Lines 30-43
use C4::Members;
Link Here
|
30 |
use C4::Overdues; |
30 |
use C4::Overdues; |
31 |
use Koha::Libraries; |
31 |
use Koha::Libraries; |
32 |
|
32 |
|
|
|
33 |
use Koha::Patron::Categories; |
34 |
|
33 |
our $input = new CGI; |
35 |
our $input = new CGI; |
34 |
my $dbh = C4::Context->dbh; |
36 |
my $dbh = C4::Context->dbh; |
35 |
|
37 |
|
36 |
my @categories = @{$dbh->selectall_arrayref( |
38 |
my @patron_categories = Koha::Patron::Categories->search( { overduenoticerequired => { '>' => 0 } } ); |
37 |
'SELECT description, categorycode FROM categories WHERE overduenoticerequired > 0', |
39 |
my @category_codes = map { $_->categorycode } @patron_categories; |
38 |
{ Slice => {} } |
|
|
39 |
)}; |
40 |
my @category_codes = map { $_->{categorycode} } @categories; |
41 |
our @rule_params = qw(delay letter debarred); |
40 |
our @rule_params = qw(delay letter debarred); |
42 |
|
41 |
|
43 |
# 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. |
Lines 224-230
my @line_loop;
Link Here
|
224 |
|
223 |
|
225 |
my $message_transport_types = C4::Letters::GetMessageTransportTypes(); |
224 |
my $message_transport_types = C4::Letters::GetMessageTransportTypes(); |
226 |
my ( @first, @second, @third ); |
225 |
my ( @first, @second, @third ); |
227 |
for my $data (@categories) { |
226 |
for my $patron_category (@patron_categories) { |
228 |
if (%temphash and not $input_saved){ |
227 |
if (%temphash and not $input_saved){ |
229 |
# if we managed to save the form submission, don't |
228 |
# if we managed to save the form submission, don't |
230 |
# reuse %temphash, but take the values from the |
229 |
# reuse %temphash, but take the values from the |
Lines 232-244
for my $data (@categories) {
Link Here
|
232 |
# bugs where the form submission was not correctly saved |
231 |
# bugs where the form submission was not correctly saved |
233 |
for my $i ( 1..3 ){ |
232 |
for my $i ( 1..3 ){ |
234 |
my %row = ( |
233 |
my %row = ( |
235 |
overduename => $data->{'categorycode'}, |
234 |
overduename => $patron_category->categorycode, |
236 |
line => $data->{'description'} |
235 |
line => $patron_category->description, |
237 |
); |
236 |
); |
238 |
$row{delay}=$temphash{$data->{'categorycode'}}->{"delay$i"}; |
237 |
$row{delay}=$temphash{$patron_category->categorycode}->{"delay$i"}; |
239 |
$row{debarred}=$temphash{$data->{'categorycode'}}->{"debarred$i"}; |
238 |
$row{debarred}=$temphash{$patron_category->categorycode}->{"debarred$i"}; |
240 |
$row{selected_lettercode} = $temphash{ $data->{categorycode} }->{"letter$i"}; |
239 |
$row{selected_lettercode} = $temphash{ $patron_category->categorycode }->{"letter$i"}; |
241 |
my @selected_mtts = @{ GetOverdueMessageTransportTypes( $branch, $data->{'categorycode'}, $i) }; |
240 |
my @selected_mtts = @{ GetOverdueMessageTransportTypes( $branch, $patron_category->categorycode, $i) }; |
242 |
my @mtts; |
241 |
my @mtts; |
243 |
for my $mtt ( @$message_transport_types ) { |
242 |
for my $mtt ( @$message_transport_types ) { |
244 |
push @mtts, { |
243 |
push @mtts, { |
Lines 258-276
for my $data (@categories) {
Link Here
|
258 |
} else { |
257 |
} else { |
259 |
#getting values from table |
258 |
#getting values from table |
260 |
my $sth2=$dbh->prepare("SELECT * from overduerules WHERE branchcode=? AND categorycode=?"); |
259 |
my $sth2=$dbh->prepare("SELECT * from overduerules WHERE branchcode=? AND categorycode=?"); |
261 |
$sth2->execute($branch,$data->{'categorycode'}); |
260 |
$sth2->execute($branch,$patron_category->categorycode); |
262 |
my $dat=$sth2->fetchrow_hashref; |
261 |
my $dat=$sth2->fetchrow_hashref; |
263 |
for my $i ( 1..3 ){ |
262 |
for my $i ( 1..3 ){ |
264 |
my %row = ( |
263 |
my %row = ( |
265 |
overduename => $data->{'categorycode'}, |
264 |
overduename => $patron_category->categorycode, |
266 |
line => $data->{'description'} |
265 |
line => $patron_category->description, |
267 |
); |
266 |
); |
268 |
|
267 |
|
269 |
$row{selected_lettercode} = $dat->{"letter$i"}; |
268 |
$row{selected_lettercode} = $dat->{"letter$i"}; |
270 |
|
269 |
|
271 |
if ($dat->{"delay$i"}){$row{delay}=$dat->{"delay$i"};} |
270 |
if ($dat->{"delay$i"}){$row{delay}=$dat->{"delay$i"};} |
272 |
if ($dat->{"debarred$i"}){$row{debarred}=$dat->{"debarred$i"};} |
271 |
if ($dat->{"debarred$i"}){$row{debarred}=$dat->{"debarred$i"};} |
273 |
my @selected_mtts = @{ GetOverdueMessageTransportTypes( $branch, $data->{'categorycode'}, $i) }; |
272 |
my @selected_mtts = @{ GetOverdueMessageTransportTypes( $branch, $patron_category->categorycode, $i) }; |
274 |
my @mtts; |
273 |
my @mtts; |
275 |
for my $mtt ( @$message_transport_types ) { |
274 |
for my $mtt ( @$message_transport_types ) { |
276 |
push @mtts, { |
275 |
push @mtts, { |
277 |
- |
|
|