add validation of history line which 'se chevauchent'

This commit is contained in:
2013-12-01 20:02:18 +01:00
parent c9204e32d8
commit 82f1aeee19
2 changed files with 13 additions and 1 deletions

View File

@@ -626,6 +626,7 @@ ou une valeur vide lorsque la donnée nest pas connue*/
const ERROR_OPENING_IS_INSIDE_CLOSING = 1;
const ERROR_OPENING_NOT_CLOSED_IS_BEFORE_NEW_LINE = 2;
const ERROR_OPENING_NOT_CLOSE_IS_INSIDE_CLOSED_HISTORY_LINE = 3;
const ERROR_OPENING_IS_BEFORE_OTHER_LINE_AND_CLOSED_IS_AFTER_THIS_LINE = 4;
public function checkHistoryIsNotCovering() {
@@ -657,6 +658,17 @@ ou une valeur vide lorsque la donnée nest pas connue*/
);
}
if ($history->getDateOpening() < $against->getDateOpening()
&& $history->getDateClosing() > $against->getDateClosing()) {
// the history date opening is inside another opening line
return array(
'result' => self::ERROR_OPENING_IS_BEFORE_OTHER_LINE_AND_CLOSED_IS_AFTER_THIS_LINE,
'dateOpening' => $against->getDateOpening(),
'dateClosing' => $against->getDateClosing(),
'date' => $history->getDateOpening()
);
}
//if we have an aopening later...
if ($history->getDateOpening() < $against->getDateClosing()) {
return array( 'result' => self::ERROR_OPENING_NOT_CLOSED_IS_BEFORE_NEW_LINE,