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