'agent_aid' => { 'label' => 'Export agentnum values to Artera AID',
'type' => 'checkbox',
},
+ 'aid' => { 'label' => 'Artera Agent ID to use if not using agentnum values', },
'production' => { 'label' => 'Production mode (leave unchecked for staging)',
'type' => 'checkbox',
},
+ 'debug' => { 'label' => 'Enable debug logging',
+ 'type' => 'checkbox',
+ },
;
%info = (
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
);
eval "use Net::Artera;";
return $@ if $@;
-
+ $Net::Artera::DEBUG = 1 if $self->option('debug');
my $artera = $self->_new_Artera;
my $cust_pkg = $svc_external->cust_svc->cust_pkg;
'email' => $email,
'cname' => $cust_main->name,
'ref' => $svc_external->svcnum,
- 'aid' => ( $self->option('agent_aid') ? $cust_main->agentnum : '' ),
+ 'aid' => ( $self->option('agent_aid')
+ ? $cust_main->agentnum
+ : $self->option('aid') ),
'add1' => $cust_main->address1,
'add2' => $cust_main->address2,
'add3' => $cust_main->city,
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;
'';
}
sub _export_delete {
my( $self, $svc_external ) = (shift, shift);
- $self->StatusChange(17, $svc_external);
+ $self->statusChange(17, $svc_external);
}
sub _export_suspend {
my( $self, $svc_external ) = (shift, shift);
- $self->StatusChange(16, $svc_external);
+ $self->statusChange(16, $svc_external);
}
sub _export_unsuspend {
my( $self, $svc_external ) = (shift, shift);
- $self->StatusChange(15, $svc_external);
+ $self->statusChange(15, $svc_external);
}
-sub StatusChange {
+sub statusChange {
my( $self, $status, $svc_external ) = @_;
+ eval "use Net::Artera;";
+ return $@ if $@;
+ $Net::Artera::DEBUG = 1 if $self->option('debug');
my $artera = $self->_new_Artera;
- my $result = $artera->StatusChange(
+ my $result = $artera->statusChange(
'asn' => sprintf('%010d', $svc_external->id),
'akc' => $svc_external->title,
'statusid' => $status,