Lines 57-63
use Koha::RefundLostItemFeeRules;
Link Here
|
57 |
use Koha::Account::Lines; |
57 |
use Koha::Account::Lines; |
58 |
use Koha::Account::Offsets; |
58 |
use Koha::Account::Offsets; |
59 |
use Carp; |
59 |
use Carp; |
60 |
use List::MoreUtils qw( uniq ); |
60 |
use List::MoreUtils qw( uniq any ); |
61 |
use Scalar::Util qw( looks_like_number ); |
61 |
use Scalar::Util qw( looks_like_number ); |
62 |
use Date::Calc qw( |
62 |
use Date::Calc qw( |
63 |
Today |
63 |
Today |
Lines 2603-2608
sub CanBookBeRenewed {
Link Here
|
2603 |
my $item = GetItem($itemnumber) or return ( 0, 'no_item' ); |
2603 |
my $item = GetItem($itemnumber) or return ( 0, 'no_item' ); |
2604 |
my $issue = Koha::Checkouts->find( { itemnumber => $itemnumber } ) or return ( 0, 'no_checkout' ); |
2604 |
my $issue = Koha::Checkouts->find( { itemnumber => $itemnumber } ) or return ( 0, 'no_checkout' ); |
2605 |
return ( 0, 'onsite_checkout' ) if $issue->onsite_checkout; |
2605 |
return ( 0, 'onsite_checkout' ) if $issue->onsite_checkout; |
|
|
2606 |
return ( 0, 'item_denied_renewal') if _item_denied_renewal({ item => $item }); |
2607 |
|
2606 |
|
2608 |
|
2607 |
$borrowernumber ||= $issue->borrowernumber; |
2609 |
$borrowernumber ||= $issue->borrowernumber; |
2608 |
my $patron = Koha::Patrons->find( $borrowernumber ) |
2610 |
my $patron = Koha::Patrons->find( $borrowernumber ) |
Lines 4081-4086
sub _CalculateAndUpdateFine {
Link Here
|
4081 |
} |
4083 |
} |
4082 |
} |
4084 |
} |
4083 |
|
4085 |
|
|
|
4086 |
sub _item_denied_renewal { |
4087 |
my ($params) = @_; |
4088 |
|
4089 |
my $item = $params->{item}; |
4090 |
return unless $item; |
4091 |
|
4092 |
my $yaml = C4::Context->preference('ItemsDeniedRenewal'); |
4093 |
my @lines = split /\n/, $yaml; |
4094 |
my $denyingrules; |
4095 |
foreach my $line (@lines){ |
4096 |
my ($field,$array) = split /:/, $line; |
4097 |
$array =~ s/[ [\]\r]//g; |
4098 |
my @array = split /,/, $array; |
4099 |
@array = map { $_ eq 'NULL' ? undef : $_ } @array; |
4100 |
@array = map { $_ eq '""' || $_ eq "''" ? undef : $_ } @array; |
4101 |
$denyingrules->{$field} = \@array; |
4102 |
} |
4103 |
return unless $denyingrules; |
4104 |
foreach my $field (keys %$denyingrules) { |
4105 |
my $val = $item->{$field}; |
4106 |
if( !defined $val) { |
4107 |
if ( any { !defined $_ } @{$denyingrules->{$field}} ){ |
4108 |
return 1; |
4109 |
} |
4110 |
} elsif (any { $val eq $_ } @{$denyingrules->{$field}}) { |
4111 |
# If the results matches the values in the syspref |
4112 |
# We return true if match found |
4113 |
return 1; |
4114 |
} |
4115 |
} |
4116 |
return 0; |
4117 |
} |
4118 |
|
4119 |
|
4084 |
1; |
4120 |
1; |
4085 |
|
4121 |
|
4086 |
__END__ |
4122 |
__END__ |
4087 |
- |
|
|