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 253-274 sub format { Link Here
253
    my ( $self, $template ) = @_;
254
    my ( $self, $template ) = @_;
254
255
255
    if ($template) {
256
    if ($template) {
256
        require Template;
257
        require Koha::Patrons;
257
        require Koha::Patrons;
258
258
259
        my $tt = Template->new();
260
261
        my $patron = Koha::Patrons->find( $self->{borrowernumber} );
259
        my $patron = Koha::Patrons->find( $self->{borrowernumber} );
262
260
        return process_tt( $template, { patron => $patron } );
263
        my $output;
264
        eval {
265
            $tt->process( \$template, { patron => $patron }, \$output );
266
        };
267
        if ( $@ ){
268
            siplog("LOG_DEBUG", "Error processing template: $template");
269
            return "";
270
        }
271
        return $output;
272
    }
261
    }
273
}
262
}
274
263
Lines 420-435 sub fine_items { Link Here
420
    my $av_field_template = $server ? $server->{account}->{av_field_template} : undef;
409
    my $av_field_template = $server ? $server->{account}->{av_field_template} : undef;
421
    $av_field_template ||= "[% accountline.description %] [% accountline.amountoutstanding | format('%.2f') %]";
410
    $av_field_template ||= "[% accountline.description %] [% accountline.amountoutstanding | format('%.2f') %]";
422
411
423
    my $tt = Template->new();
424
425
    my @return_values;
412
    my @return_values;
426
    for ( my $i = $start; $i <= $end; $i++ ) {
413
    for ( my $i = $start; $i <= $end; $i++ ) {
427
        my $fee = $fees[$i];
414
        my $fee = $fees[$i];
428
415
429
        next unless $fee;
416
        next unless $fee;
430
417
431
        my $output;
418
        my $output = process_tt( $av_field_template, { accountline => $fee } );
432
        $tt->process( \$av_field_template, { accountline => $fee }, \$output );
433
        push( @return_values, { barcode => $output } );
419
        push( @return_values, { barcode => $output } );
434
    }
420
    }
435
421
436
- 

Return to bug 33043