[Vtigercrm-developers] How to fire the $field_model->getDBInsertValue($value) method for a custom module field with custom uitype?

Holbok István holbok at gmail.com
Tue Aug 5 13:21:00 GMT 2014


Dear vtiger Team, and vtiger Community,

I am involved a vtiger 6.1 custom module development and now I've got 
stuck in this case:

I created a custom multipicklist field for this custom module. This 
multipicklist field is stored in the SQL db in the form of "1 |##| 2 
|##| 3" (similar to the vtiger standard multipicklist) where 1, 2 and 3 
the selected data indexes.
The $field_model->getDisplayValue($value) method - whit proper 
overwrites - works everywhere (listview, detailview, editview) and shows 
the field data as "Label1, Label2, Label3".

When editing (or creating a new) record of the custom module the 
consequence $field_model->getDBInsertValue($value) method is not called.

The custom multiselect field UI works well, because
- the label list is displayed well.
- if I choose only 1 item, e.g. Label2, the save method will save to the 
database 2 (2 = index of Label2).

- if I choose multiple selectable items, e.g. Label2 and Label3 the 
input content of the field will be consequently "2,3"
- if I choose multiple selectable items, e.g. Label2 and Label4 and 
Label5 the input content of the field will be consequently "2,4,5" - in 
this coma separated form.

I put debug tags to all related files and methods and I see in the 
debugger that the filed UI works, the multiselect works, but the 
$field_model->getDBInsertValue($value) method - where the "2,4,5" should 
be changed into "2 |##| 4 |##| 5" - *is not called*.

My question is how to fire this method depending the 
$field_model->uitype_model ?
*_
_**_The coma separated input of the field cause an other error also._*

And this is a vtiger 6.1 serious BUG.
This custom module record has 11 fields. And the update record method 
fired from the vtiger_module parent uses 10 fields to updete + the 
record_id = 11 input data together for the db-update method.

When a sole select in this filed - all work well.

When a multiple select in this custom field, the selected values e.g. 
"2,4,5" operate as independent integer values to insert or update sql. 
It means when the update method required 11 data unit, it will receive 
13 because the "2,4,5" will be interpreted as 3 separate values.
I think the missing db-quotes (in the basic methods) are responsible for 
this issue.

So, the other question is - how to handle it?

Kindest regards:
Istvan

-- 
üdvözlettel:

*Holbok István*

+3670-342-0900
*e-mail:* holbok at gmail.com
*SkyPe:* holboki

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.vtigercrm.com/pipermail/vtigercrm-developers/attachments/20140805/a39fa1a1/attachment.html>


More information about the vtigercrm-developers mailing list