Closed jmaas-onoffice closed 2 years ago
@jmaas-onoffice Can you explain more specifically about requirement "we should additionally have access to all status fields". What we need to do?
That's point 2. The first phrase is just an overview. Can I clarify something in 2.?
@jmaas-onoffice I understand that you need only have access all of the individual status fields and passing them to template but not need show all on template, right?
@hungnc89 Yes, you do not need to add them anywhere, it is just about templates having access to them.
This is currently backwards incompatible and needs to be rethought.
No access to individual status fields
For estate lists and the detail view, when the setting "Show estate status" is active, the plugin gets the status fields like "Reference", "New", "Sold", and more.
It then picks the one with the highest priority and gives only that one as
vermarktungsstatus
to the template. (See thttps://github.com/onOffice-Web-Org/oo-wp-plugin/blob/937935229bac56f7c1ffca299c0d42b3be5f6083/plugin/EstateList.php#L424)This means that in the template you do not have access to the individual status fields.
In particular, if you want to hide the price of all sold estates, you need to make sure that you do not select any status like "Reference". Otherwise, the plugin would set
vermarktungsstatus
to "Reference" and in the template you would have no way of knowing that the field "verkauft" ("sold") is actually active for the estate. This means the price would show for an estate that was sold, which is undesired.Expose individual status fields to templates
As a small-batch project, we propose to make all individual status fields accessible in the template.
The relevant status fields are already queried here: https://github.com/onOffice-Web-Org/oo-wp-plugin/blob/35e2d7ad3e209b5090a37d77dc0a8699e856d794/plugin/Types/EstateStatusLabel.php#L46-L54
We need to stay backwards compatible. Luckily, the field
vermarktungsstatus
is not an actual status field from enterprise, so its behavior can stay the same and we do not need to rename any status field.There is no need to add or output the fields anywhere. They should simply be accessible in the template.