Bug 34531: Fix template logic to not hide patron restrictions
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / members / members-update.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% USE AuthorisedValues %]
4 [% USE Branches %]
5 [% USE Categories %]
6 [% USE KohaDates %]
7 [% PROCESS 'i18n.inc' %]
8 [% SET footerjs = 1 %]
9 [% INCLUDE 'doc-head-open.inc' %]
10 <title>[% FILTER collapse %]
11     [% t("Update patron records") | html %] &rsaquo;
12     [% t("Patrons") | html %] &rsaquo;
13     [% t("Koha") | html %]
14 [% END %]</title>
15 [% INCLUDE 'doc-head-close.inc' %]
16 </head>
17
18 <body id="pat_update" class="pat">
19 [% WRAPPER 'header.inc' %]
20     [% INCLUDE 'patron-search-header.inc' %]
21 [% END %]
22
23 [% BLOCK display_names %]
24 [% SWITCH field %]
25 [% CASE 'branchcode'          %]<span>Home library (branchcode)</span>
26 [% CASE 'surname'             %]<span>Surname</span>
27 [% CASE 'firstname'           %]<span>First name</span>
28 [% CASE 'middle_name'         %]<span>Middle name</span>
29 [% CASE 'title'               %]<span>Title</span>
30 [% CASE 'othernames'          %]<span>Other names</span>
31 [% CASE 'initials'            %]<span>Initials</span>
32 [% CASE 'pronouns'            %]<span>Pronouns</span>
33 [% CASE 'streetnumber'        %]<span>Street number</span>
34 [% CASE 'streettype'          %]<span>Street type</span>
35 [% CASE 'address'             %]<span>Address</span>
36 [% CASE 'address2'            %]<span>Address 2</span>
37 [% CASE 'city'                %]<span>City</span>
38 [% CASE 'state'               %]<span>State</span>
39 [% CASE 'zipcode'             %]<span>ZIP/Postal code</span>
40 [% CASE 'country'             %]<span>Country</span>
41 [% CASE 'email'               %]<span>Email</span>
42 [% CASE 'phone'               %]<span>Primary phone</span>
43 [% CASE 'mobile'              %]<span>Other phone</span>
44 [% CASE 'fax'                 %]<span>Fax</span>
45 [% CASE 'emailpro'            %]<span>Secondary email</span>
46 [% CASE 'phonepro'            %]<span>Secondary phone</span>
47 [% CASE 'B_streetnumber'      %]<span>Alternate address: Street number</span>
48 [% CASE 'B_streettype'        %]<span>Alternate address: Street type</span>
49 [% CASE 'B_address'           %]<span>Alternate address: Address</span>
50 [% CASE 'B_address2'          %]<span>Alternate address: Address 2</span>
51 [% CASE 'B_city'              %]<span>Alternate address: City</span>
52 [% CASE 'B_state'             %]<span>Alternate address: State</span>
53 [% CASE 'B_zipcode'           %]<span>Alternate address: ZIP/Postal code</span>
54 [% CASE 'B_email'             %]<span>Alternate address: Email</span>
55 [% CASE 'B_phone'             %]<span>Alternate address: Phone</span>
56 [% CASE 'contactnote'         %]<span>Alternate address: Contact note</span>
57 [% CASE 'dateofbirth'         %]<span>Date of birth</span>
58 [% CASE 'contactname'         %]<span>Contact: Last name</span>
59 [% CASE 'contactfirstname'    %]<span>Contact: First name</span>
60 [% CASE 'contacttitle'        %]<span>Contact: Title</span>
61 [% CASE 'relationship'        %]<span>Contact: Relationship</span>
62 [% CASE 'sex'                 %]<span>Gender</span>
63 [% CASE 'autorenew_checkouts' %]<span>Auto-renewal</span>
64 [% CASE 'altcontactfirstname' %]<span>Alternate contact: First name</span>
65 [% CASE 'altcontactsurname'   %]<span>Alternate contact: Surname</span>
66 [% CASE 'altcontactaddress1'  %]<span>Alternate contact: Address</span>
67 [% CASE 'altcontactaddress2'  %]<span>Alternate contact: Address 2</span>
68 [% CASE 'altcontactaddress3'  %]<span>Alternate contact: City</span>
69 [% CASE 'altcontactstate'     %]<span>Alternate contact: State</span>
70 [% CASE 'altcontactzipcode'   %]<span>Alternate contact: ZIP/Postal code</span>
71 [% CASE 'altcontactcountry'   %]<span>Alternate contact: Country</span>
72 [% CASE 'altcontactphone'     %]<span>Alternate contact: Phone</span>
73 [% CASE 'smsalertnumber'      %]<span>SMS alert number</span>
74 [% CASE 'extended_attributes' %]<span>Additional attributes and identifiers</span>
75 [% CASE %][% field | html %]
76 [% END %]
77 [% END %]
78
79 [% BLOCK display_extended_attributes %]
80     [% IF attrs and attrs.size > 1 %]
81       <ul>
82         [% FOREACH attr IN attrs %]
83             <li>[% PROCESS display_attribute attr=attr type=type %]</li>
84         [% END %]
85       <ul>
86     [% ELSIF attrs %]
87         [% PROCESS display_attribute attr=attrs.0 type=type %]
88     [% END %]
89 [% END %]
90
91 [% BLOCK display_attribute %]
92     [% IF type.authorised_value_category %]
93         [% AuthorisedValues.GetByCode(type.authorised_value_category,attr.attribute) | html %]
94     [% ELSE %]
95         [% attr.attribute | html %]
96     [% END %]
97 [% END %]
98
99 [% WRAPPER 'sub-header.inc' %]
100     [% WRAPPER breadcrumbs %]
101         [% WRAPPER breadcrumb_item %]
102             <a href="/cgi-bin/koha/members/members-home.pl">Patrons</a>
103         [% END %]
104         [% WRAPPER breadcrumb_item bc_active= 1 %]
105             <span>Update patron records</span>
106         [% END %]
107     [% END #/ WRAPPER breadcrumbs %]
108 [% END #/ WRAPPER sub-header.inc %]
109
110 <div class="main container-fluid">
111     <div class="row">
112         <div class="col-md-8 col-md-offset-2">
113
114             <h1>Update patron records</h1>
115             [% IF PendingModifications %]
116                 <form method="post" action="members-update-do.pl">
117                     <div id="pending_updates" class="panel-group" role="tablist" aria-multiselectable="true">
118                         [% FOREACH pm IN PendingModifications %]
119                             [% SET borrowernumber = pm.borrowernumber %]
120                             <div class="panel panel-default">
121                                 <div class="panel-heading" role="tab" id="panel-header-[% pm.borrowernumber | html %]">
122                                     <h3 class="panel-title">
123                                         <a role="button" class="collapsed" data-toggle="collapse" data-parent="#pending_updates" aria-controls="panel_modify_[% pm.borrowernumber | html %]" href="#panel_modify_[% pm.borrowernumber | uri %]">[% borrowers.$borrowernumber.surname | html %][% IF ( borrowers.$borrowernumber.firstname ) %], [% borrowers.$borrowernumber.firstname | html %][% END %] - [% Categories.GetName( borrowers.$borrowernumber.categorycode ) | html %] ([% Branches.GetName( borrowers.$borrowernumber.branchcode ) | html %]) ([% borrowers.$borrowernumber.cardnumber | html %]) - Requested on [% pm.timestamp | $KohaDates with_hours = 1 %]</a>
124                                     </h3>
125                                 </div> <!-- /.panel-heading -->
126                                 <div id="panel_modify_[% pm.borrowernumber | html %]" class="panel-collapse collapse" role="tabpanel" aria-labelledby="panel-header-[% pm.borrowernumber | html %]">
127                                     <div class="panel-body">
128                                         <div class="btn-toolbar">
129
130                                             <label for="approve_modify_[% pm.borrowernumber | html %]"><input type="radio" id="approve_modify_[% pm.borrowernumber | html %]" name="modify_[% pm.borrowernumber | html %]" value="approve" /> Approve</label>
131
132
133                                             <label for="deny_modify_[% pm.borrowernumber | html %]"><input type="radio" id="deny_modify_[% pm.borrowernumber | html %]" name="modify_[% pm.borrowernumber | html %]" value="deny" /> Deny</label>
134
135
136                                             <label for="ignore_modify_[% pm.borrowernumber | html %]"><input type="radio" id="ignore_modify_[% pm.borrowernumber | html %]" name="modify_[% pm.borrowernumber | html %]" value="ignore" checked="checked"/> Ignore</label>
137                                             &nbsp;|&nbsp; <a target="_blank" href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% pm.borrowernumber | html %]" >Patron details</a>
138                                         </div>
139
140                                         [% IF borrowers.$borrowernumber.gonenoaddress > 0 %]
141                                             <div class="dialog message" style="margin-top:.8em">
142                                                 <h4>Patron's address in doubt</h4>
143                                                 <p>The <strong>Gone no address</strong> flag is set for this patron. If this modification request resolves the issue, please unset the flag.</p>
144                                                 <input type="checkbox" id="unset_gna_[% pm.borrowernumber | html %]" name="unset_gna_[% pm.borrowernumber | html %]" value="unset_gna_[% pm.borrowernumber | html %]"/>
145                                                 <label for="unset_gna_[% pm.borrowernumber | html %]">Unset Gone no address for this patron</label>
146                                             </div>
147                                         [% END %]
148
149                                         [% IF !pm.extended_attributes and pm.size > 3 or pm.extended_attributes and pm.size > 4 %]
150                                             [%# timestamp+verification_token+borrowernumber=3 %]
151                                             <div class="members-update-table">
152                                                 <table>
153                                                     <tr>
154                                                         <th>Field</th>
155                                                         <th>Old value</th>
156                                                         <th>New value</th>
157                                                     </tr>
158
159
160                                                     [% FOREACH key IN pm.keys %]
161                                                         [% IF ( key != "timestamp" and key != "extended_attributes" ) %]
162                                                             [% IF ( ( pm.$key OR borrowers.$borrowernumber.$key ) && ( pm.$key != borrowers.$borrowernumber.$key ) ) %]
163                                                                 <tr>
164                                                                     <td>[% PROCESS display_names field = key %]</td>
165                                                                     [% IF ( key == "dateofbirth" ) %]
166                                                                         <td>[% borrowers.$borrowernumber.$key | $KohaDates %]</td>
167                                                                         <td>[% pm.$key | $KohaDates %]</td>
168                                                                     [% ELSIF key == 'branchcode' %]
169                                                                         <td>[% Branches.GetName( borrowers.$borrowernumber.$key ) | html %]</td>
170                                                                         <td>[% Branches.GetName( pm.$key ) | html %]</td>
171                                                                     [% ELSE %]
172                                                                         <td>[% borrowers.$borrowernumber.$key | html %]</td>
173                                                                         <td>[% pm.$key | html %]</td>
174                                                                     [% END %]
175                                                                 </tr>
176                                                             [% END %]
177                                                         [% END %]
178                                                     [% END %]
179                                                 </table>
180                                             </div> <!-- /.members-update-table -->
181                                         [% END # /!pm.extended_attributes %]
182                                         [% IF borrowers.$borrowernumber.modified_attributes %]
183                                             <div class="members-update-table">
184                                                 <h4>[% PROCESS display_names field='extended_attributes' %]</h4>
185                                                 <table>
186                                                     <tr>
187                                                         <th>Field</th>
188                                                         <th>Old value</th>
189                                                         <th>New value</th>
190                                                     </tr>
191                                                     [% FOREACH attribute_group IN borrowers.$borrowernumber.modified_attributes %]
192                                                         <tr>
193                                                             <td>[% attribute_group.type.description | html %]</td>
194                                                             <td>[% PROCESS display_extended_attributes attrs=attribute_group.before type=attribute_group.type %]</td>
195                                                             <td>[% PROCESS display_extended_attributes attrs=attribute_group.after type=attribute_group.type %]</td>
196                                                         </tr>
197                                                     [% END %]
198                                                 </table>
199                                             </div> <!-- /.members-update-table -->
200                                         [% END # / borrowers.$borrowernumber.modified_attributes %]
201                                     </div> <!-- /.panel-body -->
202                                 </div> <!-- /.panel-collapse.collapse -->
203                             </div> <!-- /panel.panel-default -->
204                         [% END # /FOREACH pm %]
205                     </div> <!-- /#pending-updates -->
206                     <fieldset class="action"><input type="submit" class="btn btn-primary" value="Submit" /></fieldset>
207                 </form>
208             [% ELSE %]
209                 <div class="dialog message">
210                     <p>There are no pending patron modifications.</p>
211                 </div>
212             [% END %]
213
214         </div>
215     </div>
216
217 [% MACRO jsinclude BLOCK %]
218     [% INCLUDE 'str/members-menu.inc' %]
219     [% Asset.js("js/members-menu.js") | $raw %]
220     <script>
221         $(document).ready(function(){
222             [%- IF ( active ) -%]
223                 $("#pending_updates a[href='#panel_modify_" + [% active | html %] + "']").click();
224             [%- ELSE -%]
225                 $("#pending_updates a.collapsed:eq(0)").click();
226             [%- END -%]
227         });
228     </script>
229 [% END %]
230
231 [% INCLUDE 'intranet-bottom.inc' %]