mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
New: Add new hook function addMoreActionsButtons to allow a module to
add/replace action buttons into an element.
This commit is contained in:
parent
101151630d
commit
8d916215cc
|
|
@ -8,7 +8,7 @@ For users:
|
|||
- New: Add graph stats for suppliers orders in tab "stats" on products.
|
||||
- New: Add option MAIN_HIDE_INACTIVETAB_ON_PRINT to hide inactive tabs when you
|
||||
use the "print" view on screen.
|
||||
- New: Add menu entry to barcode genration page.
|
||||
- New: Add a menu entry to a barcode generation page.
|
||||
- New: Add option MAIN_AUTO_TIMESTAMP_IN_PUBLIC_NOTES and MAIN_AUTO_TIMESTAMP_IN_PRIVATE_NOTES
|
||||
to automatically add timestamp and user line into editionf field when editing a note.
|
||||
- New: Add button cancel into edition of notes.
|
||||
|
|
@ -27,7 +27,9 @@ For developers:
|
|||
- New: Add option 'aZ' into GETPOST function to check parameters contains
|
||||
only a to z or A to Z characters.
|
||||
- New: Opensurvey polls tab cards can now be extended from external modules.
|
||||
- New: Triggers OPENSURVEY_CREATE, OPENSURVEY_DELETE
|
||||
- New: Triggers OPENSURVEY_CREATE, OPENSURVEY_DELETE added.
|
||||
- New: Add new hook function addMoreActionsButtons to allow a module to add/replace
|
||||
action buttons into an element.
|
||||
|
||||
WARNING: Following change may create regression for some external modules, but was necessary to make
|
||||
Dolibarr better:
|
||||
|
|
|
|||
|
|
@ -167,8 +167,7 @@ if ($action == 'add_action')
|
|||
$actioncomm->datep = $datep;
|
||||
$actioncomm->datef = $datef;
|
||||
$actioncomm->percentage = $percentage;
|
||||
$actioncomm->duree=((float) (GETPOST('dureehour') * 60) + (float) GETPOST('dureemin')) *
|
||||
60;
|
||||
$actioncomm->duree=((float) (GETPOST('dureehour') * 60) + (float) GETPOST('dureemin')) * 60;
|
||||
|
||||
$usertodo=new User($db);
|
||||
if ($_POST["affectedto"] > 0)
|
||||
|
|
@ -1072,29 +1071,34 @@ if ($id > 0)
|
|||
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
if ($action != 'edit')
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('addMoreActionsButtons',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
||||
if (empty($reshook))
|
||||
{
|
||||
if ($user->rights->agenda->allactions->create ||
|
||||
(($act->author->id == $user->id || $act->usertodo->id == $user->id) && $user->rights->agenda->myactions->create))
|
||||
if ($action != 'edit')
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="fiche.php?action=edit&id='.$act->id.'">'.$langs->trans("Modify").'</a></div>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.$langs->trans("NotAllowed").'">'.$langs->trans("Modify").'</a></div>';
|
||||
}
|
||||
|
||||
if ($user->rights->agenda->allactions->delete ||
|
||||
(($act->author->id == $user->id || $act->usertodo->id == $user->id) && $user->rights->agenda->myactions->delete))
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butActionDelete" href="fiche.php?action=delete&id='.$act->id.'">'.$langs->trans("Delete").'</a></div>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.$langs->trans("NotAllowed").'">'.$langs->trans("Delete").'</a></div>';
|
||||
if ($user->rights->agenda->allactions->create ||
|
||||
(($act->author->id == $user->id || $act->usertodo->id == $user->id) && $user->rights->agenda->myactions->create))
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="fiche.php?action=edit&id='.$act->id.'">'.$langs->trans("Modify").'</a></div>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.$langs->trans("NotAllowed").'">'.$langs->trans("Modify").'</a></div>';
|
||||
}
|
||||
|
||||
if ($user->rights->agenda->allactions->delete ||
|
||||
(($act->author->id == $user->id || $act->usertodo->id == $user->id) && $user->rights->agenda->myactions->delete))
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butActionDelete" href="fiche.php?action=delete&id='.$act->id.'">'.$langs->trans("Delete").'</a></div>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.$langs->trans("NotAllowed").'">'.$langs->trans("Delete").'</a></div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2127,99 +2127,104 @@ else
|
|||
{
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
if ($action != 'statut' && $action <> 'editline')
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('addMoreActionsButtons',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
||||
if (empty($reshook))
|
||||
{
|
||||
// Validate
|
||||
if ($object->statut == 0 && $object->total_ttc >= 0 && count($object->lines) > 0 && $user->rights->propal->valider)
|
||||
if ($action != 'statut' && $action <> 'editline')
|
||||
{
|
||||
if (count($object->lines) > 0) print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=validate">'.$langs->trans('Validate').'</a></div>';
|
||||
//else print '<a class="butActionRefused" href="#">'.$langs->trans('Validate').'</a>';
|
||||
}
|
||||
// Create event
|
||||
if ($conf->agenda->enabled && ! empty($conf->global->MAIN_ADD_EVENT_ON_ELEMENT_CARD)) // Add hidden condition because this is not a "workflow" action so should appears somewhere else on page.
|
||||
{
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/comm/action/fiche.php?action=create&origin='.$object->element.'&originid='.$object->id.'&socid='.$object->socid.'">'.$langs->trans("AddAction").'</a>';
|
||||
}
|
||||
// Edit
|
||||
if ($object->statut == 1 && $user->rights->propal->creer)
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=modif">'.$langs->trans('Modify').'</a></div>';
|
||||
}
|
||||
|
||||
// ReOpen
|
||||
if (($object->statut == 2 || $object->statut == 3) && $user->rights->propal->cloturer)
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=reopen'.(empty($conf->global->MAIN_JUMP_TAG)?'':'#reopen').'"';
|
||||
print '>'.$langs->trans('ReOpen').'</a></div>';
|
||||
}
|
||||
|
||||
// Send
|
||||
if ($object->statut == 1 || $object->statut == 2)
|
||||
{
|
||||
if (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->propal->propal_advance->send)
|
||||
// Validate
|
||||
if ($object->statut == 0 && $object->total_ttc >= 0 && count($object->lines) > 0 && $user->rights->propal->valider)
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&mode=init">'.$langs->trans('SendByMail').'</a></div>';
|
||||
if (count($object->lines) > 0) print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=validate">'.$langs->trans('Validate').'</a></div>';
|
||||
//else print '<a class="butActionRefused" href="#">'.$langs->trans('Validate').'</a>';
|
||||
}
|
||||
else print '<div class="inline-block divButAction"><a class="butActionRefused" href="#">'.$langs->trans('SendByMail').'</a></div>';
|
||||
}
|
||||
|
||||
// Create an order
|
||||
if (! empty($conf->commande->enabled) && $object->statut == 2 && $user->societe_id == 0)
|
||||
{
|
||||
if ($user->rights->commande->creer)
|
||||
// Create event
|
||||
if ($conf->agenda->enabled && ! empty($conf->global->MAIN_ADD_EVENT_ON_ELEMENT_CARD)) // Add hidden condition because this is not a "workflow" action so should appears somewhere else on page.
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/commande/fiche.php?action=create&origin='.$object->element.'&originid='.$object->id.'&socid='.$object->socid.'">'.$langs->trans("AddOrder").'</a></div>';
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/comm/action/fiche.php?action=create&origin='.$object->element.'&originid='.$object->id.'&socid='.$object->socid.'">'.$langs->trans("AddAction").'</a>';
|
||||
}
|
||||
}
|
||||
|
||||
// Create contract
|
||||
if ($conf->contrat->enabled && $object->statut == 2 && $user->societe_id == 0)
|
||||
{
|
||||
$langs->load("contracts");
|
||||
|
||||
if ($user->rights->contrat->creer)
|
||||
// Edit
|
||||
if ($object->statut == 1 && $user->rights->propal->creer)
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/contrat/fiche.php?action=create&origin='.$object->element.'&originid='.$object->id.'&socid='.$object->socid.'">'.$langs->trans('AddContract').'</a></div>';
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=modif">'.$langs->trans('Modify').'</a></div>';
|
||||
}
|
||||
}
|
||||
|
||||
// Create an invoice and classify billed
|
||||
if ($object->statut == 2 && $user->societe_id == 0)
|
||||
{
|
||||
if (! empty($conf->facture->enabled) && $user->rights->facture->creer)
|
||||
|
||||
// ReOpen
|
||||
if (($object->statut == 2 || $object->statut == 3) && $user->rights->propal->cloturer)
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/compta/facture.php?action=create&origin='.$object->element.'&originid='.$object->id.'&socid='.$object->socid.'">'.$langs->trans("AddBill").'</a></div>';
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=reopen'.(empty($conf->global->MAIN_JUMP_TAG)?'':'#reopen').'"';
|
||||
print '>'.$langs->trans('ReOpen').'</a></div>';
|
||||
}
|
||||
|
||||
$arraypropal=$object->getInvoiceArrayList();
|
||||
if (is_array($arraypropal) && count($arraypropal) > 0)
|
||||
|
||||
// Send
|
||||
if ($object->statut == 1 || $object->statut == 2)
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=classifybilled&socid='.$object->socid.'">'.$langs->trans("ClassifyBilled").'</a></div>';
|
||||
if (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->propal->propal_advance->send)
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&mode=init">'.$langs->trans('SendByMail').'</a></div>';
|
||||
}
|
||||
else print '<div class="inline-block divButAction"><a class="butActionRefused" href="#">'.$langs->trans('SendByMail').'</a></div>';
|
||||
}
|
||||
|
||||
// Create an order
|
||||
if (! empty($conf->commande->enabled) && $object->statut == 2 && $user->societe_id == 0)
|
||||
{
|
||||
if ($user->rights->commande->creer)
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/commande/fiche.php?action=create&origin='.$object->element.'&originid='.$object->id.'&socid='.$object->socid.'">'.$langs->trans("AddOrder").'</a></div>';
|
||||
}
|
||||
}
|
||||
|
||||
// Create contract
|
||||
if ($conf->contrat->enabled && $object->statut == 2 && $user->societe_id == 0)
|
||||
{
|
||||
$langs->load("contracts");
|
||||
|
||||
if ($user->rights->contrat->creer)
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/contrat/fiche.php?action=create&origin='.$object->element.'&originid='.$object->id.'&socid='.$object->socid.'">'.$langs->trans('AddContract').'</a></div>';
|
||||
}
|
||||
}
|
||||
|
||||
// Create an invoice and classify billed
|
||||
if ($object->statut == 2 && $user->societe_id == 0)
|
||||
{
|
||||
if (! empty($conf->facture->enabled) && $user->rights->facture->creer)
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/compta/facture.php?action=create&origin='.$object->element.'&originid='.$object->id.'&socid='.$object->socid.'">'.$langs->trans("AddBill").'</a></div>';
|
||||
}
|
||||
|
||||
$arraypropal=$object->getInvoiceArrayList();
|
||||
if (is_array($arraypropal) && count($arraypropal) > 0)
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=classifybilled&socid='.$object->socid.'">'.$langs->trans("ClassifyBilled").'</a></div>';
|
||||
}
|
||||
}
|
||||
|
||||
// Close
|
||||
if ($object->statut == 1 && $user->rights->propal->cloturer)
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=statut'.(empty($conf->global->MAIN_JUMP_TAG)?'':'#close').'"';
|
||||
print '>'.$langs->trans('Close').'</a></div>';
|
||||
}
|
||||
|
||||
// Clone
|
||||
if ($user->rights->propal->creer)
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&socid='.$object->socid.'&action=clone&object='.$object->element.'">'.$langs->trans("ToClone").'</a></div>';
|
||||
}
|
||||
|
||||
// Delete
|
||||
if ($user->rights->propal->supprimer)
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete"';
|
||||
print '>'.$langs->trans('Delete').'</a></div>';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Close
|
||||
if ($object->statut == 1 && $user->rights->propal->cloturer)
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=statut'.(empty($conf->global->MAIN_JUMP_TAG)?'':'#close').'"';
|
||||
print '>'.$langs->trans('Close').'</a></div>';
|
||||
}
|
||||
|
||||
// Clone
|
||||
if ($user->rights->propal->creer)
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&socid='.$object->socid.'&action=clone&object='.$object->element.'">'.$langs->trans("ToClone").'</a></div>';
|
||||
}
|
||||
|
||||
// Delete
|
||||
if ($user->rights->propal->supprimer)
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete"';
|
||||
print '>'.$langs->trans('Delete').'</a></div>';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
print '</div>';
|
||||
}
|
||||
print "<br>\n";
|
||||
|
|
|
|||
|
|
@ -2392,12 +2392,14 @@ else
|
|||
/*
|
||||
* Boutons actions
|
||||
*/
|
||||
if ($action != 'presend')
|
||||
if ($action != 'presend' && $action != 'editline')
|
||||
{
|
||||
if ($user->societe_id == 0 && $action <> 'editline')
|
||||
{
|
||||
print '<div class="tabsAction">';
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('addMoreActionsButtons',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
||||
if (empty($reshook))
|
||||
{
|
||||
// Valid
|
||||
if ($object->statut == 0 && $object->total_ttc >= 0 && $numlines > 0 && $user->rights->commande->valider)
|
||||
{
|
||||
|
|
@ -2470,7 +2472,7 @@ else
|
|||
}
|
||||
|
||||
// Reopen a closed order
|
||||
if ($object->statut == 3)
|
||||
if ($object->statut == 3 && $user->rights->commande->creer)
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=reopen">'.$langs->trans('ReOpen').'</a></div>';
|
||||
}
|
||||
|
|
@ -2519,9 +2521,8 @@ else
|
|||
print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.$langs->trans("ShippingExist").'">'.$langs->trans("Delete").'</a></div>';
|
||||
}
|
||||
}
|
||||
|
||||
print '</div>';
|
||||
}
|
||||
print '</div>';
|
||||
}
|
||||
print '<br>';
|
||||
|
||||
|
|
|
|||
|
|
@ -3547,12 +3547,14 @@ else if ($id > 0 || ! empty($ref))
|
|||
|
||||
// Boutons actions
|
||||
|
||||
if ($action != 'prerelance' && $action != 'presend')
|
||||
if ($action != 'prerelance' && $action != 'presend' && $action != 'valid' && $action != 'editline')
|
||||
{
|
||||
if ($user->societe_id == 0 && $action <> 'valid' && $action <> 'editline')
|
||||
{
|
||||
print '<div class="tabsAction">';
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('addMoreActionsButtons',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
||||
if (empty($reshook))
|
||||
{
|
||||
// Editer une facture deja validee, sans paiement effectue et pas exporte en compta
|
||||
if ($object->statut == 1)
|
||||
{
|
||||
|
|
@ -3580,7 +3582,7 @@ else if ($id > 0 || ! empty($ref))
|
|||
}
|
||||
|
||||
// Reopen a standard paid invoice
|
||||
if (($object->type == 0 || $object->type == 1) && ($object->statut == 2 || $object->statut == 3)) // A paid invoice (partially or completely)
|
||||
if (($object->type == 0 || $object->type == 1) && ($object->statut == 2 || $object->statut == 3) && $user->rights->facture->creer) // A paid invoice (partially or completely)
|
||||
{
|
||||
if (! $objectidnext && $object->close_code != 'replaced') // Not replaced by another invoice
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1026,11 +1026,13 @@ else
|
|||
print "</div>";
|
||||
|
||||
// Barre d'actions
|
||||
if (! $user->societe_id)
|
||||
{
|
||||
print '<div class="tabsAction">';
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
if ($user->rights->societe->contact->creer)
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('addMoreActionsButtons',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
||||
if (empty($reshook))
|
||||
{
|
||||
if ($user->rights->societe->contact->creer)
|
||||
{
|
||||
print '<a class="butAction" href="fiche.php?id='.$object->id.'&action=edit">'.$langs->trans('Modify').'</a>';
|
||||
}
|
||||
|
|
@ -1054,10 +1056,10 @@ else
|
|||
{
|
||||
print '<a class="butActionDelete" href="'.$_SERVER['PHP_SELF'].'?action=disable&id='.$object->id.'">'.$langs->trans("DisableUser").'</a>';
|
||||
}
|
||||
|
||||
print "</div><br>";
|
||||
}
|
||||
|
||||
|
||||
print "</div><br>";
|
||||
|
||||
print load_fiche_titre($langs->trans("TasksHistoryForThisContact"),'','');
|
||||
|
||||
print show_actions_todo($conf,$langs,$db,$objsoc,$object);
|
||||
|
|
|
|||
|
|
@ -134,6 +134,7 @@ class HookManager
|
|||
if (in_array(
|
||||
$method,
|
||||
array(
|
||||
'addMoreActionsButtons',
|
||||
'addStatisticLine',
|
||||
'doActions',
|
||||
'formObjectOptions',
|
||||
|
|
@ -164,7 +165,7 @@ class HookManager
|
|||
// test to avoid to run twice a hook, when a module implements several active contexts
|
||||
if (in_array($module,$modulealreadyexecuted)) continue;
|
||||
$modulealreadyexecuted[$module]=$module;
|
||||
// Hooks that return int (doActions, formObjectOptions, pdf_writelinedesc, paymentsupplierinvoices)
|
||||
// Hooks that must return int (hooks with type 'addreplace')
|
||||
if ($hooktype == 'addreplace')
|
||||
{
|
||||
$resaction += $actionclassinstance->$method($parameters, $object, $action, $this); // $object and $action can be changed by method ($object->id during creation for example or $action to go back to other action for example)
|
||||
|
|
|
|||
|
|
@ -1285,49 +1285,54 @@ if (($action == 'clone' && (empty($conf->use_javascript_ajax) || ! empty($conf->
|
|||
|
||||
print "\n".'<div class="tabsAction">'."\n";
|
||||
|
||||
if ($action == '' || $action == 'view')
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('addMoreActionsButtons',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
||||
if (empty($reshook))
|
||||
{
|
||||
if ($user->rights->produit->creer || $user->rights->service->creer)
|
||||
{
|
||||
if (! isset($object->no_button_edit) || $object->no_button_edit <> 1) print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&id='.$object->id.'">'.$langs->trans("Modify").'</a></div>';
|
||||
|
||||
if (! isset($object->no_button_copy) || $object->no_button_copy <> 1)
|
||||
{
|
||||
if (! empty($conf->use_javascript_ajax) && empty($conf->dol_use_jmobile))
|
||||
{
|
||||
print '<div class="inline-block divButAction"><span id="action-clone" class="butAction">'.$langs->trans('ToClone').'</span></div>'."\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=clone&id='.$object->id.'">'.$langs->trans("ToClone").'</a></div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
$object_is_used = $object->isObjectUsed($object->id);
|
||||
|
||||
if (($object->type == 0 && $user->rights->produit->supprimer)
|
||||
|| ($object->type == 1 && $user->rights->service->supprimer))
|
||||
{
|
||||
if (empty($object_is_used) && (! isset($object->no_button_delete) || $object->no_button_delete <> 1))
|
||||
{
|
||||
if (! empty($conf->use_javascript_ajax) && empty($conf->dol_use_jmobile))
|
||||
{
|
||||
print '<div class="inline-block divButAction"><span id="action-delete" class="butActionDelete">'.$langs->trans('Delete').'</span></div>'."\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?action=delete&id='.$object->id.'">'.$langs->trans("Delete").'</a></div>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.$langs->trans("ProductIsUsed").'">'.$langs->trans("Delete").'</a></div>';
|
||||
}
|
||||
}
|
||||
else
|
||||
if ($action == '' || $action == 'view')
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.$langs->trans("NotEnoughPermissions").'">'.$langs->trans("Delete").'</a></div>';
|
||||
}
|
||||
if ($user->rights->produit->creer || $user->rights->service->creer)
|
||||
{
|
||||
if (! isset($object->no_button_edit) || $object->no_button_edit <> 1) print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&id='.$object->id.'">'.$langs->trans("Modify").'</a></div>';
|
||||
|
||||
if (! isset($object->no_button_copy) || $object->no_button_copy <> 1)
|
||||
{
|
||||
if (! empty($conf->use_javascript_ajax) && empty($conf->dol_use_jmobile))
|
||||
{
|
||||
print '<div class="inline-block divButAction"><span id="action-clone" class="butAction">'.$langs->trans('ToClone').'</span></div>'."\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=clone&id='.$object->id.'">'.$langs->trans("ToClone").'</a></div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
$object_is_used = $object->isObjectUsed($object->id);
|
||||
|
||||
if (($object->type == 0 && $user->rights->produit->supprimer)
|
||||
|| ($object->type == 1 && $user->rights->service->supprimer))
|
||||
{
|
||||
if (empty($object_is_used) && (! isset($object->no_button_delete) || $object->no_button_delete <> 1))
|
||||
{
|
||||
if (! empty($conf->use_javascript_ajax) && empty($conf->dol_use_jmobile))
|
||||
{
|
||||
print '<div class="inline-block divButAction"><span id="action-delete" class="butActionDelete">'.$langs->trans('Delete').'</span></div>'."\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?action=delete&id='.$object->id.'">'.$langs->trans("Delete").'</a></div>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.$langs->trans("ProductIsUsed").'">'.$langs->trans("Delete").'</a></div>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.$langs->trans("NotEnoughPermissions").'">'.$langs->trans("Delete").'</a></div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
print "\n</div><br>\n";
|
||||
|
|
|
|||
|
|
@ -47,6 +47,8 @@ $mesg = '';
|
|||
// Security check
|
||||
$result=restrictedArea($user,'stock');
|
||||
|
||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||
$hookmanager->initHooks(array('warehousecard'));
|
||||
|
||||
|
||||
/*
|
||||
|
|
@ -336,19 +338,24 @@ else
|
|||
|
||||
print "<div class=\"tabsAction\">\n";
|
||||
|
||||
if ($action == '')
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('addMoreActionsButtons',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
||||
if (empty($reshook))
|
||||
{
|
||||
if ($user->rights->stock->creer)
|
||||
print "<a class=\"butAction\" href=\"fiche.php?action=edit&id=".$object->id."\">".$langs->trans("Modify")."</a>";
|
||||
else
|
||||
print "<a class=\"butActionRefused\" href=\"#\">".$langs->trans("Modify")."</a>";
|
||||
|
||||
if ($user->rights->stock->supprimer)
|
||||
print "<a class=\"butActionDelete\" href=\"fiche.php?action=delete&id=".$object->id."\">".$langs->trans("Delete")."</a>";
|
||||
else
|
||||
print "<a class=\"butActionRefused\" href=\"#\">".$langs->trans("Delete")."</a>";
|
||||
if (empty($action))
|
||||
{
|
||||
if ($user->rights->stock->creer)
|
||||
print "<a class=\"butAction\" href=\"fiche.php?action=edit&id=".$object->id."\">".$langs->trans("Modify")."</a>";
|
||||
else
|
||||
print "<a class=\"butActionRefused\" href=\"#\">".$langs->trans("Modify")."</a>";
|
||||
|
||||
if ($user->rights->stock->supprimer)
|
||||
print "<a class=\"butActionDelete\" href=\"fiche.php?action=delete&id=".$object->id."\">".$langs->trans("Delete")."</a>";
|
||||
else
|
||||
print "<a class=\"butActionRefused\" href=\"#\">".$langs->trans("Delete")."</a>";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
print "</div>";
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1818,34 +1818,39 @@ else
|
|||
*/
|
||||
print '<div class="tabsAction">'."\n";
|
||||
|
||||
if (! empty($object->email))
|
||||
{
|
||||
$langs->load("mails");
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER['PHP_SELF'].'?socid='.$object->id.'&action=presend&mode=init">'.$langs->trans('SendMail').'</a></div>';
|
||||
}
|
||||
else
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('addMoreActionsButtons',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
||||
if (empty($reshook))
|
||||
{
|
||||
$langs->load("mails");
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("NoEmail")).'">'.$langs->trans('SendMail').'</a></div>';
|
||||
}
|
||||
|
||||
if ($user->rights->societe->creer)
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?socid='.$object->id.'&action=edit">'.$langs->trans("Modify").'</a></div>'."\n";
|
||||
}
|
||||
|
||||
if ($user->rights->societe->supprimer)
|
||||
{
|
||||
if ($conf->use_javascript_ajax && empty($conf->dol_use_jmobile)) // We can(t use preloaded confirm form with jmobile
|
||||
{
|
||||
print '<div class="inline-block divButAction"><span id="action-delete" class="butActionDelete">'.$langs->trans('Delete').'</span></div>'."\n";
|
||||
}
|
||||
else
|
||||
if (! empty($object->email))
|
||||
{
|
||||
$langs->load("mails");
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER['PHP_SELF'].'?socid='.$object->id.'&action=presend&mode=init">'.$langs->trans('SendMail').'</a></div>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?socid='.$object->id.'&action=delete">'.$langs->trans('Delete').'</a></div>'."\n";
|
||||
}
|
||||
}
|
||||
|
||||
$langs->load("mails");
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("NoEmail")).'">'.$langs->trans('SendMail').'</a></div>';
|
||||
}
|
||||
|
||||
if ($user->rights->societe->creer)
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?socid='.$object->id.'&action=edit">'.$langs->trans("Modify").'</a></div>'."\n";
|
||||
}
|
||||
|
||||
if ($user->rights->societe->supprimer)
|
||||
{
|
||||
if ($conf->use_javascript_ajax && empty($conf->dol_use_jmobile)) // We can(t use preloaded confirm form with jmobile
|
||||
{
|
||||
print '<div class="inline-block divButAction"><span id="action-delete" class="butActionDelete">'.$langs->trans('Delete').'</span></div>'."\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?socid='.$object->id.'&action=delete">'.$langs->trans('Delete').'</a></div>'."\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
print '</div>'."\n";
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user