[Bug 42284] New: Tidy all script tags - addbiblio/authorities
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42284 Bug ID: 42284 Summary: Tidy all script tags - addbiblio/authorities Initiative type: --- Sponsorship --- status: Product: Koha Version: unspecified Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: Architecture, internals, and plumbing Assignee: koha-bugs@lists.koha-community.org Reporter: jonathan.druart@gmail.com QA Contact: testopia@bugs.koha-community.org Blocks: 42094 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42094 [Bug 42094] Tidy all script tags (except value_builder) -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42284 Jonathan Druart <jonathan.druart@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |jonathan.druart@gmail.com |ity.org | -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42284 Jonathan Druart <jonathan.druart@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42284 --- Comment #1 from Jonathan Druart <jonathan.druart@gmail.com> --- Created attachment 196787 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=196787&action=edit Bug 42284: Tidy all script tags - addbiblio/authorities In order to tidy all the script tags of the .tt files we isolate the interpolation of Template::Toolkit variables in a separate script tag. This patch focuses on the edition of biblio and authority records. We rethink how (the ugly) BIG_LOOP works: * push all mandatory and important fields in a JS array * use objects/hashes instead of array to store/access tag, id, index and tab (vs arr[0], arr[1], ...) For testing you need to focus on the mandatory and important fields and subfields. Confirm that there is no change in behaviour introduced by this patch. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42284 --- Comment #2 from Jonathan Druart <jonathan.druart@gmail.com> --- Created attachment 196788 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=196788&action=edit Bug 42284: Tidy all script tags - addbiblio/authorities (auto tidy) Patch from commit b11c6eb -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42284 Jonathan Druart <jonathan.druart@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #196787|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42284 --- Comment #3 from Jonathan Druart <jonathan.druart@gmail.com> --- Created attachment 197122 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=197122&action=edit Bug 42284: Tidy all script tags - addbiblio/authorities In order to tidy all the script tags of the .tt files we isolate the interpolation of Template::Toolkit variables in a separate script tag. This patch focuses on the edition of biblio and authority records. We rethink how (the ugly) BIG_LOOP works: * push all mandatory and important fields in a JS array * use objects/hashes instead of array to store/access tag, id, index and tab (vs arr[0], arr[1], ...) For testing you need to focus on the mandatory and important fields and subfields. Confirm that there is no change in behaviour introduced by this patch. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42284 Jonathan Druart <jonathan.druart@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #196788|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42284 --- Comment #4 from Jonathan Druart <jonathan.druart@gmail.com> --- Created attachment 197123 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=197123&action=edit Bug 42284: Tidy all script tags - addbiblio/authorities (auto tidy) Patch from commit 3bb974f -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42284 Jonathan Druart <jonathan.druart@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on| |41653 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41653 [Bug 41653] Stores for permissions and sysprefs should be under the Koha namespace -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42284 Phil Ringnalda <phil@chetcolibrary.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |phil@chetcolibrary.org Status|Needs Signoff |Patch doesn't apply --- Comment #5 from Phil Ringnalda <phil@chetcolibrary.org> --- Patches look sort of oddly trimmed on top, and don't apply. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42284 Jonathan Druart <jonathan.druart@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #197122|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42284 Jonathan Druart <jonathan.druart@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #197123|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42284 --- Comment #6 from Jonathan Druart <jonathan.druart@gmail.com> --- Created attachment 197555 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=197555&action=edit Bug 42284: Tidy all script tags - addbiblio/authorities In order to tidy all the script tags of the .tt files we isolate the interpolation of Template::Toolkit variables in a separate script tag. This patch focuses on the edition of biblio and authority records. We rethink how (the ugly) BIG_LOOP works: * push all mandatory and important fields in a JS array * use objects/hashes instead of array to store/access tag, id, index and tab (vs arr[0], arr[1], ...) For testing you need to focus on the mandatory and important fields and subfields. Confirm that there is no change in behaviour introduced by this patch. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42284 --- Comment #7 from Jonathan Druart <jonathan.druart@gmail.com> --- Created attachment 197556 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=197556&action=edit Bug 42284: Tidy all script tags - addbiblio/authorities (auto tidy) Patch from commit a73175c -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42284 Jonathan Druart <jonathan.druart@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Patch doesn't apply |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42284 Paul Derscheid <paul.derscheid@lmscloud.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42284 Paul Derscheid <paul.derscheid@lmscloud.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #197555|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42284 Paul Derscheid <paul.derscheid@lmscloud.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #197556|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42284 --- Comment #8 from Paul Derscheid <paul.derscheid@lmscloud.de> --- Created attachment 197650 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=197650&action=edit Bug 42284: Tidy all script tags - addbiblio/authorities In order to tidy all the script tags of the .tt files we isolate the interpolation of Template::Toolkit variables in a separate script tag. This patch focuses on the edition of biblio and authority records. We rethink how (the ugly) BIG_LOOP works: * push all mandatory and important fields in a JS array * use objects/hashes instead of array to store/access tag, id, index and tab (vs arr[0], arr[1], ...) For testing you need to focus on the mandatory and important fields and subfields. Confirm that there is no change in behaviour introduced by this patch. Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42284 --- Comment #9 from Paul Derscheid <paul.derscheid@lmscloud.de> --- Created attachment 197651 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=197651&action=edit Bug 42284: Tidy all script tags - addbiblio/authorities (auto tidy) Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42284 --- Comment #10 from Paul Derscheid <paul.derscheid@lmscloud.de> --- Created attachment 197652 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=197652&action=edit Bug 42284: (follow-up) Fix important_fields push and id concatenation The BIG_LOOP rewrite introduced two regressions in the mandatory / important field collector at the top of addbiblio.tt: - `important_fields.push([ tag: ..., id: ..., ... ])` wraps the object in brackets instead of braces. `[a: 1]` is not a valid array literal, so the parser aborts the whole script tag and AreFieldsNotOk / PopupZ3950 never run for any record whose framework marks fields as "important". - The `id` interpolation joins index and random with a literal `$` (`"[% index %]$[% random %]"`), but the DOM ids rendered elsewhere in the template (and looked up by AreFieldsNotOk via `divid = "tag_" + tag + "_" + id`) concatenate them with no separator. Use `{...}` for important_fields and drop the `$` so the collector shape and ids match the rest of the template. To test: - Open addbiblio.pl for a framework that has mandatory and important fields (e.g. default MARC21). - Submit a new record with mandatory subfields empty: the error panel lists them and focuses the first empty input. - Submit with only important subfields empty: the warning panel (not blocking) lists them under "The following important subfields aren't filled". - Browser console has no SyntaxError on page load. Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42284 --- Comment #11 from Paul Derscheid <paul.derscheid@lmscloud.de> --- Created attachment 197653 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=197653&action=edit Bug 42284: (follow-up) Use z3950_mandatory name as query param, not marc_lib GetMandatoryFieldZ3950 (in cataloguing/addbiblio.pl and authorities/authorities.pl) populates subfield_loo.z3950_mandatory with the z3950 query-field name expected by z3950_search.pl (isbn, title, author, issn, lccn, ...). The pre-port JS copied this value into mandatories_label and used it as the URL parameter name in GetZ3950Terms. The BIG_LOOP rewrite stored subfield_loo.marc_lib as `label` instead. marc_lib is the human-readable field label ("Title statement"), so GetZ3950Terms started emitting URLs like &Title+statement=... which z3950_search.pl ignores, and the z3950 lookup from the editor stopped matching any subfield. Use subfield_loo.z3950_mandatory for the label in z3950_mandatory_subfields on both templates. To test: - Open addbiblio.pl and fill the ISBN / title / author subfields. - Click "Z39.50/SRU search". - In the popup form (or the network request), the pre-filled fields should correspond to the entered values (title -> Title, isbn -> ISBN, ...). Before this patch they were empty. - Same flow from authorities/authorities.pl on a matching authority type. Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42284 --- Comment #12 from Paul Derscheid <paul.derscheid@lmscloud.de> --- Created attachment 197654 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=197654&action=edit Bug 42284: (follow-up) Restore hide_marc polarity for marc tag visibility The original UNLESS/ELSE block kept MARC tag links visible by default and hid them only when the hide_marc syspref was enabled: [% UNLESS Koha.Preference("hide_marc") %] toggleMARCTagLinks(true) [% ELSE %] toggleMARCTagLinks(false); [% END %] The JS port inverted the test without swapping the branches, so when hide_marc was off the tag links were hidden and when it was on they were shown -- the opposite of the pref's intent. Flip the condition back (!Koha.prefs.hide_marc). To test: - Set hide_marc = 0: open addbiblio.pl, MARC tag numbers and subfield codes are visible on first load. - Set hide_marc = 1 and clear the marctags cookie (devtools -> Application -> Cookies): reload addbiblio.pl, tag numbers and subfield codes are hidden on first load. Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42284 Jonathan Druart <jonathan.druart@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #197650|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42284 Jonathan Druart <jonathan.druart@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #197651|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42284 Jonathan Druart <jonathan.druart@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #197652|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42284 Jonathan Druart <jonathan.druart@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #197653|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42284 Jonathan Druart <jonathan.druart@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #197654|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42284 --- Comment #13 from Jonathan Druart <jonathan.druart@gmail.com> --- Created attachment 198793 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=198793&action=edit Bug 42284: Tidy all script tags - addbiblio/authorities In order to tidy all the script tags of the .tt files we isolate the interpolation of Template::Toolkit variables in a separate script tag. This patch focuses on the edition of biblio and authority records. We rethink how (the ugly) BIG_LOOP works: * push all mandatory and important fields in a JS array * use objects/hashes instead of array to store/access tag, id, index and tab (vs arr[0], arr[1], ...) For testing you need to focus on the mandatory and important fields and subfields. Confirm that there is no change in behaviour introduced by this patch. Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42284 --- Comment #14 from Jonathan Druart <jonathan.druart@gmail.com> --- Created attachment 198794 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=198794&action=edit Bug 42284: Tidy all script tags - addbiblio/authorities (auto tidy) Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42284 --- Comment #15 from Jonathan Druart <jonathan.druart@gmail.com> --- Created attachment 198795 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=198795&action=edit Bug 42284: (follow-up) Fix important_fields push and id concatenation The BIG_LOOP rewrite introduced two regressions in the mandatory / important field collector at the top of addbiblio.tt: - `important_fields.push([ tag: ..., id: ..., ... ])` wraps the object in brackets instead of braces. `[a: 1]` is not a valid array literal, so the parser aborts the whole script tag and AreFieldsNotOk / PopupZ3950 never run for any record whose framework marks fields as "important". - The `id` interpolation joins index and random with a literal `$` (`"[% index %]$[% random %]"`), but the DOM ids rendered elsewhere in the template (and looked up by AreFieldsNotOk via `divid = "tag_" + tag + "_" + id`) concatenate them with no separator. Use `{...}` for important_fields and drop the `$` so the collector shape and ids match the rest of the template. To test: - Open addbiblio.pl for a framework that has mandatory and important fields (e.g. default MARC21). - Submit a new record with mandatory subfields empty: the error panel lists them and focuses the first empty input. - Submit with only important subfields empty: the warning panel (not blocking) lists them under "The following important subfields aren't filled". - Browser console has no SyntaxError on page load. Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42284 --- Comment #16 from Jonathan Druart <jonathan.druart@gmail.com> --- Created attachment 198796 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=198796&action=edit Bug 42284: (follow-up) Use z3950_mandatory name as query param, not marc_lib GetMandatoryFieldZ3950 (in cataloguing/addbiblio.pl and authorities/authorities.pl) populates subfield_loo.z3950_mandatory with the z3950 query-field name expected by z3950_search.pl (isbn, title, author, issn, lccn, ...). The pre-port JS copied this value into mandatories_label and used it as the URL parameter name in GetZ3950Terms. The BIG_LOOP rewrite stored subfield_loo.marc_lib as `label` instead. marc_lib is the human-readable field label ("Title statement"), so GetZ3950Terms started emitting URLs like &Title+statement=... which z3950_search.pl ignores, and the z3950 lookup from the editor stopped matching any subfield. Use subfield_loo.z3950_mandatory for the label in z3950_mandatory_subfields on both templates. To test: - Open addbiblio.pl and fill the ISBN / title / author subfields. - Click "Z39.50/SRU search". - In the popup form (or the network request), the pre-filled fields should correspond to the entered values (title -> Title, isbn -> ISBN, ...). Before this patch they were empty. - Same flow from authorities/authorities.pl on a matching authority type. Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42284 --- Comment #17 from Jonathan Druart <jonathan.druart@gmail.com> --- Created attachment 198797 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=198797&action=edit Bug 42284: (follow-up) Restore hide_marc polarity for marc tag visibility The original UNLESS/ELSE block kept MARC tag links visible by default and hid them only when the hide_marc syspref was enabled: [% UNLESS Koha.Preference("hide_marc") %] toggleMARCTagLinks(true) [% ELSE %] toggleMARCTagLinks(false); [% END %] The JS port inverted the test without swapping the branches, so when hide_marc was off the tag links were hidden and when it was on they were shown -- the opposite of the pref's intent. Flip the condition back (!Koha.prefs.hide_marc). To test: - Set hide_marc = 0: open addbiblio.pl, MARC tag numbers and subfield codes are visible on first load. - Set hide_marc = 1 and clear the marctags cookie (devtools -> Application -> Cookies): reload addbiblio.pl, tag numbers and subfield codes are hidden on first load. Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42284 --- Comment #18 from Jonathan Druart <jonathan.druart@gmail.com> --- Fixed conflicts with bug 42424. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42284 Jan Kissig <bibliothek@th-wildau.de> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bibliothek@th-wildau.de QA Contact|testopia@bugs.koha-communit |bibliothek@th-wildau.de |y.org | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42284 Jan Kissig <bibliothek@th-wildau.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42284 Jan Kissig <bibliothek@th-wildau.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #198793|0 |1 is obsolete| | Attachment #198794|0 |1 is obsolete| | Attachment #198795|0 |1 is obsolete| | Attachment #198796|0 |1 is obsolete| | Attachment #198797|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42284 --- Comment #19 from Jan Kissig <bibliothek@th-wildau.de> --- Created attachment 200626 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=200626&action=edit Bug 42284: Tidy all script tags - addbiblio/authorities In order to tidy all the script tags of the .tt files we isolate the interpolation of Template::Toolkit variables in a separate script tag. This patch focuses on the edition of biblio and authority records. We rethink how (the ugly) BIG_LOOP works: * push all mandatory and important fields in a JS array * use objects/hashes instead of array to store/access tag, id, index and tab (vs arr[0], arr[1], ...) For testing you need to focus on the mandatory and important fields and subfields. Confirm that there is no change in behaviour introduced by this patch. Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de> Signed-off-by: Jan Kissig <bibliothek@th-wildau.de> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42284 --- Comment #20 from Jan Kissig <bibliothek@th-wildau.de> --- Created attachment 200627 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=200627&action=edit Bug 42284: Tidy all script tags - addbiblio/authorities (auto tidy) Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de> Signed-off-by: Jan Kissig <bibliothek@th-wildau.de> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42284 --- Comment #21 from Jan Kissig <bibliothek@th-wildau.de> --- Created attachment 200628 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=200628&action=edit Bug 42284: (follow-up) Fix important_fields push and id concatenation The BIG_LOOP rewrite introduced two regressions in the mandatory / important field collector at the top of addbiblio.tt: - `important_fields.push([ tag: ..., id: ..., ... ])` wraps the object in brackets instead of braces. `[a: 1]` is not a valid array literal, so the parser aborts the whole script tag and AreFieldsNotOk / PopupZ3950 never run for any record whose framework marks fields as "important". - The `id` interpolation joins index and random with a literal `$` (`"[% index %]$[% random %]"`), but the DOM ids rendered elsewhere in the template (and looked up by AreFieldsNotOk via `divid = "tag_" + tag + "_" + id`) concatenate them with no separator. Use `{...}` for important_fields and drop the `$` so the collector shape and ids match the rest of the template. To test: - Open addbiblio.pl for a framework that has mandatory and important fields (e.g. default MARC21). - Submit a new record with mandatory subfields empty: the error panel lists them and focuses the first empty input. - Submit with only important subfields empty: the warning panel (not blocking) lists them under "The following important subfields aren't filled". - Browser console has no SyntaxError on page load. Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de> Signed-off-by: Jan Kissig <bibliothek@th-wildau.de> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42284 --- Comment #22 from Jan Kissig <bibliothek@th-wildau.de> --- Created attachment 200629 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=200629&action=edit Bug 42284: (follow-up) Use z3950_mandatory name as query param, not marc_lib GetMandatoryFieldZ3950 (in cataloguing/addbiblio.pl and authorities/authorities.pl) populates subfield_loo.z3950_mandatory with the z3950 query-field name expected by z3950_search.pl (isbn, title, author, issn, lccn, ...). The pre-port JS copied this value into mandatories_label and used it as the URL parameter name in GetZ3950Terms. The BIG_LOOP rewrite stored subfield_loo.marc_lib as `label` instead. marc_lib is the human-readable field label ("Title statement"), so GetZ3950Terms started emitting URLs like &Title+statement=... which z3950_search.pl ignores, and the z3950 lookup from the editor stopped matching any subfield. Use subfield_loo.z3950_mandatory for the label in z3950_mandatory_subfields on both templates. To test: - Open addbiblio.pl and fill the ISBN / title / author subfields. - Click "Z39.50/SRU search". - In the popup form (or the network request), the pre-filled fields should correspond to the entered values (title -> Title, isbn -> ISBN, ...). Before this patch they were empty. - Same flow from authorities/authorities.pl on a matching authority type. Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de> Signed-off-by: Jan Kissig <bibliothek@th-wildau.de> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42284 --- Comment #23 from Jan Kissig <bibliothek@th-wildau.de> --- Created attachment 200630 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=200630&action=edit Bug 42284: (follow-up) Restore hide_marc polarity for marc tag visibility The original UNLESS/ELSE block kept MARC tag links visible by default and hid them only when the hide_marc syspref was enabled: [% UNLESS Koha.Preference("hide_marc") %] toggleMARCTagLinks(true) [% ELSE %] toggleMARCTagLinks(false); [% END %] The JS port inverted the test without swapping the branches, so when hide_marc was off the tag links were hidden and when it was on they were shown -- the opposite of the pref's intent. Flip the condition back (!Koha.prefs.hide_marc). To test: - Set hide_marc = 0: open addbiblio.pl, MARC tag numbers and subfield codes are visible on first load. - Set hide_marc = 1 and clear the marctags cookie (devtools -> Application -> Cookies): reload addbiblio.pl, tag numbers and subfield codes are hidden on first load. Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de> Signed-off-by: Jan Kissig <bibliothek@th-wildau.de> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42284 --- Comment #24 from Jan Kissig <bibliothek@th-wildau.de> --- Created attachment 200631 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=200631&action=edit Bug 42284: (QA follow-up) Add missing Koha.prefs Fix call of marcflavour which is saved in Koha.prefs store. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42284 --- Comment #25 from Jan Kissig <bibliothek@th-wildau.de> --- Created attachment 200632 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=200632&action=edit Bug 42284: (QA follow-up) biblionumber must not be null Presetting biblionumber to null (when adding a new record) will lead to a query parameter biblionumber=null when performing a z39.50 search followed by importing a result. This patch will default biblionumber to "". Testplan: a) go to More -> Cataloging -> New Record -> Z39.50/SRU search b) search for a title f.e. "Programming Perl" c) import one of the results d) check that the opened URL has a param biblionumber=null and the addbiblio page displays an error: The record you are trying to edit doesn't exist. Add a new record or do a catalog search. e) apply patch and redo steps a) - d) and check that query param biblonumber is 0 and addbiblio loads correct carrying the imported data. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42284 --- Comment #26 from Jan Kissig <bibliothek@th-wildau.de> --- Created attachment 200633 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=200633&action=edit Bug 42284: (QA follow-up) Fix missing query param index This restores the param "index" to the popup window URL. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42284 --- Comment #27 from Jonathan Druart <jonathan.druart@gmail.com> --- Good catches, Jan. Thanks (again)! -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org