@@ -46,19 +46,36 @@ discard block |
||
46 | 46 | $usemargins=1; |
47 | 47 | } |
48 | 48 | |
49 | -if (! isset($dateSelector)) global $dateSelector; // Take global var only if not already defined into function calling (for example formAddObjectLine) |
|
49 | +if (! isset($dateSelector)) { |
|
50 | + global $dateSelector; |
|
51 | +} |
|
52 | +// Take global var only if not already defined into function calling (for example formAddObjectLine) |
|
50 | 53 | global $forceall, $forcetoshowtitlelines, $senderissupplier, $inputalsopricewithtax; |
51 | 54 | |
52 | -if (! isset($dateSelector)) $dateSelector=1; // For backward compatibility |
|
53 | -elseif (empty($dateSelector)) $dateSelector=0; |
|
54 | -if (empty($forceall)) $forceall=0; |
|
55 | -if (empty($senderissupplier)) $senderissupplier=0; |
|
56 | -if (empty($inputalsopricewithtax)) $inputalsopricewithtax=0; |
|
55 | +if (! isset($dateSelector)) { |
|
56 | + $dateSelector=1; |
|
57 | +} |
|
58 | +// For backward compatibility |
|
59 | +elseif (empty($dateSelector)) { |
|
60 | + $dateSelector=0; |
|
61 | +} |
|
62 | +if (empty($forceall)) { |
|
63 | + $forceall=0; |
|
64 | +} |
|
65 | +if (empty($senderissupplier)) { |
|
66 | + $senderissupplier=0; |
|
67 | +} |
|
68 | +if (empty($inputalsopricewithtax)) { |
|
69 | + $inputalsopricewithtax=0; |
|
70 | +} |
|
57 | 71 | |
58 | 72 | |
59 | 73 | // Define colspan for button Add |
60 | 74 | $colspan = 3; // Col total ht + col edit + col delete |
61 | -if (in_array($object->element,array('propal','commande','order','facture','facturerec','invoice','supplier_proposal','order_supplier','invoice_supplier'))) $colspan++; // With this, there is a column move button |
|
75 | +if (in_array($object->element,array('propal','commande','order','facture','facturerec','invoice','supplier_proposal','order_supplier','invoice_supplier'))) { |
|
76 | + $colspan++; |
|
77 | +} |
|
78 | +// With this, there is a column move button |
|
62 | 79 | //print $object->element; |
63 | 80 | |
64 | 81 | // Lines for extrafield |
@@ -67,26 +84,19 @@ discard block |
||
67 | 84 | { |
68 | 85 | if ($this->table_element_line=='commandedet') { |
69 | 86 | $objectline = new OrderLine($this->db); |
70 | - } |
|
71 | - elseif ($this->table_element_line=='propaldet') { |
|
87 | + } elseif ($this->table_element_line=='propaldet') { |
|
72 | 88 | $objectline = new PropaleLigne($this->db); |
73 | - } |
|
74 | - elseif ($this->table_element_line=='supplier_proposaldet') { |
|
89 | + } elseif ($this->table_element_line=='supplier_proposaldet') { |
|
75 | 90 | $objectline = new SupplierProposalLine($this->db); |
76 | - } |
|
77 | - elseif ($this->table_element_line=='facturedet') { |
|
91 | + } elseif ($this->table_element_line=='facturedet') { |
|
78 | 92 | $objectline = new FactureLigne($this->db); |
79 | - } |
|
80 | - elseif ($this->table_element_line=='contratdet') { |
|
93 | + } elseif ($this->table_element_line=='contratdet') { |
|
81 | 94 | $objectline = new ContratLigne($this->db); |
82 | - } |
|
83 | - elseif ($this->table_element_line=='commande_fournisseurdet') { |
|
95 | + } elseif ($this->table_element_line=='commande_fournisseurdet') { |
|
84 | 96 | $objectline = new CommandeFournisseurLigne($this->db); |
85 | - } |
|
86 | - elseif ($this->table_element_line=='facture_fourn_det') { |
|
97 | + } elseif ($this->table_element_line=='facture_fourn_det') { |
|
87 | 98 | $objectline = new SupplierInvoiceLine($this->db); |
88 | - } |
|
89 | - elseif ($this->table_element_line=='facturedet_rec') { |
|
99 | + } elseif ($this->table_element_line=='facturedet_rec') { |
|
90 | 100 | $objectline = new FactureLigneRec($this->db); |
91 | 101 | } |
92 | 102 | } |
@@ -106,10 +116,13 @@ discard block |
||
106 | 116 | <div id="add"></div><span class="hideonsmartphone"><?php echo $langs->trans('AddNewLine'); ?></span><?php // echo $langs->trans("FreeZone"); ?> |
107 | 117 | </td> |
108 | 118 | <?php |
109 | - if ($object->element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier') // We must have same test in printObjectLines |
|
119 | + if ($object->element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier') { |
|
120 | + // We must have same test in printObjectLines |
|
110 | 121 | { |
111 | 122 | ?> |
112 | - <td class="linecolrefsupplier"><span id="title_fourn_ref"><?php echo $langs->trans('SupplierRef'); ?></span></td> |
|
123 | + <td class="linecolrefsupplier"><span id="title_fourn_ref"><?php echo $langs->trans('SupplierRef'); |
|
124 | + } |
|
125 | + ?></span></td> |
|
113 | 126 | <?php } ?> |
114 | 127 | <td class="linecolvat" align="right"><span id="title_vat"><?php echo $langs->trans('VAT'); ?></span></td> |
115 | 128 | <td class="linecoluht" align="right"><span id="title_up_ht"><?php echo $langs->trans('PriceUHT'); ?></span></td> |
@@ -140,18 +153,24 @@ discard block |
||
140 | 153 | ?> |
141 | 154 | <td align="right" class="margininfos linecolmargin1"> |
142 | 155 | <?php |
156 | + } else { |
|
157 | + $colspan++; |
|
143 | 158 | } |
144 | - else $colspan++; |
|
145 | 159 | |
146 | - if ($conf->global->MARGIN_TYPE == "1") |
|
147 | - echo $langs->trans('BuyingPrice'); |
|
148 | - else |
|
149 | - echo $langs->trans('CostPrice'); |
|
160 | + if ($conf->global->MARGIN_TYPE == "1") { |
|
161 | + echo $langs->trans('BuyingPrice'); |
|
162 | + } else { |
|
163 | + echo $langs->trans('CostPrice'); |
|
164 | + } |
|
150 | 165 | ?> |
151 | 166 | </td> |
152 | 167 | <?php |
153 | - if ($user->rights->margins->creer && ! empty($conf->global->DISPLAY_MARGIN_RATES)) echo '<td align="right" class="margininfos linecolmargin2"><span class="np_marginRate">'.$langs->trans('MarginRate').'</span></td>'; |
|
154 | - if ($user->rights->margins->creer && ! empty($conf->global->DISPLAY_MARK_RATES)) echo '<td align="right" class="margininfos linecolmargin2"><span class="np_markRate">'.$langs->trans('MarkRate').'</span></td>'; |
|
168 | + if ($user->rights->margins->creer && ! empty($conf->global->DISPLAY_MARGIN_RATES)) { |
|
169 | + echo '<td align="right" class="margininfos linecolmargin2"><span class="np_marginRate">'.$langs->trans('MarginRate').'</span></td>'; |
|
170 | + } |
|
171 | + if ($user->rights->margins->creer && ! empty($conf->global->DISPLAY_MARK_RATES)) { |
|
172 | + echo '<td align="right" class="margininfos linecolmargin2"><span class="np_markRate">'.$langs->trans('MarkRate').'</span></td>'; |
|
173 | + } |
|
155 | 174 | } |
156 | 175 | ?> |
157 | 176 | <td class="linecoledit" colspan="<?php echo $colspan; ?>"> </td> |
@@ -167,8 +186,7 @@ discard block |
||
167 | 186 | ?> |
168 | 187 | <td class="nobottom linecolnum" align="center" width="5"></td> |
169 | 188 | <?php |
170 | -} |
|
171 | -else { |
|
189 | +} else { |
|
172 | 190 | $coldisplay=0; |
173 | 191 | } |
174 | 192 | ?> |
@@ -184,8 +202,13 @@ discard block |
||
184 | 202 | $forceall=1; // We always force all type for free lines (module product or service means we use predefined product or service) |
185 | 203 | if ($object->element == 'contrat') |
186 | 204 | { |
187 | - if (empty($conf->product->enabled) && empty($conf->service->enabled) && empty($conf->global->CONTRACT_SUPPORT_PRODUCTS)) $forceall=-1; // With contract, by default, no choice at all, except if CONTRACT_SUPPORT_PRODUCTS is set |
|
188 | - else if (empty($conf->global->CONTRACT_SUPPORT_PRODUCTS)) $forceall=3; |
|
205 | + if (empty($conf->product->enabled) && empty($conf->service->enabled) && empty($conf->global->CONTRACT_SUPPORT_PRODUCTS)) { |
|
206 | + $forceall=-1; |
|
207 | + } |
|
208 | + // With contract, by default, no choice at all, except if CONTRACT_SUPPORT_PRODUCTS is set |
|
209 | + else if (empty($conf->global->CONTRACT_SUPPORT_PRODUCTS)) { |
|
210 | + $forceall=3; |
|
211 | + } |
|
189 | 212 | } |
190 | 213 | |
191 | 214 | // Free line |
@@ -202,15 +225,17 @@ discard block |
||
202 | 225 | echo $langs->trans("FreeLineOfType"); |
203 | 226 | echo '</label>'; |
204 | 227 | echo ' '; |
205 | - } |
|
206 | - else |
|
228 | + } else |
|
207 | 229 | { |
208 | 230 | echo '<input type="hidden" id="prod_entry_mode_free" name="prod_entry_mode" value="free">'; |
209 | 231 | // Show type selector |
210 | 232 | if ($forceall >= 0) |
211 | 233 | { |
212 | - if (empty($conf->product->enabled) || empty($conf->service->enabled)) echo $langs->trans("Type"); |
|
213 | - else echo $langs->trans("FreeLineOfType"); |
|
234 | + if (empty($conf->product->enabled) || empty($conf->service->enabled)) { |
|
235 | + echo $langs->trans("Type"); |
|
236 | + } else { |
|
237 | + echo $langs->trans("FreeLineOfType"); |
|
238 | + } |
|
214 | 239 | echo ' '; |
215 | 240 | } |
216 | 241 | } |
@@ -223,27 +248,38 @@ discard block |
||
223 | 248 | // Predefined product/service |
224 | 249 | if (! empty($conf->product->enabled) || ! empty($conf->service->enabled)) |
225 | 250 | { |
226 | - if ($forceall >= 0 && $freelines) echo '<br>'; |
|
251 | + if ($forceall >= 0 && $freelines) { |
|
252 | + echo '<br>'; |
|
253 | + } |
|
227 | 254 | echo '<span class="prod_entry_mode_predef">'; |
228 | 255 | echo '<label for="prod_entry_mode_predef">'; |
229 | 256 | echo '<input type="radio" class="prod_entry_mode_predef" name="prod_entry_mode" id="prod_entry_mode_predef" value="predef"'.(GETPOST('prod_entry_mode')=='predef'?' checked':'').'> '; |
230 | 257 | if (empty($senderissupplier)) |
231 | 258 | { |
232 | - if (! empty($conf->product->enabled) && empty($conf->service->enabled)) echo $langs->trans('PredefinedProductsToSell'); |
|
233 | - else if ((empty($conf->product->enabled) && ! empty($conf->service->enabled)) || ($object->element == 'contrat' && empty($conf->global->CONTRACT_SUPPORT_PRODUCTS))) echo $langs->trans('PredefinedServicesToSell'); |
|
234 | - else echo $langs->trans('PredefinedProductsAndServicesToSell'); |
|
235 | - } |
|
236 | - else |
|
259 | + if (! empty($conf->product->enabled) && empty($conf->service->enabled)) { |
|
260 | + echo $langs->trans('PredefinedProductsToSell'); |
|
261 | + } else if ((empty($conf->product->enabled) && ! empty($conf->service->enabled)) || ($object->element == 'contrat' && empty($conf->global->CONTRACT_SUPPORT_PRODUCTS))) { |
|
262 | + echo $langs->trans('PredefinedServicesToSell'); |
|
263 | + } else { |
|
264 | + echo $langs->trans('PredefinedProductsAndServicesToSell'); |
|
265 | + } |
|
266 | + } else |
|
237 | 267 | { |
238 | - if (! empty($conf->product->enabled) && empty($conf->service->enabled)) echo $langs->trans('PredefinedProductsToPurchase'); |
|
239 | - else if (empty($conf->product->enabled) && ! empty($conf->service->enabled)) echo $langs->trans('PredefinedServicesToPurchase'); |
|
240 | - else echo $langs->trans('PredefinedProductsAndServicesToPurchase'); |
|
268 | + if (! empty($conf->product->enabled) && empty($conf->service->enabled)) { |
|
269 | + echo $langs->trans('PredefinedProductsToPurchase'); |
|
270 | + } else if (empty($conf->product->enabled) && ! empty($conf->service->enabled)) { |
|
271 | + echo $langs->trans('PredefinedServicesToPurchase'); |
|
272 | + } else { |
|
273 | + echo $langs->trans('PredefinedProductsAndServicesToPurchase'); |
|
274 | + } |
|
241 | 275 | } |
242 | 276 | echo '</label>'; |
243 | 277 | echo ' '; |
244 | 278 | |
245 | 279 | $filtertype=''; |
246 | - if (! empty($object->element) && $object->element == 'contrat' && empty($conf->global->CONTRACT_SUPPORT_PRODUCTS)) $filtertype='1'; |
|
280 | + if (! empty($object->element) && $object->element == 'contrat' && empty($conf->global->CONTRACT_SUPPORT_PRODUCTS)) { |
|
281 | + $filtertype='1'; |
|
282 | + } |
|
247 | 283 | |
248 | 284 | if (empty($senderissupplier)) |
249 | 285 | { |
@@ -251,13 +287,11 @@ discard block |
||
251 | 287 | { |
252 | 288 | // hide products in closed warehouse, but show products for internal transfer |
253 | 289 | $form->select_produits(GETPOST('idprod'), 'idprod', $filtertype, $conf->product->limit_size, $buyer->price_level, 1, 2, '', 1, array(), $buyer->id, '1', 0, 'maxwidth300', 0, 'warehouseopen,warehouseinternal', GETPOST('combinations', 'array')); |
254 | - } |
|
255 | - else |
|
290 | + } else |
|
256 | 291 | { |
257 | 292 | $form->select_produits(GETPOST('idprod'), 'idprod', $filtertype, $conf->product->limit_size, $buyer->price_level, 1, 2, '', 1, array(), $buyer->id, '1', 0, 'maxwidth300', 0, '', GETPOST('combinations', 'array')); |
258 | 293 | } |
259 | - } |
|
260 | - else |
|
294 | + } else |
|
261 | 295 | { |
262 | 296 | // $senderissupplier=2 is same than 1 but disable test on minimum qty and disable autofill qty with minimum |
263 | 297 | if ($senderissupplier != 2) |
@@ -268,8 +302,7 @@ discard block |
||
268 | 302 | 'warning' => $langs->trans("NoPriceDefinedForThisSupplier") // translation of an error saved into var 'warning' (for exemple shown we select a disabled option into combo) |
269 | 303 | ); |
270 | 304 | $alsoproductwithnosupplierprice=0; |
271 | - } |
|
272 | - else |
|
305 | + } else |
|
273 | 306 | { |
274 | 307 | $ajaxoptions = array(); |
275 | 308 | $alsoproductwithnosupplierprice=1; |
@@ -312,9 +345,13 @@ discard block |
||
312 | 345 | require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; |
313 | 346 | $nbrows=ROWS_2; |
314 | 347 | $enabled=(! empty($conf->global->FCKEDITOR_ENABLE_DETAILS)?$conf->global->FCKEDITOR_ENABLE_DETAILS:0); |
315 | - if (! empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) $nbrows=$conf->global->MAIN_INPUT_DESC_HEIGHT; |
|
348 | + if (! empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) { |
|
349 | + $nbrows=$conf->global->MAIN_INPUT_DESC_HEIGHT; |
|
350 | + } |
|
316 | 351 | $toolbarname='dolibarr_details'; |
317 | - if (! empty($conf->global->FCKEDITOR_ENABLE_DETAILS_FULL)) $toolbarname='dolibarr_notes'; |
|
352 | + if (! empty($conf->global->FCKEDITOR_ENABLE_DETAILS_FULL)) { |
|
353 | + $toolbarname='dolibarr_notes'; |
|
354 | + } |
|
318 | 355 | $doleditor=new DolEditor('dp_desc',GETPOST('dp_desc'),'',100,$toolbarname,'',false,true,$enabled,$nbrows,'98%'); |
319 | 356 | $doleditor->Create(); |
320 | 357 | |
@@ -333,15 +370,21 @@ discard block |
||
333 | 370 | </td> |
334 | 371 | |
335 | 372 | <?php |
336 | - if ($object->element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier') // We must have same test in printObjectLines |
|
373 | + if ($object->element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier') { |
|
374 | + // We must have same test in printObjectLines |
|
337 | 375 | { |
338 | 376 | ?> |
339 | - <td class="nobottom linecolresupplier"><input id="fourn_ref" name="fourn_ref" class="flat maxwidth75" value="<?php echo (isset($_POST["fourn_ref"])?GETPOST("fourn_ref",'alpha',2):''); ?>"></td> |
|
377 | + <td class="nobottom linecolresupplier"><input id="fourn_ref" name="fourn_ref" class="flat maxwidth75" value="<?php echo (isset($_POST["fourn_ref"])?GETPOST("fourn_ref",'alpha',2):''); |
|
378 | + } |
|
379 | + ?>"></td> |
|
340 | 380 | <?php } ?> |
341 | 381 | |
342 | 382 | <td class="nobottom linecolvat" align="right"><?php |
343 | - if ($seller->tva_assuj == "0") echo '<input type="hidden" name="tva_tx" id="tva_tx" value="0">'.vatrate(0, true); |
|
344 | - else echo $form->load_tva('tva_tx', (isset($_POST["tva_tx"])?GETPOST("tva_tx",'alpha',2):-1), $seller, $buyer, 0, 0, '', false, 1); |
|
383 | + if ($seller->tva_assuj == "0") { |
|
384 | + echo '<input type="hidden" name="tva_tx" id="tva_tx" value="0">'.vatrate(0, true); |
|
385 | + } else { |
|
386 | + echo $form->load_tva('tva_tx', (isset($_POST["tva_tx"])?GETPOST("tva_tx",'alpha',2):-1), $seller, $buyer, 0, 0, '', false, 1); |
|
387 | + } |
|
345 | 388 | ?> |
346 | 389 | </td> |
347 | 390 | <td class="nobottom linecoluht" align="right"> |
@@ -407,11 +450,14 @@ discard block |
||
407 | 450 | echo '<td align="right" class="nobottom nowrap margininfos"><input class="flat right" type="text" size="2" id="np_markRate" name="np_markRate" value="'.(isset($_POST["np_markRate"])?GETPOST("np_markRate",'alpha',2):'').'"><span class="np_markRate hideonsmartphone">%</span></td>'; |
408 | 451 | $coldisplay++; |
409 | 452 | } |
410 | - } |
|
411 | - else |
|
453 | + } else |
|
412 | 454 | { |
413 | - if (! empty($conf->global->DISPLAY_MARGIN_RATES)) $coldisplay++; |
|
414 | - if (! empty($conf->global->DISPLAY_MARK_RATES)) $coldisplay++; |
|
455 | + if (! empty($conf->global->DISPLAY_MARGIN_RATES)) { |
|
456 | + $coldisplay++; |
|
457 | + } |
|
458 | + if (! empty($conf->global->DISPLAY_MARK_RATES)) { |
|
459 | + $coldisplay++; |
|
460 | + } |
|
415 | 461 | } |
416 | 462 | } |
417 | 463 | ?> |
@@ -427,14 +473,18 @@ discard block |
||
427 | 473 | ?> |
428 | 474 | |
429 | 475 | <?php |
430 | -if ((! empty($conf->service->enabled) || ($object->element == 'contrat')) && $dateSelector && GETPOST('type') != '0') // We show date field if required |
|
476 | +if ((! empty($conf->service->enabled) || ($object->element == 'contrat')) && $dateSelector && GETPOST('type') != '0') { |
|
477 | + // We show date field if required |
|
431 | 478 | { |
432 | 479 | $colspan = 6; |
480 | +} |
|
433 | 481 | |
434 | - if ($object->element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier') // We must have same test in printObjectLines |
|
482 | + if ($object->element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier') { |
|
483 | + // We must have same test in printObjectLines |
|
435 | 484 | { |
436 | 485 | $colspan++; |
437 | 486 | } |
487 | + } |
|
438 | 488 | if ($this->situation_cycle_ref) { |
439 | 489 | $colspan++; |
440 | 490 | } |
@@ -465,13 +515,22 @@ discard block |
||
465 | 515 | } |
466 | 516 | } |
467 | 517 | |
468 | - if (!empty($conf->multicurrency->enabled) && $this->multicurrency_code != $conf->currency) $colspan+=2; |
|
518 | + if (!empty($conf->multicurrency->enabled) && $this->multicurrency_code != $conf->currency) { |
|
519 | + $colspan+=2; |
|
520 | + } |
|
469 | 521 | |
470 | 522 | if (! empty($usemargins)) |
471 | 523 | { |
472 | - if (!empty($user->rights->margins->creer)) $colspan++; // For the buying price |
|
473 | - if (! empty($conf->global->DISPLAY_MARGIN_RATES)) $colspan++; |
|
474 | - if (! empty($conf->global->DISPLAY_MARK_RATES)) $colspan++; |
|
524 | + if (!empty($user->rights->margins->creer)) { |
|
525 | + $colspan++; |
|
526 | + } |
|
527 | + // For the buying price |
|
528 | + if (! empty($conf->global->DISPLAY_MARGIN_RATES)) { |
|
529 | + $colspan++; |
|
530 | + } |
|
531 | + if (! empty($conf->global->DISPLAY_MARK_RATES)) { |
|
532 | + $colspan++; |
|
533 | + } |
|
475 | 534 | } |
476 | 535 | ?> |
477 | 536 | |
@@ -487,8 +546,7 @@ discard block |
||
487 | 546 | print $form->selectDate($date_start,"date_start",$usehm,$usehm,1,"addproduct"); |
488 | 547 | print ' '.$langs->trans("DateEndPlanned").' '; |
489 | 548 | print $form->selectDate($date_end,"date_end",$usehm,$usehm,1,"addproduct"); |
490 | - } |
|
491 | - else |
|
549 | + } else |
|
492 | 550 | { |
493 | 551 | echo $langs->trans('ServiceLimitedDuration').' '.$langs->trans('From').' '; |
494 | 552 | print $form->selectDate($date_start, 'date_start', empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE)?0:1, empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE)?0:1, 1, "addproduct", 1, 0); |
@@ -675,9 +733,15 @@ discard block |
||
675 | 733 | var defaultbuyprice = '<?php |
676 | 734 | if (isset($conf->global->MARGIN_TYPE)) |
677 | 735 | { |
678 | - if ($conf->global->MARGIN_TYPE == '1') print 'bestsupplierprice'; |
|
679 | - if ($conf->global->MARGIN_TYPE == 'pmp') print 'pmp'; |
|
680 | - if ($conf->global->MARGIN_TYPE == 'costprice') print 'costprice'; |
|
736 | + if ($conf->global->MARGIN_TYPE == '1') { |
|
737 | + print 'bestsupplierprice'; |
|
738 | + } |
|
739 | + if ($conf->global->MARGIN_TYPE == 'pmp') { |
|
740 | + print 'pmp'; |
|
741 | + } |
|
742 | + if ($conf->global->MARGIN_TYPE == 'costprice') { |
|
743 | + print 'costprice'; |
|
744 | + } |
|
681 | 745 | } ?>'; |
682 | 746 | console.log("we will set the field for margin. defaultbuyprice="+defaultbuyprice); |
683 | 747 |
@@ -25,8 +25,12 @@ |
||
25 | 25 | } |
26 | 26 | |
27 | 27 | $hide = true; // Hide by default |
28 | -if (isset($parameters['showblocbydefault'])) $hide=(empty($parameters['showblocbydefault']) ? true : false); |
|
29 | -if (isset($object->extraparams[$blocname]['showhide'])) $hide = (empty($object->extraparams[$blocname]['showhide']) ? true : false); |
|
28 | +if (isset($parameters['showblocbydefault'])) { |
|
29 | + $hide=(empty($parameters['showblocbydefault']) ? true : false); |
|
30 | +} |
|
31 | +if (isset($object->extraparams[$blocname]['showhide'])) { |
|
32 | + $hide = (empty($object->extraparams[$blocname]['showhide']) ? true : false); |
|
33 | +} |
|
30 | 34 | |
31 | 35 | ?> |
32 | 36 | <!-- BEGIN PHP TEMPLATE bloc_showhide.tpl.php --> |
@@ -7,10 +7,13 @@ discard block |
||
7 | 7 | exit; |
8 | 8 | } |
9 | 9 | |
10 | -if (empty($extrafieldsobjectkey) && is_object($object)) $extrafieldsobjectkey=$object->table_element; |
|
10 | +if (empty($extrafieldsobjectkey) && is_object($object)) { |
|
11 | + $extrafieldsobjectkey=$object->table_element; |
|
12 | +} |
|
11 | 13 | |
12 | 14 | // Loop to show all columns of extrafields from $obj, $extrafields and $db |
13 | -if (! empty($extrafieldsobjectkey)) // $extrafieldsobject is the $object->table_element like 'societe', 'socpeople', ... |
|
15 | +if (! empty($extrafieldsobjectkey)) { |
|
16 | + // $extrafieldsobject is the $object->table_element like 'societe', 'socpeople', ... |
|
14 | 17 | { |
15 | 18 | if (is_array($extrafields->attributes[$extrafieldsobjectkey]['label']) && count($extrafields->attributes[$extrafieldsobjectkey]['label'])) |
16 | 19 | { |
@@ -19,27 +22,33 @@ discard block |
||
19 | 22 | if (! empty($arrayfields["ef.".$key]['checked'])) |
20 | 23 | { |
21 | 24 | $align=$extrafields->getAlignFlag($key, $extrafieldsobjectkey); |
25 | +} |
|
22 | 26 | print '<td'; |
23 | - if ($align) print ' align="'.$align.'"'; |
|
27 | + if ($align) { |
|
28 | + print ' align="'.$align.'"'; |
|
29 | + } |
|
24 | 30 | print '>'; |
25 | 31 | $tmpkey='options_'.$key; |
26 | 32 | if (in_array($extrafields->attributes[$extrafieldsobjectkey]['type'][$key], array('date', 'datetime', 'timestamp')) && !is_numeric($obj->$tmpkey)) |
27 | 33 | { |
28 | 34 | $datenotinstring = $obj->$tmpkey; |
29 | - if (! is_numeric($obj->$tmpkey)) // For backward compatibility |
|
35 | + if (! is_numeric($obj->$tmpkey)) { |
|
36 | + // For backward compatibility |
|
30 | 37 | { |
31 | 38 | $datenotinstring = $db->jdate($datenotinstring); |
32 | 39 | } |
40 | + } |
|
33 | 41 | $value = $datenotinstring; |
34 | - } |
|
35 | - else |
|
42 | + } else |
|
36 | 43 | { |
37 | 44 | $value = $obj->$tmpkey; |
38 | 45 | } |
39 | 46 | |
40 | 47 | print $extrafields->showOutputField($key, $value, '', $extrafieldsobjectkey); |
41 | 48 | print '</td>'; |
42 | - if (! $i) $totalarray['nbfield']++; |
|
49 | + if (! $i) { |
|
50 | + $totalarray['nbfield']++; |
|
51 | + } |
|
43 | 52 | |
44 | 53 | if ($extrafields->attributes[$extrafieldsobjectkey]['totalizable'][$key]) { |
45 | 54 | if (! $i) { |
@@ -50,7 +59,9 @@ discard block |
||
50 | 59 | } |
51 | 60 | if (! empty($val['isameasure'])) |
52 | 61 | { |
53 | - if (! $i) $totalarray['pos'][$totalarray['nbfield']]='ef.'.$tmpkey; |
|
62 | + if (! $i) { |
|
63 | + $totalarray['pos'][$totalarray['nbfield']]='ef.'.$tmpkey; |
|
64 | + } |
|
54 | 65 | $totalarray['val']['ef.'.$tmpkey] += $obj->$tmpkey; |
55 | 66 | } |
56 | 67 | } |
@@ -35,20 +35,10 @@ discard block |
||
35 | 35 | $module = $object->element; |
36 | 36 | |
37 | 37 | // Special cases |
38 | -if ($module == 'propal') { $permission=$user->rights->propale->creer; } |
|
39 | -elseif ($module == 'fichinter') { $permission=$user->rights->ficheinter->creer; } |
|
40 | -elseif ($module == 'order_supplier') { $permission=$user->rights->fournisseur->commande->creer; } |
|
41 | -elseif ($module == 'invoice_supplier') { $permission=$user->rights->fournisseur->facture->creer; } |
|
42 | -elseif ($module == 'project') { $permission=$user->rights->projet->creer; } |
|
43 | -elseif ($module == 'action') { $permission=$user->rights->agenda->myactions->create; } |
|
44 | -elseif ($module == 'shipping') { $permission=$user->rights->expedition->creer; } |
|
45 | -elseif ($module == 'reception') { $permission=$user->rights->reception->creer; } |
|
46 | -elseif ($module == 'project_task') { $permission=$user->rights->projet->creer; } |
|
47 | -elseif (! isset($permission) && isset($user->rights->$module->creer)) |
|
38 | +if ($module == 'propal') { $permission=$user->rights->propale->creer; } elseif ($module == 'fichinter') { $permission=$user->rights->ficheinter->creer; } elseif ($module == 'order_supplier') { $permission=$user->rights->fournisseur->commande->creer; } elseif ($module == 'invoice_supplier') { $permission=$user->rights->fournisseur->facture->creer; } elseif ($module == 'project') { $permission=$user->rights->projet->creer; } elseif ($module == 'action') { $permission=$user->rights->agenda->myactions->create; } elseif ($module == 'shipping') { $permission=$user->rights->expedition->creer; } elseif ($module == 'reception') { $permission=$user->rights->reception->creer; } elseif ($module == 'project_task') { $permission=$user->rights->projet->creer; } elseif (! isset($permission) && isset($user->rights->$module->creer)) |
|
48 | 39 | { |
49 | 40 | $permission=$user->rights->$module->creer; |
50 | -} |
|
51 | -elseif (! isset($permission) && isset($user->rights->$module->write)) |
|
41 | +} elseif (! isset($permission) && isset($user->rights->$module->write)) |
|
52 | 42 | { |
53 | 43 | $permission=$user->rights->$module->write; |
54 | 44 | } |
@@ -88,14 +78,19 @@ discard block |
||
88 | 78 | <input type="hidden" name="id" value="<?php echo $object->id; ?>" /> |
89 | 79 | <input type="hidden" name="action" value="addcontact" /> |
90 | 80 | <input type="hidden" name="source" value="internal" /> |
91 | - <?php if ($withproject) print '<input type="hidden" name="withproject" value="'.$withproject.'">'; ?> |
|
81 | + <?php if ($withproject) { |
|
82 | + print '<input type="hidden" name="withproject" value="'.$withproject.'">'; |
|
83 | +} |
|
84 | +?> |
|
92 | 85 | <div class="nowrap tagtd"><?php echo img_object('','user').' '.$langs->trans("Users"); ?></div> |
93 | 86 | <div class="tagtd"><?php echo $conf->global->MAIN_INFO_SOCIETE_NOM; ?></div> |
94 | 87 | <div class="tagtd maxwidthonsmartphone"><?php echo $form->select_dolusers($user->id, 'userid', 0, (! empty($userAlreadySelected)?$userAlreadySelected:null), 0, null, null, 0, 56, '', 0, '', 'minwidth200imp'); ?></div> |
95 | 88 | <div class="tagtd maxwidthonsmartphone"> |
96 | 89 | <?php |
97 | 90 | $tmpobject=$object; |
98 | - if (($object->element == 'shipping' || $object->element == 'reception') && is_object($objectsrc)) $tmpobject=$objectsrc; |
|
91 | + if (($object->element == 'shipping' || $object->element == 'reception') && is_object($objectsrc)) { |
|
92 | + $tmpobject=$objectsrc; |
|
93 | + } |
|
99 | 94 | echo $formcompany->selectTypeContact($tmpobject, '', 'type','internal'); |
100 | 95 | ?></div> |
101 | 96 | <div class="tagtd"> </div> |
@@ -115,7 +110,10 @@ discard block |
||
115 | 110 | <input type="hidden" name="id" value="<?php echo $object->id; ?>" /> |
116 | 111 | <input type="hidden" name="action" value="addcontact" /> |
117 | 112 | <input type="hidden" name="source" value="external" /> |
118 | - <?php if ($withproject) print '<input type="hidden" name="withproject" value="'.$withproject.'">'; ?> |
|
113 | + <?php if ($withproject) { |
|
114 | + print '<input type="hidden" name="withproject" value="'.$withproject.'">'; |
|
115 | +} |
|
116 | +?> |
|
119 | 117 | <div class="tagtd nowrap noborderbottom"><?php echo img_object('','contact').' '.$langs->trans("ThirdPartyContacts"); ?></div> |
120 | 118 | <div class="tagtd nowrap maxwidthonsmartphone noborderbottom"> |
121 | 119 | <?php $selectedCompany = isset($_GET["newcompany"])?$_GET["newcompany"]:$object->socid; ?> |
@@ -134,12 +132,17 @@ discard block |
||
134 | 132 | <div class="tagtd maxwidthonsmartphone noborderbottom"> |
135 | 133 | <?php |
136 | 134 | $tmpobject=$object; |
137 | - if (($object->element == 'shipping'|| $object->element == 'reception') && is_object($objectsrc)) $tmpobject=$objectsrc; |
|
135 | + if (($object->element == 'shipping'|| $object->element == 'reception') && is_object($objectsrc)) { |
|
136 | + $tmpobject=$objectsrc; |
|
137 | + } |
|
138 | 138 | $formcompany->selectTypeContact($tmpobject, '', 'type','external', 'position', 0, 'minwidth100imp'); ?> |
139 | 139 | </div> |
140 | 140 | <div class="tagtd noborderbottom"> </div> |
141 | 141 | <div class="tagtd center noborderbottom"> |
142 | - <input type="submit" id="add-customer-contact" class="button" value="<?php echo $langs->trans("Add"); ?>"<?php if (! $nbofcontacts) echo ' disabled'; ?>> |
|
142 | + <input type="submit" id="add-customer-contact" class="button" value="<?php echo $langs->trans("Add"); ?>"<?php if (! $nbofcontacts) { |
|
143 | + echo ' disabled'; |
|
144 | +} |
|
145 | +?>> |
|
143 | 146 | </div> |
144 | 147 | </form> |
145 | 148 | |
@@ -162,7 +165,9 @@ discard block |
||
162 | 165 | foreach($arrayofsource as $source) { |
163 | 166 | |
164 | 167 | $tmpobject=$object; |
165 | - if (($object->element == 'shipping'|| $object->element == 'reception') && is_object($objectsrc)) $tmpobject=$objectsrc; |
|
168 | + if (($object->element == 'shipping'|| $object->element == 'reception') && is_object($objectsrc)) { |
|
169 | + $tmpobject=$objectsrc; |
|
170 | + } |
|
166 | 171 | |
167 | 172 | $tab = $tmpobject->liste_contact(-1,$source); |
168 | 173 | $num=count($tab); |
@@ -173,8 +178,14 @@ discard block |
||
173 | 178 | |
174 | 179 | <form class="tagtr oddeven"> |
175 | 180 | <div class="tagtd" align="left"> |
176 | - <?php if ($tab[$i]['source']=='internal') echo $langs->trans("User"); ?> |
|
177 | - <?php if ($tab[$i]['source']=='external') echo $langs->trans("ThirdPartyContact"); ?> |
|
181 | + <?php if ($tab[$i]['source']=='internal') { |
|
182 | + echo $langs->trans("User"); |
|
183 | +} |
|
184 | +?> |
|
185 | + <?php if ($tab[$i]['source']=='external') { |
|
186 | + echo $langs->trans("ThirdPartyContact"); |
|
187 | +} |
|
188 | +?> |
|
178 | 189 | </div> |
179 | 190 | <div class="tagtd" align="left"> |
180 | 191 | <?php |
@@ -119,9 +119,11 @@ discard block |
||
119 | 119 | $formmail->fromid = $user->id; |
120 | 120 | } |
121 | 121 | $formmail->trackid=$trackid; |
122 | - if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 2)) // If bit 2 is set |
|
122 | + if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 2)) { |
|
123 | + // If bit 2 is set |
|
123 | 124 | { |
124 | 125 | include DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; |
126 | + } |
|
125 | 127 | $formmail->frommail=dolAddEmailTrackId($formmail->frommail, $trackid); |
126 | 128 | } |
127 | 129 | $formmail->withfrom = 1; |
@@ -133,22 +135,18 @@ discard block |
||
133 | 135 | $fuser = new User($db); |
134 | 136 | $fuser->fetch($object->fk_user_author); |
135 | 137 | $liste['thirdparty'] = $fuser->getFullName($langs)." <".$fuser->email.">"; |
136 | - } |
|
137 | - elseif ($object->element == 'societe') |
|
138 | + } elseif ($object->element == 'societe') |
|
138 | 139 | { |
139 | 140 | foreach ($object->thirdparty_and_contact_email_array(1) as $key => $value) { |
140 | 141 | $liste[$key] = $value; |
141 | 142 | } |
142 | - } |
|
143 | - elseif ($object->element == 'contact') |
|
143 | + } elseif ($object->element == 'contact') |
|
144 | 144 | { |
145 | 145 | $liste['contact'] = $object->getFullName($langs)." <".$object->email.">"; |
146 | - } |
|
147 | - elseif ($object->element == 'user' || $object->element == 'member') |
|
146 | + } elseif ($object->element == 'user' || $object->element == 'member') |
|
148 | 147 | { |
149 | 148 | $liste['thirdparty'] = $object->getFullName($langs)." <".$object->email.">"; |
150 | - } |
|
151 | - else |
|
149 | + } else |
|
152 | 150 | { |
153 | 151 | if (is_object($object->thirdparty)) |
154 | 152 | { |
@@ -185,7 +183,9 @@ discard block |
||
185 | 183 | $formmail->withcancel = 1; |
186 | 184 | |
187 | 185 | //$arrayoffamiliestoexclude=array('system', 'mycompany', 'object', 'objectamount', 'date', 'user', ...); |
188 | - if (! isset($arrayoffamiliestoexclude)) $arrayoffamiliestoexclude=null; |
|
186 | + if (! isset($arrayoffamiliestoexclude)) { |
|
187 | + $arrayoffamiliestoexclude=null; |
|
188 | + } |
|
189 | 189 | |
190 | 190 | // Make substitution in email content |
191 | 191 | $substitutionarray = getCommonSubstitutionArray($outputlangs, 0, $arrayoffamiliestoexclude, $object); |
@@ -447,7 +447,9 @@ |
||
447 | 447 | $extrafields = new ExtraFields($db); |
448 | 448 | $extralabels = $extrafields->fetch_name_optionals_label('socpeople'); |
449 | 449 | foreach($extrafields->attribute_type as $key=>&$value) { |
450 | - if($value == 'radio')$value = 'select'; |
|
450 | + if($value == 'radio') { |
|
451 | + $value = 'select'; |
|
452 | + } |
|
451 | 453 | } |
452 | 454 | |
453 | 455 |
@@ -34,7 +34,9 @@ discard block |
||
34 | 34 | |
35 | 35 | require_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmdirectory.class.php'; |
36 | 36 | |
37 | -if (empty($module)) $module='ecm'; |
|
37 | +if (empty($module)) { |
|
38 | + $module='ecm'; |
|
39 | +} |
|
38 | 40 | |
39 | 41 | $permtoadd = 0; |
40 | 42 | $permtoupload = 0; |
@@ -77,8 +79,7 @@ discard block |
||
77 | 79 | print '<a href="'.DOL_URL_ROOT.'/ecm/dir_add_card.php?action=create&module='.urlencode($module).($websitekey?'&website='.$websitekey:'').($pageid?'&pageid='.$pageid:'').'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?file_manager=1&website='.$websitekey.'&pageid='.$pageid).'" class="inline-block valignmiddle toolbarbutton" title="'.dol_escape_htmltag($langs->trans('ECMAddSection')).'">'; |
78 | 80 | print '<img class="toolbarbutton" border="0" src="'.DOL_URL_ROOT.'/theme/common/folder-new.png">'; |
79 | 81 | print '</a>'; |
80 | -} |
|
81 | -else |
|
82 | +} else |
|
82 | 83 | { |
83 | 84 | print '<a href="#" class="inline-block valignmiddle toolbarbutton" title="'.$langs->trans("NotAllowed").'">'; |
84 | 85 | print '<img class="toolbarbutton" border="0" src="'.DOL_URL_ROOT.'/theme/common/folder-new.png">'; |
@@ -116,8 +117,9 @@ discard block |
||
116 | 117 | include_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; |
117 | 118 | $formfile=new FormFile($db); |
118 | 119 | $formfile->form_attach_new_file($_SERVER["PHP_SELF"], 'none', 0, ($section?$section:-1), $permtoupload, 48, null, '', 0, '', 0, $nameforformuserfile, '', $sectiondir); |
120 | +} else { |
|
121 | + print ' '; |
|
119 | 122 | } |
120 | -else print ' '; |
|
121 | 123 | |
122 | 124 | print '</div>'; |
123 | 125 | // End "Add new file" area |
@@ -173,11 +175,12 @@ discard block |
||
173 | 175 | // Show filemanager tree (will be filled by a call of ajax /ecm/tpl/enablefiletreeajax.tpl.php, later, that executes ajaxdirtree.php) |
174 | 176 | print '<div id="filetree" class="ecmfiletree"></div>'; |
175 | 177 | |
176 | - if ($action == 'deletefile') print $form->formconfirm('eeeee', $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile', '', '', 'deletefile'); |
|
178 | + if ($action == 'deletefile') { |
|
179 | + print $form->formconfirm('eeeee', $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile', '', '', 'deletefile'); |
|
180 | + } |
|
177 | 181 | |
178 | 182 | print '</td></tr>'; |
179 | - } |
|
180 | - else // Show filtree when ajax is disabled (rare) |
|
183 | + } else // Show filtree when ajax is disabled (rare) |
|
181 | 184 | { |
182 | 185 | print '<tr><td style="padding-left: 20px">'; |
183 | 186 | |
@@ -192,7 +195,9 @@ discard block |
||
192 | 195 | // $_GET['modulepart'], $_GET['openeddir'], $_GET['sortfield'], $_GET['sortorder'] |
193 | 196 | // $_POST['dir'] |
194 | 197 | $mode='noajax'; |
195 | - if (empty($url)) $url=DOL_URL_ROOT.'/ecm/index.php'; |
|
198 | + if (empty($url)) { |
|
199 | + $url=DOL_URL_ROOT.'/ecm/index.php'; |
|
200 | + } |
|
196 | 201 | include DOL_DOCUMENT_ROOT.'/core/ajax/ajaxdirtree.php'; |
197 | 202 | |
198 | 203 | print '</div>'; |
@@ -215,7 +220,9 @@ discard block |
||
215 | 220 | |
216 | 221 | |
217 | 222 | $mode='noajax'; |
218 | -if (empty($url)) $url=DOL_URL_ROOT.'/ecm/index.php'; |
|
223 | +if (empty($url)) { |
|
224 | + $url=DOL_URL_ROOT.'/ecm/index.php'; |
|
225 | +} |
|
219 | 226 | include DOL_DOCUMENT_ROOT.'/core/ajax/ajaxdirpreview.php'; // Show content of a directory on right side |
220 | 227 | |
221 | 228 | |
@@ -229,14 +236,17 @@ discard block |
||
229 | 236 | <?php |
230 | 237 | |
231 | 238 | |
232 | -if (! empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_JS)) // Show filtree when ajax is enabled |
|
239 | +if (! empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_JS)) { |
|
240 | + // Show filtree when ajax is enabled |
|
233 | 241 | { |
234 | 242 | //var_dump($modulepart); |
235 | 243 | // Variables that may be defined: |
236 | 244 | // $_GET['modulepart'], $_GET['openeddir'], $_GET['sortfield'], $_GET['sortorder'] |
237 | 245 | // $_POST['dir'] |
238 | 246 | // $_POST['section_dir'], $_POST['section_id'], $_POST['token'], $_POST['max_file_size'], $_POST['sendit'] |
239 | - if (GETPOST('section_dir','alpha')) { $preopened=GETPOST('section_dir','alpha'); } |
|
247 | + if (GETPOST('section_dir','alpha')) { $preopened=GETPOST('section_dir','alpha'); |
|
248 | +} |
|
249 | +} |
|
240 | 250 | |
241 | 251 | include DOL_DOCUMENT_ROOT.'/ecm/tpl/enablefiletreeajax.tpl.php'; |
242 | 252 | } |
@@ -29,7 +29,9 @@ discard block |
||
29 | 29 | print "Error, template page can't be called as URL"; |
30 | 30 | exit; |
31 | 31 | } |
32 | -if (! is_object($form)) $form=new Form($db); |
|
32 | +if (! is_object($form)) { |
|
33 | + $form=new Form($db); |
|
34 | +} |
|
33 | 35 | |
34 | 36 | ?> |
35 | 37 | <!-- BEGIN PHP TEMPLATE commonfields_view.tpl.php --> |
@@ -40,20 +42,35 @@ discard block |
||
40 | 42 | foreach($object->fields as $key => $val) |
41 | 43 | { |
42 | 44 | // Discard if extrafield is a hidden field on form |
43 | - if (abs($val['visible']) != 1) continue; |
|
45 | + if (abs($val['visible']) != 1) { |
|
46 | + continue; |
|
47 | + } |
|
44 | 48 | |
45 | - if (array_key_exists('enabled', $val) && isset($val['enabled']) && ! verifCond($val['enabled'])) continue; // We don't want this field |
|
46 | - if (in_array($key, array('ref','status'))) continue; // Ref and status are already in dol_banner |
|
49 | + if (array_key_exists('enabled', $val) && isset($val['enabled']) && ! verifCond($val['enabled'])) { |
|
50 | + continue; |
|
51 | + } |
|
52 | + // We don't want this field |
|
53 | + if (in_array($key, array('ref','status'))) { |
|
54 | + continue; |
|
55 | + } |
|
56 | + // Ref and status are already in dol_banner |
|
47 | 57 | |
48 | 58 | $value=$object->$key; |
49 | 59 | |
50 | 60 | print '<tr><td'; |
51 | 61 | print ' class="titlefield'; |
52 | - if ($val['notnull'] > 0) print ' fieldrequired'; |
|
53 | - if ($val['type'] == 'text' || $val['type'] == 'html') print ' tdtop'; |
|
62 | + if ($val['notnull'] > 0) { |
|
63 | + print ' fieldrequired'; |
|
64 | + } |
|
65 | + if ($val['type'] == 'text' || $val['type'] == 'html') { |
|
66 | + print ' tdtop'; |
|
67 | + } |
|
54 | 68 | print '">'; |
55 | - if (! empty($val['help'])) print $form->textwithpicto($langs->trans($val['label']), $val['help']); |
|
56 | - else print $langs->trans($val['label']); |
|
69 | + if (! empty($val['help'])) { |
|
70 | + print $form->textwithpicto($langs->trans($val['label']), $val['help']); |
|
71 | + } else { |
|
72 | + print $langs->trans($val['label']); |
|
73 | + } |
|
57 | 74 | print '</td>'; |
58 | 75 | print '<td>'; |
59 | 76 | print $object->showOutputField($val, $key, $value, '', '', '', 0); |
@@ -61,7 +78,10 @@ discard block |
||
61 | 78 | print '</td>'; |
62 | 79 | print '</tr>'; |
63 | 80 | |
64 | - if (! empty($keyforbreak) && $key == $keyforbreak) break; // key used for break on second column |
|
81 | + if (! empty($keyforbreak) && $key == $keyforbreak) { |
|
82 | + break; |
|
83 | + } |
|
84 | + // key used for break on second column |
|
65 | 85 | } |
66 | 86 | |
67 | 87 | print '</table>'; |
@@ -76,23 +96,42 @@ discard block |
||
76 | 96 | { |
77 | 97 | if ($alreadyoutput) |
78 | 98 | { |
79 | - if (! empty($keyforbreak) && $key == $keyforbreak) $alreadyoutput = 0; // key used for break on second column |
|
99 | + if (! empty($keyforbreak) && $key == $keyforbreak) { |
|
100 | + $alreadyoutput = 0; |
|
101 | + } |
|
102 | + // key used for break on second column |
|
80 | 103 | continue; |
81 | 104 | } |
82 | 105 | |
83 | - if (abs($val['visible']) != 1) continue; // Discard such field from form |
|
84 | - if (array_key_exists('enabled', $val) && isset($val['enabled']) && ! $val['enabled']) continue; // We don't want this field |
|
85 | - if (in_array($key, array('ref','status'))) continue; // Ref and status are already in dol_banner |
|
106 | + if (abs($val['visible']) != 1) { |
|
107 | + continue; |
|
108 | + } |
|
109 | + // Discard such field from form |
|
110 | + if (array_key_exists('enabled', $val) && isset($val['enabled']) && ! $val['enabled']) { |
|
111 | + continue; |
|
112 | + } |
|
113 | + // We don't want this field |
|
114 | + if (in_array($key, array('ref','status'))) { |
|
115 | + continue; |
|
116 | + } |
|
117 | + // Ref and status are already in dol_banner |
|
86 | 118 | |
87 | 119 | $value=$object->$key; |
88 | 120 | |
89 | 121 | print '<tr><td'; |
90 | 122 | print ' class="titlefield'; |
91 | - if ($val['notnull'] > 0) print ' fieldrequired'; |
|
92 | - if ($val['type'] == 'text' || $val['type'] == 'html') print ' tdtop'; |
|
123 | + if ($val['notnull'] > 0) { |
|
124 | + print ' fieldrequired'; |
|
125 | + } |
|
126 | + if ($val['type'] == 'text' || $val['type'] == 'html') { |
|
127 | + print ' tdtop'; |
|
128 | + } |
|
93 | 129 | print '">'; |
94 | - if (! empty($val['help'])) print $form->textwithpicto($langs->trans($val['label']), $val['help']); |
|
95 | - else print $langs->trans($val['label']); |
|
130 | + if (! empty($val['help'])) { |
|
131 | + print $form->textwithpicto($langs->trans($val['label']), $val['help']); |
|
132 | + } else { |
|
133 | + print $langs->trans($val['label']); |
|
134 | + } |
|
96 | 135 | print '</td>'; |
97 | 136 | print '<td>'; |
98 | 137 | print $object->showOutputField($val, $key, $value, '', '', '', 0); |
@@ -48,13 +48,25 @@ discard block |
||
48 | 48 | global $forceall, $senderissupplier, $inputalsopricewithtax, $outputalsopricetotalwithtax; |
49 | 49 | |
50 | 50 | $usemargins=0; |
51 | -if (! empty($conf->margin->enabled) && ! empty($object->element) && in_array($object->element,array('facture','propal','commande'))) $usemargins=1; |
|
51 | +if (! empty($conf->margin->enabled) && ! empty($object->element) && in_array($object->element,array('facture','propal','commande'))) { |
|
52 | + $usemargins=1; |
|
53 | +} |
|
52 | 54 | |
53 | -if (empty($dateSelector)) $dateSelector=0; |
|
54 | -if (empty($forceall)) $forceall=0; |
|
55 | -if (empty($senderissupplier)) $senderissupplier=0; |
|
56 | -if (empty($inputalsopricewithtax)) $inputalsopricewithtax=0; |
|
57 | -if (empty($outputalsopricetotalwithtax)) $outputalsopricetotalwithtax=0; |
|
55 | +if (empty($dateSelector)) { |
|
56 | + $dateSelector=0; |
|
57 | +} |
|
58 | +if (empty($forceall)) { |
|
59 | + $forceall=0; |
|
60 | +} |
|
61 | +if (empty($senderissupplier)) { |
|
62 | + $senderissupplier=0; |
|
63 | +} |
|
64 | +if (empty($inputalsopricewithtax)) { |
|
65 | + $inputalsopricewithtax=0; |
|
66 | +} |
|
67 | +if (empty($outputalsopricetotalwithtax)) { |
|
68 | + $outputalsopricetotalwithtax=0; |
|
69 | +} |
|
58 | 70 | |
59 | 71 | // add html5 elements |
60 | 72 | $domData = ' data-element="'.$line->element.'"'; |
@@ -78,9 +90,13 @@ discard block |
||
78 | 90 | <?php |
79 | 91 | $txt=''; |
80 | 92 | print img_object($langs->trans("ShowReduc"),'reduc').' '; |
81 | - if ($line->description == '(DEPOSIT)') $txt=$langs->trans("Deposit"); |
|
82 | - elseif ($line->description == '(EXCESS RECEIVED)') $txt=$langs->trans("ExcessReceived"); |
|
83 | - elseif ($line->description == '(EXCESS PAID)') $txt=$langs->trans("ExcessPaid"); |
|
93 | + if ($line->description == '(DEPOSIT)') { |
|
94 | + $txt=$langs->trans("Deposit"); |
|
95 | + } elseif ($line->description == '(EXCESS RECEIVED)') { |
|
96 | + $txt=$langs->trans("ExcessReceived"); |
|
97 | + } elseif ($line->description == '(EXCESS PAID)') { |
|
98 | + $txt=$langs->trans("ExcessPaid"); |
|
99 | + } |
|
84 | 100 | //else $txt=$langs->trans("Discount"); |
85 | 101 | print $txt; |
86 | 102 | ?> |
@@ -93,66 +109,77 @@ discard block |
||
93 | 109 | $discount=new DiscountAbsolute($this->db); |
94 | 110 | $discount->fetch($line->fk_remise_except); |
95 | 111 | echo ($txt?' - ':'').$langs->transnoentities("DiscountFromCreditNote",$discount->getNomUrl(0)); |
96 | - } |
|
97 | - elseif ($line->description == '(DEPOSIT)' && $line->fk_remise_except > 0) |
|
112 | + } elseif ($line->description == '(DEPOSIT)' && $line->fk_remise_except > 0) |
|
98 | 113 | { |
99 | 114 | $discount=new DiscountAbsolute($this->db); |
100 | 115 | $discount->fetch($line->fk_remise_except); |
101 | 116 | echo ($txt?' - ':'').$langs->transnoentities("DiscountFromDeposit",$discount->getNomUrl(0)); |
102 | 117 | // Add date of deposit |
103 | - if (! empty($conf->global->INVOICE_ADD_DEPOSIT_DATE)) |
|
104 | - echo ' ('.dol_print_date($discount->datec).')'; |
|
105 | - } |
|
106 | - elseif ($line->description == '(EXCESS RECEIVED)' && $objp->fk_remise_except > 0) |
|
118 | + if (! empty($conf->global->INVOICE_ADD_DEPOSIT_DATE)) { |
|
119 | + echo ' ('.dol_print_date($discount->datec).')'; |
|
120 | + } |
|
121 | + } elseif ($line->description == '(EXCESS RECEIVED)' && $objp->fk_remise_except > 0) |
|
107 | 122 | { |
108 | 123 | $discount=new DiscountAbsolute($this->db); |
109 | 124 | $discount->fetch($line->fk_remise_except); |
110 | 125 | echo ($txt?' - ':'').$langs->transnoentities("DiscountFromExcessReceived",$discount->getNomUrl(0)); |
111 | - } |
|
112 | - elseif ($line->description == '(EXCESS PAID)' && $objp->fk_remise_except > 0) |
|
126 | + } elseif ($line->description == '(EXCESS PAID)' && $objp->fk_remise_except > 0) |
|
113 | 127 | { |
114 | 128 | $discount=new DiscountAbsolute($this->db); |
115 | 129 | $discount->fetch($line->fk_remise_except); |
116 | 130 | echo ($txt?' - ':'').$langs->transnoentities("DiscountFromExcessPaid",$discount->getNomUrl(0)); |
117 | - } |
|
118 | - else |
|
131 | + } else |
|
119 | 132 | { |
120 | 133 | echo ($txt?' - ':'').dol_htmlentitiesbr($line->description); |
121 | 134 | } |
122 | 135 | } |
123 | - } |
|
124 | - else |
|
136 | + } else |
|
125 | 137 | { |
126 | 138 | $format = $conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE?'dayhour':'day'; |
127 | 139 | |
128 | 140 | if ($line->fk_product > 0) |
129 | 141 | { |
130 | 142 | echo $form->textwithtooltip($text,$description,3,'','',$i,0,(!empty($line->fk_parent_line)?img_picto('', 'rightarrow'):'')); |
131 | - } |
|
132 | - else |
|
143 | + } else |
|
133 | 144 | { |
134 | - if ($type==1) $text = img_object($langs->trans('Service'),'service'); |
|
135 | - else $text = img_object($langs->trans('Product'),'product'); |
|
145 | + if ($type==1) { |
|
146 | + $text = img_object($langs->trans('Service'),'service'); |
|
147 | + } else { |
|
148 | + $text = img_object($langs->trans('Product'),'product'); |
|
149 | + } |
|
136 | 150 | |
137 | 151 | if (! empty($line->label)) { |
138 | 152 | $text.= ' <strong>'.$line->label.'</strong>'; |
139 | 153 | echo $form->textwithtooltip($text,dol_htmlentitiesbr($line->description),3,'','',$i,0,(!empty($line->fk_parent_line)?img_picto('', 'rightarrow'):'')); |
140 | 154 | } else { |
141 | - if (! empty($line->fk_parent_line)) echo img_picto('', 'rightarrow'); |
|
155 | + if (! empty($line->fk_parent_line)) { |
|
156 | + echo img_picto('', 'rightarrow'); |
|
157 | + } |
|
142 | 158 | echo $text.' '.dol_htmlentitiesbr($line->description); |
143 | 159 | } |
144 | 160 | } |
145 | 161 | |
146 | 162 | // Show date range |
147 | 163 | if ($line->element == 'facturedetrec') { |
148 | - if ($line->date_start_fill || $line->date_end_fill) echo '<br><div class="clearboth nowraponall">'; |
|
149 | - if ($line->date_start_fill) echo $langs->trans('AutoFillDateFromShort').': '.yn($line->date_start_fill); |
|
150 | - if ($line->date_start_fill && $line->date_end_fill) echo ' - '; |
|
151 | - if ($line->date_end_fill) echo $langs->trans('AutoFillDateToShort').': '.yn($line->date_end_fill); |
|
152 | - if ($line->date_start_fill || $line->date_end_fill) echo '</div>'; |
|
153 | - } |
|
154 | - else { |
|
155 | - if ($line->date_start || $line->date_end) echo '<br><div class="clearboth nowraponall">'.get_date_range($line->date_start, $line->date_end, $format).'</div>'; |
|
164 | + if ($line->date_start_fill || $line->date_end_fill) { |
|
165 | + echo '<br><div class="clearboth nowraponall">'; |
|
166 | + } |
|
167 | + if ($line->date_start_fill) { |
|
168 | + echo $langs->trans('AutoFillDateFromShort').': '.yn($line->date_start_fill); |
|
169 | + } |
|
170 | + if ($line->date_start_fill && $line->date_end_fill) { |
|
171 | + echo ' - '; |
|
172 | + } |
|
173 | + if ($line->date_end_fill) { |
|
174 | + echo $langs->trans('AutoFillDateToShort').': '.yn($line->date_end_fill); |
|
175 | + } |
|
176 | + if ($line->date_start_fill || $line->date_end_fill) { |
|
177 | + echo '</div>'; |
|
178 | + } |
|
179 | + } else { |
|
180 | + if ($line->date_start || $line->date_end) { |
|
181 | + echo '<br><div class="clearboth nowraponall">'.get_date_range($line->date_start, $line->date_end, $format).'</div>'; |
|
182 | + } |
|
156 | 183 | //echo get_date_range($line->date_start, $line->date_end, $format); |
157 | 184 | } |
158 | 185 | |
@@ -173,11 +200,13 @@ discard block |
||
173 | 200 | ?> |
174 | 201 | </td> |
175 | 202 | <?php |
176 | - if ($object->element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier') // We must have same test in printObjectLines |
|
203 | + if ($object->element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier') { |
|
204 | + // We must have same test in printObjectLines |
|
177 | 205 | { |
178 | 206 | ?> |
179 | 207 | <td class="linecolrefsupplier"><?php |
180 | 208 | echo ($line->ref_fourn?$line->ref_fourn:$line->ref_supplier); |
209 | + } |
|
181 | 210 | ?></td> |
182 | 211 | <?php |
183 | 212 | } |
@@ -185,10 +214,18 @@ discard block |
||
185 | 214 | ?> |
186 | 215 | <td align="right" class="linecolvat nowrap"><?php $coldisplay++; ?><?php |
187 | 216 | $positiverates=''; |
188 | - if (price2num($line->tva_tx)) $positiverates.=($positiverates?'/':'').price2num($line->tva_tx); |
|
189 | - if (price2num($line->total_localtax1)) $positiverates.=($positiverates?'/':'').price2num($line->localtax1_tx); |
|
190 | - if (price2num($line->total_localtax2)) $positiverates.=($positiverates?'/':'').price2num($line->localtax2_tx); |
|
191 | - if (empty($positiverates)) $positiverates='0'; |
|
217 | + if (price2num($line->tva_tx)) { |
|
218 | + $positiverates.=($positiverates?'/':'').price2num($line->tva_tx); |
|
219 | + } |
|
220 | + if (price2num($line->total_localtax1)) { |
|
221 | + $positiverates.=($positiverates?'/':'').price2num($line->localtax1_tx); |
|
222 | + } |
|
223 | + if (price2num($line->total_localtax2)) { |
|
224 | + $positiverates.=($positiverates?'/':'').price2num($line->localtax2_tx); |
|
225 | + } |
|
226 | + if (empty($positiverates)) { |
|
227 | + $positiverates='0'; |
|
228 | + } |
|
192 | 229 | echo vatrate($positiverates.($line->vat_src_code?' ('.$line->vat_src_code.')':''), '%', $line->info_bits); |
193 | 230 | //echo vatrate($line->tva_tx.($line->vat_src_code?(' ('.$line->vat_src_code.')'):''), '%', $line->info_bits); |
194 | 231 | ?></td> |
@@ -210,7 +247,10 @@ discard block |
||
210 | 247 | // must also not be output for most entities (proposal, intervention, ...) |
211 | 248 | //if($line->qty > $line->stock) print img_picto($langs->trans("StockTooLow"),"warning", 'style="vertical-align: bottom;"')." "; |
212 | 249 | echo $line->qty; |
213 | - } else echo ' '; ?> |
|
250 | + } else { |
|
251 | + echo ' '; |
|
252 | + } |
|
253 | + ?> |
|
214 | 254 | </td> |
215 | 255 | |
216 | 256 | <?php |