Lines 37-43
my @categories = @{$dbh->selectall_arrayref(
Link Here
|
37 |
{ Slice => {} } |
37 |
{ Slice => {} } |
38 |
)}; |
38 |
)}; |
39 |
my @category_codes = map { $_->{categorycode} } @categories; |
39 |
my @category_codes = map { $_->{categorycode} } @categories; |
40 |
our @rule_params = qw(delay letter debarred); |
40 |
our @rule_params = qw(delay letter debarred fixed_fine); |
41 |
|
41 |
|
42 |
# blank_row($category_code) - return true if the entire row is blank. |
42 |
# blank_row($category_code) - return true if the entire row is blank. |
43 |
sub blank_row { |
43 |
sub blank_row { |
Lines 82-89
if ($op eq 'save') {
Link Here
|
82 |
my @names=$input->param(); |
82 |
my @names=$input->param(); |
83 |
my $sth_search = $dbh->prepare("SELECT count(*) AS total FROM overduerules WHERE branchcode=? AND categorycode=?"); |
83 |
my $sth_search = $dbh->prepare("SELECT count(*) AS total FROM overduerules WHERE branchcode=? AND categorycode=?"); |
84 |
|
84 |
|
85 |
my $sth_insert = $dbh->prepare("INSERT INTO overduerules (branchcode,categorycode, delay1,letter1,debarred1, delay2,letter2,debarred2, delay3,letter3,debarred3) VALUES (?,?,?,?,?,?,?,?,?,?,?)"); |
85 |
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 (?,?,?,?,?,?,?,?,?,?,?,?,?,?)"); |
86 |
my $sth_update=$dbh->prepare("UPDATE overduerules SET delay1=?, letter1=?, debarred1=?, delay2=?, letter2=?, debarred2=?, delay3=?, letter3=?, debarred3=? WHERE branchcode=? AND categorycode=?"); |
86 |
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=?"); |
87 |
my $sth_delete=$dbh->prepare("DELETE FROM overduerules WHERE branchcode=? AND categorycode=?"); |
87 |
my $sth_delete=$dbh->prepare("DELETE FROM overduerules WHERE branchcode=? AND categorycode=?"); |
88 |
my $sth_insert_mtt = $dbh->prepare(" |
88 |
my $sth_insert_mtt = $dbh->prepare(" |
89 |
INSERT INTO overduerules_transport_types( |
89 |
INSERT INTO overduerules_transport_types( |
Lines 99-105
if ($op eq 'save') {
Link Here
|
99 |
|
99 |
|
100 |
foreach my $key (@names){ |
100 |
foreach my $key (@names){ |
101 |
# ISSUES |
101 |
# ISSUES |
102 |
if ($key =~ /(delay|letter|debarred)([1-3])-(.*)/) { |
102 |
if ($key =~ /(delay|letter|debarred|fixed_fine)([1-3])-(.*)/) { |
103 |
my $type = $1; # data type |
103 |
my $type = $1; # data type |
104 |
my $num = $2; # From 1 to 3 |
104 |
my $num = $2; # From 1 to 3 |
105 |
my $bor = $3; # borrower category |
105 |
my $bor = $3; # borrower category |
Lines 148-156
if ($op eq 'save') {
Link Here
|
148 |
$err=1; |
148 |
$err=1; |
149 |
} |
149 |
} |
150 |
unless ($err){ |
150 |
unless ($err){ |
151 |
if (($temphash{$bor}->{delay1} and ($temphash{$bor}->{"letter1"} or $temphash{$bor}->{"debarred1"})) |
151 |
if (($temphash{$bor}->{delay1} and ($temphash{$bor}->{"letter1"} or $temphash{$bor}->{"debarred1"} or $temphash{$bor}->{"fixed_fine1"})) |
152 |
or ($temphash{$bor}->{delay2} and ($temphash{$bor}->{"letter2"} or $temphash{$bor}->{"debarred2"})) |
152 |
or ($temphash{$bor}->{delay2} and ($temphash{$bor}->{"letter2"} or $temphash{$bor}->{"debarred2"} or $temphash{$bor}->{"fixed_fine2"})) |
153 |
or ($temphash{$bor}->{delay3} and ($temphash{$bor}->{"letter3"} or $temphash{$bor}->{"debarred3"}))) { |
153 |
or ($temphash{$bor}->{delay3} and ($temphash{$bor}->{"letter3"} or $temphash{$bor}->{"debarred3"} or $temphash{$bor}->{"fixed_fine3"}))) { |
154 |
$sth_search->execute($branch,$bor); |
154 |
$sth_search->execute($branch,$bor); |
155 |
my $res = $sth_search->fetchrow_hashref(); |
155 |
my $res = $sth_search->fetchrow_hashref(); |
156 |
if ($res->{'total'}>0) { |
156 |
if ($res->{'total'}>0) { |
Lines 158-169
if ($op eq 'save') {
Link Here
|
158 |
($temphash{$bor}->{"delay1"}?$temphash{$bor}->{"delay1"}:undef), |
158 |
($temphash{$bor}->{"delay1"}?$temphash{$bor}->{"delay1"}:undef), |
159 |
($temphash{$bor}->{"letter1"}?$temphash{$bor}->{"letter1"}:""), |
159 |
($temphash{$bor}->{"letter1"}?$temphash{$bor}->{"letter1"}:""), |
160 |
($temphash{$bor}->{"debarred1"}?$temphash{$bor}->{"debarred1"}:0), |
160 |
($temphash{$bor}->{"debarred1"}?$temphash{$bor}->{"debarred1"}:0), |
|
|
161 |
($temphash{$bor}->{"fixed_fine1"}?$temphash{$bor}->{"fixed_fine1"}:0), |
161 |
($temphash{$bor}->{"delay2"}?$temphash{$bor}->{"delay2"}:undef), |
162 |
($temphash{$bor}->{"delay2"}?$temphash{$bor}->{"delay2"}:undef), |
162 |
($temphash{$bor}->{"letter2"}?$temphash{$bor}->{"letter2"}:""), |
163 |
($temphash{$bor}->{"letter2"}?$temphash{$bor}->{"letter2"}:""), |
163 |
($temphash{$bor}->{"debarred2"}?$temphash{$bor}->{"debarred2"}:0), |
164 |
($temphash{$bor}->{"debarred2"}?$temphash{$bor}->{"debarred2"}:0), |
|
|
165 |
($temphash{$bor}->{"fixed_fine2"}?$temphash{$bor}->{"fixed_fine2"}:0), |
164 |
($temphash{$bor}->{"delay3"}?$temphash{$bor}->{"delay3"}:undef), |
166 |
($temphash{$bor}->{"delay3"}?$temphash{$bor}->{"delay3"}:undef), |
165 |
($temphash{$bor}->{"letter3"}?$temphash{$bor}->{"letter3"}:""), |
167 |
($temphash{$bor}->{"letter3"}?$temphash{$bor}->{"letter3"}:""), |
166 |
($temphash{$bor}->{"debarred3"}?$temphash{$bor}->{"debarred3"}:0), |
168 |
($temphash{$bor}->{"debarred3"}?$temphash{$bor}->{"debarred3"}:0), |
|
|
169 |
($temphash{$bor}->{"fixed_fine3"}?$temphash{$bor}->{"fixed_fine3"}:0), |
167 |
$branch ,$bor |
170 |
$branch ,$bor |
168 |
); |
171 |
); |
169 |
} else { |
172 |
} else { |
Lines 171-182
if ($op eq 'save') {
Link Here
|
171 |
($temphash{$bor}->{"delay1"}?$temphash{$bor}->{"delay1"}:0), |
174 |
($temphash{$bor}->{"delay1"}?$temphash{$bor}->{"delay1"}:0), |
172 |
($temphash{$bor}->{"letter1"}?$temphash{$bor}->{"letter1"}:""), |
175 |
($temphash{$bor}->{"letter1"}?$temphash{$bor}->{"letter1"}:""), |
173 |
($temphash{$bor}->{"debarred1"}?$temphash{$bor}->{"debarred1"}:0), |
176 |
($temphash{$bor}->{"debarred1"}?$temphash{$bor}->{"debarred1"}:0), |
|
|
177 |
($temphash{$bor}->{"fixed_fine1"}?$temphash{$bor}->{"fixed_fine1"}:0), |
174 |
($temphash{$bor}->{"delay2"}?$temphash{$bor}->{"delay2"}:0), |
178 |
($temphash{$bor}->{"delay2"}?$temphash{$bor}->{"delay2"}:0), |
175 |
($temphash{$bor}->{"letter2"}?$temphash{$bor}->{"letter2"}:""), |
179 |
($temphash{$bor}->{"letter2"}?$temphash{$bor}->{"letter2"}:""), |
176 |
($temphash{$bor}->{"debarred2"}?$temphash{$bor}->{"debarred2"}:0), |
180 |
($temphash{$bor}->{"debarred2"}?$temphash{$bor}->{"debarred2"}:0), |
|
|
181 |
($temphash{$bor}->{"fixed_fine2"}?$temphash{$bor}->{"fixed_fine2"}:0), |
177 |
($temphash{$bor}->{"delay3"}?$temphash{$bor}->{"delay3"}:0), |
182 |
($temphash{$bor}->{"delay3"}?$temphash{$bor}->{"delay3"}:0), |
178 |
($temphash{$bor}->{"letter3"}?$temphash{$bor}->{"letter3"}:""), |
183 |
($temphash{$bor}->{"letter3"}?$temphash{$bor}->{"letter3"}:""), |
179 |
($temphash{$bor}->{"debarred3"}?$temphash{$bor}->{"debarred3"}:0) |
184 |
($temphash{$bor}->{"debarred3"}?$temphash{$bor}->{"debarred3"}:0), |
|
|
185 |
($temphash{$bor}->{"fixed_fine3"}?$temphash{$bor}->{"fixed_fine3"}:0) |
180 |
); |
186 |
); |
181 |
} |
187 |
} |
182 |
|
188 |
|
Lines 225-230
for my $data (@categories) {
Link Here
|
225 |
); |
231 |
); |
226 |
$row{delay}=$temphash{$data->{'categorycode'}}->{"delay$i"}; |
232 |
$row{delay}=$temphash{$data->{'categorycode'}}->{"delay$i"}; |
227 |
$row{debarred}=$temphash{$data->{'categorycode'}}->{"debarred$i"}; |
233 |
$row{debarred}=$temphash{$data->{'categorycode'}}->{"debarred$i"}; |
|
|
234 |
$row{fixed_fine}=$temphash{$data->{'categorycode'}}->{"fixed_fine$i"}; |
228 |
$row{selected_lettercode} = $temphash{ $data->{categorycode} }->{"letter$i"}; |
235 |
$row{selected_lettercode} = $temphash{ $data->{categorycode} }->{"letter$i"}; |
229 |
my @selected_mtts = @{ GetOverdueMessageTransportTypes( $branch, $data->{'categorycode'}, $i) }; |
236 |
my @selected_mtts = @{ GetOverdueMessageTransportTypes( $branch, $data->{'categorycode'}, $i) }; |
230 |
my @mtts; |
237 |
my @mtts; |
Lines 258-263
for my $data (@categories) {
Link Here
|
258 |
|
265 |
|
259 |
if ($dat->{"delay$i"}){$row{delay}=$dat->{"delay$i"};} |
266 |
if ($dat->{"delay$i"}){$row{delay}=$dat->{"delay$i"};} |
260 |
if ($dat->{"debarred$i"}){$row{debarred}=$dat->{"debarred$i"};} |
267 |
if ($dat->{"debarred$i"}){$row{debarred}=$dat->{"debarred$i"};} |
|
|
268 |
if ($dat->{"fixed_fine$i"}){$row{fixed_fine}=$dat->{"fixed_fine$i"};} |
261 |
my @selected_mtts = @{ GetOverdueMessageTransportTypes( $branch, $data->{'categorycode'}, $i) }; |
269 |
my @selected_mtts = @{ GetOverdueMessageTransportTypes( $branch, $data->{'categorycode'}, $i) }; |
262 |
my @mtts; |
270 |
my @mtts; |
263 |
for my $mtt ( @$message_transport_types ) { |
271 |
for my $mtt ( @$message_transport_types ) { |
264 |
- |
|
|