Bugzilla – Attachment 126770 Details for
Bug 14957
Write protecting MARC fields based on source of import
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 14957: (QA follow-up) Update for bug 17858
Bug-14957-QA-follow-up-Update-for-bug-17858.patch (text/plain), 18.72 KB, created by
Martin Renvoize (ashimema)
on 2021-10-22 12:36:17 UTC
(
hide
)
Description:
Bug 14957: (QA follow-up) Update for bug 17858
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2021-10-22 12:36:17 UTC
Size:
18.72 KB
patch
obsolete
>From 9481daae7f3e8d70023b6c6e0132a1fb6ff7fa3f Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Wed, 5 May 2021 16:28:30 +0100 >Subject: [PATCH] Bug 14957: (QA follow-up) Update for bug 17858 > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > .../en/modules/admin/marc-overlay-rules.tt | 514 +++++++++--------- > 1 file changed, 258 insertions(+), 256 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/marc-overlay-rules.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/marc-overlay-rules.tt >index 18bc91675c..fe278b2913 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/marc-overlay-rules.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/marc-overlay-rules.tt >@@ -1,4 +1,6 @@ > [% USE raw %] >+[% USE Asset %] >+[% SET footerjs = 1 %] > [% USE Koha %] > [% INCLUDE 'doc-head-open.inc' %] > <title>MARC overlay rules › Koha › Administration</title> >@@ -12,258 +14,6 @@ > } > </style> > >-<script> >-function doSubmit(op, id) { >- $('<input type="hidden"/>') >- .attr('name', 'op') >- .attr('value', op) >- .appendTo('#marc-overlay-rules-form'); >- >- if(id) { >- $('<input type="hidden"/>') >- .attr('name', 'id') >- .attr('value', id) >- .appendTo('#marc-overlay-rules-form'); >- } >- >- var valid = true; >- if (op == 'add' || op == 'edit') { >- var validate = [ >- $('#marc-overlay-rules-form input[name="filter"]'), >- $('#marc-overlay-rules-form input[name="tag"]') >- ]; >- for(var i = 0; i < validate.length; i++) { >- if (validate[i].length) { >- if(validate[i].val().length == 0) { >- validate[i].addClass('required'); >- valid = false; >- } else { >- validate[i].removeClass('required'); >- } >- } >- } >- } >- >- if (valid) { >- $('#marc-overlay-rules-form').submit(); >- } >- >- return valid; >-} >- >-$(document).ready(function(){ >- $('#doremove').on('click', function(){ >- doSubmit('doremove'); >- }); >- $('#doedit').on('click', function(){ >- doSubmit('doedit', $("#doedit").attr('value')); >- }); >- $('#add').on('click', function(){ >- doSubmit('add'); >- return false; >- }); >- $('#btn_batchremove').on('click', function(){ >- doSubmit('remove'); >- }); >- >- /* Disable batch remove unless one or more checkboxes are checked */ >- $('input[name="batchremove"]').change(function() { >- if($('input[name="batchremove"]:checked').length > 0) { >- $('#btn_batchremove').removeAttr('disabled'); >- } else { >- $('#btn_batchremove').attr('disabled', 'disabled'); >- } >- }); >- >- $.fn.dataTable.ext.order['dom-input'] = function (settings, col) { >- return this.api().column(col, { order: 'index' }).nodes() >- .map(function (td, i) { >- if($('input', td).val() != undefined) { >- return $('input', td).val(); >- } else if($('select', td).val() != undefined) { >- return $('option[selected="selected"]', td).val(); >- } else { >- return $(td).html(); >- } >- }); >- } >- >- $('#marc-overlay-rules').dataTable($.extend(true, {}, dataTablesDefaults, { >- "aoColumns": [ >- {"bSearchable": false, "bSortable": false}, >- {"sSortDataType": "dom-input"}, >- {"sSortDataType": "dom-input"}, >- {"bSearchable": false, "sSortDataType": "dom-input"}, >- {"bSearchable": false, "sSortDataType": "dom-input"}, >- {"bSearchable": false, "sSortDataType": "dom-input"}, >- {"bSearchable": false, "sSortDataType": "dom-input"}, >- {"bSearchable": false, "sSortDataType": "dom-input"}, >- {"bSearchable": false, "sSortDataType": "dom-input"}, >- {"bSearchable": false, "bSortable": false}, >- {"bSearchable": false, "bSortable": false} >- ], >- "pagingType": "simple" >- })); >- >- var overlay_rules_presets = {}; >- overlay_rules_presets[_("Protect")] = { >- 'add': 0, >- 'append': 0, >- 'remove': 0, >- 'delete': 0 >- }; >- overlay_rules_presets[_("Overwrite")] = { >- 'add': 1, >- 'append': 1, >- 'remove': 1, >- 'delete': 1 >- }; >- overlay_rules_presets[_("Add new")] = { >- 'add': 1, >- 'append': 0, >- 'remove': 0, >- 'delete': 0 >- }; >- overlay_rules_presets[_("Add and append")] = { >- 'add': 1, >- 'append': 1, >- 'remove': 0, >- 'delete': 0 >- }; >- overlay_rules_presets[_("Protect from deletion")] = { >- 'add': 1, >- 'append': 1, >- 'remove': 1, >- 'delete': 0 >- }; >- >- var overlay_rules_label_to_value = {}; >- overlay_rules_label_to_value[_("Add")] = 1; >- overlay_rules_label_to_value[_("Append")] = 1; >- overlay_rules_label_to_value[_("Remove")] = 1; >- overlay_rules_label_to_value[_("Delete")] = 1; >- overlay_rules_label_to_value[_("Skip")] = 0; >- >- function hash_config(config) { >- return JSON.stringify(config, Object.keys(config).sort()); >- } >- >- var overlay_rules_preset_map = {}; >- $.each(overlay_rules_presets, function(preset, config) { >- overlay_rules_preset_map[hash_config(config)] = preset; >- }); >- >- function operations_config_overlay_rule_preset(config) { >- return overlay_rules_preset_map[hash_config(config)] || ''; >- } >- >- /* Set preset values according to operation config */ >- $('.rule').each(function() { >- var $this = $(this); >- var operations_config = {}; >- $('.rule-operation-action', $this).each(function() { >- var $operation = $(this); >- operations_config[$operation.data('operation')] = overlay_rules_label_to_value[$operation.text()]; >- }); >- $('.rule-preset', $this).text( >- operations_config_overlay_rule_preset(operations_config) || _("Custom") >- ); >- }); >- >- /* Listen to operations config changes and set presets accordingly */ >- $('.rule-operation-action-edit select').change(function() { >- var operations_config = {}; >- var $parent_row = $(this).closest('tr'); >- $('.rule-operation-action-edit select', $parent_row).each(function() { >- var $this = $(this); >- operations_config[$this.attr('name')] = parseInt($this.val()); >- }); >- $('select[name="preset"]', $parent_row).val( >- operations_config_overlay_rule_preset(operations_config) >- ); >- }); >- >- /* Listen to preset changes and set operations config accordingly */ >- $('select[name="preset"]').change(function() { >- var $this = $(this); >- var $parent_row = $this.closest('tr'); >- var preset = $this.val(); >- if (preset) { >- $.each(overlay_rules_presets[preset], function(operation, action) { >- $('select[name="' + operation + '"]', $parent_row).val(action); >- }); >- } >- }); >- >- var module_filter_options = { >- source: { >- '*': '*', >- batchmod: _("Batch record modification"), >- intranet: _("Staff client MARC editor"), >- batchimport: _("Staged MARC import"), >- z3950: _("Z39.50"), >- /* bulkmarcimport: _("bulkmarcimport.pl"), */ >- import_lexile: _("import_lexile.pl") >- }, >- categorycode: { >- '*': '*', >- [% FOREACH categorycode IN categorycodes %] >- [% categorycode.categorycode | html %]: "[% categorycode.description | html %]", >- [% END %] >- } >- }; >- >- //Kind of hack: Replace filter value with label when one exist >- $('.rule-module').each(function() { >- var $this = $(this); >- var module = $this.text(); >- if (module in module_filter_options) { >- let $filter = $this.siblings('.rule-filter'); >- if ($filter.text() in module_filter_options[module]) { >- $filter.text(module_filter_options[module][$filter.text()]); >- } >- } >- }); >- >- var $filter_container = $('#filter-container'); >- >- /* Listen to module changes and set filter input accordingly */ >- $('select[name="module"]').change(function() { >- var $this = $(this); >- var module_name = $this.val(); >- >- /* Remove current element if any */ >- $filter_container.empty(); >- >- var filter_elem = null; >- if (module_name in module_filter_options) { >- // Create select element >- filter_elem = document.createElement('select'); >- for (var filter_value in module_filter_options[module_name]) { >- var option = document.createElement('option'); >- option.value = filter_value; >- option.text = module_filter_options[module_name][filter_value]; >- filter_elem.appendChild(option); >- } >- } >- else { >- // Create text input element >- filter_elem = document.createElement('input'); >- filter_elem.type = 'text'; >- filter_elem.setAttribute('size', 5); >- } >- filter_elem.name = 'filter'; >- filter_elem.id = 'filter'; >- $filter_container.append(filter_elem); >- }).change(); // Trigger change >- >- // Hack: set value if editing rule >- if ($filter_container.data('filter')) { >- $('#filter').val($filter_container.data('filter')); >- } >- >-}); >-</script> > </head> > <body id="admin_marc-overlay-rules" class="admin"> > [% INCLUDE 'header.inc' %] >@@ -502,9 +252,261 @@ $(document).ready(function(){ > </aside> > </div> > >-</div> >-<!-- /.row> >-</div> >-<!-- /main container-fluid --> >+</div><!-- /.row --> >+</div><!-- /main container-fluid --> >+ >+[% MACRO jsinclude BLOCK %] >+ <script> >+ function doSubmit(op, id) { >+ $('<input type="hidden"/>') >+ .attr('name', 'op') >+ .attr('value', op) >+ .appendTo('#marc-overlay-rules-form'); >+ >+ if(id) { >+ $('<input type="hidden"/>') >+ .attr('name', 'id') >+ .attr('value', id) >+ .appendTo('#marc-overlay-rules-form'); >+ } >+ >+ var valid = true; >+ if (op == 'add' || op == 'edit') { >+ var validate = [ >+ $('#marc-overlay-rules-form input[name="filter"]'), >+ $('#marc-overlay-rules-form input[name="tag"]') >+ ]; >+ for(var i = 0; i < validate.length; i++) { >+ if (validate[i].length) { >+ if(validate[i].val().length == 0) { >+ validate[i].addClass('required'); >+ valid = false; >+ } else { >+ validate[i].removeClass('required'); >+ } >+ } >+ } >+ } >+ >+ if (valid) { >+ $('#marc-overlay-rules-form').submit(); >+ } >+ >+ return valid; >+ } >+ >+ $(document).ready(function(){ >+ $('#doremove').on('click', function(){ >+ doSubmit('doremove'); >+ }); >+ $('#doedit').on('click', function(){ >+ doSubmit('doedit', $("#doedit").attr('value')); >+ }); >+ $('#add').on('click', function(){ >+ doSubmit('add'); >+ return false; >+ }); >+ $('#btn_batchremove').on('click', function(){ >+ doSubmit('remove'); >+ }); >+ >+ /* Disable batch remove unless one or more checkboxes are checked */ >+ $('input[name="batchremove"]').change(function() { >+ if($('input[name="batchremove"]:checked').length > 0) { >+ $('#btn_batchremove').removeAttr('disabled'); >+ } else { >+ $('#btn_batchremove').attr('disabled', 'disabled'); >+ } >+ }); >+ >+ $.fn.dataTable.ext.order['dom-input'] = function (settings, col) { >+ return this.api().column(col, { order: 'index' }).nodes() >+ .map(function (td, i) { >+ if($('input', td).val() != undefined) { >+ return $('input', td).val(); >+ } else if($('select', td).val() != undefined) { >+ return $('option[selected="selected"]', td).val(); >+ } else { >+ return $(td).html(); >+ } >+ }); >+ } >+ >+ $('#marc-overlay-rules').dataTable($.extend(true, {}, dataTablesDefaults, { >+ "aoColumns": [ >+ {"bSearchable": false, "bSortable": false}, >+ {"sSortDataType": "dom-input"}, >+ {"sSortDataType": "dom-input"}, >+ {"bSearchable": false, "sSortDataType": "dom-input"}, >+ {"bSearchable": false, "sSortDataType": "dom-input"}, >+ {"bSearchable": false, "sSortDataType": "dom-input"}, >+ {"bSearchable": false, "sSortDataType": "dom-input"}, >+ {"bSearchable": false, "sSortDataType": "dom-input"}, >+ {"bSearchable": false, "sSortDataType": "dom-input"}, >+ {"bSearchable": false, "bSortable": false}, >+ {"bSearchable": false, "bSortable": false} >+ ], >+ "pagingType": "simple" >+ })); >+ >+ var overlay_rules_presets = {}; >+ overlay_rules_presets[_("Protect")] = { >+ 'add': 0, >+ 'append': 0, >+ 'remove': 0, >+ 'delete': 0 >+ }; >+ overlay_rules_presets[_("Overwrite")] = { >+ 'add': 1, >+ 'append': 1, >+ 'remove': 1, >+ 'delete': 1 >+ }; >+ overlay_rules_presets[_("Add new")] = { >+ 'add': 1, >+ 'append': 0, >+ 'remove': 0, >+ 'delete': 0 >+ }; >+ overlay_rules_presets[_("Add and append")] = { >+ 'add': 1, >+ 'append': 1, >+ 'remove': 0, >+ 'delete': 0 >+ }; >+ overlay_rules_presets[_("Protect from deletion")] = { >+ 'add': 1, >+ 'append': 1, >+ 'remove': 1, >+ 'delete': 0 >+ }; >+ >+ var overlay_rules_label_to_value = {}; >+ overlay_rules_label_to_value[_("Add")] = 1; >+ overlay_rules_label_to_value[_("Append")] = 1; >+ overlay_rules_label_to_value[_("Remove")] = 1; >+ overlay_rules_label_to_value[_("Delete")] = 1; >+ overlay_rules_label_to_value[_("Skip")] = 0; >+ >+ function hash_config(config) { >+ return JSON.stringify(config, Object.keys(config).sort()); >+ } >+ >+ var overlay_rules_preset_map = {}; >+ $.each(overlay_rules_presets, function(preset, config) { >+ overlay_rules_preset_map[hash_config(config)] = preset; >+ }); >+ >+ function operations_config_overlay_rule_preset(config) { >+ return overlay_rules_preset_map[hash_config(config)] || ''; >+ } >+ >+ /* Set preset values according to operation config */ >+ $('.rule').each(function() { >+ var $this = $(this); >+ var operations_config = {}; >+ $('.rule-operation-action', $this).each(function() { >+ var $operation = $(this); >+ operations_config[$operation.data('operation')] = overlay_rules_label_to_value[$operation.text()]; >+ }); >+ $('.rule-preset', $this).text( >+ operations_config_overlay_rule_preset(operations_config) || _("Custom") >+ ); >+ }); > >+ /* Listen to operations config changes and set presets accordingly */ >+ $('.rule-operation-action-edit select').change(function() { >+ var operations_config = {}; >+ var $parent_row = $(this).closest('tr'); >+ $('.rule-operation-action-edit select', $parent_row).each(function() { >+ var $this = $(this); >+ operations_config[$this.attr('name')] = parseInt($this.val()); >+ }); >+ $('select[name="preset"]', $parent_row).val( >+ operations_config_overlay_rule_preset(operations_config) >+ ); >+ }); >+ >+ /* Listen to preset changes and set operations config accordingly */ >+ $('select[name="preset"]').change(function() { >+ var $this = $(this); >+ var $parent_row = $this.closest('tr'); >+ var preset = $this.val(); >+ if (preset) { >+ $.each(overlay_rules_presets[preset], function(operation, action) { >+ $('select[name="' + operation + '"]', $parent_row).val(action); >+ }); >+ } >+ }); >+ >+ var module_filter_options = { >+ source: { >+ '*': '*', >+ batchmod: _("Batch record modification"), >+ intranet: _("Staff client MARC editor"), >+ batchimport: _("Staged MARC import"), >+ z3950: _("Z39.50"), >+ /* bulkmarcimport: _("bulkmarcimport.pl"), */ >+ import_lexile: _("import_lexile.pl") >+ }, >+ categorycode: { >+ '*': '*', >+ [% FOREACH categorycode IN categorycodes %] >+ [% categorycode.categorycode | html %]: "[% categorycode.description | html %]", >+ [% END %] >+ } >+ }; >+ >+ //Kind of hack: Replace filter value with label when one exist >+ $('.rule-module').each(function() { >+ var $this = $(this); >+ var module = $this.text(); >+ if (module in module_filter_options) { >+ let $filter = $this.siblings('.rule-filter'); >+ if ($filter.text() in module_filter_options[module]) { >+ $filter.text(module_filter_options[module][$filter.text()]); >+ } >+ } >+ }); >+ >+ var $filter_container = $('#filter-container'); >+ >+ /* Listen to module changes and set filter input accordingly */ >+ $('select[name="module"]').change(function() { >+ var $this = $(this); >+ var module_name = $this.val(); >+ >+ /* Remove current element if any */ >+ $filter_container.empty(); >+ >+ var filter_elem = null; >+ if (module_name in module_filter_options) { >+ // Create select element >+ filter_elem = document.createElement('select'); >+ for (var filter_value in module_filter_options[module_name]) { >+ var option = document.createElement('option'); >+ option.value = filter_value; >+ option.text = module_filter_options[module_name][filter_value]; >+ filter_elem.appendChild(option); >+ } >+ } >+ else { >+ // Create text input element >+ filter_elem = document.createElement('input'); >+ filter_elem.type = 'text'; >+ filter_elem.setAttribute('size', 5); >+ } >+ filter_elem.name = 'filter'; >+ filter_elem.id = 'filter'; >+ $filter_container.append(filter_elem); >+ }).change(); // Trigger change >+ >+ // Hack: set value if editing rule >+ if ($filter_container.data('filter')) { >+ $('#filter').val($filter_container.data('filter')); >+ } >+ >+ }); >+ </script> >+[% END %] > [% INCLUDE 'intranet-bottom.inc' %] >-- >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 14957
:
44056
|
44057
|
44058
|
51723
|
51724
|
56637
|
56638
|
56643
|
56644
|
56645
|
56646
|
56647
|
56648
|
57114
|
57115
|
57116
|
57117
|
57118
|
57119
|
59811
|
59812
|
59885
|
60711
|
60824
|
60825
|
61065
|
61641
|
61736
|
64792
|
72498
|
74855
|
75118
|
76201
|
76202
|
76203
|
76204
|
76205
|
76206
|
76207
|
76208
|
76209
|
76210
|
78651
|
78652
|
78653
|
79367
|
79368
|
79369
|
79370
|
79890
|
80972
|
80973
|
80974
|
80975
|
81176
|
81177
|
81178
|
81179
|
81621
|
81699
|
81700
|
81705
|
81706
|
81707
|
81708
|
81969
|
81970
|
81971
|
82030
|
82031
|
82775
|
87709
|
87711
|
87771
|
87929
|
88205
|
88206
|
89961
|
90668
|
90669
|
90671
|
90672
|
90722
|
90723
|
90740
|
90741
|
92933
|
92934
|
92935
|
92936
|
92937
|
92938
|
92999
|
93499
|
94909
|
94911
|
99998
|
100052
|
100053
|
100054
|
100055
|
100056
|
100057
|
100058
|
100059
|
100060
|
100061
|
101510
|
109955
|
109956
|
109957
|
109958
|
109959
|
109960
|
109961
|
109962
|
109963
|
116622
|
116623
|
116624
|
116625
|
117844
|
117845
|
117849
|
117850
|
117853
|
117859
|
117964
|
117965
|
117966
|
118918
|
118919
|
118920
|
118921
|
118922
|
118923
|
118924
|
118925
|
118926
|
118927
|
118934
|
118935
|
118936
|
118937
|
118938
|
118939
|
118940
|
118941
|
118942
|
118943
|
118944
|
118945
|
118946
|
118957
|
120533
|
120534
|
120535
|
120536
|
120537
|
120538
|
120539
|
120540
|
120541
|
120542
|
120543
|
120544
|
120545
|
120546
|
120547
|
120548
|
120550
|
120553
|
120554
|
120555
|
120556
|
120557
|
120581
|
120582
|
120583
|
120584
|
120585
|
120586
|
120587
|
120588
|
120589
|
120590
|
120591
|
120592
|
120593
|
120594
|
120595
|
120596
|
120597
|
120598
|
120599
|
120600
|
120601
|
120602
|
120603
|
120604
|
120605
|
120670
|
120671
|
120705
|
125514
|
125515
|
125516
|
125517
|
125518
|
125519
|
125520
|
125521
|
125522
|
125523
|
125524
|
125525
|
125526
|
125527
|
125528
|
125529
|
125530
|
125531
|
125532
|
125533
|
125534
|
125535
|
125536
|
125537
|
125538
|
125539
|
125540
|
125632
|
125633
|
125636
|
126424
|
126425
|
126431
|
126592
|
126666
|
126667
|
126752
|
126753
|
126754
|
126755
|
126756
|
126757
|
126758
|
126759
|
126760
|
126761
|
126762
|
126763
|
126764
|
126765
|
126766
|
126767
|
126768
|
126769
| 126770 |
126771
|
126772
|
126773
|
126774
|
126775
|
126776
|
126777
|
126778
|
126779
|
126780
|
126781
|
126782
|
126783
|
126784
|
126785
|
126786
|
126950
|
126951