... | ... |
@@ -53,8 +53,13 @@ |
53 | 53 |
<ul> |
54 | 54 |
<li> |
55 | 55 |
<span class="label">Adresse:</span> |
56 |
- {% if item.address is not empty %}{{ item.address }}<br>{% endif %} |
|
57 |
- {% if item.postal is not empty and item.city is not empty %}{{ item.postal }} {{ item.city }}<br>{% endif %} |
|
56 |
+ {% if item.hasProperty %} |
|
57 |
+ {% if item.property.address is not empty %}{{ item.property.address }}<br>{% endif %} |
|
58 |
+ {% if item.property.postal is not empty and item.property.city is not empty %}{{ item.property.postal }} {{ item.property.city }}<br>{% endif %} |
|
59 |
+ {% else %} |
|
60 |
+ {% if item.address is not empty %}{{ item.address }}<br>{% endif %} |
|
61 |
+ {% if item.postal is not empty and item.city is not empty %}{{ item.postal }} {{ item.city }}<br>{% endif %} |
|
62 |
+ {% endif %} |
|
58 | 63 |
</li> |
59 | 64 |
{% if item.livingSpace > 0 %} |
60 | 65 |
<li> |
... | ... |
@@ -90,9 +90,19 @@ class RealEstateAssetsListController extends RealEstateAssetsModuleController |
90 | 90 |
{ |
91 | 91 |
$arrItem = array_merge($asset->row(), [ |
92 | 92 |
'teaserFigure' => $this->getImageFigures($asset->gallerySRC, $figureBuilder, $asset->orderSRC, 1), |
93 |
- 'detailsUrl' => $jumpTo !== null ? $urlGenerator->generate($jumpTo, ['parameters'=>'/items/'.$asset->id]) : null |
|
93 |
+ 'detailsUrl' => $jumpTo !== null ? $urlGenerator->generate($jumpTo, ['parameters'=>'/items/'.$asset->id]) : null, |
|
94 |
+ 'hasProperty' => false |
|
94 | 95 |
]); |
95 | 96 |
|
97 |
+ // Check for object |
|
98 |
+ if (($Property = $asset->getRelated('managedPropertyId')) !== null) { |
|
99 |
+ $arrItem['hasProperty'] = true; |
|
100 |
+ $arrItem['property'] = array_merge($Property->row(),[ |
|
101 |
+ 'teaserFigure' => $this->getImageFigures($Property->gallerySRC, $figureBuilder, $Property->orderSRC, 1), |
|
102 |
+ 'galleryFigures' => $this->getImageFigures($Property->gallerySRC, $figureBuilder, $Property->orderSRC, 0, 0), |
|
103 |
+ ]); |
|
104 |
+ } |
|
105 |
+ |
|
96 | 106 |
// Grouping |
97 | 107 |
if ($model->vr_re_grouped) |
98 | 108 |
{ |
... | ... |
@@ -126,11 +136,18 @@ class RealEstateAssetsListController extends RealEstateAssetsModuleController |
126 | 136 |
} |
127 | 137 |
if (!empty($asset->city)) |
128 | 138 |
{ |
139 |
+ $strCity = $asset->city; |
|
140 |
+ |
|
141 |
+ // Check for object |
|
142 |
+ if (($Property = $asset->getRelated('managedPropertyId')) !== null) { |
|
143 |
+ $strCity = $Property->city; |
|
144 |
+ } |
|
145 |
+ |
|
129 | 146 |
$tmpOptions = $arrAssetsOptions; |
130 |
- $tmpOptions['column'] = array_merge((isset($arrAssetsOptions['column']) ? $arrAssetsOptions['column'] : []),['city'=>'city = ?']); |
|
131 |
- $tmpOptions['value'] = array_merge((isset($arrAssetsOptions['value']) ? $arrAssetsOptions['value'] : []),['city'=>$asset->city]); |
|
147 |
+ $tmpOptions['column'] = array_merge((isset($arrAssetsOptions['column']) ? $arrAssetsOptions['column'] : []),['city'=>'(city = ? AND managedPropertyId < 1) OR ? IN (SELECT p.city FROM tl_vr_re_managedProperties p WHERE p.id = managedPropertyId)']); |
|
148 |
+ $tmpOptions['value'] = array_merge((isset($arrAssetsOptions['value']) ? $arrAssetsOptions['value'] : []),[$strCity,$strCity]); |
|
132 | 149 |
$count = $this->countRealEstateAssets(StringUtil::deserialize($model->vr_re_categories),$tmpOptions); |
133 |
- $arrFilterOptions['city'][$asset->city] = $asset->city . ' ('.$count.')'; |
|
150 |
+ $arrFilterOptions['city'][$strCity] = $strCity . ' ('.$count.')'; |
|
134 | 151 |
} |
135 | 152 |
if (!empty($asset->coldRent)) |
136 | 153 |
{ |