diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php
index 64ebfc4a873..ff44a23319b 100644
--- a/htdocs/comm/action/card.php
+++ b/htdocs/comm/action/card.php
@@ -1959,19 +1959,34 @@ if ($id > 0)
// Reminders
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 '
| '.$langs->trans("Reminders").' | ';
if (count($object->reminders) > 0) {
- //checkbox create reminder
-
- print ' |
| '.$langs->trans("Reminders").' | ';
-
+ $tmpuserstatic = new User($db);
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 ' - ';
+ print $langs->trans("NotSent");
+ print ' ';
+ } elseif ($actioncommreminder->status == $actioncommreminder::STATUS_DONE) {
+ print ' - ';
+ print $langs->trans("Done");
+ print ' ';
+ }
}
-
- print ' |
';
}
+
+ print '';
}
print '';
diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php
index 56bfa01555e..7e4a58b07e0 100644
--- a/htdocs/comm/action/class/actioncomm.class.php
+++ b/htdocs/comm/action/class/actioncomm.class.php
@@ -1956,10 +1956,11 @@ class ActionComm extends CommonObject
/**
* Load event reminder of events
*
- * @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 string $type Type of reminder 'browser' or 'email'
+ * @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;
@@ -1968,12 +1969,15 @@ class ActionComm extends CommonObject
$this->reminders = array();
//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 .= " WHERE fk_actioncomm = ".$this->id." AND dateremind <= '".$this->db->idate(dol_now())."'";
if ($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_BROWSER)) $sql .= " AND typeremind != 'browser'";
@@ -1989,6 +1993,7 @@ class ActionComm extends CommonObject
$tmpactioncommreminder->offsetvalue = $obj->offsetvalue;
$tmpactioncommreminder->offsetunit = $obj->offsetunit;
$tmpactioncommreminder->status = $obj->status;
+ $tmpactioncommreminder->fk_user = $obj->fk_user;
$this->reminders[$obj->id] = $tmpactioncommreminder;
}
diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang
index e184368c618..4ad56467cf7 100644
--- a/htdocs/langs/en_US/main.lang
+++ b/htdocs/langs/en_US/main.lang
@@ -658,6 +658,7 @@ Response=Response
Priority=Priority
SendByMail=Send by email
MailSentBy=Email sent by
+NotSent=Not sent
TextUsedInTheMessageBody=Email body
SendAcknowledgementByMail=Send confirmation email
SendMail=Send email