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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt (-3 / +6 lines)
Lines 371-388 Link Here
371
                </li>
371
                </li>
372
            [% END %]
372
            [% END %]
373
        <li><table>
373
        <li><table>
374
            <thead><tr><th>&nbsp;</th><th>Date</th><th>By</th></tr></thead>
374
            <thead><tr><th>&nbsp;</th><th>Date</th><th>By</th><th>Action</th></tr></thead>
375
            <tbody>
375
            <tbody>
376
            <tr>
376
            <tr>
377
                <th><label for="suggesteddate">[% tp('purchase suggestion created by', 'Created by:') | html %]</label> </th>
377
                <th><label for="suggesteddate">[% tp('purchase suggestion created by', 'Created by:') | html %]</label> </th>
378
                <td><input type="text" id="suggesteddate" name="suggesteddate" class="datepicker" size="10" maxlength="10" value="[% suggesteddate | $KohaDates %]"/>[% INCLUDE 'date-format.inc' %]</td>
378
                <td><input type="text" id="suggesteddate" name="suggesteddate" class="datepicker" size="10" maxlength="10" value="[% suggesteddate | $KohaDates %]"/>[% INCLUDE 'date-format.inc' %]</td>
379
                <td><input type="hidden" id="suggestedby" name="suggestedby" value="[% suggestedby | html %]"/>[% IF ( suggestedby_patron.borrowernumber ) %]<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% suggestedby_patron.borrowernumber | uri %]">[% suggestedby_patron.surname | html %], [% suggestedby_patron.firstname | html %] ([% suggestedby_patron.cardnumber | html %])</a>  [% Branches.GetName( suggestedby_patron.branchcode ) | html %] ([% suggestedby_patron.category.description | html %])[% END %]
379
                <td id="tdsuggestedby"><input type="hidden" id="suggestedby" name="suggestedby" value="[% suggestedby | html %]"/>[% IF ( suggestedby_patron.borrowernumber ) %]<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% suggestedby_patron.borrowernumber | uri %]">[% suggestedby_patron.surname | html %], [% suggestedby_patron.firstname | html %] ([% suggestedby_patron.cardnumber | html %])</a>  [% Branches.GetName( suggestedby_patron.branchcode ) | html %] ([% suggestedby_patron.category.description | html %])[% END %]
380
                </td>
380
                </td>
381
                <td><a href="#" id="suggestion_search" class="btn btn-default">Set to patron</a></td>
381
            </tr>
382
            </tr>
382
            <tr>
383
            <tr>
383
                <th><label for="accepteddate">Accepted on:</label> </th>
384
                <th><label for="accepteddate">Accepted on:</label> </th>
384
                <td><input type="text" id="accepteddate" name="accepteddate" class="datepicker" size="10" maxlength="10" value="[% accepteddate | $KohaDates %]" />[% INCLUDE 'date-format.inc' %]</td>
385
                <td><input type="text" id="accepteddate" name="accepteddate" class="datepicker" size="10" maxlength="10" value="[% accepteddate | $KohaDates %]" />[% INCLUDE 'date-format.inc' %]</td>
385
                <td><input type="hidden" id="acceptedby" name="acceptedby" value="[% acceptedby | html %]"/>[% IF ( acceptedby_patron.borrowernumber ) %]<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% acceptedby_patron.borrowernumber | uri %]">[% acceptedby_patron.surname | html %], [% acceptedby_patron.firstname | html %] ([% suggestedby_patron.cardnumber | html %])</a> [% Branches.GetName( acceptedby_patron.branchcode ) | html %] ([% acceptedby_patron.category.description | html %])[% END %]</td>
386
                <td><input type="hidden" id="acceptedby" name="acceptedby" value="[% acceptedby | html %]"/>[% IF ( acceptedby_patron.borrowernumber ) %]<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% acceptedby_patron.borrowernumber | uri %]">[% acceptedby_patron.surname | html %], [% acceptedby_patron.firstname | html %] ([% suggestedby_patron.cardnumber | html %])</a> [% Branches.GetName( acceptedby_patron.branchcode ) | html %] ([% acceptedby_patron.category.description | html %])[% END %]</td>
387
                <td></td>
386
            </tr>
388
            </tr>
387
            <tr>
389
            <tr>
388
                <th><label for="lastmodificationdate">Last modification on:</label> </th>
390
                <th><label for="lastmodificationdate">Last modification on:</label> </th>
Lines 392-397 Link Here
392
                        [% INCLUDE 'patron-title.inc' patron=lastmodificationby_patron hide_patron_infos_if_needed=1 %] [% Branches.GetName( lastmodificationby_patron.branchcode ) | html %] ([% lastmodificationby_patron.category.description | html %])
394
                        [% INCLUDE 'patron-title.inc' patron=lastmodificationby_patron hide_patron_infos_if_needed=1 %] [% Branches.GetName( lastmodificationby_patron.branchcode ) | html %] ([% lastmodificationby_patron.category.description | html %])
393
                    [% END %]
395
                    [% END %]
394
                </td>
396
                </td>
397
                <td></td>
395
            </tr>
398
            </tr>
396
            </tbody>
399
            </tbody>
397
        </table></li>
400
        </table></li>
Lines 1129-1134 Link Here
1129
    [% END %]
1132
    [% END %]
1130
    [% Asset.js("js/acq.js") | $raw %]
1133
    [% Asset.js("js/acq.js") | $raw %]
1131
    [% Asset.js("js/acquisitions-menu.js") | $raw %]
1134
    [% Asset.js("js/acquisitions-menu.js") | $raw %]
1135
    [% Asset.js("js/suggestions.js") | $raw %]
1132
[% END %]
1136
[% END %]
1133
1134
[% INCLUDE 'intranet-bottom.inc' %]
1137
[% INCLUDE 'intranet-bottom.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/tables/suggestion_search.tt (+36 lines)
Line 0 Link Here
1
[% USE raw %]
2
[% USE To %]
3
[% USE Branches %]
4
[% USE KohaDates %]
5
{
6
    "sEcho": [% sEcho | html %],
7
    "iTotalRecords": [% iTotalRecords | html %],
8
    "iTotalDisplayRecords": [% iTotalDisplayRecords | html %],
9
    "aaData": [
10
        [% FOREACH data IN aaData %]
11
            {
12
                "dt_cardnumber":
13
                    "[% data.cardnumber | html %]",
14
                "dt_name":
15
                    "[% INCLUDE 'patron-title.inc' borrowernumber = data.borrowernumber category_type = data.category_type firstname = data.firstname surname = data.surname othernames = data.othernames cardnumber = data.cardnumber invert_name = 1%]",
16
                "dt_dateofbirth":
17
                    "[% data.dateofbirth | $KohaDates %]",
18
                "dt_address":
19
                    "[% INCLUDE escape_address data=data %]",
20
                "dt_action":
21
                    "<a href=\"#\" class=\"btn btn-default btn-xs select_user\" data-borrowernumber=\"[% data.borrowernumber | html %]\">Select</a><input type=\"hidden\" id=\"borrower_data[% data.borrowernumber | html %]\" name=\"borrower_data[% data.borrowernumber | html %]\" value=\"[% To.json(data) | html %]\" />"
22
            }[% UNLESS loop.last %],[% END %]
23
        [% END %]
24
    ]
25
}
26
[% BLOCK escape_address %]
27
[%~ SET address = data.streetnumber _ ' ' %]
28
[%~ IF data.address %][% SET address = address _ data.address _ ' ' %][% END %]
29
[%~ IF data.address2 %][% SET address = address _ data.address2 _ ' ' %][% END %]
30
[%~ IF data.city %][% SET address = address _ data.city _ ' ' %][% END %]
31
[%~ IF data.state %][% SET address = address _ data.state _ ' ' %][% END %]
32
[%~ IF data.zipcode %][% SET address = address _ data.zipcode _ ' ' %][% END %]
33
[%~ IF data.country %][% SET address = address _ data.country _ ' ' %][% END %]
34
[%~ SET address = address _ Branches.GetName( data.branchcode ) %]
35
[%~ To.json( address ) | $raw ~%]
36
[% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/js/suggestions.js (+17 lines)
Line 0 Link Here
1
function select_user(borrowernumber, borrower) {
2
    var suggested = '<input type="hidden" id="suggestedby" name="suggestedby" value="' + borrowernumber + '" />';
3
    suggested += '<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=' + borrowernumber + '">';
4
    suggested += borrower.surname + ', ' + borrower.firstname + ' (' + borrower.cardnumber + ')';
5
    suggested += '</a> ';
6
    suggested += borrower.branchname + ' (' + borrower.category_description + ')';
7
    $("#tdsuggestedby").html(suggested);
8
    return 0;
9
}
10
11
$(document).ready(function(){
12
    $('body').on('click', '#suggestion_search', function(e) {
13
        e.preventDefault();
14
        var newin = window.open('suggestion_search.pl','popup','width=600,height=400,resizable=no,toolbar=false,scrollbars=yes,top');
15
    });
16
17
});
(-)a/suggestion/suggestion_search.pl (-1 / +57 lines)
Line 0 Link Here
0
- 
1
#!/usr/bin/perl
2
3
# This file is part of Koha.
4
#
5
# Copyright 2020 BibLibre
6
#
7
# Koha is free software; you can redistribute it and/or modify it
8
# under the terms of the GNU General Public License as published by
9
# the Free Software Foundation; either version 3 of the License, or
10
# (at your option) any later version.
11
#
12
# Koha is distributed in the hope that it will be useful, but
13
# WITHOUT ANY WARRANTY; without even the implied warranty of
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
# GNU General Public License for more details.
16
#
17
# You should have received a copy of the GNU General Public License
18
# along with Koha; if not, see <http://www.gnu.org/licenses>.
19
20
use Modern::Perl;
21
22
use CGI qw ( -utf8 );
23
use C4::Auth;
24
use C4::Output;
25
use C4::Members;
26
27
use Koha::Patron::Categories;
28
29
my $input = new CGI;
30
31
my $dbh = C4::Context->dbh;
32
33
my ( $template, $loggedinuser, $cookie, $staff_flags ) = get_template_and_user(
34
    {   template_name   => "common/patron_search.tt",
35
        query           => $input,
36
        type            => "intranet",
37
        authnotrequired => 0,
38
        flagsrequired   => { suggestions => 'suggestions_manage' },
39
    }
40
);
41
42
my $q = $input->param('q') || '';
43
my $op = $input->param('op') || '';
44
45
my $referer = $input->referer();
46
47
my $patron_categories = Koha::Patron::Categories->search_limited;
48
$template->param(
49
    view => ( $input->request_method() eq "GET" ) ? "show_form" : "show_results",
50
    columns => ['cardnumber', 'name', 'dateofbirth', 'address', 'action' ],
51
    json_template => 'suggestion/tables/suggestion_search.tt',
52
    selection_type => 'select',
53
    alphabet        => ( C4::Context->preference('alphabet') || join ' ', 'A' .. 'Z' ),
54
    categories      => $patron_categories,
55
    aaSorting       => 1,
56
);
57
output_html_with_http_headers( $input, $cookie, $template->output );

Return to bug 24819