Don't let admin remove scheduled events if they have teams registered

This commit is contained in:
james 2010-06-16 17:09:42 +00:00
parent dd230b2cdf
commit bbf46aa47f

View File

@ -155,10 +155,15 @@
exit;
}
else if($_GET['action']=="deleteevent") {
//FIXME: dont let it delete an event that is already in use!
//FIXME: and if we do, delete everything that its been linked to!
$id=intval($_POST['id']);
mysql_query("DELETE FROM schedule WHERE conferences_id='{$conference['id']}' AND id='{$id}'");
$q=mysql_query("SELECT * FROM schedule_registrations WHERE schedule_id='{$id}' AND conferences_id='{$conference['id']}'");
if(mysql_num_rows($q)) {
error_("Cannot remove an event that has teams registered for it. Remove the teams first");
}
else {
mysql_query("DELETE FROM schedule WHERE conferences_id='{$conference['id']}' AND id='{$id}'");
happy_("Event successfully removed from the schedule");
}
exit;
}
else {
@ -289,7 +294,7 @@
function deleteEvent(event,id) {
event.stopPropagation();
if(confirmClick('Are you sure you want to delete this event from the schedule?')) {
if(confirmClick('Are you sure you want to remove this event from the schedule?')) {
$("#debug").load('schedule.php?action=deleteevent',{id:id},function() {
changeDate();
});