[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

Henri-Damien LAURENT hdl at users.sourceforge.net
Fri Aug 26 14:21:52 CEST 2005


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

Modified Files:
      Tag: rel_2_2
	deletemem.pl memberentry.pl moremember.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: deletemem.pl
===================================================================
RCS file: /cvsroot/koha/koha/members/deletemem.pl,v
retrieving revision 1.4
retrieving revision 1.4.2.1
diff -C2 -r1.4 -r1.4.2.1
*** deletemem.pl	27 Oct 2004 15:33:55 -0000	1.4
--- deletemem.pl	26 Aug 2005 12:21:50 -0000	1.4.2.1
***************
*** 42,45 ****
--- 42,55 ----
  my ($loggedinuser, $cookie, $sessionID) = checkauth($input, 0, $flagsrequired);
  
+ if (C4::Context->preference("IndependantBranches")) {
+ 	my $userenv = C4::Context->userenv;
+ 	unless ($userenv->{flags} == 1){
+ 		unless ($userenv->{'branch'} eq $bor->{'branchcode'}){
+ 			warn "user ".$userenv->{'branch'} ."borrower :". $bor->{'branchcode'};
+ 			print $input->redirect("/cgi-bin/koha/members/moremember.pl?bornum=$member");
+ 			exit 1;
+ 		}
+ 	}
+ }
  
  
***************
*** 62,66 ****
  $sth->finish;
  
- 
  if ($i > 0 || $flags->{'CHARGES'} ne '' || $data ne ''){
  	my ($template, $borrowernumber, $cookie)
--- 72,75 ----

Index: memberentry.pl
===================================================================
RCS file: /cvsroot/koha/koha/members/memberentry.pl,v
retrieving revision 1.5.2.5
retrieving revision 1.5.2.6
diff -C2 -r1.5.2.5 -r1.5.2.6
*** memberentry.pl	28 Jun 2005 11:51:57 -0000	1.5.2.5
--- memberentry.pl	26 Aug 2005 12:21:50 -0000	1.5.2.6
***************
*** 109,112 ****
--- 109,121 ----
  		$nok=1;
  	}
+ 	if (C4::Context->preference("IndependantBranches")) {
+ 		my $userenv = C4::Context->userenv;
+ 		if ($userenv->{flags} != 1){
+ 			unless ($userenv->{branch} eq $data{'branchcode'}){
+ 				push @errors, "ERROR_branch";
+ 				$nok=1;
+ 			}
+ 		}
+ 	}
  	if ($nok) {
  		foreach my $error (@errors) {
***************
*** 149,152 ****
--- 158,169 ----
  		$data=borrdata('',$borrowernumber);
  	}
+ 	if (C4::Context->preference("IndependantBranches")) {
+ 		my $userenv = C4::Context->userenv;
+ 		if ($userenv->{flags} != 1){
+ 			unless ($userenv->{branch} eq $data->{'branchcode'}){
+ 				print $input->redirect("/cgi-bin/koha/members/members-home.pl");
+ 			}
+ 		}
+ 	}
  	if ($actionType eq 'Add'){
  		$template->param( updtype => 'I');
***************
*** 222,228 ****
  	my %select_branches;
  	my $branches=getbranches();
  	foreach my $branch (keys %$branches) {
! 		push @select_branch, $branch;
! 		$select_branches{$branch} = $branches->{$branch}->{'branchname'};
  	}
  	my $CGIbranch=CGI::scrolling_list( -name     => 'branchcode',
--- 239,253 ----
  	my %select_branches;
  	my $branches=getbranches();
+ 	my $default;
  	foreach my $branch (keys %$branches) {
! 		if ((not C4::Context->preference("IndependantBranches")) || (C4::Context->userenv->{'flags'} == 1)) {
! 			push @select_branch, $branch;
! 			$select_branches{$branch} = $branches->{$branch}->{'branchname'};
! 			$default = $data->{'branchcode'};
! 		} else {
! 				push @select_branch, $branch if ($branch eq C4::Context->userenv->{'branch'});
! 				$select_branches{$branch} = $branches->{$branch}->{'branchname'} if ($branch eq C4::Context->userenv->{'branch'});
! 				$default = C4::Context->userenv->{'branch'};
! 		}
  	}
  	my $CGIbranch=CGI::scrolling_list( -name     => 'branchcode',

Index: moremember.pl
===================================================================
RCS file: /cvsroot/koha/koha/members/moremember.pl,v
retrieving revision 1.5.2.4
retrieving revision 1.5.2.5
diff -C2 -r1.5.2.4 -r1.5.2.5
*** moremember.pl	15 Jul 2005 20:09:19 -0000	1.5.2.4
--- moremember.pl	26 Aug 2005 12:21:50 -0000	1.5.2.5
***************
*** 191,194 ****
--- 191,197 ----
  }
  
+ #Independant branches management
+ my $unvalidlibrarian = ((C4::Context->preference("IndependantBranches")) && (C4::Context->userenv->{flags}!=1) && !($data->{'branchcode'} eq C4::Context->userenv->{branch}));
+ 
  $template->param($data);
  $template->param(
***************
*** 197,200 ****
--- 200,204 ----
  		 totaldue =>$total,
  		 issueloop       => \@issuedata,
+ 		 unvalidlibrarian => $unvalidlibrarian,
  		 reserveloop     => \@reservedata);
  





More information about the Koha-cvs mailing list