Ticket A2billing credit limit fix
[freeside.git] / FS / FS / part_export / a2billing.pm
index dc152e4..7aab01a 100644 (file)
@@ -24,7 +24,7 @@ tie %options, 'Tie::IxHash',
   'credit'      => { label=>'Default credit limit' },
   'billtype'    => {label=>'Billing type',
                     type => 'select',
-                    options => ['monthly', 'weekly']
+                    options => ['Dial Out Rate', 'Free']
                   },
   'debug'       => { label=>'Enable debugging', type=>'checkbox' }
 ;
@@ -131,7 +131,7 @@ sub export_insert {
       username  => $username,
       useralias => $username,
       uipass    => $svc->_password,
-      credit    => $self->option('credit') || 0,
+      creditlimit    => $cust_main->credit_limit || $self->option('credit') || 0,
       tariff    => $part_pkg->option('a2billing_tariff'),
       status    => 1,
       lastname  => $cust_main->last, # $svc->finger?
@@ -142,6 +142,7 @@ sub export_insert {
       state     => $location->state,
       country   => $country3,
       zipcode   => $location->zip,
+      simultaccess  => $part_pkg->option('a2billing_simultaccess'),
       typepaid  => $part_pkg->option('a2billing_type'),
       sip_buddy => 1,
       company_name => $cust_main->company,
@@ -221,7 +222,7 @@ sub export_insert {
       id_cc_country   => $cc_country_id,
       iduser          => $cc_card_id,
       did             => $svc->phonenum,
-      billingtype     => ($self->option('billtype') eq 'weekly' ? 1 : 0),
+      billingtype     => ($self->option('billtype') eq 'Dial Out Rate' ? 2 : 3),
       activated       => 1,
     );
 
@@ -444,7 +445,7 @@ sub export_unsuspend {
   if ( $svc->isa('FS::svc_acct') ) {
     $error = $self->a2b_insert_or_replace('cc_card', 'svcnum',
       { svcnum    => $svc->svcnum,
-        status    => 0, #"ACTIVE"
+        status    => 1, #"ACTIVE"
         activated => 1,
       }
     );