Merge pull request #2318 from GPCsolutions/3.5-accountingmask

FIXED Allowed 0 to be used as an account mask
This commit is contained in:
Laurent Destailleur 2015-03-14 13:42:46 +01:00
commit da042c1677
2 changed files with 7 additions and 3 deletions

View File

@ -44,8 +44,8 @@ class mod_codecompta_aquarium extends ModeleAccountancyCode
function __construct() function __construct()
{ {
global $conf; global $conf;
if (empty($conf->global->COMPANY_AQUARIUM_MASK_CUSTOMER)) $conf->global->COMPANY_AQUARIUM_MASK_CUSTOMER='411'; if (is_null($conf->global->COMPANY_AQUARIUM_MASK_CUSTOMER)) $conf->global->COMPANY_AQUARIUM_MASK_CUSTOMER='411';
if (empty($conf->global->COMPANY_AQUARIUM_MASK_SUPPLIER)) $conf->global->COMPANY_AQUARIUM_MASK_SUPPLIER='401'; if (is_null($conf->global->COMPANY_AQUARIUM_MASK_SUPPLIER)) $conf->global->COMPANY_AQUARIUM_MASK_SUPPLIER='401';
$this->prefixcustomeraccountancycode=$conf->global->COMPANY_AQUARIUM_MASK_CUSTOMER; $this->prefixcustomeraccountancycode=$conf->global->COMPANY_AQUARIUM_MASK_CUSTOMER;
$this->prefixsupplieraccountancycode=$conf->global->COMPANY_AQUARIUM_MASK_SUPPLIER; $this->prefixsupplieraccountancycode=$conf->global->COMPANY_AQUARIUM_MASK_SUPPLIER;
} }

View File

@ -114,7 +114,11 @@ if ($action == 'setModuleOptions')
{ {
$param=GETPOST("param".$i,'alpha'); $param=GETPOST("param".$i,'alpha');
$value=GETPOST("value".$i,'alpha'); $value=GETPOST("value".$i,'alpha');
if ($param) $res = dolibarr_set_const($db,$param,$value,'chaine',0,'',$conf->entity); // Use the default values if the field is not set
if ($param == '') {
$param = null;
}
$res = dolibarr_set_const($db,$param,$value,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++; if (! $res > 0) $error++;
} }
} }