diff --git a/CHANGELOG b/CHANGELOG
index e81cb5b..da14582 100755
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -32,11 +32,12 @@ Contents
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
**Changes introduced in 0.3.12
+[Enhance] When configuring template port ID, show last port ID in long abreviated list
+[Enhance] Cable path connections generated programatically instead of static images
+[Enhance] Added customer payment portal
[Fix] Corrected nested insert size as displayed in "Available Templates" box
[Fix] Template port ID add/remove field not refreshing when shown for different connectable partitions
[Fix] Fresh install inserted data in a way that would cause a "duplicate cabinet order" error on backup restore
-[Enhance] When configuring template port ID, show last port ID in long abreviated list
-[Enhance] Cable path connections generated programatically instead of static images
**Changes introduced in 0.3.11
[Enhance] Added ability to create inserts with enclosure partitions
diff --git a/admin.php b/admin.php
index 99ada2e..9bc763d 100755
--- a/admin.php
+++ b/admin.php
@@ -139,13 +139,18 @@ $qls->Security->check_auth_page('administrator.php');
Check
-
+
+
+ Payment Portal
+
+
+
diff --git a/assets/pages/jquery.admin.js b/assets/pages/jquery.admin.js
index 0baf0cb..a48b273 100755
--- a/assets/pages/jquery.admin.js
+++ b/assets/pages/jquery.admin.js
@@ -269,6 +269,28 @@ $( document ).ready(function() {
});
});
+ $('#entitlementPaymentPortal').on('click', function(event){
+
+ var data = {
+ action: 'portal'
+ };
+
+ data = JSON.stringify(data);
+
+ // Process mail settings
+ $.post("backend/process_entitlement.php", {data:data}, function(response){
+ var responseJSON = JSON.parse(response);
+ if (responseJSON.active == 'inactive'){
+ window.location.replace("/");
+ } else if ($(responseJSON.error).size() > 0){
+ displayError(responseJSON.error);
+ } else {
+ displaySuccess(responseJSON.success.customerPortalURL);
+ window.open(responseJSON.success.customerPortalURL, '_blank');
+ }
+ });
+ });
+
$('#confirmEntitlementCancellation').on('click', function(event){
event.preventDefault();
var entitlementID = $('#inline-entitlement').editable('getValue')['inline-entitlement'];
diff --git a/backend/process_entitlement.php b/backend/process_entitlement.php
index 01416a0..01d86f1 100755
--- a/backend/process_entitlement.php
+++ b/backend/process_entitlement.php
@@ -40,13 +40,61 @@ if($_SERVER['REQUEST_METHOD'] == 'POST'){
$qls->App->cancelEntitlement();
$qls->App->gatherEntitlementData();
$validate->returnData['success'] = $qls->App->entitlementArray;
+
+ } else if($action == 'portal') {
+ $entitlementID = $qls->App->entitlementArray['id'];
+
+ // POST Request
+ $data = array(
+ 'action' => 'portal',
+ 'entitlementID' => $entitlementID
+ );
+ $dataJSON = json_encode($data);
+ $POSTData = array('data' => $dataJSON);
+
+ $ch = curl_init('https://patchcablemgr.com/public/process_subscription.php');
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
+ curl_setopt($ch, CURLOPT_POST, true);
+ curl_setopt($ch, CURLOPT_POSTFIELDS, $POSTData);
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, "/etc/ssl/certs/");
+
+ // Submit the POST request
+ $responseJSON = curl_exec($ch);
+
+ //Check for request errors.
+ $errMsg = false;
+ if(!curl_errno($ch)) {
+ error_log('Debug (responseJSON): '.$responseJSON);
+ if($response = json_decode($responseJSON, true)) {
+ if(!count($response['error'])) {
+ if($response['success'] != '') {
+ $validate->returnData['success']['customerPortalURL'] = $response['success'];
+ } else {
+ $errMsg = 'Entitlement not found, please contact support@patchcablemgr.com';
+ }
+ } else {
+ $errMsg = $response['error'][0];
+ }
+ } else {
+ $errMsg = 'Invalid server response, please contact support@patchcablemgr.com';
+ }
+ } else {
+ $errMsg = 'Unable to contact server, please contact support@patchcablemgr.com';
+ }
+
+ if($errMsg) {
+ array_push($validate->returnData['error'], $errMsg);
+ }
+
+ // Close cURL session handle
+ curl_close($ch);
}
}
echo json_encode($validate->returnData);
}
function validate($data, &$validate, &$qls){
- $actionsArray = array('update', 'check', 'cancel');
+ $actionsArray = array('update', 'check', 'cancel', 'portal');
$action = strtolower($data['action']);
//Validate action
@@ -57,6 +105,7 @@ function validate($data, &$validate, &$qls){
// Validate entitlement ID
$entitlementID = strtolower($data['entitlementID']);
$validate->validateSHA($entitlementID, 'Invalid entitlement ID.');
+
}
}
}
diff --git a/includes/App.class.php b/includes/App.class.php
index 80825c1..9373bcf 100755
--- a/includes/App.class.php
+++ b/includes/App.class.php
@@ -1945,6 +1945,11 @@ var $qls;
}
function logAction($function, $actionType, $actionString){
+
+ if(strlen($actionString) > 200) {
+ $actionString = substr($actionString, 0 , 200).'...';
+ }
+
$columns = array('date', 'function', 'action_type', 'user_id', 'action');
$values = array(time(), $function, $actionType, $this->qls->user_info['id'], $actionString);
$this->qls->SQL->insert('app_history', $columns, $values);
@@ -2376,7 +2381,6 @@ var $qls;
$POSTData = array('data' => $dataJSON);
$ch = curl_init('https://patchcablemgr.com/public/process_subscription.php');
- //curl_setopt($ch, CURLOPT_HTTPHEADER, array('Cookie: BACKDOOR=yes'));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $POSTData);