Invoice php 8 issue and warnings.
Seems if ("" < 0) is true in php 8
This commit is contained in:
parent
b8f5dc74d7
commit
e4f61d430f
@ -112,7 +112,12 @@ $extrafields->fetch_name_optionals_label($object->table_element);
|
|||||||
// Load object
|
// Load object
|
||||||
if ($id > 0 || !empty($ref)) {
|
if ($id > 0 || !empty($ref)) {
|
||||||
if ($action != 'add') {
|
if ($action != 'add') {
|
||||||
$ret = $object->fetch($id, $ref, '', '', $conf->global->INVOICE_USE_SITUATION);
|
if (empty($conf->global->INVOICE_USE_SITUATION)) {
|
||||||
|
$fetch_situation = false;
|
||||||
|
} else {
|
||||||
|
$fetch_situation = true;
|
||||||
|
}
|
||||||
|
$ret = $object->fetch($id, $ref, '', '', $fetch_situation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -607,7 +612,7 @@ if (empty($reshook)) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check for mandatory fields in invoice
|
// Check for mandatory fields in invoice
|
||||||
$array_to_check = array('REF_CUSTOMER'=>'RefCustomer');
|
$array_to_check = array('REF_CLIENT'=>'RefCustomer');
|
||||||
foreach ($array_to_check as $key => $val) {
|
foreach ($array_to_check as $key => $val) {
|
||||||
$keymin = strtolower($key);
|
$keymin = strtolower($key);
|
||||||
$vallabel = $object->$keymin;
|
$vallabel = $object->$keymin;
|
||||||
@ -2362,21 +2367,22 @@ if (empty($reshook)) {
|
|||||||
$line = new FactureLigne($db);
|
$line = new FactureLigne($db);
|
||||||
$line->fetch(GETPOST('lineid', 'int'));
|
$line->fetch(GETPOST('lineid', 'int'));
|
||||||
$percent = $line->get_prev_progress($object->id);
|
$percent = $line->get_prev_progress($object->id);
|
||||||
|
$progress = floatval(GETPOST('progress', 'int'));
|
||||||
|
|
||||||
if ($object->type == Facture::TYPE_CREDIT_NOTE && $object->situation_cycle_ref > 0) {
|
if ($object->type == Facture::TYPE_CREDIT_NOTE && $object->situation_cycle_ref > 0) {
|
||||||
// in case of situation credit note
|
// in case of situation credit note
|
||||||
if (GETPOST('progress') >= 0) {
|
if ($progress >= 0) {
|
||||||
$mesg = $langs->trans("CantBeNullOrPositive");
|
$mesg = $langs->trans("CantBeNullOrPositive");
|
||||||
setEventMessages($mesg, null, 'warnings');
|
setEventMessages($mesg, null, 'warnings');
|
||||||
$error++;
|
$error++;
|
||||||
$result = -1;
|
$result = -1;
|
||||||
} elseif (GETPOST('progress') < $line->situation_percent) { // TODO : use a modified $line->get_prev_progress($object->id) result
|
} elseif ($progress < $line->situation_percent) { // TODO : use a modified $line->get_prev_progress($object->id) result
|
||||||
$mesg = $langs->trans("CantBeLessThanMinPercent");
|
$mesg = $langs->trans("CantBeLessThanMinPercent");
|
||||||
setEventMessages($mesg, null, 'warnings');
|
setEventMessages($mesg, null, 'warnings');
|
||||||
$error++;
|
$error++;
|
||||||
$result = -1;
|
$result = -1;
|
||||||
}
|
}
|
||||||
} elseif (GETPOST('progress') < $percent) {
|
} elseif ($progress < $percent) {
|
||||||
$mesg = '<div class="warning">'.$langs->trans("CantBeLessThanMinPercent").'</div>';
|
$mesg = '<div class="warning">'.$langs->trans("CantBeLessThanMinPercent").'</div>';
|
||||||
setEventMessages($mesg, null, 'warnings');
|
setEventMessages($mesg, null, 'warnings');
|
||||||
$error++;
|
$error++;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user