| Server IP : 162.214.74.102 / Your IP : 216.73.217.114 Web Server : Apache System : Linux dedi-4363141.lrsys.com.br 3.10.0-1160.119.1.el7.tuxcare.els25.x86_64 #1 SMP Wed Oct 1 17:37:27 UTC 2025 x86_64 User : lrsys ( 1015) PHP Version : 5.6.40 Disable Function : exec,passthru,shell_exec,system MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /home/lrsys/www/lrsys_apps/leo/application/plugins/module_imobles/factories/ |
Upload File : |
<?php
include_once "Factory.php";
class DealsFactory extends Factory {
public static function create($data, $query, $create = false) {
$query->title = $data['title'];
$query->timing_id = $data['timing_id'];
$query->vgv_id = $data['vgv_id'];
$query->engagement_id = $data['engagement_id'];
$query->first_contact_id = $data['first_contact_id'];
$query->lost_reason_id = $data['lost_reason_id'];
$query->sale_stage_id = $data['sale_stage_id'];
$query->status_id = $data['status_id'];
$query->service_region_id = $data['service_region_id'];
$query->passing_event_type = @$data['passing_event_type'];
$query->closing_journey = @$data['closing_journey'];
$query->passing_event_date = isset($data['passing_event_date']) ? _formatDateDB($data['passing_event_date']) : null;
if (isset($data['crm_account_related'])) {
$query->crm_account_related = json_encode($data['crm_account_related']);
} else {
$query->crm_account_related = json_encode(array());
}
$query->sdr_id = $data['sdr_id'];
$query->seller_id = @$data['seller_id'];
$query->first_choice = $data['first_choice'];
$query->high_engagement = @$data['high_engagement'] == 1 ? 1 : 0;
$query->commission = Finance::amount_fix(@$data['commission']);
$query->deal_amount = Finance::amount_fix(@$data['deal_amount']);
$query->expected_closed_date = isset($data['expected_closed_date']) ? _formatDateDB($data['expected_closed_date']) : null;
$user = User::_info();
if ($create) {
//somente cadastra o crm_account_id no novo
$query->crm_account_id = $data['crm_account_id'];
$query->created_at = date('Y-m-d H:i:s');
$query->created_by = $user->id;
}
$query->closed_at = !empty($data['closed_at']) ? _formatDateDB($data['closed_at']) : null;
$query->closed_by = $user->id;
$query->updated_at = date('Y-m-d H:i:s');
$query->updated_by = $user->id;
return $query;
}
}