Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

yes/no element with "Single Yes" = yes #1338

Closed
trob opened this issue Nov 22, 2014 · 3 comments
Closed

yes/no element with "Single Yes" = yes #1338

trob opened this issue Nov 22, 2014 · 3 comments

Comments

@trob
Copy link

trob commented Nov 22, 2014

issue1:
it doesn't check if the yesno element is YES at all. Even if it's NO it's setting all other rows to NO.

issue2:
if adding a row the rowid is not known, so it's throwing
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 3 SQL=UPDATE liste_einfach SET yn2 = 0 WHERE liste_einfach.id <>
Fix: add around line 457
$rowid = $rowid == ""? 0 : $rowid;
$query->update($this->actualTableName())->set($name . ' = 0')->where($pk . ' <> ' . $rowid);

@jaanusnurmoja
Copy link

Some optional additional filter would be also useful there because usually we need a single yes for a specific group of data, not for whole table.
Example;

$where = $pk . ' <> ' . $rowid;
$field_name = $params->get('filtering_field_name');
$field_value = 'filtering field value for this row';
if $params->get('filtering_field_name')
{
$where .= ' and ' . $field_name . ' = ' . $field_value;
}
$query->update($this->actualTableName())->set($name . ' = 0')->where($where);

@cheesegrits
Copy link
Member

Jaanus - the comitt closed this issue, as it resolves the bug(s). Can't keep an issue open pending impementing feature requests unrelated to the actual bug.

@jaanusnurmoja
Copy link

OK, actually it wasn't difficult at all to make it by myself :)
#1355

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants