Merge branch '7.0' of git@github.com:Dolibarr/dolibarr.git into 8.0

Conflicts:
	htdocs/expedition/class/expedition.class.php
This commit is contained in:
Laurent Destailleur 2019-02-08 10:22:36 +01:00
commit 679a13e48c
2 changed files with 18 additions and 7 deletions

View File

@ -72,9 +72,13 @@ $coldisplay=-1; // We remove first td
<input type="hidden" id="product_type" name="type" value="<?php echo $line->product_type; ?>">
<input type="hidden" id="product_id" name="productid" value="<?php echo (! empty($line->fk_product)?$line->fk_product:0); ?>" />
<input type="hidden" id="special_code" name="special_code" value="<?php echo $line->special_code; ?>">
<input type="hidden" id="fk_parent_line" name="fk_parent_line" value="<?php echo $line->fk_parent_line; ?>">
<?php if ($line->fk_product > 0) { ?>
<?php
if ($line->fk_parent_line > 0) echo img_picto('', 'rightarrow');
?>
<a href="<?php echo DOL_URL_ROOT.'/product/card.php?id='.$line->fk_product; ?>">
<?php
if ($line->product_type==1) echo img_object($langs->trans('ShowService'),'service');

View File

@ -531,7 +531,7 @@ class Expedition extends CommonObject
$this->db->free($result);
if ($this->statut == 0) $this->brouillon = 1;
if ($this->statut == self::STATUS_DRAFT) $this->brouillon = 1;
// Tracking url
$this->GetUrlTrackingStatus($obj->tracking_number);
@ -772,7 +772,7 @@ class Expedition extends CommonObject
if (! $error)
{
$this->ref = $numref;
$this->statut = 1;
$this->statut = self::STATUS_VALIDATED;
}
if (! $error)
@ -805,7 +805,7 @@ class Expedition extends CommonObject
if ($conf->livraison_bon->enabled)
{
if ($this->statut == 1 || $this->statut == 2)
if ($this->statut == self::STATUS_VALIDATED || $this->statut == self::STATUS_CLOSED)
{
// Expedition validee
include_once DOL_DOCUMENT_ROOT.'/livraison/class/livraison.class.php';
@ -1111,7 +1111,7 @@ class Expedition extends CommonObject
}
// Stock control
if (! $error && $conf->stock->enabled && $conf->global->STOCK_CALCULATE_ON_SHIPMENT && $this->statut > 0)
if (! $error && $conf->stock->enabled && $conf->global->STOCK_CALCULATE_ON_SHIPMENT && $this->statut > self::STATUS_DRAFT)
{
require_once(DOL_DOCUMENT_ROOT."/product/stock/class/mouvementstock.class.php");
@ -1658,7 +1658,7 @@ class Expedition extends CommonObject
$this->id=0;
$this->ref = 'SPECIMEN';
$this->specimen=1;
$this->statut = 1;
$this->statut = self::STATUS_VALIDATED;
$this->livraison_id = 0;
$this->date = $now;
$this->date_creation = $now;
@ -2032,6 +2032,7 @@ class Expedition extends CommonObject
}
else
{
$this->statut = self::STATUS_VALIDATED;
$this->db->rollback();
return -1;
}
@ -2055,7 +2056,7 @@ class Expedition extends CommonObject
$resql=$this->db->query($sql);
if ($resql)
{
$this->statut=2;
$this->statut=self::STATUS_CLOSED;
$this->billed=1;
// Call trigger
@ -2075,6 +2076,8 @@ class Expedition extends CommonObject
}
else
{
$this->statut=self::STATUS_VALIDATED;
$this->billed=0;
$this->db->rollback();
return -1;
}
@ -2099,13 +2102,15 @@ class Expedition extends CommonObject
$this->db->begin();
$oldbilled=$this->billed;
$sql = 'UPDATE '.MAIN_DB_PREFIX.'expedition SET fk_statut=1';
$sql .= ' WHERE rowid = '.$this->id.' AND fk_statut > 0';
$resql=$this->db->query($sql);
if ($resql)
{
$this->statut=1;
$this->statut=self::STATUS_VALIDATED;
$this->billed=0;
// If stock increment is done on closing
@ -2203,6 +2208,8 @@ class Expedition extends CommonObject
}
else
{
$this->statut=self::STATUS_CLOSED;
$this->billed=$oldbilled;
$this->db->rollback();
return -1;
}