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 121-127 if ( $total_paid and $total_paid ne '0.00' ) { Link Here
121
122
122
        if ($pay_individual) {
123
        if ($pay_individual) {
123
            my $line = Koha::Account::Lines->find($accountlines_id);
124
            my $line = Koha::Account::Lines->find($accountlines_id);
124
            $account->pay(
125
            $payment_id = $account->pay(
125
                {
126
                {
126
                    lines        => [$line],
127
                    lines        => [$line],
127
                    amount       => $total_paid,
128
                    amount       => $total_paid,
Lines 132-138 if ( $total_paid and $total_paid ne '0.00' ) { Link Here
132
                }
133
                }
133
            );
134
            );
134
            print $input->redirect(
135
            print $input->redirect(
135
                "/cgi-bin/koha/members/pay.pl?borrowernumber=$borrowernumber");
136
                "/cgi-bin/koha/members/pay.pl?borrowernumber=$borrowernumber&payment_id=$payment_id");
136
        } else {
137
        } else {
137
            if ($select) {
138
            if ($select) {
138
                if ( $select =~ /^([\d,]*).*/ ) {
139
                if ( $select =~ /^([\d,]*).*/ ) {
Lines 150-156 if ( $total_paid and $total_paid ne '0.00' ) { Link Here
150
                    { order_by => 'date' }
151
                    { order_by => 'date' }
151
                );
152
                );
152
153
153
                $account->pay(
154
                $payment_id = $account->pay(
154
                    {
155
                    {
155
                        type         => $type,
156
                        type         => $type,
156
                        amount       => $total_paid,
157
                        amount       => $total_paid,
Lines 164-170 if ( $total_paid and $total_paid ne '0.00' ) { Link Here
164
            }
165
            }
165
            else {
166
            else {
166
                my $note = $input->param('selected_accts_notes');
167
                my $note = $input->param('selected_accts_notes');
167
                $account->pay(
168
                $payment_id = $account->pay(
168
                    {
169
                    {
169
                        amount       => $total_paid,
170
                        amount       => $total_paid,
170
                        library_id   => $library_id,
171
                        library_id   => $library_id,
Lines 175-181 if ( $total_paid and $total_paid ne '0.00' ) { Link Here
175
                );
176
                );
176
            }
177
            }
177
178
178
            print $input->redirect("/cgi-bin/koha/members/boraccount.pl?borrowernumber=$borrowernumber");
179
            print $input->redirect("/cgi-bin/koha/members/boraccount.pl?borrowernumber=$borrowernumber&payment_id=$payment_id");
179
        }
180
        }
180
    }
181
    }
181
} else {
182
} else {
Lines 189-200 if ( $input->param('error_over') ) { Link Here
189
}
190
}
190
191
191
$template->param(
192
$template->param(
193
    payment_id => $payment_id,
194
192
    type           => $type,
195
    type           => $type,
193
    borrowernumber => $borrowernumber,    # some templates require global
196
    borrowernumber => $borrowernumber,    # some templates require global
194
    patron        => $patron,
197
    patron         => $patron,
195
    total         => $total_due,
198
    total          => $total_due,
196
199
197
    csrf_token => Koha::Token->new->generate_csrf({ session_id => scalar $input->cookie('CGISESSID') }),
200
    csrf_token => Koha::Token->new->generate_csrf( { session_id => scalar $input->cookie('CGISESSID') } ),
198
);
201
);
199
202
200
output_html_with_http_headers $input, $cookie, $template->output;
203
output_html_with_http_headers $input, $cookie, $template->output;
201
- 

Return to bug 23228