[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Koha-cvs] CVS: koha/admin aqbookfund.pl,1.19.2.2,1.19.2.3 aqbudget.pl,1
From: |
Henri-Damien LAURENT |
Subject: |
[Koha-cvs] CVS: koha/admin aqbookfund.pl,1.19.2.2,1.19.2.3 aqbudget.pl,1.16,1.16.2.1 |
Date: |
Fri, 26 Aug 2005 05:21:51 -0700 |
Update of /cvsroot/koha/koha/admin
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24682/admin
Modified Files:
Tag: rel_2_2
aqbookfund.pl aqbudget.pl
Log Message:
Commiting all that allows Branch Independancy management :
* in acquisition module, an order can be modified/recieved/closed only by a
librarian from the same branch than the librarian that created the basket.
* in catalogue module, an item can be modified/deleted/created only by a
librarian from the same branch as item owner branch
* in members module, a member can be created/modified only by a librarian from
the branch of the member.
Modifying Context.pm :
Adding userenv context variable.
Is set during checkauth or get_template_and_user
Modifying Auth.pm function checkauth : setting userenv context variable
Modifying Acquisition.pm:
* histsearch
* branches
* bookfunds
* getsupplierlistwithlateorders
* getlateorders
* getallorders
* getorders
Add a branch criterium if IndependantBranches is set.
Modifiying Suggestion.pm:
* searchsuggestions Will look first for th Librarian Branch and restrict
search to suggestion made by users from this branch
* countsuggestions Will look first for th Librarian Branch and restrict
search to suggestion made by users from this branch
File Modifiying :
* admin/aqbudget.pl adding a branch selection for budget.
* parameters/aqbudget.tmpl
* admin/aqbookfund.pl adding a branch selection for bookfund
* parameters/aqookfund.tmpl
And adding branch selection to members and items changes.
WARNING: bibid are still used in additem, unlike in HEAD... Shall be soon fixed.
Index: aqbookfund.pl
===================================================================
RCS file: /cvsroot/koha/koha/admin/aqbookfund.pl,v
retrieving revision 1.19.2.2
retrieving revision 1.19.2.3
diff -C2 -r1.19.2.2 -r1.19.2.3
*** aqbookfund.pl 20 Apr 2005 18:36:52 -0000 1.19.2.2
--- aqbookfund.pl 26 Aug 2005 12:21:49 -0000 1.19.2.3
***************
*** 42,45 ****
--- 42,46 ----
use C4::Auth;
use C4::Context;
+ use C4::Acquisition;
use C4::Output;
use C4::Interface::CGI::Output;
***************
*** 49,58 ****
sub StringSearch {
! my ($env,$searchstring,$type)address@hidden;
my $dbh = C4::Context->dbh;
$searchstring=~ s/\'/\\\'/g;
my @data=split(' ',$searchstring);
my address@hidden;
! 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)address@hidden;
my $dbh = C4::Context->dbh;
$searchstring=~ s/\'/\\\'/g;
my @data=split(' ',$searchstring);
my address@hidden;
! 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;
***************
*** 92,95 ****
--- 104,127 ----
$template->param(action => $script_name);
+ my @branches;
+ my @select_branch;
+ my %select_branches;
+ my ($count2,@branches)=branches();
+
+ push @select_branch,"";
+ $select_branches{""}="";
+
+ 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 => address@hidden,
+ -labels => \%select_branches,
+ -size => 1,
+ -multiple => 0 );
+ $template->param(CGIbranch => $CGIbranch);
################## ADD_FORM ##################################
***************
*** 170,185 ****
}
my $env;
! my ($count,$results)=StringSearch($env,$searchfield,'web');
my $toggle="white";
my @loop_data =();
my $dbh = C4::Context->dbh;
- my $sth2 = $dbh->prepare("Select
aqbudgetid,startdate,enddate,budgetamount from aqbudget where bookfundid = ?
order by bookfundid");
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'};
$sth2->execute($row_data{bookfundid});
my @budget_loop;
! while (my ($aqbudgetid,$startdate,$enddate,$budgetamount) =
$sth2->fetchrow) {
my %budgetrow_data;
$budgetrow_data{aqbudgetid} = $aqbudgetid;
--- 202,227 ----
}
my $env;
! my ($count,$results)=StringSearch($env,$searchfield,%select_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} =
$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
(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) {
my %budgetrow_data;
$budgetrow_data{aqbudgetid} = $aqbudgetid;
***************
*** 187,190 ****
--- 229,233 ----
$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.16
retrieving revision 1.16.2.1
diff -C2 -r1.16 -r1.16.2.1
*** aqbudget.pl 22 Dec 2003 19:16:58 -0000 1.16
--- aqbudget.pl 26 Aug 2005 12:21:49 -0000 1.16.2.1
***************
*** 42,45 ****
--- 42,46 ----
use C4::Date;
use C4::Auth;
+ use C4::Acquisition;
use C4::Context;
use C4::Output;
***************
*** 103,111 ****
if ($aqbudgetid) {
my $dbh = C4::Context->dbh;
! my $sth=$dbh->prepare("select
aqbudgetid,bookfundname,aqbookfund.bookfundid,startdate,enddate,budgetamount
from aqbudget,aqbookfund where aqbudgetid=? and
aqbudget.bookfundid=aqbookfund.bookfundid");
$sth->execute($aqbudgetid);
$dataaqbudget=$sth->fetchrow_hashref;
$sth->finish;
}
my $header;
if ($aqbudgetid) {
--- 104,119 ----
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");
$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) {
***************
*** 117,126 ****
if ($aqbudgetid) {
$template->param(modify => 1);
! $template->param(bookfundid => $dataaqbudget->{bookfundid});
! $template->param(bookfundname => $dataaqbudget->{bookfundname});
} else {
$template->param(bookfundid => $bookfundid,
adding => 1);
}
$template->param(dateformat => display_date_format(),
aqbudgetid =>
$dataaqbudget->{'aqbudgetid'},
--- 125,157 ----
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,@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 => address@hidden,
+ -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'},
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Koha-cvs] CVS: koha/admin aqbookfund.pl,1.19.2.2,1.19.2.3 aqbudget.pl,1.16,1.16.2.1,
Henri-Damien LAURENT <=
- Prev by Date:
[Koha-cvs] CVS: koha/koha-tmpl/intranet-tmpl/default/en/acqui.simple addbiblio.tmpl,1.33.2.9,1.33.2.10 additem.tmpl,1.20.2.5,1.20.2.6
- Next by Date:
[Koha-cvs] CVS: koha/members deletemem.pl,1.4,1.4.2.1 memberentry.pl,1.5.2.5,1.5.2.6 moremember.pl,1.5.2.4,1.5.2.5
- Previous by thread:
[Koha-cvs] CVS: koha/koha-tmpl/intranet-tmpl/default/en/acqui.simple addbiblio.tmpl,1.33.2.9,1.33.2.10 additem.tmpl,1.20.2.5,1.20.2.6
- Next by thread:
[Koha-cvs] CVS: koha/members deletemem.pl,1.4,1.4.2.1 memberentry.pl,1.5.2.5,1.5.2.6 moremember.pl,1.5.2.4,1.5.2.5
- Index(es):