Koha/koha-tmpl/intranet-tmpl/prog/js
Petro Vashchuk 43f9758c3d Bug 27508: do nothing if tag label elements don't exist
When JavaScript make copy of DOM set for MARC tag, it tries to reassign
label elements to another id, the problem is there is no check for
existence of that label element, so in case when option
"advancedMARCeditor" is set to "Don't display", labels were absent
which caused JavaScript to crush in the middle of process with uncaught
exception.

This patch wraps this label assignment in try/catch hook like it's done
in the code around for other elements, to allow the script to proceed
when description labels are not present.

To test:
1) Check in the system preferences interface subsection that
   "advancedMARCeditor" is set to "Display".
2) Go to the "Add MARC record" cataloguing section and press "Repeat
   this tag" button near the MARC tag record to ensure that it makes
   duplicate in the interface as expected.
3) Then again in the system preferences interface subsection change
   "advancedMARCeditor" to "Don't display".
4) Return back to the "Add MARC record" interface, refresh the page to
   have no MARC field labels displayed, and try duplicating the tag
   again.
5) Ensure that it doesn't work, also you can notice a JavaScript error
   "Cannot read property "setAttribute" of undefined..." in the
   JavaScript console of your browser.
6) Apply the patch.
7) Repeat the test sequence (changes will be in the step 5), ensure that
   the tag gets duplicated even when description labels are not present.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-01-27 10:45:54 +01:00
..
pages Bug 26154: Remove the use of jquery.checkboxes plugin from batch item deletion and modification 2020-10-12 11:28:41 +02:00
acq.js Bug 26217: Move translatable strings out of templates into acq.js 2020-09-29 14:28:18 +02:00
acquisitions-menu.js
additem.js Bug 25353: Correct eslint errors in additems.js 2020-10-26 00:14:42 +01:00
addorderiso2709.js
admin-menu.js
ajax.js Bug 26237: Move translatable strings out of preferences.tt and into JavaScript files 2020-09-29 14:28:18 +02:00
audio_alerts.js
auth-finder-search.js
automatic_item_modification_by_age.js
background-job-progressbar.js
basket.js Bug 26707: Split cart and lists button on bibliographic detail pages 2021-01-04 16:31:29 +01:00
basketgroup.js
biblio_framework.js
calendar.js Bug 26261: Split calendar.inc into include file and JavaScript file 2020-09-29 14:28:19 +02:00
cart.js Bug 26439: (QA follow-up) Correct MSG instances in cart.js 2020-11-04 12:59:34 +01:00
catalog.js Bug 26707: Split cart and lists button on bibliographic detail pages 2021-01-04 16:31:29 +01:00
cataloging.js Bug 27508: do nothing if tag label elements don't exist 2021-01-27 10:45:54 +01:00
cataloging_additem.js
categories.js Bug 26229: Move translatable strings out of categories.tt and into categories.js 2020-09-29 14:28:18 +02:00
charts.js
checkouts.js Bug 27306: (QA follow-up) Add space between title and subtitle 2021-01-12 16:30:19 +01:00
circ-patron-search-results.js
datatables.js
desk_selection.js
file-upload.js
funds_sorts.js
holds.js Bug 27016: Make the pickup locations dropdowns use Select2 2021-01-04 16:33:15 +01:00
ill-availability-partner.js
ill-availability.js
ill-list-table.js Bug 25614: Move ILL request keyword filter to sidebar 2021-01-27 10:45:54 +01:00
item_search_fields.js Bug 26230: Move translatable strings out of item_search_fields.tt and into item_search_fields.js 2020-09-29 14:28:18 +02:00
letter.js Bug 26395: Move translatable strings out of letter.tt into letter.js 2020-09-29 14:28:18 +02:00
localcovers.js
mana.js
marc_modification_templates.js
marc_subfields_structure.js
members-menu.js Bug 26334: Move translatable strings out of members-menu.inc into members-menu.js 2020-09-29 14:28:18 +02:00
members.js Bug 26245: Remove unused functions from members.js 2020-09-29 14:28:18 +02:00
merge-record.js Bug 25320: Move translatable strings out of merge-record-strings.inc into merge-record.js 2020-09-29 14:28:19 +02:00
messaging-preference-form.js
offlinecirc.js
onboarding.js
register_selection.js Bug 24786: Allow selection of cash register at login 2020-11-06 15:39:59 +01:00
rotating-collections.js
select2.js Bug 27124: JS error "select2Width is not defined" 2020-12-21 10:07:40 +01:00
serials-toolbar.js Bug 26256: Move translatable strings out of templates and into serials-toolbar.js 2020-09-29 14:28:18 +02:00
showpredictionpattern.js
sms_providers.js Bug 26240: Move translatable strings out of sms_providers.tt and into sms_providers.js 2020-09-29 14:28:18 +02:00
staff-global.js Bug 23475: Unset the storage if the values do not exist 2020-11-30 11:14:58 +01:00
subscription-add.js
table_filters.js
tools-menu.js
viewlog.js Bug 26572: (QA follow-up) Escape strings in autocomplete 2020-11-04 12:59:34 +01:00
xmlControlfield.js
z3950_search.js Bug 11299: Add a button to the biblio edition page to automatically add authority links in the current biblio record via AJAX. Also adds a button to easily create missing authority records. 2021-01-14 14:03:49 +01:00