function plugin_moreticket_getAddSearchOptions($itemtype)
{
    $sopt = array();
    if ($itemtype == "Ticket") {
        if (Session::haveRight("plugin_moreticket", READ)) {
            $config = new PluginMoreticketConfig();
            $sopt[3451]['table'] = 'glpi_plugin_moreticket_waitingtickets';
            $sopt[3451]['field'] = 'date_report';
            $sopt[3451]['name'] = __('Postponement date', 'moreticket');
            $sopt[3451]['datatype'] = "datetime";
            $sopt[3451]['joinparams'] = array('jointype' => 'child');
            $sopt[3451]['massiveaction'] = false;
            $sopt[3452]['table'] = 'glpi_plugin_moreticket_waitingtypes';
            $sopt[3452]['field'] = 'name';
            $sopt[3452]['name'] = PluginMoreticketWaitingType::getTypeName(1);
            $sopt[3452]['datatype'] = "dropdown";
            $sopt[3452]['joinparams'] = array('beforejoin' => array('table' => 'glpi_plugin_moreticket_waitingtickets', 'joinparams' => array('jointype' => 'child')));
            $sopt[3452]['massiveaction'] = false;
            if ($config->closeInformations()) {
                $sopt[3453]['table'] = 'glpi_plugin_moreticket_closetickets';
                $sopt[3453]['field'] = 'date';
                $sopt[3453]['name'] = __('Close ticket informations', 'moreticket') . " : " . __('Date');
                $sopt[3453]['datatype'] = "datetime";
                $sopt[3453]['joinparams'] = array('jointype' => 'child');
                $sopt[3453]['massiveaction'] = false;
                $sopt[3454]['table'] = 'glpi_plugin_moreticket_closetickets';
                $sopt[3454]['field'] = 'comment';
                $sopt[3454]['name'] = __('Close ticket informations', 'moreticket') . " : " . __('Comments');
                $sopt[3454]['datatype'] = "text";
                $sopt[3454]['joinparams'] = array('jointype' => 'child');
                $sopt[3454]['massiveaction'] = false;
                $sopt[3455]['table'] = 'glpi_plugin_moreticket_closetickets';
                $sopt[3455]['field'] = 'requesters_id';
                $sopt[3455]['name'] = __('Close ticket informations', 'moreticket') . " : " . __('Writer');
                $sopt[3455]['datatype'] = "dropdown";
                $sopt[3455]['joinparams'] = array('jointype' => 'child');
                $sopt[3455]['massiveaction'] = false;
                $sopt[3486]['table'] = 'glpi_documents';
                $sopt[3486]['field'] = 'name';
                $sopt[3486]['name'] = __('Close ticket informations', 'moreticket') . " : " . _n('Document', 'Documents', Session::getPluralNumber());
                $sopt[3486]['forcegroupby'] = true;
                $sopt[3486]['usehaving'] = true;
                $sopt[3486]['datatype'] = 'dropdown';
                $sopt[3486]['massiveaction'] = false;
                $sopt[3486]['joinparams'] = array('beforejoin' => array('table' => 'glpi_documents_items', 'joinparams' => array('jointype' => 'itemtype_item', 'specific_itemtype' => 'PluginMoreticketCloseTicket', 'beforejoin' => array('table' => 'glpi_plugin_moreticket_closetickets', 'joinparams' => array()))));
            }
        }
    }
    return $sopt;
}
 /**
  * Print the wainting ticket form
  *
  * @param $ID integer ID of the item
  * @param $options array
  *     - target filename : where to go when done.
  *     - withtemplate boolean : template or basic item
  *
  * @return Nothing (display)
  * */
 static function showForTicket($item)
 {
     global $CFG_GLPI;
     // validation des droits
     if (!Session::haveRight('plugin_moreticket', READ)) {
         return false;
     }
     if (isset($_REQUEST["start"])) {
         $start = $_REQUEST["start"];
     } else {
         $start = 0;
     }
     // Total Number of events
     $number = countElementsInTable("glpi_plugin_moreticket_waitingtickets", "`tickets_id`='" . $item->getField('id') . "'");
     if ($number < 1) {
         echo "<div class='center'>";
         echo "<table class='tab_cadre_fixe'>";
         echo "<tr><th>" . __('No historical') . "</th></tr>";
         echo "</table>";
         echo "</div><br>";
         return;
     } else {
         echo "<div class='center'>";
         // Display the pager
         Html::printAjaxPager(__('Ticket suspension history', 'moreticket'), $start, $number);
         echo "<table class='tab_cadre_fixe'>";
         echo "<tr>";
         echo "<th>" . __('Suspension date', 'moreticket') . "</th>";
         echo "<th>" . __('Reason', 'moreticket') . "</th>";
         echo "<th>" . PluginMoreticketWaitingType::getTypeName(1) . "</th>";
         echo "<th>" . __('Postponement date', 'moreticket') . "</th>";
         echo "<th>" . __('Suspension end date', 'moreticket') . "</th>";
         echo "</tr>";
         foreach (self::getWaitingTicketFromDB($item->getField('id'), array('start' => $start, 'limit' => $_SESSION['glpilist_limit'])) as $waitingTicket) {
             echo "<tr class='tab_bg_2'>";
             echo "<td>";
             echo Html::convDateTime($waitingTicket['date_suspension']);
             echo "</td>";
             echo "<td>";
             echo $waitingTicket['reason'];
             echo "</td>";
             echo "<td>";
             echo Dropdown::getDropdownName('glpi_plugin_moreticket_waitingtypes', $waitingTicket['plugin_moreticket_waitingtypes_id']);
             echo "</td>";
             echo "<td>";
             if ($waitingTicket['date_report'] == "0000-00-00 00:00:00") {
                 echo _x('periodicity', 'None');
             } else {
                 echo Html::convDateTime($waitingTicket['date_report']);
             }
             echo "</td>";
             echo "<td>";
             echo Html::convDateTime($waitingTicket['date_end_suspension']);
             echo "</td>";
             echo "</tr>";
         }
         echo "</table>";
         echo "</div>";
         Html::printAjaxPager(__('Ticket suspension history', 'moreticket'), $start, $number);
     }
 }