diff --git a/htdocs/core/tpl/objectline_edit.tpl.php b/htdocs/core/tpl/objectline_edit.tpl.php
index 00fc4f8e885..0864d8e4054 100644
--- a/htdocs/core/tpl/objectline_edit.tpl.php
+++ b/htdocs/core/tpl/objectline_edit.tpl.php
@@ -72,9 +72,13 @@ $coldisplay=-1; // We remove first td
+
fk_product > 0) { ?>
+ fk_parent_line > 0) echo img_picto('', 'rightarrow');
+ ?>
product_type==1) echo img_object($langs->trans('ShowService'),'service');
diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php
index 5848c1b9d9d..3ab96fed1fa 100644
--- a/htdocs/expedition/class/expedition.class.php
+++ b/htdocs/expedition/class/expedition.class.php
@@ -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;
}