add options to adjust UI for artera turbo as svc_export
authorivan <ivan>
Sun, 17 Oct 2004 09:19:23 +0000 (09:19 +0000)
committerivan <ivan>
Sun, 17 Oct 2004 09:19:23 +0000 (09:19 +0000)
FS/FS/Conf.pm
FS/FS/cust_svc.pm
FS/FS/part_export/artera_turbo.pm
README.1.5.0pre6
bin/populate-msgcat
httemplate/docs/upgrade10.html
httemplate/view/svc_external.cgi

index c8fd7cd..eb6c690 100644 (file)
@@ -1298,6 +1298,14 @@ httemplate/docs/config.html
     'type'        => 'checkbox',
   },
 
     'type'        => 'checkbox',
   },
 
+  {
+    'key'         => 'svc_external-display_type',
+    'section'     => 'UI',
+    'description' => 'Select a specific svc_external type to enable some UI changes specific to that type (i.e. artera_turbo).',
+    'type'        => 'select',
+    'select_enum' => [ 'generic', 'artera_turbo', ],
+  },
+
 );
 
 1;
 );
 
 1;
index 0c17c97..65f8d58 100644 (file)
@@ -3,6 +3,7 @@ package FS::cust_svc;
 use strict;
 use vars qw( @ISA $ignore_quantity );
 use Carp qw( cluck );
 use strict;
 use vars qw( @ISA $ignore_quantity );
 use Carp qw( cluck );
+use FS::Conf;
 use FS::Record qw( qsearch qsearchs dbh );
 use FS::cust_pkg;
 use FS::part_pkg;
 use FS::Record qw( qsearch qsearchs dbh );
 use FS::cust_pkg;
 use FS::part_pkg;
@@ -303,7 +304,12 @@ sub label {
   } elsif ( $svcdb eq 'svc_broadband' ) {
     $tag = $svc_x->ip_addr;
   } elsif ( $svcdb eq 'svc_external' ) {
   } elsif ( $svcdb eq 'svc_broadband' ) {
     $tag = $svc_x->ip_addr;
   } elsif ( $svcdb eq 'svc_external' ) {
-    $tag = $svc_x->id. ': '. $svc_x->title;
+    my $conf = new FS::Conf;
+    if ( $conf->config('svc_external-display_type') eq 'artera_turbo' ) {
+      $tag = sprintf('%010d', $svc_x->id). '-'. $svc_x->title;
+    } else {
+      $tag = $svc_x->id. ': '. $svc_x->title;
+    }
   } else {
     cluck "warning: asked for label of unsupported svcdb; using svcnum";
     $tag = $svc_x->getfield('svcnum');
   } else {
     cluck "warning: asked for label of unsupported svcdb; using svcnum";
     $tag = $svc_x->getfield('svcnum');
index 60cafc3..52ab232 100644 (file)
@@ -34,7 +34,11 @@ tie my %options, 'Tie::IxHash',
 Real-time export to <a href="http://www.arteraturbo.com/">Artera Turbo</a>
 Reseller API.  Requires installation of
 <a href="http://search.cpan.org/dist/Net-Artera">Net::Artera</a>
 Real-time export to <a href="http://www.arteraturbo.com/">Artera Turbo</a>
 Reseller API.  Requires installation of
 <a href="http://search.cpan.org/dist/Net-Artera">Net::Artera</a>
-from CPAN.
+from CPAN.  You probably also want to:
+<UL>
+  <LI>In the configuraiton UI section: set the <B>svc_external-skip_manual</B> and <B>svc_external-display_type</B> configuration values.
+  <LI>In the message catalog: set <B>svc_external-id</B> to <I>Artera Serial Number</I> and set <B>svc_external-title</B> to <I>Artera Key Code</I>.
+</UL>
 END
 );
 
 END
 );
 
@@ -100,11 +104,10 @@ sub _export_insert {
 
 sub _export_replace {
   my( $self, $new, $old ) = (shift, shift, shift);
 
 sub _export_replace {
   my( $self, $new, $old ) = (shift, shift, shift);
-  #except the first time, hehe..
-  #return "can't change serial number with Artera"
-  #  if $old->id != $new->id;
-  #return "can't change key code with Artera"
-  #  if $old->title ne $new->title;
+  return "can't change serial number with Artera"
+    if $old->id != $new->id && $old->id;
+  return "can't change key code with Artera"
+    if $old->title ne $new->title && $old->title;
   '';
 }
 
   '';
 }
 
index 9fcfd2e..7e46264 100644 (file)
@@ -28,6 +28,9 @@ CREATE INDEX cust_pay_void1 ON cust_pay_void(custnum);
 alter table svc_external alter column id drop not null;
 alter table h_svc_external alter column id drop not null;
 
 alter table svc_external alter column id drop not null;
 alter table h_svc_external alter column id drop not null;
 
+INSERT INTO msgcat ( msgnum, msgcode, locale, msg ) VALUES ( 20, 'svc_external-id', 'en_US', 'External ID' );
+INSERT INTO msgcat ( msgnum, msgcode, locale, msg ) VALUES ( 21, 'svc_external-title', 'en_US', 'Title' );
+
 dbdef-create username
 create-history-tables username cust_pay_refund cust_pay_void
 dbdef-create username
 dbdef-create username
 create-history-tables username cust_pay_refund cust_pay_void
 dbdef-create username
index 719d330..adac92d 100755 (executable)
@@ -118,6 +118,14 @@ sub messages {
       'en_US' => 'Night Phone',
     },
 
       'en_US' => 'Night Phone',
     },
 
+    'svc_external-id' => {
+      'en_US' => 'External ID',
+    },
+
+    'svc_external-title' => {
+      'en_US' => 'Title',
+    },
+
   );
 }
 
   );
 }
 
index 6a11324..dc60865 100644 (file)
@@ -10,6 +10,9 @@ install Net::SSH 0.08
 
 install NetAddr::IP, Chart::Base, IPC::ShareLite and Locale::SubCountry
 
 
 install NetAddr::IP, Chart::Base, IPC::ShareLite and Locale::SubCountry
 
+INSERT INTO msgcat ( msgnum, msgcode, locale, msg ) VALUES ( 20, 'svc_external-id', 'en_US', 'External ID' );
+INSERT INTO msgcat ( msgnum, msgcode, locale, msg ) VALUES ( 21, 'svc_external-title', 'en_US', 'Title' );
+
 CREATE TABLE cust_bill_pkg_detail (
   detailnum serial,
   pkgnum int NOT NULL,
 CREATE TABLE cust_bill_pkg_detail (
   detailnum serial,
   pkgnum int NOT NULL,
index 59cc357..49183cd 100644 (file)
@@ -7,6 +7,8 @@ my $svcnum = $1;
 my $svc_external = qsearchs( 'svc_external', { 'svcnum' => $svcnum } )
   or die "svc_external: Unknown svcnum $svcnum";
 
 my $svc_external = qsearchs( 'svc_external', { 'svcnum' => $svcnum } )
   or die "svc_external: Unknown svcnum $svcnum";
 
+my $conf = new FS::Conf;
+
 #false laziness w/all svc_*.cgi
 my $cust_svc = qsearchs( 'cust_svc', { 'svcnum' => $svcnum } );
 my $pkgnum = $cust_svc->getfield('pkgnum');
 #false laziness w/all svc_*.cgi
 my $cust_svc = qsearchs( 'cust_svc', { 'svcnum' => $svcnum } );
 my $pkgnum = $cust_svc->getfield('pkgnum');
@@ -20,6 +22,7 @@ if ($pkgnum) {
 }
 #eofalse
 
 }
 #eofalse
 
+
 %>
 
 <%= header('External Service View', menubar(
 %>
 
 <%= header('External Service View', menubar(
@@ -37,9 +40,9 @@ if ($pkgnum) {
 
 <TR><TD ALIGN="right">Service number</TD>
   <TD BGCOLOR="#ffffff"><%= $svcnum %></TD></TR>
 
 <TR><TD ALIGN="right">Service number</TD>
   <TD BGCOLOR="#ffffff"><%= $svcnum %></TD></TR>
-<TR><TD ALIGN="right">External ID</TD>
-  <TD BGCOLOR="#ffffff"><%= $svc_external->id %></TD></TR>
-<TR><TD ALIGN="right">Title</TD>
+<TR><TD ALIGN="right"><%= FS::Msgcat::_gettext('svc_external-id') || 'External&nbsp;ID' %></TD>
+  <TD BGCOLOR="#ffffff"><%= $conf->config('svc_external-display_type') eq 'artera_turbo' ? sprintf('%010d', $svc_external->id) : $svc_external->id %></TD></TR>
+<TR><TD ALIGN="right"><%= FS::Msgcat::_gettext('svc_external-title') || 'Title' %></TD>
   <TD BGCOLOR="#ffffff"><%= $svc_external->title %></TD></TR>
 
 <% foreach (sort { $a cmp $b } $svc_external->virtual_fields) { %>
   <TD BGCOLOR="#ffffff"><%= $svc_external->title %></TD></TR>
 
 <% foreach (sort { $a cmp $b } $svc_external->virtual_fields) { %>