For #3739. Removed unnecessary escaping from customer maintenance.

This commit is contained in:
Steve Ireland
2023-04-15 17:20:28 -04:00
parent ae1eebe3c5
commit 29fabc0522
4 changed files with 61 additions and 55 deletions

View File

@@ -106,7 +106,7 @@ class Config extends Secure_Controller
$basename = 'license/' . $fileinfo->getBasename('.version');
$license[$i]['title'] = file_get_contents($basename . '.version', NULL, NULL, 0, 100);
$license[$i]['title'] = file_get_contents($basename . '.version', false, NULL, 0, 100);
$license_text_file = $basename . '.license';

View File

@@ -93,11 +93,11 @@ class Customers extends Persons
*/
public function getSearch()
{
$search = $this->request->getGet('search', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
$search = $this->request->getGet('search');
$limit = $this->request->getGet('limit', FILTER_SANITIZE_NUMBER_INT);
$offset = $this->request->getGet('offset', FILTER_SANITIZE_NUMBER_INT);
$sort = $this->request->getGet('sort', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
$order = $this->request->getGet('order', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
$sort = $this->request->getGet('sort');
$order = $this->request->getGet('order');
$customers = $this->customer->search($search, $limit, $offset, $sort, $order);
$total_rows = $this->customer->get_found_rows($search);
@@ -131,14 +131,14 @@ class Customers extends Persons
*/
public function getSuggest(): void
{
$suggestions = $this->customer->get_search_suggestions($this->request->getVar('term', FILTER_SANITIZE_FULL_SPECIAL_CHARS), 25,TRUE);
$suggestions = $this->customer->get_search_suggestions($this->request->getVar('term'), 25,TRUE);
echo json_encode($suggestions);
}
public function suggest_search(): void
{
$suggestions = $this->customer->get_search_suggestions($this->request->getPost('term', FILTER_SANITIZE_FULL_SPECIAL_CHARS), 25, FALSE);
$suggestions = $this->customer->get_search_suggestions($this->request->getPost('term'), 25, FALSE);
echo json_encode($suggestions);
}
@@ -168,7 +168,6 @@ class Customers extends Persons
$data['employee'] = $employee_info->first_name . ' ' . $employee_info->last_name;
$tax_code_info = $this->tax_code->get_info($info->sales_tax_code_id);
$tax_code_id = $tax_code_info->tax_code_id; //TODO: This variable is never used after this.
if($tax_code_info->tax_code != NULL)
{
@@ -270,8 +269,8 @@ class Customers extends Persons
*/
public function postSave(int $customer_id = NEW_ENTRY): void
{
$first_name = $this->request->getPost('first_name', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
$last_name = $this->request->getPost('last_name', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
$first_name = $this->request->getPost('first_name');
$last_name = $this->request->getPost('last_name');
$email = strtolower($this->request->getPost('email', FILTER_SANITIZE_EMAIL));
// format first and last name properly
@@ -283,26 +282,26 @@ class Customers extends Persons
'last_name' => $last_name,
'gender' => $this->request->getPost('gender', FILTER_SANITIZE_NUMBER_INT),
'email' => $email,
'phone_number' => $this->request->getPost('phone_number', FILTER_SANITIZE_FULL_SPECIAL_CHARS),
'address_1' => $this->request->getPost('address_1', FILTER_SANITIZE_FULL_SPECIAL_CHARS),
'address_2' => $this->request->getPost('address_2', FILTER_SANITIZE_FULL_SPECIAL_CHARS),
'city' => $this->request->getPost('city', FILTER_SANITIZE_FULL_SPECIAL_CHARS),
'state' => $this->request->getPost('state', FILTER_SANITIZE_FULL_SPECIAL_CHARS),
'zip' => $this->request->getPost('zip', FILTER_SANITIZE_FULL_SPECIAL_CHARS),
'country' => $this->request->getPost('country', FILTER_SANITIZE_FULL_SPECIAL_CHARS),
'comments' => $this->request->getPost('comments', FILTER_SANITIZE_FULL_SPECIAL_CHARS)
'phone_number' => $this->request->getPost('phone_number'),
'address_1' => $this->request->getPost('address_1'),
'address_2' => $this->request->getPost('address_2'),
'city' => $this->request->getPost('city'),
'state' => $this->request->getPost('state'),
'zip' => $this->request->getPost('zip'),
'country' => $this->request->getPost('country'),
'comments' => $this->request->getPost('comments')
];
$date_formatter = date_create_from_format($this->config['dateformat'] . ' ' . $this->config['timeformat'], $this->request->getPost('date', FILTER_SANITIZE_FULL_SPECIAL_CHARS));
$date_formatter = date_create_from_format($this->config['dateformat'] . ' ' . $this->config['timeformat'], $this->request->getPost('date'));
$customer_data = [
'consent' => $this->request->getPost('consent') != NULL,
'account_number' => $this->request->getPost('account_number') == '' ? NULL : $this->request->getPost('account_number', FILTER_SANITIZE_FULL_SPECIAL_CHARS),
'tax_id' => $this->request->getPost('tax_id', FILTER_SANITIZE_FULL_SPECIAL_CHARS),
'company_name' => $this->request->getPost('company_name') == '' ? NULL : $this->request->getPost('company_name', FILTER_SANITIZE_FULL_SPECIAL_CHARS),
'account_number' => $this->request->getPost('account_number') == '' ? NULL : $this->request->getPost('account_number'),
'tax_id' => $this->request->getPost('tax_id'),
'company_name' => $this->request->getPost('company_name') == '' ? NULL : $this->request->getPost('company_name'),
'discount' => $this->request->getPost('discount') == '' ? 0.00 : $this->request->getPost('discount', FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION),
'discount_type' => $this->request->getPost('discount_type') == NULL ? PERCENT : $this->request->getPost('discount_type', FILTER_SANITIZE_NUMBER_INT),
'package_id' => $this->request->getPost('package_id') == '' ? NULL : $this->request->getPost('package_id', FILTER_SANITIZE_FULL_SPECIAL_CHARS),
'package_id' => $this->request->getPost('package_id') == '' ? NULL : $this->request->getPost('package_id'),
'taxable' => $this->request->getPost('taxable') != NULL,
'date' => $date_formatter->format('Y-m-d H:i:s'),
'employee_id' => $this->request->getPost('employee_id', FILTER_SANITIZE_NUMBER_INT),
@@ -312,7 +311,7 @@ class Customers extends Persons
if($this->customer->save_customer($person_data, $customer_data, $customer_id))
{
// save customer to Mailchimp selected list //TODO: addOrUpdateMember should be refactored... potentially pass an array or object instead of 6 parameters.
$mailchimp_status = $this->request->getPost('mailchimp_status', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
$mailchimp_status = $this->request->getPost('mailchimp_status');
$this->mailchimp_lib->addOrUpdateMember(
$this->_list_id,
$email,
@@ -375,7 +374,7 @@ class Customers extends Persons
*/
public function postDelete(): void
{
$customers_to_delete = $this->request->getPost('ids', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
$customers_to_delete = $this->request->getPost('ids');
$customers_info = $this->customer->get_multiple_info($customers_to_delete);
$count = 0;

View File

@@ -100,7 +100,7 @@
'name' => 'company_name',
'id' => 'company_name',
'class' => 'form-control input-sm',
'value' => esc($person_info->company_name)
'value' => $person_info->company_name
]) ?>
</div>
</div>
@@ -112,7 +112,7 @@
'name' => 'account_number',
'id' => 'account_number',
'class' => 'form-control input-sm',
'value' => esc($person_info->account_number)
'value' => $person_info->account_number
]) ?>
</div>
</div>
@@ -124,7 +124,7 @@
'name' => 'tax_id',
'id' => 'tax_id',
'class' => 'form-control input-sm',
'value' => esc($person_info->tax_id)
'value' => $person_info->tax_id
]) ?>
</div>
</div>
@@ -133,7 +133,12 @@
<div class="form-group form-group-sm">
<?php echo form_label(lang('Customers.rewards_package'), 'rewards', ['class' => 'control-label col-xs-3']) ?>
<div class='col-xs-8'>
<?php echo form_dropdown('package_id', esc($packages), $selected_package, ['class' => 'form-control']) ?>
<?php echo form_dropdown([
'name' => 'package_id',
'options' => $packages,
'selected' => $selected_package,
'extra' => ['class' => 'form-control']
]) ?>
</div>
</div>
@@ -171,7 +176,7 @@
'id' => 'sales_tax_code_name',
'class' => 'form-control input-sm',
'size' => '50',
'value' => esc($sales_tax_code_label)
'value' => $sales_tax_code_label
]) ?>
<?php echo form_hidden('sales_tax_code_id', $person_info->sales_tax_code_id) ?>
</div>
@@ -204,7 +209,7 @@
'name' => 'employee',
'id' => 'employee',
'class' => 'form-control input-sm',
'value' => esc($employee),
'value' => $employee,
'readonly' => 'true'
]) ?>
</div>
@@ -349,15 +354,17 @@
<div class="form-group form-group-sm">
<?php echo form_label(lang('Customers.mailchimp_status'), 'mailchimp_status', ['class' => 'control-label col-xs-3']) ?>
<div class='col-xs-4'>
<?php echo form_dropdown('mailchimp_status',
[
<?php echo form_dropdown([
'name' => 'mailchimp_status',
'options' => [
'subscribed' => 'subscribed',
'unsubscribed' => 'unsubscribed',
'cleaned' => 'cleaned',
'pending' => 'pending'
],
esc($mailchimp_info['status']),
['id' => 'mailchimp_status', 'class' => 'form-control input-sm']) ?>
'selected' => $mailchimp_info['status'],
'extras' => ['id' => 'mailchimp_status', 'class' => 'form-control input-sm']
]) ?>
</div>
</div>
@@ -374,7 +381,7 @@
<?php echo form_input ([
'name' => 'mailchimp_member_rating',
'class' => 'form-control input-sm',
'value' => esc($mailchimp_info['member_rating']),
'value' => $mailchimp_info['member_rating'],
'disabled' => ''
]) ?>
</div>
@@ -386,7 +393,7 @@
<?php echo form_input ([
'name' => 'mailchimp_activity_total',
'class' => 'form-control input-sm',
'value' => esc($mailchimp_activity['total']),
'value' => $mailchimp_activity['total'],
'disabled' => ''
]) ?>
</div>
@@ -398,7 +405,7 @@
<?php echo form_input ([
'name' => 'mailchimp_activity_lastopen',
'class' => 'form-control input-sm',
'value' => esc($mailchimp_activity['lastopen']),
'value' => $mailchimp_activity['lastopen'],
'disabled' => ''
]) ?>
</div>
@@ -410,7 +417,7 @@
<?php echo form_input ([
'name' => 'mailchimp_activity_open',
'class' => 'form-control input-sm',
'value' => esc($mailchimp_activity['open']),
'value' => $mailchimp_activity['open'],
'disabled' => ''
]) ?>
</div>
@@ -422,7 +429,7 @@
<?php echo form_input ([
'name' => 'mailchimp_activity_click',
'class' => 'form-control input-sm',
'value' => esc($mailchimp_activity['click']),
'value' => $mailchimp_activity['click'],
'disabled' => ''
]) ?>
</div>
@@ -434,7 +441,7 @@
<?php echo form_input ([
'name' => 'mailchimp_activity_unopen',
'class' => 'form-control input-sm',
'value' => esc($mailchimp_activity['unopen']),
'value' => $mailchimp_activity['unopen'],
'disabled' => ''
]) ?>
</div>
@@ -446,7 +453,7 @@
<?php echo form_input ([
'name' => 'mailchimp_email_client',
'class' => 'form-control input-sm',
'value' => esc($mailchimp_info['email_client']),
'value' => $mailchimp_info['email_client'],
'disabled' => ''
]) ?>
</div>
@@ -491,7 +498,7 @@ $(document).ready(function()
success: function(response)
{
dialog_support.hide();
table_support.handle_submit("<?php echo esc($controller_name) ?>", response);
table_support.handle_submit("<?= $controller_name ?>", response);
},
dataType: 'json'
});
@@ -508,7 +515,7 @@ $(document).ready(function()
{
remote:
{
url: "<?php echo esc("$controller_name/checkEmail") ?>",
url: "<?= "$controller_name/checkEmail" ?>",
type: 'POST',
data: {
'person_id': "<?php echo $person_info->person_id ?>"
@@ -520,7 +527,7 @@ $(document).ready(function()
{
remote:
{
url: "<?php echo esc("$controller_name/checkAccountNumber") ?>",
url: "<?= "$controller_name/checkAccountNumber" ?>",
type: 'POST',
data: {
'person_id': "<?php echo $person_info->person_id ?>"

View File

@@ -10,7 +10,7 @@
'name' => 'first_name',
'id' => 'first_name',
'class' => 'form-control input-sm',
'value' => esc($person_info->first_name)
'value' => $person_info->first_name
]) ?>
</div>
</div>
@@ -22,7 +22,7 @@
'name' => 'last_name',
'id' => 'last_name',
'class' => 'form-control input-sm',
'value' => esc($person_info->last_name)
'value' => $person_info->last_name
]) ?>
</div>
</div>
@@ -61,7 +61,7 @@
'name' => 'email',
'id' => 'email',
'class' => 'form-control input-sm',
'value' => esc($person_info->email)
'value' => $person_info->email
]) ?>
</div>
</div>
@@ -76,7 +76,7 @@
'name' => 'phone_number',
'id' => 'phone_number',
'class' => 'form-control input-sm',
'value' => esc($person_info->phone_number)
'value' => $person_info->phone_number
]) ?>
</div>
</div>
@@ -89,7 +89,7 @@
'name' => 'address_1',
'id' => 'address_1',
'class' => 'form-control input-sm',
'value' => esc($person_info->address_1)
'value' => $person_info->address_1
]) ?>
</div>
</div>
@@ -101,7 +101,7 @@
'name' => 'address_2',
'id' => 'address_2',
'class' => 'form-control input-sm',
'value' => esc($person_info->address_2)
'value' => $person_info->address_2
]) ?>
</div>
</div>
@@ -113,7 +113,7 @@
'name' => 'city',
'id' => 'city',
'class' => 'form-control input-sm',
'value' => esc($person_info->city)
'value' => $person_info->city
]) ?>
</div>
</div>
@@ -125,7 +125,7 @@
'name' => 'state',
'id' => 'state',
'class' => 'form-control input-sm',
'value' => esc($person_info->state)
'value' => $person_info->state
]) ?>
</div>
</div>
@@ -137,7 +137,7 @@
'name' => 'zip',
'id' => 'postcode',
'class' => 'form-control input-sm',
'value' => esc($person_info->zip)
'value' => $person_info->zip
]) ?>
</div>
</div>
@@ -149,7 +149,7 @@
'name' => 'country',
'id' => 'country',
'class' => 'form-control input-sm',
'value' => esc($person_info->country)
'value' => $person_info->country
]) ?>
</div>
</div>
@@ -161,7 +161,7 @@
'name' => 'comments',
'id' => 'comments',
'class' => 'form-control input-sm',
'value' => esc($person_info->comments)
'value' => $person_info->comments
]) ?>
</div>
</div>