diff --git a/htdocs/langs/en_US/receptions.lang b/htdocs/langs/en_US/receptions.lang index 34b2276fca7..6c8a8f7346b 100644 --- a/htdocs/langs/en_US/receptions.lang +++ b/htdocs/langs/en_US/receptions.lang @@ -53,3 +53,4 @@ RestoreWithCurrentQtySaved=Fill quantities with latest saved values ReceptionsRecorded=Receptions recorded ReceptionUpdated=Reception successfully updated ReceptionDistribution=Reception distribution +ReceptionMustBeInTheSameCurrencyThanOther=Reception have to be int the same currency than the other diff --git a/htdocs/langs/fr_FR/receptions.lang b/htdocs/langs/fr_FR/receptions.lang index ff11e7d8555..b5e3027a467 100644 --- a/htdocs/langs/fr_FR/receptions.lang +++ b/htdocs/langs/fr_FR/receptions.lang @@ -53,4 +53,5 @@ RestoreWithCurrentQtySaved=Remplir les quantités avec les dernières valeurs en ReceptionsRecorded=Réceptions enregistrées ReceptionUpdated=Réception mise à jour avec succès ReceptionDistribution=Distribution de réception +ReceptionMustBeInTheSameCurrencyThanOther=Cette Reception n'est pas dans la même devise que les autres AutoValidationNotPossibleWhenStockIsDecreasedOnInvoiceValidation=La validation automatique n'est pas possible lorsque le stock est réduit sur facture validation diff --git a/htdocs/product/stock/movement_list.php b/htdocs/product/stock/movement_list.php index e5cabbe26d5..0ba90f42d0f 100644 --- a/htdocs/product/stock/movement_list.php +++ b/htdocs/product/stock/movement_list.php @@ -373,7 +373,7 @@ if ($action == "correct_stock" && $permissiontoadd) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Product")), null, 'errors'); $action = 'correction'; } - if (!is_numeric(GETPOST("nbpiece"))) { + if (!GETPOSTFLOAT("nbpiece")) { $error++; setEventMessages($langs->trans("ErrorFieldMustBeANumeric", $langs->transnoentitiesnoconv("NumberOfUnit")), null, 'errors'); $action = 'correction'; @@ -399,7 +399,7 @@ if ($action == "correct_stock" && $permissiontoadd) { $result = $product->correct_stock_batch( $user, $id, - GETPOSTINT("nbpiece"), + GETPOSTFLOAT("nbpiece"), GETPOSTINT("mouvement"), GETPOST("label", 'alphanohtml'), price2num(GETPOST('unitprice'), 'MT'), @@ -416,7 +416,7 @@ if ($action == "correct_stock" && $permissiontoadd) { $result = $product->correct_stock( $user, $id, - GETPOSTINT("nbpiece"), + GETPOSTFLOAT("nbpiece"), GETPOSTINT("mouvement"), GETPOST("label", 'alphanohtml'), price2num(GETPOST('unitprice'), 'MT'), @@ -461,7 +461,7 @@ if ($action == "transfert_stock" && $permissiontoadd && !$cancel) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Product")), null, 'errors'); $action = 'transfert'; } - if (!GETPOSTINT("nbpiece")) { + if (!GETPOSTFLOAT("nbpiece")) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("NumberOfUnit")), null, 'errors'); $error++; $action = 'transfert'; @@ -530,7 +530,7 @@ if ($action == "transfert_stock" && $permissiontoadd && !$cancel) { $result1 = $product->correct_stock_batch( $user, $srcwarehouseid, - GETPOSTINT("nbpiece"), + GETPOSTFLOAT("nbpiece"), 1, GETPOST("label", 'san_alpha'), $pricesrc, @@ -547,7 +547,7 @@ if ($action == "transfert_stock" && $permissiontoadd && !$cancel) { $result2 = $product->correct_stock_batch( $user, GETPOSTINT("id_entrepot_destination"), - GETPOSTINT("nbpiece"), + GETPOSTFLOAT("nbpiece"), 0, GETPOST("label", 'san_alpha'), $pricedest, @@ -566,9 +566,9 @@ if ($action == "transfert_stock" && $permissiontoadd && !$cancel) { $result1 = $product->correct_stock( $user, $id, - GETPOST("nbpiece"), + GETPOSTFLOAT("nbpiece"), 1, - GETPOST("label", 'san_alpha'), + GETPOST("label", 'alphanohtml'), $pricesrc, GETPOST('inventorycode', 'alphanohtml'), '', @@ -581,9 +581,9 @@ if ($action == "transfert_stock" && $permissiontoadd && !$cancel) { $result2 = $product->correct_stock( $user, GETPOST("id_entrepot_destination"), - GETPOST("nbpiece"), + GETPOSTFLOAT("nbpiece"), 0, - GETPOST("label", 'san_alpha'), + GETPOST("label", 'alphanohtml'), $pricedest, GETPOST('inventorycode', 'alphanohtml'), '', diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index f416f4fc55d..60cf4e489dc 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -1306,12 +1306,12 @@ foreach ($listofreferent as $key => $value) { if (!empty($element->close_code) && $element->close_code == 'replaced') { $qualifiedfortotal = false; // Replacement invoice, do not include into total } - } elseif ($key == 'order_supplier' && $element->status == 7) { + } elseif ($key == 'order_supplier' && ($element->status == 6 || $element->status == 7)) { $qualifiedfortotal = false; // It makes no sense to include canceled orders in the total } - if ($key == "order_supplier" && $element->status == 7) { - print ''; + if ($key == "order_supplier" && ($element->status == 6 || $element->status == 7)) { + print ''; } else { print ''; } diff --git a/htdocs/reception/list.php b/htdocs/reception/list.php index e50ffb1e687..dede4ca2a8f 100644 --- a/htdocs/reception/list.php +++ b/htdocs/reception/list.php @@ -275,6 +275,8 @@ if (empty($reshook)) { $mode_reglement_id = 0; $fk_account = 0; $transport_mode_id = 0; + $multicurrency_code = null; + if (!empty($rcp->cond_reglement_id)) { $cond_reglement_id = $rcp->cond_reglement_id; } @@ -287,11 +289,15 @@ if (empty($reshook)) { if (!empty($rcp->transport_mode_id)) { $transport_mode_id = $rcp->transport_mode_id; } + if (!empty($rcp->multicurrency_code)) { + $multicurrency_code = $rcp->multicurrency_code; + } if (empty($cond_reglement_id) || empty($mode_reglement_id) || empty($fk_account) || empty($transport_mode_id) + || empty($multicurrency_code) ) { if (!isset($rcp->supplier_order)) { $rcp->fetch_origin(); @@ -312,6 +318,9 @@ if (empty($reshook)) { if (empty($transport_mode_id) && !empty($supplierOrder->transport_mode_id)) { $transport_mode_id = $supplierOrder->transport_mode_id; } + if (empty($multicurrency_code) && !empty($supplierOrder->multicurrency_code)) { + $multicurrency_code = $supplierOrder->multicurrency_code; + } } $soc = null; @@ -330,6 +339,9 @@ if (empty($reshook)) { if (empty($transport_mode_id) && !empty($soc->transport_mode_id)) { $transport_mode_id = $soc->transport_mode_id; } + if (empty($multicurrency_code) && !empty($soc->multicurrency_code)) { + $multicurrency_code = $soc->multicurrency_code; + } } } @@ -340,6 +352,7 @@ if (empty($reshook)) { $objecttmp->mode_reglement_id = $mode_reglement_id; $objecttmp->fk_account = $fk_account; $objecttmp->transport_mode_id = $transport_mode_id; + $objecttmp->multicurrency_code = $multicurrency_code; // if the VAT reverse-charge is activated by default in supplier card to resume the information if (is_object($soc)) { @@ -397,6 +410,13 @@ if (empty($reshook)) { } if ($objecttmp->id > 0) { + if (!isset($rcp->origin_object)) { + $rcp->fetch_origin(); + } + if ($rcp->origin_object->multicurrency_code != $objecttmp->multicurrency_code) { + $errors[] = $rcp->ref." : ".$langs->trans("ReceptionMustBeInTheSameCurrencyThanOther"); + } + $res = $objecttmp->add_object_linked($objecttmp->origin, $id_reception); if ($res == 0) { @@ -506,7 +526,7 @@ if (empty($reshook)) { array(), null, $lines[$i]->rowid, - 0, + $lines[$i]->multicurrency_subprice, $lines[$i]->ref_supplier );