Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Pasteque
pasteque-server
Commits
d029afbc
Commit
d029afbc
authored
Feb 15, 2019
by
Karamel
Browse files
Fix fiscal ticket import for fiscal mirror mode.
parent
e5288ea1
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/http/routes/fiscal.php
View file @
d029afbc
...
...
@@ -232,6 +232,8 @@ $app->POST('/api/fiscal/import', function($request, $response, $args) {
$tkts
=
[];
foreach
(
$data
as
$tkt
)
{
$tkt
[
'date'
]
=
DateUtils
::
readDate
(
$tkt
[
'date'
]);
unset
(
$tkt
[
'id'
]);
// We don't care about id as FiscalTicketAPI checks with snapshots.
// And it messes things up with Doctrine.
$tkts
[]
=
FiscalTicket
::
fromStruct
(
$tkt
,
$ptApp
->
getDao
());
}
$apiResult
=
APICaller
::
run
(
$ptApp
,
'fiscal'
,
'batchImport'
,
[
$tkts
]);
...
...
tests/fiscalmirror/http/HttpFiscalTest.php
View file @
d029afbc
...
...
@@ -78,8 +78,6 @@ class HttpFiscalTest extends TestCase
$tkt2
->
setContent
(
'Mewtwo'
);
$tkt2
->
sign
(
$tkt
);
$tkts
=
[
$tkt
->
toStruct
(),
$tkt2
->
toStruct
()];
unset
(
$tkts
[
0
][
'id'
]);
unset
(
$tkts
[
1
][
'id'
]);
// Import
curl_setopt
(
$this
->
curl
,
CURLOPT_URL
,
apiUrl
(
'api/fiscal/import'
));
curl_setopt
(
$this
->
curl
,
CURLOPT_HTTPHEADER
,
...
...
@@ -112,7 +110,6 @@ class HttpFiscalTest extends TestCase
$tkt
->
setContent
(
'Nippon Ichi!'
);
$tkt
->
sign
(
null
);
$tkts
=
[
$tkt
->
toStruct
()];
unset
(
$tkts
[
0
][
'id'
]);
// Import
curl_setopt
(
$this
->
curl
,
CURLOPT_URL
,
apiUrl
(
'api/fiscal/import'
));
curl_setopt
(
$this
->
curl
,
CURLOPT_HTTPHEADER
,
...
...
@@ -131,7 +128,6 @@ class HttpFiscalTest extends TestCase
$tkt2
->
setContent
(
'Mewtwo'
);
$tkt2
->
sign
(
$tkt
);
$tkts
[]
=
$tkt2
->
toStruct
();
unset
(
$tkts
[
1
][
'id'
]);
// Import the whole
curl_setopt
(
$this
->
curl
,
CURLOPT_URL
,
apiUrl
(
'api/fiscal/import'
));
curl_setopt
(
$this
->
curl
,
CURLOPT_HTTPHEADER
,
...
...
@@ -163,7 +159,6 @@ class HttpFiscalTest extends TestCase
$tkt
->
setContent
(
'Nippon Ichi!'
);
$tkt
->
sign
(
null
);
$tkts
=
[
$tkt
->
toStruct
()];
unset
(
$tkts
[
0
][
'id'
]);
// Import
curl_setopt
(
$this
->
curl
,
CURLOPT_URL
,
apiUrl
(
'api/fiscal/import'
));
curl_setopt
(
$this
->
curl
,
CURLOPT_HTTPHEADER
,
...
...
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