diff --git a/doc/manuel-fr.odt b/doc/manuel-fr.odt index b165ee357..74ffb37a1 100644 Binary files a/doc/manuel-fr.odt and b/doc/manuel-fr.odt differ diff --git a/include/class_document.php b/include/class_document.php index a0691ab31..6adc5ebd0 100644 --- a/include/class_document.php +++ b/include/class_document.php @@ -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 " "; -?> -SaveGenerated($_SERVER['DOCUMENT_ROOT'].$dirname.DIRECTORY_SEPARATOR.$file_to_parse); + $this->SaveGenerated($dirname.DIRECTORY_SEPARATOR.$file_to_parse); // Invoice $ret='Document généré'; + 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); diff --git a/include/class_fiche.php b/include/class_fiche.php index f291a3208..bd1c20985 100644 --- a/include/class_fiche.php +++ b/include/class_fiche.php @@ -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; diff --git a/include/class_icard.php b/include/class_icard.php index 166f8df87..d1600f361 100644 --- a/include/class_icard.php +++ b/include/class_icard.php @@ -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 diff --git a/include/constant.php b/include/constant.php index d623e0e60..d13a658e4 100644 --- a/include/constant.php +++ b/include/constant.php @@ -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);