Bugzilla – Attachment 21295 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]
[PATCH] Bug 10869: Allow the deletion of order line if the record is deleted
0003-mieux-Bug-10869-Allow-the-deletion-of-order-line-if-.patch (text/plain), 9.67 KB, created by
Mathieu Saby
on 2013-09-21 16:15:46 UTC
(
hide
)
Description:
[PATCH] Bug 10869: Allow the deletion of order line if the record is deleted
Filename:
MIME Type:
Creator:
Mathieu Saby
Created:
2013-09-21 16:15:46 UTC
Size:
9.67 KB
patch
obsolete
>From 541abb5b8501688a3a3e7043f136366c903904b2 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 >Content-Type: text/plain; charset="utf-8" > >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" > >I had to change the behavior of Acquisitions::DelOrder (which is used only by addorder.pl file), a line in addorder.pl, and a few lines in template basket.tt. > >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 : felete an other order (one with no item), then check you cannot delete an order with an item (like before patch) > >--- > C4/Acquisition.pm | 17 +++--- > acqui/addorder.pl | 2 +- > .../intranet-tmpl/prog/en/modules/acqui/basket.tt | 54 +++++++++++--------- > 3 files changed, 41 insertions(+), 32 deletions(-) > >diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm >index ed9c215..42a58c4 100644 >--- a/C4/Acquisition.pm >+++ b/C4/Acquisition.pm >@@ -1580,7 +1580,7 @@ sub SearchOrder { > > =head3 DelOrder > >- &DelOrder($biblionumber, $ordernumber); >+ &DelOrder($ordernumber, $biblionumber); > > Cancel the order with the given order and biblio numbers. It does not > delete any entries in the aqorders table, it merely marks them as >@@ -1589,21 +1589,22 @@ cancelled. > =cut > > sub DelOrder { >- my ( $bibnum, $ordernumber ) = @_; >+ my ($ordernumber,$bibnum) = @_; > my $dbh = C4::Context->dbh; > my $query = " > UPDATE aqorders > SET datecancellationprinted=now() >- WHERE biblionumber=? AND ordernumber=? >+ WHERE ordernumber=? > "; > my $sth = $dbh->prepare($query); >- $sth->execute( $bibnum, $ordernumber ); >+ $sth->execute($ordernumber ); > $sth->finish; >- my @itemnumbers = GetItemnumbersFromOrder( $ordernumber ); >- foreach my $itemnumber (@itemnumbers){ >- C4::Items::DelItem( $dbh, $bibnum, $itemnumber ); >+ if ($bibnum) { >+ my @itemnumbers = GetItemnumbersFromOrder( $ordernumber ); >+ foreach my $itemnumber (@itemnumbers){ >+ C4::Items::DelItem( $dbh, $bibnum, $itemnumber ); >+ } > } >- > } > > =head3 TransferOrder >diff --git a/acqui/addorder.pl b/acqui/addorder.pl >index 42324aa..ebbb96a 100755 >--- a/acqui/addorder.pl >+++ b/acqui/addorder.pl >@@ -251,7 +251,7 @@ if ( $orderinfo->{quantity} ne '0' ) { > > else { # qty=0, delete the line > my $biblionumber = $input->param('biblionumber'); >- DelOrder( $biblionumber, $$orderinfo{ordernumber} ); >+ DelOrder($$orderinfo{ordernumber}, $biblionumber ); > if ($orderinfo->{delbiblio} == 1){ > DelBiblio($biblionumber); > } >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 67e299d..0f12485 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt >@@ -336,8 +336,12 @@ > [% IF ( books_loo.order_received ) %]<tr class="disabled">[% ELSE %][% IF ( books_loo.toggle ) %]<tr class="highlight">[% ELSE %]<tr>[% END %][% END %] > <td> > <p>[% IF ( books_loo.order_received ) %] (rcvd)[% END %] >- <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% books_loo.biblionumber %]">[% books_loo.title |html %]</a> by [% books_loo.author %] >- <br /> >+ [% IF (books_loo.biblionumber) %] >+ <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% books_loo.biblionumber %]">[% books_loo.title |html %]</a> by [% books_loo.author %] >+ <br /> >+ [% ELSE %] >+ <em>Deleted bibliographic record, can't find title</em><br /> >+ [% END %] > [% IF ( books_loo.isbn ) %] - [% books_loo.isbn %][% END %] > [% IF ( books_loo.issn ) %] - [% books_loo.issn %][% END %] > [% IF ( books_loo.publishercode ) %], [% books_loo.publishercode %][% END %] >@@ -387,27 +391,31 @@ > [% END %] > </td> > <td> >- [% IF ( books_loo.left_holds_on_order ) %] >- <span class="button" title="Can't delete order, ([% books_loo.holds_on_order %]) holds are linked with this order cancel holds first">Can't delete order</span><br> >+ [% UNLESS (books_loo.biblionumber) %] >+ <a href="javascript:confirm_delete_item([% books_loo.ordernumber %])" class="button">Delete order</a><br> > [% ELSE %] >- <a href="javascript:confirm_delete_item([% books_loo.ordernumber %],[% books_loo.biblionumber %])" class="button">Delete order</a><br> >- [% END %] >- [% IF ( books_loo.can_del_bib ) %] >- <a href="javascript:confirm_delete_biblio([% books_loo.ordernumber %],[% books_loo.biblionumber %])" class="button">Delete order and catalog record</a><br> >- [% ELSE %] >- <span class="button" title="Can't delete catalog record, see constraints below">Can't delete order and catalog record</span><br> >- [% END %] >- [% IF ( books_loo.left_item ) %] >- <b title="Can't delete catalog record, because of [% books_loo.items %] existing hold(s)" >[% books_loo.items %] item(s) left</b><br> >- [% END %] >- [% IF ( books_loo.left_biblio ) %] >- <b title="Can't delete catalog record, delete other orders linked to it first">[% books_loo.biblios %] order(s) left</b><br> >- [% END %] >- [% IF ( books_loo.left_subscription ) %] >- <b title="Can't delete catalog record, delete subscriptions first">[% books_loo.subscriptions %] subscription(s) left</b><br> >- [% END %] >- [% IF ( books_loo.left_holds ) %] >- <b title="Can't delete catalog record or order, cancel holds first">[% books_loo.holds %] hold(s) left</b> >+ [% IF ( books_loo.left_holds_on_order ) %] >+ <span class="button" title="Can't delete order, ([% books_loo.holds_on_order %]) holds are linked with this order cancel holds first">Can't delete order</span><br> >+ [% ELSE %] >+ <a href="javascript:confirm_delete_item([% books_loo.ordernumber %],[% books_loo.biblionumber %])" class="button">Delete order</a><br> >+ [% END %] >+ [% IF ( books_loo.can_del_bib ) %] >+ <a href="javascript:confirm_delete_biblio([% books_loo.ordernumber %],[% books_loo.biblionumber %])" class="button">Delete order and catalog record</a><br> >+ [% ELSE %] >+ <span class="button" title="Can't delete catalog record, see constraints below">Can't delete order and catalog record</span><br> >+ [% END %] >+ [% IF ( books_loo.left_item ) %] >+ <b title="Can't delete catalog record, because of [% books_loo.items %] existing hold(s)" >[% books_loo.items %] item(s) left</b><br> >+ [% END %] >+ [% IF ( books_loo.left_biblio ) %] >+ <b title="Can't delete catalog record, delete other orders linked to it first">[% books_loo.biblios %] order(s) left</b><br> >+ [% END %] >+ [% IF ( books_loo.left_subscription ) %] >+ <b title="Can't delete catalog record, delete subscriptions first">[% books_loo.subscriptions %] subscription(s) left</b><br> >+ [% END %] >+ [% IF ( books_loo.left_holds ) %] >+ <b title="Can't delete catalog record or order, cancel holds first">[% books_loo.holds %] hold(s) left</b> >+ [% END %] > [% END %] > </td> > [% END %] >@@ -445,7 +453,7 @@ > <td> > <p> > [% IF ( order.order_received ) %] (rcvd)[% END %] >- [% IF (order.title) %] >+ [% IF (order.biblionumber) %] > [% order.title |html %] by [% order.author %]<br /> > [% ELSE %] > <em>Deleted bibliographic record, can't find title</em><br /> >-- >1.7.9.5 >
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