Skip to content

Commit

Permalink
Ticket #3265
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonLV committed Apr 1, 2021
1 parent 4cc072d commit 7ee2fa0
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions modules/boonex/ads/classes/BxAdsModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,9 @@ public function actionMakeOffer()
$iAuthorId = bx_get_logged_profile_id();
$iContentId = bx_process_input(bx_get('id'), BX_DATA_INT);

if(empty($iAuthorId))
return echoJson(array('code' => 1, 'eval' => 'window.open("' . BxDolPermalinks::getInstance()->permalink('page.php?i=login') . '", "_self");'));

$aContentInfo = $this->_oDb->getContentInfoById($iContentId);
if(empty($aContentInfo) || !is_array($aContentInfo))
return echoJson(array());
Expand All @@ -143,7 +146,7 @@ public function actionMakeOffer()
));

if(!empty($aOffer) && is_array($aOffer))
return echoJson(array('code' => 1, 'msg' => _t('_bx_ads_txt_err_duplicate')));
return echoJson(array('code' => 2, 'msg' => _t('_bx_ads_txt_err_duplicate')));

$aOffer = $this->_oDb->getOffersBy(array(
'type' => 'content_and_author_ids',
Expand All @@ -153,7 +156,7 @@ public function actionMakeOffer()
));

if(!empty($aOffer) && is_array($aOffer))
return echoJson(array('code' => 1, 'msg' => _t('_bx_ads_txt_err_offer_accepted')));
return echoJson(array('code' => 3, 'msg' => _t('_bx_ads_txt_err_offer_accepted')));

$oForm = BxDolForm::getObjectInstance($CNF['OBJECT_FORM_OFFER'], $CNF['OBJECT_FORM_OFFER_DISPLAY_ADD']);
$oForm->aFormAttrs['action'] = BX_DOL_URL_ROOT . bx_append_url_params($this->_oConfig->getBaseUri() . 'make_offer', array('id' => $iContentId));
Expand All @@ -166,7 +169,7 @@ public function actionMakeOffer()
if($iId != 0)
$aResult = array('code' => 0, 'msg' => _t('_bx_ads_txt_msg_offer_added'), 'eval' => $sJsObject . '.onMakeOffer(oData);', 'id' => $iId);
else
$aResult = array('code' => 2, 'msg' => _t('_bx_ads_txt_err_cannot_perform_action'));
$aResult = array('code' => 4, 'msg' => _t('_bx_ads_txt_err_cannot_perform_action'));

$this->onOfferAdded($iId);

Expand Down

0 comments on commit 7ee2fa0

Please sign in to comment.