<?php require_once('includes/requirecompere.inc.php'); require_once('includes/requirepost.inc.php'); $plc_id=0+TPOST('plc_id'); $mb_id=current_mb_id(); $DBConn->connect(); if (TPOST('add')) { $number_of_seats=TPOST('numbertoadd'); $DBConn->begin(true); $s_count=db_count_seat($DBConn,$mb_id); $number_of_seats=min($number_of_seats,get_compere_limit($DBConn,$mb_id,'seat.count')-$s_count); if ($number_of_seats>=1) db_add_seats_at_place($DBConn,$plc_id,$number_of_seats); $DBConn->commit(); redirect("qx-cmd-place.seats-plc_id-{$plc_id}.html"); } else if (TPOST('delete')) { $st_ids=TPOST('st_ids'); $DBConn->begin(true); $seat_summaries=db_count_seats_reservation($DBConn,$st_ids); if (count_true_assignments($seat_summaries,'count')==0) { $seats=db_load_seats($DBConn,$st_ids); db_delete_seats($DBConn,$st_ids); redirect("qx-cmd-place.seats-plc_id-{$plc_id}.html"); } else { $undeletable_st_ids=array_projection($seat_summaries,'st_id'); redirect("qx-cmd-place.seats-plc_id-$plc_id-error-deleteinuse-st_ids-".urlencode(implode(',',$undeletable_st_ids)).".html"); } $DBConn->commit(); } ?>