/**
  * @param $item       CommonITILObject
  * @param $type
  */
 static function alertValidation(CommonITILObject $item, $type)
 {
     global $CFG_GLPI;
     // No alert for new item
     if ($item->isNewID($item->getID())) {
         return;
     }
     $status = array_merge($item->getClosedStatusArray(), $item->getSolvedStatusArray());
     $message = __s("This item is waiting for approval, do you really want to resolve or close it?");
     switch ($type) {
         case 'status':
             Html::scriptStart();
             echo "\$('[name=\"status\"]').change(function() {\n                     var status_ko = 0;\n                     var input_status = \$(this).val();\n                     if (input_status != undefined) {\n                        if ((";
             $first = true;
             foreach ($status as $val) {
                 if (!$first) {
                     echo "||";
                 }
                 echo "input_status == {$val}";
                 $first = false;
             }
             echo "           )\n                                 && input_status != " . $item->fields['status'] . "){\n                           status_ko = 1;\n                        }\n                     }\n                     if ((status_ko == 1)\n                         && ('" . $item->fields['global_validation'] . "' == '" . self::WAITING . "')) {\n                        alert('" . $message . "');\n                     }\n                  });";
             echo Html::scriptEnd();
             break;
         case 'solution':
             if (!in_array($item->fields['status'], $status) && $item->fields['global_validation'] == self::WAITING) {
                 Html::displayTitle($CFG_GLPI['root_doc'] . "/pics/warning.png", $message, $message);
             }
             break;
     }
 }