Bugzilla – Attachment 28714 Details for
Bug 9093
008 forgetting what material type was chosen
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[PASSED QA] Bug 9093 - 008 forgetting what material type was chosen
PASSED-QA-Bug-9093---008-forgetting-what-material-.patch (text/plain), 6.62 KB, created by
Kyle M Hall (khall)
on 2014-06-06 18:02:00 UTC
(
hide
)
Description:
[PASSED QA] Bug 9093 - 008 forgetting what material type was chosen
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2014-06-06 18:02:00 UTC
Size:
6.62 KB
patch
obsolete
>From 9796cfc26e5514dc727d68c007e473c9fceaad5c Mon Sep 17 00:00:00 2001 >From: David Cook <dcook@prosentient.com.au> >Date: Fri, 6 Jun 2014 14:01:17 +1000 >Subject: [PATCH] [PASSED QA] Bug 9093 - 008 forgetting what material type was chosen > >This patch adds material type checking to the MARC21 008 tag editor, >based on value from the leader. That is, the 008 tag editor >will choose an initial material type based on the leader 06 >(and if necessary the leader 07 position) > >_TEST PLAN_ >1) Create a new record or open an existing bib record >2) Change position 6 from its current value (probably "a") to >"c" or "e" or "g" or "m" or "p". (See the end of this message >for a comprehensive list of 06 values to try.) >3) Open the 008 tag editor >4) Note that it still says BKS even though it should say "MU" >or "MP" or "VM" or "CF" or "MX". > >5) Apply the patch > >6) Repeat steps 2 and 3. >7) Note that the 008 tag editor now shows the correct material >type based on the leader. > >8) For more comprehensive checking, try switching position 6 >back to "a" and changing position 7 to "b" instead of "m". >9) Note that it will switch from "BKS" to "CR". >10) Fin > >Comprehensive mapping: > >Field 008/18-34 Configuration >If Leader/06 = a and Leader/07 = a, c, d, or m: Books >If Leader/06 = a and Leader/07 = b, i, or s: Continuing Resources >If Leader/06 = t: Books >If Leader/06 = c, d, i, or j: Music >If Leader/06 = e, or f: Maps >If Leader/06 = g, k, o, or r: Visual Materials >If Leader/06 = m: Computer Files >If Leader/06 = p: Mixed Materials >http://www.loc.gov/marc/bibliographic/bdleader.html > >Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> >Work as described, nice job. >koha-qa complains for a tab char, removed on followup. >Mode change on TT file (+x), removed. >No other errors > >NOTE: It would be desirable to update LEADER values >to reflect changes on 008. > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > cataloguing/value_builder/marc21_field_008.pl | 58 +++++++++++++++++++- > .../cataloguing/value_builder/marc21_field_008.tt | 4 ++ > 2 files changed, 61 insertions(+), 1 deletions(-) > >diff --git a/cataloguing/value_builder/marc21_field_008.pl b/cataloguing/value_builder/marc21_field_008.pl >index 6fbb3d1..ab30454 100755 >--- a/cataloguing/value_builder/marc21_field_008.pl >+++ b/cataloguing/value_builder/marc21_field_008.pl >@@ -72,7 +72,14 @@ function Blur$function_name(subfield_managed) { > > function Clic$function_name(i) { > defaultvalue=document.getElementById(\"$field_number\").value; >- newin=window.open(\"../cataloguing/plugin_launcher.pl?plugin_name=marc21_field_008.pl&index=$field_number&result=\"+defaultvalue,\"tag_editor\",'width=1000,height=600,toolbar=false,scrollbars=yes'); >+ //Retrieve full leader string and pass it to the 008 tag editor >+ var leader_value = \$(\"input[id^='tag_000']\").val(); >+ var leader_parameter = \"\"; >+ if (leader_value){ >+ //Only add the parameter to the URL if there is a value to add >+ leader_parameter = \"&leader=\"+leader_value; >+ } >+ newin=window.open(\"../cataloguing/plugin_launcher.pl?plugin_name=marc21_field_008.pl&index=$field_number&result=\"+defaultvalue+leader_parameter,\"tag_editor\",'width=1000,height=600,toolbar=false,scrollbars=yes'); > > } > //]]> >@@ -90,6 +97,54 @@ sub plugin { > my ($input) = @_; > my $index = $input->param('index'); > my $result = $input->param('result'); >+ my $leader = $input->param('leader'); >+ >+ my $material_configuration; >+ if ($leader && length($leader) == '24') { >+ #MARC 21 Material Type Configuration >+ #Field 008/18-34 Configuration >+ #If Leader/06 = a and Leader/07 = a, c, d, or m: Books >+ #If Leader/06 = a and Leader/07 = b, i, or s: Continuing Resources >+ #If Leader/06 = t: Books >+ #If Leader/06 = c, d, i, or j: Music >+ #If Leader/06 = e, or f: Maps >+ #If Leader/06 = g, k, o, or r: Visual Materials >+ #If Leader/06 = m: Computer Files >+ #If Leader/06 = p: Mixed Materials >+ #http://www.loc.gov/marc/bibliographic/bdleader.html >+ my $material_configuration_mapping = { >+ 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', >+ }; >+ my $leader06 = substr($leader, 6, 1); >+ my $leader07 = substr($leader, 7, 1); >+ #Retrieve material type using leader06 >+ $material_configuration = $material_configuration_mapping->{$leader06}; >+ #If the value returned is a ref (i.e. leader06 is 'a'), then use leader07 to get the actual material type >+ if ( ($material_configuration) && (ref($material_configuration) eq 'HASH') ){ >+ $material_configuration = $material_configuration->{$leader07}; >+ } >+ } > > my $dbh = C4::Context->dbh; > >@@ -123,6 +178,7 @@ sub plugin { > index => $index, > result => $result, > errorXml => $errorXml, >+ material_configuration => $material_configuration, > ); > output_html_with_http_headers $input, $cookie, $template->output; > } >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/marc21_field_008.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/marc21_field_008.tt >index 5bb381b..fc2499a 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/marc21_field_008.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/marc21_field_008.tt >@@ -17,6 +17,10 @@ > h4_result = document.getElementById("h4_result"); > tr_result = document.getElementById("tr_result"); > objXmlControlField = new xmlControlField('[% tagfield %]', 'f_pop', document.getElementById('material_type'), document.getElementById('table_material_types'), 'h4_result', 'tr_result', '', '[% themelang %]', '[% marcflavour %]'); >+ [%# If material type configuration is found using the leader, use that type when rendering. Otherwise, the default of BKS will be used %] >+ [% IF ( material_configuration ) %] >+ objXmlControlField.idMaterial = "[% material_configuration %]"; >+ [% END %] > objXmlControlField.loadXmlValues(); > renderResult(tr_result, (form.result.value != "")?form.result.value:returnValueParam("result")); > [% END %] >-- >1.7.2.5
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 9093
:
20789
|
28690
|
28691
|
28696
|
28697
| 28714