Skip to content

Commit 027c007

Browse files
Merge pull request #38 from OnePlc/1.0.34-dev
1.0.34 dev
2 parents 62dd82b + 7d40270 commit 027c007

5 files changed

Lines changed: 103 additions & 63 deletions

File tree

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "oneplace/oneplace-core",
33
"description": "onePlace Core Application",
44
"type": "project",
5-
"version": "1.0.33",
5+
"version": "1.0.34",
66
"license": "BSD-3-Clause",
77
"keywords": [
88
"laminas",
@@ -31,7 +31,7 @@
3131
"laminas/laminas-session": "^2.9.1",
3232
"laminas/laminas-paginator": "^2.8",
3333
"laminas/laminas-mail": "^2.10",
34-
"oneplace/oneplace-user": "^1.0.13"
34+
"oneplace/oneplace-user": "^1.0.23"
3535
},
3636
"autoload": {
3737
"psr-4": {

module/Application/config/module.config.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@
3939
'options' => [
4040
'route' => '/',
4141
'defaults' => [
42-
'controller' => Controller\WebController::class,
43-
'action' => 'index',
42+
'controller' => Controller\IndexController::class,
43+
'action' => 'route',
4444
],
4545
],
4646
],

module/Application/src/Controller/IndexController.php

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,22 @@
2525

2626
class IndexController extends CoreController
2727
{
28+
29+
/**
30+
* Home Router - go to Webpage or login or api
31+
* depending in mode this oneplace is working in
32+
*
33+
* @return mixed
34+
* @since 1.0.34
35+
*/
36+
public function routeAction()
37+
{
38+
if(isset(CoreController::$aGlobalSettings['home-route'])) {
39+
return $this->redirect()->toRoute(CoreController::$aGlobalSettings['home-route']);
40+
} else {
41+
return $this->redirect()->toRoute('app-home');
42+
}
43+
}
2844
/**
2945
* Application Home - Main Index
3046
*
@@ -33,6 +49,14 @@ class IndexController extends CoreController
3349
*/
3450
public function indexAction()
3551
{
52+
if(!is_dir($_SERVER['DOCUMENT_ROOT'].'/vendor')) {
53+
$this->layout('layout/json');
54+
echo '<b style="color:red">Assets are missing. Please install them first.</b>';
55+
echo '<br>Switch to your onePlace Core Directory (default is /var/www/plc) and execute:';
56+
echo '<br><code>yarn install</code><br>Checkout <a href="https://docs.1plc.ch" target="_blank">onePlace Docs</a> for more info';
57+
echo '<br/><br/><a href="/logout">Logout</a>';
58+
return false;
59+
}
3660
# Set Layout based on users theme
3761
$this->layout('layout/layout-'.CoreController::$oSession->oUser->getTheme());
3862

@@ -46,13 +70,25 @@ public function indexAction()
4670
]);
4771
}
4872

73+
/**
74+
* Themes Overview
75+
*
76+
* @return ViewModel - View Object with Data from Controller
77+
* @since 1.0.18
78+
*/
4979
public function themesAction()
5080
{
5181
$this->setThemeBasedLayout('application');
5282

5383
return new ViewModel([]);
5484
}
5585

86+
/**
87+
* System Update Page
88+
*
89+
* @return ViewModel - View Object with Data from Controller
90+
* @since 1.0.18
91+
*/
5692
public function updateAction()
5793
{
5894
$oRequest = $this->getRequest();

module/Application/src/Model/CoreEntityTable.php

Lines changed: 62 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -117,74 +117,78 @@ protected function attachDynamicFields(array $aData,$oObject) {
117117
public function fetchAll($bPaginated = false,$aWhere = [],$sSort = 'created_date DESC',$iLimit = 0) {
118118
$oSel = new Select($this->oTableGateway->getTable());
119119

120-
# Build where
121-
$oWh = new Where();
122-
foreach(array_keys($aWhere) as $sWh) {
123-
$bIsLike = stripos($sWh,'-like');
124-
if($bIsLike === false) {
125-
126-
} else {
127-
# its a like
128-
$oWh->like(substr($sWh,0,strlen($sWh)-strlen('-like')),$aWhere[$sWh].'%');
129-
}
120+
if(is_object($aWhere)) {
121+
$oSel->where($aWhere);
122+
} else {
123+
# Build where
124+
$oWh = new Where();
125+
foreach(array_keys($aWhere) as $sWh) {
126+
$bIsLike = stripos($sWh,'-like');
127+
if($bIsLike === false) {
128+
129+
} else {
130+
# its a like
131+
$oWh->like(substr($sWh,0,strlen($sWh)-strlen('-like')),$aWhere[$sWh].'%');
132+
}
130133

131-
$bIsLike = stripos($sWh,'-lkall');
132-
if($bIsLike === false) {
134+
$bIsLike = stripos($sWh,'-lkall');
135+
if($bIsLike === false) {
133136

134-
} else {
135-
# its a like
136-
$oWh->like(substr($sWh,0,strlen($sWh)-strlen('-lkall')),'%'.$aWhere[$sWh].'%');
137-
}
137+
} else {
138+
# its a like
139+
$oWh->like(substr($sWh,0,strlen($sWh)-strlen('-lkall')),'%'.$aWhere[$sWh].'%');
140+
}
138141

139-
$bIsIDFS = stripos($sWh,'_idfs');
140-
if($bIsIDFS === false) {
142+
$bIsIDFS = stripos($sWh,'_idfs');
143+
if($bIsIDFS === false) {
141144

142-
} else {
143-
# its a like
144-
$oWh->equalTo($sWh,$aWhere[$sWh]);
145-
}
145+
} else {
146+
# its a like
147+
$oWh->equalTo($sWh,$aWhere[$sWh]);
148+
}
146149

147-
$bIsGreaterEqual = stripos($sWh,'-greaterthanequalto');
148-
if($bIsGreaterEqual === false) {
150+
$bIsGreaterEqual = stripos($sWh,'-greaterthanequalto');
151+
if($bIsGreaterEqual === false) {
149152

150-
} else {
151-
# its a like
152-
$oWh->greaterThanOrEqualTo(substr($sWh,0,strlen($sWh)-strlen('-greaterthanequalto')),$aWhere[$sWh]);
153-
}
153+
} else {
154+
# its a like
155+
$oWh->greaterThanOrEqualTo(substr($sWh,0,strlen($sWh)-strlen('-greaterthanequalto')),$aWhere[$sWh]);
156+
}
154157

155-
$bIsLessEqual = stripos($sWh,'-lessthanequalto');
156-
if($bIsLessEqual === false) {
158+
$bIsLessEqual = stripos($sWh,'-lessthanequalto');
159+
if($bIsLessEqual === false) {
157160

158-
} else {
159-
# its a like
160-
$oWh->lessThanOrEqualTo(substr($sWh,0,strlen($sWh)-strlen('-lessthanequalto')),$aWhere[$sWh]);
161+
} else {
162+
# its a like
163+
$oWh->lessThanOrEqualTo(substr($sWh,0,strlen($sWh)-strlen('-lessthanequalto')),$aWhere[$sWh]);
164+
}
161165
}
166+
if(array_key_exists('created_by',$aWhere)) {
167+
$oWh->equalTo('created_by',$aWhere['created_by']);
168+
}
169+
if(array_key_exists('modified_by',$aWhere)) {
170+
$oWh->equalTo('modified_by',$aWhere['modified_by']);
171+
}
172+
if(array_key_exists('multi_tag',$aWhere)) {
173+
$sEntityType = explode('-',$this->sSingleForm)[0];
174+
$oSel->join(['category_tag'=>'core_entity_tag_entity'],'category_tag.entity_idfs = '.$sEntityType.'.'.ucfirst($sEntityType).'_ID');
175+
$oWh->equalTo('category_tag.entity_tag_idfs',$aWhere['multi_tag']);
176+
$oWh->like('category_tag.entity_type',explode('-',$this->sSingleForm)[0]);
177+
}
178+
if(array_key_exists('multi_tag_custom',$aWhere)) {
179+
$sEntityType = explode('-',$this->sSingleForm)[0];
180+
$oSel->join(['category_tag_custom'=>$aWhere['multi_tag_custom-tbl']],'category_tag_custom.'.$aWhere['multi_tag_custom-keyjoin'].' = '.$sEntityType.'.'.ucfirst($sEntityType).'_ID');
181+
$oWh->equalTo('category_tag_custom.'.$aWhere['multi_tag_custom-keylike'],$aWhere['multi_tag_custom']);
182+
}
183+
if(array_key_exists('tag_like',$aWhere)) {
184+
$sEntityType = explode('-',$this->sSingleForm)[0];
185+
$oSel->join(['category_tag'=>'core_entity_tag_entity'],'category_tag.entity_idfs = '.$sEntityType.'.'.ucfirst($sEntityType).'_ID');
186+
$oSel->join(['entity_tag' => 'core_entity_tag'],'entity_tag.Entitytag_ID = category_tag.entity_tag_idfs',['Entitytag_ID','tag_value','tag_idfs']);
187+
$oWh->like('entity_tag.tag_value','%'.$aWhere['tag_like'].'%');
188+
//$oWh->like('category_tag.entity_type',explode('-',$this->sSingleForm)[0]);
189+
}
190+
$oSel->where($oWh);
162191
}
163-
if(array_key_exists('created_by',$aWhere)) {
164-
$oWh->equalTo('created_by',$aWhere['created_by']);
165-
}
166-
if(array_key_exists('modified_by',$aWhere)) {
167-
$oWh->equalTo('modified_by',$aWhere['modified_by']);
168-
}
169-
if(array_key_exists('multi_tag',$aWhere)) {
170-
$sEntityType = explode('-',$this->sSingleForm)[0];
171-
$oSel->join(['category_tag'=>'core_entity_tag_entity'],'category_tag.entity_idfs = '.$sEntityType.'.'.ucfirst($sEntityType).'_ID');
172-
$oWh->equalTo('category_tag.entity_tag_idfs',$aWhere['multi_tag']);
173-
$oWh->like('category_tag.entity_type',explode('-',$this->sSingleForm)[0]);
174-
}
175-
if(array_key_exists('multi_tag_custom',$aWhere)) {
176-
$sEntityType = explode('-',$this->sSingleForm)[0];
177-
$oSel->join(['category_tag_custom'=>$aWhere['multi_tag_custom-tbl']],'category_tag_custom.'.$aWhere['multi_tag_custom-keyjoin'].' = '.$sEntityType.'.'.ucfirst($sEntityType).'_ID');
178-
$oWh->equalTo('category_tag_custom.'.$aWhere['multi_tag_custom-keylike'],$aWhere['multi_tag_custom']);
179-
}
180-
if(array_key_exists('tag_like',$aWhere)) {
181-
$sEntityType = explode('-',$this->sSingleForm)[0];
182-
$oSel->join(['category_tag'=>'core_entity_tag_entity'],'category_tag.entity_idfs = '.$sEntityType.'.'.ucfirst($sEntityType).'_ID');
183-
$oSel->join(['entity_tag' => 'core_entity_tag'],'entity_tag.Entitytag_ID = category_tag.entity_tag_idfs',['Entitytag_ID','tag_value','tag_idfs']);
184-
$oWh->like('entity_tag.tag_value','%'.$aWhere['tag_like'].'%');
185-
//$oWh->like('category_tag.entity_type',explode('-',$this->sSingleForm)[0]);
186-
}
187-
$oSel->where($oWh);
188192
$oSel->order($sSort);
189193

190194
if($iLimit != 0) {

module/Application/src/Module.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class Module {
2727
*
2828
* @since 1.0.0
2929
*/
30-
const VERSION = '1.0.33';
30+
const VERSION = '1.0.34';
3131

3232
public function getConfig() : array
3333
{

0 commit comments

Comments
 (0)