<?php require_once('includes/requirelogin.inc.php'); require_once('includes/requirepost.inc.php'); require_once('includes/message.inc.php'); $CMD_TMPL_NAME='reservation.list'; $lctr_id=0+TPOST('lctr_id'); $mb_id=0+TPOST('mb_id'); $st_id=0+TPOST('st_id'); $cancelmsg=TPOST('cancelmsg'); if ($mb_id!=current_mb_id()) { redirect("./"); return; } $timezone_bias_seconds=get_user_time_zone()*60; $cur_time_utc=seconds_to_datetime(); $DBConn->connect(); $DBConn->begin(true); $reservation=db_load_reservation($DBConn,$lctr_id,$st_id,$mb_id); $lecture=db_load_lecture_by_id($DBConn,$lctr_id); $course=db_load_course_by_id($DBConn,$lecture['cs_id']); if (!$reservation || $lecture['lctr_deadline']<$cur_time_utc) { redirect("qx-cmd-reserve.cancel.confirm-lctr_id-".$lctr_id.'-mb_id-'.$mb_id.'-st_id-'.$st_id.".html"); } else { $lecture_cancelled=false; $uh_amount=-$Config->Prices['reservation.cancel.1']; $rsv_id=db_cancel_reservation($DBConn,$lctr_id,$mb_id,$st_id,$mb_id); db_set_reservation_option($DBConn,$rsv_id,array()); if (!db_load_lecture_size($DBConn,$lctr_id)) { db_cancel_lecture($DBConn,$lctr_id,$mb_id); db_delete_lecture_unit_income($DBConn,$lctr_id); $uh_amount+=-$Config->Prices['lecture.cancel.1']; $lecture_cancelled=true; } send_message( $DBConn, 'CANCEL', $mb_id, 'MEMBER', $course['mb_id_owner'], 'COMPERE', $cancelmsg, false, array( 'msg_lctr_id'=>$lctr_id, 'msg_cs_id'=>$lecture['cs_id'], 'msg_st_id'=>$st_id ) ); redirect("qx-cmd-reservation.list-op-cancel.ok.html"); } $DBConn->commit(); ?>