diff --git a/htdocs/contact/agenda.php b/htdocs/contact/agenda.php index f1be48a063b..f4cfeaa38cd 100644 --- a/htdocs/contact/agenda.php +++ b/htdocs/contact/agenda.php @@ -226,11 +226,10 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { $objsoc = new Societe($db); $objsoc->fetch($object->socid); // Thirdparty - $morehtmlref .= $langs->trans('ThirdParty').' : '; if ($objsoc->id > 0) { $morehtmlref .= $objsoc->getNomUrl(1); } else { - $morehtmlref .= $langs->trans("ContactNotLinkedToCompany"); + $morehtmlref .= ''.$langs->trans("ContactNotLinkedToCompany").''; } } $morehtmlref .= ''; diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index 2c2d8df7d80..7197eabb19c 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -1308,7 +1308,6 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) { $objsoc->fetch($object->socid); // Thirdparty - $morehtmlref .= $langs->trans('ThirdParty').' : '; if ($objsoc->id > 0) { $morehtmlref .= $objsoc->getNomUrl(1, 'contact'); } else { diff --git a/htdocs/contact/consumption.php b/htdocs/contact/consumption.php index 7d9a95bad56..93acb2ab463 100644 --- a/htdocs/contact/consumption.php +++ b/htdocs/contact/consumption.php @@ -133,11 +133,10 @@ $morehtmlref .= '
'; if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) { $objsoc->fetch($socid); // Thirdparty - $morehtmlref .= $langs->trans('ThirdParty').' : '; if ($objsoc->id > 0) { $morehtmlref .= $objsoc->getNomUrl(1, 'contact'); } else { - $morehtmlref .= $langs->trans("ContactNotLinkedToCompany"); + $morehtmlref .= ''.$langs->trans("ContactNotLinkedToCompany").''; } } $morehtmlref .= '
'; diff --git a/htdocs/contact/document.php b/htdocs/contact/document.php index ed8bc2d4d93..88858a11e1f 100644 --- a/htdocs/contact/document.php +++ b/htdocs/contact/document.php @@ -142,11 +142,10 @@ if ($object->id) { $objsoc = new Societe($db); $objsoc->fetch($object->socid); // Thirdparty - $morehtmlref .= $langs->trans('ThirdParty').' : '; if ($objsoc->id > 0) { $morehtmlref .= $objsoc->getNomUrl(1); } else { - $morehtmlref .= $langs->trans("ContactNotLinkedToCompany"); + $morehtmlref .= ''.$langs->trans("ContactNotLinkedToCompany").''; } } $morehtmlref .= ''; diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index 71154e23b28..cea2b5464d3 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -120,12 +120,14 @@ $optioncss = GETPOST('optioncss', 'alpha'); $type = GETPOST("type", 'aZ'); $view = GETPOST("view", 'alpha'); +$userid = GETPOST('userid', 'int'); +$begin = GETPOST('begin'); + +// Load variable for pagination $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); -$userid = GETPOST('userid', 'int'); -$begin = GETPOST('begin'); if (!$sortorder) { $sortorder = "ASC"; } @@ -133,9 +135,12 @@ if (!$sortfield) { $sortfield = "p.lastname"; } if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) { + // If $page is not defined, or '' or -1 or if we click on clear filters $page = 0; } $offset = $limit * $page; +$pageprev = $page - 1; +$pagenext = $page + 1; $title = (!empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("Contacts") : $langs->trans("ContactsAddresses")); @@ -166,10 +171,10 @@ if ($type == "c") { $urlfiche = ""; } -// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context +// Initialize technical object $object = new Contact($db); -$hookmanager->initHooks(array('contactlist')); $extrafields = new ExtraFields($db); +$hookmanager->initHooks(array($contextpage)); // fetch optionals attributes and labels $extrafields->fetch_name_optionals_label($object->table_element); @@ -197,19 +202,28 @@ if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) { $fieldstosearchall['s.name_alias'] = "AliasNames"; } -// Definition of fields for list +$parameters = array('fieldstosearchall'=>$fieldstosearchall); +$reshook = $hookmanager->executeHooks('completeFieldsToSearchAll', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks +if ($reshook > 0) { + $fieldstosearchall = empty($hookmanager->resArray['fieldstosearchall']) ? array() : $hookmanager->resArray['fieldstosearchall']; +} elseif ($reshook == 0) { + $fieldstosearchall = array_merge($fieldstosearchall, empty($hookmanager->resArray['fieldstosearchall']) ? array() : $hookmanager->resArray['fieldstosearchall']); +} + +// Definition of array of fields for columns $arrayfields = array(); foreach ($object->fields as $key => $val) { // If $val['visible']==0, then we never show the field - if (empty($val['visible'])) { - continue; + if (!empty($val['visible'])) { + $visible = (int) dol_eval($val['visible'], 1); + $arrayfields['p.'.$key] = array( + 'label'=>$val['label'], + 'checked'=>(($visible < 0) ? 0 : 1), + 'enabled'=>(abs($visible) != 3 && dol_eval($val['enabled'], 1)), + 'position'=>$val['position'], + 'help'=> isset($val['help']) ? $val['help'] : '' + ); } - - $arrayfields['p.'.$key] = array( - 'label'=>$val['label'], - 'checked'=>(($val['visible'] < 0) ? 0 : 1), - 'enabled'=>($val['enabled'] && ($val['visible'] != 3)), - 'position'=>$val['position']); } // Add none object fields to fields for list @@ -241,6 +255,7 @@ if (isModEnabled('socialnetworks')) { include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; $object->fields = dol_sort_array($object->fields, 'position'); +//$arrayfields['anotherfield'] = array('type'=>'integer', 'label'=>'AnotherField', 'checked'=>1, 'enabled'=>1, 'position'=>90, 'csslist'=>'right'); $arrayfields = dol_sort_array($arrayfields, 'position'); @@ -251,13 +266,20 @@ if (($id > 0 || !empty($ref)) && $action != 'add') { } } +$permissiontoread = $user->hasRight('societe', 'lire'); +$permissiontodelete = $user->hasRight('societe', 'supprimer'); +$permissiontoadd = $user->hasRight('societe', 'creer'); + +if (!$permissiontoread) accessforbidden(); + /* * Actions */ if (GETPOST('cancel', 'alpha')) { - $action = 'list'; $massaction = ''; + $action = 'list'; + $massaction = ''; } if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction = ''; @@ -273,7 +295,7 @@ if (empty($reshook)) { // Selection of new fields include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; - // Did we click on purge search criteria ? + // 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 $sall = ""; $search_id = ''; @@ -317,9 +339,6 @@ if (empty($reshook)) { // Mass actions $objectclass = 'Contact'; $objectlabel = 'Contact'; - $permissiontoread = $user->hasRight('societe', 'lire'); - $permissiontodelete = $user->hasRight('societe', 'supprimer'); - $permissiontoadd = $user->hasRight('societe', 'creer'); $uploaddir = $conf->societe->dir_output; include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; @@ -350,13 +369,12 @@ $formother = new FormOther($db); $formcompany = new FormCompany($db); $contactstatic = new Contact($db); -$morejs = array(); -$morecss = array(); +$now = dol_now(); -// Page Header $title = $langs->trans("Contacts")." - ".$langs->trans("List"); $help_url = 'EN:Module_Third_Parties|FR:Module_Tiers|ES:Módulo_Empresas'; -llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', 'bodyforlist'); +$morejs = array(); +$morecss = array(); if (!empty($conf->global->THIRDPARTY_ENABLE_PROSPECTION_ON_ALTERNATIVE_ADRESSES)) { $contactstatic->loadCacheOfProspStatus(); @@ -385,14 +403,15 @@ if ($resql) { dol_print_error($db); } +// Build and execute select +// -------------------------------------------------------------------- $sql = "SELECT s.rowid as socid, s.nom as name, s.name_alias as alias,"; $sql .= " p.rowid, p.lastname as lastname, p.statut, p.firstname, p.address, p.zip, p.town, p.poste, p.email,"; $sql .= " p.socialnetworks, p.photo,"; $sql .= " p.phone as phone_pro, p.phone_mobile, p.phone_perso, p.fax, p.fk_pays, p.priv, p.datec as date_creation, p.tms as date_update,"; -$sql .= " p.import_key,"; -$sql .= " st.libelle as stcomm, st.picto as stcomm_picto, p.fk_stcommcontact as stcomm_id, p.fk_prospectlevel,"; +$sql .= " p.import_key, p.fk_stcommcontact as stcomm_id, p.fk_prospectlevel,"; +$sql .= " st.libelle as stcomm, st.picto as stcomm_picto,"; $sql .= " co.label as country, co.code as country_code"; - // Add fields from extrafields if (!empty($extrafields->attributes[$object->table_element]['label'])) { foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) { @@ -403,10 +422,11 @@ if (isModEnabled('mailing')) { $sql .= ", (SELECT count(*) FROM ".MAIN_DB_PREFIX."mailing_unsubscribe WHERE email = p.email) as unsubscribed"; } -// Add fields from hooks - ListSelect +// Add fields from hooks $parameters = array(); $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object, $action); // Note that $action and $object may have been modified by hook -$sql .= $hookmanager->resPrint; +$sql .= preg_replace('/^,/', '', $hookmanager->resPrint); +$sql = preg_replace('/,\s*$/', '', $sql); $sqlfields = $sql; // $sql fields to remove for count total @@ -679,7 +699,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { dol_print_error($db); } - if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0 + if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller than the paging size (filtering), goto and load page 0 $page = 0; $offset = 0; } @@ -704,9 +724,8 @@ if (!$resql) { $num = $db->num_rows($resql); -$arrayofselected = is_array($toselect) ? $toselect : array(); - -if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && ($sall != '' || $search_cti != '')) { +// Direct jump if only one record found +if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && ($sall != '' || $search_cti != '') && !$page) { $obj = $db->fetch_object($resql); $id = $obj->rowid; header("Location: ".DOL_URL_ROOT.'/contact/card.php?id='.$id); @@ -714,6 +733,12 @@ if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && ( } +// Output page +// -------------------------------------------------------------------- +// Page Header +llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', 'bodyforlist'); + +$arrayofselected = is_array($toselect) ? $toselect : array(); $param = ''; if (!empty($mode)) { @@ -802,10 +827,10 @@ if (is_array($search_level) && count($search_level)) { } } if ($search_import_key != '') { - $param .= '&search_import_key='.urlencode($search_import_key); + $param .= '&search_import_key='.urlencode($search_import_key); } if ($optioncss != '') { - $param .= '&optioncss='.urlencode($optioncss); + $param .= '&optioncss='.urlencode($optioncss); } if (count($search_roles) > 0) { $param .= implode('&search_roles[]=', $search_roles); @@ -820,7 +845,7 @@ $arrayofmassactions = array( // 'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"), ); //if($user->rights->societe->creer) $arrayofmassactions['createbills']=$langs->trans("CreateInvoiceForThisCustomer"); -if ($user->hasRight('societe', 'supprimer')) { +if (!empty($permissiontodelete)) { $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete"); } if (isModEnabled('category') && $user->rights->societe->creer) { @@ -831,25 +856,28 @@ if (in_array($massaction, array('presend', 'predelete','preaffecttag'))) { } $massactionbutton = $form->selectMassAction('', $arrayofmassactions); -$newcardbutton = ''; -$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition')); -$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition')); -$newcardbutton .= dolGetButtonTitle($langs->trans('NewContactAddress'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/contact/card.php?action=create', '', $user->rights->societe->contact->creer); - -print '
'; +print ''; if ($optioncss != '') { print ''; } print ''; print ''; +print ''; print ''; print ''; //print ''; print ''; -print ''; +print ''; +print ''; print ''; +$newcardbutton = ''; +$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition')); +$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition')); +$newcardbutton .= dolGetButtonTitleSeparator(); +$newcardbutton .= dolGetButtonTitle($langs->trans('NewContactAddress'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/contact/card.php?action=create', '', $permissiontoadd); + print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'address', 0, $newcardbutton, '', $limit, 0, 0, 1); $topicmail = "Information"; @@ -859,9 +887,12 @@ $trackid = 'ctc'.$object->id; include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; if ($sall) { + $setupstring = ''; foreach ($fieldstosearchall as $key => $val) { $fieldstosearchall[$key] = $langs->trans($val); + $setupstring .= $key."=".$val.";"; } + print ''."\n"; print '
'.$langs->trans("FilterOnInto", $sall).join(', ', $fieldstosearchall).'
'; } if ($search_firstlast_only) { @@ -914,18 +945,17 @@ print ''; $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN', '')); // This also change content of $arrayfields -if ($massactionbutton) { - $selectedfields .= $form->showCheckAddButtons('checkforselect', 1); -} +$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : ''); print '
'; -print ''."\n"; +print '
'."\n"; -// Lines for filter fields +// Fields title search +// -------------------------------------------------------------------- print ''; // Action column -if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { - print ''; @@ -1093,87 +1123,113 @@ if (!empty($arrayfields['p.import_key']['checked'])) { print ''; } // Action column -if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { - print ''; } -print ''; +print ''."\n"; -// Title line +$totalarray = array(); +$totalarray['nbfield'] = 0; + +// Fields title label +// -------------------------------------------------------------------- print ''; -if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { - print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch '); +if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print getTitleFieldOfList(($mode != 'kanban' ? $selectedfields : ''), 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; + $totalarray['nbfield']++; } if (!empty($arrayfields['p.rowid']['checked'])) { print_liste_field_titre($arrayfields['p.rowid']['label'], $_SERVER["PHP_SELF"], "p.rowid", "", $param, "", $sortfield, $sortorder); + $totalarray['nbfield']++; } if (!empty($arrayfields['p.lastname']['checked'])) { print_liste_field_titre($arrayfields['p.lastname']['label'], $_SERVER["PHP_SELF"], "p.lastname", $begin, $param, '', $sortfield, $sortorder); + $totalarray['nbfield']++; } if (!empty($arrayfields['p.firstname']['checked'])) { print_liste_field_titre($arrayfields['p.firstname']['label'], $_SERVER["PHP_SELF"], "p.firstname", $begin, $param, '', $sortfield, $sortorder); + $totalarray['nbfield']++; } if (!empty($arrayfields['p.poste']['checked'])) { print_liste_field_titre($arrayfields['p.poste']['label'], $_SERVER["PHP_SELF"], "p.poste", $begin, $param, '', $sortfield, $sortorder); + $totalarray['nbfield']++; } if (!empty($arrayfields['p.address']['checked'])) { print_liste_field_titre($arrayfields['p.address']['label'], $_SERVER["PHP_SELF"], "p.address", $begin, $param, '', $sortfield, $sortorder); + $totalarray['nbfield']++; } if (!empty($arrayfields['p.zip']['checked'])) { print_liste_field_titre($arrayfields['p.zip']['label'], $_SERVER["PHP_SELF"], "p.zip", $begin, $param, '', $sortfield, $sortorder); + $totalarray['nbfield']++; } if (!empty($arrayfields['p.town']['checked'])) { print_liste_field_titre($arrayfields['p.town']['label'], $_SERVER["PHP_SELF"], "p.town", $begin, $param, '', $sortfield, $sortorder); + $totalarray['nbfield']++; } //if (!empty($arrayfields['state.nom']['checked'])) print_liste_field_titre($arrayfields['state.nom']['label'],$_SERVER["PHP_SELF"],"state.nom","",$param,'',$sortfield,$sortorder); //if (!empty($arrayfields['region.nom']['checked'])) print_liste_field_titre($arrayfields['region.nom']['label'],$_SERVER["PHP_SELF"],"region.nom","",$param,'',$sortfield,$sortorder); if (!empty($arrayfields['country.code_iso']['checked'])) { print_liste_field_titre($arrayfields['country.code_iso']['label'], $_SERVER["PHP_SELF"], "co.code_iso", "", $param, '', $sortfield, $sortorder, 'center '); + $totalarray['nbfield']++; } if (!empty($arrayfields['p.phone']['checked'])) { print_liste_field_titre($arrayfields['p.phone']['label'], $_SERVER["PHP_SELF"], "p.phone", $begin, $param, '', $sortfield, $sortorder); + $totalarray['nbfield']++; } if (!empty($arrayfields['p.phone_perso']['checked'])) { print_liste_field_titre($arrayfields['p.phone_perso']['label'], $_SERVER["PHP_SELF"], "p.phone_perso", $begin, $param, '', $sortfield, $sortorder); + $totalarray['nbfield']++; } if (!empty($arrayfields['p.phone_mobile']['checked'])) { print_liste_field_titre($arrayfields['p.phone_mobile']['label'], $_SERVER["PHP_SELF"], "p.phone_mobile", $begin, $param, '', $sortfield, $sortorder); + $totalarray['nbfield']++; } if (!empty($arrayfields['p.fax']['checked'])) { print_liste_field_titre($arrayfields['p.fax']['label'], $_SERVER["PHP_SELF"], "p.fax", $begin, $param, '', $sortfield, $sortorder); + $totalarray['nbfield']++; } if (!empty($arrayfields['p.email']['checked'])) { print_liste_field_titre($arrayfields['p.email']['label'], $_SERVER["PHP_SELF"], "p.email", $begin, $param, '', $sortfield, $sortorder); + $totalarray['nbfield']++; } if (!empty($arrayfields['unsubscribed']['checked'])) { print_liste_field_titre($arrayfields['unsubscribed']['label'], $_SERVER["PHP_SELF"], "unsubscribed", $begin, $param, '', $sortfield, $sortorder, 'center '); + $totalarray['nbfield']++; } if (isModEnabled('socialnetworks')) { foreach ($socialnetworks as $key => $value) { if ($value['active'] && !empty($arrayfields['p.'.$key]['checked'])) { print_liste_field_titre($arrayfields['p.'.$key]['label'], $_SERVER["PHP_SELF"], "p.".$key, $begin, $param, '', $sortfield, $sortorder); + $totalarray['nbfield']++; } } } if (!empty($arrayfields['p.fk_soc']['checked'])) { print_liste_field_titre($arrayfields['p.fk_soc']['label'], $_SERVER["PHP_SELF"], "p.fk_soc", $begin, $param, '', $sortfield, $sortorder); + $totalarray['nbfield']++; } if (!empty($arrayfields['s.nom']['checked'])) { print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"], "s.nom", $begin, $param, '', $sortfield, $sortorder); + $totalarray['nbfield']++; } if (!empty($arrayfields['s.name_alias']['checked'])) { print_liste_field_titre($arrayfields['s.name_alias']['label'], $_SERVER["PHP_SELF"], "s.name_alias", $begin, $param, '', $sortfield, $sortorder); + $totalarray['nbfield']++; } if (!empty($arrayfields['p.priv']['checked'])) { print_liste_field_titre($arrayfields['p.priv']['label'], $_SERVER["PHP_SELF"], "p.priv", $begin, $param, '', $sortfield, $sortorder, 'center '); + $totalarray['nbfield']++; } if (!empty($arrayfields['p.fk_prospectlevel']['checked'])) { print_liste_field_titre($arrayfields['p.fk_prospectlevel']['label'], $_SERVER["PHP_SELF"], "p.fk_prospectlevel", "", $param, '', $sortfield, $sortorder, 'center '); + $totalarray['nbfield']++; } if (!empty($arrayfields['p.fk_stcommcontact']['checked'])) { print_liste_field_titre($arrayfields['p.fk_stcommcontact']['label'], $_SERVER["PHP_SELF"], "p.fk_stcommcontact", "", $param, '', $sortfield, $sortorder, 'center '); + $totalarray['nbfield']++; } // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; @@ -1204,11 +1260,18 @@ if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { print "\n"; +// Loop on record +// -------------------------------------------------------------------- $i = 0; +$savnbfield = $totalarray['nbfield']; $totalarray = array(); $totalarray['nbfield'] = 0; -while ($i < min($num, $limit)) { +$imaxinloop = ($limit ? min($num, $limit) : $num); +while ($i < $imaxinloop) { $obj = $db->fetch_object($resql); + if (empty($obj)) { + break; // Should not happen + } $arraysocialnetworks = (array) json_decode($obj->socialnetworks, true); $contactstatic->lastname = $obj->lastname; @@ -1233,7 +1296,7 @@ while ($i < min($num, $limit)) { if ($mode == 'kanban') { if ($i == 0) { - print ''; } } else { - print ''; + // Show here line of result + $j = 0; + print ''; // Action column - if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { print ''; + if (!$i) { + $totalarray['nbfield']++; + } } // ID @@ -1523,7 +1591,7 @@ while ($i < min($num, $limit)) { } // Action column - if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { print ''; - } - if (!$i) { - $totalarray['nbfield']++; + if (!$i) { + $totalarray['nbfield']++; + } } print "\n"; diff --git a/htdocs/contact/note.php b/htdocs/contact/note.php index 148d9fb6f04..e9e5d64f495 100644 --- a/htdocs/contact/note.php +++ b/htdocs/contact/note.php @@ -106,11 +106,10 @@ if ($id > 0) { $objsoc = new Societe($db); $objsoc->fetch($object->socid); // Thirdparty - $morehtmlref .= $langs->trans('ThirdParty').' : '; if ($objsoc->id > 0) { $morehtmlref .= $objsoc->getNomUrl(1); } else { - $morehtmlref .= $langs->trans("ContactNotLinkedToCompany"); + $morehtmlref .= ''.$langs->trans("ContactNotLinkedToCompany").''; } } $morehtmlref .= ''; diff --git a/htdocs/contact/perso.php b/htdocs/contact/perso.php index bdfa4ddb708..0fd23753fdf 100644 --- a/htdocs/contact/perso.php +++ b/htdocs/contact/perso.php @@ -232,11 +232,10 @@ if ($action == 'edit') { $objsoc = new Societe($db); $objsoc->fetch($object->socid); // Thirdparty - $morehtmlref .= $langs->trans('ThirdParty').' : '; if ($objsoc->id > 0) { $morehtmlref .= $objsoc->getNomUrl(1); } else { - $morehtmlref .= $langs->trans("ContactNotLinkedToCompany"); + $morehtmlref .= ''.$langs->trans("ContactNotLinkedToCompany").''; } } $morehtmlref .= ''; diff --git a/htdocs/contact/project.php b/htdocs/contact/project.php index 571fa57e428..466e6a6b5b6 100644 --- a/htdocs/contact/project.php +++ b/htdocs/contact/project.php @@ -82,14 +82,14 @@ if ($id) { $morehtmlref .= ''; $morehtmlref .= '
'; - if (empty($conf->global->SOCIETE_DISABLE_CONTACTS) && !empty($socid)) { - $object->thirdparty->fetch($socid); + if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) { + $objsoc = new Societe($db); + $objsoc->fetch($object->socid); // Thirdparty - $morehtmlref .= $langs->trans('ThirdParty').' : '; - if ($object->thirdparty->id > 0) { - $morehtmlref .= $object->thirdparty->getNomUrl(1, 'contact'); + if ($objsoc->id > 0) { + $morehtmlref .= $objsoc->getNomUrl(1, 'contact'); } else { - $morehtmlref .= $langs->trans("ContactNotLinkedToCompany"); + $morehtmlref .= ''.$langs->trans("ContactNotLinkedToCompany").''; } } $morehtmlref .= '
'; diff --git a/htdocs/hrm/class/skill.class.php b/htdocs/hrm/class/skill.class.php index 1413bc36e0c..44cea026320 100644 --- a/htdocs/hrm/class/skill.class.php +++ b/htdocs/hrm/class/skill.class.php @@ -1124,6 +1124,7 @@ class Skill extends CommonObject public function getKanbanView($option = '', $arraydata = null) { global $selected, $langs; + $return = '
'; $return .= '
'; $return .= ''; diff --git a/htdocs/modulebuilder/template/myobject_list.php b/htdocs/modulebuilder/template/myobject_list.php index f58e662daea..c5923412e27 100644 --- a/htdocs/modulebuilder/template/myobject_list.php +++ b/htdocs/modulebuilder/template/myobject_list.php @@ -302,7 +302,7 @@ if (isset($extrafields->attributes[$object->table_element]['label']) && is_array } // Add table from hooks $parameters = array(); -$reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $sql .= $hookmanager->resPrint; if ($object->ismultientitymanaged == 1) { $sql .= " WHERE t.entity IN (".getEntity($object->element).")"; @@ -449,7 +449,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } foreach ($search as $key => $val) { if (is_array($search[$key])) {
'; +if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; $searchpicto = $form->showFilterButtons('left'); print $searchpicto; print ''; - $searchpicto = $form->showFilterAndCheckAddButtons(0); +if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + $searchpicto = $form->showFilterButtons(); print $searchpicto; print '
'; + print '
'; print '
'; } $contactstatic->photo = $obj->photo; @@ -1241,15 +1304,17 @@ while ($i < min($num, $limit)) { $contactstatic->fetch_thirdparty($obj->socid); } print $contactstatic->getKanbanView(''); - if ($i == min($num, $limit) - 1) { + if ($i == ($imaxinloop - 1)) { print '
'; print '
'; if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined $selected = 0; @@ -1259,6 +1324,9 @@ while ($i < min($num, $limit)) { print ''; } print ''; if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined $selected = 0; @@ -1533,9 +1601,9 @@ while ($i < min($num, $limit)) { print ''; } print '