128 |
{ |
{ |
129 |
global $langs,$conf; |
global $langs,$conf; |
130 |
|
|
131 |
|
// Nettoyage paramètres |
132 |
$this->nom=trim($this->nom); |
$this->nom=trim($this->nom); |
133 |
|
|
134 |
|
dolibarr_syslog("societe.class.php::create ".$this->nom); |
135 |
|
|
136 |
$this->db->begin(); |
$this->db->begin(); |
137 |
|
|
138 |
$result = $this->verify(); |
$result = $this->verify(); |
151 |
|
|
152 |
$ret = $this->update($this->id,$user,0); |
$ret = $this->update($this->id,$user,0); |
153 |
|
|
154 |
if ($ret == 0) |
if ($ret > 0) |
155 |
{ |
{ |
156 |
$this->use_webcal=($conf->global->PHPWEBCALENDAR_COMPANYCREATE=='always'?1:0); |
$this->use_webcal=($conf->global->PHPWEBCALENDAR_COMPANYCREATE=='always'?1:0); |
157 |
|
|
176 |
else |
else |
177 |
|
|
178 |
{ |
{ |
179 |
if ($this->db->errno() == DB_ERROR_RECORD_ALREADY_EXISTS) |
if ($this->db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') |
180 |
{ |
{ |
181 |
|
|
182 |
$this->error=$langs->trans("ErrorCompanyNameAlreadyExists",$this->nom); |
$this->error=$langs->trans("ErrorCompanyNameAlreadyExists",$this->nom); |
252 |
* \param id id societe |
* \param id id societe |
253 |
* \param user Utilisateur qui demande la mise à jour |
* \param user Utilisateur qui demande la mise à jour |
254 |
* \param call_trigger 0=non, 1=oui |
* \param call_trigger 0=non, 1=oui |
255 |
* \return int 0 si ok, < 0 si erreur |
* \return int <0 si ko, >0 si erreur |
256 |
*/ |
*/ |
257 |
function update($id, $user='', $call_trigger=1) |
function update($id, $user='', $call_trigger=1) |
258 |
{ |
{ |