@@ -193,7 +193,7 @@ class Document extends ActiveRecordCommon | |||
} | |||
$prefix = Producer::getConfig('document_' . $classLower . '_prefix'); | |||
$oneDocumentExist = $class::searchOne([], ['orderby' => 'reference DESC']); | |||
$oneDocumentExist = $class::searchOne(['status' => Document::STATUS_VALID] , ['orderby' => 'reference DESC']); | |||
if ($oneDocumentExist) { | |||
$reference = $oneDocumentExist->reference; |