1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* Copyright (C) 2015 Laurent Destailleur <[email protected]> |
4
|
|
|
* Copyright (C) 2024 Rafael San José <[email protected]> |
5
|
|
|
* |
6
|
|
|
* This program is free software; you can redistribute it and/or modify |
7
|
|
|
* it under the terms of the GNU General Public License as published by |
8
|
|
|
* the Free Software Foundation; either version 3 of the License, or |
9
|
|
|
* (at your option) any later version. |
10
|
|
|
* |
11
|
|
|
* This program is distributed in the hope that it will be useful, |
12
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
13
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14
|
|
|
* GNU General Public License for more details. |
15
|
|
|
* |
16
|
|
|
* You should have received a copy of the GNU General Public License |
17
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>. |
18
|
|
|
*/ |
19
|
|
|
|
20
|
|
|
namespace Dolibarr\Code\ExpenseReport\Classes; |
21
|
|
|
|
22
|
|
|
use Dolibarr\Code\Core\Classes\CommonDocGenerator; |
23
|
|
|
use Dolibarr\Code\Core\Classes\Translate; |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* Parent class for trips and expenses templates |
27
|
|
|
*/ |
28
|
|
|
abstract class ModeleExpenseReport extends CommonDocGenerator |
29
|
|
|
{ |
30
|
|
|
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
31
|
|
|
/** |
32
|
|
|
* Return list of active models generation |
33
|
|
|
* |
34
|
|
|
* @param DoliDB $db Database handler |
|
|
|
|
35
|
|
|
* @param integer $maxfilenamelength Max length of value to show |
36
|
|
|
* @return array List of templates |
37
|
|
|
*/ |
38
|
|
|
public static function liste_modeles($db, $maxfilenamelength = 0) |
39
|
|
|
{ |
40
|
|
|
// phpcs:enable |
41
|
|
|
$type = 'expensereport'; |
42
|
|
|
$list = array(); |
43
|
|
|
|
44
|
|
|
include_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php'; |
45
|
|
|
$list = getListOfModels($db, $type, $maxfilenamelength); |
46
|
|
|
|
47
|
|
|
return $list; |
|
|
|
|
48
|
|
|
} |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* expensereport_pdf_create |
53
|
|
|
* |
54
|
|
|
* @param DoliDB $db Database handler |
55
|
|
|
* @param ExpenseReport $object Object ExpenseReport |
56
|
|
|
* @param string $message Message |
57
|
|
|
* @param string $modele Force the model to use ('' to not force) |
58
|
|
|
* @param Translate $outputlangs lang object to use for translation |
59
|
|
|
* @param int $hidedetails Hide details of lines |
60
|
|
|
* @param int $hidedesc Hide description |
61
|
|
|
* @param int $hideref Hide ref |
62
|
|
|
* @return int 0 if KO, 1 if OK |
63
|
|
|
*/ |
64
|
|
|
function expensereport_pdf_create(DoliDB $db, ExpenseReport $object, $message, $modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0) |
65
|
|
|
{ |
66
|
|
|
return $object->generateDocument($modele, $outputlangs, $hidedetails, $hidedesc, $hideref); |
67
|
|
|
} |
68
|
|
|
|