forked from Wavyzz/dolibarr
Fix: Combo list of warehouse not saved.
Fix: Validate of shipment in error when using not predefined products.
This commit is contained in:
@@ -2118,12 +2118,12 @@ else
|
|||||||
// Create bill and Classify billed
|
// Create bill and Classify billed
|
||||||
if ($conf->facture->enabled && $object->statut > 0 && ! $object->billed)
|
if ($conf->facture->enabled && $object->statut > 0 && ! $object->billed)
|
||||||
{
|
{
|
||||||
if ($user->rights->facture->creer)
|
if ($user->rights->facture->creer && empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER))
|
||||||
{
|
{
|
||||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/facture.php?action=create&origin='.$object->element.'&originid='.$object->id.'&socid='.$object->socid.'">'.$langs->trans("CreateBill").'</a>';
|
print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/facture.php?action=create&origin='.$object->element.'&originid='.$object->id.'&socid='.$object->socid.'">'.$langs->trans("CreateBill").'</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($user->rights->commande->creer && $object->statut > 2)
|
if ($user->rights->commande->creer && $object->statut > 2 && empty($conf->global->WORKFLOW_DISABLE_CLASSIFY_BILLED_FROM_ORDER))
|
||||||
{
|
{
|
||||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=classifybilled">'.$langs->trans("ClassifyBilled").'</a>';
|
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=classifybilled">'.$langs->trans("ClassifyBilled").'</a>';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2069,9 +2069,9 @@ function info_admin($text,$infoonimgalt=0)
|
|||||||
* Toutefois, il faut essayer de ne l'appeler qu'au sein de pages php, les classes devant
|
* Toutefois, il faut essayer de ne l'appeler qu'au sein de pages php, les classes devant
|
||||||
* renvoyer leur erreur par l'intermediaire de leur propriete "error".
|
* renvoyer leur erreur par l'intermediaire de leur propriete "error".
|
||||||
*
|
*
|
||||||
* @param DoliDB $db Database handler
|
* @param DoliDB $db Database handler
|
||||||
* @param string $error String or array of errors strings to show
|
* @param string $error String or array of errors strings to show
|
||||||
* @return void
|
* @return void
|
||||||
* @see dol_htmloutput_errors
|
* @see dol_htmloutput_errors
|
||||||
*/
|
*/
|
||||||
function dol_print_error($db='',$error='')
|
function dol_print_error($db='',$error='')
|
||||||
|
|||||||
@@ -122,8 +122,9 @@ if ($action == 'add')
|
|||||||
{
|
{
|
||||||
$ent = "entl".$i;
|
$ent = "entl".$i;
|
||||||
$idl = "idl".$i;
|
$idl = "idl".$i;
|
||||||
$entrepot_id = GETPOST($ent,'int')?GETPOST($ent,'int'):GETPOST('entrepot_id','int');
|
$entrepot_id = is_numeric(GETPOST($ent,'int'))?GETPOST($ent,'int'):GETPOST('entrepot_id','int');
|
||||||
|
if ($entrepot_id < 0) $entrepot_id='';
|
||||||
|
|
||||||
$ret=$object->addline($entrepot_id,GETPOST($idl,'int'),GETPOST($qty,'int'));
|
$ret=$object->addline($entrepot_id,GETPOST($idl,'int'),GETPOST($qty,'int'));
|
||||||
if ($ret < 0)
|
if ($ret < 0)
|
||||||
{
|
{
|
||||||
@@ -779,21 +780,19 @@ if ($action == 'create')
|
|||||||
print '<td align="left">';
|
print '<td align="left">';
|
||||||
if ($line->product_type == 0 || ! empty($conf->global->STOCK_SUPPORTS_SERVICES))
|
if ($line->product_type == 0 || ! empty($conf->global->STOCK_SUPPORTS_SERVICES))
|
||||||
{
|
{
|
||||||
// Show warehous
|
// Show warehouse combo list
|
||||||
if (GETPOST('entrepot_id','int'))
|
$ent = "entl".$indiceAsked;
|
||||||
|
$idl = "idl".$indiceAsked;
|
||||||
|
$tmpentrepot_id = is_numeric(GETPOST($ent,'int'))?GETPOST($ent,'int'):GETPOST('entrepot_id','int');
|
||||||
|
print $formproduct->selectWarehouses($tmpentrepot_id,'entl'.$indiceAsked,'',1,0,$line->fk_product);
|
||||||
|
if ($tmpentrepot_id && $tmpentrepot_id == GETPOST('entrepot_id','int'))
|
||||||
{
|
{
|
||||||
print $formproduct->selectWarehouses(GETPOST('entrepot_id','int'),'entl'.$indiceAsked,'',1,0,$line->fk_product);
|
|
||||||
//print $stock.' '.$quantityToBeDelivered;
|
//print $stock.' '.$quantityToBeDelivered;
|
||||||
//if ($stock >= 0 && $stock < $quantityToBeDelivered)
|
|
||||||
if ($stock < $quantityToBeDelivered)
|
if ($stock < $quantityToBeDelivered)
|
||||||
{
|
{
|
||||||
print ' '.img_warning($langs->trans("StockTooLow"));
|
print ' '.img_warning($langs->trans("StockTooLow")); // Stock too low for entrepot_id but we may have change warehouse
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
print $formproduct->selectWarehouses('','entl'.$indiceAsked,'',1,0,$line->fk_product);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ class FormProduct
|
|||||||
$this->loadWarehouses($fk_product);
|
$this->loadWarehouses($fk_product);
|
||||||
|
|
||||||
$out='<select class="flat"'.($disabled?' disabled="disabled"':'').' id="'.$htmlname.'" name="'.($htmlname.($disabled?'_disabled':'')).'">';
|
$out='<select class="flat"'.($disabled?' disabled="disabled"':'').' id="'.$htmlname.'" name="'.($htmlname.($disabled?'_disabled':'')).'">';
|
||||||
if ($empty) $out.='<option value=""> </option>';
|
if ($empty) $out.='<option value="-1"> </option>';
|
||||||
foreach($this->cache_warehouses as $id => $arraytypes)
|
foreach($this->cache_warehouses as $id => $arraytypes)
|
||||||
{
|
{
|
||||||
$out.='<option value="'.$id.'"';
|
$out.='<option value="'.$id.'"';
|
||||||
|
|||||||
@@ -1042,7 +1042,7 @@ class Product extends CommonObject
|
|||||||
// Check parameters
|
// Check parameters
|
||||||
if (! $id && ! $ref && ! $ref_ext)
|
if (! $id && ! $ref && ! $ref_ext)
|
||||||
{
|
{
|
||||||
$this->error=$langs->trans('ErrorWrongParameters');
|
$this->error='ErrorWrongParameters';
|
||||||
dol_print_error(get_class($this)."::fetch ".$this->error, LOG_ERR);
|
dol_print_error(get_class($this)."::fetch ".$this->error, LOG_ERR);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ class MouvementStock
|
|||||||
* @param int $price Unit price HT of product
|
* @param int $price Unit price HT of product
|
||||||
* @param string $label Label of stock movement
|
* @param string $label Label of stock movement
|
||||||
* @param string $datem Force date of movement
|
* @param string $datem Force date of movement
|
||||||
* @return int <0 if KO, >0 if OK
|
* @return int <0 if KO, 0 if fk_product is null, >0 if OK
|
||||||
*/
|
*/
|
||||||
function _create($user, $fk_product, $entrepot_id, $qty, $type, $price=0, $label='', $datem='')
|
function _create($user, $fk_product, $entrepot_id, $qty, $type, $price=0, $label='', $datem='')
|
||||||
{
|
{
|
||||||
@@ -65,13 +65,15 @@ class MouvementStock
|
|||||||
$error = 0;
|
$error = 0;
|
||||||
dol_syslog("MouvementStock::_create start userid=$user->id, fk_product=$fk_product, warehouse=$entrepot_id, qty=$qty, type=$type, price=$price label=$label");
|
dol_syslog("MouvementStock::_create start userid=$user->id, fk_product=$fk_product, warehouse=$entrepot_id, qty=$qty, type=$type, price=$price label=$label");
|
||||||
|
|
||||||
|
if (empty($fk_product)) return 0;
|
||||||
|
|
||||||
$now=(! empty($datem) ? $datem : dol_now());
|
$now=(! empty($datem) ? $datem : dol_now());
|
||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
$product = new Product($this->db);
|
$product = new Product($this->db);
|
||||||
$result=$product->fetch($fk_product);
|
$result=$product->fetch($fk_product);
|
||||||
if (! $result > 0)
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
dol_print_error('',"Failed to fetch product");
|
dol_print_error('',"Failed to fetch product");
|
||||||
return -1;
|
return -1;
|
||||||
|
|||||||
Reference in New Issue
Block a user