Fix chart
This commit is contained in:
parent
ffd671ae29
commit
b826267a73
@ -4885,11 +4885,16 @@ class Requisitions{
|
|||||||
if(isset($post['summa']) && $post['luck']){
|
if(isset($post['summa']) && $post['luck']){
|
||||||
if($dop_text != '') $dop_text .= " ";
|
if($dop_text != '') $dop_text .= " ";
|
||||||
$commission = isset($post['commission']) ? intval($post['commission']) : 0;
|
$commission = isset($post['commission']) ? intval($post['commission']) : 0;
|
||||||
|
// Если у заявки есть deal_id
|
||||||
|
$hasDeal = false;
|
||||||
|
$chkDeal = $this->db->query("SELECT deal_id FROM requisitions WHERE id = " . intval($id) . " AND deal_id IS NOT NULL AND deal_id > 0 LIMIT 1");
|
||||||
|
if ($chkDeal && $this->db->num_rows($chkDeal) > 0) $hasDeal = true;
|
||||||
|
$summaValue = $hasDeal ? $commission : intval($post['summa']);
|
||||||
$dop_text1 = "Совершена сделка на ".$commission." руб. ".$formatted_dateZajavki;
|
$dop_text1 = "Совершена сделка на ".$commission." руб. ".$formatted_dateZajavki;
|
||||||
if ($funnelId > 0) {
|
if ($funnelId > 0) {
|
||||||
$sql = "UPDATE requisitions SET reason='".$dop_text1."', who_delete = '$user_id', deleted=1, step_id=$lastStepId, summa='$post[summa]', confirm='$post[luck]' WHERE id=$id";
|
$sql = "UPDATE requisitions SET reason='".$dop_text1."', who_delete = '$user_id', deleted=1, step_id=$lastStepId, summa='".$summaValue."', confirm='$post[luck]' WHERE id=$id";
|
||||||
} else {
|
} else {
|
||||||
$sql = "UPDATE requisitions SET reason='".$dop_text1."', who_delete = '$user_id', deleted=1, stage=$lastStepId, summa='$post[summa]', confirm='$post[luck]' WHERE id=$id";
|
$sql = "UPDATE requisitions SET reason='".$dop_text1."', who_delete = '$user_id', deleted=1, stage=$lastStepId, summa='".$summaValue."', confirm='$post[luck]' WHERE id=$id";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -6248,7 +6253,7 @@ class Requisitions{
|
|||||||
$this->db->query($sql);
|
$this->db->query($sql);
|
||||||
|
|
||||||
return ['status' => true];
|
return ['status' => true];
|
||||||
} catch (\Throwable $th) {
|
} catch (\Exception $th) {
|
||||||
return ['status' => false];
|
return ['status' => false];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user