NEW #28871 signed_status to commande (#30359)

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
This commit is contained in:
Shanty
2024-07-16 15:22:54 +02:00
committed by GitHub
parent 1983c09ba4
commit 8c4f3534cc
3 changed files with 46 additions and 0 deletions

View File

@@ -218,6 +218,12 @@ class Commande extends CommonOrder
public $source; // Order mode. How we received order (by phone, by email, ...)
/**
* Status of the contract (0=NoSignature, 1=SignedBySender, 2=SignedByReceiver, 9=SignedByAll)
* @var int
*/
public $signed_status = 0;
/**
* @var int Warehouse Id
*/
@@ -307,6 +313,7 @@ class Commande extends CommonOrder
'localtax2' => array('type' => 'double(24,8)', 'label' => 'LocalTax2', 'enabled' => 1, 'visible' => -1, 'position' => 135, 'isameasure' => 1),
'total_ht' => array('type' => 'double(24,8)', 'label' => 'TotalHT', 'enabled' => 1, 'visible' => -1, 'position' => 140, 'isameasure' => 1),
'total_ttc' => array('type' => 'double(24,8)', 'label' => 'TotalTTC', 'enabled' => 1, 'visible' => -1, 'position' => 145, 'isameasure' => 1),
'signed_status' => array('type' => 'smallint(6)', 'label' => 'SignedStatus', 'enabled' => 1, 'visible' => -1, 'position' => 146, 'arrayofkeyval' => array(0 => 'NoSignature', 1 => 'SignedSender', 2 => 'SignedReceiver', 9 => 'SignedAll')),
'note_private' => array('type' => 'html', 'label' => 'NotePrivate', 'enabled' => 1, 'visible' => 0, 'position' => 150),
'note_public' => array('type' => 'html', 'label' => 'NotePublic', 'enabled' => 1, 'visible' => 0, 'position' => 155),
'model_pdf' => array('type' => 'varchar(255)', 'label' => 'PDFTemplate', 'enabled' => 1, 'visible' => 0, 'position' => 160),
@@ -375,6 +382,26 @@ class Commande extends CommonOrder
*/
const STATUS_CLOSED = 3;
/*
* No signature
*/
const STATUS_NO_SIGNATURE = 0;
/*
* Signed by sender
*/
CONST STATUS_SIGNED_SENDER = 1;
/*
* Signed by receiver
*/
CONST STATUS_SIGNED_RECEIVER = 2;
/*
* Signed by all
*/
CONST STATUS_SIGNED_ALL = 9; // To handle future kind of signature (ex: tripartite contract)
/**
* Constructor
@@ -4196,6 +4223,20 @@ class Commande extends CommonOrder
return $text;
}
/**
* Set signed status
*
* @param User $user Object user that modify
* @param int $status Newsigned status to set (often a constant like self::STATUS_XXX)
* @param int $notrigger 1 = Does not execute triggers, 0 = Execute triggers
* @param string $triggercode Trigger code to use
* @return int 0 < if KO, > 0 if OK
*/
public function setSignedStatus(User $user, int $status = 0, int $notrigger = 0, $triggercode = ''): int
{
return $this->setSignedStatusCommon($user, $status, $notrigger, $triggercode);
}
}