add dbquery
This commit is contained in:
parent
6abf0b819d
commit
25cf090f7b
@ -23,7 +23,8 @@
|
||||
|
||||
"require": {
|
||||
"guzzlehttp/guzzle": "^7.9",
|
||||
"oxid-esales/oxideshop-ce": "6.3 - 6.14"
|
||||
"oxid-esales/oxideshop-ce": "6.3 - 6.14",
|
||||
"ext-json": "*"
|
||||
},
|
||||
"extra": {
|
||||
"oxideshop": {
|
||||
|
1
setup+doku/installation.sql
Normal file
1
setup+doku/installation.sql
Normal file
@ -0,0 +1 @@
|
||||
ALTER TABLE `oxorder` ADD COLUMN `D3LEITWEGID` VARCHAR(25) NOT NULL COMMENT 'xRechnung'
|
@ -30,15 +30,17 @@ class OrderOverview extends OrderOverview_parent
|
||||
return FALSE;
|
||||
}
|
||||
else {
|
||||
$strx=array('#[^a-zA-Z0-9äöüß\040]#','# +#','#ä#','#ö#','#ü#','#ß#');
|
||||
$stry=array(' ',' ','ae','oe','ue','ss');
|
||||
$strx = array('#[^a-zA-Z0-9äöüß\040]#','# +#','#ä#','#ö#','#ü#','#ß#');
|
||||
$stry = array(' ',' ','ae','oe','ue','ss');
|
||||
$sTrimmedBillName=preg_replace($strx,$stry,$sTrimmedBillName);
|
||||
$sTrimmedBillName=trim($sTrimmedBillName);
|
||||
$sTrimmedBillName=strtolower($sTrimmedBillName);
|
||||
}
|
||||
$sFilename = $oOrder->oxorder__oxordernr->value . "_" . $sTrimmedBillName . ".xml";
|
||||
$sFilename = $this->makeValidFileName($sFilename);
|
||||
$aReturn = $oOrder->genXRechnung($sFilename, Registry::getConfig()->getRequestParameter("xmllanguage"), false);
|
||||
|
||||
$sReturn = $oOrder->genXRechnung($sFilename, Registry::getConfig()->getRequestParameter("xmllanguage"), false);
|
||||
$aReturn = $this->preparFromTansport($sReturn);
|
||||
$sFilename = $aReturn['FileName'];
|
||||
|
||||
$myConfig = Registry::getConfig();
|
||||
@ -61,4 +63,13 @@ class OrderOverview extends OrderOverview_parent
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $Data
|
||||
* @return array
|
||||
*/
|
||||
public function preparFromTansport(string $Data): array
|
||||
{
|
||||
return (array)json_decode(base64_decode($Data));
|
||||
}
|
||||
}
|
||||
|
@ -45,6 +45,7 @@ class Order extends Order_parent
|
||||
{
|
||||
$oConfig = Registry::getConfig();
|
||||
|
||||
// add payload
|
||||
$sPathDetails = $oConfig->getConfigParam('d3xrechnung_PATH_GENERATOR')."?";
|
||||
$query = [
|
||||
'orderid' => $sOrderId,
|
||||
@ -54,6 +55,7 @@ class Order extends Order_parent
|
||||
'combinexmlpdf' => false,
|
||||
];
|
||||
|
||||
// add accessdata
|
||||
$sUser = $oConfig->getConfigParam('d3xrechnung_HTACCESS_USER');
|
||||
$sPassword = $oConfig->getConfigParam('d3xrechnung_HTACCESS_PASSWORD');
|
||||
$auth = [$sUser, $sPassword]
|
||||
|
@ -45,7 +45,7 @@ Der Pfad und Zugangsschutz zum Generator wird in der Konfiguration des Moduls hi
|
||||
'url' => 'https://www.oxidmodule.com/',
|
||||
'extend' => [
|
||||
\OxidEsales\Eshop\Application\Controller\Admin\OrderOverview::class => D3\XRechnung\Modules\Application\Controller\Admin\OrderOverview::class,
|
||||
\OxidEsales\Eshop\Application\Model\Order::class => D3\XRechnung\Modules\Application\Model\Order::class
|
||||
\OxidEsales\Eshop\Application\Model\Order::class => D3\XRechnung\Modules\Application\Model\Order::class
|
||||
],
|
||||
'templates' => [
|
||||
],
|
||||
|
225
src/public/connect.php
Normal file
225
src/public/connect.php
Normal file
@ -0,0 +1,225 @@
|
||||
<?php
|
||||
|
||||
use OxidEsales\Eshop\Core\Controller\BaseController;
|
||||
use OxidEsales\Eshop\Core\DatabaseProvider;
|
||||
use OxidEsales\Eshop\Core\Exception\DatabaseConnectionException;
|
||||
use OxidEsales\Eshop\Core\Exception\DatabaseErrorException;
|
||||
use OxidEsales\Eshop\Core\Registry;
|
||||
use OxidEsales\Eshop\Core\TableViewNameGenerator;
|
||||
|
||||
require_once dirname(__FILE__) . "/../../../../bootstrap.php";
|
||||
|
||||
/**
|
||||
* Class d3_Cron_Points
|
||||
*/
|
||||
class connect extends BaseController
|
||||
{
|
||||
/**
|
||||
* @throws DatabaseErrorException
|
||||
* @throws DatabaseConnectionException
|
||||
*/
|
||||
public function init()
|
||||
{
|
||||
$this->checkParamter();
|
||||
//dumpvar($this->processRequest());
|
||||
//echo __METHOD__ . " " . __LINE__ . "<br>" . PHP_EOL;
|
||||
|
||||
//dumpvar($this->prepareFromTansport($this->prepareDataForTansport($this->processRequest())));
|
||||
//echo __METHOD__ . " " . __LINE__ . "<br>" . PHP_EOL;
|
||||
//die();
|
||||
echo $this->prepareDataForTansport($this->processRequest());
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws DatabaseErrorException
|
||||
* @throws DatabaseConnectionException
|
||||
*/
|
||||
public function processRequest()
|
||||
{
|
||||
$Parameter = $this->getParameter();
|
||||
switch ($Parameter['FNC']) {
|
||||
case 'getShopData':
|
||||
return $this->getShopData($Parameter);
|
||||
break;
|
||||
case 'getOrder':
|
||||
return $this->getOrder($Parameter);
|
||||
break;
|
||||
case 'getOrderArticles':
|
||||
return $this->getOrderArticles($Parameter);
|
||||
break;
|
||||
case 'getArticle':
|
||||
return $this->getArticle($Parameter);
|
||||
break;
|
||||
case 'getDeliveryData':
|
||||
return $this->getDeliveryData($Parameter);
|
||||
break;
|
||||
case 'getPaymentData':
|
||||
return $this->getPaymentData($Parameter);
|
||||
break;
|
||||
case 'getCountry':
|
||||
return $this->getCountry($Parameter);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws DatabaseErrorException
|
||||
* @throws DatabaseConnectionException
|
||||
*/
|
||||
public function getShopData(array $aParameter)
|
||||
{
|
||||
$OXID = $aParameter['OXID'];
|
||||
$sTable = Registry::get(TableViewNameGenerator::class)->getViewName('oxshops');
|
||||
$Db = DatabaseProvider::getDb(DatabaseProvider::FETCH_MODE_ASSOC);
|
||||
$sQuery =
|
||||
<<<MSQL
|
||||
SELECT * FROM {$sTable} WHERE OXID = ?
|
||||
MSQL;
|
||||
|
||||
$result = $Db->getRow($sQuery,[$OXID]);
|
||||
unset($result['OXSERIAL']);
|
||||
unset($result['OXSMTP']);
|
||||
unset($result['OXSMTPUSER']);
|
||||
unset($result['OXSMTPPWD']);
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $aParameter
|
||||
* @return array
|
||||
* @throws DatabaseConnectionException
|
||||
*/
|
||||
public function getOrder(array $aParameter)
|
||||
{
|
||||
$OXID = $aParameter['OXID'];
|
||||
$sTable = Registry::get(TableViewNameGenerator::class)->getViewName('oxorder');
|
||||
$Db = DatabaseProvider::getDb(DatabaseProvider::FETCH_MODE_ASSOC);
|
||||
$sQuery = "SELECT * FROM ".$sTable." WHERE OXID= ?";
|
||||
//echo $sQuery;
|
||||
return $Db->getRow($sQuery,[$OXID]);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param array $aParameter
|
||||
* @return array
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws DatabaseErrorException
|
||||
*/
|
||||
public function getOrderArticles(array $aParameter)
|
||||
{
|
||||
$OXID = $aParameter['OXID'];
|
||||
$sTable = Registry::get(TableViewNameGenerator::class)->getViewName('oxorderarticles');
|
||||
$Db = DatabaseProvider::getDb(DatabaseProvider::FETCH_MODE_ASSOC);
|
||||
|
||||
$sQuery = "SELECT * FROM ".$sTable." WHERE
|
||||
oxorderid = ?
|
||||
AND OXAMOUNT > 0
|
||||
AND OXSTORNO = 0
|
||||
ORDER BY oxartid, oxselvariant, oxpersparam";
|
||||
|
||||
return $Db->getAll($sQuery,[$OXID]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $aParameter
|
||||
* @return array
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws DatabaseErrorException
|
||||
*/
|
||||
public function getArticle(array $aParameter)
|
||||
{
|
||||
$OXID = $aParameter['OXID'];
|
||||
$sTable = Registry::get(TableViewNameGenerator::class)->getViewName('oxarticles');
|
||||
$Db = DatabaseProvider::getDb(DatabaseProvider::FETCH_MODE_ASSOC);
|
||||
$sQuery = "SELECT * FROM ".$sTable." WHERE OXID= ?";
|
||||
return $Db->getAll($sQuery,[$OXID]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $aParameter
|
||||
* @return array
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws DatabaseErrorException
|
||||
*/
|
||||
public function getDeliveryData(array $aParameter)
|
||||
{
|
||||
$OXID = $aParameter['OXID'];
|
||||
if(!$OXID) {
|
||||
$OXID = 'oxidstandard';
|
||||
}
|
||||
$sTable = Registry::get(TableViewNameGenerator::class)->getViewName('oxdeliveryset');
|
||||
$Db = DatabaseProvider::getDb(DatabaseProvider::FETCH_MODE_ASSOC);
|
||||
$sQuery = "SELECT * FROM ".$sTable." WHERE OXID= ?";
|
||||
return $Db->getRow($sQuery,[$OXID]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $aParameter
|
||||
* @return array
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws DatabaseErrorException
|
||||
*/
|
||||
public function getPaymentData(array $aParameter)
|
||||
{
|
||||
$OXID = $aParameter['OXID'];
|
||||
$sTable = Registry::get(TableViewNameGenerator::class)->getViewName('oxpayments');
|
||||
$Db = DatabaseProvider::getDb(DatabaseProvider::FETCH_MODE_ASSOC);
|
||||
$sQuery = "SELECT * FROM ".$sTable." WHERE OXID= ?";
|
||||
return $Db->getAll($sQuery,[$OXID]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $aParameter
|
||||
* @return array
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws DatabaseErrorException
|
||||
*/
|
||||
public function getCountry(array $aParameter)
|
||||
{
|
||||
$OXID = $aParameter['OXID'];
|
||||
$sTable = Registry::get(TableViewNameGenerator::class)->getViewName('oxcountry');
|
||||
$Db = DatabaseProvider::getDb(DatabaseProvider::FETCH_MODE_ASSOC);
|
||||
$sQuery = "SELECT * FROM ".$sTable." WHERE OXID= ?";
|
||||
return $Db->getAll($sQuery,[$OXID]);
|
||||
}
|
||||
|
||||
public function checkParamter()
|
||||
{
|
||||
|
||||
//fnc
|
||||
//oxid
|
||||
//
|
||||
$this->getParameter();
|
||||
}
|
||||
|
||||
public function getParameter()
|
||||
{
|
||||
return array(
|
||||
'SecureID' => $_GET['ID'],
|
||||
'FNC' => $_GET['FNC'],
|
||||
'OXID' => $_GET['OXID'],
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $Data
|
||||
* @return string
|
||||
*/
|
||||
public function prepareDataForTansport(array $Data): string
|
||||
{
|
||||
return base64_encode(json_encode($Data));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $Data
|
||||
* @return array
|
||||
*/
|
||||
public function prepareFromTansport(string $Data): array
|
||||
{
|
||||
return (array)json_decode(base64_decode($Data));
|
||||
}
|
||||
}
|
||||
|
||||
$Connect = new connect();
|
||||
$Connect->init();
|
Loading…
x
Reference in New Issue
Block a user