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

(-)a/catalogue/export.pl (-1 / +12 lines)
Lines 25-35 my $error = ''; Link Here
25
if ($op eq "export") {
25
if ($op eq "export") {
26
    my $biblionumber = $query->param("bib");
26
    my $biblionumber = $query->param("bib");
27
        if ($biblionumber){
27
        if ($biblionumber){
28
            my $file_id = $biblionumber;
29
            my $file_pre = "bib-";
28
30
29
            my $marc = GetMarcBiblio({
31
            my $marc = GetMarcBiblio({
30
                biblionumber => $biblionumber,
32
                biblionumber => $biblionumber,
31
                embed_items  => 1 });
33
                embed_items  => 1 });
32
34
35
            if( C4::Context->preference('DefaultSaveRecordFileID') eq 'controlnumber' ){
36
                my $marcflavour = C4::Context->preference('marcflavour'); #FIXME This option is required but does not change control num behaviour
37
                my $control_num = GetMarcControlnumber( $marc, $marcflavour );
38
                if( $control_num ){
39
                    $file_id = $control_num;
40
                    $file_pre = "record-";
41
                }
42
            }
43
33
            if ($format =~ /endnote/) {
44
            if ($format =~ /endnote/) {
34
                $marc = marc2endnote($marc);
45
                $marc = marc2endnote($marc);
35
                $format = 'endnote';
46
                $format = 'endnote';
Lines 74-80 if ($op eq "export") { Link Here
74
            }
85
            }
75
            print $query->header(
86
            print $query->header(
76
                -type => 'application/octet-stream',
87
                -type => 'application/octet-stream',
77
                -attachment=>"bib-$biblionumber.$format");
88
                -attachment=>"$file_pre$file_id.$format");
78
            print $marc;
89
            print $marc;
79
        }
90
        }
80
}
91
}
(-)a/installer/data/mysql/atomicupdate/bug_24108-add_SaveRecordbyControlNumber_syspref.sql (-1 / +1 lines)
Lines 3-9 if( CheckVersion( $DBversion ) ) { Link Here
3
    $dbh->do(q{
3
    $dbh->do(q{
4
         INSERT IGNORE INTO systempreferences
4
         INSERT IGNORE INTO systempreferences
5
         (variable, value, explanation, options, type) VALUES
5
         (variable, value, explanation, options, type) VALUES
6
         ('SaveRecordbyControlNumber', '0', 'If set, advanced cataloging editor will use the control number field to populate the name of the save file, otherwise it uses the biblionumber.', NULL, 'YesNo')
6
         ('DefaultSaveRecordFileID', 'biblionumber', 'Defines whether the advanced cataloging editor will use the bibliographic record number or control number field to populate the name of the save file.', 'biblionumber|controlnumber', 'Choice')
7
    });
7
    });
8
    NewVersion( $DBversion, 24108, "Add system preference SaveRecordbyControlNumber");
8
    NewVersion( $DBversion, 24108, "Add system preference SaveRecordbyControlNumber");
9
}
9
}
(-)a/installer/data/mysql/mandatory/sysprefs.sql (+1 lines)
Lines 157-162 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
157
('DefaultLongOverdueDays', '', NULL, "Set the LOST value of an item when the item has been overdue for more than n days.", 'integer'),
157
('DefaultLongOverdueDays', '', NULL, "Set the LOST value of an item when the item has been overdue for more than n days.", 'integer'),
158
('DefaultLongOverdueLostValue', '', NULL, "Set the LOST value of an item to n when the item has been overdue for more than defaultlongoverduedays days.", 'integer'),
158
('DefaultLongOverdueLostValue', '', NULL, "Set the LOST value of an item to n when the item has been overdue for more than defaultlongoverduedays days.", 'integer'),
159
('DefaultPatronSearchFields',    'surname,firstname,othernames,cardnumber,userid',NULL,'Comma separated list defining the default fields to be used during a patron search using the "standard" option. If empty Koha will default to "surname,firstname,othernames,cardnumber,userid". Additional fields added to this preference will be added as search options in the dropdown menu on the patron search page.','free'),
159
('DefaultPatronSearchFields',    'surname,firstname,othernames,cardnumber,userid',NULL,'Comma separated list defining the default fields to be used during a patron search using the "standard" option. If empty Koha will default to "surname,firstname,othernames,cardnumber,userid". Additional fields added to this preference will be added as search options in the dropdown menu on the patron search page.','free'),
160
('DefaultSaveRecordFileID','biblionumber','biblionumber|controlnumber','Defines whether the advanced cataloging editor will use the bibliographic record number or control number field to populate the name of the save file','Choice')
160
('defaultSortField','relevance','relevance|popularity|call_number|pubdate|acqdate|title|author','Specify the default field used for sorting','Choice'),
161
('defaultSortField','relevance','relevance|popularity|call_number|pubdate|acqdate|title|author','Specify the default field used for sorting','Choice'),
161
('defaultSortOrder','dsc','asc|dsc|az|za','Specify the default sort order','Choice'),
162
('defaultSortOrder','dsc','asc|dsc|az|za','Specify the default sort order','Choice'),
162
('DefaultToLoggedInLibraryCircRules',  '0', NULL ,  'If enabled, circ rules editor will default to the logged in library''s rules, rather than the ''all libraries'' rules.',  'YesNo'),
163
('DefaultToLoggedInLibraryCircRules',  '0', NULL ,  'If enabled, circ rules editor will default to the logged in library''s rules, rather than the ''all libraries'' rules.',  'YesNo'),
(-)a/installer/data/mysql/sysprefs.sql (-1 lines)
Line 1 Link Here
1
('SaveRecordbyControlNumber','0',NULL,'If set, advanced editor (Rancor) will use the control number field to populate the name of the save file, otherwise it uses the biblionumber.','YesNo')
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/cateditor-ui.inc (-12 / +12 lines)
Lines 291-304 require( [ 'koha-backend', 'search', 'macros', 'marc-editor', 'marc-record', 'pr Link Here
291
            save: function( id, record, done ) {
291
            save: function( id, record, done ) {
292
                var recname = 'record.mrc';
292
                var recname = 'record.mrc';
293
                if(state.recordID) {
293
                if(state.recordID) {
294
                    recname = state.recordID+'.mrc';
294
                    recname = 'bib-'+state.recordID+'.mrc';
295
                }
295
                }
296
296
297
                [% IF (Koha.Preference('SaveRecordbyControlNumber') == '1') %]
297
                [% IF (Koha.Preference('DefaultSaveRecordFileID') == 'controlnumber') %]
298
                var controlnumfield = record.field('001');
298
                    var controlnumfield = record.field('001');
299
                if(controlnumfield) {
299
                    if(controlnumfield) {
300
                    recname = controlnumfield.subfield('@')+'.mrc';
300
                        recname = 'record-'+controlnumfield.subfield('@')+'.mrc';
301
                }
301
                    }
302
                [% END %]
302
                [% END %]
303
                saveAs( new Blob( [record.toISO2709()], { 'type': 'application/octet-stream;charset=utf-8' } ), recname );
303
                saveAs( new Blob( [record.toISO2709()], { 'type': 'application/octet-stream;charset=utf-8' } ), recname );
304
304
Lines 310-323 require( [ 'koha-backend', 'search', 'macros', 'marc-editor', 'marc-record', 'pr Link Here
310
            save: function( id, record, done ) {
310
            save: function( id, record, done ) {
311
                var recname = 'record.xml';
311
                var recname = 'record.xml';
312
                if(state.recordID) {
312
                if(state.recordID) {
313
                    recname = state.recordID+'.xml';
313
                    recname = 'bib-'+state.recordID+'.xml';
314
                }
314
                }
315
315
316
                [% IF (Koha.Preference('SaveRecordbyControlNumber') == '1') %]
316
                [% IF (Koha.Preference('DefaultSaveRecordFileID') == 'controlnumber') %]
317
                var controlnumfield = record.field('001');
317
                    var controlnumfield = record.field('001');
318
                if(controlnumfield) {
318
                    if(controlnumfield) {
319
                    recname = controlnumfield.subfield('@')+'.xml';
319
                        recname = 'record-'+controlnumfield.subfield('@')+'.xml';
320
                }
320
                    }
321
                [% END %]
321
                [% END %]
322
                saveAs( new Blob( [record.toXML()], { 'type': 'application/octe     t-stream;charset=utf-8' } ), recname );
322
                saveAs( new Blob( [record.toXML()], { 'type': 'application/octe     t-stream;charset=utf-8' } ), recname );
323
323
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref (-6 / +5 lines)
Lines 29-41 Cataloging: Link Here
29
            - Currently does not include support for UNIMARC or NORMARC fixed fields.
29
            - Currently does not include support for UNIMARC or NORMARC fixed fields.
30
        -
30
        -
31
            - "When saving in a MARC/MARCXML file in the advanced cataloging editor, use the"
31
            - "When saving in a MARC/MARCXML file in the advanced cataloging editor, use the"
32
            - pref: SaveRecordbyControlNumber
32
            - pref: DefaultSaveRecordFileID
33
              default: 0
33
              default: biblionumber
34
              choices:
34
              choices:
35
                  yes: Enable
35
                  controlnumber: "control number"
36
                  yes: "control number"
36
                  biblionumber: "bibliographic record number"
37
                  no: "record number"
37
            - "in the file name."
38
            - "in the file name. The default is to use the bibliographic record number."
39
    Spine labels:
38
    Spine labels:
40
        -
39
        -
41
            - When using the quick spine label printer,
40
            - When using the quick spine label printer,
(-)a/opac/opac-export.pl (-5 / +15 lines)
Lines 61-66 if(!$marc) { Link Here
61
    exit;
61
    exit;
62
}
62
}
63
63
64
my $file_id = $biblionumber;
65
my $file_pre = "bib-";
66
if( C4::Context->preference('DefaultSaveRecordFileID') eq 'controlnumber' ){
67
    my $marcflavour = C4::Context->preference('marcflavour'); #FIXME This option is required but does not change control num behaviour
68
    my $control_num = GetMarcControlnumber( $marc, $marcflavour );
69
    if( $control_num ){
70
        $file_id = $control_num;
71
        $file_pre = "record-";
72
    }
73
}
74
64
# ASSERT: There is a biblionumber, because GetMarcBiblio returned something.
75
# ASSERT: There is a biblionumber, because GetMarcBiblio returned something.
65
my $framework = GetFrameworkCode( $biblionumber );
76
my $framework = GetFrameworkCode( $biblionumber );
66
my $record_processor = Koha::RecordProcessor->new({
77
my $record_processor = Koha::RecordProcessor->new({
Lines 136-162 else { Link Here
136
        print $query->header(
147
        print $query->header(
137
            -type => 'application/marc',
148
            -type => 'application/marc',
138
            -charset=>'ISO-2022',
149
            -charset=>'ISO-2022',
139
            -attachment=>"bib-$biblionumber.$format");
150
            -attachment=>"$file_pre$file_id.$format");
140
    }
151
    }
141
    elsif ( $format eq 'isbd' ) {
152
    elsif ( $format eq 'isbd' ) {
142
        print $query->header(
153
        print $query->header(
143
            -type       => 'text/plain',
154
            -type       => 'text/plain',
144
            -charset    => 'utf-8',
155
            -charset    => 'utf-8',
145
            -attachment =>  "bib-$biblionumber.txt"
156
            -attachment =>  "$file_pre$file_id.txt"
146
        );
157
        );
147
    }
158
    }
148
    elsif ( $format eq 'ris' ) {
159
    elsif ( $format eq 'ris' ) {
149
        print $query->header(
160
        print $query->header(
150
            -type => 'text/plain',
161
            -type => 'text/plain',
151
            -charset => 'utf-8',
162
            -charset => 'utf-8',
152
            -attachment => "bib-$biblionumber.$format"
163
            -attachment => "$file_pre$file_id.$format"
153
        );
164
        );
154
    } else {
165
    } else {
155
        binmode STDOUT, ':encoding(UTF-8)';
166
        binmode STDOUT, ':encoding(UTF-8)';
156
        print $query->header(
167
        print $query->header(
157
            -type => 'application/octet-stream',
168
            -type => 'application/octet-stream',
158
            -charset => 'utf-8',
169
            -charset => 'utf-8',
159
            -attachment => "bib-$biblionumber.$format"
170
            -attachment => "$file_pre$file_id.$format"
160
        );
171
        );
161
    }
172
    }
162
    print $marc;
173
    print $marc;
163
- 

Return to bug 24108