diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 18e836823e0..5465e00887a 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -69,7 +69,7 @@ $addreminder = GETPOST('addreminder'); $offsetvalue = GETPOST('offsetvalue'); $offsetunit = GETPOST('offsetunittype_duration'); $remindertype = GETPOST('selectremindertype'); -$modelmail = GETPOST('eventpushmodel_mail'); +$modelmail = GETPOST('agendasendmodel_mail'); //var_dump($_POST); exit; @@ -412,8 +412,8 @@ if (empty($reshook) && $action == 'add') $actionCommReminder->offsetunit = $offsetunit; $actionCommReminder->offsetvalue = $offsetvalue; $actionCommReminder->status = $actionCommReminder::STATUS_TODO; - $actionCommReminder->fk_project = $object->id; - //TODO : $fk_project + $actionCommReminder->fk_actioncomm = $object->id; + if($remindertype == 'email') $actionCommReminder->fk_email_template = $modelmail; $res = $actionCommReminder->create($user); } @@ -1181,7 +1181,7 @@ if ($action == 'create') //Mail Model print ''.$langs->trans("EMailTemplates").''; - print $form->select_model_mail('eventpush', 'event_push'); + print $form->select_model_mail('agendasend', 'agenda_send'); print ''; @@ -1201,9 +1201,9 @@ if ($action == 'create') $("#selectremindertype").click(function(){ var selected_option = $("#selectremindertype option:selected").val(); if(selected_option == "email") { - $("#select_eventpushmodel_mail").closest("tr").show(); + $("#select_agendasendmodel_mail").closest("tr").show(); } else { - $("#select_eventpushmodel_mail").closest("tr").hide(); + $("#select_agendasendmodel_mail").closest("tr").hide(); }; }); })'; diff --git a/htdocs/comm/action/class/actioncommreminder.class.php b/htdocs/comm/action/class/actioncommreminder.class.php index 383acddb70c..9e7f8f62fc1 100644 --- a/htdocs/comm/action/class/actioncommreminder.class.php +++ b/htdocs/comm/action/class/actioncommreminder.class.php @@ -81,8 +81,8 @@ class ActionCommReminder extends CommonObject 'offsetvalue' => array('type'=>'integer', 'label'=>'OffsetValue', 'visible'=>1, 'enabled'=>1, 'position'=>56, 'notnull'=>1,), 'offsetunit' => array('type'=>'varchar(1)', 'label'=>'OffsetUnit', 'visible'=>1, 'enabled'=>1, 'position'=>57, 'notnull'=>1, 'comment'=>"m, h, d, w",), 'status' => array('type'=>'integer', 'label'=>'Status', 'visible'=>1, 'enabled'=>1, 'position'=>58, 'notnull'=>1, 'default'=>0, 'index'=>0, 'arrayofkeyval'=>array('0'=>'ToDo', '1'=>'Done')), - 'fk_project' => array('type'=>'integer', 'label'=>'Project', 'visible'=>1, 'enabled'=>1, 'position'=>59, 'notnull'=>1), - 'fk_email_template' => array('type'=>'integer', 'label'=>'Project', 'visible'=>1, 'enabled'=>1, 'position'=>59, 'notnull'=>0), + 'fk_actioncomm' => array('type'=>'integer', 'label'=>'Project', 'visible'=>1, 'enabled'=>1, 'position'=>59, 'notnull'=>1), + 'fk_email_template' => array('type'=>'integer', 'label'=>'EmailTemplate', 'visible'=>1, 'enabled'=>1, 'position'=>60, 'notnull'=>0), ); /** @@ -114,7 +114,7 @@ class ActionCommReminder extends CommonObject /** * @var int Project */ - public $fk_project; + public $fk_actioncomm; /** * @var int Template Mail diff --git a/htdocs/install/mysql/migration/12.0.0-13.0.0.sql b/htdocs/install/mysql/migration/12.0.0-13.0.0.sql index 676655815dc..3a6d9a98d0b 100644 --- a/htdocs/install/mysql/migration/12.0.0-13.0.0.sql +++ b/htdocs/install/mysql/migration/12.0.0-13.0.0.sql @@ -282,5 +282,6 @@ insert into llx_c_action_trigger (code,label,description,elementtype,rang) value insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('RECRUITMENTCANDIDATURE_DELETE','Candidature deleted','Executed when a candidature is deleted','recruitment',7516); ALTER TABLE llx_actioncomm_reminder ADD COLUMN entity integer NOT NULL DEFAULT 1; -ALTER TABLE llx_actioncomm_reminder ADD COLUMN fk_project integer NOT NULL; -ALTER TABLE llx_actioncomm_reminder ADD COLUMN fk_email_template integer; \ No newline at end of file +ALTER TABLE llx_actioncomm_reminder ADD COLUMN fk_actioncomm integer NOT NULL; +ALTER TABLE llx_actioncomm_reminder ADD COLUMN fk_email_template integer; +ALTER TABLE llx_actioncomm_reminder DROP INDEX uk_actioncomm_reminder_unique, ADD UNIQUE uk_actioncomm_reminder_unique (fk_user, typeremind, offsetvalue, offsetunit, fk_actioncomm); \ No newline at end of file diff --git a/htdocs/install/mysql/tables/llx_actioncomm_reminder.key.sql b/htdocs/install/mysql/tables/llx_actioncomm_reminder.key.sql index 94e50d05634..634e474782a 100644 --- a/htdocs/install/mysql/tables/llx_actioncomm_reminder.key.sql +++ b/htdocs/install/mysql/tables/llx_actioncomm_reminder.key.sql @@ -20,6 +20,6 @@ ALTER TABLE llx_actioncomm_reminder ADD INDEX idx_actioncomm_reminder_dateremind ALTER TABLE llx_actioncomm_reminder ADD INDEX idx_actioncomm_reminder_fk_user (fk_user); -- END MODULEBUILDER INDEXES -ALTER TABLE llx_actioncomm_reminder ADD UNIQUE INDEX uk_actioncomm_reminder_unique(fk_user, typeremind, offsetvalue, offsetunit); +ALTER TABLE llx_actioncomm_reminder ADD UNIQUE INDEX uk_actioncomm_reminder_unique(fk_actioncomm, fk_user, typeremind, offsetvalue, offsetunit); diff --git a/htdocs/install/mysql/tables/llx_actioncomm_reminder.sql b/htdocs/install/mysql/tables/llx_actioncomm_reminder.sql index 2edb11c45c5..78dd00d6ea5 100644 --- a/htdocs/install/mysql/tables/llx_actioncomm_reminder.sql +++ b/htdocs/install/mysql/tables/llx_actioncomm_reminder.sql @@ -22,6 +22,10 @@ CREATE TABLE llx_actioncomm_reminder( fk_user integer NOT NULL, offsetvalue integer NOT NULL, offsetunit varchar(1) NOT NULL, - status integer NOT NULL DEFAULT 0 + status integer NOT NULL DEFAULT 0, + entity integer NOT NULL DEFAULT 1, + fk_actioncomm integer NOT NULL, + fk_email_template integer + -- END MODULEBUILDER FIELDS ) ENGINE=innodb;