[Koha-cvs] CVS: koha/C4 Acquisition.pm,1.18,1.19
Henri-Damien LAURENT
hdl at users.sourceforge.net
Mon Aug 8 10:42:35 CEST 2005
Update of /cvsroot/koha/koha/C4
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26599/C4
Modified Files:
Acquisition.pm
Log Message:
Code necessary for IndependantBranches parameter to work. Should have been committed sooner...
Modify Histsearch and getorders to respect branches of librarian.
Index: Acquisition.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Acquisition.pm,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -r1.18 -r1.19
*** Acquisition.pm 4 Aug 2005 13:27:47 -0000 1.18
--- Acquisition.pm 8 Aug 2005 08:42:32 -0000 1.19
***************
*** 392,403 ****
my ($supplierid)=@_;
my $dbh = C4::Context->dbh;
! my $sth=$dbh->prepare("Select count(*),authorisedby,creationdate,aqbasket.basketno,
! closedate,surname,firstname
! from aqorders
! left join aqbasket on aqbasket.basketno=aqorders.basketno
! left join borrowers on aqbasket.authorisedby=borrowers.borrowernumber
! where booksellerid=? and (quantity > quantityreceived or
! quantityreceived is NULL) and datecancellationprinted is NULL
! group by basketno order by aqbasket.basketno");
$sth->execute($supplierid);
my @results = ();
--- 392,411 ----
my ($supplierid)=@_;
my $dbh = C4::Context->dbh;
! my $strsth ="Select count(*),authorisedby,creationdate,aqbasket.basketno,
! closedate,surname,firstname,aqorders.title
! from aqorders
! left join aqbasket on aqbasket.basketno=aqorders.basketno
! left join borrowers on aqbasket.authorisedby=borrowers.borrowernumber
! where booksellerid=? and (quantity > quantityreceived or
! quantityreceived is NULL) and datecancellationprinted is NULL ";
!
! if (C4::Context->preference("IndependantBranches")) {
! my $userenv = C4::Context->userenv;
! unless ($userenv->{flags} == 1){
! $strsth .= " and (borrowers.branchcode = '".$userenv->{branch}."' or borrowers.branchcode ='')";
! }
! }
! $strsth.=" group by basketno order by aqbasket.basketno";
! my $sth=$dbh->prepare($strsth);
$sth->execute($supplierid);
my @results = ();
***************
*** 607,613 ****
my ($title,$author,$name,$from_placed_on,$to_placed_on)=@_;
my $dbh= C4::Context->dbh;
! my $query = "select biblio.title,aqorders.basketno,name,aqbasket.creationdate,aqorders.datereceived, aqorders.quantity, aqorders.ecost from aqorders,aqbasket,aqbooksellers,biblio
! where aqorders.basketno=aqbasket.basketno and aqbasket.booksellerid=aqbooksellers.id and
! biblio.biblionumber=aqorders.biblionumber";
$query .= " and biblio.title like ".$dbh->quote("%".$title."%") if $title;
$query .= " and biblio.author like ".$dbh->quote("%".$author."%") if $author;
--- 615,623 ----
my ($title,$author,$name,$from_placed_on,$to_placed_on)=@_;
my $dbh= C4::Context->dbh;
! my $query = "select biblio.title,aqorders.basketno,name,aqbasket.creationdate,aqorders.datereceived, aqorders.quantity, aqorders.ecost from aqorders,aqbasket,aqbooksellers,biblio";
!
! $query .= ",borrowers " if (C4::Context->preference("IndependantBranches"));
! $query .=" where aqorders.basketno=aqbasket.basketno and aqbasket.booksellerid=aqbooksellers.id and biblio.biblionumber=aqorders.biblionumber ";
! $query .= " and aqbasket.authorisedby=borrowers.borrowernumber" if (C4::Context->preference("IndependantBranches"));
$query .= " and biblio.title like ".$dbh->quote("%".$title."%") if $title;
$query .= " and biblio.author like ".$dbh->quote("%".$author."%") if $author;
***************
*** 615,618 ****
--- 625,634 ----
$query .= " and creationdate >" .$dbh->quote($from_placed_on) if $from_placed_on;
$query .= " and creationdate<".$dbh->quote($to_placed_on) if $to_placed_on;
+ if (C4::Context->preference("IndependantBranches")) {
+ my $userenv = C4::Context->userenv;
+ unless ($userenv->{flags} == 1){
+ $query .= " and (borrowers.branchcode = '".$userenv->{branch}."' or borrowers.branchcode ='')";
+ }
+ }
warn "C4:Acquisition : ".$query;
my $sth = $dbh->prepare($query);
More information about the Koha-cvs
mailing list