koha-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Koha-cvs] CVS: koha/acqui.simple additem.pl,1.27.2.4,1.27.2.5


From: Henri-Damien LAURENT
Subject: [Koha-cvs] CVS: koha/acqui.simple additem.pl,1.27.2.4,1.27.2.5
Date: Fri, 26 Aug 2005 05:21:51 -0700

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

Modified Files:
      Tag: rel_2_2
        additem.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: additem.pl
===================================================================
RCS file: /cvsroot/koha/koha/acqui.simple/additem.pl,v
retrieving revision 1.27.2.4
retrieving revision 1.27.2.5
diff -C2 -r1.27.2.4 -r1.27.2.5
*** additem.pl  28 Jul 2005 19:56:15 -0000      1.27.2.4
--- additem.pl  26 Aug 2005 12:21:49 -0000      1.27.2.5
***************
*** 132,146 ****
  # build screen with existing items. and "new" one
  
#------------------------------------------------------------------------------------------------------------------------------
  
  my %indicators;
  $indicators{995}='  ';
  # now, build existiing item list
! # my $temp = MARCgetbiblio($dbh,$bibid);
! # my @fields = $temp->fields();
! my @fields = $record->fields();
  my %witness; #---- stores the list of subfields used at least once, with the 
"meaning" of the code
  my @big_array;
  #---- finds where items.itemnumber is stored
  my ($itemtagfield,$itemtagsubfield) = 
&MARCfind_marc_from_kohafield($dbh,"items.itemnumber",$itemtype);
  my @itemnums; # array to store itemnums
  foreach my $field (@fields) {
--- 132,156 ----
  # build screen with existing items. and "new" one
  
#------------------------------------------------------------------------------------------------------------------------------
+ my ($template, $loggedinuser, $cookie)
+     = get_template_and_user({template_name => "acqui.simple/additem.tmpl",
+                            query => $input,
+                            type => "intranet",
+                            authnotrequired => 0,
+                            flagsrequired => {editcatalogue => 1},
+                            debug => 1,
+                            });
  
  my %indicators;
  $indicators{995}='  ';
  # now, build existiing item list
! my $temp = MARCgetbiblio($dbh,$bibid);
! my @fields = $temp->fields();
! #my @fields = $record->fields();
  my %witness; #---- stores the list of subfields used at least once, with the 
"meaning" of the code
  my @big_array;
  #---- finds where items.itemnumber is stored
  my ($itemtagfield,$itemtagsubfield) = 
&MARCfind_marc_from_kohafield($dbh,"items.itemnumber",$itemtype);
+ my ($branchtagfield,$branchtagsubfield) = 
&MARCfind_marc_from_kohafield($dbh,"items.homebranch",$itemtype);
+ 
  my @itemnums; # array to store itemnums
  foreach my $field (@fields) {
***************
*** 153,156 ****
--- 163,173 ----
                $witness{$subf[$i][0]} = 
$tagslib->{$field->tag()}->{$subf[$i][0]}->{lib} if 
($tagslib->{$field->tag()}->{$subf[$i][0]}->{tab}  eq 10);
                $this_row{$subf[$i][0]} =$subf[$i][1] if 
($tagslib->{$field->tag()}->{$subf[$i][0]}->{tab}  eq 10);
+               if (($field->tag eq $branchtagfield) && ($subf[$i][$0] eq 
$branchtagsubfield) && C4::Context->preference("IndependantBranches")) {
+                       #verifying rights
+                       my $userenv = C4::Context->userenv;
+                       unless (($userenv->{'flags'} == 1) or 
(($userenv->{'branch'} eq $subf[$i][1]))){
+                                       $this_row{'nomod'}=1;
+                       }
+               }
                push @itemnums,$this_row{$subf[$i][0]} =$subf[$i][1] if 
($field->tag() eq $itemtagfield && $subf[$i][0] eq $itemtagsubfield);
        }
***************
*** 176,179 ****
--- 193,198 ----
        $row_data{item_value} = $items_data;
        $row_data{itemnum} = $itemnums[$i];
+       #reporting this_row values
+       $row_data{'nomod'} = $big_array[$i]{'nomod'};
        push(@item_value_loop,\%row_data);
  }
***************
*** 204,207 ****
--- 223,231 ----
                my ($x,$value);
                ($x,$value) = find_value($tag,$subfield,$itemrecord) if 
($itemrecord);
+               #testing branch value if IndependantBranches.
+               my $test = (C4::Context->preference("IndependantBranches")) && 
+                                       ($tag eq $branchtagfield) && ($subfield 
eq $branchtagsubfield) &&
+                                       (C4::Context->userenv->{flags} != 1) && 
($value) && ($value ne C4::Context->userenv->{branch}) ;
+ #             print $input->redirect(".pl?bibid=$bibid") if ($test);
                # search for itemcallnumber if applicable
                if ($tagslib->{$tag}->{$subfield}->{kohafield} eq 
'items.itemcallnumber' && C4::Context->preference('itemcallnumber')) {
***************
*** 219,228 ****
                        #---- branch
                        if ($tagslib->{$tag}->{$subfield}->{'authorised_value'} 
eq "branches" ) {
!                               my $sth=$dbh->prepare("select 
branchcode,branchname from branches order by branchname");
!                               $sth->execute;
!                               push @authorised_values, "" unless 
($tagslib->{$tag}->{$subfield}->{mandatory});
!                               while (my ($branchcode,$branchname) = 
$sth->fetchrow_array) {
!                                       push @authorised_values, $branchcode;
!                                       
$authorised_lib{$branchcode}=$branchname;
                                }
                        #----- itemtypes
--- 243,262 ----
                        #---- branch
                        if ($tagslib->{$tag}->{$subfield}->{'authorised_value'} 
eq "branches" ) {
!                               if 
((C4::Context->preference("IndependantBranches")) && 
(C4::Context->userenv->{flags} != 1)){
!                                               my $sth=$dbh->prepare("select 
branchcode,branchname from branches where branchcode = ? order by branchname");
!                                               
$sth->execute(C4::Context->userenv->{branch});
!                                               push @authorised_values, "" 
unless ($tagslib->{$tag}->{$subfield}->{mandatory});
!                                               while (my 
($branchcode,$branchname) = $sth->fetchrow_array) {
!                                                       push 
@authorised_values, $branchcode;
!                                                       
$authorised_lib{$branchcode}=$branchname;
!                                               }
!                               } else {
!                                       my $sth=$dbh->prepare("select 
branchcode,branchname from branches order by branchname");
!                                       $sth->execute;
!                                       push @authorised_values, "" unless 
($tagslib->{$tag}->{$subfield}->{mandatory});
!                                       while (my ($branchcode,$branchname) = 
$sth->fetchrow_array) {
!                                               push @authorised_values, 
$branchcode;
!                                               
$authorised_lib{$branchcode}=$branchname;
!                                       }
                                }
                        #----- itemtypes
***************
*** 268,279 ****
        }
  }
- my ($template, $loggedinuser, $cookie)
-     = get_template_and_user({template_name => "acqui.simple/additem.tmpl",
-                            query => $input,
-                            type => "intranet",
-                            authnotrequired => 0,
-                            flagsrequired => {editcatalogue => 1},
-                            debug => 1,
-                            });
  
  # what's the next op ? it's what we are not in : an add if we're editing, 
otherwise, and edit.
--- 302,305 ----




reply via email to

[Prev in Thread] Current Thread [Next in Thread]