contacts can be shared among customers / "duplicate contact emails", ng_selfservice...
[freeside.git] / ng_selfservice / process_select_cust.php
diff --git a/ng_selfservice/process_select_cust.php b/ng_selfservice/process_select_cust.php
new file mode 100644 (file)
index 0000000..fe36121
--- /dev/null
@@ -0,0 +1,32 @@
+<?
+
+require('freeside.class.php');
+$freeside = new FreesideSelfService();
+
+$response = $freeside->switch_cust( array( 
+  'session_id' => $_COOKIE['session_id'],
+  'custnum'    => $_POST['custnum'],
+) );
+
+#error_log("[switch_cust] received response from freeside: $response");
+
+$error = $response['error'];
+
+if ( $error ) {
+
+  //this isn't well handled... but the only possible error is a session timeout?
+
+  header('Location:index.php?username='. urlencode($username).
+                           '&domain='.   urlencode($domain).
+                           '&email='.    urlencode($email).
+                           '&error='.    urlencode($error)
+        );
+  die();
+
+}
+
+// sucessful customer selection
+
+header("Location:main.php");
+
+?>