bug 2915 followup - small efficiency improvement
authorGalen Charlton <galen.charlton@liblime.com>
Mon, 27 Apr 2009 15:31:03 +0000 (10:31 -0500)
committerHenri-Damien LAURENT <henridamien.laurent@biblibre.com>
Tue, 26 May 2009 19:15:19 +0000 (21:15 +0200)
Following up on a suggestion by Joe Atzberger, save
a database query by not counting the subscriptions
to delete; instead, simply fetch a list of them.

No user-visible change.

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

index ddf711f..1c5f1ee 100755 (executable)
@@ -365,11 +365,9 @@ 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});
-        }
+    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