dolibarr 23.0.3
expensereport_addfile.tpl.php
1<?php
2/* Copyright (C) 2025 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';
31
32// Add line to upload new file
33print '<!-- expensereport_addfile.tpl.php -->'."\n";
34print '<tr class="truploadnewfilenow'.(empty($tredited) ? ' oddeven nohover' : ' '.$tredited).'"'.(!getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER') ? ' style="display: none"' : '').'>';
35
36// Num line
37if ($action == 'editline') {
38 print '<td></td>';
39}
40
41// Upload section
42print '<td colspan="'.($action == 'editline' ? $colspan - 1 : $colspan).'">';
43
44$modulepart = 'expensereport';
45$permission = $user->hasRight('expensereport', 'creer');
46
47// We define var to enable the feature to add prefix of uploaded files
48$savingdocmask = '';
49if (!getDolGlobalString('MAIN_DISABLE_SUGGEST_REF_AS_PREFIX')) {
50 //var_dump($modulepart);
51 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'))) {
52 $savingdocmask = dol_sanitizeFileName($object->ref).'-__file__';
53 }
54}
55
56// Show upload form (document and links)
57$formfile->form_attach_new_file(
58 $_SERVER["PHP_SELF"].'?id='.$object->id,
59 'none',
60 0,
61 0,
62 $permission,
63 $conf->browser->layout == 'phone' ? 40 : 60,
64 $object,
65 '',
66 1,
67 $savingdocmask,
68 0,
69 'formuserfile',
70 'accept',
71 '',
72 1
73);
74
75print '</td></tr>';
if(! $sortfield) if(! $sortorder) $object
Definition account.php:100
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.