Gestion des formes juridiques pour tous les pays actifs dans la liste droulante des formes juridiques
This commit is contained in:
parent
95dbaf6b26
commit
4f69253b24
@ -453,7 +453,7 @@ if ($socid > 0)
|
||||
*
|
||||
*/
|
||||
print '<table width="100%" cellspacing=0 border=0 cellpadding=2>';
|
||||
print '<tr class="liste_titre"><td>Actions à faire</td><td align="right"> [<a href="action/fiche.php?action=create&socid='.$socid.'&afaire=1">Nouvelle action</a>]</td></tr>';
|
||||
print '<tr class="liste_titre"><td><a href="action/index.php?socid='.$socid.'">Actions à faire</a></td><td align="right"> <a href="action/fiche.php?action=create&socid='.$socid.'&afaire=1">Nouvelle action</a></td></tr>';
|
||||
print '<tr>';
|
||||
print '<td colspan="2" valign="top">';
|
||||
|
||||
@ -531,7 +531,7 @@ if ($socid > 0)
|
||||
* Listes des actions effectuees
|
||||
*
|
||||
*/
|
||||
print '<table width="100%" cellspacing=0 border=0 cellpadding=2>';
|
||||
print '<table class="noborder" width="100%" cellspacing=0 cellpadding=2>';
|
||||
print '<tr class="liste_titre"><td><a href="action/index.php?socid='.$socid.'">Actions effectuées</a></td></tr>';
|
||||
print '<tr>';
|
||||
print '<td valign="top">';
|
||||
@ -585,11 +585,11 @@ if ($socid > 0)
|
||||
|
||||
if ($obj->propalrowid)
|
||||
{
|
||||
print '<td width="40%"><a href="propal.php?propalid='.$obj->propalrowid.'">'.$obj->libelle.'</a></td>';
|
||||
print '<td width="40%"><a href="'.DOL_URL_ROOT.'/comm/propal.php?propalid='.$obj->propalrowid.'">'.$obj->libelle.'</a></td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td width="40%"><a href="action/fiche.php?id='.$obj->id.'">'.$obj->libelle.'</a></td>';
|
||||
print '<td width="40%"><a href="'.DOL_URL_ROOT.'/comm/action/fiche.php?id='.$obj->id.'">'.$obj->libelle.'</a></td>';
|
||||
}
|
||||
/*
|
||||
* Contact pour cette action
|
||||
|
||||
@ -415,20 +415,18 @@ if ($socid > 0)
|
||||
$i++;
|
||||
$tag = !$tag;
|
||||
}
|
||||
print "</table>";
|
||||
print "</table><br>";
|
||||
|
||||
print "\n<hr noshade size=1>\n";
|
||||
/*
|
||||
*
|
||||
* Listes des actions effectuées
|
||||
*
|
||||
*/
|
||||
print '<table width="100%" cellspacing=0 border=0 cellpadding=2>';
|
||||
print '<tr class="liste_titre"><td><a href="action/index.php?socid='.$socid.'">Actions effectuées</a></td></tr>';
|
||||
print '<tr>';
|
||||
print '<td valign="top">';
|
||||
/*
|
||||
*
|
||||
* Listes des actions
|
||||
*
|
||||
*/
|
||||
|
||||
$sql = "SELECT a.id, ".$db->pdate("a.datea")." as da, c.libelle, u.code, a.propalrowid, a.fk_user_author, fk_contact, u.rowid ";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."actioncomm as a, ".MAIN_DB_PREFIX."c_actioncomm as c, ".MAIN_DB_PREFIX."user as u ";
|
||||
$sql .= " WHERE a.fk_soc = $objsoc->idp ";
|
||||
@ -465,11 +463,15 @@ if ($socid > 0)
|
||||
|
||||
print '<td width="10%"> </td>';
|
||||
|
||||
if ($obj->propalrowid) {
|
||||
print '<td width="40%"><a href="propal.php?propalid='.$obj->propalrowid.'">'.$obj->libelle.'</a></td>';
|
||||
} else {
|
||||
print '<td width="40%">'.$obj->libelle.'</td>';
|
||||
}
|
||||
if ($obj->propalrowid)
|
||||
{
|
||||
print '<td width="40%"><a href="'.DOL_URL_ROOT.'/comm/propal.php?propalid='.$obj->propalrowid.'">'.$obj->libelle.'</a></td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td width="40%"><a href="'.DOL_URL_ROOT.'/comm/action/fiche.php?id='.$obj->id.'">'.$obj->libelle.'</a></td>';
|
||||
}
|
||||
|
||||
/*
|
||||
* Contact pour cette action
|
||||
*
|
||||
@ -494,6 +496,7 @@ if ($socid > 0)
|
||||
print $db->error();
|
||||
}
|
||||
print "</td></tr></table>";
|
||||
|
||||
/*
|
||||
*
|
||||
* Notes sur la societe
|
||||
|
||||
@ -38,7 +38,7 @@ class Form {
|
||||
* avec un affichage avec rupture sur le pays
|
||||
*
|
||||
*/
|
||||
Function select_departement($selected='', $addnsp=0)
|
||||
Function select_departement($selected='')
|
||||
{
|
||||
print '<select name="departement_id">';
|
||||
|
||||
@ -90,7 +90,7 @@ class Form {
|
||||
* Retourne la liste déroulante des pays actifs
|
||||
*
|
||||
*/
|
||||
Function select_pays($selected='', $addnsp=0)
|
||||
Function select_pays($selected='')
|
||||
{
|
||||
print '<select name="pays_id">';
|
||||
|
||||
@ -121,6 +121,59 @@ class Form {
|
||||
print '</select>';
|
||||
}
|
||||
|
||||
/*
|
||||
* Retourne la liste déroulante des formes juridiques
|
||||
* avec un affichage avec rupture sur le pays
|
||||
*
|
||||
*/
|
||||
Function select_forme_juridique($selected='')
|
||||
{
|
||||
print '<select name="forme_juridique_id">';
|
||||
|
||||
// On recherche les formes juridiques actives des pays actifs
|
||||
$sql = "SELECT f.rowid, f.code as code , f.libelle as nom, f.active, p.libelle as libelle_pays, p.code as code_pays FROM llx_c_forme_juridique as f, llx_c_pays as p";
|
||||
$sql .= " WHERE f.fk_pays=p.rowid";
|
||||
$sql .= " AND f.active = 1 AND p.active = 1 ORDER BY code_pays, code ASC";
|
||||
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
$num = $this->db->num_rows();
|
||||
$i = 0;
|
||||
if ($num)
|
||||
{
|
||||
$pays='';
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $this->db->fetch_object( $i);
|
||||
if ($obj->code == 0) {
|
||||
print '<option value="0"> </option>';
|
||||
}
|
||||
else {
|
||||
if ($pays == '' || $pays != $obj->libelle_pays) {
|
||||
// Affiche la rupture
|
||||
print '<option value="-1">----- '.$obj->libelle_pays.' -----</option>';
|
||||
$pays=$obj->libelle_pays;
|
||||
}
|
||||
|
||||
if ($selected > 0 && $selected == $obj->rowid)
|
||||
{
|
||||
print '<option value="'.$obj->rowid.'" selected>['.$obj->code.'] '.$obj->nom.'</option>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<option value="'.$obj->rowid.'">['.$obj->code.'] '.$obj->nom.'</option>';
|
||||
}
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
print "Erreur : $sql : ".$this->db->error();
|
||||
}
|
||||
print '</select>';
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*
|
||||
|
||||
@ -75,6 +75,9 @@ $form = new Form($db);
|
||||
|
||||
if ($action == 'create')
|
||||
{
|
||||
/*
|
||||
* Fiche societe en mode création
|
||||
*/
|
||||
$soc = new Societe($db);
|
||||
print '<div class="titre">Nouvelle société (prospect, client, fournisseur)</div><br>';
|
||||
print '<form action="soc.php" method="post">';
|
||||
@ -88,7 +91,7 @@ if ($action == 'create')
|
||||
print 'Ville <input type="text" name="ville"></td>';
|
||||
|
||||
print '<td>Département</td><td>';
|
||||
print $form->select_departement(0);
|
||||
print $form->select_departement($soc->departement_id);
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td>Pays</td><td colspan="3">';
|
||||
@ -108,7 +111,7 @@ if ($action == 'create')
|
||||
print '<td>Capital</td><td><input type="text" name="capital" size="10" value="'.$soc->capital.'"> '.MAIN_MONNAIE.'</td></tr>';
|
||||
|
||||
print '<tr><td>Forme juridique</td><td colspan="3">';
|
||||
print $form->select_array("forme_juridique_id",$soc->forme_juridique_array(), $soc->forme_juridique, 0, 1);
|
||||
print $form->select_forme_juridique($soc->forme_juridique_id);
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td>Effectif</td><td colspan="3">';
|
||||
@ -123,7 +126,7 @@ if ($action == 'create')
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td>Prospect / Client</td><td><select name="client">';
|
||||
print '<option value="2" SELECTED>Prospect';
|
||||
print '<option value="2" selected>Prospect';
|
||||
print '<option value="1">Client';
|
||||
print '<option value="0">Ni client, ni prospect';
|
||||
print '</select></td>';
|
||||
@ -138,6 +141,10 @@ if ($action == 'create')
|
||||
}
|
||||
elseif ($action == 'edit')
|
||||
{
|
||||
/*
|
||||
* Fiche societe en mode edition
|
||||
*/
|
||||
|
||||
print_titre("Edition de la société");
|
||||
|
||||
if ($socid)
|
||||
@ -177,12 +184,11 @@ elseif ($action == 'edit')
|
||||
|
||||
|
||||
print '<tr><td>Forme juridique</td><td colspan="3">';
|
||||
$html = new Form($db);
|
||||
print $html->select_array("forme_juridique_id",$soc->forme_juridique_array(), $soc->forme_juridique_id,0,1);
|
||||
print $form->select_forme_juridique($soc->forme_juridique_id);
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td>Effectif</td><td colspan="3">';
|
||||
print $html->select_array("effectif_id",$soc->effectif_array(), $soc->effectif_id);
|
||||
print $form->select_array("effectif_id",$soc->effectif_array(), $soc->effectif_id);
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td colspan="2">Numéro de TVA Intracommunautaire</td><td colspan="2">';
|
||||
@ -195,21 +201,21 @@ elseif ($action == 'edit')
|
||||
print '<tr><td>Prospect / Client</td><td><select name="client">';
|
||||
if ($soc->client == 2)
|
||||
{
|
||||
print '<option value="2" SELECTED>Prospect</option>';
|
||||
print '<option value="2" selected>Prospect</option>';
|
||||
print '<option value="1">Client</option>';
|
||||
print '<option value="0">Ni client, ni prospect</option>';
|
||||
}
|
||||
elseif ($soc->client == 1)
|
||||
{
|
||||
print '<option value="2">Prospect</option>';
|
||||
print '<option value="1" SELECTED>Client</option>';
|
||||
print '<option value="1" selected>Client</option>';
|
||||
print '<option value="0">Ni client, ni prospect</option>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<option value="2">Prospect</option>';
|
||||
print '<option value="1">Client</option>';
|
||||
print '<option value="0" SELECTED>Ni client, ni prospect</option>';
|
||||
print '<option value="0" selected>Ni client, ni prospect</option>';
|
||||
}
|
||||
|
||||
print '</select></td>';
|
||||
|
||||
@ -31,10 +31,13 @@ class Societe {
|
||||
var $adresse;
|
||||
var $cp;
|
||||
var $ville;
|
||||
var $departement_id;
|
||||
var $pays_id;
|
||||
var $tel;
|
||||
var $fax;
|
||||
var $url;
|
||||
var $siren;
|
||||
var $forme_juridique_id;
|
||||
var $client;
|
||||
var $note;
|
||||
var $fournisseur;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user