mirror of
https://github.com/OpenXE-org/OpenXE.git
synced 2025-01-23 19:31:13 +01:00
mirakl Zwischenstand
This commit is contained in:
parent
9d547c6e52
commit
55e7934fe4
@ -1111,7 +1111,7 @@ if (typeof document.hidden !== \"undefined\") { // Opera 12.10 and Firefox 18 an
|
|||||||
}
|
}
|
||||||
|
|
||||||
// userd edit ajax call
|
// userd edit ajax call
|
||||||
$poll = true;
|
// $poll = true;
|
||||||
if($poll) {
|
if($poll) {
|
||||||
$this->addPollJs($module, $action, $id);
|
$this->addPollJs($module, $action, $id);
|
||||||
}
|
}
|
||||||
|
@ -2775,6 +2775,7 @@ class Remote
|
|||||||
}
|
}
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
if($shoptyp === 'intern')
|
if($shoptyp === 'intern')
|
||||||
{
|
{
|
||||||
if($modulename != '')
|
if($modulename != '')
|
||||||
@ -2788,15 +2789,16 @@ class Remote
|
|||||||
$obj->getKonfig($id, $data);
|
$obj->getKonfig($id, $data);
|
||||||
}
|
}
|
||||||
$method = 'Import'.$action;
|
$method = 'Import'.$action;
|
||||||
|
|
||||||
if(method_exists($obj,$method)) {
|
if(method_exists($obj,$method)) {
|
||||||
try {
|
try {
|
||||||
$ret = $obj->$method();
|
$ret = $obj->$method();
|
||||||
}
|
}
|
||||||
catch(Exception $e) {
|
catch(Exception $e) {
|
||||||
if($isActionAuth) {
|
if($isActionAuth) {
|
||||||
|
return 'Fehler Auth: '.$e->getMessage();
|
||||||
|
}
|
||||||
return 'Fehler: '.$e->getMessage();
|
return 'Fehler: '.$e->getMessage();
|
||||||
}
|
|
||||||
return '';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!empty($this->app->stringcleaner)){
|
if(!empty($this->app->stringcleaner)){
|
||||||
@ -2804,6 +2806,8 @@ class Remote
|
|||||||
}
|
}
|
||||||
$this->parseReturn($ret, $id, $action);
|
$this->parseReturn($ret, $id, $action);
|
||||||
return $ret;
|
return $ret;
|
||||||
|
} else {
|
||||||
|
return 'Fehler: Funktion nicht implementiert: '.$method;
|
||||||
}
|
}
|
||||||
}elseif($isActionAuth)
|
}elseif($isActionAuth)
|
||||||
{
|
{
|
||||||
|
@ -2867,6 +2867,7 @@ class Artikel extends GenArtikel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$pageContents = $this->app->remote->RemoteSendArticleList($shop,$artikel,$extartikelnummer);
|
$pageContents = $this->app->remote->RemoteSendArticleList($shop,$artikel,$extartikelnummer);
|
||||||
|
|
||||||
$check = strpos($pageContents ,'error:');
|
$check = strpos($pageContents ,'error:');
|
||||||
$msg = '';
|
$msg = '';
|
||||||
if(!empty($pageContents) && is_array($pageContents)) {
|
if(!empty($pageContents) && is_array($pageContents)) {
|
||||||
|
@ -3339,7 +3339,7 @@ INNER JOIN shopexport s ON
|
|||||||
}
|
}
|
||||||
|
|
||||||
if($this->app->Secure->GetPOST('pruefen')) {
|
if($this->app->Secure->GetPOST('pruefen')) {
|
||||||
|
|
||||||
$className = 'Remote';
|
$className = 'Remote';
|
||||||
$methodName = 'RemoteConnection';
|
$methodName = 'RemoteConnection';
|
||||||
$r = new ReflectionMethod($className, $methodName);
|
$r = new ReflectionMethod($className, $methodName);
|
||||||
|
@ -11,7 +11,6 @@ class Shopimporter_Mirakl extends ShopimporterBase
|
|||||||
private $app;
|
private $app;
|
||||||
private $intern;
|
private $intern;
|
||||||
private $shopid;
|
private $shopid;
|
||||||
private $data;
|
|
||||||
private $protocol;
|
private $protocol;
|
||||||
private $apiKey;
|
private $apiKey;
|
||||||
private $shopUrl;
|
private $shopUrl;
|
||||||
@ -20,6 +19,8 @@ class Shopimporter_Mirakl extends ShopimporterBase
|
|||||||
private $idbearbeitung;
|
private $idbearbeitung;
|
||||||
private $idabgeschlossen;
|
private $idabgeschlossen;
|
||||||
|
|
||||||
|
public $data;
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
private $langidToIso = [3 => 'de', 1 => 'en'];
|
private $langidToIso = [3 => 'de', 1 => 'en'];
|
||||||
private $taxationByDestinationCountry;
|
private $taxationByDestinationCountry;
|
||||||
@ -45,14 +46,14 @@ class Shopimporter_Mirakl extends ShopimporterBase
|
|||||||
'typ' => 'checkbox',
|
'typ' => 'checkbox',
|
||||||
'bezeichnung' => '{|Protokollierung im Logfile|}:'
|
'bezeichnung' => '{|Protokollierung im Logfile|}:'
|
||||||
],
|
],
|
||||||
'textekuerzen' => [
|
/* 'textekuerzen' => [
|
||||||
'typ' => 'checkbox',
|
'typ' => 'checkbox',
|
||||||
'bezeichnung' => '{|Texte bei Artikelexport auf Maximallänge kürzen|}:'
|
'bezeichnung' => '{|Texte bei Artikelexport auf Maximallänge kürzen|}:'
|
||||||
],
|
],
|
||||||
'useKeyAsParameter' => [
|
'useKeyAsParameter' => [
|
||||||
'typ' => 'checkbox',
|
'typ' => 'checkbox',
|
||||||
'bezeichnung' => '{|Shop Version ist mindestens 1.6.1.1|}:'
|
'bezeichnung' => '{|Shop Version ist mindestens 1.6.1.1|}:'
|
||||||
],
|
],*/
|
||||||
'apikey' => [
|
'apikey' => [
|
||||||
'typ' => 'text',
|
'typ' => 'text',
|
||||||
'bezeichnung' => '{|API Key|}:',
|
'bezeichnung' => '{|API Key|}:',
|
||||||
@ -65,9 +66,9 @@ class Shopimporter_Mirakl extends ShopimporterBase
|
|||||||
],
|
],
|
||||||
'shopidmirakl' => [
|
'shopidmirakl' => [
|
||||||
'typ' => 'text',
|
'typ' => 'text',
|
||||||
'bezeichnung' => '{|Shop ID des Shops|}:',
|
'bezeichnung' => '{|Shop ID des Shops (optional, int64)|}:',
|
||||||
'size' => 40,
|
'size' => 40,
|
||||||
],
|
],/*
|
||||||
'steuergruppen' => [
|
'steuergruppen' => [
|
||||||
'typ' => 'text',
|
'typ' => 'text',
|
||||||
'bezeichnung' => '{|Steuergruppenmapping|}:',
|
'bezeichnung' => '{|Steuergruppenmapping|}:',
|
||||||
@ -107,7 +108,7 @@ class Shopimporter_Mirakl extends ShopimporterBase
|
|||||||
'typ' => 'checkbox',
|
'typ' => 'checkbox',
|
||||||
'bezeichnung' => '{|Artikelpreis im Shop anzeigen|}:',
|
'bezeichnung' => '{|Artikelpreis im Shop anzeigen|}:',
|
||||||
'col' => 2
|
'col' => 2
|
||||||
],
|
],*/
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
@ -136,15 +137,44 @@ class Shopimporter_Mirakl extends ShopimporterBase
|
|||||||
$this->taxationByDestinationCountry = !empty($this->app->DB->Select($query));
|
$this->taxationByDestinationCountry = !empty($this->app->DB->Select($query));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function miraklRequest(string $endpoint, string $postdata = null, bool $raw = false)
|
||||||
|
{
|
||||||
|
$ch = curl_init($this->shopUrl.$endpoint);
|
||||||
|
|
||||||
|
$headers = array("Authorization: ".$this->apiKey);
|
||||||
|
|
||||||
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||||
|
|
||||||
|
if (!empty($postdata)) {
|
||||||
|
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
|
||||||
|
curl_setopt($ch, CURLOPT_POSTFIELDS, $postdata);
|
||||||
|
$headers[] = 'Content-Type: application/json';
|
||||||
|
}
|
||||||
|
|
||||||
|
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
|
||||||
|
|
||||||
|
$response = curl_exec($ch);
|
||||||
|
if (curl_error($ch)) {
|
||||||
|
$this->error[] = curl_error($ch);
|
||||||
|
}
|
||||||
|
curl_close($ch);
|
||||||
|
|
||||||
|
if ($raw)
|
||||||
|
return $response;
|
||||||
|
|
||||||
|
return simplexml_load_string($response);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public function ImportAuth() {
|
public function ImportAuth() {
|
||||||
$ch = curl_init($this->shopUrl);
|
$ch = curl_init($this->shopUrl."version");
|
||||||
curl_setopt($ch, CURLOPT_USERNAME, $this->apiKey);
|
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Authorization: ".$this->apiKey));
|
||||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||||
$response = curl_exec($ch);
|
$response = curl_exec($ch);
|
||||||
$code = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
|
$code = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
|
||||||
if ($code == 200)
|
if ($code == 200) {
|
||||||
return 'success';
|
return 'success '.print_r($response,true);
|
||||||
|
}
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -314,109 +344,180 @@ class Shopimporter_Mirakl extends ShopimporterBase
|
|||||||
return $fetchedOrders;
|
return $fetchedOrders;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Fetches article list from the shop, puts them into table shopexport_getarticles, starts the prozessstarter getarticles which fetches details for each article via ImportGetArticle()
|
||||||
|
*/
|
||||||
public function ImportGetArticleList()
|
public function ImportGetArticleList()
|
||||||
{
|
{
|
||||||
$result = [];
|
$result = [];
|
||||||
$response = $this->miraklRequest('GET', 'products?display=[reference]');
|
$response = $this->miraklRequest('offers', raw: true);
|
||||||
foreach ($response->products->product as $product) {
|
|
||||||
$result[] = $product->reference;
|
$result_array = json_decode($response);
|
||||||
|
|
||||||
|
foreach ($result_array->offers as $offer) {
|
||||||
|
$result[] = $offer->shop_sku;
|
||||||
}
|
}
|
||||||
|
|
||||||
array_unique($result);
|
array_unique($result);
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Fetches article details from the shop
|
||||||
|
*/
|
||||||
public function ImportGetArticle()
|
public function ImportGetArticle()
|
||||||
{
|
{
|
||||||
$nummer = $this->data['nummer'];
|
throw new Exception("Not implemented");
|
||||||
if (isset($this->data['nummerintern'])) {
|
}
|
||||||
$nummer = $this->data['nummerintern'];
|
|
||||||
}
|
|
||||||
$nummer = trim($nummer);
|
|
||||||
|
|
||||||
if (empty($nummer))
|
/*
|
||||||
return;
|
* Send articles to shop
|
||||||
|
*/
|
||||||
|
|
||||||
$productsresult = $this->miraklRequest('GET', 'products?filter[reference]='.$nummer);
|
public function ImportSendList()
|
||||||
$combinationsresult = $this->miraklRequest('GET', 'combinations?filter[reference]='.$nummer);
|
{
|
||||||
$numberOfCombinations = count($combinationsresult->combinations->combination);
|
$articleList = $this->CatchRemoteCommand('data');
|
||||||
$numberOfProducts = count($productsresult->products->product);
|
|
||||||
$numberOfResults = $numberOfProducts + $numberOfCombinations;
|
//print_r($articleList);
|
||||||
if ($numberOfResults > 1) {
|
|
||||||
$this->Log('Got multiple results from Shop', $this->data);
|
/*
|
||||||
return;
|
Array
|
||||||
}
|
(
|
||||||
elseif ($numberOfResults < 1) {
|
[0] => Array
|
||||||
$this->Log('No product found in Shop', $this->data);
|
(
|
||||||
return;
|
[artikel] => 1
|
||||||
}
|
[artikelid] => 1
|
||||||
|
[nummer] => 700001
|
||||||
|
[inaktiv] =>
|
||||||
|
[name_de] => Schraube M10x20
|
||||||
|
[name_en] =>
|
||||||
|
[einheit] =>
|
||||||
|
[hersteller] =>
|
||||||
|
[herstellernummer] =>
|
||||||
|
[ean] =>
|
||||||
|
[artikelnummer_fremdnummern] =>
|
||||||
|
[kurztext_de] =>
|
||||||
|
[kurztext_en] =>
|
||||||
|
[anabregs_text] =>
|
||||||
|
[anabregs_text_en] =>
|
||||||
|
[beschreibung_de] =>
|
||||||
|
[beschreibung_en] =>
|
||||||
|
[uebersicht_de] =>
|
||||||
|
[uebersicht_en] =>
|
||||||
|
[herkunftsland] => DE
|
||||||
|
[texteuebertragen] => 1
|
||||||
|
[metadescription_de] =>
|
||||||
|
[metadescription_en] =>
|
||||||
|
[metakeywords_de] =>
|
||||||
|
[metakeywords_en] =>
|
||||||
|
[metatitle_de] =>
|
||||||
|
[metatitle_en] =>
|
||||||
|
[links_de] =>
|
||||||
|
[altersfreigabe] =>
|
||||||
|
[links_en] =>
|
||||||
|
[startseite_de] =>
|
||||||
|
[startseite_en] =>
|
||||||
|
[restmenge] => 0
|
||||||
|
[startseite] => 0
|
||||||
|
[standardbild] =>
|
||||||
|
[herstellerlink] =>
|
||||||
|
[lieferzeit] =>
|
||||||
|
[lieferzeitmanuell] =>
|
||||||
|
[gewicht] =>
|
||||||
|
[laenge] => 0.00
|
||||||
|
[breite] => 0.00
|
||||||
|
[hoehe] => 0.00
|
||||||
|
[wichtig] => 0
|
||||||
|
[porto] => 0
|
||||||
|
[gesperrt] => 0
|
||||||
|
[sperrgrund] =>
|
||||||
|
[gueltigbis] => 0000-00-00
|
||||||
|
[umsatzsteuer] => normal
|
||||||
|
[ausverkauft] => 0
|
||||||
|
[variante] => 0
|
||||||
|
[variante_von_id] => 0
|
||||||
|
[variantevon] =>
|
||||||
|
[pseudopreis] => 0.00
|
||||||
|
[keinrabatterlaubt] => 0
|
||||||
|
[einkaufspreis] => 0.12000000
|
||||||
|
[pseudolager] =>
|
||||||
|
[downloadartikel] => 0
|
||||||
|
[zolltarifnummer] =>
|
||||||
|
[typ] => 1_kat
|
||||||
|
[kategoriename] => Handelsware (100000)
|
||||||
|
[steuer_art_produkt] => 0
|
||||||
|
[steuer_art_produkt_download] => 0
|
||||||
|
[anzahl_bilder] => 0
|
||||||
|
[anzahl_lager] =>
|
||||||
|
[lagerkorrekturwert] => -0
|
||||||
|
[autolagerlampe] => 0
|
||||||
|
[crosssellingartikel] => Array
|
||||||
|
(
|
||||||
|
)
|
||||||
|
|
||||||
$isCombination = $numberOfCombinations > 0;
|
[waehrung] => EUR
|
||||||
if ($isCombination) {
|
[preis] => 0.16000000
|
||||||
$combinationId = intval($combinationsresult->combinations->combination->attributes()->id);
|
[steuersatz] => 19
|
||||||
$combination = $this->miraklRequest('GET', "combinations/$combinationId");
|
[staffelpreise_standard] => Array
|
||||||
$productId = intval($combination->combination->id_product);
|
(
|
||||||
} else {
|
[0] => Array
|
||||||
$productId = intval($productsresult->products->product->attributes()->id);
|
(
|
||||||
}
|
[ab_menge] => 1.0000
|
||||||
$product = $this->miraklRequest('GET', "products/$productId");
|
[preis] => 0.16000000
|
||||||
$res = [];
|
[bruttopreis] => 0.1904
|
||||||
if ($isCombination) {
|
[waehrung] => EUR
|
||||||
$res['nummer'] = strval($combination->combination->reference);
|
)
|
||||||
$res['artikelnummerausshop'] = strval($combination->combination->reference);
|
|
||||||
$res['ean'] = strval($combination->combination->ean13);
|
|
||||||
$res['preis_netto'] = floatval($product->product->price) + floatval($combination->combination->price);
|
|
||||||
} else {
|
|
||||||
$res['nummer'] = strval($product->product->reference);
|
|
||||||
$res['artikelnummerausshop'] = strval($product->product->reference);
|
|
||||||
$res['ean'] = strval($product->product->ean13);
|
|
||||||
$res['preis_netto'] = floatval($product->product->price);
|
|
||||||
}
|
|
||||||
$names = $this->toMultilangArray($product->product->name->language);
|
|
||||||
$descriptions = $this->toMultilangArray($product->product->description->language);
|
|
||||||
$shortdescriptions = $this->toMultilangArray($product->product->description_short->language);
|
|
||||||
$metadescriptions = $this->toMultilangArray($product->product->meta_description->language);
|
|
||||||
$metakeywords = $this->toMultilangArray($product->product->meta_keywords->language);
|
|
||||||
$metatitles = $this->toMultilangArray($product->product->meta_title->language);
|
|
||||||
$res['name'] = $names['de'];
|
|
||||||
$res['name_en'] = $names['en'];
|
|
||||||
$res['uebersicht_de'] = $descriptions['de'];
|
|
||||||
$res['uebersicht_en'] = $descriptions['en'];
|
|
||||||
$res['kurztext_de'] = strip_tags($shortdescriptions['de']);
|
|
||||||
$res['kurztext_en'] = strip_tags($shortdescriptions['en']);
|
|
||||||
$res['hersteller'] = strval($product->product->manufacturer_name);
|
|
||||||
$res['metatitle_de'] = $metatitles['de'];
|
|
||||||
$res['metatitle_en'] = $metatitles['en'];
|
|
||||||
$res['metadescription_de'] = $metadescriptions['de'];
|
|
||||||
$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->miraklRequest('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 = [];
|
[staffelpreise] => Array
|
||||||
foreach ($product->product->associations->images->image as $img) {
|
(
|
||||||
$endpoint = "images/products/$productId/$img->id";
|
[0] => Array
|
||||||
$imgdata = $this->miraklRequest('GET', $endpoint, '', true);
|
(
|
||||||
$images[] = [
|
[ab_menge] => 1.0000
|
||||||
'content' => base64_encode($imgdata),
|
[preis] => 0.16000000
|
||||||
'path' => "$img->id.jpg",
|
[bruttopreis] => 0.1904
|
||||||
'id' => $img->id
|
[waehrung] => EUR
|
||||||
];
|
)
|
||||||
}
|
|
||||||
$res['bilder'] = $images;
|
)
|
||||||
return $res;
|
|
||||||
|
[bruttopreis] => 0.1904
|
||||||
|
[checksum] =>
|
||||||
|
[variantevorhanden] => 0
|
||||||
|
)
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
$offers_for_mirakl = array();
|
||||||
|
|
||||||
|
foreach ($articleList as $article) {
|
||||||
|
$offers_for_mirakl[] = array(
|
||||||
|
'product_id_type' => 'sku', // ?!?!
|
||||||
|
'price' => $article['preis'],
|
||||||
|
// 'pricing_unit' => $article['waehrung'],
|
||||||
|
'product_id' => $article['nummer'],
|
||||||
|
'shop_sku' => $article['nummer'],
|
||||||
|
'state_code' => '11', // ?!?!
|
||||||
|
'update_delete' => 'update' // update or delete
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
$data_for_mirakl = array();
|
||||||
|
$data_for_mirakl['offers'] = $offers_for_mirakl;
|
||||||
|
|
||||||
|
$json_for_mirakl = json_encode($data_for_mirakl);
|
||||||
|
|
||||||
|
$result = [];
|
||||||
|
$response = $this->miraklRequest('offers', postdata: $json_for_mirakl, raw: true);
|
||||||
|
|
||||||
|
$result_array = json_decode($response);
|
||||||
|
|
||||||
|
|
||||||
|
print_r($result_array); // stdClass Object ( [import_id] => 69751 )
|
||||||
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
private function toMultilangArray($xmlnode) {
|
private function toMultilangArray($xmlnode) {
|
||||||
@ -454,30 +555,5 @@ class Shopimporter_Mirakl extends ShopimporterBase
|
|||||||
$this->app->erp->Logfile($message, print_r($dump, true));
|
$this->app->erp->Logfile($message, print_r($dump, true));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function miraklRequest($method, $endpoint, $data = '', $raw = false)
|
|
||||||
{
|
|
||||||
$url = $this->shopUrl . $endpoint;
|
|
||||||
$url = str_replace('[', '%5b', $url);
|
|
||||||
$url = str_replace(']', '%5d', $url);
|
|
||||||
|
|
||||||
$ch = curl_init();
|
|
||||||
curl_setopt($ch, CURLOPT_URL, $url);
|
|
||||||
if (!empty($data)) {
|
|
||||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
|
|
||||||
}
|
|
||||||
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);
|
|
||||||
curl_setopt($ch, CURLOPT_USERNAME, $this->apiKey);
|
|
||||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
|
||||||
$response = curl_exec($ch);
|
|
||||||
if (curl_error($ch)) {
|
|
||||||
$this->error[] = curl_error($ch);
|
|
||||||
}
|
|
||||||
curl_close($ch);
|
|
||||||
|
|
||||||
if ($raw)
|
|
||||||
return $response;
|
|
||||||
|
|
||||||
return simplexml_load_string($response);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -228,11 +228,7 @@ class Verbindlichkeit {
|
|||||||
$defaultorder = 1;
|
$defaultorder = 1;
|
||||||
$defaultorderdesc = 0;
|
$defaultorderdesc = 0;
|
||||||
|
|
||||||
$offen_menge = "TRIM(IF(
|
$offen_menge = "";
|
||||||
pd.menge > COALESCE(vp.menge,0),
|
|
||||||
pd.menge - COALESCE(vp.menge,0),
|
|
||||||
0
|
|
||||||
))+0";
|
|
||||||
|
|
||||||
$auswahl = array (
|
$auswahl = array (
|
||||||
'<input type=\"checkbox\" name=\"ids[]\" value=\"',
|
'<input type=\"checkbox\" name=\"ids[]\" value=\"',
|
||||||
@ -242,10 +238,8 @@ class Verbindlichkeit {
|
|||||||
|
|
||||||
$werte = array (
|
$werte = array (
|
||||||
'<input type="number" name="werte[]" value="',
|
'<input type="number" name="werte[]" value="',
|
||||||
['sql' => $offen_menge],
|
|
||||||
'" min="0"',
|
'" min="0"',
|
||||||
' max="',
|
' max="',
|
||||||
['sql' => $offen_menge],
|
|
||||||
'"/>'
|
'"/>'
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -303,7 +297,7 @@ class Verbindlichkeit {
|
|||||||
// END Toggle filters
|
// END Toggle filters
|
||||||
|
|
||||||
$sql = "
|
$sql = "
|
||||||
SELECT SQL_CALC_FOUND_ROWS * FROM (
|
SELECT * FROM (
|
||||||
SELECT
|
SELECT
|
||||||
pa.id pa_id,
|
pa.id pa_id,
|
||||||
".$this->app->erp->ConcatSQL($auswahl)." AS auswahl,
|
".$this->app->erp->ConcatSQL($auswahl)." AS auswahl,
|
||||||
@ -316,11 +310,7 @@ class Verbindlichkeit {
|
|||||||
art.name_de,
|
art.name_de,
|
||||||
pd.bemerkung,
|
pd.bemerkung,
|
||||||
pd.menge,
|
pd.menge,
|
||||||
IF(
|
0 offen_menge,
|
||||||
pd.menge > COALESCE(vp.menge,0),
|
|
||||||
pd.menge - COALESCE(vp.menge,0),
|
|
||||||
0
|
|
||||||
) offen_menge,
|
|
||||||
".$this->app->erp->ConcatSQL($werte).",
|
".$this->app->erp->ConcatSQL($werte).",
|
||||||
".$this->app->erp->ConcatSQL($preise)." AS preis,
|
".$this->app->erp->ConcatSQL($preise)." AS preis,
|
||||||
if(art.umsatzsteuer = '',art.steuersatz,art.umsatzsteuer) steuer,
|
if(art.umsatzsteuer = '',art.steuersatz,art.umsatzsteuer) steuer,
|
||||||
@ -329,38 +319,28 @@ class Verbindlichkeit {
|
|||||||
CONCAT(skadr.sachkonto,' ',skadr.beschriftung)
|
CONCAT(skadr.sachkonto,' ',skadr.beschriftung)
|
||||||
) AS sachkonto
|
) AS sachkonto
|
||||||
FROM
|
FROM
|
||||||
paketannahme pa
|
paketdistribution pd
|
||||||
INNER JOIN paketdistribution pd ON
|
LEFT JOIN paketannahme pa ON
|
||||||
pd.paketannahme = pa.id
|
pd.paketannahme = pa.id
|
||||||
INNER JOIN artikel art ON
|
LEFT JOIN artikel art ON
|
||||||
art.id = pd.artikel
|
art.id = pd.artikel
|
||||||
LEFT JOIN adresse adr ON
|
LEFT JOIN adresse adr ON
|
||||||
adr.id = pa.adresse
|
adr.id = pa.adresse
|
||||||
LEFT JOIN bestellung_position bp ON
|
LEFT JOIN bestellung_position bp ON
|
||||||
bp.id = pd.bestellung_position
|
bp.id = pd.bestellung_position
|
||||||
LEFT JOIN bestellung b ON
|
LEFT JOIN bestellung b ON
|
||||||
b.id = bp.bestellung
|
b.id = bp.bestellung
|
||||||
LEFT JOIN(
|
|
||||||
SELECT
|
|
||||||
paketdistribution,
|
|
||||||
SUM(menge) AS menge
|
|
||||||
FROM
|
|
||||||
verbindlichkeit_position vp
|
|
||||||
GROUP BY
|
|
||||||
paketdistribution
|
|
||||||
) vp
|
|
||||||
ON
|
|
||||||
vp.paketdistribution = pd.id
|
|
||||||
LEFT JOIN
|
LEFT JOIN
|
||||||
kontorahmen skart ON skart.id = art.kontorahmen
|
kontorahmen skart ON skart.id = art.kontorahmen
|
||||||
LEFT JOIN
|
LEFT JOIN
|
||||||
kontorahmen skadr ON skadr.id = adr.kontorahmen
|
kontorahmen skadr ON skadr.id = adr.kontorahmen
|
||||||
WHERE pa.adresse = ".$lieferant." AND pd.vorlaeufig IS NULL".$innerwhere."
|
WHERE pa.adresse = '".$lieferant."'
|
||||||
|
GROUP BY pd.id
|
||||||
) temp
|
) temp
|
||||||
";
|
";
|
||||||
|
|
||||||
$count = "";
|
$count = "";
|
||||||
// $groupby = "";
|
$groupby = "";
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 'verbindlichkeit_positionen':
|
case 'verbindlichkeit_positionen':
|
||||||
|
@ -98,7 +98,7 @@
|
|||||||
<div class="inside inside-full-height">
|
<div class="inside inside-full-height">
|
||||||
<fieldset><legend>{|Aktion|}</legend>
|
<fieldset><legend>{|Aktion|}</legend>
|
||||||
<table width="100%">
|
<table width="100%">
|
||||||
<tr><td><input type="button" onclick="verpruefen();" value="{|Verbindung prüfen|}" class="aktionbutton" ></td></tr>
|
<tr><td><input type="submit" form="frmpruefen" value="{|Verbindung prüfen|}" class="aktionbutton" ></td></tr>
|
||||||
<tr><td width="50%"><input type="button" onclick="Holeauftrag();" value="{|Aufträge abholen|}" class="aktionbutton" ></td></tr>
|
<tr><td width="50%"><input type="button" onclick="Holeauftrag();" value="{|Aufträge abholen|}" class="aktionbutton" ></td></tr>
|
||||||
[AKTIONBUTTONS]
|
[AKTIONBUTTONS]
|
||||||
</table>
|
</table>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user