Bugzilla – Attachment 116912 Details for
Bug 24108
Configure if biblionumber or control number is used for saved files from detail page or advanced cataloguing editor
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 24108: Advanced editor: configure if biblionumber or control number is used for saved files
Bug-24108-Advanced-editor-configure-if-biblionumbe.patch (text/plain), 5.95 KB, created by
Jonathan Druart
on 2021-02-16 11:18:11 UTC
(
hide
)
Description:
Bug 24108: Advanced editor: configure if biblionumber or control number is used for saved files
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2021-02-16 11:18:11 UTC
Size:
5.95 KB
patch
obsolete
>From 85be05ac6bc7d0d86680b9025d542c31a2c334da Mon Sep 17 00:00:00 2001 >From: Cori Lynn Arnold <carnold@dgiinc.com> >Date: Tue, 1 Dec 2020 18:16:23 +0000 >Subject: [PATCH] Bug 24108: Advanced editor: configure if biblionumber or > control number is used for saved files > >Creates a new system preference "SaveRecordbyControlNumber" (renamed in >follow-up patch with "DefaultSaveRecordFileID") which is >initially set to 0 (off/no). By default saving .mrc (and .xml) will be >saved by the biblionumber. If the record does not yet have a biblionumber, >the record will be saved as record.mrc or record.xml > >Test plan: >1) Apply the patch, flush_memcached and restart_all >2) Enable the "EnableAdvancedCatalogingEditor" system preference >4) Save the record using the drop down box selecting "Save as MARC (.mrc) > file. >5) Note that the file saved is the same as the biblionumber at the top of > the Advanced Editor interface. >6) Repeat steps 3-5 for the .xml save option >7) Update the new system preference "SaveRecordbyControlNumber" and > change to "Save by ControlNumber" >8) Verify that there is not a 001 field in the record (delete it if > there is) >9) Repeat steps 3-5 for both .mrc and .xml options (the file should still > be saved as the biblionumber if there is no control field) >10) Add a 001 field to the record such as "001 abc00012345" >11) Repeat step 4 for both .mrc and .xml and verify that the files > saved are named abc00012345.mrc and abc00012345.xml >12) Sign off! > >Signed-off-by: David Nind <david@davidnind.com> > >Signed-off-by: David Nind <david@davidnind.com> > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> > >JD amended patch: >* Remove change to obsolete sysprefs.sql >* Fix author's patch >* Update commit message to tell the syspref has been renamed >--- > ...-add_SaveRecordbyControlNumber_syspref.sql | 1 + > .../prog/en/includes/cateditor-ui.inc | 26 +++++++++++++++++-- > .../admin/preferences/cataloguing.pref | 9 +++++++ > 3 files changed, 34 insertions(+), 2 deletions(-) > create mode 100644 installer/data/mysql/atomicupdate/bug_24108-add_SaveRecordbyControlNumber_syspref.sql > >diff --git a/installer/data/mysql/atomicupdate/bug_24108-add_SaveRecordbyControlNumber_syspref.sql b/installer/data/mysql/atomicupdate/bug_24108-add_SaveRecordbyControlNumber_syspref.sql >new file mode 100644 >index 0000000000..fe5e48798e >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_24108-add_SaveRecordbyControlNumber_syspref.sql >@@ -0,0 +1 @@ >+NSERT IGNORE INTO systempreferences (variable, value, explanation, options, type) VALUES ('SaveRecordbyControlNumber', '0', 'If set, advanced editor (Rancor) will use the control number field to populate the name of the save file, otherwise it uses the biblionumber.', NULL, 'YesNo'); >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/cateditor-ui.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/cateditor-ui.inc >index 9089af4192..401724865a 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/cateditor-ui.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/cateditor-ui.inc >@@ -289,7 +289,18 @@ require( [ 'koha-backend', 'search', 'macros', 'marc-editor', 'marc-record', 'pr > 'iso2709': { > saveLabel: _("Save as MARC (.mrc) file"), > save: function( id, record, done ) { >- saveAs( new Blob( [record.toISO2709()], { 'type': 'application/octet-stream;charset=utf-8' } ), 'record.mrc' ); >+ var recname = 'record.mrc'; >+ if(state.recordID) { >+ recname = state.recordID+'.mrc'; >+ } >+ >+ [% IF (Koha.Preference('SaveRecordbyControlNumber') == '1') %] >+ var controlnumfield = record.field('001'); >+ if(controlnumfield) { >+ recname = controlnumfield.subfield('@')+'.mrc'; >+ } >+ [% END %] >+ saveAs( new Blob( [record.toISO2709()], { 'type': 'application/octet-stream;charset=utf-8' } ), recname ); > > done( {} ); > } >@@ -297,7 +308,18 @@ require( [ 'koha-backend', 'search', 'macros', 'marc-editor', 'marc-record', 'pr > 'marcxml': { > saveLabel: _("Save as MARCXML (.xml) file"), > save: function( id, record, done ) { >- saveAs( new Blob( [record.toXML()], { 'type': 'application/octet-stream;charset=utf-8' } ), 'record.xml' ); >+ var recname = 'record.mrc'; >+ if(state.recordID) { >+ recname = state.recordID+'.mrc'; >+ } >+ >+ [% IF (Koha.Preference('SaveRecordbyControlNumber') == '1') %] >+ var controlnumfield = record.field('001'); >+ if(controlnumfield) { >+ recname = controlnumfield.subfield('@')+'.xml'; >+ } >+ [% END %] >+ saveAs( new Blob( [record.toXML()], { 'type': 'application/octe t-stream;charset=utf-8' } ), recname ); > > done( {} ); > } >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref >index 575dde1c50..9988ae47d7 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref >@@ -27,6 +27,15 @@ Cataloging: > - the advanced cataloging editor. > - "<br/> <strong>NOTE:</strong>" > - Currently does not include support for UNIMARC or NORMARC fixed fields. >+ - >+ - "When saving in a MARC/MARCXML file in the advanced editor (Rancor), use the" >+ - pref: SaveRecordbyControlNumber >+ default: 0 >+ choices: >+ yes: Enable >+ yes: "Save by controlnumber" >+ no: "Save by biblionumber" >+ - "in the file name. Default is by biblionumer." > Spine labels: > - > - When using the quick spine label printer, >-- >2.20.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 24108
:
95989
|
101026
|
101027
|
101032
|
101056
|
101069
|
101381
|
101382
|
101383
|
101384
|
114081
|
114082
|
114243
|
114244
|
115033
|
115034
|
115035
|
115036
|
115038
|
115356
|
115357
|
115358
|
115359
|
116898
|
116899
|
116900
|
116901
|
116902
|
116903
| 116912 |
116913
|
116914
|
116915
|
116916
|
116917
|
116918