diff --git a/html/bilan.php b/html/bilan.php
index e6c7a6fae..06cd1efe8 100644
--- a/html/bilan.php
+++ b/html/bilan.php
@@ -52,7 +52,7 @@ if ( $bilan->b_type=='odt')
{
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Cache-Control: must-revalidate");
- header('Content-type: "application/vnd.oasis.opendocument.text"');
+ header('Content-type: application/vnd.oasis.opendocument.text');
header('Content-Disposition: attachment;filename="'.$bilan->b_name.'.odt"',FALSE);
header("Accept-Ranges: bytes");
@@ -61,7 +61,7 @@ if ( $bilan->b_type=='ods')
{
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Cache-Control: must-revalidate");
- header('Content-type: "application/vnd.oasis.opendocument.spreadsheet"');
+ header('Content-type: application/vnd.oasis.opendocument.spreadsheet');
header('Content-Disposition: attachment;filename="'.$bilan->b_name.'.ods"',FALSE);
header("Accept-Ranges: bytes");
diff --git a/include/class_acc_bilan.php b/include/class_acc_bilan.php
index 20ddd0150..678055c1c 100644
--- a/include/class_acc_bilan.php
+++ b/include/class_acc_bilan.php
@@ -395,10 +395,18 @@ class Acc_Bilan {
$a=$this->$f2_value;
}
if ( $a=='-0' ) $a=0;
-
- echo_debug(__FILE__.':'.__LINE__.'- $a =',$a);
-
- $line_rtf=str_replace($f2_str,$a,$line_rtf);
+
+ /* allow numeric cel in ODT for the formatting and formula */
+ if ( is_numeric($a) ) {
+ echo_debug(__FILE__,__LINE__," a is numeric $a");
+ $searched='office:value-type="string">'.$f2_str;
+ $replaced='office:value-type="float" office:value="'.$a.'">'.$f2_str;
+ $line_rtf=str_replace($searched, $replaced, $line_rtf);
+ }
+
+ echo_debug(__FILE__.':'.__LINE__.'- $a =',$a);
+
+ $line_rtf=str_replace($f2_str,$a,$line_rtf);
}// foreach end
} // while ereg
@@ -509,49 +517,51 @@ class Acc_Bilan {
break;
case 'odt':
case 'ods':
- $result=$this->generate_odt($templ);
-
- $this->send($result);
- break;
+ $result=$this->generate_odt($templ);
+ $this->send($result);
+ break;
- }
- fclose($templ);
- }
- /*!\brief send the result of generate plain to the browser
- * \param $p_result is the string returned by generate_...
- */
- function send($p_result) {
- switch ($this->b_type) {
- case 'rtf':
- // A rtf file is generated
- header('Content-type: application/rtf');
- header('Content-Disposition: attachment; filename="'.$this->b_name.'.rtf"');
- echo $p_result;
- break;
+ }
+ fclose($templ);
+ }
+ /*!\brief send the result of generate plain to the browser
+ * \param $p_result is the string returned by generate_...
+ */
+ function send($p_result) {
+ switch ($this->b_type) {
+ case 'rtf':
+ // A rtf file is generated
+ header('Content-type: application/rtf');
+ header('Content-Disposition: attachment; filename="'.$this->b_name.'.rtf"');
+ echo $p_result;
+ break;
- case 'txt':
- // A txt file is generated
- header('Content-type: application/txt');
- header('Content-Disposition: attachment; filename="'.$this->b_name.'.txt"');
+ case 'txt':
+ // A txt file is generated
+ header('Content-type: application/txt');
+ header('Content-Disposition: attachment; filename="'.$this->b_name.'.txt"');
- echo $p_result;
- break;
- case 'html':
- // A txt file is generated
- header('Content-type: application/html');
- header('Content-Disposition: attachment; filename="'.$this->b_name.'.html"');
+ echo $p_result;
+ break;
+ case 'html':
+ // A txt file is generated
+ header('Content-type: application/html');
+ header('Content-Disposition: attachment; filename="'.$this->b_name.'.html"');
- echo $p_result;
- break;
- case 'odt':
- case 'ods':
- /* header("Pragma: public");
- header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
- header("Cache-Control: must-revalidate");
- header('Content-type: "application/vnd.oasis.opendocument.text"');
- header('Content-Disposition: attachment;filename="'.$this->b_name.'.odt"',FALSE);
- header("Accept-Ranges: bytes");
- */
+ echo $p_result;
+ break;
+ case 'odt':
+ case 'ods':
+ /* header("Pragma: public");
+ header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
+ header("Cache-Control: must-revalidate");
+ if ( $this->b_type == 'odt' )
+ header('Content-type: application/vnd.oasis.opendocument.text');
+ if ( $this->b_type == 'ods' )
+ header('Content-type: application/vnd.oasis.opendocument.spreadsheet');
+ header('Content-Disposition: attachment;filename="'.$this->b_name.'.odt"',FALSE);
+ header("Accept-Ranges: bytes");
+ */
ob_start();
// save the file in a temp folder
// create a temp directory in /tmp to unpack file and to parse it
diff --git a/include/class_document.php b/include/class_document.php
index 8e7b479c8..09759e834 100644
--- a/include/class_document.php
+++ b/include/class_document.php
@@ -730,7 +730,7 @@ class Document
|| strlen(trim($qt)) ==0)
return "";
$a_tva=GetTvaRate($this->db,${$tva});
- echo_debug('class_document',__LINE__,'Tva :'.var_eanalyticxport($a_tva,true));
+ echo_debug('class_document',__LINE__,'Tva :'.var_export($a_tva,true));
// if no vat returns 0
if ( sizeof($a_tva) == 0 ) return "";
$r=round(${$price},2)*${$qt}*$a_tva['tva_rate'];