Merge remote-tracking branch 'origin/3.5' into develop
This commit is contained in:
commit
0a372a1c7d
@ -443,7 +443,7 @@ class ImportCsv extends ModeleImports
|
|||||||
}
|
}
|
||||||
elseif ($objimport->array_import_convertvalue[0][$val]['rule']=='getcustomercodeifnull')
|
elseif ($objimport->array_import_convertvalue[0][$val]['rule']=='getcustomercodeifnull')
|
||||||
{
|
{
|
||||||
if (empty($newval) || $newval='auto')
|
if (empty($newval) || $newval=='auto')
|
||||||
{
|
{
|
||||||
$this->thirpartyobject->get_codeclient(0,0);
|
$this->thirpartyobject->get_codeclient(0,0);
|
||||||
$newval=$this->thirpartyobject->code_client;
|
$newval=$this->thirpartyobject->code_client;
|
||||||
@ -452,7 +452,7 @@ class ImportCsv extends ModeleImports
|
|||||||
}
|
}
|
||||||
elseif ($objimport->array_import_convertvalue[0][$val]['rule']=='getsuppliercodeifnull')
|
elseif ($objimport->array_import_convertvalue[0][$val]['rule']=='getsuppliercodeifnull')
|
||||||
{
|
{
|
||||||
if (empty($newval) || $newval='auto')
|
if (empty($newval) || $newval=='auto')
|
||||||
{
|
{
|
||||||
$newval=$this->thirpartyobject->get_codefournisseur(0,1);
|
$newval=$this->thirpartyobject->get_codefournisseur(0,1);
|
||||||
$newval=$this->thirpartyobject->code_fournisseur;
|
$newval=$this->thirpartyobject->code_fournisseur;
|
||||||
@ -461,7 +461,7 @@ class ImportCsv extends ModeleImports
|
|||||||
}
|
}
|
||||||
elseif ($objimport->array_import_convertvalue[0][$val]['rule']=='getcustomeraccountancycodeifnull')
|
elseif ($objimport->array_import_convertvalue[0][$val]['rule']=='getcustomeraccountancycodeifnull')
|
||||||
{
|
{
|
||||||
if (empty($newval) || $newval='auto')
|
if (empty($newval) || $newval=='auto')
|
||||||
{
|
{
|
||||||
$this->thirpartyobject->get_codecompta('customer');
|
$this->thirpartyobject->get_codecompta('customer');
|
||||||
$newval=$this->thirpartyobject->code_compta;
|
$newval=$this->thirpartyobject->code_compta;
|
||||||
@ -470,7 +470,7 @@ class ImportCsv extends ModeleImports
|
|||||||
}
|
}
|
||||||
elseif ($objimport->array_import_convertvalue[0][$val]['rule']=='getsupplieraccountancycodeifnull')
|
elseif ($objimport->array_import_convertvalue[0][$val]['rule']=='getsupplieraccountancycodeifnull')
|
||||||
{
|
{
|
||||||
if (empty($newval) || $newval='auto')
|
if (empty($newval) || $newval=='auto')
|
||||||
{
|
{
|
||||||
$this->thirpartyobject->get_codecompta('supplier');
|
$this->thirpartyobject->get_codecompta('supplier');
|
||||||
$newval=$this->thirpartyobject->code_compta_fournisseur;
|
$newval=$this->thirpartyobject->code_compta_fournisseur;
|
||||||
|
|||||||
@ -303,6 +303,7 @@ class Societe extends CommonObject
|
|||||||
|
|
||||||
$contact->name = $this->name_bis;
|
$contact->name = $this->name_bis;
|
||||||
$contact->firstname = $this->firstname;
|
$contact->firstname = $this->firstname;
|
||||||
|
$contact->civilite_id = $this->civility_id;
|
||||||
$contact->socid = $this->id; // fk_soc
|
$contact->socid = $this->id; // fk_soc
|
||||||
$contact->statut = 1;
|
$contact->statut = 1;
|
||||||
$contact->priv = 0;
|
$contact->priv = 0;
|
||||||
|
|||||||
@ -118,7 +118,7 @@ if (empty($reshook))
|
|||||||
$object->particulier = GETPOST("private");
|
$object->particulier = GETPOST("private");
|
||||||
|
|
||||||
$object->name = dolGetFirstLastname(GETPOST('firstname'),GETPOST('nom')?GETPOST('nom'):GETPOST('name'));
|
$object->name = dolGetFirstLastname(GETPOST('firstname'),GETPOST('nom')?GETPOST('nom'):GETPOST('name'));
|
||||||
$object->civilite_id = GETPOST('civilite_id');
|
$object->civility_id = GETPOST('civilite_id');
|
||||||
// Add non official properties
|
// Add non official properties
|
||||||
$object->name_bis = GETPOST('name')?GETPOST('name'):GETPOST('nom');
|
$object->name_bis = GETPOST('name')?GETPOST('name'):GETPOST('nom');
|
||||||
$object->firstname = GETPOST('firstname');
|
$object->firstname = GETPOST('firstname');
|
||||||
|
|||||||
@ -490,12 +490,57 @@ class NumberingModulesTest extends PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
$localobject=new Facture($this->savdb);
|
$localobject=new Facture($this->savdb);
|
||||||
$localobject->initAsSpecimen();
|
$localobject->initAsSpecimen();
|
||||||
$localobject->date=dol_mktime(12, 0, 0, 12, 1, 1971); // we use different discal year but same year
|
$localobject->date=dol_mktime(12, 0, 0, 12, 1, 1971); // we use different fiscal year but same year
|
||||||
$numbering=new mod_facture_mercure();
|
$numbering=new mod_facture_mercure();
|
||||||
$result=$numbering->getNextValue($mysoc, $localobject);
|
$result=$numbering->getNextValue($mysoc, $localobject);
|
||||||
print __METHOD__." result=".$result."\n";
|
print __METHOD__." result=".$result."\n";
|
||||||
$this->assertEquals('197212-0001', $result); // counter must be reset to 1
|
$this->assertEquals('197212-0001', $result); // counter must be reset to 1
|
||||||
|
|
||||||
|
// Now we try with a reset every month (@99)
|
||||||
|
$conf->global->SOCIETE_FISCAL_MONTH_START=6;
|
||||||
|
$conf->global->FACTURE_MERCURE_MASK_CREDIT='{yyyy}{mm}-{0000@99}';
|
||||||
|
$conf->global->FACTURE_MERCURE_MASK_INVOICE='{yyyy}{mm}-{0000@99}';
|
||||||
|
|
||||||
|
$localobject=new Facture($this->savdb);
|
||||||
|
$localobject->initAsSpecimen();
|
||||||
|
$localobject->date=dol_mktime(12, 0, 0, 1, 1, 1980); // we use year 1980 to be sure to not have existing invoice for this year
|
||||||
|
$numbering=new mod_facture_mercure();
|
||||||
|
$result=$numbering->getNextValue($mysoc, $localobject);
|
||||||
|
$result2=$localobject->create($user,1);
|
||||||
|
$result3=$localobject->validate($user, $result);
|
||||||
|
print __METHOD__." result=".$result."\n";
|
||||||
|
$this->assertEquals('198001-0001', $result); // counter must start to 1
|
||||||
|
|
||||||
|
$localobject=new Facture($this->savdb);
|
||||||
|
$localobject->initAsSpecimen();
|
||||||
|
$localobject->date=dol_mktime(12, 0, 0, 1, 1, 1980); // we use year 1980 to be sure to not have existing invoice for this year
|
||||||
|
$numbering=new mod_facture_mercure();
|
||||||
|
$result=$numbering->getNextValue($mysoc, $localobject);
|
||||||
|
$result2=$localobject->create($user,1);
|
||||||
|
$result3=$localobject->validate($user, $result);
|
||||||
|
print __METHOD__." result=".$result."\n";
|
||||||
|
$this->assertEquals('198001-0002', $result); // counter must start to 2
|
||||||
|
|
||||||
|
$localobject=new Facture($this->savdb);
|
||||||
|
$localobject->initAsSpecimen();
|
||||||
|
$localobject->date=dol_mktime(12, 0, 0, 2, 1, 1980); // we use year 1980 to be sure to not have existing invoice for this year
|
||||||
|
$numbering=new mod_facture_mercure();
|
||||||
|
$result=$numbering->getNextValue($mysoc, $localobject);
|
||||||
|
$result2=$localobject->create($user,1);
|
||||||
|
$result3=$localobject->validate($user, $result);
|
||||||
|
print __METHOD__." result=".$result."\n";
|
||||||
|
$this->assertEquals('198002-0001', $result); // counter must start to 1
|
||||||
|
|
||||||
|
$localobject=new Facture($this->savdb);
|
||||||
|
$localobject->initAsSpecimen();
|
||||||
|
$localobject->date=dol_mktime(12, 0, 0, 1, 1, 1981); // we use year 1981 to be sure to not have existing invoice for this year
|
||||||
|
$numbering=new mod_facture_mercure();
|
||||||
|
$result=$numbering->getNextValue($mysoc, $localobject);
|
||||||
|
$result2=$localobject->create($user,1);
|
||||||
|
$result3=$localobject->validate($user, $result);
|
||||||
|
print __METHOD__." result=".$result."\n";
|
||||||
|
$this->assertEquals('198101-0001', $result); // counter must start to 1
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user