Bugzilla – Attachment 183087 Details for
Bug 39971
Patron attribute types form logic should be reusable
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 39971: Move form rendering to reusable tt block
Bug-39971-Move-form-rendering-to-reusable-tt-block.patch (text/plain), 16.87 KB, created by
David Nind
on 2025-06-07 01:20:26 UTC
(
hide
)
Description:
Bug 39971: Move form rendering to reusable tt block
Filename:
MIME Type:
Creator:
David Nind
Created:
2025-06-07 01:20:26 UTC
Size:
16.87 KB
patch
obsolete
>From da873aeb1d83fda068173f3661470fc108f9c223 Mon Sep 17 00:00:00 2001 >From: Pedro Amorim <pedro.amorim@openfifth.co.uk> >Date: Wed, 21 May 2025 12:40:04 +0000 >Subject: [PATCH] Bug 39971: Move form rendering to reusable tt block > >Signed-off-by: David Nind <david@davidnind.com> >--- > .../en/includes/member-attribute-types.inc | 84 ++++++++++++++++++ > .../prog/en/modules/members/memberentrygen.tt | 86 +------------------ > 2 files changed, 86 insertions(+), 84 deletions(-) > create mode 100644 koha-tmpl/intranet-tmpl/prog/en/includes/member-attribute-types.inc > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/member-attribute-types.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/member-attribute-types.inc >new file mode 100644 >index 0000000000..dfdf17d819 >--- /dev/null >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/member-attribute-types.inc >@@ -0,0 +1,84 @@ >+[% BLOCK 'memberentry_patron_attributes_form' %] >+ [% UNLESS ( no_patron_attribute_types ) %] >+ <fieldset class="rows" id="memberentry_patron_attributes"> >+ <legend class="expanded" id="patron_attributes_lgd"> >+ <i class="fa fa-caret-down" aria-hidden="true"></i> >+ Additional attributes and identifiers >+ </legend> >+ <div class="attributes_tables"> >+ <input type="hidden" name="setting_extended_patron_attributes" value="1" /> >+ [% FOREACH pa_loo IN patron_attributes %] >+ <ol class="attributes_table"> >+ <div id="aai_[% pa_loo.class | html %]"> >+ [% IF pa_loo.class %] >+ <h3 id="[% pa_loo.class | html %]_lgd">[% pa_loo.lib | html %]</h3> >+ [% END %] >+ [% FOREACH patron_attribute IN pa_loo.items %] >+ <li data-category_code="[% patron_attribute.category_code | html %]" data-pa_code="[% patron_attribute.code | replace('[^a-zA-Z0-9_-]', '') %]"> >+ [% IF patron_attribute.mandatory %] >+ <label for="[% patron_attribute.form_id | html %]" class="required" required="required">[% patron_attribute.description | html %]: </label> >+ [% ELSE %] >+ <label for="[% patron_attribute.form_id | html %]">[% patron_attribute.description | html %]: </label> >+ [% END %] >+ [% IF ( patron_attribute.use_dropdown ) %] >+ <select id="[% patron_attribute.form_id | html %]" name="[% patron_attribute.form_id | html %]" [% IF patron_attribute.mandatory %]required="required"[% END %]> >+ <option value=""></option> >+ [% FOREACH auth_val_loo IN patron_attribute.auth_val_loop %] >+ [% IF auth_val_loo.authorised_value == patron_attribute.value %] >+ <option value="[% auth_val_loo.authorised_value | html %]" selected="selected"> [% auth_val_loo.lib | html %] </option> >+ [% ELSE %] >+ <option value="[% auth_val_loo.authorised_value | html %]"> [% auth_val_loo.lib | html %] </option> >+ [% END %] >+ [% END %] >+ </select> >+ [% ELSE %] >+ [% IF patron_attribute.mandatory %] >+ [% IF patron_attribute.is_date %] >+ <input >+ type="text" >+ id="[% patron_attribute.form_id | html %]" >+ name="[% patron_attribute.form_id | html %]" >+ maxlength="10" >+ size="10" >+ value="[% patron_attribute.value | html %]" >+ required="required" >+ class="flatpickr" >+ /> >+ [% ELSE %] >+ <textarea rows="2" cols="30" id="[% patron_attribute.form_id | html %]" name="[% patron_attribute.form_id | html %]" required="required"> [% patron_attribute.value | html %]</textarea> >+ [% END %] >+ [% ELSE %] >+ [% IF patron_attribute.is_date %] >+ <input >+ type="text" >+ id="[% patron_attribute.form_id | html %]" >+ name="[% patron_attribute.form_id | html %]" >+ maxlength="10" >+ size="10" >+ value="[% patron_attribute.value | html %]" >+ class="flatpickr" >+ /> >+ [% ELSE %] >+ <textarea rows="2" cols="30" id="[% patron_attribute.form_id | html %]" name="[% patron_attribute.form_id | html %]">[% patron_attribute.value | html %]</textarea> >+ [% END %] >+ [% END %] >+ [% END # /IF ( patron_attribute.use_dropdown ) %] >+ <input type="hidden" id="[% patron_attribute.form_id | html %]_code" name="[% patron_attribute.form_id | html %]_code" value="[% patron_attribute.code | html %]" /> >+ [% IF ( !patron_attribute.is_date ) %] >+ <a href="#" class="clear_attribute"><i class="fa fa-fw fa-trash-can"></i> Clear</a> >+ [% END %] >+ [% IF ( patron_attribute.repeatable ) %] >+ <a href="#" class="clone_attribute"><i class="fa fa-fw fa-plus"></i> New</a> >+ [% END %] >+ [% IF patron_attribute.mandatory %]<span class="required">Required</span>[% END %] >+ </li> >+ [% END # /FOREACH patron_attribute %] >+ </div> >+ </ol> >+ [% END # /FOREACH pa_loo %] >+ </div> >+ <!-- /.attributes_tables --> >+ </fieldset> >+ <!-- /#memberentry_patron_attributes --> >+ [% END # UNLESS ( no_patron_attribute_types ) %] >+[% END %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt >index 361a178107..c69ef3b655 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt >@@ -7,6 +7,7 @@ > [% PROCESS 'member-main-address-style.inc' %] > [% PROCESS 'member-alt-address-style.inc' %] > [% PROCESS 'member-alt-contact-style.inc' %] >+[% PROCESS 'member-attribute-types.inc' %] > [% PROCESS 'restriction-types.inc' %] > [% PROCESS 'i18n.inc' %] > [% SET footerjs = 1 %] >@@ -1505,90 +1506,7 @@ > > [% IF ( step_4 ) %] > [% IF Koha.Preference('ExtendedPatronAttributes') %] >- [% UNLESS ( no_patron_attribute_types ) %] >- <fieldset class="rows" id="memberentry_patron_attributes"> >- <legend class="expanded" id="patron_attributes_lgd"> >- <i class="fa fa-caret-down" aria-hidden="true"></i> >- Additional attributes and identifiers >- </legend> >- <div class="attributes_tables"> >- <input type="hidden" name="setting_extended_patron_attributes" value="1" /> >- [% FOREACH pa_loo IN patron_attributes %] >- <ol class="attributes_table"> >- <div id="aai_[% pa_loo.class | html %]"> >- [% IF pa_loo.class %] >- <h3 id="[% pa_loo.class | html %]_lgd">[% pa_loo.lib | html %]</h3> >- [% END %] >- [% FOREACH patron_attribute IN pa_loo.items %] >- <li data-category_code="[% patron_attribute.category_code | html %]" data-pa_code="[% patron_attribute.code | replace('[^a-zA-Z0-9_-]', '') %]"> >- [% IF patron_attribute.mandatory %] >- <label for="[% patron_attribute.form_id | html %]" class="required" required="required">[% patron_attribute.description | html %]: </label> >- [% ELSE %] >- <label for="[% patron_attribute.form_id | html %]">[% patron_attribute.description | html %]: </label> >- [% END %] >- [% IF ( patron_attribute.use_dropdown ) %] >- <select id="[% patron_attribute.form_id | html %]" name="[% patron_attribute.form_id | html %]" [% IF patron_attribute.mandatory %]required="required"[% END %]> >- <option value=""></option> >- [% FOREACH auth_val_loo IN patron_attribute.auth_val_loop %] >- [% IF auth_val_loo.authorised_value == patron_attribute.value %] >- <option value="[% auth_val_loo.authorised_value | html %]" selected="selected"> [% auth_val_loo.lib | html %] </option> >- [% ELSE %] >- <option value="[% auth_val_loo.authorised_value | html %]"> [% auth_val_loo.lib | html %] </option> >- [% END %] >- [% END %] >- </select> >- [% ELSE %] >- [% IF patron_attribute.mandatory %] >- [% IF patron_attribute.is_date %] >- <input >- type="text" >- id="[% patron_attribute.form_id | html %]" >- name="[% patron_attribute.form_id | html %]" >- maxlength="10" >- size="10" >- value="[% patron_attribute.value | html %]" >- required="required" >- class="flatpickr" >- /> >- [% ELSE %] >- <textarea rows="2" cols="30" id="[% patron_attribute.form_id | html %]" name="[% patron_attribute.form_id | html %]" required="required"> >- [% patron_attribute.value | html %]</textarea >- > >- [% END %] >- [% ELSE %] >- [% IF patron_attribute.is_date %] >- <input >- type="text" >- id="[% patron_attribute.form_id | html %]" >- name="[% patron_attribute.form_id | html %]" >- maxlength="10" >- size="10" >- value="[% patron_attribute.value | html %]" >- class="flatpickr" >- /> >- [% ELSE %] >- <textarea rows="2" cols="30" id="[% patron_attribute.form_id | html %]" name="[% patron_attribute.form_id | html %]">[% patron_attribute.value | html %]</textarea> >- [% END %] >- [% END %] >- [% END # /IF ( patron_attribute.use_dropdown ) %] >- <input type="hidden" id="[% patron_attribute.form_id | html %]_code" name="[% patron_attribute.form_id | html %]_code" value="[% patron_attribute.code | html %]" /> >- [% IF ( !patron_attribute.is_date ) %] >- <a href="#" class="clear_attribute"><i class="fa fa-fw fa-trash-can"></i> Clear</a> >- [% END %] >- [% IF ( patron_attribute.repeatable ) %] >- <a href="#" class="clone_attribute"><i class="fa fa-fw fa-plus"></i> New</a> >- [% END %] >- [% IF patron_attribute.mandatory %]<span class="required">Required</span>[% END %] >- </li> >- [% END # /FOREACH patron_attribute %] >- </div> >- </ol> >- [% END # /FOREACH pa_loo %] >- </div> >- <!-- /.attributes_tables --> >- </fieldset> >- <!-- /#memberentry_patron_attributes --> >- [% END # UNLESS ( no_patron_attribute_types ) %] >+ [% PROCESS 'memberentry_patron_attributes_form' patron_attributes=patron_attributes %] > [% END # IF Koha.Preference('ExtendedPatronAttributes') %] > [% END # IF ( step_4 ) %] > >-- >2.39.5
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 39971
:
182739
|
182740
|
182741
|
182742
| 183087 |
183088
|
183089
|
183090