dolibarr  7.0.0-beta
document_actions_post_headers.tpl.php
1 <?php
2 /* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
3  * Copyright (C) 2013-2014 Laurent Destailleur <eldy@users.sourceforge.net>
4  * Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
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 <http://www.gnu.org/licenses/>.
18  * or see http://www.gnu.org/
19  */
20 
21 // Following var can be set
22 // $permission = permission or not to add a file
23 // $permtoedit = permission or not to edit file name, crop file
24 // $modulepart = for download
25 // $param = param to add to download links
26 
27 // Protection to avoid direct call of template
28 if (empty($langs) || ! is_object($langs))
29 {
30  print "Error, template page can't be called as URL";
31  exit;
32 }
33 
34 
35 $langs->load("link");
36 if (empty($relativepathwithnofile)) $relativepathwithnofile='';
37 if (empty($permtoedit)) $permtoedit=-1;
38 
39 /*
40  * Confirm form to delete
41  */
42 
43 if ($action == 'delete')
44 {
45  $langs->load("companies"); // Need for string DeleteFile+ConfirmDeleteFiles
46  $ret = $form->form_confirm(
47  $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&urlfile=' . urlencode(GETPOST("urlfile")) . '&linkid=' . GETPOST('linkid', 'int') . (empty($param)?'':$param),
48  $langs->trans('DeleteFile'),
49  $langs->trans('ConfirmDeleteFile'),
50  'confirm_deletefile',
51  '',
52  0,
53  1
54  );
55  if ($ret == 'html') print '<br>';
56 }
57 
58 $formfile=new FormFile($db);
59 
60 // We define var to enable the feature to add prefix of uploaded files
61 $savingdocmask='';
62 if (empty($conf->global->MAIN_DISABLE_SUGGEST_REF_AS_PREFIX))
63 {
64  //var_dump($modulepart);
65  if (in_array($modulepart,array('facture_fournisseur','commande_fournisseur','facture','commande','propal','supplier_proposal','ficheinter','contract','project','project_task','expensereport','tax')))
66  {
67  $savingdocmask=dol_sanitizeFileName($object->ref).'-__file__';
68  }
69  /*if (in_array($modulepart,array('member')))
70  {
71  $savingdocmask=$object->login.'___file__';
72  }*/
73 }
74 
75 // Show upload form (document and links)
76 $formfile->form_attach_new_file(
77  $_SERVER["PHP_SELF"].'?id='.$object->id.(empty($withproject)?'':'&withproject=1'),
78  '',
79  0,
80  0,
81  $permission,
82  $conf->browser->layout == 'phone' ? 40 : 60,
83  $object,
84  '',
85  1,
86  $savingdocmask
87 );
88 
89 $disablemove=1;
90 if (in_array($modulepart, array('product', 'produit', 'societe', 'user'))) $disablemove=0; // Drag and drop for up and down allowed on product, thirdparty, ...
91 
92 // List of document
93 $formfile->list_of_documents(
94  $filearray,
95  $object,
96  $modulepart,
97  $param,
98  0,
99  $relativepathwithnofile, // relative path with no file. For example "0/1"
100  $permission,
101  0,
102  '',
103  0,
104  '',
105  '',
106  0,
107  $permtoedit,
108  $upload_dir,
109  $sortfield,
110  $sortorder,
111  $disablemove
112 );
113 
114 print "<br>";
115 //List of links
116 $formfile->listOfLinks($object, $permission, $action, GETPOST('linkid', 'int'), $param);
117 print "<br>";
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
if(empty($reshook)) $form
View.
Definition: perms.php:103
GETPOST($paramname, $check='none', $method=0, $filter=NULL, $options=NULL, $noreplace=0)
Return value of a param into GET or POST supervariable.
Class to offer components to list and upload files.
print
Draft customers invoices.
Definition: index.php:91