Bugzilla – Attachment 67884 Details for
Bug 15685
Allow creation of items (AcqCreateItem) to be customizable per-basket
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 15685: Followup - address QA issues
-Bug-15685-Followup---address-QA-issues.patch (text/plain), 9.93 KB, created by
Nick Clemens (kidclamp)
on 2017-10-10 15:50:03 UTC
(
hide
)
Description:
Bug 15685: Followup - address QA issues
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2017-10-10 15:50:03 UTC
Size:
9.93 KB
patch
obsolete
>From 9bbab6ee1222ea6cf35188b8f702479943a69d1f Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Tue, 10 Oct 2017 12:11:14 +0000 >Subject: [PATCH] Bug 15685: Followup - address QA issues > >--- > C4/Acquisition.pm | 4 ++-- > Koha/Acquisition/Order.pm | 3 ++- > Koha/EDI.pm | 4 +++- > acqui/addorderiso2709.pl | 6 ++---- > acqui/basket.pl | 1 - > circ/reserveratios.pl | 15 +++++++++++++-- > installer/data/mysql/atomicupdate/bug15685.perl | 10 ++++++---- > .../intranet-tmpl/prog/en/modules/acqui/basketheader.tt | 14 +++++++------- > t/db_dependent/Acquisition/CancelReceipt.t | 2 +- > 9 files changed, 36 insertions(+), 23 deletions(-) > >diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm >index 70dd409..4d12bc7 100644 >--- a/C4/Acquisition.pm >+++ b/C4/Acquisition.pm >@@ -1590,7 +1590,7 @@ sub CancelReceipt { > my $parent_ordernumber = $order->{'parent_ordernumber'}; > > my @itemnumbers = GetItemnumbersFromOrder( $ordernumber ); >- my $basket = Koha::Acquisition::Order->find( $order->{ordernumber} )->basket; >+ my $basket = Koha::Acquisition::Orders->find({ordernumber => $ordernumber})->basket; > > if($parent_ordernumber == $ordernumber || not $parent_ordernumber) { > # The order line has no parent, just mark it as not received >@@ -1604,7 +1604,7 @@ sub CancelReceipt { > }; > $sth = $dbh->prepare($query); > $sth->execute(0, undef, undef, $ordernumber); >- _cancel_items_receipt( $ordernumber ); >+ _cancel_items_receipt( $basket->effective_create_items, $ordernumber ); > } else { > # The order line has a parent, increase parent quantity and delete > # the order line. >diff --git a/Koha/Acquisition/Order.pm b/Koha/Acquisition/Order.pm >index bbad104..1c52497 100644 >--- a/Koha/Acquisition/Order.pm >+++ b/Koha/Acquisition/Order.pm >@@ -109,7 +109,8 @@ Returns the basket associated to the order. > > sub basket { > my ( $self ) = @_; >- return Koha::Acquisition::Baskets->find( $self->basketno ); >+ my $basket_rs = $self->_result->basketno; >+ return Koha::Acquisition::Basket->_new_from_dbic( $basket_rs ); > } > > =head2 Internal methods >diff --git a/Koha/EDI.pm b/Koha/EDI.pm >index 1a15507..bad68d1 100644 >--- a/Koha/EDI.pm >+++ b/Koha/EDI.pm >@@ -797,7 +797,9 @@ sub quote_item { > ); > } > >- if ( C4::Context->preference('AcqCreateItem') eq 'ordering' ) { >+ my $basket = Koha::Acquisition::Basket->find( $basketno ); >+ >+ if ( $basket->effective_create_item eq 'ordering' ) { > my $new_item = { > notforloan => -1, > cn_sort => q{}, >diff --git a/acqui/addorderiso2709.pl b/acqui/addorderiso2709.pl >index 8e8929c..cc5d222 100755 >--- a/acqui/addorderiso2709.pl >+++ b/acqui/addorderiso2709.pl >@@ -103,8 +103,7 @@ if ($op eq ""){ > "allmatch" => $allmatch, > ); > import_biblios_list($template, $cgiparams->{'import_batch_id'}); >- my $basket = GetBasket($cgiparams->{basketno}); >- if ( $basket->effective_create_items eq 'ordering' && !$basket->{is_standing} ) { >+ if ( $basket->effective_create_items eq 'ordering' && !$basket->is_standing ) { > # prepare empty item form > my $cell = PrepareItemrecordDisplay( '', '', '', 'ACQ' ); > >@@ -382,8 +381,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 ! >- my $basket = GetBasket($cgiparams->{basketno}); >- if ( $basket->effective_create_items eq 'ordering' && !$basket->{is_standing} ) { >+ if ( $basket->effective_create_items eq 'ordering' && !$basket->is_standing ) { > my @tags = $input->multi_param('tag'); > my @subfields = $input->multi_param('subfield'); > my @field_values = $input->multi_param('field_value'); >diff --git a/acqui/basket.pl b/acqui/basket.pl >index 0e8ac5c..1f97d18 100755 >--- a/acqui/basket.pl >+++ b/acqui/basket.pl >@@ -390,7 +390,6 @@ if ( $op eq 'list' ) { > } > > $template->param( >- basket => $basket, > basketno => $basketno, > basket => $basket, > basketname => $basket->{'basketname'}, >diff --git a/circ/reserveratios.pl b/circ/reserveratios.pl >index e7c28c7..5d87cd1 100755 >--- a/circ/reserveratios.pl >+++ b/circ/reserveratios.pl >@@ -31,6 +31,7 @@ use C4::Debug; > use C4::Biblio qw/GetMarcBiblio GetRecordValue GetFrameworkCode/; > use C4::Acquisition qw/GetOrdersByBiblionumber/; > use Koha::DateUtils; >+use Koha::Acquisition::Baskets; > > my $input = new CGI; > my $startdate = $input->param('from'); >@@ -55,6 +56,16 @@ if ($booksellerid && $basketno) { > $template->param( booksellerid => $booksellerid, basketno => $basketno ); > } > >+my $effective_create_items; >+if ( $basketno ){ >+ my $basket = Koha::Acquisition::Baskets->find( $basketno ); >+ if ($basket){ >+ $effective_create_items = $basket->effective_create_items; >+ } else { >+ $effective_create_items = C4::Context->preference('AcqCreateItem'); >+ } >+} >+ > $startdate = eval { dt_from_string( $startdate ) } if $startdate; > $enddate = eval { dt_from_string( $enddate ) } if $enddate; > >@@ -84,12 +95,12 @@ $sqldatewhere .= " AND reservedate <= ?"; > push @query_params, output_pref({ dt => $enddate, dateformat => 'iso' }); > > my $include_aqorders_qty = >- C4::Context->preference('AcqCreateItem') eq 'receiving' >+ $effective_create_items eq 'receiving' > ? '+ COALESCE(aqorders.quantity, 0) - COALESCE(aqorders.quantityreceived, 0)' > : q{}; > > my $include_aqorders_qty_join = >- C4::Context->preference('AcqCreateItem') eq 'receiving' >+ $effective_create_items eq 'receiving' > ? 'LEFT JOIN aqorders ON reserves.biblionumber=aqorders.biblionumber' > : q{}; > >diff --git a/installer/data/mysql/atomicupdate/bug15685.perl b/installer/data/mysql/atomicupdate/bug15685.perl >index 8c66878..7721df5 100644 >--- a/installer/data/mysql/atomicupdate/bug15685.perl >+++ b/installer/data/mysql/atomicupdate/bug15685.perl >@@ -1,10 +1,12 @@ > $DBversion = 'XXX'; # will be replaced by the RM > if( CheckVersion( $DBversion ) ) { > >- $dbh->do(q{ >- ALTER TABLE aqbasket >- ADD COLUMN create_items ENUM('ordering', 'receiving', 'cataloguing') default NULL >- }); >+ unless( column_exists('aqbasket','create_items') ){ >+ $dbh->do(q{ >+ ALTER TABLE aqbasket >+ ADD COLUMN create_items ENUM('ordering', 'receiving', 'cataloguing') default NULL >+ }); >+ } > > SetVersion( $DBversion ); > print "Upgrade to $DBversion done (Bug 15685: Allow creation of items (AcqCreateItem) to be customizable per-basket)\n"; >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 9fc7786..13917cf 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketheader.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketheader.tt >@@ -43,7 +43,7 @@ > [% IF ( basketno ) %] > <li> > <input type="hidden" name="basketno" value="[% basketno %]" /> >- <input type="hidden" name="rs_an_edit" value="1" /> >+ <input type="hidden" name="is_an_edit" value="1" /> > </li> > [% END %] > <li> >@@ -113,13 +113,13 @@ > <label for="create_items">Create items when:</label> > <select name="create_items" id="create_items"> > [% SWITCH Koha.Preference('AcqCreateItem') %] >- [% CASE 'receiving' %]<option value="">use default (receiving an order).</option> >- [% CASE 'cataloguing' %]<option value="">use default (cataloging the record).</option> >- [% CASE %]<option value="">use default (placing an order).</option> >+ [% CASE 'receiving' %]<option value="">use default (receiving an order)</option> >+ [% CASE 'cataloguing' %]<option value="">use default (cataloging the record)</option> >+ [% CASE %]<option value="">use default (placing an order)</option> > [% END %] >- <option value="ordering">placing an order.</option> >- <option value="receiving">receiving an order.</option> >- <option value="cataloguing">cataloging the record.</option> >+ <option value="ordering">placing an order</option> >+ <option value="receiving">receiving an order</option> >+ <option value="cataloguing">cataloging the record</option> > </select> > </li> > [% END %] >diff --git a/t/db_dependent/Acquisition/CancelReceipt.t b/t/db_dependent/Acquisition/CancelReceipt.t >index 20290da..3b650b0 100644 >--- a/t/db_dependent/Acquisition/CancelReceipt.t >+++ b/t/db_dependent/Acquisition/CancelReceipt.t >@@ -49,6 +49,7 @@ my $bookseller = Koha::Acquisition::Bookseller->new( > active => 1 > } > )->store; >+t::lib::Mocks::mock_preference('AcqCreateItem', 'receiving'); > > my $basketno1 = C4::Acquisition::NewBasket( > $bookseller->id >@@ -66,7 +67,6 @@ my $budget = C4::Budgets::GetBudget( $budgetid ); > my ($biblionumber, $biblioitemnumber) = AddBiblio(MARC::Record->new, ''); > my $itemnumber = AddItem( { itype => $itemtype }, $biblionumber ); > >-t::lib::Mocks::mock_preference('AcqCreateItem', 'receiving'); > my $order = Koha::Acquisition::Order->new( > { > basketno => $basketno1, >-- >2.1.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 15685
:
47783
|
55094
|
55096
|
57390
|
57392
|
57395
|
57424
|
57425
|
57426
|
57427
|
64918
|
64919
|
64920
|
64921
|
64922
|
65119
|
65120
|
65121
|
65122
|
65895
|
65896
|
65897
|
65898
|
65899
|
65900
|
66119
|
66120
|
66121
|
66122
|
66123
|
66124
|
67638
|
67639
|
67640
|
67641
|
67642
|
67643
|
67644
|
67645
|
67646
|
67647
|
67689
|
67690
|
67691
|
67692
|
67693
|
67694
|
67695
|
67696
|
67697
|
67698
|
67884
|
67898
|
67899
|
67900
|
67901
|
67902
|
67903
|
67904
|
67905
|
67906
|
67907
|
67908
|
67909
|
67910
|
67911