From af7cc5f81668fe50dde12fa0a03278fcbb0005fa 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 Signed-off-by: Nick Clemens Signed-off-by: Tomas Cohen Arazi Signed-off-by: Jonathan Druart --- .../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 86eab2547f..6aac6ae28e 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 e86726141e..a6a1f3f82d 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt @@ -157,95 +157,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 %]
[% IF op != 'add_item' %] -- 2.39.5