]> git.koha-community.org Git - koha.git/commit
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)
committerJulian Maurice <julian.maurice@biblibre.com>
Mon, 14 Mar 2016 10:10:25 +0000 (11:10 +0100)
commit7847081c526e701da2cdbff231c74eb09782bfe5
tree128c071ba1b71da70df1a6d176c10eb5385ff258
parent0483a13d26001a6c09ff99aac2c62903192380a3
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>
(cherry picked from commit de3289506dcda91510dc9c7a867558a29ebefd57)
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Conflicts:
Koha/Branch.pm
Koha/Branches.pm
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/Branch.pm
Koha/Branches.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/Virtualshelf.pm
Koha/Virtualshelfcontent.pm
Koha/Virtualshelfcontents.pm
Koha/Virtualshelfshare.pm
Koha/Virtualshelfshares.pm
Koha/Virtualshelves.pm