Lines 29-42
use C4::Letters;
Link Here
|
29 |
use C4::Members; |
29 |
use C4::Members; |
30 |
use C4::Overdues; |
30 |
use C4::Overdues; |
31 |
|
31 |
|
|
|
32 |
use Koha::Patron::Categories; |
33 |
|
32 |
our $input = new CGI; |
34 |
our $input = new CGI; |
33 |
my $dbh = C4::Context->dbh; |
35 |
my $dbh = C4::Context->dbh; |
34 |
|
36 |
|
35 |
my @categories = @{$dbh->selectall_arrayref( |
37 |
my @patron_categories = Koha::Patron::Categories->search( { overduenoticerequired => { '>' => 0 } } ); |
36 |
'SELECT description, categorycode FROM categories WHERE overduenoticerequired > 0', |
38 |
my @category_codes = map { $_->categorycode } @patron_categories; |
37 |
{ Slice => {} } |
|
|
38 |
)}; |
39 |
my @category_codes = map { $_->{categorycode} } @categories; |
40 |
our @rule_params = qw(delay letter debarred); |
39 |
our @rule_params = qw(delay letter debarred); |
41 |
|
40 |
|
42 |
# blank_row($category_code) - return true if the entire row is blank. |
41 |
# blank_row($category_code) - return true if the entire row is blank. |
Lines 212-218
my @line_loop;
Link Here
|
212 |
|
211 |
|
213 |
my $message_transport_types = C4::Letters::GetMessageTransportTypes(); |
212 |
my $message_transport_types = C4::Letters::GetMessageTransportTypes(); |
214 |
my ( @first, @second, @third ); |
213 |
my ( @first, @second, @third ); |
215 |
for my $data (@categories) { |
214 |
for my $patron_category (@patron_categories) { |
216 |
if (%temphash and not $input_saved){ |
215 |
if (%temphash and not $input_saved){ |
217 |
# if we managed to save the form submission, don't |
216 |
# if we managed to save the form submission, don't |
218 |
# reuse %temphash, but take the values from the |
217 |
# reuse %temphash, but take the values from the |
Lines 220-232
for my $data (@categories) {
Link Here
|
220 |
# bugs where the form submission was not correctly saved |
219 |
# bugs where the form submission was not correctly saved |
221 |
for my $i ( 1..3 ){ |
220 |
for my $i ( 1..3 ){ |
222 |
my %row = ( |
221 |
my %row = ( |
223 |
overduename => $data->{'categorycode'}, |
222 |
overduename => $patron_category->categorycode, |
224 |
line => $data->{'description'} |
223 |
line => $patron_category->description, |
225 |
); |
224 |
); |
226 |
$row{delay}=$temphash{$data->{'categorycode'}}->{"delay$i"}; |
225 |
$row{delay}=$temphash{$patron_category->categorycode}->{"delay$i"}; |
227 |
$row{debarred}=$temphash{$data->{'categorycode'}}->{"debarred$i"}; |
226 |
$row{debarred}=$temphash{$patron_category->categorycode}->{"debarred$i"}; |
228 |
$row{selected_lettercode} = $temphash{ $data->{categorycode} }->{"letter$i"}; |
227 |
$row{selected_lettercode} = $temphash{ $patron_category->categorycode }->{"letter$i"}; |
229 |
my @selected_mtts = @{ GetOverdueMessageTransportTypes( $branch, $data->{'categorycode'}, $i) }; |
228 |
my @selected_mtts = @{ GetOverdueMessageTransportTypes( $branch, $patron_category->categorycode, $i) }; |
230 |
my @mtts; |
229 |
my @mtts; |
231 |
for my $mtt ( @$message_transport_types ) { |
230 |
for my $mtt ( @$message_transport_types ) { |
232 |
push @mtts, { |
231 |
push @mtts, { |
Lines 246-264
for my $data (@categories) {
Link Here
|
246 |
} else { |
245 |
} else { |
247 |
#getting values from table |
246 |
#getting values from table |
248 |
my $sth2=$dbh->prepare("SELECT * from overduerules WHERE branchcode=? AND categorycode=?"); |
247 |
my $sth2=$dbh->prepare("SELECT * from overduerules WHERE branchcode=? AND categorycode=?"); |
249 |
$sth2->execute($branch,$data->{'categorycode'}); |
248 |
$sth2->execute($branch,$patron_category->categorycode); |
250 |
my $dat=$sth2->fetchrow_hashref; |
249 |
my $dat=$sth2->fetchrow_hashref; |
251 |
for my $i ( 1..3 ){ |
250 |
for my $i ( 1..3 ){ |
252 |
my %row = ( |
251 |
my %row = ( |
253 |
overduename => $data->{'categorycode'}, |
252 |
overduename => $patron_category->categorycode, |
254 |
line => $data->{'description'} |
253 |
line => $patron_category->description, |
255 |
); |
254 |
); |
256 |
|
255 |
|
257 |
$row{selected_lettercode} = $dat->{"letter$i"}; |
256 |
$row{selected_lettercode} = $dat->{"letter$i"}; |
258 |
|
257 |
|
259 |
if ($dat->{"delay$i"}){$row{delay}=$dat->{"delay$i"};} |
258 |
if ($dat->{"delay$i"}){$row{delay}=$dat->{"delay$i"};} |
260 |
if ($dat->{"debarred$i"}){$row{debarred}=$dat->{"debarred$i"};} |
259 |
if ($dat->{"debarred$i"}){$row{debarred}=$dat->{"debarred$i"};} |
261 |
my @selected_mtts = @{ GetOverdueMessageTransportTypes( $branch, $data->{'categorycode'}, $i) }; |
260 |
my @selected_mtts = @{ GetOverdueMessageTransportTypes( $branch, $patron_category->categorycode, $i) }; |
262 |
my @mtts; |
261 |
my @mtts; |
263 |
for my $mtt ( @$message_transport_types ) { |
262 |
for my $mtt ( @$message_transport_types ) { |
264 |
push @mtts, { |
263 |
push @mtts, { |
265 |
- |
|
|