goiintra/public_html/lib/shortInfo_lib_process.php

61 lines
1.1 KiB
PHP

<?php
include getenv("DOCUMENT_ROOT")."/include/session_include.php";
include_once getenv("DOCUMENT_ROOT")."/lib/erp_api.php";
include_once getenv("DOCUMENT_ROOT")."/assets/api/customer.php";
if($c_uid == "") {
echo 0;
exit();
}
if ($_SESSION['ss_LEVEL'] == 10) {
echo -1;
exit();
}
try {
$c_comment_riSTR = str_replace("\\","",trim($c_comment_ri));
$c_locationSTR = str_replace("\\","",trim($c_location));
// ====================
// CUSTOMER PATCH
// ====================
$svc = new CustomerService();
$result = $svc->patchCustomer(
(int)$c_uid,
[
'c_comment_ri' => $c_comment_riSTR,
'c_location' => $c_locationSTR,
'c_updatedby' => $_SESSION['ss_UID']
]
);
// ====================
// LOG
// ====================
$logText = json_encode([
'c_comment_ri' => $c_comment_riSTR,
'c_location' => $c_locationSTR
], JSON_UNESCAPED_UNICODE);
addLog(
"add",
"SHORT INFO",
"UPDATE",
$_SESSION['ss_UID'],
$logText,
$c_uid
);
echo 1;
exit();
} catch (Exception $e) {
error_log($e->getMessage());
echo 0;
exit();
}
?>