3 require( dirname( __FILE__ ) . '/wp-blog-header.php' );
5 $freeside = new FreesideSelfService();
7 if ( isset($_POST['pkgpart_svcpart']) && $_POST['pkgpart_svcpart'] ) {
11 $params = array( 'custnum', 'pkgpart' );
14 if ( preg_match( '/^(\d+)_(\d+)$/', $_POST['pkgpart_svcpart'], $matches ) ) {
15 $_POST['pkgpart'] = $matches[1];
16 $_POST['svcpart'] = $matches[2];
17 $params[] = 'svcpart';
18 $svcdb = $_POST['svcdb'];
19 if ( $svcdb == 'svc_acct' ) { $params[] = 'domsvc'; }
24 if ( $svcdb == 'svc_acct' ) {
26 array_push($params, 'username', '_password', '_password2', 'sec_phrase', 'popnum' );
28 if ( strlen($_POST['_password']) == 0 ) {
29 $results['error'] = 'Empty password';
31 if ( $_POST['_password'] != $_POST['_password2'] ) {
32 $results['error'] = 'Passwords do not match';
33 $_POST['_password'] = '';
34 $_POST['_password2'] = '';
37 } elseif ( $svcdb == 'svc_phone' ) {
39 array_push($params, 'phonenum', 'sip_password', 'pin', 'phone_name' );
42 die("$svcdb not handled on process_order_pkg yet");
45 if ( ! $results['error'] ) {
47 'session_id' => $_COOKIE['freeside_session_id'],
50 foreach ( $params AS $param ) {
51 $order_pkg[$param] = $_POST[$param];
54 $results = $freeside->order_pkg($order_pkg);
58 if ( isset($results['error']) && $results['error'] ) {
59 $_REQUEST['freeside_error'] = $results['error'];
61 #$pkgnum = $results['pkgnum'];
62 #wp_redirect("services.php"); # #pkgnum ?
63 #wp_redirect("service_order_success.php"); # #pkgnum ?
64 wp_redirect("example_selfservice.php"); # #pkgnum ?
70 $pkgselect = $freeside->mason_comp( [
71 'session_id' => $_COOKIE['freeside_session_id'],
72 'comp' => '/edit/cust_main/first_pkg/select-part_pkg.html',
73 'args' => [ 'password_verify', 1,
74 'onchange' , 'enable_order_pkg()',
76 'empty_label' , 'Select package',
77 'form_name' , 'OrderPkgForm',
78 'pkgpart_svcpart', $_POST['pkgpart_svcpart'],
79 'username' , $_POST['username'],
80 'password' , $_POST['_password'],
81 'password2' , $_POST['_password2'],
82 'popnum' , $_POST['popnum'],
83 'saved_domsvc' , $_POST['domsvc'],
91 <h3>Order a new service</h3>
93 <SCRIPT TYPE="text/javascript">
94 function enable_order_pkg () {
95 if ( document.OrderPkgForm.pkgpart_svcpart.selectedIndex > 0 ) {
96 document.OrderPkgForm.submit.disabled = false;
98 document.OrderPkgForm.submit.disabled = true;
103 <?php include(dirname(__FILE__).'/elements/error.php'); ?>
105 <FORM NAME="OrderPkgForm" ACTION="services_new.php" METHOD=POST>
107 <?php echo $pkgselect['output']; ?>
110 <INPUT NAME="submit" TYPE="submit" VALUE="Purchase" <?php if ( ! $_POST['pkgpart_svcpart'] ) { echo 'DISABLED'; } ?>>
113 <?php get_footer(); ?>