On Thu, Jan 15, 2009 at 4:22 AM, Nahuel ANGELINETTI <
[email protected]> 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
_______________________________________________
Koha-patches mailing list
[email protected]
http://lists.koha.org/mailman/listinfo/koha-patches

Reply via email to