From 92fb3d128484b9d0b865b06f8b3a6003a0448673 Mon Sep 17 00:00:00 2001 From: hdl Date: Tue, 7 Feb 2006 16:21:32 +0000 Subject: [PATCH] Bug Fixing empty loops would provide ppl with a bug. Fixing it --- bull/statecollection.pl | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/bull/statecollection.pl b/bull/statecollection.pl index a43c1c27f7..0fd00e91fa 100755 --- a/bull/statecollection.pl +++ b/bull/statecollection.pl @@ -116,21 +116,29 @@ foreach my $thisitemlocation (keys %$itemlocationhash) { ); push @itemlocationloop, \%row; } - -foreach my $data (@serialslist){ - $data->{"itemstatusloop"}=\@itemstatusloop if ((C4::Context->preference("serialsadditems")) && scalar(@itemstatusloop)); - $data->{"itemlocationloop"}=\@itemlocationloop if ((C4::Context->preference("serialsadditems")) && scalar(@itemlocationloop)); - $data->{"branchloop"}=\@branchloop; - } + +if (C4::Context->preference("serialsadditems")){ + foreach my $data (@serialslist){ + $data->{"itemstatusloop"}=\@itemstatusloop if (scalar(@itemstatusloop)); + $data->{"itemlocationloop"}=\@itemlocationloop if (scalar(@itemlocationloop)); + $data->{"branchloop"}=\@branchloop ; + } +} + my $sth=$dbh->prepare("select * from subscriptionhistory where subscriptionid = ?"); $sth->execute($subscriptionid); my $solhistory = $sth->fetchrow_hashref; -$template->param(serialadditems =>C4::Context->preference("serialsadditems"), +if (C4::Context->preference("serialsadditems")){ + $template->param(serialadditems =>C4::Context->preference("serialsadditems"), branchloop => \@branchloop, - ) if (C4::Context->preference("serialsadditems")); -$template->param(itemstatus=>1,itemstatusloop=>\@itemstatusloop) if ((C4::Context->preference("serialsadditems")) && scalar(@itemstatusloop)); -$template->param(itemlocation=>1,itemlocationloop=>\@itemlocationloop) if ((C4::Context->preference("serialsadditems")) && scalar(@itemlocationloop)); + ) ; + $template->param(itemstatus=>1,itemstatusloop=>\@itemstatusloop) if (scalar(@itemstatusloop)); + $template->param(itemlocation=>1,itemlocationloop=>\@itemlocationloop) if (scalar(@itemlocationloop)); +}else{ + $template->param(branchloop=>[],itemstatusloop=>[],itemlocationloop=>[]) ; +} + $template->param( serialslist => \@serialslist, biblionumber => $subscription->{biblionumber}, -- 2.39.5