Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
sg_mail
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TYPO3
sg_mail
Commits
26c246d1
Commit
26c246d1
authored
6 years ago
by
Torsten Oppermann
Browse files
Options
Downloads
Patches
Plain Diff
[TASK] Fixing a bug in error handling and display of empty values
parent
e9e3a3b0
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!12
Feature backend config
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Classes/Controller/ConfigurationController.php
+47
-46
47 additions, 46 deletions
Classes/Controller/ConfigurationController.php
Resources/Private/Templates/Mail/Index.html
+6
-2
6 additions, 2 deletions
Resources/Private/Templates/Mail/Index.html
with
53 additions
and
48 deletions
Classes/Controller/ConfigurationController.php
+
47
−
46
View file @
26c246d1
...
...
@@ -110,63 +110,64 @@ class ConfigurationController extends ActionController {
*
* @throws StopActionException
* @throws UnsupportedRequestTypeException
* @throws \TYPO3\CMS\Core\Cache\Exception\NoSuchCacheException
* @throws \TYPO3\CMS\Extbase\Mvc\Exception\NoSuchArgumentException
*/
public
function
createAction
()
{
try
{
/** @var array $configuration */
$configuration
=
$this
->
request
->
getArgument
(
'configuration'
);
$templateName
=
$configuration
[
'templateName'
];
$csv
=
$configuration
[
'csv'
];
$subject
=
$configuration
[
'subject'
];
$description
=
$configuration
[
'description'
];
// parse csv (,,,;,,,;)
$markersCsv
=
str_getcsv
(
$csv
,
';'
);
$markers
=
[];
foreach
(
$markersCsv
as
$markerCsv
)
{
$rowArray
=
GeneralUtility
::
trimExplode
(
','
,
$markerCsv
);
$markers
[]
=
[
'identifier'
=>
$rowArray
[
0
],
'value'
=>
$rowArray
[
1
],
'description'
=>
$rowArray
[
2
]
];
}
if
(
!
$this
->
$this
->
request
->
hasArgument
(
'configuration'
))
{
$this
->
redirect
(
'index'
,
'Configuration'
,
NULL
,
[
'message'
=>
LocalizationUtility
::
translate
(
'backend.create_error'
,
'sg_mail'
)]
);
}
// write the new Register.php file
$this
->
writeRegisterFile
(
$templateName
,
self
::
DEFAULT_EXTENSION_KEY
,
$markers
,
$subject
,
$descrip
tion
);
/** @var array $configuration */
$configuration
=
$this
->
request
->
getArgument
(
'configura
tion
'
);
// call register function in mail template service class
MailTemplateService
::
registerExtensions
();
$templateName
=
$configuration
[
'templateName'
];
$csv
=
$configuration
[
'csv'
];
$subject
=
$configuration
[
'subject'
];
$description
=
$configuration
[
'description'
];
// clear caches
$this
->
clearCaches
();
// parse csv (,,,;,,,;)
$markersCsv
=
str_getcsv
(
$csv
,
';'
);
$markers
=
[];
// store selected template & extension key in the session
if
(
!
(
$this
->
session
instanceof
PhpSession
))
{
$this
->
session
=
$this
->
objectManager
->
get
(
PhpSession
::
class
);
$this
->
session
->
setSessionKey
(
'sg_mail_controller_session'
);
}
else
{
$this
->
session
->
setSessionKey
(
'sg_mail_controller_session'
);
foreach
(
$markersCsv
as
$markerCsv
)
{
$rowArray
=
GeneralUtility
::
trimExplode
(
','
,
$markerCsv
);
if
(
!
$rowArray
[
0
])
{
continue
;
}
$this
->
session
->
setDataByKey
(
'selectedTemplate'
,
$templateName
);
$this
->
session
->
setDataByKey
(
'selectedExtension'
,
self
::
DEFAULT_EXTENSION_KEY
);
$markers
[]
=
[
'identifier'
=>
$rowArray
[
0
],
'value'
=>
$rowArray
[
1
],
'description'
=>
$rowArray
[
2
]
];
}
$this
->
redirect
(
'index'
,
'Mail'
,
NULL
,
[
'message'
=>
LocalizationUtility
::
translate
(
'backend.create_message'
,
'sg_mail'
)]
);
// write the new Register.php file
$this
->
writeRegisterFile
(
$templateName
,
self
::
DEFAULT_EXTENSION_KEY
,
$markers
,
$subject
,
$description
);
}
catch
(
\Exception
$e
)
{
$logger
=
GeneralUtility
::
makeInstance
(
Logger
::
class
,
[
'name'
=>
'sgmail_error_logger'
]);
$logger
->
error
(
$e
->
getMessage
());
// call register function in mail template service class
MailTemplateService
::
registerExtensions
();
$this
->
redirect
(
'index'
,
'Configuration'
,
NULL
,
[
'message'
=>
LocalizationUtility
::
translate
(
'backend.create_error'
,
'sg_mail'
)]
);
// clear caches
$this
->
clearCaches
();
// store selected template & extension key in the session
if
(
!
(
$this
->
session
instanceof
PhpSession
))
{
$this
->
session
=
$this
->
objectManager
->
get
(
PhpSession
::
class
);
$this
->
session
->
setSessionKey
(
'sg_mail_controller_session'
);
}
else
{
$this
->
session
->
setSessionKey
(
'sg_mail_controller_session'
);
}
$this
->
session
->
setDataByKey
(
'selectedTemplate'
,
$templateName
);
$this
->
session
->
setDataByKey
(
'selectedExtension'
,
self
::
DEFAULT_EXTENSION_KEY
);
$this
->
redirect
(
'index'
,
'Mail'
,
NULL
,
[
'message'
=>
LocalizationUtility
::
translate
(
'backend.create_message'
,
'sg_mail'
)]
);
}
/**
...
...
This diff is collapsed.
Click to expand it.
Resources/Private/Templates/Mail/Index.html
+
6
−
2
View file @
26c246d1
...
...
@@ -53,12 +53,16 @@
</f:for>
</f:then>
<f:else>
<f:translate
key=
"{marker.value}"
>
{marker.value}
</f:translate>
<f:if
condition=
"{marker.value}"
>
<f:translate
key=
"{marker.value}"
>
{marker.value}
</f:translate>
</f:if>
</f:else>
</f:if>
</td>
<td>
<f:translate
key=
"{marker.description}"
>
{marker.description}
</f:translate>
<f:if
condition=
"{marker.description}"
>
<f:translate
key=
"{marker.description}"
>
{marker.description}
</f:translate>
</f:if>
</td>
</tr>
</f:for>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment