From 3aa9c75b0d9048b3b430d8e191f833e6683a365f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 21 Dec 2012 17:56:40 +0100 Subject: [PATCH] Fix: If thirdparty module not enabled, company and contact fields must not be visibles --- htdocs/comm/action/fiche.php | 89 +++++++++++++++++++----------------- 1 file changed, 47 insertions(+), 42 deletions(-) diff --git a/htdocs/comm/action/fiche.php b/htdocs/comm/action/fiche.php index ab7fd2a510c..8342613208e 100644 --- a/htdocs/comm/action/fiche.php +++ b/htdocs/comm/action/fiche.php @@ -352,7 +352,7 @@ if ($action == 'update') $actioncomm->array_options[$key]=GETPOST($key); } } - + if (! $error) { $db->begin(); @@ -646,7 +646,7 @@ if ($id) $act = new ActionComm($db); $result=$act->fetch($id); $act->fetch_optionals($id,$extralabels); - + if ($result < 0) { dol_print_error($db,$act->error); @@ -786,16 +786,19 @@ if ($id) print ''; - // Company - print ''; - print ''; + // Thirdparty - Contact + if ($conf->societe->enabled) + { + print ''; + print ''; - // Contact - print ''; + // Contact + print ''; + } // Project if (! empty($conf->projet->enabled)) @@ -803,7 +806,7 @@ if ($id) // Projet associe $langs->load("project"); - print ''; @@ -835,7 +838,7 @@ if ($id) // Other attributes $parameters=array('colspan' => ' colspan="3"', 'colspanvalue' => '3'); $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$act,$action); // Note that $action and $object may have been modified by hook - + print '
'.$langs->trans("ActionOnCompany").''; - print $form->select_company($act->societe->id,'socid','',1,1); - print '
'.$langs->trans("ActionOnCompany").''; + print $form->select_company($act->societe->id,'socid','',1,1); + print ''.$langs->trans("Contact").''; - print $form->selectarray("contactid", (empty($act->societe->id)?array():$act->societe->contact_array()), $act->contact->id, 1); - print '
'.$langs->trans("Contact").''; + print $form->selectarray("contactid", (empty($act->societe->id)?array():$act->societe->contact_array()), $act->contact->id, 1); + print '
'.$langs->trans("Project").''; + print '
'.$langs->trans("Project").''; $numprojet=select_projects($act->societe->id,$act->fk_project,'projectid'); if ($numprojet==0) { @@ -813,7 +816,7 @@ if ($id) } // Priority - print '
'.$langs->trans("Priority").''; + print '
'.$langs->trans("Priority").''; print ''; print '
'; if (empty($reshook) && ! empty($extrafields->attribute_label)) @@ -852,7 +855,7 @@ if ($id) } print '

'; } - + print '

'; print '     '; @@ -958,39 +961,41 @@ if ($id) print '

'; // Third party - Contact - print ''; - print ''; - print ''; + print ''; + print ''; } - else - { - print $langs->trans("None"); - } - - print ''; // Project if (! empty($conf->projet->enabled)) { - print ''; @@ -1022,10 +1027,10 @@ if ($id) $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$act,$action); // Note that $action and $object may have been modified by hook print '
'.$langs->trans("ActionOnCompany").''.($act->societe->id?$act->societe->getNomUrl(1):$langs->trans("None")); - if ($act->societe->id && $act->type_code == 'AC_TEL') - { - if ($act->societe->fetch($act->societe->id)) + if ($conf->societe->enabled) + { + print '
'.$langs->trans("ActionOnCompany").''.($act->societe->id?$act->societe->getNomUrl(1):$langs->trans("None")); + if ($act->societe->id && $act->type_code == 'AC_TEL') { - print "
".dol_print_phone($act->societe->tel); - } - } - print '
'.$langs->trans("Contact").''; - if ($act->contact->id > 0) - { - print $act->contact->getNomUrl(1); - if ($act->contact->id && $act->type_code == 'AC_TEL') - { - if ($act->contact->fetch($act->contact->id)) + if ($act->societe->fetch($act->societe->id)) { - print "
".dol_print_phone($act->contact->phone_pro); + print "
".dol_print_phone($act->societe->tel); } } + print '
'.$langs->trans("Contact").''; + if ($act->contact->id > 0) + { + print $act->contact->getNomUrl(1); + if ($act->contact->id && $act->type_code == 'AC_TEL') + { + if ($act->contact->fetch($act->contact->id)) + { + print "
".dol_print_phone($act->contact->phone_pro); + } + } + } + else + { + print $langs->trans("None"); + } + print '
'.$langs->trans("Project").''; + print '
'.$langs->trans("Project").''; if ($act->fk_project) { $project=new Project($db); @@ -1001,7 +1006,7 @@ if ($id) } // Priority - print '
'.$langs->trans("Priority").''; + print '
'.$langs->trans("Priority").''; print ($act->priority?$act->priority:''); print '
'; - + //Extra field if (empty($reshook) && ! empty($extrafields->attribute_label)) - { + { print '

'; foreach($extrafields->attribute_label as $key=>$label) {