Clean code

This commit is contained in:
Laurent Destailleur 2023-05-22 18:57:42 +02:00
parent 55eedb7fd3
commit 034a0f5c53
3 changed files with 10 additions and 10 deletions

View File

@ -1643,7 +1643,7 @@ if (empty($reshook)) {
}
// Don't add lines with qty 0 when coming from a shipment including all order lines
if ($srcobject->element == 'shipping' && $conf->global->SHIPMENT_GETS_ALL_ORDER_PRODUCTS && $lines[$i]->qty == 0) {
if ($srcobject->element == 'shipping' && getDolGlobalString('SHIPMENT_GETS_ALL_ORDER_PRODUCTS') && $lines[$i]->qty == 0) {
continue;
}
// Don't add closed lines when coming from a contract (Set constant to '0,5' to exclude also inactive lines)

View File

@ -357,7 +357,7 @@ if (empty($reshook)) {
}
//var_dump($batch_line[2]);
if (($totalqty > 0 || !empty($conf->global->SHIPMENT_GETS_ALL_ORDER_PRODUCTS)) && !$error) { // There is at least one thing to ship and no error
if (($totalqty > 0 || getDolGlobalString('SHIPMENT_GETS_ALL_ORDER_PRODUCTS')) && !$error) { // There is at least one thing to ship and no error
for ($i = 0; $i < $num; $i++) {
$qty = "qtyl".$i;
@ -367,7 +367,7 @@ if (empty($reshook)) {
//shipment from multiple stock locations
$nbstockline = count($stockLine[$i]);
for ($j = 0; $j < $nbstockline; $j++) {
if ($stockLine[$i][$j]['qty'] > 0 || ($stockLine[$i][$j]['qty'] == 0 && !empty($conf->global->SHIPMENT_GETS_ALL_ORDER_PRODUCTS))) {
if ($stockLine[$i][$j]['qty'] > 0 || ($stockLine[$i][$j]['qty'] == 0 && getDolGlobalString('SHIPMENT_GETS_ALL_ORDER_PRODUCTS'))) {
$ret = $object->addline($stockLine[$i][$j]['warehouse_id'], $stockLine[$i][$j]['ix_l'], $stockLine[$i][$j]['qty'], $array_options[$i]);
if ($ret < 0) {
setEventMessages($object->error, $object->errors, 'errors');
@ -376,7 +376,7 @@ if (empty($reshook)) {
}
}
} else {
if (GETPOST($qty, 'int') > 0 || (GETPOST($qty, 'int') == 0 && !empty($conf->global->SHIPMENT_GETS_ALL_ORDER_PRODUCTS))) {
if (GETPOST($qty, 'int') > 0 || (GETPOST($qty, 'int') == 0 && getDolGlobalString('SHIPMENT_GETS_ALL_ORDER_PRODUCTS'))) {
$ent = "entl".$i;
$idl = "idl".$i;
$entrepot_id = is_numeric(GETPOST($ent, 'int')) ?GETPOST($ent, 'int') : GETPOST('entrepot_id', 'int');
@ -396,7 +396,7 @@ if (empty($reshook)) {
}
} else {
// batch mode
if ($batch_line[$i]['qty'] > 0 || ($batch_line[$i]['qty'] == 0 && $conf->global->SHIPMENT_GETS_ALL_ORDER_PRODUCTS)) {
if ($batch_line[$i]['qty'] > 0 || ($batch_line[$i]['qty'] == 0 && getDolGlobalString('SHIPMENT_GETS_ALL_ORDER_PRODUCTS'))) {
$ret = $object->addline_batch($batch_line[$i], $array_options[$i]);
if ($ret < 0) {
setEventMessages($object->error, $object->errors, 'errors');
@ -1286,7 +1286,7 @@ if ($action == 'create') {
print '<input name="idl'.$indiceAsked.'" type="hidden" value="'.$line->id.'">';
print '<input name="qtyl'.$indiceAsked.'" id="qtyl'.$indiceAsked.'" class="qtyl center" type="text" size="4" value="'.$deliverableQty.'">';
} else {
if (!empty($conf->global->SHIPMENT_GETS_ALL_ORDER_PRODUCTS)) {
if (getDolGlobalString('SHIPMENT_GETS_ALL_ORDER_PRODUCTS')) {
print '<input name="idl'.$indiceAsked.'" type="hidden" value="'.$line->id.'">';
print '<input name="qtyl'.$indiceAsked.'" id="qtyl'.$indiceAsked.'" type="hidden" value="0">';
}
@ -1473,7 +1473,7 @@ if ($action == 'create') {
print '<input '.$tooltip.' class="qtyl" name="qtyl'.$indiceAsked.'_'.$subj.'" id="qtyl'.$indiceAsked.'" type="text" size="4" value="'.$deliverableQty.'">';
print '<input name="ent1'.$indiceAsked.'_'.$subj.'" type="hidden" value="'.$warehouse_id.'">';
} else {
if (!empty($conf->global->SHIPMENT_GETS_ALL_ORDER_PRODUCTS)) {
if (getDolGlobalString('SHIPMENT_GETS_ALL_ORDER_PRODUCTS')) {
print '<input name="qtyl'.$indiceAsked.'_'.$subj.'" id="qtyl'.$indiceAsked.'" type="hidden" value="0">';
}

View File

@ -964,11 +964,11 @@ class Expedition extends CommonObject
global $conf, $langs;
$num = count($this->lines);
if ($dbatch['qty'] > 0 || ($dbatch['qty'] == 0 && $conf->global->SHIPMENT_GETS_ALL_ORDER_PRODUCTS)) {
if ($dbatch['qty'] > 0 || ($dbatch['qty'] == 0 && getDolGlobalString('SHIPMENT_GETS_ALL_ORDER_PRODUCTS'))) {
$line = new ExpeditionLigne($this->db);
$tab = array();
foreach ($dbatch['detail'] as $key => $value) {
if ($value['q'] > 0 || ($value['q'] == 0 && $conf->global->SHIPMENT_GETS_ALL_ORDER_PRODUCTS)) {
if ($value['q'] > 0 || ($value['q'] == 0 && getDolGlobalString('SHIPMENT_GETS_ALL_ORDER_PRODUCTS'))) {
// $value['q']=qty to move
// $value['id_batch']=id into llx_product_batch of record to move
//var_dump($value);
@ -980,7 +980,7 @@ class Expedition extends CommonObject
return -1;
}
$linebatch->qty = $value['q'];
if ($linebatch->qty == 0 && $conf->global->SHIPMENT_GETS_ALL_ORDER_PRODUCTS) {
if ($linebatch->qty == 0 && getDolGlobalString('SHIPMENT_GETS_ALL_ORDER_PRODUCTS')) {
$linebatch->batch = null;
}
$tab[] = $linebatch;