getApplication(); $application->moderator_comment = null; $application->approver_id = null; $application->approved_at = null; $application->sent_at = time(); $application->save(false, ['sent_at', 'moderator_comment', 'approver_id', 'approved_at']); if ($application->sendAllApplicationTo1C()) { $comment = $application->moderator_comment; Yii::$app->notifier->notifyAboutApplyApplication($application->user_id, $comment); $application = DraftsManager::createArchivePoint( $application, DraftsManager::REASON_APPROVED, IDraftable::DRAFT_STATUS_APPROVED ); DraftsManager::clearOldSendings($application, Yii::$app->user->identity, DraftsManager::REASON_APPROVED); DraftsManager::clearOldModerations($application, Yii::$app->user->identity, DraftsManager::REASON_APPROVED); DraftsManager::removeOldApproved($application, Yii::$app->user->identity, DraftsManager::REASON_APPROVED); $application->type->toggleResubmitPermissions($application->user, false); return true; } else { DraftsManager::createArchivePoint( $application, DraftsManager::REASON_REJECTED_BY_1C, $application->draft_status ); return false; } } }