[Koha-cvs] CVS: koha/C4 Acquisition.pm,1.15,1.16 Auth.pm,1.42,1.43
Henri-Damien LAURENT
hdl at users.sourceforge.net
Thu Jul 28 09:52:06 CEST 2005
Update of /cvsroot/koha/koha/C4
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18438/C4
Modified Files:
Acquisition.pm Auth.pm
Log Message:
Implementing Independancy Branches management :
- Trying to get a basket not owned by so of his own branch leads to mainpage.
- Lists onlys ths baskets owned by someon of user's brach.
Auth.pm now sends a cookie with userenv informations.
Index: Acquisition.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Acquisition.pm,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -r1.15 -r1.16
*** Acquisition.pm 14 Jul 2005 09:13:25 -0000 1.15
--- Acquisition.pm 28 Jul 2005 07:52:03 -0000 1.16
***************
*** 82,86 ****
my ($basketno)=@_;
my $dbh=C4::Context->dbh;
! my $sth=$dbh->prepare("select aqbasket.*,borrowers.firstname+' '+borrowers.surname as authorisedbyname from aqbasket left join borrowers on aqbasket.authorisedby=borrowers.borrowernumber where basketno=?");
$sth->execute($basketno);
return($sth->fetchrow_hashref);
--- 82,86 ----
my ($basketno)=@_;
my $dbh=C4::Context->dbh;
! my $sth=$dbh->prepare("select aqbasket.*,borrowers.firstname+' '+borrowers.surname as authorisedbyname, borrowers.branchcode as branch from aqbasket left join borrowers on aqbasket.authorisedby=borrowers.borrowernumber where basketno=?");
$sth->execute($basketno);
return($sth->fetchrow_hashref);
***************
*** 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,413 ----
my ($supplierid)=@_;
my $dbh = C4::Context->dbh;
!
! my $strsth ="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 ";
!
! 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";
! warn "getorders :".$strsth;
! my $sth=$dbh->prepare($strsth);
$sth->execute($supplierid);
my @results = ();
***************
*** 481,493 ****
my $dbh = C4::Context->dbh;
my @results = ();
! my $sth=$dbh->prepare("Select * from aqorders,biblio,biblioitems,aqbasket where aqbasket.basketno=aqorders.basketno
! and booksellerid=?
! and (cancelledby is NULL or cancelledby = '')
and (quantityreceived < quantity or quantityreceived is NULL)
and biblio.biblionumber=aqorders.biblionumber and biblioitems.biblioitemnumber=
! aqorders.biblioitemnumber
! group by aqorders.biblioitemnumber
order by
! biblio.title");
$sth->execute($supid);
while (my $data=$sth->fetchrow_hashref){
--- 491,512 ----
my $dbh = C4::Context->dbh;
my @results = ();
! my $strsth="Select * from aqorders,biblio,biblioitems,aqbasket ";
! $strsth .= ",borrowers " if (C4::Context->preference("IndependantBranches"));
! $strsth .=" where aqorders.basketno=aqbasket.basketno and aqbasket.booksellerid=aqbooksellers.id and biblio.biblionumber=aqorders.biblionumber ";
! $strsth .= " and aqbasket.authorisedby=borrowers.borrowernumber" if (C4::Context->preference("IndependantBranches"));
! $strsth.=" and booksellerid=? and (cancelledby is NULL or cancelledby = '')
and (quantityreceived < quantity or quantityreceived is NULL)
and biblio.biblionumber=aqorders.biblionumber and biblioitems.biblioitemnumber=
! aqorders.biblioitemnumber";
! 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 aqorders.biblioitemnumber
order by
! biblio.title";
! my $sth=$dbh->prepare($strsth);
$sth->execute($supid);
while (my $data=$sth->fetchrow_hashref){
***************
*** 600,606 ****
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;
--- 619,627 ----
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;
***************
*** 608,612 ****
$query .= " and creationdate >" .$dbh->quote($from_placed_on) if $from_placed_on;
$query .= " and creationdate<".$dbh->quote($to_placed_on) if $to_placed_on;
! warn "C4:Acquisition : ".$query;
my $sth = $dbh->prepare($query);
$sth->execute;
--- 629,639 ----
$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);
$sth->execute;
Index: Auth.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Auth.pm,v
retrieving revision 1.42
retrieving revision 1.43
diff -C2 -r1.42 -r1.43
*** Auth.pm 26 Jul 2005 15:58:47 -0000 1.42
--- Auth.pm 28 Jul 2005 07:52:03 -0000 1.43
***************
*** 495,500 ****
}
if ($userid eq C4::Context->config('user') && $password eq C4::Context->config('pass')) {
- # Koha superuser account
- warn "setuserenv3";
return 2;
}
--- 495,498 ----
More information about the Koha-cvs
mailing list