Skip to content

Commit

Permalink
set object entity at create
Browse files Browse the repository at this point in the history
  • Loading branch information
frederic34 committed Nov 20, 2024
1 parent 1386d8c commit 51f9d76
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
11 changes: 9 additions & 2 deletions htdocs/fourn/class/fournisseur.commande.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ class CommandeFournisseur extends CommonOrder

/**
* @var ?int<0,9>
* @deprecated see $status
* @see $status
*/
public $statut; // 0=Draft -> 1=Validated -> 2=Approved -> 3=Ordered/Process running -> 4=Received partially -> 5=Received totally -> (reopen) 4=Received partially
// -> 7=Canceled/Never received -> (reopen) 3=Process running
Expand Down Expand Up @@ -892,7 +894,7 @@ public function valid($user, $idwarehouse = 0, $notrigger = 0)
*/
public function getLibStatut($mode = 0)
{
return $this->LibStatut($this->statut, $mode, $this->billed);
return $this->LibStatut($this->status, $mode, $this->billed);
}

// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
Expand Down Expand Up @@ -992,7 +994,7 @@ public function getTooltipContentArray($params)

if ($user->hasRight("fournisseur", "commande", "read")) {
$datas['picto'] = '<u class="paddingrightonly">'.$langs->trans("SupplierOrder").'</u>';
if ($this->statut) {
if ($this->status) {
$datas['picto'] .= ' '.$this->getLibStatut(5);
}
if (!empty($this->ref)) {
Expand Down Expand Up @@ -1156,6 +1158,7 @@ public function getNextNumRef($soc)

$obj = new $classname();
'@phan-var-force ModeleNumRefSuppliersOrders $obj';
/** @var ModeleNumRefSuppliersOrders $obj */
$numref = $obj->getNextValue($soc, $this);

if ($numref != "") {
Expand All @@ -1169,6 +1172,7 @@ public function getNextNumRef($soc)
return -2;
}
}

/**
* Class invoiced the supplier order
*
Expand Down Expand Up @@ -1598,6 +1602,9 @@ public function create($user, $notrigger = 0)
$this->fk_multicurrency = 0;
$this->multicurrency_tx = 1;
}
if (empty($this->entity)) {
$this->entity = setEntity($this);
}

// We set order into draft status
$this->statut = self::STATUS_DRAFT; // deprecated
Expand Down
3 changes: 3 additions & 0 deletions htdocs/fourn/class/fournisseur.facture.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,9 @@ public function create($user)
$this->fk_multicurrency = 0;
$this->multicurrency_tx = 1;
}
if (empty($this->entity)) {
$this->entity = setEntity($this);
}

$this->db->begin();

Expand Down

0 comments on commit 51f9d76

Please sign in to comment.