mirror of
https://github.com/opensourcepos/opensourcepos.git
synced 2026-04-13 19:40:06 -04:00
Further review and fixes to input->post(...) (#120)
This commit is contained in:
@@ -23,7 +23,7 @@ class Config extends Secure_area
|
||||
$upload_data = $this->upload->data();
|
||||
|
||||
$batch_save_data=array(
|
||||
'company'=>$this->input->post('company'),
|
||||
'company'=>$this->input->post('company'),
|
||||
'address'=>$this->input->post('address'),
|
||||
'phone'=>$this->input->post('phone'),
|
||||
'email'=>$this->input->post('email'),
|
||||
@@ -34,10 +34,10 @@ class Config extends Secure_area
|
||||
'default_tax_2_rate'=>$this->input->post('default_tax_2_rate'),
|
||||
'default_tax_2_name'=>$this->input->post('default_tax_2_name'),
|
||||
'return_policy'=>$this->input->post('return_policy'),
|
||||
'tax_included'=>$this->input->post('tax_included'),
|
||||
'tax_included'=>$this->input->post('tax_included') != null,
|
||||
'recv_invoice_format'=>$this->input->post('recv_invoice_format'),
|
||||
'sales_invoice_format'=>$this->input->post('sales_invoice_format'),
|
||||
'receiving_calculate_average_price'=>$this->input->post('receiving_calculate_average_price'),
|
||||
'receiving_calculate_average_price'=>$this->input->post('receiving_calculate_average_price') != null,
|
||||
'lines_per_page'=>$this->input->post('lines_per_page'),
|
||||
'default_sales_discount'=>$this->input->post('default_sales_discount'),
|
||||
'custom1_name'=>$this->input->post('custom1_name'),
|
||||
@@ -69,7 +69,7 @@ class Config extends Secure_area
|
||||
{
|
||||
$batch_save_data=array(
|
||||
'currency_symbol'=>$this->input->post('currency_symbol'),
|
||||
'currency_side'=>$this->input->post('currency_side'),
|
||||
'currency_side'=>$this->input->post('currency_side') != null,
|
||||
'language'=>$this->input->post('language'),
|
||||
'timezone'=>$this->input->post('timezone'),
|
||||
'dateformat'=>$this->input->post('dateformat'),
|
||||
@@ -145,7 +145,7 @@ class Config extends Secure_area
|
||||
'barcode_num_in_row'=>$this->input->post('barcode_num_in_row'),
|
||||
'barcode_page_width'=>$this->input->post('barcode_page_width'),
|
||||
'barcode_page_cellspacing'=>$this->input->post('barcode_page_cellspacing'),
|
||||
'barcode_generate_if_empty'=>$this->input->post('barcode_generate_if_empty'),
|
||||
'barcode_generate_if_empty'=>$this->input->post('barcode_generate_if_empty') != null,
|
||||
'barcode_content'=>$this->input->post('barcode_content')
|
||||
);
|
||||
|
||||
@@ -157,18 +157,18 @@ class Config extends Secure_area
|
||||
function save_receipt()
|
||||
{
|
||||
$batch_save_data = array (
|
||||
'use_invoice_template' => $this->input->post ( 'use_invoice_template' ),
|
||||
'use_invoice_template' => $this->input->post ( 'use_invoice_template' ) != null,
|
||||
'invoice_default_comments' => $this->input->post ( 'invoice_default_comments' ),
|
||||
'invoice_email_message' => $this->input->post ( 'invoice_email_message' ),
|
||||
'receipt_show_taxes' => $this->input->post ( 'receipt_show_taxes' ),
|
||||
'print_silently' => $this->input->post ( 'print_silently' ),
|
||||
'print_header' => $this->input->post ( 'print_header' ),
|
||||
'print_footer' => $this->input->post ( 'print_footer' ),
|
||||
'receipt_show_taxes' => $this->input->post ( 'receipt_show_taxes' ) != null,
|
||||
'print_silently' => $this->input->post ( 'print_silently' ) != null,
|
||||
'print_header' => $this->input->post ( 'print_header' ) != null,
|
||||
'print_footer' => $this->input->post ( 'print_footer' ) != null,
|
||||
'print_top_margin' => $this->input->post ( 'print_top_margin' ),
|
||||
'print_left_margin' => $this->input->post ( 'print_left_margin' ),
|
||||
'print_bottom_margin' => $this->input->post ( 'print_bottom_margin' ),
|
||||
'print_right_margin' => $this->input->post ( 'print_right_margin' ),
|
||||
'show_total_discount' => $this->input->post( 'show_total_discount' )
|
||||
'show_total_discount' => $this->input->post( 'show_total_discount' ) != null
|
||||
);
|
||||
$result = $this->Appconfig->batch_save( $batch_save_data );
|
||||
$success = $result ? true : false;
|
||||
|
||||
@@ -57,23 +57,23 @@ class Customers extends Person_controller
|
||||
function save($customer_id=-1)
|
||||
{
|
||||
$person_data = array(
|
||||
'first_name'=>$this->input->post('first_name'),
|
||||
'last_name'=>$this->input->post('last_name'),
|
||||
'gender'=>$this->input->post('gender'),
|
||||
'email'=>$this->input->post('email'),
|
||||
'phone_number'=>$this->input->post('phone_number'),
|
||||
'address_1'=>$this->input->post('address_1'),
|
||||
'address_2'=>$this->input->post('address_2'),
|
||||
'city'=>$this->input->post('city'),
|
||||
'state'=>$this->input->post('state'),
|
||||
'zip'=>$this->input->post('zip'),
|
||||
'country'=>$this->input->post('country'),
|
||||
'comments'=>$this->input->post('comments')
|
||||
'first_name'=>$this->input->post('first_name'),
|
||||
'last_name'=>$this->input->post('last_name'),
|
||||
'gender'=>$this->input->post('gender'),
|
||||
'email'=>$this->input->post('email'),
|
||||
'phone_number'=>$this->input->post('phone_number'),
|
||||
'address_1'=>$this->input->post('address_1'),
|
||||
'address_2'=>$this->input->post('address_2'),
|
||||
'city'=>$this->input->post('city'),
|
||||
'state'=>$this->input->post('state'),
|
||||
'zip'=>$this->input->post('zip'),
|
||||
'country'=>$this->input->post('country'),
|
||||
'comments'=>$this->input->post('comments')
|
||||
);
|
||||
$customer_data=array(
|
||||
'account_number'=>$this->input->post('account_number')=='' ? null:$this->input->post('account_number'),
|
||||
'company_name'=>$this->input->post('company_name')=='' ? null:$this->input->post('company_name'),
|
||||
'taxable'=>$this->input->post('taxable')=='' ? 0:1,
|
||||
'account_number'=>$this->input->post('account_number') == '' ? null : $this->input->post('account_number'),
|
||||
'company_name'=>$this->input->post('company_name') == '' ? null : $this->input->post('account_number'),
|
||||
'taxable'=>$this->input->post('taxable') != null
|
||||
);
|
||||
if($this->Customer->save_customer($person_data,$customer_data,$customer_id))
|
||||
{
|
||||
|
||||
@@ -59,27 +59,27 @@ class Employees extends Person_controller
|
||||
function save($employee_id=-1)
|
||||
{
|
||||
$person_data = array(
|
||||
'first_name'=>$this->input->post('first_name'),
|
||||
'last_name'=>$this->input->post('last_name'),
|
||||
'gender'=>$this->input->post('gender'),
|
||||
'email'=>$this->input->post('email'),
|
||||
'phone_number'=>$this->input->post('phone_number'),
|
||||
'address_1'=>$this->input->post('address_1'),
|
||||
'address_2'=>$this->input->post('address_2'),
|
||||
'city'=>$this->input->post('city'),
|
||||
'state'=>$this->input->post('state'),
|
||||
'zip'=>$this->input->post('zip'),
|
||||
'country'=>$this->input->post('country'),
|
||||
'comments'=>$this->input->post('comments')
|
||||
'first_name'=>$this->input->post('first_name'),
|
||||
'last_name'=>$this->input->post('last_name'),
|
||||
'gender'=>$this->input->post('gender'),
|
||||
'email'=>$this->input->post('email'),
|
||||
'phone_number'=>$this->input->post('phone_number'),
|
||||
'address_1'=>$this->input->post('address_1'),
|
||||
'address_2'=>$this->input->post('address_2'),
|
||||
'city'=>$this->input->post('city'),
|
||||
'state'=>$this->input->post('state'),
|
||||
'zip'=>$this->input->post('zip'),
|
||||
'country'=>$this->input->post('country'),
|
||||
'comments'=>$this->input->post('comments')
|
||||
);
|
||||
$grants_data = $this->input->post("grants")!=FALSE ? $this->input->post("grants"):array();
|
||||
$grants_data = $this->input->post('grants') != null ? $this->input->post('grants') : array();
|
||||
|
||||
//Password has been changed OR first time password set
|
||||
if($this->input->post('password')!='')
|
||||
if ( $this->input->post('password') != '' )
|
||||
{
|
||||
$employee_data=array(
|
||||
'username'=>$this->input->post('username'),
|
||||
'password'=>md5($this->input->post('password'))
|
||||
'username'=>$this->input->post('username'),
|
||||
'password'=>md5($this->input->post('password'))
|
||||
);
|
||||
}
|
||||
else //Password not changed
|
||||
|
||||
@@ -73,7 +73,7 @@ class Giftcards extends Secure_area implements iData_controller
|
||||
'record_time' => date('Y-m-d H:i:s'),
|
||||
'giftcard_number'=>$this->input->post('giftcard_number', TRUE),
|
||||
'value'=>$this->input->post('value', TRUE),
|
||||
'person_id'=>$this->input->post('person_id', TRUE) ? $this->input->post('person_id') : NULL
|
||||
'person_id'=>$this->input->post('person_id', TRUE) ? $this->input->post('person_id') : null
|
||||
);
|
||||
|
||||
if( $this->Giftcard->save( $giftcard_data, $giftcard_id ) )
|
||||
|
||||
@@ -118,7 +118,7 @@ class Item_kits extends Secure_area implements iData_controller
|
||||
'item_kit_id'=>$item_kit_id));
|
||||
}
|
||||
|
||||
if ($this->input->post('item_kit_item'))
|
||||
if ( $this->input->post('item_kit_item') != null )
|
||||
{
|
||||
$item_kit_items = array();
|
||||
foreach($this->input->post('item_kit_item') as $item_id => $quantity)
|
||||
|
||||
@@ -44,7 +44,7 @@ class Items extends Secure_area implements iData_controller
|
||||
|
||||
function find_item_info()
|
||||
{
|
||||
$item_number=$this->input->post('scan_item_number');
|
||||
$item_number = $this->input->post('scan_item_number');
|
||||
echo json_encode($this->Item->find_item_info($item_number));
|
||||
}
|
||||
|
||||
@@ -391,8 +391,8 @@ class Items extends Secure_area implements iData_controller
|
||||
'name'=>$this->input->post('name'),
|
||||
'description'=>$this->input->post('description'),
|
||||
'category'=>$this->input->post('category'),
|
||||
'supplier_id'=>$this->input->post('supplier_id')=='' ? null : $this->input->post('supplier_id'),
|
||||
'item_number'=>$this->input->post('item_number')=='' ? null : $this->input->post('item_number'),
|
||||
'supplier_id'=>$this->input->post('supplier_id') == '' ? null : $this->input->post('supplier_id'),
|
||||
'item_number'=>$this->input->post('item_number') == '' ? null : $this->input->post('item_number'),
|
||||
'cost_price'=>$this->input->post('cost_price'),
|
||||
'unit_price'=>$this->input->post('unit_price'),
|
||||
'reorder_level'=>$this->input->post('reorder_level'),
|
||||
|
||||
@@ -30,13 +30,15 @@ class Login extends CI_Controller
|
||||
|
||||
function login_check($username)
|
||||
{
|
||||
$password = $this->input->post("password");
|
||||
$password = $this->input->post('password');
|
||||
|
||||
if(!$this->Employee->login($username,$password))
|
||||
if(!$this->Employee->login($username, $password))
|
||||
{
|
||||
$this->form_validation->set_message('login_check', $this->lang->line('login_invalid_username_and_password'));
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ class Receivings extends Secure_area
|
||||
|
||||
function select_supplier()
|
||||
{
|
||||
$supplier_id = $this->input->post("supplier");
|
||||
$supplier_id = $this->input->post('supplier');
|
||||
$this->receiving_lib->set_supplier($supplier_id);
|
||||
$this->_reload();
|
||||
}
|
||||
@@ -37,12 +37,12 @@ class Receivings extends Secure_area
|
||||
function change_mode()
|
||||
{
|
||||
$stock_destination = $this->input->post('stock_destination');
|
||||
$stock_source = $this->input->post("stock_source");
|
||||
$stock_source = $this->input->post('stock_source');
|
||||
if ((!$stock_source || $stock_source == $this->receiving_lib->get_stock_source()) &&
|
||||
(!$stock_destination || $stock_destination == $this->receiving_lib->get_stock_destination()))
|
||||
{
|
||||
$this->receiving_lib->clear_invoice_number();
|
||||
$mode = $this->input->post("mode");
|
||||
$mode = $this->input->post('mode');
|
||||
$this->receiving_lib->set_mode($mode);
|
||||
}
|
||||
else if ($this->Stock_location->is_allowed_location($stock_source, 'receivings'))
|
||||
@@ -77,7 +77,7 @@ class Receivings extends Secure_area
|
||||
{
|
||||
$data=array();
|
||||
$mode = $this->receiving_lib->get_mode();
|
||||
$item_id_or_number_or_item_kit_or_receipt = $this->input->post("item");
|
||||
$item_id_or_number_or_item_kit_or_receipt = $this->input->post('item');
|
||||
$quantity = ($mode=="receive" or $mode=="requisition") ? 1:-1;
|
||||
$item_location = $this->receiving_lib->get_stock_source();
|
||||
if($mode=='return' && $this->receiving_lib->is_valid_receipt($item_id_or_number_or_item_kit_or_receipt))
|
||||
@@ -104,12 +104,12 @@ class Receivings extends Secure_area
|
||||
$this->form_validation->set_rules('quantity', 'lang:items_quantity', 'required|numeric');
|
||||
$this->form_validation->set_rules('discount', 'lang:items_discount', 'required|numeric');
|
||||
|
||||
$description = $this->input->post("description");
|
||||
$serialnumber = $this->input->post("serialnumber");
|
||||
$price = $this->input->post("price");
|
||||
$quantity = $this->input->post("quantity");
|
||||
$discount = $this->input->post("discount");
|
||||
$item_location = $this->input->post("location");
|
||||
$description = $this->input->post('description');
|
||||
$serialnumber = $this->input->post('serialnumber');
|
||||
$price = $this->input->post('price');
|
||||
$quantity = $this->input->post('quantity');
|
||||
$discount = $this->input->post('discount');
|
||||
$item_location = $this->input->post('location');
|
||||
|
||||
if ($this->form_validation->run() != FALSE)
|
||||
{
|
||||
@@ -190,7 +190,7 @@ class Receivings extends Secure_area
|
||||
$emp_info=$this->Employee->get_info($employee_id);
|
||||
$payment_type=$this->input->post('payment_type');
|
||||
$data['stock_location']=$this->receiving_lib->get_stock_source();
|
||||
if ($this->input->post('amount_tendered'))
|
||||
if ( $this->input->post('amount_tendered') != null )
|
||||
{
|
||||
$data['amount_tendered'] = $this->input->post('amount_tendered');
|
||||
$data['amount_change'] = to_currency($data['amount_tendered'] - round($data['total'], 2));
|
||||
@@ -370,10 +370,10 @@ class Receivings extends Secure_area
|
||||
|
||||
$receiving_data = array(
|
||||
'receiving_time' => $date_formatter->format('Y-m-d H:i:s'),
|
||||
'supplier_id' => $this->input->post('supplier_id') ? $this->input->post('supplier_id') : null,
|
||||
'supplier_id' => $this->input->post('supplier_id'),
|
||||
'employee_id' => $this->input->post('employee_id'),
|
||||
'comment' => $this->input->post('comment'),
|
||||
'invoice_number' => $this->input->post('invoice_number') != '' ? $this->input->post('invoice_number') : null
|
||||
'invoice_number' => $this->input->post('invoice_number')
|
||||
);
|
||||
|
||||
if ($this->Receiving->update($receiving_data, $receiving_id))
|
||||
|
||||
@@ -32,9 +32,9 @@ class Sales extends Secure_area
|
||||
$lines_per_page = $this->Appconfig->get('lines_per_page');
|
||||
|
||||
$today = date($this->config->item('dateformat'));
|
||||
$start_date = $this->input->post('start_date') != NULL ? $this->input->post('start_date', TRUE) : $today;
|
||||
$start_date = $this->input->post('start_date') != null ? $this->input->post('start_date', TRUE) : $today;
|
||||
$start_date_formatter = date_create_from_format($this->config->item('dateformat'), $start_date);
|
||||
$end_date = $this->input->post('end_date') != NULL ? $this->input->post('end_date', TRUE) : $today;
|
||||
$end_date = $this->input->post('end_date') != null ? $this->input->post('end_date', TRUE) : $today;
|
||||
$end_date_formatter = date_create_from_format($this->config->item('dateformat'), $end_date);
|
||||
|
||||
$sale_type = 'all';
|
||||
@@ -98,9 +98,9 @@ class Sales extends Secure_area
|
||||
$search = $this->input->post('search', TRUE);
|
||||
|
||||
$today = date($this->config->item('dateformat'));
|
||||
$start_date = $this->input->post('start_date') != NULL ? $this->input->post('start_date', TRUE) : $today;
|
||||
$start_date = $this->input->post('start_date') != null ? $this->input->post('start_date', TRUE) : $today;
|
||||
$start_date_formatter = date_create_from_format($this->config->item('dateformat'), $start_date);
|
||||
$end_date = $this->input->post('end_date') != NULL ? $this->input->post('end_date', TRUE) : $today;
|
||||
$end_date = $this->input->post('end_date') != null ? $this->input->post('end_date', TRUE) : $today;
|
||||
$end_date_formatter = date_create_from_format($this->config->item('dateformat'), $end_date);
|
||||
|
||||
$is_valid_receipt = isset($search) ? $this->sale_lib->is_valid_receipt($search) : FALSE;
|
||||
@@ -159,7 +159,7 @@ class Sales extends Secure_area
|
||||
|
||||
function select_customer()
|
||||
{
|
||||
$customer_id = $this->input->post("customer");
|
||||
$customer_id = $this->input->post('customer');
|
||||
$this->sale_lib->set_customer($customer_id);
|
||||
$this->_reload();
|
||||
}
|
||||
@@ -270,7 +270,7 @@ class Sales extends Secure_area
|
||||
{
|
||||
$data=array();
|
||||
$mode = $this->sale_lib->get_mode();
|
||||
$item_id_or_number_or_item_kit_or_receipt = $this->input->post("item");
|
||||
$item_id_or_number_or_item_kit_or_receipt = $this->input->post('item');
|
||||
$quantity = ($mode=="return")? -1:1;
|
||||
$item_location = $this->sale_lib->get_sale_location();
|
||||
|
||||
@@ -302,12 +302,12 @@ class Sales extends Secure_area
|
||||
$this->form_validation->set_rules('quantity', 'lang:items_quantity', 'required|numeric');
|
||||
$this->form_validation->set_rules('discount', 'lang:items_discount', 'required|numeric');
|
||||
|
||||
$description = $this->input->post("description");
|
||||
$serialnumber = $this->input->post("serialnumber");
|
||||
$price = $this->input->post("price");
|
||||
$quantity = $this->input->post("quantity");
|
||||
$discount = $this->input->post("discount");
|
||||
$item_location = $this->input->post("location");
|
||||
$description = $this->input->post('description');
|
||||
$serialnumber = $this->input->post('serialnumber');
|
||||
$price = $this->input->post('price');
|
||||
$quantity = $this->input->post('quantity');
|
||||
$discount = $this->input->post('discount');
|
||||
$item_location = $this->input->post('location');
|
||||
|
||||
if ($this->form_validation->run() != FALSE)
|
||||
{
|
||||
@@ -673,10 +673,10 @@ class Sales extends Secure_area
|
||||
|
||||
$sale_data = array(
|
||||
'sale_time' => $start_date_formatter->format('Y-m-d H:i:s'),
|
||||
'customer_id' => $this->input->post('customer_id') ? $this->input->post('customer_id') : NULL,
|
||||
'customer_id' => $this->input->post('customer_id'),
|
||||
'employee_id' => $this->input->post('employee_id'),
|
||||
'comment' => $this->input->post('comment'),
|
||||
'invoice_number' => $this->input->post('invoice_number') ? $this->input->post('invoice_number') : NULL
|
||||
'invoice_number' => $this->input->post('invoice_number')
|
||||
);
|
||||
|
||||
if ($this->Sale->update($sale_data, $sale_id))
|
||||
|
||||
@@ -58,23 +58,23 @@ class Suppliers extends Person_controller
|
||||
function save($supplier_id=-1)
|
||||
{
|
||||
$person_data = array(
|
||||
'first_name'=>$this->input->post('first_name'),
|
||||
'last_name'=>$this->input->post('last_name'),
|
||||
'gender'=>$this->input->post('gender'),
|
||||
'email'=>$this->input->post('email'),
|
||||
'phone_number'=>$this->input->post('phone_number'),
|
||||
'address_1'=>$this->input->post('address_1'),
|
||||
'address_2'=>$this->input->post('address_2'),
|
||||
'city'=>$this->input->post('city'),
|
||||
'state'=>$this->input->post('state'),
|
||||
'zip'=>$this->input->post('zip'),
|
||||
'country'=>$this->input->post('country'),
|
||||
'comments'=>$this->input->post('comments')
|
||||
'first_name'=>$this->input->post('first_name'),
|
||||
'last_name'=>$this->input->post('last_name'),
|
||||
'gender'=>$this->input->post('gender'),
|
||||
'email'=>$this->input->post('email'),
|
||||
'phone_number'=>$this->input->post('phone_number'),
|
||||
'address_1'=>$this->input->post('address_1'),
|
||||
'address_2'=>$this->input->post('address_2'),
|
||||
'city'=>$this->input->post('city'),
|
||||
'state'=>$this->input->post('state'),
|
||||
'zip'=>$this->input->post('zip'),
|
||||
'country'=>$this->input->post('country'),
|
||||
'comments'=>$this->input->post('comments')
|
||||
);
|
||||
$supplier_data=array(
|
||||
'company_name'=>$this->input->post('company_name'),
|
||||
'agency_name'=>$this->input->post('agency_name'),
|
||||
'account_number'=>$this->input->post('account_number')=='' ? null:$this->input->post('account_number'),
|
||||
'company_name'=>$this->input->post('company_name'),
|
||||
'agency_name'=>$this->input->post('agency_name'),
|
||||
'account_number'=>$this->input->post('account_number') == '' ? null : $this->input->post('account_number')
|
||||
);
|
||||
if($this->Supplier->save_supplier($person_data,$supplier_data,$supplier_id))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user