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

(-)a/C4/Auth.pm (+1 lines)
Lines 197-202 sub get_template_and_user { Link Here
197
        # to create the template's parameters that will indicate
197
        # to create the template's parameters that will indicate
198
        # which menus the user can access.
198
        # which menus the user can access.
199
        if ( $flags && $flags->{superlibrarian}==1 ) {
199
        if ( $flags && $flags->{superlibrarian}==1 ) {
200
            $template->param( CAN_user_superlibrarian   => 1 );
200
            $template->param( CAN_user_circulate        => 1 );
201
            $template->param( CAN_user_circulate        => 1 );
201
            $template->param( CAN_user_catalogue        => 1 );
202
            $template->param( CAN_user_catalogue        => 1 );
202
            $template->param( CAN_user_parameters       => 1 );
203
            $template->param( CAN_user_parameters       => 1 );
(-)a/C4/Biblio.pm (-6 / +15 lines)
Lines 3045-3056 sub _koha_add_biblio { Link Here
3045
            seriestitle = ?,
3045
            seriestitle = ?,
3046
            copyrightdate = ?,
3046
            copyrightdate = ?,
3047
            datecreated=NOW(),
3047
            datecreated=NOW(),
3048
            abstract = ?
3048
            abstract = ?,
3049
            branchcode = ?
3049
        ";
3050
        ";
3050
    my $sth = $dbh->prepare($query);
3051
    my $sth = $dbh->prepare($query);
3051
    $sth->execute(
3052
    $sth->execute(
3052
        $frameworkcode, $biblio->{'author'},      $biblio->{'title'},         $biblio->{'unititle'}, $biblio->{'notes'},
3053
        $frameworkcode,           $biblio->{'author'},
3053
        $biblio->{'serial'},        $biblio->{'seriestitle'}, $biblio->{'copyrightdate'}, $biblio->{'abstract'}
3054
        $biblio->{'title'},       $biblio->{'unititle'},
3055
        $biblio->{'notes'},       $biblio->{'serial'},
3056
        $biblio->{'seriestitle'}, $biblio->{'copyrightdate'},
3057
        $biblio->{'abstract'},    $biblio->{'branchcode'},
3054
    );
3058
    );
3055
3059
3056
    my $biblionumber = $dbh->{'mysql_insertid'};
3060
    my $biblionumber = $dbh->{'mysql_insertid'};
Lines 3087-3101 sub _koha_modify_biblio { Link Here
3087
               serial = ?,
3091
               serial = ?,
3088
               seriestitle = ?,
3092
               seriestitle = ?,
3089
               copyrightdate = ?,
3093
               copyrightdate = ?,
3090
               abstract = ?
3094
               abstract = ?,
3095
               branchcode = ?
3091
        WHERE  biblionumber = ?
3096
        WHERE  biblionumber = ?
3092
        "
3097
        "
3093
      ;
3098
      ;
3094
    my $sth = $dbh->prepare($query);
3099
    my $sth = $dbh->prepare($query);
3095
3100
3096
    $sth->execute(
3101
    $sth->execute(
3097
        $frameworkcode,      $biblio->{'author'},      $biblio->{'title'},         $biblio->{'unititle'}, $biblio->{'notes'},
3102
        $frameworkcode,           $biblio->{'author'},
3098
        $biblio->{'serial'}, $biblio->{'seriestitle'}, $biblio->{'copyrightdate'}, $biblio->{'abstract'}, $biblio->{'biblionumber'}
3103
        $biblio->{'title'},       $biblio->{'unititle'},
3104
        $biblio->{'notes'},       $biblio->{'serial'},
3105
        $biblio->{'seriestitle'}, $biblio->{'copyrightdate'},
3106
        $biblio->{'abstract'},    $biblio->{'branchcode'},
3107
        $biblio->{'biblionumber'}
3099
    ) if $biblio->{'biblionumber'};
3108
    ) if $biblio->{'biblionumber'};
3100
3109
3101
    if ( $dbh->errstr || !$biblio->{'biblionumber'} ) {
3110
    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, $flags ) = 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 / +21 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 =
175
        my $onlymine =
176
             C4::Context->preference('IndependentBranches')
176
             C4::Context->preference('IndependentBranches')
Lines 183-189 sub build_authorized_values_list { Link Here
183
            push @authorised_values, $thisbranch;
183
            push @authorised_values, $thisbranch;
184
            $authorised_lib{$thisbranch} = $branches->{$thisbranch}->{'branchname'};
184
            $authorised_lib{$thisbranch} = $branches->{$thisbranch}->{'branchname'};
185
        }
185
        }
186
186
        push( @authorised_values, q{} ) if ( $tagslib->{$tag}->{$subfield}->{'authorised_value'} eq 'branches_optional' );
187
        #----- itemtypes
187
        #----- itemtypes
188
    }
188
    }
189
    elsif ( $tagslib->{$tag}->{$subfield}->{authorised_value} eq "itemtypes" ) {
189
    elsif ( $tagslib->{$tag}->{$subfield}->{authorised_value} eq "itemtypes" ) {
Lines 808-813 if ($breedingid) { Link Here
808
    ( $record, $encoding ) = MARCfindbreeding( $breedingid ) ;
808
    ( $record, $encoding ) = MARCfindbreeding( $breedingid ) ;
809
}
809
}
810
810
811
if ( $record != -1
812
    && C4::Context->preference('IndependentBranchesMarcEditing') )
813
{
814
    my ( $field, $subfield ) =
815
      GetMarcFromKohaField( 'biblio.branchcode', $frameworkcode );
816
    if (
817
           defined( $record->field($field) )
818
        && defined( $record->subfield( $field, $subfield ) )
819
        && !GetIndependentGroupModificationRights(
820
            { for => $record->subfield( $field, $subfield ) }
821
        )
822
      )
823
    {
824
        print $input->redirect(
825
            "/cgi-bin/koha/catalogue/detail.pl?biblionumber=$biblionumber");
826
        exit;
827
    }
828
}
829
811
#populate hostfield if hostbiblionumber is available
830
#populate hostfield if hostbiblionumber is available
812
if ($hostbiblionumber) {
831
if ($hostbiblionumber) {
813
    my $marcflavour = C4::Context->preference("marcflavour");
832
    my $marcflavour = C4::Context->preference("marcflavour");
(-)a/installer/data/mysql/kohastructure.sql (+2 lines)
Lines 127-132 CREATE TABLE `biblio` ( -- table that stores bibliographic information Link Here
127
  `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, -- date and time this record was last touched
127
  `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, -- date and time this record was last touched
128
  `datecreated` DATE NOT NULL, -- the date this record was added to Koha
128
  `datecreated` DATE NOT NULL, -- the date this record was added to Koha
129
  `abstract` mediumtext, -- summary from the MARC record (520$a in MARC21)
129
  `abstract` mediumtext, -- summary from the MARC record (520$a in MARC21)
130
  `branchcode` VARCHAR( 10 ) NULL DEFAULT NULL, -- branchcode for the opationl 'owner' of this record.
130
  PRIMARY KEY  (`biblionumber`),
131
  PRIMARY KEY  (`biblionumber`),
131
  KEY `blbnoidx` (`biblionumber`)
132
  KEY `blbnoidx` (`biblionumber`)
132
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
133
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
Lines 740-745 CREATE TABLE `deletedbiblio` ( -- stores information about bibliographic records Link Here
740
  `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, -- date and time this record was last touched
741
  `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, -- date and time this record was last touched
741
  `datecreated` DATE NOT NULL, -- the date this record was added to Koha
742
  `datecreated` DATE NOT NULL, -- the date this record was added to Koha
742
  `abstract` mediumtext, -- summary from the MARC record (520$a in MARC21)
743
  `abstract` mediumtext, -- summary from the MARC record (520$a in MARC21)
744
  `branchcode` VARCHAR( 10 ) NULL DEFAULT NULL, -- branchcode for the opationl 'owner' of this record.
743
  PRIMARY KEY  (`biblionumber`),
745
  PRIMARY KEY  (`biblionumber`),
744
  KEY `blbnoidx` (`biblionumber`)
746
  KEY `blbnoidx` (`biblionumber`)
745
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
747
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
(-)a/installer/data/mysql/updatedatabase.pl (-2 / +33 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 7153-7159 if ( CheckVersion($DBversion) ) { Link Here
7153
7154
7154
$DBversion = "3.13.00.XXX";
7155
$DBversion = "3.13.00.XXX";
7155
if ( CheckVersion($DBversion) ) {
7156
if ( CheckVersion($DBversion) ) {
7156
    $dbh->do("
7157
    $dbh->do(q{
7157
        INSERT INTO systempreferences (
7158
        INSERT INTO systempreferences (
7158
            variable,
7159
            variable,
7159
            value,
7160
            value,
Lines 7167-7173 if ( CheckVersion($DBversion) ) { Link Here
7167
            'If on, the staff interface search will hide all records that do not contain an item owned by the logged in branch, and hide the items themselves.',
7168
            'If on, the staff interface search will hide all records that do not contain an item owned by the logged in branch, and hide the items themselves.',
7168
            'YesNo'
7169
            'YesNo'
7169
        )
7170
        )
7170
    ");
7171
    });
7171
    print "Upgrade to $DBversion done (Bug 10278 - Add ability to hide items and records from search results for Independent Branches)\n";
7172
    print "Upgrade to $DBversion done (Bug 10278 - Add ability to hide items and records from search results for Independent Branches)\n";
7172
    SetVersion ($DBversion);
7173
    SetVersion ($DBversion);
7173
}
7174
}
Lines 7876-7881 if(CheckVersion($DBversion)) { Link Here
7876
    SetVersion($DBversion);
7877
    SetVersion($DBversion);
7877
}
7878
}
7878
7879
7880
$DBversion = "3.13.00.XXX";
7881
if ( CheckVersion($DBversion) ) {
7882
    $dbh->do(q{
7883
        INSERT INTO systempreferences (
7884
            variable,
7885
            value,
7886
            options,
7887
            explanation,
7888
            type
7889
        ) VALUES (
7890
            'IndependentBranchesMarcEditing',
7891
            '0',
7892
            '',
7893
            "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.",
7894
            'YesNo'
7895
        )
7896
    });
7897
7898
    $dbh->do(q{
7899
        ALTER TABLE biblio ADD branchcode VARCHAR( 10 ) NULL DEFAULT NULL
7900
    });
7901
7902
    $dbh->do(q{
7903
        ALTER TABLE deletedbiblio ADD branchcode VARCHAR( 10 ) NULL DEFAULT NULL
7904
    });
7905
7906
    print "Upgrade to $DBversion done (Bug 10263 - Add ability to limit which branch can edit a bibliographic record)\n";
7907
    SetVersion ($DBversion);
7908
}
7909
7879
=head1 FUNCTIONS
7910
=head1 FUNCTIONS
7880
7911
7881
=head2 TableExists($table)
7912
=head2 TableExists($table)
(-)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 152-158 CAN_user_serials_create_subscription ) %] Link Here
152
    <div class="btn-group">
154
    <div class="btn-group">
153
    <button class="btn btn-small dropdown-toggle" data-toggle="dropdown"><i class="icon-pencil"></i> Edit <span class="caret"></span></button>
155
    <button class="btn btn-small dropdown-toggle" data-toggle="dropdown"><i class="icon-pencil"></i> Edit <span class="caret"></span></button>
154
        <ul class="dropdown-menu">
156
        <ul class="dropdown-menu">
155
            [% IF ( CAN_user_editcatalogue_edit_catalogue ) %]
157
            [% IF ( CAN_user_editcatalogue_edit_catalogue ) && ( !biblio.branchcode || CAN_user_superlibrarian || ( !Koha.Preference( 'IndependentBranchesMarcEditing' ) || ( Koha.Preference( 'IndependentBranchesMarcEditing' ) && Koha.HasIndependentGroupModificationRightsFor( biblio.branchcode ) ) ) ) %]
156
            <li><a id="editbiblio" href="/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=[% biblionumber %]&amp;frameworkcode=[% current_framework %]&amp;op=">Edit record</a></li>
158
            <li><a id="editbiblio" href="/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=[% biblionumber %]&amp;frameworkcode=[% current_framework %]&amp;op=">Edit record</a></li>
157
            [% END %]
159
            [% END %]
158
160
Lines 170-180 CAN_user_serials_create_subscription ) %] Link Here
170
            [% 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 %]
172
            [% 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 %]
171
173
172
            [% IF ( CAN_user_editcatalogue_edit_catalogue ) %]
174
            [% IF ( CAN_user_editcatalogue_edit_catalogue ) %]
173
            <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>
175
                <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>
174
            <li><a href="#" id="z3950copy">Replace record via Z39.50</a></li>
176
                <li><a href="#" id="z3950copy">Replace record via Z39.50</a></li>
177
178
179
                [% IF ( !biblio.branchcode || CAN_user_superlibrarian || ( !Koha.Preference( 'IndependentBranchesMarcEditing' ) || ( Koha.Preference( 'IndependentBranchesMarcEditing' ) && LoginBranchcode == biblio.branchcode ) ) ) %]
180
                    [% IF ( count ) %]
181
                        <li class="disabled">
182
                    [% ELSE %]
183
                        <li>
184
                    [% END %]
175
185
176
            [% IF ( count ) %]<li class="disabled">[% ELSE %]<li>[% END %]
186
                        <a id="deletebiblio" href="/cgi-bin/koha/cataloguing/addbiblio.pl?op=delete&amp;biblionumber=[% biblionumber %]">Delete record</a>
177
            <a id="deletebiblio" href="/cgi-bin/koha/cataloguing/addbiblio.pl?op=delete&amp;biblionumber=[% biblionumber %]">Delete record</a></li>
187
                    </li>
188
                [% END %]
178
            [% END %]
189
            [% END %]
179
190
180
            [% IF ( CAN_user_editcatalogue_edit_items ) %]
191
            [% IF ( CAN_user_editcatalogue_edit_items ) %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/admin.pref (-1 / +8 lines)
Lines 76-82 Administration: Link Here
76
              choices:
76
              choices:
77
                  yes: Prevent
77
                  yes: Prevent
78
                  no: "Don't prevent"
78
                  no: "Don't prevent"
79
            - staff from seeing items owned by other libraries, and records without any items the library.
79
            - staff from seeing items owned by other libraries, and records without any items the library ( requires IndependentBranches ).
80
        -
81
            - pref: IndependentBranchesMarcEditing
82
              default: 0
83
              choices:
84
                  yes: Prevent
85
                  no: "Don't prevent"
86
            - 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 ).
80
    CAS Authentication:
87
    CAS Authentication:
81
        -
88
        -
82
            - pref: casAuthentication
89
            - 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 517-523 var holdForPatron = function () { Link Here
517
                                  <a id="reserve_[% SEARCH_RESULT.biblionumber %]" href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% SEARCH_RESULT.biblionumber %]">Holds</a>
518
                                  <a id="reserve_[% SEARCH_RESULT.biblionumber %]" href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% SEARCH_RESULT.biblionumber %]">Holds</a>
518
                                  [% 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 %]
519
                                  [% 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 %]
519
                              [% END %]
520
                              [% END %]
520
                          [% IF ( CAN_user_editcatalogue_edit_catalogue ) %]
521
                              [% IF ( CAN_user_editcatalogue_edit_catalogue ) && ( !SEARCH_RESULT.branchcode || CAN_user_superlibrarian || ( !Koha.Preference( 'IndependentBranchesMarcEditing' ) || ( Koha.Preference( 'IndependentBranchesMarcEditing' ) && Koha.HasIndependentGroupModificationRightsFor( SEARCH_RESULT.branchcode ) ) ) ) %]
521
                          | <a href="/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=[% SEARCH_RESULT.biblionumber %]">Edit record</a>
522
                          | <a href="/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=[% SEARCH_RESULT.biblionumber %]">Edit record</a>
522
                          [% END %]
523
                          [% END %]
523
                          [% IF ( CAN_user_editcatalogue_edit_items ) %]
524
                          [% IF ( CAN_user_editcatalogue_edit_items ) %]
524
- 

Return to bug 10263