Clean code

This commit is contained in:
Laurent Destailleur 2023-04-26 11:41:02 +02:00
parent ff98cb10e3
commit 2f3cefcc09
4 changed files with 17 additions and 5 deletions

View File

@ -122,6 +122,7 @@ class Propal extends CommonObject
/** /**
* Status of the quote * Status of the quote
* @var int * @var int
* @deprecated Try to use $status now
* @see Propal::STATUS_DRAFT, Propal::STATUS_VALIDATED, Propal::STATUS_SIGNED, Propal::STATUS_NOTSIGNED, Propal::STATUS_BILLED * @see Propal::STATUS_DRAFT, Propal::STATUS_VALIDATED, Propal::STATUS_SIGNED, Propal::STATUS_NOTSIGNED, Propal::STATUS_BILLED
*/ */
public $statut; public $statut;
@ -1606,6 +1607,7 @@ class Propal extends CommonObject
$this->ref = $obj->ref; $this->ref = $obj->ref;
$this->ref_client = $obj->ref_client; $this->ref_client = $obj->ref_client;
$this->ref_customer = $obj->ref_client;
$this->ref_ext = $obj->ref_ext; $this->ref_ext = $obj->ref_ext;
$this->remise = $obj->remise; // TODO deprecated $this->remise = $obj->remise; // TODO deprecated

View File

@ -177,9 +177,6 @@ class Facture extends CommonInvoice
*/ */
public $ref_customer; public $ref_customer;
//Check constants for types
public $type = self::TYPE_STANDARD;
// Warning: Do not set default value into property defintion. it must stay null. // Warning: Do not set default value into property defintion. it must stay null.
// For example to avoid to have substition done when object is generic and not yet defined. // For example to avoid to have substition done when object is generic and not yet defined.
public $remise_absolue; public $remise_absolue;
@ -302,6 +299,7 @@ class Facture extends CommonInvoice
public $retained_warranty_fk_cond_reglement; public $retained_warranty_fk_cond_reglement;
/** /**
* 'type' if the field format ('integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter]]', 'varchar(x)', 'double(24,8)', 'real', 'price', 'text', 'html', 'date', 'datetime', 'timestamp', 'duration', 'mail', 'phone', 'url', 'password') * 'type' if the field format ('integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter]]', 'varchar(x)', 'double(24,8)', 'real', 'price', 'text', 'html', 'date', 'datetime', 'timestamp', 'duration', 'mail', 'phone', 'url', 'password')
* Note: Filter can be a string like "(t.ref:like:'SO-%') or (t.date_creation:<:'20160101') or (t.nature:is:NULL)" * Note: Filter can be a string like "(t.ref:like:'SO-%') or (t.date_creation:<:'20160101') or (t.nature:is:NULL)"
@ -492,7 +490,9 @@ class Facture extends CommonInvoice
if (empty($this->type)) { if (empty($this->type)) {
$this->type = self::TYPE_STANDARD; $this->type = self::TYPE_STANDARD;
} }
$this->ref_client = trim($this->ref_client); $this->ref_client = trim($this->ref_client);
$this->note = (isset($this->note) ? trim($this->note) : trim($this->note_private)); // deprecated $this->note = (isset($this->note) ? trim($this->note) : trim($this->note_private)); // deprecated
$this->note_private = (isset($this->note_private) ? trim($this->note_private) : trim($this->note_private)); $this->note_private = (isset($this->note_private) ? trim($this->note_private) : trim($this->note_private));
$this->note_public = trim($this->note_public); $this->note_public = trim($this->note_public);

View File

@ -33,6 +33,16 @@ abstract class CommonInvoice extends CommonObject
{ {
use CommonIncoterm; use CommonIncoterm;
/**
* @var int Type of invoice (See TYPE_XXX constants)
*/
public $type = self::TYPE_STANDARD;
/**
* @var int Sub type of invoice (A subtype code coming from llx_invoice_subtype table. May be used by some countries like Greece)
*/
public $subtype;
/** /**
* Standard invoice * Standard invoice
*/ */