Skip to content

Commit

Permalink
Fix: Question about warehouse must not be done when module stock is
Browse files Browse the repository at this point in the history
disabled.
Fix: Option STOCK_SUPPORTS_SERVICES was not correctly implemented
(missing test at some places).
  • Loading branch information
eldy committed Jun 23, 2014
1 parent d22bfa8 commit b4add02
Show file tree
Hide file tree
Showing 4 changed files with 107 additions and 13 deletions.
3 changes: 3 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
77 changes: 69 additions & 8 deletions htdocs/commande/fiche.php
Original file line number Diff line number Diff line change
Expand Up @@ -1011,8 +1011,18 @@
{
$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)
{
Expand Down Expand Up @@ -1047,8 +1057,18 @@
{
$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)
{
Expand Down Expand Up @@ -1094,8 +1114,18 @@
{
$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)
{
Expand Down Expand Up @@ -1887,8 +1917,19 @@
$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';
Expand All @@ -1906,9 +1947,19 @@
// 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';
Expand All @@ -1934,12 +1985,22 @@

/*
* 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';
Expand All @@ -1956,7 +2017,7 @@

/*
* 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);
Expand Down
26 changes: 23 additions & 3 deletions htdocs/fourn/commande/fiche.php
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@
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';
Expand All @@ -499,8 +499,18 @@
{
$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)
{
Expand Down Expand Up @@ -1193,8 +1203,18 @@
*/
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';
Expand Down
14 changes: 12 additions & 2 deletions htdocs/fourn/facture/fiche.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@
}

// 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)
Expand Down Expand Up @@ -1475,7 +1475,17 @@
}*/
$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';
Expand Down

0 comments on commit b4add02

Please sign in to comment.