$conditionAll = getEntitiesRestrictRequest('AND', 'glpi_plugin_resources_professions', '', '', true);
 $query .= $conditionAll . " " . getOrderBy('profession', $columns);
 $result = $DB->query($query);
 for ($row_num = 0; $data = $DB->fetch_assoc($result); $row_num++) {
     if ($row_num == 0) {
         $dataAll[$row_num]['professionline'] = PluginResourcesProfession::getTypeName(1);
         $row_num++;
     }
     $dataAll[$row_num] = $data;
 }
 //Case of specific management for each grade of a profession
 $rankList = "SELECT DISTINCT(`glpi_plugin_resources_budgets`.`plugin_resources_ranks_id`)\n               FROM `glpi_plugin_resources_budgets`\n               WHERE ((`glpi_plugin_resources_budgets`.`begin_date` < '" . $date . "')\n                  AND (`glpi_plugin_resources_budgets`.`end_date` IS NOT NULL\n                  OR `glpi_plugin_resources_budgets`.`end_date` > '" . $date . "'))\n               ORDER BY `glpi_plugin_resources_budgets`.`plugin_resources_ranks_id`";
 foreach ($DB->request($rankList) as $d) {
     if ($d['plugin_resources_ranks_id'] != 0) {
         $rank = new PluginResourcesRank();
         $rank->getFromDB($d['plugin_resources_ranks_id']);
         $qRank = "SELECT  `glpi_plugin_resources_ranks`.`name` AS rank_name,\n                              `glpi_plugin_resources_ranks`.`code` AS rank_code,\n                              `glpi_plugin_resources_professions`.`plugin_resources_professionlines_id` AS professionline,\n                              `glpi_plugin_resources_professions`.`plugin_resources_professioncategories_id` AS professioncategory,\n                              `glpi_plugin_resources_professions`.`name` AS profession,\n                              `glpi_plugin_resources_professions`.`id` AS profession_id,\n                              `glpi_plugin_resources_professions`.`code` AS profession_code,\n                              `glpi_plugin_resources_professions`.`begin_date`,\n                              `glpi_plugin_resources_professions`.`end_date`\n                      FROM `glpi_plugin_resources_ranks`\n                      LEFT JOIN `glpi_plugin_resources_professions`\n                           ON (`glpi_plugin_resources_ranks`.`plugin_resources_professions_id` = `glpi_plugin_resources_professions`.`id`)\n                      LEFT JOIN `glpi_plugin_resources_budgets`\n                           ON (`glpi_plugin_resources_budgets`.`plugin_resources_ranks_id` = `glpi_plugin_resources_ranks`.`id`\n                                 AND ((`glpi_plugin_resources_budgets`.`begin_date` IS NULL)\n                                    OR (`glpi_plugin_resources_budgets`.`begin_date` < '" . $date . "')\n                                 AND (`glpi_plugin_resources_budgets`.`end_date` IS NULL)\n                                    OR (`glpi_plugin_resources_budgets`.`end_date` > '" . $date . "')))\n                      WHERE `glpi_plugin_resources_ranks`.`plugin_resources_professions_id`='" . $rank->getField('plugin_resources_professions_id') . "'\n                           AND `glpi_plugin_resources_ranks`.`is_active` = 1\n                           AND ((`glpi_plugin_resources_ranks`.`end_date` IS NULL )\n                                 OR (`glpi_plugin_resources_ranks`.`end_date` > '" . $date . "' ))\n                           AND ((`glpi_plugin_resources_ranks`.`begin_date` IS NULL)\n                                 OR ( `glpi_plugin_resources_ranks`.`begin_date` < '" . $date . "'))\n                           AND ((`glpi_plugin_resources_budgets`.`id` IS NULL)\n                              OR (`glpi_plugin_resources_budgets`.`begin_date` IS NOT NULL\n                                 AND `glpi_plugin_resources_budgets`.`begin_date` > '" . $date . "')\n                              OR (`glpi_plugin_resources_budgets`.`end_date` IS NOT NULL\n                                 AND `glpi_plugin_resources_budgets`.`end_date` < '" . $date . "')) " . $sqlprofessioncategory . $sqlprofessionline;
         $qRank .= $conditionAll . " " . getOrderBy('profession', $columns);
         $first = 0;
         foreach ($DB->request($qRank) as $dataRank) {
             if ($first == 0) {
                 $dataAll[$row_num]['professionline'] = PluginResourcesRank::getTypeName(1);
                 $first++;
                 $row_num++;
             }
             $dataAll[$row_num] = $dataRank;
             $row_num++;
         }
     }
 }
 $nbtot = count($dataAll);