diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index 8fb590d61b4..a1727d770a4 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -1245,7 +1245,7 @@ if ($id > 0) print ''; - if (! empty($conf->global->MAIN_REPEATCONTACTONEACHTAB)) + if (! empty($conf->global->MAIN_DUPLICATE_CONTACTS_TAB_ON_CUSTOMER_CARD)) { // List of contacts show_contacts($conf,$langs,$db,$object,$_SERVER["PHP_SELF"].'?socid='.$object->id); diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index 3cb683a0e9b..f616ca728b6 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -49,8 +49,8 @@ class Contact extends CommonObject */ public $fields=array( 'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'index'=>1, 'position'=>1, 'comment'=>'Id'), - 'lastname' =>array('type'=>'varchar(128)', 'label'=>'Name', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1, 'comment'=>'Reference of object'), - 'firstname' =>array('type'=>'varchar(128)', 'label'=>'Firstname', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>11, 'searchall'=>1, 'comment'=>'Reference of object'), + 'lastname' =>array('type'=>'varchar(128)', 'label'=>'Name', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1), + 'firstname' =>array('type'=>'varchar(128)', 'label'=>'Firstname', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>11, 'searchall'=>1), 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'default'=>1, 'notnull'=>1, 'index'=>1, 'position'=>20), 'note_public' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>60), 'note_private' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>61), diff --git a/htdocs/core/actions_changeselectedfields.inc.php b/htdocs/core/actions_changeselectedfields.inc.php index 11884f81224..6d39272f74e 100644 --- a/htdocs/core/actions_changeselectedfields.inc.php +++ b/htdocs/core/actions_changeselectedfields.inc.php @@ -33,14 +33,14 @@ if (GETPOST('formfilteraction') == 'listafterchangingselectedfields') $tabparam=array(); $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; - + if (GETPOST("selectedfields")) $tabparam["MAIN_SELECTEDFIELDS_".$varpage]=GETPOST("selectedfields"); else $tabparam["MAIN_SELECTEDFIELDS_".$varpage]=''; include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; - + $result=dol_set_user_param($db, $conf, $user, $tabparam); - + //$action='list'; //var_dump($tabparam);exit; } diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index dd8081754d8..a1d051440c3 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -259,9 +259,6 @@ class Conf // Load translation object with current language if (empty($this->global->MAIN_LANG_DEFAULT)) $this->global->MAIN_LANG_DEFAULT="en_US"; - //if (! isset($this->global->MAIN_REPEATCONTACTONEACHTAB)) $this->global->MAIN_REPEATCONTACTONEACHTAB=1; - //if (! isset($this->global->MAIN_REPEATADDRESSONEACHTAB)) $this->global->MAIN_REPEATADDRESSONEACHTAB=1; - $rootfordata = DOL_DATA_ROOT; $rootforuser = DOL_DATA_ROOT; // If multicompany module is enabled, we redefine the root of data diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 9a750639182..357771f04d3 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -1351,28 +1351,48 @@ class ExtraFields /** * Return HTML string to put an output field into a page * - * @param string $key Key of attribute - * @param string $value Value to show - * @param string $moreparam To add more parameters on html input tag (only checkbox use html input for output rendering) - * @return string Formated value + * @param string $key Key of attribute + * @param string $value Value to show + * @param string $moreparam To add more parameters on html input tag (only checkbox use html input for output rendering) + * @param string $extrafieldsobjectkey If defined, use the new method to get extrafields data + * @return string Formated value */ - function showOutputField($key,$value,$moreparam='') + function showOutputField($key, $value, $moreparam='', $extrafieldsobjectkey='') { global $conf,$langs; - $elementtype=$this->attribute_elementtype[$key]; // seems not used - $label=$this->attribute_label[$key]; - $type=$this->attribute_type[$key]; - $size=$this->attribute_size[$key]; - $default=$this->attribute_default[$key]; - $computed=$this->attribute_computed[$key]; - $unique=$this->attribute_unique[$key]; - $required=$this->attribute_required[$key]; - $param=$this->attribute_param[$key]; - $perms=$this->attribute_perms[$key]; - $langfile=$this->attribute_langfile[$key]; - $list=$this->attribute_list[$key]; - $hidden=(($list == 0) ? 1 : 0); // If zero, we are sure it is hidden, otherwise we show. If it depends on mode (view/create/edit form or list, this must be filtered by caller) + if (! empty($extrafieldsobjectkey)) + { + $elementtype=$this->attributes[$extrafieldsobjectkey]['elementtype'][$key]; // seems not used + $label=$this->attributes[$extrafieldsobjectkey]['label'][$key]; + $type=$this->attributes[$extrafieldsobjectkey]['type'][$key]; + $size=$this->attributes[$extrafieldsobjectkey]['size'][$key]; + $default=$this->attributes[$extrafieldsobjectkey]['default'][$key]; + $computed=$this->attributes[$extrafieldsobjectkey]['computed'][$key]; + $unique=$this->attributes[$extrafieldsobjectkey]['unique'][$key]; + $required=$this->attributes[$extrafieldsobjectkey]['required'][$key]; + $param=$this->attributes[$extrafieldsobjectkey]['param'][$key]; + $perms=$this->attributes[$extrafieldsobjectkey]['perms'][$key]; + $langfile=$this->attributes[$extrafieldsobjectkey]['langfile'][$key]; + $list=$this->attributes[$extrafieldsobjectkey]['list'][$key]; + $hidden=(($list == 0) ? 1 : 0); // If zero, we are sure it is hidden, otherwise we show. If it depends on mode (view/create/edit form or list, this must be filtered by caller) + } + else + { + $elementtype=$this->attribute_elementtype[$key]; // seems not used + $label=$this->attribute_label[$key]; + $type=$this->attribute_type[$key]; + $size=$this->attribute_size[$key]; + $default=$this->attribute_default[$key]; + $computed=$this->attribute_computed[$key]; + $unique=$this->attribute_unique[$key]; + $required=$this->attribute_required[$key]; + $param=$this->attribute_param[$key]; + $perms=$this->attribute_perms[$key]; + $langfile=$this->attribute_langfile[$key]; + $list=$this->attribute_list[$key]; + $hidden=(($list == 0) ? 1 : 0); // If zero, we are sure it is hidden, otherwise we show. If it depends on mode (view/create/edit form or list, this must be filtered by caller) + } if ($hidden) return ''; // This is a protection. If field is hidden, we should just not call this method. @@ -1600,6 +1620,7 @@ class ExtraFields elseif ($type == 'link') { $out=''; + // only if something to display (perf) if ($value) { @@ -1648,14 +1669,16 @@ class ExtraFields /** * Return tag to describe alignement to use for this extrafield * - * @param string $key Key of attribute - * @return string Formated value + * @param string $key Key of attribute + * @param string $extrafieldsobjectkey If defined, use the new method to get extrafields data + * @return string Formated value */ - function getAlignFlag($key) + function getAlignFlag($key, $extrafieldsobjectkey='') { global $conf,$langs; - $type=$this->attribute_type[$key]; + if (! empty($extrafieldsobjectkey)) $type=$this->attributes[$extrafieldsobjectkey]['type'][$key]; + else $type=$this->attribute_type[$key]; $align=''; diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 48914ebd69f..0c62c190992 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -640,7 +640,6 @@ function isInEEC($object) function show_projects($conf, $langs, $db, $object, $backtopage='', $nocreatelink=0, $morehtmlright='') { global $user; - global $bc; $i = -1 ; @@ -768,10 +767,10 @@ function show_projects($conf, $langs, $db, $object, $backtopage='', $nocreatelin */ function show_contacts($conf,$langs,$db,$object,$backtopage='') { - global $user,$conf; - global $bc; + global $user,$conf,$extrafields,$hookmanager; + global $contextpage; - $form= new Form($db); + $form = new Form($db); $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); @@ -782,24 +781,67 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='') $search_addressphone = GETPOST("search_addressphone",'alpha'); if (! $sortorder) $sortorder="ASC"; - if (! $sortfield) $sortfield="p.lastname"; + if (! $sortfield) $sortfield="t.lastname"; + if (! empty($conf->clicktodial->enabled)) + { + $user->fetch_clicktodial(); // lecture des infos de clicktodial du user + } + + + $contactstatic = new Contact($db); + + $extralabels=$extrafields->fetch_name_optionals_label($contactstatic->table_element); + + $contactstatic->fields=array( + 'name' =>array('type'=>'varchar(128)', 'label'=>'Name', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1), + 'poste' =>array('type'=>'varchar(128)', 'label'=>'PostOfFunction', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>20), + 'address' =>array('type'=>'varchar(128)', 'label'=>'Address', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>30), + 'statut' =>array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'default'=>0, 'index'=>1, 'position'=>40, 'arrayofkeyval'=>array(0=>$contactstatic->LibStatut(0,1), 1=>$contactstatic->LibStatut(1,1))), + ); + + // Definition of fields for list + $arrayfields=array( + 't.rowid'=>array('label'=>"TechnicalID", 'checked'=>($conf->global->MAIN_SHOW_TECHNICAL_ID?1:0), 'enabled'=>($conf->global->MAIN_SHOW_TECHNICAL_ID?1:0), 'position'=>1), + 't.name'=>array('label'=>"Name", 'checked'=>1, 'position'=>10), + 't.poste'=>array('label'=>"PostOrFunction", 'checked'=>1, 'position'=>20), + 't.address'=>array('label'=>(empty($conf->dol_optimize_smallscreen) ? $langs->trans("Address").' / '.$langs->trans("Phone").' / '.$langs->trans("Email") : $langs->trans("Address")), 'checked'=>1, 'position'=>30), + 't.statut'=>array('label'=>"Status", 'checked'=>1, 'position'=>40, 'align'=>'center'), + ); + // Extra fields + if (is_array($extrafields->attributes[$contactstatic->table_element]['label']) && count($extrafields->attributes[$contactstatic->table_element]['label'])) + { + foreach($extrafields->attributes[$contactstatic->table_element]['label'] as $key => $val) + { + if (! empty($extrafields->attributes[$contactstatic->table_element]['list'][$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attributes[$contactstatic->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$contactstatic->table_element]['list'][$key]<0)?0:1), 'position'=>$extrafields->attributes[$contactstatic->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$contactstatic->table_element]['list'][$key])!=3 && $extrafields->attributes[$contactstatic->table_element]['perms'][$key])); + } + } + + // Initialize array of search criterias + $search=array(); + foreach($contactstatic->fields as $key => $val) + { + if (GETPOST('search_'.$key,'alpha')) $search[$key]=GETPOST('search_'.$key,'alpha'); + } + + + // Purge search criteria if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') ||GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers { $search_status = ''; $search_name = ''; $search_addressphone = ''; $search_array_options=array(); + + foreach($contactstatic->fields as $key => $val) + { + $search[$key]=''; + } + $toselect=''; } - $i=-1; - - $contactstatic = new Contact($db); - - if (! empty($conf->clicktodial->enabled)) - { - $user->fetch_clicktodial(); // lecture des infos de clicktodial - } + $contactstatic->fields = dol_sort_array($contactstatic->fields, 'position'); + $arrayfields = dol_sort_array($arrayfields, 'position'); $buttoncreate=''; if ($user->rights->societe->contact->creer) @@ -815,25 +857,30 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='') print load_fiche_titre($title, $buttoncreate,''); print '
'; + print ''; print ''; print ''; print ''; print ''; + $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; + $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields + //if ($massactionbutton) $selectedfields.=$form->showCheckAddButtons('checkforselect', 1); - print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table - print "\n".''."\n"; + print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table + print "\n".'
'."\n"; $param="socid=".$object->id; if ($search_status != '') $param.='&search_status='.$search_status; if ($search_name != '') $param.='&search_name='.urlencode($search_name); - $sql = "SELECT p.rowid, p.lastname, p.firstname, p.fk_pays as country_id, p.civility, p.poste, p.phone as phone_pro, p.phone_mobile, p.phone_perso, p.fax, p.email, p.skype, p.statut, p.photo,"; - $sql .= " p.civility as civility_id, p.address, p.zip, p.town"; - $sql .= " FROM ".MAIN_DB_PREFIX."socpeople as p"; - $sql .= " WHERE p.fk_soc = ".$object->id; - if ($search_status!='' && $search_status != '-1') $sql .= " AND p.statut = ".$db->escape($search_status); - if ($search_name) $sql .= " AND (p.lastname LIKE '%".$db->escape($search_name)."%' OR p.firstname LIKE '%".$db->escape($search_name)."%')"; + $sql = "SELECT t.rowid, t.lastname, t.firstname, t.fk_pays as country_id, t.civility, t.poste, t.phone as phone_pro, t.phone_mobile, t.phone_perso, t.fax, t.email, t.skype, t.statut, t.photo,"; + $sql .= " t.civility as civility_id, t.address, t.zip, t.town"; + $sql .= " FROM ".MAIN_DB_PREFIX."socpeople as t"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople_extrafields as ef on (t.rowid = ef.fk_object)"; + $sql .= " WHERE t.fk_soc = ".$object->id; + if ($search_status!='' && $search_status != '-1') $sql .= " AND t.statut = ".$db->escape($search_status); + if ($search_name) $sql .= " AND (t.lastname LIKE '%".$db->escape($search_name)."%' OR t.firstname LIKE '%".$db->escape($search_name)."%')"; $sql.= " ORDER BY $sortfield $sortorder"; dol_syslog('core/lib/company.lib.php :: show_contacts', LOG_DEBUG); @@ -842,59 +889,63 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='') $num = $db->num_rows($result); - $colspan=9; - - print ''; - - // Photo - Name - print ''; - - // Position - print ''; - - // Address - Phone - Email - print ''; - - // Status - print ''; - - // Add to agenda - if (! empty($conf->agenda->enabled) && $user->rights->agenda->myactions->create) - { - $colspan++; - print ''; - } - - // Action - print ''; - - print ""; - - $titlefieldaddress=$langs->trans("Address").' / '.$langs->trans("Phone").' / '.$langs->trans("Email"); - if (! empty($conf->dol_optimize_smallscreen)) $titlefieldaddress=$langs->trans("Address"); - + // Fields title search + // -------------------------------------------------------------------- print ''; - print_liste_field_titre("Name",$_SERVER["PHP_SELF"],"p.lastname","",$param,'',$sortfield,$sortorder); - print_liste_field_titre("Poste",$_SERVER["PHP_SELF"],"p.poste","",$param,'',$sortfield,$sortorder); - print_liste_field_titre($titlefieldaddress,$_SERVER["PHP_SELF"],"","",$param,'',$sortfield,$sortorder); - print_liste_field_titre("Status",$_SERVER["PHP_SELF"],"p.statut","",$param,'align="center"',$sortfield,$sortorder); - // Add to agenda - if (! empty($conf->agenda->enabled) && ! empty($user->rights->agenda->myactions->create)) print_liste_field_titre(''); - // Edit - print_liste_field_titre(''); - print "\n"; + foreach($contactstatic->fields as $key => $val) + { + $align=''; + if (in_array($val['type'], array('date','datetime','timestamp'))) $align.=($align?' ':'').'center'; + if (in_array($val['type'], array('timestamp'))) $align.=($align?' ':'').'nowrap'; + if ($key == 'status' || $key == 'statut') $align.=($align?' ':'').'center'; + if (! empty($arrayfields['t.'.$key]['checked'])) + { + print ''; + } + } + // Extra fields + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; + + // Fields from hook + $parameters=array('arrayfields'=>$arrayfields); + $reshook=$hookmanager->executeHooks('printFieldListOption', $parameters, $contactstatic); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + // Action column + print ''; + print ''."\n"; + + + // Fields title label + // -------------------------------------------------------------------- + print ''; + foreach($contactstatic->fields as $key => $val) + { + $align=''; + if (in_array($val['type'], array('date','datetime','timestamp'))) $align.=($align?' ':'').'center'; + if (in_array($val['type'], array('timestamp'))) $align.=($align?' ':'').'nowrap'; + if ($key == 'status' || $key == 'statut') $align.=($align?' ':'').'center'; + if (! empty($arrayfields['t.'.$key]['checked'])) print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($align?'class="'.$align.'"':''), $sortfield, $sortorder, $align.' ')."\n"; + } + // Extra fields + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; + // Hook fields + $parameters=array('arrayfields'=>$arrayfields); + $reshook=$hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"],'','','','align="center"',$sortfield,$sortorder,'maxwidthsearch ')."\n"; + print ''."\n"; + + $i = -1; if ($num || (GETPOST('button_search') || GETPOST('button_search.x') || GETPOST('button_search_x'))) { - $i=0; + $i = 0; while ($i < $num) { @@ -923,46 +974,81 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='') $contactstatic->country_code = $country_code; $contactstatic->setGenderFromCivility(); + $contactstatic->fetch_optionals(); + + if (is_array($contactstatic->array_options)) + { + foreach($contactstatic->array_options as $key => $val) + { + $obj->$key = $val; + } + } print ''; + // ID + if (! empty($arrayfields['t.rowid']['checked'])) + { + print ''; + } + // Photo - Name - print ''; + if (! empty($arrayfields['t.name']['checked'])) + { + print ''; + } // Job position - print ''; + if (! empty($arrayfields['t.poste']['checked'])) + { + print ''; + } // Address - Phone - Email - print ''; + if (! empty($arrayfields['t.address']['checked'])) + { + print ''; + } // Status - print ''; + if (! empty($arrayfields['t.statut']['checked'])) + { + print ''; + } - // Add to agenda + // Extra fields + $extrafieldsobjectkey='socpeople'; + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; + + // Actions + print ''; + print '   '; } // Edit if ($user->rights->societe->contact->creer) { - print ''; + print ''; } - else print ''; + + print ''; print "\n"; $i++; @@ -970,9 +1056,9 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='') } else { - print ''; - print ''; - print "\n"; + $colspan=1; + foreach($arrayfields as $key => $val) { if (! empty($val['checked'])) $colspan++; } + print ''; } print "\n
'; - print ''; - print ''; - print ''; - print $form->selectarray('search_status', array('-1'=>'','0'=>$contactstatic->LibStatut(0,1),'1'=>$contactstatic->LibStatut(1,1)),$search_status); - print ''; - $searchpicto=$form->showFilterButtons(); - print $searchpicto; - print '
'; + if (in_array($key, array('lastname','name'))) print ''; + elseif (in_array($key, array('statut'))) print $form->selectarray('search_status', array('-1'=>'','0'=>$contactstatic->LibStatut(0,1),'1'=>$contactstatic->LibStatut(1,1)),$search_status); + print ''; + $searchpicto=$form->showFilterButtons(); + print $searchpicto; + print '
'; + print $contactstatic->id; + print ''; - print $form->showphoto('contact',$contactstatic,0,0,0,'photorefnoborder valignmiddle marginrightonly','small',1,0,1); - print $contactstatic->getNomUrl(0,'',0,'&backtopage='.urlencode($backtopage)); - print ''; + print $form->showphoto('contact',$contactstatic,0,0,0,'photorefnoborder valignmiddle marginrightonly','small',1,0,1); + print $contactstatic->getNomUrl(0,'',0,'&backtopage='.urlencode($backtopage)); + print ''; - if ($obj->poste) print $obj->poste; - print ''; + if ($obj->poste) print $obj->poste; + print ''; - print $contactstatic->getBannerAddress('contact', $object); - print ''; + print $contactstatic->getBannerAddress('contact', $object); + print ''.$contactstatic->getLibStatut(5).''.$contactstatic->getLibStatut(5).''; + + // Add to agenda if (! empty($conf->agenda->enabled) && $user->rights->agenda->myactions->create) { - print ''; print ''; print img_object($langs->trans("Event"),"action"); - print ''; print ''; print img_edit(); - print ' 
'.$langs->trans("None").'
'.$langs->trans("None").'
\n"; print '
'; @@ -995,7 +1081,6 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='') function show_addresses($conf,$langs,$db,$object,$backtopage='') { global $user; - global $bc; require_once DOL_DOCUMENT_ROOT.'/societe/class/address.class.php'; @@ -1087,7 +1172,7 @@ function show_addresses($conf,$langs,$db,$object,$backtopage='') */ function show_actions_todo($conf,$langs,$db,$filterobj,$objcon='',$noprint=0,$actioncode='') { - global $bc,$user,$conf; + global $user,$conf; $out = show_actions_done($conf,$langs,$db,$filterobj,$objcon,1,$actioncode, 'todo'); @@ -1114,7 +1199,7 @@ function show_actions_todo($conf,$langs,$db,$filterobj,$objcon='',$noprint=0,$ac */ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=0, $actioncode='', $donetodo='done', $filters=array(), $sortfield='a.datep,a.id', $sortorder='DESC') { - global $bc,$user,$conf; + global $user,$conf; global $form; global $param; @@ -1560,7 +1645,6 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint= function show_subsidiaries($conf,$langs,$db,$object) { global $user; - global $bc; $i=-1; diff --git a/htdocs/core/tpl/extrafields_list_print_fields.tpl.php b/htdocs/core/tpl/extrafields_list_print_fields.tpl.php index 7cd86d767ae..58915b7a786 100644 --- a/htdocs/core/tpl/extrafields_list_print_fields.tpl.php +++ b/htdocs/core/tpl/extrafields_list_print_fields.tpl.php @@ -8,32 +8,69 @@ if (empty($conf) || ! is_object($conf)) } // Loop to show all columns of extrafields from $obj, $extrafields and $db -if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) +if (! empty($extrafieldsobjectkey)) // New method: $extrafieldsobject can be 'societe', 'socpeople', ... { - foreach($extrafields->attribute_label as $key => $val) + if (is_array($extrafields->attributes[$extrafieldsobjectkey]['label']) && count($extrafields->attributes[$extrafieldsobjectkey]['label'])) { - if (! empty($arrayfields["ef.".$key]['checked'])) + foreach($extrafields->attributes[$extrafieldsobjectkey]['label'] as $key => $val) { - $align=$extrafields->getAlignFlag($key); - print ''; - $tmpkey='options_'.$key; - if (in_array($extrafields->attribute_type[$key], array('date', 'datetime', 'timestamp'))) + if (! empty($arrayfields["ef.".$key]['checked'])) { - $value = $db->jdate($obj->$tmpkey); + $align=$extrafields->getAlignFlag($key, $extrafieldsobjectkey); + print ''; + $tmpkey='options_'.$key; + if (in_array($extrafields->attributes[$extrafieldsobjectkey]['type'][$key], array('date', 'datetime', 'timestamp'))) + { + $value = $db->jdate($obj->$tmpkey); + } + else + { + $value = $obj->$tmpkey; + } + + print $extrafields->showOutputField($key, $value, '', $extrafieldsobjectkey); + print ''; + if (! $i) $totalarray['nbfield']++; + if (! empty($val['isameasure'])) + { + if (! $i) $totalarray['pos'][$totalarray['nbfield']]='ef.'.$tmpkey; + $totalarray['val']['ef.'.$tmpkey] += $obj->$tmpkey; + } } - else + } + } +} +else // Old method +{ + if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) + { + foreach($extrafields->attribute_label as $key => $val) + { + if (! empty($arrayfields["ef.".$key]['checked'])) { - $value = $obj->$tmpkey; - } - print $extrafields->showOutputField($key, $value, ''); - print ''; - if (! $i) $totalarray['nbfield']++; - if (! empty($val['isameasure'])) - { - if (! $i) $totalarray['pos'][$totalarray['nbfield']]='ef.'.$tmpkey; - $totalarray['val']['ef.'.$tmpkey] += $obj->$tmpkey; + $align=$extrafields->getAlignFlag($key); + print ''; + $tmpkey='options_'.$key; + if (in_array($extrafields->attribute_type[$key], array('date', 'datetime', 'timestamp'))) + { + $value = $db->jdate($obj->$tmpkey); + } + else + { + $value = $obj->$tmpkey; + } + print $extrafields->showOutputField($key, $value, ''); + print ''; + if (! $i) $totalarray['nbfield']++; + if (! empty($val['isameasure'])) + { + if (! $i) $totalarray['pos'][$totalarray['nbfield']]='ef.'.$tmpkey; + $totalarray['val']['ef.'.$tmpkey] += $obj->$tmpkey; + } } } } diff --git a/htdocs/fourn/card.php b/htdocs/fourn/card.php index 6f473f8deb3..f2ed3005022 100644 --- a/htdocs/fourn/card.php +++ b/htdocs/fourn/card.php @@ -779,7 +779,7 @@ if ($object->id > 0) print ''; - if (! empty($conf->global->MAIN_REPEATCONTACTONEACHTAB)) + if (! empty($conf->global->MAIN_DUPLICATE_CONTACTS_TAB_ON_MAIN_CARD)) { print '
'; // List of contacts diff --git a/htdocs/societe/contact.php b/htdocs/societe/contact.php index 4077c1e1b28..d57f61045c0 100644 --- a/htdocs/societe/contact.php +++ b/htdocs/societe/contact.php @@ -44,11 +44,7 @@ require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; if (! empty($conf->adherent->enabled)) require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; -$langs->load("companies"); -$langs->load("commercial"); -$langs->load("bills"); -$langs->load("banks"); -$langs->load("users"); +$langs->loadLangs(array("companies","commercial","bills","banks","users")); if (! empty($conf->categorie->enabled)) $langs->load("categories"); if (! empty($conf->incoterm->enabled)) $langs->load("incoterm"); if (! empty($conf->notification->enabled)) $langs->load("mails"); @@ -115,6 +111,9 @@ if (empty($reshook)) exit; } } + + // Selection of new fields + include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; } @@ -169,8 +168,6 @@ else if ($action != 'presend') { - print '
'; - // Contacts list if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) { @@ -182,10 +179,6 @@ else { $result=show_addresses($conf,$langs,$db,$object,$_SERVER["PHP_SELF"].'?socid='.$object->id); } - - - print '
'; - } }