freeside/FS/FS/ClientAPI MyAccount.pm,1.29,1.30
ivan
ivan at pouncequick.420.am
Sun Oct 17 07:01:56 PDT 2004
Update of /home/cvs/cvsroot/freeside/FS/FS/ClientAPI
In directory pouncequick:/tmp/cvs-serv30067/FS/FS/ClientAPI
Modified Files:
MyAccount.pm
Log Message:
add artera turbo handling to self-service and reseller interfaces
Index: MyAccount.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/ClientAPI/MyAccount.pm,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -d -r1.29 -r1.30
--- MyAccount.pm 24 Aug 2004 11:16:56 -0000 1.29
+++ MyAccount.pm 17 Oct 2004 14:01:47 -0000 1.30
@@ -21,22 +21,23 @@
use FS::ClientAPI; #hmm
FS::ClientAPI->register_handlers(
- 'MyAccount/login' => \&login,
- 'MyAccount/logout' => \&logout,
- 'MyAccount/customer_info' => \&customer_info,
- 'MyAccount/edit_info' => \&edit_info,
- 'MyAccount/invoice' => \&invoice,
- 'MyAccount/list_invoices' => \&list_invoices,
- 'MyAccount/cancel' => \&cancel,
- 'MyAccount/payment_info' => \&payment_info,
- 'MyAccount/process_payment' => \&process_payment,
- 'MyAccount/list_pkgs' => \&list_pkgs,
- 'MyAccount/order_pkg' => \&order_pkg,
- 'MyAccount/cancel_pkg' => \&cancel_pkg,
- 'MyAccount/charge' => \&charge,
- 'MyAccount/part_svc_info' => \&part_svc_info,
- 'MyAccount/provision_acct' => \&provision_acct,
- 'MyAccount/unprovision_svc' => \&unprovision_svc,
+ 'MyAccount/login' => \&login,
+ 'MyAccount/logout' => \&logout,
+ 'MyAccount/customer_info' => \&customer_info,
+ 'MyAccount/edit_info' => \&edit_info,
+ 'MyAccount/invoice' => \&invoice,
+ 'MyAccount/list_invoices' => \&list_invoices,
+ 'MyAccount/cancel' => \&cancel,
+ 'MyAccount/payment_info' => \&payment_info,
+ 'MyAccount/process_payment' => \&process_payment,
+ 'MyAccount/list_pkgs' => \&list_pkgs,
+ 'MyAccount/order_pkg' => \&order_pkg,
+ 'MyAccount/cancel_pkg' => \&cancel_pkg,
+ 'MyAccount/charge' => \&charge,
+ 'MyAccount/part_svc_info' => \&part_svc_info,
+ 'MyAccount/provision_acct' => \&provision_acct,
+ 'MyAccount/provision_external' => \&provision_external,
+ 'MyAccount/unprovision_svc' => \&unprovision_svc,
);
use vars qw( @cust_main_editable_fields );
@@ -48,6 +49,8 @@
payby payinfo payname
);
+use subs qw(_provision);
+
#store in db?
my $cache = new Cache::SharedMemoryCache( {
'namespace' => 'FS::ClientAPI::MyAccount',
@@ -611,6 +614,33 @@
sub provision_acct {
my $p = shift;
+ return { 'error' => gettext('passwords_dont_match') }
+ if $p->{'_password'} ne $p->{'_password2'};
+ return { 'error' => gettext('empty_password') }
+ unless length($p->{'_password'});
+
+ _provision( 'FS::svc_acct',
+ [qw(username _password)],
+ [qw(username _password)],
+ $p,
+ @_
+ );
+}
+
+sub provision_external {
+ my $p = shift;
+ #_provision( 'FS::svc_external', [qw(id title)], [qw(id title)], $p, @_ );
+ _provision( 'FS::svc_external',
+ [],
+ [qw(id title)],
+ $p,
+ @_
+ );
+}
+
+sub _provision {
+ my( $class, $fields, $return_fields, $p ) = splice(@_, 0, 4);
+
my($context, $session, $custnum) = _custoragent_session_custnum($p);
return { 'error' => $session } if $context eq 'error';
@@ -629,20 +659,18 @@
my $part_svc = qsearchs('part_svc', { 'svcpart' => $p->{'svcpart'} } )
or return { 'error' => "unknown svcpart $p->{'svcpart'}" };
- return { 'error' => gettext('passwords_dont_match') }
- if $p->{'_password'} ne $p->{'_password2'};
- return { 'error' => gettext('empty_password') }
- unless length($p->{'_password'});
-
- my $svc_acct = new FS::svc_acct( {
- 'pkgnum' => $p->{'pkgnum'},
- 'svcpart' => $p->{'svcpart'},
- 'username' => $p->{'username'},
- '_password' => $p->{'_password'},
+ my $svc_x = $class->new( {
+ 'pkgnum' => $p->{'pkgnum'},
+ 'svcpart' => $p->{'svcpart'},
+ map { $_ => $p->{$_} } @$fields
} );
+ my $error = $svc_x->insert;
+ $svc_x = qsearchs($svc_x->table, { 'svcnum' => $svc_x->svcnum })
+ unless $error;
return { 'svc' => $part_svc->svc,
- 'error' => $svc_acct->insert
+ 'error' => $error,
+ map { $_ => $svc_x->get($_) } @$return_fields
};
}
More information about the freeside-commits
mailing list