forked from Wavyzz/dolibarr
Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
@@ -150,7 +150,7 @@ while ($i < GEN_NUMBER_FACTURE && $result >= 0) {
|
||||
|
||||
$fuser = new User($db);
|
||||
$fuser->fetch(mt_rand(1, 2));
|
||||
$fuser->getRights();
|
||||
$fuser->loadRights();
|
||||
|
||||
$result=$object->create($fuser);
|
||||
if ($result >= 0) {
|
||||
|
||||
@@ -180,7 +180,7 @@ for ($s = 0; $s < GEN_NUMBER_COMMANDE; $s++) {
|
||||
|
||||
$fuser = new User($db);
|
||||
$fuser->fetch($listofuserid[mt_rand(0, 2)]);
|
||||
$fuser->getRights();
|
||||
$fuser->loadRights();
|
||||
|
||||
$db->begin();
|
||||
|
||||
|
||||
@@ -171,7 +171,7 @@ while ($i < GEN_NUMBER_PROPAL && $result >= 0) {
|
||||
|
||||
$fuser = new User($db);
|
||||
$fuser->fetch(mt_rand(1, 2));
|
||||
$fuser->getRights();
|
||||
$fuser->loadRights();
|
||||
|
||||
$object->contactid = $contids[$socids[$socid]][0];
|
||||
$object->socid = $socids[$socid];
|
||||
|
||||
@@ -763,6 +763,11 @@ class Adherent extends CommonObject
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
|
||||
if (empty($this->country_id) && !empty($this->country_code)) {
|
||||
$country_id = getCountry($this->country_code, '3');
|
||||
$this->country_id = is_int($country_id) ? $country_id : 0;
|
||||
}
|
||||
|
||||
$nbrowsaffected = 0;
|
||||
$error = 0;
|
||||
|
||||
|
||||
@@ -760,6 +760,11 @@ class Account extends CommonObject
|
||||
$this->status = $this->clos;
|
||||
}
|
||||
|
||||
if (empty($this->country_id) && !empty($this->country_code)) {
|
||||
$country_id = getCountry($this->country_code, '3');
|
||||
$this->country_id = is_int($country_id) ? $country_id : 0;
|
||||
}
|
||||
|
||||
// Load the library to validate/check a BAN account
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php';
|
||||
|
||||
@@ -900,6 +905,11 @@ class Account extends CommonObject
|
||||
{
|
||||
global $langs, $conf;
|
||||
|
||||
if (empty($this->country_id) && !empty($this->country_code)) {
|
||||
$country_id = getCountry($this->country_code, '3');
|
||||
$this->country_id = is_int($country_id) ? $country_id : 0;
|
||||
}
|
||||
|
||||
$error = 0;
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
@@ -607,6 +607,11 @@ class Contact extends CommonObject
|
||||
{
|
||||
global $conf;
|
||||
|
||||
if (empty($this->country_id) && !empty($this->country_code)) {
|
||||
$country_id = getCountry($this->country_code, '3');
|
||||
$this->country_id = is_int($country_id) ? $country_id : 0;
|
||||
}
|
||||
|
||||
$error = 0;
|
||||
|
||||
$this->id = $id;
|
||||
|
||||
@@ -1423,6 +1423,10 @@ class Product extends CommonObject
|
||||
if (empty($this->country_id)) {
|
||||
$this->country_id = 0;
|
||||
}
|
||||
if (empty($this->country_id) && !empty($this->country_code)) {
|
||||
$country_id = getCountry($this->country_code, '3');
|
||||
$this->country_id = is_int($country_id) ? $country_id : 0;
|
||||
}
|
||||
|
||||
if (empty($this->state_id)) {
|
||||
$this->state_id = 0;
|
||||
|
||||
@@ -255,6 +255,10 @@ class Entrepot extends CommonObject
|
||||
$this->error = "ErrorFieldRequired";
|
||||
return 0;
|
||||
}
|
||||
if (empty($this->country_id) && !empty($this->country_code)) {
|
||||
$country_id = getCountry($this->country_code, '3');
|
||||
$this->country_id = is_int($country_id) ? $country_id : 0;
|
||||
}
|
||||
|
||||
$now = dol_now();
|
||||
|
||||
@@ -325,6 +329,11 @@ class Entrepot extends CommonObject
|
||||
*/
|
||||
public function update($id, $user, $notrigger = 0)
|
||||
{
|
||||
if (empty($this->country_id) && !empty($this->country_code)) {
|
||||
$country_id = getCountry($this->country_code, '3');
|
||||
$this->country_id = is_int($country_id) ? $country_id : 0;
|
||||
}
|
||||
|
||||
$error = 0;
|
||||
|
||||
if (empty($id)) {
|
||||
|
||||
@@ -1012,11 +1012,6 @@ class Societe extends CommonObject
|
||||
$this->fk_multicurrency = 0;
|
||||
}
|
||||
|
||||
if (empty($this->country_id) && !empty($this->country_code)) {
|
||||
$country_id = getCountry($this->country_code, '3');
|
||||
$this->country_id = is_int($country_id) ? $country_id : 0;
|
||||
}
|
||||
|
||||
dol_syslog(get_class($this)."::create ".$this->name);
|
||||
|
||||
$now = dol_now();
|
||||
@@ -1446,6 +1441,11 @@ class Societe extends CommonObject
|
||||
$this->country_id = dol_getIdFromCode($this->db, $this->country_code, 'c_country', 'code', 'rowid');
|
||||
}
|
||||
|
||||
if (empty($this->country_id) && !empty($this->country_code)) {
|
||||
$country_id = getCountry($this->country_code, '3');
|
||||
$this->country_id = is_int($country_id) ? $country_id : 0;
|
||||
}
|
||||
|
||||
$error = 0;
|
||||
|
||||
dol_syslog(get_class($this)."::Update id=".$id." call_trigger=".$call_trigger." allowmodcodeclient=".$allowmodcodeclient." allowmodcodefournisseur=".$allowmodcodefournisseur);
|
||||
|
||||
@@ -2096,6 +2096,11 @@ class User extends CommonObject
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
if (empty($this->country_id) && !empty($this->country_code)) {
|
||||
$country_id = getCountry($this->country_code, '3');
|
||||
$this->country_id = is_int($country_id) ? $country_id : 0;
|
||||
}
|
||||
|
||||
$nbrowsaffected = 0;
|
||||
$error = 0;
|
||||
|
||||
|
||||
@@ -88,7 +88,7 @@ class SupplierProposalTest extends CommonClassTest
|
||||
|
||||
// Set permission not set by default sql sample
|
||||
$user->addrights(0, 'supplier_proposal');
|
||||
$user->getrights('supplier_proposal', 1);
|
||||
$user->loadRights('supplier_proposal', 1);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -183,7 +183,7 @@ class SupplierProposalTest extends CommonClassTest
|
||||
$result = $user->addrights(0, 'supplier_proposal');
|
||||
$this->assertLessThan($result, 0);
|
||||
|
||||
$result = $user->getrights('supplier_proposal', 1);
|
||||
$result = $user->loadRights('supplier_proposal', 1);
|
||||
//$this->assertLessThan($result, 0);
|
||||
|
||||
$result = $localobject->valid($user);
|
||||
|
||||
Reference in New Issue
Block a user