/** Overloading the doActions function : replacing the parent's function with the one below 
  *  @param      parameters  meta datas of the hook (context, etc...) 
  *  @param      object             the object you want to process (an invoice if you are in invoice module, a propale in propale's module, etc...) 
  *  @param      action             current action (if set). Generally create or edit or null 
  *  @return       void 
  */
 function formObjectOptions($parameters, &$object, &$action, $hookmanager)
 {
     global $db, $langs;
     if (in_array('ordercard', explode(':', $parameters['context'])) && $object->statut < 3) {
         dol_include_once('/shippableorder/class/shippableorder.class.php');
         $shippableOrder = new ShippableOrder($db);
         $shippableOrder->isOrderShippable($object->id);
         echo '<tr><td>' . $langs->trans('ShippableStatus') . '</td>';
         echo '<td>' . $shippableOrder->orderStockStatus(false) . '</td></tr>';
         $object->shippableorder = $shippableOrder;
     }
     return 0;
 }
     print_liste_field_titre($langs->trans('Règlement'), $_SERVER["PHP_SELF"], 'c.ref_client', '', $param, '', $sortfield, $sortorder);
 }
 print_liste_field_titre($langs->trans('RefCustomerOrder'), $_SERVER["PHP_SELF"], 'c.ref_client', '', $param, '', $sortfield, $sortorder);
 print_liste_field_titre($langs->trans('Company'), $_SERVER["PHP_SELF"], 's.nom', '', $param, '', $sortfield, $sortorder);
 print_liste_field_titre($langs->trans('OrderDate'), $_SERVER["PHP_SELF"], 'c.date_commande', '', $param, 'align="right"', $sortfield, $sortorder);
 print_liste_field_titre($langs->trans('DeliveryDate'), $_SERVER["PHP_SELF"], 'c.date_livraison', '', $param, 'align="right"', $sortfield, $sortorder);
 print_liste_field_titre($langs->trans('AmountHT'), $_SERVER["PHP_SELF"], 'c.total_ht', '', $param, 'align="right"', $sortfield, $sortorder);
 print_liste_field_titre($langs->trans('AmountHTToShip'), $_SERVER["PHP_SELF"], '', '', $param, 'align="right"', $sortfield, $sortorder);
 print_liste_field_titre($langs->trans('Status'), $_SERVER["PHP_SELF"], 'c.fk_statut', '', $param, 'align="right"', $sortfield, $sortorder);
 print_liste_field_titre($langs->trans('QtyProd'), $_SERVER["PHP_SELF"], 'qty_prod', '', $param, 'align="right"', $sortfield, $sortorder);
 print_liste_field_titre($langs->trans('InStock'), $_SERVER["PHP_SELF"], 'qty_prod', '', $param, 'align="right"', $sortfield, $sortorder);
 print_liste_field_titre($langs->trans('Warehouse'), $_SERVER["PHP_SELF"], 'qty_prod', '', $param, 'align="right"', $sortfield, $sortorder);
 print_liste_field_titre($langs->trans('CreateShipment'), $_SERVER["PHP_SELF"], 'qty_prod', '', $param, 'align="right"', $sortfield, $sortorder);
 $generic_commande = new Commande($db);
 $formproduct = new FormProduct($db);
 $shippableOrder = new ShippableOrder($db);
 print '</tr>';
 print '<tr class="liste_titre">';
 print '<td class="liste_titre">';
 print '<input class="flat" size="6" type="text" name="sref" value="' . $sref . '">';
 print '</td>';
 print '<td class="liste_titre" align="left">';
 print '<input class="flat" type="text" size="6" name="sref_client" value="' . $sref_client . '">';
 print '</td>';
 print '<td class="liste_titre" align="left">';
 print '<input class="flat" type="text" name="snom" value="' . $snom . '">';
 print '</td>';
 print '<td class="liste_titre">&nbsp;</td>';
 print '<td class="liste_titre">&nbsp;</td>';
 print '<td class="liste_titre">&nbsp;</td>';
 print '<td class="liste_titre">&nbsp;</td>';
 /**
  * Function called when a Dolibarrr business event is done.
  * All functions "run_trigger" are triggered if file
  * is inside directory core/triggers
  *
  * 	@param		string		$action		Event action code
  * 	@param		Object		$object		Object
  * 	@param		User		$user		Object user
  * 	@param		Translate	$langs		Object langs
  * 	@param		conf		$conf		Object conf
  * 	@return		int						<0 if KO, 0 if no triggered ran, >0 if OK
  */
 public function run_trigger($action, $object, $user, $langs, $conf)
 {
     if ($action == 'SHIPPING_VALIDATE') {
         // Classer délivrée la commande si totalement expédiée
         if ($conf->global->SHIPPABLEORDER_CLOSE_ORDER) {
             dol_include_once('/commande/class/commande.class.php');
             dol_include_once('/shippableorder/class/shippableorder.class.php');
             $object->fetchObjectLinked(0, 'commande');
             if (!empty($object->linkedObjects['commande'])) {
                 $commande = array_pop($object->linkedObjects['commande']);
                 $orderShippable = new ShippableOrder($this->db);
                 $orderShippable->isOrderShippable($commande->id);
                 if ($orderShippable->nbProduct == 0) {
                     $commande->cloture($user);
                     setEventMessage($langs->trans('OrderClosed', $commande->ref));
                 }
             }
         }
         dol_syslog("Trigger '" . $this->name . "' for action '{$action}' launched by " . __FILE__ . ". id=" . $object->id);
     }
     return 0;
 }