(bug #2915) C4::Biblio::DelBiblio delete the serials
authorNahuel ANGELINETTI <nahuel.angelinetti@biblibre.com>
Thu, 15 Jan 2009 09:15:18 +0000 (10:15 +0100)
committerHenri-Damien LAURENT <henridamien.laurent@biblibre.com>
Fri, 6 Mar 2009 09:47:32 +0000 (10:47 +0100)
This patch add the serials deletion in DelBiblio function, so now when a record is deleted all attached serials will be too.

Signed-off-by: Henri-Damien LAURENT <henridamien.laurent@biblibre.com>
C4/Biblio.pm

index b3c0a97..c15bdb9 100644 (file)
@@ -33,6 +33,7 @@ use C4::Log; # logaction
 use C4::ClassSource;
 use C4::Charset;
 require C4::Heading;
+require C4::Serials;
 
 use vars qw($VERSION @ISA @EXPORT);
 
@@ -362,6 +363,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