From 2a09e34bdf068e793be9b86ab2f4f6eeec22c484 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 14 Mar 2015 13:05:28 +0100 Subject: [PATCH] Uniformize etrafields visibility for thirdparties card --- htdocs/comm/card.php | 20 +++++++++++++++++--- htdocs/fourn/card.php | 15 ++++++++++++++- htdocs/societe/soc.php | 20 +++++++++++--------- 3 files changed, 42 insertions(+), 13 deletions(-) diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index 78b786d2366..9b7c3150c71 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -68,10 +68,15 @@ if (! $sortorder) $sortorder="ASC"; if (! $sortfield) $sortfield="nom"; $cancelbutton = GETPOST('cancel'); +$object = new Client($db); +$extrafields = new ExtraFields($db); + +// fetch optionals attributes and labels +$extralabels=$extrafields->fetch_name_optionals_label($object->table_element); + // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array $hookmanager->initHooks(array('commcard','globalcard')); -$object = new Societe($db); /* * Actions @@ -425,9 +430,9 @@ if ($id > 0) print ''; } - // Level of prospect if ($object->client == 2 || $object->client == 3) { + // Level of prospect print ''; print ''; } - // Sales representative + // Other attributes + $parameters=array('socid'=>$object->id, 'colspan' => ' colspan="3"', 'colspanvalue' => '3'); + $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + if (empty($reshook) && ! empty($extrafields->attribute_label)) + { + print $object->showOptionals($extrafields); + } + + // Sales representative include DOL_DOCUMENT_ROOT.'/societe/tpl/linesalesrepresentative.tpl.php'; // Module Adherent diff --git a/htdocs/fourn/card.php b/htdocs/fourn/card.php index 1d4c144a098..1825349e83b 100644 --- a/htdocs/fourn/card.php +++ b/htdocs/fourn/card.php @@ -52,9 +52,13 @@ $result = restrictedArea($user, 'societe&fournisseur', $id, '&societe'); $object = new Fournisseur($db); $extrafields = new ExtraFields($db); +// fetch optionals attributes and labels +$extralabels=$extrafields->fetch_name_optionals_label($object->table_element); + // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array $hookmanager->initHooks(array('suppliercard','globalcard')); + /* * Action */ @@ -253,7 +257,16 @@ if ($object->id > 0) print ""; print ''; - // Module Adherent + // Other attributes + $parameters=array('socid'=>$object->id, 'colspan' => ' colspan="3"', 'colspanvalue' => '3'); + $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + if (empty($reshook) && ! empty($extrafields->attribute_label)) + { + print $object->showOptionals($extrafields); + } + + // Module Adherent if (! empty($conf->adherent->enabled)) { $langs->load("members"); diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index 0f17851b89e..84b47983d5c 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -63,6 +63,10 @@ $extrafields = new ExtraFields($db); // fetch optionals attributes and labels $extralabels=$extrafields->fetch_name_optionals_label($object->table_element); +// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +$hookmanager->initHooks(array('thirdpartycard','globalcard')); + + // Get object canvas (By default, this is not defined, so standard usage of dolibarr) $object->getCanvas($socid); $canvas = $object->canvas?$object->canvas:GETPOST("canvas"); @@ -77,8 +81,6 @@ if (! empty($canvas)) // Security check $result = restrictedArea($user, 'societe', $socid, '&societe', '', 'fk_soc', 'rowid', $objcanvas); -// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array -$hookmanager->initHooks(array('thirdpartycard','globalcard')); /* @@ -1091,7 +1093,7 @@ else $form->select_users((! empty($object->commercial_id)?$object->commercial_id:$user->id),'commercial_id',1); // Add current user by default print ''; } - + // Incoterms if (!empty($conf->incoterm->enabled)) { @@ -1101,7 +1103,7 @@ else print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms)?$object->location_incoterms:'')); print ''; } - + // Other attributes $parameters=array('colspan' => ' colspan="3"', 'colspanvalue' => '3'); $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook @@ -1226,11 +1228,11 @@ else //Incoterms if (!empty($conf->incoterm->enabled)) - { + { $object->fk_incoterms = GETPOST('incoterm_id', 'int'); $object->location_incoterms = GETPOST('lcoation_incoterms', 'alpha'); } - + //Local Taxes $object->localtax1_assuj = GETPOST('localtax1assuj_value'); $object->localtax2_assuj = GETPOST('localtax2assuj_value'); @@ -1627,7 +1629,7 @@ else print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms)?$object->location_incoterms:'')); print ''; } - + // Logo print ''; print ''; @@ -2016,7 +2018,7 @@ else // Incoterms if (!empty($conf->incoterm->enabled)) - { + { print '
'; print $langs->trans('ProspectLevel'); @@ -453,7 +458,16 @@ if ($id > 0) print '
'; print '
'; print $langs->trans('IncotermLabel'); @@ -2030,7 +2032,7 @@ else { print $form->textwithpicto($object->display_incoterms(), $object->libelle_incoterms, 1); } - else + else { print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms)?$object->location_incoterms:''), $_SERVER['PHP_SELF'].'?socid='.$object->id); }