* @copyright 2007-2021 PrestaShop SA * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA */ namespace Core\FacturisRepository; class ExpfacturaRepository extends Repository implements \Core\App\Repository\Facturis\ExpfacturaInterface { const DOCUMENT_TYPE = "expfactura"; const ROMANIAN_LANG_ID = "1"; const RON_CURRENCY = "RON"; const A4_FORMAT = "1"; public function add($expfactura) { $response = $this->insertExpfactura($expfactura); // $marketplaceExpfacturaRepository = new \MarketplaceRepository\ExpfacturaRepository(); // $factId = $marketplaceExpfacturaRepository->getFactId($expfactura['dataFact']['id_order']); // // $values = array( // "facturi_key"=> $factId // ); // // $resp = $this->checkExpfactura($values); // // if(\Configuration::get('fsync_option_showobs') == 'inactiv'){ // $expfactura['dataFact']['facturi_obs_up'] = ''; // $expfactura['dataFact']['facturi_obs_client'] = ''; // } // // if(\Configuration::get('fsync_option_docupd') == 'activ'){ // // if($resp == null ){ // $response = $this->insertExpfactura($expfactura); // }else{ // $response = [ // 'id_fact' => $factId, // ]; // } // // } else { // // if(!$resp == null && ($resp[0]['facturi_key'] == $factId) && ($resp[0]['facturi_status'] == 'Emisa')){ // $expfactura['dataFact']['facturi_key'] = $factId; // $expfactura['dataFact']['facturi_data'] = $resp[0]['facturi_data']; // $expfactura['dataFact']['facturi_numar'] = $resp[0]['facturi_serie_numar']; // $response = $this->updateExpfactura($expfactura); // } elseif($resp == null ){ // $response = $this->insertExpfactura($expfactura); // }else{ // $response = [ // 'id_fact' => $factId, // ]; // } // // } // // return $response; } public function view($factId) { $params = array( "id_fact" => $factId, "type" => self::DOCUMENT_TYPE, "select_language" => self::ROMANIAN_LANG_ID, "select_currency" => self::RON_CURRENCY, "select_format" => self::A4_FORMAT ); if (empty($factId)) { exit; } $this->viewExpfactura($params); } }