| 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/controllers/ |
Upload File : |
<?php
defined('BASEPATH') or exit('No direct script access allowed');
/**
* @property-read Proposals_model $proposals_model;
* @property-read Invoices_model $invoices_model;
*/
class Proposal extends ClientsController
{
public function index($id = '', $hash = '')
{
check_proposal_restrictions($id, $hash);
$proposal = $this->proposals_model->get($id);
if ($proposal->rel_type == 'customer' && !is_client_logged_in()) {
load_client_language($proposal->rel_id);
} else if($proposal->rel_type == 'lead') {
load_lead_language($proposal->rel_id);
}
$identity_confirmation_enabled = get_option('proposal_accept_identity_confirmation');
if ($this->input->post()) {
$action = $this->input->post('action');
switch ($action) {
case 'proposal_pdf':
$proposal_number = format_proposal_number($id);
$companyname = get_option('invoice_company_name');
if ($companyname != '') {
$proposal_number .= '-' . mb_strtoupper(slug_it($companyname), 'UTF-8');
}
try {
$pdf = proposal_pdf($proposal);
} catch (Exception $e) {
echo $e->getMessage();
die;
}
$pdf->Output($proposal_number . '.pdf', 'D');
break;
case 'proposal_comment':
// comment is blank
if (!$this->input->post('content')) {
redirect($this->uri->uri_string());
}
$data = $this->input->post();
$data['proposalid'] = $id;
$this->proposals_model->add_comment($data, true);
redirect($this->uri->uri_string() . '?tab=discussion');
break;
case 'accept_proposal':
$success = $this->proposals_model->mark_action_status(3, $id, true);
if ($success) {
process_digital_signature_image($this->input->post('signature', false), PROPOSAL_ATTACHMENTS_FOLDER . $id);
$this->db->where('id', $id);
$this->db->update(db_prefix().'proposals', get_acceptance_info_array());
$proposal = $this->proposals_model->get($id);
if ($proposal->invoice_id) {
$invoice = $this->invoices_model->get($proposal->invoice_id);
set_alert('success', _l('clients_proposal_invoiced_successfully'));
redirect(site_url("invoice/{$invoice->id}/{$invoice->hash}"));
}
redirect($this->uri->uri_string(), 'refresh');
}
break;
case 'decline_proposal':
$success = $this->proposals_model->mark_action_status(2, $id, true);
if ($success) {
redirect($this->uri->uri_string(), 'refresh');
}
break;
}
}
$number_word_lang_rel_id = 'unknown';
if ($proposal->rel_type == 'customer') {
$number_word_lang_rel_id = $proposal->rel_id;
}
$this->load->library('app_number_to_word', [
'clientid' => $number_word_lang_rel_id,
],'numberword');
$this->disableNavigation();
$this->disableSubMenu();
$data['title'] = $proposal->subject;
$data['proposal'] = hooks()->apply_filters('proposal_html_pdf_data', $proposal);
$data['bodyclass'] = 'proposal proposal-view';
$data['identity_confirmation_enabled'] = $identity_confirmation_enabled;
if ($identity_confirmation_enabled == '1') {
$data['bodyclass'] .= ' identity-confirmation';
}
$this->app_scripts->theme('sticky-js','assets/plugins/sticky/sticky.js');
$data['comments'] = $this->proposals_model->get_comments($id);
add_views_tracking('proposal', $id);
hooks()->do_action('proposal_html_viewed', $id);
$this->app_css->remove('reset-css','customers-area-default');
$data = hooks()->apply_filters('proposal_customers_area_view_data', $data);
no_index_customers_area();
$this->data($data);
$this->view('viewproposal');
$this->layout();
}
}