Lines 26-31
use DateTime;
Link Here
|
26 |
use C4::Letters; |
26 |
use C4::Letters; |
27 |
use Mojo::Util qw(deprecated); |
27 |
use Mojo::Util qw(deprecated); |
28 |
use File::Basename qw(dirname); |
28 |
use File::Basename qw(dirname); |
|
|
29 |
use Carp qw( croak ); |
29 |
|
30 |
|
30 |
use Koha::AuthorisedValue; |
31 |
use Koha::AuthorisedValue; |
31 |
use Koha::AuthorisedValues; |
32 |
use Koha::AuthorisedValues; |
Lines 1929-1953
and transport type
Link Here
|
1929 |
sub get_notice { |
1930 |
sub get_notice { |
1930 |
my ( $self, $params ) = @_; |
1931 |
my ( $self, $params ) = @_; |
1931 |
|
1932 |
|
1932 |
my $title = $self->extended_attributes->find( { type => 'title' } ); |
1933 |
my $title = $self->extended_attributes->find( { type => 'title' } ); |
1933 |
my $author = $self->extended_attributes->find( { type => 'author' } ); |
1934 |
my $author = $self->extended_attributes->find( { type => 'author' } ); |
1934 |
my $metahash = $self->metadata; |
1935 |
my $metahash = $self->metadata; |
|
|
1936 |
my $template = Koha::Notice::Templates->find_effective_template( |
1937 |
{ |
1938 |
module => 'ill', |
1939 |
code => $params->{notice_code}, |
1940 |
branchcode => $self->branchcode, |
1941 |
message_transport_type => $params->{transport}, |
1942 |
lang => $self->patron ? $self->patron->lang : undef |
1943 |
} |
1944 |
); |
1945 |
|
1946 |
unless ($template) { |
1947 |
croak "No 'ill' " . $params->{notice_code} . " letter transported by " . $params->{transport}; |
1948 |
return; |
1949 |
} |
1950 |
|
1951 |
my $metastring; |
1935 |
my @metaarray = (); |
1952 |
my @metaarray = (); |
1936 |
foreach my $key ( sort { lc $a cmp lc $b } keys %{$metahash} ) { |
1953 |
foreach my $key ( sort { lc $a cmp lc $b } keys %{$metahash} ) { |
1937 |
my $value = $metahash->{$key}; |
1954 |
my $value = $metahash->{$key}; |
1938 |
push @metaarray, "- $key: $value" if $value; |
1955 |
push @metaarray, "- $key: $value" if $value; |
1939 |
} |
1956 |
} |
1940 |
my $metastring = join( "\n", @metaarray ); |
|
|
1941 |
|
1957 |
|
|
|
1958 |
my $template_hash = $template->unblessed; |
1959 |
if ( $template_hash->{is_html} ) { |
1960 |
$metastring = join( "<br>\n", @metaarray ); |
1961 |
$template_hash->{'content-type'} = 'text/html; charset="UTF-8"'; |
1962 |
} else { |
1963 |
$metastring = join( "\n", @metaarray ); |
1964 |
} |
1942 |
my $illrequestattributes = { map { $_->type => $_->value } $self->extended_attributes->as_list }; |
1965 |
my $illrequestattributes = { map { $_->type => $_->value } $self->extended_attributes->as_list }; |
1943 |
|
1966 |
|
1944 |
my $letter = C4::Letters::GetPreparedLetter( |
1967 |
my $letter = C4::Letters::GetPreparedLetter( |
1945 |
module => 'ill', |
1968 |
letter => $template_hash, |
1946 |
letter_code => $params->{notice_code}, |
1969 |
tables => { |
1947 |
branchcode => $self->branchcode, |
|
|
1948 |
message_transport_type => $params->{transport}, |
1949 |
lang => $self->patron ? $self->patron->lang : undef, |
1950 |
tables => { |
1951 |
illrequests => $self->illrequest_id, |
1970 |
illrequests => $self->illrequest_id, |
1952 |
borrowers => $self->borrowernumber, |
1971 |
borrowers => $self->borrowernumber, |
1953 |
biblio => $self->biblio_id, |
1972 |
biblio => $self->biblio_id, |
1954 |
- |
|
|