Bug 22698: Fix incorrect button classes
[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 %]' /></td>
74                                         <td>[% p.cardnumber | html %]</td>
75                                         <td>[% INCLUDE 'patron-title.inc' patron = p %]</td>
76                                         <td>[% p.dateofbirth | $KohaDates %]</td>
77                                         <td>[% Categories.GetName( p.categorycode ) | html %] ([% p.categorycode | html %])</td>
78                                         <td>[% Branches.GetName( p.branchcode ) | html %]</td>
79                                         <td>[% p.dateexpiry | $KohaDates %]</td>
80                                 [% END %]
81                             </tbody>
82                         </table>
83
84                         [% FOREACH p IN patrons %]
85                             <input type="hidden" name="id" value="[% p.id | html %]" />
86                         [% END %]
87
88                         <p/>
89
90                         <input type="hidden" name="action" value="merge" />
91                         <input id="merge-patrons" type="submit" value="Merge patrons" />
92                     [% ELSE %]
93                         <div class="dialog alert">Error: Two or more patrons need to be selected for merging</div>
94                     [% END %]
95                 </form>
96             [% ELSIF action == 'merge' %]
97                 <h4>Results</h4>
98                 [% IF error %]
99                     [% IF error == 'INVALID_KEEPER' %]
100                         <div class="dialog alert">Merge failed! The patron to keep was invalid.</div>
101                     [% ELSE %]
102                         <div class="dialog alert">Merge failed! The following error was reported: [% error | html %].</div>
103                     [% END %]
104                 [% ELSIF !results.merged.keys.size %]
105                     <div class="dialog alert">No valid patrons to merge were found.</div>
106                 [% ELSE %]
107                     <p>
108                         Patron records merged into <a href="moremember.pl?borrowernumber=[% keeper.id | uri %]">[% INCLUDE 'patron-title.inc' patron = keeper %]</a>
109                     </p>
110
111                     [% FOREACH pair IN results.merged.pairs %]
112                         [% SET patron = pair.value.patron %]
113
114                         <h5>[% INCLUDE 'patron-title.inc' %]</h5>
115
116                         [% FOREACH r IN pair.value.updated.pairs %]
117                             [% SET name = r.key %]
118                             [% SET count = r.value %]
119                             [% IF count %]
120                                 <p>
121                                     <span>[% count | html %] [% PROCESS display_names rs = name %] transferred.</span>
122                                     [% IF name == 'Reserve' %]
123                                         <strong>It is advisable to check for and resolve duplicate holds due to merging.</strong>
124                                     [% END %]
125                                 </p>
126                             [% END %]
127                         [% END %]
128                     [% END %]
129                 [% END %]
130
131                 [% UNLESS error %]
132                     <a class="btn btn-default" href="moremember.pl?borrowernumber=[% keeper.id | html %]">View patron record</a>
133                 [% END %]
134             [% END %]
135         </div>
136     </div>
137
138 [% MACRO jsinclude BLOCK %]
139     [% INCLUDE 'str/members-menu.inc' %]
140     [% Asset.js("js/members-menu.js") | $raw %]
141
142     <script>
143     $(document).ready(function() {
144         $('#merge-patrons').prop('disabled', true);
145         $('#patron-merge-table').on('change', 'input', function() {
146             if ( $('.keeper:checked').length > 0 ) {
147                 $('#merge-patrons').prop('disabled', false);
148             } else {
149                 $('#merge-patrons').prop('disabled', true);
150             }
151         });
152     });
153     </script>
154 [% END %]
155
156 [% INCLUDE 'intranet-bottom.inc' %]