Topic: Report Generator

Running the report generator after installation only gives a blank screen. All the files are in the repgen subdirectory in modules
Please advice

Re: Report Generator

Set the variable, $go_debug, to 1 in the file config.php. That will tell you about the errors.

/Joe

Re: Report Generator

I am beginning to get repgen to work ( v2.1.5 of FA ). I needed to fix :

A) Security Level in module install
- security level on inst_module.php. As installed it is set to $page_security = 20;;however the  whilst security level in config.php as installed are
            array(1,2),
            array(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16),
            array(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,20),
and despite logging in as administrator ( and the screen showing administrator it refused me access
correcting this to $page_security = 16; allowed the installation routine to work.

Have I discovered a bug or a feature? as I understood these arrays related to inquiries,accountant,administrator respectively and therefore the admin should have security level 20.

B) Test of sql statement in repgen_create.php. On line 204 I added ?sql=$sql to the url to get rid of a SQL Statement is empty error. I note that the OpenWindow php function didn't set the method to GET or POST prior to the submit -

Enough for now...

Cheers

Vernon

4 (edited by apmuthu 11/10/2009 04:36:06 pm)

Re: Report Generator

Tested repgen on FA v2.1.6 and v2.1.7 and it installed flawlessly with no changes at all.

Logged in as Admin in the Company 0 (default) and was able to see the default reports.

When we try to EDIT any of the 3 default reports
and then we go to the "Page definition for Strings",
we are unable to edit any record in the "Table of Stored Items" there.

5 (edited by apmuthu 11/10/2009 07:55:25 pm)

Re: Report Generator

Refer file /modules/repgen/repgen_strings.php :-

Line 654 is the "start_form" statement and it is inside a cell of a table and PHP decides to auto close the form within the cell itself. Hence the Line 681 which is the actual "end_form()" does not get used where intended.

The start_form() and end_form() statements must be outside of the row cells showing the current Page String Records to be effectve. If each record is in a table of it's own, it will be effective.

6 (edited by apmuthu 11/10/2009 05:26:03 pm)

Re: Report Generator

Lines 653 and 680 have typos:
    echo "<td style='width;0px;display:none;'>\n";
should be
    echo "<td style='width:0px;display:none;'>\n";

The semicolon (;) after "width" should be a colon (:).

This still does not as yet solve the problem.

Re: Report Generator

The above colon typo applies to Lines 259 and 300  in /modules/repgen/repgen_graphics.php as well.

Re: Report Generator

A new report can be created but items cannot be added. The EDIT and INSERT are broken.

Re: Report Generator

For a start, I have done some code cleanup for /modules/repgen/repgen_strings.php by bringing all form elements into one cell for each record. They just have the same name for each record's form.

The last empty column after "Action" is removed in Line 602 by replacing:
$th = array(IT_TYP, IT_ART, IT_FONT, IT_FONT_SIZE, IT_ORD, IT_LEN, IT_X1, IT_Y1, "Total", IT_STRING, "Action", "");
with
$th = array(IT_TYP, IT_ART, IT_FONT, IT_FONT_SIZE, IT_ORD, IT_LEN, IT_X1, IT_Y1, "Total", IT_STRING, "Action");


Then replace the snippet from "existing items" till "end of while" with:

// <!-- existing items -->

    $hiddenattrs  = hidden("id1", $id_new, false);
    $hiddenattrs .= hidden("attrib", $val, false);
    $hiddenattrs .= hidden("id_new", $id_new, false);
    $hiddenattrs .= hidden("sql", $sql,false);
    $hiddenattrs .= hidden("long", $long, false);
   
    alt_table_row_color($k);
    label_cell($it_typ);
    label_cell($it_art);
    label_cell($it_font);
    label_cell($it_fontsize);
    label_cell($it_ord);
    label_cell($it_number);
    label_cell($it_x1);
    label_cell(($it_y1 != "" ? $it_y1 : "."));
    label_cell(($it_total != "" ? $it_total : "."));
    if (in_array($it_typ, array("Line","Rectangle")))
        label_cell(".");
    else
    {
        if (!(empty($it_from) || empty($it_to)))
            label_cell($it_str."(".$it_from."-".$it_to.")");
        else
            label_cell($it_str);
    }
    if (in_array($it_typ,array("String","DB","Term","Block","Textarea")))
        $editbutton = submit("alter", CHANGE, false);
    else
        $editbutton = " ";
    echo "<td>\n";
    start_form(false, false, "repgen_strings.php?report_type=".$report_type, "edit");
    echo $hiddenattrs . $editbutton . submit("delete", DELETE, false);
    end_form();
    echo "</td>\n";

    end_row();
   
}  // end of while


The form URL is still suspect - the $report_type variable in the submit url may cause problems with the other POST variables.

Re: Report Generator

It would be nice if this board enables file attachments.

Re: Report Generator

Both files: /modules/repgen/repgen_strings.php and repgen_graphics.php do not have any UPDATE / REPLACE SQL query for case="alter" and hence no updations occur. Hence we will have to manually enter the item values into the table for now.

The repgen_graphics.php uses the $k row variable for the "edit" form names and this alternates between 0 and 1 as it is used for alternate row colors. Another variable should be used to serially number the form name like edit1, edit2, etc. This is totally absent in repgen_strings.php.

Re: Report Generator

As there is no Primary Key field in the xx_reports table, even DELETION will not work reliably if it does work at all.

13 (edited by apmuthu 11/10/2009 09:18:46 pm)

Re: Report Generator

Hack so far - still insert, edit and delete do not work.

The last part of the repgen_strings.php now stands as:

$k = 0;   // line-number (for row color)
$kk = 0; // For input field name serial
while (list ($key,$val) = each($rec_ar))
{
    $h = explode("|",$val);
    for ($i = 0; $i < 16; $i++)
    {
        if (!isset($h[$i]))
            $h[$i] = "";
    }
    $it_typ=$h[0];
    $it_art = $h[1];
    $it_font = $h[2];
    $it_fontsize = $h[3];
    $it_number = $h[4];
    $it_x1 = $h[5];
    $it_y1 = $h[6];
    if (in_array($it_typ, array("String","DB","Term","Block","Textarea")))
        $it_str = $h[7];
    $it_ord = $h[8];
    $it_from = $h[10];
    $it_to = $h[11];
    $it_total = $h[12];
    $it_o_score = $h[13];
    $it_u_score = $h[14];
    $it_bold = $h[15];

    // <!-- existing items -->
   
    $hiddenattrs  = hidden("id1", $id_new, false);
    $hiddenattrs .= hidden("attrib", $val, false);
    $hiddenattrs .= hidden("id_new", $id_new, false);
    $hiddenattrs .= hidden("sql", $sql, false);
    $hiddenattrs .= hidden("long", $long, false);

    alt_table_row_color($k);
    label_cell($it_typ);
    label_cell($it_art);
    label_cell($it_font);
    label_cell($it_fontsize);
    label_cell($it_ord);
    label_cell($it_number);
    label_cell($it_x1);
    label_cell(($it_y1 != "" ? $it_y1 : "."));
    label_cell(($it_total != "" ? $it_total : "."));
    if (in_array($it_typ, array("Line","Rectangle")))
        label_cell(".");
    else
    {
        if (!(empty($it_from) || empty($it_to)))
            label_cell($it_str."(".$it_from."-".$it_to.")");
        else
            label_cell($it_str);
    }
    if (in_array($it_typ,array("String","DB","Term","Block","Textarea")))
        $editbutton = submit("alter", CHANGE, false);
    else
        $editbutton = " ";
    echo "<td>\n";
    start_form(false, false, "repgen_strings.php?report_type=".$report_type, "edit");
    echo $hiddenattrs . $editbutton . submit("delete", DELETE, false);
    end_form();
    echo "</td>\n";
    end_row();
    $kk++;
}  // end of while

end_table(1);

end_page();
?>