Tomas Cohen Arazi
253dbb758a
This patch moves the Koha::Patrons->merge method into Koha::Patron->merge_with in the line of the discussed implementation for bug 15336. I agree with that implementation so I provide this follow-up. Tests are adjusted, the controller script is adapted too. The behaviour remains. Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
136 lines
5.9 KiB
Text
136 lines
5.9 KiB
Text
[% USE Branches %]
|
|
[% USE Categories %]
|
|
[% USE KohaDates %]
|
|
[% INCLUDE 'doc-head-open.inc' %]
|
|
<title>Koha › Patrons › Merge patron records</title>
|
|
[% INCLUDE 'doc-head-close.inc' %]
|
|
|
|
<script type="text/javascript">
|
|
//<![CDATA[
|
|
$(document).ready(function() {
|
|
$('#merge-patrons').prop('disabled', true);
|
|
$('#patron-merge-table').on('change', 'input', function() {
|
|
if ( $('.keeper:checked').length > 0 ) {
|
|
$('#merge-patrons').prop('disabled', false);
|
|
} else {
|
|
$('#merge-patrons').prop('disabled', true);
|
|
}
|
|
});
|
|
});
|
|
//]]>
|
|
</script>
|
|
|
|
</head>
|
|
<body id="pat_merge" class="pat">
|
|
[% INCLUDE 'header.inc' %]
|
|
[% INCLUDE 'patron-search.inc' %]
|
|
|
|
[% BLOCK display_names %]
|
|
[% SWITCH rs %]
|
|
[% CASE 'Accountline' %]account lines
|
|
[% CASE 'ArticleRequest' %]article requests
|
|
[% CASE 'BorrowerAttribute' %]extended patron attributes
|
|
[% CASE 'BorrowerDebarment' %]patron restrictions
|
|
[% CASE 'BorrowerFile' %]patrons files
|
|
[% CASE 'BorrowerModification' %]patron modification requests
|
|
[% CASE 'ClubEnrollment' %]club enrollments
|
|
[% CASE 'Issue' %]checkouts
|
|
[% CASE 'ItemsLastBorrower' %]marks as last borrower of item
|
|
[% CASE 'Linktracker' %]tracked link clicks
|
|
[% CASE 'Message' %]patron messages
|
|
[% CASE 'MessageQueue' %]patron notices
|
|
[% CASE 'OldIssue' %]previous checkouts
|
|
[% CASE 'OldReserve' %]filled holds
|
|
[% CASE 'Rating' %]ratings
|
|
[% CASE 'Reserve' %]current holds
|
|
[% CASE 'Review' %]reviews
|
|
[% CASE 'Statistic' %]statistics
|
|
[% CASE 'SearchHistory' %]historical searches
|
|
[% CASE 'Suggestion' %]purchase suggestions
|
|
[% CASE 'TagAll' %]tags
|
|
[% CASE 'Virtualshelfcontent' %]list items
|
|
[% CASE 'Virtualshelfshare' %]list shares
|
|
[% CASE 'Virtualshelve' %]lists
|
|
[% CASE %][% rs %]
|
|
[% END %]
|
|
[% END %]
|
|
|
|
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/members/members-home.pl">Patrons</a> › Merge patron records</div>
|
|
|
|
<div id="doc2" class="yui-t7">
|
|
<div id="bd">
|
|
<div id="yui-main">
|
|
<h3>Merge patron records</h3>
|
|
|
|
[% IF action == 'show' %]
|
|
<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>
|
|
<form type="post" action="merge-patrons.pl">
|
|
<table id="patron-merge-table" class="datatable">
|
|
<thead>
|
|
<tr>
|
|
<th> </th>
|
|
<th>Card</th>
|
|
<th>Name</th>
|
|
<th>Date of birth</th>
|
|
<th>Category</th>
|
|
<th>Library</th>
|
|
<th>Expires on</th>
|
|
</tr>
|
|
</thead>
|
|
|
|
<tbody>
|
|
[% FOREACH p IN patrons %]
|
|
<tr>
|
|
<td><input class='keeper' type='radio' name='keeper' value='[% p.id %]' /></td>
|
|
<td>[% p.cardnumber | html %]</td>
|
|
<td>[% p.firstname | html %] [% p.surname | html %]</td>
|
|
<td>[% p.dateofbirth | $KohaDates %]</td>
|
|
<td>[% Categories.GetName( p.categorycode ) %] ([% p.categorycode %])</td>
|
|
<td>[% Branches.GetName( p.branchcode ) %]</td>
|
|
<td>[% p.dateexpiry | $KohaDates %]</td>
|
|
[% END %]
|
|
</tbody>
|
|
</table>
|
|
|
|
[% FOREACH p IN patrons %]
|
|
<input type="hidden" name="id" value="[% p.id %]" />
|
|
[% END %]
|
|
|
|
<p/>
|
|
|
|
<input type="hidden" name="action" value="merge" />
|
|
<input id="merge-patrons" type="submit" value="Merge patrons" />
|
|
</form>
|
|
[% ELSIF action == 'merge' %]
|
|
<h4>Results</h4>
|
|
|
|
[% IF error %]
|
|
<div class="dialog alert">Merge failed! The following error was reported: [% error %].</div>
|
|
[% ELSE %]
|
|
<p>
|
|
Patron records merged into <a href="moremember.pl?borrowernumber=[% keeper.id %]">[% keeper.firstname %] [% keeper.surname %] ([% keeper.cardnumber | html %])</a>
|
|
</p>
|
|
|
|
[% FOREACH pair IN results.merged.pairs %]
|
|
[% SET patron = pair.value.patron %]
|
|
|
|
<h5>[% patron.firstname %] [% patron.surname %] ([% patron.cardnumber %])</h5>
|
|
|
|
[% FOREACH r IN pair.value.updated.pairs %]
|
|
[% SET name = r.key %]
|
|
[% SET count = r.value %]
|
|
[% IF count %]
|
|
<p>
|
|
[% count %] [% PROCESS display_names rs = name %] transferred.
|
|
[% IF name == 'Reserve' %]
|
|
<strong>It is advisable to check for and resolve duplicate holds due to merging.</strong>
|
|
[% END %]
|
|
</p>
|
|
[% END %]
|
|
[% END %]
|
|
[% END %]
|
|
[% END %]
|
|
[% END %]
|
|
</div>
|
|
</div>
|
|
[% INCLUDE 'intranet-bottom.inc' %]
|