On Order creation form, if the default adjustment field is left empty( or 0), the order creation will fail, because adjustment field doesn't think 0 is a number.

Attached screenshot is probably the same error but on the adjustment field setting page.

"Amount must be a number." is thrown when the default value is 0.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

skyredwang created an issue. See original summary.

skyredwang’s picture

Title: Adjustment field validation fails on integer 0 » Adjustment field shouldn't pass to price/number validation when there is nothing/type selected

Looks like there are two bugs:

1. adjustment field shouldn't pass to price/number validation when there is nothing/type selected
2. It seems #2684713: WSOD if price amount is NULL still exist, when adjustment field amount is left empty, when "apply order adjustment" is chosen, but the amount is empty. Therefore, WSOD.

steveoliver’s picture

skyredwang’s picture

Title: Adjustment field shouldn't pass to price/number validation when there is nothing/type selected » Pricing validation won't pass when the default price number is not set
Component: Order » Price
Status: Closed (duplicate) » Active

I thought

adjustment field shouldn't pass to price/number validation when there is nothing/type selected

But, when I create a new price field, the settings page still throw the same error, so I believe something in #2684713: WSOD if price amount is NULL is still not fixed.

skyredwang’s picture

@steveoliver referenced the '_none' bug in adjustment, this issue is used to track the null bug in Pricing.

bojanz’s picture

Title: Pricing validation won't pass when the default price number is not set » Number validation initially fails for NULL values

Reproduced this. First time it fails and converts NULL to 0, second time it works cause 0 is a value.
This is coming from the commerce_number form element, and it actually prevents us from saving an empty price.

Doing a test run with the fix in https://travis-ci.org/drupalcommerce/commerce/jobs/189036362.

  • bojanz committed e771612 on 8.x-2.x
    Issue #2840539 by skyredwang: Number validation initially fails for NULL...
bojanz’s picture

Status: Active » Fixed

Okay, we now support truly-empty values again.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.