Hi Admin,
I'm not in the position of tell you what to do, so I apologize in advance for the following review, it's just a way to give you an idea on how fix quickly the following bugs.
scenario:
- table with authoring feature
- boolean toggle field with default value = TRUE
- grid view with toggle function on that field
bug:
1) with "edit own" enabled, toggle not working
2) if the above bug is bypassed, toggle function not working, because I get a message DONE but the value is ALWAYS "TRUE", so it doesn't toggle anything.
Bugs reasons and Fixes (backend / frontend):
1) in the toggle function in the controllers file at the line:
if (!$this->can('core.edit', JText::_("COMPONENTNAME_JTOOLBAR_EDIT")))
return;
that line should be:
if (!$this->can(array('core.edit', 'core.edit.own'), JText::_("COMPONENTNAME_JTOOLBAR_EDIT")))
return;
2) always in the same controller file and in the same function at the line:
$data["your_toggle_field"] = !$componentitem->your_toggle_field;
that line should be (surely it is not nice looking like the original, but it works with no doubts):
if ($componentitem->your_toggle_field == 1) {
$data["your_toggle_field"] = 0;
} else {
$data["your_toggle_field"] = 1;
}
the bug is not fixed yet, we have to go to the TABLE file in the backend at the line:
/**
* @var bool
*/
var $your_toggle_field = null;
and replace the value with our default value, in my case TRUE so it will be 1:
/**
* @var bool
*/
var $your_toggle_field = 1;
then down to the CHECK function at the line:
if ($this->your_toggle_field == null)
$this->your_toggle_field = 1;
we have to delete those two lines that caused the bug.
Moreover, I have noticed sometimes the toggle function in the controllers files, for some weird reason, is not rendered (but in the builder everything is configured correctly), so the workaround to have the toggle function working is to delete from the TABLE in the builder the YOUR_TOGGLE_FIELD and recreate it.
I'm sure the Admin will find a better way to fix these bugs in the builder.
thanks in advance for the support.