From 003df66f6a8a14dfa90d33f6be49a43258aca995 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 22 Oct 2022 02:32:43 +0200 Subject: [PATCH] Clean code --- htdocs/comm/action/card.php | 29 +++++++------------- htdocs/comm/action/document.php | 26 +++++++++++------- htdocs/comm/action/info.php | 25 +++++++++++------- htdocs/comm/propal/card.php | 4 +-- htdocs/comm/propal/contact.php | 2 +- htdocs/comm/propal/document.php | 2 +- htdocs/comm/propal/info.php | 2 +- htdocs/comm/propal/note.php | 2 +- htdocs/commande/contact.php | 2 +- htdocs/commande/document.php | 2 +- htdocs/commande/info.php | 2 +- htdocs/commande/note.php | 2 +- htdocs/compta/facture/contact.php | 2 +- htdocs/compta/facture/document.php | 2 +- htdocs/compta/facture/info.php | 2 +- htdocs/compta/facture/note.php | 2 +- htdocs/compta/facture/prelevement.php | 2 +- htdocs/contrat/agenda.php | 2 +- htdocs/contrat/contact.php | 2 +- htdocs/contrat/document.php | 2 +- htdocs/contrat/note.php | 2 +- htdocs/core/lib/functions.lib.php | 2 +- htdocs/expensereport/card.php | 38 --------------------------- htdocs/fourn/commande/contact.php | 2 +- htdocs/fourn/commande/dispatch.php | 2 +- htdocs/fourn/commande/document.php | 2 +- htdocs/fourn/commande/info.php | 2 +- htdocs/fourn/commande/note.php | 2 +- htdocs/fourn/facture/contact.php | 2 +- htdocs/fourn/facture/document.php | 2 +- htdocs/fourn/facture/info.php | 2 +- htdocs/fourn/facture/note.php | 2 +- htdocs/resource/element_resource.php | 26 +++++++++++------- 33 files changed, 87 insertions(+), 115 deletions(-) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 8b42e6df6e2..27d3c049c64 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -151,6 +151,8 @@ if ($user->socid && $socid) { $result = restrictedArea($user, 'societe', $socid); } +$usercancreate = $user->rights->agenda->allactions->create || (($object->authorid == $user->id || $object->userownerid == $user->id) && $user->rights->agenda->myactions->create); + /* * Actions @@ -2152,34 +2154,21 @@ if ($id > 0) { // Project if (isModEnabled('project')) { $langs->load("projects"); - //$morehtmlref.='
'.$langs->trans('Project') . ' '; - $morehtmlref .= $langs->trans('Project').' '; - if ($user->rights->agenda->allactions->create || - (($object->authorid == $user->id || $object->userownerid == $user->id) && $user->rights->agenda->myactions->create)) { + //$morehtmlref .= '
'; + if ($usercancreate) { + $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); if ($action != 'classify') { - $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' : '; - } - if ($action == 'classify') { - //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); - $morehtmlref .= '
'; - $morehtmlref .= ''; - $morehtmlref .= ''; - $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); - $morehtmlref .= ''; - $morehtmlref .= '
'; - } else { - $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, ($action == 'classify' ? 1 : 0), 0, 1, ''); } else { if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); - $morehtmlref .= ' : '.$proj->getNomUrl(1); + $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.$proj->title; + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title); } - } else { - $morehtmlref .= ''; } } } diff --git a/htdocs/comm/action/document.php b/htdocs/comm/action/document.php index 9a4a4e6a869..f80476c2f9a 100644 --- a/htdocs/comm/action/document.php +++ b/htdocs/comm/action/document.php @@ -89,7 +89,8 @@ if ($user->socid && $socid) { $result = restrictedArea($user, 'societe', $socid); } -$permissiontoadd = $user->rights->agenda->myactions->read; // Used by the include of actions_addupdatedelete.inc.php and actions_linkedfiles.inc.php +$usercancreate = $user->rights->agenda->allactions->create || (($object->authorid == $user->id || $object->userownerid == $user->id) && $user->rights->agenda->myactions->create); +$permissiontoadd = $usercancreate; /* @@ -162,17 +163,22 @@ if ($object->id > 0) { // Project if (isModEnabled('project')) { $langs->load("projects"); - //$morehtmlref.='
'.$langs->trans('Project') . ' '; - $morehtmlref .= $langs->trans('Project').': '; - if (!empty($object->fk_project)) { - $proj = new Project($db); - $proj->fetch($object->fk_project); - $morehtmlref .= ' : '.$proj->getNomUrl(1); - if ($proj->title) { - $morehtmlref .= ' - '.$proj->title; + //$morehtmlref .= '
'; + if (0) { + $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); + if ($action != 'classify') { + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, ($action == 'classify' ? 1 : 0), 0, 1, ''); } else { - $morehtmlref .= ''; + if (!empty($object->fk_project)) { + $proj = new Project($db); + $proj->fetch($object->fk_project); + $morehtmlref .= $proj->getNomUrl(1); + if ($proj->title) { + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title); + } + } } } $morehtmlref .= ''; diff --git a/htdocs/comm/action/info.php b/htdocs/comm/action/info.php index 807a8e6f412..e009c9fccf7 100644 --- a/htdocs/comm/action/info.php +++ b/htdocs/comm/action/info.php @@ -50,6 +50,8 @@ if ($user->socid && $socid) { $result = restrictedArea($user, 'societe', $socid); } +$usercancreate = $user->rights->agenda->allactions->create || (($object->authorid == $user->id || $object->userownerid == $user->id) && $user->rights->agenda->myactions->create); + /* * View @@ -89,17 +91,22 @@ $morehtmlref = '
'; // Project if (isModEnabled('project')) { $langs->load("projects"); - //$morehtmlref.='
'.$langs->trans('Project') . ' '; - $morehtmlref .= $langs->trans('Project').': '; - if (!empty($object->fk_project)) { - $proj = new Project($db); - $proj->fetch($object->fk_project); - $morehtmlref .= ' : '.$proj->getNomUrl(1); - if ($proj->title) { - $morehtmlref .= ' - '.$proj->title; + //$morehtmlref .= '
'; + if (0) { + $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); + if ($action != 'classify') { + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, ($action == 'classify' ? 1 : 0), 0, 1, ''); } else { - $morehtmlref .= ''; + if (!empty($object->fk_project)) { + $proj = new Project($db); + $proj->fetch($object->fk_project); + $morehtmlref .= $proj->getNomUrl(1); + if ($proj->title) { + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title); + } + } } } $morehtmlref .= '
'; diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 87906426b44..9180be4f99b 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -2332,7 +2332,7 @@ if ($action == 'create') { print '
'; print '
'; - print ''; + print '
'; // Link for thirdparty discounts if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { @@ -2392,7 +2392,7 @@ if ($action == 'create') { // Date end proposal print ''; print '
'; - print '
'; + print ''; if ($action != 'editecheance' && $usercancreate && $caneditfield) { diff --git a/htdocs/comm/propal/contact.php b/htdocs/comm/propal/contact.php index f1dff7991ef..835dcc70fd0 100644 --- a/htdocs/comm/propal/contact.php +++ b/htdocs/comm/propal/contact.php @@ -144,7 +144,7 @@ if ($object->id > 0) { if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'; - if ($usercancreate) { + if (0) { $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); if ($action != 'classify') { $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; diff --git a/htdocs/comm/propal/document.php b/htdocs/comm/propal/document.php index 569a9d2494e..799539d97b1 100644 --- a/htdocs/comm/propal/document.php +++ b/htdocs/comm/propal/document.php @@ -142,7 +142,7 @@ if ($object->id > 0) { if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'; - if ($usercancreate) { + if (0) { $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); if ($action != 'classify') { $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; diff --git a/htdocs/comm/propal/info.php b/htdocs/comm/propal/info.php index ed15c4d7615..26a65f9a66e 100644 --- a/htdocs/comm/propal/info.php +++ b/htdocs/comm/propal/info.php @@ -89,7 +89,7 @@ $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1); if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'; - if ($usercancreate) { + if (0) { $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); if ($action != 'classify') { $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; diff --git a/htdocs/comm/propal/note.php b/htdocs/comm/propal/note.php index 272ef300db2..64fe59edea5 100644 --- a/htdocs/comm/propal/note.php +++ b/htdocs/comm/propal/note.php @@ -114,7 +114,7 @@ if ($object->id > 0) { if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'; - if ($usercancreate) { + if (0) { $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); if ($action != 'classify') { $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; diff --git a/htdocs/commande/contact.php b/htdocs/commande/contact.php index 7637d1e62ba..aa61426e435 100644 --- a/htdocs/commande/contact.php +++ b/htdocs/commande/contact.php @@ -138,7 +138,7 @@ if ($id > 0 || !empty($ref)) { if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'; - if ($usercancreate) { + if (0) { $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); if ($action != 'classify') { $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; diff --git a/htdocs/commande/document.php b/htdocs/commande/document.php index 1cda0476355..ef1e1ce1697 100644 --- a/htdocs/commande/document.php +++ b/htdocs/commande/document.php @@ -135,7 +135,7 @@ if ($id > 0 || !empty($ref)) { if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'; - if ($usercancreate) { + if (0) { $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); if ($action != 'classify') { $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; diff --git a/htdocs/commande/info.php b/htdocs/commande/info.php index 9b091c47397..e319cb95d36 100644 --- a/htdocs/commande/info.php +++ b/htdocs/commande/info.php @@ -89,7 +89,7 @@ $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1); if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'; - if ($usercancreate) { + if (0) { $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); if ($action != 'classify') { $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; diff --git a/htdocs/commande/note.php b/htdocs/commande/note.php index 7ab5fa96310..946902e1a11 100644 --- a/htdocs/commande/note.php +++ b/htdocs/commande/note.php @@ -108,7 +108,7 @@ if ($id > 0 || !empty($ref)) { if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'; - if ($usercancreate) { + if (0) { $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); if ($action != 'classify') { $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; diff --git a/htdocs/compta/facture/contact.php b/htdocs/compta/facture/contact.php index 0bc058a05d6..7b7dd41ef7e 100644 --- a/htdocs/compta/facture/contact.php +++ b/htdocs/compta/facture/contact.php @@ -143,7 +143,7 @@ if ($id > 0 || !empty($ref)) { if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'; - if ($usercancreate) { + if (0) { $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); if ($action != 'classify') { $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; diff --git a/htdocs/compta/facture/document.php b/htdocs/compta/facture/document.php index a38fd572e09..c4b11cea186 100644 --- a/htdocs/compta/facture/document.php +++ b/htdocs/compta/facture/document.php @@ -147,7 +147,7 @@ if ($id > 0 || !empty($ref)) { if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'; - if ($usercancreate) { + if (0) { $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); if ($action != 'classify') { $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; diff --git a/htdocs/compta/facture/info.php b/htdocs/compta/facture/info.php index 7cbfdb50a14..340c40afa4a 100644 --- a/htdocs/compta/facture/info.php +++ b/htdocs/compta/facture/info.php @@ -103,7 +103,7 @@ $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1, 'customer'); if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'; - if ($usercancreate) { + if (0) { $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); if ($action != 'classify') { $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; diff --git a/htdocs/compta/facture/note.php b/htdocs/compta/facture/note.php index 3066b5adfc6..f6c81bbf800 100644 --- a/htdocs/compta/facture/note.php +++ b/htdocs/compta/facture/note.php @@ -125,7 +125,7 @@ if ($id > 0 || !empty($ref)) { if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'; - if ($usercancreate) { + if (0) { $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); if ($action != 'classify') { $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; diff --git a/htdocs/compta/facture/prelevement.php b/htdocs/compta/facture/prelevement.php index d7a674867d0..172ec0c1120 100644 --- a/htdocs/compta/facture/prelevement.php +++ b/htdocs/compta/facture/prelevement.php @@ -363,7 +363,7 @@ if ($object->id > 0) { if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'.$langs->trans('Project').' '; - if ($usercancreate) { + if (0) { $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); if ($action != 'classify') { $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; diff --git a/htdocs/contrat/agenda.php b/htdocs/contrat/agenda.php index 5b649c5b850..9ddab3b6487 100644 --- a/htdocs/contrat/agenda.php +++ b/htdocs/contrat/agenda.php @@ -176,7 +176,7 @@ if ($id > 0) { if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'; - if ($permissiontoadd) { + if (0) { $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); if ($action != 'classify') { $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; diff --git a/htdocs/contrat/contact.php b/htdocs/contrat/contact.php index 7f1187853c8..3c3bb00baeb 100644 --- a/htdocs/contrat/contact.php +++ b/htdocs/contrat/contact.php @@ -160,7 +160,7 @@ if ($id > 0 || !empty($ref)) { if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'; - if ($permissiontoadd) { + if (0) { $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); if ($action != 'classify') { $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; diff --git a/htdocs/contrat/document.php b/htdocs/contrat/document.php index 55fb5c690a1..477d8818c4b 100644 --- a/htdocs/contrat/document.php +++ b/htdocs/contrat/document.php @@ -147,7 +147,7 @@ if ($object->id) { if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'; - if ($permissiontoadd) { + if (0) { $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); if ($action != 'classify') { $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; diff --git a/htdocs/contrat/note.php b/htdocs/contrat/note.php index 94aa8369b3f..1038fe83de3 100644 --- a/htdocs/contrat/note.php +++ b/htdocs/contrat/note.php @@ -116,7 +116,7 @@ if ($id > 0 || !empty($ref)) { if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'; - if ($permissiontoadd) { + if (0) { $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); if ($action != 'classify') { $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index c7c699fc170..4e7acd5fc52 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -8155,7 +8155,7 @@ function print_date_range($date_start, $date_end, $format = '', $outputlangs = ' * * @param int $date_start Start date * @param int $date_end End date - * @param string $format Output format + * @param string $format Output date format ('day', 'dayhour', ...) * @param Translate $outputlangs Output language * @param integer $withparenthesis 1=Add parenthesis, 0=no parenthesis * @return string String diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index bb4f41861ec..4bb9bf378ee 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -1694,44 +1694,6 @@ if ($action == 'create') { $linkback = ''.$langs->trans("BackToList").''; $morehtmlref = '
'; - /* - // Ref customer - $morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->commande->creer, 'string', '', 0, 1); - $morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->commande->creer, 'string', '', null, null, '', 1); - // Thirdparty - $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $soc->getNomUrl(1); - // Project - if (isModEnabled('project')) - { - $langs->load("projects"); - $morehtmlref.='
'.$langs->trans('Project') . ' '; - if ($user->rights->commande->creer) - { - if ($action != 'classify') - $morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; - if ($action == 'classify') { - //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); - $morehtmlref.='
'; - $morehtmlref.=''; - $morehtmlref.=''; - $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); - $morehtmlref.=''; - $morehtmlref.=''; - } else { - $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); - } - } else { - if (!empty($object->fk_project)) { - $proj = new Project($db); - $proj->fetch($object->fk_project); - $morehtmlref.=''; - $morehtmlref.=$proj->ref; - $morehtmlref.=''; - } else { - $morehtmlref.=''; - } - } - }*/ $morehtmlref .= '
'; dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); diff --git a/htdocs/fourn/commande/contact.php b/htdocs/fourn/commande/contact.php index dd945ef3d39..3a8a5a5c49a 100644 --- a/htdocs/fourn/commande/contact.php +++ b/htdocs/fourn/commande/contact.php @@ -143,7 +143,7 @@ if ($id > 0 || !empty($ref)) { if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'; - if ($permissiontoadd) { + if (0) { $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); if ($action != 'classify' && $caneditproject) { $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index b7fd424054c..1f63c5a594b 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -549,7 +549,7 @@ if ($id > 0 || !empty($ref)) { if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'; - if ($permissiontoadd) { + if (0) { $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); if ($action != 'classify' && $caneditproject) { $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; diff --git a/htdocs/fourn/commande/document.php b/htdocs/fourn/commande/document.php index a598dd4b83d..b7d8ba118a0 100644 --- a/htdocs/fourn/commande/document.php +++ b/htdocs/fourn/commande/document.php @@ -135,7 +135,7 @@ if ($object->id > 0) { if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'; - if ($permissiontoadd) { + if (0) { $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); if ($action != 'classify' && $caneditproject) { $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; diff --git a/htdocs/fourn/commande/info.php b/htdocs/fourn/commande/info.php index df9f52abae1..4129947282f 100644 --- a/htdocs/fourn/commande/info.php +++ b/htdocs/fourn/commande/info.php @@ -148,7 +148,7 @@ $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1); if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'; - if ($permissiontoadd) { + if (0) { $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); if ($action != 'classify' && $caneditproject) { $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; diff --git a/htdocs/fourn/commande/note.php b/htdocs/fourn/commande/note.php index 53cb80f9e55..27e74006d85 100644 --- a/htdocs/fourn/commande/note.php +++ b/htdocs/fourn/commande/note.php @@ -117,7 +117,7 @@ if ($id > 0 || !empty($ref)) { if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'; - if ($permissiontoadd) { + if (0) { $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); if ($action != 'classify' && $caneditproject) { $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; diff --git a/htdocs/fourn/facture/contact.php b/htdocs/fourn/facture/contact.php index 5242fce001c..1317fe2f0a7 100644 --- a/htdocs/fourn/facture/contact.php +++ b/htdocs/fourn/facture/contact.php @@ -144,7 +144,7 @@ if ($id > 0 || !empty($ref)) { if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'; - if ($permissiontoadd) { + if (0) { $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); if ($action != 'classify') { $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; diff --git a/htdocs/fourn/facture/document.php b/htdocs/fourn/facture/document.php index cdc045b60fc..45189f5395e 100644 --- a/htdocs/fourn/facture/document.php +++ b/htdocs/fourn/facture/document.php @@ -120,7 +120,7 @@ if ($object->id > 0) { if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'; - if ($permissiontoadd) { + if (0) { $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); if ($action != 'classify') { $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; diff --git a/htdocs/fourn/facture/info.php b/htdocs/fourn/facture/info.php index b451d6fa63d..0dc58debba3 100644 --- a/htdocs/fourn/facture/info.php +++ b/htdocs/fourn/facture/info.php @@ -86,7 +86,7 @@ if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0 if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'; - if ($permissiontoadd) { + if (0) { $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); if ($action != 'classify') { $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; diff --git a/htdocs/fourn/facture/note.php b/htdocs/fourn/facture/note.php index 20c8f6d977c..0136ee1d11d 100644 --- a/htdocs/fourn/facture/note.php +++ b/htdocs/fourn/facture/note.php @@ -116,7 +116,7 @@ if ($object->id > 0) { if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'; - if ($permissiontoadd) { + if (0) { $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); if ($action != 'classify') { $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; diff --git a/htdocs/resource/element_resource.php b/htdocs/resource/element_resource.php index a5ca456310e..7e94465219f 100644 --- a/htdocs/resource/element_resource.php +++ b/htdocs/resource/element_resource.php @@ -350,21 +350,29 @@ if (!$ret) { // Thirdparty //$morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1); // Project + $savobject = $object; + $object = $act; if (isModEnabled('project')) { $langs->load("projects"); - //$morehtmlref.='
'.$langs->trans('Project') . ' '; - $morehtmlref .= $langs->trans('Project').': '; - if (!empty($act->fk_project)) { - $proj = new Project($db); - $proj->fetch($act->fk_project); - $morehtmlref .= ' : '.$proj->getNomUrl(1); - if ($proj->title) { - $morehtmlref .= ' - '.$proj->title; + //$morehtmlref .= '
'; + if (0) { + $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); + if ($action != 'classify') { + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, ($action == 'classify' ? 1 : 0), 0, 1, ''); } else { - $morehtmlref .= ''; + if (!empty($object->fk_project)) { + $proj = new Project($db); + $proj->fetch($object->fk_project); + $morehtmlref .= $proj->getNomUrl(1); + if ($proj->title) { + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title); + } + } } } + $object = $savobject; $morehtmlref .= ''; dol_banner_tab($act, 'element_id', $linkback, ($user->socid ? 0 : 1), 'id', 'ref', $morehtmlref, '&element='.$element, 0, '', '');
'; print $langs->trans('DateEndPropal'); print '