summaryrefslogtreecommitdiff
path: root/ng_selfservice/process_packages_change.php
blob: a7ba2c4bf81ecc89e034aa3fdb3d3a56c1896e01 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
<? $title ='Change Package'; include('elements/header.php'); ?>
<? $current_menu = 'services.php'; include('elements/menu.php'); ?>

<?

require_once('elements/session.php');

$results = array();

$params = array( 'custnum', 'pkgpart', 'pkgnum' );

$matches = array();
if ( preg_match( '/^(\d+)_(\d+)$/', $_POST['pkgpart_svcpart'], $matches ) ) {
  $_POST['pkgpart'] = $matches[1];
  $_POST['svcpart'] = $matches[2];
  $params[] = 'svcpart';
  $svcdb = $_POST['svcdb'];
  if ( $svcdb == 'svc_acct' ) { $params[] = 'domsvc'; }
} else {
  $svcdb = 'svc_acct';
}

if ( $svcdb == 'svc_acct' ) {

  array_push($params, 'username', '_password', '_password2', 'sec_phrase', 'popnum' );

  #if ( strlen($_POST['_password']) == 0 ) {
  #  $results['error'] = 'Empty password';
  #}
  #if ( $_POST['_password'] != $_POST['_password'] ) {
  #  $results['error'] = 'Passwords do not match';
  #  $_POST['_password'] = '';
  #  $_POST['_password2'] = '';
  #}

} elseif ( $svcdb == 'svc_phone' ) {

  array_push($params, 'phonenum', 'sip_password', 'pin', 'phone_name' );

} else {
  die("$svcdb not handled on process_change_pkg yet");
}

if ( ! $results['error'] ) {

  $change_pkg = array(
    'session_id' => $_COOKIE['session_id'],
  );

  foreach ( $params AS $param ) {
    $change_pkg[$param] = $_POST[$param];
  }

  $results = $freeside->change_pkg($change_pkg);

}

#  if ( $results->{'error'} ) {
#    $action = 'customer_change_pkg';
#    return {
#      $cgi->Vars,
#      %{customer_change_pkg()},
#      'error' => '<FONT COLOR="#FF0000">'. $results->{'error'}. '</FONT>',
#    };
#  } else {
#    return $results;
#  }


## reload below except pkgnum
if ( isset($results['error']) && $results['error'] ) {
  $error = $results['error'];
#  header('Location:services.php?error='. urlencode($error));
#  die();
}

#$pkgnum = $results['pkgnum'];

#header("Location:services.php"); # #pkgnum ?
## end reload
?>
<? include('elements/error.php'); ?>

<FONT SIZE=4>Package Successfully Changed To "<? echo htmlspecialchars($results['pkg']); ?>"</FONT><BR><BR>

<? include('elements/menu_footer.php'); ?>
<? include('elements/footer.php'); ?>