From b058e91a995c9e9fc0422964fc35cb51786c7931 Mon Sep 17 00:00:00 2001 From: FrancescoUK Date: Mon, 27 Nov 2017 20:52:46 +0000 Subject: [PATCH] Fix code indentation issues --- application/helpers/table_helper.php | 6 +- application/libraries/Mailchimp_lib.php | 48 ++++++++-------- application/models/Expense.php | 74 ++++++++++++------------- application/models/Expense_category.php | 19 ++++--- 4 files changed, 74 insertions(+), 73 deletions(-) diff --git a/application/helpers/table_helper.php b/application/helpers/table_helper.php index a32cd8cb3..7f24647db 100644 --- a/application/helpers/table_helper.php +++ b/application/helpers/table_helper.php @@ -517,7 +517,7 @@ function get_expenses_data_row($expense) 'payment_type' => $expense->payment_type, 'category_name' => $expense->category_name, 'description' => $expense->description, - 'createdBy' => $expense->first_name.' '. $expense->last_name, + 'createdBy' => $expense->first_name.' '. $expense->last_name, 'edit' => anchor($controller_name."/view/$expense->expense_id", '', array('class'=>'modal-dlg', 'data-btn-submit' => $CI->lang->line('common_submit'), 'title'=>$CI->lang->line($controller_name.'_update')) )); @@ -531,7 +531,7 @@ function get_expenses_data_last_row($expense) foreach($expense->result() as $key=>$expense) { - $sum_amount_expense += $expense->amount; + $sum_amount_expense += $expense->amount; } return array( @@ -552,7 +552,7 @@ function get_expenses_manage_payments_summary($payments, $expenses) foreach($payments as $key=>$payment) { - $amount = $payment['amount']; + $amount = $payment['amount']; $table .= '
' . $payment['payment_type'] . ': ' . to_currency($amount) . '
'; } $table .= ''; diff --git a/application/libraries/Mailchimp_lib.php b/application/libraries/Mailchimp_lib.php index a11122367..3346ce0dc 100644 --- a/application/libraries/Mailchimp_lib.php +++ b/application/libraries/Mailchimp_lib.php @@ -26,9 +26,9 @@ class MailchimpConnector */ private $_api_endpoint = 'https://.api.mailchimp.com/3.0/'; - /** - * Constructor - */ + /** + * Constructor + */ public function __construct($api_key = '') { $CI =& get_instance(); @@ -53,13 +53,13 @@ class MailchimpConnector } } - /** - * Call an API method. Every request needs the API key - * @param string $httpVerb The HTTP method to be used - * @param string $method The API method to call, e.g. 'lists/list' - * @param array $args An array of arguments to pass to the method. Will be json-encoded for you. - * @return array Associative array of json decoded API response. - */ + /** + * Call an API method. Every request needs the API key + * @param string $httpVerb The HTTP method to be used + * @param string $method The API method to call, e.g. 'lists/list' + * @param array $args An array of arguments to pass to the method. Will be json-encoded for you. + * @return array Associative array of json decoded API response. + */ public function call($httpVerb = 'POST', $method, $args = array()) { if(!empty($this->_api_key)) @@ -70,13 +70,13 @@ class MailchimpConnector return FALSE; } - /** - * Builds the request URL based on request type - * @param string $httpVerb The HTTP method to be used - * @param string $method The API method to be called - * @param array $args Assoc array of parameters to be passed - * @return string Request URL - */ + /** + * Builds the request URL based on request type + * @param string $httpVerb The HTTP method to be used + * @param string $method The API method to be called + * @param array $args Assoc array of parameters to be passed + * @return string Request URL + */ private function _build_request_url($httpVerb = 'POST', $method, $args = array()) { if($httpVerb == 'GET') @@ -87,13 +87,13 @@ class MailchimpConnector return $this->_api_endpoint . $method; } - /** - * Performs the underlying HTTP request. - * @param string $httpVerb The HTTP method to be used - * @param string $method The API method to be called - * @param array $args Assoc array of parameters to be passed - * @return array Assoc array of decoded result - */ + /** + * Performs the underlying HTTP request. + * @param string $httpVerb The HTTP method to be used + * @param string $method The API method to be called + * @param array $args Assoc array of parameters to be passed + * @return array Assoc array of decoded result + */ private function _request($httpVerb, $method, $args = array()) { $result = FALSE; diff --git a/application/models/Expense.php b/application/models/Expense.php index 885c7cd7b..64308e2be 100644 --- a/application/models/Expense.php +++ b/application/models/Expense.php @@ -7,17 +7,17 @@ class Expense extends CI_Model { /* - Determines if a given Expense_id is an Expense + Determines if a given Expense_id is an Expense */ public function exists($expense_id) { - $this->db->from('expenses'); + $this->db->from('expenses'); $this->db->where('expense_id', $expense_id); return ($this->db->get()->num_rows() == 1); - } - - /* + } + + /* Gets category info */ public function get_expense_category($expense_id) @@ -28,7 +28,7 @@ class Expense extends CI_Model return $this->Expense_category->get_info($this->db->get()->row()->expense_category_id); } - /* + /* Gets employee info */ public function get_employee($expense_id) @@ -38,10 +38,10 @@ class Expense extends CI_Model return $this->Employee->get_info($this->db->get()->row()->employee_id); } - + public function get_multiple_info($expense_ids) { - $this->db->from('expenses'); + $this->db->from('expenses'); $this->db->where_in('expenses.expense_id', $expense_ids); $this->db->order_by('expense_id', 'asc'); @@ -54,7 +54,7 @@ class Expense extends CI_Model public function get_found_rows($search, $filters) { return $this->search($search, $filters)->num_rows(); - } + } /* Searches expenses @@ -71,10 +71,10 @@ class Expense extends CI_Model MAX(employees.last_name) AS last_name, MAX(expense_categories.category_name) AS category_name '); - $this->db->from('expenses AS expenses'); + $this->db->from('expenses AS expenses'); $this->db->join('people AS employees', 'employees.person_id = expenses.employee_id', 'LEFT'); - $this->db->join('expense_categories AS expense_categories', 'expense_categories.expense_category_id = expenses.expense_category_id', 'LEFT'); - + $this->db->join('expense_categories AS expense_categories', 'expense_categories.expense_category_id = expenses.expense_category_id', 'LEFT'); + $this->db->group_start(); $this->db->like('employees.first_name', $search); $this->db->or_like('expenses.date', $search); @@ -83,10 +83,10 @@ class Expense extends CI_Model $this->db->or_like('expenses.amount', $search); $this->db->or_like('expense_categories.category_name', $search); $this->db->or_like('CONCAT(employees.first_name, " ", employees.last_name)', $search); - $this->db->group_end(); - + $this->db->group_end(); + $this->db->where('expenses.deleted', $filters['is_deleted']); - + if(empty($this->config->item('date_or_time_format'))) { $this->db->where('DATE_FORMAT(expenses.date, "%Y-%m-%d") BETWEEN ' . $this->db->escape($filters['start_date']) . ' AND ' . $this->db->escape($filters['end_date'])); @@ -95,12 +95,12 @@ class Expense extends CI_Model { $this->db->where('expenses.date BETWEEN ' . $this->db->escape(rawurldecode($filters['start_date'])) . ' AND ' . $this->db->escape(rawurldecode($filters['end_date']))); } - + if($filters['only_debit'] != FALSE) { $this->db->like('expenses.payment_type', $this->lang->line('expenses_debit')); } - + if($filters['only_credit'] != FALSE) { $this->db->like('expenses.payment_type', $this->lang->line('expenses_credit')); @@ -123,16 +123,16 @@ class Expense extends CI_Model { $this->db->like('expenses.payment_type', $this->lang->line('expenses_check')); } - + $this->db->group_by('expense_id'); - $this->db->order_by($sort, $order); - + $this->db->order_by($sort, $order); + if($rows > 0) - { + { $this->db->limit($rows, $limit); } - return $this->db->get(); + return $this->db->get(); } /* @@ -153,9 +153,9 @@ class Expense extends CI_Model expense_categories.expense_category_id AS expense_category_id, expense_categories.category_name AS category_name '); - $this->db->from('expenses AS expenses'); + $this->db->from('expenses AS expenses'); $this->db->join('people AS employees', 'employees.person_id = expenses.employee_id', 'LEFT'); - $this->db->join('expense_categories AS expense_categories', 'expense_categories.expense_category_id = expenses.expense_category_id', 'LEFT'); + $this->db->join('expense_categories AS expense_categories', 'expense_categories.expense_category_id = expenses.expense_category_id', 'LEFT'); $this->db->where('expense_id', $expense_id); $query = $this->db->get(); @@ -187,18 +187,18 @@ class Expense extends CI_Model if(!$expense_id == -1 || !$this->exists($expense_id)) { if($this->db->insert('expenses', $expense_data)) - { + { $expense_data['expense_id'] = $this->db->insert_id(); - + return TRUE; } return FALSE; } - + $this->db->where('expense_id', $expense_id); - return $this->db->update('expenses', $expense_data); + return $this->db->update('expenses', $expense_data); } /* @@ -206,23 +206,23 @@ class Expense extends CI_Model */ public function delete_list($expense_ids) { - $success = FALSE; + $success = FALSE; //Run these queries as a transaction, we want to make sure we do all or nothing - $this->db->trans_start(); - $this->db->where_in('expense_id', $expense_ids); + $this->db->trans_start(); + $this->db->where_in('expense_id', $expense_ids); $success = $this->db->update('expenses', array('deleted'=>1)); $this->db->trans_complete(); return $success; } - + /* Gets the payment summary for the expenses (expenses/manage) view */ public function get_payments_summary($search, $filters) { - // get payment summary + // get payment summary $this->db->select('payment_type, COUNT(amount) AS count, SUM(amount) AS amount'); $this->db->from('expenses'); $this->db->where('deleted', $filters['is_deleted']); @@ -250,19 +250,19 @@ class Expense extends CI_Model { $this->db->like('payment_type', $this->lang->line('expenses_check')); } - + if($filters['only_credit'] != FALSE) { $this->db->like('payment_type', $this->lang->line('expenses_credit')); } - + if($filters['only_debit'] != FALSE) { $this->db->like('payment_type', $this->lang->line('expenses_debit')); } $this->db->group_by('payment_type'); - + $payments = $this->db->get()->result_array(); return $payments; @@ -298,7 +298,7 @@ class Expense extends CI_Model $payments[$this->lang->line('sales_check')] = $this->lang->line('sales_check'); return $payments; - } + } /* Gets the expense payment diff --git a/application/models/Expense_category.php b/application/models/Expense_category.php index c4a4e1c66..7938a3636 100644 --- a/application/models/Expense_category.php +++ b/application/models/Expense_category.php @@ -63,18 +63,19 @@ class Expense_category extends CI_Model public function get_all($rows = 0, $limit_from = 0, $no_deleted = FALSE) { $this->db->from('expense_categories'); - $this->db->order_by('category_name', 'asc'); if($no_deleted == TRUE) { $this->db->where('deleted', 0); } + $this->db->order_by('category_name', 'asc'); + if($rows > 0) { $this->db->limit($rows, $limit_from); } - return $this->db->get(); + return $this->db->get(); } /* @@ -110,7 +111,7 @@ class Expense_category extends CI_Model return $this->db->update('expense_categories', $expense_category_data); } - + /* Deletes a list of expense_category */ @@ -118,8 +119,8 @@ class Expense_category extends CI_Model { $this->db->where_in('expense_category_id', $expense_category_ids); - return $this->db->update('expense_categories', array('deleted' => 1)); - } + return $this->db->update('expense_categories', array('deleted' => 1)); + } /* Perform a search on expense_category @@ -130,7 +131,7 @@ class Expense_category extends CI_Model $this->db->group_start(); $this->db->like('category_name', $search); $this->db->or_like('category_description', $search); - $this->db->group_end(); + $this->db->group_end(); $this->db->where('deleted', 0); $this->db->order_by($sort, $order); @@ -140,9 +141,9 @@ class Expense_category extends CI_Model $this->db->limit($rows, $limit_from); } - return $this->db->get(); + return $this->db->get(); } - + public function get_found_rows($search) { $this->db->from('expense_categories'); @@ -150,7 +151,7 @@ class Expense_category extends CI_Model $this->db->like('category_name', $search); $this->db->or_like('category_description', $search); $this->db->group_end(); - $this->db->where('deleted', 0); + $this->db->where('deleted', 0); return $this->db->get()->num_rows(); }