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

(-)a/C4/Members.pm (+66 lines)
Lines 100-105 BEGIN { Link Here
100
        &GetMessagesCount
100
        &GetMessagesCount
101
101
102
        &IssueSlip
102
        &IssueSlip
103
        &CheckInSlip
103
        GetBorrowersWithEmail
104
        GetBorrowersWithEmail
104
105
105
        HasOverdues
106
        HasOverdues
Lines 2394-2399 sub IssueSlip { Link Here
2394
    );
2395
    );
2395
}
2396
}
2396
2397
2398
=head2 GetTodaysReturnsForBorrower
2399
2400
    $returns = GetTodaysReturnsForBorrower($borrowernumber, $branch);
2401
2402
Return a list of items borrower has checked-in today in branch.
2403
2404
=cut
2405
2406
sub GetTodaysReturnsForBorrower {
2407
    my ($borrowernumber, $branch) = @_;
2408
    my $dbh  = C4::Context->dbh;
2409
    my $date = POSIX::strftime("%Y-%m-%d",localtime());
2410
2411
    my $query = "
2412
       SELECT itemnumber
2413
       FROM old_issues
2414
       WHERE DATE(returndate) = ?
2415
         AND borrowernumber = ?
2416
         AND branchcode = ?
2417
    ";
2418
2419
    my $sth = $dbh->prepare($query);
2420
    $sth->execute($date, $borrowernumber, $branch);
2421
    my @results;
2422
2423
    while ( my $data = $sth->fetchrow_hashref ) {
2424
        my $bibdata = GetBiblioFromItemNumber($data->{itemnumber});
2425
        push @results, $bibdata;
2426
    }
2427
    return \@results;
2428
}
2429
2430
=head2 CheckInSlip
2431
2432
    $letter = CheckInSlip($borrowernumber, $branch [, $message_transport_type ] );
2433
2434
Returns the prepared letter data for items patron checked-in today in branch.
2435
message_transport_type defaults to 'print'.
2436
2437
=cut
2438
2439
sub CheckInSlip {
2440
    my ($borrowernumber, $branch, $mtt) = @_;
2441
    my $issues = GetTodaysReturnsForBorrower($borrowernumber, $branch);
2442
    my %repeat = (
2443
            'checkedin' => [ map {
2444
                'biblio' => $_,
2445
                'items'  => $_,
2446
                'issues' => $_,
2447
            }, @$issues ],
2448
        );
2449
2450
    return  C4::Letters::GetPreparedLetter (
2451
        module => 'circulation',
2452
        letter_code => 'CHECKINSLIP',
2453
        branchcode => $branch,
2454
        tables => {
2455
            'branches'    => $branch,
2456
            'borrowers'   => $borrowernumber,
2457
        },
2458
        repeat => \%repeat,
2459
        message_transport_type => $mtt || 'print',
2460
    );
2461
}
2462
2397
=head2 GetBorrowersWithEmail
2463
=head2 GetBorrowersWithEmail
2398
2464
2399
    ([$borrnum,$userid], ...) = GetBorrowersWithEmail('me@example.com');
2465
    ([$borrnum,$userid], ...) = GetBorrowersWithEmail('me@example.com');
(-)a/installer/data/mysql/en/mandatory/sample_notices.sql (+11 lines)
Lines 142-144 Thank you. Link Here
142
142
143
Your library.'
143
Your library.'
144
);
144
);
145
INSERT INTO  letter (module, code, branchcode, name, is_html, title, content, message_transport_type)
146
VALUES ( 'circulation', 'CHECKINSLIP', '', 'Printed check-in slip', '1', 'Items returned today', '<<borrowers.firstname>> <<borrowers.surname>><br>
147
<<branches.branchname>>, <<today>><br>
148
You returned these items today:
149
<ul>
150
<checkedin>
151
<li><<biblio.author>>: <<biblio.title>><br>
152
Barcode: <<items.barcode>><br>
153
</checkedin>
154
</ul>', 'print'
155
);
(-)a/installer/data/mysql/updatedatabase.pl (+19 lines)
Lines 8465-8470 if ( CheckVersion($DBversion) ) { Link Here
8465
    SetVersion($DBversion);
8465
    SetVersion($DBversion);
8466
}
8466
}
8467
8467
8468
$DBversion = "3.15.00.XXX";
8469
if ( CheckVersion($DBversion) ) {
8470
    $dbh->do("
8471
INSERT INTO  letter (module, code, branchcode, name, is_html, title, content, message_transport_type)
8472
VALUES ( 'circulation', 'CHECKINSLIP', '', 'Printed check-in slip', '1', 'Items returned today', '<<borrowers.firstname>> <<borrowers.surname>><br>
8473
<<branches.branchname>>, <<today>><br>
8474
You returned these items today:
8475
<ul>
8476
<checkedin>
8477
<li><<biblio.author>>: <<biblio.title>><br>
8478
Barcode: <<items.barcode>><br>
8479
</checkedin>
8480
</ul>', 'print'
8481
);");
8482
    print "Upgrade to $DBversion done (Bug 12224 - Easy printing of patron check-in slip)\n";
8483
    SetVersion($DBversion);
8484
}
8485
8486
8468
=head1 FUNCTIONS
8487
=head1 FUNCTIONS
8469
8488
8470
=head2 TableExists($table)
8489
=head2 TableExists($table)
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc (+6 lines)
Lines 38-43 $(document).ready(function(){ Link Here
38
        $(".btn-group").removeClass("open");
38
        $(".btn-group").removeClass("open");
39
        return false;
39
        return false;
40
    });
40
    });
41
    $("#printcheckinslip").click(function(){
42
        printx_window("checkinslip");
43
        $(".btn-group").removeClass("open");
44
        return false;
45
    });
41
    $("#searchtohold").click(function(){
46
    $("#searchtohold").click(function(){
42
        searchToHold();
47
        searchToHold();
43
        return false;
48
        return false;
Lines 124-129 function searchToHold(){ Link Here
124
                [% IF ( CAN_user_borrowers ) %]<li><a id="printsummary" href="#">Print summary</a></li>[% END %]
129
                [% IF ( CAN_user_borrowers ) %]<li><a id="printsummary" href="#">Print summary</a></li>[% END %]
125
                <li><a id="printslip" href="#">Print slip</a></li>
130
                <li><a id="printslip" href="#">Print slip</a></li>
126
                <li><a id="printquickslip" href="#">Print quick slip</a></li>
131
                <li><a id="printquickslip" href="#">Print quick slip</a></li>
132
                <li><a id="printcheckinslip" href="#">Print checked-in today -slip</a></li>
127
            </ul>
133
            </ul>
128
    </div>
134
    </div>
129
    <a id="searchtohold" class="btn btn-small" href="#"><i class="icon-search"></i> Search to hold</a>
135
    <a id="searchtohold" class="btn btn-small" href="#"><i class="icon-search"></i> Search to hold</a>
(-)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