dolibarr 24.0.0-beta
vat.lib.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2016 Alexandre Spangaro <aspangaro@open-dsi.fr>
3 * Copyright (C) 2018 Philippe Grand <philippe.grand@atoo-net.com>
4 * Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
5 * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
6 * Copyright (C) 2025 Frédéric France <frederic.france@free.fr>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 3 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <https://www.gnu.org/licenses/>.
20 */
21
36{
37 global $db, $langs, $conf;
38
39 $tab = 0;
40 $head = array();
41
42 $head[$tab][0] = DOL_URL_ROOT.'/compta/tva/card.php?id='.$object->id;
43 $head[$tab][1] = $langs->trans('VATDeclaration');
44 $head[$tab][2] = 'card';
45 $tab++;
46
47 // Show more tabs from modules
48 // Entries must be declared in modules descriptor with line
49 // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
50 // $this->tabs = array('entity:-tabname); to remove a tab
51 complete_head_from_modules($conf, $langs, $object, $head, $tab, 'vat');
52
53 require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
54 require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
55 $upload_dir = $conf->tax->dir_output."/vat/".dol_sanitizeFileName($object->ref);
56 $nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$'));
57 $nbLinks = Link::count($db, $object->element, $object->id);
58 $head[$tab][0] = DOL_URL_ROOT.'/compta/tva/document.php?id='.$object->id;
59 $head[$tab][1] = $langs->trans("Documents");
60 if (($nbFiles + $nbLinks) > 0) {
61 $head[$tab][1] .= '<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).'</span>';
62 }
63 $head[$tab][2] = 'documents';
64 $tab++;
65
66 $head[$tab][0] = DOL_URL_ROOT.'/compta/tva/info.php?id='.$object->id;
67 $head[$tab][1] = $langs->trans("Info");
68 $head[$tab][2] = 'info';
69 $tab++;
70
71 complete_head_from_modules($conf, $langs, $object, $head, $tab, 'vat', 'remove');
72
73 return $head;
74}
if(! $sortfield) if(! $sortorder) $object
Definition account.php:100
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $conf
The main.inc.php has been included so the following variable are now defined:
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $db
API class for accounts.
dol_dir_list($utf8_path, $types="all", $recursive=0, $filter="", $excludefilter=null, $sortcriteria="name", $sortorder=SORT_ASC, $mode=0, $nohook=0, $relativename="", $donotfollowsymlinks=0, $nbsecondsold=0)
Scan a directory and return a list of files/directories.
Definition files.lib.php:64
dol_sanitizeFileName($str, $newstr='_', $unaccent=1, $includequotes=0, $allowdash=0)
Clean a string to use it as a file name.
complete_head_from_modules($conf, $langs, $object, &$head, &$h, $type, $mode='add', $filterorigmodule='')
Complete or removed entries into a head array (used to build tabs).
vat_prepare_head($object)
Prepare array with list of tabs.
Definition vat.lib.php:35