|
Line 0
Link Here
|
| 0 |
- |
1 |
#!/usr/bin/perl |
|
|
2 |
|
| 3 |
# Copyright 2020 BibLibre |
| 4 |
# |
| 5 |
# This file is part of Koha. |
| 6 |
# |
| 7 |
# Koha is free software; you can redistribute it and/or modify it under the |
| 8 |
# terms of the GNU General Public License as published by the Free Software |
| 9 |
# Foundation; either version 3 of the License, or (at your option) any later |
| 10 |
# version. |
| 11 |
# |
| 12 |
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY |
| 13 |
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR |
| 14 |
# A PARTICULAR PURPOSE. See the GNU General Public License for more details. |
| 15 |
# |
| 16 |
# You should have received a copy of the GNU General Public License along |
| 17 |
# with Koha; if not, see <http://www.gnu.org/licenses>. |
| 18 |
|
| 19 |
use Modern::Perl; |
| 20 |
|
| 21 |
use Getopt::Long; |
| 22 |
use JSON; |
| 23 |
|
| 24 |
use C4::Letters; |
| 25 |
|
| 26 |
my ($module, $letter_code, $branchcode, $message_transport_type, $lang, $repeat, $tables, $loops); |
| 27 |
|
| 28 |
GetOptions( |
| 29 |
'module=s' => \$module, |
| 30 |
'letter-code=s' => \$letter_code, |
| 31 |
'branchcode=s' => \$branchcode, |
| 32 |
'message-transport-type=s' => \$message_transport_type, |
| 33 |
'lang=s' => \$lang, |
| 34 |
'repeat=s' => \$repeat, |
| 35 |
'tables=s' => \$tables, |
| 36 |
'loops=s' => \$loops, |
| 37 |
) or die "Error in command line arguments\n"; |
| 38 |
|
| 39 |
$repeat = $repeat ? decode_json($repeat) : {}; |
| 40 |
$tables = $tables ? decode_json($tables) : {}; |
| 41 |
$loops = $loops ? decode_json($loops) : {}; |
| 42 |
|
| 43 |
my $letter = C4::Letters::GetPreparedLetter( |
| 44 |
module => $module, |
| 45 |
letter_code => $letter_code, |
| 46 |
branchcode => $branchcode, |
| 47 |
message_transport_type => $message_transport_type, |
| 48 |
lang => $lang, |
| 49 |
repeat => $repeat, |
| 50 |
tables => $tables, |
| 51 |
loops => $loops, |
| 52 |
); |
| 53 |
|
| 54 |
print "Subject: " . $letter->{title} . "\n\n"; |
| 55 |
print $letter->{content} . "\n"; |