[Koha-bugs] [Bug 21610] Koha::Object->store needs to handle incorrect values

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Tue Oct 23 15:52:34 CEST 2018


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

--- Comment #27 from Jonathan Druart <jonathan.druart at bugs.koha-community.org> ---
(In reply to Kyle M Hall from comment #16)
> Comment on attachment 80882 [details] [review]
> Bug 21610: Fix integers and dates values at Koha::Object->store level
> 
> Review of attachment 80882 [details] [review]:
> -----------------------------------------------------------------
> 
> ::: Koha/Object.pm
> @@ +308,5 @@
> > +        'date',
> > +        'datetime'
> > +    );
> > +
> > +    return ( grep { $column_type eq $_ } @dt_types) ? 1 : 0;
> 
> I think this may be quite inefficient as it uses grep. Perhaps we could use
> https://perldoc.perl.org/List/Util.html#any instead? Or just a set of
> ternary operators or elsifs if we really want to keep it fast and simple.

Hi Kyle, thanks for your feedback!

I would consider this as out of the scope for now, I reused what
_datetime_column_type and other methods already did:

Koha/Object.pm:        unless ( grep {/^$p$/} @columns ) {
Koha/Object.pm:    return ( grep { $column_type eq $_ } @dt_types) ? 1 : 0;
Koha/Object.pm:    return ( grep { $column_type eq $_ } @numeric_types) ? 1 :
0;
Koha/Object.pm:    if ( grep {/^$method$/} @columns ) {
Koha/Object.pm:    ) unless grep { /^$method$/ } @known_methods;

However I agree we should replace them but, then, all of them at the same time
:)
I am going to open a separate bug report to talk about that.

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


More information about the Koha-bugs mailing list