From 2950574dd6395e9814a7ae6e0cc30092ac6d59c5 Mon Sep 17 00:00:00 2001 From: hdl Date: Thu, 14 Jul 2005 09:13:24 +0000 Subject: [PATCH] Adding branch specific display to budgets and selection. Be warned that to be able to select a budget which is not from patron's Branch, you should have a '' Branch information. --- C4/Acquisition.pm | 2 +- acqui/acqui-home.pl | 7 ++++++- acqui/acquire.pl | 5 ++++- acqui/newbiblio.pl | 6 +++++- bull/acqui-search.pl | 9 ++++++++- bull/subscription-add.pl | 11 ++++++++++- 6 files changed, 34 insertions(+), 6 deletions(-) diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm index 54a29d636d..2330d4acd0 100644 --- a/C4/Acquisition.pm +++ b/C4/Acquisition.pm @@ -675,7 +675,7 @@ sub bookfunds { group by aqbookfund.bookfundid order by bookfundname"; } else { $strsth="Select * from aqbookfund,aqbudget where aqbookfund.bookfundid - =aqbudget.bookfundid and (aqbookfund.branchcode='' or aqbookfund.branchcode= ? ) + =aqbudget.bookfundid and (aqbookfund.branchcode is null or aqbookfund.branchcode='' or aqbookfund.branchcode= ? ) group by aqbookfund.bookfundid order by bookfundname"; } my $sth=$dbh->prepare($strsth); diff --git a/acqui/acqui-home.pl b/acqui/acqui-home.pl index 30cc75fce4..438c721371 100755 --- a/acqui/acqui-home.pl +++ b/acqui/acqui-home.pl @@ -21,7 +21,12 @@ my ($template, $loggedinuser, $cookie) }); # budget -my ($count,@results)=bookfunds; +my $dbh = C4::Context->dbh; +my $sthtemp = $dbh->prepare("Select flags, branchcode from borrowers where borrowernumber = ?"); +$sthtemp->execute($loggedinuser); +my ($flags, $homebranch)=$sthtemp->fetchrow; + +my ($count,@results)=bookfunds($homebranch); my $classlist=''; my $total=0; my $totspent=0; diff --git a/acqui/acquire.pl b/acqui/acquire.pl index d06d0cf218..7bad0aa6c9 100755 --- a/acqui/acquire.pl +++ b/acqui/acquire.pl @@ -58,8 +58,11 @@ my ($template, $loggedinuser, $cookie) flagsrequired => {acquisition => 1}, debug => 1, }); - $template->param($count); +my $sthtemp = $dbh->prepare("Select flags, branchcode from borrowers where borrowernumber = ?"); +$sthtemp->execute($borrowernumber); +my ($flags, $homebranch)=$sthtemp->fetchrow; + if ($count == 1){ my $sth; # my $sth=$dbh->prepare("Select itemtype,description from itemtypes order by description"); diff --git a/acqui/newbiblio.pl b/acqui/newbiblio.pl index 9f9f09aa51..151a11fe09 100755 --- a/acqui/newbiblio.pl +++ b/acqui/newbiblio.pl @@ -125,10 +125,14 @@ my $CGIbranch=CGI::scrolling_list( -name => 'branch', -multiple => 0 ); # build bookfund list +my $sthtemp = $dbh->prepare("Select flags, branchcode from borrowers where borrowernumber = ?"); +$sthtemp->execute($loggedinuser); +my ($flags, $homebranch)=$sthtemp->fetchrow; + my @bookfund; my @select_bookfund; my %select_bookfunds; -($count2,@bookfund)=bookfunds(); +($count2,@bookfund)=bookfunds($homebranch); for (my $i=0;$i<$count2;$i++){ push @select_bookfund, $bookfund[$i]->{'bookfundid'}; $select_bookfunds{$bookfund[$i]->{'bookfundid'}} = $bookfund[$i]->{'bookfundname'} diff --git a/bull/acqui-search.pl b/bull/acqui-search.pl index 3961405bb0..5da9f7eb5b 100755 --- a/bull/acqui-search.pl +++ b/bull/acqui-search.pl @@ -18,8 +18,15 @@ my ($template, $loggedinuser, $cookie) debug => 1, }); +#FIXME : Is this page still used ???? +# looks like no. + # budget -my ($count,@results)=&bookfunds; +my $dbh = C4::Context->dbh; +my $sthtemp = $dbh->prepare("Select flags, branchcode from borrowers where borrowernumber = ?"); +$sthtemp->execute($loggedinuser); +my ($flags, $homebranch)=$sthtemp->fetchrow; +my ($count,@results)=bookfunds($homebranch); my $classlist=''; my $total=0; my $totspent=0; diff --git a/bull/subscription-add.pl b/bull/subscription-add.pl index 079da3b9ec..a003171f3a 100755 --- a/bull/subscription-add.pl +++ b/bull/subscription-add.pl @@ -36,6 +36,13 @@ my ($template, $loggedinuser, $cookie) }); +#FIXME : If Budgets are never used, then these lines are useless. +my $dbh = C4::Context->dbh; +my $sthtemp = $dbh->prepare("Select flags, branchcode from borrowers where borrowernumber = ?"); +$sthtemp->execute($loggedinuser); +my ($flags, $homebranch)=$sthtemp->fetchrow; +#FIXME : END added by hdl on July,14 2005 + if ($op eq 'mod') { my $subscriptionid = $query->param('subscriptionid'); my $subs = &getsubscription($subscriptionid); @@ -120,7 +127,8 @@ if ($op eq 'mod') { "dow$dow" => 1, ); } -(my $temp,@budgets) = bookfunds(); +##FIXME : Looks like never used. +(my $temp,@budgets) = bookfunds($homebranch); # find default value & set it for the template for (my $i=0;$i<=$#budgets;$i++) { if ($budgets[$i]->{'aqbudgetid'} eq $aqbudgetid) { @@ -128,6 +136,7 @@ for (my $i=0;$i<=$#budgets;$i++) { } } $template->param(budgets => \@budgets); +#FIXME : END Added by hdl on July, 14 2005 if ($op eq 'addsubscription') { my $auser = $query->param('user'); -- 2.39.5