@@ -26,21 +26,21 @@ |
||
26 | 26 | // $object must be defined |
27 | 27 | // $permissiondellink must be defined |
28 | 28 | |
29 | -$dellinkid = GETPOST('dellinkid','int'); |
|
30 | -$addlinkid = GETPOST('idtolinkto','int'); |
|
29 | +$dellinkid = GETPOST('dellinkid', 'int'); |
|
30 | +$addlinkid = GETPOST('idtolinkto', 'int'); |
|
31 | 31 | |
32 | 32 | // Link invoice to order |
33 | -if ($action == 'addlink' && ! empty($permissiondellink) && ! GETPOST('cancel','alpha') && $id > 0 && $addlinkid > 0) |
|
33 | +if ($action == 'addlink' && !empty($permissiondellink) && !GETPOST('cancel', 'alpha') && $id > 0 && $addlinkid > 0) |
|
34 | 34 | { |
35 | 35 | $object->fetch($id); |
36 | 36 | $object->fetch_thirdparty(); |
37 | - $result = $object->add_object_linked(GETPOST('addlink','alpha'), $addlinkid); |
|
37 | + $result = $object->add_object_linked(GETPOST('addlink', 'alpha'), $addlinkid); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | // Delete link |
41 | -if ($action == 'dellink' && ! empty($permissiondellink) && ! GETPOST('cancel','alpha') && $dellinkid > 0) |
|
41 | +if ($action == 'dellink' && !empty($permissiondellink) && !GETPOST('cancel', 'alpha') && $dellinkid > 0) |
|
42 | 42 | { |
43 | - $result=$object->deleteObjectLinked(0, '', 0, '', $dellinkid); |
|
44 | - if ($result < 0) setEventMessages($object->error,$object->errors,'errors'); |
|
43 | + $result = $object->deleteObjectLinked(0, '', 0, '', $dellinkid); |
|
44 | + if ($result < 0) setEventMessages($object->error, $object->errors, 'errors'); |
|
45 | 45 | } |
46 | 46 |
@@ -28,9 +28,9 @@ discard block |
||
28 | 28 | // $cancel must be defined |
29 | 29 | // $id or $ref must be defined (object is loaded in this file with fetch) |
30 | 30 | |
31 | -if (($id > 0 || (! empty($ref) && ! in_array($action, array('create', 'createtask', 'add')))) && (empty($cancel) || $id > 0)) |
|
31 | +if (($id > 0 || (!empty($ref) && !in_array($action, array('create', 'createtask', 'add')))) && (empty($cancel) || $id > 0)) |
|
32 | 32 | { |
33 | - if (($id > 0 && is_numeric($id)) || ! empty($ref)) // To discard case when id is list of ids like '1,2,3...' |
|
33 | + if (($id > 0 && is_numeric($id)) || !empty($ref)) // To discard case when id is list of ids like '1,2,3...' |
|
34 | 34 | { |
35 | 35 | $ret = $object->fetch($id, $ref); |
36 | 36 | if ($ret > 0) |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | } |
41 | 41 | else |
42 | 42 | { |
43 | - if (empty($object->error) && ! count($object->errors)) |
|
43 | + if (empty($object->error) && !count($object->errors)) |
|
44 | 44 | { |
45 | 45 | if ($ret < 0) // if $ret == 0, it means not found. |
46 | 46 | { |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | } |
49 | 49 | } |
50 | 50 | else setEventMessages($object->error, $object->errors, 'errors'); |
51 | - $action=''; |
|
51 | + $action = ''; |
|
52 | 52 | } |
53 | 53 | } |
54 | 54 | } |
@@ -26,15 +26,15 @@ discard block |
||
26 | 26 | // This script is called with a POST method. |
27 | 27 | // Directory to scan (full path) is inside POST['dir'] and encode by js escape() if ajax is used or encoded by urlencode if mode=noajax |
28 | 28 | |
29 | -if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL',1); // Disables token renewal |
|
30 | -if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); |
|
31 | -if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1'); |
|
32 | -if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); |
|
29 | +if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', 1); // Disables token renewal |
|
30 | +if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); |
|
31 | +if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); |
|
32 | +if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); |
|
33 | 33 | |
34 | 34 | |
35 | -if (! isset($mode) || $mode != 'noajax') // For ajax call |
|
35 | +if (!isset($mode) || $mode != 'noajax') // For ajax call |
|
36 | 36 | { |
37 | - $res=@include '../../main.inc.php'; |
|
37 | + $res = @include '../../main.inc.php'; |
|
38 | 38 | include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
39 | 39 | include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; |
40 | 40 | include_once DOL_DOCUMENT_ROOT.'/core/lib/treeview.lib.php'; |
@@ -44,58 +44,58 @@ discard block |
||
44 | 44 | //if (GETPOST('preopened')) { $_GET['dir'] = $_POST['dir'] = '/bbb/'; } |
45 | 45 | |
46 | 46 | $openeddir = GETPOST('openeddir'); |
47 | - $modulepart= GETPOST('modulepart'); |
|
48 | - $selecteddir = jsUnEscape(GETPOST('dir')); // relative path. We must decode using same encoding function used by javascript: escape() |
|
47 | + $modulepart = GETPOST('modulepart'); |
|
48 | + $selecteddir = jsUnEscape(GETPOST('dir')); // relative path. We must decode using same encoding function used by javascript: escape() |
|
49 | 49 | |
50 | 50 | $preopened = GETPOST('preopened'); |
51 | 51 | |
52 | - if ($selecteddir != '/') $selecteddir = preg_replace('/\/$/','',$selecteddir); // We removed last '/' except if it is '/' |
|
52 | + if ($selecteddir != '/') $selecteddir = preg_replace('/\/$/', '', $selecteddir); // We removed last '/' except if it is '/' |
|
53 | 53 | } |
54 | 54 | else // For no ajax call |
55 | 55 | { |
56 | 56 | //if (GETPOST('preopened')) { $_GET['dir'] = $_POST['dir'] = GETPOST('preopened'); } |
57 | 57 | |
58 | 58 | $openeddir = GETPOST('openeddir'); |
59 | - $modulepart= GETPOST('modulepart'); |
|
59 | + $modulepart = GETPOST('modulepart'); |
|
60 | 60 | $selecteddir = GETPOST('dir'); |
61 | 61 | |
62 | 62 | $preopened = GETPOST('preopened'); |
63 | 63 | |
64 | - if ($selecteddir != '/') $selecteddir = preg_replace('/\/$/','',$selecteddir); // We removed last '/' except if it is '/' |
|
65 | - if (empty($url)) $url=DOL_URL_ROOT.'/ecm/index.php'; |
|
64 | + if ($selecteddir != '/') $selecteddir = preg_replace('/\/$/', '', $selecteddir); // We removed last '/' except if it is '/' |
|
65 | + if (empty($url)) $url = DOL_URL_ROOT.'/ecm/index.php'; |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | // Load translation files required by the page |
69 | 69 | $langs->load("ecm"); |
70 | 70 | |
71 | 71 | // Define fullpathselecteddir. |
72 | -$fullpathselecteddir='<none>'; |
|
72 | +$fullpathselecteddir = '<none>'; |
|
73 | 73 | if ($modulepart == 'ecm') |
74 | 74 | { |
75 | - $fullpathselecteddir=$conf->ecm->dir_output.'/'.($selecteddir != '/' ? $selecteddir : ''); |
|
76 | - $fullpathpreopened=$conf->ecm->dir_output.'/'.($preopened != '/' ? $preopened : ''); |
|
75 | + $fullpathselecteddir = $conf->ecm->dir_output.'/'.($selecteddir != '/' ? $selecteddir : ''); |
|
76 | + $fullpathpreopened = $conf->ecm->dir_output.'/'.($preopened != '/' ? $preopened : ''); |
|
77 | 77 | } |
78 | 78 | elseif ($modulepart == 'medias') |
79 | 79 | { |
80 | - $fullpathselecteddir=$dolibarr_main_data_root.'/medias/'.($selecteddir != '/' ? $selecteddir : ''); |
|
81 | - $fullpathpreopened=$dolibarr_main_data_root.'/medias/'.($preopened != '/' ? $preopened : ''); |
|
80 | + $fullpathselecteddir = $dolibarr_main_data_root.'/medias/'.($selecteddir != '/' ? $selecteddir : ''); |
|
81 | + $fullpathpreopened = $dolibarr_main_data_root.'/medias/'.($preopened != '/' ? $preopened : ''); |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | |
85 | 85 | // Security: |
86 | 86 | // On interdit les remontees de repertoire ainsi que les pipe dans les noms de fichiers. |
87 | -if (preg_match('/\.\./',$fullpathselecteddir) || preg_match('/[<>|]/',$fullpathselecteddir)) |
|
87 | +if (preg_match('/\.\./', $fullpathselecteddir) || preg_match('/[<>|]/', $fullpathselecteddir)) |
|
88 | 88 | { |
89 | 89 | dol_syslog("Refused to deliver file ".$original_file); |
90 | 90 | // Do no show plain path in shown error message |
91 | - dol_print_error(0,$langs->trans("ErrorFileNameInvalid",GETPOST("file"))); |
|
91 | + dol_print_error(0, $langs->trans("ErrorFileNameInvalid", GETPOST("file"))); |
|
92 | 92 | exit; |
93 | 93 | } |
94 | 94 | |
95 | 95 | // Check permissions |
96 | 96 | if ($modulepart == 'ecm') |
97 | 97 | { |
98 | - if (! $user->rights->ecm->read) accessforbidden(); |
|
98 | + if (!$user->rights->ecm->read) accessforbidden(); |
|
99 | 99 | } |
100 | 100 | elseif ($modulepart == 'medias') |
101 | 101 | { |
@@ -107,22 +107,22 @@ discard block |
||
107 | 107 | * View |
108 | 108 | */ |
109 | 109 | |
110 | -if (! isset($mode) || $mode != 'noajax') // if ajax mode |
|
110 | +if (!isset($mode) || $mode != 'noajax') // if ajax mode |
|
111 | 111 | { |
112 | 112 | top_httphead(); |
113 | 113 | } |
114 | 114 | |
115 | 115 | //print '<!-- selecteddir (relative dir we click on) = '.$selecteddir.', openeddir = '.$openeddir.', modulepart='.$modulepart.', preopened='.$preopened.' -->'."\n"; |
116 | -$userstatic=new User($db); |
|
117 | -$form=new Form($db); |
|
116 | +$userstatic = new User($db); |
|
117 | +$form = new Form($db); |
|
118 | 118 | $ecmdirstatic = new EcmDirectory($db); |
119 | 119 | |
120 | 120 | // Load full tree of ECM module from database. We will use it to define nbofsubdir and nboffilesinsubdir |
121 | -if (empty($sqltree)) $sqltree=$ecmdirstatic->get_full_arbo(0); |
|
121 | +if (empty($sqltree)) $sqltree = $ecmdirstatic->get_full_arbo(0); |
|
122 | 122 | |
123 | 123 | // Try to find selected dir id into $sqltree and save it into $current_ecmdir_id |
124 | -$current_ecmdir_id=-1; |
|
125 | -foreach($sqltree as $keycursor => $val) |
|
124 | +$current_ecmdir_id = -1; |
|
125 | +foreach ($sqltree as $keycursor => $val) |
|
126 | 126 | { |
127 | 127 | //print $val['fullrelativename']." == ".$selecteddir; |
128 | 128 | if ($val['fullrelativename'] == $selecteddir) |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | } |
132 | 132 | } |
133 | 133 | |
134 | -if (! empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_JS)) |
|
134 | +if (!empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_JS)) |
|
135 | 135 | { |
136 | 136 | treeOutputForAbsoluteDir($sqltree, $selecteddir, $fullpathselecteddir, $modulepart, $websitekey, $pageid, $preopened, $fullpathpreopened); |
137 | 137 | |
@@ -159,115 +159,115 @@ discard block |
||
159 | 159 | } |
160 | 160 | |
161 | 161 | |
162 | -if (empty($conf->use_javascript_ajax) || ! empty($conf->global->MAIN_ECM_DISABLE_JS)) |
|
162 | +if (empty($conf->use_javascript_ajax) || !empty($conf->global->MAIN_ECM_DISABLE_JS)) |
|
163 | 163 | { |
164 | 164 | print '<ul class="ecmjqft">'; |
165 | 165 | |
166 | 166 | // Load full tree from database. We will use it to define nbofsubdir and nboffilesinsubdir |
167 | - if (empty($sqltree)) $sqltree=$ecmdirstatic->get_full_arbo(0); // Slow |
|
167 | + if (empty($sqltree)) $sqltree = $ecmdirstatic->get_full_arbo(0); // Slow |
|
168 | 168 | |
169 | 169 | // ----- This section will show a tree from a fulltree array ----- |
170 | 170 | // $section must also be defined |
171 | 171 | // ---------------------------------------------------------------- |
172 | 172 | |
173 | 173 | // Define fullpathselected ( _x_y_z ) of $section parameter (!! not into ajaxdirtree) |
174 | - $fullpathselected=''; |
|
175 | - foreach($sqltree as $key => $val) |
|
174 | + $fullpathselected = ''; |
|
175 | + foreach ($sqltree as $key => $val) |
|
176 | 176 | { |
177 | 177 | //print $val['id']."-".$section."<br>"; |
178 | 178 | if ($val['id'] == $section) |
179 | 179 | { |
180 | - $fullpathselected=$val['fullpath']; |
|
180 | + $fullpathselected = $val['fullpath']; |
|
181 | 181 | break; |
182 | 182 | } |
183 | 183 | } |
184 | 184 | //print "fullpathselected=".$fullpathselected."<br>"; |
185 | 185 | |
186 | 186 | // Update expandedsectionarray in session |
187 | - $expandedsectionarray=array(); |
|
188 | - if (isset($_SESSION['dol_ecmexpandedsectionarray'])) $expandedsectionarray=explode(',',$_SESSION['dol_ecmexpandedsectionarray']); |
|
187 | + $expandedsectionarray = array(); |
|
188 | + if (isset($_SESSION['dol_ecmexpandedsectionarray'])) $expandedsectionarray = explode(',', $_SESSION['dol_ecmexpandedsectionarray']); |
|
189 | 189 | |
190 | 190 | if ($section && GETPOST('sectionexpand') == 'true') |
191 | 191 | { |
192 | 192 | // We add all sections that are parent of opened section |
193 | - $pathtosection=explode('_',$fullpathselected); |
|
194 | - foreach($pathtosection as $idcursor) |
|
193 | + $pathtosection = explode('_', $fullpathselected); |
|
194 | + foreach ($pathtosection as $idcursor) |
|
195 | 195 | { |
196 | - if ($idcursor && ! in_array($idcursor,$expandedsectionarray)) // Not already in array |
|
196 | + if ($idcursor && !in_array($idcursor, $expandedsectionarray)) // Not already in array |
|
197 | 197 | { |
198 | - $expandedsectionarray[]=$idcursor; |
|
198 | + $expandedsectionarray[] = $idcursor; |
|
199 | 199 | } |
200 | 200 | } |
201 | - $_SESSION['dol_ecmexpandedsectionarray']=join(',',$expandedsectionarray); |
|
201 | + $_SESSION['dol_ecmexpandedsectionarray'] = join(',', $expandedsectionarray); |
|
202 | 202 | } |
203 | 203 | if ($section && GETPOST('sectionexpand') == 'false') |
204 | 204 | { |
205 | 205 | // We removed all expanded sections that are child of the closed section |
206 | - $oldexpandedsectionarray=$expandedsectionarray; |
|
207 | - $expandedsectionarray=array(); // Reset |
|
208 | - foreach($oldexpandedsectionarray as $sectioncursor) |
|
206 | + $oldexpandedsectionarray = $expandedsectionarray; |
|
207 | + $expandedsectionarray = array(); // Reset |
|
208 | + foreach ($oldexpandedsectionarray as $sectioncursor) |
|
209 | 209 | { |
210 | 210 | // TODO is_in_subtree(fulltree,sectionparent,sectionchild) does nox exists. Enable or remove this... |
211 | 211 | //if ($sectioncursor && ! is_in_subtree($sqltree,$section,$sectioncursor)) $expandedsectionarray[]=$sectioncursor; |
212 | 212 | } |
213 | - $_SESSION['dol_ecmexpandedsectionarray']=join(',',$expandedsectionarray); |
|
213 | + $_SESSION['dol_ecmexpandedsectionarray'] = join(',', $expandedsectionarray); |
|
214 | 214 | } |
215 | 215 | //print $_SESSION['dol_ecmexpandedsectionarray'].'<br>'; |
216 | 216 | |
217 | - $nbofentries=0; |
|
218 | - $oldvallevel=0; |
|
219 | - foreach($sqltree as $key => $val) |
|
217 | + $nbofentries = 0; |
|
218 | + $oldvallevel = 0; |
|
219 | + foreach ($sqltree as $key => $val) |
|
220 | 220 | { |
221 | 221 | |
222 | - $ecmdirstatic->id=$val['id']; |
|
223 | - $ecmdirstatic->ref=$val['label']; |
|
222 | + $ecmdirstatic->id = $val['id']; |
|
223 | + $ecmdirstatic->ref = $val['label']; |
|
224 | 224 | |
225 | 225 | // Refresh cache |
226 | - if (preg_match('/refresh/i',$action)) |
|
226 | + if (preg_match('/refresh/i', $action)) |
|
227 | 227 | { |
228 | - $result=$ecmdirstatic->fetch($val['id']); |
|
229 | - $ecmdirstatic->ref=$ecmdirstatic->label; |
|
228 | + $result = $ecmdirstatic->fetch($val['id']); |
|
229 | + $ecmdirstatic->ref = $ecmdirstatic->label; |
|
230 | 230 | |
231 | - $result=$ecmdirstatic->refreshcachenboffile(0); |
|
232 | - $val['cachenbofdoc']=$result; |
|
231 | + $result = $ecmdirstatic->refreshcachenboffile(0); |
|
232 | + $val['cachenbofdoc'] = $result; |
|
233 | 233 | } |
234 | 234 | |
235 | 235 | //$fullpathparent=preg_replace('/(_[^_]+)$/i','',$val['fullpath']); |
236 | 236 | |
237 | 237 | // Define showline |
238 | - $showline=0; |
|
238 | + $showline = 0; |
|
239 | 239 | |
240 | 240 | // If directory is son of expanded directory, we show line |
241 | - if (in_array($val['id_mere'],$expandedsectionarray)) $showline=4; |
|
241 | + if (in_array($val['id_mere'], $expandedsectionarray)) $showline = 4; |
|
242 | 242 | // If directory is brother of selected directory, we show line |
243 | - elseif ($val['id'] != $section && $val['id_mere'] == $ecmdirstatic->motherof[$section]) $showline=3; |
|
243 | + elseif ($val['id'] != $section && $val['id_mere'] == $ecmdirstatic->motherof[$section]) $showline = 3; |
|
244 | 244 | // If directory is parent of selected directory or is selected directory, we show line |
245 | - elseif (preg_match('/'.$val['fullpath'].'_/i',$fullpathselected.'_')) $showline=2; |
|
245 | + elseif (preg_match('/'.$val['fullpath'].'_/i', $fullpathselected.'_')) $showline = 2; |
|
246 | 246 | // If we are level one we show line |
247 | - elseif ($val['level'] < 2) $showline=1; |
|
247 | + elseif ($val['level'] < 2) $showline = 1; |
|
248 | 248 | |
249 | 249 | if ($showline) |
250 | 250 | { |
251 | - if (in_array($val['id'],$expandedsectionarray)) $option='indexexpanded'; |
|
252 | - else $option='indexnotexpanded'; |
|
251 | + if (in_array($val['id'], $expandedsectionarray)) $option = 'indexexpanded'; |
|
252 | + else $option = 'indexnotexpanded'; |
|
253 | 253 | //print $option; |
254 | 254 | |
255 | 255 | print '<li class="directory collapsed">'; |
256 | 256 | |
257 | 257 | // Show tree graph pictos |
258 | - $cpt=1; |
|
258 | + $cpt = 1; |
|
259 | 259 | while ($cpt < $sqltree[$key]['level']) |
260 | 260 | { |
261 | 261 | print ' '; |
262 | 262 | $cpt++; |
263 | 263 | } |
264 | - $resarray=tree_showpad($sqltree,$key,1); |
|
265 | - $a=$resarray[0]; |
|
266 | - $nbofsubdir=$resarray[1]; |
|
267 | - $nboffilesinsubdir=$resarray[2]; |
|
264 | + $resarray = tree_showpad($sqltree, $key, 1); |
|
265 | + $a = $resarray[0]; |
|
266 | + $nbofsubdir = $resarray[1]; |
|
267 | + $nboffilesinsubdir = $resarray[2]; |
|
268 | 268 | |
269 | 269 | // Show link |
270 | - print $ecmdirstatic->getNomUrl(0,$option,32,'class="fmdirlia jqft ecmjqft"'); |
|
270 | + print $ecmdirstatic->getNomUrl(0, $option, 32, 'class="fmdirlia jqft ecmjqft"'); |
|
271 | 271 | |
272 | 272 | print '<div class="ecmjqft">'; |
273 | 273 | |
@@ -281,16 +281,16 @@ discard block |
||
281 | 281 | |
282 | 282 | // Info |
283 | 283 | print '<td align="center">'; |
284 | - $userstatic->id=$val['fk_user_c']; |
|
285 | - $userstatic->lastname=$val['login_c']; |
|
286 | - $htmltooltip='<b>'.$langs->trans("ECMSection").'</b>: '.$val['label'].'<br>'; |
|
287 | - $htmltooltip='<b>'.$langs->trans("Type").'</b>: '.$langs->trans("ECMSectionManual").'<br>'; |
|
288 | - $htmltooltip.='<b>'.$langs->trans("ECMCreationUser").'</b>: '.$userstatic->getNomUrl(1, '', false, 1).'<br>'; |
|
289 | - $htmltooltip.='<b>'.$langs->trans("ECMCreationDate").'</b>: '.dol_print_date($val['date_c'],"dayhour").'<br>'; |
|
290 | - $htmltooltip.='<b>'.$langs->trans("Description").'</b>: '.$val['description'].'<br>'; |
|
291 | - $htmltooltip.='<b>'.$langs->trans("ECMNbOfFilesInDir").'</b>: '.$val['cachenbofdoc'].'<br>'; |
|
292 | - if ($nbofsubdir) $htmltooltip.='<b>'.$langs->trans("ECMNbOfFilesInSubDir").'</b>: '.$nboffilesinsubdir; |
|
293 | - else $htmltooltip.='<b>'.$langs->trans("ECMNbOfSubDir").'</b>: '.$nbofsubdir.'<br>'; |
|
284 | + $userstatic->id = $val['fk_user_c']; |
|
285 | + $userstatic->lastname = $val['login_c']; |
|
286 | + $htmltooltip = '<b>'.$langs->trans("ECMSection").'</b>: '.$val['label'].'<br>'; |
|
287 | + $htmltooltip = '<b>'.$langs->trans("Type").'</b>: '.$langs->trans("ECMSectionManual").'<br>'; |
|
288 | + $htmltooltip .= '<b>'.$langs->trans("ECMCreationUser").'</b>: '.$userstatic->getNomUrl(1, '', false, 1).'<br>'; |
|
289 | + $htmltooltip .= '<b>'.$langs->trans("ECMCreationDate").'</b>: '.dol_print_date($val['date_c'], "dayhour").'<br>'; |
|
290 | + $htmltooltip .= '<b>'.$langs->trans("Description").'</b>: '.$val['description'].'<br>'; |
|
291 | + $htmltooltip .= '<b>'.$langs->trans("ECMNbOfFilesInDir").'</b>: '.$val['cachenbofdoc'].'<br>'; |
|
292 | + if ($nbofsubdir) $htmltooltip .= '<b>'.$langs->trans("ECMNbOfFilesInSubDir").'</b>: '.$nboffilesinsubdir; |
|
293 | + else $htmltooltip .= '<b>'.$langs->trans("ECMNbOfSubDir").'</b>: '.$nbofsubdir.'<br>'; |
|
294 | 294 | print $form->textwithpicto('', $htmltooltip, 1, 'info'); |
295 | 295 | print "</td>"; |
296 | 296 | |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | print "</li>\n"; |
302 | 302 | } |
303 | 303 | |
304 | - $oldvallevel=$val['level']; |
|
304 | + $oldvallevel = $val['level']; |
|
305 | 305 | $nbofentries++; |
306 | 306 | } |
307 | 307 | |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | |
321 | 321 | |
322 | 322 | // Close db if mode is not noajax |
323 | -if ((! isset($mode) || $mode != 'noajax') && is_object($db)) $db->close(); |
|
323 | +if ((!isset($mode) || $mode != 'noajax') && is_object($db)) $db->close(); |
|
324 | 324 | |
325 | 325 | |
326 | 326 | |
@@ -338,7 +338,7 @@ discard block |
||
338 | 338 | * @param int $depth Depth |
339 | 339 | * @return void |
340 | 340 | */ |
341 | -function treeOutputForAbsoluteDir($sqltree, $selecteddir, $fullpathselecteddir, $modulepart, $websitekey, $pageid, $preopened, $fullpathpreopened, $depth=0) |
|
341 | +function treeOutputForAbsoluteDir($sqltree, $selecteddir, $fullpathselecteddir, $modulepart, $websitekey, $pageid, $preopened, $fullpathpreopened, $depth = 0) |
|
342 | 342 | { |
343 | 343 | global $conf, $db, $langs, $form; |
344 | 344 | global $dolibarr_main_data_root; |
@@ -350,7 +350,7 @@ discard block |
||
350 | 350 | { |
351 | 351 | $files = @scandir($fullpathselecteddir); |
352 | 352 | |
353 | - if (! empty($files)) |
|
353 | + if (!empty($files)) |
|
354 | 354 | { |
355 | 355 | natcasesort($files); |
356 | 356 | if (count($files) > 2) /* The 2 accounts for . and .. */ |
@@ -362,56 +362,56 @@ discard block |
||
362 | 362 | { |
363 | 363 | if ($file == 'temp') continue; |
364 | 364 | |
365 | - $nbofsubdir=0; |
|
366 | - $nboffilesinsubdir=0; |
|
365 | + $nbofsubdir = 0; |
|
366 | + $nboffilesinsubdir = 0; |
|
367 | 367 | |
368 | - $val=array(); |
|
368 | + $val = array(); |
|
369 | 369 | |
370 | 370 | // Loop on all database entries (sqltree) to find the one matching the subdir found into dir to scan |
371 | - foreach($sqltree as $key => $tmpval) |
|
371 | + foreach ($sqltree as $key => $tmpval) |
|
372 | 372 | { |
373 | 373 | //print "-- key=".$key." - ".$tmpval['fullrelativename']." vs ".(($selecteddir != '/'?$selecteddir.'/':'').$file)."<br>\n"; |
374 | - if ($tmpval['fullrelativename'] == (($selecteddir != '/'?$selecteddir.'/':'').$file)) // We found equivalent record into database |
|
374 | + if ($tmpval['fullrelativename'] == (($selecteddir != '/' ? $selecteddir.'/' : '').$file)) // We found equivalent record into database |
|
375 | 375 | { |
376 | - $val=$tmpval; |
|
377 | - $resarray=tree_showpad($sqltree,$key,1); |
|
376 | + $val = $tmpval; |
|
377 | + $resarray = tree_showpad($sqltree, $key, 1); |
|
378 | 378 | |
379 | 379 | // Refresh cache for this subdir |
380 | 380 | if (isset($val['cachenbofdoc']) && $val['cachenbofdoc'] < 0) // Cache is not up to date, so we update it for this directory t |
381 | 381 | { |
382 | - $result=$ecmdirstatic->fetch($val['id']); |
|
383 | - $ecmdirstatic->ref=$ecmdirstatic->label; |
|
382 | + $result = $ecmdirstatic->fetch($val['id']); |
|
383 | + $ecmdirstatic->ref = $ecmdirstatic->label; |
|
384 | 384 | |
385 | - $result=$ecmdirstatic->refreshcachenboffile(0); |
|
386 | - $val['cachenbofdoc']=$result; |
|
385 | + $result = $ecmdirstatic->refreshcachenboffile(0); |
|
386 | + $val['cachenbofdoc'] = $result; |
|
387 | 387 | } |
388 | 388 | |
389 | - $a=$resarray[0]; |
|
390 | - $nbofsubdir=$resarray[1]; |
|
391 | - $nboffilesinsubdir=$resarray[2]; |
|
389 | + $a = $resarray[0]; |
|
390 | + $nbofsubdir = $resarray[1]; |
|
391 | + $nboffilesinsubdir = $resarray[2]; |
|
392 | 392 | break; |
393 | 393 | } |
394 | 394 | } |
395 | 395 | |
396 | 396 | //print 'modulepart='.$modulepart.' fullpathselecteddir='.$fullpathselecteddir.' - val[fullrelativename] (in database)='.$val['fullrelativename'].' - val[id]='.$val['id'].' - is_dir='.dol_is_dir($fullpathselecteddir . $file).' - file='.$file."\n"; |
397 | - if ($file != '.' && $file != '..' && ((! empty($val['fullrelativename']) && $val['id'] >= 0) || dol_is_dir($fullpathselecteddir . (preg_match('/\/$/',$fullpathselecteddir)?'':'/') . $file))) |
|
397 | + if ($file != '.' && $file != '..' && ((!empty($val['fullrelativename']) && $val['id'] >= 0) || dol_is_dir($fullpathselecteddir.(preg_match('/\/$/', $fullpathselecteddir) ? '' : '/').$file))) |
|
398 | 398 | { |
399 | 399 | if (empty($val['fullrelativename'])) // If we did not find entry into database, but found a directory (dol_is_dir was ok at previous test) |
400 | 400 | { |
401 | - $val['fullrelativename']=(($selecteddir && $selecteddir != '/')?$selecteddir.'/':'').$file; |
|
402 | - $val['id']=0; |
|
403 | - $val['label']=$file; |
|
404 | - $val['description']=''; |
|
405 | - $nboffilesinsubdir=$langs->trans("Unknown"); |
|
401 | + $val['fullrelativename'] = (($selecteddir && $selecteddir != '/') ? $selecteddir.'/' : '').$file; |
|
402 | + $val['id'] = 0; |
|
403 | + $val['label'] = $file; |
|
404 | + $val['description'] = ''; |
|
405 | + $nboffilesinsubdir = $langs->trans("Unknown"); |
|
406 | 406 | } |
407 | 407 | |
408 | - $collapsedorexpanded='collapsed'; |
|
409 | - if (preg_match('/^'.preg_quote($val['fullrelativename'].'/', '/').'/', $preopened)) $collapsedorexpanded='expanded'; |
|
410 | - print '<li class="directory '.$collapsedorexpanded.'">'; // collapsed is opposite if expanded |
|
408 | + $collapsedorexpanded = 'collapsed'; |
|
409 | + if (preg_match('/^'.preg_quote($val['fullrelativename'].'/', '/').'/', $preopened)) $collapsedorexpanded = 'expanded'; |
|
410 | + print '<li class="directory '.$collapsedorexpanded.'">'; // collapsed is opposite if expanded |
|
411 | 411 | |
412 | 412 | print "<a class=\"fmdirlia jqft ecmjqft\" href=\""; |
413 | 413 | print "#"; |
414 | - print "\" rel=\"" . dol_escape_htmltag($val['fullrelativename'].'/') . "\" id=\"fmdirlia_id_".$val['id']."\""; |
|
414 | + print "\" rel=\"".dol_escape_htmltag($val['fullrelativename'].'/')."\" id=\"fmdirlia_id_".$val['id']."\""; |
|
415 | 415 | print " onClick=\"loadandshowpreview('".dol_escape_js($val['fullrelativename'])."',".$val['id'].")"; |
416 | 416 | print "\">"; |
417 | 417 | print dol_escape_htmltag($file); |
@@ -427,10 +427,10 @@ discard block |
||
427 | 427 | |
428 | 428 | // Nb of docs |
429 | 429 | print '<td align="right">'; |
430 | - print (isset($val['cachenbofdoc']) && $val['cachenbofdoc'] >= 0)?$val['cachenbofdoc']:' '; |
|
430 | + print (isset($val['cachenbofdoc']) && $val['cachenbofdoc'] >= 0) ? $val['cachenbofdoc'] : ' '; |
|
431 | 431 | print '</td>'; |
432 | 432 | print '<td align="left">'; |
433 | - if ($nbofsubdir > 0 && $nboffilesinsubdir > 0) print '<font color="#AAAAAA">+'.$nboffilesinsubdir.'</font> '; |
|
433 | + if ($nbofsubdir > 0 && $nboffilesinsubdir > 0) print '<font color="#AAAAAA">+'.$nboffilesinsubdir.'</font> '; |
|
434 | 434 | print '</td>'; |
435 | 435 | |
436 | 436 | // Edit link |
@@ -447,17 +447,17 @@ discard block |
||
447 | 447 | if ($modulepart == 'ecm') |
448 | 448 | { |
449 | 449 | print '<td align="right" width="18">'; |
450 | - $userstatic->id=isset($val['fk_user_c'])?$val['fk_user_c']:0; |
|
451 | - $userstatic->lastname=isset($val['login_c'])?$val['login_c']:0; |
|
452 | - $htmltooltip='<b>'.$langs->trans("ECMSection").'</b>: '.$val['label'].'<br>'; |
|
453 | - $htmltooltip='<b>'.$langs->trans("Type").'</b>: '.$langs->trans("ECMSectionManual").'<br>'; |
|
454 | - $htmltooltip.='<b>'.$langs->trans("ECMCreationUser").'</b>: '.$userstatic->getNomUrl(1, '', false, 1).'<br>'; |
|
455 | - $htmltooltip.='<b>'.$langs->trans("ECMCreationDate").'</b>: '.(isset($val['date_c'])?dol_print_date($val['date_c'],"dayhour"):$langs->trans("NeedRefresh")).'<br>'; |
|
456 | - $htmltooltip.='<b>'.$langs->trans("Description").'</b>: '.$val['description'].'<br>'; |
|
457 | - $htmltooltip.='<b>'.$langs->trans("ECMNbOfFilesInDir").'</b>: '.((isset($val['cachenbofdoc']) && $val['cachenbofdoc'] >= 0)?$val['cachenbofdoc']:$langs->trans("NeedRefresh")).'<br>'; |
|
458 | - if ($nboffilesinsubdir > 0) $htmltooltip.='<b>'.$langs->trans("ECMNbOfFilesInSubDir").'</b>: '.$nboffilesinsubdir; |
|
459 | - else $htmltooltip.='<b>'.$langs->trans("ECMNbOfSubDir").'</b>: '.($nbofsubdir >= 0 ? $nbofsubdir : $langs->trans("NeedRefresh")).'<br>'; |
|
460 | - print $form->textwithpicto('',$htmltooltip,1,"info"); |
|
450 | + $userstatic->id = isset($val['fk_user_c']) ? $val['fk_user_c'] : 0; |
|
451 | + $userstatic->lastname = isset($val['login_c']) ? $val['login_c'] : 0; |
|
452 | + $htmltooltip = '<b>'.$langs->trans("ECMSection").'</b>: '.$val['label'].'<br>'; |
|
453 | + $htmltooltip = '<b>'.$langs->trans("Type").'</b>: '.$langs->trans("ECMSectionManual").'<br>'; |
|
454 | + $htmltooltip .= '<b>'.$langs->trans("ECMCreationUser").'</b>: '.$userstatic->getNomUrl(1, '', false, 1).'<br>'; |
|
455 | + $htmltooltip .= '<b>'.$langs->trans("ECMCreationDate").'</b>: '.(isset($val['date_c']) ?dol_print_date($val['date_c'], "dayhour") : $langs->trans("NeedRefresh")).'<br>'; |
|
456 | + $htmltooltip .= '<b>'.$langs->trans("Description").'</b>: '.$val['description'].'<br>'; |
|
457 | + $htmltooltip .= '<b>'.$langs->trans("ECMNbOfFilesInDir").'</b>: '.((isset($val['cachenbofdoc']) && $val['cachenbofdoc'] >= 0) ? $val['cachenbofdoc'] : $langs->trans("NeedRefresh")).'<br>'; |
|
458 | + if ($nboffilesinsubdir > 0) $htmltooltip .= '<b>'.$langs->trans("ECMNbOfFilesInSubDir").'</b>: '.$nboffilesinsubdir; |
|
459 | + else $htmltooltip .= '<b>'.$langs->trans("ECMNbOfSubDir").'</b>: '.($nbofsubdir >= 0 ? $nbofsubdir : $langs->trans("NeedRefresh")).'<br>'; |
|
460 | + print $form->textwithpicto('', $htmltooltip, 1, "info"); |
|
461 | 461 | print "</td>"; |
462 | 462 | } |
463 | 463 | |
@@ -469,17 +469,17 @@ discard block |
||
469 | 469 | { |
470 | 470 | //print 'modulepart='.$modulepart.' fullpathselecteddir='.$fullpathselecteddir.' - val[fullrelativename] (in database)='.$val['fullrelativename'].' - val[id]='.$val['id'].' - is_dir='.dol_is_dir($fullpathselecteddir . $file).' - file='.$file."\n"; |
471 | 471 | $newselecteddir = $val['fullrelativename']; |
472 | - $newfullpathselecteddir=''; |
|
472 | + $newfullpathselecteddir = ''; |
|
473 | 473 | if ($modulepart == 'ecm') |
474 | 474 | { |
475 | - $newfullpathselecteddir=$conf->ecm->dir_output.'/'.($val['fullrelativename'] != '/' ? $val['fullrelativename'] : ''); |
|
475 | + $newfullpathselecteddir = $conf->ecm->dir_output.'/'.($val['fullrelativename'] != '/' ? $val['fullrelativename'] : ''); |
|
476 | 476 | } |
477 | 477 | elseif ($modulepart == 'medias') |
478 | 478 | { |
479 | - $newfullpathselecteddir=$dolibarr_main_data_root.'/medias/'.($val['fullrelativename'] != '/' ? $val['fullrelativename'] : ''); |
|
479 | + $newfullpathselecteddir = $dolibarr_main_data_root.'/medias/'.($val['fullrelativename'] != '/' ? $val['fullrelativename'] : ''); |
|
480 | 480 | } |
481 | 481 | |
482 | - if ($newfullpathselecteddir) treeOutputForAbsoluteDir($sqltree, $newselecteddir, $newfullpathselecteddir, $modulepart, $websitekey, $pageid, $preopened, $fullpathpreopened, $depth+1); |
|
482 | + if ($newfullpathselecteddir) treeOutputForAbsoluteDir($sqltree, $newselecteddir, $newfullpathselecteddir, $modulepart, $websitekey, $pageid, $preopened, $fullpathpreopened, $depth + 1); |
|
483 | 483 | } |
484 | 484 | |
485 | 485 | print "</li>\n"; |
@@ -27,42 +27,42 @@ discard block |
||
27 | 27 | * ajaxdirpreview.php?mode=nojs&action=preview&module=ecm§ion=0&file=xxx |
28 | 28 | */ |
29 | 29 | |
30 | -if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL',1); // Disables token renewal |
|
31 | -if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); |
|
32 | -if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1'); |
|
33 | -if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); |
|
30 | +if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', 1); // Disables token renewal |
|
31 | +if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); |
|
32 | +if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); |
|
33 | +if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); |
|
34 | 34 | |
35 | -if (! isset($mode) || $mode != 'noajax') // For ajax call |
|
35 | +if (!isset($mode) || $mode != 'noajax') // For ajax call |
|
36 | 36 | { |
37 | 37 | require_once '../../main.inc.php'; |
38 | 38 | require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
39 | 39 | require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; |
40 | 40 | require_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmdirectory.class.php'; |
41 | 41 | |
42 | - $action=GETPOST('action','aZ09'); |
|
43 | - $file=urldecode(GETPOST('file','alpha')); |
|
44 | - $section=GETPOST("section",'alpha'); |
|
45 | - $module=GETPOST("module",'alpha'); |
|
46 | - $urlsource=GETPOST("urlsource",'alpha'); |
|
47 | - $search_doc_ref=GETPOST('search_doc_ref','alpha'); |
|
42 | + $action = GETPOST('action', 'aZ09'); |
|
43 | + $file = urldecode(GETPOST('file', 'alpha')); |
|
44 | + $section = GETPOST("section", 'alpha'); |
|
45 | + $module = GETPOST("module", 'alpha'); |
|
46 | + $urlsource = GETPOST("urlsource", 'alpha'); |
|
47 | + $search_doc_ref = GETPOST('search_doc_ref', 'alpha'); |
|
48 | 48 | |
49 | - $sortfield = GETPOST("sortfield",'alpha'); |
|
50 | - $sortorder = GETPOST("sortorder",'alpha'); |
|
51 | - $page = GETPOST("page",'int'); |
|
49 | + $sortfield = GETPOST("sortfield", 'alpha'); |
|
50 | + $sortorder = GETPOST("sortorder", 'alpha'); |
|
51 | + $page = GETPOST("page", 'int'); |
|
52 | 52 | if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1 |
53 | 53 | $offset = $conf->liste_limit * $page; |
54 | 54 | $pageprev = $page - 1; |
55 | 55 | $pagenext = $page + 1; |
56 | - if (! $sortorder) $sortorder="ASC"; |
|
57 | - if (! $sortfield) $sortfield="name"; |
|
56 | + if (!$sortorder) $sortorder = "ASC"; |
|
57 | + if (!$sortfield) $sortfield = "name"; |
|
58 | 58 | |
59 | 59 | $rootdirfordoc = $conf->ecm->dir_output; |
60 | 60 | |
61 | 61 | $upload_dir = dirname(str_replace("../", "/", $rootdirfordoc.'/'.$file)); |
62 | 62 | |
63 | 63 | $ecmdir = new EcmDirectory($db); |
64 | - $result=$ecmdir->fetch($section); |
|
65 | - if (! $result > 0) |
|
64 | + $result = $ecmdir->fetch($section); |
|
65 | + if (!$result > 0) |
|
66 | 66 | { |
67 | 67 | //dol_print_error($db,$ecmdir->error); |
68 | 68 | //exit; |
@@ -73,21 +73,21 @@ discard block |
||
73 | 73 | $rootdirfordoc = $conf->ecm->dir_output; |
74 | 74 | |
75 | 75 | $ecmdir = new EcmDirectory($db); |
76 | - $relativepath=''; |
|
76 | + $relativepath = ''; |
|
77 | 77 | if ($section > 0) |
78 | 78 | { |
79 | - $result=$ecmdir->fetch($section); |
|
80 | - if (! $result > 0) |
|
79 | + $result = $ecmdir->fetch($section); |
|
80 | + if (!$result > 0) |
|
81 | 81 | { |
82 | - dol_print_error($db,$ecmdir->error); |
|
82 | + dol_print_error($db, $ecmdir->error); |
|
83 | 83 | exit; |
84 | 84 | } |
85 | 85 | |
86 | - $relativepath=$ecmdir->getRelativePath(); // Example 'mydir/' |
|
86 | + $relativepath = $ecmdir->getRelativePath(); // Example 'mydir/' |
|
87 | 87 | } |
88 | 88 | elseif (GETPOST('section_dir')) |
89 | 89 | { |
90 | - $relativepath=GETPOST('section_dir'); |
|
90 | + $relativepath = GETPOST('section_dir'); |
|
91 | 91 | } |
92 | 92 | //var_dump($section.'-'.GETPOST('section_dir').'-'.$relativepath); |
93 | 93 | |
@@ -96,12 +96,12 @@ discard block |
||
96 | 96 | |
97 | 97 | if (empty($url)) |
98 | 98 | { |
99 | - if (GETPOSTISSET('website')) $url=DOL_URL_ROOT.'/website/index.php'; |
|
100 | - else $url=DOL_URL_ROOT.'/ecm/index.php'; |
|
99 | + if (GETPOSTISSET('website')) $url = DOL_URL_ROOT.'/website/index.php'; |
|
100 | + else $url = DOL_URL_ROOT.'/ecm/index.php'; |
|
101 | 101 | } |
102 | 102 | |
103 | 103 | // Load translation files required by the page |
104 | -$langs->loadLangs(array("ecm","companies","other")); |
|
104 | +$langs->loadLangs(array("ecm", "companies", "other")); |
|
105 | 105 | |
106 | 106 | // Security check |
107 | 107 | if ($user->societe_id > 0) $socid = $user->societe_id; |
@@ -110,18 +110,18 @@ discard block |
||
110 | 110 | |
111 | 111 | // Security: |
112 | 112 | // On interdit les remontees de repertoire ainsi que les pipe dans les noms de fichiers. |
113 | -if (preg_match('/\.\./',$upload_dir) || preg_match('/[<>|]/',$upload_dir)) |
|
113 | +if (preg_match('/\.\./', $upload_dir) || preg_match('/[<>|]/', $upload_dir)) |
|
114 | 114 | { |
115 | 115 | dol_syslog("Refused to deliver file ".$upload_dir); |
116 | 116 | // Do no show plain path in shown error message |
117 | - dol_print_error(0,$langs->trans("ErrorFileNameInvalid",$upload_dir)); |
|
117 | + dol_print_error(0, $langs->trans("ErrorFileNameInvalid", $upload_dir)); |
|
118 | 118 | exit; |
119 | 119 | } |
120 | 120 | |
121 | 121 | // Check permissions |
122 | 122 | if ($modulepart == 'ecm') |
123 | 123 | { |
124 | - if (! $user->rights->ecm->read) accessforbidden(); |
|
124 | + if (!$user->rights->ecm->read) accessforbidden(); |
|
125 | 125 | } |
126 | 126 | if ($modulepart == 'medias') |
127 | 127 | { |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | * View |
142 | 142 | */ |
143 | 143 | |
144 | -if (! isset($mode) || $mode != 'noajax') |
|
144 | +if (!isset($mode) || $mode != 'noajax') |
|
145 | 145 | { |
146 | 146 | // Ajout directives pour resoudre bug IE |
147 | 147 | header('Cache-Control: Public, must-revalidate'); |
@@ -150,10 +150,10 @@ discard block |
||
150 | 150 | top_httphead(); |
151 | 151 | } |
152 | 152 | |
153 | -$type='directory'; |
|
153 | +$type = 'directory'; |
|
154 | 154 | |
155 | 155 | // This test if file exists should be useless. We keep it to find bug more easily |
156 | -if (! dol_is_dir($upload_dir)) |
|
156 | +if (!dol_is_dir($upload_dir)) |
|
157 | 157 | { |
158 | 158 | // dol_mkdir($upload_dir); |
159 | 159 | /* $langs->load("install"); |
@@ -164,19 +164,19 @@ discard block |
||
164 | 164 | print '<!-- ajaxdirpreview type='.$type.' -->'."\n"; |
165 | 165 | //print '<!-- Page called with mode='.dol_escape_htmltag(isset($mode)?$mode:'').' type='.dol_escape_htmltag($type).' module='.dol_escape_htmltag($module).' url='.dol_escape_htmltag($url).' '.dol_escape_htmltag($_SERVER["PHP_SELF"]).'?'.dol_escape_htmltag($_SERVER["QUERY_STRING"]).' -->'."\n"; |
166 | 166 | |
167 | -$param=($sortfield?'&sortfield='.$sortfield:'').($sortorder?'&sortorder='.$sortorder:''); |
|
168 | -if (! empty($websitekey)) $param.='&website='.$websitekey; |
|
169 | -if (! empty($pageid)) $param.='&pageid='.$pageid; |
|
167 | +$param = ($sortfield ? '&sortfield='.$sortfield : '').($sortorder ? '&sortorder='.$sortorder : ''); |
|
168 | +if (!empty($websitekey)) $param .= '&website='.$websitekey; |
|
169 | +if (!empty($pageid)) $param .= '&pageid='.$pageid; |
|
170 | 170 | |
171 | 171 | |
172 | 172 | // Dir scan |
173 | 173 | if ($type == 'directory') |
174 | 174 | { |
175 | - $formfile=new FormFile($db); |
|
175 | + $formfile = new FormFile($db); |
|
176 | 176 | |
177 | - $maxlengthname=40; |
|
178 | - $excludefiles = array('^SPECIMEN\.pdf$','^\.','(\.meta|_preview.*\.png)$','^temp$','^payments$','^CVS$','^thumbs$'); |
|
179 | - $sorting = (strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC); |
|
177 | + $maxlengthname = 40; |
|
178 | + $excludefiles = array('^SPECIMEN\.pdf$', '^\.', '(\.meta|_preview.*\.png)$', '^temp$', '^payments$', '^CVS$', '^thumbs$'); |
|
179 | + $sorting = (strtolower($sortorder) == 'desc' ?SORT_DESC:SORT_ASC); |
|
180 | 180 | |
181 | 181 | // Right area. If module is defined here, we are in automatic ecm. |
182 | 182 | $automodules = array('company', 'invoice', 'invoice_supplier', 'propal', 'supplier_proposal', 'order', 'order_supplier', 'contract', 'product', 'tax', 'project', 'fichinter', 'user', 'expensereport', 'holiday'); |
@@ -216,19 +216,19 @@ discard block |
||
216 | 216 | // Automatic list |
217 | 217 | if (in_array($module, $automodules)) |
218 | 218 | { |
219 | - $param.='&module='.$module; |
|
220 | - if (isset($search_doc_ref) && $search_doc_ref != '') $param.='&search_doc_ref='.$search_doc_ref; |
|
219 | + $param .= '&module='.$module; |
|
220 | + if (isset($search_doc_ref) && $search_doc_ref != '') $param .= '&search_doc_ref='.$search_doc_ref; |
|
221 | 221 | |
222 | - $textifempty=($section?$langs->trans("NoFileFound"):($showonrightsize=='featurenotyetavailable'?$langs->trans("FeatureNotYetAvailable"):$langs->trans("NoFileFound"))); |
|
222 | + $textifempty = ($section ? $langs->trans("NoFileFound") : ($showonrightsize == 'featurenotyetavailable' ? $langs->trans("FeatureNotYetAvailable") : $langs->trans("NoFileFound"))); |
|
223 | 223 | |
224 | - if ($module == 'company') $excludefiles[]='^contact$'; // The subdir 'contact' contains files of contacts with no id of thirdparty. |
|
224 | + if ($module == 'company') $excludefiles[] = '^contact$'; // The subdir 'contact' contains files of contacts with no id of thirdparty. |
|
225 | 225 | |
226 | - $filter=preg_quote($search_doc_ref, '/'); |
|
227 | - $filearray=dol_dir_list($upload_dir, "files", 1, $filter, $excludefiles, $sortfield, $sorting,1); |
|
226 | + $filter = preg_quote($search_doc_ref, '/'); |
|
227 | + $filearray = dol_dir_list($upload_dir, "files", 1, $filter, $excludefiles, $sortfield, $sorting, 1); |
|
228 | 228 | |
229 | - $perm=$user->rights->ecm->upload; |
|
229 | + $perm = $user->rights->ecm->upload; |
|
230 | 230 | |
231 | - $formfile->list_of_autoecmfiles($upload_dir,$filearray,$module,$param,1,'',$perm,1,$textifempty,$maxlengthname,$url,1); |
|
231 | + $formfile->list_of_autoecmfiles($upload_dir, $filearray, $module, $param, 1, '', $perm, 1, $textifempty, $maxlengthname, $url, 1); |
|
232 | 232 | } |
233 | 233 | // Manual list |
234 | 234 | else |
@@ -246,60 +246,60 @@ discard block |
||
246 | 246 | 'max_file_size' => string '2097152' (length=7) |
247 | 247 | 'sendit' => string 'Envoyer fichier' (length=15) |
248 | 248 | */ |
249 | - $relativepath=GETPOST('file','alpha')?GETPOST('file','alpha'):GETPOST('section_dir','alpha'); |
|
250 | - if ($relativepath && $relativepath!= '/') $relativepath.='/'; |
|
249 | + $relativepath = GETPOST('file', 'alpha') ?GETPOST('file', 'alpha') : GETPOST('section_dir', 'alpha'); |
|
250 | + if ($relativepath && $relativepath != '/') $relativepath .= '/'; |
|
251 | 251 | $upload_dir = $dolibarr_main_data_root.'/'.$module.'/'.$relativepath; |
252 | 252 | if (GETPOSTISSET('website') || GETPOSTISSET('file_manager')) |
253 | 253 | { |
254 | - $param.='&file_manager=1'; |
|
255 | - if (!preg_match('/website=/',$param)) $param.='&website='.urlencode(GETPOST('website','alpha')); |
|
256 | - if (!preg_match('/pageid=/',$param)) $param.='&pageid='.urlencode(GETPOST('pageid','int')); |
|
254 | + $param .= '&file_manager=1'; |
|
255 | + if (!preg_match('/website=/', $param)) $param .= '&website='.urlencode(GETPOST('website', 'alpha')); |
|
256 | + if (!preg_match('/pageid=/', $param)) $param .= '&pageid='.urlencode(GETPOST('pageid', 'int')); |
|
257 | 257 | //if (!preg_match('/backtopage=/',$param)) $param.='&backtopage='.urlencode($_SERVER["PHP_SELF"].'?file_manager=1&website='.$websitekey.'&pageid='.$pageid); |
258 | 258 | } |
259 | 259 | } |
260 | 260 | else |
261 | 261 | { |
262 | - $relativepath=$ecmdir->getRelativePath(); |
|
262 | + $relativepath = $ecmdir->getRelativePath(); |
|
263 | 263 | $upload_dir = $conf->ecm->dir_output.'/'.$relativepath; |
264 | 264 | } |
265 | 265 | |
266 | 266 | // If $section defined with value 0 |
267 | 267 | if (($section === '0' || empty($section)) && ($module != 'medias')) |
268 | 268 | { |
269 | - $filearray=array(); |
|
269 | + $filearray = array(); |
|
270 | 270 | } |
271 | 271 | else |
272 | 272 | { |
273 | - $filearray=dol_dir_list($upload_dir,"files",0,'',array('^\.','(\.meta|_preview.*\.png)$','^temp$','^CVS$'),$sortfield, $sorting,1); |
|
273 | + $filearray = dol_dir_list($upload_dir, "files", 0, '', array('^\.', '(\.meta|_preview.*\.png)$', '^temp$', '^CVS$'), $sortfield, $sorting, 1); |
|
274 | 274 | } |
275 | 275 | |
276 | 276 | if ($section) |
277 | 277 | { |
278 | - $param.='§ion='.$section; |
|
279 | - if (isset($search_doc_ref) && $search_doc_ref != '') $param.='&search_doc_ref='.$search_doc_ref; |
|
278 | + $param .= '§ion='.$section; |
|
279 | + if (isset($search_doc_ref) && $search_doc_ref != '') $param .= '&search_doc_ref='.$search_doc_ref; |
|
280 | 280 | |
281 | 281 | $textifempty = $langs->trans('NoFileFound'); |
282 | 282 | } |
283 | 283 | else if ($section === '0') |
284 | 284 | { |
285 | - if ($module == 'ecm') $textifempty='<br><div align="center"><font class="warning">'.$langs->trans("DirNotSynchronizedSyncFirst").'</font></div><br>'; |
|
285 | + if ($module == 'ecm') $textifempty = '<br><div align="center"><font class="warning">'.$langs->trans("DirNotSynchronizedSyncFirst").'</font></div><br>'; |
|
286 | 286 | else $textifempty = $langs->trans('NoFileFound'); |
287 | 287 | } |
288 | - else $textifempty=($showonrightsize=='featurenotyetavailable'?$langs->trans("FeatureNotYetAvailable"):$langs->trans("ECMSelectASection")); |
|
288 | + else $textifempty = ($showonrightsize == 'featurenotyetavailable' ? $langs->trans("FeatureNotYetAvailable") : $langs->trans("ECMSelectASection")); |
|
289 | 289 | |
290 | 290 | if ($module == 'medias') |
291 | 291 | { |
292 | 292 | $useinecm = 2; |
293 | - $modulepart='medias'; |
|
294 | - $perm=($user->rights->website->write || $user->rights->emailing->creer); |
|
295 | - $title='none'; |
|
293 | + $modulepart = 'medias'; |
|
294 | + $perm = ($user->rights->website->write || $user->rights->emailing->creer); |
|
295 | + $title = 'none'; |
|
296 | 296 | } |
297 | 297 | else |
298 | 298 | { |
299 | 299 | $useinecm = 1; |
300 | - $modulepart='ecm'; |
|
301 | - $perm=$user->rights->ecm->upload; |
|
302 | - $title=''; // Use default |
|
300 | + $modulepart = 'ecm'; |
|
301 | + $perm = $user->rights->ecm->upload; |
|
302 | + $title = ''; // Use default |
|
303 | 303 | } |
304 | 304 | |
305 | 305 | // When we show list of files for ECM files, $filearray contains file list, and directory is defined with modulepart + section into $param |
@@ -312,33 +312,33 @@ discard block |
||
312 | 312 | |
313 | 313 | |
314 | 314 | // Bottom of page |
315 | -$useajax=1; |
|
316 | -if (! empty($conf->dol_use_jmobile)) $useajax=0; |
|
317 | -if (empty($conf->use_javascript_ajax)) $useajax=0; |
|
318 | -if (! empty($conf->global->MAIN_ECM_DISABLE_JS)) $useajax=0; |
|
315 | +$useajax = 1; |
|
316 | +if (!empty($conf->dol_use_jmobile)) $useajax = 0; |
|
317 | +if (empty($conf->use_javascript_ajax)) $useajax = 0; |
|
318 | +if (!empty($conf->global->MAIN_ECM_DISABLE_JS)) $useajax = 0; |
|
319 | 319 | |
320 | 320 | //$param.=($param?'?':'').(preg_replace('/^&/','',$param)); |
321 | 321 | |
322 | 322 | if ($useajax || $action == 'delete') |
323 | 323 | { |
324 | - $urlfile=''; |
|
325 | - if ($action == 'delete') $urlfile=GETPOST('urlfile','alpha'); |
|
324 | + $urlfile = ''; |
|
325 | + if ($action == 'delete') $urlfile = GETPOST('urlfile', 'alpha'); |
|
326 | 326 | |
327 | - if (empty($section_dir)) $section_dir=GETPOST("file","alpha"); |
|
328 | - $section_id=$section; |
|
327 | + if (empty($section_dir)) $section_dir = GETPOST("file", "alpha"); |
|
328 | + $section_id = $section; |
|
329 | 329 | |
330 | 330 | require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php'; |
331 | - $useglobalvars=1; |
|
331 | + $useglobalvars = 1; |
|
332 | 332 | $form = new Form($db); |
333 | - $formquestion['urlfile']=array('type'=>'hidden','value'=>$urlfile,'name'=>'urlfile'); // We must always put field, even if empty because it is fille by javascript later |
|
334 | - $formquestion['section']=array('type'=>'hidden','value'=>$section,'name'=>'section'); // We must always put field, even if empty because it is fille by javascript later |
|
335 | - $formquestion['section_id']=array('type'=>'hidden','value'=>$section_id,'name'=>'section_id'); // We must always put field, even if empty because it is fille by javascript later |
|
336 | - $formquestion['section_dir']=array('type'=>'hidden','value'=>$section_dir,'name'=>'section_dir'); // We must always put field, even if empty because it is fille by javascript later |
|
337 | - if (! empty($action) && $action == 'file_manager') $formquestion['file_manager']=array('type'=>'hidden','value'=>1,'name'=>'file_manager'); |
|
338 | - if (! empty($websitekey)) $formquestion['website']=array('type'=>'hidden','value'=>$websitekey,'name'=>'website'); |
|
339 | - if (! empty($pageid) && $pageid > 0) $formquestion['pageid']=array('type'=>'hidden','value'=>$pageid,'name'=>'pageid'); |
|
340 | - |
|
341 | - print $form->formconfirm($url,$langs->trans("DeleteFile"),$langs->trans("ConfirmDeleteFile"),'confirm_deletefile',$formquestion,"no",($useajax?'deletefile':0)); |
|
333 | + $formquestion['urlfile'] = array('type'=>'hidden', 'value'=>$urlfile, 'name'=>'urlfile'); // We must always put field, even if empty because it is fille by javascript later |
|
334 | + $formquestion['section'] = array('type'=>'hidden', 'value'=>$section, 'name'=>'section'); // We must always put field, even if empty because it is fille by javascript later |
|
335 | + $formquestion['section_id'] = array('type'=>'hidden', 'value'=>$section_id, 'name'=>'section_id'); // We must always put field, even if empty because it is fille by javascript later |
|
336 | + $formquestion['section_dir'] = array('type'=>'hidden', 'value'=>$section_dir, 'name'=>'section_dir'); // We must always put field, even if empty because it is fille by javascript later |
|
337 | + if (!empty($action) && $action == 'file_manager') $formquestion['file_manager'] = array('type'=>'hidden', 'value'=>1, 'name'=>'file_manager'); |
|
338 | + if (!empty($websitekey)) $formquestion['website'] = array('type'=>'hidden', 'value'=>$websitekey, 'name'=>'website'); |
|
339 | + if (!empty($pageid) && $pageid > 0) $formquestion['pageid'] = array('type'=>'hidden', 'value'=>$pageid, 'name'=>'pageid'); |
|
340 | + |
|
341 | + print $form->formconfirm($url, $langs->trans("DeleteFile"), $langs->trans("ConfirmDeleteFile"), 'confirm_deletefile', $formquestion, "no", ($useajax ? 'deletefile' : 0)); |
|
342 | 342 | } |
343 | 343 | |
344 | 344 | if ($useajax) |
@@ -376,4 +376,4 @@ discard block |
||
376 | 376 | } |
377 | 377 | |
378 | 378 | // Close db if mode is not noajax |
379 | -if ((! isset($mode) || $mode != 'noajax') && is_object($db)) $db->close(); |
|
379 | +if ((!isset($mode) || $mode != 'noajax') && is_object($db)) $db->close(); |
@@ -24,19 +24,19 @@ discard block |
||
24 | 24 | |
25 | 25 | // This script is called with a POST method or as an include. |
26 | 26 | |
27 | -if (! isset($usedbyinclude) || empty($usedbyinclude)) |
|
27 | +if (!isset($usedbyinclude) || empty($usedbyinclude)) |
|
28 | 28 | { |
29 | - if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL',1); // Disables token renewal |
|
30 | - if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); |
|
31 | - if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1'); |
|
32 | - if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); |
|
33 | - if (! defined('NOREDIRECTBYMAINTOLOGIN')) define('NOREDIRECTBYMAINTOLOGIN','1'); |
|
29 | + if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', 1); // Disables token renewal |
|
30 | + if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); |
|
31 | + if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); |
|
32 | + if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); |
|
33 | + if (!defined('NOREDIRECTBYMAINTOLOGIN')) define('NOREDIRECTBYMAINTOLOGIN', '1'); |
|
34 | 34 | |
35 | - $res=@include '../../main.inc.php'; |
|
35 | + $res = @include '../../main.inc.php'; |
|
36 | 36 | if ($res == 'ERROR_NOT_LOGGED') |
37 | 37 | { |
38 | 38 | $langs->load("other"); |
39 | - $arrayresult['jumptologin']=array('img'=>'object_generic', 'label'=>$langs->trans("JumpToLogin"), 'text'=>'<span class="fa fa-sign-in"></span> '.$langs->trans("JumpToLogin"), 'url'=>DOL_URL_ROOT.'/index.php'); |
|
39 | + $arrayresult['jumptologin'] = array('img'=>'object_generic', 'label'=>$langs->trans("JumpToLogin"), 'text'=>'<span class="fa fa-sign-in"></span> '.$langs->trans("JumpToLogin"), 'url'=>DOL_URL_ROOT.'/index.php'); |
|
40 | 40 | print json_encode($arrayresult); |
41 | 41 | if (is_object($db)) $db->close(); |
42 | 42 | exit; |
@@ -48,93 +48,93 @@ discard block |
||
48 | 48 | //global $hookmanager; |
49 | 49 | $hookmanager->initHooks(array('searchform')); |
50 | 50 | |
51 | -$search_boxvalue=GETPOST('q', 'none'); |
|
51 | +$search_boxvalue = GETPOST('q', 'none'); |
|
52 | 52 | |
53 | -$arrayresult=array(); |
|
53 | +$arrayresult = array(); |
|
54 | 54 | |
55 | 55 | // Define $searchform |
56 | 56 | |
57 | -if (! empty($conf->adherent->enabled) && empty($conf->global->MAIN_SEARCHFORM_ADHERENT_DISABLED) && $user->rights->adherent->lire) |
|
57 | +if (!empty($conf->adherent->enabled) && empty($conf->global->MAIN_SEARCHFORM_ADHERENT_DISABLED) && $user->rights->adherent->lire) |
|
58 | 58 | { |
59 | - $arrayresult['searchintomember']=array('position'=>8, 'shortcut'=>'M', 'img'=>'object_user', 'label'=>$langs->trans("SearchIntoMembers", $search_boxvalue), 'text'=>img_picto('','object_user').' '.$langs->trans("SearchIntoMembers", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/adherents/list.php'.($search_boxvalue?'?sall='.urlencode($search_boxvalue):'')); |
|
59 | + $arrayresult['searchintomember'] = array('position'=>8, 'shortcut'=>'M', 'img'=>'object_user', 'label'=>$langs->trans("SearchIntoMembers", $search_boxvalue), 'text'=>img_picto('', 'object_user').' '.$langs->trans("SearchIntoMembers", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/adherents/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : '')); |
|
60 | 60 | } |
61 | 61 | |
62 | -if ((( ! empty($conf->societe->enabled) && (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS))) || ! empty($conf->fournisseur->enabled)) && empty($conf->global->MAIN_SEARCHFORM_SOCIETE_DISABLED) && $user->rights->societe->lire) |
|
62 | +if (((!empty($conf->societe->enabled) && (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS))) || !empty($conf->fournisseur->enabled)) && empty($conf->global->MAIN_SEARCHFORM_SOCIETE_DISABLED) && $user->rights->societe->lire) |
|
63 | 63 | { |
64 | - $arrayresult['searchintothirdparty']=array('position'=>10, 'shortcut'=>'T', 'img'=>'object_company', 'label'=>$langs->trans("SearchIntoThirdparties", $search_boxvalue), 'text'=>img_picto('','object_company').' '.$langs->trans("SearchIntoThirdparties", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/societe/list.php'.($search_boxvalue?'?sall='.urlencode($search_boxvalue):'')); |
|
64 | + $arrayresult['searchintothirdparty'] = array('position'=>10, 'shortcut'=>'T', 'img'=>'object_company', 'label'=>$langs->trans("SearchIntoThirdparties", $search_boxvalue), 'text'=>img_picto('', 'object_company').' '.$langs->trans("SearchIntoThirdparties", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/societe/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : '')); |
|
65 | 65 | } |
66 | 66 | |
67 | -if (! empty($conf->societe->enabled) && empty($conf->global->MAIN_SEARCHFORM_CONTACT_DISABLED) && $user->rights->societe->lire) |
|
67 | +if (!empty($conf->societe->enabled) && empty($conf->global->MAIN_SEARCHFORM_CONTACT_DISABLED) && $user->rights->societe->lire) |
|
68 | 68 | { |
69 | - $arrayresult['searchintocontact']=array('position'=>15, 'shortcut'=>'A', 'img'=>'object_contact', 'label'=>$langs->trans("SearchIntoContacts", $search_boxvalue), 'text'=>img_picto('','object_contact').' '.$langs->trans("SearchIntoContacts", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/contact/list.php'.($search_boxvalue?'?sall='.urlencode($search_boxvalue):'')); |
|
69 | + $arrayresult['searchintocontact'] = array('position'=>15, 'shortcut'=>'A', 'img'=>'object_contact', 'label'=>$langs->trans("SearchIntoContacts", $search_boxvalue), 'text'=>img_picto('', 'object_contact').' '.$langs->trans("SearchIntoContacts", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/contact/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : '')); |
|
70 | 70 | } |
71 | 71 | |
72 | -if (((! empty($conf->product->enabled) && $user->rights->produit->lire) || (! empty($conf->service->enabled) && $user->rights->service->lire)) |
|
72 | +if (((!empty($conf->product->enabled) && $user->rights->produit->lire) || (!empty($conf->service->enabled) && $user->rights->service->lire)) |
|
73 | 73 | && empty($conf->global->MAIN_SEARCHFORM_PRODUITSERVICE_DISABLED)) |
74 | 74 | { |
75 | - $arrayresult['searchintoproduct']=array('position'=>30, 'shortcut'=>'P', 'img'=>'object_product', 'label'=>$langs->trans("SearchIntoProductsOrServices", $search_boxvalue),'text'=>img_picto('','object_product').' '.$langs->trans("SearchIntoProductsOrServices", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/product/list.php'.($search_boxvalue?'?sall='.urlencode($search_boxvalue):'')); |
|
75 | + $arrayresult['searchintoproduct'] = array('position'=>30, 'shortcut'=>'P', 'img'=>'object_product', 'label'=>$langs->trans("SearchIntoProductsOrServices", $search_boxvalue), 'text'=>img_picto('', 'object_product').' '.$langs->trans("SearchIntoProductsOrServices", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/product/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : '')); |
|
76 | 76 | } |
77 | 77 | |
78 | -if (! empty($conf->projet->enabled) && empty($conf->global->MAIN_SEARCHFORM_PROJECT_DISABLED) && $user->rights->projet->lire) |
|
78 | +if (!empty($conf->projet->enabled) && empty($conf->global->MAIN_SEARCHFORM_PROJECT_DISABLED) && $user->rights->projet->lire) |
|
79 | 79 | { |
80 | - $arrayresult['searchintoprojects']=array('position'=>40, 'shortcut'=>'Q', 'img'=>'object_projectpub', 'label'=>$langs->trans("SearchIntoProjects", $search_boxvalue), 'text'=>img_picto('','object_projectpub').' '.$langs->trans("SearchIntoProjects", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/projet/list.php'.($search_boxvalue?'?search_all='.urlencode($search_boxvalue):'')); |
|
80 | + $arrayresult['searchintoprojects'] = array('position'=>40, 'shortcut'=>'Q', 'img'=>'object_projectpub', 'label'=>$langs->trans("SearchIntoProjects", $search_boxvalue), 'text'=>img_picto('', 'object_projectpub').' '.$langs->trans("SearchIntoProjects", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/projet/list.php'.($search_boxvalue ? '?search_all='.urlencode($search_boxvalue) : '')); |
|
81 | 81 | } |
82 | -if (! empty($conf->projet->enabled) && empty($conf->global->MAIN_SEARCHFORM_TASK_DISABLED) && $user->rights->projet->lire) |
|
82 | +if (!empty($conf->projet->enabled) && empty($conf->global->MAIN_SEARCHFORM_TASK_DISABLED) && $user->rights->projet->lire) |
|
83 | 83 | { |
84 | - $arrayresult['searchintotasks']=array('position'=>45, 'img'=>'object_task', 'label'=>$langs->trans("SearchIntoTasks", $search_boxvalue), 'text'=>img_picto('','object_task').' '.$langs->trans("SearchIntoTasks", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/projet/tasks/list.php'.($search_boxvalue?'?search_all='.urlencode($search_boxvalue):'')); |
|
84 | + $arrayresult['searchintotasks'] = array('position'=>45, 'img'=>'object_task', 'label'=>$langs->trans("SearchIntoTasks", $search_boxvalue), 'text'=>img_picto('', 'object_task').' '.$langs->trans("SearchIntoTasks", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/projet/tasks/list.php'.($search_boxvalue ? '?search_all='.urlencode($search_boxvalue) : '')); |
|
85 | 85 | } |
86 | 86 | |
87 | -if (! empty($conf->propal->enabled) && empty($conf->global->MAIN_SEARCHFORM_CUSTOMER_PROPAL_DISABLED) && $user->rights->propal->lire) |
|
87 | +if (!empty($conf->propal->enabled) && empty($conf->global->MAIN_SEARCHFORM_CUSTOMER_PROPAL_DISABLED) && $user->rights->propal->lire) |
|
88 | 88 | { |
89 | - $arrayresult['searchintopropal']=array('position'=>60, 'img'=>'object_propal', 'label'=>$langs->trans("SearchIntoCustomerProposals", $search_boxvalue), 'text'=>img_picto('','object_propal').' '.$langs->trans("SearchIntoCustomerProposals", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/comm/propal/list.php'.($search_boxvalue?'?sall='.urlencode($search_boxvalue):'')); |
|
89 | + $arrayresult['searchintopropal'] = array('position'=>60, 'img'=>'object_propal', 'label'=>$langs->trans("SearchIntoCustomerProposals", $search_boxvalue), 'text'=>img_picto('', 'object_propal').' '.$langs->trans("SearchIntoCustomerProposals", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/comm/propal/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : '')); |
|
90 | 90 | } |
91 | -if (! empty($conf->commande->enabled) && empty($conf->global->MAIN_SEARCHFORM_CUSTOMER_ORDER_DISABLED) && $user->rights->commande->lire) |
|
91 | +if (!empty($conf->commande->enabled) && empty($conf->global->MAIN_SEARCHFORM_CUSTOMER_ORDER_DISABLED) && $user->rights->commande->lire) |
|
92 | 92 | { |
93 | - $arrayresult['searchintoorder']=array('position'=>70, 'img'=>'object_order', 'label'=>$langs->trans("SearchIntoCustomerOrders", $search_boxvalue), 'text'=>img_picto('','object_order').' '.$langs->trans("SearchIntoCustomerOrders", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/commande/list.php'.($search_boxvalue?'?sall='.urlencode($search_boxvalue):'')); |
|
93 | + $arrayresult['searchintoorder'] = array('position'=>70, 'img'=>'object_order', 'label'=>$langs->trans("SearchIntoCustomerOrders", $search_boxvalue), 'text'=>img_picto('', 'object_order').' '.$langs->trans("SearchIntoCustomerOrders", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/commande/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : '')); |
|
94 | 94 | } |
95 | -if (! empty($conf->expedition->enabled) && empty($conf->global->MAIN_SEARCHFORM_CUSTOMER_SHIPMENT_DISABLED) && $user->rights->expedition->lire) |
|
95 | +if (!empty($conf->expedition->enabled) && empty($conf->global->MAIN_SEARCHFORM_CUSTOMER_SHIPMENT_DISABLED) && $user->rights->expedition->lire) |
|
96 | 96 | { |
97 | - $arrayresult['searchintoshipment']=array('position'=>80, 'img'=>'object_sending', 'label'=>$langs->trans("SearchIntoCustomerShipments", $search_boxvalue), 'text'=>img_picto('','object_sending').' '.$langs->trans("SearchIntoCustomerShipments", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/expedition/list.php'.($search_boxvalue?'?sall='.urlencode($search_boxvalue):'')); |
|
97 | + $arrayresult['searchintoshipment'] = array('position'=>80, 'img'=>'object_sending', 'label'=>$langs->trans("SearchIntoCustomerShipments", $search_boxvalue), 'text'=>img_picto('', 'object_sending').' '.$langs->trans("SearchIntoCustomerShipments", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/expedition/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : '')); |
|
98 | 98 | } |
99 | -if (! empty($conf->facture->enabled) && empty($conf->global->MAIN_SEARCHFORM_CUSTOMER_INVOICE_DISABLED) && $user->rights->facture->lire) |
|
99 | +if (!empty($conf->facture->enabled) && empty($conf->global->MAIN_SEARCHFORM_CUSTOMER_INVOICE_DISABLED) && $user->rights->facture->lire) |
|
100 | 100 | { |
101 | - $arrayresult['searchintoinvoice']=array('position'=>90, 'img'=>'object_bill', 'label'=>$langs->trans("SearchIntoCustomerInvoices", $search_boxvalue), 'text'=>img_picto('','object_bill').' '.$langs->trans("SearchIntoCustomerInvoices", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/compta/facture/list.php'.($search_boxvalue?'?sall='.urlencode($search_boxvalue):'')); |
|
101 | + $arrayresult['searchintoinvoice'] = array('position'=>90, 'img'=>'object_bill', 'label'=>$langs->trans("SearchIntoCustomerInvoices", $search_boxvalue), 'text'=>img_picto('', 'object_bill').' '.$langs->trans("SearchIntoCustomerInvoices", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/compta/facture/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : '')); |
|
102 | 102 | } |
103 | 103 | |
104 | -if (! empty($conf->supplier_proposal->enabled) && empty($conf->global->MAIN_SEARCHFORM_SUPPLIER_PROPAL_DISABLED) && $user->rights->supplier_proposal->lire) |
|
104 | +if (!empty($conf->supplier_proposal->enabled) && empty($conf->global->MAIN_SEARCHFORM_SUPPLIER_PROPAL_DISABLED) && $user->rights->supplier_proposal->lire) |
|
105 | 105 | { |
106 | - $arrayresult['searchintosupplierpropal']=array('position'=>100, 'img'=>'object_propal', 'label'=>$langs->trans("SearchIntoSupplierProposals", $search_boxvalue), 'text'=>img_picto('','object_propal').' '.$langs->trans("SearchIntoSupplierProposals", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/supplier_proposal/list.php'.($search_boxvalue?'?sall='.urlencode($search_boxvalue):'')); |
|
106 | + $arrayresult['searchintosupplierpropal'] = array('position'=>100, 'img'=>'object_propal', 'label'=>$langs->trans("SearchIntoSupplierProposals", $search_boxvalue), 'text'=>img_picto('', 'object_propal').' '.$langs->trans("SearchIntoSupplierProposals", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/supplier_proposal/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : '')); |
|
107 | 107 | } |
108 | -if (! empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_SEARCHFORM_SUPPLIER_ORDER_DISABLED) && $user->rights->fournisseur->commande->lire) |
|
108 | +if (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_SEARCHFORM_SUPPLIER_ORDER_DISABLED) && $user->rights->fournisseur->commande->lire) |
|
109 | 109 | { |
110 | - $arrayresult['searchintosupplierorder']=array('position'=>110, 'img'=>'object_order', 'label'=>$langs->trans("SearchIntoSupplierOrders", $search_boxvalue), 'text'=>img_picto('','object_order').' '.$langs->trans("SearchIntoSupplierOrders", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/fourn/commande/list.php'.($search_boxvalue?'?search_all='.urlencode($search_boxvalue):'')); |
|
110 | + $arrayresult['searchintosupplierorder'] = array('position'=>110, 'img'=>'object_order', 'label'=>$langs->trans("SearchIntoSupplierOrders", $search_boxvalue), 'text'=>img_picto('', 'object_order').' '.$langs->trans("SearchIntoSupplierOrders", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/fourn/commande/list.php'.($search_boxvalue ? '?search_all='.urlencode($search_boxvalue) : '')); |
|
111 | 111 | } |
112 | -if (! empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_SEARCHFORM_SUPPLIER_INVOICE_DISABLED) && $user->rights->fournisseur->facture->lire) |
|
112 | +if (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_SEARCHFORM_SUPPLIER_INVOICE_DISABLED) && $user->rights->fournisseur->facture->lire) |
|
113 | 113 | { |
114 | - $arrayresult['searchintosupplierinvoice']=array('position'=>120, 'img'=>'object_bill', 'label'=>$langs->trans("SearchIntoSupplierInvoices", $search_boxvalue), 'text'=>img_picto('','object_bill').' '.$langs->trans("SearchIntoSupplierInvoices", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/fourn/facture/list.php'.($search_boxvalue?'?sall='.urlencode($search_boxvalue):'')); |
|
114 | + $arrayresult['searchintosupplierinvoice'] = array('position'=>120, 'img'=>'object_bill', 'label'=>$langs->trans("SearchIntoSupplierInvoices", $search_boxvalue), 'text'=>img_picto('', 'object_bill').' '.$langs->trans("SearchIntoSupplierInvoices", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/fourn/facture/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : '')); |
|
115 | 115 | } |
116 | 116 | |
117 | -if (! empty($conf->contrat->enabled) && empty($conf->global->MAIN_SEARCHFORM_CONTRACT_DISABLED) && $user->rights->contrat->lire) |
|
117 | +if (!empty($conf->contrat->enabled) && empty($conf->global->MAIN_SEARCHFORM_CONTRACT_DISABLED) && $user->rights->contrat->lire) |
|
118 | 118 | { |
119 | - $arrayresult['searchintocontract']=array('position'=>130, 'img'=>'object_contract', 'label'=>$langs->trans("SearchIntoContracts", $search_boxvalue), 'text'=>img_picto('','object_contract').' '.$langs->trans("SearchIntoContracts", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/contrat/list.php'.($search_boxvalue?'?sall='.urlencode($search_boxvalue):'')); |
|
119 | + $arrayresult['searchintocontract'] = array('position'=>130, 'img'=>'object_contract', 'label'=>$langs->trans("SearchIntoContracts", $search_boxvalue), 'text'=>img_picto('', 'object_contract').' '.$langs->trans("SearchIntoContracts", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/contrat/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : '')); |
|
120 | 120 | } |
121 | -if (! empty($conf->ficheinter->enabled) && empty($conf->global->MAIN_SEARCHFORM_FICHINTER_DISABLED) && $user->rights->ficheinter->lire) |
|
121 | +if (!empty($conf->ficheinter->enabled) && empty($conf->global->MAIN_SEARCHFORM_FICHINTER_DISABLED) && $user->rights->ficheinter->lire) |
|
122 | 122 | { |
123 | - $arrayresult['searchintointervention']=array('position'=>140, 'img'=>'object_intervention', 'label'=>$langs->trans("SearchIntoInterventions", $search_boxvalue), 'text'=>img_picto('','object_intervention').' '.$langs->trans("SearchIntoInterventions", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/fichinter/list.php'.($search_boxvalue?'?sall='.urlencode($search_boxvalue):'')); |
|
123 | + $arrayresult['searchintointervention'] = array('position'=>140, 'img'=>'object_intervention', 'label'=>$langs->trans("SearchIntoInterventions", $search_boxvalue), 'text'=>img_picto('', 'object_intervention').' '.$langs->trans("SearchIntoInterventions", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/fichinter/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : '')); |
|
124 | 124 | } |
125 | 125 | |
126 | 126 | // HR |
127 | -if (! empty($conf->user->enabled) && empty($conf->global->MAIN_SEARCHFORM_USER_DISABLED) && $user->rights->user->user->lire) |
|
127 | +if (!empty($conf->user->enabled) && empty($conf->global->MAIN_SEARCHFORM_USER_DISABLED) && $user->rights->user->user->lire) |
|
128 | 128 | { |
129 | - $arrayresult['searchintouser']=array('position'=>200, 'shortcut'=>'U', 'img'=>'object_user', 'label'=>$langs->trans("SearchIntoUsers", $search_boxvalue), 'text'=>img_picto('','object_user').' '.$langs->trans("SearchIntoUsers", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/user/list.php'.($search_boxvalue?'?sall='.urlencode($search_boxvalue):'')); |
|
129 | + $arrayresult['searchintouser'] = array('position'=>200, 'shortcut'=>'U', 'img'=>'object_user', 'label'=>$langs->trans("SearchIntoUsers", $search_boxvalue), 'text'=>img_picto('', 'object_user').' '.$langs->trans("SearchIntoUsers", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/user/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : '')); |
|
130 | 130 | } |
131 | -if (! empty($conf->expensereport->enabled) && empty($conf->global->MAIN_SEARCHFORM_EXPENSEREPORT_DISABLED) && $user->rights->expensereport->lire) |
|
131 | +if (!empty($conf->expensereport->enabled) && empty($conf->global->MAIN_SEARCHFORM_EXPENSEREPORT_DISABLED) && $user->rights->expensereport->lire) |
|
132 | 132 | { |
133 | - $arrayresult['searchintoexpensereport']=array('position'=>210, 'img'=>'object_trip', 'label'=>$langs->trans("SearchIntoExpenseReports", $search_boxvalue), 'text'=>img_picto('','object_trip').' '.$langs->trans("SearchIntoExpenseReports", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/expensereport/list.php?mainmenu=hrm'.($search_boxvalue?'&sall='.urlencode($search_boxvalue):'')); |
|
133 | + $arrayresult['searchintoexpensereport'] = array('position'=>210, 'img'=>'object_trip', 'label'=>$langs->trans("SearchIntoExpenseReports", $search_boxvalue), 'text'=>img_picto('', 'object_trip').' '.$langs->trans("SearchIntoExpenseReports", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/expensereport/list.php?mainmenu=hrm'.($search_boxvalue ? '&sall='.urlencode($search_boxvalue) : '')); |
|
134 | 134 | } |
135 | -if (! empty($conf->holiday->enabled) && empty($conf->global->MAIN_SEARCHFORM_HOLIDAY_DISABLED) && $user->rights->holiday->read) |
|
135 | +if (!empty($conf->holiday->enabled) && empty($conf->global->MAIN_SEARCHFORM_HOLIDAY_DISABLED) && $user->rights->holiday->read) |
|
136 | 136 | { |
137 | - $arrayresult['searchintoleaves']=array('position'=>220, 'img'=>'object_holiday', 'label'=>$langs->trans("SearchIntoLeaves", $search_boxvalue), 'text'=>img_picto('','object_holiday').' '.$langs->trans("SearchIntoLeaves", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/holiday/list.php?mainmenu=hrm'.($search_boxvalue?'&sall='.urlencode($search_boxvalue):'')); |
|
137 | + $arrayresult['searchintoleaves'] = array('position'=>220, 'img'=>'object_holiday', 'label'=>$langs->trans("SearchIntoLeaves", $search_boxvalue), 'text'=>img_picto('', 'object_holiday').' '.$langs->trans("SearchIntoLeaves", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/holiday/list.php?mainmenu=hrm'.($search_boxvalue ? '&sall='.urlencode($search_boxvalue) : '')); |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | |
@@ -147,25 +147,25 @@ discard block |
||
147 | 147 | */ |
148 | 148 | |
149 | 149 | // Execute hook addSearchEntry |
150 | -$parameters=array('search_boxvalue'=>$search_boxvalue, 'arrayresult'=>$arrayresult); |
|
151 | -$reshook=$hookmanager->executeHooks('addSearchEntry',$parameters); |
|
150 | +$parameters = array('search_boxvalue'=>$search_boxvalue, 'arrayresult'=>$arrayresult); |
|
151 | +$reshook = $hookmanager->executeHooks('addSearchEntry', $parameters); |
|
152 | 152 | if (empty($reshook)) |
153 | 153 | { |
154 | - $arrayresult=array_merge($arrayresult, $hookmanager->resArray); |
|
154 | + $arrayresult = array_merge($arrayresult, $hookmanager->resArray); |
|
155 | 155 | } |
156 | -else $arrayresult=$hookmanager->resArray; |
|
156 | +else $arrayresult = $hookmanager->resArray; |
|
157 | 157 | |
158 | 158 | // This allow to keep a search entry to the top |
159 | -if(! empty($conf->global->DEFAULT_SEARCH_INTO_MODULE)) { |
|
159 | +if (!empty($conf->global->DEFAULT_SEARCH_INTO_MODULE)) { |
|
160 | 160 | $key = 'searchinto'.$conf->global->DEFAULT_SEARCH_INTO_MODULE; |
161 | - if(array_key_exists($key, $arrayresult)) $arrayresult[$key]['position'] = -10; |
|
161 | + if (array_key_exists($key, $arrayresult)) $arrayresult[$key]['position'] = -10; |
|
162 | 162 | } |
163 | 163 | |
164 | 164 | // Sort on position |
165 | 165 | $arrayresult = dol_sort_array($arrayresult, 'position'); |
166 | 166 | |
167 | 167 | // Print output if called by ajax or do nothing (var $arrayresult will be used) if called by an include |
168 | -if (! isset($usedbyinclude) || empty($usedbyinclude)) |
|
168 | +if (!isset($usedbyinclude) || empty($usedbyinclude)) |
|
169 | 169 | { |
170 | 170 | print json_encode($arrayresult); |
171 | 171 | if (is_object($db)) $db->close(); |
@@ -20,17 +20,17 @@ discard block |
||
20 | 20 | * \brief File to return Ajax response on set extra parameters of elements |
21 | 21 | */ |
22 | 22 | |
23 | -if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); // Disables token renewal |
|
24 | -if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); |
|
25 | -if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1'); |
|
26 | -if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); |
|
27 | -if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1'); |
|
23 | +if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Disables token renewal |
|
24 | +if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); |
|
25 | +if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); |
|
26 | +if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); |
|
27 | +if (!defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1'); |
|
28 | 28 | |
29 | 29 | include '../../main.inc.php'; |
30 | 30 | |
31 | -$id = GETPOST('id','int'); |
|
32 | -$element = GETPOST('element','alpha'); |
|
33 | -$htmlelement = GETPOST('htmlelement','alpha'); |
|
31 | +$id = GETPOST('id', 'int'); |
|
32 | +$element = GETPOST('element', 'alpha'); |
|
33 | +$htmlelement = GETPOST('htmlelement', 'alpha'); |
|
34 | 34 | $type = GETPOST('type', 'alpha'); |
35 | 35 | |
36 | 36 | /* |
@@ -41,37 +41,37 @@ discard block |
||
41 | 41 | |
42 | 42 | print '<!-- Ajax page called with url '.dol_escape_htmltag($_SERVER["PHP_SELF"]).'?'.dol_escape_htmltag($_SERVER["QUERY_STRING"]).' -->'."\n"; |
43 | 43 | |
44 | -if(! empty($id) && ! empty($element) && ! empty($htmlelement) && ! empty($type)) |
|
44 | +if (!empty($id) && !empty($element) && !empty($htmlelement) && !empty($type)) |
|
45 | 45 | { |
46 | - $value = GETPOST('value','alpha'); |
|
47 | - $params=array(); |
|
46 | + $value = GETPOST('value', 'alpha'); |
|
47 | + $params = array(); |
|
48 | 48 | |
49 | 49 | dol_syslog("AjaxSetExtraParameters id=".$id." element=".$element." htmlelement=".$htmlelement." type=".$type." value=".$value, LOG_DEBUG); |
50 | 50 | |
51 | 51 | $classpath = $subelement = $element; |
52 | 52 | |
53 | 53 | // For compatibility |
54 | - if ($element == 'order' || $element == 'commande') { $classpath = $subelement = 'commande'; } |
|
55 | - else if ($element == 'propal') { $classpath = 'comm/propal'; $subelement = 'propal'; } |
|
56 | - else if ($element == 'facture') { $classpath = 'compta/facture'; $subelement = 'facture'; } |
|
57 | - else if ($element == 'contract') { $classpath = $subelement = 'contrat'; } |
|
58 | - else if ($element == 'shipping') { $classpath = $subelement = 'expedition'; } |
|
59 | - else if ($element == 'deplacement') { $classpath = 'compta/deplacement'; $subelement = 'deplacement'; } |
|
60 | - else if ($element == 'order_supplier') { $classpath = 'fourn'; $subelement = 'fournisseur.commande'; } |
|
61 | - else if ($element == 'invoice_supplier') { $classpath = 'fourn'; $subelement = 'fournisseur.facture'; } |
|
54 | + if ($element == 'order' || $element == 'commande') { $classpath = $subelement = 'commande'; } |
|
55 | + else if ($element == 'propal') { $classpath = 'comm/propal'; $subelement = 'propal'; } |
|
56 | + else if ($element == 'facture') { $classpath = 'compta/facture'; $subelement = 'facture'; } |
|
57 | + else if ($element == 'contract') { $classpath = $subelement = 'contrat'; } |
|
58 | + else if ($element == 'shipping') { $classpath = $subelement = 'expedition'; } |
|
59 | + else if ($element == 'deplacement') { $classpath = 'compta/deplacement'; $subelement = 'deplacement'; } |
|
60 | + else if ($element == 'order_supplier') { $classpath = 'fourn'; $subelement = 'fournisseur.commande'; } |
|
61 | + else if ($element == 'invoice_supplier') { $classpath = 'fourn'; $subelement = 'fournisseur.facture'; } |
|
62 | 62 | |
63 | 63 | dol_include_once('/'.$classpath.'/class/'.$subelement.'.class.php'); |
64 | 64 | |
65 | - if ($element == 'order_supplier') { $classname = 'CommandeFournisseur'; } |
|
66 | - else if ($element == 'invoice_supplier') { $classname = 'FactureFournisseur'; } |
|
65 | + if ($element == 'order_supplier') { $classname = 'CommandeFournisseur'; } |
|
66 | + else if ($element == 'invoice_supplier') { $classname = 'FactureFournisseur'; } |
|
67 | 67 | else $classname = ucfirst($subelement); |
68 | 68 | |
69 | - $object = new $classname($db); |
|
69 | + $object = new $classname($db); |
|
70 | 70 | $object->fetch($id); |
71 | 71 | |
72 | 72 | $params[$htmlelement] = array($type => $value); |
73 | 73 | $object->extraparams = array_merge($object->extraparams, $params); |
74 | 74 | |
75 | - $result=$object->setExtraParameters(); |
|
75 | + $result = $object->setExtraParameters(); |
|
76 | 76 | } |
77 | 77 |
@@ -30,12 +30,12 @@ discard block |
||
30 | 30 | // Print file |
31 | 31 | if ($action == 'print_file' && $user->rights->printing->read) { |
32 | 32 | $langs->load("printing"); |
33 | - require_once DOL_DOCUMENT_ROOT . '/core/modules/printing/modules_printing.php'; |
|
33 | + require_once DOL_DOCUMENT_ROOT.'/core/modules/printing/modules_printing.php'; |
|
34 | 34 | $objectprint = new PrintingDriver($db); |
35 | 35 | $list = $objectprint->listDrivers($db, 10); |
36 | - if (! empty($list)) { |
|
37 | - $errorprint=0; |
|
38 | - $printerfound=0; |
|
36 | + if (!empty($list)) { |
|
37 | + $errorprint = 0; |
|
38 | + $printerfound = 0; |
|
39 | 39 | foreach ($list as $driver) { |
40 | 40 | require_once DOL_DOCUMENT_ROOT.'/core/modules/printing/'.$driver.'.modules.php'; |
41 | 41 | $langs->load($driver); |
@@ -43,13 +43,13 @@ discard block |
||
43 | 43 | $printer = new $classname($db); |
44 | 44 | //print '<pre>'.print_r($printer, true).'</pre>'; |
45 | 45 | |
46 | - if (! empty($conf->global->{$printer->active})) |
|
46 | + if (!empty($conf->global->{$printer->active})) |
|
47 | 47 | { |
48 | 48 | $printerfound++; |
49 | 49 | |
50 | - $subdir=''; |
|
50 | + $subdir = ''; |
|
51 | 51 | $module = GETPOST('printer', 'alpha'); |
52 | - switch ($module ) |
|
52 | + switch ($module) |
|
53 | 53 | { |
54 | 54 | case 'livraison' : |
55 | 55 | $subdir = 'receipt'; |
@@ -69,21 +69,21 @@ discard block |
||
69 | 69 | //print '<pre>'.print_r($printer->errors, true).'</pre>'; |
70 | 70 | setEventMessages($printer->error, $printer->errors, 'errors'); |
71 | 71 | } |
72 | - if ($ret==0) |
|
72 | + if ($ret == 0) |
|
73 | 73 | { |
74 | 74 | //print '<pre>'.print_r($printer->errors, true).'</pre>'; |
75 | 75 | setEventMessages($printer->error, $printer->errors); |
76 | 76 | setEventMessages($langs->transnoentitiesnoconv("FileWasSentToPrinter", basename(GETPOST('file', 'alpha'))).' '.$langs->transnoentitiesnoconv("ViaModule").' '.$printer->name, null); |
77 | 77 | } |
78 | 78 | } |
79 | - catch(Exception $e) |
|
79 | + catch (Exception $e) |
|
80 | 80 | { |
81 | 81 | $ret = 1; |
82 | 82 | setEventMessages($e->getMessage(), null, 'errors'); |
83 | 83 | } |
84 | 84 | } |
85 | 85 | } |
86 | - if ($printerfound==0) setEventMessages($langs->trans("NoActivePrintingModuleFound", $langs->transnoentities("Module64000Name")), null, 'warnings'); |
|
86 | + if ($printerfound == 0) setEventMessages($langs->trans("NoActivePrintingModuleFound", $langs->transnoentities("Module64000Name")), null, 'warnings'); |
|
87 | 87 | } else { |
88 | 88 | setEventMessages($langs->trans("NoModuleFound"), null, 'warnings'); |
89 | 89 | } |
@@ -21,14 +21,14 @@ discard block |
||
21 | 21 | * \brief Return antispam image |
22 | 22 | */ |
23 | 23 | |
24 | -define('NOLOGIN',1); |
|
24 | +define('NOLOGIN', 1); |
|
25 | 25 | |
26 | -if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER',1); |
|
27 | -if (! defined('NOREQUIREDB')) define('NOREQUIREDB',1); |
|
28 | -if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN',1); |
|
29 | -if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU',1); |
|
30 | -if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC',1); |
|
31 | -if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL',1); |
|
26 | +if (!defined('NOREQUIREUSER')) define('NOREQUIREUSER', 1); |
|
27 | +if (!defined('NOREQUIREDB')) define('NOREQUIREDB', 1); |
|
28 | +if (!defined('NOREQUIRETRAN')) define('NOREQUIRETRAN', 1); |
|
29 | +if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', 1); |
|
30 | +if (!defined('NOREQUIRESOC')) define('NOREQUIRESOC', 1); |
|
31 | +if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', 1); |
|
32 | 32 | |
33 | 33 | require_once '../main.inc.php'; |
34 | 34 | |
@@ -37,24 +37,24 @@ discard block |
||
37 | 37 | * View |
38 | 38 | */ |
39 | 39 | |
40 | -$length=5; |
|
40 | +$length = 5; |
|
41 | 41 | $letters = 'aAbBCDeEFgGhHJKLmMnNpPqQRsStTuVwWXYZz2345679'; |
42 | 42 | $number = strlen($letters); |
43 | 43 | $string = ''; |
44 | -for($i = 0; $i < $length; $i++) |
|
44 | +for ($i = 0; $i < $length; $i++) |
|
45 | 45 | { |
46 | 46 | $string .= $letters{mt_rand(0, $number - 1)}; |
47 | 47 | } |
48 | 48 | //print $string; |
49 | 49 | |
50 | 50 | |
51 | -$sessionkey='dol_antispam_value'; |
|
52 | -$_SESSION[$sessionkey]=$string; |
|
51 | +$sessionkey = 'dol_antispam_value'; |
|
52 | +$_SESSION[$sessionkey] = $string; |
|
53 | 53 | |
54 | -$img = imagecreate(80,32); |
|
54 | +$img = imagecreate(80, 32); |
|
55 | 55 | if (empty($img)) |
56 | 56 | { |
57 | - dol_print_error('',"Problem with GD creation"); |
|
57 | + dol_print_error('', "Problem with GD creation"); |
|
58 | 58 | exit; |
59 | 59 | } |
60 | 60 |
@@ -8,58 +8,58 @@ |
||
8 | 8 | } |
9 | 9 | |
10 | 10 | // Add extra fields |
11 | -$sql="SELECT name, label, type, param, fieldcomputed, fielddefault FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = '".$keyforselect."' AND type != 'separate' AND entity IN (0, ".$conf->entity.')'; |
|
11 | +$sql = "SELECT name, label, type, param, fieldcomputed, fielddefault FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = '".$keyforselect."' AND type != 'separate' AND entity IN (0, ".$conf->entity.')'; |
|
12 | 12 | //print $sql; |
13 | -$resql=$this->db->query($sql); |
|
13 | +$resql = $this->db->query($sql); |
|
14 | 14 | if ($resql) // This can fail when class is used on old database (during migration for example) |
15 | 15 | { |
16 | - while ($obj=$this->db->fetch_object($resql)) |
|
16 | + while ($obj = $this->db->fetch_object($resql)) |
|
17 | 17 | { |
18 | - $fieldname=$keyforaliasextra.'.'.$obj->name; |
|
19 | - $fieldlabel=ucfirst($obj->label); |
|
20 | - $typeFilter="Text"; |
|
21 | - $typefield=preg_replace('/\(.*$/', '', $obj->type); // double(24,8) -> double |
|
18 | + $fieldname = $keyforaliasextra.'.'.$obj->name; |
|
19 | + $fieldlabel = ucfirst($obj->label); |
|
20 | + $typeFilter = "Text"; |
|
21 | + $typefield = preg_replace('/\(.*$/', '', $obj->type); // double(24,8) -> double |
|
22 | 22 | switch ($typefield) { |
23 | 23 | case 'int': |
24 | 24 | case 'integer': |
25 | 25 | case 'double': |
26 | 26 | case 'price': |
27 | - $typeFilter="Numeric"; |
|
27 | + $typeFilter = "Numeric"; |
|
28 | 28 | break; |
29 | 29 | case 'date': |
30 | 30 | case 'datetime': |
31 | 31 | case 'timestamp': |
32 | - $typeFilter="Date"; |
|
32 | + $typeFilter = "Date"; |
|
33 | 33 | break; |
34 | 34 | case 'boolean': |
35 | - $typeFilter="Boolean"; |
|
35 | + $typeFilter = "Boolean"; |
|
36 | 36 | break; |
37 | 37 | case 'sellist': |
38 | - $tmp=''; |
|
39 | - $tmpparam=unserialize($obj->param); // $tmp ay be array 'options' => array 'c_currencies:code_iso:code_iso' => null |
|
38 | + $tmp = ''; |
|
39 | + $tmpparam = unserialize($obj->param); // $tmp ay be array 'options' => array 'c_currencies:code_iso:code_iso' => null |
|
40 | 40 | if ($tmpparam['options'] && is_array($tmpparam['options'])) { |
41 | - $tmpkeys=array_keys($tmpparam['options']); |
|
42 | - $tmp=array_shift($tmpkeys); |
|
41 | + $tmpkeys = array_keys($tmpparam['options']); |
|
42 | + $tmp = array_shift($tmpkeys); |
|
43 | 43 | } |
44 | - if (preg_match('/[a-z0-9_]+:[a-z0-9_]+:[a-z0-9_]+/', $tmp)) $typeFilter="List:".$tmp; |
|
44 | + if (preg_match('/[a-z0-9_]+:[a-z0-9_]+:[a-z0-9_]+/', $tmp)) $typeFilter = "List:".$tmp; |
|
45 | 45 | break; |
46 | 46 | } |
47 | - if ($obj->type!='separate') |
|
47 | + if ($obj->type != 'separate') |
|
48 | 48 | { |
49 | 49 | // If not a computed field |
50 | 50 | if (empty($obj->fieldcomputed)) |
51 | 51 | { |
52 | - $this->export_fields_array[$r][$fieldname]=$fieldlabel; |
|
53 | - $this->export_TypeFields_array[$r][$fieldname]=$typeFilter; |
|
54 | - $this->export_entities_array[$r][$fieldname]=$keyforelement; |
|
52 | + $this->export_fields_array[$r][$fieldname] = $fieldlabel; |
|
53 | + $this->export_TypeFields_array[$r][$fieldname] = $typeFilter; |
|
54 | + $this->export_entities_array[$r][$fieldname] = $keyforelement; |
|
55 | 55 | } |
56 | 56 | // If this is a computed field |
57 | 57 | else |
58 | 58 | { |
59 | - $this->export_fields_array[$r][$fieldname]=$fieldlabel; |
|
60 | - $this->export_TypeFields_array[$r][$fieldname]=$typeFilter.'Compute'; |
|
61 | - $this->export_special_array[$r][$fieldname]=$obj->fieldcomputed; |
|
62 | - $this->export_entities_array[$r][$fieldname]=$keyforelement; |
|
59 | + $this->export_fields_array[$r][$fieldname] = $fieldlabel; |
|
60 | + $this->export_TypeFields_array[$r][$fieldname] = $typeFilter.'Compute'; |
|
61 | + $this->export_special_array[$r][$fieldname] = $obj->fieldcomputed; |
|
62 | + $this->export_entities_array[$r][$fieldname] = $keyforelement; |
|
63 | 63 | } |
64 | 64 | } |
65 | 65 | } |