BxBaseModPaymentGridOrders.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php defined('BX_DOL') or die('hack attempt');
  2. /**
  3. * Copyright (c) UNA, Inc - https://una.io
  4. * MIT License - https://opensource.org/licenses/MIT
  5. *
  6. * @defgroup BasePayment Base classes for Payment like modules
  7. * @ingroup UnaModules
  8. *
  9. * @{
  10. */
  11. class BxBaseModPaymentGridOrders extends BxBaseModPaymentGridTransactions
  12. {
  13. public function __construct ($aOptions, $oTemplate = false)
  14. {
  15. parent::__construct ($aOptions, $oTemplate);
  16. }
  17. public function getCode ($isDisplayHeader = true)
  18. {
  19. if(empty($this->_aQueryAppend['seller_id']) || $this->_aQueryAppend['seller_id'] != bx_get_logged_profile_id())
  20. return '';
  21. return parent::getCode($isDisplayHeader);
  22. }
  23. public function performActionCancel()
  24. {
  25. $aIds = bx_get('ids');
  26. if(!$aIds || !is_array($aIds))
  27. return $this->_bIsApi ? [] : echoJson([]);
  28. $oOrders = $this->_oModule->getObjectOrders();
  29. $iAffected = 0;
  30. $aAffected = array();
  31. foreach($aIds as $iId)
  32. if($oOrders->cancel($this->_sOrdersType, $iId)) {
  33. $aAffected[] = $iId;
  34. $iAffected++;
  35. }
  36. if(!$iAffected)
  37. return ($sMsg = _t($this->_sLangsPrefix . 'err_cannot_perform')) && $this->_bIsApi ? [bx_api_get_msg($sMsg)] : echoJson(['msg' => $sMsg]);
  38. return $this->_bIsApi ? [] : echoJson(['grid' => $this->getCode(false), 'blink' => $aAffected]);
  39. }
  40. }
  41. /** @} */