Bug 26727: (follow-up) More markup corrections
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / members / merge-patrons.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% USE Branches %]
4 [% USE Categories %]
5 [% USE KohaDates %]
6 [% SET footerjs = 1 %]
7 [% INCLUDE 'doc-head-open.inc' %]
8 <title>Koha &rsaquo; Patrons &rsaquo; Merge patron records</title>
9 [% INCLUDE 'doc-head-close.inc' %]
10
11 </head>
12 <body id="pat_merge" class="pat">
13 [% INCLUDE 'header.inc' %]
14 [% INCLUDE 'patron-search.inc' %]
15
16 [% BLOCK display_names %]
17     [% SWITCH rs %]
18         [% CASE 'Accountline'           %]account lines
19         [% CASE 'ArticleRequest'        %]article requests
20         [% CASE 'BorrowerAttribute'     %]extended patron attributes
21         [% CASE 'BorrowerDebarment'     %]patron restrictions
22         [% CASE 'BorrowerFile'          %]patrons files
23         [% CASE 'BorrowerModification'  %]patron modification requests
24         [% CASE 'ClubEnrollment'        %]club enrollments
25         [% CASE 'Issue'                 %]checkouts
26         [% CASE 'ItemsLastBorrower'     %]marks as last borrower of item
27         [% CASE 'Linktracker'           %]tracked link clicks
28         [% CASE 'Message'               %]patron messages
29         [% CASE 'MessageQueue'          %]patron notices
30         [% CASE 'OldIssue'              %]previous checkouts
31         [% CASE 'OldReserve'            %]filled holds
32         [% CASE 'Rating'                %]ratings
33         [% CASE 'Reserve'               %]current holds
34         [% CASE 'Review'                %]reviews
35         [% CASE 'Statistic'             %]statistics
36         [% CASE 'SearchHistory'         %]historical searches
37         [% CASE 'Suggestion'            %]purchase suggestions
38         [% CASE 'TagAll'                %]tags
39         [% CASE 'Virtualshelfcontent'   %]list items
40         [% CASE 'Virtualshelfshare'     %]list shares
41         [% CASE 'Virtualshelve'         %]lists
42         [% CASE %][% rs | html %]
43     [% END %]
44 [% END %]
45
46 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/members/members-home.pl">Patrons</a> &rsaquo; Merge patron records</div>
47
48 <div class="main container-fluid">
49     <div class="row">
50         <div class="col-md-10 col-md-offset-1 col-lg-8 col-lg-offset-2">
51             <h3>Merge patron records</h3>
52
53             [% IF action == 'show' %]
54                 [% IF patrons.count > 1 %]
55                     <p>Select patron to keep. Data from the other patrons will be transferred to this patron record and the remaining patron records will be deleted.</p>
56                     <form type="post" action="merge-patrons.pl">
57                         <table id="patron-merge-table" class="datatable">
58                             <thead>
59                                 <tr>
60                                     <th>&nbsp;</th>
61                                     <th>Card</th>
62                                     <th>Name</th>
63                                     <th>Date of birth</th>
64                                     <th>Category</th>
65                                     <th>Library</th>
66                                     <th>Expires on</th>
67                                 </tr>
68                             </thead>
69
70                             <tbody>
71                                 [% FOREACH p IN patrons %]
72                                     <tr>
73                                         <td><input class="keeper" type="radio" name="keeper" value="[% p.id | html %]" id="keeper_[% p.id | html %]" /></td>
74                                         <td>
75                                             <label for="keeper_[% p.id | html %]">
76                                                 <strong>[% p.cardnumber | html %]</strong>
77                                             </label>
78                                         </td>
79                                         <td>[% INCLUDE 'patron-title.inc' patron = p %]</td>
80                                         <td>[% p.dateofbirth | $KohaDates %]</td>
81                                         <td>[% Categories.GetName( p.categorycode ) | html %] ([% p.categorycode | html %])</td>
82                                         <td>[% Branches.GetName( p.branchcode ) | html %]</td>
83                                         <td>[% p.dateexpiry | $KohaDates %]</td>
84                                 [% END %]
85                             </tbody>
86                         </table>
87
88                         <fieldset class="action">
89                             [% FOREACH p IN patrons %]
90                                 <input type="hidden" name="id" value="[% p.id | html %]" />
91                             [% END %]
92                             <input type="hidden" name="action" value="merge" />
93                             <input id="merge-patrons" type="submit" value="Merge patrons" />
94                         </fieldset>
95
96                     [% ELSE %]
97                         <div class="dialog alert">Error: Two or more patrons need to be selected for merging</div>
98                     [% END %]
99                 </form>
100             [% ELSIF action == 'merge' %]
101                 <h4>Results</h4>
102                 [% IF error %]
103                     [% IF error == 'INVALID_KEEPER' %]
104                         <div class="dialog alert">Merge failed! The patron to keep was invalid.</div>
105                     [% ELSE %]
106                         <div class="dialog alert">Merge failed! The following error was reported: [% error | html %].</div>
107                     [% END %]
108                 [% ELSIF !results.merged.keys.size %]
109                     <div class="dialog alert">No valid patrons to merge were found.</div>
110                 [% ELSE %]
111                     <p>
112                         Patron records merged into <a href="moremember.pl?borrowernumber=[% keeper.id | uri %]">[% INCLUDE 'patron-title.inc' patron = keeper %]</a>
113                     </p>
114
115                     [% FOREACH pair IN results.merged.pairs %]
116                         [% SET patron = pair.value.patron %]
117
118                         <h5>[% INCLUDE 'patron-title.inc' %]</h5>
119
120                         [% FOREACH r IN pair.value.updated.pairs %]
121                             [% SET name = r.key %]
122                             [% SET count = r.value %]
123                             [% IF count %]
124                                 <p>
125                                     <span>[% count | html %] [% PROCESS display_names rs = name %] transferred.</span>
126                                     [% IF name == 'Reserve' %]
127                                         <strong>It is advisable to check for and resolve duplicate holds due to merging.</strong>
128                                     [% END %]
129                                 </p>
130                             [% END %]
131                         [% END %]
132                     [% END %]
133                 [% END %]
134
135                 [% UNLESS error %]
136                     <a class="btn btn-default" href="moremember.pl?borrowernumber=[% keeper.id | html %]">View patron record</a>
137                 [% END %]
138             [% END %]
139         </div>
140     </div>
141
142 [% MACRO jsinclude BLOCK %]
143     [% INCLUDE 'str/members-menu.inc' %]
144     [% Asset.js("js/members-menu.js") | $raw %]
145
146     <script>
147     $(document).ready(function() {
148         $('#merge-patrons').prop('disabled', true);
149         $('#patron-merge-table').on('change', 'input', function() {
150             if ( $('.keeper:checked').length > 0 ) {
151                 $('#merge-patrons').prop('disabled', false);
152             } else {
153                 $('#merge-patrons').prop('disabled', true);
154             }
155         });
156     });
157     </script>
158 [% END %]
159
160 [% INCLUDE 'intranet-bottom.inc' %]