Add "select_model_mail" function + add select to create event

This commit is contained in:
atm-lena 2020-08-25 17:26:32 +02:00
parent 6a94c0f52f
commit 7df993c7ed
3 changed files with 49 additions and 6 deletions

View File

@ -1118,23 +1118,30 @@ if ($action == 'create')
print '<table class="border centpercent">';
//Reminder
print '<tr><td class="titlefieldcreate nowrap">'.$langs->trans("Reminder").'</td><td colspan="3">';
print '<tr><td class="titlefieldcreate nowrap">'.$langs->trans("ReminderTime").'</td><td colspan="3">';
print '<input type="number" name="offsetvalue" value="10" size="5">';
print '</td></tr>';
//Reminder Type
print '<tr><td class="titlefieldcreate nowrap">'.$langs->trans("ReminderType").'</td><td colspan="3">';
//Time Type
print '<tr><td class="titlefieldcreate nowrap">'.$langs->trans("TimeType").'</td><td colspan="3">';
print $form->select_type_duration('offsetunit');
print '</td></tr>';
//Notification
//Reminder Type
$TRemindTypes = array();
if(!empty($conf->global->AGENDA_REMINDER_EMAIL)) $TRemindTypes['mail'] = $langs->trans('EMail');
if(!empty($conf->global->AGENDA_REMINDER_BROWSER)) $TRemindTypes['push'] = $langs->trans('OSNotif');
print '<tr><td class="titlefieldcreate nowrap">'.$langs->trans("TypeRemind").'</td><td colspan="3">';
print $form->selectarray('typeremind',$TRemindTypes);
print '<tr><td class="titlefieldcreate nowrap">'.$langs->trans("ReminderType").'</td><td colspan="3">';
print $form->selectarray('remindertype',$TRemindTypes);
print '</td></tr>';
//Mail Model
//TODO : ajouter les conditions pour l'affichage de ce champs : si au moins un model existe et si Email est le type de rappel sélectionné
print '<tr><td class="titlefieldcreate nowrap">'.$langs->trans("Model").'</td><td colspan="3">';
print $form->select_model_mail('eventpush', 'event_push');
print '</td></tr>';
print '</table>';
}

View File

@ -7965,4 +7965,37 @@ class Form
return $ret;
}
public function select_model_mail($prefix, $modelType = ''){
global $langs, $db, $user;
$retstring = '';
$TModels = array();
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
$formmail = new FormMail($db);
$result = $formmail->fetchAllEMailTemplate($modelType, $user, $langs);
if($result > 0){
foreach($formmail->lines_model as $model){
$TModels[$model->id] = $model->label;
}
}
$retstring .= '<select class="flat" id="select_'.$prefix.'model_mail" name="'.$prefix.'model_mail">';
foreach($TModels as $id_model=>$label_model){
$retstring .= '<option value="'.$id_model.'"';
$retstring .= ">".$label_model."</option>";
}
$retstring .= "</select>";
print $retstring;
return;
}
}

View File

@ -158,3 +158,6 @@ DateStartPlusOne=Date de début + 1 heure
SetAllEventsToTodo=Réglez tous les événements à "A faire"
SetAllEventsToInProgress=Définir tous les événements à "En cours"
SetAllEventsToFinished=Définir tous les événements sur "Terminés"
ReminderTime=Durée du rappel
TimeType=Type de durée
ReminderType=Type de rappel