Refactoring files and variable names in Customer/People

This commit is contained in:
objecttothis
2019-11-25 17:27:59 +04:00
parent 6294079ce3
commit 619742de4e
5 changed files with 23 additions and 23 deletions

View File

@@ -347,25 +347,25 @@ class Customers extends Persons
}
/*
Customers import from excel spreadsheet
Customers import from csv spreadsheet
*/
public function excel()
public function csv()
{
$name = 'import_customers.csv';
$data = file_get_contents('../' . $name);
force_download($name, $data);
}
public function excel_import()
public function csv_import()
{
$this->load->view('customers/form_excel_import', NULL);
$this->load->view('customers/form_csv_import', NULL);
}
public function do_excel_import()
public function do_csv_import()
{
if($_FILES['file_path']['error'] != UPLOAD_ERR_OK)
{
echo json_encode(array('success' => FALSE, 'message' => $this->lang->line('customers_excel_import_failed')));
echo json_encode(array('success' => FALSE, 'message' => $this->lang->line('customers_csv_import_failed')));
}
else
{
@@ -446,18 +446,18 @@ class Customers extends Persons
if(count($failCodes) > 0)
{
$message = $this->lang->line('customers_excel_import_partially_failed') . ' (' . count($failCodes) . '): ' . implode(', ', $failCodes);
$message = $this->lang->line('customers_csv_import_partially_failed') . ' (' . count($failCodes) . '): ' . implode(', ', $failCodes);
echo json_encode(array('success' => FALSE, 'message' => $message));
}
else
{
echo json_encode(array('success' => TRUE, 'message' => $this->lang->line('customers_excel_import_success')));
echo json_encode(array('success' => TRUE, 'message' => $this->lang->line('customers_csv_import_success')));
}
}
else
{
echo json_encode(array('success' => FALSE, 'message' => $this->lang->line('customers_excel_import_nodata_wrongformat')));
echo json_encode(array('success' => FALSE, 'message' => $this->lang->line('customers_csv_import_nodata_wrongformat')));
}
}
}

View File

@@ -21,11 +21,11 @@ $lang["customers_discount_type"] = "Discount Type";
$lang["customers_email_duplicate"] = "Email Address is already present in the database.";
$lang["customers_employee"] = "Employee";
$lang["customers_error_adding_updating"] = "Customer add or update failed.";
$lang["customers_excel_import_failed"] = "Excel import failed";
$lang["customers_excel_import_nodata_wrongformat"] = "The uploaded file has no data or is incorrectly formatted.";
$lang["customers_excel_import_partially_failed"] = "Customer import successful with some failures:";
$lang["customers_excel_import_success"] = "Customer import successful.";
$lang["customers_import_items_excel"] = "Customer Import from Excel";
$lang["customers_csv_import_failed"] = "CSV import failed";
$lang["customers_csv_import_nodata_wrongformat"] = "The uploaded file has no data or is incorrectly formatted.";
$lang["customers_csv_import_partially_failed"] = "Customer import successful with some failures:";
$lang["customers_csv_import_success"] = "Customer import successful.";
$lang["customers_import_items_csv"] = "Customer Import from CSV";
$lang["customers_mailchimp_activity_click"] = "Email click";
$lang["customers_mailchimp_activity_lastopen"] = "Last open email";
$lang["customers_mailchimp_activity_open"] = "Email open";

View File

@@ -1,10 +1,10 @@
<ul id="error_message_box" class="error_message_box"></ul>
<?php echo form_open_multipart('customers/do_excel_import/', array('id'=>'excel_form', 'class'=>'form-horizontal')); ?>
<?php echo form_open_multipart('customers/do_csv_import/', array('id'=>'csv_form', 'class'=>'form-horizontal')); ?>
<fieldset id="item_basic_info">
<div class="form-group form-group-sm">
<div class="col-xs-12">
<a href="<?php echo site_url('customers/excel'); ?>"><?php echo $this->lang->line('common_download_import_template'); ?></a>
<a href="<?php echo site_url('customers/csv'); ?>"><?php echo $this->lang->line('common_download_import_template'); ?></a>
</div>
</div>
@@ -24,7 +24,7 @@
//validation and submit handling
$(document).ready(function()
{
$('#excel_form').validate($.extend({
$('#csv_form').validate($.extend({
submitHandler: function(form) {
$(form).ajaxSubmit({
success: function(response)

View File

@@ -1,10 +1,10 @@
<ul id="error_message_box" class="error_message_box"></ul>
<?php echo form_open_multipart('items/do_excel_import/', array('id'=>'excel_form', 'class'=>'form-horizontal')); ?>
<?php echo form_open_multipart('items/do_csv_import/', array('id'=>'csv_form', 'class'=>'form-horizontal')); ?>
<fieldset id="item_basic_info">
<div class="form-group form-group-sm">
<div class="col-xs-12">
<a href="<?php echo site_url('items/excel'); ?>"><?php echo $this->lang->line('common_download_import_template'); ?></a>
<a href="<?php echo site_url('items/csv'); ?>"><?php echo $this->lang->line('common_download_import_template'); ?></a>
</div>
</div>
@@ -24,7 +24,7 @@
//validation and submit handling
$(document).ready(function()
{
$('#excel_form').validate($.extend({
$('#csv_form').validate($.extend({
submitHandler: function(form) {
$(form).ajaxSubmit({
success:function(response)

View File

@@ -33,9 +33,9 @@ $(document).ready(function()
if ($controller_name == 'customers')
{
?>
<button class='btn btn-info btn-sm pull-right modal-dlg' data-btn-submit='<?php echo $this->lang->line('common_submit') ?>' data-href='<?php echo site_url($controller_name."/excel_import"); ?>'
title='<?php echo $this->lang->line('customers_import_items_excel'); ?>'>
<span class="glyphicon glyphicon-import">&nbsp</span><?php echo $this->lang->line('common_import_excel'); ?>
<button class='btn btn-info btn-sm pull-right modal-dlg' data-btn-submit='<?php echo $this->lang->line('common_submit') ?>' data-href='<?php echo site_url($controller_name."/csv_import"); ?>'
title='<?php echo $this->lang->line('customers_import_items_csv'); ?>'>
<span class="glyphicon glyphicon-import">&nbsp</span><?php echo $this->lang->line('common_import_csv'); ?>
</button>
<?php
}