Skip to content

Commit

Permalink
FIX trigger name and status set of setStatus for commercial proposal
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed May 5, 2017
1 parent 884b261 commit 90542d1
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions htdocs/core/class/commonobject.class.php
Expand Up @@ -2790,6 +2790,8 @@ function setStatut($status,$elementId=null,$elementType='')
{
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);
$elementTable = (!empty($elementType)?$elementType:$this->table_element);

Expand All @@ -2813,11 +2815,13 @@ function setStatut($status,$elementId=null,$elementType='')
$error = 0;

$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 == 2) $trigkey='FICHINTER_CLASSIFY_BILLED';
if ($this->element == 'fichinter' && $status == 1) $trigkey='FICHINTER_CLASSIFY_UNBILLED';

if ($trigkey)
{
// Appel des triggers
Expand All @@ -2833,12 +2837,14 @@ function setStatut($status,$elementId=null,$elementType='')
if (! $error)
{
$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->status = $status;
}
return 1;

return 1;
}
else
{
Expand Down

0 comments on commit 90542d1

Please sign in to comment.