lib/catissue/domain/specimen.rb
def add_defaults_local
      super
      self.specimen_collection_group ||= parent.specimen_collection_group if parent
      add_default_event_parameters if collected?
      
      # The default available quantity is the initial quantity.
      self.available_quantity ||= is_available ? initial_quantity : 0
      
      if is_available.nil? then
        self.is_available = default_availablility
      elsif is_available == false then
        # Reset is_available value from false to nil to work around caTissue bug but described in
        # the method rubydoc above.
        self.is_available = nil
      end
    end
def add_defaults_local
      super
      self.specimen_collection_group ||= parent.specimen_collection_group if parent
      add_default_event_parameters if collected?
      
      # The default available quantity is the initial quantity.
      self.available_quantity ||= is_available ? initial_quantity : 0
      
      if is_available.nil? then
        self.is_available = default_availablility
      elsif is_available == false then
        # Reset is_available value from false to nil to work around caTissue bug but described in
        # the method rubydoc above.
        self.is_available = nil
      end
    end
def add_defaults_local super self . specimen_collection_group ||= parent . specimen_collection_group if parent add_default_event_parameters if collected? # The default available quantity is the initial quantity. self . available_quantity ||= is_available ? initial_quantity : 0 if is_available . nil? then self . is_available = default_availablility elsif is_available == false then # Reset is_available value from false to nil to work around caTissue bug but described in # the method rubydoc above. self . is_available = nil end end
Adds this Specimen's defaults, as follows:
 * The default specimen_collection_group is the parent specimen_collection_group.
 * Add default collection and received event parameters if this Specimen is collected.
 * If the is_available flag is set to false then the default available quantity is
   zero, otherwise the default available quantity is the initial quantity.
 * The default is_available flag is true if the available quantity is greater than zero.

 The motivation for the is_available flag default is that an initial quantity of zero can indicate
 unknown amount as well a known zero amount, and therefore the available flag should be set to
 false only if it is known that there was an amount but that amount is exhausted.

 @quirk caTissue initial_quantity cannot be null (cf. Bug #160).

 @quirk caTissue the available status cannot be set to to false. The status must be set to nil
 instead. caTissue allows a nil available status on insert but not a false value, even though a
 nil status is set to false (0 database value) when the record is inserted.

 @quirk caTissue a collected Specimen without a collection and received event parameters
 results in the dreaded 'Severe Error' caTissue server message. Create default SEPs if necessary.
Adds this Specimen s defaults as follows : * The default specimen_collection_group is the parent specimen_collection_group . * Add default collection and received event parameters if this Specimen is collected . * If the is_available flag is set to false then the default available quantity is zero otherwise the default available quantity is the initial quantity . * The default is_available flag is true if the available quantity is greater than zero .