Bug 41834: Fix GetDelimiterChoices after options column removed from sysprefs.sql

We removed the `options` column from all sysprefs.sql INSERT statements,
leaving CSVDelimiter.options as NULL in the DB. This broke GetDelimiterChoices()
which relied on that column for the list of valid delimiter choices, resulting
in empty dropdowns across all report pages and an uninitialized value warning in
the test suite.

Fix by hardcoding the choices (matching admin.pref) and reading the
current value via C4::Context->preference() instead of a raw DB query.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
This commit is contained in:
Martin Renvoize 2026-03-20 11:34:57 +00:00
parent 9818b3bf8d
commit b3357ab31b
No known key found for this signature in database
GPG Key ID: 2D86E0EAEC83711B
1 changed files with 3 additions and 11 deletions

View File

@ -49,18 +49,10 @@ This will return a list of all the available delimiters.
=cut
sub GetDelimiterChoices {
my $dbh = C4::Context->dbh;
my $default = C4::Context->preference('CSVDelimiter');
my $sth = $dbh->prepare( "
SELECT options, value
FROM systempreferences
WHERE variable = 'CSVDelimiter'
" );
$sth->execute();
my ( $choices, $default ) = $sth->fetchrow;
my @dels = split /\|/, $choices;
# NOTE: The below list should match the corresponding options in the .pref file
my @dels = ( ';', 'tabulation', ',', '/', '\\', '#' );
return {
values => \@dels,