Main Koha release repository https://koha-community.org
Find a file
Nick Clemens 254f721320
Bug 29012: Fix existing update to prevent inserting incorrect data
Both updates now rely on 'suspension_chargeperiod' as the source of truth
for existence of a rule. Spot checking some existing production databases this
seems to be acceptable.

This alters the update to only add rules where a 'suspension_chargeperiod' rule exists
and a value for the rule is not already set.

NOTE: While the table has a unique key:
UNIQUE KEY `branchcode` (`branchcode`,`categorycode`,`itemtype`,`rule_name`),

This key doesn't prevent duplicates on NULLs, i.e.:

branchcode  | categorycode  | itemtype  | rule_name                 | rule_value
NULL        | NULL          | BK        | unseen_renewals_allowed   | 1
NULL        | NULL          | BK        | unseen_renewals_allowed   | 2
NULL        | NULL          | BK        | unseen_renewals_allowed   | 3

So we need to both check that any rule is present and that the specific rule is not.
The 'INSERT IGNORE' won't IGNORE existing values except for the most specific rules

Test plan:
 0 - Edit and save existing default rule in DB (sample data does not include suspension_chargeperiod)
 1 - Set some rules for "Default checkout, hold and return policy" for "Standard rule" and some specific libraries
 2 - cp installer/data/mysql/db_revs/220600024.pl installer/data/mysql/atomicupdate/
 3 - SELECT * FROM circulation rules, note the number of rules that exist
 4 - updatedatabase
 5 - Check the DB again, you should now have rules as described in the bug
     i.e. You will have 5 new rules per 'Default checkout, hold and return policy'
 6 - apply 1st patch on bug
 7 - rm installer/data/mysql/atomicupdate/220600024.pl (so we don't add again)
 8 - updatedatabase
 9 - Check DB, the extra rules have been deleted
10 - Apply 2nd patch
11 - cp installer/data/mysql/db_revs/220600024.pl installer/data/mysql/atomicupdate/
12 - rm installer/data/mysql/atomicupdate/bug_31727.pl (so we can confirm update isn't adding rules)
13 - updatedatabase
14 - Confirm no change in rules since step 9
15 - git reset --hard (get deleted update back)
16 - rm installer/data/mysql/atomicupdate/220600024.pl

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-10-20 09:53:45 -03:00
acqui Bug 31569: Remove unecessary imports 2022-10-17 08:14:57 -03:00
admin Bug 31785: (follow-up) Fix modify operation too 2022-10-14 15:47:57 -03:00
api Bug 31555: change holds GET permission to place_holds 2022-10-11 10:49:18 -03:00
authorities Bug 29333: Fix encoding of imported UNIMARC authorities 2022-07-08 15:43:33 -03:00
basket Bug 31309: Remove GetItemsInfo from basket/sendbasket 2022-08-16 09:22:14 -03:00
bin
C4 Bug 31626: Add letter id to the message queue table 2022-10-18 09:41:41 -03:00
catalogue Bug 31252: Advanced search in staff interface should call barcodedecode if the search index is a barcode 2022-10-17 15:10:22 -03:00
cataloguing Bug 31162: Add a cataloging module home page 2022-10-18 10:20:58 -03:00
circ Bug 25426: Allow return policy to be selected via syspref and not just home library 2022-10-18 09:14:52 -03:00
clubs Bug 30718: Use flatpickr's altInput 2022-08-19 08:26:31 -03:00
course_reserves Bug 30409: barcodedecode() should always trim barcode 2022-06-14 07:54:58 -03:00
debian Bug 27315: use the namespace-aware docbook stylesheet 2022-10-17 21:10:06 -03:00
docs Bug 30808: Add the 22.05 release team. 2022-05-25 23:56:12 -10:00
errors Bug 29420: HTTP status code incorrect when calling error pages directly under Plack/PSGI 2022-04-20 09:03:39 -10:00
etc Bug 31469: log4perl.conf: Add %n to conversionpattern for Plack 2022-10-12 14:58:40 -03:00
ill Bug 28909: Allow illview to use backend template 2022-08-09 13:21:39 -03:00
installer Bug 29012: Fix existing update to prevent inserting incorrect data 2022-10-20 09:53:45 -03:00
Koha Bug 31162: (QA follow-up) Use new WRAPPPERs and fix help link 2022-10-18 10:21:03 -03:00
koha-tmpl Bug 31417: Update and reference cat-menu.inc 2022-10-18 10:28:34 -03:00
labels Bug 31633: (follow-up) Group template params 2022-10-03 14:09:59 -03:00
lib/CGI/Session/Serialize
members Bug 31562: Treat flags as other borrower fields 2022-09-22 09:24:41 -03:00
misc Bug 27265: (QA follow-up) Typo on L99 cron script 2022-10-17 21:11:41 -03:00
offline_circ Bug 30016: Remove GetOpenIssue subroutine 2022-08-31 08:50:37 -03:00
opac Bug 14783: (QA follow-up) Rename method and move tests 2022-10-17 15:43:22 -03:00
patron_lists Bug 16446: Add ability to add patrons to list by borrowernumber 2021-10-21 12:24:04 +02:00
patroncards Bug 24001: Fix patron card template edition 2022-04-28 10:49:20 -10:00
plugins Bug 29787: Add plugin version to plugin search results 2022-04-08 15:49:15 +02:00
pos Bug 30619: Add email receipt to POS 2022-09-07 15:59:34 -07:00
recalls Bug 30924: Add missing branchtransfers.reason value for recall cancellation 2022-06-13 10:30:51 -03:00
reports Bug 28967: Patrons with no checkouts report shows patrons from other libraries with IndependentBranches 2022-10-17 08:10:59 -03:00
reserve Bug 31575: Missing warning for holds where AllowHoldPolicyOverride can be used to force a hold to be placed 2022-10-11 10:12:35 -03:00
reviews
rotating_collections
serials Bug 29608: Made so doesn't require full permission 2022-09-07 13:49:53 -07:00
services
skel
suggestion Bug 30718: Use flatpickr's altInput 2022-08-19 08:26:31 -03:00
svc Bug 31682: Silence automatic linker warn 2022-10-11 10:41:23 -03:00
t Bug 31626: Add letter id to the message queue table 2022-10-18 09:41:41 -03:00
tags Bug 30718: Use flatpickr's altInput 2022-08-19 08:26:31 -03:00
tmp/modified_authorities
tools Bug 31590: Remove Text::CSV::Unicode 2022-09-21 16:07:21 -03:00
virtualshelves Bug 31320: Remove GetItemsInfo from virtualshelves/sendshelf.pl 2022-08-16 09:23:25 -03:00
xt Bug 31590: Remove Text::CSV::Unicode 2022-09-21 16:07:21 -03:00
.editorconfig Bug 27375: Set YAML file settings in .editorconfig 2021-11-03 15:40:52 +01:00
.eslintrc.json
.gitignore
.htaccess
.mailmap 22.05.00: Update mailmap 2022-05-25 23:56:12 -10:00
.perlcriticrc
.proverc.dist Bug 19821: Install sample data, ES mappings and Version syspref 2021-10-25 11:27:40 +02:00
.stylelintrc.json Bug 31528: (follow-up) A few additional rules 2022-10-03 08:23:15 -03:00
about.pl Bug 29744: (QA follow-up) Call psgi_env in OO style 2022-09-22 08:11:58 -03:00
app.psgi
changelanguage.pl
cpanfile Bug 31590: Remove Text::CSV::Unicode 2022-09-21 16:07:21 -03:00
fix-perl-path.PL
gulpfile.js Bug 30373: Enable translation of UNIMARC frameworks 2022-04-21 13:41:35 -10:00
help.pl
INSTALL
Koha.pm Bug 31626: DBRev 22.06.00.066 2022-10-18 09:54:08 -03:00
koha_perl_deps.pl
kohaversion.pl
LICENSE
mainpage.pl Bug 30650: Add filter_by_scheduled_today 2022-07-29 15:00:47 -03:00
Makefile.PL Bug 19532: Database and installer stuff 2022-03-14 22:45:50 -10:00
MANIFEST.SKIP
package.json Bug 31528: Replace scss-lint configuration with one for stylelint 2022-10-03 08:23:14 -03:00
README
README.md
README.robots
rewrite-config.PL
yarn.lock Bug 31528: Replace scss-lint configuration with one for stylelint 2022-10-03 08:23:14 -03:00

Koha is a free software integrated library system (ILS).

Koha is distributed under the GNU GPL version 3 or later.

Note: Koha does not accept pull requests from git hosting sites.

Note: This project has its own bug tracker, to report a bug or submit a patch visit http://bugs.koha-community.org.

For guidelines on submitting patches for Koha please visit https://wiki.koha-community.org/wiki/SubmitingAPatch

The developers handbook can be found at https://wiki.koha-community.org/wiki/Developer_handbook

http://koha-community.org/

Koha Logo