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

(-)a/C4/Members.pm (+66 lines)
Lines 101-106 BEGIN { Link Here
101
        &GetMessagesCount
101
        &GetMessagesCount
102
102
103
        &IssueSlip
103
        &IssueSlip
104
        &CheckInSlip
104
        GetBorrowersWithEmail
105
        GetBorrowersWithEmail
105
106
106
        HasOverdues
107
        HasOverdues
Lines 2405-2410 sub IssueSlip { Link Here
2405
    );
2406
    );
2406
}
2407
}
2407
2408
2409
=head2 GetTodaysReturnsForBorrower
2410
2411
    $returns = GetTodaysReturnsForBorrower($borrowernumber, $branch);
2412
2413
Return a list of items borrower has checked-in today in branch.
2414
2415
=cut
2416
2417
sub GetTodaysReturnsForBorrower {
2418
    my ($borrowernumber, $branch) = @_;
2419
    my $dbh  = C4::Context->dbh;
2420
    my $date = POSIX::strftime("%Y-%m-%d",localtime());
2421
2422
    my $query = "
2423
       SELECT itemnumber
2424
       FROM old_issues
2425
       WHERE DATE(returndate) = ?
2426
         AND borrowernumber = ?
2427
         AND branchcode = ?
2428
    ";
2429
2430
    my $sth = $dbh->prepare($query);
2431
    $sth->execute($date, $borrowernumber, $branch);
2432
    my @results;
2433
2434
    while ( my $data = $sth->fetchrow_hashref ) {
2435
        my $bibdata = GetBiblioFromItemNumber($data->{itemnumber});
2436
        push @results, $bibdata;
2437
    }
2438
    return \@results;
2439
}
2440
2441
=head2 CheckInSlip
2442
2443
    $letter = CheckInSlip($borrowernumber, $branch [, $message_transport_type ] );
2444
2445
Returns the prepared letter data for items patron checked-in today in branch.
2446
message_transport_type defaults to 'print'.
2447
2448
=cut
2449
2450
sub CheckInSlip {
2451
    my ($borrowernumber, $branch, $mtt) = @_;
2452
    my $issues = GetTodaysReturnsForBorrower($borrowernumber, $branch);
2453
    my %repeat = (
2454
            'checkedin' => [ map {
2455
                'biblio' => $_,
2456
                'items'  => $_,
2457
                'issues' => $_,
2458
            }, @$issues ],
2459
        );
2460
2461
    return  C4::Letters::GetPreparedLetter (
2462
        module => 'circulation',
2463
        letter_code => 'CHECKINSLIP',
2464
        branchcode => $branch,
2465
        tables => {
2466
            'branches'    => $branch,
2467
            'borrowers'   => $borrowernumber,
2468
        },
2469
        repeat => \%repeat,
2470
        message_transport_type => $mtt || 'print',
2471
    );
2472
}
2473
2408
=head2 GetBorrowersWithEmail
2474
=head2 GetBorrowersWithEmail
2409
2475
2410
    ([$borrnum,$userid], ...) = GetBorrowersWithEmail('me@example.com');
2476
    ([$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 8570-8575 if ( CheckVersion($DBversion) ) { Link Here
8570
    SetVersion($DBversion);
8570
    SetVersion($DBversion);
8571
}
8571
}
8572
8572
8573
$DBversion = "3.15.00.XXX";
8574
if ( CheckVersion($DBversion) ) {
8575
    $dbh->do("
8576
INSERT INTO  letter (module, code, branchcode, name, is_html, title, content, message_transport_type)
8577
VALUES ( 'circulation', 'CHECKINSLIP', '', 'Printed check-in slip', '1', 'Items returned today', '<<borrowers.firstname>> <<borrowers.surname>><br>
8578
<<branches.branchname>>, <<today>><br>
8579
You returned these items today:
8580
<ul>
8581
<checkedin>
8582
<li><<biblio.author>>: <<biblio.title>><br>
8583
Barcode: <<items.barcode>><br>
8584
</checkedin>
8585
</ul>', 'print'
8586
);");
8587
    print "Upgrade to $DBversion done (Bug 12224 - Easy printing of patron check-in slip)\n";
8588
    SetVersion($DBversion);
8589
}
8590
8591
8573
=head1 FUNCTIONS
8592
=head1 FUNCTIONS
8574
8593
8575
=head2 TableExists($table)
8594
=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