From b774abe229ffaeb7693e475da8415977355ec78d Mon Sep 17 00:00:00 2001 From: mbeaulieu Date: Fri, 20 Jun 2014 15:16:43 -0400 Subject: [PATCH] [Signed-off] Bug 12448 - Fixes: confirmation when checking out an item with rental fees MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes: Default behaviour changed to "Don't ask". Adressed the punctuation issues. Removed the currency symbols in the warning message. Using "GetIssuingCharges()" to calculate the correct charge amount, including applicable discounts. Signed-off-by: Christopher Brannon Signed-off-by: Marc VĂ©ron --- C4/Circulation.pm | 12 +++++------- installer/data/mysql/sysprefs.sql | 2 +- .../intranet-tmpl/prog/en/modules/circ/circulation.tt | 4 ++-- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index e33e5ea..c5cae12 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -906,17 +906,15 @@ sub CanBookBeIssued { if ( $borrower->{'branchcode'} ne $userenv->{branch} ); } } - + # # CHECK IF THERE IS RENTAL CHARGES. RENTAL MUST BE CONFIRMED BY THE BORROWER - my $sth = $dbh->prepare("SELECT rentalcharge FROM itemtypes WHERE itemtype = ?"); - $sth->execute( $item->{'itemtype'} ); - my $rentalCharge = $sth->fetchrow(); + # + my ($rentalCharge) = GetIssuingCharges( $item->{'itemnumber'}, $borrower->{'borrowernumber'} ); my $rentalConfirmation = C4::Context->preference("RentalFeesCheckoutConfirmation"); - if ( $rentalCharge && $rentalConfirmation ) + if ( $rentalConfirmation && $rentalCharge != 0 ) { - $rentalCharge = sprintf("%.02f \$", $rentalCharge); - $rentalCharge =~ s/\./,/; + $rentalCharge = sprintf("%.02f", $rentalCharge); $needsconfirmation{RENTALCHARGE} = $rentalCharge; } diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index 98ee138..76775b7 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -332,7 +332,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('RenewalPeriodBase','date_due','date_due|now','Set whether the renewal date should be counted from the date_due or from the moment the Patron asks for renewal ','Choice'), ('RenewalSendNotice','0','',NULL,'YesNo'), ('RenewSerialAddsSuggestion','0',NULL,'If ON, adds a new suggestion at serial subscription renewal','YesNo'), -('RentalFeesCheckoutConfirmation', '1', NULL , 'Allow user to confirme when checking out an item with rental fees.', 'YesNo'), +('RentalFeesCheckoutConfirmation', '0', NULL , 'Allow user to confirme when checking out an item with rental fees.', 'YesNo'), ('RentalsInNoissuesCharge','1',NULL,'Rental charges block checkouts (added to noissuescharge).','YesNo'), ('RequestOnOpac','1',NULL,'If ON, globally enables patron holds on OPAC','YesNo'), ('ReservesControlBranch','PatronLibrary','ItemHomeLibrary|PatronLibrary','Branch checked for members reservations rights','Choice'), diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt index faf3d81..fc3247d 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt @@ -203,11 +203,11 @@ var MSG_EXPORT_SELECT_CHECKOUTS = _("You must select checkout(s) to export"); [% END %] [% IF ( DEBT ) %] -
  • The patron has a debt of [% DEBT %]
  • +
  • The patron has a debt of [% DEBT %].
  • [% END %] [% IF ( RENTALCHARGE ) %] -
  • Rental charge for this item : [% RENTALCHARGE %]
  • +
  • Rental charge for this item: [% RENTALCHARGE %]
  • [% END %] [% IF ( RENEW_ISSUE ) %] -- 1.7.10.4