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

(-)a/C4/Circulation.pm (+6 lines)
Lines 63-68 use Koha::Exceptions::Checkout; Link Here
63
use Koha::Plugins;
63
use Koha::Plugins;
64
use Koha::Recalls;
64
use Koha::Recalls;
65
use Koha::Library::Hours;
65
use Koha::Library::Hours;
66
use Koha::Bookings;
66
use Carp qw( carp );
67
use Carp qw( carp );
67
use List::MoreUtils qw( any );
68
use List::MoreUtils qw( any );
68
use Scalar::Util qw( looks_like_number blessed );
69
use Scalar::Util qw( looks_like_number blessed );
Lines 1552-1557 sub AddIssue { Link Here
1552
    my $auto_renew = $params && $params->{auto_renew};
1553
    my $auto_renew = $params && $params->{auto_renew};
1553
    my $cancel_recall = $params && $params->{cancel_recall};
1554
    my $cancel_recall = $params && $params->{cancel_recall};
1554
    my $recall_id = $params && $params->{recall_id};
1555
    my $recall_id = $params && $params->{recall_id};
1556
    my $booking_id = $params && $params->{booking_id};
1555
    my $dbh          = C4::Context->dbh;
1557
    my $dbh          = C4::Context->dbh;
1556
    my $barcodecheck = CheckValidBarcode($barcode);
1558
    my $barcodecheck = CheckValidBarcode($barcode);
1557
1559
Lines 1733-1738 sub AddIssue { Link Here
1733
                    q{DELETE tmp_holdsqueue, hold_fill_targets FROM tmp_holdsqueue LEFT JOIN hold_fill_targets USING ( itemnumber ) WHERE itemnumber = ?},
1735
                    q{DELETE tmp_holdsqueue, hold_fill_targets FROM tmp_holdsqueue LEFT JOIN hold_fill_targets USING ( itemnumber ) WHERE itemnumber = ?},
1734
                    undef, $item_object->id
1736
                    undef, $item_object->id
1735
                );
1737
                );
1738
1739
                if ($booking_id) {
1740
                    Koha::Bookings->find( { booking_id => $booking_id } )->delete({ 'transform_to_checkout' => 1 });
1741
                }
1736
            }
1742
            }
1737
            $issue->discard_changes;
1743
            $issue->discard_changes;
1738
            $patron->update_lastseen('check_out');
1744
            $patron->update_lastseen('check_out');
(-)a/Koha/Booking.pm (-1 / +3 lines)
Lines 251-261 sub to_api_mapping { Link Here
251
=cut
251
=cut
252
252
253
sub delete {
253
sub delete {
254
    my ($self) = @_;
254
    my ( $self, $params ) = @_;
255
255
256
    my $patron         = $self->patron;
256
    my $patron         = $self->patron;
257
    my $pickup_library = $self->pickup_library;
257
    my $pickup_library = $self->pickup_library;
258
258
259
    if ( not  defined( $params->{'transform_to_checkout'} ) ) {
259
    my $letter = C4::Letters::GetPreparedLetter(
260
    my $letter = C4::Letters::GetPreparedLetter(
260
        module                 => 'bookings',
261
        module                 => 'bookings',
261
        letter_code            => 'BOOKING_CANCELLATION',
262
        letter_code            => 'BOOKING_CANCELLATION',
Lines 277-282 sub delete { Link Here
277
278
278
    my $deleted = $self->SUPER::delete($self);
279
    my $deleted = $self->SUPER::delete($self);
279
    return $deleted;
280
    return $deleted;
281
    }
280
}
282
}
281
283
282
=head2 Internal methods
284
=head2 Internal methods
(-)a/bookings/list.pl (-2 / +8 lines)
Lines 21-28 use Modern::Perl; Link Here
21
21
22
use CGI qw ( -utf8 );
22
use CGI qw ( -utf8 );
23
23
24
use Koha::Biblios;
25
use Koha::Bookings;
26
use Koha::Patrons;
27
use Koha::Items;
28
use Koha::CirculationRules;
29
24
use C4::Output qw( output_html_with_http_headers );
30
use C4::Output qw( output_html_with_http_headers );
25
use C4::Auth qw( get_template_and_user );
31
use C4::Auth   qw( get_template_and_user );
26
32
27
my $input = CGI->new;
33
my $input = CGI->new;
28
my ( $template, $borrowernumber, $cookie, $flags ) = get_template_and_user(
34
my ( $template, $borrowernumber, $cookie, $flags ) = get_template_and_user(
Lines 35-41 my ( $template, $borrowernumber, $cookie, $flags ) = get_template_and_user( Link Here
35
);
41
);
36
42
37
my $biblionumber = $input->param('biblionumber');
43
my $biblionumber = $input->param('biblionumber');
38
my $biblio       = Koha::Biblios->find($biblionumber);
44
my $biblio       = Koha::Biblios->find( { biblionumber => $biblionumber } );
39
45
40
$template->param(
46
$template->param(
41
    biblionumber => $biblionumber,
47
    biblionumber => $biblionumber,
(-)a/circ/circulation.pl (-1 / +4 lines)
Lines 57-62 use Koha::SearchEngine; Link Here
57
use Koha::SearchEngine::Search;
57
use Koha::SearchEngine::Search;
58
use Koha::Patron::Modifications;
58
use Koha::Patron::Modifications;
59
use Koha::Token;
59
use Koha::Token;
60
use Koha::Bookings;
60
61
61
use List::MoreUtils qw( uniq );
62
use List::MoreUtils qw( uniq );
62
63
Lines 68-73 my $query = CGI->new; Link Here
68
my $borrowernumber = $query->param('borrowernumber');
69
my $borrowernumber = $query->param('borrowernumber');
69
my $barcodes       = [];
70
my $barcodes       = [];
70
my $barcode        = $query->param('barcode');
71
my $barcode        = $query->param('barcode');
72
my $booking_id = $query->param('booking_id');
71
73
72
74
73
# Barcode given by user could be '0'
75
# Barcode given by user could be '0'
Lines 524-530 if (@$barcodes && $op eq 'cud-checkout') { Link Here
524
                {
526
                {
525
                    onsite_checkout        => $onsite_checkout,        auto_renew    => $session->param('auto_renew'),
527
                    onsite_checkout        => $onsite_checkout,        auto_renew    => $session->param('auto_renew'),
526
                    switch_onsite_checkout => $switch_onsite_checkout, cancel_recall => $cancel_recall,
528
                    switch_onsite_checkout => $switch_onsite_checkout, cancel_recall => $cancel_recall,
527
                    recall_id              => $recall_id,
529
                    recall_id              => $recall_id,              booking_id    => $booking_id
528
                }
530
                }
529
            );
531
            );
530
            $template_params->{issue} = $issue;
532
            $template_params->{issue} = $issue;
Lines 765-770 $template->param( Link Here
765
    nopermission              => scalar $query->param('nopermission'),
767
    nopermission              => scalar $query->param('nopermission'),
766
    autoswitched              => $autoswitched,
768
    autoswitched              => $autoswitched,
767
    logged_in_user            => $logged_in_user,
769
    logged_in_user            => $logged_in_user,
770
    booking_id                => $booking_id || '',
768
);
771
);
769
772
770
output_html_with_http_headers $query, $cookie, $template->output;
773
output_html_with_http_headers $query, $cookie, $template->output;
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/bookings/list.tt (-2 / +3 lines)
Lines 310-317 Link Here
310
                "render": function(data, type, row, meta) {
310
                "render": function(data, type, row, meta) {
311
                    let result = "";
311
                    let result = "";
312
                    [% IF CAN_user_circulate_manage_bookings %]
312
                    [% IF CAN_user_circulate_manage_bookings %]
313
                    result += '<button type="button" class="btn btn-default btn-xs edit-action" data-bs-toggle="modal" data-bs-target="#placeBookingModal" data-booking="'+row.booking_id+'" data-biblionumber="[% biblionumber | uri %]" data-itemnumber="'+row.item_id+'" data-patron="'+row.patron_id+'" data-pickup_library="'+row.pickup_library_id+'" data-start_date="'+row.start_date+'" data-end_date="'+row.end_date+'"><i class="fa fa-pencil" aria-hidden="true"></i> '+_("Edit")+'</button>';
313
                    result += '<button type="button" class="btn btn-default btn-xs edit-action" data-toggle="modal" data-target="#placeBookingModal" data-booking="'+row.booking_id+'" data-biblionumber="[% biblionumber | uri %]" data-itemnumber="'+row.item_id+'" data-patron="'+row.patron_id+'" data-pickup_library="'+row.pickup_library_id+'" data-start_date="'+row.start_date+'" data-end_date="'+row.end_date+'"><i class="fa fa-pencil" aria-hidden="true"></i> '+_("Edit")+'</button>';
314
                    result += '<button type="button" class="btn btn-default btn-xs cancel-action" data-bs-toggle="modal" data-bs-target="#cancelBookingModal" data-booking="'+row.booking_id+'"><i class="fa fa-trash" aria-hidden="true"></i> '+_("Cancel")+'</button>';
314
                    result += '<button type="button" class="btn btn-default btn-xs cancel-action" data-toggle="modal" data-target="#cancelBookingModal" data-booking="'+row.booking_id+'"><i class="fa fa-trash" aria-hidden="true"></i> '+_("Cancel")+'</button>';
315
                    result += `<form name="checkout-transform" method="post" action="/cgi-bin/koha/circ/circulation.pl?borrowernumber=${row.patron_id}"><input type="hidden" name="op" value="cud-checkout"/><input type="hidden" name="borrowernumber" value="${row.patron_id}"/><input type="hidden" name="barcode" value="${row.item.external_id}"/><input type="hidden" name="duedatespec" value="${row.end_date}"/><input type="hidden" name="booking_id" value="${row.booking_id}"/><button id="checkout_action" class="btn btn-default btn-xs" type="submit">${_("Transform to checkout")}</button></form>`;
315
                    [% END %]
316
                    [% END %]
316
                    return result;
317
                    return result;
317
                }
318
                }
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt (-3 / +10 lines)
Lines 9-14 Link Here
9
[% USE ItemTypes %]
9
[% USE ItemTypes %]
10
[% USE Price %]
10
[% USE Price %]
11
[% USE AuthorisedValues %]
11
[% USE AuthorisedValues %]
12
[% USE JSON.Escape %]
12
[% PROCESS 'i18n.inc' %]
13
[% PROCESS 'i18n.inc' %]
13
[% SET footerjs = 1 %]
14
[% SET footerjs = 1 %]
14
[% INCLUDE 'doc-head-open.inc' %]
15
[% INCLUDE 'doc-head-open.inc' %]
Lines 282-287 Link Here
282
                                    <fieldset>
283
                                    <fieldset>
283
                                    <input type="hidden" name="restoreduedatespec" />
284
                                    <input type="hidden" name="restoreduedatespec" />
284
                                    <input type="hidden" name="op" value="cud-checkout" />
285
                                    <input type="hidden" name="op" value="cud-checkout" />
286
                                    <input type="hidden" name="booking_id" value="[% booking_id | html %]"/>
285
287
286
                                    [% IF (forceallow) %]<input type="hidden" name="forceallow" value="1">[% END %]
288
                                    [% IF (forceallow) %]<input type="hidden" name="forceallow" value="1">[% END %]
287
289
Lines 390-395 Link Here
390
                                    [% INCLUDE 'csrf-token.inc' %]
392
                                    [% INCLUDE 'csrf-token.inc' %]
391
                                    <input type="hidden" name="op" value="cud-checkout" />
393
                                    <input type="hidden" name="op" value="cud-checkout" />
392
                                    <input type="hidden" name="restoreduedatespec" />
394
                                    <input type="hidden" name="restoreduedatespec" />
395
                                    <input type="hidden" name="booking_id" value="[% booking_id | html %]"/>
393
396
394
                                    [% IF (forceallow) %]<input type="hidden" name="forceallow" value="1">[% END %]
397
                                    [% IF (forceallow) %]<input type="hidden" name="forceallow" value="1">[% END %]
395
398
Lines 423-429 Link Here
423
                                    <input type="hidden" name="hold_borrower" value="[% resborrowernumber | html %]" />
426
                                    <input type="hidden" name="hold_borrower" value="[% resborrowernumber | html %]" />
424
                                    <input type="hidden" name="hold_itemnumber" value="[% item.itemnumber | html %]" />
427
                                    <input type="hidden" name="hold_itemnumber" value="[% item.itemnumber | html %]" />
425
                                    <input type="hidden" name="stickyduedate" value="[% stickyduedate | html %]" />
428
                                    <input type="hidden" name="stickyduedate" value="[% stickyduedate | html %]" />
426
                                    <button class="btn btn-default print" type="submit" onclick="Dopop('hold-transfer-slip.pl?reserve_id=[% reserve_id | uri %]&itemnumber=[% item.id | html %]');this.form.submit();"><i class="fa fa-print"></i> Don't check out, confirm hold, and print slip (P)</button>
429
                                    <input type="hidden" name="booking_id" value="[% booking_id | html %]"/>
430
                                    <button class="print" type="submit" onclick="Dopop('hold-transfer-slip.pl?reserve_id=[% reserve_id | uri %]&itemnumber=[% item.id | html %]');this.form.submit();"><i class="fa fa-print"></i> Don't check out, confirm hold, and print slip (P)</button>
427
                                </form>
431
                                </form>
428
                            [% END %]
432
                            [% END %]
429
433
Lines 439-444 Link Here
439
                                <input type="hidden" name="duedatespec" value="[% duedatespec | html %]" />
443
                                <input type="hidden" name="duedatespec" value="[% duedatespec | html %]" />
440
                                <input type="hidden" name="restoreduedatespec" />
444
                                <input type="hidden" name="restoreduedatespec" />
441
                                <input type="hidden" name="stickyduedate" value="[% stickyduedate | html %]" />
445
                                <input type="hidden" name="stickyduedate" value="[% stickyduedate | html %]" />
446
                                <input type="hidden" name="booking_id" value="[% booking_id | html %]"/>
442
                                [% IF CAN_user_circulate_force_checkout or HIGHHOLDS or ADDITIONAL_MATERIALS %]
447
                                [% IF CAN_user_circulate_force_checkout or HIGHHOLDS or ADDITIONAL_MATERIALS %]
443
                                    [% IF ( RENEW_ISSUE ) %]
448
                                    [% IF ( RENEW_ISSUE ) %]
444
                                        <button type="submit" class="btn btn-default deny" accesskey="n"><i class="fa fa-times"></i> No, don't renew (N)</button>
449
                                        <button type="submit" class="btn btn-default deny" accesskey="n"><i class="fa fa-times"></i> No, don't renew (N)</button>
Lines 1053-1059 Link Here
1053
                if ( $("#onsite_checkout").prop('checked') ) {
1058
                if ( $("#onsite_checkout").prop('checked') ) {
1054
                    duedatespec_fp.setDate("[% today_due_date_and_time | $KohaDates dateformat => 'iso', with_hours => 1 %]");
1059
                    duedatespec_fp.setDate("[% today_due_date_and_time | $KohaDates dateformat => 'iso', with_hours => 1 %]");
1055
                } else {
1060
                } else {
1056
                    duedatespec_fp.setDate("");
1061
                    var booking_id = [% booking_id.json %];
1062
                    if (!booking_id) {
1063
                        duedatespec_fp.setDate("");
1064
                    }
1057
                }
1065
                }
1058
            }
1066
            }
1059
        }
1067
        }
1060
- 

Return to bug 36789