本文整理汇总了PHP中DCL_Sanitize::ToDecimal方法的典型用法代码示例。如果您正苦于以下问题:PHP DCL_Sanitize::ToDecimal方法的具体用法?PHP DCL_Sanitize::ToDecimal怎么用?PHP DCL_Sanitize::ToDecimal使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DCL_Sanitize
的用法示例。
在下文中一共展示了DCL_Sanitize::ToDecimal方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: dbreassign
function dbreassign()
{
global $dcl_info, $g_oSec;
commonHeader();
if (($iID = @DCL_Sanitize::ToInt($_REQUEST['jcn'])) === null || ($iSeq = @DCL_Sanitize::ToInt($_REQUEST['seq'])) === null || ($iResponsible = @DCL_Sanitize::ToInt($_REQUEST['responsible'])) === null || ($fEstHours = @DCL_Sanitize::ToDecimal($_REQUEST['esthours'])) === null || ($fEtcHours = @DCL_Sanitize::ToDecimal($_REQUEST['etchours'])) === null || ($iSeverity = @DCL_Sanitize::ToInt($_REQUEST['severity'])) === null || ($iPriority = @DCL_Sanitize::ToInt($_REQUEST['priority'])) === null || ($deadlineon = @DCL_Sanitize::ToDate($_REQUEST['deadlineon'])) === null || ($eststarton = @DCL_Sanitize::ToDate($_REQUEST['eststarton'])) === null || ($estendon = @DCL_Sanitize::ToDate($_REQUEST['estendon'])) === null) {
trigger_error('Data sanitize failed.');
return;
}
if (!$g_oSec->HasPerm(DCL_ENTITY_WORKORDER, DCL_PERM_ASSIGN, $iID, $iSeq)) {
return PrintPermissionDenied();
}
$objWO =& CreateObject('dcl.dbWorkorders');
if ($objWO->Load($iID, $iSeq) == -1) {
return;
}
if ($objWO->responsible != $iResponsible || $objWO->deadlineon != $deadlineon || $objWO->eststarton != $eststarton || $objWO->estendon != $estendon || $objWO->esthours != $fEstHours || $objWO->etchours != $fEtcHours || $objWO->priority != $iPriority || $objWO->status == $dcl_info['DCL_DEF_STATUS_UNASSIGN_WO'] || $objWO->severity != $iSeverity) {
$objWO->responsible = $iResponsible;
$objWO->deadlineon = $deadlineon;
$objWO->eststarton = $eststarton;
$objWO->estendon = $estendon;
$objWO->esthours = $fEstHours;
$oStatus =& CreateObject("dcl.dbStatuses");
if ($oStatus->GetStatusType($objWO->status) != 2) {
$objWO->etchours = $fEtcHours;
if ($objWO->status == $dcl_info['DCL_DEF_STATUS_UNASSIGN_WO']) {
$objWO->status = $dcl_info['DCL_DEF_STATUS_ASSIGN_WO'];
$objWO->statuson = $objWO->GetDateSQL();
}
} else {
$objWO->etchours = 0.0;
}
$objWO->priority = $iPriority;
$objWO->severity = $iSeverity;
$objWO->Edit();
$objWtch =& CreateObject('dcl.boWatches');
$objWtch->sendNotification($objWO, '4');
}
$objHTMLWO =& CreateObject('dcl.htmlWorkOrderDetail');
$objHTMLWO->Show($iID, $iSeq);
}
示例2: Add
function Add($targeted_version_id = 0, $fixed_version_id = 0)
{
global $dcl_info, $g_oSec;
if (($fEtcHours = DCL_Sanitize::ToDecimal($_REQUEST['etchours'])) === null) {
trigger_error('Data sanitize failed.');
return;
}
$objWO = CreateObject('dcl.dbWorkorders');
if ($objWO->Load($this->jcn, $this->seq) == -1) {
trigger_error(printf(STR_DB_WORKORDERLOADERR, $this->jcn, $this->seq));
return;
}
$currstatus = $objWO->status;
$justStarted = $objWO->IsFieldNull('starton');
$idSQL = $this->GetNewIDSQLForTable('timecards');
$query = 'INSERT INTO timecards (';
if ($idSQL != '') {
$query .= 'id,';
}
$query .= 'jcn, seq, actionon, inputon, actionby, status, action, hours, summary, description, is_public, reassign_from_id, reassign_to_id';
$query .= ') VALUES (';
if ($idSQL != '') {
$query .= $idSQL . ',';
}
$query .= $this->jcn . ',' . $this->seq . ',';
$query .= $this->DisplayToSQL($this->actionon) . ',';
$query .= $this->GetDateSQL() . ',' . $this->actionby . ',';
$query .= $this->status . ',' . $this->action . ',' . $this->hours;
$query .= ',' . $this->Quote($this->summary);
$query .= ',' . $this->Quote($this->description);
$query .= ',' . $this->Quote($this->is_public);
// Reassign if selected and able
if ($this->reassign_to_id > 0 && $g_oSec->HasPerm(DCL_ENTITY_WORKORDER, DCL_PERM_ASSIGN) && $objWO->responsible != $this->reassign_to_id) {
$query .= ',' . $objWO->responsible;
$query .= ',' . $this->reassign_to_id;
$objWO->responsible = $this->reassign_to_id;
} else {
$query .= ', NULL, NULL';
}
$query .= ')';
$objWO->lastactionon = date($dcl_info['DCL_TIMESTAMP_FORMAT']);
$objWO->totalhours = $objWO->totalhours + $this->hours;
$objWO->etchours = $_REQUEST['etchours'];
if ($currstatus != $this->status) {
$objWO->status = $this->status;
$objWO->statuson = date($dcl_info['DCL_TIMESTAMP_FORMAT']);
$oStatus = CreateObject('dcl.dbStatuses');
if ($oStatus->GetStatusType($this->status) == 2 && $oStatus->GetStatusType($currstatus) != 2) {
$objWO->closedby = $this->actionby;
$objWO->closedon = $this->actionon;
} else {
if ($oStatus->GetStatusType($currstatus) == 2) {
$objWO->closedby = 0;
$objWO->closedon = '';
}
}
}
// Check for version updates
if ((int) $targeted_version_id > 0) {
$objWO->targeted_version_id = $targeted_version_id;
}
if ((int) $fixed_version_id > 0) {
$objWO->fixed_version_id = $fixed_version_id;
}
// ensure the etc hours do not get anything but zero when closed
$oStatus = CreateObject('dcl.dbStatuses');
if ($oStatus->GetStatusType($objWO->status) == 2) {
$objWO->etchours = 0.0;
}
if ($justStarted == 1) {
$objWO->starton = $this->actionon;
}
$this->BeginTransaction();
$this->Insert($query);
$objWO->Edit();
$this->EndTransaction();
}
示例3: FieldValueToSQL
/**
* Helper function to properly represent data for SQL statements
* @param string the field this value represents
* @param string the value of this field
* @return mixed NULL if the value is NULL or empty, otherwise proper SQL formatted value
*/
function FieldValueToSQL($sField, $sValue)
{
$aField =& $GLOBALS['phpgw_baseline'][$this->TableName]['fd'][$sField];
if (is_null($sValue) || trim($sValue) === '') {
if ($aField['type'] == 'timestamp') {
return $this->emptyTimestamp;
}
return 'NULL';
}
switch ($aField['type']) {
case 'varchar':
case 'char':
case 'text':
return $this->Quote($sValue);
case 'date':
case 'datetime':
case 'timestamp':
if ($sValue == DCL_NOW) {
return $this->GetDateSQL();
}
return $this->DisplayToSQL($sValue);
case 'int':
case 'auto':
return DCL_Sanitize::ToInt($sValue);
case 'float':
return DCL_Sanitize::ToDecimal($sValue);
default:
return $sValue;
}
}