Bugzilla – Attachment 13011 Details for
Bug 5343
Subscription cost (Link serial and acqui modules)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 5343: Link serial and acqui modules
Bug-5343-Link-serial-and-acqui-modules.patch (text/plain), 48.06 KB, created by
Jonathan Druart
on 2012-10-23 15:17:21 UTC
(
hide
)
Description:
Bug 5343: Link serial and acqui modules
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2012-10-23 15:17:21 UTC
Size:
48.06 KB
patch
obsolete
>From 02c286667c69e4b37d589995c5c1164077f0a6c4 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@biblibre.com> >Date: Tue, 23 Oct 2012 12:13:16 +0200 >Subject: [PATCH] Bug 5343: Link serial and acqui modules > >DB changements: >- Adds 2 fields: subscription.reneweddate and aqorders.subscriptionid. >- Removes 2 unused fields: aqorders.serialid and aqorders.subscription. > >Main test plan: >1) Create a subscription >2) Create a bookseller and a basket >3) Add a new order 'from a subscription' >4) Search your subscription and check if results are correct >5) Click on the "order" link >6) Check the biblio information are filled in the form >7) Select a budget and fill some price information. >8) retry steps 3 and 4. Verify you cannot order the same subscription. >Message:Outstanding order (only one order per subscription is allowed). >9) click on your subscription (already added) and check you have a new >table "Acquisition details" with your price information in the "Ordered >amount" line. >10) receive this order >11) On your subscription detail page, the "Spent amount" line must be >filled with your price information. >12) Re order the same subscription. Now you are allowed to. Prices >information have to be filled with the previous information. >13) Retry some orders and click on a maximum of links in order to find a >bug :) >--- > C4/Acquisition.pm | 63 +++++++++- > C4/Budgets.pm | 23 ++++ > C4/Serials.pm | 24 +++- > acqui/addorder.pl | 1 + > acqui/finishreceive.pl | 3 +- > acqui/neworderempty.pl | 34 +++++- > acqui/newordersubscription.pl | 101 ++++++++++++++++ > acqui/orderreceive.pl | 1 + > installer/data/mysql/kohastructure.sql | 7 +- > installer/data/mysql/updatedatabase.pl | 11 ++ > .../en/includes/acquisitions-add-to-basket.inc | 19 ++-- > .../prog/en/includes/subscriptions-search.inc | 55 +++++++++ > .../prog/en/modules/acqui/neworderempty.tt | 105 +++++++++-------- > .../prog/en/modules/acqui/newordersubscription.tt | 120 ++++++++++++++++++++ > .../prog/en/modules/acqui/orderreceive.tt | 50 ++++---- > .../prog/en/modules/serials/serials-home.tt | 1 + > serials/serials-search.pl | 2 +- > serials/subscription-detail.pl | 95 +++++++++++----- > 18 files changed, 596 insertions(+), 119 deletions(-) > create mode 100755 acqui/newordersubscription.pl > create mode 100644 koha-tmpl/intranet-tmpl/prog/en/includes/subscriptions-search.inc > create mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/acqui/newordersubscription.tt > >diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm >index 83031be..b5cf74f 100644 >--- a/C4/Acquisition.pm >+++ b/C4/Acquisition.pm >@@ -58,7 +58,7 @@ BEGIN { > &SearchOrder &GetHistory &GetRecentAcqui > &ModReceiveOrder &CancelReceipt &ModOrderBiblioitemNumber > &GetCancelledOrders >- >+ &GetLastOrderNotReceivedFromSubscriptionid &GetLastOrderReceivedFromSubscriptionid > &NewOrderItem &ModOrderItem &ModItemOrder > > &GetParcels &GetParcel >@@ -1006,6 +1006,67 @@ sub GetOrder { > return $data; > } > >+=head3 GetLastOrderNotReceivedFromSubscriptionid >+ >+ $order = &GetLastOrderNotReceivedFromSubscriptionid($subscriptionid); >+ >+Returns a reference-to-hash describing the last order not received for a subscription. >+ >+=cut >+ >+sub GetLastOrderNotReceivedFromSubscriptionid { >+ my ( $subscriptionid ) = @_; >+ my $dbh = C4::Context->dbh; >+ my $query = qq| >+ SELECT * FROM aqorders >+ LEFT JOIN subscription >+ ON ( aqorders.subscriptionid = subscription.subscriptionid ) >+ WHERE aqorders.subscriptionid = ? >+ AND aqorders.datereceived IS NULL >+ LIMIT 1 >+ |; >+ my $sth = $dbh->prepare( $query ); >+ $sth->execute( $subscriptionid ); >+ my $order = $sth->fetchrow_hashref; >+ return $order; >+} >+ >+=head3 GetLastOrderReceivedFromSubscriptionid >+ >+ $order = &GetLastOrderReceivedFromSubscriptionid($subscriptionid); >+ >+Returns a reference-to-hash describing the last order received for a subscription. >+ >+=cut >+ >+sub GetLastOrderReceivedFromSubscriptionid { >+ my ( $subscriptionid ) = @_; >+ my $dbh = C4::Context->dbh; >+ my $query = qq| >+ SELECT * FROM aqorders >+ LEFT JOIN subscription >+ ON ( aqorders.subscriptionid = subscription.subscriptionid ) >+ WHERE aqorders.subscriptionid = ? >+ AND aqorders.datereceived = >+ ( >+ SELECT MAX( aqorders.datereceived ) >+ FROM aqorders >+ LEFT JOIN subscription >+ ON ( aqorders.subscriptionid = subscription.subscriptionid ) >+ WHERE aqorders.subscriptionid = ? >+ AND aqorders.datereceived IS NOT NULL >+ ) >+ ORDER BY ordernumber DESC >+ LIMIT 1 >+ |; >+ my $sth = $dbh->prepare( $query ); >+ $sth->execute( $subscriptionid, $subscriptionid ); >+ my $order = $sth->fetchrow_hashref; >+ return $order; >+ >+} >+ >+ > #------------------------------------------------------------# > > =head3 NewOrder >diff --git a/C4/Budgets.pm b/C4/Budgets.pm >index d07dc75..45dbe31 100644 >--- a/C4/Budgets.pm >+++ b/C4/Budgets.pm >@@ -41,6 +41,7 @@ BEGIN { > &DelBudget > &GetBudgetSpent > &GetBudgetOrdered >+ &GetBudgetName > &GetPeriodsCount > &GetChildBudgetsSpent > >@@ -356,6 +357,28 @@ sub GetBudgetOrdered { > return $sum; > } > >+=head2 GetBudgetName >+ >+ my $budget_name = &GetBudgetName($budget_id); >+ >+get the budget_name for a given budget_id >+ >+=cut >+ >+sub GetBudgetName { >+ my ( $budget_id ) = @_; >+ my $dbh = C4::Context->dbh; >+ my $sth = $dbh->prepare( >+ qq| >+ SELECT budget_name >+ FROM aqbudgets >+ WHERE budget_id = ? >+ |); >+ >+ $sth->execute($budget_id); >+ return $sth->fetchrow_array; >+} >+ > # ------------------------------------------------------------------- > sub GetBudgetAuthCats { > my ($budget_period_id) = shift; >diff --git a/C4/Serials.pm b/C4/Serials.pm >index cedbcff..431693a 100644 >--- a/C4/Serials.pm >+++ b/C4/Serials.pm >@@ -55,6 +55,7 @@ BEGIN { > &CountIssues > HasItems > &GetSubscriptionsFromBorrower >+ &subscriptionCurrentlyOnOrder > > ); > } >@@ -1422,7 +1423,7 @@ sub ReNewSubscription { > # renew subscription > $query = qq| > UPDATE subscription >- SET startdate=?,numberlength=?,weeklength=?,monthlength=? >+ SET startdate=?,numberlength=?,weeklength=?,monthlength=?,reneweddate=NOW() > WHERE subscriptionid=? > |; > $sth = $dbh->prepare($query); >@@ -2465,6 +2466,27 @@ sub is_barcode_in_use { > return @{$occurences}; > } > >+=head2 subscriptionCurrentlyOnOrder >+ >+ $bool = subscriptionCurrentlyOnOrder( $subscriptionid ); >+ >+Return 1 if subscription is currently on order else 0. >+ >+=cut >+ >+sub subscriptionCurrentlyOnOrder { >+ my ( $subscriptionid ) = @_; >+ my $dbh = C4::Context->dbh; >+ my $query = qq| >+ SELECT COUNT(*) FROM aqorders >+ WHERE subscriptionid = ? >+ AND datereceived IS NULL >+ |; >+ my $sth = $dbh->prepare( $query ); >+ $sth->execute($subscriptionid); >+ return $sth->fetchrow_array; >+} >+ > 1; > __END__ > >diff --git a/acqui/addorder.pl b/acqui/addorder.pl >index 1dfa0b1..00588ab 100755 >--- a/acqui/addorder.pl >+++ b/acqui/addorder.pl >@@ -153,6 +153,7 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( > my $orderinfo = $input->Vars; > $orderinfo->{'list_price'} ||= 0; > $orderinfo->{'uncertainprice'} ||= 0; >+$orderinfo->{subscriptionid} ||= undef; > > my $user = $input->remote_user; > >diff --git a/acqui/finishreceive.pl b/acqui/finishreceive.pl >index 565ac36..5ca2c98 100755 >--- a/acqui/finishreceive.pl >+++ b/acqui/finishreceive.pl >@@ -52,7 +52,6 @@ my $invoiceno = $invoice->{invoicenumber}; > my $datereceived = $invoice->{shipmentdate}; > my $booksellerid = $input->param('booksellerid'); > my $cnt = 0; >-my $error_url_str; > my $ecost = $input->param('ecost'); > my $rrp = $input->param('rrp'); > my $note = $input->param("note"); >@@ -93,7 +92,7 @@ if ($quantityrec > $origquantityrec ) { > $user, > $order->{unitprice}, > $order->{ecost}, >- $invoiceno, >+ $invoiceid, > $order->{rrp}, > undef, > $datereceived, >diff --git a/acqui/neworderempty.pl b/acqui/neworderempty.pl >index 4144033..e30c18c 100755 >--- a/acqui/neworderempty.pl >+++ b/acqui/neworderempty.pl >@@ -97,14 +97,14 @@ my $budget_id = $input->param('budget_id') || 0; > my $title = $input->param('title'); > my $author = $input->param('author'); > my $publicationyear = $input->param('publicationyear'); >-my $bookseller = GetBookSellerFromId($booksellerid); # FIXME: else ERROR! >-my $ordernumber = $input->param('ordernumber') || ''; >+my $ordernumber = $input->param('ordernumber') || ''; > my $biblionumber = $input->param('biblionumber'); > my $basketno = $input->param('basketno'); > my $suggestionid = $input->param('suggestionid'); > my $close = $input->param('close'); > my $uncertainprice = $input->param('uncertainprice'); > my $import_batch_id = $input->param('import_batch_id'); # if this is filled, we come from a staged file, and we will return here after saving the order ! >+my $subscriptionid = $input->param('subscriptionid'); > my $data; > my $new = 'no'; > >@@ -129,6 +129,9 @@ if(!$basketno) { > } > > my $basket = GetBasket($basketno); >+$booksellerid = $basket->{booksellerid} unless $booksellerid; >+my $bookseller = GetBookSellerFromId($booksellerid); >+ > my $contract = &GetContract($basket->{contractnumber}); > > #simple parameters reading (all in one :-) >@@ -186,10 +189,8 @@ else { #modify order > $biblionumber = $data->{'biblionumber'}; > $budget_id = $data->{'budget_id'}; > >- #get basketno and supplierno. too! >- my $data2 = GetBasket( $data->{'basketno'} ); >- $basketno = $data2->{'basketno'}; >- $booksellerid = $data2->{'booksellerid'}; >+ $basket = GetBasket( $data->{'basketno'} ); >+ $basketno = $basket->{'basketno'}; > } > > my $suggestion; >@@ -321,6 +322,26 @@ if (C4::Context->preference('AcqCreateItem') eq 'ordering' && !$ordernumber) { > my @itemtypes; > @itemtypes = C4::ItemType->all unless C4::Context->preference('item-level_itypes'); > >+if ( defined $subscriptionid ) { >+ my $lastOrderReceived = GetLastOrderReceivedFromSubscriptionid $subscriptionid; >+ if ( defined $lastOrderReceived ) { >+ $budget_id = $lastOrderReceived->{budgetid}; >+ $data->{listprice} = $lastOrderReceived->{listprice}; >+ $data->{uncertainprice} = $lastOrderReceived->{uncertainprice}; >+ $data->{gstrate} = $lastOrderReceived->{gstrate}; >+ $data->{discount} = $lastOrderReceived->{discount}; >+ $data->{rrp} = $lastOrderReceived->{rrp}; >+ $data->{ecost} = $lastOrderReceived->{ecost}; >+ $data->{quantity} = $lastOrderReceived->{quantity}; >+ $data->{unitprice} = $lastOrderReceived->{unitprice}; >+ $data->{notes} = $lastOrderReceived->{notes}; >+ $data->{sort1} = $lastOrderReceived->{sort1}; >+ $data->{sort2} = $lastOrderReceived->{sort2}; >+ >+ $basket = GetBasket( $input->param('basketno') ); >+ } >+} >+ > # Find the items.barcode subfield for barcode validations > my (undef, $barcode_subfield) = GetMarcFromKohaField('items.barcode', ''); > >@@ -396,6 +417,7 @@ $template->param( > publishercode => $data->{'publishercode'}, > barcode_subfield => $barcode_subfield, > import_batch_id => $import_batch_id, >+ subscriptionid => $subscriptionid, > (uc(C4::Context->preference("marcflavour"))) => 1 > ); > >diff --git a/acqui/newordersubscription.pl b/acqui/newordersubscription.pl >new file mode 100755 >index 0000000..a0da499 >--- /dev/null >+++ b/acqui/newordersubscription.pl >@@ -0,0 +1,101 @@ >+#!/usr/bin/perl >+ >+# Copyright 2012 BibLibre >+# >+# 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., >+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. >+ >+use Modern::Perl; >+use CGI; >+use C4::Acquisition; >+use C4::Auth; >+use C4::Bookseller qw/GetBookSellerFromId/; >+use C4::Branch; >+use C4::Context; >+use C4::Output; >+use C4::Serials; >+ >+my $query = new CGI; >+my $title = $query->param('title_filter'); >+my $ISSN = $query->param('ISSN_filter'); >+my $EAN = $query->param('EAN_filter'); >+my $publisher = $query->param('publisher_filter'); >+my $supplier = $query->param('supplier_filter'); >+my $branch = $query->param('branch_filter'); >+my $routing = $query->param('routing') || C4::Context->preference("RoutingSerials"); >+my $searched = $query->param('searched'); >+my $biblionumber = $query->param('biblionumber'); >+ >+my $basketno = $query->param('basketno'); >+my $booksellerid = $query->param('booksellerid'); >+ >+my ( $template, $loggedinuser, $cookie, $flags ) = get_template_and_user( >+ { template_name => "acqui/newordersubscription.tt", >+ query => $query, >+ type => "intranet", >+ authnotrequired => 0, >+ flagsrequired => { acquisition => 'order_manage' }, >+ } >+); >+ >+my $basket = GetBasket($basketno); >+$booksellerid = $basket->{booksellerid} unless $booksellerid; >+my ($bookseller) = GetBookSellerFromId($booksellerid); >+ >+my @subscriptions; >+if ($searched) { >+ @subscriptions = SearchSubscriptions($title, $ISSN, $EAN, $publisher, $supplier, $branch); >+} >+ >+foreach my $sub (@subscriptions) { >+ $sub->{alreadyOnOrder} = subscriptionCurrentlyOnOrder $sub->{subscriptionid}; >+ >+ # to toggle between create or edit routing list options >+ if ($routing) { >+ $sub->{routingedit} = check_routing( $sub->{subscriptionid} ); >+ } >+} >+ >+my $branches = GetBranches(); >+my @branches_loop; >+foreach (sort keys %$branches){ >+ my $selected = 0; >+ $selected = 1 if defined $branch && $branch eq $_; >+ push @branches_loop, { >+ branchcode => $_, >+ branchname => $branches->{$_}->{branchname}, >+ selected => $selected, >+ }; >+} >+ >+$template->param( >+ subs_loop => \@subscriptions, >+ title_filter => $title, >+ ISSN_filter => $ISSN, >+ EAN_filter => $EAN, >+ publisher_filter => $publisher, >+ supplier_filter => $supplier, >+ branch_filter => $branch, >+ branches_loop => \@branches_loop, >+ done_searched => $searched, >+ routing => $routing, >+ booksellerid => $booksellerid, >+ basketno => $basket->{basketno}, >+ basketname => $basket->{basketname}, >+ booksellername => $bookseller->{name}, >+ dateformat => C4::Context->preference("dateformat"), >+); >+output_html_with_http_headers $query, $cookie, $template->output; >+ >diff --git a/acqui/orderreceive.pl b/acqui/orderreceive.pl >index 17c2d5e..91f87ab 100755 >--- a/acqui/orderreceive.pl >+++ b/acqui/orderreceive.pl >@@ -198,6 +198,7 @@ if ( $count == 1 ) { > biblionumber => $order->{'biblionumber'}, > ordernumber => $order->{'ordernumber'}, > biblioitemnumber => $order->{'biblioitemnumber'}, >+ subscriptionid => $order->{subscriptionid}, > booksellerid => $order->{'booksellerid'}, > freight => $freight, > gstrate => $order->{gstrate} || $bookseller->{gstrate} || C4::Context->preference("gist") || 0, >diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql >index 29ee782..12ddc08 100644 >--- a/installer/data/mysql/kohastructure.sql >+++ b/installer/data/mysql/kohastructure.sql >@@ -1918,6 +1918,7 @@ CREATE TABLE `subscription` ( > `opacdisplaycount` VARCHAR(10) NULL, > `graceperiod` int(11) NOT NULL default '0', > `enddate` date default NULL, >+ `reneweddate` date default NULL, > PRIMARY KEY (`subscriptionid`) > ) ENGINE=InnoDB DEFAULT CHARSET=utf8; > >@@ -2782,8 +2783,6 @@ CREATE TABLE `aqorders` ( -- information related to the basket line items > `notes` mediumtext, -- notes related to this order line > `supplierreference` mediumtext, -- not used? always NULL > `purchaseordernumber` mediumtext, -- not used? always NULL >- `subscription` tinyint(1) default NULL, -- not used? always NULL >- `serialid` varchar(30) default NULL, -- not used? always NULL > `basketno` int(11) default NULL, -- links this order line to a specific basket (aqbasket.basketno) > `biblioitemnumber` int(11) default NULL, -- links this order line the biblioitems table (biblioitems.biblioitemnumber) > `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, -- the date and time this order line was last modified >@@ -2801,6 +2800,7 @@ CREATE TABLE `aqorders` ( -- information related to the basket line items > `uncertainprice` tinyint(1), -- was this price uncertain (1 for yes, 0 for no) > `claims_count` int(11) default 0, -- count of claim letters generated > `claimed_date` date default NULL, -- last date a claim was generated >+ `subscriptionid` int(11) default NULL, -- links this order line to a subscription (subscription.subscriptionid) > parent_ordernumber int(11) default NULL, -- ordernumber of parent order line, or same as ordernumber if no parent > PRIMARY KEY (`ordernumber`), > KEY `basketno` (`basketno`), >@@ -2808,7 +2808,8 @@ CREATE TABLE `aqorders` ( -- information related to the basket line items > KEY `budget_id` (`budget_id`), > CONSTRAINT `aqorders_ibfk_1` FOREIGN KEY (`basketno`) REFERENCES `aqbasket` (`basketno`) ON DELETE CASCADE ON UPDATE CASCADE, > CONSTRAINT `aqorders_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE SET NULL ON UPDATE CASCADE, >- CONSTRAINT aqorders_ibfk_3 FOREIGN KEY (invoiceid) REFERENCES aqinvoices (invoiceid) ON DELETE SET NULL ON UPDATE CASCADE >+ CONSTRAINT aqorders_ibfk_3 FOREIGN KEY (invoiceid) REFERENCES aqinvoices (invoiceid) ON DELETE SET NULL ON UPDATE CASCADE, >+ CONSTRAINT `aqorders_subscriptionid` FOREIGN KEY (`subscriptionid`) REFERENCES `subscription` (`subscriptionid`) ON DELETE CASCADE ON UPDATE CASCADE > ) ENGINE=InnoDB DEFAULT CHARSET=utf8; > > >diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl >index 4759034..2e5ad8f 100755 >--- a/installer/data/mysql/updatedatabase.pl >+++ b/installer/data/mysql/updatedatabase.pl >@@ -6019,6 +6019,17 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) { > SetVersion ($DBversion); > } > >+$DBversion = "3.09.00.XXX"; >+if (C4::Context->preference("Version") < TransformToNum($DBversion)) { >+ $dbh->do(q{ALTER TABLE aqorders DROP COLUMN serialid;}); >+ $dbh->do(q{ALTER TABLE aqorders DROP COLUMN subscription;}); >+ $dbh->do(q{ALTER TABLE aqorders ADD COLUMN subscriptionid INT(11) DEFAULT NULL;}); >+ $dbh->do(q{ALTER TABLE aqorders ADD CONSTRAINT aqorders_subscriptionid FOREIGN KEY (subscriptionid) REFERENCES subscription (subscriptionid) ON DELETE CASCADE ON UPDATE CASCADE;}); >+ $dbh->do(q{ALTER TABLE subscription ADD COLUMN reneweddate DATE DEFAULT NULL;}); >+ print "Upgrade to $DBversion done (Bug 5343: table aqorders: DROP serialid and subscription fields and ADD subscriptionid, table subscription: ADD reneweddate)\n"; >+ SetVersion ($DBversion); >+} >+ > =head1 FUNCTIONS > > =head2 TableExists($table) >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/acquisitions-add-to-basket.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/acquisitions-add-to-basket.inc >index c36698d..01ecec9 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/acquisitions-add-to-basket.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/acquisitions-add-to-basket.inc >@@ -1,17 +1,22 @@ > <fieldset id="acqui_basket_add"> > <legend>Add order to basket</legend> > [% IF has_budgets %] >- <form action="/cgi-bin/koha/acqui/neworderbiblio.pl" method="post"> >- <input type="hidden" name="booksellerid" value="[% booksellerid %]" /> >- <input type="hidden" name="basketno" value="[% basketno %]" /> >- <ul><li><label for="q">From an existing record: </label><input id="q" type="text" size="25" name="q" /> >- <input type="submit" class="submit" value="Search" /></li> >+ <ul> >+ <li> >+ <label for="q">From an existing record: </label> >+ <form action="/cgi-bin/koha/acqui/neworderbiblio.pl" method="post"> >+ <input type="hidden" name="booksellerid" value="[% booksellerid %]" /> >+ <input type="hidden" name="basketno" value="[% basketno %]" /> >+ <input id="q" type="text" size="25" name="q" /> >+ <input type="submit" class="submit" value="Search" /> >+ </form> >+ </li> > <li><a href="/cgi-bin/koha/acqui/newordersuggestion.pl?booksellerid=[% booksellerid %]&basketno=[% basketno %]">From a suggestion</a></li> >+ <li><a href="/cgi-bin/koha/acqui/newordersubscription.pl?booksellerid=[% booksellerid %]&basketno=[% basketno %]">From a subscription</a></li> > <li><a href="/cgi-bin/koha/acqui/neworderempty.pl?booksellerid=[% booksellerid %]&basketno=[% basketno %]">From a new (empty) record</a></li> > <li><a href="/cgi-bin/koha/acqui/z3950_search.pl?booksellerid=[% booksellerid %]&basketno=[% basketno %]">From an external source</a></li> > <li><a href="/cgi-bin/koha/acqui/addorderiso2709.pl?booksellerid=[% booksellerid %]&basketno=[% basketno %]"> From a staged file</a></li> >- </ul> >- </form> >+ </ul> > [% ELSE %] > You can't create any orders unless you first <a href="/cgi-bin/koha/admin/aqbudgetperiods.pl">define a budget and a fund</a>. > [% END %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/subscriptions-search.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/subscriptions-search.inc >new file mode 100644 >index 0000000..c18a53e >--- /dev/null >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/subscriptions-search.inc >@@ -0,0 +1,55 @@ >+<div id="advsearch"> >+ <form action="" method="get"> >+ <fieldset class="brief"> >+ <a id="unfold_advsearch" style="cursor:pointer" onclick="$('#advsearch_form').slideToggle(400);">Advanced search</a> >+ <div id="advsearch_form" style="display:none"> >+ <ol> >+ <li> >+ <label for="issn">ISSN:</label> >+ <input type="text" id="issn" name="ISSN_filter" value="[% ISSN_filter %]" /> >+ </li> >+ <li> >+ <label for="title">Title:</label> >+ <input type="text" id="title" name="title_filter" value="[% title_filter %]" /> >+ </li> >+ <li> >+ <label for="ean">EAN:</label> >+ <input type="text" id="ean" name="EAN_filter" value="[% EAN_filter %]" /> >+ </li> >+ <li> >+ <label for="publisher">Publisher:</label> >+ <input type="text" id="publisher" name="publisher_filter" value="[% publisher_filter %]" /> >+ </li> >+ <li> >+ <label for="supplier">Supplier:</label> >+ <input type="text" id="supplier" name="supplier_filter" value="[% supplier_filter %]" /> >+ </li> >+ <li> >+ <label for="branch">Branch:</label> >+ <select id="branch" name="branch_filter"> >+ <option value="">All</option> >+ [% FOREACH branch IN branches_loop %] >+ [% IF (branch.selected) %] >+ <option selected="branch.selected" value="[% branch.branchcode %]">[% branch.branchname %]</option> >+ [% ELSE %] >+ <option value="[% branch.branchcode %]">[% branch.branchname %]</option> >+ [% END %] >+ [% END %] >+ </select> >+ </li> >+ </ol> >+ <input type="hidden" name="searched" value="1" /> >+ [% IF (booksellerid) %] >+ <input type="hidden" name="booksellerid" value="[% booksellerid %]" /> >+ [% END %] >+ [% IF (basketno) %] >+ <input type="hidden" name="basketno" value="[% basketno %]" /> >+ [% END %] >+ <fieldset class="action"> >+ <input type="submit" value="Search" /> >+ </fieldset> >+ </div> >+ </fieldset> >+ </form> >+</div> >+ >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt >index 96c6fb6..3ea33c4 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt >@@ -339,47 +339,49 @@ $(document).ready(function() > </fieldset> > [% END %] > >- [% IF (AcqCreateItemOrdering) %] >- >- <div id="items_list" style="display:none"> >- <p><b>Items list</b></p> >- <div style="width:100%;overflow:auto;"> >- <table> >- <thead> >- <tr> >- <th> </th> >- <th> </th> >- <th>Barcode</th> >- <th>Home branch</th> >- <th>Holding branch</th> >- <th>Not for loan</th> >- <th>Restricted</th> >- <th>Location</th> >- <th>Call number</th> >- <th>Copy number</th> >- <th>Stock number</th> >- <th>Collection code</th> >- <th>Item type</th> >- <th>Materials</th> >- <th>Notes</th> >- </tr> >- </thead> >- <tbody> >- </tbody> >- </table> >- </div> >- </div> >- >- <fieldset class="rows" id="itemfieldset"> >- <legend>Item</legend> >- [% IF ( NoACQframework ) %] >- <div class="dialog message">No ACQ framework, using default. You should create a framework with code ACQ, the items framework would be used</div> >- [% END %] >- >- <div id="outeritemblock"></div> >- >- </fieldset> >- [% END %][%# IF (AcqCreateItemOrdering) %] >+ [% UNLESS subscriptionid %][% # it is a suggestion, we have not items %] >+ [% IF (AcqCreateItemOrdering) %] >+ >+ <div id="items_list" style="display:none"> >+ <p><b>Items list</b></p> >+ <div style="width:100%;overflow:auto;"> >+ <table> >+ <thead> >+ <tr> >+ <th> </th> >+ <th> </th> >+ <th>Barcode</th> >+ <th>Home branch</th> >+ <th>Holding branch</th> >+ <th>Not for loan</th> >+ <th>Restricted</th> >+ <th>Location</th> >+ <th>Call number</th> >+ <th>Copy number</th> >+ <th>Stock number</th> >+ <th>Collection code</th> >+ <th>Item type</th> >+ <th>Materials</th> >+ <th>Notes</th> >+ </tr> >+ </thead> >+ <tbody> >+ </tbody> >+ </table> >+ </div> >+ </div> >+ >+ <fieldset class="rows" id="itemfieldset"> >+ <legend>Item</legend> >+ [% IF ( NoACQframework ) %] >+ <div class="dialog message">No ACQ framework, using default. You should create a framework with code ACQ, the items framework would be used</div> >+ [% END %] >+ >+ <div id="outeritemblock"></div> >+ >+ </fieldset> >+ [% END %][%# IF (AcqCreateItemOrdering) %] >+ [% END %][%# UNLESS subscriptionid %] > <fieldset class="rows"> > <legend>Accounting Details</legend> > <ol> >@@ -390,9 +392,17 @@ $(document).ready(function() > [% ELSE %] > <label class="required" for="quantity">Quantity: </label> > [% IF (AcqCreateItemOrdering) %] >- <input type="text" readonly="readonly" size="20" id="quantity" name="quantity" value="0" /> >+ [% IF subscriptionid %] >+ <input type="text" readonly="readonly" size="20" id="quantity" name="quantity" value="1" /> >+ [% ELSE %] >+ <input type="text" readonly="readonly" size="20" id="quantity" name="quantity" value="0" /> >+ [% END %] > [% ELSE %] >- <input type="text" size="20" id="quantity" name="quantity" value="[% quantityrec %]" onchange="updateCosts();" /> >+ [% IF subscriptionid %] >+ <input type="text" readonly="readonly" size="20" id="quantity" name="quantity" value="1" /> >+ [% ELSE %] >+ <input type="text" size="20" id="quantity" name="quantity" value="[% quantityrec %]" onchange="updateCosts();" /> >+ [% END %] > [% END %] > [% END %] > <!-- origquantityrec only here for javascript compatibility (additem.js needs it, useless here, usefull when receiveing an order --> >@@ -560,14 +570,19 @@ $(document).ready(function() > [% END %] > </span> > </li> >-</ol> >+ </ol> > </fieldset> > <fieldset class="action"> >+ <input type="hidden" name="subscriptionid" value="[% subscriptionid %]" /> > <input type="submit" value="Save" /> > [% IF (suggestionid) %] > <a class="cancel" href="/cgi-bin/koha/acqui/newordersuggestion.pl?booksellerid=[% booksellerid %]&basketno=[% basketno %]">Cancel</a> > [% ELSE %] >- <a class="cancel" href="/cgi-bin/koha/acqui/basket.pl?basketno=[% basketno %]">Cancel</a> >+ [% IF subscriptionid %] >+ <a class="cancel" href="/cgi-bin/koha/acqui/newordersubscription.pl?booksellerid=[% booksellerid %]&basketno=[% basketno %]">Cancel</a> >+ [% ELSE %] >+ <a class="cancel" href="/cgi-bin/koha/acqui/basket.pl?basketno=[% basketno %]">Cancel</a> >+ [% END %] > [% END %] > </fieldset> > </form> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/newordersubscription.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/newordersubscription.tt >new file mode 100644 >index 0000000..66369ce >--- /dev/null >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/newordersubscription.tt >@@ -0,0 +1,120 @@ >+[% USE KohaDates %] >+[% INCLUDE 'doc-head-open.inc' %] >+<title>Koha › Serials [% biblionumber %]</title> >+<link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" /> >+[% INCLUDE 'doc-head-close.inc' %] >+<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.dataTables.min.js"></script> >+[% INCLUDE 'datatables-strings.inc' %] >+<script type="text/javascript" src="[% themelang %]/js/datatables.js"></script> >+<script type="text/javascript"> >+//<![CDATA[ >+ function updateRowsVisibility(show_only_renewed) { >+ if ( show_only_renewed ) { >+ $("#srlt [data-reneweddate='']").hide(); >+ } else { >+ $("#srlt > tbody > tr").show(); >+ } >+ } >+ >+ [% IF (dateformat == 'metric') %] >+ dt_add_type_uk_date(); >+ [% END %] >+ $(document).ready(function() { >+ $("#srlt").dataTable($.extend(true, {}, dataTablesDefaults, { >+ "aoColumnDefs": [ >+ { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false }, >+ [% IF (dateformat == 'metric') %] >+ { "aTargets": [ -2 ], "sType": "uk_date" }, >+ [% END %] >+ ], >+ } ) ) >+ >+ $("#show_only_renewed").click(function(){ >+ updateRowsVisibility($(this+":checked").val()); >+ }); >+ $("#show_only_renewed").attr('checked', false); >+ updateRowsVisibility(false); >+ }); >+ //]]> >+</script> >+</head> >+<body> >+[% INCLUDE 'header.inc' %] >+[% INCLUDE 'acquisitions-search.inc' %] >+ >+<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a> › <a href="/cgi-bin/koha/acqui/supplier.pl?supplierid=[% supplierid %]">[% booksellername %]</a> › <a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% basketno %]">Shopping Basket [% basketno %]</a> › Add order from a subscription</div> >+ >+<div id="doc3" class="yui-t2"> >+ <div id="bd"> >+ <div id="yui-main"> >+ <div class="yui-b"> >+ <h2>Serials subscriptions</h2> >+ [% IF (routing) %] >+ <h3>Search for Serial Routing List</h3> >+ [% END %] >+ [% IF (done_searched) %] >+ <label for="show_only_renewed"> >+ <input type="checkbox" style="vertical-align: middle;" id="show_only_renewed" /> >+ Show only renewed >+ </label> >+ [% IF (subs_loop) %] >+ <table id="srlt"> >+ <thead> >+ <tr> >+ <th>ISSN</th> >+ <th>Title</th> >+ <th> Notes </th> >+ <th>Library</th> >+ <th>Call number</th> >+ <th>Expiration date</th> >+ <th></th> >+ </tr> >+ </thead> >+ <tbody> >+ [% FOREACH sub IN subs_loop %] >+ <tr data-reneweddate="[% sub.reneweddate %]" > >+ <td>[% sub.issn %]</td> >+ <td><a href="/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=[% sub.subscriptionid %]" class="button" title="subscription detail">[% IF (sub.title) %][% sub.title |html %][% ELSE %] >+ --- >+ [% END %][% IF (sub.unititle) %], [% sub.unititle %][% END %]</a> >+ </td> >+ <td>[% notes %] >+ [% IF (sub.internalnotes) %]([% sub.internalnotes %])[% END %] >+ </td> >+ <td> >+ [% IF (sub.branchcode) %][% sub.branchcode %][% END %] >+ </td> >+ <td> >+ [% IF (sub.callnumber) %][% sub.callnumber %][% END %] >+ </td> >+ <td> >+ [% IF (sub.enddate) %][% sub.enddate | $KohaDates %][% END %] >+ </td> >+ <td> >+ [% IF (sub.alreadyOnOrder) %] >+ Outstanding order (only one order per subscription is allowed) >+ [% ELSE %] >+ <a href="/cgi-bin/koha/acqui/neworderempty.pl?booksellerid=[% booksellerid %]&basketno=[% basketno %]&biblionumber=[% sub.biblionumber %]&subscriptionid=[% sub.subscriptionid %]" title="Order this one"> >+ Order >+ </a> >+ [% END %] >+ </td> >+ </tr> >+ [% END %] >+ </tbody> >+ </table> >+ [% ELSE %] >+ <p>Sorry, there is no result for your search.</p> >+ [% END %] >+ [% ELSE %] >+ <p>Use the search form on the left to find subscriptions.</p> >+ [% END %] >+ </div> >+ </div> >+ >+ <div class="yui-b"> >+ [% INCLUDE 'subscriptions-search.inc' %] >+ [% INCLUDE 'acquisitions-menu.inc' %] >+ </div> >+</div> >+[% INCLUDE 'intranet-bottom.inc' %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt >index c6559c3..ab8d30d 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt >@@ -197,17 +197,19 @@ > </div> > </div> > >- <fieldset class="rows" id="itemfieldset"> >- <legend>Item</legend> >- [% IF ( NoACQframework ) %] >- <p class="required"> >- No ACQ framework, using default. You should create a >- framework with code ACQ, the items framework would be >- used >- </p> >- [% END %] >- <div id="outeritemblock"></div> >- </fieldset> >+ [% UNLESS subscriptionid %] >+ <fieldset class="rows" id="itemfieldset"> >+ <legend>Item</legend> >+ [% IF ( NoACQframework ) %] >+ <p class="required"> >+ No ACQ framework, using default. You should create a >+ framework with code ACQ, the items framework would be >+ used >+ </p> >+ [% END %] >+ <div id="outeritemblock"></div> >+ </fieldset> >+ [% END %] > [% ELSIF (AcqCreateItem == 'ordering') %] > [% IF (items.size) %] > <h5>Items</h5> >@@ -273,9 +275,9 @@ > <li><label for="bookfund">Budget: </label><span> [% bookfund %] </span></li> > <li><label for="creator">Created by: </label><span> [% IF ( memberfirstname and membersurname ) %][% IF ( memberfirstname ) %][% memberfirstname %][% END %] [% membersurname %][% ELSE %]No name[% END %]</span></li> > <li><label for="quantity_to_receive">Quantity to receive: </label><span class="label"> >- [% IF ( edit ) %] >+ [% IF ( edit and not subscriptionid) %] > <input type="text" id="quantity_to_receive" name="quantity" value="[% quantity %]" /> >- [% ELSE %] >+ [% ELSE%] > <input type="text" readonly="readonly" id="quantity_to_receive" name="quantity" value="[% quantity %]" /> > [% END %] > </span></li> >@@ -286,22 +288,22 @@ > [% IF ( quantityreceived ) %] > [% IF ( edit ) %] > <input type="text" size="20" name="quantityrec" id="quantity" value="[% quantityreceived %]" /> >- <input id="origquantityrec" READONLY type="hidden" name="origquantityrec" value="[% quantityreceived %]" /> >- [% ELSE %] >- [% IF ( items ) %] >- <input READONLY type="text" size="20" name="quantityrec" id="quantity" value="[% quantityreceivedplus1 %]" /> >+ <input id="origquantityrec" readonly="readonly" type="hidden" name="origquantityrec" value="[% quantityreceived %]" /> > [% ELSE %] >- <input type="text" size="20" name="quantityrec" id="quantity" value="[% quantityreceivedplus1 %]" /> >- [% END %] >- <input id="origquantityrec" READONLY type="hidden" name="origquantityrec" value="[% quantityreceived %]" /> >+ [% IF ( items ) %] >+ <input readonly="readonly" type="text" size="20" name="quantityrec" id="quantity" value="[% quantityreceivedplus1 %]" /> >+ [% ELSE %] >+ <input type="text" size="20" name="quantityrec" id="quantity" value="[% quantityreceivedplus1 %]" /> >+ [% END %] >+ <input id="origquantityrec" readonly="readonly" type="hidden" name="origquantityrec" value="[% quantityreceived %]" /> > [% END %] > [% ELSE %] >- [% IF ( items ) %] >- <input type="text" id="quantity" size="20" name="quantityrec" value="1" /> >+ [% IF ( subscriptionid ) %] >+ <input type="text" readonly="readonly" id="quantity" size="20" name="quantityrec" value="1" /> > [% ELSE %] >- <input type="text" size="20" id="quantity" name="quantityrec" value="1" /> >+ <input type="text" id="quantity" size="20" name="quantityrec" value="1" /> > [% END %] >- <input id="origquantityrec" READONLY type="hidden" name="origquantityrec" value="0" /> >+ <input id="origquantityrec" readonly="readonly" type="hidden" name="origquantityrec" value="0" /> > [% END %] > <div id="qtyrecerror" style="display:none"> > <p class="error">Warning, you have entered more items than expected. >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-home.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-home.tt >index eaafc94..4037b45 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-home.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-home.tt >@@ -17,6 +17,7 @@ > </div> > </div> > <div class="yui-b"> >+ [% INCLUDE 'subscriptions-search.inc' %] > [% INCLUDE 'serials-menu.inc' %] > </div> > </div> >diff --git a/serials/serials-search.pl b/serials/serials-search.pl >index ac5d0d3..74190ac 100755 >--- a/serials/serials-search.pl >+++ b/serials/serials-search.pl >@@ -85,7 +85,7 @@ my $branches = GetBranches(); > my @branches_loop; > foreach (sort keys %$branches){ > my $selected = 0; >- $selected = 1 if( $branch eq $_ ); >+ $selected = 1 if( defined $branch and $branch eq $_ ); > push @branches_loop, { > branchcode => $_, > branchname => $branches->{$_}->{'branchname'}, >diff --git a/serials/subscription-detail.pl b/serials/subscription-detail.pl >index f3a50ac..c0cf8a9 100755 >--- a/serials/subscription-detail.pl >+++ b/serials/subscription-detail.pl >@@ -15,10 +15,12 @@ > # with Koha; if not, write to the Free Software Foundation, Inc., > # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. > >-use strict; >-use warnings; >+use Modern::Perl; > use CGI; >+use C4::Acquisition; > use C4::Auth; >+use C4::Bookseller qw/GetBookSellerFromId/; >+use C4::Budgets; > use C4::Koha; > use C4::Dates qw/format_date/; > use C4::Serials; >@@ -121,34 +123,33 @@ if (! $subs->{periodicity}) { > my $default_bib_view = get_default_view(); > > my ( $order, $bookseller, $tmpl_infos ); >-# FIXME = see http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=5335#c52 >-#if ( defined $subscriptionid ) { >-# my $lastOrderNotReceived = GetLastOrderNotReceivedFromSubscriptionid $subscriptionid; >-# my $lastOrderReceived = GetLastOrderReceivedFromSubscriptionid $subscriptionid; >-# if ( defined $lastOrderNotReceived ) { >-# my $basket = GetBasket $lastOrderNotReceived->{basketno}; >-# my $bookseller = GetBookSellerFromId $basket->{booksellerid}; >-# ( $tmpl_infos->{valuegsti_ordered}, $tmpl_infos->{valuegste_ordered} ) = get_value_with_gst_params ( $lastOrderNotReceived->{ecost}, $lastOrderNotReceived->{gstrate}, $bookseller ); >-# $tmpl_infos->{valuegsti_ordered} = sprintf( "%.2f", $tmpl_infos->{valuegsti_ordered} ); >-# $tmpl_infos->{valuegste_ordered} = sprintf( "%.2f", $tmpl_infos->{valuegste_ordered} ); >-# $tmpl_infos->{budget_name_ordered} = GetBudgetName $lastOrderNotReceived->{budget_id}; >-# $tmpl_infos->{basketno} = $lastOrderNotReceived->{basketno}; >-# $tmpl_infos->{ordered_exists} = 1; >-# } >-# if ( defined $lastOrderReceived ) { >-# my $basket = GetBasket $lastOrderReceived->{basketno}; >-# my $bookseller = GetBookSellerFromId $basket->{booksellerid}; >-# ( $tmpl_infos->{valuegsti_spent}, $tmpl_infos->{valuegste_spent} ) = get_value_with_gst_params ( $lastOrderReceived->{unitprice}, $lastOrderReceived->{gstrate}, $bookseller ); >-# $tmpl_infos->{valuegsti_spent} = sprintf( "%.2f", $tmpl_infos->{valuegsti_spent} ); >-# $tmpl_infos->{valuegste_spent} = sprintf( "%.2f", $tmpl_infos->{valuegste_spent} ); >-# $tmpl_infos->{budget_name_spent} = GetBudgetName $lastOrderReceived->{budget_id}; >-# $tmpl_infos->{invoicenumber} = $lastOrderReceived->{booksellerinvoicenumber}; >-# $tmpl_infos->{spent_exists} = 1; >-# } >-#} >+if ( defined $subscriptionid ) { >+ my $lastOrderNotReceived = GetLastOrderNotReceivedFromSubscriptionid $subscriptionid; >+ my $lastOrderReceived = GetLastOrderReceivedFromSubscriptionid $subscriptionid; >+ if ( defined $lastOrderNotReceived ) { >+ my $basket = GetBasket $lastOrderNotReceived->{basketno}; >+ my $bookseller = GetBookSellerFromId $basket->{booksellerid}; >+ ( $tmpl_infos->{valuegsti_ordered}, $tmpl_infos->{valuegste_ordered} ) = get_value_with_gst_params ( $lastOrderNotReceived->{ecost}, $lastOrderNotReceived->{gstrate}, $bookseller ); >+ $tmpl_infos->{valuegsti_ordered} = sprintf( "%.2f", $tmpl_infos->{valuegsti_ordered} ); >+ $tmpl_infos->{valuegste_ordered} = sprintf( "%.2f", $tmpl_infos->{valuegste_ordered} ); >+ $tmpl_infos->{budget_name_ordered} = GetBudgetName $lastOrderNotReceived->{budget_id}; >+ $tmpl_infos->{basketno} = $lastOrderNotReceived->{basketno}; >+ $tmpl_infos->{ordered_exists} = 1; >+ } >+ if ( defined $lastOrderReceived ) { >+ my $basket = GetBasket $lastOrderReceived->{basketno}; >+ my $bookseller = GetBookSellerFromId $basket->{booksellerid}; >+ ( $tmpl_infos->{valuegsti_spent}, $tmpl_infos->{valuegste_spent} ) = get_value_with_gst_params ( $lastOrderReceived->{unitprice}, $lastOrderReceived->{gstrate}, $bookseller ); >+ $tmpl_infos->{valuegsti_spent} = sprintf( "%.2f", $tmpl_infos->{valuegsti_spent} ); >+ $tmpl_infos->{valuegste_spent} = sprintf( "%.2f", $tmpl_infos->{valuegste_spent} ); >+ $tmpl_infos->{budget_name_spent} = GetBudgetName $lastOrderReceived->{budget_id}; >+ $tmpl_infos->{invoicenumber} = $lastOrderReceived->{booksellerinvoicenumber}; >+ $tmpl_infos->{spent_exists} = 1; >+ } >+} > > $template->param( >- subscriptionid => $subscriptionid, >+ subscriptionid => $subscriptionid, > serialslist => \@serialslist, > hasRouting => $hasRouting, > routing => C4::Context->preference("RoutingSerials"), >@@ -168,7 +169,9 @@ $template->param( > default_bib_view => $default_bib_view, > (uc(C4::Context->preference("marcflavour"))) => 1, > show_acquisition_details => defined $tmpl_infos->{ordered_exists} || defined $tmpl_infos->{spent_exists} ? 1 : 0, >- ); >+ basketno => $order->{basketno}, >+ %$tmpl_infos, >+); > > output_html_with_http_headers $query, $cookie, $template->output; > >@@ -186,3 +189,37 @@ sub get_default_view { > } > return 'detail'; > } >+ >+sub get_value_with_gst_params { >+ my $value = shift; >+ my $gstrate = shift; >+ my $bookseller = shift; >+ if ( $bookseller->{listincgst} ) { >+ return ( $value, $value / ( 1 + $gstrate ) ); >+ } else { >+ return ( $value * ( 1 + $gstrate ), $value ); >+ } >+} >+ >+sub get_gste { >+ my $value = shift; >+ my $gstrate = shift; >+ my $bookseller = shift; >+ if ( $bookseller->{invoiceincgst} ) { >+ return $value / ( 1 + $gstrate ); >+ } else { >+ return $value; >+ } >+} >+ >+sub get_gst { >+ my $value = shift; >+ my $gstrate = shift; >+ my $bookseller = shift; >+ if ( $bookseller->{invoiceincgst} ) { >+ return $value / ( 1 + $gstrate ) * $gstrate; >+ } else { >+ return $value * ( 1 + $gstrate ) - $value; >+ } >+} >+ >-- >1.7.10.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 5343
:
13010
|
13011
|
15840
|
16321
|
16482
|
16492
|
16510
|
16624
|
16625
|
16626
|
16641
|
16723
|
16724
|
16725
|
16726
|
16728
|
16733
|
16735
|
16736
|
16737
|
16738
|
16739
|
16748
|
16754
|
16762
|
16764
|
16765
|
16766
|
16767
|
16768
|
16769
|
16770