diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index f6ff8570fed..915a1410933 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -212,21 +212,21 @@ class Categorie extends CommonObject } } else if ($reshook < 0) $error++; - + // Call trigger $result=$this->call_trigger('CATEGORY_CREATE',$user); - if ($result < 0) { $error++; } + if ($result < 0) { $error++; } // End call triggers if ( ! $error ) - { - $this->db->rollback(); - return -3; - } - else { $this->db->commit(); return $id; + } + else + { + $this->db->rollback(); + return -3; } } else @@ -310,7 +310,7 @@ class Categorie extends CommonObject // Call trigger $result=$this->call_trigger('CATEGORY_MODIFY',$user); - if ($result < 0) { $error++; $this->db->rollback(); return -1; } + if ($result < 0) { $error++; $this->db->rollback(); return -1; } // End call triggers return 1; @@ -430,7 +430,7 @@ class Categorie extends CommonObject } // Call trigger $result=$this->call_trigger('CATEGORY_DELETE',$user); - if ($result < 0) { $error++; } + if ($result < 0) { $error++; } // End call triggers } } @@ -472,7 +472,7 @@ class Categorie extends CommonObject if ($type=='fournisseur') $column_name='societe'; $this->db->begin(); - + $sql = "INSERT INTO ".MAIN_DB_PREFIX."categorie_".$type." (fk_categorie, fk_".$column_name.")"; $sql .= " VALUES (".$this->id.", ".$obj->id.")"; @@ -523,7 +523,7 @@ class Categorie extends CommonObject // Call trigger $result=$this->call_trigger('CATEGORY_LINK',$user); - if ($result < 0) { $error++; } + if ($result < 0) { $error++; } // End call triggers if (! $error) @@ -532,11 +532,11 @@ class Categorie extends CommonObject return 1; } else - { + { $this->db->rollback(); return -2; } - + } else { @@ -575,7 +575,7 @@ class Categorie extends CommonObject $column_name=$type; if ($type=='contact') $column_name='socpeople'; if ($type=='fournisseur') $column_name='societe'; - + $this->db->begin(); $sql = "DELETE FROM ".MAIN_DB_PREFIX."categorie_".$type; @@ -590,7 +590,7 @@ class Categorie extends CommonObject // Call trigger $result=$this->call_trigger('CATEGORY_UNLINK',$user); - if ($result < 0) { $error++; } + if ($result < 0) { $error++; } // End call triggers if (! $error) @@ -601,7 +601,7 @@ class Categorie extends CommonObject else { $this->db->rollback(); - return -2; + return -2; } } else diff --git a/htdocs/install/mysql/migration/3.6.0-3.7.0.sql b/htdocs/install/mysql/migration/3.6.0-3.7.0.sql index c95c4500fb8..a3f128b8afa 100644 --- a/htdocs/install/mysql/migration/3.6.0-3.7.0.sql +++ b/htdocs/install/mysql/migration/3.6.0-3.7.0.sql @@ -101,7 +101,7 @@ create table llx_accounting_fiscalyear statut tinyint DEFAULT 0 NOT NULL, entity integer DEFAULT 1 NOT NULL, -- multi company id datec datetime NOT NULL, - tms timestamp NULL, + tms timestamp, fk_user_author integer NULL, fk_user_modif integer NULL )ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_accounting_fiscalyear.sql b/htdocs/install/mysql/tables/llx_accounting_fiscalyear.sql index eba284e4002..569c22dd57e 100644 --- a/htdocs/install/mysql/tables/llx_accounting_fiscalyear.sql +++ b/htdocs/install/mysql/tables/llx_accounting_fiscalyear.sql @@ -25,7 +25,7 @@ create table llx_accounting_fiscalyear statut tinyint DEFAULT 0 NOT NULL, entity integer DEFAULT 1 NOT NULL, -- multi company id datec datetime NOT NULL, - tms timestamp DEFAULT NULL, + tms timestamp, fk_user_author integer DEFAULT NULL, fk_user_modif integer DEFAULT NULL )ENGINE=innodb;