diff --git a/build/makepack-dolibarr.pl b/build/makepack-dolibarr.pl index b9bdaba4e86..5862f3f2970 100755 --- a/build/makepack-dolibarr.pl +++ b/build/makepack-dolibarr.pl @@ -627,11 +627,11 @@ if ($nboftargetok) { $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/sabre/sabre/*/tests`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/stripe/tests`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/stripe/LICENSE`; - $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/examples`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/fonts/dejavu-fonts-ttf-*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/fonts/freefont-*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/fonts/ae_fonts_*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/fonts/utils`; + $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/examples`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/tools`; $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/vendor`; $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/webmozart`; diff --git a/dev/dolibarr_changes.txt b/dev/dolibarr_changes.txt index dd2ef0023de..89d87a4ab14 100644 --- a/dev/dolibarr_changes.txt +++ b/dev/dolibarr_changes.txt @@ -185,6 +185,23 @@ with: return strval($number); } +* Add this at begin of tcpdf_autoconfig.php + + // @CHANGE LDR DOCUMENT_ROOT fix for IIS Webserver + if ((!isset($_SERVER['DOCUMENT_ROOT'])) OR (empty($_SERVER['DOCUMENT_ROOT']))) { + if (isset($_SERVER['SCRIPT_FILENAME']) && isset($_SERVER['PHP_SELF'])) { + $_SERVER['DOCUMENT_ROOT'] = str_replace( '\\', '/', substr($_SERVER['SCRIPT_FILENAME'], 0, 0-strlen($_SERVER['PHP_SELF']))); + } elseif(isset($_SERVER['PATH_TRANSLATED'])) { + $_SERVER['DOCUMENT_ROOT'] = str_replace( '\\', '/', substr(str_replace('\\\\', '\\', $_SERVER['PATH_TRANSLATED']), 0, 0-strlen($_SERVER['PHP_SELF']))); + } else { + // define here your DOCUMENT_ROOT path if the previous fails (e.g. '/var/www') + $_SERVER['DOCUMENT_ROOT'] = '/'; + } + } + $_SERVER['DOCUMENT_ROOT'] = str_replace('//', '/', $_SERVER['DOCUMENT_ROOT']); + if (substr($_SERVER['DOCUMENT_ROOT'], -1) != '/') { + $_SERVER['DOCUMENT_ROOT'] .= '/'; + } TCPDI: diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index 9907ac5f397..1e891a8a6ab 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -1733,4 +1733,51 @@ abstract class CommonDocGenerator return 1; } + + /** + * Define Array Column Field into $this->cols + * This method must be implemented by the module that generate the document with its own columns. + * + * @param Object $object Common object + * @param Translate $outputlangs Langs + * @param int $hidedetails Do not show line details + * @param int $hidedesc Do not show desc + * @param int $hideref Do not show ref + * @return void + */ + public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0) + { + // Default field style for content + $this->defaultContentsFieldsStyle = array( + 'align' => 'R', // R,C,L + 'padding' => array(1, 0.5, 1, 0.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left + ); + + // Default field style for content + $this->defaultTitlesFieldsStyle = array( + 'align' => 'C', // R,C,L + 'padding' => array(0.5, 0, 0.5, 0), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left + ); + + // Example + /* + $rank = 0; // do not use negative rank + $this->cols['desc'] = array( + 'rank' => $rank, + 'width' => false, // only for desc + 'status' => true, + 'title' => array( + 'textkey' => 'Designation', // use lang key is usefull in somme case with module + 'align' => 'L', + // 'textkey' => 'yourLangKey', // if there is no label, yourLangKey will be translated to replace label + // 'label' => ' ', // the final label + 'padding' => array(0.5, 0.5, 0.5, 0.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left + ), + 'content' => array( + 'align' => 'L', + 'padding' => array(1, 0.5, 1, 1.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left + ), + ); + */ + } } diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index cc29338325a..29b47a624b3 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -9362,7 +9362,7 @@ function dol_eval($s, $returnvalue = 0, $hideerrors = 1, $onlysimplestring = '1' } catch (Error $e) { $error = 'dol_eval try/catch error : '; $error .= $e->getMessage(); - dol_syslog($error); + dol_syslog($error, LOG_WARNING); } } diff --git a/htdocs/core/modules/supplier_proposal/doc/pdf_zenith.modules.php b/htdocs/core/modules/supplier_proposal/doc/pdf_zenith.modules.php index b9bdcb9f3e8..d876d5a6b12 100644 --- a/htdocs/core/modules/supplier_proposal/doc/pdf_zenith.modules.php +++ b/htdocs/core/modules/supplier_proposal/doc/pdf_zenith.modules.php @@ -1446,7 +1446,7 @@ class pdf_zenith extends ModelePDFSupplierProposal /** * Define Array Column Field * - * @param object $object common object + * @param Object $object common object * @param Translate $outputlangs langs * @param int $hidedetails Do not show line details * @param int $hidedesc Do not show desc @@ -1469,24 +1469,6 @@ class pdf_zenith extends ModelePDFSupplierProposal 'padding' => array(0.5, 0, 0.5, 0), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left ); - /* - * For exemple - $this->cols['theColKey'] = array( - 'rank' => $rank, // int : use for ordering columns - 'width' => 20, // the column width in mm - 'title' => array( - 'textkey' => 'yourLangKey', // if there is no label, yourLangKey will be translated to replace label - 'label' => ' ', // the final label : used fore final generated text - 'align' => 'L', // text alignement : R,C,L - 'padding' => array(0.5,0.5,0.5,0.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left - ), - 'content' => array( - 'align' => 'L', // text alignement : R,C,L - 'padding' => array(0.5,0.5,0.5,0.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left - ), - ); - */ - $rank = 0; // do not use negative rank $this->cols['desc'] = array( 'rank' => $rank, diff --git a/htdocs/includes/tecnickcom/tcpdf/tcpdf_autoconfig.php b/htdocs/includes/tecnickcom/tcpdf/tcpdf_autoconfig.php index 6ec9ce83bb8..3767b823442 100644 --- a/htdocs/includes/tecnickcom/tcpdf/tcpdf_autoconfig.php +++ b/htdocs/includes/tecnickcom/tcpdf/tcpdf_autoconfig.php @@ -40,11 +40,11 @@ * @version 1.1.1 */ -// DOCUMENT_ROOT fix for IIS Webserver +// @CHANGE LDR DOCUMENT_ROOT fix for IIS Webserver if ((!isset($_SERVER['DOCUMENT_ROOT'])) OR (empty($_SERVER['DOCUMENT_ROOT']))) { - if(isset($_SERVER['SCRIPT_FILENAME'])) { + if (isset($_SERVER['SCRIPT_FILENAME']) && isset($_SERVER['PHP_SELF'])) { $_SERVER['DOCUMENT_ROOT'] = str_replace( '\\', '/', substr($_SERVER['SCRIPT_FILENAME'], 0, 0-strlen($_SERVER['PHP_SELF']))); - } elseif(isset($_SERVER['PATH_TRANSLATED'])) { + } elseif (isset($_SERVER['PATH_TRANSLATED']) && isset($_SERVER['PHP_SELF'])) { $_SERVER['DOCUMENT_ROOT'] = str_replace( '\\', '/', substr(str_replace('\\\\', '\\', $_SERVER['PATH_TRANSLATED']), 0, 0-strlen($_SERVER['PHP_SELF']))); } else { // define here your DOCUMENT_ROOT path if the previous fails (e.g. '/var/www') diff --git a/test/phpunit/FunctionsLibTest.php b/test/phpunit/FunctionsLibTest.php index 287f759982c..c8843d36209 100644 --- a/test/phpunit/FunctionsLibTest.php +++ b/test/phpunit/FunctionsLibTest.php @@ -1117,12 +1117,12 @@ class FunctionsLibTest extends PHPUnit\Framework\TestCase { $s=img_picto('title', 'user'); print __METHOD__." s=".$s."\n"; - $this->assertContains('fa-user', $s, 'testImgPicto1'); + $this->assertStringContainsStringIgnoringCase('fa-user', $s, 'testImgPicto1'); $s=img_picto('title', 'img.png', 'style="float: right"', 0); print __METHOD__." s=".$s."\n"; - $this->assertContains('theme', $s, 'testImgPicto2'); - $this->assertContains('style="float: right"', $s, 'testImgPicto2'); + $this->assertStringContainsStringIgnoringCase('theme', $s, 'testImgPicto2'); + $this->assertStringContainsStringIgnoringCase('style="float: right"', $s, 'testImgPicto2'); $s=img_picto('title', '/fullpath/img.png', '', 1); print __METHOD__." s=".$s."\n"; diff --git a/test/phpunit/SecurityTest.php b/test/phpunit/SecurityTest.php index d4d45837e74..d6fad65c570 100644 --- a/test/phpunit/SecurityTest.php +++ b/test/phpunit/SecurityTest.php @@ -1031,7 +1031,8 @@ class SecurityTest extends PHPUnit\Framework\TestCase print "result18 = ".$result."\n"; $this->assertFalse($result); - $result = (string) dol_eval("(\$a.'aa')", 1, 0); + $a='ab'; + $result = (string) dol_eval("(\$a.'s')", 1, 0); print "result19 = ".$result."\n"; $this->assertStringContainsString('Bad string syntax to evaluate', $result);