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


PHP CurrencyField::convertToDBFormat方法代码示例

本文整理汇总了PHP中CurrencyField::convertToDBFormat方法的典型用法代码示例。如果您正苦于以下问题:PHP CurrencyField::convertToDBFormat方法的具体用法?PHP CurrencyField::convertToDBFormat怎么用?PHP CurrencyField::convertToDBFormat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CurrencyField的用法示例。


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

示例1: addListPrice

 /**
  * Function adds Products/Services-PriceBooks Relation
  * @param type $request
  */
 function addListPrice($request)
 {
     $sourceModule = $request->getModule();
     $sourceRecordId = $request->get('src_record');
     $relatedModule = $request->get('related_module');
     $relInfos = $request->get('relinfo');
     $sourceModuleModel = Vtiger_Module_Model::getInstance($sourceModule);
     $relatedModuleModel = Vtiger_Module_Model::getInstance($relatedModule);
     $relationModel = Vtiger_Relation_Model::getInstance($sourceModuleModel, $relatedModuleModel);
     foreach ($relInfos as $relInfo) {
         $price = CurrencyField::convertToDBFormat($relInfo['price'], null, true);
         $relationModel->addListPrice($sourceRecordId, $relInfo['id'], $price);
     }
 }
开发者ID:Bergdahls,项目名称:YetiForceCRM,代码行数:18,代码来源:RelationAjax.php

示例2: save


//.........这里部分代码省略.........
            //User Specific filterId
            if (empty($defaultViewId)) {
                $userDefaultModuleFilter = $db->pquery('SELECT default_cvid FROM vtiger_user_module_preferences WHERE
											userid = ? AND tabid = ?', array($currentUserModel->id, $moduleModel->getId()));
                $defaultViewId = $db->query_result($userDefaultModuleFilter, 0, 'default_cvid');
            }
            //First filterid of module
            if (empty($defaultViewId)) {
                $firstDefaultFilter = $db->pquery('SELECT cvid FROM vtiger_customview WHERE entitytype = ?', array($moduleName));
                $defaultViewId = $db->query_result($firstDefaultFilter, 0, 'cvid');
            }
            // Get the defaults filters columnlist
            $columnSql = "INSERT INTO vtiger_cvcolumnlist (cvid, columnindex, columnname)\n\t\t\t\t\t\t\tSELECT ?, columnindex, columnname FROM vtiger_cvcolumnlist WHERE cvid = ?";
            $db->pquery($columnSql, array($cvId, $defaultViewId));
        }
        $stdFilterList = $this->get('stdfilterlist');
        if (!empty($stdFilterList) && !empty($stdFilterList['columnname'])) {
            $stdFilterSql = 'INSERT INTO vtiger_cvstdfilter(cvid,columnname,stdfilter,startdate,enddate) VALUES (?,?,?,?,?)';
            $stdFilterParams = array($cvId, $stdFilterList['columnname'], $stdFilterList['stdfilter'], $db->formatDate($stdFilterList['startdate'], true), $db->formatDate($stdFilterList['enddate'], true));
            $db->pquery($stdFilterSql, $stdFilterParams);
        }
        $advFilterList = $this->get('advfilterlist');
        if (!empty($advFilterList)) {
            foreach ($advFilterList as $groupIndex => $groupInfo) {
                if (empty($groupInfo)) {
                    continue;
                }
                $groupColumns = $groupInfo['columns'];
                $groupCondition = $groupInfo['condition'];
                foreach ($groupColumns as $columnIndex => $columnCondition) {
                    if (empty($columnCondition)) {
                        continue;
                    }
                    $advFilterColumn = $columnCondition['columnname'];
                    $advFilterComparator = $columnCondition['comparator'];
                    $advFitlerValue = $columnCondition['value'];
                    $advFilterColumnCondition = $columnCondition['column_condition'];
                    $columnInfo = explode(":", $advFilterColumn);
                    $fieldName = $columnInfo[2];
                    $fieldModel = $moduleModel->getField($fieldName);
                    //Required if Events module fields are selected for the condition
                    if (!$fieldModel) {
                        $modulename = $moduleModel->get('name');
                        if ($modulename == 'Calendar') {
                            $eventModuleModel = Vtiger_Module_model::getInstance('Events');
                            $fieldModel = $eventModuleModel->getField($fieldName);
                        }
                    }
                    $fieldType = $fieldModel->getFieldDataType();
                    if ($fieldType == 'currency') {
                        if ($fieldModel->get('uitype') == '72') {
                            // Some of the currency fields like Unit Price, Totoal , Sub-total - doesn't need currency conversion during save
                            $advFitlerValue = CurrencyField::convertToDBFormat($advFitlerValue, null, true);
                        } else {
                            $advFitlerValue = CurrencyField::convertToDBFormat($advFitlerValue);
                        }
                    }
                    $temp_val = explode(",", $advFitlerValue);
                    if (($fieldType == 'date' || $fieldType == 'time' && $fieldName != 'time_start' && $fieldName != 'time_end' || $fieldType == 'datetime') && ($fieldType != '' && $advFitlerValue != '')) {
                        $val = array();
                        for ($x = 0; $x < count($temp_val); $x++) {
                            //if date and time given then we have to convert the date and
                            //leave the time as it is, if date only given then temp_time
                            //value will be empty
                            if (trim($temp_val[$x]) != '') {
                                $date = new DateTimeField(trim($temp_val[$x]));
                                if ($fieldType == 'date') {
                                    $val[$x] = DateTimeField::convertToDBFormat(trim($temp_val[$x]));
                                } elseif ($fieldType == 'datetime') {
                                    $val[$x] = $date->getDBInsertDateTimeValue();
                                } else {
                                    $val[$x] = $date->getDBInsertTimeValue();
                                }
                            }
                        }
                        $advFitlerValue = implode(",", $val);
                    }
                    $advCriteriaSql = 'INSERT INTO vtiger_cvadvfilter(cvid,columnindex,columnname,comparator,value,groupid,column_condition)
											values (?,?,?,?,?,?,?)';
                    $advCriteriaParams = array($cvId, $columnIndex, $advFilterColumn, $advFilterComparator, $advFitlerValue, $groupIndex, $advFilterColumnCondition);
                    $db->pquery($advCriteriaSql, $advCriteriaParams);
                    // Update the condition expression for the group to which the condition column belongs
                    $groupConditionExpression = '';
                    if (!empty($advFilterList[$groupIndex]["conditionexpression"])) {
                        $groupConditionExpression = $advFilterList[$groupIndex]["conditionexpression"];
                    }
                    $groupConditionExpression = $groupConditionExpression . ' ' . $columnIndex . ' ' . $advFilterColumnCondition;
                    $advFilterList[$groupIndex]["conditionexpression"] = $groupConditionExpression;
                }
                $groupConditionExpression = $advFilterList[$groupIndex]["conditionexpression"];
                if (empty($groupConditionExpression)) {
                    continue;
                }
                // Case when the group doesn't have any column criteria
                $advGroupSql = 'INSERT INTO vtiger_cvadvfilter_grouping(groupid,cvid,group_condition,condition_expression) VALUES (?,?,?,?)';
                $advGroupParams = array($groupIndex, $cvId, $groupCondition, $groupConditionExpression);
                $db->pquery($advGroupSql, $advGroupParams);
            }
        }
    }
开发者ID:JeRRimix,项目名称:YetiForceCRM,代码行数:101,代码来源:Record.php

示例3: addUserSearchConditions


//.........这里部分代码省略.........
                     $this->addCondition($name, $filter['value'], $filter['comparator']);
                     $columncondition = $filter['column_condition'];
                     if (!empty($columncondition)) {
                         $this->addConditionGlue($columncondition);
                     }
                 }
                 $this->endGroup();
                 $groupConditionGlue = $groupcolumns['condition'];
                 if (!empty($groupConditionGlue)) {
                     $this->addConditionGlue($groupConditionGlue);
                 }
             }
         }
         $this->endGroup();
     } elseif ($input['type'] == 'dbrd') {
         if ($this->conditionInstanceCount > 0) {
             $this->startGroup(self::$AND);
         } else {
             $this->startGroup('');
         }
         $allConditionsList = $this->getDashBoardConditionList();
         $conditionList = $allConditionsList['conditions'];
         $relatedConditionList = $allConditionsList['relatedConditions'];
         $noOfConditions = count($conditionList);
         $noOfRelatedConditions = count($relatedConditionList);
         foreach ($conditionList as $index => $conditionInfo) {
             $this->addCondition($conditionInfo['fieldname'], $conditionInfo['value'], $conditionInfo['operator']);
             if ($index < $noOfConditions - 1 || $noOfRelatedConditions > 0) {
                 $this->addConditionGlue(self::$AND);
             }
         }
         foreach ($relatedConditionList as $index => $conditionInfo) {
             $this->addRelatedModuleCondition($conditionInfo['relatedModule'], $conditionInfo['conditionModule'], $conditionInfo['finalValue'], $conditionInfo['SQLOperator']);
             if ($index < $noOfRelatedConditions - 1) {
                 $this->addConditionGlue(self::$AND);
             }
         }
         $this->endGroup();
     } else {
         if (isset($input['search_field']) && $input['search_field'] != "") {
             $fieldName = vtlib_purify($input['search_field']);
         } else {
             return;
         }
         if ($this->conditionInstanceCount > 0) {
             $this->startGroup(self::$AND);
         } else {
             $this->startGroup('');
         }
         $moduleFields = $this->getModuleFields();
         $field = $moduleFields[$fieldName];
         $type = $field->getFieldDataType();
         if (isset($input['search_text']) && $input['search_text'] != "") {
             // search other characters like "|, ?, ?" by jagi
             $value = $input['search_text'];
             $stringConvert = function_exists(iconv) ? @iconv("UTF-8", $default_charset, $value) : $value;
             if (!$this->isStringType($type)) {
                 $value = trim($stringConvert);
             }
             if ($type == 'picklist') {
                 global $mod_strings;
                 // Get all the keys for the for the Picklist value
                 $mod_keys = array_keys($mod_strings, $value);
                 if (sizeof($mod_keys) >= 1) {
                     // Iterate on the keys, to get the first key which doesn't start with LBL_      (assuming it is not used in PickList)
                     foreach ($mod_keys as $mod_idx => $mod_key) {
                         $stridx = strpos($mod_key, 'LBL_');
                         // Use strict type comparision, refer strpos for more details
                         if ($stridx !== 0) {
                             $value = $mod_key;
                             break;
                         }
                     }
                 }
             }
             if ($type == 'currency') {
                 // Some of the currency fields like Unit Price, Total, Sub-total etc of Inventory modules, do not need currency conversion
                 if ($field->getUIType() == '72') {
                     $value = CurrencyField::convertToDBFormat($value, null, true);
                 } else {
                     $currencyField = new CurrencyField($value);
                     $value = $currencyField->getDBInsertedValue();
                 }
             }
         }
         if (!empty($input['operator'])) {
             $operator = $input['operator'];
         } elseif (trim(strtolower($value)) == 'null') {
             $operator = 'e';
         } else {
             if (!$this->isNumericType($type) && !$this->isDateType($type)) {
                 $operator = 'c';
             } else {
                 $operator = 'h';
             }
         }
         $this->addCondition($fieldName, $value, $operator);
         $this->endGroup();
     }
 }
开发者ID:artisan4710,项目名称:YetiForceCRM,代码行数:101,代码来源:QueryGenerator.php

示例4: explode

         $value = explode("=", $fieldvalue);
         $field_name_val = $value[0];
         $field_value = urldecode($value[1]);
         $finfo = VTCacheUtils::lookupFieldInfo($tabid, $field_name_val);
         if ($finfo !== false) {
             switch ($finfo['uitype']) {
                 case '56':
                     $field_value = $field_value == 'on' ? '1' : '0';
                     break;
                 case '7':
                 case '9':
                 case '72':
                     $field_value = CurrencyField::convertToDBFormat($field_value, null, true);
                     break;
                 case '71':
                     $field_value = CurrencyField::convertToDBFormat($field_value);
                     break;
                 case '33':
                 case '3313':
                     if (is_array($field_value)) {
                         $field_value = implode(' |##| ', $field_value);
                     }
                     break;
             }
         }
         $focus->column_fields[$field_name_val] = $field_value;
     }
 }
 $errormessageclass = isset($_REQUEST['error_msgclass']) ? vtlib_purify($_REQUEST['error_msgclass']) : '';
 $errormessage = isset($_REQUEST['error_msg']) ? vtlib_purify($_REQUEST['error_msg']) : '';
 $smarty->assign('ERROR_MESSAGE_CLASS', $errormessageclass);
开发者ID:kikojover,项目名称:corebos,代码行数:31,代码来源:EditView.php

示例5: getValueForSave

 /**
  * Get the value to save
  * @param Vtiger_Request $request
  * @param string $field Field name
  * @param int $i Sequence number
  * @return string
  */
 public function getValueForSave($request, $field, $i)
 {
     $value = '';
     if ($request->has($field . $i)) {
         $value = $request->get($field . $i);
     } else {
         if ($request->has($field)) {
             $value = $request->get($field);
         }
     }
     if (in_array($field, $this->jsonFields) && $value != '') {
         $value = json_encode($value);
     }
     if (in_array($field, ['price', 'gross', 'net', 'discount', 'purchase', 'margin', 'marginp', 'tax', 'total'])) {
         $value = CurrencyField::convertToDBFormat($value, null, true);
     }
     return $value;
 }
开发者ID:reeid,项目名称:YetiForceCRM,代码行数:25,代码来源:InventoryField.php

示例6: vtlib_purify

<?php

/*+********************************************************************************
 * The contents of this file are subject to the vtiger CRM Public License Version 1.0
 * ("License"); You may not use this file except in compliance with the License
 * The Original Code is:  vtiger CRM Open Source
 * The Initial Developer of the Original Code is vtiger.
 * Portions created by vtiger are Copyright (C) vtiger.
 * All Rights Reserved.
 *********************************************************************************/
global $adb, $log;
$record = vtlib_purify($_REQUEST['record']);
$pricebook_id = vtlib_purify($_REQUEST['pricebook_id']);
$product_id = vtlib_purify($_REQUEST['product_id']);
$listprice = vtlib_purify($_REQUEST['list_price']);
$return_action = vtlib_purify($_REQUEST['return_action']);
$return_module = vtlib_purify($_REQUEST['return_module']);
$log->debug("Update ListPrice in (modules/Products/UpdateListPrice.php): {$pricebook_id} {$product_id} {$listprice}");
$query = 'update vtiger_pricebookproductrel set listprice=? where pricebookid=? and productid=?';
$listprice = CurrencyField::convertToDBFormat($listprice, null, true);
$adb->pquery($query, array($listprice, $pricebook_id, $product_id));
header("Location: index.php?module={$return_module}&action=" . $return_module . "Ajax&file={$return_action}&ajax=true&record={$record}");
开发者ID:kduqi,项目名称:corebos,代码行数:22,代码来源:UpdateListPrice.php

示例7: 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

示例8: insertIntoEntityTable


//.........这里部分代码省略.........
                 }
             } 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);
             } elseif ($uitype == 12) {
                 // Bulk Sae Mode: Consider the FROM email address as specified, if not lookup
                 $fldvalue = $this->column_fields[$fieldname];
                 if (empty($fldvalue)) {
                     $query = "SELECT email1 FROM vtiger_users WHERE id = ?";
                     $res = $adb->pquery($query, array($current_user->id));
                     $rows = $adb->num_rows($res);
                     if ($rows > 0) {
                         $fldvalue = $adb->query_result($res, 0, 'email1');
                     }
                 }
                 // END
             } elseif ($uitype == 72 && !$ajaxSave) {
                 // Some of the currency fields like Unit Price, Totoal , Sub-total - doesn't need currency conversion during save
                 $fldvalue = CurrencyField::convertToDBFormat($this->column_fields[$fieldname], null, true);
             } elseif ($uitype == 71 && !$ajaxSave) {
                 $fldvalue = CurrencyField::convertToDBFormat($this->column_fields[$fieldname]);
             } else {
                 $fldvalue = $this->column_fields[$fieldname];
             }
             if ($uitype != 33 && $uitype != 8) {
                 $fldvalue = from_html($fldvalue, $insertion_mode == 'edit' ? true : false);
             }
         } else {
             $fldvalue = '';
         }
         if ($fldvalue == '') {
             $fldvalue = $this->get_column_value($columname, $fldvalue, $fieldname, $uitype, $datatype);
         }
         if ($insertion_mode == 'edit') {
             if ($table_name != 'vtiger_ticketcomments' && $uitype != 4) {
                 array_push($update, $columname . "=?");
                 array_push($update_params, $fldvalue);
             }
         } else {
             array_push($column, $columname);
             array_push($value, $fldvalue);
         }
     }
     if ($insertion_mode == 'edit') {
         if ($module == 'Potentials') {
             $dbquery = 'select sales_stage from vtiger_potential where potentialid = ?';
             $sales_stage = $adb->query_result($adb->pquery($dbquery, array($this->id)), 0, 'sales_stage');
             if ($sales_stage != $_REQUEST['sales_stage'] && $_REQUEST['sales_stage'] != '') {
                 $date_var = date("Y-m-d H:i:s");
                 $closingDateField = new DateTimeField($this->column_fields['closingdate']);
                 $closingdate = $_REQUEST['ajxaction'] == 'DETAILVIEW' ? $this->column_fields['closingdate'] : $closingDateField->getDBInsertDateValue();
开发者ID:gitter-badger,项目名称:openshift-salesplatform,代码行数:67,代码来源:CRMEntity.php

示例9: transferListSearchParamsToFilterCondition

    public static function transferListSearchParamsToFilterCondition($listSearchParams, $moduleModel) {
        if(empty($listSearchParams)) {
            $listSearchParams = array();
        }
        $advFilterConditionFormat = array();
        $glueOrder = array('and','or');
        $groupIterator = 0;
        foreach($listSearchParams as $groupInfo){
            if(empty($groupInfo)){
                continue;
            }
            $groupConditionInfo = array();
            $groupColumnsInfo = array();
            $groupConditionGlue = $glueOrder[$groupIterator];
            foreach($groupInfo as $fieldSearchInfo){
                   $advFilterFieldInfoFormat = array();
                   $fieldName = $fieldSearchInfo[0];
                   $operator = $fieldSearchInfo[1];
                   $fieldValue = $fieldSearchInfo[2];
                   $fieldInfo = $moduleModel->getField($fieldName);

                   //Request will be having in terms of AM and PM but the database will be having in 24 hr format so converting
 		            //Database format

                    if($fieldInfo->getFieldDataType() == "time") {
 		                $fieldValue = Vtiger_Time_UIType::getTimeValueWithSeconds($fieldValue);
 		            }
                  
                     if($fieldName == 'amount' && $fieldInfo->getFieldDataType() == 'currency'){
                        $fieldValue = CurrencyField::convertToDBFormat($fieldValue);
                    }
                    
                    if($fieldName == 'date_start' || $fieldName == 'due_date' || $fieldInfo->getFieldDataType() == "datetime" ) {
	 	                $dateValues = explode(',', $fieldValue);
	 	                //Indicate whether it is fist date in the between condition
     	                $isFirstDate = true;
	 	                foreach($dateValues as $key => $dateValue) {
	 	                    $dateTimeCompoenents = explode(' ', $dateValue);
	 	                    if(empty($dateTimeCompoenents[1])) {
	 	                        if($isFirstDate)
	 	                            $dateTimeCompoenents[1] = '00:00:00';
	 	                        else
	 	                            $dateTimeCompoenents[1] = '23:59:59';

	 	                    }
	 	                    $dateValue = implode(' ',$dateTimeCompoenents);
	 	                    $dateValues[$key] = $dateValue;
	 	                    $isFirstDate = false;
                        }
                        $fieldValue = implode(',',$dateValues);
                    }

                   $advFilterFieldInfoFormat['columnname'] = $fieldInfo->getCustomViewColumnName();
                   $advFilterFieldInfoFormat['comparator'] = $operator;
                   $advFilterFieldInfoFormat['value'] = $fieldValue;
                   $advFilterFieldInfoFormat['column_condition'] = $groupConditionGlue;
                   $groupColumnsInfo[] = $advFilterFieldInfoFormat;
            }
            $noOfConditions = count($groupColumnsInfo);
            //to remove the last column condition
            $groupColumnsInfo[$noOfConditions-1]['column_condition']  = '';
            $groupConditionInfo['columns'] = $groupColumnsInfo;
            $groupConditionInfo['condition'] = 'and';
            $advFilterConditionFormat[] = $groupConditionInfo;
            $groupIterator++;
        }
        //We aer removing last condition since this condition if there is next group and this is the last group
        unset($advFilterConditionFormat[count($advFilterConditionFormat)-1]['condition']);
        return $advFilterConditionFormat;

    }
开发者ID:jeremyevans6,项目名称:kulturedTiger-,代码行数:71,代码来源:Util.php

示例10: explode

 }
 $adv_filter_column = $column_condition["columnname"];
 $adv_filter_comparator = $column_condition["comparator"];
 $adv_filter_value = $column_condition["value"];
 $adv_filter_column_condition = $column_condition["columncondition"];
 $adv_filter_groupid = $column_condition["groupid"];
 $column_info = explode(":", $adv_filter_column);
 $fieldName = $column_info[2];
 $fieldObj = $moduleFields[$fieldName];
 $fieldType = $fieldObj->getFieldDataType();
 if ($fieldType == 'currency') {
     // Some of the currency fields like Unit Price, Total, Sub-total etc of Inventory modules, do not need currency conversion
     if ($fieldObj->getUIType() == '72') {
         $adv_filter_value = CurrencyField::convertToDBFormat($adv_filter_value, null, true);
     } else {
         $adv_filter_value = CurrencyField::convertToDBFormat($adv_filter_value);
     }
 }
 $temp_val = explode(",", $adv_filter_value);
 if (($fieldType == 'date' || $fieldType == 'time' && $fieldName != 'time_start' && $fieldName != 'time_end' || $fieldType == 'datetime') && ($fieldType != '' && $adv_filter_value != '')) {
     $val = array();
     for ($x = 0; $x < count($temp_val); $x++) {
         //if date and time given then we have to convert the date and
         //leave the time as it is, if date only given then temp_time
         //value will be empty
         if (trim($temp_val[$x]) != '') {
             $date = new DateTimeField(trim($temp_val[$x]));
             if ($fieldType == 'date') {
                 $val[$x] = DateTimeField::convertToUserFormat(trim($temp_val[$x]));
             } elseif ($fieldType == 'datetime') {
                 $val[$x] = $date->getDBInsertDateTimeValue();
开发者ID:hbsman,项目名称:vtigercrm-5.3.0-ja,代码行数:31,代码来源:Save.php

示例11: foreach

    foreach ($storearray as $id) {
        if ($id != '') {
            $lp_name = $id . '_listprice';
            $list_price = CurrencyField::convertToDBFormat($_REQUEST[$lp_name], null, false);
            //Updating the vtiger_pricebook product rel vtiger_table
            $log->info("Products :: Inserting vtiger_products to price book");
            $query = "insert into vtiger_pricebookproductrel (pricebookid,productid,listprice,usedcurrency) values(?,?,?,?)";
            $adb->pquery($query, array($pricebook_id, $id, $list_price, $currency_id));
        }
    }
    if ($singlepane_view == 'true') {
        header("Location: index.php?module=PriceBooks&action=DetailView&record={$pricebook_id}&parenttab={$parenttab}");
    } else {
        header("Location: index.php?module=PriceBooks&action=CallRelatedList&record={$pricebook_id}&parenttab={$parenttab}");
    }
} elseif (isset($_REQUEST['product_id']) && $_REQUEST['product_id'] != '') {
    //split the string and store in an array
    $storearray = explode(";", $idlist);
    foreach ($storearray as $id) {
        if ($id != '') {
            $currency_id = getPriceBookCurrency($id);
            $lp_name = $id . '_listprice';
            $list_price = CurrencyField::convertToDBFormat($_REQUEST[$lp_name], null, false);
            //Updating the vtiger_pricebook product rel vtiger_table
            $log->info("Products :: Inserting PriceBooks to Product");
            $query = "insert into vtiger_pricebookproductrel (pricebookid,productid,listprice,usedcurrency) values(?,?,?,?)";
            $adb->pquery($query, array($id, $productid, $list_price, $currency_id));
        }
    }
    header("Location: index.php?module={$returnmodule}&action={$returnaction}&record={$productid}&parenttab={$parenttab}");
}
开发者ID:casati-dolibarr,项目名称:corebos,代码行数:31,代码来源:addPbProductRelToDB.php

示例12: convertToDBFormat

 /**
  * Function converts User currency format to database format
  * @param <Object> $value - Currency value
  * @param <User Object> $user
  * @param <Boolean> $skipConversion
  */
 public static function convertToDBFormat($value, $user = null, $skipConversion = false)
 {
     return CurrencyField::convertToDBFormat($value, $user, $skipConversion);
 }
开发者ID:rcrrich,项目名称:UpdatePackages,代码行数:10,代码来源:Currency.php

示例13: convertToDBFormat

 /**
  * Function converts User currency format to database format
  * @param <Object> $value - Currency value
  * @param <User Object> $user
  * @param <Boolean> $skipConversion
  */
 public static function convertToDBFormat($value, $user = null, $skipConversion = false)
 {
     global $log;
     $log->debug("Entering ./uitypes/Currency.php::staticconvertToDBFormat");
     return CurrencyField::convertToDBFormat($value, $user, $skipConversion);
 }
开发者ID:cin-system,项目名称:cinrepo,代码行数:12,代码来源:Currency.php

示例14: RunTimeAdvFilter

 /** Function to get the RunTime Advanced filter conditions
  *  @ param $advft_criteria : Type Array
  *  @ param $advft_criteria_groups : Type Array
  *  This function returns  $advfiltersql
  *
  */
 function RunTimeAdvFilter($advft_criteria, $advft_criteria_groups)
 {
     $adb = PearDatabase::getInstance();
     $advfilterlist = array();
     $advfiltersql = '';
     if (!empty($advft_criteria)) {
         foreach ($advft_criteria as $column_index => $column_condition) {
             if (empty($column_condition)) {
                 continue;
             }
             $adv_filter_column = $column_condition["columnname"];
             $adv_filter_comparator = $column_condition["comparator"];
             $adv_filter_value = $column_condition["value"];
             $adv_filter_column_condition = $column_condition["columncondition"];
             $adv_filter_groupid = $column_condition["groupid"];
             $column_info = explode(":", $adv_filter_column);
             $moduleFieldLabel = $column_info[2];
             $fieldName = $column_info[3];
             list($module, $fieldLabel) = explode('__', $moduleFieldLabel, 2);
             $fieldInfo = getFieldByReportLabel($module, $fieldLabel);
             $fieldType = null;
             if (!empty($fieldInfo)) {
                 $field = WebserviceField::fromArray($adb, $fieldInfo);
                 $fieldType = $field->getFieldDataType();
             }
             if ($fieldType == 'currency') {
                 // Some of the currency fields like Unit Price, Total, Sub-total etc of Inventory modules, do not need currency conversion
                 if ($field->getUIType() == '72') {
                     $adv_filter_value = CurrencyField::convertToDBFormat($adv_filter_value, null, true);
                 } else {
                     $adv_filter_value = CurrencyField::convertToDBFormat($adv_filter_value);
                 }
             }
             $temp_val = explode(",", $adv_filter_value);
             if (($column_info[4] == 'D' || $column_info[4] == 'T' && $column_info[1] != 'time_start' && $column_info[1] != 'time_end' || $column_info[4] == 'DT') && ($column_info[4] != '' && $adv_filter_value != '')) {
                 $val = array();
                 for ($x = 0; $x < count($temp_val); $x++) {
                     if ($column_info[4] == 'D') {
                         $date = new DateTimeField(trim($temp_val[$x]));
                         $val[$x] = $date->getDBInsertDateValue();
                     } elseif ($column_info[4] == 'DT') {
                         $date = new DateTimeField(trim($temp_val[$x]));
                         $val[$x] = $date->getDBInsertDateTimeValue();
                     } else {
                         $date = new DateTimeField(trim($temp_val[$x]));
                         $val[$x] = $date->getDBInsertTimeValue();
                     }
                 }
                 $adv_filter_value = implode(",", $val);
             }
             $criteria = array();
             $criteria['columnname'] = $adv_filter_column;
             $criteria['comparator'] = $adv_filter_comparator;
             $criteria['value'] = $adv_filter_value;
             $criteria['column_condition'] = $adv_filter_column_condition;
             $advfilterlist[$adv_filter_groupid]['columns'][] = $criteria;
         }
         foreach ($advft_criteria_groups as $group_index => $group_condition_info) {
             if (empty($group_condition_info)) {
                 continue;
             }
             if (empty($advfilterlist[$group_index])) {
                 continue;
             }
             $advfilterlist[$group_index]['condition'] = $group_condition_info["groupcondition"];
             $noOfGroupColumns = count($advfilterlist[$group_index]['columns']);
             if (!empty($advfilterlist[$group_index]['columns'][$noOfGroupColumns - 1]['column_condition'])) {
                 $advfilterlist[$group_index]['columns'][$noOfGroupColumns - 1]['column_condition'] = '';
             }
         }
         $noOfGroups = count($advfilterlist);
         if (!empty($advfilterlist[$noOfGroups]['condition'])) {
             $advfilterlist[$noOfGroups]['condition'] = '';
         }
         $advfiltersql = $this->generateAdvFilterSql($advfilterlist);
     }
     return $advfiltersql;
 }
开发者ID:rcrrich,项目名称:UpdatePackages,代码行数:84,代码来源:ReportRun.php

示例15: insertIntoEntityTable


//.........这里部分代码省略.........
                 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);
             } elseif ($uitype == 12) {
                 // Bulk Sae Mode: Consider the FROM email address as specified, if not lookup
                 $fldvalue = $this->column_fields[$fieldname];
                 if (empty($fldvalue)) {
                     $query = "SELECT email1 FROM vtiger_users WHERE id = ?";
                     $res = $adb->pquery($query, array($current_user->id));
                     $rows = $adb->num_rows($res);
                     if ($rows > 0) {
                         $fldvalue = $adb->query_result($res, 0, 'email1');
                     }
                 }
                 // END
             } elseif ($uitype == 72 && !$ajaxSave) {
                 // Some of the currency fields like Unit Price, Totoal , Sub-total - doesn't need currency conversion during save
                 $fldvalue = CurrencyField::convertToDBFormat($this->column_fields[$fieldname], null, true);
             } elseif ($uitype == 71 && !$ajaxSave) {
                 $fldvalue = CurrencyField::convertToDBFormat($this->column_fields[$fieldname]);
             } else {
                 $fldvalue = $this->column_fields[$fieldname];
             }
             if ($uitype != 33 && $uitype != 8) {
                 $fldvalue = from_html($fldvalue, $insertion_mode == 'edit' ? true : false);
             }
         } else {
             $fldvalue = '';
         }
         if ($fldvalue == '') {
             $fldvalue = $this->get_column_value($columname, $fldvalue, $fieldname, $uitype, $datatype);
         }
         // key-value 配列にキーと値の組を登録する
         $value_table[$columname] = $fldvalue;
         // tao
         if ($insertion_mode == 'edit') {
             if ($table_name != 'vtiger_ticketcomments' && $uitype != 4) {
                 array_push($update, $columname . "=?");
                 array_push($update_params, $fldvalue);
             }
         } else {
             array_push($column, $columname);
             array_push($value, $fldvalue);
         }
     }
     if ($insertion_mode == 'edit') {
         // ADDED by tao on 15/12/04 -- begin
         if ($table_name == 'vtiger_payment_management') {
             // 顧客名が指定されていない場合は、カナ名から顧客名を類推する。 */
             $value_table = $this->insertClientName($value_table);
             $update_params = PaymentManagement::generateValues($value_table);
             if ($value_table['accountname'] != '') {
                 $sql = 'update vtiger_crmentityrel set crmid=? where relcrmid=?';
                 $param = array($value_table['accountname'], $this->id);
                 $adb->pquery($sql, $param);
             }
         }
         // ADDED by tao on 15/12/04 -- end
         //Check done by Don. If update is empty the the query fails
         if (count($update) > 0) {
             $sql1 = "update {$table_name} set " . implode(",", $update) . " where " . $this->tab_name_index[$table_name] . "=?";
             array_push($update_params, $this->id);
             $adb->pquery($sql1, $update_params, true);
         }
     } else {
         // Added by 田尾 (tao) on 15/11/25 -- begin
         if ($module == 'PaymentManagement' && $table_name == 'vtiger_payment_management') {
             $value_table = $this->insertClientName($value_table);
             if ($value_table['accountname'] != '') {
                 $this->save_related_module('Account', $value_table['accountname'], 'PaymentManagement', $value_table['payment_management_id']);
             }
         }
         $value = PaymentManagement::generateValues($value_table);
         // Added by 田尾 (tao) on 15/11/25 -- end
         $sql1 = "insert into {$table_name}(" . implode(",", $column) . ") values(" . generateQuestionMarks($value) . ")";
         $adb->pquery($sql1, $value);
     }
     $log->debug("Exting PaymentManagement::insertIntoEntityTable(" . $table_name . ", " . $module . ", " . $fileid . ") method ...");
 }
开发者ID:cin-system,项目名称:cinrepo,代码行数:101,代码来源:PaymentManagement.php


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