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 1546-1551 sub AddIssue { Link Here
1546
    my $auto_renew = $params && $params->{auto_renew};
1547
    my $auto_renew = $params && $params->{auto_renew};
1547
    my $cancel_recall = $params && $params->{cancel_recall};
1548
    my $cancel_recall = $params && $params->{cancel_recall};
1548
    my $recall_id = $params && $params->{recall_id};
1549
    my $recall_id = $params && $params->{recall_id};
1550
    my $booking_id = $params && $params->{booking_id};
1549
    my $dbh          = C4::Context->dbh;
1551
    my $dbh          = C4::Context->dbh;
1550
    my $barcodecheck = CheckValidBarcode($barcode);
1552
    my $barcodecheck = CheckValidBarcode($barcode);
1551
1553
Lines 1727-1732 sub AddIssue { Link Here
1727
                    q{DELETE tmp_holdsqueue, hold_fill_targets FROM tmp_holdsqueue LEFT JOIN hold_fill_targets USING ( itemnumber ) WHERE itemnumber = ?},
1729
                    q{DELETE tmp_holdsqueue, hold_fill_targets FROM tmp_holdsqueue LEFT JOIN hold_fill_targets USING ( itemnumber ) WHERE itemnumber = ?},
1728
                    undef, $item_object->id
1730
                    undef, $item_object->id
1729
                );
1731
                );
1732
1733
                if ($booking_id) {
1734
                    Koha::Bookings->find( { booking_id => $booking_id } )->delete({ 'transform_to_checkout' => 1 });
1735
                }
1730
            }
1736
            }
1731
            $issue->discard_changes;
1737
            $issue->discard_changes;
1732
            $patron->update_lastseen('check_out');
1738
            $patron->update_lastseen('check_out');
(-)a/Koha/Booking.pm (-15 / +18 lines)
Lines 251-278 $booking->delete(); 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 $deleted = $self->SUPER::delete($self);
256
    my $deleted = $self->SUPER::delete($self);
257
    my $patron  = Koha::Patrons->find( $self->patron_id );
257
    my $patron  = Koha::Patrons->find( $self->patron_id );
258
    my $item    = Koha::Items->find( $self->item_id );
258
    my $item    = Koha::Items->find( $self->item_id );
259
    my $library = Koha::Libraries->find( $self->pickup_library_id );
259
    my $library = Koha::Libraries->find( $self->pickup_library_id );
260
260
261
    if ( not  defined( $params->{'transform_to_checkout'} ) ) {
261
    my $letter = C4::Letters::GetPreparedLetter(
262
    my $letter = C4::Letters::GetPreparedLetter(
262
            module                 => 'bookings',
263
        module                 => 'bookings',
263
            letter_code            => 'BOOKING_CANCELLATION',
264
        letter_code            => 'BOOKING_CANCELLATION',
264
            message_transport_type => 'email',
265
        message_transport_type => 'email',
265
            branchcode             => $patron->branchcode,
266
        branchcode             => $patron->branchcode,
266
            lang                   => $patron->lang,
267
        lang                   => $patron->lang,
267
            tables                 => {
268
        tables                 => {
268
                branches    => $library->branchcode,
269
            branches    => $library->branchcode,
269
                borrowers   => $patron->borrowernumber,
270
            borrowers   => $patron->borrowernumber,
270
                items       => $item->itemnumber,
271
            items       => $item->itemnumber,
271
                biblio      => $item->biblionumber,
272
            biblio      => $item->biblionumber,
272
                biblioitems => $item->biblionumber,
273
            biblioitems => $item->biblionumber,
273
                bookings    => $self->unblessed,
274
            bookings    => $self->unblessed,
274
            }
275
        }
275
        );
276
    );
276
277
277
        if ($letter) {
278
        if ($letter) {
278
            C4::Letters::EnqueueLetter(
279
            C4::Letters::EnqueueLetter(
Lines 283-288 sub delete { Link Here
283
                }
284
                }
284
            );
285
            );
285
        }
286
        }
287
    }
288
286
    return $deleted;
289
    return $deleted;
287
}
290
}
288
291
(-)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 56-61 use Koha::SearchEngine; Link Here
56
use Koha::SearchEngine::Search;
56
use Koha::SearchEngine::Search;
57
use Koha::Patron::Modifications;
57
use Koha::Patron::Modifications;
58
use Koha::Token;
58
use Koha::Token;
59
use Koha::Bookings;
59
60
60
use List::MoreUtils qw( uniq );
61
use List::MoreUtils qw( uniq );
61
62
Lines 67-72 my $query = CGI->new; Link Here
67
my $borrowernumber = $query->param('borrowernumber');
68
my $borrowernumber = $query->param('borrowernumber');
68
my $barcodes       = [];
69
my $barcodes       = [];
69
my $barcode        = $query->param('barcode');
70
my $barcode        = $query->param('barcode');
71
my $booking_id = $query->param('booking_id');
70
72
71
73
72
# Barcode given by user could be '0'
74
# Barcode given by user could be '0'
Lines 514-520 if (@$barcodes && $op eq 'cud-checkout') { Link Here
514
                {
516
                {
515
                    onsite_checkout        => $onsite_checkout,        auto_renew    => $session->param('auto_renew'),
517
                    onsite_checkout        => $onsite_checkout,        auto_renew    => $session->param('auto_renew'),
516
                    switch_onsite_checkout => $switch_onsite_checkout, cancel_recall => $cancel_recall,
518
                    switch_onsite_checkout => $switch_onsite_checkout, cancel_recall => $cancel_recall,
517
                    recall_id              => $recall_id,
519
                    recall_id              => $recall_id,              booking_id    => $booking_id
518
                }
520
                }
519
            );
521
            );
520
            $template_params->{issue} = $issue;
522
            $template_params->{issue} = $issue;
Lines 763-768 $template->param( Link Here
763
    nopermission              => scalar $query->param('nopermission'),
765
    nopermission              => scalar $query->param('nopermission'),
764
    autoswitched              => $autoswitched,
766
    autoswitched              => $autoswitched,
765
    logged_in_user            => $logged_in_user,
767
    logged_in_user            => $logged_in_user,
768
    booking_id                => $booking_id || '',
766
);
769
);
767
770
768
output_html_with_http_headers $query, $cookie, $template->output;
771
output_html_with_http_headers $query, $cookie, $template->output;
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/bookings/list.tt (+1 lines)
Lines 277-282 Link Here
277
                    [% IF CAN_user_circulate_manage_bookings %]
277
                    [% IF CAN_user_circulate_manage_bookings %]
278
                    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>';
278
                    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>';
279
                    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>';
279
                    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>';
280
                    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>`;
280
                    [% END %]
281
                    [% END %]
281
                    return result;
282
                    return result;
282
                }
283
                }
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt (-2 / +9 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-428 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 %]" />
429
                                    <input type="hidden" name="booking_id" value="[% booking_id | html %]"/>
426
                                    <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>
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 %]
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="deny" accesskey="n"><i class="fa fa-times"></i> No, don't renew (N)</button>
449
                                        <button type="submit" class="deny" accesskey="n"><i class="fa fa-times"></i> No, don't renew (N)</button>
Lines 1049-1055 Link Here
1049
                if ( $("#onsite_checkout").prop('checked') ) {
1054
                if ( $("#onsite_checkout").prop('checked') ) {
1050
                    duedatespec_fp.setDate("[% today_due_date_and_time | $KohaDates dateformat => 'iso', with_hours => 1 %]");
1055
                    duedatespec_fp.setDate("[% today_due_date_and_time | $KohaDates dateformat => 'iso', with_hours => 1 %]");
1051
                } else {
1056
                } else {
1052
                    duedatespec_fp.setDate("");
1057
                    var booking_id = [% booking_id.json %];
1058
                    if (!booking_id) {
1059
                        duedatespec_fp.setDate("");
1060
                    }
1053
                }
1061
                }
1054
            }
1062
            }
1055
        }
1063
        }
1056
- 

Return to bug 36789