adding hook for addMoreActionsbuttons
This commit is contained in:
parent
6149994b43
commit
e9374e8c08
@ -1814,98 +1814,104 @@ elseif (! empty($object->id))
|
|||||||
/**
|
/**
|
||||||
* Boutons actions
|
* 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 '<div class="tabsAction">';
|
if ($user->societe_id == 0 && $action != 'edit_line' && $action != 'delete')
|
||||||
|
|
||||||
// Validate
|
|
||||||
if ($object->statut == 0 && $num > 0)
|
|
||||||
{
|
{
|
||||||
if ($user->rights->fournisseur->commande->valider)
|
print '<div class="tabsAction">';
|
||||||
{
|
|
||||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=valid"';
|
|
||||||
print '>'.$langs->trans('Validate').'</a>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Modify
|
// Validate
|
||||||
if ($object->statut == 1)
|
if ($object->statut == 0 && $num > 0)
|
||||||
{
|
|
||||||
if ($user->rights->fournisseur->commande->commander)
|
|
||||||
{
|
{
|
||||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=reopen">'.$langs->trans("Modify").'</a>';
|
if ($user->rights->fournisseur->commande->valider)
|
||||||
}
|
{
|
||||||
}
|
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=valid"';
|
||||||
|
print '>'.$langs->trans('Validate').'</a>';
|
||||||
// Approve
|
}
|
||||||
if ($object->statut == 1)
|
|
||||||
{
|
|
||||||
if ($user->rights->fournisseur->commande->approuver)
|
|
||||||
{
|
|
||||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=approve">'.$langs->trans("ApproveOrder").'</a>';
|
|
||||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=refuse">'.$langs->trans("RefuseOrder").'</a>';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
print '<a class="butActionRefused" href="#">'.$langs->trans("ApproveOrder").'</a>';
|
|
||||||
print '<a class="butActionRefused" href="#">'.$langs->trans("RefuseOrder").'</a>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Send
|
|
||||||
if (in_array($object->statut, array(2, 3, 4, 5)))
|
|
||||||
{
|
|
||||||
if ($user->rights->fournisseur->commande->commander)
|
|
||||||
{
|
|
||||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&mode=init">'.$langs->trans('SendByMail').'</a>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Reopen
|
|
||||||
if (in_array($object->statut, array(2, 5, 6, 7, 9)))
|
|
||||||
{
|
|
||||||
if ($user->rights->fournisseur->commande->commander)
|
|
||||||
{
|
|
||||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=reopen">'.$langs->trans("ReOpen").'</a>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create bill
|
|
||||||
if (! empty($conf->fournisseur->enabled) && $object->statut >= 2) // 2 means accepted
|
|
||||||
{
|
|
||||||
if ($user->rights->fournisseur->facture->creer)
|
|
||||||
{
|
|
||||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/fourn/facture/card.php?action=create&origin='.$object->element.'&originid='.$object->id.'&socid='.$object->socid.'">'.$langs->trans("CreateBill").'</a>';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//if ($user->rights->fournisseur->commande->creer && $object->statut > 2)
|
// Modify
|
||||||
//{
|
if ($object->statut == 1)
|
||||||
// print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=classifybilled">'.$langs->trans("ClassifyBilled").'</a>';
|
|
||||||
//}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Cancel
|
|
||||||
if ($object->statut == 2)
|
|
||||||
{
|
|
||||||
if ($user->rights->fournisseur->commande->commander)
|
|
||||||
{
|
{
|
||||||
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=cancel">'.$langs->trans("CancelOrder").'</a>';
|
if ($user->rights->fournisseur->commande->commander)
|
||||||
|
{
|
||||||
|
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=reopen">'.$langs->trans("Modify").'</a>';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Clone
|
// Approve
|
||||||
if ($user->rights->fournisseur->commande->creer)
|
if ($object->statut == 1)
|
||||||
{
|
{
|
||||||
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&socid='.$object->socid.'&action=clone&object=order">'.$langs->trans("ToClone").'</a>';
|
if ($user->rights->fournisseur->commande->approuver)
|
||||||
}
|
{
|
||||||
|
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=approve">'.$langs->trans("ApproveOrder").'</a>';
|
||||||
|
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=refuse">'.$langs->trans("RefuseOrder").'</a>';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print '<a class="butActionRefused" href="#">'.$langs->trans("ApproveOrder").'</a>';
|
||||||
|
print '<a class="butActionRefused" href="#">'.$langs->trans("RefuseOrder").'</a>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Delete
|
// Send
|
||||||
if ($user->rights->fournisseur->commande->supprimer)
|
if (in_array($object->statut, array(2, 3, 4, 5)))
|
||||||
{
|
{
|
||||||
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete">'.$langs->trans("Delete").'</a>';
|
if ($user->rights->fournisseur->commande->commander)
|
||||||
}
|
{
|
||||||
|
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&mode=init">'.$langs->trans('SendByMail').'</a>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
print "</div>";
|
// Reopen
|
||||||
|
if (in_array($object->statut, array(2, 5, 6, 7, 9)))
|
||||||
|
{
|
||||||
|
if ($user->rights->fournisseur->commande->commander)
|
||||||
|
{
|
||||||
|
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=reopen">'.$langs->trans("ReOpen").'</a>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create bill
|
||||||
|
if (! empty($conf->fournisseur->enabled) && $object->statut >= 2) // 2 means accepted
|
||||||
|
{
|
||||||
|
if ($user->rights->fournisseur->facture->creer)
|
||||||
|
{
|
||||||
|
print '<a class="butAction" href="'.DOL_URL_ROOT.'/fourn/facture/card.php?action=create&origin='.$object->element.'&originid='.$object->id.'&socid='.$object->socid.'">'.$langs->trans("CreateBill").'</a>';
|
||||||
|
}
|
||||||
|
|
||||||
|
//if ($user->rights->fournisseur->commande->creer && $object->statut > 2)
|
||||||
|
//{
|
||||||
|
// print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=classifybilled">'.$langs->trans("ClassifyBilled").'</a>';
|
||||||
|
//}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Cancel
|
||||||
|
if ($object->statut == 2)
|
||||||
|
{
|
||||||
|
if ($user->rights->fournisseur->commande->commander)
|
||||||
|
{
|
||||||
|
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=cancel">'.$langs->trans("CancelOrder").'</a>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Clone
|
||||||
|
if ($user->rights->fournisseur->commande->creer)
|
||||||
|
{
|
||||||
|
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&socid='.$object->socid.'&action=clone&object=order">'.$langs->trans("ToClone").'</a>';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Delete
|
||||||
|
if ($user->rights->fournisseur->commande->supprimer)
|
||||||
|
{
|
||||||
|
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete">'.$langs->trans("Delete").'</a>';
|
||||||
|
}
|
||||||
|
|
||||||
|
print "</div>";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
print "<br>";
|
print "<br>";
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user