Bug 31325 - Fix koha-preferences get
Summary: Fix koha-preferences get
Status: RESOLVED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Command-line Utilities (show other bugs)
Version: master
Hardware: All All
: P5 - low normal (vote)
Assignee: Bugs List
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-08-09 06:48 UTC by Magnus Enger
Modified: 2022-10-23 09:56 UTC (History)
4 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
22.11.00,22.05.06,21.11.12


Attachments
Bug 31325: Fix koha-preferences get (1.03 KB, patch)
2022-08-09 06:53 UTC, Magnus Enger
Details | Diff | Splinter Review
Bug 31325: Fix koha-preferences get (1.08 KB, patch)
2022-08-09 14:30 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 31325: Fix koha-preferences get (1.14 KB, patch)
2022-08-12 13:25 UTC, Martin Renvoize
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Magnus Enger 2022-08-09 06:48:19 UTC
To reproduce: 

$ perl koha/misc/admin/koha-preferences get
HASH(0x55dd4d432840)

The problem is that _fetch_preference() fetches variable, value and type:

109 sub _fetch_preference {
110     my ( $preference ) = @_;
111 
112     my $dbh = C4::Context->dbh;
113 
114     my $row = $dbh->selectrow_hashref( "
115         SELECT
116           variable, value, type
117           FROM systempreferences
118           WHERE variable = ?
119           LIMIT 1
120     ", {}, $preference );
121 
122     exit 2 unless ( $row );
123 
124     return $row;
125 }

And then all of that data is just printed, instead of only the value being printed.
Comment 1 Magnus Enger 2022-08-09 06:53:57 UTC
Created attachment 138880 [details] [review]
Bug 31325: Fix koha-preferences get

To reproduce:
$ perl koha/misc/admin/koha-preferences get MarcFlavour
This will output something like "HASH(0x55dd4d432840)".

To test:
Apply this patch and run the command again:
$ perl koha/misc/admin/koha-preferences get MarcFlavour
This should output something like "MARC21".
Comment 2 Owen Leonard 2022-08-09 14:30:53 UTC
Created attachment 138918 [details] [review]
Bug 31325: Fix koha-preferences get

To reproduce:
$ perl koha/misc/admin/koha-preferences get MarcFlavour
This will output something like "HASH(0x55dd4d432840)".

To test:
Apply this patch and run the command again:
$ perl koha/misc/admin/koha-preferences get MarcFlavour
This should output something like "MARC21".

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Comment 3 Martin Renvoize 2022-08-12 13:25:30 UTC
Created attachment 139050 [details] [review]
Bug 31325: Fix koha-preferences get

To reproduce:
$ perl koha/misc/admin/koha-preferences get MarcFlavour
This will output something like "HASH(0x55dd4d432840)".

To test:
Apply this patch and run the command again:
$ perl koha/misc/admin/koha-preferences get MarcFlavour
This should output something like "MARC21".

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 4 Martin Renvoize 2022-08-12 13:25:54 UTC
Works as expected, Passing QA
Comment 5 Tomás Cohen Arazi 2022-08-16 12:20:54 UTC
Pushed to master for 22.11.

Nice work everyone, thanks!
Comment 6 Lucas Gass 2022-09-30 23:01:09 UTC
Backported to 22.05.x for 22.05.06
Comment 7 Victor Grousset/tuxayo 2022-10-16 16:05:38 UTC
Not backported to oldoldstable (21.05.x). Feel free to ask if it's needed.

Nothing to document it seems, marking resolved.
Comment 8 Arthur Suzuki 2022-10-22 22:10:06 UTC
Thanks!

Pushed to 21.11 for 21.11.12