Пример #1
0
 the Free Software Foundation; either version 2 of the License, or
 (at your option) any later version.

 Resources is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.

 You should have received a copy of the GNU General Public License
 along with Resources. If not, see <http://www.gnu.org/licenses/>.
 --------------------------------------------------------------------------
*/
include '../../../inc/includes.php';
$resource = new PluginResourcesResource();
$employee = new PluginResourcesEmployee();
$choice = new PluginResourcesChoice();
$resource->checkGlobal("r");
if ($_SESSION['glpiactiveprofile']['interface'] == 'central') {
    //from central
    Html::header(PluginResourcesResource::getTypeName(2), '', "plugins", "resources");
} else {
    //from helpdesk
    Html::helpHeader(PluginResourcesResource::getTypeName(2));
}
if (isset($_POST["first_step"]) || isset($_GET["first_step"])) {
    if (!isset($_POST["template"])) {
        $_POST["template"] = $_GET["template"];
    }
    if (!isset($_POST["withtemplate"])) {
        $_POST["withtemplate"] = $_GET["withtemplate"];
    }
Пример #2
0
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

Resources is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with Resources. If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------
*/
include '../../../inc/includes.php';
//from helpdesk
Html::helpHeader(PluginResourcesResource::getTypeName(2));
$choice = new PluginResourcesChoice();
$resource = new PluginResourcesResource();
//add items needs from helpdesk
if (isset($_POST["addhelpdeskitem"])) {
    if ($_POST['plugin_resources_choiceitems_id'] > 0 && $_POST['plugin_resources_resources_id'] > 0) {
        if ($resource->canCreate()) {
            $choice->addHelpdeskItem($_POST);
        }
    }
    Html::back();
} else {
    if (isset($_POST["deletehelpdeskitem"])) {
        if ($resource->canCreate()) {
            $choice->delete(array('id' => $_POST["id"]));
        }
        Html::back();
Пример #3
0
 function post_addItem()
 {
     global $CFG_GLPI;
     // Manage add from template
     if (isset($this->input["_oldID"])) {
         // ADD choices
         PluginResourcesChoice::cloneItem($this->input["_oldID"], $this->fields['id']);
         // ADD items
         PluginResourcesResource_Item::cloneItem($this->input["_oldID"], $this->fields['id']);
         // ADD reports
         PluginResourcesReportConfig::cloneItem($this->input["_oldID"], $this->fields['id']);
         //manage template from helpdesk (no employee to add : resource.form.php)
         if (!isset($this->input["add_from_helpdesk"])) {
             PluginResourcesEmployee::cloneItem($this->input["_oldID"], $this->fields['id']);
         }
         // ADD Documents
         Document_Item::cloneItem($this->getType(), $this->input["_oldID"], $this->fields['id']);
         // ADD tasks
         PluginResourcesTask::cloneItem($this->input["_oldID"], $this->fields['id']);
     }
     //Launch notification
     if (isset($this->input['withtemplate']) && $this->input["withtemplate"] != 1 && isset($this->input['send_notification']) && $this->input['send_notification'] == 1) {
         if ($CFG_GLPI["use_mailing"]) {
             NotificationEvent::raiseEvent("new", $this);
         }
     }
     //ADD Checklists from rules
     $PluginResourcesChecklistconfig = new PluginResourcesChecklistconfig();
     $PluginResourcesChecklistconfig->addChecklistsFromRules($this, PluginResourcesChecklist::RESOURCES_CHECKLIST_IN);
     $PluginResourcesChecklistconfig->addChecklistsFromRules($this, PluginResourcesChecklist::RESOURCES_CHECKLIST_OUT);
 }
Пример #4
0
You should have received a copy of the GNU General Public License
along with Resources. If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------
*/
include '../../../inc/includes.php';
if (!isset($_GET["id"])) {
    $_GET["id"] = "";
}
if (!isset($_GET["withtemplate"])) {
    $_GET["withtemplate"] = "";
}
$resource = new PluginResourcesResource();
$checklist = new PluginResourcesChecklist();
$checklistconfig = new PluginResourcesChecklistconfig();
$employee = new PluginResourcesEmployee();
$choice = new PluginResourcesChoice();
$resource_item = new PluginResourcesResource_Item();
$cat = new PluginResourcesTicketCategory();
$task = new PluginResourcesTask();
/////////////////////////////////resource from helpdesk///////////////////////////////
if (isset($_POST["resend"])) {
    $resource->reSendResourceCreation($_POST);
    $resource->redirectToList();
    //from helpdesk
    //add items needs of a resource
} else {
    if (isset($_POST["addhelpdeskitem"])) {
        if ($_POST['plugin_resources_choiceitems_id'] > 0 && $_POST['plugin_resources_resources_id'] > 0) {
            if ($resource->canCreate()) {
                $choice->addHelpdeskItem($_POST);
            }
Пример #5
0
function plugin_resources_install()
{
    global $DB;
    foreach (glob(GLPI_ROOT . '/plugins/resources/inc/*.php') as $file) {
        if (!preg_match('/resourceinjection/', $file) && !preg_match('/clientinjection/', $file) && !preg_match('/resourcepdf/', $file) && !preg_match('/datecriteria/', $file)) {
            include_once $file;
        }
    }
    $update = false;
    $update78 = false;
    $update80 = false;
    $update804 = false;
    $update83 = false;
    $install = false;
    if (!TableExists("glpi_plugin_resources_resources") && !TableExists("glpi_plugin_resources_employments")) {
        $install = true;
        //      $DB->runFile(GLPI_ROOT ."/plugins/resources/sql/empty-1.9.0.sql");
        //      $DB->runFile(GLPI_ROOT ."/plugins/resources/sql/update-1.9.1.sql");
        $DB->runFile(GLPI_ROOT . "/plugins/resources/sql/empty-1.9.1.sql");
        $query = "INSERT INTO `glpi_plugin_resources_contracttypes` ( `id`, `name`,`comment`)\n         VALUES (1, '" . __('Long term contract', 'resources') . "', '')";
        $DB->query($query) or die($DB->error());
        $query = "INSERT INTO `glpi_plugin_resources_contracttypes` ( `id`, `name`,`comment`)\n               VALUES (2, '" . __('Fixed term contract', 'resources') . "', '')";
        $DB->query($query) or die($DB->error());
        $query = "INSERT INTO `glpi_plugin_resources_contracttypes` ( `id`, `name`,`comment`)\n               VALUES (3, '" . __('Trainee', 'resources') . "', '')";
        $DB->query($query) or die($DB->error());
    } else {
        if (TableExists("glpi_plugin_resources") && !TableExists("glpi_plugin_resources_employee")) {
            $update = true;
            $update78 = true;
            $update80 = true;
            $update804 = true;
            $update83 = true;
            $DB->runFile(GLPI_ROOT . "/plugins/resources/sql/update-1.4.sql");
            $DB->runFile(GLPI_ROOT . "/plugins/resources/sql/update-1.5.0.sql");
            $DB->runFile(GLPI_ROOT . "/plugins/resources/sql/update-1.5.1.sql");
            $DB->runFile(GLPI_ROOT . "/plugins/resources/sql/update-1.6.0.sql");
            $DB->runFile(GLPI_ROOT . "/plugins/resources/sql/update-1.6.1.sql");
            $DB->runFile(GLPI_ROOT . "/plugins/resources/sql/update-1.6.2.sql");
            $DB->runFile(GLPI_ROOT . "/plugins/resources/sql/update-1.7.0.sql");
            $DB->runFile(GLPI_ROOT . "/plugins/resources/sql/update-1.7.1.sql");
            $DB->runFile(GLPI_ROOT . "/plugins/resources/sql/update-1.9.0.sql");
            $DB->runFile(GLPI_ROOT . "/plugins/resources/sql/update-1.9.1.sql");
        } else {
            if (TableExists("glpi_plugin_resources_profiles") && FieldExists("glpi_plugin_resources_profiles", "interface")) {
                $update = true;
                $update78 = true;
                $update80 = true;
                $update804 = true;
                $update83 = true;
                $DB->runFile(GLPI_ROOT . "/plugins/resources/sql/update-1.5.0.sql");
                $DB->runFile(GLPI_ROOT . "/plugins/resources/sql/update-1.5.1.sql");
                $DB->runFile(GLPI_ROOT . "/plugins/resources/sql/update-1.6.0.sql");
                $DB->runFile(GLPI_ROOT . "/plugins/resources/sql/update-1.6.1.sql");
                $DB->runFile(GLPI_ROOT . "/plugins/resources/sql/update-1.6.2.sql");
                $DB->runFile(GLPI_ROOT . "/plugins/resources/sql/update-1.7.0.sql");
                $DB->runFile(GLPI_ROOT . "/plugins/resources/sql/update-1.7.1.sql");
                $DB->runFile(GLPI_ROOT . "/plugins/resources/sql/update-1.9.0.sql");
                $DB->runFile(GLPI_ROOT . "/plugins/resources/sql/update-1.9.1.sql");
            } else {
                if (TableExists("glpi_plugin_resources") && !FieldExists("glpi_plugin_resources", "helpdesk_visible")) {
                    $update = true;
                    $update78 = true;
                    $update80 = true;
                    $update804 = true;
                    $update83 = true;
                    $DB->runFile(GLPI_ROOT . "/plugins/resources/sql/update-1.5.1.sql");
                    $DB->runFile(GLPI_ROOT . "/plugins/resources/sql/update-1.6.0.sql");
                    $DB->runFile(GLPI_ROOT . "/plugins/resources/sql/update-1.6.1.sql");
                    $DB->runFile(GLPI_ROOT . "/plugins/resources/sql/update-1.6.2.sql");
                    $DB->runFile(GLPI_ROOT . "/plugins/resources/sql/update-1.7.0.sql");
                    $DB->runFile(GLPI_ROOT . "/plugins/resources/sql/update-1.7.1.sql");
                    $DB->runFile(GLPI_ROOT . "/plugins/resources/sql/update-1.9.0.sql");
                    $DB->runFile(GLPI_ROOT . "/plugins/resources/sql/update-1.9.1.sql");
                } else {
                    if (!TableExists("glpi_plugin_resources_contracttypes")) {
                        $update = true;
                        $update78 = true;
                        $update80 = true;
                        $update804 = true;
                        $update83 = true;
                        $DB->runFile(GLPI_ROOT . "/plugins/resources/sql/update-1.6.0.sql");
                        $DB->runFile(GLPI_ROOT . "/plugins/resources/sql/update-1.6.1.sql");
                        $DB->runFile(GLPI_ROOT . "/plugins/resources/sql/update-1.6.2.sql");
                        $DB->runFile(GLPI_ROOT . "/plugins/resources/sql/update-1.7.0.sql");
                        $DB->runFile(GLPI_ROOT . "/plugins/resources/sql/update-1.7.1.sql");
                        $DB->runFile(GLPI_ROOT . "/plugins/resources/sql/update-1.9.0.sql");
                        $DB->runFile(GLPI_ROOT . "/plugins/resources/sql/update-1.9.1.sql");
                    } else {
                        if (TableExists("glpi_plugin_resources_contracttypes") && !FieldExists("glpi_plugin_resources_resources", "plugin_resources_resourcestates_id")) {
                            $update = true;
                            $update80 = true;
                            $update804 = true;
                            $update83 = true;
                            $DB->runFile(GLPI_ROOT . "/plugins/resources/sql/update-1.6.1.sql");
                            $DB->runFile(GLPI_ROOT . "/plugins/resources/sql/update-1.6.2.sql");
                            $DB->runFile(GLPI_ROOT . "/plugins/resources/sql/update-1.7.0.sql");
                            $DB->runFile(GLPI_ROOT . "/plugins/resources/sql/update-1.7.1.sql");
                            $DB->runFile(GLPI_ROOT . "/plugins/resources/sql/update-1.9.0.sql");
                            $DB->runFile(GLPI_ROOT . "/plugins/resources/sql/update-1.9.1.sql");
                        } else {
                            if (!TableExists("glpi_plugin_resources_reportconfigs")) {
                                $update = true;
                                $update80 = true;
                                $update804 = true;
                                $update83 = true;
                                $DB->runFile(GLPI_ROOT . "/plugins/resources/sql/update-1.6.2.sql");
                                $DB->runFile(GLPI_ROOT . "/plugins/resources/sql/update-1.7.0.sql");
                                $DB->runFile(GLPI_ROOT . "/plugins/resources/sql/update-1.7.1.sql");
                                $DB->runFile(GLPI_ROOT . "/plugins/resources/sql/update-1.9.0.sql");
                                $DB->runFile(GLPI_ROOT . "/plugins/resources/sql/update-1.9.1.sql");
                            } else {
                                if (!TableExists("glpi_plugin_resources_checklistconfigs")) {
                                    $update80 = true;
                                    $update804 = true;
                                    $update83 = true;
                                    $DB->runFile(GLPI_ROOT . "/plugins/resources/sql/update-1.7.0.sql");
                                    $DB->runFile(GLPI_ROOT . "/plugins/resources/sql/update-1.7.1.sql");
                                    $DB->runFile(GLPI_ROOT . "/plugins/resources/sql/update-1.9.0.sql");
                                    $DB->runFile(GLPI_ROOT . "/plugins/resources/sql/update-1.9.1.sql");
                                } else {
                                    if (!TableExists("glpi_plugin_resources_choiceitems")) {
                                        $update804 = true;
                                        $update83 = true;
                                        $DB->runFile(GLPI_ROOT . "/plugins/resources/sql/update-1.7.1.sql");
                                        $DB->runFile(GLPI_ROOT . "/plugins/resources/sql/update-1.9.0.sql");
                                        $DB->runFile(GLPI_ROOT . "/plugins/resources/sql/update-1.9.1.sql");
                                    } else {
                                        if (!TableExists("glpi_plugin_resources_employments")) {
                                            $update83 = true;
                                            $DB->runFile(GLPI_ROOT . "/plugins/resources/sql/update-1.9.0.sql");
                                            $DB->runFile(GLPI_ROOT . "/plugins/resources/sql/update-1.9.1.sql");
                                            $query = "SELECT *\n               FROM `glpi_plugin_resources_employers`";
                                            $result = $DB->query($query);
                                            if ($DB->numrows($result) > 0) {
                                                while ($data = $DB->fetch_array($result)) {
                                                    $queryUpdate = "UPDATE `glpi_plugin_resources_employers`\n                            SET `completename`= '" . $data["name"] . "'\n                            WHERE `id`= '" . $data["id"] . "'";
                                                    $DB->query($queryUpdate) or die($DB->error());
                                                }
                                            }
                                        } else {
                                            if (TableExists("glpi_plugin_resources_ranks") && !FieldExists("glpi_plugin_resources_ranks", "begin_date")) {
                                                $DB->runFile(GLPI_ROOT . "/plugins/resources/sql/update-1.9.1.sql");
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    if ($update78 || $install) {
        //Do One time on 0.78
        $query_id = "SELECT `id` FROM `glpi_notificationtemplates` WHERE `itemtype`='PluginResourcesResource' AND `name` = 'Resources'";
        $result = $DB->query($query_id) or die($DB->error());
        $itemtype = $DB->result($result, 0, 'id');
        $query = "INSERT INTO `glpi_notificationtemplatetranslations`\n                                 VALUES(NULL, " . $itemtype . ", '','##lang.resource.title## -  ##resource.firstname## ##resource.name##',\n                        '##lang.resource.url##  : ##resource.url##\n\n   ##lang.resource.entity## : ##resource.entity##\n   ##IFresource.name####lang.resource.name## : ##resource.name##\n   ##ENDIFresource.name## ##IFresource.firstname####lang.resource.firstname## : ##resource.firstname##\n   ##ENDIFresource.firstname## ##IFresource.type####lang.resource.type## : ##resource.type##\n   ##ENDIFresource.type## ##IFresource.users####lang.resource.users## : ##resource.users##\n   ##ENDIFresource.users## ##IFresource.usersrecipient####lang.resource.usersrecipient## : ##resource.usersrecipient##\n   ##ENDIFresource.usersrecipient## ##IFresource.datedeclaration####lang.resource.datedeclaration## : ##resource.datedeclaration##\n   ##ENDIFresource.datedeclaration## ##IFresource.datebegin####lang.resource.datebegin## : ##resource.datebegin##\n   ##ENDIFresource.datebegin## ##IFresource.dateend####lang.resource.dateend## : ##resource.dateend##\n   ##ENDIFresource.dateend## ##IFresource.department####lang.resource.department## : ##resource.department##\n   ##ENDIFresource.department## ##IFresource.status####lang.resource.status## : ##resource.status##\n   ##ENDIFresource.status## ##IFresource.location####lang.resource.location## : ##resource.location##\n   ##ENDIFresource.location## ##IFresource.comment####lang.resource.comment## : ##resource.comment##\n   ##ENDIFresource.comment## ##IFresource.usersleaving####lang.resource.usersleaving## : ##resource.usersleaving##\n   ##ENDIFresource.usersleaving## ##IFresource.leaving####lang.resource.leaving## : ##resource.leaving##\n   ##ENDIFresource.leaving## ##IFresource.helpdesk####lang.resource.helpdesk## : ##resource.helpdesk##\n   ##ENDIFresource.helpdesk## ##FOREACHupdates##----------\n   ##lang.update.title## :\n   ##IFupdate.name####lang.resource.name## : ##update.name##\n   ##ENDIFupdate.name## ##IFupdate.firstname####lang.resource.firstname## : ##update.firstname##\n   ##ENDIFupdate.firstname## ##IFupdate.type####lang.resource.type## : ##update.type##\n   ##ENDIFupdate.type## ##IFupdate.users####lang.resource.users## : ##update.users##\n   ##ENDIFupdate.users## ##IFupdate.usersrecipient####lang.resource.usersrecipient## : ##update.usersrecipient##\n   ##ENDIFupdate.usersrecipient## ##IFupdate.datedeclaration####lang.resource.datedeclaration## : ##update.datedeclaration##\n   ##ENDIFupdate.datedeclaration## ##IFupdate.datebegin####lang.resource.datebegin## : ##update.datebegin##\n   ##ENDIFupdate.datebegin## ##IFupdate.dateend####lang.resource.dateend## : ##update.dateend##\n   ##ENDIFupdate.dateend## ##IFupdate.department####lang.resource.department## : ##update.department##\n   ##ENDIFupdate.department## ##IFupdate.status####lang.resource.status## : ##update.status##\n   ##ENDIFupdate.status## ##IFupdate.location####lang.resource.location## : ##update.location##\n   ##ENDIFupdate.location## ##IFupdate.comment####lang.resource.comment## : ##update.comment##\n   ##ENDIFupdate.comment## ##IFupdate.usersleaving####lang.resource.usersleaving## : ##update.usersleaving##\n   ##ENDIFupdate.usersleaving## ##IFupdate.leaving####lang.resource.leaving## : ##update.leaving##\n   ##ENDIFupdate.leaving## ##IFupdate.helpdesk####lang.resource.helpdesk## : ##update.helpdesk##\n   ##ENDIFupdate.helpdesk## ----------##ENDFOREACHupdates##\n   ##FOREACHtasks####lang.task.title## :\n   ##IFtask.name####lang.task.name## : ##task.name##\n   ##ENDIFtask.name## ##IFtask.type####lang.task.type## : ##task.type##\n   ##ENDIFtask.type## ##IFtask.users####lang.task.users## : ##task.users##\n   ##ENDIFtask.users## ##IFtask.groups####lang.task.groups## : ##task.groups##\n   ##ENDIFtask.groups## ##IFtask.datebegin####lang.task.datebegin## : ##task.datebegin##\n   ##ENDIFtask.datebegin## ##IFtask.dateend####lang.task.dateend## : ##task.dateend##\n   ##ENDIFtask.dateend## ##IFtask.comment####lang.task.comment## : ##task.comment##\n   ##ENDIFtask.comment## ##IFtask.finished####lang.task.finished## : ##task.finished##\n   ##ENDIFtask.finished## ##IFtask.realtime####lang.task.realtime## : ##task.realtime##\n   ##ENDIFtask.realtime## ----------##ENDFOREACHtasks## ',\n                        '&lt;p&gt;&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;\n                        &lt;strong&gt;##lang.resource.url##\n                        &lt;/strong&gt; :\n                        &lt;a href=\"##resource.url##\"&gt;##resource.url##\n                        &lt;/a&gt;&lt;/span&gt; &lt;br /&gt;&lt;br /&gt;\n                        &lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;\n                        &lt;strong&gt;##lang.resource.entity##&lt;/strong&gt; : ##resource.entity##\n                        &lt;/span&gt; &lt;br /&gt; ##IFresource.name##\n                        &lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;\n                        &lt;strong&gt;##lang.resource.name##&lt;/strong&gt; : ##resource.name##\n                        &lt;br /&gt;&lt;/span&gt;##ENDIFresource.name## ##IFresource.firstname##\n                        &lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;\n                        &lt;strong&gt;##lang.resource.firstname##&lt;/strong&gt; : ##resource.firstname##\n                        &lt;br /&gt;&lt;/span&gt;##ENDIFresource.firstname## ##IFresource.type##\n                        &lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;\n                        &lt;strong&gt;##lang.resource.type##&lt;/strong&gt; :  ##resource.type##&lt;br /&gt;\n                        &lt;/span&gt;##ENDIFresource.type## ##IFresource.status##\n                        &lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;\n                        &lt;strong&gt;##lang.resource.status##&lt;/strong&gt; :  ##resource.status##&lt;br /&gt;\n                        &lt;/span&gt;##ENDIFresource.status## ##IFresource.users##\n                        &lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;\n                        &lt;strong&gt;##lang.resource.users##&lt;/strong&gt; :  ##resource.users##&lt;br /&gt;\n                        &lt;/span&gt;##ENDIFresource.users## ##IFresource.usersrecipient##\n                        &lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;\n                        &lt;strong&gt;##lang.resource.usersrecipient##\n                        &lt;/strong&gt; :  ##resource.usersrecipient##&lt;br /&gt;\n                        &lt;/span&gt;##ENDIFresource.usersrecipient## ##IFresource.datedeclaration##\n                        &lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;\n                        &lt;strong&gt;##lang.resource.datedeclaration##\n                        &lt;/strong&gt; :  ##resource.datedeclaration##&lt;br /&gt;\n                        &lt;/span&gt;##ENDIFresource.datedeclaration## ##IFresource.datebegin##\n                        &lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;\n                        &lt;strong&gt;##lang.resource.datebegin##&lt;/strong&gt; :  ##resource.datebegin##\n                        &lt;br /&gt;&lt;/span&gt;##ENDIFresource.datebegin## ##IFresource.dateend##\n                        &lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;\n                        &lt;strong&gt;##lang.resource.dateend##&lt;/strong&gt; :  ##resource.dateend##\n                        &lt;br /&gt;&lt;/span&gt;##ENDIFresource.dateend## ##IFresource.department##\n                        &lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;\n                        &lt;strong&gt;##lang.resource.department##&lt;/strong&gt; :  ##resource.department##\n                        &lt;br /&gt;&lt;/span&gt;##ENDIFresource.department## ##IFresource.location##\n                        &lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;\n                        &lt;strong&gt;##lang.resource.location##&lt;/strong&gt; :  ##resource.location##\n                        &lt;br /&gt;&lt;/span&gt;##ENDIFresource.location## ##IFresource.comment##\n                        &lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;\n                        &lt;strong&gt;##lang.resource.comment##&lt;/strong&gt; :  ##resource.comment##\n                        &lt;br /&gt;&lt;/span&gt;##ENDIFresource.comment## ##IFresource.usersleaving##\n                        &lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;\n                        &lt;strong&gt;##lang.resource.usersleaving##&lt;/strong&gt; :  ##resource.usersleaving##\n                        &lt;br /&gt;&lt;/span&gt;##ENDIFresource.usersleaving## ##IFresource.leaving##\n                        &lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;\n                        &lt;strong&gt;##lang.resource.leaving##&lt;/strong&gt; :  ##resource.leaving##\n                        &lt;br /&gt;&lt;/span&gt;##ENDIFresource.leaving## ##IFresource.helpdesk##\n                        &lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;\n                        &lt;strong&gt;##lang.resource.helpdesk##&lt;/strong&gt; :  ##resource.helpdesk##\n                        &lt;br /&gt;&lt;/span&gt;##ENDIFresource.helpdesk##   ##FOREACHupdates##----------\n                        &lt;br /&gt;\n                        &lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;\n                        &lt;strong&gt;##lang.update.title## :&lt;/strong&gt;&lt;/span&gt;\n                        &lt;br /&gt; ##IFupdate.name##\n                        &lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;\n                        &lt;strong&gt;##lang.resource.name##&lt;/strong&gt; : ##update.name##&lt;br /&gt;\n                        &lt;/span&gt;##ENDIFupdate.name## ##IFupdate.firstname##\n                        &lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;\n                        &lt;strong&gt;##lang.resource.firstname##&lt;/strong&gt; : ##update.firstname##\n                        &lt;br /&gt;&lt;/span&gt;##ENDIFupdate.firstname## ##IFupdate.type##\n                        &lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;\n                        &lt;strong&gt;##lang.resource.type##&lt;/strong&gt; : ##update.type##&lt;br /&gt;\n                        &lt;/span&gt;##ENDIFupdate.type## ##IFupdate.status##\n                        &lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;\n                        &lt;strong&gt;##lang.resource.status##&lt;/strong&gt; : ##update.status##&lt;br /&gt;\n                        &lt;/span&gt;##ENDIFupdate.status## ##IFupdate.users##\n                        &lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;\n                        &lt;strong&gt;##lang.resource.users##&lt;/strong&gt; : ##update.users##&lt;br /&gt;\n                        &lt;/span&gt;##ENDIFupdate.users## ##IFupdate.usersrecipient##\n                        &lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;\n                        &lt;strong&gt;##lang.resource.usersrecipient##&lt;/strong&gt; : ##update.usersrecipient##\n                        &lt;br /&gt;&lt;/span&gt;##ENDIFupdate.usersrecipient## ##IFupdate.datedeclaration##\n                        &lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;\n                        &lt;strong&gt;##lang.resource.datedeclaration##\n                        &lt;/strong&gt; : ##update.datedeclaration##&lt;br /&gt;\n                        &lt;/span&gt;##ENDIFupdate.datedeclaration## ##IFupdate.datebegin##\n                        &lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;\n                        &lt;strong&gt;##lang.resource.datebegin##&lt;/strong&gt; : ##update.datebegin##\n                        &lt;br /&gt;&lt;/span&gt;##ENDIFupdate.datebegin## ##IFupdate.dateend##\n                        &lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;\n                        &lt;strong&gt;##lang.resource.dateend##&lt;/strong&gt; : ##update.dateend##\n                        &lt;br /&gt;&lt;/span&gt;##ENDIFupdate.dateend## ##IFupdate.department##\n                        &lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;\n                        &lt;strong&gt;##lang.resource.department##&lt;/strong&gt; : ##update.department##\n                        &lt;br /&gt;&lt;/span&gt;##ENDIFupdate.department## ##IFupdate.location##\n                        &lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;\n                        &lt;strong&gt;##lang.resource.location##&lt;/strong&gt; : ##update.location##\n                        &lt;br /&gt;&lt;/span&gt;##ENDIFupdate.location## ##IFupdate.comment##\n                        &lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;\n                        &lt;strong&gt;##lang.resource.comment##&lt;/strong&gt; : ##update.comment##\n                        &lt;br /&gt;&lt;/span&gt;##ENDIFupdate.comment## ##IFupdate.usersleaving##\n                        &lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;\n                        &lt;strong&gt;##lang.resource.usersleaving##\n                        &lt;/strong&gt; : ##update.usersleaving##&lt;br /&gt;\n                        &lt;/span&gt;##ENDIFupdate.usersleaving## ##IFupdate.leaving##\n                        &lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;\n                        &lt;strong&gt;##lang.resource.leaving##&lt;/strong&gt; : ##update.leaving##\n                        &lt;br /&gt;&lt;/span&gt;##ENDIFupdate.leaving## ##IFupdate.helpdesk##\n                        &lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;\n                        &lt;strong&gt;##lang.resource.helpdesk##&lt;/strong&gt; : ##update.helpdesk##\n                        &lt;br /&gt;&lt;/span&gt;##ENDIFupdate.helpdesk####ENDFOREACHupdates##   ##FOREACHtasks##----------\n                        &lt;br /&gt;&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;\n                        &lt;strong&gt;##lang.task.title## :&lt;/strong&gt;&lt;/span&gt; &lt;br /&gt; ##IFtask.name##\n                        &lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;\n                        &lt;strong&gt;##lang.task.name##&lt;/strong&gt; : ##task.name##&lt;br /&gt;\n                        &lt;/span&gt;##ENDIFtask.name## ##IFtask.type##\n                        &lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;\n                        &lt;strong&gt;##lang.task.type##&lt;/strong&gt; : ##task.type##&lt;br /&gt;\n                        &lt;/span&gt;##ENDIFtask.type## ##IFtask.users##\n                        &lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;\n                        &lt;strong&gt;##lang.task.users##&lt;/strong&gt; : ##task.users##&lt;br /&gt;\n                        &lt;/span&gt;##ENDIFtask.users## ##IFtask.groups##\n                        &lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;\n                        &lt;strong&gt;##lang.task.groups##&lt;/strong&gt; : ##task.groups##&lt;br /&gt;\n                        &lt;/span&gt;##ENDIFtask.groups## ##IFtask.datebegin##\n                        &lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;\n                        &lt;strong&gt;##lang.task.datebegin##&lt;/strong&gt; : ##task.datebegin##&lt;br /&gt;\n                        &lt;/span&gt;##ENDIFtask.datebegin## ##IFtask.dateend##\n                        &lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;\n                        &lt;strong&gt;##lang.task.dateend##&lt;/strong&gt; : ##task.dateend##&lt;br /&gt;\n                        &lt;/span&gt;##ENDIFtask.dateend## ##IFtask.comment##\n                        &lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;\n                        &lt;strong&gt;##lang.task.comment##&lt;/strong&gt; : ##task.comment##&lt;br /&gt;\n                        &lt;/span&gt;##ENDIFtask.comment## ##IFtask.finished##\n                        &lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;\n                        &lt;strong&gt;##lang.task.finished##&lt;/strong&gt; : ##task.finished##&lt;br /&gt;\n                        &lt;/span&gt;##ENDIFtask.finished## ##IFtask.realtime##\n                        &lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;\n                        &lt;strong&gt;##lang.task.realtime##&lt;/strong&gt; : ##task.realtime##\n                        &lt;/span&gt;##ENDIFtask.realtime##&lt;br /&gt;----------##ENDFOREACHtasks##&lt;/p&gt;');";
        $result = $DB->query($query);
        $query = "INSERT INTO `glpi_notifications`\n                                   VALUES (NULL, 'New Resource', 0, 'PluginResourcesResource', 'new',\n                                          'mail'," . $itemtype . ",\n                                          '', 1, 1, '2010-05-16 22:36:46');";
        $result = $DB->query($query);
        $query = "INSERT INTO `glpi_notifications`\n                                   VALUES (NULL, 'Update Resource', 0, 'PluginResourcesResource', 'update',\n                                          'mail'," . $itemtype . ",\n                                          '', 1, 1, '2010-05-16 22:36:46');";
        $result = $DB->query($query);
        $query = "INSERT INTO `glpi_notifications`\n                                   VALUES (NULL, 'Delete Resource', 0, 'PluginResourcesResource', 'delete',\n                                          'mail'," . $itemtype . ",\n                                          '', 1, 1, '2010-05-16 22:36:46');";
        $result = $DB->query($query);
        $query = "INSERT INTO `glpi_notifications`\n                                   VALUES (NULL, 'New Resource Task', 0, 'PluginResourcesResource', 'newtask',\n                                          'mail'," . $itemtype . ",\n                                          '', 1, 1, '2010-05-16 22:36:46');";
        $result = $DB->query($query);
        $query = "INSERT INTO `glpi_notifications`\n                                   VALUES (NULL, 'Update Resource Task', 0, 'PluginResourcesResource', 'updatetask',\n                                          'mail'," . $itemtype . ",\n                                          '', 1, 1, '2010-05-16 22:36:46');";
        $result = $DB->query($query);
        $query = "INSERT INTO `glpi_notifications`\n                                   VALUES (NULL, 'Delete Resource Task', 0, 'PluginResourcesResource', 'deletetask',\n                                          'mail'," . $itemtype . ",\n                                          '', 1, 1, '2010-05-16 22:36:46');";
        $result = $DB->query($query);
        $query_id = "SELECT `id` FROM `glpi_notificationtemplates` WHERE `itemtype`='PluginResourcesResource' AND `name` = 'Alert Resources Tasks'";
        $result = $DB->query($query_id) or die($DB->error());
        $itemtype = $DB->result($result, 0, 'id');
        $query = "INSERT INTO `glpi_notificationtemplatetranslations`\n                                 VALUES(NULL, " . $itemtype . ", '','##resource.action## : ##resource.entity##',\n                        '##FOREACHtasks##\n   ##lang.task.name## : ##task.name##\n   ##lang.task.type## : ##task.type##\n   ##lang.task.users## : ##task.users##\n   ##lang.task.groups## : ##task.groups##\n   ##lang.task.datebegin## : ##task.datebegin##\n   ##lang.task.dateend## : ##task.dateend##\n   ##lang.task.comment## : ##task.comment##\n   ##lang.task.resource## : ##task.resource##\n   ##ENDFOREACHtasks##',\n                           '&lt;table class=\"tab_cadre\" border=\"1\" cellspacing=\"2\" cellpadding=\"3\"&gt;\n   &lt;tbody&gt;\n   &lt;tr&gt;\n   &lt;td style=\"text-align: left;\" bgcolor=\"#cccccc\"&gt;&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;##lang.task.name##&lt;/span&gt;&lt;/td&gt;\n   &lt;td style=\"text-align: left;\" bgcolor=\"#cccccc\"&gt;&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;##lang.task.type##&lt;/span&gt;&lt;/td&gt;\n   &lt;td style=\"text-align: left;\" bgcolor=\"#cccccc\"&gt;&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;##lang.task.users##&lt;/span&gt;&lt;/td&gt;\n   &lt;td style=\"text-align: left;\" bgcolor=\"#cccccc\"&gt;&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;##lang.task.groups##&lt;/span&gt;&lt;/td&gt;\n   &lt;td style=\"text-align: left;\" bgcolor=\"#cccccc\"&gt;&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;##lang.task.datebegin##&lt;/span&gt;&lt;/td&gt;\n   &lt;td style=\"text-align: left;\" bgcolor=\"#cccccc\"&gt;&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;##lang.task.dateend##&lt;/span&gt;&lt;/td&gt;\n   &lt;td style=\"text-align: left;\" bgcolor=\"#cccccc\"&gt;&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;##lang.task.comment##&lt;/span&gt;&lt;/td&gt;\n   &lt;td style=\"text-align: left;\" bgcolor=\"#cccccc\"&gt;&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;##lang.task.resource##&lt;/span&gt;&lt;/td&gt;\n   &lt;/tr&gt;\n   ##FOREACHtasks##\n   &lt;tr&gt;\n   &lt;td&gt;&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;##task.name##&lt;/span&gt;&lt;/td&gt;\n   &lt;td&gt;&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;##task.type##&lt;/span&gt;&lt;/td&gt;\n   &lt;td&gt;&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;##task.users##&lt;/span&gt;&lt;/td&gt;\n   &lt;td&gt;&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;##task.groups##&lt;/span&gt;&lt;/td&gt;\n   &lt;td&gt;&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;##task.datebegin##&lt;/span&gt;&lt;/td&gt;\n   &lt;td&gt;&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;##task.dateend##&lt;/span&gt;&lt;/td&gt;\n   &lt;td&gt;&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;##task.comment##&lt;/span&gt;&lt;/td&gt;\n   &lt;td&gt;&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;##task.resource##&lt;/span&gt;&lt;/td&gt;\n   &lt;/tr&gt;\n   ##ENDFOREACHtasks##\n   &lt;/tbody&gt;\n   &lt;/table&gt;');";
        $result = $DB->query($query);
        $query = "INSERT INTO `glpi_notifications`\n                                   VALUES (NULL, 'Alert Expired Resources Tasks', 0, 'PluginResourcesResource', 'AlertExpiredTasks',\n                                          'mail'," . $itemtype . ",\n                                          '', 1, 1, '2010-02-17 22:36:46');";
        $result = $DB->query($query);
        $query_id = "SELECT `id` FROM `glpi_notificationtemplates` WHERE `itemtype`='PluginResourcesResource' AND `name` = 'Alert Leaving Resources'";
        $result = $DB->query($query_id) or die($DB->error());
        $itemtype = $DB->result($result, 0, 'id');
        $query = "INSERT INTO `glpi_notificationtemplatetranslations`\n                                 VALUES(NULL, " . $itemtype . ", '','##resource.action## : ##resource.entity##',\n                        '##FOREACHresources##\n   ##lang.resource.name## : ##resource.name##\n   ##lang.resource.firstname## : ##resource.firstname##\n   ##lang.resource.type## : ##resource.type##\n   ##lang.resource.location## : ##resource.location##\n   ##lang.resource.users## : ##resource.users##\n   ##lang.resource.dateend## : ##resource.dateend##\n   ##ENDFOREACHresources##',\n                           '&lt;table class=\"tab_cadre\" border=\"1\" cellspacing=\"2\" cellpadding=\"3\"&gt;\n   &lt;tbody&gt;\n   &lt;tr&gt;\n   &lt;td style=\"text-align: left;\" bgcolor=\"#cccccc\"&gt;&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;##lang.resource.name##&lt;/span&gt;&lt;/td&gt;\n   &lt;td style=\"text-align: left;\" bgcolor=\"#cccccc\"&gt;&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;##lang.resource.firstname##&lt;/span&gt;&lt;/td&gt;\n   &lt;td style=\"text-align: left;\" bgcolor=\"#cccccc\"&gt;&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;##lang.resource.type##&lt;/span&gt;&lt;/td&gt;\n   &lt;td style=\"text-align: left;\" bgcolor=\"#cccccc\"&gt;&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;##lang.resource.location##&lt;/span&gt;&lt;/td&gt;\n   &lt;td style=\"text-align: left;\" bgcolor=\"#cccccc\"&gt;&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;##lang.resource.users##&lt;/span&gt;&lt;/td&gt;\n   &lt;td style=\"text-align: left;\" bgcolor=\"#cccccc\"&gt;&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;##lang.resource.dateend##&lt;/span&gt;&lt;/td&gt;\n   &lt;/tr&gt;\n   ##FOREACHresources##\n   &lt;tr&gt;\n   &lt;td&gt;&lt;a href=\"##resource.url##\"&gt;&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;##resource.name##&lt;/span&gt;&lt;/a&gt;&lt;/td&gt;\n   &lt;td&gt;&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;##resource.firstname##&lt;/span&gt;&lt;/td&gt;\n   &lt;td&gt;&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;##resource.type##&lt;/span&gt;&lt;/td&gt;\n   &lt;td&gt;&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;##resource.location##&lt;/span&gt;&lt;/td&gt;\n   &lt;td&gt;&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;##resource.users##&lt;/span&gt;&lt;/td&gt;\n   &lt;td&gt;&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;##resource.dateend##&lt;/span&gt;&lt;/td&gt;\n   &lt;/tr&gt;\n   ##ENDFOREACHresources##\n   &lt;/tbody&gt;\n   &lt;/table&gt;');";
        $result = $DB->query($query);
        $query = "INSERT INTO `glpi_notifications`\n                                   VALUES (NULL, 'Alert Leaving Resources', 0, 'PluginResourcesResource', 'AlertLeavingResources',\n                                          'mail'," . $itemtype . ",\n                                          '', 1, 1, '2010-02-17 22:36:46');";
        $result = $DB->query($query);
        $query_id = "SELECT `id` FROM `glpi_notificationtemplates` WHERE `itemtype`='PluginResourcesResource' AND `name` = 'Alert Resources Checklists'";
        $result = $DB->query($query_id) or die($DB->error());
        $itemtype = $DB->result($result, 0, 'id');
        $query = "INSERT INTO `glpi_notificationtemplatetranslations`\n                                 VALUES(NULL, " . $itemtype . ", '','##checklist.action## : ##checklist.entity##',\n                        '##lang.checklist.title##\n\n   ##FOREACHchecklists##\n   ##lang.checklist.name## ##lang.checklist.firstname## : ##checklist.name## ##checklist.firstname##\n   ##lang.checklist.datebegin## : ##checklist.datebegin##\n   ##lang.checklist.dateend## : ##checklist.dateend##\n   ##lang.checklist.entity## : ##checklist.entity##\n   ##lang.checklist.location## : ##checklist.location##\n   ##lang.checklist.type## : ##checklist.type##\n\n   ##lang.checklist.title2## :\n   ##tasklist.name##\n   ##ENDFOREACHchecklists##',\n                           '&lt;table class=\"tab_cadre\" border=\"1\" cellspacing=\"2\" cellpadding=\"3\"&gt;\n   &lt;tbody&gt;\n   &lt;tr bgcolor=\"#d9c4b8\"&gt;\n   &lt;th colspan=\"7\"&gt;&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: center;\"&gt;##lang.checklist.title##&lt;/span&gt;&lt;/th&gt;\n   &lt;/tr&gt;\n   &lt;tr&gt;\n   &lt;td style=\"text-align: left;\" bgcolor=\"#cccccc\"&gt;&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;##lang.checklist.name## ##lang.checklist.firstname##&lt;/span&gt;&lt;/td&gt;\n   &lt;td style=\"text-align: left;\" bgcolor=\"#cccccc\"&gt;&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;##lang.checklist.datebegin##&lt;/span&gt;&lt;/td&gt;\n   &lt;td style=\"text-align: left;\" bgcolor=\"#cccccc\"&gt;&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;##lang.checklist.dateend##&lt;/span&gt;&lt;/td&gt;\n   &lt;td style=\"text-align: left;\" bgcolor=\"#cccccc\"&gt;&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;##lang.checklist.entity##&lt;/span&gt;&lt;/td&gt;\n   &lt;td style=\"text-align: left;\" bgcolor=\"#cccccc\"&gt;&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;##lang.checklist.location##&lt;/span&gt;&lt;/td&gt;\n   &lt;td style=\"text-align: left;\" bgcolor=\"#cccccc\"&gt;&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;##lang.checklist.type##&lt;/span&gt;&lt;/td&gt;\n   &lt;td style=\"text-align: left;\" bgcolor=\"#cccccc\"&gt;&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;##lang.checklist.title2##&lt;/span&gt;&lt;/td&gt;\n   &lt;/tr&gt;\n   ##FOREACHchecklists##\n   &lt;tr&gt;\n   &lt;td&gt;&lt;a href=\"##checklist.url##\"&gt;&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;##checklist.name## ##checklist.firstname##&lt;/span&gt;&lt;/a&gt;&lt;/td&gt;\n   &lt;td&gt;&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;##checklist.datebegin##&lt;/span&gt;&lt;/td&gt;\n   &lt;td&gt;&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;##checklist.dateend##&lt;/span&gt;&lt;/td&gt;\n   &lt;td&gt;&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;##checklist.entity##&lt;/span&gt;&lt;/td&gt;\n   &lt;td&gt;&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;##checklist.location##&lt;/span&gt;&lt;/td&gt;\n   &lt;td&gt;&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;##checklist.type##&lt;/span&gt;&lt;/td&gt;\n   &lt;td&gt;&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;\n   &lt;table width=\"100%\"&gt;\n   &lt;tbody&gt;\n   &lt;tr&gt;\n   &lt;td&gt;&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt; ##tasklist.name## &lt;/span&gt;&lt;/td&gt;\n   &lt;/tr&gt;\n   &lt;/tbody&gt;\n   &lt;/table&gt;\n   &lt;/span&gt;&lt;/td&gt;\n   &lt;/tr&gt;\n   ##ENDFOREACHchecklists##\n   &lt;/tbody&gt;\n   &lt;/table&gt;');";
        $result = $DB->query($query);
        $query = "INSERT INTO `glpi_notifications`\n                                   VALUES (NULL, 'Alert Arrival Checklists', 0, 'PluginResourcesResource', 'AlertArrivalChecklists',\n                                          'mail'," . $itemtype . ",\n                                          '', 1, 1, '2010-02-17 22:36:46');";
        $result = $DB->query($query);
        $query = "INSERT INTO `glpi_notifications`\n                                   VALUES (NULL, 'Alert Leaving Checklists', 0, 'PluginResourcesResource', 'AlertLeavingChecklists',\n                                          'mail'," . $itemtype . ",\n                                          '', 1, 1, '2010-02-17 22:36:46');";
        $result = $DB->query($query);
        $query_id = "SELECT `id` FROM `glpi_notificationtemplates` WHERE `itemtype`='PluginResourcesResource' AND `name` = 'Leaving Resource'";
        $result = $DB->query($query_id) or die($DB->error());
        $itemtype = $DB->result($result, 0, 'id');
        $query = "INSERT INTO `glpi_notificationtemplatetranslations`\n                                 VALUES(NULL, " . $itemtype . ", '','##lang.resource.title## -  ##resource.firstname## ##resource.name##',\n                        '##lang.resource.title2##\n\n   ##lang.resource.url## : ##resource.url##\n\n   ##lang.resource.entity## : ##resource.entity##\n   ##IFresource.name## ##lang.resource.name## : ##resource.name##\n   ##ENDIFresource.name##\n   ##IFresource.firstname## ##lang.resource.firstname## : ##resource.firstname##\n   ##ENDIFresource.firstname##\n\n   ##lang.resource.badge##',\n                        '&lt;p&gt;&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;&lt;strong&gt;##lang.resource.title2##&lt;/strong&gt;\n   &lt;p&gt;&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;\n   &lt;strong&gt;##lang.resource.url##&lt;/strong&gt; :\n   &lt;a href=\"##resource.url##\"&gt;##resource.url##&lt;/a&gt;\n   &lt;/span&gt; &lt;br /&gt;&lt;br /&gt;\n   &lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;\n   &lt;strong&gt;##lang.resource.entity##&lt;/strong&gt; : ##resource.entity##&lt;/span&gt;\n   &lt;br /&gt; ##IFresource.name##\n   &lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;\n   &lt;strong&gt;##lang.resource.name##&lt;/strong&gt; : ##resource.name##&lt;br /&gt;\n   &lt;/span&gt;##ENDIFresource.name## ##IFresource.firstname##\n   &lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;\n   &lt;strong&gt;##lang.resource.firstname##&lt;/strong&gt; : ##resource.firstname##\n   &lt;br /&gt;&lt;/span&gt;##ENDIFresource.firstname##&lt;/p&gt;\n   &lt;p&gt;&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;&lt;strong&gt;##lang.resource.badge##&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;\n   &lt;/span&gt;&lt;/p&gt;');";
        $result = $DB->query($query);
        $query = "INSERT INTO `glpi_notifications`\n                                   VALUES (NULL, 'Leaving Resource', 0, 'PluginResourcesResource', 'LeavingResource',\n                                          'mail'," . $itemtype . ",\n                                          '', 1, 1, '2010-05-16 22:36:46');";
        $result = $DB->query($query);
    }
    if ($update78) {
        $profiles = getAllDatasFromTable("glpi_plugin_resources_profiles");
        if (!empty($profiles)) {
            foreach ($profiles as $profile) {
                $query = "UPDATE `glpi_plugin_resources_profiles`\n                  SET `profiles_id` = '" . $resource["id"] . "'\n                  WHERE `id` = '" . $resource["id"] . "';";
                $result = $DB->query($query);
            }
        }
        $query = "ALTER TABLE `glpi_plugin_resources_profiles`\n               DROP `name` ;";
        $result = $DB->query($query);
        $tables = array("glpi_displaypreferences", "glpi_documents_items", "glpi_bookmarks", "glpi_logs", "glpi_tickets");
        foreach ($tables as $table) {
            $query = "DELETE FROM `{$table}` WHERE (`itemtype` = '4302' ) ";
            $DB->query($query);
        }
        Plugin::migrateItemType(array(4300 => 'PluginResourcesResource', 4301 => 'PluginResourcesTask', 4303 => 'PluginResourcesDirectory'), array("glpi_bookmarks", "glpi_bookmarks_users", "glpi_displaypreferences", "glpi_documents_items", "glpi_infocoms", "glpi_logs", "glpi_tickets"), array("glpi_plugin_resources_resources_items", "glpi_plugin_resources_choices", "glpi_plugin_resources_tasks_items"));
        Plugin::migrateItemType(array(1600 => "PluginBadgesBadge"), array("glpi_plugin_resources_resources_items", "glpi_plugin_resources_choices", "glpi_plugin_resources_tasks_items"));
    }
    if ($update || $install) {
        //Do One time on 0.78 for 1.6.2
        $query_id = "SELECT `id` FROM `glpi_notificationtemplates` WHERE `itemtype`='PluginResourcesResource' AND `name` = 'Resource Report Creation'";
        $result = $DB->query($query_id) or die($DB->error());
        $itemtype = $DB->result($result, 0, 'id');
        $query = "INSERT INTO `glpi_notificationtemplatetranslations`\n                                 VALUES(NULL, " . $itemtype . ", '','##lang.resource.title## -  ##resource.firstname## ##resource.name##',\n                        '##lang.resource.creationtitle##\n\n##lang.resource.entity## : ##resource.entity##\n\n##lang.resource.name## : ##resource.name##\n##lang.resource.firstname## : ##resource.firstname##\n##lang.resource.department## : ##resource.department##\n##lang.resource.location## : ##resource.location##\n##lang.resource.users## : ##resource.users##\n##lang.resource.usersrecipient## : ##resource.usersrecipient##\n##lang.resource.datedeclaration## : ##resource.datedeclaration##\n##lang.resource.datebegin## : ##resource.datebegin##\n\n##lang.resource.creation##\n\n##lang.resource.datecreation## : ##resource.datecreation##\n##lang.resource.login## : ##resource.login##\n##lang.resource.email## : ##resource.email##\n\n##lang.resource.informationtitle##\n\n##IFresource.commentaires####lang.resource.commentaires## : ##resource.commentaires####ENDIFresource.commentaires##\n\n##IFresource.informations####lang.resource.informations## : ##resource.informations####ENDIFresource.informations##',\n                        '&lt;p style=\"text-align: center;\"&gt;&lt;span style=\"font-size: 11px; font-family: verdana;\"&gt;##lang.resource.creationtitle##&lt;/span&gt;&lt;/p&gt;\n&lt;table border=\"1\" cellspacing=\"2\" cellpadding=\"3\" width=\"590px\" align=\"center\"&gt;\n&lt;tbody&gt;\n&lt;tr&gt;\n&lt;td style=\"text-align: left;\" colspan=\"2\" width=\"auto\" bgcolor=\"#cccccc\"&gt;&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;##lang.resource.entity##&lt;/span&gt;&lt;/td&gt;\n&lt;td style=\"text-align: left;\" colspan=\"2\" width=\"auto\"&gt;&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;##resource.entity##&lt;/span&gt;&lt;/td&gt;\n&lt;/tr&gt;\n&lt;tr&gt;\n&lt;td style=\"text-align: left;\" width=\"auto\" bgcolor=\"#cccccc\"&gt;&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;##lang.resource.name##&lt;/span&gt;&lt;/td&gt;\n&lt;td style=\"text-align: left;\" width=\"auto\"&gt;&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;##resource.name##&lt;/span&gt;&lt;/td&gt;\n&lt;td style=\"text-align: left;\" width=\"auto\" bgcolor=\"#cccccc\"&gt;&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;##lang.resource.firstname##&lt;/span&gt;&lt;/td&gt;\n&lt;td style=\"text-align: left;\" width=\"auto\"&gt;&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;##resource.firstname##&lt;/span&gt;&lt;/td&gt;\n&lt;/tr&gt;\n&lt;tr&gt;\n&lt;td style=\"text-align: left;\" width=\"auto\" bgcolor=\"#cccccc\"&gt;&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;##lang.resource.department##&lt;/span&gt;&lt;/td&gt;\n&lt;td style=\"text-align: left;\" width=\"auto\"&gt;&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;##resource.department##&lt;/span&gt;&lt;/td&gt;\n&lt;td style=\"text-align: left;\" width=\"auto\" bgcolor=\"#cccccc\"&gt;&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;##lang.resource.location##&lt;/span&gt;&lt;/td&gt;\n&lt;td style=\"text-align: left;\" width=\"auto\"&gt;&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;##resource.location##&lt;/span&gt;&lt;/td&gt;\n&lt;/tr&gt;\n&lt;tr&gt;\n&lt;td style=\"text-align: left;\" width=\"auto\" bgcolor=\"#cccccc\"&gt;&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;##lang.resource.users##&lt;/span&gt;&lt;/td&gt;\n&lt;td style=\"text-align: left;\" width=\"auto\"&gt;&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;##resource.users##&lt;/span&gt;&lt;/td&gt;\n&lt;td style=\"text-align: left;\" width=\"auto\" bgcolor=\"#cccccc\"&gt;&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;##lang.resource.usersrecipient##&lt;/span&gt;&lt;/td&gt;\n&lt;td style=\"text-align: left;\" width=\"auto\"&gt;&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;##resource.usersrecipient##&lt;/span&gt;&lt;/td&gt;\n&lt;/tr&gt;\n&lt;tr&gt;\n&lt;td style=\"text-align: left;\" width=\"auto\" bgcolor=\"#cccccc\"&gt;&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;##lang.resource.datedeclaration##&lt;/span&gt;&lt;/td&gt;\n&lt;td style=\"text-align: left;\" width=\"auto\"&gt;&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;##resource.datedeclaration##&lt;/span&gt;&lt;/td&gt;\n&lt;td style=\"text-align: left;\" width=\"auto\" bgcolor=\"#cccccc\"&gt;&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;##lang.resource.datebegin##&lt;/span&gt;&lt;/td&gt;\n&lt;td style=\"text-align: left;\" width=\"auto\"&gt;&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;##resource.datebegin##&lt;/span&gt;&lt;/td&gt;\n&lt;/tr&gt;\n&lt;/tbody&gt;\n&lt;/table&gt;\n&lt;p style=\"text-align: center;\"&gt;&lt;span style=\"font-size: 11px; font-family: verdana;\"&gt;##lang.resource.creation##&lt;/span&gt;&lt;/p&gt;\n&lt;table border=\"1\" cellspacing=\"2\" cellpadding=\"3\" width=\"590px\" align=\"center\"&gt;\n&lt;tbody&gt;\n&lt;tr&gt;\n&lt;td style=\"text-align: left;\" width=\"auto\" bgcolor=\"#cccccc\"&gt;&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;##lang.resource.datecreation##&lt;/span&gt;&lt;/td&gt;\n&lt;td style=\"text-align: left;\" width=\"auto\"&gt;&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;##resource.datecreation##&lt;/span&gt;&lt;/td&gt;\n&lt;td style=\"text-align: left;\" width=\"auto\" bgcolor=\"#cccccc\"&gt;&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;##lang.resource.login##&lt;/span&gt;&lt;/td&gt;\n&lt;td style=\"text-align: left;\" width=\"auto\"&gt;&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;##resource.login##&lt;/span&gt;&lt;/td&gt;\n&lt;td style=\"text-align: left;\" width=\"auto\" bgcolor=\"#cccccc\"&gt;&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;##lang.resource.email##&lt;/span&gt;&lt;/td&gt;\n&lt;td style=\"text-align: left;\" width=\"auto\"&gt;&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;##resource.email##&lt;/span&gt;&lt;/td&gt;\n&lt;/tr&gt;\n&lt;/tbody&gt;\n&lt;/table&gt;\n&lt;p style=\"text-align: center;\"&gt;&lt;span style=\"font-size: 11px; font-family: verdana;\"&gt;##lang.resource.informationtitle##&lt;/span&gt;&lt;/p&gt;\n&lt;table border=\"1\" cellspacing=\"2\" cellpadding=\"3\" width=\"590px\" align=\"center\"&gt;\n&lt;tbody&gt;\n##IFresource.commentaires##\n&lt;tr&gt;\n&lt;td style=\"text-align: left;\" width=\"auto\" bgcolor=\"#cccccc\"&gt;&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;##lang.resource.commentaires##&lt;/span&gt;&lt;/td&gt;\n&lt;/tr&gt;\n&lt;tr&gt;\n&lt;td style=\"text-align: left;\" width=\"auto\"&gt;&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;##resource.commentaires##&lt;/span&gt;&lt;/td&gt;\n&lt;/tr&gt;\n##ENDIFresource.commentaires## ##IFresource.informations##\n&lt;tr&gt;\n&lt;td style=\"text-align: left;\" width=\"auto\" bgcolor=\"#cccccc\"&gt;&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;##lang.resource.informations##&lt;/span&gt;&lt;/td&gt;\n&lt;/tr&gt;\n&lt;tr&gt;\n&lt;td style=\"text-align: left;\" width=\"auto\"&gt;&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;##resource.informations##&lt;/span&gt;&lt;/td&gt;\n&lt;/tr&gt;\n##ENDIFresource.informations##\n&lt;/tbody&gt;\n&lt;/table&gt;');";
        $result = $DB->query($query);
        $query = "INSERT INTO `glpi_notifications`\n                                   VALUES (NULL, 'Resource Report Creation', 0, 'PluginResourcesResource', 'report',\n                                          'mail'," . $itemtype . ",\n                                          '', 1, 1, '2010-11-16 11:36:46');";
        $result = $DB->query($query);
    }
    if ($update80) {
        $restrict = "`plugin_resources_resources_id` ='-1'";
        $checklists = getAllDatasFromTable("glpi_plugin_resources_checklists", $restrict);
        $PluginResourcesChecklistconfig = new PluginResourcesChecklistconfig();
        if (!empty($checklists)) {
            foreach ($checklists as $checklist) {
                $values["name"] = addslashes($checklist["name"]);
                $values["address"] = addslashes($checklist["address"]);
                $values["comment"] = addslashes($checklist["comment"]);
                $values["tag"] = $checklist["tag"];
                $values["entities_id"] = $checklist["entities_id"];
                $PluginResourcesChecklistconfig->add($values);
            }
        }
        $query = "DELETE FROM `glpi_plugin_resources_checklists`\n               WHERE `plugin_resources_resources_id` ='-1'\n                  OR `plugin_resources_resources_id` ='0';";
        $DB->query($query);
        // Put realtime in seconds
        if (FieldExists('glpi_plugin_resources_tasks', 'realtime')) {
            $query = "ALTER TABLE `glpi_plugin_resources_tasks`\n            ADD `actiontime` INT( 11 ) NOT NULL DEFAULT 0 ;";
            $DB->queryOrDie($query, $this->version . " 0.80 Add actiontime in glpi_plugin_resources_tasks");
            $query = "UPDATE `glpi_plugin_resources_tasks`\n                   SET `actiontime` = ROUND(realtime * 3600)";
            $DB->queryOrDie($query, $this->version . " 0.80 Compute actiontime value in glpi_plugin_resources_tasks");
            $query = "ALTER TABLE `glpi_plugin_resources_tasks`\n            DROP `realtime` ;";
            $DB->queryOrDie($query, $this->version . " 0.80 DROP realtime in glpi_plugin_resources_tasks");
        }
        // ADD plannings for tasks
        $tasks = getAllDatasFromTable("glpi_plugin_resources_tasks");
        if (!empty($tasks)) {
            foreach ($tasks as $task) {
                $query = "INSERT INTO `glpi_plugin_resources_taskplannings`\n               ( `id` , `plugin_resources_tasks_id` , `begin` , `end` )\n               VALUES (NULL , '" . $task["id"] . "', '" . $task["date_begin"] . "', '" . $task["date_end"] . "') ;";
                $DB->query($query);
            }
        }
        unset($input);
        $query = "ALTER TABLE `glpi_plugin_resources_tasks`\n               DROP `date_begin`, DROP `date_end` ;";
        $DB->queryOrDie($query, $this->version . " 0.80 Drop date_begin and date_end in glpi_plugin_resources_tasks");
        // ADD tasks
        $PluginResourcesResource = new PluginResourcesResource();
        $taches = getAllDatasFromTable("glpi_plugin_resources_tasks");
        if (!empty($taches)) {
            foreach ($taches as $tache) {
                $PluginResourcesResource->getFromDB($tache["plugin_resources_resources_id"]);
                $input["entities_id"] = $PluginResourcesResource->fields["entities_id"];
                $query = "UPDATE `glpi_plugin_resources_tasks`\n               SET `entities_id` =  '" . $PluginResourcesResource->fields["entities_id"] . "' WHERE `id` = '" . $tache["id"] . "' ;";
                $DB->query($query);
            }
        }
    }
    if ($install || $update80) {
        $restrict = "`itemtype` = 'PluginResourcesResource'";
        $unicities = getAllDatasFromTable("glpi_fieldunicities", $restrict);
        if (empty($unicities)) {
            $query = "INSERT INTO `glpi_fieldunicities`\n                                      VALUES (NULL, 'Resources creation', 1, 'PluginResourcesResource', '0',\n                                             'name,firstname','1',\n                                             '1', '1', '');";
            $DB->queryOrDie($query, " 0.80 Create fieldunicities check");
        }
        $query_id = "SELECT `id` FROM `glpi_notificationtemplates` WHERE `itemtype`='PluginResourcesResource' AND `name` = 'Resource Resting'";
        $result = $DB->query($query_id) or die($DB->error());
        $itemtype = $DB->result($result, 0, 'id');
        $query = "INSERT INTO `glpi_notificationtemplatetranslations`\n                                 VALUES(NULL, " . $itemtype . ", '','##lang.resource.title## -  ##resource.firstname## ##resource.name##',\n                        '##lang.resource.restingtitle##\n##lang.resource.openby## : ##resource.openby##\n##lang.resource.entity## : ##resource.entity##\n\n##lang.resource.name## : ##resource.name##\n##lang.resource.firstname## : ##resource.firstname##\n\n##lang.resource.department## : ##resource.department##\n##lang.resource.users## : ##resource.users##\n\n##lang.resource.resting##\n\n##lang.resource.location## : ##resource.location##\n##lang.resource.home## : ##resource.home##\n##lang.resource.datebegin## : ##resource.datebegin##\n##lang.resource.dateend## : ##resource.dateend##\n\n##lang.resource.commentaires## : ##resource.commentaires##\n\n##FOREACHupdates##\n##lang.update.title##\n\n##IFupdate.datebegin####lang.resource.datebegin## : ##update.datebegin####ENDIFupdate.datebegin##\n##IFupdate.dateend####lang.resource.dateend## : ##update.dateend####ENDIFupdate.dateend##\n##IFupdate.location####lang.resource.location## : ##update.location###ENDIFupdate.location##\n##IFupdate.home####lang.resource.home## : ##update.home####ENDIFupdate.home##\n##IFupdate.comment####lang.resource.comment## : ##update.comment####ENDIFupdate.comment##\n##ENDFOREACHupdates##',\n                        '&lt;p style=\"text-align: center;\"&gt;&lt;span style=\"font-size: 11px; font-family: verdana;\"&gt;##lang.resource.restingtitle##&lt;/span&gt;&lt;/p&gt;\n&lt;table border=\"1\" cellspacing=\"2\" cellpadding=\"3\" width=\"590px\" align=\"center\"&gt;\n&lt;tbody&gt;\n&lt;tr&gt;\n&lt;td style=\"text-align: left;\" width=\"auto\" bgcolor=\"#cccccc\"&gt;&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;##lang.resource.entity##&lt;/span&gt;&lt;/td&gt;\n&lt;td style=\"text-align: left;\" width=\"auto\"&gt;&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;##resource.entity##&lt;/span&gt;&lt;/td&gt;\n&lt;td style=\"text-align: left;\" width=\"auto\" bgcolor=\"#cccccc\"&gt;&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;##lang.resource.openby##&lt;/span&gt;&lt;/td&gt;\n&lt;td style=\"text-align: left;\" width=\"auto\"&gt;&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;##resource.openby##&lt;/span&gt;&lt;/td&gt;\n&lt;/tr&gt;\n&lt;tr&gt;\n&lt;td style=\"text-align: left;\" width=\"auto\" bgcolor=\"#cccccc\"&gt;&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;##lang.resource.name##&lt;/span&gt;&lt;/td&gt;\n&lt;td style=\"text-align: left;\" width=\"auto\"&gt;&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;##resource.name##&lt;/span&gt;&lt;/td&gt;\n&lt;td style=\"text-align: left;\" width=\"auto\" bgcolor=\"#cccccc\"&gt;&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;##lang.resource.firstname##&lt;/span&gt;&lt;/td&gt;\n&lt;td style=\"text-align: left;\" width=\"auto\"&gt;&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;##resource.firstname##&lt;/span&gt;&lt;/td&gt;\n&lt;/tr&gt;\n&lt;tr&gt;\n&lt;td style=\"text-align: left;\" width=\"auto\" bgcolor=\"#cccccc\"&gt;&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;##lang.resource.department##&lt;/span&gt;&lt;/td&gt;\n&lt;td style=\"text-align: left;\" width=\"auto\"&gt;&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;##resource.department##&lt;/span&gt;&lt;/td&gt;\n&lt;td style=\"text-align: left;\" width=\"auto\" bgcolor=\"#cccccc\"&gt;&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;##lang.resource.users##&lt;/span&gt;&lt;/td&gt;\n&lt;td style=\"text-align: left;\" width=\"auto\"&gt;&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;##resource.users##&lt;/span&gt;&lt;/td&gt;\n&lt;/tr&gt;\n&lt;/tbody&gt;\n&lt;/table&gt;\n&lt;p style=\"text-align: center;\"&gt;&lt;span style=\"font-size: 11px; font-family: verdana;\"&gt;##lang.resource.resting##&lt;/span&gt;&lt;/p&gt;\n&lt;table border=\"1\" cellspacing=\"2\" cellpadding=\"3\" width=\"590px\" align=\"center\"&gt;\n&lt;tbody&gt;\n&lt;tr&gt;\n&lt;td style=\"text-align: left;\" width=\"auto\" bgcolor=\"#cccccc\"&gt;&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;##lang.resource.location##&lt;/span&gt;&lt;/td&gt;\n&lt;td style=\"text-align: left;\" width=\"auto\"&gt;&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;##resource.location##&lt;/span&gt;&lt;/td&gt;\n&lt;td style=\"text-align: left;\" width=\"auto\" bgcolor=\"#cccccc\"&gt;&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;##lang.resource.home##&lt;/span&gt;&lt;/td&gt;\n&lt;td style=\"text-align: left;\" width=\"auto\"&gt;&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;##resource.home##&lt;/span&gt;&lt;/td&gt;\n&lt;/tr&gt;\n&lt;tr&gt;\n&lt;td style=\"text-align: left;\" width=\"auto\" bgcolor=\"#cccccc\"&gt;&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;##lang.resource.datebegin##&lt;/span&gt;&lt;/td&gt;\n&lt;td style=\"text-align: left;\" width=\"auto\"&gt;&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;##resource.datebegin##&lt;/span&gt;&lt;/td&gt;\n&lt;td style=\"text-align: left;\" width=\"auto\" bgcolor=\"#cccccc\"&gt;&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;##lang.resource.dateend##&lt;/span&gt;&lt;/td&gt;\n&lt;td style=\"text-align: left;\" width=\"auto\"&gt;&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;##resource.dateend##&lt;/span&gt;&lt;/td&gt;\n&lt;/tr&gt;\n&lt;tr&gt;\n&lt;td style=\"text-align: left;\" colspan=\"4\" width=\"auto\" bgcolor=\"#cccccc\"&gt;&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;##lang.resource.commentaires##&lt;/span&gt;&lt;/td&gt;\n&lt;/tr&gt;\n&lt;tr&gt;\n&lt;td style=\"text-align: left;\" colspan=\"4\" width=\"auto\"&gt;&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;##resource.commentaires##&lt;/span&gt;&lt;/td&gt;\n&lt;/tr&gt;\n&lt;/tbody&gt;\n&lt;/table&gt;\n&lt;p&gt;##FOREACHupdates##&lt;/p&gt;\n&lt;p style=\"text-align: center;\"&gt;&lt;span style=\"font-size: 11px; font-family: verdana;\"&gt;##lang.update.title##&lt;/span&gt;&lt;/p&gt;\n&lt;table border=\"1\" cellspacing=\"2\" cellpadding=\"3\" width=\"590px\" align=\"center\"&gt;\n&lt;tbody&gt;\n##IFupdate.datebegin##\n&lt;tr&gt;\n&lt;td style=\"text-align: left;\" colspan=\"4\" width=\"auto\"&gt;\n&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;\n&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;##lang.resource.datebegin## : ##update.datebegin##\n&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;\n&lt;/tr&gt;\n##ENDIFupdate.datebegin## ##IFupdate.dateend##\n&lt;tr&gt;\n&lt;td style=\"text-align: left;\" colspan=\"4\" width=\"auto\"&gt;\n&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;\n&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;##lang.resource.dateend## : ##update.dateend##\n&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;\n&lt;/tr&gt;\n##ENDIFupdate.dateend## ##IFupdate.location##\n&lt;tr&gt;\n&lt;td style=\"text-align: left;\" colspan=\"4\" width=\"auto\"&gt;\n&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;\n&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;##lang.resource.location## : ##update.location##\n&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;\n&lt;/tr&gt;\n##ENDIFupdate.location## ##IFupdate.home##\n&lt;tr&gt;\n&lt;td style=\"text-align: left;\" colspan=\"4\" width=\"auto\"&gt;\n&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;\n&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;##lang.resource.home## : ##update.home##\n&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;\n&lt;/tr&gt;\n##ENDIFupdate.home## ##IFupdate.comment##\n&lt;tr&gt;\n&lt;td style=\"text-align: left;\" colspan=\"4\" width=\"auto\"&gt;\n&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;\n&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;##lang.resource.comment## : ##update.comment##\n&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;\n&lt;/tr&gt;\n##ENDIFupdate.comment##\n&lt;/tbody&gt;\n&lt;/table&gt;\n&lt;p&gt;##ENDFOREACHupdates##&lt;/p&gt;');";
        $result = $DB->query($query);
        $query = "INSERT INTO `glpi_notifications`\n                                   VALUES (NULL, 'New Resource Resting', 0, 'PluginResourcesResource', 'newresting',\n                                          'mail'," . $itemtype . ",\n                                          '', 1, 1, '2010-05-16 22:36:46');";
        $result = $DB->query($query);
        $query = "INSERT INTO `glpi_notifications`\n                                   VALUES (NULL, 'Update Resource Resting', 0, 'PluginResourcesResource', 'updateresting',\n                                          'mail'," . $itemtype . ",\n                                          '', 1, 1, '2010-05-16 22:36:46');";
        $result = $DB->query($query);
        $query = "INSERT INTO `glpi_notifications`\n                                   VALUES (NULL, 'Delete Resource Resting', 0, 'PluginResourcesResource', 'deleteresting',\n                                          'mail'," . $itemtype . ",\n                                          '', 1, 1, '2010-05-16 22:36:46');";
        $result = $DB->query($query);
        $query_id = "SELECT `id` FROM `glpi_notificationtemplates` WHERE `itemtype`='PluginResourcesResource' AND `name` = 'Resource Holiday'";
        $result = $DB->query($query_id) or die($DB->error());
        $itemtype = $DB->result($result, 0, 'id');
        $query = "INSERT INTO `glpi_notificationtemplatetranslations`\n                                 VALUES(NULL, " . $itemtype . ", '','##lang.resource.title## -  ##resource.firstname## ##resource.name##',\n                        '##lang.resource.holidaytitle##\n##lang.resource.openby## : ##resource.openby##\n##lang.resource.entity## : ##resource.entity##\n\n##lang.resource.name## : ##resource.name##\n##lang.resource.firstname## : ##resource.firstname##\n\n##lang.resource.department## : ##resource.department##\n##lang.resource.users## : ##resource.users##\n\n##lang.resource.holiday##\n\n##lang.resource.datebegin## : ##resource.datebegin##\n##lang.resource.dateend## : ##resource.dateend##\n\n##lang.resource.commentaires## : ##resource.commentaires##\n\n##FOREACHupdates##\n##lang.update.title##\n\n##IFupdate.datebegin####lang.resource.datebegin## : ##update.datebegin####ENDIFupdate.datebegin##\n##IFupdate.dateend####lang.resource.dateend## : ##update.dateend####ENDIFupdate.dateend##\n##IFupdate.comment####lang.resource.comment## : ##update.comment####ENDIFupdate.comment##\n##ENDFOREACHupdates##',\n                        '&lt;p style=\"text-align: center;\"&gt;&lt;span style=\"font-size: 11px; font-family: verdana;\"&gt;##lang.resource.holidaytitle##&lt;/span&gt;&lt;/p&gt;\n&lt;table border=\"1\" cellspacing=\"2\" cellpadding=\"3\" width=\"590px\" align=\"center\"&gt;\n&lt;tbody&gt;\n&lt;tr&gt;\n&lt;td style=\"text-align: left;\" width=\"auto\" bgcolor=\"#cccccc\"&gt;&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;##lang.resource.entity##&lt;/span&gt;&lt;/td&gt;\n&lt;td style=\"text-align: left;\" width=\"auto\"&gt;&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;##resource.entity##&lt;/span&gt;&lt;/td&gt;\n&lt;td style=\"text-align: left;\" width=\"auto\" bgcolor=\"#cccccc\"&gt;&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;##lang.resource.openby##&lt;/span&gt;&lt;/td&gt;\n&lt;td style=\"text-align: left;\" width=\"auto\"&gt;&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;##resource.openby##&lt;/span&gt;&lt;/td&gt;\n&lt;/tr&gt;\n&lt;tr&gt;\n&lt;td style=\"text-align: left;\" width=\"auto\" bgcolor=\"#cccccc\"&gt;&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;##lang.resource.name##&lt;/span&gt;&lt;/td&gt;\n&lt;td style=\"text-align: left;\" width=\"auto\"&gt;&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;##resource.name##&lt;/span&gt;&lt;/td&gt;\n&lt;td style=\"text-align: left;\" width=\"auto\" bgcolor=\"#cccccc\"&gt;&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;##lang.resource.firstname##&lt;/span&gt;&lt;/td&gt;\n&lt;td style=\"text-align: left;\" width=\"auto\"&gt;&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;##resource.firstname##&lt;/span&gt;&lt;/td&gt;\n&lt;/tr&gt;\n&lt;tr&gt;\n&lt;td style=\"text-align: left;\" width=\"auto\" bgcolor=\"#cccccc\"&gt;&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;##lang.resource.department##&lt;/span&gt;&lt;/td&gt;\n&lt;td style=\"text-align: left;\" width=\"auto\"&gt;&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;##resource.department##&lt;/span&gt;&lt;/td&gt;\n&lt;td style=\"text-align: left;\" width=\"auto\" bgcolor=\"#cccccc\"&gt;&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;##lang.resource.users##&lt;/span&gt;&lt;/td&gt;\n&lt;td style=\"text-align: left;\" width=\"auto\"&gt;&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;##resource.users##&lt;/span&gt;&lt;/td&gt;\n&lt;/tr&gt;\n&lt;/tbody&gt;\n&lt;/table&gt;\n&lt;p style=\"text-align: center;\"&gt;&lt;span style=\"font-size: 11px; font-family: verdana;\"&gt;##lang.resource.holiday##&lt;/span&gt;&lt;/p&gt;\n&lt;table border=\"1\" cellspacing=\"2\" cellpadding=\"3\" width=\"590px\" align=\"center\"&gt;\n&lt;tbody&gt;\n&lt;tr&gt;\n&lt;td style=\"text-align: left;\" width=\"auto\" bgcolor=\"#cccccc\"&gt;&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;##lang.resource.datebegin##&lt;/span&gt;&lt;/td&gt;\n&lt;td style=\"text-align: left;\" width=\"auto\"&gt;&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;##resource.datebegin##&lt;/span&gt;&lt;/td&gt;\n&lt;td style=\"text-align: left;\" width=\"auto\" bgcolor=\"#cccccc\"&gt;&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;##lang.resource.dateend##&lt;/span&gt;&lt;/td&gt;\n&lt;td style=\"text-align: left;\" width=\"auto\"&gt;&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;##resource.dateend##&lt;/span&gt;&lt;/td&gt;\n&lt;/tr&gt;\n&lt;tr&gt;\n&lt;td style=\"text-align: left;\" colspan=\"4\" width=\"auto\" bgcolor=\"#cccccc\"&gt;&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;##lang.resource.commentaires##&lt;/span&gt;&lt;/td&gt;\n&lt;/tr&gt;\n&lt;tr&gt;\n&lt;td style=\"text-align: left;\" colspan=\"4\" width=\"auto\"&gt;&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;##resource.commentaires##&lt;/span&gt;&lt;/td&gt;\n&lt;/tr&gt;\n&lt;/tbody&gt;\n&lt;/table&gt;\n&lt;p&gt;##FOREACHupdates##&lt;/p&gt;\n&lt;p style=\"text-align: center;\"&gt;&lt;span style=\"font-size: 11px; font-family: verdana;\"&gt;##lang.update.title##&lt;/span&gt;&lt;/p&gt;\n&lt;table border=\"1\" cellspacing=\"2\" cellpadding=\"3\" width=\"590px\" align=\"center\"&gt;\n&lt;tbody&gt;\n##IFupdate.datebegin##\n&lt;tr&gt;\n&lt;td style=\"text-align: left;\" colspan=\"4\" width=\"auto\"&gt;\n&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;\n&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;##lang.resource.datebegin## : ##update.datebegin##\n&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;\n&lt;/tr&gt;\n##ENDIFupdate.datebegin## ##IFupdate.dateend##\n&lt;tr&gt;\n&lt;td style=\"text-align: left;\" colspan=\"4\" width=\"auto\"&gt;\n&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;\n&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;##lang.resource.dateend## : ##update.dateend##\n&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;\n&lt;/tr&gt;\n##ENDIFupdate.dateend## ##IFupdate.comment##\n&lt;tr&gt;\n&lt;td style=\"text-align: left;\" colspan=\"4\" width=\"auto\"&gt;\n&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;\n&lt;span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"&gt;##lang.resource.comment## : ##update.comment##\n&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;\n&lt;/tr&gt;\n##ENDIFupdate.comment##\n&lt;/tbody&gt;\n&lt;/table&gt;\n&lt;p&gt;##ENDFOREACHupdates##&lt;/p&gt;');";
        $result = $DB->query($query);
        $query = "INSERT INTO `glpi_notifications`\n                                   VALUES (NULL, 'New Resource Holiday', 0, 'PluginResourcesResource', 'newholiday',\n                                          'mail'," . $itemtype . ",\n                                          '', 1, 1, '2010-05-16 22:36:46');";
        $result = $DB->query($query);
        $query = "INSERT INTO `glpi_notifications`\n                                   VALUES (NULL, 'Update Resource Holiday', 0, 'PluginResourcesResource', 'updateholiday',\n                                          'mail'," . $itemtype . ",\n                                          '', 1, 1, '2010-05-16 22:36:46');";
        $result = $DB->query($query);
        $query = "INSERT INTO `glpi_notifications`\n                                   VALUES (NULL, 'Delete Resource Holiday', 0, 'PluginResourcesResource', 'deleteholiday',\n                                          'mail'," . $itemtype . ",\n                                          '', 1, 1, '2010-05-16 22:36:46');";
        $result = $DB->query($query);
    }
    if ($update804) {
        $query = "SELECT * FROM `glpi_plugin_resources_choices`\n      WHERE `itemtype`!= ''\n      GROUP BY `comment`,`itemtype`";
        $result = $DB->query($query);
        $number = $DB->numrows($result);
        $affectedchoices = array();
        if (!empty($number)) {
            while ($data = $DB->fetch_assoc($result)) {
                $restrictaffected = "`itemtype` = '" . $data["itemtype"] . "'\n               AND `comment` = '" . addslashes($data["comment"]) . "'";
                $affected = getAllDatasFromTable("glpi_plugin_resources_choices", $restrictaffected);
                if (!empty($affected)) {
                    foreach ($affected as $affect) {
                        if ($affect["itemtype"] == $data["itemtype"] && $affect["comment"] == $data["comment"]) {
                            $affectedchoices[$data["id"]][] = $affect["plugin_resources_resources_id"];
                        }
                    }
                }
            }
        }
        $i = 0;
        if (!empty($affectedchoices)) {
            foreach ($affectedchoices as $key => $ressources) {
                $i++;
                $choice = new PluginResourcesChoice();
                $choice_item = new PluginResourcesChoiceItem();
                $types = array(__('Computer') => 'Computer', __('Monitor') => 'Monitor', __('Software') => 'Software', __('Network device') => 'NetworkEquipment', __('Printer') => 'Printer', __('Peripheral') => 'Peripheral', __('Phone') => 'Phone', __('Consumable model') => 'ConsumableItem', __('Specific network rights', 'resources') => '4303', __('Access to the applications', 'resources') => '4304', __('Specific securities groups', 'resources') => '4305', __('Specific distribution lists', 'resources') => '4306', __('Others needs', 'resources') => '4307', 'PluginBadgesBadge' => 'PluginBadgesBadge');
                if ($choice->getFromDB($key)) {
                    $key = array_search($choice->fields["itemtype"], $types);
                    if ($key) {
                        $name = $key;
                    } else {
                        $name = $choice->fields["itemtype"];
                    }
                    $valuesparent["name"] = $i . "." . $name;
                    $valuesparent["entities_id"] = 0;
                    $valuesparent["is_recursive"] = 1;
                    $newidparent = $choice_item->add($valuesparent);
                    $comment = "N/A";
                    if (!empty($choice->fields["comment"])) {
                        $comment = $choice->fields["comment"];
                    }
                    $valueschild["name"] = addslashes(Html::resume_text($comment, 50));
                    $valueschild["comment"] = addslashes($comment);
                    $valueschild["entities_id"] = 0;
                    $valueschild["is_recursive"] = 1;
                    $valueschild["plugin_resources_choiceitems_id"] = $newidparent;
                    $newidchild = $choice_item->add($valueschild);
                    foreach ($ressources as $id => $val) {
                        $query = "UPDATE `glpi_plugin_resources_choices`\n                           SET `plugin_resources_choiceitems_id` = '" . $newidchild . "'\n                          WHERE `plugin_resources_resources_id` = '" . $val . "'\n                          AND `itemtype` = '" . $choice->fields["itemtype"] . "'\n                           AND `comment` = '" . addslashes($choice->fields["comment"]) . "';";
                        $result = $DB->query($query);
                    }
                }
            }
        }
        $query = "ALTER TABLE `glpi_plugin_resources_choices`\n   DROP `itemtype`,\n   DROP `comment`,\n   ADD UNIQUE KEY `unicity` (`plugin_resources_resources_id`,`plugin_resources_choiceitems_id`);";
        $result = $DB->query($query);
        $query = "ALTER TABLE `glpi_plugin_resources_choices`\n   ADD `comment` text collate utf8_unicode_ci;";
        $result = $DB->query($query);
    }
    //0.83 - Drop Matricule
    if (TableExists("glpi_plugin_resources_employees") && FieldExists("glpi_plugin_resources_employees", "matricule")) {
        $query = "SELECT * FROM `glpi_users`";
        $result = $DB->query($query);
        $number = $DB->numrows($result);
        if (!empty($number)) {
            while ($data = $DB->fetch_assoc($result)) {
                $restrict = "`items_id` = '" . $data["id"] . "'\n               AND `itemtype` = 'User'";
                $links = getAllDatasFromTable("glpi_plugin_resources_resources_items", $restrict);
                if (!empty($links)) {
                    foreach ($links as $link) {
                        $employee = new PluginResourcesEmployee();
                        if ($employee->getFromDBbyResources($link["plugin_resources_resources_id"])) {
                            $matricule = $employee->fields["matricule"];
                            if (isset($matricule) && !empty($matricule)) {
                                $query = "UPDATE `glpi_users`\n                           SET `registration_number` = '" . $matricule . "'\n                           WHERE `id` ='" . $link["items_id"] . "'";
                                $DB->query($query);
                            }
                        }
                    }
                }
            }
        }
        $query = "ALTER TABLE `glpi_plugin_resources_employees`\n               DROP `matricule` ;";
        $result = $DB->query($query);
    }
    $rep_files_resources = GLPI_PLUGIN_DOC_DIR . "/resources";
    if (!is_dir($rep_files_resources)) {
        mkdir($rep_files_resources);
    }
    CronTask::Register('PluginResourcesResource', 'Resources', DAY_TIMESTAMP);
    CronTask::Register('PluginResourcesTask', 'ResourcesTask', DAY_TIMESTAMP);
    CronTask::Register('PluginResourcesChecklist', 'ResourcesChecklist', DAY_TIMESTAMP);
    CronTask::Register('PluginResourcesEmployment', 'ResourcesLeaving', DAY_TIMESTAMP, array('state' => CronTask::STATE_DISABLE));
    PluginResourcesProfile::createFirstAccess($_SESSION['glpiactiveprofile']['id']);
    return true;
}