[freeside-commits] branch master updated. dfd0a5487139aa2fe33ac87d628e104af4c9d04e

Mark Wells mark at 420.am
Wed Feb 12 14:25:55 PST 2014


The branch, master has been updated
       via  dfd0a5487139aa2fe33ac87d628e104af4c9d04e (commit)
      from  8d51b40b5bf90351bd013ad3daa9569b2f399a3d (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit dfd0a5487139aa2fe33ac87d628e104af4c9d04e
Author: Mark Wells <mark at freeside.biz>
Date:   Wed Feb 12 14:25:28 2014 -0800

    script to insert CDR header strings into msgcat, #27276

diff --git a/bin/translate-insert-cdr-headers b/bin/translate-insert-cdr-headers
new file mode 100755
index 0000000..b7f1ce0
--- /dev/null
+++ b/bin/translate-insert-cdr-headers
@@ -0,0 +1,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");
+  }
+}

-----------------------------------------------------------------------

Summary of changes:
 bin/translate-insert-cdr-headers |   40 ++++++++++++++++++++++++++++++++++++++
 1 files changed, 40 insertions(+), 0 deletions(-)
 create mode 100755 bin/translate-insert-cdr-headers




More information about the freeside-commits mailing list