diff --git a/ChangeLog b/ChangeLog index 55cc3594ac3..b10c4b11d91 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,9 @@ English Dolibarr ChangeLog -------------------------------------------------------------- ***** ChangeLog for 3.5.4 compared to 3.5.3 ***** +Fix: Question about warehouse must not be done when module stock is disabled. +Fix: Option STOCK_SUPPORTS_SERVICES was not correctly implemented + (missing test at some places). Fix: Renaming a project with uplaoded files failed. Fix: [ bug #1476 ] Invoice creation form loses invoice date when there is a validation error. Fix: [ bug #1431 ] Reception and Send supplier order box has a weird top margin. diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php index 0b9590d7e2f..99864a59dd2 100644 --- a/htdocs/commande/fiche.php +++ b/htdocs/commande/fiche.php @@ -1011,8 +1011,18 @@ else if ($action == 'confirm_validate' && $confirm == 'yes' && $user->rights->co { $idwarehouse=GETPOST('idwarehouse'); + $qualified_for_stock_change=0; + if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) + { + $qualified_for_stock_change=$object->hasProductsOrServices(2); + } + else + { + $qualified_for_stock_change=$object->hasProductsOrServices(1); + } + // Check parameters - if (! empty($conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER) && $object->hasProductsOrServices(1)) + if (! empty($conf->stock->enabled) && ! empty($conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER) && $qualified_for_stock_change) { if (! $idwarehouse || $idwarehouse == -1) { @@ -1047,8 +1057,18 @@ else if ($action == 'confirm_modif' && $user->rights->commande->creer) { $idwarehouse=GETPOST('idwarehouse'); + $qualified_for_stock_change=0; + if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) + { + $qualified_for_stock_change=$object->hasProductsOrServices(2); + } + else + { + $qualified_for_stock_change=$object->hasProductsOrServices(1); + } + // Check parameters - if (! empty($conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER) && $object->hasProductsOrServices(1)) + if (! empty($conf->stock->enabled) && ! empty($conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER) && $qualified_for_stock_change) { if (! $idwarehouse || $idwarehouse == -1) { @@ -1094,8 +1114,18 @@ else if ($action == 'confirm_cancel' && $confirm == 'yes' && $user->rights->comm { $idwarehouse=GETPOST('idwarehouse'); + $qualified_for_stock_change=0; + if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) + { + $qualified_for_stock_change=$object->hasProductsOrServices(2); + } + else + { + $qualified_for_stock_change=$object->hasProductsOrServices(1); + } + // Check parameters - if (! empty($conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER) && $object->hasProductsOrServices(1)) + if (! empty($conf->stock->enabled) && ! empty($conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER) && $qualified_for_stock_change) { if (! $idwarehouse || $idwarehouse == -1) { @@ -1887,8 +1917,19 @@ else $text.='
'; $text.=$notify->confirmMessage('ORDER_VALIDATE',$object->socid); } + + $qualified_for_stock_change=0; + if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) + { + $qualified_for_stock_change=$object->hasProductsOrServices(2); + } + else + { + $qualified_for_stock_change=$object->hasProductsOrServices(1); + } + $formquestion=array(); - if (! empty($conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER) && $object->hasProductsOrServices(1)) + if (! empty($conf->stock->enabled) && ! empty($conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER) && $qualified_for_stock_change) { $langs->load("stocks"); require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; @@ -1906,9 +1947,19 @@ else // Confirm back to draft status if ($action == 'modif') { + $qualified_for_stock_change=0; + if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) + { + $qualified_for_stock_change=$object->hasProductsOrServices(2); + } + else + { + $qualified_for_stock_change=$object->hasProductsOrServices(1); + } + $text=$langs->trans('ConfirmUnvalidateOrder',$object->ref); $formquestion=array(); - if (! empty($conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER) && $object->hasProductsOrServices(1)) + if (! empty($conf->stock->enabled) && ! empty($conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER) && $qualified_for_stock_change) { $langs->load("stocks"); require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; @@ -1934,12 +1985,22 @@ else /* * Confirmation de l'annulation - */ + */ if ($action == 'cancel') { + $qualified_for_stock_change=0; + if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) + { + $qualified_for_stock_change=$object->hasProductsOrServices(2); + } + else + { + $qualified_for_stock_change=$object->hasProductsOrServices(1); + } + $text=$langs->trans('ConfirmCancelOrder',$object->ref); $formquestion=array(); - if (! empty($conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER) && $object->hasProductsOrServices(1)) + if (! empty($conf->stock->enabled) && ! empty($conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER) && $qualified_for_stock_change) { $langs->load("stocks"); require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; @@ -1956,7 +2017,7 @@ else /* * Confirmation de la suppression d'une ligne produit - */ + */ if ($action == 'ask_deleteline') { $formconfirm=$form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$lineid, $langs->trans('DeleteProductLine'), $langs->trans('ConfirmDeleteProductLine'), 'confirm_deleteline', '', 0, 1); diff --git a/htdocs/fourn/commande/fiche.php b/htdocs/fourn/commande/fiche.php index 21d165c118e..24b80a60f94 100644 --- a/htdocs/fourn/commande/fiche.php +++ b/htdocs/fourn/commande/fiche.php @@ -488,7 +488,7 @@ else if ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->fourn setEventMessage($object->error, 'errors'); } - // If we have permission, and if we don't need to provide th idwarehouse, we go directly on approved step + // If we have permission, and if we don't need to provide the idwarehouse, we go directly on approved step if ($user->rights->fournisseur->commande->approuver && ! (! empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER) && $object->hasProductsOrServices(1))) { $action='confirm_approve'; @@ -499,8 +499,18 @@ else if ($action == 'confirm_approve' && $confirm == 'yes' && $user->rights->fou { $idwarehouse=GETPOST('idwarehouse', 'int'); + $qualified_for_stock_change=0; + if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) + { + $qualified_for_stock_change=$object->hasProductsOrServices(2); + } + else + { + $qualified_for_stock_change=$object->hasProductsOrServices(1); + } + // Check parameters - if (! empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER) && $object->hasProductsOrServices(1)) + if (! empty($conf->stock->enabled) && ! empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER) && $qualified_for_stock_change) { if (! $idwarehouse || $idwarehouse == -1) { @@ -1193,8 +1203,18 @@ elseif (! empty($object->id)) */ if ($action == 'approve') { + $qualified_for_stock_change=0; + if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) + { + $qualified_for_stock_change=$object->hasProductsOrServices(2); + } + else + { + $qualified_for_stock_change=$object->hasProductsOrServices(1); + } + $formquestion=array(); - if (! empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER) && $object->hasProductsOrServices(1)) + if (! empty($conf->stock->enabled) && ! empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER) && $qualified_for_stock_change) { $langs->load("stocks"); require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; diff --git a/htdocs/fourn/facture/fiche.php b/htdocs/fourn/facture/fiche.php index 8ea921d094b..2874127471a 100644 --- a/htdocs/fourn/facture/fiche.php +++ b/htdocs/fourn/facture/fiche.php @@ -129,7 +129,7 @@ elseif ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->fourni } // Check parameters - if (! empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL) && $qualified_for_stock_change) + if (! empty($conf->stock->enabled) && ! empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL) && $qualified_for_stock_change) { $langs->load("stocks"); if (! $idwarehouse || $idwarehouse == -1) @@ -1475,7 +1475,17 @@ else }*/ $formquestion=array(); - if (! empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL) && $object->hasProductsOrServices(1)) + $qualified_for_stock_change=0; + if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) + { + $qualified_for_stock_change=$object->hasProductsOrServices(2); + } + else + { + $qualified_for_stock_change=$object->hasProductsOrServices(1); + } + + if (! empty($conf->stock->enabled) && ! empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL) && $qualified_for_stock_change) { $langs->load("stocks"); require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';