Bugzilla – Attachment 170314 Details for
Bug 33473
Allow to send email receipts for payments/writeoff manually instead of automatically
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 33473: Rename UseEmailReceipts to AutomaticEmailReceipts
Bug-33473-Rename-UseEmailReceipts-to-AutomaticEmai.patch (text/plain), 9.68 KB, created by
Jake Deery
on 2024-08-14 11:36:50 UTC
(
hide
)
Description:
Bug 33473: Rename UseEmailReceipts to AutomaticEmailReceipts
Filename:
MIME Type:
Creator:
Jake Deery
Created:
2024-08-14 11:36:50 UTC
Size:
9.68 KB
patch
obsolete
>From 67c6a8cf402dbecce8d80bdf9d4c348000e26b8f Mon Sep 17 00:00:00 2001 >From: PerplexedTheta <jahdobble@llownd.net> >Date: Wed, 14 Aug 2024 11:58:22 +0100 >Subject: [PATCH] Bug 33473: Rename UseEmailReceipts to AutomaticEmailReceipts > >This bug will rename the UseEmailReceipts to AutomaticEmailReceipts, to >make it clearer the purpose of this syspref. This is because the receipts >dropdown is no longer conditional, and will always show, even if >AutomaticEmailReceipts is switched off. > >To test (steps a-e before applying patch): >a) search sysprefs for 'EmailReceipts' > 1) note the name is currently 'UseEmailReceipts' > 2) enable this syspref >b) go to members/maninvoice.pl?borrowernumber=51 > 1) enter an amount (e.g. 100) > 2) save & pay, confirm >c) go to members/boraccount.pl?borrowernumber=51 > 1) note that the receipt dropdown is visible >d) go to members/notices.pl?borrowernumber=51 > 1) note that a receipt was automatically sent >e) apply the patch, upgrade the db schema >f) search sysprefs for 'EmailReceipts' > 1) note the name is now 'AutomaticEmailReceipts' >g) go to members/maninvoice.pl?borrowernumber=51 > 1) enter an amount (e.g. 100) > 2) save & pay, confirm >h) go to members/boraccount.pl?borrowernumber=51 > 1) note that the receipt dropdown is still visible >i) go to members/notices.pl?borrowernumber=51 > 1) note that a receipt was automatically sent again >j) disable the 'AutomaticEmailReceipts' syspref >k) go to members/maninvoice.pl?borrowernumber=51 > 1) enter an amount (e.g. 100) > 2) save & pay, confirm >l) go to members/boraccount.pl?borrowernumber=51 > 1) note that the receipt dropdown is STILL visible >m) go to members/notices.pl?borrowernumber=51 > 1) note that a receipt was NOT automatically sent >n) go to members/boraccount.pl?borrowernumber=51 > 1) on any account line where a payment is made, click receipts > email >o) go to members/notices.pl?borrowernumber=51 > 1) confirm a manual notice has been generated >p) make coffee & have a mini disco >--- > Koha/Account.pm | 2 +- > ...il-receipt-when-UseEmailReceipts-is-enabled.pl | 15 +++++++++++++++ > installer/data/mysql/mandatory/sysprefs.sql | 2 +- > .../en/modules/admin/preferences/patrons.pref | 2 +- > .../prog/en/modules/members/boraccount.tt | 4 ---- > t/db_dependent/Accounts.t | 8 ++++---- > t/db_dependent/Koha/Account.t | 4 ++-- > 7 files changed, 24 insertions(+), 13 deletions(-) > create mode 100755 installer/data/mysql/atomicupdate/bug_33473-Add-option-to-resend-email-receipt-when-UseEmailReceipts-is-enabled.pl > >diff --git a/Koha/Account.pm b/Koha/Account.pm >index 3d0fcee854..19fab584f6 100644 >--- a/Koha/Account.pm >+++ b/Koha/Account.pm >@@ -126,7 +126,7 @@ sub pay { > > my $patron = Koha::Patrons->find( $self->{patron_id} ); > my @account_offsets = $payment->credit_offsets({ type => 'APPLY' })->as_list; >- if ( C4::Context->preference('UseEmailReceipts') ) { >+ if ( C4::Context->preference('AutomaticEmailReceipts') ) { > if ( > my $letter = C4::Letters::GetPreparedLetter( > module => 'circulation', >diff --git a/installer/data/mysql/atomicupdate/bug_33473-Add-option-to-resend-email-receipt-when-UseEmailReceipts-is-enabled.pl b/installer/data/mysql/atomicupdate/bug_33473-Add-option-to-resend-email-receipt-when-UseEmailReceipts-is-enabled.pl >new file mode 100755 >index 0000000000..088561f260 >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_33473-Add-option-to-resend-email-receipt-when-UseEmailReceipts-is-enabled.pl >@@ -0,0 +1,15 @@ >+ use Modern::Perl; >+ >+ return { >+ bug_number => "33473", >+ description => "Allow to send email receipts for payments/writeoff manually instead of automatically", >+ up => sub { >+ my ($args) = @_; >+ my ( $dbh, $out ) = @$args{qw(dbh out)}; >+ >+ $dbh->do(q{ >+ UPDATE systempreferences SET variable = 'AutomaticEmailReceipts' WHERE variable = 'UseEmailReceipts'; >+ }); >+ say $out "Renamed system preference 'UseEmailReceipts' to 'AutomaticEmailReceipts'"; >+ }, >+} >diff --git a/installer/data/mysql/mandatory/sysprefs.sql b/installer/data/mysql/mandatory/sysprefs.sql >index 1a7cd033e9..40d06f723e 100644 >--- a/installer/data/mysql/mandatory/sysprefs.sql >+++ b/installer/data/mysql/mandatory/sysprefs.sql >@@ -837,7 +837,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` > ('useDaysMode','Calendar','Calendar|Days|Datedue|Dayweek','Choose the method for calculating due date: select Calendar, Datedue or Dayweek to use the holidays module, and Days to ignore the holidays module','Choice'), > ('useDefaultReplacementCost', '0', NULL, 'default replacement cost defined in item type', 'YesNo'), > ('useDischarge','0','','Allows librarians to discharge borrowers and borrowers to request a discharge','YesNo'), >-('UseEmailReceipts','0','','Send email receipts for payments and write-offs','YesNo'), >+('AutomaticEmailReceipts','0','','Send email receipts for payments and write-offs','YesNo'), > ('UseICUStyleQuotes','0','1','Tell Koha whether to use ICU style quotes ({) or default (") when tracing subjects .','YesNo'), > ('UseLocationAsAQInSIP', '0', '', 'Use permanent_location instead of homebranch for AQ in SIP response', 'YesNo'), > ('UseOCLCEncodingLevels','0',NULL,'If enabled, include OCLC encoding levels in leader value builder dropdown for position 17.','YesNo'), >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref >index 3db000432f..79707581d7 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref >@@ -185,7 +185,7 @@ Patrons: > 0: "Don't notify" > - patrons whenever their password is changed. > - >- - pref: UseEmailReceipts >+ - pref: AutomaticEmailReceipts > choices: > 1: Send > 0: "Don't send" >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 5ed00b06f3..8b37a29167 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tt >@@ -137,7 +137,6 @@ > [% IF account.amountoutstanding <= 0 %]<td class="credit" style="text-align: right;">[% ELSE %]<td class="debit" style="text-align: right;">[% END %][% account.amountoutstanding | $Price %]</td> > <td class="actions"> > [% IF ( account.is_credit ) %] >- [% IF Koha.Preference('UseEmailReceipts') %] > <div class="btn-group"> > <button class="btn btn-xs btn-default dropdown-toggle" data-toggle="dropdown"><i class="fa fa-receipt"></i> Receipt <span class="caret"></span></button> > <ul class="dropdown-menu dropdown-menu-right"> >@@ -153,9 +152,6 @@ > </li> > </ul> > </div> >- [% ELSE %] >- <a target="_blank" href="printfeercpt.pl?action=print&accountlines_id=[% account.accountlines_id | uri %]" class="btn btn-default btn-xs receipt-print-action"><i class="fa fa-print"></i> Print</a> >- [% END %] > [% ELSE %] > <a target="_blank" href="printinvoice.pl?action=print&accountlines_id=[% account.accountlines_id | uri %]" class="btn btn-default btn-xs invoice-print-action"><i class="fa fa-print"></i> Print</a> > [% END %] >diff --git a/t/db_dependent/Accounts.t b/t/db_dependent/Accounts.t >index f749706a6c..c3e74b2dfb 100755 >--- a/t/db_dependent/Accounts.t >+++ b/t/db_dependent/Accounts.t >@@ -1059,14 +1059,14 @@ subtest "Payment notice tests" => sub { > $letter->content('[%- USE Price -%]A payment of [% credit.amount * -1 | $Price %] has been applied to your account. Your [% branch.branchcode %]'); > $letter->store(); > >- t::lib::Mocks::mock_preference('UseEmailReceipts', '0'); >+ t::lib::Mocks::mock_preference('AutomaticEmailReceipts', '0'); > my $id = $account->pay( { amount => 1 } )->{payment_id}; >- is( Koha::Notice::Messages->search()->count(), 0, 'Notice for payment not sent if UseEmailReceipts is disabled' ); >+ is( Koha::Notice::Messages->search()->count(), 0, 'Notice for payment not sent if AutomaticEmailReceipts is disabled' ); > > $id = $account->pay( { amount => 1, type => 'WRITEOFF' } )->{payment_id}; >- is( Koha::Notice::Messages->search()->count(), 0, 'Notice for writeoff not sent if UseEmailReceipts is disabled' ); >+ is( Koha::Notice::Messages->search()->count(), 0, 'Notice for writeoff not sent if AutomaticEmailReceipts is disabled' ); > >- t::lib::Mocks::mock_preference('UseEmailReceipts', '1'); >+ t::lib::Mocks::mock_preference('AutomaticEmailReceipts', '1'); > > $id = $account->pay( { amount => 12, library_id => $branchcode } )->{payment_id}; > my $notice = Koha::Notice::Messages->search()->next(); >diff --git a/t/db_dependent/Koha/Account.t b/t/db_dependent/Koha/Account.t >index 39a84a7eb2..837c667f4c 100755 >--- a/t/db_dependent/Koha/Account.t >+++ b/t/db_dependent/Koha/Account.t >@@ -780,11 +780,11 @@ subtest 'pay() tests' => sub { > my $payment = Koha::Account::Lines->find({accountlines_id => $result->{payment_id}}); > is($payment->manager_id, undef, "manager_id left undefined when no userenv found"); > >- subtest 'UseEmailReceipts tests' => sub { >+ subtest 'AutomaticEmailReceipts tests' => sub { > > plan tests => 5; > >- t::lib::Mocks::mock_preference( 'UseEmailReceipts', 1 ); >+ t::lib::Mocks::mock_preference( 'AutomaticEmailReceipts', 1 ); > > my %params; > >-- >2.39.3 (Apple Git-146)
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 33473
:
170314
|
170980
|
171012
|
171013