Bug 28138: Add syspref to make the payment type required

The payment type is already required when using the cash register
feature, but some users want to force selecting a payment type even
when cash registers are not used

The new system preference name is RequirePaymentType

Test plan:
1. Apply patch and run updatedatabase.pl
2. Disable UseCashRegisters and RequirePaymentType sysprefs
3. Create some authorised values in PAYMENT_TYPE category if needed
4. Create a manual invoice and pay it. Notice that the payment type is
   optional.
5. Enable RequirePaymentType
6. Create a manual invoice and pay it. Notice that the payment type is
   now required.
7. Enable UseCashRegisters and verify that the payment type is always
   required, even if RequirePaymentType is disabled

Rebased by Thibaud Guillot <thibaud.guillot@biblibre.com> on 21-12-02

Signed-off-by: shiyao <shiyao@inlibro.com>

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
Julian Maurice 2021-04-13 10:06:24 +02:00 committed by Fridolin Somers
parent bbcc781ba4
commit a7139af17a
4 changed files with 18 additions and 1 deletions

View file

@ -0,0 +1,9 @@
$DBversion = 'XXX';
if ( CheckVersion($DBversion) ) {
$dbh->do(q{
INSERT IGNORE INTO systempreferences (`variable`,`value`,`options`,`explanation`,`type`)
VALUES ('RequirePaymentType','0','','Require staff to select a payment type when a payment is made','YesNo')
});
NewVersion( $DBversion, '28138', 'Add system preference RequirePaymentType');
}

View file

@ -569,6 +569,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'),
('RequirePaymentType','0','','Require staff to select a payment type when a payment is made','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'),

View file

@ -6,7 +6,7 @@
[% END %]
[% IF payment_types.size > 0 %]
<li>
[% IF Koha.Preference('UseCashRegisters') %]
[% IF Koha.Preference('UseCashRegisters') || Koha.Preference('RequirePaymentType') %]
<label for="[% type | html %]_type" class="required">[% IF type == 'payment' %]Payment[% ELSE %]Transaction[% END %] type: </label>
<select name="[% type | html %]_type" id="[% type | html %]_type" class="required" required="required">
[% IF type == 'refund' %]

View file

@ -12,6 +12,13 @@ Accounting:
1: "Do"
0: "Don't"
- automatically display a print dialog for a payment receipt when making a payment.
-
- pref: RequirePaymentType
choices:
0: "Do not require"
1: "Require"
- staff to select a payment type when a payment is made.
- This preference has no effect when UseCashRegisters is enabled or when no payment type is defined in PAYMENT_TYPE authorised value category
-
- pref: RoundFinesAtPayment
choices: