#1533 issue on date formate
Merge request reports
Activity
1302 1302 global $log; 1303 1303 $log->debug("Entering getAllUserName() method ..."); 1304 1304 global $adb; 1305 $query="select * from vtiger_users where deleted=0"; 1305 $query="select id, userlabel from vtiger_users where deleted=0"; 1302 1302 global $log; 1303 1303 $log->debug("Entering getAllUserName() method ..."); 1304 1304 global $adb; 1305 $query="select * from vtiger_users where deleted=0"; 1305 $query="select id, userlabel from vtiger_users where deleted=0"; @ruben.estrada schema and migration changes were added in different commit, please refer this commit - #1904fa02
46 46 if(!empty($searchValue)) { 47 47 $db = PearDatabase::getInstance(); 48 48 49 $query = 'SELECT * FROM vtiger_users WHERE (first_name LIKE ? OR last_name LIKE ?) AND status = ?'; 49 $query = 'SELECT * FROM vtiger_users WHERE userlabel LIKE ? AND status = ?'; @akshath Will this search work the same? I'm not sure where it is being used... There are no "%" in either so am not sure if searching for "firstname" OR "lastname" will give the same result?
46 46 if(!empty($searchValue)) { 47 47 $db = PearDatabase::getInstance(); 48 48 49 $query = 'SELECT * FROM vtiger_users WHERE (first_name LIKE ? OR last_name LIKE ?) AND status = ?'; 49 $query = 'SELECT * FROM vtiger_users WHERE userlabel LIKE ? AND status = ?'; 50 50 $currentUser = Users_Record_Model::getCurrentUserModel(); 51 51 $allSubordinates = $currentUser->getAllSubordinatesByReportsToField($currentUser->getId()); 52 52 $params = array("%$searchValue%", "%$searchValue%", 'Active'); @akshath @lord_alan may need also here a modification params = array("%searchValue%", "%$searchValue%", 'Active');
46 46 if(!empty($searchValue)) { 47 47 $db = PearDatabase::getInstance(); 48 48 49 $query = 'SELECT * FROM vtiger_users WHERE (first_name LIKE ? OR last_name LIKE ?) AND status = ?'; 49 $query = 'SELECT * FROM vtiger_users WHERE userlabel LIKE ? AND status = ?'; @lord_alan '?' is replaced with a content '%$searchValue%'. So search should work fine with firstname or lastname.
46 46 if(!empty($searchValue)) { 47 47 $db = PearDatabase::getInstance(); 48 48 49 $query = 'SELECT * FROM vtiger_users WHERE (first_name LIKE ? OR last_name LIKE ?) AND status = ?'; 49 $query = 'SELECT * FROM vtiger_users WHERE userlabel LIKE ? AND status = ?'; 50 50 $currentUser = Users_Record_Model::getCurrentUserModel(); 51 51 $allSubordinates = $currentUser->getAllSubordinatesByReportsToField($currentUser->getId()); 52 52 $params = array("%$searchValue%", "%$searchValue%", 'Active'); Thanks @manuelgit , yes you are right. I some how missed to modify $params. I have raised a MR to address this issue.
46 46 if(!empty($searchValue)) { 47 47 $db = PearDatabase::getInstance(); 48 48 49 $query = 'SELECT * FROM vtiger_users WHERE (first_name LIKE ? OR last_name LIKE ?) AND status = ?'; 49 $query = 'SELECT * FROM vtiger_users WHERE userlabel LIKE ? AND status = ?'; 50 50 $currentUser = Users_Record_Model::getCurrentUserModel(); 51 51 $allSubordinates = $currentUser->getAllSubordinatesByReportsToField($currentUser->getId()); 52 52 $params = array("%$searchValue%", "%$searchValue%", 'Active'); @akshath Merged the changes.
544 544 } 545 545 546 546 static function getSqlForNameInDisplayFormat($input, $module, $glue = ' ') { 547 if ($module == 'Users') { 16 16 {assign var="FIELD_NAME" value=$FIELD_MODEL->getFieldName()} 17 17 {/if} 18 18 {if $FIELD_MODEL->get('uitype') eq '71'} 19 <div class="input-group"> 20 <span class="input-group-addon">{$USER_MODEL->get('currency_symbol')}</span> 19 <div class="input-group inputElement"> 20 <span class="input-group-addon input-group-addon-right">{$USER_MODEL->get('currency_symbol')}</span> 21 21 <input id="{$MODULE}_editView_fieldName_{$FIELD_NAME}" type="text" class="inputElement currencyField" name="{$FIELD_NAME}" @uma.s The above changes need to be applied below for the uitype 72 and unit_price field in Products or else that field doesn't line up.
e.g. Just below the test for 'unit_price' the first two rows should be:
<div class="input-group inputElement" style="float:none;"> <span class="input-group-addon input-group-addon-right" id="baseCurrencySymbol">{$BASE_CURRENCY_SYMBOL}</span>
16 16 {assign var="FIELD_NAME" value=$FIELD_MODEL->getFieldName()} 17 17 {/if} 18 18 {if $FIELD_MODEL->get('uitype') eq '71'} 19 <div class="input-group"> 20 <span class="input-group-addon">{$USER_MODEL->get('currency_symbol')}</span> 19 <div class="input-group inputElement"> 20 <span class="input-group-addon input-group-addon-right">{$USER_MODEL->get('currency_symbol')}</span> 21 21 <input id="{$MODULE}_editView_fieldName_{$FIELD_NAME}" type="text" class="inputElement currencyField" name="{$FIELD_NAME}" @lord_alan changes accepted.
770 770 771 // userlabel is a field. So, setting to column_fields will take care for update and insert as well 772 if($table_name == 'vtiger_users') { 773 $entityFields = Vtiger_Functions::getEntityModuleInfo($module); 774 $entityFieldNames = explode(',', $entityFields['fieldname']); 775 776 $userlabel = ''; 777 foreach($entityFieldNames as $entityFieldName) { 778 $userlabel .= $this->column_fields[$entityFieldName]." "; 779 } 780 $userlabel = trim(decode_html($userlabel)); 781 782 $this->column_fields['userlabel'] = strip_tags($userlabel); 783 } 784 771 785 if($insertion_mode == 'edit') { @uma.s The above patch makes the commit below invalid in the migration scripts:
https://code.vtiger.com/vtiger/vtigercrm/blob/master/modules/Migration/schema/730_to_740.php#L38
See #927 (closed) for more info.
770 770 771 // userlabel is a field. So, setting to column_fields will take care for update and insert as well 772 if($table_name == 'vtiger_users') { 773 $entityFields = Vtiger_Functions::getEntityModuleInfo($module); 774 $entityFieldNames = explode(',', $entityFields['fieldname']); 775 776 $userlabel = ''; 777 foreach($entityFieldNames as $entityFieldName) { 778 $userlabel .= $this->column_fields[$entityFieldName]." "; 779 } 780 $userlabel = trim(decode_html($userlabel)); 781 782 $this->column_fields['userlabel'] = strip_tags($userlabel); 783 } 784 771 785 if($insertion_mode == 'edit') { @lord_alan Do you mean the order of fields for userlabel is not specified here? where as in migration script it says firstname " " lastname?
770 770 771 // userlabel is a field. So, setting to column_fields will take care for update and insert as well 772 if($table_name == 'vtiger_users') { 773 $entityFields = Vtiger_Functions::getEntityModuleInfo($module); 774 $entityFieldNames = explode(',', $entityFields['fieldname']); 775 776 $userlabel = ''; 777 foreach($entityFieldNames as $entityFieldName) { 778 $userlabel .= $this->column_fields[$entityFieldName]." "; 779 } 780 $userlabel = trim(decode_html($userlabel)); 781 782 $this->column_fields['userlabel'] = strip_tags($userlabel); 783 } 784 771 785 if($insertion_mode == 'edit') { Yes - The migration script should use the entityfields setting for the Users module.
I reckon something like this should work for the 730_to_740 script:
$entityFields = Vtiger_Functions::getEntityModuleInfo($module); $entityFieldNames = explode(',', $entityFields['fieldname']); $sql = "UPDATE vtiger_users SET $fieldName = TRIM(CONCAT(".implode(' ', $entityFieldNames)."))"; $db->pquery($sql, array());
26 if (!$fieldModel) { 27 $fieldModel = new Vtiger_Field(); 28 $fieldModel->name = $fieldName; 29 $fieldModel->label = 'User Label'; 30 $fieldModel->table = 'vtiger_users'; 31 $fieldModel->columntype = 'VARCHAR(255)'; 32 $fieldModel->typeofdata = 'V~O'; 33 $fieldModel->displaytype= 3; 34 $blockModel->addField($fieldModel); 35 echo "<br>Successfully added <b>$fieldName</b> field to <b>$moduleName</b><br>"; 36 } 37 } 38 $db->pquery("UPDATE vtiger_users SET $fieldName=TRIM(CONCAT(first_name, ' ' , last_name))", array()); 39 echo "<br>Successfully updated <b>$fieldName</b> value as concatenate of firstname and lastname for <b>$moduleName</b> module<br>"; 40 41 vimport('~modules/Users/CreateUserPrivilegeFile.php'); @uma.s Also in may of the migration scripts why do you use the code block below? There is already a perfectly good static method to do this
Vtiger_Access::syncSharingAccess();
16 16 $className = 'Vtiger_RecordLabelUpdater_Handler'; 17 17 $eventManager->unregisterHandler($className); @uma.s Is the RecordLabelUpdater_Handler not required for any entity modules now? It is unregistered here but I can't see that it is re-registered later on?
16 16 $className = 'Vtiger_RecordLabelUpdater_Handler'; 17 17 $eventManager->unregisterHandler($className); @lord_alan This has been taken care in CRMEntity.php insertIntoCrmEntity() api, Which updates the record label with $entityFieldNames.
https://code.vtiger.com/vtiger/vtigercrm/blob/master/data/CRMEntity.php#L292
770 770 771 // userlabel is a field. So, setting to column_fields will take care for update and insert as well 772 if($table_name == 'vtiger_users') { 773 $entityFields = Vtiger_Functions::getEntityModuleInfo($module); 774 $entityFieldNames = explode(',', $entityFields['fieldname']); 775 776 $userlabel = ''; 777 foreach($entityFieldNames as $entityFieldName) { 778 $userlabel .= $this->column_fields[$entityFieldName]." "; 779 } 780 $userlabel = trim(decode_html($userlabel)); 781 782 $this->column_fields['userlabel'] = strip_tags($userlabel); 783 } 784 771 785 if($insertion_mode == 'edit') { @lord_alan Sure! I will take care of this change. Thank you!
26 if (!$fieldModel) { 27 $fieldModel = new Vtiger_Field(); 28 $fieldModel->name = $fieldName; 29 $fieldModel->label = 'User Label'; 30 $fieldModel->table = 'vtiger_users'; 31 $fieldModel->columntype = 'VARCHAR(255)'; 32 $fieldModel->typeofdata = 'V~O'; 33 $fieldModel->displaytype= 3; 34 $blockModel->addField($fieldModel); 35 echo "<br>Successfully added <b>$fieldName</b> field to <b>$moduleName</b><br>"; 36 } 37 } 38 $db->pquery("UPDATE vtiger_users SET $fieldName=TRIM(CONCAT(first_name, ' ' , last_name))", array()); 39 echo "<br>Successfully updated <b>$fieldName</b> value as concatenate of firstname and lastname for <b>$moduleName</b> module<br>"; 40 41 vimport('~modules/Users/CreateUserPrivilegeFile.php'); @lord_alan Will review to make necessary changes.
281 281 282 282 $entityFields = Vtiger_Functions::getEntityModuleInfo($module); 283 283 $entityFieldNames = explode(',', $entityFields['fieldname']); 284 $label = (count($entityFieldNames) > 1) ? 284 switch ($module) { 285 case 'HelpDesk': $entityFieldNames = array('ticket_title'); @prasad @akshath Why are you hard-coding the entity fieldnames here? I have many customers who use the "Ticket No." as the entityfield as it is Unique and very easy for everyone to understand - the ticket title is often something facile like "customer bug" or "widget not working"... Similarly with Documents. The notes title is often just a cut & paste and is the same for multiple documents. It can also be a rather long string so when viewed in a related record or a list it gets truncated. Using the "Document No." is again rather common with several of my customers.