View | Details | Raw Unified | Return to bug 24591
Collapse All | Expand All

(-)a/misc/devel/get_prepared_letter.pl (-1 / +56 lines)
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,
27
    $repeat, $tables, $loops );
28
29
GetOptions(
30
    'module=s'                 => \$module,
31
    'letter-code=s'            => \$letter_code,
32
    'branchcode=s'             => \$branchcode,
33
    'message-transport-type=s' => \$message_transport_type,
34
    'lang=s'                   => \$lang,
35
    'repeat=s'                 => \$repeat,
36
    'tables=s'                 => \$tables,
37
    'loops=s'                  => \$loops,
38
) or die "Error in command line arguments\n";
39
40
$repeat = $repeat ? decode_json($repeat) : {};
41
$tables = $tables ? decode_json($tables) : {};
42
$loops  = $loops  ? decode_json($loops)  : {};
43
44
my $letter = C4::Letters::GetPreparedLetter(
45
    module                 => $module,
46
    letter_code            => $letter_code,
47
    branchcode             => $branchcode,
48
    message_transport_type => $message_transport_type,
49
    lang                   => $lang,
50
    repeat                 => $repeat,
51
    tables                 => $tables,
52
    loops                  => $loops,
53
);
54
55
print "Subject: " . $letter->{title} . "\n\n";
56
print $letter->{content} . "\n";

Return to bug 24591