From e9374e8c08c46b1504d012bf4ffdff5a5995187f Mon Sep 17 00:00:00 2001 From: jean Date: Thu, 25 Sep 2014 09:26:32 +0200 Subject: [PATCH] adding hook for addMoreActionsbuttons --- htdocs/fourn/commande/card.php | 152 +++++++++++++++++---------------- 1 file changed, 79 insertions(+), 73 deletions(-) diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index ba3cb7e9de0..d0fa34d87ad 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -1814,98 +1814,104 @@ elseif (! empty($object->id)) /** * Boutons actions */ - if ($user->societe_id == 0 && $action != 'edit_line' && $action != 'delete') + $parameters = array(); + $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been + // modified by hook + if (empty($reshook)) { - print '
'; - - // Validate - if ($object->statut == 0 && $num > 0) + if ($user->societe_id == 0 && $action != 'edit_line' && $action != 'delete') { - if ($user->rights->fournisseur->commande->valider) + print '
'; + + // Validate + if ($object->statut == 0 && $num > 0) { - print ''.$langs->trans('Validate').''; + if ($user->rights->fournisseur->commande->valider) + { + print ''.$langs->trans('Validate').''; + } } - } - - // Modify - if ($object->statut == 1) - { - if ($user->rights->fournisseur->commande->commander) + + // Modify + if ($object->statut == 1) { - print ''.$langs->trans("Modify").''; + if ($user->rights->fournisseur->commande->commander) + { + print ''.$langs->trans("Modify").''; + } } - } - - // Approve - if ($object->statut == 1) - { - if ($user->rights->fournisseur->commande->approuver) + + // Approve + if ($object->statut == 1) { - print ''.$langs->trans("ApproveOrder").''; - print ''.$langs->trans("RefuseOrder").''; + if ($user->rights->fournisseur->commande->approuver) + { + print ''.$langs->trans("ApproveOrder").''; + print ''.$langs->trans("RefuseOrder").''; + } + else + { + print ''.$langs->trans("ApproveOrder").''; + print ''.$langs->trans("RefuseOrder").''; + } } - else + + // Send + if (in_array($object->statut, array(2, 3, 4, 5))) { - print ''.$langs->trans("ApproveOrder").''; - print ''.$langs->trans("RefuseOrder").''; + if ($user->rights->fournisseur->commande->commander) + { + print ''.$langs->trans('SendByMail').''; + } } - } - - // Send - if (in_array($object->statut, array(2, 3, 4, 5))) - { - if ($user->rights->fournisseur->commande->commander) + + // Reopen + if (in_array($object->statut, array(2, 5, 6, 7, 9))) { - print ''.$langs->trans('SendByMail').''; + if ($user->rights->fournisseur->commande->commander) + { + print ''.$langs->trans("ReOpen").''; + } } - } - - // Reopen - if (in_array($object->statut, array(2, 5, 6, 7, 9))) - { - if ($user->rights->fournisseur->commande->commander) + + // Create bill + if (! empty($conf->fournisseur->enabled) && $object->statut >= 2) // 2 means accepted { - print ''.$langs->trans("ReOpen").''; + if ($user->rights->fournisseur->facture->creer) + { + print ''.$langs->trans("CreateBill").''; + } + + //if ($user->rights->fournisseur->commande->creer && $object->statut > 2) + //{ + // print ''.$langs->trans("ClassifyBilled").''; + //} } - } - - // Create bill - if (! empty($conf->fournisseur->enabled) && $object->statut >= 2) // 2 means accepted - { - if ($user->rights->fournisseur->facture->creer) + + // Cancel + if ($object->statut == 2) { - print ''.$langs->trans("CreateBill").''; + if ($user->rights->fournisseur->commande->commander) + { + print ''.$langs->trans("CancelOrder").''; + } } - - //if ($user->rights->fournisseur->commande->creer && $object->statut > 2) - //{ - // print ''.$langs->trans("ClassifyBilled").''; - //} - } - - // Cancel - if ($object->statut == 2) - { - if ($user->rights->fournisseur->commande->commander) + + // Clone + if ($user->rights->fournisseur->commande->creer) { - print ''.$langs->trans("CancelOrder").''; + print ''.$langs->trans("ToClone").''; } + + // Delete + if ($user->rights->fournisseur->commande->supprimer) + { + print ''.$langs->trans("Delete").''; + } + + print "
"; } - - // Clone - if ($user->rights->fournisseur->commande->creer) - { - print ''.$langs->trans("ToClone").''; - } - - // Delete - if ($user->rights->fournisseur->commande->supprimer) - { - print ''.$langs->trans("Delete").''; - } - - print "
"; } print "
";