';
print $langs->trans("Comment") . ' : ';
@@ -712,9 +716,11 @@ if ($id > 0 || ! empty($ref)) {
// print ' / '.$object->ref_supplier; // Not yet available
print '" class="flat">
'.$checkboxlabel;
+
+ empty($conf->reception->enabled)?$dispatchBt=$langs->trans("DispatchVerb"):$dispatchBt=$langs->trans("Receive");
+
+ print '
";
- print '| ';
- if(!empty($conf->reception->enabled) && !empty($objp->fk_reception)){
- $reception = new Reception($db);
- $reception->fetch($objp->fk_reception);
- print $reception->getNomUrl();
+
+ if(!empty($conf->reception->enabled) ){
+ print ' | ';
+ if (!empty($objp->fk_reception)){
+ $reception = new Reception($db);
+ $reception->fetch($objp->fk_reception);
+ print $reception->getNomUrl();
+ }
+
+ print " | ";
}
- print "";
+
print '';
print '' . img_object($langs->trans("ShowProduct"), 'product') . ' ' . $objp->ref . '';
print ' - ' . $objp->label;
diff --git a/htdocs/langs/fr_FR/receptions.lang b/htdocs/langs/fr_FR/receptions.lang
index 7522dc6eb51..0939ae18319 100644
--- a/htdocs/langs/fr_FR/receptions.lang
+++ b/htdocs/langs/fr_FR/receptions.lang
@@ -3,8 +3,8 @@ RefReception=Réf. réception
Reception=Réception
Receptions=Réceptions
AllReceptions=Toutes les réceptions
-Shipment=Réception
-Shipments=Réceptions
+Reception=Réception
+Receptions=Réceptions
ShowReception=Afficher Réceptions
Receivings=Bons de réceptions
ReceptionsArea=Espace réceptions
@@ -13,15 +13,15 @@ ReceptionMethod=Méthode d'réception
LastReceptions=Les %s dernières réceptions
StatisticsOfReceptions=Statistiques des réceptions
NbOfReceptions=Nombre d'réceptions
-NumberOfShipmentsByMonth=Nombre d'réceptions par mois
+NumberOfReceptionsByMonth=Nombre d'réceptions par mois
ReceptionCard=Fiche réception
NewReception=Nouvelle réception
-CreateShipment=Créer réception
+CreateReception=Créer réception
QtyShipped=Qté. expédiée
QtyPreparedOrShipped=Quantité préparée ou envoyée
-QtyToShip=Qté. à expédier
+QtyToReceive=Qté. à recevoir
QtyReceived=Qté. reçue
-QtyInOtherShipments=Qté dans les autres réceptions
+QtyInOtherReceptions=Qté dans les autres réceptions
KeepToShip=Reste à expédier
OtherReceptionsForSameOrder=Autres réceptions pour cette commande
ReceptionsAndReceivingForSameOrder=Réceptions et réceptions pour cette commande
@@ -39,24 +39,24 @@ ConfirmValidateReception=Êtes-vous sûr de vouloir valider cette réception sou
ConfirmCancelReception=Êtes-vous sûr de vouloir annuler cette réception ?
DocumentModelMerou=Modèle Merou A5
WarningNoQtyLeftToSend=Alerte, aucun produit en attente d'réception.
-StatsOnShipmentsOnlyValidated=Statistiques effectuées sur les réceptions validées uniquement. La date prise en compte est la date de validation (la date de prévision de livraison n'étant pas toujours renseignée).
+StatsOnReceptionsOnlyValidated=Statistiques effectuées sur les réceptions validées uniquement. La date prise en compte est la date de validation (la date de prévision de livraison n'étant pas toujours renseignée).
DateDeliveryPlanned=Date prévue de livraison
RefDeliveryReceipt=Ref bon de réception
StatusReceipt=Status du bon de réception
DateReceived=Date de réception réelle
-SendShippingByEMail=Envoyer bon d'réception par email
-SendShippingRef=Envoi du bordereau d'réception %s
-ActionsOnShipping=Événements sur l'réception
+SendReceptionByEMail=Envoyer bon d'réception par email
+SendReceptionRef=Envoi du bordereau d'réception %s
+ActionsOnReception=Événements sur l'réception
LinkToTrackYourPackage=Lien pour le suivi de votre colis
-ShipmentCreationIsDoneFromOrder=Pour le moment, la création d'une nouvelle réception se fait depuis la fiche commande.
-ShipmentLine=Ligne d'réception
+ReceptionCreationIsDoneFromOrder=Pour le moment, la création d'une nouvelle réception se fait depuis la fiche commande fournisseur.
+ReceptionLine=Ligne d'réception
ProductQtyInCustomersOrdersRunning=Quantité de produit en commandes client ouvertes
ProductQtyInSuppliersOrdersRunning=Quantité de produit en commandes fournisseur ouvertes
-ProductQtyInShipmentAlreadySent=Quantité de produit en commande client ouverte déjà expédiée
-ProductQtyInSuppliersShipmentAlreadyRecevied=Quantité de produit déjà reçu en commandes fournisseur ouvertes
+ProductQtyInReceptionAlreadySent=Quantité de produit en commande client ouverte déjà expédiée
+ProductQtyInSuppliersReceptionAlreadyRecevied=Quantité de produit déjà reçu en commandes fournisseur ouvertes
NoProductToShipFoundIntoStock=Aucun produit à expédier n'a été trouver dans l'entrepôt %s. Corrigez l'inventaire ou retourner choisir un autre entrepôt.
WeightVolShort=Poids/vol.
-ValidateOrderFirstBeforeShipment=Vous devez d'abord valider la commande pour pouvoir créer une réception.
+ValidateOrderFirstBeforeReception=Vous devez d'abord valider la commande pour pouvoir créer une réception.
# Reception methods
# ModelDocument
diff --git a/htdocs/reception/card.php b/htdocs/reception/card.php
index fbe7d81622c..4be1dc7f822 100644
--- a/htdocs/reception/card.php
+++ b/htdocs/reception/card.php
@@ -27,41 +27,42 @@
*/
/**
- * \file htdocs/expedition/card.php
- * \ingroup expedition
- * \brief Card of a shipment
+ * \file htdocs/reception/card.php
+ * \ingroup reception
+ * \brief Card of a reception
*/
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
-require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php';
+require_once DOL_DOCUMENT_ROOT.'/reception/class/reception.class.php';
require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php';
-require_once DOL_DOCUMENT_ROOT.'/core/lib/sendings.lib.php';
-require_once DOL_DOCUMENT_ROOT.'/core/modules/expedition/modules_expedition.php';
+require_once DOL_DOCUMENT_ROOT.'/core/lib/reception.lib.php';
+require_once DOL_DOCUMENT_ROOT.'/core/modules/reception/modules_reception.php';
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->commande->enabled)) require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
+if (! empty($conf->fournisseur->enabled)) require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.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';
}
-$langs->loadLangs(array("sendings","companies","bills",'deliveries','orders','stocks','other','propal'));
+$langs->loadLangs(array("receptions","companies","bills",'deliveries','orders','stocks','other','propal'));
if (!empty($conf->incoterm->enabled)) $langs->load('incoterm');
if (! empty($conf->productbatch->enabled)) $langs->load('productbatch');
-$origin = GETPOST('origin','alpha')?GETPOST('origin','alpha'):'expedition'; // Example: commande, propal
+$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
$ref=GETPOST('ref','alpha');
$line_id = GETPOST('lineid','int')?GETPOST('lineid','int'):'';
@@ -69,10 +70,12 @@ $line_id = GETPOST('lineid','int')?GETPOST('lineid','int'):'';
$socid='';
if ($user->societe_id) $socid=$user->societe_id;
-if ($origin == 'expedition') $result=restrictedArea($user, $origin, $id);
+if ($origin == 'reception') $result=restrictedArea($user, $origin, $id);
else {
- $result=restrictedArea($user, 'expedition');
- if (empty($user->rights->{$origin}->lire) && empty($user->rights->{$origin}->read)) accessforbidden();
+ $result=restrictedArea($user, 'reception');
+ if($origin == 'supplierorder'){
+ if (empty($user->rights->fournisseur->commande->lire) && empty($user->rights->fournisseur->commande->read)) accessforbidden();
+ }else if (empty($user->rights->{$origin}->lire) && empty($user->rights->{$origin}->read)) accessforbidden();
}
$action = GETPOST('action','alpha');
@@ -84,7 +87,7 @@ $hidedetails = (GETPOST('hidedetails','int') ? GETPOST('hidedetails','int') : (!
$hidedesc = (GETPOST('hidedesc','int') ? GETPOST('hidedesc','int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0));
$hideref = (GETPOST('hideref','int') ? GETPOST('hideref','int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0));
-$object = new Expedition($db);
+$object = new Reception($db);
$extrafields = new ExtraFields($db);
$extrafieldsline = new ExtraFields($db);
@@ -99,9 +102,9 @@ $extralabelslines=$extrafieldsline->fetch_name_optionals_label($object->table_el
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
-$hookmanager->initHooks(array('expeditioncard','globalcard'));
+$hookmanager->initHooks(array('receptioncard','globalcard'));
-$permissiondellink=$user->rights->expedition->livraison->creer; // Used by the include of actions_dellink.inc.php
+$permissiondellink=$user->rights->reception->livraison->creer; // Used by the include of actions_dellink.inc.php
//var_dump($object->lines[0]->detail_batch);
@@ -118,20 +121,20 @@ if (empty($reshook))
if ($cancel)
{
$action = '';
- $object->fetch($id); // show shipment also after canceling modification
+ $object->fetch($id); // show reception also after canceling modification
}
include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be include, not include_once
// Reopen
- if ($action == 'reopen' && $user->rights->expedition->creer)
+ if ($action == 'reopen' && $user->rights->reception->creer)
{
$object->fetch($id);
$result = $object->reOpen();
}
// Confirm back to draft status
- if ($action == 'modif' && $user->rights->expedition->creer)
+ if ($action == 'modif' && $user->rights->reception->creer)
{
$result = $object->set_draft($user);
if ($result >= 0)
@@ -167,7 +170,7 @@ if (empty($reshook))
setEventMessages($object->error, $object->errors, 'errors');
}
- $result = $object->setValueFrom('ref_customer', GETPOST('ref_customer','alpha'), '', null, 'text', '', $user, 'SHIPMENT_MODIFY');
+ $result = $object->setValueFrom('ref_customer', GETPOST('ref_customer','alpha'), '', null, 'text', '', $user, 'RECEPTION_MODIFY');
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
$action = 'editref_customer';
@@ -188,7 +191,7 @@ if (empty($reshook))
{
// Actions on extra fields (by external module or standard code)
// TODO le hook fait double emploi avec le trigger !!
- $hookmanager->initHooks(array('expeditiondao'));
+ $hookmanager->initHooks(array('receptiondao'));
$parameters = array('id' => $object->id);
$reshook = $hookmanager->executeHooks('insertExtraFields', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if (empty($reshook)) {
@@ -206,8 +209,8 @@ if (empty($reshook))
$action = 'edit_extras';
}
- // Create shipment
- if ($action == 'add' && $user->rights->expedition->creer)
+ // Create reception
+ if ($action == 'add' && $user->rights->reception->creer)
{
$error=0;
$predef='';
@@ -227,7 +230,7 @@ if (empty($reshook))
$date_delivery = dol_mktime(GETPOST('date_deliveryhour','int'), GETPOST('date_deliverymin','int'), 0, GETPOST('date_deliverymonth','int'), GETPOST('date_deliveryday','int'), GETPOST('date_deliveryyear','int'));
- // On va boucler sur chaque ligne du document d'origine pour completer objet expedition
+ // On va boucler sur chaque ligne du document d'origine pour completer objet reception
// avec info diverses + qte a livrer
$classname = ucfirst($object->origin);
$objectsrc = new $classname($db);
@@ -238,7 +241,7 @@ if (empty($reshook))
$object->model_pdf = GETPOST('model');
$object->date_delivery = $date_delivery; // Date delivery planed
$object->fk_delivery_address = $objectsrc->fk_delivery_address;
- $object->shipping_method_id = GETPOST('shipping_method_id','int');
+ $object->reception_method_id = GETPOST('reception_method_id','int');
$object->tracking_number = GETPOST('tracking_number','alpha');
$object->ref_int = GETPOST('ref_int','alpha');
$object->note_private = GETPOST('note_private','none');
@@ -269,7 +272,7 @@ if (empty($reshook))
{
if (isset($_POST[$batch]))
{
- //shipment line with batch-enable product
+ //reception line with batch-enable product
$qty .= '_'.$j;
while (isset($_POST[$batch]))
{
@@ -305,7 +308,7 @@ if (empty($reshook))
}
else if (isset($_POST[$stockLocation]))
{
- //shipment line from multiple stock locations
+ //reception line from multiple stock locations
$qty .= '_'.$j;
while (isset($_POST[$stockLocation]))
{
@@ -324,7 +327,7 @@ if (empty($reshook))
else
{
//var_dump(GETPOST($qty,'int')); var_dump($_POST); var_dump($batch);exit;
- //shipment line for product with no batch management and no multiple stock location
+ //reception line for product with no batch management and no multiple stock location
if (GETPOST($qty,'int') > 0) $totalqty+=GETPOST($qty,'int');
}
@@ -354,7 +357,7 @@ if (empty($reshook))
// not batch mode
if (isset($stockLine[$i]))
{
- //shipment from multiple stock locations
+ //reception from multiple stock locations
$nbstockline = count($stockLine[$i]);
for($j = 0; $j < $nbstockline; $j++)
{
@@ -371,7 +374,7 @@ if (empty($reshook))
}
else
{
- if (GETPOST($qty,'int') > 0 || (GETPOST($qty,'int') == 0 && $conf->global->SHIPMENT_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;
@@ -408,7 +411,7 @@ if (empty($reshook))
if (! $error)
{
- $ret=$object->create($user); // This create shipment (like Odoo picking) and line of shipments. Stock movement will when validating shipment.
+ $ret=$object->create($user); // This create reception (like Odoo picking) and line of receptions. Stock movement will when validating reception.
if ($ret <= 0)
{
setEventMessages($object->error, $object->errors, 'errors');
@@ -418,7 +421,7 @@ if (empty($reshook))
}
else
{
- setEventMessages($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("QtyToShip").'/'.$langs->transnoentitiesnoconv("Warehouse")), null, 'errors');
+ setEventMessages($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("QtyToReceive").'/'.$langs->transnoentitiesnoconv("Warehouse")), null, 'errors');
$error++;
}
@@ -439,7 +442,7 @@ if (empty($reshook))
/*
* Build a receiving receipt
*/
- else if ($action == 'create_delivery' && $conf->livraison_bon->enabled && $user->rights->expedition->livraison->creer)
+ else if ($action == 'create_delivery' && $conf->livraison_bon->enabled && $user->rights->reception->livraison->creer)
{
$result = $object->create_delivery($user);
if ($result > 0)
@@ -454,8 +457,8 @@ if (empty($reshook))
}
else if ($action == 'confirm_valid' && $confirm == 'yes' &&
- ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->expedition->creer))
- || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->expedition->shipping_advance->validate)))
+ ((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)))
)
{
$object->fetch_thirdparty();
@@ -489,12 +492,12 @@ if (empty($reshook))
}
}
- else if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->expedition->supprimer)
+ else if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->reception->supprimer)
{
$result = $object->delete();
if ($result > 0)
{
- header("Location: ".DOL_URL_ROOT.'/expedition/index.php');
+ header("Location: ".DOL_URL_ROOT.'/reception/index.php');
exit;
}
else
@@ -503,7 +506,7 @@ if (empty($reshook))
}
}
// TODO add alternative status
- /*else if ($action == 'reopen' && (! empty($user->rights->expedition->creer) || ! empty($user->rights->expedition->shipping_advance->validate)))
+ /*else if ($action == 'reopen' && (! empty($user->rights->reception->creer) || ! empty($user->rights->reception->reception_advance->validate)))
{
$result = $object->setStatut(0);
if ($result < 0)
@@ -512,7 +515,7 @@ if (empty($reshook))
}
}*/
- else if ($action == 'setdate_livraison' && $user->rights->expedition->creer)
+ else if ($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'));
@@ -531,7 +534,7 @@ if (empty($reshook))
|| $action == 'settrueWidth'
|| $action == 'settrueHeight'
|| $action == 'settrueDepth'
- || $action == 'setshipping_method_id')
+ || $action == 'setreception_method_id')
{
$error=0;
@@ -547,7 +550,7 @@ if (empty($reshook))
$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 == 'setreception_method_id') $object->reception_method_id = trim(GETPOST('reception_method_id','int'));
if (! $error)
{
@@ -572,7 +575,7 @@ if (empty($reshook))
$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=$shipment->thirdparty->default_lang;
+ if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$reception->thirdparty->default_lang;
if (! empty($newlang))
{
$outputlangs = new Translate("",$conf);
@@ -591,7 +594,7 @@ if (empty($reshook))
{
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
- $upload_dir = $conf->expedition->dir_output . "/sending";
+ $upload_dir = $conf->reception->dir_output . "/reception";
$file = $upload_dir . '/' . GETPOST('file');
$ret=dol_delete_file($file,0,0,0,$object);
if ($ret) setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs');
@@ -625,7 +628,7 @@ if (empty($reshook))
{
$object->fetch($id);
$lines = $object->lines;
- $line = new ExpeditionLigne($db);
+ $line = new ReceptionLigne($db);
$num_prod = count($lines);
for ($i = 0 ; $i < $num_prod ; $i++)
@@ -669,7 +672,7 @@ if (empty($reshook))
/*
* Update a line
*/
- else if ($action == 'updateline' && $user->rights->expedition->creer && GETPOST('save'))
+ else if ($action == 'updateline' && $user->rights->reception->creer && GETPOST('save'))
{
// Clean parameters
$qty=0;
@@ -682,7 +685,7 @@ if (empty($reshook))
{
if ($lines[$i]->id == $line_id) // we have found line to update
{
- $line = new ExpeditionLigne($db);
+ $line = new ReceptionLigne($db);
// Extrafields Lines
$extrafieldsline = new ExtraFields($db);
$extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line);
@@ -700,21 +703,21 @@ if (empty($reshook))
foreach ($lines[$i]->detail_batch as $detail_batch)
{
$lotStock = new Productbatch($db);
- $batch="batchl".$detail_batch->fk_expeditiondet."_".$detail_batch->fk_origin_stock;
- $qty = "qtyl".$detail_batch->fk_expeditiondet.'_'.$detail_batch->id;
+ $batch="batchl".$detail_batch->fk_receptiondet."_".$detail_batch->fk_origin_stock;
+ $qty = "qtyl".$detail_batch->fk_receptiondet.'_'.$detail_batch->id;
$batch_id = GETPOST($batch,'int');
$batch_qty = GETPOST($qty, 'int');
if (! empty($batch_id) && ($batch_id != $detail_batch->fk_origin_stock || $batch_qty != $detail_batch->dluo_qty))
{
- if ($lotStock->fetch($batch_id) > 0 && $line->fetch($detail_batch->fk_expeditiondet) > 0) // $line is ExpeditionLine
+ if ($lotStock->fetch($batch_id) > 0 && $line->fetch($detail_batch->fk_receptiondet) > 0) // $line is ReceptionLine
{
if ($lines[$i]->entrepot_id != 0)
{
- // allow update line entrepot_id if not multi warehouse shipping
+ // allow update line entrepot_id if not multi warehouse reception
$line->entrepot_id = $lotStock->warehouseid;
}
- // detail_batch can be an object with keys, or an array of ExpeditionLineBatch
+ // detail_batch can be an object with keys, or an array of ReceptionLineBatch
if (empty($line->detail_batch)) $line->detail_batch=new stdClass();
$line->detail_batch->fk_origin_stock = $batch_id;
@@ -750,7 +753,7 @@ if (empty($reshook))
// check if lotStock warehouse id is same as line warehouse id
if ($lines[$i]->entrepot_id > 0)
{
- // single warehouse shipment line
+ // single warehouse reception line
if ($lines[i]->entrepot_id == $lotStock->warehouseid)
{
$lineIdToAddLot = $line_id;
@@ -758,7 +761,7 @@ if (empty($reshook))
}
else if (count($lines[$i]->details_entrepot) > 1)
{
- // multi warehouse shipment lines
+ // multi warehouse reception lines
foreach ($lines[$i]->details_entrepot as $detail_entrepot)
{
if ($detail_entrepot->entrepot_id == $lotStock->warehouseid)
@@ -792,7 +795,7 @@ if (empty($reshook))
// create new line with new lot
$line->origin_line_id = $lines[$i]->origin_line_id;
$line->entrepot_id = $lotStock->warehouseid;
- $line->detail_batch[0] = new ExpeditionLineBatch($db);
+ $line->detail_batch[0] = new ReceptionLineBatch($db);
$line->detail_batch[0]->fk_origin_stock = $batch_id;
$line->detail_batch[0]->batch = $lotStock->batch;
$line->detail_batch[0]->entrepot_id = $lotStock->warehouseid;
@@ -818,7 +821,7 @@ if (empty($reshook))
// line without lot
if ($lines[$i]->entrepot_id > 0)
{
- // single warehouse shipment line
+ // single warehouse reception line
$stockLocation="entl".$line_id;
$qty = "qtyl".$line_id;
$line->id = $line_id;
@@ -833,7 +836,7 @@ if (empty($reshook))
}
else if (count($lines[$i]->details_entrepot) > 1)
{
- // multi warehouse shipment lines
+ // multi warehouse reception lines
foreach ($lines[$i]->details_entrepot as $detail_entrepot)
{
if (! $error) {
@@ -899,7 +902,7 @@ if (empty($reshook))
}
}
- else if ($action == 'updateline' && $user->rights->expedition->creer && GETPOST('cancel','alpha') == $langs->trans('Cancel')) {
+ else if ($action == 'updateline' && $user->rights->reception->creer && GETPOST('cancel','alpha') == $langs->trans('Cancel')) {
header('Location: ' . $_SERVER['PHP_SELF'] . '?id=' . $object->id); // Pour reaffichage de la fiche en cours d'edition
exit();
}
@@ -908,9 +911,9 @@ if (empty($reshook))
// Actions to send emails
if (empty($id)) $id=$facid;
- $trigger_name='SHIPPING_SENTBYMAIL';
+ $trigger_name='RECEPTION_SENTBYMAIL';
$paramname='id';
- $mode='emailfromshipment';
+ $mode='emailfromreception';
$trackid='shi'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
@@ -921,7 +924,7 @@ if (empty($reshook))
* View
*/
-llxHeader('',$langs->trans('Shipment'),'Expedition');
+llxHeader('',$langs->trans('Reception'),'Reception');
$form = new Form($db);
$formfile = new FormFile($db);
@@ -929,22 +932,22 @@ $formproduct = new FormProduct($db);
if (! empty($conf->projet->enabled)) { $formproject = new FormProjets($db); }
$product_static = new Product($db);
-$shipment_static = new Expedition($db);
+$reception_static = new Reception($db);
$warehousestatic = new Entrepot($db);
if ($action == 'create2')
{
- print load_fiche_titre($langs->trans("CreateShipment")).' ';
- print $langs->trans("ShipmentCreationIsDoneFromOrder");
+ print load_fiche_titre($langs->trans("CreateReception")).' ';
+ print $langs->trans("ReceptionCreationIsDoneFromOrder");
$action=''; $id=''; $ref='';
}
// Mode creation.
if ($action == 'create')
{
- $expe = new Expedition($db);
+ $recept = new Reception($db);
- print load_fiche_titre($langs->trans("CreateShipment"));
+ print load_fiche_titre($langs->trans("CreateReception"));
if (! $origin)
{
setEventMessages($langs->trans("ErrorBadParameters"), null, 'errors');
@@ -952,8 +955,9 @@ if ($action == 'create')
if ($origin)
{
- $classname = ucfirst($origin);
-
+ if($origin == 'supplierorder')$classname = 'CommandeFournisseur';
+ else $classname = ucfirst($origin);
+
$object = new $classname($db);
if ($object->fetch($origin_id)) // This include the fetch_lines
{
@@ -982,9 +986,9 @@ if ($action == 'create')
// Ref
print ' |
';
@@ -1073,8 +1075,8 @@ if ($action == 'create')
// Delivery method
print "
\n";
@@ -1086,7 +1088,7 @@ if ($action == 'create')
// Other attributes
$parameters = array('objectsrc' => $objectsrc, 'colspan' => ' colspan="3"', 'socid'=>$socid);
- $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$expe,$action); // Note that $action and $object may have been modified by hook
+ $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$recept,$action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if (empty($reshook) && ! empty($extrafields->attribute_label)) {
@@ -1094,7 +1096,7 @@ if ($action == 'create')
$orderExtrafields = new Extrafields($db);
$orderExtrafieldLabels = $orderExtrafields->fetch_name_optionals_label($object->table_element);
if ($object->fetch_optionals($object->id, $orderExtrafieldLabels) > 0) {
- $expe->array_options = array_merge($expe->array_options, $object->array_options);
+ $recept->array_options = array_merge($recept->array_options, $object->array_options);
}
print $object->showOptionals($extrafields, 'edit');
}
@@ -1111,13 +1113,13 @@ if ($action == 'create')
}
// Document model
- include_once DOL_DOCUMENT_ROOT . '/core/modules/expedition/modules_expedition.php';
- $liste = ModelePdfExpedition::liste_modeles($db);
+ include_once DOL_DOCUMENT_ROOT . '/core/modules/reception/modules_reception.php';
+ $liste = ModelePdfReception::liste_modeles($db);
if (count($liste) > 1)
{
print "
\n";
}
@@ -1126,9 +1128,48 @@ if ($action == 'create')
dol_fiche_end();
- // Shipment lines
+ // Reception lines
+ $numAsked=0;
+ $dispatchLines = array();
+ foreach ($_POST as $key => $value)
+ {
+ // without batch module enabled
+ if (preg_match('/^product_([0-9]+)_([0-9]+)$/i', $key, $reg))
+ {
+
- $numAsked = count($object->lines);
+ // $numline=$reg[2] + 1; // line of product
+ $numline = $numAsked;
+ $prod = "product_".$reg[1].'_'.$reg[2];
+ $qty = "qty_".$reg[1].'_'.$reg[2];
+ $ent = "entrepot_".$reg[1].'_'.$reg[2];
+ $pu = "pu_".$reg[1].'_'.$reg[2]; // This is unit price including discount
+ $fk_commandefourndet = "fk_commandefourndet_".$reg[1].'_'.$reg[2];
+ $dispatchLines[$numAsked]=array('prod' => GETPOST($prod, 'int'), 'qty' =>GETPOST($qty), 'ent' =>GETPOST($ent, 'int'), 'pu' =>GETPOST($pu), 'comment' =>GETPOST('comment'),'fk_commandefourndet' => GETPOST($fk_commandefourndet, 'int'));
+
+ $numAsked ++;
+ }
+ // with batch module enabled
+ if (preg_match('/^product_batch_([0-9]+)_([0-9]+)$/i', $key, $reg))
+ {
+
+
+ // eat-by date dispatch
+ // $numline=$reg[2] + 1; // line of product
+ $numline = $numAsked;
+ $prod = 'product_batch_'.$reg[1].'_'.$reg[2];
+ $qty = 'qty_'.$reg[1].'_'.$reg[2];
+ $ent = 'entrepot_'.$reg[1].'_'.$reg[2];
+ $pu = 'pu_'.$reg[1].'_'.$reg[2];
+ $lot = 'lot_number_'.$reg[1].'_'.$reg[2];
+ $dDLUO = dol_mktime(12, 0, 0, $_POST['dluo_'.$reg[1].'_'.$reg[2].'month'], $_POST['dluo_'.$reg[1].'_'.$reg[2].'day'], $_POST['dluo_'.$reg[1].'_'.$reg[2].'year']);
+ $dDLC = dol_mktime(12, 0, 0, $_POST['dlc_'.$reg[1].'_'.$reg[2].'month'], $_POST['dlc_'.$reg[1].'_'.$reg[2].'day'], $_POST['dlc_'.$reg[1].'_'.$reg[2].'year']);
+ $fk_commandefourndet = 'fk_commandefourndet_'.$reg[1].'_'.$reg[2];
+ $dispatchLines[$numAsked]=array('prod' => GETPOST($prod, 'int'), 'qty' =>GETPOST($qty), 'ent' =>GETPOST($ent, 'int'), 'pu' =>GETPOST($pu), 'comment' =>GETPOST('comment'),'fk_commandefourndet' => GETPOST($fk_commandefourndet, 'int'),'DLC'=> $dDLC,'DLUO'=> $dDLUO,'lot'=> GETPOST($lot, 'alpha'));
+ $numAsked ++;
+ }
+ }
+ $numAsked --;
print '