Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

31368 Property search button value displays all properties #459

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions plugin/EstateList.php
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,8 @@ private function getEstateParameters(int $currentPage, bool $formatOutput)
}
} elseif ($this->getShowReferenceEstate() === DataListView::HIDE_REFERENCE_ESTATE) {
$requestParams['filter']['referenz'][] = ['op' => '=', 'val' => 0];
} elseif ($this->getShowReferenceEstate() === DataListView::SHOW_ONLY_REFERENCE_ESTATE) {
$requestParams['filter']['referenz'][] = ['op' => '=', 'val' => 1];
}

$requestParams += $this->addExtraParams();
Expand Down
17 changes: 0 additions & 17 deletions plugin/Filter/DefaultFilterBuilderListView.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,7 @@ public function buildFilter(): array
case DataListView::LISTVIEW_TYPE_FAVORITES:
$filter = $this->getFavoritesFilter();
break;
case DataListView::LISTVIEW_TYPE_REFERENCE:
$filter = $this->getReferenceViewFilter();
break;
}

$filterWithRegion = $this->addSubRegionFilter($filter);

return $filterWithRegion;
Expand Down Expand Up @@ -161,17 +157,4 @@ private function getFavoritesFilter(): array

return $filter;
}

/**
* @return array
*/
private function getReferenceViewFilter(): array
{
$filter = $this->_defaultFilter;
$filter['referenz'] = [
['op' => '=', 'val' => 1],
];

return $filter;
}
}
11 changes: 11 additions & 0 deletions plugin/Form/Preview/FormPreviewEstate.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use onOffice\SDK\onOfficeSDK;
use onOffice\WPlugin\API\APIClientActionGeneric;
use onOffice\WPlugin\API\ApiClientException;
use onOffice\WPlugin\DataView\DataListView;
use onOffice\WPlugin\DataView\DataListViewFactory;
use onOffice\WPlugin\DataView\UnknownViewException;
use onOffice\WPlugin\Filter\DefaultFilterBuilderFactory;
Expand Down Expand Up @@ -70,6 +71,16 @@ public function preview(string $listName): int
}
$pDefaultFilterBuilder = $this->_pDefaultFilterBuilderFactory->buildDefaultListViewFilter($pListView);
$requestParams['filter'] = $pDefaultFilterBuilder->buildFilter();

switch ($pListView->getShowReferenceEstate()) {
case DataListView::HIDE_REFERENCE_ESTATE:
$requestParams['filter']['referenz'][] = ['op' => '=', 'val' => 0];
break;
case DataListView::SHOW_ONLY_REFERENCE_ESTATE:
$requestParams['filter']['referenz'][] = ['op' => '=', 'val' => 1];
break;
}

$pApiClientAction = $this->_pApiClientAction->withActionIdAndResourceType
(onOfficeSDK::ACTION_ID_READ, 'estate');
$pApiClientAction->setParameters($requestParams);
Expand Down
6 changes: 0 additions & 6 deletions tests/TestClassDefaultFilterBuilderListView.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,12 +160,6 @@ public function testReferenceViewFilter()
'val' => 1,
],
],
'referenz' => [
[
'op' => '=',
'val' => 1,
],
],
];


Expand Down
2 changes: 1 addition & 1 deletion tests/TestClassFormPreviewEstate.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ private function buildSubject(): FormPreviewEstate
->after("1")
->id("2")
->method('setParameters')
->with(['listlimit' => 0, 'filter' => ['veroeffentlichen' => [['op' => '=', 'val' => 1]]], 'filterid' => 24])
->with(['listlimit' => 0, 'filter' => ['veroeffentlichen' => [['op' => '=', 'val' => 1]],'referenz' => [['op' => '=','val' => 0],],], 'filterid' => 24])
->willReturnSelf();
$pApiClientAction
->expects($this->once())
Expand Down