diff --git a/htdocs/reception/card.php b/htdocs/reception/card.php
index 41e8f60e634..83701e59e40 100644
--- a/htdocs/reception/card.php
+++ b/htdocs/reception/card.php
@@ -44,13 +44,19 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php';
require_once DOL_DOCUMENT_ROOT.'/product/stock/class/productlot.class.php';
-if (!empty($conf->product->enabled) || !empty($conf->service->enabled)) require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
-if (!empty($conf->propal->enabled)) require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
+if (!empty($conf->product->enabled) || !empty($conf->service->enabled)) {
+ require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
+}
+if (!empty($conf->propal->enabled)) {
+ require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
+}
if (!empty($conf->fournisseur->enabled)) {
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.dispatch.class.php';
}
-if (!empty($conf->productbatch->enabled)) require_once DOL_DOCUMENT_ROOT.'/product/class/productbatch.class.php';
+if (!empty($conf->productbatch->enabled)) {
+ require_once DOL_DOCUMENT_ROOT.'/product/class/productbatch.class.php';
+}
if (!empty($conf->projet->enabled)) {
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
@@ -58,28 +64,45 @@ if (!empty($conf->projet->enabled)) {
$langs->loadLangs(array("receptions", "companies", "bills", 'deliveries', 'orders', 'stocks', 'other', 'propal', 'sendings'));
-if (!empty($conf->incoterm->enabled)) $langs->load('incoterm');
-if (!empty($conf->productbatch->enabled)) $langs->load('productbatch');
+if (!empty($conf->incoterm->enabled)) {
+ $langs->load('incoterm');
+}
+if (!empty($conf->productbatch->enabled)) {
+ $langs->load('productbatch');
+}
$origin = GETPOST('origin', 'alpha') ?GETPOST('origin', 'alpha') : 'reception'; // Example: commande, propal
$origin_id = GETPOST('id', 'int') ?GETPOST('id', 'int') : '';
$id = $origin_id;
-if (empty($origin_id)) $origin_id = GETPOST('origin_id', 'int'); // Id of order or propal
-if (empty($origin_id)) $origin_id = GETPOST('object_id', 'int'); // Id of order or propal
-if (empty($origin_id)) $origin_id = GETPOST('originid', 'int'); // Id of order or propal
+if (empty($origin_id)) {
+ $origin_id = GETPOST('origin_id', 'int'); // Id of order or propal
+}
+if (empty($origin_id)) {
+ $origin_id = GETPOST('object_id', 'int'); // Id of order or propal
+}
+if (empty($origin_id)) {
+ $origin_id = GETPOST('originid', 'int'); // Id of order or propal
+}
$ref = GETPOST('ref', 'alpha');
$line_id = GETPOST('lineid', 'int') ?GETPOST('lineid', 'int') : '';
// Security check
$socid = '';
-if ($user->socid) $socid = $user->socid;
+if ($user->socid) {
+ $socid = $user->socid;
+}
-if ($origin == 'reception') $result = restrictedArea($user, $origin, $id);
-else {
+if ($origin == 'reception') {
+ $result = restrictedArea($user, $origin, $id);
+} else {
$result = restrictedArea($user, 'reception');
if ($origin == 'supplierorder') {
- if (empty($user->rights->fournisseur->commande->lire) && empty($user->rights->fournisseur->commande->read)) accessforbidden();
- } elseif (empty($user->rights->{$origin}->lire) && empty($user->rights->{$origin}->read)) accessforbidden();
+ if (empty($user->rights->fournisseur->commande->lire) && empty($user->rights->fournisseur->commande->read)) {
+ accessforbidden();
+ }
+ } elseif (empty($user->rights->{$origin}->lire) && empty($user->rights->{$origin}->read)) {
+ accessforbidden();
+ }
}
$action = GETPOST('action', 'alpha');
@@ -120,12 +143,12 @@ $date_delivery = dol_mktime(GETPOST('date_deliveryhour', 'int'), GETPOST('date_d
$parameters = array();
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
-if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
+if ($reshook < 0) {
+ setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
+}
-if (empty($reshook))
-{
- if ($cancel)
- {
+if (empty($reshook)) {
+ if ($cancel) {
$action = '';
$object->fetch($id); // show reception also after canceling modification
}
@@ -133,25 +156,25 @@ if (empty($reshook))
include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be include, not include_once
// Reopen
- if ($action == 'reopen' && $user->rights->reception->creer)
- {
+ if ($action == 'reopen' && $user->rights->reception->creer) {
$object->fetch($id);
$result = $object->reOpen();
}
// Confirm back to draft status
- if ($action == 'modif' && $user->rights->reception->creer)
- {
+ if ($action == 'modif' && $user->rights->reception->creer) {
$result = $object->setDraft($user);
- if ($result >= 0)
- {
+ if ($result >= 0) {
// Define output language
- if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
- {
+ if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
$outputlangs = $langs;
$newlang = '';
- if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang = GETPOST('lang_id', 'aZ09');
- if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang;
+ if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) {
+ $newlang = GETPOST('lang_id', 'aZ09');
+ }
+ if ($conf->global->MAIN_MULTILANGS && empty($newlang)) {
+ $newlang = $object->thirdparty->default_lang;
+ }
if (!empty($newlang)) {
$outputlangs = new Translate("", $conf);
$outputlangs->setDefaultLang($newlang);
@@ -164,13 +187,11 @@ if (empty($reshook))
}
// Set incoterm
- if ($action == 'set_incoterms' && !empty($conf->incoterm->enabled))
- {
+ if ($action == 'set_incoterms' && !empty($conf->incoterm->enabled)) {
$result = $object->setIncoterms(GETPOST('incoterm_id', 'int'), GETPOST('location_incoterms', 'alpha'));
}
- if ($action == 'setref_supplier')
- {
+ if ($action == 'setref_supplier') {
$result = $object->fetch($id);
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
@@ -186,32 +207,31 @@ if (empty($reshook))
}
}
- if ($action == 'update_extras')
- {
+ if ($action == 'update_extras') {
$object->oldcopy = dol_clone($object);
// Fill array 'array_options' with data from update form
$ret = $extrafields->setOptionalsFromPost(null, $object, GETPOST('attribute', 'restricthtml'));
- if ($ret < 0) $error++;
+ if ($ret < 0) {
+ $error++;
+ }
- if (!$error)
- {
+ if (!$error) {
// Actions on extra fields
$result = $object->insertExtraFields('RECEPTION_MODIFY');
- if ($result < 0)
- {
+ if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
$error++;
}
}
- if ($error)
+ if ($error) {
$action = 'edit_extras';
+ }
}
// Create reception
- if ($action == 'add' && $user->rights->reception->creer)
- {
+ if ($action == 'add' && $user->rights->reception->creer) {
$error = 0;
$predef = '';
@@ -231,9 +251,11 @@ if (empty($reshook))
// On va boucler sur chaque ligne du document d'origine pour completer objet reception
// avec info diverses + qte a livrer
- if ($object->origin == "supplierorder")
+ if ($object->origin == "supplierorder") {
$classname = 'CommandeFournisseur';
- else $classname = ucfirst($object->origin);
+ } else {
+ $classname = ucfirst($object->origin);
+ }
$objectsrc = new $classname($db);
$objectsrc->fetch($object->origin_id);
@@ -258,18 +280,15 @@ if (empty($reshook))
$totalqty = 0;
$num = 0;
- foreach ($_POST as $key => $value)
- {
+ foreach ($_POST as $key => $value) {
// without batch module enabled
- if (strpos($key, 'qtyasked') !== false)
- {
+ if (strpos($key, 'qtyasked') !== false) {
$num++;
}
}
- for ($i = 1; $i <= $num; $i++)
- {
+ for ($i = 1; $i <= $num; $i++) {
$idl = "idl".$i;
$sub_qty = array();
@@ -284,8 +303,9 @@ if (empty($reshook))
//var_dump(GETPOST($qty,'int')); var_dump($_POST); var_dump($batch);exit;
//reception line for product with no batch management and no multiple stock location
- if (GETPOST($qty, 'int') > 0)
+ if (GETPOST($qty, 'int') > 0) {
$totalqty += GETPOST($qty, 'int');
+ }
// Extrafields
@@ -293,14 +313,14 @@ if (empty($reshook))
}
- if ($totalqty > 0) // There is at least one thing to ship
- {
+ if ($totalqty > 0) { // There is at least one thing to ship
//var_dump($_POST);exit;
- for ($i = 1; $i <= $num; $i++)
- {
+ for ($i = 1; $i <= $num; $i++) {
$lineToTest = '';
foreach ($objectsrc->lines as $linesrc) {
- if ($linesrc->id == GETPOST($idl, 'int')) $lineToTest = $linesrc;
+ if ($linesrc->id == GETPOST($idl, 'int')) {
+ $lineToTest = $linesrc;
+ }
}
$qty = "qtyl".$i;
$comment = "comment".$i;
@@ -310,18 +330,19 @@ if (empty($reshook))
$timeFormat = '%d/%m/%Y';
- if (GETPOST($qty, 'int') > 0 || (GETPOST($qty, 'int') == 0 && $conf->global->RECEPTION_GETS_ALL_ORDER_PRODUCTS))
- {
+ if (GETPOST($qty, 'int') > 0 || (GETPOST($qty, 'int') == 0 && $conf->global->RECEPTION_GETS_ALL_ORDER_PRODUCTS)) {
$ent = "entl".$i;
$idl = "idl".$i;
$entrepot_id = is_numeric(GETPOST($ent, 'int')) ? GETPOST($ent, 'int') : GETPOST('entrepot_id', 'int');
- if ($entrepot_id < 0)
+ if ($entrepot_id < 0) {
$entrepot_id = '';
- if (!($linesrc->fk_product > 0) && empty($conf->global->STOCK_SUPPORTS_SERVICES))
+ }
+ if (!($linesrc->fk_product > 0) && empty($conf->global->STOCK_SUPPORTS_SERVICES)) {
$entrepot_id = 0;
+ }
$eatby = GETPOST($eatby, 'alpha');
$sellby = GETPOST($sellby, 'alpha');
$eatbydate = str_replace('/', '-', $eatby);
@@ -329,8 +350,7 @@ if (empty($reshook))
$ret = $object->addline($entrepot_id, GETPOST($idl, 'int'), GETPOST($qty, 'int'), $array_options[$i], GETPOST($comment, 'alpha'), strtotime($eatbydate), strtotime($sellbydate), GETPOST($batch, 'alpha'));
- if ($ret < 0)
- {
+ if ($ret < 0) {
setEventMessages($object->error, $object->errors, 'errors');
$error++;
}
@@ -340,13 +360,13 @@ if (empty($reshook))
// Fill array 'array_options' with data from add form
$ret = $extrafields->setOptionalsFromPost(null, $object);
- if ($ret < 0) $error++;
- if (!$error)
- {
+ if ($ret < 0) {
+ $error++;
+ }
+ if (!$error) {
$ret = $object->create($user); // This create reception (like Odoo picking) and line of receptions. Stock movement will when validating reception.
- if ($ret <= 0)
- {
+ if ($ret <= 0) {
setEventMessages($object->error, $object->errors, 'errors');
$error++;
}
@@ -356,8 +376,7 @@ if (empty($reshook))
$error++;
}
- if (!$error)
- {
+ if (!$error) {
$db->commit();
header("Location: card.php?id=".$object->id);
exit;
@@ -368,25 +387,26 @@ if (empty($reshook))
}
} elseif ($action == 'confirm_valid' && $confirm == 'yes' &&
((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->reception->creer))
- || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->reception->reception_advance->validate)))
- )
- {
+ || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->reception->reception_advance->validate)))
+ ) {
$object->fetch_thirdparty();
$result = $object->valid($user);
- if ($result < 0)
- {
+ if ($result < 0) {
$langs->load("errors");
setEventMessages($langs->trans($object->error), null, 'errors');
} else {
// Define output language
- if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
- {
+ if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
$outputlangs = $langs;
$newlang = '';
- if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang = GETPOST('lang_id', 'aZ09');
- if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang;
+ if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) {
+ $newlang = GETPOST('lang_id', 'aZ09');
+ }
+ if ($conf->global->MAIN_MULTILANGS && empty($newlang)) {
+ $newlang = $object->thirdparty->default_lang;
+ }
if (!empty($newlang)) {
$outputlangs = new Translate("", $conf);
$outputlangs->setDefaultLang($newlang);
@@ -395,71 +415,70 @@ if (empty($reshook))
$ret = $object->fetch($id); // Reload to get new records
$result = $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
- if ($result < 0) dol_print_error($db, $result);
+ if ($result < 0) {
+ dol_print_error($db, $result);
+ }
}
}
- } elseif ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->reception->supprimer)
- {
+ } elseif ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->reception->supprimer) {
$result = $object->delete($user);
- if ($result > 0)
- {
+ if ($result > 0) {
header("Location: ".DOL_URL_ROOT.'/reception/index.php');
exit;
} else {
setEventMessages($object->error, $object->errors, 'errors');
}
- }
- // TODO add alternative status
- /*elseif ($action == 'reopen' && (! empty($user->rights->reception->creer) || ! empty($user->rights->reception->reception_advance->validate)))
- {
- $result = $object->setStatut(0);
- if ($result < 0)
- {
- setEventMessages($object->error, $object->errors, 'errors');
- }
- }*/
- elseif ($action == 'setdate_livraison' && $user->rights->reception->creer)
- {
+ // TODO add alternative status
+ /*} elseif ($action == 'reopen' && (! empty($user->rights->reception->creer) || ! empty($user->rights->reception->reception_advance->validate))) {
+ $result = $object->setStatut(0);
+ if ($result < 0) {
+ setEventMessages($object->error, $object->errors, 'errors');
+ }*/
+ } elseif ($action == 'setdate_livraison' && $user->rights->reception->creer) {
//print "x ".$_POST['liv_month'].", ".$_POST['liv_day'].", ".$_POST['liv_year'];
$datedelivery = dol_mktime(GETPOST('liv_hour', 'int'), GETPOST('liv_min', 'int'), 0, GETPOST('liv_month', 'int'), GETPOST('liv_day', 'int'), GETPOST('liv_year', 'int'));
$object->fetch($id);
$result = $object->setDeliveryDate($user, $datedelivery);
- if ($result < 0)
- {
+ if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
}
- }
-
- // Action update
- elseif ($action == 'settracking_number' || $action == 'settracking_url'
+ } elseif ($action == 'settracking_number' || $action == 'settracking_url'
|| $action == 'settrueWeight'
|| $action == 'settrueWidth'
|| $action == 'settrueHeight'
|| $action == 'settrueDepth'
- || $action == 'setshipping_method_id')
- {
+ || $action == 'setshipping_method_id') {
+ // Action update
$error = 0;
- if ($action == 'settracking_number') $object->tracking_number = trim(GETPOST('tracking_number', 'alpha'));
- if ($action == 'settracking_url') $object->tracking_url = trim(GETPOST('tracking_url', 'int'));
+ if ($action == 'settracking_number') {
+ $object->tracking_number = trim(GETPOST('tracking_number', 'alpha'));
+ }
+ if ($action == 'settracking_url') {
+ $object->tracking_url = trim(GETPOST('tracking_url', 'int'));
+ }
if ($action == 'settrueWeight') {
$object->trueWeight = trim(GETPOST('trueWeight', 'int'));
$object->weight_units = GETPOST('weight_units', 'int');
}
- if ($action == 'settrueWidth') $object->trueWidth = trim(GETPOST('trueWidth', 'int'));
+ if ($action == 'settrueWidth') {
+ $object->trueWidth = trim(GETPOST('trueWidth', 'int'));
+ }
if ($action == 'settrueHeight') {
$object->trueHeight = trim(GETPOST('trueHeight', 'int'));
$object->size_units = GETPOST('size_units', 'int');
}
- if ($action == 'settrueDepth') $object->trueDepth = trim(GETPOST('trueDepth', 'int'));
- if ($action == 'setshipping_method_id') $object->shipping_method_id = trim(GETPOST('shipping_method_id', 'int'));
+ if ($action == 'settrueDepth') {
+ $object->trueDepth = trim(GETPOST('trueDepth', 'int'));
+ }
+ if ($action == 'setshipping_method_id') {
+ $object->shipping_method_id = trim(GETPOST('shipping_method_id', 'int'));
+ }
- if (!$error)
- {
- if ($object->update($user) >= 0)
- {
+ if (!$error) {
+ if ($object->update($user) >= 0) {
header("Location: card.php?id=".$object->id);
exit;
}
@@ -467,78 +486,70 @@ if (empty($reshook))
}
$action = "";
- }
-
- // Build document
- elseif ($action == 'builddoc') // En get ou en post
- {
+ } elseif ($action == 'builddoc') {
+ // Build document
+ // En get ou en post
// Save last template used to generate document
- if (GETPOST('model')) $object->setDocModel($user, GETPOST('model', 'alpha'));
+ if (GETPOST('model')) {
+ $object->setDocModel($user, GETPOST('model', 'alpha'));
+ }
// Define output language
$outputlangs = $langs;
$newlang = '';
- if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang = GETPOST('lang_id', 'aZ09');
- if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $reception->thirdparty->default_lang;
- if (!empty($newlang))
- {
+ if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) {
+ $newlang = GETPOST('lang_id', 'aZ09');
+ }
+ if ($conf->global->MAIN_MULTILANGS && empty($newlang)) {
+ $newlang = $reception->thirdparty->default_lang;
+ }
+ if (!empty($newlang)) {
$outputlangs = new Translate("", $conf);
$outputlangs->setDefaultLang($newlang);
}
$result = $object->generateDocument($object->model_pdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
- if ($result <= 0)
- {
+ if ($result <= 0) {
setEventMessages($object->error, $object->errors, 'errors');
$action = '';
}
- }
-
- // Delete file in doc form
- elseif ($action == 'remove_file')
- {
+ } elseif ($action == 'remove_file') {
+ // Delete file in doc form
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
$upload_dir = $conf->reception->dir_output;
$file = $upload_dir.'/'.GETPOST('file');
$ret = dol_delete_file($file, 0, 0, 0, $object);
- if ($ret) setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs');
- else setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors');
- } elseif ($action == 'classifybilled')
- {
+ if ($ret) {
+ setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs');
+ } else {
+ setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors');
+ }
+ } elseif ($action == 'classifybilled') {
$object->fetch($id);
$result = $object->setBilled();
if ($result >= 0) {
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id);
exit();
}
- } elseif ($action == 'classifyclosed')
- {
+ } elseif ($action == 'classifyclosed') {
$object->fetch($id);
$result = $object->setClosed();
if ($result >= 0) {
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id);
exit();
}
- }
-
- /*
- * delete a line
- */
- elseif ($action == 'deleteline' && !empty($line_id))
- {
+ } elseif ($action == 'deleteline' && !empty($line_id)) {
+ // delete a line
$object->fetch($id);
$lines = $object->lines;
$line = new CommandeFournisseurDispatch($db);
$num_prod = count($lines);
- for ($i = 0; $i < $num_prod; $i++)
- {
- if ($lines[$i]->id == $line_id)
- {
+ for ($i = 0; $i < $num_prod; $i++) {
+ if ($lines[$i]->id == $line_id) {
// delete single warehouse line
$line->id = $line_id;
- if (!$error && $line->delete($user) < 0)
- {
+ if (!$error && $line->delete($user) < 0) {
$error++;
}
}
@@ -551,13 +562,8 @@ if (empty($reshook))
} else {
setEventMessages($line->error, $line->errors, 'errors');
}
- }
-
- /*
- * Update a line
- */
- elseif ($action == 'updateline' && $user->rights->reception->creer && GETPOST('save'))
- {
+ } elseif ($action == 'updateline' && $user->rights->reception->creer && GETPOST('save')) {
+ // Update a line
// Clean parameters
$qty = 0;
$entrepot_id = 0;
@@ -565,10 +571,8 @@ if (empty($reshook))
$lines = $object->lines;
$num_prod = count($lines);
- for ($i = 0; $i < $num_prod; $i++)
- {
- if ($lines[$i]->id == $line_id) // we have found line to update
- {
+ for ($i = 0; $i < $num_prod; $i++) {
+ if ($lines[$i]->id == $line_id) { // we have found line to update
$line = new CommandeFournisseurDispatch($db);
$line->fetch($line_id);
// Extrafields Lines
@@ -579,8 +583,7 @@ if (empty($reshook))
$line->fk_product = $lines[$i]->fk_product;
- if ($lines[$i]->fk_product > 0)
- {
+ if ($lines[$i]->fk_product > 0) {
// single warehouse reception line
$stockLocation = "entl".$line_id;
$qty = "qtyl".$line_id;
@@ -605,8 +608,7 @@ if (empty($reshook))
$line->sellby = strtotime($sellbydate);
}
- if ($line->update($user) < 0)
- {
+ if ($line->update($user) < 0) {
setEventMessages($line->error, $line->errors, 'errors');
$error++;
}
@@ -616,8 +618,7 @@ if (empty($reshook))
$line->id = $line_id;
$line->qty = GETPOST($qty, 'int');
$line->fk_entrepot = 0;
- if ($line->update($user) < 0)
- {
+ if ($line->update($user) < 0) {
setEventMessages($line->error, $line->errors, 'errors');
$error++;
}
@@ -633,10 +634,12 @@ if (empty($reshook))
// Define output language
$outputlangs = $langs;
$newlang = '';
- if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09'))
+ if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) {
$newlang = GETPOST('lang_id', 'aZ09');
- if ($conf->global->MAIN_MULTILANGS && empty($newlang))
+ }
+ if ($conf->global->MAIN_MULTILANGS && empty($newlang)) {
$newlang = $object->thirdparty->default_lang;
+ }
if (!empty($newlang)) {
$outputlangs = new Translate("", $conf);
$outputlangs->setDefaultLang($newlang);
@@ -657,7 +660,9 @@ if (empty($reshook))
include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
// Actions to send emails
- if (empty($id)) $id = $facid;
+ if (empty($id)) {
+ $id = $facid;
+ }
$triggersendname = 'RECEPTION_SENTBYMAIL';
$paramname = 'id';
$mode = 'emailfromreception';
@@ -675,14 +680,15 @@ llxHeader('', $langs->trans('Reception'), 'Reception');
$form = new Form($db);
$formfile = new FormFile($db);
$formproduct = new FormProduct($db);
-if (!empty($conf->projet->enabled)) { $formproject = new FormProjets($db); }
+if (!empty($conf->projet->enabled)) {
+ $formproject = new FormProjets($db);
+}
$product_static = new Product($db);
$reception_static = new Reception($db);
$warehousestatic = new Entrepot($db);
-if ($action == 'create2')
-{
+if ($action == 'create2') {
print load_fiche_titre($langs->trans("CreateReception"), '', 'dollyrevert');
print '
'.$langs->trans("ReceptionCreationIsDoneFromOrder");
@@ -690,31 +696,32 @@ if ($action == 'create2')
}
// Mode creation.
-if ($action == 'create')
-{
+if ($action == 'create') {
$recept = new Reception($db);
print load_fiche_titre($langs->trans("CreateReception"));
- if (!$origin)
- {
+ if (!$origin) {
setEventMessages($langs->trans("ErrorBadParameters"), null, 'errors');
}
- if ($origin)
- {
- if ($origin == 'supplierorder')$classname = 'CommandeFournisseur';
- else $classname = ucfirst($origin);
+ if ($origin) {
+ if ($origin == 'supplierorder') {
+ $classname = 'CommandeFournisseur';
+ } else {
+ $classname = ucfirst($origin);
+ }
$object = new $classname($db);
- if ($object->fetch($origin_id)) // This include the fetch_lines
- {
+ if ($object->fetch($origin_id)) { // This include the fetch_lines
$soc = new Societe($db);
$soc->fetch($object->socid);
$author = new User($db);
$author->fetch($object->user_author_id);
- if (!empty($conf->stock->enabled)) $entrepot = new Entrepot($db);
+ if (!empty($conf->stock->enabled)) {
+ $entrepot = new Entrepot($db);
+ }
print '