diff --git a/CHANGELOG.md b/CHANGELOG.md index 09b1d41ad37783390cddbc49b60b3152327eb6c7..c9f50c5bc65c34f0a30a655676e82c6450fb1b14 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,6 +32,26 @@ The present file will list all changes made to the project; according to the - `getAllDatasFromTable` renamed to `getAllDataFromTable()` - Usage of `$order` parameter in `getAllDataFromTable()` (`DbUtils::getAllDataFromTable()`) +#### Removed + +- Usage of string `$condition` parameter in `CommonDBTM::find()` +- Usage of string `$condition` parameter in `Dropdown::addNewCondition()` +- Usage of string in `$option['condition']` parameter in `Dropdown::show()` +- `KnowbaseItemCategory::showFirstLevel()` +- `Ticket::getTicketActors()` +- `NotificationTarget::getProfileJoinSql()` +- `NotificationTarget::getDistinctUserSql()` +- `NotificationTargetCommonITILObject::getProfileJoinSql()` +- `RuleCollection::getRuleListQuery()` +- `getNextItem()` +- `getPreviousItem()` +- `CommonDBChild::getSQLRequestToSearchForItem()` +- `CommonDBConnexity::getSQLRequestToSearchForItem()` +- `CommonDBRelation::getSQLRequestToSearchForItem()` +- `Project::addVisibility()` +- `Project::addVisibilityJoins()` + + ## [9.4.2] unreleased ### API changes diff --git a/inc/commondbchild.class.php b/inc/commondbchild.class.php index 2c5da1f793b4271e8ee2651cac2540f9b95fc9a1..03ad5153c1fdce4791a13daf18713993f87b957d 100644 --- a/inc/commondbchild.class.php +++ b/inc/commondbchild.class.php @@ -52,42 +52,6 @@ abstract class CommonDBChild extends CommonDBConnexity { static public $log_history_lock = Log::HISTORY_LOCK_SUBITEM; static public $log_history_unlock = Log::HISTORY_UNLOCK_SUBITEM; - /** - * @since 0.84 - * - * @deprecated 9.4 - * - * @param $itemtype - * @param $items_id - * - * @return string - **/ - static function getSQLRequestToSearchForItem($itemtype, $items_id) { - Toolbox::deprecated('Use getSQLCriteriaToSearchForItem'); - - $fields = ['`'.static::getIndexName().'`']; - - // Check item 1 type - $condition_id = "`".static::$items_id."` = '$items_id'"; - $fields[] = "`".static::$items_id."` as items_id"; - if (preg_match('/^itemtype/', static::$itemtype)) { - $fields[] = "`".static::$itemtype."` AS itemtype"; - $condition = "($condition_id AND `".static::$itemtype."` = '$itemtype')"; - } else { - $fields[] = "'".static::$itemtype."' AS itemtype"; - if (($itemtype == static::$itemtype) - || is_subclass_of($itemtype, static::$itemtype)) { - $condition = $condition_id; - } - } - if (isset($condition)) { - return "SELECT ".implode(', ', $fields)." - FROM `".static::getTable()."` - WHERE $condition"; - } - return ''; - } - /** * Get request cirteria to search for an item diff --git a/inc/commondbconnexity.class.php b/inc/commondbconnexity.class.php index 25becf289a108466991b810b587c5c80d503b925..3ffc0179b8287b3ac475c10003bd12e573715b1f 100644 --- a/inc/commondbconnexity.class.php +++ b/inc/commondbconnexity.class.php @@ -89,23 +89,6 @@ abstract class CommonDBConnexity extends CommonDBTM { /// Disable auto forwarding information about entities ? static public $disableAutoEntityForwarding = false; - /** - * Return the SQL request to get all the connexities corresponding to $itemtype[$items_id] - * That is used by cleanDBOnItem : the only interesting field is static::getIndexName() - * But CommonDBRelation also use it to get more complex result - * - * @deprecated 9.4 - * - * @param string $itemtype the type of the item to look for - * @param integer $items_id the id of the item to look for - * - * @return string the SQL request of '' if it is not possible - **/ - static function getSQLRequestToSearchForItem($itemtype, $items_id) { - Toolbox::deprecated('Use getSQLCriteriaToSearchForItem'); - return ''; - } - /** * Return the SQL request to get all the connexities corresponding to $itemtype[$items_id] diff --git a/inc/commondbrelation.class.php b/inc/commondbrelation.class.php index 48bf7a5581a8825620fcb93d110f4a99cf2b088b..73d085e160d4977933d628df10658a0da6b4a7cc 100644 --- a/inc/commondbrelation.class.php +++ b/inc/commondbrelation.class.php @@ -80,72 +80,6 @@ abstract class CommonDBRelation extends CommonDBConnexity { public $no_form_page = true; - - /** - * @since 0.84 - * - * @deprecated 9.4 - * - * @param $itemtype - * @param $items_id - * - * @return string - **/ - static function getSQLRequestToSearchForItem($itemtype, $items_id) { - Toolbox::deprecated('Use getSQLCriteriaToSearchForItem'); - - $conditions = []; - $fields = ['`'.static::getIndexName().'`']; - - // Check item 1 type - $condition_id_1 = "`".static::$items_id_1."` = '$items_id'"; - $fields[] = "`".static::$items_id_1."` as items_id_1"; - if (preg_match('/^itemtype/', static::$itemtype_1)) { - $fields[] = "`".static::$itemtype_1."` AS itemtype_1"; - $condition_1 = "($condition_id_1 AND `".static::$itemtype_1."` = '$itemtype')"; - } else { - $fields[] = "'".static::$itemtype_1."' AS itemtype_1"; - if (($itemtype == static::$itemtype_1) - || is_subclass_of($itemtype, static::$itemtype_1)) { - $condition_1 = $condition_id_1; - } - } - if (isset($condition_1)) { - $conditions[] = $condition_1; - $fields[] = "IF($condition_1, 1, 0) AS is_1"; - } else { - $fields[] = "0 AS is_1"; - } - - // Check item 2 type - $condition_id_2 = "`".static::$items_id_2."` = '$items_id'"; - $fields[] = "`".static::$items_id_2."` as items_id_2"; - if (preg_match('/^itemtype/', static::$itemtype_2)) { - $fields[] = "`".static::$itemtype_2."` AS itemtype_2"; - $condition_2 = "($condition_id_2 AND `".static::$itemtype_2."` = '$itemtype')"; - } else { - $fields[] = "'".static::$itemtype_2."' AS itemtype_2"; - if (($itemtype == static::$itemtype_2) - || is_subclass_of($itemtype, static::$itemtype_2)) { - $condition_2 = $condition_id_2; - } - } - if (isset($condition_2)) { - $conditions[] = $condition_2; - $fields[] = "IF($condition_2, 2, 0) AS is_2"; - } else { - $fields[] = "0 AS is_2"; - } - - if (count($conditions) != 0) { - return "SELECT ".implode(', ', $fields)." - FROM `".static::getTable()."` - WHERE ".implode(' OR ', $conditions).""; - } - return ''; - } - - /** * Get request cirteria to search for an item * diff --git a/inc/commondbtm.class.php b/inc/commondbtm.class.php index 12e48912ca42234053cd69cb255d2711d3499e7f..34ee1913570d43837de9ff443dded73fb1761a1f 100644 --- a/inc/commondbtm.class.php +++ b/inc/commondbtm.class.php @@ -108,7 +108,7 @@ class CommonDBTM extends CommonGLPI { protected $fkfield = ""; /** - * Search option of item. Initialized on first call to `self::getOptions()` and used as cache. + * Search option of item. Initialized on first call to self::getOptions() and used as cache. * * @var array * @@ -472,60 +472,30 @@ class CommonDBTM extends CommonGLPI { **/ function find($condition = [], $order = [], $limit = null) { global $DB; - // Make new database object and fill variables - - if (!is_array($condition)) { - Toolbox::deprecated('Using string condition in find is deprecated!'); - - $query = "SELECT * - FROM `".$this->getTable()."`"; - - if (!empty($condition)) { - $query .= " WHERE $condition"; - } - - if (!empty($order)) { - $query .= " ORDER BY $order"; - } - - if (!empty($limit)) { - $query .= " LIMIT ".intval($limit); - } - $data = []; - if ($result = $DB->query($query)) { - if ($DB->numrows($result)) { - while ($line = $DB->fetchAssoc($result)) { - $data[$line['id']] = $line; - } - } - } - } else { - //@since 9.4: use iterator - $criteria = [ - 'FROM' => $this->getTable() - ]; + $criteria = [ + 'FROM' => $this->getTable() + ]; - if (count($condition)) { - $criteria['WHERE'] = $condition; - } + if (count($condition)) { + $criteria['WHERE'] = $condition; + } - if (!is_array($order)) { - $order = [$order]; - } - if (count($order)) { - $criteria['ORDERBY'] = $order; - } + if (!is_array($order)) { + $order = [$order]; + } + if (count($order)) { + $criteria['ORDERBY'] = $order; + } - if ((int)$limit > 0) { - $criteria['LIMIT'] = (int)$limit; - } + if ((int)$limit > 0) { + $criteria['LIMIT'] = (int)$limit; + } - $data = []; - $iterator = $DB->request($criteria); - while ($line = $iterator->next()) { - $data[$line['id']] = $line; - } + $data = []; + $iterator = $DB->request($criteria); + while ($line = $iterator->next()) { + $data[$line['id']] = $line; } return $data; diff --git a/inc/db.function.php b/inc/db.function.php index 77335e95e36701d7eb82a7a807cc0b3f8b595fab..463154c9961cefce17e330e9a125f092cd6496d0 100644 --- a/inc/db.function.php +++ b/inc/db.function.php @@ -425,42 +425,6 @@ function regenerateTreeCompleteName($table) { } -/** - * Get the ID of the next Item - * - * @deprecated 9.4 - * - * @param string $table table to search next item - * @param integer $ID current ID - * @param string $condition condition to add to the search (default ='') - * @param string $nextprev_item field used to sort (default ='name') - * - * @return integer the next ID, -1 if not exist - */ -function getNextItem($table, $ID, $condition = "", $nextprev_item = "name") { - $dbu = new DbUtils(); - return $dbu->getNextItem($table, $ID, $condition, $nextprev_item); -} - - -/** - * Get the ID of the previous Item - * - * @deprecated 9.4 - * - * @param string $table table to search next item - * @param integer $ID current ID - * @param string $condition condition to add to the search (default ='') - * @param string $nextprev_item field used to sort (default ='name') - * - * @return integer the previous ID, -1 if not exist - */ -function getPreviousItem($table, $ID, $condition = "", $nextprev_item = "name") { - $dbu = new DbUtils(); - return $dbu->getPreviousItem($table, $ID, $condition, $nextprev_item); -} - - /** * Format a user name * diff --git a/inc/dbutils.class.php b/inc/dbutils.class.php index f6d2f5752f95e8cbd8e39ed96708f31ddbf26f16..e8bb55c7a7da169fe7a53e42ed8dbc0c7b7aff8b 100644 --- a/inc/dbutils.class.php +++ b/inc/dbutils.class.php @@ -1350,190 +1350,6 @@ final class DbUtils { } - /** - * Get the ID of the next Item - * - * @deprecated 9.4 - * - * @param string $table table to search next item - * @param integer $ID current ID - * @param string $condition condition to add to the search (default ='') - * @param string $nextprev_item field used to sort (default ='name') - * - * @return integer the next ID, -1 if not exist - */ - public function getNextItem($table, $ID, $condition = "", $nextprev_item = "name") { - global $DB; - Toolbox::deprecated(); - - if (empty($nextprev_item)) { - return false; - } - - $itemtype = $this->getItemTypeForTable($table); - $item = new $itemtype(); - $search = $ID; - - if ($nextprev_item != "id") { - $iterator = $DB->request([ - 'SELECT' => $nextprev_item, - 'FROM' => $table, - 'WHERE' => ['id' => $ID] - ]); - - if (count($iterator) > 0) { - $search = addslashes($iterator->next()[$nextprev_item]); - } else { - $nextprev_item = "id"; - } - } - - $LEFTJOIN = ''; - if ($table == "glpi_users") { - $LEFTJOIN = " LEFT JOIN `glpi_profiles_users` - ON (`glpi_users`.`id` = `glpi_profiles_users`.`users_id`)"; - } - - $query = "SELECT `$table`.`id` - FROM `$table` - $LEFTJOIN - WHERE (`$table`.`$nextprev_item` > '$search' "; - - // Same name case - if ($nextprev_item != "id") { - $query .= " OR (`$table`.`".$nextprev_item."` = '$search' - AND `$table`.`id` > '$ID') "; - } - $query .= ") "; - - if (!empty($condition)) { - $query .= " AND $condition "; - } - - if ($item->maybeDeleted()) { - $query .= " AND `$table`.`is_deleted` = 0 "; - } - - if ($item->maybeTemplate()) { - $query .= " AND `$table`.`is_template` = 0 "; - } - - // Restrict to active entities - if ($table == "glpi_entities") { - $query .= $this->getEntitiesRestrictRequest("AND", $table, '', '', true); - - } else if ($item->isEntityAssign()) { - $query .= $this->getEntitiesRestrictRequest("AND", $table, '', '', $item->maybeRecursive()); - - } else if ($table == "glpi_users") { - $query .= $this->getEntitiesRestrictRequest("AND", "glpi_profiles_users"); - } - - $query .= " ORDER BY `$table`.`$nextprev_item` ASC, - `$table`.`id` ASC"; - - $result = $DB->query($query); - if ($result - && ($DB->numrows($result) > 0)) { - return $DB->result($result, 0, "id"); - } - - return -1; - } - - - /** - * Get the ID of the previous Item - * - * @deprecated 9.4 - * - * @param string $table table to search next item - * @param integer $ID current ID - * @param string $condition condition to add to the search (default ='') - * @param string $nextprev_item field used to sort (default ='name') - * - * @return integer the previous ID, -1 if not exist - */ - public function getPreviousItem($table, $ID, $condition = "", $nextprev_item = "name") { - global $DB; - Toolbox::deprecated(); - - if (empty($nextprev_item)) { - return false; - } - - $itemtype = $this->getItemTypeForTable($table); - $item = new $itemtype(); - $search = $ID; - - if ($nextprev_item != "id") { - $iterator = $DB->request([ - 'SELECT' => $nextprev_item, - 'FROM' => $table, - 'WHERE' => ['id' => $ID] - ]); - - if (count($iterator) > 0) { - $search = addslashes($iterator->next()[$nextprev_item]); - } else { - $nextprev_item = "id"; - } - } - - $LEFTJOIN = ''; - if ($table == "glpi_users") { - $LEFTJOIN = " LEFT JOIN `glpi_profiles_users` - ON (`glpi_users`.`id` = `glpi_profiles_users`.`users_id`)"; - } - - $query = "SELECT `$table`.`id` - FROM `$table` - $LEFTJOIN - WHERE (`$table`.`$nextprev_item` < '$search' "; - - // Same name case - if ($nextprev_item != "id") { - $query .= " OR (`$table`.`$nextprev_item` = '$search' - AND `$table`.`id` < '$ID') "; - } - $query .= ") "; - - if (!empty($condition)) { - $query .= " AND $condition "; - } - - if ($item->maybeDeleted()) { - $query .= "AND `$table`.`is_deleted` = 0"; - } - - if ($item->maybeTemplate()) { - $query .= "AND `$table`.`is_template` = 0"; - } - - // Restrict to active entities - if ($table == "glpi_entities") { - $query .= $this->getEntitiesRestrictRequest("AND", $table, '', '', true); - - } else if ($item->isEntityAssign()) { - $query .= $this->getEntitiesRestrictRequest("AND", $table, '', '', $item->maybeRecursive()); - - } else if ($table == "glpi_users") { - $query .= $this->getEntitiesRestrictRequest("AND", "glpi_profiles_users"); - } - - $query .= " ORDER BY `$table`.`$nextprev_item` DESC, - `$table`.`id` DESC"; - - $result = $DB->query($query); - if ($result - && ($DB->numrows($result) > 0)) { - return $DB->result($result, 0, "id"); - } - - return -1; - } - - /** * Format a user name * diff --git a/inc/dropdown.class.php b/inc/dropdown.class.php index efa92e52cb2825aaa59b781cdbb7ef80ba77212d..06771fb6539815fbc2def2aa380dffc9a6db4aca 100755 --- a/inc/dropdown.class.php +++ b/inc/dropdown.class.php @@ -75,15 +75,11 @@ class Dropdown { * * @return boolean : false if error and random id if OK * - * @since 9.4.0 Usage of string in condition option is deprecated + * @since 9.5.0 Usage of string in condition option is removed **/ static function show($itemtype, $options = []) { global $DB, $CFG_GLPI; - if (array_key_exists('condition', $options) && !is_array($options['condition'])) { - Toolbox::deprecated('Using a string in condition option is deprecated.'); - } - if ($itemtype && !($item = getItemForItemtype($itemtype))) { return false; } @@ -280,14 +276,7 @@ class Dropdown { * @return string */ static function addNewCondition($condition) { - if (!is_array($condition)) { - Toolbox::deprecated('Using a string in dropdown condition is deprecated.'); - $condition = Toolbox::cleanNewLines($condition); - $sha1 = sha1($condition); - } else { - $sha1 = sha1(serialize($condition)); - } - + $sha1 = sha1(serialize($condition)); $_SESSION['glpicondition'][$sha1] = $condition; return $sha1; } @@ -2316,12 +2305,7 @@ class Dropdown { } if (isset($post['condition']) && ($post['condition'] != '')) { - if (!is_array($post['condition']) && $post['condition'] != '') { - Toolbox::deprecated('Please no longer use raw SQL for conditions!'); - $where[] = new \QueryExpression($post['condition']); - } else if (count($post['condition'])) { - $where = array_merge($where, $post['condition']); - } + $where = array_merge($where, $post['condition']); } $one_item = -1; diff --git a/inc/knowbaseitemcategory.class.php b/inc/knowbaseitemcategory.class.php index 7adfacd93ddc4b62798b13c9b7e823607011ae18..13387ef0d06f5a9663043e2b46da6a9bc2d91551 100755 --- a/inc/knowbaseitemcategory.class.php +++ b/inc/knowbaseitemcategory.class.php @@ -44,183 +44,7 @@ class KnowbaseItemCategory extends CommonTreeDropdown { static $rightname = 'knowbasecategory'; - static function getTypeName($nb = 0) { return _n('Knowledge base category', 'Knowledge base categories', $nb); } - - - /** - * Show KB categories - * - * @param $options $_GET - * - * @return nothing (display the form) - * - * @deprecated 9.4.0 - **/ - static function showFirstLevel($options) { - global $DB, $CFG_GLPI; - - Toolbox::deprecated(); - - $faq = !Session::haveRight("knowbase", READ); - - // Default values of parameters - $params["knowbaseitemcategories_id"] = "0"; - $params["target"] = KnowbaseItem::getSearchURL(); - - if (is_array($options) && count($options)) { - foreach ($options as $key => $val) { - $params[$key]=$val; - } - } - - $parameters = ''; - // Manage search solution - if (isset($options['item_itemtype']) - && isset($options['item_items_id'])) { - $parameters = "&item_items_id=".$options['item_items_id']."&item_itemtype=". - $options['item_itemtype']; - } - - if ($faq) { - if (!$CFG_GLPI["use_public_faq"] - && !Session::haveRight('knowbase', KnowbaseItem::READFAQ)) { - return false; - } - - $where = []; - if (Session::getLoginUserID()) { - $where = getEntitiesRestrictCriteria('glpi_knowbaseitemcategories', '', '', true); - } else { - // Anonymous access - if (Session::isMultiEntitiesMode()) { - $where['glpi_knowbaseitemcategories.entities_id'] = 0; - $where['glpi_knowbaseitemcategories.is_recursive'] = 1; - } - } - - // Get All FAQ categories - $categories = []; - - $criteria = [ - 'SELECT' => 'glpi_knowbaseitems.knowbaseitemcategories_id', - 'DISTINCT' => true, - 'FROM' => 'glpi_knowbaseitems', - 'LEFT JOIN' => [ - 'glpi_knowbaseitemcategories', [ - 'ON' => [ - 'glpi_knowbaseitemcategories' => 'id', - 'glpi_knowbaseitems' => 'knowbaseitemcategories_id' - ] - ] - ], - 'WHERE' => $where + ['glpi_knowbaseitems.is_faq' => 1] - ]; - $criteria = array_merge( - $criteria, - KnowbaseItem::getVisibilityCriteria() - ); - - $iterator = $DB->request($criteria); - while ($data = $iterator->next()) { - if (!in_array($data['knowbaseitemcategories_id'], $categories)) { - $categories[] = $data['knowbaseitemcategories_id']; - $categories = array_merge( - $categories, - getAncestorsOf( - 'glpi_knowbaseitemcategories', - $data['knowbaseitemcategories_id'] - ) - ); - } - } - - $criteria = [ - 'SELECT' => 'glpi_knowbaseitemcategories.*', - 'DISTINCT' => true, - 'FROM' => 'glpi_knowbaseitemcategories', - 'WHERE' => [ - 'id' => $categories, - 'knowbaseitemcategories_id' => $params['knowbaseitemcategories_id'] - ] + $where, - 'ORDERBY' => 'name ASC' - ]; - } else { - if (!Session::haveRight("knowbase", READ)) { - return false; - } - $where = getEntitiesRestrictCriteria( - 'glpi_knowbaseitemcategories', - 'entities_id', - $_SESSION['glpiactiveentities'], - true - ); - - $criteria = [ - 'FROM' => 'glpi_knowbaseitemcategories', - 'WHERE' => [ - 'knowbaseitemcategories_id' => $params['knowbaseitemcategories_id'] - ] + $where, - 'ORDER' => 'name ASC' - ]; - } - $iterator = $DB->request($criteria); - - // Show category - echo ""; - echo ""; - } - $ID = $row["id"]; - echo ""; - } - $i++; - } - } - echo "
"; - echo " " . __('Root category') . ""; - - // Display Category - if ($params["knowbaseitemcategories_id"]!=0) { - $tmpID = $params["knowbaseitemcategories_id"]; - $todisplay = ""; - - while ($tmpID != 0) { - $cat_iterator = $DB->request([ - 'FROM' => 'glpi_knowbaseitemcategories', - 'WHERE' => [ - 'knowbaseitemcategories_id' => $tmpID - ] + $where - ]); - - if (count($cat_iterator) == 1) { - $data = $cat_iterator->next(); - $tmpID = $data["knowbaseitemcategories_id"]; - $todisplay = "".$data["name"]."". - (empty($todisplay)?"":" > "). $todisplay; - } else { - $tmpID = 0; - } - } - echo " > ".$todisplay; - } - - if (count($iterator) > 0) { - $i = 0; - while ($row = $iterator->next()) { - // on affiche les résultats sur trois colonnes - if (($i%3) == 0) { - echo "
"; - echo " "; - echo "". - "". - $row["name"].""; - echo "
".Html::resume_text($row['comment'], 60)."
"; - - if (($i%3) == 2) { - echo "
 

"; - } - } diff --git a/inc/notificationtarget.class.php b/inc/notificationtarget.class.php index 45a1b060eb99ab9d8f01cde91ac3dcef18461bd5..8618eebddb823bd438ab028325dcbda267bcea3d 100644 --- a/inc/notificationtarget.class.php +++ b/inc/notificationtarget.class.php @@ -735,15 +735,6 @@ class NotificationTarget extends CommonDBChild { } - /** - * @deprecated 9.4 - */ - final public function getDistinctUserSql() { - Toolbox::deprecated('Use getDistinctUserCriteria'); - return "SELECT DISTINCT `glpi_users`.`id` AS users_id, - `glpi_users`.`language` AS language"; - } - /** * Get request criteria to select uniques users * @@ -1182,22 +1173,6 @@ class NotificationTarget extends CommonDBChild { } - /** - * Get SQL join to restrict by profile and by config to avoid send notification - * to a user without rights. - * - * @deprecated 9.4 - * - * @return string - */ - public function getProfileJoinSql() { - Toolbox::deprecated('Use getProfileJoinCriteria'); - return " INNER JOIN `glpi_profiles_users` - ON (`glpi_profiles_users`.`users_id` = `glpi_users`.`id` ". - getEntitiesRestrictRequest("AND", "glpi_profiles_users", "entities_id", - $this->getEntity(), true).")"; - } - /** * Get SQL join to restrict by profile and by config to avoid send notification * to a user without rights. diff --git a/inc/notificationtargetcommonitilobject.class.php b/inc/notificationtargetcommonitilobject.class.php index 102137c1de929147ca6f402e2ae510f18f56a052..bb2daa324e8b5b141d85759523e12d199c078f68 100644 --- a/inc/notificationtargetcommonitilobject.class.php +++ b/inc/notificationtargetcommonitilobject.class.php @@ -646,27 +646,6 @@ abstract class NotificationTargetCommonITILObject extends NotificationTarget { } - public function getProfileJoinSql() { - - Toolbox::deprecated('Use getProfileJoinCriteria'); - - $query = parent::getProfileJoinSql(); - - if ($this->isPrivate()) { - $query .= " INNER JOIN `glpi_profiles` - ON (`glpi_profiles`.`id` = `glpi_profiles_users`.`profiles_id` - AND `glpi_profiles`.`interface` = 'central') - INNER JOIN `glpi_profilerights` - ON (`glpi_profiles`.`id` = `glpi_profilerights`.`profiles_id` - AND `glpi_profilerights`.`name` = 'followup' - AND `glpi_profilerights`.`rights` & ". - ITILFollowup::SEEPRIVATE.") "; - - } - return $query; - } - - public function getProfileJoinCriteria() { $criteria = parent::getProfileJoinCriteria(); diff --git a/inc/project.class.php b/inc/project.class.php index faf92813a67270d249e6182055299e5089076127..7eae4776cb24ccd68d37d7309c4ff95cb62edc72 100644 --- a/inc/project.class.php +++ b/inc/project.class.php @@ -325,56 +325,6 @@ class Project extends CommonDBTM { parent::cleanDBonPurge(); } - /** - * Return visibility joins to add to SQL - * - * @deprecated 9.4.0 - * - * @return string joins to add - **/ - static function addVisibilityJoins() { - global $DB; - - Toolbox::deprecated('Use getVisibilityCriteria'); - - //get and clean criteria - $criteria = self::getVisibilityCriteria(); - unset($criteria['WHERE']); - $criteria['FROM'] = self::getTable(); - - $it = new \DBmysqlIterator(null); - $it->buildQuery($criteria); - $sql = $it->getSql(); - $sql = str_replace( - 'SELECT * FROM '.$DB->quoteName(self::getTable()).' ', - '', - $sql - ); - return $sql; - } - - /** - * Return visibility to add to SQL - * - * @deprecated 9.4.0 - * - * @return string joins to add - **/ - static function addVisibility() { - Toolbox::deprecated('Use getVisibilityCriteria'); - - //get and clean criteria - $criteria = self::getVisibilityCriteria(); - unset($criteria['LEFT JOIN']); - $criteria['FROM'] = self::getTable(); - - $it = new \DBmysqlIterator(null); - $it->buildQuery($criteria); - $sql = $it->getSql(); - $sql = preg_replace('/.*WHERE /', '', $sql); - - return $sql; - } /** * Return visibility joins to add to DBIterator parameters diff --git a/inc/rulecollection.class.php b/inc/rulecollection.class.php index f9e3dce8bc192d7ff7967c6ed9ab1bdf950cfedb..ce01fa99f54ca77e455ec6ff5116f946d8c24cf3 100644 --- a/inc/rulecollection.class.php +++ b/inc/rulecollection.class.php @@ -107,65 +107,6 @@ class RuleCollection extends CommonDBTM { } - /** - * @deprecated 9.4 - * @param $options array - **/ - function getRuleListQuery($options = []) { - Toolbox::deprecated('Use getRuleListCriteria'); - - $p['active'] = true; - $p['start'] = 0; - $p['limit'] = 0; - $p['inherited'] = 1; - $p['childrens'] = 0; - $p['condition'] = 0; - - foreach ($options as $key => $value) { - $p[$key] = $value; - } - - if ($p['active']) { - $sql_active = " `is_active` = 1"; - } else { - $sql_active = "1"; - } - - if ($p['condition'] > 0) { - $sql_active .= " AND `condition` & ". (int) $p['condition']; - } - - $sql = "SELECT `glpi_rules`.* - FROM `glpi_rules`"; - - //Select all the rules of a different type - if ($this->isRuleRecursive()) { - $sql .= " LEFT JOIN `glpi_entities` ON (`glpi_entities`.`id`=`glpi_rules`.`entities_id`) - WHERE $sql_active - AND `sub_type` = '".$this->getRuleClassName()."' "; - - if (!$p['childrens']) { - $sql .= getEntitiesRestrictRequest(" AND", "glpi_rules", "entities_id", $this->entity, - $p['inherited']); - } else { - $sons = getSonsOf('glpi_entities', $this->entity); - $sql .= " AND `glpi_rules`.`entities_id` IN (".implode(',', $sons).")"; - } - $sql .= " ORDER BY `glpi_entities`.`level` ASC, - `".$this->orderby."` ASC"; - - } else { - $sql .= "WHERE $sql_active - AND `sub_type` = '".$this->getRuleClassName()."' - ORDER BY `".$this->orderby."` ASC"; - } - - if ($p['limit']) { - $sql .= " LIMIT ".intval($p['start']).",".intval($p['limit']); - } - return $sql; - } - /** * Get rules list criteria * diff --git a/inc/ticket.class.php b/inc/ticket.class.php index 31e05fd80f8a2f6c96114ab1502f638867887ec9..bf91a3e0ec1576f3218544d04229043a757c5415 100644 --- a/inc/ticket.class.php +++ b/inc/ticket.class.php @@ -6794,20 +6794,6 @@ class Ticket extends CommonITILObject { } - /** - * Summary of getTicketActors - * Get the list of actors for the current ticket - * will return an assoc array of users_id => array of roles. - * @return array[] of array[] of users and roles - * @since 0.90 - * @deprecated 9.4.0 - **/ - function getTicketActors() { - Toolbox::deprecated('Use getITILActors'); - return $this->getITILActors(); - } - - /** * @since 0.90 *