Merge pull request #110 from OpenXE-org/exciler_pr

Exciler pr
This commit is contained in:
OpenXE-ERP 2023-12-10 10:23:06 +01:00 committed by GitHub
commit 8ba116ccf1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 31 additions and 14 deletions

View File

@ -73,7 +73,7 @@ final class Shopware6Client
$request = new ClientRequest( $request = new ClientRequest(
$method, $method,
$this->url . 'v2/' . $endpoint, $this->url . $endpoint,
$headerInformation, $headerInformation,
empty($body) ? null : json_encode($body) empty($body) ? null : json_encode($body)
); );

View File

@ -31,14 +31,14 @@ class SubscriptionModule implements SubscriptionModuleInterface
aa.id, aa.id,
@start := GREATEST(aa.startdatum, aa.abgerechnetbis) as start, @start := GREATEST(aa.startdatum, aa.abgerechnetbis) as start,
@end := IF(aa.enddatum = '0000-00-00' OR aa.enddatum > :calcdate, :calcdate, aa.enddatum) as end, @end := IF(aa.enddatum = '0000-00-00' OR aa.enddatum > :calcdate, :calcdate, aa.enddatum) as end,
@cycles := CASE @cycles := GREATEST(aa.zahlzyklus, CASE
WHEN aa.preisart = 'monat' THEN WHEN aa.preisart = 'monat' THEN
TIMESTAMPDIFF(MONTH, @start, @end) TIMESTAMPDIFF(MONTH, @start, @end)
WHEN aa.preisart = 'jahr' THEN WHEN aa.preisart = 'jahr' THEN
TIMESTAMPDIFF(YEAR, @start, @end) TIMESTAMPDIFF(YEAR, @start, @end)
WHEN aa.preisart = '30tage' THEN WHEN aa.preisart = '30tage' THEN
FLOOR(TIMESTAMPDIFF(DAY, @start, @end) / 30) FLOOR(TIMESTAMPDIFF(DAY, @start, @end) / 30)
END+1 as cycles, END+1) as cycles,
CASE CASE
WHEN aa.preisart = 'monat' THEN WHEN aa.preisart = 'monat' THEN
DATE_ADD(@start, INTERVAL @cycles MONTH) DATE_ADD(@start, INTERVAL @cycles MONTH)

View File

@ -21095,7 +21095,7 @@ function ChargenMHDAuslagern($artikel, $menge, $lagerplatztyp, $lpid,$typ,$wert,
$pseudolager = !empty($shopAricleArr['pseudolager'])?(float)$shopAricleArr['pseudolager']:0; $pseudolager = !empty($shopAricleArr['pseudolager'])?(float)$shopAricleArr['pseudolager']:0;
} }
else { else {
$pseudolager = ''; $pseudolager = 0;
} }
$this->app->erp->RunHook('remote_send_article_list_pseudostorage', 3, $shop, $artikelid, $pseudolager); $this->app->erp->RunHook('remote_send_article_list_pseudostorage', 3, $shop, $artikelid, $pseudolager);
if(is_numeric($pseudolager) && $pseudolager < 0) { if(is_numeric($pseudolager) && $pseudolager < 0) {

View File

@ -94,7 +94,7 @@ class Rechnungslauf {
DATE_ADD(@start, INTERVAL (FLOOR(TIMESTAMPDIFF(DAY, @start, IF(aa.enddatum = '0000-00-00' OR aa.enddatum > '$scalcdate', '$scalcdate', aa.enddatum)) / 30)+1)*30 DAY ) DATE_ADD(@start, INTERVAL (FLOOR(TIMESTAMPDIFF(DAY, @start, IF(aa.enddatum = '0000-00-00' OR aa.enddatum > '$scalcdate', '$scalcdate', aa.enddatum)) / 30)+1)*30 DAY )
END, '%d.%m.%Y') SEPARATOR '<br>') as end, END, '%d.%m.%Y') SEPARATOR '<br>') as end,
SUM((100-aa.rabatt)/100 * aa.preis * aa.menge * SUM((100-aa.rabatt)/100 * aa.preis * aa.menge *
(CASE (GREATEST(aa.zahlzyklus, CASE
WHEN aa.preisart = 'monat' THEN WHEN aa.preisart = 'monat' THEN
TIMESTAMPDIFF(MONTH, @start, @end) TIMESTAMPDIFF(MONTH, @start, @end)
WHEN aa.preisart = 'jahr' THEN WHEN aa.preisart = 'jahr' THEN
@ -102,7 +102,7 @@ class Rechnungslauf {
WHEN aa.preisart = '30tage' THEN WHEN aa.preisart = '30tage' THEN
FLOOR(TIMESTAMPDIFF(DAY, @start, @end) / 30) FLOOR(TIMESTAMPDIFF(DAY, @start, @end) / 30)
END END
) ))
) as amount, ) as amount,
adr.id adr.id
FROM abrechnungsartikel aa FROM abrechnungsartikel aa

View File

@ -23,6 +23,7 @@ class Shopimporter_Presta extends ShopimporterBase
// TODO // TODO
private $langidToIso = [3 => 'de', 1 => 'en']; private $langidToIso = [3 => 'de', 1 => 'en'];
private $taxationByDestinationCountry; private $taxationByDestinationCountry;
private $orderSearchLimit;
public function __construct($app, $intern = false) public function __construct($app, $intern = false)
@ -284,17 +285,20 @@ class Shopimporter_Presta extends ShopimporterBase
$cart['articlelist'] = []; $cart['articlelist'] = [];
foreach ($order->associations->order_rows->order_row as $order_row) { foreach ($order->associations->order_rows->order_row as $order_row) {
$article = [
$steuersatz = (strval($order_row->unit_price_tax_incl) / strval($order_row->unit_price_tax_excl)) - 1;
$steuersatz = round($steuersatz, 1);
$cart['articlelist'][] = [
'articleid' => strval($order_row->product_reference), 'articleid' => strval($order_row->product_reference),
'name' => strval($order_row->product_name), 'name' => strval($order_row->product_name),
'quantity' => strval($order_row->product_quantity), 'quantity' => strval($order_row->product_quantity),
'price_netto' => strval($order_row->unit_price_tax_excl), 'price_netto' => strval($order_row->unit_price_tax_excl),
'steuersatz' => $steuersatz
]; ];
if ($order_row->unit_price_tax_excl > 0) {
$steuersatz = (strval($order_row->unit_price_tax_incl) / strval($order_row->unit_price_tax_excl)) - 1;
$steuersatz = round($steuersatz, 1);
$article['steuersatz'] = $steuersatz;
}
$cart['articlelist'][] = $article;
} }
$fetchedOrders[] = [ $fetchedOrders[] = [
@ -381,13 +385,26 @@ class Shopimporter_Presta extends ShopimporterBase
$res['kurztext_de'] = strip_tags($shortdescriptions['de']); $res['kurztext_de'] = strip_tags($shortdescriptions['de']);
$res['kurztext_en'] = strip_tags($shortdescriptions['en']); $res['kurztext_en'] = strip_tags($shortdescriptions['en']);
$res['hersteller'] = strval($product->product->manufacturer_name); $res['hersteller'] = strval($product->product->manufacturer_name);
$res['metakeywords_de'] = $metakeywords['de'];
$res['metakeywords_en'] = $metakeywords['en'];
$res['metatitle_de'] = $metatitles['de']; $res['metatitle_de'] = $metatitles['de'];
$res['metatitle_en'] = $metatitles['en']; $res['metatitle_en'] = $metatitles['en'];
$res['metadescription_de'] = $metadescriptions['de']; $res['metadescription_de'] = $metadescriptions['de'];
$res['metadescription_en'] = $metadescriptions['en']; $res['metadescription_en'] = $metadescriptions['en'];
$tags = $product->product->associations->tags->tag;
$keywords = [];
foreach ($tags as $tag) {
$tagid = intval($tag->id);
$endpoint = "tags/{$tagid}";
$tagdata = $this->prestaRequest('GET', $endpoint);
$tagiso = $this->langidToIso[intval($tagdata->tag->id_lang)];
$tagvalue = strval($tagdata->tag->name);
if (!array_key_exists($tagiso, $keywords))
$keywords[$tagiso] = [];
$keywords[$tagiso][] = $tagvalue;
}
$res['metakeywords_de'] = join(',', $keywords['de'] ?? []);
$res['metakeywords_en'] = join(',', $keywords['en'] ?? []);
$images = []; $images = [];
foreach ($product->product->associations->images->image as $img) { foreach ($product->product->associations->images->image as $img) {
$endpoint = "images/products/$productId/$img->id"; $endpoint = "images/products/$productId/$img->id";