Skip to content

Commit

Permalink
Merge pull request #5839 from atm-florian/3.9
Browse files Browse the repository at this point in the history
FIX : missing column into SQL on thridparty list
  • Loading branch information
eldy committed Oct 6, 2016
2 parents 0b49d63 + ee20704 commit 02f4f6d
Showing 1 changed file with 22 additions and 21 deletions.
43 changes: 22 additions & 21 deletions htdocs/societe/list.php
Expand Up @@ -166,7 +166,7 @@
// Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
{
foreach($extrafields->attribute_label as $key => $val)
foreach($extrafields->attribute_label as $key => $val)
{
$arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>$extrafields->attribute_list[$key], 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
}
Expand Down Expand Up @@ -342,6 +342,7 @@
$sql.= " s.siren as idprof1, s.siret as idprof2, ape as idprof3, idprof4 as idprof4, s.fk_pays,";
$sql.= " s.tms as date_update, s.datec as date_creation,";
$sql.= " typent.code as typent_code";
$sql.= " ,s.code_compta,s.code_compta_fournisseur";
// We'll need these fields in order to filter by sale (including the case where the user can only see his prospects)
if ($search_sale) $sql .= ", sc.fk_soc, sc.fk_user";
// We'll need these fields in order to filter by categ
Expand Down Expand Up @@ -403,7 +404,7 @@
$typ=$extrafields->attribute_type[$tmpkey];
$mode=0;
if (in_array($typ, array('int','double'))) $mode=1; // Search on a numeric
if ($val && ( ($crit != '' && ! in_array($typ, array('select'))) || ! empty($crit)))
if ($val && ( ($crit != '' && ! in_array($typ, array('select'))) || ! empty($crit)))
{
$sql .= natural_search('ef.'.$tmpkey, $crit, $mode);
}
Expand Down Expand Up @@ -462,8 +463,8 @@
$crit=$val;
$tmpkey=preg_replace('/search_options_/','',$key);
if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val);
}
}

print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_companies');

// Show delete result message
Expand Down Expand Up @@ -491,13 +492,13 @@
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';

if ($search_all)
{
foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
print $langs->trans("FilterOnInto", $search_all) . join(', ',$fieldstosearchall);
}

// Filter on categories
$moreforfilter='';
if ($type == 'c' || $type == 'p')
Expand Down Expand Up @@ -542,7 +543,7 @@

$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields

print '<table class="liste '.($moreforfilter?"listwithfilterbefore":"").'">';

print '<tr class="liste_titre">';
Expand All @@ -568,9 +569,9 @@
// Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
{
foreach($extrafields->attribute_label as $key => $val)
foreach($extrafields->attribute_label as $key => $val)
{
if (! empty($arrayfields["ef.".$key]['checked']))
if (! empty($arrayfields["ef.".$key]['checked']))
{
$align=$extrafields->getAlignFlag($key);
print_liste_field_titre($extralabels[$key],$_SERVER["PHP_SELF"],"ef.".$key,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder);
Expand Down Expand Up @@ -701,7 +702,7 @@
print '<input class="flat searchstring" size="4" type="text" name="search_idprof6" value="'.dol_escape_htmltag($search_idprof6).'">';
print '</td>';
}

// Type (customer/prospect/supplier)
print '<td class="liste_titre maxwidthonsmartphone" align="middle">';
print '<select class="flat" name="search_type">';
Expand All @@ -712,7 +713,7 @@
print '<option value="4"'.($search_type=='4'?' selected':'').'>'.$langs->trans('Supplier').'</option>';
print '<option value="0"'.($search_type=='0'?' selected':'').'>'.$langs->trans('Others').'</option>';
print '</select></td>';

if (! empty($arrayfields['s.fk_prospectlevel']['checked']))
{
// Prospect level
Expand All @@ -732,15 +733,15 @@
$options_to .= $langs->trans($tab_level_label);
$options_to .= '</option>';
}

// Print these two select
print $langs->trans("From").' <select class="flat" name="search_level_from">'.$options_from.'</select>';
print ' ';
print $langs->trans("to").' <select class="flat" name="search_level_to">'.$options_to.'</select>';

print '</td>';
}

if (! empty($arrayfields['s.fk_stcomm']['checked']))
{
// Prospect status
Expand All @@ -756,9 +757,9 @@
// Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
{
foreach($extrafields->attribute_label as $key => $val)
foreach($extrafields->attribute_label as $key => $val)
{
if (! empty($arrayfields["ef.".$key]['checked']))
if (! empty($arrayfields["ef.".$key]['checked']))
{
$align=$extrafields->getAlignFlag($key);
$typeofextrafield=$extrafields->attribute_type[$key];
Expand Down Expand Up @@ -814,7 +815,7 @@
{
$obj = $db->fetch_object($resql);
$var=!$var;

$companystatic->id=$obj->rowid;
$companystatic->name=$obj->name;
$companystatic->canvas=$obj->canvas;
Expand All @@ -825,7 +826,7 @@
$companystatic->code_fournisseur=$obj->code_fournisseur;
$companystatic->fk_prospectlevel=$obj->fk_prospectlevel;
$companystatic->name_alias=$obj->name_alias;

print "<tr ".$bc[$var].">";
if (! empty($arrayfields['s.nom']['checked']))
{
Expand Down Expand Up @@ -867,7 +868,7 @@
if (! empty($arrayfields['s.zip']['checked']))
{
print "<td>".$obj->zip."</td>\n";
}
}
// Country
if (! empty($arrayfields['country.code_iso']['checked']))
{
Expand Down Expand Up @@ -957,9 +958,9 @@
// Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
{
foreach($extrafields->attribute_label as $key => $val)
foreach($extrafields->attribute_label as $key => $val)
{
if (! empty($arrayfields["ef.".$key]['checked']))
if (! empty($arrayfields["ef.".$key]['checked']))
{
print '<td';
$align=$extrafields->getAlignFlag($key);
Expand Down

0 comments on commit 02f4f6d

Please sign in to comment.