summaryrefslogtreecommitdiff
path: root/ng_selfservice
diff options
context:
space:
mode:
authorChristopher Burger <burgerc@freeside.biz>2017-05-02 09:00:43 -0400
committerChristopher Burger <burgerc@freeside.biz>2017-07-21 17:16:29 -0400
commit9c1e27955566bfddd0c756e6237a89d8427d0f3e (patch)
tree4507ca95d18660b8988bce8bbcfd1b8242837a56 /ng_selfservice
parent43d43d3101e7f555422bd48276f22b1bebbf6010 (diff)
RT# 73993 updated ngselfservice to allow for package change.
Diffstat (limited to 'ng_selfservice')
-rw-r--r--ng_selfservice/packages_change.php80
-rw-r--r--ng_selfservice/process_packages_change.php89
2 files changed, 169 insertions, 0 deletions
diff --git a/ng_selfservice/packages_change.php b/ng_selfservice/packages_change.php
new file mode 100644
index 000000000..8b4386ce0
--- /dev/null
+++ b/ng_selfservice/packages_change.php
@@ -0,0 +1,80 @@
+<? $title ='Change Package'; include('elements/header.php'); ?>
+<? $current_menu = 'services.php'; include('elements/menu.php'); ?>
+<?
+
+$customer_info = $freeside->customer_info_short( array(
+ 'session_id' => $_COOKIE['session_id'],
+) );
+
+$list_pkgs = $freeside->list_pkgs( array(
+ 'session_id' => $_COOKIE['session_id'],
+) );
+
+if ( isset($list_pkgs['error']) && $list_pkgs['error'] ) {
+ $error = $list_pkgs['error'];
+ header('Location:index.php?error='. urlencode($error));
+ die();
+}
+
+extract($list_pkgs);
+
+$get_params = array( 'pkgnum', 'pkg' );
+foreach ( $get_params AS $param ) {
+ $params[$param] = $_GET[$param];
+}
+
+$pkgnum = $_GET['pkgnum'];
+$pkg = $_GET['pkg'];
+
+$pkgselect = $freeside->mason_comp( array(
+ 'session_id' => $_COOKIE['session_id'],
+ 'comp' => '/elements/select-part_pkg.html',
+ 'args' => array( 'custnum' => $customer_info['custnum'],
+ 'curr_value' => 'current_value',
+ ),
+ )
+);
+
+if ( isset($pkgselect['error']) && $pkgselect['error'] ) {
+ $error = $pkgselect['error'];
+ header('Location:index.php?error='. urlencode($error));
+ die();
+}
+
+?>
+
+<SCRIPT TYPE="text/javascript">
+function enable_change_pkg () {
+ if ( document.ChangePkgForm.pkgpart_svcpart.selectedIndex > 0 ) {
+ document.ChangePkgForm.submit.disabled = false;
+ } else {
+ document.ChangePkgForm.submit.disabled = true;
+ }
+}
+</SCRIPT>
+
+<FONT SIZE=4>Purchase replacement package for "<? echo $pkg; ?>"</FONT><BR><BR>
+
+<? include('elements/error.php'); ?>
+
+<FORM NAME="ChangePkgForm" ACTION="process_packages_change.php" METHOD=POST>
+<TABLE BGCOLOR="#cccccc" BORDER=0 CELLSPACING=0>
+
+<TR>
+ <TD COLSPAN=2>
+ <TABLE><TR><TD> <? echo $pkgselect['output']; ?>
+
+ </TD>
+</TR>
+
+</TABLE>
+<BR>
+<INPUT TYPE="hidden" NAME="custnum" VALUE="<? echo $customer_info['custnum'] ?>">
+<INPUT TYPE="hidden" NAME="pkgnum" VALUE="<? echo $params['pkgnum'] ?>">
+<INPUT TYPE="hidden" NAME="pkg" VALUE="<? echo $params['pkg'] ?>">
+<INPUT TYPE="hidden" NAME="action" VALUE="process_change_pkg">
+<INPUT NAME="submit" TYPE="submit" VALUE="Change Package">
+</FORM>
+
+<? include('elements/menu_footer.php'); ?>
+<? include('elements/footer.php'); ?> \ No newline at end of file
diff --git a/ng_selfservice/process_packages_change.php b/ng_selfservice/process_packages_change.php
new file mode 100644
index 000000000..114cc6b1a
--- /dev/null
+++ b/ng_selfservice/process_packages_change.php
@@ -0,0 +1,89 @@
+<? $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);
+
+ echo $results;
+
+}
+
+# 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 Changed Su for "<? echo $pkg; ?>"</FONT><BR><BR>
+
+<? include('elements/menu_footer.php'); ?>
+<? include('elements/footer.php'); ?> \ No newline at end of file