dolibarr 25.0.0-alpha
expensereport_addfile.tpl.php
1<?php
2/* Copyright (C) 2025-2026 MDW <mdeweerd@users.noreply.github.com>
3 * Copyright (C) 2025 Frédéric France <frederic.france@free.fr>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <https://www.gnu.org/licenses/>.
17 */
18
28'
29@phan-var-force int $colspan
30@phan-var-force FormFile $formfile
31@phan-var-force User $user
32';
33
34// Add line to upload new file
35print '<!-- expensereport_addfile.tpl.php -->'."\n";
36print '<tr class="truploadnewfilenow'.(empty($tredited) ? ' oddeven nohover' : ' '.$tredited).'"'.(!getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER') ? ' style="display: none"' : '').'>';
37
38// Num line
39if ($action == 'editline') {
40 print '<td></td>';
41}
42
43// Upload section
44print '<td colspan="'.($action == 'editline' ? $colspan - 1 : $colspan).'">';
45
46$modulepart = 'expensereport';
47$permission = $user->hasRight('expensereport', 'creer');
48
49// We define var to enable the feature to add prefix of uploaded files
50$savingdocmask = '';
51if (!getDolGlobalString('MAIN_DISABLE_SUGGEST_REF_AS_PREFIX')) {
52 //var_dump($modulepart);
53 if (in_array($modulepart, array('facture_fournisseur', 'commande_fournisseur', 'facture', 'commande', 'propal', 'supplier_proposal', 'ficheinter', 'contract', 'expedition', 'project', 'project_task', 'expensereport', 'tax', 'produit', 'product_batch'))) {
54 $savingdocmask = dol_sanitizeFileName($object->ref).'-__file__';
55 }
56}
57
58// Show upload form (document and links)
59$formfile->form_attach_new_file(
60 $_SERVER["PHP_SELF"].'?id='.$object->id,
61 'none',
62 0,
63 0,
64 $permission,
65 $conf->browser->layout == 'phone' ? 40 : 60,
66 $object,
67 '',
68 1,
69 $savingdocmask,
70 0,
71 'formuserfile',
72 'accept',
73 '',
74 1
75);
76
77print '</td></tr>';
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:
dol_sanitizeFileName($str, $newstr='_', $unaccent=1, $includequotes=0, $allowdash=0)
Clean a string to use it as a file name.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.