View | Details | Raw Unified | Return to bug 27607
Collapse All | Expand All

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/merge-patrons.tt (-9 / +168 lines)
Lines 7-13 Link Here
7
[% INCLUDE 'doc-head-open.inc' %]
7
[% INCLUDE 'doc-head-open.inc' %]
8
<title>Koha &rsaquo; Patrons &rsaquo; Merge patron records</title>
8
<title>Koha &rsaquo; Patrons &rsaquo; Merge patron records</title>
9
[% INCLUDE 'doc-head-close.inc' %]
9
[% INCLUDE 'doc-head-close.inc' %]
10
10
[% FILTER collapse %]
11
    <style>
12
        ins {
13
            background-color: #e6ffe6;
14
        }
15
        del {
16
            background-color: #ffe6e6;
17
        }
18
        .col0,
19
        .col1 {
20
            display: none;
21
        }
22
        .col3 ins,
23
        .col2 del {
24
            display: none;
25
        }
26
        #col-label,
27
        .col2,
28
        .col3 {
29
            border-right: 1px solid #EEE;
30
            flex-grow: 1;
31
            margin-right:1em;
32
        }
33
        #col-label {
34
            font-family: monospace;
35
        }
36
        #col-label div {
37
            white-space: none;
38
        }
39
        .compare {
40
            display: flex;
41
        }
42
        .modal-lg {
43
            width: 90%;
44
        }
45
    </style>
46
[% END %]
11
</head>
47
</head>
12
<body id="pat_merge" class="pat">
48
<body id="pat_merge" class="pat">
13
[% INCLUDE 'header.inc' %]
49
[% INCLUDE 'header.inc' %]
Lines 52-58 Link Here
52
88
53
            [% IF action == 'show' %]
89
            [% IF action == 'show' %]
54
                [% IF patrons.count > 1 %]
90
                [% IF patrons.count > 1 %]
91
                    [% IF ( patrons.count == 2 ) %]
92
                        <div id="toolbar" class="btn-toolbar">
93
                            <div class="btn-group">
94
                                <button class="btn btn-default" id="compare_patrons">
95
                                    <i class="fa fa-arrows-h"></i> Compare patrons
96
                                </button>
97
                            </div>
98
                        </div>
99
                    [% END %]
100
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>
101
                    <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>
102
56
                    <form type="post" action="merge-patrons.pl">
103
                    <form type="post" action="merge-patrons.pl">
57
                        <table id="patron-merge-table" class="datatable">
104
                        <table id="patron-merge-table" class="datatable">
58
                            <thead>
105
                            <thead>
Lines 70-82 Link Here
70
                            <tbody>
117
                            <tbody>
71
                                [% FOREACH p IN patrons %]
118
                                [% FOREACH p IN patrons %]
72
                                    <tr>
119
                                    <tr>
73
                                        <td><input class="keeper" type="radio" name="keeper" value="[% p.id | html %]" id="keeper_[% p.id | html %]" /></td>
120
                                        <td><input class="keeper" type="radio" name="keeper" value="[% p.id | html %]" data-borrowernumber="[% p.id | html %]" id="keeper_[% p.id | html %]" /></td>
74
                                        <td>
121
                                        <td>
75
                                            <label for="keeper_[% p.id | html %]">
122
                                            <label for="keeper_[% p.id | html %]">
76
                                                <strong>[% p.cardnumber | html %]</strong>
123
                                                <strong>[% p.cardnumber | html %]</strong>
77
                                            </label>
124
                                            </label>
78
                                        </td>
125
                                        </td>
79
                                        <td>[% INCLUDE 'patron-title.inc' patron = p %]</td>
126
                                        <td>
127
                                            <a target="_blank" href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% p.borrowernumber | uri %]">
128
                                                [% INCLUDE 'patron-title.inc' patron = p %]
129
                                                <i class="fa fa-window-restore"></i>
130
                                            </a>
131
                                        </td>
80
                                        <td>[% p.dateofbirth | $KohaDates %]</td>
132
                                        <td>[% p.dateofbirth | $KohaDates %]</td>
81
                                        <td>[% Categories.GetName( p.categorycode ) | html %] ([% p.categorycode | html %])</td>
133
                                        <td>[% Categories.GetName( p.categorycode ) | html %] ([% p.categorycode | html %])</td>
82
                                        <td>[% Branches.GetName( p.branchcode ) | html %]</td>
134
                                        <td>[% Branches.GetName( p.branchcode ) | html %]</td>
Lines 90-96 Link Here
90
                                <input type="hidden" name="id" value="[% p.id | html %]" />
142
                                <input type="hidden" name="id" value="[% p.id | html %]" />
91
                            [% END %]
143
                            [% END %]
92
                            <input type="hidden" name="action" value="merge" />
144
                            <input type="hidden" name="action" value="merge" />
93
                            <input id="merge-patrons" type="submit" value="Merge patrons" />
145
                            <input id="merge-patrons" type="button" value="Merge patrons" />
94
                        </fieldset>
146
                        </fieldset>
95
147
96
                    [% ELSE %]
148
                    [% ELSE %]
Lines 139-159 Link Here
139
        </div>
191
        </div>
140
    </div>
192
    </div>
141
193
194
    <!-- Modal -->
195
    <div class="modal" id="compareModal" tabindex="-1" role="dialog" aria-labelledby="compareModalLabel">
196
        <div class="modal-dialog modal-lg" role="document">
197
            <div class="modal-content">
198
                <div class="modal-header">
199
                    <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
200
                    <h4 class="modal-title" id="compareModalLabel">Compare patrons for merging</h4>
201
                </div>
202
                <div class="modal-body">
203
                    <div class="compare">
204
                        <div id="col-label">
205
                            <div><strong>Name:</strong></div>
206
                            <div><strong>Initials:</strong></div>
207
                            <div><strong>Other name:</strong></div>
208
                            <div><strong>Library:</strong></div>
209
                            <div><strong>Card number:</strong></div>
210
                            <div><strong>Category:</strong></div>
211
                            <br />
212
                            <div><strong>Address line 1:</strong></div>
213
                            <div><strong>Address line 2:</strong></div>
214
                            <div><strong>City:</strong></div>
215
                            <div><strong>Country:</strong></div>
216
                            <div><strong>State:</strong></div>
217
                            <div><strong>Zip code:</strong></div>
218
                            <div><strong>Country:</strong></div>
219
                            <br />
220
                            <div><strong>Registration date:</strong></div>
221
                            <div><strong>Renewal date:</strong></div>
222
                            <div><strong>Expiration date:</strong></div>
223
                            <div><strong>Date of birth:</strong></div>
224
                            <div><strong>Restricted:</strong></div>
225
                            <div><strong>Primary email:</strong></div>
226
                            <div><strong>Secondary email:</strong></div>
227
                            <div><strong>Primary phone:</strong></div>
228
                            <div><strong>Secondary phone:</strong></div>
229
                            <div><strong>Other phone:</strong></div>
230
                            <div><strong>Gender:</strong></div>
231
                            <div><strong>Updated on:</strong></div>
232
                            <div><strong>Username:</strong></div>
233
                        </div>
234
235
                        [% FOREACH p IN patrons %]
236
                            <div id="col-[% p.borrowernumber | html %]-orig"class="col[% loop.index | html %]">
237
<!-- <pre> block is unindented to avoid unwanted whitespace -->
238
<pre>
239
[% IF ( p.surname ) %][% p.surname | html %], [% p.firstname | html %][% ELSE %]-[% END %]
240
[% IF ( p.initials ) %][% p.initials | html %][% ELSE %]-[% END %]
241
[% IF ( p.othernames ) %][% p.othernames | html %][% ELSE %]-[% END %]
242
[% IF ( p.branchcode ) %][% p.branchcode | html %][% ELSE %]-[% END %]
243
[% IF ( p.cardnumber ) %][% p.cardnumber | html %][% ELSE %]-[% END %]
244
[% IF ( p.categorycode ) %][% p.categorycode | html %][% ELSE %]-[% END %]
245
246
[% IF ( p.address ) %][% p.address | html %][% ELSE %]-[% END %]
247
[% IF ( p.address2 ) %][% p.address2 | html %][% ELSE %]-[% END %]
248
[% IF ( p.city ) %][% p.city | html %][% ELSE %]-[% END %]
249
[% IF ( p.country ) %][% p.country | html %][% ELSE %]-[% END %]
250
[% IF ( p.state ) %][% p.state | html %][% ELSE %]-[% END %]
251
[% IF ( p.zipcode ) %][% p.zipcode | html %][% ELSE %]-[% END %]
252
[% IF ( p.country ) %][% p.country | html %][% ELSE %]-[% END %]
253
254
[% IF ( p.dateenrolled ) %][% p.dateenrolled | html %][% ELSE %]-[% END %]
255
[% IF ( p.date_renewed ) %][% p.date_renewed | html %][% ELSE %]-[% END %]
256
[% IF ( p.dateexpiry ) %][% p.dateexpiry | html %][% ELSE %]-[% END %]
257
[% IF ( p.dateofbirth ) %][% p.dateofbirth | html %][% ELSE %]-[% END %]
258
[% IF ( p.debarred ) %][% p.debarred | html %][% ELSE %]-[% END %]
259
[% IF ( p.email ) %][% p.email | html %][% ELSE %]-[% END %]
260
[% IF ( p.emailpro ) %][% p.emailpro | html %][% ELSE %]-[% END %]
261
[% IF ( p.phone ) %][% p.phone | html %][% ELSE %]-[% END %]
262
[% IF ( p.phonepro ) %][% p.phonepro | html %][% ELSE %]-[% END %]
263
[% IF ( p.mobile ) %][% p.mobile | html %][% ELSE %]-[% END %]
264
[% IF ( p.sex ) %][% p.sex | html %][% ELSE %]-[% END %]
265
[% IF ( p.updated_on ) %][% p.updated_on | html %][% ELSE %]-[% END %]
266
[% IF ( p.userid ) %][% p.userid | html %][% ELSE %]-[% END %]
267
</pre>
268
                            </div>
269
                        [% END %]
270
                        [% FOREACH p IN patrons %]
271
                            <div id="col-[% p.borrowernumber | html %]-diff" class="col[% ( loop.index + 2 ) | html %]"><pre></pre></div>
272
                        [% END %]
273
                    </div>
274
                </div>
275
                <div class="modal-footer">
276
                    <button type="button" class="btn btn-default" data-dismiss="modal"><i class="fa fa-remove" aria-hidden="true"></i> Close</button>
277
                </div>
278
            </div> <!-- /.modal-content -->
279
        </div> <!-- /.modal-dialog -->
280
    </div> <!-- /#compareModal -->
281
142
[% MACRO jsinclude BLOCK %]
282
[% MACRO jsinclude BLOCK %]
143
    [% INCLUDE 'str/members-menu.inc' %]
283
    [% INCLUDE 'str/members-menu.inc' %]
144
    [% Asset.js("js/members-menu.js") | $raw %]
284
    [% Asset.js("js/members-menu.js") | $raw %]
145
285
    [% Asset.js("lib/jsdiff/jsdiff.min.js") | $raw %]
146
    <script>
286
    <script>
147
    $(document).ready(function() {
287
    $(document).ready(function() {
148
        $('#merge-patrons').prop('disabled', true);
288
        var controls = $("#merge-patrons, #compare_patrons");
289
        controls.prop('disabled', true);
149
        $('#patron-merge-table').on('change', 'input', function() {
290
        $('#patron-merge-table').on('change', 'input', function() {
150
            if ( $('.keeper:checked').length > 0 ) {
291
            if ( $('.keeper:checked').length > 0 ) {
151
                $('#merge-patrons').prop('disabled', false);
292
                controls.prop('disabled', false);
152
            } else {
293
            } else {
153
                $('#merge-patrons').prop('disabled', true);
294
                controls.prop('disabled', true);
154
            }
295
            }
155
        });
296
        });
297
298
        $("#compare_patrons").on("click", function(e){
299
            e.preventDefault();
300
            $("#compareModal").modal("show");
301
        });
302
303
        $("#compareModal").on("shown.bs.modal", function(){
304
            /* Find which column is the basis for merging */
305
            var col0 = $(".keeper:checked").data("borrowernumber");
306
            var col1 = $(".keeper:not(:checked)").data("borrowernumber");
307
            /* Get the original patron data for comparison */
308
            var diff1 = $("#col-" + col0 + "-orig pre").text();
309
            var diff2 = $("#col-" + col1 + "-orig pre").text();
310
311
            var diffs = diffString(diff2, diff1);
312
            /* Load the diff HTML in the empty columns */
313
            $(".col2 pre, .col3 pre").html(diffs);
314
        });
156
    });
315
    });
316
157
    </script>
317
    </script>
158
[% END %]
318
[% END %]
159
319
160
- 

Return to bug 27607