User authentication is temporarily unavailable. If this situation persists, please inform your Wiki Admin.

Mods to the PHP Reports code

Mods have been done to the PHPReports code - need to be documented so when/if we go to a new release we know what changes to re-apply.

The following changes has been done to fix the PHP5 warnings of deprecated use of array_push function by passing variables by reference:-


In \library\phpreports\php\PHPReportRow.php Lines 12-14

Replace

		function addCol(&$oCol_) {
			array_push($this->_aCols,&$oCol_);
		}

With

		function addCol($oCol_) {
			array_push($this->_aCols,$oCol_);
		}

In \library\phpreports\xsl\PHPReportCol.xsl Line 93

Replace

		<xsl:text>&#9;$oRow->addCol(&amp;$oCol</xsl:text><xsl:value-of select="count(preceding::*[name()='COL'])+1"/><xsl:text>);&#10;</xsl:text>

With

		<xsl:text>&#9;$oRow->addCol($oCol</xsl:text><xsl:value-of select="count(preceding::*[name()='COL'])+1"/><xsl:text>);&#10;</xsl:text>

In /modules/reports/PHPReportsUtil.php Lines 15-16

Replace

	function getPHPReportsIncludePath(){
		$ipsep = stristr(PHP_OS,"LINUX")?":":";";

With

	function getPHPReportsIncludePath(){
		$ipsep = stristr(PHP_OS,"LINUX")?":":";";
		$ipsep = stristr(PHP_OS,"DARWIN")?":":$ipsep;

refer: http://groups.google.com/group/simpleinvoices-trac/browse_thread/thread/9213f3535c1d7bcb

The above changes to PHPReportUtil.php is no longer necessary as we have the PHP pre-defined constant PATH_SEPARATOR which is now used in /include/reportlib.php file. With the migration to the latest version of PHPReports (v0.4.9) and it's shift to the new /library/phpreports folder, we need to make the following change to the PHPReportMaker.php file without hard coding the temp cache folder.

In /library/phpreports/PHPReportMaker.php at Line 62:

Replace

 
			$this->_sTmp				= getPHPReportsTmpPath();

with

			$this->_sTmp				= dirname(dirname(dirname(__FILE__))) . "/cache";

The reportlib.php contains the necessary ini include path setting code:

// needed for /library/phpreports to function
$val = ini_get("include_path");
$val = $val . ":" . "./library/phpreports";
ini_set("include_path", $val);

Hence there is no need for a /tmp folder.

With the advent of PDO based DB connection (SI PDO Driver in library/phpreports/database/db_pdo.php) in the Trunk version (Multi Domain Version), it has become necessary to make a change in /library/phpreports/xslt/PHPReportRpt.xsl

Replace Line 231

	if(!is_resource($oCon)

With

	if(!is_resource($oCon) &amp;&amp; !is_object($oCon))

The said PDO driver should be ported to any upgrade as well.

In /modules/reports/PHPReportsUtil.php

Replace

      function getPHPReportsFilePath(){
          $sPath = getPHPReportsIncludePath();
          if(!is_null($sPath))
              return $sPath;
          // put your distro path here
          return "/var/htdocs/phpreports/";          
      }

With

     function getPHPReportsFilePath(){
         /*$sPath = getPHPReportsIncludePath();
         if(!is_null($sPath))
             return $sPath;
         // put your distro path here
         return $_SERVER["DOCUMENT_ROOT"]."/library/phpreports/"; 
         */
         /* SimpleInvoices.org mod*/
         return dirname(__FILE__)."/"; 
     }

Refer: http://simpleinvoices.org/forum/discussion/709/?Focus=4123#Item_7

Earlier version of PHPReports used class name “table.reportHeader” that was suitably defined in /templates/default/css/screen.css . The current version of PHPReports uses ID attribute “table#pg1” and “table#pg2” and hence the CSS file has been updated too with the following:

/* Old PHP Reports CSS  - uses class="reportTable" */
 
table.reportTable {
	border:1px solid #000; }
 
*+html table.reportTable {
	border-collapse:separate; }
 
*+html td.PAGE_LAYER {
	border-width:thin;
	border:1px solid #000;
	border-collapse:separate; }
 
*+html table.reportTable tr {
	border:1px solid #000;
	border-collapse:separate; }
 
table.reportTable td.PAGE_LAYER {
	background-color:#ccc;
	border-color:#000; }
 
/* New PHPreports CSS - uses ID="pg2" or "pg1"  - Although HEADER and FOOTER are used now instead of PAGE_LAYER, it is left as is for compatibility */
 
table#pg1 {
	border:1px solid #000; }
 
*+html table#pg1 {
	border-collapse:separate; }
 
*+html td.PAGE_LAYER {
	border-width:thin;
	border:1px solid #000;
	border-collapse:separate; }
 
*+html table#pg1 tr {
	border:1px solid #000;
	border-collapse:separate; }
 
table#pg1 td.PAGE_LAYER {
	background-color:#ccc;
	border-color:#000; }
 
table#pg1 td.GROUP_LAYER {
	background-color:#fff;
	border-color:#000; }
 
table#pg2 {
	border:1px solid #000; }
 
*+html table#pg2 {
	border-collapse:separate; }
 
*+html td.PAGE_LAYER {
	border-width:thin;
	border:1px solid #000;
	border-collapse:separate; }
 
*+html table#pg2 tr {
	border:1px solid #000;
	border-collapse:separate; }
 
table#pg2 td.PAGE_LAYER {
	background-color:#ccc;
	border-color:#000; }
 
table#pg2 td.GROUP_LAYER {
	background-color:#fff;
	border-color:#000; }
 
 | wiki/phpreport_mods.txt · Last modified: 2016/10/11 06:15 (external edit)