Page 1 of 1

Problem with showtemplate param

Posted: Fri Sep 28, 2012 9:48 am
by airelibre
Hi Guys,

I'm coding a module on a CMSMS 1.11.2, and I have a strange problem.

My module has to export PDF files, so I wanted to use the "showtemplate=false" param on the "generate pdf" action link in order to not load all the page elements (as they are useless in this case).

I have a "download" action, which makes an addition in the DB with a simple "INSERT INTO" query.

In CMSMS 1.11, when I call my module action, like :
"http://www.mywebsite.com/index.php?mact ... late=false[/b]&cntnt01returnid=47

my module code seems to be executed twice ! I mean: I have two new lines in my DB table

When I remove the "showtemplate" param, it's ok

I made the same test with an Audit function, and the Audit script saves the same thing two times too!

Is this a 1.11 bug? I have the latest version (1.11.2). If I remember clearly, it was working on 1.10

Thank you very much for your help :)

Re: Problem with showtemplate param

Posted: Mon Dec 10, 2012 6:01 am
by caciavar
I noticed this exact same behavior after 1.10.

I am using an ajax form, and it sends me two copies of the e-mail instead of just one, which makes me believe that the code is executed twice.

Re: Problem with showtemplate param

Posted: Tue Dec 11, 2012 2:31 pm
by nervino
I'm quite sure the code is executed two times.
(see http://forum.cmsmadesimple.org/viewtopi ... =6&t=64119).

I had a php page, with several "IF and ELSEIF" statements: when the last elseif was executed, in the page I had the output of the first IF statement too. I tried to debug logging in the db, and I had 2 logs recorded.
For me, I guess this issue happens when you use a cmsms generated url (create_url()) inside an ajax script or another jquery script, for example using a fancybox iframe.

I couldn't find a solution, and I removed the fancybox iframe and I sent the mail form without ajax (As I also didn't want all the queries present in the page being executed 2 times).

Re: Problem with showtemplate param

Posted: Tue Dec 11, 2012 3:17 pm
by calguy1000
I can confirm that the &showtemplate=false stuff DOES NOT occur multiple times. I use ajax alot, and have no difficulties.

Re: Problem with showtemplate param

Posted: Tue Dec 11, 2012 4:49 pm
by nervino
I also agree with calguy1000, in many cases I have no problem using ajax &showtemplate=false. It only occurs in some circumstances.
Unfortunatly, I was not able to identify the causes and reproduce the issue.