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 / +171 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-59 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>
56
                    <form type="post" action="merge-patrons.pl">
102
103
                    <form type="post" action="merge-patrons.pl" id="patron-merge-form">
57
                        <table id="patron-merge-table" class="datatable">
104
                        <table id="patron-merge-table" class="datatable">
58
                            <thead>
105
                            <thead>
59
                                <tr>
106
                                <tr>
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 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>State:</strong></div>
216
                            <div><strong>Zip code:</strong></div>
217
                            <div><strong>Country:</strong></div>
218
                            <br />
219
                            <div><strong>Registration date:</strong></div>
220
                            <div><strong>Renewal date:</strong></div>
221
                            <div><strong>Expiration date:</strong></div>
222
                            <div><strong>Date of birth:</strong></div>
223
                            <div><strong>Restricted:</strong></div>
224
                            <div><strong>Primary email:</strong></div>
225
                            <div><strong>Secondary email:</strong></div>
226
                            <div><strong>Primary phone:</strong></div>
227
                            <div><strong>Secondary phone:</strong></div>
228
                            <div><strong>Other phone:</strong></div>
229
                            <div><strong>Gender:</strong></div>
230
                            <div><strong>Updated on:</strong></div>
231
                            <div><strong>Username:</strong></div>
232
                        </div>
233
234
                        [% FOREACH p IN patrons %]
235
                            <div id="col-[% p.borrowernumber | html %]-orig"class="col[% loop.index | html %]">
236
<!-- <pre> block is unindented to avoid unwanted whitespace -->
237
<pre>
238
[% IF ( p.surname ) %][% p.surname | html %], [% p.firstname | html %][% ELSE %]-[% END %]
239
[% IF ( p.initials ) %][% p.initials | html %][% ELSE %]-[% END %]
240
[% IF ( p.othernames ) %][% p.othernames | html %][% ELSE %]-[% END %]
241
[% IF ( p.branchcode ) %][% p.branchcode | html %][% ELSE %]-[% END %]
242
[% IF ( p.cardnumber ) %][% p.cardnumber | html %][% ELSE %]-[% END %]
243
[% IF ( p.categorycode ) %][% p.categorycode | html %][% ELSE %]-[% END %]
244
245
[% IF ( p.address ) %][% p.address | html %][% ELSE %]-[% END %]
246
[% IF ( p.address2 ) %][% p.address2 | html %][% ELSE %]-[% END %]
247
[% IF ( p.city ) %][% p.city | html %][% ELSE %]-[% END %]
248
[% IF ( p.state ) %][% p.state | html %][% ELSE %]-[% END %]
249
[% IF ( p.zipcode ) %][% p.zipcode | html %][% ELSE %]-[% END %]
250
[% IF ( p.country ) %][% p.country | html %][% ELSE %]-[% END %]
251
252
[% IF ( p.dateenrolled ) %][% p.dateenrolled | html %][% ELSE %]-[% END %]
253
[% IF ( p.date_renewed ) %][% p.date_renewed | html %][% ELSE %]-[% END %]
254
[% IF ( p.dateexpiry ) %][% p.dateexpiry | html %][% ELSE %]-[% END %]
255
[% IF ( p.dateofbirth ) %][% p.dateofbirth | html %][% ELSE %]-[% END %]
256
[% IF ( p.debarred ) %][% p.debarred | html %][% ELSE %]-[% END %]
257
[% IF ( p.email ) %][% p.email | html %][% ELSE %]-[% END %]
258
[% IF ( p.emailpro ) %][% p.emailpro | html %][% ELSE %]-[% END %]
259
[% IF ( p.phone ) %][% p.phone | html %][% ELSE %]-[% END %]
260
[% IF ( p.phonepro ) %][% p.phonepro | html %][% ELSE %]-[% END %]
261
[% IF ( p.mobile ) %][% p.mobile | html %][% ELSE %]-[% END %]
262
[% IF ( p.sex ) %][% p.sex | html %][% ELSE %]-[% END %]
263
[% IF ( p.updated_on ) %][% p.updated_on | html %][% ELSE %]-[% END %]
264
[% IF ( p.userid ) %][% p.userid | html %][% ELSE %]-[% END %]
265
</pre>
266
                            </div>
267
                        [% END %]
268
                        [% FOREACH p IN patrons %]
269
                            <div id="col-[% p.borrowernumber | html %]-diff" class="col[% ( loop.index + 2 ) | html %]"><pre></pre></div>
270
                        [% END %]
271
                    </div>
272
                </div>
273
                <div class="modal-footer">
274
                    <button type="button" class="btn btn-default" id="submit-merge-form"><i class="fa fa-compress" aria-hidden="true"></i> Merge patrons</button>
275
                    <button type="button" class="btn btn-default" data-dismiss="modal"><i class="fa fa-remove" aria-hidden="true"></i> Close</button>
276
                </div>
277
            </div> <!-- /.modal-content -->
278
        </div> <!-- /.modal-dialog -->
279
    </div> <!-- /#compareModal -->
280
142
[% MACRO jsinclude BLOCK %]
281
[% MACRO jsinclude BLOCK %]
143
    [% INCLUDE 'str/members-menu.inc' %]
282
    [% INCLUDE 'str/members-menu.inc' %]
144
    [% Asset.js("js/members-menu.js") | $raw %]
283
    [% Asset.js("js/members-menu.js") | $raw %]
145
284
    [% Asset.js("lib/jsdiff/jsdiff.min.js") | $raw %]
146
    <script>
285
    <script>
147
    $(document).ready(function() {
286
    $(document).ready(function() {
148
        $('#merge-patrons').prop('disabled', true);
287
        var controls = $("#merge-patrons, #compare_patrons");
288
        controls.prop('disabled', true);
149
        $('#patron-merge-table').on('change', 'input', function() {
289
        $('#patron-merge-table').on('change', 'input', function() {
150
            if ( $('.keeper:checked').length > 0 ) {
290
            if ( $('.keeper:checked').length > 0 ) {
151
                $('#merge-patrons').prop('disabled', false);
291
                controls.prop('disabled', false);
152
            } else {
292
            } else {
153
                $('#merge-patrons').prop('disabled', true);
293
                controls.prop('disabled', true);
154
            }
294
            }
155
        });
295
        });
296
297
        $("#compare_patrons").on("click", function(e){
298
            e.preventDefault();
299
            $("#compareModal").modal("show");
300
        });
301
302
        $("#compareModal").on("shown.bs.modal", function(){
303
            /* Find which column is the basis for merging */
304
            var col0 = $(".keeper:checked").data("borrowernumber");
305
            var col1 = $(".keeper:not(:checked)").data("borrowernumber");
306
            /* Get the original patron data for comparison */
307
            var diff1 = $("#col-" + col0 + "-orig pre").text();
308
            var diff2 = $("#col-" + col1 + "-orig pre").text();
309
310
            var diffs = diffString(diff2, diff1);
311
            /* Load the diff HTML in the empty columns */
312
            $(".col2 pre, .col3 pre").html(diffs);
313
        });
314
315
        $("#submit-merge-form").on("click", function(){
316
            $("#patron-merge-form").submit();
317
        });
156
    });
318
    });
319
157
    </script>
320
    </script>
158
[% END %]
321
[% END %]
159
322
160
- 

Return to bug 27607