Fixed: fix testing issue
This commit is contained in:
@@ -466,6 +466,8 @@ class AdminSourcesControllerCore extends AdminController
|
||||
return $this->postProcessBulkDeleteSource();
|
||||
} elseif (Tools::isSubmit('submitAddbusiness_source') || Tools::isSubmit('submitAddbusiness_sourceAndStay')) {
|
||||
return $this->postProcessBusinessSource();
|
||||
} elseif (Tools::isSubmit('status'.$this->table)) {
|
||||
return $this->postProcessStatusBusinessSource();
|
||||
} elseif (Tools::isSubmit('delete'.$this->table)) {
|
||||
return $this->postProcessDeleteBusinessSource();
|
||||
} elseif (Tools::isSubmit('submitBulkdelete'.$this->table)) {
|
||||
@@ -504,6 +506,21 @@ class AdminSourcesControllerCore extends AdminController
|
||||
}
|
||||
}
|
||||
|
||||
protected function postProcessStatusBusinessSource()
|
||||
{
|
||||
if (Validate::isLoadedObject($objBusinessSource = new BusinessSource((int)Tools::getValue('id_business_source')))) {
|
||||
$newActive = !$objBusinessSource->active;
|
||||
if (!$newActive && $objBusinessSource->hasUnremovableSource()) {
|
||||
$this->errors[] = $this->l('You cannot disable this Business Source because it has one or more permanent (built-in) Booking Sources under it.');
|
||||
} else {
|
||||
$objBusinessSource->active = $newActive;
|
||||
if ($objBusinessSource->save()) {
|
||||
$this->redirect_after = self::$currentIndex.'&token='.$this->token.'&conf=5';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected function postProcessBulkDeleteSource()
|
||||
{
|
||||
$idBusinessSource = 0;
|
||||
@@ -697,6 +714,13 @@ class AdminSourcesControllerCore extends AdminController
|
||||
}
|
||||
}
|
||||
|
||||
if ($idBusinessSource && !(int)Tools::getValue('active')) {
|
||||
$objBusinessSource = new BusinessSource($idBusinessSource);
|
||||
if ($objBusinessSource->hasUnremovableSource()) {
|
||||
$this->errors[] = $this->l('You cannot disable this Business Source because it has one or more permanent (built-in) Booking Sources under it.');
|
||||
}
|
||||
}
|
||||
|
||||
if (count($this->errors)) {
|
||||
$this->display = $idBusinessSource ? 'edit' : 'add';
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user