Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/3.5' into 3.5_backported
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Jan 21, 2014
2 parents ef15503 + 3852fe4 commit d3a0eb2
Show file tree
Hide file tree
Showing 8 changed files with 67 additions and 14 deletions.
2 changes: 1 addition & 1 deletion htdocs/core/lib/functions2.lib.php
Expand Up @@ -629,7 +629,7 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m
if ($maskraz > 0) // A reset is required
{
if ($maskraz == 99) {
$maskraz = date('m');
$maskraz = date('m', $date);
$resetEveryMonth = true;
}
if ($maskraz > 12) return 'ErrorBadMaskBadRazMonth';
Expand Down
8 changes: 4 additions & 4 deletions htdocs/core/modules/import/import_csv.modules.php
Expand Up @@ -443,7 +443,7 @@ function import_insert($arrayrecord,$array_match_file_to_database,$objimport,$ma
}
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);
$newval=$this->thirpartyobject->code_client;
Expand All @@ -452,7 +452,7 @@ function import_insert($arrayrecord,$array_match_file_to_database,$objimport,$ma
}
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->code_fournisseur;
Expand All @@ -461,7 +461,7 @@ function import_insert($arrayrecord,$array_match_file_to_database,$objimport,$ma
}
elseif ($objimport->array_import_convertvalue[0][$val]['rule']=='getcustomeraccountancycodeifnull')
{
if (empty($newval) || $newval='auto')
if (empty($newval) || $newval=='auto')
{
$this->thirpartyobject->get_codecompta('customer');
$newval=$this->thirpartyobject->code_compta;
Expand All @@ -470,7 +470,7 @@ function import_insert($arrayrecord,$array_match_file_to_database,$objimport,$ma
}
elseif ($objimport->array_import_convertvalue[0][$val]['rule']=='getsupplieraccountancycodeifnull')
{
if (empty($newval) || $newval='auto')
if (empty($newval) || $newval=='auto')
{
$this->thirpartyobject->get_codecompta('supplier');
$newval=$this->thirpartyobject->code_compta_fournisseur;
Expand Down
12 changes: 6 additions & 6 deletions htdocs/core/modules/modBarcode.class.php
Expand Up @@ -111,12 +111,12 @@ function init($options='')
$this->remove($options);

$sql = array(
array('sql'=>"INSERT INTO llx_c_barcode_type (code, libelle, coder, example, entity) VALUES ('EAN8', 'EAN8', 0, '1234567', __ENTITY__)",'ignoreerror'=>1),
array('sql'=>"INSERT INTO llx_c_barcode_type (code, libelle, coder, example, entity) VALUES ('EAN13', 'EAN13', 0, '123456789012', __ENTITY__)",'ignoreerror'=>1),
array('sql'=>"INSERT INTO llx_c_barcode_type (code, libelle, coder, example, entity) VALUES ('UPC', 'UPC', 0, '123456789012', __ENTITY__)",'ignoreerror'=>1),
array('sql'=>"INSERT INTO llx_c_barcode_type (code, libelle, coder, example, entity) VALUES ('ISBN', 'ISBN', 0, '123456789', __ENTITY__)",'ignoreerror'=>1),
array('sql'=>"INSERT INTO llx_c_barcode_type (code, libelle, coder, example, entity) VALUES ('C39', 'Code 39', 0, '1234567890', __ENTITY__)",'ignoreerror'=>1),
array('sql'=>"INSERT INTO llx_c_barcode_type (code, libelle, coder, example, entity) VALUES ('C128', 'Code 128', 0, 'ABCD1234567890', __ENTITY__)",'ignoreerror'=>1)
array('sql'=>"INSERT INTO ".MAIN_DB_PREFIX."c_barcode_type (code, libelle, coder, example, entity) VALUES ('EAN8', 'EAN8', 0, '1234567', __ENTITY__)",'ignoreerror'=>1),
array('sql'=>"INSERT INTO ".MAIN_DB_PREFIX."c_barcode_type (code, libelle, coder, example, entity) VALUES ('EAN13', 'EAN13', 0, '123456789012', __ENTITY__)",'ignoreerror'=>1),
array('sql'=>"INSERT INTO ".MAIN_DB_PREFIX."c_barcode_type (code, libelle, coder, example, entity) VALUES ('UPC', 'UPC', 0, '123456789012', __ENTITY__)",'ignoreerror'=>1),
array('sql'=>"INSERT INTO ".MAIN_DB_PREFIX."c_barcode_type (code, libelle, coder, example, entity) VALUES ('ISBN', 'ISBN', 0, '123456789', __ENTITY__)",'ignoreerror'=>1),
array('sql'=>"INSERT INTO ".MAIN_DB_PREFIX."c_barcode_type (code, libelle, coder, example, entity) VALUES ('C39', 'Code 39', 0, '1234567890', __ENTITY__)",'ignoreerror'=>1),
array('sql'=>"INSERT INTO ".MAIN_DB_PREFIX."c_barcode_type (code, libelle, coder, example, entity) VALUES ('C128', 'Code 128', 0, 'ABCD1234567890', __ENTITY__)",'ignoreerror'=>1)
);

return $this->_init($sql, $options);
Expand Down
7 changes: 7 additions & 0 deletions htdocs/core/modules/modProjet.class.php
Expand Up @@ -144,6 +144,13 @@ function __construct($db)
$this->rights[$r][3] = 0; // La permission est-elle une permission par defaut
$this->rights[$r][4] = 'supprimer';

$r++;
$this->rights[$r][0] = 45; // id de la permission
$this->rights[$r][1] = "Exporter les projets"; // libelle de la permission
$this->rights[$r][2] = 'd'; // type de la permission (deprecie a ce jour)
$this->rights[$r][3] = 0; // La permission est-elle une permission par defaut
$this->rights[$r][4] = 'export';

$r++;
$this->rights[$r][0] = 141; // id de la permission
$this->rights[$r][1] = "Lire tous les projets et tâches (y compris prives qui ne me sont pas affectes)"; // libelle de la permission
Expand Down
2 changes: 1 addition & 1 deletion htdocs/product/class/product.class.php
Expand Up @@ -38,7 +38,7 @@ class Product extends CommonObject
public $element='product';
public $table_element='product';
public $fk_element='fk_product';
protected $childtables=array('propaldet','commandedet','facturedet','contratdet'); // To test if we can delete object
protected $childtables=array('propaldet','commandedet','facturedet','contratdet','facture_fourn_det','commande_fournisseurdet'); // To test if we can delete object
protected $isnolinkedbythird = 1; // No field fk_soc
protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe

Expand Down
1 change: 1 addition & 0 deletions htdocs/societe/class/societe.class.php
Expand Up @@ -303,6 +303,7 @@ function create_individual($user) {

$contact->name = $this->name_bis;
$contact->firstname = $this->firstname;
$contact->civilite_id = $this->civility_id;
$contact->socid = $this->id; // fk_soc
$contact->statut = 1;
$contact->priv = 0;
Expand Down
2 changes: 1 addition & 1 deletion htdocs/societe/soc.php
Expand Up @@ -118,7 +118,7 @@
$object->particulier = GETPOST("private");

$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
$object->name_bis = GETPOST('name')?GETPOST('name'):GETPOST('nom');
$object->firstname = GETPOST('firstname');
Expand Down
47 changes: 46 additions & 1 deletion test/phpunit/NumberingModulesTest.php
Expand Up @@ -490,12 +490,57 @@ public function testFactureMercure()

$localobject=new Facture($this->savdb);
$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();
$result=$numbering->getNextValue($mysoc, $localobject);
print __METHOD__." result=".$result."\n";
$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;
}

Expand Down

0 comments on commit d3a0eb2

Please sign in to comment.