Ajout d'une fonction pour récupérer le nom d'un pays, utiliser dans admin/index.php
This commit is contained in:
parent
12d5d00924
commit
a27601960b
@ -21,7 +21,8 @@
|
|||||||
* $Source$
|
* $Source$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class Form {
|
class Form
|
||||||
|
{
|
||||||
var $db;
|
var $db;
|
||||||
var $errorstr;
|
var $errorstr;
|
||||||
|
|
||||||
@ -44,9 +45,11 @@ class Form {
|
|||||||
print '<select name="departement_id">';
|
print '<select name="departement_id">';
|
||||||
|
|
||||||
// On recherche les départements/cantons/province active d'une region et pays actif
|
// On recherche les départements/cantons/province active d'une region et pays actif
|
||||||
$sql = "SELECT d.rowid, d.code_departement as code , d.nom, d.active, p.libelle as libelle_pays, p.code as code_pays FROM llx_c_departements as d, llx_c_regions as r, llx_c_pays as p";
|
$sql = "SELECT d.rowid, d.code_departement as code , d.nom, d.active, p.libelle as libelle_pays, p.code as code_pays FROM ";
|
||||||
|
$sql .= MAIN_DB_PREFIX ."c_departements as d, ".MAIN_DB_PREFIX."c_regions as r,".MAIN_DB_PREFIX."c_pays as p";
|
||||||
$sql .= " WHERE d.fk_region=r.code_region and r.fk_pays=p.rowid";
|
$sql .= " WHERE d.fk_region=r.code_region and r.fk_pays=p.rowid";
|
||||||
$sql .= " AND d.active = 1 AND r.active = 1 AND p.active = 1 ORDER BY code_pays, code ASC";
|
$sql .= " AND d.active = 1 AND r.active = 1 AND p.active = 1 ";
|
||||||
|
$sql .= "ORDER BY code_pays, code ASC";
|
||||||
|
|
||||||
if ($this->db->query($sql))
|
if ($this->db->query($sql))
|
||||||
{
|
{
|
||||||
@ -95,7 +98,7 @@ class Form {
|
|||||||
{
|
{
|
||||||
print '<select name="pays_id">';
|
print '<select name="pays_id">';
|
||||||
|
|
||||||
$sql = "SELECT rowid, libelle, active FROM llx_c_pays";
|
$sql = "SELECT rowid, libelle, active FROM ".MAIN_DB_PREFIX."c_pays";
|
||||||
$sql .= " WHERE active = 1 ORDER BY libelle ASC";
|
$sql .= " WHERE active = 1 ORDER BY libelle ASC";
|
||||||
|
|
||||||
if ($this->db->query($sql))
|
if ($this->db->query($sql))
|
||||||
@ -122,6 +125,34 @@ class Form {
|
|||||||
print '</select>';
|
print '</select>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Retourne le nom d'un pays
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
Function pays_name($id)
|
||||||
|
{
|
||||||
|
$sql = "SELECT rowid, libelle FROM ".MAIN_DB_PREFIX."c_pays";
|
||||||
|
$sql .= " WHERE rowid=$id";
|
||||||
|
|
||||||
|
if ($this->db->query($sql))
|
||||||
|
{
|
||||||
|
$num = $this->db->num_rows();
|
||||||
|
|
||||||
|
if ($num)
|
||||||
|
{
|
||||||
|
$obj = $this->db->fetch_object(0);
|
||||||
|
print $obj->libelle;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print "Non définit";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
print '</select>';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Retourne la liste déroulante des civilite actives
|
* Retourne la liste déroulante des civilite actives
|
||||||
@ -132,7 +163,7 @@ class Form {
|
|||||||
{
|
{
|
||||||
print '<select name="civilite_id">';
|
print '<select name="civilite_id">';
|
||||||
|
|
||||||
$sql = "SELECT rowid, civilite, active FROM llx_c_civilite";
|
$sql = "SELECT rowid, civilite, active FROM ".MAIN_DB_PREFIX."c_civilite";
|
||||||
$sql .= " WHERE active = 1";
|
$sql .= " WHERE active = 1";
|
||||||
|
|
||||||
if ($this->db->query($sql))
|
if ($this->db->query($sql))
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user