/**called from the ChangeTicketPriceCategory transaction*/
static public function changeTicketPriceCategory($trans)
{
+ global $db;
//get ticket
$tick=WTticket::getFromDB($trans->getbarcode());
if($tick===false){
$trans->abortWithError(tr("You do not have access to this category on this event."));
return;
}
+ //make sure there are enough seats left in the category
+ $ticks=WTticket::selectFromDB("eventid=".$db->escapeInt($tick->eventid)." and pricecategoryid=".$db->escapeInt($prc->pricecategoryid));
+ $tcount=0;
+ foreach($ticks as $t)if(($t->status & WTticket::MaskBlock)!=0)$tcount++;
+ if($tcount>=$prc->maxavailable){
+ $trans->abortWithError(tr("No more tickets left in this category."));
+ return;
+ }
+ //TODO: make sure seat allows the category
//change ticket
$tick->pricecategoryid=$prc->pricecategoryid;
$tick->price=$prc->price;