1 <? $title ='Order a new service'; include('elements/header.php'); ?>
2 <? $current_menu = 'services_new.php'; include('elements/menu.php'); ?>
5 if ( isset($_POST['pkgpart_svcpart']) && $_POST['pkgpart_svcpart'] ) {
9 $params = array( 'custnum', 'pkgpart' );
12 if ( preg_match( '/^(\d+)_(\d+)$/', $_POST['pkgpart_svcpart'], $matches ) ) {
13 $_POST['pkgpart'] = $matches[1];
14 $_POST['svcpart'] = $matches[2];
15 $params[] = 'svcpart';
16 $svcdb = $_POST['svcdb'];
17 if ( $svcdb == 'svc_acct' ) { $params[] = 'domsvc'; }
22 if ( $svcdb == 'svc_acct' ) {
24 array_push($params, 'username', '_password', '_password2', 'sec_phrase', 'popnum' );
26 if ( strlen($_POST['_password']) == 0 ) {
27 $results['error'] = 'Empty password';
29 if ( $_POST['_password'] != $_POST['_password2'] ) {
30 $results['error'] = 'Passwords do not match';
31 $_POST['_password'] = '';
32 $_POST['_password2'] = '';
35 } elseif ( $svcdb == 'svc_phone' ) {
37 array_push($params, 'phonenum', 'sip_password', 'pin', 'phone_name' );
40 die("$svcdb not handled on process_order_pkg yet");
43 if ( ! $results['error'] ) {
46 'session_id' => $_COOKIE['session_id'],
49 foreach ( $params AS $param ) {
50 $order_pkg[$param] = $_POST[$param];
53 $results = $freeside->order_pkg($order_pkg);
57 # if ( $results->{'error'} ) {
58 # $action = 'customer_order_pkg';
61 # %{customer_order_pkg()},
62 # 'error' => '<FONT COLOR="#FF0000">'. $results->{'error'}. '</FONT>',
68 if ( isset($results['error']) && $results['error'] ) {
69 $error = $results['error'];
71 #$pkgnum = $results['pkgnum'];
72 header("Location:services.php"); # #pkgnum ?
78 //sub customer_order_pkg {
79 // my $init_data = signup_info( 'customer_session_id' => $session_id );
80 // return $init_data if ( $init_data->{'error'} );
82 // my $customer_info = customer_info( 'session_id' => $session_id );
83 // return $customer_info if ( $customer_info->{'error'} );
85 $pkgselect = $freeside->mason_comp( array(
86 'session_id' => $_COOKIE['session_id'],
87 'comp' => '/edit/cust_main/first_pkg/select-part_pkg.html',
88 'args' => array( 'password_verify', 1,
89 'onchange' , 'enable_order_pkg()',
91 'empty_label' , 'Select package',
92 'form_name' , 'OrderPkgForm',
93 'pkgpart_svcpart', $_POST['pkgpart_svcpart'],
94 'username' , $_POST['username'],
95 'password' , $_POST['_password'],
96 'password2' , $_POST['_password2'],
97 'popnum' , $_POST['popnum'],
98 'saved_domsvc' , $_POST['domsvc'],
101 if ( isset($pkgselect['error']) && $pkgselect['error'] ) {
102 $error = $pkgselect['error'];
103 header('Location:index.php?error='. urlencode($pkgselect));
108 // ( map { $_ => $init_data->{$_} }
109 // qw( part_pkg security_phrase svc_acct_pop ),
112 // 'pkg_selector' => $pkgselect,
117 <SCRIPT TYPE="text/javascript">
118 function enable_order_pkg () {
119 if ( document.OrderPkgForm.pkgpart_svcpart.selectedIndex > 0 ) {
120 document.OrderPkgForm.submit.disabled = false;
122 document.OrderPkgForm.submit.disabled = true;
127 <? include('elements/error.php'); ?>
129 <FORM NAME="OrderPkgForm" ACTION="services_new.php" METHOD=POST>
130 <TABLE BGCOLOR="#cccccc" BORDER=0 CELLSPACING=0>
134 <TABLE><TR><TD> <? echo $pkgselect['output']; ?>
141 <INPUT NAME="submit" TYPE="submit" VALUE="Purchase" <? if ( ! $_POST['pkgpart_svcpart'] ) { echo 'DISABLED'; } ?>>
144 <? include('elements/menu_footer.php'); ?>
145 <? include('elements/footer.php'); ?>