navigation  interaction  search

 other resources

Changeset 60

Show
Ignore:
Timestamp:
11/21/05 19:38:49
Author:
brieb
Message:

- Moved logo to database.
- PDF reports are now printed directly, instead of writing to a temp file.

Implemented basic db file system (incomplete)
Install and update not tested.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/include/common_functions.php

    r51 r60  
    6464<td width="100%" class="tabbottoms">&nbsp;</td></tr></table> 
    6565        <?php 
    66 } 
    67  
    68 // Clean our temp PDF report files 
    69 //==================================================================== 
    70 function clean_pdf_reports($dir,$sectime=3600) 
    71 { 
    72     //Delete temporary files 
    73     $t=time(); 
    74     $h=opendir($dir); 
    75     while($file=readdir($h)) 
    76     { 
    77         if(substr($file,0,3)=='tmp' and substr($file,-4)=='.pdf') 
    78         { 
    79             $path=$dir.'/'.$file; 
    80             if($t-filemtime($path)>$sectime) 
    81                 @unlink($path); 
    82         } 
    83     } 
    84     closedir($h); 
    8566} 
    8667 
  • trunk/index.php

    r51 r60  
    4949                        $result = mysql_query("UPDATE users set modifieddate=modifieddate, lastlogin=Now() where id = ".$_SESSION["userinfo"]["id"],$dblink); 
    5050                        if  (!$result)die ("update users query failed:".mysql_error($dblink));                   
    51                          
    52                         //anytime anyone logs in, clean temp PDF files older than an hour 
    53                         include("include/common_functions.php"); 
    54                         clean_pdf_reports("report/"); 
    55                          
     51                                                 
    5652                        header("Location: ".$_SESSION["default_load_page"]); 
    5753                         
  • trunk/install/createtables.sql

    r58 r60  
    118118  `editfile` varchar(128) default NULL, 
    119119  `displayname` varchar(64) default NULL, 
    120   `id` int(11) NOT NULL auto_increment default 1000
     120  `id` int(11) NOT NULL auto_increment default '1000'
    121121  `maintable` varchar(64) NOT NULL default '', 
    122122  `createdby` int(11) NOT NULL default '0', 
  • trunk/install/installxml.php

    r57 r60  
    169169                                        $thereturn.=importData("users"); 
    170170                                        $thereturn.=importData("settings"); 
     171                                        $thereturn.=importData("files"); 
    171172                                        $thereturn.="\nDone Importing Data\n===========================\n"; 
    172173                         
  • trunk/install/updatev0.61.sql

    r58 r60  
    55 
    66ALTER TABLE tabledefs CHANGE defaultwhereclause defaultwhereclause varchar(255); 
     7ALTER TABLE tabledefs CHANGE `id`  `id` int(11) NOT NULL auto_increment default '1000'; 
    78 
    89UPDATE tabledefs SET defaultwhereclause="notes.type='EV' AND notes.createdby = {{$_SESSION['userinfo']['id']}} AND ((notes.startdate = year(notes.startdate)=year(curdate()) and week(notes.startdate)=week(curdate())) OR notes.`repeat`=1)" WHERE id=24; 
  • trunk/install/updatexml.php

    r57 r60  
    258258                                        $thereturn.="Moved non-mysql settings to new settings table.\n"; 
    259259                                         
     260                                        $filename="../../logo.png"; 
     261                                        if (function_exists('file_get_contents')) { 
     262                                                $file = addslashes(file_get_contents($filename)); 
     263                                        } else { 
     264                                                // If using PHP < 4.3.0 use the following: 
     265                                                $file = addslashes(fread(fopen($filename, 'r'), filesize($filename))); 
     266                                        } 
     267                                        $querystatement="INSERT INTO files (id,name,servename,type,accesslevel,file,createdby,creationdate,modifiedby)  
     268                                                                        VALUES (1,\"Printed Logo\",\"logo.png\",\"image/png\",90,\"".$file."\"2,Now(),2)"; 
     269                                        $queryresult=mysql_query($querystatement,$dblink); 
     270                                        if(!$queryresult) 
     271                                                $thereturn.="Error moving logo to database.\n"; 
     272                                        else 
     273                                                $thereturn.="Moved logo to database.\n"; 
     274 
     275                                         
    260276                                        $thereturn.="Update to 0.61 Finished\n\n"; 
    261277                                        $currentVersion="0.61"; 
  • trunk/modules/base/files_addedit.php

    r58 r60  
    9797                        <?PHP field_text("name",$therecord["name"],1,"Name cannot be blank.","",Array("size"=>"32","maxlength"=>"64","style"=>"width:98%","class"=>"important","tabindex"=>"5")); ?> 
    9898                </label> 
    99                 <label for="name" class="important"> 
     99                <label for="servename" class="important"> 
    100100                        serve name<br /> 
    101                         <?PHP field_text("name",$therecord["name"],1,"Name cannot be blank.","",Array("size"=>"40","maxlength"=>"64","style"=>"","class"=>"important","tabindex"=>"5")); ?> 
     101                        <?PHP field_text("servename",$therecord["servename"],1,"Serve name cannot be blank.","",Array("size"=>"40","maxlength"=>"64","style"=>"","class"=>"important","tabindex"=>"5")); ?> 
    102102                </label> 
    103103                <div class="small" style="padding-top:6px;padding-bottom:6px;"><em> 
     
    113113                        <input type="text" id="type" name="type" value="<?php echo htmlQuotes($therecord["type"])?>" size="40" maxlength="100" readonly="true" class="uneditable" style="" /> 
    114114                </label> 
    115                 <div><button type="button" class="Buttons">view file</button></div> 
     115                <div><button type="button" class="Buttons" onClick="document.location='../../servefile.php?i=<?php echo $therecord["id"]?>'">view file</button></div> 
    116116                <?php } ?> 
    117117                <label for="upload"> 
  • trunk/modules/base/include/adminsettings_include.php

    r57 r60  
    7474        // deal with logo graphic. 
    7575        if(isset($files["printedlogo"])) 
    76                 if($files["printedlogo"]["type"]=="image/png") 
    77                         copy($files["printedlogo"]["tmp_name"],$_SERVER["DOCUMENT_ROOT"].$_SESSION["app_path"]."report/logo.png"); 
     76                if($files["printedlogo"]["type"]=="image/png"){ 
     77                        if (function_exists('file_get_contents')) { 
     78                                $file = addslashes(file_get_contents($_FILES['upload']['tmp_name'])); 
     79                        } else { 
     80                                // If using PHP < 4.3.0 use the following: 
     81                                $file = addslashes(fread(fopen($_FILES['upload']['tmp_name'], 'r'), filesize($_FILES['thumbnailupload']['tmp_name']))); 
     82                        } 
     83                        $querystatement="UPDATE files SET file=\"".$file."\" WHERE id=1"; 
     84                        $queryresult=mysql_query($querystatement,$dblink); 
     85                        if(!$queryresult) reportError(300,"Error Uploading Graphic File"); 
     86                } 
     87        } 
    7888                         
    7989        return true; 
  • trunk/modules/base/include/files_addedit_include.php

    r58 r60  
    5050         
    5151        $querystatement="SELECT 
    52                                 id,name,servname,type,accesslevel,ISNULL(file) as nofile, 
     52                                id,name,servename,type,accesslevel,ISNULL(file) as nofile, 
    5353                                 
    5454                                createdby, creationdate,  
     
    9191         
    9292                        $querystatement.="name=\"".$variables["name"]."\", ";  
    93                         $querystatement.="type=\"".$variables["type"]."\", ";  
    94                         $querystatement.="tabledefid=".$variables["tabledefid"].", ";  
    95                         $querystatement.="reportfile=\"".$variables["reportfile"]."\", ";  
    96                         $querystatement.="description=\"".$variables["description"]."\", ";  
    97                         $querystatement.="displayorder=".$variables["displayorder"].", ";  
     93                        $querystatement.="servename=\"".$variables["servename"]."\", ";  
    9894                        $querystatement.="accesslevel=".$variables["accesslevel"].", ";  
     95                        if($_FILES['upload']["name"]){ 
     96                                if (function_exists('file_get_contents')) { 
     97                                        $file = addslashes(file_get_contents($_FILES['upload']['tmp_name'])); 
     98                                } else { 
     99                                        // If using PHP < 4.3.0 use the following: 
     100                                        $file = addslashes(fread(fopen($_FILES['upload']['tmp_name'], 'r'), filesize($_FILES['thumbnailupload']['tmp_name']))); 
     101                                } 
     102                                $querystatement.="type=\"".$_FILES['upload']['type']."\", "; 
     103                                $querystatement.="file=\"".$file."\", "; 
     104                        } 
    99105 
    100106        //==== Almost all records should have this ========= 
     
    111117        global $dblink; 
    112118 
     119        if(!$_FILES['upload']["name"]) 
     120                return -1; 
     121         
     122        if (function_exists('file_get_contents')) { 
     123                $file = addslashes(file_get_contents($_FILES['upload']['tmp_name'])); 
     124        } else { 
     125                // If using PHP < 4.3.0 use the following: 
     126                $file = addslashes(fread(fopen($_FILES['upload']['tmp_name'], 'r'), filesize($_FILES['thumbnailupload']['tmp_name']))); 
     127        } 
     128 
    113129        $querystatement="INSERT INTO files "; 
    114130         
    115         $querystatement.="(name,type,tabledefid,reportfile,description,displayorder,accesslevel 
     131        $querystatement.="(name,servename,accesslevel,type,file, 
    116132                                                createdby,creationdate,modifiedby) VALUES ("; 
    117133         
    118134                        $querystatement.="\"".$variables["name"]."\", ";  
    119                         $querystatement.="\"".$variables["type"]."\", ";  
    120                         $querystatement.=$variables["tabledefid"].", ";  
    121                         $querystatement.="\"".$variables["reportfile"]."\", ";  
    122                         $querystatement.="\"".$variables["description"]."\", ";  
    123                         $querystatement.=$variables["displayorder"].", ";  
     135                        $querystatement.="\"".$variables["servename"]."\", ";  
    124136                        $querystatement.=$variables["accesslevel"].", ";  
     137                        $querystatement.="\"".$_FILES['upload']['type']."\", "; 
     138                        $querystatement.="\"".$file."\", "; 
    125139                                 
    126140        //==== Almost all records should have this ========= 
     
    128142        $querystatement.="Now(), "; 
    129143        $querystatement.=$userid.")";  
    130          
     144 
    131145        $queryresult = mysql_query($querystatement,$dblink); 
    132146        if(!$queryresult) reportError(300,"Insert Failed: ".mysql_error($dblink)." -- ".$querystatement); 
  • trunk/modules/base/report/notes_summary.php

    r10 r60  
    6868        }// end fetch_array while loop 
    6969 
    70         if($border_debug==1){ 
    71                 $pdf->Output(); 
    72         } 
    73         else { 
    74                 //write the frickin thing! Need to write to a temp file and then you know... 
    75                 chdir("../../../report"); 
    76                 $file=basename(tempnam(getcwd(),'tmp')); 
    77                 rename($file,$file.'.pdf'); 
    78                 $file.='.pdf'; 
    79          
    80                 // write to file and then output 
    81                 $pdf->Output($file); 
    82                 echo "<HTML><SCRIPT>document.location='../../../report/".$file."';</SCRIPT></HTML>"; 
    83         } 
     70        $pdf->Output(); 
     71        exit(); 
    8472?> 
  • trunk/modules/bms/report/clients_folderlabels.php

    r51 r60  
    7070        } 
    7171 
     72        session_cache_limiter('private'); 
    7273        require_once("../../../include/session.php"); 
    7374        require_once("../../../fpdf/fpdf.php"); 
  • trunk/modules/bms/report/clients_mailinglabels.php

    r51 r60  
    7575        } 
    7676 
    77         require_once("../../../include/session.php"); 
     77        session_cache_limiter('private'); 
     78s       require_once("../../../include/session.php"); 
    7879        require_once("../../../fpdf/fpdf.php"); 
    7980        require("../../../report/general_labels.php"); 
  • trunk/modules/bms/report/clients_notesummary.php

    r51 r60  
    3636*/ 
    3737 
     38        session_cache_limiter('private'); 
    3839        require("../../../include/session.php"); 
    3940        //turn debug borders on to troubleshoot PDF creation (1 or 0) 
     
    139140        } 
    140141         
    141         if($border_debug==1){ 
    142                 $pdf->Output(); 
    143         } 
    144         else { 
    145                 //write the frickin thing! Need to write to a temp file and then you know... 
    146                 chdir("../../../report"); 
    147                 $file=basename(tempnam(getcwd(),'tmp')); 
    148                 rename($file,$file.'.pdf'); 
    149                 $file.='.pdf'; 
    150          
    151                 // write to file and then output 
    152                 $pdf->Output($file); 
    153                 echo "<HTML><SCRIPT>document.location='../../../report/".$file."';</SCRIPT></HTML>"; 
    154         } 
     142        $pdf->Output(); 
     143        exit(); 
    155144?> 
  • trunk/modules/bms/report/clients_shippinglabels.php

    r51 r60  
    7676        } 
    7777 
     78        session_cache_limiter('private'); 
    7879        require_once("../../../include/session.php"); 
    7980        require_once("../../../fpdf/fpdf.php"); 
  • trunk/modules/bms/report/invoices_pdfinvoice.php

    r51 r60  
    3535 +-------------------------------------------------------------------------+ 
    3636*/ 
    37  
    38         require("../../../include/session.php"); 
    39         require("../../../include/common_functions.php"); 
     37        session_cache_limiter('private'); 
     38        require_once("../../../include/session.php"); 
     39        require_once("../../../include/common_functions.php"); 
    4040        //turn debug borders on to troubleshoot PDF creation (1 or 0) 
    4141        $border_debug=0; 
     
    4747                $sortorder=" ORDER BY invoices.id"; 
    4848 
    49         require("../../../fpdf/fpdf.php"); 
     49        require_once("../../../fpdf/fpdf.php"); 
     50        require_once("../../../fpdf/mem_image.php"); 
    5051         
    5152        //Generate the invoice Query 
     
    7980         
    8081        //define the documents and margins 
    81         $pdf=new FPDF("P","in","Letter"); 
     82        $pdf=new MEM_IMAGE("P","in","Letter"); 
    8283        $pdf->SetMargins($leftmargin,$topmargin,$rightmargin); 
    8384        $pdf->Open(); 
     
    9899                $cname=$_SESSION["company_name"]; 
    99100                $caddress=$_SESSION["company_address"]."\n".$_SESSION["company_csz"]."\n".$_SESSION["company_phone"]; 
    100                 $pdf->Image("../../../report/logo.png",$leftmargin,$topmargin,$tempwidth); 
     101                 
     102                 
     103                // Image from DB, so we need to retieve it and then add it to pdf 
     104                // through the extended memImage function (instead of the image function, that wants a file, not data) 
     105                        $querystatement="SELECT file FROM files WHERE id=1"; 
     106                        $pictureresult=mysql_query($querystatement,$dblink); 
     107                        if(!$pictureresult) reportError(300,"Error Retrieving Logo Graphic"); 
     108                        $thepicture=mysql_fetch_array($pictureresult); 
     109                         
     110                $pdf->MemImage($thepicture["file"],$leftmargin,$topmargin,$tempwidth);   
    101111                 
    102112                //next company name 
     
    330340                 
    331341        }// end fetch_array while loop 
    332  
    333          
    334         if($border_debug==1){ 
    335                 $pdf->Output(); 
    336         } 
    337         else { 
    338                 //write the frickin thing! Need to write to a temp file and then you know... 
    339                 chdir("../../../report"); 
    340                 $file=basename(tempnam(getcwd(),'tmp')); 
    341                 chmod($file,0664); 
    342                 rename($file,$file.'.pdf'); 
    343                 $file.='.pdf'; 
    344          
    345                 // write to file and then output 
    346                 $pdf->Output($file); 
    347                 echo "<HTML><SCRIPT>document.location='../../../report/".$file."';</SCRIPT></HTML>"; 
    348         } 
     342         
     343        $pdf->Output(); 
     344        exit(); 
     345 
    349346?> 
  • trunk/modules/bms/report/invoices_pdfpackinglist.php

    r51 r60  
    3535 +-------------------------------------------------------------------------+ 
    3636*/ 
    37  
    38         require("../../../include/session.php"); 
    39         require("../../../include/common_functions.php"); 
     37        session_cache_limiter('private'); 
     38        require_once("../../../include/session.php"); 
     39        require_once("../../../include/common_functions.php"); 
    4040        //turn debug borders on to troubleshoot PDF creation (1 or 0) 
    4141        $border_debug=0; 
     
    4747 
    4848        require("../../../fpdf/fpdf.php"); 
     49        require_once("../../../fpdf/mem_image.php"); 
    4950         
    5051        //Generate the invoice Query 
     
    7879         
    7980        //define the documents and margins 
    80         $pdf=new FPDF("P","in","Letter"); 
     81        $pdf=new MEM_IMAGE("P","in","Letter"); 
    8182        $pdf->SetMargins($leftmargin,$topmargin,$rightmargin); 
    8283        $pdf->Open(); 
     
    9798                $cname=$_SESSION["company_name"]; 
    9899                $caddress=$_SESSION["company_address"]."\n".$_SESSION["company_csz"]."\n".$_SESSION["company_phone"]; 
    99                 $pdf->Image("../../../report/logo.png",$leftmargin,$topmargin,$tempwidth); 
     100 
     101                // Image from DB, so we need to retieve it and then add it to pdf 
     102                // through the extended memImage function (instead of the image function, that wants a file, not data) 
     103                        $querystatement="SELECT file FROM files WHERE id=1"; 
     104                        $pictureresult=mysql_query($querystatement,$dblink); 
     105                        if(!$pictureresult) reportError(300,"Error Retrieving Logo Graphic"); 
     106                        $thepicture=mysql_fetch_array($pictureresult); 
     107                         
     108                $pdf->MemImage($thepicture["file"],$leftmargin,$topmargin,$tempwidth);   
    100109                 
    101110                //next company name 
     
    287296        }// end fetch_array while loop 
    288297 
    289         if($border_debug==1){ 
    290                 $pdf->Output(); 
    291         } 
    292         else { 
    293                 //write the frickin thing! Need to write to a temp file and then you know... 
    294                 chdir("../../../report"); 
    295                 $file=basename(tempnam(getcwd(),'tmp')); 
    296                 chmod($file,0664);               
    297                 rename($file,$file.'.pdf'); 
    298                 $file.='.pdf'; 
    299          
    300                 // write to file and then output 
    301                 $pdf->Output($file); 
    302                 echo "<HTML><SCRIPT>document.location='../../../report/".$file."';</SCRIPT></HTML>"; 
    303         } 
     298        $pdf->Output(); 
     299        exit(); 
     300 
    304301?> 
  • trunk/modules/bms/report/invoices_pdfquote.php

    r51 r60  
    3535 +-------------------------------------------------------------------------+ 
    3636*/ 
    37  
    38         require("../../../include/session.php"); 
    39         require("../../../include/common_functions.php"); 
     37        session_cache_limiter('private'); 
     38        require_once("../../../include/session.php"); 
     39        require_once("../../../include/common_functions.php"); 
    4040        //turn debug borders on to troubleshoot PDF creation (1 or 0) 
    4141        $border_debug=0; 
     
    4747 
    4848        require("../../../fpdf/fpdf.php"); 
     49        require_once("../../../fpdf/mem_image.php"); 
    4950         
    5051        //Generate the invoice Query 
     
    7879         
    7980        //define the documents and margins 
    80         $pdf=new FPDF("P","in","Letter"); 
     81        $pdf=new MEM_IMAGE("P","in","Letter"); 
    8182        $pdf->SetMargins($leftmargin,$topmargin,$rightmargin); 
    8283        $pdf->Open(); 
     
    9798                $cname=$_SESSION["company_name"]; 
    9899                $caddress=$_SESSION["company_address"]."\n".$_SESSION["company_csz"]."\n".$_SESSION["company_phone"]; 
    99                 $pdf->Image("../../../report/logo.png",$leftmargin,$topmargin,$tempwidth); 
     100 
     101                // Image from DB, so we need to retieve it and then add it to pdf 
     102                // through the extended memImage function (instead of the image function, that wants a file, not data) 
     103                        $querystatement="SELECT file FROM files WHERE id=1"; 
     104                        $pictureresult=mysql_query($querystatement,$dblink); 
     105                        if(!$pictureresult) reportError(300,"Error Retrieving Logo Graphic"); 
     106                        $thepicture=mysql_fetch_array($pictureresult); 
     107                         
     108                $pdf->MemImage($thepicture["file"],$leftmargin,$topmargin,$tempwidth);   
    100109                 
    101110                //next company name 
     
    325334 
    326335         
    327         if($border_debug==1){ 
    328                 $pdf->Output(); 
    329         } 
    330         else { 
    331                 //write the frickin thing! Need to write to a temp file and then you know... 
    332                 chdir("../../../report"); 
    333                 $file=basename(tempnam(getcwd(),'tmp')); 
    334                 chmod($file,0664);               
    335                 rename($file,$file.'.pdf'); 
    336                 $file.='.pdf'; 
    337          
    338                 // write to file and then output 
    339                 $pdf->Output($file); 
    340                 echo "<HTML><SCRIPT>document.location='../../../report/".$file."';</SCRIPT></HTML>"; 
    341         } 
     336        $pdf->Output(); 
     337        exit(); 
     338 
    342339?> 
  • trunk/modules/bms/report/invoices_pdfworkorder.php

    r51 r60  
    3535 +-------------------------------------------------------------------------+ 
    3636*/ 
    37  
    38         require("../../../include/session.php"); 
    39         require("../../../include/common_functions.php"); 
     37        session_cache_limiter('private'); 
     38        require_once("../../../include/session.php"); 
     39        require_once("../../../include/common_functions.php"); 
    4040        //turn debug borders on to troubleshoot PDF creation (1 or 0) 
    4141        $border_debug=0; 
    4242         
    4343        require("../../../fpdf/fpdf.php"); 
     44        require_once("../../../fpdf/mem_image.php"); 
    4445         
    4546        if($_SESSION["printing"]["sortorder"]) 
     
    7879         
    7980        //define the documents and margins 
    80         $pdf=new FPDF("P","in","Letter"); 
     81        $pdf=new MEM_IMAGE("P","in","Letter"); 
    8182        $pdf->SetMargins($leftmargin,$topmargin,$rightmargin); 
    8283        $pdf->Open(); 
     
    9798                $cname=$_SESSION["company_name"]; 
    9899                $caddress=$_SESSION["company_address"]."\n".$_SESSION["company_csz"]."\n".$_SESSION["company_phone"]; 
    99                 $pdf->Image("../../../report/logo.png",$leftmargin,$topmargin,$tempwidth); 
     100 
     101                // Image from DB, so we need to retieve it and then add it to pdf 
     102                // through the extended memImage function (instead of the image function, that wants a file, not data) 
     103                        $querystatement="SELECT file FROM files WHERE id=1"; 
     104                        $pictureresult=mysql_query($querystatement,$dblink); 
     105                        if(!$pictureresult) reportError(300,"Error Retrieving Logo Graphic"); 
     106                        $thepicture=mysql_fetch_array($pictureresult); 
     107                         
     108                $pdf->MemImage($thepicture["file"],$leftmargin,$topmargin,$tempwidth);   
    100109                 
    101110                //next company name 
     
    366375        }// end fetch_array while loop 
    367376 
    368         if($border_debug==1){ 
    369                 $pdf->Output(); 
    370         } 
    371         else { 
    372                 //write the frickin thing! Need to write to a temp file and then you know... 
    373                 chdir("../../../report"); 
    374                 $file=basename(tempnam(getcwd(),'tmp')); 
    375                 chmod($file,0664);               
    376                 rename($file,$file.'.pdf'); 
    377                 $file.='.pdf'; 
    378          
    379                 // write to file and then output 
    380                 $pdf->Output($file); 
    381                 echo "<HTML><SCRIPT>document.location='../../../report/".$file."';</SCRIPT></HTML>"; 
    382         } 
     377        $pdf->Output(); 
     378        exit(); 
     379 
    383380?> 
  • trunk/modules/bms/report/invoices_shippinglabels.php

    r51 r60  
    7575        } 
    7676 
     77        session_cache_limiter('private'); 
    7778        require_once("../../../include/session.php"); 
    7879        require_once("../../../fpdf/fpdf.php"); 
  • trunk/print.php

    r51 r60  
    105105                                for($i=0;$i<count($_POST["choosereport"]);$i++){ 
    106106                                        if($_POST["choosereport"][$i]){ 
    107                                                 $querystatement="SELECT reportfile from reports where id=".$_POST["choosereport"][$i].";"; 
     107                                                $querystatement="SELECT reportfile,type from reports where id=".$_POST["choosereport"][$i].";"; 
    108108                                                $queryresult=mysql_query($querystatement,$dblink); 
    109109                                                if(!$queryresult) reportError(100,"Could not Retreive Report Information");                              
    110110                                                $reportrecord=mysql_fetch_array($queryresult);   
     111                                                $fakeExtForIE=""; 
     112                                                if($reportrecord["type"]=="PDF Report") 
     113                                                        $fakeExtForIE="&ext=.pdf"; 
    111114                                                //javascript open each report in new window 
    112                                                 $tablePrinter->openwindows.="window.open('".$_SESSION["app_path"].$reportrecord["reportfile"]."?tabledefid=".urlencode($tablePrinter->tableid)."','print".$i."');\n"; 
     115                                                $tablePrinter->openwindows.="window.open('".$_SESSION["app_path"].$reportrecord["reportfile"]."?tid=".urlencode($tablePrinter->tableid).$fakeExtForIE."','print".$i."');\n"; 
    113116                                        } 
    114117                                } 
     
    135138</head> 
    136139<body> 
    137 <?PHP   if($tablePrinter->openwindows) echo "\n".$tablePrinter->openwindows; ?> 
    138140<div class="bodyline" style="width:550px;margin-top:2px;"> 
    139141        <h1><?php echo $pageTitle ?><a name="top"></a></h1> 
     
    236238<div style="margin:0px;padding:0px;width:550px;"><?php include("footer.php")?></div> 
    237239</body> 
    238 </html> 
     240</html><?PHP   if($tablePrinter->openwindows) echo "\n".$tablePrinter->openwindows; ?> 
  • trunk/report/general_export.php

    r51 r60  
    4747        header('Content-Disposition: attachment; filename="export.txt"'); 
    4848         
    49         $querystatement="SELECT maintable FROM tabledefs WHERE id=".$_GET["tabledefid"]; 
     49        $querystatement="SELECT maintable FROM tabledefs WHERE id=".$_GET["tid"]; 
    5050        $thequery=mysql_query($querystatement,$dblink);                    
    5151        if(!$thequery)  reportError(100,"Could not retrieve table information"); 
  • trunk/report/general_labels.php

    r51 r60  
    111111                        $rowcount++; 
    112112                }// end fetch_array while loop 
    113          
    114                  
    115                 if($border_debug==1){ 
    116                         $pdf->Output(); 
    117                 } 
    118                 else { 
    119                         //write the frickin thing! Need to write to a temp file and then you know... 
    120                         chdir("../../../report"); 
    121                         $file=basename(tempnam(getcwd(),'tmp')); 
    122                         chmod($file,0664);               
    123                         rename($file,$file.'.pdf'); 
    124                         $file.='.pdf'; 
    125                  
    126                         // write to file and then output 
    127                         $pdf->Output($file); 
    128                         echo "<HTML><SCRIPT>document.location='../../../report/".$file."';</SCRIPT></HTML>"; 
    129                 } 
     113                         
     114                $pdf->Output(); 
     115                exit(); 
    130116        } else { 
    131117?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 
  • trunk/report/general_tableprint.php

    r51 r60  
    4545        require("../include/session.php"); 
    4646         
    47         $querystatement="SELECT maintable,displayname FROM tabledefs WHERE id=".$_GET["tabledefid"]; 
     47        $querystatement="SELECT maintable,displayname FROM tabledefs WHERE id=".$_GET["tid"]; 
    4848        $thequery=mysql_query($querystatement,$dblink);                    
    4949        if(!$thequery)  reportError(100,"Could not retrieve table information"); 
Copyright © 2006-2007 Kreotek, LLC. All Rights reserved.