From 520facd55e6cae0fba91af3dfdc468f5f0b4aecc Mon Sep 17 00:00:00 2001 From: BENKE Charlie Date: Wed, 27 Apr 2016 22:17:45 +0200 Subject: [PATCH 1/3] Missing addMoreActionsButtons hook --- htdocs/projet/card.php | 275 +++++++++++++++++++++-------------------- 1 file changed, 140 insertions(+), 135 deletions(-) diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index 5ef9b0e1ce4..c489910064d 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -852,142 +852,147 @@ else * Boutons actions */ print '
'; - - 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)) { - // Modify - if ($object->statut != 2 && $user->rights->projet->creer) - { - if ($userWrite > 0) - { - print ''; - } - else - { - print ''; - } - } - - // Validate - if ($object->statut == 0 && $user->rights->projet->creer) - { - if ($userWrite > 0) - { - print ''; - } - else - { - print ''; - } - } - - // Close - if (($object->statut == 0 || $object->statut == 1) && $user->rights->projet->creer) - { - if ($userWrite > 0) - { - print ''; - } - else - { - print ''; - } - } - - // Reopen - if ($object->statut == 2 && $user->rights->projet->creer) - { - if ($userWrite > 0) - { - print ''; - } - else - { - print ''; - } - } - - // Add button to create objects from project - if (! empty($conf->global->PROJECT_SHOW_CREATE_OBJECT_BUTTON)) - { - if (! empty($conf->propal->enabled) && $user->rights->propal->creer) - { - $langs->load("propal"); - print ''; - } - if (! empty($conf->commande->enabled) && $user->rights->commande->creer) - { - $langs->load("orders"); - print ''; - } - if (! empty($conf->facture->enabled) && $user->rights->facture->creer) - { - $langs->load("bills"); - print ''; - } - if (! empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposal->creer) - { - $langs->load("supplier_proposal"); - print ''; - } - if (! empty($conf->supplier_order->enabled) && $user->rights->fournisseur->commande->creer) - { - $langs->load("suppliers"); - print ''; - } - if (! empty($conf->supplier_invoice->enabled) && $user->rights->fournisseur->facture->creer) - { - $langs->load("suppliers"); - print ''; - } - if (! empty($conf->ficheinter->enabled) && $user->rights->ficheinter->creer) - { - $langs->load("interventions"); - print ''; - } - if (! empty($conf->contrat->enabled) && $user->rights->contrat->creer) - { - $langs->load("contracts"); - print ''; - } - if (! empty($conf->expensereport->enabled) && $user->rights->expensereport->creer) - { - $langs->load("expensereports"); - $langs->load("trips"); - print ''; - } - if (! empty($conf->don->enabled) && $user->rights->don->creer) - { - $langs->load("donations"); - print ''; - } - } - - // Clone - if ($user->rights->projet->creer) - { - if ($userWrite > 0) - { - print ''; - } - else - { - print ''; - } - } - - // Delete - if ($user->rights->projet->supprimer) - { - if ($userDelete > 0) - { - print ''; - } - else - { - print ''; - } - } + if ($action != "edit" ) + { + // Modify + if ($object->statut != 2 && $user->rights->projet->creer) + { + if ($userWrite > 0) + { + print ''; + } + else + { + print ''; + } + } + + // Validate + if ($object->statut == 0 && $user->rights->projet->creer) + { + if ($userWrite > 0) + { + print ''; + } + else + { + print ''; + } + } + + // Close + if (($object->statut == 0 || $object->statut == 1) && $user->rights->projet->creer) + { + if ($userWrite > 0) + { + print ''; + } + else + { + print ''; + } + } + + // Reopen + if ($object->statut == 2 && $user->rights->projet->creer) + { + if ($userWrite > 0) + { + print ''; + } + else + { + print ''; + } + } + + // Add button to create objects from project + if (! empty($conf->global->PROJECT_SHOW_CREATE_OBJECT_BUTTON)) + { + if (! empty($conf->propal->enabled) && $user->rights->propal->creer) + { + $langs->load("propal"); + print ''; + } + if (! empty($conf->commande->enabled) && $user->rights->commande->creer) + { + $langs->load("orders"); + print ''; + } + if (! empty($conf->facture->enabled) && $user->rights->facture->creer) + { + $langs->load("bills"); + print ''; + } + if (! empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposal->creer) + { + $langs->load("supplier_proposal"); + print ''; + } + if (! empty($conf->supplier_order->enabled) && $user->rights->fournisseur->commande->creer) + { + $langs->load("suppliers"); + print ''; + } + if (! empty($conf->supplier_invoice->enabled) && $user->rights->fournisseur->facture->creer) + { + $langs->load("suppliers"); + print ''; + } + if (! empty($conf->ficheinter->enabled) && $user->rights->ficheinter->creer) + { + $langs->load("interventions"); + print ''; + } + if (! empty($conf->contrat->enabled) && $user->rights->contrat->creer) + { + $langs->load("contracts"); + print ''; + } + if (! empty($conf->expensereport->enabled) && $user->rights->expensereport->creer) + { + $langs->load("expensereports"); + $langs->load("trips"); + print ''; + } + if (! empty($conf->don->enabled) && $user->rights->don->creer) + { + $langs->load("donations"); + print ''; + } + } + + // Clone + if ($user->rights->projet->creer) + { + if ($userWrite > 0) + { + print ''; + } + else + { + print ''; + } + } + + // Delete + if ($user->rights->projet->supprimer) + { + if ($userDelete > 0) + { + print ''; + } + else + { + print ''; + } + } + } } print "
"; From 8a63298102312df88124431c05f6cd0149b254b1 Mon Sep 17 00:00:00 2001 From: BENKE Charlie Date: Wed, 27 Apr 2016 22:19:38 +0200 Subject: [PATCH 2/3] Missing addMoreActionsButtons hook --- htdocs/projet/tasks/task.php | 97 +++++++++++++++++++----------------- 1 file changed, 51 insertions(+), 46 deletions(-) diff --git a/htdocs/projet/tasks/task.php b/htdocs/projet/tasks/task.php index 1a3b1921713..e1bfbb335da 100644 --- a/htdocs/projet/tasks/task.php +++ b/htdocs/projet/tasks/task.php @@ -484,55 +484,60 @@ if ($id > 0 || ! empty($ref)) dol_fiche_end(); } - - 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)) { - /* - * Actions - */ - print '
'; - - // Modify - if ($user->rights->projet->creer) + if ($action != 'edit') { - print ''.$langs->trans('Modify').''; + /* + * Actions + */ + print '
'; + + // Modify + if ($user->rights->projet->creer) + { + print ''.$langs->trans('Modify').''; + } + else + { + print ''.$langs->trans('Modify').''; + } + + // Delete + if ($user->rights->projet->supprimer && ! $object->hasChildren()) + { + print ''.$langs->trans('Delete').''; + } + else + { + print ''.$langs->trans('Delete').''; + } + + print '
'; + + print '
'; + print ''; // ancre + + /* + * Documents generes + */ + $filename=dol_sanitizeFileName($projectstatic->ref). "/". dol_sanitizeFileName($object->ref); + $filedir=$conf->projet->dir_output . "/" . dol_sanitizeFileName($projectstatic->ref). "/" .dol_sanitizeFileName($object->ref); + $urlsource=$_SERVER["PHP_SELF"]."?id=".$object->id; + $genallowed=($user->rights->projet->lire); + $delallowed=($user->rights->projet->creer); + + $var=true; + + $somethingshown=$formfile->show_documents('project_task',$filename,$filedir,$urlsource,$genallowed,$delallowed,$object->modelpdf); + + + + print '
'; } - else - { - print ''.$langs->trans('Modify').''; - } - - // Delete - if ($user->rights->projet->supprimer && ! $object->hasChildren()) - { - print ''.$langs->trans('Delete').''; - } - else - { - print ''.$langs->trans('Delete').''; - } - - print '
'; - - print '
'; - print ''; // ancre - - /* - * Documents generes - */ - $filename=dol_sanitizeFileName($projectstatic->ref). "/". dol_sanitizeFileName($object->ref); - $filedir=$conf->projet->dir_output . "/" . dol_sanitizeFileName($projectstatic->ref). "/" .dol_sanitizeFileName($object->ref); - $urlsource=$_SERVER["PHP_SELF"]."?id=".$object->id; - $genallowed=($user->rights->projet->lire); - $delallowed=($user->rights->projet->creer); - - $var=true; - - $somethingshown=$formfile->show_documents('project_task',$filename,$filedir,$urlsource,$genallowed,$delallowed,$object->modelpdf); - - - - print '
'; } } } From 379a621b1f85473bd740f26c565f499980ec0a66 Mon Sep 17 00:00:00 2001 From: BENKE Charlie Date: Sat, 30 Apr 2016 01:01:32 +0200 Subject: [PATCH 3/3] soory it's a mistake --- htdocs/projet/tasks/task.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/htdocs/projet/tasks/task.php b/htdocs/projet/tasks/task.php index e1bfbb335da..a65ca9a8f0d 100644 --- a/htdocs/projet/tasks/task.php +++ b/htdocs/projet/tasks/task.php @@ -484,12 +484,13 @@ if ($id > 0 || ! empty($ref)) dol_fiche_end(); } - $parameters = array(); - $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been - // modified by hook - if (empty($reshook)) + + if ($action != 'edit') { - 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)) { /* * Actions