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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Software_Artifact_Infrastructure_Repository
dolibarr
Commits
d686c52b
Commit
d686c52b
authored
13 years ago
by
Laurent Destailleur
Browse files
Options
Downloads
Patches
Plain Diff
Fix: usage of custom dir for supplier invoices
parent
c4af9d4d
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
htdocs/core/modules/facture/modules_facture.php
+1
-1
1 addition, 1 deletion
htdocs/core/modules/facture/modules_facture.php
htdocs/core/modules/supplier_invoice/modules_facturefournisseur.php
+53
-14
53 additions, 14 deletions
...e/modules/supplier_invoice/modules_facturefournisseur.php
with
54 additions
and
15 deletions
htdocs/core/modules/facture/modules_facture.php
+
1
−
1
View file @
d686c52b
...
@@ -135,7 +135,7 @@ abstract class ModeleNumRefFactures
...
@@ -135,7 +135,7 @@ abstract class ModeleNumRefFactures
* @param DoliDB $db Database handler
* @param DoliDB $db Database handler
* @param Object $object Object invoice
* @param Object $object Object invoice
* @param string $message message
* @param string $message message
* @param string $modele Force
le modele a utili
se
r
('' to not force)
* @param string $modele Force
template to u
se ('' to not force)
* @param Translate $outputlangs objet lang a utiliser pour traduction
* @param Translate $outputlangs objet lang a utiliser pour traduction
* @param int $hidedetails Hide details of lines
* @param int $hidedetails Hide details of lines
* @param int $hidedesc Hide description
* @param int $hidedesc Hide description
...
...
This diff is collapsed.
Click to expand it.
htdocs/core/modules/supplier_invoice/modules_facturefournisseur.php
+
53
−
14
View file @
d686c52b
...
@@ -58,38 +58,69 @@ abstract class ModelePDFSuppliersInvoices extends CommonDocGenerator
...
@@ -58,38 +58,69 @@ abstract class ModelePDFSuppliersInvoices extends CommonDocGenerator
*
*
* @param DoliDB $db objet base de donnee
* @param DoliDB $db objet base de donnee
* @param Object $object object supplier invoice
* @param Object $object object supplier invoice
* @param string $model
f
orce
le modele a utili
se
r
('' to not force)
* @param string $model
e
F
orce
template to u
se ('' to not force)
* @param Translate $outputlangs objet lang a utiliser pour traduction
* @param Translate $outputlangs objet lang a utiliser pour traduction
* @return int 0 if KO, 1 if OK
* @return int 0 if KO, 1 if OK
*/
*/
function
supplier_invoice_pdf_create
(
$db
,
$object
,
$model
,
$outputlangs
)
function
supplier_invoice_pdf_create
(
$db
,
$object
,
$model
e
,
$outputlangs
)
{
{
global
$conf
,
$langs
;
global
$conf
,
$user
,
$langs
;
$langs
->
load
(
"suppliers"
);
$langs
->
load
(
"suppliers"
);
$dir
=
DOL_DOCUMENT_ROOT
.
"/core/modules/supplier_invoice/pdf/"
;
$error
=
0
;
// Increase limit for PDF build
$err
=
error_reporting
();
error_reporting
(
0
);
@
set_time_limit
(
120
);
error_reporting
(
$err
);
$dir
=
"/core/modules/supplier_invoice/"
;
$srctemplatepath
=
''
;
// Positionne modele sur le nom du modele de invoice fournisseur a utiliser
// Positionne modele sur le nom du modele de invoice fournisseur a utiliser
if
(
!
dol_strlen
(
$model
))
if
(
!
dol_strlen
(
$model
e
))
{
{
if
(
!
empty
(
$conf
->
global
->
INVOICE_SUPPLIER_ADDON_PDF
))
if
(
!
empty
(
$conf
->
global
->
INVOICE_SUPPLIER_ADDON_PDF
))
{
{
$model
=
$conf
->
global
->
INVOICE_SUPPLIER_ADDON_PDF
;
$model
e
=
$conf
->
global
->
INVOICE_SUPPLIER_ADDON_PDF
;
}
}
else
else
{
{
$model
=
'canelle'
;
$modele
=
'canelle'
;
//print $langs->trans("Error")." ".$langs->trans("Error_INVOICE_SUPPLIER_ADDON_PDF_NotDefined");
//return 0;
}
}
}
}
// If selected modele is a filename template (then $modele="modelname:filename")
$tmp
=
explode
(
':'
,
$modele
,
2
);
if
(
!
empty
(
$tmp
[
1
]))
{
$modele
=
$tmp
[
0
];
$srctemplatepath
=
$tmp
[
1
];
}
// Search template file
$file
=
''
;
$classname
=
''
;
$filefound
=
0
;
foreach
(
array
(
'doc'
,
'pdf'
)
as
$prefix
)
{
$file
=
$prefix
.
"_"
.
$modele
.
".modules.php"
;
// On verifie l'emplacement du modele
$file
=
dol_buildpath
(
$dir
.
'pdf/'
.
$file
);
// TODO rename into doc/
if
(
file_exists
(
$file
))
{
$filefound
=
1
;
$classname
=
$prefix
.
'_'
.
$modele
;
break
;
}
}
// Charge le modele
// Charge le modele
$file
=
"pdf_"
.
$model
.
".modules.php"
;
if
(
$filefound
)
if
(
file_exists
(
$dir
.
$file
))
{
{
$classname
=
"pdf_"
.
$model
;
require_once
(
$file
);
require_once
(
$dir
.
$file
);
$obj
=
new
$classname
(
$db
,
$object
);
$obj
=
new
$classname
(
$db
,
$object
);
...
@@ -103,6 +134,14 @@ function supplier_invoice_pdf_create($db, $object, $model, $outputlangs)
...
@@ -103,6 +134,14 @@ function supplier_invoice_pdf_create($db, $object, $model, $outputlangs)
// we delete preview files
// we delete preview files
require_once
(
DOL_DOCUMENT_ROOT
.
"/core/lib/files.lib.php"
);
require_once
(
DOL_DOCUMENT_ROOT
.
"/core/lib/files.lib.php"
);
dol_delete_preview
(
$object
);
dol_delete_preview
(
$object
);
// Appel des triggers
include_once
(
DOL_DOCUMENT_ROOT
.
"/core/class/interfaces.class.php"
);
$interface
=
new
Interfaces
(
$db
);
$result
=
$interface
->
run_triggers
(
'BILL_BUILDDOC'
,
$object
,
$user
,
$langs
,
$conf
);
if
(
$result
<
0
)
{
$error
++
;
$this
->
errors
=
$interface
->
errors
;
}
// Fin appel triggers
return
1
;
return
1
;
}
}
else
else
...
@@ -115,7 +154,7 @@ function supplier_invoice_pdf_create($db, $object, $model, $outputlangs)
...
@@ -115,7 +154,7 @@ function supplier_invoice_pdf_create($db, $object, $model, $outputlangs)
}
}
else
else
{
{
print
$langs
->
trans
(
"Error"
)
.
" "
.
$langs
->
trans
(
"ErrorFileDoesNotExists"
,
$
dir
.
$
file
);
print
$langs
->
trans
(
"Error"
)
.
" "
.
$langs
->
trans
(
"ErrorFileDoesNotExists"
,
$file
);
return
0
;
return
0
;
}
}
}
}
...
...
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