[Koha-bugs] [Bug 31727] New: Orphan records in circulation_rules and false positives after attempt to fix values to be empty or zeroes instead of missing
bugzilla-daemon at bugs.koha-community.org
bugzilla-daemon at bugs.koha-community.org
Mon Oct 10 18:08:18 CEST 2022
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31727
Bug ID: 31727
Summary: Orphan records in circulation_rules and false
positives after attempt to fix values to be empty or
zeroes instead of missing
Change sponsored?: ---
Product: Koha
Version: master
Hardware: All
OS: All
Status: NEW
Severity: critical
Priority: P5 - low
Component: Circulation
Assignee: koha-bugs at lists.koha-community.org
Reporter: nugged at gmail.com
QA Contact: testopia at bugs.koha-community.org
CC: gmcharlt at gmail.com, kyle.m.hall at gmail.com
Blocks: 29012
On smart-rules.pl (Home > Administration > Circulation and fine rules):
we have 5 tables:
1. Defining circulation and fine rules for all libraries
(... for XXX branch, if branch selected)
2. Default checkout, hold and return policy
(... for XXX branch, if branch selected)
3. Checkout, hold policy by patron category
(... for XXX branch, if branch selected)
4. Lost item fee refund on return policy
(... for XXX branch, if branch selected)
5. Holds policy by item type
(... for XXX branch, if branch selected)
and with dropdown, we can select rules for "Standard rules for all libraries"
or switch to ANY of the available branches represented by the whole page.
Attempt to fix missing values in Bug 29012 had the atomic update, which filled
up the circulation_rules table with values if ANY combination of
"branch+category+itemtype" was found in the circulation_rules table. This had
false positives for items from above-mentioned table 2,3,4,5 when assumed that
only key/value pairs from table 1 should be those which affect the decision to
add or not" new empty or zeroed item.
This made the problem: after this atomic update, we have the circulation_rules
table randomly filled with orphan elements for "table 1" even if no rules in
table 1 for that branch were present in real.
Worse: those orphan items are never shown as rows of real rules for the
operator so not visible.
Bad: those orphan items, for example, "issuelength" of 0 when it has some
BRANCH overlaps ANY rule without branches and discretely changes behavior when
issuing items.
EXAMPLE:
- Open smart-rules.pl and choose in the first dropdown "Select a library : "
some BRANCH_NAME so this page will reload into BRANCH_NAME-targeted mode for
the whole page.
- Edit the last (5th) table "Holds policy by item type for BRANCH_NAME" value
holdallowed to be set into something, and save it. You will see / still have
"table 1" empty.
- make the atomic update from Bug 29012 to fill those "zeroes and empties"
- check the smart-rules.pl page for BRANCH_NAME-targeted mode: there will be
still no rules in the 1st, "Defining circulation and fine rules for XXX branch"
table,
- but now check the database in raw mode: you will see that there will be a
record: BRANCH_NAME will have, for example, "issuelength" of 0 key/value pair.
- OUCH!
What to fix:
Now we need to invent a new atomic update to be applied after this one (and
this is very non-trivial because we somehow need to preserve other proper
values), to fix the database from orphan values. This anyway can lead to very
unpredictable results.
Another thing to consider is that we should even if unsure what is orphans - is
to reveal all hidden values, i.e. append and populate other values to make a
"full row" appear for the operator in the interface, so at least human can SEE
wrong with those rules and then decide/delete but make impossible to have
"remnants" and orphans hidden.
PROBLEM 2:
unseen_renewals_allowed
vs
unseenrenewalsallowed
(sic!)
we have 'unseen_renewals_allowed' everywhere in the codebase, except in this
atomic update we have 'unseenrenewalsallowed'. And now DB is polluted even more
:).
This also should be fixed - and more: we might now have unseen_renewals_allowed
and unseenrenewalsallowed both in database.
Referenced Bugs:
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29012
[Bug 29012] Some rules are not saved when left blank while editing a 'rule'
line in smart-rules.pl
--
You are receiving this mail because:
You are watching all bug changes.
You are the assignee for the bug.
More information about the Koha-bugs
mailing list