[Vtigercrm-developers] Another Migration bug

Alan Lord alanslists at gmail.com
Mon Sep 14 09:25:32 GMT 2015


In the 5.4.0_to_6.0.0RC.php file starting line 1361 is the following bit 
of code that removes the "--None--" option from all picklist type fields.

> //Remove '--None--'/'None' from all the picklist values.

> $sql = 'SELECT fieldname FROM vtiger_field WHERE uitype IN(?,?,?,?)';

> $result = $adb->pquery($sql, array(15,16,33,55));

> $num_rows = $adb->num_rows($result);

> for($i=0; $i<$num_rows; $i++){

> 	$fieldName = $adb->query_result($result, $i, 'fieldname');

> 	$checkTable = $adb->pquery('SHOW TABLES LIKE "vtiger_'.$fieldName.'"', array());

> 	if($adb->num_rows($checkTable) > 0) {

> 		$query = "DELETE FROM vtiger_$fieldName WHERE $fieldName = ? OR $fieldName = ?";

> 		Migration_Index_View::ExecuteQuery($query, array('--None--', 'None'));

> 	}

> }

What this doesn't do however is change any of the individual module's 
records that have the value "--None--" set. And you can't "unset" these 
records using Mass Edit.

There is also a secondary issue with this approach.

It is not possible to use Mass Edit and set a Picklist field to be 
empty. So how is one supposed to do that? What if I want to change a 
picklist value in a bunch of records from something back to empty?

Al



More information about the vtigercrm-developers mailing list