[Koha-patches] [PATCH 01/17] Order cancelling improvement : delete attached items & biblio

paul.poulain at biblibre.com paul.poulain at biblibre.com
Thu Dec 16 15:11:07 CET 2010


From: Paul Poulain <paul.poulain at biblibre.com>

- all items attached to the order are deleted
- if there is no more items, then the biblio is deleted as well
---
 C4/Acquisition.pm |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm
index 984c15a..9443c62 100644
--- a/C4/Acquisition.pm
+++ b/C4/Acquisition.pm
@@ -1219,6 +1219,9 @@ sub DelOrder {
     my $sth = $dbh->prepare($query);
     $sth->execute( $bibnum, $ordernumber );
     $sth->finish;
+    my @itemnumbers = GetItemnumbersFromOrder( $ordernumber );
+    C4::Items::DelItem( $dbh, $bibnum, $_ ) for @itemnumbers;
+    DelBiblio(($bibnum)) if C4::Items::GetItemsCount( $bibnum ) == 0;
 }
 
 =head2 FUNCTIONS ABOUT PARCELS
-- 
1.7.1



More information about the Koha-patches mailing list