moduleManager->getModuleInstance('Accounting', 'Api'); $fp = \fopen(__DIR__ . '/Install/Coa/skr03.csv', 'r'); if ($fp === false) { return; } $c = 0; $definitions = []; $languages = 0; while (($line = \fgetcsv($fp)) !== false) { ++$c; if ($c === 2) { $definitions = $line; $languages = \count($definitions) - 19; } if ($c < 3) { continue; } $response = new HttpResponse(); $request = new HttpRequest(new HttpUri('')); $request->header->account = 1; $request->setData('account', $line[0]); $request->setData('content', \trim($line[19])); $request->setData('language', $definitions[19]); $module->apiAccountCreate($request, $response); $responseData = $response->get(''); if (!\is_array($responseData)) { continue; } $accountId = $responseData['response']->id; for ($i = 1; $i < $languages; ++$i) { $response = new HttpResponse(); $request = new HttpRequest(new HttpUri('')); $request->header->account = 1; $request->setData('ref', $accountId); $request->setData('content', \trim($line[19 + $i])); $request->setData('language', $definitions[19 + $i]); $module->apiAccountL11nCreate($request, $response); } } \fclose($fp); } }