Bug 15446: Rename Koha::Object[s]->type with _type
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Wed, 30 Dec 2015 17:15:31 +0000 (17:15 +0000)
committerJesse Weaver <jweaver@bywatersolutions.com>
Fri, 12 Feb 2016 19:35:57 +0000 (12:35 -0700)
commitde3289506dcda91510dc9c7a867558a29ebefd57
treece2c0f06d56f6e4e370048c6b0fb62e36066861f
parentbd7e79940d548c417580bb79a2f250751fc4575c
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

Followed test plan, value is now 0 as expected.
Signed-off-by: Marc VĂ©ron <veron@veron.ch>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jesse Weaver <jweaver@bywatersolutions.com>
32 files changed:
Koha/AudioAlert.pm
Koha/AudioAlerts.pm
Koha/AuthorisedValue.pm
Koha/AuthorisedValues.pm
Koha/Biblio.pm
Koha/Biblioitem.pm
Koha/Biblioitems.pm
Koha/Biblios.pm
Koha/Borrower.pm
Koha/Borrowers.pm
Koha/Cities.pm
Koha/City.pm
Koha/Config/SysPref.pm
Koha/Config/SysPrefs.pm
Koha/Hold.pm
Koha/Holds.pm
Koha/Item.pm
Koha/Items.pm
Koha/Localization.pm
Koha/Localizations.pm
Koha/Object.pm
Koha/Objects.pm
Koha/Patron/Categories.pm
Koha/Patron/Category.pm
Koha/Serial.pm
Koha/Serials.pm
Koha/Virtualshelf.pm
Koha/Virtualshelfcontent.pm
Koha/Virtualshelfcontents.pm
Koha/Virtualshelfshare.pm
Koha/Virtualshelfshares.pm
Koha/Virtualshelves.pm