[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Noalyss-commit] [noalyss] 05/07: Task #0002164 : rename receipt also fo
From: |
Dany De Bontridder |
Subject: |
[Noalyss-commit] [noalyss] 05/07: Task #0002164 : rename receipt also for analytical accountancy |
Date: |
Sat, 27 Aug 2022 08:03:46 -0400 (EDT) |
sparkyx pushed a commit to branch master
in repository noalyss.
commit fb893104f259a13ed206222c04d10dd45079ac2b
Author: sparkyx <danydb@noalyss.eu>
AuthorDate: Thu Aug 25 15:21:45 2022 +0200
Task #0002164 : rename receipt also for analytical accountancy
---
include/class/document_export.class.php | 20 +++++++++++++++-----
1 file changed, 15 insertions(+), 5 deletions(-)
diff --git a/include/class/document_export.class.php
b/include/class/document_export.class.php
index f3c71164c..86b1aa38f 100644
--- a/include/class/document_export.class.php
+++ b/include/class/document_export.class.php
@@ -57,7 +57,7 @@ class Document_Export
try
{
$this->check_file();
- $stmt=PDFTK." ".$this->store_pdf.'/*-stamp_*pdf output
'.$this->store_pdf.'/result.pdf';
+ $stmt=PDFTK." ".$this->store_pdf.'/*pdf output
'.$this->store_pdf.'/result.pdf';
$status=0;
echo $stmt;
passthru($stmt, $status);
@@ -91,7 +91,7 @@ class Document_Export
throw new Exception ( __FILE__.":".__LINE__."cannot recreate zip");
}
chdir($this->store_pdf);
- $zip->addGlob("*-stamp_*pdf");
+ $zip->addGlob("*.pdf");
$zip->close();
}
@@ -102,9 +102,16 @@ class Document_Export
* @throws Exception
*/
- function move_file($p_source, $target)
+ function move_file($p_source, $p_target)
{
$this->check_file();
+ $i=1;
+ $target=$p_target;
+ // do not overwrite a document already present
+ while (file_exists($target)) {
+ $target = sprintf("%d-%s",$i,$p_target);
+ $i++;
+ }
copy($p_source, $this->store_pdf . '/' . $target);
}
/**
@@ -254,7 +261,7 @@ class Document_Export
rename($output2, $output);
// Move the PDF into another temp directory
- $this->move_file($output, $order.'-stamp_'.$file_pdf);
+ $this->move_file($output, $file_pdf);
$order++;
}
@@ -324,7 +331,10 @@ class Document_Export
$filename=clean_filename($file[0]['jr_pj_name']);
-
+ $receipt=clean_filename($file[0]['jr_pj_number']);
+ $receipt=str_replace('.','-',$receipt);
+ $filename=$receipt.'-'.$filename;
+
$cn->start();
$cn->lo_export($file[0]['jr_pj'], $this->store_convert.'/'.$filename);
$cn->commit();
- [Noalyss-commit] [noalyss] branch master updated (1cb2e43b3 -> 30359ca4b), Dany De Bontridder, 2022/08/27
- [Noalyss-commit] [noalyss] 04/07: small bug : CSV setting not in SESSION, Dany De Bontridder, 2022/08/27
- [Noalyss-commit] [noalyss] 02/07: PHP 8.1 Deprecated, Dany De Bontridder, 2022/08/27
- [Noalyss-commit] [noalyss] 03/07: Cosmetic, Dany De Bontridder, 2022/08/27
- [Noalyss-commit] [noalyss] 07/07: Compatibility 7.4 , 0 is considered as NULL , not in 8.1, Dany De Bontridder, 2022/08/27
- [Noalyss-commit] [noalyss] 05/07: Task #0002164 : rename receipt also for analytical accountancy,
Dany De Bontridder <=
- [Noalyss-commit] [noalyss] 06/07: Test for changes, Dany De Bontridder, 2022/08/27
- [Noalyss-commit] [noalyss] 01/07: task #0002164 replace dot by minus in Receipt, Dany De Bontridder, 2022/08/27