OroCommerce: Disable order edit by some conditions - orocommerce

Is it possible to disable order editing when some conditions (like order status is shipped, but may be smtl else) are met?
Or disable LineItems editing but allow to edit order info?
Tried to add this lines to my current active order workflow and got nothing:
entity_restrictions:
test:
attribute: entity
field: customer_notes
tried to add this to one of workflow steps but again nothig
entity_acl:
update: false
delete: false
entity_restrictions and entity_acl are not used in any workflow.yml of oro bundles so is that functionality really implemented?

From the built-in features, you can use the workflow engine with the entity restrictions to make some form fields read-only based on conditions: https://doc.oroinc.com/backend/entities-data-management/workflows/configuration-reference/#entity-restrictions-configuration
Or create an access rule to hide the editing button and return 403 code for the editing page when conditions are met: https://doc.oroinc.com/backend/security/access-rules/#backend-security-bundle-access-rules

While I didnt found how to disable order edit via workflow like is was suggested previously here is the working way how to disable that via action configuration:
#MyBundle/Resources/config/oro/actions.yml
operations:
my_oro_order_edit
extends: UPDATE # this is for keeping all other properties same as in default
substitute_operation: UPDATE # replace UPDATE operation with current one
entities: ['Oro\Bundle\OrderBundle\Entity\Order'] # replacement will occur only if this operation will be matched by entity
for_all_entities: false
replace:
- preconditions
preconditions:
'#equal': [$internalStatus.id, 'open']
This substitutes UPDATE operation for order with my_oro_order_edit where conditions to allow UPDATE are changed - so edit button in order view page and orders grid will appear only for 'Open' orders. However this affects only buttons and its still possible to open order edit via direct link which should be prohibited using access rules

Related

yadcf externally triggered filters 'shut off' the actual filtering

I am trying to set my yadcf filters up so they can be triggered from a call (link) from another page. I have an angular single page application that has three tabs on it. If a user clicks a link on lets say the first tab, they will go to another tab (separate table) that contains detailed information relevant to the link they click. (e.g. They are on a row in a table that deals with Apple Mac Pro computers. They see that there are 20 skus currently in the system. They click the number 20 and they go to a lower tab (different table) that contains all the information for those skus). There is no server call in the middle. All the data is loaded in all the tables when the application loads up. So, they are simply clicking a link that applies a filter to the detail table.
yadcf can do this through externally_triggered filters. However, when I set 'externally_triggered': true, it stops the actual filters from working on the details table. (In other words, I can no longer go to that table and manually adjust the filters.)
Does anyone know a way around this issue?
It appears the externally_triggered: true switch does not need to be turned on to use yadcf.exFilterColumn() method. I do not understand when it does need to be turned on, but I am able to call the exFilterColumn method and pass it the options needed to 'prefilter' the table while still retaining the ability to filter the table manually.
externally_triggered and yadcf.exFilterColumn are not related in any way, indeed when yadcf.exFilterColumn is used filters behave a bit differently - they are not filtering on change/keyup/etc , but rather only when the uadcf.exFilterExternallyTriggered function is called (its on purpose and all is explained in the docs)
Here is the relevant text from the docs of the externally_triggered, here it is:
* externally_triggered
Required: false
Type: boolean
Default value: false
Description: Filters will filter only when yadcf.exFilterExternallyTriggered(table_arg) is called
Special notes: Useful when you want to build some form with filters and you want to trigger the filter when that form
"submit" button is clicked (instead of filtering per filter input change)
Here is the showcase page

Filter lookup inside a Dialog- CRM 2015 Online

How can we filter a lookup that is in a page of the dialog process.
E.g. I have a lookup to "incident" on Prompt and Response, I would like to filter it based on the value of a field in incident entity.
I tried:
Creating new views, also setting it as default.
addPreSearch and addCustomFilter on the field on the form(Not sure how to use these scripts inside the Dialog)
Any Ideas ?
Thanks you
Unfortunately this is not possible.
As an alternative you could consider adding a query to the dialog and a page with a prompt having an Option Set (picklist) response type.

Custom workflow rule to set default comment visibility

I am trying to add a workflow rule in YouTrack, which sets the visibility of newly posted comments that aren't made by a specific user.
Here's what I've tried:
rule set comment visibility to developers
when comments.added.last.author.login != "special" {
comments.last.permittedGroup = {group: Developers};
}
This works, in that all newly added comments that are not made by the special user are set as visible only to Developers. The problem is that this rule also prevents the visibility from being overridden; the visibility always reverts back to "Developers", after it is changed manually via the UI.
Obviously the rule in its current form is pretty simple and I guess (hope) there's a way to isolate the creation of a comment, rather than any update to it (which I guess is what it's currently catching).
Is there any way to only have this rule apply to newly created comments, rather than to any that have been updated?
The trick here is that YouTrack Workflow Language supports null-safety. When you add a comment, comments.added.last contains the comment, and a rule works as expected. When you edit something else, comments.added.last is null, thus comments.added.last.author.login is also null, and null != "special", indeed.
What you need is to check that there are newly created comments is this change, e.g.
when comments.added.isNotEmpty && comments.added.last.author.login != "special" {
comments.last.permittedGroup = {group: Developers};
}

Using Rally.ui.AddNew with details

I've created a Rally.ui.AddNew button to add a new release.
If the user hits "Add with Details" (which is the only active button for releases, you can't add a release without details) I would like certain fields to be set by default when the dialog is opened.
For example, I would like the "Create matching Releases in all child projects" checkbox to be set (if it exists), and I'd like to put a default note in the "Notes" area.
How do I do that? It does not look like the listeners "beforecreate" or "create" are called if the details dialog comes up.
Ideally I'd also like a chance to check these items again with another listener just before the item is created. Do these listeners exist?
The Rally standard editor likely provides only limited capabilities for defaulting field values when instantiated. As an indication, AppSDK1 had the rally.sdk.util.Navigation.popupCreatePage() method, which would accept an object with default values, for example:
// Open Defect editor with Defect default-associated to User Story with OID 12345
rally.sdk.util.Navigation.popupCreatePage("defect", {requirementOid: 12345});
The default key/value pairs that this method accepts were not well-documented. One of Rally's UI Engineers provided me with this list at one time:
rally.sdk.util.Navigation.popupCreatePage defaults keys
User Story:
defaultName
rank
iteration
release
parent
dpyOid {dependency}
Defect:
defaultName
defectSuiteOid {Defect Suites}
testCaseResult
testCase
requirement
iteration
Defect Suite:
defaultName
rank
iteration
Portfolio Item:
defaultName
rank
parent
Task:
workProduct
Test Case:
testfolderOid {Test Folder}
artifactOid {Artifact}
Test Set:
iteration
release
While the above list may not be exhaustive (or even completely accurate anymore), it suggests that the allowed defaults for the standard Rally Editor may not include the "Create matching Releases in all child projects" checkbox or the Notes field.
Nonetheless, it's not immediately apparent to me that there is any method or config for AppSDK2's Rally.ui.AddNew that is an analog in functionality to AppSDK1's rally.sdk.util.Navigation.popupCreatePage() ability to setup default values into the resulting Editor window. Hopefully one of Rally's UI Engineers may have better information to add to this question.
Unfortunately for now not all the built-in fields are defaultable (see Mark W's answer above for the list of pre-fillable fields). Any custom fields are though. You'll want to check out the beforeeditorshow event. You can modify the params there.
addNewComponent.on('beforeeditorshow', function(addNew, params) {
params.defaultName = 'foo';
params.c_MyField = 'bar';
});
Note that if you would just like to create or edit objects you can directly call the methods on Rally.nav.Manager.

Content Organizer Rule Creation Issue

I am using the Content Organizer feature to move documents of a specific content type into a specific folder in a document library in the same site. I created a content organizaer rule with a property setting that uses the property testcolumn. Testcolumn is a site column defined as a lookup to column on a custom List, testlist, and then added to a site content type. The items in this list are displayed in the Value dropdown list and I can select the specific value I want to use for this rule.
The problem is that I can create and save rules provided that there are no more than 19 items in the testlist list. When I have 20 items in the testlist, it looks like the rule was saved by the UI. If I open the rule and go to edit it, the Value for the testcolumn property is (None). If I look at the item in powershell, the Value property is equal to '0' and not the ID of the item I saved in the UI. If I delete a record in the testlist so that the total number of items drops below 20, I can save the rule without issue. I have tried different combinaitions of items in the list in case it was a text issue, but when I have 20 items or more in the list, the rule is not saved.
I have looked at the ULS logs and it states the "Routing Engine: UpdateRule() has successfully updated the rule, rule.Name=TestRule1" when I save the rule.
Thanks for your help.
The answer is partially listed here. Looks like the page renders the control differently if the number of items is 20 or greater. The content organizer rule creation page does not handle this change and does not show any error when saving the information.
I was able to get around this limitation in the UI by adding the rules through code during my feature creation event. A link to creating rules through code is here.