Bugzilla – Attachment 21660 Details for
Bug 8007
Discharge management
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 8007: Followup: fix read dir error
Bug-8007-Followup-fix-read-dir-error.patch (text/plain), 2.61 KB, created by
Jonathan Druart
on 2013-09-30 13:13:56 UTC
(
hide
)
Description:
Bug 8007: Followup: fix read dir error
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2013-09-30 13:13:56 UTC
Size:
2.61 KB
patch
obsolete
>From f08a1c9fe1db3220ef791411ca9513feb813e4a0 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@biblibre.com> >Date: Mon, 30 Sep 2013 15:10:25 +0200 >Subject: [PATCH] Bug 8007: Followup: fix read dir error > >This patch fixes: >- an error on reading the discharges directory >- the parameter sent to CancelReserves (API has been changed) >- the parameters sent to output_pref (API has been changed) >--- > C4/Discharges.pm | 22 ++++++++++++++-------- > members/discharge.pl | 6 +++--- > 2 files changed, 17 insertions(+), 11 deletions(-) > >diff --git a/C4/Discharges.pm b/C4/Discharges.pm >index 6774c79..aac0703 100644 >--- a/C4/Discharges.pm >+++ b/C4/Discharges.pm >@@ -62,16 +62,22 @@ sub GetDischarges { > > my $dischargePath = C4::Context->preference('dischargePath'); > my $dischargeWebPath = C4::Context->preference('dischargeWebPath'); >- my @return; >- >- my $pdf_path = qq{$dischargePath/$borrowernumber/*.pdf}; >- my @files = <$pdf_path>; >- foreach (@files) { >- my ($file, $dir, $ext) = fileparse("$_"); >- push @return, $file; >+ my @discharges; >+ >+ my $discharges_dir = qq{$dischargePath/$borrowernumber}; >+ opendir my $dh, $discharges_dir >+ or warn qq{Error: Can't open dir $discharges_dir} >+ and return (); >+ >+ for my $file ( readdir $dh ) { >+ next unless $file =~ /\.pdf$/; >+ my $filepath = qq{$discharges_dir/$file}; >+ my ($file, $dir, $ext) = fileparse( $filepath ); >+ push @discharges, $file; > } >+ closedir $dh; > >- return @return; >+ return @discharges; > } > > =head2 removeUnprocessedDischarges($borrowernumber) >diff --git a/members/discharge.pl b/members/discharge.pl >index cb232d4..d041a72 100755 >--- a/members/discharge.pl >+++ b/members/discharge.pl >@@ -71,8 +71,8 @@ if ( $input->param('borrowernumber') ) { > # Generating discharge if needed > if ($input->param('generatedischarge')) { > # If borrower has pending reserves, we cancel them >- foreach (@reserves) { >- CancelReserve($_->{'reservenumber'}); >+ for my $reserve (@reserves) { >+ CancelReserve({ reserve_id => $reserve->{reserve_id} }); > } > $hasreserves = 0; > >@@ -118,7 +118,7 @@ if ( $input->param('borrowernumber') ) { > > # Error handling: > # Check if we really got our discharge as a pdf file >- my $todayiso = output_pref(dt_from_string(), 'iso', 1); >+ my $todayiso = output_pref(dt_from_string(), 'iso', 0, 1); > # If we don't, then > unless (-e "$dischargePath/$borrowernumber/discharge-$todayiso.pdf") { > # Show an error message to the librarian >-- >1.7.10.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 8007
:
14490
|
16622
|
16935
|
17484
|
17485
|
21394
|
21395
|
21396
|
21660
|
21674
|
21675
|
21676
|
21677
|
21678
|
24023
|
24024
|
24025
|
24026
|
24027
|
30531
|
30532
|
30533
|
30534
|
30535
|
31007
|
34034
|
34035
|
34036
|
34037
|
34038
|
34039
|
34668
|
34669
|
34670
|
34671
|
34672
|
34673
|
34674
|
34675
|
36180
|
36181
|
36182
|
36183
|
36184
|
36185
|
36186
|
36187
|
36394
|
36395
|
36396
|
36397
|
36398
|
36399
|
36400
|
36401
|
37029
|
37030
|
37031
|
37032
|
37033
|
37034
|
37035
|
37036
|
37037
|
38596
|
38597