Index: trunk/doc/CHANGES.txt =================================================================== --- trunk/doc/CHANGES.txt (リビジョン 88) +++ trunk/doc/CHANGES.txt (リビジョン 90) @@ -1,3 +1,13 @@ foltia 更新履歴 http://www.dcc-jpl.com/soft/foltia/ + +09.4.30 +listreserve.php: +チケット#7適用。 +http://www.dcc-jpl.com/foltia/ticket/7 +表記ミス修正。 + +foltialib.php: +表記ミス修正。 + 09.1.13: Index: trunk/install/php/listreserve.php =================================================================== --- trunk/install/php/listreserve.php (リビジョン 89) +++ trunk/install/php/listreserve.php (リビジョン 90) @@ -16,4 +16,10 @@ DCC-JPL Japan/foltia project + +History + +2009/5/1 +重複予約検出処理の修正 http://www.dcc-jpl.com/foltia/ticket/7 +パッチ適用 */ @@ -202,14 +208,28 @@ $overlapmaxrows = pg_num_rows($overlap); if ($overlapmaxrows > ($recunits) ){ + + $owtimeline = array(); + for ($rrow = 0; $rrow < $overlapmaxrows ; $rrow++) { - $owrowdata = pg_fetch_row($overlap, $rrow); - $overlappid[] = $owrowdata[9]; + $owrowdata = pg_fetch_array($overlap, $rrow); + $owtimeline[ $owrowdata['startdatetime'] ] = $owtimeline[ $owrowdata['startdatetime'] ] +1; + + $owrend = calcendtime( $owrowdata['startdatetime'], $owrowdata['lengthmin'] ); + $owtimeline[ $owrend ] = $owtimeline[ $owrend ] -1; + //注意: NULL に減算子を適用しても何も起こりませんが、NULL に加算子を 適用すると 1 となります。 } - if (in_array($rowdata[9], $overlappid)) { - $rclass = "overwraped"; + + ksort ( $owtimeline ); + + $owcount = 0; + foreach ( $owtimeline as $key => $val ) { + $owcount += $val; + + if ( $owcount > $recunits ) { + $rclass = "overwraped"; + break; + } + } } - }else{ - $overlappid = ""; - }//end if //外部チューナー録画 @@ -259,14 +279,27 @@ $eoverlapmaxrows = pg_num_rows($eoverlap); if ($eoverlapmaxrows > ($externalinputs) ){ + + $eowtimeline = array(); + for ($erow = 0; $erow < $eoverlapmaxrows ; $erow++) { - $eowrowdata = pg_fetch_row($eoverlap, $erow); - $eoverlappid[] = $eowrowdata[9]; + $eowrowdata = pg_fetch_array($eoverlap, $erow); + $eowtimeline[ $eowrowdata['startdatetime'] ] = $eowtimeline[ $eowrowdata['startdatetime'] ] +1; + + $eowrend = calcendtime( $eowrowdata['startdatetime'], $eowrowdata['lengthmin'] ); + $eowtimeline[ $eowrend ] = $eowtimeline[ $eowrend ] -1; } - - if (in_array($rowdata[9], $eoverlappid)) { - $rclass = "exoverwraped"; + + ksort ( $eowtimeline ); + + $eowcount = 0; + foreach ( $eowtimeline as $key => $val ) { + $eowcount += $val; + + if ( $eowcount > $externalinputs ) { + $rclass = "exoverwraped"; + break; + } } - }else{ - $eoverlappid = ""; + } echo("\n");