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

(-)a/Koha/Patron.pm (-9 / +11 lines)
Lines 21-27 package Koha::Patron; Link Here
21
use Modern::Perl;
21
use Modern::Perl;
22
22
23
use List::MoreUtils    qw( any none uniq notall zip6);
23
use List::MoreUtils    qw( any none uniq notall zip6);
24
use Scalar::Util       qw( looks_like_number );
25
use JSON               qw( to_json );
24
use JSON               qw( to_json );
26
use Scalar::Util       qw(looks_like_number);
25
use Scalar::Util       qw(looks_like_number);
27
use Unicode::Normalize qw( NFKD );
26
use Unicode::Normalize qw( NFKD );
Lines 1692-1708 sub add_print_notice_charge_if_needed { Link Here
1692
    return unless Scalar::Util::looks_like_number($charge_amount);
1691
    return unless Scalar::Util::looks_like_number($charge_amount);
1693
    return unless $charge_amount > 0;
1692
    return unless $charge_amount > 0;
1694
1693
1695
    my $userenv = C4::Context->userenv;
1694
    my $userenv    = C4::Context->userenv;
1696
    my $library_id = $params->{library_id} || ($userenv ? $userenv->{branch} : undef);
1695
    my $library_id = $params->{library_id} || ( $userenv ? $userenv->{branch} : undef );
1697
1696
1698
    my $result;
1697
    my $result;
1699
    try {
1698
    try {
1700
        $result = $self->account->add_debit({
1699
        $result = $self->account->add_debit(
1701
            amount      => $charge_amount,
1700
            {
1702
            type        => 'PRINT_NOTICE',
1701
                amount     => $charge_amount,
1703
            interface   => C4::Context->interface,
1702
                type       => 'PRINT_NOTICE',
1704
            library_id  => $library_id,
1703
                interface  => C4::Context->interface,
1705
        });
1704
                library_id => $library_id,
1705
                note       => $params->{notice_code},
1706
            }
1707
        );
1706
    } catch {
1708
    } catch {
1707
        return;
1709
        return;
1708
    };
1710
    };
(-)a/installer/data/mysql/atomicupdate/bug_4858-print-notice-charge.pl (-1 / +1 lines)
Lines 20-26 return { Link Here
20
        $dbh->do(
20
        $dbh->do(
21
            q{
21
            q{
22
            INSERT IGNORE INTO account_debit_types (code, description, can_be_invoiced, can_be_sold, default_amount, is_system, restricts_checkouts)
22
            INSERT IGNORE INTO account_debit_types (code, description, can_be_invoiced, can_be_sold, default_amount, is_system, restricts_checkouts)
23
            VALUES ('PRINT_NOTICE', 'Print notice charge', 0, 0, 0.50, 1, 0)
23
            VALUES ('PRINT_NOTICE', 'Print notice charge', 0, 0, NULL, 1, 0)
24
        }
24
        }
25
        );
25
        );
26
26
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-messaging.tt (-8 / +48 lines)
Lines 47-54 Link Here
47
                        [% IF print_notice_charging && !patron_has_email %]
47
                        [% IF print_notice_charging && !patron_has_email %]
48
                            <div class="alert alert-warning">
48
                            <div class="alert alert-warning">
49
                                <h4><i class="fa fa-exclamation-triangle"></i> Print Notice Charges</h4>
49
                                <h4><i class="fa fa-exclamation-triangle"></i> Print Notice Charges</h4>
50
                                <p><strong>Important:</strong> Print notices incur a charge of
50
                                <p><strong>Important:</strong> Print notices incur a charge of [% print_notice_charge_amount | $Price %] each to cover postage and processing costs.</p>
51
                                   [% print_notice_charge_amount | $Price %] each to cover postage and processing costs.</p>
52
                                <p>To avoid these charges, please:</p>
51
                                <p>To avoid these charges, please:</p>
53
                                <ul>
52
                                <ul>
54
                                    <li>Provide an email address in your <a href="/cgi-bin/koha/opac-memberentry.pl">account details</a></li>
53
                                    <li>Provide an email address in your <a href="/cgi-bin/koha/opac-memberentry.pl">account details</a></li>
Lines 63-68 Link Here
63
                            <input type="hidden" name="op" value="cud-modify" />
62
                            <input type="hidden" name="op" value="cud-modify" />
64
63
65
                            [% IF Koha.Preference( 'EnhancedMessagingPreferencesOPAC' ) %]
64
                            [% IF Koha.Preference( 'EnhancedMessagingPreferencesOPAC' ) %]
65
                                [% SET has_print_transport = 0 %]
66
                                [% FOREACH pref IN messaging_preferences %]
67
                                    [% IF pref.transport_print %][% SET has_print_transport = 1 %][% LAST %][% END %]
68
                                [% END %]
66
                                <table class="table table-bordered table-condensed table-striped">
69
                                <table class="table table-bordered table-condensed table-striped">
67
                                    <caption class="sr-only">Your messaging settings</caption>
70
                                    <caption class="sr-only">Your messaging settings</caption>
68
                                    <thead>
71
                                    <thead>
Lines 73-78 Link Here
73
                                            [% IF ( TalkingTechItivaPhone ) %]<th>Phone</th>[% END %]
76
                                            [% IF ( TalkingTechItivaPhone ) %]<th>Phone</th>[% END %]
74
                                            [% IF Koha.Preference('PhoneNotification') %]<th>Phone</th>[% END %]
77
                                            [% IF Koha.Preference('PhoneNotification') %]<th>Phone</th>[% END %]
75
                                            <th>Email</th>
78
                                            <th>Email</th>
79
                                            [% IF has_print_transport %]
80
                                                <th
81
                                                    >Print
82
                                                    [% IF print_notice_charging %]
83
                                                        ([% print_notice_charge_amount | $Price %] charge)
84
                                                    [% END %]
85
                                                </th>
86
                                            [% END %]
76
                                            <th
87
                                            <th
77
                                                >Digests only
88
                                                >Digests only
78
                                                <i
89
                                                <i
Lines 256-261 Link Here
256
                                                    <td>-</td>
267
                                                    <td>-</td>
257
                                                [% END %]
268
                                                [% END %]
258
269
270
                                                [% IF has_print_transport %]
271
                                                    [% IF ( messaging_preference.transport_print ) %]
272
                                                        <td class="selectcol">
273
                                                            [% IF ( messaging_preference.transports_print ) %]
274
                                                                <input
275
                                                                    type="checkbox"
276
                                                                    aria-label="Unselect print messaging"
277
                                                                    class="pmp_print"
278
                                                                    id="print[% messaging_preference.message_attribute_id | html %]"
279
                                                                    name="[% messaging_preference.message_attribute_id | html %]"
280
                                                                    value="print"
281
                                                                    checked="checked"
282
                                                                />
283
                                                            [% ELSE %]
284
                                                                <input
285
                                                                    type="checkbox"
286
                                                                    aria-label="Select print messaging"
287
                                                                    class="pmp_print"
288
                                                                    id="print[% messaging_preference.message_attribute_id | html %]"
289
                                                                    name="[% messaging_preference.message_attribute_id | html %]"
290
                                                                    value="print"
291
                                                                />
292
                                                            [% END %]
293
                                                        </td>
294
                                                    [% ELSE %]
295
                                                        <td>-</td>
296
                                                    [% END %]
297
                                                [% END %]
298
259
                                                [% IF ( messaging_preference.has_digest ) %]
299
                                                [% IF ( messaging_preference.has_digest ) %]
260
                                                    <td class="selectcol">
300
                                                    <td class="selectcol">
261
                                                        [% IF ( messaging_preference.digest ) %]
301
                                                        [% IF ( messaging_preference.digest ) %]
Lines 294-309 Link Here
294
                            [% IF print_notice_charging %]
334
                            [% IF print_notice_charging %]
295
                                <div class="alert alert-info">
335
                                <div class="alert alert-info">
296
                                    <h5><i class="fa fa-info-circle"></i> About Print Notice Charges</h5>
336
                                    <h5><i class="fa fa-info-circle"></i> About Print Notice Charges</h5>
297
                                    <p>Print notices incur a charge of
337
                                    <p>Print notices incur a charge of [% IF print_notice_charge_amount %][% print_notice_charge_amount | $Price %][% ELSE %]0.00[% END %] each to cover postage and processing costs.</p>
298
                                       [% IF print_notice_charge_amount %][% print_notice_charge_amount | $Price %][% ELSE %]0.00[% END %]
299
                                       each to cover postage and processing costs.</p>
300
                                    <p><strong>To avoid these charges:</strong></p>
338
                                    <p><strong>To avoid these charges:</strong></p>
301
                                    <ul>
339
                                    <ul>
302
                                        [% IF !patron_has_email %]
340
                                        [% IF !patron_has_email %]
303
                                            <li><strong>Add an email address</strong> to your <a href="/cgi-bin/koha/opac-memberentry.pl">account details</a></li>
341
                                            <li><strong>Add an email address</strong> to your <a href="/cgi-bin/koha/opac-memberentry.pl">account details</a></li>
304
                                        [% END %]
342
                                        [% END %]
305
                                        <li>Select "Email" instead of any print options for your notice preferences above</li>
343
                                        <li>Select "Email" instead of "Print" for your notice preferences above</li>
306
                                        <li>Ask library staff to disable print notices for your account</li>
344
                                        <li>Uncheck any enabled print notice preferences above</li>
307
                                    </ul>
345
                                    </ul>
308
                                    [% IF patron_has_email %]
346
                                    [% IF patron_has_email %]
309
                                        <p class="text-success">✓ You have an email address on file. Make sure to select email delivery for notices to avoid print charges.</p>
347
                                        <p class="text-success">✓ You have an email address on file. Make sure to select email delivery for notices to avoid print charges.</p>
Lines 427-432 Link Here
427
            $(".pmp_phone").click(function(){
465
            $(".pmp_phone").click(function(){
428
                toggle_digest(Number($(this).attr("id").replace("phone", "")));
466
                toggle_digest(Number($(this).attr("id").replace("phone", "")));
429
            });
467
            });
468
            $(".pmp_print").click(function(){
469
                toggle_digest(Number($(this).attr("id").replace("print", "")));
470
            });
430
471
431
        });
472
        });
432
473
433
- 

Return to bug 4858