Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
typo3
qfq
Commits
c4545f5e
Commit
c4545f5e
authored
Feb 08, 2018
by
Carsten Rose
Browse files
Merge remote-tracking branch 'origin/master' into punktetool
parents
6abf1317
4195ca48
Changes
8
Hide whitespace changes
Inline
Side-by-side
doc/CODING.md
View file @
c4545f5e
...
...
@@ -216,7 +216,7 @@ Formelement type: DATE / DATETIME / TIME
*
regexp might be user defined. If given, do not use system regexp!
*
No min/max check.
*
Server:
*
check with system wi
r
de regexp
*
check with system wide regexp
*
regexp might be user defined. If given, do not use system regexp!
*
Do min/max check.
...
...
@@ -250,8 +250,8 @@ Debug / Log
$this->store->getVar(SYSTEM_SHOW_DEBUG_INFO, STORE_SYSTEM) === 'yes'
Errormessages & Eceptions
=========================
Errormessages & E
x
ceptions
=========================
=
*
Exception types:
*
Code
...
...
doc/HTML.md
View file @
c4545f5e
...
...
@@ -4,7 +4,7 @@ This document explains the HTML markup used by QFQ.
## Hooks
Hooks are used on
by
the Client to gather information required for
Hooks are used on the Client to gather information required for
asynchronous requests and to add predefined event handlers to HTML Elements.
...
...
doc/PROTOCOL.md
View file @
c4545f5e
...
...
@@ -23,7 +23,7 @@ JSON Response from the server containing at least:
"message": "<message>"
}
`status`
indicates whether or not the request has been ful
l
filed by
`status`
indicates whether or not the request has been fulfil
l
ed by
the server (
`"success"`
) or encountered an error (
`"error"`
). On
`"error"`
the Client must display
`"<message>"`
to the user. On
`"success"`
, the Client may display
`"<message>"`
to the user.
...
...
extension/Documentation/Manual.rst
View file @
c4545f5e
...
...
@@ -3490,7 +3490,7 @@ Type: sendmail
* processing `afterSave` action `FormElements`.
* *FormElement.value*: Body of the email.
* *FormElement.value*: Body of the email.
See also: `html-formatting`_
* *FormElement.parameter*:
...
...
@@ -5532,7 +5532,7 @@ Send text emails. Every mail will be logged in the table `mailLog`. Attachments
+----------+----------------------------------------+--------------------------------------------------------------------------------------------------+------------+
| s | Subject |**Subject**: Subject of the email | yes |
+----------+----------------------------------------+--------------------------------------------------------------------------------------------------+------------+
| b | Body |**Body**: Message
| yes |
| b | Body |**Body**: Message
- see also: `html-formatting`_
| yes |
+----------+----------------------------------------+--------------------------------------------------------------------------------------------------+------------+
| h | Mail header |**Custom mail header**: Separate multiple header with \\r\\n | |
+----------+----------------------------------------+--------------------------------------------------------------------------------------------------+------------+
...
...
@@ -5592,6 +5592,13 @@ Additional the CEO as well as backup will receive the mail via CC and BCC.
For
debugging
,
please
check
`
REDIRECT_ALL_MAIL_TO
`
_
.
..
_html-formatting
:
**
Mail
Body
HTML
Formatting
**
In
order
to
send
an
email
with
HTML
formatting
,
such
as
bold
text
or
bullet
lists
,
simply
start
the
email
body
with
<
html
>
.
The
subsequent
contents
will
be
interpreted
as
HTML
and
is
rendered
correctly
by
most
email
programs
.
..
_attachment
:
Attachment
...
...
extension/qfq/qfq/Constants.php
View file @
c4545f5e
...
...
@@ -187,6 +187,7 @@ const ERROR_MAX_FILE_SIZE_TOO_BIG = 1082;
const
ERROR_SMALLER_THAN_MIN
=
1083
;
const
ERROR_LARGER_THAN_MAX
=
1084
;
const
ERROR_INVALID_DECIMAL_FORMAT
=
1085
;
const
ERROR_INVALID_DATE
=
1086
;
// Subrecord
const
ERROR_SUBRECORD_MISSING_COLUMN_ID
=
1100
;
...
...
extension/qfq/qfq/QuickFormQuery.php
View file @
c4545f5e
...
...
@@ -652,6 +652,10 @@ class QuickFormQuery {
unset
(
$form
[
FE_FILL_STORE_VAR
]);
}
// this is needed for filling templateGroup records with their default values
// and for evaluating variables in the Form title
$this
->
fillStoreWithRecord
(
$form
[
F_TABLE_NAME
],
$recordId
,
STORE_RECORD
);
$formSpec
=
$this
->
eval
->
parseArray
(
$form
);
// Setting defaults later is too late.
...
...
@@ -678,9 +682,6 @@ class QuickFormQuery {
// Set F_FINAL_DELETE_FORM
$formSpec
[
F_FINAL_DELETE_FORM
]
=
(
$formSpec
[
F_EXTRA_DELETE_FORM
]
!=
''
)
?
$formSpec
[
F_EXTRA_DELETE_FORM
]
:
$formSpec
[
F_NAME
];
// this is needed for filling templateGroup records with their default values
$this
->
fillStoreWithRecord
(
$formSpec
[
F_TABLE_NAME
],
$recordId
,
STORE_RECORD
);
// Fire FE_FILL_STORE_VAR after the primary form record has been loaded
if
(
!
empty
(
$fillStoreVar
))
{
$rows
=
$this
->
eval
->
parse
(
$fillStoreVar
);
...
...
@@ -978,6 +979,7 @@ class QuickFormQuery {
* @return array
*/
private
function
initForm
(
array
$formSpec
)
{
Support
::
setIfNotSet
(
$formSpec
,
F_EXTRA_DELETE_FORM
,
''
);
Support
::
setIfNotSet
(
$formSpec
,
F_SUBMIT_BUTTON_TEXT
,
''
);
Support
::
setIfNotSet
(
$formSpec
,
F_BUTTON_ON_CHANGE_CLASS
,
''
);
...
...
extension/qfq/qfq/store/FillStoreForm.php
View file @
c4545f5e
...
...
@@ -302,7 +302,7 @@ class FillStoreForm {
}
/**
* Check $value as date/datime/time value and convert it to FORMAT_DATE_INTERNATIONAL.
* Check $value as date/dat
et
ime/time value and convert it to FORMAT_DATE_INTERNATIONAL.
*
* @param array $formElement - if not set, set $formElement[FE_DATE_FORMAT]
* @param string $value - date/datetime/time value in format FORMAT_DATE_INTERNATIONAL or FORMAT_DATE_GERMAN
...
...
@@ -310,7 +310,7 @@ class FillStoreForm {
* @return string - checked datetime string
* @throws UserFormException
*/
p
rivate
function
doDateTime
(
array
&
$formElement
,
$value
)
{
p
ublic
function
doDateTime
(
array
&
$formElement
,
$value
)
{
$regexp
=
Support
::
dateTimeRegexp
(
$formElement
[
FE_TYPE
],
$formElement
[
FE_DATE_FORMAT
]);
...
...
@@ -319,9 +319,17 @@ class FillStoreForm {
throw
new
UserFormException
(
"DateTime format not recognized:
$placeholder
/
$value
"
,
ERROR_DATE_TIME_FORMAT_NOT_RECOGNISED
);
}
$showTime
=
$formElement
[
FE_TYPE
]
==
'date'
?
'0'
:
'1'
;
$showTime
=
$formElement
[
FE_TYPE
]
==
FE_TYPE_DATE
?
'0'
:
'1'
;
$value
=
Support
::
convertDateTime
(
$value
,
FORMAT_DATE_INTERNATIONAL
,
'1'
,
$showTime
,
$formElement
[
FE_SHOW_SECONDS
]);
if
(
$formElement
[
FE_TYPE
]
!==
FE_TYPE_TIME
)
{
// Validate date (e.g. 2010-02-31)
$dateValue
=
explode
(
' '
,
$value
)[
0
];
$dateParts
=
explode
(
'-'
,
$dateValue
);
if
(
!
checkdate
(
$dateParts
[
1
],
$dateParts
[
2
],
$dateParts
[
0
]))
throw
new
UserFormException
(
"
$dateValue
is not a valid date."
,
ERROR_INVALID_DATE
);
}
return
$value
;
}
}
\ No newline at end of file
extension/qfq/tests/phpunit/FillStoreFormTest.php
View file @
c4545f5e
...
...
@@ -19,23 +19,44 @@ class FillStoreFormTest extends \PHPUnit_Framework_TestCase {
* @throws CodeException
* @throws UserFormException
*/
public
function
testFake
()
{
# Violates SANITIZE class: SANITIZE string is always an empty string.
# Access are cached: use new variables for every test.
public
function
testDoDateTime
()
{
$formElement
=
[
FE_TYPE
=>
FE_TYPE_DATE
,
FE_DATE_FORMAT
=>
FORMAT_DATE_INTERNATIONAL
,
FE_SHOW_SECONDS
=>
0
];
$msg
=
'doDateTime fails'
;
$val
=
'2010-03-31'
;
$this
->
assertEquals
(
$val
,
FillStoreForm
::
doDateTime
(
$formElement
,
$val
),
$msg
);
$val
=
'2010-02-28'
;
$this
->
assertEquals
(
$val
,
FillStoreForm
::
doDateTime
(
$formElement
,
$val
),
$msg
);
$val
=
'2012-02-29'
;
$this
->
assertEquals
(
$val
,
FillStoreForm
::
doDateTime
(
$formElement
,
$val
),
$msg
);
$formElement
[
FE_DATE_FORMAT
]
=
FORMAT_DATE_GERMAN
;
$this
->
assertEquals
(
$val
,
FillStoreForm
::
doDateTime
(
$formElement
,
'29.02.2012'
),
$msg
);
}
# Check ''
// $this->assertEquals('', Sanitize::sanitize('', SANITIZE_ALLOW_ALNUMX), "SANITIZE_ALNUMX fails");
$this
->
assertEquals
(
''
,
''
);
/**
* @expectedException \qfq\UserFormException
*/
public
function
testDoDateTimeInvalidDate
()
{
$formElement
=
[
FE_TYPE
=>
FE_TYPE_DATE
,
FE_DATE_FORMAT
=>
FORMAT_DATE_INTERNATIONAL
,
FE_SHOW_SECONDS
=>
0
];
$val
=
'2010-02-29'
;
$this
->
assertEquals
(
$val
,
FillStoreForm
::
doDateTime
(
$formElement
,
$val
),
"doDateTime is passing when it shouldn't"
);
}
/**
* @expectedException \qfq\UserFormException
*/
public
function
testDoDateTimeInvalidDateWithTime
()
{
$formElement
=
[
FE_TYPE
=>
FE_TYPE_DATE
,
FE_DATE_FORMAT
=>
FORMAT_DATE_INTERNATIONAL
,
FE_SHOW_SECONDS
=>
0
];
$val
=
'2010-02-31 23:25'
;
$this
->
assertEquals
(
$val
,
FillStoreForm
::
doDateTime
(
$formElement
,
$val
),
"doDateTime is passing when it shouldn't"
);
}
//
// /**
// * @expectedException \qfq\UserFormException
// */
// public function testSanitizeExceptionMinMaxMissingMin() {
// Sanitize::sanitize(56, SANITIZE_ALLOW_MIN_MAX, '|45');
// }
//
}
Write
Preview
Supports
Markdown
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