Merge pull request #1302 from FHenry/develop
Fix output of extrafield select list from table
This commit is contained in:
commit
cb539399a0
@ -124,6 +124,7 @@ class Contact extends CommonObject
|
||||
if (! empty($conf->global->MAIN_FIRST_TO_UPPER)) $this->firstname=ucwords($this->firstname);
|
||||
if (! $this->socid) $this->socid = 0;
|
||||
if (! $this->priv) $this->priv = 0;
|
||||
if (empty($this->statut)) $this->statut = 0;
|
||||
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."socpeople (";
|
||||
$sql.= " datec";
|
||||
|
||||
@ -935,6 +935,10 @@ class ExtraFields
|
||||
|
||||
$sql = 'SELECT '.$keyList;
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX .$InfoFieldList[0];
|
||||
if (strpos($InfoFieldList[4], 'extra')!==false)
|
||||
{
|
||||
$sql.= ' as main';
|
||||
}
|
||||
$sql.= ' WHERE '.$selectkey.'=\''.$this->db->escape($value).'\'';
|
||||
//$sql.= ' AND entity = '.$conf->entity;
|
||||
dol_syslog(get_class($this).':showOutputField:$type=sellist sql='.$sql);
|
||||
|
||||
@ -7,6 +7,7 @@
|
||||
* Copyright (C) 2013 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||
* Copyright (C) 2013 Jean Heimburger <jean@tiaris.info>
|
||||
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -175,8 +176,8 @@ else
|
||||
}
|
||||
$sql .= natural_search($params, $snom);
|
||||
}
|
||||
if (isset($tosell) && dol_strlen($tosell) > 0) $sql.= " AND p.tosell = ".$db->escape($tosell);
|
||||
if (isset($tobuy) && dol_strlen($tobuy) > 0) $sql.= " AND p.tobuy = ".$db->escape($tobuy);
|
||||
if (isset($tosell) && dol_strlen($tosell) > 0 && $tosell!=-1) $sql.= " AND p.tosell = ".$db->escape($tosell);
|
||||
if (isset($tobuy) && dol_strlen($tobuy) > 0 && $tobuy!=-1) $sql.= " AND p.tobuy = ".$db->escape($tobuy);
|
||||
if (dol_strlen($canvas) > 0) $sql.= " AND p.canvas = '".$db->escape($canvas)."'";
|
||||
if ($catid > 0) $sql.= " AND cp.fk_categorie = ".$catid;
|
||||
if ($catid == -2) $sql.= " AND cp.fk_categorie IS NULL";
|
||||
@ -297,8 +298,9 @@ else
|
||||
}
|
||||
if (! empty($conf->stock->enabled) && $user->rights->stock->lire && $type != 1) print '<td class="liste_titre" align="right">'.$langs->trans("DesiredStock").'</td>';
|
||||
if (! empty($conf->stock->enabled) && $user->rights->stock->lire && $type != 1) print '<td class="liste_titre" align="right">'.$langs->trans("PhysicalStock").'</td>';
|
||||
print_liste_field_titre($langs->trans("Sell"), $_SERVER["PHP_SELF"], "p.tosell",$param,"",'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Buy"), $_SERVER["PHP_SELF"], "p.tobuy",$param,"",'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Sell"), $_SERVER["PHP_SELF"], "p.tosell",$param,"",'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Buy"), $_SERVER["PHP_SELF"], "p.tobuy",$param,"",'align="center"',$sortfield,$sortorder);
|
||||
print '<td width="1%"> </td>';
|
||||
print "</tr>\n";
|
||||
|
||||
// Lignes des champs de filtre
|
||||
@ -354,8 +356,12 @@ else
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
print '<td class="liste_titre">';
|
||||
print ' ';
|
||||
print '<td align="center">';
|
||||
print $form->selectarray('tosell', array('0'=>$langs->trans('ProductStatusNotOnSellShort'),'1'=>$langs->trans('ProductStatusOnSellShort')),$tosell,1);
|
||||
print '</td >';
|
||||
|
||||
print '<td align="center">';
|
||||
print $form->selectarray('tobuy', array('0'=>$langs->trans('ProductStatusNotOnBuyShort'),'1'=>$langs->trans('ProductStatusOnBuyShort')),$tobuy,1);
|
||||
print '</td>';
|
||||
|
||||
print '<td class="liste_titre" align="right">';
|
||||
@ -475,11 +481,13 @@ else
|
||||
}
|
||||
|
||||
// Status (to buy)
|
||||
print '<td align="right" class="nowrap">'.$product_static->LibStatut($objp->tosell,5,0).'</td>';
|
||||
print '<td align="center" class="nowrap">'.$product_static->LibStatut($objp->tosell,5,0).'</td>';
|
||||
|
||||
// Status (to sell)
|
||||
print '<td align="right" class="nowrap">'.$product_static->LibStatut($objp->tobuy,5,1).'</td>';
|
||||
print '<td align="center" class="nowrap">'.$product_static->LibStatut($objp->tobuy,5,1).'</td>';
|
||||
|
||||
print '<td> </td>';
|
||||
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
|
||||
@ -41,6 +41,8 @@ if ($user->societe_id > 0)
|
||||
|
||||
$sall=GETPOST('sall','alpha');
|
||||
$search_user=GETPOST('search_user','alpha');
|
||||
$search_statut=GETPOST('search_statut','alpha');
|
||||
if ($search_statut=='') $search_statut=1; // always display activ customer first
|
||||
|
||||
$sortfield = GETPOST('sortfield','alpha');
|
||||
$sortorder = GETPOST('sortorder','alpha');
|
||||
@ -55,6 +57,7 @@ if (! $sortorder) $sortorder="ASC";
|
||||
|
||||
$userstatic=new User($db);
|
||||
$companystatic = new Societe($db);
|
||||
$form = new Form($db);
|
||||
|
||||
|
||||
/*
|
||||
@ -86,6 +89,10 @@ if (! empty($search_user))
|
||||
{
|
||||
$sql.= " AND (u.login LIKE '%".$db->escape($search_user)."%' OR u.lastname LIKE '%".$db->escape($search_user)."%' OR u.firstname LIKE '%".$db->escape($search_user)."%')";
|
||||
}
|
||||
if ($search_statut!='')
|
||||
{
|
||||
$sql.= " AND (u.statut=".$search_statut.")";
|
||||
}
|
||||
if ($sall) $sql.= " AND (u.login LIKE '%".$db->escape($sall)."%' OR u.lastname LIKE '%".$db->escape($sall)."%' OR u.firstname LIKE '%".$db->escape($sall)."%' OR u.email LIKE '%".$db->escape($sall)."%' OR u.note LIKE '%".$db->escape($sall)."%')";
|
||||
$sql.=$db->order($sortfield,$sortorder);
|
||||
|
||||
@ -95,6 +102,8 @@ if ($result)
|
||||
$num = $db->num_rows($result);
|
||||
$i = 0;
|
||||
|
||||
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n";
|
||||
|
||||
$param="search_user=$search_user&sall=$sall";
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
@ -104,7 +113,22 @@ if ($result)
|
||||
print_liste_field_titre($langs->trans("Company"),"index.php","u.fk_societe",$param,"","",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("DateCreation"),"index.php","u.datec",$param,"",'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("LastConnexion"),"index.php","u.datelastlogin",$param,"",'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Status"),"index.php","u.statut",$param,"",'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Status"),"index.php","u.statut",$param,"",'align="center"',$sortfield,$sortorder);
|
||||
print '<td width="1%"> </td>';
|
||||
print "</tr>\n";
|
||||
|
||||
//SearchBar
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="6"> </td>';
|
||||
|
||||
print '<td>';
|
||||
print $form->selectarray('search_statut', array('0'=>$langs->trans('Disabled'),'1'=>$langs->trans('Enabled')),$search_statut);
|
||||
print '</td>';
|
||||
|
||||
print '<td class="liste_titre" align="right">';
|
||||
print '<input class="liste_titre" type="image" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/search.png" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
|
||||
print '</td>';
|
||||
|
||||
print "</tr>\n";
|
||||
$var=True;
|
||||
while ($i < $num)
|
||||
@ -168,11 +192,13 @@ if ($result)
|
||||
|
||||
// Statut
|
||||
$userstatic->statut=$obj->statut;
|
||||
print '<td width="100" align="right">'.$userstatic->getLibStatut(5).'</td>';
|
||||
print '<td width="100" align="center">'.$userstatic->getLibStatut(5).'</td>';
|
||||
print '<td> </td>';
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
print "</table>";
|
||||
print "</form>\n";
|
||||
$db->free($result);
|
||||
}
|
||||
else
|
||||
|
||||
@ -113,7 +113,8 @@ $contact_fields = array(
|
||||
'user_id' => array('name'=>'user_id','type'=>'xsd:string'),
|
||||
'user_login' => array('name'=>'user_login','type'=>'xsd:string'),
|
||||
'civility_id' => array('name'=>'civility_id','type'=>'xsd:string'),
|
||||
'poste' => array('name'=>'poste','type'=>'xsd:string')
|
||||
'poste' => array('name'=>'poste','type'=>'xsd:string'),
|
||||
'statut' => array('name'=>'statut','type'=>'xsd:string')
|
||||
//...
|
||||
);
|
||||
//Retreive all extrafield for contact
|
||||
@ -302,7 +303,8 @@ function getContact($authentication,$id,$ref='',$ref_ext='')
|
||||
'user_id' => $contact->user_id,
|
||||
'user_login' => $contact->user_login,
|
||||
'civilite_id' => $contact->civility_id,
|
||||
'poste' => $contact->poste
|
||||
'poste' => $contact->poste,
|
||||
'statut' => $contact->statut
|
||||
);
|
||||
|
||||
//Retreive all extrafield for thirdsparty
|
||||
@ -412,6 +414,7 @@ function createContact($authentication,$contact)
|
||||
$newobject->user_id=$contact['user_id'];
|
||||
$newobject->user_login=$contact['user_login'];
|
||||
$newobject->poste=$contact['poste'];
|
||||
$newobject->statut=$contact['statut'];
|
||||
|
||||
//Retreive all extrafield for thirdsparty
|
||||
// fetch optionals attributes and labels
|
||||
@ -488,7 +491,7 @@ function getContactsForThirdParty($authentication,$idthirdparty)
|
||||
{
|
||||
$linesinvoice=array();
|
||||
|
||||
$sql = "SELECT c.rowid, c.fk_soc, c.civilite as civility_id, c.lastname, c.firstname,";
|
||||
$sql = "SELECT c.rowid, c.fk_soc, c.civilite as civility_id, c.lastname, c.firstname, c.statut,";
|
||||
$sql.= " c.address, c.zip, c.town,";
|
||||
$sql.= " c.fk_pays as country_id,";
|
||||
$sql.= " c.fk_departement,";
|
||||
@ -565,7 +568,8 @@ function getContactsForThirdParty($authentication,$idthirdparty)
|
||||
'ref_commande' => $contact->ref_commande?$contact->ref_commande:'',
|
||||
'ref_propal' => $contact->ref_propal?$contact->ref_propal:'',
|
||||
'user_id' => $contact->user_id?$contact->user_id:'',
|
||||
'user_login' => $contact->no_email?$contact->user_login:''
|
||||
'user_login' => $contact->user_login?$contact->user_login:'',
|
||||
'statut' => $contact->statut?$contact->statut:''
|
||||
|
||||
|
||||
|
||||
@ -659,6 +663,8 @@ function updateContact($authentication,$contact)
|
||||
$object->civilite_id=$contact['civility_id'];
|
||||
$object->poste=$contact['poste'];
|
||||
|
||||
$object->statut=$contact['statut'];
|
||||
|
||||
|
||||
//Retreive all extrafield for contact
|
||||
// fetch optionals attributes and labels
|
||||
|
||||
Loading…
Reference in New Issue
Block a user