static function getSearchOptionsToAdd()
{
$tab = array();
$tab['contract'] = self::getTypeName(Session::getPluralNumber());
$joinparams = array('beforejoin' => array('table' => 'glpi_contracts_items', 'joinparams' => array('jointype' => 'itemtype_item')));
$joinparamscost = array('jointype' => 'child', 'beforejoin' => array('table' => 'glpi_contracts', 'joinparams' => $joinparams));
$tab[139]['table'] = 'glpi_contracts_items';
$tab[139]['field'] = 'id';
$tab[139]['name'] = _x('quantity', 'Number of contracts');
$tab[139]['forcegroupby'] = true;
$tab[139]['usehaving'] = true;
$tab[139]['datatype'] = 'count';
$tab[139]['massiveaction'] = false;
$tab[139]['joinparams'] = array('jointype' => 'itemtype_item');
$tab[29]['table'] = 'glpi_contracts';
$tab[29]['field'] = 'name';
$tab[29]['name'] = self::getTypeName(1);
$tab[29]['forcegroupby'] = true;
$tab[29]['datatype'] = 'itemlink';
$tab[29]['massiveaction'] = false;
$tab[29]['joinparams'] = $joinparams;
$tab[30]['table'] = 'glpi_contracts';
$tab[30]['field'] = 'num';
$tab[30]['name'] = __('Contract number');
$tab[30]['forcegroupby'] = true;
$tab[30]['massiveaction'] = false;
$tab[30]['joinparams'] = $joinparams;
$tab[30]['datatype'] = 'string';
$tab[129]['table'] = 'glpi_contracttypes';
$tab[129]['field'] = 'name';
$tab[129]['name'] = sprintf(__('%1$s - %2$s'), __('Contract'), __('Type'));
$tab[129]['datatype'] = 'dropdown';
$tab[129]['massiveaction'] = false;
$tab[129]['joinparams'] = array('beforejoin' => array('table' => 'glpi_contracts', 'joinparams' => $joinparams));
$tab[130]['table'] = 'glpi_contracts';
$tab[130]['field'] = 'duration';
$tab[130]['name'] = sprintf(__('%1$s - %2$s'), __('Contract'), __('Duration'));
$tab[130]['datatype'] = 'number';
$tab[130]['max'] = 120;
$tab[130]['unit'] = 'month';
$tab[130]['forcegroupby'] = true;
$tab[130]['massiveaction'] = false;
$tab[130]['joinparams'] = $joinparams;
$tab[131]['table'] = 'glpi_contracts';
$tab[131]['field'] = 'periodicity';
//TRANS: %1$s is Contract, %2$s is field name
$tab[131]['name'] = sprintf(__('%1$s - %2$s'), __('Contract'), __('Periodicity'));
$tab[131]['forcegroupby'] = true;
$tab[131]['massiveaction'] = false;
$tab[131]['joinparams'] = $joinparams;
$tab[131]['datatype'] = 'number';
$tab[131]['min'] = 12;
$tab[131]['max'] = 60;
$tab[131]['step'] = 12;
$tab[131]['toadd'] = array(0 => Dropdown::EMPTY_VALUE, 1 => sprintf(_n('%d month', '%d months', 1), 1), 2 => sprintf(_n('%d month', '%d months', 2), 2), 3 => sprintf(_n('%d month', '%d months', 3), 3), 6 => sprintf(_n('%d month', '%d months', 6), 6));
$tab[131]['unit'] = 'month';
$tab[132]['table'] = 'glpi_contracts';
$tab[132]['field'] = 'begin_date';
$tab[132]['name'] = sprintf(__('%1$s - %2$s'), __('Contract'), __('Start date'));
$tab[132]['forcegroupby'] = true;
$tab[132]['datatype'] = 'date';
$tab[132]['massiveaction'] = false;
$tab[132]['joinparams'] = $joinparams;
$tab[133]['table'] = 'glpi_contracts';
$tab[133]['field'] = 'accounting_number';
$tab[133]['name'] = sprintf(__('%1$s - %2$s'), __('Contract'), __('Account number'));
$tab[133]['forcegroupby'] = true;
$tab[133]['massiveaction'] = false;
$tab[133]['datatype'] = 'string';
$tab[133]['joinparams'] = $joinparams;
$tab[134]['table'] = 'glpi_contracts';
$tab[134]['field'] = 'end_date';
$tab[134]['name'] = sprintf(__('%1$s - %2$s'), __('Contract'), __('End date'));
$tab[134]['forcegroupby'] = true;
$tab[134]['datatype'] = 'date_delay';
$tab[134]['datafields'][1] = 'begin_date';
$tab[134]['datafields'][2] = 'duration';
$tab[134]['searchunit'] = 'MONTH';
$tab[134]['delayunit'] = 'MONTH';
$tab[134]['massiveaction'] = false;
$tab[134]['joinparams'] = $joinparams;
$tab[135]['table'] = 'glpi_contracts';
$tab[135]['field'] = 'notice';
$tab[135]['name'] = sprintf(__('%1$s - %2$s'), __('Contract'), __('Notice'));
$tab[135]['datatype'] = 'number';
$tab[135]['max'] = 120;
$tab[135]['unit'] = 'month';
$tab[135]['forcegroupby'] = true;
$tab[135]['massiveaction'] = false;
$tab[135]['joinparams'] = $joinparams;
$tab[136]['table'] = 'glpi_contractcosts';
$tab[136]['field'] = 'totalcost';
$tab[136]['name'] = sprintf(__('%1$s - %2$s'), __('Contract'), __('Cost'));
$tab[136]['forcegroupby'] = true;
$tab[136]['usehaving'] = true;
$tab[136]['datatype'] = 'decimal';
$tab[136]['massiveaction'] = false;
$tab[136]['joinparams'] = $joinparamscost;
$tab[136]['computation'] = "(SUM(TABLE.`cost`) / COUNT(TABLE.`id`)) * COUNT(DISTINCT TABLE.`id`)";
$tab[137]['table'] = 'glpi_contracts';
$tab[137]['field'] = 'billing';
$tab[137]['name'] = sprintf(__('%1$s - %2$s'), __('Contract'), __('Invoice period'));
$tab[137]['forcegroupby'] = true;
$tab[137]['massiveaction'] = false;
$tab[137]['joinparams'] = $joinparams;
$tab[137]['datatype'] = 'number';
$tab[137]['min'] = 12;
$tab[137]['max'] = 60;
$tab[137]['step'] = 12;
$tab[137]['toadd'] = array(0 => Dropdown::EMPTY_VALUE, 1 => sprintf(_n('%d month', '%d months', 1), 1), 2 => sprintf(_n('%d month', '%d months', 2), 2), 3 => sprintf(_n('%d month', '%d months', 3), 3), 6 => sprintf(_n('%d month', '%d months', 6), 6));
$tab[137]['unit'] = 'month';
$tab[138]['table'] = 'glpi_contracts';
$tab[138]['field'] = 'renewal';
$tab[138]['name'] = sprintf(__('%1$s - %2$s'), __('Contract'), __('Renewal'));
$tab[138]['forcegroupby'] = true;
$tab[138]['massiveaction'] = false;
$tab[138]['joinparams'] = $joinparams;
$tab[138]['datatype'] = 'specific';
return $tab;
}