mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-24 02:58:43 +02:00
Merge remote-tracking branch 'origin/support/3.0' into develop
# Conflicts: # sources/Core/Email/EmailSwiftMailer.php
This commit is contained in:
@@ -33,6 +33,13 @@ define ('EMAIL_SEND_ERROR', 2);
|
|||||||
|
|
||||||
class EMail implements iEMail
|
class EMail implements iEMail
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @see self::LoadConfig()
|
||||||
|
* @var Config
|
||||||
|
* @since 2.7.7 3.0.2 3.1.0 N°3169 N°5102 Move attribute to children classes
|
||||||
|
* @since 2.7.8 3.0.3 3.1.0 N°4947 pull up the attribute back to the Email class as config init is done here
|
||||||
|
*/
|
||||||
|
protected static $m_oConfig = null;
|
||||||
protected $oMailer;
|
protected $oMailer;
|
||||||
|
|
||||||
// Serialization formats
|
// Serialization formats
|
||||||
@@ -45,6 +52,42 @@ class EMail implements iEMail
|
|||||||
$this->oMailer = EmailFactory::GetMailer();
|
$this->oMailer = EmailFactory::GetMailer();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets {@see m_oConfig} if current attribute is null
|
||||||
|
*
|
||||||
|
* @returns \Config the current {@see m_oConfig} value
|
||||||
|
* @throws \ConfigException
|
||||||
|
* @throws \CoreException
|
||||||
|
*
|
||||||
|
* @uses utils::GetConfig()
|
||||||
|
*
|
||||||
|
* @since 2.7.7 3.0.2 3.1.0 N°3169 N°5102 Move method to children classes
|
||||||
|
* @since 2.7.8 3.0.3 3.1.0 N°4947 Pull up to the parent class, and remove `$sConfigFile` param
|
||||||
|
*/
|
||||||
|
public function LoadConfig()
|
||||||
|
{
|
||||||
|
if (is_null(static::$m_oConfig)) {
|
||||||
|
static::$m_oConfig = utils::GetConfig();
|
||||||
|
}
|
||||||
|
|
||||||
|
return static::$m_oConfig;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return void
|
||||||
|
* @throws \ConfigException
|
||||||
|
* @throws \CoreException
|
||||||
|
* @since 2.7.>8 3.0.3 3.1.0 N°4947 Method creation, to factorize same code in children classes
|
||||||
|
*/
|
||||||
|
protected function InitRecipientFrom()
|
||||||
|
{
|
||||||
|
$oConfig = $this->LoadConfig();
|
||||||
|
$this->SetRecipientFrom(
|
||||||
|
$oConfig->Get('email_default_sender_address'),
|
||||||
|
$oConfig->Get('email_default_sender_label')
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Custom serialization method
|
* Custom serialization method
|
||||||
* No longer use the brute force "serialize" method since
|
* No longer use the brute force "serialize" method since
|
||||||
@@ -159,5 +202,4 @@ class EMail implements iEMail
|
|||||||
{
|
{
|
||||||
$this->oMailer->SetRecipientReplyTo($sAddress);
|
$this->oMailer->SetRecipientReplyTo($sAddress);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -47,25 +47,21 @@ class EMailLaminas extends Email
|
|||||||
// Did not work with attachements since their binary representation cannot be stored as a valid UTF-8 string
|
// Did not work with attachements since their binary representation cannot be stored as a valid UTF-8 string
|
||||||
const FORMAT_V2 = 2; // New format, only the raw data are serialized (base64 encoded if needed)
|
const FORMAT_V2 = 2; // New format, only the raw data are serialized (base64 encoded if needed)
|
||||||
|
|
||||||
protected static $m_oConfig = null;
|
|
||||||
protected $m_aData; // For storing data to serialize
|
protected $m_aData; // For storing data to serialize
|
||||||
|
|
||||||
public static function LoadConfig($sConfigFile = ITOP_DEFAULT_CONFIG_FILE)
|
|
||||||
{
|
|
||||||
if (is_null(self::$m_oConfig)) {
|
|
||||||
self::$m_oConfig = new Config($sConfigFile);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected $m_oMessage;
|
protected $m_oMessage;
|
||||||
|
|
||||||
/** @noinspection PhpMissingParentConstructorInspection */
|
/**
|
||||||
|
* @noinspection PhpMissingParentConstructorInspection
|
||||||
|
* @noinspection MagicMethodsValidityInspection
|
||||||
|
*/
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->m_aData = array();
|
$this->m_aData = array();
|
||||||
$this->m_oMessage = new Message();
|
$this->m_oMessage = new Message();
|
||||||
$this->m_oMessage->setEncoding('UTF-8');
|
$this->m_oMessage->setEncoding('UTF-8');
|
||||||
$this->SetRecipientFrom(MetaModel::GetConfig()->Get('email_default_sender_address'), MetaModel::GetConfig()->Get('email_default_sender_label'));
|
|
||||||
|
$this->InitRecipientFrom();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user