hide tickets with selfservice priority indicating closure, RT#79444
[freeside.git] / ng_selfservice / process_services_new.php
1 <?
2
3 require_once('elements/session.php');
4
5 $results = array();
6
7 $params = array( 'custnum', 'pkgpart' );
8
9 $matches = array();
10 if ( preg_match( '/^(\d+)_(\d+)$/', $_POST['pkgpart_svcpart'], $matches ) ) {
11   $_POST['pkgpart'] = $matches[1];
12   $_POST['svcpart'] = $matches[2];
13   $params[] = 'svcpart';
14   $svcdb = $_POST['svcdb'];
15   if ( $svcdb == 'svc_acct' ) { $params[] = 'domsvc'; }
16 } else {
17   $svcdb = 'svc_acct';
18 }
19
20 if ( $svcdb == 'svc_acct' ) {
21
22   array_push($params, 'username', '_password', '_password2', 'sec_phrase', 'popnum' );
23
24   if ( strlen($_POST['_password']) == 0 ) {
25     $results['error'] = 'Empty password';
26   }
27   if ( $_POST['_password'] != $_POST['_password2'] ) {
28     $results['error'] = 'Passwords do not match';
29     $_POST['_password'] = '';
30     $_POST['_password2'] = '';
31   }
32
33 } elseif ( $svcdb == 'svc_phone' ) {
34
35   array_push($params, 'phonenum', 'sip_password', 'pin', 'phone_name' );
36
37 } else {
38   die("$svcdb not handled on process_order_pkg yet");
39 }
40
41 if ( ! $results['error'] ) {
42
43   $order_pkg = array(
44     'session_id' => $_COOKIE['session_id'],
45   );
46
47   foreach ( $params AS $param ) {
48     $order_pkg[$param] = $_POST[$param];
49   }
50
51   $results = $freeside->order_pkg($order_pkg);
52
53 }
54
55 #  if ( $results->{'error'} ) {
56 #    $action = 'customer_order_pkg';
57 #    return {
58 #      $cgi->Vars,
59 #      %{customer_order_pkg()},
60 #      'error' => '<FONT COLOR="#FF0000">'. $results->{'error'}. '</FONT>',
61 #    };
62 #  } else {
63 #    return $results;
64 #  }
65
66 if ( isset($results['error']) && $results['error'] ) {
67   $error = $results['error'];
68   header('Location:services_new.php?error='. urlencode($error));
69   die();
70 }
71
72 #$pkgnum = $results['pkgnum'];
73
74 header("Location:services.php"); # #pkgnum ?
75
76 ?>