Bugzilla – Attachment 24743 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), 10.29 KB, created by
Marcel de Rooy
on 2014-01-27 12:29:45 UTC
(
hide
)
Description:
Bug 10869: Allow the deletion of order line if the record is deleted
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2014-01-27 12:29:45 UTC
Size:
10.29 KB
patch
obsolete
>From a72a29bc7e7a6a8bd10a0406897210805821d085 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 > >[I integrated a small followup by P. Poulain, changing the name of $bibnum to $biblionumber in DelOrder >It was more simple for rebasing] > >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) > >Signed-off-by: Cedric Vita <cedric.vita@dracenie.com> >--- > C4/Acquisition.pm | 18 +++--- > acqui/addorder.pl | 2 +- > .../intranet-tmpl/prog/en/modules/acqui/basket.tt | 54 +++++++++++-------- > 3 files changed, 41 insertions(+), 33 deletions(-) > >diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm >index 56c2d7f..4cd6e0b 100644 >--- a/C4/Acquisition.pm >+++ b/C4/Acquisition.pm >@@ -1752,7 +1752,7 @@ sub SearchOrders { > > =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 >@@ -1761,21 +1761,22 @@ cancelled. > =cut > > sub DelOrder { >- my ( $bibnum, $ordernumber ) = @_; >+ my ($ordernumber,$biblionumber) = @_; > my $dbh = C4::Context->dbh; > my $query = " > UPDATE aqorders > SET datecancellationprinted=now(), orderstatus='cancelled' >- 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 ($biblionumber) { >+ my @itemnumbers = GetItemnumbersFromOrder( $ordernumber ); >+ foreach my $itemnumber (@itemnumbers){ >+ C4::Items::DelItem( $dbh, $biblionumber, $itemnumber ); >+ } > } >- > } > > =head3 TransferOrder >@@ -2242,7 +2243,6 @@ sub GetHistory { > LEFT JOIN deletedbiblio ON deletedbiblio.biblionumber=aqorders.biblionumber > LEFT JOIN deletedbiblioitems ON deletedbiblioitems.biblionumber=aqorders.biblionumber > "; >- > if ( C4::Context->preference("IndependentBranches") ) { > $query .= " LEFT JOIN borrowers ON aqbasket.authorisedby=borrowers.borrowernumber"; > } >diff --git a/acqui/addorder.pl b/acqui/addorder.pl >index 1b05f07..5a34856 100755 >--- a/acqui/addorder.pl >+++ b/acqui/addorder.pl >@@ -323,7 +323,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 da78b7b..c65a6ae 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt >@@ -470,8 +470,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 %] >@@ -523,27 +527,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 %] >@@ -581,7 +589,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.7.6
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