[Koha-cvs] CVS: koha/admin aqbookfund.pl,1.22,1.23
Henri-Damien LAURENT
hdl at users.sourceforge.net
Tue Jul 12 15:59:41 CEST 2005
Update of /cvsroot/koha/koha/admin
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25642/admin
Modified Files:
aqbookfund.pl
Log Message:
Modifying branch Selection : Now Superlibrarians are always able to see ALL branches budget, not simple librarians.
Index: aqbookfund.pl
===================================================================
RCS file: /cvsroot/koha/koha/admin/aqbookfund.pl,v
retrieving revision 1.22
retrieving revision 1.23
diff -C2 -r1.22 -r1.23
*** aqbookfund.pl 6 Jul 2005 17:47:22 -0000 1.22
--- aqbookfund.pl 12 Jul 2005 13:59:38 -0000 1.23
***************
*** 50,59 ****
sub StringSearch {
! my ($env,$searchstring,$type)=@_;
my $dbh = C4::Context->dbh;
$searchstring=~ s/\'/\\\'/g;
my @data=split(' ',$searchstring);
my $count=@data;
! my $sth=$dbh->prepare("select bookfundid,bookfundname,bookfundgroup from aqbookfund where (bookfundname like ?) order by bookfundid");
$sth->execute("%$data[0]%");
my @results;
--- 50,70 ----
sub StringSearch {
! my ($env,$searchstring,%branches)=@_;
my $dbh = C4::Context->dbh;
$searchstring=~ s/\'/\\\'/g;
my @data=split(' ',$searchstring);
my $count=@data;
! my $strsth= "select bookfundid,bookfundname,bookfundgroup,branchcode from aqbookfund where bookfundname like ? ";
! if (%branches){
! $strsth.= "AND (aqbookfund.branchcode is null " ;
! foreach my $branchcode (keys %branches){
! $strsth .= "or aqbookfund.branchcode = '".$branchcode."' ";
! }
! $strsth .= ") ";
! }
! $strsth.= "order by aqbookfund.bookfundid";
! warn "chaine de recherche : ".$strsth;
!
! my $sth=$dbh->prepare($strsth);
$sth->execute("%$data[0]%");
my @results;
***************
*** 165,170 ****
$sth->execute($bookfundid);
$sth->finish;
! my $sth=$dbh->prepare("replace aqbookfund (bookfundid,bookfundname) values (?,?)");
! $sth->execute($input->param('bookfundid'),$input->param('bookfundname'));
$sth->finish;
print "Content-Type: text/html\n\n<META HTTP-EQUIV=Refresh CONTENT=\"0; URL=aqbookfund.pl\"></html>";
--- 176,181 ----
$sth->execute($bookfundid);
$sth->finish;
! my $sth=$dbh->prepare("replace aqbookfund (bookfundid,bookfundname, branchcode) values (?,?,?)");
! $sth->execute($input->param('bookfundid'),$input->param('bookfundname'),$input->param('branchcode'));
$sth->finish;
print "Content-Type: text/html\n\n<META HTTP-EQUIV=Refresh CONTENT=\"0; URL=aqbookfund.pl\"></html>";
***************
*** 201,221 ****
}
my $env;
! my ($count,$results)=StringSearch($env,$searchfield,'web');
my $toggle="white";
my @loop_data =();
- my $strsth2="Select aqbudgetid,startdate,enddate,budgetamount,aqbudget.branchcode from aqbudget where bookfundid = ? ";
- if ($homebranch){
- $strsth2 .= "AND ((aqbudget.branchcode='') OR (aqbudget.branchcode= ".$dbh->quote($homebranch)."))" ;
- } else {
- $strsth2 .= "AND (aqbudget.branchcode='') " if ($flags>1);
- }
- $strsth2 .= "order by bookfundid";
- warn "".$strsth2;
- my $sth2 = $dbh->prepare($strsth2);
for (my $i=$offset; $i < ($offset+$pagesize<$count?$offset+$pagesize:$count); $i++){
my %row_data;
$row_data{bookfundid} =$results->[$i]{'bookfundid'};
$row_data{bookfundname} = $results->[$i]{'bookfundname'};
$row_data{branchname} = $select_branches{$results->[$i]{'branchcode'}};
$sth2->execute($row_data{bookfundid});
my @budget_loop;
--- 212,233 ----
}
my $env;
! my ($count,$results)=StringSearch($env,$searchfield,%select_branches);
my $toggle="white";
my @loop_data =();
for (my $i=$offset; $i < ($offset+$pagesize<$count?$offset+$pagesize:$count); $i++){
my %row_data;
$row_data{bookfundid} =$results->[$i]{'bookfundid'};
$row_data{bookfundname} = $results->[$i]{'bookfundname'};
+ warn "".$results->[$i]{'bookfundid'}." ".$results->[$i]{'bookfundname'}." ".$results->[$i]{'branchcode'};
$row_data{branchname} = $select_branches{$results->[$i]{'branchcode'}};
+ my $strsth2="Select aqbudgetid,startdate,enddate,budgetamount,aqbudget.branchcode from aqbudget where aqbudget.bookfundid = ?";
+ if ($homebranch){
+ $strsth2 .= " AND ((aqbudget.branchcode='') OR (aqbudget.branchcode= ".$dbh->quote($homebranch).")) " ;
+ } else {
+ $strsth2 .= " AND (aqbudget.branchcode='') " if ($flags>1);
+ }
+ $strsth2 .= " order by aqbudgetid";
+ warn "".$strsth2;
+ my $sth2 = $dbh->prepare($strsth2);
$sth2->execute($row_data{bookfundid});
my @budget_loop;
More information about the Koha-cvs
mailing list