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 12-18 Link Here
12
<body id="pat_paycollect" class="pat">
12
<body id="pat_paycollect" class="pat">
13
[% INCLUDE 'header.inc' %]
13
[% INCLUDE 'header.inc' %]
14
[% INCLUDE 'patron-search.inc' %]
14
[% INCLUDE 'patron-search.inc' %]
15
<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>
15
<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>
16
16
17
<div id="doc3" class="yui-t2">
17
<div id="doc3" class="yui-t2">
18
18
Lines 158-173 Link Here
158
    <input type="hidden" name="borrowernumber" id="borrowernumber" value="[% patron.borrowernumber %]" />
158
    <input type="hidden" name="borrowernumber" id="borrowernumber" value="[% patron.borrowernumber %]" />
159
    <input type="hidden" name="selected_accts" id="selected_accts" value="[% selected_accts %]" />
159
    <input type="hidden" name="selected_accts" id="selected_accts" value="[% selected_accts %]" />
160
    <input type="hidden" name="total" id="total" value="[% total %]" />
160
    <input type="hidden" name="total" id="total" value="[% total %]" />
161
    <input type="hidden" name="type" value="[% type %]" />
161
162
162
    <fieldset class="rows">
163
    <fieldset class="rows">
163
    [% IF ( selected_accts ) %]<legend>Pay an amount toward selected fines</legend>[% ELSE %]<legend>Pay an amount toward all fines</legend>[% END %]
164
    [% IF ( selected_accts ) %]
165
        [% IF type == 'writeoff' %]
166
            <legend>Write off an amount toward selected fines</legend>
167
        [% ELSE %]
168
            <legend>Pay an amount toward selected fines</legend>
169
        [% END %]
170
    [% ELSE %]
171
        <legend>Pay an amount toward all fines</legend>
172
    [% END %]
173
164
    <ol>
174
    <ol>
165
        <li>
175
        <li>
166
            <span class="label">Total amount outstanding: </span>
176
            <span class="label">Total amount outstanding: </span>
167
            <span class="debit">[% total | format('%.2f') %]</span>
177
            <span class="debit">[% total | format('%.2f') %]</span>
168
        </li>
178
        </li>
169
    <li>
179
    <li>
170
        <label for="paid">Collect from patron: </label>
180
        [% IF type == 'writeoff' %]
181
            <label for="paid">Writeoff amount: </label>
182
        [% ELSE %]
183
            <label for="paid">Collect from patron: </label>
184
        [% END %]
171
        <!-- default to paying all -->
185
        <!-- default to paying all -->
172
        <input name="paid" id="paid" value="[% total | format('%.2f') %]" />
186
        <input name="paid" id="paid" value="[% total | format('%.2f') %]" />
173
    </li>
187
    </li>
Lines 189-196 Link Here
189
    </li>
203
    </li>
190
    </ol>
204
    </ol>
191
    </fieldset>
205
    </fieldset>
192
    <div class="action"><input type="submit" name="submitbutton" value="Confirm" />
206
    <div class="action">
193
        <a class="cancel" href="/cgi-bin/koha/members/boraccount.pl?borrowernumber=[% patron.borrowernumber %]">Cancel</a></div>
207
        <input type="submit" name="submitbutton" value="Confirm" />
208
        <a class="cancel" href="/cgi-bin/koha/members/boraccount.pl?borrowernumber=[% patron.borrowernumber %]">Cancel</a>
209
    </div>
194
    </form>
210
    </form>
195
[% END %]
211
[% END %]
196
</div></div>
212
</div></div>
(-)a/members/pay.pl (-13 / +17 lines)
Lines 74-97 $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
    my $accountline = Koha::Account::Lines->find( $accountlines_id );
95
    my $accountline = Koha::Account::Lines->find( $accountlines_id );
97
96
Lines 252-258 sub borrower_add_additional_fields { Link Here
252
}
251
}
253
252
254
sub payselected {
253
sub payselected {
255
    my @params = @_;
254
    my $parameters = shift;
255
256
    my @params = @{ $parameters->{params} };
257
    my $type = $parameters->{type} || 'payment';
258
256
    my $amt    = 0;
259
    my $amt    = 0;
257
    my @lines_to_pay;
260
    my @lines_to_pay;
258
    foreach (@params) {
261
    foreach (@params) {
Lines 267-272 sub payselected { Link Here
267
    my $notes = '&notes=' . join("%0A", map { scalar $input->param("payment_note_$_") } @lines_to_pay );
270
    my $notes = '&notes=' . join("%0A", map { scalar $input->param("payment_note_$_") } @lines_to_pay );
268
    my $redirect =
271
    my $redirect =
269
        "/cgi-bin/koha/members/paycollect.pl?borrowernumber=$borrowernumber"
272
        "/cgi-bin/koha/members/paycollect.pl?borrowernumber=$borrowernumber"
273
      . "&type=$type"
270
      . $amt
274
      . $amt
271
      . $sel
275
      . $sel
272
      . $notes;
276
      . $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 187-192 if ( $input->param('error_over') ) { Link Here
187
}
189
}
188
190
189
$template->param(
191
$template->param(
192
    type           => $type,
190
    borrowernumber => $borrowernumber,    # some templates require global
193
    borrowernumber => $borrowernumber,    # some templates require global
191
    patron        => $patron,
194
    patron        => $patron,
192
    total         => $total_due,
195
    total         => $total_due,
193
- 

Return to bug 19617