FIX trigger name and status set of setStatus for commercial proposal

This commit is contained in:
Laurent Destailleur 2017-05-05 13:25:30 +02:00
parent 884b261df5
commit 90542d119a

View File

@ -2790,6 +2790,8 @@ abstract class CommonObject
{ {
global $user,$langs,$conf; global $user,$langs,$conf;
$savElementId=$elementId; // To be used later to know if we were using the method using the id of this or not.
$elementId = (!empty($elementId)?$elementId:$this->id); $elementId = (!empty($elementId)?$elementId:$this->id);
$elementTable = (!empty($elementType)?$elementType:$this->table_element); $elementTable = (!empty($elementType)?$elementType:$this->table_element);
@ -2813,7 +2815,9 @@ abstract class CommonObject
$error = 0; $error = 0;
$trigkey=''; $trigkey='';
if ($this->element == 'supplier_proposal' && $status == 2) $trigkey='SUPPLIER_PROPOSAL_CLOSE'; if ($this->element == 'supplier_proposal' && $status == 2) $trigkey='SUPPLIER_PROPOSAL_SIGN'; // 2 = SupplierProposal::STATUS_SIGNED. Can't use constant into this generic class
if ($this->element == 'supplier_proposal' && $status == 3) $trigkey='SUPPLIER_PROPOSAL_REFUSE'; // 3 = SupplierProposal::STATUS_REFUSED. Can't use constant into this generic class
if ($this->element == 'supplier_proposal' && $status == 4) $trigkey='SUPPLIER_PROPOSAL_CLOSE'; // 4 = SupplierProposal::STATUS_CLOSED. Can't use constant into this generic class
if ($this->element == 'fichinter' && $status == 3) $trigkey='FICHINTER_CLASSIFY_DONE'; if ($this->element == 'fichinter' && $status == 3) $trigkey='FICHINTER_CLASSIFY_DONE';
if ($this->element == 'fichinter' && $status == 2) $trigkey='FICHINTER_CLASSIFY_BILLED'; if ($this->element == 'fichinter' && $status == 2) $trigkey='FICHINTER_CLASSIFY_BILLED';
if ($this->element == 'fichinter' && $status == 1) $trigkey='FICHINTER_CLASSIFY_UNBILLED'; if ($this->element == 'fichinter' && $status == 1) $trigkey='FICHINTER_CLASSIFY_UNBILLED';
@ -2833,12 +2837,14 @@ abstract class CommonObject
if (! $error) if (! $error)
{ {
$this->db->commit(); $this->db->commit();
if (empty($elementId)) // If the element we update was $this (so $elementId is null)
if (empty($savElementId)) // If the element we update was $this (so $elementId is null)
{ {
$this->statut = $status; $this->statut = $status;
$this->status = $status; $this->status = $status;
} }
return 1;
return 1;
} }
else else
{ {