function edit_submit($expensetype_id) { $data['name'] = $this->input->post('name'); $data['content'] = $this->input->post('content'); $data['taxable'] = post_checkbox('taxable'); $data['company_id'] = (int) $this->session->userdata('company_id'); if ($this->security_model->own_expensetype($expensetype_id) && $this->perm_user->expensetype->update && $this->expensetype_model->update($expensetype_id, $data)) { $this->load->view('expensetype/xhr_edit_submit'); } else { $data['error'] = $this->lang->line('error_update_expensetype'); $this->load->view('xhr_error', $data); } }
function edit_submit($invoice_id) { $invoice['name'] = htmlentities($this->input->post('name')); $invoice['duedate'] = $this->input->post('duedate'); $invoice['client_id'] = (int) $this->input->post('client_id'); $invoice['amount'] = (double) $this->input->post('amount'); $invoice['paid'] = post_checkbox('paid'); $invoice['remind'] = post_checkbox('remind'); if ($invoice['paid']) { $invoice['paiddate'] = $this->input->post('paiddate'); } else { $invoice['paiddate'] = '0000-00-00'; } $invoice['itemize'] = post_checkbox('itemize'); $invoice['sent'] = post_checkbox('sent'); $invoice['content'] = htmlentities($this->input->post('content')); $invoice['company_id'] = $this->session->userdata('company_id'); if ($invoice['name'] && $this->security_model->own_invoice($invoice_id) && $this->perm_user->invoice->update && $this->invoice_model->update($invoice_id, $invoice)) { $data['message'] = $this->lang->line('invoice_updated'); $this->load->view('invoice/xhr_edit_submit', $data); } else { $data['error'] = $this->lang->line('error_update_invoice'); $this->load->view('xhr_error', $data); } }
function edit_submit($ticketstage_id) { $data['name'] = htmlentities($this->input->post('name')); $data['description'] = htmlentities($this->input->post('description')); $data['ticket_category_id'] = (int) $this->input->post('ticket_category_id'); $data['company_id'] = (int) $this->session->userdata('company_id'); $data['closed'] = post_checkbox('closed'); if ($this->security_model->own_ticketstage($ticketstage_id) && $this->perm_user->tickettype->update && $this->ticketstage_model->update($ticketstage_id, $data)) { $this->load->view('ticketstage/xhr_edit_submit'); } else { $data['error'] = $this->lang->line('error_update_ticketstage'); $this->load->view('xhr_error', $data); } }
function edit_submit($segment_id) { $data['date'] = $this->input->post('date'); $data['project_id'] = (int) $this->input->post('project_id'); $data['worktype_id'] = (int) $this->input->post('worktype_id'); $data['ticket_id'] = (int) $this->input->post('ticket_id') ?: NULL; $data['billable'] = post_checkbox('billable'); $data['time_start'] = (int) $this->input->post('time_start_hour') . ':' . (int) $this->input->post('time_start_minute') . ':00'; $time_end_received = (int) $this->input->post('time_end_hour') . ':' . (int) $this->input->post('time_end_minute') . ':00'; $time_end = strtotime($data['date'] . ' ' . $time_end_received); $time_start = strtotime($data['date'] . ' ' . $data['time_start']); $raw_difference = $time_end - $time_start; $hour_difference = floor($raw_difference / 3600); $minute_difference = ($raw_difference - $hour_difference * 3600) / 60; $data['duration'] = str_pad($hour_difference, 2, '0', STR_PAD_LEFT) . ':' . str_pad($minute_difference, 2, '0', STR_PAD_LEFT) . ':00'; $data['content'] = htmlentities($this->input->post('content')); $data['company_id'] = (int) $this->session->userdata('company_id'); $data['user_id'] = (int) $this->session->userdata('id'); if ($this->security_model->own_segment($segment_id) && $this->perm_user->segment->update && $this->segment_model->update($segment_id, $data)) { $this->load->view('segment/xhr_edit_submit'); } else { $data['error'] = $this->lang->line('error_update_segment'); $this->load->view('xhr_error', $data); } }
/** * @todo fix up this code, make it more stable */ function edit_submit($expense_id) { $data['date'] = $this->input->post('date'); $data['project_id'] = (int) $this->input->post('project_id'); $data['expensetype_id'] = (int) $this->input->post('expensetype_id'); $data['billable'] = post_checkbox('billable'); $data['content'] = htmlentities($this->input->post('content')); $data['amount'] = (double) $this->input->post('amount'); $data['company_id'] = (int) $this->session->userdata('company_id'); if ($this->security_model->own_expense($expense_id) && $this->perm_user->expense->update && $this->expense_model->update($expense_id, $data)) { $this->load->view('expense/xhr_edit_submit'); } else { $data['error'] = $this->lang->line('error_update_expense'); $this->load->view('xhr_error', $data); } }