/** * Remove a relation between Kbit and Delivery * @param {int} $Kbit_UID Kbit UID * @param {int} $delivery_UID delivery UID * @param {string} $link_type The link type * @param {string} $database_name database name e.g. 'content', 'user' */ public static function remove_D2K_relation($Kbit_UID, $delivery_UID, $link_type, $database_name) { $database_name = dbAPI::get_db_name($database_name); // disable old relation $dbObj = new dbAPI(); // where statement $where_sttmnt = " KBIT_BASE_ID = " . $Kbit_UID . " AND DELIVERY_BASE_ID = " . $delivery_UID . " AND LINK_TYPE = '" . $link_type . "' AND ENABLED = 1 "; $dbObj->disable_revision($database_name, 'R_LD2K', $where_sttmnt); }
public static function disable_all_Delivery_info($UID, $destination = 'user') { $dbObj = new dbAPI(); $destination = dbAPI::get_db_name($destination); // disable old records $dbObj->disable_revision('', $destination . ".DELIVERY_BASE ", ' UID = ' . $UID . ' '); // disable old front record $links_tables_names = array('DELIVERY_FRONT'); for ($i = 0; $i < count($links_tables_names); $i++) { // disable old links records $dbObj->disable_revision('', $destination . "." . $links_tables_names[$i] . " ", ' UID = ' . $UID . ' '); } // loop over links and copy records from content to user $links_tables_names = Delivery::get_relations_tables_names(); for ($i = 0; $i < count($links_tables_names); $i++) { // prepare where statement if ($links_tables_names[$i] == 'R_LD2D') { $where_sttmnt = ' (PARENT_ID = ' . $UID . ' OR CHILD_ID = ' . $UID . ') '; } else { $where_sttmnt = ' (DELIVERY_BASE_ID = ' . $UID . ') '; } // disable old links records $dbObj->disable_revision('', $destination . "." . $links_tables_names[$i] . " ", $where_sttmnt); } return true; }