diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index f00d637d375..bff890a09b7 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -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"; diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index b26b050dfd4..39916775507 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -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); diff --git a/htdocs/product/liste.php b/htdocs/product/liste.php index af1dfea171b..efe4799bdee 100644 --- a/htdocs/product/liste.php +++ b/htdocs/product/liste.php @@ -7,6 +7,7 @@ * Copyright (C) 2013 Raphaël Doursenaud * Copyright (C) 2013 Jean Heimburger * Copyright (C) 2013 Cédric Salvador + * Copyright (C) 2013 Florian Henry * * 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 ''.$langs->trans("DesiredStock").''; if (! empty($conf->stock->enabled) && $user->rights->stock->lire && $type != 1) print ''.$langs->trans("PhysicalStock").''; - 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 ' '; print "\n"; // Lignes des champs de filtre @@ -354,8 +356,12 @@ else print ''; } - print ''; - print ' '; + print ''; + print $form->selectarray('tosell', array('0'=>$langs->trans('ProductStatusNotOnSellShort'),'1'=>$langs->trans('ProductStatusOnSellShort')),$tosell,1); + print ''; + + print ''; + print $form->selectarray('tobuy', array('0'=>$langs->trans('ProductStatusNotOnBuyShort'),'1'=>$langs->trans('ProductStatusOnBuyShort')),$tobuy,1); print ''; print ''; @@ -475,11 +481,13 @@ else } // Status (to buy) - print ''.$product_static->LibStatut($objp->tosell,5,0).''; + print ''.$product_static->LibStatut($objp->tosell,5,0).''; // Status (to sell) - print ''.$product_static->LibStatut($objp->tobuy,5,1).''; + print ''.$product_static->LibStatut($objp->tobuy,5,1).''; + print ' '; + print "\n"; $i++; } diff --git a/htdocs/user/index.php b/htdocs/user/index.php index d5b34808b8f..62ead1935eb 100644 --- a/htdocs/user/index.php +++ b/htdocs/user/index.php @@ -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 '
'."\n"; + $param="search_user=$search_user&sall=$sall"; print ''; print ''; @@ -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 ''; + print "\n"; + + //SearchBar + print ''; + print ''; + + print ''; + + print ''; + print "\n"; $var=True; while ($i < $num) @@ -168,11 +192,13 @@ if ($result) // Statut $userstatic->statut=$obj->statut; - print ''; + print ''; + print ''; print "\n"; $i++; } print "
 
 '; + print $form->selectarray('search_statut', array('0'=>$langs->trans('Disabled'),'1'=>$langs->trans('Enabled')),$search_statut); + print ''; + print ''; + print '
'.$userstatic->getLibStatut(5).''.$userstatic->getLibStatut(5).' 
"; + print "
\n"; $db->free($result); } else diff --git a/htdocs/webservices/server_contact.php b/htdocs/webservices/server_contact.php index a4538772e1a..126e4202018 100644 --- a/htdocs/webservices/server_contact.php +++ b/htdocs/webservices/server_contact.php @@ -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