MantisBT - v3.0 Release
View Issue Details
0001024v3.0 Release[All Projects] Generalpublic2011-11-30 04:362013-08-28 11:22
Reporterproject_manager 
Assigned Tocaseydk 
PrioritynormalSeveritycrashReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version3.0.0 
Summary0001024: bug description & suggested solution
Descriptionhttp://forums.web2project.net/viewtopic.php?p=13827#13827

@pedroa:
@opto:

Thanks opto, I installed XAMPP for Win on my VISTA-PC and started to debug the php-code with Netbeans & Xdebug. Very nice & so simpel. I would recommend for anyone to do it. If I can do (no clue about servers, php and so on) probably anybody can do it too....

As I already evaluated in the posts before the error is caused by a really stupid syntax bug!

Enclosed I put also the "gantt_pdf.php" where I marked and commented the problem & solution.

The slicing works for the tasks (25x) but I kept the time-x-axis constant, so I dont know this is the expected behaviour. Otherwise the date-range on each slice has to be handled.

I would suggest that the developers take this as a suggestion, reviewing it and rework it where necessary and put it to SVN.

@pedroa:
Could you please additionally post the bug that the time-range can not be adjusted by the start/end-Tabs in the top of the view? It would be nice to adjust the time scale as already for the gantt-view possible! Thanks.

---------------------------------------------------------------------------
Change the following in gantt_pdf.php:

// set here any date span you want: bug work around!
$start_date = '2012-03-01 00:00:00' ;
$end_date = '2012-05-01 00:00:00' ;

/* --------------------------------------------------------- */
// initial store String variables $start_date & $end_date !!!
/* --------------------------------------------------------- */
$start_date2 = $start_date;
$end_date2 = $end_date;

/* --------------------------------------------------------- */
// 1. loop handling the number of sliced sub-projects, each having 25/26 tasks
/* --------------------------------------------------------- */
foreach ($gtask_sliced as $gts) {

/* --------------------------------------------------------- */
// always restore String variables $start_date & $end_date !!!
/* --------------------------------------------------------- */
$start_date = $start_date2;
$end_date = $end_date2;
/* --------------------------------------------------------- */
//
// during slicing(), if more than 25 tasks !, the variables $start_date & $end_date are re-assigned to an object...
// and also re-used in an another context.
//
// ---> in 2. loop: for($i = 0; $i ... count($gts); $i ++) {...
// ---> re-assign & re-use:
//
// $start_date = new w2p_Utilities_Date($a['task_start_date']);
// $end_date = new w2p_Utilities_Date($a['task_end_date']);
//
// causing:
// "strpos() expects parameter 1 to be string, object given in /var/customers/.../web2project-3.0/lib/jpgraph/src/jpgraph_gantt.php on line 524"
/* --------------------------------------------------------- */
---------------------------------------------------------------------------


Please notice also the other bug-report/solution for:

"JpGraph Error General PHP error : Undefined variable: criticalTasks"

http://forums.web2project.net/viewtopic.php?p=13826#13826

roger & out.
Additional Informationprobably all versions, syntax/logic bug in "gantt_pdf.php".
should be reviewed by the developers to accept
TagsNo tags attached.
Attached Filestxt gantt_pdf.php.txt (23,981) 1969-12-31 16:00
https://bugs.web2project.net/file_download.php?file_id=300&type=bug

Notes
(0002339)
kareljj   
2011-12-08 05:35   
Hi, I tested the suggested workaround and it definitely, generates the pdf Gantt but not correctly as expected. In my case I have 32 tasks but only 20 are printed. They appear on the same page but with the legend between them.
(0002340)
project_manager   
2011-12-08 06:40   
@kareljj,
this posted solution avoids the reported bug-error that appears only with more than 25 tasks and the sclicing() starts to work. The print out quality is still not satisfying as you described. Now the "project-cutting" is performed only on the y-axis (tasks) and the x-axis (time scale) is kept const yielding probably not in a optimal paper-sheet cut. As I dont know how it should work and have never seen a correct working version, it is hard to debug it further. The developer should decide, how the proper output should look like. Probably the x-axis has to be scaled as well.
With only 32tasks you can avoid the sclicing-loop by setting this:
// $length = ($showNoMilestones) ? 26 : 25;
$length = ($showNoMilestones) ? 1000 : 1000;
and all will be scaled to one sheet.
(0002341)
project_manager   
2011-12-08 06:42   
I have seen an additional problem, as the depedency arrows (lines) are not plotted anymore on the 2. pdf-slice, only tasks become visible!
(0002366)
caseydk   
2011-12-27 22:10   
Resolved in r2263 along with 0001023;

Issue History
2011-11-30 04:36project_managerNew Issue
2011-11-30 04:42project_managerFile Added: gantt_pdf.php.txt
2011-12-08 05:35kareljjNote Added: 0002339
2011-12-08 06:40project_managerNote Added: 0002340
2011-12-08 06:42project_managerNote Added: 0002341
2011-12-27 22:10caseydkNote Added: 0002366
2011-12-27 22:10caseydkStatusnew => resolved
2011-12-27 22:10caseydkResolutionopen => fixed
2011-12-27 22:10caseydkAssigned To => caseydk
2013-08-28 11:14caseydkFixed in Version => 3.0.0
2013-08-28 11:22caseydkStatusresolved => closed