/** * Überprüft ob alle Unteraufgaben erfüllt sind. * @param type $id * @return boolean */ function AllSubTasksDone($id) { require 'config.php'; $sql = "SELECT * FROM tasks WHERE parent = " . $id; $result = mysqli_query($con, $sql); while ($row = mysqli_fetch_array($result)) { if ($row['taskstatus'] != 3) { return FALSE; } if (TaskHasChilds($row['taskid'])) { AllSubTasksDone($row['taskid']); } } return TRUE; }
} } if (isset($_POST['edittask'])) { $statusid = mysqli_real_escape_string($con, $_POST['statusid']); $taskid = mysqli_real_escape_string($con, $_POST['taskid']); $projectid = getTaskInfobyID($taskid, 'projectid'); $projectmanagermail = getUserInfo(getProjectInfoByID(getTaskInfobyID($taskid, 'projectid'), 'userid'), 'email'); $projectmanagerid = getProjectInfoByID(getTaskInfobyID($taskid, 'projectid'), 'userid'); $sql = "UPDATE `tasks` SET taskstatus = '" . $statusid . "', `lastchange`=CURRENT_TIMESTAMP WHERE taskid ='" . $taskid . "'"; $history = "INSERT INTO `{$db_data}`.`statushistory` (`taskid`, `userid`, `statusid`, `timestamp`) VALUES ('" . $taskid . "', '" . $_SESSION['userid'] . "', '" . $statusid . "', CURRENT_TIMESTAMP);"; mysqli_query($con, $history); if (mysqli_query($con, $sql)) { if (IsChild($taskid) && AllSubTasksDone($taskid) && $statusid == 3) { $updateparent = "UPDATE `tasks` SET taskstatus = '3' WHERE taskid ='" . getTaskInfobyID($taskid, 'parent') . "'"; mysqli_query($con, $updateparent); } elseif (IsChild($taskid) && AllSubTasksDone($taskid) && $statusid != 3) { $updateparent = "UPDATE `tasks` SET taskstatus = '0' WHERE taskid ='" . getTaskInfobyID($taskid, 'parent') . "'"; mysqli_query($con, $updateparent); } if (getProjectStatusInPercent(getTaskInfobyID($taskid, 'projectid')) == 100) { $body = "Hallo " . getUserFullName($projectmanagerid) . ",\n\n"; $body .= "Dies ist eine automatische E-Mail um Ihnen mitzuteilen, dass die letzte Aufgabe in \"" . getProjectInfoByID($projectid, 'projectname') . "\" erledigt wurde."; smtpmailer($projectmanagermail, 'Projekt: ' . getProjectInfoByID($projectid, 'projectname'), $body); } if (getTaskInfobyID($taskid, 'creator') != getTaskInfobyID($taskid, 'userid') && $statusid == 3) { $creator = getTaskInfobyID($taskid, 'creator'); $body = "Hallo " . getUserFullName($creator) . ",\n"; $body .= "Die Aufgabe (" . getTaskInfobyID($taskid, 'taskname') . "), die du " . getUserFullName(getTaskInfobyID($taskid, 'userid')) . " zugewiesen hast wurde erledigt."; smtpmailer(getUserInfo($creator, 'email'), 'Aufgabe: ' . getTaskInfobyID($taskid, 'taskname'), $body); } header("Location: " . $_SERVER['HTTP_REFERER']);
<div class="modal-content"> <form method="POST"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal">×</button> <h4 class="modal-title"><?php echo $message['deletetask']; ?> </h4> </div> <div class="modal-body"> <p><?php $message['deletequestiontask']; ?> </p> <?php if (!AllSubTasksDone($_GET['id'])) { echo "<p>" . $message['deletequestionopentask'] . "</p>"; } ?> </div> <div class="modal-footer"> <input type="hidden" name="deleteid" value="<?php echo $_GET['id']; ?> "> <button type="submit" name="delete" class="btn btn-danger"><?php echo $message['delete']; ?> </button> <button type="button" class="btn btn-default" data-dismiss="modal"><?php echo $message['cancel'];