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

(-)a/installer/data/mysql/atomicupdate/FinePaymentAutoPopup.perl (+10 lines)
Line 0 Link Here
1
$DBversion = 'XXX'; # will be replaced by the RM
2
if( CheckVersion( $DBversion ) ) {
3
    $dbh->do({
4
        INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES
5
        ('FinePaymentAutoPopup','0',NULL,'If enabled, automatically display a print dialog for a payment receipt when making a payment.','YesNo')
6
    });
7
8
    SetVersion( $DBversion );
9
    print "Upgrade to $DBversion done (Bug 23228 - Add option to automatically display payment receipt for printing after making a payment)\n";
10
}
(-)a/installer/data/mysql/sysprefs.sql (+1 lines)
Lines 183-188 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
183
('FeeOnChangePatronCategory','1','','If set, when a patron changes to a category with enrolment fee, a fee is charged','YesNo'),
183
('FeeOnChangePatronCategory','1','','If set, when a patron changes to a category with enrolment fee, a fee is charged','YesNo'),
184
('FilterBeforeOverdueReport','0','','Do not run overdue report until filter selected','YesNo'),
184
('FilterBeforeOverdueReport','0','','Do not run overdue report until filter selected','YesNo'),
185
('FineNotifyAtCheckin','0',NULL,'If ON notify librarians of overdue fines on the items they are checking in.','YesNo'),
185
('FineNotifyAtCheckin','0',NULL,'If ON notify librarians of overdue fines on the items they are checking in.','YesNo'),
186
('FinePaymentAutoPopup','0',NULL,'If enabled, automatically display a print dialog for a payment receipt when making a payment.','YesNo'),
186
('finesCalendar','noFinesWhenClosed','ignoreCalendar|noFinesWhenClosed','Specify whether to use the Calendar in calculating duedates and fines','Choice'),
187
('finesCalendar','noFinesWhenClosed','ignoreCalendar|noFinesWhenClosed','Specify whether to use the Calendar in calculating duedates and fines','Choice'),
187
('FinesIncludeGracePeriod','1',NULL,'If enabled, fines calculations will include the grace period.','YesNo'),
188
('FinesIncludeGracePeriod','1',NULL,'If enabled, fines calculations will include the grace period.','YesNo'),
188
('FinesLog','1',NULL,'If ON, log fines','YesNo'),
189
('FinesLog','1',NULL,'If ON, log fines','YesNo'),
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref (+6 lines)
Lines 889-894 Circulation: Link Here
889
            - pref: ProcessingFeeNote
889
            - pref: ProcessingFeeNote
890
              type: textarea
890
              type: textarea
891
              class: code
891
              class: code
892
        -
893
            - pref: FinePaymentAutoPopup
894
              choices:
895
                  yes: "Do"
896
                  no: "Don't"
897
            - automatically display a print dialog for a payment receipt when making a payment..
892
    Self check-in module:
898
    Self check-in module:
893
        -
899
        -
894
            - "Include the following HTML on the self check-in screen:"
900
            - "Include the following HTML on the self check-in screen:"
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tt (+4 lines)
Lines 120-125 Link Here
120
    [% Asset.js("js/members-menu.js") | $raw %]
120
    [% Asset.js("js/members-menu.js") | $raw %]
121
    <script>
121
    <script>
122
        $(document).ready(function() {
122
        $(document).ready(function() {
123
            [% IF payment_id %]
124
                window.open('/cgi-bin/koha/members/printfeercpt.pl?action=print&accountlines_id=[% payment_id %]&borrowernumber=[% patron.borrowernumber %]', '_blank');
125
            [% END %]
126
123
            var txtActivefilter = _("Filter paid transactions");
127
            var txtActivefilter = _("Filter paid transactions");
124
            var txtInactivefilter = _("Show all transactions");
128
            var txtInactivefilter = _("Show all transactions");
125
            var columns_settings = [% ColumnsSettings.GetColumns('members', 'fines', 'account-fines', 'json') | $raw %];
129
            var columns_settings = [% ColumnsSettings.GetColumns('members', 'fines', 'account-fines', 'json') | $raw %];
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/pay.tt (-1 / +5 lines)
Lines 179-185 Link Here
179
            }
179
            }
180
        }
180
        }
181
        $(document).ready(function(){
181
        $(document).ready(function(){
182
        $('#pay-fines-form').preventDoubleFormSubmit();
182
            [% IF payment_id %]
183
                window.open('/cgi-bin/koha/members/printfeercpt.pl?action=print&accountlines_id=[% payment_id %]&borrowernumber=[% patron.borrowernumber %]', '_blank');
184
            [% END %]
185
186
            $('#pay-fines-form').preventDoubleFormSubmit();
183
            $("#woall").click(function(event){
187
            $("#woall").click(function(event){
184
                var msg = _("Are you sure you want to write off %s in outstanding fines? This cannot be undone!").format( "[% total | $Price %]" );
188
                var msg = _("Are you sure you want to write off %s in outstanding fines? This cannot be undone!").format( "[% total | $Price %]" );
185
                var answer = confirm(msg);
189
                var answer = confirm(msg);
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/paycollect.tt (+4 lines)
Lines 277-282 Link Here
277
    [% Asset.js("js/members-menu.js") | $raw %]
277
    [% Asset.js("js/members-menu.js") | $raw %]
278
    <script>
278
    <script>
279
        $(document).ready(function() {
279
        $(document).ready(function() {
280
            [% IF payment_id %]
281
                window.open('/cgi-bin/koha/members/printfeercpt.pl?action=print&accountlines_id=[% payment_id %]&borrowernumber=[% patron.borrowernumber %]', '_blank');
282
            [% END %]
283
280
            var forms = $('#payindivfine, #payfine');
284
            var forms = $('#payindivfine, #payfine');
281
            var change = $('#change')[0];
285
            var change = $('#change')[0];
282
286
(-)a/members/boraccount.pl (-1 / +3 lines)
Lines 48-54 my ($template, $loggedinuser, $cookie) = get_template_and_user( Link Here
48
);
48
);
49
49
50
my $borrowernumber = $input->param('borrowernumber');
50
my $borrowernumber = $input->param('borrowernumber');
51
my $action = $input->param('action') || '';
51
my $payment_id     = $input->param('payment_id');
52
my $action         = $input->param('action') || '';
52
53
53
my $logged_in_user = Koha::Patrons->find( $loggedinuser ) or die "Not logged in";
54
my $logged_in_user = Koha::Patrons->find( $loggedinuser ) or die "Not logged in";
54
my $patron = Koha::Patrons->find( $borrowernumber );
55
my $patron = Koha::Patrons->find( $borrowernumber );
Lines 84-89 $template->param( Link Here
84
    total               => sprintf("%.2f",$total),
85
    total               => sprintf("%.2f",$total),
85
    totalcredit         => $totalcredit,
86
    totalcredit         => $totalcredit,
86
    accounts            => \@accountlines,
87
    accounts            => \@accountlines,
88
    payment_id          => $payment_id,
87
);
89
);
88
90
89
output_html_with_http_headers $input, $cookie, $template->output;
91
output_html_with_http_headers $input, $cookie, $template->output;
(-)a/members/pay.pl (-1 / +4 lines)
Lines 63-68 if ( !$borrowernumber ) { Link Here
63
    $borrowernumber = $input->param('borrowernumber0');
63
    $borrowernumber = $input->param('borrowernumber0');
64
}
64
}
65
65
66
my $payment_id = $input->param('payment_id');
67
66
# get borrower details
68
# get borrower details
67
my $logged_in_user = Koha::Patrons->find( $loggedinuser ) or die "Not logged in";
69
my $logged_in_user = Koha::Patrons->find( $loggedinuser ) or die "Not logged in";
68
our $patron         = Koha::Patrons->find($borrowernumber);
70
our $patron         = Koha::Patrons->find($borrowernumber);
Lines 131-137 for (@names) { Link Here
131
}
133
}
132
134
133
$template->param(
135
$template->param(
134
    finesview => 1,
136
    finesview  => 1,
137
    payment_id => $payment_id,
135
);
138
);
136
139
137
add_accounts_to_template();
140
add_accounts_to_template();
(-)a/members/paycollect.pl (-11 / +13 lines)
Lines 36-43 use Koha::Token; Link Here
36
36
37
my $input = CGI->new();
37
my $input = CGI->new();
38
38
39
my $writeoff_individual       = $input->param('writeoff_individual');
39
my $payment_id          = $input->param('payment_id');
40
my $type                      = scalar $input->param('type') || 'payment';
40
my $writeoff_individual = $input->param('writeoff_individual');
41
my $type                = scalar $input->param('type') || 'payment';
41
42
42
my $updatecharges_permissions = ($writeoff_individual || $type eq 'writeoff') ? 'writeoff' : 'remaining_permissions';
43
my $updatecharges_permissions = ($writeoff_individual || $type eq 'writeoff') ? 'writeoff' : 'remaining_permissions';
43
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
44
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
Lines 120-126 if ( $total_paid and $total_paid ne '0.00' ) { Link Here
120
121
121
        if ($pay_individual) {
122
        if ($pay_individual) {
122
            my $line = Koha::Account::Lines->find($accountlines_id);
123
            my $line = Koha::Account::Lines->find($accountlines_id);
123
            Koha::Account->new( { patron_id => $borrowernumber } )->pay(
124
            $payment_id = Koha::Account->new( { patron_id => $borrowernumber } )->pay(
124
                {
125
                {
125
                    lines        => [$line],
126
                    lines        => [$line],
126
                    amount       => $total_paid,
127
                    amount       => $total_paid,
Lines 131-137 if ( $total_paid and $total_paid ne '0.00' ) { Link Here
131
                }
132
                }
132
            );
133
            );
133
            print $input->redirect(
134
            print $input->redirect(
134
                "/cgi-bin/koha/members/pay.pl?borrowernumber=$borrowernumber");
135
                "/cgi-bin/koha/members/pay.pl?borrowernumber=$borrowernumber&payment_id=$payment_id");
135
        } else {
136
        } else {
136
            if ($select) {
137
            if ($select) {
137
                if ( $select =~ /^([\d,]*).*/ ) {
138
                if ( $select =~ /^([\d,]*).*/ ) {
Lines 149-155 if ( $total_paid and $total_paid ne '0.00' ) { Link Here
149
                    { order_by => 'date' }
150
                    { order_by => 'date' }
150
                );
151
                );
151
152
152
                Koha::Account->new(
153
                $payment_id = Koha::Account->new(
153
                    {
154
                    {
154
                        patron_id => $borrowernumber,
155
                        patron_id => $borrowernumber,
155
                    }
156
                    }
Lines 166-172 if ( $total_paid and $total_paid ne '0.00' ) { Link Here
166
            }
167
            }
167
            else {
168
            else {
168
                my $note = $input->param('selected_accts_notes');
169
                my $note = $input->param('selected_accts_notes');
169
                Koha::Account->new( { patron_id => $borrowernumber } )->pay(
170
                $payment_id = Koha::Account->new( { patron_id => $borrowernumber } )->pay(
170
                    {
171
                    {
171
                        amount       => $total_paid,
172
                        amount       => $total_paid,
172
                        note         => $note,
173
                        note         => $note,
Lines 176-182 if ( $total_paid and $total_paid ne '0.00' ) { Link Here
176
                );
177
                );
177
            }
178
            }
178
179
179
            print $input->redirect("/cgi-bin/koha/members/boraccount.pl?borrowernumber=$borrowernumber");
180
            print $input->redirect("/cgi-bin/koha/members/boraccount.pl?borrowernumber=$borrowernumber&payment_id=$payment_id");
180
        }
181
        }
181
    }
182
    }
182
} else {
183
} else {
Lines 190-201 if ( $input->param('error_over') ) { Link Here
190
}
191
}
191
192
192
$template->param(
193
$template->param(
194
    payment_id => $payment_id,
195
193
    type           => $type,
196
    type           => $type,
194
    borrowernumber => $borrowernumber,    # some templates require global
197
    borrowernumber => $borrowernumber,    # some templates require global
195
    patron        => $patron,
198
    patron         => $patron,
196
    total         => $total_due,
199
    total          => $total_due,
197
200
198
    csrf_token => Koha::Token->new->generate_csrf({ session_id => scalar $input->cookie('CGISESSID') }),
201
    csrf_token => Koha::Token->new->generate_csrf( { session_id => scalar $input->cookie('CGISESSID') } ),
199
);
202
);
200
203
201
output_html_with_http_headers $input, $cookie, $template->output;
204
output_html_with_http_headers $input, $cookie, $template->output;
202
- 

Return to bug 23228