Fix:[ bug #653 ] Error while creating additional attributes

This commit is contained in:
Laurent Destailleur 2012-12-30 13:49:37 +01:00
parent 717657dd05
commit 201829e60c
5 changed files with 75 additions and 10 deletions

View File

@ -228,7 +228,7 @@ class ActionComm extends CommonObject
} }
else if ($reshook < 0) $error++; else if ($reshook < 0) $error++;
if (! $notrigger) if (! $error && ! $notrigger)
{ {
// Appel des triggers // Appel des triggers
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
@ -240,8 +240,16 @@ class ActionComm extends CommonObject
// Fin appel triggers // Fin appel triggers
} }
$this->db->commit(); if (! $error)
return $this->id; {
$this->db->commit();
return $this->id;
}
else
{
$this->db->rollback();
return -1;
}
} }
else else
{ {

View File

@ -243,19 +243,19 @@ if ($action == 'add_action')
} }
else else
{ {
// Si erreur // If error
$db->rollback(); $db->rollback();
$id=$idaction;
$langs->load("errors"); $langs->load("errors");
$error=$langs->trans($actioncomm->error); $error=$langs->trans($actioncomm->error);
$action = 'create';
} }
} }
else else
{ {
$db->rollback(); $db->rollback();
$id=$idaction;
$langs->load("errors"); $langs->load("errors");
$error=$langs->trans($actioncomm->error); $error=$langs->trans($actioncomm->error);
$action = 'create';
} }
} }
} }
@ -619,7 +619,7 @@ if ($action == 'create')
print $extrafields->showInputField($key,$value); print $extrafields->showInputField($key,$value);
print '</td></tr>'."\n"; print '</td></tr>'."\n";
} }
print '</table><br><br>'; print '</table><br>';
} }
print '<center><br>'; print '<center><br>';
@ -632,7 +632,7 @@ if ($action == 'create')
} }
// View or edit // View or edit
if ($id) if ($id > 0)
{ {
if ($error) if ($error)
{ {

View File

@ -264,9 +264,20 @@ create table llx_socpeople_extrafields
fk_object integer NOT NULL, fk_object integer NOT NULL,
import_key varchar(14) -- import key import_key varchar(14) -- import key
) ENGINE=innodb; ) ENGINE=innodb;
ALTER TABLE llx_socpeople_extrafields ADD INDEX idx_socpeople_extrafields (fk_object); ALTER TABLE llx_socpeople_extrafields ADD INDEX idx_socpeople_extrafields (fk_object);
create table llx_actioncomm_extrafields
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
tms timestamp,
fk_object integer NOT NULL,
import_key varchar(14) -- import key
) ENGINE=innodb;
ALTER TABLE llx_actioncomm_extrafields ADD INDEX idx_actioncomm_extrafields (fk_object);
UPDATE llx_c_actioncomm set type = 'systemauto' where code IN ('AC_PROP','AC_COM','AC_FAC','AC_SHIP','AC_SUP_ORD','AC_SUP_INV'); UPDATE llx_c_actioncomm set type = 'systemauto' where code IN ('AC_PROP','AC_COM','AC_FAC','AC_SHIP','AC_SUP_ORD','AC_SUP_INV');

View File

@ -0,0 +1,20 @@
-- ===================================================================
-- Copyright (C) 2011 Laurent Destailleur <eldy@users.sourceforge.net>
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 2 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
--
-- ===================================================================
ALTER TABLE llx_actioncomm_extrafields ADD INDEX idx_actioncomm_extrafields (fk_object);

View File

@ -0,0 +1,26 @@
-- ========================================================================
-- Copyright (C) 2011 Laurent Destailleur <eldy@users.sourceforge.net>
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 2 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
--
-- ========================================================================
create table llx_actioncomm_extrafields
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
tms timestamp,
fk_object integer NOT NULL,
import_key varchar(14) -- import key
) ENGINE=innodb;