[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Koha-cvs] koha bull-home.pl bull/lateissues.pl bull/state... [rel_2_2]
From: |
Robert Lyon |
Subject: |
[Koha-cvs] koha bull-home.pl bull/lateissues.pl bull/state... [rel_2_2] |
Date: |
Fri, 24 Nov 2006 00:23:23 +0000 |
CVSROOT: /sources/koha
Module name: koha
Branch: rel_2_2
Changes by: Robert Lyon <bob_lyon> 06/11/24 00:23:22
Modified files:
. : bull-home.pl
bull : lateissues.pl statecollection.pl
subscription-add.pl subscription-detail.pl
subscription-renew.pl
koha-tmpl/intranet-tmpl/npl/en/bull: bull-home.tmpl
lateissues.tmpl
statecollection.tmpl
subscription-add.tmpl
subscription-detail.tmpl
subscription-renew.tmpl
koha-tmpl/intranet-tmpl/npl/en/includes: serials-topmenu.inc
updater : updatedatabase
C4 : Bull.pm
Log message:
Adding in the updated files for the routing serials
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/bull-home.pl?cvsroot=koha&only_with_tag=rel_2_2&r1=1.2.2.4&r2=1.2.2.5
http://cvs.savannah.gnu.org/viewcvs/koha/bull/lateissues.pl?cvsroot=koha&only_with_tag=rel_2_2&r1=1.1.2.6&r2=1.1.2.7
http://cvs.savannah.gnu.org/viewcvs/koha/bull/statecollection.pl?cvsroot=koha&only_with_tag=rel_2_2&r1=1.3.2.20&r2=1.3.2.21
http://cvs.savannah.gnu.org/viewcvs/koha/bull/subscription-add.pl?cvsroot=koha&only_with_tag=rel_2_2&r1=1.5.2.4&r2=1.5.2.5
http://cvs.savannah.gnu.org/viewcvs/koha/bull/subscription-detail.pl?cvsroot=koha&only_with_tag=rel_2_2&r1=1.5.2.4&r2=1.5.2.5
http://cvs.savannah.gnu.org/viewcvs/koha/bull/subscription-renew.pl?cvsroot=koha&only_with_tag=rel_2_2&r1=1.1.2.3&r2=1.1.2.4
http://cvs.savannah.gnu.org/viewcvs/koha/koha-tmpl/intranet-tmpl/npl/en/bull/bull-home.tmpl?cvsroot=koha&only_with_tag=rel_2_2&r1=1.1.2.4&r2=1.1.2.5
http://cvs.savannah.gnu.org/viewcvs/koha/koha-tmpl/intranet-tmpl/npl/en/bull/lateissues.tmpl?cvsroot=koha&only_with_tag=rel_2_2&r1=1.1.2.4&r2=1.1.2.5
http://cvs.savannah.gnu.org/viewcvs/koha/koha-tmpl/intranet-tmpl/npl/en/bull/statecollection.tmpl?cvsroot=koha&only_with_tag=rel_2_2&r1=1.2.2.12&r2=1.2.2.13
http://cvs.savannah.gnu.org/viewcvs/koha/koha-tmpl/intranet-tmpl/npl/en/bull/subscription-add.tmpl?cvsroot=koha&only_with_tag=rel_2_2&r1=1.2.2.5&r2=1.2.2.6
http://cvs.savannah.gnu.org/viewcvs/koha/koha-tmpl/intranet-tmpl/npl/en/bull/subscription-detail.tmpl?cvsroot=koha&only_with_tag=rel_2_2&r1=1.2.2.5&r2=1.2.2.6
http://cvs.savannah.gnu.org/viewcvs/koha/koha-tmpl/intranet-tmpl/npl/en/bull/subscription-renew.tmpl?cvsroot=koha&only_with_tag=rel_2_2&r1=1.1.2.1&r2=1.1.2.2
http://cvs.savannah.gnu.org/viewcvs/koha/koha-tmpl/intranet-tmpl/npl/en/includes/serials-topmenu.inc?cvsroot=koha&only_with_tag=rel_2_2&r1=1.1.2.1&r2=1.1.2.2
http://cvs.savannah.gnu.org/viewcvs/koha/updater/updatedatabase?cvsroot=koha&only_with_tag=rel_2_2&r1=1.100.2.54&r2=1.100.2.55
http://cvs.savannah.gnu.org/viewcvs/koha/C4/Bull.pm?cvsroot=koha&only_with_tag=rel_2_2&r1=1.6.2.34&r2=1.6.2.35
Patches:
Index: bull-home.pl
===================================================================
RCS file: /sources/koha/koha/Attic/bull-home.pl,v
retrieving revision 1.2.2.4
retrieving revision 1.2.2.5
diff -u -b -r1.2.2.4 -r1.2.2.5
--- bull-home.pl 5 Feb 2006 21:59:20 -0000 1.2.2.4
+++ bull-home.pl 24 Nov 2006 00:23:22 -0000 1.2.2.5
@@ -12,6 +12,8 @@
my $query = new CGI;
my $title = $query->param('title');
my $ISSN = $query->param('ISSN');
+my $routing = $query->param('routing');
+my $searched = $query->param('searched');
my $biblionumber = $query->param('biblionumber');
my @subscriptions = getsubscriptions($title,$ISSN,$biblionumber);
my ($template, $loggedinuser, $cookie)
@@ -23,10 +25,21 @@
debug => 1,
});
+# to toggle between create or edit routing list options
+if($routing){
+ for(my $i=0;$i<@subscriptions;$i++){
+ my $checkrouting =
check_routing($subscriptions[$i]->{'subscriptionid'});
+ $subscriptions[$i]->{'routingedit'} = $checkrouting;
+ # warn "check $checkrouting";
+ }
+}
+
$template->param(
subscriptions => address@hidden,
title => $title,
ISSN => $ISSN,
+ done_searched => $searched,
+ routing => $routing,
intranetcolorstylesheet =>
C4::Context->preference("intranetcolorstylesheet"),
intranetstylesheet =>
C4::Context->preference("intranetstylesheet"),
IntranetNav => C4::Context->preference("IntranetNav"),
Index: bull/lateissues.pl
===================================================================
RCS file: /sources/koha/koha/bull/Attic/lateissues.pl,v
retrieving revision 1.1.2.6
retrieving revision 1.1.2.7
diff -u -b -r1.1.2.6 -r1.1.2.7
--- bull/lateissues.pl 20 Jun 2006 16:21:43 -0000 1.1.2.6
+++ bull/lateissues.pl 24 Nov 2006 00:23:22 -0000 1.1.2.7
@@ -18,23 +18,28 @@
my $supplierid = $query->param('supplierid');
my %supplierlist = getSupplierListWithLateIssues;
my @select_supplier;
-push @select_supplier,"";
+
+my ($nothing,@supplierinfo)=bookseller($supplierid) if $supplierid;
+
foreach my $supplierid (keys %supplierlist){
+ my ($count, @dummy) = GetLateIssues($supplierid);
+ my ($count2, @dummy2) = GetMissingIssues($supplierid);
+ my $counting = $count+$count2;
+ $supplierlist{$supplierid} = $supplierlist{$supplierid}." ($counting)";
push @select_supplier, $supplierid
}
+
+my ($count, @lateissues) = GetLateIssues($supplierid);
+my ($count2, @missingissues) = GetMissingIssues($supplierid);
+
+
my $CGIsupplier=CGI::scrolling_list( -name => 'supplierid',
-values => address@hidden,
-default => $supplierid,
-labels => \%supplierlist,
-size => 1,
- -tabindex=>'',
-multiple => 0 );
-my @lateissues;
address@hidden = GetLateIssues($supplierid) if $supplierid;
-my @supplierinfo;
-my $nothing;
-($nothing,@supplierinfo)=bookseller($supplierid) if $supplierid;
my ($template, $loggedinuser, $cookie)
= get_template_and_user({template_name => "bull/lateissues.tmpl",
@@ -48,6 +53,8 @@
$template->param(
CGIsupplier => $CGIsupplier,
lateissues => address@hidden,
+ missingissues => address@hidden,
+ supplierid => $supplierid,
phone => $supplierinfo[0]->{phone},
booksellerfax => $supplierinfo[0]->{booksellerfax},
contemail => $supplierinfo[0]->{contemail},
Index: bull/statecollection.pl
===================================================================
RCS file: /sources/koha/koha/bull/Attic/statecollection.pl,v
retrieving revision 1.3.2.20
retrieving revision 1.3.2.21
diff -u -b -r1.3.2.20 -r1.3.2.21
--- bull/statecollection.pl 26 Sep 2006 10:04:06 -0000 1.3.2.20
+++ bull/statecollection.pl 24 Nov 2006 00:23:22 -0000 1.3.2.21
@@ -35,12 +35,26 @@
my @itemstatus = $query->param('itemstatus');
my @homebranches = $query->param('branch');
my $hassubscriptionexpired = hassubscriptionexpired($subscriptionid);
+my $abouttoexpire = abouttoexpire($subscriptionid);
my $subscription=getsubscription($subscriptionid);
-
+my $routing = check_routing($subscriptionid); # to see if routing list exists
+my $manualdate ='';
+my $manualissue ='';
+my $manualstatus =0;
+my $manualid ='';
+if ($op eq 'found'){
+ $manualdate = $query->param('planneddate');
+ $manualissue = $query->param('missingissue');
+ $manualstatus = 1;
+ my $sth = $dbh->prepare("select serialid from serial where subscriptionid
= ? AND serialseq = ? AND planneddate = ?");
+
$sth->execute($subscriptionid,$manualissue,format_date_in_iso($manualdate));
+ $manualid = $sth->fetchrow;
+}
if ($op eq 'modsubscriptionhistory') {
modsubscriptionhistory($subscriptionid,$histstartdate,$enddate,$recievedlist,$missinglist,$opacnote,$librariannote);
}
+
# change status except, if subscription has expired, for the "waited" issue.
if ($op eq 'serialchangestatus') {
my $sth = $dbh->prepare("select status from serial where serialid=?");
@@ -50,7 +64,11 @@
my ($oldstatus) = $sth->fetchrow;
if ($serialids[$i]) {
my $planneddate =
($planneddates[$i]?format_date_in_iso($planneddates[$i]):format_date_in_iso("today"));
+ if(C4::Context->preference("RoutingSerials")){
+
old_serialchangestatus($serialids[$i],$serialseqs[$i],format_date_in_iso($planneddates[$i]),$status[$i],$notes[$i])
unless ($hassubscriptionexpired && $oldstatus == 1);
+ } else {
serialchangestatus($serialids[$i],$serialseqs[$i],format_date_in_iso($publisheddates[$i]),$planneddate,$status[$i],$notes[$i])
unless ($hassubscriptionexpired && $oldstatus == 1);
+ }
if (($status[$i]==2) &&
C4::Context->preference("serialsadditems")){
my %info;
$info{branch}=$homebranches[$i];
@@ -58,8 +76,15 @@
$info{itemcallnumber}=$itemcallnumbers[$i];
$info{location}=$locations[$i];
$info{status}=$itemstatus[$i];
- $info{notes}=$serialseqs[$i];
+ $info{notes}=$serialseqs[$i]."
(".$planneddates[$i].")";
my ($status, @errors)=
serialsitemize($serialids[$i],\%info);
+ my $sth2 = $dbh->prepare("UPDATE
subscriptionhistory SET lastbranch = ? WHERE subscriptionid = ?");
+
$sth2->execute($homebranches[$i],$subscriptionid);
+ $sth2->finish;
+ # remove from missing list if item being
checked in is on it
+ if ($status ==1){
+
removeMissingIssue($serialseqs[$i],$subscriptionid);
+ }
}
} else {
# add a special issue
@@ -77,14 +102,23 @@
$info{itemcallnumber}=$itemcallnumbers[$i];
$info{location}=$locations[$i];
$info{status}=$itemstatus[$i];
- $info{notes}=$serialseqs[$i];
- my ($status, @errors)= serialsitemize($newserialid,\%info);
+ $info{notes}=$serialseqs[$i]." (".$planneddates[$i].")";
+ my ($status2, @errors)= serialsitemize($newserialid,\%info);
+
+ my $sth2 = $dbh->prepare("UPDATE
subscriptionhistory SET lastbranch = ? WHERE subscriptionid = ?");
+
$sth2->execute($homebranches[$i],$subscriptionid);
+ $sth2->finish;
+ # remove from missing list if item being
checked in is on it
+ if ($status2 ==1){
+
removeMissingIssue($serialseqs[$i],$subscriptionid);
+ }
}
}
}
}
}
+
my ($template, $loggedinuser, $cookie)
= get_template_and_user({template_name => "bull/statecollection.tmpl",
query => $query,
@@ -95,7 +129,24 @@
});
my $subs = &getsubscription($subscriptionid);
-my ($totalissues,@serialslist) = getserials($subscriptionid);
+my ($totalissues,@serialslist);
+if(C4::Context->preference("RoutingSerials")){
+ ($totalissues,@serialslist) = old_getserials($subscriptionid);
+} else {
+ ($totalissues,@serialslist) = getserials($subscriptionid);
+}
+
+my $count = @serialslist;
+for(my $i=0;$i<$count;$i++){
+ $serialslist[$i]->{'callnumber'} = $subscription->{'callnumber'};
+ my $temp = rand(10000000);
+ $serialslist[$i]->{'barcode'} = "TEMP" . sprintf("%.0f",$temp);
+}
+
+my $sth=$dbh->prepare("select * from subscriptionhistory where subscriptionid
= ?");
+$sth->execute($subscriptionid);
+my $solhistory = $sth->fetchrow_hashref;
+
if (C4::Context->preference("serialsadditems")){
my
$bibid=MARCfind_MARCbibid_from_oldbiblionumber($dbh,$subscription->{biblionumber});
@@ -104,18 +155,25 @@
my $branches = getbranches;
my @branchloop;
foreach my $thisbranch (keys %$branches) {
+ my $selected = 0;
+ if($thisbranch eq $solhistory->{'lastbranch'}){
+ $selected = 1;
+ }
my %row =(value => $thisbranch,
branchname =>
$branches->{$thisbranch}->{'branchname'},
+ selected => $selected,
);
push @branchloop, \%row;
}
my $itemstatushash = getitemstatus($fwk);
my @itemstatusloop;
+ my $itemstatusloopcount=0;
foreach my $thisitemstatus (keys %$itemstatushash) {
my %row =(itemval => $thisitemstatus,
itemlib =>
$itemstatushash->{$thisitemstatus},
);
+ $itemstatusloopcount++;
push @itemstatusloop, \%row;
}
@@ -127,6 +185,8 @@
);
push @itemlocationloop, \%row;
}
+ my $choice = 0;
+ if($itemstatusloopcount == 1){ $choice = 1;}
foreach my $data (@serialslist){
if
(scalar(@itemstatusloop)){$data->{"itemstatusloop"address@hidden;}
else { $data->{"itemstatusloop"}=[];}
@@ -134,6 +194,7 @@
else {$data->{"itemlocationloop"}=[];}
$data->{"branchloop"address@hidden ;
}
+ $template->param(choice => $choice);
$template->param(serialadditems
=>C4::Context->preference("serialsadditems"),
branchloop => address@hidden,
) ;
@@ -143,13 +204,11 @@
$template->param(branchloop=>[],itemstatusloop=>[],itemlocationloop=>[]) ;
}
-my $sth=$dbh->prepare("select * from subscriptionhistory where subscriptionid
= ?");
-$sth->execute($subscriptionid);
-my $solhistory = $sth->fetchrow_hashref;
-
$template->param(
+ user => $auser,
serialslist => address@hidden,
+ count => $count,
biblionumber => $subscription->{biblionumber},
histstartdate =>
format_date($solhistory->{'histstartdate'}),
enddate => format_date($solhistory->{'enddate'}),
@@ -161,8 +220,16 @@
bibliotitle => $subs->{bibliotitle},
biblionumber => $subs->{biblionumber},
hassubscriptionexpired =>$hassubscriptionexpired,
+ abouttoexpire =>$abouttoexpire,
intranetcolorstylesheet =>
C4::Context->preference("intranetcolorstylesheet"),
intranetstylesheet =>
C4::Context->preference("intranetstylesheet"),
IntranetNav => C4::Context->preference("IntranetNav"),
+ routing => $routing,
+ missingseq => $manualissue,
+ frommissing => $manualstatus,
+ missingdate => $manualdate,
+ missingid => $manualid,
);
output_html_with_http_headers $query, $cookie, $template->output;
+
+
Index: bull/subscription-add.pl
===================================================================
RCS file: /sources/koha/koha/bull/Attic/subscription-add.pl,v
retrieving revision 1.5.2.4
retrieving revision 1.5.2.5
diff -u -b -r1.5.2.4 -r1.5.2.5
--- bull/subscription-add.pl 12 May 2006 08:36:05 -0000 1.5.2.4
+++ bull/subscription-add.pl 24 Nov 2006 00:23:22 -0000 1.5.2.5
@@ -7,23 +7,23 @@
use C4::Auth;
use C4::Date;
use C4::Output;
-use C4::Bull;
use C4::Acquisition;
use C4::Interface::CGI::Output;
use C4::Context;
use HTML::Template;
use C4::Bull;
+use Date::Manip;
my $query = new CGI;
my $op = $query->param('op');
my $dbh = C4::Context->dbh;
my ($subscriptionid,$auser,$librarian,$cost,$aqbooksellerid,
$aqbooksellername,$aqbudgetid, $bookfundid, $startdate, $periodicity,
- $dow, $numberlength, $weeklength, $monthlength,
+ $firstacquidate, $dow, $irregularity, $numberpattern, $numberlength,
$weeklength, $monthlength, $sublength,
$add1,$every1,$whenmorethan1,$setto1,$lastvalue1,$innerloop1,
$add2,$every2,$whenmorethan2,$setto2,$lastvalue2,$innerloop2,
$add3,$every3,$whenmorethan3,$setto3,$lastvalue3,$innerloop3,
$numberingmethod, $status, $biblionumber,
- $bibliotitle, $notes);
+ $bibliotitle, $callnumber, $notes, $hemisphere);
my @budgets;
my ($template, $loggedinuser, $cookie)
@@ -36,6 +36,29 @@
});
+my $weekarrayjs='';
+my $count = 0;
+my ($year, $month, $day) = UnixDate("today", "%Y", "%m", "%d");
+my $firstday = Date_DayOfYear($month,$day,$year);
+my $wkno = Date_WeekOfYear($month,$day,$year,1); # week starting monday
+my $weekno = $wkno;
+for(my $i=$firstday;$i<($firstday+365);$i=$i+7){
+ $count = $i;
+ if($wkno > 52){$year++; $wkno=1;}
+ if($count>365){$count=$i-365;}
+ my ($y,$m,$d) = Date_NthDayOfYear($year,$count);
+ my $output = "$y-$m-$d";
+ $weekarrayjs .= "'Wk $wkno: ".format_date($output)."',";
+ $wkno++;
+}
+chop($weekarrayjs);
+# warn $weekarrayjs;
+
+my $sub_on;
+my @subscription_types = (
+ 'issues', 'weeks', 'months'
+ );
+my @sub_type_data;
if ($op eq 'mod') {
my $subscriptionid = $query->param('subscriptionid');
my $subs = &getsubscription($subscriptionid);
@@ -47,11 +70,38 @@
$bookfundid = $subs->{'bookfundid'};
$aqbudgetid = $subs->{'aqbudgetid'};
$startdate = $subs->{'startdate'};
+ $firstacquidate = $subs->{'firstacquidate'};
$periodicity = $subs->{'periodicity'};
$dow = $subs->{'dow'};
+ $irregularity = $subs->{'irregularity'};
+ $numberpattern = $subs->{'numberpattern'};
$numberlength = $subs->{'numberlength'};
$weeklength = $subs->{'weeklength'};
$monthlength = $subs->{'monthlength'};
+
+ if($monthlength > 0){
+ $sublength = $monthlength;
+ $sub_on = $subscription_types[2];
+ } elsif ($weeklength>0){
+ $sublength = $weeklength;
+ $sub_on = $subscription_types[1];
+ } else {
+ $sublength = $numberlength;
+ $sub_on = $subscription_types[0];
+ }
+
+
+ while (@subscription_types) {
+ my $sub_type = shift @subscription_types;
+ my %row = ( 'name' => $sub_type );
+ if ( $sub_on eq $sub_type ) {
+ $row{'selected'} = ' selected';
+ } else {
+ $row{'selected'} = '';
+ }
+ push( @sub_type_data, \%row );
+ }
+
$add1 = $subs->{'add1'};
$every1 = $subs->{'every1'};
$whenmorethan1 = $subs->{'whenmorethan1'};
@@ -73,8 +123,10 @@
$numberingmethod = $subs->{'numberingmethod'};
$status = $subs->{status};
$biblionumber = $subs->{'biblionumber'};
- $bibliotitle = $subs->{'bibliotitle'},
+ $bibliotitle = $subs->{'bibliotitle'};
+ $callnumber = $subs->{'callnumber'};
$notes = $subs->{'notes'};
+ $hemisphere = $subs->{'hemisphere'};
$template->param(
$op => 1,
user => $auser,
@@ -85,11 +137,13 @@
aqbudgetid => $aqbudgetid,
bookfundid => $bookfundid,
startdate => format_date($startdate),
+ firstacquidate => format_date($firstacquidate),
periodicity => $periodicity,
dow => $dow,
- numberlength => $numberlength,
- weeklength => $weeklength,
- monthlength => $monthlength,
+ irregularity => $irregularity,
+ numberpattern => $numberpattern,
+ sublength => $sublength,
+ subtype => address@hidden,
add1 => $add1,
every1 => $every1,
whenmorethan1 => $whenmorethan1,
@@ -112,12 +166,18 @@
status => $status,
biblionumber => $biblionumber,
bibliotitle => $bibliotitle,
+ callnumber => $callnumber,
notes => $notes,
subscriptionid => $subscriptionid,
+ weekarrayjs => $weekarrayjs,
+ weekno => $weekno,
+ hemisphere => $hemisphere,
);
+
$template->param(
"periodicity$periodicity" => 1,
"dow$dow" => 1,
+ "numberpattern$numberpattern" => 1,
);
}
(my $temp,@budgets) = bookfunds();
@@ -134,46 +194,92 @@
);
if ($op eq 'addsubscription') {
+ my @irregular = $query->param('irregular');
+ my $irregular_count = @irregular;
+ for(my $i =0;$i<$irregular_count;$i++){
+ $irregularity .=$irregular[$i]."|";
+ }
+ $irregularity =~ s/\|$//;
+
my $auser = $query->param('user');
my $aqbooksellerid = $query->param('aqbooksellerid');
my $cost = $query->param('cost');
my $aqbudgetid = $query->param('aqbudgetid');
my $startdate = $query->param('startdate');
+ my $firstacquidate = $query->param('firstacquidate');
my $periodicity = $query->param('periodicity');
my $dow = $query->param('dow');
- my $numberlength = $query->param('numberlength');
- my $weeklength = $query->param('weeklength');
- my $monthlength = $query->param('monthlength');
+ # my $irregularity = $query->param('irregularity');
+ my $numberlength = 0;
+ my $weeklength = 0;
+ my $monthlength = 0;
+ my $numberpattern = $query->param('numbering_pattern');
+ my $sublength = $query->param('sublength');
+ my $subtype = $query->param('subtype');
+ if ($subtype eq 'months'){
+ $monthlength = $sublength;
+ } elsif ($subtype eq 'weeks'){
+ $weeklength = $sublength;
+ } else {
+ $numberlength = $sublength;
+ }
+
my $add1 = $query->param('add1');
my $every1 = $query->param('every1');
my $whenmorethan1 = $query->param('whenmorethan1');
my $setto1 = $query->param('setto1');
my $lastvalue1 = $query->param('lastvalue1');
- my $innerloop1 = $query->param('innerloop1');
my $add2 = $query->param('add2');
my $every2 = $query->param('every2');
my $whenmorethan2 = $query->param('whenmorethan2');
my $setto2 = $query->param('setto2');
my $lastvalue2 = $query->param('lastvalue2');
- my $innerloop2 = $query->param('innerloop2');
my $add3 = $query->param('add3');
my $every3 = $query->param('every3');
my $whenmorethan3 = $query->param('whenmorethan3');
my $setto3 = $query->param('setto3');
my $lastvalue3 = $query->param('lastvalue3');
- my $innerloop3 = $query->param('innerloop3');
my $numberingmethod = $query->param('numberingmethod');
my $status = 1;
my $biblionumber = $query->param('biblionumber');
+ my $callnumber = $query->param('callnumber');
my $notes = $query->param('notes');
- my $subscriptionid =
newsubscription($auser,$aqbooksellerid,$cost,$aqbudgetid,$biblionumber,
+ my $hemisphere = $query->param('hemisphere') || 1;
+ my $subscriptionid;
+if(C4::Context->preference("RoutingSerials")){
+ $subscriptionid =
old_newsubscription($auser,$aqbooksellerid,$cost,$aqbudgetid,$biblionumber,
+
$startdate,$periodicity,$firstacquidate,$dow,$irregularity,$numberpattern,$numberlength,$weeklength,$monthlength,
+
$add1,$every1,$whenmorethan1,$setto1,$lastvalue1,
+
$add2,$every2,$whenmorethan2,$setto2,$lastvalue2,
+
$add3,$every3,$whenmorethan3,$setto3,$lastvalue3,
+ $numberingmethod, $status, $callnumber,
$notes, $hemisphere
+ );
+ } else {
+ $subscriptionid =
newsubscription($auser,$aqbooksellerid,$cost,$aqbudgetid,$biblionumber,
$startdate,$periodicity,$dow,$numberlength,$weeklength,$monthlength,
-
$add1,$every1,$whenmorethan1,$setto1,$lastvalue1,$innerloop1,
-
$add2,$every2,$whenmorethan2,$setto2,$lastvalue2,$innerloop2,
-
$add3,$every3,$whenmorethan3,$setto3,$lastvalue3,$innerloop3,
+
$add1,$every1,$whenmorethan1,$setto1,$lastvalue1,
+
$add2,$every2,$whenmorethan2,$setto2,$lastvalue2,
+
$add3,$every3,$whenmorethan3,$setto3,$lastvalue3,
$numberingmethod, $status, $notes
);
+
+ }
print
$query->redirect("/cgi-bin/koha/bull/subscription-detail.pl?subscriptionid=$subscriptionid");
} else {
+
+ while (@subscription_types) {
+ my $sub_type = shift @subscription_types;
+ my %row = ( 'name' => $sub_type );
+ if ( $sub_on eq $sub_type ) {
+ $row{'selected'} = ' selected';
+ } else {
+ $row{'selected'} = '';
+ }
+ push( @sub_type_data, \%row );
+ }
+ $template->param(subtype => address@hidden,
+ weekarrayjs => $weekarrayjs,
+ weekno => $weekno,
+ );
output_html_with_http_headers $query, $cookie, $template->output;
}
Index: bull/subscription-detail.pl
===================================================================
RCS file: /sources/koha/koha/bull/Attic/subscription-detail.pl,v
retrieving revision 1.5.2.4
retrieving revision 1.5.2.5
diff -u -b -r1.5.2.4 -r1.5.2.5
--- bull/subscription-detail.pl 13 Feb 2006 07:11:54 -0000 1.5.2.4
+++ bull/subscription-detail.pl 24 Nov 2006 00:23:22 -0000 1.5.2.5
@@ -10,6 +10,7 @@
use C4::Interface::CGI::Output;
use C4::Context;
use HTML::Template;
+use Date::Manip;
my $query = new CGI;
my $op = $query->param('op');
@@ -18,15 +19,22 @@
# my $id;
my ($template, $loggedinuser, $cookie, $subs);
my ($subscriptionid,$auser,$librarian,$cost,$aqbooksellerid,
$aqbooksellername,$aqbudgetid, $bookfundid, $startdate, $periodicity,
- $dow, $numberlength, $weeklength, $monthlength,
+ $firstacquidate, $dow, $irregularity, $sublength, $subtype,
$numberpattern, $numberlength, $weeklength, $monthlength,
$add1,$every1,$whenmorethan1,$setto1,$lastvalue1,$innerloop1,
$add2,$every2,$whenmorethan2,$setto2,$lastvalue2,$innerloop2,
$add3,$every3,$whenmorethan3,$setto3,$lastvalue3,$innerloop3,
- $numberingmethod, $status, $biblionumber, $bibliotitle, $notes);
+ $numberingmethod, $status, $biblionumber, $bibliotitle, $callnumber,
$notes, $hemisphere);
$subscriptionid = $query->param('subscriptionid');
if ($op eq 'modsubscription') {
+ my @irregular = $query->param('irregular');
+ my $irregular_count = @irregular;
+ for(my $i =0;$i<$irregular_count;$i++){
+ $irregularity .=$irregular[$i]."|";
+ }
+ $irregularity =~ s/\|$//;
+
$auser = $query->param('user');
$librarian => $query->param('librarian'),
$cost = $query->param('cost');
@@ -35,10 +43,24 @@
$aqbudgetid = $query->param('aqbudgetid');
$startdate = format_date_in_iso($query->param('startdate'));
$periodicity = $query->param('periodicity');
+ $firstacquidate = format_date_in_iso($query->param('firstacquidate'));
$dow = $query->param('dow');
+ $numberpattern = $query->param('numbering_pattern');
+ if(C4::Context->preference("RoutingSerials")){
+ $sublength = $query->param('sublength');
+ $subtype = $query->param('subtype');
+ if($subtype eq 'months'){
+ $monthlength = $sublength;
+ } elsif ($subtype eq 'weeks'){
+ $weeklength = $sublength;
+ } else {
+ $numberlength = $sublength;
+ }
+ } else {
$numberlength = $query->param('numberlength');
$weeklength = $query->param('weeklength');
$monthlength = $query->param('monthlength');
+ }
$add1 = $query->param('add1');
$every1 = $query->param('every1');
$whenmorethan1 = $query->param('whenmorethan1');
@@ -59,14 +81,24 @@
$innerloop3 = $query->param('innerloop3');
$numberingmethod = $query->param('numberingmethod');
$status = 1;
+ $callnumber = $query->param('callnumber');
+ $hemisphere = $query->param('hemisphere');
$notes = $query->param('notes');
-
+ if(C4::Context->preference("RoutingSerials")){
+
&old_modsubscription($auser,$aqbooksellerid,$cost,$aqbudgetid,$startdate,
+
$periodicity,$firstacquidate,$dow,$irregularity,$numberpattern,$numberlength,$weeklength,$monthlength,
+
$add1,$every1,$whenmorethan1,$setto1,$lastvalue1,$innerloop1,
+
$add2,$every2,$whenmorethan2,$setto2,$lastvalue2,$innerloop2,
+
$add3,$every3,$whenmorethan3,$setto3,$lastvalue3,$innerloop3,
+ $numberingmethod, $status,
$biblionumber, $callnumber, $notes, $hemisphere, $subscriptionid);
+ } else {
&modsubscription($auser,$aqbooksellerid,$cost,$aqbudgetid,$startdate,
$periodicity,$dow,$numberlength,$weeklength,$monthlength,
$add1,$every1,$whenmorethan1,$setto1,$lastvalue1,$innerloop1,
$add2,$every2,$whenmorethan2,$setto2,$lastvalue2,$innerloop2,
$add3,$every3,$whenmorethan3,$setto3,$lastvalue3,$innerloop3,
$numberingmethod, $status,
$biblionumber, $notes, $subscriptionid);
+ }
}
if ($op eq 'del') {
@@ -92,6 +124,23 @@
my ($user, $cookie, $sessionID, $flags)
= checkauth($query, 0, {catalogue => 1}, "intranet");
+my $weekarrayjs='';
+my $count = 0;
+my ($year, $month, $day) = UnixDate("today", "%Y", "%m", "%d");
+my $firstday = Date_DayOfYear($month,$day,$year);
+my $wkno = Date_WeekOfYear($month,$day,$year,1); # week starting monday
+my $weekno = $wkno;
+for(my $i=$firstday;$i<($firstday+365);$i=$i+7){
+ $count = $i;
+ if($wkno > 52){$year++; $wkno=1;}
+ if($count>365){$count=$i-365;}
+ my ($y,$m,$d) = Date_NthDayOfYear($year,$count);
+ my $output = "$y-$m-$d";
+ $weekarrayjs .= "'Wk $wkno: ".format_date($output)."',";
+ $wkno++;
+ }
+chop($weekarrayjs);
+
$template->param(
user => $subs->{auser},
librarian => $subs->{librarian},
@@ -102,10 +151,13 @@
bookfundid => $subs->{bookfundid},
startdate => format_date($subs->{startdate}),
periodicity => $subs->{periodicity},
+ firstacquidate => format_date($subs->{firstacquidate}),
dow => $subs->{dow},
+ irregularity => $subs->{irregularity},
numberlength => $subs->{numberlength},
weeklength => $subs->{weeklength},
monthlength => $subs->{monthlength},
+ numberpattern => $subs->{numberpattern},
add1 => $subs->{add1},
every1 => $subs->{every1},
whenmorethan1 => $subs->{whenmorethan1},
@@ -132,8 +184,12 @@
subscriptionid => $subs->{subscriptionid},
serialslist => address@hidden,
totalissues => $totalissues,
+ weekarrayjs => $weekarrayjs,
+ callnumber => $subs->{callnumber},
+ hemisphere => $hemisphere,
);
$template->param(
+ "numberpattern$subs->{numberpattern}" => 1,
"periodicity$subs->{periodicity}" => 1,
"arrival$subs->{dow}" => 1,
intranetstylesheet =>
C4::Context->preference("intranetstylesheet"),
Index: bull/subscription-renew.pl
===================================================================
RCS file: /sources/koha/koha/bull/Attic/subscription-renew.pl,v
retrieving revision 1.1.2.3
retrieving revision 1.1.2.4
diff -u -b -r1.1.2.3 -r1.1.2.4
--- bull/subscription-renew.pl 5 Feb 2006 21:59:21 -0000 1.1.2.3
+++ bull/subscription-renew.pl 24 Nov 2006 00:23:22 -0000 1.1.2.4
@@ -37,7 +37,7 @@
my $op = $query->param('op');
my $subscriptionid = $query->param('subscriptionid');
-
+my $done = 0; # for after form has been submitted
my ($template, $loggedinuser, $cookie)
= get_template_and_user({template_name =>
"bull/subscription-renew.tmpl",
query => $query,
@@ -48,6 +48,7 @@
});
if ($op eq "renew") {
subscriptionrenew($subscriptionid,$loggedinuser,$query->param('startdate'),$query->param('numberlength'),$query->param('weeklength'),$query->param('monthlength'),$query->param('note'));
+ $done = 1;
}
my $subscription= getsubscription($subscriptionid);
@@ -59,6 +60,7 @@
subscriptionid => $subscriptionid,
bibliotitle => $subscription->{bibliotitle},
$op => 1,
+ done => $done,
intranetcolorstylesheet =>
C4::Context->preference("intranetcolorstylesheet"),
intranetstylesheet =>
C4::Context->preference("intranetstylesheet"),
IntranetNav => C4::Context->preference("IntranetNav"),
Index: koha-tmpl/intranet-tmpl/npl/en/bull/bull-home.tmpl
===================================================================
RCS file:
/sources/koha/koha/koha-tmpl/intranet-tmpl/npl/en/bull/Attic/bull-home.tmpl,v
retrieving revision 1.1.2.4
retrieving revision 1.1.2.5
diff -u -b -r1.1.2.4 -r1.1.2.5
--- koha-tmpl/intranet-tmpl/npl/en/bull/bull-home.tmpl 10 Jan 2006 21:30:36
-0000 1.1.2.4
+++ koha-tmpl/intranet-tmpl/npl/en/bull/bull-home.tmpl 24 Nov 2006 00:23:22
-0000 1.1.2.5
@@ -1,68 +1,86 @@
-<!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->Koha -- Serials
Subscriptions<!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
+<!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->Koha -- Subscriptions <!--
TMPL_INCLUDE NAME="doc-head-close.inc" -->
<!-- TMPL_INCLUDE NAME="masthead.inc" -->
<!-- TMPL_INCLUDE NAME="serials-topmenu.inc" -->
<!-- TMPL_INCLUDE NAME="intranet-nav.inc" -->
+<!--------------------------MAIN BODY OF PAGE-------------------------->
<div id="main">
-<form action="bull-home.pl" method="post">
- <table>
- <caption>Serials Subscriptions</caption>
- <tr>
- <th>ISSN</th>
- <th>Title</th>
- <th>
- Note
- </td>
- <th colspan="2"> </th>
- </tr>
+ <h1 class="bull">Serials Management</h1>
+<!-- TMPL_IF NAME="routing" -->
+ <h3 class="bull">Search for Serial Routing List</h3>
+<!-- /TMPL_IF -->
+ <p>
+ <form action="bull-home.pl" method="post">
+ <input type="hidden" name="routing" value="<!-- TMPL_VAR
+NAME="routing" -->" />
+ <input type="hidden" name="searched" value="1" />
+
+ Title: <input type="text" size=20 maxlength=40 name="title" value="<!--
TMPL_VAR name="title" -->"> or ISSN: <input type="text" size=11 maxlength=11
name="ISSN" value="<!-- TMPL_VAR name="ISSN" -->">
+ <input type="submit" value="Search" class="button">
+ </p>
+
+ <!-- TMPL_IF name="subscriptions" -->
+ <table cellpadding="0" cellspacing="0" border="0" class="collapse">
<tr>
- <td>
- <input type="text" size="10" maxlength="11"
name="ISSN" value="<!-- TMPL_VAR name="ISSN" -->" title="type ISSN here to
filter subscription" />
- </td>
- <td>
- <input type="text" size="40" maxlength="40"
name="title" value="<!-- TMPL_VAR name="title" -->" title="type a title
-complete or partial- to filter subscription" />
- </td>
- <td>
-
- </td>
- <td colspan="2">
- <input type="submit" value="Filter"
class="submit" title="set a filter on ISSN / title" />
- </td>
+ <th class="cell-header">Title</th>
+ <th class="cell-header">ISSN</th>
+ <th class="cell-header"
+ <!-- TMPL_IF NAME="routing" -->
+
+ <!-- TMPL_ELSE -->
+ colspan="2"
+ <!-- /TMPL_IF -->
+ > </th>
</tr>
<!-- TMPL_LOOP name="subscriptions" -->
- <!-- TMPL_IF name="toggle" -->
- <tr class="highlight">
- <!-- TMPL_ELSE -->
<tr>
- <!-- /TMPL_IF -->
- <td>
- <!-- TMPL_IF name="ISSN" -->
- <a
href="bull/serial-issues.pl?biblionumber=<!-- TMPL_VAR name="biblionumber" -->"
title="Issues history"><!-- TMPL_VAR name="ISSN" --></a>
- <!-- /TMPL_IF -->
-
+ <td class="cell">
+ <!-- TMPL_VAR name="title" --> <!--
TMPL_IF name="notes" -->(<!-- TMPL_VAR name="notes" -->)<!-- /TMPL_IF -->
</td>
- <td>
- <!-- TMPL_IF name="title" -->
- <!-- TMPL_VAR name="title" -->
- <!-- TMPL_ELSE -->
- |
- <!-- /TMPL_IF -->
+ <td class="cell">
+ <!-- TMPL_VAR name="ISSN" -->
</td>
- <td>
- <!-- TMPL_IF
name="notes" -->(<!-- TMPL_VAR name="notes" -->)<!-- /TMPL_IF -->
+ <!-- TMPL_IF NAME="routing" -->
+ <td class="cell">
+ <a
+href="bull/routing.pl?subscriptionid=<!-- TMPL_VAR name="subscriptionid"
+--><!-- TMPL_UNLESS NAME="routingedit" -->&op=new<!-- /TMPL_UNLESS
-->">Routing List</a>
</td>
- <td>
- <a
href="bull/subscription-detail.pl?subscriptionid=<!-- TMPL_VAR
name="subscriptionid" -->" title="subscription detail">Detail</a>
+ <!-- TMPL_ELSE -->
+ <td class="cell">
+ <a
href="bull/subscription-detail.pl?subscriptionid=<!-- TMPL_VAR
name="subscriptionid" -->">Detail</a>
</td>
- <td>
- <a
href="bull/statecollection.pl?subscriptionid=<!-- TMPL_VAR
name="subscriptionid" -->" title="receive issues for this
subscription">Receive</a>
+ <td class="cell">
+ <a
href="bull/statecollection.pl?subscriptionid=<!-- TMPL_VAR
name="subscriptionid" -->">Receive</a>
</td>
+ <!-- /TMPL_IF -->
</tr>
<!-- /TMPL_LOOP -->
</table>
- </form>
- <p><form action="/cgi-bin/koha/bull/subscription-add.pl"
method="get"><input type="submit" value="Add Subscription" class="submit"
/></form></p>
-</div>
+ <!-- TMPL_ELSE -->
+ <!-- TMPL_IF NAME="done_searched" -->
+ <p><b>Item not in subscriptions yet - please click 'Add
a Subscription'</b></p>
+ <!-- /TMPL_IF -->
+ <!-- /TMPL_IF -->
+<br />
+<!-- TMPL_IF NAME="routing" -->
+<!-- TMPL_ELSE -->
+<p>Search for serials subscriptions first before adding a new one.</p>
+<p>
+ <a href="/cgi-bin/koha/bull/subscription-add.pl" class="button
bull">Add subscription</a>
+</p>
+<h4 class="bull">
+ Notes:
+</h4>
+<ul>
+ <li>
+ The serials subscriptions module allows you to manage
subscription arrivals and scheduling.
+ </li>
+ <li>
+ <b>Before</b> each item can be issued, it must be entered into
Koha through the Acquisitions process.
+ </li>
+</ul>
+<!-- /TMPL_IF -->
+</div>
<!-- TMPL_INCLUDE NAME="intranet-bottom.inc" -->
-
Index: koha-tmpl/intranet-tmpl/npl/en/bull/lateissues.tmpl
===================================================================
RCS file:
/sources/koha/koha/koha-tmpl/intranet-tmpl/npl/en/bull/Attic/lateissues.tmpl,v
retrieving revision 1.1.2.4
retrieving revision 1.1.2.5
diff -u -b -r1.1.2.4 -r1.1.2.5
--- koha-tmpl/intranet-tmpl/npl/en/bull/lateissues.tmpl 10 Apr 2006 18:18:11
-0000 1.1.2.4
+++ koha-tmpl/intranet-tmpl/npl/en/bull/lateissues.tmpl 24 Nov 2006 00:23:22
-0000 1.1.2.5
@@ -4,7 +4,7 @@
<!-- TMPL_INCLUDE NAME="intranet-nav.inc" -->
<div id="main">
-
+<!-- TMPL_IF NAME="lateissues" -->
<h1>Late issues</h1>
<div class="details">
<form action="lateissues.pl" method="post">
@@ -13,10 +13,12 @@
<!-- TMPL_IF name="booksellerfax" -->Fax: <!--
TMPL_VAR name="booksellerfax" -->; <!-- /TMPL_IF -->
<!-- TMPL_IF name="contemail" --><a
href="mailto:<!-- TMPL_VAR name="contemail" -->"><!-- TMPL_VAR name="contemail"
--></a><!-- /TMPL_IF -->
<input type="submit" value="Submit" class="submit" />
+ <a href="lateissues-excel.pl?supplierid=<!--TMPL_VAR
NAME="supplierid"-->">Export Data</a>
</form>
</div>
<table>
<tr>
+ <th>Supplier</th>
<th>Title</th>
<th>Issue number</th>
<th>Late since</th>
@@ -28,6 +30,7 @@
<!-- TMPL_ELSE -->
<tr class="highlight">
<!-- /TMPL_IF -->
+ <td><!-- TMPL_VAR name="name" --></td>
<td><!-- TMPL_IF name="Title" --><a
href="/cgi-bin/koha/bull/subscription-detail.pl?subscriptionid=<!-- TMPL_VAR
name="subscriptionid" -->"><!-- TMPL_VAR name="Title" --></a><!-- /TMPL_IF
--></td>
<td><!-- TMPL_VAR name="serialseq"
--></td>
<td><!-- TMPL_VAR name="planneddate"
--></td>
@@ -38,7 +41,43 @@
</tr>
<!-- /TMPL_LOOP -->
</table>
-</div>
+<!-- TMPL_ELSE -->
+ <p>There are currently no outstanding issues.</p>
+<!-- /TMPL_IF -->
+
+
+<!-- TMPL_IF NAME="missingissues" -->
+ <h1>Missing Issues</h1>
+ <table>
+ <tr>
+ <th>Supplier</th>
+ <th>Title</th>
+ <th>Issue number</th>
+ <th>Missing since</th>
+ <th> </th>
+ </tr>
+ <!-- TMPL_LOOP name="missingissues" -->
+ <tr>
+ <td>
+ <!-- TMPL_VAR name="name" -->
+ </td>
+ <td>
+ <!-- TMPL_VAR name="Title" -->
+ </td>
+ <td>
+ <!-- TMPL_VAR name="serialseq" -->
+ </td>
+ <td>
+ <!-- TMPL_VAR name="planneddate" -->
+ </td>
+ <td>
+ <a
href="statecollection.pl?op=found&planneddate=<!-- TMPL_VAR
name="planneddate" -->&missingissue=<!-- TMPL_VAR name="serialseq"
-->&subscriptionid=<!-- TMPL_VAR name="subscriptionid" -->">Recieve</a>
+ </td>
+ </tr>
+ <!-- /TMPL_LOOP -->
+ </table>
+<!-- /TMPL_IF -->
+</div>
<!-- TMPL_INCLUDE NAME="intranet-bottom.inc" -->
Index: koha-tmpl/intranet-tmpl/npl/en/bull/statecollection.tmpl
===================================================================
RCS file:
/sources/koha/koha/koha-tmpl/intranet-tmpl/npl/en/bull/Attic/statecollection.tmpl,v
retrieving revision 1.2.2.12
retrieving revision 1.2.2.13
diff -u -b -r1.2.2.12 -r1.2.2.13
--- koha-tmpl/intranet-tmpl/npl/en/bull/statecollection.tmpl 4 Aug 2006
15:05:58 -0000 1.2.2.12
+++ koha-tmpl/intranet-tmpl/npl/en/bull/statecollection.tmpl 24 Nov 2006
00:23:22 -0000 1.2.2.13
@@ -18,6 +18,12 @@
<input type="hidden" name="bib" value="<!-- TMPL_VAR name="biblionumber" -->"
/>
<input class="submit" type="submit" title="go to <!-- TMPL_VAR
name="bibliotitle" -->" value="View Biblio Record" /></form>
+<!-- TMPL_IF NAME="routing" -->
+<form class="inline" method="get" action="/cgi-bin/koha/bull/routing.pl">
+<input type="hidden" name="subscriptionid" value="<!-- TMPL_VAR
name="subscriptionid" -->" />
+<input class="submit" type="submit" title="Routing list" value="Routing List"
/></form>
+<!-- /TMPL_IF -->
+
<form method="post" name="f" action="statecollection.pl">
<input type="hidden" name="op" value="serialchangestatus" />
<input type="hidden" name="serial" value="<!-- TMPL_VAR
name="serial" -->" />
@@ -127,7 +133,7 @@
<!-- TMPL_UNLESS name="hassubscriptionexpired" -->
<tr><th scope="row"><label
for="manual-serialseq">Numbered:</label> </th>
<td>
- <input type="text" id="manual-serialseq"
name="serialseq" size="30" maxlength="100" />
+ <input type="text" id="manual-serialseq"
name="serialseq" size="30" maxlength="100" value="<!-- TMPL_VAR
NAME="missingseq" -->" />
</td>
</tr>
<tr>
@@ -136,15 +142,24 @@
</tr>
<tr><th scope="row"><label
for="manual-planneddate">Expected On: </label></th>
<td>
- <input type="text" id="manual-planneddate"
name="planneddate" size="10" maxlength="15" />
+ <input type="text" id="manual-planneddate"
name="planneddate" size="10" maxlength="15" value="<!-- TMPL_VAR
NAME="missingdate" -->" />
</td></tr>
<tr><th scope="row"><label
for="manual-status">Status:</label> </th>
<td>
- <input type="hidden" id="serialid"
name="serialid" value="0" />
+
+ <!-- TMPL_IF NAME="frommissing" -->
+ <input type="hidden" id="serialid"
name="serialid" value="<!-- TMPL_VAR name="missingid" -->">
+ <!-- TMPL_ELSE -->
+ <input type="hidden" id="serialid"
name="serialid" value="0">
+ <!--/TMPL_IF-->
<select id="manual-status" name="status"
size="1">
+ <!-- TMPL_IF NAME="frommissing" -->
+ <option value="2" selected
>Arrived</option>
+ <!-- TMPL_ELSE -->
<option
value="2">Arrived</option>
<option value="3"
selected>Late</option>
<option
value="4">Missing</option>
+ <!-- /TMPL_IF -->
</select>
</td>
</tr>
@@ -191,6 +206,15 @@
<!-- TMPL_IF name="hassubscriptionexpired" -->
<p>Subscription has expired. Last waiting issue status can't be
changed. <a href="#" onclick="popup()">Renew</a> your subscription</p>
<!-- /TMPL_IF -->
+ <!-- TMPL_IF name="abouttoexpire" -->
+ <h3>Note: Subscription is about to expire next issue.</h3>
+ <script type="text/javascript">
+ <!--
+ alert("Subscription is about to expire next issue");
+ //-->
+ </script>
+ <!-- /TMPL_IF -->
+
</form></div><br>
<div class="data"><form method="post" name="f"
action="statecollection.pl">
Index: koha-tmpl/intranet-tmpl/npl/en/bull/subscription-add.tmpl
===================================================================
RCS file:
/sources/koha/koha/koha-tmpl/intranet-tmpl/npl/en/bull/Attic/subscription-add.tmpl,v
retrieving revision 1.2.2.5
retrieving revision 1.2.2.6
diff -u -b -r1.2.2.5 -r1.2.2.6
--- koha-tmpl/intranet-tmpl/npl/en/bull/subscription-add.tmpl 4 Aug 2006
18:11:13 -0000 1.2.2.5
+++ koha-tmpl/intranet-tmpl/npl/en/bull/subscription-add.tmpl 24 Nov 2006
00:23:22 -0000 1.2.2.6
@@ -1,42 +1,767 @@
-<!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->Koha -- <!-- TMPL_IF name="mod"
-->Modify a Subscription<!-- TMPL_ELSE -->Add a New Subscription<!-- /TMPL_IF
--><!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
+<!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->Koha -- Subscription Details
+for <!-- TMPL_VAR name="bibliotitle" --><!-- TMPL_INCLUDE
+NAME="doc-head-close-calendar.inc" -->
<!-- TMPL_INCLUDE NAME="masthead.inc" -->
<!-- TMPL_INCLUDE NAME="serials-topmenu.inc" -->
<!-- TMPL_INCLUDE NAME="intranet-nav.inc" -->
+<style type="text/css">
+<!--
+
+#bloc25 {
+ border: 1px solid #666666;
+ margin-bottom: 5px;
+}
+-->
+</style>
+
+<script type="text/javascript" language="javascript">
+<!--
+// the english words used in display purposes
+var text = new Array('Number','Volume','Issue','Month','Week','Starting
with:','Rollover at:','Choose Hemisphere:','Northern','Southern',
+'Autumn','Winter','Spring','Summer','Fall','Season','Year');
+var months = new
Array('January','February','March','April','May','June','July','August','September','October','November','December');
+var is_season = 0;
+var is_hemisphere = 1;
+var is_month = 0;
+
+// common pre defined number patterns
+function num_pattern() {
+var patternchoice = document.getElementById("numberpattern").value;
+ switch(patternchoice){
+ case "2":
+ document.f.add1.value=1;
+ document.f.add2.value=1;
+ document.f.add3.value=1;
+ document.f.every1.value=12;
+ document.f.every2.value=1;
+ document.f.every3.value=1;
+ document.f.whenmorethan1.value=9999999;
+ document.f.whenmorethan2.value=12;
+ document.f.whenmorethan3.value=4;
+ document.f.setto1.value=0;
+ document.f.setto2.value=1;
+ document.f.setto3.value=1;
+ document.f.lastvalue1.value=1;
+ document.f.lastvalue2.value=1;
+ document.f.lastvalue3.value=1;
+ document.f.numberingmethod.value='Vol {X}, No {Y}, Issue {Z}';
+ moreoptions(text[1],text[0],text[2]);
+ display_table(0); // toggle info box on (1) or off (0)
+ break;
+ case "3":
+ document.f.add1.value=1;
+ document.f.add2.value=1;
+ document.f.add3.value='';
+ document.f.every1.value=12;
+ document.f.every2.value=1;
+ document.f.every3.value='';
+ document.f.whenmorethan1.value=9999999;
+ document.f.whenmorethan2.value=12;
+ document.f.whenmorethan3.value='';
+ document.f.setto1.value=0;
+ document.f.setto2.value=1;
+ document.f.setto3.value='';
+ document.f.lastvalue1.value=1;
+ document.f.lastvalue2.value=1;
+ document.f.lastvalue3.value='';
+ document.f.numberingmethod.value='Vol {X}, No {Y}';
+ moreoptions(text[1],text[0]);
+ display_table(0);
+ break;
+ case "4":
+ document.f.add1.value=1;
+ document.f.add2.value=1;
+ document.f.add3.value='';
+ document.f.every1.value=12;
+ document.f.every2.value=1;
+ document.f.every3.value='';
+ document.f.whenmorethan1.value=9999999;
+ document.f.whenmorethan2.value=12;
+ document.f.whenmorethan3.value='';
+ document.f.setto1.value=0;
+ document.f.setto2.value=1;
+ document.f.setto3.value='';
+ document.f.lastvalue1.value=1;
+ document.f.lastvalue2.value=1;
+ document.f.lastvalue3.value='';
+ document.f.numberingmethod.value='Vol {X}, Issue {Y}';
+ moreoptions(text[1],text[2]);
+ display_table(0);
+ break;
+ case "5":
+ document.f.add1.value=1;
+ document.f.add2.value=1;
+ document.f.add3.value='';
+ document.f.every1.value=12;
+ document.f.every2.value=1;
+ document.f.every3.value='';
+ document.f.whenmorethan1.value=9999999;
+ document.f.whenmorethan2.value=12;
+ document.f.whenmorethan3.value='';
+ document.f.setto1.value=0;
+ document.f.setto2.value=1;
+ document.f.setto3.value='';
+ document.f.lastvalue1.value=1;
+ document.f.lastvalue2.value=1;
+ document.f.lastvalue3.value='';
+ document.f.numberingmethod.value='No {X}, Issue {Y}';
+ moreoptions(text[0],text[2]);
+ display_table(0);
+ break;
+ case "6":
+ var d = new Date();
+ var sYear = d.getFullYear();
+ document.f.add1.value=1;
+ document.f.add2.value='1';
+ document.f.add3.value='';
+ document.f.every1.value=4;
+ document.f.every2.value='1';
+ document.f.every3.value='';
+ document.f.whenmorethan1.value=9999999;
+ document.f.whenmorethan2.value='4';
+ document.f.whenmorethan3.value='';
+ document.f.setto1.value=0;
+ document.f.setto2.value='1';
+ document.f.setto3.value='';
+ document.f.lastvalue1.value=sYear;
+ document.f.lastvalue2.value='1';
+ document.f.lastvalue3.value='';
+ document.f.periodicity.value='8';
+ document.f.numberingmethod.value='{Y} {X}';
+ moreoptions_seasons(text[15],sYear);
+ display_table(0);
+ is_season = 1;
+ break;
+ case "7":
+ display_table(1);
+ document.f.irreg_check.value=1;
+ break;
+ case "8":
+ var d = new Date();
+ var sYear = d.getFullYear();
+ document.f.add1.value=1;
+ document.f.add2.value='1';
+ document.f.add3.value='';
+ document.f.every1.value=12;
+ document.f.every2.value='1';
+ document.f.every3.value='';
+ document.f.whenmorethan1.value=9999999;
+ document.f.whenmorethan2.value='12';
+ document.f.whenmorethan3.value='';
+ document.f.setto1.value=0;
+ document.f.setto2.value='1';
+ document.f.setto3.value='';
+ document.f.lastvalue1.value=sYear;
+ document.f.lastvalue2.value='1';
+ document.f.lastvalue3.value='';
+// document.f.periodicity.value='8';
+ document.f.numberingmethod.value='{Y} {X}';
+ moreoptions_months(text[3],sYear);
+ display_table(0);
+ is_month = 1;
+ break;
+ default:
+ document.f.add1.value=1;
+ document.f.add2.value='';
+ document.f.add3.value='';
+ document.f.every1.value=1;
+ document.f.every2.value='';
+ document.f.every3.value='';
+ document.f.whenmorethan1.value=9999999;
+ document.f.whenmorethan2.value='';
+ document.f.whenmorethan3.value='';
+ document.f.setto1.value=0;
+ document.f.setto2.value='';
+ document.f.setto3.value='';
+ document.f.lastvalue1.value=1;
+ document.f.lastvalue2.value='';
+ document.f.lastvalue3.value='';
+ document.f.numberingmethod.value='{X}';
+ moreoptions_daily_check(text[0]);
+ document.f.irreg_check.value=1;
+ display_table(0);
+ break;
+ }
+}
+
+function display_table(n) {
+ if(n==1){
+ document.getElementById("basetable").style.display = 'block';
+ } else {
+ document.getElementById("basetable").style.display = 'none';
+ }
+}
+
+function modify_num_pattern() {
+ document.getElementById("numberpattern").value = '<!-- TMPL_VAR
NAME="numberpattern" -->';
+ num_pattern();
+
+ document.f.add1.value='<!-- TMPL_VAR NAME="add1" -->';
+ document.f.add2.value='<!-- TMPL_VAR NAME="add2" -->';
+ document.f.add3.value='<!-- TMPL_VAR NAME="add3" -->';
+ document.f.every1.value='<!-- TMPL_VAR NAME="every1" -->';
+ document.f.every2.value='<!-- TMPL_VAR NAME="every2" -->';
+ document.f.every3.value='<!-- TMPL_VAR NAME="every3" -->';
+ document.f.whenmorethan1.value='<!-- TMPL_VAR NAME="whenmorethan1" -->';
+ document.f.whenmorethan2.value='<!-- TMPL_VAR NAME="whenmorethan2" -->';
+ document.f.whenmorethan3.value='<!-- TMPL_VAR NAME="whenmorethan3" -->';
+ document.f.setto1.value='<!-- TMPL_VAR NAME="setto1" -->';
+ document.f.setto2.value='<!-- TMPL_VAR NAME="setto2" -->';
+ document.f.setto3.value='<!-- TMPL_VAR NAME="setto3" -->';
+ document.f.lastvalue1.value='<!-- TMPL_VAR NAME="lastvalue1" -->';
+ document.f.lastvalue2.value='<!-- TMPL_VAR NAME="lastvalue2" -->';
+ document.f.lastvalue3.value='<!-- TMPL_VAR NAME="lastvalue3" -->';
+ document.f.numberingmethod.value='<!-- TMPL_VAR NAME="numberingmethod"
-->';
+
+ var more_strY;
+ var more_strZ;
+ <!-- TMPL_IF NAME="add2" -->
+ if(<!-- TMPL_VAR NAME="add2" --> > 0){
+ more_strY="Y";
+ }
+ <!-- /TMPL_IF -->
+ <!-- TMPL_IF NAME="add3" -->
+ if(<!-- TMPL_VAR NAME="add3" --> > 0){
+ more_strZ="Z";
+ }
+ <!-- /TMPL_IF -->
+
+ document.f.lastvaluetemp1.value='<!-- TMPL_VAR NAME="lastvalue1" -->';
+ if(more_strY){
+ document.f.lastvaluetemp2.value='<!-- TMPL_VAR
NAME="lastvalue2" -->';
+ document.f.whenmorethantemp2.value='<!-- TMPL_VAR NAME="whenmorethan2"
-->';
+ }
+ if(more_strZ){
+ document.f.lastvaluetemp3.value='<!-- TMPL_VAR
NAME="lastvalue3" -->';
+ document.f.whenmorethantemp3.value='<!-- TMPL_VAR NAME="whenmorethan3"
-->';
+ }
+}
+
+// a pre check with more options to see if 'number' and '1/day' are chosen
+function moreoptions_daily_check(x) {
+ var periodicity = document.f.periodicity.value;
+ var errortext='';
+ if(periodicity == 1){
+ document.getElementById("irregularity").innerHTML = '';
+ document.getElementById("more_options").innerHTML = '';
+ var daynames = new
Array('Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday');
+ errortext ="Please indicate which days of the week you <b>DO
NOT<\/b> expect to receive issues.<br \/>";
+ for(var j=0;j<daynames.length;j++){
+ errortext +="<input type='checkbox' name='irregular'
id='irregular"+(j+1)+"' value='"+(j+1)+"' />"+daynames[j]+" ";
+ }
+ var error = errortext;
+ document.getElementById("irregularity").innerHTML = error;
+ } else {
+ document.getElementById("irregularity").innerHTML = '';
+ document.getElementById("more_options").innerHTML = '';
+ moreoptions(x);
+ }
+}
+
+// to dispaly the more options section
+function moreoptions(x,y,z){
+document.getElementById("irregularity").innerHTML = '';
+document.getElementById("more_options").innerHTML = '';
+var textbox = '';
+ // alert("X: "+x+"Y: "+y+"Z: "+z);
+ if(x){
+ textbox +="<table>\n<tr><td> <\/td><td>"+x+"<\/td>";
+ if(y){
+ textbox +="<td>"+y+"<\/td>";
+ if(z){
+ textbox +="<td>"+z+"<\/td>";
+ }
+ }
+ textbox +="<\/tr>\n";
+ textbox +="<tr><td>"+text[5]+"<\/td><td><input type='text'
name='lastvaluetemp1' size='4'
onkeyup='moreoptionsupdate(\"lastvalue1\")'><\/td>\n";
+ if(y){
+ textbox +="<td><input type='text' name='lastvaluetemp2'
size='4' onkeyup='moreoptionsupdate(\"lastvalue2\")'><\/td>\n";
+ if(z){
+ textbox +="<td><input type='text'
name='lastvaluetemp3' size='4'
onkeyup='moreoptionsupdate(\"lastvalue3\")'><\/td>\n";
+ }
+ }
+ textbox +="<\/tr>\n";
+ if(y){
+ textbox +="<tr><td>"+text[6]+"<\/td>";
+ textbox +="<td><a
href='javascript:irregularity_check()'>Irregularity?<\/a><\/td>\n";
+ textbox +="<td><input type='text'
name='whenmorethantemp2' size='4'
onkeyup='moreoptionsupdate(\"whenmorethan2\",1)'><\/td>\n";
+ if(z){
+ textbox +="<td><input type='text'
name='whenmorethantemp3' size='4'
onkeyup='moreoptionsupdate(\"whenmorethan3\",1)'><\/td>\n";
+ }
+ textbox +="<\/tr>";
+ }
+ textbox +="<\/table>\n";
+ }
+ document.getElementById("more_options").innerHTML = textbox;
+}
+
+function hemispheres(chosen){
+var selbox = document.getElementById("season1");
+ if(selbox){
+ var selboxselected = selbox.options[selbox.selectedIndex].value;
+ selbox.options.length = 0;
+
+ if (chosen == "1") {
+ selbox.options[selbox.options.length] = new
Option(text[11],'1');
+ selbox.options[selbox.options.length] = new
Option(text[12],'2');
+ selbox.options[selbox.options.length] = new
Option(text[13],'3');
+ selbox.options[selbox.options.length] = new
Option(text[14],'4');
+ is_hemisphere = 1;
+ selbox.options[selboxselected-1].selected = true;
+ }
+
+ if (chosen == "2") {
+ selbox.options[selbox.options.length] = new
Option(text[13],'1');
+ selbox.options[selbox.options.length] = new
Option(text[10],'2');
+ selbox.options[selbox.options.length] = new
Option(text[11],'3');
+ selbox.options[selbox.options.length] = new
Option(text[12],'4');
+ is_hemisphere = 2;
+ selbox.options[selboxselected-1].selected = true;
+ }
+ }
+}
+
+// to dispaly the more options section for seasons
+function moreoptions_seasons(x,y){
+document.getElementById("irregularity").innerHTML = '';
+document.getElementById("more_options").innerHTML = '';
+var textbox = '';
+ // alert("X: "+x+"Year: "+y);
+ if(x){
+ var hemi_select = parseInt('<!-- TMPL_VAR NAME="hemisphere"
-->');
+ textbox +="<table>\n<tr><td>"+ text[7] +"<\/td><td
colspan='2'><select name='hemisphere'
onchange='hemispheres(this.options[this.selectedIndex].value)'>";
+ for(var i = 1; i <= 2; i++){
+ textbox +="<option value='"+i+"'";
+ if(i == hemi_select){
+ textbox += " selected "
+ }
+ textbox +=">"+text[i+7]+"<\/option>";
+ }
+ textbox +="<\/select><\/td><\/tr>\n";
+ textbox +="<tr><td> <\/td><td>"+x+"<\/td>";
+ textbox +="<td>"+text[16]+"<\/td>";
+ textbox +="<\/tr>\n";
+ textbox +="<tr><td>"+text[5]+"<\/td><td><select
name='lastvaluetemp2' id='season1'
onchange='moreoptionsupdate(\"lastvalue2\")'>";
+ for(var j = 1; j <= 4; j++){
+ textbox +="<option
value='"+j+"'>"+text[j+10]+"<\/option>";
+ }
+ textbox +="<\/select><\/td><td><select name='lastvaluetemp1'
onchange='moreoptionsupdate(\"lastvalue1\")'>";
+ for(var k = parseInt(y); k <= parseInt(y)+15; k++){
+ textbox +="<option value='"+k+"'>"+k+"<\/option>";
+ }
+ textbox +="<\/select><\/td><\/tr>\n";
+ textbox +="<tr><td>"+text[6]+"<\/td>";
+ textbox +="<td><a
href='javascript:irregularity_check()'>Irregularity?<\/a><\/td>\n";
+ textbox +="<td><input type='text' name='whenmorethantemp2'
size='4' onkeyup='moreoptionsupdate(\"whenmorethan2\",1)'><\/td>\n";
+ textbox +="<\/tr><\/table>\n";
+ }
+ document.getElementById("more_options").innerHTML = textbox;
+}
+
+// to dispaly the more options section for months/years
+function moreoptions_months(x,y){
+document.getElementById("irregularity").innerHTML = '';
+document.getElementById("more_options").innerHTML = '';
+var textbox = '';
+ // alert("X: "+x+"Year: "+y);
+ if(x){
+ textbox +="<table>\n";
+ textbox +="<tr><td> <\/td><td>"+x+"<\/td>";
+ textbox +="<td>"+text[16]+"<\/td>";
+ textbox +="<\/tr>\n";
+ textbox +="<tr><td>"+text[5]+"<\/td><td><select
name='lastvaluetemp2' onchange='moreoptionsupdate(\"lastvalue2\")'>";
+ for(var j = 1; j <= 12; j++){
+ textbox +="<option
value='"+j+"'>"+months[j-1]+"<\/option>";
+ }
+ textbox +="<\/select><\/td><td><select name='lastvaluetemp1'
onchange='moreoptionsupdate(\"lastvalue1\")'>";
+ for(var k = parseInt(y); k <= parseInt(y)+15; k++){
+ textbox +="<option value='"+k+"'>"+k+"<\/option>";
+ }
+ textbox +="<\/select><\/td><\/tr>\n";
+ textbox +="<tr><td>"+text[6]+"<\/td>";
+ textbox +="<td><a
href='javascript:irregularity_check()'>Irregularity?<\/a><\/td>\n";
+ textbox +="<td><input type='text' name='whenmorethantemp2'
size='4' onkeyup='moreoptionsupdate(\"whenmorethan2\",1)'><\/td>\n";
+ textbox +="<\/tr><\/table>\n";
+ }
+ document.getElementById("more_options").innerHTML = textbox;
+}
+
+
+function irregularity_check(){
+ document.f.irreg_check.value = 1; // Irregularity button now pushed
+ var periodicity = document.f.periodicity.value;
+ var rollover = document.f.whenmorethantemp2.value;
+ if(document.f.whenmorethantemp3){
+ rollover = document.f.whenmorethantemp3.value;
+ }
+ var error='';
+ var toobig;
+ var expected;
+ var errortext = "<b>Warning irregularity detected<\/b><br \/>";
+ switch(periodicity){
+ case "1":
+ if(rollover < 365) expected =365;
+ if(rollover > 365) {
+ expectedover=365;
+ toobig=1;
+ }
+ break;
+ case "2":
+ if(rollover < 52) expected =52;
+ if(rollover > 52){
+ expectedover=52;
+ toobig=1;
+ }
+ break;
+ case "3":
+ if(rollover < 26) expected =26;
+ if(rollover > 26){
+ expectedover=26;
+ toobig=1;
+ }
+ break;
+ case "4":
+ if(rollover < 17) expected =17;
+ if(rollover > 17){
+ expectedover=17;
+ toobig=1;
+ }
+ break;
+ case "5":
+ if(rollover < 12) expected =12;
+ if(rollover > 12){
+ expectedover=12;
+ toobig=1;
+ }
+ break;
+ case "6":
+ if(rollover < 6) expected =6;
+ if(rollover > 6){
+ expectedover=6;
+ toobig=1;
+ }
+ break;
+ case "7":
+ if(rollover < 4) expected =4;
+ if(rollover > 4){
+ expectedover=4;
+ toobig=1;
+ }
+ break;
+ case "8":
+ if(rollover < 4) expected =4;
+ if(rollover > 4){
+ expectedover=4;
+ toobig=1;
+ }
+ break;
+ case "9":
+ if(rollover < 2) expected =2;
+ if(rollover > 2){
+ expectedover=2;
+ toobig=1;
+ }
+ break;
+ case "10":
+ if(rollover < 1) expected =1;
+ if(rollover > 1){
+ expectedover=1;
+ toobig=1;
+ }
+ break;
+ case "12":
+ if(rollover < 12) expected =12;
+ if(rollover > 12){
+ expectedover=12;
+ toobig=1;
+ }
+ break;
+ default:
+ break;
+ }
+ if(expected){
+ if(expected == 365){
+ var daynames = new
Array('Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday');
+ errortext +="Please indicate which days of the week you
<b>DO NOT<\/b> expect to receive issues.<br \/>";
+ for(var j=0;j<daynames.length;j++){
+ errortext +="<input type='checkbox'
name='irregular' id='irregular"+(j+1)+"' value='"+(j+1)+"' />"+daynames[j]+"
";
+ }
+ error=errortext;
+ } else {
+ errortext +=expected+" issues expected "+rollover+"
were entered. <br \/>Please indicate which date(s) an issue is not expected<br
\/>";
+ var count=0;
+ for(var i=rollover;i<expected;i++){
+ errortext +="<select name='irregular'
id='irregular"+count+"' onchange='display_example(expected)'>\n";
+ errortext +=irregular_options(periodicity);
+ errortext +="<\/select>\n";
+ count++;
+ }
+ error=errortext;
+ }
+ }
+ if(toobig){
+ errortext +=expectedover+" issues expected "+rollover+" were
entered.<br \/> You seem to have indicated more issues per year than expected.";
+ error=errortext;
+ }
+ if(error.length ==0){
+ error='No irregularities noticed';
+ }
+ display_example(expected);
+ document.getElementById("irregularity").innerHTML = error;
+}
+
+function irregular_options(periodicity){
+ var titles;
+ var count;
+<!-- TMPL_IF NAME="weekarrayjs" -->
+ var weeks = new Array(<!-- TMPL_VAR NAME="weekarrayjs" -->);
+<!-- /TMPL_IF -->
+ var seasons = new Array('Autumn','Winter','Spring','Summer','Fall');
+ var errortext='';
+ if(periodicity == 1) {
+ expected = 366;
+ titles = "Day";
+ count = 1;
+ }
+ if(periodicity == 2 || periodicity == 3 || periodicity == 4) {
+ expected = 52;
+ <!-- TMPL_IF NAME="weekarrayjs" -->
+ titles = weeks;
+ count = <!-- TMPL_VAR NAME="weekno" -->;
+ <!-- TMPL_ELSE -->
+ titles = "Week";
+ count = 1;
+ <!-- /TMPL_IF -->
+ }
+ if(periodicity == 5 || periodicity == 6 || periodicity == 7 ||
periodicity == 8 || periodicity == 9) {
+ if(periodicity == 8) {
+ is_season = 1; // setting up from edit page
+ }
+ if(is_season){
+ titles = seasons;
+ expected = 4;
+ if(is_hemisphere == 2){
+ count = 2;
+ } else {
+ count = 1;
+ }
+ } else {
+ titles = months;
+ expected = 12;
+ count = 1;
+ }
+ }
+ for(var j=1;j<=expected;j++){
+ if(isArray(titles)){
+ if(count>expected){
+ count = count-expected;
+ }
+ if(is_season && is_hemisphere == 1){
+ errortext +="<option
value='"+((count*3)-2)+"'>"+titles[j]+"<\/option>\n";
+// alert("value: "+((count*3)-2)+" title: "+titles[j]);
+ } else if(is_season && is_hemisphere == 2){
+ errortext +="<option
value='"+((count*3)-2)+"'>"+titles[j-1]+"<\/option>\n";
+// alert("value: "+((count*3)-2)+" title: "+titles[j-1]);
+ } else {
+ errortext +="<option
value='"+count+"'>"+titles[j-1]+"<\/option>\n";
+ }
+ count++;
+ } else {
+ errortext +="<option value='"+j+"'>"+titles+"
"+j+"<\/option>\n";
+ }
+ }
+ return errortext;
+}
+
+function irregular_order(){
+ var irregular = '<!-- TMPL_VAR NAME="irregularity" -->';
+ var periodicity = document.f.periodicity.value;
+ var irregarray = irregular.split('|');
+ if(periodicity ==1){
+ for(j=0;j<irregarray.length;j++){
+ document.getElementById("irregular"+irregarray[j]).checked =
true;
+ }
+ } else {
+ for(i=0;i<irregarray.length;i++){
+ document.getElementById("irregular"+i).value =
irregarray[i];
+ }
+ }
+}
+
+function display_example(expected){
+ var startfrom1 = parseInt(document.f.lastvalue1.value);
+ var startfrom2 = parseInt(document.f.lastvalue2.value);
+ var startfrom3 = parseInt(document.f.lastvalue3.value);
+ var every1 = parseInt(document.f.every1.value);
+ var every2 = parseInt(document.f.every2.value);
+ var every3 = parseInt(document.f.every3.value);
+ var numberpattern = document.f.numberingmethod.value;
+ var whenmorethan2 = parseInt(document.f.whenmorethan2.value);
+ var whenmorethan3 = parseInt(document.f.whenmorethan3.value);
+ var setto2 = parseInt(document.f.setto2.value);
+ var setto3 = parseInt(document.f.setto3.value);
+ var displaytext = 'Based on the information<br \/>entered the Numbering
Pattern<br \/>will look like this<br \/>\n';
+ if(startfrom3>0){
+ var count=startfrom3-1;
+ var count2=startfrom2;
+ for(var i=0;i<12;i++){
+ if(count>=whenmorethan3){
+ count=setto3;
+ if(count2>=whenmorethan2){
+ startfrom1++;
+ count2=setto2;
+ } else {
+ count2++;
+ }
+ } else {
+ count++;
+ }
+ displaytext += numberpattern.replace(/{Z}/,count)+'\n';
+ displaytext = displaytext.replace(/{Y}/,count2)+'<br
\/>\n';
+ displaytext =
displaytext.replace(/{X}/,startfrom1)+'<br \/>\n';
+
+ }
+ }
+ if(startfrom2>0 && !startfrom3){
+ var count=startfrom2-1;
+ for(var i=0;i<12;i++){
+ if(count>=whenmorethan2){
+ startfrom1++;
+ count=setto2;
+ } else {
+ count++;
+ }
+
+ if(is_season){
+ if(is_hemisphere == 2){
+ if(count == 1) {
+ displaytext +=
numberpattern.replace(/{Y}/,text[count+12])+'\n';
+ } else {
+ displaytext +=
numberpattern.replace(/{Y}/,text[count+8])+'\n';
+ }
+ } else {
+ displaytext +=
numberpattern.replace(/{Y}/,text[count+10])+'\n';
+ }
+ } else if(is_month){
+ displaytext +=
numberpattern.replace(/{Y}/,months[count])+'\n';
+ } else {
+ displaytext +=
numberpattern.replace(/{Y}/,count)+'\n';
+ }
+ displaytext =
displaytext.replace(/{X}/,startfrom1)+'<br \/>\n';
+ }
+ }
+ if(startfrom1>0 && !startfrom2 && !startfrom3){
+ for(var i=startfrom1;i<(startfrom1+12);i=i+(1*every1)){
+ startfrom1 = i;
+ displaytext +=
numberpattern.replace(/{X}/,startfrom1)+'<br \/>\n';
+ }
+ }
+ displaytext = "<div style='padding: 5px; background-color:
#CCCCCC'>"+displaytext+"<\/div>";
+ document.getElementById("displayexample").innerHTML = displaytext;
+}
+
+function isArray(obj) {
+ if (obj.constructor.toString().indexOf("Array") == -1)
+ return false;
+ else
+ return true;
+}
+
+function moreoptionsupdate(fieldnames,rollover){
+ fieldname = fieldnames;
+ fld = fieldname.length;
+ fld = fld-1;
+ fieldnametempnumber = fieldname.substr(fld);
+ //alert(fieldnametempnumber);
+ fieldnametemp = fieldname.slice(0,-1)+"temp"+fieldnametempnumber;
+ // alert(fieldnametemp);
+ eval("document.f."+fieldname+".value =
document.f."+fieldnametemp+".value");
+ if(rollover){
+ eval("document.f.every"+(fieldnametempnumber-1)+".value =
document.f."+fieldnametemp+".value");
+ }
+}
+
+
+function check_input(e){
+ var unicode=e.charCode? e.charCode : e.keyCode
+ if (unicode!=8 && unicode !=46){ // if key isn't backspace or delete
+ if (unicode<48||unicode>57) { // if not a number
+ alert("Needs to be entered in digit form -eg 10");
+ return false // disable key press
+ }
+ }
+}
+
+-->
+</script>
+
<div id="main">
<!-- TMPL_IF name="mod" -->
- <h1>Modify Subscription</h1>
+ <h1>Modify subscription</h1>
<form method="post" name="f" action="subscription-detail.pl">
<input type="hidden" name="op" value="modsubscription">
<input type="hidden" name="subscriptionid" value="<!-- TMPL_VAR
name="subscriptionid" -->">
<!-- TMPL_ELSE -->
- <h1>Add a Subscription</h1>
- <form method="post" name="f"
action="/cgi-bin/koha/bull/subscription-add.pl">
+ <h1>Add a subscription (Serial Holdings Record)</h1>
+ <form method="post" name="f">
+ <input type="hidden" name="op" value="addsubscription">
<!-- /TMPL_IF -->
-<input type="hidden" name="op" value="addsubscription" />
- <input type="hidden" name="user" value="<!-- TMPL_VAR
name="user" -->" />
+ <input type="hidden" name="user" value="<!-- TMPL_VAR
name="loggedinusername" -->">
+ <input type="hidden" name="irreg_check" value="0">
+
+
<div class="data">
- <table>
- <caption>Subscription Information For:</caption>
- <tr><th scope="row">Librarian: </th><td><!-- TMPL_VAR
name="user" --></td></tr>
- <tr><th scope="row"><label for="aqbooksellerid">Supplier:
</label></th><td><input type="text" id="aqbooksellerid" name="aqbooksellerid"
value="<!-- TMPL_VAR name="aqbooksellerid" -->" size=4> (<input type="text"
name="aqbooksellername" value="<!-- TMPL_VAR name="aqbooksellername" -->"
disabled readonly>) <input type="button" class="submit" value="Search..."
onclick="FindAcqui(f); return false;" /></td></tr>
- <tr><th scope="row"><label for="biblionumber">Bibliographic
Record: </label></th><td><input type="text" id="biblionumber"
name="biblionumber" value="<!-- TMPL_VAR name="biblionumber" -->" size=4>
(<input type="text" name="title" value="<!-- TMPL_VAR name="bibliotitle" -->"
disabled readonly>) <input type="button" class="submit" value="Search..."
onclick="Plugin(f); return false;" /></td></tr>
- <tr><th scope="row"><label for="notes-field">Notes:
</label></th><td><textarea name="notes" id="notes-field" cols="30"
rows="2"><!-- TMPL_VAR name="notes" --></textarea></td></tr>
- </table>
- <div class="help"><h4>Warning</h4>
+ <h2>Subscription information</h2>
+ <table border="0" cellspacing="5" cellpadding="0">
+ <tr><td>Librarian:</td>
+ <td><!-- TMPL_VAR name="loggedinusername" --></td></tr>
+ <tr><td>Supplier:</td>
+ <td><input type="text" name="aqbooksellerid" value="<!-- TMPL_VAR
name="aqbooksellerid" -->" size="4"> (<input type="text"
name="aqbooksellername" value="<!-- TMPL_VAR name="aqbooksellername" -->"
disabled readonly>) <a href="#" onClick="FindAcqui(f)">Search for a
Supplier</a></td>
+ <tr><td>Biblio</td>
+ <td><input type="text" name="biblionumber" value="<!-- TMPL_VAR
name="biblionumber" -->" size="4"> (<input type="text" name="title" value="<!--
TMPL_VAR name="bibliotitle" -->" disabled readonly>) <a href="#"
onClick="Plugin(f)">Search for Biblio</a> | <a
href="/cgi-bin/koha/acqui/acqui-home.pl">Create Biblio</a></td>
+ <tr><td>Call Number</td>
+ <td><input type="text" name="callnumber" value="<!-- TMPL_VAR
name="callnumber" -->" size="20"></td></tr>
+ <tr><td>Notes</td>
+ <td><textarea name="notes" cols="30" rows="2"><!-- TMPL_VAR
name="notes" --></textarea></td>
+ <tr><td><b>Warning:</b></td>
+ <td>
<ul>
- <li>remember you <b>must</b> have created a biblio
<b>before</b> creating a subscription</li>
+ <li>Remember you <b>must</b> have created a biblio
<b>before</b> creating a subscription</li>
<li>You also must have selected a supplier if you want
to ask for late issues</li>
- </ul>
- </div>
+ </ul></td></tr>
+ </table>
</div>
-
<div class="data">
- <table>
- <caption>Planning</caption>
- <tr><th scope="row"><label for="startdate">Beginnning date
(yyyy-mm-dd):</label></th><td><input type="text" id="startdate"
name="startdate" value="<!-- TMPL_VAR name="startdate" -->" size=13
maxlength=10></td></tr>
- <tr><th scope="row"><label for="periodicity">Frequency
(*)</label></th><td><select id="periodicity" name="periodicity" size="1">
- <option value="" selected>Unknown</option>
+ <h2>Planning</h2>
+ <table border="0" cellspacing="5" cellpadding="0">
+ <tr><td>First Issue ETA:</td>
+ <td> <img src="<!-- TMPL_VAR Name="themelang"
-->/includes/calendar/cal.gif" id="button2" style="cursor: pointer;" />
+
+<input type="text" name="firstacquidate" value="<!-- TMPL_VAR name="startdate"
-->" size=13 maxlength=10 id="acqui_date" style="border-width: 0px;">
+<!-- both scripts for calendar must follow the input field -->
+ <script type="text/javascript">
+ Calendar.setup({
+ inputField:"acqui_date",
+ ifFormat : "%d/%m/%Y",
+ button : "button2",
+ align : "Tl"
+ });
+ </script>
+ <script type="text/javascript">
+ Calendar.setup({
+ inputField :
"acqui_date",
+ ifFormat : "%d/%m/%Y",
+ button :
"acqui_date",
+ align : "Tl"
+ });
+ </script></td>
+ <td rowspan="5"><div id="displayexample"></div></td></tr>
+ <tr><td>Frequency: (*)</td>
+ <td> <select name="periodicity" size="1">
+ <option value="" selected>-- please choose
--</option>
+ <option value="">Unknown</option>
+
<!-- TMPL_IF name="periodicity1" -->
<option value="1"
selected>1/day</option>
<!-- TMPL_ELSE -->
@@ -72,11 +797,17 @@
<!-- TMPL_ELSE -->
<option value="7">1/3 months
(1/quarter)</option>
<!-- /TMPL_IF -->
- <!-- periodicity8 is 1/quarter, exactly like
periodicity7 -->
+ <!-- periodicity8 is 1/quarter, exactly like
periodicity7 but will use it for seasonal option -->
+ <!-- TMPL_IF name="periodicity8" -->
+ <option value="8" selected>1/quarter
(seasonal)</option>
+ <!-- TMPL_ELSE -->
+ <option value="8">1/quarter
(seasonal)</option>
+ <!-- /TMPL_IF -->
+
<!-- TMPL_IF name="periodicity9" -->
<option value="9"
selected>2/years</option>
<!-- TMPL_ELSE -->
- <option value="9">2/years</option>
+ <option value="9">2/year</option>
<!-- /TMPL_IF -->
<!-- TMPL_IF name="periodicity10" -->
<option value="10"
selected>1/year</option>
@@ -88,8 +819,80 @@
<!-- TMPL_ELSE -->
<option value="11">1/2 years</option>
<!-- /TMPL_IF -->
- </select></td></tr>
- <tr><th scope="row"><label for="dow">Arrives on</label></th><td><select
name="dow" id="dow" size="1">
+ </select>
+ </td></tr>
+ <tr><td>Numbering Pattern:</td>
+ <td><select name="numbering_pattern" size="1" id="numberpattern"
onchange="num_pattern()">
+ <option value="" selected>-- please choose --</option>
+ <!-- TMPL_IF name="numberpattern1" -->
+ <option value="1" selected>Number</option>
+ <!-- TMPL_ELSE -->
+ <option value="1">Number</option>
+ <!-- /TMPL_IF -->
+ <!-- TMPL_IF name="numberpattern2" -->
+ <option value="2" selected>Volume, Number,
Issue</option>
+ <!-- TMPL_ELSE -->
+ <option value="2">Volume, Number, Issue</option>
+ <!-- /TMPL_IF -->
+ <!-- TMPL_IF name="numberpattern3" -->
+ <option value="3" selected>Volume, Number</option>
+ <!-- TMPL_ELSE -->
+ <option value="3">Volume, Number</option>
+ <!-- /TMPL_IF -->
+ <!-- TMPL_IF name="numberpattern4" -->
+ <option value="4" selected>Volume, Issue</option>
+ <!-- TMPL_ELSE -->
+ <option value="4">Volume, Issue</option>
+ <!-- /TMPL_IF -->
+ <!-- TMPL_IF name="numberpattern5" -->
+ <option value="5" selected>Number, Issue</option>
+ <!-- TMPL_ELSE -->
+ <option value="5">Number, Issue</option>
+ <!-- /TMPL_IF -->
+ <!-- TMPL_IF name="numberpattern6" -->
+ <option value="6" selected>Seasonal only</option>
+ <!-- TMPL_ELSE -->
+ <option value="6">Seasonal only</option>
+ <!-- /TMPL_IF -->
+ <!-- TMPL_IF name="numberpattern8" -->
+ <option value="8" selected>Month/Year</option>
+ <!-- TMPL_ELSE -->
+ <option value="8">Month/Year</option>
+ <!-- /TMPL_IF -->
+ <!-- TMPL_IF name="numberpattern7" -->
+ <option value="7" selected>None of the above</option>
+ <!-- TMPL_ELSE -->
+ <option value="7">None of the above</option>
+ <!-- /TMPL_IF -->
+
+ </select>
+<div id="more_options"></div>
+<div id="irregularity"></div></td></tr>
+ <tr><td>Begins On: (*)</td>
+ <td><img src="<!-- TMPL_VAR Name="themelang"
-->/includes/calendar/cal.gif" id="button1" style="cursor: pointer;" />
+<input type="text" name="startdate" value="<!-- TMPL_VAR name="startdate" -->"
size=13 maxlength=10 id="beginning_date" style="border-width: 0px;">
+<!-- both scripts for calendar must follow the input field -->
+ <script type="text/javascript">
+ Calendar.setup({
+ inputField :
"beginning_date",
+ ifFormat : "%d/%m/%Y",
+ button : "button1",
+ align : "Tl"
+ });
+ </script>
+ <script type="text/javascript">
+ Calendar.setup({
+ inputField :
"beginning_date",
+ ifFormat : "%d/%m/%Y",
+ button :
"beginning_date",
+ align : "Tl"
+ });
+ </script></td></tr>
+</table>
+</div>
+
+ <tr><td>Arrives on</td>
+ <td> <select name="dow" size="1">
<option value="">None</option>
<!-- TMPL_IF name="dow1" -->
<option value="1"
selected>Monday</option>
@@ -127,32 +930,31 @@
<option value="7">Sunday</option>
<!-- /TMPL_IF -->
</select></td></tr>
- </table>
-</div>
-<div class="data">
- <table>
- <caption>Subscription length (choose one)</caption>
- <tr><th scope="row"><label for="numberlength">Number of
issues</label></th><td><input type="text" id="numberlength" name="numberlength"
value="<!-- TMPL_VAR name="numberlength" -->"></td></tr>
- <tr><th scope="row"><label for="weeklength">Number of
weeks</label></th><td><input type="text" id="weeklength" name="weeklength"
value="<!-- TMPL_VAR name="weeklength" -->"></td></tr>
- <tr><th scope="row"><label for="monthlength">Number of
months</label></th><td><input type="text" id="monthlength" name="monthlength"
value="<!-- TMPL_VAR name="monthlength" -->"></td></tr>
- </table>
-</div>
+<div id="bloc25">
+ <h2>Subscription length</h2>
+ <p><select name="subtype">
+<!-- TMPL_LOOP NAME="subtype" -->
+<option value="<!-- TMPL_VAR NAME="name" -->" <!-- TMPL_IF NAME="selected" -->
selected="SELECTED" <!-- /TMPL_IF -->><!-- TMPL_VAR NAME="name" --></option>
+<!-- /TMPL_LOOP -->
+</select> <input type="text" name="sublength" value="<!-- TMPL_VAR
name="sublength" -->" size="3" onkeypress="return check_input(event)"> (*)
(enter amount in numerals)</p>
- <div class="data">
-<h2>Numbering calculation</h2>
- <p><label for="numberingmethod">Numbering formula:</label> <input
id="numberingmethod" type="text" name="numberingmethod" value="<!-- TMPL_VAR
name="numberingmethod" -->"></p>
- <table>
- <tr>
- <th scope="row"> </th>
- <th scope="col">X</th>
- <th scope="col">Y</th>
- <th scope="col">Z</th>
+</div>
+<div class="data">
+ <h2>Numbering calculation</h2>
+ <p>Numbering formula: <input type="text" name="numberingmethod"
value="<!-- TMPL_VAR name="numberingmethod" -->"></p>
+ <div id="basetable" style="display: none;">
+ <table class="small">
+ <tr>
+ <th > </th>
+ <th >X</th>
+ <th >Y</th>
+ <th >Z</th>
</tr>
<tr>
- <th scope="row"><label
for="add1">Add:</label></td>
+ <td >Add</td>
<td>
- <input type="text" id="add1"
name="add1" value="<!-- TMPL_VAR name="add1" -->">
+ <input type="text" name="add1"
value="<!-- TMPL_VAR name="add1" -->">
</td>
<td>
<input type="text" name="add2"
value="<!-- TMPL_VAR name="add2" -->">
@@ -162,80 +964,102 @@
</td>
</tr>
<tr>
- <th scope="row"><label for="every1">...Once
every:</label></th>
- <td><input type="text" id="every1"
name="every1" value="<!-- TMPL_VAR name="every1" -->"></td>
+ <td >once every</td>
+ <td><input type="text" name="every1"
value="<!-- TMPL_VAR name="every1" -->"></td>
<td><input type="text" name="every2"
value="<!-- TMPL_VAR name="every2" -->"></td>
<td><input type="text" name="every3"
value="<!-- TMPL_VAR name="every3" -->"></td>
</tr>
+ <tr>
+ <td >When more than</td>
+ <td><input type="text" name="whenmorethan1"
value="<!-- TMPL_VAR name="whenmorethan1" -->"></td>
+ <td><input type="text" name="whenmorethan2"
value="<!-- TMPL_VAR name="whenmorethan2" -->"></td>
+ <td><input type="text" name="whenmorethan3"
value="<!-- TMPL_VAR name="whenmorethan3" -->"></td>
+ </tr>
<!-- TMPL_IF name="mod" -->
<tr>
- <th scope="row"><label for="innerloop">The loop
is for instance:</label></th>
- <!-- TMPL_ELSE -->
- <td>Starting period</td>
- <!-- /TMPL_IF -->
- <td><input type="text" id="innerloop"
name="innerloop1" value="<!-- TMPL_VAR name="innerloop1" -->"></td>
+ <td >The loop is for instance</td>
+ <td><input type="text" name="innerloop1"
value="<!-- TMPL_VAR name="innerloop1" -->"></td>
<td><input type="text" name="innerloop2"
value="<!-- TMPL_VAR name="innerloop2" -->"></td>
<td><input type="text" name="innerloop3"
value="<!-- TMPL_VAR name="innerloop3" -->"></td>
</tr>
+ <!-- /TMPL_IF -->
<tr>
- <th scope="row"><label for="whenmorethan1">When
more than:</label></th>
- <td><input type="text" id="whenmorethan1"
name="whenmorethan1" value="<!-- TMPL_VAR name="whenmorethan1" -->"></td>
- <td><input type="text" name="whenmorethan2"
value="<!-- TMPL_VAR name="whenmorethan2" -->"></td>
- <td><input type="text" name="whenmorethan3"
value="<!-- TMPL_VAR name="whenmorethan3" -->"></td>
- </tr>
- <tr>
- <th scope="row"><label for="setto1">...Set back
to:</label></th>
- <td><input type="text" id="setto1"
name="setto1" value="<!-- TMPL_VAR name="setto1" -->"></td>
+ <td >Set back to</td>
+ <td><input type="text" name="setto1"
value="<!-- TMPL_VAR name="setto1" -->"></td>
<td><input type="text" name="setto2"
value="<!-- TMPL_VAR name="setto2" -->"></td>
<td><input type="text" name="setto3"
value="<!-- TMPL_VAR name="setto3" -->"></td>
</tr>
<tr>
- <th scope="row">
+ <td >
<!-- TMPL_IF name="mod" -->
- <label for="lastvalue1">Last
value:</label>
+ Last value
<!-- TMPL_ELSE -->
- <label for="lastvalue1">Begins
with:</label>
+ Begins with
<!-- /TMPL_IF -->
- </th>
- <td><input type="text" id="lastvalue1"
name="lastvalue1" value="<!-- TMPL_VAR name="lastvalue1" -->"></td>
+ </td>
+ <td><input type="text" name="lastvalue1"
value="<!-- TMPL_VAR name="lastvalue1" -->"></td>
<td><input type="text" name="lastvalue2"
value="<!-- TMPL_VAR name="lastvalue2" -->"></td>
<td><input type="text" name="lastvalue3"
value="<!-- TMPL_VAR name="lastvalue3" -->"></td>
</tr>
- </table>
+ </table> </div>
</div>
-
<!-- TMPL_IF name="mod" -->
- <input type="button" value="Save subscription"
onclick="Check(this.form)" accesskey="w" class="submit">
+ <input type="button" value="Save subscription"
onclick="Check(this.form)" accesskey="w" class="button bull">
<!-- TMPL_ELSE -->
- <input type="button" value="Add subscription"
onclick="Check(this.form)" accesskey="w" class="submit">
-<!-- /TMPL_IF --></div>
+ <input type="button" value="Add subscription"
onclick="Check(this.form)" accesskey="w" class="button bull">
+<!-- /TMPL_IF -->
+</form>
+</div>
+
+
+<!-- TMPL_INCLUDE NAME="intranet-bottom.inc" -->
<script language="JavaScript" type="text/javascript">
function Plugin(f)
{
- window.open("subscription-bib-search.pl","Find a bib
index",'width=500,height=400,toolbar=false,scrollbars=yes');
+
window.open('subscription-bib-search.pl','FindABibIndex','width=500,height=400,toolbar=no,scrollbars=yes');
}
function FindAcqui(f)
{
- window.open("acqui-search.pl","Find a
supplier",'width=500,height=400,toolbar=false,scrollbars=yes');
+
window.open('acqui-search.pl','FindASupplier','width=500,height=400,toolbar=no,scrollbars=yes');
}
-
-function Check(f)
+function Find_ISSN(f)
{
- if (f.startdate.value.length != 0 &&
-
f.numberlength.value+f.weeklength.value+f.monthlength.value > 0)
- {
+
window.open('issn-search.pl','FindABibIndex','width=500,height=400,toolbar=no,scrollbars=yes');
+}
+
+
+function Check(f) {
+ if (f.startdate.value.length != 0 && f.sublength.value > 0) {
+ if (f.irreg_check.value == 1) {
document.f.submit();
+ } else {
+ if(f.numbering_pattern.value == ''){
+ alert("need to choose a numbering pattern");
+ } else {
+ alert("need to check for irregularity by
clicking 'Irregularity?'");
}
-else
-{
+ }
+ } else {
alert('field marked with * are mandatory');
-}
+ }
return false;
}
</script>
-
-<!-- TMPL_INCLUDE NAME="intranet-bottom.inc" -->
+<!-- TMPL_IF name="mod" -->
+<script type="text/javascript">
+window.onload = modify_num_pattern();
+ <!-- TMPL_IF name="hemisphere" -->
+ window.onload = hemispheres(<!-- TMPL_VAR NAME="hemisphere" -->);
+ <!-- /TMPL_IF -->
+</script>
+<!-- /TMPL_IF -->
+<!-- TMPL_IF name="irregularity" -->
+<script type="text/javascript">
+window.onload = irregularity_check();
+window.onload = irregular_order();
+</script>
+<!-- /TMPL_IF -->
Index: koha-tmpl/intranet-tmpl/npl/en/bull/subscription-detail.tmpl
===================================================================
RCS file:
/sources/koha/koha/koha-tmpl/intranet-tmpl/npl/en/bull/Attic/subscription-detail.tmpl,v
retrieving revision 1.2.2.5
retrieving revision 1.2.2.6
diff -u -b -r1.2.2.5 -r1.2.2.6
--- koha-tmpl/intranet-tmpl/npl/en/bull/subscription-detail.tmpl 18 May
2006 20:23:36 -0000 1.2.2.5
+++ koha-tmpl/intranet-tmpl/npl/en/bull/subscription-detail.tmpl 24 Nov
2006 00:23:22 -0000 1.2.2.6
@@ -3,6 +3,143 @@
<!-- TMPL_INCLUDE NAME="serials-topmenu.inc" -->
<!-- TMPL_INCLUDE NAME="intranet-nav.inc" -->
+<script type="text/javascript" language="javascript">
+<!--
+// the english words used in display purposes
+var text = new Array('Number','Volume','Issue','Month','Week','Starting
with:','Rollover at:','Choose Hemisphere:','Northern','Southern',
+'Autumn','Winter','Spring','Summer','Fall','Season','Year');
+
+// common pre defined number patterns
+function num_pattern() {
+var patternchoice = '<!--TMPL_VAR NAME='numberpattern'-->';
+ switch(patternchoice){
+ case "2":
+ options(text[1],text[0],text[2]);
+ irregularity();
+ display_table(0);
+ break;
+ case "3":
+ options(text[1],text[0]);
+ irregularity();
+ display_table(0);
+ break;
+ case "4":
+ options(text[1],text[2]);
+ irregularity();
+ display_table(0);
+ break;
+ case "5":
+ options(text[0],text[2]);
+ irregularity();
+ display_table(0);
+ break;
+ case "6":
+ var d = new Date();
+ var sYear = d.getFullYear();
+ // options_seasons(text[15],sYear);
+ irregularity();
+ is_season = 1;
+ display_table(0);
+ break;
+ case "7":
+ display_table(1);
+ irregularity();
+ break;
+ case "8":
+ options(text[16],text[3]);
+ irregularity();
+ is_month = 1;
+ display_table(0);
+ break;
+ default:
+ options(text[0]);
+ irregularity();
+ display_table(0);
+ break;
+ }
+}
+
+function display_table(n) {
+ if(n==1){
+ document.getElementById("basetable").style.display = 'block';
+ } else {
+ document.getElementById("basetable").style.display = 'none';
+ }
+}
+
+// to dispaly the options section
+function options(x,y,z){
+var textbox = '';
+ // alert("X: "+x+"Y: "+y+"Z: "+z);
+ if(x){
+ document.f.xfield.value = x;
+ if(y){
+ document.f.yfield.value = y;
+ if(z){
+ document.f.zfield.value = z;
+ }
+ }
+ }
+}
+
+function irregularity(){
+ var periodicity = '<!-- TMPL_VAR NAME="periodicity"-->';
+ switch(periodicity){
+ case "1":
+ var names = new
Array('Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday');
+ break;
+ case "2":
+ <!-- TMPL_IF NAME="weekarrayjs" -->
+ var names = new Array(<!-- TMPL_VAR NAME="weekarrayjs" -->);
+ <!-- /TMPL_IF -->
+ break;
+ case "3":
+ <!-- TMPL_IF NAME="weekarrayjs" -->
+ var names = new Array(<!-- TMPL_VAR NAME="weekarrayjs" -->);
+ <!-- /TMPL_IF -->
+ break;
+ case "4":
+ <!-- TMPL_IF NAME="weekarrayjs" -->
+ var names = new Array(<!-- TMPL_VAR NAME="weekarrayjs" -->);
+ <!-- /TMPL_IF -->
+ break;
+ case "5":
+ var names = new
Array('January','February','March','April','May','June','July','August','September','October','November','December');
+ break;
+ case "6":
+ var names = new
Array('January','February','March','April','May','June','July','August','September','October','November','December');
+ break;
+ case "7":
+ var names = new
Array('January','February','March','April','May','June','July','August','September','October','November','December');
+ break;
+ case "8":
+ var names = new
Array('Autumn','Winter','Spring','Summer','Fall');
+ break;
+ case "9":
+ var names = new
Array('January','February','March','April','May','June','July','August','September','October','November','December');
+ break;
+ case "10":
+ expected =1;
+ break;
+ default:
+ break;
+ }
+
+ <!-- TMPL_IF NAME="irregularity" -->
+ var irregular = '<!-- TMPL_VAR NAME="irregularity" -->';
+ var irregarray = irregular.split('|');
+ var irregtext = '<p>';
+ for(var i=0;i<irregarray.length;i++){
+ irregtext += names[i]+' ';
+ }
+ irregtext += '</p>';
+ document.getElementById("irreg").innerHTML = irregtext;
+ <!-- /TMPL_IF -->
+}
+
+-->
+</script>
+
<div id="main">
<h1>Subscription Details: <!-- TMPL_VAR name="bibliotitle" --></h1>
<form class="inline" method="get" action="subscription-add.pl">
@@ -26,6 +163,15 @@
<input type="hidden" name="bib" value="<!-- TMPL_VAR name="biblionumber" -->"
/>
<input type="submit" class="submit" title="go to <!-- TMPL_VAR
name="bibliotitle" -->" value="View Biblio Record" /></form>
+<form class="inline" method="get" action="/cgi-bin/koha/bull/routing.pl">
+<input type="hidden" name="subscriptionid" value="<!-- TMPL_VAR
name="subscriptionid" -->" />
+<!-- TMPL_IF NAME="routing" -->
+<input type="submit" class="submit" title="Edit Routing List" value="Edit
Routing List" />
+<!-- TMPL_ELSE -->
+<input type="hidden" name="op" value="new" />
+<input type="submit" class="submit" title="Create Routing List" value="Create
Routing List" />
+<!-- /TMPL_IF -->
+
<form class="inline"><input type="submit" class="cancel" value="Delete
Subscription" onclick="confirm_deletion(); return false;" /></form>
<div class="data">
@@ -39,6 +185,7 @@
</div>
<div class="data">
+<form name="f">
<table> <caption>Planning</caption>
<tr><th scope="row">Beginnning date:</th><td> <!-- TMPL_VAR
name="startdate" --></td></tr>
<tr><th scope="row">Frequency (*):</th><td>
@@ -76,6 +223,31 @@
1/2 Years
<!-- /TMPL_IF -->
</td></tr>
+
+ <tr><th scope="row">Number Pattern:</th><td>
+ <!-- TMPL_IF name="numberpattern1" -->
+ Number
+ <!-- /TMPL_IF -->
+ <!-- TMPL_IF name="numberpattern2" -->
+ Volume, Number, Issue
+ <!-- /TMPL_IF -->
+ <!-- TMPL_IF name="numberpattern3" -->
+ Volume, Number
+ <!-- /TMPL_IF -->
+ <!-- TMPL_IF name="numberpattern4" -->
+ Volume, Issue
+ <!-- /TMPL_IF -->
+ <!-- TMPL_IF name="numberpattern5" -->
+ Number, Issue
+ <!-- /TMPL_IF -->
+ <!-- TMPL_IF name="numberpattern6" -->
+ Seasonal only
+ <!-- /TMPL_IF -->
+ <!-- TMPL_IF name="numberpattern7" -->
+ None of the above
+ <!-- /TMPL_IF -->
+ </td></tr>
+
<tr><th scope="row">Arrives on:</th><td>
<!--TMPL_IF name="arrival1" -->
Monday
@@ -99,6 +271,56 @@
Sunday
<!-- /TMPL_IF --></table>
</div>
+
+
+<table>
+<tr><td> </td>
+ <td align="right"><input type="text" name="xfield" style="border:0px solid
#FFFFFF; text-align:center;"></td>
+ <!--TMPL_IF NAME="lastvalue2"-->
+ <td align="right"><input type="text" name="yfield"
style="border:0px solid #FFFFFF; text-align:center;"></td>
+ <!--/TMPL_IF-->
+ <!--TMPL_IF NAME="lastvalue3"-->
+ <td align="right"><input type="text" name="zfield"
style="border:0px solid #FFFFFF; text-align:center;"></td>
+ <!--/TMPL_IF-->
+ </tr>
+ <tr><td>Starting with:</td>
+ <td align="center"><!--TMPL_VAR NAME="lastvalue1"--></td>
+ <!--TMPL_IF NAME="lastvalue2"-->
+ <td align="center">
+ <!--TMPL_VAR NAME="lastvalue2"-->
+ </td>
+ <!--/TMPL_IF-->
+ <!--TMPL_IF NAME="lastvalue3"-->
+ <td align="center">
+ <!--TMPL_VAR NAME="lastvalue3"-->
+ </td>
+ <!--/TMPL_IF-->
+ </tr>
+ <tr><td>Rollover:</td>
+ <td align="center"> </td>
+ <!--TMPL_IF NAME="whenmorethan2"-->
+ <td align="center">
+ <!--TMPL_VAR NAME="whenmorethan2"-->
+ </td>
+ <!--/TMPL_IF-->
+ <!--TMPL_IF NAME="whenmorethan3"-->
+ <td align="center">
+ <!--TMPL_VAR NAME="whenmorethan3"-->
+ </td>
+ <!--/TMPL_IF-->
+ </tr>
+ </table>
+ <!-- TMPL_IF NAME="irregularity" -->
+ <p>Irregularity:
+ <div id="irreg"></div>
+ </p>
+ <!-- /TMPL_IF -->
+ <p>Begins on:</label>
+ <!--TMPL_VAR name="startdate" -->
+ </p>
+ </form>
+
+
<div class="data">
<table> <caption>Subscription length</caption>
<tr><th scope="row">Number of issues:</th><td><!-- TMPL_VAR
name="numberlength" --></td></tr>
@@ -106,7 +328,7 @@
<tr><th scope="row">Number of months:</th><td><!-- TMPL_VAR
name="monthlength" --></td></tr></table>
</div>
-<div class="data">
+<div class="data" id="basetable">
<h2>Numbering calculation</h2>
<table><caption>Numbering formula: <!-- TMPL_VAR
name="numberingmethod" --></caption>
@@ -213,5 +435,6 @@
window.location="subscription-detail.pl?subscriptionid=<!--
TMPL_VAR name="subscriptionid" -->&op=del";
}
}
+window.onload = num_pattern();
</script>
<!-- TMPL_INCLUDE NAME="intranet-bottom.inc" -->
\ No newline at end of file
Index: koha-tmpl/intranet-tmpl/npl/en/bull/subscription-renew.tmpl
===================================================================
RCS file:
/sources/koha/koha/koha-tmpl/intranet-tmpl/npl/en/bull/Attic/subscription-renew.tmpl,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -b -r1.1.2.1 -r1.1.2.2
--- koha-tmpl/intranet-tmpl/npl/en/bull/subscription-renew.tmpl 9 Jun 2005
19:41:00 -0000 1.1.2.1
+++ koha-tmpl/intranet-tmpl/npl/en/bull/subscription-renew.tmpl 24 Nov 2006
00:23:22 -0000 1.1.2.2
@@ -1,9 +1,11 @@
-<!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->Subscription Renewal for <!--
TMPL_VAR name="bibliotitle" --><!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
-<div id="main-compact">
+<!-- TMPL_INCLUDE NAME="popup-top.inc" -->
+<div id="main">
<h1>Subscription Renewal for <!-- TMPL_VAR name="bibliotitle" --></h1>
<form name="f" method="post" action="subscription-renew.pl">
+<input type="hidden" name="op" value="renew">
+<input type="hidden" name="subscriptionid" value="<!-- TMPL_VAR
name="subscriptionid" -->">
<div class="data">
<table><tr><th><label>Start Date: </label></th><td><input
type="text" name="startdate" value="<!-- TMPL_VAR name="startdate" -->"
/><input type="hidden" name="op" value="renew" /><input type="hidden"
name="subscriptionid" value="<!-- TMPL_VAR name="subscriptionid" -->"
/></td></tr></table>
@@ -17,5 +19,14 @@
</div>
</form>
</div>
+ <!-- TMPL_IF NAME="done" -->
+ <script type="text/javascript">
+ <!--
+ opener.document.location.reload();
+ self.close();
+ //-->
+ </script>
+ <!-- /TMPL_IF -->
<!-- TMPL_INCLUDE NAME="intranet-bottom.inc" -->
+
Index: koha-tmpl/intranet-tmpl/npl/en/includes/serials-topmenu.inc
===================================================================
RCS file:
/sources/koha/koha/koha-tmpl/intranet-tmpl/npl/en/includes/Attic/serials-topmenu.inc,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -b -r1.1.2.1 -r1.1.2.2
--- koha-tmpl/intranet-tmpl/npl/en/includes/serials-topmenu.inc 10 Jan 2005
17:08:36 -0000 1.1.2.1
+++ koha-tmpl/intranet-tmpl/npl/en/includes/serials-topmenu.inc 24 Nov 2006
00:23:22 -0000 1.1.2.2
@@ -1 +1,3 @@
-<div id="topmenu"><a href="/cgi-bin/koha/bull-home.pl">Serials Home</a> | <a
href="/cgi-bin/koha/bull/subscription-add.pl">Add Subscription</a> | <a
href="/cgi-bin/koha/bull/lateissues.pl">Late Issues</a></div>
\ No newline at end of file
+<div id="topmenu"><a href="/cgi-bin/koha/bull-home.pl">Serials Home</a> | <a
href="/cgi-bin/koha/bull/subscription-add.pl">Add Subscription</a> | <a
href="/cgi-bin/koha/bull/lateissues.pl">Late Issues</a>
+| <a href="/cgi-bin/koha/bull-home.pl?routing=1">Create/Edit Routing
+List</a> | <a href="/cgi-bin/koha/bull/claims.pl">Claims</a></div>
Index: updater/updatedatabase
===================================================================
RCS file: /sources/koha/koha/updater/updatedatabase,v
retrieving revision 1.100.2.54
retrieving revision 1.100.2.55
diff -u -b -r1.100.2.54 -r1.100.2.55
--- updater/updatedatabase 31 Aug 2006 14:37:04 -0000 1.100.2.54
+++ updater/updatedatabase 24 Nov 2006 00:23:22 -0000 1.100.2.55
@@ -1,6 +1,6 @@
#!/usr/bin/perl
-# $Id: updatedatabase,v 1.100.2.54 2006/08/31 14:37:04 tipaul Exp $
+# $Id: updatedatabase,v 1.100.2.55 2006/11/24 00:23:22 bob_lyon Exp $
# Database Updater
# This script checks for required updates to the database.
@@ -320,6 +320,8 @@
status tinyint(4) NOT NULL default '0',
planneddate date NOT NULL default '0000-00-00',
publishedddate date NOT NULL default
'0000-00-00',
+ routingnotes text,
+ claimdate date default NULL,
PRIMARY KEY (serialid)
)",
subscription => "(biblionumber int(11) NOT NULL default '0',
@@ -333,7 +335,10 @@
monthlength tinyint(4) default
'0',
numberlength tinyint(4) default
'0',
periodicity tinyint(4) default
'0',
+ firstacquidate date default
'0000-00-00',
dow varchar(100) default '',
+ numberpattern int(4) default
'0',
+ irregularity varchar(255)
default NULL,
numberingmethod varchar(100)
default '',
notes text,
status varchar(100) NOT NULL
default '',
@@ -355,6 +360,8 @@
whenmorethan3 int(11) default 0,
setto3 int(11),
lastvalue3 int(11),
+ hemisphere int(1) default '1',
+ callnumber varchar(100) default
NULL,
PRIMARY KEY (subscriptionid)
)",
subscriptionhistory => "(biblionumber int(11) NOT NULL default '0',
@@ -368,6 +375,13 @@
PRIMARY KEY
(subscriptionid),
KEY biblionumber
(biblionumber)
)",
+ subscriptionroutinglist => "(routingid int(11) NOT NULL default null
auto_increment,
+ subscriptionid int(11) NOT NULL default '0',
+ borrowernumber int(11) NOT NULL default '0',
+ ranking int(11) NOT NULL default '0',
+ numberpattern varchar(100) default null,
+ PRIMARY KEY (routingid)
+ )",
labels => "(labelid int(11) NOT NULL auto_increment,
itemnumber varchar(100) NOT NULL default '',
timestamp timestamp(14) NOT NULL,
@@ -1375,6 +1389,19 @@
},
{
uniquefieldrequired => 'variable',
+ variable => 'RoutingSerials',
+ value => '0',
+ forceupdate => {
+ 'explanation' => 1,
+ '
+ type' => 1
+ },
+ explanation =>
+'If set, you will have access to routing serials',
+ type => 'YesNo',
+ },
+ {
+ uniquefieldrequired => 'variable',
variable => 'advancedMARCeditor',
value => '0',
forceupdate => {
@@ -2193,6 +2220,9 @@
exit;
# $Log: updatedatabase,v $
+# Revision 1.100.2.55 2006/11/24 00:23:22 bob_lyon
+# Adding in the updated files for the routing serials
+#
# Revision 1.100.2.54 2006/08/31 14:37:04 tipaul
# fix for :
# http://bugs.koha.org/cgi-bin/bugzilla/show_bug.cgi?id=1140
Index: C4/Bull.pm
===================================================================
RCS file: /sources/koha/koha/C4/Attic/Bull.pm,v
retrieving revision 1.6.2.34
retrieving revision 1.6.2.35
diff -u -b -r1.6.2.34 -r1.6.2.35
--- C4/Bull.pm 26 Sep 2006 10:04:06 -0000 1.6.2.34
+++ C4/Bull.pm 24 Nov 2006 00:23:22 -0000 1.6.2.35
@@ -53,7 +53,152 @@
&getserials &getlatestserials &serialchangestatus
&Find_Next_Date, &Get_Next_Seq
&hassubscriptionexpired &subscriptionexpirationdate
&subscriptionrenew
- &getSupplierListWithLateIssues &GetLateIssues);
+ &getSupplierListWithLateIssues &GetLateIssues
&GetMissingIssues
+ &getroutinglist &delroutingmember &addroutingmember
&reorder_members
+ &check_routing &getsupplierbyserialid &updateClaim
&removeMissingIssue &abouttoexpire
+ &old_getserials &old_newsubscription
&old_modsubscription &old_serialchangestatus);
+
+# for removing the missing issue sequence from the box on check-in page
+sub removeMissingIssue {
+ my ($sequence,$subscriptionid) = @_;
+ my $dbh = C4::Context->dbh;
+ my $sth = $dbh->prepare("SELECT * FROM subscriptionhistory WHERE
subscriptionid = ?");
+ $sth->execute($subscriptionid);
+ my $data = $sth->fetchrow_hashref;
+ my $missinglist = $data->{'missinglist'};
+ my $missinglistbefore = $missinglist;
+ # warn $missinglist." before";
+ $missinglist =~ s/($sequence)//;
+ # warn $missinglist." after";
+ if($missinglist ne $missinglistbefore){
+ $missinglist =~ s/\|\s\|/\|/g;
+ $missinglist =~ s/^\| //g;
+ $missinglist =~ s/\|$//g;
+ my $sth2= $dbh->prepare("UPDATE subscriptionhistory
+ SET missinglist = ?
+ WHERE subscriptionid = ?");
+ $sth2->execute($missinglist,$subscriptionid);
+ }
+}
+
+sub updateClaim {
+ my ($serialid) = @_;
+ my $dbh = C4::Context->dbh;
+ my $sth = $dbh->prepare("UPDATE serial SET claimdate = now()
+ WHERE serialid = ?
+ ");
+ $sth->execute($serialid);
+}
+
+sub getsupplierbyserialid {
+ my ($serialid) = @_;
+ my $dbh = C4::Context->dbh;
+ my $sth = $dbh->prepare("SELECT serialid, serial.subscriptionid,
aqbooksellerid
+ FROM serial, subscription
+ WHERE serial.subscriptionid =
subscription.subscriptionid
+ AND serialid = ?
+ ");
+ $sth->execute($serialid);
+ my $line = $sth->fetchrow_hashref;
+ my $result = $line->{'aqbooksellerid'};
+ return $result;
+}
+
+sub check_routing {
+ my ($subscriptionid) = @_;
+ my $dbh = C4::Context->dbh;
+ my $sth = $dbh->prepare("SELECT count(routingid) routingids FROM
subscriptionroutinglist, subscription
+ WHERE subscription.subscriptionid =
subscriptionroutinglist.subscriptionid
+ AND subscription.subscriptionid = ? ORDER BY
ranking ASC
+ ");
+ $sth->execute($subscriptionid);
+ my $line = $sth->fetchrow_hashref;
+ my $result = $line->{'routingids'};
+ return $result;
+}
+
+sub addroutingmember {
+ my ($bornum,$subscriptionid) = @_;
+ my $rank;
+ my $dbh = C4::Context->dbh;
+ my $sth = $dbh->prepare("SELECT max(ranking) rank FROM
subscriptionroutinglist WHERE subscriptionid = ?");
+ $sth->execute($subscriptionid);
+ while(my $line = $sth->fetchrow_hashref){
+ if($line->{'rank'}>0){
+ $rank = $line->{'rank'}+1;
+ } else {
+ $rank = 1;
+ }
+ }
+ $sth = $dbh->prepare("INSERT INTO subscriptionroutinglist VALUES
(null,?,?,?,null)");
+ $sth->execute($subscriptionid,$bornum,$rank);
+}
+
+sub reorder_members {
+ # updates the ranks for the unique routingids for a subscription
+ # if $rank is specified then it changes the ranking of the routingid
to the new rank
+ my ($subscriptionid,$routingid,$rank) = @_;
+ my $dbh = C4::Context->dbh;
+ my $sth = $dbh->prepare("SELECT * FROM subscriptionroutinglist WHERE
subscriptionid = ? ORDER BY ranking ASC");
+ $sth->execute($subscriptionid);
+ my @result;
+ while(my $line = $sth->fetchrow_hashref){
+ push(@result,$line->{'routingid'});
+ }
+
+ # To find the matching index
+ my $i;
+ my $key = -1; # to allow for 0 being a valid response
+ for ($i = 0; $i < @result; $i++) {
+ if ($routingid == $result[$i]) {
+ $key = $i; # save the index
+ last;
+ }
+ }
+ # warn "key: $key";
+ # if index exists in array then move it to new position
+ if($key > -1 && $rank > 0){
+ my $new_rank = $rank-1; # $new_rank is what you want the new index
to be in the array
+ my $moving_item = splice(@result, $key, 1);
+ splice(@result, $new_rank, 0, $moving_item);
+ }
+ for(my $j = 0; $j < @result; $j++){
+ my $sth = $dbh->prepare("UPDATE subscriptionroutinglist SET
ranking = '" . ($j+1) . "' WHERE routingid = '". $result[$j]."'");
+ $sth->execute;
+ }
+}
+
+sub delroutingmember {
+ # if $routingid exists then deletes that row otherwise deletes all
with $subscriptionid
+ my ($routingid,$subscriptionid) = @_;
+ my $dbh = C4::Context->dbh;
+ if($routingid){
+ my $sth = $dbh->prepare("DELETE FROM subscriptionroutinglist
WHERE routingid = ?");
+ $sth->execute($routingid);
+ reorder_members($subscriptionid,$routingid);
+ } else {
+ my $sth = $dbh->prepare("DELETE FROM subscriptionroutinglist
WHERE subscriptionid = ?");
+ $sth->execute($subscriptionid);
+ }
+}
+
+sub getroutinglist {
+ my ($subscriptionid) = @_;
+ my $dbh = C4::Context->dbh;
+ my $sth = $dbh->prepare("SELECT routingid, borrowernumber,
+ ranking, biblionumber FROM
subscriptionroutinglist, subscription
+ WHERE subscription.subscriptionid =
subscriptionroutinglist.subscriptionid
+ AND subscription.subscriptionid = ? ORDER BY
ranking ASC
+ ");
+ $sth->execute($subscriptionid);
+ my @routinglist;
+ my $count=0;
+ while (my $line = $sth->fetchrow_hashref) {
+ $count++;
+ push(@routinglist,$line);
+ }
+ return ($count,@routinglist);
+}
sub getSupplierListWithLateIssues {
my $dbh = C4::Context->dbh;
@@ -61,13 +206,14 @@
FROM subscription,
serial
LEFT JOIN aqbooksellers
ON subscription.aqbooksellerid = aqbooksellers.id
WHERE
subscription.subscriptionid = serial.subscriptionid AND
- (planneddate < now( )
OR serial.STATUS = 3)
+ (planneddate < now( )
OR serial.STATUS = 3 OR serial.STATUS = 4)
");
$sth->execute;
my %supplierlist;
while (my ($id,$name) = $sth->fetchrow) {
$supplierlist{$id} = $name;
}
+ $supplierlist{''} = "All Suppliers";
return %supplierlist;
}
sub GetLateIssues {
@@ -96,15 +242,62 @@
my @issuelist;
my $last_title;
my $odd=0;
+ my $count=0;
while (my $line = $sth->fetchrow_hashref) {
$odd++ unless $line->{title} eq $last_title;
$line->{title} = "" if $line->{title} eq $last_title;
$last_title = $line->{title} if ($line->{title});
$line->{planneddate} = format_date($line->{planneddate});
$line->{'odd'} = 1 if $odd %2 ;
+ $count++;
push @issuelist,$line;
}
- return @issuelist;
+ return $count,@issuelist;
+}
+
+sub GetMissingIssues {
+ my ($supplierid,$serialid) = @_;
+ my $dbh = C4::Context->dbh;
+ my $sth;
+ my $byserial='';
+ if($serialid) {
+ $byserial = "and serialid = ".$serialid;
+ }
+
+ if ($supplierid) {
+ $sth = $dbh->prepare("SELECT
serialid,aqbooksellerid,name,title,planneddate,serialseq,serial.subscriptionid,claimdate
+ FROM subscription, serial, biblio
+ LEFT JOIN aqbooksellers ON
subscription.aqbooksellerid = aqbooksellers.id
+ WHERE subscription.subscriptionid =
serial.subscriptionid AND
+ serial.STATUS = 4 and
+ subscription.aqbooksellerid=$supplierid and
+ biblio.biblionumber =
subscription.biblionumber ".$byserial." order by title
+ ");
+ } else {
+ $sth = $dbh->prepare("SELECT
serialid,aqbooksellerid,name,title,planneddate,serialseq,serial.subscriptionid,claimdate
+ FROM subscription, serial, biblio
+ LEFT JOIN aqbooksellers ON
subscription.aqbooksellerid = aqbooksellers.id
+ WHERE subscription.subscriptionid =
serial.subscriptionid AND
+ serial.STATUS =4 and
+ biblio.biblionumber =
subscription.biblionumber ".$byserial." order by title
+ ");
+ }
+ $sth->execute;
+ my @issuelist;
+ my $last_title;
+ my $odd=0;
+ my $count=0;
+ while (my $line = $sth->fetchrow_hashref) {
+ $odd++ unless $line->{title} eq $last_title;
+ # $line->{title} = "" if $line->{title} eq
$last_title;
+ $last_title = $line->{title} if ($line->{title});
+ $line->{planneddate} =
format_date($line->{planneddate});
+ $line->{claimdate} =
format_date($line->{claimdate});
+ $line->{'odd'} = 1 if $odd %2 ;
+ $count++;
+ push @issuelist,$line;
+ }
+ return $count,@issuelist;
}
sub newsubscription {
@@ -293,6 +486,19 @@
$numberingmethod, $status,
$biblionumber, $notes, $subscriptionid);
$sth->finish;
+ $sth = $dbh->prepare("select * from subscription where subscriptionid
= ? ");
+ $sth->execute($subscriptionid);
+ my $val = $sth->fetchrow_hashref;
+
+ # calculate issue number
+ my $serialseq = Get_Seq($val);
+ $sth = $dbh->prepare("UPDATE serial SET serialseq = ? WHERE
subscriptionid = ?");
+ $sth->execute($serialseq,$subscriptionid);
+
+ my $enddate = subscriptionexpirationdate($subscriptionid);
+ $sth = $dbh->prepare("update subscriptionhistory set enddate=?");
+ $sth->execute(format_date_in_iso($enddate));
+
}
sub delsubscription {
@@ -314,20 +520,20 @@
} else {
if ($ISSN and $title)
{
- $sth = $dbh->prepare("SELECT
subscription.subscriptionid,biblio.title,biblioitems.issn,subscription.notes,biblio.biblionumber
from subscription,biblio,biblioitems where biblio.biblionumber =
biblioitems.biblionumber and biblio.biblionumber=subscription.biblionumber and
(biblio.title like ? or biblioitems.issn = ? order by title )");
+ $sth = $dbh->prepare("SELECT
subscription.subscriptionid,biblio.title,biblioitems.issn,subscription.notes,biblio.biblionumber
from subscription,biblio,biblioitems where biblio.biblionumber =
biblioitems.biblionumber and biblio.biblionumber=subscription.biblionumber and
(biblio.title like ? or biblioitems.issn = ? group by subscriptionid order by
title )");
$sth->execute("%$title%",$ISSN);
}
else
{
if ($ISSN)
{
- $sth = $dbh->prepare("SELECT
subscription.subscriptionid,biblio.title,biblioitems.issn,subscription.notes,biblio.biblionumber
from subscription,biblio,biblioitems where biblio.biblionumber =
biblioitems.biblionumber and biblio.biblionumber=subscription.biblionumber and
biblioitems.issn = ? order by title");
+ $sth = $dbh->prepare("SELECT
subscription.subscriptionid,biblio.title,biblioitems.issn,subscription.notes,biblio.biblionumber
from subscription,biblio,biblioitems where biblio.biblionumber =
biblioitems.biblionumber and biblio.biblionumber=subscription.biblionumber and
biblioitems.issn = ? group by subscriptionid order by title");
$sth->execute($ISSN);
}
else
{
$sth = $dbh->prepare("SELECT
subscription.subscriptionid,biblio.title,biblioitems.issn,subscription.notes,biblio.biblionumber
from subscription,biblio,biblioitems where biblio.biblionumber =
biblioitems.biblionumber and
- biblio.biblionumber=subscription.biblionumber and biblio.title like ? order
by title");
+ biblio.biblionumber=subscription.biblionumber and biblio.title like ? group
by subscriptionid order by title");
$sth->execute("%$title%");
}
}
@@ -357,9 +563,9 @@
UPDATE subscriptionhistory
SET
histstartdate=?,enddate=?,recievedlist=?,missinglist=?,opacnote=?,librariannote=?
WHERE subscriptionid=?");
- $recievedlist =~ s/^,//g;
- $missinglist =~ s/^,//g;
- $opacnote =~ s/^,//g;
+ $recievedlist =~ s/^\| ,//g;
+ $missinglist =~ s/^\| ,//g;
+ $opacnote =~ s/^\| ,//g;
$sth->execute($histstartdate,$enddate,$recievedlist,$missinglist,$opacnote,$librariannote,$subscriptionid);
}
# get every serial not arrived for a given subscription
@@ -497,11 +703,51 @@
=cut
sub serialsitemize {
my ($serialid, $info) address@hidden;
+ my $now = ParseDate("today");
+ $now = UnixDate( $now, "%Y-%m-%d" );
my $dbh= C4::Context->dbh;
my $sth=$dbh->prepare("SELECT * from serial WHERE serialid=?");
$sth->execute($serialid);
my $data=$sth->fetchrow_hashref;
+ if ( C4::Context->preference("RoutingSerials") ) {
+
+ # check for existing biblioitem relating to serial issue
+ my ( $count, @results ) =
+ getbiblioitembybiblionumber( $data->{'biblionumber'} );
+ my $bibitemno = 0;
+ for ( my $i = 0 ; $i < $count ; $i++ ) {
+ if ( $results[$i]->{'volumeddesc'} eq
$data->{'serialseq'} . ' ('
+ . $data->{'planneddate'}
+ . ')' )
+ {
+ $bibitemno =
$results[$i]->{'biblioitemnumber'};
+ last;
+ }
+ }
+ if ( $bibitemno == 0 ) {
+
+ # warn "need to add new biblioitem so copy last one and
make minor changes";
+ my $sth =
+ $dbh->prepare(
+ "SELECT * FROM biblioitems WHERE
biblionumber = ? ORDER BY biblioitemnumber DESC"
+ );
+ $sth->execute( $data->{'biblionumber'} );
+ my $biblioitem = $sth->fetchrow_hashref;
+ $biblioitem->{'volumedate'} =
+ format_date_in_iso( $data->{planneddate} );
+ $biblioitem->{'volumeddesc'} =
+ $data->{serialseq} . ' ('
+ . format_date( $data->{'planneddate'} ) .
')';
+ $biblioitem->{'dewey'} =
$info->{itemcallnumber};
+
+ if ( $info->{barcode} )
+ { # only make biblioitem if we are going
to make item also
+ $bibitemno =
newbiblioitem($biblioitem);
+ }
+ }
+ }
+
# warn "biblionumber : ".$data->{biblionumber};
my
$bibid=MARCfind_MARCbibid_from_oldbiblionumber($dbh,$data->{biblionumber});
my $fwk=MARCfind_frameworkcode($dbh,$bibid);
@@ -594,6 +840,18 @@
$marcrecord->insert_fields_ordered($newField);
}
}
+ if ( C4::Context->preference("RoutingSerials") ) {
+ my ( $tag, $subfield ) =
+ MARCfind_marc_from_kohafield( $dbh,
"items.dateaccessioned",
+ $fwk );
+ if ( $marcrecord->field($tag) ) {
+
$marcrecord->field($tag)->add_subfields( "$subfield" => $now );
+ }
+ else {
+ my $newField =
MARC::Field->new( "$tag", '', '', "$subfield" => $now );
+
$marcrecord->insert_fields_ordered($newField);
+ }
+ }
NEWnewitem($dbh,$marcrecord,$bibid);
return 1;
}
@@ -608,6 +866,16 @@
$sth->execute($serialseq,$subscriptionid);
}
+sub in_array { # used in next sub down
+ my ($val,@elements) = @_;
+ foreach my $elem(@elements) {
+ if($val == $elem) {
+ return 1;
+ }
+ }
+ return 0;
+ }
+
sub Get_Next_Date(@) {
my ($planneddate,$subscription) = @_;
@@ -654,6 +922,20 @@
my $x=$val->{'lastvalue1'};
$calculated =~ s/\{X\}/$x/g;
my $y=$val->{'lastvalue2'};
+ my $pattern = $val->{numberpattern};
+ my @seasons = ('','Winter','Spring','Summer','Fall');
+ my @southern_seasons = ('','Summer','Autumn','Winter','Spring');
+ my @months =
('','January','February','March','April','May','June','July','August','September','October','November','December');
+ if($pattern == 6){
+ if($val->{hemisphere} == 2){
+ $y = $southern_seasons[$y];
+ } else {
+ $y = $seasons[$y];
+ }
+ }
+ if($pattern ==8){
+ $y = $months[$y];
+ }
$calculated =~ s/\{Y\}/$y/g;
my $z=$val->{'lastvalue3'};
$calculated =~ s/\{Z\}/$z/g;
@@ -691,6 +973,85 @@
return
($calculated,$newlastvalue1,$newlastvalue2,$newlastvalue3,$newinnerloop1,$newinnerloop2,$newinnerloop3);
}
+sub New_Get_Next_Seq {
+ my ($val,$nextplanneddate) address@hidden;
+ my
($calculated,$newlastvalue1,$newlastvalue2,$newlastvalue3,$newinnerloop1,$newinnerloop2,$newinnerloop3);
+ my $pattern = $val->{numberpattern};
+ my @seasons = ('nothing','Winter','Spring','Summer','Autumn');
+ my @southern_seasons = ('','Summer','Autumn','Winter','Spring');
+ my @months =
('','January','February','March','April','May','June','July','August','September','October','November','December');
+
+ my $new_month = UnixDate($nextplanneddate,"%m"); # for the month/year
calculations
+ my $new_year = UnixDate($nextplanneddate,"%Y"); # for the month/year
calculations
+ $calculated = $val->{numberingmethod};
+ $newlastvalue1 = $val->{lastvalue1};
+ $newlastvalue2 = $val->{lastvalue2};
+ $newlastvalue3 = $val->{lastvalue3};
+ if($newlastvalue3 > 0){ # if x y and z columns are used
+ $newlastvalue3 = $newlastvalue3+1;
+ if($newlastvalue3 > $val->{whenmorethan3}){
+ $newlastvalue3 = $val->{setto3};
+ $newlastvalue2++;
+ if($newlastvalue2 > $val->{whenmorethan2}){
+ $newlastvalue1++;
+ $newlastvalue2 = $val->{setto2};
+ }
+ }
+ $calculated =~ s/\{X\}/$newlastvalue1/g;
+ if($pattern == 6){
+ if($val->{hemisphere} == 2){
+ my $newlastvalue2seq = $southern_seasons[$newlastvalue2];
+ $calculated =~ s/\{Y\}/$newlastvalue2seq/g;
+ } else {
+ my $newlastvalue2seq = $seasons[$newlastvalue2];
+ $calculated =~ s/\{Y\}/$newlastvalue2seq/g;
+ }
+ } else {
+ $calculated =~ s/\{Y\}/$newlastvalue2/g;
+ }
+ $calculated =~ s/\{Z\}/$newlastvalue3/g;
+ }
+
+ if($newlastvalue2 > 0 && $newlastvalue3 < 1){ # if x and y columns are
used
+ $newlastvalue2 = $newlastvalue2+1;
+ # warn "y val: $newlastvalue2";
+ # warn "x val: $newlastvalue1";
+ if($newlastvalue2 > $val->{whenmorethan2}){
+ $newlastvalue2 = $val->{setto2};
+ $newlastvalue1++;
+ }
+ if($pattern == 8){
+ $calculated =~ s/\{X\}/$new_year/g;
+ } else {
+ $calculated =~ s/\{X\}/$newlastvalue1/g;
+ }
+ if($pattern == 6){
+ if($val->{hemisphere} == 2){
+ my $newlastvalue2seq = $southern_seasons[$newlastvalue2];
+ $calculated =~ s/\{Y\}/$newlastvalue2seq/g;
+ } else {
+ my $newlastvalue2seq = $seasons[$newlastvalue2];
+ $calculated =~ s/\{Y\}/$newlastvalue2seq/g;
+ }
+ } elsif($pattern == 8){
+ my $newlastvalue2seq = $months[$new_month];
+ $calculated =~ s/\{Y\}/$newlastvalue2seq/g;
+ } else {
+ $calculated =~ s/\{Y\}/$newlastvalue2/g;
+ }
+ }
+
+ if($newlastvalue1 > 0 && $newlastvalue2 < 1 && $newlastvalue3 < 1){ #
if column x only
+ $newlastvalue1 = $newlastvalue1+1;
+ if($newlastvalue1 > $val->{whenmorethan1}){
+ $newlastvalue1 = $val->{setto2};
+ }
+ $calculated =~ s/\{X\}/$newlastvalue1/g;
+ }
+ warn $calculated.' '.$newlastvalue1.' '.$newlastvalue2.'
'.$newlastvalue3;
+ return ($calculated,$newlastvalue1,$newlastvalue2,$newlastvalue3);
+}
+
# the subscription has expired when the next issue to arrive is out of
subscription limit.
sub hassubscriptionexpired {
my ($subscriptionid) = @_;
@@ -719,6 +1080,50 @@
}
}
+# is the subscription about to expire? - check if penultimate issue.
+sub abouttoexpire {
+ my ($subscriptionid) = @_;
+ my $dbh = C4::Context->dbh;
+ my $subscription = getsubscription($subscriptionid);
+ # we don't do the same test if the subscription is based on X numbers
or on X weeks/months
+ if ($subscription->{numberlength}) {
+ my $sth = $dbh->prepare("select count(*) from serial where
subscriptionid=? and planneddate>=?");
+ $sth->execute($subscriptionid,$subscription->{startdate});
+ my $res = $sth->fetchrow;
+ # warn "length: ".$subscription->{numberlength}." vs count:
".$res;
+ if ($subscription->{numberlength}==$res) {
+ return 1;
+ } else {
+ return 0;
+ }
+ } else {
+ # a little bit more tricky if based on X weeks/months : search
if the latest issue waited is not after subscription startdate + duration
+ my $sth = $dbh->prepare("select max(planneddate) from serial
where subscriptionid=?");
+ $sth->execute($subscriptionid);
+ my $res = ParseDate(format_date_in_iso($sth->fetchrow));
+ my $endofsubscriptiondate;
+ $endofsubscriptiondate =
DateCalc(format_date_in_iso($subscription->{startdate}),$subscription->{monthlength}."
months") if ($subscription->{monthlength});
+ $endofsubscriptiondate =
DateCalc(format_date_in_iso($subscription->{startdate}),$subscription->{weeklength}."
weeks") if ($subscription->{weeklength});
+ warn "last: ".$endofsubscriptiondate." vs currentdate: ".$res;
+ my $per = $subscription->{'periodicity'};
+ my $x = 0;
+ if ($per == 1) { $x = '1 day'; }
+ if ($per == 2) { $x = '1 week'; }
+ if ($per == 3) { $x = '2 weeks'; }
+ if ($per == 4) { $x = '3 weeks'; }
+ if ($per == 5) { $x = '1 month'; }
+ if ($per == 6) { $x = '2 months'; }
+ if ($per == 7 || $per == 8) { $x = '3 months'; }
+ if ($per == 9) { $x = '6 months'; }
+ if ($per == 10) { $x = '1 year'; }
+ if ($per == 11) { $x = '2 years'; }
+ my $datebeforeend = DateCalc($endofsubscriptiondate,"- ".$x); #
if ($subscription->{weeklength});
+ warn "DATE BEFORE END: $datebeforeend";
+ return 1 if ($res >= $datebeforeend && $res <
$endofsubscriptiondate);
+ return 0;
+ }
+}
+
sub subscriptionexpirationdate {
my ($subscriptionid) = @_;
my $dbh = C4::Context->dbh;
@@ -751,4 +1156,473 @@
$sth=$dbh->prepare("update subscription set
startdate=?,numberlength=?,weeklength=?,monthlength=? where subscriptionid=?");
$sth->execute(format_date_in_iso($startdate),$numberlength,$weeklength,$monthlength,
$subscriptionid);
}
+
+=head2 old_newsubscription
+
+=over 4
+
+($subscriptionid) =
&old_newsubscription($auser,$aqbooksellerid,$cost,$aqbudgetid,$biblionumber,
+
$startdate,$periodicity,$firstacquidate,$dow,$irregularity,$numberpattern,$numberlength,$weeklength,$monthlength,
+ $add1,$every1,$whenmorethan1,$setto1,$lastvalue1,
+ $add2,$every2,$whenmorethan2,$setto2,$lastvalue2,
+ $add3,$every3,$whenmorethan3,$setto3,$lastvalue3,
+ $numberingmethod, $status, $callnumber, $notes,
$hemisphere)
+
+this function is similar to the NewSubscription subroutine but has a few
different
+values passed in
+$firstacquidate - date of first serial issue to arrive
+$irregularity - the issues not expected separated by a '|'
+- eg. monthly issue but not expecting issue for june and july would have
$irregularity of '6|7'
+$numberpattern - the number for an array of labels to reconstruct the
javascript correctly in the
+ subscription-add.tmpl file
+$callnumber - display the callnumber of the serial
+$hemisphere - either 2 = southern hemisphere or 1 = northern hemisphere - used
for quarterly serials
+
+return :
+the $subscriptionid number of the new subscription
+
+=back
+
+=cut
+
+sub old_newsubscription {
+ my (
+ $auser, $aqbooksellerid, $cost,
$aqbudgetid,
+ $biblionumber, $startdate, $periodicity,
$firstacquidate,
+ $dow, $irregularity, $numberpattern,
$numberlength,
+ $weeklength, $monthlength, $add1, $every1,
+ $whenmorethan1, $setto1, $lastvalue1, $add2,
+ $every2, $whenmorethan2, $setto2,
$lastvalue2,
+ $add3, $every3, $whenmorethan3, $setto3,
+ $lastvalue3, $numberingmethod, $status,
$callnumber,
+ $notes, $hemisphere
+ ) = @_;
+ my $dbh = C4::Context->dbh;
+
+ #save subscription
+ my $sth = $dbh->prepare(
+ "INSERT INTO subscription
(librarian,aqbooksellerid,cost,aqbudgetid,biblionumber,
+
startdate,periodicity,firstacquidate,dow,irregularity,numberpattern,numberlength,weeklength,monthlength,
+ add1,every1,whenmorethan1,setto1,lastvalue1,
+ add2,every2,whenmorethan2,setto2,lastvalue2,
+ add3,every3,whenmorethan3,setto3,lastvalue3,
+ numberingmethod, status, callnumber, notes, hemisphere)
values
+ (?,?,?,?,?,?,?,?,?,?,?,
+ ?,?,?,?,?,?,?,?,?,?,?,
+ ?,?,?,?,?,?,?,?,?,?,?,?)"
+ );
+ $sth->execute(
+ $auser, $aqbooksellerid,
+ $cost, $aqbudgetid,
+ $biblionumber, format_date_in_iso($startdate),
+ $periodicity, format_date_in_iso($firstacquidate),
+ $dow, $irregularity,
+ $numberpattern, $numberlength,
+ $weeklength, $monthlength,
+ $add1, $every1,
+ $whenmorethan1, $setto1,
+ $lastvalue1, $add2,
+ $every2, $whenmorethan2,
+ $setto2, $lastvalue2,
+ $add3, $every3,
+ $whenmorethan3, $setto3,
+ $lastvalue3, $numberingmethod,
+ $status, $callnumber,
+ $notes, $hemisphere
+ );
+
+ #then create the 1st waited number
+ my $subscriptionid = $dbh->{'mysql_insertid'};
+ my $enddate = GetSubscriptionExpirationDate($subscriptionid);
+
+ $sth =
+ $dbh->prepare(
+ "insert into subscriptionhistory (biblionumber, subscriptionid,
histstartdate, enddate, missinglist, recievedlist, opacnote, librariannote)
values (?,?,?,?,?,?,?,?)"
+ );
+ $sth->execute(
+ $biblionumber, $subscriptionid,
+ format_date_in_iso($startdate),
+ format_date_in_iso($enddate),
+ "", "", "", $notes
+ );
+
+ # reread subscription to get a hash (for calculation of the 1st issue
number)
+ $sth =
+ $dbh->prepare("select * from subscription where subscriptionid = ? ");
+ $sth->execute($subscriptionid);
+ my $val = $sth->fetchrow_hashref;
+
+ # calculate issue number
+ my $serialseq = Get_Seq($val);
+ $sth =
+ $dbh->prepare(
+ "insert into serial (serialseq,subscriptionid,biblionumber,status,
planneddate) values (?,?,?,?,?)"
+ );
+ $sth->execute( $serialseq, $subscriptionid, $val->{'biblionumber'},
+ 1, format_date_in_iso($startdate) );
+warn "sub ID: $subscriptionid";
+ return $subscriptionid;
+}
+
+=head2 old_modsubscription
+
+=over 4
+
+($subscriptionid) =
&old_modsubscription($auser,$aqbooksellerid,$cost,$aqbudgetid,$biblionumber,
+
$startdate,$periodicity,$firstacquidate,$dow,$irregularity,$numberpattern,$numberlength,$weeklength,$monthlength,
+ $add1,$every1,$whenmorethan1,$setto1,$lastvalue1,
+ $add2,$every2,$whenmorethan2,$setto2,$lastvalue2,
+ $add3,$every3,$whenmorethan3,$setto3,$lastvalue3,
+ $numberingmethod, $status, $callnumber, $notes,
$hemisphere, $subscriptionid)
+
+this function is similar to the ModSubscription subroutine but has a few
different
+values passed in
+$firstacquidate - date of first serial issue to arrive
+$irregularity - the issues not expected separated by a '|'
+- eg. monthly issue but not expecting issue for june and july would have
$irregularity of '6|7'
+$numberpattern - the number for an array of labels to reconstruct the
javascript correctly in the
+ subscription-add.tmpl file
+$callnumber - display the callnumber of the serial
+$hemisphere - either 2 = southern hemisphere or 1 = northern hemisphere - used
for quarterly serials
+
+=back
+
+=cut
+
+sub old_modsubscription {
+ my ( $auser, $aqbooksellerid, $cost,
$aqbudgetid,
+ $startdate, $periodicity, $firstacquidate, $dow,
+ $irregularity, $numberpattern, $numberlength,
$weeklength,
+ $monthlength, $add1, $every1,
$whenmorethan1,
+ $setto1, $lastvalue1, $innerloop1, $add2,
+ $every2, $whenmorethan2, $setto2,
$lastvalue2,
+ $innerloop2, $add3, $every3,
$whenmorethan3,
+ $setto3, $lastvalue3, $innerloop3,
$numberingmethod,
+ $status, $biblionumber, $callnumber, $notes,
+ $hemisphere, $subscriptionid
+ ) = @_;
+ my $dbh = C4::Context->dbh;
+ my $sth = $dbh->prepare("update subscription set librarian=?,
aqbooksellerid=?,cost=?,aqbudgetid=?,startdate=?,
+
periodicity=?,firstacquidate=?,dow=?,irregularity=?,numberpattern=?,numberlength=?,weeklength=?,monthlength=?,
+
add1=?,every1=?,whenmorethan1=?,setto1=?,lastvalue1=?,innerloop1=?,
+
add2=?,every2=?,whenmorethan2=?,setto2=?,lastvalue2=?,innerloop2=?,
+
add3=?,every3=?,whenmorethan3=?,setto3=?,lastvalue3=?,innerloop3=?,
+ numberingmethod=?, status=?, biblionumber=?,
callnumber=?, notes=?, hemisphere=? where subscriptionid = ?"
+ );
+ $sth->execute(
+ $auser, $aqbooksellerid, $cost, $aqbudgetid,
+ $startdate, $periodicity, $firstacquidate, $dow,
+ $irregularity, $numberpattern, $numberlength, $weeklength,
+ $monthlength, $add1, $every1, $whenmorethan1,
+ $setto1, $lastvalue1, $innerloop1, $add2,
+ $every2, $whenmorethan2, $setto2, $lastvalue2,
+ $innerloop2, $add3, $every3, $whenmorethan3,
+ $setto3, $lastvalue3, $innerloop3,
$numberingmethod,
+ $status, $biblionumber, $callnumber, $notes,
+ $hemisphere, $subscriptionid
+ );
+ $sth->finish;
+
+ $sth =
+ $dbh->prepare("select * from subscription where subscriptionid = ? ");
+ $sth->execute($subscriptionid);
+ my $val = $sth->fetchrow_hashref;
+
+ # calculate issue number
+ my $serialseq = Get_Seq($val);
+ $sth =
+ $dbh->prepare("UPDATE serial SET serialseq = ? WHERE subscriptionid =
?");
+ $sth->execute( $serialseq, $subscriptionid );
+
+ my $enddate = subscriptionexpirationdate($subscriptionid);
+ $sth = $dbh->prepare("update subscriptionhistory set enddate=?");
+ $sth->execute( format_date_in_iso($enddate) );
+}
+
+=head2 old_getserials
+
+=over 4
+
+($totalissues,@serials) = &old_getserials($subscriptionid)
+
+this function get a hashref of serials and the total count of them
+
+return :
+$totalissues - number of serial lines
+the serials into a table. Each line of this table containts a ref to a hash
which it containts
+serialid, serialseq, status,planneddate,notes,routingnotes from tables :
serial where status is not 2, 4, or 5
+
+=back
+
+=cut
+
+sub old_getserials {
+ my ($subscriptionid) = @_;
+ my $dbh = C4::Context->dbh;
+
+ # status = 2 is "arrived"
+ my $sth =
+ $dbh->prepare(
+ "select serialid,serialseq, status,
planneddate,notes,routingnotes from serial where subscriptionid = ? and status
<>2 and status <>4 and status <>5"
+ );
+ $sth->execute($subscriptionid);
+ my @serials;
+ my $num = 1;
+ while ( my $line = $sth->fetchrow_hashref ) {
+ $line->{ "status" . $line->{status} } =
+ 1; # fills a "statusX" value, used for template
status select list
+ $line->{"planneddate"} = format_date(
$line->{"planneddate"} );
+ $line->{"num"} = $num;
+ $num++;
+ push @serials, $line;
+ }
+ $sth = $dbh->prepare("select count(*) from serial where
subscriptionid=?");
+ $sth->execute($subscriptionid);
+ my ($totalissues) = $sth->fetchrow;
+ return ( $totalissues, @serials );
+ }
+
+=head2 GetNextDate
+
+=over 4
+
+($resultdate) = &GetNextDate($planneddate,$subscription)
+
+this function is an extension of GetNextDate which allows for checking for
irregularity
+
+it takes the planneddate and will return the next issue's date and will skip
dates if there
+exists an irregularity
+- eg if periodicity is monthly and $planneddate is 2007-02-10 but if March and
April is to be
+skipped then the returned date will be 2007-05-10
+
+return :
+$resultdate - then next date in the sequence
+
+=back
+
+=cut
+
+sub GetNextDate(@) {
+ my ( $planneddate, $subscription ) = @_;
+ my @irreg = split( /\|/, $subscription->{irregularity} );
+
+ my ( $year, $month, $day ) = UnixDate( $planneddate, "%Y", "%m", "%d"
);
+ my $dayofweek = Date_DayOfWeek( $month, $day, $year );
+ my $resultdate;
+
+ # warn "DOW $dayofweek";
+ if ( $subscription->{periodicity} == 1 ) {
+ for ( my $i = 0 ; $i < @irreg ; $i++ ) {
+ if ( $dayofweek == 7 ) { $dayofweek = 0; }
+ if ( in_array( ( $dayofweek + 1 ), @irreg )
) {
+ $planneddate =
DateCalc( $planneddate, "1 day" );
+ $dayofweek++;
+ }
+ }
+ $resultdate = DateCalc( $planneddate, "1 day" );
+ }
+ if ( $subscription->{periodicity} == 2 ) {
+ my $wkno = Date_WeekOfYear( $month, $day, $year, 1 );
+ for ( my $i = 0 ; $i < @irreg ; $i++ ) {
+ if ( $wkno > 52 ) { $wkno = 0; } # need
to rollover at January
+ if ( $irreg[$i] == ( $wkno + 1 ) ) {
+ $planneddate =
DateCalc( $planneddate, "1 week" );
+ $wkno++;
+ }
+ }
+ $resultdate = DateCalc( $planneddate, "1 week" );
+ }
+ if ( $subscription->{periodicity} == 3 ) {
+ my $wkno = Date_WeekOfYear( $month, $day, $year, 1 );
+ for ( my $i = 0 ; $i < @irreg ; $i++ ) {
+ if ( $wkno > 52 ) { $wkno = 0; } # need
to rollover at January
+ if ( $irreg[$i] == ( $wkno + 1 ) ) {
+ $planneddate =
DateCalc( $planneddate, "2 weeks" );
+ $wkno++;
+ }
+ }
+ $resultdate = DateCalc( $planneddate, "2 weeks" );
+ }
+ if ( $subscription->{periodicity} == 4 ) {
+ my $wkno = Date_WeekOfYear( $month, $day, $year, 1 );
+ for ( my $i = 0 ; $i < @irreg ; $i++ ) {
+ if ( $wkno > 52 ) { $wkno = 0; } # need
to rollover at January
+ if ( $irreg[$i] == ( $wkno + 1 ) ) {
+ $planneddate =
DateCalc( $planneddate, "3 weeks" );
+ $wkno++;
+ }
+ }
+ $resultdate = DateCalc( $planneddate, "3 weeks" );
+ }
+ if ( $subscription->{periodicity} == 5 ) {
+ for ( my $i = 0 ; $i < @irreg ; $i++ ) {
+
+ # warn $irreg[$i];
+ # warn $month;
+ if ( $month == 12 ) {
+ $month = 0;
+ } # need to rollover to
check January
+ if ( $irreg[$i] == ( $month + 1 ) )
+ { # check next one to see if is to be
skipped
+ $planneddate =
DateCalc( $planneddate, "1 month" );
+ $month++; # to
check if following ones are to be skipped too
+ }
+ }
+ $resultdate = DateCalc( $planneddate, "1 month" );
+
+ # warn "Planneddate2: $planneddate";
+ }
+ if ( $subscription->{periodicity} == 6 ) {
+ for ( my $i = 0 ; $i < @irreg ; $i++ ) {
+ if ( $month == 12 ) {
+ $month = 0;
+ } # need to rollover to
check January
+ if ( $irreg[$i] == ( $month + 1 ) )
+ { # check next one to see if is to be
skipped
+ $planneddate =
DateCalc( $planneddate, "2 months" );
+ $month++; # to
check if following ones are to be skipped too
+ }
+ }
+ $resultdate = DateCalc( $planneddate, "2 months" );
+ }
+ if ( $subscription->{periodicity} == 7 ) {
+ for ( my $i = 0 ; $i < @irreg ; $i++ ) {
+ if ( $month == 12 ) {
+ $month = 0;
+ } # need to rollover to
check January
+ if ( $irreg[$i] == ( $month + 1 ) )
+ { # check next one to see if is to be
skipped
+ $planneddate =
DateCalc( $planneddate, "3 months" );
+ $month++; # to
check if following ones are to be skipped too
+ }
+ }
+ $resultdate = DateCalc( $planneddate, "3 months" );
+ }
+ if ( $subscription->{periodicity} == 8 ) {
+ for ( my $i = 0 ; $i < @irreg ; $i++ ) {
+ if ( $month == 12 ) {
+ $month = 0;
+ } # need to rollover to
check January
+ if ( $irreg[$i] == ( $month + 1 ) )
+ { # check next one to see if is to be
skipped
+ $planneddate =
DateCalc( $planneddate, "3 months" );
+ $month++; # to
check if following ones are to be skipped too
+ }
+ }
+ $resultdate = DateCalc( $planneddate, "3 months" );
+ }
+ if ( $subscription->{periodicity} == 9 ) {
+ for ( my $i = 0 ; $i < @irreg ; $i++ ) {
+ if ( $month == 12 ) {
+ $month = 0;
+ } # need to rollover to
check January
+ if ( $irreg[$i] == ( $month + 1 ) )
+ { # check next one to see if is to be
skipped
+ $planneddate =
DateCalc( $planneddate, "6 months" );
+ $month++; # to
check if following ones are to be skipped too
+ }
+ }
+ $resultdate = DateCalc( $planneddate, "6 months" );
+ }
+ if ( $subscription->{periodicity} == 10 ) {
+ $resultdate = DateCalc( $planneddate, "1 year" );
+ }
+ if ( $subscription->{periodicity} == 11 ) {
+ $resultdate = DateCalc( $planneddate, "2 years" );
+ }
+
+ # warn "date: ".$resultdate;
+ return format_date_in_iso($resultdate);
+ }
+
+sub old_serialchangestatus {
+ my
($serialid,$serialseq,$planneddate,$status,$notes)address@hidden;
+ # warn "($serialid,$serialseq,$planneddate,$status)";
+ # 1st, get previous status : if we change from "waited" to
something else, then we will have to create a new "waited" entry
+ my $dbh = C4::Context->dbh;
+ my $sth = $dbh->prepare("select subscriptionid,status from serial
where serialid=?");
+ $sth->execute($serialid);
+ my ($subscriptionid,$oldstatus) = $sth->fetchrow;
+ # change status & update subscriptionhistory
+ if ($status eq 6){
+ delissue($serialseq, $subscriptionid)
+ }else{
+ $sth = $dbh->prepare("update
serial set serialseq=?,planneddate=?,status=?,notes=? where serialid = ?");
+
$sth->execute($serialseq,$planneddate,$status,$notes,$serialid);
+ $sth = $dbh->prepare("select
missinglist,recievedlist from subscriptionhistory where subscriptionid=?");
+ $sth->execute($subscriptionid);
+ my ($missinglist,$recievedlist) =
$sth->fetchrow;
+ if ($status eq 2) {
+
$recievedlist .= "| $serialseq";
+
$recievedlist =~ s/^\| //g;
+ }
+ $missinglist .= "| $serialseq" if
($status eq 4) ;
+ $missinglist .= "| not issued
$serialseq" if ($status eq 5);
+ $missinglist =~ s/^\| //g;
+ $sth=$dbh->prepare("update
subscriptionhistory set recievedlist=?, missinglist=? where subscriptionid=?");
+
$sth->execute($recievedlist,$missinglist,$subscriptionid);
+ }
+ # create new waited entry if needed (ie : was a "waited" and has
changed)
+ if ($oldstatus eq 1 && $status ne 1) {
+ $sth = $dbh->prepare("select * from
subscription where subscriptionid = ? ");
+ $sth->execute($subscriptionid);
+ my $val = $sth->fetchrow_hashref;
+ # next date (calculated from actual date &
frequency parameters)
+ my $nextplanneddate =
Get_Next_Date($planneddate,$val);
+ # next issue number
+ # my
($newserialseq,$newlastvalue1,$newlastvalue2,$newlastvalue3,$newinnerloop1,$newinnerloop2,$newinnerloop3)
= Get_Next_Seq($val);
+ my
($newserialseq,$newlastvalue1,$newlastvalue2,$newlastvalue3) =
New_Get_Next_Seq($val,$nextplanneddate);
+ newissue($newserialseq, $subscriptionid,
$val->{'biblionumber'}, 1, $nextplanneddate);
+ # $sth = $dbh->prepare("update subscription set
lastvalue1=?, lastvalue2=?,lastvalue3=?,
+ #
innerloop1=?,innerloop2=?,innerloop3=?
+ # where subscriptionid = ?");
+ #
$sth->execute($newlastvalue1,$newlastvalue2,$newlastvalue3,$newinnerloop1,$newinnerloop2,$newinnerloop3,$subscriptionid);
+ $sth = $dbh->prepare("update subscription set
lastvalue1=?, lastvalue2=?,lastvalue3=?
+ where subscriptionid = ?");
+
$sth->execute($newlastvalue1,$newlastvalue2,$newlastvalue3,$subscriptionid);
+ }
+}
+
+=head2 GetSubscriptionExpirationDate
+
+=over 4
+
+$sensddate = GetSubscriptionExpirationDate($subscriptionid)
+
+this function return the expiration date for a subscription given on input
args.
+
+return
+the enddate
+
+=back
+
+=cut
+
+sub GetSubscriptionExpirationDate {
+ my ($subscriptionid) = @_;
+ my $dbh = C4::Context->dbh;
+ my $subscription = getsubscription($subscriptionid);
+ my $enddate = $subscription->{startdate};
+
+ # we don't do the same test if the subscription is based on X numbers or
on X weeks/months
+ if ( $subscription->{numberlength} ) {
+
+ #calculate the date of the last issue.
+ for ( my $i = 1 ; $i <= $subscription->{numberlength} ;
$i++ ) {
+ $enddate = GetNextDate( $enddate,
$subscription );
+ }
+ }
+ else {
+ $enddate = DateCalc(
+ format_date_in_iso(
$subscription->{startdate} ),
+ $subscription->{monthlength} . " months"
+ ) if ( $subscription->{monthlength} );
+ $enddate = DateCalc(
+ format_date_in_iso(
$subscription->{startdate} ),
+ $subscription->{weeklength} . " weeks"
+ ) if ( $subscription->{weeklength} );
+ }
+ return $enddate;
+ }
+
END { } # module clean-up code here (global destructor)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Koha-cvs] koha bull-home.pl bull/lateissues.pl bull/state... [rel_2_2],
Robert Lyon <=