@@ -51,10 +51,12 @@ discard block |
||
51 | 51 | { |
52 | 52 | // delivery link |
53 | 53 | $object->fetchObjectLinked($object->id,$object->element); |
54 | - if (count($object->linkedObjectsIds['delivery']) > 0) // If there is a delivery |
|
54 | + if (count($object->linkedObjectsIds['delivery']) > 0) { |
|
55 | + // If there is a delivery |
|
55 | 56 | { |
56 | 57 | // Take first one element of array |
57 | 58 | $tmp = reset($object->linkedObjectsIds['delivery']); |
59 | + } |
|
58 | 60 | |
59 | 61 | $head[$h][0] = DOL_URL_ROOT."/livraison/card.php?id=".$tmp; |
60 | 62 | $head[$h][1] = $langs->trans("DeliveryCard"); |
@@ -74,7 +76,9 @@ discard block |
||
74 | 76 | $nbContact = count($objectsrc->liste_contact(-1,'internal')) + count($objectsrc->liste_contact(-1,'external')); |
75 | 77 | $head[$h][0] = DOL_URL_ROOT."/expedition/contact.php?id=".$object->id; |
76 | 78 | $head[$h][1] = $langs->trans("ContactsAddresses"); |
77 | - if ($nbContact > 0) $head[$h][1].= ' <span class="badge">'.$nbContact.'</span>'; |
|
79 | + if ($nbContact > 0) { |
|
80 | + $head[$h][1].= ' <span class="badge">'.$nbContact.'</span>'; |
|
81 | + } |
|
78 | 82 | $head[$h][2] = 'contact'; |
79 | 83 | $h++; |
80 | 84 | } |
@@ -86,16 +90,24 @@ discard block |
||
86 | 90 | $nbLinks=Link::count($db, $object->element, $object->id); |
87 | 91 | $head[$h][0] = DOL_URL_ROOT.'/expedition/document.php?id='.$object->id; |
88 | 92 | $head[$h][1] = $langs->trans('Documents'); |
89 | - if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>'; |
|
93 | + if (($nbFiles+$nbLinks) > 0) { |
|
94 | + $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>'; |
|
95 | + } |
|
90 | 96 | $head[$h][2] = 'documents'; |
91 | 97 | $h++; |
92 | 98 | |
93 | 99 | $nbNote = 0; |
94 | - if (!empty($object->note_private)) $nbNote++; |
|
95 | - if (!empty($object->note_public)) $nbNote++; |
|
100 | + if (!empty($object->note_private)) { |
|
101 | + $nbNote++; |
|
102 | + } |
|
103 | + if (!empty($object->note_public)) { |
|
104 | + $nbNote++; |
|
105 | + } |
|
96 | 106 | $head[$h][0] = DOL_URL_ROOT."/expedition/note.php?id=".$object->id; |
97 | 107 | $head[$h][1] = $langs->trans("Notes"); |
98 | - if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>'; |
|
108 | + if ($nbNote > 0) { |
|
109 | + $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>'; |
|
110 | + } |
|
99 | 111 | $head[$h][2] = 'note'; |
100 | 112 | $h++; |
101 | 113 | |
@@ -199,7 +211,9 @@ discard block |
||
199 | 211 | $sql.= " AND obj.fk_".$origin." = ".$origin_id; |
200 | 212 | $sql.= " AND obj.rowid = ed.fk_origin_line"; |
201 | 213 | $sql.= " AND ed.fk_expedition = e.rowid"; |
202 | - if ($filter) $sql.= $filter; |
|
214 | + if ($filter) { |
|
215 | + $sql.= $filter; |
|
216 | + } |
|
203 | 217 | |
204 | 218 | $sql.= " ORDER BY obj.fk_product"; |
205 | 219 | |
@@ -212,8 +226,11 @@ discard block |
||
212 | 226 | |
213 | 227 | if ($num) |
214 | 228 | { |
215 | - if ($filter) print load_fiche_titre($langs->trans("OtherSendingsForSameOrder")); |
|
216 | - else print load_fiche_titre($langs->trans("SendingsAndReceivingForSameOrder")); |
|
229 | + if ($filter) { |
|
230 | + print load_fiche_titre($langs->trans("OtherSendingsForSameOrder")); |
|
231 | + } else { |
|
232 | + print load_fiche_titre($langs->trans("SendingsAndReceivingForSameOrder")); |
|
233 | + } |
|
217 | 234 | |
218 | 235 | print '<table class="liste" width="100%">'; |
219 | 236 | print '<tr class="liste_titre">'; |
@@ -268,8 +285,12 @@ discard block |
||
268 | 285 | |
269 | 286 | $outputlangs = $langs; |
270 | 287 | $newlang=''; |
271 | - if (empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id']; |
|
272 | - if (empty($newlang)) $newlang=$object->thirdparty->default_lang; |
|
288 | + if (empty($newlang) && ! empty($_REQUEST['lang_id'])) { |
|
289 | + $newlang=$_REQUEST['lang_id']; |
|
290 | + } |
|
291 | + if (empty($newlang)) { |
|
292 | + $newlang=$object->thirdparty->default_lang; |
|
293 | + } |
|
273 | 294 | if (! empty($newlang)) |
274 | 295 | { |
275 | 296 | $outputlangs = new Translate("",$conf); |
@@ -277,8 +298,7 @@ discard block |
||
277 | 298 | } |
278 | 299 | |
279 | 300 | $label = (! empty($prod->multilangs[$outputlangs->defaultlang]["label"])) ? $prod->multilangs[$outputlangs->defaultlang]["label"] : $objp->product_label; |
280 | - } |
|
281 | - else |
|
301 | + } else |
|
282 | 302 | { |
283 | 303 | $label = (! empty($objp->label)?$objp->label:$objp->product_label); |
284 | 304 | } |
@@ -305,12 +325,14 @@ discard block |
||
305 | 325 | } |
306 | 326 | |
307 | 327 | print '</td>'; |
308 | - } |
|
309 | - else |
|
328 | + } else |
|
310 | 329 | { |
311 | 330 | print "<td>"; |
312 | - if ($objp->fk_product_type==1) $text = img_object($langs->trans('Service'),'service'); |
|
313 | - else $text = img_object($langs->trans('Product'),'product'); |
|
331 | + if ($objp->fk_product_type==1) { |
|
332 | + $text = img_object($langs->trans('Service'),'service'); |
|
333 | + } else { |
|
334 | + $text = img_object($langs->trans('Product'),'product'); |
|
335 | + } |
|
314 | 336 | |
315 | 337 | if (! empty($objp->label)) { |
316 | 338 | $text.= ' <strong>'.$objp->label.'</strong>'; |
@@ -388,7 +410,10 @@ discard block |
||
388 | 410 | //var_dump($expedition->linkedObjects); |
389 | 411 | |
390 | 412 | $receiving=''; |
391 | - if (count($expedition->linkedObjects['delivery']) > 0) $receiving=reset($expedition->linkedObjects['delivery']); // Take first link |
|
413 | + if (count($expedition->linkedObjects['delivery']) > 0) { |
|
414 | + $receiving=reset($expedition->linkedObjects['delivery']); |
|
415 | + } |
|
416 | + // Take first link |
|
392 | 417 | |
393 | 418 | if (! empty($receiving)) |
394 | 419 | { |
@@ -412,8 +437,7 @@ discard block |
||
412 | 437 | print '<td align="right">'; |
413 | 438 | print dol_print_date($receiving->date_delivery,'day'); |
414 | 439 | print '</td>'; |
415 | - } |
|
416 | - else |
|
440 | + } else |
|
417 | 441 | { |
418 | 442 | //print '<td> </td>'; |
419 | 443 | print '<td> </td>'; |
@@ -427,8 +451,7 @@ discard block |
||
427 | 451 | print '</table>'; |
428 | 452 | } |
429 | 453 | $db->free($resql); |
430 | - } |
|
431 | - else |
|
454 | + } else |
|
432 | 455 | { |
433 | 456 | dol_print_error($db); |
434 | 457 | } |
@@ -60,17 +60,25 @@ |
||
60 | 60 | $nbContact = count($objectsrc->liste_contact(-1,'internal')) + count($objectsrc->liste_contact(-1,'external')); |
61 | 61 | $head[$h][0] = DOL_URL_ROOT."/reception/contact.php?id=".$object->id; |
62 | 62 | $head[$h][1] = $langs->trans("ContactsAddresses"); |
63 | - if ($nbContact > 0) $head[$h][1].= ' <span class="badge">'.$nbContact.'</span>'; |
|
63 | + if ($nbContact > 0) { |
|
64 | + $head[$h][1].= ' <span class="badge">'.$nbContact.'</span>'; |
|
65 | + } |
|
64 | 66 | $head[$h][2] = 'contact'; |
65 | 67 | $h++; |
66 | 68 | } |
67 | 69 | |
68 | 70 | $nbNote = 0; |
69 | - if (!empty($object->note_private)) $nbNote++; |
|
70 | - if (!empty($object->note_public)) $nbNote++; |
|
71 | + if (!empty($object->note_private)) { |
|
72 | + $nbNote++; |
|
73 | + } |
|
74 | + if (!empty($object->note_public)) { |
|
75 | + $nbNote++; |
|
76 | + } |
|
71 | 77 | $head[$h][0] = DOL_URL_ROOT."/reception/note.php?id=".$object->id; |
72 | 78 | $head[$h][1] = $langs->trans("Notes"); |
73 | - if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>'; |
|
79 | + if ($nbNote > 0) { |
|
80 | + $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>'; |
|
81 | + } |
|
74 | 82 | $head[$h][2] = 'note'; |
75 | 83 | $h++; |
76 | 84 |
@@ -52,18 +52,26 @@ |
||
52 | 52 | $nbLinks=Link::count($db, $object->element, $object->id); |
53 | 53 | $head[$h][0] = DOL_URL_ROOT.'/expensereport/document.php?id='.$object->id; |
54 | 54 | $head[$h][1] = $langs->trans('Documents'); |
55 | - if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>'; |
|
55 | + if (($nbFiles+$nbLinks) > 0) { |
|
56 | + $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>'; |
|
57 | + } |
|
56 | 58 | $head[$h][2] = 'documents'; |
57 | 59 | $h++; |
58 | 60 | |
59 | 61 | if (empty($conf->global->MAIN_DISABLE_NOTES_TAB)) |
60 | 62 | { |
61 | 63 | $nbNote = 0; |
62 | - if(!empty($object->note_private)) $nbNote++; |
|
63 | - if(!empty($object->note_public)) $nbNote++; |
|
64 | + if(!empty($object->note_private)) { |
|
65 | + $nbNote++; |
|
66 | + } |
|
67 | + if(!empty($object->note_public)) { |
|
68 | + $nbNote++; |
|
69 | + } |
|
64 | 70 | $head[$h][0] = DOL_URL_ROOT.'/expensereport/note.php?id='.$object->id; |
65 | 71 | $head[$h][1] = $langs->trans('Notes'); |
66 | - if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>'; |
|
72 | + if ($nbNote > 0) { |
|
73 | + $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>'; |
|
74 | + } |
|
67 | 75 | $head[$h][2] = 'note'; |
68 | 76 | $h++; |
69 | 77 | } |
@@ -50,12 +50,16 @@ discard block |
||
50 | 50 | foreach($fulltree as $key2 => $val2) |
51 | 51 | { |
52 | 52 | //print "x".$pos." ".$key2." ".$found." ".$fulltree[$key2]['level']; |
53 | - if ($found == 1) // We are after the entry to show |
|
53 | + if ($found == 1) { |
|
54 | + // We are after the entry to show |
|
54 | 55 | { |
55 | 56 | if ($fulltree[$key2]['level'] > $pos) |
56 | 57 | { |
57 | 58 | $nbofdirinsub++; |
58 | - if (isset($fulltree[$key2]['cachenbofdoc']) && $fulltree[$key2]['cachenbofdoc'] > 0) $nbofdocinsub+=$fulltree[$key2]['cachenbofdoc']; |
|
59 | + } |
|
60 | + if (isset($fulltree[$key2]['cachenbofdoc']) && $fulltree[$key2]['cachenbofdoc'] > 0) { |
|
61 | + $nbofdocinsub+=$fulltree[$key2]['cachenbofdoc']; |
|
62 | + } |
|
59 | 63 | } |
60 | 64 | if ($fulltree[$key2]['level'] == $pos) |
61 | 65 | { |
@@ -66,10 +70,12 @@ discard block |
||
66 | 70 | break; |
67 | 71 | } |
68 | 72 | } |
69 | - if ($key2 == $key) // We found ourself, so now every lower level will be counted |
|
73 | + if ($key2 == $key) { |
|
74 | + // We found ourself, so now every lower level will be counted |
|
70 | 75 | { |
71 | 76 | $found=1; |
72 | 77 | } |
78 | + } |
|
73 | 79 | } |
74 | 80 | //print $atleastoneofthislevelafter; |
75 | 81 | |
@@ -77,13 +83,18 @@ discard block |
||
77 | 83 | { |
78 | 84 | if ($atleastoneofthislevelafter) |
79 | 85 | { |
80 | - if ($fulltree[$key]['level'] == $pos) print img_picto_common('','treemenu/branch.gif'); |
|
81 | - else print img_picto_common('','treemenu/line.gif'); |
|
82 | - } |
|
83 | - else |
|
86 | + if ($fulltree[$key]['level'] == $pos) { |
|
87 | + print img_picto_common('','treemenu/branch.gif'); |
|
88 | + } else { |
|
89 | + print img_picto_common('','treemenu/line.gif'); |
|
90 | + } |
|
91 | + } else |
|
84 | 92 | { |
85 | - if ($fulltree[$key]['level'] == $pos) print img_picto_common('','treemenu/branchbottom.gif'); |
|
86 | - else print img_picto_common('','treemenu/linebottom.gif'); |
|
93 | + if ($fulltree[$key]['level'] == $pos) { |
|
94 | + print img_picto_common('','treemenu/branchbottom.gif'); |
|
95 | + } else { |
|
96 | + print img_picto_common('','treemenu/linebottom.gif'); |
|
97 | + } |
|
87 | 98 | } |
88 | 99 | } |
89 | 100 | $pos++; |
@@ -117,7 +128,9 @@ discard block |
||
117 | 128 | { |
118 | 129 | global $tree_recur_alreadyadded; |
119 | 130 | |
120 | - if ($rang == 0 && empty($donoresetalreadyloaded)) $tree_recur_alreadyadded=array(); |
|
131 | + if ($rang == 0 && empty($donoresetalreadyloaded)) { |
|
132 | + $tree_recur_alreadyadded=array(); |
|
133 | + } |
|
121 | 134 | |
122 | 135 | if ($rang == 0) |
123 | 136 | { |
@@ -174,8 +187,7 @@ discard block |
||
174 | 187 | print '</td><td align="right">'; |
175 | 188 | print $tab[$x]['buttons']; |
176 | 189 | print '</td></tr></table>'; |
177 | - } |
|
178 | - else |
|
190 | + } else |
|
179 | 191 | { |
180 | 192 | print $tab[$x]['entry']; |
181 | 193 | } |
@@ -184,8 +196,7 @@ discard block |
||
184 | 196 | // And now we search all its sons of lower level |
185 | 197 | tree_recur($tab, $tab[$x], $rang+1, 'iddivjstree', 0, $showfk); |
186 | 198 | print '</li>'; |
187 | - } |
|
188 | - elseif (! empty($tab[$x]['rowid']) && $tab[$x]['fk_menu'] == -1 && $tab[$x]['fk_mainmenu'] == $pere['mainmenu'] && $tab[$x]['fk_leftmenu'] == $pere['leftmenu']) |
|
199 | + } elseif (! empty($tab[$x]['rowid']) && $tab[$x]['fk_menu'] == -1 && $tab[$x]['fk_mainmenu'] == $pere['mainmenu'] && $tab[$x]['fk_leftmenu'] == $pere['leftmenu']) |
|
189 | 200 | { |
190 | 201 | //print 'rang='.$rang.'-x='.$x." rowid=".$tab[$x]['rowid']." tab[x]['fk_leftmenu'] = ".$tab[$x]['fk_leftmenu']." leftmenu pere = ".$pere['leftmenu']."<br>\n"; |
191 | 202 | if (empty($ulprinted) && ! empty($pere['rowid'])) |
@@ -210,8 +221,7 @@ discard block |
||
210 | 221 | print '</td><td align="right">'; |
211 | 222 | print $tab[$x]['buttons']; |
212 | 223 | print '</td></tr></table>'; |
213 | - } |
|
214 | - else |
|
224 | + } else |
|
215 | 225 | { |
216 | 226 | print $tab[$x]['entry']; |
217 | 227 | } |
@@ -225,6 +235,8 @@ discard block |
||
225 | 235 | } |
226 | 236 | if (! empty($ulprinted) && ! empty($pere['rowid'])) { print '</ul>'."\n"; } |
227 | 237 | |
228 | - if ($rang == 0) print '</ul>'; |
|
229 | -} |
|
238 | + if ($rang == 0) { |
|
239 | + print '</ul>'; |
|
240 | + } |
|
241 | + } |
|
230 | 242 |
@@ -53,7 +53,9 @@ discard block |
||
53 | 53 | $dolmemcache=new Memcached(); |
54 | 54 | $tmparray=explode(':',$conf->global->MEMCACHED_SERVER); |
55 | 55 | $result=$dolmemcache->addServer($tmparray[0], $tmparray[1]?$tmparray[1]:11211); |
56 | - if (! $result) return -1; |
|
56 | + if (! $result) { |
|
57 | + return -1; |
|
58 | + } |
|
57 | 59 | } |
58 | 60 | |
59 | 61 | $memoryid=session_name().'_'.$memoryid; |
@@ -63,13 +65,11 @@ discard block |
||
63 | 65 | if ($rescode == 0) |
64 | 66 | { |
65 | 67 | return count($data); |
66 | - } |
|
67 | - else |
|
68 | + } else |
|
68 | 69 | { |
69 | 70 | return -$rescode; |
70 | 71 | } |
71 | - } |
|
72 | - else if (! empty($conf->memcached->enabled) && class_exists('Memcache')) |
|
72 | + } else if (! empty($conf->memcached->enabled) && class_exists('Memcache')) |
|
73 | 73 | { |
74 | 74 | global $dolmemcache; |
75 | 75 | if (empty($dolmemcache) || ! is_object($dolmemcache)) |
@@ -77,7 +77,9 @@ discard block |
||
77 | 77 | $dolmemcache=new Memcache(); |
78 | 78 | $tmparray=explode(':',$conf->global->MEMCACHED_SERVER); |
79 | 79 | $result=$dolmemcache->addServer($tmparray[0], $tmparray[1]?$tmparray[1]:11211); |
80 | - if (! $result) return -1; |
|
80 | + if (! $result) { |
|
81 | + return -1; |
|
82 | + } |
|
81 | 83 | } |
82 | 84 | |
83 | 85 | $memoryid=session_name().'_'.$memoryid; |
@@ -86,8 +88,7 @@ discard block |
||
86 | 88 | if ($result) |
87 | 89 | { |
88 | 90 | return count($data); |
89 | - } |
|
90 | - else |
|
91 | + } else |
|
91 | 92 | { |
92 | 93 | return -1; |
93 | 94 | } |
@@ -120,7 +121,9 @@ discard block |
||
120 | 121 | $m=new Memcached(); |
121 | 122 | $tmparray=explode(':',$conf->global->MEMCACHED_SERVER); |
122 | 123 | $result=$m->addServer($tmparray[0], $tmparray[1]?$tmparray[1]:11211); |
123 | - if (! $result) return -1; |
|
124 | + if (! $result) { |
|
125 | + return -1; |
|
126 | + } |
|
124 | 127 | } |
125 | 128 | |
126 | 129 | $memoryid=session_name().'_'.$memoryid; |
@@ -133,13 +136,11 @@ discard block |
||
133 | 136 | if ($rescode == 0) |
134 | 137 | { |
135 | 138 | return $data; |
136 | - } |
|
137 | - else |
|
139 | + } else |
|
138 | 140 | { |
139 | 141 | return -$rescode; |
140 | 142 | } |
141 | - } |
|
142 | - else if (! empty($conf->memcached->enabled) && class_exists('Memcache')) |
|
143 | + } else if (! empty($conf->memcached->enabled) && class_exists('Memcache')) |
|
143 | 144 | { |
144 | 145 | global $m; |
145 | 146 | if (empty($m) || ! is_object($m)) |
@@ -147,7 +148,9 @@ discard block |
||
147 | 148 | $m=new Memcache(); |
148 | 149 | $tmparray=explode(':',$conf->global->MEMCACHED_SERVER); |
149 | 150 | $result=$m->addServer($tmparray[0], $tmparray[1]?$tmparray[1]:11211); |
150 | - if (! $result) return -1; |
|
151 | + if (! $result) { |
|
152 | + return -1; |
|
153 | + } |
|
151 | 154 | } |
152 | 155 | |
153 | 156 | $memoryid=session_name().'_'.$memoryid; |
@@ -158,8 +161,7 @@ discard block |
||
158 | 161 | if ($data) |
159 | 162 | { |
160 | 163 | return $data; |
161 | - } |
|
162 | - else |
|
164 | + } else |
|
163 | 165 | { |
164 | 166 | return -1; |
165 | 167 | } |
@@ -185,7 +187,9 @@ discard block |
||
185 | 187 | function dol_getshmopaddress($memoryid) |
186 | 188 | { |
187 | 189 | global $shmkeys,$shmoffset; |
188 | - if (empty($shmkeys[$memoryid])) return 0; |
|
190 | + if (empty($shmkeys[$memoryid])) { |
|
191 | + return 0; |
|
192 | + } |
|
189 | 193 | return $shmkeys[$memoryid]+$shmoffset; |
190 | 194 | } |
191 | 195 | |
@@ -202,7 +206,9 @@ discard block |
||
202 | 206 | foreach($shmkeys as $key => $val) |
203 | 207 | { |
204 | 208 | $result=dol_getshmop($key); |
205 | - if (! is_numeric($result) || $result > 0) $resarray[$key]=$result; |
|
209 | + if (! is_numeric($result) || $result > 0) { |
|
210 | + $resarray[$key]=$result; |
|
211 | + } |
|
206 | 212 | } |
207 | 213 | return $resarray; |
208 | 214 | } |
@@ -219,7 +225,9 @@ discard block |
||
219 | 225 | global $shmkeys,$shmoffset; |
220 | 226 | |
221 | 227 | //print 'dol_setshmop memoryid='.$memoryid."<br>\n"; |
222 | - if (empty($shmkeys[$memoryid]) || ! function_exists("shmop_write")) return 0; |
|
228 | + if (empty($shmkeys[$memoryid]) || ! function_exists("shmop_write")) { |
|
229 | + return 0; |
|
230 | + } |
|
223 | 231 | $shmkey=dol_getshmopaddress($memoryid); |
224 | 232 | $newdata=serialize($data); |
225 | 233 | $size=strlen($newdata); |
@@ -235,8 +243,7 @@ discard block |
||
235 | 243 | } |
236 | 244 | shmop_close($handle); |
237 | 245 | return ($shm_bytes_written1+$shm_bytes_written2); |
238 | - } |
|
239 | - else |
|
246 | + } else |
|
240 | 247 | { |
241 | 248 | print 'Error in shmop_open for memoryid='.$memoryid.' shmkey='.$shmkey.' 6+size=6+'.$size; |
242 | 249 | return -1; |
@@ -253,18 +260,22 @@ discard block |
||
253 | 260 | { |
254 | 261 | global $shmkeys,$shmoffset; |
255 | 262 | |
256 | - if (empty($shmkeys[$memoryid]) || ! function_exists("shmop_open")) return 0; |
|
263 | + if (empty($shmkeys[$memoryid]) || ! function_exists("shmop_open")) { |
|
264 | + return 0; |
|
265 | + } |
|
257 | 266 | $shmkey=dol_getshmopaddress($memoryid); |
258 | 267 | //print 'dol_getshmop memoryid='.$memoryid." shmkey=".$shmkey."<br>\n"; |
259 | 268 | $handle=@shmop_open($shmkey,'a',0,0); |
260 | 269 | if ($handle) |
261 | 270 | { |
262 | 271 | $size=trim(shmop_read($handle,0,6)); |
263 | - if ($size) $data=unserialize(shmop_read($handle,6,$size)); |
|
264 | - else return -1; |
|
272 | + if ($size) { |
|
273 | + $data=unserialize(shmop_read($handle,6,$size)); |
|
274 | + } else { |
|
275 | + return -1; |
|
276 | + } |
|
265 | 277 | shmop_close($handle); |
266 | - } |
|
267 | - else |
|
278 | + } else |
|
268 | 279 | { |
269 | 280 | return -2; |
270 | 281 | } |
@@ -38,7 +38,9 @@ discard block |
||
38 | 38 | |
39 | 39 | dol_syslog("xcal.lib.php::build_calfile Build cal file ".$outputfile." to format ".$format); |
40 | 40 | |
41 | - if (empty($outputfile)) return -1; |
|
41 | + if (empty($outputfile)) { |
|
42 | + return -1; |
|
43 | + } |
|
42 | 44 | |
43 | 45 | // Note: A cal file is an UTF8 encoded file |
44 | 46 | $calfileh=fopen($outputfile,'w'); |
@@ -48,7 +50,9 @@ discard block |
||
48 | 50 | $now=dol_now(); |
49 | 51 | |
50 | 52 | $encoding=''; |
51 | - if ($format == 'vcal') $encoding='ENCODING=QUOTED-PRINTABLE:'; |
|
53 | + if ($format == 'vcal') { |
|
54 | + $encoding='ENCODING=QUOTED-PRINTABLE:'; |
|
55 | + } |
|
52 | 56 | |
53 | 57 | // Print header |
54 | 58 | fwrite($calfileh,"BEGIN:VCALENDAR\n"); |
@@ -152,8 +156,12 @@ discard block |
||
152 | 156 | fwrite($calfileh,"URL:".$url."\n"); |
153 | 157 | }; |
154 | 158 | |
155 | - if ($created) fwrite($calfileh,"CREATED:".dol_print_date($created,'dayhourxcard',true)."\n"); |
|
156 | - if ($modified) fwrite($calfileh,"LAST-MODIFIED:".dol_print_date($modified,'dayhourxcard',true)."\n"); |
|
159 | + if ($created) { |
|
160 | + fwrite($calfileh,"CREATED:".dol_print_date($created,'dayhourxcard',true)."\n"); |
|
161 | + } |
|
162 | + if ($modified) { |
|
163 | + fwrite($calfileh,"LAST-MODIFIED:".dol_print_date($modified,'dayhourxcard',true)."\n"); |
|
164 | + } |
|
157 | 165 | fwrite($calfileh,"SUMMARY:".$encoding.$summary."\n"); |
158 | 166 | fwrite($calfileh,"DESCRIPTION:".$encoding.$description."\n"); |
159 | 167 | |
@@ -178,9 +186,15 @@ discard block |
||
178 | 186 | //fwrite($calfileh,"X-MICROSOFT-CDO-BUSYSTATUS:1\n"); |
179 | 187 | //ATTENDEE;CUTYPE=INDIVIDUAL;ROLE=REQ-PARTICIPANT;PARTSTAT=ACCEPTED;CN=Laurent Destailleur;X-NUM-GUESTS=0:mailto:[email protected] |
180 | 188 | |
181 | - if (! empty($location)) fwrite($calfileh,"LOCATION:".$encoding.$location."\n"); |
|
182 | - if ($fulldayevent) fwrite($calfileh,"X-FUNAMBOL-ALLDAY:1\n"); |
|
183 | - if ($fulldayevent) fwrite($calfileh,"X-MICROSOFT-CDO-ALLDAYEVENT:1\n"); |
|
189 | + if (! empty($location)) { |
|
190 | + fwrite($calfileh,"LOCATION:".$encoding.$location."\n"); |
|
191 | + } |
|
192 | + if ($fulldayevent) { |
|
193 | + fwrite($calfileh,"X-FUNAMBOL-ALLDAY:1\n"); |
|
194 | + } |
|
195 | + if ($fulldayevent) { |
|
196 | + fwrite($calfileh,"X-MICROSOFT-CDO-ALLDAYEVENT:1\n"); |
|
197 | + } |
|
184 | 198 | |
185 | 199 | // Date must be GMT dates |
186 | 200 | // Current date |
@@ -197,11 +211,14 @@ discard block |
||
197 | 211 | // End date |
198 | 212 | if ($fulldayevent) |
199 | 213 | { |
200 | - if (empty($enddate)) $enddate=dol_time_plus_duree($startdate,1,'d'); |
|
201 | - } |
|
202 | - else |
|
214 | + if (empty($enddate)) { |
|
215 | + $enddate=dol_time_plus_duree($startdate,1,'d'); |
|
216 | + } |
|
217 | + } else |
|
203 | 218 | { |
204 | - if (empty($enddate)) $enddate=$startdate+$duration; |
|
219 | + if (empty($enddate)) { |
|
220 | + $enddate=$startdate+$duration; |
|
221 | + } |
|
205 | 222 | } |
206 | 223 | $prefix=''; |
207 | 224 | $enddatef = dol_print_date($enddate,'dayhourxcard',true); |
@@ -213,8 +230,12 @@ discard block |
||
213 | 230 | } |
214 | 231 | fwrite($calfileh,"DTEND".$prefix.":".$enddatef."\n"); |
215 | 232 | fwrite($calfileh,'STATUS:CONFIRMED'."\n"); |
216 | - if (! empty($transparency)) fwrite($calfileh,"TRANSP:".$transparency."\n"); |
|
217 | - if (! empty($category)) fwrite($calfileh,"CATEGORIES:".$encoding.$category."\n"); |
|
233 | + if (! empty($transparency)) { |
|
234 | + fwrite($calfileh,"TRANSP:".$transparency."\n"); |
|
235 | + } |
|
236 | + if (! empty($category)) { |
|
237 | + fwrite($calfileh,"CATEGORIES:".$encoding.$category."\n"); |
|
238 | + } |
|
218 | 239 | fwrite($calfileh,"END:VEVENT\n"); |
219 | 240 | } |
220 | 241 | |
@@ -237,8 +258,12 @@ discard block |
||
237 | 258 | fwrite($calfileh,"URL:".$url."\n"); |
238 | 259 | }; |
239 | 260 | |
240 | - if ($created) fwrite($calfileh,"CREATED:".dol_print_date($created,'dayhourxcard',true)."\n"); |
|
241 | - if ($modified) fwrite($calfileh,"LAST-MODIFIED:".dol_print_date($modified,'dayhourxcard',true)."\n"); |
|
261 | + if ($created) { |
|
262 | + fwrite($calfileh,"CREATED:".dol_print_date($created,'dayhourxcard',true)."\n"); |
|
263 | + } |
|
264 | + if ($modified) { |
|
265 | + fwrite($calfileh,"LAST-MODIFIED:".dol_print_date($modified,'dayhourxcard',true)."\n"); |
|
266 | + } |
|
242 | 267 | fwrite($calfileh,"SUMMARY:".$encoding.$summary."\n"); |
243 | 268 | fwrite($calfileh,"DESCRIPTION:".$encoding.$description."\n"); |
244 | 269 | fwrite($calfileh,'STATUS:CONFIRMED'."\n"); |
@@ -270,10 +295,10 @@ discard block |
||
270 | 295 | fwrite($calfileh,"END:VCALENDAR"); |
271 | 296 | |
272 | 297 | fclose($calfileh); |
273 | - if (! empty($conf->global->MAIN_UMASK)) |
|
274 | - @chmod($outputfile, octdec($conf->global->MAIN_UMASK)); |
|
275 | - } |
|
276 | - else |
|
298 | + if (! empty($conf->global->MAIN_UMASK)) { |
|
299 | + @chmod($outputfile, octdec($conf->global->MAIN_UMASK)); |
|
300 | + } |
|
301 | + } else |
|
277 | 302 | { |
278 | 303 | dol_syslog("xcal.lib.php::build_calfile Failed to open file ".$outputfile." for writing"); |
279 | 304 | return -2; |
@@ -299,7 +324,9 @@ discard block |
||
299 | 324 | |
300 | 325 | dol_syslog("xcal.lib.php::build_rssfile Build rss file ".$outputfile." to format ".$format); |
301 | 326 | |
302 | - if (empty($outputfile)) return -1; |
|
327 | + if (empty($outputfile)) { |
|
328 | + return -1; |
|
329 | + } |
|
303 | 330 | |
304 | 331 | $fichier=fopen($outputfile,'w'); |
305 | 332 | if ($fichier) |
@@ -367,7 +394,9 @@ discard block |
||
367 | 394 | fwrite($fichier, "<author><![CDATA[".$author."]]></author>\n"); |
368 | 395 | fwrite($fichier, "<category><![CDATA[".$category."]]></category>\n"); |
369 | 396 | fwrite($fichier, "<description><![CDATA["); |
370 | - if ($description) fwrite($fichier, $description); |
|
397 | + if ($description) { |
|
398 | + fwrite($fichier, $description); |
|
399 | + } |
|
371 | 400 | //else fwrite($fichier, 'NoDesc'); |
372 | 401 | fwrite($fichier, "]]></description>\n"); |
373 | 402 | fwrite($fichier, "<pubDate>".date("r", $startdate)."</pubDate>\n"); |
@@ -382,8 +411,9 @@ discard block |
||
382 | 411 | fwrite($fichier, '</rss>'); |
383 | 412 | |
384 | 413 | fclose($fichier); |
385 | - if (! empty($conf->global->MAIN_UMASK)) |
|
386 | - @chmod($outputfile, octdec($conf->global->MAIN_UMASK)); |
|
414 | + if (! empty($conf->global->MAIN_UMASK)) { |
|
415 | + @chmod($outputfile, octdec($conf->global->MAIN_UMASK)); |
|
416 | + } |
|
387 | 417 | } |
388 | 418 | } |
389 | 419 | |
@@ -447,8 +477,7 @@ discard block |
||
447 | 477 | $newpara .= $char; |
448 | 478 | } |
449 | 479 | $out .= $newpara; |
450 | - } |
|
451 | - else |
|
480 | + } else |
|
452 | 481 | { |
453 | 482 | $strlength=dol_strlen($line); |
454 | 483 | for ($j = 0; $j <= ($strlength - 1); $j++) |
@@ -491,13 +520,20 @@ discard block |
||
491 | 520 | $char = substr($line, $j, 1); |
492 | 521 | $ascii = ord($char); |
493 | 522 | |
494 | - if ( $ascii < 32 || $ascii == 61 || $ascii > 126 ) |
|
495 | - $char = '=' . strtoupper(sprintf("%02X", $ascii)); |
|
523 | + if ( $ascii < 32 || $ascii == 61 || $ascii > 126 ) { |
|
524 | + $char = '=' . strtoupper(sprintf("%02X", $ascii)); |
|
525 | + } |
|
496 | 526 | |
497 | - if ((strlen($newpara) + strlen($char)) >= 76 ) // Do not use dol_strlen here, we need number of bytes |
|
527 | + if ((strlen($newpara) + strlen($char)) >= 76 ) { |
|
528 | + // Do not use dol_strlen here, we need number of bytes |
|
498 | 529 | { |
499 | - $out .= $newpara . '=' . "\r\n"; // CRLF |
|
500 | - if ($forcal) $out .= " "; // + Space for cal |
|
530 | + $out .= $newpara . '=' . "\r\n"; |
|
531 | + } |
|
532 | + // CRLF |
|
533 | + if ($forcal) { |
|
534 | + $out .= " "; |
|
535 | + } |
|
536 | + // + Space for cal |
|
501 | 537 | $newpara = ''; |
502 | 538 | } |
503 | 539 | $newpara .= $char; |
@@ -81,7 +81,9 @@ |
||
81 | 81 | $nbContact = count($object->liste_contact(-1,'internal')) + count($object->liste_contact(-1,'external')); |
82 | 82 | $head[$h][0] = DOL_URL_ROOT.'/ticket/contact.php?track_id='.$object->track_id; |
83 | 83 | $head[$h][1] = $langs->trans('ContactsAddresses'); |
84 | - if ($nbContact > 0) $head[$h][1].= ' <span class="badge">'.$nbContact.'</span>'; |
|
84 | + if ($nbContact > 0) { |
|
85 | + $head[$h][1].= ' <span class="badge">'.$nbContact.'</span>'; |
|
86 | + } |
|
85 | 87 | $head[$h][2] = 'contact'; |
86 | 88 | $h++; |
87 | 89 | } |
@@ -103,7 +103,9 @@ discard block |
||
103 | 103 | print '<br>'; |
104 | 104 | |
105 | 105 | $logintouse = 'firstadmin'; |
106 | - if ($user->admin) $logintouse = $user->login; |
|
106 | + if ($user->admin) { |
|
107 | + $logintouse = $user->login; |
|
108 | + } |
|
107 | 109 | |
108 | 110 | print '<u>'.$langs->trans("FileToLaunchCronJobs").':</u><br>'; |
109 | 111 | |
@@ -115,16 +117,19 @@ discard block |
||
115 | 117 | if (empty($conf->global->CRON_DISABLE_TUTORIAL_CRON)) |
116 | 118 | { |
117 | 119 | $linuxlike=1; |
118 | - if (preg_match('/^win/i',PHP_OS)) $linuxlike=0; |
|
119 | - if (preg_match('/^mac/i',PHP_OS)) $linuxlike=0; |
|
120 | + if (preg_match('/^win/i',PHP_OS)) { |
|
121 | + $linuxlike=0; |
|
122 | + } |
|
123 | + if (preg_match('/^mac/i',PHP_OS)) { |
|
124 | + $linuxlike=0; |
|
125 | + } |
|
120 | 126 | print $langs->trans("Note").': '; |
121 | 127 | if ($linuxlike) |
122 | 128 | { |
123 | 129 | print $langs->trans("CronExplainHowToRunUnix"); |
124 | 130 | print '<br>'; |
125 | 131 | print '<textarea class="quatrevingtpercent">*/5 * * * * pathtoscript/scripts/cron/cron_run_jobs.php '.(empty($conf->global->CRON_KEY)?'securitykey':''.$conf->global->CRON_KEY.'').' '.$logintouse.' > '.DOL_DATA_ROOT.'/cron_run_jobs.php.log</textarea><br>'; |
126 | - } |
|
127 | - else |
|
132 | + } else |
|
128 | 133 | { |
129 | 134 | print $langs->trans("CronExplainHowToRunWin"); |
130 | 135 | } |
@@ -42,11 +42,15 @@ discard block |
||
42 | 42 | { |
43 | 43 | global $langs; |
44 | 44 | |
45 | - if (empty($hselected)) $hselected='report'; |
|
45 | + if (empty($hselected)) { |
|
46 | + $hselected='report'; |
|
47 | + } |
|
46 | 48 | |
47 | 49 | print "\n\n<!-- start banner of report -->\n"; |
48 | 50 | |
49 | - if(! empty($varlink)) $varlink = '?'.$varlink; |
|
51 | + if(! empty($varlink)) { |
|
52 | + $varlink = '?'.$varlink; |
|
53 | + } |
|
50 | 54 | |
51 | 55 | $h=0; |
52 | 56 | $head[$h][0] = $_SERVER["PHP_SELF"].$varlink; |
@@ -71,7 +75,9 @@ discard block |
||
71 | 75 | print '<td>'; |
72 | 76 | print $reportname; |
73 | 77 | print '</td>'; |
74 | - if ($variante) print '<td></td>'; |
|
78 | + if ($variante) { |
|
79 | + print '<td></td>'; |
|
80 | + } |
|
75 | 81 | print '</tr>'; |
76 | 82 | |
77 | 83 | // Calculation mode |
@@ -81,7 +87,9 @@ discard block |
||
81 | 87 | print '<td width="110">'.$langs->trans("CalculationMode").'</td>'; |
82 | 88 | print '<td>'; |
83 | 89 | print $calcmode; |
84 | - if ($variante) print '<td></td>'; |
|
90 | + if ($variante) { |
|
91 | + print '<td></td>'; |
|
92 | + } |
|
85 | 93 | print '</td>'; |
86 | 94 | print '</tr>'; |
87 | 95 | } |
@@ -90,8 +98,12 @@ discard block |
||
90 | 98 | print '<tr>'; |
91 | 99 | print '<td>'.$langs->trans("ReportPeriod").'</td>'; |
92 | 100 | print '<td>'; |
93 | - if ($period) print $period; |
|
94 | - if ($variante) print '<td class="nowraponall">'.$periodlink.'</td>'; |
|
101 | + if ($period) { |
|
102 | + print $period; |
|
103 | + } |
|
104 | + if ($variante) { |
|
105 | + print '<td class="nowraponall">'.$periodlink.'</td>'; |
|
106 | + } |
|
95 | 107 | print '</td>'; |
96 | 108 | print '</tr>'; |
97 | 109 | |
@@ -99,7 +111,9 @@ discard block |
||
99 | 111 | print '<tr>'; |
100 | 112 | print '<td>'.$langs->trans("ReportDescription").'</td>'; |
101 | 113 | print '<td>'.$description.'</td>'; |
102 | - if ($variante) print '<td></td>'; |
|
114 | + if ($variante) { |
|
115 | + print '<td></td>'; |
|
116 | + } |
|
103 | 117 | print '</tr>'; |
104 | 118 | |
105 | 119 | // Ligne d'export |
@@ -108,7 +122,9 @@ discard block |
||
108 | 122 | print '<td>'; |
109 | 123 | print dol_print_date($builddate, 'dayhour'); |
110 | 124 | print '</td>'; |
111 | - if ($variante) print '<td>'.($exportlink ? $langs->trans("Export").': '.$exportlink : '').'</td>'; |
|
125 | + if ($variante) { |
|
126 | + print '<td>'.($exportlink ? $langs->trans("Export").': '.$exportlink : '').'</td>'; |
|
127 | + } |
|
112 | 128 | print '</tr>'; |
113 | 129 | |
114 | 130 | print '</table>'; |