View | Details | Raw Unified | Return to bug 10263
Collapse All | Expand All

(-)a/C4/Auth.pm (+1 lines)
Lines 186-191 sub get_template_and_user { Link Here
186
        # to create the template's parameters that will indicate
186
        # to create the template's parameters that will indicate
187
        # which menus the user can access.
187
        # which menus the user can access.
188
        if ( $flags && $flags->{superlibrarian}==1 ) {
188
        if ( $flags && $flags->{superlibrarian}==1 ) {
189
            $template->param( CAN_user_superlibrarian   => 1 );
189
            $template->param( CAN_user_circulate        => 1 );
190
            $template->param( CAN_user_circulate        => 1 );
190
            $template->param( CAN_user_catalogue        => 1 );
191
            $template->param( CAN_user_catalogue        => 1 );
191
            $template->param( CAN_user_parameters       => 1 );
192
            $template->param( CAN_user_parameters       => 1 );
(-)a/C4/Biblio.pm (-6 / +15 lines)
Lines 2955-2966 sub _koha_add_biblio { Link Here
2955
            seriestitle = ?,
2955
            seriestitle = ?,
2956
            copyrightdate = ?,
2956
            copyrightdate = ?,
2957
            datecreated=NOW(),
2957
            datecreated=NOW(),
2958
            abstract = ?
2958
            abstract = ?,
2959
            branchcode = ?
2959
        ";
2960
        ";
2960
    my $sth = $dbh->prepare($query);
2961
    my $sth = $dbh->prepare($query);
2961
    $sth->execute(
2962
    $sth->execute(
2962
        $frameworkcode, $biblio->{'author'},      $biblio->{'title'},         $biblio->{'unititle'}, $biblio->{'notes'},
2963
        $frameworkcode,           $biblio->{'author'},
2963
        $biblio->{'serial'},        $biblio->{'seriestitle'}, $biblio->{'copyrightdate'}, $biblio->{'abstract'}
2964
        $biblio->{'title'},       $biblio->{'unititle'},
2965
        $biblio->{'notes'},       $biblio->{'serial'},
2966
        $biblio->{'seriestitle'}, $biblio->{'copyrightdate'},
2967
        $biblio->{'abstract'},    $biblio->{'branchcode'},
2964
    );
2968
    );
2965
2969
2966
    my $biblionumber = $dbh->{'mysql_insertid'};
2970
    my $biblionumber = $dbh->{'mysql_insertid'};
Lines 2997-3011 sub _koha_modify_biblio { Link Here
2997
               serial = ?,
3001
               serial = ?,
2998
               seriestitle = ?,
3002
               seriestitle = ?,
2999
               copyrightdate = ?,
3003
               copyrightdate = ?,
3000
               abstract = ?
3004
               abstract = ?,
3005
               branchcode = ?
3001
        WHERE  biblionumber = ?
3006
        WHERE  biblionumber = ?
3002
        "
3007
        "
3003
      ;
3008
      ;
3004
    my $sth = $dbh->prepare($query);
3009
    my $sth = $dbh->prepare($query);
3005
3010
3006
    $sth->execute(
3011
    $sth->execute(
3007
        $frameworkcode,      $biblio->{'author'},      $biblio->{'title'},         $biblio->{'unititle'}, $biblio->{'notes'},
3012
        $frameworkcode,           $biblio->{'author'},
3008
        $biblio->{'serial'}, $biblio->{'seriestitle'}, $biblio->{'copyrightdate'}, $biblio->{'abstract'}, $biblio->{'biblionumber'}
3013
        $biblio->{'title'},       $biblio->{'unititle'},
3014
        $biblio->{'notes'},       $biblio->{'serial'},
3015
        $biblio->{'seriestitle'}, $biblio->{'copyrightdate'},
3016
        $biblio->{'abstract'},    $biblio->{'branchcode'},
3017
        $biblio->{'biblionumber'}
3009
    ) if $biblio->{'biblionumber'};
3018
    ) if $biblio->{'biblionumber'};
3010
3019
3011
    if ( $dbh->errstr || !$biblio->{'biblionumber'} ) {
3020
    if ( $dbh->errstr || !$biblio->{'biblionumber'} ) {
(-)a/Koha/Template/Plugin/Koha.pm (-1 / +7 lines)
Lines 22-28 use Modern::Perl; Link Here
22
use base qw( Template::Plugin );
22
use base qw( Template::Plugin );
23
23
24
use C4::Context;
24
use C4::Context;
25
25
use C4::Branch qw( GetIndependentGroupModificationRights );
26
=pod
26
=pod
27
27
28
This plugin contains various Koha replated Template Toolkit functions
28
This plugin contains various Koha replated Template Toolkit functions
Lines 44-47 sub Preference { Link Here
44
    return C4::Context->preference( $pref );
44
    return C4::Context->preference( $pref );
45
}
45
}
46
46
47
sub HasIndependentGroupModificationRightsFor {
48
    my ( $self, $branchcode ) = @_;
49
    my $value = GetIndependentGroupModificationRights( { for => $branchcode } );
50
    return $value;
51
}
52
47
1;
53
1;
(-)a/admin/marc_subfields_structure.pl (+1 lines)
Lines 133-138 if ( $op eq 'add_form' ) { Link Here
133
        push @authorised_values, $category;
133
        push @authorised_values, $category;
134
    }
134
    }
135
    push( @authorised_values, "branches" );
135
    push( @authorised_values, "branches" );
136
    push( @authorised_values, "branches_optional" );
136
    push( @authorised_values, "itemtypes" );
137
    push( @authorised_values, "itemtypes" );
137
    push( @authorised_values, "cn_source" );
138
    push( @authorised_values, "cn_source" );
138
139
(-)a/catalogue/detail.pl (+2 lines)
Lines 62-67 my ( $template, $borrowernumber, $cookie ) = get_template_and_user( Link Here
62
my $biblionumber = $query->param('biblionumber');
62
my $biblionumber = $query->param('biblionumber');
63
my $record       = GetMarcBiblio($biblionumber);
63
my $record       = GetMarcBiblio($biblionumber);
64
64
65
$template->param( biblio => GetBiblio( $biblionumber ) );
66
65
if ( not defined $record ) {
67
if ( not defined $record ) {
66
    # biblionumber invalid -> report and exit
68
    # biblionumber invalid -> report and exit
67
    $template->param( unknownbiblionumber => 1,
69
    $template->param( unknownbiblionumber => 1,
(-)a/cataloguing/addbiblio.pl (-2 / +18 lines)
Lines 170-176 sub build_authorized_values_list { Link Here
170
    # builds list, depending on authorised value...
170
    # builds list, depending on authorised value...
171
171
172
    #---- branch
172
    #---- branch
173
    if ( $tagslib->{$tag}->{$subfield}->{'authorised_value'} eq "branches" ) {
173
    if ( $tagslib->{$tag}->{$subfield}->{'authorised_value'} =~ /branches|branches_optional/ ) {
174
        #Use GetBranches($onlymine)
174
        #Use GetBranches($onlymine)
175
        my $onlymine=C4::Context->preference('IndependentBranches') &&
175
        my $onlymine=C4::Context->preference('IndependentBranches') &&
176
                C4::Context->userenv && 
176
                C4::Context->userenv && 
Lines 182-188 sub build_authorized_values_list { Link Here
182
            push @authorised_values, $thisbranch;
182
            push @authorised_values, $thisbranch;
183
            $authorised_lib{$thisbranch} = $branches->{$thisbranch}->{'branchname'};
183
            $authorised_lib{$thisbranch} = $branches->{$thisbranch}->{'branchname'};
184
        }
184
        }
185
185
        push( @authorised_values, q{} ) if ( $tagslib->{$tag}->{$subfield}->{'authorised_value'} eq 'branches_optional' );
186
        #----- itemtypes
186
        #----- itemtypes
187
    }
187
    }
188
    elsif ( $tagslib->{$tag}->{$subfield}->{authorised_value} eq "itemtypes" ) {
188
    elsif ( $tagslib->{$tag}->{$subfield}->{authorised_value} eq "itemtypes" ) {
Lines 805-810 if ($breedingid) { Link Here
805
    ( $record, $encoding ) = MARCfindbreeding( $breedingid ) ;
805
    ( $record, $encoding ) = MARCfindbreeding( $breedingid ) ;
806
}
806
}
807
807
808
if ( C4::Context->preference('IndependentBranchesMarcEditing') ) {
809
    unless (
810
        GetIndependentGroupModificationRights(
811
            {
812
                for => $record->subfield(
813
                    GetMarcFromKohaField( 'biblio.branchcode', $frameworkcode )
814
                )
815
            }
816
        )
817
      )
818
    {
819
        print $input->redirect( "/cgi-bin/koha/catalogue/detail.pl?biblionumber=$biblionumber" );
820
        exit;
821
    }
822
}
823
808
#populate hostfield if hostbiblionumber is available
824
#populate hostfield if hostbiblionumber is available
809
if ($hostbiblionumber) {
825
if ($hostbiblionumber) {
810
    my $marcflavour = C4::Context->preference("marcflavour");
826
    my $marcflavour = C4::Context->preference("marcflavour");
(-)a/installer/data/mysql/kohastructure.sql (+2 lines)
Lines 126-131 CREATE TABLE `biblio` ( -- table that stores bibliographic information Link Here
126
  `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, -- date and time this record was last touched
126
  `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, -- date and time this record was last touched
127
  `datecreated` DATE NOT NULL, -- the date this record was added to Koha
127
  `datecreated` DATE NOT NULL, -- the date this record was added to Koha
128
  `abstract` mediumtext, -- summary from the MARC record (520$a in MARC21)
128
  `abstract` mediumtext, -- summary from the MARC record (520$a in MARC21)
129
  `branchcode` VARCHAR( 10 ) NULL DEFAULT NULL, -- branchcode for the opationl 'owner' of this record.
129
  PRIMARY KEY  (`biblionumber`),
130
  PRIMARY KEY  (`biblionumber`),
130
  KEY `blbnoidx` (`biblionumber`)
131
  KEY `blbnoidx` (`biblionumber`)
131
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
132
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
Lines 715-720 CREATE TABLE `deletedbiblio` ( -- stores information about bibliographic records Link Here
715
  `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, -- date and time this record was last touched
716
  `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, -- date and time this record was last touched
716
  `datecreated` DATE NOT NULL, -- the date this record was added to Koha
717
  `datecreated` DATE NOT NULL, -- the date this record was added to Koha
717
  `abstract` mediumtext, -- summary from the MARC record (520$a in MARC21)
718
  `abstract` mediumtext, -- summary from the MARC record (520$a in MARC21)
719
  `branchcode` VARCHAR( 10 ) NULL DEFAULT NULL, -- branchcode for the opationl 'owner' of this record.
718
  PRIMARY KEY  (`biblionumber`),
720
  PRIMARY KEY  (`biblionumber`),
719
  KEY `blbnoidx` (`biblionumber`)
721
  KEY `blbnoidx` (`biblionumber`)
720
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
722
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
(-)a/installer/data/mysql/updatedatabase.pl (+31 lines)
Lines 6800-6805 if (C4::Context->preference("Version") < TransformToNum($DBversion)) { Link Here
6800
            ADD KEY `branchcode_idx` (`branchcode`),
6800
            ADD KEY `branchcode_idx` (`branchcode`),
6801
            ADD KEY `issuingbranch_idx` (`issuingbranch`)
6801
            ADD KEY `issuingbranch_idx` (`issuingbranch`)
6802
    });
6802
    });
6803
6803
    #items
6804
    #items
6804
    $dbh->do(q{
6805
    $dbh->do(q{
6805
        ALTER TABLE `items` ADD KEY `itype_idx` (`itype`)
6806
        ALTER TABLE `items` ADD KEY `itype_idx` (`itype`)
Lines 6832-6837 if (C4::Context->preference("Version") < TransformToNum($DBversion)) { Link Here
6832
    SetVersion($DBversion);
6833
    SetVersion($DBversion);
6833
}
6834
}
6834
6835
6836
<<<<<<< HEAD
6835
$DBversion = "3.12.00.000";
6837
$DBversion = "3.12.00.000";
6836
if ( CheckVersion($DBversion) ) {
6838
if ( CheckVersion($DBversion) ) {
6837
    print "Upgrade to $DBversion done (3.12.0 release)\n";
6839
    print "Upgrade to $DBversion done (3.12.0 release)\n";
Lines 6995-7000 INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ( Link Here
6995
    SetVersion($DBversion);
6997
    SetVersion($DBversion);
6996
}
6998
}
6997
6999
7000
$DBversion = "3.13.00.XXX";
7001
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
7002
    $dbh->do(q{
7003
        INSERT INTO systempreferences (
7004
            variable,
7005
            value,
7006
            options,
7007
            explanation,
7008
            type
7009
        ) VALUES (
7010
            'IndependentBranchesMarcEditing',
7011
            '0',
7012
            '',
7013
            "If on, this preference disallows the editing of a bibliographic record unless the logged in library's branchcode matchs the branchcode stored in biblio.branchcode.",
7014
            'YesNo'
7015
        )
7016
    });
7017
7018
    $dbh->do(q{
7019
        ALTER TABLE biblio ADD branchcode VARCHAR( 10 ) NULL DEFAULT NULL
7020
    });
7021
7022
    $dbh->do(q{
7023
        ALTER TABLE deletedbiblio ADD branchcode VARCHAR( 10 ) NULL DEFAULT NULL
7024
    });
7025
7026
    print "Upgrade to $DBversion done (Bug 9681: Add some database indexes)\n";
7027
    SetVersion ($DBversion);
7028
}
6998
7029
6999
=head1 FUNCTIONS
7030
=head1 FUNCTIONS
7000
7031
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc (-5 / +16 lines)
Lines 1-3 Link Here
1
[% USE Koha %]
2
1
	<script type="text/javascript">
3
	<script type="text/javascript">
2
	//<![CDATA[
4
	//<![CDATA[
3
	[% IF ( CAN_user_editcatalogue_edit_catalogue ) %]
5
	[% IF ( CAN_user_editcatalogue_edit_catalogue ) %]
Lines 137-143 CAN_user_serials_create_subscription ) %] Link Here
137
    <div class="btn-group">
139
    <div class="btn-group">
138
    <button class="btn btn-small dropdown-toggle" data-toggle="dropdown"><i class="icon-pencil"></i> Edit <span class="caret"></span></button>
140
    <button class="btn btn-small dropdown-toggle" data-toggle="dropdown"><i class="icon-pencil"></i> Edit <span class="caret"></span></button>
139
        <ul class="dropdown-menu">
141
        <ul class="dropdown-menu">
140
            [% IF ( CAN_user_editcatalogue_edit_catalogue ) %]
142
            [% IF ( CAN_user_editcatalogue_edit_catalogue ) && ( !biblio.branchcode || CAN_user_superlibrarian || ( !Koha.Preference( 'IndependentBranchesMarcEditing' ) || ( Koha.Preference( 'IndependentBranchesMarcEditing' ) && Koha.HasIndependentGroupModificationRightsFor( biblio.branchcode ) ) ) ) %]
141
            <li><a id="editbiblio" href="/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=[% biblionumber %]&amp;frameworkcode=[% current_framework %]&amp;op=">Edit record</a></li>
143
            <li><a id="editbiblio" href="/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=[% biblionumber %]&amp;frameworkcode=[% current_framework %]&amp;op=">Edit record</a></li>
142
            [% END %]
144
            [% END %]
143
145
Lines 155-165 CAN_user_serials_create_subscription ) %] Link Here
155
            [% IF ( LocalCoverImages || OPACLocalCoverImages) %][% IF ( CAN_user_tools_upload_local_cover_images ) %]<li><a href="/cgi-bin/koha/tools/upload-cover-image.pl?biblionumber=[% biblionumber %]&amp;filetype=image">Upload image</a>[% END %][% END %]
157
            [% IF ( LocalCoverImages || OPACLocalCoverImages) %][% IF ( CAN_user_tools_upload_local_cover_images ) %]<li><a href="/cgi-bin/koha/tools/upload-cover-image.pl?biblionumber=[% biblionumber %]&amp;filetype=image">Upload image</a>[% END %][% END %]
156
158
157
            [% IF ( CAN_user_editcatalogue_edit_catalogue ) %]
159
            [% IF ( CAN_user_editcatalogue_edit_catalogue ) %]
158
            <li><a id="duplicatebiblio" href="/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=[% biblionumber %]&amp;frameworkcode=[% current_framework %]&amp;op=duplicate">Edit as new (duplicate)</a></li>
160
                <li><a id="duplicatebiblio" href="/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=[% biblionumber %]&amp;frameworkcode=[% current_framework %]&amp;op=duplicate">Edit as new (duplicate)</a></li>
159
            <li><a href="#" id="z3950copy">Replace record via Z39.50</a></li>
161
                <li><a href="#" id="z3950copy">Replace record via Z39.50</a></li>
162
163
164
                [% IF ( !biblio.branchcode || CAN_user_superlibrarian || ( !Koha.Preference( 'IndependentBranchesMarcEditing' ) || ( Koha.Preference( 'IndependentBranchesMarcEditing' ) && LoginBranchcode == biblio.branchcode ) ) ) %]
165
                    [% IF ( count ) %]
166
                        <li class="disabled">
167
                    [% ELSE %]
168
                        <li>
169
                    [% END %]
160
170
161
            [% IF ( count ) %]<li class="disabled">[% ELSE %]<li>[% END %]
171
                        <a id="deletebiblio" href="/cgi-bin/koha/cataloguing/addbiblio.pl?op=delete&amp;biblionumber=[% biblionumber %]">Delete record</a>
162
            <a id="deletebiblio" href="/cgi-bin/koha/cataloguing/addbiblio.pl?op=delete&amp;biblionumber=[% biblionumber %]">Delete record</a></li>
172
                    </li>
173
                [% END %]
163
            [% END %]
174
            [% END %]
164
175
165
            [% IF ( CAN_user_editcatalogue_edit_items ) %]
176
            [% IF ( CAN_user_editcatalogue_edit_items ) %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/admin.pref (+7 lines)
Lines 70-75 Administration: Link Here
70
                  yes: Prevent
70
                  yes: Prevent
71
                  no: "Don't prevent"
71
                  no: "Don't prevent"
72
            - staff (but not superlibrarians) from modifying objects (holds, items, patrons, etc.) belonging to other libraries.
72
            - staff (but not superlibrarians) from modifying objects (holds, items, patrons, etc.) belonging to other libraries.
73
        -
74
            - pref: IndependentBranchesMarcEditing
75
              default: 0
76
              choices:
77
                  yes: Prevent
78
                  no: "Don't prevent"
79
            - the logged in library from editing bibliographic records of other libraries. The owning library is defined by the branchcode in biblio.branchcode which should be mapped to a MARC field ( e.g. 951$o ).
73
    CAS Authentication:
80
    CAS Authentication:
74
        -
81
        -
75
            - pref: casAuthentication
82
            - pref: casAuthentication
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt (-2 / +2 lines)
Lines 1-3 Link Here
1
[% USE Koha %]
1
[% INCLUDE 'doc-head-open.inc' %]
2
[% INCLUDE 'doc-head-open.inc' %]
2
<title>Koha &rsaquo; Catalog &rsaquo; [% IF ( searchdesc ) %]Results of search [% IF ( query_desc ) %]for '[% query_desc | html %]'[% END %][% IF ( limit_desc ) %]&nbsp;with limit(s):&nbsp;'[% limit_desc | html %]'[% END %][% ELSE %]You did not specify any search criteria[% END %]</title>
3
<title>Koha &rsaquo; Catalog &rsaquo; [% IF ( searchdesc ) %]Results of search [% IF ( query_desc ) %]for '[% query_desc | html %]'[% END %][% IF ( limit_desc ) %]&nbsp;with limit(s):&nbsp;'[% limit_desc | html %]'[% END %][% ELSE %]You did not specify any search criteria[% END %]</title>
3
[% INCLUDE 'doc-head-close.inc' %]
4
[% INCLUDE 'doc-head-close.inc' %]
Lines 493-499 var holdForPatron = function () { Link Here
493
                                  <a id="reserve_[% SEARCH_RESULT.biblionumber %]" href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% SEARCH_RESULT.biblionumber %]">Holds</a>
494
                                  <a id="reserve_[% SEARCH_RESULT.biblionumber %]" href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% SEARCH_RESULT.biblionumber %]">Holds</a>
494
                                  [% IF ( holdfor ) %] <span class="holdforlink">| <a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% SEARCH_RESULT.biblionumber %]&amp;findborrower=[% holdfor_cardnumber %]">Place hold for [% holdfor_firstname %] [% holdfor_surname %] ([% holdfor_cardnumber %])</a></span>[% END %]
495
                                  [% IF ( holdfor ) %] <span class="holdforlink">| <a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% SEARCH_RESULT.biblionumber %]&amp;findborrower=[% holdfor_cardnumber %]">Place hold for [% holdfor_firstname %] [% holdfor_surname %] ([% holdfor_cardnumber %])</a></span>[% END %]
495
                              [% END %]
496
                              [% END %]
496
                          [% IF ( CAN_user_editcatalogue_edit_catalogue ) %]
497
                              [% IF ( CAN_user_editcatalogue_edit_catalogue ) && ( !SEARCH_RESULT.branchcode || CAN_user_superlibrarian || ( !Koha.Preference( 'IndependentBranchesMarcEditing' ) || ( Koha.Preference( 'IndependentBranchesMarcEditing' ) && Koha.HasIndependentGroupModificationRightsFor( SEARCH_RESULT.branchcode ) ) ) ) %]
497
                          | <a href="/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=[% SEARCH_RESULT.biblionumber %]">Edit record</a>
498
                          | <a href="/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=[% SEARCH_RESULT.biblionumber %]">Edit record</a>
498
                          [% END %]
499
                          [% END %]
499
                          [% IF ( CAN_user_editcatalogue_edit_items ) %]
500
                          [% IF ( CAN_user_editcatalogue_edit_items ) %]
500
- 

Return to bug 10263