Use return code on activateAll and closeAll

This commit is contained in:
Laurent Destailleur 2017-09-03 15:40:36 +02:00
parent f963afa505
commit cf175b0777

View File

@ -252,7 +252,7 @@ class Contrat extends CommonObject
*
* @param User $user Object User making action
* @param int|string $date_start Date start (now if empty)
* @return void
* @return int <0 if KO, >0 if OK
*/
function activateAll($user, $date_start='')
{
@ -287,19 +287,21 @@ class Contrat extends CommonObject
if ($ok)
{
$this->db->commit();
return 0;
}
else
{
dol_print_error($this->db,'Error in activateAll function');
$this->db->rollback();
return -1;
}
}
/**
* Close all lines of a contract
*
* @param User $user Object User making action
* @return void
* @param User $user Object User making action
* @return int <0 if KO, >0 if OK
*/
function closeAll($user)
{
@ -335,11 +337,13 @@ class Contrat extends CommonObject
if ($ok)
{
$this->db->commit();
return 1;
}
else
{
dol_print_error($this->db,'Error in closeAll function');
$this->db->rollback();
return -1;
}
}