当前位置: 首页>>代码示例>>PHP>>正文


PHP getValidDBInsertDateValue函数代码示例

本文整理汇总了PHP中getValidDBInsertDateValue函数的典型用法代码示例。如果您正苦于以下问题:PHP getValidDBInsertDateValue函数的具体用法?PHP getValidDBInsertDateValue怎么用?PHP getValidDBInsertDateValue使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了getValidDBInsertDateValue函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: handleEvent

 public function handleEvent($handlerType, $entityData)
 {
     $adb = PearDatabase::getInstance();
     $log = vglobal('log');
     $moduleName = $entityData->getModuleName();
     if ($moduleName == 'SalesOrder') {
         $soId = $entityData->getId();
         $data = $entityData->getData();
         if ($data['enable_recurring'] == 'on' || $data['enable_recurring'] == 1) {
             $frequency = $data['recurring_frequency'];
             $startPeriod = getValidDBInsertDateValue($data['start_period']);
             $endPeriod = getValidDBInsertDateValue($data['end_period']);
             $paymentDuration = $data['payment_duration'];
             $invoiceStatus = $data['invoicestatus'];
             if (isset($frequency) && $frequency != '' && $frequency != '--None--') {
                 $check_query = "SELECT * FROM vtiger_invoice_recurring_info WHERE salesorderid=?";
                 $check_res = $adb->pquery($check_query, array($soId));
                 $noofrows = $adb->num_rows($check_res);
                 if ($noofrows > 0) {
                     $row = $adb->query_result_rowdata($check_res, 0);
                     $query = "UPDATE vtiger_invoice_recurring_info SET recurring_frequency=?, start_period=?, end_period=?, payment_duration=?, invoice_status=? WHERE salesorderid=?";
                     $params = array($frequency, $startPeriod, $endPeriod, $paymentDuration, $invoiceStatus, $soId);
                 } else {
                     $query = "INSERT INTO vtiger_invoice_recurring_info VALUES (?,?,?,?,?,?,?)";
                     $params = array($soId, $frequency, $startPeriod, $endPeriod, $startPeriod, $paymentDuration, $invoiceStatus);
                 }
                 $adb->pquery($query, $params);
             }
         } else {
             $query = "DELETE FROM vtiger_invoice_recurring_info WHERE salesorderid = ?";
             $adb->pquery($query, array($soId));
         }
     }
 }
开发者ID:yozhi,项目名称:YetiForceCRM,代码行数:34,代码来源:RecurringInvoiceHandler.php

示例2: datefmt

 function datefmt($date, $outFormat = "d.m.Y")
 {
     if (strlen($date) > 10) {
         $date = substr($date, 0, 10);
     }
     $sql_format_date = getValidDBInsertDateValue($date);
     $date = new DateTime($sql_format_date);
     return $date->format($outFormat);
 }
开发者ID:cin-system,项目名称:cinrepo,代码行数:9,代码来源:date_format.php

示例3: insertIntoEntityTable

 /** Function to insert values in the specifed table for the specified module
  * @param $table_name -- table name:: Type varchar
  * @param $module -- module:: Type varchar
  */
 function insertIntoEntityTable($table_name, $module)
 {
     $log = vglobal('log');
     $log->info("function insertIntoEntityTable " . $module . ' vtiger_table name ' . $table_name);
     $adb = PearDatabase::getInstance();
     $current_user = vglobal('current_user');
     $insertion_mode = $this->mode;
     //Checkin whether an entry is already is present in the vtiger_table to update
     if ($insertion_mode == 'edit') {
         $check_query = "select * from " . $table_name . " where " . $this->tab_name_index[$table_name] . "=?";
         $check_result = $this->db->pquery($check_query, array($this->id));
         $num_rows = $this->db->num_rows($check_result);
         if ($num_rows <= 0) {
             $insertion_mode = '';
         }
     }
     // We will set the crypt_type based on the insertion_mode
     $crypt_type = '';
     if ($insertion_mode == 'edit') {
         $update = '';
         $update_params = array();
         $tabid = getTabid($module);
         $sql = "select * from vtiger_field where tabid=? and tablename=? and displaytype in (1,3,5) and vtiger_field.presence in (0,2)";
         $params = array($tabid, $table_name);
     } else {
         $column = $this->tab_name_index[$table_name];
         if ($column == 'id' && $table_name == 'vtiger_users') {
             $currentuser_id = $this->db->getUniqueID("vtiger_users");
             $this->id = $currentuser_id;
         }
         $qparams = array($this->id);
         $tabid = getTabid($module);
         $sql = "select * from vtiger_field where tabid=? and tablename=? and displaytype in (1,3,4,5) and vtiger_field.presence in (0,2)";
         $params = array($tabid, $table_name);
         $crypt_type = $this->DEFAULT_PASSWORD_CRYPT_TYPE;
     }
     $result = $this->db->pquery($sql, $params);
     $noofrows = $this->db->num_rows($result);
     for ($i = 0; $i < $noofrows; $i++) {
         $fieldname = $this->db->query_result($result, $i, "fieldname");
         $columname = $this->db->query_result($result, $i, "columnname");
         $uitype = $this->db->query_result($result, $i, "uitype");
         $typeofdata = $adb->query_result($result, $i, "typeofdata");
         $typeofdata_array = explode("~", $typeofdata);
         $datatype = $typeofdata_array[0];
         if (isset($this->column_fields[$fieldname])) {
             if ($uitype == 56) {
                 if ($this->column_fields[$fieldname] === 'on' || $this->column_fields[$fieldname] == 1) {
                     $fldvalue = 1;
                 } else {
                     $fldvalue = 0;
                 }
             } elseif ($uitype == 15) {
                 if ($this->column_fields[$fieldname] == $app_strings['LBL_NOT_ACCESSIBLE']) {
                     //If the value in the request is Not Accessible for a picklist, the existing value will be replaced instead of Not Accessible value.
                     $sql = "select {$columname} from  {$table_name} where " . $this->tab_name_index[$table_name] . "=?";
                     $res = $adb->pquery($sql, array($this->id));
                     $pick_val = $adb->query_result($res, 0, $columname);
                     $fldvalue = $pick_val;
                 } else {
                     $fldvalue = $this->column_fields[$fieldname];
                 }
             } elseif ($uitype == 5 || $uitype == 6 || $uitype == 23) {
                 if (isset($current_user->date_format)) {
                     $fldvalue = getValidDBInsertDateValue($this->column_fields[$fieldname]);
                 } else {
                     $fldvalue = $this->column_fields[$fieldname];
                 }
             } elseif ($uitype == 33) {
                 if (is_array($this->column_fields[$fieldname])) {
                     $field_list = implode(' |##| ', $this->column_fields[$fieldname]);
                 } else {
                     $field_list = $this->column_fields[$fieldname];
                 }
                 $fldvalue = $field_list;
             } elseif ($uitype == 99) {
                 $plain_text = $this->column_fields[$fieldname];
                 $fldvalue = $this->encrypt_password($plain_text, $crypt_type);
                 // Update the plain-text value with encrypted value and dependent fields
                 $this->column_fields[$fieldname] = $fldvalue;
                 $this->column_fields['crypt_type'] = $crypt_type;
                 $this->column_fields['user_hash'] = $this->get_user_hash($plain_text);
             } else {
                 $fldvalue = $this->column_fields[$fieldname];
                 $fldvalue = stripslashes($fldvalue);
             }
             $fldvalue = from_html($fldvalue, $insertion_mode == 'edit' ? true : false);
         } else {
             $fldvalue = '';
         }
         if ($uitype == 31) {
             $themeList = array_keys(Vtiger_Util_Helper::getAllSkins());
             if (!in_array($fldvalue, $themeList) || $fldvalue == '') {
                 global $default_theme;
                 if (!empty($default_theme) && in_array($default_theme, $themeList)) {
                     $fldvalue = $default_theme;
//.........这里部分代码省略.........
开发者ID:Bergdahls,项目名称:YetiForceCRM,代码行数:101,代码来源:Users.php

示例4: transformForImport


//.........这里部分代码省略.........
                         $referenceModuleName = $referenceModule;
                         if ($referenceModule == 'Users') {
                             $referenceEntityId = getUserId_Ol($entityLabel);
                             if (empty($referenceEntityId) || !Import_Utils::hasAssignPrivilege($moduleMeta->getEntityName(), $referenceEntityId)) {
                                 $referenceEntityId = $this->user->id;
                             }
                         } else {
                             $referenceEntityId = getEntityId($referenceModule, $entityLabel);
                         }
                         if ($referenceEntityId != 0) {
                             $entityId = $referenceEntityId;
                             break;
                         }
                     }
                 }
                 if ((empty($entityId) || $entityId == 0) && (!empty($referenceModuleName) and !in_array($referenceModuleName, getInventoryModules()))) {
                     if (isPermitted($referenceModuleName, 'EditView') == 'yes') {
                         $wsEntityIdInfo = $this->createEntityRecord($referenceModuleName, $entityLabel);
                         $wsEntityId = $wsEntityIdInfo['id'];
                         $entityIdComponents = vtws_getIdComponents($wsEntityId);
                         $entityId = $entityIdComponents[1];
                     }
                 }
                 $fieldData[$fieldName] = $entityId;
             } else {
                 $referencedModules = $fieldInstance->getReferenceList();
                 if ($referencedModules[0] == 'Users') {
                     if (isset($defaultFieldValues[$fieldName])) {
                         $fieldData[$fieldName] = $defaultFieldValues[$fieldName];
                     }
                     if (empty($fieldData[$fieldName]) || !Import_Utils::hasAssignPrivilege($moduleMeta->getEntityName(), $fieldData[$fieldName])) {
                         $fieldData[$fieldName] = $this->user->id;
                     }
                 } else {
                     $fieldData[$fieldName] = '';
                 }
             }
         } elseif ($fieldInstance->getFieldDataType() == 'picklist') {
             global $default_charset;
             if (empty($fieldValue) && isset($defaultFieldValues[$fieldName])) {
                 $fieldData[$fieldName] = $fieldValue = $defaultFieldValues[$fieldName];
             }
             $allPicklistDetails = $fieldInstance->getPicklistDetails();
             $allPicklistValues = array();
             foreach ($allPicklistDetails as $picklistDetails) {
                 $allPicklistValues[] = $picklistDetails['value'];
             }
             $encodePicklistValue = $fieldValue;
             if (!in_array($encodePicklistValue, $allPicklistValues)) {
                 $moduleObject = Vtiger_Module::getInstance($moduleMeta->getEntityName());
                 $fieldObject = Vtiger_Field::getInstance($fieldName, $moduleObject);
                 $fieldObject->setPicklistValues(array($fieldValue));
             }
         } else {
             if ($fieldInstance->getFieldDataType() == 'datetime' && !empty($fieldValue)) {
                 if ($fieldValue == null || $fieldValue == '0000-00-00 00:00:00') {
                     $fieldValue = '';
                 }
                 $valuesList = explode(' ', $fieldValue);
                 if (count($valuesList) == 1) {
                     $fieldValue = '';
                 }
                 $fieldValue = getValidDBInsertDateTimeValue($fieldValue);
                 if (preg_match("/^[0-9]{2,4}[-][0-1]{1,2}?[0-9]{1,2}[-][0-3]{1,2}?[0-9]{1,2} ([0-1][0-9]|[2][0-3])([:][0-5][0-9]){1,2}\$/", $fieldValue) == 0) {
                     $fieldValue = '';
                 }
                 $fieldData[$fieldName] = $fieldValue;
             }
             if ($fieldInstance->getFieldDataType() == 'date' && !empty($fieldValue)) {
                 if ($fieldValue == null || $fieldValue == '0000-00-00') {
                     $fieldValue = '';
                 }
                 $fieldValue = getValidDBInsertDateValue($fieldValue);
                 if (preg_match("/^[0-9]{2,4}[-][0-1]{1,2}?[0-9]{1,2}[-][0-3]{1,2}?[0-9]{1,2}\$/", $fieldValue) == 0) {
                     $fieldValue = '';
                 }
                 $fieldData[$fieldName] = $fieldValue;
             }
             if (empty($fieldValue) && isset($defaultFieldValues[$fieldName]) && !$mergeMode) {
                 $fieldData[$fieldName] = $fieldValue = $defaultFieldValues[$fieldName];
             }
         }
     }
     if ($fillDefault) {
         foreach ($defaultFieldValues as $fieldName => $fieldValue) {
             if (!isset($fieldData[$fieldName])) {
                 $fieldData[$fieldName] = $defaultFieldValues[$fieldName];
             }
         }
     }
     if (!$mergeMode) {
         //Do not check mandatory fields on merge !
         foreach ($moduleFields as $fieldName => $fieldInstance) {
             if (empty($fieldData[$fieldName]) && $fieldInstance->isMandatory()) {
                 return null;
             }
         }
     }
     return DataTransform::sanitizeData($fieldData, $moduleMeta);
 }
开发者ID:casati-dolibarr,项目名称:corebos,代码行数:101,代码来源:Import_Data_Controller.php

示例5: insertIntoEntityTable


//.........这里部分代码省略.........
             if (!CRMEntity::isBulkSaveMode()) {
                 $fldvalue = $this->setModuleSeqNumber("increment", $module);
             }
             $this->column_fields[$fieldname] = $fldvalue;
         }
         if (isset($this->column_fields[$fieldname])) {
             if ($uitype == 56) {
                 if ($this->column_fields[$fieldname] == 'on' || $this->column_fields[$fieldname] == 1) {
                     $fldvalue = '1';
                 } else {
                     $fldvalue = '0';
                 }
             } elseif ($uitype == 15 || $uitype == 16) {
                 if ($this->column_fields[$fieldname] == $app_strings['LBL_NOT_ACCESSIBLE']) {
                     //If the value in the request is Not Accessible for a picklist,
                     //the existing value will be replaced instead of Not Accessible value.
                     $sql = "select {$columname} from  {$table_name} where " . $this->tab_name_index[$table_name] . "=?";
                     $res = $adb->pquery($sql, array($this->id));
                     $pick_val = $adb->query_result($res, 0, $columname);
                     $fldvalue = $pick_val;
                 } else {
                     $fldvalue = $this->column_fields[$fieldname];
                 }
             } elseif ($uitype == 33) {
                 if (is_array($this->column_fields[$fieldname])) {
                     $field_list = implode(' |##| ', $this->column_fields[$fieldname]);
                 } else {
                     $field_list = $this->column_fields[$fieldname];
                 }
                 $fldvalue = $field_list;
             } elseif ($uitype == 5 || $uitype == 6 || $uitype == 23) {
                 //Added to avoid function call getDBInsertDateValue in ajax save
                 if (isset($current_user->date_format) && !$ajaxSave) {
                     $fldvalue = getValidDBInsertDateValue($this->column_fields[$fieldname]);
                 } else {
                     $fldvalue = $this->column_fields[$fieldname];
                 }
             } elseif ($uitype == 7) {
                 //strip out the spaces and commas in numbers if given ie., in amounts there may be ,
                 $fldvalue = str_replace(",", "", $this->column_fields[$fieldname]);
                 //trim($this->column_fields[$fieldname],",");
             } elseif ($uitype == 26) {
                 if (empty($this->column_fields[$fieldname])) {
                     $fldvalue = 1;
                     //the documents will stored in default folder
                 } else {
                     $fldvalue = $this->column_fields[$fieldname];
                 }
             } elseif ($uitype == 28) {
                 if ($this->column_fields[$fieldname] == null) {
                     $fileQuery = $adb->pquery("SELECT filename from vtiger_notes WHERE notesid = ?", array($this->id));
                     $fldvalue = null;
                     if (isset($fileQuery)) {
                         $rowCount = $adb->num_rows($fileQuery);
                         if ($rowCount > 0) {
                             $fldvalue = decode_html($adb->query_result($fileQuery, 0, 'filename'));
                         }
                     }
                 } else {
                     $fldvalue = decode_html($this->column_fields[$fieldname]);
                 }
             } elseif ($uitype == 8) {
                 $this->column_fields[$fieldname] = rtrim($this->column_fields[$fieldname], ',');
                 $ids = explode(',', $this->column_fields[$fieldname]);
                 $json = new Zend_Json();
                 $fldvalue = $json->encode($ids);
开发者ID:cin-system,项目名称:cinrepo,代码行数:67,代码来源:PaymentManagement.php

示例6: transformForImport


//.........这里部分代码省略.........
                         } catch (Exception $e) {
                             $entityId = false;
                         }
                     }
                 }
                 $fieldData[$fieldName] = $entityId;
             } else {
                 $referencedModules = $fieldInstance->getReferenceList();
                 if ($referencedModules[0] == 'Users') {
                     if (isset($defaultFieldValues[$fieldName])) {
                         $fieldData[$fieldName] = $defaultFieldValues[$fieldName];
                     }
                     if (empty($fieldData[$fieldName]) || !Import_Utils_Helper::hasAssignPrivilege($moduleMeta->getEntityName(), $fieldData[$fieldName])) {
                         $fieldData[$fieldName] = $this->user->id;
                     }
                 } else {
                     $fieldData[$fieldName] = '';
                 }
             }
         } elseif ($fieldInstance->getFieldDataType() == 'picklist') {
             $fieldValue = trim($fieldValue);
             global $default_charset;
             if (empty($fieldValue) && isset($defaultFieldValues[$fieldName])) {
                 $fieldData[$fieldName] = $fieldValue = $defaultFieldValues[$fieldName];
             }
             $olderCacheEnable = Vtiger_Cache::$cacheEnable;
             Vtiger_Cache::$cacheEnable = false;
             if (!isset($this->allPicklistValues[$fieldName])) {
                 $this->allPicklistValues[$fieldName] = $fieldInstance->getPicklistDetails();
             }
             $allPicklistDetails = $this->allPicklistValues[$fieldName];
             $allPicklistValues = array();
             foreach ($allPicklistDetails as $picklistDetails) {
                 $allPicklistValues[] = $picklistDetails['value'];
             }
             $picklistValueInLowerCase = strtolower(htmlentities($fieldValue, ENT_QUOTES, $default_charset));
             $allPicklistValuesInLowerCase = array_map('strtolower', $allPicklistValues);
             $picklistDetails = array_combine($allPicklistValuesInLowerCase, $allPicklistValues);
             if (!in_array($picklistValueInLowerCase, $allPicklistValuesInLowerCase)) {
                 $moduleObject = Vtiger_Module::getInstance($moduleMeta->getEntityName());
                 $fieldObject = Vtiger_Field::getInstance($fieldName, $moduleObject);
                 $fieldObject->setPicklistValues(array($fieldValue));
                 unset($this->allPicklistValues[$fieldName]);
             } else {
                 $fieldData[$fieldName] = $picklistDetails[$picklistValueInLowerCase];
             }
             Vtiger_Cache::$cacheEnable = $olderCacheEnable;
         } else {
             if ($fieldInstance->getFieldDataType() == 'currency') {
                 // While exporting we are exporting as user format, we should import as db format while importing
                 $fieldData[$fieldName] = CurrencyField::convertToDBFormat($fieldValue, $current_user, false);
             } else {
                 if ($fieldInstance->getFieldDataType() == 'datetime' && !empty($fieldValue)) {
                     if ($fieldValue == null || $fieldValue == '0000-00-00 00:00:00') {
                         $fieldValue = '';
                     }
                     $valuesList = explode(' ', $fieldValue);
                     if (count($valuesList) == 1) {
                         $fieldValue = '';
                     }
                     $fieldValue = getValidDBInsertDateTimeValue($fieldValue);
                     if (preg_match("/^[0-9]{2,4}[-][0-1]{1,2}?[0-9]{1,2}[-][0-3]{1,2}?[0-9]{1,2} ([0-1][0-9]|[2][0-3])([:][0-5][0-9]){1,2}\$/", $fieldValue) == 0) {
                         $fieldValue = '';
                     }
                     $fieldData[$fieldName] = $fieldValue;
                 }
                 if ($fieldInstance->getFieldDataType() == 'date' && !empty($fieldValue)) {
                     if ($fieldValue == null || $fieldValue == '0000-00-00') {
                         $fieldValue = '';
                     }
                     $fieldValue = getValidDBInsertDateValue($fieldValue);
                     if (preg_match("/^[0-9]{2,4}[-][0-1]{1,2}?[0-9]{1,2}[-][0-3]{1,2}?[0-9]{1,2}\$/", $fieldValue) == 0) {
                         $fieldValue = '';
                     }
                     $fieldData[$fieldName] = $fieldValue;
                 }
                 if (empty($fieldValue) && isset($defaultFieldValues[$fieldName])) {
                     $fieldData[$fieldName] = $fieldValue = $defaultFieldValues[$fieldName];
                 }
             }
         }
     }
     if ($fillDefault) {
         foreach ($defaultFieldValues as $fieldName => $fieldValue) {
             if (!isset($fieldData[$fieldName])) {
                 $fieldData[$fieldName] = $defaultFieldValues[$fieldName];
             }
         }
     }
     // We should sanitizeData before doing final mandatory check below.
     $fieldData = DataTransform::sanitizeData($fieldData, $moduleMeta);
     if ($fieldData != null && $checkMandatoryFieldValues) {
         foreach ($moduleFields as $fieldName => $fieldInstance) {
             if (empty($fieldData[$fieldName]) && $fieldInstance->isMandatory()) {
                 return null;
             }
         }
     }
     return $fieldData;
 }
开发者ID:cannking,项目名称:vtigercrm-debug,代码行数:101,代码来源:Data.php

示例7: insertIntoEntityTable

 /** Function to insert values in the specifed table for the specified module
  * @param $table_name -- table name:: Type varchar
  * @param $module -- module:: Type varchar
  */
 function insertIntoEntityTable($table_name, $module, $fileid = '')
 {
     global $log;
     global $current_user, $app_strings;
     $log->info("function insertIntoEntityTable " . $module . ' vtiger_table name ' . $table_name);
     global $adb;
     $insertion_mode = $this->mode;
     //Checkin whether an entry is already is present in the vtiger_table to update
     if ($insertion_mode == 'edit') {
         $tablekey = $this->tab_name_index[$table_name];
         // Make selection on the primary key of the module table to check.
         $check_query = "select {$tablekey} from {$table_name} where {$tablekey}=?";
         $check_result = $adb->pquery($check_query, array($this->id));
         $num_rows = $adb->num_rows($check_result);
         if ($num_rows <= 0) {
             $insertion_mode = '';
         }
     }
     $tabid = getTabid($module);
     if ($module == 'Calendar' && $this->column_fields["activitytype"] != null && $this->column_fields["activitytype"] != 'Task') {
         $tabid = getTabid('Events');
     }
     if ($insertion_mode == 'edit') {
         $update = array();
         $update_params = array();
         require 'user_privileges/user_privileges_' . $current_user->id . '.php';
         if ($is_admin == true || $profileGlobalPermission[1] == 0 || $profileGlobalPermission[2] == 0) {
             $sql = "select * from vtiger_field where tabid in (" . generateQuestionMarks($tabid) . ") and tablename=? and displaytype in (1,3) and presence in (0,2) group by columnname";
             $params = array($tabid, $table_name);
         } else {
             $profileList = getCurrentUserProfileList();
             if (count($profileList) > 0) {
                 $sql = "SELECT *\n\t\t\t  \t\t\tFROM vtiger_field\n\t\t\t  \t\t\tINNER JOIN vtiger_profile2field\n\t\t\t  \t\t\tON vtiger_profile2field.fieldid = vtiger_field.fieldid\n\t\t\t  \t\t\tINNER JOIN vtiger_def_org_field\n\t\t\t  \t\t\tON vtiger_def_org_field.fieldid = vtiger_field.fieldid\n\t\t\t  \t\t\tWHERE vtiger_field.tabid = ?\n\t\t\t  \t\t\tAND vtiger_profile2field.visible = 0 \n\t\t\t  \t\t\tAND vtiger_profile2field.profileid IN (" . generateQuestionMarks($profileList) . ")\n\t\t\t  \t\t\tAND vtiger_def_org_field.visible = 0 and vtiger_field.tablename=? and vtiger_field.displaytype in (1,3) and vtiger_field.presence in (0,2) group by columnname";
                 $params = array($tabid, $profileList, $table_name);
             } else {
                 $sql = "SELECT *\n\t\t\t  \t\t\tFROM vtiger_field\n\t\t\t  \t\t\tINNER JOIN vtiger_profile2field\n\t\t\t  \t\t\tON vtiger_profile2field.fieldid = vtiger_field.fieldid\n\t\t\t  \t\t\tINNER JOIN vtiger_def_org_field\n\t\t\t  \t\t\tON vtiger_def_org_field.fieldid = vtiger_field.fieldid\n\t\t\t  \t\t\tWHERE vtiger_field.tabid = ?\n\t\t\t  \t\t\tAND vtiger_profile2field.visible = 0 \n\t\t\t  \t\t\tAND vtiger_def_org_field.visible = 0 and vtiger_field.tablename=? and vtiger_field.displaytype in (1,3) and vtiger_field.presence in (0,2) group by columnname";
                 $params = array($tabid, $table_name);
             }
         }
     } else {
         $table_index_column = $this->tab_name_index[$table_name];
         if ($table_index_column == 'id' && $table_name == 'vtiger_users') {
             $currentuser_id = $adb->getUniqueID("vtiger_users");
             $this->id = $currentuser_id;
         }
         $column = array($table_index_column);
         $value = array($this->id);
         $sql = "select * from vtiger_field where tabid=? and tablename=? and displaytype in (1,3,4) and vtiger_field.presence in (0,2)";
         $params = array($tabid, $table_name);
     }
     $result = $adb->pquery($sql, $params);
     $noofrows = $adb->num_rows($result);
     for ($i = 0; $i < $noofrows; $i++) {
         $fieldname = $adb->query_result($result, $i, "fieldname");
         $columname = $adb->query_result($result, $i, "columnname");
         $uitype = $adb->query_result($result, $i, "uitype");
         $generatedtype = $adb->query_result($result, $i, "generatedtype");
         $typeofdata = $adb->query_result($result, $i, "typeofdata");
         $typeofdata_array = explode("~", $typeofdata);
         $datatype = $typeofdata_array[0];
         if ($uitype == 4 && $insertion_mode != 'edit') {
             $this->column_fields[$fieldname] = $this->setModuleSeqNumber("increment", $module);
             $fldvalue = $this->column_fields[$fieldname];
         }
         if (isset($this->column_fields[$fieldname])) {
             if ($uitype == 56) {
                 if ($this->column_fields[$fieldname] == 'on' || $this->column_fields[$fieldname] == 1) {
                     $fldvalue = '1';
                 } else {
                     $fldvalue = '0';
                 }
             } elseif ($uitype == 15 || $uitype == 16) {
                 if ($this->column_fields[$fieldname] == $app_strings['LBL_NOT_ACCESSIBLE']) {
                     //If the value in the request is Not Accessible for a picklist, the existing value will be replaced instead of Not Accessible value.
                     $sql = "select {$columname} from  {$table_name} where " . $this->tab_name_index[$table_name] . "=?";
                     $res = $adb->pquery($sql, array($this->id));
                     $pick_val = $adb->query_result($res, 0, $columname);
                     $fldvalue = $pick_val;
                 } else {
                     $fldvalue = $this->column_fields[$fieldname];
                 }
             } elseif ($uitype == 33) {
                 if (is_array($this->column_fields[$fieldname])) {
                     $field_list = implode(' |##| ', $this->column_fields[$fieldname]);
                 } else {
                     $field_list = $this->column_fields[$fieldname];
                 }
                 $fldvalue = $field_list;
             } elseif ($uitype == 5 || $uitype == 6 || $uitype == 23) {
                 if ($_REQUEST['action'] == 'Import') {
                     $fldvalue = $this->column_fields[$fieldname];
                 } else {
                     //Added to avoid function call getDBInsertDateValue in ajax save
                     if (isset($current_user->date_format)) {
                         $fldvalue = getValidDBInsertDateValue($this->column_fields[$fieldname]);
                     } else {
//.........这里部分代码省略.........
开发者ID:vtiger-jp,项目名称:vtigercrm-5.1.x-ja,代码行数:101,代码来源:CRMEntity.php

示例8: updateFieldProperties

function updateFieldProperties()
{
    global $adb, $smarty, $log;
    $fieldid = vtlib_purify($_REQUEST['fieldid']);
    $req_sql = "select * from vtiger_field where fieldid = ? and fieldname not in('salutationtype') and vtiger_field.presence in (0,2)";
    $req_result = $adb->pquery($req_sql, array($fieldid));
    $typeofdata = $adb->query_result($req_result, 0, 'typeofdata');
    $tabid = $adb->query_result($req_result, 0, 'tabid');
    $fieldname = $adb->query_result($req_result, 0, 'fieldname');
    $uitype = $adb->query_result($req_result, 0, 'uitype');
    $oldfieldlabel = $adb->query_result($req_result, 0, 'fieldlabel');
    $tablename = $adb->query_result($req_result, 0, 'tablename');
    $columnname = $adb->query_result($req_result, 0, 'columnname');
    $oldquickcreate = $adb->query_result($req_result, 0, 'quickcreate');
    $oldmassedit = $adb->query_result($req_result, 0, 'masseditable');
    $oldpresence = $adb->query_result($req_result, 0, 'presence');
    if (!empty($_REQUEST['fld_module'])) {
        $fld_module = vtlib_purify($_REQUEST['fld_module']);
    } else {
        $fld_module = getTabModuleName($tabid);
    }
    $focus = CRMEntity::getInstance($fld_module);
    $fieldtype = explode("~", $typeofdata);
    $mandatory_checked = vtlib_purify($_REQUEST['ismandatory']);
    $quickcreate_checked = vtlib_purify($_REQUEST['quickcreate']);
    $presence_check = vtlib_purify($_REQUEST['isPresent']);
    $massedit_check = vtlib_purify($_REQUEST['massedit']);
    $defaultvalue = vtlib_purify($_REQUEST['defaultvalue']);
    if (!empty($defaultvalue)) {
        if ($uitype == 56) {
            if ($defaultvalue == 'on' || $defaultvalue == '1') {
                $defaultvalue = '1';
            } elseif ($defaultvalue == 'off' || $defaultvalue == '0') {
                $defaultvalue = '0';
            } else {
                $defaultvalue = '';
            }
        } elseif ($uitype == 5 || $uitype == 6 || $uitype == 23) {
            $defaultvalue = getValidDBInsertDateValue($defaultvalue);
        }
    }
    if (isset($focus->mandatory_fields) && !empty($focus->mandatory_fields) && in_array($fieldname, $focus->mandatory_fields)) {
        $fieldtype[1] = 'M';
    } elseif ($mandatory_checked == 'true' || $mandatory_checked == '') {
        $fieldtype[1] = 'M';
    } else {
        $fieldtype[1] = 'O';
    }
    $datatype = implode('~', $fieldtype);
    $maxseq = '';
    if ($oldquickcreate != 3) {
        if ($quickcreate_checked == 'true' || $quickcreate_checked == '') {
            $qcdata = 2;
            $quickcreateseq_Query = 'select max(quickcreatesequence) as maxseq from vtiger_field where tabid = ?';
            $res = $adb->pquery($quickcreateseq_Query, array($tabid));
            $maxseq = $adb->query_result($res, 0, 'maxseq');
        } else {
            $qcdata = 1;
        }
    }
    if ($oldpresence != 3) {
        if ($presence_check == 'true' || $presence_check == '') {
            $presence = 2;
        } else {
            $presence = 1;
        }
    } else {
        $presence = 1;
    }
    if ($oldmassedit != 3) {
        if ($massedit_check == 'true' || $massedit_check == '') {
            $massedit = 1;
        } else {
            $massedit = 2;
        }
    } else {
        $massedit = 1;
    }
    if (isset($focus->mandatory_fields) && !empty($focus->mandatory_fields)) {
        $fieldname_list = implode(',', $focus->mandatory_fields);
    } else {
        $fieldname_list = '';
    }
    $mandatory_query = "update vtiger_field set typeofdata=? where fieldid=? and fieldname not in (?) AND displaytype != 2";
    $mandatory_params = array($datatype, $fieldid, $fieldname_list);
    $adb->pquery($mandatory_query, $mandatory_params);
    if (!empty($qcdata)) {
        $quickcreate_query = "update vtiger_field set quickcreate = ? ,quickcreatesequence = ? where fieldid = ? and quickcreate not in (0,3) AND displaytype != 2";
        $quickcreate_params = array($qcdata, $maxseq + 1, $fieldid);
        $adb->pquery($quickcreate_query, $quickcreate_params);
    }
    $presence_query = "update vtiger_field set presence = ? where fieldid = ? and presence not in (0,3) and quickcreate != 0";
    $quickcreate_params = array($presence, $fieldid);
    $adb->pquery($presence_query, $quickcreate_params);
    $massedit_query = "update vtiger_field set masseditable = ? where fieldid = ? and masseditable not in (0,3) AND displaytype != 2";
    $massedit_params = array($massedit, $fieldid);
    $adb->pquery($massedit_query, $massedit_params);
    $defaultvalue_query = "update vtiger_field set defaultvalue=? where fieldid = ? and fieldname not in (?) AND displaytype != 2";
    $defaultvalue_params = array($defaultvalue, $fieldid, $fieldname_list);
    $adb->pquery($defaultvalue_query, $defaultvalue_params);
//.........这里部分代码省略.........
开发者ID:mslokhat,项目名称:corebos,代码行数:101,代码来源:LayoutBlockList.php

示例9: vtlib_purify

$recordId = vtlib_purify($_REQUEST["record"]);
$leadId = vtws_getWebserviceEntityId('Leads', $recordId);
$assigned_to = $_REQUEST["assigntype"];
if ($assigned_to == "U") {
    $assigned_user_id = $_REQUEST["assigned_user_id"];
    $assignedTo = vtws_getWebserviceEntityId('Users', $assigned_user_id);
} else {
    $assigned_user_id = $_REQUEST["assigned_group_id"];
    $assignedTo = vtws_getWebserviceEntityId('Groups', $assigned_user_id);
}
$accountName = $_REQUEST['account_name'];
$createPotential = $_REQUEST["createpotential"];
$avoidPotential = isset($createPotential) && $createPotential == "on" ? true : false;
$potential = array();
$potential['potentialname'] = vtlib_purify($_REQUEST["potential_name"]);
$potential['closingdate'] = getValidDBInsertDateValue($_REQUEST["closedate"]);
$potential['amount'] = vtlib_purify($_REQUEST['potential_amount']);
$potential['sales_stage'] = vtlib_purify($_REQUEST['potential_sales_stage']);
$transferRelatedRecordsTo = $_REQUEST['transfer_related_records_to'];
if (empty($transferRelatedRecordsTo)) {
    $transferRelatedRecordsTo = 'Contacts';
}
$result = vtws_convertlead($leadId, $assignedTo, $accountName, $avoidPotential, $potential, $transferRelatedRecordsTo, $current_user);
$accountIdComponents = vtws_getIdComponents($result['accountId']);
$accountId = $accountIdComponents[1];
$contactIdComponents = vtws_getIdComponents($result['contactId']);
$contactId = $contactIdComponents[1];
$potentialIdComponents = vtws_getIdComponents($result['potentialId']);
$potentialId = $potentialIdComponents[1];
if (!empty($accountId)) {
    header("Location: index.php?action=DetailView&module=Accounts&record={$accountId}&parenttab={$category}");
开发者ID:hbsman,项目名称:vtigercrm-5.3.0-ja,代码行数:31,代码来源:LeadConvertToEntities.php

示例10: insertIntoActivityReminderPopup

 /** Function to insert values in vtiger_activity_reminder_popup table for the specified module
  * @param $cbmodule -- module:: Type varchar
  */
 function insertIntoActivityReminderPopup($cbmodule)
 {
     $adb = PearDatabase::getInstance();
     $cbrecord = $this->id;
     unset($_SESSION['next_reminder_time']);
     if (isset($cbmodule) && isset($cbrecord)) {
         $cbdate = getValidDBInsertDateValue($this->column_fields['date_start']);
         $cbtime = $this->column_fields['time_start'];
         $reminderQuery = 'SELECT reminderid FROM vtiger_activity_reminder_popup WHERE semodule = ? and recordid = ?';
         $reminderParams = [$cbmodule, $cbrecord];
         $reminderidres = $adb->pquery($reminderQuery, $reminderParams);
         $reminderid = null;
         if ($reminderidres->rowCount() > 0) {
             $reminderid = $adb->query_result($reminderidres, 0, 'reminderid');
         }
         $currentStates = Calendar_Module_Model::getComponentActivityStateLabel('current');
         $state = Calendar_Module_Model::getCalendarState($this->column_fields);
         if (in_array($state, $currentStates)) {
             $status = 0;
         } else {
             $status = 1;
         }
         if (isset($reminderid)) {
             $adb->update('vtiger_activity_reminder_popup', ['date_start' => $cbdate, 'time_start' => $cbtime, 'status' => $status], 'reminderid = ?', [$reminderid]);
         } else {
             $adb->insert('vtiger_activity_reminder_popup', ['recordid' => $cbrecord, 'semodule' => $cbmodule, 'date_start' => $cbdate, 'time_start' => $cbtime, 'status' => $status]);
         }
     }
 }
开发者ID:awflu,项目名称:YetiForceCRM,代码行数:32,代码来源:Activity.php

示例11: insertIntoActivityReminderPopup

 /** Function to insert values in vtiger_activity_reminder_popup table for the specified module
  * @param $cbmodule -- module:: Type varchar
  */
 function insertIntoActivityReminderPopup($cbmodule)
 {
     $adb = PearDatabase::getInstance();
     $cbrecord = $this->id;
     unset($_SESSION['next_reminder_time']);
     if (isset($cbmodule) && isset($cbrecord)) {
         $cbdate = getValidDBInsertDateValue($this->column_fields['date_start']);
         $cbtime = $this->column_fields['time_start'];
         $reminder_query = "SELECT reminderid FROM vtiger_activity_reminder_popup WHERE semodule = ? and recordid = ?";
         $reminder_params = array($cbmodule, $cbrecord);
         $reminderidres = $adb->pquery($reminder_query, $reminder_params);
         $reminderid = null;
         if ($adb->num_rows($reminderidres) > 0) {
             $reminderid = $adb->query_result($reminderidres, 0, "reminderid");
         }
         if (isset($reminderid)) {
             $current_date = new DateTime();
             $record_date = new DateTime($cbdate . ' ' . $cbtime);
             $current = $current_date->format('Y-m-d H:i:s');
             $record = $record_date->format('Y-m-d H:i:s');
             if (strtotime($record) > strtotime($current)) {
                 $callback_query = "UPDATE vtiger_activity_reminder_popup set status = 0, date_start = ?, time_start = ? WHERE reminderid = ?";
                 $callback_params = array($cbdate, $cbtime, $reminderid);
             }
         } else {
             $callback_query = "INSERT INTO vtiger_activity_reminder_popup (recordid, semodule, date_start, time_start) VALUES (?,?,?,?)";
             $callback_params = array($cbrecord, $cbmodule, $cbdate, $cbtime);
         }
         if ($callback_query) {
             $adb->pquery($callback_query, $callback_params);
         }
     }
 }
开发者ID:rcrrich,项目名称:YetiForceCRM,代码行数:36,代码来源:Activity.php

示例12: transformForImport


//.........这里部分代码省略.........
							if ($referenceModule == 'Users') {
								$referenceEntityId = getUserId_Ol($entityLabel);
								if(empty($referenceEntityId) ||
										!Import_Utils::hasAssignPrivilege($moduleMeta->getEntityName(), $referenceEntityId)) {
									$referenceEntityId = $this->user->id;
								}
							} else {
								$referenceEntityId = getEntityId($referenceModule, $entityLabel);
							}
							if ($referenceEntityId != 0) {
								$entityId = $referenceEntityId;
								break;
							}
						}
					}
					if ((empty($entityId) || $entityId == 0) && !empty($referenceModuleName)) {
						if(isPermitted($referenceModuleName, 'EditView') == 'yes') {
							$wsEntityIdInfo = $this->createEntityRecord($referenceModuleName, $entityLabel);
							$wsEntityId = $wsEntityIdInfo['id'];
							$entityIdComponents = vtws_getIdComponents($wsEntityId);
							$entityId = $entityIdComponents[1];
						}
					}
					$fieldData[$fieldName] = $entityId;
				} else {
					$referencedModules = $fieldInstance->getReferenceList();
					if ($referencedModules[0] == 'Users') {
						if(isset($defaultFieldValues[$fieldName])) {
							$fieldData[$fieldName] = $defaultFieldValues[$fieldName];
						}
						if(empty($fieldData[$fieldName]) ||
								!Import_Utils::hasAssignPrivilege($moduleMeta->getEntityName(), $fieldData[$fieldName])) {
							$fieldData[$fieldName] = $this->user->id;
						}
					} else {
						$fieldData[$fieldName] = '';
					}
				}

			} elseif ($fieldInstance->getFieldDataType() == 'picklist') {
				global $default_charset;
				if (empty($fieldValue) && isset($defaultFieldValues[$fieldName])) {
					$fieldData[$fieldName] = $fieldValue = $defaultFieldValues[$fieldName];
				}
				$allPicklistDetails = $fieldInstance->getPicklistDetails();
				$allPicklistValues = array();
				foreach ($allPicklistDetails as $picklistDetails) {
					$allPicklistValues[] = $picklistDetails['value'];
				}
				$encodePicklistValue = htmlentities($fieldValue,ENT_QUOTES,$default_charset);
				if (!in_array($encodePicklistValue, $allPicklistValues)) {
					$moduleObject = Vtiger_Module::getInstance($moduleMeta->getEntityName());
					$fieldObject = Vtiger_Field::getInstance($fieldName, $moduleObject);
					$fieldObject->setPicklistValues(array($fieldValue));
				}
			} else {
				if ($fieldInstance->getFieldDataType() == 'datetime' && !empty($fieldValue)) {
					if($fieldValue == null || $fieldValue == '0000-00-00 00:00:00') {
						$fieldValue = '';
					}
					$valuesList = explode(' ', $fieldValue);
					if(count($valuesList) == 1) $fieldValue = '';
					$fieldValue = getValidDBInsertDateTimeValue($fieldValue);
					if (preg_match("/^[0-9]{2,4}[-][0-1]{1,2}?[0-9]{1,2}[-][0-3]{1,2}?[0-9]{1,2} ([0-1][0-9]|[2][0-3])([:][0-5][0-9]){1,2}$/",
							$fieldValue) == 0) {
						$fieldValue = '';
					}
					$fieldData[$fieldName] = $fieldValue;
				}
				if ($fieldInstance->getFieldDataType() == 'date' && !empty($fieldValue)) {
					if($fieldValue == null || $fieldValue == '0000-00-00') {
						$fieldValue = '';
					}
					$fieldValue = getValidDBInsertDateValue($fieldValue);
					if (preg_match("/^[0-9]{2,4}[-][0-1]{1,2}?[0-9]{1,2}[-][0-3]{1,2}?[0-9]{1,2}$/", $fieldValue) == 0) {
						$fieldValue = '';
					}
					$fieldData[$fieldName] = $fieldValue;
				}
				if (empty($fieldValue) && isset($defaultFieldValues[$fieldName])) {
					$fieldData[$fieldName] = $fieldValue = $defaultFieldValues[$fieldName];
				}
			}
		}
		if($fillDefault) {
			foreach($defaultFieldValues as $fieldName => $fieldValue) {
				if (!isset($fieldData[$fieldName])) {
					$fieldData[$fieldName] = $defaultFieldValues[$fieldName];
				}
			}
		}

		foreach ($moduleFields as $fieldName => $fieldInstance) {
			if(empty($fieldData[$fieldName]) && $fieldInstance->isMandatory()) {
				return null;
			}
		}

		return DataTransform::sanitizeData($fieldData, $moduleMeta);
	}
开发者ID:nvh3010,项目名称:quancrm,代码行数:101,代码来源:Import_Data_Controller.php

示例13: getConditionValue

 /**
  *
  * @param mixed $value
  * @param String $operator
  * @param WebserviceField $field
  */
 private function getConditionValue($value, $operator, $field)
 {
     $operator = strtolower($operator);
     $db = PearDatabase::getInstance();
     if (is_string($value)) {
         $valueArray = explode(',', $value);
     } elseif (is_array($value)) {
         $valueArray = $value;
     } else {
         $valueArray = array($value);
     }
     $sql = array();
     if ($operator == 'between') {
         if ($field->getFieldName() == 'birthday') {
             $sql[] = "BETWEEN DATE_FORMAT(" . $db->quote($valueArray[0]) . ", '%m%d') AND " . "DATE_FORMAT(" . $db->quote($valueArray[1]) . ", '%m%d')";
         } else {
             $sql[] = "BETWEEN " . $db->quote($valueArray[0]) . " AND " . $db->quote($valueArray[1]);
         }
         return $sql;
     }
     foreach ($valueArray as $value) {
         if (!$this->isStringType($field->getFieldDataType())) {
             $value = trim($value);
         }
         if (strtolower(trim($value)) == 'null' || trim($value) == '' && !$this->isStringType($field->getFieldDataType()) && ($operator == 'e' || $operator == 'n')) {
             if ($operator == 'e') {
                 $sql[] = "IS NULL";
                 continue;
             }
             $sql[] = "IS NOT NULL";
             continue;
         } elseif ($field->getFieldDataType() == 'boolean') {
             $value = strtolower($value);
             if ($value == 'yes') {
                 $value = 1;
             } elseif ($value == 'no') {
                 $value = 0;
             }
         } elseif ($this->isDateType($field->getFieldDataType())) {
             if ($field->getFieldDataType() == 'datetime') {
                 $valueList = explode(' ', $value);
                 $value = $valueList[0];
             }
             $value = getValidDBInsertDateValue($value);
             if ($field->getFieldDataType() == 'datetime') {
                 $value .= ' ' . $valueList[1];
             }
         }
         if ($field->getFieldName() == 'birthday' && !$this->isRelativeSearchOperators($operator)) {
             $value = "DATE_FORMAT(" . $db->quote($value) . ", '%m%d')";
         } else {
             $value = $db->sql_escape_string($value);
         }
         if (trim($value) == '' && ($operator == 's' || $operator == 'ew' || $operator == 'c') && ($this->isStringType($field->getFieldDataType()) || $field->getFieldDataType() == 'picklist' || $field->getFieldDataType() == 'multipicklist')) {
             $sql[] = "LIKE ''";
             continue;
         }
         if (trim($value) == '' && $operator == 'k' && $this->isStringType($field->getFieldDataType())) {
             $sql[] = "NOT LIKE ''";
             continue;
         }
         switch ($operator) {
             case 'e':
                 $sqlOperator = "=";
                 break;
             case 'n':
                 $sqlOperator = "<>";
                 break;
             case 's':
                 $sqlOperator = "LIKE";
                 $value = "{$value}%";
                 break;
             case 'ew':
                 $sqlOperator = "LIKE";
                 $value = "%{$value}";
                 break;
             case 'c':
                 $sqlOperator = "LIKE";
                 $value = "%{$value}%";
                 break;
             case 'k':
                 $sqlOperator = "NOT LIKE";
                 $value = "%{$value}%";
                 break;
             case 'l':
                 $sqlOperator = "<";
                 break;
             case 'g':
                 $sqlOperator = ">";
                 break;
             case 'm':
                 $sqlOperator = "<=";
                 break;
             case 'h':
//.........这里部分代码省略.........
开发者ID:hardikk,项目名称:HNH,代码行数:101,代码来源:QueryGenerator.php

示例14: insertIntoEntityTable


//.........这里部分代码省略.........
             $this->column_fields[$fieldname] = $fldvalue;
         }
         if (isset($this->column_fields[$fieldname])) {
             if ($uitype == 56) {
                 if ($this->column_fields[$fieldname] == 'on' || $this->column_fields[$fieldname] == 1) {
                     $fldvalue = '1';
                 } else {
                     $fldvalue = '0';
                 }
             } elseif ($uitype == 15 || $uitype == 16) {
                 if ($this->column_fields[$fieldname] == $app_strings['LBL_NOT_ACCESSIBLE']) {
                     //If the value in the request is Not Accessible for a picklist, the existing value will be replaced instead of Not Accessible value.
                     $sql = "select {$columname} from  {$table_name} where " . $this->tab_name_index[$table_name] . "=?";
                     $res = $adb->pquery($sql, array($this->id));
                     $pick_val = $adb->query_result($res, 0, $columname);
                     $fldvalue = $pick_val;
                 } else {
                     $fldvalue = $this->column_fields[$fieldname];
                 }
             } elseif ($uitype == 33) {
                 if (is_array($this->column_fields[$fieldname])) {
                     $field_list = implode(' |##| ', $this->column_fields[$fieldname]);
                 } else {
                     $field_list = $this->column_fields[$fieldname];
                 }
                 if ($field_list == '') {
                     $fldvalue = NULL;
                 } else {
                     $fldvalue = $field_list;
                 }
             } elseif ($uitype == 5 || $uitype == 6 || $uitype == 23) {
                 //Added to avoid function call getDBInsertDateValue in ajax save
                 if (isset($current_user->date_format) && !$ajaxSave) {
                     $fldvalue = getValidDBInsertDateValue($this->column_fields[$fieldname]);
                 } else {
                     $fldvalue = $this->column_fields[$fieldname];
                 }
             } elseif ($uitype == 7) {
                 //strip out the spaces and commas in numbers if given ie., in amounts there may be ,
                 $fldvalue = str_replace(",", "", $this->column_fields[$fieldname]);
                 //trim($this->column_fields[$fieldname],",");
             } elseif ($uitype == 26) {
                 if (empty($this->column_fields[$fieldname])) {
                     $fldvalue = 1;
                     //the documents will stored in default folder
                 } else {
                     $fldvalue = $this->column_fields[$fieldname];
                 }
             } elseif ($uitype == 28) {
                 if ($this->column_fields[$fieldname] == null) {
                     $fileQuery = $adb->pquery("SELECT filename from vtiger_notes WHERE notesid = ?", array($this->id));
                     $fldvalue = null;
                     if (isset($fileQuery)) {
                         $rowCount = $adb->num_rows($fileQuery);
                         if ($rowCount > 0) {
                             $fldvalue = decode_html($adb->query_result($fileQuery, 0, 'filename'));
                         }
                     }
                 } else {
                     $fldvalue = decode_html($this->column_fields[$fieldname]);
                 }
             } elseif ($uitype == 8) {
                 $this->column_fields[$fieldname] = rtrim($this->column_fields[$fieldname], ',');
                 $ids = explode(',', $this->column_fields[$fieldname]);
                 $json = new Zend_Json();
                 $fldvalue = $json->encode($ids);
开发者ID:gitter-badger,项目名称:openshift-salesplatform,代码行数:67,代码来源:CRMEntity.php

示例15: process


//.........这里部分代码省略.........
                 if ('create' == $request->getOperationArg()) {
                     $linkModule = $request->get('_mlinktotype');
                     $parent = $request->get('_mlinkto');
                     $focus = CRMEntity::getInstance($linkModule);
                     // This is added as ModComments module has a bug that will not initialize column_fields
                     // Basically $currentModule is set to MailManager, so the fields are not set properly.
                     if (empty($focus->column_fields)) {
                         $focus->column_fields = getColumnFields($linkModule);
                     }
                     setObjectValuesFromRequest($focus);
                     if ($request->get('assigntype') == 'U') {
                         $focus->column_fields['assigned_user_id'] = $request->get('assigned_user_id');
                     } elseif ($request->get('assigntype') == 'T') {
                         $focus->column_fields['assigned_user_id'] = $request->get('assigned_group_id');
                     }
                     $foldername = $request->get('_folder');
                     if (!empty($foldername)) {
                         // This is to handle larger uploads
                         $memory_limit = ConfigPrefs::get('MEMORY_LIMIT');
                         ini_set('memory_limit', $memory_limit);
                         $connector = $this->getConnector($foldername);
                         $mail = $connector->openMail($request->get('_msgno'));
                         $attachments = $mail->attachments();
                         // Initialize attachments
                     }
                     $linkedto = MailManager_RelationControllerAction::getSalesEntityInfo($parent);
                     switch ($linkModule) {
                         case 'Calendar':
                             if (empty($focus->column_fields['activitytype'])) {
                                 $focus->column_fields['activitytype'] = 'Task';
                             }
                             if (empty($focus->column_fields['due_date'])) {
                                 if (!empty($focus->column_fields['date_start'])) {
                                     $dateStart = getValidDBInsertDateValue($focus->column_fields['date_start']);
                                     $focus->column_fields['due_date'] = date("Y-m-d", strtotime(date("Y-m-d", strtotime($dateStart)) . " +1 day"));
                                 } else {
                                     $focus->column_fields['due_date'] = date('Y-m-d', strtotime("+1 day"));
                                 }
                             }
                             if (!empty($parent)) {
                                 if ($linkedto['module'] == 'Contacts') {
                                     $focus->column_fields['contact_id'] = $parent;
                                 } else {
                                     $focus->column_fields['parent_id'] = $parent;
                                 }
                             }
                             break;
                         case 'HelpDesk':
                             $from = $mail->from();
                             $focus->column_fields['parent_id'] = $this->setParentForHelpDesk($parent, $from);
                             break;
                         case 'ModComments':
                             $focus->column_fields['assigned_user_id'] = $current_user->id;
                             $focus->column_fields['creator'] = $current_user->id;
                             $focus->column_fields['related_to'] = $parent;
                             break;
                     }
                     try {
                         $focus->save($linkModule);
                         // This condition is added so that emails are not created for Todo without Parent,
                         // as there is no way to relate them
                         if (empty($parent) && $linkModule != 'Calendar') {
                             $linkedto = MailManager_RelationControllerAction::associate($mail, $focus->id);
                         }
                         // add attachments to the tickets as Documents
                         if (in_array($linkModule, array('HelpDesk', 'Potentials', 'Project', 'ProjectTask')) && !empty($attachments)) {
开发者ID:casati-dolibarr,项目名称:corebos,代码行数:67,代码来源:RelationController.php


注:本文中的getValidDBInsertDateValue函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。