[Koha-cvs] CVS: koha/admin aqbookfund.pl,1.23,1.24 aqbudget.pl,1.17,1.18 branches.pl,1.29,1.30 systempreferences.pl,1.27,1.28

Paul POULAIN tipaul at users.sourceforge.net
Wed Oct 26 11:11:36 CEST 2005


Update of /cvsroot/koha/koha/admin
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28490/admin

Modified Files:
	aqbookfund.pl aqbudget.pl branches.pl systempreferences.pl 
Log Message:
big commit, still breaking things...

* synch with rel_2_2. Probably the last non manual synch, as rel_2_2 should not be modified deeply.
* code cleaning (cleaning warnings from perl -w) continued

Index: aqbookfund.pl
===================================================================
RCS file: /cvsroot/koha/koha/admin/aqbookfund.pl,v
retrieving revision 1.23
retrieving revision 1.24
diff -C2 -r1.23 -r1.24
*** aqbookfund.pl	12 Jul 2005 13:59:38 -0000	1.23
--- aqbookfund.pl	26 Oct 2005 09:11:34 -0000	1.24
***************
*** 41,44 ****
--- 41,45 ----
  use CGI;
  use C4::Auth;
+ use C4::Koha;
  use C4::Context;
  use C4::Acquisition;
***************
*** 50,54 ****
  
  sub StringSearch  {
! 	my ($env,$searchstring,%branches)=@_;
  	my $dbh = C4::Context->dbh;
  	$searchstring=~ s/\'/\\\'/g;
--- 51,55 ----
  
  sub StringSearch  {
! 	my ($env,$searchstring,$branches)=@_;
  	my $dbh = C4::Context->dbh;
  	$searchstring=~ s/\'/\\\'/g;
***************
*** 56,62 ****
  	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."' "; 
  		}
--- 57,63 ----
  	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."' "; 
  		}
***************
*** 64,68 ****
  	}
  	$strsth.= "order by aqbookfund.bookfundid";
! 	warn "chaine de recherche : ".$strsth;
  	
  	my $sth=$dbh->prepare($strsth);
--- 65,69 ----
  	}
  	$strsth.= "order by aqbookfund.bookfundid";
! #	warn "chaine de recherche : ".$strsth;
  	
  	my $sth=$dbh->prepare($strsth);
***************
*** 79,88 ****
  my $dbh = C4::Context->dbh;
  my $input = new CGI;
! my $searchfield=$input->param('searchfield');
  my $offset=$input->param('offset');
  my $script_name="/cgi-bin/koha/admin/aqbookfund.pl";
  my $bookfundid=$input->param('bookfundid');
  my $pagesize=20;
! my $op = $input->param('op');
  $searchfield=~ s/\,//g;
  
--- 80,89 ----
  my $dbh = C4::Context->dbh;
  my $input = new CGI;
! my $searchfield=$input->param('searchfield') || '';
  my $offset=$input->param('offset');
  my $script_name="/cgi-bin/koha/admin/aqbookfund.pl";
  my $bookfundid=$input->param('bookfundid');
  my $pagesize=20;
! my $op = $input->param('op') || '';
  $searchfield=~ s/\,//g;
  
***************
*** 105,141 ****
  $template->param(action => $script_name);
  
! my @branches;
! my @select_branch;
! my %select_branches;
! my ($count2, at branches)=branches();
! 
! push @select_branch,"";
! $select_branches{""}="";
! 
! my $sthtemp = $dbh->prepare("Select flags, branchcode from borrowers where borrowernumber = ?");
! $sthtemp->execute($borrowernumber);
! my ($flags, $homebranch)=$sthtemp->fetchrow;
! if ($flags>1){
! 	if ($homebranch){
! 		push @select_branch, $homebranch;#
! 		for (my $i=0;$i<$count2;$i++){
! 			$select_branches{$branches[$i]->{'branchcode'}} = $branches[$i]->{'branchname'} if ($branches[$i]->{'branchcode'} eq $homebranch);
! 		}
! 	}
! } else {
! 	for (my $i=0;$i<$count2;$i++){
! 		push @select_branch, $branches[$i]->{'branchcode'};#
! 		$select_branches{$branches[$i]->{'branchcode'}} = $branches[$i]->{'branchname'};
! 	}
  }
- my $CGIbranch=CGI::scrolling_list( -name     => 'branchcode',
- 			-values   => \@select_branch,
- 			-labels   => \%select_branches,
- 			-size     => 1,
- 			-multiple => 0 );
- $template->param(CGIbranch => $CGIbranch);
  
! warn "bornum=".$borrowernumber . "flags = ".$flags. " homebranch= ".$homebranch;
! $sthtemp->finish;
  
  ################## ADD_FORM ##################################
--- 106,137 ----
  $template->param(action => $script_name);
  
! # my @branches;
! # my @select_branch;
! # my %select_branches;
! 
! my $branches = getbranches;
! my @branchloop;
! foreach my $thisbranch (sort keys %$branches) {
! # 	my $selected = 1 if $thisbranch eq $branch;
! 	my %row =(value => $thisbranch,
! # 				selected => $selected,
! 				branchname => $branches->{$thisbranch}->{'branchname'},
! 			);
! 	push @branchloop, \%row;
! # 	$select_branches{$thisbranch} = $branches->{$thisbranch}->{'branchname'};
  }
  
! # my $homebranch=C4::Context->userenv->{branch};
! # for (my $i=0;$i<$count2;$i++){
! # 	push @select_branch, $branches[$i]->{'branchcode'};#
! # 	$select_branches{$branches[$i]->{'branchcode'}} = $branches[$i]->{'branchname'};
! # }
! # 
! # my $CGIbranch=CGI::scrolling_list( -name     => 'branchcode',
! # 			-values   => \@select_branch,
! # 			-labels   => \%select_branches,
! # 			-size     => 1,
! # 			-multiple => 0 );
! $template->param(branchloop => \@branchloop);
  
  ################## ADD_FORM ##################################
***************
*** 176,180 ****
  	$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;
--- 172,176 ----
  	$sth->execute($bookfundid);
  	$sth->finish;
! 	$sth=$dbh->prepare("replace aqbookfund (bookfundid,bookfundname,branchcode) values (?,?,?)");
  	$sth->execute($input->param('bookfundid'),$input->param('bookfundname'),$input->param('branchcode'));
  	$sth->finish;
***************
*** 212,236 ****
  	}
  	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;
! 		while (my ($aqbudgetid,$startdate,$enddate,$budgetamount,$branchcode) = $sth2->fetchrow) {
  			my %budgetrow_data;
  			$budgetrow_data{aqbudgetid} = $aqbudgetid;
--- 208,235 ----
  	}
  	my $env;
! 	my ($count,$results)=StringSearch($env,$searchfield,$branches);
  	my $toggle="white";
  	my @loop_data =();
+ 	my $dbh = C4::Context->dbh;
  	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} = $branches->{$results->[$i]{'branchcode'}}->{branchname};
! 		my $strsth2="Select aqbudgetid,startdate,enddate,budgetamount from aqbudget where aqbudget.bookfundid = ?";
! # 		my $strsth2="Select aqbudgetid,startdate,enddate,budgetamount,branchcode from aqbudget where aqbudget.bookfundid = ?";
! # 		if ($homebranch){
! # 			$strsth2 .= " AND ((aqbudget.branchcode is null) OR (aqbudget.branchcode='') OR (aqbudget.branchcode= ".$dbh->quote($homebranch).")) " ;
! # 		} else {
! # 			$strsth2 .= " AND (aqbudget.branchcode='') " if ((C4::Context->userenv) && (C4::Context->userenv->{flags}>1));
! # 		}
  		$strsth2 .= " order by aqbudgetid";
! #  		warn "".$strsth2;
  		my $sth2 = $dbh->prepare($strsth2);
  		$sth2->execute($row_data{bookfundid});
  		my @budget_loop;
! # 		while (my ($aqbudgetid,$startdate,$enddate,$budgetamount,$branchcode) = $sth2->fetchrow) {
! 		while (my ($aqbudgetid,$startdate,$enddate,$budgetamount) = $sth2->fetchrow) {
  			my %budgetrow_data;
  			$budgetrow_data{aqbudgetid} = $aqbudgetid;
***************
*** 238,242 ****
  			$budgetrow_data{enddate} = format_date($enddate);
  			$budgetrow_data{budgetamount} = $budgetamount;
! 			$budgetrow_data{branchcode} = $branchcode;
  			push @budget_loop,\%budgetrow_data;
  		}
--- 237,241 ----
  			$budgetrow_data{enddate} = format_date($enddate);
  			$budgetrow_data{budgetamount} = $budgetamount;
! # 			$budgetrow_data{branchcode} = $branchcode;
  			push @budget_loop,\%budgetrow_data;
  		}

Index: aqbudget.pl
===================================================================
RCS file: /cvsroot/koha/koha/admin/aqbudget.pl,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -r1.17 -r1.18
*** aqbudget.pl	6 Jul 2005 17:47:22 -0000	1.17
--- aqbudget.pl	26 Oct 2005 09:11:34 -0000	1.18
***************
*** 110,118 ****
  	if ($aqbudgetid) {
  		my $dbh = C4::Context->dbh;
! 		my $sth=$dbh->prepare("select aqbudgetid,bookfundname,aqbookfund.bookfundid,startdate,enddate,budgetamount,aqbudget.branchcode from aqbudget,aqbookfund where aqbudgetid=? and aqbudget.bookfundid=aqbookfund.bookfundid");
  		$sth->execute($aqbudgetid);
  		$dataaqbudget=$sth->fetchrow_hashref;
  		$sth->finish;
  	}
  	my $header;
  	if ($aqbudgetid) {
--- 110,126 ----
  	if ($aqbudgetid) {
  		my $dbh = C4::Context->dbh;
! # 		my $sth=$dbh->prepare("select aqbudgetid,bookfundname,aqbookfund.bookfundid,aqbookfund.branchcode as bfbranch,startdate,enddate,budgetamount,aqbudget.branchcode from aqbudget,aqbookfund where aqbudgetid=? and aqbudget.bookfundid=aqbookfund.bookfundid");
! 		my $sth=$dbh->prepare("select aqbudgetid,bookfundname,aqbookfund.bookfundid,aqbookfund.branchcode as bfbranch,startdate,enddate,budgetamount from aqbudget,aqbookfund where aqbudgetid=? and aqbudget.bookfundid=aqbookfund.bookfundid");
  		$sth->execute($aqbudgetid);
  		$dataaqbudget=$sth->fetchrow_hashref;
  		$sth->finish;
  	}
+ 	if ($bookfundid) {
+ 		my $dbh = C4::Context->dbh;
+ 		my $sth=$dbh->prepare("select aqbookfund.branchcode, branches.branchname from aqbookfund LEFT JOIN branches ON aqbookfund.branchcode=branches.branchcode where bookfundid=?");
+ 		$sth->execute($bookfundid);
+ 		$dataaqbookfund=$sth->fetchrow_hashref;
+ 		$sth->finish;
+ 	}
  	my $header;
  	if ($aqbudgetid) {
***************
*** 124,159 ****
  	if ($aqbudgetid) {
  	    $template->param(modify => 1);
! 	    $template->param(bookfundid => $dataaqbudget->{bookfundid});
! 	    $template->param(bookfundname => $dataaqbudget->{bookfundname});
  	} else {
  	    $template->param(bookfundid => $bookfundid,
  	    							adding => 1);
  	}
! 	my @branches;
! 	my @select_branch;
! 	my %select_branches;
! 	my ($count2, at branches)=branches();
! 	push @select_branch,"";
! 	$select_branches{""}="";
! 	if ($flags>1){
! 		if ($homebranch){
! 			push @select_branch, $homebranch;#
! 			for (my $i=0;$i<$count2;$i++){
! 				$select_branches{$branches[$i]->{'branchcode'}} = $branches[$i]->{'branchname'} if ($branches[$i]->{'branchcode'} eq $homebranch);
! 			}
! 		}
! 	} else {
! 		for (my $i=0;$i<$count2;$i++){
! 			push @select_branch, $branches[$i]->{'branchcode'};#
! 			$select_branches{$branches[$i]->{'branchcode'}} = $branches[$i]->{'branchname'};
! 		}
! 	}
! 	my $CGIbranch=CGI::scrolling_list( -name     => 'branchcode',
! 				-values   => \@select_branch,
! 				-labels   => \%select_branches,
! 				-default  => $dataaqbudget->{branchcode},
! 				-size     => 1,
! 				-multiple => 0 );
! 	$template->param(CGIbranch => $CGIbranch);
  	$template->param(dateformat => display_date_format(),
  							aqbudgetid => $dataaqbudget->{'aqbudgetid'},
--- 132,164 ----
  	if ($aqbudgetid) {
  	    $template->param(modify => 1);
! 	    $template->param(bookfundid => $dataaqbudget->{'bookfundid'});
! 	    $template->param(bookfundname => $dataaqbudget->{'bookfundname'});
  	} else {
  	    $template->param(bookfundid => $bookfundid,
  	    							adding => 1);
  	}
! # 	my @select_branch;
! # 	my %select_branches;
! # 	if ($dataaqbookfund->{branchcode}){
! # 		push @select_branch,$dataaqbookfund->{'branchcode'};
! # 		$select_branches{$dataaqbookfund->{'branchcode'}}=$dataaqbookfund->{'branchname'};
! # 	}else {
! # 		my @branches;
! # 		my ($count2, at branches)=branches();
! # 		push @select_branch,"";
! # 		$select_branches{""}="";
! # 		for (my $i=0;$i<$count2;$i++){
! # 			push @select_branch, $branches[$i]->{'branchcode'};#
! # 			$select_branches{$branches[$i]->{'branchcode'}} = $branches[$i]->{'branchname'};
! # 		}
! # 	}
! # 	my $CGIbranch=CGI::scrolling_list( -name     => 'branchcode',
! # 				-values   => \@select_branch,
! # 				-labels   => \%select_branches,
! # 				-default  => ($dataaqbookfund->{branchcode}?$dataaqbookfund->{branchcode}:$dataaqbudget->{branchcode}),
! # 				-size     => 1,
! # 				-multiple => 0 );
! # 	$template->param(CGIbranch => $CGIbranch);
! 
  	$template->param(dateformat => display_date_format(),
  							aqbudgetid => $dataaqbudget->{'aqbudgetid'},

Index: branches.pl
===================================================================
RCS file: /cvsroot/koha/koha/admin/branches.pl,v
retrieving revision 1.29
retrieving revision 1.30
diff -C2 -r1.29 -r1.30
*** branches.pl	3 Aug 2005 19:30:31 -0000	1.29
--- branches.pl	26 Oct 2005 09:11:34 -0000	1.30
***************
*** 67,71 ****
  my $branchname=$input->param('branchname');
  my $categorycode = $input->param('categorycode');
! my $op = $input->param('op');
  
  my ($template, $borrowernumber, $cookie)
--- 67,71 ----
  my $branchname=$input->param('branchname');
  my $categorycode = $input->param('categorycode');
! my $op = $input->param('op') || '';
  
  my ($template, $borrowernumber, $cookie)
***************
*** 167,171 ****
  
  sub default {
! 	my ($message) = @_;
  	heading("Branches");
  	$template->param('heading-branches-p' => 1);
--- 167,171 ----
  
  sub default {
! 	my ($message) = @_ || "";
  	heading("Branches");
  	$template->param('heading-branches-p' => 1);
***************
*** 262,266 ****
  	}
  	my $toggle;
! 	my $i;
  	my @loop_data =();
  	foreach my $branch (@$branchinfo) {
--- 262,266 ----
  	}
  	my $toggle;
! 	my $i=0;
  	my @loop_data =();
  	foreach my $branch (@$branchinfo) {
***************
*** 330,335 ****
  	my @branchcategories =();
  	my $catinfo = getcategoryinfo();
- 	my $toggle;
- 	my $i = 0;
  	foreach my $cat (@$catinfo) {
  		($i % 2) ? ($toggle = 1) : ($toggle = 0);
--- 330,333 ----

Index: systempreferences.pl
===================================================================
RCS file: /cvsroot/koha/koha/admin/systempreferences.pl,v
retrieving revision 1.27
retrieving revision 1.28
diff -C2 -r1.27 -r1.28
*** systempreferences.pl	4 Aug 2005 12:13:35 -0000	1.27
--- systempreferences.pl	26 Oct 2005 09:11:34 -0000	1.28
***************
*** 55,64 ****
  $tabsysprefs{ISBD}="Catalogue";
  $tabsysprefs{marc}="Catalogue";
  $tabsysprefs{marcflavour}="Catalogue";
! $tabsysprefs{SubscriptionHistory}="Catalogue";
  $tabsysprefs{maxoutstanding}="Circulation";
  $tabsysprefs{printcirculationslips}="Circulation";
  $tabsysprefs{ReturnBeforeExpiry}="Circulation";
! $tabsysprefs{suggestion}="Acquisitions";
  $tabsysprefs{automembernum}="Members";
  $tabsysprefs{noissuescharge}="Circulation";
--- 55,65 ----
  $tabsysprefs{ISBD}="Catalogue";
  $tabsysprefs{marc}="Catalogue";
+ $tabsysprefs{autoBarcode}="Catalogue";
  $tabsysprefs{marcflavour}="Catalogue";
! $tabsysprefs{SubscriptionHistory}="OPAC";
  $tabsysprefs{maxoutstanding}="Circulation";
  $tabsysprefs{printcirculationslips}="Circulation";
  $tabsysprefs{ReturnBeforeExpiry}="Circulation";
! $tabsysprefs{suggestion}="OPAC";
  $tabsysprefs{automembernum}="Members";
  $tabsysprefs{noissuescharge}="Circulation";
***************
*** 68,104 ****
  $tabsysprefs{opacstylesheet}="OPAC";
  $tabsysprefs{BiblioDefaultView}="OPAC";
! $tabsysprefs{hidelostitem}="OPAC";
  $tabsysprefs{KohaAdmin}="Admin";
! $tabsysprefs{checkdigit}="Admin";
! $tabsysprefs{dateformat}="Admin";
! $tabsysprefs{insecure}="Admin";
! $tabsysprefs{ldapinfos}="Admin";
! $tabsysprefs{ldapserver}="Admin";
! $tabsysprefs{itemcallnumber}="Catalogue";
! $tabsysprefs{maxreserves}="Circulation";
! $tabsysprefs{virtualshelves}="OPAC";
! 
! my %tabsysprefs;
! $tabsysprefs{acquisitions}="Acquisitions";
! $tabsysprefs{gist}="Acquisitions";
! $tabsysprefs{authoritysep}="Authorities";
! $tabsysprefs{ISBD}="Catalogue";
! $tabsysprefs{marc}="Catalogue";
! $tabsysprefs{marcflavour}="Catalogue";
! $tabsysprefs{SubscriptionHistory}="Catalogue";
! $tabsysprefs{maxoutstanding}="Circulation";
! $tabsysprefs{printcirculationslips}="Circulation";
! $tabsysprefs{ReturnBeforeExpiry}="Circulation";
! $tabsysprefs{suggestion}="Acquisitions";
! $tabsysprefs{automembernum}="Members";
! $tabsysprefs{noissuescharge}="Circulation";
! $tabsysprefs{opacthemes}="OPAC";
! $tabsysprefs{opaclanguages}="OPAC";
! $tabsysprefs{LibraryName}="OPAC";
! $tabsysprefs{opacstylesheet}="OPAC";
! $tabsysprefs{BiblioDefaultView}="OPAC";
! $tabsysprefs{hidelostitem}="OPAC";
! $tabsysprefs{KohaAdmin}="Admin";
! $tabsysprefs{checkdigit}="Admin";
  $tabsysprefs{dateformat}="Admin";
  $tabsysprefs{insecure}="Admin";
--- 69,77 ----
  $tabsysprefs{opacstylesheet}="OPAC";
  $tabsysprefs{BiblioDefaultView}="OPAC";
! $tabsysprefs{opaclargeimage}="OPAC";
! $tabsysprefs{opacsmallimage}="OPAC";
! $tabsysprefs{hidelostitems}="OPAC";
  $tabsysprefs{KohaAdmin}="Admin";
! $tabsysprefs{checkdigit}="Members";
  $tabsysprefs{dateformat}="Admin";
  $tabsysprefs{insecure}="Admin";
***************
*** 108,111 ****
--- 81,85 ----
  $tabsysprefs{maxreserves}="Circulation";
  $tabsysprefs{virtualshelves}="OPAC";
+ $tabsysprefs{hide_marc}="Catalogue";
  
  sub StringSearch  {
***************
*** 335,339 ****
  	}
  	$sth->finish;
! 	print "Content-Type: text/html\n\n<META HTTP-EQUIV=Refresh CONTENT=\"0; URL=systempreferences.pl\"></html>";
  	exit;
  ################## DELETE_CONFIRM ##################################
--- 309,313 ----
  	}
  	$sth->finish;
! 	print "Content-Type: text/html\n\n<META HTTP-EQUIV=Refresh CONTENT=\"0; URL=systempreferences.pl?tab=".$tabsysprefs{$input->param('variable')}."\"></html>";
  	exit;
  ################## DELETE_CONFIRM ##################################





More information about the Koha-cvs mailing list