Lines 96-102
is_deeply(
Link Here
|
96 |
); |
96 |
); |
97 |
|
97 |
|
98 |
# Test GetBranchcodesWithOverdueRules |
98 |
# Test GetBranchcodesWithOverdueRules |
99 |
$dbh->do(q|DELETE FROM overduerules|); |
99 |
$dbh->do(q|DELETE FROM circulation_rules WHERE rule_name LIKE 'overdue_%' |); |
100 |
|
100 |
|
101 |
my @overdue_branches; |
101 |
my @overdue_branches; |
102 |
warnings_are { @overdue_branches = C4::Overdues::GetBranchcodesWithOverdueRules(); } [], |
102 |
warnings_are { @overdue_branches = C4::Overdues::GetBranchcodesWithOverdueRules(); } [], |
Lines 104-113
warnings_are { @overdue_branches = C4::Overdues::GetBranchcodesWithOverdueRules(
Link Here
|
104 |
|
104 |
|
105 |
$dbh->do( |
105 |
$dbh->do( |
106 |
q| |
106 |
q| |
107 |
INSERT INTO overduerules |
107 |
INSERT INTO circulation_rules |
108 |
( branchcode,categorycode, delay1,letter1,debarred1, delay2,letter2,debarred2, delay3,letter3,debarred3 ) |
108 |
( branchcode, categorycode, itemtype, rule_name, rule_value ) |
109 |
VALUES |
109 |
VALUES |
110 |
( '', '', 1, 'LETTER_CODE1', 1, 5, 'LETTER_CODE2', 1, 10, 'LETTER_CODE3', 1 ) |
110 |
( NULL, NULL, NULL, 'overdue_1_delay', 1 ) |
111 |
| |
111 |
| |
112 |
); |
112 |
); |
113 |
|
113 |
|
Lines 121-130
is_deeply(
Link Here
|
121 |
|
121 |
|
122 |
$dbh->do( |
122 |
$dbh->do( |
123 |
q| |
123 |
q| |
124 |
INSERT INTO overduerules |
124 |
INSERT INTO circulation_rules |
125 |
( branchcode,categorycode, delay1,letter1,debarred1, delay2,letter2,debarred2, delay3,letter3,debarred3 ) |
125 |
( branchcode, categorycode, itemtype, rule_name, rule_value ) |
126 |
VALUES |
126 |
VALUES |
127 |
( 'CPL', '', 1, 'LETTER_CODE1', 1, 5, 'LETTER_CODE2', 1, 10, 'LETTER_CODE3', 1 ) |
127 |
( 'CPL', NULL, NULL, 'overdue_1_delay', 1 ) |
128 |
| |
128 |
| |
129 |
); |
129 |
); |
130 |
|
130 |
|
Lines 134-160
is_deeply(
Link Here
|
134 |
'If a default rule exists and a specific rule exists, all branches should be returned' |
134 |
'If a default rule exists and a specific rule exists, all branches should be returned' |
135 |
); |
135 |
); |
136 |
|
136 |
|
137 |
$dbh->do(q|DELETE FROM overduerules|); |
137 |
$dbh->do(q|DELETE FROM circulation_rules WHERE rule_name LIKE 'overdue_%' |); |
138 |
$dbh->do( |
138 |
$dbh->do( |
139 |
q| |
139 |
q| |
140 |
INSERT INTO overduerules |
140 |
INSERT INTO circulation_rules |
141 |
( branchcode,categorycode, delay1,letter1,debarred1, delay2,letter2,debarred2, delay3,letter3,debarred3 ) |
141 |
( branchcode, categorycode, itemtype, rule_name, rule_value ) |
142 |
VALUES |
142 |
VALUES |
143 |
( 'CPL', '', 1, 'LETTER_CODE1', 1, 5, 'LETTER_CODE2', 1, 10, 'LETTER_CODE3', 1 ) |
143 |
( 'CPL', NULL, NULL, 'overdue_1_delay', 1 ) |
144 |
| |
144 |
| |
145 |
); |
145 |
); |
146 |
|
146 |
|
147 |
@overdue_branches = C4::Overdues::GetBranchcodesWithOverdueRules(); |
147 |
@overdue_branches = C4::Overdues::GetBranchcodesWithOverdueRules(); |
148 |
is_deeply( \@overdue_branches, ['CPL'], 'If only a specific rule exist, only 1 branch should be returned' ); |
148 |
is_deeply( \@overdue_branches, ['CPL'], 'If only a specific rule exist, only 1 branch should be returned' ); |
149 |
|
149 |
|
150 |
$dbh->do(q|DELETE FROM overduerules|); |
150 |
$dbh->do(q|DELETE FROM circulation_rules WHERE rule_name LIKE 'overdue_%' |); |
151 |
$dbh->do( |
151 |
$dbh->do( |
152 |
q| |
152 |
q| |
153 |
INSERT INTO overduerules |
153 |
INSERT INTO circulation_rules |
154 |
( branchcode,categorycode, delay1,letter1,debarred1, delay2,letter2,debarred2, delay3,letter3,debarred3 ) |
154 |
( branchcode, categorycode, itemtype, rule_name, rule_value ) |
155 |
VALUES |
155 |
VALUES |
156 |
( 'CPL', '', 1, 'LETTER_CODE1_CPL', 1, 5, 'LETTER_CODE2_CPL', 1, 10, 'LETTER_CODE3_CPL', 1 ), |
156 |
( 'CPL', NULL, NULL, 'overdue_1_delay', 1 ), |
157 |
( 'MPL', '', 1, 'LETTER_CODE1_MPL', 1, 5, 'LETTER_CODE2_MPL', 1, 10, 'LETTER_CODE3_MPL', 1 ) |
157 |
( 'MPL', NULL, NULL, 'overdue_1_delay', 1 ) |
158 |
| |
158 |
| |
159 |
); |
159 |
); |
160 |
|
160 |
|
161 |
- |
|
|