Problem with Bar codes on reports pdf app (URGENT)

Hi, I have a table with a bar code field.
If I use a grid to show the data all works fine.
But when I use a report pdf app I receive this error message:

Parse error: syntax error, unexpected T_ELSE in C:\Program Files (x86)\NetMake\v5\wwwroot\scriptcase\app\Cargas_Peligrosas\pdfreport_certificados\pdfreport_certificados_grid.class.php on line 501

No matter what type of barcode I use, the error remains.

If I use text type, all works fine, only I receive the error when I use the barcode type.

What Can I do?

Thanks in advance.

Re: Problem with Bar codes on reports pdf app (URGENT)

Have you loaded that page and looked at the PHP code on line 501?
Perhaps the generator is creating bad code?

Hopefully the long file name in your path is not causing problems?

C:\Program Files (x86)\

Regards,
Scott.

Re: Problem with Bar codes on reports pdf app (URGENT)

Hi, thanks for answer.

I try with C:DataSistemasSitiosWebIntranetpdfpdf_cerpdf_cer_grid.class.php

But it’s the same, the error ramains (just when I select barcode type).
The file exists, and the code is this:

Before the line 501:

$this->codigo_barras[$this->nm_grid_colunas] = trim($this->codigo_barras[$this->nm_grid_colunas]); 
     if (empty($this->codigo_barras[$this->nm_grid_colunas]) || $this->codigo_barras[$this->nm_grid_colunas] == "none" || $this->codigo_barras[$this->nm_grid_colunas] == "*nm*") 
     { 
       $this->codigo_barras[$this->nm_grid_colunas] = "" ; 
       $out_codigo_barras = "" ; 
     } 
     else  
     { 
       $Font_bar = new BCGFont($this->Ini->path_third . '/barcodegen/class/font/Arial.ttf', 8);
       $Color_black = new BCGColor(0, 0, 0);
       $Color_white = new BCGColor(255, 255, 255);
       $out_codigo_barras = $this->Ini->path_imag_temp . "/sc_code39extended_" . $_SESSION['scriptcase']['sc_num_img'] . session_id() . ".gif";
       $_SESSION['scriptcase']['sc_num_img']++ ;
       $this->codigo_barras[$this->nm_grid_colunas] = (string) $this->codigo_barras[$this->nm_grid_colunas];
       $Code_bar = new BCGcode39extended();
       $Code_bar->setScale(1);
       $Code_bar->setThickness(30);
       $Code_bar->setForegroundColor($Color_black);
       $Code_bar->setBackgroundColor($Color_white);
       $Code_bar->setFont($Font_bar);
       $Code_bar->setChecksum(false);
       $Code_bar->parse($this->codigo_barras[$this->nm_grid_colunas]);
       $Drawing_bar = new BCGDrawing($this->Ini->root . $out_codigo_barras, $Color_white);
       $Drawing_bar->setBarcode($Code_bar);
       $Drawing_bar->setDPI(72);
       $Drawing_bar->draw();
       $Drawing_bar->finish(BCGDrawing::IMG_FORMAT_GIF);
     } 

The line 501 is just: else

and after the line (the code of that else)

{ 
       $this->codigo_barras[$this->nm_grid_colunas] = nl2br($this->codigo_barras[$this->nm_grid_colunas]) ; 
       $temp = explode("<br />", $this->codigo_barras[$this->nm_grid_colunas]); 
       if (!isset($temp[1])) 
       { 
         $temp = explode("<br>", $this->codigo_barras[$this->nm_grid_colunas]); 
       } 
       $this->codigo_barras[$this->nm_grid_colunas] = "" ; 
       $ind_x = 0 ; 
       while (isset($temp[$ind_x])) 
       { 
         if (!empty($this->codigo_barras[$this->nm_grid_colunas])) 
         { 
           $this->codigo_barras[$this->nm_grid_colunas] .= "<br>"; 
         } 
         if (strlen($temp[$ind_x]) > 50) 
         { 
           $this->codigo_barras[$this->nm_grid_colunas] .= wordwrap($temp[$ind_x], 50, "<br>"); 
         } 
         else 
         { 
           $this->codigo_barras[$this->nm_grid_colunas] .= $temp[$ind_x]; 
         } 
         $ind_x++; 
       } 
     } 

I don’t know what happens…

Re: Problem with Bar codes on reports pdf app (URGENT)

There is a syntax error somewhere in the code.

It could be:
-SC is just missing curly bracket above in earlier code.
-SC is having problems with a invalid variable
-Your invalid variable in your code is messing up the generated code

You may have to run the entire generated code in a PHP checker or load a PHP editor that checks for syntax error live. (phpStorm)
http://www.icosaedro.it/phplint/phplint-on-line.html
google: php online validator

This is going to be a bit of trial end error for you to find out why SC is creating bad code.

Regards,
Scott.

Re: Problem with Bar codes on reports pdf app (URGENT)

Wow, is complicated, I use a simple table, without parameters or variables, the code was generated fine, if I use for this field, text type. But only when I use code bar the bad code appears.

The code parser shows this:

==== 499: ERROR: unknown class `BCGDrawing'
500:       } 
501:       else  

         else  
           \_ HERE
==== 501: FATAL ERROR: unexpected symbol sym_else

So, still I don’t have dea what happens.

But, if I made the file with a text field, and when the code is generated I change this part for the code that SC use to barcodes, maybe thats work??

Re: Problem with Bar codes on reports pdf app (URGENT)

Report this as a bug. SC is not knowing what to do with the field type. You may have to export the app and send it to support so they can review the app and generated code.

Regards,
Scott.

[QUOTE=quatrero;6081]Hi, I have a table with a bar code field.
If I use a grid to show the data all works fine.
But when I use a report pdf app I receive this error message:

Parse error: syntax error, unexpected T_ELSE in C:\Program Files (x86)\NetMake\v5\wwwroot\scriptcase\app\Cargas_Peligrosas\pdfreport_certificados\pdfreport_certificados_grid.class.php on line 501

No matter what type of barcode I use, the error remains.

If I use text type, all works fine, only I receive the error when I use the barcode type.

What Can I do?

Thanks in advance.[/QUOTE]
hey, can you reset the php code ?

If you have this kind of code then scriptcase basically makes a mess of it on various occasions (yes this is a bug):
if (something) dosomething;

if you use this then it goes fine:
if (something) {dosomething};

So in respect of that you could surrond your code with { } and see if it then does work properly. The parser has some minor bugs.
So alternatively you could even try:
{
if (something) {dosomething};
}

I hope that helps for you, for me a similar construction worked…

[QUOTE=Nana111;21713]Hi there
I have encountered the similar questions with you.
I tried to read barcode in pdf document.But it can not work.So i want to know that if there is a powerful pdf barcode generater which supports to do that directly instead of entering code
Because it is difficult for me.Thanks for any suggestions.[/QUOTE]

er…not sure about that