Announcement

Collapse
No announcement yet.

Problem with Bar codes on reports pdf app (URGENT)

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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:

    Code:
    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.

  • #2
    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?
    Code:
    C:\Program Files (x86)\
    Regards,
    Scott.

    Comment


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

      Hi, thanks for answer.

      I try with CataSistemasSitiosWebIntranetpdfpdf_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:

      Code:
      $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)

      Code:
      { 
             $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...

      Comment


      • #4
        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.

        Comment


        • #5
          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:

          Code:
          ==== 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??

          Comment


          • #6
            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.

            Comment


            • #7
              Originally posted by quatrero View Post
              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:

              Code:
              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.
              hey, can you reset the php code ?

              Comment


              • #8
                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.

                Comment


                • #9
                  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..

                  Comment


                  • #10
                    Originally posted by Nana111 View Post
                    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.
                    er...not sure about that

                    Comment

                    Working...
                    X