Qual: Rorganisation un peu plus logique de certaines fonctions. Rduction de la taille du fichier html.form.class.php qui est charg a chaque fois et qui consomme a lui seul 1Mo
This commit is contained in:
parent
5e1319760c
commit
7fc0d6591d
@ -26,6 +26,7 @@
|
||||
*/
|
||||
|
||||
require("./pre.inc.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/lib/company.lib.php");
|
||||
|
||||
$langs->load("admin");
|
||||
$langs->load("companies");
|
||||
@ -580,7 +581,7 @@ else
|
||||
// Forme juridique
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td width="35%">'.$langs->trans("JuridicalStatus").'</td><td>';
|
||||
print $form->forme_juridique_name($conf->global->MAIN_INFO_SOCIETE_FORME_JURIDIQUE,1);
|
||||
print getFormeJuridiqueLabel($conf->global->MAIN_INFO_SOCIETE_FORME_JURIDIQUE,1);
|
||||
print '</td></tr>';
|
||||
|
||||
// ProfId1
|
||||
|
||||
@ -618,11 +618,12 @@ if ($step == 4 && $datatoexport)
|
||||
print '</td><td width="50%"> </td></tr>';
|
||||
print '</table>';
|
||||
|
||||
// test d'affichage du tableau excel et csv
|
||||
|
||||
|
||||
// Test d'affichage du tableau excel et csv
|
||||
//print '<table width="100%"><tr><td>';
|
||||
//viewExcelFileContent($conf->export->dir_temp.'/1/export_commande_1.xls',5,3);
|
||||
//viewCsvFileContent($conf->export->dir_temp.'/1/export_commande_1.csv',5);
|
||||
//require_once(DOL_DOCUMENT_ROOT.'/lib/viewfiles.lib.php');
|
||||
//viewExcelFileContent($conf->export->dir_temp.'/1/export_member_1.xls',5,3);
|
||||
//viewCsvFileContent($conf->export->dir_temp.'/1/export_member_1.csv',5);
|
||||
//print '</td></tr></table>';
|
||||
|
||||
}
|
||||
|
||||
@ -19,7 +19,6 @@
|
||||
* or see http://www.gnu.org/
|
||||
*
|
||||
* $Id$
|
||||
* $Source$
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -33,6 +32,7 @@
|
||||
require_once(DOL_DOCUMENT_ROOT."/fourn/commande/modules/modules_commandefournisseur.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/fourn/fournisseur.commande.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/product.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/lib/company.lib.php");
|
||||
|
||||
|
||||
/**
|
||||
@ -779,13 +779,11 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
|
||||
|
||||
$outputlangs->load("dict");
|
||||
|
||||
$html=new Form($this->db);
|
||||
|
||||
// Premiere ligne d'info réglementaires
|
||||
$ligne1="";
|
||||
if ($this->emetteur->forme_juridique_code)
|
||||
{
|
||||
$ligne1.=($ligne1?" - ":"").$html->forme_juridique_name($this->emetteur->forme_juridique_code);
|
||||
$ligne1.=($ligne1?" - ":"").getFormeJuridiqueLabel($this->emetteur->forme_juridique_code);
|
||||
}
|
||||
if ($this->emetteur->capital)
|
||||
{
|
||||
|
||||
@ -195,6 +195,7 @@ class Form
|
||||
if ($pays_code) $sql .= " AND p.code = '".$pays_code."'";
|
||||
$sql .= " ORDER BY p.code, d.code_departement";
|
||||
|
||||
dolibarr_syslog("Form::select_departement sql=".$sql);
|
||||
$result=$this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
@ -263,6 +264,7 @@ class Form
|
||||
$sql = "SELECT r.rowid, r.code_region as code, r.nom as libelle, r.active, p.libelle as libelle_pays FROM ".MAIN_DB_PREFIX."c_regions as r, ".MAIN_DB_PREFIX."c_pays as p";
|
||||
$sql .= " WHERE r.fk_pays=p.rowid AND r.active = 1 and p.active = 1 ORDER BY libelle_pays, libelle ASC";
|
||||
|
||||
dolibarr_syslog("Form::select_region sql=".$sql);
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
print '<select class="flat" name="'.$htmlname.'">';
|
||||
@ -341,6 +343,7 @@ class Form
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_methode_commande_fournisseur";
|
||||
$sql.= " WHERE active = 1";
|
||||
|
||||
dolibarr_syslog("Form::select_methodes_commande sql=".$sql);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -390,8 +393,9 @@ class Form
|
||||
$sql.= " AND code = '".$selected."'";
|
||||
}
|
||||
}
|
||||
$sql.= " ORDER BY code ASC;";
|
||||
$sql.= " ORDER BY code ASC";
|
||||
|
||||
dolibarr_syslog("Form::select_pays sql=".$sql);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -572,8 +576,9 @@ class Form
|
||||
* \param filter Criteres optionnels de filtre
|
||||
*/
|
||||
function select_societes($selected='',$htmlname='socid',$filter='',$showempty=0)
|
||||
{
|
||||
global $conf;
|
||||
{
|
||||
global $conf;
|
||||
|
||||
// On recherche les societes
|
||||
$sql = "SELECT s.rowid, s.nom FROM";
|
||||
$sql.= " ".MAIN_DB_PREFIX ."societe as s";
|
||||
@ -592,7 +597,7 @@ class Form
|
||||
}
|
||||
$sql.= " ORDER BY nom ASC";
|
||||
|
||||
dolibarr_syslog("Html.form::select_societe sql=".$sql);
|
||||
dolibarr_syslog("Form::select_societes sql=".$sql);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -672,6 +677,7 @@ class Form
|
||||
if ($filter) $sql.= " AND ".$filter;
|
||||
$sql.= " ORDER BY re.description ASC";
|
||||
|
||||
dolibarr_syslog("Form::select_remises sql=".$sql);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -734,6 +740,7 @@ class Form
|
||||
if (is_array($exclude) && $excludeContacts) $sql.= " AND s.rowid NOT IN ('".$excludeContacts."')";
|
||||
$sql.= " ORDER BY s.name ASC";
|
||||
|
||||
dolibarr_syslog("Form::select_contacts sql=".$sql);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -799,6 +806,7 @@ class Form
|
||||
if (is_array($exclude) && $excludeUsers) $sql.= " WHERE u.rowid NOT IN ('".$excludeUsers."')";
|
||||
$sql.= " ORDER BY u.name ASC";
|
||||
|
||||
dolibarr_syslog("Form::select_users sql=".$sql);
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
print '<select class="flat" name="'.$htmlname.'">';
|
||||
@ -842,6 +850,7 @@ class Form
|
||||
function select_produits($selected='',$htmlname='productid',$filtretype='',$limit=20,$price_level=0)
|
||||
{
|
||||
global $langs,$conf;
|
||||
|
||||
if ($conf->global->PRODUIT_USE_SEARCH_TO_SELECT)
|
||||
{
|
||||
print '<table class="nobordernopadding"><tr class="nocellnopadd">';
|
||||
@ -901,8 +910,7 @@ class Form
|
||||
$sql.= " ORDER BY p.nbvente DESC";
|
||||
if ($limit) $sql.= " LIMIT $limit";
|
||||
|
||||
dolibarr_syslog("Form::select_produits_do sql=$sql",LOG_DEBUG);
|
||||
|
||||
dolibarr_syslog("Form::select_produits_do sql=".$sql, LOG_DEBUG);
|
||||
$result=$this->db->query($sql);
|
||||
if (! $result) dolibarr_print_error($this->db);
|
||||
|
||||
@ -913,6 +921,8 @@ class Form
|
||||
$sqld.= " FROM ".MAIN_DB_PREFIX."product as p, ".MAIN_DB_PREFIX."product_det as d ";
|
||||
$sqld.= " WHERE d.fk_product=p.rowid AND p.envente=1 AND d.lang='". $langs->getDefaultLang() ."'";
|
||||
$sqld.= " ORDER BY p.nbvente DESC";
|
||||
|
||||
dolibarr_syslog("Form::select_departement sql=".$sql, LOG_DEBUG);
|
||||
$resultd = $this->db->query($sqld);
|
||||
if ( $resultd ) $objtp = $this->db->fetch_object($resultd);
|
||||
}
|
||||
@ -964,6 +974,8 @@ class Form
|
||||
$sql.= "FROM ".MAIN_DB_PREFIX."product_price ";
|
||||
$sql.= "where fk_product='".$objp->rowid."' and price_level=".$price_level;
|
||||
$sql.= " order by date_price DESC limit 1";
|
||||
|
||||
dolibarr_syslog("Form::select_produits_do sql=".$sql);
|
||||
$result2 = $this->db->query($sql);
|
||||
$objp2 = $this->db->fetch_object($result2);
|
||||
if ($objp2)
|
||||
@ -1068,8 +1080,7 @@ class Form
|
||||
if ($ajaxkeysearch && $ajaxkeysearch != '') $sql.=" AND (pf.ref_fourn like '%".$ajaxkeysearch."%' OR p.label like '%".$ajaxkeysearch."%')";
|
||||
$sql.= " ORDER BY pf.ref_fourn DESC";
|
||||
|
||||
dolibarr_syslog("Form::select_produits_fournisseurs sql=".$sql,LOG_DEBUG);
|
||||
|
||||
dolibarr_syslog("Form::select_produits_fournisseurs_do sql=".$sql,LOG_DEBUG);
|
||||
$result=$this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
@ -1167,8 +1178,7 @@ class Form
|
||||
$sql.= " AND p.rowid = ".$productid;
|
||||
$sql.= " ORDER BY s.nom, pf.ref_fourn DESC";
|
||||
|
||||
dolibarr_syslog("Form::select_product_fourn_price sql=$sql",LOG_DEBUG);
|
||||
|
||||
dolibarr_syslog("Form::select_product_fourn_price sql=".$sql,LOG_DEBUG);
|
||||
$result=$this->db->query($sql);
|
||||
|
||||
if ($result)
|
||||
@ -1245,6 +1255,7 @@ class Form
|
||||
$sql .= " WHERE a.fk_societe = ".$socid;
|
||||
$sql .= " ORDER BY a.label ASC";
|
||||
|
||||
dolibarr_syslog("Form::select_adresse_livraison sql=".$sql);
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
print '<select class="flat" name="'.$htmlname.'">';
|
||||
@ -1288,7 +1299,6 @@ class Form
|
||||
if (sizeof($this->cache_conditions_paiements)) return 0; // Cache déja chargé
|
||||
|
||||
dolibarr_syslog('Form::load_cache_conditions_paiements',LOG_DEBUG);
|
||||
|
||||
$sql = "SELECT rowid, code, libelle";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."cond_reglement";
|
||||
$sql.= " WHERE active=1";
|
||||
@ -1327,7 +1337,6 @@ class Form
|
||||
if (sizeof($this->cache_types_paiements)) return 0; // Cache déja chargé
|
||||
|
||||
dolibarr_syslog('Form::load_cache_types_paiements',LOG_DEBUG);
|
||||
|
||||
$sql = "SELECT id, code, libelle, type";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_paiement";
|
||||
$sql.= " WHERE active > 0";
|
||||
@ -1472,6 +1481,7 @@ class Form
|
||||
$sql = "SELECT id, code, label, active FROM ".MAIN_DB_PREFIX."c_propalst";
|
||||
$sql .= " WHERE active = 1";
|
||||
|
||||
dolibarr_syslog("Form::select_propal_statut sql=".$sql);
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
print '<select class="flat" name="propal_statut">';
|
||||
@ -1524,6 +1534,8 @@ class Form
|
||||
$sql.= " WHERE clos = '".$statut."'";
|
||||
if ($filtre) $sql.=" AND ".$filtre;
|
||||
$sql.= " ORDER BY rowid";
|
||||
|
||||
dolibarr_syslog("Form::select_comptes sql=".$sql);
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
@ -1613,6 +1625,7 @@ class Form
|
||||
$sql = "SELECT rowid, code, civilite, active FROM ".MAIN_DB_PREFIX."c_civilite";
|
||||
$sql .= " WHERE active = 1";
|
||||
|
||||
dolibarr_syslog("Form::select_civilite sql=".$sql);
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
print '<select class="flat" name="civilite_id">';
|
||||
@ -1666,6 +1679,7 @@ class Form
|
||||
if ($pays_code) $sql .= " AND p.code = '".$pays_code."'";
|
||||
$sql .= " ORDER BY p.code, f.code";
|
||||
|
||||
dolibarr_syslog("Form::select_forme_juridique sql=".$sql);
|
||||
$result=$this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
@ -1717,39 +1731,6 @@ class Form
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Retourne le nom traduit de la forme juridique
|
||||
* \param code Code de la forme juridique
|
||||
* \return string Nom traduit du pays
|
||||
*/
|
||||
function forme_juridique_name($code)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
if (! $code) return '';
|
||||
|
||||
$sql = "SELECT libelle FROM ".MAIN_DB_PREFIX."c_forme_juridique";
|
||||
$sql.= " WHERE code='$code';";
|
||||
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
$num = $this->db->num_rows();
|
||||
|
||||
if ($num)
|
||||
{
|
||||
$obj = $this->db->fetch_object();
|
||||
$label=($obj->libelle!='-' ? $obj->libelle : '');
|
||||
return $label;
|
||||
}
|
||||
else
|
||||
{
|
||||
return $langs->trans("NotDefined");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Affiche formulaire de demande de confirmation
|
||||
* \param page page
|
||||
|
||||
@ -30,6 +30,7 @@
|
||||
|
||||
require_once(DOL_DOCUMENT_ROOT ."/includes/modules/commande/modules_commande.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/product.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/lib/company.lib.php");
|
||||
|
||||
|
||||
/**
|
||||
@ -934,13 +935,11 @@ class pdf_einstein extends ModelePDFCommandes
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$html=new Form($this->db);
|
||||
|
||||
// Premiere ligne d'info réglementaires
|
||||
$ligne1="";
|
||||
if ($this->emetteur->forme_juridique_code)
|
||||
{
|
||||
$ligne1.=($ligne1?" - ":"").$html->forme_juridique_name($this->emetteur->forme_juridique_code);
|
||||
$ligne1.=($ligne1?" - ":"").getFormeJuridiqueLabel($this->emetteur->forme_juridique_code);
|
||||
}
|
||||
if ($this->emetteur->capital)
|
||||
{
|
||||
|
||||
@ -30,6 +30,7 @@
|
||||
|
||||
require_once(DOL_DOCUMENT_ROOT."/includes/modules/facture/modules_facture.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/product.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/lib/company.lib.php");
|
||||
|
||||
|
||||
/**
|
||||
@ -1127,13 +1128,11 @@ class pdf_crabe extends ModelePDFFactures
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$html=new Form($this->db);
|
||||
|
||||
// Premiere ligne d'info réglementaires
|
||||
$ligne1="";
|
||||
if ($this->emetteur->forme_juridique_code)
|
||||
{
|
||||
$ligne1.=($ligne1?" - ":"").$html->forme_juridique_name($this->emetteur->forme_juridique_code);
|
||||
$ligne1.=($ligne1?" - ":"").getFormeJuridiqueLabel($this->emetteur->forme_juridique_code);
|
||||
}
|
||||
if ($this->emetteur->capital)
|
||||
{
|
||||
|
||||
@ -28,6 +28,7 @@
|
||||
*/
|
||||
|
||||
require_once(DOL_DOCUMENT_ROOT."/includes/modules/fichinter/modules_fichinter.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/lib/company.lib.php");
|
||||
|
||||
|
||||
/**
|
||||
@ -284,13 +285,11 @@ class pdf_soleil extends ModelePDFFicheinter
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$html=new Form($this->db);
|
||||
|
||||
// Premiere ligne d'info reglementaires
|
||||
$ligne1="";
|
||||
if ($this->emetteur->forme_juridique_code)
|
||||
{
|
||||
$ligne1.=($ligne1?" - ":"").$html->forme_juridique_name($this->emetteur->forme_juridique_code);
|
||||
$ligne1.=($ligne1?" - ":"").getFormeJuridiqueLabel($this->emetteur->forme_juridique_code);
|
||||
}
|
||||
if ($this->emetteur->capital)
|
||||
{
|
||||
|
||||
@ -28,8 +28,9 @@
|
||||
\version $Revision$
|
||||
*/
|
||||
|
||||
require_once(DOL_DOCUMENT_ROOT ."/includes/modules/propale/modules_propale.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/includes/modules/propale/modules_propale.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/product.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/lib/company.lib.php");
|
||||
|
||||
|
||||
/**
|
||||
@ -966,13 +967,11 @@ class pdf_propale_azur extends ModelePDFPropales
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$html=new Form($this->db);
|
||||
|
||||
// Premiere ligne d'info réglementaires
|
||||
$ligne1="";
|
||||
if ($this->emetteur->forme_juridique_code)
|
||||
{
|
||||
$ligne1.=($ligne1?" - ":"").$html->forme_juridique_name($this->emetteur->forme_juridique_code);
|
||||
$ligne1.=($ligne1?" - ":"").getFormeJuridiqueLabel($this->emetteur->forme_juridique_code);
|
||||
}
|
||||
if ($this->emetteur->capital)
|
||||
{
|
||||
|
||||
@ -142,7 +142,7 @@ function getCountryLabel($id,$withcode=0)
|
||||
$sql = "SELECT rowid, code, libelle FROM ".MAIN_DB_PREFIX."c_pays";
|
||||
$sql.= " WHERE rowid=".$id;
|
||||
|
||||
dolibarr_syslog("company.lib.php sql=".$sql);
|
||||
dolibarr_syslog("Company.lib::getCountryLabel sql=".$sql);
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -162,6 +162,41 @@ function getCountryLabel($id,$withcode=0)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Retourne le nom traduit de la forme juridique
|
||||
* \param code Code de la forme juridique
|
||||
* \return string Nom traduit du pays
|
||||
*/
|
||||
function getFormeJuridiqueLabel($code)
|
||||
{
|
||||
global $db,$langs;
|
||||
|
||||
if (! $code) return '';
|
||||
|
||||
$sql = "SELECT libelle FROM ".MAIN_DB_PREFIX."c_forme_juridique";
|
||||
$sql.= " WHERE code='$code'";
|
||||
|
||||
dolibarr_syslog("Company.lib::getFormeJuridiqueLabel sql=".$sql);
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
if ($num)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
$label=($obj->libelle!='-' ? $obj->libelle : '');
|
||||
return $label;
|
||||
}
|
||||
else
|
||||
{
|
||||
return $langs->trans("NotDefined");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Show html area with actions to do
|
||||
*/
|
||||
|
||||
@ -31,6 +31,7 @@
|
||||
|
||||
require_once(DOL_DOCUMENT_ROOT."/livraison/mods/modules_livraison.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/livraison/livraison.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/lib/company.lib.php");
|
||||
|
||||
|
||||
/**
|
||||
@ -792,13 +793,11 @@ class pdf_typhon extends ModelePDFDeliveryOrder
|
||||
$langs->load("bills");
|
||||
$langs->load("companies");
|
||||
|
||||
$html=new Form($this->db);
|
||||
|
||||
// Premiere ligne d'info réglementaires
|
||||
$ligne1="";
|
||||
if ($conf->global->MAIN_INFO_SOCIETE_FORME_JURIDIQUE)
|
||||
{
|
||||
$ligne1.=($ligne1?" - ":"").$html->forme_juridique_name($conf->global->MAIN_INFO_SOCIETE_FORME_JURIDIQUE);
|
||||
$ligne1.=($ligne1?" - ":"").getFormeJuridiqueLabel($conf->global->MAIN_INFO_SOCIETE_FORME_JURIDIQUE);
|
||||
}
|
||||
if ($conf->global->MAIN_INFO_CAPITAL)
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user