SiT! Bugs - SiT!
View Issue Details
0001881SiT!taskspublic2013-05-23 15:172013-05-23 15:18
paulvh 
 
normaltweakalways
newopen 
3.67 LTS 
 
0001881: Add and Edit Task form changes
We have been using tasks more this year to manage room setups of computers. We found some things missing from the Add and Edit forms so I have 2 patch files to make changes to the task_add.php and the task_edit.php

--- /root/sit-3.67/task_add.php 2012-08-18 10:40:26.000000000 -0400
+++ task_add.php 2013-05-23 09:39:59.959516003 -0400
@@ -77,6 +77,8 @@ else
             else $duedate = '';
             if (!empty($_POST['startdate'])) $startdate = strtotime($_POST['startdate']);
             else $startdate = '';
+ if (!empty($_POST['enddate'])) $enddate = strtotime($_POST['enddate']);
+ else $enddate = '';
             $completion = clean_int($_POST['completion']);
             $value = clean_float($_POST['value']);
             $distribution = cleanvar($_POST['distribution']);
@@ -105,12 +107,14 @@ else
             {
                 if ($startdate > 0) $startdate = date('Y-m-d',$startdate)." ".$starttime;
                 else $startdate = '';
- if ($duedate > 0) $duedate = date('Y-m-d',$duedate)." ".$duetime;
+ if ($enddate > 0) $enddate = date('Y-m-d',$enddate)." ".$endtime;
+ else $enddate = '';
+ if ($duedate > 0) $duedate = date('Y-m-d',$duedate)." ".$duetime;
                 else $duedate='';
                 if ($startdate < 1 AND $completion > 0) $startdate = date('Y-m-d H:i:s')." ".$starttime;
                 $sql = "INSERT INTO `{$dbTasks}` ";
- $sql .= "(name,description,priority,owner,duedate,startdate,completion,value,distribution,created) ";
- $sql .= "VALUES ('$name','$description','$priority','$taskuser','$duedate','$startdate','$completion','$value','$distribution','".date('Y-m-d H:i:s')."')";
+ $sql .= "(name,description,priority,owner,duedate,startdate,enddate,completion,value,distribution,created) ";
+ $sql .= "VALUES ('$name','$description','$priority','$taskuser','$duedate','$startdate','$enddate','$completion','$value','$distribution','".date('Y-m-d H:i:s')."')";
                 mysql_query($sql);
                 if (mysql_error()) trigger_error(mysql_error(),E_USER_ERROR);
                 if (mysql_affected_rows() < 1) trigger_error("Task insert failed",E_USER_ERROR);
@@ -157,16 +161,6 @@ else
             {
                 echo "<td>".priority_drop_down('priority',1)."</td></tr>";
             }
- echo "<tr><th>{$strStartDate}</th>";
- echo "<td><input type='text' name='startdate' id='startdate' size='10'";
- if ($_SESSION['formdata']['add_task']['startdate'] != '')
- {
- echo "value='{$_SESSION['formdata']['add_task']['startdate']}'";
- }
- echo "/> ";
- echo date_picker('addtask.startdate');
- echo " ".time_dropdown("starttime", date("H:i"));
- echo "</td></tr>";

             echo "<tr><th>{$strDueDate}</th>";
             echo "<td><input type='text' name='duedate' id='duedate' size='10'";
@@ -184,7 +178,26 @@ else
             }
             echo "</td></tr>";

- echo "<tr><th>{$strCompletion}</th>";
+ echo "<tr><th>{$strStartDate}</th>";
+ echo "<td><input type='text' name='startdate' id='startdate' size='10'";
+ if ($_SESSION['formdata']['add_task']['startdate'] != '')
+ {
+ echo "value='{$_SESSION['formdata']['add_task']['startdate']}'";
+ }
+ echo "/> ";
+ echo date_picker('addtask.startdate');
+ if ($_SESSION['formdata']['add_task']['starttime'] != '')
+ {
+ echo " ".time_dropdown("starttime", $_SESSION['formdata']['add_task']['starttime']);
+ }
+ else
+ {
+ echo " ".time_dropdown("starttime");
+ }
+ echo "</td></tr>";
+
+ // If this is a new task we don't have anyting completed
+ /*echo "<tr><th>{$strCompletion}</th>";
             echo "<td><input type='text' name='completion' size='3' maxlength='3'";;
             if ($_SESSION['formdata']['add_task']['completion'] != '')
             {
@@ -194,13 +207,27 @@ else
             {
                 echo "value='0'";
             }
- echo "/>%</td></tr>";
- //FIXME: should this be available?
- /*echo "<tr><th>{$strEndDate}</th>";
- echo "<td><input type='text' name='enddate' id='enddate' size='10' /> ";
+ echo "/>%</td></tr>"; */
+
+ //FIXME: should this be available? Yes it should
+ echo "<tr><th>{$strEndDate}</th>";
+ echo "<td><input type='text' name='enddate' id='enddate' size='10'";
+ if ($_SESSION['formdata']['add_task']['enddate'] != '')
+ {
+ echo "value='{$_SESSION['formdata']['add_task']['enddate']}'";
+ }
+ echo "/> ";
             echo date_picker('addtask.enddate');
- echo " ".time_dropdown("endtime");
- echo "</td></tr>";*/
+ if ($_SESSION['formdata']['add_task']['endtime'] != '')
+ {
+ echo " ".time_dropdown("endtime", $_SESSION['formdata']['add_task']['endtime']);
+ }
+ else
+ {
+ echo " ".time_dropdown("endtime");
+ }
+ echo "</td></tr>";
+
             echo "<tr><th>{$strValue}</th>";
             echo "<td><input type='text' name='value' size='6' maxlength='12'";
             if ($_SESSION['formdata']['add_task']['value'] != '')
No tags attached.
Issue History
2013-05-23 15:17paulvhNew Issue
2013-05-23 15:18paulvhNote Added: 0004829

Notes
(0004829)
paulvh   
2013-05-23 15:18   
--- /root/sit-3.67/task_edit.php 2012-08-18 10:40:26.000000000 -0400
+++ task_edit.php 2013-05-23 09:07:20.431329244 -0400
@@ -309,13 +309,7 @@ switch ($action)
                 }
                 echo "<tr><th>{$strPriority}</th>";
                 echo "<td>".priority_drop_down('priority',$task->priority)."</td></tr>";
- echo "<tr><th>{$strStartDate}</th>";
- echo "<td><input type='text' name='startdate' id='startdate' size='10' value='";
- if ($startdate > 0) echo date('Y-m-d',$startdate);
- echo "' /> ";
- echo date_picker('edittask.startdate');
- echo " ".time_dropdown("starttime", date('H:i',$startdate));
- echo "</td></tr>";
+
                 echo "<tr><th>{$strDueDate}</th>";
                 echo "<td><input type='text' name='duedate' id='duedate' size='10' value='";
                 if ($duedate > 0) echo date('Y-m-d',$duedate);
@@ -323,6 +317,15 @@ switch ($action)
                 echo date_picker('edittask.duedate');
                 echo " ".time_dropdown("duetime", date('H:i',$duedate));
                 echo "</td></tr>";
+
+ echo "<tr><th>{$strStartDate}</th>";
+ echo "<td><input type='text' name='startdate' id='startdate' size='10' value='";
+ if ($startdate > 0) echo date('Y-m-d',$startdate);
+ echo "' /> ";
+ echo date_picker('edittask.startdate');
+ echo " ".time_dropdown("starttime", date('H:i',$startdate));
+ echo "</td></tr>";
+
                 echo "<tr><th>{$strCompletion}</th>";
                 echo "<td><input type='text' name='completion' size='3' maxlength='3' value='{$task->completion}' />%</td></tr>";
                 echo "<tr><th>{$strEndDate}</th>";