diff --git a/inc/formanswer.class.php b/inc/formanswer.class.php index c20488402..cbaf21cbd 100644 --- a/inc/formanswer.class.php +++ b/inc/formanswer.class.php @@ -99,11 +99,11 @@ public static function canView() { public function canViewItem() { global $DB; - // if (Plugin::isPluginActive('advform')) { - // $advFormAnswer = new PluginAdvformFormanswer(); - // $advFormAnswer->getFromDB($this->getID()); - // return $advFormAnswer->canViewItem(); - // } + if (Plugin::isPluginActive('advform')) { + $advFormAnswer = new PluginAdvformFormanswer(); + $advFormAnswer->getFromDB($this->getID()); + return $advFormAnswer->canViewItem(); + } $currentUser = Session::getLoginUserID(); @@ -454,9 +454,11 @@ static function showForForm(PluginFormcreatorForm $form, $params = []) { * Can the current user validate the form ? */ public function canValidate(): bool { - // if (Plugin::isPluginActive('advform')) { - // return PluginAdvformFormAnswer::canValidate($this); - // } + if (Plugin::isPluginActive('advform')) { + $formAnswer = new PluginAdvformFormAnswer(); + $formAnswer->getFromDB($this->getID()); + return $formAnswer->canValidate($this); + } if (!PluginFormcreatorCommon::canValidate()) { return false; @@ -665,7 +667,9 @@ public function showForm($ID, $options = []) { } if (Plugin::isPluginActive('advform')) { - PluginAdvformFormanswerValidation::showValidationStatuses($this); + $formAnswer = PluginFormcreatorCommon::getFormAnswer(); + $formAnswer->getFromDB($this->getID()); + PluginAdvformFormanswerValidation::showValidationStatuses($formAnswer); } $options['canedit'] = true; $options['candel'] = false; @@ -936,7 +940,8 @@ public function getForm(int $formId = null): ?PluginFormcreatorForm { } $formFk = PluginFormcreatorForm::getForeignKeyField(); - $form = PluginFormcreatorForm::getById($formId ?? $this->fields[$formFk]); + $form = PluginFormcreatorCommon::getForm(); + $form->getFromDB($formId ?? $this->fields[$formFk]); if ($form === false) { return null; } @@ -1545,10 +1550,6 @@ private function updateIssue() { public static function getMyLastAnswersAsRequester($limit = 5) { global $DB; - if (Plugin::isPluginActive('advform')) { - return PluginAdvformFormAnswer::getMyLastAnswersAsRequester($limit); - } - $formAnswerTable = self::getTable(); $formTable = PluginFormcreatorForm::getTable(); $request = [