[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Koha-cvs] CVS: koha/acqui.simple additem.pl,1.29,1.30
From: |
Henri-Damien LAURENT |
Subject: |
[Koha-cvs] CVS: koha/acqui.simple additem.pl,1.29,1.30 |
Date: |
Mon, 01 Aug 2005 07:37:09 -0700 |
Update of /cvsroot/koha/koha/acqui.simple
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21090/acqui.simple
Modified Files:
additem.pl
Log Message:
Adding Independant branches Management for items, i.e
Only items on the same branch as user can be created, modified, deleted.
If trying to get an item which homebranch is different from user branch AND
that user is not superlibrarian, then go back to additem.
Index: additem.pl
===================================================================
RCS file: /cvsroot/koha/koha/acqui.simple/additem.pl,v
retrieving revision 1.29
retrieving revision 1.30
diff -C2 -r1.29 -r1.30
*** additem.pl 6 May 2005 08:25:16 -0000 1.29
--- additem.pl 1 Aug 2005 14:36:49 -0000 1.30
***************
*** 53,56 ****
--- 53,57 ----
my $oldbiblionumber = &MARCfind_oldbiblionumber_from_MARCbibid($dbh,$bibid);
+
my $op = $input->param('op');
my $itemnum = $input->param('itemnum');
***************
*** 132,135 ****
--- 133,144 ----
# 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;
***************
*** 142,145 ****
--- 151,155 ----
#---- 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) {
***************
*** 152,155 ****
--- 162,175 ----
$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){
+ if (not ($userenv->{'branch'} eq $subf[$i][1]))
{
+ $this_row{'nomod'}=1;
+ warn "nomod"
+ }
+ }
+ }
push @itemnums,$this_row{$subf[$i][0]} =$subf[$i][1] if
($field->tag() eq $itemtagfield && $subf[$i][0] eq $itemtagsubfield);
}
***************
*** 175,178 ****
--- 195,200 ----
$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);
}
***************
*** 203,206 ****
--- 225,235 ----
my ($x,$value);
($x,$value) = find_value($tag,$subfield,$itemrecord) if
($itemrecord);
+
+ #testing branch value if IndependantBranches.
+ my $test = (C4::Context->preference("IndependantBranches")) &&
+ ($tag==$branchtagfield) &&
($subfield==$branchtagsubfield) &&
+ (C4::Context->userenv->{flags} != 1) &&
($value != C4::Context->userenv->{branch}) ;
+ print $input->redirect("additem.pl?bibid=$bibid") if ($test);
+
# search for itemcallnumber if applicable
if ($tagslib->{$tag}->{$subfield}->{kohafield} eq
'items.itemcallnumber' && C4::Context->preference('itemcallnumber')) {
***************
*** 218,227 ****
#---- 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
--- 247,266 ----
#---- 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
***************
*** 267,278 ****
}
}
- 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.
--- 306,309 ----
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Koha-cvs] CVS: koha/acqui.simple additem.pl,1.29,1.30,
Henri-Damien LAURENT <=