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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/pay.tt (+1 lines)
Lines 121-126 Link Here
121
<input type="submit" id="paycollect" name="paycollect"  value="Pay amount" class="submit" />
121
<input type="submit" id="paycollect" name="paycollect"  value="Pay amount" class="submit" />
122
[% IF CAN_user_updatecharges_writeoff %]<input type="submit" name="woall"  id="woall" value="Write off all" class="submit" />[% END %]
122
[% IF CAN_user_updatecharges_writeoff %]<input type="submit" name="woall"  id="woall" value="Write off all" class="submit" />[% END %]
123
<input type="submit" id="payselected" name="payselected"  value="Pay selected" class="submit" />
123
<input type="submit" id="payselected" name="payselected"  value="Pay selected" class="submit" />
124
<input type="submit" id="writeoff-selected" name="writeoff_selected"  value="Write off selected" class="submit" />
124
<a class="cancel" href="/cgi-bin/koha/members/boraccount.pl?borrowernumber=[% patron.borrowernumber %]">Cancel</a>
125
<a class="cancel" href="/cgi-bin/koha/members/boraccount.pl?borrowernumber=[% patron.borrowernumber %]">Cancel</a>
125
</fieldset>
126
</fieldset>
126
</form>
127
</form>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/paycollect.tt (-5 / +21 lines)
Lines 11-17 Link Here
11
<body id="pat_paycollect" class="pat">
11
<body id="pat_paycollect" class="pat">
12
[% INCLUDE 'header.inc' %]
12
[% INCLUDE 'header.inc' %]
13
[% INCLUDE 'patron-search.inc' %]
13
[% INCLUDE 'patron-search.inc' %]
14
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/members/members-home.pl">Patrons</a>  &rsaquo; <a href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% patron.borrowernumber %]">Pay fines for [% patron.firstname %] [% patron.surname %]</a> &rsaquo; [% IF ( pay_individual ) %]Pay an individual fine[% ELSIF ( writeoff_individual ) %]Write off an individual fine[% ELSE %][% IF ( selected_accts ) %]Pay an amount toward selected fines[% ELSE %]Pay an amount toward all fines[% END %][% END %]</div>
14
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/members/members-home.pl">Patrons</a>  &rsaquo; <a href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% patron.borrowernumber %]">Pay fines for [% patron.firstname %] [% patron.surname %]</a> &rsaquo; [% IF ( pay_individual ) %]Pay an individual fine[% ELSIF ( writeoff_individual ) %]Write off an individual fine[% ELSE %][% IF ( selected_accts ) %][% IF type == 'write    off' %]Write off an amount toward selected fines[% ELSE %]Pay an amount toward selected fines[% END %][% ELSE %]Pay an amount toward all fines[% END %][% END %]</div>
15
15
16
<div id="doc3" class="yui-t2">
16
<div id="doc3" class="yui-t2">
17
17
Lines 153-168 Link Here
153
    <input type="hidden" name="borrowernumber" id="borrowernumber" value="[% patron.borrowernumber %]" />
153
    <input type="hidden" name="borrowernumber" id="borrowernumber" value="[% patron.borrowernumber %]" />
154
    <input type="hidden" name="selected_accts" id="selected_accts" value="[% selected_accts %]" />
154
    <input type="hidden" name="selected_accts" id="selected_accts" value="[% selected_accts %]" />
155
    <input type="hidden" name="total" id="total" value="[% total %]" />
155
    <input type="hidden" name="total" id="total" value="[% total %]" />
156
    <input type="hidden" name="type" value="[% type %]" />
156
157
157
    <fieldset class="rows">
158
    <fieldset class="rows">
158
    [% IF ( selected_accts ) %]<legend>Pay an amount toward selected fines</legend>[% ELSE %]<legend>Pay an amount toward all fines</legend>[% END %]
159
    [% IF ( selected_accts ) %]
160
        [% IF type == 'writeoff' %]
161
            <legend>Write off an amount toward selected fines</legend>
162
        [% ELSE %]
163
            <legend>Pay an amount toward selected fines</legend>
164
        [% END %]
165
    [% ELSE %]
166
        <legend>Pay an amount toward all fines</legend>
167
    [% END %]
168
159
    <ol>
169
    <ol>
160
        <li>
170
        <li>
161
            <span class="label">Total amount outstanding: </span>
171
            <span class="label">Total amount outstanding: </span>
162
            <span class="debit">[% total | format('%.2f') %]</span>
172
            <span class="debit">[% total | format('%.2f') %]</span>
163
        </li>
173
        </li>
164
    <li>
174
    <li>
165
        <label for="paid">Collect from patron: </label>
175
        [% IF type == 'writeoff' %]
176
            <label for="paid">Writeoff amount: </label>
177
        [% ELSE %]
178
            <label for="paid">Collect from patron: </label>
179
        [% END %]
166
        <!-- default to paying all -->
180
        <!-- default to paying all -->
167
        <input name="paid" id="paid" value="[% total | format('%.2f') %]" />
181
        <input name="paid" id="paid" value="[% total | format('%.2f') %]" />
168
    </li>
182
    </li>
Lines 184-191 Link Here
184
    </li>
198
    </li>
185
    </ol>
199
    </ol>
186
    </fieldset>
200
    </fieldset>
187
    <div class="action"><input type="submit" name="submitbutton" value="Confirm" />
201
    <div class="action">
188
        <a class="cancel" href="/cgi-bin/koha/members/boraccount.pl?borrowernumber=[% patron.borrowernumber %]">Cancel</a></div>
202
        <input type="submit" name="submitbutton" value="Confirm" />
203
        <a class="cancel" href="/cgi-bin/koha/members/boraccount.pl?borrowernumber=[% patron.borrowernumber %]">Cancel</a>
204
    </div>
189
    </form>
205
    </form>
190
[% END %]
206
[% END %]
191
</div></div>
207
</div></div>
(-)a/members/pay.pl (-17 / +21 lines)
Lines 74-104 $user ||= q{}; Link Here
74
74
75
our $branch = C4::Context->userenv->{'branch'};
75
our $branch = C4::Context->userenv->{'branch'};
76
76
77
my $writeoff_item = $input->param('confirm_writeoff');
77
if ( $input->param('paycollect') ) {
78
my $paycollect    = $input->param('paycollect');
79
if ($paycollect) {
80
    print $input->redirect(
78
    print $input->redirect(
81
        "/cgi-bin/koha/members/paycollect.pl?borrowernumber=$borrowernumber");
79
        "/cgi-bin/koha/members/paycollect.pl?borrowernumber=$borrowernumber");
82
}
80
}
83
my $payselected = $input->param('payselected');
81
elsif ( $input->param('payselected') ) {
84
if ($payselected) {
82
    payselected({ params => \@names });
85
    payselected(@names);
86
}
83
}
87
84
elsif ( $input->param('writeoff_selected') ) {
88
my $writeoff_all = $input->param('woall');    # writeoff all fines
85
    payselected({ params => \@names, type => 'writeoff' });
89
if ($writeoff_all) {
86
}
87
elsif ( $input->param('woall') ) {
90
    writeoff_all(@names);
88
    writeoff_all(@names);
91
} elsif ($writeoff_item) {
89
}
90
elsif ( $input->param('confirm_writeoff') ) {
92
    my $accountlines_id = $input->param('accountlines_id');
91
    my $accountlines_id = $input->param('accountlines_id');
93
    my $amount       = $input->param('amountwrittenoff');
92
    my $amount          = $input->param('amountwrittenoff');
94
    my $payment_note = $input->param("payment_note");
93
    my $payment_note    = $input->param("payment_note");
95
94
96
    Koha::Account->new( { patron_id => $borrowernumber } )->pay(
95
    Koha::Account->new( { patron_id => $borrowernumber } )->pay(
97
        {
96
        {
98
            amount     => $amount,
97
            amount => $amount,
99
            lines      => [ scalar Koha::Account::Lines->find($accountlines_id) ],
98
            lines  => [ scalar Koha::Account::Lines->find($accountlines_id) ],
100
            type       => 'writeoff',
99
            type   => 'writeoff',
101
            note       => $payment_note,
100
            note   => $payment_note,
102
            library_id => $branch,
101
            library_id => $branch,
103
        }
102
        }
104
    );
103
    );
Lines 238-244 sub borrower_add_additional_fields { Link Here
238
}
237
}
239
238
240
sub payselected {
239
sub payselected {
241
    my @params = @_;
240
    my $parameters = shift;
241
242
    my @params = @{ $parameters->{params} };
243
    my $type = $parameters->{type} || 'payment';
244
242
    my $amt    = 0;
245
    my $amt    = 0;
243
    my @lines_to_pay;
246
    my @lines_to_pay;
244
    foreach (@params) {
247
    foreach (@params) {
Lines 253-258 sub payselected { Link Here
253
    my $notes = '&notes=' . join("%0A", map { scalar $input->param("payment_note_$_") } @lines_to_pay );
256
    my $notes = '&notes=' . join("%0A", map { scalar $input->param("payment_note_$_") } @lines_to_pay );
254
    my $redirect =
257
    my $redirect =
255
        "/cgi-bin/koha/members/paycollect.pl?borrowernumber=$borrowernumber"
258
        "/cgi-bin/koha/members/paycollect.pl?borrowernumber=$borrowernumber"
259
      . "&type=$type"
256
      . $amt
260
      . $amt
257
      . $sel
261
      . $sel
258
      . $notes;
262
      . $notes;
(-)a/members/paycollect.pl (-1 / +3 lines)
Lines 69-74 my $select_lines = $input->param('selected'); Link Here
69
my $select       = $input->param('selected_accts');
69
my $select       = $input->param('selected_accts');
70
my $payment_note = uri_unescape scalar $input->param('payment_note');
70
my $payment_note = uri_unescape scalar $input->param('payment_note');
71
my $payment_type = scalar $input->param('payment_type');
71
my $payment_type = scalar $input->param('payment_type');
72
my $type         = scalar $input->param('type') || 'payment',
72
my $accountlines_id;
73
my $accountlines_id;
73
74
74
if ( $individual || $writeoff ) {
75
if ( $individual || $writeoff ) {
Lines 153-158 if ( $total_paid and $total_paid ne '0.00' ) { Link Here
153
                    }
154
                    }
154
                  )->pay(
155
                  )->pay(
155
                    {
156
                    {
157
                        type         => $type,
156
                        amount       => $total_paid,
158
                        amount       => $total_paid,
157
                        lines        => \@lines,
159
                        lines        => \@lines,
158
                        note         => $note,
160
                        note         => $note,
Lines 183-188 borrower_add_additional_fields($borrower, $template); Link Here
183
$template->param(%$borrower);
185
$template->param(%$borrower);
184
186
185
$template->param(
187
$template->param(
188
    type           => $type,
186
    borrowernumber => $borrowernumber,    # some templates require global
189
    borrowernumber => $borrowernumber,    # some templates require global
187
    patron        => $patron,
190
    patron        => $patron,
188
    total         => $total_due,
191
    total         => $total_due,
189
- 

Return to bug 19617