/** * When a profession is deleted -> deletion of the linked ranks * * @return nothing|void */ function cleanDBonPurge() { $temp = new PluginResourcesRank(); $temp->deleteByCriteria(array('plugin_resources_professions_id' => $this->fields['id'])); }
it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. Resources is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Resources. If not, see <http://www.gnu.org/licenses/>. -------------------------------------------------------------------------- */ //Options for GLPI 0.71 and newer : need slave db to access the report $USEDBREPLICATE = 1; $DBCONNECTION_REQUIRED = 0; include "../../../../inc/includes.php"; //"Rapport listant les ressources sans emploi"; //"Report listing resource without employment"; // Instantiate Report with Name $titre = $LANG['plugin_resources']['resourcewithoutemployment']; $report = new PluginReportsAutoReport($titre); // Columns title (optional) $report->setColumns(array(new PluginReportsColumnInteger('registration_number', __('Administrative number'), array('sorton' => 'registration_number')), new PluginReportsColumnLink('resource_id', __('Name'), 'PluginResourcesResource', array('sorton' => 'resource_name')), new PluginReportsColumn('firstname', __('First name'), array('sorton' => 'firstname')), new PluginReportsColumn('rank', PluginResourcesRank::getTypeName(1), array('sorton' => 'rank')), new PluginReportsColumn('situation', PluginResourcesResourceSituation::getTypeName(1), array('sorton' => 'situation')), new PluginReportsColumn('state', PluginResourcesResourceState::getTypeName(1), array('sorton' => 'state')), new PluginReportsColumnDate('date_begin', __('Arrival date', 'resources'), array('sorton' => 'date_begin')), new PluginReportsColumnDate('date_end', __('Departure date', 'resources'), array('sorton' => 'date_end')))); // SQL statement $condition = getEntitiesRestrictRequest(' AND ', "glpi_plugin_resources_resources", '', '', false); $date = date("Y-m-d"); //display only resource without user linked $query = "SELECT `glpi_users`.`registration_number`,\n `glpi_users`.`id` as user_id,\n `glpi_plugin_resources_resources`.`id` as resource_id,\n `glpi_plugin_resources_resources`.`name` as resource_name,\n `glpi_plugin_resources_resources`.`firstname`,\n `glpi_plugin_resources_ranks`.`name` AS rank,\n `glpi_plugin_resources_resourcesituations`.`name` AS situation,\n `glpi_plugin_resources_resourcestates`.`name` AS state,\n `glpi_plugin_resources_resources`.`date_begin`,\n `glpi_plugin_resources_resources`.`date_end`\n FROM `glpi_users`\n LEFT JOIN `glpi_plugin_resources_resources_items`\n ON (`glpi_users`.`id` = `glpi_plugin_resources_resources_items`.`items_id`\n AND `glpi_plugin_resources_resources_items`.`itemtype`= 'User')\n LEFT JOIN `glpi_plugin_resources_resources`\n ON (`glpi_plugin_resources_resources`.`id` = `glpi_plugin_resources_resources_items`.`plugin_resources_resources_id`)\n LEFT JOIN `glpi_plugin_resources_ranks`\n ON (`glpi_plugin_resources_resources`.`plugin_resources_ranks_id` = `glpi_plugin_resources_ranks`.`id`)\n LEFT JOIN `glpi_plugin_resources_resourcesituations`\n ON (`glpi_plugin_resources_resources`.`plugin_resources_resourcesituations_id` = `glpi_plugin_resources_resourcesituations`.`id`)\n LEFT JOIN `glpi_plugin_resources_resourcestates`\n ON (`glpi_plugin_resources_resources`.`plugin_resources_resourcestates_id` = `glpi_plugin_resources_resourcestates`.`id`)\n WHERE (`glpi_plugin_resources_resources`.`is_leaving` = 0\n AND `glpi_users`.`is_active` = 1\n AND `glpi_plugin_resources_resources`.`is_deleted` = '0'\n AND `glpi_plugin_resources_resources`.`is_template` = '0'\n AND `glpi_plugin_resources_resources`.`id` NOT IN\n (SELECT DISTINCT(`plugin_resources_resources_id`)\n FROM `glpi_plugin_resources_employments`\n WHERE ((`glpi_plugin_resources_employments`.`end_date` IS NULL )\n OR (`glpi_plugin_resources_employments`.`end_date` > '" . $date . "' ))\n AND ((`glpi_plugin_resources_employments`.`begin_date` IS NULL)\n OR ( `glpi_plugin_resources_employments`.`begin_date` < '" . $date . "')))\n " . $condition . ")\n AND ((`glpi_plugin_resources_resources`.`date_end` IS NULL )\n OR (`glpi_plugin_resources_resources`.`date_end` > '" . $date . "' ))\n AND ((`glpi_plugin_resources_resources`.`date_begin` IS NULL)\n OR ( `glpi_plugin_resources_resources`.`date_begin` < '" . $date . "'))" . $report->getOrderBy('resource_id'); $report->setSqlRequest($query); $report->execute();
Resources is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. Resources is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Resources. If not, see <http://www.gnu.org/licenses/>. -------------------------------------------------------------------------- */ //Options for GLPI 0.71 and newer : need slave db to access the report $USEDBREPLICATE = 1; $DBCONNECTION_REQUIRED = 1; include "../../../../inc/includes.php"; // Instantiate Report with Name $titre = $LANG['plugin_resources']['resourceemploymentwithlapseprofession']; $report = new PluginReportsAutoReport($titre); // Columns title (optional) $report->setColumns(array(new PluginReportsColumnLink('rank_id', PluginResourcesRank::getTypeName(1), 'PluginResourcesRank', array('sorton' => 'rank_name')), new PluginReportsColumn('rank_code', PluginResourcesRank::getTypeName(1) . " - " . __('Code', 'resources'), array('sorton' => 'rank_code')), new PluginReportsColumnDate('rank_begin_date', PluginResourcesRank::getTypeName(1) . " - " . __('Begin date'), array('sorton' => 'rank_begin_date')), new PluginReportsColumnDate('rank_end_date', PluginResourcesRank::getTypeName(1) . " - " . __('End date'), array('sorton' => 'rank_end_date')), new PluginReportsColumnLink('prof_id', PluginResourcesProfession::getTypeName(1), 'PluginResourcesProfession', array('sorton' => 'prof_name')), new PluginReportsColumn('prof_code', PluginResourcesProfession::getTypeName(1) . " - " . __('Code', 'resources'), array('sorton' => 'prof_code')), new PluginReportsColumnDate('prof_begin_date', PluginResourcesProfession::getTypeName(1) . " - " . __('Begin date'), array('sorton' => 'prof_begin_date')), new PluginReportsColumnDate('prof_end_date', PluginResourcesProfession::getTypeName(1) . " - " . __('End date'), array('sorton' => 'prof_end_date')))); // SQL statement $condition = getEntitiesRestrictRequest('AND', 'glpi_plugin_resources_professions', '', '', true); $date = date("Y-m-d"); //display only leaving resource with active employment $query = "SELECT `glpi_plugin_resources_ranks`.`id` as rank_id,\n `glpi_plugin_resources_ranks`.`name` as rank_name,\n `glpi_plugin_resources_ranks`.`code` as rank_code,\n `glpi_plugin_resources_ranks`.`begin_date` as rank_begin_date,\n `glpi_plugin_resources_ranks`.`end_date` as rank_end_date,\n `glpi_plugin_resources_professions`.`id` as prof_id,\n `glpi_plugin_resources_professions`.`name` AS prof_name,\n `glpi_plugin_resources_professions`.`code` AS prof_code,\n `glpi_plugin_resources_professions`.`begin_date` AS prof_begin_date,\n `glpi_plugin_resources_professions`.`end_date` AS prof_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 AND ((`glpi_plugin_resources_professions`.`begin_date` IS NULL)\n OR (`glpi_plugin_resources_professions`.`begin_date` < '" . $date . "')\n AND (`glpi_plugin_resources_professions`.`end_date` IS NULL)\n OR (`glpi_plugin_resources_professions`.`end_date` > '" . $date . "')))\n WHERE (`glpi_plugin_resources_ranks`.`is_active` <> `glpi_plugin_resources_professions`.`is_active`)\n OR (`glpi_plugin_resources_ranks`.`begin_date` > `glpi_plugin_resources_professions`.`end_date`)\n OR (`glpi_plugin_resources_ranks`.`end_date` < `glpi_plugin_resources_professions`.`begin_date`)\n OR (`glpi_plugin_resources_ranks`.`end_date` > `glpi_plugin_resources_professions`.`end_date`)\n OR (`glpi_plugin_resources_ranks`.`begin_date` < `glpi_plugin_resources_professions`.`begin_date`)\n OR (`glpi_plugin_resources_ranks`.`end_date` IS NULL AND `glpi_plugin_resources_professions`.`end_date` IS NOT NULL)\n OR (`glpi_plugin_resources_ranks`.`end_date` IS NOT NULL AND `glpi_plugin_resources_professions`.`end_date` IS NULL)\n " . $condition . $report->getOrderBy('rank_id'); $report->setSqlRequest($query); $report->execute();
https://forge.indepnet.net/projects/resources ------------------------------------------------------------------------- LICENSE This file is part of Resources. Resources is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. Resources is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Resources. If not, see <http://www.gnu.org/licenses/>. -------------------------------------------------------------------------- */ if (strpos($_SERVER['PHP_SELF'], "dropdownRank.php")) { include '../../../inc/includes.php'; header("Content-Type: text/html; charset=UTF-8"); Html::header_nocache(); } //allow rank's diplay depending on profession $options = array('plugin_resources_professions_id' => $_POST['plugin_resources_professions_id'], 'entity' => $_POST['entity_restrict'], 'rand' => $_POST['rand'], 'sort' => $_POST['sort']); PluginResourcesRank::showRank($options);
This file is part of Resources. Resources is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. Resources is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Resources. If not, see <http://www.gnu.org/licenses/>. -------------------------------------------------------------------------- */ //Options for GLPI 0.71 and newer : need slave db to access the report $USEDBREPLICATE = 1; $DBCONNECTION_REQUIRED = 1; include "../../../../inc/includes.php"; // Instantiate Report with Name $titre = $LANG['plugin_resources']['resourceemploymentdiff']; $report = new PluginReportsAutoReport($titre); // Columns title (optional) $report->setColumns(array(new PluginReportsColumn('registration_number', __('Administrative number'), array('sorton' => 'registration_number')), new PluginReportsColumnLink('resource_id', __('Name'), 'PluginResourcesResource', array('sorton' => 'resource_name')), new PluginReportsColumn('firstname', __('First name'), array('sorton' => 'firstname')), new PluginReportsColumnInteger('quota', __('Quota', 'resources'), array('sorton' => 'quota')), new PluginReportsColumn('resource_rank', __('Resource', 'resources') . " - " . PluginResourcesRank::getTypeName(1), array('sorton' => 'resource_rank')), new PluginReportsColumn('resource_profession', __('Resource', 'resources') . " - " . PluginResourcesProfession::getTypeName(1), array('sorton' => 'resource_profession')), new PluginReportsColumn('resource_professionline', __('Resource', 'resources') . " - " . PluginResourcesProfessionLine::getTypeName(1), array('sorton' => 'resource_professionline')), new PluginReportsColumn('resource_professioncategory', __('Resource', 'resources') . " - " . PluginResourcesProfessionCategory::getTypeName(1), array('sorton' => 'resource_professioncategory')), new PluginReportsColumnLink('employment_id', __('Name') . " - " . PluginResourcesEmployment::getTypeName(1), 'PluginResourcesEmployment', array('sorton' => 'employment_name')), new PluginReportsColumnFloat('ratio_employment_budget', __('Ratio Employment / Budget', 'resources'), array('sorton' => 'ratio_employment_budget')), new PluginReportsColumn('employment_rank', PluginResourcesEmployment::getTypeName(1) . " - " . PluginResourcesRank::getTypeName(1), array('sorton' => 'employment_rank')), new PluginReportsColumn('employment_profession', PluginResourcesEmployment::getTypeName(1) . " - " . PluginResourcesProfession::getTypeName(1), array('sorton' => 'employment_profession')), new PluginReportsColumn('employment_professionline', PluginResourcesEmployment::getTypeName(1) . " - " . PluginResourcesProfessionLine::getTypeName(1), array('sorton' => 'employment_professionline')), new PluginReportsColumn('employment_professioncategory', PluginResourcesEmployment::getTypeName(1) . " - " . PluginResourcesProfessionCategory::getTypeName(1), array('sorton' => 'employment_professioncategory')), new PluginReportsColumnDate('begin_date', __('Begin date'), array('sorton' => 'begin_date')), new PluginReportsColumnDate('end_date', __('End date'), array('sorton' => 'end_date')), new PluginReportsColumn('employment_state', PluginResourcesEmploymentState::getTypeName(1), array('sorton' => 'employment_state')), new PluginReportsColumn('employer_name', __('Name') . " - " . PluginResourcesEmployer::getTypeName(1), array('sorton' => 'employer_name')))); // SQL statement $condition = getEntitiesRestrictRequest(' AND ', "glpi_plugin_resources_employments", '', '', false); //display only resource which have rank and profession not equal to employment rank or profession $query = "SELECT `glpi_users`.`registration_number`,\n `glpi_users`.`id` as user_id,\n `glpi_plugin_resources_resources`.`id` as resource_id,\n `glpi_plugin_resources_resources`.`name` as resource_name,\n `glpi_plugin_resources_resources`.`firstname`,\n `glpi_plugin_resources_resources`.`quota`,\n `glpi_plugin_resources_ranks`.`name` AS resource_rank,\n `glpi_plugin_resources_professions`.`name` AS resource_profession,\n `glpi_plugin_resources_professionlines`.`name` AS resource_professionline,\n `glpi_plugin_resources_professioncategories`.`name` AS resource_professioncategory,\n `glpi_plugin_resources_employments`.`name` AS employment_name,\n `glpi_plugin_resources_employments`.`id` AS employment_id,\n `glpi_plugin_resources_employments`.`ratio_employment_budget`,\n `glpi_plugin_resources_employmentranks`.`name` AS employment_rank,\n `glpi_plugin_resources_employmentprofessions`.`name` AS employment_profession,\n `glpi_plugin_resources_employmentprofessionlines`.`name` AS employment_professionline,\n `glpi_plugin_resources_employmentprofessioncategories`.`name` AS employment_professioncategory,\n `glpi_plugin_resources_employments`.`begin_date`,\n `glpi_plugin_resources_employments`.`end_date`,\n `glpi_plugin_resources_employmentstates`.`name` AS employment_state,\n `glpi_plugin_resources_employers`.`name` AS employer_name\n FROM `glpi_users`\n LEFT JOIN `glpi_plugin_resources_resources_items`\n ON (`glpi_users`.`id` = `glpi_plugin_resources_resources_items`.`items_id`\n AND `glpi_plugin_resources_resources_items`.`itemtype`= 'User')\n LEFT JOIN `glpi_plugin_resources_resources`\n ON (`glpi_plugin_resources_resources`.`id` = `glpi_plugin_resources_resources_items`.`plugin_resources_resources_id`)\n LEFT JOIN `glpi_plugin_resources_employments`\n ON (`glpi_plugin_resources_resources`.`id` = `glpi_plugin_resources_employments`.`plugin_resources_resources_id` )\n LEFT JOIN `glpi_plugin_resources_ranks`\n ON (`glpi_plugin_resources_resources`.`plugin_resources_ranks_id` = `glpi_plugin_resources_ranks`.`id`)\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_professions` AS `glpi_plugin_resources_employmentprofessions`\n ON (`glpi_plugin_resources_employments`.`plugin_resources_professions_id` = `glpi_plugin_resources_employmentprofessions`.`id`)\n LEFT JOIN `glpi_plugin_resources_employers`\n ON (`glpi_plugin_resources_employments`.`plugin_resources_employers_id` = `glpi_plugin_resources_employers`.`id`)\n LEFT JOIN `glpi_plugin_resources_professionlines`\n ON (`glpi_plugin_resources_professions`.`plugin_resources_professionlines_id` = `glpi_plugin_resources_professionlines`.`id`)\n LEFT JOIN `glpi_plugin_resources_professioncategories`\n ON (`glpi_plugin_resources_professions`.`plugin_resources_professioncategories_id` = `glpi_plugin_resources_professioncategories`.`id`)\n LEFT JOIN `glpi_plugin_resources_ranks` AS `glpi_plugin_resources_employmentranks`\n ON (`glpi_plugin_resources_employments`.`plugin_resources_ranks_id` = `glpi_plugin_resources_employmentranks`.`id`)\n LEFT JOIN `glpi_plugin_resources_professionlines` AS `glpi_plugin_resources_employmentprofessionlines`\n ON (`glpi_plugin_resources_employmentprofessions`.`plugin_resources_professionlines_id` = `glpi_plugin_resources_employmentprofessionlines`.`id`)\n LEFT JOIN `glpi_plugin_resources_professioncategories` AS `glpi_plugin_resources_employmentprofessioncategories`\n ON (`glpi_plugin_resources_employmentprofessions`.`plugin_resources_professioncategories_id` = `glpi_plugin_resources_employmentprofessioncategories`.`id`)\n LEFT JOIN `glpi_plugin_resources_employmentstates`\n ON (`glpi_plugin_resources_employments`.`plugin_resources_employmentstates_id` = `glpi_plugin_resources_employmentstates`.`id`)\n WHERE (`glpi_plugin_resources_resources`.`is_leaving` = 0\n AND `glpi_users`.`is_active` = 1\n AND `glpi_plugin_resources_employments`.`plugin_resources_resources_id` <> 0\n AND `glpi_plugin_resources_resources`.`is_deleted` = '0'\n AND `glpi_plugin_resources_resources`.`is_template` = '0'\n " . $condition . " )\n GROUP BY `glpi_plugin_resources_employments`.`id`, `glpi_users`.`id`\n HAVING (resource_profession <> employment_profession\n OR resource_rank <> employment_rank)" . $report->getOrderBy('registration_number'); $report->setSqlRequest($query); $report->execute();
function getSearchOptions() { $tab = array(); $tab['common'] = self::getTypeName(2); $tab[1]['table'] = $this->table; $tab[1]['field'] = 'registration_number'; $tab[1]['name'] = __('Administrative number'); $tab[1]['datatype'] = 'string'; $tab[2]['table'] = $this->table; $tab[2]['field'] = 'id'; $tab[2]['name'] = __('ID'); $tab[2]['massiveaction'] = false; $tab[2]['datatype'] = 'number'; $tab[2]['nosearch'] = true; // FROM resources $tab[4350]['table'] = 'glpi_plugin_resources_resources'; $tab[4350]['field'] = 'name'; $tab[4350]['name'] = __('Name'); $tab[4350]['datatype'] = 'itemlink'; $tab[4350]['itemlink_type'] = 'PluginResourcesResource'; $tab[4351]['table'] = 'glpi_plugin_resources_resources'; $tab[4351]['field'] = 'firstname'; $tab[4351]['name'] = __('First name'); $tab[4352]['table'] = 'glpi_plugin_resources_resources'; $tab[4352]['field'] = 'quota'; $tab[4352]['name'] = __('Quota', 'resources'); $tab[4352]['datatype'] = 'decimal'; $tab[4353]['table'] = 'glpi_plugin_resources_resourcesituations'; $tab[4353]['field'] = 'name'; $tab[4353]['name'] = PluginResourcesResourceSituation::getTypeName(1); $tab[4353]['datatype'] = 'dropdown'; $tab[4354]['table'] = 'glpi_plugin_resources_contractnatures'; $tab[4354]['field'] = 'name'; $tab[4354]['name'] = PluginResourcesContractNature::getTypeName(1); $tab[4354]['datatype'] = 'dropdown'; $tab[4355]['table'] = 'glpi_plugin_resources_contracttypes'; $tab[4355]['field'] = 'name'; $tab[4355]['name'] = PluginResourcesContractType::getTypeName(1); $tab[4355]['datatype'] = 'dropdown'; $tab[4356]['table'] = 'glpi_plugin_resources_resourcespecialities'; $tab[4356]['field'] = 'name'; $tab[4356]['name'] = PluginResourcesResourceSpeciality::getTypeName(1); $tab[4356]['datatype'] = 'dropdown'; $tab[4357]['table'] = 'glpi_plugin_resources_ranks'; $tab[4357]['field'] = 'name'; $tab[4357]['name'] = PluginResourcesRank::getTypeName(1); $tab[4357]['datatype'] = 'dropdown'; $tab[4358]['table'] = 'glpi_plugin_resources_professions'; $tab[4358]['field'] = 'name'; $tab[4358]['name'] = PluginResourcesProfession::getTypeName(1); $tab[4358]['datatype'] = 'dropdown'; $tab[4359]['table'] = 'glpi_plugin_resources_professionlines'; $tab[4359]['field'] = 'name'; $tab[4359]['name'] = PluginResourcesProfessionLine::getTypeName(1); $tab[4359]['datatype'] = 'dropdown'; $tab[4360]['table'] = 'glpi_plugin_resources_professioncategories'; $tab[4360]['field'] = 'name'; $tab[4360]['name'] = PluginResourcesProfessionCategory::getTypeName(1); $tab[4360]['datatype'] = 'dropdown'; $tab[4376]['table'] = 'glpi_plugin_resources_resources'; $tab[4376]['field'] = 'date_begin'; $tab[4376]['name'] = __('Arrival date', 'resources'); $tab[4376]['datatype'] = 'date'; $tab[4377]['table'] = 'glpi_plugin_resources_resources'; $tab[4377]['field'] = 'date_end'; $tab[4377]['name'] = __('Departure date', 'resources'); $tab[4377]['datatype'] = 'date'; // FROM employment $tab[4361]['table'] = 'glpi_plugin_resources_employments'; $tab[4361]['field'] = 'name'; $tab[4361]['name'] = __('Name') . " - " . PluginResourcesEmployment::getTypeName(1); $tab[4361]['forcegroupby'] = true; $tab[4362]['table'] = 'glpi_plugin_resources_employments'; $tab[4362]['field'] = 'ratio_employment_budget'; $tab[4362]['name'] = __('Ratio Employment / Budget', 'resources'); $tab[4362]['datatype'] = 'decimal'; $tab[4363]['table'] = 'glpi_plugin_resources_employmentranks'; $tab[4363]['field'] = 'name'; $tab[4363]['name'] = PluginResourcesEmployment::getTypeName(1) . " - " . PluginResourcesRank::getTypeName(1); $tab[4363]['datatype'] = 'dropdown'; $tab[4364]['table'] = 'glpi_plugin_resources_employmentprofessions'; $tab[4364]['field'] = 'name'; $tab[4364]['name'] = PluginResourcesEmployment::getTypeName(1) . " - " . PluginResourcesProfession::getTypeName(1); $tab[4364]['datatype'] = 'dropdown'; $tab[4365]['table'] = 'glpi_plugin_resources_employmentprofessionlines'; $tab[4365]['field'] = 'name'; $tab[4365]['name'] = PluginResourcesEmployment::getTypeName(1) . " - " . PluginResourcesProfessionLine::getTypeName(1); $tab[4365]['datatype'] = 'dropdown'; $tab[4366]['table'] = 'glpi_plugin_resources_employmentprofessioncategories'; $tab[4366]['field'] = 'name'; $tab[4366]['name'] = PluginResourcesEmployment::getTypeName(1) . " - " . PluginResourcesProfessionCategory::getTypeName(1); $tab[4366]['datatype'] = 'dropdown'; $tab[4367]['table'] = 'glpi_plugin_resources_employments'; $tab[4367]['field'] = 'begin_date'; $tab[4367]['name'] = __('Begin date'); $tab[4367]['datatype'] = 'date'; $tab[4368]['table'] = 'glpi_plugin_resources_employments'; $tab[4368]['field'] = 'end_date'; $tab[4368]['name'] = __('End date'); $tab[4368]['datatype'] = 'date'; $tab[4369]['table'] = 'glpi_plugin_resources_employmentstates'; $tab[4369]['field'] = 'name'; $tab[4369]['name'] = PluginResourcesEmploymentState::getTypeName(1); $tab[4369]['datatype'] = 'dropdown'; //From employer $tab[4370]['table'] = 'glpi_plugin_resources_employers'; $tab[4370]['field'] = 'completename'; $tab[4370]['name'] = PluginResourcesEmployer::getTypeName(1); $tab[4370]['datatype'] = 'dropdown'; $tab[4371]['table'] = 'glpi_locations'; $tab[4371]['field'] = 'completename'; $tab[4371]['name'] = __('Employer address', 'resources'); $tab[4371]['datatype'] = 'dropdown'; $tab[4372]['table'] = 'glpi_plugin_resources_employmentranks'; $tab[4372]['field'] = 'id'; $tab[4372]['name'] = PluginResourcesEmployment::getTypeName(1) . " - " . PluginResourcesRank::getTypeName(1) . " - " . __('ID'); $tab[4373]['table'] = 'glpi_plugin_resources_employmentprofessions'; $tab[4373]['field'] = 'id'; $tab[4373]['name'] = PluginResourcesEmployment::getTypeName(1) . " - " . PluginResourcesProfession::getTypeName(1) . " - " . __('ID'); $tab[4374]['table'] = 'glpi_plugin_resources_ranks'; $tab[4374]['field'] = 'id'; $tab[4374]['name'] = PluginResourcesResource::getTypeName(1) . " - " . PluginResourcesRank::getTypeName(1) . " - " . __('ID'); $tab[4375]['table'] = 'glpi_plugin_resources_professions'; $tab[4375]['field'] = 'id'; $tab[4375]['name'] = PluginResourcesResource::getTypeName(1) . " - " . PluginResourcesProfession::getTypeName(1) . " - " . __('ID'); return $tab; }
$query = "SELECT `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 0 AS rank_name, 0 AS rank_code,\n `glpi_plugin_resources_professions`.`begin_date`,\n `glpi_plugin_resources_professions`.`end_date`\n FROM `glpi_plugin_resources_professions`\n LEFT JOIN `glpi_plugin_resources_budgets`\n ON (`glpi_plugin_resources_budgets`.`plugin_resources_professions_id` = `glpi_plugin_resources_professions`.`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_professions`.`id` IN (" . $professionsResourceList . ")\n AND `glpi_plugin_resources_professions`.`is_active` = 1\n AND ((`glpi_plugin_resources_professions`.`end_date` IS NULL )\n OR (`glpi_plugin_resources_professions`.`end_date` > '" . $date . "' ))\n AND ((`glpi_plugin_resources_professions`.`begin_date` IS NULL)\n OR ( `glpi_plugin_resources_professions`.`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; $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++; } } }
$num = 1; $link = $_SERVER['PHP_SELF']; $order = 'ASC'; $issort = false; echo Search::showHeader($output_type, $nbrows, $nbcols, true); echo Search::showNewLine($output_type); showTitle($output_type, $num, __('Entity'), 'entity', true); showTitle($output_type, $num, __('Type'), 'type'); showTitle($output_type, $num, __('Name'), 'name', true); showTitle($output_type, $num, __('First name'), 'firstname', true); showTitle($output_type, $num, __('Administrative number'), 'registration_number', true); showTitle($output_type, $num, PluginResourcesRank::getTypeName(1), 'rank', true); showTitle($output_type, $num, __('Arrival date', 'resources'), 'date_begin', true); showTitle($output_type, $num, __('Departure date', 'resources'), 'date_end', true); showTitle($output_type, $num, PluginResourcesRank::getTypeName(1) . " - " . __('Begin date'), 'begin_date', true); showTitle($output_type, $num, PluginResourcesRank::getTypeName(1) . " - " . __('End date'), 'end_date', true); echo Search::showEndLine($output_type); if ($limit) { $dataAll = array_slice($dataAll, $start, $limit); } foreach ($dataAll as $key => $data) { $num = 1; echo Search::showNewLine($output_type); echo Search::showItem($output_type, Dropdown::getDropdownName('glpi_entities', $data['entity']), $num, $key); if ($data['typeName'] == 'Resource') { $type = PluginResourcesResource::getTypeName(0); $link = Toolbox::getItemTypeFormURL("PluginResourcesResource"); } else { if ($data['typeName'] == 'Employment') { $type = PluginResourcesEmployment::getTypeName(0); $link = Toolbox::getItemTypeFormURL("PluginResourcesEmployment");
Resources is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. Resources is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Resources. If not, see <http://www.gnu.org/licenses/>. -------------------------------------------------------------------------- */ //Options for GLPI 0.71 and newer : need slave db to access the report $USEDBREPLICATE = 1; $DBCONNECTION_REQUIRED = 0; include "../../../../inc/includes.php"; //"Rapport listant les ressources partantes ayant des emplois actifs" //"Report listing resource leaving with employment active"; // Instantiate Report with Name $titre = $LANG['plugin_resources']['resourceleavingwithactiveemployment']; $report = new PluginReportsAutoReport($titre); // Columns title (optional), from $LANG $report->setColumns(array(new PluginReportsColumnInteger('registration_number', __('Administrative number'), array('sorton' => 'registration_number')), new PluginReportsColumnLink('resource_id', __('Name'), 'PluginResourcesResource', array('sorton' => 'resource_name')), new PluginReportsColumn('firstname', __('First name'), array('sorton' => 'firstname')), new PluginReportsColumn('resource_rank', PluginResourcesRank::getTypeName(1), array('sorton' => 'resource_rank')), new PluginReportsColumn('resources_situation', PluginResourcesResourceSituation::getTypeName(1), array('sorton' => 'resources_situation')), new PluginReportsColumn('resource_state', PluginResourcesResourceState::getTypeName(1), array('sorton' => 'resource_state')), new PluginReportsColumnDate('date_begin', __('Arrival date', 'resources'), array('sorton' => 'date_begin')), new PluginReportsColumnDate('date_end', __('Departure date', 'resources'), array('sorton' => 'date_end')), new PluginReportsColumnLink('employment_id', __('Name') . " - " . _n('Employment', 'Employments', 1, 'resources'), 'PluginResourcesEmployment', array('sorton' => 'employment_name')), new PluginReportsColumn('employment_profession', _n('Employment', 'Employments', 1, 'resources') . " - " . _n('Profession', 'Professions', 2, 'resources'), array('sorton' => 'employment_profession')), new PluginReportsColumn('employment_state', _n('Employment state', 'Employment states', 1, 'resources'), array('sorton' => 'employment_state')), new PluginReportsColumn('employer_name', __('Name') . " - " . _n('Employer', 'Employers', 1, 'resources'), array('sorton' => 'employer_name')))); // SQL statement $condition = getEntitiesRestrictRequest(' AND ', "glpi_plugin_resources_resources", '', '', false); //display only leaving resource with active employment $query = "SELECT `glpi_users`.`registration_number`,\n `glpi_users`.`id` as user_id,\n `glpi_plugin_resources_resources`.`id` as resource_id,\n `glpi_plugin_resources_resources`.`name` as resource_name,\n `glpi_plugin_resources_resources`.`firstname`,\n `glpi_plugin_resources_ranks`.`name` AS resource_rank,\n `glpi_plugin_resources_resourcesituations`.`name` AS resources_situation,\n `glpi_plugin_resources_resourcestates`.`name` AS resource_state,\n `glpi_plugin_resources_resources`.`date_begin`,\n `glpi_plugin_resources_resources`.`date_end`,\n `glpi_plugin_resources_employments`.`name` AS employment_name,\n `glpi_plugin_resources_employments`.`id` AS employment_id,\n `glpi_plugin_resources_employmentprofessions`.`name` AS employment_profession,\n `glpi_plugin_resources_employmentstates`.`name` AS employment_state,\n `glpi_plugin_resources_employers`.`completename` AS employer_name\n FROM `glpi_users`\n LEFT JOIN `glpi_plugin_resources_resources_items`\n ON (`glpi_users`.`id` = `glpi_plugin_resources_resources_items`.`items_id`\n AND `glpi_plugin_resources_resources_items`.`itemtype`= 'User')\n LEFT JOIN `glpi_plugin_resources_resources`\n ON (`glpi_plugin_resources_resources`.`id` = `glpi_plugin_resources_resources_items`.`plugin_resources_resources_id`)\n LEFT JOIN `glpi_plugin_resources_resourcesituations`\n ON (`glpi_plugin_resources_resources`.`plugin_resources_resourcesituations_id` = `glpi_plugin_resources_resourcesituations`.`id`)\n LEFT JOIN `glpi_plugin_resources_resourcestates`\n ON (`glpi_plugin_resources_resources`.`plugin_resources_resourcestates_id` = `glpi_plugin_resources_resourcestates`.`id`)\n LEFT JOIN `glpi_plugin_resources_employments`\n ON (`glpi_plugin_resources_resources`.`id` = `glpi_plugin_resources_employments`.`plugin_resources_resources_id` )\n LEFT JOIN `glpi_plugin_resources_ranks`\n ON (`glpi_plugin_resources_resources`.`plugin_resources_ranks_id` = `glpi_plugin_resources_ranks`.`id`)\n LEFT JOIN `glpi_plugin_resources_professions` AS `glpi_plugin_resources_employmentprofessions`\n ON (`glpi_plugin_resources_employments`.`plugin_resources_professions_id` = `glpi_plugin_resources_employmentprofessions`.`id`)\n LEFT JOIN `glpi_plugin_resources_employers`\n ON (`glpi_plugin_resources_employments`.`plugin_resources_employers_id` = `glpi_plugin_resources_employers`.`id`)\n LEFT JOIN `glpi_plugin_resources_employmentstates`\n ON (`glpi_plugin_resources_employments`.`plugin_resources_employmentstates_id` = `glpi_plugin_resources_employmentstates`.`id`)\n WHERE (`glpi_plugin_resources_resources`.`is_leaving` = 1\n AND `glpi_users`.`is_active` = 1\n AND `glpi_plugin_resources_employments`.`plugin_resources_resources_id` <> 0\n AND `glpi_plugin_resources_resources`.`is_deleted` = '0'\n AND `glpi_plugin_resources_resources`.`is_template` = '0'\n AND `glpi_plugin_resources_employmentstates`.`is_active` = 1\n " . $condition . " )\n GROUP BY `glpi_plugin_resources_employments`.`id`, `glpi_users`.`id`" . $report->getOrderBy('registration_number'); $report->setSqlRequest($query); $report->execute();
function doSpecificMassiveActions($input = array()) { $res = array('ok' => 0, 'ko' => 0, 'noright' => 0); $resource_item = new PluginResourcesResource_Item(); switch ($input['action']) { case "Transfert": if ($input['itemtype'] == 'PluginResourcesResource') { foreach ($input["item"] as $key => $val) { if ($val == 1) { $this->getFromDB($key); $contracttype = PluginResourcesContractType::transfer($PluginResourcesResource->fields["plugin_resources_contracttypes_id"], $input['entities_id']); if ($contracttype > 0) { $values["id"] = $key; $values["plugin_resources_contracttypes_id"] = $contracttype; $this->update($values); } unset($values); $resourcestate = PluginResourcesResourceState::transfer($PluginResourcesResource->fields["plugin_resources_resourcestates_id"], $input['entities_id']); if ($resourcestate > 0) { $values["id"] = $key; $values["plugin_resources_resourcestates_id"] = $resourcestate; $this->update($values); } unset($values); $department = PluginResourcesDepartment::transfer($PluginResourcesResource->fields["plugin_resources_departments_id"], $input['entities_id']); if ($department > 0) { $values["id"] = $key; $values["plugin_resources_departments_id"] = $department; $this->update($values); } unset($values); $situation = PluginResourcesResourceSituation::transfer($PluginResourcesResource->fields["plugin_resources_resourcesituations_id"], $input['entities_id']); if ($situation > 0) { $values["id"] = $key; $values["plugin_resources_resourcesituations_id"] = $situation; $this->update($values); } unset($values); $contractnature = PluginResourcesContractNature::transfer($PluginResourcesResource->fields["plugin_resources_contractnatures_id"], $input['entities_id']); if ($contractnature > 0) { $values["id"] = $key; $values["plugin_resources_contractnatures_id"] = $contractnature; $this->update($values); } unset($values); $rank = PluginResourcesRank::transfer($PluginResourcesResource->fields["plugin_resources_ranks_id"], $input['entities_id']); if ($rank > 0) { $values["id"] = $key; $values["plugin_resources_ranks_id"] = $rank; $this->update($values); } unset($values); $speciality = PluginResourcesResourceSpeciality::transfer($PluginResourcesResource->fields["plugin_resources_resourcespecialities_id"], $input['entities_id']); if ($speciality > 0) { $values["id"] = $key; $values["plugin_resources_resourcespecialities_id"] = $speciality; $this->update($values); } unset($values); $PluginResourcesTask = new PluginResourcesTask(); $restrict = "`plugin_resources_resources_id` = '" . $key . "'"; $tasks = getAllDatasFromTable("glpi_plugin_resources_tasks", $restrict); if (!empty($tasks)) { foreach ($tasks as $task) { $PluginResourcesTask->getFromDB($task["id"]); $tasktype = PluginResourcesTaskType::transfer($PluginResourcesTask->fields["plugin_resources_tasktypes_id"], $input['entities_id']); if ($tasktype > 0) { $values["id"] = $task["id"]; $values["plugin_resources_tasktypes_id"] = $tasktype; $PluginResourcesTask->update($values); } $values["id"] = $task["id"]; $values["entities_id"] = $input['entities_id']; $PluginResourcesTask->update($values); } } unset($values); $PluginResourcesEmployment = new PluginResourcesEmployment(); $restrict = "`plugin_resources_resources_id` = '" . $key . "'"; $employments = getAllDatasFromTable("glpi_plugin_resources_employments", $restrict); if (!empty($employments)) { foreach ($employments as $employment) { $PluginResourcesEmployment->getFromDB($employment["id"]); $rank = PluginResourcesRank::transfer($PluginResourcesEmployment->fields["plugin_resources_ranks_id"], $input['entities_id']); if ($rank > 0) { $values["id"] = $employment["id"]; $values["plugin_resources_ranks_id"] = $rank; $PluginResourcesEmployment->update($values); } $PluginResourcesEmployment->getFromDB($employment["id"]); $profession = PluginResourcesProfession::transfer($PluginResourcesEmployment->fields["plugin_resources_professions_id"], $input['entities_id']); if ($profession > 0) { $values["id"] = $employment["id"]; $values["plugin_resources_professions_id"] = $profession; $PluginResourcesEmployment->update($values); } $values["id"] = $employment["id"]; $values["entities_id"] = $input['entities_id']; $PluginResourcesEmployment->update($values); } } unset($values); $PluginResourcesEmployee = new PluginResourcesEmployee(); $restrict = "`plugin_resources_resources_id` = '" . $key . "'"; $employees = getAllDatasFromTable("glpi_plugin_resources_employees", $restrict); if (!empty($employees)) { foreach ($employees as $employee) { $employer = PluginResourcesEmployer::transfer($employee["plugin_resources_employers_id"], $input['entities_id']); if ($employer > 0) { $values["id"] = $employee["id"]; $values["plugin_resources_employers_id"] = $employer; $PluginResourcesEmployee->update($values); } $client = PluginResourcesClient::transfer($employee["plugin_resources_clients_id"], $input['entities_id']); if ($client > 0) { $values["id"] = $employee["id"]; $values["plugin_resources_clients_id"] = $client; $PluginResourcesEmployee->update($values); } } } unset($values); $query = "UPDATE `glpi_plugin_resources_checklists`\n SET `entities_id` = '" . $input['entities_id'] . "'\n WHERE `plugin_resources_resources_id` ='{$key}'"; $DB->query($query); $values["id"] = $key; $values["entities_id"] = $input['entities_id']; if ($this->update($values)) { $res['ok']++; } else { $res['ko']++; } } } } break; case "Install": foreach ($input["item"] as $key => $val) { if ($val == 1) { $values = array('plugin_resources_resources_id' => $key, 'items_id' => $input["item_item"], 'itemtype' => $input['typeitem']); if ($resource_item->add($values)) { $res['ok']++; } else { $res['ko']++; } } } break; case "Desinstall": foreach ($input["item"] as $key => $val) { if ($val == 1) { if ($resource_item->deleteItemByResourcesAndItem($key, $input['item_item'], $input['typeitem'])) { $res['ok']++; } else { $res['ko']++; } } } break; case "Send": if ($this->sendEmail($input)) { $res['ok']++; } else { $res['ko']++; } break; default: return parent::doSpecificMassiveActions($input); break; } return $res; }
} } } if ($res && $nbtot > 0) { $nbcols = $DB->num_fields($res); $nbrows = $DB->numrows($res); $num = 1; $link = $_SERVER['PHP_SELF']; $order = 'ASC'; $issort = false; echo Search::showHeader($output_type, $nbrows, $nbcols, true); echo Search::showNewLine($output_type); showTitle($output_type, $num, PluginResourcesProfessionCategory::getTypeName(1), 'professioncategory', true); showTitle($output_type, $num, PluginResourcesProfessionLine::getTypeName(1), 'professionline', true); showTitle($output_type, $num, PluginResourcesProfession::getTypeName(1), 'profession', true); showTitle($output_type, $num, PluginResourcesRank::getTypeName(1), 'rank', true); showTitle($output_type, $num, __('Begin date'), 'begin_date', true); showTitle($output_type, $num, __('End date'), 'end_date', true); showTitle($output_type, $num, PluginResourcesBudgetType::getTypeName(1), 'budget_type', true); showTitle($output_type, $num, __('Budget volume(qty)', 'resources'), 'qt_vol_budg_vot', true); showTitle($output_type, $num, __('Employment volume (qty)', 'resources'), 'qt_vol_budg_use'); showTitle($output_type, $num, __('Resource volume (qty)', 'resources'), 'qt_vol_real'); showTitle($output_type, $num, __('Remaining budget - employment (qty)', 'resources'), 'solde_qt'); showTitle($output_type, $num, __('Budget volume (€)', 'resources'), 'vol_budg_vot'); showTitle($output_type, $num, __('Employment volume (€)', 'resources'), 'vol_budg_use'); showTitle($output_type, $num, __('Resource volume (€)', 'resources'), 'vol_real'); showTitle($output_type, $num, __('Remaining budget - employment (€)', 'resources'), 'solde'); echo Search::showEndLine($output_type); $totalvolbudget = 0; $totalvolemployment = 0; $totalvolresource = 0;
function getActions() { $actions = array(); $actions['requiredfields_name']['name'] = __('Name'); $actions['requiredfields_name']['type'] = "yesonly"; $actions['requiredfields_name']['force_actions'] = array('assign'); $actions['requiredfields_name']['type'] = "yesonly"; $actions['requiredfields_firstname']['name'] = __('First name'); $actions['requiredfields_firstname']['type'] = "yesonly"; $actions['requiredfields_firstname']['force_actions'] = array('assign'); $actions['requiredfields_locations_id']['name'] = __('Location'); $actions['requiredfields_locations_id']['type'] = "yesonly"; $actions['requiredfields_locations_id']['force_actions'] = array('assign'); $actions['requiredfields_users_id']['name'] = __('Resource manager', 'resources'); $actions['requiredfields_users_id']['type'] = "yesonly"; $actions['requiredfields_users_id']['force_actions'] = array('assign'); $actions['requiredfields_plugin_resources_departments_id']['name'] = PluginResourcesDepartment::getTypeName(1); $actions['requiredfields_plugin_resources_departments_id']['type'] = "yesonly"; $actions['requiredfields_plugin_resources_departments_id']['force_actions'] = array('assign'); $actions['requiredfields_date_begin']['name'] = __('Arrival date', 'resources'); $actions['requiredfields_date_begin']['type'] = "yesonly"; $actions['requiredfields_date_begin']['force_actions'] = array('assign'); $actions['requiredfields_date_end']['name'] = __('Departure date', 'resources'); $actions['requiredfields_date_end']['type'] = "yesonly"; $actions['requiredfields_date_end']['force_actions'] = array('assign'); $actions['requiredfields_quota']['name'] = __('Quota', 'resources'); $actions['requiredfields_quota']['type'] = "yesonly"; $actions['requiredfields_quota']['force_actions'] = array('assign'); if (plugin_resources_haveRight('dropdown_public', 'w')) { $actions['requiredfields_plugin_resources_resourcesituations_id']['name'] = PluginResourcesResourceSituation::getTypeName(1); $actions['requiredfields_plugin_resources_resourcesituations_id']['type'] = "yesonly"; $actions['requiredfields_plugin_resources_resourcesituations_id']['force_actions'] = array('assign'); $actions['requiredfields_plugin_resources_ranks_id']['name'] = PluginResourcesRank::getTypeName(1); $actions['requiredfields_plugin_resources_ranks_id']['type'] = "yesonly"; $actions['requiredfields_plugin_resources_ranks_id']['force_actions'] = array('assign'); } return $actions; }
function getTags() { $tags = array('resource.id' => 'ID', 'resource.name' => __('Name'), 'resource.firstname' => __('First name'), 'resource.type' => PluginResourcesContractType::getTypeName(1), 'resource.quota' => __('Quota', 'resources'), 'resource.situation' => PluginResourcesResourceSituation::getTypeName(1), 'resource.contractnature' => PluginResourcesContractNature::getTypeName(1), 'resource.rank' => PluginResourcesRank::getTypeName(1), 'resource.speciality' => PluginResourcesResourceSpeciality::getTypeName(1), 'resource.users' => __('Resource manager', 'resources'), 'resource.usersrecipient' => __('Requester'), 'resource.datedeclaration' => __('Request date'), 'resource.datebegin' => __('Arrival date', 'resources'), 'resource.dateend' => __('Departure date', 'resources'), 'resource.department' => PluginResourcesDepartment::getTypeName(1), 'resource.location' => __('Location'), 'resource.comment' => __('Description'), 'resource.usersleaving' => __('Informant of leaving', 'resources'), 'resource.leaving' => __('Declared as leaving', 'resources'), 'resource.leavingreason' => PluginResourcesLeavingReason::getTypeName(1), 'resource.helpdesk' => __('Associable to a ticket'), 'resource.action_user' => __('Last updater'), 'update.name' => __('Name'), 'update.firstname' => __('First name'), 'update.type' => PluginResourcesContractType::getTypeName(1), 'update.quota' => __('Quota', 'resources'), 'update.situation' => PluginResourcesResourceSituation::getTypeName(1), 'update.contractnature' => PluginResourcesContractNature::getTypeName(1), 'update.rank' => PluginResourcesRank::getTypeName(1), 'update.speciality' => PluginResourcesResourceSpeciality::getTypeName(1), 'update.users' => __('Resource manager', 'resources'), 'update.usersrecipient' => __('Requester'), 'update.datedeclaration' => __('Request date'), 'update.datebegin' => __('Arrival date', 'resources'), 'update.dateend' => __('Departure date', 'resources'), 'update.department' => PluginResourcesDepartment::getTypeName(1), 'update.status' => PluginResourcesResourceState::getTypeName(1), 'update.location' => __('Location'), 'update.comment' => __('Description'), 'update.usersleaving' => __('Informant of leaving', 'resources'), 'update.leaving' => __('Declared as leaving', 'resources'), 'update.leavingreason' => PluginResourcesLeavingReason::getTypeName(1), 'update.helpdesk' => __('Associable to a ticket'), 'task.name' => __('Name'), 'task.type' => __('Type'), 'task.users' => __('Technician'), 'task.groups' => __('Group'), 'task.datebegin' => __('Begin date'), 'task.dateend' => __('End date'), 'task.planned' => __('Used for planning', 'resources'), 'task.realtime' => __('Effective duration', 'resources'), 'task.finished' => __('Carried out task', 'resources'), 'task.comment' => __('Description')); foreach ($tags as $tag => $label) { $this->addTagToList(array('tag' => $tag, 'label' => $label, 'value' => true)); } $this->addTagToList(array('tag' => 'resource', 'label' => __('At creation, update, removal of a resource', 'resources'), 'value' => false, 'foreach' => true, 'events' => array('new', 'update', 'delete', 'report', 'newresting', 'updateresting', 'deleteresting', 'newholiday', 'updateholiday', 'deleteholiday'))); $this->addTagToList(array('tag' => 'updates', 'label' => __('Modified fields', 'resources'), 'value' => false, 'foreach' => true, 'events' => array('update', 'updateresting', 'updateholiday'))); $this->addTagToList(array('tag' => 'tasks', 'label' => __('At creation, update, removal of a task', 'resources'), 'value' => false, 'foreach' => true, 'events' => array('newtask', 'updatetask', 'deletetask'))); asort($this->tag_descriptions); }
function plugin_resources_getDropdown() { $plugin = new Plugin(); if ($plugin->isActivated("resources")) { return array('PluginResourcesContractType' => PluginResourcesContractType::getTypeName(2), 'PluginResourcesTaskType' => PluginResourcesTaskType::getTypeName(2), 'PluginResourcesResourceState' => PluginResourcesResource::getTypeName(2) . " - " . PluginResourcesResourceSituation::getTypeName(2), 'PluginResourcesDepartment' => PluginResourcesDepartment::getTypeName(2), 'PluginResourcesEmployer' => PluginResourcesEmployer::getTypeName(2), 'PluginResourcesClient' => PluginResourcesClient::getTypeName(2), 'PluginResourcesChoiceItem' => PluginResourcesChoiceItem::getTypeName(2), 'PluginResourcesResourceSituation' => PluginResourcesEmployer::getTypeName(2) . " - " . PluginResourcesResourceSituation::getTypeName(2), 'PluginResourcesContractNature' => PluginResourcesContractNature::getTypeName(2), 'PluginResourcesRank' => PluginResourcesRank::getTypeName(2), 'PluginResourcesResourceSpeciality' => PluginResourcesResourceSpeciality::getTypeName(2), 'PluginResourcesLeavingReason' => PluginResourcesLeavingReason::getTypeName(2), 'PluginResourcesProfession' => PluginResourcesProfession::getTypeName(2), 'PluginResourcesProfessionLine' => PluginResourcesProfessionLine::getTypeName(2), 'PluginResourcesProfessionCategory' => PluginResourcesProfessionCategory::getTypeName(2), 'PluginResourcesEmploymentState' => PluginResourcesEmploymentState::getTypeName(2), 'PluginResourcesBudgetType' => PluginResourcesBudgetType::getTypeName(2), 'PluginResourcesBudgetVolume' => PluginResourcesBudgetVolume::getTypeName(2), 'PluginResourcesCost' => PluginResourcesCost::getTypeName(2)); } else { return array(); } }