Skip to content
Snippets Groups Projects

#1533 issue on date formate

Closed Hemanth requested to merge Hemanth/vtigercrm:7.4.0 into master

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
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";
  • Akshath @akshath started a thread on commit aeaf8b8c
  • 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";
  • Alan Lord
    Alan Lord @lord_alan started a thread on commit aeaf8b8c
  • 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?

  • Manuel @manuelgit started a thread on commit aeaf8b8c
  • 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 @akshath started a thread on commit aeaf8b8c
  • 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 @akshath started a thread on commit aeaf8b8c
  • 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');
  • Uma
    Uma @uma.s started a thread on commit aeaf8b8c
  • 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');
  • Manuel @manuelgit started a thread on commit aeaf8b8c
  • 544 544 }
    545 545
    546 546 static function getSqlForNameInDisplayFormat($input, $module, $glue = ' ') {
    547 if ($module == 'Users') {
  • Uma Status changed to closed

    Status changed to closed

  • Alan Lord
    Alan Lord @lord_alan started a thread on commit 33df0c18
  • 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>
  • Uma
    Uma @uma.s started a thread on commit 33df0c18
  • 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}"
  • Alan Lord
    Alan Lord @lord_alan started a thread on commit aeaf8b8c
  • 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
    Uma @uma.s started a thread on commit aeaf8b8c
  • 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?

  • Alan Lord
    Alan Lord @lord_alan started a thread on commit aeaf8b8c
  • 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());
  • Alan Lord
    Alan Lord @lord_alan started a thread on commit 1904fa02
  • 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();

  • Alan Lord
    Alan Lord @lord_alan started a thread on commit 1904fa02
  • 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?

  • Uma
    Uma @uma.s started a thread on commit 1904fa02
  • 16 16 $className = 'Vtiger_RecordLabelUpdater_Handler';
    17 17 $eventManager->unregisterHandler($className);
  • Uma
    Uma @uma.s started a thread on commit aeaf8b8c
  • 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
    Uma @uma.s started a thread on commit 1904fa02
  • 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');
  • Alan Lord
    Alan Lord @lord_alan started a thread on commit 4d67b5fc
  • 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.

    Please register or sign in to reply
    Loading