adding quick tool to change the "states" for japan
authorivan <ivan>
Wed, 25 Feb 2009 20:05:42 +0000 (20:05 +0000)
committerivan <ivan>
Wed, 25 Feb 2009 20:05:42 +0000 (20:05 +0000)
bin/japan.pl [new file with mode: 0755]

diff --git a/bin/japan.pl b/bin/japan.pl
new file mode 100755 (executable)
index 0000000..14e44e4
--- /dev/null
@@ -0,0 +1,32 @@
+#!/usr/bin/perl
+
+use FS::UID qw( adminsuidsetup );
+use FS::Record qw( qsearch );
+use FS::cust_main_county;
+
+adminsuidsetup shift;
+
+my $country = 'JP';
+
+foreach my $cust_main_county (
+  qsearch('cust_main_county', { 'country' => $country } )
+) {
+
+  if ( $cust_main_county->state =~ /\[([\w ]+)\]\s*$/ ) {
+    $cust_main_county->state($1);
+    my $error = $cust_main_county->replace;
+    die $error if $error;
+  }
+
+}
+
+
+#use Locale::SubCountry;
+#
+##my $state = 'Tôkyô [Tokyo]';
+#my $state = 'Tottori';
+#
+#my $lsc = new Locale::SubCountry 'JP';
+#
+#print $lsc->code($state)."\n";
+