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).
This commit is contained in:
Laurent Destailleur 2014-06-23 11:47:07 +02:00
parent d22bfa8847
commit b4add020a9
4 changed files with 107 additions and 13 deletions

View File

@ -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.

View File

@ -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.='<br>';
$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);

View File

@ -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';

View File

@ -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';