blob: b7f1ce0d9253cdb241358be626082791d5ff29f1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
#!/usr/bin/perl
use strict;
use FS::UID qw(adminsuidsetup);
use FS::Conf;
use FS::Record qw(qsearchs);
use FS::cdr;
sub usage {
"usage:
translate-insert-cdr-headers <user> <locale>
";
}
my $user = shift or die usage();
adminsuidsetup($user);
my $locale = shift or die usage();
$FS::UID::AutoCommit = 1;
my %formats = FS::cdr::invoice_formats();
my @strings = map { FS::cdr::invoice_header($_) } keys %formats;
foreach my $string (@strings) {
print "$string ... ";
if ( qsearchs('msgcat', {
locale => $locale,
msgcode => $string,
}) ) {
print "already exists.\n";
} else {
my $newmsgcat = FS::msgcat->new(
{
locale => $locale,
msgcode => $string,
msg => $string,
});
my $error = $newmsgcat->insert;
print (($error || "inserted."). "\n");
}
}
|