NotificationTargetCommonITILObject::getSupplierAddress PHP Method

getSupplierAddress() public method

Get supplier related to the ITIL object
public getSupplierAddress ( $sendprivate = false )
$sendprivate (false by default)
    function getSupplierAddress($sendprivate = false)
    {
        global $DB;
        if (!$sendprivate && $this->obj->countSuppliers(CommonITILActor::ASSIGN)) {
            $supplierlinktable = getTableForItemType($this->obj->supplierlinkclass);
            $fkfield = $this->obj->getForeignKeyField();
            $query = "SELECT DISTINCT `glpi_suppliers`.`email` AS email,\n                                   `glpi_suppliers`.`name` AS name\n                   FROM `{$supplierlinktable}`\n                   LEFT JOIN `glpi_suppliers`\n                     ON (`{$supplierlinktable}`.`suppliers_id` = `glpi_suppliers`.`id`)\n                   WHERE `{$supplierlinktable}`.`{$fkfield}` = '" . $this->obj->getID() . "'";
            foreach ($DB->request($query) as $data) {
                $this->addToAddressesList($data);
            }
        }
    }