From 17d18eb75fa08110665c61aeaa5b8b8651efae3c Mon Sep 17 00:00:00 2001 From: Guillaume Lajarige Date: Thu, 4 Jan 2018 10:42:37 +0000 Subject: [PATCH] =?UTF-8?q?(Retofit=20from=20trunk)=20N=C2=B01194=20Portal?= =?UTF-8?q?:=20Support=20for=20MUST=5FCHANGE=20flag=20on=20CaseLog=20attri?= =?UTF-8?q?butes=20in=20transitions.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit SVN:2.4[5200] --- .../src/forms/objectformmanager.class.inc.php | 10 ++++--- sources/form/field/caselogfield.class.inc.php | 17 +++++++---- sources/form/field/field.class.inc.php | 29 ++++++++++++++++++- 3 files changed, 46 insertions(+), 10 deletions(-) diff --git a/datamodels/2.x/itop-portal-base/portal/src/forms/objectformmanager.class.inc.php b/datamodels/2.x/itop-portal-base/portal/src/forms/objectformmanager.class.inc.php index 379da9cde9..785958ef57 100644 --- a/datamodels/2.x/itop-portal-base/portal/src/forms/objectformmanager.class.inc.php +++ b/datamodels/2.x/itop-portal-base/portal/src/forms/objectformmanager.class.inc.php @@ -1,6 +1,6 @@ + * @since iTop 2.3.0 */ class ObjectFormManager extends FormManager { @@ -611,13 +612,14 @@ class ObjectFormManager extends FormManager // - Else if it's must change (transition), we force it as not readonly and not hidden elseif (($iFieldFlags & OPT_ATT_MUSTCHANGE) === OPT_ATT_MUSTCHANGE && $this->IsTransitionForm()) { - $oField->SetReadOnly(false); + $oField->SetMustChange(true); + $oField->SetReadOnly(false); $oField->SetHidden(false); } - // - Else if it's must prompt (transition), we force it as not readonly and not hidden + // - Else if it's must prompt (transition), we force it as mustchange, not readonly and not hidden elseif (($iFieldFlags & OPT_ATT_MUSTPROMPT) === OPT_ATT_MUSTPROMPT && $this->IsTransitionForm()) { - $oField->SetReadOnly(false); + $oField->SetReadOnly(false); $oField->SetHidden(false); } // - Else if it wasn't mandatory or already had a value, and it's hidden, we force it as hidden diff --git a/sources/form/field/caselogfield.class.inc.php b/sources/form/field/caselogfield.class.inc.php index c14545d96a..fc0cae63e4 100644 --- a/sources/form/field/caselogfield.class.inc.php +++ b/sources/form/field/caselogfield.class.inc.php @@ -1,6 +1,6 @@ + * @since iTop 2.3.0 */ class CaseLogField extends TextAreaField { protected $aEntries; + /** + * @param bool $bMustChange + * @return $this + */ + public function SetMustChange($bMustChange) + { + $this->SetMandatory($bMustChange); + return $this; + } + /** * * @return array diff --git a/sources/form/field/field.class.inc.php b/sources/form/field/field.class.inc.php index 417175e595..58f61044a9 100644 --- a/sources/form/field/field.class.inc.php +++ b/sources/form/field/field.class.inc.php @@ -1,6 +1,6 @@ + * @since iTop 2.3.0 */ abstract class Field { @@ -134,6 +135,18 @@ abstract class Field return $this->bReadOnly; } + /** + * Note: This not implemented yet! Just a pre-conception for CaseLogField + * + * @todo Implement + * @return boolean + */ + public function GetMustChange() + { + // TODO + return false; + } + /** * * @return boolean @@ -272,6 +285,20 @@ abstract class Field return $this; } + /** + * Sets if the field is must change or not. + * Note: This not implemented yet! Just a pre-conception for CaseLogField + * + * @todo Implement + * @param boolean $bMustChange + * @return \Combodo\iTop\Form\Field\Field + */ + public function SetMustChange($bMustChange) + { + // TODO. + return $this; + } + /** * * @param $sDisplayMode