Skip to content
  • joubu's avatar
    Bug 15446: Rename Koha::Object[s]->type with _type · de328950
    joubu authored
    
    
    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
    
    Followed test plan, value is now 0 as expected.
    Signed-off-by: default avatarMarc Véron <veron@veron.ch>
    
    Signed-off-by: default avatarKyle M Hall <kyle@bywatersolutions.com>
    
    Signed-off-by: default avatarJesse Weaver <jweaver@bywatersolutions.com>
    de328950