Fix column too low.

Fix automatic event not found if from a module with several objects
This commit is contained in:
Laurent Destailleur 2019-12-17 14:47:58 +01:00
parent af4288ff3f
commit 4a734e53a6
4 changed files with 27 additions and 4 deletions

View File

@ -40,6 +40,7 @@ $cancel = GETPOST('cancel', 'alpha');
$search_event = GETPOST('search_event', 'alpha');
// Get list of triggers available
$triggers = array();
$sql = "SELECT a.rowid, a.code, a.label, a.elementtype, a.rang as position";
$sql .= " FROM ".MAIN_DB_PREFIX."c_action_trigger as a";
$sql .= " ORDER BY a.rang ASC";
@ -169,6 +170,12 @@ if (!empty($triggers))
if ($module == 'project') $module = 'projet';
if ($module == 'proposal_supplier') $module = 'supplier_proposal';
// If 'element' value is myobject@mymodule instead of mymodule
$tmparray = explode('@', $module);
if (! empty($tmparray[1])) {
$module = $tmparray[1];
}
//print 'module='.$module.'<br>';
if (!empty($conf->$module->enabled))
{

View File

@ -59,6 +59,8 @@ ALTER TABLE llx_emailcollector_emailcollectoraction ADD COLUMN position integer
-- For v11
ALTER TABLE llx_c_action_trigger MODIFY COLUMN elementtype varchar(64) NOT NULL;
ALTER TABLE llx_societe_account ADD COLUMN site_account varchar(128);
UPDATE llx_holiday SET ref = rowid WHERE ref IS NULL;

View File

@ -22,7 +22,7 @@
create table llx_c_action_trigger
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
elementtype varchar(32) NOT NULL,
elementtype varchar(64) NOT NULL,
code varchar(32) NOT NULL,
label varchar(128) NOT NULL,
description varchar(255),

View File

@ -13,6 +13,20 @@
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <https://www.gnu.org/licenses/>.
INSERT INTO llx_mymodule_myobject VALUES (
1, 1, 'mydata'
);
-- delete from llx_mymodule_myobject;
--INSERT INTO llx_mymodule_myobject VALUES (1, 1, 'mydata');
-- delete from llx_c_mydictionarytabme;
--INSERT INTO llx_c_mydictionarytabme (code,label,active) VALUES ('ABC', 'Label ABC', 1);
--INSERT INTO llx_c_mydictionarytabme (code,label,active) VALUES ('DEF', 'Label DEF', 1);
-- new types of automatic events to record in agenda
-- 'code' must be a value matching 'MYOBJECT_ACTION'
-- 'elementtype' must be value 'mymodule' ('myobject@mymodule' may be possible but should not be required)
--insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MYOBJECT_VALIDATE','MyObject validated','Executed when myobject is validated', 'mymodule', 1000);
--insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MYOBJECT_UNVALIDATE','MyObject unvalidated','Executed when myobject is unvalidated', 'mymodule', 1001);
--insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MYOBJECT_DELETE','MyObject deleted','Executed when myobject deleted', 'mymodule', 1004);