Fix code indentation issues

This commit is contained in:
FrancescoUK
2017-11-27 20:52:46 +00:00
parent 2cde603949
commit b058e91a99
4 changed files with 74 additions and 73 deletions

View File

@@ -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", '<span class="glyphicon glyphicon-edit"></span>',
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 .= '<div class="summary_row">' . $payment['payment_type'] . ': ' . to_currency($amount) . '</div>';
}
$table .= '</div>';

View File

@@ -26,9 +26,9 @@ class MailchimpConnector
*/
private $_api_endpoint = 'https://<dc>.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;

View File

@@ -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

View File

@@ -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();
}