Bugzilla – Attachment 191873 Details for
Bug 10190
Overdue notice triggers based on item type
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 10190: (follow-up) Complete Vue.js rewrite of Circulation Triggers administration interface
Bug-10190-follow-up-Complete-Vuejs-rewrite-of-Circ.patch (text/plain), 13.58 KB, created by
ChloƩ Zermatten
on 2026-01-22 15:57:06 UTC
(
hide
)
Description:
Bug 10190: (follow-up) Complete Vue.js rewrite of Circulation Triggers administration interface
Filename:
MIME Type:
Creator:
ChloƩ Zermatten
Created:
2026-01-22 15:57:06 UTC
Size:
13.58 KB
patch
obsolete
>From e4d112773a36cc3a8a76fe062b988821f58b4fc6 Mon Sep 17 00:00:00 2001 >From: Chloe Zermatten <chloe.zermatten@openfifth.co.uk> >Date: Fri, 7 Nov 2025 12:03:26 +0000 >Subject: [PATCH] Bug 10190: (follow-up) Complete Vue.js rewrite of Circulation > Triggers administration interface > >This patch aims to resolve the following issues as reported by comment 193: > >- missing atomic update for overde_X_has_rules (amended to account for comment 227) >- existing delays being overwritten by the client when a rule set is displayed >- inability to save circulation overdue rule sets for context for which circulations rules where already set >- address bug_10190.pl db script warnings (undef values were being concatenated with strings) >- add a guard clause to bug_101090.pl: check that the tables the script pulls the data from do still exist, otherwise exit. >--- > .../data/mysql/atomicupdate/bug_10190.pl | 90 +++++++++++++++++-- > .../CirculationTriggersFormAdd.vue | 26 +++--- > .../prog/js/vue/stores/circulation-rules.js | 5 +- > 3 files changed, 100 insertions(+), 21 deletions(-) > >diff --git a/installer/data/mysql/atomicupdate/bug_10190.pl b/installer/data/mysql/atomicupdate/bug_10190.pl >index d9494d3ec0c..285c093d092 100644 >--- a/installer/data/mysql/atomicupdate/bug_10190.pl >+++ b/installer/data/mysql/atomicupdate/bug_10190.pl >@@ -8,6 +8,11 @@ return { > my ($args) = @_; > my ( $dbh, $out ) = @$args{qw(dbh out)}; > >+ # This script first pulls data from these tables, then deletes them. -> Do not run if they do not exist. >+ if ( !TableExists('overduerules_transport_types') || !TableExists('overduerules') ) { >+ exit; >+ } >+ > # Populate empty overduerules table for missing categories > $dbh->do( > q| >@@ -150,12 +155,20 @@ return { > my $branchcode_key = $branchcode // ''; > foreach my $i ( 1 .. 3 ) { > >+ my $has_rules = 0; >+ > # Insert the delay rule for group $i, skipping if it matches the most frequent delay > if ( my $delay = $rule->{"delay$i"} ) { > $delay ||= ''; > unless ( $delay eq $most_frequent_delay{$branchcode_key}{$i} ) { > $delay ||= undef; >- say $out "Inserting $branchcode:$categorycode:$itemtype overdue_$i" . '_delay: ' . $delay; >+ say $out "Inserting " >+ . ( $branchcode // '' ) . ":" >+ . ( $categorycode // '' ) . ':' >+ . ( $itemtype // '' ) >+ . " overdue_$i" >+ . '_delay: ' >+ . ( $delay // '' ); > $insert->execute( > $branchcode, > $categorycode, >@@ -163,13 +176,20 @@ return { > "overdue_$i" . '_delay', > $delay > ); >+ $has_rules = 1; > } > } > > # Insert the notice rule for group $i, skipping if it matches the most frequent notice > if ( my $notice = $rule->{"letter$i"} ) { > unless ( $notice eq $most_frequent_notice{$branchcode_key}{$i} ) { >- say $out "Inserting $branchcode:$categorycode:$itemtype overdue_$i" . '_notice: ' . $notice; >+ say $out "Inserting " >+ . ( $branchcode // '' ) . ":" >+ . ( $categorycode // '' ) . ':' >+ . ( $itemtype // '' ) >+ . " overdue_$i" >+ . '_notice: ' >+ . ( $notice // '' ); > $insert->execute( > $branchcode, > $categorycode, >@@ -177,13 +197,20 @@ return { > "overdue_$i" . '_notice', > $notice > ); >+ $has_rules = 1; > } > } > > # Insert the message transport type rule for group $i, skipping if it matches the most frequent mtt > if ( my $mtt = $rule->{"message_transport_type_$i"} ) { > unless ( $mtt eq $most_frequent_mtt{$branchcode_key}{$i} ) { >- say $out "Inserting $branchcode:$categorycode:$itemtype overdue_$i" . '_mtt: ' . $mtt; >+ say $out "Inserting " >+ . ( $branchcode // '' ) . ":" >+ . ( $categorycode // '' ) . ':' >+ . ( $itemtype // '' ) >+ . " overdue_$i" >+ . '_mtt: ' >+ . ( $mtt // '' ); > $insert->execute( > $branchcode, > $categorycode, >@@ -191,13 +218,20 @@ return { > "overdue_$i" . '_mtt', > $mtt > ); >+ $has_rules = 1; > } > } > > # Insert the restrict rule for group $i > if ( my $restrict = $rule->{"debarred$i"} ) { > unless ( $restrict eq $most_frequent_restrict{$branchcode_key}{$i} ) { >- say $out "Inserting $branchcode:$categorycode:$itemtype overdue_$i" . '_restrict: ' . $restrict; >+ say $out "Inserting " >+ . ( $branchcode // '' ) . ":" >+ . ( $categorycode // '' ) . ':' >+ . ( $itemtype // '' ) >+ . " overdue_$i" >+ . '_restrict: ' >+ . ( $restrict // '' ); > $insert->execute( > $branchcode, > $categorycode, >@@ -205,8 +239,26 @@ return { > "overdue_$i" . '_restrict', > $restrict > ); >+ $has_rules = 1; > } > } >+ >+ # Insert the has_rules rule for group $i if and only if a rule set has been added into the db for this context. >+ if ( $has_rules == 1 ) { >+ say $out "Inserting " >+ . ( $branchcode // '' ) . ":" >+ . ( $categorycode // '' ) . ':' >+ . ( $itemtype // '' ) >+ . " overdue_$i" >+ . "has_rules: 1"; >+ $insert->execute( >+ $branchcode, >+ $categorycode, >+ $itemtype, >+ "overdue_$i" . '_has_rules', >+ 1 >+ ); >+ } > } > } > >@@ -215,7 +267,11 @@ return { > my $branchcode_value = $branchcode || undef; > foreach my $i ( 1 .. 3 ) { > my $most_frequent_delay = $most_frequent_delay{$branchcode}{$i}; >- say $out "Inserting $branchcode_value:undef:$itemtype default most frequent delay for overdue_$i: " >+ say $out "Inserting " >+ . ( $branchcode_value // '' ) >+ . ":undef:" >+ . ( $itemtype // '' ) >+ . " default most frequent delay for overdue_$i: " > . $most_frequent_delay; > $insert->execute( > $branchcode_value, >@@ -226,7 +282,9 @@ return { > ); > > my $most_frequent_notice = $most_frequent_notice{$branchcode}{$i}; >- say $out "Inserting $branchcode_value:undef:undef default most frequent notice for overdue_$i: " >+ say $out "Inserting " >+ . ( $branchcode_value // '' ) >+ . ":undef:undef default most frequent notice for overdue_$i: " > . $most_frequent_notice; > $insert->execute( > $branchcode_value, >@@ -237,7 +295,9 @@ return { > ); > > my $most_frequent_mtt = $most_frequent_mtt{$branchcode}{$i}; >- say $out "Inserting $branchcode_value:undef:undef default most frequent mtt for overdue_$i: " >+ say $out "Inserting " >+ . ( $branchcode_value // '' ) >+ . ":undef:undef default most frequent mtt for overdue_$i: " > . $most_frequent_mtt; > $insert->execute( > $branchcode_value, >@@ -248,7 +308,9 @@ return { > ); > > my $most_frequent_restrict = $most_frequent_restrict{$branchcode}{$i}; >- say $out "Inserting $branchcode_value:undef:undef default most frequent restrict for overdue_$i: " >+ say $out "Inserting " >+ . ( $branchcode_value // '' ) >+ . ":undef:undef default most frequent restrict for overdue_$i: " > . $most_frequent_restrict; > $insert->execute( > $branchcode_value, >@@ -258,6 +320,18 @@ return { > $most_frequent_restrict > ); > >+ # Insert the has_rules rule for group $i's default context >+ say $out "Inserting " >+ . ( $branchcode_value // '' ) >+ . ":undef:undef default has_rules for overdue_$i: 1"; >+ $insert->execute( >+ $branchcode_value, >+ undef, >+ undef, >+ "overdue_${i}_has_rules", >+ 1 >+ ); >+ > } > } > >diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Admin/CirculationTriggers/CirculationTriggersFormAdd.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/Admin/CirculationTriggers/CirculationTriggersFormAdd.vue >index 136fd55a0ee..87f2978f91b 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Admin/CirculationTriggers/CirculationTriggersFormAdd.vue >+++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/Admin/CirculationTriggers/CirculationTriggersFormAdd.vue >@@ -638,7 +638,7 @@ export default { > if (this.ruleSetToSubmit === null) { > this.ruleSetToSubmit = { > context: this.context, >- [`overdue_${this.triggerNumber}_delay`]: this.minDelay, >+ [`overdue_${this.triggerNumber}_delay`]: `${this.minDelay}`, > [`overdue_${this.triggerNumber}_notice`]: null, > [`overdue_${this.triggerNumber}_mtt`]: null, > [`overdue_${this.triggerNumber}_restrict`]: null, >@@ -742,8 +742,6 @@ export default { > this.currentRuleSet[`overdue_${priorTriggerNumber}_delay`] > ) + 1 > : 0; >- this.ruleSetToSubmit[`overdue_${this.triggerNumber}_delay`] = >- this.minDelay; > }, > setMaxDelay() { > const nextTriggerNumber = parseInt(this.triggerNumber) + 1; >@@ -791,16 +789,18 @@ export default { > null > ) { > this.ruleSetToSubmit[`overdue_${this.triggerNumber}_delay`] = >- min; >+ `${min}`; > } > > // Increment within the valid range > else { > this.ruleSetToSubmit[`overdue_${this.triggerNumber}_delay`] = > Math.min( >- this.ruleSetToSubmit[ >- `overdue_${this.triggerNumber}_delay` >- ] + 1, >+ parseInt( >+ this.ruleSetToSubmit[ >+ `overdue_${this.triggerNumber}_delay` >+ ] >+ ) + 1, > max > ); > } >@@ -809,12 +809,14 @@ export default { > decrementDelay() { > // Check for minDelay > const min = this.minDelay !== undefined ? this.minDelay : 1; >+ let delay = parseInt( >+ this.ruleSetToSubmit[`overdue_${this.triggerNumber}_delay`] >+ ); > // Decrement only if greater than minDelay >- if ( >- this.ruleSetToSubmit[`overdue_${this.triggerNumber}_delay`] > >- min >- ) { >- this.ruleSetToSubmit[`overdue_${this.triggerNumber}_delay`]--; >+ if (delay > min) { >+ delay--; >+ this.ruleSetToSubmit[`overdue_${this.triggerNumber}_delay`] = >+ `${delay}`; > } > this.setAllowSubmission(); > }, >diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/stores/circulation-rules.js b/koha-tmpl/intranet-tmpl/prog/js/vue/stores/circulation-rules.js >index 351033c088d..cf1004f2e35 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/vue/stores/circulation-rules.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/vue/stores/circulation-rules.js >@@ -87,7 +87,10 @@ export const useCircRulesStore = defineStore("circRules", { > return value.includes(type) ? $__("Yes") : $__("No"); > }, > hasConflict(oldRuleSet, newRuleSet, triggerNumber) { >- if (!oldRuleSet) { >+ if ( >+ !oldRuleSet || >+ oldRuleSet[`overdue_${triggerNumber}_has_rules`] === null >+ ) { > return false; > } > return ( >-- >2.39.5
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 10190
:
170357
|
170358
|
170359
|
170360
|
170361
|
170362
|
170363
|
170364
|
170365
|
170366
|
170367
|
170368
|
170369
|
170370
|
170371
|
170372
|
170373
|
170374
|
170375
|
170376
|
170380
|
170449
|
171727
|
171728
|
171729
|
171730
|
171731
|
171732
|
171733
|
171734
|
171735
|
171736
|
171737
|
171738
|
171739
|
171740
|
171741
|
171742
|
171743
|
171744
|
171745
|
171746
|
171747
|
171748
|
171749
|
171750
|
171751
|
171752
|
171753
|
171754
|
171755
|
172588
|
172589
|
172590
|
172591
|
172592
|
172593
|
172594
|
172595
|
172596
|
172597
|
172598
|
172599
|
172600
|
172601
|
172602
|
172603
|
172604
|
172605
|
172606
|
172607
|
172608
|
172609
|
172612
|
172614
|
172617
|
172619
|
172621
|
172622
|
172623
|
172624
|
172625
|
172626
|
172630
|
172631
|
172632
|
172633
|
172634
|
172635
|
172636
|
172637
|
172638
|
172639
|
172640
|
172641
|
172642
|
172643
|
172644
|
172645
|
172646
|
172647
|
172648
|
172649
|
172650
|
172651
|
172652
|
172653
|
172654
|
172655
|
172656
|
172657
|
172658
|
172659
|
172660
|
172661
|
172662
|
172663
|
178643
|
178644
|
178645
|
178646
|
178647
|
178648
|
178649
|
178650
|
178651
|
178652
|
178653
|
178654
|
178655
|
178656
|
178657
|
178658
|
178659
|
178660
|
178661
|
178662
|
178663
|
178664
|
178665
|
178666
|
178667
|
178668
|
178669
|
178670
|
178671
|
178672
|
178673
|
178674
|
178675
|
188075
|
188076
|
188077
|
188078
|
188079
|
188080
|
188081
|
188082
|
188083
|
188084
|
188085
|
188086
|
188087
|
188088
|
188476
|
189345
|
189863
|
189864
|
189865
|
189866
|
189867
|
189868
|
191749
|
191750
|
191751
|
191752
|
191753
|
191754
|
191755
|
191756
|
191757
|
191758
|
191759
|
191760
|
191761
|
191762
|
191763
|
191795
|
191796
|
191805
|
191854
|
191873
|
192871
|
192872
|
192873
|
192874
|
192875
|
192876
|
192877
|
192878
|
192879
|
192880
|
192881
|
192882
|
192883
|
192884
|
192885
|
192886
|
192887
|
192888
|
192889
|
192890
|
192891
|
192892
|
192893
|
192894
|
192895
|
192896
|
192897
|
192898
|
192899