onOffice-Web-Org / oo-wp-plugin

onOffice for WP-Websites
https://wp-plugin.onoffice.com
GNU General Public License v3.0
9 stars 9 forks source link

Removing a field from enterprise leads to a critical error in frontend #414

Closed jmaas-onoffice closed 1 year ago

jmaas-onoffice commented 1 year ago

Removing a field in enterprise

You can delete custom fields in enterprise. Custom fields are named for example ind_1876_Feld_adressen21 or ind_2050_Feld_ObjZusatz65. Default fields from enterprise cannot be deleted.

The frontend crashes when a field is missing

If you add a (custom) field to an estate list or the detail view, and then remove that field, the frontend runs into errors.

The estate list outputs an error:

image

The error is this:

[onOffice-Plugin]: The API returned an error with error code 141 and the following message:
Unknown field: ind_1926_Feld_ObjZusatz39

The request that caused this error was:

{
    "actionid": "urn:onoffice-de-ns:smart:2.5:smartml:action:read",
    "resourceid": "",
    "resourcetype": "estate",
    "parameters": {
        "data": [
            "objekttitel",
            "objektart",
            "objekttyp",
            "vermarktungsart",
            "plz",
            "ort",
            "bundesland",
            "objektnr_extern",
            "wohnflaeche",
            "grundstuecksflaeche",
            "nutzflaeche",
            "anzahl_zimmer",
            "anzahl_badezimmer",
            "kaufpreis",
            "kaltmiete",
            "multiParkingLot",
            "ind_1926_Feld_ObjZusatz39",
            "virtualAddress",
            "objektadresse_freigeben",
            "reserviert",
            "verkauft",
            "virtualStreet",
            "virtualHouseNumber",
            "laengengrad",
            "breitengrad",
            "virtualLatitude",
            "virtualLongitude",
            "strasse",
            "showGoogleMap",
            "hausnummer",
            "land",
            "Id"
        ],
        "filter": {
            "veroeffentlichen": [
                {
                    "op": "=",
                    "val": 1
                }
            ]
        },
        "estatelanguage": "ENG",
        "outputlanguage": "ENG",
        "listlimit": 20,
        "formatoutput": true,
        "addMainLangId": true,
        "listoffset": 0,
        "sortby": "kaltmiete",
        "sortorder": "ASC"
    }
}

The detail page crashes:

image

The error is this:

Fatal error: Uncaught Exception:
in /www/htdocs/w01bb2af/testinstanz-jmaa.onofficeweb.com/htdocs/wp-content/plugins/onoffice-for-wp-websites/plugin/API/APIClientExceptionFactory.php on line 53

Call stack:

onOffice\W\A\APIClientExceptionFactory::createExceptionByAPIClientAction()
wp-content/plugins/onoffice-for-wp-websites/plugin/API/APIClientActionGeneric.php:85
onOffice\W\A\APIClientActionGeneric::generateException()
wp-content/plugins/onoffice-for-wp-websites/plugin/API/APIClientActionGeneric.php:136
onOffice\W\A\APIClientActionGeneric::getResultRecords()
wp-content/plugins/onoffice-for-wp-websites/plugin/EstateList.php:223
onOffice\WPlugin\EstateList::loadRecords()
wp-content/plugins/onoffice-for-wp-websites/plugin/EstateList.php:184
onOffice\WPlugin\EstateList::loadEstates()
wp-content/plugins/onoffice-for-wp-websites/plugin/Record/EstateIdRequestGuard.php:68
onOffice\W\R\EstateIdRequestGuard::isValid()
wp-content/plugins/onoffice-for-wp-websites/plugin.php:256
{closure}()
wp-includes/class-wp-hook.php:308
WP_Hook::apply_filters()
wp-includes/class-wp-hook.php:332
WP_Hook::do_action()
wp-includes/plugin.php:565
do_action_ref_array()
wp-includes/class-wp.php:399
WP::parse_request()
wp-includes/class-wp.php:780
WP::main()
wp-includes/functions.php:1332
wp()
wp-blog-header.php:16
require()
index.php:17

Tickets regarding affected customers:

The frontend should not crash, but it rarely happens

While we do not want the frontend to crash it this case, this issue rarely happens. So we want to set an appetite of maximum 3 days work on this.

If it takes longer, please just describe what the issues are that need to be fixed and how long roughly that would take. We will then decide whether we want to invest the work or not.

dai-eastgate commented 1 year ago

@jmaas-onoffice I fixed this bug, you can watch video and give me feedback

https://user-images.githubusercontent.com/106214469/217694489-654e088a-9c38-46ba-92b6-12d37cbb7fd0.mp4

jmaas-onoffice commented 1 year ago

Looks good, thanks!