Bugzilla – Attachment 92073 Details for
Bug 23228
Add option to automatically display payment receipt for printing after making a payment
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 23228: Add option to automatically display payment receipt for printing after making a payment
Bug-23228-Add-option-to-automatically-display-paym.patch (text/plain), 11.45 KB, created by
Martin Renvoize (ashimema)
on 2019-08-08 14:22:43 UTC
(
hide
)
Description:
Bug 23228: Add option to automatically display payment receipt for printing after making a payment
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2019-08-08 14:22:43 UTC
Size:
11.45 KB
patch
obsolete
>From dc41a2cbfb81527da5d4bc17502453d41676aaa1 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Thu, 27 Jun 2019 12:12:46 -0400 >Subject: [PATCH] Bug 23228: Add option to automatically display payment > receipt for printing after making a payment > >Some libraries would like an auto-popup after making a payment so librarians don't have >to navigate to the accounts page, locate the new payment, then click the print button. > >Test Plan: >1) Apply this patch >2) Run updatedatabase.pl >3) Make a payment, note no difference in behavior >4) Enable the new syspref FinePaymentAutoPopup >5) Make a payment, note the popup for the payment receipt > >Signed-off-by: Lisette Scheer <lisettes@latahlibrary.org> >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > .../atomicupdate/FinePaymentAutoPopup.perl | 10 ++++++++ > installer/data/mysql/sysprefs.sql | 1 + > .../admin/preferences/circulation.pref | 6 +++++ > .../prog/en/modules/members/boraccount.tt | 4 ++++ > .../prog/en/modules/members/pay.tt | 6 ++++- > .../prog/en/modules/members/paycollect.tt | 4 ++++ > members/boraccount.pl | 4 +++- > members/pay.pl | 5 +++- > members/paycollect.pl | 23 +++++++++++-------- > 9 files changed, 50 insertions(+), 13 deletions(-) > create mode 100644 installer/data/mysql/atomicupdate/FinePaymentAutoPopup.perl > >diff --git a/installer/data/mysql/atomicupdate/FinePaymentAutoPopup.perl b/installer/data/mysql/atomicupdate/FinePaymentAutoPopup.perl >new file mode 100644 >index 0000000000..8e1128cd9d >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/FinePaymentAutoPopup.perl >@@ -0,0 +1,10 @@ >+$DBversion = 'XXX'; # will be replaced by the RM >+if( CheckVersion( $DBversion ) ) { >+ $dbh->do({ >+ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES >+ ('FinePaymentAutoPopup','0',NULL,'If enabled, automatically display a print dialog for a payment receipt when making a payment.','YesNo') >+ }); >+ >+ SetVersion( $DBversion ); >+ print "Upgrade to $DBversion done (Bug 23228 - Add option to automatically display payment receipt for printing after making a payment)\n"; >+} >diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql >index a0d1132d25..3d09ca477b 100644 >--- a/installer/data/mysql/sysprefs.sql >+++ b/installer/data/mysql/sysprefs.sql >@@ -183,6 +183,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` > ('FeeOnChangePatronCategory','1','','If set, when a patron changes to a category with enrolment fee, a fee is charged','YesNo'), > ('FilterBeforeOverdueReport','0','','Do not run overdue report until filter selected','YesNo'), > ('FineNotifyAtCheckin','0',NULL,'If ON notify librarians of overdue fines on the items they are checking in.','YesNo'), >+('FinePaymentAutoPopup','0',NULL,'If enabled, automatically display a print dialog for a payment receipt when making a payment.','YesNo'), > ('finesCalendar','noFinesWhenClosed','ignoreCalendar|noFinesWhenClosed','Specify whether to use the Calendar in calculating duedates and fines','Choice'), > ('FinesIncludeGracePeriod','1',NULL,'If enabled, fines calculations will include the grace period.','YesNo'), > ('FinesLog','1',NULL,'If ON, log fines','YesNo'), >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref >index 15085b6b3d..199809f139 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref >@@ -889,6 +889,12 @@ Circulation: > - pref: ProcessingFeeNote > type: textarea > class: code >+ - >+ - pref: FinePaymentAutoPopup >+ choices: >+ yes: "Do" >+ no: "Don't" >+ - automatically display a print dialog for a payment receipt when making a payment.. > Self check-in module: > - > - "Include the following HTML on the self check-in screen:" >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tt >index 8dbdea2511..02ee0f013b 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tt >@@ -120,6 +120,10 @@ > [% Asset.js("js/members-menu.js") | $raw %] > <script> > $(document).ready(function() { >+ [% IF payment_id && Koha.Preference('FinePaymentAutoPopup') %] >+ window.open('/cgi-bin/koha/members/printfeercpt.pl?action=print&accountlines_id=[% payment_id %]&borrowernumber=[% patron.borrowernumber %]', '_blank'); >+ [% END %] >+ > var txtActivefilter = _("Filter paid transactions"); > var txtInactivefilter = _("Show all transactions"); > var columns_settings = [% ColumnsSettings.GetColumns('members', 'fines', 'account-fines', 'json') | $raw %]; >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/pay.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/pay.tt >index 96d0d41699..822e10cd2a 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/pay.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/pay.tt >@@ -179,7 +179,11 @@ > } > } > $(document).ready(function(){ >- $('#pay-fines-form').preventDoubleFormSubmit(); >+ [% IF payment_id && Koha.Preference('FinePaymentAutoPopup') %] >+ window.open('/cgi-bin/koha/members/printfeercpt.pl?action=print&accountlines_id=[% payment_id %]&borrowernumber=[% patron.borrowernumber %]', '_blank'); >+ [% END %] >+ >+ $('#pay-fines-form').preventDoubleFormSubmit(); > $("#woall").click(function(event){ > var msg = _("Are you sure you want to write off %s in outstanding fines? This cannot be undone!").format( "[% total | $Price %]" ); > var answer = confirm(msg); >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 78ee2ed934..52c14042e1 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/paycollect.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/paycollect.tt >@@ -277,6 +277,10 @@ > [% Asset.js("js/members-menu.js") | $raw %] > <script> > $(document).ready(function() { >+ [% IF payment_id && Koha.Preference('FinePaymentAutoPopup') %] >+ window.open('/cgi-bin/koha/members/printfeercpt.pl?action=print&accountlines_id=[% payment_id %]&borrowernumber=[% patron.borrowernumber %]', '_blank'); >+ [% END %] >+ > var forms = $('#payindivfine, #payfine'); > var change = $('#change')[0]; > >diff --git a/members/boraccount.pl b/members/boraccount.pl >index 9121a8f80a..5ccfb0c04d 100755 >--- a/members/boraccount.pl >+++ b/members/boraccount.pl >@@ -48,7 +48,8 @@ my ($template, $loggedinuser, $cookie) = get_template_and_user( > ); > > my $borrowernumber = $input->param('borrowernumber'); >-my $action = $input->param('action') || ''; >+my $payment_id = $input->param('payment_id'); >+my $action = $input->param('action') || ''; > > my $logged_in_user = Koha::Patrons->find( $loggedinuser ) or die "Not logged in"; > my $patron = Koha::Patrons->find( $borrowernumber ); >@@ -84,6 +85,7 @@ $template->param( > total => sprintf("%.2f",$total), > totalcredit => $totalcredit, > accounts => \@accountlines, >+ payment_id => $payment_id, > ); > > output_html_with_http_headers $input, $cookie, $template->output; >diff --git a/members/pay.pl b/members/pay.pl >index dd7a1efb5f..00e6f7b386 100755 >--- a/members/pay.pl >+++ b/members/pay.pl >@@ -63,6 +63,8 @@ if ( !$borrowernumber ) { > $borrowernumber = $input->param('borrowernumber0'); > } > >+my $payment_id = $input->param('payment_id'); >+ > # get borrower details > my $logged_in_user = Koha::Patrons->find( $loggedinuser ) or die "Not logged in"; > our $patron = Koha::Patrons->find($borrowernumber); >@@ -131,7 +133,8 @@ for (@names) { > } > > $template->param( >- finesview => 1, >+ finesview => 1, >+ payment_id => $payment_id, > ); > > add_accounts_to_template(); >diff --git a/members/paycollect.pl b/members/paycollect.pl >index 1cb6cbe41a..a25f6a4030 100755 >--- a/members/paycollect.pl >+++ b/members/paycollect.pl >@@ -36,8 +36,9 @@ use Koha::Token; > > my $input = CGI->new(); > >-my $writeoff_individual = $input->param('writeoff_individual'); >-my $type = scalar $input->param('type') || 'payment'; >+my $payment_id = $input->param('payment_id'); >+my $writeoff_individual = $input->param('writeoff_individual'); >+my $type = scalar $input->param('type') || 'payment'; > > my $updatecharges_permissions = ($writeoff_individual || $type eq 'writeoff') ? 'writeoff' : 'remaining_permissions'; > my ( $template, $loggedinuser, $cookie ) = get_template_and_user( >@@ -121,7 +122,7 @@ if ( $total_paid and $total_paid ne '0.00' ) { > > if ($pay_individual) { > my $line = Koha::Account::Lines->find($accountlines_id); >- $account->pay( >+ $payment_id = $account->pay( > { > lines => [$line], > amount => $total_paid, >@@ -132,7 +133,7 @@ if ( $total_paid and $total_paid ne '0.00' ) { > } > ); > print $input->redirect( >- "/cgi-bin/koha/members/pay.pl?borrowernumber=$borrowernumber"); >+ "/cgi-bin/koha/members/pay.pl?borrowernumber=$borrowernumber&payment_id=$payment_id"); > } else { > if ($select) { > if ( $select =~ /^([\d,]*).*/ ) { >@@ -150,7 +151,7 @@ if ( $total_paid and $total_paid ne '0.00' ) { > { order_by => 'date' } > ); > >- $account->pay( >+ $payment_id = $account->pay( > { > type => $type, > amount => $total_paid, >@@ -164,7 +165,7 @@ if ( $total_paid and $total_paid ne '0.00' ) { > } > else { > my $note = $input->param('selected_accts_notes'); >- $account->pay( >+ $payment_id = $account->pay( > { > amount => $total_paid, > library_id => $library_id, >@@ -175,7 +176,7 @@ if ( $total_paid and $total_paid ne '0.00' ) { > ); > } > >- print $input->redirect("/cgi-bin/koha/members/boraccount.pl?borrowernumber=$borrowernumber"); >+ print $input->redirect("/cgi-bin/koha/members/boraccount.pl?borrowernumber=$borrowernumber&payment_id=$payment_id"); > } > } > } else { >@@ -189,12 +190,14 @@ if ( $input->param('error_over') ) { > } > > $template->param( >+ payment_id => $payment_id, >+ > type => $type, > borrowernumber => $borrowernumber, # some templates require global >- patron => $patron, >- total => $total_due, >+ patron => $patron, >+ total => $total_due, > >- csrf_token => Koha::Token->new->generate_csrf({ session_id => scalar $input->cookie('CGISESSID') }), >+ csrf_token => Koha::Token->new->generate_csrf( { session_id => scalar $input->cookie('CGISESSID') } ), > ); > > output_html_with_http_headers $input, $cookie, $template->output; >-- >2.20.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 23228
:
91055
|
91427
|
91652
|
91660
|
91665
|
92073
|
92074
|
92075
|
92076
|
92077
|
92078