ExpfacturaRepository.php 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. <?php
  2. /**
  3. * 2007-2021 PrestaShop
  4. *
  5. * NOTICE OF LICENSE
  6. *
  7. * This source file is subject to the Academic Free License (AFL 3.0)
  8. * that is bundled with this package in the file LICENSE.txt.
  9. * It is also available through the world-wide-web at this URL:
  10. * http://opensource.org/licenses/afl-3.0.php
  11. * If you did not receive a copy of the license and are unable to
  12. * obtain it through the world-wide-web, please send an email
  13. * to license@prestashop.com so we can send you a copy immediately.
  14. *
  15. * DISCLAIMER
  16. *
  17. * Do not edit or add to this file if you wish to upgrade PrestaShop to newer
  18. * versions in the future. If you wish to customize PrestaShop for your
  19. * needs please refer to http://www.prestashop.com for more information.
  20. *
  21. * @author PrestaShop SA <contact@prestashop.com>
  22. * @copyright 2007-2021 PrestaShop SA
  23. * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
  24. * International Registered Trademark & Property of PrestaShop SA
  25. */
  26. namespace Core\FacturisRepository;
  27. class ExpfacturaRepository extends Repository implements \Core\App\Repository\Facturis\ExpfacturaInterface
  28. {
  29. const DOCUMENT_TYPE = "expfactura";
  30. const ROMANIAN_LANG_ID = "1";
  31. const RON_CURRENCY = "RON";
  32. const A4_FORMAT = "1";
  33. public function add($expfactura)
  34. {
  35. $response = $this->insertExpfactura($expfactura);
  36. // $marketplaceExpfacturaRepository = new \MarketplaceRepository\ExpfacturaRepository();
  37. // $factId = $marketplaceExpfacturaRepository->getFactId($expfactura['dataFact']['id_order']);
  38. //
  39. // $values = array(
  40. // "facturi_key"=> $factId
  41. // );
  42. //
  43. // $resp = $this->checkExpfactura($values);
  44. //
  45. // if(\Configuration::get('fsync_option_showobs') == 'inactiv'){
  46. // $expfactura['dataFact']['facturi_obs_up'] = '';
  47. // $expfactura['dataFact']['facturi_obs_client'] = '';
  48. // }
  49. //
  50. // if(\Configuration::get('fsync_option_docupd') == 'activ'){
  51. //
  52. // if($resp == null ){
  53. // $response = $this->insertExpfactura($expfactura);
  54. // }else{
  55. // $response = [
  56. // 'id_fact' => $factId,
  57. // ];
  58. // }
  59. //
  60. // } else {
  61. //
  62. // if(!$resp == null && ($resp[0]['facturi_key'] == $factId) && ($resp[0]['facturi_status'] == 'Emisa')){
  63. // $expfactura['dataFact']['facturi_key'] = $factId;
  64. // $expfactura['dataFact']['facturi_data'] = $resp[0]['facturi_data'];
  65. // $expfactura['dataFact']['facturi_numar'] = $resp[0]['facturi_serie_numar'];
  66. // $response = $this->updateExpfactura($expfactura);
  67. // } elseif($resp == null ){
  68. // $response = $this->insertExpfactura($expfactura);
  69. // }else{
  70. // $response = [
  71. // 'id_fact' => $factId,
  72. // ];
  73. // }
  74. //
  75. // }
  76. //
  77. // return $response;
  78. }
  79. public function view($factId)
  80. {
  81. $params = array(
  82. "id_fact" => $factId,
  83. "type" => self::DOCUMENT_TYPE,
  84. "select_language" => self::ROMANIAN_LANG_ID,
  85. "select_currency" => self::RON_CURRENCY,
  86. "select_format" => self::A4_FORMAT
  87. );
  88. if (empty($factId)) {
  89. exit;
  90. }
  91. $this->viewExpfactura($params);
  92. }
  93. }