| Server IP : 103.161.17.216 / Your IP : 216.73.216.1 Web Server : nginx/1.18.0 System : Linux tipsysaigoncharming 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 User : www-data ( 33) PHP Version : 7.4.3-4ubuntu2.29 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /var/www/app.houseland.info/application/libraries/gdpr/ |
Upload File : |
<?php
defined('BASEPATH') or exit('No direct script access allowed');
class Gdpr_estimates
{
private $ci;
public function __construct()
{
$this->ci = &get_instance();
}
public function export($customer_id)
{
$valAllowed = get_option('gdpr_contact_data_portability_allowed');
if (empty($valAllowed)) {
$valAllowed = [];
} else {
$valAllowed = unserialize($valAllowed);
}
$this->ci->db->where('clientid', $customer_id);
$estimates = $this->ci->db->get(db_prefix().'estimates')->result_array();
$this->ci->db->where('show_on_client_portal', 1);
$this->ci->db->where('fieldto', 'estimate');
$this->ci->db->order_by('field_order', 'asc');
$custom_fields = $this->ci->db->get(db_prefix().'customfields')->result_array();
$this->ci->load->model('currencies_model');
foreach ($estimates as $estimatesKey => $estimate) {
unset($estimates[$estimatesKey]['adminnote']);
$estimates[$estimatesKey]['shipping_country'] = get_country($estimate['shipping_country']);
$estimates[$estimatesKey]['billing_country'] = get_country($estimate['billing_country']);
$estimates[$estimatesKey]['currency'] = $this->ci->currencies_model->get($estimate['currency']);
$estimates[$estimatesKey]['items'] = _prepare_items_array_for_export(get_items_by_type('estimate', $estimate['id']), 'estimate');
if (in_array('estimates_notes', $valAllowed)) {
// Notes
$this->ci->db->where('rel_id', $estimate['id']);
$this->ci->db->where('rel_type', 'estimate');
$estimates[$estimatesKey]['notes'] = $this->ci->db->get(db_prefix().'notes')->result_array();
}
if (in_array('estimates_activity_log', $valAllowed)) {
// Activity
$this->ci->db->where('rel_id', $estimate['id']);
$this->ci->db->where('rel_type', 'estimate');
$estimates[$estimatesKey]['activity'] = $this->ci->db->get(db_prefix().'sales_activity')->result_array();
}
$estimates[$estimatesKey]['views'] = get_views_tracking('estimate', $estimate['id']);
$estimates[$estimatesKey]['tracked_emails'] = get_tracked_emails($estimate['id'], 'estimate');
$estimates[$estimatesKey]['additional_fields'] = [];
foreach ($custom_fields as $cf) {
$estimates[$estimatesKey]['additional_fields'][] = [
'name' => $cf['name'],
'value' => get_custom_field_value($estimate['id'], $cf['id'], 'estimate'),
];
}
}
return $estimates;
}
}