Merge pull request #19469 from frederic34/testclass
enable societe.class.php in coding test
This commit is contained in:
commit
5b2e48ba9e
@ -4752,12 +4752,12 @@ class Societe extends CommonObject
|
|||||||
* Function used to replace a thirdparty id with another one.
|
* Function used to replace a thirdparty id with another one.
|
||||||
* It must be used within a transaction to avoid trouble
|
* It must be used within a transaction to avoid trouble
|
||||||
*
|
*
|
||||||
* @param DoliDB $db Database handler
|
* @param DoliDB $dbs Database handler, because function is static we name it $dbs not $db to avoid breaking coding test
|
||||||
* @param int $origin_id Old thirdparty id (will be removed)
|
* @param int $origin_id Old thirdparty id (will be removed)
|
||||||
* @param int $dest_id New thirdparty id
|
* @param int $dest_id New thirdparty id
|
||||||
* @return bool True if success, False if error
|
* @return bool True if success, False if error
|
||||||
*/
|
*/
|
||||||
public static function replaceThirdparty(DoliDB $db, $origin_id, $dest_id)
|
public static function replaceThirdparty(DoliDB $dbs, $origin_id, $dest_id)
|
||||||
{
|
{
|
||||||
if ($origin_id == $dest_id) {
|
if ($origin_id == $dest_id) {
|
||||||
dol_syslog('Error: Try to merge a thirdparty into itself');
|
dol_syslog('Error: Try to merge a thirdparty into itself');
|
||||||
@ -4774,9 +4774,9 @@ class Societe extends CommonObject
|
|||||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'societe_commerciaux ';
|
$sql .= ' FROM '.MAIN_DB_PREFIX.'societe_commerciaux ';
|
||||||
$sql .= ' WHERE fk_soc = '.(int) $origin_id.') ';
|
$sql .= ' WHERE fk_soc = '.(int) $origin_id.') ';
|
||||||
|
|
||||||
$resql = $db->query($sql);
|
$resql = $dbs->query($sql);
|
||||||
while ($obj = $db->fetch_object($resql)) {
|
while ($obj = $dbs->fetch_object($resql)) {
|
||||||
$db->query('DELETE FROM '.MAIN_DB_PREFIX.'societe_commerciaux WHERE rowid = '.((int) $obj->rowid));
|
$dbs->query('DELETE FROM '.MAIN_DB_PREFIX.'societe_commerciaux WHERE rowid = '.((int) $obj->rowid));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -4792,7 +4792,7 @@ class Societe extends CommonObject
|
|||||||
'societe_rib'
|
'societe_rib'
|
||||||
);
|
);
|
||||||
|
|
||||||
return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables);
|
return CommonObject::commonReplaceThirdparty($dbs, $origin_id, $dest_id, $tables);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -213,12 +213,11 @@ class CodingPhpTest extends PHPUnit\Framework\TestCase
|
|||||||
'multicurrency.class.php',
|
'multicurrency.class.php',
|
||||||
'productbatch.class.php',
|
'productbatch.class.php',
|
||||||
'reception.class.php',
|
'reception.class.php',
|
||||||
'societe.class.php'
|
|
||||||
))) {
|
))) {
|
||||||
// Must not found $db->
|
// Must not find $db->
|
||||||
$ok=true;
|
$ok=true;
|
||||||
$matches=array();
|
$matches=array();
|
||||||
// Check string $db-> inside a class.php file (it should be $this->db-> insto such classes)
|
// Check string $db-> inside a class.php file (it should be $this->db-> into such classes)
|
||||||
preg_match_all('/'.preg_quote('$db->', '/').'/', $filecontent, $matches, PREG_SET_ORDER);
|
preg_match_all('/'.preg_quote('$db->', '/').'/', $filecontent, $matches, PREG_SET_ORDER);
|
||||||
foreach ($matches as $key => $val) {
|
foreach ($matches as $key => $val) {
|
||||||
$ok=false;
|
$ok=false;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user