(2024.2) Prevent Duplicate Equipment Catalog Entries
Prevent duplicate Equipment Catalogs
Prevent Duplicate Equipment Catalog Entires
<?php /** * Prevents duplicate manufacturer/manufacturer part number combinations in the EQP_CATALOG table. * * Description: Prevent Duplicate EQP_CATALOG Entries * Table Name: EQP_CATALOG * Table Record: null * Action: Save */ $query = "SELECT RECID FROM EQP_CATALOG WHERE MANUFACTURER = '" . $params["manufacturer"] . "' AND MANU_PART_NUM = '" . $params["manu_part_num"] . "'"; $existing = $this->query($query); if (isset($existing[0]["RECID"]) && ($existing[0]["RECID"] !== $data["RECID"])) { $this->setMessage('Save failed: there already exists an Equipment Catalog record with the same manufacturer/manufacturer part number combination'); return false; } return true;