mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-13 04:53:26 +00:00
Fix #1479 : Add validation duration in mail body
This commit is contained in:
@@ -433,15 +433,16 @@ class Push implements ControllerProviderInterface
|
|||||||
$receipt = $request->get('recept') ? $app['authentication']->getUser()->get_email() : '';
|
$receipt = $request->get('recept') ? $app['authentication']->getUser()->get_email() : '';
|
||||||
|
|
||||||
$params = array(
|
$params = array(
|
||||||
'from' => $app['authentication']->getUser()->get_id()
|
'from' => $app['authentication']->getUser()->get_id(),
|
||||||
, 'from_email' => $app['authentication']->getUser()->get_email()
|
'from_email' => $app['authentication']->getUser()->get_email(),
|
||||||
, 'to' => $participant_user->get_id()
|
'to' => $participant_user->get_id(),
|
||||||
, 'to_email' => $participant_user->get_email()
|
'to_email' => $participant_user->get_email(),
|
||||||
, 'to_name' => $participant_user->get_display_name()
|
'to_name' => $participant_user->get_display_name(),
|
||||||
, 'url' => $url
|
'url' => $url,
|
||||||
, 'accuse' => $receipt
|
'accuse' => $receipt,
|
||||||
, 'message' => $request->request->get('message')
|
'message' => $request->request->get('message'),
|
||||||
, 'ssel_id' => $Basket->getId()
|
'ssel_id' => $Basket->getId(),
|
||||||
|
'duration' => (int) $request->request->get('duration'),
|
||||||
);
|
);
|
||||||
|
|
||||||
$app['events-manager']->trigger('__PUSH_VALIDATION__', $params);
|
$app['events-manager']->trigger('__PUSH_VALIDATION__', $params);
|
||||||
|
@@ -56,7 +56,7 @@ class MailInfoValidationReminder extends AbstractMailWithLink
|
|||||||
*/
|
*/
|
||||||
public function getButtonText()
|
public function getButtonText()
|
||||||
{
|
{
|
||||||
return _('Validate');
|
return _('Start validation');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -19,6 +19,8 @@ class MailInfoValidationRequest extends AbstractMailWithLink
|
|||||||
private $title;
|
private $title;
|
||||||
/** @var \User_Adapter */
|
/** @var \User_Adapter */
|
||||||
private $user;
|
private $user;
|
||||||
|
/** @var integer */
|
||||||
|
private $duration;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the title of the validation
|
* Sets the title of the validation
|
||||||
@@ -40,6 +42,11 @@ class MailInfoValidationRequest extends AbstractMailWithLink
|
|||||||
$this->user = $user;
|
$this->user = $user;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function setDuration($duration)
|
||||||
|
{
|
||||||
|
$this->duration = (int) $duration;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
@@ -60,6 +67,14 @@ class MailInfoValidationRequest extends AbstractMailWithLink
|
|||||||
*/
|
*/
|
||||||
public function getMessage()
|
public function getMessage()
|
||||||
{
|
{
|
||||||
|
if (0 < $this->duration) {
|
||||||
|
if (1 < $this->duration) {
|
||||||
|
return $this->message . "\n\n" . "You have 1 day to validate the selection.";
|
||||||
|
} else {
|
||||||
|
return $this->message . "\n\n" . sprintf(_("You have %d days to validate the selection.", $this->duration));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return $this->message;
|
return $this->message;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -68,7 +83,7 @@ class MailInfoValidationRequest extends AbstractMailWithLink
|
|||||||
*/
|
*/
|
||||||
public function getButtonText()
|
public function getButtonText()
|
||||||
{
|
{
|
||||||
return _('Validate');
|
return _('Start validation');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -112,6 +112,7 @@ class eventsmanager_notify_validate extends eventsmanager_notifyAbstract
|
|||||||
if ($readyToSend) {
|
if ($readyToSend) {
|
||||||
$mail = MailInfoValidationRequest::create($this->app, $receiver, $emitter, $params['message']);
|
$mail = MailInfoValidationRequest::create($this->app, $receiver, $emitter, $params['message']);
|
||||||
$mail->setButtonUrl($params['url']);
|
$mail->setButtonUrl($params['url']);
|
||||||
|
$mail->setDuration($params['duration']);
|
||||||
$mail->setTitle($title);
|
$mail->setTitle($title);
|
||||||
$mail->setUser($user_from);
|
$mail->setUser($user_from);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user