AntonLV 9 лет назад
Родитель
Сommit
ed9f05c19b

+ 8 - 0
modules/boonex/market/classes/BxMarketDb.php

@@ -251,6 +251,14 @@ class BxMarketDb extends BxBaseModTextDb
                 );
 
                 $sWhereClause = " AND `tl`.`id`=:id";
+                break;
+
+            case 'new':
+				$aMethod['params'][1] = array(
+                	'profile_id' => $aParams['profile_id']
+                );
+
+                $sWhereClause = " AND `tl`.`profile_id`=:profile_id AND `tl`.`new`='1'";
                 break;
 
 			case 'unused':

+ 3 - 1
modules/boonex/market/classes/BxMarketModule.php

@@ -114,6 +114,8 @@ class BxMarketModule extends BxBaseModTextModule
         if(!$oGrid)
 			return '';
 
+        $this->_oDb->updateLicense(array('new' => 0), array('profile_id' => bx_get_logged_profile_id(), 'new' => 1));
+
 		$this->_oTemplate->addJs(array('licenses.js'));
 		return array(
         	'content' => $this->_oTemplate->getJsCode('licenses', array('sObjNameGrid' => $sGrid)) . $oGrid->getCode(),
@@ -129,7 +131,7 @@ class BxMarketModule extends BxBaseModTextModule
         if(!$iProfileId)
 			$iProfileId = bx_get_logged_profile_id();
 
-        $aLicenses = $this->_oDb->getLicense(array('type' => 'unused', 'profile_id' => (int)$iProfileId));
+        $aLicenses = $this->_oDb->getLicense(array('type' => 'new', 'profile_id' => (int)$iProfileId));
         return !empty($aLicenses) && is_array($aLicenses) ? count($aLicenses) : 0;
     }
 

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

@@ -49,6 +49,7 @@ CREATE TABLE IF NOT EXISTS `bx_market_licenses` (
   `domain` varchar(128) NOT NULL default '',
   `added` int(11) unsigned NOT NULL default '0',
   `expired` int(11) unsigned NOT NULL default '0',
+  `new` tinyint(1) NOT NULL default '1',
   PRIMARY KEY (`id`),
   KEY `product_id` (`product_id`, `profile_id`),
   KEY `license` (`license`)
@@ -65,6 +66,7 @@ CREATE TABLE IF NOT EXISTS `bx_market_licenses_deleted` (
   `domain` varchar(128) NOT NULL default '',
   `added` int(11) unsigned NOT NULL default '0',
   `expired` int(11) unsigned NOT NULL default '0',
+  `new` tinyint(1) NOT NULL default '1',
   `reason` varchar(16) NOT NULL default '',
   `deleted` int(11) unsigned NOT NULL default '0',
   PRIMARY KEY (`id`),