CDbException when i try to set template permissions

More
1 month 4 days ago #159727 by alimeaday
alimeaday created the topic: CDbException when i try to set template permissions
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?

Please Log in to join the conversation.

More
1 month 3 days ago #159771 by olle
olle replied the topic: CDbException when i try to set template permissions
Strange, I'll have a look.

Please Log in to join the conversation.

More
1 month 3 days ago #159773 by olle
olle replied the topic: CDbException when i try to set template permissions
Have you been testing LS 3.0 beta on the same database?

Please Log in to join the conversation.

More
1 month 3 days ago #159777 by olle
olle replied the topic: CDbException when i try to set template permissions
The LS 3.0 changes the template database table completely, so you will run into trouble if you go back to 2.7x after.

Please Log in to join the conversation.

More
1 month 2 days ago #159801 by alimeaday
alimeaday replied the topic: CDbException when i try to set template permissions
I have not tested LS 3.0. That can not be the problem.

Please Log in to join the conversation.

More
1 month 2 days ago #159814 by olle
olle replied the topic: CDbException when i try to set template permissions
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.

Please Log in to join the conversation.

More
1 month 2 days ago - 1 month 2 days ago #159822 by alimeaday
alimeaday replied the topic: CDbException when i try to set template permissions
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: 1 month 2 days ago by alimeaday.

Please Log in to join the conversation.

More
1 month 1 day ago #159868 by olle
olle replied the topic: CDbException when i try to set template permissions
Maybe a delete template action went wrong and an inconsistency was created between templates in the database and templates in the filesystem?

Please Log in to join the conversation.

More
1 month 1 day ago #159899 by alimeaday
alimeaday replied the topic: CDbException when i try to set template permissions
It seems that way. Can i just delete the entry in mysql?

Mysql:
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:
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
 

Please Log in to join the conversation.

More
4 weeks 1 day ago #159933 by olle
olle replied the topic: CDbException when i try to set template permissions
If the template doesn't exist in the file system it should be safe to delete that entry in the database.

Please Log in to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now
Join our Newsletter!