From 326123622b3e60db0d6893f076b3a082f4e2a44a Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 17 Oct 2004 09:19:23 +0000 Subject: [PATCH] add options to adjust UI for artera turbo as svc_export --- FS/FS/Conf.pm | 8 ++++++++ FS/FS/cust_svc.pm | 8 +++++++- FS/FS/part_export/artera_turbo.pm | 15 +++++++++------ README.1.5.0pre6 | 3 +++ bin/populate-msgcat | 8 ++++++++ httemplate/docs/upgrade10.html | 3 +++ httemplate/view/svc_external.cgi | 9 ++++++--- 7 files changed, 44 insertions(+), 10 deletions(-) diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm index c8fd7cd95..eb6c69073 100644 --- a/FS/FS/Conf.pm +++ b/FS/FS/Conf.pm @@ -1298,6 +1298,14 @@ httemplate/docs/config.html '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; diff --git a/FS/FS/cust_svc.pm b/FS/FS/cust_svc.pm index 0c17c9706..65f8d58b6 100644 --- a/FS/FS/cust_svc.pm +++ b/FS/FS/cust_svc.pm @@ -3,6 +3,7 @@ package FS::cust_svc; 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; @@ -303,7 +304,12 @@ sub label { } 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'); diff --git a/FS/FS/part_export/artera_turbo.pm b/FS/FS/part_export/artera_turbo.pm index 60cafc34f..52ab232e0 100644 --- a/FS/FS/part_export/artera_turbo.pm +++ b/FS/FS/part_export/artera_turbo.pm @@ -34,7 +34,11 @@ tie my %options, 'Tie::IxHash', Real-time export to Artera Turbo Reseller API. Requires installation of Net::Artera -from CPAN. +from CPAN. You probably also want to: + END ); @@ -100,11 +104,10 @@ sub _export_insert { 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; ''; } diff --git a/README.1.5.0pre6 b/README.1.5.0pre6 index 9fcfd2e4a..7e46264c7 100644 --- a/README.1.5.0pre6 +++ b/README.1.5.0pre6 @@ -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; +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 diff --git a/bin/populate-msgcat b/bin/populate-msgcat index 719d33046..adac92dd0 100755 --- a/bin/populate-msgcat +++ b/bin/populate-msgcat @@ -118,6 +118,14 @@ sub messages { 'en_US' => 'Night Phone', }, + 'svc_external-id' => { + 'en_US' => 'External ID', + }, + + 'svc_external-title' => { + 'en_US' => 'Title', + }, + ); } diff --git a/httemplate/docs/upgrade10.html b/httemplate/docs/upgrade10.html index 6a11324b2..dc60865a5 100644 --- a/httemplate/docs/upgrade10.html +++ b/httemplate/docs/upgrade10.html @@ -10,6 +10,9 @@ install Net::SSH 0.08 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, diff --git a/httemplate/view/svc_external.cgi b/httemplate/view/svc_external.cgi index 59cc357c7..49183cd95 100644 --- a/httemplate/view/svc_external.cgi +++ b/httemplate/view/svc_external.cgi @@ -7,6 +7,8 @@ my $svcnum = $1; 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'); @@ -20,6 +22,7 @@ if ($pkgnum) { } #eofalse + %> <%= header('External Service View', menubar( @@ -37,9 +40,9 @@ if ($pkgnum) { Service number <%= $svcnum %> -External ID - <%= $svc_external->id %> -Title +<%= FS::Msgcat::_gettext('svc_external-id') || 'External ID' %> + <%= $conf->config('svc_external-display_type') eq 'artera_turbo' ? sprintf('%010d', $svc_external->id) : $svc_external->id %> +<%= FS::Msgcat::_gettext('svc_external-title') || 'Title' %> <%= $svc_external->title %> <% foreach (sort { $a cmp $b } $svc_external->virtual_fields) { %> -- 2.11.0