Merge branch '5.0' of git@github.com:Dolibarr/dolibarr.git into 5.0

This commit is contained in:
Laurent Destailleur 2017-07-08 18:10:02 +02:00
commit 4290be7ee6
3 changed files with 57 additions and 41 deletions

View File

@ -228,7 +228,7 @@ class Contrat extends CommonObject
*/ */
function active_line($user, $line_id, $date, $date_end='', $comment='') function active_line($user, $line_id, $date, $date_end='', $comment='')
{ {
$this->lines[$this->lines_id_index_mapper[$line_id]]->active_line($user, $date, $date_end, $comment); return $this->lines[$this->lines_id_index_mapper[$line_id]]->active_line($user, $date, $date_end, $comment);
} }
@ -243,7 +243,7 @@ class Contrat extends CommonObject
*/ */
function close_line($user, $line_id, $date_end, $comment='') function close_line($user, $line_id, $date_end, $comment='')
{ {
$this->lines[$this->lines_id_index_mapper[$line_id]]->close_line($user, $date_end, $comment); return $this->lines[$this->lines_id_index_mapper[$line_id]]->close_line($user, $date_end, $comment);
} }

View File

@ -600,6 +600,20 @@ abstract class CommonObject
$datecreate = dol_now(); $datecreate = dol_now();
// Socpeople must have already been added by some a trigger, then we have to check it to avoid DB_ERROR_RECORD_ALREADY_EXISTS error
$TListeContacts=$this->liste_contact(-1, $source);
$already_added=false;
if(!empty($TListeContacts)) {
foreach($TListeContacts as $array_contact) {
if($array_contact['status'] == 4 && $array_contact['id'] == $fk_socpeople && $array_contact['fk_c_type_contact'] == $id_type_contact) {
$already_added=true;
break;
}
}
}
if(!$already_added) {
$this->db->begin(); $this->db->begin();
// Insertion dans la base // Insertion dans la base
@ -632,6 +646,7 @@ abstract class CommonObject
{ {
$this->error=$this->db->errno(); $this->error=$this->db->errno();
$this->db->rollback(); $this->db->rollback();
echo 'err rollback';
return -2; return -2;
} }
else else
@ -641,6 +656,7 @@ abstract class CommonObject
return -1; return -1;
} }
} }
} else return 0;
} }
/** /**

View File

@ -878,7 +878,7 @@ if (empty($reshook))
} }
// Actions to build doc // Actions to build doc
$upload_dir = $conf->commande->dir_output; $upload_dir = $conf->fournisseur->commande->dir_output;
$permissioncreate = $user->rights->fournisseur->commande->creer; $permissioncreate = $user->rights->fournisseur->commande->creer;
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';