AvizeRepository.php 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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 AvizeRepository extends Repository implements \Core\App\Repository\Facturis\AvizeInterface
  28. {
  29. const DOCUMENT_TYPE = "avize";
  30. const ROMANIAN_LANG_ID = "1";
  31. const RON_CURRENCY = "RON";
  32. const A4_FORMAT = "1";
  33. public function add($avize)
  34. {
  35. $response = $this->insertAvize($avize);
  36. // $marketplaceAvizeRepository = new \MarketplaceRepository\AvizeRepository(
  37. // $this->settingsRepository->getToken(),
  38. // $this->settingsRepository->getShop()
  39. // );
  40. // $factId = $marketplaceAvizeRepository->getFactId($avize['dataFact']['id_order']);
  41. //
  42. // $values = array(
  43. // "facturi_key"=> $factId
  44. // );
  45. //
  46. // $resp = $this->checkAvize($values);
  47. //
  48. // if(\Configuration::get('fsync_option_showobs') == 'inactiv'){
  49. // $avize['dataFact']['facturi_obs_up'] = '';
  50. // $avize['dataFact']['facturi_obs_client'] = '';
  51. // }
  52. //
  53. // if(\Configuration::get('fsync_option_docupd') == 'activ'){
  54. //
  55. // if($resp == null ){
  56. // $response = $this->insertAvize($avize);
  57. // }else{
  58. // $response = [
  59. // 'id_fact' => $factId,
  60. // ];
  61. // }
  62. //
  63. // } else {
  64. //
  65. // if(!$resp == null && ($resp[0]['facturi_key'] == $factId) && ($resp[0]['facturi_status'] == 'Emisa')){
  66. // $avize['dataFact']['facturi_key'] = $factId;
  67. // $avize['dataFact']['facturi_data'] = $resp[0]['facturi_data'];
  68. // $avize['dataFact']['facturi_numar'] = $resp[0]['facturi_serie_numar'];
  69. // $response = $this->updateAvize($avize);
  70. // } elseif($resp == null ){
  71. // $response = $this->insertAvize($avize);
  72. // }else{
  73. // $response = [
  74. // 'id_fact' => $factId,
  75. // ];
  76. // }
  77. //
  78. // }
  79. //
  80. // return $response;
  81. }
  82. public function view($factId)
  83. {
  84. $params = array(
  85. "id_fact" => $factId,
  86. "type" => self::DOCUMENT_TYPE,
  87. "select_language" => self::ROMANIAN_LANG_ID,
  88. "select_currency" => self::RON_CURRENCY,
  89. "select_format" => self::A4_FORMAT
  90. );
  91. if (empty($factId)) {
  92. exit;
  93. }
  94. $this->viewAvize($params);
  95. }
  96. }