Lines 25-47
use JSON qw( to_json );
Link Here
|
25 |
use Unicode::Normalize qw( NFKD ); |
25 |
use Unicode::Normalize qw( NFKD ); |
26 |
use Try::Tiny; |
26 |
use Try::Tiny; |
27 |
|
27 |
|
28 |
use C4::Context; |
|
|
29 |
use C4::Auth qw( checkpw_hash ); |
28 |
use C4::Auth qw( checkpw_hash ); |
|
|
29 |
use C4::Context; |
30 |
use C4::Letters qw( GetPreparedLetter EnqueueLetter SendQueuedMessages ); |
30 |
use C4::Log qw( logaction ); |
31 |
use C4::Log qw( logaction ); |
31 |
use Koha::Account; |
32 |
use Koha::Account; |
32 |
use Koha::ArticleRequests; |
33 |
use Koha::ArticleRequests; |
33 |
use C4::Letters qw( GetPreparedLetter EnqueueLetter SendQueuedMessages ); |
|
|
34 |
use Koha::AuthUtils; |
34 |
use Koha::AuthUtils; |
35 |
use Koha::Checkouts; |
35 |
use Koha::Checkouts; |
36 |
use Koha::CirculationRules; |
36 |
use Koha::CirculationRules; |
37 |
use Koha::Club::Enrollments; |
37 |
use Koha::Club::Enrollments; |
|
|
38 |
use Koha::CurbsidePickups; |
38 |
use Koha::Database; |
39 |
use Koha::Database; |
39 |
use Koha::DateUtils qw( dt_from_string ); |
40 |
use Koha::DateUtils qw( dt_from_string ); |
40 |
use Koha::Encryption; |
41 |
use Koha::Encryption; |
41 |
use Koha::Exceptions::Password; |
42 |
use Koha::Exceptions::Password; |
42 |
use Koha::Holds; |
43 |
use Koha::Holds; |
43 |
use Koha::CurbsidePickups; |
|
|
44 |
use Koha::Old::Checkouts; |
44 |
use Koha::Old::Checkouts; |
|
|
45 |
use Koha::OverdueRules; |
45 |
use Koha::Patron::Attributes; |
46 |
use Koha::Patron::Attributes; |
46 |
use Koha::Patron::Categories; |
47 |
use Koha::Patron::Categories; |
47 |
use Koha::Patron::Debarments; |
48 |
use Koha::Patron::Debarments; |
Lines 1073-1095
sub _get_overdue_debarred_delay {
Link Here
|
1073 |
my ($branchcode, $categorycode) = @_; |
1074 |
my ($branchcode, $categorycode) = @_; |
1074 |
my $dbh = C4::Context->dbh(); |
1075 |
my $dbh = C4::Context->dbh(); |
1075 |
|
1076 |
|
1076 |
my $query = "SELECT * FROM overduerules WHERE delay1 IS NOT NULL AND branchcode = ? AND categorycode = ?"; |
|
|
1077 |
|
1078 |
my $rqoverduerules = $dbh->prepare($query); |
1079 |
$rqoverduerules->execute($branchcode, $categorycode); |
1080 |
|
1081 |
# We get default rules if there is no rule for this branch |
1077 |
# We get default rules if there is no rule for this branch |
1082 |
if($rqoverduerules->rows == 0) { |
1078 |
my $rule = Koha::OverdueRules->find( |
1083 |
$query = "SELECT * FROM overduerules WHERE delay1 IS NOT NULL AND branchcode = '' AND categorycode = ?"; |
1079 |
{ |
1084 |
|
1080 |
branchcode => $branchcode, |
1085 |
$rqoverduerules = $dbh->prepare($query); |
1081 |
categorycode => $categorycode |
1086 |
$rqoverduerules->execute($categorycode); |
1082 |
} |
1087 |
} |
1083 |
) |
|
|
1084 |
|| Koha::OverdueRules->find( |
1085 |
{ |
1086 |
branchcode => q{}, |
1087 |
categorycode => $categorycode |
1088 |
} |
1089 |
); |
1088 |
|
1090 |
|
1089 |
while ( my $overdue_rules = $rqoverduerules->fetchrow_hashref ) { |
1091 |
if ( $rule ) { |
1090 |
return $overdue_rules->{"delay1"} if($overdue_rules->{"debarred1"}); |
1092 |
return $rule->delay1 if $rule->debarred1; |
1091 |
return $overdue_rules->{"delay2"} if($overdue_rules->{"debarred2"}); |
1093 |
return $rule->delay2 if $rule->debarred2; |
1092 |
return $overdue_rules->{"delay3"} if($overdue_rules->{"debarred3"}); |
1094 |
return $rule->delay3 if $rule->debarred3; |
1093 |
} |
1095 |
} |
1094 |
} |
1096 |
} |
1095 |
|
1097 |
|