BxBaseModPaymentInstaller.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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 BxBaseModPaymentInstaller extends BxBaseModGeneralInstaller
  12. {
  13. protected $_sParamDefaultPayment;
  14. function __construct($aConfig)
  15. {
  16. parent::__construct($aConfig);
  17. $this->_sParamDefaultPayment = 'sys_default_payment';
  18. }
  19. function enable($aParams)
  20. {
  21. $aResult = parent::enable($aParams);
  22. if($aResult['result'] && getParam($this->_sParamDefaultPayment) == '')
  23. setParam($this->_sParamDefaultPayment, $this->_aConfig['name']);
  24. if($aResult['result'])
  25. BxDolService::call($this->_aConfig['name'], 'update_dependent_modules');
  26. return $aResult;
  27. }
  28. function disable($aParams)
  29. {
  30. $aResult = parent::disable($aParams);
  31. if($aResult['result'] && getParam($this->_sParamDefaultPayment) == $this->_aConfig['name'])
  32. setParam($this->_sParamDefaultPayment, '');
  33. return $aResult;
  34. }
  35. }
  36. /** @} */