[Koha-bugs] [Bug 25440] Remove undef and CGI warnings and fix template variables list in circulation rules

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Tue May 19 09:45:05 CEST 2020


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25440

Andrew Nugged <nugged at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|Needs Signoff               |In Discussion

--- Comment #11 from Andrew Nugged <nugged at gmail.com> ---
(In reply to Jonathan Druart from comment #8)
> > -    $maxsuspensiondays = undef if $maxsuspensiondays eq q||;
> > -    $maxsuspensiondays = '' if $maxsuspensiondays eq q||;
> 
> Maybe a bit radical :)
> 
> This is coming from a bad merge resolution conflict, I think it should be:
> my $maxsuspensiondays = $input->param('maxsuspensiondays') || q||;
> 
> Just a feeling, it should be tested.

In old db before circulation_rules table, it was "NULL-possible" value,
so I was confused too.

$input->param('maxsuspensiondays') here always comes as '' from posted form but
if parameter absent so default might be

When I removed these both lines I found in code only one place where this key
is used:

File: /opt/n/koha/git/KohaCommunity/C4/Circulation.pm
2326: my $max_sd = $issuing_rule->{maxsuspensiondays};
2327: if ( defined $max_sd && $max_sd ne '' ) {
2328:     $max_sd = DateTime::Duration->new( days => $max_sd );
2329:     $suspension_days = $max_sd
2330:       if DateTime::Duration->compare( $max_sd, $suspension_days ) < 0;
2331: }

and there both '' and undef is possible, so no matter which one we will have in
db.

But because current circulation_rules not allow "NULLS" for key/val pairs but
pair absence is assumed as null so it might be the consequences, that why we
had few other fixes and slightly mess with default states for parameters after
conversion from issuinrules to circulation_rules, but yes, I agree, let's stick
with one value, let it be ''.

Recreating the patch now and will follow your proposal: and it works as on me.

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list