Hi, team.
Survey duplicate lost all questions if original survey has answers. :oops:
System. RedHat Enterprise. CRM 7.0.15 and 7.0.16.
Problem - it is impossible to repeat servey with at least one answer
Problem description:
In this case you need repeat the survey manually again or keep drafts for all surveys probably will be needed in the future.
Status of servey.
The same problem for draft and public status.
The same problem for answered.
Possible reson.
Module blocks the ability to edit questions. It doesnt generate questions with holded (disabled to edit) fields.
Instead it shows simple table similar to preview mode of the survey.
Reason:
This can be a reason cause the problem to duplicate the survey which has at least one answer.
Possible solution: B-)
Instead the table with questions description generate questions with disabled fields and buttons.
To repeat.
Create any survey with 1 or more quesions.
Answer 1 or more times.
Duplicate it.
Result - All questions in the new survey will be lost.
Hi, team.
Survey duplicate lost all questions if original survey has answers. :oops:
System. RedHat Enterprise. CRM 7.0.15 and 7.0.17 (updated: was 7.0.16).
Problem - it is impossible to repeat servey with at least one answer
Problem description:
In this case you need repeat the survey manually again or keep drafts for all surveys probably will be needed in the future.
Status of servey.
The same problem for answered.
Possible reson.
Module blocks the ability to edit questions. It doesnt generate questions with holded (disabled to edit) fields.
Instead it shows simple table similar to preview mode of the survey.
Reason:
This can be a reason cause the problem to duplicate the survey which has at least one answer.
Possible solution: B-)
Instead the table with questions description generate questions with disabled fields and buttons.
To repeat.
Create any survey with 1 or more quesions.
Answer 1 or more times.
Duplicate it.
Result - All questions in the new survey will be lost.
Hi, Prg.
This fix is nice. I did it with more direct code - $isValidator = new \SuiteCRM\Utility\SuiteValidator();
Thus my problem appear after my fix.
But merged fix much better with coding style and crystal readness
Hi Prg, here is the more complexity problem.
I had a doubt with Survey duplicate behavior and test again.
System. RedHat Enterprise. CRM 7.0.15
The problem gives 2 different situation.(at least).
A) original Survey lost quiestions, duplicate has
B) duplicate Survey lost quiestions, original has
How to replicate the problem:
New Survey in Draft duplicated. = Situation 1
1a) Create new one with one question. Status Draft. > Duplicate it. => 1b) Original has no questions, duplicate has questions.
New Survey in Pubilc without an answer duplicated. = Situation 1
2a) Create new one with one question. Status Public. > Duplicate it. => 2b) Original has no questions, duplicate has questions.
New Survey in Pubilc with an answer duplicated. = Situation 2
3a) Create new one with one question. Status Public. > Duplicate it. => 3b) Original has questions, duplicate has no questions.
** 1a, 1b, 2a, 2b, 3a, 3b - attached files have similar markers with number in thier names to check how it looks
*** the list with 6 surveys with dates to insure order of steps
Hi. I don’t use something like that, sorry.
Last years I’m working in BI area. CRM it is just another one task for me. I try to use all SuiteCRM power without coding. So I’m a little bit far from debuging now.
I just use my past experience to find out and locate a problem. Sometimes I can find and fix a bug myself
Hi, Prg.
With data analysis without debugging I can find where problem is in a logic.
But not exact place in the code for sure.
Problem = The CRM renew Survey_ID field in DB for current original questions instead to copy them to new records and attach to the new. survey.
Explanation how it was detected.
Here are 2 syrveys 1a and 1b.(2nd and 3rd attached images).
For the 2nd new duplicated Survey “Dup test original 2 from Draft” here the question with Deleted = 0.
The most important data about 1st survey is Date and ID
ID 9e0855e9-84bc-d19e-754d-5d2879862237
Date_entered and Date_modified are similar and it is 2019-07-12 12:12:19
The quiestion is not deleted and it is OLD record, created with 1st Survey.
The quiestion belongs to the original “Dup test original” according to Date_entered and Date_modified.
The 2nd survey was created later.
4 No another question in DB for the 1st Suvrey. No questions with Survey_ID 9e0855e9-84bc-d19e-754d-5d2879862237
But the DB has to have 2 identical questions related to different surveys.
It means that the issue is - the CRM logic changes Survey_ID data to new Survey.
But has to create a new record for each question ralated to original survey (which duplicated) with survey_id for new the survey…
Details:
2nd Survey:DB record (partly)
ID 9e0855e9-84bc-d19e-754d-5d2879862237
Date_entered 2019-07-12 12:12:19
Date_modified 2019-07-12 12:12:19
2nd Survey:DB record ““Dup test original 2 from Draft”” is:
ID 9ce9faa2-f785-e862-553a-5d28799093c6
Name Dup test original 2 from Draft
Date_entered 2019-07-12 12:13:05
Date_modified 2019-07-12 12:13:05
Modified user ID 1
Created by1
Description Dup test original
Deleted 0
Assigned_user_id 1
Status Draft
The question:from the original survey “Dup test original” with ID 9e0855e9-84bc-d19e-754d-5d2879862237