From 928230d29441605f875a13739871b40688ea4536 Mon Sep 17 00:00:00 2001 From: Jesse Weaver Date: Thu, 28 Jan 2016 15:01:24 -0700 Subject: [PATCH] Bug 15685: Allow creation of items (AcqCreateItem) to be customizable per-basket This adds a new basket attribute (create_items) that can optionally be set to override AcqCreateItem. The following have been modified to reflect this (with the value of create_items that causes them to behave differently in parentheses): * Cancelling receipt of an order (receiving) * Creating an order by hand or from MARC (ordering) * Receiving an order (receiving) * Showing orders with uncertain price (ordering) * Showing orders (receiving) * Showing acquisition details in the OPAC (ordering) Test plan: 1) Create baskets with "Create items when:" set to ordering, receiving, cataloging and unset. 2) Test each of the above for each of these baskets, verifying that the basket-specific attribute overrides AcqCreateItem if set and falls back to the syspref otherwise. NOTE: A check of AcqCreateItem in opac-detail.tt was removed because it was redundant; the code path in question cannot be triggered unless create_items/AcqCreateItems is set to the correct value anyway. --- C4/Acquisition.pm | 24 ++++++---- Koha/Acquisition/Basket.pm | 54 ++++++++++++++++++++++ Koha/Acquisition/Baskets.pm | 51 ++++++++++++++++++++ Koha/Acquisition/Order.pm | 6 +++ acqui/addorder.pl | 5 +- acqui/addorderiso2709.pl | 6 ++- acqui/basket.pl | 1 + acqui/basketheader.pl | 2 + acqui/finishreceive.pl | 7 ++- acqui/neworderempty.pl | 5 +- acqui/orderreceive.pl | 3 +- acqui/parcel.pl | 2 + acqui/uncertainprice.pl | 3 ++ .../bug_15685-add_create_items_to_aqbasket.sql | 1 + installer/data/mysql/kohastructure.sql | 1 + .../intranet-tmpl/prog/en/modules/acqui/basket.tt | 10 ++++ .../prog/en/modules/acqui/basketheader.tt | 17 ++++++- .../intranet-tmpl/prog/en/modules/acqui/parcel.tt | 2 +- .../prog/en/modules/acqui/uncertainprice.tt | 2 +- .../en/modules/admin/preferences/acquisitions.pref | 1 + .../opac-tmpl/bootstrap/en/modules/opac-detail.tt | 4 +- opac/opac-detail.pl | 8 ++-- 22 files changed, 187 insertions(+), 28 deletions(-) create mode 100644 Koha/Acquisition/Basket.pm create mode 100644 Koha/Acquisition/Baskets.pm create mode 100644 installer/data/mysql/atomicupdate/bug_15685-add_create_items_to_aqbasket.sql diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm index 4044556..64e433b 100644 --- a/C4/Acquisition.pm +++ b/C4/Acquisition.pm @@ -188,7 +188,7 @@ sub GetBasket { =head3 NewBasket $basket = &NewBasket( $booksellerid, $authorizedby, $basketname, - $basketnote, $basketbooksellernote, $basketcontractnumber, $deliveryplace, $billingplace ); + $basketnote, $basketbooksellernote, $basketcontractnumber, $deliveryplace, $billingplace, $create_items ); Create a new basket in aqbasket table @@ -207,7 +207,7 @@ The other parameters are optional, see ModBasketHeader for more info on them. sub NewBasket { my ( $booksellerid, $authorisedby, $basketname, $basketnote, $basketbooksellernote, $basketcontractnumber, $deliveryplace, - $billingplace ) = @_; + $billingplace, $create_items ) = @_; my $dbh = C4::Context->dbh; my $query = 'INSERT INTO aqbasket (creationdate,booksellerid,authorisedby) ' @@ -219,7 +219,7 @@ sub NewBasket { $basketnote ||= q{}; $basketbooksellernote ||= q{}; ModBasketHeader( $basket, $basketname, $basketnote, $basketbooksellernote, - $basketcontractnumber, $booksellerid, $deliveryplace, $billingplace ); + $basketcontractnumber, $booksellerid, $deliveryplace, $billingplace, $create_items ); return $basket; } @@ -532,21 +532,24 @@ Modifies a basket's header. =item C<$billingplace> is the "billingplace" field in the aqbasket table. +=item C<$create_items> should be set to 'ordering', 'receiving' or 'cataloguing' (or undef, in which +case the AcqCreateItem syspref takes precedence). + =back =cut sub ModBasketHeader { - my ($basketno, $basketname, $note, $booksellernote, $contractnumber, $booksellerid, $deliveryplace, $billingplace) = @_; + my ($basketno, $basketname, $note, $booksellernote, $contractnumber, $booksellerid, $deliveryplace, $billingplace, $create_items) = @_; my $query = qq{ UPDATE aqbasket - SET basketname=?, note=?, booksellernote=?, booksellerid=?, deliveryplace=?, billingplace=? + SET basketname=?, note=?, booksellernote=?, booksellerid=?, deliveryplace=?, billingplace=?, create_items=? WHERE basketno=? }; my $dbh = C4::Context->dbh; my $sth = $dbh->prepare($query); - $sth->execute($basketname, $note, $booksellernote, $booksellerid, $deliveryplace, $billingplace, $basketno); + $sth->execute($basketname, $note, $booksellernote, $booksellerid, $deliveryplace, $billingplace, $create_items || undef, $basketno); if ( $contractnumber ) { my $query2 ="UPDATE aqbasket SET contractnumber=? WHERE basketno=?"; @@ -1499,6 +1502,7 @@ sub CancelReceipt { my $parent_ordernumber = $order->{'parent_ordernumber'}; my @itemnumbers = GetItemnumbersFromOrder( $ordernumber ); + my $basket = Koha::Acquisition::Order->find( $order->{ordernumber} )->basket; if($parent_ordernumber == $ordernumber || not $parent_ordernumber) { # The order line has no parent, just mark it as not received @@ -1549,7 +1553,7 @@ sub CancelReceipt { " receipt"; return; } - _cancel_items_receipt( $ordernumber, $parent_ordernumber ); + _cancel_items_receipt( $basket->effective_create_items, $ordernumber, $parent_ordernumber ); # Delete order line $query = qq{ DELETE FROM aqorders @@ -1560,7 +1564,7 @@ sub CancelReceipt { } - if(C4::Context->preference('AcqCreateItem') eq 'ordering') { + if( $basket->effective_create_items eq 'ordering' ) { my @affects = split q{\|}, C4::Context->preference("AcqItemSetSubfieldsWhenReceiptIsCancelled"); if ( @affects ) { for my $in ( @itemnumbers ) { @@ -1583,11 +1587,11 @@ sub CancelReceipt { } sub _cancel_items_receipt { - my ( $ordernumber, $parent_ordernumber ) = @_; + my ( $effective_create_items, $ordernumber, $parent_ordernumber ) = @_; $parent_ordernumber ||= $ordernumber; my @itemnumbers = GetItemnumbersFromOrder($ordernumber); - if(C4::Context->preference('AcqCreateItem') eq 'receiving') { + if ( $effective_create_items eq 'receiving' ) { # Remove items that were created at receipt my $query = qq{ DELETE FROM items, aqorders_items diff --git a/Koha/Acquisition/Basket.pm b/Koha/Acquisition/Basket.pm new file mode 100644 index 0000000..6441c36 --- /dev/null +++ b/Koha/Acquisition/Basket.pm @@ -0,0 +1,54 @@ +package Koha::Acquisition::Basket; + +# 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 3 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 Carp; + +use Koha::Database; + +use base qw(Koha::Object); + +=head1 NAME + +Koha::Acquisition::Basket - Koha Basket Object class + +=head1 API + +=head2 Class Methods + +=head3 effective_create_items + +Returns C for this basket, falling back to C if unset. + +=cut + +sub effective_create_items { + my ( $self ) = @_; + + return $self->create_items || C4::Context->preference('AcqCreateItem'); +} + +=head3 type + +=cut + +sub type { + return 'Aqbasket'; +} + +1; diff --git a/Koha/Acquisition/Baskets.pm b/Koha/Acquisition/Baskets.pm new file mode 100644 index 0000000..b262a50 --- /dev/null +++ b/Koha/Acquisition/Baskets.pm @@ -0,0 +1,51 @@ +package Koha::Acquisition::Baskets; + +# 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 3 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 Carp; + +use C4::Context; +use Koha::Database; + +use Koha::Acquisition::Basket; + +use base qw(Koha::Objects); + +=head1 NAME + +Koha::Acquisition::Baskets - Koha Basket Object set class + +=head1 API + +=head2 Class Methods + +=cut + +=head3 type + +=cut + +sub type { + return 'Aqbasket'; +} + +sub object_class { + return 'Koha::Acquisition::Basket'; +} + +1; diff --git a/Koha/Acquisition/Order.pm b/Koha/Acquisition/Order.pm index 15b9867..8bc16f0 100644 --- a/Koha/Acquisition/Order.pm +++ b/Koha/Acquisition/Order.pm @@ -2,6 +2,7 @@ package Koha::Acquisition::Order; use Modern::Perl; +use Koha::Acquisition::Baskets; use Koha::Database; use Koha::DateUtils qw( dt_from_string output_pref ); @@ -65,6 +66,11 @@ sub add_item { $rs->create({ ordernumber => $self->{ordernumber}, itemnumber => $itemnumber }); } +sub basket { + my ( $self ) = @_; + return Koha::Acquisition::Baskets->find( $self->{basketno} ); +} + # TODO Move code from ModItemOrder sub update_item { die "not implemented yet"; diff --git a/acqui/addorder.pl b/acqui/addorder.pl index f58e58d..4b37209 100755 --- a/acqui/addorder.pl +++ b/acqui/addorder.pl @@ -228,6 +228,8 @@ $orderinfo->{'uncertainprice'} ||= 0; $orderinfo->{subscriptionid} ||= undef; my $user = $input->remote_user; +my $basketno=$$orderinfo{basketno}; +my $basket = Koha::Acquisition::Baskets->find( $basketno ); # create, modify or delete biblio # create if $quantity>0 and $existing='no' @@ -277,7 +279,7 @@ if ( $orderinfo->{quantity} ne '0' ) { } # now, add items if applicable - if (C4::Context->preference('AcqCreateItem') eq 'ordering') { + if ($basket->effective_create_items eq 'ordering') { my @tags = $input->param('tag'); my @subfields = $input->param('subfield'); @@ -318,7 +320,6 @@ if ( $orderinfo->{quantity} ne '0' ) { } -my $basketno=$$orderinfo{basketno}; my $booksellerid=$$orderinfo{booksellerid}; if (my $import_batch_id=$$orderinfo{import_batch_id}) { print $input->redirect("/cgi-bin/koha/acqui/addorderiso2709.pl?import_batch_id=$import_batch_id&basketno=$basketno&booksellerid=$booksellerid"); diff --git a/acqui/addorderiso2709.pl b/acqui/addorderiso2709.pl index 8ce2ce1..917ff90 100755 --- a/acqui/addorderiso2709.pl +++ b/acqui/addorderiso2709.pl @@ -43,6 +43,7 @@ use C4::Branch; # GetBranches use C4::Members; use Koha::Number::Price; +use Koha::Acquisition::Baskets; use Koha::Acquisition::Order; use Koha::Acquisition::Bookseller; @@ -76,6 +77,7 @@ if ($cgiparams->{'import_batch_id'} && $op eq ""){ if (! $cgiparams->{'basketno'}){ die "Basketnumber required to order from iso2709 file import"; } +my $basket = Koha::Acquisition::Baskets->find( $cgiparams->{basketno} ); # # 1st step = choose the file to import into acquisition @@ -126,7 +128,7 @@ if ($op eq ""){ "allmatch" => $allmatch, ); import_biblios_list($template, $cgiparams->{'import_batch_id'}); - if ( C4::Context->preference('AcqCreateItem') eq 'ordering' ) { + if ( $basket->effective_create_items eq 'ordering' ) { # prepare empty item form my $cell = PrepareItemrecordDisplay( '', '', '', 'ACQ' ); @@ -266,7 +268,7 @@ if ($op eq ""){ # 4th, add items if applicable # parse the item sent by the form, and create an item just for the import_record_id we are dealing with # this is not optimised, but it's working ! - if ( C4::Context->preference('AcqCreateItem') eq 'ordering' ) { + if ( $basket->effective_create_items eq 'ordering' ) { my @tags = $input->param('tag'); my @subfields = $input->param('subfield'); my @field_values = $input->param('field_value'); diff --git a/acqui/basket.pl b/acqui/basket.pl index 5fa94f8..7a6aadd 100755 --- a/acqui/basket.pl +++ b/acqui/basket.pl @@ -357,6 +357,7 @@ if ( $op eq 'delete_confirm' ) { } $template->param( + basket => $basket, basketno => $basketno, basketname => $basket->{'basketname'}, basketbranchname => C4::Branch::GetBranchName($basket->{branch}), diff --git a/acqui/basketheader.pl b/acqui/basketheader.pl index a4ef0b9..dc535ef 100755 --- a/acqui/basketheader.pl +++ b/acqui/basketheader.pl @@ -148,6 +148,7 @@ if ( $op eq 'add_form' ) { $input->param('basketbooksellerid'), $input->param('deliveryplace'), $input->param('billingplace'), + $input->param('create_items'), ); } else { #New basket $basketno = NewBasket( @@ -159,6 +160,7 @@ if ( $op eq 'add_form' ) { $input->param('basketcontractnumber') || undef, $input->param('deliveryplace'), $input->param('billingplace'), + $input->param('create_items'), ); } print $input->redirect('basket.pl?basketno='.$basketno); diff --git a/acqui/finishreceive.pl b/acqui/finishreceive.pl index cc022b3..e0deb8c 100755 --- a/acqui/finishreceive.pl +++ b/acqui/finishreceive.pl @@ -33,6 +33,7 @@ use C4::Items; use C4::Search; use Koha::Acquisition::Bookseller; +use Koha::Acquisition::Order; use List::MoreUtils qw/any/; @@ -61,10 +62,12 @@ my $bookfund = $input->param("bookfund"); my $order = GetOrder($ordernumber); my $new_ordernumber = $ordernumber; +my $basket = Koha::Acquisition::Order->find($ordernumber)->basket; + #need old recievedate if we update the order, parcel.pl only shows the right parcel this way FIXME if ($quantityrec > $origquantityrec ) { my @received_items = (); - if(C4::Context->preference('AcqCreateItem') eq 'ordering') { + if ($basket->effective_create_items eq 'ordering') { @received_items = $input->param('items_to_receive'); my @affects = split q{\|}, C4::Context->preference("AcqItemSetSubfieldsWhenReceived"); if ( @affects ) { @@ -120,7 +123,7 @@ if ($quantityrec > $origquantityrec ) { } # now, add items if applicable - if (C4::Context->preference('AcqCreateItem') eq 'receiving') { + if ($basket->effective_create_items eq 'receiving') { my @tags = $input->param('tag'); my @subfields = $input->param('subfield'); diff --git a/acqui/neworderempty.pl b/acqui/neworderempty.pl index efd6648..77b48c5 100755 --- a/acqui/neworderempty.pl +++ b/acqui/neworderempty.pl @@ -129,6 +129,7 @@ if(!$basketno) { } our $basket = GetBasket($basketno); +my $basketobj = Koha::Acquisition::Baskets->find( $basketno ); $booksellerid = $basket->{booksellerid} unless $booksellerid; my $bookseller = Koha::Acquisition::Bookseller->fetch({ id => $booksellerid }); @@ -291,7 +292,7 @@ if ($close) { $template->param( sort1 => $data->{'sort1'} ); $template->param( sort2 => $data->{'sort2'} ); -if (C4::Context->preference('AcqCreateItem') eq 'ordering' && !$ordernumber) { +if ($basketobj->effective_create_items eq 'ordering' && !$ordernumber) { # Check if ACQ framework exists my $marc = GetMarcStructure(1, 'ACQ'); unless($marc) { @@ -403,7 +404,7 @@ $template->param( barcode_subfield => $barcode_subfield, import_batch_id => $import_batch_id, subscriptionid => $subscriptionid, - acqcreate => C4::Context->preference("AcqCreateItem") eq "ordering" ? 1 : "", + acqcreate => $basketobj->effective_create_items eq "ordering" ? 1 : "", users_ids => join(':', @order_user_ids), users => \@order_users, (uc(C4::Context->preference("marcflavour"))) => 1 diff --git a/acqui/orderreceive.pl b/acqui/orderreceive.pl index a75a624..06f919d 100755 --- a/acqui/orderreceive.pl +++ b/acqui/orderreceive.pl @@ -110,6 +110,7 @@ unless ( $results and @$results) { # prepare the form for receiving my $order = $results->[0]; +my $basket = Koha::Acquisition::Order->find($ordernumber)->basket; # Check if ACQ framework exists my $acq_fw = GetMarcStructure(1, 'ACQ'); @@ -117,7 +118,7 @@ unless($acq_fw) { $template->param('NoACQframework' => 1); } -my $AcqCreateItem = C4::Context->preference('AcqCreateItem'); +my $AcqCreateItem = $basket->effective_create_items; if ($AcqCreateItem eq 'receiving') { $template->param( AcqCreateItemReceiving => 1, diff --git a/acqui/parcel.pl b/acqui/parcel.pl index 6dee09a..3eeb873 100755 --- a/acqui/parcel.pl +++ b/acqui/parcel.pl @@ -67,6 +67,7 @@ use C4::Output; use C4::Suggestions; use C4::Reserves qw/GetReservesFromBiblionumber/; +use Koha::Acquisition::Baskets; use Koha::Acquisition::Bookseller; use Koha::DateUtils; @@ -265,6 +266,7 @@ unless( defined $invoice->{closedate} ) { $line{left_holds_on_order} = 1 if $line{left_holds}==1 && ($line{items} == 0 || $itemholds ); $line{holds} = $holds; $line{holds_on_order} = $itemholds?$itemholds:$holds if $line{left_holds_on_order}; + $line{basket} = Koha::Acquisition::Baskets->find( $line{basketno} ); my $budget_name = GetBudgetName( $line{budget_id} ); $line{budget_name} = $budget_name; diff --git a/acqui/uncertainprice.pl b/acqui/uncertainprice.pl index a90c75f..5d9332b 100755 --- a/acqui/uncertainprice.pl +++ b/acqui/uncertainprice.pl @@ -54,6 +54,7 @@ use C4::Bookseller::Contact; use C4::Acquisition qw/SearchOrders GetOrder ModOrder/; use C4::Biblio qw/GetBiblioData/; +use Koha::Acquisition::Baskets; use Koha::Acquisition::Bookseller; my $input=new CGI; @@ -73,6 +74,8 @@ my $op = $input->param('op'); my $owner = $input->param('owner') || 0 ; # flag to see only "my" orders, or everyone orders my $bookseller = Koha::Acquisition::Bookseller->fetch({ id => $booksellerid }); +$template->param( basket => Koha::Acquisition::Baskets->find($basketno) ); + #show all orders that have uncertain price for the bookseller my $pendingorders = SearchOrders({ booksellerid => $booksellerid, diff --git a/installer/data/mysql/atomicupdate/bug_15685-add_create_items_to_aqbasket.sql b/installer/data/mysql/atomicupdate/bug_15685-add_create_items_to_aqbasket.sql new file mode 100644 index 0000000..145e6d4 --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_15685-add_create_items_to_aqbasket.sql @@ -0,0 +1 @@ +ALTER TABLE aqbasket ADD COLUMN create_items ENUM('ordering', 'receiving', 'cataloguing') DEFAULT NULL; diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index b98b017..b5c2687 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -2859,6 +2859,7 @@ CREATE TABLE `aqbasket` ( -- stores data about baskets in acquisitions `basketgroupid` int(11), -- links this basket to its group (aqbasketgroups.id) `deliveryplace` varchar(10) default NULL, -- basket delivery place `billingplace` varchar(10) default NULL, -- basket billing place + create_items ENUM('ordering', 'receiving', 'cataloguing') default NULL; -- when items should be created for orders in this basket branch varchar(10) default NULL, -- basket branch PRIMARY KEY (`basketno`), KEY `booksellerid` (`booksellerid`), diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt index 00f001b..36957ed 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt @@ -306,6 +306,16 @@ [% IF ( creationdate ) %]
  • Opened on: [% creationdate | $KohaDates %]
  • [% END %] [% IF ( closedate ) %]
  • Closed on: [% closedate | $KohaDates %]
  • [% END %] [% IF ( estimateddeliverydate ) %]
  • Estimated delivery date: [% estimateddeliverydate | $KohaDates %]
  • [% END %] + [% IF basket.create_items %] +
  • + Create items when: + [% SWITCH basket.create_items %] + [% CASE 'receiving' %]Receiving items + [% CASE 'cataloguing' %]Cataloguing items + [% CASE %]Placing orders + [% END %] +
  • + [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketheader.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketheader.tt index 84b318c..0a87b17 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketheader.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketheader.tt @@ -41,7 +41,7 @@ [% IF ( basketno ) %]
  • - +
  • [% END %]
  • @@ -113,6 +113,21 @@
  • [% END %] + [% UNLESS basketno %] +
  • + + +
  • + [% END %]
    diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt index 1d942d5..7efa87e 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt @@ -418,7 +418,7 @@ [% order.unitprice | $Price %] [% order.total | $Price %] - [% IF loop_receive.cannot_cancel or ( Koha.Preference("AcqCreateItem") == "receiving" and loop_receive.holds > 0 ) %] + [% IF loop_receive.cannot_cancel or ( order.basket.effective_create_items == "receiving" and loop_receive.holds > 0 ) %] [% IF loop_receive.cannot_cancel %] [% span_title = BLOCK %] Cannot cancel receipt of this order line because it diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/uncertainprice.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/uncertainprice.tt index df50898..e1fd98b 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/uncertainprice.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/uncertainprice.tt @@ -127,7 +127,7 @@ function check(form) { - [% IF Koha.Preference('AcqCreateItem') == 'ordering' %] + [% IF basket.effective_create_items == 'ordering' %] [% uncertainpriceorder.quantity %] [% ELSE %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/acquisitions.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/acquisitions.pref index 0c924b4..261f949 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/acquisitions.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/acquisitions.pref @@ -8,6 +8,7 @@ Acquisitions: ordering: placing an order. receiving: receiving an order. cataloguing: cataloging the record. + - This is only the default behavior, and can be changed per-basket. - - "The following database columns should be unique in an item:" - pref: UniqueItemFields diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt index b9ab8cb..070f03f 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt @@ -651,7 +651,7 @@

    This record has many physical items ([% items_count %]). Click here to view them all.

    [% ELSIF ( itemloop.size ) %] [% INCLUDE items_table items=itemloop tab="holdings" %] - [% IF Koha.Preference('OPACAcquisitionDetails') and Koha.Preference('AcqCreateItem') != 'ordering' and acquisition_details.total_quantity > 0 %] + [% IF Koha.Preference('OPACAcquisitionDetails') and acquisition_details.total_quantity > 0 %] [% IF acquisition_details.total_quantity == 1 %] 1 item is on order. [% ELSE %] @@ -678,7 +678,7 @@
    Holdings: [% ALTERNATEHOLDING.holding %]
    [% END %] [% ELSE %] - [% IF Koha.Preference('OPACAcquisitionDetails') and Koha.Preference('AcqCreateItem') != 'ordering' and acquisition_details.total_quantity > 0 %] + [% IF Koha.Preference('OPACAcquisitionDetails') and acquisition_details.total_quantity > 0 %] [% IF acquisition_details.total_quantity == 1 %] 1 item is on order. [% ELSE %] diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl index 6d71bed..ed60eb6 100755 --- a/opac/opac-detail.pl +++ b/opac/opac-detail.pl @@ -52,6 +52,7 @@ use Koha::DateUtils; use C4::HTML5Media; use C4::CourseReserves qw(GetItemCourseReservesInfo); +use Koha::Acquisition::Order; use Koha::Virtualshelves; BEGIN { @@ -604,7 +605,8 @@ if ( C4::Context->preference('OPACAcquisitionDetails' ) ) { }); my $total_quantity = 0; for my $order ( @$orders ) { - if ( C4::Context->preference('AcqCreateItem') eq 'ordering' ) { + my $basket = Koha::Acquisition::Order->find( $order->{ordernumber} )->basket; + if ( $basket->effective_create_items eq 'ordering' ) { for my $itemnumber ( C4::Acquisition::GetItemnumbersFromOrder( $order->{ordernumber} ) ) { push @itemnumbers_on_order, $itemnumber; } @@ -674,9 +676,7 @@ if ( not $viewallitems and @items > $max_items_to_display ) { $itm->{transfertto} = $branches->{$transfertto}{branchname}; } - if ( C4::Context->preference('OPACAcquisitionDetails') - and C4::Context->preference('AcqCreateItem') eq 'ordering' ) - { + if ( C4::Context->preference('OPACAcquisitionDetails') ) { $itm->{on_order} = 1 if grep /^$itm->{itemnumber}$/, @itemnumbers_on_order; } -- 2.6.2