Skip to content

Commit

Permalink
Merge branch '7.0' of git@github.com:Dolibarr/dolibarr.git into 8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Jan 30, 2019
2 parents 41e20a9 + 231395d commit ae1c4e0
Showing 1 changed file with 32 additions and 7 deletions.
39 changes: 32 additions & 7 deletions htdocs/compta/sociales/class/chargesociales.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -288,10 +288,12 @@ function delete($user)
* Met a jour une charge sociale
*
* @param User $user Utilisateur qui modifie
* @param int $notrigger 0=launch triggers after, 1=disable triggers
* @return int <0 si erreur, >0 si ok
*/
function update($user)
function update($user,$notrigger=0)
{
$error=0;
$this->db->begin();

$sql = "UPDATE ".MAIN_DB_PREFIX."chargesociales";
Expand All @@ -305,17 +307,40 @@ function update($user)

dol_syslog(get_class($this)."::update", LOG_DEBUG);
$resql=$this->db->query($sql);
if ($resql)

if (! $resql) {
$error++; $this->errors[]="Error ".$this->db->lasterror();
}

if (! $error)
{
$this->db->commit();
return 1;
if (! $notrigger)
{
// Call trigger
$result=$this->call_trigger('SOCIALCHARGES_MODIFY',$user);
if ($result < 0) $error++;
// End call triggers
}
}
else

// Commit or rollback
if ($error)
{
$this->error=$this->db->error();
foreach($this->errors as $errmsg)
{
dol_syslog(get_class($this)."::update ".$errmsg, LOG_ERR);
$this->error.=($this->error?', '.$errmsg:$errmsg);
}
$this->db->rollback();
return -1;
return -1*$error;
}
else
{
$this->db->commit();
return 1;
}


}

/**
Expand Down

0 comments on commit ae1c4e0

Please sign in to comment.