[Koha-bugs] [Bug 15446] Koha::Object[s]->type should be renamed to _type to avoid conflict with column name

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Wed Dec 30 18:22:57 CET 2015


http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15446

--- Comment #2 from Jonathan Druart <jonathan.druart at bugs.koha-community.org> ---
Created attachment 46096
  -->
http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=46096&action=edit
Bug 15446: Rename Koha::Object[s]->type with _type

In a few case (at least systempreferences and export_format (csv profiles),
the type method of Koha::Object and Koha::Objects can be in conflict with the
column names.
Indeed systempreferences.type exists and so the method will return
'Systempreference' (the name of the module) instead of the value of the row in
DB.

I have found at least 1 place where it can cause issue:
In C4::Context->set_preference:
 601     my $syspref = Koha::Config::SysPrefs->find( $var );
 602     my $type = $syspref ? $syspref->type() : undef;
 603
 604     $value = 0 if ( $type && $type eq 'YesNo' && $value eq '' );

type will always be 'Systempreference' and the YesNo pref will be set to an
empty string '' instead of 0.

I am not sure about the consequences of this, but it is preferable to
fix it ASAP.

To reproduce:
0/ Do not apply this patch
1/ Edit a YesNo prefs, AutoEmailOpacUser for instance
2/ Set it to "Don't sent"
3/ Check the value in DB, it should be set to an empty string, instead
of 0
4/ Apply this patch and try again. Now the value should be 0

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


More information about the Koha-bugs mailing list