Fix fix as Eldy wish it

This commit is contained in:
fhenry 2013-04-20 00:10:20 +02:00
parent 738ed467b3
commit e2d0d0d414
8 changed files with 3200 additions and 3126 deletions

View File

@ -62,8 +62,7 @@ if ($action == 'STOCK_CALCULATE_ON_BILL'
// Mode of stock increase
if ($action == 'STOCK_CALCULATE_ON_SUPPLIER_BILL'
|| $action == 'STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER'
|| $action == 'STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER'
|| $action == 'STOCK_CALCULATE_ON_DELETE_INVOICE')
|| $action == 'STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER')
{
$db->begin();
$res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SUPPLIER_BILL", '','chaine',0,'',$conf->entity);
@ -73,7 +72,6 @@ if ($action == 'STOCK_CALCULATE_ON_SUPPLIER_BILL'
if ($action == 'STOCK_CALCULATE_ON_SUPPLIER_BILL') $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SUPPLIER_BILL", GETPOST('STOCK_CALCULATE_ON_SUPPLIER_BILL','alpha'),'chaine',0,'',$conf->entity);
if ($action == 'STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER') $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER", GETPOST('STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER','alpha'),'chaine',0,'',$conf->entity);
if ($action == 'STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER') $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER", GETPOST('STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER','alpha'),'chaine',0,'',$conf->entity);
if ($action == 'STOCK_CALCULATE_ON_DELETE_INVOICE') $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_DELETE_INVOICE", GETPOST('STOCK_CALCULATE_ON_DELETE_INVOICE','alpha'),'chaine',0,'',$conf->entity);
}
if($action)

File diff suppressed because it is too large Load Diff

View File

@ -1298,7 +1298,7 @@ class Facture extends CommonInvoice
}
// If we decrament stock on invoice validation, we increment
if ($this->type != 3 && $result >= 0 && ! empty($conf->stock->enabled) && ! empty($conf->global->STOCK_CALCULATE_ON_DELETE_INVOICE))
if ($this->type != 3 && $result >= 0 && ! empty($conf->stock->enabled) && ! empty($conf->global->STOCK_CALCULATE_ON_BILL) && $idwarehouse!=-1)
{
require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php';
$langs->load("agenda");

View File

@ -2310,7 +2310,7 @@ abstract class CommonObject
/**
* Function to say how many lines object contains
*
* @param int $predefined -1=All, 0=Count free product/service only, 1=Count predefined product/service only
* @param int $predefined -1=All, 0=Count free product/service only, 1=Count predefined product/service only, 2=Count predefined product, 3=Count predefined service
* @return int <0 if KO, 0 if no predefined products, nb of lines with predefined products if found
*/
function hasProductsOrServices($predefined=-1)
@ -2323,6 +2323,8 @@ abstract class CommonObject
if ($predefined == -1) $qualified=1;
if ($predefined == 1 && $val->fk_product > 0) $qualified=1;
if ($predefined == 0 && $val->fk_product <= 0) $qualified=1;
if ($predefined == 2 && $val->fk_product > 0 && $val->product_type==0) $qualified=1;
if ($predefined == 3 && $val->fk_product > 0 && $val->product_type==1) $qualified=1;
if ($qualified) $nb++;
}
dol_syslog(get_class($this).'::hasProductsOrServices we found '.$nb.' qualified lines of products/servcies');

View File

@ -87,4 +87,5 @@ PersonalStock=Personal stock %s
ThisWarehouseIsPersonalStock=This warehouse represents personal stock of %s %s
SelectWarehouseForStockDecrease=Choose warehouse to use for stock decrease
SelectWarehouseForStockIncrease=Choose warehouse to use for stock increase
NoStockAction=No stock action
LastWaitingSupplierOrders=Orders waiting for receptions

View File

@ -86,4 +86,5 @@ PersonalStock=Stock personal %s
ThisWarehouseIsPersonalStock=Este almacén representa el stock personal de %s %s
SelectWarehouseForStockDecrease=Seleccione el almacén a usar en el decremento de stock
SelectWarehouseForStockIncrease=Seleccione el almacén a usar en el incremento de stock
NoStockAction=Sin acciones sobre el stock
LastWaitingSupplierOrders=Pedidos en espera de recepción

View File

@ -87,4 +87,5 @@ PersonalStock=Stock personnel %s
ThisWarehouseIsPersonalStock=Cet entrepôt représente le stock personnel de %s %s
SelectWarehouseForStockDecrease=Sélectionner l'entrepôt à utiliser pour la décrémentation du stock
SelectWarehouseForStockIncrease=Sélectionner l'entrepôt à utiliser pour l'incrémentation du stock
NoStockAction=Pas d'action sur l'entrepot
LastWaitingSupplierOrders=Commandes en attente de réception

View File

@ -109,9 +109,10 @@ class FormProduct
* @param int $empty 1=Can be empty, 0 if not
* @param int $disabled 1=Select is disabled
* @param int $fk_product Add quantity of stock in label for product with id fk_product. Nothing if 0.
* @param string $empty_label Empty label if needed (only if $empty=1)
* @return string HTML select
*/
function selectWarehouses($selected='',$htmlname='idwarehouse',$filtertype='',$empty=0,$disabled=0,$fk_product=0)
function selectWarehouses($selected='',$htmlname='idwarehouse',$filtertype='',$empty=0,$disabled=0,$fk_product=0,$empty_label='')
{
global $langs,$user;
@ -120,7 +121,7 @@ class FormProduct
$this->loadWarehouses($fk_product);
$out='<select class="flat"'.($disabled?' disabled="disabled"':'').' id="'.$htmlname.'" name="'.($htmlname.($disabled?'_disabled':'')).'">';
if ($empty) $out.='<option value="-1">&nbsp;</option>';
if ($empty) $out.='<option value="-1">'.($empty_label?$empty_label:'&nbsp;').'</option>';
foreach($this->cache_warehouses as $id => $arraytypes)
{
$out.='<option value="'.$id.'"';