app/models/item.rb
# For items for which the ArchivesSpace top container no longer exists
#   due to re-processing
For items for which the ArchivesSpace top container no longer exists
due to re-processing
For items for which the ArchivesSpace top container no longer exists due to re - processing
def mark_as_obsolete
    if source == 'archivesspace'
      replacement_items = []
      item_orders.each do |io|
        return_items = io.update_archivesspace_item
        replacement_items += return_items
      end
      eligible_for_obsolete = !replacement_items.include?(self)
    else
      raise CircaExceptions::BadRequest,
        "The item could not be marked as obsolete this only applies to items created from ArchivesSpace records."
    end
    puts eligible_for_obsolete ? "Item is eligible to be made obsolete" :
        "Item is NOT eligible to be made obsolete"
    if eligible_for_obsolete
      update_columns(current_location_id: nil, permanent_location_id: nil, obsolete: true)
      item_orders.each do |io|
        io.update_columns(archivesspace_uri: nil, active: false)
      end
      update_index
    else
      raise CircaExceptions::BadRequest,
        "The item could not be marked as obsolete because one or more of the
        ArchivesSpace URIs associated with it still return a record with
        container information matching that of the item."
    end
  end
def mark_as_obsolete if source == 'archivesspace' replacement_items = [ ] item_orders . each do | io | return_items = io . update_archivesspace_item replacement_items += return_items end eligible_for_obsolete = ! replacement_items . include? ( self ) else raise CircaExceptions :: BadRequest , "The item could not be marked as obsolete this only applies to items created from ArchivesSpace records." end puts eligible_for_obsolete ? "Item is eligible to be made obsolete" : "Item is NOT eligible to be made obsolete" if eligible_for_obsolete update_columns ( current_location_id : nil , permanent_location_id : nil , obsolete : true ) item_orders . each do | io | io . update_columns ( archivesspace_uri : nil , active : false ) end update_index else raise CircaExceptions :: BadRequest , "The item could not be marked as obsolete because one or more of the
        ArchivesSpace URIs associated with it still return a record with
        container information matching that of the item." end end
For items for which the ArchivesSpace top container no longer exists
due to re-processing
For items for which the ArchivesSpace top container no longer exists due to re - processing