Lines 35-41
my $dbh = C4::Context->dbh;
Link Here
|
35 |
|
35 |
|
36 |
my @patron_categories = Koha::Patron::Categories->search( { overduenoticerequired => { '>' => 0 } } ); |
36 |
my @patron_categories = Koha::Patron::Categories->search( { overduenoticerequired => { '>' => 0 } } ); |
37 |
my @category_codes = map { $_->categorycode } @patron_categories; |
37 |
my @category_codes = map { $_->categorycode } @patron_categories; |
38 |
our @rule_params = qw(delay letter debarred); |
38 |
our @rule_params = qw(delay letter debarred fixed_fine); |
39 |
|
39 |
|
40 |
# blank_row($category_code) - return true if the entire row is blank. |
40 |
# blank_row($category_code) - return true if the entire row is blank. |
41 |
sub blank_row { |
41 |
sub blank_row { |
Lines 91-98
if ($op eq 'save') {
Link Here
|
91 |
my @names=$input->multi_param(); |
91 |
my @names=$input->multi_param(); |
92 |
my $sth_search = $dbh->prepare("SELECT count(*) AS total FROM overduerules WHERE branchcode=? AND categorycode=?"); |
92 |
my $sth_search = $dbh->prepare("SELECT count(*) AS total FROM overduerules WHERE branchcode=? AND categorycode=?"); |
93 |
|
93 |
|
94 |
my $sth_insert = $dbh->prepare("INSERT INTO overduerules (branchcode,categorycode, delay1,letter1,debarred1, delay2,letter2,debarred2, delay3,letter3,debarred3) VALUES (?,?,?,?,?,?,?,?,?,?,?)"); |
94 |
my $sth_insert = $dbh->prepare("INSERT INTO overduerules (branchcode,categorycode, delay1,letter1,debarred1,fixed_fine1, delay2,letter2,debarred2,fixed_fine1, delay3,letter3,debarred3,fixed_fine1) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?)"); |
95 |
my $sth_update=$dbh->prepare("UPDATE overduerules SET delay1=?, letter1=?, debarred1=?, delay2=?, letter2=?, debarred2=?, delay3=?, letter3=?, debarred3=? WHERE branchcode=? AND categorycode=?"); |
95 |
my $sth_update=$dbh->prepare("UPDATE overduerules SET delay1=?, letter1=?, debarred1=?, fixed_fine1=?, delay2=?, letter2=?, debarred2=?, fixed_fine2=?, delay3=?, letter3=?, debarred3=?, fixed_fine3=? WHERE branchcode=? AND categorycode=?"); |
96 |
my $sth_delete=$dbh->prepare("DELETE FROM overduerules WHERE branchcode=? AND categorycode=?"); |
96 |
my $sth_delete=$dbh->prepare("DELETE FROM overduerules WHERE branchcode=? AND categorycode=?"); |
97 |
my $sth_insert_mtt = $dbh->prepare(" |
97 |
my $sth_insert_mtt = $dbh->prepare(" |
98 |
INSERT INTO overduerules_transport_types( |
98 |
INSERT INTO overduerules_transport_types( |
Lines 108-114
if ($op eq 'save') {
Link Here
|
108 |
|
108 |
|
109 |
foreach my $key (@names){ |
109 |
foreach my $key (@names){ |
110 |
# ISSUES |
110 |
# ISSUES |
111 |
if ($key =~ /(delay|letter|debarred)([1-3])-(.*)/) { |
111 |
if ($key =~ /(delay|letter|debarred|fixed_fine)([1-3])-(.*)/) { |
112 |
my $type = $1; # data type |
112 |
my $type = $1; # data type |
113 |
my $num = $2; # From 1 to 3 |
113 |
my $num = $2; # From 1 to 3 |
114 |
my $bor = $3; # borrower category |
114 |
my $bor = $3; # borrower category |
Lines 157-165
if ($op eq 'save') {
Link Here
|
157 |
$err=1; |
157 |
$err=1; |
158 |
} |
158 |
} |
159 |
unless ($err){ |
159 |
unless ($err){ |
160 |
if (($temphash{$bor}->{delay1} and ($temphash{$bor}->{"letter1"} or $temphash{$bor}->{"debarred1"})) |
160 |
if (($temphash{$bor}->{delay1} and ($temphash{$bor}->{"letter1"} or $temphash{$bor}->{"debarred1"} or $temphash{$bor}->{"fixed_fine1"})) |
161 |
or ($temphash{$bor}->{delay2} and ($temphash{$bor}->{"letter2"} or $temphash{$bor}->{"debarred2"})) |
161 |
or ($temphash{$bor}->{delay2} and ($temphash{$bor}->{"letter2"} or $temphash{$bor}->{"debarred2"} or $temphash{$bor}->{"fixed_fine2"})) |
162 |
or ($temphash{$bor}->{delay3} and ($temphash{$bor}->{"letter3"} or $temphash{$bor}->{"debarred3"}))) { |
162 |
or ($temphash{$bor}->{delay3} and ($temphash{$bor}->{"letter3"} or $temphash{$bor}->{"debarred3"} or $temphash{$bor}->{"fixed_fine3"}))) { |
163 |
$sth_search->execute($branch,$bor); |
163 |
$sth_search->execute($branch,$bor); |
164 |
my $res = $sth_search->fetchrow_hashref(); |
164 |
my $res = $sth_search->fetchrow_hashref(); |
165 |
if ($res->{'total'}>0) { |
165 |
if ($res->{'total'}>0) { |
Lines 167-178
if ($op eq 'save') {
Link Here
|
167 |
($temphash{$bor}->{"delay1"}?$temphash{$bor}->{"delay1"}:undef), |
167 |
($temphash{$bor}->{"delay1"}?$temphash{$bor}->{"delay1"}:undef), |
168 |
($temphash{$bor}->{"letter1"}?$temphash{$bor}->{"letter1"}:""), |
168 |
($temphash{$bor}->{"letter1"}?$temphash{$bor}->{"letter1"}:""), |
169 |
($temphash{$bor}->{"debarred1"}?$temphash{$bor}->{"debarred1"}:0), |
169 |
($temphash{$bor}->{"debarred1"}?$temphash{$bor}->{"debarred1"}:0), |
|
|
170 |
($temphash{$bor}->{"fixed_fine1"}?$temphash{$bor}->{"fixed_fine1"}:0), |
170 |
($temphash{$bor}->{"delay2"}?$temphash{$bor}->{"delay2"}:undef), |
171 |
($temphash{$bor}->{"delay2"}?$temphash{$bor}->{"delay2"}:undef), |
171 |
($temphash{$bor}->{"letter2"}?$temphash{$bor}->{"letter2"}:""), |
172 |
($temphash{$bor}->{"letter2"}?$temphash{$bor}->{"letter2"}:""), |
172 |
($temphash{$bor}->{"debarred2"}?$temphash{$bor}->{"debarred2"}:0), |
173 |
($temphash{$bor}->{"debarred2"}?$temphash{$bor}->{"debarred2"}:0), |
|
|
174 |
($temphash{$bor}->{"fixed_fine2"}?$temphash{$bor}->{"fixed_fine2"}:0), |
173 |
($temphash{$bor}->{"delay3"}?$temphash{$bor}->{"delay3"}:undef), |
175 |
($temphash{$bor}->{"delay3"}?$temphash{$bor}->{"delay3"}:undef), |
174 |
($temphash{$bor}->{"letter3"}?$temphash{$bor}->{"letter3"}:""), |
176 |
($temphash{$bor}->{"letter3"}?$temphash{$bor}->{"letter3"}:""), |
175 |
($temphash{$bor}->{"debarred3"}?$temphash{$bor}->{"debarred3"}:0), |
177 |
($temphash{$bor}->{"debarred3"}?$temphash{$bor}->{"debarred3"}:0), |
|
|
178 |
($temphash{$bor}->{"fixed_fine3"}?$temphash{$bor}->{"fixed_fine3"}:0), |
176 |
$branch ,$bor |
179 |
$branch ,$bor |
177 |
); |
180 |
); |
178 |
} else { |
181 |
} else { |
Lines 180-191
if ($op eq 'save') {
Link Here
|
180 |
($temphash{$bor}->{"delay1"}?$temphash{$bor}->{"delay1"}:0), |
183 |
($temphash{$bor}->{"delay1"}?$temphash{$bor}->{"delay1"}:0), |
181 |
($temphash{$bor}->{"letter1"}?$temphash{$bor}->{"letter1"}:""), |
184 |
($temphash{$bor}->{"letter1"}?$temphash{$bor}->{"letter1"}:""), |
182 |
($temphash{$bor}->{"debarred1"}?$temphash{$bor}->{"debarred1"}:0), |
185 |
($temphash{$bor}->{"debarred1"}?$temphash{$bor}->{"debarred1"}:0), |
|
|
186 |
($temphash{$bor}->{"fixed_fine1"}?$temphash{$bor}->{"fixed_fine1"}:0), |
183 |
($temphash{$bor}->{"delay2"}?$temphash{$bor}->{"delay2"}:0), |
187 |
($temphash{$bor}->{"delay2"}?$temphash{$bor}->{"delay2"}:0), |
184 |
($temphash{$bor}->{"letter2"}?$temphash{$bor}->{"letter2"}:""), |
188 |
($temphash{$bor}->{"letter2"}?$temphash{$bor}->{"letter2"}:""), |
185 |
($temphash{$bor}->{"debarred2"}?$temphash{$bor}->{"debarred2"}:0), |
189 |
($temphash{$bor}->{"debarred2"}?$temphash{$bor}->{"debarred2"}:0), |
|
|
190 |
($temphash{$bor}->{"fixed_fine2"}?$temphash{$bor}->{"fixed_fine2"}:0), |
186 |
($temphash{$bor}->{"delay3"}?$temphash{$bor}->{"delay3"}:0), |
191 |
($temphash{$bor}->{"delay3"}?$temphash{$bor}->{"delay3"}:0), |
187 |
($temphash{$bor}->{"letter3"}?$temphash{$bor}->{"letter3"}:""), |
192 |
($temphash{$bor}->{"letter3"}?$temphash{$bor}->{"letter3"}:""), |
188 |
($temphash{$bor}->{"debarred3"}?$temphash{$bor}->{"debarred3"}:0) |
193 |
($temphash{$bor}->{"debarred3"}?$temphash{$bor}->{"debarred3"}:0), |
|
|
194 |
($temphash{$bor}->{"fixed_fine3"}?$temphash{$bor}->{"fixed_fine3"}:0) |
189 |
); |
195 |
); |
190 |
} |
196 |
} |
191 |
|
197 |
|
Lines 233-238
for my $patron_category (@patron_categories) {
Link Here
|
233 |
); |
239 |
); |
234 |
$row{delay}=$temphash{$patron_category->categorycode}->{"delay$i"}; |
240 |
$row{delay}=$temphash{$patron_category->categorycode}->{"delay$i"}; |
235 |
$row{debarred}=$temphash{$patron_category->categorycode}->{"debarred$i"}; |
241 |
$row{debarred}=$temphash{$patron_category->categorycode}->{"debarred$i"}; |
|
|
242 |
$row{fixed_fine}=$temphash{$patron_category->categorycode}->{"fixed_fine$i"}; |
236 |
$row{selected_lettercode} = $temphash{ $patron_category->categorycode }->{"letter$i"}; |
243 |
$row{selected_lettercode} = $temphash{ $patron_category->categorycode }->{"letter$i"}; |
237 |
my @selected_mtts = @{ GetOverdueMessageTransportTypes( $branch, $patron_category->categorycode, $i) }; |
244 |
my @selected_mtts = @{ GetOverdueMessageTransportTypes( $branch, $patron_category->categorycode, $i) }; |
238 |
my @mtts; |
245 |
my @mtts; |
Lines 266-271
for my $patron_category (@patron_categories) {
Link Here
|
266 |
|
273 |
|
267 |
if ($dat->{"delay$i"}){$row{delay}=$dat->{"delay$i"};} |
274 |
if ($dat->{"delay$i"}){$row{delay}=$dat->{"delay$i"};} |
268 |
if ($dat->{"debarred$i"}){$row{debarred}=$dat->{"debarred$i"};} |
275 |
if ($dat->{"debarred$i"}){$row{debarred}=$dat->{"debarred$i"};} |
|
|
276 |
if ($dat->{"fixed_fine$i"}){$row{fixed_fine}=$dat->{"fixed_fine$i"};} |
269 |
my @selected_mtts = @{ GetOverdueMessageTransportTypes( $branch, $patron_category->categorycode, $i) }; |
277 |
my @selected_mtts = @{ GetOverdueMessageTransportTypes( $branch, $patron_category->categorycode, $i) }; |
270 |
my @mtts; |
278 |
my @mtts; |
271 |
for my $mtt ( @$message_transport_types ) { |
279 |
for my $mtt ( @$message_transport_types ) { |
272 |
- |
|
|