Actual prod

This commit is contained in:
mac 2026-07-03 12:04:07 +03:00
parent f4cfdaf9eb
commit b8881e2aad

View File

@ -4,7 +4,7 @@
*
* @author iren
*/
class Requisitions{
class Requisitions{
private $user;
private $roles_user = ['AGENCY', 'AGENT', 'MANAGER'];
private $role_user;
@ -4836,7 +4836,8 @@
$sql = "SELECT * FROM `requisitions` WHERE id = $id";
$requisistion = $this->db->fetch_assoc($this->db->query($sql));
// Вычисляем последний этап воронки
// последний этап воронки
$lastStage = 8; // значение по умолчанию
$funnelId = intval($requisistion['funnel_id']);
if ($funnelId > 0) {
@ -4848,7 +4849,7 @@
}
}
} else {
// funnel_id = 0 — дефолтная воронка, берём по agency_id
// funnel_id = 0
$agencyId = $this->user->agencyId;
$q_default = $this->db->query("SELECT id FROM funnel_default WHERE agency_id = $agencyId LIMIT 1");
if ($q_default && $this->db->num_rows($q_default) > 0) {
@ -4889,7 +4890,6 @@
if (!$this->db->query($sql))
$errors[] = $this->db->errorInfo();
// Обновление статуса сделки при закрытии заявки
if (!empty($requisistion['deal_id']) && $requisistion['deal_id'] > 0) {
$dealId = intval($requisistion['deal_id']);
// Проверяем, есть ли другие заявки в сделке, которые ещё не закрыты
@ -4910,7 +4910,7 @@
$linkedReq = $this->db->fetch_assoc($this->db->query($linkedReqSql));
if ($linkedReq) {
$reason = 'Закрыта, т.к. была смежной заявкой по сделке "' . addslashes($dealRow['title']) . '"';
$reason = 'Закрыта, т.к. была смежной заявкой по сделке ID: ' . $dealId;
$this->db->query("UPDATE requisitions SET deleted=1, confirm=10, reason='" . addslashes($reason) . "', who_delete=$user_id WHERE id=$linkedReqId");
@ -6201,7 +6201,7 @@
*/
public function get_union_reqs($reqs){
/* ini_set('display_errors', 1);
error_reporting(E_ALL & ~E_DEPRECATED & ~E_STRICT & ~E_NOTICE);*/
error_reporting(E_ALL & ~E_DEPRECATED & ~E_STRICT & ~E_NOTICE);*/
$result = array();
if($this->user_id > 0 && $this->agencyId > 0 && !empty($reqs)){
@ -6245,7 +6245,7 @@ error_reporting(E_ALL & ~E_DEPRECATED & ~E_STRICT & ~E_NOTICE);*/
public function save_union_reqs($reqs, $main_id){
/* ini_set('display_errors', 1);
error_reporting(E_ALL & ~E_DEPRECATED & ~E_STRICT & ~E_NOTICE);*/
error_reporting(E_ALL & ~E_DEPRECATED & ~E_STRICT & ~E_NOTICE);*/
$result = array();
$done = false;
@ -7007,7 +7007,7 @@ error_reporting(E_ALL & ~E_DEPRECATED & ~E_STRICT & ~E_NOTICE);*/
'items' => $stmt->fetchAll(PDO::FETCH_ASSOC)
];
}
}
}
// Базовый тип: 1=Подбор, 2=Реализация, 3=Другие услуги, 4=Спрос. heir != 0 — кастомный наследник.
function requisition_base_type_id($typeRow) {