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/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 61-66 my ( $template, $borrowernumber, $cookie ) = get_template_and_user( Link Here
61
my $biblionumber = $query->param('biblionumber');
61
my $biblionumber = $query->param('biblionumber');
62
my $record       = GetMarcBiblio($biblionumber);
62
my $record       = GetMarcBiblio($biblionumber);
63
63
64
$template->param( biblio => GetBiblio( $biblionumber ) );
65
64
if ( not defined $record ) {
66
if ( not defined $record ) {
65
    # biblionumber invalid -> report and exit
67
    # biblionumber invalid -> report and exit
66
    $template->param( unknownbiblionumber => 1,
68
    $template->param( unknownbiblionumber => 1,
(-)a/cataloguing/addbiblio.pl (-2 / +2 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('IndependantBranches') && 
175
        my $onlymine=C4::Context->preference('IndependantBranches') && 
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" ) {
(-)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 613-618 CREATE TABLE `deletedbiblio` ( -- stores information about bibliographic records Link Here
613
  `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, -- date and time this record was last touched
614
  `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, -- date and time this record was last touched
614
  `datecreated` DATE NOT NULL, -- the date this record was added to Koha
615
  `datecreated` DATE NOT NULL, -- the date this record was added to Koha
615
  `abstract` mediumtext, -- summary from the MARC record (520$a in MARC21)
616
  `abstract` mediumtext, -- summary from the MARC record (520$a in MARC21)
617
  `branchcode` VARCHAR( 10 ) NULL DEFAULT NULL, -- branchcode for the opationl 'owner' of this record.
616
  PRIMARY KEY  (`biblionumber`),
618
  PRIMARY KEY  (`biblionumber`),
617
  KEY `blbnoidx` (`biblionumber`)
619
  KEY `blbnoidx` (`biblionumber`)
618
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
620
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
(-)a/installer/data/mysql/updatedatabase.pl (+31 lines)
Lines 6802-6807 if (C4::Context->preference("Version") < TransformToNum($DBversion)) { Link Here
6802
            ADD KEY `branchcode_idx` (`branchcode`),
6802
            ADD KEY `branchcode_idx` (`branchcode`),
6803
            ADD KEY `issuingbranch_idx` (`issuingbranch`)
6803
            ADD KEY `issuingbranch_idx` (`issuingbranch`)
6804
    });
6804
    });
6805
6805
    #items
6806
    #items
6806
    $dbh->do(q{
6807
    $dbh->do(q{
6807
        ALTER TABLE `items` ADD KEY `itype_idx` (`itype`)
6808
        ALTER TABLE `items` ADD KEY `itype_idx` (`itype`)
Lines 6834-6839 if (C4::Context->preference("Version") < TransformToNum($DBversion)) { Link Here
6834
    SetVersion($DBversion);
6835
    SetVersion($DBversion);
6835
}
6836
}
6836
6837
6838
$DBversion = "3.11.00.XXX";
6839
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
6840
    $dbh->do(q{
6841
        INSERT INTO systempreferences (
6842
            variable,
6843
            value,
6844
            options,
6845
            explanation,
6846
            type
6847
        ) VALUES (
6848
            'IndependentBranchesMarcEditing',
6849
            '0',
6850
            '',
6851
            "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.",
6852
            'YesNo'
6853
        )
6854
    });
6855
6856
    $dbh->do(q{
6857
        ALTER TABLE biblio ADD branchcode VARCHAR( 10 ) NULL DEFAULT NULL
6858
    });
6859
6860
    $dbh->do(q{
6861
        ALTER TABLE deletedbiblio ADD branchcode VARCHAR( 10 ) NULL DEFAULT NULL
6862
    });
6863
6864
    print "Upgrade to $DBversion done (Bug 9681: Add some database indexes)\n";
6865
    SetVersion ($DBversion);
6866
}
6867
6837
=head1 FUNCTIONS
6868
=head1 FUNCTIONS
6838
6869
6839
=head2 TableExists($table)
6870
=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 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' ) && LoginBranchcode == 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 (-1 / +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
76
- 

Return to bug 10263