Bugzilla – Attachment 119149 Details for
Bug 27607
Add the ability to compare patron records during merge process
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 27607: Add the ability to compare patron records during merge process
Bug-27607-Add-the-ability-to-compare-patron-record.patch (text/plain), 13.03 KB, created by
Katrin Fischer
on 2021-04-03 13:14:51 UTC
(
hide
)
Description:
Bug 27607: Add the ability to compare patron records during merge process
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2021-04-03 13:14:51 UTC
Size:
13.03 KB
patch
obsolete
>From 80ec6d5ff9d898442088f91f35e6148537f6fc29 Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Fri, 11 Sep 2020 16:33:15 +0000 >Subject: [PATCH] Bug 27607: Add the ability to compare patron records during > merge process >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >This patch adds an option to compare two patron records during the >patron merge process. It can't work with more than two patrons, so the >option only appears if one has selected only two patrons to merge. > >This patch also adds links to the patron names for opening the patron >record in a new tab. > >To test, apply the patch and perform a search for patrons in the staff >client Patrons module. > > - Select two patrons in the list of search results and click "Merge > selected patrons." > - On the merge patron records page, confirm that the two patron names > are links which, when clicked, open the patron details in another > tab. > - Click a radio button to select the patron whose record will be > the basis of the merge. The "Compare patrons" button and "Merge > patrons" should go from disabled to enabled. > - Click the "Compare patrons" button. A modal window should display > highlighting the differences in some selected values in the patron > record. The patron you selected as the basis for the merge should > appear on the left. > - Close the modal and select the other patron as the basis of the > merge. "Compare patrons" again. The other patron should now appear in > the left pane of the comparison. > - Test that the "Merge patrons" button in the modal window works > correctly to submit the merge form and that the correct patron is > used as the basis for merging. > - Repeat the same process above but select more than two patrons for > merging. The "Compare patrons" button should not appear. > >Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr> > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> >--- > .../prog/en/modules/members/merge-patrons.tt | 179 ++++++++++++++++++++- > 1 file changed, 171 insertions(+), 8 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/merge-patrons.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/merge-patrons.tt >index 3ac0fbe1cc..7e994d06a2 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/merge-patrons.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/merge-patrons.tt >@@ -7,7 +7,43 @@ > [% INCLUDE 'doc-head-open.inc' %] > <title>Koha › Patrons › Merge patron records</title> > [% INCLUDE 'doc-head-close.inc' %] >- >+[% FILTER collapse %] >+ <style> >+ ins { >+ background-color: #e6ffe6; >+ } >+ del { >+ background-color: #ffe6e6; >+ } >+ .col0, >+ .col1 { >+ display: none; >+ } >+ .col3 ins, >+ .col2 del { >+ display: none; >+ } >+ #col-label, >+ .col2, >+ .col3 { >+ border-right: 1px solid #EEE; >+ flex-grow: 1; >+ margin-right:1em; >+ } >+ #col-label { >+ font-family: monospace; >+ } >+ #col-label div { >+ white-space: none; >+ } >+ .compare { >+ display: flex; >+ } >+ .modal-lg { >+ width: 90%; >+ } >+ </style> >+[% END %] > </head> > <body id="pat_merge" class="pat"> > [% INCLUDE 'header.inc' %] >@@ -52,8 +88,19 @@ > > [% IF action == 'show' %] > [% IF patrons.count > 1 %] >+ [% IF ( patrons.count == 2 ) %] >+ <div id="toolbar" class="btn-toolbar"> >+ <div class="btn-group"> >+ <button class="btn btn-default" id="compare_patrons"> >+ <i class="fa fa-arrows-h"></i> Compare patrons >+ </button> >+ </div> >+ </div> >+ [% END %] >+ > <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"> >+ >+ <form type="post" action="merge-patrons.pl" id="patron-merge-form"> > <table id="patron-merge-table" class="datatable"> > <thead> > <tr> >@@ -70,13 +117,18 @@ > <tbody> > [% FOREACH p IN patrons %] > <tr> >- <td><input class="keeper" type="radio" name="keeper" value="[% p.id | html %]" id="keeper_[% p.id | html %]" /></td> >+ <td><input class="keeper" type="radio" name="keeper" value="[% p.id | html %]" data-borrowernumber="[% p.id | html %]" id="keeper_[% p.id | html %]" /></td> > <td> > <label for="keeper_[% p.id | html %]"> > <strong>[% p.cardnumber | html %]</strong> > </label> > </td> >- <td>[% INCLUDE 'patron-title.inc' patron = p %]</td> >+ <td> >+ <a target="_blank" href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% p.borrowernumber | uri %]"> >+ [% INCLUDE 'patron-title.inc' patron = p %] >+ <i class="fa fa-window-restore"></i> >+ </a> >+ </td> > <td>[% p.dateofbirth | $KohaDates %]</td> > <td>[% Categories.GetName( p.categorycode ) | html %] ([% p.categorycode | html %])</td> > <td>[% Branches.GetName( p.branchcode ) | html %]</td> >@@ -139,21 +191,132 @@ > </div> > </div> > >+ <!-- Modal --> >+ <div class="modal" id="compareModal" tabindex="-1" role="dialog" aria-labelledby="compareModalLabel"> >+ <div class="modal-dialog modal-lg" role="document"> >+ <div class="modal-content"> >+ <div class="modal-header"> >+ <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> >+ <h4 class="modal-title" id="compareModalLabel">Compare patrons for merging</h4> >+ </div> >+ <div class="modal-body"> >+ <div class="compare"> >+ <div id="col-label"> >+ <div><strong>Name:</strong></div> >+ <div><strong>Initials:</strong></div> >+ <div><strong>Other name:</strong></div> >+ <div><strong>Library:</strong></div> >+ <div><strong>Card number:</strong></div> >+ <div><strong>Category:</strong></div> >+ <br /> >+ <div><strong>Address line 1:</strong></div> >+ <div><strong>Address line 2:</strong></div> >+ <div><strong>City:</strong></div> >+ <div><strong>State:</strong></div> >+ <div><strong>Zip code:</strong></div> >+ <div><strong>Country:</strong></div> >+ <br /> >+ <div><strong>Registration date:</strong></div> >+ <div><strong>Renewal date:</strong></div> >+ <div><strong>Expiration date:</strong></div> >+ <div><strong>Date of birth:</strong></div> >+ <div><strong>Restricted:</strong></div> >+ <div><strong>Primary email:</strong></div> >+ <div><strong>Secondary email:</strong></div> >+ <div><strong>Primary phone:</strong></div> >+ <div><strong>Secondary phone:</strong></div> >+ <div><strong>Other phone:</strong></div> >+ <div><strong>Gender:</strong></div> >+ <div><strong>Updated on:</strong></div> >+ <div><strong>Username:</strong></div> >+ </div> >+ >+ [% FOREACH p IN patrons %] >+ <div id="col-[% p.borrowernumber | html %]-orig"class="col[% loop.index | html %]"> >+<!-- <pre> block is unindented to avoid unwanted whitespace --> >+<pre> >+[% IF ( p.surname ) %][% p.surname | html %], [% p.firstname | html %][% ELSE %]-[% END %] >+[% IF ( p.initials ) %][% p.initials | html %][% ELSE %]-[% END %] >+[% IF ( p.othernames ) %][% p.othernames | html %][% ELSE %]-[% END %] >+[% IF ( p.branchcode ) %][% p.branchcode | html %][% ELSE %]-[% END %] >+[% IF ( p.cardnumber ) %][% p.cardnumber | html %][% ELSE %]-[% END %] >+[% IF ( p.categorycode ) %][% p.categorycode | html %][% ELSE %]-[% END %] >+ >+[% IF ( p.address ) %][% p.address | html %][% ELSE %]-[% END %] >+[% IF ( p.address2 ) %][% p.address2 | html %][% ELSE %]-[% END %] >+[% IF ( p.city ) %][% p.city | html %][% ELSE %]-[% END %] >+[% IF ( p.state ) %][% p.state | html %][% ELSE %]-[% END %] >+[% IF ( p.zipcode ) %][% p.zipcode | html %][% ELSE %]-[% END %] >+[% IF ( p.country ) %][% p.country | html %][% ELSE %]-[% END %] >+ >+[% IF ( p.dateenrolled ) %][% p.dateenrolled | html %][% ELSE %]-[% END %] >+[% IF ( p.date_renewed ) %][% p.date_renewed | html %][% ELSE %]-[% END %] >+[% IF ( p.dateexpiry ) %][% p.dateexpiry | html %][% ELSE %]-[% END %] >+[% IF ( p.dateofbirth ) %][% p.dateofbirth | html %][% ELSE %]-[% END %] >+[% IF ( p.debarred ) %][% p.debarred | html %][% ELSE %]-[% END %] >+[% IF ( p.email ) %][% p.email | html %][% ELSE %]-[% END %] >+[% IF ( p.emailpro ) %][% p.emailpro | html %][% ELSE %]-[% END %] >+[% IF ( p.phone ) %][% p.phone | html %][% ELSE %]-[% END %] >+[% IF ( p.phonepro ) %][% p.phonepro | html %][% ELSE %]-[% END %] >+[% IF ( p.mobile ) %][% p.mobile | html %][% ELSE %]-[% END %] >+[% IF ( p.sex ) %][% p.sex | html %][% ELSE %]-[% END %] >+[% IF ( p.updated_on ) %][% p.updated_on | html %][% ELSE %]-[% END %] >+[% IF ( p.userid ) %][% p.userid | html %][% ELSE %]-[% END %] >+</pre> >+ </div> >+ [% END %] >+ [% FOREACH p IN patrons %] >+ <div id="col-[% p.borrowernumber | html %]-diff" class="col[% ( loop.index + 2 ) | html %]"><pre></pre></div> >+ [% END %] >+ </div> >+ </div> >+ <div class="modal-footer"> >+ <button type="button" class="btn btn-default" id="submit-merge-form"><i class="fa fa-compress" aria-hidden="true"></i> Merge patrons</button> >+ <button type="button" class="btn btn-default" data-dismiss="modal"><i class="fa fa-remove" aria-hidden="true"></i> Close</button> >+ </div> >+ </div> <!-- /.modal-content --> >+ </div> <!-- /.modal-dialog --> >+ </div> <!-- /#compareModal --> >+ > [% MACRO jsinclude BLOCK %] > [% INCLUDE 'str/members-menu.inc' %] > [% Asset.js("js/members-menu.js") | $raw %] >- >+ [% Asset.js("lib/jsdiff/jsdiff.min.js") | $raw %] > <script> > $(document).ready(function() { >- $('#merge-patrons').prop('disabled', true); >+ var controls = $("#merge-patrons, #compare_patrons"); >+ controls.prop('disabled', true); > $('#patron-merge-table').on('change', 'input', function() { > if ( $('.keeper:checked').length > 0 ) { >- $('#merge-patrons').prop('disabled', false); >+ controls.prop('disabled', false); > } else { >- $('#merge-patrons').prop('disabled', true); >+ controls.prop('disabled', true); > } > }); >+ >+ $("#compare_patrons").on("click", function(e){ >+ e.preventDefault(); >+ $("#compareModal").modal("show"); >+ }); >+ >+ $("#compareModal").on("shown.bs.modal", function(){ >+ /* Find which column is the basis for merging */ >+ var col0 = $(".keeper:checked").data("borrowernumber"); >+ var col1 = $(".keeper:not(:checked)").data("borrowernumber"); >+ /* Get the original patron data for comparison */ >+ var diff1 = $("#col-" + col0 + "-orig pre").text(); >+ var diff2 = $("#col-" + col1 + "-orig pre").text(); >+ >+ var diffs = diffString(diff2, diff1); >+ /* Load the diff HTML in the empty columns */ >+ $(".col2 pre, .col3 pre").html(diffs); >+ }); >+ >+ $("#submit-merge-form").on("click", function(){ >+ $("#patron-merge-form").submit(); >+ }); > }); >+ > </script> > [% END %] > >-- >2.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 27607
:
116287
|
116534
|
116895
|
116896
|
117090
|
117091
|
117124
|
117125
|
119064
|
119065
| 119149 |
119150