deletion functionality for mass edition
fix #1349 (closed) and #1241 (closed) by adding deletion functionality to mass edition. It adds checkboxes for each field in the mass edit layout, which allows delete fields by just checking the checkbox without modifying the field contents.
Merge request reports
Activity
@ruben.estrada Thanks! for the fix on the most demanded issue. I will review the changes and update you in couple of days.
excellent! thanks @uma.s !
68 71 $fieldDataType = $fieldModel->getFieldDataType(); 69 72 if($fieldDataType == 'time'){ 70 73 $fieldValue = Vtiger_Time_UIType::getTimeValueWithSeconds($fieldValue); 71 74 } 72 if(isset($fieldValue) && $fieldValue != null) { 73 if(!is_array($fieldValue)) { 74 $fieldValue = trim($fieldValue); 75 } 76 $recordModel->set($fieldName, $fieldValue); 77 } else { 78 $uiType = $fieldModel->get('uitype'); 79 if($uiType == 70) { 80 $recordModel->set($fieldName, $recordModel->get($fieldName)); 81 } else { 82 $uiTypeModel = $fieldModel->getUITypeModel(); 83 $recordModel->set($fieldName, $uiTypeModel->getUserRequestValue($recordModel->get($fieldName))); @ruben.estrada Here uitype model based data fetch has been completely removed, Can you please analyze this and update the explanation.
Even i observed that currency and date values are saving fine with these changes.
68 71 $fieldDataType = $fieldModel->getFieldDataType(); 69 72 if($fieldDataType == 'time'){ 70 73 $fieldValue = Vtiger_Time_UIType::getTimeValueWithSeconds($fieldValue); 71 74 } 72 if(isset($fieldValue) && $fieldValue != null) { 73 if(!is_array($fieldValue)) { 74 $fieldValue = trim($fieldValue); 75 } 76 $recordModel->set($fieldName, $fieldValue); 77 } else { 78 $uiType = $fieldModel->get('uitype'); 79 if($uiType == 70) { 80 $recordModel->set($fieldName, $recordModel->get($fieldName)); 81 } else { 82 $uiTypeModel = $fieldModel->getUITypeModel(); 83 $recordModel->set($fieldName, $uiTypeModel->getUserRequestValue($recordModel->get($fieldName))); @uma.s I removed those lines because they were unnecessary. The whole idea of that if-else statement is to update the changed fields in the
if
part and set the unchanged fields in theelse
statement.When you get an instance of a record via
Vtiger_Record_Model::getInstanceById()
in line 62 above, you already have all the field values loaded in the object, there is no need to set the unchanged fields again. That's why I removed that whole else statement. It's the same with$recordModel->set('id', $recordId);
on line 63. There is no need for that because the record model already knows what its' id is.I think this has to do with how older versions of vtiger used to work. where you would create a "focus" object to save changes to a record. However I'm not 100% sure on this. What I'm sure of is that Vtiger_Record_Model already has all fields loaded when you make an instance and you only have to set the changed fields. All other fields will remain exactly the same if you save the record. There is no need to set the fields with the values they already have.
68 71 $fieldDataType = $fieldModel->getFieldDataType(); 69 72 if($fieldDataType == 'time'){ 70 73 $fieldValue = Vtiger_Time_UIType::getTimeValueWithSeconds($fieldValue); 71 74 } 72 if(isset($fieldValue) && $fieldValue != null) { 73 if(!is_array($fieldValue)) { 74 $fieldValue = trim($fieldValue); 75 } 76 $recordModel->set($fieldName, $fieldValue); 77 } else { 78 $uiType = $fieldModel->get('uitype'); 79 if($uiType == 70) { 80 $recordModel->set($fieldName, $recordModel->get($fieldName)); 81 } else { 82 $uiTypeModel = $fieldModel->getUITypeModel(); 83 $recordModel->set($fieldName, $uiTypeModel->getUserRequestValue($recordModel->get($fieldName))); @ruben.estrada Thank you! I agree with your explanation, Let me review and get it integrated.
68 71 $fieldDataType = $fieldModel->getFieldDataType(); 69 72 if($fieldDataType == 'time'){ 70 73 $fieldValue = Vtiger_Time_UIType::getTimeValueWithSeconds($fieldValue); 71 74 } 72 if(isset($fieldValue) && $fieldValue != null) { 73 if(!is_array($fieldValue)) { 74 $fieldValue = trim($fieldValue); 75 } 76 $recordModel->set($fieldName, $fieldValue); 77 } else { 78 $uiType = $fieldModel->get('uitype'); 79 if($uiType == 70) { 80 $recordModel->set($fieldName, $recordModel->get($fieldName)); 81 } else { 82 $uiTypeModel = $fieldModel->getUITypeModel(); 83 $recordModel->set($fieldName, $uiTypeModel->getUserRequestValue($recordModel->get($fieldName))); mentioned in commit 0f7443c8
mentioned in issue #1737 (closed)