dolibarr 21.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 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <https://www.gnu.org/licenses/>.
19 */
20
35{
36 global $db, $langs, $conf;
37
38 $tab = 0;
39 $head = array();
40
41 $head[$tab][0] = DOL_URL_ROOT.'/compta/tva/card.php?id='.$object->id;
42 $head[$tab][1] = $langs->trans('VATDeclaration');
43 $head[$tab][2] = 'card';
44 $tab++;
45
46 // Show more tabs from modules
47 // Entries must be declared in modules descriptor with line
48 // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
49 // $this->tabs = array('entity:-tabname); to remove a tab
50 complete_head_from_modules($conf, $langs, $object, $head, $tab, 'vat');
51
52 require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
53 require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
54 $upload_dir = $conf->tax->dir_output."/vat/".dol_sanitizeFileName($object->ref);
55 $nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$'));
56 $nbLinks = Link::count($db, $object->element, $object->id);
57 $head[$tab][0] = DOL_URL_ROOT.'/compta/tva/document.php?id='.$object->id;
58 $head[$tab][1] = $langs->trans("Documents");
59 if (($nbFiles + $nbLinks) > 0) {
60 $head[$tab][1] .= '<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).'</span>';
61 }
62 $head[$tab][2] = 'documents';
63 $tab++;
64
65 $head[$tab][0] = DOL_URL_ROOT.'/compta/tva/info.php?id='.$object->id;
66 $head[$tab][1] = $langs->trans("Info");
67 $head[$tab][2] = 'info';
68 $tab++;
69
70 complete_head_from_modules($conf, $langs, $object, $head, $tab, 'vat', 'remove');
71
72 return $head;
73}
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Definition card.php:66
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:63
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
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).
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
Definition member.php:79
vat_prepare_head($object)
Prepare array with list of tabs.
Definition vat.lib.php:34