Commit 2c8cfebe authored by Daniel Kazior's avatar Daniel Kazior
Browse files

Merge branch 'Release/1.3.5' into 'master'

Die Bereitstellung der verfügbaren Zahlungsarten war fehlerhaft bei einem...

See merge request crefopay/jtl-4!25
parents 22f1b9a0 a7a3e0df
......@@ -2,6 +2,9 @@
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
## [1.3.5] - 2021-07-25
- [BUG] Die Bereitstellung der verfügbaren Zahlungsarten war fehlerhaft bei einem nachträglichen Wechsel der Lieferadresse
## [1.3.4] - 2021-05-18
- [FEATURE] Die WaWi sendet den für ein Capture benötigten Amount nicht in einem einheitlichen Format. Das Plugin wandelt den gesendeten Amount unabhängig vom Format in das benötigte Format um
......@@ -87,4 +90,4 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Integration of SmartSignup-Functions
## [1.0.0] - 2019-05-10
- Initial release
\ No newline at end of file
- Initial release
No preview for this file type
......@@ -2,6 +2,9 @@
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
## [1.3.5] - 2021-07-25
- [BUG] Die Bereitstellung der verfügbaren Zahlungsarten war fehlerhaft bei einem nachträglichen Wechsel der Lieferadresse
## [1.3.4] - 2021-05-18
- [FEATURE] Die WaWi sendet den für ein Capture benötigten Amount nicht in einem einheitlichen Format. Das Plugin wandelt den gesendeten Amount unabhängig vom Format in das benötigte Format um
......@@ -87,4 +90,4 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Integration of SmartSignup-Functions
## [1.0.0] - 2019-05-10
- Initial release
\ No newline at end of file
- Initial release
This diff is collapsed.
<?php
global $cHinweis, $cFehler;
$items_per_page = 25;
$page = (verifyGPCDataInteger('page')!==0)?verifyGPCDataInteger('page'):1;
$prev_page = $page--;
$next_page = $page++;
if ($page < 0) {
$page = 1;
}
if ($prev_page <= 0) {
$prev_page = 1;
}
if ($next_page === 0) {
$next_page = 1;
}
$bestellungen_anzahl = Shop::DB()->executeQuery("SELECT count(*) as count FROM xplugin_lfs_crefopayment_orders
JOIN tbestellung ON tbestellung.kBestellung = xplugin_lfs_crefopayment_orders.kBestellung
ORDER BY xplugin_lfs_crefopayment_orders.kBestellung DESC", 1);
$max_pages = ((int)floor($bestellungen_anzahl->count/$items_per_page)!==0)?(int)floor($bestellungen_anzahl->count/$items_per_page):1;
if ($page > $max_pages) {
$page = $max_pages;
}
if ($next_page > $max_pages) {
$next_page = $max_pages;
}
$bestellungen_arr = Shop::DB()->executeQuery("SELECT * FROM xplugin_lfs_crefopayment_orders
JOIN tbestellung ON tbestellung.kBestellung = xplugin_lfs_crefopayment_orders.kBestellung
ORDER BY xplugin_lfs_crefopayment_orders.kBestellung DESC
LIMIT " . $items_per_page . " OFFSET " . $items_per_page*($page-1), 2);
foreach ($oPlugin->oPluginAdminMenu_arr as $menuItem) {
if ($menuItem->cName === 'Bestellungen') {
Shop::Smarty()->assign('ordersTabId', $menuItem->kPluginAdminMenu);
}
}
Shop::Smarty()->assign('bestellungen_arr', $bestellungen_arr)
->assign('prev_page', $prev_page)
->assign('next_page', $next_page);
Shop::Smarty()->assign('cHinweis', $cHinweis);
Shop::Smarty()->assign('cFehler', $cFehler);
Shop::Smarty()->assign('adminURL', "plugin.php?kPlugin=".$oPlugin->kPlugin);
Shop::Smarty()->display($oPlugin->cAdminmenuPfad . "template/orders.tpl");
\ No newline at end of file
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>Bestell-Nr.</th>
<th>Bestell-Datum</th>
<th>Gesamtsumme</th>
<th>Zahlungsart</th>
<th>Versandart</th>
</tr>
</thead>
<tbody>
{if isset($bestellungen_arr) && count($bestellungen_arr)>0}
{foreach from=$bestellungen_arr item=bestellung}
<tr>
<td>{$bestellung->cBestellNr}</td>
<td>{$bestellung->dErstellt|date_format:"d.m.Y H:i"}</td>
<td>{$bestellung->fGesamtsumme|number_format:2:",":"."} &euro;</td>
<td>{$bestellung->cZahlungsartName}</td>
<td>{$bestellung->cVersandartName}</td>
</tr>
{/foreach}
{else}
<tr>
<td colspan="5" align="center">- Keinen Bestellungen vorhanden -</td>
</tr>
{/if}
</tbody>
</table>
<br />
<div class="text-center">
{if $prev_page > 1}
<a href="{$adminURL}&page={$prev_page}#plugin-tab-{$ordersTabId}" class="btn btn-primary">Vorherige</a>
{/if}
{if $next_page > 1}
<a href="{$adminURL}&page={$next_page}#plugin-tab-{$ordersTabId}" class="btn btn-primary">Nchste</a>
{/if}
</div>
\ No newline at end of file
<div class="panel panel-default first">
<div class="panel-heading"><h3 class="panel-title">WaWi-Einstellungen</h3></div>
<div class="panel-body">
<div class="input-group">
<span class="input-group-addon">
<label for="crefopayment_merchant_id">Workflow-URL</label>
</span>
<span class="input-group-wrap">
<input class="form-control" readonly value="{$cfp_update_url}">
</span>
</div>
</div>
</div>
<div class="panel panel-default first">
<div class="panel-heading"><h3 class="panel-title">Workflow-Parameter "Capture"</h3></div>
<div class="panel-body">
<div class="input-group">
<span class="input-group-addon">
<label for="crefopayment_merchant_id">Parameter</label>
</span>
<span class="input-group-wrap">
<textarea class="form-control" readonly style="height: 85px;">{$capture_workflow_params}</textarea>
</span>
</div>
</div>
</div>
<div class="panel panel-default first">
<div class="panel-heading"><h3 class="panel-title">Workflow-Parameter "Cancel"</h3></div>
<div class="panel-body">
<div class="input-group">
<span class="input-group-addon">
<label for="crefopayment_merchant_id">Parameter</label>
</span>
<span class="input-group-wrap">
<textarea class="form-control" readonly style="height: 85px;">{$cancel_workflow_params}</textarea>
</span>
</div>
</div>
</div>
\ No newline at end of file
<?php
global $cHinweis, $cFehler;
Shop::Smarty()->assign('cfp_update_url', Shop::getURL()."/cfp_update");
if (version_compare(Shop::getShopVersion(), '405', '<=')) {
$capture_workflow_params = "{% capture query -%}
SELECT tBestellHinweis.cText FROM tBestellung
JOIN tBestellHinweis ON tBestellung.kBestellHinweis = tBestellHinweis.kBestellHinweis
WHERE tBestellung.cBestellNr = '{{ Vorgang.Auftrag.Auftragsnummer }}'
{% endcapture -%}
{% assign crefopay_orderid = query | DirectQueryScalar %}{% if crefopay_orderid != null %}Action=capture&merchantid=" . $oPlugin->oPluginEinstellungAssoc_arr["crefopayment_merchant_id"]."&storeid=".$oPlugin->oPluginEinstellungAssoc_arr["crefopayment_store_id"]."&Rechnungsnummer={{ Vorgang.Auftrag.Rechnung.Rechnungsnummer }}&orderid={{ crefopay_orderid | Replace: '-','' | Replace: 'CrefoPayID: ', '' | Trim }}&amount={{ Vorgang.Auftrag.Gesamtbruttopreis }}{% endif %}";
$cancel_workflow_params = "{% capture query -%}
SELECT tBestellHinweis.cText FROM tBestellung
JOIN tBestellHinweis ON tBestellung.kBestellHinweis = tBestellHinweis.kBestellHinweis
WHERE tBestellung.cBestellNr = '{{ Vorgang.Auftrag.Auftragsnummer }}'
{% endcapture -%}
{% assign crefopay_orderid = query | DirectQueryScalar %}{% if crefopay_orderid != null %}Action=cancel&merchantid=" . $oPlugin->oPluginEinstellungAssoc_arr["crefopayment_merchant_id"] . "&storeid=".$oPlugin->oPluginEinstellungAssoc_arr["crefopayment_store_id"]."&bestellnr={{ crefopay_orderid | Replace: '-','' | Replace: 'CrefoPayID: ', '' | Trim }}{% endif %}";
}
else {
$capture_workflow_params = "{% capture query -%}
SELECT cValue FROM tBestellungAttribute
JOIN tBestellung ON tBestellung.kBestellung = tBestellungAttribute.kBestellung
WHERE tBestellung.cBestellNr = '{{ Vorgang.Auftrag.Auftragsnummer }}'
AND tBestellungAttribute.cName = 'crefopay_orderid'
{% endcapture -%}
{% assign crefopay_orderid = query | DirectQueryScalar %}{% if crefopay_orderid != null %}Action=capture&merchantid=".$oPlugin->oPluginEinstellungAssoc_arr["crefopayment_merchant_id"]."&storeid=".$oPlugin->oPluginEinstellungAssoc_arr["crefopayment_store_id"]."&Rechnungsnummer={{ Vorgang.Auftrag.Rechnung.Rechnungsnummer }}&orderid={{ crefopay_orderid }}&amount={{ Vorgang.Auftrag.Gesamtbruttopreis }}{% endif %}";
$cancel_workflow_params = "{% capture query -%}
SELECT cValue FROM tBestellungAttribute
JOIN tBestellung ON tBestellung.kBestellung = tBestellungAttribute.kBestellung
WHERE tBestellung.cBestellNr = '{{ Vorgang.Stammdaten.Auftragsnummer }}'
AND tBestellungAttribute.cName = 'crefopay_orderid'
{% endcapture -%}
{% assign crefopay_orderid = query | DirectQueryScalar %}{% if crefopay_orderid != null %}Action=cancel&merchantid=" . $oPlugin->oPluginEinstellungAssoc_arr["crefopayment_merchant_id"] . "&storeid=".$oPlugin->oPluginEinstellungAssoc_arr["crefopayment_store_id"]."&bestellnr={{crefopay_orderid}}{% endif %}";
}
Shop::Smarty()->assign('capture_workflow_params', $capture_workflow_params);
Shop::Smarty()->assign('cancel_workflow_params', $cancel_workflow_params);
Shop::Smarty()->assign('cHinweis', $cHinweis);
Shop::Smarty()->assign('cFehler', $cFehler);
Shop::Smarty()->assign('adminURL', "plugin.php?kPlugin=".$oPlugin->kPlugin);
Shop::Smarty()->display($oPlugin->cAdminmenuPfad . "template/wawi.tpl");
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
<?php
require_once $oPlugin->cFrontendPfad."/classes/cfpHelper.php";
$cfpHelper = new cfpHelper($oPlugin);
if (strpos($_SESSION['Zahlungsart']->cModulId, "crefopay") !== false) {
if (!isset($_SESSION['cfp_paymentinfo_set'])) {
header("Location: " . Shop::getURL()."/bestellvorgang.php?editZahlungsart=1");
}
}
\ No newline at end of file
<?php
require_once $oPlugin->cFrontendPfad . "/classes/cfpHelper.php";
$cfpHelper = new cfpHelper($oPlugin);
if (strtoupper($_SERVER['REQUEST_METHOD']) === 'POST') {
if (isset($_POST['action']) && $_POST['action'] === "cfp_reserve" && isset($_SESSION['reserveData'])) {
$response_code = 200;
$_SESSION['cfp_reservecall'] = time();
$oReturn = [];
$aPost_arr = (array)json_decode($_SESSION['reserveData']);
$result = $cfpHelper->reservePayment($aPost_arr);
if ($result !== null) {
$_SESSION['cfp_paymentreserved'] = true;
$oReturn['success'] = true;
$oInsert = new stdClass();
$oInsert->cfp_orderid = $_SESSION['cfp_orderId'];
$oInsert->kBestellung = 0;
$oInsert->transaction_state = "NEW";
$oInsert->order_state = "PAYPENDING";
$oInsert->created_at = date('Y-m-d H:i:s', time());
$oInsert->updated_at = date('Y-m-d H:i:s', time());
Shop::DB()->insertRow("xplugin_lfs_crefopayment_orders", $oInsert);
if ($result->resultCode == 0) {
// Keine Weiterleitung zur Besttigung erforderlich
$oReturn['cfp_redirectUrl'] = "";
} else {
if ($result->resultCode == 1) {
// Weiterleitung zur Besttigung erforderlich
$oReturn['cfp_redirectUrl'] = $result->redirectUrl;
} else {
$oReturn['success'] = false;
}
}
} else {
$oReturn['success'] = false;
$oInsert = new stdClass();
$oInsert->cfp_orderid = $_SESSION['cfp_orderId'];
$oInsert->kBestellung = 0;
$oInsert->transaction_state = "NEW";
$oInsert->order_state = "PAYMENTFAILED";
$oInsert->created_at = date('Y-m-d H:i:s', time());
$oInsert->updated_at = date('Y-m-d H:i:s', time());
Shop::DB()->insert('xplugin_lfs_crefopayment_orders', $oInsert);
if ($cfpHelper->getTransactionPaymentInstruments() === false) {
Jtllog::writeLog("Crefopay: Fehler bei 'getTransactionPaymentInstruments'-Call", JTLLOG_LEVEL_ERROR);
$cfpHelper->sendInfoMail("Crefopay: Fehler bei 'getTransactionPaymentInstruments'-Call", 'error');
} else {
Jtllog::writeLog("Crefopay: 'getTransactionPaymentInstruments'-Call erfolgreich ausgefhrt", JTLLOG_LEVEL_DEBUG);
$cfpHelper->sendInfoMail("Crefopay: 'getTransactionPaymentInstruments'-Call erfolgreich ausgefhrt", 'debug');
}
if (isset($_SESSION['cfp_failed_paymentmethods']) && is_array($_SESSION['cfp_failed_paymentmethods'])) {
if (!in_array($_SESSION['AktiveZahlungsart'], $_SESSION['cfp_failed_paymentmethods'])) {
$_SESSION['cfp_failed_paymentmethods'][] = $_SESSION['AktiveZahlungsart'];
}
unset($_SESSION['AktiveZahlungsart']);
}
}
header('Content-type: application/json');
print json_encode($oReturn);
die();
}
// Handle notifications by Crefopay-MNS
if (isset($_POST['merchantID']) && $_POST['merchantID'] === $oPlugin->oPluginEinstellungAssoc_arr["crefopayment_merchant_id"]
&& isset($_POST['storeID']) && $_POST['storeID'] === $oPlugin->oPluginEinstellungAssoc_arr["crefopayment_store_id"]
&& !isset($_POST['Action']) && !isset($_POST['action'])
) {
$response_code = 200;
Jtllog::writeLog("Crefopay: Notification-Call " . print_r($_POST, 1), JTLLOG_LEVEL_DEBUG);
$tmpCfpOrderData = Shop::DB()->selectSingleRow("xplugin_lfs_crefopayment_orders", "cfp_orderid", $_POST['orderID']);
if (is_object($tmpCfpOrderData)) {
$tmpCfpOrderData->notification_attempts += 1;
$tmpCfpOrderData->updated_at = date('Y-m-d H:i:s');
Jtllog::writeLog("Crefopay: Notification-Call - Order found", JTLLOG_LEVEL_DEBUG);
if ($_POST['orderStatus'] != "")
$tmpCfpOrderData->order_state = $_POST['orderStatus'];
if ($_POST['transactionStatus'] != "")
$tmpCfpOrderData->transaction_state = $_POST['transactionStatus'];
if ($_POST['orderStatus'] != "" || $_POST['transactionStatus'] != "")
Shop::DB()->updateRow("xplugin_lfs_crefopayment_orders", "cfp_orderid", $_POST['orderID'], $tmpCfpOrderData);
$oInsert = new stdClass();
$oInsert->cfp_orderid = (isset($_POST['orderID'])) ? $_POST['orderID'] : "-none-";
$oInsert->request_type = "Notification-Call";
$oInsert->request_data = verschluesselXTEA(print_r($_POST, 1));
$oInsert->request_answer = "";
$oInsert->created_at = date('Y-m-d H:i:s', time());
$oInsert->updated_at = date('Y-m-d H:i:s', time());
Shop::DB()->insertRow("xplugin_lfs_crefopayment_log", $oInsert);
Jtllog::writeLog("Crefopay: Notification-Call - Bestellung " . print_r($tmpCfpOrderData, 1), JTLLOG_LEVEL_DEBUG);
if ($tmpCfpOrderData->kBestellung > 0) {
Jtllog::writeLog("Crefopay: Notification-Call - Bestellung found", JTLLOG_LEVEL_DEBUG);
$tmpOrder = new Bestellung($tmpCfpOrderData->kBestellung);
$tmpZahlungsart = new Zahlungsart($tmpOrder->kZahlungsart);
if (strpos($tmpZahlungsart->cModulId, "paypal") !== false
|| strpos($tmpZahlungsart->cModulId, "kreditkarte") !== false
|| strpos($tmpZahlungsart->cModulId, "sofort") !== false
|| strpos($tmpZahlungsart->cModulId, "vorkasse") !== false
|| strpos($tmpZahlungsart->cModulId, "lastschrift") !== false) {
Jtllog::writeLog("Crefopay: Notification-Call - Set payment", JTLLOG_LEVEL_DEBUG);
if ($tmpOrder->cStatus != 3 && $tmpOrder->dBezahltDatum == '0000-00-00') {
if ($tmpCfpOrderData->transaction_state === "MERCHANTPENDING") {
$tmpKunde = new Kunde($tmpOrder->kKunde);
$tmpOrder->dBezahltDatum = date('Y-m-d', time());
if ($tmpOrder->cStatus < 3)
$tmpOrder->cStatus = 3;
$tmpOrder->updateInDB();
$cfpHelper->savePayment($tmpCfpOrderData, $tmpOrder, $tmpKunde);
}
}
}
$response_code = 200;
} else {
// increase notifications_attempts counter
$tmpCfpOrderData->notification_attempts += 1;
$tmpCfpOrderData->updated_at = date('Y-m-d H:i:s');
Shop::DB()->updateRow("xplugin_lfs_crefopayment_orders", "cfp_orderid", $_POST['orderID'], $tmpCfpOrderData);
if ($tmpCfpOrderData->notification_attempts >= 3
&& $cfpHelper->getOPlugin()->oPluginEinstellungAssoc_arr['crefopayment_autocancel_active'] === 'Y'
)
{
$cfpHelper->cancelOrder($_POST['orderID']);
}
$response_code = 200;
}
http_response_code($response_code);
die();
}
http_response_code($response_code);
die();
}
// END --- Handle notifications by Crefopay-MNS
// Handle calls from JTL-WaWi
$tmpRequestUri = str_replace("/", "", $_SERVER['REQUEST_URI']);
if ($tmpRequestUri === 'cfp_update') {
if ($_POST['Action'] === "capture" && $cfpHelper->checkMerchantAndStoreId($_POST['merchantid'], $_POST['storeid'])) {
$tmpCfpOrderData = Shop::DB()->selectSingleRow("xplugin_lfs_crefopayment_orders", "cfp_orderid", $_POST['orderid']);
if (!is_null($tmpCfpOrderData)) {
$tmpOrder = new Bestellung($tmpCfpOrderData->kBestellung);
$captureAmount = $cfpHelper->getFormattedAmount($_POST['amount']);
$param = array(
'merchantID' => $oPlugin->oPluginEinstellungAssoc_arr["crefopayment_merchant_id"],
'storeID' => $oPlugin->oPluginEinstellungAssoc_arr["crefopayment_store_id"],
'orderID' => $tmpCfpOrderData->cfp_orderid,
);
$result = $cfpHelper->callCfpApi("getTransactionStatus", $param);
if ($result !== false)
{
if (isset($result->additionalData->transactionAmount))
{
if ($captureAmount > (int)$result->additionalData->transactionAmount)
{
$captureAmount = (int)$result->additionalData->transactionAmount;
Jtllog::writeLog($oPlugin->cPluginID . ": CaptureAmount > TransactionAmount", JTLLOG_LEVEL_ERROR);
}
if ($captureAmount < (int)$result->additionalData->transactionAmount)
{
Jtllog::writeLog($oPlugin->cPluginID . ": CaptureAmount < TransactionAmount", JTLLOG_LEVEL_NOTICE);
}
}
}
else
{
Jtllog::writeLog($oPlugin->cPluginID . ": getTransactionStatus FEHLER: " . print_r($param, 1) . " - " . print_r($_POST, 1), JTLLOG_LEVEL_ERROR);
}
$param = array(
'merchantID' => $oPlugin->oPluginEinstellungAssoc_arr["crefopayment_merchant_id"],
'storeID' => $oPlugin->oPluginEinstellungAssoc_arr["crefopayment_store_id"],
'orderID' => $tmpCfpOrderData->cfp_orderid,
'captureID' => $oPlugin->oPluginEinstellungAssoc_arr["crefopayment_store_id"] . "-" . $_POST['Rechnungsnummer'],
'amount' => $captureAmount
);
$result = $cfpHelper->callCfpApi("capture", $param);
if (!is_object($result)) {
Jtllog::writeLog($oPlugin->cPluginID . ": " . $cfpHelper->mapErrorCode($result->resultCode) . " - " . print_r($param, 1) . " - " . print_r($_POST, 1), JTLLOG_LEVEL_ERROR);
$cfpHelper->sendInfoMail($oPlugin->cPluginID . ": " . $cfpHelper->mapErrorCode($result->resultCode) . " - " . print_r($param, 1) . " - " . print_r($_POST, 1), 'error');
} else {
Jtllog::writeLog($oPlugin->cPluginID . ": " . $cfpHelper->mapErrorCode($result->resultCode) . " - Capture fr " . $tmpCfpOrderData->cfp_orderid . " ausgefhrt - " . print_r($_POST, 1), JTLLOG_LEVEL_DEBUG);
$cfpHelper->sendInfoMail($oPlugin->cPluginID . ": " . $cfpHelper->mapErrorCode($result->resultCode) . " - Capture fr " . $tmpCfpOrderData->cfp_orderid . " ausgefhrt - " . print_r($_POST, 1), 'debug');
}
}
http_response_code(200);
die();
}
if ($_POST['Action'] === "cancel" && $cfpHelper->checkMerchantAndStoreId($_POST['merchantid'], $_POST['storeid'])) {
$tmpCfpOrderData = Shop::DB()->selectSingleRow("xplugin_lfs_crefopayment_orders", "cfp_orderid", $_POST['bestellnr']);
if (!is_null($tmpCfpOrderData)) {
$cfpHelper->cancelOrder($tmpCfpOrderData->cfp_orderid);
}
die();
}
if ($_POST['Action'] === "transactionstatus" && $cfpHelper->checkMerchantAndStoreId($_POST['merchantid'], $_POST['storeid'])) {
$param = array(
'merchantID' => $oPlugin->oPluginEinstellungAssoc_arr["crefopayment_merchant_id"],
'storeID' => $oPlugin->oPluginEinstellungAssoc_arr["crefopayment_store_id"],
'orderID' => $_POST['orderID']
);
$cfpStatus = $cfpHelper->callCfpApi('getTransactionStatus', $param);
http_response_code(200);
die();
}
if ($_POST['Action'] === "getlogitem" && $cfpHelper->checkMerchantAndStoreId($_POST['merchantid'], $_POST['storeid'])) {
$logitem = Shop::DB()->selectSingleRow("xplugin_lfs_crefopayment_log", "id", $_POST['logid']);
if (is_object($logitem)) {
print $logitem->request_type . "<br /><br />";
print "Request<br />:";
print entschluesselXTEA($logitem->request_data);
print "<br />---<br />";
print "Response<br />:";
print entschluesselXTEA($logitem->request_answer);
} else {
print "No item selected!";
}
http_response_code(200);
die();
}
if ($_POST['Action'] === "readlog" && $cfpHelper->checkMerchantAndStoreId($_POST['merchantid'], $_POST['storeid'])) {
$logitems = [];
$params = 0;
$cSQL = "SELECT * FROM xplugin_lfs_crefopayment_log";
if ( (isset($_POST['fromDate']) && $_POST['fromDate'] !== "")
|| (isset($_POST['tillDate']) && $_POST['tillDate'] !== "")
|| (isset($_POST['requestType']) && $_POST['requestType'] !== "") )
{
$cSQL .= " WHERE ";
if (isset($_POST['fromDate']) && $_POST['fromDate'] !== "") {
$params++;
$dFrom = DateTime::createFromFormat('Y-m-d', $_POST['fromDate']);
$cSQL .= " created_at >= '" . $dFrom->setTime(0,0,0)->format('Y-m-d H:i:s') . "'";
}
if (isset($_POST['tillDate']) && $_POST['tillDate'] !== "") {
if ($params > 0) {
$cSQL .= " AND ";
}
$params++;
$dTill = DateTime::createFromFormat('Y-m-d', $_POST['tillDate']);
$cSQL .= " created_at <= '" . $dTill->setTime(23, 59,59)->format('Y-m-d H:i:s') . "'";
}
if (isset($_POST['requestType']) && $_POST['requestType'] !== "") {
if ($params > 0) {
$cSQL .= " AND ";
}
$cSQL .= " request_type = '" . Shop::DB()->escape($_POST['requestType']) . "'";
}
}
$dbLogitems = Shop::DB()->executeQuery($cSQL, 2, (isset($_POST['debugSql'])));
if (isset($_POST['debugSql'])) {
echo "\r\n";
}
if (is_array($dbLogitems) && count($dbLogitems)>0) {
foreach ($dbLogitems as $logitem) {
$item = new stdClass();
$item->id = $logitem->id;
if (!isset($_POST['ids_only'])) {
$item->request_type = $logitem->request_type;
$item->request_data = urldecode(entschluesselXTEA($logitem->request_data));
$item->response_data = entschluesselXTEA($logitem->request_answer);
$item->created_at = $logitem->created_at;
}
$logitems[] = $item;
}
}
header('Content-Type: application/json');
echo json_encode($logitems);
http_response_code(200);
die();
}
if ($_POST['Action'] === "getsysinfo" && $cfpHelper->checkMerchantAndStoreId($_POST['merchantid'], $_POST['storeid'])) {
echo $cfpHelper->getSysInfo();
http_response_code(200);
die();
}
}
}
<?php
if (Shop::getPageType() == PAGE_BESTELLVORGANG) {
require_once $oPlugin->cFrontendPfad."/classes/cfpHelper.php";
$cfpHelper = new cfpHelper($oPlugin);
Shop::Smarty()->assign('cfp_oPlugin', $oPlugin);
if (file_exists($oPlugin->cFrontendPfad."/templ