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 684-689 WHERE borrowernumber = 0 AND DATEDIFF( NOW(), timestamp ) > ?|; Link Here
684
    return $cnt eq '0E0'? 0: $cnt;
685
    return $cnt eq '0E0'? 0: $cnt;
685
}
686
}
686
687
688
sub GetBorrowerFines {
689
    my ($borrowernumber) = @_;
690
    my $dbh       = C4::Context->dbh;
691
    my $query = qq{
692
        SELECT * FROM accountlines
693
        LEFT JOIN borrowers ON borrowers.borrowernumber = accountlines.borrowernumber
694
        LEFT JOIN items ON accountlines.itemnumber = items.itemnumber
695
        WHERE accountlines.borrowernumber = ?
696
        ORDER BY accountlines.timestamp
697
    };
698
    my $sth = $dbh->prepare( $query );
699
    $sth->execute( $borrowernumber );
700
    my $data = $sth->fetchall_arrayref({});
701
    return $data;
702
}
703
704
sub FineSlip {
705
    my ($borrowernumber, $branch) = @_;
706
707
    #my $now       = POSIX::strftime("%Y-%m-%d", localtime);
708
709
    my $issueslist = GetBorrowerFines($borrowernumber);
710
711
    my $total = 0.0;
712
713
    foreach my $it (@$issueslist){
714
        my $dt = dt_from_string( $it->{'date'} );
715
        $it->{'date_due'} = output_pref({ dt => $dt, dateonly => 1 });
716
        $it->{'amount'} = sprintf('%.2f', $it->{'amount'});
717
        $total = $total + $it->{'amount'};
718
        $it->{'barcode'} = '-' if (!defined($it->{'barcode'}));
719
    }
720
    my @issues = sort { $b->{'timestamp'} <=> $a->{'timestamp'} } @$issueslist;
721
722
    my %repeat = (
723
        'fines' => [ map {
724
            'fines' => $_,
725
            'borrowers' => $_,
726
            'items' => $_
727
                     }, @issues ],
728
        );
729
730
    return  C4::Letters::GetPreparedLetter (
731
        module => 'circulation',
732
        letter_code => 'FINESLIP',
733
        branchcode => $branch,
734
        tables => {
735
            'branches'    => $branch,
736
            'borrowers'   => $borrowernumber,
737
        },
738
        substitute => {
739
            'total.amount' => sprintf('%.2f', $total),
740
            'total.fines' => scalar(@issues)
741
        },
742
        repeat => \%repeat,
743
        message_transport_type => 'print',
744
    );
745
}
746
687
END { }    # module clean-up code here (global destructor)
747
END { }    # module clean-up code here (global destructor)
688
748
689
1;
749
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 1822-1824 tables: Link Here
1822
            - "<p>This is to confirm that someone enabled two factor authentication on your account.</p>"
1822
            - "<p>This is to confirm that someone enabled two factor authentication on your account.</p>"
1823
            - "<p>If you did not do this, someone else may be using your account. Please contact technical support.</p>"
1823
            - "<p>If you did not do this, someone else may be using your account. Please contact technical support.</p>"
1824
            - "<p>Your library</p>"
1824
            - "<p>Your library</p>"
1825
1826
        - module: circulation
1827
          code: FINESLIP
1828
          branchcode: ""
1829
          name: "Patron fines -slip"
1830
          is_html: 1
1831
          title: "Fines and fees slip"
1832
          message_transport_type: pront
1833
          lang: default
1834
          content:
1835
            - "<<borrowers.firstname>> <<borrowers.surname>><br>"
1836
            - "<<borrowers.cardnumber>><br>"
1837
            - "Fines: <<total.fines>>"
1838
            - "<ul>"
1839
            - "<fines>"
1840
            - "<li>""
1841
            - "<<fines.date_due>>, <<fines.amount>><br>"
1842
            - "Barcode: <<items.barcode>><br>"
1843
            - "<<fines.description>>"
1844
            - "</li>"
1845
            - "</fines>"
1846
            - "</ul>"
1847
            - "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