public static function insert($DATA) { $DB = portal::database(); extract($DATA['POST']); $INVENTORY = array(); $CHARACTERISTIC = array(); foreach ($inventory as $KEY => $VALUE) { switch ($KEY) { case 'SKU': case 'CATEGORY_ID': case 'CLASSIFICATION_ID': case 'WEIGHT': $INVENTORY[$KEY] = $VALUE; break; default: $CHARACTERISTIC[$KEY] = $VALUE; break; } } $DB->select("ID AS INVENTORY_ID", "inventory", "SKU = ?", array($INVENTORY['SKU'])); if ($DB->fetch_assoc()) { $_SESSION[CLIENT]['ERROR_MSG'] = 'Duplicate SKU, please resubmit with a valid SKU.'; return; } $DB->insert("inventory", array("SKU" => $INVENTORY['SKU'], "CATEGORY_ID" => $INVENTORY['CATEGORY_ID'], "CLASSIFICATION_ID" => $INVENTORY['CLASSIFICATION_ID'], "WEIGHT" => $INVENTORY['WEIGHT'])); $DB->select("ID AS INVENTORY_ID", "inventory", "SKU = ?", array($INVENTORY['SKU'])); extract($DB->fetch_assoc()); $DB->insert("inventory_characteristic", array("INVENTORY_ID" => $INVENTORY_ID, "CHARACTERISTICS" => json_encode($CHARACTERISTIC))); $DB->insert("inventory_worked_by", array("INVENTORY_ID" => $INVENTORY_ID, "USER_ACCOUNT_ID" => $_SESSION[CLIENT]['ID'])); }
public static function delete($DATA) { extract($DATA['GET']); $DB = portal::database(); $IDS = json_decode($id); foreach ($IDS as $ID) { $DB->delete("user_type", "ID = ?", array($ID)); } }
public static function delete($DATA) { extract($DATA['GET']); $DB = portal::database(); $IDS = json_decode($id); foreach ($IDS as $ID) { $DB->delete("inventory", "ID = ?", array($ID)); $DB->delete("inventory_worked_by", "INVENTORY_ID = ?", array($ID)); $DB->delete("inventory_characteristic", "INVENTORY_ID = ?", array($ID)); $DB->delete("inventory_status", "INVENTORY_ID = ?", array($ID)); $DB->delete("inventory_title", "INVENTORY_ID = ?", array($ID)); } }
public static function delete($DATA) { extract($DATA['GET']); $DB = portal::database(); $IDS = json_decode($id); foreach ($IDS as $ID) { $DB->delete("classification", "ID = ?", array($ID)); $DB->select("ID", "category_has_classification", "CLASSIFICATION_ID = ?", array($ID)); $CHC_IDS = $DB->fetch_assoc_all(); $DB->delete("category_has_classification", "CLASSIFICATION_ID = ?", array($ID)); foreach ($CHC_IDS as $KEY => $VALUE) { $DB->delete("classification_has_characteristic", "CATEGORY_HAS_CLASSIFICATION_ID = ?", array($VALUE['ID'])); } } }
public static function delete($DATA) { extract($DATA['GET']); $DB = portal::database(); $IDS = json_decode($id); foreach ($IDS as $ID) { $DB->delete("category_has_classification", "ID = ?", array($ID)); $DB->delete("classification_has_characteristic", "CATEGORY_HAS_CLASSIFICATION_ID = ?", array($ID)); } }
public static function delete($DATA) { extract($DATA['GET']); $DB = portal::database(); $IDS = json_decode($id); foreach ($IDS as $ID) { $DB->delete("characteristic", "ID = ?", array($ID)); $DB->delete("classification_has_characteristic", "CHARACTERISTIC_ID = ?", array($ID)); } }
public static function getUserGroup($DATA) { extract($DATA); $DB = portal::database(); if (!isset($DATA['TYPE'])) { return; } switch ($DATA['TYPE']) { case 'ALL': $DB->query("SELECT user_account.ID, \r\n USER_NAME \r\n FROM user_account \r\n JOIN user_type ON USER_TYPE_ID = user_type.ID\r\n JOIN user_name ON USER_NAME_ID = user_name.ID"); break; default: $DB->query("SELECT user_account.ID, \r\n USER_NAME \r\n FROM user_account \r\n JOIN user_type ON USER_TYPE_ID = user_type.ID\r\n JOIN user_name ON USER_NAME_ID = user_name.ID\r\n WHERE USER_TYPE = 'ADMIN' OR USER_TYPE = ?", array($TYPE)); break; } return $DB->fetch_assoc_all(); }
public static function userEmailExists($DATA) { extract($DATA); $DB = portal::database(); if (isset($ID)) { $DB->select("USER_EMAIL", "user_email", "ID = ?", array($ID)); if ($DB->fetch_assoc()) { return true; } } elseif (isset($USER_EMAIL)) { $DB->select("USER_EMAIL", "user_email", "USER_EMAIL = ?", array($USER_EMAIL)); if ($DB->fetch_assoc()) { return true; } } return false; }