Commit ef45455a authored by dockx thibault's avatar dockx thibault
Browse files

Merge branch '6303-core-mail-attachments-for-emails-must-be-created-as-sub-nodes' into 'dev'

Resolve "[CORE][MAIL] – Attachments for emails must be created as sub nodes"

See merge request fusiondirectory/fd!1057
Showing with 73 additions and 38 deletions
+73 -38
......@@ -121,8 +121,8 @@ attributetype ( 1.3.6.1.4.1.38414.62.1.7 NAME 'fdMailTemplateSignature'
SUBSTR caseIgnoreSubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.40)
attributetype ( 1.3.6.1.4.1.38414.62.1.8 NAME 'fdMailTemplateAttachment'
DESC 'FusionDirectory - template mail field'
attributetype ( 1.3.6.1.4.1.38414.62.1.8 NAME 'fdMailAttachmentsContent'
DESC 'FusionDirectory - attachment data in bin format'
EQUALITY octetStringMatch
SUBSTR caseIgnoreSubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.40)
......@@ -447,8 +447,13 @@ objectclass (1.3.6.1.4.1.38414.62.2.3 NAME 'fdPluginManager'
objectclass (1.3.6.1.4.1.38414.62.2.4 NAME 'fdMailTemplate'
DESC 'FusionDirectory - template mail object'
SUP top STRUCTURAL
MUST ( cn $ fdMailTemplateBody $ fdMailTemplateSubject )
MAY ( fdMailTemplateSignature $ fdMailTemplateReadReceipt $ fdMailTemplateAttachment ) )
MAY ( fdMailTemplateSignature $ fdMailTemplateReadReceipt))
objectclass (1.3.6.1.4.1.38414.62.2.10 NAME 'fdMailAttachments'
DESC 'FusionDirectory - mail template attachments'
MUST ( cn $ fdMailAttachmentsContent ))
objectclass ( 1.3.6.1.4.1.38414.62.2.5 NAME 'fdMailTemplateConf'
DESC 'FusionDirectory Mail Template Configuration'
......
......@@ -26,14 +26,14 @@ class mailTemplate extends simplePlugin
public static function plInfo (): array
{
return [
'plShortName' => _('Mail Template'),
'plShortName' => _('Mail Template'),
'plDescription' => _('Mail Template'),
'plObjectClass' => ['fdMailTemplate'],
'plFilter' => '(objectClass=fdMailTemplate)',
'plObjectType' => ['mailTemplate' => [
'name' => _('Mail Template'),
'ou' => get_ou('mailTemplateRDN'),
'icon' => 'geticon.php?context=applications&icon=mail-template&size=16',
'plFilter' => '(objectClass=fdMailTemplate)',
'plObjectType' => ['mailTemplate' => [
'name' => _('Mail Template'),
'ou' => get_ou('mailTemplateRDN'),
'icon' => 'geticon.php?context=applications&icon=mail-template&size=16',
]],
'plProvidedAcls' => parent::generatePlProvidedAcls(static::getAttributesInfo())
];
......@@ -45,33 +45,47 @@ class mailTemplate extends simplePlugin
return [
// Attributes are grouped by section
'mailTemplate' => [
'name' => _('Mail Object'),
'name' => _('Mail Object'),
'attrs' => [
new StringAttribute(
_('Mail Template Name'), _('Mail Template Name'),
'cn', TRUE
),
new StringAttribute(
_('Mail Subject'), _('Mail Subject'),
'fdMailTemplateSubject', TRUE
),
new TextAreaAttribute(
_('Mail Template Body'), _('Text to be sent to recipient'),
'fdMailTemplateBody', TRUE
),
new TextAreaAttribute(
_('Mail Signature'), _('Mail Signature'),
'fdMailTemplateSignature', FALSE
),
new FileDownloadAttribute(
_('Attachment'), _('Import a file for this e-mail'),
'fdMailTemplateAttachment', FALSE, '', TRUE
),
new BooleanAttribute(
_('Read Receipt'),
_('Read Receipt'),
'fdMailTemplateReadReceipt', FALSE
),
new StringAttribute(
_('Mail Template Name'), _('Mail Template Name'),
'cn', TRUE
),
new StringAttribute(
_('Mail Subject'), _('Mail Subject'),
'fdMailTemplateSubject', TRUE
),
new TextAreaAttribute(
_('Mail Template Body'), _('Text to be sent to recipient'),
'fdMailTemplateBody', TRUE
),
new TextAreaAttribute(
_('Mail Signature'), _('Mail Signature'),
'fdMailTemplateSignature', FALSE
),
new BooleanAttribute(
_('Read Receipt'),
_('Read Receipt'),
'fdMailTemplateReadReceipt', FALSE
),
// Management of attachments files in a sub-node ldap format.
new SubNodesAttribute(
'', _('Attachments'),
'attachments', ['fdMailAttachments'],
[
new StringAttribute(
_('Name'), _('The name of the attachment file'),
'cn', TRUE
),
new FileDownloadAttribute(
_('Attachment'), _('Import a file for this e-mail'),
'fdMailAttachmentsContent', FALSE, '', TRUE
),
],
FALSE, /* no order */
[],
TRUE /* edit enabled */
),
]
],
];
......@@ -85,4 +99,20 @@ class mailTemplate extends simplePlugin
}
protected function shouldSave (): bool
{
// Trigger a save method required due to sub nodes not being triggered by default. (Modification and suppression).
return TRUE;
}
function ldap_save (): array
{
global $config;
$errors = parent::ldap_save();
$this->attributesAccess['attachments']->postLdapSave($config->get_ldap_link());
return $errors;
}
}
......@@ -82,7 +82,7 @@ class tasks extends simplePlugin
),
new SelectAttribute(
_('Repeatable Schedule'), _('Select the desired schedule.'),
'fdTasksRepeatableSchedule', FALSE, ['Yearly', 'Monthly', 'Daily', 'Hourly'], 'Daily'
'fdTasksRepeatableSchedule', FALSE, ['Yearly', 'Monthly', 'Weekly', 'Daily', 'Hourly'], 'Daily'
),
]
],
......
......@@ -29,6 +29,7 @@ class tasksManagement extends management
*/
public static $columns = [
//below fdTasksMailObject must be change to have a type defined within task creation (new ldap attributes ?hidden)
['LinkColumn', ['attributes' => 'cn', 'label' => 'Tasks']],
['TasksColumn', ['attributes' => 'fdTasksMailObject', 'label' => 'Types']],
['Column', ['attributes' => 'fdTasksCreationDate', 'label' => 'Creation Date']],
['TasksColumn', ['attributes' => 'fdTasksScheduleDate', 'label' => 'Scheduled']],
......
......@@ -29,9 +29,8 @@ class tasksDashboard extends management
$this->setupFilters();
}
// Actions collumn are removed compared to parent.
// Actions column are removed compared to parent.
public static $columns = [
['Column', ['attributes' => 'cn', 'label' => 'Tasks']],
['TasksColumn', ['attributes' => 'fdTasksGranularMaster', 'label' => 'Master Task']],
['Column', ['attributes' => 'fdTasksGranularType', 'label' => 'Types']],
['Column', ['attributes' => 'fdTasksGranularMail', 'label' => 'Email']],
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment