N°3366 - Multiple target state on approbal-extended #7
Conversation
|
Sounds interesting, does that mean it could be used to have a ruleset for In your example I see it went from |
|
Yes, this is the target. |
|
Okay, so the transitions from starting state towards ending state should be named exactly |
|
There are a lot of logs, because the code is not finished yet. I still have to do a lot of tests to validate this code. To not forget what I did I have already created the PR. I will have time in August to finish it. |
|
Sure, I gave suggestions to apply correct line indentations and log debug messages as actual debug, not error ;) |
|
Support PRs review:
Good :
Sounds nice! Will take a closer look. |
Co-authored-by: Thomas Casteleyn <thomas.casteleyn@me.com>
Co-authored-by: Molkobain <lajarige.guillaume@free.fr>
Co-authored-by: Molkobain <lajarige.guillaume@free.fr>
Hipska
left a comment
There was a problem hiding this comment.
Indentations sometimes still not correct. (Is your IDE correctly configured?)
Also, what with users that already have customised their config? Shouldn't there be a migration method during iTop Setup? Currently the old config is ignored and reverted to default.
Totally, the config migration was asked during the support PRs review:
|
Co-authored-by: Thomas Casteleyn <thomas.casteleyn@me.com>
Hipska
left a comment
There was a problem hiding this comment.
Thanks, the code looks much more readable now. Some minor remarks:
| // Replacing old conf parameters value to indicate that it is obsolete | ||
| $aParamsToRemove = array('target_states', 'bypass_profiles', 'reuse_previous_answers'); | ||
| foreach($aParamsToRemove as $sParamToRemove) | ||
| { | ||
| $sParamCurrentValue = $oConfiguration->GetModuleSetting('combodo-approval-extended', $sParamToRemove, null); | ||
| if(!empty($sParamCurrentValue)) | ||
| { | ||
| $oConfiguration->SetModuleSetting('combodo-approval-extended', $sParamToRemove, 'No longer used, you can remove this parameter.'); | ||
| } | ||
| } |
There was a problem hiding this comment.
I would remove this section, since you said this: https://github.com/Combodo/combodo-approval-extended/pull/7/files#r1763440755
| $newConfiguration = [ | ||
| 'UserRequest' => [ | ||
| 'target_states' => [$oConfiguration->GetModuleSetting('combodo-approval-extended', 'target_states', null) ], | ||
| 'bypass_profiles' =>$oConfiguration->GetModuleSetting('combodo-approval-extended', 'bypass_profiles', 'Service Manager') , | ||
| 'reuse_previous_answers' => $oConfiguration->GetModuleSetting('combodo-approval-extended', 'reuse_previous_answers', true) , | ||
| ] | ||
| ]; |
There was a problem hiding this comment.
Still some indentation problem, a typo and to keep backward compatibility, the admin profile should also be included when migrating.
| $newConfiguration = [ | |
| 'UserRequest' => [ | |
| 'target_states' => [$oConfiguration->GetModuleSetting('combodo-approval-extended', 'target_states', null) ], | |
| 'bypass_profiles' =>$oConfiguration->GetModuleSetting('combodo-approval-extended', 'bypass_profiles', 'Service Manager') , | |
| 'reuse_previous_answers' => $oConfiguration->GetModuleSetting('combodo-approval-extended', 'reuse_previous_answers', true) , | |
| ] | |
| ]; | |
| $newConfiguration = [ | |
| 'UserRequest' => [ | |
| 'target_states' => [$oConfiguration->GetModuleSetting('combodo-approval-extended', 'target_state', 'new')], | |
| 'bypass_profiles' => $oConfiguration->GetModuleSetting('combodo-approval-extended', 'bypass_profiles', 'Administrator, Service Manager'), | |
| 'reuse_previous_answers' => $oConfiguration->GetModuleSetting('combodo-approval-extended', 'reuse_previous_answers', true), | |
| ] | |
| ]; |
| $aAllowedClasses = MetaModel::GetConfig()->GetModuleSetting('combodo-approval-extended', 'targets', ApprovalConfiguration::DEFAULT_TARGET); | ||
| if (array_key_exists(get_class($oObject), $aAllowedClasses) === false) { |
There was a problem hiding this comment.
It would make more sense later in the code when this var is named differently..
| $aAllowedClasses = MetaModel::GetConfig()->GetModuleSetting('combodo-approval-extended', 'targets', ApprovalConfiguration::DEFAULT_TARGET); | |
| if (array_key_exists(get_class($oObject), $aAllowedClasses) === false) { | |
| $aTargets = MetaModel::GetConfig()->GetModuleSetting('combodo-approval-extended', 'targets', ApprovalConfiguration::DEFAULT_TARGET); | |
| if (array_key_exists(get_class($oObject), $aTargets) === false) { |
need change in approval base (branche feature/3366-Add_status_informations_on_approval )
Allows you to configure which classes are affected by the approval and from which statuses. Multiple starting statuses are allowed for a class.
new configuration for this module:
You can configure different triggers to send different messages for approval:

Different approval stages are visible on the object in the Approval tab with the starting and ending status (thanks to the functionality implemented in the approval-base)
