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

(-)a/C4/SIP/ILS/Item.pm (-21 / +3 lines)
Lines 11-17 use warnings; Link Here
11
11
12
use C4::SIP::Sip qw(siplog);
12
use C4::SIP::Sip qw(siplog);
13
use Carp;
13
use Carp;
14
use Template;
15
14
16
use C4::SIP::ILS::Transaction;
15
use C4::SIP::ILS::Transaction;
17
use C4::SIP::Sip qw(add_field maybe_add);
16
use C4::SIP::Sip qw(add_field maybe_add);
Lines 29-34 use Koha::DateUtils qw( dt_from_string ); Link Here
29
use Koha::Holds;
28
use Koha::Holds;
30
use Koha::Items;
29
use Koha::Items;
31
use Koha::Patrons;
30
use Koha::Patrons;
31
use Koha::TemplateUtils qw( process_tt );
32
32
33
=encoding UTF-8
33
=encoding UTF-8
34
34
Lines 183-195 sub hold_patron_name { Link Here
183
    my $borrowernumber = $self->hold_patron_id() or return q{};
183
    my $borrowernumber = $self->hold_patron_id() or return q{};
184
184
185
    if ($template) {
185
    if ($template) {
186
        my $tt = Template->new();
187
188
        my $patron = Koha::Patrons->find($borrowernumber);
186
        my $patron = Koha::Patrons->find($borrowernumber);
189
187
        return process_tt( $template, { patron => $patron } );
190
        my $output;
191
        $tt->process( \$template, { patron => $patron }, \$output );
192
        return $output;
193
    }
188
    }
194
189
195
    my $holder = Koha::Patrons->find( $borrowernumber );
190
    my $holder = Koha::Patrons->find( $borrowernumber );
Lines 480-500 sub format { Link Here
480
    my ( $self, $template ) = @_;
475
    my ( $self, $template ) = @_;
481
476
482
    if ($template) {
477
    if ($template) {
483
        require Template;
484
485
        my $tt = Template->new();
486
487
        my $item = $self->{_object};
478
        my $item = $self->{_object};
488
479
        return process_tt( $template, { item => $item } );
489
        my $output;
490
        eval {
491
            $tt->process( \$template, { item => $item }, \$output );
492
        };
493
        if ( $@ ){
494
            siplog("LOG_DEBUG", "Error processing template: $template");
495
            return "";
496
        }
497
        return $output;
498
    }
480
    }
499
}
481
}
500
482
(-)a/C4/SIP/ILS/Patron.pm (-18 / +3 lines)
Lines 27-32 use Koha::Items; Link Here
27
use Koha::Libraries;
27
use Koha::Libraries;
28
use Koha::Patrons;
28
use Koha::Patrons;
29
use Koha::Checkouts;
29
use Koha::Checkouts;
30
use Koha::TemplateUtils qw( process_tt );
30
31
31
our $kp;    # koha patron
32
our $kp;    # koha patron
32
33
Lines 255-276 sub format { Link Here
255
    my ( $self, $template ) = @_;
256
    my ( $self, $template ) = @_;
256
257
257
    if ($template) {
258
    if ($template) {
258
        require Template;
259
        require Koha::Patrons;
259
        require Koha::Patrons;
260
260
261
        my $tt = Template->new();
262
263
        my $patron = Koha::Patrons->find( $self->{borrowernumber} );
261
        my $patron = Koha::Patrons->find( $self->{borrowernumber} );
264
262
        return process_tt( $template, { patron => $patron } );
265
        my $output;
266
        eval {
267
            $tt->process( \$template, { patron => $patron }, \$output );
268
        };
269
        if ( $@ ){
270
            siplog("LOG_DEBUG", "Error processing template: $template");
271
            return "";
272
        }
273
        return $output;
274
    }
263
    }
275
}
264
}
276
265
Lines 422-437 sub fine_items { Link Here
422
    my $av_field_template = $server ? $server->{account}->{av_field_template} : undef;
411
    my $av_field_template = $server ? $server->{account}->{av_field_template} : undef;
423
    $av_field_template ||= "[% accountline.description %] [% accountline.amountoutstanding | format('%.2f') %]";
412
    $av_field_template ||= "[% accountline.description %] [% accountline.amountoutstanding | format('%.2f') %]";
424
413
425
    my $tt = Template->new();
426
427
    my @return_values;
414
    my @return_values;
428
    for ( my $i = $start; $i <= $end; $i++ ) {
415
    for ( my $i = $start; $i <= $end; $i++ ) {
429
        my $fee = $fees[$i];
416
        my $fee = $fees[$i];
430
417
431
        next unless $fee;
418
        next unless $fee;
432
419
433
        my $output;
420
        my $output = process_tt( $av_field_template, { accountline => $fee } );
434
        $tt->process( \$av_field_template, { accountline => $fee }, \$output );
435
        push( @return_values, { barcode => $output } );
421
        push( @return_values, { barcode => $output } );
436
    }
422
    }
437
423
438
- 

Return to bug 33043