View Issue Details

This bug affects 1 person(s).
 2
IDProjectCategoryView StatusLast Update
03784Bug reportsSurvey editingpublic2009-11-13 16:40
ReporterMazi Assigned Tojcleeland  
PrioritynormalSeveritypartial_block 
Status closedResolutionfixed 
Product Version1.86 
Fixed in Version1.87RC1 
Summary03784: Can't create survey if expiry date is set
Description

If I set an expiry date for my survey I get the following error message and the survey is not created:

Notice: Undefined variable: isrquery in /home/htdocs/web27/html/mazi/ls/demo/admin/database.php on line 1362
Incorrect date value: '10.12.2018 00:00' for column 'expires' at row 1

Additional Information

How to reproduce:

  1. Create a new survey and set a title
  2. Set date format to "dd.mm.yyyy" at presentation & navigation tab
  3. Set start date to todays date
  4. Set expiry date to e.g. "today next year", in this example (error message above) "19.10.2010"
  5. Click Create survey
  6. Wonder about the error message shown above.

I can reproduce this error with 1.86 stable and 1.87beta

TagsNo tags attached.
Bug heat2
Complete LimeSurvey version number (& build)7697
I will donate to the project if issue is resolved
BrowserFF3
Database type & versionMySQL 5
Server OS (if known)Win XP Sp 3
Webserver software & version (if known)Apache 2.2
PHP Version5.2

Relationships

related to 03756 closedjcleeland SQL error messages when trying to update start or expiry date 
related to 03787 closedMazi Start- und expiry date are not imported 

Users monitoring this issue

There are no users monitoring this issue.

Activities

jcleeland

jcleeland

2009-10-19 15:27

reporter   ~09820

Will investigate further tomorrow, but issue arises here, in database.php lines 1297 to 1317
if (trim($_POST['expires'])=='')
{
$_POST['expires']=null;
}
else
{
$datetimeobj = new Date_Time_Converter($_POST['expires'] , "Y-m-d H:i:s");
$browsedatafield=$datetimeobj->convert($dateformatdetails['phpdate'].' H:i');
$_POST['expires']=$browsedatafield;
}

    if (trim($_POST['startdate'])=='')
    {
        $_POST['expires']=null;
    }
    else
    {
        $datetimeobj = new Date_Time_Converter($_POST['startdate'] , "Y-m-d H:i:s");
        $browsedatafield=$datetimeobj->convert($dateformatdetails['phpdate'].' H:i');                      
        $_POST['startdate']=$browsedatafield;
    }

which are converting perfectly nice dates into something completely wrong, and then attempting to insert a weird date/time format into mysql. As an example, my date which gets posted as 06.10.2009 then gets converted by these functions to 09.12.2005 01:00, and when that attempts to get inserted into the mysql date/time field it either causes an error(as discovered by Mazi) or MySql just makes it into 0000-00-00

jcleeland

jcleeland

2009-10-20 02:13

reporter   ~09822

The problem was twofold, with the lines
$datetimeobj = new Date_Time_Converter($_POST['expires'] , "Y-m-d H:i:s");
and
$browsedatafield=$datetimeobj->convert($dateformatdetails['phpdate'].' H:i');

Firstly, the date was being delivered in Y.m.d H:i:s format, not Y-m-d H:i:s. And then secondly, the date needed to be changed to a database friendly format for inserting, and $dateformatdetails['phpdate'] does not produce this. I copied the Date_Time_Converter->convert function from the update database function which worked, and that fixes the problem.

Issue History

Date Modified Username Field Change
2009-10-19 15:20 Mazi New Issue
2009-10-19 15:20 Mazi Status new => assigned
2009-10-19 15:20 Mazi Assigned To => user372
2009-10-19 15:20 Mazi LimeSurvey build number => 7697
2009-10-19 15:20 Mazi Browser => FF3
2009-10-19 15:20 Mazi Database & DB-Version => MySQL 5
2009-10-19 15:20 Mazi Operating System (Server) => Win XP Sp 3
2009-10-19 15:20 Mazi Webserver => Apache 2.2
2009-10-19 15:20 Mazi PHP Version => 5.2
2009-10-19 15:21 Mazi Assigned To user372 => jcleeland
2009-10-19 15:23 Mazi Summary Can't create survey if expery date is set => Can't create survey if expiry date is set
2009-10-19 15:23 Mazi Description Updated
2009-10-19 15:23 Mazi Additional Information Updated
2009-10-19 15:27 jcleeland Note Added: 09820
2009-10-20 02:13 jcleeland Note Added: 09822
2009-10-20 02:13 jcleeland Status assigned => resolved
2009-10-20 02:13 jcleeland Fixed in Version => 1.87RC1
2009-10-20 02:13 jcleeland Resolution open => fixed
2009-10-20 14:58 Mazi Relationship added related to 03756
2009-10-21 14:11 Mazi Relationship added related to 03787
2009-11-13 16:40 c_schmitz Status resolved => closed
2010-10-25 00:17 c_schmitz Category Survey Design => Survey design
2019-11-01 17:25 c_schmitz Category Survey design => Survey editing