New: Ajout de la forme juridique dans la configuration globale de sa socit (requis dans les factures).
This commit is contained in:
parent
76d39158ca
commit
6b64aa40ac
@ -35,108 +35,186 @@ if (!$user->admin)
|
||||
accessforbidden();
|
||||
|
||||
|
||||
if (isset($_POST["action"]) && $_POST["action"] == 'update')
|
||||
if ( (isset($_POST["action"]) && $_POST["action"] == 'update')
|
||||
|| (isset($_POST["action"]) && $_POST["action"] == 'updateedit') )
|
||||
{
|
||||
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_NOM",$_POST["nom"]);
|
||||
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_ADRESSE",$_POST["address"]);
|
||||
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_PAYS",$_POST["pays_id"]);
|
||||
dolibarr_set_const($db, "MAIN_MONNAIE",$_POST["currency"]);
|
||||
dolibarr_set_const($db, "MAIN_INFO_CAPITAL",$_POST["capital"]);
|
||||
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_NOM",$_POST["nom"]);
|
||||
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_ADRESSE",$_POST["address"]);
|
||||
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_PAYS",$_POST["pays_id"]);
|
||||
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_FORME_JURIDIQUE",$_POST["forme_juridique_code"]);
|
||||
dolibarr_set_const($db, "MAIN_MONNAIE",$_POST["currency"]);
|
||||
dolibarr_set_const($db, "MAIN_INFO_CAPITAL",$_POST["capital"]);
|
||||
|
||||
dolibarr_set_const($db, "MAIN_INFO_SIREN",$_POST["siren"]);
|
||||
dolibarr_set_const($db, "MAIN_INFO_SIRET",$_POST["siret"]);
|
||||
dolibarr_set_const($db, "MAIN_INFO_APE",$_POST["ape"]);
|
||||
dolibarr_set_const($db, "MAIN_INFO_TVAINTRA",$_POST["tva"]);
|
||||
dolibarr_set_const($db, "MAIN_INFO_SIREN",$_POST["siren"]);
|
||||
dolibarr_set_const($db, "MAIN_INFO_SIRET",$_POST["siret"]);
|
||||
dolibarr_set_const($db, "MAIN_INFO_APE",$_POST["ape"]);
|
||||
dolibarr_set_const($db, "MAIN_INFO_TVAINTRA",$_POST["tva"]);
|
||||
|
||||
Header("Location: index.php");
|
||||
if ($_POST['action'] != 'updateedit')
|
||||
{
|
||||
Header("Location: index.php");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
llxHeader();
|
||||
|
||||
$form = new Form($db);
|
||||
$countrynotdefined='<font class="error">'.$langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')</font>';
|
||||
|
||||
|
||||
print_titre($langs->trans("GlobalSetup"));
|
||||
|
||||
|
||||
print "<br>\n";
|
||||
|
||||
if (isset($_GET["action"]) && $_GET["action"] == 'edit')
|
||||
if ((isset($_GET["action"]) && $_GET["action"] == 'edit')
|
||||
|| (isset($_POST["action"]) && $_POST["action"] == 'updateedit') )
|
||||
{
|
||||
/*
|
||||
* Edition des paramètres
|
||||
*/
|
||||
print '<form method="post" action="index.php">';
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
/*
|
||||
* Edition des paramètres
|
||||
*/
|
||||
print '
|
||||
<script language="javascript" type="text/javascript">
|
||||
<!--
|
||||
function save_refresh()
|
||||
{
|
||||
document.form_index.action.value="updateedit";
|
||||
document.form_index.submit();
|
||||
// location.href = "index.php?action=updateedit";
|
||||
}
|
||||
-->
|
||||
</script>
|
||||
';
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("CompanyInfo").'</td></tr>';
|
||||
print '<form method="post" action="index.php" name="form_index">';
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
$var=true;
|
||||
|
||||
print '<tr class="pair"><td>'.$langs->trans("CompanyName").'</td><td>';
|
||||
print '<input name="nom" value="'. MAIN_INFO_SOCIETE_NOM . '"></td></tr>';
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("CompanyInfo").'</td></tr>';
|
||||
|
||||
print '<tr class="impair"><td>'.$langs->trans("CompanyAddress").'</td><td>';
|
||||
print '<textarea name="address" cols="50" rows="3">'. MAIN_INFO_SOCIETE_ADRESSE . '</textarea></td></tr>';
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("CompanyName").'</td><td>';
|
||||
print '<input name="nom" value="'. $conf->global->MAIN_INFO_SOCIETE_NOM . '"></td></tr>';
|
||||
|
||||
print '<tr class="pair"><td>'.$langs->trans("Country").'</td><td>';
|
||||
$form->select_pays(MAIN_INFO_SOCIETE_PAYS);
|
||||
print '</td></tr>';
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("CompanyAddress").'</td><td>';
|
||||
print '<textarea name="address" cols="50" rows="2">'. $conf->global->MAIN_INFO_SOCIETE_ADRESSE . '</textarea></td></tr>';
|
||||
|
||||
print '<tr class="impair"><td>'.$langs->trans("CompanyCurrency").'</td><td>';
|
||||
$form->select_currency(MAIN_MONNAIE,"currency");
|
||||
print '</td></tr>';
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("Country").'</td><td>';
|
||||
$form->select_pays($conf->global->MAIN_INFO_SOCIETE_PAYS,'pays_id',' onChange="save_refresh()"');
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr class="pair"><td width="35%">'.$langs->trans("Capital").'</td><td>';
|
||||
print '<input name="capital" size="20" value="' . MAIN_INFO_CAPITAL . '"></td></tr>';
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("CompanyCurrency").'</td><td>';
|
||||
$form->select_currency($conf->global->MAIN_MONNAIE,"currency");
|
||||
print '</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td width="35%">'.$langs->trans("Capital").'</td><td>';
|
||||
print '<input name="capital" size="20" value="' . $conf->global->MAIN_INFO_CAPITAL . '"></td></tr>';
|
||||
|
||||
print '<br>';
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td>'.$langs->trans("CompanyIds").'</td><td>'.$langs->trans("Value").'</td></tr>';
|
||||
print '</table>';
|
||||
|
||||
$langs->load("companies");
|
||||
print '<br>';
|
||||
|
||||
// Recupere code pays
|
||||
$code_pays=substr($langs->defaultlang,-2); // Par defaut, pays de la localisation
|
||||
$sql = "SELECT code from ".MAIN_DB_PREFIX."c_pays";
|
||||
$sql .= " WHERE rowid = ".MAIN_INFO_SOCIETE_PAYS;
|
||||
$result=$db->query($sql);
|
||||
if ($result) {
|
||||
$obj = $db->fetch_object();
|
||||
if ($obj->code) $code_pays=$obj->code;
|
||||
}
|
||||
else {
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
|
||||
if ($langs->transcountry("ProfId1",$code_pays) != '-')
|
||||
{
|
||||
print '<tr class="impair"><td width="35%">'.$langs->transcountry("ProfId1",$code_pays).'</td><td>';
|
||||
print '<input name="siren" size="20" value="' . MAIN_INFO_SIREN . '"></td></tr>';
|
||||
}
|
||||
|
||||
if ($langs->transcountry("ProfId2",$code_pays) != '-')
|
||||
{
|
||||
print '<tr class="pair"><td width="35%">'.$langs->transcountry("ProfId2",$code_pays).'</td><td>';
|
||||
print '<input name="siret" size="20" value="' . MAIN_INFO_SIRET . '"></td></tr>';
|
||||
}
|
||||
// Identifiants de la société (propre au pays)
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td>'.$langs->trans("CompanyIds").'</td><td>'.$langs->trans("Value").'</td></tr>';
|
||||
$var=true;
|
||||
|
||||
if ($langs->transcountry("ProfId3",$code_pays) != '-')
|
||||
{
|
||||
print '<tr class="impair"><td width="35%">'.$langs->transcountry("ProfId3",$code_pays).'</td><td>';
|
||||
print '<input name="ape" size="20" value="' . MAIN_INFO_APE . '"></td></tr>';
|
||||
}
|
||||
|
||||
print '<tr class="pair"><td width="35%">'.$langs->trans("TVAIntra").'</td><td>';
|
||||
print '<input name="tva" size="20" value="' . MAIN_INFO_TVAINTRA . '"></td></tr>';
|
||||
$langs->load("companies");
|
||||
|
||||
print '</table>';
|
||||
// Recupere code pays
|
||||
$code_pays=substr($langs->defaultlang,-2); // Par defaut, pays de la localisation
|
||||
if ($conf->global->MAIN_INFO_SOCIETE_PAYS)
|
||||
{
|
||||
$sql = "SELECT code from ".MAIN_DB_PREFIX."c_pays";
|
||||
$sql .= " WHERE rowid = ".$conf->global->MAIN_INFO_SOCIETE_PAYS;
|
||||
$result=$db->query($sql);
|
||||
if ($result) {
|
||||
$obj = $db->fetch_object();
|
||||
if ($obj->code) $code_pays=$obj->code;
|
||||
}
|
||||
else {
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
print '<br><center><input type="submit" value="'.$langs->trans("Save").'"></center>';
|
||||
// Forme juridique
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("JuridicalStatus").'</td><td>';
|
||||
if ($conf->global->MAIN_INFO_SOCIETE_PAYS)
|
||||
{
|
||||
$form->select_forme_juridique($conf->global->MAIN_INFO_FORME_JURIDIQUE,$code_pays);
|
||||
}
|
||||
else
|
||||
{
|
||||
print $countrynotdefined;
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
print '</form>';
|
||||
// ProfID1
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td width="35%">'.$langs->transcountry("ProfId1",$code_pays).'</td><td>';
|
||||
if ($conf->global->MAIN_INFO_SOCIETE_PAYS)
|
||||
{
|
||||
if ($langs->transcountry("ProfId1",$code_pays) != '-')
|
||||
{
|
||||
print '<input name="siren" size="20" value="' . $conf->global->MAIN_INFO_SIREN . '">';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print $countrynotdefined;
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
// ProfId2
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td width="35%">'.$langs->transcountry("ProfId2",$code_pays).'</td><td>';
|
||||
if ($conf->global->MAIN_INFO_SOCIETE_PAYS)
|
||||
{
|
||||
if ($langs->transcountry("ProfId2",$code_pays) != '-')
|
||||
{
|
||||
print '<input name="siret" size="20" value="' . $conf->global->MAIN_INFO_SIRET . '">';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print $countrynotdefined;
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
// ProfId3
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td width="35%">'.$langs->transcountry("ProfId3",$code_pays).'</td><td>';
|
||||
if ($conf->global->MAIN_INFO_SOCIETE_PAYS)
|
||||
{
|
||||
if ($langs->transcountry("ProfId3",$code_pays) != '-')
|
||||
{
|
||||
print '<input name="ape" size="20" value="' . $conf->global->MAIN_INFO_APE . '">';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print $countrynotdefined;
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
// TVA Intra
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td width="35%">'.$langs->trans("TVAIntra").'</td><td>';
|
||||
print '<input name="tva" size="20" value="' . $conf->global->MAIN_INFO_TVAINTRA . '"></td></tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '<br><center><input type="submit" value="'.$langs->trans("Save").'"></center>';
|
||||
|
||||
print '</form>';
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -144,71 +222,95 @@ else
|
||||
* Affichage des paramètres
|
||||
*/
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td>'.$langs->trans("CompanyInfo").'</td><td>'.$langs->trans("Value").'</td></tr>';
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td>'.$langs->trans("CompanyInfo").'</td><td>'.$langs->trans("Value").'</td></tr>';
|
||||
$var=true;
|
||||
|
||||
print '<tr class="pair"><td width="35%">'.$langs->trans("CompanyName").'</td><td>' . MAIN_INFO_SOCIETE_NOM . '</td></tr>';
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td width="35%">'.$langs->trans("CompanyName").'</td><td>' . $conf->global->MAIN_INFO_SOCIETE_NOM . '</td></tr>';
|
||||
|
||||
print '<tr class="impair"><td width="35%">'.$langs->trans("CompanyAddress").'</td><td>' . nl2br(MAIN_INFO_SOCIETE_ADRESSE) . '</td></tr>';
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td width="35%">'.$langs->trans("CompanyAddress").'</td><td>' . nl2br($conf->global->MAIN_INFO_SOCIETE_ADRESSE) . '</td></tr>';
|
||||
|
||||
print '<tr class="pair"><td>'.$langs->trans("Country").'</td><td>';
|
||||
print $form->pays_name(MAIN_INFO_SOCIETE_PAYS,1);
|
||||
print '</td></tr>';
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("Country").'</td><td>';
|
||||
print $form->pays_name($conf->global->MAIN_INFO_SOCIETE_PAYS,1);
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr class="impair"><td width="35%">'.$langs->trans("CompanyCurrency").'</td><td>';
|
||||
print $form->currency_name(MAIN_MONNAIE,1);
|
||||
print '</td></tr>';
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td width="35%">'.$langs->trans("CompanyCurrency").'</td><td>';
|
||||
print $form->currency_name($conf->global->MAIN_MONNAIE,1);
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr class="pair"><td width="35%">'.$langs->trans("Capital").'</td><td>';
|
||||
print MAIN_INFO_CAPITAL . '</td></tr>';
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td width="35%">'.$langs->trans("Capital").'</td><td>';
|
||||
print $conf->global->MAIN_INFO_CAPITAL . '</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
print '</table>';
|
||||
|
||||
print '<br>';
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td>'.$langs->trans("CompanyIds").'</td><td>'.$langs->trans("Value").'</td></tr>';
|
||||
print '<br>';
|
||||
|
||||
// Recupere code pays
|
||||
$code_pays=substr($langs->defaultlang,-2); // Par defaut, pays de la localisation
|
||||
$sql = "SELECT code from ".MAIN_DB_PREFIX."c_pays";
|
||||
$sql .= " WHERE rowid = ".MAIN_INFO_SOCIETE_PAYS;
|
||||
$result=$db->query($sql);
|
||||
if ($result) {
|
||||
$obj = $db->fetch_object();
|
||||
if ($obj->code) $code_pays=$obj->code;
|
||||
}
|
||||
else {
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
|
||||
if ($langs->transcountry("ProfId1",$code_pays) != '-')
|
||||
{
|
||||
print '<tr class="impair"><td width="35%">'.$langs->transcountry("ProfId1",$code_pays).'</td><td>';
|
||||
print MAIN_INFO_SIREN . '</td></tr>';
|
||||
}
|
||||
|
||||
if ($langs->transcountry("ProfId2",$code_pays) != '-')
|
||||
{
|
||||
print '<tr class="pair"><td width="35%">'.$langs->transcountry("ProfId2",$code_pays).'</td><td>';
|
||||
print MAIN_INFO_SIRET . '</td></tr>';
|
||||
}
|
||||
|
||||
if ($langs->transcountry("ProfId3",$code_pays) != '-')
|
||||
{
|
||||
print '<tr class="impair"><td width="35%">'.$langs->transcountry("ProfId3",$code_pays).'</td><td>';
|
||||
print MAIN_INFO_APE . '</td></tr>';
|
||||
}
|
||||
|
||||
print '<tr class="pair"><td>'.$langs->trans("TVAIntra").'</td><td>' . MAIN_INFO_TVAINTRA . '</td></tr>';
|
||||
// Identifiants de la société (propre au pays)
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td>'.$langs->trans("CompanyIds").'</td><td>'.$langs->trans("Value").'</td></tr>';
|
||||
$var=true;
|
||||
|
||||
print '</table><br>';
|
||||
// Recupere code pays
|
||||
$code_pays=substr($langs->defaultlang,-2); // Par defaut, pays de la localisation
|
||||
if ($conf->global->MAIN_INFO_SOCIETE_PAYS)
|
||||
{
|
||||
$sql = "SELECT code from ".MAIN_DB_PREFIX."c_pays";
|
||||
$sql .= " WHERE rowid = ".$conf->global->MAIN_INFO_SOCIETE_PAYS;
|
||||
$result=$db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$obj = $db->fetch_object();
|
||||
if ($obj->code) $code_pays=$obj->code;
|
||||
}
|
||||
else {
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
// Boutons d'action
|
||||
print '<div class="tabsAction">';
|
||||
print '<a class="tabAction" href="index.php?action=edit">'.$langs->trans("Edit").'</a>';
|
||||
print '</div>';
|
||||
// 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 '</td></tr>';
|
||||
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td width="35%">'.$langs->transcountry("ProfId1",$code_pays).'</td><td>';
|
||||
if ($langs->transcountry("ProfId1",$code_pays) != '-')
|
||||
{
|
||||
print $conf->global->MAIN_INFO_SIREN;
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td width="35%">'.$langs->transcountry("ProfId2",$code_pays).'</td><td>';
|
||||
if ($langs->transcountry("ProfId2",$code_pays) != '-')
|
||||
{
|
||||
print $conf->global->MAIN_INFO_SIRET;
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td width="35%">'.$langs->transcountry("ProfId3",$code_pays).'</td><td>';
|
||||
if ($langs->transcountry("ProfId3",$code_pays) != '-')
|
||||
{
|
||||
print $conf->global->MAIN_INFO_APE;
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("TVAIntra").'</td><td>' . $conf->global->MAIN_INFO_TVAINTRA . '</td></tr>';
|
||||
|
||||
print '</table><br>';
|
||||
|
||||
// Boutons d'action
|
||||
print '<div class="tabsAction">';
|
||||
print '<a class="tabAction" href="index.php?action=edit">'.$langs->trans("Edit").'</a>';
|
||||
print '</div>';
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -1642,6 +1642,8 @@ class Facture
|
||||
|
||||
class FactureLigne
|
||||
{
|
||||
var $subprice; // Prix unitaire HT
|
||||
var $price; // Prix HT apres remise %
|
||||
|
||||
/**
|
||||
* \brief Constructeur d'objets ligne de facture
|
||||
@ -1670,6 +1672,7 @@ class FactureLigne
|
||||
$this->desc = stripslashes($objp->description);
|
||||
$this->qty = $objp->qty;
|
||||
$this->price = $objp->price;
|
||||
$this->price_ttc = $objp->price_ttc;
|
||||
$this->subprice = $objp->subprice;
|
||||
$this->tva_taux = $objp->tva_taux;
|
||||
$this->remise = $objp->remise;
|
||||
|
||||
@ -185,10 +185,11 @@ class Form
|
||||
* \brief Retourne la liste déroulante des pays actifs, dans la langue de l'utilisateur
|
||||
* \param selected Code pays pré-sélectionné
|
||||
* \param htmlname Nom de la liste deroulante
|
||||
* \param htmloption Options html sur le select
|
||||
* \todo trier liste sur noms après traduction plutot que avant
|
||||
*/
|
||||
|
||||
function select_pays($selected='',$htmlname='pays_id')
|
||||
function select_pays($selected='',$htmlname='pays_id',$htmloption='')
|
||||
{
|
||||
global $conf,$langs;
|
||||
$langs->load("dict");
|
||||
@ -199,7 +200,7 @@ class Form
|
||||
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
print '<select class="flat" name="'.$htmlname.'">';
|
||||
print '<select class="flat" name="'.$htmlname.'" '.$htmloption.'>';
|
||||
$num = $this->db->num_rows();
|
||||
$i = 0;
|
||||
if ($num)
|
||||
@ -688,6 +689,36 @@ 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;
|
||||
|
||||
$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;
|
||||
return $label;
|
||||
}
|
||||
else
|
||||
{
|
||||
return $langs->trans("NotDefined");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Retourne le nom traduit ou code+nom d'un pays
|
||||
* \param id id du pays
|
||||
@ -720,6 +751,7 @@ class Form
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Retourne le nom traduit ou code+nom d'une devise
|
||||
* \param code_iso Code iso de la devise
|
||||
|
||||
@ -18,7 +18,6 @@
|
||||
*
|
||||
* $Id$
|
||||
* $Source$
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -49,6 +48,7 @@ class pdf_crabe extends ModelePDFFactures
|
||||
$this->db = $db;
|
||||
$this->name = "crabe";
|
||||
$this->description = "Modèle de facture complet (Gère l'option fiscale de facturation TVA, le choix du mode de règlement à afficher, logo...)";
|
||||
$this->format="A4";
|
||||
$this->option_logo = 1; // Affiche logo FAC_PDF_LOGO
|
||||
$this->option_tva = 1; // Gere option tva FACTURE_TVAOPTION
|
||||
$this->option_modereg = 1; // Gere choix mode règlement FACTURE_CHQ_NUMBER, FACTURE_RIB_NUMBER
|
||||
@ -148,6 +148,13 @@ class pdf_crabe extends ModelePDFFactures
|
||||
$nexY = $pdf->GetY();
|
||||
$nblignes = sizeof($fac->lignes);
|
||||
|
||||
$posxdesc=11;
|
||||
$posxtva=121;
|
||||
$posxup=133;
|
||||
$posxqty=151;
|
||||
$posxdiscount=163;
|
||||
$postotttc=173;
|
||||
|
||||
// Boucle sur les lignes
|
||||
for ($i = 0 ; $i < $nblignes ; $i++)
|
||||
{
|
||||
@ -160,7 +167,7 @@ class pdf_crabe extends ModelePDFFactures
|
||||
if ($libelleproduitservice) $libelleproduitservice.="\n";
|
||||
$libelleproduitservice.=$fac->lignes[$i]->desc;
|
||||
}
|
||||
$pdf->SetXY (11, $curY );
|
||||
$pdf->SetXY ($posxdesc, $curY );
|
||||
|
||||
if ($conf->global->FACTURE_CODEPRODUITSERVICE && $fac->lignes[$i]->produit_id)
|
||||
{
|
||||
@ -181,25 +188,25 @@ class pdf_crabe extends ModelePDFFactures
|
||||
$nexY = $pdf->GetY();
|
||||
|
||||
// TVA
|
||||
$pdf->SetXY (121, $curY);
|
||||
$pdf->SetXY ($posxtva, $curY);
|
||||
$pdf->MultiCell(10, 5, $fac->lignes[$i]->tva_taux, 0, 'C');
|
||||
|
||||
// Prix unitaire HT avant remise
|
||||
$pdf->SetXY (133, $curY);
|
||||
$pdf->SetXY ($posxup, $curY);
|
||||
$pdf->MultiCell(17, 5, price($fac->lignes[$i]->subprice), 0, 'R', 0);
|
||||
|
||||
// Quantité
|
||||
$pdf->SetXY (151, $curY);
|
||||
$pdf->SetXY ($posxqty, $curY);
|
||||
$pdf->MultiCell(10, 5, $fac->lignes[$i]->qty, 0, 'R');
|
||||
|
||||
// Remise sur ligne
|
||||
$pdf->SetXY (163, $curY);
|
||||
$pdf->SetXY ($posxdiscount, $curY);
|
||||
if ($fac->lignes[$i]->remise_percent) {
|
||||
$pdf->MultiCell(14, 5, $fac->lignes[$i]->remise_percent."%", 0, 'R');
|
||||
}
|
||||
|
||||
// Total HT
|
||||
$pdf->SetXY (173, $curY);
|
||||
// Total TTC
|
||||
$pdf->SetXY ($postotttc, $curY);
|
||||
$total = price($fac->lignes[$i]->price * $fac->lignes[$i]->qty);
|
||||
$pdf->MultiCell(26, 5, $total, 0, 'R', 0);
|
||||
|
||||
|
||||
@ -34,6 +34,8 @@ ActiveOn=Activated on
|
||||
SourceFile=Source file
|
||||
TriggersAvailable=Triggers available
|
||||
TriggersDesc=Triggers are components that modify, once activated, the behaviour of Dolibarr workflow. They add new actions, activated on Dolibarr events (new company creation, invoice validation, ...).
|
||||
SeeAbove=See above
|
||||
ErrorSetACountryFirst=Set the country first
|
||||
ModuleFamilyCrm=Customer Ressource Management (CRM)
|
||||
ModuleFamilyProducts=Products Management
|
||||
ModuleFamilyHr=Human Ressource Management
|
||||
|
||||
@ -34,6 +34,8 @@ ActiveOn=Active sur
|
||||
SourceFile=Fichier source
|
||||
TriggersAvailable=Triggers disponibles
|
||||
TriggersDesc=Les triggers sont des composants qui, une fois activés, modifient le comportement du workflow de Dolibarr. Ils réalisent des actions suplémentaires, délenchées par les évennements Dolibarr (création société, validation facture, cloture contrat...).
|
||||
SeeAbove=Voir ci-dessus
|
||||
ErrorSetACountryFirst=Définisser le pays d'abord
|
||||
ModuleFamilyCrm=Gestion client (CRM)
|
||||
ModuleFamilyProducts=Gestion produits
|
||||
ModuleFamilyHr=Ressources humaines
|
||||
|
||||
@ -210,7 +210,7 @@ function dolibarr_fiche_head($links, $active=0, $title='')
|
||||
|
||||
/**
|
||||
\brief Récupère une constante depuis la base de données.
|
||||
\see dolibarr_del_const, dolibarr_sel_const
|
||||
\see dolibarr_del_const, dolibarr_set_const
|
||||
\param db Handler d'accès base
|
||||
\param name Nom de la constante
|
||||
\return string Valeur de la constante
|
||||
@ -262,17 +262,19 @@ function dolibarr_set_php_lang($code_lang)
|
||||
|
||||
/**
|
||||
\brief Insertion d'une constante dans la base de données.
|
||||
\see dolibarr_del_const, dolibarr_gel_const
|
||||
\param db handler d'accès base
|
||||
\param name nom de la constante
|
||||
\param value valeur de la constante
|
||||
\param type type de constante (chaine par défaut)
|
||||
\param visible la constante est elle visible (0 par défaut)
|
||||
\param note explication de la constante
|
||||
\return int 0 si KO, 1 si OK
|
||||
\see dolibarr_del_const, dolibarr_get_const
|
||||
\param db Handler d'accès base
|
||||
\param name Nom de la constante
|
||||
\param value Valeur de la constante
|
||||
\param type Type de constante (chaine par défaut)
|
||||
\param visible La constante est elle visible (0 par défaut)
|
||||
\param note Explication de la constante
|
||||
\return int <0 si ko, >0 si ok
|
||||
*/
|
||||
function dolibarr_set_const($db, $name, $value, $type='chaine', $visible=0, $note='')
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$db->begin();
|
||||
|
||||
$sql = "DELETE FROM llx_const WHERE name = '$name';";
|
||||
@ -285,12 +287,13 @@ function dolibarr_set_const($db, $name, $value, $type='chaine', $visible=0, $not
|
||||
if ($resql)
|
||||
{
|
||||
$db->commit();
|
||||
$conf->global->$name=$value;
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$db->rollback();
|
||||
return 0;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -480,7 +480,7 @@ insert into llx_c_forme_juridique (fk_pays, code, libelle) values (1,'62','Group
|
||||
insert into llx_c_forme_juridique (fk_pays, code, libelle) values (1,'63','Société coopérative agricole');
|
||||
insert into llx_c_forme_juridique (fk_pays, code, libelle) values (1,'64','Société non commerciale d\'assurances');
|
||||
insert into llx_c_forme_juridique (fk_pays, code, libelle) values (1,'65','Société civile');
|
||||
insert into llx_c_forme_juridique (fk_pays, code, libelle) values (1,'69','Autres personnes de droit privé inscrites au registre du commerce et des sociétés');
|
||||
insert into llx_c_forme_juridique (fk_pays, code, libelle) values (1,'69','Autres personnes de droit privé inscrites au registre du commerce et sociétés');
|
||||
|
||||
insert into llx_c_forme_juridique (fk_pays, code, libelle) values (1,'71','Administration de l\'état');
|
||||
insert into llx_c_forme_juridique (fk_pays, code, libelle) values (1,'72','Collectivité territoriale');
|
||||
|
||||
Loading…
Reference in New Issue
Block a user