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

(-)a/C4/Discharges.pm (-8 / +14 lines)
Lines 62-77 sub GetDischarges { Link Here
62
62
63
    my $dischargePath    = C4::Context->preference('dischargePath');
63
    my $dischargePath    = C4::Context->preference('dischargePath');
64
    my $dischargeWebPath = C4::Context->preference('dischargeWebPath');
64
    my $dischargeWebPath = C4::Context->preference('dischargeWebPath');
65
    my @return;
65
    my @discharges;
66
66
67
    my $pdf_path = qq{$dischargePath/$borrowernumber/*.pdf};
67
    my $discharges_dir = qq{$dischargePath/$borrowernumber};
68
    my @files = <$pdf_path>;
68
    opendir my $dh, $discharges_dir
69
    foreach (@files) {
69
        or warn qq{Error: Can't open dir $discharges_dir}
70
        my ($file, $dir, $ext) = fileparse("$_");
70
        and return ();
71
        push @return, $file;
71
72
    for my $file ( readdir $dh ) {
73
        next unless $file =~ /\.pdf$/;
74
        my $filepath = qq{$discharges_dir/$file};
75
        my ($file, $dir, $ext) = fileparse( $filepath );
76
        push @discharges, $file;
72
    }
77
    }
78
    closedir $dh;
73
79
74
    return @return;
80
    return @discharges;
75
}
81
}
76
82
77
=head2 removeUnprocessedDischarges($borrowernumber)
83
=head2 removeUnprocessedDischarges($borrowernumber)
(-)a/members/discharge.pl (-4 / +3 lines)
Lines 71-78 if ( $input->param('borrowernumber') ) { Link Here
71
    # Generating discharge if needed
71
    # Generating discharge if needed
72
    if ($input->param('generatedischarge')) {
72
    if ($input->param('generatedischarge')) {
73
        # If borrower has pending reserves, we cancel them
73
        # If borrower has pending reserves, we cancel them
74
        foreach (@reserves) {
74
        for my $reserve (@reserves) {
75
            CancelReserve($_->{'reservenumber'});
75
            CancelReserve({ reserve_id => $reserve->{reserve_id} });
76
        }
76
        }
77
        $hasreserves = 0;
77
        $hasreserves = 0;
78
78
Lines 118-124 if ( $input->param('borrowernumber') ) { Link Here
118
118
119
        # Error handling:
119
        # Error handling:
120
        # Check if we really got our discharge as a pdf file
120
        # Check if we really got our discharge as a pdf file
121
        my $todayiso = output_pref(dt_from_string(), 'iso', 1);
121
        my $todayiso = output_pref(dt_from_string(), 'iso', 0, 1);
122
        # If we don't, then
122
        # If we don't, then
123
        unless (-e "$dischargePath/$borrowernumber/discharge-$todayiso.pdf") {
123
        unless (-e "$dischargePath/$borrowernumber/discharge-$todayiso.pdf") {
124
            # Show an error message to the librarian
124
            # Show an error message to the librarian
125
- 

Return to bug 8007