Bugzilla – Attachment 184129 Details for
Bug 40405
systempreferences.value cannot be set to NULL
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 40405: Set systempreferences.value to NOT NULL
Bug-40405-Set-systempreferencesvalue-to-NOT-NULL.patch (text/plain), 14.87 KB, created by
Jonathan Druart
on 2025-07-16 10:01:33 UTC
(
hide
)
Description:
Bug 40405: Set systempreferences.value to NOT NULL
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2025-07-16 10:01:33 UTC
Size:
14.87 KB
patch
obsolete
>From 39212050c6f1279244be3a8e08de99c9093c346c Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 16 Jul 2025 11:57:50 +0200 >Subject: [PATCH] Bug 40405: Set systempreferences.value to NOT NULL > >Some sysprefs have NULL as their default value, and systempreferences.value allows NULL values. > >However C4::Context->set_preference does not unset a syspref if "undef" is passed. > >Additionally some of the sysprefs that have NULL as default will generate warnings in the logs (and test suite output). > >opac/opac-suggestions.pl: for my $f ( split( /\s*\,\s*/, C4::Context->preference("OPACSuggestionUnwantedFields") ) ) { > >Here is the current list: >+-------------------------------+-------+ >| variable | value | >+-------------------------------+-------+ >| decreaseLoanHighHoldsDuration | NULL | >| decreaseLoanHighHoldsValue | NULL | >| ILLHiddenRequestStatuses | NULL | >| ILLOpacbackends | NULL | >| ILLSendStaffNotices | NULL | >| ListOwnerDesignated | NULL | >| MarcFieldDocURL | NULL | >| MaxFine | NULL | >| OPACSuggestionUnwantedFields | NULL | >| ReportsExportLimit | NULL | >| SerialsSearchResultsLimit | NULL | >+-------------------------------+-------+ > >Test plan: >Code review required here, please confirm the above and that the >different occurrences do not use "undef" as a value. > >Note that some tests now do not longer generate warnings >(eg. t/db_dependent/selenium/opac_ill_requests.t) >--- > .../data/mysql/atomicupdate/bug_40405.pl | 30 +++++++++++++++++++ > installer/data/mysql/kohastructure.sql | 2 +- > installer/data/mysql/mandatory/sysprefs.sql | 22 +++++++------- > 3 files changed, 42 insertions(+), 12 deletions(-) > create mode 100755 installer/data/mysql/atomicupdate/bug_40405.pl > >diff --git a/installer/data/mysql/atomicupdate/bug_40405.pl b/installer/data/mysql/atomicupdate/bug_40405.pl >new file mode 100755 >index 00000000000..b0aeb88ff2d >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_40405.pl >@@ -0,0 +1,30 @@ >+use Modern::Perl; >+use Koha::Installer::Output qw(say_warning say_success say_info); >+ >+return { >+ bug_number => "40405", >+ description => "Set systempreferences.value to NOT NULL", >+ up => sub { >+ my ($args) = @_; >+ my ( $dbh, $out ) = @$args{qw(dbh out)}; >+ >+ my $modified = $dbh->do( >+ q{ >+ UPDATE systempreferences >+ SET value="" >+ WHERE value IS NULL >+ } >+ ); >+ >+ if ( $modified ne "0E0" ) { >+ say $out sprintf "Adjusted %s systempreference's value to an empty string", $modified; >+ } >+ >+ $dbh->do( >+ q{ >+ ALTER TABLE systempreferences >+ MODIFY COLUMN `value` mediumtext NOT NULL DEFAULT '' COMMENT 'system preference values' >+ } >+ ); >+ }, >+}; >diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql >index 11018d4f7b4..e7448b7fca8 100644 >--- a/installer/data/mysql/kohastructure.sql >+++ b/installer/data/mysql/kohastructure.sql >@@ -6368,7 +6368,7 @@ DROP TABLE IF EXISTS `systempreferences`; > /*!40101 SET character_set_client = utf8mb4 */; > CREATE TABLE `systempreferences` ( > `variable` varchar(50) NOT NULL DEFAULT '' COMMENT 'system preference name', >- `value` mediumtext DEFAULT NULL COMMENT 'system preference values', >+ `value` mediumtext NOT NULL DEFAULT '' COMMENT 'system preference values', > `options` longtext DEFAULT NULL COMMENT 'options for multiple choice system preferences', > `explanation` mediumtext DEFAULT NULL COMMENT 'descriptive text for the system preference', > `type` varchar(20) DEFAULT NULL COMMENT 'type of question this preference asks (multiple choice, plain text, yes or no, etc)', >diff --git a/installer/data/mysql/mandatory/sysprefs.sql b/installer/data/mysql/mandatory/sysprefs.sql >index f2b6d940cc0..4d62690f4da 100644 >--- a/installer/data/mysql/mandatory/sysprefs.sql >+++ b/installer/data/mysql/mandatory/sysprefs.sql >@@ -194,9 +194,9 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` > ('DebugLevel','2','0|1|2','Define the level of debugging information sent to the browser when errors are encountered (set to 0 in production). 0=none, 1=some, 2=most','Choice'), > ('decreaseLoanHighHolds','0','','Decreases the loan period for items with number of holds above the threshold specified in decreaseLoanHighHoldsValue','YesNo'), > ('decreaseLoanHighHoldsControl', 'static', 'static|dynamic', "Chooses between static and dynamic high holds checking", 'Choice'), >-('decreaseLoanHighHoldsDuration',NULL,'','Specifies a number of days that a loan is reduced to when used in conjunction with decreaseLoanHighHolds','Integer'), >+('decreaseLoanHighHoldsDuration','','','Specifies a number of days that a loan is reduced to when used in conjunction with decreaseLoanHighHolds','Integer'), > ('decreaseLoanHighHoldsIgnoreStatuses', '', 'damaged|itemlost|notforloan|withdrawn', "Ignore items with these statuses for dynamic high holds checking", 'Choice'), >-('decreaseLoanHighHoldsValue',NULL,'','Specifies a threshold for the minimum number of holds needed to trigger a reduction in loan duration (used with decreaseLoanHighHolds)','Integer'), >+('decreaseLoanHighHoldsValue','','','Specifies a threshold for the minimum number of holds needed to trigger a reduction in loan duration (used with decreaseLoanHighHolds)','Integer'), > ('DefaultAuthorityTab','0','0|1|2|3|4|5|6|7|8|9','Default tab to shwo when displaying authorities','Choice'), > ('DefaultClassificationSource','ddc',NULL,'Default classification scheme used by the collection. E.g., Dewey, LCC, etc.','ClassSources'), > ('DefaultCountryField008','','','Fill in the default country code for field 008 Range 15-17 of MARC21 - Place of publication, production, or execution. See <a href=\"http://www.loc.gov/marc/countries/countries_code.html\">MARC Code List for Countries</a>','Free'), >@@ -327,17 +327,17 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` > ('IdRef','0','','Disable/enable the IdRef webservice from the OPAC detail page.','YesNo'), > ('ILLCheckAvailability', 0, '', 'If ON, during the ILL request process third party sources will be checked for current availability', 'YesNo'), > ('ILLDefaultStaffEmail', '', NULL, 'Fallback email address for staff ILL notices to be sent to in the absence of a branch address', 'Free'), >-('ILLHiddenRequestStatuses', NULL, NULL, 'ILL statuses that are considered finished and should not be displayed in the ILL module', 'multiple'), >+('ILLHiddenRequestStatuses', '', NULL, 'ILL statuses that are considered finished and should not be displayed in the ILL module', 'multiple'), > ('ILLHistoryCheck', 0, '', 'If ON, a verification is performed to check if the ILL request has previously been placed by the same patron. Verification is done using one of the following identifier fields: DOI, Pubmed ID or ISBN', 'YesNo'), > ('IllLog', 0, '', 'If ON, log information about ILL requests', 'YesNo'), > ('ILLModule','0','If ON, enables the interlibrary loans module.','','YesNo'), > ('ILLModuleDisclaimerByType','','','YAML defining disclaimer settings for each ILL request type','Textarea'), > ('ILLModuleUnmediated','0','','If enabled, try to immediately progress newly placed ILL requests.','YesNo'), >-('ILLOpacbackends',NULL,NULL,'ILL backends to enabled for OPAC initiated requests','multiple'), >+('ILLOpacbackends','',NULL,'ILL backends to enabled for OPAC initiated requests','multiple'), > ('ILLOpacUnauthenticatedRequest',NULL,NULL,'Can OPAC users place ILL requests without having to be logged in','YesNo'), > ('ILLPartnerCode','IL','','Patrons from this patron category will be used as partners to place ILL requests with','free'), > ('ILLRequestsTabs','','','Add customizable tabs to interlibrary loan requests list','Textarea'), >-('ILLSendStaffNotices', NULL, NULL, 'Send these ILL notices to staff', 'multiple'), >+('ILLSendStaffNotices', '', NULL, 'Send these ILL notices to staff', 'multiple'), > ('ILS-DI','0','','Enables ILS-DI services at OPAC.','YesNo'), > ('ILS-DI:AuthorizedIPs','','Restricts usage of ILS-DI to some IPs','.','Free'), > ('ImageLimit','5','','Limit images stored in the database by the Patron Card image manager to this number.','Integer'), >@@ -390,7 +390,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` > ('LinkerModule','Default','Default|FirstMatch|LastMatch','Chooses which linker module to use (see documentation).','Choice'), > ('LinkerOptions','','','A pipe-separated list of options for the linker.','free'), > ('LinkerRelink','1',NULL,'If ON the authority linker will relink headings that have previously been linked every time it runs.','YesNo'), >-('ListOwnerDesignated', NULL, NULL, 'Designated list owner at patron deletion', 'Free'), >+('ListOwnerDesignated', '', NULL, 'Designated list owner at patron deletion', 'Free'), > ('ListOwnershipUponPatronDeletion', 'delete', 'delete|transfer', 'Defines the action on their public or shared lists when patron is deleted', 'Choice'), > ('LoadCheckoutsTableDelay','0','','Delay before auto-loading checkouts table on checkouts screen','Integer'), > ('LoadSearchHistoryToTheFirstLoggedUser', '1', NULL, 'If ON, the next user will automatically get the last searches in their history', 'YesNo'), >@@ -403,7 +403,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` > ('Mana','2',NULL,'request to Mana Webservice. Mana centralize common information between other Koha to facilitate the creation of new subscriptions, vendors, report queries etc... You can search, share, import and comment the content of Mana.','Choice'), > ('ManaToken','',NULL,'Security token used for authentication on Mana KB service (anti spam)','Textarea'), > ('MARCAuthorityControlField008','|| aca||aabn | a|a d',NULL,'Define the contents of MARC21 authority control field 008 position 06-39','Textarea'), >-('MarcFieldDocURL', NULL, NULL, 'URL used for MARC field documentation. Following substitutions are available: {MARC} = marc flavour, eg. "MARC21" or "UNIMARC". {FIELD} = field number, eg. "000" or "048". {LANG} = user language, eg. "en" or "fi-FI"', 'free'), >+('MarcFieldDocURL', '', NULL, 'URL used for MARC field documentation. Following substitutions are available: {MARC} = marc flavour, eg. "MARC21" or "UNIMARC". {FIELD} = field number, eg. "000" or "048". {LANG} = user language, eg. "en" or "fi-FI"', 'free'), > ('MarcFieldForCreatorId','',NULL,'Where to store the borrowernumber of the record''s creator','Free'), > ('MarcFieldForCreatorName','',NULL,'Where to store the name of the record''s creator','Free'), > ('MarcFieldForModifierId','',NULL,'Where to store the borrowernumber of the record''s last modifier','Free'), >@@ -415,7 +415,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` > ('MARCOverlayRules','0',NULL,'Use the MARC record overlay rules system to decide what actions to take for each field when modifying records.','YesNo'), > ('MarkLostItemsAsReturned','batchmod,moredetail,cronjob,additem,pendingreserves,onpayment','claim_returned|batchmod|moredetail|cronjob|additem|pendingreserves|onpayment','Mark items as returned when flagged as lost','multiple'), > ('MaxComponentRecords', '300', '','Max number of component records to display','Integer'), >-('MaxFine',NULL,'','Maximum fine a patron can have for all late returns at one moment. Single item caps are specified in the circulation rules matrix.','Integer'), >+('MaxFine','','','Maximum fine a patron can have for all late returns at one moment. Single item caps are specified in the circulation rules matrix.','Integer'), > ('maxItemsInSearchResults','20',NULL,'Specify the maximum number of items to display for each result on a page of results','free'), > ('MaxItemsToDisplayForBatchDel','1000',NULL,'Display up to a given number of items in a single item deletionbatch.','Integer'), > ('MaxItemsToDisplayForBatchMod','1000',NULL,'Display up to a given number of items in a single item modification batch.','Integer'), >@@ -577,7 +577,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` > ('OPACSuggestionAutoFill','0',NULL,'Automatically fill OPAC suggestion form with data from Google Books API','YesNo'), > ('OpacSuggestionManagedBy',1,'','Show the name of the staff member who managed a suggestion in OPAC','YesNo'), > ('OPACSuggestionMandatoryFields','title','','Define the mandatory fields for a patron purchase suggestions made via OPAC.','multiple'), >-('OPACSuggestionUnwantedFields',NULL,'','Define the hidden fields for a patron purchase suggestions made via OPAC.','multiple'), >+('OPACSuggestionUnwantedFields','','','Define the hidden fields for a patron purchase suggestions made via OPAC.','multiple'), > ('OpacSuppression','0','','Turn ON the OPAC Suppression feature, requires further setup, ask your system administrator for details','YesNo'), > ('OpacSuppressionByIPRange','','','Restrict the suppression to IP adresses outside of the IP range','free'), > ('OpacSuppressionRedirect','1','Redirect the opac detail page for suppressed records to an explanatory page (otherwise redirect to 404 error page)','','YesNo'), >@@ -682,7 +682,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` > ('RentalFeesCheckoutConfirmation', '0', NULL , 'Allow user to confirm when checking out an item with rental fees.', 'YesNo'), > ('ReplytoDefault','',NULL,'Use this email address as the replyto in emails','Free'), > ('ReportsExportFormatODS',1,NULL,'Show ODS download in Reports','YesNo'), >-('ReportsExportLimit',NULL,NULL,'Limit for report downloads','Integer'), >+('ReportsExportLimit','',NULL,'Limit for report downloads','Integer'), > ('ReportsLog','0',NULL,'If ON, log information about reports.','YesNo'), > ('RequireCashRegister','0',NULL,'Require a cash register when collecting a payment','YesNo'), > ('RequireChoosingExistingAuthority','0',NULL,'Require existing authority selection in controlled fields during cataloging.','YesNo'), >@@ -736,7 +736,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` > ('SeparateHoldingsBranch','homebranch','homebranch|holdingbranch','Branch used to separate holdings','Choice'), > ('SerialsDefaultEmailAddress', '', NULL, 'Default email address used as reply-to for notices sent by the serials module.', 'Free'), > ('SerialsDefaultReplyTo', '', NULL, 'Default email address that serials notices are sent from.', 'Free'), >-('SerialsSearchResultsLimit', NULL, NULL, 'Serials search results limit', 'integer'), >+('SerialsSearchResultsLimit', '', NULL, 'Serials search results limit', 'integer'), > ('SessionRestrictionByIP','1','Check for change in remote IP address for session security. Disable only when remote IP address changes frequently.','','YesNo'), > ('SessionStorage','mysql','mysql|Pg|tmp','Use database or a temporary file for storing session data','Choice'), > ('ShelfBrowserUsesCcode','1','0','Use the item collection code when finding items for the shelf browser.','YesNo'), >-- >2.34.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 40405
: 184129 |
184130
|
184131
|
184205