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

(-)a/C4/Members.pm (+66 lines)
Lines 105-110 BEGIN { Link Here
105
        &GetMessagesCount
105
        &GetMessagesCount
106
106
107
        &IssueSlip
107
        &IssueSlip
108
        &CheckInSlip
108
        GetBorrowersWithEmail
109
        GetBorrowersWithEmail
109
110
110
        HasOverdues
111
        HasOverdues
Lines 2448-2453 sub IssueSlip { Link Here
2448
    );
2449
    );
2449
}
2450
}
2450
2451
2452
=head2 GetTodaysReturnsForBorrower
2453
2454
    $returns = GetTodaysReturnsForBorrower($borrowernumber, $branch);
2455
2456
Return a list of items borrower has checked-in today in branch.
2457
2458
=cut
2459
2460
sub GetTodaysReturnsForBorrower {
2461
    my ($borrowernumber, $branch) = @_;
2462
    my $dbh  = C4::Context->dbh;
2463
    my $date = POSIX::strftime("%Y-%m-%d",localtime());
2464
2465
    my $query = "
2466
       SELECT itemnumber
2467
       FROM old_issues
2468
       WHERE DATE(returndate) = ?
2469
         AND borrowernumber = ?
2470
         AND branchcode = ?
2471
    ";
2472
2473
    my $sth = $dbh->prepare($query);
2474
    $sth->execute($date, $borrowernumber, $branch);
2475
    my @results;
2476
2477
    while ( my $data = $sth->fetchrow_hashref ) {
2478
        my $bibdata = GetBiblioFromItemNumber($data->{itemnumber});
2479
        push @results, $bibdata;
2480
    }
2481
    return \@results;
2482
}
2483
2484
=head2 CheckInSlip
2485
2486
    $letter = CheckInSlip($borrowernumber, $branch [, $message_transport_type ] );
2487
2488
Returns the prepared letter data for items patron checked-in today in branch.
2489
message_transport_type defaults to 'print'.
2490
2491
=cut
2492
2493
sub CheckInSlip {
2494
    my ($borrowernumber, $branch, $mtt) = @_;
2495
    my $issues = GetTodaysReturnsForBorrower($borrowernumber, $branch);
2496
    my %repeat = (
2497
            'checkedin' => [ map {
2498
                'biblio' => $_,
2499
                'items'  => $_,
2500
                'issues' => $_,
2501
            }, @$issues ],
2502
        );
2503
2504
    return  C4::Letters::GetPreparedLetter (
2505
        module => 'circulation',
2506
        letter_code => 'CHECKINSLIP',
2507
        branchcode => $branch,
2508
        tables => {
2509
            'branches'    => $branch,
2510
            'borrowers'   => $borrowernumber,
2511
        },
2512
        repeat => \%repeat,
2513
        message_transport_type => $mtt || 'print',
2514
    );
2515
}
2516
2451
=head2 GetBorrowersWithEmail
2517
=head2 GetBorrowersWithEmail
2452
2518
2453
    ([$borrnum,$userid], ...) = GetBorrowersWithEmail('me@example.com');
2519
    ([$borrnum,$userid], ...) = GetBorrowersWithEmail('me@example.com');
(-)a/installer/data/mysql/en/mandatory/sample_notices.sql (+12 lines)
Lines 162-164 VALUES ( 'circulation', 'OVERDUES_SLIP', '', 'Overdues Slip', '0', 'OVERDUES_SLI Link Here
162
162
163
<item>"<<biblio.title>>" by <<biblio.author>>, <<items.itemcallnumber>>, Barcode: <<items.barcode>> Fine: <<items.fine>></item>
163
<item>"<<biblio.title>>" by <<biblio.author>>, <<items.itemcallnumber>>, Barcode: <<items.barcode>> Fine: <<items.fine>></item>
164
', 'print' );
164
', 'print' );
165
166
INSERT INTO  letter (module, code, branchcode, name, is_html, title, content, message_transport_type)
167
VALUES ( 'circulation', 'CHECKINSLIP', '', 'Printed check-in slip', '1', 'Items returned today', '<<borrowers.firstname>> <<borrowers.surname>><br>
168
<<branches.branchname>>, <<today>><br>
169
You returned these items today:
170
<ul>
171
<checkedin>
172
<li><<biblio.author>>: <<biblio.title>><br>
173
Barcode: <<items.barcode>><br>
174
</checkedin>
175
</ul>', 'print'
176
);
(-)a/installer/data/mysql/updatedatabase.pl (+18 lines)
Lines 11341-11346 if ( CheckVersion($DBversion) ) { Link Here
11341
    SetVersion($DBversion);
11341
    SetVersion($DBversion);
11342
}
11342
}
11343
11343
11344
$DBversion = "3.21.00.054";
11345
if ( CheckVersion($DBversion) ) {
11346
    $dbh->do("
11347
INSERT INTO  letter (module, code, branchcode, name, is_html, title, content, message_transport_type)
11348
VALUES ( 'circulation', 'CHECKINSLIP', '', 'Printed check-in slip', '1', 'Items returned today', '<<borrowers.firstname>> <<borrowers.surname>><br>
11349
<<branches.branchname>>, <<today>><br>
11350
You returned these items today:
11351
<ul>
11352
<checkedin>
11353
<li><<biblio.author>>: <<biblio.title>><br>
11354
Barcode: <<items.barcode>><br>
11355
</checkedin>
11356
</ul>', 'print'
11357
);");
11358
    print "Upgrade to $DBversion done (Bug 12224 - Easy printing of patron check-in slip)\n";
11359
    SetVersion($DBversion);
11360
}
11361
11344
# DEVELOPER PROCESS, search for anything to execute in the db_update directory
11362
# DEVELOPER PROCESS, search for anything to execute in the db_update directory
11345
# SEE bug 13068
11363
# SEE bug 13068
11346
# if there is anything in the atomicupdate, read and execute it.
11364
# if there is anything in the atomicupdate, read and execute it.
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc (+6 lines)
Lines 64-69 $(document).ready(function(){ Link Here
64
        $(".btn-group").removeClass("open");
64
        $(".btn-group").removeClass("open");
65
        return false;
65
        return false;
66
    });
66
    });
67
    $("#printcheckinslip").click(function(){
68
        printx_window("checkinslip");
69
        $(".btn-group").removeClass("open");
70
        return false;
71
    });
67
    $("#searchtohold").click(function(){
72
    $("#searchtohold").click(function(){
68
        searchToHold();
73
        searchToHold();
69
        return false;
74
        return false;
Lines 160-165 function searchToHold(){ Link Here
160
                [% IF ( CAN_user_borrowers ) %]<li><a id="printsummary" href="#">Print summary</a></li>[% END %]
165
                [% IF ( CAN_user_borrowers ) %]<li><a id="printsummary" href="#">Print summary</a></li>[% END %]
161
                <li><a id="printslip" href="#">Print slip</a></li>
166
                <li><a id="printslip" href="#">Print slip</a></li>
162
                <li><a id="printquickslip" href="#">Print quick slip</a></li>
167
                <li><a id="printquickslip" href="#">Print quick slip</a></li>
168
                <li><a id="printcheckinslip" href="#">Print checked-in today -slip</a></li>
163
                [% IF Borrowers.HasOverdues( borrowernumber ) %]
169
                [% IF Borrowers.HasOverdues( borrowernumber ) %]
164
                    <li><a id="print_overdues" href="#">Print overdues</a></li>
170
                    <li><a id="print_overdues" href="#">Print overdues</a></li>
165
                [% END %]
171
                [% END %]
(-)a/members/printslip.pl (-2 / +6 lines)
Lines 76-82 my ( $template, $loggedinuser, $cookie ) = get_template_and_user( Link Here
76
my $borrowernumber = $input->param('borrowernumber');
76
my $borrowernumber = $input->param('borrowernumber');
77
my $branch=C4::Context->userenv->{'branch'};
77
my $branch=C4::Context->userenv->{'branch'};
78
my ($slip, $is_html);
78
my ($slip, $is_html);
79
if (my $letter = IssueSlip ($session->param('branch') || $branch, $borrowernumber, $print eq "qslip")) {
79
if ($print eq 'checkinslip') {
80
    if (my $letter = CheckInSlip($borrowernumber, $session->param('branch') || $branch)) {
81
        $slip = $letter->{content};
82
        $is_html = $letter->{is_html};
83
    }
84
} elsif (my $letter = IssueSlip ($session->param('branch') || $branch, $borrowernumber, $print eq "qslip")) {
80
    $slip = $letter->{content};
85
    $slip = $letter->{content};
81
    $is_html = $letter->{is_html};
86
    $is_html = $letter->{is_html};
82
}
87
}
83
- 

Return to bug 12224