From 716d4a4e18162af89b23d36d0a1a28a67013c371 Mon Sep 17 00:00:00 2001 From: tipaul Date: Thu, 12 Aug 2004 14:36:07 +0000 Subject: [PATCH] serials : lot of bugfixes. Works fine now. And is documented (clic Help) --- C4/Acquisition.pm | 33 +-- C4/Bull.pm | 169 +++++++++++--- bull/order.pl | 23 +- bull/serial-issues.pl | 58 +++++ bull/statecollection.pl | 25 +- bull/subscription-add.pl | 16 +- bull/subscription-bib-search.pl | 82 +------ bull/subscription-detail.pl | 119 ++++------ bull/subscription-detail.pl.new | 177 ++++++++++++++ bull/subscription-renew.pl | 69 ++++++ .../intranet-tmpl/default/en/bull/order.tmpl | 74 +++--- .../default/en/bull/serial-issues.tmpl | 87 +++++++ .../default/en/bull/statecollection.tmpl | 19 +- .../default/en/bull/subscription-add.tmpl | 217 +++--------------- .../default/en/bull/subscription-detail.tmpl | 49 +++- .../default/en/bull/subscription-renew.tmpl | 22 ++ .../default/en/includes/bull-top.inc | 3 +- .../opac-tmpl/css/en/opac-serial-issues.tmpl | 85 +++++++ 18 files changed, 863 insertions(+), 464 deletions(-) create mode 100755 bull/serial-issues.pl create mode 100755 bull/subscription-detail.pl.new create mode 100755 bull/subscription-renew.pl create mode 100644 koha-tmpl/intranet-tmpl/default/en/bull/serial-issues.tmpl create mode 100644 koha-tmpl/intranet-tmpl/default/en/bull/subscription-renew.tmpl create mode 100644 koha-tmpl/opac-tmpl/css/en/opac-serial-issues.tmpl diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm index 950411a3e4..9170707b34 100644 --- a/C4/Acquisition.pm +++ b/C4/Acquisition.pm @@ -221,10 +221,6 @@ Cancel the order with the given order and biblio numbers. It does not delete any entries in the aqorders table, it merely marks them as cancelled. -If there are no items remaining with the given biblionumber, -C<&delorder> also deletes them from the marc_subfield_table and -marc_biblio tables of the Koha database. - =cut #' sub delorder { @@ -234,10 +230,6 @@ sub delorder { where biblionumber=? and ordernumber=?"); $sth->execute($bibnum,$ordnum); $sth->finish; - my $count=itemcount($bibnum); - if ($count == 0){ - delbiblio($bibnum); - } } =item modorder @@ -317,17 +309,13 @@ Also updates the book fund ID in the aqorderbreakdown table. =cut #' sub receiveorder { - my ($biblio,$ordnum,$quantrec,$user,$cost,$invoiceno,$bibitemno,$freight,$bookfund,$rrp)=@_; - my $dbh = C4::Context->dbh; - my $sth=$dbh->prepare("update aqorders set quantityreceived=?,datereceived=now(),booksellerinvoicenumber=?, - biblioitemnumber=?,unitprice=?,freight=?,rrp=? - where biblionumber=? and ordernumber=?"); - $sth->execute($quantrec,$invoiceno,$bibitemno,$cost,$freight,$rrp,$biblio,$ordnum); - $sth->finish; - $sth=$dbh->prepare("update aqorderbreakdown set bookfundid=? where - ordernumber=?"); - $sth->execute($bookfund,$ordnum); - $sth->finish; + my ($biblio,$ordnum,$quantrec,$user,$cost,$invoiceno,$freight,$rrp)=@_; + my $dbh = C4::Context->dbh; + my $sth=$dbh->prepare("update aqorders set quantityreceived=?,datereceived=now(),booksellerinvoicenumber=?, + unitprice=?,freight=?,rrp=? + where biblionumber=? and ordernumber=?"); + $sth->execute($quantrec,$invoiceno,$cost,$freight,$rrp,$biblio,$ordnum); + $sth->finish; } =item updaterecorder @@ -566,9 +554,10 @@ sub ordersearch { my @searchterms = ($id); map { push(@searchterms,"$_%","% $_%") } @data; push(@searchterms,$search,$search,$biblio); - my $sth=$dbh->prepare("Select *,biblio.title from aqorders,biblioitems,biblio - where aqorders.biblioitemnumber = biblioitems.biblioitemnumber - and aqorders.booksellerid = ? + my $sth=$dbh->prepare("Select *,biblio.title from aqorders,biblioitems,biblio,aqbasket + where aqorders.biblioitemnumber = biblioitems.biblioitemnumber and + aqorders.basketno = aqbasket.basketno + and aqbasket.booksellerid = ? and biblio.biblionumber=aqorders.biblionumber and ((datecancellationprinted is NULL) or (datecancellationprinted = '0000-00-00')) diff --git a/C4/Bull.pm b/C4/Bull.pm index dbfeb6bc04..b49f1670dc 100755 --- a/C4/Bull.pm +++ b/C4/Bull.pm @@ -20,6 +20,8 @@ package C4::Bull; #assumes C4/Bull.pm use strict; use C4::Date; +use Date::Manip; +use C4::Suggestions; require Exporter; use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); @@ -42,10 +44,11 @@ Give all XYZ functions =cut @ISA = qw(Exporter); -@EXPORT = qw(&newsubscription &modsubscription &getsubscriptions &getsubscription - &modsubscriptionhistory +@EXPORT = qw(&newsubscription &modsubscription &getsubscriptions &getsubscription &getsubscriptionfrombiblionumber + &modsubscriptionhistory &getserials &serialchangestatus - &Find_Next_Date, &Get_Next_Seq); + &Find_Next_Date, &Get_Next_Seq + &hassubscriptionexpired &subscriptionexpirationdate &subscriptionrenew); sub newsubscription { my ($auser,$aqbooksellerid,$cost,$aqbudgetid,$biblionumber, @@ -53,7 +56,7 @@ sub newsubscription { $add1,$every1,$whenmorethan1,$setto1,$lastvalue1, $add2,$every2,$whenmorethan2,$setto2,$lastvalue2, $add3,$every3,$whenmorethan3,$setto3,$lastvalue3, - $numberingmethod, $arrivalplanified, $status, $notes) = @_; + $numberingmethod, $status, $notes) = @_; my $dbh = C4::Context->dbh; #save subscription my $sth=$dbh->prepare("insert into subscription (librarian,aqbooksellerid,cost,aqbudgetid,biblionumber, @@ -61,8 +64,8 @@ sub newsubscription { add1,every1,whenmorethan1,setto1,lastvalue1, add2,every2,whenmorethan2,setto2,lastvalue2, add3,every3,whenmorethan3,setto3,lastvalue3, - numberingmethod, arrivalplanified, status, notes) values - (?,?,?,?,?,?,?,?,?,?, + numberingmethod, status, notes) values + (?,?,?,?,?,?,?,?,?, ?,?,?,?,?,?,?,?,?,?, ?,?,?,?,?,?,?,?,?,?)"); $sth->execute($auser,$aqbooksellerid,$cost,$aqbudgetid,$biblionumber, @@ -70,55 +73,72 @@ sub newsubscription { $add1,$every1,$whenmorethan1,$setto1,$lastvalue1, $add2,$every2,$whenmorethan2,$setto2,$lastvalue2, $add3,$every3,$whenmorethan3,$setto3,$lastvalue3, - $numberingmethod, format_date_in_iso($arrivalplanified), $status, $notes); + $numberingmethod, $status, $notes); #then create the 1st waited number my $subscriptionid = $dbh->{'mysql_insertid'}; - $sth = $dbh->prepare("insert into subscriptionhistory (biblionumber, subscriptionid, startdate, enddate, missinglist, recievedlist, opacnote, librariannote) values (?,?,?,?,?,?,?,?)"); - $sth->execute($biblionumber, $subscriptionid, $startdate, 0, "", "", 0, $notes); + $sth = $dbh->prepare("insert into subscriptionhistory (biblionumber, subscriptionid, histstartdate, enddate, missinglist, recievedlist, opacnote, librariannote) values (?,?,?,?,?,?,?,?)"); + $sth->execute($biblionumber, $subscriptionid, format_date_in_iso($startdate), 0, "", "", 0, $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; - $sth = $dbh->prepare("insert into serial (biblionumber, subscriptionid, serialseq, status, planneddate) values (?,?,?,?,?)"); - $sth->execute($biblionumber, $subscriptionid, - &Get_Next_Seq($val), - $status, Find_Next_Date()); + # next issue number + my ($newserialseq,$newlastvalue1,$newlastvalue2,$newlastvalue3,$newinnerloop1,$newinnerloop2,$newinnerloop3) = Get_Next_Seq($val); + # next date (calculated from actual date & frequency parameters) + my $nextplanneddate = Get_Next_Date($startdate,$val); + $sth = $dbh->prepare("insert into serial (serialseq,subscriptionid,biblionumber,status, planneddate) values (?,?,?,?,?)"); + $sth->execute($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->finish; + return $subscriptionid; } sub getsubscription { my ($subscriptionid) = @_; my $dbh = C4::Context->dbh; - my $sth = $dbh->prepare('select subscription.*,aqbudget.bookfundid,aqbooksellers.name as aqbooksellername,biblio.title as bibliotitle + my $sth = $dbh->prepare('select subscription.*,subscriptionhistory.*,aqbudget.bookfundid,aqbooksellers.name as aqbooksellername,biblio.title as bibliotitle from subscription + left join subscriptionhistory on subscription.subscriptionid=subscriptionhistory.subscriptionid left join aqbudget on subscription.aqbudgetid=aqbudget.aqbudgetid left join aqbooksellers on subscription.aqbooksellerid=aqbooksellers.id left join biblio on biblio.biblionumber=subscription.biblionumber - where subscriptionid = ?'); + where subscription.subscriptionid = ?'); $sth->execute($subscriptionid); my $subs = $sth->fetchrow_hashref; return $subs; } +sub getsubscriptionfrombiblionumber { + my ($biblionumber) = @_; + my $dbh = C4::Context->dbh; + my $sth = $dbh->prepare('select subscriptionid from subscription where biblionumber=?'); + $sth->execute($biblionumber); + my $subscriptionid = $sth->fetchrow; + return $subscriptionid; +} + sub modsubscription { my ($auser,$aqbooksellerid,$cost,$aqbudgetid,$startdate, $periodicity,$dow,$numberlength,$weeklength,$monthlength, $add1,$every1,$whenmorethan1,$setto1,$lastvalue1, $add2,$every2,$whenmorethan2,$setto2,$lastvalue2, $add3,$every3,$whenmorethan3,$setto3,$lastvalue3, - $numberingmethod, $arrivalplanified, $status, $biblionumber, $notes, $subscriptionid)= @_; + $numberingmethod, $status, $biblionumber, $notes, $subscriptionid)= @_; my $dbh = C4::Context->dbh; my $sth=$dbh->prepare("update subscription set librarian=?, aqbooksellerid=?,cost=?,aqbudgetid=?,startdate=?, periodicity=?,dow=?,numberlength=?,weeklength=?,monthlength=?, add1=?,every1=?,whenmorethan1=?,setto1=?,lastvalue1=?, add2=?,every2=?,whenmorethan2=?,setto2=?,lastvalue2=?, add3=?,every3=?,whenmorethan3=?,setto3=?,lastvalue3=?, - numberingmethod=?, arrivalplanified=?, status=?, biblionumber=?, notes=? where subscriptionid = ?"); + numberingmethod=?, status=?, biblionumber=?, notes=? where subscriptionid = ?"); $sth->execute($auser,$aqbooksellerid,$cost,$aqbudgetid,$startdate, $periodicity,$dow,$numberlength,$weeklength,$monthlength, $add1,$every1,$whenmorethan1,$setto1,$lastvalue1, $add2,$every2,$whenmorethan2,$setto2,$lastvalue2, $add3,$every3,$whenmorethan3,$setto3,$lastvalue3, - $numberingmethod, $arrivalplanified, $status, $biblionumber, $notes, $subscriptionid); + $numberingmethod, $status, $biblionumber, $notes, $subscriptionid); $sth->finish; } @@ -137,10 +157,10 @@ sub getsubscriptions { } sub modsubscriptionhistory { - my ($subscriptionid,$startdate,$enddate,$recievedlist,$missinglist,$opacnote,$librariannote)=@_; + my ($subscriptionid,$histstartdate,$enddate,$recievedlist,$missinglist,$opacnote,$librariannote)=@_; my $dbh=C4::Context->dbh; - my $sth = $dbh->prepare("update subscriptionhistory set startdate=?,enddate=?,recievedlist=?,missinglist=?,opacnote=?,librariannote=? where subscriptionid=?"); - $sth->execute($startdate,$enddate,$recievedlist,$missinglist,$opacnote,$librariannote,$subscriptionid); + my $sth = $dbh->prepare("update subscriptionhistory set histstartdate=?,enddate=?,recievedlist=?,missinglist=?,opacnote=?,librariannote=? where subscriptionid=?"); + $sth->execute($histstartdate,$enddate,$recievedlist,$missinglist,$opacnote,$librariannote,$subscriptionid); } # get every serial not arrived for a given subscription. sub getserials { @@ -152,6 +172,7 @@ sub getserials { my @serials; 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"}); push @serials,$line; } return @serials; @@ -184,9 +205,12 @@ sub serialchangestatus { $sth = $dbh->prepare("select * from subscription where subscriptionid = ? "); $sth->execute($subscriptionid); my $val = $sth->fetchrow_hashref; + # next issue number my ($newserialseq,$newlastvalue1,$newlastvalue2,$newlastvalue3,$newinnerloop1,$newinnerloop2,$newinnerloop3) = Get_Next_Seq($val); + # next date (calculated from actual date & frequency parameters) + my $nextplanneddate = Get_Next_Date($planneddate,$val); $sth = $dbh->prepare("insert into serial (serialseq,subscriptionid,biblionumber,status, planneddate) values (?,?,?,?,?)"); - $sth->execute($newserialseq, $subscriptionid, $val->{'biblionumber'}, 1, 0); + $sth->execute($newserialseq, $subscriptionid, $val->{'biblionumber'}, 1, $nextplanneddate); $sth = $dbh->prepare("update subscription set lastvalue1=?, lastvalue2=?,lastvalue3=?, innerloop1=?,innerloop2=?,innerloop3=? where subscriptionid = ?"); @@ -194,14 +218,47 @@ sub serialchangestatus { } } -sub Find_Next_Date(@) { - return "2004-29-03"; +sub Get_Next_Date(@) { + my ($planneddate,$subscription) = @_; + my $resultdate; + if ($subscription->{periodicity} == 1) { + $resultdate=DateCalc($planneddate,"1 day"); + } + if ($subscription->{periodicity} == 2) { + $resultdate=DateCalc($planneddate,"1 week"); + } + if ($subscription->{periodicity} == 3) { + $resultdate=DateCalc($planneddate,"2 weeks"); + } + if ($subscription->{periodicity} == 4) { + $resultdate=DateCalc($planneddate,"3 weeks"); + } + if ($subscription->{periodicity} == 5) { + $resultdate=DateCalc($planneddate,"1 month"); + } + if ($subscription->{periodicity} == 6) { + $resultdate=DateCalc($planneddate,"2 months"); + } + if ($subscription->{periodicity} == 7) { + $resultdate=DateCalc($planneddate,"3 months"); + } + if ($subscription->{periodicity} == 8) { + $resultdate=DateCalc($planneddate,"1 quarter"); + } + if ($subscription->{periodicity} == 9) { + $resultdate=DateCalc($planneddate,"2 weeks"); + } + if ($subscription->{periodicity} == 10) { + $resultdate=DateCalc($planneddate,"1 year"); + } + if ($subscription->{periodicity} == 11) { + $resultdate=DateCalc($planneddate,"2 years"); + } + return format_date_in_iso($resultdate); } sub Get_Next_Seq { my ($val) =@_; -# return ("$sequence", $seqnum1, $seqnum2, $seqnum3) -# if (!defined($seqnum1) && !defined($seqnum2) && !defined($seqnum3)); my ($calculated,$newlastvalue1,$newlastvalue2,$newlastvalue3,$newinnerloop1,$newinnerloop2,$newinnerloop3); $calculated = $val->{numberingmethod}; # calculate the (expected) value of the next issue recieved. @@ -231,4 +288,64 @@ sub Get_Next_Seq { return ($calculated,$newlastvalue1,$newlastvalue2,$newlastvalue3,$newinnerloop1,$newinnerloop2,$newinnerloop3); } +# the subscription has expired when the next issue to arrive is out of subscription limit. +sub hassubscriptionexpired { + 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->{planneddate}); + my $res = $sth->fetchrow; + if ($subscription->{numberlength}>=$res) { + return 0; + } else { + return 1; + } + } 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}); + return 1 if ($res >= $endofsubscriptiondate); + return 0; + } +} + +sub subscriptionexpirationdate { + 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 = Get_Next_Date($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}); + } +# $enddate=format_date_in_iso($enddate); +# warn "END : $enddate"; + return $enddate; +} + +sub subscriptionrenew { + my ($subscriptionid,$user,$startdate,$numberlength,$weeklength,$monthlength,$note) = @_; + my $dbh = C4::Context->dbh; + my $subscription = getsubscription($subscriptionid); + my $sth = $dbh->prepare("select * from biblio,biblioitems where biblio.biblionumber=biblioitems.biblionumber and biblio.biblionumber=?"); + $sth->execute($subscription->{biblionumber}); + my $biblio = $sth->fetchrow_hashref; + newsuggestion($user,$subscription->{bibliotitle},$biblio->{author},$biblio->{publishercode},$biblio->{note},,,,,$subscription->{biblionumber}); + # renew subscription + $sth=$dbh->prepare("update subscription set startdate=?,numberlength=?,weeklength=?,monthlength=?"); + $sth->execute(format_date_in_iso($startdate),$numberlength,$weeklength,$monthlength); +} END { } # module clean-up code here (global destructor) diff --git a/bull/order.pl b/bull/order.pl index 85b3332697..050da81ba9 100755 --- a/bull/order.pl +++ b/bull/order.pl @@ -24,7 +24,6 @@ # Suite 330, Boston, MA 02111-1307 USA use strict; -use C4::Acquisition; use C4::Auth; use C4::Biblio; use C4::Output; @@ -32,6 +31,7 @@ use CGI; use C4::Interface::CGI::Output; use C4::Database; use HTML::Template; +use C4::Acquisition; use C4::Date; my $query=new CGI; @@ -47,32 +47,37 @@ my ($template, $loggedinuser, $cookie) my $supplier=$query->param('supplier'); my ($count,@suppliers)=bookseller($supplier); -my $colour='#EEEEEE'; +# check if we have to "close" a basket before building page +my $op = $query->param('op'); +my $basket = $query->param('basket'); +if ($op eq 'close') { + closebasket($basket); +} + +#build reult page my $toggle=0; my @loop_suppliers; for (my $i=0; $i<$count; $i++) { my ($ordcount,$orders)=getorders($suppliers[$i]->{'id'}); my %line; if ($toggle==0){ - $line{color}='#EEEEEE'; + $line{even}=1; $toggle=1; } else { - $line{color}='white'; + $line{even}=0; $toggle=0; } - $line{id} =$suppliers[$i]->{'id'}; + $line{supplierid} =$suppliers[$i]->{'id'}; $line{name} = $suppliers[$i]->{'name'}; $line{active} = $suppliers[$i]->{'active'}; - $line{total} = $orders->[0]->{'count(*)'}; - $line{authorisedby} = $orders->[0]->{'authorisedby'}; - $line{entrydate} = $orders->[0]->{'entrydate'}; my @loop_basket; for (my $i2=0;$i2<$ordcount;$i2++){ my %inner_line; $inner_line{basketno} =$orders->[$i2]->{'basketno'}; $inner_line{total} =$orders->[$i2]->{'count(*)'}; $inner_line{authorisedby} = $orders->[$i2]->{'authorisedby'}; - $inner_line{entrydate} = format_date($orders->[$i2]->{'entrydate'}); + $inner_line{creationdate} = format_date($orders->[$i2]->{'creationdate'}); + $inner_line{closedate} = format_date($orders->[$i2]->{'closedate'}); push @loop_basket, \%inner_line; } $line{loop_basket} = \@loop_basket; diff --git a/bull/serial-issues.pl b/bull/serial-issues.pl new file mode 100755 index 0000000000..75ebf97f16 --- /dev/null +++ b/bull/serial-issues.pl @@ -0,0 +1,58 @@ +#!/usr/bin/perl + +use strict; +use CGI; +use C4::Auth; +use C4::Koha; +use C4::Date; +use C4::Bull; +use C4::Output; +use C4::Interface::CGI::Output; +use C4::Context; +use HTML::Template; + +my $query = new CGI; +my $op = $query->param('op'); +my $dbh = C4::Context->dbh; +my $sth; +# my $id; +my ($template, $loggedinuser, $cookie); +my ($subscriptionid); + +$subscriptionid = $query->param('subscriptionid'); +my $subscription = &getsubscription($subscriptionid); + +($template, $loggedinuser, $cookie) += get_template_and_user({template_name => "bull/serial-issues.tmpl", + query => $query, + type => "intranet", + authnotrequired => 0, + flagsrequired => {catalogue => 1}, + debug => 1, + }); + +# replace CR by
in librarian note +$subscription->{librariannote} =~ s/\n/\/g; + +$template->param( + startdate => format_date($subscription->{startdate}), + periodicity => $subscription->{periodicity}, + dow => $subscription->{dow}, + numberlength => $subscription->{numberlength}, + weeklength => $subscription->{weeklength}, + monthlength => $subscription->{monthlength}, + librariannote => $subscription->{librariannote}, + numberingmethod => $subscription->{numberingmethod}, + arrivalplanified => $subscription->{arrivalplanified}, + status => $subscription->{status}, + biblionumber => $subscription->{biblionumber}, + bibliotitle => $subscription->{bibliotitle}, + notes => $subscription->{notes}, + subscriptionid => $subscription->{subscriptionid} + ); +$template->param( + "periodicity$subscription->{periodicity}" => 1, + "arrival$subscription->{dow}" => 1, + ); + +output_html_with_http_headers $query, $cookie, $template->output; diff --git a/bull/statecollection.pl b/bull/statecollection.pl index 6eee904b01..82dbb9deb0 100755 --- a/bull/statecollection.pl +++ b/bull/statecollection.pl @@ -3,6 +3,7 @@ use strict; use CGI; use C4::Auth; +use C4::Date; use C4::Output; use C4::Interface::CGI::Output; use C4::Context; @@ -13,10 +14,9 @@ my $query = new CGI; my $op = $query->param('op'); my $dbh = C4::Context->dbh; my $subscriptionid = $query->param('subscriptionid'); -# warn "$ser la valeur du nom du formulaire"; my $auser = $query->param('user'); -my $startdate = $query->param('startdate'); -my $enddate = $query->param('enddate'); +my $histstartdate = format_date_in_iso($query->param('histstartdate')); +my $enddate = format_date_in_iso($query->param('enddate')); my $recievedlist = $query->param('recievedlist'); my $missinglist = $query->param('missinglist'); my $opacnote = $query->param('opacnote'); @@ -25,14 +25,20 @@ my @serialids = $query->param('serialid'); my @serialseqs = $query->param('serialseq'); my @planneddates = $query->param('planneddate'); my @status = $query->param('status'); +my $hassubscriptionexpired = hassubscriptionexpired($subscriptionid); if ($op eq 'modsubscriptionhistory') { - modsubscriptionhistory($subscriptionid,$startdate,$enddate,$recievedlist,$missinglist,$opacnote,$librariannote); + 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 subscriptionid,status from serial where serialid=?"); for (my $i=0;$i<=$#serialids;$i++) { - serialchangestatus($serialids[$i],$serialseqs[$i],$planneddates[$i],$status[$i]); + $sth->execute($serialids[$i]); + my ($x,$oldstatus) = $sth->fetchrow; + serialchangestatus($serialids[$i],$serialseqs[$i],format_date_in_iso($planneddates[$i]),$status[$i]) unless ($hassubscriptionexpired && $oldstatus == 1); } } +my $subs = &getsubscription($subscriptionid); my @serialslist = getserials($subscriptionid); my $sth=$dbh->prepare("select * from subscriptionhistory where subscriptionid = ?"); @@ -48,16 +54,15 @@ my ($template, $loggedinuser, $cookie) }); $template->param( -# user => $user, serialslist => \@serialslist, -# status => $sol->{'status'}, -# waited => $sol->{'serialseq'}, - startdate => $solhistory->{'startdate'}, - enddate => $solhistory->{'enddate'}, + histstartdate => format_date($solhistory->{'histstartdate'}), + enddate => format_date($solhistory->{'enddate'}), recievedlist => $solhistory->{'recievedlist'}, missinglist => $solhistory->{'missinglist'}, opacnote => $solhistory->{'opacnote'}, librariannote => $solhistory->{'librariannote'}, subscriptionid => $subscriptionid, + bibliotitle => $subs->{bibliotitle}, + hassubscriptionexpired =>$hassubscriptionexpired, ); output_html_with_http_headers $query, $cookie, $template->output; diff --git a/bull/subscription-add.pl b/bull/subscription-add.pl index f5e90e4fe9..c585bb027c 100755 --- a/bull/subscription-add.pl +++ b/bull/subscription-add.pl @@ -1,5 +1,6 @@ #!/usr/bin/perl + use strict; use CGI; use C4::Koha; @@ -21,7 +22,7 @@ my ($subscriptionid,$auser,$librarian,$cost,$aqbooksellerid, $aqbooksellername,$ $add1,$every1,$whenmorethan1,$setto1,$lastvalue1, $add2,$every2,$whenmorethan2,$setto2,$lastvalue2, $add3,$every3,$whenmorethan3,$setto3,$lastvalue3, - $numberingmethod, $arrivalplanified, $status, $biblionumber, + $numberingmethod, $status, $biblionumber, $bibliotitle, $notes); my @budgets; @@ -67,7 +68,6 @@ if ($op eq 'mod') { $setto3 = $subs->{'setto3'}; $lastvalue3 = $subs->{'lastvalue3'}; $numberingmethod = $subs->{'numberingmethod'}; - $arrivalplanified = $subs->{'arrivalplanified'}; $status = $subs->{status}; $biblionumber = $subs->{'biblionumber'}; $bibliotitle = $subs->{'bibliotitle'}, @@ -103,7 +103,6 @@ if ($op eq 'mod') { setto3 => $setto3, lastvalue3 => $lastvalue3, numberingmethod => $numberingmethod, - arrivalplanified => format_date($arrivalplanified), status => $status, biblionumber => $biblionumber, bibliotitle => $bibliotitle, @@ -151,18 +150,17 @@ if ($op eq 'addsubscription') { my $setto3 = $query->param('setto3'); my $lastvalue3 = $query->param('lastvalue3'); my $numberingmethod = $query->param('numberingmethod'); - my $arrivalplanified = $query->param('arrivalplanified'); my $status = 1; my $biblionumber = $query->param('biblionumber'); my $notes = $query->param('notes'); - newsubscription($auser,$aqbooksellerid,$cost,$aqbudgetid,$biblionumber, + my $subscriptionid = newsubscription($auser,$aqbooksellerid,$cost,$aqbudgetid,$biblionumber, $startdate,$periodicity,$dow,$numberlength,$weeklength,$monthlength, $add1,$every1,$whenmorethan1,$setto1,$lastvalue1, $add2,$every2,$whenmorethan2,$setto2,$lastvalue2, $add3,$every3,$whenmorethan3,$setto3,$lastvalue3, - $numberingmethod, $arrivalplanified, $status, $notes + $numberingmethod, $status, $notes ); - + print $query->redirect("/cgi-bin/koha/bull/subscription-detail.pl?subscriptionid=$subscriptionid"); +} else { + output_html_with_http_headers $query, $cookie, $template->output; } - -output_html_with_http_headers $query, $cookie, $template->output; diff --git a/bull/subscription-bib-search.pl b/bull/subscription-bib-search.pl index db8279a275..ca62bd5e09 100755 --- a/bull/subscription-bib-search.pl +++ b/bull/subscription-bib-search.pl @@ -127,11 +127,6 @@ if ($op eq "do_search") { push @tags, ""; } } - findseealso($dbh,\@tags); - -# my $sth2 = $dbh->prepare("select b3.serial from biblioitems b2, biblio b3 where b3.biblionumber = ? and b2.biblionumber = b3.biblionumber and (b2.issn = ? or b3.serial like ?)"); - - my ($results,$total) = catalogsearch($dbh, \@tags,\@and_or, \@excluding, \@operator, \@value, $startfrom*$resultsperpage, $resultsperpage,$orderby); @@ -205,82 +200,7 @@ if ($op eq "do_search") { to=>$to, numbers=>\@numbers, ); - -} elsif ($op eq "AddStatement") { - - ($template, $loggedinuser, $cookie) - = get_template_and_user({template_name => "bull/search.tmpl", - query => $query, - type => "intranet", - authnotrequired => 0, - flagsrequired => {catalogue => 1}, - debug => 1, - }); - - # Gets the entered information - my @marcfields = $query->param('marclist'); - my @and_or = $query->param('and_or'); - my @excluding = $query->param('excluding'); - my @operator = $query->param('operator'); - my @value = $query->param('value'); - - my @statements = (); - - # List of the marc tags to display - my $marcarray = create_marclist(); - - my $nbstatements = $query->param('nbstatements'); - $nbstatements = 1 if(!defined $nbstatements); - - for(my $i = 0 ; $i < $nbstatements ; $i++) - { - my %fields = (); - - # Recreates the old scrolling lists with the previously selected values - my $marclist = create_scrolling_list({name=>"marclist", - values=> $marcarray, - size=> 1, - default=>$marcfields[$i], - onChange => "sql_update()"} - ); - - $fields{'marclist'} = $marclist; - $fields{'first'} = 1 if($i == 0); - - # Restores the and/or parameters (no need to test the 'and' for activation because it's the default value) - $fields{'or'} = 1 if($and_or[$i] eq "or"); - - #Restores the "not" parameters - $fields{'not'} = 1 if($excluding[$i]); - - #Restores the operators (most common operators first); - if($operator[$i] eq "=") { $fields{'eq'} = 1; } - elsif($operator[$i] eq "contains") { $fields{'contains'} = 1; } - elsif($operator[$i] eq "start") { $fields{'start'} = 1; } - elsif($operator[$i] eq ">") { $fields{'gt'} = 1; } #greater than - elsif($operator[$i] eq ">=") { $fields{'ge'} = 1; } #greater or equal - elsif($operator[$i] eq "<") { $fields{'lt'} = 1; } #lower than - elsif($operator[$i] eq "<=") { $fields{'le'} = 1; } #lower or equal - - #Restores the value - $fields{'value'} = $value[$i]; - - push @statements, \%fields; - } - $nbstatements++; - - # The new scrolling list - my $marclist = create_scrolling_list({name=>"marclist", - values=> $marcarray, - size=>1, - onChange => "sql_update()"}); - push @statements, {"marclist" => $marclist }; - - $template->param("statements" => \@statements, - "nbstatements" => $nbstatements); - -} -else { +} else { ($template, $loggedinuser, $cookie) = get_template_and_user({template_name => "bull/search.tmpl", query => $query, diff --git a/bull/subscription-detail.pl b/bull/subscription-detail.pl index 49846ed7f3..b57b6b4053 100755 --- a/bull/subscription-detail.pl +++ b/bull/subscription-detail.pl @@ -22,7 +22,7 @@ my ($subscriptionid,$auser,$librarian,$cost,$aqbooksellerid, $aqbooksellername,$ $add1,$every1,$whenmorethan1,$setto1,$lastvalue1, $add2,$every2,$whenmorethan2,$setto2,$lastvalue2, $add3,$every3,$whenmorethan3,$setto3,$lastvalue3, - $numberingmethod, $arrivalplanified, $status, $biblionumber, $bibliotitle, $notes); + $numberingmethod, $status, $biblionumber, $bibliotitle, $notes); $subscriptionid = $query->param('subscriptionid'); @@ -33,7 +33,7 @@ if ($op eq 'modsubscription') { $aqbooksellerid = $query->param('aqbooksellerid'); $biblionumber = $query->param('biblionumber'); $aqbudgetid = $query->param('aqbudgetid'); - $startdate = $query->param('startdate'); + $startdate = format_date_in_iso($query->param('startdate')); $periodicity = $query->param('periodicity'); $dow = $query->param('dow'); $numberlength = $query->param('numberlength'); @@ -55,7 +55,6 @@ if ($op eq 'modsubscription') { $setto3 = $query->param('setto3'); $lastvalue3 = $query->param('lastvalue3'); $numberingmethod = $query->param('numberingmethod'); - $arrivalplanified = $query->param('arrivalplanified'); $status = 1; $notes = $query->param('notes'); @@ -64,43 +63,11 @@ if ($op eq 'modsubscription') { $add1,$every1,$whenmorethan1,$setto1,$lastvalue1, $add2,$every2,$whenmorethan2,$setto2,$lastvalue2, $add3,$every3,$whenmorethan3,$setto3,$lastvalue3, - $numberingmethod, $arrivalplanified, $status, $biblionumber, $notes, $subscriptionid); + $numberingmethod, $status, $biblionumber, $notes, $subscriptionid); } - my $subs = &getsubscription($subscriptionid); - $auser = $subs->{'user'}; - $librarian => $subs->{'librarian'}, - $cost = $subs->{'cost'}; - $aqbooksellerid = $subs->{'aqbooksellerid'}; - $aqbooksellername = $subs->{'aqbooksellername'}; - $bookfundid = $subs->{'bookfundid'}; - $aqbudgetid = $subs->{'aqbudgetid'}; - $startdate = $subs->{'startdate'}; - $periodicity = $subs->{'periodicity'}; - $dow = $subs->{'dow'}; - $numberlength = $subs->{'numberlength'}; - $weeklength = $subs->{'weeklength'}; - $monthlength = $subs->{'monthlength'}; - $add1 = $subs->{'add1'}; - $every1 = $subs->{'every1'}; - $whenmorethan1 = $subs->{'whenmorethan1'}; - $setto1 = $subs->{'setto1'}; - $lastvalue1 = $subs->{'lastvalue1'}; - $add2 = $subs->{'add2'}; - $every2 = $subs->{'every2'}; - $whenmorethan2 = $subs->{'whenmorethan2'}; - $setto2 = $subs->{'setto2'}; - $lastvalue2 = $subs->{'lastvalue2'}; - $add3 = $subs->{'add3'}; - $every3 = $subs->{'every3'}; - $whenmorethan3 = $subs->{'whenmorethan3'}; - $setto3 = $subs->{'setto3'}; - $lastvalue3 = $subs->{'lastvalue3'}; - $numberingmethod = $subs->{'numberingmethod'}; - $arrivalplanified = $subs->{'arrivalplanified'}; - $status = $subs->{status}; - $biblionumber = $subs->{'biblionumber'}; - $bibliotitle = $subs->{'bibliotitle'}, - $notes = $subs->{'notes'}; + +my $subs = &getsubscription($subscriptionid); +my @serialslist = getserials($subscriptionid); ($template, $loggedinuser, $cookie) = get_template_and_user({template_name => "bull/subscription-detail.tmpl", @@ -115,45 +82,45 @@ my ($user, $cookie, $sessionID, $flags) = checkauth($query, 0, {catalogue => 1}, "intranet"); $template->param( - user => $auser, - librarian => $librarian, - aqbooksellerid => $aqbooksellerid, - aqbooksellername => $aqbooksellername, - cost => $cost, - aqbudgetid => $aqbudgetid, - bookfundid => $bookfundid, - startdate => format_date($startdate), - periodicity => $periodicity, - dow => $dow, - numberlength => $numberlength, - weeklength => $weeklength, - monthlength => $monthlength, - add1 => $add1, - every1 => $every1, - whenmorethan1 => $whenmorethan1, - setto1 => $setto1, - lastvalue1 => $lastvalue1, - add2 => $add2, - every2 => $every2, - whenmorethan2 => $whenmorethan2, - setto2 => $setto2, - lastvalue2 => $lastvalue2, - add3 => $add3, - every3 => $every3, - whenmorethan3 => $whenmorethan3, - setto3 => $setto3, - lastvalue3 => $lastvalue3, - numberingmethod => $numberingmethod, - arrivalplanified => $arrivalplanified, - status => $status, - biblionumber => $biblionumber, - bibliotitle => $bibliotitle, - notes => $notes, - subscriptionid => $subscriptionid + user => $subs->{auser}, + librarian => $subs->{librarian}, + aqbooksellerid => $subs->{aqbooksellerid}, + aqbooksellername => $subs->{aqbooksellername}, + cost => $subs->{cost}, + aqbudgetid => $subs->{aqbudgetid}, + bookfundid => $subs->{bookfundid}, + startdate => format_date($subs->{startdate}), + periodicity => $subs->{periodicity}, + dow => $subs->{dow}, + numberlength => $subs->{numberlength}, + weeklength => $subs->{weeklength}, + monthlength => $subs->{monthlength}, + add1 => $subs->{add1}, + every1 => $subs->{every1}, + whenmorethan1 => $subs->{whenmorethan1}, + setto1 => $subs->{setto1}, + lastvalue1 => $subs->{lastvalue1}, + add2 => $subs->{add2}, + every2 => $subs->{every2}, + whenmorethan2 => $subs->{whenmorethan2}, + setto2 => $subs->{setto2}, + lastvalue2 => $subs->{lastvalue2}, + add3 => $subs->{add3}, + every3 => $subs->{every3}, + whenmorethan3 => $subs->{whenmorethan3}, + setto3 => $subs->{setto3}, + lastvalue3 => $subs->{lastvalue3}, + numberingmethod => $subs->{numberingmethod}, + status => $subs->{status}, + biblionumber => $subs->{biblionumber}, + bibliotitle => $subs->{bibliotitle}, + notes => $subs->{notes}, + subscriptionid => $subs->{subscriptionid}, + serialslist => \@serialslist, ); $template->param( - "periodicity$periodicity" => 1, - "arrival$dow" => 1, + "periodicity$subs->{periodicity}" => 1, + "arrival$subs->{dow}" => 1, ); output_html_with_http_headers $query, $cookie, $template->output; diff --git a/bull/subscription-detail.pl.new b/bull/subscription-detail.pl.new new file mode 100755 index 0000000000..86c9090bfa --- /dev/null +++ b/bull/subscription-detail.pl.new @@ -0,0 +1,177 @@ +#!/usr/bin/perl + +use strict; +use CGI; +use C4::Auth; +use C4::Bull; +use C4::Output; +use C4::Interface::CGI::Output; +use C4::Context; +use HTML::Template; + +my $query = new CGI; +my $op = $query->param('op'); +my $dbh = C4::Context->dbh; +my $sth; +my $id; +my ($template, $loggedinuser, $cookie, $subs); + +if ($op eq 'modsubscription') { + &modsubscription($query->param('suscr'),$query->param('user'),$query->param('cost'), + $query->param('supplier'),$query->param('budget'),$query->param('begin'), + $query->param('frequency'),$query->param('arrival'),$query->param('numberlength'), + $query->param('weeklength'),$query->param('monthlength'), + $query->param('X'),$query->param('Xstate'),$query->param('Xfreq'),$query->param('Xstep'), + $query->param('Y'),$query->param('Ystate'),$query->param('Yfreq'),$query->param('Ystep'), + $query->param('Z'),$query->param('Zstate'),$query->param('Zfreq'),$query->param('Zstep'), + $query->param('sequence'),$query->param('arrivalplanified'),1, + $query->param('biblioid'),$query->param('notes') + ); + + ($template, $loggedinuser, $cookie) + = get_template_and_user({template_name => "bull/subscription-detail.tmpl", + query => $query, + type => "intranet", + authnotrequired => 0, + flagsrequired => {catalogue => 1}, + debug => 1, + }); + + my ($user, $cookie, $sessionID, $flags) = checkauth($query, 0, {catalogue => 1}, "intranet"); + warn "user =>".$query->param('user'), + "librarian =>".$query->param('user'), + "aqbooksellerid =>". $query->param('supplier'), + "cost =>". $query->param('cost'), + "aqbudgetid =>". $query->param('budget'), + "startdate =>". $query->param('begin'), + "frequency =>". $query->param('frequency'), + "arrival =>". $query->param('dow'), + "numberlength =>". $query->param('numberlength'), + "weeklength =>". $query->param('weeklength'), + "monthlength =>". $query->param('monthlength'), + "seqnum1 =>". $query->param('X'), + "startseqnum1 =>". $query->param('X'), + "seqtype1 =>". $query->param('Xstate'), + "freq1 =>". $query->param('Xfreq'), + "step1 =>". $query->param('Xstep'), + "seqnum2 =>". $query->param('Y'), + "startseqnum2 =>". $query->param('Y'), + "seqtype2 =>". $query->param('Ystate'), + "freq2 =>". $query->param('Yfreq'), + "step2 =>". $query->param('Ystep'), + "seqnum3 =>". $query->param('Z'), + "startseqnum3 =>". $query->param('Z'), + "seqtype3 =>". $query->param('Zstate'), + "freq3 =>". $query->param('Zfreq'), + "step3 =>". $query->param('Zstep'), + "sequence =>". $query->param('sequence'), + "arrivalplanified =>". $query->param('arrivalplanified'), + "status =>". $query->param('status'), + "biblioid =>". $query->param('perioid'), + "notes =>". $query->param('notes'), + "suscr =>". $query->param('id'); + $template->param( + user => $query->param('user'), + librarian => $query->param('user'), + aqbooksellerid => $query->param('supplier'), + cost => $query->param('cost'), + aqbudgetid => $query->param('budget'), + startdate => $query->param('begin'), + frequency => $query->param('frequency'), + arrival => $query->param('dow'), + numberlength => $query->param('numberlength'), + weeklength => $query->param('weeklength'), + monthlength => $query->param('monthlength'), + seqnum1 => $query->param('X'), + startseqnum1 => $query->param('X'), + seqtype1 => $query->param('Xstate'), + freq1 => $query->param('Xfreq'), + step1 => $query->param('Xstep'), + seqnum2 => $query->param('Y'), + startseqnum2 => $query->param('Y'), + seqtype2 => $query->param('Ystate'), + freq2 => $query->param('Yfreq'), + step2 => $query->param('Ystep'), + seqnum3 => $query->param('Z'), + startseqnum3 => $query->param('Z'), + seqtype3 => $query->param('Zstate'), + freq3 => $query->param('Zfreq'), + step3 => $query->param('Zstep'), + sequence => $query->param('sequence'), + arrivalplanified => $query->param('arrivalplanified'), + status => $query->param('status'), + biblioid => $query->param('perioid'), + notes => $query->param('notes'), + suscr => $query->param('id')); + + + $template->param( + "frequency$query->param('frequency')" => 1, + "Xstate".$query->param('Xstate') => 1, + "Ystate".$query->param('Ystate') => 1, + "Zstate".$query->param('Zstate') => 1, + "arrival".query->param('$dow') => 1, + ); + + } else { + $sth = $dbh->prepare('select * from subscription where subscriptionid = ?'); + $id = $query->param('suscr'); + $sth->execute($id); + $subs = $sth->fetchrow_hashref; + $sth->finish; + + ($template, $loggedinuser, $cookie) + = get_template_and_user({template_name => "bull/subscription-detail.tmpl", + query => $query, + type => "intranet", + authnotrequired => 0, + flagsrequired => {catalogue => 1}, + debug => 1, + }); + + my ($user, $cookie, $sessionID, $flags) = checkauth($query, 0, {catalogue => 1}, "intranet"); + $template->param(user => $user); + $template->param(librarian => $subs->{'librarian'}, + aqbooksellerid => $subs->{'aqbooksellerid'}, + cost => $subs->{'cost'}, + aqbudgetid => $subs->{'aqbudgetid'}, + startdate => $subs->{'startdate'}, + frequency => $subs->{'periodicity'}, + arrival => $subs->{'dow'}, + numberlength => $subs->{'numberlength'}, + weeklength => $subs->{'weeklength'}, + monthlength => $subs->{'monthlength'}, + seqnum1 => $subs->{'seqnum1'}, + startseqnum1 => $subs->{'startseqnum1'}, + seqtype1 => $subs->{'seqtype1'}, + freq1 => $subs->{'freq1'}, + step1 => $subs->{'step1'}, + seqnum2 => $subs->{'seqnum2'}, + startseqnum2 => $subs->{'startseqnum2'}, + seqtype2 => $subs->{'seqtype2'}, + freq2 => $subs->{'freq2'}, + step2 => $subs->{'step2'}, + seqnum3 => $subs->{'seqnum3'}, + startseqnum3 => $subs->{'startseqnum3'}, + seqtype3 => $subs->{'seqtype3'}, + freq3 => $subs->{'freq3'}, + step3 => $subs->{'step3'}, + sequence => $subs->{'numberingmethod'}, + arrivalplanified => $subs->{'arrivalplanified'}, + status => $subs->{'status'}, + biblioid => $subs->{'perioid'}, + notes => $subs->{'notes'}, + suscr => $id, + ); + + $template->param( + "frequency$subs->{'periodicity'}" => 1, + "Xstate$subs->{'seqtype1'}" => 1, + "Ystate$subs->{'seqtype2'}" => 1, + "Zstate$subs->{'seqtype3'}" => 1, + "arrival$subs->{'dow'}" => 1, + ); + +} + +output_html_with_http_headers $query, $cookie, $template->output; diff --git a/bull/subscription-renew.pl b/bull/subscription-renew.pl new file mode 100755 index 0000000000..1b94806bf5 --- /dev/null +++ b/bull/subscription-renew.pl @@ -0,0 +1,69 @@ +#!/usr/bin/perl +# WARNING: 4-character tab stops here + +# Copyright 2000-2002 Katipo Communications +# +# This file is part of Koha. +# +# Koha is free software; you can redistribute it and/or modify it under the +# terms of the GNU General Public License as published by the Free Software +# Foundation; either version 2 of the License, or (at your option) any later +# version. +# +# Koha is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +# A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place, +# Suite 330, Boston, MA 02111-1307 USA + +use strict; +require Exporter; +use CGI; +use C4::Koha; +use C4::Auth; +use C4::Date; +use HTML::Template; +use C4::Context; +use C4::Search; +use C4::Auth; +use C4::Output; +use C4::Interface::CGI::Output; +use C4::Bull; + +my $query = new CGI; +my $dbh = C4::Context->dbh; + +my $op = $query->param('op'); +my $subscriptionid = $query->param('subscriptionid'); + +my ($template, $loggedinuser, $cookie) + = get_template_and_user({template_name => "bull/subscription-renew.tmpl", + query => $query, + type => "intranet", + authnotrequired => 0, + flagsrequired => {catalogue => 1}, + debug => 1, + }); +if ($op eq "renew") { + subscriptionrenew($subscriptionid,$loggedinuser,$query->param('startdate'),$query->param('numberlength'),$query->param('weeklength'),$query->param('monthlength'),$query->param('note')); +} + +my $subscription= getsubscription($subscriptionid); + +$template->param(startdate => format_date(subscriptionexpirationdate($subscriptionid)), + numberlength => $subscription->{numberlength}, + weeklength => $subscription->{weeklength}, + monthlength => $subscription->{monthlength}, + subscriptionid => $subscriptionid, + bibliotitle => $subscription->{bibliotitle}, + $op => 1, + ); + +# Print the page +output_html_with_http_headers $query, $cookie, $template->output; + +# Local Variables: +# tab-width: 4 +# End: diff --git a/koha-tmpl/intranet-tmpl/default/en/bull/order.tmpl b/koha-tmpl/intranet-tmpl/default/en/bull/order.tmpl index 717608a5c6..0f8ee4471b 100644 --- a/koha-tmpl/intranet-tmpl/default/en/bull/order.tmpl +++ b/koha-tmpl/intranet-tmpl/default/en/bull/order.tmpl @@ -1,39 +1,53 @@
-

Supplier Search Results

+

Supplier Search Results

-

You searched on supplier , results found

+

You searched on supplier , results found

- - + + + - > - + > + - - -
SupplierSelectCompany + + + + + +
Basket 
+
- -
- ')"> - /images/arrow.gif" title="select this supplier" BORDER=0 height=40 width=40> - -
- -
-Add supplier - - - + + + + + + + + + + + + + + + + + +
BasketItemsCreated byDate 
+ + closed on + + " class="button acquisition">... + +
+ + + +
+ Add supplier +
diff --git a/koha-tmpl/intranet-tmpl/default/en/bull/serial-issues.tmpl b/koha-tmpl/intranet-tmpl/default/en/bull/serial-issues.tmpl new file mode 100644 index 0000000000..7135381e3d --- /dev/null +++ b/koha-tmpl/intranet-tmpl/default/en/bull/serial-issues.tmpl @@ -0,0 +1,87 @@ + + +
+

Issues for a subscription

+" class="button catalogue">Biblio +
+
+

Subscription information

+

For that began on and is issued every + + + day + + + week + + + 2 weeks + + + 3 weeks + + + month + + + 2 monthes + + + 3 Monthes + + + quarter + + + 2 quarters + + + year + + + 2 years + + + on + + + Monday + + + Tuesday + + + Wednesday + + + Thursday + + + Friday + + + Saturday + + + Sunday + + +

+

(subscription for + issues + weeks + months + ) +

+

+
+
+

Issues summary

+

+ +

+
+ +
+ + \ No newline at end of file diff --git a/koha-tmpl/intranet-tmpl/default/en/bull/statecollection.tmpl b/koha-tmpl/intranet-tmpl/default/en/bull/statecollection.tmpl index 3c29b580ec..b53a41ef51 100644 --- a/koha-tmpl/intranet-tmpl/default/en/bull/statecollection.tmpl +++ b/koha-tmpl/intranet-tmpl/default/en/bull/statecollection.tmpl @@ -2,7 +2,8 @@
-

Subscription for XXX

+

Subscription for

+" class="button bull">Subscription

Subscription summary

@@ -12,7 +13,7 @@ "> ">

-

">

+

">

">

Arrived Numbers

 

@@ -56,11 +57,8 @@ "> + +

Subscription has expired. Waited last issue status can't be changed. Renew your subscription

+
+ + \ No newline at end of file diff --git a/koha-tmpl/intranet-tmpl/default/en/bull/subscription-add.tmpl b/koha-tmpl/intranet-tmpl/default/en/bull/subscription-add.tmpl index 3cc3df828c..c09409e2af 100644 --- a/koha-tmpl/intranet-tmpl/default/en/bull/subscription-add.tmpl +++ b/koha-tmpl/intranet-tmpl/default/en/bull/subscription-add.tmpl @@ -15,85 +15,74 @@ ">

Librarian

-

" size=4> (" disabled readonly>) ...

-

" size=4>

-

- -

-

" size=4> (" disabled readonly>)...

-

+

" size=4> (" disabled readonly>)...

+

+

warning

+
    +
  • remember you must have created a biblio before creating a subscription
  • +
  • a suggestion is sent to the librarian. The suggestion will be changed to an order
  • +

Planning

" size=13 maxlength=10>

-

" size=13 maxlength=10>

@@ -225,9 +214,8 @@ function FindAcqui(f) function Check(f) { - if (f.aqbooksellerid.value.length != 0 && f.dow.value.length != 0 - && f.startdate.value.length != 0 && f.dow.value.length != 0 - && f.periodicity.value.length != 0) + if (f.dow.value.length != 0 + && f.startdate.value.length != 0 && f.dow.value.length != 0) { // alert('subscription ok'); document.f.submit(); @@ -238,149 +226,4 @@ else } return false; } - -function select(reponse, type) -{ - if (type == 'X') - { - if (reponse == 0) - { - document.f.step1.style.backgroundColor="#DCDCDC"; - document.f.step1.value = ""; - document.f.step1.disabled = true; - document.f.freq1.style.backgroundColor="#DCDCDC"; - document.f.freq1.value = ""; - document.f.freq1.disabled = true; - document.f.seqnum1.style.backgroundColor="#DCDCDC"; - document.f.seqnum1.value = ""; - document.f.seqnum1.disabled = true; - - } - if (reponse == 1) - { - document.f.step1.style.backgroundColor="#FFFFFF"; - document.f.step1.disabled = false; - document.f.freq1.style.backgroundColor="#DCDCDC"; - document.f.freq1.value = ""; - document.f.freq1.disabled = true; - document.f.seqnum1.style.backgroundColor="#FFFFFF"; - document.f.seqnum1.disabled = false; - } - if (reponse == 2) - { - document.f.step1.style.backgroundColor="#FFFFFF"; - document.f.step1.disabled = false; - document.f.freq1.style.backgroundColor="#FFFFFF"; - document.f.freq1.disabled = false; - document.f.seqnum1.style.backgroundColor="#FFFFFF"; - document.f.seqnum1.disabled = false; - } - if (reponse == 3) - { - document.f.step1.style.backgroundColor="#DCDCDC"; - document.f.step1.value = ""; - document.f.step1.disabled = true; - document.f.freq1.style.backgroundColor="#DCDCDC"; - document.f.freq1.value = ""; - document.f.freq1.disabled = true; - document.f.seqnum1.style.backgroundColor="#FFFFFF"; - document.f.seqnum1.disabled = false; - } - } - if (type == 'Y') - { - if (reponse == 0) - { - document.f.step2.style.backgroundColor="#DCDCDC"; - document.f.step2.value = ""; - document.f.step2.disabled = true; - document.f.freq2.style.backgroundColor="#DCDCDC"; - document.f.freq2.value = ""; - document.f.freq2.disabled = true; - document.f.seqnum2.style.backgroundColor="#DCDCDC"; - document.f.seqnum2.value = ""; - document.f.seqnum2.disabled = true; - - } - if (reponse == 1) - { - document.f.step2.style.backgroundColor="#FFFFFF"; - document.f.step2.disabled = false; - document.f.freq2.style.backgroundColor="#DCDCDC"; - document.f.freq2.value = ""; - document.f.freq2.disabled = true; - document.f.seqnum2.style.backgroundColor="#FFFFFF"; - document.f.seqnum2.disabled = false; - } - if (reponse == 2) - { - document.f.step2.style.backgroundColor="#FFFFFF"; - document.f.step2.disabled = false; - document.f.freq2.style.backgroundColor="#FFFFFF"; - document.f.freq2.disabled = false; - document.f.seqnum2.style.backgroundColor="#FFFFFF"; - document.f.seqnum2.disabled = false; - } - if (reponse == 3) - { - document.f.step2.style.backgroundColor="#DCDCDC"; - document.f.step2.value = ""; - document.f.step2.disabled = true; - document.f.freq2.style.backgroundColor="#DCDCDC"; - document.f.freq2.value = ""; - document.f.freq2.disabled = true; - document.f.Y.style.backgroundColor="#FFFFFF"; - document.f.Y.disabled = false; - } - - } - if (type == 'Z') - { - if (reponse == 0) - { - document.f.step3.style.backgroundColor="#DCDCDC"; - document.f.step3.value = ""; - document.f.step3.disabled = true; - document.f.freq3.style.backgroundColor="#DCDCDC"; - document.f.freq3.value = ""; - document.f.freq3.disabled = true; - document.f.seqnum3.style.backgroundColor="#DCDCDC"; - document.f.seqnum3.value = ""; - document.f.seqnum3.disabled = true; - - } - if (reponse == 1) - { - document.f.step3.style.backgroundColor="#FFFFFF"; - document.f.step3.disabled = false; - document.f.freq3.style.backgroundColor="#DCDCDC"; - document.f.freq3.value = ""; - document.f.freq3.disabled = true; - document.f.seqnum3.style.backgroundColor="#FFFFFF"; - document.f.seqnum3.disabled = false; - } - if (reponse == 2) - { - document.f.step3.style.backgroundColor="#FFFFFF"; - document.f.step3.disabled = false; - document.f.freq3.style.backgroundColor="#FFFFFF"; - document.f.freq3.disabled = false; - document.f.seqnum3.style.backgroundColor="#FFFFFF"; - document.f.seqnum3.disabled = false; - } - if (reponse == 3) - { - document.f.step3.style.backgroundColor="#DCDCDC"; - document.f.step3.value = ""; - document.f.step3.disabled = true; - document.f.freq3.style.backgroundColor="#DCDCDC"; - document.f.freq3.value = ""; - document.f.freq3.disabled = true; - document.f.seqnum3.style.backgroundColor="#FFFFFF"; - document.f.seqnum3.disabled = false; - } - - } -} - \ No newline at end of file diff --git a/koha-tmpl/intranet-tmpl/default/en/bull/subscription-detail.tmpl b/koha-tmpl/intranet-tmpl/default/en/bull/subscription-detail.tmpl index 791d5d3b7d..783262e4e6 100644 --- a/koha-tmpl/intranet-tmpl/default/en/bull/subscription-detail.tmpl +++ b/koha-tmpl/intranet-tmpl/default/en/bull/subscription-detail.tmpl @@ -3,7 +3,8 @@

Subscription

" class="button bull">Edit -" class="button bull">Recieve +" class="button bull">Issues +" class="button bull">Biblio

Subscription information

@@ -25,10 +26,10 @@ 1/week - 2/weeks + 1/2 weeks - 3/weeks + 1/3 weeks 1/Month @@ -43,13 +44,13 @@ 1/quarter - 2 quarters + 1/2 quarters - 1 year + 1/year - 2 years + 1/2 years

@@ -132,7 +133,41 @@

- +
+

Issues

+ + + + + + + + + + + + + +
    Issue number        Planned date        Status    
+ + + + + + Waited + + + Arrived + + + Late + + + Missing + + +
+
\ No newline at end of file diff --git a/koha-tmpl/intranet-tmpl/default/en/bull/subscription-renew.tmpl b/koha-tmpl/intranet-tmpl/default/en/bull/subscription-renew.tmpl new file mode 100644 index 0000000000..7365d8561d --- /dev/null +++ b/koha-tmpl/intranet-tmpl/default/en/bull/subscription-renew.tmpl @@ -0,0 +1,22 @@ + +
+ +

subscription renewal for

+ + +
+ + "> +

">

+

Subscription length :

+

">

+

">

+

">

+

Note for the librarian that will manage your renewal request

+
+ +
+ +
+ + diff --git a/koha-tmpl/intranet-tmpl/default/en/includes/bull-top.inc b/koha-tmpl/intranet-tmpl/default/en/includes/bull-top.inc index fd0774f224..06d4ee34c6 100644 --- a/koha-tmpl/intranet-tmpl/default/en/includes/bull-top.inc +++ b/koha-tmpl/intranet-tmpl/default/en/includes/bull-top.inc @@ -45,8 +45,7 @@ a.bull:hover {
diff --git a/koha-tmpl/opac-tmpl/css/en/opac-serial-issues.tmpl b/koha-tmpl/opac-tmpl/css/en/opac-serial-issues.tmpl new file mode 100644 index 0000000000..4889440963 --- /dev/null +++ b/koha-tmpl/opac-tmpl/css/en/opac-serial-issues.tmpl @@ -0,0 +1,85 @@ + + +
+

Issues for a subscription

+" class="button catalogue">Back to biblio +
+
+

Subscription information for

+

It began on and is issued every + + + day + + + week + + + 2 weeks + + + 3 weeks + + + month + + + 2 monthes + + + 3 Monthes + + + quarter + + + 2 quarters + + + year + + + 2 years + + + on + + + Monday + + + Tuesday + + + Wednesday + + + Thursday + + + Friday + + + Saturday + + + Sunday + + + for + issues + weeks + months + + since +

+

+

Issues summary

+

+ +

+
+ +
+ + \ No newline at end of file -- 2.39.5