[Vtigercrm-developers] [2.] Strange behavior of ModTracker in a Custom module vtiger 6.1 - there is a BUG

Holbok István holbok at gmail.com
Wed Jul 16 09:32:54 GMT 2014


Dear Vtiger Team,

I have found a *bug *in the vtiger 6.1 SVN 14164.
The bug is related to the issue mentioned my letter of 14, July, here is 
below with screenshoots, and easy to handle.

The ModTracker should not be notify the change in the field of *Modified 
Time*, and the Created Time also should be displayed right in any Custom 
module.

The cause of the issue is a very simply and stupid thing.

Here is the sample code of the creation entity module, form the page:
http://community.vtiger.com/help/vtigercrm/developers/extensions/examples/entity-module.html
         $mfield3 = new Vtiger_Field();
         $mfield3->name = 'ModifiedTime';
         $mfield3->label= 'Modified Time';
         $mfield3->table = 'vtiger_crmentity';
         $mfield3->column = 'modifiedtime';
         $mfield3->uitype = 70;
         $mfield3->typeofdata = 'T~O';
         $mfield3->displaytype= 2;
         $block->addField($mfield3);

The field name 'ModifiedTime' uses *uppercase *and *lowercase *letters 
also. For the SQL is indifferent because the SQL is case *insensitive 
*relating to the field names or table names.
But the array keys are case sensitive things in PHP.
Ref.: http://php.net/manual/en/function.array-key-exists.php (look at 
the comments) or look at this post
http://stackoverflow.com/questions/1511230/php-array-are-array-indexes-case-sensitive

So, using the field name 'ModifiedTime' and 'modifiedtime' are two 
different things for the handling programs.

*.../modules/ModTracker/ModTrackerHandler.php will fail in the line 
33-34 due to the uppercase / lowercase confusion.*
                     foreach($delta as $fieldName => $values) {
                         if($fieldName != 'modifiedtime') {

Perhaps many of the Custom modules uses the field name 'ModifiedTime' 
(as it was suggested in the sample code) and the tabid=34, PBXManager 
also uses in the table vtiger_field uppercase / lowercase name.

*Solution:*
*(1) Using lowercase field names in all vtiger consequently. It is the 
most easiest way to repair code.**It is may suggestion.*


(2) Using lowercase conversion in every place where SQL field names are 
appearing as an array key. It is quite difficult to check all the code 
and change all appearances.

Affected standard modules:
PBXManager

An other question to this issue, with Type of Data:
  $mfield3->typeofdata = 'T~O';

Here is T~O in the sample code.
Looking the table vtiger_field inside, all other fields 'modifiedtime' 
have typeofdata= DT~O.

Is it a typo or intentionally was changed the typeofdata in the sample code?

The above mentioned issue with both side (field name and typeofdata) is 
valid for the other system field '*CreatedTime*' / '*createdtime*' also

Kindest regards:
Istvan


-------- Eredeti üzenet --------
Tárgy: 	Strange behavior of ModTracker in a Custom module vtiger 6.1
Dátum: 	Mon, 14 Jul 2014 15:45:14 +0200



Dear Vtiger Community,

There is a strange behavior of ModTracker in a Custom module vtiger 6.1 
module record summary view.
Here is the Modtracker data in Contacts module, with right data:


And here is the Modtracker data in my Custom module with totally strange 
data show:


Is there any idea what is the cause of it?

Kindest regards:
István



-- 
ü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/20140716/ff652826/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/png
Size: 64737 bytes
Desc: not available
URL: <http://lists.vtigercrm.com/pipermail/vtigercrm-developers/attachments/20140716/ff652826/attachment-0002.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/png
Size: 63269 bytes
Desc: not available
URL: <http://lists.vtigercrm.com/pipermail/vtigercrm-developers/attachments/20140716/ff652826/attachment-0003.png>


More information about the vtigercrm-developers mailing list