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

(-)a/C4/Members.pm (+60 lines)
Lines 50-55 BEGIN { Link Here
50
      GetBorrowersToExpunge
50
      GetBorrowersToExpunge
51
51
52
      IssueSlip
52
      IssueSlip
53
      &FineSlip
53
54
54
      checkuserpassword
55
      checkuserpassword
55
      get_cardnumber_length
56
      get_cardnumber_length
Lines 674-679 WHERE borrowernumber = 0 AND DATEDIFF( NOW(), timestamp ) > ?|; Link Here
674
    return $cnt eq '0E0'? 0: $cnt;
675
    return $cnt eq '0E0'? 0: $cnt;
675
}
676
}
676
677
678
sub GetBorrowerFines {
679
    my ($borrowernumber) = @_;
680
    my $dbh       = C4::Context->dbh;
681
    my $query = qq{
682
        SELECT * FROM accountlines
683
        LEFT JOIN borrowers ON borrowers.borrowernumber = accountlines.borrowernumber
684
        LEFT JOIN items ON accountlines.itemnumber = items.itemnumber
685
        WHERE accountlines.borrowernumber = ?
686
        ORDER BY accountlines.timestamp
687
    };
688
    my $sth = $dbh->prepare( $query );
689
    $sth->execute( $borrowernumber );
690
    my $data = $sth->fetchall_arrayref({});
691
    return $data;
692
}
693
694
sub FineSlip {
695
    my ($borrowernumber, $branch) = @_;
696
697
    #my $now       = POSIX::strftime("%Y-%m-%d", localtime);
698
699
    my $issueslist = GetBorrowerFines($borrowernumber);
700
701
    my $total = 0.0;
702
703
    foreach my $it (@$issueslist){
704
        my $dt = dt_from_string( $it->{'date'} );
705
        $it->{'date_due'} = output_pref({ dt => $dt, dateonly => 1 });
706
        $it->{'amount'} = sprintf('%.2f', $it->{'amount'});
707
        $total = $total + $it->{'amount'};
708
        $it->{'barcode'} = '-' if (!defined($it->{'barcode'}));
709
    }
710
    my @issues = sort { $b->{'timestamp'} <=> $a->{'timestamp'} } @$issueslist;
711
712
    my %repeat = (
713
        'fines' => [ map {
714
            'fines' => $_,
715
            'borrowers' => $_,
716
            'items' => $_
717
                     }, @issues ],
718
        );
719
720
    return  C4::Letters::GetPreparedLetter (
721
        module => 'circulation',
722
        letter_code => 'FINESLIP',
723
        branchcode => $branch,
724
        tables => {
725
            'branches'    => $branch,
726
            'borrowers'   => $borrowernumber,
727
        },
728
        substitute => {
729
            'total.amount' => sprintf('%.2f', $total),
730
            'total.fines' => scalar(@issues)
731
        },
732
        repeat => \%repeat,
733
        message_transport_type => 'print',
734
    );
735
}
736
677
END { }    # module clean-up code here (global destructor)
737
END { }    # module clean-up code here (global destructor)
678
738
679
1;
739
1;
(-)a/installer/data/mysql/atomicupdate/bug_12285 (+10 lines)
Line 0 Link Here
1
$DBversion = 'XXX'; # will be replaced by the RM
2
if( CheckVersion( $DBversion ) ) {
3
    # you can use $dbh here like:
4
    # $dbh->do( "ALTER TABLE biblio ADD COLUMN badtaste int" );
5
6
    $dbh->do( qq| INSERT INTO letter (module, code, branchcode, name, is_html, title, content, message_transport_type) VALUES ( "circulation", "FINESLIP", "", "Patron fines -slip", "1", "Fines and fees slip", "<<borrowers.firstname>> <<borrowers.surname>><br><<borrowers.cardnumber>><br>Fines: <<total.fines>><ul><fines><li><<fines.date_due>>, <<fines.amount>><br>Barcode: <<items.barcode>><br><<fines.description>></li></fines></ul>Total: <<total.amount>>", "print")| );
7
8
    # Always end with this (adjust the bug info)
9
    NewVersion( $DBversion, 12285, "Allow easy printing of patron's fines");
10
}
(-)a/installer/data/mysql/en/mandatory/sample_notices.yml (+23 lines)
Lines 1545-1547 tables: Link Here
1545
            - "This item must be renewed at the library."
1545
            - "This item must be renewed at the library."
1546
            - "[% END %]"
1546
            - "[% END %]"
1547
            - "[% END %]"
1547
            - "[% END %]"
1548
1549
        - module:
1550
          code: FINESLIP
1551
          branchcode: ""
1552
          name: "Patron fines -slip"
1553
          is_html: 1
1554
          title: "Fines and fees slip"
1555
          message_transport_type: pront
1556
          lang: default
1557
          content:
1558
          - "<<borrowers.firstname>> <<borrowers.surname>><br>"
1559
          - "<<borrowers.cardnumber>><br>"
1560
          - "Fines: <<total.fines>>"
1561
          - "<ul>"
1562
          - "<fines>"
1563
          - "<li>""
1564
          - "<<fines.date_due>>, <<fines.amount>><br>"
1565
          - "Barcode: <<items.barcode>><br>"
1566
          - "<<fines.description>>"
1567
          - "</li>"
1568
          - "</fines>"
1569
          - "</ul>"
1570
          - "Total: <<total.amount>>"
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc (+1 lines)
Lines 24-29 Link Here
24
                <li><a id="printsummary" href="#">Print summary</a></li>
24
                <li><a id="printsummary" href="#">Print summary</a></li>
25
                <li><a id="printslip" href="#">Print slip</a></li>
25
                <li><a id="printslip" href="#">Print slip</a></li>
26
                <li><a id="printquickslip" href="#">Print quick slip</a></li>
26
                <li><a id="printquickslip" href="#">Print quick slip</a></li>
27
                <li><a id="printfineslip" href="#">Print fines</a></li>
27
                [% IF patron.has_overdues %]
28
                [% IF patron.has_overdues %]
28
                    <li><a id="print_overdues" href="#">Print overdues</a></li>
29
                    <li><a id="print_overdues" href="#">Print overdues</a></li>
29
                [% END %]
30
                [% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/js/members-menu.js (+5 lines)
Lines 78-83 $(document).ready(function(){ Link Here
78
        $(".btn-group").removeClass("open");
78
        $(".btn-group").removeClass("open");
79
        return false;
79
        return false;
80
    });
80
    });
81
    $("#printfineslip").click(function(){
82
        printx_window("fineslip");
83
        $(".btn-group").removeClass("open");
84
        return false;
85
    });
81
    $("#printclearscreen").click(function(){
86
    $("#printclearscreen").click(function(){
82
        printx_window("slip");
87
        printx_window("slip");
83
        window.location.replace("/cgi-bin/koha/circ/circulation.pl");
88
        window.location.replace("/cgi-bin/koha/circ/circulation.pl");
(-)a/members/printslip.pl (-1 / +4 lines)
Lines 94-99 if ( $print eq 'checkinslip' ) { Link Here
94
    $slip    = $letter->{content};
94
    $slip    = $letter->{content};
95
    $is_html = $letter->{is_html};
95
    $is_html = $letter->{is_html};
96
96
97
} elsif ($print eq 'fineslip') {
98
    my $letter = C4::Members::FineSlip($borrowernumber, $session->param('branch') || $branch);
99
    $slip = $letter->{content};
100
    $is_html = $letter->{is_html};
97
} elsif (my $letter = IssueSlip ($session->param('branch') || $branch, $borrowernumber, $print eq "qslip")) {
101
} elsif (my $letter = IssueSlip ($session->param('branch') || $branch, $borrowernumber, $print eq "qslip")) {
98
    $slip = $letter->{content};
102
    $slip = $letter->{content};
99
    $is_html = $letter->{is_html};
103
    $is_html = $letter->{is_html};
100
- 

Return to bug 12285