Replace doubleval into floatval

This commit is contained in:
Laurent Destailleur 2021-05-20 09:22:55 +02:00
parent 03c81acb42
commit dbd7292cd6
6 changed files with 24 additions and 24 deletions

View File

@ -3556,7 +3556,7 @@ if ($action == 'create') {
if($( this ).prop("checked") && $.inArray($( this ).val(), '.json_encode($retainedWarrantyInvoiceAvailableType).' ) !== -1)
{
$(".retained-warranty-line").show();
$("#new-situation-invoice-retained-warranty").val("'.doubleval($retained_warranty_js_default).'");
$("#new-situation-invoice-retained-warranty").val("'.floatval($retained_warranty_js_default).'");
}
else{
$(".retained-warranty-line").hide();

View File

@ -437,7 +437,7 @@ class CUnits // extends CommonObject
*/
public function unitConverter($value, $fk_unit, $fk_new_unit = 0)
{
$value = doubleval(price2num($value));
$value = floatval(price2num($value));
$fk_unit = intval($fk_unit);
// Calcul en unité de base
@ -469,10 +469,10 @@ class CUnits // extends CommonObject
if ($unit) {
// TODO : if base exist in unit dictionary table remove this convertion exception and update convertion infos in database exemple time hour currently scale 3600 will become scale 2 base 60
if ($unit->unit_type == 'time') {
return doubleval($unit->scale);
return floatval($unit->scale);
}
return pow($base, doubleval($unit->scale));
return pow($base, floatval($unit->scale));
}
return 0;

View File

@ -2694,7 +2694,7 @@ function getTaskProgressView($task, $label = true, $progressNumber = true, $hide
// define progress color according to time spend vs workload
$progressBarClass = 'progress-bar-info';
if ($task->planned_workload) {
$progressCalculated = round(100 * doubleval($task->duration_effective) / doubleval($task->planned_workload), 2);
$progressCalculated = round(100 * floatval($task->duration_effective) / floatval($task->planned_workload), 2);
// this conf is actually hidden, by default we use 10% for "be carefull or warning"
$warningRatio = !empty($conf->global->PROJECT_TIME_SPEND_WARNING_PERCENT) ? (1 + $conf->global->PROJECT_TIME_SPEND_WARNING_PERCENT / 100) : 1.10;
@ -2702,12 +2702,12 @@ function getTaskProgressView($task, $label = true, $progressNumber = true, $hide
$diffTitle = '<br>'.$langs->trans('ProgressDeclared').' : '.$task->progress.($task->progress ? '%' : '');
$diffTitle .= '<br>'.$langs->trans('ProgressCalculated').' : '.$progressCalculated.($progressCalculated ? '%' : '');
//var_dump($progressCalculated.' '.$warningRatio.' '.$task->progress.' '.doubleval($task->progress * $warningRatio));
if (doubleval($progressCalculated) > doubleval($task->progress * $warningRatio)) {
//var_dump($progressCalculated.' '.$warningRatio.' '.$task->progress.' '.floatval($task->progress * $warningRatio));
if (floatval($progressCalculated) > floatval($task->progress * $warningRatio)) {
$progressBarClass = 'progress-bar-danger';
$title = $langs->trans('TheReportedProgressIsLessThanTheCalculatedProgressionByX', abs($task->progress - $progressCalculated).' '.$langs->trans("point"));
$diff = '<span class="text-danger classfortooltip paddingrightonly" title="'.dol_htmlentities($title.$diffTitle).'" ><i class="fa fa-caret-down"></i> '.($task->progress - $progressCalculated).'%</span>';
} elseif (doubleval($progressCalculated) > doubleval($task->progress)) { // warning if close at 10%
} elseif (floatval($progressCalculated) > floatval($task->progress)) { // warning if close at 10%
$progressBarClass = 'progress-bar-warning';
$title = $langs->trans('TheReportedProgressIsLessThanTheCalculatedProgressionByX', abs($task->progress - $progressCalculated).' '.$langs->trans("point"));
$diff = '<span class="text-warning classfortooltip paddingrightonly" title="'.dol_htmlentities($title.$diffTitle).'" ><i class="fa fa-caret-left"></i> '.($task->progress - $progressCalculated).'%</span>';
@ -2771,18 +2771,18 @@ function getTaskProgressView($task, $label = true, $progressNumber = true, $hide
$out .= '</span>';
$out .= ' <div class="progress sm '.$spaced.'">';
$diffval = doubleval($task->progress) - doubleval($progressCalculated);
$diffval = floatval($task->progress) - floatval($progressCalculated);
if ($diffval >= 0) {
// good
$out .= ' <div class="progress-bar '.$progressBarClass.'" style="width: '.doubleval($task->progress).'%" title="'.doubleval($task->progress).'%">';
$out .= ' <div class="progress-bar '.$progressBarClass.'" style="width: '.floatval($task->progress).'%" title="'.floatval($task->progress).'%">';
if (!empty($task->progress)) {
$out .= ' <div class="progress-bar progress-bar-consumed" style="width: '.doubleval($progressCalculated / $task->progress * 100).'%" title="'.doubleval($progressCalculated).'%"></div>';
$out .= ' <div class="progress-bar progress-bar-consumed" style="width: '.floatval($progressCalculated / $task->progress * 100).'%" title="'.floatval($progressCalculated).'%"></div>';
}
$out .= ' </div>';
} else {
// bad
$out .= ' <div class="progress-bar progress-bar-consumed" style="width: '.doubleval($progressCalculated).'%" title="'.doubleval($progressCalculated).'%">';
$out .= ' <div class="progress-bar '.$progressBarClass.'" style="width: '.($task->progress ? doubleval($task->progress / $progressCalculated * 100).'%' : '1px').'" title="'.doubleval($task->progress).'%"></div>';
$out .= ' <div class="progress-bar progress-bar-consumed" style="width: '.floatval($progressCalculated).'%" title="'.floatval($progressCalculated).'%">';
$out .= ' <div class="progress-bar '.$progressBarClass.'" style="width: '.($task->progress ? floatval($task->progress / $progressCalculated * 100).'%' : '1px').'" title="'.floatval($task->progress).'%"></div>';
$out .= ' </div>';
}
$out .= ' </div>';
@ -2811,17 +2811,17 @@ function getTaskProgressBadge($task, $label = '', $tooltip = '')
// define color according to time spend vs workload
$badgeClass = 'badge ';
if ($task->planned_workload) {
$progressCalculated = round(100 * doubleval($task->duration_effective) / doubleval($task->planned_workload), 2);
$progressCalculated = round(100 * floatval($task->duration_effective) / floatval($task->planned_workload), 2);
// this conf is actually hidden, by default we use 10% for "be carefull or warning"
$warningRatio = !empty($conf->global->PROJECT_TIME_SPEND_WARNING_PERCENT) ? (1 + $conf->global->PROJECT_TIME_SPEND_WARNING_PERCENT / 100) : 1.10;
if (doubleval($progressCalculated) > doubleval($task->progress * $warningRatio)) {
if (floatval($progressCalculated) > floatval($task->progress * $warningRatio)) {
$badgeClass .= 'badge-danger';
if (empty($tooltip)) {
$tooltip = $task->progress.'% < '.$langs->trans("TimeConsumed").' '.$progressCalculated.'%';
}
} elseif (doubleval($progressCalculated) > doubleval($task->progress)) { // warning if close at 10%
} elseif (floatval($progressCalculated) > floatval($task->progress)) { // warning if close at 10%
$badgeClass .= 'badge-warning';
if (empty($tooltip)) {
$tooltip = $task->progress.'% < '.$langs->trans("TimeConsumed").' '.$progressCalculated.'%';

View File

@ -472,7 +472,7 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) {
$classe = (!empty($classes[$keyIndex]) ? $classes[$keyIndex] : '');
if (isset($boardloaded[$classe]) && is_object($boardloaded[$classe])) {
$groupElement['globalStats']['total'] = $boardloaded[$classe]->nb[$globalStatsKey] ? $boardloaded[$classe]->nb[$globalStatsKey] : 0;
$nbTotal = doubleval($groupElement['globalStats']['total']);
$nbTotal = floatval($groupElement['globalStats']['total']);
if ($nbTotal >= 10000) {
$nbTotal = round($nbTotal / 1000, 2).'k';
}

View File

@ -513,8 +513,8 @@ class ProductCombination
if ($parent->multiprices[$i] != '' || isset($this->combination_price_levels[$i]->variation_price)) {
$new_type = $parent->multiprices_base_type[$i];
$new_min_price = $parent->multiprices_min[$i];
$variation_price = doubleval(!isset($this->combination_price_levels[$i]->variation_price) ? $this->variation_price : $this->combination_price_levels[$i]->variation_price);
$variation_price_percentage = doubleval(!isset($this->combination_price_levels[$i]->variation_price_percentage) ? $this->variation_price_percentage : $this->combination_price_levels[$i]->variation_price_percentage);
$variation_price = floatval(!isset($this->combination_price_levels[$i]->variation_price) ? $this->variation_price : $this->combination_price_levels[$i]->variation_price);
$variation_price_percentage = floatval(!isset($this->combination_price_levels[$i]->variation_price_percentage) ? $this->variation_price_percentage : $this->combination_price_levels[$i]->variation_price_percentage);
if ($parent->prices_by_qty_list[$i]) {
$new_psq = 1;
@ -1093,9 +1093,9 @@ class ProductCombinationLevel
}
$this->id = $obj->rowid;
$this->fk_product_attribute_combination = doubleval($obj->fk_product_attribute_combination);
$this->fk_product_attribute_combination = floatval($obj->fk_product_attribute_combination);
$this->fk_price_level = intval($obj->fk_price_level);
$this->variation_price = doubleval($obj->variation_price);
$this->variation_price = floatval($obj->variation_price);
$this->variation_price_percentage = (bool) $obj->variation_price_percentage;
return 1;
@ -1129,7 +1129,7 @@ class ProductCombinationLevel
// Update
if (!empty($this->id)) {
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
$sql .= ' SET variation_price = '.doubleval($this->variation_price).' , variation_price_percentage = '.intval($this->variation_price_percentage);
$sql .= ' SET variation_price = '.floatval($this->variation_price).' , variation_price_percentage = '.intval($this->variation_price_percentage);
$sql .= ' WHERE rowid = '.((int) $this->id);
$res = $this->db->query($sql);
@ -1147,7 +1147,7 @@ class ProductCombinationLevel
$sql .= ") VALUES (";
$sql .= (int) $this->fk_product_attribute_combination;
$sql .= ", ".intval($this->fk_price_level);
$sql .= ", ".doubleval($this->variation_price);
$sql .= ", ".floatval($this->variation_price);
$sql .= ", ".intval($this->variation_price_percentage);
$sql .= ")";

View File

@ -169,7 +169,7 @@ function createPayment($authentication, $payment)
$soc->fetch($payment['thirdparty_id']);
$new_payment = new Paiement($db);
$new_payment->amount = doubleval($payment['amount']);
$new_payment->amount = floatval($payment['amount']);
$new_payment->num_payment = $payment['num_payment'];
$new_payment->fk_account = intval($payment['bank_account']);
$new_payment->paiementid = !empty($payment['payment_mode_id']) ? intval($payment['payment_mode_id']) : $soc->mode_reglement_id;