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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/paycollect.tt (-9 / +69 lines)
Lines 36-47 Link Here
36
    </li>
36
    </li>
37
</ul>
37
</ul>
38
<div class="tabs-container">
38
<div class="tabs-container">
39
[% IF ( error_over ) %]
39
[% IF (error_negative) %]
40
    <div id="error_message" class="dialog alert">
40
    <div id="error_message" class="dialog alert">
41
    You must pay a value less than or equal to [% total_due | format('%.2f') %].
41
        <span>The amount paid can't be negative!</span>
42
    </div>
42
    </div>
43
[% END %]
43
[% END %]
44
44
45
[% IF (error_collected_less) %]
46
    <div id="error_message" class="dialog alert">
47
        <span>The amount collected can't be lower than the amount paid!</span>
48
    </div>
49
[% END %]
50
51
[% UNLESS (writeoff_individual) %]
52
    <form name="payform" id="payform" action="/cgi-bin/koha/members/paycollect.pl" method="post">
53
[% END %]
54
55
[% IF (give_change) %]
56
    <div id="change_message" class="dialog message">
57
        <span>The amount collected is greater than the total amount paid.</span><br />
58
        <strong>Change to give back: [% give_change %]</strong><br /><br />
59
        <input type="submit" name="submitbutton" value="Confirm payment" />
60
        <a class="cancel" href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% borrower.borrowernumber %]">Cancel</a>
61
     </div>
62
[% END %]
63
45
[% IF ( pay_individual ) %]
64
[% IF ( pay_individual ) %]
46
    <form name="payindivfine" id="payindivfine" method="post" action="/cgi-bin/koha/members/paycollect.pl">
65
    <form name="payindivfine" id="payindivfine" method="post" action="/cgi-bin/koha/members/paycollect.pl">
47
    <input type="hidden" name="csrf_token" value="[% csrf_token %]" />
66
    <input type="hidden" name="csrf_token" value="[% csrf_token %]" />
Lines 79-90 Link Here
79
</table>
98
</table>
80
99
81
<ol>
100
<ol>
82
101
    [% IF ( give_change ) %]
102
    <li>
103
        <label for="paid">Amount paid:</label>
104
        <input type="hidden" name="paid" id="paid" value="[% amount_paid %]" />
105
        <input type="hidden" name="collected" id="collected" value="[% amount_paid %]" />
106
        [% amount_paid %]
107
    </li>
108
    <li>
109
        <label>Collect from patron:</label>
110
        [% amount_collected %]
111
    </li>
83
    <li>
112
    <li>
84
        <label for="paid">Collect from patron: </label>
113
        <label>Change to give back:</label>
85
            <!-- default to paying all -->
114
        [% give_change %]
86
        <input name="paid" id="paid" value="[% amountoutstanding %]" />
87
    </li>
115
    </li>
116
    [% ELSE %]
117
    <li>
118
        <label for="paid">Amount paid :</label>
119
        <input name="paid" id="paid" value="[% amountoutstanding | format('%.2f') %]" onchange="moneyFormat(document.payform.paid)"/>
120
        [% amount_paid %]
121
    </li>
122
    <li>
123
        <label for="collected">Collect from patron:</label>
124
        <input name="collected" id="collected" value="[% amountoutstanding | format('%.2f') %]" onchange="moneyFormat(document.payform.collected)" />
125
    </li>
126
    [% END %]
88
</ol>
127
</ol>
89
</fieldset>
128
</fieldset>
90
129
Lines 147-157 Link Here
147
            <span class="label">Total amount outstanding: </span>
186
            <span class="label">Total amount outstanding: </span>
148
            <span class="debit">[% total | format('%.2f') %]</span>
187
            <span class="debit">[% total | format('%.2f') %]</span>
149
        </li>
188
        </li>
189
    [% IF ( give_change ) %]
190
    <li>
191
        <label for="paid">Amount paid:</label>
192
        <input type="hidden" name="paid" id="paid" value="[% amount_paid %]" />
193
        [% amount_paid %]
194
    </li>
195
    <li>
196
        <label>Collected from patron:</label>
197
        <input type="hidden" name="collected" id="collected" value="[% amount_paid %]" />
198
        [% amount_collected %]
199
    </li>
200
    <li>
201
        <label>Change to give back:</label>
202
        [% give_change %]
203
    </li>
204
    [% ELSE %]
205
    <li>
206
        <label for="paid">Amount paid :</label>
207
        <input name="paid" id="paid" value="[% total | format('%.2f') %]" onchange="moneyFormat(document.payform.paid)" />
208
    </li>
150
    <li>
209
    <li>
151
        <label for="paid">Collect from patron: </label>
210
        <label for="collected">Collect from patron:</label>
152
        <!-- default to paying all -->
211
        <!-- default to paying all -->
153
        <input name="paid" id="paid" value="[% total | format('%.2f') %]" />
212
        <input name="collected" id="collected" value="[% total | format('%.2f') %]" onchange="moneyFormat(document.payform.collected)"/>
154
    </li>
213
    </li>
214
    [% END %]
155
    <li>
215
    <li>
156
        <label for="selected_accts_notes">Note: </label>
216
        <label for="selected_accts_notes">Note: </label>
157
        <textarea name="selected_accts_notes" id="selected_accts_notes">[% selected_accts_notes %]</textarea>
217
        <textarea name="selected_accts_notes" id="selected_accts_notes">[% selected_accts_notes %]</textarea>
Lines 175-181 Link Here
175
    <script type="text/javascript" src="[% interface %]/[% theme %]/js/members-menu_[% KOHA_VERSION %].js"></script>
235
    <script type="text/javascript" src="[% interface %]/[% theme %]/js/members-menu_[% KOHA_VERSION %].js"></script>
176
    <script type= "text/javascript">
236
    <script type= "text/javascript">
177
        $(document).ready(function() {
237
        $(document).ready(function() {
178
            $('#payindivfine, #woindivfine, #payfine').preventDoubleFormSubmit();
238
            $('#payindivfine, #woindivfine, #payfine, #payform').preventDoubleFormSubmit();
179
            $("#paid").on("change",function(){
239
            $("#paid").on("change",function(){
180
                moneyFormat( this );
240
                moneyFormat( this );
181
            });
241
            });
(-)a/members/paycollect.pl (-7 / +25 lines)
Lines 60-65 my $branch = C4::Context->userenv->{'branch'}; Link Here
60
60
61
my ( $total_due, $accts, $numaccts ) = GetMemberAccountRecords($borrowernumber);
61
my ( $total_due, $accts, $numaccts ) = GetMemberAccountRecords($borrowernumber);
62
my $total_paid = $input->param('paid');
62
my $total_paid = $input->param('paid');
63
my $total_collected = $input->param('collected');
63
64
64
my $individual   = $input->param('pay_individual');
65
my $individual   = $input->param('pay_individual');
65
my $writeoff     = $input->param('writeoff_individual');
66
my $writeoff     = $input->param('writeoff_individual');
Lines 92-111 if ( $individual || $writeoff ) { Link Here
92
        individual_description => $description,
93
        individual_description => $description,
93
        payment_note    => $payment_note,
94
        payment_note    => $payment_note,
94
    );
95
    );
95
} elsif ($select_lines) {
96
} elsif ($select) {
96
    $total_due = $input->param('amt');
97
    $total_due = ($input->param('amt') || $input->param('total'));
97
    $template->param(
98
    $template->param(
98
        selected_accts => $select_lines,
99
        selected_accts => $select,
99
        amt            => $total_due,
100
        amt            => $total_due,
100
        selected_accts_notes => scalar $input->param('notes'),
101
        selected_accts_notes => scalar $input->param('notes'),
101
    );
102
    );
102
}
103
}
103
104
104
if ( $total_paid and $total_paid ne '0.00' ) {
105
if ( $total_paid and $total_paid ne '0.00' ) {
105
    if ( $total_paid < 0 or $total_paid > $total_due ) {
106
    if ( $total_paid < 0 ) {
106
        $template->param(
107
        $template->param(
107
            error_over => 1,
108
            error_negative => 1,
108
            total_due => $total_due
109
        );
110
    }
111
    elsif (($total_collected - $total_paid) < 0) {
112
        $template->param(
113
            error_collected_less => 1,
114
        );
115
    }
116
    elsif ($total_paid >=  $total_due and $total_collected ne $total_paid) {
117
        $template->param(
118
            amount_paid => sprintf('%.2f', $total_due),
119
            amount_collected => sprintf('%.2f', $total_collected),
120
            give_change => sprintf('%.2f',($total_collected-$total_due))
121
        );
122
    }
123
    elsif ($total_paid < $total_due and $total_collected ne $total_paid) {
124
         $template->param(
125
            amount_paid => sprintf('%.2f', $total_paid),
126
            amount_collected => sprintf('%.2f', $total_collected),
127
            give_change => sprintf('%.2f',($total_collected-$total_paid))
109
        );
128
        );
110
    } else {
129
    } else {
111
        die "Wrong CSRF token"
130
        die "Wrong CSRF token"
112
- 

Return to bug 11373