AntonLV 5 лет назад
Родитель
Сommit
7da3fbb4e1

+ 2 - 0
modules/boonex/ads/classes/BxAdsConfig.php

@@ -48,6 +48,8 @@ class BxAdsConfig extends BxBaseModTextConfig
             'FIELD_AUTHOR' => 'author',
             'FIELD_AUTHOR' => 'author',
             'FIELD_ADDED' => 'added',
             'FIELD_ADDED' => 'added',
             'FIELD_CHANGED' => 'changed',
             'FIELD_CHANGED' => 'changed',
+            'FIELD_DELIVERED' => 'delivered',
+            'FIELD_RECEIVED' => 'received',
             'FIELD_TITLE' => 'title',
             'FIELD_TITLE' => 'title',
             'FIELD_NAME' => 'name',
             'FIELD_NAME' => 'name',
             'FIELD_TEXT' => 'text',
             'FIELD_TEXT' => 'text',

+ 55 - 0
modules/boonex/ads/classes/BxAdsDb.php

@@ -345,6 +345,52 @@ class BxAdsDb extends BxBaseModTextDb
         return $this->query($sQuery, $aWhereBindings) !== false;
         return $this->query($sQuery, $aWhereBindings) !== false;
     }
     }
 
 
+    public function getLicense($aParams = array())
+    {
+    	$CNF = &$this->_oConfig->CNF;
+    	$aMethod = array('name' => 'getAll', 'params' => array(0 => 'query'));
+
+    	$sSelectClause = "`tl`.*";
+    	$sJoinClause = $sWhereClause = $sLimitClause = "";
+        switch($aParams['type']) {
+            case 'id':
+            	$aMethod['name'] = 'getRow';
+            	$aMethod['params'][1] = array(
+                    'id' => $aParams['id']
+                );
+
+                $sWhereClause = " AND `tl`.`id`=:id";
+                break;
+
+            case 'has_by':
+                $aMethod['name'] = "getOne";
+                $aMethod['params'][1] = array(
+                    'profile_id' => $aParams['profile_id'],
+                    'entry_id' => $aParams['entry_id']
+                );
+
+                $sSelectClause = "`tl`.`id`";
+                $sWhereClause = " AND `tl`.`profile_id`=:profile_id AND `tl`.`entry_id`=:entry_id";
+
+                if(!empty($aParams['order'])) {
+                    $aMethod['params'][1]['order'] = $aParams['order'];
+                    $sWhereClause .= " AND `tl`.`order`=:order";
+                }
+
+                $sLimitClause = "1";
+                break;
+        }
+
+        $sLimitClause = !empty($sLimitClause) ? "LIMIT " . $sLimitClause : $sLimitClause;
+
+        $aMethod['params'][0] = "SELECT
+            " . $sSelectClause . "
+            FROM `" . $this->_oConfig->CNF['TABLE_LICENSES'] . "` AS `tl`" . $sJoinClause . "
+            WHERE 1" . $sWhereClause . " " . $sLimitClause;
+
+        return call_user_func_array(array($this, $aMethod['name']), $aMethod['params']);
+    }
+
     public function updateLicense($aSet, $aWhere)
     public function updateLicense($aSet, $aWhere)
     {
     {
         $CNF = &$this->_oConfig->CNF;
         $CNF = &$this->_oConfig->CNF;
@@ -352,6 +398,15 @@ class BxAdsDb extends BxBaseModTextDb
         return (int)$this->query("UPDATE `" . $CNF['TABLE_LICENSES'] . "` SET " . $this->arrayToSQL($aSet) . " WHERE " . (!empty($aWhere) ? $this->arrayToSQL($aWhere, ' AND ') : "1")) > 0;
         return (int)$this->query("UPDATE `" . $CNF['TABLE_LICENSES'] . "` SET " . $this->arrayToSQL($aSet) . " WHERE " . (!empty($aWhere) ? $this->arrayToSQL($aWhere, ' AND ') : "1")) > 0;
     }
     }
 
 
+    public function hasLicense($iProfileId, $iEntryId)
+    {
+    	return (int)$this->getLicense(array(
+            'type' => 'has_by', 
+            'profile_id' => $iProfileId, 
+            'entry_id' => $iEntryId
+    	)) > 0;
+    }
+
     protected function _getEntriesBySearchIds($aParams, &$aMethod, &$sSelectClause, &$sJoinClause, &$sWhereClause, &$sOrderClause, &$sLimitClause)
     protected function _getEntriesBySearchIds($aParams, &$aMethod, &$sSelectClause, &$sJoinClause, &$sWhereClause, &$sOrderClause, &$sLimitClause)
     {
     {
         $CNF = &$this->_oConfig->CNF;
         $CNF = &$this->_oConfig->CNF;

+ 12 - 0
modules/boonex/ads/classes/BxAdsMenuView.php

@@ -92,6 +92,18 @@ class BxAdsMenuView extends BxBaseModTextMenuView
                 $bResult = $this->_oModule->isAllowedViewOffers($this->_aContentInfo);
                 $bResult = $this->_oModule->isAllowedViewOffers($this->_aContentInfo);
                 break;
                 break;
 
 
+            case 'approve':
+                $bResult = $this->_oModule->isAllowedApprove($this->_aContentInfo);
+                break;
+
+            case 'delivered':
+                $bResult = $this->_oModule->isAllowedMarkDelivered($this->_aContentInfo);
+                break;
+
+            case 'received':
+                $bResult = $this->_oModule->isAllowedMarkReceived($this->_aContentInfo);
+                break;
+
             default:
             default:
                 $bResult = true;
                 $bResult = true;
         }
         }

+ 10 - 0
modules/boonex/ads/classes/BxAdsMenuViewActions.php

@@ -60,6 +60,16 @@ class BxAdsMenuViewActions extends BxBaseModTextMenuViewActions
     {
     {
         return $this->_getMenuItemByNameActions($aItem);
         return $this->_getMenuItemByNameActions($aItem);
     }
     }
+    
+    protected function _getMenuItemDelivered($aItem)
+    {
+        return $this->_getMenuItemByNameActions($aItem);
+    }
+
+    protected function _getMenuItemReceived($aItem)
+    {
+        return $this->_getMenuItemByNameActions($aItem);
+    }
 
 
     protected function _getMenuItemReview($aItem, $aParams = array())
     protected function _getMenuItemReview($aItem, $aParams = array())
     {
     {

+ 95 - 9
modules/boonex/ads/classes/BxAdsModule.php

@@ -171,6 +171,16 @@ class BxAdsModule extends BxBaseModTextModule
         return echoJson(array('popup' => array('html' => $sContent, 'options' => array('closeOnOuterClick' => false, 'removeOnClose' => true))));
         return echoJson(array('popup' => array('html' => $sContent, 'options' => array('closeOnOuterClick' => false, 'removeOnClose' => true))));
     }
     }
 
 
+    public function actionDelivered()
+    {
+        return echoJson($this->_actionMarkAs('delivered'));
+    }
+
+    public function actionReceived()
+    {
+        return echoJson($this->_actionMarkAs('received'));
+    }
+
     public function serviceGetSafeServices()
     public function serviceGetSafeServices()
     {
     {
         $a = parent::serviceGetSafeServices();
         $a = parent::serviceGetSafeServices();
@@ -1013,7 +1023,7 @@ class BxAdsModule extends BxBaseModTextModule
 
 
         return $this->_oConfig->isAuction() && (int)$aContentInfo[$CNF['FIELD_AUCTION']] != 0;
         return $this->_oConfig->isAuction() && (int)$aContentInfo[$CNF['FIELD_AUCTION']] != 0;
     }
     }
-    
+
     public function isAllowedMakeOffer($mixedContent, $isPerformAction = false)
     public function isAllowedMakeOffer($mixedContent, $isPerformAction = false)
     {
     {
         return $this->checkAllowedMakeOffer($mixedContent, $isPerformAction) === CHECK_ACTION_RESULT_ALLOWED;
         return $this->checkAllowedMakeOffer($mixedContent, $isPerformAction) === CHECK_ACTION_RESULT_ALLOWED;
@@ -1022,18 +1032,22 @@ class BxAdsModule extends BxBaseModTextModule
     public function checkAllowedMakeOffer($mixedContent, $isPerformAction = false)
     public function checkAllowedMakeOffer($mixedContent, $isPerformAction = false)
     {
     {
         $CNF = &$this->_oConfig->CNF;
         $CNF = &$this->_oConfig->CNF;
+        $sTxtError = '_sys_txt_access_denied';
 
 
         if(!is_array($mixedContent))
         if(!is_array($mixedContent))
             $mixedContent = $this->_oDb->getContentInfoById((int)$mixedContent);
             $mixedContent = $this->_oDb->getContentInfoById((int)$mixedContent);
 
 
+        if(empty($mixedContent) || !is_array($mixedContent))
+            return _t($sTxtError);
+
         if(!$this->isAuction($mixedContent) || (int)$mixedContent[$CNF['FIELD_QUANTITY']] <= 0)
         if(!$this->isAuction($mixedContent) || (int)$mixedContent[$CNF['FIELD_QUANTITY']] <= 0)
-            return _t('_sys_txt_access_denied');
+            return _t($sTxtError);
 
 
-        if(!empty($mixedContent) && is_array($mixedContent) && $mixedContent[$CNF['FIELD_AUTHOR']] != bx_get_logged_profile_id())
+        if($mixedContent[$CNF['FIELD_AUTHOR']] != bx_get_logged_profile_id())
             return CHECK_ACTION_RESULT_ALLOWED;
             return CHECK_ACTION_RESULT_ALLOWED;
 
 
-        return _t('_sys_txt_access_denied');
-    }    
+        return _t($sTxtError);
+    }
 
 
     public function isAllowedViewOffers($mixedContent, $isPerformAction = false)
     public function isAllowedViewOffers($mixedContent, $isPerformAction = false)
     {
     {
@@ -1043,22 +1057,70 @@ class BxAdsModule extends BxBaseModTextModule
     public function checkAllowedViewOffers($mixedContent, $isPerformAction = false)
     public function checkAllowedViewOffers($mixedContent, $isPerformAction = false)
     {
     {
         $CNF = &$this->_oConfig->CNF;
         $CNF = &$this->_oConfig->CNF;
+        $sTxtError = '_sys_txt_access_denied';
 
 
         if(!is_array($mixedContent))
         if(!is_array($mixedContent))
             $mixedContent = $this->_oDb->getContentInfoById((int)$mixedContent);
             $mixedContent = $this->_oDb->getContentInfoById((int)$mixedContent);
 
 
+        if(empty($mixedContent) || !is_array($mixedContent))
+            return _t($sTxtError);
+
         if(!$this->isAuction($mixedContent))
         if(!$this->isAuction($mixedContent))
-            return _t('_sys_txt_access_denied');
+            return _t($sTxtError);
 
 
-        if($this->checkAllowedEditAnyEntry($isPerformAction) === CHECK_ACTION_RESULT_ALLOWED)
+        if($this->_isModerator())
             return CHECK_ACTION_RESULT_ALLOWED;
             return CHECK_ACTION_RESULT_ALLOWED;
 
 
-        if(!empty($mixedContent) && is_array($mixedContent) && $mixedContent[$CNF['FIELD_AUTHOR']] == bx_get_logged_profile_id())
+        if($mixedContent[$CNF['FIELD_AUTHOR']] == bx_get_logged_profile_id())
             return CHECK_ACTION_RESULT_ALLOWED;
             return CHECK_ACTION_RESULT_ALLOWED;
 
 
-        return _t('_sys_txt_access_denied');
+        return _t($sTxtError);
+    }
+
+    public function isAllowedMarkDelivered($mixedContent, $isPerformAction = false)
+    {
+        return $this->checkAllowedMarkDelivered($mixedContent, $isPerformAction) === CHECK_ACTION_RESULT_ALLOWED;
+    }
+
+    public function checkAllowedMarkDelivered($mixedContent, $isPerformAction = false)
+    {
+        $CNF = &$this->_oConfig->CNF;
+        $sTxtError = '_sys_txt_access_denied';
+
+        if(!is_array($mixedContent))
+            $mixedContent = $this->_oDb->getContentInfoById((int)$mixedContent);
+
+        if(empty($mixedContent) || !is_array($mixedContent))
+            return _t($sTxtError);
+
+        if((int)$mixedContent[$CNF['FIELD_DELIVERED']] != 0 || $mixedContent[$CNF['FIELD_AUTHOR']] != bx_get_logged_profile_id())
+            return _t($sTxtError);
+
+        return CHECK_ACTION_RESULT_ALLOWED;
+    }
+    
+    public function isAllowedMarkReceived($mixedContent, $isPerformAction = false)
+    {
+        return $this->checkAllowedMarkReceived($mixedContent, $isPerformAction) === CHECK_ACTION_RESULT_ALLOWED;
     }
     }
 
 
+    public function checkAllowedMarkReceived($mixedContent, $isPerformAction = false)
+    {
+        $CNF = &$this->_oConfig->CNF;
+        $sTxtError = '_sys_txt_access_denied';
+
+        if(!is_array($mixedContent))
+            $mixedContent = $this->_oDb->getContentInfoById((int)$mixedContent);
+
+        if(empty($mixedContent) || !is_array($mixedContent))
+            return _t($sTxtError);
+
+        if((int)$mixedContent[$CNF['FIELD_RECEIVED']] != 0 || !$this->_oDb->hasLicense(bx_get_logged_profile_id(), $mixedContent[$CNF['FIELD_ID']]))
+            return _t($sTxtError);
+
+        return CHECK_ACTION_RESULT_ALLOWED;
+    }
+    
     public function onOfferAdded($iOfferId)
     public function onOfferAdded($iOfferId)
     {
     {
         $CNF = &$this->_oConfig->CNF;
         $CNF = &$this->_oConfig->CNF;
@@ -1208,6 +1270,30 @@ class BxAdsModule extends BxBaseModTextModule
     /**
     /**
      * Internal methods.
      * Internal methods.
      */
      */
+    protected function _actionMarkAs($sAction)
+    {
+        $CNF = &$this->_oConfig->CNF;
+
+        $iContentId = bx_process_input(bx_get('id'), BX_DATA_INT);
+        $aContentInfo = $this->_oDb->getContentInfoById($iContentId);
+
+        $sMethodCheck = 'checkAllowedMark' . bx_gen_method_name($sAction);
+        if(!method_exists($this, $sMethodCheck))
+            return array();
+
+        if(($mixedCheckResult = $this->$sMethodCheck($aContentInfo)) !== CHECK_ACTION_RESULT_ALLOWED)
+            return array('msg' => $mixedCheckResult);
+
+        if((int)$this->_oDb->updateEntriesBy(array($CNF['FIELD_' . strtoupper($sAction)] => time()), array($CNF['FIELD_ID'] => $iContentId)) == 0)
+            return array('msg' => _t('_bx_ads_txt_err_cannot_perform_action'));
+
+        $this->$sMethodCheck($aContentInfo, true);
+
+        return array(
+            'reload' => 1
+        );
+    }
+
     protected function _serviceEntityForm ($sFormMethod, $iContentId = 0, $sDisplay = false, $sCheckFunction = false, $bErrorMsg = true)
     protected function _serviceEntityForm ($sFormMethod, $iContentId = 0, $sDisplay = false, $sCheckFunction = false, $bErrorMsg = true)
     {
     {
         $CNF = &$this->_oConfig->CNF;
         $CNF = &$this->_oConfig->CNF;

+ 4 - 0
modules/boonex/ads/install/langs/en.xml

@@ -291,6 +291,10 @@
     <string name="_bx_ads_menu_item_title_edit_entry"><![CDATA[Edit]]></string>
     <string name="_bx_ads_menu_item_title_edit_entry"><![CDATA[Edit]]></string>
     <string name="_bx_ads_menu_item_title_system_delete_entry"><![CDATA[Delete]]></string>
     <string name="_bx_ads_menu_item_title_system_delete_entry"><![CDATA[Delete]]></string>
     <string name="_bx_ads_menu_item_title_delete_entry"><![CDATA[Delete]]></string>
     <string name="_bx_ads_menu_item_title_delete_entry"><![CDATA[Delete]]></string>
+    <string name="_bx_ads_menu_item_title_system_mark_delivered"><![CDATA[Delivered]]></string>
+    <string name="_bx_ads_menu_item_title_mark_delivered"><![CDATA[Delivered]]></string>
+    <string name="_bx_ads_menu_item_title_system_mark_received"><![CDATA[Received]]></string>
+    <string name="_bx_ads_menu_item_title_mark_received"><![CDATA[Received]]></string>
     <string name="_bx_ads_menu_item_title_system_review_entry"><![CDATA[Review]]></string>
     <string name="_bx_ads_menu_item_title_system_review_entry"><![CDATA[Review]]></string>
     <string name="_bx_ads_menu_item_title_system_view_entry"><![CDATA[View Ad]]></string>
     <string name="_bx_ads_menu_item_title_system_view_entry"><![CDATA[View Ad]]></string>
     <string name="_bx_ads_menu_item_title_system_entries_home"><![CDATA[Ads]]></string>
     <string name="_bx_ads_menu_item_title_system_entries_home"><![CDATA[Ads]]></string>

+ 7 - 2
modules/boonex/ads/install/sql/enable.sql

@@ -250,7 +250,10 @@ INSERT INTO `sys_menu_items`(`set_name`, `module`, `name`, `title_system`, `titl
 ('bx_ads_view', 'bx_ads', 'make-offer', '_bx_ads_menu_item_title_system_make_offer', '_bx_ads_menu_item_title_make_offer', 'javascript:void(0);', 'javascript:{js_object}.makeOffer(this, {content_id})', '', 'hand-holding-usd', '', 2147483647, 1, 0, 16),
 ('bx_ads_view', 'bx_ads', 'make-offer', '_bx_ads_menu_item_title_system_make_offer', '_bx_ads_menu_item_title_make_offer', 'javascript:void(0);', 'javascript:{js_object}.makeOffer(this, {content_id})', '', 'hand-holding-usd', '', 2147483647, 1, 0, 16),
 ('bx_ads_view', 'bx_ads', 'view-offers', '_bx_ads_menu_item_title_system_view_offers', '_bx_ads_menu_item_title_view_offers', 'page.php?i=view-ad-offers&id={content_id}', '', '', '', '', 2147483647, 1, 0, 17),
 ('bx_ads_view', 'bx_ads', 'view-offers', '_bx_ads_menu_item_title_system_view_offers', '_bx_ads_menu_item_title_view_offers', 'page.php?i=view-ad-offers&id={content_id}', '', '', '', '', 2147483647, 1, 0, 17),
 ('bx_ads_view', 'bx_ads', 'edit-ad', '_bx_ads_menu_item_title_system_edit_entry', '_bx_ads_menu_item_title_edit_entry', 'page.php?i=edit-ad&id={content_id}', '', '', 'pencil-alt', '', 2147483647, 1, 0, 20),
 ('bx_ads_view', 'bx_ads', 'edit-ad', '_bx_ads_menu_item_title_system_edit_entry', '_bx_ads_menu_item_title_edit_entry', 'page.php?i=edit-ad&id={content_id}', '', '', 'pencil-alt', '', 2147483647, 1, 0, 20),
-('bx_ads_view', 'bx_ads', 'delete-ad', '_bx_ads_menu_item_title_system_delete_entry', '_bx_ads_menu_item_title_delete_entry', 'page.php?i=delete-ad&id={content_id}', '', '', 'remove', '', 2147483647, 1, 0, 30);
+('bx_ads_view', 'bx_ads', 'delete-ad', '_bx_ads_menu_item_title_system_delete_entry', '_bx_ads_menu_item_title_delete_entry', 'page.php?i=delete-ad&id={content_id}', '', '', 'remove', '', 2147483647, 1, 0, 30),
+('bx_ads_view', 'bx_ads', 'approve', '_sys_menu_item_title_system_va_approve', '_sys_menu_item_title_va_approve', 'javascript:void(0)', 'javascript:bx_approve(this,  ''{module_uri}'', {content_id});', '', 'check', '', 2147483647, 1, 0, 40),
+('bx_ads_view', 'bx_ads', 'delivered', '_bx_ads_menu_item_title_system_mark_delivered', '_bx_ads_menu_item_title_mark_delivered', 'javascript:void(0)', 'javascript:{js_object}.delivered(this, {content_id})', '', 'truck', '', 2147483647, 1, 0, 50),
+('bx_ads_view', 'bx_ads', 'received', '_bx_ads_menu_item_title_system_mark_received', '_bx_ads_menu_item_title_mark_received', 'javascript:void(0)', 'javascript:{js_object}.received(this, {content_id})', '', 'clipboard-check', '', 2147483647, 1, 0, 55);
 
 
 -- MENU: all actions menu for view entry 
 -- MENU: all actions menu for view entry 
 INSERT INTO `sys_objects_menu`(`object`, `title`, `set_name`, `module`, `template_id`, `deletable`, `active`, `override_class_name`, `override_class_file`) VALUES 
 INSERT INTO `sys_objects_menu`(`object`, `title`, `set_name`, `module`, `template_id`, `deletable`, `active`, `override_class_name`, `override_class_file`) VALUES 
@@ -266,7 +269,9 @@ INSERT INTO `sys_menu_items`(`set_name`, `module`, `name`, `title_system`, `titl
 ('bx_ads_view_actions', 'bx_ads', 'view-offers', '_bx_ads_menu_item_title_system_view_offers', '', '', '', '', '', '', '', 0, 2147483647, 1, 0, 17),
 ('bx_ads_view_actions', 'bx_ads', 'view-offers', '_bx_ads_menu_item_title_system_view_offers', '', '', '', '', '', '', '', 0, 2147483647, 1, 0, 17),
 ('bx_ads_view_actions', 'bx_ads', 'edit-ad', '_bx_ads_menu_item_title_system_edit_entry', '', '', '', '', '', '', '', 0, 2147483647, 1, 0, 20),
 ('bx_ads_view_actions', 'bx_ads', 'edit-ad', '_bx_ads_menu_item_title_system_edit_entry', '', '', '', '', '', '', '', 0, 2147483647, 1, 0, 20),
 ('bx_ads_view_actions', 'bx_ads', 'delete-ad', '_bx_ads_menu_item_title_system_delete_entry', '', '', '', '', '', '', '', 0, 2147483647, 1, 0, 30),
 ('bx_ads_view_actions', 'bx_ads', 'delete-ad', '_bx_ads_menu_item_title_system_delete_entry', '', '', '', '', '', '', '', 0, 2147483647, 1, 0, 30),
-('bx_ads_view_actions', 'bx_ads', 'approve', '_sys_menu_item_title_system_va_approve', '_sys_menu_item_title_va_approve', 'javascript:void(0)', 'javascript:bx_approve(this,  ''{module_uri}'', {content_id});', '', 'check', '', '', 0, 2147483647, 1, 0, 40),
+('bx_ads_view_actions', 'bx_ads', 'approve', '_sys_menu_item_title_system_va_approve', '', '', '', '', '', '', '', 0, 2147483647, 1, 0, 40),
+('bx_ads_view_actions', 'bx_ads', 'delivered', '_bx_ads_menu_item_title_system_mark_delivered', '', '', '', '', '', '', '', 0, 2147483647, 1, 0, 50),
+('bx_ads_view_actions', 'bx_ads', 'received', '_bx_ads_menu_item_title_system_mark_received', '', '', '', '', '', '', '', 0, 2147483647, 1, 0, 55),
 ('bx_ads_view_actions', 'bx_ads', 'review', '_bx_ads_menu_item_title_system_review_entry', '', '', '', '', '', '', '', 0, 2147483647, 0, 0, 190),
 ('bx_ads_view_actions', 'bx_ads', 'review', '_bx_ads_menu_item_title_system_review_entry', '', '', '', '', '', '', '', 0, 2147483647, 0, 0, 190),
 ('bx_ads_view_actions', 'bx_ads', 'comment', '_sys_menu_item_title_system_va_comment', '', '', '', '', '', '', '', 0, 2147483647, 0, 0, 200),
 ('bx_ads_view_actions', 'bx_ads', 'comment', '_sys_menu_item_title_system_va_comment', '', '', '', '', '', '', '', 0, 2147483647, 0, 0, 200),
 ('bx_ads_view_actions', 'bx_ads', 'view', '_sys_menu_item_title_system_va_view', '', '', '', '', '', '', '', 0, 2147483647, 1, 0, 210),
 ('bx_ads_view_actions', 'bx_ads', 'view', '_sys_menu_item_title_system_va_view', '', '', '', '', '', '', '', 0, 2147483647, 1, 0, 210),

+ 2 - 0
modules/boonex/ads/install/sql/install.sql

@@ -4,6 +4,8 @@ CREATE TABLE IF NOT EXISTS `bx_ads_entries` (
   `author` int(11) NOT NULL,
   `author` int(11) NOT NULL,
   `added` int(11) NOT NULL,
   `added` int(11) NOT NULL,
   `changed` int(11) NOT NULL,
   `changed` int(11) NOT NULL,
+  `delivered` int(11) NOT NULL,
+  `received` int(11) NOT NULL,
   `category` int(11) NOT NULL,
   `category` int(11) NOT NULL,
   `thumb` int(11) NOT NULL,
   `thumb` int(11) NOT NULL,
   `name` varchar(255) NOT NULL,
   `name` varchar(255) NOT NULL,

+ 24 - 33
modules/boonex/ads/js/entry.js

@@ -19,27 +19,34 @@ function BxAdsEntry(oOptions) {
 }
 }
 
 
 BxAdsEntry.prototype.interested = function(oElement, iContentId) {
 BxAdsEntry.prototype.interested = function(oElement, iContentId) {
-    var $this = this;
-    var oParams = this._getDefaultData();
-    oParams['id'] = iContentId;
+    this._performAction(oElement, 'interested', iContentId);
+};
 
 
-    if(oElement)
-        this.loadingInButton(oElement, true);
+BxAdsEntry.prototype.makeOffer = function(oElement, iContentId) {
+    this._performAction(oElement, 'make_offer', iContentId);
+};
 
 
-    jQuery.get (
-        this._sActionsUrl + 'interested',
-        oParams,
-        function(oData) {
-            if(oElement)
-                $this.loadingInButton(oElement, false);
+BxAdsEntry.prototype.delivered = function(oElement, iContentId) {
+    this._performAction(oElement, 'delivered', iContentId);
+};
 
 
-            processJsonData(oData);
-        },
-        'json'
-    );
+BxAdsEntry.prototype.received = function(oElement, iContentId) {
+    this._performAction(oElement, 'received', iContentId);
 };
 };
 
 
-BxAdsEntry.prototype.makeOffer = function(oElement, iContentId) {
+BxAdsEntry.prototype.loadingInButton = function(e, bShow) {
+    if($(e).length)
+        bx_loading_btn($(e), bShow);
+    else
+        bx_loading($('body'), bShow);	
+};
+
+BxAdsEntry.prototype.loadingInBox = function(e, bShow) {
+    var oParent = $(e).length ? $(e).parents('.bx-base-text-poll:first') : $('body'); 
+    bx_loading(oParent, bShow);
+};
+
+BxAdsEntry.prototype._performAction = function(oElement, sAction, iContentId) {
     var $this = this;
     var $this = this;
     var oParams = this._getDefaultData();
     var oParams = this._getDefaultData();
     oParams['id'] = iContentId;
     oParams['id'] = iContentId;
@@ -48,7 +55,7 @@ BxAdsEntry.prototype.makeOffer = function(oElement, iContentId) {
         this.loadingInButton(oElement, true);
         this.loadingInButton(oElement, true);
 
 
     jQuery.get (
     jQuery.get (
-        this._sActionsUrl + 'make_offer',
+        this._sActionsUrl + sAction,
         oParams,
         oParams,
         function(oData) {
         function(oData) {
             if(oElement)
             if(oElement)
@@ -60,22 +67,6 @@ BxAdsEntry.prototype.makeOffer = function(oElement, iContentId) {
     );
     );
 };
 };
 
 
-BxAdsEntry.prototype.onMakeOffer = function(oData) {
-    
-};
-
-BxAdsEntry.prototype.loadingInButton = function(e, bShow) {
-    if($(e).length)
-        bx_loading_btn($(e), bShow);
-    else
-        bx_loading($('body'), bShow);	
-};
-
-BxAdsEntry.prototype.loadingInBox = function(e, bShow) {
-    var oParent = $(e).length ? $(e).parents('.bx-base-text-poll:first') : $('body'); 
-    bx_loading(oParent, bShow);
-};
-
 BxAdsEntry.prototype._getDefaultData = function() {
 BxAdsEntry.prototype._getDefaultData = function() {
     var oDate = new Date();
     var oDate = new Date();
     return jQuery.extend({}, this._oRequestParams, {_t:oDate.getTime()});
     return jQuery.extend({}, this._oRequestParams, {_t:oDate.getTime()});

+ 4 - 0
modules/boonex/russian/data/langs/bx_ads/ru.xml

@@ -291,6 +291,10 @@
     <string name="_bx_ads_menu_item_title_edit_entry"><![CDATA[Редактировать]]></string>
     <string name="_bx_ads_menu_item_title_edit_entry"><![CDATA[Редактировать]]></string>
     <string name="_bx_ads_menu_item_title_system_delete_entry"><![CDATA[Удалить]]></string>
     <string name="_bx_ads_menu_item_title_system_delete_entry"><![CDATA[Удалить]]></string>
     <string name="_bx_ads_menu_item_title_delete_entry"><![CDATA[Удалить]]></string>
     <string name="_bx_ads_menu_item_title_delete_entry"><![CDATA[Удалить]]></string>
+    <string name="_bx_ads_menu_item_title_system_mark_delivered"><![CDATA[Доставлен]]></string>
+    <string name="_bx_ads_menu_item_title_mark_delivered"><![CDATA[Доставлен]]></string>
+    <string name="_bx_ads_menu_item_title_system_mark_received"><![CDATA[Получен]]></string>
+    <string name="_bx_ads_menu_item_title_mark_received"><![CDATA[Получен]]></string>
     <string name="_bx_ads_menu_item_title_system_review_entry"><![CDATA[Разместить обзор]]></string>
     <string name="_bx_ads_menu_item_title_system_review_entry"><![CDATA[Разместить обзор]]></string>
     <string name="_bx_ads_menu_item_title_system_view_entry"><![CDATA[Просмотреть объявление]]></string>
     <string name="_bx_ads_menu_item_title_system_view_entry"><![CDATA[Просмотреть объявление]]></string>
     <string name="_bx_ads_menu_item_title_system_entries_home"><![CDATA[Объявления]]></string>
     <string name="_bx_ads_menu_item_title_system_entries_home"><![CDATA[Объявления]]></string>