From f1bc81d09f35bcec1e0d090aa8a41698b44b2233 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 26 Jul 2021 18:25:19 +0200 Subject: [PATCH] Bug 28445: Isolate add item form to an include file To ease reusability --- .../prog/en/includes/html_helpers.inc | 121 ++++++++++++++++++ .../prog/en/modules/cataloguing/additem.tt | 90 +------------ 2 files changed, 122 insertions(+), 89 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers.inc index 86eab2547f4..6aac6ae28ec 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers.inc @@ -58,3 +58,124 @@ [% END %] [% END %] + +[% BLOCK subfields_for_item %] +
    + [% FOREACH subfield IN subfields %] + [% IF subfield.kohafield == 'items.more_subfields_xml' %] + [% SET kohafield = 'items.more_subfields_xml_' _ subfield.subfield %] + [% ELSE %] + [% SET kohafield = subfield.kohafield %] + [% END %] + +
  1. +
    + [% IF ( subfield.mandatory ) %] + + [% ELSE %] + + [% END %] + + [% SET mv = subfield.marc_value %] + [% IF ( mv.type == 'hidden' ) %] + + [% ELSIF ( mv.type == 'select' ) %] + [% IF ( mv.readonly || subfield.IS_RETURN_CLAIM ) %] + + [% END %] + + [% FOREACH aval IN mv.values %] + [% IF aval == mv.default %] + + [% ELSE %] + [% IF subfield.IS_LOST_AV && Koha.Preference("ClaimReturnedLostValue") && aval == Koha.Preference("ClaimReturnedLostValue") %] + + [% ELSE %] + + [% END %] + [% END %] + [% END %] + + [% ELSIF ( mv.type == 'text_auth' ) %] + [% IF mv.readonly %] + + [% ELSE %] + + [% SET dopop = "Dopop('/cgi-bin/koha/authorities/auth_finder.pl?authtypecode=\"${mv.authtypecode}\"&index=${mv.id}','${mv.id}')" %] + ... + [% END %] + [% ELSIF ( mv.type == 'text_plugin' ) %] + [% IF mv.readonly %] + + [% ELSE %] + + [% IF ( mv.nopopup ) %] + ... + [% ELSE %] + ... + [% END %] + [%- mv.javascript | $raw -%] + [% END %] + [% ELSIF ( mv.type == 'text' ) %] + [% IF mv.readonly %] + + [% ELSE %] + + [% END %] + [% ELSIF ( mv.type == 'textarea' ) %] + [% IF mv.readonly %] + + [% ELSE %] + + [% END %] + [% END %] + + [% IF subfield.kohafield == 'items.more_subfields_xml' %] + + [% END %] + + + + + + [% IF add_regex %] + + s// + / + + + [% END %] + + [% IF add_delete_checkbox %] + [% UNLESS ( subfield.mandatory ) %] + + [% ELSE %] + Required + [% END %] + [% ELSE %] + [% IF ( subfield.mandatory ) %] Required + [% ELSIF ( subfield.important ) %] Important + [% END %] + [% END %] + + [% IF add_regex %] + [% IF (mv.type == 'text' || mv.type == 'text2' || mv.type == 'textarea' ) %] + RegEx + [% END %] + [% END %] + + [% IF ( subfield.repeatable ) %] + + Clone + + [% END %] + + + +
    +
  2. + [% END %] +
+[% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt index 345329ecc7a..0988065fb6b 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt @@ -153,95 +153,7 @@

Edit Item #[% itemnumber | html %][% IF ( barcode ) %] / Barcode [% barcode | html %][% END %]

[% END %]
-
    - [% FOREACH subfield IN subfields %] - - [% IF subfield.kohafield == 'items.more_subfields_xml' %] - [% SET kohafield = 'items.more_subfields_xml_' _ subfield.subfield %] - [% ELSE %] - [% SET kohafield = subfield.kohafield %] - [% END %] - -
  1. - [% IF ( subfield.mandatory ) %] - - [% ELSE %] - - [% END %] - - [% SET mv = subfield.marc_value %] - [% IF ( mv.type == 'hidden' ) %] - - [% ELSIF ( mv.type == 'select' ) %] - [% IF ( mv.readonly || subfield.IS_RETURN_CLAIM ) %] - - [% END %] - [% FOREACH aval IN mv.values %] - [% IF aval == mv.default %] - - [% ELSE %] - [% IF subfield.IS_LOST_AV && Koha.Preference("ClaimReturnedLostValue") && aval == Koha.Preference("ClaimReturnedLostValue") %] - - [% ELSE %] - - [% END %] - [% END %] - [% END %] - - [% ELSIF ( mv.type == 'text_auth' ) %] - [% IF mv.readonly %] - - [% ELSE %] - - [% SET dopop = "Dopop('/cgi-bin/koha/authorities/auth_finder.pl?authtypecode=\"${mv.authtypecode}\"&index=${mv.id}','${mv.id}')" %] - ... - [% END %] - [% ELSIF ( mv.type == 'text_plugin' ) %] - [% IF mv.readonly %] - - [% ELSE %] - - [% IF ( mv.nopopup ) %] - ... - [% ELSE %] - ... - [% END %] - [%- mv.javascript | $raw -%] - [% END %] - [% ELSIF ( mv.type == 'text' ) %] - [% IF mv.readonly %] - - [% ELSE %] - - [% END %] - [% ELSIF ( mv.type == 'textarea' ) %] - [% IF mv.readonly %] - - [% ELSE %] - - [% END %] - [% END %] - - [% IF subfield.kohafield == 'items.more_subfields_xml' %] - - [% END %] - - - - - [% IF ( subfield.repeatable ) %] - - Clone - - [% END %] - [% IF ( subfield.mandatory ) %] Required - [% ELSIF ( subfield.important ) %] Important - [% END %] -
  2. - [% END %] -
+ [% PROCESS subfields_for_item subfields => subfields %]
-- 2.20.1