×
Please submit new Bug Reports on GitHub: github.com/Jensen-Technologies/component-creator-issues/issues
Possible Bug? 'Item Saved Successfully'
Gary Hurdman
New Member
Posts: 6
1 год 7 мес. назад #9994
от Gary Hurdman
Gary Hurdman создал тему: Possible Bug? 'Item Saved Successfully'
Hi,
I think I have found a bug.
in the Model when a form is NOT saved because FALSE was passed back to the controller
public function save($data)
{...
.
.
if ($status !=6 && $status !=7)
{
$app->enqueueMessage(Text::_('WARNING! - This trader has is neither Casual or licensed - Status = '.$status), 'warning');
return false; //Don't save this data.
}
.
.
}
In the controller:
The 'Item Saved Successfully' message is always shown
I think it should be like this...
public function save($key = NULL, $urlVar = NULL)
{
.
.
.
.
// Check in the profile.
if ($return)
{
$model->checkin($return);
$this->setMessage(Text::_('COM_BCC_MACCS_MARKET_STALLS_ITEM_SAVED_SUCCESSFULLY'));
}
There doesn't appear to be any condition around the message otherwise???
Cheers - Paul
I think I have found a bug.
in the Model when a form is NOT saved because FALSE was passed back to the controller
public function save($data)
{...
.
.
if ($status !=6 && $status !=7)
{
$app->enqueueMessage(Text::_('WARNING! - This trader has is neither Casual or licensed - Status = '.$status), 'warning');
return false; //Don't save this data.
}
.
.
}
In the controller:
The 'Item Saved Successfully' message is always shown
I think it should be like this...
public function save($key = NULL, $urlVar = NULL)
{
.
.
.
.
// Check in the profile.
if ($return)
{
$model->checkin($return);
$this->setMessage(Text::_('COM_BCC_MACCS_MARKET_STALLS_ITEM_SAVED_SUCCESSFULLY'));
}
There doesn't appear to be any condition around the message otherwise???
Cheers - Paul
Пожалуйста Войти или Регистрация, чтобы присоединиться к беседе.
Michael Cochran
New Member
Posts: 2
9 мес. 2 дн. назад - 9 мес. 1 день назад #10204
от Michael Cochran
Michael Cochran ответил в теме Possible Bug? 'Item Saved Successfully'
It seems there might be a potential bug in the code. In the "Model" section, the "save" function checks for specific conditions, and if they are met, it returns false to prevent data from being saved. However, it doesn't seem to handle the message display properly in this case.
In the "Controller" section, after the data is saved, the "Item Saved Successfully" message is shown unconditionally. This means that even if the "save" function in the model returns false due to certain conditions, the success message will still be displayed, which could be misleading to the user. MyAccountAccess Login
To fix this, the "Controller" should check if the data was successfully saved or not by examining the return value of the "save" function in the "Model." If the save was successful, then display the success message; otherwise, show an appropriate warning or error message indicating that the data couldn't be saved due to the specific conditions not being met.
In the "Controller" section, after the data is saved, the "Item Saved Successfully" message is shown unconditionally. This means that even if the "save" function in the model returns false due to certain conditions, the success message will still be displayed, which could be misleading to the user. MyAccountAccess Login
To fix this, the "Controller" should check if the data was successfully saved or not by examining the return value of the "save" function in the "Model." If the save was successful, then display the success message; otherwise, show an appropriate warning or error message indicating that the data couldn't be saved due to the specific conditions not being met.
Последнее редактирование: 9 мес. 1 день назад пользователем Michael Cochran.
Пожалуйста Войти или Регистрация, чтобы присоединиться к беседе.
Время создания страницы: 0.168 секунд