-
Notifications
You must be signed in to change notification settings - Fork 278
N°4032 - On UserRequest, service subcategory no more limited by request_type #786
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
v-dumas
wants to merge
2
commits into
develop
Choose a base branch
from
feature/3246-request_type-computation
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -306,10 +306,9 @@ | |
| <is_null_allowed>true</is_null_allowed> | ||
| </field> | ||
| <field id="servicesubcategory_id" xsi:type="AttributeExternalKey"> | ||
| <filter><![CDATA[SELECT ServiceSubcategory WHERE service_id = :this->service_id AND (ISNULL(:this->request_type) OR request_type = :this->request_type) AND status != 'obsolete']]></filter> | ||
| <filter><![CDATA[SELECT ServiceSubcategory WHERE service_id = :this->service_id AND status != 'obsolete']]></filter> | ||
| <dependencies> | ||
| <attribute id="service_id"/> | ||
| <attribute id="request_type"/> | ||
| </dependencies> | ||
| <sql>servicesubcategory_id</sql> | ||
| <target_class>ServiceSubcategory</target_class> | ||
|
|
@@ -1334,19 +1333,21 @@ | |
| // Compute the priority of the ticket | ||
| $this->Set('priority', $this->ComputePriority()); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As soon as this changes, I would like it to be fully aligned with the recommendation => event based. |
||
|
|
||
| // Compute the request_type if not already defined (by the user) | ||
| $sType = $this->Get('request_type'); | ||
| if (is_null($sType) || ($sType === '')) | ||
| return parent::ComputeValues(); | ||
| }]]></code> | ||
| </method> | ||
| <method id="EvtComputeRequestType"> | ||
| <static>false</static> | ||
| <access>public</access> | ||
| <type>EventListener</type> | ||
| <code><![CDATA[ public function EvtComputeRequestType(?Combodo\iTop\Service\Events\EventData $oEventData = null) | ||
| { | ||
| $iSvcSubcat = $this->Get('servicesubcategory_id'); | ||
| if ($iSvcSubcat != 0) | ||
| { | ||
| $iSvcSubcat = $this->Get('servicesubcategory_id'); | ||
| if ($iSvcSubcat != 0) | ||
| { | ||
| $oSvcSubcat = MetaModel::GetObject(ServiceSubcategory::class, $iSvcSubcat, true, true); | ||
| $this->Set('request_type', $oSvcSubcat->Get('request_type')); | ||
| } | ||
| $oSvcSubcat = MetaModel::GetObject(ServiceSubcategory::class, $iSvcSubcat, true, true); | ||
| $this->Set('request_type', $oSvcSubcat->Get('request_type')); | ||
| } | ||
|
|
||
| return parent::ComputeValues(); | ||
| }]]></code> | ||
| </method> | ||
| <method id="DisplayBareRelations"> | ||
|
|
@@ -1528,6 +1529,13 @@ | |
| }]]></code> | ||
| </method> | ||
| </methods> | ||
| <event_listeners> | ||
| <event_listener id="EVENT_DB_BEFORE_WRITE"> | ||
| <event>EVENT_DB_BEFORE_WRITE</event> | ||
| <callback>EvtComputeRequestType</callback> | ||
| <rank>0</rank> | ||
| </event_listener> | ||
| </event_listeners> | ||
| <presentation> | ||
| <details> | ||
| <items> | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why keep this second explicit dependence (it will be computed anyhow)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To not be able to select
ServiceSubcategoryfrom anotherService. What do you mean with "it will be computed"?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi Hipska, since about 2 or 3 years, the field dependencies are useless when due to a filter. iTop automatically add the dependency on field specified in the filter. But dependency remains useful when due to a PHP computation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So you're saying that in the console selecting a Service, and not having this dependency at subcategory, the refresh of that list will happen anyways because
:this->service_idis used in the filter?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, console and portal