Adding branch specific display to budgets and selection.
authorhdl <hdl>
Thu, 14 Jul 2005 09:13:24 +0000 (09:13 +0000)
committerhdl <hdl>
Thu, 14 Jul 2005 09:13:24 +0000 (09:13 +0000)
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
acqui/acqui-home.pl
acqui/acquire.pl
acqui/newbiblio.pl
bull/acqui-search.pl
bull/subscription-add.pl

index 54a29d6..2330d4a 100644 (file)
@@ -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);
index 30cc75f..438c721 100755 (executable)
@@ -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;
index d06d0cf..7bad0aa 100755 (executable)
@@ -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");
index 9f9f09a..151a11f 100755 (executable)
@@ -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'}
index 3961405..5da9f7e 100755 (executable)
@@ -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;
index 079da3b..a003171 100755 (executable)
@@ -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');