Line 0
Link Here
|
0 |
- |
1 |
#!/usr/bin/perl |
|
|
2 |
|
3 |
use Modern::Perl; |
4 |
|
5 |
use Getopt::Long; |
6 |
use JSON; |
7 |
|
8 |
use C4::Letters; |
9 |
|
10 |
my ($module, $letter_code, $branchcode, $message_transport_type, $lang, $repeat, $tables, $loops); |
11 |
|
12 |
GetOptions( |
13 |
'module=s' => \$module, |
14 |
'letter-code=s' => \$letter_code, |
15 |
'branchcode=s' => \$branchcode, |
16 |
'message-transport-type=s' => \$message_transport_type, |
17 |
'lang=s' => \$lang, |
18 |
'repeat=s' => \$repeat, |
19 |
'tables=s' => \$tables, |
20 |
'loops=s' => \$loops, |
21 |
) or die "Error in command line arguments\n"; |
22 |
|
23 |
$repeat = $repeat ? decode_json($repeat) : {}; |
24 |
$tables = $tables ? decode_json($tables) : {}; |
25 |
$loops = $loops ? decode_json($loops) : {}; |
26 |
|
27 |
my $letter = C4::Letters::GetPreparedLetter( |
28 |
module => $module, |
29 |
letter_code => $letter_code, |
30 |
branchcode => $branchcode, |
31 |
message_transport_type => $message_transport_type, |
32 |
lang => $lang, |
33 |
repeat => $repeat, |
34 |
tables => $tables, |
35 |
loops => $loops, |
36 |
); |
37 |
|
38 |
print "Subject: " . $letter->{title} . "\n\n"; |
39 |
print $letter->{content} . "\n"; |