|
Lines 31-36
use C4::SMS;
Link Here
|
| 31 |
use C4::Debug; |
31 |
use C4::Debug; |
| 32 |
use Date::Calc qw( Add_Delta_Days ); |
32 |
use Date::Calc qw( Add_Delta_Days ); |
| 33 |
use Encode; |
33 |
use Encode; |
|
|
34 |
use Unicode::Normalize; |
| 34 |
use Carp; |
35 |
use Carp; |
| 35 |
|
36 |
|
| 36 |
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); |
37 |
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); |
|
Lines 762-767
sub EnqueueLetter {
Link Here
|
| 762 |
return; |
763 |
return; |
| 763 |
} |
764 |
} |
| 764 |
|
765 |
|
|
|
766 |
# It was found that the some utf8 codes, cause the text to be truncated from that point onward when stored, |
| 767 |
# so we normalize utf8 with NFC so that mysql will store 'all' of the content in its TEXT column type |
| 768 |
# Note: It is also done in _add_attachments accordingly. |
| 769 |
$params->{'letter'}->{'title'} = NFC($params->{'letter'}->{'title'}); # subject |
| 770 |
$params->{'letter'}->{'content'} = NFC($params->{'letter'}->{'content'}); |
| 771 |
|
| 765 |
# If we have any attachments we should encode then into the body. |
772 |
# If we have any attachments we should encode then into the body. |
| 766 |
if ( $params->{'attachments'} ) { |
773 |
if ( $params->{'attachments'} ) { |
| 767 |
$params->{'letter'} = _add_attachments( |
774 |
$params->{'letter'} = _add_attachments( |
|
Lines 932-942
sub _add_attachments {
Link Here
|
| 932 |
$message->attach( |
939 |
$message->attach( |
| 933 |
Type => $letter->{'content-type'} || 'TEXT', |
940 |
Type => $letter->{'content-type'} || 'TEXT', |
| 934 |
Data => $letter->{'is_html'} |
941 |
Data => $letter->{'is_html'} |
| 935 |
? _wrap_html($letter->{'content'}, $letter->{'title'}) |
942 |
? _wrap_html($letter->{'content'}, NFC($letter->{'title'})) |
| 936 |
: $letter->{'content'}, |
943 |
: NFC($letter->{'content'}), |
| 937 |
); |
944 |
); |
| 938 |
|
945 |
|
| 939 |
foreach my $attachment ( @$attachments ) { |
946 |
foreach my $attachment ( @$attachments ) { |
|
|
947 |
|
| 948 |
if ($attachment->{'content'} =~ m/text/o) { # NFC normailze any "text" related content-type attachments |
| 949 |
$attachment->{'content'} = NFC($attachment->{'content'}); |
| 950 |
} |
| 951 |
$attachment->{'filename'} = NFC($attachment->{'filename'}); |
| 952 |
|
| 940 |
$message->attach( |
953 |
$message->attach( |
| 941 |
Type => $attachment->{'type'}, |
954 |
Type => $attachment->{'type'}, |
| 942 |
Data => $attachment->{'content'}, |
955 |
Data => $attachment->{'content'}, |