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 683-688 WHERE borrowernumber = 0 AND DATEDIFF( NOW(), timestamp ) > ?|; Link Here
683
    return $cnt eq '0E0'? 0: $cnt;
684
    return $cnt eq '0E0'? 0: $cnt;
684
}
685
}
685
686
687
sub GetBorrowerFines {
688
    my ($borrowernumber) = @_;
689
    my $dbh       = C4::Context->dbh;
690
    my $query = qq{
691
        SELECT * FROM accountlines
692
        LEFT JOIN borrowers ON borrowers.borrowernumber = accountlines.borrowernumber
693
        LEFT JOIN items ON accountlines.itemnumber = items.itemnumber
694
        WHERE accountlines.borrowernumber = ?
695
        ORDER BY accountlines.timestamp
696
    };
697
    my $sth = $dbh->prepare( $query );
698
    $sth->execute( $borrowernumber );
699
    my $data = $sth->fetchall_arrayref({});
700
    return $data;
701
}
702
703
sub FineSlip {
704
    my ($borrowernumber, $branch) = @_;
705
706
    #my $now       = POSIX::strftime("%Y-%m-%d", localtime);
707
708
    my $issueslist = GetBorrowerFines($borrowernumber);
709
710
    my $total = 0.0;
711
712
    foreach my $it (@$issueslist){
713
        my $dt = dt_from_string( $it->{'date'} );
714
        $it->{'date_due'} = output_pref({ dt => $dt, dateonly => 1 });
715
        $it->{'amount'} = sprintf('%.2f', $it->{'amount'});
716
        $total = $total + $it->{'amount'};
717
        $it->{'barcode'} = '-' if (!defined($it->{'barcode'}));
718
    }
719
    my @issues = sort { $b->{'timestamp'} <=> $a->{'timestamp'} } @$issueslist;
720
721
    my %repeat = (
722
        'fines' => [ map {
723
            'fines' => $_,
724
            'borrowers' => $_,
725
            'items' => $_
726
                     }, @issues ],
727
        );
728
729
    return  C4::Letters::GetPreparedLetter (
730
        module => 'circulation',
731
        letter_code => 'FINESLIP',
732
        branchcode => $branch,
733
        tables => {
734
            'branches'    => $branch,
735
            'borrowers'   => $borrowernumber,
736
        },
737
        substitute => {
738
            'total.amount' => sprintf('%.2f', $total),
739
            'total.fines' => scalar(@issues)
740
        },
741
        repeat => \%repeat,
742
        message_transport_type => 'print',
743
    );
744
}
745
686
END { }    # module clean-up code here (global destructor)
746
END { }    # module clean-up code here (global destructor)
687
747
688
1;
748
1;
(-)a/installer/data/mysql/atomicupdate/bug_12285-allow_easy_printing_of_patrons_fines.perl (+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 IGNORE 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 1745-1747 tables: Link Here
1745
            - "<p>This is to confirm that someone enabled two factor authentication on your account.</p>"
1745
            - "<p>This is to confirm that someone enabled two factor authentication on your account.</p>"
1746
            - "<p>If you did not do this, someone else may be using your account. Please contact technical support.</p>"
1746
            - "<p>If you did not do this, someone else may be using your account. Please contact technical support.</p>"
1747
            - "<p>Your library</p>"
1747
            - "<p>Your library</p>"
1748
1749
        - module: circulation
1750
          code: FINESLIP
1751
          branchcode: ""
1752
          name: "Patron fines -slip"
1753
          is_html: 1
1754
          title: "Fines and fees slip"
1755
          message_transport_type: pront
1756
          lang: default
1757
          content:
1758
            - "<<borrowers.firstname>> <<borrowers.surname>><br>"
1759
            - "<<borrowers.cardnumber>><br>"
1760
            - "Fines: <<total.fines>>"
1761
            - "<ul>"
1762
            - "<fines>"
1763
            - "<li>""
1764
            - "<<fines.date_due>>, <<fines.amount>><br>"
1765
            - "Barcode: <<items.barcode>><br>"
1766
            - "<<fines.description>>"
1767
            - "</li>"
1768
            - "</fines>"
1769
            - "</ul>"
1770
            - "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 82-87 $(document).ready(function(){ Link Here
82
        $(".btn-group").removeClass("open");
82
        $(".btn-group").removeClass("open");
83
        return false;
83
        return false;
84
    });
84
    });
85
    $("#printfineslip").click(function(){
86
        printx_window("fineslip");
87
        $(".btn-group").removeClass("open");
88
        return false;
89
    });
85
    $("#printclearscreen").click(function(){
90
    $("#printclearscreen").click(function(){
86
        printx_window("slip");
91
        printx_window("slip");
87
        window.location.replace("/cgi-bin/koha/circ/circulation.pl");
92
        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