Sha256: 81e1b4ef4ce1d4c3742b1099a98dd37e1f16ce5c6d1ad5358e63d15ff5191e9e

Contents?: true

Size: 935 Bytes

Versions: 66

Compression:

Stored size: 935 Bytes

Contents

# frozen_string_literal: true

module Spree
  module AdjustmentSource
    def deals_with_adjustments_for_deleted_source
      Spree::Deprecation.warn "AdjustmentSource#deals_with_adjustments_for_deleted_source is deprecated. Please use AdjustmentSource#remove_adjustments_from_incomplete_orders instead."

      remove_adjustments_from_incomplete_orders

      # The following is deprecated. As source_type without a source_id isn't
      # much better than a source_id that doesn't exist.  In Solidus itself the
      # relevant classes use `acts_as_paranoid` so it is useful to keep the
      # source_id around.
      adjustments.
        joins(:order).
        merge(Spree::Order.complete).
        update_all(source_id: nil, updated_at: Time.current)
    end

    def remove_adjustments_from_incomplete_orders
      adjustments.
        joins(:order).
        merge(Spree::Order.incomplete).
        destroy_all
    end
  end
end

Version data entries

66 entries across 66 versions & 2 rubygems

Version Path
solidus_core-2.11.17 app/models/concerns/spree/adjustment_source.rb
solidus_core-2.11.16 app/models/concerns/spree/adjustment_source.rb
solidus_core-2.11.15 app/models/concerns/spree/adjustment_source.rb
solidus_core-2.11.14 app/models/concerns/spree/adjustment_source.rb
solidus_core-2.11.13 app/models/concerns/spree/adjustment_source.rb
solidus_core-2.11.12 app/models/concerns/spree/adjustment_source.rb
solidus_core-2.11.11 app/models/concerns/spree/adjustment_source.rb
solidus_core-2.10.5 app/models/concerns/spree/adjustment_source.rb
solidus_core-2.11.10 app/models/concerns/spree/adjustment_source.rb
solidus_core-2.11.9 app/models/concerns/spree/adjustment_source.rb
solidus_core-2.11.8 app/models/concerns/spree/adjustment_source.rb
solidus_core-2.11.7 app/models/concerns/spree/adjustment_source.rb
solidus_core-2.11.6 app/models/concerns/spree/adjustment_source.rb
solidus_core-2.11.5 app/models/concerns/spree/adjustment_source.rb
solidus_core-2.11.4 app/models/concerns/spree/adjustment_source.rb
solidus_core-2.11.3 app/models/concerns/spree/adjustment_source.rb
solidus_core-2.11.2 app/models/concerns/spree/adjustment_source.rb
solidus_core-2.11.1 app/models/concerns/spree/adjustment_source.rb
solidus_core-2.10.3 app/models/concerns/spree/adjustment_source.rb
solidus_core-2.11.0 app/models/concerns/spree/adjustment_source.rb