[Bug 43786] New: Incorrect string concat in templates
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43786 Bug ID: 43786 Summary: Incorrect string concat in templates Initiative type: --- Sponsorship --- status: Product: Koha Version: unspecified Hardware: All OS: All Status: NEW Severity: normal Priority: P5 - low Component: Templates Assignee: oleonard@myacpl.org Reporter: jonathan.druart@gmail.com QA Contact: testopia@bugs.koha-community.org Depends on: 41340 Target Milestone: --- From 41340 comment 12 + >[% tnx( '{count} item modified', '{count} items modified', modified_items_count, { count = modified_items_count }) + ' (' + tnx( 'with {count} field modified', 'with {count} fields modified', modified_fields_count, { count = modified_fields_count }) + ').' | html %]</span String concat with TT is with "_", not "+" [2026/09/30 07:56:36] [WARN] Argument " (" isn't numeric in addition (+) at /kohadevbox/koha/koha-tmpl/intranet-tmpl/prog/en/includes/background_jobs/batch_item_record_modification.inc line 19. [2026/09/30 07:56:36] [WARN] Argument "3 items modified" isn't numeric in addition (+) at /kohadevbox/koha/koha-tmpl/intranet-tmpl/prog/en/includes/background_jobs/batch_item_record_modification.inc line 19. [2026/09/30 07:56:36] [WARN] Argument "with 3 fields modified" isn't numeric in addition (+) at /kohadevbox/koha/koha-tmpl/intranet-tmpl/prog/en/includes/background_jobs/batch_item_record_modification.inc line 19. [2026/09/30 07:56:36] [WARN] Argument ")." isn't numeric in addition (+) at /kohadevbox/koha/koha-tmpl/intranet-tmpl/prog/en/includes/background_jobs/batch_item_record_modification.inc line 19. Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41340 [Bug 41340] Better translatability on 'batch_item_record_modification.inc' -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43786 Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|oleonard@myacpl.org |tomascohen@gmail.com CC| |tomascohen@gmail.com Status|NEW |ASSIGNED -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43786 Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |Needs Signoff Patch complexity|--- |Trivial patch -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43786 --- Comment #1 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- Created attachment 207865 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=207865&action=edit Bug 43786: Fix string concatenation in batch_item_record_modification.inc Bug 41340 introduced the batch item modification report count string using the TT numeric addition operator (+) instead of the string concatenation operator (_). As a result, Template::Toolkit tries to add the strings numerically, emitting "isn't numeric in addition (+)" warnings and rendering only the leading item count instead of the full message. This patch replaces the + operators with _ so the translated strings are concatenated as intended. Test plan: 1. Reproduce the current behavior: $ ktd --shell k$ perl -we 'use Template; my $t=q{[% tnx("{count} item modified","{count} items modified",c,{count=c}) + " (" + tnx("with {count} field modified","with {count} fields modified",f,{count=f}) + ")." %]}; Template->new->process(\$t,{c=>3,f=>3,tnx=>sub{my($s,$p,$n,$h)=@_;my $x=$n==1?$s:$p;$x=~s/\{count\}/$h->{count}/g;$x}},\my $o); print "[$o]\n"' => FAIL: Four "Argument ... isn't numeric in addition (+)" warnings and the render is "[3]" 2. Apply this patch, repeat step 1 using _ instead of + in the template 3. Repeat the render => SUCCESS: No warnings and the render is "[3 items modified (with 3 fields modified).]" 4. Sign off :-D Assisted-by: Claude Sonnet 4.5 (Anthropic) -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43786 Frédéric Demians <f.demians@tamil.fr> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43786 Frédéric Demians <f.demians@tamil.fr> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #207865|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43786 --- Comment #2 from Frédéric Demians <f.demians@tamil.fr> --- Created attachment 207870 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=207870&action=edit Bug 43786: Fix string concatenation in batch_item_record_modification.inc Bug 41340 introduced the batch item modification report count string using the TT numeric addition operator (+) instead of the string concatenation operator (_). As a result, Template::Toolkit tries to add the strings numerically, emitting "isn't numeric in addition (+)" warnings and rendering only the leading item count instead of the full message. This patch replaces the + operators with _ so the translated strings are concatenated as intended. Test plan: 1. Reproduce the current behavior: $ ktd --shell k$ perl -we 'use Template; my $t=q{[% tnx("{count} item modified","{count} items modified",c,{count=c}) + " (" + tnx("with {count} field modified","with {count} fields modified",f,{count=f}) + ")." %]}; Template->new->process(\$t,{c=>3,f=>3,tnx=>sub{my($s,$p,$n,$h)=@_;my $x=$n==1?$s:$p;$x=~s/\{count\}/$h->{count}/g;$x}},\my $o); print "[$o]\n"' => FAIL: Four "Argument ... isn't numeric in addition (+)" warnings and the render is "[3]" 2. Apply this patch, repeat step 1 using _ instead of + in the template 3. Repeat the render => SUCCESS: No warnings and the render is "[3 items modified (with 3 fields modified).]" 4. Sign off :-D Assisted-by: Claude Sonnet 4.5 (Anthropic) Signed-off-by: Frédéric Demians <f.demians@tamil.fr> No more entries in plack-intranet-error.log Item report OK -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43786 Lisette Scheer <lisette@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- QA Contact|testopia@bugs.koha-communit |martin.renvoize@openfifth.c |y.org |o.uk -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org