Feature: #922 - Show and create cancellations and returns in the backend order view 

See Issue 922

Description 

With the feature toggle cart.orderFulfillment enabled, the order view of the backend module shows the cancellations and returns of the order (see Feature: #916 - Cancellations and returns with lines, Feature: #918 - Create cancellations and returns and change their status and Feature: #920 - Restock products of accepted cancellations and returns):

  • Every cancellation and return with its type, return number, status, products with counts, condition and restock flag, reason, received date, note and the override reason of an overridden veto. The status is changed with its select. An accepted or rejected cancellation or return can not be changed anymore.
  • A form cancels products: a count per product (at most the count still available for a cancellation), a restock flag per product (checked by default, canceled products did not leave the stock), reason and note. A cancellation created in the backend takes effect immediately, it is created as accepted and the shipping status of the order is derived.
  • A form creates a return: a count per product (at most the shipped count which is not in a return yet), a condition and a restock flag per product, the status (requested, received or accepted), return number, reason and note.
  • Products which are not cancelable or not returnable are offered with a hint. If a listener vetoes the creation, the veto reason is shown; with an override reason the cancellation or return is created anyway and both reasons are written to the order history.

The condition and the restock flag of the products are often only known when a return is received, so they can be changed until the cancellation or return is accepted or rejected. The change is written to the order history with the type order_return_products. Other extensions change them with \Extcode\Cart\Domain\Order\Fulfillment\OrderReturnProductChangeService :

$result = $orderReturnProductChangeService->change(
    $orderReturn,
    [
        new OrderReturnProduct(
            orderProductUid: $orderReturnProduct->orderProductUid,
            count: $orderReturnProduct->count,
            isRestocked: true,
            condition: ItemCondition::Used,
            uid: $orderReturnProduct->uid,
        ),
    ],
    fromStatus: $orderReturn->status,
    initiator: 'erp_sync',
);
Copied!

The products are identified by their uid, the counts are kept. The change is refused if the status is not fromStatus anymore or is final.

Impact 

Without the feature toggle nothing changes.