CMS MADE SIMPLE FORGE

LISE

 

[#12375] Fieldtype Checkbox toggle in overview page

avatar
Created By: Deleted User (deleteduser_11200)
Date Submitted: Mon Oct 12 14:55:27 -0400 2020

Assigned To: Fernando Morgado (JoMorg)
Version: 1.4.2
CMSMS Version: 2.2.10
Severity: Minor
Resolution: None
State: Open
Summary:
Fieldtype Checkbox toggle in overview page
Detailed Description:
== Description

Fieldtype Checkbox displayed in the overview page can't be toggled on/off 

== How to reproduce

- Go to [Field Definitions]-tab 
- Add Field Definition -> Choose Checkbox -> Complete the fields -> Hit submit

- Go to the [Options]-tab
- Add the Checkbox field just created to the item overview -> Hit submit

- Add a new item
- Set status to "Active" and also mark the Checkbox -> Hit submit

- Go to the [Items]-tab
- Toggle the status and checkbox on -> off

- Go to Content -> YourLiseModule and see the result in the overview screen or
in the item edit screen

== Remark

* The rest of the update from LISE 1.3.1 to 1.4.2 went flawless.
* If you want me to check with a more recent CMSMS version let me know. 
* Have to update this site from 2.2.10 -> 2.2.14 or 2.2.15 soon but first did
the LiseModule.


History

Comments
avatar
Date: 2020-10-12 17:17
Posted By: Deleted User (deleteduser_11200)

This is caused by the STRICT_TRANS_TABLES SQL mode set in mysql.conf

[mysqld]
sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION

https://dev.mysql.com/doc/refman/5.7/en/sql-mode.html#sqlmode_strict_trans_tables

I have changed my mysql.conf file that solved the problem. 
If you want to fix it in the php script be sure that value_index is not NULL
when inserting a record to cms_module_lisemodulename_fieldval on
framework/action_togglefielddefvalue.php

mysql> desc cms_module_lisemodulename_fieldval;
+-------------+---------+------+-----+---------+-------+
| Field       | Type    | Null | Key | Default | Extra |
+-------------+---------+------+-----+---------+-------+
| item_id     | int(11) | NO   | PRI | NULL    |       |
| fielddef_id | int(11) | NO   | PRI | NULL    |       |
| value_index | int(11) | NO   | PRI | NULL    |       |
| value       | text    | YES  |     | NULL    |       |
| data        | text    | YES  |     | NULL    |       |
+-------------+---------+------+-----+---------+-------+
5 rows in set (0.00 sec)

mysql> select * from cms_module_lisemodulename_fieldval where item_id=101;
+---------+-------------+-------------+---------------------------------------------+------+
| item_id | fielddef_id | value_index | value                                   
| data |
+---------+-------------+-------------+---------------------------------------------+------+
|     101 |           4 |           0 | 1                                       
| NULL |
+---------+-------------+-------------+---------------------------------------------+------+
2 rows in set (0.00 sec)


(root)/trunk/framework/action.admin_togglefielddefvalue.php - Rev 210
http://viewsvn.cmsmadesimple.org/filedetails.php?repname=lise&path=%2Ftrunk%2Fframework%2Faction.admin_togglefielddefvalue.php

$query  = 'DELETE FROM ' . cms_db_prefix() . 'module_' .
$this->_GetModuleAlias() . '_fieldval WHERE item_id = ? AND fielddef_id = ?';
$result = $db->Execute($query, array($item_id, $fid));

----> $query  = 'INSERT INTO ' . cms_db_prefix() . 'module_' .
$this->_GetModuleAlias() . '_fieldval (item_id, fielddef_id, value) VALUES (?,
?, ?)';
$result = $db->Execute($query, array($item_id, $fid, $value));
      
Updates

Updated: 2020-10-12 17:17
resolution_id: => 5