Fixed: fix filter data issue and status update issue
Co-authored-by: Name <sumit201@webkul.in>
This commit is contained in:
@@ -11,8 +11,8 @@
|
||||
<form action="{$current_index}&token={$token}" method="post">
|
||||
<div class="modal-body">
|
||||
<div class="form-group">
|
||||
<label>{l s='Current Source'}</label>
|
||||
<select name="merge_current_source" id="merge_current_source" class="form-control">
|
||||
<label>{l s='Current Source'}</label>
|
||||
<select disabled name="merge_current_source" id="merge_current_source" class="form-control">
|
||||
{foreach from=$sources item=source}
|
||||
<option value="{$source.id_source}"{if $source.id_source == $id_current_source} selected="selected"{/if}>{$source.name}</option>
|
||||
{/foreach}
|
||||
@@ -20,7 +20,7 @@
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>{l s='Target Source'}</label>
|
||||
<select name="merge_target_source" id="merge_target_source" class="form-control">
|
||||
<select name="target_source" id="target_source" class="form-control">
|
||||
{foreach from=$sources item=source}
|
||||
<option value="{$source.id_source}">{$source.name}</option>
|
||||
{/foreach}
|
||||
@@ -28,9 +28,10 @@
|
||||
</div>
|
||||
<p class="help-block">{l s='Every order currently attributed to Current Source will be reattributed to Target Source. Current Source itself is left as-is.'}</p>
|
||||
<input type="hidden" name="id_source_type" value="{$id_source_type|intval}" />
|
||||
<input type="hidden" name="current_source" value="{$id_current_source|intval}" />
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">{l s='Cancel'}</button>
|
||||
<button type="submit" name="submitMergeSource" class="btn btn-primary">{l s='Update'}</button>
|
||||
<button type="submit" name="submitMergeSource" class="btn btn-primary"> <i class="icon-random"></i>   {l s='Update'}</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@@ -356,7 +356,7 @@ abstract class PaymentModuleCore extends Module
|
||||
if (isset($this->idBookingSource) && $this->idBookingSource) {
|
||||
$order->id_source = (int)$this->idBookingSource;
|
||||
} else {
|
||||
$order->id_source = Source::getDefaultSourceId();
|
||||
$order->id_source = (int)Source::getDefaultSourceId();
|
||||
}
|
||||
|
||||
if (self::DEBUG_MODE) {
|
||||
|
||||
@@ -271,6 +271,7 @@ class OrderCore extends ObjectModel
|
||||
'invoice_date' => array('type' => self::TYPE_DATE),
|
||||
'delivery_date' => array('type' => self::TYPE_DATE),
|
||||
'source' => array('type' => self::TYPE_STRING),
|
||||
'id_source' => array('type' => self::TYPE_INT),
|
||||
'valid' => array('type' => self::TYPE_BOOL),
|
||||
'reference' => array('type' => self::TYPE_STRING),
|
||||
'is_advance_payment' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'default' => 0),
|
||||
|
||||
@@ -62,22 +62,6 @@ class AdminSourcesControllerCore extends AdminController
|
||||
|
||||
public function init()
|
||||
{
|
||||
if (Tools::isSubmit('viewbusiness_source')
|
||||
|| Tools::isSubmit('submitFiltersource')
|
||||
|| Tools::isSubmit('submitResetsource')
|
||||
|| Tools::getValue('sourceOrderby')
|
||||
|| Tools::getValue('sourceOrderway')
|
||||
) {
|
||||
$this->list_id = 'source';
|
||||
}
|
||||
|
||||
$idSourceType = (int) Tools::getValue('id_source_type');
|
||||
|
||||
if ($idSourceType && Tools::getValue('viewbusiness_source')) {
|
||||
self::$currentIndex .= '&id_source_type=' . $idSourceType . '&viewbusiness_source';
|
||||
$this->className = 'Source';
|
||||
}
|
||||
|
||||
if (Tools::isSubmit('addsource') || Tools::isSubmit('addbusiness_source')) {
|
||||
$this->display = 'add';
|
||||
}
|
||||
@@ -91,10 +75,23 @@ class AdminSourcesControllerCore extends AdminController
|
||||
$this->display = Tools::getValue('id_source_type') ? 'edit' : 'add';
|
||||
}
|
||||
|
||||
|
||||
return parent::init();
|
||||
}
|
||||
|
||||
public function initContent()
|
||||
{
|
||||
if (Tools::isSubmit('submitFiltersource') || Tools::isSubmit('submitResetsource')) {
|
||||
$this->list_id = 'source';
|
||||
$this->display = 'view';
|
||||
|
||||
$idSourceType = (int) Tools::getValue('id_source_type');
|
||||
self::$currentIndex .= '&id_source_type=' . $idSourceType . '&viewbusiness_source';
|
||||
if (Tools::isSubmit('submitResetsource')) {
|
||||
$this->processResetFilters('source');
|
||||
}
|
||||
}
|
||||
parent::initContent();
|
||||
}
|
||||
/**
|
||||
* @see AdminController::initPageHeaderToolbar()
|
||||
*/
|
||||
@@ -153,7 +150,7 @@ class AdminSourcesControllerCore extends AdminController
|
||||
'position' => 'position'
|
||||
),
|
||||
'orders_count' => array(
|
||||
'title' => $this->l('Orders'),
|
||||
'title' => $this->l('Orders (%)'),
|
||||
'align' => 'text-center',
|
||||
'orderby' => false,
|
||||
'search' => false,
|
||||
@@ -200,7 +197,7 @@ class AdminSourcesControllerCore extends AdminController
|
||||
'position' => 'position'
|
||||
),
|
||||
'orders_count' => array(
|
||||
'title' => $this->l('Orders'),
|
||||
'title' => $this->l('Orders (%)'),
|
||||
'align' => 'text-center',
|
||||
'orderby' => false,
|
||||
'search' => false,
|
||||
@@ -240,7 +237,7 @@ class AdminSourcesControllerCore extends AdminController
|
||||
$idSourceType = (int)Tools::getValue('id_source_type');
|
||||
$objBusinessSource = new BusinessSource($idSourceType, (int)$this->context->language->id);
|
||||
if (!Validate::isLoadedObject($objBusinessSource)) {
|
||||
return;
|
||||
Tools::redirectAdmin(self::$currentIndex.'&token='.$this->token);
|
||||
}
|
||||
|
||||
$this->addRowAction('edit');
|
||||
@@ -428,20 +425,20 @@ class AdminSourcesControllerCore extends AdminController
|
||||
} else {
|
||||
Tools::redirectAdmin(self::$currentIndex.'&viewbusiness_source&id_source_type='.(int)$objSource->id_source_type.'&conf=1&token='.$this->token);
|
||||
}
|
||||
} else if(Tools::isSubmit('statussource')){
|
||||
if(Validate::isLoadedObject($objSource = new Source((int)Tools::getValue('id_source')))){
|
||||
$idSourceType = $objSource->id_source_type;
|
||||
$objSource->active = !$objSource->active;
|
||||
if($objSource->save()){
|
||||
$this->redirect_after = self::$currentIndex.'&viewbusiness_source&id_source_type='.(int)$idSourceType.'&conf=5&token='.$this->token;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} else if(Tools::isSubmit('submitBulkenableSelectionsource')){
|
||||
$idSourceType = (int)Tools::getValue('id_source_type');
|
||||
$this->className = 'Source';
|
||||
$this->table = 'source';
|
||||
$this->boxes = Tools::getValue('sourceBox');
|
||||
parent::processBulkEnableSelection();
|
||||
$this->redirect_after = self::$currentIndex.'&viewbusiness_source&id_source_type='.(int)$idSourceType.'&token='.$this->token;
|
||||
$this->processUpdateStatusBulk(1);
|
||||
} else if(Tools::isSubmit('submitBulkdisableSelectionsource')){
|
||||
$idSourceType = (int)Tools::getValue('id_source_type');
|
||||
$this->className = 'Source';
|
||||
$this->table = 'source';
|
||||
$this->boxes = Tools::getValue('sourceBox');
|
||||
parent::processBulkDisableSelection();
|
||||
$this->redirect_after = self::$currentIndex.'&viewbusiness_source&id_source_type='.(int)$idSourceType.'&token='.$this->token;
|
||||
$this->processUpdateStatusBulk(0);
|
||||
} elseif (Tools::isSubmit('submitBulkdeletesource')) {
|
||||
$idSourceType = 0;
|
||||
foreach (Tools::getValue('sourceBox') as $selection) {
|
||||
@@ -486,6 +483,22 @@ class AdminSourcesControllerCore extends AdminController
|
||||
}
|
||||
}
|
||||
|
||||
protected function processUpdateStatusBulk($status = 1)
|
||||
{
|
||||
$idSourceType = (int)Tools::getValue('id_source_type');
|
||||
$this->className = 'Source';
|
||||
$this->table = 'source';
|
||||
$this->boxes = Tools::getValue('sourceBox');
|
||||
if(empty($this->boxes)){
|
||||
$this->errors[] = $this->l('You must select at least one item to perform a bulk action.');
|
||||
}
|
||||
$this->display = 'view';
|
||||
if(!$this->errors){
|
||||
parent::processBulkStatusSelection($status);
|
||||
$this->redirect_after = self::$currentIndex.'&viewbusiness_source&id_source_type='.(int)$idSourceType.'&conf=5&token='.$this->token;
|
||||
}
|
||||
}
|
||||
|
||||
protected function postProcessSource()
|
||||
{
|
||||
$idSource = (int)Tools::getValue('id_source');
|
||||
@@ -549,8 +562,8 @@ class AdminSourcesControllerCore extends AdminController
|
||||
protected function postProcessMergeSource()
|
||||
{
|
||||
$idSourceType = (int)Tools::getValue('id_source_type');
|
||||
$idCurrentSource = (int)Tools::getValue('merge_current_source');
|
||||
$idTargetSource = (int)Tools::getValue('merge_target_source');
|
||||
$idCurrentSource = (int)Tools::getValue('current_source');
|
||||
$idTargetSource = (int)Tools::getValue('target_source');
|
||||
|
||||
$objCurrent = new Source($idCurrentSource);
|
||||
$objTarget = new Source($idTargetSource);
|
||||
@@ -564,7 +577,7 @@ class AdminSourcesControllerCore extends AdminController
|
||||
} else {
|
||||
$objCurrent->mergeOrdersInto($idTargetSource);
|
||||
}
|
||||
|
||||
$this->display = 'view';
|
||||
if (!count($this->errors)) {
|
||||
Tools::redirectAdmin(self::$currentIndex.'&viewbusiness_source&id_source_type='.$idSourceType.'&conf=4&token='.$this->token);
|
||||
}
|
||||
@@ -645,7 +658,7 @@ class AdminSourcesControllerCore extends AdminController
|
||||
$this->context->smarty->assign(array(
|
||||
'modal_id' => 'merge_source_modal',
|
||||
'modal_class' => 'modal-md',
|
||||
'modal_title' => $this->l('Merge Booking Source'),
|
||||
'modal_title' => '<i class="icon-random"></i>   ' .$this->l('Merge Booking Source'),
|
||||
'modal_content' => $this->context->smarty->fetch('controllers/sources/modals/_merge_source_form.tpl'),
|
||||
));
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
</source>
|
||||
<source id="Email" id_source_type="Direct" source_code="EMAIL" position="4" unremovable="0" active="1">
|
||||
</source>
|
||||
<source id="Social_Media" id_source_type="Direct" source_code="SOCIAL_MEDIA" position="0" unremovable="1" active="1">
|
||||
<source id="Social_Media" id_source_type="Direct" source_code="SOCIAL_MEDIA" position="0" unremovable="0" active="1">
|
||||
</source>
|
||||
<source id="WhatsApp" id_source_type="Direct" source_code="WHATSAPP" position="6" unremovable="0" active="1">
|
||||
</source>
|
||||
|
||||
@@ -34,7 +34,7 @@ $(document).on('click', '.merge-source-btn', function (e) {
|
||||
$('#footer').next('.bootstrap').append(result.modalHtml);
|
||||
$('#merge_source_modal').modal('show');
|
||||
} else {
|
||||
showErrorMessage(result.error || 'Could not open the merge form.');
|
||||
showErrorMessage(result.error);
|
||||
}
|
||||
},
|
||||
complete: function () {
|
||||
|
||||
Reference in New Issue
Block a user