Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

CDbException when i try to set template permissions

  • alimeaday
  • alimeaday's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
6 years 5 months ago #159727 by alimeaday
Hello,

i have a user that i want to give permissions to edit a specific template. When i go to users and click "Set template permissions for this user" i get this error:

CDbCommand failed to execute the SQL statement: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'def07_no_red_mark_focus_first_empty_cells_yesnoaut' for key 'PRIMARY'. The SQL statement executed was: INSERT INTO `lime_templates` (`folder`, `creator`) VALUES (:yp0, :yp1)

Same error on other users as well.

I run the latest stable Version 171017
Full debug:
pastebin.com/5iyW41Ke

Any ideas?
The topic has been locked.
  • ollehar
  • ollehar's Avatar
  • Offline
  • LimeSurvey GmbH Employee
  • LimeSurvey GmbH Employee
More
6 years 5 months ago #159771 by ollehar
Strange, I'll have a look.
The topic has been locked.
  • ollehar
  • ollehar's Avatar
  • Offline
  • LimeSurvey GmbH Employee
  • LimeSurvey GmbH Employee
More
6 years 5 months ago #159773 by ollehar
Have you been testing LS 3.0 beta on the same database?
The topic has been locked.
  • ollehar
  • ollehar's Avatar
  • Offline
  • LimeSurvey GmbH Employee
  • LimeSurvey GmbH Employee
More
6 years 5 months ago #159777 by ollehar
The LS 3.0 changes the template database table completely, so you will run into trouble if you go back to 2.7x after.
The topic has been locked.
  • alimeaday
  • alimeaday's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
6 years 5 months ago #159801 by alimeaday
I have not tested LS 3.0. That can not be the problem.
The topic has been locked.
  • ollehar
  • ollehar's Avatar
  • Offline
  • LimeSurvey GmbH Employee
  • LimeSurvey GmbH Employee
More
6 years 4 months ago #159814 by ollehar
OK, I've pushed a change to repository to help see the error. Can you either pull from github or apply this patch manually?

github.com/LimeSurvey/LimeSurvey/commit/...981439b24984880b1003

Alternatively you can wait until the next release.
The topic has been locked.
  • alimeaday
  • alimeaday's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
6 years 4 months ago - 6 years 4 months ago #159822 by alimeaday
I have applied the patch and now it still shows the error, but it lets me go to the permission settings.

Screenshot:
imgur.com/TsZU0mo

Edit: I just noticed that the list of templates in the permission settings does not match the list of avaiable templates.
For example i deleted def06.. and def08....
Here is the list of templates i can edit in the template editor:
imgur.com/ZQoU7yE
Last edit: 6 years 4 months ago by alimeaday.
The topic has been locked.
  • ollehar
  • ollehar's Avatar
  • Offline
  • LimeSurvey GmbH Employee
  • LimeSurvey GmbH Employee
More
6 years 4 months ago #159868 by ollehar
Maybe a delete template action went wrong and an inconsistency was created between templates in the database and templates in the filesystem?
The topic has been locked.
  • alimeaday
  • alimeaday's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
6 years 4 months ago #159899 by alimeaday
It seems that way. Can i just delete the entry in mysql?

Mysql:
Code:
SELECT * FROM `lime_templates` LIMIT 50
 
folder  creator
def02_no_red_mark  1
def03_no_box  1
def04_no_red_mark_focus_first  1
default  1
news_paper  1
ubuntu_orange  1
def05_no_red_mark_focus_first_empty_cells  1
def06_no_red_mark_focus_first_empty_cells_yesnoaut  1
def07_no_red_mark_focus_first_empty_cells_yesnoaut  1
def08_no_red_mark_focus_first_empty_cells_yesnoaut  1
kdnr12-3  1
nsaid_cdef07  1

Filesystem:
Code:
upload/templates# ls -l
def02_no_red_mark
def03_no_box
def04_no_red_mark_focus_first
def05_no_red_mark_focus_first_empty_cells
def07_no_red_mark_focus_first_empty_cells_yesnoauto_size
index.html
kdnr12-3
nsaid_cdef07
readme.txt
 
The topic has been locked.
  • ollehar
  • ollehar's Avatar
  • Offline
  • LimeSurvey GmbH Employee
  • LimeSurvey GmbH Employee
More
6 years 4 months ago #159933 by ollehar
If the template doesn't exist in the file system it should be safe to delete that entry in the database.
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose