function Update_oldParent_Points($thisstory) { global $DBConn; $psql = 'Update story set Size = (select sum(Size) from (select * from story) as p where p.Parent_Story_ID=' . $thisstory . ') where story.AID =' . $thisstory; mysqli_query($DBConn, $psql); $psql = 'select Iteration_ID from story where story.AID =' . $thisstory; $Res = mysqli_query($DBConn, $psql); $Row = mysqli_fetch_assoc($Res); Update_Iteration_Points($Row['Iteration_ID']); Update_Parent_Status($thisstory); }
$sql .= 'Type="' . $data[7] . '", ' . 'Project_ID="' . $_REQUEST['PID'] . '", ' . 'Status="' . trim($data[8]) . '", ' . 'Size="' . $data[9] . '", ' . 'Blocked="' . $data[10] . '", ' . 'Summary="' . htmlentities($data[11], ENT_QUOTES) . '", ' . 'Col_1="' . htmlentities($data[12], ENT_QUOTES) . '", ' . 'As_A="' . htmlentities($data[13], ENT_QUOTES) . '", ' . 'Col_2="' . htmlentities($data[14], ENT_QUOTES) . '", ' . 'Acceptance="' . htmlentities($data[15], ENT_QUOTES) . '", ' . 'Tags="' . $data[16] . '"'; } $sql .= $whereClause; mysqli_query($DBConn, $sql); if (mysqli_error($DBConn)) { $hasError = true; echo '<br>Error on record ' . $data[0] . ' - ' . $data[8] . ' ' . $data[9] . ' ' . $data[11]; echo '<br>' . mysqli_error($DBConn) . '<br>'; //echo('<br>'.$sql.'<br>'); } else { echo '<br>' . substr($sql_method, 0, 18) . ' ' . $data[0] . ' - ' . $data[8] . ' (' . $data[9] . ') ' . $data[11]; } } } foreach ($iter_id as $value) { Update_Iteration_Points($value); } } } $showForm = false; ?> <center><p><p><form enctype="multipart/form-data" method="post" action="?"> <input type="hidden" name="PID" value="<?php echo $_REQUEST['PID']; ?> "> <input type="hidden" name="IID" value="<?php echo $story_Row['Iteration_ID']; ?> "> <br><input type="submit" name="acceptImport" value="OK">
$asql = 'delete from comment where Story_AID=' . $_REQUEST['id']; $aqry = mysqli_query($DBConn, $asql); $asql = "select upload.Name, upload.Desc, HEX(Name) as HName, upload.Type FROM upload WHERE upload.AID=" . $_REQUEST['id']; $aqry = mysqli_query($DBConn, $asql); while ($aresult = mysqli_fetch_array($aqry)) { if (!mysqli_error($DBConn)) { if (unlink('upload/' . $aresult['HName'] . '.' . $aresult['Type'])) { auditit($_REQUEST['PID'], $_REQUEST['id'], $_SESSION['Email'], 'Deleted uploaded file ', $aresult[HName], $aresult[Desc]); } } } $asql = "DELETE FROM upload WHERE upload.AID=" . $_REQUEST['id']; $aqry = mysqli_query($DBConn, $asql); $showForm = false; $deleted = true; Update_Iteration_Points($_REQUEST['IID']); } } } else { if ($_REQUEST['nodelete']) { $showForm = false; $deleted = false; } } if ($showForm) { $Res = mysqli_query($DBConn, 'SELECT ID, Summary, Size FROM story WHERE AID=' . $_REQUEST['id'] . ' AND Project_ID=' . $_REQUEST['PID']); $Row = mysqli_fetch_assoc($Res); echo '<form method="post" action="?">' . '<p><b>#' . $Row['ID'] . ' - ' . $Row['Summary'] . ' (' . $Row['Size'] . ' pts.)</b><p>' . 'Are you sure you want to delete this story, Its tasks, comments and uploaded files?<P>' . '<input type="hidden" name="id" value="' . $_REQUEST['id'] . '">' . '<input type="hidden" name="PID" value="' . $_REQUEST['PID'] . '">' . '<input type="hidden" name="IID" value="' . $_REQUEST['IID'] . '">' . '<input type="submit" name="delete" value="Yes, Delete">' . ' ' . '<input type="submit" name="nodelete" value="No, Don\'t Delete">' . '</form>'; } else { header('Location:story_List.php?PID=' . $_REQUEST['PID'] . '&IID=' . $_REQUEST['IID']); }
<?php require_once 'include/dbconfig.inc.php'; require_once 'include/common.php'; $user_details = check_user($_SESSION['user_identifier']); if (!$user_details) { exit; } // add it $ssql = 'INSERT INTO story (Project_ID, Release_ID, Iteration_ID, Parent_Story_ID, Created_Date' . ', Status, Epic_Rank, Iteration_Rank, Size, Blocked' . ', Summary, Col_1, As_A, Col_2, Acceptance, Tags, Type, Created_By_ID, ID)' . ' SELECT Project_ID, Release_ID, Iteration_ID, Parent_Story_ID, Created_Date' . ', Status, Epic_Rank, Iteration_Rank, Size, Blocked' . ', CONCAT("(Dup. of #",ID,") ",Summary), Col_1, As_A, Col_2, Acceptance, Tags, Type, ' . '"' . $_SESSION['ID'] . '", (SELECT max(local.ID)+1 from story as local where Project_ID=story.Project_ID)' . ' FROM story WHERE story.AID=' . $_GET['SAID']; //echo '<br>'.$sql; // Add the record mysqli_query($DBConn, $ssql); // Fecth new local ID $sql = 'select ID, AID, Project_ID, Iteration_ID, Summary from story where AID=' . mysqli_insert_id($DBConn); //echo '<br>'.$sql; $res = mysqli_query($DBConn, $sql); $RecRow = mysqli_fetch_assoc($res); $story_Row['ID'] = $RecRow['ID']; Update_Iteration_Points($RecRow['Iteration_ID']); echo 'New story <a title="Edit story #' . $story_Row['ID'] . '" href="story_Edit.php?AID=' . $RecRow['AID'] . '&PID=' . $RecRow['Project_ID'] . '&IID=' . $RecRow['Iteration_ID'] . '">#' . $story_Row['ID'] . '</a> Created'; // and now dupcate the tasks if ($_GET['TASKS'] == 'True') { $sql = 'INSERT INTO task (Story_AID, User_ID, Rank, task.Desc, Done, Expected_Hours, Actual_Hours, Task_Date)' . ' SELECT ' . $RecRow['AID'] . ', 0, Rank, task.Desc, 0, Expected_Hours, 0, Task_Date' . ' FROM task WHERE task.Story_AID=' . $_GET['SAID']; mysqli_query($DBConn, $sql); } auditit($RecRow['Project_ID'], $RecRow['AID'], $_SESSION['Email'], 'Duplicated Story from', $_GET['SAID'], $_GET['SAID'] . '-' . $RecRow['Summary'], 'Story #' . $RecRow['ID']); auditit($RecRow['Project_ID'], $_GET['SAID'], $_SESSION['Email'], 'Duplicated Story to', $_GET['SAID'] . '-' . $RecRow['Summary'], 'Story #' . $RecRow['ID']);
<?php require_once 'include/dbconfig.inc.php'; require_once 'include/common.php'; $user_details = check_user($_SESSION['user_identifier']); if (!$user_details) { exit; } //STAID= status order id for his project. $sql = 'UPDATE story SET story.Status=(select d.Desc from story_status as d where d.Project_ID = (select project_ID from iteration where iteration.ID=' . $_GET['IID'] . ' ) and d.Order=' . $_GET['STAID'] . ') WHERE story.AID=' . $_GET['AID']; mysqli_query($DBConn, $sql); Update_Iteration_Points($_GET['IID']); //this updates bot the parent points as well as the parent status Update_Parent_Points($_GET['AID']); auditit($_GET['PID'], $_GET['AID'], $_SESSION['Email'], 'Update Status', '', $_GET['AID']);