Show reminders on the event page
This commit is contained in:
parent
f626bd70d0
commit
59c10235b5
@ -1959,19 +1959,34 @@ if ($id > 0)
|
|||||||
// Reminders
|
// Reminders
|
||||||
if ($conf->global->AGENDA_REMINDER_EMAIL || $conf->global->AGENDA_REMINDER_BROWSER)
|
if ($conf->global->AGENDA_REMINDER_EMAIL || $conf->global->AGENDA_REMINDER_BROWSER)
|
||||||
{
|
{
|
||||||
$object->loadReminders();
|
$filtreuserid = $user->id;
|
||||||
|
if ($user->rights->agenda->allactions->read) $filtreuserid = 0;
|
||||||
|
$object->loadReminders('', $filteruserid);
|
||||||
|
|
||||||
|
print '<tr><td class="titlefieldcreate nowrap">'.$langs->trans("Reminders").'</td><td>';
|
||||||
|
|
||||||
if (count($object->reminders) > 0) {
|
if (count($object->reminders) > 0) {
|
||||||
//checkbox create reminder
|
$tmpuserstatic = new User($db);
|
||||||
|
|
||||||
print '<tr><td class="titlefieldcreate nowrap">'.$langs->trans("Reminders").'</td><td>';
|
|
||||||
|
|
||||||
foreach($object->reminders as $actioncommreminderid => $actioncommreminder) {
|
foreach($object->reminders as $actioncommreminderid => $actioncommreminder) {
|
||||||
print $TRemindTypes[$actioncommreminder->typeremind].' - '.$actioncommreminder->offsetvalue.' '.$TDurationTypes[$actioncommreminder->offsetunit];
|
print $TRemindTypes[$actioncommreminder->typeremind];
|
||||||
|
if ($actioncommreminder->fk_user > 0) {
|
||||||
|
$tmpuserstatic->fetch($actioncommreminder->fk_user);
|
||||||
|
print ' ('.$tmpuser->getNomUrl(0, '', 0, 0, 16).')';
|
||||||
|
}
|
||||||
|
print ' - '.$actioncommreminder->offsetvalue.' '.$TDurationTypes[$actioncommreminder->offsetunit];
|
||||||
|
if ($actioncommreminder->status == $actioncommreminder::STATUS_TODO) {
|
||||||
|
print ' - <span class="opacitymedium">';
|
||||||
|
print $langs->trans("NotSent");
|
||||||
|
print ' </span>';
|
||||||
|
} elseif ($actioncommreminder->status == $actioncommreminder::STATUS_DONE) {
|
||||||
|
print ' - <span class="opacitymedium">';
|
||||||
|
print $langs->trans("Done");
|
||||||
|
print ' </span>';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
print '</td></tr>';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|||||||
@ -1956,10 +1956,11 @@ class ActionComm extends CommonObject
|
|||||||
/**
|
/**
|
||||||
* Load event reminder of events
|
* Load event reminder of events
|
||||||
*
|
*
|
||||||
* @param string $type Type of reminder 'browser' or 'email'
|
* @param string $type Type of reminder 'browser' or 'email'
|
||||||
* @return int 0 if OK, <>0 if KO (this function is used also by cron so only 0 is OK)
|
* @param int $fk_user Id of user
|
||||||
|
* @return int 0 if OK, <>0 if KO (this function is used also by cron so only 0 is OK)
|
||||||
*/
|
*/
|
||||||
public function loadReminders($type = '')
|
public function loadReminders($type = '', $fk_user = 0)
|
||||||
{
|
{
|
||||||
global $conf, $langs, $user;
|
global $conf, $langs, $user;
|
||||||
|
|
||||||
@ -1968,12 +1969,15 @@ class ActionComm extends CommonObject
|
|||||||
$this->reminders = array();
|
$this->reminders = array();
|
||||||
|
|
||||||
//Select all action comm reminders for event
|
//Select all action comm reminders for event
|
||||||
$sql = "SELECT rowid as id, typeremind, dateremind, status, offsetvalue, offsetunit";
|
$sql = "SELECT rowid as id, typeremind, dateremind, status, offsetvalue, offsetunit, fk_user";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."actioncomm_reminder";
|
$sql .= " FROM ".MAIN_DB_PREFIX."actioncomm_reminder";
|
||||||
$sql .= " WHERE fk_actioncomm = ".$this->id." AND dateremind <= '".$this->db->idate(dol_now())."'";
|
$sql .= " WHERE fk_actioncomm = ".$this->id." AND dateremind <= '".$this->db->idate(dol_now())."'";
|
||||||
if ($type) {
|
if ($type) {
|
||||||
$sql .= " AND typeremind ='".$this->db->escape($type)."'";
|
$sql .= " AND typeremind ='".$this->db->escape($type)."'";
|
||||||
}
|
}
|
||||||
|
if ($fk_user > 0) {
|
||||||
|
$sql .= " AND fk_user = ".((int) $fk_user);
|
||||||
|
}
|
||||||
if (empty($conf->global->AGENDA_REMINDER_EMAIL)) $sql .= " AND typeremind != 'email'";
|
if (empty($conf->global->AGENDA_REMINDER_EMAIL)) $sql .= " AND typeremind != 'email'";
|
||||||
if (empty($conf->global->AGENDA_REMINDER_BROWSER)) $sql .= " AND typeremind != 'browser'";
|
if (empty($conf->global->AGENDA_REMINDER_BROWSER)) $sql .= " AND typeremind != 'browser'";
|
||||||
|
|
||||||
@ -1989,6 +1993,7 @@ class ActionComm extends CommonObject
|
|||||||
$tmpactioncommreminder->offsetvalue = $obj->offsetvalue;
|
$tmpactioncommreminder->offsetvalue = $obj->offsetvalue;
|
||||||
$tmpactioncommreminder->offsetunit = $obj->offsetunit;
|
$tmpactioncommreminder->offsetunit = $obj->offsetunit;
|
||||||
$tmpactioncommreminder->status = $obj->status;
|
$tmpactioncommreminder->status = $obj->status;
|
||||||
|
$tmpactioncommreminder->fk_user = $obj->fk_user;
|
||||||
|
|
||||||
$this->reminders[$obj->id] = $tmpactioncommreminder;
|
$this->reminders[$obj->id] = $tmpactioncommreminder;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -658,6 +658,7 @@ Response=Response
|
|||||||
Priority=Priority
|
Priority=Priority
|
||||||
SendByMail=Send by email
|
SendByMail=Send by email
|
||||||
MailSentBy=Email sent by
|
MailSentBy=Email sent by
|
||||||
|
NotSent=Not sent
|
||||||
TextUsedInTheMessageBody=Email body
|
TextUsedInTheMessageBody=Email body
|
||||||
SendAcknowledgementByMail=Send confirmation email
|
SendAcknowledgementByMail=Send confirmation email
|
||||||
SendMail=Send email
|
SendMail=Send email
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user