changeset 91:f6b909678e51

fix: CSとBSを合計するとチューナー数以上の重複予約が出来てしまうバグを修正
author Sushi-k <epgrec@park.mda.or.jp>
date Tue, 02 Mar 2010 17:42:30 +0900
parents c29d41d0c945
children e2c37cc736db 80cc05b420af
files Reservation.class.php
diffstat 1 files changed, 7 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/Reservation.class.php	Mon Mar 01 17:46:03 2010 +0900
+++ b/Reservation.class.php	Tue Mar 02 17:42:30 2010 +0900
@@ -78,8 +78,10 @@
 			
 			// √篋膣 = TUNER
 			$tuners = ($crec->type == "GR") ? $settings->gr_tuners : $settings->bs_tuners;
+			$type_str = ($crec->type == "GR") ? "type = 'GR' " : "(type = 'BS' OR type = 'CS') ";
+			
 			$battings = DBRecord::countRecords( RESERVE_TBL, "WHERE complete = '0' ".
-															  "AND type = '".$crec->type."' ".
+															  "AND ".$type_str.
 															  "AND starttime < '".toDatetime($end_time) ."' ".
 															  "AND endtime > '".toDatetime($rec_start)."'"
 			);
@@ -90,11 +92,11 @@
 					// 茹f純茲茯帥鴻
 					// 緇篋膣
 					$nexts = DBRecord::countRecords( RESERVE_TBL, "WHERE complete = '0' ".
-																	"AND type = '".$crec->type."' ".
+																	"AND ".$type_str.
 																	"AND starttime = '".toDatetime($end_time - $settings->former_time)."'");
 					
 					$prevs = DBRecord::countRecords( RESERVE_TBL, "WHERE complete = '0' ".
-																"AND type = '".$crec->type."' ".
+																"AND ".$type_str.
 																"AND endtime = '".$starttime."'"  );
 					
 					// 緇綣ャ若惹違遺札筝茲茹f∞
@@ -111,7 +113,7 @@
 					
 					// 翫牙私膣荀篁
 					$trecs = DBRecord::createRecords(RESERVE_TBL, "WHERE complete = '0' ".
-																		 "AND type = '".$crec->type."' ".
+																		 "AND ".$type_str.
 																		 "AND endtime = '".$starttime."'" );
 					// 翫腟
 					for( $i = 0; $i < count($trecs) ; $i++ ) {
@@ -182,7 +184,7 @@
 			%TITLE%	腟帥ゃ
 			%ST%	紮ユ鐚ex.200907201830)
 			%ET%	腟篋ユ
-			%TYPE%	GR/BS
+			%TYPE%	GR/BS/CS
 			%CH%	c潟
 			%DOW%	ワSun-Mon鐚
 			%DOWJ%	ワ-鐚