[Koha-patches] [PATCH] (bug #2915) C4::Biblio::DelBiblio delete the serials

Nahuel ANGELINETTI nahuel.angelinetti at biblibre.com
Thu Jan 15 10:22:35 CET 2009


This patch add the serials deletion in DelBiblio function, so now when a record is deleted all attached serials will be too.
---
 C4/Biblio.pm |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/C4/Biblio.pm b/C4/Biblio.pm
index 3c32710..c0677f4 100644
--- a/C4/Biblio.pm
+++ b/C4/Biblio.pm
@@ -33,6 +33,7 @@ use C4::Dates qw/format_date/;
 use C4::Log; # logaction
 use C4::ClassSource;
 use C4::Charset;
+require C4::Serials;
 
 use vars qw($VERSION @ISA @EXPORT);
 
@@ -382,6 +383,14 @@ sub DelBiblio {
 
     return $error if $error;
 
+    # We delete attached subscriptions
+    if(C4::Serials::CountSubscriptionFromBiblionumber($biblionumber) != 0){
+        my $subscriptions = &C4::Serials::GetFullSubscriptionsFromBiblionumber($biblionumber);
+        foreach my $subscription (@$subscriptions){
+            &C4::Serials::DelSubscription($subscription->{subscriptionid});
+        }
+    }
+    
     # Delete in Zebra. Be careful NOT to move this line after _koha_delete_biblio
     # for at least 2 reasons :
     # - we need to read the biblio if NoZebra is set (to remove it from the indexes
-- 
1.5.6.3




More information about the Koha-patches mailing list