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

(-)a/C4/Members.pm (-4 / +5 lines)
Lines 1129-1139 sub IssueSlip { Link Here
1129
        }
1129
        }
1130
    }
1130
    }
1131
1131
1132
    # Sort on timestamp then on issuedate (useful for tests and could be if modified in a batch
1132
    # Sort on timestamp then on issuedate then on issue_id
1133
    # useful for tests and could be if modified in a batch
1133
    @issues = sort {
1134
    @issues = sort {
1134
        my $s = $b->{timestamp} <=> $a->{timestamp};
1135
            $b->{timestamp} <=> $a->{timestamp}
1135
        $s == 0 ?
1136
         or $b->{issuedate} <=> $a->{issuedate}
1136
             $b->{issuedate} <=> $a->{issuedate} : $s;
1137
         or $b->{issue_id}  <=> $a->{issue_id}
1137
    } @issues;
1138
    } @issues;
1138
1139
1139
    my ($letter_code, %repeat, %loops);
1140
    my ($letter_code, %repeat, %loops);
(-)a/t/db_dependent/Letters/TemplateToolkit.t (-5 / +10 lines)
Lines 600-605 EOF Link Here
600
        plan tests => 2;
600
        plan tests => 2;
601
601
602
        my $code = 'ISSUESLIP';
602
        my $code = 'ISSUESLIP';
603
        my $now = dt_from_string;
604
        my $one_minute_ago = dt_from_string->subtract( minutes => 1 );
603
605
604
        my $branchcode = $library->{branchcode};
606
        my $branchcode = $library->{branchcode};
605
607
Lines 647-656 EOF Link Here
647
649
648
        reset_template( { template => $template, code => $code, module => 'circulation' } );
650
        reset_template( { template => $template, code => $code, module => 'circulation' } );
649
651
650
        C4::Circulation::AddIssue( $patron, $item1->{barcode} ); # Add a first checkout
652
        my $checkout = C4::Circulation::AddIssue( $patron, $item1->{barcode} ); # Add a first checkout
653
        $checkout->set_columns( { timestamp => $now, issuedate => $one_minute_ago } )->update; # FIXME $checkout is a Koha::Schema::Result::Issues, must be a Koha::Checkout
651
        my $first_slip = C4::Members::IssueSlip( $branchcode, $patron->{borrowernumber} );
654
        my $first_slip = C4::Members::IssueSlip( $branchcode, $patron->{borrowernumber} );
652
655
653
        C4::Circulation::AddIssue( $patron, $item2->{barcode} ); # Add a second checkout
656
        $checkout = C4::Circulation::AddIssue( $patron, $item2->{barcode} ); # Add a second checkout
657
        $checkout->set_columns( { timestamp => $now, issuedate => $now } )->update;
654
        my $yesterday = dt_from_string->subtract( days => 1 );
658
        my $yesterday = dt_from_string->subtract( days => 1 );
655
        C4::Circulation::AddIssue( $patron, $item3->{barcode}, $yesterday ); # Add an overdue
659
        C4::Circulation::AddIssue( $patron, $item3->{barcode}, $yesterday ); # Add an overdue
656
        my $second_slip = C4::Members::IssueSlip( $branchcode, $patron->{borrowernumber} );
660
        my $second_slip = C4::Members::IssueSlip( $branchcode, $patron->{borrowernumber} );
Lines 705-714 EOF Link Here
705
709
706
        reset_template( { template => $tt_template, code => $code, module => 'circulation' } );
710
        reset_template( { template => $tt_template, code => $code, module => 'circulation' } );
707
711
708
        C4::Circulation::AddIssue( $patron, $item1->{barcode} ); # Add a first checkout
712
        $checkout = C4::Circulation::AddIssue( $patron, $item1->{barcode} ); # Add a first checkout
713
        $checkout->set_columns( { timestamp => $now, issuedate => $one_minute_ago } )->update;
709
        my $first_tt_slip = C4::Members::IssueSlip( $branchcode, $patron->{borrowernumber} );
714
        my $first_tt_slip = C4::Members::IssueSlip( $branchcode, $patron->{borrowernumber} );
710
715
711
        C4::Circulation::AddIssue( $patron, $item2->{barcode} ); # Add a second checkout
716
        $checkout = C4::Circulation::AddIssue( $patron, $item2->{barcode} ); # Add a second checkout
717
        $checkout->set_columns( { timestamp => $now, issuedate => $now } )->update;
712
        C4::Circulation::AddIssue( $patron, $item3->{barcode}, $yesterday ); # Add an overdue
718
        C4::Circulation::AddIssue( $patron, $item3->{barcode}, $yesterday ); # Add an overdue
713
        my $second_tt_slip = C4::Members::IssueSlip( $branchcode, $patron->{borrowernumber} );
719
        my $second_tt_slip = C4::Members::IssueSlip( $branchcode, $patron->{borrowernumber} );
714
720
715
- 

Return to bug 19277