-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'b-6.3.x' into UNZER-214_Dispay_Bank_Data
- Loading branch information
Showing
12 changed files
with
238 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<?php | ||
|
||
namespace OxidSolutionCatalysts\Unzer\Controller\Admin; | ||
|
||
use OxidEsales\Eshop\Core\DatabaseProvider; | ||
use OxidEsales\Eshop\Core\Exception\DatabaseConnectionException; | ||
use OxidEsales\Eshop\Core\Registry; | ||
|
||
class OrderList extends OrderList_parent | ||
{ | ||
/** | ||
* Adding folder check | ||
* bi * | ||
* @param array $whereQuery SQL condition array | ||
* @param string $fullQuery SQL query string | ||
* | ||
* @SuppressWarnings(PHPMD.StaticAccess) | ||
* | ||
* @return string | ||
*/ | ||
protected function _prepareWhereQuery($whereQuery, $fullQuery) | ||
{ | ||
// seperate oxordernr | ||
$orderNrSearch = ''; | ||
if (isset($whereQuery['oxorder.oxordernr'])) { | ||
$orderNrSearch = $whereQuery['oxorder.oxordernr']; | ||
unset($whereQuery['oxorder.oxordernr']); | ||
} | ||
|
||
$database = DatabaseProvider::getDb(); | ||
$query = parent::_prepareWhereQuery($whereQuery, $fullQuery); | ||
$config = $this->getConfig(); | ||
$folders = $config->getConfigParam('aOrderfolder'); | ||
$folder = Registry::getConfig()->getRequestParameter('folder'); | ||
// Searching for empty oxfolder fields | ||
if ($folder && $folder !== '-1') { | ||
$query .= " and ( oxorder.oxfolder = " . $database->quote($folder) . " )"; | ||
} elseif (!$folder && is_array($folders)) { | ||
$folderNames = array_keys($folders); | ||
$query .= " and ( oxorder.oxfolder = " . $database->quote($folderNames[0]) . " )"; | ||
} | ||
|
||
// glue oxordernr | ||
if ($orderNrSearch) { | ||
$oxOrderNr = $database->quoteIdentifier("oxorder.oxordernr"); | ||
$oxUnzerOrderNr = $database->quoteIdentifier("oxorder.oxunzerordernr"); | ||
$orderNrValue = $database->quote($orderNrSearch); | ||
$query .= " and ({$oxOrderNr} like {$orderNrValue} or {$oxUnzerOrderNr} like {$orderNrValue}) "; | ||
} | ||
|
||
return $query; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
<?php | ||
|
||
/** | ||
* Copyright © OXID eSales AG. All rights reserved. | ||
* See LICENSE file for license details. | ||
*/ | ||
|
||
namespace OxidSolutionCatalysts\Unzer\Model; | ||
|
||
use OxidEsales\Eshop\Application\Model\Article; | ||
use OxidEsales\Eshop\Application\Model\Groups; | ||
use OxidEsales\Eshop\Application\Model\User; | ||
use OxidEsales\Eshop\Core\DatabaseProvider; | ||
use OxidEsales\Eshop\Core\Model\ListModel; | ||
use OxidEsales\Eshop\Core\Registry; | ||
use OxidEsales\Eshop\Application\Model\DiscountList as CoreDisCountList; | ||
|
||
class DiscountList extends DiscountList_parent | ||
{ | ||
/** | ||
* Returns array of discounts that can be globally (transparently) applied | ||
* | ||
* @param Article $oArticle article object | ||
* @param User $oUser oxuser object (optional) | ||
* | ||
* @return array | ||
*/ | ||
public function getArticleDiscounts($oArticle, $oUser = null) | ||
{ | ||
$aList = []; | ||
$this->forceReload(); | ||
/** @var CoreDisCountList $oDiscList */ | ||
$oDiscList = $this->_getList($oUser); | ||
$aDiscList = $oDiscList->getArray(); | ||
foreach ($aDiscList as $oDiscount) { | ||
if ($oDiscount->isForArticle($oArticle)) { | ||
$aList[$oDiscount->getId()] = $oDiscount; | ||
} | ||
} | ||
|
||
return $aList; | ||
} | ||
|
||
|
||
/** | ||
* Creates discount list filter SQL to load current state discount list | ||
* | ||
* @SuppressWarnings(PHPMD.StaticAccess) | ||
* | ||
* @inheritdoc | ||
*/ | ||
protected function _getFilterSelect($oUser) | ||
{ | ||
$oBaseObject = $this->getBaseObject(); | ||
$bDisableSqlActive = Registry::getSession()->getVariable('disableSqlActiveSnippet'); | ||
$sTable = $oBaseObject->getViewName(); | ||
$sSql = "select " . $oBaseObject->getSelectFields() . " from $sTable where 1 "; | ||
$sSql .= false === $bDisableSqlActive ? $oBaseObject->getSqlActiveSnippet() . ' ' : ''; | ||
|
||
// defining initial filter parameters | ||
$sUserId = null; | ||
$sGroupIds = null; | ||
$sCountryId = $this->getCountryId($oUser); | ||
$oDb = DatabaseProvider::getDb(); | ||
|
||
// checking for current session user which gives additional restrictions for user itself, | ||
// users group and country | ||
if ($oUser) { | ||
// user ID | ||
$sUserId = $oUser->getId(); | ||
|
||
// user group ids | ||
/** @var ListModel $userGroups */ | ||
$userGroups = $oUser->getUserGroups(); | ||
/** @var Groups $oGroup */ | ||
foreach ($userGroups as $oGroup) { | ||
if ($sGroupIds) { | ||
$sGroupIds .= ', '; | ||
} | ||
$sGroupIds .= $oDb->quote($oGroup->getId()); | ||
} | ||
} | ||
|
||
$sUserTable = getViewName('oxuser'); | ||
$sGroupTable = getViewName('oxgroups'); | ||
$sCountryTable = getViewName('oxcountry'); | ||
|
||
$sCountrySql = $sCountryId ? | ||
"EXISTS(select oxobject2discount.oxid from oxobject2discount where | ||
oxobject2discount.OXDISCOUNTID = $sTable.OXID and oxobject2discount.oxtype = 'oxcountry' and | ||
oxobject2discount.OXOBJECTID = " . $oDb->quote($sCountryId) . ")" : | ||
'0'; | ||
$sUserSql = $sUserId ? | ||
"EXISTS(select oxo bject2discount.oxid from oxobject2discount where | ||
oxobject2discount.OXDISCOUNTID = $sTable.OXID and oxobject2discount.oxtype = 'oxuser' and | ||
oxobject2discount.OXOBJECTID = " . $oDb->quote($sUserId) . ")" : | ||
'0'; | ||
$sGroupSql = $sGroupIds ? | ||
"EXISTS(select oxobject2discount.oxid from oxobject2discount where | ||
oxobject2discount.OXDISCOUNTID = $sTable.OXID and oxobject2discount.oxtype = 'oxgroups' and | ||
oxobject2discount.OXOBJECTID in ($sGroupIds) )" : | ||
'0'; | ||
|
||
$sSql .= "and ( | ||
if(EXISTS(select 1 from oxobject2discount, $sCountryTable where | ||
$sCountryTable.oxid = oxobject2discount.oxobjectid and | ||
oxobject2discount.OXDISCOUNTID = $sTable.OXID and | ||
oxobject2discount.oxtype = 'oxcountry' LIMIT 1), | ||
$sCountrySql, | ||
1) && | ||
if(EXISTS(select 1 from oxobject2discount, $sUserTable where | ||
$sUserTable.oxid = oxobject2discount.oxobjectid and | ||
oxobject2discount.OXDISCOUNTID = $sTable.OXID and | ||
oxobject2discount.oxtype = 'oxuser' LIMIT 1), | ||
$sUserSql, | ||
1) && | ||
if(EXISTS(select 1 from oxobject2discount, $sGroupTable where | ||
$sGroupTable.oxid = oxobject2discount.oxobjectid and | ||
oxobject2discount.OXDISCOUNTID = $sTable.OXID and | ||
oxobject2discount.oxtype = 'oxgroups' LIMIT 1), | ||
$sGroupSql, | ||
1) | ||
)"; | ||
|
||
$sSql .= " order by $sTable.oxsort "; | ||
|
||
return $sSql; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters