diff --git a/htdocs/admin/invoice.php b/htdocs/admin/invoice.php index 86095306c4c..7305ba06e48 100644 --- a/htdocs/admin/invoice.php +++ b/htdocs/admin/invoice.php @@ -335,6 +335,7 @@ foreach ($dirmodels as $reldir) { $classname = "mod_facture_".$file; } // Check if there is a filter on country + $reg = array(); preg_match('/\-(.*)_(.*)$/', $classname, $reg); if (!empty($reg[2]) && $reg[2] != strtoupper($mysoc->country_code)) { continue; diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 87eb24f3144..98dd09a970a 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -3030,19 +3030,22 @@ function dol_get_fiche_head($links = array(), $active = '', $title = '', $notab $popuptab = 1; $outmore .= '
'; // The css used to hide/show popup } - $outmore .= '
'; + $outmore_content = ''; + if (isset($links[$i][2]) && $links[$i][2] == 'image') { if (!empty($links[$i][0])) { - $outmore .= '' . $links[$i][1] . '' . "\n"; + $outmore_content .= ''.$links[$i][1].''."\n"; } else { - $outmore .= '' . $links[$i][1] . '' . "\n"; + $outmore_content .= ''.$links[$i][1].''."\n"; } } elseif (!empty($links[$i][1])) { - $outmore .= ''; - $outmore .= preg_replace('/([a-z])\|([a-z])/i', '\\1 | \\2', $links[$i][1]); // Replace x|y with x | y to allow wrap on long composed texts. - $outmore .= '' . "\n"; + $outmore_content .= ''; + $outmore_content .= preg_replace('/([a-z])\|([a-z])/i', '\\1 | \\2', $links[$i][1]); // Replace x|y with x | y to allow wrap on long composed texts. + $outmore_content .= ''."\n"; + } + if ($outmore_content !== '') { + $outmore .= '
' . $outmore_content . '
'; } - $outmore .= '
'; $nbintab++; } diff --git a/htdocs/langs/en_US/receptions.lang b/htdocs/langs/en_US/receptions.lang index e3b748a983a..ef3fb18fcdc 100644 --- a/htdocs/langs/en_US/receptions.lang +++ b/htdocs/langs/en_US/receptions.lang @@ -53,4 +53,5 @@ 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 AutoValidationNotPossibleWhenStockIsDecreasedOnInvoiceValidation=Automatic validation is not possible when stock is decreased on invoice validation 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 5770021675b..3b76df2a257 100644 --- a/htdocs/product/stock/movement_list.php +++ b/htdocs/product/stock/movement_list.php @@ -382,7 +382,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'; @@ -572,7 +572,7 @@ if ($action == "transfert_stock" && $permissiontoadd && !$cancel) { $id, GETPOSTFLOAT("nbpiece"), 1, - GETPOST("label", 'san_alpha'), + GETPOST("label", 'alphanohtml'), (float) $pricesrc, GETPOST('inventorycode', 'alphanohtml'), '', @@ -587,7 +587,7 @@ if ($action == "transfert_stock" && $permissiontoadd && !$cancel) { GETPOSTINT("id_entrepot_destination"), GETPOSTFLOAT("nbpiece"), 0, - GETPOST("label", 'san_alpha'), + GETPOST("label", 'alphanohtml'), (float) $pricedest, GETPOST('inventorycode', 'alphanohtml'), '', diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index 9b50d0d167b..e2521410666 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -1340,12 +1340,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 1a8b023578c..5689b9a057c 100644 --- a/htdocs/reception/list.php +++ b/htdocs/reception/list.php @@ -276,6 +276,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; } @@ -288,11 +290,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(); @@ -313,6 +319,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; + } } // try get from third party of reception @@ -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 );