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

(-)a/members/summary-print.pl (-17 / +15 lines)
Lines 82-117 output_html_with_http_headers $input, $cookie, $template->output; Link Here
82
82
83
sub build_issue_data {
83
sub build_issue_data {
84
    my ( $borrowernumber ) = @_;
84
    my ( $borrowernumber ) = @_;
85
    my $issues = GetPendingIssues( $borrowernumber );
85
    my $patron = Koha::Patrons->find( $borrowernumber );
86
    return unless $patron;
86
87
87
    my $return = [];
88
    my $pending_checkouts = $patron->pending_checkouts->search( {},
89
        { order_by => [ { -desc => 'date_due' }, { -asc => 'issue_id' } ] } );
88
90
89
    my $today = DateTime->now( time_zone => C4::Context->tz );
91
    my @checkouts;
90
    $today->truncate( to => 'day' );
91
92
92
    foreach my $issue ( @{$issues} ) {
93
    while ( my $c = $pending_checkouts->next ) {
94
        my $checkout = $c->unblessed_all_relateds;
93
95
94
        my %row = %{$issue};
96
        $totalprice += $checkout->{replacementprice}
95
        $totalprice += $issue->{replacementprice}
97
            if $checkout->{replacementprice};
96
            if ( $issue->{replacementprice} );
97
98
98
        #find the charge for an item
99
        #find the charge for an item
99
        my ( $charge, $itemtype ) =
100
        my ( $charge, $itemtype ) =
100
          GetIssuingCharges( $issue->{itemnumber}, $borrowernumber );
101
          GetIssuingCharges( $checkout->{itemnumber}, $borrowernumber );
101
102
102
        $itemtype = Koha::ItemTypes->find( $itemtype );
103
        $itemtype = Koha::ItemTypes->find( $itemtype );
103
        $row{'itemtype_description'} = $itemtype->description; #FIXME Should not it be translated_description
104
        $checkout->{itemtype_description} = $itemtype->description; #FIXME Should not it be translated_description
104
105
105
        $row{'charge'} = sprintf( "%.2f", $charge );
106
        $checkout->{charge} = sprintf( "%.2f", $charge ); # TODO Should be done in the template using Price
106
107
107
        $row{date_due} = $row{date_due_sql};
108
        $checkout->{overdue} = $c->is_overdue;
108
109
109
        push( @{$return}, \%row );
110
        push @checkouts, $checkout;
110
    }
111
    }
111
112
112
    @{$return} = sort { $a->{date_due} eq $b->{date_due} } @{$return};
113
    return \@checkouts;
113
114
    return $return;
115
114
116
}
115
}
117
116
118
- 

Return to bug 19935