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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tt (-1 / +1 lines)
Lines 144-150 Link Here
144
                                        data-accountline="[% account.accountlines_id | html %]"
144
                                        data-accountline="[% account.accountlines_id | html %]"
145
                                        data-note="[% account.note | html %]"
145
                                        data-note="[% account.note | html %]"
146
                                        data-member="[% account.borrowernumber | html %]"
146
                                        data-member="[% account.borrowernumber | html %]"
147
                                        ><i class="fa-solid fa-pen"></i> Edit</button
147
                                        >[% IF account.note %]<i class="fa-solid fa-pen"></i> Edit[% ELSE %]<i class="fa-solid fa-plus"></i>Add[% END %]</button
148
                                    >
148
                                    >
149
                                [% END %]
149
                                [% END %]
150
                            </td>
150
                            </td>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/pay.tt (-8 / +70 lines)
Lines 170-184 Link Here
170
                                        </td>
170
                                        </td>
171
                                        <td class="actions">
171
                                        <td class="actions">
172
                                            [% IF line.note %]
172
                                            [% IF line.note %]
173
                                                <a href="#" class="add-note" data-accountlines_id="[% line.accountlines_id | html %]" style="display:none;"><i class="fa fa-plus"></i> Add note</a>
173
                                                [% line.note | html_line_break %]
174
                                                <span class="payment_note" id="payment_note_[% line.accountlines_id | html %]"
174
                                                [% IF CAN_user_updatecharges_edit_accountline_notes %]
175
                                                    ><input type="text" size="10" name="payment_note_[% line.accountlines_id | html %]" value="[% line.note | html %]" /> <a href="#" class="cancel-note"><i class="fa fa-times"></i></a
175
                                                    <button
176
                                                ></span>
176
                                                        type="button"
177
                                                        class="btn btn-default btn-xs edit-action"
178
                                                        data-bs-toggle="modal"
179
                                                        data-bs-target="#editNoteModal"
180
                                                        data-accountline="[% line.accountlines_id | html %]"
181
                                                        data-note="[% line.note | html %]"
182
                                                        data-member="[% line.borrowernumber | html %]"
183
                                                        ><i class="fa-solid fa-pen"></i> Edit</button
184
                                                    >
185
                                                [% END %]
177
                                            [% ELSE %]
186
                                            [% ELSE %]
178
                                                <a href="#" class="add-note" data-accountlines_id="[% line.accountlines_id | html %]"><i class="fa fa-plus"></i> Add note</a>
187
                                                <button
179
                                                <span class="payment_note" id="payment_note_[% line.accountlines_id | html %]" style="display:none"
188
                                                    type="button"
180
                                                    ><input type="text" size="10" name="payment_note_[% line.accountlines_id | html %]" value="" /> <a href="#" class="cancel-note"><i class="fa fa-times"></i></a
189
                                                    class="btn btn-default btn-xs edit-action"
181
                                                ></span>
190
                                                    data-bs-toggle="modal"
191
                                                    data-bs-target="#editNoteModal"
192
                                                    data-accountline="[% line.accountlines_id | html %]"
193
                                                    data-note="[% line.note | html %]"
194
                                                    data-member="[% line.borrowernumber | html %]"
195
                                                    ><i class="fa-solid fa-plus"></i> Add</button
196
                                                >
182
                                            [% END %]
197
                                            [% END %]
183
                                        </td>
198
                                        </td>
184
                                        <td class="debit" style="text-align: right;">[% line.amount | $Price %]</td>
199
                                        <td class="debit" style="text-align: right;">[% line.amount | $Price %]</td>
Lines 228-234 Link Here
228
    </div>
243
    </div>
229
    <!-- /.toptabs -->
244
    <!-- /.toptabs -->
230
[% END %]
245
[% END %]
246
<!-- Edit note modal -->
247
<div class="modal" id="editNoteModal" tabindex="-1" role="dialog" aria-labelledby="editNoteLabel">
248
    <form id="edit_form" action="/cgi-bin/koha/members/pay.pl" method="post" enctype="multipart/form-data" class="validated">
249
        [% INCLUDE 'csrf-token.inc' %]
250
        <input type="hidden" name="accountlines_id" value="" id="noteline" />
251
        <input type="hidden" name="op" value="cud-edit_note" />
252
        <input type="hidden" name="borrowernumber" value="[% line.borrowernumber | html %]" />
253
254
        <div class="modal-dialog" role="document">
255
            <div class="modal-content">
256
                <div class="modal-header">
257
                    <h1 class="modal-title" id="editNoteLabel">Edit note</h1>
258
                    <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
259
                </div>
260
261
                <div class="modal-body">
262
                    <fieldset class="rows">
263
                        <ol>
264
                            <li>
265
                                <label for="payment_note">Note: </label>
266
                                <textarea id="payment_note" name="payment_note" rows="5" cols="30"></textarea>
267
                            </li>
268
                        </ol>
269
                    </fieldset>
270
                    <!-- /.rows -->
271
                </div>
272
                <!-- /.modal-body -->
231
273
274
                <div class="modal-footer">
275
                    <button type="submit" class="btn btn-default">Confirm</button>
276
                    <button type="button" class="btn btn-default" data-bs-dismiss="modal">Cancel</button>
277
                </div>
278
                <!-- /.modal-footer -->
279
            </div>
280
            <!-- /.modal-content -->
281
        </div>
282
        <!-- /.modal-dialog -->
283
    </form>
284
    <!-- /#void_form -->
285
</div>
286
<!-- /#editNoteModal -->
232
[% MACRO jsinclude BLOCK %]
287
[% MACRO jsinclude BLOCK %]
233
    [% INCLUDE 'str/members-menu.inc' %]
288
    [% INCLUDE 'str/members-menu.inc' %]
234
    [% Asset.js("js/members-menu.js") | $raw %]
289
    [% Asset.js("js/members-menu.js") | $raw %]
Lines 296-301 Link Here
296
                table_settings
351
                table_settings
297
            );
352
            );
298
        });
353
        });
354
        $("#editNoteModal").on("shown.bs.modal", function(e) {
355
            var button = $(e.relatedTarget);
356
            var accountline = button.data('accountline');
357
            $('#noteline').val(accountline);
358
            var note = button.data('note');
359
            $('#payment_note').val(note);
360
            });
299
    </script>
361
    </script>
300
[% END %]
362
[% END %]
301
363
(-)a/members/pay.pl (-1 / +20 lines)
Lines 98-104 if ( $op eq 'cud-paycollect' ) { Link Here
98
} elsif ( $op eq 'cud-apply_credits' ) {
98
} elsif ( $op eq 'cud-apply_credits' ) {
99
    apply_credits( { patron => $patron, cgi => $input } );
99
    apply_credits( { patron => $patron, cgi => $input } );
100
}
100
}
101
if ( $op eq 'cud-edit_note' ) {
101
102
103
    output_and_exit_if_error( $input, $cookie, $template, { check => 'csrf_token' } );
104
105
    my $payment_id = scalar $input->param('accountlines_id');
106
    my $note       = scalar $input->param('edited_note');
107
    my $schema     = Koha::Database->new->schema;
108
    my $payment    = Koha::Account::Lines->find($payment_id);
109
110
    $schema->txn_do(
111
        sub {
112
            # Update the note and date in the account line
113
            $payment->set(
114
                {
115
                    date => \'NOW()',
116
                    note => $note
117
                }
118
            )->store();
119
        }
120
    );
121
}
102
for (@names) {
122
for (@names) {
103
    if ( $op =~ /^cud-pay_indiv_(\d+)$/ ) {
123
    if ( $op =~ /^cud-pay_indiv_(\d+)$/ ) {
104
        my $line_no = $1;
124
        my $line_no = $1;
105
- 

Return to bug 40795