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

(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-patron-search-results.inc (-45 lines)
Lines 1-45 Link Here
1
[% USE KohaDates %]
2
<table id="table_borrowers" class="selections-table">
3
    <thead>
4
        <tr>
5
            <th>Name</th>
6
            <th>Card number</th>
7
            <th>Date of birth</th>
8
            <th>Category</th>
9
            <th>Library</th>
10
            <th>Address</th>
11
            <th>Primary phone</th>
12
        </tr>
13
    </thead>
14
    <tbody>
15
        [% FOREACH borrower IN borrowers %]
16
            [% IF destination == "circ" %]
17
                <tr class="clickable" data-url="/cgi-bin/koha/circ/circulation.pl?borrowernumber=[% borrower.borrowernumber | html %]">
18
                    <td><a href="/cgi-bin/koha/circ/circulation.pl?borrowernumber=[% borrower.borrowernumber | uri %]">[% borrower.surname | html %], [% borrower.firstname | html %]</a></td>
19
            [% ELSIF destination == "holds" %]
20
                [% SET data_url = "/cgi-bin/koha/reserve/request.pl?borrowernumber=" _ borrower.borrowernumber %]
21
                [% FOREACH biblionumber IN biblionumbers %]
22
                    [% SET data_url = data_url _ "&amp;biblionumber=" _ biblionumber %]
23
                [% END %]
24
                [% IF multi_hold %]
25
                    [% SET data_url = data_url _ "&amp;multi_hold=1" %]
26
                [% END %]
27
                <tr class="clickable" data-url="[% data_url | url %]">
28
                    <td><a href="[% data_url | url %]">[% borrower.surname | html %], [% borrower.firstname | html %]</a></td>
29
            [% END %]
30
                <td>[% borrower.cardnumber | html %]</td>
31
                <td data-order="[% borrower.dateofbirth | html %]">[% INCLUDE 'patron-age.inc' patron = borrower %]</td>
32
                <td>[% Categories.GetName( borrower.categorycode ) | html %]</td>
33
                <td>
34
                    [% IF ( Branches.GetLoggedInBranchcode == borrower.branchcode && !singleBranchMode ) %]
35
                        <span class="currentlibrary">[% Branches.GetName( borrower.branchcode ) | html %]</span>
36
                    [% ELSE %]
37
                        [% Branches.GetName( borrower.branchcode ) | html %]
38
                    [% END %]
39
                </td>
40
                <td>[% borrower.address | html %]</td>
41
                <td>[% borrower.phone | html %]</td>
42
            </tr>
43
        [% END %]
44
    </tbody>
45
</table>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt (-42 / +91 lines)
Lines 163-180 Link Here
163
                            [% END %]
163
                            [% END %]
164
                        </ul>
164
                        </ul>
165
                        <div id="holds_patronsearch_pane">
165
                        <div id="holds_patronsearch_pane">
166
                            <form id="holds_patronsearch" action="request.pl" method="post">
166
                            <form id="holds_patronsearch" method="get">
167
                                <div class="hint">Enter patron card number or partial name:</div>
167
                                <div class="hint">Enter patron card number or partial name:</div>
168
                                <input type="text" size="40" id="patron" class="focus" name="findborrower" autocomplete="off" />
168
                                <input type="text" size="40" id="patron" class="focus" autocomplete="off" />
169
                                <input type="submit" value="Search" />
169
                                <input type="submit" value="Search" />
170
                                [% FOREACH biblionumber IN biblionumbers %]
170
                                [% FOREACH biblionumber IN biblionumbers %]
171
                                <input type="hidden" name="biblionumber" value="[% biblionumber | html %]"/>
171
                                <input type="hidden" name="biblionumber" value="[% biblionumber | html %]"/>
172
                                [% END %]
172
                                [% END %]
173
174
                            </form> <!-- /#holds_patronsearch -->
173
                            </form> <!-- /#holds_patronsearch -->
175
                            [% IF borrowers %]
174
176
                                [% INCLUDE 'circ-patron-search-results.inc' destination = "holds" %]
175
                            <table id="table_borrowers" class="selections-table" style="display: none;">
177
                            [% END %]
176
                              <thead>
177
                                <tr>
178
                                  <th>Name</th>
179
                                  <th>Address</th>
180
                                  <th>Card number</th>
181
                                  <th>Date of birth</th>
182
                                  <th>Category</th>
183
                                  <th>Library</th>
184
                                  <th>Primary phone</th>
185
                                </tr>
186
                              </thead>
187
                              <tbody></tbody>
188
                            </table>
189
178
                        </div>
190
                        </div>
179
                        [% IF clubcount %]
191
                        [% IF clubcount %]
180
                            <div id="holds_clubsearch_pane">
192
                            <div id="holds_clubsearch_pane">
Lines 1146-1152 Link Here
1146
    [% INCLUDE 'calendar.inc' %]
1158
    [% INCLUDE 'calendar.inc' %]
1147
    [% INCLUDE 'columns_settings.inc' %]
1159
    [% INCLUDE 'columns_settings.inc' %]
1148
    [% Asset.js("lib/hc-sticky.js") | $raw %]
1160
    [% Asset.js("lib/hc-sticky.js") | $raw %]
1149
    [% Asset.js("js/circ-patron-search-results.js") | $raw %]
1150
    [% INCLUDE 'select2.inc' %]
1161
    [% INCLUDE 'select2.inc' %]
1151
    [% Asset.js("js/holds.js") | $raw%]
1162
    [% Asset.js("js/holds.js") | $raw%]
1152
    <script>
1163
    <script>
Lines 1404-1409 Link Here
1404
        }
1415
        }
1405
1416
1406
         $(document).ready(function() {
1417
         $(document).ready(function() {
1418
1407
            $("#always_show_holds").change(function(){
1419
            $("#always_show_holds").change(function(){
1408
                if( $(this).prop('checked') ){
1420
                if( $(this).prop('checked') ){
1409
                    document.cookie = 'always_show_holds=DO';
1421
                    document.cookie = 'always_show_holds=DO';
Lines 1507-1547 Link Here
1507
                return false;
1519
                return false;
1508
            });
1520
            });
1509
1521
1510
            [% UNLESS ( patron || patron.borrowernumber || borrowers || noitems || nobiblio ) %]
1511
                [% IF ( PatronAutoComplete ) %]
1512
                $( "#patron" ).autocomplete({
1513
                    source: "/cgi-bin/koha/circ/ysearch.pl",
1514
                    minLength: 3,
1515
                    select: function( event, ui ) {
1516
                        $( "#patron" ).val( ui.item.cardnumber );
1517
                        $( "#holds_patronsearch" ).submit();
1518
                        return false;
1519
                    }
1520
                })
1521
                .data( "ui-autocomplete" )._renderItem = function( ul, item ) {
1522
                    return $( "<li></li>" )
1523
                    .data( "ui-autocomplete-item", item )
1524
                    .append(
1525
                        "<a>"
1526
                            + ( item.surname ? item.surname.escapeHtml() : "" )
1527
                            + ", "
1528
                            + ( item.firstname ? item.firstname.escapeHtml() : "" )
1529
                            + " (" + ( item.cardnumber ? item.cardnumber.escapeHtml() : "" ) + ")"
1530
                            + " "
1531
                            + "<small>"
1532
                                + ( item.address ? item.address.escapeHtml() : "" )
1533
                                + " "
1534
                                + ( item.city ? item.city.escapeHtml() : "" )
1535
                                + " "
1536
                                + ( item.zipcode ? item.zipcode.escapeHtml() : "" )
1537
                                + " "
1538
                                + ( item.country ? item.country.escapeHtml() : "" )
1539
                            + "</small>"
1540
                        + "</a>" )
1541
                    .appendTo( ul );
1542
                };
1543
                [% END %]
1544
            [% END %]
1545
            Sticky = $("#toolbar");
1522
            Sticky = $("#toolbar");
1546
            Sticky.hcSticky({
1523
            Sticky.hcSticky({
1547
                stickTo: "#existing_holds",
1524
                stickTo: "#existing_holds",
Lines 1593-1598 Link Here
1593
                return false;
1570
                return false;
1594
            });
1571
            });
1595
1572
1573
            [% FOREACH biblionumber IN biblionumbers %]
1574
                [% SET url_biblio_params = url_biblio_params _ "&amp;biblionumber=" _ biblionumber %]
1575
            [% END %]
1576
            [% IF multi_hold %]
1577
                [% SET url_biblio_params = url_biblio_params _ "&amp;multi_hold=1" %]
1578
            [% END %]
1579
            search = 0;
1580
            dtMemberResults = KohaTable("table_borrowers", {
1581
                'bServerSide': true,
1582
                'sAjaxSource': "/cgi-bin/koha/svc/members/search",
1583
                'fnServerData': function(sSource, aoData, fnCallback) {
1584
                    if ( ! search ) {
1585
                        return;
1586
                    }
1587
                    aoData.push({
1588
                        'name': 'searchmember',
1589
                        'value': $("#patron").val()
1590
                    },{
1591
                        'name': 'template_path',
1592
                        'value': 'reserve/tables/members_results.tt',
1593
                    });
1594
                    $.ajax({
1595
                        'dataType': 'json',
1596
                        'type': 'POST',
1597
                        'url': sSource,
1598
                        'data': aoData,
1599
                        'success': function(json){
1600
                            // redirect if there is only 1 result.
1601
                            if ( json.aaData.length == 1 ) {
1602
                                var borrowernumber = json.aaData[0].borrowernumber;
1603
                                document.location.href = '/cgi-bin/koha/reserve/request.pl?borrowernumber=' + borrowernumber + "[% url_biblio_params %]"
1604
                                return false;
1605
                            }
1606
                            fnCallback(json);
1607
                        }
1608
                    });
1609
                },
1610
                'fnDrawCallback': function (oSettings) {
1611
                    var data = this.fnGetData();
1612
                    $.each($(this).find("tbody tr"), function(index, tr) {
1613
                        let url = '/cgi-bin/koha/reserve/request.pl?borrowernumber=' + data[index].borrowernumber + "[% url_biblio_params %]"
1614
                        $(tr).off('click').on('click', function() {
1615
                            document.location.href = url;
1616
                        }).addClass('clickable');
1617
                        $(tr).find("a.patron_preview").attr('href', url);
1618
                    });
1619
                },
1620
                'aoColumns':[
1621
                    { 'mDataProp': 'dt_name' },
1622
                    { 'mDataProp': 'dt_address' },
1623
                    { 'mDataProp': 'dt_cardnumber' },
1624
                    { 'mDataProp': 'dt_dateofbirth' },
1625
                    { 'mDataProp': 'dt_category' },
1626
                    { 'mDataProp': 'dt_branch' },
1627
                    { 'mDataProp': 'dt_phone' },
1628
                ],
1629
                'bFilter': false,
1630
                'bAutoWidth': false,
1631
                'sPaginationType': 'full_numbers',
1632
                "bProcessing": true
1633
            }, columns_settings_borrowers_table );
1634
            $("#table_borrowers_wrapper").hide();
1635
1636
            function filter() {
1637
                search = 1;
1638
                $("#table_borrowers").show();
1639
                $("#table_borrowers_wrapper").show();
1640
                dtMemberResults.fnDraw();
1641
                return false;
1642
            }
1643
            $("#holds_patronsearch").on("submit", filter);
1644
1596
        });
1645
        });
1597
    </script>
1646
    </script>
1598
[% END %]
1647
[% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/tables/members_results.tt (+32 lines)
Line 0 Link Here
1
[% USE raw %]
2
[% USE I18N %]
3
[% USE To %]
4
[% USE Price %]
5
[% PROCESS 'member-display-address-style.inc' %]
6
{
7
    "sEcho": [% sEcho | html %],
8
    "iTotalRecords": [% iTotalRecords | html %],
9
    "iTotalDisplayRecords": [% iTotalDisplayRecords | html %],
10
    "aaData": [
11
        [% FOREACH data IN aaData %]
12
            {
13
                "dt_name":
14
                    "<a href=\"/cgi-bin/koha/members/moremember.pl?borrowernumber=[% data.borrowernumber | html %]\" class=\"patron_preview\" data-borrowernumber=\"[% data.borrowernumber | html %]\" style='white-space:nowrap' title=\"[% I18N.t("View") | html %]\">[% INCLUDE 'patron-title.inc' borrowernumber = data.borrowernumber category_type = data.category_type firstname = data.firstname surname = data.surname othernames = data.othernames invert_name = 1 | $To %]</a><br />",
15
                "dt_address":
16
                    "[%~ INCLUDE 'display-address-style' patron=data no_line_break=1 | $To ~%]",
17
                "dt_cardnumber":
18
                    "[% data.cardnumber | html | $To %]",
19
                "dt_dateofbirth":
20
                    "[% INCLUDE 'patron-age.inc' patron = data %]",
21
                "dt_category":
22
                    "[% data.category_description | html | $To %] <span class=\"patron_category_type\">([% data.category_type | html | $To %])</span>",
23
                "dt_branch":
24
                    "[% data.branchname | html | $To %]",
25
                "dt_phone":
26
                    "[% data.phone| html | $To %]",
27
                "borrowernumber":
28
                    "[% data.borrowernumber | html %]"
29
            }[% UNLESS loop.last %],[% END %]
30
        [% END %]
31
    ]
32
}
(-)a/koha-tmpl/intranet-tmpl/prog/js/circ-patron-search-results.js (-13 lines)
Lines 1-13 Link Here
1
/* global dataTablesDefaults */
2
$(document).ready(function() {
3
    $(".clickable").click(function() {
4
        window.document.location = $(this).data('url');
5
    });
6
    var table = KohaTable("table_borrowers",
7
        {
8
            "aaSorting": [ 0, "asc" ],
9
            "sDom": "t",
10
            "paging": false
11
        },
12
        columns_settings_borrowers_table, null);
13
});
(-)a/reserve/request.pl (-20 / +1 lines)
Lines 144-168 elsif ( $action eq 'cancelBulk' ) { Link Here
144
144
145
if ($findborrower) {
145
if ($findborrower) {
146
    my $patron = Koha::Patrons->find( { cardnumber => $findborrower } );
146
    my $patron = Koha::Patrons->find( { cardnumber => $findborrower } );
147
    if ( $patron ) {
147
    $borrowernumber_hold = $patron->borrowernumber if $patron;
148
        $borrowernumber_hold = $patron->borrowernumber;
149
    } else {
150
        my $dt_params = { iDisplayLength => -1 };
151
        my $results = C4::Utils::DataTables::Members::search(
152
            {
153
                searchmember => $findborrower,
154
                dt_params => $dt_params,
155
            }
156
        );
157
        my $borrowers = $results->{patrons};
158
        if ( scalar @$borrowers == 1 ) {
159
            $borrowernumber_hold = $borrowers->[0]->{borrowernumber};
160
        } elsif ( @$borrowers ) {
161
            $template->param( borrowers => $borrowers );
162
        } else {
163
            $messageborrower = "'$findborrower'";
164
        }
165
    }
166
}
148
}
167
149
168
if($findclub) {
150
if($findclub) {
169
- 

Return to bug 29136