Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dolibarr
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Software_Artifact_Infrastructure_Repository
dolibarr
Commits
167ec691
Commit
167ec691
authored
10 years ago
by
Laurent Destailleur
Browse files
Options
Downloads
Patches
Plain Diff
Can add prefix into generated filename. This will save time for script
to build kit of files for book keeper.
parent
762eb1cd
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
htdocs/core/lib/invoice2.lib.php
+6
-12
6 additions, 12 deletions
htdocs/core/lib/invoice2.lib.php
scripts/invoices/rebuild_merge_pdf.php
+10
-1
10 additions, 1 deletion
scripts/invoices/rebuild_merge_pdf.php
with
16 additions
and
13 deletions
htdocs/core/lib/invoice2.lib.php
+
6
−
12
View file @
167ec691
...
...
@@ -41,12 +41,13 @@ require_once(DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php');
* @param date $paymentdatebefore Payment before date (must includes hour)
* @param int $usestdout Add information onto standard output
* @param int $regenerate ''=Use existing PDF files, 'nameofpdf'=Regenerate all PDF files using the template
* @param string $
option
Suffix to add into file name of generated PDF
* @param string $
filesuffix
Suffix to add into file name of generated PDF
* @param string $paymentbankid Only if payment on this bank account id
* @param array $thirdpartiesid List of thirdparties id when using filter excludethirdpartiesid or onlythirdpartiesid
* @param string $fileprefix Prefix to add into filename of generated PDF
* @return int Error code
*/
function
rebuild_merge_pdf
(
$db
,
$langs
,
$conf
,
$diroutputpdf
,
$newlangid
,
$filter
,
$dateafterdate
,
$datebeforedate
,
$paymentdateafter
,
$paymentdatebefore
,
$usestdout
,
$regenerate
=
0
,
$
option
=
''
,
$paymentbankid
=
''
,
$thirdpartiesid
=
''
)
function
rebuild_merge_pdf
(
$db
,
$langs
,
$conf
,
$diroutputpdf
,
$newlangid
,
$filter
,
$dateafterdate
,
$datebeforedate
,
$paymentdateafter
,
$paymentdatebefore
,
$usestdout
,
$regenerate
=
0
,
$
filesuffix
=
''
,
$paymentbankid
=
''
,
$thirdpartiesid
=
''
,
$fileprefix
=
'mergedpdf'
)
{
$sql
=
"SELECT DISTINCT f.rowid, f.facnumber"
;
$sql
.
=
" FROM "
.
MAIN_DB_PREFIX
.
"facture as f"
;
...
...
@@ -220,13 +221,6 @@ function rebuild_merge_pdf($db, $langs, $conf, $diroutputpdf, $newlangid, $filte
if
(
$conf
->
global
->
MAIN_DISABLE_PDF_COMPRESSION
)
$pdf
->
SetCompression
(
false
);
//$pdf->SetCompression(false);
//$pdf->Open();
//$pdf->AddPage();
//$title=$langs->trans("BillsCustomersUnpaid");
//if ($option=='late') $title=$langs->trans("BillsCustomersUnpaid");
//$pdf->MultiCell(100, 3, $title, 0, 'J');
// Add all others
foreach
(
$files
as
$file
)
{
...
...
@@ -248,9 +242,9 @@ function rebuild_merge_pdf($db, $langs, $conf, $diroutputpdf, $newlangid, $filte
dol_mkdir
(
$diroutputpdf
);
// Save merged file
$filename
=
'mergedpdf'
;
if
(
!
empty
(
$
option
))
$filename
.
=
'_'
.
$
option
;
$filename
=
$fileprefix
;
if
(
empty
(
$filename
))
$filename
=
'mergedpdf'
;
if
(
!
empty
(
$
filesuffix
))
$filename
.
=
'_'
.
$
filesuffix
;
$file
=
$diroutputpdf
.
'/'
.
$filename
.
'.pdf'
;
if
(
!
$error
&&
$pagecount
)
...
...
This diff is collapsed.
Click to expand it.
scripts/invoices/rebuild_merge_pdf.php
+
10
−
1
View file @
167ec691
...
...
@@ -71,6 +71,7 @@ $newlangid='en_EN'; // To force a new lang id
$filter
=
array
();
$regenerate
=
''
;
// Ask regenerate (contains name of model to use)
$option
=
''
;
$fileprefix
=
'mergedpdf'
;
foreach
(
$argv
as
$key
=>
$value
)
{
...
...
@@ -84,6 +85,13 @@ foreach ($argv as $key => $value)
$newlangid
=
$valarray
[
1
];
print
'Use language '
.
$newlangid
.
".
\n
"
;
}
if
(
preg_match
(
'/^prefix=/i'
,
$value
))
{
$found
=
true
;
$valarray
=
explode
(
'='
,
$value
);
$fileprefix
=
$valarray
[
1
];
print
'Use prefix for filename '
.
$fileprefix
.
".
\n
"
;
}
if
(
preg_match
(
'/^regenerate=(.*)/i'
,
$value
,
$reg
))
{
...
...
@@ -232,7 +240,7 @@ if (in_array('bank',$filter) && in_array('nopayment',$filter))
// Define SQL and SQL request to select invoices
// Use $filter, $dateafterdate, datebeforedate, $paymentdateafter, $paymentdatebefore
$result
=
rebuild_merge_pdf
(
$db
,
$langs
,
$conf
,
$diroutputpdf
,
$newlangid
,
$filter
,
$dateafterdate
,
$datebeforedate
,
$paymentdateafter
,
$paymentdatebefore
,
1
,
$regenerate
,
$option
,
$paymentonbankid
,
$thirdpartiesid
);
$result
=
rebuild_merge_pdf
(
$db
,
$langs
,
$conf
,
$diroutputpdf
,
$newlangid
,
$filter
,
$dateafterdate
,
$datebeforedate
,
$paymentdateafter
,
$paymentdatebefore
,
1
,
$regenerate
,
$option
,
$paymentonbankid
,
$thirdpartiesid
,
$fileprefix
);
...
...
@@ -283,6 +291,7 @@ function usage()
print
"To limit to some thirdparties, use filter=onlythirdparties id1,id2...
\n
"
;
print
"To regenerate existing PDF, use regenerate=crabe
\n
"
;
print
"To generate invoices in a language, use lang=xx_XX
\n
"
;
print
"To set prefix of generated file name, use prefix=myfileprefix
\n
"
;
print
"
\n
"
;
print
"Example: "
.
$script_file
.
" filter=payments 20080101 20081231 lang=fr_FR regenerate=crabe
\n
"
;
print
"Example: "
.
$script_file
.
" filter=all lang=en_US
\n
"
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment