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 1044-1066
sub _get_overdue_debarred_delay {
Link Here
|
1044 |
my ($branchcode, $categorycode) = @_; |
1045 |
my ($branchcode, $categorycode) = @_; |
1045 |
my $dbh = C4::Context->dbh(); |
1046 |
my $dbh = C4::Context->dbh(); |
1046 |
|
1047 |
|
1047 |
my $query = "SELECT * FROM overduerules WHERE delay1 IS NOT NULL AND branchcode = ? AND categorycode = ?"; |
|
|
1048 |
|
1049 |
my $rqoverduerules = $dbh->prepare($query); |
1050 |
$rqoverduerules->execute($branchcode, $categorycode); |
1051 |
|
1052 |
# We get default rules if there is no rule for this branch |
1048 |
# We get default rules if there is no rule for this branch |
1053 |
if($rqoverduerules->rows == 0) { |
1049 |
my $rule = Koha::OverdueRules->find( |
1054 |
$query = "SELECT * FROM overduerules WHERE delay1 IS NOT NULL AND branchcode = '' AND categorycode = ?"; |
1050 |
{ |
1055 |
|
1051 |
branchcode => $branchcode, |
1056 |
$rqoverduerules = $dbh->prepare($query); |
1052 |
categorycode => $categorycode |
1057 |
$rqoverduerules->execute($categorycode); |
1053 |
} |
1058 |
} |
1054 |
) |
|
|
1055 |
|| Koha::OverdueRules->find( |
1056 |
{ |
1057 |
branchcode => q{}, |
1058 |
categorycode => $categorycode |
1059 |
} |
1060 |
); |
1059 |
|
1061 |
|
1060 |
while ( my $overdue_rules = $rqoverduerules->fetchrow_hashref ) { |
1062 |
if ( $rule ) { |
1061 |
return $overdue_rules->{"delay1"} if($overdue_rules->{"debarred1"}); |
1063 |
return $rule->delay1 if $rule->debarred1; |
1062 |
return $overdue_rules->{"delay2"} if($overdue_rules->{"debarred2"}); |
1064 |
return $rule->delay2 if $rule->debarred2; |
1063 |
return $overdue_rules->{"delay3"} if($overdue_rules->{"debarred3"}); |
1065 |
return $rule->delay3 if $rule->debarred3; |
1064 |
} |
1066 |
} |
1065 |
} |
1067 |
} |
1066 |
|
1068 |
|