Bugzilla – Attachment 79837 Details for
Bug 21467
Allow several receipts for a given subscription
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 21467: Do not erase the internal note of the first order
Bug-21467-Do-not-erase-the-internal-note-of-the-fi.patch (text/plain), 5.32 KB, created by
Jonathan Druart
on 2018-10-02 16:51:17 UTC
(
hide
)
Description:
Bug 21467: Do not erase the internal note of the first order
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2018-10-02 16:51:17 UTC
Size:
5.32 KB
patch
obsolete
>From 243371290b6ee1f45125ec1ece6dbf4fd8ac1059 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 2 Oct 2018 13:31:20 -0300 >Subject: [PATCH] Bug 21467: Do not erase the internal note of the first order > >For the subscription we would like to keep the original internal note >(from the first order), to display it unmodified each time we receive >issues. >--- > C4/Acquisition.pm | 7 +++++-- > acqui/orderreceive.pl | 15 ++++++++++++--- > t/db_dependent/Acquisition.t | 41 ++++++++++++++++++++++++++++++++++++++++- > 3 files changed, 57 insertions(+), 6 deletions(-) > >diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm >index d635a49e79..67ba8f4301 100644 >--- a/C4/Acquisition.pm >+++ b/C4/Acquisition.pm >@@ -1460,16 +1460,19 @@ sub ModReceiveOrder { > UPDATE aqorders > SET quantity = ?, > orderstatus = 'partial'|; >- $query .= q|, order_internalnote = ?| if defined $order->{order_internalnote}; > $query .= q| WHERE ordernumber = ?|; > my $sth = $dbh->prepare($query); > > $sth->execute( > ( $is_standing ? 1 : ($order->{quantity} - $quantrec) ), >- ( defined $order->{order_internalnote} ? $order->{order_internalnote} : () ), > $order->{ordernumber} > ); > >+ if ( not $order->{subscriptionid} && defined $order->{order_internalnote} ) { >+ $dbh->do(q|UPDATE aqorders >+ SET order_internalnote = ?|, {}, $order->{order_internalnote}); >+ } >+ > # Recalculate tax_value > $dbh->do(q| > UPDATE aqorders >diff --git a/acqui/orderreceive.pl b/acqui/orderreceive.pl >index 41fda545fa..ae86edb28d 100755 >--- a/acqui/orderreceive.pl >+++ b/acqui/orderreceive.pl >@@ -194,6 +194,8 @@ my @gst_values = map { > option => $_ + 0.0 > }, split( '\|', C4::Context->preference("gist") ); > >+my $order_internalnote = $order->{order_internalnote}; >+my $order_vendornote = $order->{order_vendornote}; > if ( $order->{subscriptionid} ) { > # Order from a subscription, we will display an history of what has been received > my $orders = Koha::Acquisition::Orders->search( >@@ -203,7 +205,14 @@ if ( $order->{subscriptionid} ) { > ordernumber => { '!=' => $order->{ordernumber} } > } > ); >- $template->param( orders => $orders ); >+ if ( $order->{parent_ordernumber} != $order->{ordernumber} ) { >+ my $parent_order = Koha::Acquisition::Orders->find($order->{parent_ordernumber}); >+ $order_internalnote = $parent_order->{order_internalnote}; >+ $order_vendornote = $parent_order->{order_vendornote}; >+ } >+ $template->param( >+ orders => $orders, >+ ); > } > > $template->param( >@@ -233,8 +242,8 @@ $template->param( > invoiceid => $invoice->{invoiceid}, > invoice => $invoice->{invoicenumber}, > datereceived => $datereceived, >- order_internalnote => $order->{order_internalnote}, >- order_vendornote => $order->{order_vendornote}, >+ order_internalnote => $order_internalnote, >+ order_vendornote => $order_vendornote, > suggestionid => $suggestion->{suggestionid}, > surnamesuggestedby => $suggestion->{surnamesuggestedby}, > firstnamesuggestedby => $suggestion->{firstnamesuggestedby}, >diff --git a/t/db_dependent/Acquisition.t b/t/db_dependent/Acquisition.t >index 04687eb7a7..568f7e613b 100755 >--- a/t/db_dependent/Acquisition.t >+++ b/t/db_dependent/Acquisition.t >@@ -19,7 +19,7 @@ use Modern::Perl; > > use POSIX qw(strftime); > >-use Test::More tests => 70; >+use Test::More tests => 71; > use t::lib::Mocks; > use Koha::Database; > >@@ -708,4 +708,43 @@ subtest 'ModReceiveOrder replacementprice tests' => sub { > is ($received_order->{replacementprice},'16.120000',"Replacement price set if none passed in"); > }; > >+subtest 'ModReceiveOrder and subscription' => sub { >+ plan tests => 2; >+ >+ my $builder = t::lib::TestBuilder->new; >+ my $first_note = 'first note'; >+ my $second_note = 'second note'; >+ my $subscription = $builder->build_object( { class => 'Koha::Subscriptions' } ); >+ my $order = $builder->build_object( >+ { >+ class => 'Koha::Acquisition::Orders', >+ value => { >+ subscriptionid => $subscription->subscriptionid, >+ order_internalnote => $first_note, >+ quantity => 5, >+ quantityreceived => 0, >+ } >+ } >+ ); >+ my $order_info = $order->unblessed; >+ # We do not want the note from the original note to be modified >+ # Keeping it will permit to display it for future receptions >+ $order_info->{order_internalnote} = $second_note; >+ my ( undef, my $received_ordernumber ) = ModReceiveOrder( >+ { >+ biblionumber => $order->biblionumber, >+ order => $order_info, >+ invoice => $order->{invoiceid}, >+ quantityreceived => 1, >+ budget_id => $order->budget_id, >+ } >+ ); >+ my $received_order = Koha::Acquisition::Orders->find($received_ordernumber); >+ is( $received_order->order_internalnote, >+ $second_note, "No price set if none passed in" ); >+ >+ $order->get_from_storage; >+ is( $order->get_from_storage->order_internalnote, $first_note ); >+}; >+ > $schema->storage->txn_rollback(); >-- >2.11.0
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 21467
:
79801
|
79802
|
79834
|
79835
|
79836
|
79837
|
79838
|
80546
|
80706
|
80707
|
80717
|
80718
|
80719
|
80720
|
80721
|
80722
|
80723
|
80724
|
81394
|
81395
|
81396
|
81397
|
81398
|
81399
|
81400
|
81430
|
81797
|
81798
|
81799
|
81800
|
81801
|
81802
|
81803
|
81804
|
81805
|
81806
|
81807
|
81808
|
81809
|
81810
|
81811
|
82117
|
82122
|
82123
|
82124
|
82125
|
82126
|
82127
|
82128
|
82129
|
82130
|
82131
|
82132