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

refactor: #10

Übergeordneter d4b3d4e5
No related branches found
No related tags found
Keine zugehörigen Merge Requests gefunden
......@@ -38,7 +38,7 @@
<input type="text" name="discount" class="field-container-field"/>
<select name="discount_type"
class="field-container-item"
style="width: 100px;"
style="width: 50px;"
>
<option value="1">%</option>
<option value="2"></option>
......@@ -165,6 +165,9 @@
<label class="field-container">
<span class="field-container-item" title="{{usageScope}}">
{{usageScope}}
<span class="field-container-item-help"
title="{{scopeDescription}}"></span>
</span>
<select name="scope" class="field-container-field">
......
......@@ -80,6 +80,7 @@ define('package/quiqqer/discount/bin/controls/DiscountEdit', [
usageScopeEvery : QUILocale.get(lg, 'control.edit.template.usageScopeEvery'),
usageScopeTotal : QUILocale.get(lg, 'control.edit.template.usageScopeTotal'),
usageScopeUnique: QUILocale.get(lg, 'control.edit.template.usageScopeUnique'),
scopeDescription: QUILocale.get(lg, 'control.edit.template.usage.description'),
calculationBasis : QUILocale.get(lg, 'control.edit.template.calculationBasis'),
calculationBasisNetto : QUILocale.get(lg, 'control.edit.template.calculationBasis.netto'),
......
......@@ -30,7 +30,7 @@
class="field-container-field"/>
<select name="discount_type"
class="field-container-item"
style="width: 100px;"
style="width: 50px;"
>
<option value="%">%</option>
<option value="currency"></option>
......@@ -117,4 +117,4 @@
</tr>
</tbody>
</table>
</form>
\ No newline at end of file
</form>
......@@ -237,6 +237,14 @@
<de><![CDATA[Auf ein Produkt (Einmalig)]]></de>
<en><![CDATA[On one product (Unique)]]></en>
</locale>
<locale name="control.edit.template.usage.description">
<de><![CDATA[
'Für jedes Produkt' und 'Auf ein Produkt (Einmalig)' wird auf den Einzelpreis des Produktes angewendet.
]]></de>
<en><![CDATA[
'For each product' and 'On one product (Unique)' is applied to the single price of the product.
]]></en>
</locale>
<locale name="control.edit.template.shopping.amount.of">
<de><![CDATA[Einkaufsmenge von]]></de>
......
......@@ -56,7 +56,7 @@ public function __construct($id, Handler $Factory)
break;
default:
$this->setAttribute('scope', 0);
$this->setAttribute('scope', Handler::DISCOUNT_SCOPE_TOTAL);
}
......@@ -539,11 +539,17 @@ public function toPriceFactor($Locale = null, $Customer = null)
$hideDiscounts = false;
}
if ($this->getAttribute('scope') === Handler::DISCOUNT_SCOPE_TOTAL) {
if ($this->getAttribute('discount_type') === QUI\ERP\Accounting\Calc::CALCULATION_PERCENTAGE) {
$valueText = false;
} else {
$valueText = $this->getTitle($Locale);
}
return new PriceFactor([
'identifier' => 'discount-'.$this->getId(),
'title' => $this->getTitle($Locale),
'valueText' => $valueText,
'description' => '',
'priority' => (int)$this->getAttribute('priority'),
'calculation' => $calculation,
......@@ -554,9 +560,11 @@ public function toPriceFactor($Locale = null, $Customer = null)
]);
}
// to product
return new QUI\ERP\Products\Utils\PriceFactor([
'identifier' => 'discount-'.$this->getId(),
'title' => $this->getTitle($Locale),
// 'valueText' => $this->getTitle($Locale),
'description' => '',
'priority' => (int)$this->getAttribute('priority'),
'calculation' => $calculation,
......
......@@ -79,6 +79,10 @@ public function __construct()
$childData['active'] = 0;
}
if (empty($childData['scope'])) {
$childData['scope'] = self::DISCOUNT_SCOPE_TOTAL;
}
if (empty($childData['price_calculation_basis'])) {
$childData['price_calculation_basis'] = QUI\ERP\Accounting\Calc::CALCULATION_BASIS_NETTO;
}
......
0% oder .
You are about to add 0 people to the discussion. Proceed with caution.
Bearbeitung dieser Nachricht zuerst beenden!
Bitte registrieren oder zum Kommentieren