Commit d029afbc authored by Karamel's avatar Karamel
Browse files

Fix fiscal ticket import for fiscal mirror mode.

parent e5288ea1
......@@ -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]);
......
......@@ -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,
......
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