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

(-)a/C4/Biblio.pm (+21 lines)
Lines 271-276 sub AddBiblio { Link Here
271
    # update MARC subfield that stores biblioitems.cn_sort
271
    # update MARC subfield that stores biblioitems.cn_sort
272
    _koha_marc_update_biblioitem_cn_sort( $record, $olddata, $frameworkcode );
272
    _koha_marc_update_biblioitem_cn_sort( $record, $olddata, $frameworkcode );
273
273
274
    # update the control number (001) in MARC
275
    if(C4::Context->preference('autoControlNumber') eq 'biblionumber'){
276
        unless($record->field('001')){
277
            $record->insert_fields_ordered(MARC::Field->new('001', $biblionumber));
278
        }elsif($record->field('001')->data() eq 'biblionumber'){
279
            $record->field('001')->update($biblionumber);
280
        }
281
    }elsif(C4::Context->preference('autoControlNumber') eq 'incremental'){
282
        my $incrementalCN=C4::Context->preference('incrementalControlNumber');
283
        unless($record->field('001')){
284
            $record->insert_fields_ordered(MARC::Field->new('001', $incrementalCN));
285
        }elsif($record->field('001')->data() eq 'incremental'){
286
            $record->field('001')->update($incrementalCN);
287
        }
288
        if($record->field('001')->data() eq $incrementalCN){
289
            my $sth = $dbh->prepare(q{UPDATE systempreferences SET value = ? WHERE variable = 'incrementalControlNumber'});
290
            $sth->execute(int($record->field('001')->data())+1);
291
            $sth->finish();
292
        }
293
    }
294
    
274
    # now add the record
295
    # now add the record
275
    ModBiblioMarc( $record, $biblionumber, $frameworkcode ) unless $defer_marc_save;
296
    ModBiblioMarc( $record, $biblionumber, $frameworkcode ) unless $defer_marc_save;
276
297
(-)a/cataloguing/value_builder/marc21_field_001.pl (+90 lines)
Line 0 Link Here
1
#!/usr/bin/perl
2
3
4
# Copyright 2013 MASmedios for information management
5
#
6
# This file is part of Koha.
7
#
8
# Koha is free software; you can redistribute it and/or modify it under the
9
# terms of the GNU General Public License as published by the Free Software
10
# Foundation; either version 2 of the License, or (at your option) any later
11
# version.
12
#
13
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
14
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
15
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
16
#
17
# You should have received a copy of the GNU General Public License along
18
# with Koha; if not, write to the Free Software Foundation, Inc.,
19
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20
21
use strict;
22
#use warnings; FIXME - Bug 2505
23
use C4::Context;
24
25
=head1
26
27
plugin_parameters : other parameters added when the plugin is called by the dopop function
28
29
=cut
30
31
sub plugin_parameters {
32
    # my ($dbh,$record,$tagslib,$i,$tabloop) = @_;
33
    return "";
34
}
35
36
=head1
37
38
plugin_javascript : the javascript function called when the user enters the subfield.
39
contain 3 javascript functions :
40
* one called when the field is entered (OnFocus). Named FocusXXX
41
* one called when the field is leaved (onBlur). Named BlurXXX
42
* one called when the ... link is clicked (<a href="javascript:function">) named ClicXXX
43
44
returns :
45
* XXX
46
* a variable containing the 3 scripts.
47
the 3 scripts are inserted after the <input> in the html code
48
49
=cut
50
51
sub plugin_javascript {
52
    my ($dbh,$record,$tagslib,$field_number,$tabloop) = @_;
53
    my $function_name= $field_number;
54
    my $res;
55
    my $autoControlNumber = C4::Context->preference('autoControlNumber');
56
    unless($autoControlNumber eq 'OFF'){
57
        my $control_number = $autoControlNumber;
58
        $res  = "
59
<script type=\"text/javascript\">
60
//<![CDATA[
61
62
function Blur$function_name(index) {
63
//need this?
64
}
65
66
function Focus$function_name(subfield_managed) {
67
    document.getElementById(\"$field_number\").value='$control_number';
68
    return 0;
69
}
70
71
function Clic$function_name(subfield_managed) {
72
}
73
//]]>
74
</script>
75
";
76
    }
77
    return ($function_name,$res);
78
}
79
80
=head1
81
82
plugin : the true value_builded. The screen that is open in the popup window.
83
84
=cut
85
86
sub plugin {
87
    return "";
88
}
89
90
1;
(-)a/installer/data/mysql/sysprefs.sql (+2 lines)
Lines 427-429 INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES(' Link Here
427
INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES('UseCourseReserves', '0', 'Enable the course reserves feature.', NULL, 'YesNo');
427
INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES('UseCourseReserves', '0', 'Enable the course reserves feature.', NULL, 'YesNo');
428
INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacShowHoldNotes',0,'Show hold notes on OPAC','','YesNo');
428
INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacShowHoldNotes',0,'Show hold notes on OPAC','','YesNo');
429
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('CalculateFinesOnReturn','1','Switch to control if overdue fines are calculated on return or not', '', 'YesNo');
429
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('CalculateFinesOnReturn','1','Switch to control if overdue fines are calculated on return or not', '', 'YesNo');
430
INSERT INTO systempreferences (variable, value, options, explanation, type) VALUES ('autoControlNumber','OFF','incremental|biblionumber|OFF','Used to autogenerate a Control Number: incremental will be of the form 1, 2, 3; biblionumber will be as biblionumber;','Choice');
431
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('incrementalControlNumber', '1', 'Set the number (controlnumber) of the next bibliographic record.',NULL,'');
(-)a/installer/data/mysql/updatedatabase.pl (+16 lines)
Lines 6983-6988 INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ( Link Here
6983
    SetVersion($DBversion);
6983
    SetVersion($DBversion);
6984
}
6984
}
6985
6985
6986
$DBversion = "3.13.00.XXX";
6987
if ( CheckVersion($DBversion) ) {
6988
    $dbh->do(
6989
        q{
6990
INSERT INTO systempreferences (variable, value, options, explanation, type) VALUES ('autoControlNumber','OFF','incremental|biblionumber|OFF','Used to autogenerate a Control Number: incremental will be of the form 1, 2, 3; biblionumber will be as biblionumber;','Choice');
6991
}
6992
    );
6993
    $dbh->do(
6994
        q{
6995
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('incrementalControlNumber', '1', 'Set the number (controlnumber) of the next bibliographic record.',NULL,'');
6996
}
6997
    );
6998
    print
6999
"Upgrade to $DBversion done (Bug 9921 - Make it possible to force 001 = biblionumber)\n";
7000
    SetVersion($DBversion);
7001
}
6986
7002
6987
=head1 FUNCTIONS
7003
=head1 FUNCTIONS
6988
7004
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref (-1 / +12 lines)
Lines 109-114 Cataloging: Link Here
109
            - pref: UNIMARCField100Language
109
            - pref: UNIMARCField100Language
110
              class: short
110
              class: short
111
            - as default language in the UNIMARC field 100 when creating a new record or in the field plugin.
111
            - as default language in the UNIMARC field 100 when creating a new record or in the field plugin.
112
        -
113
            - Control Number (001) is
114
            - pref: autoControlNumber
115
              choices:
116
                  biblionumber: generated as biblionumber.
117
                  incremental: generated in the form 1, 2, 3.
118
                  "OFF": not generated automatically.
119
        -
120
            - Use Control Number (001)
121
            - pref: incrementalControlNumber
122
              class: integer
123
            - as incremental number. This requires incremental option on autoControlNumber.
112
    Display:
124
    Display:
113
        -
125
        -
114
            - 'Separate multiple displayed authors, series or subjects with '
126
            - 'Separate multiple displayed authors, series or subjects with '
115
- 

Return to bug 9921