Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

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;
  • No labels