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

Joe Atzberger joe.atzberger at liblime.com
Thu Jan 15 18:32:19 CET 2009


On Thu, Jan 15, 2009 at 4:22 AM, Nahuel ANGELINETTI <
nahuel.angelinetti at biblibre.com> wrote:

> +    # 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});
> +        }
> +    }
>

I think this should just be:

+ my $subscriptions =
&C4::Serials::GetFullSubscriptionsFromBiblionumber($biblionumber);
+ foreach my $subscription (@$subscriptions){
+      &C4::Serials::DelSubscription($subscription->{subscriptionid});
+ }

This avoids hitting the DB twice for the same data and the negative of "if"
conditional above is that scalar(@$subscriptions) == 0, meaning the foreach
loop will be skipped anyway.

-joe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/koha-patches/attachments/20090115/de480b6a/attachment-0002.htm>


More information about the Koha-patches mailing list