Skip to content

Commit

Permalink
Clean constant FACTURE_TVAOPTION into conf.class.php so we don't have
Browse files Browse the repository at this point in the history
to do it everywhere at different places. Value is now 0 or 1.
  • Loading branch information
eldy committed Mar 31, 2014
1 parent 39f48f2 commit 76259a6
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
8 changes: 4 additions & 4 deletions htdocs/admin/company.php
Expand Up @@ -530,7 +530,7 @@
$var=true;

$var=!$var;
print "<tr ".$bc[$var]."><td width=\"140\"><label><input type=\"radio\" name=\"optiontva\" value=\"reel\"".($conf->global->FACTURE_TVAOPTION != "franchise"?" checked":"")."> ".$langs->trans("VATIsUsed")."</label></td>";
print "<tr ".$bc[$var]."><td width=\"140\"><label><input type=\"radio\" name=\"optiontva\" value=\"1\"".(empty($conf->global->FACTURE_TVAOPTION)?"":" checked")."> ".$langs->trans("VATIsUsed")."</label></td>";
print '<td colspan="2">';
print "<table>";
print "<tr><td>".$langs->trans("VATIsUsedDesc")."</td></tr>";
Expand All @@ -539,7 +539,7 @@
print "</td></tr>\n";

$var=!$var;
print "<tr ".$bc[$var]."><td width=\"140\"><label><input type=\"radio\" name=\"optiontva\" value=\"franchise\"".($conf->global->FACTURE_TVAOPTION == "franchise"?" checked":"")."> ".$langs->trans("VATIsNotUsed")."</label></td>";
print "<tr ".$bc[$var]."><td width=\"140\"><label><input type=\"radio\" name=\"optiontva\" value=\"0\"".(empty($conf->global->FACTURE_TVAOPTION)?" checked":"")."> ".$langs->trans("VATIsNotUsed")."</label></td>";
print '<td colspan="2">';
print "<table>";
print "<tr><td>".$langs->trans("VATIsNotUsedDesc")."</td></tr>";
Expand Down Expand Up @@ -913,7 +913,7 @@
$var=true;

$var=!$var;
print "<tr ".$bc[$var]."><td width=\"140\"><label><input ".$bc[$var]." type=\"radio\" name=\"optiontva\" disabled value=\"reel\"".($conf->global->FACTURE_TVAOPTION != "franchise"?" checked":"")."> ".$langs->trans("VATIsUsed")."</label></td>";
print "<tr ".$bc[$var]."><td width=\"140\"><label><input ".$bc[$var]." type=\"radio\" name=\"optiontva\" disabled value=\"1\"".(empty($conf->global->FACTURE_TVAOPTION)?"":" checked")."> ".$langs->trans("VATIsUsed")."</label></td>";
print '<td colspan="2">';
print "<table>";
print "<tr><td>".$langs->trans("VATIsUsedDesc")."</td></tr>";
Expand All @@ -922,7 +922,7 @@
print "</td></tr>\n";

$var=!$var;
print "<tr ".$bc[$var]."><td width=\"140\"><label><input ".$bc[$var]." type=\"radio\" name=\"optiontva\" disabled value=\"franchise\"".($conf->global->FACTURE_TVAOPTION == "franchise"?" checked":"")."> ".$langs->trans("VATIsNotUsed")."</label></td>";
print "<tr ".$bc[$var]."><td width=\"140\"><label><input ".$bc[$var]." type=\"radio\" name=\"optiontva\" disabled value=\"0\"".(empty($conf->global->FACTURE_TVAOPTION)?" checked":"")."> ".$langs->trans("VATIsNotUsed")."</label></td>";
print '<td colspan="2">';
print "<table>";
print "<tr><td>".$langs->trans("VATIsNotUsedDesc")."</td></tr>";
Expand Down
10 changes: 9 additions & 1 deletion htdocs/core/class/conf.class.php
Expand Up @@ -235,7 +235,15 @@ function setValues($db)
if (empty($this->global->MAIN_MENUFRONT_STANDARD)) $this->global->MAIN_MENUFRONT_STANDARD="eldy_menu.php";
if (empty($this->global->MAIN_MENU_SMARTPHONE)) $this->global->MAIN_MENU_SMARTPHONE="eldy_menu.php"; // Use eldy by default because smartphone does not work on all phones
if (empty($this->global->MAIN_MENUFRONT_SMARTPHONE)) $this->global->MAIN_MENUFRONT_SMARTPHONE="eldy_menu.php"; // Use eldy by default because smartphone does not work on all phones

// Clean var use vat for company
if (! isset($conf->global->FACTURE_TVAOPTION)) $conf->global->FACTURE_TVAOPTION=1;
else if (! empty($conf->global->FACTURE_TVAOPTION) && ! is_numeric($conf->global->FACTURE_TVAOPTION))
{
// Old value of option, we clean to use new value (0 or 1)
if ($conf->global->FACTURE_TVAOPTION != "franchise") $conf->global->FACTURE_TVAOPTION=1;
else $conf->global->FACTURE_TVAOPTION=0;
}

// Variable globales LDAP
if (empty($this->global->LDAP_FIELD_FULLNAME)) $this->global->LDAP_FIELD_FULLNAME='';
if (! isset($this->global->LDAP_KEY_USERS)) $this->global->LDAP_KEY_USERS=$this->global->LDAP_FIELD_FULLNAME;
Expand Down
4 changes: 2 additions & 2 deletions htdocs/societe/class/societe.class.php
Expand Up @@ -2575,8 +2575,8 @@ function setMysoc($conf)
$this->logo_small=empty($conf->global->MAIN_INFO_SOCIETE_LOGO_SMALL)?'':$conf->global->MAIN_INFO_SOCIETE_LOGO_SMALL;
$this->logo_mini=empty($conf->global->MAIN_INFO_SOCIETE_LOGO_MINI)?'':$conf->global->MAIN_INFO_SOCIETE_LOGO_MINI;

// Define if company use vat or not (Do not use conf->global->FACTURE_TVAOPTION anymore)
$this->tva_assuj=((isset($conf->global->FACTURE_TVAOPTION) && $conf->global->FACTURE_TVAOPTION=='franchise')?0:1);
// Define if company use vat or not
$this->tva_assuj=$conf->global->FACTURE_TVAOPTION;

// Define if company use local taxes
$this->localtax1_assuj=((isset($conf->global->FACTURE_LOCAL_TAX1_OPTION) && ($conf->global->FACTURE_LOCAL_TAX1_OPTION=='1' || $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on'))?1:0);
Expand Down

0 comments on commit 76259a6

Please sign in to comment.