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

“Land” field in onOffice enterprise is a single select but it is output as input field in plugin and frontend #540

Open
fredericalpers opened this issue May 26, 2023 Discussed in #535 · 36 comments
Assignees
Labels
blocked Blocked due to external factors bug Indicates an unexpected problem or unintended behaviour

Comments

@fredericalpers
Copy link
Member

fredericalpers commented May 26, 2023

Discussed in #535

Originally posted by fredericalpers May 26, 2023

Current state

The "Land" field is displayed as an input field in the plugin and in the frontend. However it is a single select in onOffice enterprise. This causes problems.

Forms can not be submitted if a country name like "France" is entered. It is only possible to sent a form when typing the value from onOffice enterprise "10" for France. If the input is 10 then the form is sent and also an address will be created.

If the fieldname "FRA" is entered, the form will be sent with "no data" to the e-mail but in onOffice enterprise the correct country will be added to the address.

Edit: deleted the investigation part

Desired state

In the plugin and in the frontend, the field must also be a single select. All countries that the customers have activated in onOffice enterprise should be selectable here.

@fredericalpers fredericalpers added bug Indicates an unexpected problem or unintended behaviour investigate labels May 26, 2023
@yeneastgate
Copy link
Contributor

@fredericalpers
After checking this issue, we need more than a week to investigate closely and also work on it.
Meanwhile, some issues in the cycle 25/05 such as "Default values for estate list" and other issues in this cycle also account for a considerable amount of time.
Therefore, I'm not sure I'll be able to finish this issue in time this cycle. It would be great if we can push this issue to the next cycle so that we have enough time to work well on other issues.
At that time, we can deal with a small change issue, please check and push if necessary. Thanks.

@fredericalpers
Copy link
Member Author

@fredericalpers After checking this issue, we need more than a week to investigate closely and also work on it. Meanwhile, some issues in the cycle 25/05 such as "Default values for estate list" and other issues in this cycle also account for a considerable amount of time. Therefore, I'm not sure I'll be able to finish this issue in time this cycle. It would be great if we can push this issue to the next cycle so that we have enough time to work well on other issues. At that time, we can deal with a small change issue, please check and push if necessary. Thanks.

Thank you for investigating. I will lock this issue and push it to the next cycle. :)

@onOffice-Web-Org onOffice-Web-Org locked and limited conversation to collaborators Jun 2, 2023
@onOffice-Web onOffice-Web added this to the v4.13 milestone Jun 7, 2023
@onOffice-Web-Org onOffice-Web-Org unlocked this conversation Jun 20, 2023
@dai-eastgate
Copy link
Contributor

dai-eastgate commented Jun 22, 2023

Hi @fredericalpers, I have a few questions that need your clarification:

  1. Currently, I check the code and find there are 2 keys "land" and "Land", the one you are trying to change is "Land" right?
    image

  2. In the Investigate section, I understand your requirement but I don't really understand why you want to change the name from "Land" to "Country"

  3. Do you want the "Land" field to be a single select in both frontend and backend?

@fredericalpers
Copy link
Member Author

fredericalpers commented Jun 22, 2023

@dai-eastgate

  1. we need to use both. "Land" is for address. "land" is for properties.
    for instance: in the applicantform in the part for contact details (address) the field "Land" has to be used.
    Further down in the part of the search criteria the "land" field has to be used.

In search forms also the "land" field has to be used.

  1. We do not want to change the name to "country".

  2. yes, please change the field to a single select in both frontend and backend.

@dai-eastgate
Copy link
Contributor

@dai-eastgate

  1. we need to use both. "Land" is for address. "land" is for properties.
    for instance: in the applicantform in the part for contact details (address) the field "Land" has to be used.
    Further down in the part of the search criteria the "land" field has to be used.

In search forms also the "land" field also the "land" field has to be used.

  1. We do not want to change the name to "country".
  2. yes, please change the field to a single select in both frontend and backend.

Yes, I will implement it. Thanks!

@dai-eastgate
Copy link
Contributor

Apparently the "Land" field in the plugin is called "Country" everywhere. It is necessary to check whether a renaming in the plugin is necessary so that the function can be used as intended.

I have one question: If you don't want to change the name of "Land" to "Country", what do you mean, please explain to me.

@fredericalpers
Copy link
Member Author

Apparently the "Land" field in the plugin is called "Country" everywhere. It is necessary to check whether a renaming in the plugin is necessary so that the function can be used as intended.

I have one question: If you don't want to change the name of "Land" to "Country", what do you mean, please explain to me.

@dai-eastgate you can ignore that part. I will edit it out of the original issue. :)

@dai-eastgate
Copy link
Contributor

dai-eastgate commented Jun 28, 2023

Hi @fredericalpers , I would like to confirm some points with you:

  1. When I checked first, the "Land" field displays in the address as a single-select and the value option of the single-select is a number.
    => It leads to this issue: "Forms can not be submitted if a country name like "France" is entered. It is only possible to send a form when typing the value from onOffice enterprise "10" for France. If the input is 10 then the form is sent and also an address will be created."
    Attached image
    image

  2. Currently, I check and see that the "Land" field displays in the address as single-select and the value option of single-select is "short name lower case"
    Attached image

image
So, when we changed it to single-select, the address record is created correctly and the value of "Land" got the correct country submitted from the form.

  1. However, another problem, that is: in the content of the email sent, the "Land" field did not display the value of the submitted country from the form.
    Attached image

image

Reason: on your backend when generating email content, the "Land" field only accepts the value as "short name lowercase".
Please check it with your IT Department and let me know your opinions about this. Thanks!

@fredericalpers
Copy link
Member Author

@dai-eastgate If I'm not confusing it myself right now, the field that is not displayed is the different "land" field. As mentioned in the comment above there are two different fields.

Can you confirm this?

@yeneastgate
Copy link
Contributor

yeneastgate commented Jun 29, 2023

@fredericalpers
Sorry, You seem to be confusing "short name lowercase" in this comment "the 'Land' field only accepts the value as "short name lowercase".

"short name lowercase" is short name lowercase of ISO code
not mean is the "land" field.
short name lower case

We seem to find a solution for the "change the field 'Land' to a single select in both frontend and backend" issue work fine("Land" field display normal even in content email )
I need a day to research and implement it. I will reponse you later.

@yeneastgate
Copy link
Contributor

@fredericalpers
I need onOffice API documentation for "do" action_id with "contactaddress" resourceType.
image

We don't find it in the API doc this link
https://apidoc.onoffice.de/
Please provide me as soon as possible, thanks

@fredericalpers
Copy link
Member Author

@fredericalpers I need onOffice API documentation for "do" action_id with "contactaddress" resourceType. image

We don't find it in the API doc this link https://apidoc.onoffice.de/ Please provide me as soon as possible, thanks

@yeneastgate I will get back to you as soon as possible, thank you. :)

@fredericalpers
Copy link
Member Author

@yeneastgate please check the following links if any of this is helpful otherwise I will send a ticket to our IT-Department for clarification:

@yeneastgate
Copy link
Contributor

I have researched, implemented and found the following problems:

When creating a contact address record
According to the "API doc", the field "Land" required data type as "STRING” and the value is "country as ISO 3166-1 alpha-3 value format"
image

But actually, if I submit the "Land" field as "ISO 3166-1 alpha-3 value", I can create a contact address record on the enterprise according to the name of the country we submitted, but the mail does not show that field.

cmt.mp4

If I send the “Land” field as "the German-translated country name", then I can create address in both contact and email

With the API doc you send me:
ApiResponseDoContactaddress(https://github.com/onOffice-Web-Org/oo-wp-plugin/blob/7a436759c3b386a27744cc67924ed6d57a73eb0a/tests/resources/ApiResponseDoContactaddress.json)
I can't find anything related to 'Land'.

So I guess, the current reason is that when generating email content, the "Land" field shows only "the German-translated country name".
For the input field value "FRA", the form will be sent with "no data" to the e-mail but in onOffice enterprise, the correct country will be added to the address.

Please check with your IT about these problems and let us know about your opinion. Thanks.

@fredericalpers fredericalpers added the blocked Blocked due to external factors label Jul 7, 2023
@fredericalpers fredericalpers modified the milestones: v4.14, v4.16 Jul 7, 2023
@fredericalpers
Copy link
Member Author

postponed for now, since I'm still waiting for more information.

@fredericalpers fredericalpers removed this from the v4.16 milestone Aug 9, 2023
@fredericalpers
Copy link
Member Author

We would like to split this issue into two issues. Before we do that we would like to confirm if the following is possible:

Since there is a problem with using ISO 3166-1 alpha-3 for the mail transmission, we would like to skip this and instead just transmit the value (e.g. 10 for france) in the mail for now. Would this be possible?

@yeneastgate

@yeneastgate
Copy link
Contributor

@fredericalpers Yes, let me try again and report back to you with the clearest results

@fredericalpers
Copy link
Member Author

@yeneastgate

(1) What is the GET request to get all available countries for address records?

https://apidoc.onoffice.de/actions/datensatz-anlegen/adressen/

The following request can be used to display the values for the "Land" field:

{
        "actionid":"urn:onoffice-de-ns:smart:2.5:smartml:action:get",
        "resourceid":"fieldvalues",
        "identifier":"",
        "resourcetype":"confignewaddressfields",
        "parameters":
        {
          "fieldname": "Land"
        }
}

(2) How do we have to write a post request to create an address record with a country?

https://apidoc.onoffice.de/actions/datensatz-anlegen/adressen/

For country, simply enter the ISO 3166-1 alpha-3 value such as "DEU" for Deutschland or "AUT" for Austria.

{
    "actionid":"urn:onoffice-de-ns:smart:2.5:smartml:action:create",
    "resourcetype":"address",
    "resourceid":"",
    "identifier":"",
    "parameters": {
        "Land":"AUT",
        "Vorname":"Max",
        "Name":"Mustermann"
    }
}

@fredericalpers fredericalpers removed the blocked Blocked due to external factors label Sep 18, 2023
@fredericalpers fredericalpers added this to the v4.17 milestone Sep 18, 2023
@yeneastgate
Copy link
Contributor

@yeneastgate
Thanks, I will check and let you know asap.

@yeneastgate
Copy link
Contributor

yeneastgate commented Sep 19, 2023

The following request can be used to display the values for the "Land" field:

{
        "actionid":"urn:onoffice-de-ns:smart:2.5:smartml:action:get",
        "resourceid":"fieldvalues",
        "identifier":"",
        "resourcetype":"confignewaddressfields",
        "parameters":
        {
          "fieldname": "Land"
        }
}

@fredericalpers yes, I can display the values for the "Land" field When calling this API

@yeneastgate
Copy link
Contributor

yeneastgate commented Sep 19, 2023

https://apidoc.onoffice.de/actions/datensatz-anlegen/adressen/

For country, simply enter the ISO 3166-1 alpha-3 value such as "DEU" for Deutschland or "AUT" for Austria.

{
    "actionid":"urn:onoffice-de-ns:smart:2.5:smartml:action:create",
    "resourcetype":"address",
    "resourceid":"",
    "identifier":"",
    "parameters": {
        "Land":"AUT",
        "Vorname":"Max",
        "Name":"Mustermann"
    }
}

@fredericalpers I created an address record with a country When entering the ISO 3166-1 alpha-3 value such as "DEU" for Deutschland

@yeneastgate
Copy link
Contributor

yeneastgate commented Sep 19, 2023

@fredericalpers However, when I enter the ISO 3166-1 alpha-3 value such as "DEU" for Deutschland, the "Land" Field do not show the value in the email content.
not show country in email content
The reason is that this API is not working properly
api send email
ex: You can check this API on "sendEmail" function in file "FormPostInterest.php"
The API has parameters

  • ACTION_ID_DO = 'urn:onoffice-de-ns:smart:2.5:smartml:action:do';
  • resourceType: contactaddress

ex: I enter the ISO 3166-1 alpha-3 value such as "DEU" for Deutschland
$addressData for the "Land" field was submitted correctly is "DEU"
image

Please check the above API operation with the IT department and let me know the results.

@fredericalpers
Copy link
Member Author

@yeneastgate as mentioned in this comment when using the german names of the countries everything works fine.

For that reason we want to investigate further but could not find how the plugin is "building" the email content. would you please be so kind and let us know where we can find how the plugin is "building" the email?

form-mail

@yeneastgate
Copy link
Contributor

@fredericalpers I will check and let you know asap.

@yeneastgate
Copy link
Contributor

yeneastgate commented Sep 27, 2023

where we can find how the plugin is "building" the email?
@fredericalpers
You can check this API on "sendEmail" function in file "FormPostContact.php".

private function sendContactRequest(FormData $pFormData, string $recipient = '', $subject = null)

@fredericalpers
Copy link
Member Author

@yeneastgate

As mentioned in this comment from september 6, more specifically

Entering the correct value e.g. "Deutschland" will correctly transmit the data to onOffice enterprise and also will correctly display it as "Land: Deutschland" in the e-mail.

Please implement a singleselect for both backend and frontend that's displaying the german full name of the countries such as Deutschland, Frankreich, Spanien etc. that are available in onOffice enterprise.

Also use this full name to transfer the data into onOffice enterprise and via email.

@yeneastgate
Copy link
Contributor

@fredericalpers Ok, I will check

@yeneastgate
Copy link
Contributor

yeneastgate commented Oct 2, 2023

@fredericalpers
I tried using a few libraries(e.g.: League..) to get "the German full name of the countries" from "ISO 3166-1 alpha-3 code"
However, the name of the countries returned is not the same name displayed on the enterprise.
image
=> So please update the API response "https://apidoc.onoffice.de/actions/datensatz-anlegen/adressen/" return "the German full name of the countries" information.
ex:
{
"id": "VIR",
"type": "",
"elements": {
"title": "American Virgin Islands"
"name": "the German full name of the countries"
}
},

@fredericalpers fredericalpers modified the milestones: v4.17, v4.18 Oct 12, 2023
@fredericalpers fredericalpers added the up for discussion Issues and Pull Requests which will be discussed label Oct 12, 2023
@fredericalpers fredericalpers removed this from the v4.18 milestone Oct 25, 2023
@yeneastgate yeneastgate self-assigned this Oct 31, 2023
@fredericalpers
Copy link
Member Author

@yeneastgate https://apidoc.onoffice.de/actions/informationen-abfragen/single-and-multiselect-values/

shouldn't it be possible to display the german full name using the "title" of the response? The value of "title" should also be the one being displayed in the e-mail. In the attached XML however it should still use the corresponding ISO 3166-1 alpha-3, so onOffice enterprise can correctly interpret the value.

@fredericalpers fredericalpers added this to the v4.19 milestone Nov 13, 2023
@fredericalpers fredericalpers added investigate and removed up for discussion Issues and Pull Requests which will be discussed labels Nov 13, 2023
@yeneastgate
Copy link
Contributor

yeneastgate commented Dec 29, 2023

@fredericalpers After researching again I found that:
1.

shouldn't it be possible to display the german full name using the "title" of the response? The value of "title" should also be the one being displayed in the e-mail.

=> Yes, it is impossible to display the German full name using the "title" of the response When using the "contactaddress" API to send the email.

I also tried implementing testing on branch "35108-implement-change-land-field-input-to-single-select"

Step 1: Generate the "email body content" on the "onoffice wordpress plugin" side with the "sendmail" old API.
Step 2: Processed the "addressData" with the "createStringFromInputData" method before passing it to $requestParams($body)
=> It is possible to display the German full name using the "title" of the response.
image

540_cmt.mp4

So I think:
We missed process the "addressData" when generating the "content body of email" using the "contactaddress" API of the Onoffice Enterprise system.
=>If we process the "addressData" => Possibly display the full German name using the "title" field when sending an email using the "contactaddress" API.
=> Please check with the IT department again.

In the attached XML however it should still use the corresponding ISO 3166-1 alpha-3, so onOffice enterprise can correctly interpret the value.

I checked again and I did not find <land></land> XML tags related to data processing for the "Land" field (even though I entered a value for the "Land" field when submitting the form).

=> Please check with the IT department generated miss <land></land> XML tags When using the "contactaddress" API to send emails has attachment XML.

@fredericalpers fredericalpers removed this from the v4.19 milestone Jan 8, 2024
@fredericalpers
Copy link
Member Author

@yeneastgate

Step 1: Generate the "email body content" on the "onoffice wordpress plugin" side with the "sendmail" old API.
Step 2: Processed the "addressData" with the "createStringFromInputData" method before passing it to $requestParams($body)
=> It is possible to display the German full name using the "title" of the response.

When using this, the transmission in the mail works as intended, correct?

The XML-Tag seems not to be necessary. It's currently not in the feedback.xml file which is attached to the email but the countries are transmitted to onOffice enterprise correctly.

@nglelinh
Copy link
Contributor

@fredericalpers your last response is a little bit confusing for us. Let me try to summarize our understanding, please help to confirm

  1. the issue is missing a "Land" field in the email sending to the user
  2. current implementation uses the API endpoint - "contactaddress", which generates the email, but the logic on enterprise side misses "Land" field, and we can not control that to add the "Land field
  3. using the another API - "sendemail", we can generate the email content on the plugin side and add the missing "Land" field, but the plugin can not generate the .xml file

Question:

  1. what should we investigate more ?

If needed we can schedule a call to take about

@fredericalpers fredericalpers added blocked Blocked due to external factors and removed investigate 3 weeks labels Feb 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked Blocked due to external factors bug Indicates an unexpected problem or unintended behaviour
Projects
None yet
Development

No branches or pull requests

5 participants