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' ...@@ -121,8 +121,8 @@ attributetype ( 1.3.6.1.4.1.38414.62.1.7 NAME 'fdMailTemplateSignature'
SUBSTR caseIgnoreSubstringsMatch SUBSTR caseIgnoreSubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.40) 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' attributetype ( 1.3.6.1.4.1.38414.62.1.8 NAME 'fdMailAttachmentsContent'
DESC 'FusionDirectory - template mail field' DESC 'FusionDirectory - attachment data in bin format'
EQUALITY octetStringMatch EQUALITY octetStringMatch
SUBSTR caseIgnoreSubstringsMatch SUBSTR caseIgnoreSubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.40) 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' ...@@ -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' objectclass (1.3.6.1.4.1.38414.62.2.4 NAME 'fdMailTemplate'
DESC 'FusionDirectory - template mail object' DESC 'FusionDirectory - template mail object'
SUP top STRUCTURAL
MUST ( cn $ fdMailTemplateBody $ fdMailTemplateSubject ) 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' objectclass ( 1.3.6.1.4.1.38414.62.2.5 NAME 'fdMailTemplateConf'
DESC 'FusionDirectory Mail Template Configuration' DESC 'FusionDirectory Mail Template Configuration'
......
...@@ -26,14 +26,14 @@ class mailTemplate extends simplePlugin ...@@ -26,14 +26,14 @@ class mailTemplate extends simplePlugin
public static function plInfo (): array public static function plInfo (): array
{ {
return [ return [
'plShortName' => _('Mail Template'), 'plShortName' => _('Mail Template'),
'plDescription' => _('Mail Template'), 'plDescription' => _('Mail Template'),
'plObjectClass' => ['fdMailTemplate'], 'plObjectClass' => ['fdMailTemplate'],
'plFilter' => '(objectClass=fdMailTemplate)', 'plFilter' => '(objectClass=fdMailTemplate)',
'plObjectType' => ['mailTemplate' => [ 'plObjectType' => ['mailTemplate' => [
'name' => _('Mail Template'), 'name' => _('Mail Template'),
'ou' => get_ou('mailTemplateRDN'), 'ou' => get_ou('mailTemplateRDN'),
'icon' => 'geticon.php?context=applications&icon=mail-template&size=16', 'icon' => 'geticon.php?context=applications&icon=mail-template&size=16',
]], ]],
'plProvidedAcls' => parent::generatePlProvidedAcls(static::getAttributesInfo()) 'plProvidedAcls' => parent::generatePlProvidedAcls(static::getAttributesInfo())
]; ];
...@@ -45,33 +45,47 @@ class mailTemplate extends simplePlugin ...@@ -45,33 +45,47 @@ class mailTemplate extends simplePlugin
return [ return [
// Attributes are grouped by section // Attributes are grouped by section
'mailTemplate' => [ 'mailTemplate' => [
'name' => _('Mail Object'), 'name' => _('Mail Object'),
'attrs' => [ 'attrs' => [
new StringAttribute( new StringAttribute(
_('Mail Template Name'), _('Mail Template Name'), _('Mail Template Name'), _('Mail Template Name'),
'cn', TRUE 'cn', TRUE
), ),
new StringAttribute( new StringAttribute(
_('Mail Subject'), _('Mail Subject'), _('Mail Subject'), _('Mail Subject'),
'fdMailTemplateSubject', TRUE 'fdMailTemplateSubject', TRUE
), ),
new TextAreaAttribute( new TextAreaAttribute(
_('Mail Template Body'), _('Text to be sent to recipient'), _('Mail Template Body'), _('Text to be sent to recipient'),
'fdMailTemplateBody', TRUE 'fdMailTemplateBody', TRUE
), ),
new TextAreaAttribute( new TextAreaAttribute(
_('Mail Signature'), _('Mail Signature'), _('Mail Signature'), _('Mail Signature'),
'fdMailTemplateSignature', FALSE 'fdMailTemplateSignature', FALSE
), ),
new FileDownloadAttribute( new BooleanAttribute(
_('Attachment'), _('Import a file for this e-mail'), _('Read Receipt'),
'fdMailTemplateAttachment', FALSE, '', TRUE _('Read Receipt'),
), 'fdMailTemplateReadReceipt', FALSE
new BooleanAttribute( ),
_('Read Receipt'), // Management of attachments files in a sub-node ldap format.
_('Read Receipt'), new SubNodesAttribute(
'fdMailTemplateReadReceipt', FALSE '', _('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 ...@@ -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 ...@@ -82,7 +82,7 @@ class tasks extends simplePlugin
), ),
new SelectAttribute( new SelectAttribute(
_('Repeatable Schedule'), _('Select the desired schedule.'), _('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 ...@@ -29,6 +29,7 @@ class tasksManagement extends management
*/ */
public static $columns = [ public static $columns = [
//below fdTasksMailObject must be change to have a type defined within task creation (new ldap attributes ?hidden) //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']], ['TasksColumn', ['attributes' => 'fdTasksMailObject', 'label' => 'Types']],
['Column', ['attributes' => 'fdTasksCreationDate', 'label' => 'Creation Date']], ['Column', ['attributes' => 'fdTasksCreationDate', 'label' => 'Creation Date']],
['TasksColumn', ['attributes' => 'fdTasksScheduleDate', 'label' => 'Scheduled']], ['TasksColumn', ['attributes' => 'fdTasksScheduleDate', 'label' => 'Scheduled']],
......
...@@ -29,9 +29,8 @@ class tasksDashboard extends management ...@@ -29,9 +29,8 @@ class tasksDashboard extends management
$this->setupFilters(); $this->setupFilters();
} }
// Actions collumn are removed compared to parent. // Actions column are removed compared to parent.
public static $columns = [ public static $columns = [
['Column', ['attributes' => 'cn', 'label' => 'Tasks']],
['TasksColumn', ['attributes' => 'fdTasksGranularMaster', 'label' => 'Master Task']], ['TasksColumn', ['attributes' => 'fdTasksGranularMaster', 'label' => 'Master Task']],
['Column', ['attributes' => 'fdTasksGranularType', 'label' => 'Types']], ['Column', ['attributes' => 'fdTasksGranularType', 'label' => 'Types']],
['Column', ['attributes' => 'fdTasksGranularMail', 'label' => 'Email']], ['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