|
Lines 16-32
Link Here
|
| 16 |
# You should have received a copy of the GNU General Public License along |
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>. |
17 |
# with Koha; if not, see <http://www.gnu.org/licenses>. |
| 18 |
|
18 |
|
|
|
19 |
=head1 NAME |
| 20 |
|
| 21 |
get-prepared-letter.pl - preview letter content |
| 22 |
|
| 23 |
=head1 SYNOPSIS |
| 24 |
|
| 25 |
get-prepared-letter.pl --module MODULE --letter-code CODE [options] |
| 26 |
|
| 27 |
=head1 OPTIONS |
| 28 |
|
| 29 |
=over |
| 30 |
|
| 31 |
=item B<--module MODULE> |
| 32 |
|
| 33 |
The letter module (acquisition, catalogue, circulation, ...) |
| 34 |
|
| 35 |
=item B<--letter-code CODE> |
| 36 |
|
| 37 |
The letter code (DUE, PREDUE, ...) |
| 38 |
|
| 39 |
=item B<--branchcode BRANCHCODE> |
| 40 |
|
| 41 |
The letter branchcode |
| 42 |
|
| 43 |
=item B<--message-transport-type TYPE> |
| 44 |
|
| 45 |
The message transport type (email, print, ...) |
| 46 |
|
| 47 |
=item B<--lang LANG> |
| 48 |
|
| 49 |
The letter language (es-ES, fr-FR, ...) |
| 50 |
|
| 51 |
=item B<--repeat REPEAT> |
| 52 |
|
| 53 |
A JSON formatted string that will be used as repeat parameter. See |
| 54 |
documentation of GetPreparedLetter for more informations. |
| 55 |
|
| 56 |
=item B<--tables TABLES> |
| 57 |
|
| 58 |
A JSON formatted string that will be used as tables parameter. See |
| 59 |
documentation of GetPreparedLetter for more informations. |
| 60 |
|
| 61 |
=item B<--loops LOOPS> |
| 62 |
|
| 63 |
A JSON formatted string that will be used as loops parameter. See |
| 64 |
documentation of GetPreparedLetter for more informations. |
| 65 |
|
| 66 |
=back |
| 67 |
|
| 68 |
=cut |
| 69 |
|
| 19 |
use Modern::Perl; |
70 |
use Modern::Perl; |
| 20 |
|
71 |
|
| 21 |
use Getopt::Long; |
72 |
use Getopt::Long; |
| 22 |
use JSON; |
73 |
use JSON; |
|
|
74 |
use Pod::Usage; |
| 23 |
|
75 |
|
| 24 |
use C4::Letters; |
76 |
use C4::Letters; |
| 25 |
|
77 |
|
|
|
78 |
my $help; |
| 26 |
my ( $module, $letter_code, $branchcode, $message_transport_type, $lang, |
79 |
my ( $module, $letter_code, $branchcode, $message_transport_type, $lang, |
| 27 |
$repeat, $tables, $loops ); |
80 |
$repeat, $tables, $loops ); |
| 28 |
|
81 |
|
| 29 |
GetOptions( |
82 |
GetOptions( |
|
|
83 |
'help' => \$help, |
| 30 |
'module=s' => \$module, |
84 |
'module=s' => \$module, |
| 31 |
'letter-code=s' => \$letter_code, |
85 |
'letter-code=s' => \$letter_code, |
| 32 |
'branchcode=s' => \$branchcode, |
86 |
'branchcode=s' => \$branchcode, |
|
Lines 35-41
GetOptions(
Link Here
|
| 35 |
'repeat=s' => \$repeat, |
89 |
'repeat=s' => \$repeat, |
| 36 |
'tables=s' => \$tables, |
90 |
'tables=s' => \$tables, |
| 37 |
'loops=s' => \$loops, |
91 |
'loops=s' => \$loops, |
| 38 |
) or die "Error in command line arguments\n"; |
92 |
) or pod2usage( -exitval => 2, -verbose => 1 ); |
|
|
93 |
|
| 94 |
if ($help) { |
| 95 |
pod2usage( -exitval => 0, -verbose => 1 ); |
| 96 |
} |
| 39 |
|
97 |
|
| 40 |
$repeat = $repeat ? decode_json($repeat) : {}; |
98 |
$repeat = $repeat ? decode_json($repeat) : {}; |
| 41 |
$tables = $tables ? decode_json($tables) : {}; |
99 |
$tables = $tables ? decode_json($tables) : {}; |
| 42 |
- |
|
|