mirror of
https://github.com/OpenXE-org/OpenXE.git
synced 2024-12-25 14:10:28 +01:00
Merge pull request #137 from exciler/matrixartikel
MatrixProdukt: Fix SQL and hide Table when no groups are defined
This commit is contained in:
commit
1f14f1829b
@ -35,11 +35,11 @@ SPDX-License-Identifier: LicenseRef-EGPL-3.1
|
||||
<div class="row-height">
|
||||
<div class="col-xs-12 col-md-10 col-md-height">
|
||||
<div class="inside-white inside-full-height">
|
||||
[MESSAGE]
|
||||
[MESSAGE2]
|
||||
[TAB2]
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-12 col-md-2 col-md-height">
|
||||
<div class="col-xs-12 col-md-2 col-md-height" [TAB2HIDEACTIONS]>
|
||||
<div class="inside inside-full-height">
|
||||
<fieldset>
|
||||
<legend>{|Aktionen|}</legend>
|
||||
|
@ -135,7 +135,7 @@ class Matrixprodukt
|
||||
}
|
||||
$heading[] = 'Menü';
|
||||
$width[] = '1%';
|
||||
$findcols = array_merge($nameColumns, ['nummer']);
|
||||
$findcols = array_merge($nameColumns, ['nummer', 'id']);
|
||||
$searchsql = $nameColumns;
|
||||
$menu = "<table><tr><td nowrap>"
|
||||
. "<img class=\"vueAction\" data-action=\"variantEdit\" data-variant-id=\"%value%\" data-article-id=\"$id\" src=\"./themes/{$app->Conf->WFconf['defaulttheme']}/images/edit.svg\"> "
|
||||
@ -150,10 +150,11 @@ class Matrixprodukt
|
||||
$artsql = "SELECT a.id, a.nummer, group_concat(mota.option_id order by mota.option_id separator ',') idlist
|
||||
FROM matrixprodukt_optionen_zu_artikel mota
|
||||
JOIN artikel a ON mota.artikel = a.id WHERE a.variante_von = $id group by mota.artikel";
|
||||
$sqlNameCols = join(',', $nameColumns);
|
||||
$sql = "SELECT SQL_CALC_FOUND_ROWS art.id, art.nummer, $sqlNameCols, art.id
|
||||
FROM ($artsql) art
|
||||
LEFT OUTER JOIN ($optsql) opts ON opts.idlist = art.idlist";
|
||||
$sqlNameCols = join(',', array_merge(['art.id', 'art.nummer'], $nameColumns, ['art.id']));
|
||||
$sql = "SELECT SQL_CALC_FOUND_ROWS $sqlNameCols
|
||||
FROM ($artsql) art ";
|
||||
if (!empty($optsqlIdCols))
|
||||
$sql .= " LEFT OUTER JOIN ($optsql) opts ON opts.idlist = art.idlist";
|
||||
$where = "1";
|
||||
//$count = "SELECT count(DISTINCT moa.id)
|
||||
// FROM matrixprodukt_eigenschaftengruppen_artikel mga
|
||||
@ -362,18 +363,23 @@ class Matrixprodukt
|
||||
return new JsonResponse($result);
|
||||
}
|
||||
|
||||
$articleId = $this->app->Secure->GetGET('id');
|
||||
$groupId = $this->app->Secure->GetGET('sid');
|
||||
if (empty($groupId)) {
|
||||
$this->app->YUI->TableSearch('TAB1', 'matrixprodukt_article_groups', "show", "", "", basename(__FILE__), __CLASS__);
|
||||
$this->app->Tpl->Set('ADDEDITFUNCTION', 'groupEdit');
|
||||
} else {
|
||||
$articleId = $this->app->Secure->GetGET('id');
|
||||
$this->app->erp->MenuEintrag("index.php?module=matrixprodukt&action=artikel&id=$articleId", 'Zurück zur Gruppenübersicht');
|
||||
$this->app->YUI->TableSearch('TAB1', 'matrixprodukt_article_options', "show", "", "", basename(__FILE__), __CLASS__);
|
||||
$this->app->Tpl->Set('SID', $groupId);
|
||||
$this->app->Tpl->Set('ADDEDITFUNCTION', 'optionEdit');
|
||||
}
|
||||
if ($this->service->GetArticleGroupsByArticleId($articleId)) {
|
||||
$this->app->YUI->TableSearch('TAB2', 'matrixprodukt_variants', "show", "", "", basename(__FILE__), __CLASS__);
|
||||
} else {
|
||||
$this->app->Tpl->Set('TAB2HIDEACTIONS', 'style="display: none;"');
|
||||
$this->app->Tpl->Set('MESSAGE2', "<div class=\"error\">Es sind noch keine Gruppen angelegt!</div>");
|
||||
}
|
||||
$this->app->Tpl->Parse('PAGE', "matrixprodukt_article.tpl");
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user