Managing IndependantBranches when creating a new Biblio

librarians can only add/edit/delete items on their own branches.

Signed-off-by: Chris Cormack <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
This commit is contained in:
Henri-Damien LAURENT 2007-10-22 14:43:16 -05:00 committed by Joshua Ferraro
parent 1f5e1606e8
commit 458111f263
3 changed files with 26 additions and 24 deletions

View File

@ -29,6 +29,7 @@ use C4::Context;
use MARC::Record;
use C4::Log;
use C4::Koha; # XXX subfield_is_koha_internal_p
use C4::Branch; # XXX subfield_is_koha_internal_p
use Date::Calc qw(Today);
use MARC::File::USMARC;
use MARC::File::XML;
@ -163,16 +164,16 @@ sub build_authorized_values_list ($$$$$$$) {
#---- 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;
#Use GetBranches($onlymine)
my $onlymine=C4::Context->preference('IndependantBranches') &&
C4::Context->userenv &&
C4::Context->userenv->{flags}!=1 &&
C4::Context->userenv->{branch};
my $branches = GetBranches($onlymine);
my @branchloop;
foreach my $thisbranch ( sort keys %$branches ) {
push @authorised_values, $thisbranch;
$authorised_lib{$thisbranch} = $branches->{$thisbranch}->{'branchname'};
}
#----- itemtypes

View File

@ -25,6 +25,7 @@ use C4::Output;
use C4::Biblio;
use C4::Context;
use C4::Koha; # XXX subfield_is_koha_internal_p
use C4::Branch; # XXX subfield_is_koha_internal_p
use Date::Calc qw(Today);
use MARC::File::XML;
@ -256,7 +257,7 @@ foreach my $tag (sort keys %{$tagslib}) {
my $index_subfield= int(rand(1000000));
if($subfield eq '@'){
$subfield_data{id} = "tag_".$tag."_subfield_0_".$index_subfield;
$subfield_data{id} = "tag_".$tag."_subfield_00_".$index_subfield;
} else {
$subfield_data{id} = "tag_".$tag."_subfield_".$subfield."_".$index_subfield;
}
@ -308,18 +309,18 @@ foreach my $tag (sort keys %{$tagslib}) {
#---- 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;
#Use GetBranches($onlymine)
my $onlymine=C4::Context->preference('IndependantBranches') &&
C4::Context->userenv &&
C4::Context->userenv->{flags}!=1 &&
C4::Context->userenv->{branch};
my $branches = GetBranches($onlymine);
my @branchloop;
foreach my $thisbranch ( sort keys %$branches ) {
push @authorised_values, $thisbranch;
$authorised_lib{$thisbranch} = $branches->{$thisbranch}->{'branchname'};
}
#----- itemtypes
}
elsif ( $tagslib->{$tag}->{$subfield}->{authorised_value} eq "itemtypes" ) {

View File

@ -155,8 +155,8 @@ function CreateKey(){
<!-- TMPL_LOOP NAME="item_loop" -->
<tr>
<!-- TMPL_VAR NAME="item_value" -->
<td><a href="additem.pl?op=edititem&amp;biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->&amp;itemnumber=<!-- TMPL_VAR NAME="itemnumber" -->">Edit</a></td>
<td><a href="javascript:confirm_deletion(<!-- TMPL_VAR NAME="biblionumber" -->,<!-- TMPL_VAR NAME="itemnumber" -->)">Delete</a></td>
<!-- TMPL_IF Name="nomod"--> <td colspan="2">&nbsp;</td><!--TMPL_ELSE--><td><a href="additem.pl?op=edititem&amp;biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->&amp;itemnumber=<!-- TMPL_VAR NAME="itemnumber" -->">Edit</a></td>
<td><a href="javascript:confirm_deletion(<!-- TMPL_VAR NAME="biblionumber" -->,<!-- TMPL_VAR NAME="itemnumber" -->)">Delete</a></td><!--/TMPL_IF-->
</tr>
<!-- /TMPL_LOOP -->
</table>