|
Lines 23-42
use Carp qw( carp croak );
Link Here
|
| 23 |
use JSON qw( from_json ); |
23 |
use JSON qw( from_json ); |
| 24 |
|
24 |
|
| 25 |
use C4::Context; |
25 |
use C4::Context; |
| 26 |
use C4::Templates qw/themelanguage/; |
|
|
| 27 |
use C4::Koha qw( GetAuthorisedValues ); |
26 |
use C4::Koha qw( GetAuthorisedValues ); |
| 28 |
use Koha::DateUtils qw( dt_from_string ); |
|
|
| 29 |
use Koha::Patrons; |
| 30 |
use Koha::Reports; |
| 31 |
use C4::Output; |
| 32 |
use C4::Log qw( logaction ); |
27 |
use C4::Log qw( logaction ); |
| 33 |
use Koha::Notice::Templates; |
28 |
use C4::Output; |
| 34 |
|
29 |
use C4::Templates qw/themelanguage/; |
|
|
30 |
use Koha::AuthorisedValues; |
| 35 |
use Koha::Database::Columns; |
31 |
use Koha::Database::Columns; |
|
|
32 |
use Koha::DateUtils qw( dt_from_string ); |
| 36 |
use Koha::Logger; |
33 |
use Koha::Logger; |
| 37 |
use Koha::AuthorisedValues; |
34 |
use Koha::Notice::Templates; |
| 38 |
use Koha::Patron::Categories; |
35 |
use Koha::Patron::Categories; |
|
|
36 |
use Koha::Patrons; |
| 37 |
use Koha::Reports; |
| 39 |
use Koha::SharedContent; |
38 |
use Koha::SharedContent; |
|
|
39 |
use Koha::TemplateUtils qw( process_tt ); |
| 40 |
|
40 |
|
| 41 |
our (@ISA, @EXPORT_OK); |
41 |
our (@ISA, @EXPORT_OK); |
| 42 |
BEGIN { |
42 |
BEGIN { |
|
Lines 1061-1067
sub EmailReport {
Link Here
|
| 1061 |
|
1061 |
|
| 1062 |
my $from_address = $from || $row->{from}; |
1062 |
my $from_address = $from || $row->{from}; |
| 1063 |
my $to_address = $row->{$email_col}; |
1063 |
my $to_address = $row->{$email_col}; |
| 1064 |
push ( @errors, { NOT_PARSE => $counter } ) unless my $content = _process_row_TT( $row, $template ); |
1064 |
push ( @errors, { NOT_PARSE => $counter } ) unless my $content = process_tt( $template, $row ); |
| 1065 |
$counter++; |
1065 |
$counter++; |
| 1066 |
next if scalar @errors > $err_count; #If any problems, try next |
1066 |
next if scalar @errors > $err_count; #If any problems, try next |
| 1067 |
|
1067 |
|
|
Lines 1078-1106
sub EmailReport {
Link Here
|
| 1078 |
|
1078 |
|
| 1079 |
} |
1079 |
} |
| 1080 |
|
1080 |
|
| 1081 |
|
|
|
| 1082 |
|
| 1083 |
=head2 ProcessRowTT |
| 1084 |
|
| 1085 |
my $content = ProcessRowTT($row_hashref, $template); |
| 1086 |
|
| 1087 |
Accepts a hashref containing values and processes them against Template Toolkit |
| 1088 |
to produce content |
| 1089 |
|
| 1090 |
=cut |
| 1091 |
|
| 1092 |
sub _process_row_TT { |
| 1093 |
|
| 1094 |
my ($row, $template) = @_; |
| 1095 |
|
| 1096 |
return 0 unless ($row && $template); |
| 1097 |
my $content; |
| 1098 |
my $processor = Template->new(); |
| 1099 |
$processor->process( \$template, $row, \$content); |
| 1100 |
return $content; |
| 1101 |
|
| 1102 |
} |
| 1103 |
|
| 1104 |
sub _get_display_value { |
1081 |
sub _get_display_value { |
| 1105 |
my ( $original_value, $column ) = @_; |
1082 |
my ( $original_value, $column ) = @_; |
| 1106 |
if ( $column eq 'periodicity' ) { |
1083 |
if ( $column eq 'periodicity' ) { |
| 1107 |
- |
|
|