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

(-)a/Koha/Booking.pm (-15 / +18 lines)
Lines 336-363 $booking->delete(); Link Here
336
=cut
336
=cut
337
337
338
sub delete {
338
sub delete {
339
    my ( $self ) = @_;
339
    my ( $self, $params ) = @_;
340
340
341
    my $deleted = $self->SUPER::delete($self);
341
    my $deleted = $self->SUPER::delete($self);
342
    my $patron  = Koha::Patrons->find( $self->patron_id );
342
    my $patron  = Koha::Patrons->find( $self->patron_id );
343
    my $item    = Koha::Items->find( $self->item_id );
343
    my $item    = Koha::Items->find( $self->item_id );
344
    my $library = Koha::Libraries->find( $self->pickup_library_id );
344
    my $library = Koha::Libraries->find( $self->pickup_library_id );
345
345
346
    if ( not  defined( $params->{'transform_to_checkout'} ) ) {
346
    my $letter = C4::Letters::GetPreparedLetter(
347
    my $letter = C4::Letters::GetPreparedLetter(
347
            module                 => 'bookings',
348
        module                 => 'bookings',
348
            letter_code            => 'BOOKING_CANCELLATION',
349
        letter_code            => 'BOOKING_CANCELLATION',
349
            message_transport_type => 'email',
350
        message_transport_type => 'email',
350
            branchcode             => $patron->branchcode,
351
        branchcode             => $patron->branchcode,
351
            lang                   => $patron->lang,
352
        lang                   => $patron->lang,
352
            tables                 => {
353
        tables                 => {
353
                branches    => $library->branchcode,
354
            branches    => $library->branchcode,
354
                borrowers   => $patron->borrowernumber,
355
            borrowers   => $patron->borrowernumber,
355
                items       => $item->itemnumber,
356
            items       => $item->itemnumber,
356
                biblio      => $item->biblionumber,
357
            biblio      => $item->biblionumber,
357
                biblioitems => $item->biblionumber,
358
            biblioitems => $item->biblionumber,
358
                bookings    => $self->unblessed,
359
            bookings    => $self->unblessed,
359
            }
360
        }
360
        );
361
    );
361
362
362
        if ($letter) {
363
        if ($letter) {
363
            C4::Letters::EnqueueLetter(
364
            C4::Letters::EnqueueLetter(
Lines 368-373 sub delete { Link Here
368
                }
369
                }
369
            );
370
            );
370
        }
371
        }
372
    }
373
371
    return $deleted;
374
    return $deleted;
372
}
375
}
373
376
(-)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 (+7 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 321-331 if ($patron) { Link Here
321
#
322
#
322
if (@$barcodes && $op eq 'cud-checkout') {
323
if (@$barcodes && $op eq 'cud-checkout') {
323
    my $checkout_infos;
324
    my $checkout_infos;
325
    my $from_booking = $query->param('booking_id') ? '1' : '0';
324
    for my $barcode ( @$barcodes ) {
326
    for my $barcode ( @$barcodes ) {
325
327
326
        my $template_params = {
328
        my $template_params = {
327
            barcode         => $barcode,
329
            barcode         => $barcode,
328
            onsite_checkout => $onsite_checkout,
330
            onsite_checkout => $onsite_checkout,
331
            from_booking    => $from_booking,
329
        };
332
        };
330
333
331
        # always check for blockers on issuing
334
        # always check for blockers on issuing
Lines 553-558 if (@$barcodes && $op eq 'cud-checkout') { Link Here
553
        confirmation_needed => $confirmation_needed,
556
        confirmation_needed => $confirmation_needed,
554
    );
557
    );
555
  }
558
  }
559
  if($from_booking){
560
    my $booking = Koha::Bookings->find( $query->param('booking_id') );
561
    $booking->delete( { 'transform_to_checkout' => 1 } );
562
  }
556
}
563
}
557
564
558
##################################################################################
565
##################################################################################
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/bookings/list.tt (+2 lines)
Lines 73-78 Link Here
73
    var update_success = 0;
73
    var update_success = 0;
74
    var bookings_table;
74
    var bookings_table;
75
    var timeline;
75
    var timeline;
76
    var bookings_period_length = "[% bookings_period_length | html %]";
76
    $(document).ready(function(){
77
    $(document).ready(function(){
77
78
78
        var items = $.ajax({
79
        var items = $.ajax({
Lines 276-281 Link Here
276
                    [% IF CAN_user_circulate_manage_bookings %]
277
                    [% IF CAN_user_circulate_manage_bookings %]
277
                    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>';
278
                    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>`;
279
                    [% END %]
281
                    [% END %]
280
                    return result;
282
                    return result;
281
                }
283
                }
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt (-2 / +4 lines)
Lines 1049-1055 Link Here
1049
                if ( $("#onsite_checkout").prop('checked') ) {
1049
                if ( $("#onsite_checkout").prop('checked') ) {
1050
                    duedatespec_fp.setDate("[% today_due_date_and_time | $KohaDates dateformat => 'iso', with_hours => 1 %]");
1050
                    duedatespec_fp.setDate("[% today_due_date_and_time | $KohaDates dateformat => 'iso', with_hours => 1 %]");
1051
                } else {
1051
                } else {
1052
                    duedatespec_fp.setDate("");
1052
                    var from_booking = [% from_booking | html %];
1053
                    if (!from_booking) {
1054
                        duedatespec_fp.setDate("");
1055
                    }
1053
                }
1056
                }
1054
            }
1057
            }
1055
        }
1058
        }
1056
- 

Return to bug 36789