collectiveaccess / providence

Cataloguing and data/media management application
GNU General Public License v3.0
290 stars 167 forks source link

objectLotSplitter processing lot_status_id incorrectly (develop) #1475

Closed Monica-Wood closed 11 months ago

Monica-Wood commented 11 months ago

I have found this to be the case on the develop branch, but it may also be doing it on dev/php8, except the php8 branch has a new feature that lot_status_id isn't mandatory anymore.

When importing from ca_objects and using the objectLotSplitter, it gives back the error Could not insert object lot Acquisition Title: Invalid relationship reference for lot_status_id

When I look at the database innoDB status. It shows for the Latest Foreign Key Error

INSERT INTO ca_object_lots (`type_id`,`lot_status_id`,idno_stub,idno_stub_sort,`idno_stub_sort_num`,`extent`,extent_units,home_location_id,`is_deaccessioned`,deaccession_sdatetime, deaccession_edatetime,deaccession_disposal_sdatetime, deaccession_disposal_edatetime,deaccession_authorized_by,deaccession_notes,deaccession_type_id,`access`,`status`,source_id,source_info,`deleted`,`rank`,`view_count`,submission_user_id,submission_group_id,submission_status_id,submission_via_form,submission_session_id) VALUES (87,0,'ACQ.2023.1487','                 ACQ.2023.                1487',465600,0,'',NULL,0,
Foreign key constraint fails for table `ca_utas_prod`.`ca_object_lots`:
,
  CONSTRAINT `fk_ca_object_lots_lot_status_id` FOREIGN KEY (`lot_status_id`) REFERENCES `ca_list_items` (`item_id`) ON DELETE RESTRICT ON UPDATE RESTRICT
Trying to add in child table, in index i_lot_status_id tuple:

No matter what value you enter in the lot_status_id for the refinery options, even the list_item_id, it still tries to put a 0 in the insert for lot_status_id

For completeness, this is the refinery parameters

{
  "objectLotType": "acquisition",
  "matchOn":["label"],
  "attributes": {
    "acquisitionMethod":"^30",
    "acquisitionDate": "^31",
    "creditLine": "^29",
    "acquisitionReason": "^32",
    "acquisitionNote": "^55 ^22",
    "lot_status_id": "accessioned",
    "idno_stub": "%"
  },
  "relationships": [
    {
      "relatedTable": "ca_entities",
      "entityType": "ind",
      "relationshipType": "donor",
      "preferredLabels": "^41"
    }
  ]
}