View | Details | Raw Unified | Return to bug 33473
Collapse All | Expand All

(-)a/Koha/Account.pm (-1 / +1 lines)
Lines 124-130 sub pay { Link Here
124
124
125
    my $patron          = Koha::Patrons->find( $self->{patron_id} );
125
    my $patron          = Koha::Patrons->find( $self->{patron_id} );
126
    my @account_offsets = $payment->credit_offsets( { type => 'APPLY' } )->as_list;
126
    my @account_offsets = $payment->credit_offsets( { type => 'APPLY' } )->as_list;
127
    if ( C4::Context->preference('UseEmailReceipts') ) {
127
    if ( C4::Context->preference('AutomaticEmailReceipts') ) {
128
        if (
128
        if (
129
            my $letter = C4::Letters::GetPreparedLetter(
129
            my $letter = C4::Letters::GetPreparedLetter(
130
                module                 => 'circulation',
130
                module                 => 'circulation',
(-)a/installer/data/mysql/atomicupdate/bug_33473-Add-option-to-resend-email-receipt-when-UseEmailReceipts-is-enabled.pl (+15 lines)
Line 0 Link Here
1
    use Modern::Perl;
2
3
    return {
4
        bug_number  => "33473",
5
        description => "Allow to send email receipts for payments/writeoff manually instead of automatically",
6
        up          => sub {
7
            my ($args) = @_;
8
            my ( $dbh, $out ) = @$args{qw(dbh out)};
9
10
            $dbh->do(q{
11
                UPDATE systempreferences SET variable = 'AutomaticEmailReceipts' WHERE variable = 'UseEmailReceipts';
12
            });
13
            say $out "Renamed system preference 'UseEmailReceipts' to 'AutomaticEmailReceipts'";
14
        },
15
}
(-)a/installer/data/mysql/mandatory/sysprefs.sql (-1 / +1 lines)
Lines 854-860 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
854
('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'),
854
('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'),
855
('useDefaultReplacementCost', '0', NULL, 'default replacement cost defined in item type', 'YesNo'),
855
('useDefaultReplacementCost', '0', NULL, 'default replacement cost defined in item type', 'YesNo'),
856
('useDischarge','0','','Allows librarians to discharge borrowers and borrowers to request a discharge','YesNo'),
856
('useDischarge','0','','Allows librarians to discharge borrowers and borrowers to request a discharge','YesNo'),
857
('UseEmailReceipts','0','','Send email receipts for payments and write-offs','YesNo'),
857
('AutomaticEmailReceipts','0','','Send email receipts for payments and write-offs','YesNo'),
858
('UseICUStyleQuotes','0','1','Tell Koha whether to use ICU style quotes ({) or default (") when tracing subjects .','YesNo'),
858
('UseICUStyleQuotes','0','1','Tell Koha whether to use ICU style quotes ({) or default (") when tracing subjects .','YesNo'),
859
('UseLocationAsAQInSIP', '0', '', 'Use permanent_location instead of homebranch for AQ in SIP response', 'YesNo'),
859
('UseLocationAsAQInSIP', '0', '', 'Use permanent_location instead of homebranch for AQ in SIP response', 'YesNo'),
860
('UseOCLCEncodingLevels','0',NULL,'If enabled, include OCLC encoding levels in leader value builder dropdown for position 17.','YesNo'),
860
('UseOCLCEncodingLevels','0',NULL,'If enabled, include OCLC encoding levels in leader value builder dropdown for position 17.','YesNo'),
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref (-1 / +1 lines)
Lines 187-193 Patrons: Link Here
187
               0: "Don't notify"
187
               0: "Don't notify"
188
         - patrons whenever their password is changed.
188
         - patrons whenever their password is changed.
189
     -
189
     -
190
         - pref: UseEmailReceipts
190
         - pref: AutomaticEmailReceipts
191
           choices:
191
           choices:
192
               1: Send
192
               1: Send
193
               0: "Don't send"
193
               0: "Don't send"
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tt (-2 / +2 lines)
Lines 143-149 Link Here
143
                            <td class="[% td_class | html %]" style="text-align: right;">[% account.amountoutstanding | $Price %]</td>
143
                            <td class="[% td_class | html %]" style="text-align: right;">[% account.amountoutstanding | $Price %]</td>
144
                            <td class="actions">
144
                            <td class="actions">
145
                                [% IF ( account.is_credit ) %]
145
                                [% IF ( account.is_credit ) %]
146
                                    [% IF Koha.Preference('UseEmailReceipts') %]
146
                                    [% IF patron.notice_email_address %]
147
                                        <div class="btn-group dropup">
147
                                        <div class="btn-group dropup">
148
                                            <button class="btn btn-xs btn-default dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false"><i class="fa fa-receipt"></i> Receipt</button>
148
                                            <button class="btn btn-xs btn-default dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false"><i class="fa fa-receipt"></i> Receipt</button>
149
                                            <ul class="dropdown-menu dropdown-menu-end">
149
                                            <ul class="dropdown-menu dropdown-menu-end">
Lines 156-163 Link Here
156
                                                        <input type="hidden" name="op" value="cud-send_receipt" />
156
                                                        <input type="hidden" name="op" value="cud-send_receipt" />
157
                                                        <input type="hidden" name="accountlines_id" value="[% account.accountlines_id | html %]" />
157
                                                        <input type="hidden" name="accountlines_id" value="[% account.accountlines_id | html %]" />
158
                                                        <input type="hidden" name="borrowernumber" value="[% account.borrowernumber | html %]" />
158
                                                        <input type="hidden" name="borrowernumber" value="[% account.borrowernumber | html %]" />
159
                                                        <button type="submit" class="dropdown-item receipt-email-action"> <i class="fa fa-envelope"></i> Email </button>
160
                                                    </form>
159
                                                    </form>
160
                                                    <a href="#" class="receipt-email-action dropdown-item"><i class="fa fa-envelope"></i> Email</a>
161
                                                </li>
161
                                                </li>
162
                                            </ul>
162
                                            </ul>
163
                                        </div>
163
                                        </div>
(-)a/t/db_dependent/Accounts.t (-4 / +4 lines)
Lines 1257-1270 subtest "Payment notice tests" => sub { Link Here
1257
    );
1257
    );
1258
    $letter->store();
1258
    $letter->store();
1259
1259
1260
    t::lib::Mocks::mock_preference( 'UseEmailReceipts', '0' );
1260
    t::lib::Mocks::mock_preference( 'AutomaticEmailReceipts', '0' );
1261
    my $id = $account->pay( { amount => 1 } )->{payment_id};
1261
    my $id = $account->pay( { amount => 1 } )->{payment_id};
1262
    is( Koha::Notice::Messages->search()->count(), 0, 'Notice for payment not sent if UseEmailReceipts is disabled' );
1262
    is( Koha::Notice::Messages->search()->count(), 0, 'Notice for payment not sent if AutomaticEmailReceipts is disabled' );
1263
1263
1264
    $id = $account->pay( { amount => 1, type => 'WRITEOFF' } )->{payment_id};
1264
    $id = $account->pay( { amount => 1, type => 'WRITEOFF' } )->{payment_id};
1265
    is( Koha::Notice::Messages->search()->count(), 0, 'Notice for writeoff not sent if UseEmailReceipts is disabled' );
1265
    is( Koha::Notice::Messages->search()->count(), 0, 'Notice for writeoff not sent if AutomaticEmailReceipts is disabled' );
1266
1266
1267
    t::lib::Mocks::mock_preference( 'UseEmailReceipts', '1' );
1267
    t::lib::Mocks::mock_preference( 'AutomaticEmailReceipts', '1' );
1268
1268
1269
    $id = $account->pay( { amount => 12, library_id => $branchcode } )->{payment_id};
1269
    $id = $account->pay( { amount => 12, library_id => $branchcode } )->{payment_id};
1270
    my $notice = Koha::Notice::Messages->search()->next();
1270
    my $notice = Koha::Notice::Messages->search()->next();
(-)a/t/db_dependent/Koha/Account.t (-3 / +2 lines)
Lines 795-805 subtest 'pay() tests' => sub { Link Here
795
    my $payment = Koha::Account::Lines->find( { accountlines_id => $result->{payment_id} } );
795
    my $payment = Koha::Account::Lines->find( { accountlines_id => $result->{payment_id} } );
796
    is( $payment->manager_id, undef, "manager_id left undefined when no userenv found" );
796
    is( $payment->manager_id, undef, "manager_id left undefined when no userenv found" );
797
797
798
    subtest 'UseEmailReceipts tests' => sub {
798
    subtest 'AutomaticEmailReceipts tests' => sub {
799
799
800
        plan tests => 5;
800
        plan tests => 5;
801
801
802
        t::lib::Mocks::mock_preference( 'UseEmailReceipts', 1 );
802
        t::lib::Mocks::mock_preference( 'AutomaticEmailReceipts', 1 );
803
803
804
        my %params;
804
        my %params;
805
805
806
- 

Return to bug 33473