Merged revisions 3651-3653 via svnmerge from
svn+ssh://danydb@svn/svn/phpcompta/branches/rel520 ........ r3651 | danydb | 2010-08-20 18:01:37 +0200 (Fri, 20 Aug 2010) | 1 line Fix warning ........ r3652 | danydb | 2010-08-23 15:38:08 +0200 (Mon, 23 Aug 2010) | 2 lines Fix bug for generating document under M$ ........ r3653 | danydb | 2010-08-24 03:59:28 +0200 (Tue, 24 Aug 2010) | 1 line improve performance for searching a card ........
This commit is contained in:
parent
f16183f4cf
commit
15de8a5568
5 changed files with 27 additions and 31 deletions
Binary file not shown.
|
|
@ -74,7 +74,7 @@ class Document
|
|||
{
|
||||
// create a temp directory in /tmp to unpack file and to parse it
|
||||
$dirname=tempnam($_ENV['TMP'],'doc_');
|
||||
|
||||
|
||||
|
||||
unlink($dirname);
|
||||
mkdir ($dirname);
|
||||
|
|
@ -93,7 +93,9 @@ class Document
|
|||
|
||||
chdir($dirname);
|
||||
$filename=$row['md_filename'];
|
||||
$this->db->lo_export($row['md_lob'],$filename);
|
||||
$exp=$this->db->lo_export($row['md_lob'],$dirname.DIRECTORY_SEPARATOR.$filename);
|
||||
if ( $exp === false ) echo_warning( __FILE__.":".__LINE__."Export NOK $filename");
|
||||
|
||||
$type="n";
|
||||
// if the doc is a OOo, we need to unzip it first
|
||||
// and the name of the file to change is always content.xml
|
||||
|
|
@ -123,20 +125,14 @@ class Document
|
|||
system ("zip -r ".$filename." *");
|
||||
ob_end_clean();
|
||||
echo " ";
|
||||
?>
|
||||
|
||||
<?php
|
||||
$file_to_parse=$filename;
|
||||
}
|
||||
// Create a directory
|
||||
$l_dir=$_SERVER['DOCUMENT_ROOT'].DIRECTORY_SEPARATOR.$dirname;
|
||||
mkdir ($l_dir);
|
||||
|
||||
// we need to rename the new generated file
|
||||
rename($dirname.DIRECTORY_SEPARATOR.$file_to_parse,$_SERVER['DOCUMENT_ROOT'].$dirname.DIRECTORY_SEPARATOR.$file_to_parse);
|
||||
$this->SaveGenerated($_SERVER['DOCUMENT_ROOT'].$dirname.DIRECTORY_SEPARATOR.$file_to_parse);
|
||||
$this->SaveGenerated($dirname.DIRECTORY_SEPARATOR.$file_to_parse);
|
||||
// Invoice
|
||||
$ret='<A class="mtitle" HREF="show_document.php?d_id='.$this->d_id.'&'.dossier::get().'">Document généré</A>';
|
||||
rmdir($dirname);
|
||||
return $ret;
|
||||
}
|
||||
|
||||
|
|
@ -152,7 +148,6 @@ class Document
|
|||
*/
|
||||
function ParseDocument($p_dir,$p_file,$p_type)
|
||||
{
|
||||
|
||||
|
||||
/*!\note Replace in the doc the tags by their values.
|
||||
* - MY_* table parameter
|
||||
|
|
@ -178,9 +173,9 @@ class Document
|
|||
$output_name=tempnam($temp_dir,"gen_doc_");
|
||||
$output_file=fopen($output_name,"w+");
|
||||
// check if the opening is sucessfull
|
||||
if ( $h == false )
|
||||
if ( $h === false )
|
||||
{
|
||||
echo "cannot open $p_dir $p_file ";
|
||||
echo __FILE__.":".__LINE__."cannot open $p_dir $p_file ";
|
||||
exit();
|
||||
}
|
||||
if ( $output_file == false)
|
||||
|
|
@ -243,8 +238,8 @@ class Document
|
|||
|
||||
}
|
||||
fclose($h);
|
||||
fclose($output_file);
|
||||
if ( ($ret=rename ($output_name,$infile_name)) == FALSE ){
|
||||
fclose($output_file);
|
||||
if ( ($ret=copy ($output_name,$infile_name)) == FALSE ){
|
||||
echo _('Ne peut pas sauver '.$output_name.' vers '.$infile_name.' code d\'erreur ='.$ret);
|
||||
}
|
||||
|
||||
|
|
@ -263,7 +258,7 @@ class Document
|
|||
$doc=new Document($this->db);
|
||||
$this->db->start();
|
||||
$this->d_lob=$this->db->lo_import($p_file);
|
||||
if ( $this->d_lob == false ) {
|
||||
if ( $this->d_lob == false ) { echo "ne peut pas importer [$p_file]";
|
||||
return 1; }
|
||||
|
||||
$sql="insert into document(ag_id,d_lob,d_number,d_filename,d_mimetype)
|
||||
|
|
@ -987,10 +982,9 @@ class Document
|
|||
*/
|
||||
function MoveDocumentPj($p_internal)
|
||||
{
|
||||
|
||||
$sql=sprintf("update jrn set jr_pj=%s,jr_pj_name='%s',jr_pj_type='%s' where jr_internal='%s'",
|
||||
$this->d_lob,$this->d_filename,$this->d_mimetype,$p_internal);
|
||||
$this->db->exec_sql($sql);
|
||||
$sql="update jrn set jr_pj=$1,jr_pj_name=$2,jr_pj_type=$3 where jr_internal=$4";
|
||||
|
||||
$this->db->exec_sql($sql,array($this->d_lob,$this->d_filename,$this->d_mimetype,$p_internal));
|
||||
// clean the table document
|
||||
$sql='delete from document where d_id='.$this->d_id;
|
||||
$this->db->exec_sql($sql);
|
||||
|
|
|
|||
|
|
@ -1594,11 +1594,19 @@ function is_used() {
|
|||
$and=" and ";
|
||||
if (isset($query)){
|
||||
$query=FormatString($query);
|
||||
|
||||
/**
|
||||
*@function
|
||||
*@todo FS#151 bad performance, to be changed with a prepare stmt
|
||||
*/
|
||||
$filter_query=$and."(vw_name ilike '%$query%' or quick_code ilike ('%$query%') or vw_description ilike '%$query%' or tva_num ilike '%$query%')";
|
||||
if (strlen(trim($query)) > 1)
|
||||
{
|
||||
$filter_query=$and."(vw_name ilike '%$query%' or quick_code ilike ('%$query%') or vw_description ilike '%$query%' or tva_num ilike '%$query%')";
|
||||
}
|
||||
else
|
||||
{
|
||||
$filter_query='';
|
||||
}
|
||||
}
|
||||
$sql="select * from vw_fiche_attr where ".$filter_fd_id.$filter_query;
|
||||
return $sql;
|
||||
|
|
|
|||
|
|
@ -36,6 +36,8 @@
|
|||
*\see ajaxFid
|
||||
*\see card.js
|
||||
*\see fid.php
|
||||
*\see fid_card.php
|
||||
*\see ajax_card.php
|
||||
*
|
||||
* Set the hidden field or input field to be set by javascript with the function set_attribute
|
||||
* call the input method. After selecting a value the update_value function is called. If you need
|
||||
|
|
@ -248,14 +250,6 @@ class ICard extends HtmlInput
|
|||
return $r;
|
||||
|
||||
}
|
||||
static function javascript() {
|
||||
$str='';
|
||||
echo js_include('prototype.js');
|
||||
echo js_include('scriptaculous.js');
|
||||
echo js_include('effects.js');
|
||||
echo js_include('controls.js');
|
||||
return $str;
|
||||
}
|
||||
/**
|
||||
*@brief return a string containing the button for displaying
|
||||
* a search form. When clicking on the result, update the input text file
|
||||
|
|
|
|||
|
|
@ -29,8 +29,8 @@ require_once('constant.security.php');
|
|||
global $version_phpcompta;
|
||||
$version_phpcompta=9000;
|
||||
/* set to none for production */
|
||||
error_reporting (E_ALL|E_STRICT);
|
||||
//$version_phpcompta=SVNINFO;
|
||||
|
||||
error_reporting (15);
|
||||
|
||||
define ("DBVERSION",88);
|
||||
define ("DBVERSIONREPO",12);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue