Bugzilla – Attachment 86130 Details for
Bug 16251
Material type is not correctly set for Rancor 008 widget
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 16251: Fix value of material select for Rancor 008 widget
Bug-16251-Fix-value-of-material-select-for-Rancor-.patch (text/plain), 3.42 KB, created by
Julian Maurice
on 2019-03-06 08:05:55 UTC
(
hide
)
Description:
Bug 16251: Fix value of material select for Rancor 008 widget
Filename:
MIME Type:
Creator:
Julian Maurice
Created:
2019-03-06 08:05:55 UTC
Size:
3.42 KB
patch
obsolete
>From eed33a49438f1d0e7cebbb355e6dc57bbcc32738 Mon Sep 17 00:00:00 2001 >From: Julian Maurice <julian.maurice@biblibre.com> >Date: Wed, 6 Mar 2019 08:58:03 +0100 >Subject: [PATCH] Bug 16251: Fix value of material select for Rancor 008 widget > >The material type is selected in accordance with the leader (06-07) > >Test plan: >1. Create a new record using the advanced editor >2. Set the leader 6th position to 'c' >3. Save the record and reload the page >4. 'Music' should be automatically selected for 008 >5. Try other values for the leader 6th and 7th positions > >See comment 0 of this bug for the complete mapping >--- > .../lib/koha/cateditor/widget.js | 7 +++++ > .../en/includes/cateditor-widgets-marc21.inc | 26 ++++++++++++++++++- > 2 files changed, 32 insertions(+), 1 deletion(-) > >diff --git a/koha-tmpl/intranet-tmpl/lib/koha/cateditor/widget.js b/koha-tmpl/intranet-tmpl/lib/koha/cateditor/widget.js >index bfb1ea1697..be0623699c 100644 >--- a/koha-tmpl/intranet-tmpl/lib/koha/cateditor/widget.js >+++ b/koha-tmpl/intranet-tmpl/lib/koha/cateditor/widget.js >@@ -121,6 +121,13 @@ define( [ 'resources' ], function( Resources ) { > materialInfo[ $(this).attr('id') ] = this; > } ); > >+ if (widget.getMaterial) { >+ const material = widget.getMaterial(); >+ if (material) { >+ $matSelect.val(material); >+ } >+ } >+ > $matSelect.change( function() { > widget.loadXMLMaterial( materialInfo[ $matSelect.val() ] ); > widget.nodeChanged(); >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/cateditor-widgets-marc21.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/cateditor-widgets-marc21.inc >index f1cb70c1cd..4b5688554f 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/cateditor-widgets-marc21.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/cateditor-widgets-marc21.inc >@@ -85,7 +85,7 @@ > * single subfield, '@'. > */ > >-require( [ 'koha-backend', 'widget' ], function( KohaBackend, Widget ) { >+require( [ 'koha-backend', 'widget', 'text-marc' ], function( KohaBackend, Widget, TextMarc ) { > Widget.Register( '000@', { > makeTemplate: function() { > return ' nam a22 7a 4500'; >@@ -237,6 +237,30 @@ require( [ 'koha-backend', 'widget' ], function( KohaBackend, Widget ) { > > return $result[0]; > }, >+ materialTypeMapping: { >+ a: { >+ a: 'BKS', c: 'BKS', d: 'BKS', m: 'BKS', >+ b: 'CR', i: 'CR', s: 'CR', >+ }, >+ t: 'BKS', >+ c: 'MU', d: 'MU', i: 'MU', j: 'MU', >+ e: 'MP', f: 'MP', >+ g: 'VM', k: 'VM', o: 'VM', r: 'VM', >+ m: 'CF', >+ p: 'MX', >+ }, >+ getMaterial: function () { >+ const record = TextMarc.TextToRecord(this.editor.cm.getValue()); >+ const leader = record.leader(); >+ const leader6 = leader.substring(6, 7); >+ let materialType = this.materialTypeMapping[leader6]; >+ if (typeof materialType === 'object') { >+ const leader7 = leader.substring(7, 8); >+ materialType = materialType[leader7]; >+ } >+ >+ return materialType; >+ }, > postCreate: function( node, mark ) { > this.createFromXML( 'marc21/xml/008' ); > } >-- >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 16251
:
86130
|
86213
|
86239