├── resources.png ├── locales ├── cs_CZ.mo ├── de_DE.mo ├── en_GB.mo ├── es_AR.mo ├── es_EC.mo ├── es_ES.mo ├── fr_FR.mo ├── id_ID.mo ├── it_IT.mo ├── pl_PL.mo ├── pt_BR.mo ├── pt_PT.mo ├── ro_RO.mo ├── ru_RU.mo ├── sv_SE.mo └── tr_TR.mo ├── public ├── pics │ ├── add.png │ ├── conf.png │ ├── logo.png │ ├── nobody.png │ ├── recap.png │ ├── csv_file.png │ ├── database.png │ ├── budgetlist.png │ ├── card_footer.png │ ├── csv_check.png │ ├── directory.png │ ├── employment.png │ ├── holidaylist.png │ ├── newresource.png │ ├── newresting.png │ ├── restinglist.png │ ├── card_content.png │ ├── closeresting.png │ ├── csv_file_red.png │ ├── deleteresting.png │ ├── gallery │ │ ├── Phone.jpg │ │ ├── Computer.jpg │ │ ├── Monitor.jpg │ │ ├── Printer.jpg │ │ ├── nothing.png │ │ ├── Peripheral.jpg │ │ ├── PluginBadgesBadge.jpg │ │ ├── PluginOrderOrder.jpg │ │ ├── PluginProjetProjet.jpg │ │ ├── PluginSimcardSimcard.jpg │ │ ├── PluginAccountsAccount.jpg │ │ └── PluginResourcesResource.jpg │ ├── habilitation.png │ ├── miniresources.png │ ├── puce-delete2.png │ ├── resourcelist.png │ ├── detailresource.png │ ├── employmentlist.png │ ├── habilitationnew.png │ ├── holidayresource.png │ ├── nav_item_active.png │ ├── removeresource.png │ ├── resource_check.png │ ├── transferresource.png │ ├── habilitationdelete.png │ └── card_header_matte_blue.png └── lib │ ├── pics │ └── jquery │ │ └── jstree │ │ ├── 32px.png │ │ ├── 40px.png │ │ └── throbber.gif │ ├── jstree │ └── themes │ │ ├── default │ │ ├── 32px.png │ │ ├── 40px.png │ │ └── throbber.gif │ │ └── default-dark │ │ ├── 32px.png │ │ ├── 40px.png │ │ └── throbber.gif │ └── resources_card.js ├── install ├── sql │ ├── update-2.6.4.sql │ ├── update-1.5.1.sql │ ├── update-4.0.3.sql │ ├── update-4.0.0.sql │ ├── update-2.6.3.sql │ ├── update-4.0.6.sql │ ├── update-4.0.7.sql │ ├── update-1.9.1.sql │ ├── update-4.0.8.sql │ ├── update-2.3.3.sql │ ├── update-2.0.4.sql │ ├── update-4.0.4.sql │ ├── update-1.6.2.sql │ ├── update-1.6.1.sql │ ├── update-2.0.3.sql │ ├── update-3.0.5.sql │ ├── update-2.4.4.sql │ ├── update-1.7.1.sql │ ├── update-2.7.2.sql │ └── update-4.0.2.sql └── index.php ├── lib ├── pics │ └── jquery │ │ └── jstree │ │ ├── 32px.png │ │ ├── 40px.png │ │ └── throbber.gif ├── jstree │ └── themes │ │ ├── default │ │ ├── 32px.png │ │ ├── 40px.png │ │ └── throbber.gif │ │ └── default-dark │ │ ├── 32px.png │ │ ├── 40px.png │ │ └── throbber.gif └── resources_card.js ├── report ├── userwithnoresource │ ├── userwithnoresource.en_GB.php │ ├── userwithnoresource.fr_FR.php │ └── index.php ├── index.php ├── checkgroup │ └── index.php ├── budgetsummary │ └── index.php ├── checkhabilitation │ └── index.php ├── checkmissingN0group │ └── index.php ├── checkmissingN1group │ └── index.php ├── lapserankprofession │ └── index.php ├── professionwithoutcost │ └── index.php ├── resourcewithoutuser │ └── index.php ├── professionwithoutvolume │ └── index.php ├── resourceemploymentdiff │ └── index.php ├── resourcewithoutemployment │ └── index.php ├── resourceemploymentwithlapserank │ └── index.php ├── userwithmorethanoneresource │ └── index.php ├── resourceleavingwithactiveemployment │ └── index.php └── resourceemploymentwithlapseprofession │ └── index.php ├── composer.json ├── ISSUE_TEMPLATE.md ├── tools ├── update_mo.pl ├── update_po.pl └── extract_template.sh ├── .github └── workflows │ ├── updatepot.yml │ └── generatemo.yml ├── index.php ├── ajax ├── index.php ├── getitemtype.php ├── resourcetree.php ├── inputtext.php ├── resourceinfo.php ├── planningend.php ├── dropdownRank.php ├── dropdownSpeciality.php ├── checkComputerResource.php ├── dropdownRole.php ├── dropdownContractnature.php ├── dropdownMassiveActionReports.php ├── dropdownLocation.php ├── resourcebadge.php ├── resourceresting.php ├── linkItems.php ├── employee.php ├── resourcechange.php ├── dropdownService.php ├── viewchecklisttask.php ├── addneedcomment.php ├── verifyCSVStatistics.php └── comments.php ├── front ├── index.php ├── rulechecklist.php ├── rulecontracttype.php ├── rulechecklist.form.php ├── rulecontracttype.form.php ├── rulecontracttypehidden.php ├── rulecontracttypehidden.form.php ├── picture.send.php ├── setup.templates.php ├── budget.php ├── import.php ├── adconfig.form.php ├── checklistconfig.php ├── leavinginformation.form.php ├── resource_change.form.php ├── actionprofile.form.php ├── importcolumn.form.php ├── employment.php ├── task.php ├── contracttypeprofile.form.php ├── popup.php ├── checklistconfig.form.php ├── employee.form.php ├── import.form.php ├── menu.php ├── importresource.form.php ├── resourceholiday.php ├── resourceresting.php ├── budget.form.php ├── rulesengine.test.php ├── checklist.form.php ├── resource.transfer.php ├── directory.php ├── resourcehabilitation.form.php ├── config.form.php ├── resourceimport.form.php └── rule.test.php ├── src ├── Recipient.php ├── Recipient_Leaving.php ├── Location.php ├── Manager.php ├── EmploymentRank.php ├── EmploymentProfession.php ├── EmploymentProfessionLine.php ├── EmploymentProfessionCategory.php ├── Department_Service.php ├── Role_Service.php ├── ResourceFunction.php ├── RuleContracttypeCollection.php └── RuleContracttypeHiddenCollection.php └── README.md /resources.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfotelGLPI/resources/master/resources.png -------------------------------------------------------------------------------- /locales/cs_CZ.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfotelGLPI/resources/master/locales/cs_CZ.mo -------------------------------------------------------------------------------- /locales/de_DE.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfotelGLPI/resources/master/locales/de_DE.mo -------------------------------------------------------------------------------- /locales/en_GB.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfotelGLPI/resources/master/locales/en_GB.mo -------------------------------------------------------------------------------- /locales/es_AR.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfotelGLPI/resources/master/locales/es_AR.mo -------------------------------------------------------------------------------- /locales/es_EC.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfotelGLPI/resources/master/locales/es_EC.mo -------------------------------------------------------------------------------- /locales/es_ES.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfotelGLPI/resources/master/locales/es_ES.mo -------------------------------------------------------------------------------- /locales/fr_FR.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfotelGLPI/resources/master/locales/fr_FR.mo -------------------------------------------------------------------------------- /locales/id_ID.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfotelGLPI/resources/master/locales/id_ID.mo -------------------------------------------------------------------------------- /locales/it_IT.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfotelGLPI/resources/master/locales/it_IT.mo -------------------------------------------------------------------------------- /locales/pl_PL.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfotelGLPI/resources/master/locales/pl_PL.mo -------------------------------------------------------------------------------- /locales/pt_BR.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfotelGLPI/resources/master/locales/pt_BR.mo -------------------------------------------------------------------------------- /locales/pt_PT.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfotelGLPI/resources/master/locales/pt_PT.mo -------------------------------------------------------------------------------- /locales/ro_RO.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfotelGLPI/resources/master/locales/ro_RO.mo -------------------------------------------------------------------------------- /locales/ru_RU.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfotelGLPI/resources/master/locales/ru_RU.mo -------------------------------------------------------------------------------- /locales/sv_SE.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfotelGLPI/resources/master/locales/sv_SE.mo -------------------------------------------------------------------------------- /locales/tr_TR.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfotelGLPI/resources/master/locales/tr_TR.mo -------------------------------------------------------------------------------- /public/pics/add.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfotelGLPI/resources/master/public/pics/add.png -------------------------------------------------------------------------------- /public/pics/conf.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfotelGLPI/resources/master/public/pics/conf.png -------------------------------------------------------------------------------- /public/pics/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfotelGLPI/resources/master/public/pics/logo.png -------------------------------------------------------------------------------- /public/pics/nobody.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfotelGLPI/resources/master/public/pics/nobody.png -------------------------------------------------------------------------------- /public/pics/recap.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfotelGLPI/resources/master/public/pics/recap.png -------------------------------------------------------------------------------- /public/pics/csv_file.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfotelGLPI/resources/master/public/pics/csv_file.png -------------------------------------------------------------------------------- /public/pics/database.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfotelGLPI/resources/master/public/pics/database.png -------------------------------------------------------------------------------- /install/sql/update-2.6.4.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE glpi_plugin_resources_checklistconfigs 2 | DROP `is_deleted`; 3 | -------------------------------------------------------------------------------- /public/pics/budgetlist.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfotelGLPI/resources/master/public/pics/budgetlist.png -------------------------------------------------------------------------------- /public/pics/card_footer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfotelGLPI/resources/master/public/pics/card_footer.png -------------------------------------------------------------------------------- /public/pics/csv_check.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfotelGLPI/resources/master/public/pics/csv_check.png -------------------------------------------------------------------------------- /public/pics/directory.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfotelGLPI/resources/master/public/pics/directory.png -------------------------------------------------------------------------------- /public/pics/employment.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfotelGLPI/resources/master/public/pics/employment.png -------------------------------------------------------------------------------- /public/pics/holidaylist.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfotelGLPI/resources/master/public/pics/holidaylist.png -------------------------------------------------------------------------------- /public/pics/newresource.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfotelGLPI/resources/master/public/pics/newresource.png -------------------------------------------------------------------------------- /public/pics/newresting.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfotelGLPI/resources/master/public/pics/newresting.png -------------------------------------------------------------------------------- /public/pics/restinglist.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfotelGLPI/resources/master/public/pics/restinglist.png -------------------------------------------------------------------------------- /public/pics/card_content.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfotelGLPI/resources/master/public/pics/card_content.png -------------------------------------------------------------------------------- /public/pics/closeresting.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfotelGLPI/resources/master/public/pics/closeresting.png -------------------------------------------------------------------------------- /public/pics/csv_file_red.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfotelGLPI/resources/master/public/pics/csv_file_red.png -------------------------------------------------------------------------------- /public/pics/deleteresting.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfotelGLPI/resources/master/public/pics/deleteresting.png -------------------------------------------------------------------------------- /public/pics/gallery/Phone.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfotelGLPI/resources/master/public/pics/gallery/Phone.jpg -------------------------------------------------------------------------------- /public/pics/habilitation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfotelGLPI/resources/master/public/pics/habilitation.png -------------------------------------------------------------------------------- /public/pics/miniresources.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfotelGLPI/resources/master/public/pics/miniresources.png -------------------------------------------------------------------------------- /public/pics/puce-delete2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfotelGLPI/resources/master/public/pics/puce-delete2.png -------------------------------------------------------------------------------- /public/pics/resourcelist.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfotelGLPI/resources/master/public/pics/resourcelist.png -------------------------------------------------------------------------------- /lib/pics/jquery/jstree/32px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfotelGLPI/resources/master/lib/pics/jquery/jstree/32px.png -------------------------------------------------------------------------------- /lib/pics/jquery/jstree/40px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfotelGLPI/resources/master/lib/pics/jquery/jstree/40px.png -------------------------------------------------------------------------------- /public/pics/detailresource.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfotelGLPI/resources/master/public/pics/detailresource.png -------------------------------------------------------------------------------- /public/pics/employmentlist.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfotelGLPI/resources/master/public/pics/employmentlist.png -------------------------------------------------------------------------------- /public/pics/gallery/Computer.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfotelGLPI/resources/master/public/pics/gallery/Computer.jpg -------------------------------------------------------------------------------- /public/pics/gallery/Monitor.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfotelGLPI/resources/master/public/pics/gallery/Monitor.jpg -------------------------------------------------------------------------------- /public/pics/gallery/Printer.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfotelGLPI/resources/master/public/pics/gallery/Printer.jpg -------------------------------------------------------------------------------- /public/pics/gallery/nothing.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfotelGLPI/resources/master/public/pics/gallery/nothing.png -------------------------------------------------------------------------------- /public/pics/habilitationnew.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfotelGLPI/resources/master/public/pics/habilitationnew.png -------------------------------------------------------------------------------- /public/pics/holidayresource.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfotelGLPI/resources/master/public/pics/holidayresource.png -------------------------------------------------------------------------------- /public/pics/nav_item_active.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfotelGLPI/resources/master/public/pics/nav_item_active.png -------------------------------------------------------------------------------- /public/pics/removeresource.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfotelGLPI/resources/master/public/pics/removeresource.png -------------------------------------------------------------------------------- /public/pics/resource_check.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfotelGLPI/resources/master/public/pics/resource_check.png -------------------------------------------------------------------------------- /public/pics/transferresource.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfotelGLPI/resources/master/public/pics/transferresource.png -------------------------------------------------------------------------------- /lib/jstree/themes/default/32px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfotelGLPI/resources/master/lib/jstree/themes/default/32px.png -------------------------------------------------------------------------------- /lib/jstree/themes/default/40px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfotelGLPI/resources/master/lib/jstree/themes/default/40px.png -------------------------------------------------------------------------------- /public/pics/gallery/Peripheral.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfotelGLPI/resources/master/public/pics/gallery/Peripheral.jpg -------------------------------------------------------------------------------- /public/pics/habilitationdelete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfotelGLPI/resources/master/public/pics/habilitationdelete.png -------------------------------------------------------------------------------- /lib/pics/jquery/jstree/throbber.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfotelGLPI/resources/master/lib/pics/jquery/jstree/throbber.gif -------------------------------------------------------------------------------- /lib/jstree/themes/default-dark/32px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfotelGLPI/resources/master/lib/jstree/themes/default-dark/32px.png -------------------------------------------------------------------------------- /lib/jstree/themes/default-dark/40px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfotelGLPI/resources/master/lib/jstree/themes/default-dark/40px.png -------------------------------------------------------------------------------- /lib/jstree/themes/default/throbber.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfotelGLPI/resources/master/lib/jstree/themes/default/throbber.gif -------------------------------------------------------------------------------- /public/lib/pics/jquery/jstree/32px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfotelGLPI/resources/master/public/lib/pics/jquery/jstree/32px.png -------------------------------------------------------------------------------- /public/lib/pics/jquery/jstree/40px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfotelGLPI/resources/master/public/lib/pics/jquery/jstree/40px.png -------------------------------------------------------------------------------- /public/pics/card_header_matte_blue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfotelGLPI/resources/master/public/pics/card_header_matte_blue.png -------------------------------------------------------------------------------- /public/lib/jstree/themes/default/32px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfotelGLPI/resources/master/public/lib/jstree/themes/default/32px.png -------------------------------------------------------------------------------- /public/lib/jstree/themes/default/40px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfotelGLPI/resources/master/public/lib/jstree/themes/default/40px.png -------------------------------------------------------------------------------- /public/lib/pics/jquery/jstree/throbber.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfotelGLPI/resources/master/public/lib/pics/jquery/jstree/throbber.gif -------------------------------------------------------------------------------- /public/pics/gallery/PluginBadgesBadge.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfotelGLPI/resources/master/public/pics/gallery/PluginBadgesBadge.jpg -------------------------------------------------------------------------------- /public/pics/gallery/PluginOrderOrder.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfotelGLPI/resources/master/public/pics/gallery/PluginOrderOrder.jpg -------------------------------------------------------------------------------- /public/pics/gallery/PluginProjetProjet.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfotelGLPI/resources/master/public/pics/gallery/PluginProjetProjet.jpg -------------------------------------------------------------------------------- /lib/jstree/themes/default-dark/throbber.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfotelGLPI/resources/master/lib/jstree/themes/default-dark/throbber.gif -------------------------------------------------------------------------------- /public/pics/gallery/PluginSimcardSimcard.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfotelGLPI/resources/master/public/pics/gallery/PluginSimcardSimcard.jpg -------------------------------------------------------------------------------- /public/lib/jstree/themes/default-dark/32px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfotelGLPI/resources/master/public/lib/jstree/themes/default-dark/32px.png -------------------------------------------------------------------------------- /public/lib/jstree/themes/default-dark/40px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfotelGLPI/resources/master/public/lib/jstree/themes/default-dark/40px.png -------------------------------------------------------------------------------- /public/lib/jstree/themes/default/throbber.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfotelGLPI/resources/master/public/lib/jstree/themes/default/throbber.gif -------------------------------------------------------------------------------- /public/pics/gallery/PluginAccountsAccount.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfotelGLPI/resources/master/public/pics/gallery/PluginAccountsAccount.jpg -------------------------------------------------------------------------------- /public/pics/gallery/PluginResourcesResource.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfotelGLPI/resources/master/public/pics/gallery/PluginResourcesResource.jpg -------------------------------------------------------------------------------- /public/lib/jstree/themes/default-dark/throbber.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfotelGLPI/resources/master/public/lib/jstree/themes/default-dark/throbber.gif -------------------------------------------------------------------------------- /install/sql/update-1.5.1.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE `glpi_plugin_resources` 2 | ADD `helpdesk_visible` int(11) NOT NULL default '1', 3 | ADD `date_mod` datetime default NULL; 4 | -------------------------------------------------------------------------------- /install/sql/update-4.0.3.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE `glpi_plugin_resources_configs` CHANGE `plugin_resources_resourcetemplates_id` `plugin_resources_resourcetemplates_id` INT NULL DEFAULT '0'; 2 | -------------------------------------------------------------------------------- /report/userwithnoresource/userwithnoresource.en_GB.php: -------------------------------------------------------------------------------- 1 | =8.2", 9 | "adldap2/adldap2": "^10.3" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /install/sql/update-4.0.6.sql: -------------------------------------------------------------------------------- 1 | UPDATE `glpi_documents_items` SET `itemtype` = 'GlpiPlugin\\Resources\\Client' WHERE `itemtype` = 'PluginResourcesClient'; 2 | UPDATE `glpi_documents_items` SET `itemtype` = 'GlpiPlugin\\Resources\\Resource' WHERE `itemtype` = 'PluginResourcesResource'; 3 | -------------------------------------------------------------------------------- /install/sql/update-4.0.7.sql: -------------------------------------------------------------------------------- 1 | UPDATE `glpi_savedsearches` SET `itemtype` = 'GlpiPlugin\\Resources\\Resource' WHERE `itemtype` = 'PluginResourcesResource'; 2 | UPDATE `glpi_savedsearches_users` SET `itemtype` = 'GlpiPlugin\\Resources\\Resource' WHERE `itemtype` = 'PluginResourcesResource'; 3 | -------------------------------------------------------------------------------- /install/sql/update-1.9.1.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE `glpi_plugin_resources_ranks` 2 | ADD `begin_date` date default NULL, 3 | ADD `end_date` date default NULL; 4 | 5 | ALTER TABLE `glpi_plugin_resources_professions` 6 | ADD `begin_date` date default NULL, 7 | ADD `end_date` date default NULL; 8 | -------------------------------------------------------------------------------- /install/sql/update-4.0.8.sql: -------------------------------------------------------------------------------- 1 | UPDATE `glpi_rules` SET `sub_type` = 'GlpiPlugin\\Resources\\RuleContracttype' WHERE `sub_type` = 'PluginResourcesRuleContracttype'; 2 | UPDATE `glpi_rules` SET `sub_type` = 'GlpiPlugin\\Resources\\RuleChecklist' WHERE `sub_type` = 'PluginResourcesRuleChecklist'; 3 | UPDATE `glpi_rules` SET `sub_type` = 'GlpiPlugin\\Resources\\RuleContracttypeHidden' WHERE `sub_type` = 'PluginResourcesRuleContracttypeHidden'; 4 | -------------------------------------------------------------------------------- /install/sql/update-2.3.3.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE glpi_plugin_resources_configs 2 | ADD `security_compliance` tinyint(1) NOT NULL default '0'; 3 | 4 | ALTER TABLE glpi_plugin_resources_clients 5 | ADD `security_and` tinyint(1) NOT NULL default '0'; 6 | ALTER TABLE glpi_plugin_resources_clients 7 | ADD `security_fifour` tinyint(1) NOT NULL default '0'; 8 | ALTER TABLE glpi_plugin_resources_clients 9 | ADD `security_gisf` tinyint(1) NOT NULL default '0'; 10 | ALTER TABLE glpi_plugin_resources_clients 11 | ADD `security_cfi` tinyint(1) NOT NULL default '0'; 12 | -------------------------------------------------------------------------------- /install/sql/update-2.0.4.sql: -------------------------------------------------------------------------------- 1 | DROP TABLE IF EXISTS `glpi_plugin_resources_transferentities`; 2 | CREATE TABLE `glpi_plugin_resources_transferentities` 3 | ( 4 | `id` int(11) NOT NULL auto_increment, 5 | `entities_id` int(11) NOT NULL default '0', 6 | `groups_id` int(11) NOT NULL default '0', 7 | PRIMARY KEY (`id`), 8 | KEY `entities_id` (`entities_id`), 9 | KEY `groups_id` (`groups_id`) 10 | ) ENGINE = MyISAM 11 | DEFAULT CHARSET = utf8 12 | COLLATE = utf8_unicode_ci; 13 | 14 | ALTER TABLE `glpi_plugin_resources_reportconfigs` 15 | ADD `send_transfer_notif` tinyint(1) NOT NULL default '0'; 16 | -------------------------------------------------------------------------------- /ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | Dear GLPi user. 2 | 3 | BEFORE SUBMITTING YOUR ISSUE, please make sure to read and follow these steps : 4 | 5 | * Verify that your question has not already been asked 6 | * Please use the below template. 7 | * Delete this text before submiting your issue. 8 | 9 | The Plugin team. 10 | 11 | ------------ 12 | 13 | * Version of the plugin : 14 | 15 | 16 | * Version of your GLPI : 17 | 18 | 19 | * Steps to reproduce (which actions have you made) : 20 | 21 | 22 | * Expected result : 23 | 24 | 25 | * Actual result : 26 | 27 | 28 | * URL of the page : 29 | 30 | 31 | * Screenshot of the problem (if pertinent) : 32 | 33 | -------------------------------------------------------------------------------- /tools/update_mo.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | #!/usr/bin/perl -w 3 | 4 | if (@ARGV!=0){ 5 | print "USAGE update_mo.pl\n\n"; 6 | 7 | exit(); 8 | } 9 | 10 | 11 | opendir(DIRHANDLE,'locales')||die "ERROR: can not read current directory\n"; 12 | foreach (readdir(DIRHANDLE)){ 13 | if ($_ ne '..' && $_ ne '.'){ 14 | 15 | if(!(-l "$dir/$_")){ 16 | if (index($_,".po",0)==length($_)-3) { 17 | $lang=$_; 18 | $lang=~s/\.po//; 19 | 20 | `msgfmt locales/$_ -o locales/$lang.mo`; 21 | } 22 | } 23 | 24 | } 25 | } 26 | closedir DIRHANDLE; 27 | 28 | # 29 | # 30 | -------------------------------------------------------------------------------- /install/sql/update-4.0.4.sql: -------------------------------------------------------------------------------- 1 | UPDATE `glpi_crontasks` SET `itemtype` = 'GlpiPlugin\\Resources\\Resource' WHERE `itemtype` = 'PluginResourcesResource'; 2 | UPDATE `glpi_crontasks` SET `itemtype` = 'GlpiPlugin\\Resources\\ResourceImport' WHERE `itemtype` = 'PluginResourcesImportResource'; 3 | UPDATE `glpi_crontasks` SET `itemtype` = 'GlpiPlugin\\Resources\\Task' WHERE `itemtype` = 'PluginResourcesTask'; 4 | UPDATE `glpi_crontasks` SET `itemtype` = 'GlpiPlugin\\Resources\\Checklist' WHERE `itemtype` = 'PluginResourcesChecklist'; 5 | UPDATE `glpi_crontasks` SET `itemtype` = 'GlpiPlugin\\Resources\\Employment' WHERE `itemtype` = 'PluginResourcesEmployment'; 6 | DELETE FROM `glpi_crontasks` WHERE `itemtype` LIKE '%PluginResources%'; 7 | -------------------------------------------------------------------------------- /.github/workflows/updatepot.yml: -------------------------------------------------------------------------------- 1 | name: Update POT 2 | on: 3 | push: 4 | branches: [ master ] 5 | paths-ignore: 6 | - 'locales/**' 7 | 8 | env: 9 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 10 | jobs: 11 | run: 12 | 13 | name: Update POT 14 | 15 | runs-on: ubuntu-latest 16 | steps: 17 | - name: Checkout repo 18 | uses: actions/checkout@v2 19 | 20 | - name: install xgettext 21 | 22 | run: sudo apt-get install gettext; 23 | - name: Update POT 24 | run: sh tools/extract_template.sh; 25 | 26 | 27 | - name: Commit changes 28 | uses: EndBug/add-and-commit@v5.1.0 29 | with: 30 | message: "Update POT" 31 | - name: Push changes 32 | 33 | uses: actions-go/push@v1 34 | 35 | -------------------------------------------------------------------------------- /install/sql/update-1.6.2.sql: -------------------------------------------------------------------------------- 1 | INSERT INTO `glpi_notificationtemplates` 2 | VALUES (NULL, 'Resource Report Creation', 'PluginResourcesResource', '2010-11-16 11:36:46', ''); 3 | 4 | CREATE TABLE `glpi_plugin_resources_reportconfigs` 5 | ( 6 | `id` int(11) NOT NULL auto_increment, 7 | `plugin_resources_resources_id` int(11) NOT NULL default '0' COMMENT 'RELATION to glpi_plugin_resources_resources (id)', 8 | `comment` text collate utf8_unicode_ci, 9 | `information` text collate utf8_unicode_ci, 10 | PRIMARY KEY (`id`) 11 | ) ENGINE = MyISAM 12 | DEFAULT CHARSET = utf8 13 | COLLATE = utf8_unicode_ci; 14 | 15 | UPDATE `glpi_plugin_resources_choices` 16 | SET `itemtype` = '4303' 17 | WHERE `itemtype` = 'PluginResourcesDirectory'; 18 | -------------------------------------------------------------------------------- /install/sql/update-1.6.1.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE `glpi_plugin_resources_resources` 2 | ADD `plugin_resources_resourcestates_id` int(11) NOT NULL default '0' COMMENT 'RELATION to glpi_plugin_resources_resourcestates (id)', 3 | ADD `picture` varchar(100) collate utf8_unicode_ci default NULL, 4 | ADD INDEX (`plugin_resources_resourcestates_id`); 5 | 6 | CREATE TABLE `glpi_plugin_resources_resourcestates` 7 | ( 8 | `id` int(11) NOT NULL auto_increment, 9 | `entities_id` int(11) NOT NULL default '0', 10 | `name` varchar(255) collate utf8_unicode_ci default NULL, 11 | `comment` text collate utf8_unicode_ci, 12 | PRIMARY KEY (`id`), 13 | KEY `name` (`name`) 14 | ) ENGINE = MyISAM 15 | DEFAULT CHARSET = utf8 16 | COLLATE = utf8_unicode_ci; 17 | -------------------------------------------------------------------------------- /tools/update_po.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | #!/usr/bin/perl -w 3 | 4 | if (@ARGV!=2){ 5 | print "USAGE update_po.pl transifex_login transifex_password\n\n"; 6 | 7 | exit(); 8 | } 9 | $user = $ARGV[0]; 10 | $password = $ARGV[1]; 11 | 12 | opendir(DIRHANDLE,'locales')||die "ERROR: can not read current directory\n"; 13 | foreach (readdir(DIRHANDLE)){ 14 | if ($_ ne '..' && $_ ne '.'){ 15 | 16 | if(!(-l "$dir/$_")){ 17 | if (index($_,".po",0)==length($_)-3) { 18 | $lang=$_; 19 | $lang=~s/\.po//; 20 | 21 | `wget --user=$user --password=$password --output-document=locales/$_ http://www.transifex.com/api/2/project/GLPI_resources/resource/glpi/translation/$lang/?file=$_`; 22 | } 23 | } 24 | 25 | } 26 | } 27 | closedir DIRHANDLE; 28 | 29 | # 30 | # 31 | -------------------------------------------------------------------------------- /install/sql/update-2.0.3.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE `glpi_plugin_resources_reportconfigs` 2 | ADD `send_report_notif` tinyint(1) NOT NULL default '1', 3 | ADD `send_other_notif` tinyint(1) NOT NULL default '0'; 4 | 5 | DROP TABLE IF EXISTS `glpi_plugin_resources_notifications`; 6 | CREATE TABLE `glpi_plugin_resources_notifications` 7 | ( 8 | `id` int(11) NOT NULL auto_increment, 9 | `plugin_resources_resources_id` int(11) NOT NULL default '0' COMMENT 'RELATION to glpi_plugin_resources_resources (id)', 10 | `date_mod` datetime default NULL, 11 | `users_id` int(11) NOT NULL default '0', 12 | `type` varchar(50) default NULL, 13 | PRIMARY KEY (`id`), 14 | KEY `users_id` (`users_id`), 15 | KEY `date_mod` (`date_mod`) 16 | ) ENGINE = MyISAM 17 | DEFAULT CHARSET = utf8 18 | COLLATE = utf8_unicode_ci; 19 | -------------------------------------------------------------------------------- /install/sql/update-3.0.5.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE `glpi_plugin_resources_resources` 2 | ADD `date_of_last_location` timestamp NULL DEFAULT NULL; 3 | ALTER TABLE `glpi_plugin_resources_resources` 4 | ADD `last_location` int unsigned NOT NULL DEFAULT '0'; 5 | ALTER TABLE `glpi_plugin_resources_resources` 6 | ADD `plugin_resources_workprofiles_id_entrance` int unsigned NOT NULL default '0'; 7 | ALTER TABLE `glpi_plugin_resources_resources` 8 | ADD `plugin_resources_candidateorigins_id` int unsigned NOT NULL default '0'; 9 | 10 | CREATE TABLE `glpi_plugin_resources_candidateorigins` 11 | ( 12 | `id` int unsigned NOT NULL auto_increment, 13 | `entities_id` int unsigned NOT NULL default '0', 14 | `is_recursive` tinyint NOT NULL DEFAULT '0', 15 | `name` varchar(255) collate utf8_unicode_ci default NULL, 16 | `comment` text collate utf8_unicode_ci, 17 | PRIMARY KEY (`id`) 18 | ) ENGINE = InnoDB 19 | DEFAULT CHARSET = utf8 20 | COLLATE = utf8_unicode_ci 21 | ROW_FORMAT = DYNAMIC; 22 | -------------------------------------------------------------------------------- /index.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | -------------------------------------------------------------------------------- /.github/workflows/generatemo.yml: -------------------------------------------------------------------------------- 1 | name: Generate MO 2 | on: 3 | push: 4 | branches: [ master ] 5 | paths: 6 | - '**.po' 7 | env: 8 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 9 | jobs: 10 | run: 11 | 12 | name: Generate mo 13 | runs-on: ubuntu-latest 14 | steps: 15 | - name: Checkout repo 16 | uses: actions/checkout@v4 17 | 18 | - name: Setup Perl environment 19 | # You may pin to the exact commit or the version. 20 | # uses: shogo82148/actions-setup-perl@8d2e3d59a9516b785ed32169d48a4888eaa9b514 21 | uses: shogo82148/actions-setup-perl@v1 22 | - name: msgfmt 23 | # You may pin to the exact commit or the version. 24 | # uses: whtsky/msgfmt-action@6b2181f051b002182d01a1e1f1aff216230c5a4d 25 | uses: whtsky/msgfmt-action@20190305 26 | - name: Generate mo 27 | run: perl tools/update_mo.pl; 28 | 29 | - name: Commit changes 30 | uses: EndBug/add-and-commit@v9 31 | with: 32 | 33 | message: "Generate mo" 34 | - name: Push changes 35 | 36 | uses: actions-go/push@master 37 | with: 38 | commit-message: '' 39 | 40 | -------------------------------------------------------------------------------- /ajax/index.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | -------------------------------------------------------------------------------- /front/index.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | -------------------------------------------------------------------------------- /install/index.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | -------------------------------------------------------------------------------- /report/index.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | -------------------------------------------------------------------------------- /report/checkgroup/index.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | -------------------------------------------------------------------------------- /report/budgetsummary/index.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | -------------------------------------------------------------------------------- /report/checkhabilitation/index.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | -------------------------------------------------------------------------------- /report/checkmissingN0group/index.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | -------------------------------------------------------------------------------- /report/checkmissingN1group/index.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | -------------------------------------------------------------------------------- /report/lapserankprofession/index.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | -------------------------------------------------------------------------------- /report/professionwithoutcost/index.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | -------------------------------------------------------------------------------- /report/resourcewithoutuser/index.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | -------------------------------------------------------------------------------- /report/userwithnoresource/index.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | -------------------------------------------------------------------------------- /report/professionwithoutvolume/index.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | -------------------------------------------------------------------------------- /report/resourceemploymentdiff/index.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | -------------------------------------------------------------------------------- /report/resourcewithoutemployment/index.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | -------------------------------------------------------------------------------- /report/resourceemploymentwithlapserank/index.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | -------------------------------------------------------------------------------- /report/userwithmorethanoneresource/index.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | -------------------------------------------------------------------------------- /report/resourceleavingwithactiveemployment/index.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | -------------------------------------------------------------------------------- /report/resourceemploymentwithlapseprofession/index.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | -------------------------------------------------------------------------------- /front/rulechecklist.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | 30 | use GlpiPlugin\Resources\RuleChecklistCollection; 31 | 32 | $rulecollection = new RuleChecklistCollection($_SESSION['glpiactive_entity']); 33 | 34 | include(GLPI_ROOT . "/front/rule.common.php"); 35 | 36 | -------------------------------------------------------------------------------- /front/rulecontracttype.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | 30 | use GlpiPlugin\Resources\RuleContracttypeCollection; 31 | 32 | $rulecollection = new RuleContracttypeCollection($_SESSION['glpiactive_entity']); 33 | 34 | include(GLPI_ROOT . "/front/rule.common.php"); 35 | -------------------------------------------------------------------------------- /src/Recipient.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | 30 | if (!defined('GLPI_ROOT')) { 31 | die("Sorry. You can't access directly to this file"); 32 | } 33 | 34 | /** 35 | * Class Recipient 36 | */ 37 | class Recipient extends CommonDBTM { 38 | 39 | 40 | } 41 | 42 | -------------------------------------------------------------------------------- /front/rulechecklist.form.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | 30 | use GlpiPlugin\Resources\RuleChecklistCollection; 31 | 32 | $rulecollection = new RuleChecklistCollection($_SESSION['glpiactive_entity']); 33 | 34 | include(GLPI_ROOT . "/front/rule.common.form.php"); 35 | 36 | -------------------------------------------------------------------------------- /ajax/getitemtype.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | 30 | header("Content-Type: text/html; charset=UTF-8"); 31 | Html::header_nocache(); 32 | Session::checkLoginUser(); 33 | 34 | if (isset($_POST["type"])) { 35 | echo $_POST['type']; 36 | } 37 | -------------------------------------------------------------------------------- /front/rulecontracttype.form.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | 30 | use GlpiPlugin\Resources\RuleContracttypeCollection; 31 | 32 | $rulecollection = new RuleContracttypeCollection($_SESSION['glpiactive_entity']); 33 | 34 | include(GLPI_ROOT . "/front/rule.common.form.php"); 35 | 36 | -------------------------------------------------------------------------------- /src/Recipient_Leaving.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | if (!defined('GLPI_ROOT')) { 30 | die("Sorry. You can't access directly to this file"); 31 | } 32 | 33 | /** 34 | * Class Recipient_Leaving 35 | */ 36 | class Recipient_Leaving extends CommonDBTM { 37 | 38 | 39 | } 40 | 41 | -------------------------------------------------------------------------------- /front/rulecontracttypehidden.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | 30 | use GlpiPlugin\Resources\RuleContracttypeHiddenCollection; 31 | 32 | $rulecollection = new RuleContracttypeHiddenCollection($_SESSION['glpiactive_entity']); 33 | 34 | include(GLPI_ROOT . "/front/rule.common.php"); 35 | 36 | -------------------------------------------------------------------------------- /front/rulecontracttypehidden.form.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | 30 | use GlpiPlugin\Resources\RuleContracttypeHiddenCollection; 31 | 32 | $rulecollection = new RuleContracttypeHiddenCollection($_SESSION['glpiactive_entity']); 33 | 34 | include(GLPI_ROOT . "/front/rule.common.form.php"); 35 | 36 | -------------------------------------------------------------------------------- /src/Location.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | 30 | namespace GlpiPlugin\Resources; 31 | 32 | if (!defined('GLPI_ROOT')) { 33 | die("Sorry. You can't access directly to this file"); 34 | } 35 | 36 | /** 37 | * Class Location 38 | */ 39 | class Location extends CommonDBTM { 40 | 41 | 42 | } 43 | 44 | -------------------------------------------------------------------------------- /front/picture.send.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | 30 | use Glpi\Exception\Http\AccessDeniedHttpException; 31 | use GlpiPlugin\Resources\Resource; 32 | 33 | if (isset($_GET["file"])) { 34 | Resource::sendFile(GLPI_PLUGIN_DOC_DIR . "/resources/pictures/" . $_GET["file"], $_GET["file"]); 35 | } else { 36 | throw new AccessDeniedHttpException(); 37 | } 38 | 39 | -------------------------------------------------------------------------------- /install/sql/update-2.4.4.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE `glpi_plugin_resources_resources` 2 | DROP `plugin_resources_habilitations_id`; 3 | 4 | ALTER TABLE glpi_plugin_resources_contracttypes 5 | ADD `use_habilitation_wizard` tinyint(1) NOT NULL DEFAULT '0'; 6 | 7 | DROP TABLE IF EXISTS `glpi_plugin_resources_habilitationlevels`; 8 | CREATE TABLE `glpi_plugin_resources_habilitationlevels` 9 | ( 10 | `id` int(11) NOT NULL AUTO_INCREMENT, 11 | `entities_id` int(11) NOT NULL DEFAULT '0', 12 | `is_recursive` tinyint(1) NOT NULL DEFAULT '0', 13 | `name` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, 14 | `comment` text COLLATE utf8_unicode_ci, 15 | `number` tinyint(1) NOT NULL DEFAULT '0', 16 | `is_mandatory_creating_resource` tinyint(1) NOT NULL DEFAULT '0', 17 | PRIMARY KEY (`id`), 18 | KEY `name` (`name`), 19 | KEY `entities_id` (`entities_id`), 20 | KEY `is_recursive` (`is_recursive`) 21 | ) ENGINE = MyISAM 22 | DEFAULT CHARSET = utf8 23 | COLLATE = utf8_unicode_ci; 24 | 25 | ALTER TABLE glpi_plugin_resources_habilitations 26 | ADD `plugin_resources_habilitationlevels_id` int(11) NOT NULL default '0'; 27 | ALTER TABLE glpi_plugin_resources_habilitations 28 | DROP `allow_resource_creation`; 29 | 30 | DELETE 31 | FROM `glpi_ruleactions` 32 | WHERE `field` LIKE 'requiredfields_plugin_resources_habilitations_id'; 33 | -------------------------------------------------------------------------------- /src/Manager.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | 30 | namespace GlpiPlugin\Resources; 31 | 32 | if (!defined('GLPI_ROOT')) { 33 | die("Sorry. You can't access directly to this file"); 34 | } 35 | 36 | /** 37 | * Class Manager 38 | */ 39 | class Manager { 40 | 41 | public static function getTable($classname = null) 42 | { 43 | return "glpi_plugin_resources_managers"; 44 | } 45 | } 46 | 47 | -------------------------------------------------------------------------------- /ajax/resourcetree.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | 30 | use GlpiPlugin\Resources\Resource; 31 | 32 | $AJAX_INCLUDE = 1; 33 | header("Content-Type: text/html; charset=UTF-8"); 34 | Html::header_nocache(); 35 | 36 | Session::checkLoginUser(); 37 | 38 | if (!isset($_GET['target'])) { 39 | $_GET['target'] = PLUGIN_RESOURCES_WEBDIR . "/front/resource.php"; 40 | } 41 | 42 | Resource::showSelector($_GET['target']); 43 | 44 | -------------------------------------------------------------------------------- /src/EmploymentRank.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | 30 | namespace GlpiPlugin\Resources; 31 | 32 | use CommonDropdown; 33 | 34 | if (!defined('GLPI_ROOT')) { 35 | die("Sorry. You can't access directly to this file"); 36 | } 37 | 38 | /** 39 | * Class EmploymentRank 40 | */ 41 | class EmploymentRank extends CommonDropdown 42 | { 43 | 44 | var $can_be_translated = true; 45 | public $table = 'glpi_plugin_resources_ranks'; 46 | 47 | } 48 | 49 | -------------------------------------------------------------------------------- /ajax/inputtext.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | 30 | header("Content-Type: text/html; charset=UTF-8"); 31 | Html::header_nocache(); 32 | 33 | Session::checkLoginUser(); 34 | 35 | if (isset($_POST['name'])) { 36 | echo Html::textarea([ 37 | 'name' => $_POST['name'], 38 | 'value' => htmlescape(rawurldecode(stripslashes($_POST["data"]))), 39 | 'cols' => '30', 40 | 'rows' => '3', 41 | 'display' => false, 42 | ]); 43 | } 44 | 45 | -------------------------------------------------------------------------------- /front/setup.templates.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | 30 | use GlpiPlugin\Resources\Menu; 31 | use GlpiPlugin\Resources\Resource; 32 | 33 | $resource = new Resource(); 34 | 35 | if ($resource->canView() || Session::haveRight("config", UPDATE)) { 36 | Html::header(Resource::getTypeName(2), '', "admin", Menu::class); 37 | 38 | $resource->listOfTemplates(PLUGIN_RESOURCES_WEBDIR . "/front/resource.form.php", $_GET["add"]); 39 | 40 | Html::footer(); 41 | } 42 | -------------------------------------------------------------------------------- /ajax/resourceinfo.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | 30 | header("Content-Type: text/html; charset=UTF-8"); 31 | Html::header_nocache(); 32 | 33 | Session::checkLoginUser(); 34 | 35 | switch ($_POST['action']) { 36 | case 'groupEntity': 37 | if (isset($_POST["entities_id"])) { 38 | echo __('Group') . " "; 39 | Dropdown::show('Group', ['entity' => $_POST["entities_id"], 'entity_sons' => true]); 40 | } 41 | break; 42 | } 43 | 44 | -------------------------------------------------------------------------------- /src/EmploymentProfession.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | 30 | namespace GlpiPlugin\Resources; 31 | 32 | use CommonDropdown; 33 | 34 | if (!defined('GLPI_ROOT')) { 35 | die("Sorry. You can't access directly to this file"); 36 | } 37 | 38 | /** 39 | * Class EmploymentProfession 40 | */ 41 | class EmploymentProfession extends CommonDropdown 42 | { 43 | 44 | var $can_be_translated = true; 45 | public $table = 'glpi_plugin_resources_professions'; 46 | 47 | } 48 | 49 | -------------------------------------------------------------------------------- /src/EmploymentProfessionLine.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | 30 | namespace GlpiPlugin\Resources; 31 | 32 | use CommonDropdown; 33 | 34 | if (!defined('GLPI_ROOT')) { 35 | die("Sorry. You can't access directly to this file"); 36 | } 37 | 38 | /** 39 | * Class EmploymentProfessionLine 40 | */ 41 | class EmploymentProfessionLine extends CommonDropdown 42 | { 43 | 44 | var $can_be_translated = true; 45 | public $table = 'glpi_plugin_resources_professionlines'; 46 | 47 | } 48 | 49 | -------------------------------------------------------------------------------- /src/EmploymentProfessionCategory.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | 30 | namespace GlpiPlugin\Resources; 31 | 32 | use CommonDropdown; 33 | 34 | if (!defined('GLPI_ROOT')) { 35 | die("Sorry. You can't access directly to this file"); 36 | } 37 | 38 | /** 39 | * Class EmploymentProfessionCategory 40 | */ 41 | class EmploymentProfessionCategory extends CommonDropdown 42 | { 43 | 44 | var $can_be_translated = true; 45 | public $table = 'glpi_plugin_resources_professioncategories'; 46 | 47 | } 48 | 49 | -------------------------------------------------------------------------------- /ajax/planningend.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | 30 | $AJAX_INCLUDE = 1; 31 | 32 | // Send UTF8 Headers 33 | header("Content-Type: text/html; charset=UTF-8"); 34 | Html::header_nocache(); 35 | 36 | Session::checkLoginUser(); 37 | 38 | if (isset($_POST['duration']) && $_POST['duration'] == 0) { 39 | Html::showDateTimeField("plan[end]", [ 40 | 'value' => $_POST['end'], 41 | 'maybeempty' => false, 42 | 'mintime' => $_POST['global_begin'], 43 | 'maxtime' => $_POST['global_end'] 44 | ]); 45 | } 46 | 47 | -------------------------------------------------------------------------------- /front/budget.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | 30 | use Glpi\Exception\Http\AccessDeniedHttpException; 31 | use GlpiPlugin\Resources\Budget; 32 | use GlpiPlugin\Resources\Menu; 33 | use GlpiPlugin\Resources\Resource; 34 | 35 | Html::header(Resource::getTypeName(2), '', "admin", Menu::class, Budget::class); 36 | 37 | $budget = new Budget(); 38 | if ($budget->canView() || Session::haveRight("config", UPDATE)) { 39 | Search::show(Budget::class); 40 | } else { 41 | throw new AccessDeniedHttpException(); 42 | } 43 | 44 | Html::footer(); 45 | -------------------------------------------------------------------------------- /front/import.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | 30 | use Glpi\Exception\Http\AccessDeniedHttpException; 31 | use GlpiPlugin\Resources\Import; 32 | use GlpiPlugin\Resources\Menu; 33 | 34 | Html::header(Menu::getTypeName(2), '', "admin", Menu::class); 35 | 36 | $import = new Import(); 37 | $import->checkGlobal(READ); 38 | 39 | if ($import->canView()) { 40 | $import->showTitle(); 41 | Search::show(Import::class); 42 | } else { 43 | throw new AccessDeniedHttpException(); 44 | } 45 | 46 | Html::footer(); 47 | -------------------------------------------------------------------------------- /ajax/dropdownRank.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | 30 | use GlpiPlugin\Resources\Rank; 31 | 32 | if (strpos($_SERVER['PHP_SELF'], "dropdownRank.php")) { 33 | header("Content-Type: text/html; charset=UTF-8"); 34 | Html::header_nocache(); 35 | } 36 | 37 | Session::checkLoginUser(); 38 | 39 | //allow rank's diplay depending on profession 40 | $options = [ 41 | 'plugin_resources_professions_id' => $_POST['plugin_resources_professions_id'], 42 | 'entity' => $_POST['entity_restrict'], 43 | 'rand' => $_POST['rand'], 44 | 'sort' => $_POST['sort'] 45 | ]; 46 | 47 | Rank::showRank($options); 48 | 49 | -------------------------------------------------------------------------------- /ajax/dropdownSpeciality.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | 30 | use GlpiPlugin\Resources\ResourceSpeciality; 31 | 32 | if (strpos($_SERVER['PHP_SELF'], "dropdownSpeciality.php")) { 33 | header("Content-Type: text/html; charset=UTF-8"); 34 | Html::header_nocache(); 35 | } 36 | 37 | Session::checkLoginUser(); 38 | 39 | //allow speciality's display depending on rank 40 | $options = [ 41 | 'plugin_resources_ranks_id' => $_POST['plugin_resources_ranks_id'], 42 | 'entity' => $_POST['entity_restrict'], 43 | 'rand' => $_POST['rand'] 44 | ]; 45 | 46 | ResourceSpeciality::showSpeciality($options); 47 | 48 | -------------------------------------------------------------------------------- /front/adconfig.form.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | 30 | use GlpiPlugin\Resources\Adconfig; 31 | 32 | Session::checkRight("config", UPDATE); 33 | 34 | if (Plugin::isPluginActive("resources")) { 35 | $config = new Adconfig(); 36 | 37 | 38 | if (isset($_POST["update_setup"])) { 39 | $config->check(-1, UPDATE, $_POST); 40 | $config->update($_POST); 41 | Html::back(); 42 | } 43 | } else { 44 | Html::header(__('Setup'), '', "config", "plugin"); 45 | echo "
"; 46 | echo "" . __('Please activate the plugin', 'resources') . "
"; 47 | } 48 | 49 | Html::footer(); 50 | -------------------------------------------------------------------------------- /ajax/checkComputerResource.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | 30 | use GlpiPlugin\Resources\Resource_Item; 31 | 32 | header("Content-Type: text/html; charset=UTF-8"); 33 | Html::header_nocache(); 34 | 35 | Session::checkLoginUser(); 36 | 37 | if (!defined('GLPI_ROOT')) { 38 | die("Can not acces directly to this file"); 39 | } 40 | 41 | 42 | if (isset($_POST["computer_id"])) { 43 | $resource_item = new Resource_Item(); 44 | $resources = $resource_item->find(['itemtype' => Computer::getType(), 'items_id' => $_POST["computer_id"]]); 45 | if (count($resources) > 0) { 46 | echo true; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /front/checklistconfig.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | 30 | use GlpiPlugin\Resources\Checklist; 31 | use GlpiPlugin\Resources\Checklistconfig; 32 | use GlpiPlugin\Resources\Menu; 33 | use GlpiPlugin\Resources\Resource; 34 | use Glpi\Exception\Http\AccessDeniedHttpException; 35 | 36 | Html::header(Resource::getTypeName(2), '', "admin", Menu::class, Checklist::class); 37 | 38 | $checklistconfig = new Checklistconfig(); 39 | if (($checklistconfig->canView() || Session::haveRight("config", UPDATE))) { 40 | Search::show(Checklistconfig::class); 41 | } else { 42 | throw new AccessDeniedHttpException(); 43 | } 44 | 45 | Html::footer(); 46 | -------------------------------------------------------------------------------- /ajax/dropdownRole.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | 30 | use GlpiPlugin\Resources\Role; 31 | 32 | if (strpos($_SERVER['PHP_SELF'], "dropdownRole.php")) { 33 | header("Content-Type: text/html; charset=UTF-8"); 34 | Html::header_nocache(); 35 | } 36 | Session::checkLoginUser(); 37 | 38 | if ($_POST['plugin_resources_services_id'] > 0) { 39 | $opt = [ 40 | 'name' => "plugin_resources_roles_id", 41 | 'entity' => $_SESSION['glpiactiveentities'], 42 | 'rand' => $_POST['rand'], 43 | 'display' => false 44 | ]; 45 | echo Role::dropdownFromService($_POST['plugin_resources_services_id'], $opt); 46 | } 47 | 48 | -------------------------------------------------------------------------------- /ajax/dropdownContractnature.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | 30 | use GlpiPlugin\Resources\ContractNature; 31 | 32 | if (strpos($_SERVER['PHP_SELF'], "dropdownContractnature.php")) { 33 | header("Content-Type: text/html; charset=UTF-8"); 34 | Html::header_nocache(); 35 | } 36 | 37 | Session::checkLoginUser(); 38 | 39 | //allow ContractNature's display depending on resource situation 40 | $options = [ 41 | 'plugin_resources_resourcesituations_id' => $_POST['plugin_resources_resourcesituations_id'], 42 | 'entity' => $_POST['entity_restrict'], 43 | 'rand' => $_POST['rand'] 44 | ]; 45 | 46 | ContractNature::showContractnature($options); 47 | 48 | -------------------------------------------------------------------------------- /ajax/dropdownMassiveActionReports.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | 30 | $AJAX_INCLUDE = 1; 31 | 32 | header("Content-Type: text/html; charset=UTF-8"); 33 | Html::header_nocache(); 34 | 35 | Session::checkLoginUser(); 36 | 37 | if (isset($_POST["action"]) || isset($_POST["id"])) { 38 | echo Html::hidden('action', ['value' => $_POST["action"]]); 39 | echo Html::hidden('id', ['value' => $_POST["id"]]); 40 | switch ($_POST["action"]) { 41 | case "delete": 42 | echo " "; 43 | echo Html::submit(_sx('button', 'Post'), ['name' => 'massiveaction_reports', 'class' => 'btn btn-primary']); 44 | break; 45 | } 46 | } 47 | 48 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # resources 2 | 3 | Plugin resources pour GLPI 4 | 5 | Ce plugin est sur Transifex - Aidez-nous à le traduire : 6 | https://www.transifex.com/infotelGLPI/GLPI_resources/ 7 | 8 | This plugin is on Transifex - Help us to translate : 9 | https://www.transifex.com/infotelGLPI/GLPI_resources/ 10 | 11 | Ce plugin vous permet de gérer les ressources humaines afin de gérer correctement l'attribution de matériel. 12 | 13 | * Fonctionnalités : 14 | 15 | > * Gestion de checklists 16 | > * Gestion de tâches 17 | > * Système d'envoi de mails 18 | > * Utilisable depuis le helpdesk 19 | > * Utilisable avec le plugin "badges":https://github.com/InfotelGLPI/badges 20 | > * Utilisable avec le plugin "PDF":https://forge.glpi-project.org/projects/show/pdf 21 | > * Utilisable avec le plugin "Cartographie":https://github.com/InfotelGLPI/positions 22 | > * GLPI > 0.84 : Utilisable avec le plugin "Arborescence":https://forge.glpi-project.org/projects/show/treeview 23 | > * Import de fichier csv 24 | 25 | Mode d'emploi - pdf : https://forge.glpi-project.org/attachments/1329/Guide_Utilisateur_Resource.pdf 26 | 27 | Mode d'emploi - Service public - 28 | pdf : https://forge.glpi-project.org/attachments/1330/Guide_Utilisateur_Resource_service_public.pdf 29 | 30 | This plugin allows you to manage resources to properly manage the allocation of material. 31 | 32 | * Features : 33 | 34 | > * Checklists management 35 | > * Tasks management 36 | > * Email sending system 37 | > * Can be used with helpdesk 38 | > * Can be used with "badges":https://github.com/InfotelGLPI/badges plugin 39 | > * Can be used with "PDF":https://forge.glpi-project.org/projects/show/pdf plugin 40 | > * Can be used with "Positions":https://github.com/InfotelGLPI/positions 41 | > * GLPI > 0.84 : Can be used with "Tree View":https://forge.glpi-project.org/projects/show/treeview 42 | > * Import csv file 43 | -------------------------------------------------------------------------------- /ajax/dropdownLocation.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | 30 | use GlpiPlugin\Resources\Employer; 31 | 32 | if (strpos($_SERVER['PHP_SELF'], "dropdownLocation.php")) { 33 | header("Content-Type: text/html; charset=UTF-8"); 34 | Html::header_nocache(); 35 | } 36 | Session::checkLoginUser(); 37 | 38 | if ($_POST['plugin_resources_employers_id'] > 0) { 39 | $employer = new Employer(); 40 | $employer->getFromDB($_POST['plugin_resources_employers_id']); 41 | $locationId = $employer->fields["locations_id"]; 42 | if ($locationId > 0) { 43 | echo Dropdown::getDropdownName('glpi_locations', $locationId); 44 | } else { 45 | echo __('None'); 46 | } 47 | } 48 | 49 | -------------------------------------------------------------------------------- /ajax/resourcebadge.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | 30 | use GlpiPlugin\Resources\ResourceBadge; 31 | 32 | header("Content-Type: text/html; charset=UTF-8"); 33 | Html::header_nocache(); 34 | 35 | Session::checkLoginUser(); 36 | 37 | if (isset($_POST['action'])) { 38 | $badge = new ResourceBadge(); 39 | switch ($_POST['action']) { 40 | case "loadBadge" : 41 | $badge->loadBadge($_POST['plugin_resources_resources_id']); 42 | break; 43 | case "loadBadgeRestitution" : 44 | $badge->loadBadgeRestitution(); 45 | break; 46 | case "cleanButtonRestitution" : 47 | echo ""; 48 | break; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /lib/resources_card.js: -------------------------------------------------------------------------------- 1 | $(window).load(function () { 2 | 3 | var navigation = $('nav').find('ul'), 4 | navigationWidth = navigation.width(); 5 | 6 | navigation.css({width: navigationWidth, float: 'none', margin: '0 auto', visibility: 'visible'}); 7 | 8 | }); 9 | 10 | $(document).ready(function () { 11 | 12 | var containerHeight = $('#container').height(), 13 | header = $('header'); 14 | 15 | $(window).resize(function () { 16 | 17 | var windowHeight = $(this).height(), 18 | calculate = (274 + (windowHeight - containerHeight) + 12) / 2; 19 | 20 | if (calculate > 274) { 21 | calculate = 274 22 | } else if (calculate < 42) { 23 | calculate = 42 24 | } 25 | 26 | header.css({height: calculate}); 27 | 28 | }).trigger('resize'); 29 | 30 | 31 | var contentAnimating = false, 32 | initialLoad = true; 33 | 34 | $('nav').delegate('a', 'click', function () { 35 | 36 | if (!contentAnimating) { 37 | 38 | contentAnimating = true; 39 | 40 | $(this).parent('li').siblings().removeClass('active').end().addClass('active'); 41 | 42 | $.address.value($(this).attr('href')); 43 | 44 | if (initialLoad) { 45 | $('#plugin_resources_card-content-wrap').css({marginLeft: ($(this).parent('li').index() * 590) * -1}); 46 | contentAnimating = false; 47 | initialLoad = false; 48 | } else { 49 | $('#plugin_resources_card-content-wrap').animate({marginLeft: ($(this).parent('li').index() * 590) * -1}, 500, 'easeOutExpo', function () { 50 | contentAnimating = false; 51 | }); 52 | } 53 | 54 | } 55 | 56 | return false; 57 | 58 | }); 59 | 60 | $('.scrollable').jScrollPane(); 61 | 62 | }); 63 | -------------------------------------------------------------------------------- /front/leavinginformation.form.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | 30 | use GlpiPlugin\Resources\LeavingInformation; 31 | 32 | Session::checkLoginUser(); 33 | if (!isset($_GET["id"])) { 34 | $_GET["id"] = ""; 35 | } 36 | $leavingReason = new LeavingInformation(); 37 | 38 | if (isset($_POST["add"])) { 39 | $leavingReason->check(-1, CREATE, $_POST); 40 | $leavingReason->add($_POST); 41 | Html::back(); 42 | } elseif (isset($_POST["purge"])) { 43 | $leavingReason->check($_POST['id'], PURGE); 44 | $leavingReason->delete($_POST); 45 | Html::back(); 46 | } elseif (isset($_POST["update"])) { 47 | $leavingReason->check($_POST['id'], UPDATE); 48 | $leavingReason->update($_POST); 49 | Html::back(); 50 | } 51 | -------------------------------------------------------------------------------- /front/resource_change.form.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | 30 | use GlpiPlugin\Resources\Config; 31 | use GlpiPlugin\Resources\Menu; 32 | use GlpiPlugin\Resources\Resource; 33 | use GlpiPlugin\Resources\Resource_Change; 34 | 35 | if (!isset($_GET["id"])) { 36 | $_GET["id"] = ""; 37 | } 38 | 39 | $resource_change = new Resource_Change(); 40 | 41 | if (isset($_POST['add_entity_category'])) { 42 | $resource_change->check(-1, UPDATE, $_POST); 43 | $resource_change->add($_POST); 44 | Html::back(); 45 | } else { 46 | $resource_change->checkGlobal(READ); 47 | Html::header(Resource::getTypeName(2), '', "admin", Menu::class, Config::class); 48 | $resource_change->showFormActions(); 49 | Html::footer(); 50 | } 51 | -------------------------------------------------------------------------------- /public/lib/resources_card.js: -------------------------------------------------------------------------------- 1 | $(window).load(function () { 2 | 3 | var navigation = $('nav').find('ul'), 4 | navigationWidth = navigation.width(); 5 | 6 | navigation.css({width: navigationWidth, float: 'none', margin: '0 auto', visibility: 'visible'}); 7 | 8 | }); 9 | 10 | $(document).ready(function () { 11 | 12 | var containerHeight = $('#container').height(), 13 | header = $('header'); 14 | 15 | $(window).resize(function () { 16 | 17 | var windowHeight = $(this).height(), 18 | calculate = (274 + (windowHeight - containerHeight) + 12) / 2; 19 | 20 | if (calculate > 274) { 21 | calculate = 274 22 | } else if (calculate < 42) { 23 | calculate = 42 24 | } 25 | 26 | header.css({height: calculate}); 27 | 28 | }).trigger('resize'); 29 | 30 | 31 | var contentAnimating = false, 32 | initialLoad = true; 33 | 34 | $('nav').delegate('a', 'click', function () { 35 | 36 | if (!contentAnimating) { 37 | 38 | contentAnimating = true; 39 | 40 | $(this).parent('li').siblings().removeClass('active').end().addClass('active'); 41 | 42 | $.address.value($(this).attr('href')); 43 | 44 | if (initialLoad) { 45 | $('#plugin_resources_card-content-wrap').css({marginLeft: ($(this).parent('li').index() * 590) * -1}); 46 | contentAnimating = false; 47 | initialLoad = false; 48 | } else { 49 | $('#plugin_resources_card-content-wrap').animate({marginLeft: ($(this).parent('li').index() * 590) * -1}, 500, 'easeOutExpo', function () { 50 | contentAnimating = false; 51 | }); 52 | } 53 | 54 | } 55 | 56 | return false; 57 | 58 | }); 59 | 60 | $('.scrollable').jScrollPane(); 61 | 62 | }); 63 | -------------------------------------------------------------------------------- /install/sql/update-1.7.1.sql: -------------------------------------------------------------------------------- 1 | DROP TABLE IF EXISTS `glpi_plugin_resources_choiceitems`; 2 | CREATE TABLE `glpi_plugin_resources_choiceitems` 3 | ( 4 | `id` int(11) NOT NULL auto_increment, 5 | `entities_id` int(11) NOT NULL default '0', 6 | `is_recursive` tinyint(1) NOT NULL DEFAULT '0', 7 | `plugin_resources_choiceitems_id` int(11) NOT NULL DEFAULT '0', 8 | `completename` text COLLATE utf8_unicode_ci, 9 | `level` int(11) NOT NULL DEFAULT '0', 10 | `ancestors_cache` longtext COLLATE utf8_unicode_ci, 11 | `sons_cache` longtext COLLATE utf8_unicode_ci, 12 | `is_helpdesk_visible` int(11) NOT NULL default '1', 13 | `name` varchar(255) collate utf8_unicode_ci default NULL, 14 | `comment` text collate utf8_unicode_ci, 15 | PRIMARY KEY (`id`), 16 | UNIQUE KEY `unicity` (`entities_id`, `plugin_resources_choiceitems_id`, `name`), 17 | KEY `name` (`name`), 18 | KEY `plugin_resources_choiceitems_id` (`plugin_resources_choiceitems_id`), 19 | KEY `is_recursive` (`is_recursive`) 20 | ) ENGINE = MyISAM 21 | DEFAULT CHARSET = utf8 22 | COLLATE = utf8_unicode_ci; 23 | 24 | ALTER TABLE `glpi_plugin_resources_choices` 25 | ADD `plugin_resources_choiceitems_id` int(11) NOT NULL default '0' COMMENT 'RELATION to glpi_plugin_resources_choiceitems (id)', 26 | ADD INDEX (`plugin_resources_choiceitems_id`); 27 | 28 | ALTER TABLE `glpi_plugin_resources_contracttypes` 29 | ADD `use_employee_wizard` tinyint(1) NOT NULL DEFAULT '1', 30 | ADD `use_need_wizard` tinyint(1) NOT NULL DEFAULT '1', 31 | ADD `use_picture_wizard` tinyint(1) NOT NULL DEFAULT '1'; 32 | -------------------------------------------------------------------------------- /ajax/resourceresting.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | 30 | use GlpiPlugin\Resources\ResourceResting; 31 | 32 | header("Content-Type: text/html; charset=UTF-8"); 33 | Html::header_nocache(); 34 | 35 | Session::checkLoginUser(); 36 | 37 | if (isset($_POST['action'])) { 38 | $resting = new ResourceResting(); 39 | switch ($_POST['action']) { 40 | case "loadResting" : 41 | $resting->loadResting($_POST['plugin_resources_resources_id']); 42 | break; 43 | 44 | 45 | case "loadEndDateResting" : 46 | $resting->loadEndDateResting($_POST['plugin_resources_resting_id']); 47 | break; 48 | 49 | case "loadButtonResting" : 50 | $resting->loadButtonResting($_POST['plugin_resources_resting_id']); 51 | break; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /front/actionprofile.form.php: -------------------------------------------------------------------------------- 1 | . 24 | -------------------------------------------------------------------------- 25 | */ 26 | 27 | use GlpiPlugin\Resources\Actionprofile; 28 | 29 | $actionprofile = new Actionprofile(); 30 | if (isset($_POST["addAction"])) { 31 | $actionprofile->check(-1, CREATE, $_POST); 32 | if (isset($_POST["actions_id"])) { 33 | $_POST["actions_id"] = json_encode($_POST["actions_id"]); 34 | } else { 35 | $_POST["actions_id"] = "[]"; 36 | } 37 | if ($actionprofile->getFromDBByCrit(['profiles_id' => $_POST['profiles_id']])) { 38 | $actionprofile->update([ 39 | 'id' => $actionprofile->fields['id'], 40 | 'actions_id' => $_POST['actions_id'] 41 | ]); 42 | } else { 43 | $actionprofile->add([ 44 | 'actions_id' => $_POST['actions_id'], 45 | 'profiles_id' => $_POST['profiles_id'] 46 | ]); 47 | } 48 | 49 | Html::back(); 50 | } else { 51 | Html::back(); 52 | } 53 | -------------------------------------------------------------------------------- /front/importcolumn.form.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | 30 | use Glpi\Exception\Http\BadRequestHttpException; 31 | use GlpiPlugin\Resources\ImportColumn; 32 | 33 | Session::checkLoginUser(); 34 | if (!isset($_GET["id"])) { 35 | $_GET["id"] = ""; 36 | } 37 | $import = new ImportColumn(); 38 | if (isset($_POST["add"])) { 39 | $import->check(-1, CREATE, $_POST); 40 | $import->add($_POST); 41 | Html::back(); 42 | } elseif (isset($_POST["purge"])) { 43 | $import->check($_POST['id'], PURGE); 44 | $import->delete($_POST); 45 | $import->redirectToList(); 46 | } elseif (isset($_POST["update"])) { 47 | $import->check($_POST['id'], UPDATE); 48 | $import->update($_POST); 49 | Html::back(); 50 | } 51 | throw new BadRequestHttpException(); 52 | -------------------------------------------------------------------------------- /install/sql/update-2.7.2.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE `glpi_plugin_resources_configs` 2 | ADD `mandatory_checklist` tinyint(1) NOT NULL default '0'; 3 | ALTER TABLE `glpi_plugin_resources_configs` 4 | ADD `mandatory_adcreation` INT(11) NULL DEFAULT '0'; 5 | ALTER TABLE `glpi_plugin_resources_configs` 6 | ADD `allow_without_contract` INT(11) NULL DEFAULT '0'; 7 | ALTER TABLE `glpi_plugin_resources_configs` 8 | ADD `plugin_resources_resourcetemplates_id` INT(11) NULL DEFAULT '0'; 9 | ALTER TABLE `glpi_plugin_resources_configs` 10 | ADD `plugin_resources_resourcestates_id_arrival` INT(11) NULL DEFAULT '0'; 11 | ALTER TABLE `glpi_plugin_resources_configs` 12 | ADD `plugin_resources_resourcestates_id_departure` INT(11) NULL DEFAULT '0'; 13 | ALTER TABLE `glpi_plugin_resources_adconfigs` 14 | ADD `mail_prefix` INT(11) NULL DEFAULT '0'; 15 | ALTER TABLE `glpi_plugin_resources_adconfigs` 16 | ADD `mail_suffix` varchar(255) NOT NULL default ''; 17 | 18 | ALTER TABLE `glpi_plugin_resources_resources` 19 | ADD `plugin_resources_roles_id` int(11) NOT NULL default '0' COMMENT 'RELATION to glpi_plugin_resources_roles (id)'; 20 | ALTER TABLE `glpi_plugin_resources_resources` 21 | ADD `matricule` varchar(255) NOT NULL default ''; 22 | ALTER TABLE `glpi_plugin_resources_configs` 23 | ADD `reaffect_checklist_change` TINYINT(1) NOT NULL DEFAULT '1'; 24 | 25 | CREATE TABLE `glpi_plugin_resources_roles` 26 | ( 27 | `id` int(11) NOT NULL auto_increment, 28 | `entities_id` int(11) NOT NULL default '0', 29 | `is_recursive` tinyint(1) NOT NULL DEFAULT '0', 30 | `name` varchar(255) collate utf8_unicode_ci default NULL, 31 | `comment` text collate utf8_unicode_ci, 32 | PRIMARY KEY (`id`), 33 | KEY `name` (`name`), 34 | KEY `entities_id` (`entities_id`), 35 | KEY `is_recursive` (`is_recursive`) 36 | ) ENGINE = InnoDB 37 | DEFAULT CHARSET = utf8 38 | COLLATE = utf8_unicode_ci; 39 | 40 | -------------------------------------------------------------------------------- /front/employment.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | 30 | use Glpi\Exception\Http\AccessDeniedHttpException; 31 | use GlpiPlugin\Resources\Employment; 32 | use GlpiPlugin\Resources\Menu; 33 | use GlpiPlugin\Resources\Resource; 34 | 35 | 36 | Html::header(Resource::getTypeName(2), '', "admin", Menu::class, Employment::class); 37 | 38 | $employment = new Employment(); 39 | 40 | if ($employment->canView() || Session::haveRight("config", UPDATE)) { 41 | if (isset($_GET["plugin_resources_resources_id"]) 42 | && !empty($_GET["plugin_resources_resources_id"])) { 43 | $_GET["field"] = [0 => "13"]; 44 | $_GET["contains"] = [0 => $_GET["plugin_resources_resources_id"]]; 45 | } 46 | 47 | Search::show(Employment::class); 48 | } else { 49 | throw new AccessDeniedHttpException(); 50 | } 51 | 52 | Html::footer(); 53 | -------------------------------------------------------------------------------- /ajax/linkItems.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | 30 | if (strpos($_SERVER['PHP_SELF'], "linkItems.php")) { 31 | $AJAX_INCLUDE = 1; 32 | header("Content-Type: text/html; charset=UTF-8"); 33 | Html::header_nocache(); 34 | } 35 | 36 | Session::checkCentralAccess(); 37 | 38 | if (isset($_POST["type"]) && isset($_POST["current_type"])) { 39 | $values = 0; 40 | if ($_POST["type"] != "0" && $_POST["type"] != "" && $_POST["type"] != "ALL") { 41 | if ($_POST['type'] == $_POST['current_type'] && isset($_POST["values"])) { 42 | $values = $_POST['values']; 43 | } 44 | 45 | 46 | $option["name"] = "items"; 47 | if (isset($values)) { 48 | $option["value"] = $values; 49 | } else { 50 | $option["value"] = 0; 51 | } 52 | 53 | 54 | $_POST["type"]::dropdown($option); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /front/task.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | 30 | use Glpi\Exception\Http\AccessDeniedHttpException; 31 | use GlpiPlugin\Resources\Menu; 32 | use GlpiPlugin\Resources\Resource; 33 | use GlpiPlugin\Resources\Task; 34 | 35 | Html::header(Resource::getTypeName(2), '', "admin", Menu::class); 36 | 37 | $task = new Task(); 38 | 39 | if (($task->canView() || Session::haveRight("config", UPDATE))) { 40 | //if $_GET["plugin_resources_resources_id"] exist this show list of tasks from a resource 41 | //else show all resources 42 | if (isset($_GET["plugin_resources_resources_id"]) && !empty($_GET["plugin_resources_resources_id"])) { 43 | $_GET["field"] = [0 => "13"]; 44 | $_GET["contains"] = [0 => $_GET["plugin_resources_resources_id"]]; 45 | } 46 | 47 | Search::show(Task::class); 48 | } else { 49 | throw new AccessDeniedHttpException(); 50 | } 51 | 52 | Html::footer(); 53 | -------------------------------------------------------------------------------- /ajax/employee.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | 30 | use GlpiPlugin\Resources\Client; 31 | use GlpiPlugin\Resources\Resource_Change; 32 | 33 | header("Content-Type: text/html; charset=UTF-8"); 34 | Html::header_nocache(); 35 | 36 | Session::checkLoginUser(); 37 | 38 | $resource_change = new Resource_Change(); 39 | 40 | if (isset($_POST['plugin_resources_clients_id'])) { 41 | if (Client::isSecurityCompliance($_POST['plugin_resources_clients_id'])) { 42 | $img = ""; 43 | $color = "color: green;"; 44 | } else { 45 | $img = ""; 46 | $color = "color: red;"; 47 | } 48 | echo ""; 49 | echo __('Security compliance', 'resources') . " "; 50 | echo $img; 51 | echo ""; 52 | } 53 | -------------------------------------------------------------------------------- /tools/extract_template.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | 4 | # --- Étape 1 : Extraction des chaînes PHP --- 5 | find . -name '*.php' > php_files.list 6 | 7 | xgettext --files-from=php_files.list \ 8 | --copyright-holder='Resources Development Team' \ 9 | --package-name='Resources plugin' \ 10 | -o locales/glpi.pot \ 11 | -L PHP \ 12 | --add-comments=TRANS \ 13 | --from-code=UTF-8 \ 14 | --force-po \ 15 | --sort-output \ 16 | --keyword=_n:1,2,4t \ 17 | --keyword=__s:1,2t \ 18 | --keyword=__:1,2t \ 19 | --keyword=_e:1,2t \ 20 | --keyword=_x:1c,2,3t \ 21 | --keyword=_ex:1c,2,3t \ 22 | --keyword=_nx:1c,2,3,5t \ 23 | --keyword=_sx:1c,2,3t 24 | 25 | rm php_files.list 26 | 27 | # --- Étape 2 : Extraction des chaînes Twig --- 28 | 29 | # Append locales from Twig templates 30 | SCRIPT_DIR=$(dirname $0) 31 | WORKING_DIR=$(readlink -f "$SCRIPT_DIR/..") # Script will be executed from "vendor/bin" directory 32 | # Define translate function args 33 | F_ARGS_N="1,2" 34 | F_ARGS__S="1" 35 | F_ARGS__="1" 36 | F_ARGS_X="1c,2" 37 | F_ARGS_SX="1c,2" 38 | F_ARGS_NX="1c,2,3" 39 | F_ARGS_SN="1,2" 40 | 41 | for file in $(cd $WORKING_DIR && find -regextype posix-egrep -not -regex $EXCLUDE_REGEX "$SCRIPT_DIR/.." -name "*.twig") 42 | do 43 | # 1. Convert file content to replace "{{ function(.*) }}" by "" and extract strings via std input 44 | # 2. Replace "standard input:line_no" by file location in po file comments 45 | contents=`cat $file | sed -r "s|\{\{\s*([a-z0-9_]+\(.*\))\s*\}\}||gi"` 46 | cat $file | perl -0pe "s/\{\{(.*?)\}\}//gism" | xgettext - \ 47 | -o locales/glpi.pot \ 48 | -L PHP \ 49 | --add-comments=TRANS \ 50 | --from-code=UTF-8 \ 51 | --force-po \ 52 | --join-existing \ 53 | --sort-output \ 54 | --keyword=_n:$F_ARGS_N \ 55 | --keyword=__:$F_ARGS__ \ 56 | --keyword=_x:$F_ARGS_X \ 57 | --keyword=_nx:$F_ARGS_NX 58 | sed -i -r "s|standard input:([0-9]+)|`echo $file | sed "s|./||"`:\1|g" locales/glpi.pot 59 | done 60 | -------------------------------------------------------------------------------- /src/Department_Service.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | 30 | namespace GlpiPlugin\Resources; 31 | 32 | use CommonDBRelation; 33 | 34 | if (!defined('GLPI_ROOT')) { 35 | die("Sorry. You can't access this file directly"); 36 | } 37 | 38 | class Department_Service extends CommonDBRelation 39 | { 40 | 41 | // From CommonDBRelation 42 | static public $itemtype_1 = Department::class; 43 | static public $items_id_1 = 'plugin_resources_departments_id'; 44 | 45 | static public $itemtype_2 = Service::class; 46 | static public $items_id_2 = 'plugin_resources_services_id'; 47 | 48 | 49 | function getForbiddenStandardMassiveAction() 50 | { 51 | $forbidden = parent::getForbiddenStandardMassiveAction(); 52 | $forbidden[] = 'update'; 53 | return $forbidden; 54 | } 55 | 56 | 57 | static function getTypeName($nb = 0) 58 | { 59 | return _n('Link Department/Service', 'Links Department/Service', $nb, 'resources'); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /ajax/resourcechange.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | 30 | use GlpiPlugin\Resources\Resource_Change; 31 | 32 | Session::checkLoginUser(); 33 | 34 | $resource_change = new Resource_Change(); 35 | 36 | if (isset($_POST['load_button_changeresources'])) { 37 | $resource_change->loadButtonChangeResources($_POST['action'], $_POST); 38 | } elseif (isset($_POST['action'])) { 39 | switch ($_POST['action']) { 40 | case "loadEntity": 41 | $resource_change->loadEntity($_POST['actions_id']); 42 | break; 43 | case "loadCategory": 44 | $resource_change->displayCategory($_POST['entities_id']); 45 | break; 46 | case "loadButtonAdd": 47 | $resource_change->displayButtonAdd($_POST['itilcategories_id']); 48 | break; 49 | case "clean": 50 | echo ""; 51 | break; 52 | } 53 | } else { 54 | $resource_change->setFieldByAction($_POST["id"], $_POST['plugin_resources_resources_id']); 55 | } 56 | -------------------------------------------------------------------------------- /ajax/dropdownService.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | 30 | use GlpiPlugin\Resources\Service; 31 | 32 | if (strpos($_SERVER['PHP_SELF'], "dropdownService.php")) { 33 | header("Content-Type: text/html; charset=UTF-8"); 34 | Html::header_nocache(); 35 | } 36 | Session::checkLoginUser(); 37 | 38 | if ($_POST['plugin_resources_departments_id'] > 0) { 39 | $rand = $_POST['rand']; 40 | $opt = [ 41 | 'name' => "plugin_resources_services_id", 42 | 'entity' => $_SESSION['glpiactiveentities'], 43 | 'rand' => $rand, 44 | 'display' => false 45 | ]; 46 | $params = [ 47 | 'plugin_resources_services_id' => '__VALUE__', 48 | 'rand' => $rand, 49 | ]; 50 | Ajax::updateItemOnSelectEvent( 51 | "dropdown_plugin_resources_services_id$rand", 52 | "show_roles", 53 | "../ajax/dropdownRole.php", 54 | $params 55 | ); 56 | echo Service::dropdownFromDepart($_POST['plugin_resources_departments_id'], $opt); 57 | } 58 | 59 | -------------------------------------------------------------------------------- /front/contracttypeprofile.form.php: -------------------------------------------------------------------------------- 1 | . 24 | -------------------------------------------------------------------------- 25 | */ 26 | 27 | use GlpiPlugin\Resources\Contracttypeprofile; 28 | 29 | $contracttype = new Contracttypeprofile(); 30 | if (isset($_POST["addContracttype"])) { 31 | $contracttype->check(-1, CREATE, $_POST); 32 | if (isset($_POST["plugin_resources_contracttypes_id"])) { 33 | $_POST["plugin_resources_contracttypes_id"] = json_encode($_POST["plugin_resources_contracttypes_id"]); 34 | } else { 35 | $_POST["plugin_resources_contracttypes_id"] = "[]"; 36 | } 37 | if ($contracttype->getFromDBByCrit(['profiles_id' => $_POST['profiles_id']])) { 38 | $contracttype->update([ 39 | 'id' => $contracttype->fields['id'], 40 | 'plugin_resources_contracttypes_id' => $_POST['plugin_resources_contracttypes_id'] 41 | ]); 42 | } else { 43 | $contracttype->add([ 44 | 'plugin_resources_contracttypes_id' => $_POST['plugin_resources_contracttypes_id'], 45 | 'profiles_id' => $_POST['profiles_id'] 46 | ]); 47 | } 48 | 49 | Html::back(); 50 | } else { 51 | Html::back(); 52 | } 53 | -------------------------------------------------------------------------------- /src/Role_Service.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | 30 | namespace GlpiPlugin\Resources; 31 | 32 | use CommonDBRelation; 33 | 34 | if (!defined('GLPI_ROOT')) { 35 | die("Sorry. You can't access this file directly"); 36 | } 37 | 38 | /** 39 | * Role_Service Class 40 | **/ 41 | class Role_Service extends CommonDBRelation 42 | { 43 | 44 | // From CommonDBRelation 45 | static public $itemtype_1 = ResourceFunction::class; 46 | static public $items_id_1 = 'plugin_resources_roles_id'; 47 | 48 | static public $itemtype_2 = Service::class; 49 | static public $items_id_2 = 'plugin_resources_services_id'; 50 | 51 | 52 | function getForbiddenStandardMassiveAction() 53 | { 54 | $forbidden = parent::getForbiddenStandardMassiveAction(); 55 | $forbidden[] = 'update'; 56 | return $forbidden; 57 | } 58 | 59 | 60 | static function getTypeName($nb = 0) 61 | { 62 | return _n('Link Role/Service', 'Links Role/Service', $nb, 'resources'); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /ajax/viewchecklisttask.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | 30 | use GlpiPlugin\Resources\Checklist; 31 | 32 | header("Content-Type: text/html; charset=UTF-8"); 33 | Html::header_nocache(); 34 | 35 | Session::checkLoginUser(); 36 | 37 | $item = new Checklist(); 38 | 39 | if (isset($_POST["plugin_resources_contracttypes_id"]) && isset($_POST["checklist_type"])) { 40 | $options = [ 41 | 'id' => $_POST["id"], 42 | 'target' => $_POST["target"], 43 | 'plugin_resources_contracttypes_id' => $_POST["plugin_resources_contracttypes_id"], 44 | 'checklist_type' => $_POST["checklist_type"], 45 | 'plugin_resources_resources_id' => $_POST["plugin_resources_resources_id"] 46 | ]; 47 | 48 | echo ""; 49 | echo ""; 50 | echo ""; 53 | echo ""; 54 | echo "
"; 51 | $item->showForm($_POST["id"], $options); 52 | echo "
"; 55 | } else { 56 | echo __("You don't have permission to perform this action."); 57 | } 58 | -------------------------------------------------------------------------------- /front/popup.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | 30 | Session::checkLoginUser(); 31 | 32 | if (isset($_GET["popup"])) { 33 | $_SESSION["glpipopup"]["name"] = $_GET["popup"]; 34 | } 35 | 36 | if (isset($_SESSION["glpipopup"]["name"])) { 37 | switch ($_SESSION["glpipopup"]["name"]) { 38 | case "test_rule" : 39 | Html::popHeader(__('Test'), $_SERVER['PHP_SELF']); 40 | include GLPI_ROOT . "/front/rule.test.php"; 41 | break; 42 | 43 | case "test_all_rules" : 44 | Html::popHeader(__('Test rules engine'), $_SERVER['PHP_SELF']); 45 | include GLPI_ROOT . "/front/rulesengine.test.php"; 46 | break; 47 | 48 | case "show_cache" : 49 | Html::popHeader(__('Cache information'), $_SERVER['PHP_SELF']); 50 | include GLPI_ROOT . "/front/rule.cache.php"; 51 | break; 52 | } 53 | echo "

" . __('Close') . ""; 54 | echo "
"; 55 | Html::popFooter(); 56 | } 57 | 58 | -------------------------------------------------------------------------------- /front/checklistconfig.form.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | 30 | use GlpiPlugin\Resources\Checklist; 31 | use GlpiPlugin\Resources\Checklistconfig; 32 | use GlpiPlugin\Resources\Menu; 33 | use GlpiPlugin\Resources\Resource; 34 | 35 | if (!isset($_GET["id"])) { 36 | $_GET["id"] = ""; 37 | } 38 | 39 | $checklistconfig = new Checklistconfig(); 40 | 41 | if (isset($_POST["add"])) { 42 | $checklistconfig->check(-1, UPDATE, $_POST); 43 | $newID = $checklistconfig->add($_POST); 44 | Html::back(); 45 | } elseif (isset($_POST["purge"])) { 46 | $checklistconfig->check($_POST['id'], UPDATE); 47 | $checklistconfig->delete($_POST, 1); 48 | $checklistconfig->redirectToList(); 49 | } elseif (isset($_POST["update"])) { 50 | $checklistconfig->check($_POST['id'], UPDATE); 51 | $checklistconfig->update($_POST); 52 | Html::back(); 53 | } else { 54 | $checklistconfig->checkGlobal(READ); 55 | Html::header(Resource::getTypeName(2), '', "admin", Menu::class, Checklist::class); 56 | $checklistconfig->display(['id' => $_GET["id"]]); 57 | Html::footer(); 58 | } 59 | -------------------------------------------------------------------------------- /front/employee.form.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | 30 | use GlpiPlugin\Resources\Employee; 31 | use GlpiPlugin\Resources\Menu; 32 | use GlpiPlugin\Resources\Resource; 33 | use GlpiPlugin\Servicecatalog\Main; 34 | 35 | //from helpdesk 36 | if (Plugin::isPluginActive('servicecatalog')) { 37 | Main::showDefaultHeaderHelpdesk(Menu::getTypeName(2)); 38 | } else { 39 | Html::helpHeader(Resource::getTypeName(2)); 40 | } 41 | 42 | $employee = new Employee(); 43 | 44 | //add employee informations from helpdesk 45 | //next step : show list needs of the new ressource 46 | if (isset($_POST["add_helpdesk_employee"])) { 47 | $newID = $employee->add($_POST); 48 | Html::redirect("./resource_item.list.php?id=" . $_POST["plugin_resources_resources_id"] . "&exist=0"); 49 | } else { 50 | //show form employee informations from helpdesk 51 | $employee->showFormHelpdesk($_GET["id"], 0); 52 | } 53 | 54 | if (Session::getCurrentInterface() != 'central' 55 | && Plugin::isPluginActive('servicecatalog')) { 56 | Main::showNavBarFooter('resources'); 57 | } 58 | 59 | Html::helpFooter(); 60 | -------------------------------------------------------------------------------- /front/import.form.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | 30 | use Glpi\Exception\Http\AccessDeniedHttpException; 31 | use GlpiPlugin\Resources\Import; 32 | use GlpiPlugin\Resources\Menu; 33 | 34 | Session::checkLoginUser(); 35 | if (!isset($_GET["id"])) { 36 | $_GET["id"] = ""; 37 | } 38 | $import = new Import(); 39 | 40 | if (isset($_POST["add"])) { 41 | $import->check(-1, CREATE, $_POST); 42 | $import->add($_POST); 43 | Html::back(); 44 | } elseif (isset($_POST["purge"])) { 45 | $import->check($_POST['id'], PURGE); 46 | $import->delete($_POST); 47 | $import->redirectToList(); 48 | } elseif (isset($_POST["update"])) { 49 | $import->check($_POST['id'], UPDATE); 50 | $import->update($_POST); 51 | Html::back(); 52 | } else { 53 | $import->checkGlobal(READ); 54 | 55 | Html::header(Menu::getTypeName(2), '', "admin", Menu::class); 56 | 57 | if ($import->canView()) { 58 | $import->showTitle(false); 59 | $import->display(['id' => $_GET['id']]); 60 | } else { 61 | throw new AccessDeniedHttpException(); 62 | } 63 | Html::footer(); 64 | } 65 | -------------------------------------------------------------------------------- /front/menu.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | 30 | use Glpi\Exception\Http\AccessDeniedHttpException; 31 | use GlpiPlugin\Servicecatalog\Main; 32 | use GlpiPlugin\Resources\Menu; 33 | use GlpiPlugin\Resources\Resource; 34 | 35 | //central or helpdesk access 36 | if (Session::getCurrentInterface() == 'central') { 37 | Html::header(Menu::getTypeName(2), '', "admin", Menu::class); 38 | } else { 39 | if (Plugin::isPluginActive('servicecatalog')) { 40 | Main::showDefaultHeaderHelpdesk(Menu::getTypeName(2)); 41 | } else { 42 | Html::helpHeader(Resource::getTypeName(2)); 43 | } 44 | } 45 | 46 | $resource = new Resource(); 47 | $menu = new Menu(); 48 | 49 | if ($resource->canView() || Session::haveRight("config", UPDATE)) { 50 | $menu->display(); 51 | } else { 52 | throw new AccessDeniedHttpException(); 53 | } 54 | 55 | if (Session::getCurrentInterface() != 'central' 56 | && Plugin::isPluginActive('servicecatalog')) { 57 | Main::showNavBarFooter('resources'); 58 | } 59 | 60 | if (Session::getCurrentInterface() == 'central') { 61 | Html::footer(); 62 | } else { 63 | Html::helpFooter(); 64 | } 65 | -------------------------------------------------------------------------------- /ajax/addneedcomment.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | 30 | header("Content-Type: text/html; charset=UTF-8"); 31 | Html::header_nocache(); 32 | 33 | Session::checkLoginUser(); 34 | 35 | if (isset($_POST["id"])) { 36 | $items_id = $_POST["id"]; 37 | $rand = $_POST["rand"]; 38 | echo "
"; 39 | echo Html::textarea([ 40 | 'name' => 'commentneed' . $items_id, 41 | 'cols' => '30', 42 | 'rows' => '3', 43 | 'display' => false, 44 | ]); 45 | echo Html::hidden('id', ['value' => $items_id]); 46 | echo "
"; 47 | echo "
"; 48 | echo "

"; 49 | $name = "updateneedcomment[" . $items_id . "]"; 50 | echo Html::submit(_sx('button', 'Add'), ['name' => $name, 'class' => 'btn btn-primary']); 51 | echo " "; 52 | echo Html::submit( 53 | _sx('button', 'Cancel'), 54 | ['name' => 'cancel', 'class' => 'btn btn-primary', 'onclick' => "hideAddForm$items_id();"] 55 | ); 56 | echo "

"; 57 | } else { 58 | echo __("You don't have permission to perform this action."); 59 | } 60 | 61 | -------------------------------------------------------------------------------- /front/importresource.form.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | 30 | use Glpi\Exception\Http\BadRequestHttpException; 31 | use GlpiPlugin\Resources\ImportResource; 32 | use GlpiPlugin\Resources\ImportResourceData; 33 | 34 | Session::checkLoginUser(); 35 | 36 | $importResource = new ImportResource(); 37 | if (isset($_POST["add"])) { 38 | $importResource->add($_POST); 39 | Html::back(); 40 | } elseif (isset($_POST["purge"])) { 41 | $importResource->delete($_POST); 42 | Html::back(); 43 | } elseif (isset($_POST["update"])) { 44 | $importResource->update($_POST); 45 | Html::back(); 46 | } elseif (isset($_POST["import-file"])) { 47 | $importResource->importFileToVerify($_POST); 48 | Html::back(); 49 | } elseif (isset($_POST["verify-file"])) { 50 | $importResource->setFileVerify($_POST); 51 | Html::back(); 52 | } elseif (isset($_GET["reset-imports"])) { 53 | $importResource->purgeDatabase(); 54 | 55 | $importResourceDataDBTM = new ImportResourceData(); 56 | $importResourceDataDBTM->purgeDatabase(); 57 | Html::back(); 58 | } 59 | throw new BadRequestHttpException(); 60 | -------------------------------------------------------------------------------- /front/resourceholiday.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | 30 | use Glpi\Exception\Http\AccessDeniedHttpException; 31 | use GlpiPlugin\Resources\ResourceHoliday; 32 | use GlpiPlugin\Servicecatalog\Main; 33 | use GlpiPlugin\Resources\Menu; 34 | use GlpiPlugin\Resources\Resource; 35 | 36 | if (Session::getCurrentInterface() == 'central') { 37 | //from central 38 | Html::header(Resource::getTypeName(2), '', "admin", Menu::class); 39 | } else { 40 | //from helpdesk 41 | if (Plugin::isPluginActive('servicecatalog')) { 42 | Main::showDefaultHeaderHelpdesk(Menu::getTypeName(2)); 43 | } else { 44 | Html::helpHeader(Resource::getTypeName(2)); 45 | } 46 | } 47 | 48 | $holiday = new ResourceHoliday(); 49 | 50 | if (($holiday->canView() || Session::haveRight("config", UPDATE))) { 51 | Search::show(ResourceHoliday::class); 52 | } else { 53 | throw new AccessDeniedHttpException(); 54 | } 55 | 56 | if (Session::getCurrentInterface() != 'central' 57 | && Plugin::isPluginActive('servicecatalog')) { 58 | Main::showNavBarFooter('resources'); 59 | } 60 | 61 | if (Session::getCurrentInterface() == 'central') { 62 | Html::footer(); 63 | } else { 64 | Html::helpFooter(); 65 | } 66 | -------------------------------------------------------------------------------- /front/resourceresting.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | 30 | use Glpi\Exception\Http\AccessDeniedHttpException; 31 | use GlpiPlugin\Resources\ResourceResting; 32 | use GlpiPlugin\Servicecatalog\Main; 33 | use GlpiPlugin\Resources\Menu; 34 | use GlpiPlugin\Resources\Resource; 35 | 36 | if (Session::getCurrentInterface() == 'central') { 37 | //from central 38 | Html::header(Resource::getTypeName(2), '', "admin", Menu::class); 39 | } else { 40 | //from helpdesk 41 | if (Plugin::isPluginActive('servicecatalog')) { 42 | Main::showDefaultHeaderHelpdesk(Menu::getTypeName(2)); 43 | } else { 44 | Html::helpHeader(Resource::getTypeName(2)); 45 | } 46 | } 47 | 48 | $resting = new ResourceResting(); 49 | 50 | if (($resting->canView() || Session::haveRight("config", UPDATE))) { 51 | Search::show(ResourceResting::class); 52 | } else { 53 | throw new AccessDeniedHttpException(); 54 | } 55 | 56 | if (Session::getCurrentInterface() != 'central' 57 | && Plugin::isPluginActive('servicecatalog')) { 58 | Main::showNavBarFooter('resources'); 59 | } 60 | 61 | if (Session::getCurrentInterface() == 'central') { 62 | Html::footer(); 63 | } else { 64 | Html::helpFooter(); 65 | } 66 | -------------------------------------------------------------------------------- /ajax/verifyCSVStatistics.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | 30 | 31 | use GlpiPlugin\Resources\ImportResource; 32 | 33 | header('Content-Type: application/json'); 34 | Html::header_nocache(); 35 | 36 | Session::checkLoginUser(); 37 | 38 | if (isset($_GET['page']) && isset($_GET['file'])) { 39 | $ImportResource = new ImportResource(); 40 | 41 | $absoluteFilePath = $ImportResource::getLocationOfVerificationFiles() . "/" . $_GET['file']; 42 | 43 | $temp = $ImportResource->readCSVLines($absoluteFilePath, 0, 1); 44 | $header = array_shift($temp); 45 | 46 | $importId = $ImportResource->checkHeader($header); 47 | 48 | $listParams = $ImportResource->fillVerifyParams( 49 | 1, 50 | INF, 51 | $_GET['page'], 52 | $absoluteFilePath, 53 | $importId, 54 | $_GET['file'], 55 | $ImportResource::DISPLAY_STATISTICS, 56 | true 57 | ); 58 | 59 | switch ($_GET['page']) { 60 | case ImportResource::VERIFY_FILE: 61 | $ImportResource->showVerificationFileList($listParams); 62 | break; 63 | case ImportResource::VERIFY_GLPI: 64 | $ImportResource->showVerificationGLPIFromFileList($listParams); 65 | break; 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /install/sql/update-4.0.2.sql: -------------------------------------------------------------------------------- 1 | UPDATE `glpi_displaypreferences` SET `itemtype` = 'GlpiPlugin\\Resources\\Resource' WHERE `glpi_displaypreferences`.`itemtype` = 'PluginResourcesResource'; 2 | UPDATE `glpi_displaypreferences` SET `itemtype` = 'GlpiPlugin\\Resources\\Task' WHERE `glpi_displaypreferences`.`itemtype` = 'PluginResourcesTask'; 3 | UPDATE `glpi_displaypreferences` SET `itemtype` = 'GlpiPlugin\\Resources\\ResourceResting' WHERE `glpi_displaypreferences`.`itemtype` = 'PluginResourcesResourceResting'; 4 | UPDATE `glpi_displaypreferences` SET `itemtype` = 'GlpiPlugin\\Resources\\ResourceHoliday' WHERE `glpi_displaypreferences`.`itemtype` = 'PluginResourcesResourceHoliday'; 5 | UPDATE `glpi_displaypreferences` SET `itemtype` = 'GlpiPlugin\\Resources\\Directory' WHERE `glpi_displaypreferences`.`itemtype` = 'PluginResourcesDirectory'; 6 | UPDATE `glpi_displaypreferences` SET `itemtype` = 'GlpiPlugin\\Resources\\Checklistconfig' WHERE `glpi_displaypreferences`.`itemtype` = 'PluginResourcesChecklistconfig'; 7 | UPDATE `glpi_displaypreferences` SET `itemtype` = 'GlpiPlugin\\Resources\\ChoiceItem' WHERE `glpi_displaypreferences`.`itemtype` = 'PluginResourcesChoiceItem'; 8 | UPDATE `glpi_displaypreferences` SET `itemtype` = 'GlpiPlugin\\Resources\\Employment' WHERE `glpi_displaypreferences`.`itemtype` = 'PluginResourcesEmployment'; 9 | UPDATE `glpi_displaypreferences` SET `itemtype` = 'GlpiPlugin\\Resources\\Budget' WHERE `glpi_displaypreferences`.`itemtype` = 'PluginResourcesBudget'; 10 | UPDATE `glpi_displaypreferences` SET `itemtype` = 'GlpiPlugin\\Resources\\Recap' WHERE `glpi_displaypreferences`.`itemtype` = 'PluginResourcesRecap'; 11 | UPDATE `glpi_displaypreferences` SET `itemtype` = 'GlpiPlugin\\Resources\\Client' WHERE `glpi_displaypreferences`.`itemtype` = 'PluginResourcesClient'; 12 | UPDATE `glpi_displaypreferences` SET `itemtype` = 'GlpiPlugin\\Resources\\Habilitation' WHERE `glpi_displaypreferences`.`itemtype` = 'PluginResourcesHabilitation'; 13 | UPDATE `glpi_displaypreferences` SET `itemtype` = 'GlpiPlugin\\Resources\\ContractType' WHERE `glpi_displaypreferences`.`itemtype` = 'PluginResourcesContractType'; 14 | UPDATE `glpi_displaypreferences` SET `itemtype` = 'GlpiPlugin\\Resources\\Team' WHERE `glpi_displaypreferences`.`itemtype` = 'PluginResourcesTeam'; 15 | UPDATE `glpi_displaypreferences` SET `itemtype` = 'GlpiPlugin\\Resources\\ResignationReason' WHERE `glpi_displaypreferences`.`itemtype` = 'PluginResourcesResignationReason'; 16 | -------------------------------------------------------------------------------- /front/budget.form.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | 30 | use GlpiPlugin\Resources\Budget; 31 | use GlpiPlugin\Resources\Menu; 32 | use GlpiPlugin\Resources\Resource; 33 | 34 | if (!isset($_GET["id"])) { 35 | $_GET["id"] = ""; 36 | } 37 | 38 | $budget = new Budget(); 39 | 40 | if (isset($_POST["add"])) { 41 | $budget->check(-1, UPDATE); 42 | $newID = $budget->add($_POST); 43 | 44 | Html::back(); 45 | } elseif (isset($_POST["update"])) { 46 | $budget->check($_POST["id"], UPDATE); 47 | $budget->update($_POST); 48 | 49 | Html::back(); 50 | } elseif (isset($_POST["delete"])) { 51 | $budget->check($_POST["id"], UPDATE); 52 | $budget->delete($_POST); 53 | 54 | $budget->redirectToList(); 55 | } elseif (isset($_POST["purge"])) { 56 | $budget->check($_POST['id'], UPDATE); 57 | $budget->delete($_POST, 1); 58 | 59 | $budget->redirectToList(); 60 | } elseif (isset($_POST["restore"])) { 61 | $budget->check($_POST["id"], UPDATE); 62 | $budget->restore($_POST); 63 | 64 | $budget->redirectToList(); 65 | } else { 66 | $budget->checkGlobal(READ); 67 | Html::header(Resource::getTypeName(2), '', "admin", Menu::class, strtolower(Budget::getType())); 68 | $budget->display(['id' => $_GET["id"]]); 69 | Html::footer(); 70 | } 71 | -------------------------------------------------------------------------------- /front/rulesengine.test.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | 30 | Session::checkCentralAccess(); 31 | 32 | if (isset($_POST["sub_type"])) { 33 | $sub_type = $_POST["sub_type"]; 34 | } elseif (isset($_GET["sub_type"])) { 35 | $sub_type = $_GET["sub_type"]; 36 | } else { 37 | $sub_type = 0; 38 | } 39 | 40 | if (isset($_POST["condition"])) { 41 | $condition = $_POST["condition"]; 42 | } elseif (isset($_GET["condition"])) { 43 | $condition = $_GET["condition"]; 44 | } else { 45 | $condition = 0; 46 | } 47 | 48 | $rulecollection = RuleCollection::getClassByType($sub_type); 49 | if ($rulecollection->isRuleRecursive()) { 50 | $rulecollection->setEntity($_SESSION['glpiactive_entity']); 51 | } 52 | $rulecollection->checkGlobal(READ); 53 | 54 | Html::popHeader(__('Setup'), $_SERVER['PHP_SELF']); 55 | 56 | // Need for RuleEngines 57 | foreach ($_POST as $key => $val) { 58 | $_POST[$key] = stripslashes($_POST[$key]); 59 | } 60 | $input = $rulecollection->showRulesEnginePreviewCriteriasForm($_SERVER['PHP_SELF'], $_POST, $condition); 61 | 62 | if (isset($_POST["test_all_rules"])) { 63 | //Unset values that must not be processed by the rule 64 | unset($_POST["sub_type"]); 65 | unset($_POST["test_all_rules"]); 66 | 67 | echo "
"; 68 | $rulecollection->showRulesEnginePreviewResultsForm($_SERVER['PHP_SELF'], $_POST, $condition); 69 | } 70 | 71 | Html::popFooter(); 72 | -------------------------------------------------------------------------------- /front/checklist.form.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | 30 | use GlpiPlugin\Resources\Checklist; 31 | use GlpiPlugin\Resources\Menu; 32 | use GlpiPlugin\Resources\Resource; 33 | 34 | if (!isset($_GET["id"])) { 35 | $_GET["id"] = ""; 36 | } 37 | if (!isset($_GET["plugin_resources_contracttypes_id"])) { 38 | $_GET["plugin_resources_contracttypes_id"] = 0; 39 | } 40 | if (!isset($_GET["checklist_type"])) { 41 | $_GET["checklist_type"] = 0; 42 | } 43 | if (!isset($_GET["plugin_resources_resources_id"])) { 44 | $_GET["plugin_resources_resources_id"] = -1; 45 | } 46 | 47 | $checklist = new Checklist(); 48 | 49 | //from central 50 | //update checklist 51 | if (isset($_POST["add"])) { 52 | $checklist->add($_POST); 53 | Html::back(); 54 | } elseif (isset($_POST["update"])) { 55 | if ($checklist->canCreate()) { 56 | $checklist->update($_POST); 57 | } 58 | Html::back(); 59 | } else { 60 | $checklist->checkGlobal(READ); 61 | Html::header(Resource::getTypeName(2), '', "admin", Menu::class, Checklist::class); 62 | $options = [ 63 | 'id' => $_GET["id"], 64 | 'checklist_type' => $_GET["checklist_type"], 65 | 'plugin_resources_contracttypes_id' => $_GET["plugin_resources_contracttypes_id"], 66 | 'plugin_resources_resources_id' => $_GET["plugin_resources_resources_id"] 67 | ]; 68 | $checklist->display($options); 69 | Html::footer(); 70 | } 71 | -------------------------------------------------------------------------------- /src/ResourceFunction.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | 30 | namespace GlpiPlugin\Resources; 31 | 32 | use CommonDropdown; 33 | use Session; 34 | 35 | if (!defined('GLPI_ROOT')) { 36 | die("Sorry. You can't access directly to this file"); 37 | } 38 | 39 | /** 40 | * Class ResourceFunction 41 | */ 42 | class ResourceFunction extends CommonDropdown 43 | { 44 | 45 | static $rightname = 'plugin_resources_role'; 46 | 47 | /** 48 | * @param $nb 49 | **@since 0.85 50 | * 51 | */ 52 | static function getTypeName($nb = 0) 53 | { 54 | return _n('Function', 'Functions', $nb, 'resources'); 55 | } 56 | 57 | /** 58 | * @return 59 | */ 60 | static function canView(): bool 61 | { 62 | return Session::haveRight(self::$rightname, READ); 63 | } 64 | 65 | /** 66 | * @return 67 | */ 68 | static function canCreate(): bool 69 | { 70 | return Session::haveRightsOr(self::$rightname, [CREATE, UPDATE, DELETE]); 71 | } 72 | 73 | 74 | /** 75 | * @return array 76 | */ 77 | function rawSearchOptions() 78 | { 79 | $tab = parent::rawSearchOptions(); 80 | return $tab; 81 | } 82 | 83 | 84 | /** 85 | * is_active = 1 during a creation 86 | * 87 | * @return 88 | */ 89 | function post_getEmpty() 90 | { 91 | $this->fields['is_active'] = 1; 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /front/resource.transfer.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | 30 | use GlpiPlugin\Servicecatalog\Main; 31 | use GlpiPlugin\Resources\Menu; 32 | use GlpiPlugin\Resources\Resource; 33 | 34 | if (Session::getCurrentInterface() == 'central') { 35 | Html::header(Resource::getTypeName(2), '', "admin", Menu::class); 36 | } else { 37 | if (Plugin::isPluginActive('servicecatalog')) { 38 | Main::showDefaultHeaderHelpdesk(Menu::getTypeName(2)); 39 | } else { 40 | Html::helpHeader(Resource::getTypeName(2)); 41 | } 42 | } 43 | 44 | $resource = new Resource(); 45 | 46 | if (isset($_POST["transferresources"])) { 47 | if ($resource->checkTransferMandatoryFields($_POST)) { 48 | $resource->transferResource($_POST["plugin_resources_resources_id"], $_POST['entities_id'], $_POST); 49 | Html::redirect(PLUGIN_RESOURCES_WEBDIR . "/front/resource.change.php"); 50 | } else { 51 | Html::back(); 52 | } 53 | } else { 54 | if ($resource->canView() || Session::haveRight("config", "w")) { 55 | //show remove resource form 56 | $resource->showResourcesToTransfer($_GET['plugin_resources_resources_id']); 57 | } 58 | } 59 | 60 | if (Session::getCurrentInterface() != 'central' 61 | && Plugin::isPluginActive('servicecatalog')) { 62 | Main::showNavBarFooter('resources'); 63 | } 64 | 65 | if (Session::getCurrentInterface() == 'central') { 66 | Html::footer(); 67 | } else { 68 | Html::helpFooter(); 69 | } 70 | -------------------------------------------------------------------------------- /front/directory.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | 30 | use Glpi\Exception\Http\AccessDeniedHttpException; 31 | use GlpiPlugin\Servicecatalog\Main; 32 | use GlpiPlugin\Resources\Directory; 33 | use GlpiPlugin\Resources\Menu; 34 | use GlpiPlugin\Resources\Resource; 35 | 36 | //show list of users linked with a resource 37 | if (Session::getCurrentInterface() == 'central') { 38 | Html::header(Resource::getTypeName(2), '', "admin", Menu::class); 39 | } else { 40 | if (Plugin::isPluginActive('servicecatalog')) { 41 | Main::showDefaultHeaderHelpdesk(Menu::getTypeName(2)); 42 | } else { 43 | Html::helpHeader(Resource::getTypeName(2)); 44 | } 45 | } 46 | 47 | $directory = new Directory(); 48 | 49 | if (($directory->canView() || Session::haveRight("config", UPDATE))) { 50 | if (empty($_GET["sort"])) { 51 | $_GET["sort"] = "34"; 52 | } 53 | if (empty($_GET["order"])) { 54 | $_GET["order"] = "ASC"; 55 | } 56 | 57 | $params = Search::manageParams(Directory::class, $_GET); 58 | Search::showGenericSearch(Directory::class, $params); 59 | $directory->showList(Directory::class, $params); 60 | } else { 61 | throw new AccessDeniedHttpException(); 62 | } 63 | 64 | if (Session::getCurrentInterface() != 'central' 65 | && Plugin::isPluginActive('servicecatalog')) { 66 | Main::showNavBarFooter('resources'); 67 | } 68 | 69 | if (Session::getCurrentInterface() == 'central') { 70 | Html::footer(); 71 | } else { 72 | Html::helpFooter(); 73 | } 74 | -------------------------------------------------------------------------------- /ajax/comments.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | 30 | use Glpi\Exception\Http\NotFoundHttpException; 31 | use GlpiPlugin\Resources\Resource; 32 | 33 | $AJAX_INCLUDE = 1; 34 | 35 | // Send UTF8 Headers 36 | header("Content-Type: text/html; charset=UTF-8"); 37 | Html::header_nocache(); 38 | 39 | Session::checkLoginUser(); 40 | global $DB; 41 | 42 | if (isset($_REQUEST["table"]) && isset($_REQUEST["value"])) { 43 | // Security 44 | if (!$DB->tableExists($_REQUEST['table'])) { 45 | throw new NotFoundHttpException(); 46 | } 47 | 48 | switch ($_REQUEST["table"]) { 49 | case "glpi_plugin_resources_resources" : 50 | if ($_REQUEST['value'] == 0) { 51 | $tmpname['link'] = PLUGIN_RESOURCES_WEBDIR . "/front/resource.php"; 52 | $tmpname['comment'] = ""; 53 | } else { 54 | $tmpname = Resource::getResourceName($_REQUEST["value"], 2); 55 | } 56 | echo $tmpname["comment"]; 57 | 58 | if (isset($_REQUEST['withlink'])) { 59 | echo "\n"; 62 | } 63 | break; 64 | 65 | default : 66 | if ($_REQUEST["value"] > 0) { 67 | $tmpname = Dropdown::getDropdownName($_REQUEST["table"], $_REQUEST["value"], 1); 68 | echo $tmpname["comment"]; 69 | } 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /front/resourcehabilitation.form.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | 30 | use GlpiPlugin\Resources\ResourceHabilitation; 31 | use GlpiPlugin\Servicecatalog\Main; 32 | use GlpiPlugin\Resources\Menu; 33 | use GlpiPlugin\Resources\Resource; 34 | 35 | if (Session::getCurrentInterface() == 'central') { 36 | //from central 37 | Html::header(Resource::getTypeName(2), '', "admin", Menu::class); 38 | } else { 39 | //from helpdesk 40 | if (Plugin::isPluginActive('servicecatalog')) { 41 | Main::showDefaultHeaderHelpdesk(Menu::getTypeName(2)); 42 | } else { 43 | Html::helpHeader(Resource::getTypeName(2)); 44 | } 45 | } 46 | 47 | if (!isset($_GET["id"])) { 48 | $_GET["id"] = ""; 49 | } 50 | 51 | $habilitation = new ResourceHabilitation(); 52 | 53 | if (isset($_POST['add'])) { 54 | if (isset($_POST['plugin_resources_habilitations_id']) && 55 | !empty($_POST['plugin_resources_habilitations_id']) && 56 | $_POST['plugin_resources_habilitations_id']) { 57 | $habilitation->check(-1, UPDATE, $_POST); 58 | $habilitation->add($_POST); 59 | } 60 | Html::back(); 61 | } elseif (isset($_POST["delete"])) { 62 | $habilitation->check($_POST["id"], UPDATE); 63 | $habilitation->delete($_POST); 64 | Html::back(); 65 | } 66 | 67 | if (Session::getCurrentInterface() != 'central' 68 | && Plugin::isPluginActive('servicecatalog')) { 69 | Main::showNavBarFooter('resources'); 70 | } 71 | 72 | if (Session::getCurrentInterface() == 'central') { 73 | Html::footer(); 74 | } else { 75 | Html::helpFooter(); 76 | } 77 | -------------------------------------------------------------------------------- /src/RuleContracttypeCollection.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | 30 | namespace GlpiPlugin\Resources; 31 | 32 | use RuleCollection; 33 | use Session; 34 | 35 | if (!defined('GLPI_ROOT')) { 36 | die("Sorry. You can't access directly to this file"); 37 | } 38 | 39 | 40 | /** 41 | * Class RuleContracttypeCollection 42 | */ 43 | class RuleContracttypeCollection extends RuleCollection 44 | { 45 | 46 | static $rightname = 'plugin_resources'; 47 | 48 | // From RuleCollection 49 | public $stop_on_first_match = true; 50 | public $menu_option = 'contracttypes'; 51 | 52 | /** 53 | * Get title used in list of rules 54 | * 55 | * @return string of the rule collection 56 | **/ 57 | function getTitle() 58 | { 59 | return __('Assignment rule of fields to a contract type', 'resources'); 60 | } 61 | 62 | /** 63 | * RuleContracttypeCollection constructor. 64 | * 65 | * @param int $entity 66 | */ 67 | function __construct($entity = 0) 68 | { 69 | $this->entity = $entity; 70 | } 71 | 72 | /** 73 | * @return bool 74 | */ 75 | function showInheritedTab() 76 | { 77 | return Session::haveRightsOr(self::$rightname, [CREATE, UPDATE, DELETE]) && ($this->entity); 78 | } 79 | 80 | /** 81 | * @return bool 82 | */ 83 | function showChildrensTab() 84 | { 85 | return Session::haveRightsOr(self::$rightname, [CREATE, UPDATE, DELETE]) && (count( 86 | $_SESSION['glpiactiveentities'] 87 | ) > 1); 88 | } 89 | } 90 | 91 | -------------------------------------------------------------------------------- /front/config.form.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | 30 | use GlpiPlugin\Resources\Config; 31 | use GlpiPlugin\Resources\Menu; 32 | use GlpiPlugin\Resources\Resource; 33 | use GlpiPlugin\Resources\ResourceBadge; 34 | use GlpiPlugin\Resources\TicketCategory; 35 | use GlpiPlugin\Resources\TransferEntity; 36 | 37 | Session::checkRight("config", UPDATE); 38 | 39 | if (Plugin::isPluginActive("resources")) { 40 | $cat = new TicketCategory(); 41 | $transferEntity = new TransferEntity(); 42 | $resourceBadge = new ResourceBadge(); 43 | $config = new Config(); 44 | 45 | if (isset($_POST["add_ticket"])) { 46 | $cat->addTicketCategory($_POST['ticketcategories_id']); 47 | Html::back(); 48 | } elseif (isset($_POST["delete_ticket"])) { 49 | if (isset($_POST['id'])) { 50 | $cat->delete(['id' => $_POST['id']]); 51 | } 52 | Html::back(); 53 | } elseif (isset($_POST["add_transferentity"])) { 54 | $transferEntity->check(-1, UPDATE, $_POST); 55 | $transferEntity->add($_POST); 56 | Html::back(); 57 | } elseif (isset($_POST["update_setup"])) { 58 | $config->check(-1, UPDATE, $_POST); 59 | $config->update($_POST); 60 | Html::back(); 61 | } else { 62 | Html::header(Resource::getTypeName(2), '', "admin", Menu::class); 63 | //setup 64 | $config->display($_GET); 65 | } 66 | } else { 67 | Html::header(__('Setup'), '', "config", "plugin"); 68 | echo "
"; 69 | echo "" . __('Please activate the plugin', 'resources') . "
"; 70 | } 71 | 72 | Html::footer(); 73 | -------------------------------------------------------------------------------- /front/resourceimport.form.php: -------------------------------------------------------------------------------- 1 | $selected) { 16 | if ($selected) { 17 | // Update 18 | if ($_POST['resource'][$key]) { 19 | $input = [ 20 | 'resourceID' => $_POST['resource'][$key], 21 | 'datas' => $_POST['import'][$key] 22 | ]; 23 | 24 | $pluginResourcesResourceImport->update($input); 25 | $pluginResourcesImportResource = new ImportResource(); 26 | $pluginResourcesImportResource->delete(['id' => $key]); 27 | } //New 28 | else { 29 | $import->check(-1, CREATE, $_POST); 30 | $input = [ 31 | 'importID' => $key, 32 | 'datas' => $_POST['import'][$key] 33 | ]; 34 | 35 | $pluginResourcesResourceImport->add($input); 36 | $pluginResourcesImportResource = new ImportResource(); 37 | $pluginResourcesImportResource->delete(['id' => $key]); 38 | } 39 | } 40 | } 41 | redirectWithParameters(ImportResource::getIndexUrl(), $_GET); 42 | } elseif (isset($_POST["purge"])) { 43 | $import->check($_POST['id'], PURGE); 44 | $pluginResourcesResourceImport->delete($_POST); 45 | redirectWithParameters(ImportResource::getIndexUrl(), $_GET); 46 | } elseif (isset($_POST["delete"])) { 47 | foreach ($_POST['select'] as $key => $selected) { 48 | if ($selected) { 49 | $pluginResourcesImportResource = new ImportResource(); 50 | 51 | $input = [ 52 | ImportResource::getIndexName() => $key 53 | ]; 54 | 55 | $pluginResourcesImportResource->delete($input); 56 | } 57 | } 58 | redirectWithParameters(ImportResource::getIndexUrl(), $_GET); 59 | } 60 | throw new BadRequestHttpException(); 61 | 62 | function redirectWithParameters($url, array $parameters) 63 | { 64 | $params = ""; 65 | if (count($parameters)) { 66 | $iterator = 0; 67 | foreach ($parameters as $key => $parameter) { 68 | if ($iterator === 0) { 69 | $params .= "?$key=$parameter"; 70 | } else { 71 | $params .= "&$key=$parameter"; 72 | } 73 | $iterator++; 74 | } 75 | } 76 | Html::redirect($url . $params); 77 | } 78 | -------------------------------------------------------------------------------- /src/RuleContracttypeHiddenCollection.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | 30 | namespace GlpiPlugin\Resources; 31 | 32 | use RuleCollection; 33 | use Session; 34 | 35 | if (!defined('GLPI_ROOT')) { 36 | die("Sorry. You can't access directly to this file"); 37 | } 38 | 39 | 40 | /** 41 | * Class RuleContracttypeHiddenCollection 42 | */ 43 | class RuleContracttypeHiddenCollection extends RuleCollection 44 | { 45 | 46 | static $rightname = 'plugin_resources'; 47 | 48 | // From RuleCollection 49 | public $stop_on_first_match = true; 50 | public $menu_option = 'contracttypehiddens'; 51 | 52 | /** 53 | * Get title used in list of rules 54 | * 55 | * @return string of the rule collection 56 | **/ 57 | function getTitle() 58 | { 59 | return __('Assignment rule of hidden fields to a contract type', 'resources'); 60 | } 61 | 62 | /** 63 | * RuleContracttypeCollection constructor. 64 | * 65 | * @param int $entity 66 | */ 67 | function __construct($entity = 0) 68 | { 69 | $this->entity = $entity; 70 | } 71 | 72 | /** 73 | * @return bool 74 | */ 75 | function showInheritedTab() 76 | { 77 | return Session::haveRightsOr(self::$rightname, [CREATE, UPDATE, DELETE]) && ($this->entity); 78 | } 79 | 80 | /** 81 | * @return bool 82 | */ 83 | function showChildrensTab() 84 | { 85 | return Session::haveRightsOr(self::$rightname, [CREATE, UPDATE, DELETE]) && (count( 86 | $_SESSION['glpiactiveentities'] 87 | ) > 1); 88 | } 89 | } 90 | 91 | -------------------------------------------------------------------------------- /front/rule.test.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | 30 | Session::checkCentralAccess(); 31 | 32 | if (isset($_POST["sub_type"])) { 33 | $sub_type = $_POST["sub_type"]; 34 | } elseif (isset($_GET["sub_type"])) { 35 | $sub_type = $_GET["sub_type"]; 36 | } else { 37 | $sub_type = 0; 38 | } 39 | 40 | if (isset($_POST["rules_id"])) { 41 | $rules_id = $_POST["rules_id"]; 42 | } elseif (isset($_GET["rules_id"])) { 43 | $rules_id = $_GET["rules_id"]; 44 | } else { 45 | $rules_id = 0; 46 | } 47 | $dbu = new DbUtils(); 48 | if (!$rule = $dbu->getItemForItemtype($sub_type)) { 49 | exit; 50 | } 51 | $rule->checkGlobal(READ); 52 | 53 | $test_rule_output = null; 54 | 55 | Html::popHeader(__('Setup'), $_SERVER['PHP_SELF']); 56 | 57 | $rule->showRulePreviewCriteriasForm($_SERVER['PHP_SELF'], $rules_id); 58 | 59 | if (isset($_POST["test_rule"])) { 60 | $params = []; 61 | //Unset values that must not be processed by the rule 62 | unset($_POST["test_rule"]); 63 | unset($_POST["rules_id"]); 64 | unset($_POST["sub_type"]); 65 | $rule->getRuleWithCriteriasAndActions($rules_id, 1, 1); 66 | 67 | // Need for RuleEngines 68 | foreach ($_POST as $key => $val) { 69 | $_POST[$key] = stripslashes($_POST[$key]); 70 | } 71 | //Add rules specific POST fields to the param array 72 | $params = $rule->addSpecificParamsForPreview($params); 73 | 74 | $input = $rule->prepareAllInputDataForProcess($_POST, $params); 75 | //$rule->regex_results = array(); 76 | echo "
"; 77 | $rule->showRulePreviewResultsForm($_SERVER['PHP_SELF'], $input, $params); 78 | } 79 | 80 | Html::popFooter(); 81 | --------------------------------------------------------------------------------