tomolimo / processmaker

GLPI plugin that provides an interface with ProcessMaker (http://www.processmaker.com/)
30 stars 11 forks source link

The first task does not finish #168

Closed jorge-madrigal closed 7 months ago

jorge-madrigal commented 7 months ago

Hello @tomolimo:

I keep doing tests without success. The first task does not finish. I attach a video with the postmessages sent between the iframe and the main window.

https://github.com/tomolimo/processmaker/assets/66475507/6bfb512d-d6c2-4c35-b42f-c4f1244a9a88

The first task of the process has 2 steps. The first step collects data, the second step has the submit button.

I do this same process in processmaker and it works correctly

I don't know if it is normal for messages between the iframe and the window to be duplicates

processmaker server: version 3.3 R 2.0 procesmmaker plugin: 5.0.1 glpi 10.0.10


On the other hand, I think that the GLPI_DATA error is corrected in release 2.1. At least I no longer see an error in the chrome console


Thank you Jorge

tomolimo commented 7 months ago

Hello @jorge-madrigal

Does the latest version fix the issue of the GLPI_DATA?

Thank you, Regards, Tomolimo

jorge-madrigal commented 7 months ago

Hello @tomolimo:

Does the latest version fix the issue of the GLPI_DATA? I think so. Before, in the chrome console, I saw a GLPI_DATA not found error. Now I don't see that error.

https://github.com/tomolimo/processmaker/assets/66475507/86f9ef9e-ebb8-46d4-9a41-3535b7c67457

But, I can't confirm it 100% because I can't get the first task to finish.


Is it normal for there to be repeated postmessage between the iframe and the main window?

Thank you, Regards, Jorge

tomolimo commented 7 months ago

Hello @jorge-madrigal,

Could you post the process which is blocked at the first task? And also post the process config in GLPI? Regarding your question about duplicated postmessage: I don't know. I'm going to investigate

Thank you Regards, Tomolimo

tomolimo commented 7 months ago

Hello @jorge-madrigal I can reproduce the blocking task, so I don't need more information, thank you Thank you, Regards, Tomolimo

tomolimo commented 7 months ago

Hello @jorge-madrigal There is a new release of PM server (RE-2.2) due to a bug I've introduced in RE-2.1: https://github.com/tomolimo/processmaker-server/releases/tag/RE-2.2 I have a fix for the issue of the task that doesn't post onto GLPI (but give some minutes to release a new version of the plugin). Thank you Regards, Tomolimo

tomolimo commented 7 months ago

Hello @jorge-madrigal https://github.com/tomolimo/processmaker/releases/tag/5.0.2 will fix the issue with the first task that is blocked 😃 Thank you for your help Regards, Tomolimo

jorge-madrigal commented 7 months ago

Hello @tomolimo:

Version 5.0.2...works!!!!!

Just this morning I came close to finding the error.

I saw that the first time, when"case_submit_form: function" is called, you cancel the form with preventDefault and wait for the case to be recorded and routed.

The second time "case_submit_form: function" is called it tries to submit the form, but cannot. I imagine it is because of the data-submitted attribute is true.

From what I see, preventDefault does not eliminate the attribute and must be done manually.

All I can only say is thank you, thank you and thank you very much.

Tomorrow, Thursday, I will test the complete process with all the steps (output document, etc.).

I stay informed.

Thank you very much. Regards, Jorge Madrigal

tomolimo commented 7 months ago

Hello @jorge-madrigal,

For your information: GLPI core js is adding the data-submitted=true, but I cannot set it to false when I do the preventDefault as I don't know if the attribute is already set or not (there is no guarantee about the execution order of the handlers). Another question was: the multiple postmessage that are sent:

Thank you for your tests.

Regards, Tomolimo

jorge-madrigal commented 7 months ago

Hello @tomolimo:

I have good news and bad news.

The good news is: Version 5.0.2, works correctly.

But....here's the bad thing, GLPI_DATA is lost when you do the following:

We use many tasks with 3 steps:


Step 1. form Step 2. We generate PDF with the form data from step 1. But this step is not shown to the user. We jump to step 3. We do it with a trigger in the "after output document" section, with this code.

$result = executeQuery("SELECT STEP_UID_OBJ FROM STEP WHERE TAS_UID='".@@TASK. "' and STEP_POSITION = 3"); @@stepUID_OBJ= $result[1]["STEP_UID_OBJ"];

PMFRedirectToStep(@@APPLICATION, @%INDEX, 'DYNAFORM', @@stepUIDObj);

Step 3. We show the PDF file to the user so they can sign it digitally.


If we jump to step 3 from step 2, GLPI_DATA is lost. Why do we skip to step 3? Because we believe that it is an auxiliary step that does not give the user any special information. At least, in our process.

I don't know if this can be controlled in the processmaker plugin or server. Could it be controlled so that it does not lose GLPI_DATA?

As a solution, I can always not do the jump.

Thank you. Jorge

jorge-madrigal commented 7 months ago

Hello again @ tomolimo:

About..."Another question was: the multiple postmessage that are sent".

I also think that the Chrome extension to view postmessage messages does not work correctly.

Thank you again. Regards, Jorge

tomolimo commented 7 months ago

Hello @jorge-madrigal I think that if you don't want to show the output document step to the end-user, then the best solution would be to generate the document in a trigger instead of trying to do step jump. See: https://wiki.processmaker.com/3.3/Output_Documents#Generating_Output_Documents Thank you, Regards, Tomolimo

tomolimo commented 7 months ago

The PMFGenerateOutputDocument() is here: PMFGenerateOutputDocument