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

Possible Bug? 'Item Saved Successfully'

1 year 7 months ago #9994 by Gary Hurdman
Possible Bug? 'Item Saved Successfully' was created by 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

Please Log in or Create an account to join the conversation.

8 months 3 weeks ago - 8 months 3 weeks ago #10204 by Michael Cochran
Replied by Michael Cochran on 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.
Last edit: 8 months 3 weeks ago by Michael Cochran.

Please Log in or Create an account to join the conversation.

Time to create page: 0.182 seconds
Powered by Kunena Forum

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.