| Server IP : 210.245.233.93 / Your IP : 216.73.216.226 Web Server : Apache/2.2.15 (CentOS) System : Linux webserver2.onesolution.com.hk 2.6.32-754.35.1.el6.x86_64 #1 SMP Sat Nov 7 12:42:14 UTC 2020 x86_64 User : apache ( 48) PHP Version : 5.3.3 Disable Function : exec, shell_exec, system, passthru, popen, proc_open, pcntl_exec MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/onesolution.com.hk/onesupport/job/ |
Upload File : |
<?php
require_once(__DIR__ . '/../checkuser.php');
function edit($id) {
global $dbh, $sqlsrv_dbh;
//-----------------------------------------------------------------------------
// Find job by id
//-----------------------------------------------------------------------------
$sql = "SELECT * FROM sup_job WHERE id = ?";
$parameters = array($id);
if (!($sth = $dbh->prepare($sql))) {
throw new Exception("sql prepare statement failure: $sql");
}
$sth->setFetchMode(PDO::FETCH_ASSOC);
if (!$sth->execute($parameters)) {
throw new Exception("sql execute statement failure: $sql");
}
$job = $sth->fetch(PDO::FETCH_ASSOC);
if (empty($job)) {
throw new Exception('Job not found!');
}
if($job["job_type"] == "CALL IN"){
redirectAndExit('../call_in_job/modifyform.php?id='.$id);
exit;
}
//-----------------------------------------------------------------------------
// Check permission
//-----------------------------------------------------------------------------
if (!Util::isAdmin()) {
if ($job['staff_id'] != $_SESSION['webadmin']['id']) {
redirectAndExit('index.php?message=No permission!');
}
}
require(__DIR__ . '/modify.php');
//-----------------------------------------------------------------------------
// Return array parameters
//-----------------------------------------------------------------------------
$sql = "SELECT * FROM sup_job_detail WHERE job_id = ? ORDER BY id";
$parameters = array($job['id']);
if (!($sth = $dbh->prepare($sql))) {
throw new Exception("sql prepare statement failure: $sql");
}
$sth->setFetchMode(PDO::FETCH_ASSOC);
if (!$sth->execute($parameters)) {
throw new Exception("sql execute statement failure: $sql");
}
$job['details'] = $sth->fetchAll();
$json_details = array();
foreach ($job['details'] as $detail) {
$json_details[] = json_encode($detail);
}
$sql = "SELECT * FROM v_cm_customer_support V_CM_CUSTOMER_SUPPORT ORDER BY company_name";
if (!($sth = $dbh->prepare($sql))) {
throw new Exception("sql prepare statement failure: $sql");
}
$sth->setFetchMode(PDO::FETCH_ASSOC);
if (!$sth->execute()) {
throw new Exception("sql execute statement failure: $sql");
}
$customers = $sth->fetchAll();
$sql = "SELECT * FROM sys_login WHERE deleted = ? ORDER BY username";
$parameters = array(0);
if (!($sth = $dbh->prepare($sql))) {
throw new Exception("sql prepare statement failure: $sql");
}
$sth->setFetchMode(PDO::FETCH_ASSOC);
if (!$sth->execute($parameters)) {
throw new Exception("sql execute statement failure: $sql");
}
$staffs = $sth->fetchAll();
return array(
'job' => $job,
'typeOptions' => Job::typeOptions(),
'statusOptions' => Job::statusOptions(),
'customers' => $customers,
'staffs' => $staffs,
'json_details' => $json_details,
'detailStausOptions' => JobDetail::statusOptions(),
'message' => $_GET['message'],
);
}
extract(edit($_GET['id']));
require(__DIR__ . '/views/form.php');