Bugzilla – Attachment 78862 Details for
Bug 10869
Can't cancel order line if title deleted
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 10869: Allow the deletion of order line if the record is deleted
Bug-10869-Allow-the-deletion-of-order-line-if-the-.patch (text/plain), 5.92 KB, created by
Chris Cormack
on 2018-09-15 17:28:17 UTC
(
hide
)
Description:
Bug 10869: Allow the deletion of order line if the record is deleted
Filename:
MIME Type:
Creator:
Chris Cormack
Created:
2018-09-15 17:28:17 UTC
Size:
5.92 KB
patch
obsolete
>From f9fad6c5a61464b00edeece35492c4987b04cd31 Mon Sep 17 00:00:00 2001 >From: Mathieu Saby <mathieu.saby@univ-rennes2.fr> >Date: Sat, 14 Sep 2013 12:28:21 +0200 >Subject: [PATCH] Bug 10869: Allow the deletion of order line if the record is > deleted > >This patch fixes 2 issues : >(medium issue) It is not possible to delete an order in a basket if the biblio record is deleted. >(minor issue) There is a useless hyperlink around "Deleted bibliographic notice", and "notice" is a frenchism for "record" > >Biblionumber was passed to the function as 1st parameter, which made impossible to suppress an order whose associated biblio record was suppressed. >Moreover, the biblionumber is not needed to get and suppress the order, but only to suppress items, in a second step. > >Change made to Acquisitions::DelOrder: >- I changed the order of the 2 parameters: now $ordernumber as 1st parameter and $biblionumber as 2d parameter >- I renamed $bibnum to $biblionumber >- I removed $biblionumber from the main SQL query of the function >- I suppressed useless $sth->finish >- if no $biblionumber is provided, Koha does not try to suppress the items linked created by acq process > >Change made to the calls to Acquisitions::DelOrder in Koha's code, to change the order of the parameters >- in addorder.pl >- in basket.pl >- in UT t/db_dependant/Acquisition.t > >Change made in template basket.tt. > >This bug was signed off by Cedric some time ago, but it needs a second sign off, because I had to made some little changes. > >To test : >1. Fill a basket with some records (some records with items or holds, some without items) >2. Supress one of the record >3. In the basket (refresh the screen) check that "Deleted bibliographic notice" line was replaced with "Deleted bibliographic record", without hyperlink arround >4. Delete this order with the link "Delete order" to the right column of the table >5. Check there is a new line in the "Deleted orders" table >6. Check there is no regression : delete an other order (one with no item), then check you cannot delete an order with an item (like before patch) > >Signed-off-by: Cedric Vita <cedric.vita@dracenie.com> >--- > C4/Acquisition.pm | 19 ++++++++++--------- > acqui/basket.pl | 2 +- > .../intranet-tmpl/prog/en/modules/acqui/basket.tt | 7 ++++++- > 3 files changed, 17 insertions(+), 11 deletions(-) > >diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm >index 384b598e43..aa571489e2 100644 >--- a/C4/Acquisition.pm >+++ b/C4/Acquisition.pm >@@ -1908,22 +1908,23 @@ sub DelOrder { > $query .= ", cancellationreason = ? "; > } > $query .= " >- WHERE biblionumber=? AND ordernumber=? >+ WHERE ordernumber=? > "; > my $sth = $dbh->prepare($query); > if($reason) { >- $sth->execute($reason, $bibnum, $ordernumber); >+ $sth->execute($reason, $ordernumber); > } else { >- $sth->execute( $bibnum, $ordernumber ); >+ $sth->execute( $ordernumber ); > } > $sth->finish; >+ if ($bibnum) { >+ my @itemnumbers = GetItemnumbersFromOrder( $ordernumber ); >+ foreach my $itemnumber (@itemnumbers){ >+ my $delcheck = C4::Items::DelItemCheck( $bibnum, $itemnumber ); > >- my @itemnumbers = GetItemnumbersFromOrder( $ordernumber ); >- foreach my $itemnumber (@itemnumbers){ >- my $delcheck = C4::Items::DelItemCheck( $bibnum, $itemnumber ); >- >- if($delcheck != 1) { >- $error->{'delitem'} = 1; >+ if($delcheck != 1) { >+ $error->{'delitem'} = 1; >+ } > } > } > >diff --git a/acqui/basket.pl b/acqui/basket.pl >index 9f2ffdf7e1..9d533bc5ff 100755 >--- a/acqui/basket.pl >+++ b/acqui/basket.pl >@@ -124,7 +124,7 @@ if ( $op eq 'delete_confirm' ) { > my @orders = GetOrders($basketno); > #Delete all orders included in that basket, and all items received. > foreach my $myorder (@orders){ >- DelOrder($myorder->{biblionumber},$myorder->{ordernumber}); >+ DelOrder($myorder->{biblionumber} || '', $myorder->{ordernumber}); > } > # if $delbiblio = 1, delete the records if possible > if ((defined $delbiblio)and ($delbiblio ==1)){ >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 b870d835e8..e7c48918a4 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt >@@ -500,6 +500,10 @@ > [% END %] > </td> > <td> >+ [% UNLESS (books_loo.biblionumber) %] >+ <a href="javascript:confirm_delete_item([% books_loo.ordernumber | html %])" class="button">Delete order</a><br> >+ [% ELSE %] >+ > [% IF ( books_loo.left_holds_on_order ) %] > <span class="button" title="Can't cancel order, ([% books_loo.holds_on_order | html %]) holds are linked with this order cancel holds first">Can't cancel order</span><br> > [% ELSE %] >@@ -522,6 +526,7 @@ > [% IF ( books_loo.left_holds ) %] > <b title="Can't delete catalog record or order, cancel holds first">[% books_loo.holds | html %] hold(s) left</b> > [% END %] >+ [% END %] > </td> > [% END %] > [% END %] >@@ -563,7 +568,7 @@ > <td> > <p> > [% IF ( order.order_received ) %] (rcvd)[% END %] >- [% IF (order.title) %] >+ [% IF (order.biblionumber) %] > [% order.title | html %][% IF order.author %] by [% order.author | html %][% END %] > [% ELSE %] > <em>Deleted bibliographic record, can't find title</em> >-- >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 10869
:
20970
|
21106
|
21294
|
21295
|
21480
|
22104
|
22299
|
22300
|
22342
|
22676
|
23839
|
24743
|
24744
|
24992
|
25000
|
25001
|
25002
|
25003
|
26692
|
26693
|
27270
|
27292
|
28516
|
29668
| 78862 |
78863
|
78864