WIP : rename fk_project to fk_actioncomm + add line to sql file to install

This commit is contained in:
atm-lena 2020-08-26 16:48:09 +02:00
parent a01d1b58c7
commit cc29654f47
5 changed files with 18 additions and 13 deletions

View File

@ -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 '<tr><td class="titlefieldcreate nowrap">'.$langs->trans("EMailTemplates").'</td><td colspan="3">';
print $form->select_model_mail('eventpush', 'event_push');
print $form->select_model_mail('agendasend', 'agenda_send');
print '</td></tr>';
@ -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();
};
});
})';

View File

@ -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

View File

@ -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;
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);

View File

@ -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);

View File

@ -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;