【问题标题】:OroCommerce: Disable order edit by some conditionsOroCommerce:在某些条件下禁用订单编辑
【发布时间】:2021-07-02 19:13:17
【问题描述】:

是否可以在满足某些条件(例如订单状态已发货,但可能是 smtl else)时禁用订单编辑?

或者禁用 LineItems 编辑但允许编辑订单信息?

尝试将此行添加到我当前的活动订单工作流程中,但一无所获:

        entity_restrictions:
            test:
                attribute: entity
                field: customer_notes

尝试将此添加到工作流步骤之一,但又没有

            entity_acl:
                update: false
                delete: false

entity_restrictionsentity_acl 没有在 oro 包的任何 workflow.yml 中使用,那么该功能真的实现了吗?

【问题讨论】:

    标签: orocommerce


    【解决方案1】:

    通过内置功能,您可以使用带有实体限制的工作流引擎,根据条件将某些表单字段设为只读:https://doc.oroinc.com/backend/entities-data-management/workflows/configuration-reference/#entity-restrictions-configuration

    或者创建访问规则隐藏编辑按钮,满足条件时返回编辑页面403码:https://doc.oroinc.com/backend/security/access-rules/#backend-security-bundle-access-rules

    【讨论】:

    • 我没有看到任何与订单相关的工作流程,我可以在其中更改订单编辑条件,我是否遗漏了什么?例如,我了解如何为具有工作流的机会添加限制,但如何为可能在没有工作流引擎的情况下实现的订单添加限制?
    • 您可以为 Order 实体创建自己的工作流
    • 新的工作流程如何影响现有的订单编辑?
    • 通过实体限制,您可以根据条件将现有订单中的部分表单字段编辑为只读。
    • 用 entity_restrictions 行更新了开始帖子,这根本没有帮助,我做错了什么?
    【解决方案2】:

    虽然我没有找到如何像之前建议的那样通过工作流禁用订单编辑,但这里是如何通过操作配置禁用它的工作方式:

    #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']
    

    这用 my_oro_order_edit 替换了订单的 UPDATE 操作,其中允许 UPDATE 的条件已更改 - 因此订单视图页面和订单网格中的编辑按钮将仅针对“未结”订单显示。但是,这仅影响按钮,并且仍然可以通过直接链接打开订单编辑,这应该使用访问规则来禁止

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-12-07
      • 2011-12-05
      • 2012-10-02
      • 2019-06-18
      • 2010-12-27
      • 1970-01-01
      • 2012-10-18
      • 1970-01-01
      相关资源
      最近更新 更多