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

(-)a/Koha/Booking.pm (+47 lines)
Lines 21-26 use Modern::Perl; Link Here
21
21
22
use Koha::Exceptions::Booking;
22
use Koha::Exceptions::Booking;
23
use Koha::DateUtils qw( dt_from_string );
23
use Koha::DateUtils qw( dt_from_string );
24
use Koha::Items;
25
use Koha::Patrons;
26
use Koha::Libraries;
27
28
use C4::Letters;
24
29
25
use base qw(Koha::Object);
30
use base qw(Koha::Object);
26
31
Lines 239-244 sub to_api_mapping { Link Here
239
    return {};
244
    return {};
240
}
245
}
241
246
247
=head3 delete
248
249
$booking->delete();
250
251
=cut
252
253
sub delete {
254
    my ( $self ) = @_;
255
256
    my $deleted = $self->SUPER::delete($self);
257
    my $patron  = Koha::Patrons->find( $self->patron_id );
258
    my $item    = Koha::Items->find( $self->item_id );
259
    my $library = Koha::Libraries->find( $self->pickup_library_id );
260
261
    my $letter = C4::Letters::GetPreparedLetter(
262
            module                 => 'bookings',
263
            letter_code            => 'BOOKING_CANCELLATION',
264
            message_transport_type => 'email',
265
            branchcode             => $patron->branchcode,
266
            lang                   => $patron->lang,
267
            tables                 => {
268
                branches    => $library->branchcode,
269
                borrowers   => $patron->borrowernumber,
270
                items       => $item->itemnumber,
271
                biblio      => $item->biblionumber,
272
                biblioitems => $item->biblionumber,
273
                bookings    => $self->unblessed,
274
            }
275
        );
276
277
        if ($letter) {
278
            C4::Letters::EnqueueLetter(
279
                {
280
                    letter                 => $letter,
281
                    borrowernumber         => $patron->borrowernumber,
282
                    message_transport_type => 'email',
283
                }
284
            );
285
        }
286
    return $deleted;
287
}
288
242
=head2 Internal methods
289
=head2 Internal methods
243
290
244
=head3 _type
291
=head3 _type
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt (+7 lines)
Lines 182-187 Link Here
182
                                <li><a href="/cgi-bin/koha/tools/letter.pl?op=add_form&amp;module=suggestions">Suggestions</a></li>
182
                                <li><a href="/cgi-bin/koha/tools/letter.pl?op=add_form&amp;module=suggestions">Suggestions</a></li>
183
                                <li><a href="/cgi-bin/koha/tools/letter.pl?op=add_form&amp;module=pos">Point of sale</a></li>
183
                                <li><a href="/cgi-bin/koha/tools/letter.pl?op=add_form&amp;module=pos">Point of sale</a></li>
184
                                <li><a href="/cgi-bin/koha/tools/letter.pl?op=add_form&amp;module=report">Reports</a></li>
184
                                <li><a href="/cgi-bin/koha/tools/letter.pl?op=add_form&amp;module=report">Reports</a></li>
185
                                <li><a href="/cgi-bin/koha/tools/letter.pl?op=add_form&amp;module=bookings">Bookings</a></li>
185
                            </ul>
186
                            </ul>
186
                        </div>
187
                        </div>
187
                    </div> <!-- /#toolbar -->
188
                    </div> <!-- /#toolbar -->
Lines 243-248 Link Here
243
                                                    [% CASE 'suggestions' %]<span>Suggestions</span>
244
                                                    [% CASE 'suggestions' %]<span>Suggestions</span>
244
                                                    [% CASE 'pos' %]<span>Point of sale</span>
245
                                                    [% CASE 'pos' %]<span>Point of sale</span>
245
                                                    [% CASE 'report' %]<span>Reports</span>
246
                                                    [% CASE 'report' %]<span>Reports</span>
247
                                                    [% CASE 'bookings' %]<span>Bookings</span>
246
                                                    [% CASE %]<span>[% lette.module | html %]</span>
248
                                                    [% CASE %]<span>[% lette.module | html %]</span>
247
                                                [% END %]
249
                                                [% END %]
248
                                            </td>
250
                                            </td>
Lines 441-446 Link Here
441
                                        [% ELSE %]
443
                                        [% ELSE %]
442
                                            <option value="report">Reports</option>
444
                                            <option value="report">Reports</option>
443
                                        [% END %]
445
                                        [% END %]
446
                                        [% IF ( module == "bookings" ) %]
447
                                            <option value="bookings" selected="selected">Bookings</option>
448
                                        [% ELSE %]
449
                                            <option value="bookings" >Bookings</option>
450
                                        [% END %]
444
                                    </select>
451
                                    </select>
445
                                </li>
452
                                </li>
446
                                <li>
453
                                <li>
(-)a/tools/letter.pl (-1 / +2 lines)
Lines 254-259 sub add_form { Link Here
254
            add_fields( 'branches', 'biblio', 'biblioitems', 'borrowers', 'subscription', 'serial' );
254
            add_fields( 'branches', 'biblio', 'biblioitems', 'borrowers', 'subscription', 'serial' );
255
    } elsif ( $module eq 'suggestions' ) {
255
    } elsif ( $module eq 'suggestions' ) {
256
        push @{$field_selection}, add_fields( 'suggestions', 'borrowers', 'biblio' );
256
        push @{$field_selection}, add_fields( 'suggestions', 'borrowers', 'biblio' );
257
    } elsif ( $module eq 'bookings' ) {
258
        push @{$field_selection}, add_fields( 'borrowers', 'bookings', 'biblio', 'biblioitems', 'items' );
257
    } else {
259
    } else {
258
        push @{$field_selection}, add_fields( 'biblio', 'biblioitems' ),
260
        push @{$field_selection}, add_fields( 'biblio', 'biblioitems' ),
259
            add_fields('items'),
261
            add_fields('items'),
260
- 

Return to bug 36915