forked from Wavyzz/dolibarr
Debug v19
This commit is contained in:
@@ -1220,10 +1220,10 @@ function dol_buildpath($path, $type = 0, $returnemptyifnotfound = 0)
|
|||||||
foreach ($conf->file->dol_document_root as $key => $dirroot) { // ex: array(["main"]=>"/home/main/htdocs", ["alt0"]=>"/home/dirmod/htdocs", ...)
|
foreach ($conf->file->dol_document_root as $key => $dirroot) { // ex: array(["main"]=>"/home/main/htdocs", ["alt0"]=>"/home/dirmod/htdocs", ...)
|
||||||
if ($key == 'main') {
|
if ($key == 'main') {
|
||||||
if ($type == 3) {
|
if ($type == 3) {
|
||||||
global $dolibarr_main_url_root;
|
/*global $dolibarr_main_url_root;*/
|
||||||
|
|
||||||
// Define $urlwithroot
|
// Define $urlwithroot
|
||||||
$urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
|
$urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($conf->file->dol_main_url_root));
|
||||||
$urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
|
$urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
|
||||||
//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
|
//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
|
||||||
|
|
||||||
@@ -1244,10 +1244,10 @@ function dol_buildpath($path, $type = 0, $returnemptyifnotfound = 0)
|
|||||||
$res = (preg_match('/^http/i', $conf->file->dol_url_root[$key]) ? '' : DOL_MAIN_URL_ROOT).$conf->file->dol_url_root[$key].'/'.$path;
|
$res = (preg_match('/^http/i', $conf->file->dol_url_root[$key]) ? '' : DOL_MAIN_URL_ROOT).$conf->file->dol_url_root[$key].'/'.$path;
|
||||||
}
|
}
|
||||||
if ($type == 3) {
|
if ($type == 3) {
|
||||||
global $dolibarr_main_url_root;
|
/*global $dolibarr_main_url_root;*/
|
||||||
|
|
||||||
// Define $urlwithroot
|
// Define $urlwithroot
|
||||||
$urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
|
$urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($conf->file->dol_main_url_root));
|
||||||
$urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
|
$urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
|
||||||
//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
|
//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
|
||||||
|
|
||||||
|
|||||||
@@ -82,6 +82,7 @@ $conf->file->main_authentication = empty($dolibarr_main_authentication) ? 'dolib
|
|||||||
$conf->file->main_force_https = empty($dolibarr_main_force_https) ? '' : $dolibarr_main_force_https; // Force https
|
$conf->file->main_force_https = empty($dolibarr_main_force_https) ? '' : $dolibarr_main_force_https; // Force https
|
||||||
$conf->file->strict_mode = empty($dolibarr_strict_mode) ? '' : $dolibarr_strict_mode; // Force php strict mode (for debug)
|
$conf->file->strict_mode = empty($dolibarr_strict_mode) ? '' : $dolibarr_strict_mode; // Force php strict mode (for debug)
|
||||||
$conf->file->instance_unique_id = empty($dolibarr_main_instance_unique_id) ? (empty($dolibarr_main_cookie_cryptkey) ? '' : $dolibarr_main_cookie_cryptkey) : $dolibarr_main_instance_unique_id; // Unique id of instance
|
$conf->file->instance_unique_id = empty($dolibarr_main_instance_unique_id) ? (empty($dolibarr_main_cookie_cryptkey) ? '' : $dolibarr_main_cookie_cryptkey) : $dolibarr_main_instance_unique_id; // Unique id of instance
|
||||||
|
$conf->file->dol_main_url_root = $dolibarr_main_url_root;
|
||||||
$conf->file->dol_document_root = array('main' => (string) DOL_DOCUMENT_ROOT); // Define array of document root directories ('/home/htdocs')
|
$conf->file->dol_document_root = array('main' => (string) DOL_DOCUMENT_ROOT); // Define array of document root directories ('/home/htdocs')
|
||||||
$conf->file->dol_url_root = array('main' => (string) DOL_URL_ROOT); // Define array of url root path ('' or '/dolibarr')
|
$conf->file->dol_url_root = array('main' => (string) DOL_URL_ROOT); // Define array of url root path ('' or '/dolibarr')
|
||||||
if (!empty($dolibarr_main_document_root_alt)) {
|
if (!empty($dolibarr_main_document_root_alt)) {
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
* \remarks To run this script as CLI: phpunit filename.php
|
* \remarks To run this script as CLI: phpunit filename.php
|
||||||
*/
|
*/
|
||||||
|
|
||||||
global $conf,$user,$langs,$db;
|
global $conf,$user,$langs,$db,$mysoc;
|
||||||
//define('TEST_DB_FORCE_TYPE','mysql'); // This is to force using mysql driver
|
//define('TEST_DB_FORCE_TYPE','mysql'); // This is to force using mysql driver
|
||||||
//require_once 'PHPUnit/Autoload.php';
|
//require_once 'PHPUnit/Autoload.php';
|
||||||
require_once dirname(__FILE__).'/../../htdocs/master.inc.php';
|
require_once dirname(__FILE__).'/../../htdocs/master.inc.php';
|
||||||
@@ -199,6 +199,11 @@ class FunctionsLibTest extends PHPUnit\Framework\TestCase
|
|||||||
$sql = forgeSQLFromUniversalSearchCriteria($filter);
|
$sql = forgeSQLFromUniversalSearchCriteria($filter);
|
||||||
$this->assertEquals(" AND ((t.ref LIKE 'SO-%') or (t.date_creation < '20160101') or (t.date_creation < 0) or (t.nature IS NULL))", $sql);
|
$this->assertEquals(" AND ((t.ref LIKE 'SO-%') or (t.date_creation < '20160101') or (t.date_creation < 0) or (t.nature IS NULL))", $sql);
|
||||||
|
|
||||||
|
$filter = 't.fk_soc IN (SELECT rowid FROM llx_societe WHERE fournisseur = 1)';
|
||||||
|
$sql = forgeSQLFromUniversalSearchCriteria($filter);
|
||||||
|
$this->assertEquals(" xxx", $sql);
|
||||||
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -388,11 +393,11 @@ class FunctionsLibTest extends PHPUnit\Framework\TestCase
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
$result=dol_buildpath('/google/oauth2callback.php', 2);
|
$result=dol_buildpath('/google/oauth2callback.php', 2);
|
||||||
print __METHOD__." result=".$result."\n";
|
print __METHOD__." dol_buildpath result=".$result."\n";
|
||||||
$this->assertStringStartsWith('http', $result);
|
$this->assertStringStartsWith('http', $result);
|
||||||
|
|
||||||
$result=dol_buildpath('/google/oauth2callback.php', 3);
|
$result=dol_buildpath('/google/oauth2callback.php', 3);
|
||||||
print __METHOD__." result=".$result."\n";
|
print __METHOD__." dol_buildpath result=".$result."\n";
|
||||||
$this->assertStringStartsWith('http', $result);
|
$this->assertStringStartsWith('http', $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1634,13 +1639,13 @@ class FunctionsLibTest extends PHPUnit\Framework\TestCase
|
|||||||
$langs->load("main");
|
$langs->load("main");
|
||||||
|
|
||||||
// Try simple replacement
|
// Try simple replacement
|
||||||
$substit = array("__AAA__"=>'Not used', "__BBB__"=>'Not used', "__CCC__"=>"C replaced", "DDD"=>"D replaced");
|
$substit = array("__AAA__"=>'Not used', "__BBB__"=>'Not used', "__CCC__"=>"C instead", "DDD"=>"D instead");
|
||||||
$substit += getCommonSubstitutionArray($langs);
|
$substit += getCommonSubstitutionArray($langs);
|
||||||
|
|
||||||
$chaine = 'This is a string with theme constant __[MAIN_THEME]__ and __(DIRECTION)__ and __CCC__ and DDD and __MYCOMPANY_NAME__ and __YEAR__';
|
$chaine = 'This is a string with theme constant __[MAIN_THEME]__ and __(DIRECTION)__ and __CCC__ and DDD and __MYCOMPANY_NAME__ and __YEAR__';
|
||||||
$newstring = make_substitutions($chaine, $substit);
|
$newstring = make_substitutions($chaine, $substit);
|
||||||
print __METHOD__." ".$newstring."\n";
|
print __METHOD__." ".$newstring."\n";
|
||||||
$this->assertEquals($newstring, 'This is a string with theme constant eldy and ltr and C replaced and D replaced and '.$mysoc->name.' and '.dol_print_date(dol_now(), '%Y', 'gmt'));
|
$this->assertEquals($newstring, 'This is a string with theme constant eldy and ltr and C instead and D instead and '.$mysoc->name.' and '.dol_print_date(dol_now(), '%Y', 'gmt'));
|
||||||
|
|
||||||
// Try mix HTML not HTML, no change on initial text
|
// Try mix HTML not HTML, no change on initial text
|
||||||
$substit = array("__NOHTML__"=>'No html', "__HTML__"=>'<b>HTML</b>');
|
$substit = array("__NOHTML__"=>'No html', "__HTML__"=>'<b>HTML</b>');
|
||||||
|
|||||||
Reference in New Issue
Block a user