2
0
forked from Wavyzz/dolibarr

FIX contextpage on contact list

This commit is contained in:
Laurent Destailleur
2018-06-23 12:06:17 +02:00
parent 4dcc74d08f
commit 06342ff80c
3 changed files with 11 additions and 16 deletions

View File

@@ -42,6 +42,7 @@ $massaction=GETPOST('massaction','alpha');
$show_files=GETPOST('show_files','int'); $show_files=GETPOST('show_files','int');
$confirm=GETPOST('confirm','alpha'); $confirm=GETPOST('confirm','alpha');
$toselect = GETPOST('toselect', 'array'); $toselect = GETPOST('toselect', 'array');
$contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'contactlist';
// Security check // Security check
$id = GETPOST('id','int'); $id = GETPOST('id','int');
@@ -81,8 +82,8 @@ if ($search_status=='') $search_status=1; // always display activ customer first
$optioncss = GETPOST('optioncss','alpha'); $optioncss = GETPOST('optioncss','alpha');
$type=GETPOST("type"); $type=GETPOST("type",'aZ');
$view=GETPOST("view"); $view=GETPOST("view",'alpha');
$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit; $limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
$sortfield = GETPOST('sortfield', 'alpha'); $sortfield = GETPOST('sortfield', 'alpha');
@@ -95,29 +96,28 @@ if (! $sortfield) $sortfield="p.lastname";
if (empty($page) || $page < 0) { $page = 0; } if (empty($page) || $page < 0) { $page = 0; }
$offset = $limit * $page; $offset = $limit * $page;
$contextpage='contactlist';
$titre = (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("ListOfContacts") : $langs->trans("ListOfContactsAddresses")); $titre = (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("ListOfContacts") : $langs->trans("ListOfContactsAddresses"));
if ($type == "p") if ($type == "p")
{ {
$contextpage='contactprospectlist'; if (empty($contextpage) || $contextpage == 'contactlist') $contextpage='contactprospectlist';
$titre.=' ('.$langs->trans("ThirdPartyProspects").')'; $titre.=' ('.$langs->trans("ThirdPartyProspects").')';
$urlfiche="card.php"; $urlfiche="card.php";
} }
if ($type == "c") if ($type == "c")
{ {
$contextpage='contactcustomerlist'; if (empty($contextpage) || $contextpage == 'contactlist') $contextpage='contactcustomerlist';
$titre.=' ('.$langs->trans("ThirdPartyCustomers").')'; $titre.=' ('.$langs->trans("ThirdPartyCustomers").')';
$urlfiche="card.php"; $urlfiche="card.php";
} }
else if ($type == "f") else if ($type == "f")
{ {
$contextpage='contactsupplierlist'; if (empty($contextpage) || $contextpage == 'contactlist') $contextpage='contactsupplierlist';
$titre.=' ('.$langs->trans("ThirdPartySuppliers").')'; $titre.=' ('.$langs->trans("ThirdPartySuppliers").')';
$urlfiche="card.php"; $urlfiche="card.php";
} }
else if ($type == "o") else if ($type == "o")
{ {
$contextpage='contactotherlist'; if (empty($contextpage) || $contextpage == 'contactlist') $contextpage='contactotherlist';
$titre.=' ('.$langs->trans("OthersNotLinkedToThirdParty").')'; $titre.=' ('.$langs->trans("OthersNotLinkedToThirdParty").')';
$urlfiche=""; $urlfiche="";
} }
@@ -435,6 +435,7 @@ print '<input type="hidden" name="formfilteraction" id="formfilteraction" value=
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">'; print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">'; print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="page" value="'.$page.'">'; print '<input type="hidden" name="page" value="'.$page.'">';
print '<input type="hidden" name="type" value="'.$type.'">';
print '<input type="hidden" name="view" value="'.dol_escape_htmltag($view).'">'; print '<input type="hidden" name="view" value="'.dol_escape_htmltag($view).'">';
print_barre_liste($titre, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_companies.png', 0, $newcardbutton, '', $limit); print_barre_liste($titre, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_companies.png', 0, $newcardbutton, '', $limit);

View File

@@ -4072,10 +4072,6 @@ function getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $m
$options=preg_replace('/&+/i','&',$options); $options=preg_replace('/&+/i','&',$options);
if (! preg_match('/^&/',$options)) $options='&'.$options; if (! preg_match('/^&/',$options)) $options='&'.$options;
//print "&nbsp;";
//$sortimg.= '<img width="2" src="'.DOL_URL_ROOT.'/theme/common/transparent.png" alt="">';
//$sortimg.= '<span class="nowrap">';
if (! $sortorder || $field1 != $sortfield1) if (! $sortorder || $field1 != $sortfield1)
{ {
//$out.= '<a href="'.$file.'?sortfield='.$field.'&sortorder=asc&begin='.$begin.$options.'">'.img_down("A-Z",0).'</a>'; //$out.= '<a href="'.$file.'?sortfield='.$field.'&sortorder=asc&begin='.$begin.$options.'">'.img_down("A-Z",0).'</a>';
@@ -4094,8 +4090,6 @@ function getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $m
$sortimg.= '<span class="nowrap">'.img_down("A-Z",0).'</span>'; $sortimg.= '<span class="nowrap">'.img_down("A-Z",0).'</span>';
} }
} }
//$sortimg.= '</span>';
} }
$out.=$sortimg; $out.=$sortimg;

View File

@@ -108,9 +108,9 @@ $offset = $limit * $page;
$pageprev = $page - 1; $pageprev = $page - 1;
$pagenext = $page + 1; $pagenext = $page + 1;
if ($type == 'c' && (empty($contextpage) || $contextpage == 'thirdpartylist')) { $contextpage='customerlist'; if ($search_type=='') $search_type='1,3'; } if ($type == 'c') { if (empty($contextpage) || $contextpage == 'thirdpartylist') $contextpage='customerlist'; if ($search_type=='') $search_type='1,3'; }
if ($type == 'p' && (empty($contextpage) || $contextpage == 'thirdpartylist')) { $contextpage='prospectlist'; if ($search_type=='') $search_type='2,3'; } if ($type == 'p') { if (empty($contextpage) || $contextpage == 'thirdpartylist') $contextpage='prospectlist'; if ($search_type=='') $search_type='2,3'; }
if ($type == 'f' && (empty($contextpage) || $contextpage == 'thirdpartylist')) { $contextpage='supplierlist'; if ($search_type=='') $search_type='4'; } if ($type == 'f') { if (empty($contextpage) || $contextpage == 'thirdpartylist') $contextpage='supplierlist'; if ($search_type=='') $search_type='4'; }
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$object = new Societe($db); $object = new Societe($db);