Fix:[ bug #653 ] Error while creating additional attributes
This commit is contained in:
parent
717657dd05
commit
201829e60c
@ -228,7 +228,7 @@ class ActionComm extends CommonObject
|
||||
}
|
||||
else if ($reshook < 0) $error++;
|
||||
|
||||
if (! $notrigger)
|
||||
if (! $error && ! $notrigger)
|
||||
{
|
||||
// Appel des triggers
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||
@ -240,8 +240,16 @@ class ActionComm extends CommonObject
|
||||
// Fin appel triggers
|
||||
}
|
||||
|
||||
$this->db->commit();
|
||||
return $this->id;
|
||||
if (! $error)
|
||||
{
|
||||
$this->db->commit();
|
||||
return $this->id;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -591,7 +599,7 @@ class ActionComm extends CommonObject
|
||||
$now=dol_now();
|
||||
|
||||
$this->nbtodo=$this->nbtodolate=0;
|
||||
|
||||
|
||||
$sql = "SELECT a.id, a.datep as dp";
|
||||
$sql.= " FROM (".MAIN_DB_PREFIX."actioncomm as a";
|
||||
$sql.= ")";
|
||||
|
||||
@ -243,19 +243,19 @@ if ($action == 'add_action')
|
||||
}
|
||||
else
|
||||
{
|
||||
// Si erreur
|
||||
// If error
|
||||
$db->rollback();
|
||||
$id=$idaction;
|
||||
$langs->load("errors");
|
||||
$error=$langs->trans($actioncomm->error);
|
||||
$action = 'create';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$db->rollback();
|
||||
$id=$idaction;
|
||||
$langs->load("errors");
|
||||
$error=$langs->trans($actioncomm->error);
|
||||
$action = 'create';
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -619,7 +619,7 @@ if ($action == 'create')
|
||||
print $extrafields->showInputField($key,$value);
|
||||
print '</td></tr>'."\n";
|
||||
}
|
||||
print '</table><br><br>';
|
||||
print '</table><br>';
|
||||
}
|
||||
|
||||
print '<center><br>';
|
||||
@ -632,7 +632,7 @@ if ($action == 'create')
|
||||
}
|
||||
|
||||
// View or edit
|
||||
if ($id)
|
||||
if ($id > 0)
|
||||
{
|
||||
if ($error)
|
||||
{
|
||||
|
||||
@ -264,9 +264,20 @@ create table llx_socpeople_extrafields
|
||||
fk_object integer NOT NULL,
|
||||
import_key varchar(14) -- import key
|
||||
) ENGINE=innodb;
|
||||
|
||||
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');
|
||||
|
||||
|
||||
|
||||
20
htdocs/install/mysql/tables/llx_actioncomm_extrafields.key.sql
Executable file
20
htdocs/install/mysql/tables/llx_actioncomm_extrafields.key.sql
Executable 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);
|
||||
26
htdocs/install/mysql/tables/llx_actioncomm_extrafields.sql
Executable file
26
htdocs/install/mysql/tables/llx_actioncomm_extrafields.sql
Executable 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;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user