Bugzilla – Attachment 27427 Details for
Bug 9180
Default rules are not always used for overdues
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 9180: Use selectcol instead of selectrow
Bug-9180-Use-selectcol-instead-of-selectrow.patch (text/plain), 2.38 KB, created by
Jonathan Druart
on 2014-04-22 16:26:07 UTC
(
hide
)
Description:
Bug 9180: Use selectcol instead of selectrow
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2014-04-22 16:26:07 UTC
Size:
2.38 KB
patch
obsolete
>From 3bbe70ea35748a1867d30511e4b85e8cf221abac Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@biblibre.com> >Date: Tue, 22 Apr 2014 18:23:58 +0200 >Subject: [PATCH] Bug 9180: Use selectcol instead of selectrow > >The selectrow_* method only returns the *first* row of data! >--- > C4/Overdues.pm | 6 +++--- > t/db_dependent/Overdues.pl | 14 +++++++++++++- > 2 files changed, 16 insertions(+), 4 deletions(-) > >diff --git a/C4/Overdues.pm b/C4/Overdues.pm >index 955a8cf..47fe49f 100644 >--- a/C4/Overdues.pm >+++ b/C4/Overdues.pm >@@ -749,18 +749,18 @@ returns a list of branch codes for branches with overdue rules defined. > > sub GetBranchcodesWithOverdueRules { > my $dbh = C4::Context->dbh; >- my @branchcodes = $dbh->selectrow_array(q| >+ my $branchcodes = $dbh->selectcol_arrayref(q| > SELECT DISTINCT(branchcode) > FROM overduerules > WHERE delay1 IS NOT NULL > ORDER BY branchcode > |); >- if ( $branchcodes[0] eq '' ) { >+ if ( $branchcodes->[0] eq '' ) { > # If a default rule exists, all branches should be returned > my $availbranches = C4::Branch::GetBranches(); > return keys %$availbranches; > } >- return @branchcodes; >+ return @$branchcodes; > } > > =head2 CheckItemNotify >diff --git a/t/db_dependent/Overdues.pl b/t/db_dependent/Overdues.pl >index 64c284a..01fb532 100644 >--- a/t/db_dependent/Overdues.pl >+++ b/t/db_dependent/Overdues.pl >@@ -1,7 +1,7 @@ > #!/usr/bin/perl > > use Modern::Perl; >-use Test::More tests => 3; >+use Test::More tests => 4; > > use C4::Branch; > use C4::Context; >@@ -45,3 +45,15 @@ $dbh->do(q| > > @overdue_branches = C4::Overdues::GetBranchcodesWithOverdueRules; > is_deeply( \@overdue_branches, ['CPL'] , 'If only a specific rule exist, only 1 branch should be returned' ); >+ >+$dbh->do(q|DELETE FROM overduerules|); >+$dbh->do(q| >+ INSERT INTO overduerules >+ ( branchcode,categorycode, delay1,letter1,debarred1, delay2,letter2,debarred2, delay3,letter3,debarred3 ) >+ VALUES >+ ( 'CPL', '', 1, 'LETTER_CODE1_CPL', 1, 5, 'LETTER_CODE2_CPL', 1, 10, 'LETTER_CODE3_CPL', 1 ), >+ ( 'MPL', '', 1, 'LETTER_CODE1_MPL', 1, 5, 'LETTER_CODE2_MPL', 1, 10, 'LETTER_CODE3_MPL', 1 ) >+|); >+ >+@overdue_branches = C4::Overdues::GetBranchcodesWithOverdueRules; >+is_deeply( \@overdue_branches, ['CPL', 'MPL'] , 'If only 2 specific rules exist, 2 branches should be returned' ); >-- >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 9180
:
13799
|
22574
|
25947
|
27427
|
29548
|
30392