Bugzilla – Attachment 133393 Details for
Bug 30563
Add system preference to make the cash register field required when collecting a payment
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 30563: Add syspref to make the "cash register" field mandatory
Bug-30563-Add-syspref-to-make-the-cash-register-fi.patch (text/plain), 6.17 KB, created by
Julian Maurice
on 2022-04-19 10:11:10 UTC
(
hide
)
Description:
Bug 30563: Add syspref to make the "cash register" field mandatory
Filename:
MIME Type:
Creator:
Julian Maurice
Created:
2022-04-19 10:11:10 UTC
Size:
6.17 KB
patch
obsolete
>From 4018ae38952fabc021d562f1a6baca3fb83ae752 Mon Sep 17 00:00:00 2001 >From: Julian Maurice <julian.maurice@biblibre.com> >Date: Fri, 15 Apr 2022 10:01:00 +0200 >Subject: [PATCH] Bug 30563: Add syspref to make the "cash register" field > mandatory > >Test plan: >1. Apply patch and run updatedatabase >2. Enable 'UseCashRegisters' syspref and create at least one cash > register for your library >3. Verify that you have several authorized values in the 'PAYMENT_TYPE' > category. One of them should be 'CASH' >4. Go to a patron accounting tab, create a manual invoice and go to the > payment form. Select payment type 'CASH' and verify that you cannot > submit the form if no cash register is selected. > Select another payment type and verify that you can submit the form > even if no cash register is selected >5. Set syspref 'RequireCashRegister' to 'always require a cash register' >6. Repeat step 4 but this time you should not be able to submit the form > if no cash register is selected, no matter which payment type is > selected. >--- > .../add-syspref-RequireCashRegister.pl | 17 +++++++++++ > installer/data/mysql/mandatory/sysprefs.sql | 1 + > .../modules/admin/preferences/accounting.pref | 8 +++++ > .../prog/en/modules/members/paycollect.tt | 29 +++++++++++++++---- > 4 files changed, 50 insertions(+), 5 deletions(-) > create mode 100644 installer/data/mysql/atomicupdate/add-syspref-RequireCashRegister.pl > >diff --git a/installer/data/mysql/atomicupdate/add-syspref-RequireCashRegister.pl b/installer/data/mysql/atomicupdate/add-syspref-RequireCashRegister.pl >new file mode 100644 >index 0000000000..da878d4e82 >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/add-syspref-RequireCashRegister.pl >@@ -0,0 +1,17 @@ >+use Modern::Perl; >+ >+return { >+ bug_number => '30563', >+ description => 'Add system preference RequireCashRegister', >+ up => sub { >+ my ($args) = @_; >+ my ($dbh, $out) = @$args{qw(dbh out)}; >+ >+ $dbh->do(q{ >+ INSERT IGNORE INTO systempreferences (`variable`, `value`, `options`, `explanation`, `type`) >+ VALUES ('RequireCashRegister', '0', NULL, 'Require a cash register when collecting a payment', 'YesNo') >+ }); >+ >+ say $out 'System preference RequireCashRegister added'; >+ }, >+}; >diff --git a/installer/data/mysql/mandatory/sysprefs.sql b/installer/data/mysql/mandatory/sysprefs.sql >index 34523550c0..03fcbaba10 100644 >--- a/installer/data/mysql/mandatory/sysprefs.sql >+++ b/installer/data/mysql/mandatory/sysprefs.sql >@@ -567,6 +567,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` > ('RentalsInNoissuesCharge','1',NULL,'Rental charges block checkouts (added to noissuescharge).','YesNo'), > ('ReplyToDefault','',NULL,'Use this email address as the replyto in emails','Free'), > ('ReportsLog','0',NULL,'If ON, log information about reports.','YesNo'), >+('RequireCashRegister','0',NULL,'Require a cash register when collecting a payment','YesNo'), > ('RequireStrongPassword','1','','Require a strong login password for staff and patrons','YesNo'), > ('ReservesControlBranch','PatronLibrary','ItemHomeLibrary|PatronLibrary','Branch checked for members reservations rights','Choice'), > ('ReservesMaxPickUpDelay','7','','Define the Maximum delay to pick up an item on hold','Integer'), >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 b23880179b..0930801513 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 >@@ -26,6 +26,14 @@ Accounting: > 1: "Use" > 0: "Don't use" > - " cash registers with the accounting system to track payments." >+ - >+ - "When collecting a payment, " >+ - pref: RequireCashRegister >+ default: no >+ choices: >+ no: "require a cash register only when the CASH payment type is selected" >+ yes: "always require a cash register" >+ - " (Requires UseCashRegisters)" > - > - pref: EnablePointOfSale > default: no >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/paycollect.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/paycollect.tt >index cc6dc7bc5d..f8a97ac728 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/paycollect.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/paycollect.tt >@@ -170,11 +170,26 @@ > > [% IF Koha.Preference('UseCashRegisters') %] > <li> >- <label for="cash_register">Cash register: </label> >- <select name="cash_register" id="cash_register"> >+ [% IF Koha.Preference('RequireCashRegister') %] >+ <label for="cash_register" class="required"> >+ [% ELSE %] >+ <label for="cash_register"> >+ [% END %] >+ Cash register: >+ </label> >+ >+ [% IF Koha.Preference('RequireCashRegister') %] >+ <select name="cash_register" id="cash_register" required> >+ [% ELSE %] >+ <select name="cash_register" id="cash_register"> >+ [% END %] > <option id="noregister" disabled selected="selected" value="">-- Select an option--</option> > [% PROCESS options_for_registers %] > </select> >+ >+ [% IF Koha.Preference('RequireCashRegister') %] >+ <span class="required">Required</span> >+ [% END %] > </li> > [% END %] > </ol> >@@ -403,9 +418,13 @@ > }, > [% IF Koha.Preference('UseCashRegisters') %] > cash_register: { >- required: function() { >- return $('#payment_type').val() == 'CASH' >- } >+ [% IF Koha.Preference('RequireCashRegister') %] >+ required: true >+ [% ELSE %] >+ required: function() { >+ return $('#payment_type').val() == 'CASH' >+ } >+ [% END %] > } > [% END %] > }, >-- >2.30.2
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 30563
:
133393
|
133698
|
133878
|
133879
|
133880