Skip to content
Code-Schnipsel Gruppen Projekte
Commit 5a43cc0b erstellt von Henning Leutz's avatar Henning Leutz :martial_arts_uniform:
Dateien durchsuchen

feat: #7

Übergeordneter 2759d25e
Keine zugehörigen Branchen gefunden
Keine zugehörigen Tags gefunden
Keine zugehörigen Merge Requests gefunden
......@@ -127,6 +127,32 @@
<de><![CDATA[Versand]]></de>
<en><![CDATA[Shipping]]></en>
</locale>
<locale name="window.erp.title">
<de><![CDATA[Versand]]></de>
<en><![CDATA[Shipping]]></en>
</locale>
<locale name="window.erp.shipping.title">
<de><![CDATA[Versand]]></de>
<en><![CDATA[Shipping]]></en>
</locale>
<locale name="shipping.settings.title">
<de><![CDATA[Allgemein]]></de>
<en><![CDATA[General]]></en>
</locale>
<locale name="shipping.settings.debug">
<de><![CDATA[Versand Debugging]]></de>
<en><![CDATA[Shipping debugging]]></en>
</locale>
<locale name="shipping.settings.debug.description">
<de><![CDATA[
Schalte das Versand Debugging an, damit du Fehler in deinen Versandarten und -regeln besser feststellen kannst.
In der Browser Konsole werden dir bei dem Versandschritt einer Bestellung hiflreiche Informationen mitgegeben.
]]></de>
<en><![CDATA[
Enable shipping debugging to help you identify errors in your shipping methods and rules.
In the browser console, you'll be given helpful information at the shipping step in an order process.
]]></en>
</locale>
</groups>
......
<?xml version="1.0" encoding="UTF-8"?>
<quiqqer>
<settings name="ERP">
<config>
<section name="shipping">
<conf name="debug">
<type><![CDATA[bool]]></type>
<defaultvalue>0</defaultvalue>
</conf>
</section>
<section name="paymentsChangeable"/>
</config>
<window name="ERP">
<title>
<locale group="quiqqer/shipping" var="window.erp.title"/>
</title>
<params>
<icon>fa fa-sun-o</icon>
</params>
<categories>
<category name="shipping" index="4">
<text>
<locale group="quiqqer/shipping" var="window.erp.shipping.title"/>
</text>
<icon>fa fa-truck</icon>
<settings title="shipping" name="shipping">
<title>
<locale group="quiqqer/shipping" var="shipping.settings.title"/>
</title>
<input type="checkbox" conf="shipping.debug">
<text>
<locale group="quiqqer/shipping" var="shipping.settings.debug"/>
</text>
<description>
<locale group="quiqqer/shipping"
var="shipping.settings.debug.description"
/>
</description>
</input>
</settings>
</category>
</categories>
</window>
</settings>
</quiqqer>
......@@ -7,10 +7,8 @@
namespace QUI\ERP\Shipping;
use QUI;
use QUI\ERP\Shipping\Types\ShippingTypeInterface;
use QUI\ERP\Shipping\Types\Factory;
use QUI\ERP\Shipping\Api\AbstractShippingProvider;
use QUI\ERP\Shipping\Api\AbstractShippingEntry;
/**
* Shipping
......@@ -24,6 +22,11 @@ class Shipping extends QUI\Utils\Singleton
*/
protected $shipping = [];
/**
* @var bool
*/
protected $debugging = null;
/**
* Return all available shipping provider
*
......@@ -80,6 +83,27 @@ public function getShippingProviders()
return $result;
}
/**
* Is shipping debugging enabled?
*
* @return bool
*/
public function debuggingEnabled()
{
if ($this->debugging !== null) {
return $this->debugging;
}
try {
$Config = QUI::getPackage('quiqqer/shipping')->getConfig();
$this->debugging = !!$Config->getValue('shipping', 'debug');
} catch (QUI\Exception $Exception) {
$this->debugging = false;
}
return $this->debugging;
}
/**
* Return all available Shipping methods
*
......
......@@ -495,6 +495,7 @@ public function addShippingRuleId($shippingRuleId)
* @return ShippingRule[]
*
* @todo check if rule is valid
* @todo debug output why rule is valid and not
*/
public function getShippingRules()
{
......@@ -531,9 +532,7 @@ public function getShippingRules()
});
// debug shipping entry / rules
$debug = true;
if ($debug) {
if (QUI\ERP\Shipping\Shipping::getInstance()->debuggingEnabled()) {
$self = $this;
$Logger = new \Monolog\Logger('quiqqer-shipping');
......
0% Lade oder .
You are about to add 0 people to the discussion. Proceed with caution.
Bearbeitung dieser Nachricht zuerst beenden!
Bitte registrieren oder zum Kommentieren