Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
services
t3o sites
voting.typo3.org
extensions
election
Commits
510a2845
Commit
510a2845
authored
Jan 24, 2021
by
Wolf-Peter Utz
Committed by
Felix Herrmann
Jan 24, 2021
Browse files
Task/be functionality fix extension scanner errors
parent
60d25b73
Changes
10
Hide whitespace changes
Inline
Side-by-side
Classes/Constants.php
View file @
510a2845
<?php
namespace
T3o\Election
;
class
Constants
...
...
@@ -6,4 +7,6 @@ class Constants
public
const
EXTENSION_KEY
=
'election'
;
public
const
EXTENSION_NAME
=
'Election'
;
public
const
VENDOR
=
'T3o'
;
}
Classes/Controller/AbstractProtectedBeController.php
View file @
510a2845
...
...
@@ -41,7 +41,7 @@ abstract class AbstractProtectedBeController extends AbstractBeController
{
$this
->
clearCacheOnError
();
$message
=
""
;
foreach
(
$this
->
arguments
->
getV
alidat
ionResults
()
->
getFlattenedErrors
()
as
$propertyPath
=>
$errors
)
{
foreach
(
$this
->
arguments
->
v
alidat
e
()
->
getFlattenedErrors
()
as
$propertyPath
=>
$errors
)
{
foreach
(
$errors
as
$error
)
{
$message
.
=
PHP_EOL
.
'Error for '
.
$propertyPath
.
': '
.
$error
->
render
();
}
...
...
@@ -60,9 +60,13 @@ abstract class AbstractProtectedBeController extends AbstractBeController
if
(
$referringRequest
!==
null
)
{
$originalRequest
=
clone
$this
->
request
;
$this
->
request
->
setOriginalRequest
(
$originalRequest
);
$this
->
request
->
setOriginalRequestMappingResults
(
$this
->
arguments
->
getValidationResults
());
$this
->
forward
(
$referringRequest
->
getControllerActionName
(),
$referringRequest
->
getControllerName
(),
$referringRequest
->
getControllerExtensionName
(),
$referringRequest
->
getArguments
());
$this
->
request
->
setOriginalRequestMappingResults
(
$this
->
arguments
->
validate
());
$this
->
forward
(
$referringRequest
->
getControllerActionName
(),
$referringRequest
->
getControllerName
(),
$referringRequest
->
getControllerExtensionName
(),
$referringRequest
->
getArguments
()
);
}
$message
=
'An error occurred while trying to call '
.
get_class
(
$this
)
.
'->'
.
$this
->
actionMethodName
.
'().'
.
PHP_EOL
;
...
...
Classes/Domain/Model/Configuration.php
View file @
510a2845
...
...
@@ -62,7 +62,7 @@ class Configuration extends AbstractEntity
/**
* @var bool
*/
protected
$
debug
=
false
;
protected
$
inTestMode
=
false
;
/**
* @var string
...
...
@@ -184,17 +184,17 @@ class Configuration extends AbstractEntity
/**
* @return boolean
*/
public
function
is
Debug
()
public
function
is
InTestMode
()
{
return
$this
->
debug
;
return
$this
->
inTestMode
;
}
/**
* @param boolean $
debug
* @param boolean $
inTestMode
*/
public
function
set
Debug
(
$debug
)
public
function
set
InTestMode
(
$inTestMode
)
{
$this
->
debug
=
$debug
;
$this
->
inTestMode
=
$inTestMode
;
}
/**
...
...
@@ -233,7 +233,7 @@ class Configuration extends AbstractEntity
$clone
->
setNumberOfMails
(
$this
->
getNumberOfMails
());
$clone
->
setFromEmail
(
$this
->
getFromEmail
());
$clone
->
setFromName
(
$this
->
getFromName
());
$clone
->
set
Debug
(
$this
->
isDebug
());
$clone
->
set
InTestMode
(
$this
->
isInTestMode
());
$clone
->
setTestEmail
(
$this
->
getTestEmail
());
return
$clone
;
}
...
...
Classes/Domain/Model/ElectionCircular.php
View file @
510a2845
...
...
@@ -165,15 +165,13 @@ class ElectionCircular extends AbstractEntity
0
);
$GLOBALS
[
'TSFE'
]
->
config
=
[
'config'
=>
[]];
$GLOBALS
[
'TSFE'
]
->
initFEuser
();
$GLOBALS
[
'TSFE'
]
->
fetch_the_id
();
$GLOBALS
[
'TSFE'
]
->
initTemplate
();
}
/** @var UriBuilder $uriBuilder */
$uriBuilder
=
$objectManager
->
get
(
UriBuilder
::
class
);
$uriBuilder
->
setTargetPageUid
(
$configuration
->
getPluginPid
());
$uriBuilder
->
setCreateAbsoluteUri
(
true
);
$uriBuilder
->
setUseCacheHash
(
false
);
$uriBuilder
->
uriFor
(
FeElectionController
::
ACTION_VOTE
,
[
...
...
Classes/Service/ElectionInvitationService.php
View file @
510a2845
...
...
@@ -81,7 +81,7 @@ class ElectionInvitationService
$mail
->
setSubject
(
$electionCircular
->
getSubject
());
$mail
->
setFrom
([
$configuration
->
getFromEmail
()
=>
$configuration
->
getFromName
()]);
if
(
$configuration
->
is
Debug
())
{
if
(
$configuration
->
is
InTestMode
())
{
$mail
->
setTo
([
$configuration
->
getTestEmail
()
=>
$elector
->
getFullName
()]);
}
else
{
$mail
->
setTo
([
$elector
->
getEmail
()
=>
$elector
->
getFullName
()]);
...
...
Classes/Utility/MailUtility.php
View file @
510a2845
...
...
@@ -54,7 +54,7 @@ class MailUtility
$electionInvitationRepository
->
persistAll
();
if
(
$configuration
->
is
Debug
())
{
if
(
$configuration
->
is
InTestMode
())
{
$mail
->
setTo
([
$configuration
->
getTestEmail
()
=>
$elector
->
getFullName
()]);
}
else
{
$mail
->
setTo
([
$elector
->
getEmail
()
=>
$elector
->
getFullName
()]);
...
...
Configuration/Extbase/Persistence/Classes.php
0 → 100644
View file @
510a2845
<?php
declare
(
strict_types
=
1
);
defined
(
'TYPO3_MODE'
)
||
die
();
return
[
\
T3o\Election\Domain\Model\Configuration
::
class
=>
[
'tableName'
=>
'tx_election_domain_model_configuration'
,
'properties'
=>
[
'inTestMode'
=>
[
'fieldName'
=>
'debug'
],
],
],
];
Resources/Private/Partials/Model/Configuration/FormFields/Debug.html
View file @
510a2845
...
...
@@ -6,7 +6,7 @@
</f:translate>
</label>
<div
class=
"form-control-wrap"
style=
"max-width: 480px"
>
<f:form.checkbox
id=
"tx_election_configuration_debug"
property=
"
debug
"
value=
"true"
/>
<f:form.checkbox
id=
"tx_election_configuration_debug"
property=
"
isInTestMode
"
value=
"true"
/>
</div>
</div>
</fieldset>
ext_emconf.php
View file @
510a2845
<?php
$EM_CONF
[
$_EXT
KEY
]
=
[
$EM_CONF
[
\
T3o\Election\Constants
::
EXTENSION_
KEY
]
=
[
'title'
=>
'Election'
,
'description'
=>
'voting / polling tool'
,
'category'
=>
'fe'
,
...
...
ext_typoscript_setup.txt
View file @
510a2845
temp.abstractEntity.mapping.columns {
creation_date.mapOnProperty = creationDate
creation_user.mapOnProperty = creationUser
}
temp.abstractPerson.mapping.columns {
first_name.mapOnProperty = firstName
middle_name.mapOnProperty = middleName
last_name.mapOnProperty = lastName
gender.mapOnProperty = gender
email.mapOnProperty = email
}
config.tx_extbase.persistence.classes {
T3o\Election\Domain\Model\Configuration < temp.abstractEntity
T3o\Election\Domain\Model\Configuration {
mapping {
tableName = tx_election_domain_model_configuration
columns {
administration_group.mapOnProperty = administrationGroup
election_manager_group.mapOnProperty = electionManagerGroup
poll_manager_group.mapOnProperty = pollManagerGroup
plugin_pid.mapOnProperty = pluginPid
number_of_mails.mapOnProperty = numberOfMails
from_email.mapOnProperty = fromEmail
from_name.mapOnProperty = fromName
debug.mapOnProperty = debug
test_email.mapOnProperty = testEmail
}
}
}
T3o\Election\Domain\Model\Elector < temp.abstractPerson
T3o\Election\Domain\Model\Elector {
mapping {
tableName = tx_election_domain_model_elector
columns {
electorates {
mapOnProperty = electorates
config {
type = select
MM = tx_election_domain_model_electorate_elector_mm
foreign_table = tx_election_domain_model_electorate
MM_opposite_field = electors
}
}
election_invitations {
mapOnProperty = electionInvitations
config {
type = inline
foreign_table = tx_election_domain_model_electioninvitation
foreign_field = elector
}
}
}
}
}
T3o\Election\Domain\Model\ElectorImport < temp.abstractPerson
T3o\Election\Domain\Model\ElectorImport {
mapping {
tableName = tx_election_domain_model_electorimport
columns {
electorate {
mapOnProperty = electorate
config {
type = select
foreign_table = tx_election_domain_model_electorate
}
}
}
}
}
T3o\Election\Domain\Model\Nominee < temp.abstractPerson
T3o\Election\Domain\Model\Nominee {
mapping {
tableName = tx_election_domain_model_nominee
columns {
url.mapOnProperty = url
image.mapOnProperty = image
comment.mapOnProperty = comment
public.mapOnProperty = public
elections {
mapOnProperty = elections
config {
type = select
MM = tx_election_domain_model_election_nominee_mm
foreign_table = tx_election_domain_model_nominee
MM_opposite_field = nominees
}
}
}
}
}
T3o\Election\Domain\Model\Election < temp.abstractEntity
T3o\Election\Domain\Model\Election {
mapping {
tableName = tx_election_domain_model_election
columns {
title.mapOnProperty = title
description.mapOnProperty = description
start_date.mapOnProperty = startDate
end_date.mapOnProperty = endDate
number_of_votes.mapOnProperty = numberOfVotes
electorate {
mapOnProperty = electorate
config {
type = select
foreign_table = tx_election_domain_model_electorate
}
}
nominees {
mapOnProperty = nominees
config {
type = select
MM = tx_election_domain_model_election_nominee_mm
foreign_table = tx_election_domain_model_nominee
}
}
election_votes {
mapOnProperty = electionVotes
config {
type = inline
foreign_table = tx_election_domain_model_electionvote
foreign_field = election
}
}
}
}
}
T3o\Election\Domain\Model\Electorate < temp.abstractEntity
T3o\Election\Domain\Model\Electorate {
mapping {
tableName = tx_election_domain_model_electorate
columns {
title.mapOnProperty = title
electors {
mapOnProperty = electors
config {
type = select
MM = tx_election_domain_model_electorate_elector_mm
foreign_table = tx_election_domain_model_elector
}
}
}
}
}
T3o\Election\Domain\Model\ElectionCircular < temp.abstractEntity
T3o\Election\Domain\Model\ElectionCircular {
mapping {
tableName = tx_election_domain_model_electioncircular
columns {
subject.mapOnProperty = subject
body.mapOnProperty = body
election {
mapOnProperty = election
config {
type = select
foreign_table = tx_election_domain_model_election
}
}
}
}
}
T3o\Election\Domain\Model\ElectionInvitation < temp.abstractEntity
T3o\Election\Domain\Model\ElectionInvitation {
mapping {
tableName = tx_election_domain_model_electioninvitation
columns {
secret.mapOnProperty = secret
success.mapOnProperty = success
voted.mapOnProperty = voted
election_circular {
mapOnProperty = electionCircular
config {
type = select
foreign_table = tx_election_domain_model_electioncircular
}
}
elector {
mapOnProperty = elector
config {
type = select
foreign_table = tx_election_domain_model_elector
}
}
}
}
}
T3o\Election\Domain\Model\ElectionVote < temp.abstractEntity
T3o\Election\Domain\Model\ElectionVote {
mapping {
tableName = tx_election_domain_model_electionvote
columns {
elector {
mapOnProperty = elector
config {
type = select
foreign_table = tx_election_domain_model_elector
}
}
election {
mapOnProperty = election
config {
type = select
foreign_table = tx_election_domain_model_election
}
}
nominee {
mapOnProperty = nominee
config {
type = select
foreign_table = tx_election_domain_model_nominee
}
}
}
}
}
}
plugin {
tx_election {
features {
...
...
@@ -238,4 +12,4 @@ page {
includeJSFooter {
election = EXT:election/Resources/Public/JavaScript/election.js
}
}
\ No newline at end of file
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment