diff --git a/htdocs/reception/card.php b/htdocs/reception/card.php index 884f4609eca..c73657a8e1d 100644 --- a/htdocs/reception/card.php +++ b/htdocs/reception/card.php @@ -1003,9 +1003,7 @@ if ($action == 'create') print ''; if (! empty($conf->stock->enabled)) { - print ''.$langs->trans("Warehouse").' ('.$langs->trans("Stock").')'; - } if (!empty($conf->productbatch->enabled)) { @@ -1152,9 +1150,8 @@ if ($action == 'create') $tmpentrepot_id = is_numeric(GETPOST($ent,'int'))?GETPOST($ent,'int'):$warehouse_id; if ($line->fk_product > 0) { - print ''; + print ''; print $formproduct->selectWarehouses($tmpentrepot_id, 'entl'.$indiceAsked, '', 0 , 0, $line->fk_product, '', 1); - } } else @@ -1164,7 +1161,8 @@ if ($action == 'create') print ''; } - if(!empty($conf->productbatch->enabled) ){ + if (!empty($conf->productbatch->enabled)) + { if( !empty($product->status_batch)){ print ''; print ''; @@ -1177,8 +1175,6 @@ if ($action == 'create') print ''; } - - } print "\n"; } @@ -1285,8 +1281,8 @@ else if ($id || $ref) } $formconfirm=$form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id,$langs->trans('ValidateReception'),$text,'confirm_valid','',0,1); - } + // Confirm cancelation if ($action == 'annuler') { @@ -1337,7 +1333,8 @@ else if ($id || $ref) // Thirdparty $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1); // Project - if (! empty($conf->projet->enabled)) { + if (! empty($conf->projet->enabled)) + { $langs->load("projects"); $morehtmlref .= '
' . $langs->trans('Project') . ' '; if (0) { // Do not change on reception @@ -1494,7 +1491,6 @@ else if ($id || $ref) print ' '; print ' '; print ''; - } else { @@ -1881,7 +1877,7 @@ else if ($id || $ref) { // edit mode print ''; - if (! empty($conf->stock->enabled)) + if (! empty($conf->stock->enabled)) { if ($lines[$i]->fk_product > 0) { @@ -1892,7 +1888,8 @@ else if ($id || $ref) // Warehouse source print ''; // Batch number managment - if($conf->productbatch->enabled && !empty($lines[$i]->product->status_batch)){ + if ($conf->productbatch->enabled && !empty($lines[$i]->product->status_batch)) + { print '
' . $formproduct->selectWarehouses($lines[$i]->fk_entrepot, 'entl'.$line_id, '', 1, 0, $lines[$i]->fk_product, '', 1). '
'; print $langs->trans('EatByDate').' : '; print $form->select_date($lines[$i]->eatby,'dlc' .$line_id , '', '', 1, ""). '
'; @@ -2122,7 +2119,6 @@ else if ($id || $ref) { print ''.$langs->trans("Delete").''; } - } print ''; diff --git a/htdocs/reception/class/reception.class.php b/htdocs/reception/class/reception.class.php index 59200b53bd8..fd5847e45ee 100644 --- a/htdocs/reception/class/reception.class.php +++ b/htdocs/reception/class/reception.class.php @@ -857,14 +857,14 @@ class Reception extends CommonObject $this->db->commit(); return 1; } - } + } /** * Delete reception. * * @return int >0 if OK, 0 if deletion done but failed to delete files, <0 if KO */ - function delete() + function delete(User $user) { global $conf, $langs, $user; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; @@ -874,10 +874,11 @@ class Reception extends CommonObject $this->db->begin(); + // Stock control if ($conf->stock->enabled && $conf->global->STOCK_CALCULATE_ON_RECEPTION && $this->statut > 0) { - require_once(DOL_DOCUMENT_ROOT."/product/stock/class/mouvementstock.class.php"); + require_once DOL_DOCUMENT_ROOT."/product/stock/class/mouvementstock.class.php"; $langs->load("agenda"); @@ -902,7 +903,6 @@ class Reception extends CommonObject // we do not log origin because it will be deleted $mouvS->origin = null; - $result=$mouvS->livraison($user, $obj->fk_product, $obj->fk_entrepot, $obj->qty, 0, $langs->trans("ReceptionDeletedInDolibarr", $this->ref),'', $obj->eatby, $obj->sellby, $obj->batch); // Price is set to 0, because we don't want to see WAP changed } } @@ -1014,6 +1014,7 @@ class Reception extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load lines @@ -1066,10 +1067,10 @@ class Reception extends CommonObject } return 1; - }else { + } + else { return -1; } - } /** @@ -1247,7 +1248,6 @@ class Reception extends CommonObject $this->lines[]=$line; $xnbp++; } - } // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps @@ -1546,7 +1546,6 @@ class Reception extends CommonObject $this->errors = $mouvS->errors; $error++; break; } - } else { @@ -1561,7 +1560,6 @@ class Reception extends CommonObject $error++; break; } } - } } else @@ -1628,7 +1626,6 @@ class Reception extends CommonObject if ($result < 0) { $error++; } - } else { $error++; $this->errors[]=$this->db->lasterror; @@ -1750,7 +1747,6 @@ class Reception extends CommonObject $commande->fetch($this->origin_id); $commande->setStatus($user,4); } - } else { $error++; $this->errors[]=$this->db->lasterror(); @@ -1866,7 +1862,6 @@ class Reception extends CommonObject $error++; break; } } - } } else @@ -1945,8 +1940,8 @@ class Reception extends CommonObject $langs->load("receptions"); - if (! dol_strlen($modele)) { - + if (! dol_strlen($modele)) + { $modele = 'squille'; if ($this->modelpdf) { @@ -1973,10 +1968,8 @@ class Reception extends CommonObject */ public static function replaceThirdparty(DoliDB $db, $origin_id, $dest_id) { - $tables = array( - 'reception' - ); + $tables = array('reception'); return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables); } -} +} \ No newline at end of file