8
0
Fork 0
Ordermanager/src/Application/Controller/Admin/d3_cfg_ordermanageritem_set...

156 Zeilen
4.8 KiB
PHP

2017-12-20 13:44:53 +01:00
<?php
2019-05-15 11:31:56 +02:00
/**
2017-12-20 13:44:53 +01:00
* This Software is the property of Data Development and is protected
* by copyright law - it is NOT Freeware.
*
* Any unauthorized use of this software without a valid license
* is a violation of the license agreement and will be prosecuted by
* civil and criminal law.
*
* http://www.shopmodule.com
*
2019-05-15 11:31:56 +02:00
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
* @author D3 Data Development - Daniel Seifert <support@shopmodule.com>
2017-12-20 13:44:53 +01:00
* @link http://www.oxidmodule.com
*/
namespace D3\Ordermanager\Application\Controller\Admin;
2020-04-21 18:21:44 +02:00
use D3\ModCfg\Application\Model\d3database;
2018-02-20 09:37:52 +01:00
use D3\ModCfg\Application\Model\Exception\d3_cfg_mod_exception;
use D3\ModCfg\Application\Model\Exception\d3ShopCompatibilityAdapterException;
2017-12-20 13:44:53 +01:00
use D3\Ordermanager\Application\Model\d3ordermanager;
use D3\ModCfg\Application\Controller\Admin\d3_cfg_mod_main;
use D3\ModCfg\Application\Model\Configuration\d3_cfg_mod;
2018-02-20 09:37:52 +01:00
use Doctrine\DBAL\DBALException;
2019-05-15 11:31:56 +02:00
use Exception;
use OxidEsales\Eshop\Core\Config;
2018-02-20 09:37:52 +01:00
use OxidEsales\Eshop\Core\Exception\DatabaseConnectionException;
use OxidEsales\Eshop\Core\Exception\DatabaseErrorException;
use OxidEsales\Eshop\Core\Exception\StandardException;
2019-05-15 11:31:56 +02:00
use OxidEsales\Eshop\Core\Language;
2017-12-20 13:44:53 +01:00
use OxidEsales\Eshop\Core\Model\ListModel;
use OxidEsales\Eshop\Core\Model\MultiLanguageModel;
class d3_cfg_ordermanageritem_settings extends d3_cfg_mod_main
{
2019-05-15 11:31:56 +02:00
protected $_sModId = 'd3_ordermanager';
2017-12-20 13:44:53 +01:00
protected $_sMenuItemTitle = 'd3mxordermanager';
protected $_blUseOwnOxid = true;
protected $_aNaviItems = array(
'new' => array(
'sScript' => 'top.oxid.admin.editThis( -1 );return false;',
'sTranslationId' => 'D3_TOOLTIPS_NEWORDERMANAGER',
),
);
protected $_sD3ObjectClass = d3ordermanager::class;
2019-05-15 11:31:56 +02:00
/**
* d3_cfg_ordermanageritem_settings constructor.
*/
public function __construct()
{
d3GetModCfgDIC()->setParameter('d3.ordermanager.modcfgid', $this->_sModId);
parent::__construct();
}
2017-12-20 13:44:53 +01:00
/**
* @return array
2019-05-15 11:31:56 +02:00
* @throws Exception
2017-12-20 13:44:53 +01:00
*/
2021-03-16 10:11:13 +01:00
public function getOrderFolders()
2017-12-20 13:44:53 +01:00
{
2019-05-15 11:31:56 +02:00
/** @var Config $config */
$config = d3GetModCfgDIC()->get('d3ox.ordermanager.'.Config::class);
return $config->getConfigParam('aOrderfolder');
2017-12-20 13:44:53 +01:00
}
/**
* @return ListModel
2019-05-15 11:31:56 +02:00
* @throws Exception
2017-12-20 13:44:53 +01:00
*/
public function getGroupsList()
{
/** @var $oGroupsList ListModel */
2019-05-15 11:31:56 +02:00
$oGroupsList = d3GetModCfgDIC()->get('d3ox.ordermanager.'.ListModel::class);
2017-12-20 13:44:53 +01:00
$oGroupsList->init('oxgroups');
2019-12-10 11:45:33 +01:00
return $this->_getObjectList($oGroupsList, null, 'oxtitle ASC');
2017-12-20 13:44:53 +01:00
}
/**
2020-04-21 18:21:44 +02:00
* @param ListModel $oObjectList
2019-12-10 11:45:33 +01:00
* @param null|string $sWhere
* @param null|string $sOrderBy
*
2017-12-20 13:44:53 +01:00
* @return ListModel
2020-04-21 18:21:44 +02:00
* @throws DBALException
2017-12-20 13:44:53 +01:00
*/
2019-12-10 11:45:33 +01:00
protected function _getObjectList($oObjectList, $sWhere = null, $sOrderBy = null)
2017-12-20 13:44:53 +01:00
{
startProfile(__METHOD__);
2019-05-15 11:31:56 +02:00
/** @var Language $oLang */
$oLang = d3GetModCfgDIC()->get('d3ox.ordermanager.'.Language::class);
2017-12-20 13:44:53 +01:00
/** @var $oObject MultiLanguageModel */
$oObject = $oObjectList->getBaseObject();
if ($oObject->isMultilang()) {
2019-05-15 11:31:56 +02:00
$oObject->setLanguage($oLang->getTplLanguage());
2017-12-20 13:44:53 +01:00
}
$sFieldList = $oObject->getSelectFields();
2020-04-21 18:21:44 +02:00
/** @var d3database $db */
$db = d3GetModCfgDIC()->get('d3.ordermanager.database');
$qb = $db->getQueryBuilder();
$qb->select($sFieldList)
->from($oObject->getViewName());
if ($sWhere) {
$qb->add('where', $sWhere);
}
if ($sOrderBy) {
$qb->add('orderBy', $sOrderBy);
}
$oObjectList->selectString($qb->getSQL(), $qb->getParameters());
2017-12-20 13:44:53 +01:00
stopProfile(__METHOD__);
return $oObjectList;
}
/**
* @return bool
*/
public function isEditMode()
{
return true;
}
/**
* @return string
2018-02-20 09:37:52 +01:00
* @throws DBALException
* @throws DatabaseConnectionException
* @throws DatabaseErrorException
* @throws StandardException
2019-05-15 11:31:56 +02:00
* @throws d3ShopCompatibilityAdapterException
* @throws d3_cfg_mod_exception
* @throws Exception
2017-12-20 13:44:53 +01:00
*/
public function getRestrictionMessage()
{
2019-05-15 11:31:56 +02:00
/** @var Language $oLang */
$oLang = d3GetModCfgDIC()->get('d3ox.ordermanager.'.Language::class);
/** @var d3_cfg_mod $oModCfg */
$oModCfg = d3GetModCfgDIC()->get('d3.ordermanager.modcfg');
2017-12-20 13:44:53 +01:00
return sprintf(
2019-05-15 11:31:56 +02:00
$oLang->translateString('D3_ORDERMANAGER_ERROR_RESTRICTIONS'),
$oModCfg->getLicenseConfigData('sEditionId', 'unknown')
2017-12-20 13:44:53 +01:00
);
}
}