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

Form does not insert attachments in ticket #1367

Closed
dboscaini opened this issue Mar 22, 2019 · 14 comments · Fixed by #1390
Closed

Form does not insert attachments in ticket #1367

dboscaini opened this issue Mar 22, 2019 · 14 comments · Fixed by #1390
Assignees
Labels

Comments

@dboscaini
Copy link

I have GLPI 9.4.4.1 and formcreator 2.80 and when I try to open a ticket through the form the attachment is not included, I ran some tests and the attachment is included only when there is only the files field, if any other add the ticket is opened without the file.

example dont attach
image
image

example attach
image
image

@btry btry added the bug label Mar 22, 2019
@btry btry self-assigned this Mar 22, 2019
@btry
Copy link
Collaborator

btry commented Mar 22, 2019

Hi

I have several reports about this issue. Your observation is interestiing, this might help me to solve it. Please stay tuned next week.

@btry
Copy link
Collaborator

btry commented Mar 25, 2019

Hi

I created 2 forms : one with a file field and an other with a textarea and a file field. Both wotks for me.

Could you export the 2 forms and send them to me ? Maybe there is an other difference which is important to trigger the bug.

@dboscaini
Copy link
Author

I discovered another detail, the error occurs only when I move the field ... for example ... if I just create the attachment field it works, if I move it to another position it stops working ... it follows export from the pre and after move

erro anexo.zip

@btry
Copy link
Collaborator

btry commented Mar 25, 2019

Where do you do this move : in the target ticket, or when you reorder the questions of the form ?

OK, I think the answer is in the JSONs ;)

I'll give a try

@dboscaini
Copy link
Author

when I reorder the questions of the form

image

@btry
Copy link
Collaborator

btry commented Mar 25, 2019

I still don't reproduce : I imported the version of your form before the move, tested it, then moved the file field before the urgency question, and tested it again. I still have the uploaded file in the generated ticket.

@btry
Copy link
Collaborator

btry commented Mar 25, 2019

If you have a testing instance of GLPI, could you try the current develop branch of the plugin and feedback if the bug still occurs ?

@dboscaini
Copy link
Author

Unfortunately I do not currently have a testing GLPI, by the time I resolved not moving the field. One more information that might help is that I'm coming from another version, it was in GLPI 9.2.1 and I went to 9.4.4.1, and the formcreator was in 2.5.2 and I went to 2.8.0. I got many bugs in this migration, it could have been caused by this.

@btry
Copy link
Collaborator

btry commented Mar 25, 2019

By checking the source code or trying to reproduce in various ways, there is nothing obvious yet.

Could you identify 2 answers for the form

  • one which worked fine,
  • another which failed to add the uploaded tile in the target ticket
    Lets call them faID1 and faID2

Take note of the ID of both.

Next, in the table glpi_plugin_formcreator_form_questions, find the row matching the file question of the form, and take note if its ID. Lets call it qID

In the table glpi_plugin_formcreator_answers you whould find 2 rows :

  • one for the working form answer
  • an other for the failed one

select * from glpi_plugin_formcreator_answers where plugin_formcreator_formanswers_id in ( faID1, faID2 ) AND plugin_formcreator_questions_id = qid

I want to compare the value of the column answer for the returned rows.

@dboscaini
Copy link
Author

The form ID OK (faID1) is 13
The question file of faID1 is 169
The answer OK is 47

image

The form ID NotOK (faID2) is 25
The question file of faID2 is 181
The anwser nOK is 47

image

If i run de query selecting only the questions 169 exist, 181 dont exist
image

@btry
Copy link
Collaborator

btry commented Mar 26, 2019

Hi

The row with the foreign key = 181 exists in your screenshot. It is the 3rd line starting from the bottom. However, the column "answer" contains [] which means that no document was taken into account while saving answers. I think the issue is here : the document is uploaded but ignored by the plugin for some reason.

@dboscaini
Copy link
Author

dboscaini commented Mar 26, 2019

Sorry, I had not seen the 181, I believe it is uploaded, because at the opening of the ticket it is shown that the file has been moved successfully.

image

@btry
Copy link
Collaborator

btry commented Apr 5, 2019

Hi

when you reproduce the bug, do you confirm t hat the file is added in the documents of GLPI and you can download it ? (in Management > Documents)

@btry
Copy link
Collaborator

btry commented Apr 18, 2019

Hi

Please test the above patch and feedback. Files should no longer be lost now.

The loss occurs in the following scenario

  • requester opens a form
  • requester uploads a file in a file field
  • requester clicks or edits an other field
  • the update triggers request to the server for visibility update of each field
  • file field processes the uploaded file, converts it into a Document in GLPI. The uploaded file is moved
  • the requester validates the form
  • the file field does not finds any file and considers there are no file to convert into Document

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants