Posts: 31
Threads: 9
Joined: Sep 2009
Reputation:
0
I tired to copy a form using the Form Backup and then the Submission History doesn't enable it self on the new form. In fact there is no new tables for it in the database.
Is this normal? Or have I done something terribly wrong again?
Thank you! :3
Posts: 90
Threads: 30
Joined: Mar 2010
Reputation:
1
Hi Axel,
the same here.
I think it is for privacy reason that you always have to confirm the activation of tracking in the module.
I myself prefere to have it this way to not waste to much mysql resources...
Is it a problem for you application?
Cheers,
Hannes
Posts: 31
Threads: 9
Joined: Sep 2009
Reputation:
0
Hey Hannes,
I have activated tracking for the cloned forms, however I don't think it understands to build the new table for the submission history. Even when history is disabled, there is a table kept in the DB from what it looks like.
My question would be then if there is someway for Submission History to be aware of Form Backup so it knows to create those new tables when form backup makes a copy.
Posts: 90
Threads: 30
Joined: Mar 2010
Reputation:
1
Hey Alex,
ok, now i get you. Sorry, I did not check it in detail...
What you want is are the options "copy submissions history" and "enable submission history by default".
which should be visible in "form backup" module when "submission history" is actived for the form that is to be backuped.
Right?
I guess for the moment you need to set the history db manually in mysql.
Cheers,
Hannes
Posts: 15
Threads: 8
Joined: Jan 2011
Reputation:
0
May 24th, 2011, 1:41 AM
(This post was last modified: May 24th, 2011, 2:05 AM by russellfeeed.)
Okay, I figured a way to create the history table, after you have used Form Backup. However you need to edit the Submission History code:
Edit formtools/modules/submission_history/global/code/actions.php
Change
PHP Code:
<?php
switch ($_POST["action"])
{
case "create_history_table":
$form_id = $_POST["form_id"];
$form_info = ft_get_form($form_id);
$form_name = preg_replace("/\"/", '\"', $form_info["form_name"]);
list($success, $message) = sh_create_history_table($form_id);
$json = "{ \"success\": \"$success\", \"form_id\": \"$form_id\", \"form_name\": \"$form_name\" }";
echo $json;
break;
to
PHP Code:
<?php
switch ($_REQUEST["action"])
{
case "create_history_table":
$form_id = $_REQUEST["form_id"];
$form_info = ft_get_form($form_id);
$form_name = preg_replace("/\"/", '\"', $form_info["form_name"]);
list($success, $message) = sh_create_history_table($form_id);
$json = "{ \"success\": \"$success\", \"form_id\": \"$form_id\", \"form_name\": \"$form_name\" }";
echo $json;
break;
i.e. you're changing the $_POST to $_REQUEST
Then hit this URL using your browser:
Code:
http://www.yourdomain.com/formtools/modules/submission_history/global/code/actions.php?action=create_history_table&form_id=<yourformid>
remember to put in your
own domain, path to formtools and the correct form ID