Lines 200-211
sub GetLettersAvailableForALibrary {
Link Here
|
200 |
|
200 |
|
201 |
} |
201 |
} |
202 |
|
202 |
|
203 |
# FIXME: using our here means that a Plack server will need to be |
|
|
204 |
# restarted fairly regularly when working with this routine. |
205 |
# A better option would be to use Koha::Cache and use a cache |
206 |
# that actually works in a persistent environment, but as a |
207 |
# short-term fix, our will work. |
208 |
our %letter; |
209 |
sub getletter { |
203 |
sub getletter { |
210 |
my ( $module, $code, $branchcode, $message_transport_type ) = @_; |
204 |
my ( $module, $code, $branchcode, $message_transport_type ) = @_; |
211 |
$message_transport_type //= '%'; |
205 |
$message_transport_type //= '%'; |
Lines 218-227
sub getletter {
Link Here
|
218 |
} |
212 |
} |
219 |
$branchcode //= ''; |
213 |
$branchcode //= ''; |
220 |
|
214 |
|
221 |
if ( my $l = $letter{$module}{$code}{$branchcode}{$message_transport_type} ) { |
|
|
222 |
return { %$l }; # deep copy |
223 |
} |
224 |
|
225 |
my $dbh = C4::Context->dbh; |
215 |
my $dbh = C4::Context->dbh; |
226 |
my $sth = $dbh->prepare(q{ |
216 |
my $sth = $dbh->prepare(q{ |
227 |
SELECT * |
217 |
SELECT * |
Lines 234-240
sub getletter {
Link Here
|
234 |
my $line = $sth->fetchrow_hashref |
224 |
my $line = $sth->fetchrow_hashref |
235 |
or return; |
225 |
or return; |
236 |
$line->{'content-type'} = 'text/html; charset="UTF-8"' if $line->{is_html}; |
226 |
$line->{'content-type'} = 'text/html; charset="UTF-8"' if $line->{is_html}; |
237 |
$letter{$module}{$code}{$branchcode}{$message_transport_type} = $line; |
|
|
238 |
return { %$line }; |
227 |
return { %$line }; |
239 |
} |
228 |
} |
240 |
|
229 |
|
241 |
- |
|
|