Menu
SuiteCRM Pull Request Party hosted by SalesAgility
Welcome, Guest
Username: Password: Remember me

TOPIC: Survey duplicate lost all questions if original survey has answers

Survey duplicate lost all questions if original survey has answers 2 weeks 4 days ago #86351

  • 111alexr
  • 111alexr's Avatar
  • Offline
  • Senior Member
  • Posts: 43
  • Thank you received: 1
  • Karma: 0
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.
1. Create any survey with 1 or more quesions.
2. Answer 1 or more times.
3. Duplicate it.

Result - All questions in the new survey will be lost.

Image uploaded:
[CRM_survey_block_questions_to_duplicate.PNG]
The administrator has disabled public write access.

Survey duplicate lost all questions if original survey has answers 2 weeks 3 days ago #86392

  • 111alexr
  • 111alexr's Avatar
  • Offline
  • Senior Member
  • Posts: 43
  • Thank you received: 1
  • Karma: 0
UPDATE: here are 2 different problems, so I changed description
1) This post - Can't duplicate survey with any answer
2) New post - duplicate survey with Draft or Public status is ok but original servey lost all questions
Survey duplicate but delete all questions in original survey suitecrm.com/suitecrm/forum/suitecrm-7-0...s-in-original-survey


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.
1. Create any survey with 1 or more quesions.
2. Answer 1 or more times.
3. Duplicate it.

Result - All questions in the new survey will be lost.
The administrator has disabled public write access.

Survey duplicate lost all questions if original survey has answers 5 days 21 hours ago #86908

  • pgr
  • pgr's Avatar
  • Offline
  • Administrator
  • Posts: 10450
  • Thank you received: 1558
  • Karma: 358
There was a bug with the surveys entry point, I am not sure if it affects your version.

Does this change improve anything in the problem you describe here?

github.com/salesagility/SuiteCRM/pull/7516/files

My SuiteCRM In-depth blog.
Thank you for always stating your SuiteCRM version, checking your logs, reading the Docs, and searching before you ask!
The administrator has disabled public write access.

Survey duplicate lost all questions if original survey has answers 3 days 17 hours ago #87055

  • 111alexr
  • 111alexr's Avatar
  • Offline
  • Senior Member
  • Posts: 43
  • Thank you received: 1
  • Karma: 0
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 :)

Anyway I retest it again and publish the result.
The administrator has disabled public write access.

Survey duplicate lost all questions if original survey has answers 3 days 17 hours ago #87056

  • 111alexr
  • 111alexr's Avatar
  • Offline
  • Senior Member
  • Posts: 43
  • Thank you received: 1
  • Karma: 0
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:

1. 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.

2. 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.

3. 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

Here is new behavior for different 2 situations.

Thanks. Alex
Attachments:
The administrator has disabled public write access.

Survey duplicate lost all questions if original survey has answers 3 days 14 hours ago #87068

  • pgr
  • pgr's Avatar
  • Offline
  • Administrator
  • Posts: 10450
  • Thank you received: 1558
  • Karma: 358
Are you using an IDE (like PHpStorm or Eclipse)? Can you debug through the Survey duplication code to see where it's going wrong?

My SuiteCRM In-depth blog.
Thank you for always stating your SuiteCRM version, checking your logs, reading the Docs, and searching before you ask!
The administrator has disabled public write access.

Survey duplicate lost all questions if original survey has answers 17 hours 12 minutes ago #87150

  • 111alexr
  • 111alexr's Avatar
  • Offline
  • Senior Member
  • Posts: 43
  • Thank you received: 1
  • Karma: 0
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 :)

Alex
The administrator has disabled public write access.

Survey duplicate lost all questions if original survey has answers 16 hours 35 minutes ago #87151

  • 111alexr
  • 111alexr's Avatar
  • Offline
  • Senior Member
  • Posts: 43
  • Thank you received: 1
  • Karma: 0
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).

1. For the 2nd new duplicated Survey "Dup test original 2 from Draft" here the question with Deleted = 0.

2. 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

3. 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.

5. 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

ID abd8d536-7e61-a90d-3ef5-5d28796e0662
Duplicate
2019-07-12 12:12:19
2019-07-12 12:13:05
1
1
NULL
Deleted = 0
0
Rating
0
Survey_id = 9ce9faa2-f785-e862-553a-5d28799093c6

Maybe it helps a little bit. I surprised with DB analysis.

Alex
The administrator has disabled public write access.
Time to create page: 0.051 seconds
Powered by Kunena Forum