Bugzilla – Attachment 189482 Details for
Bug 40445
Point of Sale reconciliation input during daily summaries
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 40445: Add authorized value support for reconciliation notes
Bug-40445-Add-authorized-value-support-for-reconci.patch (text/plain), 10.57 KB, created by
Martin Renvoize (ashimema)
on 2025-11-11 07:40:09 UTC
(
hide
)
Description:
Bug 40445: Add authorized value support for reconciliation notes
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2025-11-11 07:40:09 UTC
Size:
10.57 KB
patch
obsolete
>From e3c38990083cb5240973f30197d12aabfd888c8d Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@openfifth.co.uk> >Date: Tue, 11 Nov 2025 07:03:18 +0000 >Subject: [PATCH] Bug 40445: Add authorized value support for reconciliation > notes > >This patch adds the ability to restrict reconciliation notes to a >predefined list of authorized values for standardization and consistency. > >A new system preference `CashupReconciliationNoteAuthorisedValue` allows >administrators to specify an authorized value category for the note >dropdown. If not configured, a free text textarea is used instead. > >Test plan: >1. Create authorized value category (e.g., CASHUP_NOTE) with values > like "Till count error", "Cash removed", "Foreign currency", etc. >2. Set CashupReconciliationNoteAuthorisedValue to CASHUP_NOTE >3. Perform cashup - note field should be dropdown with AV options >4. Clear preference - note field should revert to textarea >5. Verify notes are saved correctly in both modes >--- > ...45_reconciliation_note_authorized_value.pl | 31 ++++++++++++++++++ > installer/data/mysql/mandatory/sysprefs.sql | 1 + > .../modules/admin/preferences/accounting.pref | 4 +++ > .../prog/en/modules/pos/register.tt | 32 ++++++++++++++++--- > .../intranet-tmpl/prog/js/cashup_modal.js | 12 ++++++- > pos/register.pl | 12 +++++++ > 6 files changed, 86 insertions(+), 6 deletions(-) > create mode 100644 installer/data/mysql/atomicupdate/bug_40445_reconciliation_note_authorized_value.pl > >diff --git a/installer/data/mysql/atomicupdate/bug_40445_reconciliation_note_authorized_value.pl b/installer/data/mysql/atomicupdate/bug_40445_reconciliation_note_authorized_value.pl >new file mode 100644 >index 00000000000..06519b00388 >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_40445_reconciliation_note_authorized_value.pl >@@ -0,0 +1,31 @@ >+use Modern::Perl; >+use Koha::Installer::Output qw(say_warning say_success say_info); >+ >+return { >+ bug_number => "40445", >+ description => "Add system preference for cashup reconciliation note authorized values", >+ up => sub { >+ my ($args) = @_; >+ my ( $dbh, $out ) = @$args{qw(dbh out)}; >+ >+ # Add CashupReconciliationNoteAuthorisedValue preference >+ $dbh->do( >+ q{ >+ INSERT IGNORE INTO systempreferences (variable, value, options, explanation, type) >+ VALUES ( >+ 'CashupReconciliationNoteAuthorisedValue', >+ '', >+ '', >+ 'Authorized value category to use for cashup reconciliation notes (leave empty for free text)', >+ 'Free' >+ ) >+ } >+ ); >+ >+ say_success( $out, "Added CashupReconciliationNoteAuthorisedValue system preference" ); >+ say_info( >+ $out, >+ "CashupReconciliationNoteAuthorisedValue: Optionally restrict reconciliation notes to authorized values" >+ ); >+ }, >+}; >diff --git a/installer/data/mysql/mandatory/sysprefs.sql b/installer/data/mysql/mandatory/sysprefs.sql >index 0d4abc85c55..5576abf5a69 100644 >--- a/installer/data/mysql/mandatory/sysprefs.sql >+++ b/installer/data/mysql/mandatory/sysprefs.sql >@@ -150,6 +150,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` > ('casLogout','0','','Does a logout from Koha should also log the user out of CAS?','YesNo'), > ('casServerUrl','https://localhost:8443/cas','','URL of the cas server','Free'), > ('casServerVersion','2', '2|3','Version of the CAS server Koha will connect to.','Choice'), >+('CashupReconciliationNoteAuthorisedValue', '', NULL, 'Authorized value category to use for cashup reconciliation notes (leave empty for free text)', 'Free'), > ('CashupReconciliationNoteRequired', '0', NULL, 'Require a reconciliation note when completing cashup with discrepancies between expected and actual amounts', 'YesNo'), > ('CatalogConcerns', '0', NULL, 'Allow users to report catalog concerns', 'YesNo'), > ('CatalogerEmails', '', '', 'Notify these catalogers by email when a catalog concern is submitted', 'free'), >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/accounting.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/accounting.pref >index 37046e4aa75..627ca5a800f 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/accounting.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/accounting.pref >@@ -63,3 +63,7 @@ Accounting: > 1: "Require" > 0: "Don't require" > - a reconciliation note when completing cashup with discrepancies between expected and actual amounts. >+ - >+ - "Use authorized value category " >+ - pref: CashupReconciliationNoteAuthorisedValue >+ - " for reconciliation notes during cashup. Leave empty to allow free text entry." >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/pos/register.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/pos/register.tt >index 00392774f33..c7b29b96845 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/pos/register.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/pos/register.tt >@@ -469,12 +469,24 @@ > <span id="reconciliation_text"></span> > </li> > <li id="reconciliation_note_field" style="display: none;"> >- <label for="reconciliation_note" id="reconciliation_note_label">Note (optional):</label> >- <textarea id="reconciliation_note" name="reconciliation_note" rows="3" cols="40" maxlength="1000" placeholder="Enter a note explaining the surplus or deficit..."></textarea> >- [% IF reconciliation_note_required %] >- <span class="required">Required</span> >+ <label for="reconciliation_note" id="reconciliation_note_label">Note:</label> >+ [% IF reconciliation_note_avs %] >+ <select id="reconciliation_note" name="reconciliation_note"> >+ <option value="">-- Select a reason --</option> >+ [% FOREACH av IN reconciliation_note_avs %] >+ <option value="[% av.authorised_value | html %]">[% av.lib | html %]</option> >+ [% END %] >+ </select> >+ [% IF reconciliation_note_required %] >+ <span class="required">Required</span> >+ [% END %] >+ [% ELSE %] >+ <textarea id="reconciliation_note" name="reconciliation_note" rows="3" cols="40" maxlength="1000" placeholder="Enter a note explaining the surplus or deficit..."></textarea> >+ [% IF reconciliation_note_required %] >+ <span class="required">Required</span> >+ [% END %] >+ <div class="hint">Maximum 1000 characters</div> > [% END %] >- <div class="hint">Maximum 1000 characters</div> > </li> > </ol> > </fieldset> >@@ -584,6 +596,16 @@ > [% INCLUDE 'datatables.inc' %] > [% INCLUDE 'format_price.inc' %] > [% INCLUDE 'js-date-format.inc' %] >+ <script> >+ // Map of authorized value codes to descriptions for reconciliation notes >+ var reconciliation_note_avs = { >+ [% IF reconciliation_note_avs %] >+ [% FOREACH av IN reconciliation_note_avs %] >+ "[% av.authorised_value | html %]": "[% av.lib | html %]"[% UNLESS loop.last %],[% END %] >+ [% END %] >+ [% END %] >+ }; >+ </script> > [% Asset.js("js/cashup_modal.js") | $raw %] > [% Asset.js("js/modal_printer.js") | $raw %] > [% INCLUDE 'calendar.inc' %] >diff --git a/koha-tmpl/intranet-tmpl/prog/js/cashup_modal.js b/koha-tmpl/intranet-tmpl/prog/js/cashup_modal.js >index 9f57c77e1a7..11d00e034ca 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/cashup_modal.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/cashup_modal.js >@@ -198,13 +198,23 @@ $(document).ready(function () { > > // Add note if present > if (reconciliationNote) { >+ // Check if note is an authorized value code and use description if available >+ var noteDisplay = reconciliationNote; >+ if ( >+ typeof reconciliation_note_avs !== "undefined" && >+ reconciliation_note_avs[reconciliationNote] >+ ) { >+ noteDisplay = >+ reconciliation_note_avs[reconciliationNote]; >+ } >+ > tfoot.append( > "<tr class='" + > reconciliationClass + > "'><td colspan='2'><em>" + > __("Note:") + > " " + >- escape_str(reconciliationNote) + >+ escape_str(noteDisplay) + > "</em></td></tr>" > ); > } >diff --git a/pos/register.pl b/pos/register.pl >index 183d9b27d52..a0752689c37 100755 >--- a/pos/register.pl >+++ b/pos/register.pl >@@ -67,10 +67,22 @@ if ( !$registers->count ) { > my $accountlines = $cash_register->outstanding_accountlines(); > my $cashup_in_progress = $cash_register->cashup_in_progress(); > >+ # Get authorized values for reconciliation notes if configured >+ my $note_av_category = C4::Context->preference('CashupReconciliationNoteAuthorisedValue'); >+ my $reconciliation_note_avs; >+ if ($note_av_category) { >+ require Koha::AuthorisedValues; >+ $reconciliation_note_avs = Koha::AuthorisedValues->search( >+ { category => $note_av_category }, >+ { order_by => { '-asc' => 'lib' } } >+ ); >+ } >+ > $template->param( > register => $cash_register, > accountlines => $accountlines, > cashup_in_progress => $cashup_in_progress, >+ reconciliation_note_avs => $reconciliation_note_avs, > reconciliation_note_required => C4::Context->preference('CashupReconciliationNoteRequired'), > ); > >-- >2.51.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 40445
:
185289
|
185290
|
185291
|
185292
|
185809
|
186636
|
186637
|
186638
|
186639
|
186640
|
186641
|
186642
|
186643
|
189333
|
189334
|
189335
|
189336
|
189337
|
189338
|
189339
|
189340
|
189341
|
189353
|
189354
|
189355
|
189356
|
189357
|
189358
|
189359
|
189360
|
189361
|
189362
|
189363
|
189364
|
189410
|
189411
|
189412
|
189413
|
189414
|
189415
|
189420
|
189421
|
189422
|
189423
|
189424
|
189425
|
189426
|
189427
|
189428
|
189429
|
189430
|
189476
|
189477
|
189478
|
189479
|
189480
|
189481
| 189482