1 | <?php |
||
2 | |||
3 | /* Copyright (C) 2003-2007 Rodolphe Quiedeville <[email protected]> |
||
4 | * Copyright (C) 2004-2010 Laurent Destailleur <[email protected]> |
||
5 | * Copyright (C) 2005 Marc Barilley / Ocebo <[email protected]> |
||
6 | * Copyright (C) 2005-2009 Regis Houssin <[email protected]> |
||
7 | * Copyright (C) 2005 Simon TOSSER <[email protected]> |
||
8 | * Copyright (C) 2011-2012 Juanjo Menent <[email protected]> |
||
9 | * Copyright (C) 2013 Cédric Salvador <[email protected]> |
||
10 | * Copyright (C) 2017 Ferran Marcet <[email protected]> |
||
11 | * Copyright (C) 2024 Rafael San José <[email protected]> |
||
12 | * |
||
13 | * This program is free software; you can redistribute it and/or modify |
||
14 | * it under the terms of the GNU General Public License as published by |
||
15 | * the Free Software Foundation; either version 3 of the License, or |
||
16 | * (at your option) any later version. |
||
17 | * |
||
18 | * This program is distributed in the hope that it will be useful, |
||
19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
21 | * GNU General Public License for more details. |
||
22 | * |
||
23 | * You should have received a copy of the GNU General Public License |
||
24 | * along with this program. If not, see <https://www.gnu.org/licenses/>. |
||
25 | */ |
||
26 | |||
27 | use Dolibarr\Code\Core\Classes\Form; |
||
28 | use Dolibarr\Code\FichInter\Classes\Fichinter; |
||
29 | use Dolibarr\Code\Projet\Classes\Project; |
||
30 | use Dolibarr\Lib\ViewMain; |
||
31 | |||
32 | /** |
||
33 | * \file htdocs/fichinter/document.php |
||
34 | * \ingroup fichinter |
||
35 | * \brief Page des documents joints sur les contrats |
||
36 | */ |
||
37 | |||
38 | // Load Dolibarr environment |
||
39 | require constant('DOL_DOCUMENT_ROOT') . '/main.inc.php'; |
||
40 | require_once constant('DOL_DOCUMENT_ROOT') . '/core/lib/files.lib.php'; |
||
41 | require_once constant('DOL_DOCUMENT_ROOT') . '/core/lib/images.lib.php'; |
||
42 | require_once constant('DOL_DOCUMENT_ROOT') . '/core/lib/fichinter.lib.php'; |
||
43 | |||
44 | // Load translation files required by the page |
||
45 | $langs->loadLangs(array('other', 'fichinter', 'companies', 'interventions')); |
||
46 | |||
47 | $id = GETPOSTINT('id'); |
||
48 | $ref = GETPOST('ref', 'alpha'); |
||
49 | $action = GETPOST('action', 'aZ09'); |
||
50 | $confirm = GETPOST('confirm', 'alpha'); |
||
51 | |||
52 | // Security check |
||
53 | if ($user->socid) { |
||
54 | $socid = $user->socid; |
||
55 | } |
||
56 | $result = restrictedArea($user, 'ficheinter', $id, 'fichinter'); |
||
57 | |||
58 | |||
59 | // Get parameters |
||
60 | $limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit; |
||
61 | $sortfield = GETPOST('sortfield', 'aZ09comma'); |
||
62 | $sortorder = GETPOST('sortorder', 'aZ09comma'); |
||
63 | $page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT("page"); |
||
64 | if (empty($page) || $page == -1) { |
||
65 | $page = 0; |
||
66 | } // If $page is not defined, or '' or -1 |
||
67 | $offset = $limit * $page; |
||
68 | $pageprev = $page - 1; |
||
69 | $pagenext = $page + 1; |
||
70 | if (!$sortorder) { |
||
71 | $sortorder = "ASC"; |
||
72 | } |
||
73 | if (!$sortfield) { |
||
74 | $sortfield = "name"; |
||
75 | } |
||
76 | |||
77 | $object = new Fichinter($db); |
||
78 | $object->fetch($id, $ref); |
||
79 | |||
80 | $upload_dir = $conf->ficheinter->dir_output . '/' . dol_sanitizeFileName($object->ref); |
||
81 | $modulepart = 'fichinter'; |
||
82 | |||
83 | $permissiontoadd = $user->hasRight('ficheinter', 'creer'); // Used by the include of actions_setnotes.inc.php |
||
84 | |||
85 | |||
86 | /* |
||
87 | * Actions |
||
88 | */ |
||
89 | |||
90 | include DOL_DOCUMENT_ROOT . '/core/actions_linkedfiles.inc.php'; |
||
91 | |||
92 | |||
93 | /* |
||
94 | * View |
||
95 | */ |
||
96 | |||
97 | $form = new Form($db); |
||
98 | |||
99 | ViewMain::llxHeader('', $langs->trans("Intervention")); |
||
100 | |||
101 | if ($object->id) { |
||
102 | $object->fetch_thirdparty(); |
||
103 | |||
104 | $head = fichinter_prepare_head($object); |
||
105 | |||
106 | print dol_get_fiche_head($head, 'documents', $langs->trans("InterventionCard"), -1, 'intervention'); |
||
107 | |||
108 | |||
109 | // Build file list |
||
110 | $filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) == 'desc' ? SORT_DESC : SORT_ASC), 1); |
||
111 | $totalsize = 0; |
||
112 | foreach ($filearray as $key => $file) { |
||
113 | $totalsize += $file['size']; |
||
114 | } |
||
115 | |||
116 | |||
117 | // Intervention card |
||
118 | $linkback = '<a href="' . constant('BASE_URL') . '/fichinter/list.php?restore_lastsearch_values=1' . (!empty($socid) ? '&socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>'; |
||
119 | |||
120 | |||
121 | $morehtmlref = '<div class="refidno">'; |
||
122 | // Ref customer |
||
123 | //$morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->ficheinter->creer, 'string', '', 0, 1); |
||
124 | //$morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->ficheinter->creer, 'string', '', null, null, '', 1); |
||
125 | $morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1); |
||
126 | $morehtmlref .= $form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1); |
||
127 | // Thirdparty |
||
128 | $morehtmlref .= '<br>' . $object->thirdparty->getNomUrl(1, 'customer'); |
||
0 ignored issues
–
show
|
|||
129 | // Project |
||
130 | if (isModEnabled('project')) { |
||
131 | $langs->load("projects"); |
||
132 | $morehtmlref .= '<br>'; |
||
133 | if ($permissiontoadd && 0) { |
||
134 | $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); |
||
135 | if ($action != 'classify') { |
||
136 | $morehtmlref .= '<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&token=' . newToken() . '&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> '; |
||
137 | } |
||
138 | $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300'); |
||
139 | } else { |
||
140 | if (!empty($object->fk_project)) { |
||
141 | $proj = new Project($db); |
||
142 | $proj->fetch($object->fk_project); |
||
143 | $morehtmlref .= $proj->getNomUrl(1); |
||
144 | if ($proj->title) { |
||
145 | $morehtmlref .= '<span class="opacitymedium"> - ' . dol_escape_htmltag($proj->title) . '</span>'; |
||
146 | } |
||
147 | } |
||
148 | } |
||
149 | } |
||
150 | $morehtmlref .= '</div>'; |
||
151 | |||
152 | dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); |
||
153 | |||
154 | |||
155 | print '<div class="fichecenter">'; |
||
156 | print '<div class="underbanner clearboth"></div>'; |
||
157 | |||
158 | print '<table class="border tableforfield centpercent">'; |
||
159 | print '<tr><td class="titlefield">' . $langs->trans("NbOfAttachedFiles") . '</td><td colspan="3">' . count($filearray) . '</td></tr>'; |
||
160 | print '<tr><td>' . $langs->trans("TotalSizeOfAttachedFiles") . '</td><td colspan="3">' . dol_print_size($totalsize, 1, 1) . '</td></tr>'; |
||
161 | print '</table>'; |
||
162 | |||
163 | print '</div>'; |
||
164 | |||
165 | print dol_get_fiche_end(); |
||
166 | |||
167 | $modulepart = 'ficheinter'; |
||
168 | $permtoedit = $user->hasRight('ficheinter', 'creer'); |
||
169 | $param = '&id=' . $object->id; |
||
170 | include DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php'; |
||
171 | } else { |
||
172 | print $langs->trans("ErrorUnknown"); |
||
173 | } |
||
174 | |||
175 | |||
176 | ViewMain::llxFooter(); |
||
177 | |||
178 | $db->close(); |
||
179 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.