[Koha-cvs] CVS: koha/C4 Suggestions.pm,1.6,1.7

Henri-Damien LAURENT hdl at users.sourceforge.net
Tue Jul 26 19:01:14 CEST 2005


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

Modified Files:
	Suggestions.pm 
Log Message:
Adding branch Independancy support for searchsugestion.


Index: Suggestions.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Suggestions.pm,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** Suggestions.pm	26 Jul 2005 07:50:27 -0000	1.6
--- Suggestions.pm	26 Jul 2005 17:01:11 -0000	1.7
***************
*** 109,112 ****
--- 109,120 ----
  		$query .= " and status=?";
  	}
+ 	
+ 	if (C4::Context->preference("IndependantBranches")) {
+ 		my $userenv = C4::Context->userenv;
+ 		unless ($userenv->{flags} == 1){
+ 			push @sql_params,$userenv->{branch};
+ 			$query .= " and (U1.branchcode = ? or U1.branchcode ='')";
+ 		}
+ 	}
  	if ($suggestedbyme) {
  		if ($suggestedbyme eq -1) {
***************
*** 169,175 ****
  	if (C4::Context->preference("IndependantBranches")){
  		my $userenv = C4::Context->userenv;
! 		warn "IndependantBranches : Count Suggestions : ".$userenv->{branch};
! 		$sth = $dbh->prepare("select count(*) from suggestions,borrowers where status=? and borrowers.borrowernumber=suggestions.suggestedby and (borrowers.branchcode='' or borrowers.branchcode =?)");
! 		$sth->execute($status,$userenv->{branch});
  	} else {
  		$sth = $dbh->prepare("select count(*) from suggestions where status=?");
--- 177,187 ----
  	if (C4::Context->preference("IndependantBranches")){
  		my $userenv = C4::Context->userenv;
! 		if ($userenv->{flags} == 1){
! 			$sth = $dbh->prepare("select count(*) from suggestions where status=?");
! 			$sth->execute($status);
! 		} else {
! 			$sth = $dbh->prepare("select count(*) from suggestions,borrowers where status=? and borrowers.borrowernumber=suggestions.suggestedby and (borrowers.branchcode='' or borrowers.branchcode =?)");
! 			$sth->execute($status,$userenv->{branch});
! 		}
  	} else {
  		$sth = $dbh->prepare("select count(*) from suggestions where status=?");





More information about the Koha-cvs mailing list