× Please submit new Bug Reports on GitHub: github.com/Jensen-Technologies/component-creator-issues/issues

Possible Bug? 'Item Saved Successfully'

1 jaar 6 maanden geleden #9994 door Gary Hurdman
Possible Bug? 'Item Saved Successfully' werd gestart door Gary Hurdman
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

Gelieve Inloggen of een account aanmaken om deel te nemen aan het gesprek.

8 maanden 1 dag geleden - 8 maanden 21 uren geleden #10204 door Michael Cochran
Beantwoord door Michael Cochran in topic 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.
Laatst bewerkt 8 maanden 21 uren geleden door Michael Cochran.

Gelieve Inloggen of een account aanmaken om deel te nemen aan het gesprek.

Tijd voor maken pagina: 0.311 seconden
Gemaakt door Kunena

We use cookies so that you can place orders and we can provide a better service. You can control the use of cookies at the individual browser level. If you reject cookies, you may still use our website, but your ability to use some features or areas of our website may be limited.