Bug 18887: (follow-up) Fix null/empty behavior

Signed-off-by: Lisette Scheer <lisetteslatah@gmail.com>

Signed-off-by: Jesse Maseto <jesse@bywatersolution.com>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
This commit is contained in:
Kyle M Hall 2018-07-18 17:35:46 +00:00 committed by Nick Clemens
parent 5a931e4e93
commit b9727d2058
4 changed files with 5 additions and 5 deletions

View File

@ -429,7 +429,7 @@ sub CanItemBeReserved {
rule_name => 'max_holds',
}
);
if ( $rule ) {
if ( $rule && defined( $rule->rule_value ) && $rule->rule_value ne '' ) {
my $total_holds_count = Koha::Holds->search(
{
borrowernumber => $borrower->{borrowernumber}

View File

@ -232,7 +232,7 @@ elsif ($op eq "set-branch-defaults") {
$holdallowed =~ s/\s//g;
$holdallowed = undef if $holdallowed !~ /^\d+/;
$max_holds =~ s/\s//g;
$max_holds = undef if $max_holds !~ /^\d+/;
$max_holds = '' if $max_holds !~ /^\d+/;
if ($branch eq "*") {
my $sth_search = $dbh->prepare("SELECT count(*) AS total

View File

@ -20,12 +20,12 @@ if( CheckVersion( $DBversion ) ) {
$dbh->do(q{
INSERT INTO circulation_rules ( branchcode, categorycode, itemtype, rule_name, rule_value )
SELECT branchcode, categorycode, NULL, 'max_holds', max_holds FROM branch_borrower_circ_rules
SELECT branchcode, categorycode, NULL, 'max_holds', COALESCE( max_holds, '' ) FROM branch_borrower_circ_rules
});
$dbh->do(q{
INSERT INTO circulation_rules ( branchcode, categorycode, itemtype, rule_name, rule_value )
SELECT NULL, categorycode, NULL, 'max_holds', max_holds FROM branch_borrower_circ_rules
SELECT NULL, categorycode, NULL, 'max_holds', COALESCE( max_holds, '' ) FROM default_borrower_circ_rules
});
$dbh->do(q{

View File

@ -520,7 +520,7 @@
</td>
<td>
[% SET rule_value = CirculationRules.Get( branch_cat_rule_loo.branchcode, branch_cat_rule_loo.categorycode, branch_cat_rule_loo.itemtype, 'max_holds' ) %]
[% IF rule_value %]
[% IF rule_value.defined && rule_value != '' %]
[% rule_value %]
[% ELSE %]
Unlimited