(Retofit from trunk) N°1194 Portal: Support for MUST_CHANGE flag on CaseLog attributes in transitions.

SVN:2.4[5200]
This commit is contained in:
Guillaume Lajarige
2018-01-04 10:42:37 +00:00
parent a9a6460747
commit 17d18eb75f
3 changed files with 46 additions and 10 deletions

View File

@@ -1,6 +1,6 @@
<?php <?php
// Copyright (C) 2010-2017 Combodo SARL // Copyright (C) 2010-2018Combodo SARL
// //
// This file is part of iTop. // This file is part of iTop.
// //
@@ -49,6 +49,7 @@ use \Combodo\iTop\Portal\Helper\ApplicationHelper;
* Description of objectformmanager * Description of objectformmanager
* *
* @author Guillaume Lajarige <guillaume.lajarige@combodo.com> * @author Guillaume Lajarige <guillaume.lajarige@combodo.com>
* @since iTop 2.3.0
*/ */
class ObjectFormManager extends FormManager 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 // - 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()) elseif (($iFieldFlags & OPT_ATT_MUSTCHANGE) === OPT_ATT_MUSTCHANGE && $this->IsTransitionForm())
{ {
$oField->SetReadOnly(false); $oField->SetMustChange(true);
$oField->SetReadOnly(false);
$oField->SetHidden(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()) elseif (($iFieldFlags & OPT_ATT_MUSTPROMPT) === OPT_ATT_MUSTPROMPT && $this->IsTransitionForm())
{ {
$oField->SetReadOnly(false); $oField->SetReadOnly(false);
$oField->SetHidden(false); $oField->SetHidden(false);
} }
// - Else if it wasn't mandatory or already had a value, and it's hidden, we force it as hidden // - Else if it wasn't mandatory or already had a value, and it's hidden, we force it as hidden

View File

@@ -1,6 +1,6 @@
<?php <?php
// Copyright (C) 2010-2016 Combodo SARL // Copyright (C) 2010-2018 Combodo SARL
// //
// This file is part of iTop. // This file is part of iTop.
// //
@@ -19,19 +19,26 @@
namespace Combodo\iTop\Form\Field; namespace Combodo\iTop\Form\Field;
use \Closure;
use \DBObject;
use \Combodo\iTop\Form\Field\TextAreaField;
/** /**
* Description of CaseLogField * Description of CaseLogField
* *
* @author Guillaume Lajarige <guillaume.lajarige@combodo.com> * @author Guillaume Lajarige <guillaume.lajarige@combodo.com>
* @since iTop 2.3.0
*/ */
class CaseLogField extends TextAreaField class CaseLogField extends TextAreaField
{ {
protected $aEntries; protected $aEntries;
/**
* @param bool $bMustChange
* @return $this
*/
public function SetMustChange($bMustChange)
{
$this->SetMandatory($bMustChange);
return $this;
}
/** /**
* *
* @return array * @return array

View File

@@ -1,6 +1,6 @@
<?php <?php
// Copyright (C) 2010-2017 Combodo SARL // Copyright (C) 2010-2018 Combodo SARL
// //
// This file is part of iTop. // This file is part of iTop.
// //
@@ -27,6 +27,7 @@ use \Combodo\iTop\Form\Validator\MandatoryValidator;
* Description of Field * Description of Field
* *
* @author Guillaume Lajarige <guillaume.lajarige@combodo.com> * @author Guillaume Lajarige <guillaume.lajarige@combodo.com>
* @since iTop 2.3.0
*/ */
abstract class Field abstract class Field
{ {
@@ -134,6 +135,18 @@ abstract class Field
return $this->bReadOnly; 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 * @return boolean
@@ -272,6 +285,20 @@ abstract class Field
return $this; 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 * @param $sDisplayMode