|
@@ -119,7 +119,7 @@ discard block |
|
|
block discarded – undo |
119
|
119
|
if (getDolGlobalString('MAIN_USE_JQUERY_JEDITABLE') && !preg_match('/^select;/', $typeofdata)) { |
120
|
120
|
if (!empty($perm)) { |
121
|
121
|
$tmp = explode(':', $typeofdata); |
122
|
|
- $ret .= '<div class="editkey_' . $tmp[0] . (!empty($tmp[1]) ? ' ' . $tmp[1] : '') . '" id="' . $htmlname . '">'; |
|
122
|
+ $ret .= '<div class="editkey_'.$tmp[0].(!empty($tmp[1]) ? ' '.$tmp[1] : '').'" id="'.$htmlname.'">'; |
123
|
123
|
if ($fieldrequired) { |
124
|
124
|
$ret .= '<span class="fieldrequired">'; |
125
|
125
|
} |
|
@@ -131,7 +131,7 @@ discard block |
|
|
block discarded – undo |
131
|
131
|
if ($fieldrequired) { |
132
|
132
|
$ret .= '</span>'; |
133
|
133
|
} |
134
|
|
- $ret .= '</div>' . "\n"; |
|
134
|
+ $ret .= '</div>'."\n"; |
135
|
135
|
} else { |
136
|
136
|
if ($fieldrequired) { |
137
|
137
|
$ret .= '<span class="fieldrequired">'; |
|
@@ -169,8 +169,8 @@ discard block |
|
|
block discarded – undo |
169
|
169
|
if (empty($notabletag) && $perm) { |
170
|
170
|
$ret .= '<td class="right">'; |
171
|
171
|
} |
172
|
|
- if ($htmlname && GETPOST('action', 'aZ09') != 'edit' . $htmlname && $perm) { |
173
|
|
- $ret .= '<a class="editfielda reposition" href="' . $_SERVER["PHP_SELF"] . '?action=edit' . $htmlname . '&token=' . newToken() . '&' . $paramid . '=' . $object->id . $moreparam . '">' . img_edit($langs->trans('Edit'), ($notabletag ? 0 : 1)) . '</a>'; |
|
172
|
+ if ($htmlname && GETPOST('action', 'aZ09') != 'edit'.$htmlname && $perm) { |
|
173
|
+ $ret .= '<a class="editfielda reposition" href="'.$_SERVER["PHP_SELF"].'?action=edit'.$htmlname.'&token='.newToken().'&'.$paramid.'='.$object->id.$moreparam.'">'.img_edit($langs->trans('Edit'), ($notabletag ? 0 : 1)).'</a>'; |
174
|
174
|
} |
175
|
175
|
if (!empty($notabletag) && $notabletag == 1) { |
176
|
176
|
if ($text) { |
|
@@ -237,7 +237,7 @@ discard block |
|
|
block discarded – undo |
237
|
237
|
} elseif ($reg[1] == 'int') { |
238
|
238
|
$typeofdata = 'numeric'; |
239
|
239
|
} else { |
240
|
|
- return 'ErrorBadParameter ' . $typeofdata; |
|
240
|
+ return 'ErrorBadParameter '.$typeofdata; |
241
|
241
|
} |
242
|
242
|
} |
243
|
243
|
|
|
@@ -248,13 +248,13 @@ discard block |
|
|
block discarded – undo |
248
|
248
|
if ($editaction == '') { |
249
|
249
|
$editaction = GETPOST('action', 'aZ09'); |
250
|
250
|
} |
251
|
|
- $editmode = ($editaction == 'edit' . $htmlname); |
|
251
|
+ $editmode = ($editaction == 'edit'.$htmlname); |
252
|
252
|
if ($editmode) { // edit mode |
253
|
253
|
$ret .= "\n"; |
254
|
|
- $ret .= '<form method="post" action="' . $_SERVER["PHP_SELF"] . ($moreparam ? '?' . $moreparam : '') . '">'; |
255
|
|
- $ret .= '<input type="hidden" name="action" value="set' . $htmlname . '">'; |
256
|
|
- $ret .= '<input type="hidden" name="token" value="' . newToken() . '">'; |
257
|
|
- $ret .= '<input type="hidden" name="' . $paramid . '" value="' . $object->id . '">'; |
|
254
|
+ $ret .= '<form method="post" action="'.$_SERVER["PHP_SELF"].($moreparam ? '?'.$moreparam : '').'">'; |
|
255
|
+ $ret .= '<input type="hidden" name="action" value="set'.$htmlname.'">'; |
|
256
|
+ $ret .= '<input type="hidden" name="token" value="'.newToken().'">'; |
|
257
|
+ $ret .= '<input type="hidden" name="'.$paramid.'" value="'.$object->id.'">'; |
258
|
258
|
if (empty($notabletag)) { |
259
|
259
|
$ret .= '<table class="nobordernopadding centpercent">'; |
260
|
260
|
} |
|
@@ -263,28 +263,28 @@ discard block |
|
|
block discarded – undo |
263
|
263
|
} |
264
|
264
|
if (preg_match('/^(string|safehtmlstring|email|phone|url)/', $typeofdata)) { |
265
|
265
|
$tmp = explode(':', $typeofdata); |
266
|
|
- $ret .= '<input type="text" id="' . $htmlname . '" name="' . $htmlname . '" value="' . ($editvalue ? $editvalue : $value) . '"' . (empty($tmp[1]) ? '' : ' size="' . $tmp[1] . '"') . ' autofocus>'; |
|
266
|
+ $ret .= '<input type="text" id="'.$htmlname.'" name="'.$htmlname.'" value="'.($editvalue ? $editvalue : $value).'"'.(empty($tmp[1]) ? '' : ' size="'.$tmp[1].'"').' autofocus>'; |
267
|
267
|
} elseif (preg_match('/^(integer)/', $typeofdata)) { |
268
|
268
|
$tmp = explode(':', $typeofdata); |
269
|
269
|
$valuetoshow = price2num($editvalue ? $editvalue : $value, 0); |
270
|
|
- $ret .= '<input type="text" id="' . $htmlname . '" name="' . $htmlname . '" value="' . $valuetoshow . '"' . (empty($tmp[1]) ? '' : ' size="' . $tmp[1] . '"') . ' autofocus>'; |
|
270
|
+ $ret .= '<input type="text" id="'.$htmlname.'" name="'.$htmlname.'" value="'.$valuetoshow.'"'.(empty($tmp[1]) ? '' : ' size="'.$tmp[1].'"').' autofocus>'; |
271
|
271
|
} elseif (preg_match('/^(numeric|amount)/', $typeofdata)) { |
272
|
272
|
$tmp = explode(':', $typeofdata); |
273
|
273
|
$valuetoshow = price2num($editvalue ? $editvalue : $value); |
274
|
|
- $ret .= '<input type="text" id="' . $htmlname . '" name="' . $htmlname . '" value="' . ($valuetoshow != '' ? price($valuetoshow) : '') . '"' . (empty($tmp[1]) ? '' : ' size="' . $tmp[1] . '"') . ' autofocus>'; |
|
274
|
+ $ret .= '<input type="text" id="'.$htmlname.'" name="'.$htmlname.'" value="'.($valuetoshow != '' ? price($valuetoshow) : '').'"'.(empty($tmp[1]) ? '' : ' size="'.$tmp[1].'"').' autofocus>'; |
275
|
275
|
} elseif (preg_match('/^(checkbox)/', $typeofdata)) { |
276
|
276
|
$tmp = explode(':', $typeofdata); |
277
|
|
- $ret .= '<input type="checkbox" id="' . $htmlname . '" name="' . $htmlname . '" value="' . ($value ? $value : 'on') . '"' . ($value ? ' checked' : '') . (empty($tmp[1]) ? '' : $tmp[1]) . '/>'; |
|
277
|
+ $ret .= '<input type="checkbox" id="'.$htmlname.'" name="'.$htmlname.'" value="'.($value ? $value : 'on').'"'.($value ? ' checked' : '').(empty($tmp[1]) ? '' : $tmp[1]).'/>'; |
278
|
278
|
} elseif (preg_match('/^text/', $typeofdata) || preg_match('/^note/', $typeofdata)) { // if wysiwyg is enabled $typeofdata = 'ckeditor' |
279
|
279
|
$tmp = explode(':', $typeofdata); |
280
|
280
|
$cols = (empty($tmp[2]) ? '' : $tmp[2]); |
281
|
281
|
$morealt = ''; |
282
|
282
|
if (preg_match('/%/', $cols)) { |
283
|
|
- $morealt = ' style="width: ' . $cols . '"'; |
|
283
|
+ $morealt = ' style="width: '.$cols.'"'; |
284
|
284
|
$cols = ''; |
285
|
285
|
} |
286
|
286
|
$valuetoshow = ($editvalue ? $editvalue : $value); |
287
|
|
- $ret .= '<textarea id="' . $htmlname . '" name="' . $htmlname . '" wrap="soft" rows="' . (empty($tmp[1]) ? '20' : $tmp[1]) . '"' . ($cols ? ' cols="' . $cols . '"' : 'class="quatrevingtpercent"') . $morealt . '" autofocus>'; |
|
287
|
+ $ret .= '<textarea id="'.$htmlname.'" name="'.$htmlname.'" wrap="soft" rows="'.(empty($tmp[1]) ? '20' : $tmp[1]).'"'.($cols ? ' cols="'.$cols.'"' : 'class="quatrevingtpercent"').$morealt.'" autofocus>'; |
288
|
288
|
// textarea convert automatically entities chars into simple chars. |
289
|
289
|
// So we convert & into & so a string like 'a < <b>b</b><br>é<br><script>alert('X');<script>' stay a correct html and is not converted by textarea component when wysiwig is off. |
290
|
290
|
$valuetoshow = str_replace('&', '&', $valuetoshow); |
|
@@ -294,12 +294,12 @@ discard block |
|
|
block discarded – undo |
294
|
294
|
$addnowlink = empty($moreoptions['addnowlink']) ? 0 : $moreoptions['addnowlink']; |
295
|
295
|
$adddateof = empty($moreoptions['adddateof']) ? '' : $moreoptions['adddateof']; |
296
|
296
|
$labeladddateof = empty($moreoptions['labeladddateof']) ? '' : $moreoptions['labeladddateof']; |
297
|
|
- $ret .= $this->selectDate($value, $htmlname, 0, 0, 1, 'form' . $htmlname, 1, $addnowlink, 0, '', '', $adddateof, '', 1, $labeladddateof, '', $gm); |
|
297
|
+ $ret .= $this->selectDate($value, $htmlname, 0, 0, 1, 'form'.$htmlname, 1, $addnowlink, 0, '', '', $adddateof, '', 1, $labeladddateof, '', $gm); |
298
|
298
|
} elseif ($typeofdata == 'dayhour' || $typeofdata == 'datehourpicker') { |
299
|
299
|
$addnowlink = empty($moreoptions['addnowlink']) ? 0 : $moreoptions['addnowlink']; |
300
|
300
|
$adddateof = empty($moreoptions['adddateof']) ? '' : $moreoptions['adddateof']; |
301
|
301
|
$labeladddateof = empty($moreoptions['labeladddateof']) ? '' : $moreoptions['labeladddateof']; |
302
|
|
- $ret .= $this->selectDate($value, $htmlname, 1, 1, 1, 'form' . $htmlname, 1, $addnowlink, 0, '', '', $adddateof, '', 1, $labeladddateof, '', $gm); |
|
302
|
+ $ret .= $this->selectDate($value, $htmlname, 1, 1, 1, 'form'.$htmlname, 1, $addnowlink, 0, '', '', $adddateof, '', 1, $labeladddateof, '', $gm); |
303
|
303
|
} elseif (preg_match('/^select;/', $typeofdata)) { |
304
|
304
|
$arraydata = explode(',', preg_replace('/^select;/', '', $typeofdata)); |
305
|
305
|
$arraylist = array(); |
|
@@ -313,7 +313,7 @@ discard block |
|
|
block discarded – undo |
313
|
313
|
// TODO Not yet implemented. See code for extrafields |
314
|
314
|
} elseif (preg_match('/^ckeditor/', $typeofdata)) { |
315
|
315
|
$tmp = explode(':', $typeofdata); // Example: ckeditor:dolibarr_zzz:width:height:savemethod:toolbarstartexpanded:rows:cols:uselocalbrowser |
316
|
|
- require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php'; |
|
316
|
+ require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; |
317
|
317
|
$doleditor = new DolEditor($htmlname, ($editvalue ? $editvalue : $value), (empty($tmp[2]) ? '' : $tmp[2]), (empty($tmp[3]) ? '100' : $tmp[3]), (empty($tmp[1]) ? 'dolibarr_notes' : $tmp[1]), 'In', (empty($tmp[5]) ? 0 : $tmp[5]), (isset($tmp[8]) ? ($tmp[8] ? true : false) : true), true, (empty($tmp[6]) ? '20' : $tmp[6]), (empty($tmp[7]) ? '100' : $tmp[7])); |
318
|
318
|
$ret .= $doleditor->Create(1); |
319
|
319
|
} elseif ($typeofdata == 'asis') { |
|
@@ -328,19 +328,19 @@ discard block |
|
|
block discarded – undo |
328
|
328
|
$ret .= '<td>'; |
329
|
329
|
} |
330
|
330
|
//else $ret.='<div class="clearboth"></div>'; |
331
|
|
- $ret .= '<input type="submit" class="smallpaddingimp button' . (empty($notabletag) ? '' : ' ') . '" name="modify" value="' . $langs->trans("Modify") . '">'; |
|
331
|
+ $ret .= '<input type="submit" class="smallpaddingimp button'.(empty($notabletag) ? '' : ' ').'" name="modify" value="'.$langs->trans("Modify").'">'; |
332
|
332
|
if (preg_match('/ckeditor|textarea/', $typeofdata) && empty($notabletag)) { |
333
|
|
- $ret .= '<br>' . "\n"; |
|
333
|
+ $ret .= '<br>'."\n"; |
334
|
334
|
} |
335
|
|
- $ret .= '<input type="submit" class="smallpaddingimp button button-cancel' . (empty($notabletag) ? '' : ' ') . '" name="cancel" value="' . $langs->trans("Cancel") . '">'; |
|
335
|
+ $ret .= '<input type="submit" class="smallpaddingimp button button-cancel'.(empty($notabletag) ? '' : ' ').'" name="cancel" value="'.$langs->trans("Cancel").'">'; |
336
|
336
|
if (empty($notabletag)) { |
337
|
337
|
$ret .= '</td>'; |
338
|
338
|
} |
339
|
339
|
|
340
|
340
|
if (empty($notabletag)) { |
341
|
|
- $ret .= '</tr></table>' . "\n"; |
|
341
|
+ $ret .= '</tr></table>'."\n"; |
342
|
342
|
} |
343
|
|
- $ret .= '</form>' . "\n"; |
|
343
|
+ $ret .= '</form>'."\n"; |
344
|
344
|
} else { // view mode |
345
|
345
|
if (preg_match('/^email/', $typeofdata)) { |
346
|
346
|
$ret .= dol_print_email($value, 0, 0, 0, 0, 1); |
|
@@ -352,15 +352,15 @@ discard block |
|
|
block discarded – undo |
352
|
352
|
$ret .= ($value != '' ? price($value, '', $langs, 0, -1, -1, $conf->currency) : ''); |
353
|
353
|
} elseif (preg_match('/^checkbox/', $typeofdata)) { |
354
|
354
|
$tmp = explode(':', $typeofdata); |
355
|
|
- $ret .= '<input type="checkbox" disabled id="' . $htmlname . '" name="' . $htmlname . '" value="' . $value . '"' . ($value ? ' checked' : '') . ($tmp[1] ? $tmp[1] : '') . '/>'; |
|
355
|
+ $ret .= '<input type="checkbox" disabled id="'.$htmlname.'" name="'.$htmlname.'" value="'.$value.'"'.($value ? ' checked' : '').($tmp[1] ? $tmp[1] : '').'/>'; |
356
|
356
|
} elseif (preg_match('/^text/', $typeofdata) || preg_match('/^note/', $typeofdata)) { |
357
|
357
|
$ret .= dol_htmlwithnojs(dol_string_onlythesehtmltags(dol_htmlentitiesbr($value), 1, 1, 1)); |
358
|
358
|
} elseif (preg_match('/^(safehtmlstring|restricthtml)/', $typeofdata)) { // 'restricthtml' is not an allowed type for editfieldval. Value is 'safehtmlstring' |
359
|
359
|
$ret .= dol_htmlwithnojs(dol_string_onlythesehtmltags($value)); |
360
|
360
|
} elseif ($typeofdata == 'day' || $typeofdata == 'datepicker') { |
361
|
|
- $ret .= '<span class="valuedate">' . dol_print_date($value, 'day', $gm) . '</span>'; |
|
361
|
+ $ret .= '<span class="valuedate">'.dol_print_date($value, 'day', $gm).'</span>'; |
362
|
362
|
} elseif ($typeofdata == 'dayhour' || $typeofdata == 'datehourpicker') { |
363
|
|
- $ret .= '<span class="valuedate">' . dol_print_date($value, 'dayhour', $gm) . '</span>'; |
|
363
|
+ $ret .= '<span class="valuedate">'.dol_print_date($value, 'dayhour', $gm).'</span>'; |
364
|
364
|
} elseif (preg_match('/^select;/', $typeofdata)) { |
365
|
365
|
$arraydata = explode(',', preg_replace('/^select;/', '', $typeofdata)); |
366
|
366
|
$arraylist = array(); |
|
@@ -371,9 +371,9 @@ discard block |
|
|
block discarded – undo |
371
|
371
|
$ret .= $arraylist[$value]; |
372
|
372
|
if ($htmlname == 'fk_product_type') { |
373
|
373
|
if ($value == 0) { |
374
|
|
- $ret = img_picto($langs->trans("Product"), 'product', 'class="paddingleftonly paddingrightonly colorgrey"') . $ret; |
|
374
|
+ $ret = img_picto($langs->trans("Product"), 'product', 'class="paddingleftonly paddingrightonly colorgrey"').$ret; |
375
|
375
|
} else { |
376
|
|
- $ret = img_picto($langs->trans("Service"), 'service', 'class="paddingleftonly paddingrightonly colorgrey"') . $ret; |
|
376
|
+ $ret = img_picto($langs->trans("Service"), 'service', 'class="paddingleftonly paddingrightonly colorgrey"').$ret; |
377
|
377
|
} |
378
|
378
|
} |
379
|
379
|
} elseif (preg_match('/^ckeditor/', $typeofdata)) { |
|
@@ -381,7 +381,7 @@ discard block |
|
|
block discarded – undo |
381
|
381
|
if (getDolGlobalString('MAIN_DISABLE_NOTES_TAB')) { |
382
|
382
|
$firstline = preg_replace('/<br>.*/', '', $tmpcontent); |
383
|
383
|
$firstline = preg_replace('/[\n\r].*/', '', $firstline); |
384
|
|
- $tmpcontent = $firstline . ((strlen($firstline) != strlen($tmpcontent)) ? '...' : ''); |
|
384
|
+ $tmpcontent = $firstline.((strlen($firstline) != strlen($tmpcontent)) ? '...' : ''); |
385
|
385
|
} |
386
|
386
|
// We dont use dol_escape_htmltag to get the html formating active, but this need we must also |
387
|
387
|
// clean data from some dangerous html |
|
@@ -390,7 +390,7 @@ discard block |
|
|
block discarded – undo |
390
|
390
|
if (empty($moreoptions['valuealreadyhtmlescaped'])) { |
391
|
391
|
$ret .= dol_escape_htmltag($value); |
392
|
392
|
} else { |
393
|
|
- $ret .= $value; // $value must be already html escaped. |
|
393
|
+ $ret .= $value; // $value must be already html escaped. |
394
|
394
|
} |
395
|
395
|
} |
396
|
396
|
|
|
@@ -428,7 +428,7 @@ discard block |
|
|
block discarded – undo |
428
|
428
|
|
429
|
429
|
if (is_array($arrayoflangcode) && count($arrayoflangcode)) { |
430
|
430
|
if (!is_object($extralanguages)) { |
431
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/class/extralanguages.class.php'; |
|
431
|
+ include_once DOL_DOCUMENT_ROOT.'/core/class/extralanguages.class.php'; |
432
|
432
|
$extralanguages = new ExtraLanguages($this->db); |
433
|
433
|
} |
434
|
434
|
$extralanguages->fetch_name_extralanguages('societe'); |
|
@@ -437,17 +437,17 @@ discard block |
|
|
block discarded – undo |
437
|
437
|
return ''; // No extralang field to show |
438
|
438
|
} |
439
|
439
|
|
440
|
|
- $result .= '<!-- Widget for translation -->' . "\n"; |
441
|
|
- $result .= '<div class="inline-block paddingleft image-' . $object->element . '-' . $fieldname . '">'; |
|
440
|
+ $result .= '<!-- Widget for translation -->'."\n"; |
|
441
|
+ $result .= '<div class="inline-block paddingleft image-'.$object->element.'-'.$fieldname.'">'; |
442
|
442
|
$s = img_picto($langs->trans("ShowOtherLanguages"), 'language', '', false, 0, 0, '', 'fa-15 editfieldlang'); |
443
|
443
|
$result .= $s; |
444
|
444
|
$result .= '</div>'; |
445
|
445
|
|
446
|
|
- $result .= '<div class="inline-block hidden field-' . $object->element . '-' . $fieldname . '">'; |
|
446
|
+ $result .= '<div class="inline-block hidden field-'.$object->element.'-'.$fieldname.'">'; |
447
|
447
|
|
448
|
448
|
$resultforextrlang = ''; |
449
|
449
|
foreach ($arrayoflangcode as $langcode) { |
450
|
|
- $valuetoshow = GETPOSTISSET('field-' . $object->element . "-" . $fieldname . "-" . $langcode) ? GETPOST('field-' . $object->element . '-' . $fieldname . "-" . $langcode, $check) : ''; |
|
450
|
+ $valuetoshow = GETPOSTISSET('field-'.$object->element."-".$fieldname."-".$langcode) ? GETPOST('field-'.$object->element.'-'.$fieldname."-".$langcode, $check) : ''; |
451
|
451
|
if (empty($valuetoshow)) { |
452
|
452
|
$object->fetchValuesForExtraLanguages(); |
453
|
453
|
//var_dump($object->array_languages); |
|
@@ -459,17 +459,17 @@ discard block |
|
|
block discarded – undo |
459
|
459
|
|
460
|
460
|
// TODO Use the showInputField() method of ExtraLanguages object |
461
|
461
|
if ($typeofdata == 'textarea') { |
462
|
|
- $resultforextrlang .= '<textarea name="field-' . $object->element . "-" . $fieldname . "-" . $langcode . '" id="' . $fieldname . "-" . $langcode . '" class="' . $morecss . '" rows="' . ROWS_2 . '" wrap="soft">'; |
|
462
|
+ $resultforextrlang .= '<textarea name="field-'.$object->element."-".$fieldname."-".$langcode.'" id="'.$fieldname."-".$langcode.'" class="'.$morecss.'" rows="'.ROWS_2.'" wrap="soft">'; |
463
|
463
|
$resultforextrlang .= $valuetoshow; |
464
|
464
|
$resultforextrlang .= '</textarea>'; |
465
|
465
|
} else { |
466
|
|
- $resultforextrlang .= '<input type="text" class="inputfieldforlang ' . ($morecss ? ' ' . $morecss : '') . '" name="field-' . $object->element . '-' . $fieldname . '-' . $langcode . '" value="' . $valuetoshow . '">'; |
|
466
|
+ $resultforextrlang .= '<input type="text" class="inputfieldforlang '.($morecss ? ' '.$morecss : '').'" name="field-'.$object->element.'-'.$fieldname.'-'.$langcode.'" value="'.$valuetoshow.'">'; |
467
|
467
|
} |
468
|
468
|
} |
469
|
469
|
$result .= $resultforextrlang; |
470
|
470
|
|
471
|
471
|
$result .= '</div>'; |
472
|
|
- $result .= '<script nonce="' . getNonce() . '">$(".image-' . $object->element . '-' . $fieldname . '").click(function() { console.log("Toggle lang widget"); jQuery(".field-' . $object->element . '-' . $fieldname . '").toggle(); });</script>'; |
|
472
|
+ $result .= '<script nonce="'.getNonce().'">$(".image-'.$object->element.'-'.$fieldname.'").click(function() { console.log("Toggle lang widget"); jQuery(".field-'.$object->element.'-'.$fieldname.'").toggle(); });</script>'; |
473
|
473
|
} |
474
|
474
|
|
475
|
475
|
return $result; |
|
@@ -534,7 +534,7 @@ discard block |
|
|
block discarded – undo |
534
|
534
|
if (!empty($tmp[2])) { |
535
|
535
|
$savemethod = $tmp[2]; |
536
|
536
|
} |
537
|
|
- $out .= '<input id="width_' . $htmlname . '" value="' . $inputOption . '" type="hidden"/>' . "\n"; |
|
537
|
+ $out .= '<input id="width_'.$htmlname.'" value="'.$inputOption.'" type="hidden"/>'."\n"; |
538
|
538
|
} elseif ((preg_match('/^day$/', $inputType)) || (preg_match('/^datepicker/', $inputType)) || (preg_match('/^datehourpicker/', $inputType))) { |
539
|
539
|
$tmp = explode(':', $inputType); |
540
|
540
|
$inputType = $tmp[0]; |
|
@@ -545,7 +545,7 @@ discard block |
|
|
block discarded – undo |
545
|
545
|
$savemethod = $tmp[2]; |
546
|
546
|
} |
547
|
547
|
|
548
|
|
- $out .= '<input id="timestamp" type="hidden"/>' . "\n"; // Use for timestamp format |
|
548
|
+ $out .= '<input id="timestamp" type="hidden"/>'."\n"; // Use for timestamp format |
549
|
549
|
} elseif (preg_match('/^(select|autocomplete)/', $inputType)) { |
550
|
550
|
$tmp = explode(':', $inputType); |
551
|
551
|
$inputType = $tmp[0]; |
|
@@ -576,40 +576,40 @@ discard block |
|
|
block discarded – undo |
576
|
576
|
} |
577
|
577
|
|
578
|
578
|
if (isModEnabled('fckeditor')) { |
579
|
|
- $out .= '<input id="ckeditor_toolbar" value="' . $toolbar . '" type="hidden"/>' . "\n"; |
|
579
|
+ $out .= '<input id="ckeditor_toolbar" value="'.$toolbar.'" type="hidden"/>'."\n"; |
580
|
580
|
} else { |
581
|
581
|
$inputType = 'textarea'; |
582
|
582
|
} |
583
|
583
|
} |
584
|
584
|
|
585
|
|
- $out .= '<input id="element_' . $htmlname . '" value="' . $element . '" type="hidden"/>' . "\n"; |
586
|
|
- $out .= '<input id="table_element_' . $htmlname . '" value="' . $table_element . '" type="hidden"/>' . "\n"; |
587
|
|
- $out .= '<input id="fk_element_' . $htmlname . '" value="' . $fk_element . '" type="hidden"/>' . "\n"; |
588
|
|
- $out .= '<input id="loadmethod_' . $htmlname . '" value="' . $loadmethod . '" type="hidden"/>' . "\n"; |
|
585
|
+ $out .= '<input id="element_'.$htmlname.'" value="'.$element.'" type="hidden"/>'."\n"; |
|
586
|
+ $out .= '<input id="table_element_'.$htmlname.'" value="'.$table_element.'" type="hidden"/>'."\n"; |
|
587
|
+ $out .= '<input id="fk_element_'.$htmlname.'" value="'.$fk_element.'" type="hidden"/>'."\n"; |
|
588
|
+ $out .= '<input id="loadmethod_'.$htmlname.'" value="'.$loadmethod.'" type="hidden"/>'."\n"; |
589
|
589
|
if (!empty($savemethod)) { |
590
|
|
- $out .= '<input id="savemethod_' . $htmlname . '" value="' . $savemethod . '" type="hidden"/>' . "\n"; |
|
590
|
+ $out .= '<input id="savemethod_'.$htmlname.'" value="'.$savemethod.'" type="hidden"/>'."\n"; |
591
|
591
|
} |
592
|
592
|
if (!empty($ext_element)) { |
593
|
|
- $out .= '<input id="ext_element_' . $htmlname . '" value="' . $ext_element . '" type="hidden"/>' . "\n"; |
|
593
|
+ $out .= '<input id="ext_element_'.$htmlname.'" value="'.$ext_element.'" type="hidden"/>'."\n"; |
594
|
594
|
} |
595
|
595
|
if (!empty($custommsg)) { |
596
|
596
|
if (is_array($custommsg)) { |
597
|
597
|
if (!empty($custommsg['success'])) { |
598
|
|
- $out .= '<input id="successmsg_' . $htmlname . '" value="' . $custommsg['success'] . '" type="hidden"/>' . "\n"; |
|
598
|
+ $out .= '<input id="successmsg_'.$htmlname.'" value="'.$custommsg['success'].'" type="hidden"/>'."\n"; |
599
|
599
|
} |
600
|
600
|
if (!empty($custommsg['error'])) { |
601
|
|
- $out .= '<input id="errormsg_' . $htmlname . '" value="' . $custommsg['error'] . '" type="hidden"/>' . "\n"; |
|
601
|
+ $out .= '<input id="errormsg_'.$htmlname.'" value="'.$custommsg['error'].'" type="hidden"/>'."\n"; |
602
|
602
|
} |
603
|
603
|
} else { |
604
|
|
- $out .= '<input id="successmsg_' . $htmlname . '" value="' . $custommsg . '" type="hidden"/>' . "\n"; |
|
604
|
+ $out .= '<input id="successmsg_'.$htmlname.'" value="'.$custommsg.'" type="hidden"/>'."\n"; |
605
|
605
|
} |
606
|
606
|
} |
607
|
607
|
if ($inputType == 'textarea') { |
608
|
|
- $out .= '<input id="textarea_' . $htmlname . '_rows" value="' . $rows . '" type="hidden"/>' . "\n"; |
609
|
|
- $out .= '<input id="textarea_' . $htmlname . '_cols" value="' . $cols . '" type="hidden"/>' . "\n"; |
|
608
|
+ $out .= '<input id="textarea_'.$htmlname.'_rows" value="'.$rows.'" type="hidden"/>'."\n"; |
|
609
|
+ $out .= '<input id="textarea_'.$htmlname.'_cols" value="'.$cols.'" type="hidden"/>'."\n"; |
610
|
610
|
} |
611
|
|
- $out .= '<span id="viewval_' . $htmlname . '" class="viewval_' . $inputType . ($button_only ? ' inactive' : ' active') . '">' . $value . '</span>' . "\n"; |
612
|
|
- $out .= '<span id="editval_' . $htmlname . '" class="editval_' . $inputType . ($button_only ? ' inactive' : ' active') . ' hideobject">' . (!empty($editvalue) ? $editvalue : $value) . '</span>' . "\n"; |
|
611
|
+ $out .= '<span id="viewval_'.$htmlname.'" class="viewval_'.$inputType.($button_only ? ' inactive' : ' active').'">'.$value.'</span>'."\n"; |
|
612
|
+ $out .= '<span id="editval_'.$htmlname.'" class="editval_'.$inputType.($button_only ? ' inactive' : ' active').' hideobject">'.(!empty($editvalue) ? $editvalue : $value).'</span>'."\n"; |
613
|
613
|
} else { |
614
|
614
|
$out = $value; |
615
|
615
|
} |
|
@@ -638,12 +638,12 @@ discard block |
|
|
block discarded – undo |
638
|
638
|
public function textwithtooltip($text, $htmltext, $tooltipon = 1, $direction = 0, $img = '', $extracss = '', $notabs = 3, $incbefore = '', $noencodehtmltext = 0, $tooltiptrigger = '', $forcenowrap = 0) |
639
|
639
|
{ |
640
|
640
|
if ($incbefore) { |
641
|
|
- $text = $incbefore . $text; |
|
641
|
+ $text = $incbefore.$text; |
642
|
642
|
} |
643
|
643
|
if (!$htmltext) { |
644
|
644
|
return $text; |
645
|
645
|
} |
646
|
|
- $direction = (int) $direction; // For backward compatibility when $direction was set to '' instead of 0 |
|
646
|
+ $direction = (int) $direction; // For backward compatibility when $direction was set to '' instead of 0 |
647
|
647
|
|
648
|
648
|
$tag = 'td'; |
649
|
649
|
if ($notabs == 2) { |
|
@@ -657,11 +657,11 @@ discard block |
|
|
block discarded – undo |
657
|
657
|
|
658
|
658
|
$extrastyle = ''; |
659
|
659
|
if ($direction < 0) { |
660
|
|
- $extracss = ($extracss ? $extracss . ' ' : '') . ($notabs != 3 ? 'inline-block' : ''); |
|
660
|
+ $extracss = ($extracss ? $extracss.' ' : '').($notabs != 3 ? 'inline-block' : ''); |
661
|
661
|
$extrastyle = 'padding: 0px; padding-left: 3px;'; |
662
|
662
|
} |
663
|
663
|
if ($direction > 0) { |
664
|
|
- $extracss = ($extracss ? $extracss . ' ' : '') . ($notabs != 3 ? 'inline-block' : ''); |
|
664
|
+ $extracss = ($extracss ? $extracss.' ' : '').($notabs != 3 ? 'inline-block' : ''); |
665
|
665
|
$extrastyle = 'padding: 0px; padding-right: 3px;'; |
666
|
666
|
} |
667
|
667
|
|
|
@@ -674,53 +674,53 @@ discard block |
|
|
block discarded – undo |
674
|
674
|
$htmltext = str_replace('"', '"', $htmltext); |
675
|
675
|
} else { |
676
|
676
|
$classfortooltip = 'classfortooltiponclick'; |
677
|
|
- $textfordialog .= '<div style="display: none;" id="idfortooltiponclick_' . $tooltiptrigger . '" class="classfortooltiponclicktext">' . $htmltext . '</div>'; |
|
677
|
+ $textfordialog .= '<div style="display: none;" id="idfortooltiponclick_'.$tooltiptrigger.'" class="classfortooltiponclicktext">'.$htmltext.'</div>'; |
678
|
678
|
} |
679
|
679
|
if ($tooltipon == 2 || $tooltipon == 3) { |
680
|
|
- $paramfortooltipimg = ' class="' . $classfortooltip . ($notabs != 3 ? ' inline-block' : '') . ($extracss ? ' ' . $extracss : '') . '" style="padding: 0px;' . ($extrastyle ? ' ' . $extrastyle : '') . '"'; |
|
680
|
+ $paramfortooltipimg = ' class="'.$classfortooltip.($notabs != 3 ? ' inline-block' : '').($extracss ? ' '.$extracss : '').'" style="padding: 0px;'.($extrastyle ? ' '.$extrastyle : '').'"'; |
681
|
681
|
if ($tooltiptrigger == '') { |
682
|
|
- $paramfortooltipimg .= ' title="' . ($noencodehtmltext ? $htmltext : dol_escape_htmltag($htmltext, 1)) . '"'; // Attribut to put on img tag to store tooltip |
|
682
|
+ $paramfortooltipimg .= ' title="'.($noencodehtmltext ? $htmltext : dol_escape_htmltag($htmltext, 1)).'"'; // Attribut to put on img tag to store tooltip |
683
|
683
|
} else { |
684
|
|
- $paramfortooltipimg .= ' dolid="' . $tooltiptrigger . '"'; |
|
684
|
+ $paramfortooltipimg .= ' dolid="'.$tooltiptrigger.'"'; |
685
|
685
|
} |
686
|
686
|
} else { |
687
|
|
- $paramfortooltipimg = ($extracss ? ' class="' . $extracss . '"' : '') . ($extrastyle ? ' style="' . $extrastyle . '"' : ''); // Attribut to put on td text tag |
|
687
|
+ $paramfortooltipimg = ($extracss ? ' class="'.$extracss.'"' : '').($extrastyle ? ' style="'.$extrastyle.'"' : ''); // Attribut to put on td text tag |
688
|
688
|
} |
689
|
689
|
if ($tooltipon == 1 || $tooltipon == 3) { |
690
|
|
- $paramfortooltiptd = ' class="' . ($tooltipon == 3 ? 'cursorpointer ' : '') . $classfortooltip . ' inline-block' . ($extracss ? ' ' . $extracss : '') . '" style="padding: 0px;' . ($extrastyle ? ' ' . $extrastyle : '') . '" '; |
|
690
|
+ $paramfortooltiptd = ' class="'.($tooltipon == 3 ? 'cursorpointer ' : '').$classfortooltip.' inline-block'.($extracss ? ' '.$extracss : '').'" style="padding: 0px;'.($extrastyle ? ' '.$extrastyle : '').'" '; |
691
|
691
|
if ($tooltiptrigger == '') { |
692
|
|
- $paramfortooltiptd .= ' title="' . ($noencodehtmltext ? $htmltext : dol_escape_htmltag($htmltext, 1)) . '"'; // Attribut to put on td tag to store tooltip |
|
692
|
+ $paramfortooltiptd .= ' title="'.($noencodehtmltext ? $htmltext : dol_escape_htmltag($htmltext, 1)).'"'; // Attribut to put on td tag to store tooltip |
693
|
693
|
} else { |
694
|
|
- $paramfortooltiptd .= ' dolid="' . $tooltiptrigger . '"'; |
|
694
|
+ $paramfortooltiptd .= ' dolid="'.$tooltiptrigger.'"'; |
695
|
695
|
} |
696
|
696
|
} else { |
697
|
|
- $paramfortooltiptd = ($extracss ? ' class="' . $extracss . '"' : '') . ($extrastyle ? ' style="' . $extrastyle . '"' : ''); // Attribut to put on td text tag |
|
697
|
+ $paramfortooltiptd = ($extracss ? ' class="'.$extracss.'"' : '').($extrastyle ? ' style="'.$extrastyle.'"' : ''); // Attribut to put on td text tag |
698
|
698
|
} |
699
|
699
|
if (empty($notabs)) { |
700
|
700
|
$s .= '<table class="nobordernopadding"><tr style="height: auto;">'; |
701
|
701
|
} elseif ($notabs == 2) { |
702
|
|
- $s .= '<div class="inline-block' . ($forcenowrap ? ' nowrap' : '') . '">'; |
|
702
|
+ $s .= '<div class="inline-block'.($forcenowrap ? ' nowrap' : '').'">'; |
703
|
703
|
} |
704
|
704
|
// Define value if value is before |
705
|
705
|
if ($direction < 0) { |
706
|
|
- $s .= '<' . $tag . $paramfortooltipimg; |
|
706
|
+ $s .= '<'.$tag.$paramfortooltipimg; |
707
|
707
|
if ($tag == 'td') { |
708
|
708
|
$s .= ' class="valigntop" width="14"'; |
709
|
709
|
} |
710
|
|
- $s .= '>' . $textfordialog . $img . '</' . $tag . '>'; |
|
710
|
+ $s .= '>'.$textfordialog.$img.'</'.$tag.'>'; |
711
|
711
|
} |
712
|
712
|
// Use another method to help avoid having a space in value in order to use this value with jquery |
713
|
713
|
// Define label |
714
|
714
|
if ((string) $text != '') { |
715
|
|
- $s .= '<' . $tag . $paramfortooltiptd . '>' . $text . '</' . $tag . '>'; |
|
715
|
+ $s .= '<'.$tag.$paramfortooltiptd.'>'.$text.'</'.$tag.'>'; |
716
|
716
|
} |
717
|
717
|
// Define value if value is after |
718
|
718
|
if ($direction > 0) { |
719
|
|
- $s .= '<' . $tag . $paramfortooltipimg; |
|
719
|
+ $s .= '<'.$tag.$paramfortooltipimg; |
720
|
720
|
if ($tag == 'td') { |
721
|
721
|
$s .= ' class="valignmiddle" width="14"'; |
722
|
722
|
} |
723
|
|
- $s .= '>' . $textfordialog . $img . '</' . $tag . '>'; |
|
723
|
+ $s .= '>'.$textfordialog.$img.'</'.$tag.'>'; |
724
|
724
|
} |
725
|
725
|
if (empty($notabs)) { |
726
|
726
|
$s .= '</tr></table>'; |
|
@@ -825,7 +825,7 @@ discard block |
|
|
block discarded – undo |
825
|
825
|
|
826
|
826
|
$disabled = 0; |
827
|
827
|
$ret = '<div class="centpercent center">'; |
828
|
|
- $ret .= '<select class="flat' . (empty($conf->use_javascript_ajax) ? '' : ' hideobject') . ' ' . $name . ' ' . $name . 'select valignmiddle alignstart" id="' . $name . '" name="' . $name . '"' . ($disabled ? ' disabled="disabled"' : '') . '>'; |
|
828
|
+ $ret .= '<select class="flat'.(empty($conf->use_javascript_ajax) ? '' : ' hideobject').' '.$name.' '.$name.'select valignmiddle alignstart" id="'.$name.'" name="'.$name.'"'.($disabled ? ' disabled="disabled"' : '').'>'; |
829
|
829
|
|
830
|
830
|
// Complete list with data from external modules. THe module can use $_SERVER['PHP_SELF'] to know on which page we are, or use the $parameters['currentcontext'] completed by executeHooks. |
831
|
831
|
$parameters = array(); |
|
@@ -835,9 +835,9 @@ discard block |
|
|
block discarded – undo |
835
|
835
|
return; |
836
|
836
|
} |
837
|
837
|
if (empty($reshook)) { |
838
|
|
- $ret .= '<option value="0"' . ($disabled ? ' disabled="disabled"' : '') . '>-- ' . $langs->trans("SelectAction") . ' --</option>'; |
|
838
|
+ $ret .= '<option value="0"'.($disabled ? ' disabled="disabled"' : '').'>-- '.$langs->trans("SelectAction").' --</option>'; |
839
|
839
|
foreach ($arrayofaction as $code => $label) { |
840
|
|
- $ret .= '<option value="' . $code . '"' . ($disabled ? ' disabled="disabled"' : '') . ' data-html="' . dol_escape_htmltag($label) . '">' . $label . '</option>'; |
|
840
|
+ $ret .= '<option value="'.$code.'"'.($disabled ? ' disabled="disabled"' : '').' data-html="'.dol_escape_htmltag($label).'">'.$label.'</option>'; |
841
|
841
|
} |
842
|
842
|
} |
843
|
843
|
$ret .= $hookmanager->resPrint; |
|
@@ -845,17 +845,17 @@ discard block |
|
|
block discarded – undo |
845
|
845
|
$ret .= '</select>'; |
846
|
846
|
|
847
|
847
|
if (empty($conf->dol_optimize_smallscreen)) { |
848
|
|
- $ret .= ajax_combobox('.' . $name . 'select'); |
|
848
|
+ $ret .= ajax_combobox('.'.$name.'select'); |
849
|
849
|
} |
850
|
850
|
|
851
|
851
|
// Warning: if you set submit button to disabled, post using 'Enter' will no more work if there is no another input submit. So we add a hidden button |
852
|
852
|
$ret .= '<input type="submit" name="confirmmassactioninvisible" style="display: none" tabindex="-1">'; // Hidden button BEFORE so it is the one used when we submit with ENTER. |
853
|
|
- $ret .= '<input type="submit" disabled name="confirmmassaction"' . (empty($conf->use_javascript_ajax) ? '' : ' style="display: none"') . ' class="reposition button smallpaddingimp' . (empty($conf->use_javascript_ajax) ? '' : ' hideobject') . ' ' . $name . ' ' . $name . 'confirmed" value="' . dol_escape_htmltag($langs->trans("Confirm")) . '">'; |
|
853
|
+ $ret .= '<input type="submit" disabled name="confirmmassaction"'.(empty($conf->use_javascript_ajax) ? '' : ' style="display: none"').' class="reposition button smallpaddingimp'.(empty($conf->use_javascript_ajax) ? '' : ' hideobject').' '.$name.' '.$name.'confirmed" value="'.dol_escape_htmltag($langs->trans("Confirm")).'">'; |
854
|
854
|
$ret .= '</div>'; |
855
|
855
|
|
856
|
856
|
if (!empty($conf->use_javascript_ajax)) { |
857
|
857
|
$ret .= '<!-- JS CODE TO ENABLE mass action select --> |
858
|
|
- <script nonce="' . getNonce() . '"> |
|
858
|
+ <script nonce="' . getNonce().'"> |
859
|
859
|
function initCheckForSelect(mode, name, cssclass) /* mode is 0 during init of page or click all, 1 when we click on 1 checkboxi, "name" refers to the class of the massaction button, "cssclass" to the class of the checkfor select boxes */ |
860
|
860
|
{ |
861
|
861
|
atleastoneselected=0; |
|
@@ -866,11 +866,11 @@ discard block |
|
|
block discarded – undo |
866
|
866
|
|
867
|
867
|
console.log("initCheckForSelect mode="+mode+" name="+name+" cssclass="+cssclass+" atleastoneselected="+atleastoneselected); |
868
|
868
|
|
869
|
|
- if (atleastoneselected || ' . $alwaysvisible . ') |
|
869
|
+ if (atleastoneselected || ' . $alwaysvisible.') |
870
|
870
|
{ |
871
|
871
|
jQuery("."+name).show(); |
872
|
|
- ' . ($selected ? 'if (atleastoneselected) { jQuery("."+name+"select").val("' . $selected . '").trigger(\'change\'); jQuery("."+name+"confirmed").prop(\'disabled\', false); }' : '') . ' |
873
|
|
- ' . ($selected ? 'if (! atleastoneselected) { jQuery("."+name+"select").val("0").trigger(\'change\'); jQuery("."+name+"confirmed").prop(\'disabled\', true); } ' : '') . ' |
|
872
|
+ ' . ($selected ? 'if (atleastoneselected) { jQuery("."+name+"select").val("'.$selected.'").trigger(\'change\'); jQuery("."+name+"confirmed").prop(\'disabled\', false); }' : '').' |
|
873
|
+ ' . ($selected ? 'if (! atleastoneselected) { jQuery("."+name+"select").val("0").trigger(\'change\'); jQuery("."+name+"confirmed").prop(\'disabled\', true); } ' : '').' |
874
|
874
|
} |
875
|
875
|
else |
876
|
876
|
{ |
|
@@ -880,11 +880,11 @@ discard block |
|
|
block discarded – undo |
880
|
880
|
} |
881
|
881
|
|
882
|
882
|
jQuery(document).ready(function () { |
883
|
|
- initCheckForSelect(0, "' . $name . '", "' . $cssclass . '"); |
884
|
|
- jQuery(".' . $cssclass . '").click(function() { |
885
|
|
- initCheckForSelect(1, "' . $name . '", "' . $cssclass . '"); |
|
883
|
+ initCheckForSelect(0, "' . $name.'", "'.$cssclass.'"); |
|
884
|
+ jQuery(".' . $cssclass.'").click(function() { |
|
885
|
+ initCheckForSelect(1, "' . $name.'", "'.$cssclass.'"); |
886
|
886
|
}); |
887
|
|
- jQuery(".' . $name . 'select").change(function() { |
|
887
|
+ jQuery(".' . $name.'select").change(function() { |
888
|
888
|
var massaction = $( this ).val(); |
889
|
889
|
var urlform = $( this ).closest("form").attr("action").replace("#show_files",""); |
890
|
890
|
if (massaction == "builddoc") |
|
@@ -892,18 +892,18 @@ discard block |
|
|
block discarded – undo |
892
|
892
|
urlform = urlform + "#show_files"; |
893
|
893
|
} |
894
|
894
|
$( this ).closest("form").attr("action", urlform); |
895
|
|
- console.log("we select a mass action name=' . $name . ' massaction="+massaction+" - "+urlform); |
|
895
|
+ console.log("we select a mass action name=' . $name.' massaction="+massaction+" - "+urlform); |
896
|
896
|
/* Warning: if you set submit button to disabled, post using Enter will no more work if there is no other button */ |
897
|
897
|
if ($(this).val() != \'0\') |
898
|
898
|
{ |
899
|
|
- jQuery(".' . $name . 'confirmed").prop(\'disabled\', false); |
900
|
|
- jQuery(".' . $name . 'other").hide(); /* To disable if another div was open */ |
901
|
|
- jQuery(".' . $name . '"+massaction).show(); |
|
899
|
+ jQuery(".' . $name.'confirmed").prop(\'disabled\', false); |
|
900
|
+ jQuery(".' . $name.'other").hide(); /* To disable if another div was open */ |
|
901
|
+ jQuery(".' . $name.'"+massaction).show(); |
902
|
902
|
} |
903
|
903
|
else |
904
|
904
|
{ |
905
|
|
- jQuery(".' . $name . 'confirmed").prop(\'disabled\', true); |
906
|
|
- jQuery(".' . $name . 'other").hide(); /* To disable any div open */ |
|
905
|
+ jQuery(".' . $name.'confirmed").prop(\'disabled\', true); |
|
906
|
+ jQuery(".' . $name.'other").hide(); /* To disable any div open */ |
907
|
907
|
} |
908
|
908
|
}); |
909
|
909
|
}); |
|
@@ -946,14 +946,14 @@ discard block |
|
|
block discarded – undo |
946
|
946
|
$atleastonefavorite = 0; |
947
|
947
|
|
948
|
948
|
$sql = "SELECT rowid, code as code_iso, code_iso as code_iso3, label, favorite, eec"; |
949
|
|
- $sql .= " FROM " . $this->db->prefix() . "c_country"; |
|
949
|
+ $sql .= " FROM ".$this->db->prefix()."c_country"; |
950
|
950
|
$sql .= " WHERE active > 0"; |
951
|
951
|
//$sql.= " ORDER BY code ASC"; |
952
|
952
|
|
953
|
|
- dol_syslog(get_class($this) . "::select_country", LOG_DEBUG); |
|
953
|
+ dol_syslog(get_class($this)."::select_country", LOG_DEBUG); |
954
|
954
|
$resql = $this->db->query($sql); |
955
|
955
|
if ($resql) { |
956
|
|
- $out .= '<select id="select' . $htmlname . '" class="flat maxwidth200onsmartphone selectcountry' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" ' . $htmloption . '>'; |
|
956
|
+ $out .= '<select id="select'.$htmlname.'" class="flat maxwidth200onsmartphone selectcountry'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" '.$htmloption.'>'; |
957
|
957
|
$num = $this->db->num_rows($resql); |
958
|
958
|
$i = 0; |
959
|
959
|
if ($num) { |
|
@@ -963,7 +963,7 @@ discard block |
|
|
block discarded – undo |
963
|
963
|
$countryArray[$i]['rowid'] = $obj->rowid; |
964
|
964
|
$countryArray[$i]['code_iso'] = $obj->code_iso; |
965
|
965
|
$countryArray[$i]['code_iso3'] = $obj->code_iso3; |
966
|
|
- $countryArray[$i]['label'] = ($obj->code_iso && $langs->transnoentitiesnoconv("Country" . $obj->code_iso) != "Country" . $obj->code_iso ? $langs->transnoentitiesnoconv("Country" . $obj->code_iso) : ($obj->label != '-' ? $obj->label : '')); |
|
966
|
+ $countryArray[$i]['label'] = ($obj->code_iso && $langs->transnoentitiesnoconv("Country".$obj->code_iso) != "Country".$obj->code_iso ? $langs->transnoentitiesnoconv("Country".$obj->code_iso) : ($obj->label != '-' ? $obj->label : '')); |
967
|
967
|
$countryArray[$i]['favorite'] = $obj->favorite; |
968
|
968
|
$countryArray[$i]['eec'] = $obj->eec; |
969
|
969
|
$favorite[$i] = $obj->favorite; |
|
@@ -981,20 +981,20 @@ discard block |
|
|
block discarded – undo |
981
|
981
|
|
982
|
982
|
if ($showempty) { |
983
|
983
|
if (is_numeric($showempty)) { |
984
|
|
- $out .= '<option value=""> </option>' . "\n"; |
|
984
|
+ $out .= '<option value=""> </option>'."\n"; |
985
|
985
|
} else { |
986
|
|
- $out .= '<option value="-1">' . $langs->trans($showempty) . '</option>' . "\n"; |
|
986
|
+ $out .= '<option value="-1">'.$langs->trans($showempty).'</option>'."\n"; |
987
|
987
|
} |
988
|
988
|
} |
989
|
989
|
|
990
|
990
|
if ($addspecialentries) { // Add dedicated entries for groups of countries |
991
|
991
|
//if ($showempty) $out.= '<option value="" disabled class="selectoptiondisabledwhite">--------------</option>'; |
992
|
|
- $out .= '<option value="special_allnotme"' . ($selected == 'special_allnotme' ? ' selected' : '') . '>' . $langs->trans("CountriesExceptMe", $langs->transnoentitiesnoconv("Country" . $mysoc->country_code)) . '</option>'; |
993
|
|
- $out .= '<option value="special_eec"' . ($selected == 'special_eec' ? ' selected' : '') . '>' . $langs->trans("CountriesInEEC") . '</option>'; |
|
992
|
+ $out .= '<option value="special_allnotme"'.($selected == 'special_allnotme' ? ' selected' : '').'>'.$langs->trans("CountriesExceptMe", $langs->transnoentitiesnoconv("Country".$mysoc->country_code)).'</option>'; |
|
993
|
+ $out .= '<option value="special_eec"'.($selected == 'special_eec' ? ' selected' : '').'>'.$langs->trans("CountriesInEEC").'</option>'; |
994
|
994
|
if ($mysoc->isInEEC()) { |
995
|
|
- $out .= '<option value="special_eecnotme"' . ($selected == 'special_eecnotme' ? ' selected' : '') . '>' . $langs->trans("CountriesInEECExceptMe", $langs->transnoentitiesnoconv("Country" . $mysoc->country_code)) . '</option>'; |
|
995
|
+ $out .= '<option value="special_eecnotme"'.($selected == 'special_eecnotme' ? ' selected' : '').'>'.$langs->trans("CountriesInEECExceptMe", $langs->transnoentitiesnoconv("Country".$mysoc->country_code)).'</option>'; |
996
|
996
|
} |
997
|
|
- $out .= '<option value="special_noteec"' . ($selected == 'special_noteec' ? ' selected' : '') . '>' . $langs->trans("CountriesNotInEEC") . '</option>'; |
|
997
|
+ $out .= '<option value="special_noteec"'.($selected == 'special_noteec' ? ' selected' : '').'>'.$langs->trans("CountriesNotInEEC").'</option>'; |
998
|
998
|
$out .= '<option value="" disabled class="selectoptiondisabledwhite">------------</option>'; |
999
|
999
|
} |
1000
|
1000
|
|
|
@@ -1022,20 +1022,20 @@ discard block |
|
|
block discarded – undo |
1022
|
1022
|
$labeltoshow .= ' '; |
1023
|
1023
|
} |
1024
|
1024
|
if ($row['code_iso']) { |
1025
|
|
- $labeltoshow .= ' <span class="opacitymedium">(' . $row['code_iso'] . ')</span>'; |
|
1025
|
+ $labeltoshow .= ' <span class="opacitymedium">('.$row['code_iso'].')</span>'; |
1026
|
1026
|
if (empty($hideflags)) { |
1027
|
1027
|
$tmpflag = picto_from_langcode($row['code_iso'], 'class="saturatemedium paddingrightonly"', 1); |
1028
|
|
- $labeltoshow = $tmpflag . ' ' . $labeltoshow; |
|
1028
|
+ $labeltoshow = $tmpflag.' '.$labeltoshow; |
1029
|
1029
|
} |
1030
|
1030
|
} |
1031
|
1031
|
|
1032
|
1032
|
if ($selected && $selected != '-1' && ($selected == $row['rowid'] || $selected == $row['code_iso'] || $selected == $row['code_iso3'] || $selected == $row['label'])) { |
1033
|
|
- $out .= '<option value="' . ($usecodeaskey ? ($usecodeaskey == 'code2' ? $row['code_iso'] : $row['code_iso3']) : $row['rowid']) . '" selected data-html="' . dol_escape_htmltag($labeltoshow) . '" data-eec="' . ((int) $row['eec']) . '">'; |
|
1033
|
+ $out .= '<option value="'.($usecodeaskey ? ($usecodeaskey == 'code2' ? $row['code_iso'] : $row['code_iso3']) : $row['rowid']).'" selected data-html="'.dol_escape_htmltag($labeltoshow).'" data-eec="'.((int) $row['eec']).'">'; |
1034
|
1034
|
} else { |
1035
|
|
- $out .= '<option value="' . ($usecodeaskey ? ($usecodeaskey == 'code2' ? $row['code_iso'] : $row['code_iso3']) : $row['rowid']) . '" data-html="' . dol_escape_htmltag($labeltoshow) . '" data-eec="' . ((int) $row['eec']) . '">'; |
|
1035
|
+ $out .= '<option value="'.($usecodeaskey ? ($usecodeaskey == 'code2' ? $row['code_iso'] : $row['code_iso3']) : $row['rowid']).'" data-html="'.dol_escape_htmltag($labeltoshow).'" data-eec="'.((int) $row['eec']).'">'; |
1036
|
1036
|
} |
1037
|
1037
|
$out .= $labeltoshow; |
1038
|
|
- $out .= '</option>' . "\n"; |
|
1038
|
+ $out .= '</option>'."\n"; |
1039
|
1039
|
} |
1040
|
1040
|
} |
1041
|
1041
|
$out .= '</select>'; |
|
@@ -1044,8 +1044,8 @@ discard block |
|
|
block discarded – undo |
1044
|
1044
|
} |
1045
|
1045
|
|
1046
|
1046
|
// Make select dynamic |
1047
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
1048
|
|
- $out .= ajax_combobox('select' . $htmlname, array(), 0, 0, 'resolve'); |
|
1047
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
|
1048
|
+ $out .= ajax_combobox('select'.$htmlname, array(), 0, 0, 'resolve'); |
1049
|
1049
|
|
1050
|
1050
|
return $out; |
1051
|
1051
|
} |
|
@@ -1077,25 +1077,25 @@ discard block |
|
|
block discarded – undo |
1077
|
1077
|
$incotermArray = array(); |
1078
|
1078
|
|
1079
|
1079
|
$sql = "SELECT rowid, code"; |
1080
|
|
- $sql .= " FROM " . $this->db->prefix() . "c_incoterms"; |
|
1080
|
+ $sql .= " FROM ".$this->db->prefix()."c_incoterms"; |
1081
|
1081
|
$sql .= " WHERE active > 0"; |
1082
|
1082
|
$sql .= " ORDER BY code ASC"; |
1083
|
1083
|
|
1084
|
|
- dol_syslog(get_class($this) . "::select_incoterm", LOG_DEBUG); |
|
1084
|
+ dol_syslog(get_class($this)."::select_incoterm", LOG_DEBUG); |
1085
|
1085
|
$resql = $this->db->query($sql); |
1086
|
1086
|
if ($resql) { |
1087
|
1087
|
if ($conf->use_javascript_ajax && !$forcecombo) { |
1088
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
1088
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
1089
|
1089
|
$out .= ajax_combobox($htmlname, $events); |
1090
|
1090
|
} |
1091
|
1091
|
|
1092
|
1092
|
if (!empty($page)) { |
1093
|
|
- $out .= '<form method="post" action="' . $page . '">'; |
|
1093
|
+ $out .= '<form method="post" action="'.$page.'">'; |
1094
|
1094
|
$out .= '<input type="hidden" name="action" value="set_incoterms">'; |
1095
|
|
- $out .= '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
1095
|
+ $out .= '<input type="hidden" name="token" value="'.newToken().'">'; |
1096
|
1096
|
} |
1097
|
1097
|
|
1098
|
|
- $out .= '<select id="' . $htmlname . '" class="flat selectincoterm width75" name="' . $htmlname . '" ' . $htmloption . '>'; |
|
1098
|
+ $out .= '<select id="'.$htmlname.'" class="flat selectincoterm width75" name="'.$htmlname.'" '.$htmloption.'>'; |
1099
|
1099
|
$out .= '<option value="0"> </option>'; |
1100
|
1100
|
$num = $this->db->num_rows($resql); |
1101
|
1101
|
$i = 0; |
|
@@ -1109,9 +1109,9 @@ discard block |
|
|
block discarded – undo |
1109
|
1109
|
|
1110
|
1110
|
foreach ($incotermArray as $row) { |
1111
|
1111
|
if ($selected && ($selected == $row['rowid'] || $selected == $row['code'])) { |
1112
|
|
- $out .= '<option value="' . $row['rowid'] . '" selected>'; |
|
1112
|
+ $out .= '<option value="'.$row['rowid'].'" selected>'; |
1113
|
1113
|
} else { |
1114
|
|
- $out .= '<option value="' . $row['rowid'] . '">'; |
|
1114
|
+ $out .= '<option value="'.$row['rowid'].'">'; |
1115
|
1115
|
} |
1116
|
1116
|
|
1117
|
1117
|
if ($row['code']) { |
|
@@ -1124,13 +1124,13 @@ discard block |
|
|
block discarded – undo |
1124
|
1124
|
$out .= '</select>'; |
1125
|
1125
|
|
1126
|
1126
|
if ($conf->use_javascript_ajax && empty($disableautocomplete)) { |
1127
|
|
- $out .= ajax_multiautocompleter('location_incoterms', array(), DOL_URL_ROOT . '/core/ajax/locationincoterms.php') . "\n"; |
|
1127
|
+ $out .= ajax_multiautocompleter('location_incoterms', array(), DOL_URL_ROOT.'/core/ajax/locationincoterms.php')."\n"; |
1128
|
1128
|
$moreattrib .= ' autocomplete="off"'; |
1129
|
1129
|
} |
1130
|
|
- $out .= '<input id="location_incoterms" class="maxwidthonsmartphone type="text" name="location_incoterms" value="' . $location_incoterms . '">' . "\n"; |
|
1130
|
+ $out .= '<input id="location_incoterms" class="maxwidthonsmartphone type="text" name="location_incoterms" value="'.$location_incoterms.'">'."\n"; |
1131
|
1131
|
|
1132
|
1132
|
if (!empty($page)) { |
1133
|
|
- $out .= '<input type="submit" class="button valignmiddle smallpaddingimp nomargintop nomarginbottom" value="' . $langs->trans("Modify") . '"></form>'; |
|
1133
|
+ $out .= '<input type="submit" class="button valignmiddle smallpaddingimp nomargintop nomarginbottom" value="'.$langs->trans("Modify").'"></form>'; |
1134
|
1134
|
} |
1135
|
1135
|
} else { |
1136
|
1136
|
dol_print_error($this->db); |
|
@@ -1161,9 +1161,9 @@ discard block |
|
|
block discarded – undo |
1161
|
1161
|
if ($forceall == 1 || (empty($forceall) && isModEnabled("product") && isModEnabled("service")) |
1162
|
1162
|
|| (empty($forceall) && !isModEnabled('product') && !isModEnabled('service'))) { |
1163
|
1163
|
if (empty($hidetext)) { |
1164
|
|
- print $langs->trans("Type") . ': '; |
|
1164
|
+ print $langs->trans("Type").': '; |
1165
|
1165
|
} |
1166
|
|
- print '<select class="flat" id="select_' . $htmlname . '" name="' . $htmlname . '">'; |
|
1166
|
+ print '<select class="flat" id="select_'.$htmlname.'" name="'.$htmlname.'">'; |
1167
|
1167
|
if ($showempty) { |
1168
|
1168
|
print '<option value="-1"'; |
1169
|
1169
|
if ($selected == -1) { |
|
@@ -1176,28 +1176,28 @@ discard block |
|
|
block discarded – undo |
1176
|
1176
|
if (0 == $selected || ($selected == -1 && getDolGlobalString('MAIN_FREE_PRODUCT_CHECKED_BY_DEFAULT') == 'product')) { |
1177
|
1177
|
print ' selected'; |
1178
|
1178
|
} |
1179
|
|
- print '>' . $langs->trans("Product"); |
|
1179
|
+ print '>'.$langs->trans("Product"); |
1180
|
1180
|
|
1181
|
1181
|
print '<option value="1"'; |
1182
|
1182
|
if (1 == $selected || ($selected == -1 && getDolGlobalString('MAIN_FREE_PRODUCT_CHECKED_BY_DEFAULT') == 'service')) { |
1183
|
1183
|
print ' selected'; |
1184
|
1184
|
} |
1185
|
|
- print '>' . $langs->trans("Service"); |
|
1185
|
+ print '>'.$langs->trans("Service"); |
1186
|
1186
|
|
1187
|
1187
|
print '</select>'; |
1188
|
|
- print ajax_combobox('select_' . $htmlname); |
|
1188
|
+ print ajax_combobox('select_'.$htmlname); |
1189
|
1189
|
//if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); |
1190
|
1190
|
} |
1191
|
1191
|
if ((empty($forceall) && !isModEnabled('product') && isModEnabled("service")) || $forceall == 3) { |
1192
|
1192
|
print $langs->trans("Service"); |
1193
|
|
- print '<input type="hidden" name="' . $htmlname . '" value="1">'; |
|
1193
|
+ print '<input type="hidden" name="'.$htmlname.'" value="1">'; |
1194
|
1194
|
} |
1195
|
1195
|
if ((empty($forceall) && isModEnabled("product") && !isModEnabled('service')) || $forceall == 2) { |
1196
|
1196
|
print $langs->trans("Product"); |
1197
|
|
- print '<input type="hidden" name="' . $htmlname . '" value="0">'; |
|
1197
|
+ print '<input type="hidden" name="'.$htmlname.'" value="0">'; |
1198
|
1198
|
} |
1199
|
1199
|
if ($forceall < 0) { // This should happened only for contracts when both predefined product and service are disabled. |
1200
|
|
- print '<input type="hidden" name="' . $htmlname . '" value="1">'; // By default we set on service for contract. If CONTRACT_SUPPORT_PRODUCTS is set, forceall should be 1 not -1 |
|
1200
|
+ print '<input type="hidden" name="'.$htmlname.'" value="1">'; // By default we set on service for contract. If CONTRACT_SUPPORT_PRODUCTS is set, forceall should be 1 not -1 |
1201
|
1201
|
} |
1202
|
1202
|
} |
1203
|
1203
|
|
|
@@ -1223,7 +1223,7 @@ discard block |
|
|
block discarded – undo |
1223
|
1223
|
$langs->load("trips"); |
1224
|
1224
|
|
1225
|
1225
|
$sql = "SELECT c.code, c.label"; |
1226
|
|
- $sql .= " FROM " . $this->db->prefix() . "c_type_fees as c"; |
|
1226
|
+ $sql .= " FROM ".$this->db->prefix()."c_type_fees as c"; |
1227
|
1227
|
$sql .= " WHERE active > 0"; |
1228
|
1228
|
|
1229
|
1229
|
$resql = $this->db->query($sql); |
|
@@ -1264,11 +1264,11 @@ discard block |
|
|
block discarded – undo |
1264
|
1264
|
// phpcs:enable |
1265
|
1265
|
global $user, $langs; |
1266
|
1266
|
|
1267
|
|
- dol_syslog(__METHOD__ . " selected=" . $selected . ", htmlname=" . $htmlname, LOG_DEBUG); |
|
1267
|
+ dol_syslog(__METHOD__." selected=".$selected.", htmlname=".$htmlname, LOG_DEBUG); |
1268
|
1268
|
|
1269
|
1269
|
$this->load_cache_types_fees(); |
1270
|
1270
|
|
1271
|
|
- print '<select id="select_' . $htmlname . '" class="flat" name="' . $htmlname . '">'; |
|
1271
|
+ print '<select id="select_'.$htmlname.'" class="flat" name="'.$htmlname.'">'; |
1272
|
1272
|
if ($showempty) { |
1273
|
1273
|
print '<option value="-1"'; |
1274
|
1274
|
if ($selected == -1) { |
|
@@ -1278,7 +1278,7 @@ discard block |
|
|
block discarded – undo |
1278
|
1278
|
} |
1279
|
1279
|
|
1280
|
1280
|
foreach ($this->cache_types_fees as $key => $value) { |
1281
|
|
- print '<option value="' . $key . '"'; |
|
1281
|
+ print '<option value="'.$key.'"'; |
1282
|
1282
|
if ($key == $selected) { |
1283
|
1283
|
print ' selected'; |
1284
|
1284
|
} |
|
@@ -1329,12 +1329,12 @@ discard block |
|
|
block discarded – undo |
1329
|
1329
|
$ajaxoptions = array(); |
1330
|
1330
|
} |
1331
|
1331
|
|
1332
|
|
- require_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
1332
|
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
1333
|
1333
|
|
1334
|
1334
|
// No immediate load of all database |
1335
|
1335
|
$placeholder = ''; |
1336
|
1336
|
if ($selected && empty($selected_input_value)) { |
1337
|
|
- require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; |
|
1337
|
+ require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; |
1338
|
1338
|
$societetmp = new Societe($this->db); |
1339
|
1339
|
$societetmp->fetch($selected); |
1340
|
1340
|
$selected_input_value = $societetmp->name; |
|
@@ -1342,25 +1342,25 @@ discard block |
|
|
block discarded – undo |
1342
|
1342
|
} |
1343
|
1343
|
|
1344
|
1344
|
// mode 1 |
1345
|
|
- $urloption = 'htmlname=' . urlencode(str_replace('.', '_', $htmlname)) . '&outjson=1&filter=' . urlencode($filter) . (empty($excludeids) ? '' : '&excludeids=' . join(',', $excludeids)) . ($showtype ? '&showtype=' . urlencode($showtype) : '') . ($showcode ? '&showcode=' . urlencode($showcode) : ''); |
|
1345
|
+ $urloption = 'htmlname='.urlencode(str_replace('.', '_', $htmlname)).'&outjson=1&filter='.urlencode($filter).(empty($excludeids) ? '' : '&excludeids='.join(',', $excludeids)).($showtype ? '&showtype='.urlencode($showtype) : '').($showcode ? '&showcode='.urlencode($showcode) : ''); |
1346
|
1346
|
|
1347
|
1347
|
$out .= '<!-- force css to be higher than dialog popup --><style type="text/css">.ui-autocomplete { z-index: 1010; }</style>'; |
1348
|
1348
|
if (empty($hidelabel)) { |
1349
|
|
- print $langs->trans("RefOrLabel") . ' : '; |
|
1349
|
+ print $langs->trans("RefOrLabel").' : '; |
1350
|
1350
|
} elseif ($hidelabel > 1) { |
1351
|
1351
|
$placeholder = $langs->trans("RefOrLabel"); |
1352
|
1352
|
if ($hidelabel == 2) { |
1353
|
1353
|
$out .= img_picto($langs->trans("Search"), 'search'); |
1354
|
1354
|
} |
1355
|
1355
|
} |
1356
|
|
- $out .= '<input type="text" class="' . $morecss . '" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . ($placeholder ? ' placeholder="' . dol_escape_htmltag($placeholder) . '"' : '') . ' ' . (getDolGlobalString('THIRDPARTY_SEARCH_AUTOFOCUS') ? 'autofocus' : '') . ' />'; |
|
1356
|
+ $out .= '<input type="text" class="'.$morecss.'" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.($placeholder ? ' placeholder="'.dol_escape_htmltag($placeholder).'"' : '').' '.(getDolGlobalString('THIRDPARTY_SEARCH_AUTOFOCUS') ? 'autofocus' : '').' />'; |
1357
|
1357
|
if ($hidelabel == 3) { |
1358
|
1358
|
$out .= img_picto($langs->trans("Search"), 'search'); |
1359
|
1359
|
} |
1360
|
1360
|
|
1361
|
1361
|
$out .= ajax_event($htmlname, $events); |
1362
|
1362
|
|
1363
|
|
- $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/societe/ajax/company.php', $urloption, $conf->global->COMPANY_USE_SEARCH_TO_SELECT, 0, $ajaxoptions); |
|
1363
|
+ $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/societe/ajax/company.php', $urloption, $conf->global->COMPANY_USE_SEARCH_TO_SELECT, 0, $ajaxoptions); |
1364
|
1364
|
} else { |
1365
|
1365
|
// Immediate load of all database |
1366
|
1366
|
$out .= $this->select_thirdparty_list($selected, $htmlname, $filter, $showempty, $showtype, $forcecombo, $events, '', 0, $limit, $morecss, $moreparam, $multiple, $excludeids, $showcode); |
|
@@ -1444,30 +1444,30 @@ discard block |
|
|
block discarded – undo |
1444
|
1444
|
$sql .= ", s.address, s.zip, s.town"; |
1445
|
1445
|
$sql .= ", dictp.code as country_code"; |
1446
|
1446
|
} |
1447
|
|
- $sql .= " FROM " . $this->db->prefix() . "societe as s"; |
|
1447
|
+ $sql .= " FROM ".$this->db->prefix()."societe as s"; |
1448
|
1448
|
if (getDolGlobalString('COMPANY_SHOW_ADDRESS_SELECTLIST')) { |
1449
|
|
- $sql .= " LEFT JOIN " . $this->db->prefix() . "c_country as dictp ON dictp.rowid = s.fk_pays"; |
|
1449
|
+ $sql .= " LEFT JOIN ".$this->db->prefix()."c_country as dictp ON dictp.rowid = s.fk_pays"; |
1450
|
1450
|
} |
1451
|
1451
|
if (!$user->hasRight('societe', 'client', 'voir') && !$user->socid) { |
1452
|
|
- $sql .= ", " . $this->db->prefix() . "societe_commerciaux as sc"; |
|
1452
|
+ $sql .= ", ".$this->db->prefix()."societe_commerciaux as sc"; |
1453
|
1453
|
} |
1454
|
|
- $sql .= " WHERE s.entity IN (" . getEntity('societe') . ")"; |
|
1454
|
+ $sql .= " WHERE s.entity IN (".getEntity('societe').")"; |
1455
|
1455
|
if (!empty($user->socid)) { |
1456
|
|
- $sql .= " AND s.rowid = " . ((int) $user->socid); |
|
1456
|
+ $sql .= " AND s.rowid = ".((int) $user->socid); |
1457
|
1457
|
} |
1458
|
1458
|
if ($filter) { |
1459
|
1459
|
// $filter is safe because, if it contains '(' or ')', it has been sanitized by testSqlAndScriptInject() and forgeSQLFromUniversalSearchCriteria() |
1460
|
1460
|
// if not, by testSqlAndScriptInject() only. |
1461
|
|
- $sql .= " AND (" . $filter . ")"; |
|
1461
|
+ $sql .= " AND (".$filter.")"; |
1462
|
1462
|
} |
1463
|
1463
|
if (!$user->hasRight('societe', 'client', 'voir') && !$user->socid) { |
1464
|
|
- $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " . ((int) $user->id); |
|
1464
|
+ $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id); |
1465
|
1465
|
} |
1466
|
1466
|
if (getDolGlobalString('COMPANY_HIDE_INACTIVE_IN_COMBOBOX')) { |
1467
|
1467
|
$sql .= " AND s.status <> 0"; |
1468
|
1468
|
} |
1469
|
1469
|
if (!empty($excludeids)) { |
1470
|
|
- $sql .= " AND s.rowid NOT IN (" . $this->db->sanitize(join(',', $excludeids)) . ")"; |
|
1470
|
+ $sql .= " AND s.rowid NOT IN (".$this->db->sanitize(join(',', $excludeids)).")"; |
1471
|
1471
|
} |
1472
|
1472
|
// Add where from hooks |
1473
|
1473
|
$parameters = array(); |
|
@@ -1487,17 +1487,17 @@ discard block |
|
|
block discarded – undo |
1487
|
1487
|
if ($i > 0) { |
1488
|
1488
|
$sql .= " AND "; |
1489
|
1489
|
} |
1490
|
|
- $sql .= "(s.nom LIKE '" . $this->db->escape($prefix . $crit) . "%')"; |
|
1490
|
+ $sql .= "(s.nom LIKE '".$this->db->escape($prefix.$crit)."%')"; |
1491
|
1491
|
$i++; |
1492
|
1492
|
} |
1493
|
1493
|
if (count($scrit) > 1) { |
1494
|
1494
|
$sql .= ")"; |
1495
|
1495
|
} |
1496
|
1496
|
if (isModEnabled('barcode')) { |
1497
|
|
- $sql .= " OR s.barcode LIKE '" . $this->db->escape($prefix . $filterkey) . "%'"; |
|
1497
|
+ $sql .= " OR s.barcode LIKE '".$this->db->escape($prefix.$filterkey)."%'"; |
1498
|
1498
|
} |
1499
|
|
- $sql .= " OR s.code_client LIKE '" . $this->db->escape($prefix . $filterkey) . "%' OR s.code_fournisseur LIKE '" . $this->db->escape($prefix . $filterkey) . "%'"; |
1500
|
|
- $sql .= " OR s.name_alias LIKE '" . $this->db->escape($prefix . $filterkey) . "%' OR s.tva_intra LIKE '" . $this->db->escape($prefix . $filterkey) . "%'"; |
|
1499
|
+ $sql .= " OR s.code_client LIKE '".$this->db->escape($prefix.$filterkey)."%' OR s.code_fournisseur LIKE '".$this->db->escape($prefix.$filterkey)."%'"; |
|
1500
|
+ $sql .= " OR s.name_alias LIKE '".$this->db->escape($prefix.$filterkey)."%' OR s.tva_intra LIKE '".$this->db->escape($prefix.$filterkey)."%'"; |
1501
|
1501
|
$sql .= ")"; |
1502
|
1502
|
} |
1503
|
1503
|
$sql .= $this->db->order("nom", "ASC"); |
|
@@ -1508,12 +1508,12 @@ discard block |
|
|
block discarded – undo |
1508
|
1508
|
$resql = $this->db->query($sql); |
1509
|
1509
|
if ($resql) { |
1510
|
1510
|
if (!$forcecombo) { |
1511
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
1511
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
1512
|
1512
|
$out .= ajax_combobox($htmlname, $events, getDolGlobalString("COMPANY_USE_SEARCH_TO_SELECT")); |
1513
|
1513
|
} |
1514
|
1514
|
|
1515
|
1515
|
// Construct $out and $outarray |
1516
|
|
- $out .= '<select id="' . $htmlname . '" class="flat' . ($morecss ? ' ' . $morecss : '') . '"' . ($moreparam ? ' ' . $moreparam : '') . ' name="' . $htmlname . ($multiple ? '[]' : '') . '" ' . ($multiple ? 'multiple' : '') . '>' . "\n"; |
|
1516
|
+ $out .= '<select id="'.$htmlname.'" class="flat'.($morecss ? ' '.$morecss : '').'"'.($moreparam ? ' '.$moreparam : '').' name="'.$htmlname.($multiple ? '[]' : '').'" '.($multiple ? 'multiple' : '').'>'."\n"; |
1517
|
1517
|
|
1518
|
1518
|
$textifempty = (($showempty && !is_numeric($showempty)) ? $langs->trans($showempty) : ''); |
1519
|
1519
|
if (getDolGlobalString('COMPANY_USE_SEARCH_TO_SELECT')) { |
|
@@ -1526,7 +1526,7 @@ discard block |
|
|
block discarded – undo |
1526
|
1526
|
} |
1527
|
1527
|
} |
1528
|
1528
|
if ($showempty) { |
1529
|
|
- $out .= '<option value="-1" data-html="' . dol_escape_htmltag('<span class="opacitymedium">' . ($textifempty ? $textifempty : ' ') . '</span>') . '">' . $textifempty . '</option>' . "\n"; |
|
1529
|
+ $out .= '<option value="-1" data-html="'.dol_escape_htmltag('<span class="opacitymedium">'.($textifempty ? $textifempty : ' ').'</span>').'">'.$textifempty.'</option>'."\n"; |
1530
|
1530
|
} |
1531
|
1531
|
|
1532
|
1532
|
$companytemp = new Societe($this->db); |
|
@@ -1539,18 +1539,18 @@ discard block |
|
|
block discarded – undo |
1539
|
1539
|
$label = ''; |
1540
|
1540
|
if ($showcode || getDolGlobalString('SOCIETE_ADD_REF_IN_LIST')) { |
1541
|
1541
|
if (($obj->client) && (!empty($obj->code_client))) { |
1542
|
|
- $label = $obj->code_client . ' - '; |
|
1542
|
+ $label = $obj->code_client.' - '; |
1543
|
1543
|
} |
1544
|
1544
|
if (($obj->fournisseur) && (!empty($obj->code_fournisseur))) { |
1545
|
|
- $label .= $obj->code_fournisseur . ' - '; |
|
1545
|
+ $label .= $obj->code_fournisseur.' - '; |
1546
|
1546
|
} |
1547
|
|
- $label .= ' ' . $obj->name; |
|
1547
|
+ $label .= ' '.$obj->name; |
1548
|
1548
|
} else { |
1549
|
1549
|
$label = $obj->name; |
1550
|
1550
|
} |
1551
|
1551
|
|
1552
|
1552
|
if (!empty($obj->name_alias)) { |
1553
|
|
- $label .= ' (' . $obj->name_alias . ')'; |
|
1553
|
+ $label .= ' ('.$obj->name_alias.')'; |
1554
|
1554
|
} |
1555
|
1555
|
|
1556
|
1556
|
if (getDolGlobalString('SOCIETE_SHOW_VAT_IN_LIST') && !empty($obj->tva_intra)) { |
|
@@ -1565,7 +1565,7 @@ discard block |
|
|
block discarded – undo |
1565
|
1565
|
$companytemp->fournisseur = $obj->fournisseur; |
1566
|
1566
|
$tmptype = $companytemp->getTypeUrl(1, '', 0, 'span'); |
1567
|
1567
|
if ($tmptype) { |
1568
|
|
- $labelhtml .= ' ' . $tmptype; |
|
1568
|
+ $labelhtml .= ' '.$tmptype; |
1569
|
1569
|
} |
1570
|
1570
|
|
1571
|
1571
|
if ($obj->client || $obj->fournisseur) { |
|
@@ -1575,10 +1575,10 @@ discard block |
|
|
block discarded – undo |
1575
|
1575
|
$label .= $langs->trans("Customer"); |
1576
|
1576
|
} |
1577
|
1577
|
if ($obj->client == 2 || $obj->client == 3) { |
1578
|
|
- $label .= ($obj->client == 3 ? ', ' : '') . $langs->trans("Prospect"); |
|
1578
|
+ $label .= ($obj->client == 3 ? ', ' : '').$langs->trans("Prospect"); |
1579
|
1579
|
} |
1580
|
1580
|
if ($obj->fournisseur) { |
1581
|
|
- $label .= ($obj->client ? ', ' : '') . $langs->trans("Supplier"); |
|
1581
|
+ $label .= ($obj->client ? ', ' : '').$langs->trans("Supplier"); |
1582
|
1582
|
} |
1583
|
1583
|
if ($obj->client || $obj->fournisseur) { |
1584
|
1584
|
$label .= ')'; |
|
@@ -1586,9 +1586,9 @@ discard block |
|
|
block discarded – undo |
1586
|
1586
|
} |
1587
|
1587
|
|
1588
|
1588
|
if (getDolGlobalString('COMPANY_SHOW_ADDRESS_SELECTLIST')) { |
1589
|
|
- $s = ($obj->address ? ' - ' . $obj->address : '') . ($obj->zip ? ' - ' . $obj->zip : '') . ($obj->town ? ' ' . $obj->town : ''); |
|
1589
|
+ $s = ($obj->address ? ' - '.$obj->address : '').($obj->zip ? ' - '.$obj->zip : '').($obj->town ? ' '.$obj->town : ''); |
1590
|
1590
|
if (!empty($obj->country_code)) { |
1591
|
|
- $s .= ', ' . $langs->trans('Country' . $obj->country_code); |
|
1591
|
+ $s .= ', '.$langs->trans('Country'.$obj->country_code); |
1592
|
1592
|
} |
1593
|
1593
|
$label .= $s; |
1594
|
1594
|
$labelhtml .= $s; |
|
@@ -1596,9 +1596,9 @@ discard block |
|
|
block discarded – undo |
1596
|
1596
|
|
1597
|
1597
|
if (empty($outputmode)) { |
1598
|
1598
|
if (in_array($obj->rowid, $selected)) { |
1599
|
|
- $out .= '<option value="' . $obj->rowid . '" selected data-html="' . dol_escape_htmltag($labelhtml, 0, 0, '', 0, 1) . '">' . dol_escape_htmltag($label, 0, 0, '', 0, 1) . '</option>'; |
|
1599
|
+ $out .= '<option value="'.$obj->rowid.'" selected data-html="'.dol_escape_htmltag($labelhtml, 0, 0, '', 0, 1).'">'.dol_escape_htmltag($label, 0, 0, '', 0, 1).'</option>'; |
1600
|
1600
|
} else { |
1601
|
|
- $out .= '<option value="' . $obj->rowid . '" data-html="' . dol_escape_htmltag($labelhtml, 0, 0, '', 0, 1) . '">' . dol_escape_htmltag($label, 0, 0, '', 0, 1) . '</option>'; |
|
1601
|
+ $out .= '<option value="'.$obj->rowid.'" data-html="'.dol_escape_htmltag($labelhtml, 0, 0, '', 0, 1).'">'.dol_escape_htmltag($label, 0, 0, '', 0, 1).'</option>'; |
1602
|
1602
|
} |
1603
|
1603
|
} else { |
1604
|
1604
|
array_push($outarray, array('key' => $obj->rowid, 'value' => $label, 'label' => $label, 'labelhtml' => $labelhtml)); |
|
@@ -1610,7 +1610,7 @@ discard block |
|
|
block discarded – undo |
1610
|
1610
|
} |
1611
|
1611
|
} |
1612
|
1612
|
} |
1613
|
|
- $out .= '</select>' . "\n"; |
|
1613
|
+ $out .= '</select>'."\n"; |
1614
|
1614
|
} else { |
1615
|
1615
|
dol_print_error($this->db); |
1616
|
1616
|
} |
|
@@ -1644,18 +1644,18 @@ discard block |
|
|
block discarded – undo |
1644
|
1644
|
// On recherche les remises |
1645
|
1645
|
$sql = "SELECT re.rowid, re.amount_ht, re.amount_tva, re.amount_ttc,"; |
1646
|
1646
|
$sql .= " re.description, re.fk_facture_source"; |
1647
|
|
- $sql .= " FROM " . $this->db->prefix() . "societe_remise_except as re"; |
1648
|
|
- $sql .= " WHERE re.fk_soc = " . (int) $socid; |
1649
|
|
- $sql .= " AND re.entity = " . $conf->entity; |
|
1647
|
+ $sql .= " FROM ".$this->db->prefix()."societe_remise_except as re"; |
|
1648
|
+ $sql .= " WHERE re.fk_soc = ".(int) $socid; |
|
1649
|
+ $sql .= " AND re.entity = ".$conf->entity; |
1650
|
1650
|
if ($filter) { |
1651
|
|
- $sql .= " AND " . $filter; |
|
1651
|
+ $sql .= " AND ".$filter; |
1652
|
1652
|
} |
1653
|
1653
|
$sql .= " ORDER BY re.description ASC"; |
1654
|
1654
|
|
1655
|
|
- dol_syslog(get_class($this) . "::select_remises", LOG_DEBUG); |
|
1655
|
+ dol_syslog(get_class($this)."::select_remises", LOG_DEBUG); |
1656
|
1656
|
$resql = $this->db->query($sql); |
1657
|
1657
|
if ($resql) { |
1658
|
|
- print '<select id="select_' . $htmlname . '" class="flat maxwidthonsmartphone" name="' . $htmlname . '">'; |
|
1658
|
+ print '<select id="select_'.$htmlname.'" class="flat maxwidthonsmartphone" name="'.$htmlname.'">'; |
1659
|
1659
|
$num = $this->db->num_rows($resql); |
1660
|
1660
|
|
1661
|
1661
|
$qualifiedlines = $num; |
|
@@ -1693,16 +1693,16 @@ discard block |
|
|
block discarded – undo |
1693
|
1693
|
if (getDolGlobalString('MAIN_SHOW_FACNUMBER_IN_DISCOUNT_LIST') && !empty($obj->fk_facture_source)) { |
1694
|
1694
|
$tmpfac = new Facture($this->db); |
1695
|
1695
|
if ($tmpfac->fetch($obj->fk_facture_source) > 0) { |
1696
|
|
- $desc = $desc . ' - ' . $tmpfac->ref; |
|
1696
|
+ $desc = $desc.' - '.$tmpfac->ref; |
1697
|
1697
|
} |
1698
|
1698
|
} |
1699
|
1699
|
|
1700
|
|
- print '<option value="' . $obj->rowid . '"' . $selectstring . $disabled . '>' . $desc . ' (' . price($obj->amount_ht) . ' ' . $langs->trans("HT") . ' - ' . price($obj->amount_ttc) . ' ' . $langs->trans("TTC") . ')</option>'; |
|
1700
|
+ print '<option value="'.$obj->rowid.'"'.$selectstring.$disabled.'>'.$desc.' ('.price($obj->amount_ht).' '.$langs->trans("HT").' - '.price($obj->amount_ttc).' '.$langs->trans("TTC").')</option>'; |
1701
|
1701
|
$i++; |
1702
|
1702
|
} |
1703
|
1703
|
} |
1704
|
1704
|
print '</select>'; |
1705
|
|
- print ajax_combobox('select_' . $htmlname); |
|
1705
|
+ print ajax_combobox('select_'.$htmlname); |
1706
|
1706
|
|
1707
|
1707
|
return $qualifiedlines; |
1708
|
1708
|
} else { |
|
@@ -1783,7 +1783,7 @@ discard block |
|
|
block discarded – undo |
1783
|
1783
|
$out = ''; |
1784
|
1784
|
|
1785
|
1785
|
if (!is_object($hookmanager)) { |
1786
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/class/hookmanager.class.php'; |
|
1786
|
+ include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; |
1787
|
1787
|
$hookmanager = new HookManager($this->db); |
1788
|
1788
|
} |
1789
|
1789
|
|
|
@@ -1792,13 +1792,13 @@ discard block |
|
|
block discarded – undo |
1792
|
1792
|
if ($showsoc > 0 || getDolGlobalString('CONTACT_SHOW_EMAIL_PHONE_TOWN_SELECTLIST')) { |
1793
|
1793
|
$sql .= ", s.nom as company, s.town AS company_town"; |
1794
|
1794
|
} |
1795
|
|
- $sql .= " FROM " . $this->db->prefix() . "socpeople as sp"; |
|
1795
|
+ $sql .= " FROM ".$this->db->prefix()."socpeople as sp"; |
1796
|
1796
|
if ($showsoc > 0 || getDolGlobalString('CONTACT_SHOW_EMAIL_PHONE_TOWN_SELECTLIST')) { |
1797
|
|
- $sql .= " LEFT OUTER JOIN " . $this->db->prefix() . "societe as s ON s.rowid=sp.fk_soc"; |
|
1797
|
+ $sql .= " LEFT OUTER JOIN ".$this->db->prefix()."societe as s ON s.rowid=sp.fk_soc"; |
1798
|
1798
|
} |
1799
|
|
- $sql .= " WHERE sp.entity IN (" . getEntity('contact') . ")"; |
|
1799
|
+ $sql .= " WHERE sp.entity IN (".getEntity('contact').")"; |
1800
|
1800
|
if ($socid > 0 || $socid == -1) { |
1801
|
|
- $sql .= " AND sp.fk_soc = " . ((int) $socid); |
|
1801
|
+ $sql .= " AND sp.fk_soc = ".((int) $socid); |
1802
|
1802
|
} |
1803
|
1803
|
if (getDolGlobalString('CONTACT_HIDE_INACTIVE_IN_COMBOBOX')) { |
1804
|
1804
|
$sql .= " AND sp.statut <> 0"; |
|
@@ -1809,30 +1809,30 @@ discard block |
|
|
block discarded – undo |
1809
|
1809
|
$sql .= $hookmanager->resPrint; |
1810
|
1810
|
$sql .= " ORDER BY sp.lastname ASC"; |
1811
|
1811
|
|
1812
|
|
- dol_syslog(get_class($this) . "::selectcontacts", LOG_DEBUG); |
|
1812
|
+ dol_syslog(get_class($this)."::selectcontacts", LOG_DEBUG); |
1813
|
1813
|
$resql = $this->db->query($sql); |
1814
|
1814
|
if ($resql) { |
1815
|
1815
|
$num = $this->db->num_rows($resql); |
1816
|
1816
|
|
1817
|
1817
|
if ($htmlname != 'none' && !$options_only) { |
1818
|
|
- $out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" id="' . $htmlid . '" name="' . $htmlname . (($num || empty($disableifempty)) ? '' : ' disabled') . ($multiple ? '[]' : '') . '" ' . ($multiple ? 'multiple' : '') . ' ' . (!empty($moreparam) ? $moreparam : '') . '>'; |
|
1818
|
+ $out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" id="'.$htmlid.'" name="'.$htmlname.(($num || empty($disableifempty)) ? '' : ' disabled').($multiple ? '[]' : '').'" '.($multiple ? 'multiple' : '').' '.(!empty($moreparam) ? $moreparam : '').'>'; |
1819
|
1819
|
} |
1820
|
1820
|
|
1821
|
1821
|
if ($showempty && !is_numeric($showempty)) { |
1822
|
1822
|
$textforempty = $showempty; |
1823
|
|
- $out .= '<option class="optiongrey" value="-1"' . (in_array(-1, $selected) ? ' selected' : '') . '>' . $textforempty . '</option>'; |
|
1823
|
+ $out .= '<option class="optiongrey" value="-1"'.(in_array(-1, $selected) ? ' selected' : '').'>'.$textforempty.'</option>'; |
1824
|
1824
|
} else { |
1825
|
1825
|
if (($showempty == 1 || ($showempty == 3 && $num > 1)) && !$multiple) { |
1826
|
|
- $out .= '<option value="0"' . (in_array(0, $selected) ? ' selected' : '') . '> </option>'; |
|
1826
|
+ $out .= '<option value="0"'.(in_array(0, $selected) ? ' selected' : '').'> </option>'; |
1827
|
1827
|
} |
1828
|
1828
|
if ($showempty == 2) { |
1829
|
|
- $out .= '<option value="0"' . (in_array(0, $selected) ? ' selected' : '') . '>-- ' . $langs->trans("Internal") . ' --</option>'; |
|
1829
|
+ $out .= '<option value="0"'.(in_array(0, $selected) ? ' selected' : '').'>-- '.$langs->trans("Internal").' --</option>'; |
1830
|
1830
|
} |
1831
|
1831
|
} |
1832
|
1832
|
|
1833
|
1833
|
$i = 0; |
1834
|
1834
|
if ($num) { |
1835
|
|
- include_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php'; |
|
1835
|
+ include_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; |
1836
|
1836
|
$contactstatic = new Contact($this->db); |
1837
|
1837
|
|
1838
|
1838
|
while ($i < $num) { |
|
@@ -1868,7 +1868,7 @@ discard block |
|
|
block discarded – undo |
1868
|
1868
|
} |
1869
|
1869
|
$extendedInfos = implode(' - ', $extendedInfos); |
1870
|
1870
|
if (!empty($extendedInfos)) { |
1871
|
|
- $extendedInfos = ' - ' . $extendedInfos; |
|
1871
|
+ $extendedInfos = ' - '.$extendedInfos; |
1872
|
1872
|
} |
1873
|
1873
|
} |
1874
|
1874
|
|
|
@@ -1885,42 +1885,42 @@ discard block |
|
|
block discarded – undo |
1885
|
1885
|
$disabled = 1; |
1886
|
1886
|
} |
1887
|
1887
|
if (!empty($selected) && in_array($obj->rowid, $selected)) { |
1888
|
|
- $out .= '<option value="' . $obj->rowid . '"'; |
|
1888
|
+ $out .= '<option value="'.$obj->rowid.'"'; |
1889
|
1889
|
if ($disabled) { |
1890
|
1890
|
$out .= ' disabled'; |
1891
|
1891
|
} |
1892
|
1892
|
$out .= ' selected>'; |
1893
|
|
- $out .= $contactstatic->getFullName($langs) . $extendedInfos; |
|
1893
|
+ $out .= $contactstatic->getFullName($langs).$extendedInfos; |
1894
|
1894
|
if ($showfunction && $obj->poste) { |
1895
|
|
- $out .= ' (' . $obj->poste . ')'; |
|
1895
|
+ $out .= ' ('.$obj->poste.')'; |
1896
|
1896
|
} |
1897
|
1897
|
if (($showsoc > 0) && $obj->company) { |
1898
|
|
- $out .= ' - (' . $obj->company . ')'; |
|
1898
|
+ $out .= ' - ('.$obj->company.')'; |
1899
|
1899
|
} |
1900
|
1900
|
$out .= '</option>'; |
1901
|
1901
|
} else { |
1902
|
|
- $out .= '<option value="' . $obj->rowid . '"'; |
|
1902
|
+ $out .= '<option value="'.$obj->rowid.'"'; |
1903
|
1903
|
if ($disabled) { |
1904
|
1904
|
$out .= ' disabled'; |
1905
|
1905
|
} |
1906
|
1906
|
$out .= '>'; |
1907
|
|
- $out .= $contactstatic->getFullName($langs) . $extendedInfos; |
|
1907
|
+ $out .= $contactstatic->getFullName($langs).$extendedInfos; |
1908
|
1908
|
if ($showfunction && $obj->poste) { |
1909
|
|
- $out .= ' (' . $obj->poste . ')'; |
|
1909
|
+ $out .= ' ('.$obj->poste.')'; |
1910
|
1910
|
} |
1911
|
1911
|
if (($showsoc > 0) && $obj->company) { |
1912
|
|
- $out .= ' - (' . $obj->company . ')'; |
|
1912
|
+ $out .= ' - ('.$obj->company.')'; |
1913
|
1913
|
} |
1914
|
1914
|
$out .= '</option>'; |
1915
|
1915
|
} |
1916
|
1916
|
} else { |
1917
|
1917
|
if (in_array($obj->rowid, $selected)) { |
1918
|
|
- $out .= $contactstatic->getFullName($langs) . $extendedInfos; |
|
1918
|
+ $out .= $contactstatic->getFullName($langs).$extendedInfos; |
1919
|
1919
|
if ($showfunction && $obj->poste) { |
1920
|
|
- $out .= ' (' . $obj->poste . ')'; |
|
1920
|
+ $out .= ' ('.$obj->poste.')'; |
1921
|
1921
|
} |
1922
|
1922
|
if (($showsoc > 0) && $obj->company) { |
1923
|
|
- $out .= ' - (' . $obj->company . ')'; |
|
1923
|
+ $out .= ' - ('.$obj->company.')'; |
1924
|
1924
|
} |
1925
|
1925
|
} |
1926
|
1926
|
} |
|
@@ -1929,7 +1929,7 @@ discard block |
|
|
block discarded – undo |
1929
|
1929
|
} |
1930
|
1930
|
} else { |
1931
|
1931
|
$labeltoshow = ($socid != -1) ? ($langs->trans($socid ? "NoContactDefinedForThirdParty" : "NoContactDefined")) : $langs->trans('SelectAThirdPartyFirst'); |
1932
|
|
- $out .= '<option class="disabled" value="-1"' . (($showempty == 2 || $multiple) ? '' : ' selected') . ' disabled="disabled">'; |
|
1932
|
+ $out .= '<option class="disabled" value="-1"'.(($showempty == 2 || $multiple) ? '' : ' selected').' disabled="disabled">'; |
1933
|
1933
|
$out .= $labeltoshow; |
1934
|
1934
|
$out .= '</option>'; |
1935
|
1935
|
} |
|
@@ -1950,7 +1950,7 @@ discard block |
|
|
block discarded – undo |
1950
|
1950
|
} |
1951
|
1951
|
|
1952
|
1952
|
if ($conf->use_javascript_ajax && !$forcecombo && !$options_only) { |
1953
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
1953
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
1954
|
1954
|
$out .= ajax_combobox($htmlid, $events, getDolGlobalString("CONTACT_USE_SEARCH_TO_SELECT")); |
1955
|
1955
|
} |
1956
|
1956
|
|
|
@@ -2055,11 +2055,11 @@ discard block |
|
|
block discarded – undo |
2055
|
2055
|
if (isModEnabled('multicompany') && $conf->entity == 1 && $user->admin && !$user->entity) { |
2056
|
2056
|
$sql .= ", e.label"; |
2057
|
2057
|
} |
2058
|
|
- $sql .= " FROM " . $this->db->prefix() . "user as u"; |
|
2058
|
+ $sql .= " FROM ".$this->db->prefix()."user as u"; |
2059
|
2059
|
if (isModEnabled('multicompany') && $conf->entity == 1 && $user->admin && !$user->entity) { |
2060
|
|
- $sql .= " LEFT JOIN " . $this->db->prefix() . "entity as e ON e.rowid = u.entity"; |
|
2060
|
+ $sql .= " LEFT JOIN ".$this->db->prefix()."entity as e ON e.rowid = u.entity"; |
2061
|
2061
|
if (!empty($force_entity)) { |
2062
|
|
- $sql .= " WHERE u.entity IN (0, " . $this->db->sanitize($force_entity) . ")"; |
|
2062
|
+ $sql .= " WHERE u.entity IN (0, ".$this->db->sanitize($force_entity).")"; |
2063
|
2063
|
} else { |
2064
|
2064
|
$sql .= " WHERE u.entity IS NOT NULL"; |
2065
|
2065
|
} |
|
@@ -2067,23 +2067,23 @@ discard block |
|
|
block discarded – undo |
2067
|
2067
|
if (isModEnabled('multicompany') && getDolGlobalInt('MULTICOMPANY_TRANSVERSE_MODE')) { |
2068
|
2068
|
$sql .= " WHERE u.rowid IN (SELECT ug.fk_user FROM ".$this->db->prefix()."usergroup_user as ug WHERE ug.entity IN (".getEntity('usergroup')."))"; |
2069
|
2069
|
} else { |
2070
|
|
- $sql .= " WHERE u.entity IN (" . getEntity('user') . ")"; |
|
2070
|
+ $sql .= " WHERE u.entity IN (".getEntity('user').")"; |
2071
|
2071
|
} |
2072
|
2072
|
} |
2073
|
2073
|
if (!empty($user->socid)) { |
2074
|
|
- $sql .= " AND u.fk_soc = " . ((int) $user->socid); |
|
2074
|
+ $sql .= " AND u.fk_soc = ".((int) $user->socid); |
2075
|
2075
|
} |
2076
|
2076
|
if (is_array($exclude) && $excludeUsers) { |
2077
|
|
- $sql .= " AND u.rowid NOT IN (" . $this->db->sanitize($excludeUsers) . ")"; |
|
2077
|
+ $sql .= " AND u.rowid NOT IN (".$this->db->sanitize($excludeUsers).")"; |
2078
|
2078
|
} |
2079
|
2079
|
if ($includeUsers) { |
2080
|
|
- $sql .= " AND u.rowid IN (" . $this->db->sanitize($includeUsers) . ")"; |
|
2080
|
+ $sql .= " AND u.rowid IN (".$this->db->sanitize($includeUsers).")"; |
2081
|
2081
|
} |
2082
|
2082
|
if (getDolGlobalString('USER_HIDE_INACTIVE_IN_COMBOBOX') || $notdisabled) { |
2083
|
2083
|
$sql .= " AND u.statut <> 0"; |
2084
|
2084
|
} |
2085
|
2085
|
if (!empty($morefilter)) { |
2086
|
|
- $sql .= " " . $morefilter; |
|
2086
|
+ $sql .= " ".$morefilter; |
2087
|
2087
|
} |
2088
|
2088
|
|
2089
|
2089
|
//Add hook to filter on user (for exemple on usergroup define in custom modules) |
|
@@ -2098,7 +2098,7 @@ discard block |
|
|
block discarded – undo |
2098
|
2098
|
$sql .= " ORDER BY u.statut DESC, u.lastname ASC, u.firstname ASC"; |
2099
|
2099
|
} |
2100
|
2100
|
|
2101
|
|
- dol_syslog(get_class($this) . "::select_dolusers", LOG_DEBUG); |
|
2101
|
+ dol_syslog(get_class($this)."::select_dolusers", LOG_DEBUG); |
2102
|
2102
|
|
2103
|
2103
|
$resql = $this->db->query($sql); |
2104
|
2104
|
if ($resql) { |
|
@@ -2106,7 +2106,7 @@ discard block |
|
|
block discarded – undo |
2106
|
2106
|
$i = 0; |
2107
|
2107
|
if ($num) { |
2108
|
2108
|
// do not use maxwidthonsmartphone by default. Set it by caller so auto size to 100% will work when not defined |
2109
|
|
- $out .= '<select class="flat' . ($morecss ? ' ' . $morecss : ' minwidth200') . '" id="' . $htmlname . '" name="' . $htmlname . ($multiple ? '[]' : '') . '" ' . ($multiple ? 'multiple' : '') . ' ' . ($disabled ? ' disabled' : '') . '>'; |
|
2109
|
+ $out .= '<select class="flat'.($morecss ? ' '.$morecss : ' minwidth200').'" id="'.$htmlname.'" name="'.$htmlname.($multiple ? '[]' : '').'" '.($multiple ? 'multiple' : '').' '.($disabled ? ' disabled' : '').'>'; |
2110
|
2110
|
if ($show_empty && !$multiple) { |
2111
|
2111
|
$textforempty = ' '; |
2112
|
2112
|
if (!empty($conf->use_javascript_ajax)) { |
|
@@ -2115,10 +2115,10 @@ discard block |
|
|
block discarded – undo |
2115
|
2115
|
if (!is_numeric($show_empty)) { |
2116
|
2116
|
$textforempty = $show_empty; |
2117
|
2117
|
} |
2118
|
|
- $out .= '<option class="optiongrey" value="' . ($show_empty < 0 ? $show_empty : -1) . '"' . ((empty($selected) || in_array(-1, $selected)) ? ' selected' : '') . '>' . $textforempty . '</option>' . "\n"; |
|
2118
|
+ $out .= '<option class="optiongrey" value="'.($show_empty < 0 ? $show_empty : -1).'"'.((empty($selected) || in_array(-1, $selected)) ? ' selected' : '').'>'.$textforempty.'</option>'."\n"; |
2119
|
2119
|
} |
2120
|
2120
|
if ($show_every) { |
2121
|
|
- $out .= '<option value="-2"' . ((in_array(-2, $selected)) ? ' selected' : '') . '>-- ' . $langs->trans("Everybody") . ' --</option>' . "\n"; |
|
2121
|
+ $out .= '<option value="-2"'.((in_array(-2, $selected)) ? ' selected' : '').'>-- '.$langs->trans("Everybody").' --</option>'."\n"; |
2122
|
2122
|
} |
2123
|
2123
|
|
2124
|
2124
|
$userstatic = new User($this->db); |
|
@@ -2165,22 +2165,22 @@ discard block |
|
|
block discarded – undo |
2165
|
2165
|
} |
2166
|
2166
|
if ($showstatus >= 0) { |
2167
|
2167
|
if ($obj->status == 1 && $showstatus == 1) { |
2168
|
|
- $moreinfo .= ($moreinfo ? ' - ' : ' (') . $langs->trans('Enabled'); |
2169
|
|
- $moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(') . $langs->trans('Enabled'); |
|
2168
|
+ $moreinfo .= ($moreinfo ? ' - ' : ' (').$langs->trans('Enabled'); |
|
2169
|
+ $moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(').$langs->trans('Enabled'); |
2170
|
2170
|
} |
2171
|
2171
|
if ($obj->status == 0 && $showstatus == 1) { |
2172
|
|
- $moreinfo .= ($moreinfo ? ' - ' : ' (') . $langs->trans('Disabled'); |
2173
|
|
- $moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(') . $langs->trans('Disabled'); |
|
2172
|
+ $moreinfo .= ($moreinfo ? ' - ' : ' (').$langs->trans('Disabled'); |
|
2173
|
+ $moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(').$langs->trans('Disabled'); |
2174
|
2174
|
} |
2175
|
2175
|
} |
2176
|
2176
|
if (isModEnabled('multicompany') && !getDolGlobalInt('MULTICOMPANY_TRANSVERSE_MODE') && $conf->entity == 1 && !empty($user->admin) && empty($user->entity)) { |
2177
|
2177
|
if (empty($obj->entity)) { |
2178
|
|
- $moreinfo .= ($moreinfo ? ' - ' : ' (') . $langs->trans("AllEntities"); |
2179
|
|
- $moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(') . $langs->trans("AllEntities"); |
|
2178
|
+ $moreinfo .= ($moreinfo ? ' - ' : ' (').$langs->trans("AllEntities"); |
|
2179
|
+ $moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(').$langs->trans("AllEntities"); |
2180
|
2180
|
} else { |
2181
|
2181
|
if ($obj->entity != $conf->entity) { |
2182
|
|
- $moreinfo .= ($moreinfo ? ' - ' : ' (') . ($obj->label ? $obj->label : $langs->trans("EntityNameNotDefined")); |
2183
|
|
- $moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(') . ($obj->label ? $obj->label : $langs->trans("EntityNameNotDefined")); |
|
2182
|
+ $moreinfo .= ($moreinfo ? ' - ' : ' (').($obj->label ? $obj->label : $langs->trans("EntityNameNotDefined")); |
|
2183
|
+ $moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(').($obj->label ? $obj->label : $langs->trans("EntityNameNotDefined")); |
2184
|
2184
|
} |
2185
|
2185
|
} |
2186
|
2186
|
} |
|
@@ -2188,13 +2188,13 @@ discard block |
|
|
block discarded – undo |
2188
|
2188
|
$moreinfohtml .= (!empty($moreinfohtml) ? ')</span>' : ''); |
2189
|
2189
|
if (!empty($disableline) && $disableline != '1') { |
2190
|
2190
|
// Add text from $enableonlytext parameter |
2191
|
|
- $moreinfo .= ' - ' . $disableline; |
2192
|
|
- $moreinfohtml .= ' - ' . $disableline; |
|
2191
|
+ $moreinfo .= ' - '.$disableline; |
|
2192
|
+ $moreinfohtml .= ' - '.$disableline; |
2193
|
2193
|
} |
2194
|
2194
|
$labeltoshow .= $moreinfo; |
2195
|
2195
|
$labeltoshowhtml .= $moreinfohtml; |
2196
|
2196
|
|
2197
|
|
- $out .= '<option value="' . $obj->rowid . '"'; |
|
2197
|
+ $out .= '<option value="'.$obj->rowid.'"'; |
2198
|
2198
|
if (!empty($disableline)) { |
2199
|
2199
|
$out .= ' disabled'; |
2200
|
2200
|
} |
|
@@ -2202,7 +2202,7 @@ discard block |
|
|
block discarded – undo |
2202
|
2202
|
$out .= ' selected'; |
2203
|
2203
|
} |
2204
|
2204
|
$out .= ' data-html="'; |
2205
|
|
- $outhtml = $userstatic->getNomUrl(-3, '', 0, 1, 24, 1, 'login', '', 1) . ' '; |
|
2205
|
+ $outhtml = $userstatic->getNomUrl(-3, '', 0, 1, 24, 1, 'login', '', 1).' '; |
2206
|
2206
|
if ($showstatus >= 0 && $obj->status == 0) { |
2207
|
2207
|
$outhtml .= '<strike class="opacitymediumxxx">'; |
2208
|
2208
|
} |
|
@@ -2215,7 +2215,7 @@ discard block |
|
|
block discarded – undo |
2215
|
2215
|
$out .= $labeltoshow; |
2216
|
2216
|
$out .= '</option>'; |
2217
|
2217
|
|
2218
|
|
- $outarray[$userstatic->id] = $userstatic->getFullName($langs, $fullNameMode, -1, $maxlength) . $moreinfo; |
|
2218
|
+ $outarray[$userstatic->id] = $userstatic->getFullName($langs, $fullNameMode, -1, $maxlength).$moreinfo; |
2219
|
2219
|
$outarray2[$userstatic->id] = array( |
2220
|
2220
|
'id'=>$userstatic->id, |
2221
|
2221
|
'label'=>$labeltoshow, |
|
@@ -2227,14 +2227,14 @@ discard block |
|
|
block discarded – undo |
2227
|
2227
|
$i++; |
2228
|
2228
|
} |
2229
|
2229
|
} else { |
2230
|
|
- $out .= '<select class="flat" id="' . $htmlname . '" name="' . $htmlname . '" disabled>'; |
2231
|
|
- $out .= '<option value="">' . $langs->trans("None") . '</option>'; |
|
2230
|
+ $out .= '<select class="flat" id="'.$htmlname.'" name="'.$htmlname.'" disabled>'; |
|
2231
|
+ $out .= '<option value="">'.$langs->trans("None").'</option>'; |
2232
|
2232
|
} |
2233
|
2233
|
$out .= '</select>'; |
2234
|
2234
|
|
2235
|
2235
|
if ($num && !$forcecombo) { |
2236
|
2236
|
// Enhance with select2 |
2237
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
2237
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
2238
|
2238
|
$out .= ajax_combobox($htmlname); |
2239
|
2239
|
} |
2240
|
2240
|
} else { |
|
@@ -2304,16 +2304,16 @@ discard block |
|
|
block discarded – undo |
2304
|
2304
|
$out .= $userstatic->getNomUrl(-1); |
2305
|
2305
|
if ($i == 0) { |
2306
|
2306
|
$ownerid = $value['id']; |
2307
|
|
- $out .= ' (' . $langs->trans("Owner") . ')'; |
|
2307
|
+ $out .= ' ('.$langs->trans("Owner").')'; |
2308
|
2308
|
} |
2309
|
2309
|
if ($nbassignetouser > 1 && $action != 'view') { |
2310
|
|
- $out .= ' <input type="image" style="border: 0px;" src="' . img_picto($langs->trans("Remove"), 'delete', '', 0, 1) . '" value="' . $userstatic->id . '" class="removedassigned reposition" id="removedassigned_' . $userstatic->id . '" name="removedassigned_' . $userstatic->id . '">'; |
|
2310
|
+ $out .= ' <input type="image" style="border: 0px;" src="'.img_picto($langs->trans("Remove"), 'delete', '', 0, 1).'" value="'.$userstatic->id.'" class="removedassigned reposition" id="removedassigned_'.$userstatic->id.'" name="removedassigned_'.$userstatic->id.'">'; |
2311
|
2311
|
} |
2312
|
2312
|
// Show my availability |
2313
|
2313
|
if ($showproperties) { |
2314
|
2314
|
if ($ownerid == $value['id'] && is_array($listofuserid) && count($listofuserid) && in_array($ownerid, array_keys($listofuserid))) { |
2315
|
2315
|
$out .= '<div class="myavailability inline-block">'; |
2316
|
|
- $out .= '<span class="hideonsmartphone"> - <span class="opacitymedium">' . $langs->trans("Availability") . ':</span> </span><input id="transparency" class="paddingrightonly" ' . ($action == 'view' ? 'disabled' : '') . ' type="checkbox" name="transparency"' . ($listofuserid[$ownerid]['transparency'] ? ' checked' : '') . '><label for="transparency">' . $langs->trans("Busy") . '</label>'; |
|
2316
|
+ $out .= '<span class="hideonsmartphone"> - <span class="opacitymedium">'.$langs->trans("Availability").':</span> </span><input id="transparency" class="paddingrightonly" '.($action == 'view' ? 'disabled' : '').' type="checkbox" name="transparency"'.($listofuserid[$ownerid]['transparency'] ? ' checked' : '').'><label for="transparency">'.$langs->trans("Busy").'</label>'; |
2317
|
2317
|
$out .= '</div>'; |
2318
|
2318
|
} |
2319
|
2319
|
} |
|
@@ -2330,15 +2330,15 @@ discard block |
|
|
block discarded – undo |
2330
|
2330
|
// Method with no ajax |
2331
|
2331
|
if ($action != 'view') { |
2332
|
2332
|
$out .= '<input type="hidden" class="removedassignedhidden" name="removedassigned" value="">'; |
2333
|
|
- $out .= '<script nonce="' . getNonce() . '" type="text/javascript">jQuery(document).ready(function () {'; |
|
2333
|
+ $out .= '<script nonce="'.getNonce().'" type="text/javascript">jQuery(document).ready(function () {'; |
2334
|
2334
|
$out .= 'jQuery(".removedassigned").click(function() { jQuery(".removedassignedhidden").val(jQuery(this).val()); });'; |
2335
|
2335
|
$out .= 'jQuery(".assignedtouser").change(function() { console.log(jQuery(".assignedtouser option:selected").val());'; |
2336
|
|
- $out .= ' if (jQuery(".assignedtouser option:selected").val() > 0) { jQuery("#' . $action . 'assignedtouser").attr("disabled", false); }'; |
2337
|
|
- $out .= ' else { jQuery("#' . $action . 'assignedtouser").attr("disabled", true); }'; |
|
2336
|
+ $out .= ' if (jQuery(".assignedtouser option:selected").val() > 0) { jQuery("#'.$action.'assignedtouser").attr("disabled", false); }'; |
|
2337
|
+ $out .= ' else { jQuery("#'.$action.'assignedtouser").attr("disabled", true); }'; |
2338
|
2338
|
$out .= '});'; |
2339
|
2339
|
$out .= '})</script>'; |
2340
|
2340
|
$out .= $this->select_dolusers('', $htmlname, $show_empty, $exclude, $disabled, $include, $enableonly, $force_entity, $maxlength, $showstatus, $morefilter); |
2341
|
|
- $out .= ' <input type="submit" disabled class="button valignmiddle smallpaddingimp reposition" id="' . $action . 'assignedtouser" name="' . $action . 'assignedtouser" value="' . dol_escape_htmltag($langs->trans("Add")) . '">'; |
|
2341
|
+ $out .= ' <input type="submit" disabled class="button valignmiddle smallpaddingimp reposition" id="'.$action.'assignedtouser" name="'.$action.'assignedtouser" value="'.dol_escape_htmltag($langs->trans("Add")).'">'; |
2342
|
2342
|
$out .= '<br>'; |
2343
|
2343
|
} |
2344
|
2344
|
|
|
@@ -2393,13 +2393,13 @@ discard block |
|
|
block discarded – undo |
2393
|
2393
|
$resourcestatic->fetch($value['id']); |
2394
|
2394
|
$out .= $resourcestatic->getNomUrl(-1); |
2395
|
2395
|
if ($nbassignetoresource > 1 && $action != 'view') { |
2396
|
|
- $out .= ' <input type="image" style="border: 0px;" src="' . img_picto($langs->trans("Remove"), 'delete', '', 0, 1) . '" value="' . $resourcestatic->id . '" class="removedassigned reposition" id="removedassignedresource_' . $resourcestatic->id . '" name="removedassignedresource_' . $resourcestatic->id . '">'; |
|
2396
|
+ $out .= ' <input type="image" style="border: 0px;" src="'.img_picto($langs->trans("Remove"), 'delete', '', 0, 1).'" value="'.$resourcestatic->id.'" class="removedassigned reposition" id="removedassignedresource_'.$resourcestatic->id.'" name="removedassignedresource_'.$resourcestatic->id.'">'; |
2397
|
2397
|
} |
2398
|
2398
|
// Show my availability |
2399
|
2399
|
if ($showproperties) { |
2400
|
2400
|
if (is_array($listofresourceid) && count($listofresourceid)) { |
2401
|
2401
|
$out .= '<div class="myavailability inline-block">'; |
2402
|
|
- $out .= '<span class="hideonsmartphone"> - <span class="opacitymedium">' . $langs->trans("Availability") . ':</span> </span><input id="transparencyresource" class="paddingrightonly" ' . ($action == 'view' ? 'disabled' : '') . ' type="checkbox" name="transparency"' . ($listofresourceid[$value['id']]['transparency'] ? ' checked' : '') . '><label for="transparency">' . $langs->trans("Busy") . '</label>'; |
|
2402
|
+ $out .= '<span class="hideonsmartphone"> - <span class="opacitymedium">'.$langs->trans("Availability").':</span> </span><input id="transparencyresource" class="paddingrightonly" '.($action == 'view' ? 'disabled' : '').' type="checkbox" name="transparency"'.($listofresourceid[$value['id']]['transparency'] ? ' checked' : '').'><label for="transparency">'.$langs->trans("Busy").'</label>'; |
2403
|
2403
|
$out .= '</div>'; |
2404
|
2404
|
} |
2405
|
2405
|
} |
|
@@ -2416,11 +2416,11 @@ discard block |
|
|
block discarded – undo |
2416
|
2416
|
// Method with no ajax |
2417
|
2417
|
if ($action != 'view') { |
2418
|
2418
|
$out .= '<input type="hidden" class="removedassignedhidden" name="removedassignedresource" value="">'; |
2419
|
|
- $out .= '<script nonce="' . getNonce() . '" type="text/javascript">jQuery(document).ready(function () {'; |
|
2419
|
+ $out .= '<script nonce="'.getNonce().'" type="text/javascript">jQuery(document).ready(function () {'; |
2420
|
2420
|
$out .= 'jQuery(".removedassignedresource").click(function() { jQuery(".removedassignedresourcehidden").val(jQuery(this).val()); });'; |
2421
|
2421
|
$out .= 'jQuery(".assignedtoresource").change(function() { console.log(jQuery(".assignedtoresource option:selected").val());'; |
2422
|
|
- $out .= ' if (jQuery(".assignedtoresource option:selected").val() > 0) { jQuery("#' . $action . 'assignedtoresource").attr("disabled", false); }'; |
2423
|
|
- $out .= ' else { jQuery("#' . $action . 'assignedtoresource").attr("disabled", true); }'; |
|
2422
|
+ $out .= ' if (jQuery(".assignedtoresource option:selected").val() > 0) { jQuery("#'.$action.'assignedtoresource").attr("disabled", false); }'; |
|
2423
|
+ $out .= ' else { jQuery("#'.$action.'assignedtoresource").attr("disabled", true); }'; |
2424
|
2424
|
$out .= '});'; |
2425
|
2425
|
$out .= '})</script>'; |
2426
|
2426
|
|
|
@@ -2428,7 +2428,7 @@ discard block |
|
|
block discarded – undo |
2428
|
2428
|
$out .= img_picto('', 'resource', 'class="pictofixedwidth"'); |
2429
|
2429
|
$out .= $formresources->select_resource_list('', $htmlname, '', 1, 1, 0, $events, '', 2, null); |
2430
|
2430
|
//$out .= $this->select_dolusers('', $htmlname, $show_empty, $exclude, $disabled, $include, $enableonly, $force_entity, $maxlength, $showstatus, $morefilter); |
2431
|
|
- $out .= ' <input type="submit" disabled class="button valignmiddle smallpaddingimp reposition" id="' . $action . 'assignedtoresource" name="' . $action . 'assignedtoresource" value="' . dol_escape_htmltag($langs->trans("Add")) . '">'; |
|
2431
|
+ $out .= ' <input type="submit" disabled class="button valignmiddle smallpaddingimp reposition" id="'.$action.'assignedtoresource" name="'.$action.'assignedtoresource" value="'.dol_escape_htmltag($langs->trans("Add")).'">'; |
2432
|
2432
|
$out .= '<br>'; |
2433
|
2433
|
} |
2434
|
2434
|
|
|
@@ -2489,7 +2489,7 @@ discard block |
|
|
block discarded – undo |
2489
|
2489
|
$placeholder = ''; |
2490
|
2490
|
|
2491
|
2491
|
if ($selected && empty($selected_input_value)) { |
2492
|
|
- require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; |
|
2492
|
+ require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; |
2493
|
2493
|
$producttmpselect = new Product($this->db); |
2494
|
2494
|
$producttmpselect->fetch($selected); |
2495
|
2495
|
$selected_input_value = $producttmpselect->ref; |
|
@@ -2504,17 +2504,17 @@ discard block |
|
|
block discarded – undo |
2504
|
2504
|
} |
2505
|
2505
|
} |
2506
|
2506
|
// mode=1 means customers products |
2507
|
|
- $urloption = ($socid > 0 ? 'socid=' . $socid . '&' : '') . 'htmlname=' . $htmlname . '&outjson=1&price_level=' . $price_level . '&type=' . $filtertype . '&mode=1&status=' . $status . '&status_purchase=' . $status_purchase . '&finished=' . $finished . '&hidepriceinlabel=' . $hidepriceinlabel . '&warehousestatus=' . $warehouseStatus; |
2508
|
|
- $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/product/ajax/products.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions); |
|
2507
|
+ $urloption = ($socid > 0 ? 'socid='.$socid.'&' : '').'htmlname='.$htmlname.'&outjson=1&price_level='.$price_level.'&type='.$filtertype.'&mode=1&status='.$status.'&status_purchase='.$status_purchase.'&finished='.$finished.'&hidepriceinlabel='.$hidepriceinlabel.'&warehousestatus='.$warehouseStatus; |
|
2508
|
+ $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/product/ajax/products.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions); |
2509
|
2509
|
|
2510
|
2510
|
if (isModEnabled('variants') && is_array($selected_combinations)) { |
2511
|
2511
|
// Code to automatically insert with javascript the select of attributes under the select of product |
2512
|
2512
|
// when a parent of variant has been selected. |
2513
|
2513
|
$out .= ' |
2514
|
2514
|
<!-- script to auto show attributes select tags if a variant was selected --> |
2515
|
|
- <script nonce="' . getNonce() . '"> |
|
2515
|
+ <script nonce="' . getNonce().'"> |
2516
|
2516
|
// auto show attributes fields |
2517
|
|
- selected = ' . json_encode($selected_combinations) . '; |
|
2517
|
+ selected = ' . json_encode($selected_combinations).'; |
2518
|
2518
|
combvalues = {}; |
2519
|
2519
|
|
2520
|
2520
|
jQuery(document).ready(function () { |
|
@@ -2525,7 +2525,7 @@ discard block |
|
|
block discarded – undo |
2525
|
2525
|
} |
2526
|
2526
|
}); |
2527
|
2527
|
|
2528
|
|
- jQuery("input#' . $htmlname . '").change(function () { |
|
2528
|
+ jQuery("input#' . $htmlname.'").change(function () { |
2529
|
2529
|
|
2530
|
2530
|
if (!jQuery(this).val()) { |
2531
|
2531
|
jQuery(\'div#attributes_box\').empty(); |
|
@@ -2534,7 +2534,7 @@ discard block |
|
|
block discarded – undo |
2534
|
2534
|
|
2535
|
2535
|
console.log("A change has started. We get variants fields to inject html select"); |
2536
|
2536
|
|
2537
|
|
- jQuery.getJSON("' . DOL_URL_ROOT . '/variants/ajax/getCombinations.php", { |
|
2537
|
+ jQuery.getJSON("' . DOL_URL_ROOT.'/variants/ajax/getCombinations.php", { |
2538
|
2538
|
id: jQuery(this).val() |
2539
|
2539
|
}, function (data) { |
2540
|
2540
|
jQuery(\'div#attributes_box\').empty(); |
|
@@ -2577,21 +2577,21 @@ discard block |
|
|
block discarded – undo |
2577
|
2577
|
}) |
2578
|
2578
|
}); |
2579
|
2579
|
|
2580
|
|
- ' . ($selected ? 'jQuery("input#' . $htmlname . '").change();' : '') . ' |
|
2580
|
+ ' . ($selected ? 'jQuery("input#'.$htmlname.'").change();' : '').' |
2581
|
2581
|
}); |
2582
|
2582
|
</script> |
2583
|
2583
|
'; |
2584
|
2584
|
} |
2585
|
2585
|
|
2586
|
2586
|
if (empty($hidelabel)) { |
2587
|
|
- $out .= $langs->trans("RefOrLabel") . ' : '; |
|
2587
|
+ $out .= $langs->trans("RefOrLabel").' : '; |
2588
|
2588
|
} elseif ($hidelabel > 1) { |
2589
|
|
- $placeholder = ' placeholder="' . $langs->trans("RefOrLabel") . '"'; |
|
2589
|
+ $placeholder = ' placeholder="'.$langs->trans("RefOrLabel").'"'; |
2590
|
2590
|
if ($hidelabel == 2) { |
2591
|
2591
|
$out .= img_picto($langs->trans("Search"), 'search'); |
2592
|
2592
|
} |
2593
|
2593
|
} |
2594
|
|
- $out .= '<input type="text" class="minwidth100' . ($morecss ? ' ' . $morecss : '') . '" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . $placeholder . ' ' . (getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '') . ' />'; |
|
2594
|
+ $out .= '<input type="text" class="minwidth100'.($morecss ? ' '.$morecss : '').'" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' '.(getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '').' />'; |
2595
|
2595
|
if ($hidelabel == 3) { |
2596
|
2596
|
$out .= img_picto($langs->trans("Search"), 'search'); |
2597
|
2597
|
} |
|
@@ -2628,33 +2628,33 @@ discard block |
|
|
block discarded – undo |
2628
|
2628
|
// phpcs:enable |
2629
|
2629
|
global $conf, $user, $langs, $db; |
2630
|
2630
|
|
2631
|
|
- require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; |
|
2631
|
+ require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; |
2632
|
2632
|
|
2633
|
2633
|
$error = 0; |
2634
|
2634
|
$out = ''; |
2635
|
2635
|
|
2636
|
2636
|
if (!$forcecombo) { |
2637
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
2637
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
2638
|
2638
|
$events = array(); |
2639
|
2639
|
$out .= ajax_combobox($htmlname, $events, getDolGlobalInt("PRODUIT_USE_SEARCH_TO_SELECT")); |
2640
|
2640
|
} |
2641
|
2641
|
|
2642
|
|
- $out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">'; |
|
2642
|
+ $out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">'; |
2643
|
2643
|
|
2644
|
2644
|
$sql = 'SELECT b.rowid, b.ref, b.label, b.fk_product'; |
2645
|
|
- $sql .= ' FROM ' . MAIN_DB_PREFIX . 'bom_bom as b'; |
2646
|
|
- $sql .= ' WHERE b.entity IN (' . getEntity('bom') . ')'; |
|
2645
|
+ $sql .= ' FROM '.MAIN_DB_PREFIX.'bom_bom as b'; |
|
2646
|
+ $sql .= ' WHERE b.entity IN ('.getEntity('bom').')'; |
2647
|
2647
|
if (!empty($status)) { |
2648
|
|
- $sql .= ' AND status = ' . (int) $status; |
|
2648
|
+ $sql .= ' AND status = '.(int) $status; |
2649
|
2649
|
} |
2650
|
2650
|
if (!empty($type)) { |
2651
|
|
- $sql .= ' AND bomtype = ' . (int) $type; |
|
2651
|
+ $sql .= ' AND bomtype = '.(int) $type; |
2652
|
2652
|
} |
2653
|
2653
|
if (!empty($TProducts)) { |
2654
|
|
- $sql .= ' AND fk_product IN (' . $this->db->sanitize(implode(',', $TProducts)) . ')'; |
|
2654
|
+ $sql .= ' AND fk_product IN ('.$this->db->sanitize(implode(',', $TProducts)).')'; |
2655
|
2655
|
} |
2656
|
2656
|
if (!empty($limit)) { |
2657
|
|
- $sql .= ' LIMIT ' . (int) $limit; |
|
2657
|
+ $sql .= ' LIMIT '.(int) $limit; |
2658
|
2658
|
} |
2659
|
2659
|
$resql = $db->query($sql); |
2660
|
2660
|
if ($resql) { |
|
@@ -2668,11 +2668,11 @@ discard block |
|
|
block discarded – undo |
2668
|
2668
|
while ($obj = $db->fetch_object($resql)) { |
2669
|
2669
|
$product = new Product($db); |
2670
|
2670
|
$res = $product->fetch($obj->fk_product); |
2671
|
|
- $out .= '<option value="' . $obj->rowid . '"'; |
|
2671
|
+ $out .= '<option value="'.$obj->rowid.'"'; |
2672
|
2672
|
if ($obj->rowid == $selected) { |
2673
|
2673
|
$out .= 'selected'; |
2674
|
2674
|
} |
2675
|
|
- $out .= '>' . $obj->ref . ' - ' . $product->label . ' - ' . $obj->label . '</option>'; |
|
2675
|
+ $out .= '>'.$obj->ref.' - '.$product->label.' - '.$obj->label.'</option>'; |
2676
|
2676
|
} |
2677
|
2677
|
} else { |
2678
|
2678
|
$error++; |
|
@@ -2729,7 +2729,7 @@ discard block |
|
|
block discarded – undo |
2729
|
2729
|
|
2730
|
2730
|
$warehouseStatusArray = array(); |
2731
|
2731
|
if (!empty($warehouseStatus)) { |
2732
|
|
- require_once DOL_DOCUMENT_ROOT . '/product/stock/class/entrepot.class.php'; |
|
2732
|
+ require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php'; |
2733
|
2733
|
if (preg_match('/warehouseclosed/', $warehouseStatus)) { |
2734
|
2734
|
$warehouseStatusArray[] = Entrepot::STATUS_CLOSED; |
2735
|
2735
|
} |
|
@@ -2743,9 +2743,9 @@ discard block |
|
|
block discarded – undo |
2743
|
2743
|
|
2744
|
2744
|
$selectFields = " p.rowid, p.ref, p.label, p.description, p.barcode, p.fk_country, p.fk_product_type, p.price, p.price_ttc, p.price_base_type, p.tva_tx, p.default_vat_code, p.duration, p.fk_price_expression"; |
2745
|
2745
|
if (count($warehouseStatusArray)) { |
2746
|
|
- $selectFieldsGrouped = ", sum(" . $this->db->ifsql("e.statut IS NULL", "0", "ps.reel") . ") as stock"; // e.statut is null if there is no record in stock |
|
2746
|
+ $selectFieldsGrouped = ", sum(".$this->db->ifsql("e.statut IS NULL", "0", "ps.reel").") as stock"; // e.statut is null if there is no record in stock |
2747
|
2747
|
} else { |
2748
|
|
- $selectFieldsGrouped = ", " . $this->db->ifsql("p.stock IS NULL", 0, "p.stock") . " AS stock"; |
|
2748
|
+ $selectFieldsGrouped = ", ".$this->db->ifsql("p.stock IS NULL", 0, "p.stock")." AS stock"; |
2749
|
2749
|
} |
2750
|
2750
|
|
2751
|
2751
|
$sql = "SELECT "; |
|
@@ -2761,9 +2761,9 @@ discard block |
|
|
block discarded – undo |
2761
|
2761
|
|
2762
|
2762
|
if (getDolGlobalString('PRODUCT_SORT_BY_CATEGORY')) { |
2763
|
2763
|
//Product category |
2764
|
|
- $sql .= ", (SELECT " . $this->db->prefix() . "categorie_product.fk_categorie |
2765
|
|
- FROM " . $this->db->prefix() . "categorie_product |
2766
|
|
- WHERE " . $this->db->prefix() . "categorie_product.fk_product=p.rowid |
|
2764
|
+ $sql .= ", (SELECT ".$this->db->prefix()."categorie_product.fk_categorie |
|
2765
|
+ FROM " . $this->db->prefix()."categorie_product |
|
2766
|
+ WHERE " . $this->db->prefix()."categorie_product.fk_product=p.rowid |
2767
|
2767
|
LIMIT 1 |
2768
|
2768
|
) AS categorie_product_id "; |
2769
|
2769
|
} |
|
@@ -2789,15 +2789,15 @@ discard block |
|
|
block discarded – undo |
2789
|
2789
|
} |
2790
|
2790
|
// Price by quantity |
2791
|
2791
|
if (getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES')) { |
2792
|
|
- $sql .= ", (SELECT pp.rowid FROM " . $this->db->prefix() . "product_price as pp WHERE pp.fk_product = p.rowid"; |
|
2792
|
+ $sql .= ", (SELECT pp.rowid FROM ".$this->db->prefix()."product_price as pp WHERE pp.fk_product = p.rowid"; |
2793
|
2793
|
if ($price_level >= 1 && getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES')) { |
2794
|
|
- $sql .= " AND price_level = " . ((int) $price_level); |
|
2794
|
+ $sql .= " AND price_level = ".((int) $price_level); |
2795
|
2795
|
} |
2796
|
2796
|
$sql .= " ORDER BY date_price"; |
2797
|
2797
|
$sql .= " DESC LIMIT 1) as price_rowid"; |
2798
|
|
- $sql .= ", (SELECT pp.price_by_qty FROM " . $this->db->prefix() . "product_price as pp WHERE pp.fk_product = p.rowid"; // price_by_qty is 1 if some prices by qty exists in subtable |
|
2798
|
+ $sql .= ", (SELECT pp.price_by_qty FROM ".$this->db->prefix()."product_price as pp WHERE pp.fk_product = p.rowid"; // price_by_qty is 1 if some prices by qty exists in subtable |
2799
|
2799
|
if ($price_level >= 1 && getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES')) { |
2800
|
|
- $sql .= " AND price_level = " . ((int) $price_level); |
|
2800
|
+ $sql .= " AND price_level = ".((int) $price_level); |
2801
|
2801
|
} |
2802
|
2802
|
$sql .= " ORDER BY date_price"; |
2803
|
2803
|
$sql .= " DESC LIMIT 1) as price_by_qty"; |
|
@@ -2811,67 +2811,67 @@ discard block |
|
|
block discarded – undo |
2811
|
2811
|
$sql .= $hookmanager->resPrint; |
2812
|
2812
|
|
2813
|
2813
|
if (count($warehouseStatusArray)) { |
2814
|
|
- $sql .= " LEFT JOIN " . $this->db->prefix() . "product_stock as ps on ps.fk_product = p.rowid"; |
2815
|
|
- $sql .= " LEFT JOIN " . $this->db->prefix() . "entrepot as e on ps.fk_entrepot = e.rowid AND e.entity IN (" . getEntity('stock') . ")"; |
2816
|
|
- $sql .= ' AND e.statut IN (' . $this->db->sanitize($this->db->escape(implode(',', $warehouseStatusArray))) . ')'; // Return line if product is inside the selected stock. If not, an empty line will be returned so we will count 0. |
|
2814
|
+ $sql .= " LEFT JOIN ".$this->db->prefix()."product_stock as ps on ps.fk_product = p.rowid"; |
|
2815
|
+ $sql .= " LEFT JOIN ".$this->db->prefix()."entrepot as e on ps.fk_entrepot = e.rowid AND e.entity IN (".getEntity('stock').")"; |
|
2816
|
+ $sql .= ' AND e.statut IN ('.$this->db->sanitize($this->db->escape(implode(',', $warehouseStatusArray))).')'; // Return line if product is inside the selected stock. If not, an empty line will be returned so we will count 0. |
2817
|
2817
|
} |
2818
|
2818
|
|
2819
|
2819
|
// include search in supplier ref |
2820
|
2820
|
if (getDolGlobalString('MAIN_SEARCH_PRODUCT_BY_FOURN_REF')) { |
2821
|
|
- $sql .= " LEFT JOIN " . $this->db->prefix() . "product_fournisseur_price as pfp ON p.rowid = pfp.fk_product"; |
|
2821
|
+ $sql .= " LEFT JOIN ".$this->db->prefix()."product_fournisseur_price as pfp ON p.rowid = pfp.fk_product"; |
2822
|
2822
|
} |
2823
|
2823
|
|
2824
|
2824
|
//Price by customer |
2825
|
2825
|
if (getDolGlobalString('PRODUIT_CUSTOMER_PRICES') && !empty($socid)) { |
2826
|
|
- $sql .= " LEFT JOIN " . $this->db->prefix() . "product_customer_price as pcp ON pcp.fk_soc=" . ((int) $socid) . " AND pcp.fk_product=p.rowid"; |
|
2826
|
+ $sql .= " LEFT JOIN ".$this->db->prefix()."product_customer_price as pcp ON pcp.fk_soc=".((int) $socid)." AND pcp.fk_product=p.rowid"; |
2827
|
2827
|
} |
2828
|
2828
|
// Units |
2829
|
2829
|
if (getDolGlobalInt('PRODUCT_USE_UNITS')) { |
2830
|
|
- $sql .= " LEFT JOIN " . $this->db->prefix() . "c_units u ON u.rowid = p.fk_unit"; |
|
2830
|
+ $sql .= " LEFT JOIN ".$this->db->prefix()."c_units u ON u.rowid = p.fk_unit"; |
2831
|
2831
|
} |
2832
|
2832
|
// Multilang : we add translation |
2833
|
2833
|
if (getDolGlobalInt('MAIN_MULTILANGS')) { |
2834
|
|
- $sql .= " LEFT JOIN " . $this->db->prefix() . "product_lang as pl ON pl.fk_product = p.rowid "; |
|
2834
|
+ $sql .= " LEFT JOIN ".$this->db->prefix()."product_lang as pl ON pl.fk_product = p.rowid "; |
2835
|
2835
|
if (getDolGlobalString('PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE') && !empty($socid)) { |
2836
|
|
- require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; |
|
2836
|
+ require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; |
2837
|
2837
|
$soc = new Societe($this->db); |
2838
|
2838
|
$result = $soc->fetch($socid); |
2839
|
2839
|
if ($result > 0 && !empty($soc->default_lang)) { |
2840
|
|
- $sql .= " AND pl.lang = '" . $this->db->escape($soc->default_lang) . "'"; |
|
2840
|
+ $sql .= " AND pl.lang = '".$this->db->escape($soc->default_lang)."'"; |
2841
|
2841
|
} else { |
2842
|
|
- $sql .= " AND pl.lang = '" . $this->db->escape($langs->getDefaultLang()) . "'"; |
|
2842
|
+ $sql .= " AND pl.lang = '".$this->db->escape($langs->getDefaultLang())."'"; |
2843
|
2843
|
} |
2844
|
2844
|
} else { |
2845
|
|
- $sql .= " AND pl.lang = '" . $this->db->escape($langs->getDefaultLang()) . "'"; |
|
2845
|
+ $sql .= " AND pl.lang = '".$this->db->escape($langs->getDefaultLang())."'"; |
2846
|
2846
|
} |
2847
|
2847
|
} |
2848
|
2848
|
|
2849
|
2849
|
if (getDolGlobalString('PRODUIT_ATTRIBUTES_HIDECHILD')) { |
2850
|
|
- $sql .= " LEFT JOIN " . $this->db->prefix() . "product_attribute_combination pac ON pac.fk_product_child = p.rowid"; |
|
2850
|
+ $sql .= " LEFT JOIN ".$this->db->prefix()."product_attribute_combination pac ON pac.fk_product_child = p.rowid"; |
2851
|
2851
|
} |
2852
|
2852
|
|
2853
|
|
- $sql .= ' WHERE p.entity IN (' . getEntity('product') . ')'; |
|
2853
|
+ $sql .= ' WHERE p.entity IN ('.getEntity('product').')'; |
2854
|
2854
|
|
2855
|
2855
|
if (getDolGlobalString('PRODUIT_ATTRIBUTES_HIDECHILD')) { |
2856
|
2856
|
$sql .= " AND pac.rowid IS NULL"; |
2857
|
2857
|
} |
2858
|
2858
|
|
2859
|
2859
|
if ($finished == 0) { |
2860
|
|
- $sql .= " AND p.finished = " . ((int) $finished); |
|
2860
|
+ $sql .= " AND p.finished = ".((int) $finished); |
2861
|
2861
|
} elseif ($finished == 1) { |
2862
|
|
- $sql .= " AND p.finished = " . ((int) $finished); |
|
2862
|
+ $sql .= " AND p.finished = ".((int) $finished); |
2863
|
2863
|
if ($status >= 0) { |
2864
|
|
- $sql .= " AND p.tosell = " . ((int) $status); |
|
2864
|
+ $sql .= " AND p.tosell = ".((int) $status); |
2865
|
2865
|
} |
2866
|
2866
|
} elseif ($status >= 0) { |
2867
|
|
- $sql .= " AND p.tosell = " . ((int) $status); |
|
2867
|
+ $sql .= " AND p.tosell = ".((int) $status); |
2868
|
2868
|
} |
2869
|
2869
|
if ($status_purchase >= 0) { |
2870
|
|
- $sql .= " AND p.tobuy = " . ((int) $status_purchase); |
|
2870
|
+ $sql .= " AND p.tobuy = ".((int) $status_purchase); |
2871
|
2871
|
} |
2872
|
2872
|
// Filter by product type |
2873
|
2873
|
if (strval($filtertype) != '') { |
2874
|
|
- $sql .= " AND p.fk_product_type = " . ((int) $filtertype); |
|
2874
|
+ $sql .= " AND p.fk_product_type = ".((int) $filtertype); |
2875
|
2875
|
} elseif (!isModEnabled('product')) { // when product module is disabled, show services only |
2876
|
2876
|
$sql .= " AND p.fk_product_type = 1"; |
2877
|
2877
|
} elseif (!isModEnabled('service')) { // when service module is disabled, show products only |
|
@@ -2895,21 +2895,21 @@ discard block |
|
|
block discarded – undo |
2895
|
2895
|
if ($i > 0) { |
2896
|
2896
|
$sql .= " AND "; |
2897
|
2897
|
} |
2898
|
|
- $sql .= "(p.ref LIKE '" . $this->db->escape($prefix . $crit) . "%' OR p.label LIKE '" . $this->db->escape($prefix . $crit) . "%'"; |
|
2898
|
+ $sql .= "(p.ref LIKE '".$this->db->escape($prefix.$crit)."%' OR p.label LIKE '".$this->db->escape($prefix.$crit)."%'"; |
2899
|
2899
|
if (getDolGlobalInt('MAIN_MULTILANGS')) { |
2900
|
|
- $sql .= " OR pl.label LIKE '" . $this->db->escape($prefix . $crit) . "%'"; |
|
2900
|
+ $sql .= " OR pl.label LIKE '".$this->db->escape($prefix.$crit)."%'"; |
2901
|
2901
|
} |
2902
|
2902
|
if (getDolGlobalString('PRODUIT_CUSTOMER_PRICES') && !empty($socid)) { |
2903
|
|
- $sql .= " OR pcp.ref_customer LIKE '" . $this->db->escape($prefix . $crit) . "%'"; |
|
2903
|
+ $sql .= " OR pcp.ref_customer LIKE '".$this->db->escape($prefix.$crit)."%'"; |
2904
|
2904
|
} |
2905
|
2905
|
if (getDolGlobalString('PRODUCT_AJAX_SEARCH_ON_DESCRIPTION')) { |
2906
|
|
- $sql .= " OR p.description LIKE '" . $this->db->escape($prefix . $crit) . "%'"; |
|
2906
|
+ $sql .= " OR p.description LIKE '".$this->db->escape($prefix.$crit)."%'"; |
2907
|
2907
|
if (getDolGlobalInt('MAIN_MULTILANGS')) { |
2908
|
|
- $sql .= " OR pl.description LIKE '" . $this->db->escape($prefix . $crit) . "%'"; |
|
2908
|
+ $sql .= " OR pl.description LIKE '".$this->db->escape($prefix.$crit)."%'"; |
2909
|
2909
|
} |
2910
|
2910
|
} |
2911
|
2911
|
if (getDolGlobalString('MAIN_SEARCH_PRODUCT_BY_FOURN_REF')) { |
2912
|
|
- $sql .= " OR pfp.ref_fourn LIKE '" . $this->db->escape($prefix . $crit) . "%'"; |
|
2912
|
+ $sql .= " OR pfp.ref_fourn LIKE '".$this->db->escape($prefix.$crit)."%'"; |
2913
|
2913
|
} |
2914
|
2914
|
$sql .= ")"; |
2915
|
2915
|
$i++; |
|
@@ -2918,12 +2918,12 @@ discard block |
|
|
block discarded – undo |
2918
|
2918
|
$sql .= ")"; |
2919
|
2919
|
} |
2920
|
2920
|
if (isModEnabled('barcode')) { |
2921
|
|
- $sql .= " OR p.barcode LIKE '" . $this->db->escape($prefix . $filterkey) . "%'"; |
|
2921
|
+ $sql .= " OR p.barcode LIKE '".$this->db->escape($prefix.$filterkey)."%'"; |
2922
|
2922
|
} |
2923
|
2923
|
$sql .= ')'; |
2924
|
2924
|
} |
2925
|
2925
|
if (count($warehouseStatusArray)) { |
2926
|
|
- $sql .= " GROUP BY " . $selectFields; |
|
2926
|
+ $sql .= " GROUP BY ".$selectFields; |
2927
|
2927
|
} |
2928
|
2928
|
|
2929
|
2929
|
//Sort by category |
|
@@ -2938,23 +2938,23 @@ discard block |
|
|
block discarded – undo |
2938
|
2938
|
$sql .= $this->db->plimit($limit, 0); |
2939
|
2939
|
|
2940
|
2940
|
// Build output string |
2941
|
|
- dol_syslog(get_class($this) . "::select_produits_list search products", LOG_DEBUG); |
|
2941
|
+ dol_syslog(get_class($this)."::select_produits_list search products", LOG_DEBUG); |
2942
|
2942
|
$result = $this->db->query($sql); |
2943
|
2943
|
if ($result) { |
2944
|
|
- require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; |
2945
|
|
- require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php'; |
2946
|
|
- require_once DOL_DOCUMENT_ROOT . '/core/lib/product.lib.php'; |
|
2944
|
+ require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; |
|
2945
|
+ require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php'; |
|
2946
|
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php'; |
2947
|
2947
|
|
2948
|
2948
|
$num = $this->db->num_rows($result); |
2949
|
2949
|
|
2950
|
2950
|
$events = null; |
2951
|
2951
|
|
2952
|
2952
|
if (!$forcecombo) { |
2953
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
2953
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
2954
|
2954
|
$out .= ajax_combobox($htmlname, $events, getDolGlobalInt("PRODUIT_USE_SEARCH_TO_SELECT")); |
2955
|
2955
|
} |
2956
|
2956
|
|
2957
|
|
- $out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">'; |
|
2957
|
+ $out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">'; |
2958
|
2958
|
|
2959
|
2959
|
$textifempty = ''; |
2960
|
2960
|
// Do not use textifempty = ' ' or ' ' here, or search on key will search on ' key'. |
|
@@ -2971,7 +2971,7 @@ discard block |
|
|
block discarded – undo |
2971
|
2971
|
} |
2972
|
2972
|
} |
2973
|
2973
|
if ($showempty) { |
2974
|
|
- $out .= '<option value="-1" selected>' . ($textifempty ? $textifempty : ' ') . '</option>'; |
|
2974
|
+ $out .= '<option value="-1" selected>'.($textifempty ? $textifempty : ' ').'</option>'; |
2975
|
2975
|
} |
2976
|
2976
|
|
2977
|
2977
|
$i = 0; |
|
@@ -2982,11 +2982,11 @@ discard block |
|
|
block discarded – undo |
2982
|
2982
|
|
2983
|
2983
|
if ((getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES')) && !empty($objp->price_by_qty) && $objp->price_by_qty == 1) { // Price by quantity will return many prices for the same product |
2984
|
2984
|
$sql = "SELECT rowid, quantity, price, unitprice, remise_percent, remise, price_base_type"; |
2985
|
|
- $sql .= " FROM " . $this->db->prefix() . "product_price_by_qty"; |
2986
|
|
- $sql .= " WHERE fk_product_price = " . ((int) $objp->price_rowid); |
|
2985
|
+ $sql .= " FROM ".$this->db->prefix()."product_price_by_qty"; |
|
2986
|
+ $sql .= " WHERE fk_product_price = ".((int) $objp->price_rowid); |
2987
|
2987
|
$sql .= " ORDER BY quantity ASC"; |
2988
|
2988
|
|
2989
|
|
- dol_syslog(get_class($this) . "::select_produits_list search prices by qty", LOG_DEBUG); |
|
2989
|
+ dol_syslog(get_class($this)."::select_produits_list search prices by qty", LOG_DEBUG); |
2990
|
2990
|
$result2 = $this->db->query($sql); |
2991
|
2991
|
if ($result2) { |
2992
|
2992
|
$nb_prices = $this->db->num_rows($result2); |
|
@@ -3024,7 +3024,7 @@ discard block |
|
|
block discarded – undo |
3024
|
3024
|
$price_product = new Product($this->db); |
3025
|
3025
|
$price_product->fetch($objp->rowid, '', '', 1); |
3026
|
3026
|
|
3027
|
|
- require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php'; |
|
3027
|
+ require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php'; |
3028
|
3028
|
$priceparser = new PriceParser($this->db); |
3029
|
3029
|
$price_result = $priceparser->parseProduct($price_product); |
3030
|
3030
|
if ($price_result >= 0) { |
|
@@ -3108,7 +3108,7 @@ discard block |
|
|
block discarded – undo |
3108
|
3108
|
$label = $objp->label_translated; |
3109
|
3109
|
} |
3110
|
3110
|
if (!empty($filterkey) && $filterkey != '') { |
3111
|
|
- $label = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $label, 1); |
|
3111
|
+ $label = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $label, 1); |
3112
|
3112
|
} |
3113
|
3113
|
|
3114
|
3114
|
$outkey = $objp->rowid; |
|
@@ -3129,32 +3129,32 @@ discard block |
|
|
block discarded – undo |
3129
|
3129
|
$outdurationunit = $outtype == Product::TYPE_SERVICE ? substr($objp->duration, -1) : ''; |
3130
|
3130
|
|
3131
|
3131
|
if ($outorigin && getDolGlobalString('PRODUCT_SHOW_ORIGIN_IN_COMBO')) { |
3132
|
|
- require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php'; |
|
3132
|
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; |
3133
|
3133
|
} |
3134
|
3134
|
|
3135
|
3135
|
// Units |
3136
|
3136
|
$outvalUnits = ''; |
3137
|
3137
|
if (getDolGlobalInt('PRODUCT_USE_UNITS')) { |
3138
|
3138
|
if (!empty($objp->unit_short)) { |
3139
|
|
- $outvalUnits .= ' - ' . $objp->unit_short; |
|
3139
|
+ $outvalUnits .= ' - '.$objp->unit_short; |
3140
|
3140
|
} |
3141
|
3141
|
} |
3142
|
3142
|
if (getDolGlobalString('PRODUCT_SHOW_DIMENSIONS_IN_COMBO')) { |
3143
|
3143
|
if (!empty($objp->weight) && $objp->weight_units !== null) { |
3144
|
3144
|
$unitToShow = showDimensionInBestUnit($objp->weight, $objp->weight_units, 'weight', $langs); |
3145
|
|
- $outvalUnits .= ' - ' . $unitToShow; |
|
3145
|
+ $outvalUnits .= ' - '.$unitToShow; |
3146
|
3146
|
} |
3147
|
3147
|
if ((!empty($objp->length) || !empty($objp->width) || !empty($objp->height)) && $objp->length_units !== null) { |
3148
|
|
- $unitToShow = $objp->length . ' x ' . $objp->width . ' x ' . $objp->height . ' ' . measuringUnitString(0, 'size', $objp->length_units); |
3149
|
|
- $outvalUnits .= ' - ' . $unitToShow; |
|
3148
|
+ $unitToShow = $objp->length.' x '.$objp->width.' x '.$objp->height.' '.measuringUnitString(0, 'size', $objp->length_units); |
|
3149
|
+ $outvalUnits .= ' - '.$unitToShow; |
3150
|
3150
|
} |
3151
|
3151
|
if (!empty($objp->surface) && $objp->surface_units !== null) { |
3152
|
3152
|
$unitToShow = showDimensionInBestUnit($objp->surface, $objp->surface_units, 'surface', $langs); |
3153
|
|
- $outvalUnits .= ' - ' . $unitToShow; |
|
3153
|
+ $outvalUnits .= ' - '.$unitToShow; |
3154
|
3154
|
} |
3155
|
3155
|
if (!empty($objp->volume) && $objp->volume_units !== null) { |
3156
|
3156
|
$unitToShow = showDimensionInBestUnit($objp->volume, $objp->volume_units, 'volume', $langs); |
3157
|
|
- $outvalUnits .= ' - ' . $unitToShow; |
|
3157
|
+ $outvalUnits .= ' - '.$unitToShow; |
3158
|
3158
|
} |
3159
|
3159
|
} |
3160
|
3160
|
if ($outdurationvalue && $outdurationunit) { |
|
@@ -3166,14 +3166,14 @@ discard block |
|
|
block discarded – undo |
3166
|
3166
|
'y' => $langs->trans('Year') |
3167
|
3167
|
); |
3168
|
3168
|
if (isset($da[$outdurationunit])) { |
3169
|
|
- $outvalUnits .= ' - ' . $outdurationvalue . ' ' . $langs->transnoentities($da[$outdurationunit] . ($outdurationvalue > 1 ? 's' : '')); |
|
3169
|
+ $outvalUnits .= ' - '.$outdurationvalue.' '.$langs->transnoentities($da[$outdurationunit].($outdurationvalue > 1 ? 's' : '')); |
3170
|
3170
|
} |
3171
|
3171
|
} |
3172
|
3172
|
|
3173
|
|
- $opt = '<option value="' . $objp->rowid . '"'; |
|
3173
|
+ $opt = '<option value="'.$objp->rowid.'"'; |
3174
|
3174
|
$opt .= ($objp->rowid == $selected) ? ' selected' : ''; |
3175
|
3175
|
if (!empty($objp->price_by_qty_rowid) && $objp->price_by_qty_rowid > 0) { |
3176
|
|
- $opt .= ' pbq="' . $objp->price_by_qty_rowid . '" data-pbq="' . $objp->price_by_qty_rowid . '" data-pbqup="' . $objp->price_by_qty_unitprice . '" data-pbqbase="' . $objp->price_by_qty_price_base_type . '" data-pbqqty="' . $objp->price_by_qty_quantity . '" data-pbqpercent="' . $objp->price_by_qty_remise_percent . '"'; |
|
3176
|
+ $opt .= ' pbq="'.$objp->price_by_qty_rowid.'" data-pbq="'.$objp->price_by_qty_rowid.'" data-pbqup="'.$objp->price_by_qty_unitprice.'" data-pbqbase="'.$objp->price_by_qty_price_base_type.'" data-pbqqty="'.$objp->price_by_qty_quantity.'" data-pbqpercent="'.$objp->price_by_qty_remise_percent.'"'; |
3177
|
3177
|
} |
3178
|
3178
|
if (isModEnabled('stock') && isset($objp->stock) && ($objp->fk_product_type == Product::TYPE_PRODUCT || getDolGlobalString('STOCK_SUPPORTS_SERVICES'))) { |
3179
|
3179
|
if ($user->hasRight('stock', 'lire')) { |
|
@@ -3185,36 +3185,36 @@ discard block |
|
|
block discarded – undo |
3185
|
3185
|
} |
3186
|
3186
|
} |
3187
|
3187
|
if (getDolGlobalString('PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE')) { |
3188
|
|
- $opt .= ' data-labeltrans="' . $outlabel_translated . '"'; |
3189
|
|
- $opt .= ' data-desctrans="' . dol_escape_htmltag($outdesc_translated) . '"'; |
|
3188
|
+ $opt .= ' data-labeltrans="'.$outlabel_translated.'"'; |
|
3189
|
+ $opt .= ' data-desctrans="'.dol_escape_htmltag($outdesc_translated).'"'; |
3190
|
3190
|
} |
3191
|
3191
|
$opt .= '>'; |
3192
|
3192
|
$opt .= $objp->ref; |
3193
|
3193
|
if (!empty($objp->custref)) { |
3194
|
|
- $opt .= ' (' . $objp->custref . ')'; |
|
3194
|
+ $opt .= ' ('.$objp->custref.')'; |
3195
|
3195
|
} |
3196
|
3196
|
if ($outbarcode) { |
3197
|
|
- $opt .= ' (' . $outbarcode . ')'; |
|
3197
|
+ $opt .= ' ('.$outbarcode.')'; |
3198
|
3198
|
} |
3199
|
|
- $opt .= ' - ' . dol_trunc($label, $maxlengtharticle); |
|
3199
|
+ $opt .= ' - '.dol_trunc($label, $maxlengtharticle); |
3200
|
3200
|
if ($outorigin && getDolGlobalString('PRODUCT_SHOW_ORIGIN_IN_COMBO')) { |
3201
|
|
- $opt .= ' (' . getCountry($outorigin, 1) . ')'; |
|
3201
|
+ $opt .= ' ('.getCountry($outorigin, 1).')'; |
3202
|
3202
|
} |
3203
|
3203
|
|
3204
|
3204
|
$objRef = $objp->ref; |
3205
|
3205
|
if (!empty($objp->custref)) { |
3206
|
|
- $objRef .= ' (' . $objp->custref . ')'; |
|
3206
|
+ $objRef .= ' ('.$objp->custref.')'; |
3207
|
3207
|
} |
3208
|
3208
|
if (!empty($filterkey) && $filterkey != '') { |
3209
|
|
- $objRef = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $objRef, 1); |
|
3209
|
+ $objRef = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $objRef, 1); |
3210
|
3210
|
} |
3211
|
3211
|
$outval .= $objRef; |
3212
|
3212
|
if ($outbarcode) { |
3213
|
|
- $outval .= ' (' . $outbarcode . ')'; |
|
3213
|
+ $outval .= ' ('.$outbarcode.')'; |
3214
|
3214
|
} |
3215
|
|
- $outval .= ' - ' . dol_trunc($label, $maxlengtharticle); |
|
3215
|
+ $outval .= ' - '.dol_trunc($label, $maxlengtharticle); |
3216
|
3216
|
if ($outorigin && getDolGlobalString('PRODUCT_SHOW_ORIGIN_IN_COMBO')) { |
3217
|
|
- $outval .= ' (' . getCountry($outorigin, 1) . ')'; |
|
3217
|
+ $outval .= ' ('.getCountry($outorigin, 1).')'; |
3218
|
3218
|
} |
3219
|
3219
|
|
3220
|
3220
|
// Units |
|
@@ -3227,35 +3227,35 @@ discard block |
|
|
block discarded – undo |
3227
|
3227
|
// If we need a particular price level (from 1 to n) |
3228
|
3228
|
if (empty($hidepriceinlabel) && $price_level >= 1 && (getDolGlobalString('PRODUIT_MULTIPRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES'))) { |
3229
|
3229
|
$sql = "SELECT price, price_ttc, price_base_type, tva_tx, default_vat_code"; |
3230
|
|
- $sql .= " FROM " . $this->db->prefix() . "product_price"; |
3231
|
|
- $sql .= " WHERE fk_product = " . ((int) $objp->rowid); |
3232
|
|
- $sql .= " AND entity IN (" . getEntity('productprice') . ")"; |
3233
|
|
- $sql .= " AND price_level = " . ((int) $price_level); |
|
3230
|
+ $sql .= " FROM ".$this->db->prefix()."product_price"; |
|
3231
|
+ $sql .= " WHERE fk_product = ".((int) $objp->rowid); |
|
3232
|
+ $sql .= " AND entity IN (".getEntity('productprice').")"; |
|
3233
|
+ $sql .= " AND price_level = ".((int) $price_level); |
3234
|
3234
|
$sql .= " ORDER BY date_price DESC, rowid DESC"; // Warning DESC must be both on date_price and rowid. |
3235
|
3235
|
$sql .= " LIMIT 1"; |
3236
|
3236
|
|
3237
|
|
- dol_syslog(get_class($this) . '::constructProductListOption search price for product ' . $objp->rowid . ' AND level ' . $price_level, LOG_DEBUG); |
|
3237
|
+ dol_syslog(get_class($this).'::constructProductListOption search price for product '.$objp->rowid.' AND level '.$price_level, LOG_DEBUG); |
3238
|
3238
|
$result2 = $this->db->query($sql); |
3239
|
3239
|
if ($result2) { |
3240
|
3240
|
$objp2 = $this->db->fetch_object($result2); |
3241
|
3241
|
if ($objp2) { |
3242
|
3242
|
$found = 1; |
3243
|
3243
|
if ($objp2->price_base_type == 'HT') { |
3244
|
|
- $opt .= ' - ' . price($objp2->price, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("HT"); |
3245
|
|
- $outval .= ' - ' . price($objp2->price, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("HT"); |
|
3244
|
+ $opt .= ' - '.price($objp2->price, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("HT"); |
|
3245
|
+ $outval .= ' - '.price($objp2->price, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("HT"); |
3246
|
3246
|
} else { |
3247
|
|
- $opt .= ' - ' . price($objp2->price_ttc, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("TTC"); |
3248
|
|
- $outval .= ' - ' . price($objp2->price_ttc, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("TTC"); |
|
3247
|
+ $opt .= ' - '.price($objp2->price_ttc, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("TTC"); |
|
3248
|
+ $outval .= ' - '.price($objp2->price_ttc, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("TTC"); |
3249
|
3249
|
} |
3250
|
3250
|
$outprice_ht = price($objp2->price); |
3251
|
3251
|
$outprice_ttc = price($objp2->price_ttc); |
3252
|
3252
|
$outpricebasetype = $objp2->price_base_type; |
3253
|
3253
|
if (getDolGlobalString('PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL')) { // using this option is a bug. kept for backward compatibility |
3254
|
|
- $outtva_tx = $objp2->tva_tx; // We use the vat rate on line of multiprice |
3255
|
|
- $outdefault_vat_code = $objp2->default_vat_code; // We use the vat code on line of multiprice |
|
3254
|
+ $outtva_tx = $objp2->tva_tx; // We use the vat rate on line of multiprice |
|
3255
|
+ $outdefault_vat_code = $objp2->default_vat_code; // We use the vat code on line of multiprice |
3256
|
3256
|
} else { |
3257
|
|
- $outtva_tx = $objp->tva_tx; // We use the vat rate of product, not the one on line of multiprice |
3258
|
|
- $outdefault_vat_code = $objp->default_vat_code; // We use the vat code or product, not the one on line of multiprice |
|
3257
|
+ $outtva_tx = $objp->tva_tx; // We use the vat rate of product, not the one on line of multiprice |
|
3258
|
+ $outdefault_vat_code = $objp->default_vat_code; // We use the vat code or product, not the one on line of multiprice |
3259
|
3259
|
} |
3260
|
3260
|
} |
3261
|
3261
|
} else { |
|
@@ -3269,13 +3269,13 @@ discard block |
|
|
block discarded – undo |
3269
|
3269
|
$outqty = $objp->quantity; |
3270
|
3270
|
$outdiscount = $objp->remise_percent; |
3271
|
3271
|
if ($objp->quantity == 1) { |
3272
|
|
- $opt .= ' - ' . price($objp->unitprice, 1, $langs, 0, 0, -1, $conf->currency) . "/"; |
3273
|
|
- $outval .= ' - ' . price($objp->unitprice, 0, $langs, 0, 0, -1, $conf->currency) . "/"; |
|
3272
|
+ $opt .= ' - '.price($objp->unitprice, 1, $langs, 0, 0, -1, $conf->currency)."/"; |
|
3273
|
+ $outval .= ' - '.price($objp->unitprice, 0, $langs, 0, 0, -1, $conf->currency)."/"; |
3274
|
3274
|
$opt .= $langs->trans("Unit"); // Do not use strtolower because it breaks utf8 encoding |
3275
|
3275
|
$outval .= $langs->transnoentities("Unit"); |
3276
|
3276
|
} else { |
3277
|
|
- $opt .= ' - ' . price($objp->price, 1, $langs, 0, 0, -1, $conf->currency) . "/" . $objp->quantity; |
3278
|
|
- $outval .= ' - ' . price($objp->price, 0, $langs, 0, 0, -1, $conf->currency) . "/" . $objp->quantity; |
|
3277
|
+ $opt .= ' - '.price($objp->price, 1, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity; |
|
3278
|
+ $outval .= ' - '.price($objp->price, 0, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity; |
3279
|
3279
|
$opt .= $langs->trans("Units"); // Do not use strtolower because it breaks utf8 encoding |
3280
|
3280
|
$outval .= $langs->transnoentities("Units"); |
3281
|
3281
|
} |
|
@@ -3283,16 +3283,16 @@ discard block |
|
|
block discarded – undo |
3283
|
3283
|
$outprice_ht = price($objp->unitprice); |
3284
|
3284
|
$outprice_ttc = price($objp->unitprice * (1 + ($objp->tva_tx / 100))); |
3285
|
3285
|
$outpricebasetype = $objp->price_base_type; |
3286
|
|
- $outtva_tx = $objp->tva_tx; // This value is the value on product when constructProductListOption is called by select_produits_list even if other field $objp-> are from table price_by_qty |
3287
|
|
- $outdefault_vat_code = $objp->default_vat_code; // This value is the value on product when constructProductListOption is called by select_produits_list even if other field $objp-> are from table price_by_qty |
|
3286
|
+ $outtva_tx = $objp->tva_tx; // This value is the value on product when constructProductListOption is called by select_produits_list even if other field $objp-> are from table price_by_qty |
|
3287
|
+ $outdefault_vat_code = $objp->default_vat_code; // This value is the value on product when constructProductListOption is called by select_produits_list even if other field $objp-> are from table price_by_qty |
3288
|
3288
|
} |
3289
|
3289
|
if (empty($hidepriceinlabel) && !empty($objp->quantity) && $objp->quantity >= 1) { |
3290
|
|
- $opt .= " (" . price($objp->unitprice, 1, $langs, 0, 0, -1, $conf->currency) . "/" . $langs->trans("Unit") . ")"; // Do not use strtolower because it breaks utf8 encoding |
3291
|
|
- $outval .= " (" . price($objp->unitprice, 0, $langs, 0, 0, -1, $conf->currency) . "/" . $langs->transnoentities("Unit") . ")"; // Do not use strtolower because it breaks utf8 encoding |
|
3290
|
+ $opt .= " (".price($objp->unitprice, 1, $langs, 0, 0, -1, $conf->currency)."/".$langs->trans("Unit").")"; // Do not use strtolower because it breaks utf8 encoding |
|
3291
|
+ $outval .= " (".price($objp->unitprice, 0, $langs, 0, 0, -1, $conf->currency)."/".$langs->transnoentities("Unit").")"; // Do not use strtolower because it breaks utf8 encoding |
3292
|
3292
|
} |
3293
|
3293
|
if (empty($hidepriceinlabel) && !empty($objp->remise_percent) && $objp->remise_percent >= 1) { |
3294
|
|
- $opt .= " - " . $langs->trans("Discount") . " : " . vatrate($objp->remise_percent) . ' %'; |
3295
|
|
- $outval .= " - " . $langs->transnoentities("Discount") . " : " . vatrate($objp->remise_percent) . ' %'; |
|
3294
|
+ $opt .= " - ".$langs->trans("Discount")." : ".vatrate($objp->remise_percent).' %'; |
|
3295
|
+ $outval .= " - ".$langs->transnoentities("Discount")." : ".vatrate($objp->remise_percent).' %'; |
3296
|
3296
|
} |
3297
|
3297
|
|
3298
|
3298
|
// Price by customer |
|
@@ -3301,11 +3301,11 @@ discard block |
|
|
block discarded – undo |
3301
|
3301
|
$found = 1; |
3302
|
3302
|
|
3303
|
3303
|
if ($objp->custprice_base_type == 'HT') { |
3304
|
|
- $opt .= ' - ' . price($objp->custprice, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("HT"); |
3305
|
|
- $outval .= ' - ' . price($objp->custprice, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("HT"); |
|
3304
|
+ $opt .= ' - '.price($objp->custprice, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("HT"); |
|
3305
|
+ $outval .= ' - '.price($objp->custprice, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("HT"); |
3306
|
3306
|
} else { |
3307
|
|
- $opt .= ' - ' . price($objp->custprice_ttc, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("TTC"); |
3308
|
|
- $outval .= ' - ' . price($objp->custprice_ttc, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("TTC"); |
|
3307
|
+ $opt .= ' - '.price($objp->custprice_ttc, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("TTC"); |
|
3308
|
+ $outval .= ' - '.price($objp->custprice_ttc, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("TTC"); |
3309
|
3309
|
} |
3310
|
3310
|
|
3311
|
3311
|
$outprice_ht = price($objp->custprice); |
|
@@ -3319,11 +3319,11 @@ discard block |
|
|
block discarded – undo |
3319
|
3319
|
// If level no defined or multiprice not found, we used the default price |
3320
|
3320
|
if (empty($hidepriceinlabel) && !$found) { |
3321
|
3321
|
if ($objp->price_base_type == 'HT') { |
3322
|
|
- $opt .= ' - ' . price($objp->price, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("HT"); |
3323
|
|
- $outval .= ' - ' . price($objp->price, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("HT"); |
|
3322
|
+ $opt .= ' - '.price($objp->price, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("HT"); |
|
3323
|
+ $outval .= ' - '.price($objp->price, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("HT"); |
3324
|
3324
|
} else { |
3325
|
|
- $opt .= ' - ' . price($objp->price_ttc, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("TTC"); |
3326
|
|
- $outval .= ' - ' . price($objp->price_ttc, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("TTC"); |
|
3325
|
+ $opt .= ' - '.price($objp->price_ttc, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("TTC"); |
|
3326
|
+ $outval .= ' - '.price($objp->price_ttc, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("TTC"); |
3327
|
3327
|
} |
3328
|
3328
|
$outprice_ht = price($objp->price); |
3329
|
3329
|
$outprice_ttc = price($objp->price_ttc); |
|
@@ -3334,14 +3334,14 @@ discard block |
|
|
block discarded – undo |
3334
|
3334
|
|
3335
|
3335
|
if (isModEnabled('stock') && isset($objp->stock) && ($objp->fk_product_type == Product::TYPE_PRODUCT || getDolGlobalString('STOCK_SUPPORTS_SERVICES'))) { |
3336
|
3336
|
if ($user->hasRight('stock', 'lire')) { |
3337
|
|
- $opt .= ' - ' . $langs->trans("Stock") . ': ' . price(price2num($objp->stock, 'MS')); |
|
3337
|
+ $opt .= ' - '.$langs->trans("Stock").': '.price(price2num($objp->stock, 'MS')); |
3338
|
3338
|
|
3339
|
3339
|
if ($objp->stock > 0) { |
3340
|
3340
|
$outval .= ' - <span class="product_line_stock_ok">'; |
3341
|
3341
|
} elseif ($objp->stock <= 0) { |
3342
|
3342
|
$outval .= ' - <span class="product_line_stock_too_low">'; |
3343
|
3343
|
} |
3344
|
|
- $outval .= $langs->transnoentities("Stock") . ': ' . price(price2num($objp->stock, 'MS')); |
|
3344
|
+ $outval .= $langs->transnoentities("Stock").': '.price(price2num($objp->stock, 'MS')); |
3345
|
3345
|
$outval .= '</span>'; |
3346
|
3346
|
if (empty($novirtualstock) && getDolGlobalString('STOCK_SHOW_VIRTUAL_STOCK_IN_PRODUCTS_COMBO')) { // Warning, this option may slow down combo list generation |
3347
|
3347
|
$langs->load("stocks"); |
|
@@ -3351,9 +3351,9 @@ discard block |
|
|
block discarded – undo |
3351
|
3351
|
$tmpproduct->load_virtual_stock(); |
3352
|
3352
|
$virtualstock = $tmpproduct->stock_theorique; |
3353
|
3353
|
|
3354
|
|
- $opt .= ' - ' . $langs->trans("VirtualStock") . ':' . $virtualstock; |
|
3354
|
+ $opt .= ' - '.$langs->trans("VirtualStock").':'.$virtualstock; |
3355
|
3355
|
|
3356
|
|
- $outval .= ' - ' . $langs->transnoentities("VirtualStock") . ':'; |
|
3356
|
+ $outval .= ' - '.$langs->transnoentities("VirtualStock").':'; |
3357
|
3357
|
if ($virtualstock > 0) { |
3358
|
3358
|
$outval .= '<span class="product_line_stock_ok">'; |
3359
|
3359
|
} elseif ($virtualstock <= 0) { |
|
@@ -3431,7 +3431,7 @@ discard block |
|
|
block discarded – undo |
3431
|
3431
|
$selected_input_value = ''; |
3432
|
3432
|
if (!empty($conf->use_javascript_ajax) && getDolGlobalString('PRODUIT_USE_SEARCH_TO_SELECT')) { |
3433
|
3433
|
if ($selected > 0) { |
3434
|
|
- require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; |
|
3434
|
+ require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; |
3435
|
3435
|
$producttmpselect = new Product($this->db); |
3436
|
3436
|
$producttmpselect->fetch($selected); |
3437
|
3437
|
$selected_input_value = $producttmpselect->ref; |
|
@@ -3439,10 +3439,10 @@ discard block |
|
|
block discarded – undo |
3439
|
3439
|
} |
3440
|
3440
|
|
3441
|
3441
|
// mode=2 means suppliers products |
3442
|
|
- $urloption = ($socid > 0 ? 'socid=' . $socid . '&' : '') . 'htmlname=' . $htmlname . '&outjson=1&price_level=' . $price_level . '&type=' . $filtertype . '&mode=2&status=' . $status . '&finished=' . $finished . '&alsoproductwithnosupplierprice=' . $alsoproductwithnosupplierprice; |
3443
|
|
- print ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/product/ajax/products.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 0, $ajaxoptions); |
|
3442
|
+ $urloption = ($socid > 0 ? 'socid='.$socid.'&' : '').'htmlname='.$htmlname.'&outjson=1&price_level='.$price_level.'&type='.$filtertype.'&mode=2&status='.$status.'&finished='.$finished.'&alsoproductwithnosupplierprice='.$alsoproductwithnosupplierprice; |
|
3443
|
+ print ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/product/ajax/products.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 0, $ajaxoptions); |
3444
|
3444
|
|
3445
|
|
- print($hidelabel ? '' : $langs->trans("RefOrLabel") . ' : ') . '<input type="text" class="minwidth300" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . ($placeholder ? ' placeholder="' . $placeholder . '"' : '') . '>'; |
|
3445
|
+ print($hidelabel ? '' : $langs->trans("RefOrLabel").' : ').'<input type="text" class="minwidth300" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.($placeholder ? ' placeholder="'.$placeholder.'"' : '').'>'; |
3446
|
3446
|
} else { |
3447
|
3447
|
print $this->select_produits_fournisseurs_list($socid, $selected, $htmlname, $filtertype, $filtre, '', $status, 0, 0, $alsoproductwithnosupplierprice, $morecss, 0, $placeholder); |
3448
|
3448
|
} |
|
@@ -3502,25 +3502,25 @@ discard block |
|
|
block discarded – undo |
3502
|
3502
|
if (isModEnabled('barcode')) { |
3503
|
3503
|
$sql .= ", pfp.barcode"; |
3504
|
3504
|
} |
3505
|
|
- $sql .= " FROM " . $this->db->prefix() . "product as p"; |
3506
|
|
- $sql .= " LEFT JOIN " . $this->db->prefix() . "product_fournisseur_price as pfp ON ( p.rowid = pfp.fk_product AND pfp.entity IN (" . getEntity('product') . ") )"; |
|
3505
|
+ $sql .= " FROM ".$this->db->prefix()."product as p"; |
|
3506
|
+ $sql .= " LEFT JOIN ".$this->db->prefix()."product_fournisseur_price as pfp ON ( p.rowid = pfp.fk_product AND pfp.entity IN (".getEntity('product').") )"; |
3507
|
3507
|
if ($socid > 0) { |
3508
|
|
- $sql .= " AND pfp.fk_soc = " . ((int) $socid); |
|
3508
|
+ $sql .= " AND pfp.fk_soc = ".((int) $socid); |
3509
|
3509
|
} |
3510
|
|
- $sql .= " LEFT JOIN " . $this->db->prefix() . "societe as s ON pfp.fk_soc = s.rowid"; |
|
3510
|
+ $sql .= " LEFT JOIN ".$this->db->prefix()."societe as s ON pfp.fk_soc = s.rowid"; |
3511
|
3511
|
// Units |
3512
|
3512
|
if (getDolGlobalInt('PRODUCT_USE_UNITS')) { |
3513
|
|
- $sql .= " LEFT JOIN " . $this->db->prefix() . "c_units u ON u.rowid = p.fk_unit"; |
|
3513
|
+ $sql .= " LEFT JOIN ".$this->db->prefix()."c_units u ON u.rowid = p.fk_unit"; |
3514
|
3514
|
} |
3515
|
|
- $sql .= " WHERE p.entity IN (" . getEntity('product') . ")"; |
|
3515
|
+ $sql .= " WHERE p.entity IN (".getEntity('product').")"; |
3516
|
3516
|
if ($statut != -1) { |
3517
|
|
- $sql .= " AND p.tobuy = " . ((int) $statut); |
|
3517
|
+ $sql .= " AND p.tobuy = ".((int) $statut); |
3518
|
3518
|
} |
3519
|
3519
|
if (strval($filtertype) != '') { |
3520
|
|
- $sql .= " AND p.fk_product_type = " . ((int) $filtertype); |
|
3520
|
+ $sql .= " AND p.fk_product_type = ".((int) $filtertype); |
3521
|
3521
|
} |
3522
|
3522
|
if (!empty($filtre)) { |
3523
|
|
- $sql .= " " . $filtre; |
|
3523
|
+ $sql .= " ".$filtre; |
3524
|
3524
|
} |
3525
|
3525
|
// Add where from hooks |
3526
|
3526
|
$parameters = array(); |
|
@@ -3540,9 +3540,9 @@ discard block |
|
|
block discarded – undo |
3540
|
3540
|
if ($i > 0) { |
3541
|
3541
|
$sql .= " AND "; |
3542
|
3542
|
} |
3543
|
|
- $sql .= "(pfp.ref_fourn LIKE '" . $this->db->escape($prefix . $crit) . "%' OR p.ref LIKE '" . $this->db->escape($prefix . $crit) . "%' OR p.label LIKE '" . $this->db->escape($prefix . $crit) . "%'"; |
|
3543
|
+ $sql .= "(pfp.ref_fourn LIKE '".$this->db->escape($prefix.$crit)."%' OR p.ref LIKE '".$this->db->escape($prefix.$crit)."%' OR p.label LIKE '".$this->db->escape($prefix.$crit)."%'"; |
3544
|
3544
|
if (getDolGlobalString('PRODUIT_FOURN_TEXTS')) { |
3545
|
|
- $sql .= " OR pfp.desc_fourn LIKE '" . $this->db->escape($prefix . $crit) . "%'"; |
|
3545
|
+ $sql .= " OR pfp.desc_fourn LIKE '".$this->db->escape($prefix.$crit)."%'"; |
3546
|
3546
|
} |
3547
|
3547
|
$sql .= ")"; |
3548
|
3548
|
$i++; |
|
@@ -3551,8 +3551,8 @@ discard block |
|
|
block discarded – undo |
3551
|
3551
|
$sql .= ")"; |
3552
|
3552
|
} |
3553
|
3553
|
if (isModEnabled('barcode')) { |
3554
|
|
- $sql .= " OR p.barcode LIKE '" . $this->db->escape($prefix . $filterkey) . "%'"; |
3555
|
|
- $sql .= " OR pfp.barcode LIKE '" . $this->db->escape($prefix . $filterkey) . "%'"; |
|
3554
|
+ $sql .= " OR p.barcode LIKE '".$this->db->escape($prefix.$filterkey)."%'"; |
|
3555
|
+ $sql .= " OR pfp.barcode LIKE '".$this->db->escape($prefix.$filterkey)."%'"; |
3556
|
3556
|
} |
3557
|
3557
|
$sql .= ')'; |
3558
|
3558
|
} |
|
@@ -3561,20 +3561,20 @@ discard block |
|
|
block discarded – undo |
3561
|
3561
|
|
3562
|
3562
|
// Build output string |
3563
|
3563
|
|
3564
|
|
- dol_syslog(get_class($this) . "::select_produits_fournisseurs_list", LOG_DEBUG); |
|
3564
|
+ dol_syslog(get_class($this)."::select_produits_fournisseurs_list", LOG_DEBUG); |
3565
|
3565
|
$result = $this->db->query($sql); |
3566
|
3566
|
if ($result) { |
3567
|
|
- require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php'; |
3568
|
|
- require_once DOL_DOCUMENT_ROOT . '/core/lib/product.lib.php'; |
|
3567
|
+ require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php'; |
|
3568
|
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php'; |
3569
|
3569
|
|
3570
|
3570
|
$num = $this->db->num_rows($result); |
3571
|
3571
|
|
3572
|
3572
|
//$out.='<select class="flat" id="select'.$htmlname.'" name="'.$htmlname.'">'; // remove select to have id same with combo and ajax |
3573
|
|
- $out .= '<select class="flat ' . ($morecss ? ' ' . $morecss : '') . '" id="' . $htmlname . '" name="' . $htmlname . '">'; |
|
3573
|
+ $out .= '<select class="flat '.($morecss ? ' '.$morecss : '').'" id="'.$htmlname.'" name="'.$htmlname.'">'; |
3574
|
3574
|
if (!$selected) { |
3575
|
|
- $out .= '<option value="-1" selected>' . ($placeholder ? $placeholder : ' ') . '</option>'; |
|
3575
|
+ $out .= '<option value="-1" selected>'.($placeholder ? $placeholder : ' ').'</option>'; |
3576
|
3576
|
} else { |
3577
|
|
- $out .= '<option value="-1">' . ($placeholder ? $placeholder : ' ') . '</option>'; |
|
3577
|
+ $out .= '<option value="-1">'.($placeholder ? $placeholder : ' ').'</option>'; |
3578
|
3578
|
} |
3579
|
3579
|
|
3580
|
3580
|
$i = 0; |
|
@@ -3589,7 +3589,7 @@ discard block |
|
|
block discarded – undo |
3589
|
3589
|
|
3590
|
3590
|
$outkey = $objp->idprodfournprice; // id in table of price |
3591
|
3591
|
if (!$outkey && $alsoproductwithnosupplierprice) { |
3592
|
|
- $outkey = 'idprod_' . $objp->rowid; // id of product |
|
3592
|
+ $outkey = 'idprod_'.$objp->rowid; // id of product |
3593
|
3593
|
} |
3594
|
3594
|
|
3595
|
3595
|
$outref = $objp->ref; |
|
@@ -3604,23 +3604,23 @@ discard block |
|
|
block discarded – undo |
3604
|
3604
|
$outvalUnits = ''; |
3605
|
3605
|
if (getDolGlobalInt('PRODUCT_USE_UNITS')) { |
3606
|
3606
|
if (!empty($objp->unit_short)) { |
3607
|
|
- $outvalUnits .= ' - ' . $objp->unit_short; |
|
3607
|
+ $outvalUnits .= ' - '.$objp->unit_short; |
3608
|
3608
|
} |
3609
|
3609
|
if (!empty($objp->weight) && $objp->weight_units !== null) { |
3610
|
3610
|
$unitToShow = showDimensionInBestUnit($objp->weight, $objp->weight_units, 'weight', $langs); |
3611
|
|
- $outvalUnits .= ' - ' . $unitToShow; |
|
3611
|
+ $outvalUnits .= ' - '.$unitToShow; |
3612
|
3612
|
} |
3613
|
3613
|
if ((!empty($objp->length) || !empty($objp->width) || !empty($objp->height)) && $objp->length_units !== null) { |
3614
|
|
- $unitToShow = $objp->length . ' x ' . $objp->width . ' x ' . $objp->height . ' ' . measuringUnitString(0, 'size', $objp->length_units); |
3615
|
|
- $outvalUnits .= ' - ' . $unitToShow; |
|
3614
|
+ $unitToShow = $objp->length.' x '.$objp->width.' x '.$objp->height.' '.measuringUnitString(0, 'size', $objp->length_units); |
|
3615
|
+ $outvalUnits .= ' - '.$unitToShow; |
3616
|
3616
|
} |
3617
|
3617
|
if (!empty($objp->surface) && $objp->surface_units !== null) { |
3618
|
3618
|
$unitToShow = showDimensionInBestUnit($objp->surface, $objp->surface_units, 'surface', $langs); |
3619
|
|
- $outvalUnits .= ' - ' . $unitToShow; |
|
3619
|
+ $outvalUnits .= ' - '.$unitToShow; |
3620
|
3620
|
} |
3621
|
3621
|
if (!empty($objp->volume) && $objp->volume_units !== null) { |
3622
|
3622
|
$unitToShow = showDimensionInBestUnit($objp->volume, $objp->volume_units, 'volume', $langs); |
3623
|
|
- $outvalUnits .= ' - ' . $unitToShow; |
|
3623
|
+ $outvalUnits .= ' - '.$unitToShow; |
3624
|
3624
|
} |
3625
|
3625
|
if ($outdurationvalue && $outdurationunit) { |
3626
|
3626
|
$da = array( |
|
@@ -3631,22 +3631,22 @@ discard block |
|
|
block discarded – undo |
3631
|
3631
|
'y' => $langs->trans('Year') |
3632
|
3632
|
); |
3633
|
3633
|
if (isset($da[$outdurationunit])) { |
3634
|
|
- $outvalUnits .= ' - ' . $outdurationvalue . ' ' . $langs->transnoentities($da[$outdurationunit] . ($outdurationvalue > 1 ? 's' : '')); |
|
3634
|
+ $outvalUnits .= ' - '.$outdurationvalue.' '.$langs->transnoentities($da[$outdurationunit].($outdurationvalue > 1 ? 's' : '')); |
3635
|
3635
|
} |
3636
|
3636
|
} |
3637
|
3637
|
} |
3638
|
3638
|
|
3639
|
3639
|
$objRef = $objp->ref; |
3640
|
3640
|
if ($filterkey && $filterkey != '') { |
3641
|
|
- $objRef = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $objRef, 1); |
|
3641
|
+ $objRef = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $objRef, 1); |
3642
|
3642
|
} |
3643
|
3643
|
$objRefFourn = $objp->ref_fourn; |
3644
|
3644
|
if ($filterkey && $filterkey != '') { |
3645
|
|
- $objRefFourn = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $objRefFourn, 1); |
|
3645
|
+ $objRefFourn = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $objRefFourn, 1); |
3646
|
3646
|
} |
3647
|
3647
|
$label = $objp->label; |
3648
|
3648
|
if ($filterkey && $filterkey != '') { |
3649
|
|
- $label = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $label, 1); |
|
3649
|
+ $label = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $label, 1); |
3650
|
3650
|
} |
3651
|
3651
|
|
3652
|
3652
|
switch ($objp->fk_product_type) { |
|
@@ -3669,21 +3669,21 @@ discard block |
|
|
block discarded – undo |
3669
|
3669
|
|
3670
|
3670
|
$optlabel .= $objp->ref; |
3671
|
3671
|
if (!empty($objp->idprodfournprice) && ($objp->ref != $objp->ref_fourn)) { |
3672
|
|
- $optlabel .= ' <span class="opacitymedium">(' . $objp->ref_fourn . ')</span>'; |
|
3672
|
+ $optlabel .= ' <span class="opacitymedium">('.$objp->ref_fourn.')</span>'; |
3673
|
3673
|
} |
3674
|
3674
|
if (isModEnabled('barcode') && !empty($objp->barcode)) { |
3675
|
|
- $optlabel .= ' (' . $outbarcode . ')'; |
|
3675
|
+ $optlabel .= ' ('.$outbarcode.')'; |
3676
|
3676
|
} |
3677
|
|
- $optlabel .= ' - ' . dol_trunc($label, $maxlengtharticle); |
|
3677
|
+ $optlabel .= ' - '.dol_trunc($label, $maxlengtharticle); |
3678
|
3678
|
|
3679
|
3679
|
$outvallabel = $objRef; |
3680
|
3680
|
if (!empty($objp->idprodfournprice) && ($objp->ref != $objp->ref_fourn)) { |
3681
|
|
- $outvallabel .= ' (' . $objRefFourn . ')'; |
|
3681
|
+ $outvallabel .= ' ('.$objRefFourn.')'; |
3682
|
3682
|
} |
3683
|
3683
|
if (isModEnabled('barcode') && !empty($objp->barcode)) { |
3684
|
|
- $outvallabel .= ' (' . $outbarcode . ')'; |
|
3684
|
+ $outvallabel .= ' ('.$outbarcode.')'; |
3685
|
3685
|
} |
3686
|
|
- $outvallabel .= ' - ' . dol_trunc($label, $maxlengtharticle); |
|
3686
|
+ $outvallabel .= ' - '.dol_trunc($label, $maxlengtharticle); |
3687
|
3687
|
|
3688
|
3688
|
// Units |
3689
|
3689
|
$optlabel .= $outvalUnits; |
|
@@ -3700,7 +3700,7 @@ discard block |
|
|
block discarded – undo |
3700
|
3700
|
$prod_supplier->fourn_tva_tx = $objp->tva_tx; |
3701
|
3701
|
$prod_supplier->fk_supplier_price_expression = $objp->fk_supplier_price_expression; |
3702
|
3702
|
|
3703
|
|
- require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php'; |
|
3703
|
+ require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php'; |
3704
|
3704
|
$priceparser = new PriceParser($this->db); |
3705
|
3705
|
$price_result = $priceparser->parseProductSupplier($prod_supplier); |
3706
|
3706
|
if ($price_result >= 0) { |
|
@@ -3711,47 +3711,47 @@ discard block |
|
|
block discarded – undo |
3711
|
3711
|
} |
3712
|
3712
|
} |
3713
|
3713
|
if ($objp->quantity == 1) { |
3714
|
|
- $optlabel .= ' - ' . price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency) . "/"; |
3715
|
|
- $outvallabel .= ' - ' . price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 0, $langs, 0, 0, -1, $conf->currency) . "/"; |
|
3714
|
+ $optlabel .= ' - '.price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency)."/"; |
|
3715
|
+ $outvallabel .= ' - '.price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 0, $langs, 0, 0, -1, $conf->currency)."/"; |
3716
|
3716
|
$optlabel .= $langs->trans("Unit"); // Do not use strtolower because it breaks utf8 encoding |
3717
|
3717
|
$outvallabel .= $langs->transnoentities("Unit"); |
3718
|
3718
|
} else { |
3719
|
|
- $optlabel .= ' - ' . price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency) . "/" . $objp->quantity; |
3720
|
|
- $outvallabel .= ' - ' . price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 0, $langs, 0, 0, -1, $conf->currency) . "/" . $objp->quantity; |
3721
|
|
- $optlabel .= ' ' . $langs->trans("Units"); // Do not use strtolower because it breaks utf8 encoding |
3722
|
|
- $outvallabel .= ' ' . $langs->transnoentities("Units"); |
|
3719
|
+ $optlabel .= ' - '.price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity; |
|
3720
|
+ $outvallabel .= ' - '.price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 0, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity; |
|
3721
|
+ $optlabel .= ' '.$langs->trans("Units"); // Do not use strtolower because it breaks utf8 encoding |
|
3722
|
+ $outvallabel .= ' '.$langs->transnoentities("Units"); |
3723
|
3723
|
} |
3724
|
3724
|
|
3725
|
3725
|
if ($objp->quantity > 1) { |
3726
|
|
- $optlabel .= " (" . price($objp->unitprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency) . "/" . $langs->trans("Unit") . ")"; // Do not use strtolower because it breaks utf8 encoding |
3727
|
|
- $outvallabel .= " (" . price($objp->unitprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 0, $langs, 0, 0, -1, $conf->currency) . "/" . $langs->transnoentities("Unit") . ")"; // Do not use strtolower because it breaks utf8 encoding |
|
3726
|
+ $optlabel .= " (".price($objp->unitprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency)."/".$langs->trans("Unit").")"; // Do not use strtolower because it breaks utf8 encoding |
|
3727
|
+ $outvallabel .= " (".price($objp->unitprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 0, $langs, 0, 0, -1, $conf->currency)."/".$langs->transnoentities("Unit").")"; // Do not use strtolower because it breaks utf8 encoding |
3728
|
3728
|
} |
3729
|
3729
|
if ($objp->remise_percent >= 1) { |
3730
|
|
- $optlabel .= " - " . $langs->trans("Discount") . " : " . vatrate($objp->remise_percent) . ' %'; |
3731
|
|
- $outvallabel .= " - " . $langs->transnoentities("Discount") . " : " . vatrate($objp->remise_percent) . ' %'; |
|
3730
|
+ $optlabel .= " - ".$langs->trans("Discount")." : ".vatrate($objp->remise_percent).' %'; |
|
3731
|
+ $outvallabel .= " - ".$langs->transnoentities("Discount")." : ".vatrate($objp->remise_percent).' %'; |
3732
|
3732
|
} |
3733
|
3733
|
if ($objp->duration) { |
3734
|
|
- $optlabel .= " - " . $objp->duration; |
3735
|
|
- $outvallabel .= " - " . $objp->duration; |
|
3734
|
+ $optlabel .= " - ".$objp->duration; |
|
3735
|
+ $outvallabel .= " - ".$objp->duration; |
3736
|
3736
|
} |
3737
|
3737
|
if (!$socid) { |
3738
|
|
- $optlabel .= " - " . dol_trunc($objp->name, 8); |
3739
|
|
- $outvallabel .= " - " . dol_trunc($objp->name, 8); |
|
3738
|
+ $optlabel .= " - ".dol_trunc($objp->name, 8); |
|
3739
|
+ $outvallabel .= " - ".dol_trunc($objp->name, 8); |
3740
|
3740
|
} |
3741
|
3741
|
if ($objp->supplier_reputation) { |
3742
|
3742
|
//TODO dictionary |
3743
|
3743
|
$reputations = array('' => $langs->trans('Standard'), 'FAVORITE' => $langs->trans('Favorite'), 'NOTTHGOOD' => $langs->trans('NotTheGoodQualitySupplier'), 'DONOTORDER' => $langs->trans('DoNotOrderThisProductToThisSupplier')); |
3744
|
3744
|
|
3745
|
|
- $optlabel .= " - " . $reputations[$objp->supplier_reputation]; |
3746
|
|
- $outvallabel .= " - " . $reputations[$objp->supplier_reputation]; |
|
3745
|
+ $optlabel .= " - ".$reputations[$objp->supplier_reputation]; |
|
3746
|
+ $outvallabel .= " - ".$reputations[$objp->supplier_reputation]; |
3747
|
3747
|
} |
3748
|
3748
|
} else { |
3749
|
3749
|
if (empty($alsoproductwithnosupplierprice)) { // No supplier price defined for couple product/supplier |
3750
|
|
- $optlabel .= " - <span class='opacitymedium'>" . $langs->trans("NoPriceDefinedForThisSupplier") . '</span>'; |
3751
|
|
- $outvallabel .= ' - ' . $langs->transnoentities("NoPriceDefinedForThisSupplier"); |
|
3750
|
+ $optlabel .= " - <span class='opacitymedium'>".$langs->trans("NoPriceDefinedForThisSupplier").'</span>'; |
|
3751
|
+ $outvallabel .= ' - '.$langs->transnoentities("NoPriceDefinedForThisSupplier"); |
3752
|
3752
|
} else { // No supplier price defined for product, even on other suppliers |
3753
|
|
- $optlabel .= " - <span class='opacitymedium'>" . $langs->trans("NoPriceDefinedForThisSupplier") . '</span>'; |
3754
|
|
- $outvallabel .= ' - ' . $langs->transnoentities("NoPriceDefinedForThisSupplier"); |
|
3753
|
+ $optlabel .= " - <span class='opacitymedium'>".$langs->trans("NoPriceDefinedForThisSupplier").'</span>'; |
|
3754
|
+ $outvallabel .= ' - '.$langs->transnoentities("NoPriceDefinedForThisSupplier"); |
3755
|
3755
|
} |
3756
|
3756
|
} |
3757
|
3757
|
|
|
@@ -3759,14 +3759,14 @@ discard block |
|
|
block discarded – undo |
3759
|
3759
|
$novirtualstock = ($showstockinlist == 2); |
3760
|
3760
|
|
3761
|
3761
|
if ($user->hasRight('stock', 'lire')) { |
3762
|
|
- $outvallabel .= ' - ' . $langs->trans("Stock") . ': ' . price(price2num($objp->stock, 'MS')); |
|
3762
|
+ $outvallabel .= ' - '.$langs->trans("Stock").': '.price(price2num($objp->stock, 'MS')); |
3763
|
3763
|
|
3764
|
3764
|
if ($objp->stock > 0) { |
3765
|
3765
|
$optlabel .= ' - <span class="product_line_stock_ok">'; |
3766
|
3766
|
} elseif ($objp->stock <= 0) { |
3767
|
3767
|
$optlabel .= ' - <span class="product_line_stock_too_low">'; |
3768
|
3768
|
} |
3769
|
|
- $optlabel .= $langs->transnoentities("Stock") . ':' . price(price2num($objp->stock, 'MS')); |
|
3769
|
+ $optlabel .= $langs->transnoentities("Stock").':'.price(price2num($objp->stock, 'MS')); |
3770
|
3770
|
$optlabel .= '</span>'; |
3771
|
3771
|
if (empty($novirtualstock) && getDolGlobalString('STOCK_SHOW_VIRTUAL_STOCK_IN_PRODUCTS_COMBO')) { // Warning, this option may slow down combo list generation |
3772
|
3772
|
$langs->load("stocks"); |
|
@@ -3776,9 +3776,9 @@ discard block |
|
|
block discarded – undo |
3776
|
3776
|
$tmpproduct->load_virtual_stock(); |
3777
|
3777
|
$virtualstock = $tmpproduct->stock_theorique; |
3778
|
3778
|
|
3779
|
|
- $outvallabel .= ' - ' . $langs->trans("VirtualStock") . ':' . $virtualstock; |
|
3779
|
+ $outvallabel .= ' - '.$langs->trans("VirtualStock").':'.$virtualstock; |
3780
|
3780
|
|
3781
|
|
- $optlabel .= ' - ' . $langs->transnoentities("VirtualStock") . ':'; |
|
3781
|
+ $optlabel .= ' - '.$langs->transnoentities("VirtualStock").':'; |
3782
|
3782
|
if ($virtualstock > 0) { |
3783
|
3783
|
$optlabel .= '<span class="product_line_stock_ok">'; |
3784
|
3784
|
} elseif ($virtualstock <= 0) { |
|
@@ -3792,7 +3792,7 @@ discard block |
|
|
block discarded – undo |
3792
|
3792
|
} |
3793
|
3793
|
} |
3794
|
3794
|
|
3795
|
|
- $optstart = '<option value="' . $outkey . '"'; |
|
3795
|
+ $optstart = '<option value="'.$outkey.'"'; |
3796
|
3796
|
if ($selected && $selected == $objp->idprodfournprice) { |
3797
|
3797
|
$optstart .= ' selected'; |
3798
|
3798
|
} |
|
@@ -3801,27 +3801,27 @@ discard block |
|
|
block discarded – undo |
3801
|
3801
|
} |
3802
|
3802
|
|
3803
|
3803
|
if (!empty($objp->idprodfournprice) && $objp->idprodfournprice > 0) { |
3804
|
|
- $optstart .= ' data-product-id="' . dol_escape_htmltag($objp->rowid) . '"'; |
3805
|
|
- $optstart .= ' data-price-id="' . dol_escape_htmltag($objp->idprodfournprice) . '"'; |
3806
|
|
- $optstart .= ' data-qty="' . dol_escape_htmltag($objp->quantity) . '"'; |
3807
|
|
- $optstart .= ' data-up="' . dol_escape_htmltag(price2num($objp->unitprice)) . '"'; |
3808
|
|
- $optstart .= ' data-up-locale="' . dol_escape_htmltag(price($objp->unitprice)) . '"'; |
3809
|
|
- $optstart .= ' data-discount="' . dol_escape_htmltag($outdiscount) . '"'; |
3810
|
|
- $optstart .= ' data-tvatx="' . dol_escape_htmltag(price2num($objp->tva_tx)) . '"'; |
3811
|
|
- $optstart .= ' data-tvatx-formated="' . dol_escape_htmltag(price($objp->tva_tx, 0, $langs, 1, -1, 2)) . '"'; |
3812
|
|
- $optstart .= ' data-default-vat-code="' . dol_escape_htmltag($objp->default_vat_code) . '"'; |
3813
|
|
- $optstart .= ' data-supplier-ref="' . dol_escape_htmltag($objp->ref_fourn) . '"'; |
3814
|
|
- } |
3815
|
|
- $optstart .= ' data-description="' . dol_escape_htmltag($objp->description, 0, 1) . '"'; |
|
3804
|
+ $optstart .= ' data-product-id="'.dol_escape_htmltag($objp->rowid).'"'; |
|
3805
|
+ $optstart .= ' data-price-id="'.dol_escape_htmltag($objp->idprodfournprice).'"'; |
|
3806
|
+ $optstart .= ' data-qty="'.dol_escape_htmltag($objp->quantity).'"'; |
|
3807
|
+ $optstart .= ' data-up="'.dol_escape_htmltag(price2num($objp->unitprice)).'"'; |
|
3808
|
+ $optstart .= ' data-up-locale="'.dol_escape_htmltag(price($objp->unitprice)).'"'; |
|
3809
|
+ $optstart .= ' data-discount="'.dol_escape_htmltag($outdiscount).'"'; |
|
3810
|
+ $optstart .= ' data-tvatx="'.dol_escape_htmltag(price2num($objp->tva_tx)).'"'; |
|
3811
|
+ $optstart .= ' data-tvatx-formated="'.dol_escape_htmltag(price($objp->tva_tx, 0, $langs, 1, -1, 2)).'"'; |
|
3812
|
+ $optstart .= ' data-default-vat-code="'.dol_escape_htmltag($objp->default_vat_code).'"'; |
|
3813
|
+ $optstart .= ' data-supplier-ref="'.dol_escape_htmltag($objp->ref_fourn).'"'; |
|
3814
|
+ } |
|
3815
|
+ $optstart .= ' data-description="'.dol_escape_htmltag($objp->description, 0, 1).'"'; |
3816
|
3816
|
|
3817
|
3817
|
$outarrayentry = array( |
3818
|
3818
|
'key' => $outkey, |
3819
|
3819
|
'value' => $outref, |
3820
|
3820
|
'label' => $outvallabel, |
3821
|
3821
|
'qty' => $outqty, |
3822
|
|
- 'price_qty_ht' => price2num($objp->fprice, 'MU'), // Keep higher resolution for price for the min qty |
3823
|
|
- 'price_unit_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price |
3824
|
|
- 'price_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price (for compatibility) |
|
3822
|
+ 'price_qty_ht' => price2num($objp->fprice, 'MU'), // Keep higher resolution for price for the min qty |
|
3823
|
+ 'price_unit_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price |
|
3824
|
+ 'price_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price (for compatibility) |
3825
|
3825
|
'tva_tx_formated' => price($objp->tva_tx, 0, $langs, 1, -1, 2), |
3826
|
3826
|
'tva_tx' => price2num($objp->tva_tx), |
3827
|
3827
|
'default_vat_code' => $objp->default_vat_code, |
|
@@ -3846,18 +3846,18 @@ discard block |
|
|
block discarded – undo |
3846
|
3846
|
// Add new entry |
3847
|
3847
|
// "key" value of json key array is used by jQuery automatically as selected value. Example: 'type' = product or service, 'price_ht' = unit price without tax |
3848
|
3848
|
// "label" value of json key array is used by jQuery automatically as text for combo box |
3849
|
|
- $out .= $optstart . ' data-html="' . dol_escape_htmltag($optlabel) . '">' . $optlabel . "</option>\n"; |
|
3849
|
+ $out .= $optstart.' data-html="'.dol_escape_htmltag($optlabel).'">'.$optlabel."</option>\n"; |
3850
|
3850
|
array_push( |
3851
|
3851
|
$outarray, |
3852
|
3852
|
array('key' => $outkey, |
3853
|
3853
|
'value' => $outref, |
3854
|
3854
|
'label' => $outvallabel, |
3855
|
3855
|
'qty' => $outqty, |
3856
|
|
- 'price_qty_ht' => price2num($objp->fprice, 'MU'), // Keep higher resolution for price for the min qty |
|
3856
|
+ 'price_qty_ht' => price2num($objp->fprice, 'MU'), // Keep higher resolution for price for the min qty |
3857
|
3857
|
'price_qty_ht_locale' => price($objp->fprice), |
3858
|
|
- 'price_unit_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price |
|
3858
|
+ 'price_unit_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price |
3859
|
3859
|
'price_unit_ht_locale' => price($objp->unitprice), |
3860
|
|
- 'price_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price (for compatibility) |
|
3860
|
+ 'price_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price (for compatibility) |
3861
|
3861
|
'tva_tx_formated' => price($objp->tva_tx), |
3862
|
3862
|
'tva_tx' => price2num($objp->tva_tx), |
3863
|
3863
|
'default_vat_code' => $objp->default_vat_code, |
|
@@ -3884,7 +3884,7 @@ discard block |
|
|
block discarded – undo |
3884
|
3884
|
|
3885
|
3885
|
$this->db->free($result); |
3886
|
3886
|
|
3887
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
3887
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
3888
|
3888
|
$out .= ajax_combobox($htmlname); |
3889
|
3889
|
} else { |
3890
|
3890
|
dol_print_error($this->db); |
|
@@ -3916,43 +3916,43 @@ discard block |
|
|
block discarded – undo |
3916
|
3916
|
$sql = "SELECT p.rowid, p.ref, p.label, p.price, p.duration, pfp.fk_soc,"; |
3917
|
3917
|
$sql .= " pfp.ref_fourn, pfp.rowid as idprodfournprice, pfp.price as fprice, pfp.remise_percent, pfp.quantity, pfp.unitprice,"; |
3918
|
3918
|
$sql .= " pfp.fk_supplier_price_expression, pfp.fk_product, pfp.tva_tx, s.nom as name"; |
3919
|
|
- $sql .= " FROM " . $this->db->prefix() . "product as p"; |
3920
|
|
- $sql .= " LEFT JOIN " . $this->db->prefix() . "product_fournisseur_price as pfp ON p.rowid = pfp.fk_product"; |
3921
|
|
- $sql .= " LEFT JOIN " . $this->db->prefix() . "societe as s ON pfp.fk_soc = s.rowid"; |
3922
|
|
- $sql .= " WHERE pfp.entity IN (" . getEntity('productsupplierprice') . ")"; |
|
3919
|
+ $sql .= " FROM ".$this->db->prefix()."product as p"; |
|
3920
|
+ $sql .= " LEFT JOIN ".$this->db->prefix()."product_fournisseur_price as pfp ON p.rowid = pfp.fk_product"; |
|
3921
|
+ $sql .= " LEFT JOIN ".$this->db->prefix()."societe as s ON pfp.fk_soc = s.rowid"; |
|
3922
|
+ $sql .= " WHERE pfp.entity IN (".getEntity('productsupplierprice').")"; |
3923
|
3923
|
$sql .= " AND p.tobuy = 1"; |
3924
|
3924
|
$sql .= " AND s.fournisseur = 1"; |
3925
|
|
- $sql .= " AND p.rowid = " . ((int) $productid); |
|
3925
|
+ $sql .= " AND p.rowid = ".((int) $productid); |
3926
|
3926
|
if (!getDolGlobalString('PRODUCT_BEST_SUPPLIER_PRICE_PRESELECTED')) { |
3927
|
3927
|
$sql .= " ORDER BY s.nom, pfp.ref_fourn DESC"; |
3928
|
3928
|
} else { |
3929
|
3929
|
$sql .= " ORDER BY pfp.unitprice ASC"; |
3930
|
3930
|
} |
3931
|
3931
|
|
3932
|
|
- dol_syslog(get_class($this) . "::select_product_fourn_price", LOG_DEBUG); |
|
3932
|
+ dol_syslog(get_class($this)."::select_product_fourn_price", LOG_DEBUG); |
3933
|
3933
|
$result = $this->db->query($sql); |
3934
|
3934
|
|
3935
|
3935
|
if ($result) { |
3936
|
3936
|
$num = $this->db->num_rows($result); |
3937
|
3937
|
|
3938
|
|
- $form = '<select class="flat" id="select_' . $htmlname . '" name="' . $htmlname . '">'; |
|
3938
|
+ $form = '<select class="flat" id="select_'.$htmlname.'" name="'.$htmlname.'">'; |
3939
|
3939
|
|
3940
|
3940
|
if (!$num) { |
3941
|
|
- $form .= '<option value="0">-- ' . $langs->trans("NoSupplierPriceDefinedForThisProduct") . ' --</option>'; |
|
3941
|
+ $form .= '<option value="0">-- '.$langs->trans("NoSupplierPriceDefinedForThisProduct").' --</option>'; |
3942
|
3942
|
} else { |
3943
|
|
- require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php'; |
|
3943
|
+ require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php'; |
3944
|
3944
|
$form .= '<option value="0"> </option>'; |
3945
|
3945
|
|
3946
|
3946
|
$i = 0; |
3947
|
3947
|
while ($i < $num) { |
3948
|
3948
|
$objp = $this->db->fetch_object($result); |
3949
|
3949
|
|
3950
|
|
- $opt = '<option value="' . $objp->idprodfournprice . '"'; |
|
3950
|
+ $opt = '<option value="'.$objp->idprodfournprice.'"'; |
3951
|
3951
|
//if there is only one supplier, preselect it |
3952
|
3952
|
if ($num == 1 || ($selected_supplier > 0 && $objp->fk_soc == $selected_supplier) || ($i == 0 && getDolGlobalString('PRODUCT_BEST_SUPPLIER_PRICE_PRESELECTED'))) { |
3953
|
3953
|
$opt .= ' selected'; |
3954
|
3954
|
} |
3955
|
|
- $opt .= '>' . $objp->name . ' - ' . $objp->ref_fourn . ' - '; |
|
3955
|
+ $opt .= '>'.$objp->name.' - '.$objp->ref_fourn.' - '; |
3956
|
3956
|
|
3957
|
3957
|
if (isModEnabled('dynamicprices') && !empty($objp->fk_supplier_price_expression)) { |
3958
|
3958
|
$prod_supplier = new ProductFournisseur($this->db); |
|
@@ -3962,7 +3962,7 @@ discard block |
|
|
block discarded – undo |
3962
|
3962
|
$prod_supplier->fourn_tva_tx = $objp->tva_tx; |
3963
|
3963
|
$prod_supplier->fk_supplier_price_expression = $objp->fk_supplier_price_expression; |
3964
|
3964
|
|
3965
|
|
- require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php'; |
|
3965
|
+ require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php'; |
3966
|
3966
|
$priceparser = new PriceParser($this->db); |
3967
|
3967
|
$price_result = $priceparser->parseProductSupplier($prod_supplier); |
3968
|
3968
|
if ($price_result >= 0) { |
|
@@ -3973,10 +3973,10 @@ discard block |
|
|
block discarded – undo |
3973
|
3973
|
} |
3974
|
3974
|
} |
3975
|
3975
|
if ($objp->quantity == 1) { |
3976
|
|
- $opt .= price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency) . "/"; |
|
3976
|
+ $opt .= price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency)."/"; |
3977
|
3977
|
} |
3978
|
3978
|
|
3979
|
|
- $opt .= $objp->quantity . ' '; |
|
3979
|
+ $opt .= $objp->quantity.' '; |
3980
|
3980
|
|
3981
|
3981
|
if ($objp->quantity == 1) { |
3982
|
3982
|
$opt .= $langs->trans("Unit"); |
|
@@ -3985,10 +3985,10 @@ discard block |
|
|
block discarded – undo |
3985
|
3985
|
} |
3986
|
3986
|
if ($objp->quantity > 1) { |
3987
|
3987
|
$opt .= " - "; |
3988
|
|
- $opt .= price($objp->unitprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency) . "/" . $langs->trans("Unit"); |
|
3988
|
+ $opt .= price($objp->unitprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency)."/".$langs->trans("Unit"); |
3989
|
3989
|
} |
3990
|
3990
|
if ($objp->duration) { |
3991
|
|
- $opt .= " - " . $objp->duration; |
|
3991
|
+ $opt .= " - ".$objp->duration; |
3992
|
3992
|
} |
3993
|
3993
|
$opt .= "</option>\n"; |
3994
|
3994
|
|
|
@@ -4026,8 +4026,8 @@ discard block |
|
|
block discarded – undo |
4026
|
4026
|
dol_syslog(__METHOD__, LOG_DEBUG); |
4027
|
4027
|
|
4028
|
4028
|
$sql = "SELECT rowid, code, libelle as label, deposit_percent"; |
4029
|
|
- $sql .= " FROM " . $this->db->prefix() . 'c_payment_term'; |
4030
|
|
- $sql .= " WHERE entity IN (" . getEntity('c_payment_term') . ")"; |
|
4029
|
+ $sql .= " FROM ".$this->db->prefix().'c_payment_term'; |
|
4030
|
+ $sql .= " WHERE entity IN (".getEntity('c_payment_term').")"; |
4031
|
4031
|
$sql .= " AND active > 0"; |
4032
|
4032
|
$sql .= " ORDER BY sortorder"; |
4033
|
4033
|
|
|
@@ -4039,7 +4039,7 @@ discard block |
|
|
block discarded – undo |
4039
|
4039
|
$obj = $this->db->fetch_object($resql); |
4040
|
4040
|
|
4041
|
4041
|
// Si traduction existe, on l'utilise, sinon on prend le libelle par defaut |
4042
|
|
- $label = ($langs->trans("PaymentConditionShort" . $obj->code) != ("PaymentConditionShort" . $obj->code) ? $langs->trans("PaymentConditionShort" . $obj->code) : ($obj->label != '-' ? $obj->label : '')); |
|
4042
|
+ $label = ($langs->trans("PaymentConditionShort".$obj->code) != ("PaymentConditionShort".$obj->code) ? $langs->trans("PaymentConditionShort".$obj->code) : ($obj->label != '-' ? $obj->label : '')); |
4043
|
4043
|
$this->cache_conditions_paiements[$obj->rowid]['code'] = $obj->code; |
4044
|
4044
|
$this->cache_conditions_paiements[$obj->rowid]['label'] = $label; |
4045
|
4045
|
$this->cache_conditions_paiements[$obj->rowid]['deposit_percent'] = $obj->deposit_percent; |
|
@@ -4067,7 +4067,7 @@ discard block |
|
|
block discarded – undo |
4067
|
4067
|
// phpcs:enable |
4068
|
4068
|
global $langs; |
4069
|
4069
|
|
4070
|
|
- $num = count($this->cache_availability); // TODO Use $conf->cache['availability'] instead of $this->cache_availability |
|
4070
|
+ $num = count($this->cache_availability); // TODO Use $conf->cache['availability'] instead of $this->cache_availability |
4071
|
4071
|
if ($num > 0) { |
4072
|
4072
|
return 0; // Cache already loaded |
4073
|
4073
|
} |
|
@@ -4077,7 +4077,7 @@ discard block |
|
|
block discarded – undo |
4077
|
4077
|
$langs->load('propal'); |
4078
|
4078
|
|
4079
|
4079
|
$sql = "SELECT rowid, code, label, position"; |
4080
|
|
- $sql .= " FROM " . $this->db->prefix() . 'c_availability'; |
|
4080
|
+ $sql .= " FROM ".$this->db->prefix().'c_availability'; |
4081
|
4081
|
$sql .= " WHERE active > 0"; |
4082
|
4082
|
|
4083
|
4083
|
$resql = $this->db->query($sql); |
|
@@ -4088,7 +4088,7 @@ discard block |
|
|
block discarded – undo |
4088
|
4088
|
$obj = $this->db->fetch_object($resql); |
4089
|
4089
|
|
4090
|
4090
|
// Si traduction existe, on l'utilise, sinon on prend le libelle par defaut |
4091
|
|
- $label = ($langs->trans("AvailabilityType" . $obj->code) != ("AvailabilityType" . $obj->code) ? $langs->trans("AvailabilityType" . $obj->code) : ($obj->label != '-' ? $obj->label : '')); |
|
4091
|
+ $label = ($langs->trans("AvailabilityType".$obj->code) != ("AvailabilityType".$obj->code) ? $langs->trans("AvailabilityType".$obj->code) : ($obj->label != '-' ? $obj->label : '')); |
4092
|
4092
|
$this->cache_availability[$obj->rowid]['code'] = $obj->code; |
4093
|
4093
|
$this->cache_availability[$obj->rowid]['label'] = $label; |
4094
|
4094
|
$this->cache_availability[$obj->rowid]['position'] = $obj->position; |
|
@@ -4120,17 +4120,17 @@ discard block |
|
|
block discarded – undo |
4120
|
4120
|
|
4121
|
4121
|
$this->load_cache_availability(); |
4122
|
4122
|
|
4123
|
|
- dol_syslog(__METHOD__ . " selected=" . $selected . ", htmlname=" . $htmlname, LOG_DEBUG); |
|
4123
|
+ dol_syslog(__METHOD__." selected=".$selected.", htmlname=".$htmlname, LOG_DEBUG); |
4124
|
4124
|
|
4125
|
|
- print '<select id="' . $htmlname . '" class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">'; |
|
4125
|
+ print '<select id="'.$htmlname.'" class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">'; |
4126
|
4126
|
if ($addempty) { |
4127
|
4127
|
print '<option value="0"> </option>'; |
4128
|
4128
|
} |
4129
|
4129
|
foreach ($this->cache_availability as $id => $arrayavailability) { |
4130
|
4130
|
if ($selected == $id) { |
4131
|
|
- print '<option value="' . $id . '" selected>'; |
|
4131
|
+ print '<option value="'.$id.'" selected>'; |
4132
|
4132
|
} else { |
4133
|
|
- print '<option value="' . $id . '">'; |
|
4133
|
+ print '<option value="'.$id.'">'; |
4134
|
4134
|
} |
4135
|
4135
|
print dol_escape_htmltag($arrayavailability['label']); |
4136
|
4136
|
print '</option>'; |
|
@@ -4151,13 +4151,13 @@ discard block |
|
|
block discarded – undo |
4151
|
4151
|
{ |
4152
|
4152
|
global $langs; |
4153
|
4153
|
|
4154
|
|
- $num = count($this->cache_demand_reason); // TODO Use $conf->cache['input_reason'] instead of $this->cache_demand_reason |
|
4154
|
+ $num = count($this->cache_demand_reason); // TODO Use $conf->cache['input_reason'] instead of $this->cache_demand_reason |
4155
|
4155
|
if ($num > 0) { |
4156
|
4156
|
return 0; // Cache already loaded |
4157
|
4157
|
} |
4158
|
4158
|
|
4159
|
4159
|
$sql = "SELECT rowid, code, label"; |
4160
|
|
- $sql .= " FROM " . $this->db->prefix() . 'c_input_reason'; |
|
4160
|
+ $sql .= " FROM ".$this->db->prefix().'c_input_reason'; |
4161
|
4161
|
$sql .= " WHERE active > 0"; |
4162
|
4162
|
|
4163
|
4163
|
$resql = $this->db->query($sql); |
|
@@ -4170,8 +4170,8 @@ discard block |
|
|
block discarded – undo |
4170
|
4170
|
|
4171
|
4171
|
// Si traduction existe, on l'utilise, sinon on prend le libelle par defaut |
4172
|
4172
|
$label = ($obj->label != '-' ? $obj->label : ''); |
4173
|
|
- if ($langs->trans("DemandReasonType" . $obj->code) != ("DemandReasonType" . $obj->code)) { |
4174
|
|
- $label = $langs->trans("DemandReasonType" . $obj->code); // So translation key DemandReasonTypeSRC_XXX will work |
|
4173
|
+ if ($langs->trans("DemandReasonType".$obj->code) != ("DemandReasonType".$obj->code)) { |
|
4174
|
+ $label = $langs->trans("DemandReasonType".$obj->code); // So translation key DemandReasonTypeSRC_XXX will work |
4175
|
4175
|
} |
4176
|
4176
|
if ($langs->trans($obj->code) != $obj->code) { |
4177
|
4177
|
$label = $langs->trans($obj->code); // So translation key SRC_XXX will work |
|
@@ -4211,9 +4211,9 @@ discard block |
|
|
block discarded – undo |
4211
|
4211
|
|
4212
|
4212
|
$this->loadCacheInputReason(); |
4213
|
4213
|
|
4214
|
|
- print '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" id="select_' . $htmlname . '" name="' . $htmlname . '">'; |
|
4214
|
+ print '<select class="flat'.($morecss ? ' '.$morecss : '').'" id="select_'.$htmlname.'" name="'.$htmlname.'">'; |
4215
|
4215
|
if ($addempty) { |
4216
|
|
- print '<option value="0"' . (empty($selected) ? ' selected' : '') . '> </option>'; |
|
4216
|
+ print '<option value="0"'.(empty($selected) ? ' selected' : '').'> </option>'; |
4217
|
4217
|
} |
4218
|
4218
|
foreach ($this->cache_demand_reason as $id => $arraydemandreason) { |
4219
|
4219
|
if ($arraydemandreason['code'] == $exclude) { |
|
@@ -4221,9 +4221,9 @@ discard block |
|
|
block discarded – undo |
4221
|
4221
|
} |
4222
|
4222
|
|
4223
|
4223
|
if ($selected && ($selected == $arraydemandreason['id'] || $selected == $arraydemandreason['code'])) { |
4224
|
|
- print '<option value="' . $arraydemandreason['id'] . '" selected>'; |
|
4224
|
+ print '<option value="'.$arraydemandreason['id'].'" selected>'; |
4225
|
4225
|
} else { |
4226
|
|
- print '<option value="' . $arraydemandreason['id'] . '">'; |
|
4226
|
+ print '<option value="'.$arraydemandreason['id'].'">'; |
4227
|
4227
|
} |
4228
|
4228
|
$label = $arraydemandreason['label']; // Translation of label was already done into the ->loadCacheInputReason |
4229
|
4229
|
print $langs->trans($label); |
|
@@ -4233,7 +4233,7 @@ discard block |
|
|
block discarded – undo |
4233
|
4233
|
if ($user->admin && empty($notooltip)) { |
4234
|
4234
|
print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); |
4235
|
4235
|
} |
4236
|
|
- print ajax_combobox('select_' . $htmlname); |
|
4236
|
+ print ajax_combobox('select_'.$htmlname); |
4237
|
4237
|
} |
4238
|
4238
|
|
4239
|
4239
|
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
@@ -4248,7 +4248,7 @@ discard block |
|
|
block discarded – undo |
4248
|
4248
|
// phpcs:enable |
4249
|
4249
|
global $langs; |
4250
|
4250
|
|
4251
|
|
- $num = count($this->cache_types_paiements); // TODO Use $conf->cache['payment_mode'] instead of $this->cache_types_paiements |
|
4251
|
+ $num = count($this->cache_types_paiements); // TODO Use $conf->cache['payment_mode'] instead of $this->cache_types_paiements |
4252
|
4252
|
if ($num > 0) { |
4253
|
4253
|
return $num; // Cache already loaded |
4254
|
4254
|
} |
|
@@ -4258,8 +4258,8 @@ discard block |
|
|
block discarded – undo |
4258
|
4258
|
$this->cache_types_paiements = array(); |
4259
|
4259
|
|
4260
|
4260
|
$sql = "SELECT id, code, libelle as label, type, active"; |
4261
|
|
- $sql .= " FROM " . $this->db->prefix() . "c_paiement"; |
4262
|
|
- $sql .= " WHERE entity IN (" . getEntity('c_paiement') . ")"; |
|
4261
|
+ $sql .= " FROM ".$this->db->prefix()."c_paiement"; |
|
4262
|
+ $sql .= " WHERE entity IN (".getEntity('c_paiement').")"; |
4263
|
4263
|
|
4264
|
4264
|
$resql = $this->db->query($sql); |
4265
|
4265
|
if ($resql) { |
|
@@ -4269,7 +4269,7 @@ discard block |
|
|
block discarded – undo |
4269
|
4269
|
$obj = $this->db->fetch_object($resql); |
4270
|
4270
|
|
4271
|
4271
|
// Si traduction existe, on l'utilise, sinon on prend le libelle par defaut |
4272
|
|
- $label = ($langs->transnoentitiesnoconv("PaymentTypeShort" . $obj->code) != ("PaymentTypeShort" . $obj->code) ? $langs->transnoentitiesnoconv("PaymentTypeShort" . $obj->code) : ($obj->label != '-' ? $obj->label : '')); |
|
4272
|
+ $label = ($langs->transnoentitiesnoconv("PaymentTypeShort".$obj->code) != ("PaymentTypeShort".$obj->code) ? $langs->transnoentitiesnoconv("PaymentTypeShort".$obj->code) : ($obj->label != '-' ? $obj->label : '')); |
4273
|
4273
|
$this->cache_types_paiements[$obj->id]['id'] = $obj->id; |
4274
|
4274
|
$this->cache_types_paiements[$obj->id]['code'] = $obj->code; |
4275
|
4275
|
$this->cache_types_paiements[$obj->id]['label'] = $label; |
|
@@ -4335,17 +4335,17 @@ discard block |
|
|
block discarded – undo |
4335
|
4335
|
global $langs, $user, $conf; |
4336
|
4336
|
|
4337
|
4337
|
$out = ''; |
4338
|
|
- dol_syslog(__METHOD__ . " selected=" . $selected . ", htmlname=" . $htmlname, LOG_DEBUG); |
|
4338
|
+ dol_syslog(__METHOD__." selected=".$selected.", htmlname=".$htmlname, LOG_DEBUG); |
4339
|
4339
|
|
4340
|
4340
|
$this->load_cache_conditions_paiements(); |
4341
|
4341
|
|
4342
|
4342
|
// Set default value if not already set by caller |
4343
|
4343
|
if (empty($selected) && getDolGlobalString('MAIN_DEFAULT_PAYMENT_TERM_ID')) { |
4344
|
|
- dol_syslog(__METHOD__ . "Using deprecated option MAIN_DEFAULT_PAYMENT_TERM_ID", LOG_NOTICE); |
|
4344
|
+ dol_syslog(__METHOD__."Using deprecated option MAIN_DEFAULT_PAYMENT_TERM_ID", LOG_NOTICE); |
4345
|
4345
|
$selected = $conf->global->MAIN_DEFAULT_PAYMENT_TERM_ID; |
4346
|
4346
|
} |
4347
|
4347
|
|
4348
|
|
- $out .= '<select id="' . $htmlname . '" class="flat selectpaymentterms' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">'; |
|
4348
|
+ $out .= '<select id="'.$htmlname.'" class="flat selectpaymentterms'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">'; |
4349
|
4349
|
if ($addempty) { |
4350
|
4350
|
$out .= '<option value="0"> </option>'; |
4351
|
4351
|
} |
|
@@ -4359,9 +4359,9 @@ discard block |
|
|
block discarded – undo |
4359
|
4359
|
|
4360
|
4360
|
if ($selected == $id) { |
4361
|
4361
|
$selectedDepositPercent = $deposit_percent > 0 ? $deposit_percent : $arrayconditions['deposit_percent']; |
4362
|
|
- $out .= '<option value="' . $id . '" data-deposit_percent="' . $arrayconditions['deposit_percent'] . '" selected>'; |
|
4362
|
+ $out .= '<option value="'.$id.'" data-deposit_percent="'.$arrayconditions['deposit_percent'].'" selected>'; |
4363
|
4363
|
} else { |
4364
|
|
- $out .= '<option value="' . $id . '" data-deposit_percent="' . $arrayconditions['deposit_percent'] . '">'; |
|
4364
|
+ $out .= '<option value="'.$id.'" data-deposit_percent="'.$arrayconditions['deposit_percent'].'">'; |
4365
|
4365
|
} |
4366
|
4366
|
$label = $arrayconditions['label']; |
4367
|
4367
|
|
|
@@ -4379,21 +4379,21 @@ discard block |
|
|
block discarded – undo |
4379
|
4379
|
$out .= ajax_combobox($htmlname); |
4380
|
4380
|
|
4381
|
4381
|
if ($deposit_percent >= 0) { |
4382
|
|
- $out .= ' <span id="' . $htmlname . '_deposit_percent_container"' . (empty($selectedDepositPercent) ? ' style="display: none"' : '') . '>'; |
4383
|
|
- $out .= $langs->trans('DepositPercent') . ' : '; |
4384
|
|
- $out .= '<input id="' . $htmlname . '_deposit_percent" name="' . $htmlname . '_deposit_percent" class="maxwidth50" value="' . $deposit_percent . '" />'; |
|
4382
|
+ $out .= ' <span id="'.$htmlname.'_deposit_percent_container"'.(empty($selectedDepositPercent) ? ' style="display: none"' : '').'>'; |
|
4383
|
+ $out .= $langs->trans('DepositPercent').' : '; |
|
4384
|
+ $out .= '<input id="'.$htmlname.'_deposit_percent" name="'.$htmlname.'_deposit_percent" class="maxwidth50" value="'.$deposit_percent.'" />'; |
4385
|
4385
|
$out .= '</span>'; |
4386
|
4386
|
$out .= ' |
4387
|
|
- <script nonce="' . getNonce() . '"> |
|
4387
|
+ <script nonce="' . getNonce().'"> |
4388
|
4388
|
$(document).ready(function () { |
4389
|
|
- $("#' . $htmlname . '").change(function () { |
|
4389
|
+ $("#' . $htmlname.'").change(function () { |
4390
|
4390
|
let $selected = $(this).find("option:selected"); |
4391
|
4391
|
let depositPercent = $selected.attr("data-deposit_percent"); |
4392
|
4392
|
|
4393
|
4393
|
if (depositPercent.length > 0) { |
4394
|
|
- $("#' . $htmlname . '_deposit_percent_container").show().find("#' . $htmlname . '_deposit_percent").val(depositPercent); |
|
4394
|
+ $("#' . $htmlname.'_deposit_percent_container").show().find("#'.$htmlname.'_deposit_percent").val(depositPercent); |
4395
|
4395
|
} else { |
4396
|
|
- $("#' . $htmlname . '_deposit_percent_container").hide(); |
|
4396
|
+ $("#' . $htmlname.'_deposit_percent_container").hide(); |
4397
|
4397
|
} |
4398
|
4398
|
|
4399
|
4399
|
return true; |
|
@@ -4431,7 +4431,7 @@ discard block |
|
|
block discarded – undo |
4431
|
4431
|
|
4432
|
4432
|
$out = ''; |
4433
|
4433
|
|
4434
|
|
- dol_syslog(__METHOD__ . " " . $selected . ", " . $htmlname . ", " . $filtertype . ", " . $format, LOG_DEBUG); |
|
4434
|
+ dol_syslog(__METHOD__." ".$selected.", ".$htmlname.", ".$filtertype.", ".$format, LOG_DEBUG); |
4435
|
4435
|
|
4436
|
4436
|
$filterarray = array(); |
4437
|
4437
|
if ($filtertype == 'CRDT') { |
|
@@ -4446,11 +4446,11 @@ discard block |
|
|
block discarded – undo |
4446
|
4446
|
|
4447
|
4447
|
// Set default value if not already set by caller |
4448
|
4448
|
if (empty($selected) && getDolGlobalString('MAIN_DEFAULT_PAYMENT_TYPE_ID')) { |
4449
|
|
- dol_syslog(__METHOD__ . "Using deprecated option MAIN_DEFAULT_PAYMENT_TYPE_ID", LOG_NOTICE); |
|
4449
|
+ dol_syslog(__METHOD__."Using deprecated option MAIN_DEFAULT_PAYMENT_TYPE_ID", LOG_NOTICE); |
4450
|
4450
|
$selected = $conf->global->MAIN_DEFAULT_PAYMENT_TYPE_ID; |
4451
|
4451
|
} |
4452
|
4452
|
|
4453
|
|
- $out .= '<select id="select' . $htmlname . '" class="flat selectpaymenttypes' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">'; |
|
4453
|
+ $out .= '<select id="select'.$htmlname.'" class="flat selectpaymenttypes'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">'; |
4454
|
4454
|
if ($empty) { |
4455
|
4455
|
$out .= '<option value=""> </option>'; |
4456
|
4456
|
} |
|
@@ -4471,13 +4471,13 @@ discard block |
|
|
block discarded – undo |
4471
|
4471
|
} |
4472
|
4472
|
|
4473
|
4473
|
if ($format == 0) { |
4474
|
|
- $out .= '<option value="' . $id . '"'; |
|
4474
|
+ $out .= '<option value="'.$id.'"'; |
4475
|
4475
|
} elseif ($format == 1) { |
4476
|
|
- $out .= '<option value="' . $arraytypes['code'] . '"'; |
|
4476
|
+ $out .= '<option value="'.$arraytypes['code'].'"'; |
4477
|
4477
|
} elseif ($format == 2) { |
4478
|
|
- $out .= '<option value="' . $arraytypes['code'] . '"'; |
|
4478
|
+ $out .= '<option value="'.$arraytypes['code'].'"'; |
4479
|
4479
|
} elseif ($format == 3) { |
4480
|
|
- $out .= '<option value="' . $id . '"'; |
|
4480
|
+ $out .= '<option value="'.$id.'"'; |
4481
|
4481
|
} |
4482
|
4482
|
// Print attribute selected or not |
4483
|
4483
|
if ($format == 1 || $format == 2) { |
|
@@ -4507,7 +4507,7 @@ discard block |
|
|
block discarded – undo |
4507
|
4507
|
if ($user->admin && !$noadmininfo) { |
4508
|
4508
|
$out .= info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); |
4509
|
4509
|
} |
4510
|
|
- $out .= ajax_combobox('select' . $htmlname); |
|
4510
|
+ $out .= ajax_combobox('select'.$htmlname); |
4511
|
4511
|
|
4512
|
4512
|
if (empty($nooutput)) { |
4513
|
4513
|
print $out; |
|
@@ -4529,22 +4529,22 @@ discard block |
|
|
block discarded – undo |
4529
|
4529
|
{ |
4530
|
4530
|
global $langs; |
4531
|
4531
|
|
4532
|
|
- $return = '<select class="flat maxwidth100" id="select_' . $htmlname . '" name="' . $htmlname . '">'; |
|
4532
|
+ $return = '<select class="flat maxwidth100" id="select_'.$htmlname.'" name="'.$htmlname.'">'; |
4533
|
4533
|
$options = array( |
4534
|
4534
|
'HT' => $langs->trans("HT"), |
4535
|
4535
|
'TTC' => $langs->trans("TTC") |
4536
|
4536
|
); |
4537
|
4537
|
foreach ($options as $id => $value) { |
4538
|
4538
|
if ($selected == $id) { |
4539
|
|
- $return .= '<option value="' . $id . '" selected>' . $value; |
|
4539
|
+ $return .= '<option value="'.$id.'" selected>'.$value; |
4540
|
4540
|
} else { |
4541
|
|
- $return .= '<option value="' . $id . '">' . $value; |
|
4541
|
+ $return .= '<option value="'.$id.'">'.$value; |
4542
|
4542
|
} |
4543
|
4543
|
$return .= '</option>'; |
4544
|
4544
|
} |
4545
|
4545
|
$return .= '</select>'; |
4546
|
4546
|
if ($addjscombo) { |
4547
|
|
- $return .= ajax_combobox('select_' . $htmlname); |
|
4547
|
+ $return .= ajax_combobox('select_'.$htmlname); |
4548
|
4548
|
} |
4549
|
4549
|
|
4550
|
4550
|
return $return; |
|
@@ -4562,7 +4562,7 @@ discard block |
|
|
block discarded – undo |
4562
|
4562
|
// phpcs:enable |
4563
|
4563
|
global $langs; |
4564
|
4564
|
|
4565
|
|
- $num = count($this->cache_transport_mode); // TODO Use $conf->cache['payment_mode'] instead of $this->cache_transport_mode |
|
4565
|
+ $num = count($this->cache_transport_mode); // TODO Use $conf->cache['payment_mode'] instead of $this->cache_transport_mode |
4566
|
4566
|
if ($num > 0) { |
4567
|
4567
|
return $num; // Cache already loaded |
4568
|
4568
|
} |
|
@@ -4572,8 +4572,8 @@ discard block |
|
|
block discarded – undo |
4572
|
4572
|
$this->cache_transport_mode = array(); |
4573
|
4573
|
|
4574
|
4574
|
$sql = "SELECT rowid, code, label, active"; |
4575
|
|
- $sql .= " FROM " . $this->db->prefix() . "c_transport_mode"; |
4576
|
|
- $sql .= " WHERE entity IN (" . getEntity('c_transport_mode') . ")"; |
|
4575
|
+ $sql .= " FROM ".$this->db->prefix()."c_transport_mode"; |
|
4576
|
+ $sql .= " WHERE entity IN (".getEntity('c_transport_mode').")"; |
4577
|
4577
|
|
4578
|
4578
|
$resql = $this->db->query($sql); |
4579
|
4579
|
if ($resql) { |
|
@@ -4583,7 +4583,7 @@ discard block |
|
|
block discarded – undo |
4583
|
4583
|
$obj = $this->db->fetch_object($resql); |
4584
|
4584
|
|
4585
|
4585
|
// If traduction exist, we use it else we take the default label |
4586
|
|
- $label = ($langs->transnoentitiesnoconv("PaymentTypeShort" . $obj->code) != ("PaymentTypeShort" . $obj->code) ? $langs->transnoentitiesnoconv("PaymentTypeShort" . $obj->code) : ($obj->label != '-' ? $obj->label : '')); |
|
4586
|
+ $label = ($langs->transnoentitiesnoconv("PaymentTypeShort".$obj->code) != ("PaymentTypeShort".$obj->code) ? $langs->transnoentitiesnoconv("PaymentTypeShort".$obj->code) : ($obj->label != '-' ? $obj->label : '')); |
4587
|
4587
|
$this->cache_transport_mode[$obj->rowid]['rowid'] = $obj->rowid; |
4588
|
4588
|
$this->cache_transport_mode[$obj->rowid]['code'] = $obj->code; |
4589
|
4589
|
$this->cache_transport_mode[$obj->rowid]['label'] = $label; |
|
@@ -4617,11 +4617,11 @@ discard block |
|
|
block discarded – undo |
4617
|
4617
|
{ |
4618
|
4618
|
global $langs, $user; |
4619
|
4619
|
|
4620
|
|
- dol_syslog(__METHOD__ . " " . $selected . ", " . $htmlname . ", " . $format, LOG_DEBUG); |
|
4620
|
+ dol_syslog(__METHOD__." ".$selected.", ".$htmlname.", ".$format, LOG_DEBUG); |
4621
|
4621
|
|
4622
|
4622
|
$this->load_cache_transport_mode(); |
4623
|
4623
|
|
4624
|
|
- print '<select id="select' . $htmlname . '" class="flat selectmodetransport' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">'; |
|
4624
|
+ print '<select id="select'.$htmlname.'" class="flat selectmodetransport'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">'; |
4625
|
4625
|
if ($empty) { |
4626
|
4626
|
print '<option value=""> </option>'; |
4627
|
4627
|
} |
|
@@ -4637,13 +4637,13 @@ discard block |
|
|
block discarded – undo |
4637
|
4637
|
} |
4638
|
4638
|
|
4639
|
4639
|
if ($format == 0) { |
4640
|
|
- print '<option value="' . $id . '"'; |
|
4640
|
+ print '<option value="'.$id.'"'; |
4641
|
4641
|
} elseif ($format == 1) { |
4642
|
|
- print '<option value="' . $arraytypes['code'] . '"'; |
|
4642
|
+ print '<option value="'.$arraytypes['code'].'"'; |
4643
|
4643
|
} elseif ($format == 2) { |
4644
|
|
- print '<option value="' . $arraytypes['code'] . '"'; |
|
4644
|
+ print '<option value="'.$arraytypes['code'].'"'; |
4645
|
4645
|
} elseif ($format == 3) { |
4646
|
|
- print '<option value="' . $id . '"'; |
|
4646
|
+ print '<option value="'.$id.'"'; |
4647
|
4647
|
} |
4648
|
4648
|
// If text is selected, we compare with code, else with id |
4649
|
4649
|
if (preg_match('/[a-z]/i', $selected) && $selected == $arraytypes['code']) { |
|
@@ -4691,31 +4691,31 @@ discard block |
|
|
block discarded – undo |
4691
|
4691
|
$langs->load("deliveries"); |
4692
|
4692
|
|
4693
|
4693
|
$sql = "SELECT rowid, code, libelle as label"; |
4694
|
|
- $sql .= " FROM " . $this->db->prefix() . "c_shipment_mode"; |
|
4694
|
+ $sql .= " FROM ".$this->db->prefix()."c_shipment_mode"; |
4695
|
4695
|
$sql .= " WHERE active > 0"; |
4696
|
4696
|
if ($filtre) { |
4697
|
|
- $sql .= " AND " . $filtre; |
|
4697
|
+ $sql .= " AND ".$filtre; |
4698
|
4698
|
} |
4699
|
4699
|
$sql .= " ORDER BY libelle ASC"; |
4700
|
4700
|
|
4701
|
|
- dol_syslog(get_class($this) . "::selectShippingMode", LOG_DEBUG); |
|
4701
|
+ dol_syslog(get_class($this)."::selectShippingMode", LOG_DEBUG); |
4702
|
4702
|
$result = $this->db->query($sql); |
4703
|
4703
|
if ($result) { |
4704
|
4704
|
$num = $this->db->num_rows($result); |
4705
|
4705
|
$i = 0; |
4706
|
4706
|
if ($num) { |
4707
|
|
- print '<select id="select' . $htmlname . '" class="flat selectshippingmethod' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '"' . ($moreattrib ? ' ' . $moreattrib : '') . '>'; |
|
4707
|
+ print '<select id="select'.$htmlname.'" class="flat selectshippingmethod'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'"'.($moreattrib ? ' '.$moreattrib : '').'>'; |
4708
|
4708
|
if ($useempty == 1 || ($useempty == 2 && $num > 1)) { |
4709
|
4709
|
print '<option value="-1"> </option>'; |
4710
|
4710
|
} |
4711
|
4711
|
while ($i < $num) { |
4712
|
4712
|
$obj = $this->db->fetch_object($result); |
4713
|
4713
|
if ($selected == $obj->rowid) { |
4714
|
|
- print '<option value="' . $obj->rowid . '" selected>'; |
|
4714
|
+ print '<option value="'.$obj->rowid.'" selected>'; |
4715
|
4715
|
} else { |
4716
|
|
- print '<option value="' . $obj->rowid . '">'; |
|
4716
|
+ print '<option value="'.$obj->rowid.'">'; |
4717
|
4717
|
} |
4718
|
|
- print ($langs->trans("SendingMethod" . strtoupper($obj->code)) != "SendingMethod" . strtoupper($obj->code)) ? $langs->trans("SendingMethod" . strtoupper($obj->code)) : $obj->label; |
|
4718
|
+ print ($langs->trans("SendingMethod".strtoupper($obj->code)) != "SendingMethod".strtoupper($obj->code)) ? $langs->trans("SendingMethod".strtoupper($obj->code)) : $obj->label; |
4719
|
4719
|
print '</option>'; |
4720
|
4720
|
$i++; |
4721
|
4721
|
} |
|
@@ -4724,7 +4724,7 @@ discard block |
|
|
block discarded – undo |
4724
|
4724
|
print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); |
4725
|
4725
|
} |
4726
|
4726
|
|
4727
|
|
- print ajax_combobox('select' . $htmlname); |
|
4727
|
+ print ajax_combobox('select'.$htmlname); |
4728
|
4728
|
} else { |
4729
|
4729
|
print $langs->trans("NoShippingMethodDefined"); |
4730
|
4730
|
} |
|
@@ -4749,16 +4749,16 @@ discard block |
|
|
block discarded – undo |
4749
|
4749
|
$langs->load("deliveries"); |
4750
|
4750
|
|
4751
|
4751
|
if ($htmlname != "none") { |
4752
|
|
- print '<form method="POST" action="' . $page . '">'; |
|
4752
|
+ print '<form method="POST" action="'.$page.'">'; |
4753
|
4753
|
print '<input type="hidden" name="action" value="setshippingmethod">'; |
4754
|
|
- print '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
4754
|
+ print '<input type="hidden" name="token" value="'.newToken().'">'; |
4755
|
4755
|
$this->selectShippingMethod($selected, $htmlname, '', $addempty); |
4756
|
|
- print '<input type="submit" class="button valignmiddle" value="' . $langs->trans("Modify") . '">'; |
|
4756
|
+ print '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">'; |
4757
|
4757
|
print '</form>'; |
4758
|
4758
|
} else { |
4759
|
4759
|
if ($selected) { |
4760
|
4760
|
$code = $langs->getLabelFromKey($this->db, $selected, 'c_shipment_mode', 'rowid', 'code'); |
4761
|
|
- print $langs->trans("SendingMethod" . strtoupper($code)); |
|
4761
|
+ print $langs->trans("SendingMethod".strtoupper($code)); |
4762
|
4762
|
} else { |
4763
|
4763
|
print " "; |
4764
|
4764
|
} |
|
@@ -4781,10 +4781,10 @@ discard block |
|
|
block discarded – undo |
4781
|
4781
|
|
4782
|
4782
|
$opt = '<option value="" selected></option>'; |
4783
|
4783
|
$sql = "SELECT rowid, ref, situation_cycle_ref, situation_counter, situation_final, fk_soc"; |
4784
|
|
- $sql .= ' FROM ' . $this->db->prefix() . 'facture'; |
4785
|
|
- $sql .= ' WHERE entity IN (' . getEntity('invoice') . ')'; |
|
4784
|
+ $sql .= ' FROM '.$this->db->prefix().'facture'; |
|
4785
|
+ $sql .= ' WHERE entity IN ('.getEntity('invoice').')'; |
4786
|
4786
|
$sql .= ' AND situation_counter >= 1'; |
4787
|
|
- $sql .= ' AND fk_soc = ' . (int) $socid; |
|
4787
|
+ $sql .= ' AND fk_soc = '.(int) $socid; |
4788
|
4788
|
$sql .= ' AND type <> 2'; |
4789
|
4789
|
$sql .= ' ORDER by situation_cycle_ref, situation_counter desc'; |
4790
|
4790
|
$resql = $this->db->query($sql); |
|
@@ -4802,19 +4802,19 @@ discard block |
|
|
block discarded – undo |
4802
|
4802
|
//Not prov? |
4803
|
4803
|
if (substr($obj->ref, 1, 4) != 'PROV') { |
4804
|
4804
|
if ($selected == $obj->rowid) { |
4805
|
|
- $opt .= '<option value="' . $obj->rowid . '" selected>' . $obj->ref . '</option>'; |
|
4805
|
+ $opt .= '<option value="'.$obj->rowid.'" selected>'.$obj->ref.'</option>'; |
4806
|
4806
|
} else { |
4807
|
|
- $opt .= '<option value="' . $obj->rowid . '">' . $obj->ref . '</option>'; |
|
4807
|
+ $opt .= '<option value="'.$obj->rowid.'">'.$obj->ref.'</option>'; |
4808
|
4808
|
} |
4809
|
4809
|
} |
4810
|
4810
|
} |
4811
|
4811
|
} |
4812
|
4812
|
} |
4813
|
4813
|
} else { |
4814
|
|
- dol_syslog("Error sql=" . $sql . ", error=" . $this->error, LOG_ERR); |
|
4814
|
+ dol_syslog("Error sql=".$sql.", error=".$this->error, LOG_ERR); |
4815
|
4815
|
} |
4816
|
4816
|
if ($opt == '<option value ="" selected></option>') { |
4817
|
|
- $opt = '<option value ="0" selected>' . $langs->trans('NoSituations') . '</option>'; |
|
4817
|
+ $opt = '<option value ="0" selected>'.$langs->trans('NoSituations').'</option>'; |
4818
|
4818
|
} |
4819
|
4819
|
return $opt; |
4820
|
4820
|
} |
|
@@ -4834,12 +4834,12 @@ discard block |
|
|
block discarded – undo |
4834
|
4834
|
|
4835
|
4835
|
$langs->load('products'); |
4836
|
4836
|
|
4837
|
|
- $return = '<select class="flat" id="' . $htmlname . '" name="' . $htmlname . '">'; |
|
4837
|
+ $return = '<select class="flat" id="'.$htmlname.'" name="'.$htmlname.'">'; |
4838
|
4838
|
|
4839
|
|
- $sql = "SELECT rowid, label, code FROM " . $this->db->prefix() . "c_units"; |
|
4839
|
+ $sql = "SELECT rowid, label, code FROM ".$this->db->prefix()."c_units"; |
4840
|
4840
|
$sql .= ' WHERE active > 0'; |
4841
|
4841
|
if (!empty($unit_type)) { |
4842
|
|
- $sql .= " AND unit_type = '" . $this->db->escape($unit_type) . "'"; |
|
4842
|
+ $sql .= " AND unit_type = '".$this->db->escape($unit_type)."'"; |
4843
|
4843
|
} |
4844
|
4844
|
$sql .= " ORDER BY sortorder"; |
4845
|
4845
|
|
|
@@ -4851,14 +4851,14 @@ discard block |
|
|
block discarded – undo |
4851
|
4851
|
|
4852
|
4852
|
while ($res = $this->db->fetch_object($resql)) { |
4853
|
4853
|
$unitLabel = $res->label; |
4854
|
|
- if (!empty($langs->tab_translate['unit' . $res->code])) { // check if Translation is available before |
4855
|
|
- $unitLabel = $langs->trans('unit' . $res->code) != $res->label ? $langs->trans('unit' . $res->code) : $res->label; |
|
4854
|
+ if (!empty($langs->tab_translate['unit'.$res->code])) { // check if Translation is available before |
|
4855
|
+ $unitLabel = $langs->trans('unit'.$res->code) != $res->label ? $langs->trans('unit'.$res->code) : $res->label; |
4856
|
4856
|
} |
4857
|
4857
|
|
4858
|
4858
|
if ($selected == $res->rowid) { |
4859
|
|
- $return .= '<option value="' . $res->rowid . '" selected>' . $unitLabel . '</option>'; |
|
4859
|
+ $return .= '<option value="'.$res->rowid.'" selected>'.$unitLabel.'</option>'; |
4860
|
4860
|
} else { |
4861
|
|
- $return .= '<option value="' . $res->rowid . '">' . $unitLabel . '</option>'; |
|
4861
|
+ $return .= '<option value="'.$res->rowid.'">'.$unitLabel.'</option>'; |
4862
|
4862
|
} |
4863
|
4863
|
} |
4864
|
4864
|
$return .= '</select>'; |
|
@@ -4893,23 +4893,23 @@ discard block |
|
|
block discarded – undo |
4893
|
4893
|
$num = 0; |
4894
|
4894
|
|
4895
|
4895
|
$sql = "SELECT rowid, label, bank, clos as status, currency_code"; |
4896
|
|
- $sql .= " FROM " . $this->db->prefix() . "bank_account"; |
4897
|
|
- $sql .= " WHERE entity IN (" . getEntity('bank_account') . ")"; |
|
4896
|
+ $sql .= " FROM ".$this->db->prefix()."bank_account"; |
|
4897
|
+ $sql .= " WHERE entity IN (".getEntity('bank_account').")"; |
4898
|
4898
|
if ($status != 2) { |
4899
|
|
- $sql .= " AND clos = " . (int) $status; |
|
4899
|
+ $sql .= " AND clos = ".(int) $status; |
4900
|
4900
|
} |
4901
|
4901
|
if ($filtre) { |
4902
|
|
- $sql .= " AND " . $filtre; |
|
4902
|
+ $sql .= " AND ".$filtre; |
4903
|
4903
|
} |
4904
|
4904
|
$sql .= " ORDER BY label"; |
4905
|
4905
|
|
4906
|
|
- dol_syslog(get_class($this) . "::select_comptes", LOG_DEBUG); |
|
4906
|
+ dol_syslog(get_class($this)."::select_comptes", LOG_DEBUG); |
4907
|
4907
|
$result = $this->db->query($sql); |
4908
|
4908
|
if ($result) { |
4909
|
4909
|
$num = $this->db->num_rows($result); |
4910
|
4910
|
$i = 0; |
4911
|
4911
|
if ($num) { |
4912
|
|
- $out .= '<select id="select' . $htmlname . '" class="flat selectbankaccount' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '"' . ($moreattrib ? ' ' . $moreattrib : '') . '>'; |
|
4912
|
+ $out .= '<select id="select'.$htmlname.'" class="flat selectbankaccount'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'"'.($moreattrib ? ' '.$moreattrib : '').'>'; |
4913
|
4913
|
if ($useempty == 1 || ($useempty == 2 && $num > 1)) { |
4914
|
4914
|
$out .= '<option value="-1"> </option>'; |
4915
|
4915
|
} |
|
@@ -4917,27 +4917,27 @@ discard block |
|
|
block discarded – undo |
4917
|
4917
|
while ($i < $num) { |
4918
|
4918
|
$obj = $this->db->fetch_object($result); |
4919
|
4919
|
if ($selected == $obj->rowid || ($useempty == 2 && $num == 1 && empty($selected))) { |
4920
|
|
- $out .= '<option value="' . $obj->rowid . '" data-currency-code="' . $obj->currency_code . '" selected>'; |
|
4920
|
+ $out .= '<option value="'.$obj->rowid.'" data-currency-code="'.$obj->currency_code.'" selected>'; |
4921
|
4921
|
} else { |
4922
|
|
- $out .= '<option value="' . $obj->rowid . '" data-currency-code="' . $obj->currency_code . '">'; |
|
4922
|
+ $out .= '<option value="'.$obj->rowid.'" data-currency-code="'.$obj->currency_code.'">'; |
4923
|
4923
|
} |
4924
|
4924
|
$out .= trim($obj->label); |
4925
|
4925
|
if ($showcurrency) { |
4926
|
|
- $out .= ' (' . $obj->currency_code . ')'; |
|
4926
|
+ $out .= ' ('.$obj->currency_code.')'; |
4927
|
4927
|
} |
4928
|
4928
|
if ($status == 2 && $obj->status == 1) { |
4929
|
|
- $out .= ' (' . $langs->trans("Closed") . ')'; |
|
4929
|
+ $out .= ' ('.$langs->trans("Closed").')'; |
4930
|
4930
|
} |
4931
|
4931
|
$out .= '</option>'; |
4932
|
4932
|
$i++; |
4933
|
4933
|
} |
4934
|
4934
|
$out .= "</select>"; |
4935
|
|
- $out .= ajax_combobox('select' . $htmlname); |
|
4935
|
+ $out .= ajax_combobox('select'.$htmlname); |
4936
|
4936
|
} else { |
4937
|
4937
|
if ($status == 0) { |
4938
|
|
- $out .= '<span class="opacitymedium">' . $langs->trans("NoActiveBankAccountDefined") . '</span>'; |
|
4938
|
+ $out .= '<span class="opacitymedium">'.$langs->trans("NoActiveBankAccountDefined").'</span>'; |
4939
|
4939
|
} else { |
4940
|
|
- $out .= '<span class="opacitymedium">' . $langs->trans("NoBankAccountFound") . '</span>'; |
|
4940
|
+ $out .= '<span class="opacitymedium">'.$langs->trans("NoBankAccountFound").'</span>'; |
4941
|
4941
|
} |
4942
|
4942
|
} |
4943
|
4943
|
} else { |
|
@@ -4973,23 +4973,23 @@ discard block |
|
|
block discarded – undo |
4973
|
4973
|
$num = 0; |
4974
|
4974
|
|
4975
|
4975
|
$sql = "SELECT rowid, name, fk_country, status, entity"; |
4976
|
|
- $sql .= " FROM " . $this->db->prefix() . "establishment"; |
|
4976
|
+ $sql .= " FROM ".$this->db->prefix()."establishment"; |
4977
|
4977
|
$sql .= " WHERE 1=1"; |
4978
|
4978
|
if ($status != 2) { |
4979
|
|
- $sql .= " AND status = " . (int) $status; |
|
4979
|
+ $sql .= " AND status = ".(int) $status; |
4980
|
4980
|
} |
4981
|
4981
|
if ($filtre) { |
4982
|
|
- $sql .= " AND " . $filtre; |
|
4982
|
+ $sql .= " AND ".$filtre; |
4983
|
4983
|
} |
4984
|
4984
|
$sql .= " ORDER BY name"; |
4985
|
4985
|
|
4986
|
|
- dol_syslog(get_class($this) . "::select_establishment", LOG_DEBUG); |
|
4986
|
+ dol_syslog(get_class($this)."::select_establishment", LOG_DEBUG); |
4987
|
4987
|
$result = $this->db->query($sql); |
4988
|
4988
|
if ($result) { |
4989
|
4989
|
$num = $this->db->num_rows($result); |
4990
|
4990
|
$i = 0; |
4991
|
4991
|
if ($num) { |
4992
|
|
- print '<select id="select' . $htmlname . '" class="flat selectestablishment" name="' . $htmlname . '"' . ($moreattrib ? ' ' . $moreattrib : '') . '>'; |
|
4992
|
+ print '<select id="select'.$htmlname.'" class="flat selectestablishment" name="'.$htmlname.'"'.($moreattrib ? ' '.$moreattrib : '').'>'; |
4993
|
4993
|
if ($useempty == 1 || ($useempty == 2 && $num > 1)) { |
4994
|
4994
|
print '<option value="-1"> </option>'; |
4995
|
4995
|
} |
|
@@ -4997,13 +4997,13 @@ discard block |
|
|
block discarded – undo |
4997
|
4997
|
while ($i < $num) { |
4998
|
4998
|
$obj = $this->db->fetch_object($result); |
4999
|
4999
|
if ($selected == $obj->rowid) { |
5000
|
|
- print '<option value="' . $obj->rowid . '" selected>'; |
|
5000
|
+ print '<option value="'.$obj->rowid.'" selected>'; |
5001
|
5001
|
} else { |
5002
|
|
- print '<option value="' . $obj->rowid . '">'; |
|
5002
|
+ print '<option value="'.$obj->rowid.'">'; |
5003
|
5003
|
} |
5004
|
5004
|
print trim($obj->name); |
5005
|
5005
|
if ($status == 2 && $obj->status == 1) { |
5006
|
|
- print ' (' . $langs->trans("Closed") . ')'; |
|
5006
|
+ print ' ('.$langs->trans("Closed").')'; |
5007
|
5007
|
} |
5008
|
5008
|
print '</option>'; |
5009
|
5009
|
$i++; |
|
@@ -5011,9 +5011,9 @@ discard block |
|
|
block discarded – undo |
5011
|
5011
|
print "</select>"; |
5012
|
5012
|
} else { |
5013
|
5013
|
if ($status == 0) { |
5014
|
|
- print '<span class="opacitymedium">' . $langs->trans("NoActiveEstablishmentDefined") . '</span>'; |
|
5014
|
+ print '<span class="opacitymedium">'.$langs->trans("NoActiveEstablishmentDefined").'</span>'; |
5015
|
5015
|
} else { |
5016
|
|
- print '<span class="opacitymedium">' . $langs->trans("NoEstablishmentFound") . '</span>'; |
|
5016
|
+ print '<span class="opacitymedium">'.$langs->trans("NoEstablishmentFound").'</span>'; |
5017
|
5017
|
} |
5018
|
5018
|
} |
5019
|
5019
|
|
|
@@ -5037,20 +5037,20 @@ discard block |
|
|
block discarded – undo |
5037
|
5037
|
{ |
5038
|
5038
|
global $langs; |
5039
|
5039
|
if ($htmlname != "none") { |
5040
|
|
- print '<form method="POST" action="' . $page . '">'; |
|
5040
|
+ print '<form method="POST" action="'.$page.'">'; |
5041
|
5041
|
print '<input type="hidden" name="action" value="setbankaccount">'; |
5042
|
|
- print '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
5042
|
+ print '<input type="hidden" name="token" value="'.newToken().'">'; |
5043
|
5043
|
print img_picto('', 'bank_account', 'class="pictofixedwidth"'); |
5044
|
5044
|
$nbaccountfound = $this->select_comptes($selected, $htmlname, 0, '', $addempty); |
5045
|
5045
|
if ($nbaccountfound > 0) { |
5046
|
|
- print '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">'; |
|
5046
|
+ print '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">'; |
5047
|
5047
|
} |
5048
|
5048
|
print '</form>'; |
5049
|
5049
|
} else { |
5050
|
5050
|
$langs->load('banks'); |
5051
|
5051
|
|
5052
|
5052
|
if ($selected) { |
5053
|
|
- require_once DOL_DOCUMENT_ROOT . '/compta/bank/class/account.class.php'; |
|
5053
|
+ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; |
5054
|
5054
|
$bankstatic = new Account($this->db); |
5055
|
5055
|
$result = $bankstatic->fetch($selected); |
5056
|
5056
|
if ($result) { |
|
@@ -5088,19 +5088,19 @@ discard block |
|
|
block discarded – undo |
5088
|
5088
|
global $conf, $langs; |
5089
|
5089
|
$langs->load("categories"); |
5090
|
5090
|
|
5091
|
|
- include_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; |
|
5091
|
+ include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; |
5092
|
5092
|
|
5093
|
5093
|
// For backward compatibility |
5094
|
5094
|
if (is_numeric($type)) { |
5095
|
|
- dol_syslog(__METHOD__ . ': using numeric value for parameter type is deprecated. Use string code instead.', LOG_WARNING); |
|
5095
|
+ dol_syslog(__METHOD__.': using numeric value for parameter type is deprecated. Use string code instead.', LOG_WARNING); |
5096
|
5096
|
} |
5097
|
5097
|
|
5098
|
5098
|
if ($type === Categorie::TYPE_BANK_LINE) { |
5099
|
5099
|
// TODO Move this into common category feature |
5100
|
5100
|
$cate_arbo = array(); |
5101
|
5101
|
$sql = "SELECT c.label, c.rowid"; |
5102
|
|
- $sql .= " FROM " . $this->db->prefix() . "bank_categ as c"; |
5103
|
|
- $sql .= " WHERE entity = " . $conf->entity; |
|
5102
|
+ $sql .= " FROM ".$this->db->prefix()."bank_categ as c"; |
|
5103
|
+ $sql .= " WHERE entity = ".$conf->entity; |
5104
|
5104
|
$sql .= " ORDER BY c.label"; |
5105
|
5105
|
$result = $this->db->query($sql); |
5106
|
5106
|
if ($result) { |
|
@@ -5125,10 +5125,10 @@ discard block |
|
|
block discarded – undo |
5125
|
5125
|
$outarray = array(); |
5126
|
5126
|
$outarrayrichhtml = array(); |
5127
|
5127
|
|
5128
|
|
- $output = '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">'; |
|
5128
|
+ $output = '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">'; |
5129
|
5129
|
if (is_array($cate_arbo)) { |
5130
|
5130
|
if (!count($cate_arbo)) { |
5131
|
|
- $output .= '<option value="-1" disabled>' . $langs->trans("NoCategoriesDefined") . '</option>'; |
|
5131
|
+ $output .= '<option value="-1" disabled>'.$langs->trans("NoCategoriesDefined").'</option>'; |
5132
|
5132
|
} else { |
5133
|
5133
|
$output .= '<option value="-1"> </option>'; |
5134
|
5134
|
foreach ($cate_arbo as $key => $value) { |
|
@@ -5138,15 +5138,15 @@ discard block |
|
|
block discarded – undo |
5138
|
5138
|
$add = ''; |
5139
|
5139
|
} |
5140
|
5140
|
|
5141
|
|
- $labeltoshow = img_picto('', 'category', 'class="pictofixedwidth" style="color: #' . $cate_arbo[$key]['color'] . '"'); |
|
5141
|
+ $labeltoshow = img_picto('', 'category', 'class="pictofixedwidth" style="color: #'.$cate_arbo[$key]['color'].'"'); |
5142
|
5142
|
$labeltoshow .= dol_trunc($cate_arbo[$key]['fulllabel'], $maxlength, 'middle'); |
5143
|
5143
|
|
5144
|
5144
|
$outarray[$cate_arbo[$key]['id']] = $cate_arbo[$key]['fulllabel']; |
5145
|
5145
|
|
5146
|
5146
|
$outarrayrichhtml[$cate_arbo[$key]['id']] = $labeltoshow; |
5147
|
5147
|
|
5148
|
|
- $output .= '<option ' . $add . 'value="' . $cate_arbo[$key]['id'] . '"'; |
5149
|
|
- $output .= ' data-html="' . dol_escape_htmltag($labeltoshow) . '"'; |
|
5148
|
+ $output .= '<option '.$add.'value="'.$cate_arbo[$key]['id'].'"'; |
|
5149
|
+ $output .= ' data-html="'.dol_escape_htmltag($labeltoshow).'"'; |
5150
|
5150
|
$output .= '>'; |
5151
|
5151
|
$output .= dol_trunc($cate_arbo[$key]['fulllabel'], $maxlength, 'middle'); |
5152
|
5152
|
$output .= '</option>'; |
|
@@ -5187,7 +5187,7 @@ discard block |
|
|
block discarded – undo |
5187
|
5187
|
public function form_confirm($page, $title, $question, $action, $formquestion = '', $selectedchoice = "", $useajax = 0, $height = 170, $width = 500) |
5188
|
5188
|
{ |
5189
|
5189
|
// phpcs:enable |
5190
|
|
- dol_syslog(__METHOD__ . ': using form_confirm is deprecated. Use formconfim instead.', LOG_WARNING); |
|
5190
|
+ dol_syslog(__METHOD__.': using form_confirm is deprecated. Use formconfim instead.', LOG_WARNING); |
5191
|
5191
|
print $this->formconfirm($page, $title, $question, $action, $formquestion, $selectedchoice, $useajax, $height, $width); |
5192
|
5192
|
} |
5193
|
5193
|
|
|
@@ -5222,7 +5222,7 @@ discard block |
|
|
block discarded – undo |
5222
|
5222
|
{ |
5223
|
5223
|
global $langs, $conf; |
5224
|
5224
|
|
5225
|
|
- $more = '<!-- formconfirm - before call, page=' . dol_escape_htmltag($page) . ' -->'; |
|
5225
|
+ $more = '<!-- formconfirm - before call, page='.dol_escape_htmltag($page).' -->'; |
5226
|
5226
|
$formconfirm = ''; |
5227
|
5227
|
$inputok = array(); |
5228
|
5228
|
$inputko = array(); |
|
@@ -5246,27 +5246,27 @@ discard block |
|
|
block discarded – undo |
5246
|
5246
|
foreach ($formquestion as $key => $input) { |
5247
|
5247
|
if (is_array($input) && !empty($input)) { |
5248
|
5248
|
if ($input['type'] == 'hidden') { |
5249
|
|
- $moreattr = (!empty($input['moreattr']) ? ' ' . $input['moreattr'] : ''); |
5250
|
|
- $morecss = (!empty($input['morecss']) ? ' ' . $input['morecss'] : ''); |
|
5249
|
+ $moreattr = (!empty($input['moreattr']) ? ' '.$input['moreattr'] : ''); |
|
5250
|
+ $morecss = (!empty($input['morecss']) ? ' '.$input['morecss'] : ''); |
5251
|
5251
|
|
5252
|
|
- $more .= '<input type="hidden" id="' . dol_escape_htmltag($input['name']) . '" name="' . dol_escape_htmltag($input['name']) . '" value="' . dol_escape_htmltag($input['value']) . '" class="' . $morecss . '"' . $moreattr . '>' . "\n"; |
|
5252
|
+ $more .= '<input type="hidden" id="'.dol_escape_htmltag($input['name']).'" name="'.dol_escape_htmltag($input['name']).'" value="'.dol_escape_htmltag($input['value']).'" class="'.$morecss.'"'.$moreattr.'>'."\n"; |
5253
|
5253
|
} |
5254
|
5254
|
} |
5255
|
5255
|
} |
5256
|
5256
|
|
5257
|
5257
|
// Now add questions |
5258
|
5258
|
$moreonecolumn = ''; |
5259
|
|
- $more .= '<div class="tagtable paddingtopbottomonly centpercent noborderspacing">' . "\n"; |
|
5259
|
+ $more .= '<div class="tagtable paddingtopbottomonly centpercent noborderspacing">'."\n"; |
5260
|
5260
|
foreach ($formquestion as $key => $input) { |
5261
|
5261
|
if (is_array($input) && !empty($input)) { |
5262
|
|
- $size = (!empty($input['size']) ? ' size="' . $input['size'] . '"' : ''); // deprecated. Use morecss instead. |
5263
|
|
- $moreattr = (!empty($input['moreattr']) ? ' ' . $input['moreattr'] : ''); |
5264
|
|
- $morecss = (!empty($input['morecss']) ? ' ' . $input['morecss'] : ''); |
|
5262
|
+ $size = (!empty($input['size']) ? ' size="'.$input['size'].'"' : ''); // deprecated. Use morecss instead. |
|
5263
|
+ $moreattr = (!empty($input['moreattr']) ? ' '.$input['moreattr'] : ''); |
|
5264
|
+ $morecss = (!empty($input['morecss']) ? ' '.$input['morecss'] : ''); |
5265
|
5265
|
|
5266
|
5266
|
if ($input['type'] == 'text') { |
5267
|
|
- $more .= '<div class="tagtr"><div class="tagtd' . (empty($input['tdclass']) ? '' : (' ' . $input['tdclass'])) . '">' . $input['label'] . '</div><div class="tagtd"><input type="text" class="flat' . $morecss . '" id="' . dol_escape_htmltag($input['name']) . '" name="' . dol_escape_htmltag($input['name']) . '"' . $size . ' value="' . (empty($input['value']) ? '' : $input['value']) . '"' . $moreattr . ' /></div></div>' . "\n"; |
|
5267
|
+ $more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">'.$input['label'].'</div><div class="tagtd"><input type="text" class="flat'.$morecss.'" id="'.dol_escape_htmltag($input['name']).'" name="'.dol_escape_htmltag($input['name']).'"'.$size.' value="'.(empty($input['value']) ? '' : $input['value']).'"'.$moreattr.' /></div></div>'."\n"; |
5268
|
5268
|
} elseif ($input['type'] == 'password') { |
5269
|
|
- $more .= '<div class="tagtr"><div class="tagtd' . (empty($input['tdclass']) ? '' : (' ' . $input['tdclass'])) . '">' . $input['label'] . '</div><div class="tagtd"><input type="password" class="flat' . $morecss . '" id="' . dol_escape_htmltag($input['name']) . '" name="' . dol_escape_htmltag($input['name']) . '"' . $size . ' value="' . (empty($input['value']) ? '' : $input['value']) . '"' . $moreattr . ' /></div></div>' . "\n"; |
|
5269
|
+ $more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">'.$input['label'].'</div><div class="tagtd"><input type="password" class="flat'.$morecss.'" id="'.dol_escape_htmltag($input['name']).'" name="'.dol_escape_htmltag($input['name']).'"'.$size.' value="'.(empty($input['value']) ? '' : $input['value']).'"'.$moreattr.' /></div></div>'."\n"; |
5270
|
5270
|
} elseif ($input['type'] == 'textarea') { |
5271
|
5271
|
/*$more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">'.$input['label'].'</div><div class="tagtd">'; |
5272
|
5272
|
$more .= '<textarea name="'.$input['name'].'" class="'.$morecss.'"'.$moreattr.'>'; |
|
@@ -5274,8 +5274,8 @@ discard block |
|
|
block discarded – undo |
5274
|
5274
|
$more .= '</textarea>'; |
5275
|
5275
|
$more .= '</div></div>'."\n";*/ |
5276
|
5276
|
$moreonecolumn .= '<div class="margintoponly">'; |
5277
|
|
- $moreonecolumn .= $input['label'] . '<br>'; |
5278
|
|
- $moreonecolumn .= '<textarea name="' . dol_escape_htmltag($input['name']) . '" id="' . dol_escape_htmltag($input['name']) . '" class="' . $morecss . '"' . $moreattr . '>'; |
|
5277
|
+ $moreonecolumn .= $input['label'].'<br>'; |
|
5278
|
+ $moreonecolumn .= '<textarea name="'.dol_escape_htmltag($input['name']).'" id="'.dol_escape_htmltag($input['name']).'" class="'.$morecss.'"'.$moreattr.'>'; |
5279
|
5279
|
$moreonecolumn .= $input['value']; |
5280
|
5280
|
$moreonecolumn .= '</textarea>'; |
5281
|
5281
|
$moreonecolumn .= '</div>'; |
|
@@ -5292,20 +5292,20 @@ discard block |
|
|
block discarded – undo |
5292
|
5292
|
$disabled = isset($input['select_disabled']) ? $input['select_disabled'] : 0; |
5293
|
5293
|
$sort = isset($input['select_sort']) ? $input['select_sort'] : ''; |
5294
|
5294
|
|
5295
|
|
- $more .= '<div class="tagtr"><div class="tagtd' . (empty($input['tdclass']) ? '' : (' ' . $input['tdclass'])) . '">'; |
|
5295
|
+ $more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">'; |
5296
|
5296
|
if (!empty($input['label'])) { |
5297
|
|
- $more .= $input['label'] . '</div><div class="tagtd left">'; |
|
5297
|
+ $more .= $input['label'].'</div><div class="tagtd left">'; |
5298
|
5298
|
} |
5299
|
5299
|
if ($input['type'] == 'select') { |
5300
|
5300
|
$more .= $this->selectarray($input['name'], $input['values'], isset($input['default']) ? $input['default'] : '-1', $show_empty, $key_in_label, $value_as_key, $moreattr, $translate, $maxlen, $disabled, $sort, $morecss); |
5301
|
5301
|
} else { |
5302
|
5302
|
$more .= $this->multiselectarray($input['name'], $input['values'], is_array($input['default']) ? $input['default'] : [$input['default']], $key_in_label, $value_as_key, $morecss, $translate, $maxlen, $moreattr); |
5303
|
5303
|
} |
5304
|
|
- $more .= '</div></div>' . "\n"; |
|
5304
|
+ $more .= '</div></div>'."\n"; |
5305
|
5305
|
} elseif ($input['type'] == 'checkbox') { |
5306
|
5306
|
$more .= '<div class="tagtr">'; |
5307
|
|
- $more .= '<div class="tagtd' . (empty($input['tdclass']) ? '' : (' ' . $input['tdclass'])) . '"><label for="' . dol_escape_htmltag($input['name']) . '">' . $input['label'] . '</label></div><div class="tagtd">'; |
5308
|
|
- $more .= '<input type="checkbox" class="flat' . ($morecss ? ' ' . $morecss : '') . '" id="' . dol_escape_htmltag($input['name']) . '" name="' . dol_escape_htmltag($input['name']) . '"' . $moreattr; |
|
5307
|
+ $more .= '<div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'"><label for="'.dol_escape_htmltag($input['name']).'">'.$input['label'].'</label></div><div class="tagtd">'; |
|
5308
|
+ $more .= '<input type="checkbox" class="flat'.($morecss ? ' '.$morecss : '').'" id="'.dol_escape_htmltag($input['name']).'" name="'.dol_escape_htmltag($input['name']).'"'.$moreattr; |
5309
|
5309
|
if (!is_bool($input['value']) && $input['value'] != 'false' && $input['value'] != '0' && $input['value'] != '') { |
5310
|
5310
|
$more .= ' checked'; |
5311
|
5311
|
} |
|
@@ -5316,19 +5316,19 @@ discard block |
|
|
block discarded – undo |
5316
|
5316
|
$more .= ' disabled'; |
5317
|
5317
|
} |
5318
|
5318
|
$more .= ' /></div>'; |
5319
|
|
- $more .= '</div>' . "\n"; |
|
5319
|
+ $more .= '</div>'."\n"; |
5320
|
5320
|
} elseif ($input['type'] == 'radio') { |
5321
|
5321
|
$i = 0; |
5322
|
5322
|
foreach ($input['values'] as $selkey => $selval) { |
5323
|
5323
|
$more .= '<div class="tagtr">'; |
5324
|
5324
|
if (isset($input['label'])) { |
5325
|
5325
|
if ($i == 0) { |
5326
|
|
- $more .= '<div class="tagtd' . (empty($input['tdclass']) ? ' tdtop' : (' tdtop ' . $input['tdclass'])) . '">' . $input['label'] . '</div>'; |
|
5326
|
+ $more .= '<div class="tagtd'.(empty($input['tdclass']) ? ' tdtop' : (' tdtop '.$input['tdclass'])).'">'.$input['label'].'</div>'; |
5327
|
5327
|
} else { |
5328
|
|
- $more .= '<div clas="tagtd' . (empty($input['tdclass']) ? '' : (' "' . $input['tdclass'])) . '"> </div>'; |
|
5328
|
+ $more .= '<div clas="tagtd'.(empty($input['tdclass']) ? '' : (' "'.$input['tdclass'])).'"> </div>'; |
5329
|
5329
|
} |
5330
|
5330
|
} |
5331
|
|
- $more .= '<div class="tagtd' . ($i == 0 ? ' tdtop' : '') . '"><input type="radio" class="flat' . $morecss . '" id="' . dol_escape_htmltag($input['name'] . $selkey) . '" name="' . dol_escape_htmltag($input['name']) . '" value="' . $selkey . '"' . $moreattr; |
|
5331
|
+ $more .= '<div class="tagtd'.($i == 0 ? ' tdtop' : '').'"><input type="radio" class="flat'.$morecss.'" id="'.dol_escape_htmltag($input['name'].$selkey).'" name="'.dol_escape_htmltag($input['name']).'" value="'.$selkey.'"'.$moreattr; |
5332
|
5332
|
if (!empty($input['disabled'])) { |
5333
|
5333
|
$more .= ' disabled'; |
5334
|
5334
|
} |
|
@@ -5336,12 +5336,12 @@ discard block |
|
|
block discarded – undo |
5336
|
5336
|
$more .= ' checked="checked"'; |
5337
|
5337
|
} |
5338
|
5338
|
$more .= ' /> '; |
5339
|
|
- $more .= '<label for="' . dol_escape_htmltag($input['name'] . $selkey) . '" class="valignmiddle">' . $selval . '</label>'; |
5340
|
|
- $more .= '</div></div>' . "\n"; |
|
5339
|
+ $more .= '<label for="'.dol_escape_htmltag($input['name'].$selkey).'" class="valignmiddle">'.$selval.'</label>'; |
|
5340
|
+ $more .= '</div></div>'."\n"; |
5341
|
5341
|
$i++; |
5342
|
5342
|
} |
5343
|
5343
|
} elseif ($input['type'] == 'date' || $input['type'] == 'datetime') { |
5344
|
|
- $more .= '<div class="tagtr"><div class="tagtd' . (empty($input['tdclass']) ? '' : (' ' . $input['tdclass'])) . '">' . $input['label'] . '</div>'; |
|
5344
|
+ $more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">'.$input['label'].'</div>'; |
5345
|
5345
|
$more .= '<div class="tagtd">'; |
5346
|
5346
|
$addnowlink = (empty($input['datenow']) ? 0 : 1); |
5347
|
5347
|
$h = $m = 0; |
|
@@ -5359,24 +5359,24 @@ discard block |
|
|
block discarded – undo |
5359
|
5359
|
} elseif ($input['type'] == 'other') { // can be 1 column or 2 depending if label is set or not |
5360
|
5360
|
$more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">'; |
5361
|
5361
|
if (!empty($input['label'])) { |
5362
|
|
- $more .= $input['label'] . '</div><div class="tagtd">'; |
|
5362
|
+ $more .= $input['label'].'</div><div class="tagtd">'; |
5363
|
5363
|
} |
5364
|
5364
|
$more .= $input['value']; |
5365
|
|
- $more .= '</div></div>' . "\n"; |
|
5365
|
+ $more .= '</div></div>'."\n"; |
5366
|
5366
|
} elseif ($input['type'] == 'onecolumn') { |
5367
|
5367
|
$moreonecolumn .= '<div class="margintoponly">'; |
5368
|
5368
|
$moreonecolumn .= $input['value']; |
5369
|
|
- $moreonecolumn .= '</div>' . "\n"; |
|
5369
|
+ $moreonecolumn .= '</div>'."\n"; |
5370
|
5370
|
} elseif ($input['type'] == 'hidden') { |
5371
|
5371
|
// Do nothing more, already added by a previous loop |
5372
|
5372
|
} elseif ($input['type'] == 'separator') { |
5373
|
5373
|
$more .= '<br>'; |
5374
|
5374
|
} else { |
5375
|
|
- $more .= 'Error type ' . $input['type'] . ' for the confirm box is not a supported type'; |
|
5375
|
+ $more .= 'Error type '.$input['type'].' for the confirm box is not a supported type'; |
5376
|
5376
|
} |
5377
|
5377
|
} |
5378
|
5378
|
} |
5379
|
|
- $more .= '</div>' . "\n"; |
|
5379
|
+ $more .= '</div>'."\n"; |
5380
|
5380
|
$more .= $moreonecolumn; |
5381
|
5381
|
} |
5382
|
5382
|
|
|
@@ -5398,10 +5398,10 @@ discard block |
|
|
block discarded – undo |
5398
|
5398
|
$button = $useajax; |
5399
|
5399
|
$useajax = 1; |
5400
|
5400
|
$autoOpen = false; |
5401
|
|
- $dialogconfirm .= '-' . $button; |
|
5401
|
+ $dialogconfirm .= '-'.$button; |
5402
|
5402
|
} |
5403
|
|
- $pageyes = $page . (preg_match('/\?/', $page) ? '&' : '?') . 'action=' . urlencode($action) . '&confirm=yes'; |
5404
|
|
- $pageno = ($useajax == 2 ? $page . (preg_match('/\?/', $page) ? '&' : '?') . 'action=' . urlencode($action) . '&confirm=no' : ''); |
|
5403
|
+ $pageyes = $page.(preg_match('/\?/', $page) ? '&' : '?').'action='.urlencode($action).'&confirm=yes'; |
|
5404
|
+ $pageno = ($useajax == 2 ? $page.(preg_match('/\?/', $page) ? '&' : '?').'action='.urlencode($action).'&confirm=no' : ''); |
5405
|
5405
|
|
5406
|
5406
|
// Add input fields into list of fields to read during submit (inputok and inputko) |
5407
|
5407
|
if (is_array($formquestion)) { |
|
@@ -5423,24 +5423,24 @@ discard block |
|
|
block discarded – undo |
5423
|
5423
|
} |
5424
|
5424
|
|
5425
|
5425
|
// Show JQuery confirm box. |
5426
|
|
- $formconfirm .= '<div id="' . $dialogconfirm . '" title="' . dol_escape_htmltag($title) . '" style="display: none;">'; |
|
5426
|
+ $formconfirm .= '<div id="'.$dialogconfirm.'" title="'.dol_escape_htmltag($title).'" style="display: none;">'; |
5427
|
5427
|
if (is_array($formquestion) && !empty($formquestion['text'])) { |
5428
|
|
- $formconfirm .= '<div class="confirmtext">' . $formquestion['text'] . '</div>' . "\n"; |
|
5428
|
+ $formconfirm .= '<div class="confirmtext">'.$formquestion['text'].'</div>'."\n"; |
5429
|
5429
|
} |
5430
|
5430
|
if (!empty($more)) { |
5431
|
|
- $formconfirm .= '<div class="confirmquestions">' . $more . '</div>' . "\n"; |
|
5431
|
+ $formconfirm .= '<div class="confirmquestions">'.$more.'</div>'."\n"; |
5432
|
5432
|
} |
5433
|
|
- $formconfirm .= ($question ? '<div class="confirmmessage">' . img_help('', '') . ' ' . $question . '</div>' : ''); |
5434
|
|
- $formconfirm .= '</div>' . "\n"; |
|
5433
|
+ $formconfirm .= ($question ? '<div class="confirmmessage">'.img_help('', '').' '.$question.'</div>' : ''); |
|
5434
|
+ $formconfirm .= '</div>'."\n"; |
5435
|
5435
|
|
5436
|
|
- $formconfirm .= "\n<!-- begin code of popup for formconfirm page=" . $page . " -->\n"; |
5437
|
|
- $formconfirm .= '<script nonce="' . getNonce() . '" type="text/javascript">' . "\n"; |
|
5436
|
+ $formconfirm .= "\n<!-- begin code of popup for formconfirm page=".$page." -->\n"; |
|
5437
|
+ $formconfirm .= '<script nonce="'.getNonce().'" type="text/javascript">'."\n"; |
5438
|
5438
|
$formconfirm .= "/* Code for the jQuery('#dialogforpopup').dialog() */\n"; |
5439
|
5439
|
$formconfirm .= 'jQuery(document).ready(function() { |
5440
|
5440
|
$(function() { |
5441
|
|
- $( "#' . $dialogconfirm . '" ).dialog( |
|
5441
|
+ $( "#' . $dialogconfirm.'" ).dialog( |
5442
|
5442
|
{ |
5443
|
|
- autoOpen: ' . ($autoOpen ? "true" : "false") . ','; |
|
5443
|
+ autoOpen: ' . ($autoOpen ? "true" : "false").','; |
5444
|
5444
|
if ($newselectedchoice == 'no') { |
5445
|
5445
|
$formconfirm .= ' |
5446
|
5446
|
open: function() { |
|
@@ -5450,24 +5450,24 @@ discard block |
|
|
block discarded – undo |
5450
|
5450
|
|
5451
|
5451
|
$jsforcursor = ''; |
5452
|
5452
|
if ($useajax == 1) { |
5453
|
|
- $jsforcursor = '// The call to urljump can be slow, so we set the wait cursor' . "\n"; |
5454
|
|
- $jsforcursor .= 'jQuery("html,body,#id-container").addClass("cursorwait");' . "\n"; |
|
5453
|
+ $jsforcursor = '// The call to urljump can be slow, so we set the wait cursor'."\n"; |
|
5454
|
+ $jsforcursor .= 'jQuery("html,body,#id-container").addClass("cursorwait");'."\n"; |
5455
|
5455
|
} |
5456
|
5456
|
|
5457
|
5457
|
$postconfirmas = 'GET'; |
5458
|
5458
|
|
5459
|
5459
|
$formconfirm .= ' |
5460
|
5460
|
resizable: false, |
5461
|
|
- height: "' . $height . '", |
5462
|
|
- width: "' . $width . '", |
|
5461
|
+ height: "' . $height.'", |
|
5462
|
+ width: "' . $width.'", |
5463
|
5463
|
modal: true, |
5464
|
5464
|
closeOnEscape: false, |
5465
|
5465
|
buttons: { |
5466
|
|
- "' . dol_escape_js($langs->transnoentities($labelbuttonyes)) . '": function() { |
5467
|
|
- var options = "token=' . urlencode(newToken()) . '"; |
5468
|
|
- var inputok = ' . json_encode($inputok) . '; /* List of fields into form */ |
5469
|
|
- var page = "' . dol_escape_js(!empty($page) ? $page : '') . '"; |
5470
|
|
- var pageyes = "' . dol_escape_js(!empty($pageyes) ? $pageyes : '') . '"; |
|
5466
|
+ "' . dol_escape_js($langs->transnoentities($labelbuttonyes)).'": function() { |
|
5467
|
+ var options = "token=' . urlencode(newToken()).'"; |
|
5468
|
+ var inputok = ' . json_encode($inputok).'; /* List of fields into form */ |
|
5469
|
+ var page = "' . dol_escape_js(!empty($page) ? $page : '').'"; |
|
5470
|
+ var pageyes = "' . dol_escape_js(!empty($pageyes) ? $pageyes : '').'"; |
5471
|
5471
|
|
5472
|
5472
|
if (inputok.length > 0) { |
5473
|
5473
|
$.each(inputok, function(i, inputname) { |
|
@@ -5501,11 +5501,11 @@ discard block |
|
|
block discarded – undo |
5501
|
5501
|
} |
5502
|
5502
|
$(this).dialog("close"); |
5503
|
5503
|
}, |
5504
|
|
- "' . dol_escape_js($langs->transnoentities($labelbuttonno)) . '": function() { |
5505
|
|
- var options = "token=' . urlencode(newToken()) . '"; |
5506
|
|
- var inputko = ' . json_encode($inputko) . '; /* List of fields into form */ |
5507
|
|
- var page = "' . dol_escape_js(!empty($page) ? $page : '') . '"; |
5508
|
|
- var pageno="' . dol_escape_js(!empty($pageno) ? $pageno : '') . '"; |
|
5504
|
+ "' . dol_escape_js($langs->transnoentities($labelbuttonno)).'": function() { |
|
5505
|
+ var options = "token=' . urlencode(newToken()).'"; |
|
5506
|
+ var inputko = ' . json_encode($inputko).'; /* List of fields into form */ |
|
5507
|
+ var page = "' . dol_escape_js(!empty($page) ? $page : '').'"; |
|
5508
|
+ var pageno="' . dol_escape_js(!empty($pageno) ? $pageno : '').'"; |
5509
|
5509
|
if (inputko.length > 0) { |
5510
|
5510
|
$.each(inputko, function(i, inputname) { |
5511
|
5511
|
var more = ""; |
|
@@ -5537,10 +5537,10 @@ discard block |
|
|
block discarded – undo |
5537
|
5537
|
} |
5538
|
5538
|
); |
5539
|
5539
|
|
5540
|
|
- var button = "' . $button . '"; |
|
5540
|
+ var button = "' . $button.'"; |
5541
|
5541
|
if (button.length > 0) { |
5542
|
5542
|
$( "#" + button ).click(function() { |
5543
|
|
- $("#' . $dialogconfirm . '").dialog("open"); |
|
5543
|
+ $("#' . $dialogconfirm.'").dialog("open"); |
5544
|
5544
|
}); |
5545
|
5545
|
} |
5546
|
5546
|
}); |
|
@@ -5548,44 +5548,44 @@ discard block |
|
|
block discarded – undo |
5548
|
5548
|
</script>'; |
5549
|
5549
|
$formconfirm .= "<!-- end ajax formconfirm -->\n"; |
5550
|
5550
|
} else { |
5551
|
|
- $formconfirm .= "\n<!-- begin formconfirm page=" . dol_escape_htmltag($page) . " -->\n"; |
|
5551
|
+ $formconfirm .= "\n<!-- begin formconfirm page=".dol_escape_htmltag($page)." -->\n"; |
5552
|
5552
|
|
5553
|
5553
|
if (empty($disableformtag)) { |
5554
|
|
- $formconfirm .= '<form method="POST" action="' . $page . '" class="notoptoleftroright">' . "\n"; |
|
5554
|
+ $formconfirm .= '<form method="POST" action="'.$page.'" class="notoptoleftroright">'."\n"; |
5555
|
5555
|
} |
5556
|
5556
|
|
5557
|
|
- $formconfirm .= '<input type="hidden" name="action" value="' . $action . '">' . "\n"; |
5558
|
|
- $formconfirm .= '<input type="hidden" name="token" value="' . newToken() . '">' . "\n"; |
|
5557
|
+ $formconfirm .= '<input type="hidden" name="action" value="'.$action.'">'."\n"; |
|
5558
|
+ $formconfirm .= '<input type="hidden" name="token" value="'.newToken().'">'."\n"; |
5559
|
5559
|
|
5560
|
|
- $formconfirm .= '<table class="valid centpercent">' . "\n"; |
|
5560
|
+ $formconfirm .= '<table class="valid centpercent">'."\n"; |
5561
|
5561
|
|
5562
|
5562
|
// Line title |
5563
|
5563
|
$formconfirm .= '<tr class="validtitre"><td class="validtitre" colspan="2">'; |
5564
|
|
- $formconfirm .= img_picto('', 'pictoconfirm') . ' ' . $title; |
5565
|
|
- $formconfirm .= '</td></tr>' . "\n"; |
|
5564
|
+ $formconfirm .= img_picto('', 'pictoconfirm').' '.$title; |
|
5565
|
+ $formconfirm .= '</td></tr>'."\n"; |
5566
|
5566
|
|
5567
|
5567
|
// Line text |
5568
|
5568
|
if (is_array($formquestion) && !empty($formquestion['text'])) { |
5569
|
|
- $formconfirm .= '<tr class="valid"><td class="valid" colspan="2">' . $formquestion['text'] . '</td></tr>' . "\n"; |
|
5569
|
+ $formconfirm .= '<tr class="valid"><td class="valid" colspan="2">'.$formquestion['text'].'</td></tr>'."\n"; |
5570
|
5570
|
} |
5571
|
5571
|
|
5572
|
5572
|
// Line form fields |
5573
|
5573
|
if ($more) { |
5574
|
|
- $formconfirm .= '<tr class="valid"><td class="valid" colspan="2">' . "\n"; |
|
5574
|
+ $formconfirm .= '<tr class="valid"><td class="valid" colspan="2">'."\n"; |
5575
|
5575
|
$formconfirm .= $more; |
5576
|
|
- $formconfirm .= '</td></tr>' . "\n"; |
|
5576
|
+ $formconfirm .= '</td></tr>'."\n"; |
5577
|
5577
|
} |
5578
|
5578
|
|
5579
|
5579
|
// Line with question |
5580
|
5580
|
$formconfirm .= '<tr class="valid">'; |
5581
|
|
- $formconfirm .= '<td class="valid">' . $question . '</td>'; |
|
5581
|
+ $formconfirm .= '<td class="valid">'.$question.'</td>'; |
5582
|
5582
|
$formconfirm .= '<td class="valid center">'; |
5583
|
5583
|
$formconfirm .= $this->selectyesno("confirm", $newselectedchoice, 0, false, 0, 0, 'marginleftonly marginrightonly', $labelbuttonyes, $labelbuttonno); |
5584
|
|
- $formconfirm .= '<input class="button valignmiddle confirmvalidatebutton small" type="submit" value="' . $langs->trans("Validate") . '">'; |
|
5584
|
+ $formconfirm .= '<input class="button valignmiddle confirmvalidatebutton small" type="submit" value="'.$langs->trans("Validate").'">'; |
5585
|
5585
|
$formconfirm .= '</td>'; |
5586
|
|
- $formconfirm .= '</tr>' . "\n"; |
|
5586
|
+ $formconfirm .= '</tr>'."\n"; |
5587
|
5587
|
|
5588
|
|
- $formconfirm .= '</table>' . "\n"; |
|
5588
|
+ $formconfirm .= '</table>'."\n"; |
5589
|
5589
|
|
5590
|
5590
|
if (empty($disableformtag)) { |
5591
|
5591
|
$formconfirm .= "</form>\n"; |
|
@@ -5594,7 +5594,7 @@ discard block |
|
|
block discarded – undo |
5594
|
5594
|
|
5595
|
5595
|
if (!empty($conf->use_javascript_ajax)) { |
5596
|
5596
|
$formconfirm .= '<!-- code to disable button to avoid double clic -->'; |
5597
|
|
- $formconfirm .= '<script nonce="' . getNonce() . '" type="text/javascript">' . "\n"; |
|
5597
|
+ $formconfirm .= '<script nonce="'.getNonce().'" type="text/javascript">'."\n"; |
5598
|
5598
|
$formconfirm .= ' |
5599
|
5599
|
$(document).ready(function () { |
5600
|
5600
|
$(".confirmvalidatebutton").on("click", function() { |
|
@@ -5606,7 +5606,7 @@ discard block |
|
|
block discarded – undo |
5606
|
5606
|
}); |
5607
|
5607
|
}); |
5608
|
5608
|
'; |
5609
|
|
- $formconfirm .= '</script>' . "\n"; |
|
5609
|
+ $formconfirm .= '</script>'."\n"; |
5610
|
5610
|
} |
5611
|
5611
|
|
5612
|
5612
|
$formconfirm .= "<!-- end formconfirm -->\n"; |
|
@@ -5638,8 +5638,8 @@ discard block |
|
|
block discarded – undo |
5638
|
5638
|
// phpcs:enable |
5639
|
5639
|
global $langs; |
5640
|
5640
|
|
5641
|
|
- require_once DOL_DOCUMENT_ROOT . '/core/lib/project.lib.php'; |
5642
|
|
- require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php'; |
|
5641
|
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php'; |
|
5642
|
+ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; |
5643
|
5643
|
|
5644
|
5644
|
$out = ''; |
5645
|
5645
|
|
|
@@ -5647,11 +5647,11 @@ discard block |
|
|
block discarded – undo |
5647
|
5647
|
|
5648
|
5648
|
$langs->load("project"); |
5649
|
5649
|
if ($htmlname != "none") { |
5650
|
|
- $out .= '<form method="post" action="' . $page . '">'; |
|
5650
|
+ $out .= '<form method="post" action="'.$page.'">'; |
5651
|
5651
|
$out .= '<input type="hidden" name="action" value="classin">'; |
5652
|
|
- $out .= '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
5652
|
+ $out .= '<input type="hidden" name="token" value="'.newToken().'">'; |
5653
|
5653
|
$out .= $formproject->select_projects($socid, $selected, $htmlname, $maxlength, 0, 1, $discard_closed, $forcefocus, 0, 0, '', 1, 0, $morecss); |
5654
|
|
- $out .= '<input type="submit" class="button smallpaddingimp" value="' . $langs->trans("Modify") . '">'; |
|
5654
|
+ $out .= '<input type="submit" class="button smallpaddingimp" value="'.$langs->trans("Modify").'">'; |
5655
|
5655
|
$out .= '</form>'; |
5656
|
5656
|
} else { |
5657
|
5657
|
$out .= '<span class="project_head_block">'; |
|
@@ -5660,7 +5660,7 @@ discard block |
|
|
block discarded – undo |
5660
|
5660
|
$projet->fetch($selected); |
5661
|
5661
|
$out .= $projet->getNomUrl(0, '', 1); |
5662
|
5662
|
} else { |
5663
|
|
- $out .= '<span class="opacitymedium">' . $textifnoproject . '</span>'; |
|
5663
|
+ $out .= '<span class="opacitymedium">'.$textifnoproject.'</span>'; |
5664
|
5664
|
} |
5665
|
5665
|
$out .= '</span>'; |
5666
|
5666
|
} |
|
@@ -5697,14 +5697,14 @@ discard block |
|
|
block discarded – undo |
5697
|
5697
|
$out = ''; |
5698
|
5698
|
|
5699
|
5699
|
if ($htmlname != "none") { |
5700
|
|
- $out .= '<form method="POST" action="' . $page . '">'; |
|
5700
|
+ $out .= '<form method="POST" action="'.$page.'">'; |
5701
|
5701
|
$out .= '<input type="hidden" name="action" value="setconditions">'; |
5702
|
|
- $out .= '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
5702
|
+ $out .= '<input type="hidden" name="token" value="'.newToken().'">'; |
5703
|
5703
|
if ($type) { |
5704
|
|
- $out .= '<input type="hidden" name="type" value="' . dol_escape_htmltag($type) . '">'; |
|
5704
|
+ $out .= '<input type="hidden" name="type" value="'.dol_escape_htmltag($type).'">'; |
5705
|
5705
|
} |
5706
|
5706
|
$out .= $this->getSelectConditionsPaiements($selected, $htmlname, $filtertype, $addempty, 0, '', $deposit_percent); |
5707
|
|
- $out .= '<input type="submit" class="button valignmiddle smallpaddingimp" value="' . $langs->trans("Modify") . '">'; |
|
5707
|
+ $out .= '<input type="submit" class="button valignmiddle smallpaddingimp" value="'.$langs->trans("Modify").'">'; |
5708
|
5708
|
$out .= '</form>'; |
5709
|
5709
|
} else { |
5710
|
5710
|
if ($selected) { |
|
@@ -5749,12 +5749,12 @@ discard block |
|
|
block discarded – undo |
5749
|
5749
|
// phpcs:enable |
5750
|
5750
|
global $langs; |
5751
|
5751
|
if ($htmlname != "none") { |
5752
|
|
- print '<form method="post" action="' . $page . '">'; |
|
5752
|
+ print '<form method="post" action="'.$page.'">'; |
5753
|
5753
|
print '<input type="hidden" name="action" value="setavailability">'; |
5754
|
|
- print '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
5754
|
+ print '<input type="hidden" name="token" value="'.newToken().'">'; |
5755
|
5755
|
$this->selectAvailabilityDelay($selected, $htmlname, -1, $addempty); |
5756
|
|
- print '<input type="submit" name="modify" class="button smallpaddingimp" value="' . $langs->trans("Modify") . '">'; |
5757
|
|
- print '<input type="submit" name="cancel" class="button smallpaddingimp" value="' . $langs->trans("Cancel") . '">'; |
|
5756
|
+ print '<input type="submit" name="modify" class="button smallpaddingimp" value="'.$langs->trans("Modify").'">'; |
|
5757
|
+ print '<input type="submit" name="cancel" class="button smallpaddingimp" value="'.$langs->trans("Cancel").'">'; |
5758
|
5758
|
print '</form>'; |
5759
|
5759
|
} else { |
5760
|
5760
|
if ($selected) { |
|
@@ -5780,11 +5780,11 @@ discard block |
|
|
block discarded – undo |
5780
|
5780
|
{ |
5781
|
5781
|
global $langs; |
5782
|
5782
|
if ($htmlname != "none") { |
5783
|
|
- print '<form method="post" action="' . $page . '">'; |
|
5783
|
+ print '<form method="post" action="'.$page.'">'; |
5784
|
5784
|
print '<input type="hidden" name="action" value="setdemandreason">'; |
5785
|
|
- print '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
5785
|
+ print '<input type="hidden" name="token" value="'.newToken().'">'; |
5786
|
5786
|
$this->selectInputReason($selected, $htmlname, -1, $addempty); |
5787
|
|
- print '<input type="submit" class="button smallpaddingimp" value="' . $langs->trans("Modify") . '">'; |
|
5787
|
+ print '<input type="submit" class="button smallpaddingimp" value="'.$langs->trans("Modify").'">'; |
5788
|
5788
|
print '</form>'; |
5789
|
5789
|
} else { |
5790
|
5790
|
if ($selected) { |
|
@@ -5824,17 +5824,17 @@ discard block |
|
|
block discarded – undo |
5824
|
5824
|
$ret = ''; |
5825
|
5825
|
|
5826
|
5826
|
if ($htmlname != "none") { |
5827
|
|
- $ret .= '<form method="POST" action="' . $page . '" name="form' . $htmlname . '">'; |
5828
|
|
- $ret .= '<input type="hidden" name="action" value="set' . $htmlname . '">'; |
5829
|
|
- $ret .= '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
5827
|
+ $ret .= '<form method="POST" action="'.$page.'" name="form'.$htmlname.'">'; |
|
5828
|
+ $ret .= '<input type="hidden" name="action" value="set'.$htmlname.'">'; |
|
5829
|
+ $ret .= '<input type="hidden" name="token" value="'.newToken().'">'; |
5830
|
5830
|
if ($type) { |
5831
|
|
- $ret .= '<input type="hidden" name="type" value="' . dol_escape_htmltag($type) . '">'; |
|
5831
|
+ $ret .= '<input type="hidden" name="type" value="'.dol_escape_htmltag($type).'">'; |
5832
|
5832
|
} |
5833
|
5833
|
$ret .= '<table class="nobordernopadding">'; |
5834
|
5834
|
$ret .= '<tr><td>'; |
5835
|
|
- $ret .= $this->selectDate($selected, $htmlname, $displayhour, $displaymin, 1, 'form' . $htmlname, 1, 0); |
|
5835
|
+ $ret .= $this->selectDate($selected, $htmlname, $displayhour, $displaymin, 1, 'form'.$htmlname, 1, 0); |
5836
|
5836
|
$ret .= '</td>'; |
5837
|
|
- $ret .= '<td class="left"><input type="submit" class="button smallpaddingimp" value="' . $langs->trans("Modify") . '"></td>'; |
|
5837
|
+ $ret .= '<td class="left"><input type="submit" class="button smallpaddingimp" value="'.$langs->trans("Modify").'"></td>'; |
5838
|
5838
|
$ret .= '</tr></table></form>'; |
5839
|
5839
|
} else { |
5840
|
5840
|
if ($displayhour) { |
|
@@ -5869,15 +5869,15 @@ discard block |
|
|
block discarded – undo |
5869
|
5869
|
global $langs; |
5870
|
5870
|
|
5871
|
5871
|
if ($htmlname != "none") { |
5872
|
|
- print '<form method="POST" action="' . $page . '" name="form' . $htmlname . '">'; |
5873
|
|
- print '<input type="hidden" name="action" value="set' . $htmlname . '">'; |
5874
|
|
- print '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
5872
|
+ print '<form method="POST" action="'.$page.'" name="form'.$htmlname.'">'; |
|
5873
|
+ print '<input type="hidden" name="action" value="set'.$htmlname.'">'; |
|
5874
|
+ print '<input type="hidden" name="token" value="'.newToken().'">'; |
5875
|
5875
|
print $this->select_dolusers($selected, $htmlname, 1, $exclude, 0, $include); |
5876
|
|
- print '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">'; |
|
5876
|
+ print '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">'; |
5877
|
5877
|
print '</form>'; |
5878
|
5878
|
} else { |
5879
|
5879
|
if ($selected) { |
5880
|
|
- require_once DOL_DOCUMENT_ROOT . '/user/class/user.class.php'; |
|
5880
|
+ require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; |
5881
|
5881
|
$theuser = new User($this->db); |
5882
|
5882
|
$theuser->fetch($selected); |
5883
|
5883
|
print $theuser->getNomUrl(1); |
|
@@ -5910,14 +5910,14 @@ discard block |
|
|
block discarded – undo |
5910
|
5910
|
|
5911
|
5911
|
$out = ''; |
5912
|
5912
|
if ($htmlname != "none") { |
5913
|
|
- $out .= '<form method="POST" action="' . $page . '">'; |
|
5913
|
+ $out .= '<form method="POST" action="'.$page.'">'; |
5914
|
5914
|
$out .= '<input type="hidden" name="action" value="setmode">'; |
5915
|
|
- $out .= '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
5915
|
+ $out .= '<input type="hidden" name="token" value="'.newToken().'">'; |
5916
|
5916
|
if ($type) { |
5917
|
|
- $out .= '<input type="hidden" name="type" value="' . dol_escape_htmltag($type) . '">'; |
|
5917
|
+ $out .= '<input type="hidden" name="type" value="'.dol_escape_htmltag($type).'">'; |
5918
|
5918
|
} |
5919
|
5919
|
$out .= $this->select_types_paiements($selected, $htmlname, $filtertype, 0, $addempty, 0, 0, $active, '', 1); |
5920
|
|
- $out .= '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">'; |
|
5920
|
+ $out .= '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">'; |
5921
|
5921
|
$out .= '</form>'; |
5922
|
5922
|
} else { |
5923
|
5923
|
if ($selected) { |
|
@@ -5950,11 +5950,11 @@ discard block |
|
|
block discarded – undo |
5950
|
5950
|
{ |
5951
|
5951
|
global $langs; |
5952
|
5952
|
if ($htmlname != "none") { |
5953
|
|
- print '<form method="POST" action="' . $page . '">'; |
|
5953
|
+ print '<form method="POST" action="'.$page.'">'; |
5954
|
5954
|
print '<input type="hidden" name="action" value="settransportmode">'; |
5955
|
|
- print '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
5955
|
+ print '<input type="hidden" name="token" value="'.newToken().'">'; |
5956
|
5956
|
$this->selectTransportMode($selected, $htmlname, 0, $addempty, 0, 0, $active); |
5957
|
|
- print '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">'; |
|
5957
|
+ print '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">'; |
5958
|
5958
|
print '</form>'; |
5959
|
5959
|
} else { |
5960
|
5960
|
if ($selected) { |
|
@@ -5981,11 +5981,11 @@ discard block |
|
|
block discarded – undo |
5981
|
5981
|
// phpcs:enable |
5982
|
5982
|
global $langs; |
5983
|
5983
|
if ($htmlname != "none") { |
5984
|
|
- print '<form method="POST" action="' . $page . '">'; |
|
5984
|
+ print '<form method="POST" action="'.$page.'">'; |
5985
|
5985
|
print '<input type="hidden" name="action" value="setmulticurrencycode">'; |
5986
|
|
- print '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
5986
|
+ print '<input type="hidden" name="token" value="'.newToken().'">'; |
5987
|
5987
|
print $this->selectMultiCurrency($selected, $htmlname, 0); |
5988
|
|
- print '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">'; |
|
5988
|
+ print '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">'; |
5989
|
5989
|
print '</form>'; |
5990
|
5990
|
} else { |
5991
|
5991
|
dol_include_once('/core/lib/company.lib.php'); |
|
@@ -6010,21 +6010,21 @@ discard block |
|
|
block discarded – undo |
6010
|
6010
|
global $langs, $mysoc, $conf; |
6011
|
6011
|
|
6012
|
6012
|
if ($htmlname != "none") { |
6013
|
|
- print '<form method="POST" action="' . $page . '">'; |
|
6013
|
+ print '<form method="POST" action="'.$page.'">'; |
6014
|
6014
|
print '<input type="hidden" name="action" value="setmulticurrencyrate">'; |
6015
|
|
- print '<input type="hidden" name="token" value="' . newToken() . '">'; |
6016
|
|
- print '<input type="text" class="maxwidth100" name="' . $htmlname . '" value="' . (!empty($rate) ? price(price2num($rate, 'CU')) : 1) . '" /> '; |
|
6015
|
+ print '<input type="hidden" name="token" value="'.newToken().'">'; |
|
6016
|
+ print '<input type="text" class="maxwidth100" name="'.$htmlname.'" value="'.(!empty($rate) ? price(price2num($rate, 'CU')) : 1).'" /> '; |
6017
|
6017
|
print '<select name="calculation_mode">'; |
6018
|
|
- print '<option value="1">Change ' . $langs->trans("PriceUHT") . ' of lines</option>'; |
6019
|
|
- print '<option value="2">Change ' . $langs->trans("PriceUHTCurrency") . ' of lines</option>'; |
|
6018
|
+ print '<option value="1">Change '.$langs->trans("PriceUHT").' of lines</option>'; |
|
6019
|
+ print '<option value="2">Change '.$langs->trans("PriceUHTCurrency").' of lines</option>'; |
6020
|
6020
|
print '</select> '; |
6021
|
|
- print '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">'; |
|
6021
|
+ print '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">'; |
6022
|
6022
|
print '</form>'; |
6023
|
6023
|
} else { |
6024
|
6024
|
if (!empty($rate)) { |
6025
|
6025
|
print price($rate, 1, $langs, 1, 0); |
6026
|
6026
|
if ($currency && $rate != 1) { |
6027
|
|
- print ' (' . price($rate, 1, $langs, 1, 0) . ' ' . $currency . ' = 1 ' . $conf->currency . ')'; |
|
6027
|
+ print ' ('.price($rate, 1, $langs, 1, 0).' '.$currency.' = 1 '.$conf->currency.')'; |
6028
|
6028
|
} |
6029
|
6029
|
} else { |
6030
|
6030
|
print 1; |
|
@@ -6055,9 +6055,9 @@ discard block |
|
|
block discarded – undo |
6055
|
6055
|
// phpcs:enable |
6056
|
6056
|
global $conf, $langs; |
6057
|
6057
|
if ($htmlname != "none") { |
6058
|
|
- print '<form method="post" action="' . $page . '">'; |
|
6058
|
+ print '<form method="post" action="'.$page.'">'; |
6059
|
6059
|
print '<input type="hidden" name="action" value="setabsolutediscount">'; |
6060
|
|
- print '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
6060
|
+ print '<input type="hidden" name="token" value="'.newToken().'">'; |
6061
|
6061
|
print '<div class="inline-block">'; |
6062
|
6062
|
if (!empty($discount_type)) { |
6063
|
6063
|
if (getDolGlobalString('FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS')) { |
|
@@ -6095,24 +6095,24 @@ discard block |
|
|
block discarded – undo |
6095
|
6095
|
print '</div>'; |
6096
|
6096
|
if (empty($hidelist)) { |
6097
|
6097
|
print '<div class="inline-block" style="padding-right: 10px">'; |
6098
|
|
- $newfilter = 'discount_type=' . intval($discount_type); |
|
6098
|
+ $newfilter = 'discount_type='.intval($discount_type); |
6099
|
6099
|
if (!empty($discount_type)) { |
6100
|
6100
|
$newfilter .= ' AND fk_invoice_supplier IS NULL AND fk_invoice_supplier_line IS NULL'; // Supplier discounts available |
6101
|
6101
|
} else { |
6102
|
6102
|
$newfilter .= ' AND fk_facture IS NULL AND fk_facture_line IS NULL'; // Customer discounts available |
6103
|
6103
|
} |
6104
|
6104
|
if ($filter) { |
6105
|
|
- $newfilter .= ' AND (' . $filter . ')'; |
|
6105
|
+ $newfilter .= ' AND ('.$filter.')'; |
6106
|
6106
|
} |
6107
|
6107
|
// output the combo of discounts |
6108
|
6108
|
$nbqualifiedlines = $this->select_remises($selected, $htmlname, $newfilter, $socid, $maxvalue); |
6109
|
6109
|
if ($nbqualifiedlines > 0) { |
6110
|
|
- print ' <input type="submit" class="button smallpaddingimp" value="' . dol_escape_htmltag($langs->trans("UseLine")) . '"'; |
|
6110
|
+ print ' <input type="submit" class="button smallpaddingimp" value="'.dol_escape_htmltag($langs->trans("UseLine")).'"'; |
6111
|
6111
|
if (!empty($discount_type) && $filter && $filter != "fk_invoice_supplier_source IS NULL OR (description LIKE '(DEPOSIT)%' AND description NOT LIKE '(EXCESS PAID)%')") { |
6112
|
|
- print ' title="' . $langs->trans("UseCreditNoteInInvoicePayment") . '"'; |
|
6112
|
+ print ' title="'.$langs->trans("UseCreditNoteInInvoicePayment").'"'; |
6113
|
6113
|
} |
6114
|
6114
|
if (empty($discount_type) && $filter && $filter != "fk_facture_source IS NULL OR (description LIKE '(DEPOSIT)%' AND description NOT LIKE '(EXCESS RECEIVED)%')") { |
6115
|
|
- print ' title="' . $langs->trans("UseCreditNoteInInvoicePayment") . '"'; |
|
6115
|
+ print ' title="'.$langs->trans("UseCreditNoteInInvoicePayment").'"'; |
6116
|
6116
|
} |
6117
|
6117
|
|
6118
|
6118
|
print '>'; |
|
@@ -6152,23 +6152,23 @@ discard block |
|
|
block discarded – undo |
6152
|
6152
|
global $langs, $conf; |
6153
|
6153
|
|
6154
|
6154
|
if ($htmlname != "none") { |
6155
|
|
- print '<form method="post" action="' . $page . '">'; |
|
6155
|
+ print '<form method="post" action="'.$page.'">'; |
6156
|
6156
|
print '<input type="hidden" name="action" value="set_contact">'; |
6157
|
|
- print '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
6157
|
+ print '<input type="hidden" name="token" value="'.newToken().'">'; |
6158
|
6158
|
print '<table class="nobordernopadding">'; |
6159
|
6159
|
print '<tr><td>'; |
6160
|
6160
|
print $this->selectcontacts($societe->id, $selected, $htmlname); |
6161
|
6161
|
$num = $this->num; |
6162
|
6162
|
if ($num == 0) { |
6163
|
6163
|
$addcontact = (getDolGlobalString('SOCIETE_ADDRESSES_MANAGEMENT') ? $langs->trans("AddContact") : $langs->trans("AddContactAddress")); |
6164
|
|
- print '<a href="' . DOL_URL_ROOT . '/contact/card.php?socid=' . $societe->id . '&action=create&backtoreferer=1">' . $addcontact . '</a>'; |
|
6164
|
+ print '<a href="'.DOL_URL_ROOT.'/contact/card.php?socid='.$societe->id.'&action=create&backtoreferer=1">'.$addcontact.'</a>'; |
6165
|
6165
|
} |
6166
|
6166
|
print '</td>'; |
6167
|
|
- print '<td class="left"><input type="submit" class="button smallpaddingimp" value="' . $langs->trans("Modify") . '"></td>'; |
|
6167
|
+ print '<td class="left"><input type="submit" class="button smallpaddingimp" value="'.$langs->trans("Modify").'"></td>'; |
6168
|
6168
|
print '</tr></table></form>'; |
6169
|
6169
|
} else { |
6170
|
6170
|
if ($selected) { |
6171
|
|
- require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php'; |
|
6171
|
+ require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; |
6172
|
6172
|
$contact = new Contact($this->db); |
6173
|
6173
|
$contact->fetch($selected); |
6174
|
6174
|
print $contact->getFullName($langs); |
|
@@ -6203,20 +6203,20 @@ discard block |
|
|
block discarded – undo |
6203
|
6203
|
|
6204
|
6204
|
$out = ''; |
6205
|
6205
|
if ($htmlname != "none") { |
6206
|
|
- $out .= '<form method="post" action="' . $page . '">'; |
|
6206
|
+ $out .= '<form method="post" action="'.$page.'">'; |
6207
|
6207
|
$out .= '<input type="hidden" name="action" value="set_thirdparty">'; |
6208
|
|
- $out .= '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
6208
|
+ $out .= '<input type="hidden" name="token" value="'.newToken().'">'; |
6209
|
6209
|
$out .= $this->select_company($selected, $htmlname, $filter, $showempty, $showtype, $forcecombo, $events, 0, 'minwidth100', '', '', 1, array(), false, $excludeids); |
6210
|
|
- $out .= '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">'; |
|
6210
|
+ $out .= '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">'; |
6211
|
6211
|
$out .= '</form>'; |
6212
|
6212
|
} else { |
6213
|
6213
|
if ($selected) { |
6214
|
|
- require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; |
|
6214
|
+ require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; |
6215
|
6215
|
$soc = new Societe($this->db); |
6216
|
6216
|
$soc->fetch($selected); |
6217
|
6217
|
$out .= $soc->getNomUrl(0, ''); |
6218
|
6218
|
} else { |
6219
|
|
- $out .= '<span class="opacitymedium">' . $textifnothirdparty . '</span>'; |
|
6219
|
+ $out .= '<span class="opacitymedium">'.$textifnothirdparty.'</span>'; |
6220
|
6220
|
} |
6221
|
6221
|
} |
6222
|
6222
|
|
|
@@ -6266,22 +6266,22 @@ discard block |
|
|
block discarded – undo |
6266
|
6266
|
$selected = 'EUR'; // Pour compatibilite |
6267
|
6267
|
} |
6268
|
6268
|
|
6269
|
|
- $out .= '<select class="flat maxwidth200onsmartphone minwidth300" name="' . $htmlname . '" id="' . $htmlname . '">'; |
|
6269
|
+ $out .= '<select class="flat maxwidth200onsmartphone minwidth300" name="'.$htmlname.'" id="'.$htmlname.'">'; |
6270
|
6270
|
if ($useempty) { |
6271
|
6271
|
$out .= '<option value="-1" selected></option>'; |
6272
|
6272
|
} |
6273
|
6273
|
foreach ($langs->cache_currencies as $code_iso => $currency) { |
6274
|
6274
|
$labeltoshow = $currency['label']; |
6275
|
6275
|
if ($mode == 1) { |
6276
|
|
- $labeltoshow .= ' <span class="opacitymedium">(' . $code_iso . ')</span>'; |
|
6276
|
+ $labeltoshow .= ' <span class="opacitymedium">('.$code_iso.')</span>'; |
6277
|
6277
|
} else { |
6278
|
|
- $labeltoshow .= ' <span class="opacitymedium">(' . $langs->getCurrencySymbol($code_iso) . ')</span>'; |
|
6278
|
+ $labeltoshow .= ' <span class="opacitymedium">('.$langs->getCurrencySymbol($code_iso).')</span>'; |
6279
|
6279
|
} |
6280
|
6280
|
|
6281
|
6281
|
if ($selected && $selected == $code_iso) { |
6282
|
|
- $out .= '<option value="' . $code_iso . '" selected data-html="' . dol_escape_htmltag($labeltoshow) . '">'; |
|
6282
|
+ $out .= '<option value="'.$code_iso.'" selected data-html="'.dol_escape_htmltag($labeltoshow).'">'; |
6283
|
6283
|
} else { |
6284
|
|
- $out .= '<option value="' . $code_iso . '" data-html="' . dol_escape_htmltag($labeltoshow) . '">'; |
|
6284
|
+ $out .= '<option value="'.$code_iso.'" data-html="'.dol_escape_htmltag($labeltoshow).'">'; |
6285
|
6285
|
} |
6286
|
6286
|
$out .= $labeltoshow; |
6287
|
6287
|
$out .= '</option>'; |
|
@@ -6292,7 +6292,7 @@ discard block |
|
|
block discarded – undo |
6292
|
6292
|
} |
6293
|
6293
|
|
6294
|
6294
|
// Make select dynamic |
6295
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
6295
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
6296
|
6296
|
$out .= ajax_combobox($htmlname); |
6297
|
6297
|
|
6298
|
6298
|
return $out; |
|
@@ -6318,10 +6318,10 @@ discard block |
|
|
block discarded – undo |
6318
|
6318
|
|
6319
|
6319
|
$TCurrency = array(); |
6320
|
6320
|
|
6321
|
|
- $sql = "SELECT code FROM " . $this->db->prefix() . "multicurrency"; |
6322
|
|
- $sql .= " WHERE entity IN ('" . getEntity('mutlicurrency') . "')"; |
|
6321
|
+ $sql = "SELECT code FROM ".$this->db->prefix()."multicurrency"; |
|
6322
|
+ $sql .= " WHERE entity IN ('".getEntity('mutlicurrency')."')"; |
6323
|
6323
|
if ($filter) { |
6324
|
|
- $sql .= " AND " . $filter; |
|
6324
|
+ $sql .= " AND ".$filter; |
6325
|
6325
|
} |
6326
|
6326
|
$resql = $this->db->query($sql); |
6327
|
6327
|
if ($resql) { |
|
@@ -6331,7 +6331,7 @@ discard block |
|
|
block discarded – undo |
6331
|
6331
|
} |
6332
|
6332
|
|
6333
|
6333
|
$out = ''; |
6334
|
|
- $out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">'; |
|
6334
|
+ $out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">'; |
6335
|
6335
|
if ($useempty) { |
6336
|
6336
|
$out .= '<option value=""> </option>'; |
6337
|
6337
|
} |
|
@@ -6343,13 +6343,13 @@ discard block |
|
|
block discarded – undo |
6343
|
6343
|
foreach ($langs->cache_currencies as $code_iso => $currency) { |
6344
|
6344
|
if (isset($TCurrency[$code_iso])) { |
6345
|
6345
|
if (!empty($selected) && $selected == $code_iso) { |
6346
|
|
- $out .= '<option value="' . $code_iso . '" selected="selected">'; |
|
6346
|
+ $out .= '<option value="'.$code_iso.'" selected="selected">'; |
6347
|
6347
|
} else { |
6348
|
|
- $out .= '<option value="' . $code_iso . '">'; |
|
6348
|
+ $out .= '<option value="'.$code_iso.'">'; |
6349
|
6349
|
} |
6350
|
6350
|
|
6351
|
6351
|
$out .= $currency['label']; |
6352
|
|
- $out .= ' (' . $langs->getCurrencySymbol($code_iso) . ')'; |
|
6352
|
+ $out .= ' ('.$langs->getCurrencySymbol($code_iso).')'; |
6353
|
6353
|
$out .= '</option>'; |
6354
|
6354
|
} |
6355
|
6355
|
} |
|
@@ -6358,7 +6358,7 @@ discard block |
|
|
block discarded – undo |
6358
|
6358
|
$out .= '</select>'; |
6359
|
6359
|
|
6360
|
6360
|
// Make select dynamic |
6361
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
6361
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
6362
|
6362
|
$out .= ajax_combobox($htmlname); |
6363
|
6363
|
|
6364
|
6364
|
return $out; |
|
@@ -6385,11 +6385,11 @@ discard block |
|
|
block discarded – undo |
6385
|
6385
|
dol_syslog(__METHOD__, LOG_DEBUG); |
6386
|
6386
|
|
6387
|
6387
|
$sql = "SELECT DISTINCT t.rowid, t.code, t.taux, t.localtax1, t.localtax1_type, t.localtax2, t.localtax2_type, t.recuperableonly"; |
6388
|
|
- $sql .= " FROM " . $this->db->prefix() . "c_tva as t, " . $this->db->prefix() . "c_country as c"; |
|
6388
|
+ $sql .= " FROM ".$this->db->prefix()."c_tva as t, ".$this->db->prefix()."c_country as c"; |
6389
|
6389
|
$sql .= " WHERE t.fk_pays = c.rowid"; |
6390
|
6390
|
$sql .= " AND t.active > 0"; |
6391
|
6391
|
$sql .= " AND t.entity IN (".getEntity('c_tva').")"; |
6392
|
|
- $sql .= " AND c.code IN (" . $this->db->sanitize($country_code, 1) . ")"; |
|
6392
|
+ $sql .= " AND c.code IN (".$this->db->sanitize($country_code, 1).")"; |
6393
|
6393
|
$sql .= " ORDER BY t.code ASC, t.taux ASC, t.recuperableonly ASC"; |
6394
|
6394
|
|
6395
|
6395
|
$resql = $this->db->query($sql); |
|
@@ -6407,22 +6407,22 @@ discard block |
|
|
block discarded – undo |
6407
|
6407
|
$this->cache_vatrates[$i]['localtax2'] = $obj->localtax2; |
6408
|
6408
|
$this->cache_vatrates[$i]['localtax2_type'] = $obj->localtax1_type; |
6409
|
6409
|
|
6410
|
|
- $this->cache_vatrates[$i]['label'] = $obj->taux . '%' . ($obj->code ? ' (' . $obj->code . ')' : ''); // Label must contains only 0-9 , . % or * |
6411
|
|
- $this->cache_vatrates[$i]['labelallrates'] = $obj->taux . '/' . ($obj->localtax1 ? $obj->localtax1 : '0') . '/' . ($obj->localtax2 ? $obj->localtax2 : '0') . ($obj->code ? ' (' . $obj->code . ')' : ''); // Must never be used as key, only label |
|
6410
|
+ $this->cache_vatrates[$i]['label'] = $obj->taux.'%'.($obj->code ? ' ('.$obj->code.')' : ''); // Label must contains only 0-9 , . % or * |
|
6411
|
+ $this->cache_vatrates[$i]['labelallrates'] = $obj->taux.'/'.($obj->localtax1 ? $obj->localtax1 : '0').'/'.($obj->localtax2 ? $obj->localtax2 : '0').($obj->code ? ' ('.$obj->code.')' : ''); // Must never be used as key, only label |
6412
|
6412
|
$positiverates = ''; |
6413
|
6413
|
if ($obj->taux) { |
6414
|
|
- $positiverates .= ($positiverates ? '/' : '') . $obj->taux; |
|
6414
|
+ $positiverates .= ($positiverates ? '/' : '').$obj->taux; |
6415
|
6415
|
} |
6416
|
6416
|
if ($obj->localtax1) { |
6417
|
|
- $positiverates .= ($positiverates ? '/' : '') . $obj->localtax1; |
|
6417
|
+ $positiverates .= ($positiverates ? '/' : '').$obj->localtax1; |
6418
|
6418
|
} |
6419
|
6419
|
if ($obj->localtax2) { |
6420
|
|
- $positiverates .= ($positiverates ? '/' : '') . $obj->localtax2; |
|
6420
|
+ $positiverates .= ($positiverates ? '/' : '').$obj->localtax2; |
6421
|
6421
|
} |
6422
|
6422
|
if (empty($positiverates)) { |
6423
|
6423
|
$positiverates = '0'; |
6424
|
6424
|
} |
6425
|
|
- $this->cache_vatrates[$i]['labelpositiverates'] = $positiverates . ($obj->code ? ' (' . $obj->code . ')' : ''); // Must never be used as key, only label |
|
6425
|
+ $this->cache_vatrates[$i]['labelpositiverates'] = $positiverates.($obj->code ? ' ('.$obj->code.')' : ''); // Must never be used as key, only label |
6426
|
6426
|
} |
6427
|
6427
|
|
6428
|
6428
|
return $num; |
|
@@ -6440,7 +6440,7 @@ discard block |
|
|
block discarded – undo |
6440
|
6440
|
return -1; |
6441
|
6441
|
} |
6442
|
6442
|
} else { |
6443
|
|
- $this->error = '<span class="error">' . $this->db->error() . '</span>'; |
|
6443
|
+ $this->error = '<span class="error">'.$this->db->error().'</span>'; |
6444
|
6444
|
return -2; |
6445
|
6445
|
} |
6446
|
6446
|
} |
|
@@ -6492,9 +6492,9 @@ discard block |
|
|
block discarded – undo |
6492
|
6492
|
// Check parameters |
6493
|
6493
|
if (is_object($societe_vendeuse) && !$societe_vendeuse->country_code) { |
6494
|
6494
|
if ($societe_vendeuse->id == $mysoc->id) { |
6495
|
|
- $return .= '<span class="error">' . $langs->trans("ErrorYourCountryIsNotDefined") . '</span>'; |
|
6495
|
+ $return .= '<span class="error">'.$langs->trans("ErrorYourCountryIsNotDefined").'</span>'; |
6496
|
6496
|
} else { |
6497
|
|
- $return .= '<span class="error">' . $langs->trans("ErrorSupplierCountryIsNotDefined") . '</span>'; |
|
6497
|
+ $return .= '<span class="error">'.$langs->trans("ErrorSupplierCountryIsNotDefined").'</span>'; |
6498
|
6498
|
} |
6499
|
6499
|
return $return; |
6500
|
6500
|
} |
|
@@ -6506,25 +6506,25 @@ discard block |
|
|
block discarded – undo |
6506
|
6506
|
// Define list of countries to use to search VAT rates to show |
6507
|
6507
|
// First we defined code_country to use to find list |
6508
|
6508
|
if (is_object($societe_vendeuse)) { |
6509
|
|
- $code_country = "'" . $societe_vendeuse->country_code . "'"; |
|
6509
|
+ $code_country = "'".$societe_vendeuse->country_code."'"; |
6510
|
6510
|
} else { |
6511
|
|
- $code_country = "'" . $mysoc->country_code . "'"; // Pour compatibilite ascendente |
|
6511
|
+ $code_country = "'".$mysoc->country_code."'"; // Pour compatibilite ascendente |
6512
|
6512
|
} |
6513
|
6513
|
if (getDolGlobalString('SERVICE_ARE_ECOMMERCE_200238EC')) { // If option to have vat for end customer for services is on |
6514
|
|
- require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php'; |
|
6514
|
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; |
6515
|
6515
|
if (!isInEEC($societe_vendeuse) && (!is_object($societe_acheteuse) || (isInEEC($societe_acheteuse) && !$societe_acheteuse->isACompany()))) { |
6516
|
6516
|
// We also add the buyer country code |
6517
|
6517
|
if (is_numeric($type)) { |
6518
|
6518
|
if ($type == 1) { // We know product is a service |
6519
|
|
- $code_country .= ",'" . $societe_acheteuse->country_code . "'"; |
|
6519
|
+ $code_country .= ",'".$societe_acheteuse->country_code."'"; |
6520
|
6520
|
} |
6521
|
6521
|
} elseif (!$idprod) { // We don't know type of product |
6522
|
|
- $code_country .= ",'" . $societe_acheteuse->country_code . "'"; |
|
6522
|
+ $code_country .= ",'".$societe_acheteuse->country_code."'"; |
6523
|
6523
|
} else { |
6524
|
6524
|
$prodstatic = new Product($this->db); |
6525
|
6525
|
$prodstatic->fetch($idprod); |
6526
|
6526
|
if ($prodstatic->type == Product::TYPE_SERVICE) { // We know product is a service |
6527
|
|
- $code_country .= ",'" . $societe_acheteuse->country_code . "'"; |
|
6527
|
+ $code_country .= ",'".$societe_acheteuse->country_code."'"; |
6528
|
6528
|
} |
6529
|
6529
|
} |
6530
|
6530
|
} |
|
@@ -6576,13 +6576,13 @@ discard block |
|
|
block discarded – undo |
6576
|
6576
|
// Override/enable VAT for expense report regardless of global setting - needed if expense report used for business expenses instead |
6577
|
6577
|
// of using supplier invoices (this is a very bad idea !) |
6578
|
6578
|
if (!getDolGlobalString('EXPENSEREPORT_OVERRIDE_VAT')) { |
6579
|
|
- $title = ' title="' . dol_escape_htmltag($langs->trans('VATIsNotUsed')) . '"'; |
|
6579
|
+ $title = ' title="'.dol_escape_htmltag($langs->trans('VATIsNotUsed')).'"'; |
6580
|
6580
|
$disabled = true; |
6581
|
6581
|
} |
6582
|
6582
|
} |
6583
|
6583
|
|
6584
|
6584
|
if (!$options_only) { |
6585
|
|
- $return .= '<select class="flat minwidth50imp maxwidth100" id="' . $htmlname . '" name="' . $htmlname . '"' . ($disabled ? ' disabled' : '') . $title . '>'; |
|
6585
|
+ $return .= '<select class="flat minwidth50imp maxwidth100" id="'.$htmlname.'" name="'.$htmlname.'"'.($disabled ? ' disabled' : '').$title.'>'; |
6586
|
6586
|
} |
6587
|
6587
|
|
6588
|
6588
|
$selectedfound = false; |
|
@@ -6596,13 +6596,13 @@ discard block |
|
|
block discarded – undo |
6596
|
6596
|
$key = $rate['txtva']; |
6597
|
6597
|
$key .= $rate['nprtva'] ? '*' : ''; |
6598
|
6598
|
if ($mode > 0 && $rate['code']) { |
6599
|
|
- $key .= ' (' . $rate['code'] . ')'; |
|
6599
|
+ $key .= ' ('.$rate['code'].')'; |
6600
|
6600
|
} |
6601
|
6601
|
if ($mode < 0) { |
6602
|
6602
|
$key = $rate['rowid']; |
6603
|
6603
|
} |
6604
|
6604
|
|
6605
|
|
- $return .= '<option value="' . $key . '"'; |
|
6605
|
+ $return .= '<option value="'.$key.'"'; |
6606
|
6606
|
if (!$selectedfound) { |
6607
|
6607
|
if ($defaultcode) { // If defaultcode is defined, we used it in priority to select combo option instead of using rate+npr flag |
6608
|
6608
|
if ($defaultcode == $rate['code']) { |
|
@@ -6673,7 +6673,7 @@ discard block |
|
|
block discarded – undo |
6673
|
6673
|
public function select_date($set_time = '', $prefix = 're', $h = 0, $m = 0, $empty = 0, $form_name = "", $d = 1, $addnowlink = 0, $nooutput = 0, $disabled = 0, $fullday = '', $addplusone = '', $adddateof = '') |
6674
|
6674
|
{ |
6675
|
6675
|
// phpcs:enable |
6676
|
|
- dol_syslog(__METHOD__ . ': using select_date is deprecated. Use selectDate instead.', LOG_WARNING); |
|
6676
|
+ dol_syslog(__METHOD__.': using select_date is deprecated. Use selectDate instead.', LOG_WARNING); |
6677
|
6677
|
$retstring = $this->selectDate($set_time, $prefix, $h, $m, $empty, $form_name, $d, $addnowlink, $disabled, $fullday, $addplusone, $adddateof); |
6678
|
6678
|
if (!empty($nooutput)) { |
6679
|
6679
|
return $retstring; |
|
@@ -6702,11 +6702,11 @@ discard block |
|
|
block discarded – undo |
6702
|
6702
|
{ |
6703
|
6703
|
global $langs; |
6704
|
6704
|
|
6705
|
|
- $ret = $this->selectDate($set_time, $prefix . '_start', 0, 0, $empty, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("from"), 'tzuserrel'); |
|
6705
|
+ $ret = $this->selectDate($set_time, $prefix.'_start', 0, 0, $empty, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("from"), 'tzuserrel'); |
6706
|
6706
|
if ($forcenewline) { |
6707
|
6707
|
$ret .= '<br>'; |
6708
|
6708
|
} |
6709
|
|
- $ret .= $this->selectDate($set_time_end, $prefix . '_end', 0, 0, $empty, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"), 'tzuserrel'); |
|
6709
|
+ $ret .= $this->selectDate($set_time_end, $prefix.'_end', 0, 0, $empty, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"), 'tzuserrel'); |
6710
|
6710
|
return $ret; |
6711
|
6711
|
} |
6712
|
6712
|
|
|
@@ -6772,7 +6772,7 @@ discard block |
|
|
block discarded – undo |
6772
|
6772
|
$orig_set_time = $set_time; |
6773
|
6773
|
|
6774
|
6774
|
if ($set_time === '' && $emptydate == 0) { |
6775
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php'; |
|
6775
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; |
6776
|
6776
|
if ($gm == 'tzuser' || $gm == 'tzuserrel') { |
6777
|
6777
|
$set_time = dol_now($gm); |
6778
|
6778
|
} else { |
|
@@ -6840,38 +6840,38 @@ discard block |
|
|
block discarded – undo |
6840
|
6840
|
// Calendrier popup version eldy |
6841
|
6841
|
if ($usecalendar == "eldy") { |
6842
|
6842
|
// Input area to enter date manually |
6843
|
|
- $retstring .= '<input id="' . $prefix . '" name="' . $prefix . '" type="text" class="maxwidthdate" maxlength="11" value="' . $formated_date . '"'; |
|
6843
|
+ $retstring .= '<input id="'.$prefix.'" name="'.$prefix.'" type="text" class="maxwidthdate" maxlength="11" value="'.$formated_date.'"'; |
6844
|
6844
|
$retstring .= ($disabled ? ' disabled' : ''); |
6845
|
|
- $retstring .= ' onChange="dpChangeDay(\'' . $prefix . '\',\'' . $langs->trans("FormatDateShortJavaInput") . '\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript |
|
6845
|
+ $retstring .= ' onChange="dpChangeDay(\''.$prefix.'\',\''.$langs->trans("FormatDateShortJavaInput").'\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript |
6846
|
6846
|
$retstring .= '>'; |
6847
|
6847
|
|
6848
|
6848
|
// Icon calendar |
6849
|
6849
|
$retstringbuttom = ''; |
6850
|
6850
|
if (!$disabled) { |
6851
|
|
- $retstringbuttom = '<button id="' . $prefix . 'Button" type="button" class="dpInvisibleButtons"'; |
6852
|
|
- $base = DOL_URL_ROOT . '/core/'; |
6853
|
|
- $retstringbuttom .= ' onClick="showDP(\'' . $base . '\',\'' . $prefix . '\',\'' . $langs->trans("FormatDateShortJavaInput") . '\',\'' . $langs->defaultlang . '\');"'; |
6854
|
|
- $retstringbuttom .= '>' . img_object($langs->trans("SelectDate"), 'calendarday', 'class="datecallink"') . '</button>'; |
|
6851
|
+ $retstringbuttom = '<button id="'.$prefix.'Button" type="button" class="dpInvisibleButtons"'; |
|
6852
|
+ $base = DOL_URL_ROOT.'/core/'; |
|
6853
|
+ $retstringbuttom .= ' onClick="showDP(\''.$base.'\',\''.$prefix.'\',\''.$langs->trans("FormatDateShortJavaInput").'\',\''.$langs->defaultlang.'\');"'; |
|
6854
|
+ $retstringbuttom .= '>'.img_object($langs->trans("SelectDate"), 'calendarday', 'class="datecallink"').'</button>'; |
6855
|
6855
|
} else { |
6856
|
|
- $retstringbuttom = '<button id="' . $prefix . 'Button" type="button" class="dpInvisibleButtons">' . img_object($langs->trans("Disabled"), 'calendarday', 'class="datecallink"') . '</button>'; |
|
6856
|
+ $retstringbuttom = '<button id="'.$prefix.'Button" type="button" class="dpInvisibleButtons">'.img_object($langs->trans("Disabled"), 'calendarday', 'class="datecallink"').'</button>'; |
6857
|
6857
|
} |
6858
|
|
- $retstring = $retstringbuttom . $retstring; |
|
6858
|
+ $retstring = $retstringbuttom.$retstring; |
6859
|
6859
|
|
6860
|
|
- $retstring .= '<input type="hidden" id="' . $prefix . 'day" name="' . $prefix . 'day" value="' . $sday . '">' . "\n"; |
6861
|
|
- $retstring .= '<input type="hidden" id="' . $prefix . 'month" name="' . $prefix . 'month" value="' . $smonth . '">' . "\n"; |
6862
|
|
- $retstring .= '<input type="hidden" id="' . $prefix . 'year" name="' . $prefix . 'year" value="' . $syear . '">' . "\n"; |
|
6860
|
+ $retstring .= '<input type="hidden" id="'.$prefix.'day" name="'.$prefix.'day" value="'.$sday.'">'."\n"; |
|
6861
|
+ $retstring .= '<input type="hidden" id="'.$prefix.'month" name="'.$prefix.'month" value="'.$smonth.'">'."\n"; |
|
6862
|
+ $retstring .= '<input type="hidden" id="'.$prefix.'year" name="'.$prefix.'year" value="'.$syear.'">'."\n"; |
6863
|
6863
|
} elseif ($usecalendar == 'jquery') { |
6864
|
6864
|
if (!$disabled) { |
6865
|
6865
|
// Output javascript for datepicker |
6866
|
6866
|
$minYear = getDolGlobalInt('MIN_YEAR_SELECT_DATE', (date('Y') - 100)); |
6867
|
6867
|
$maxYear = getDolGlobalInt('MAX_YEAR_SELECT_DATE', (date('Y') + 100)); |
6868
|
6868
|
|
6869
|
|
- $retstring .= '<script nonce="' . getNonce() . '" type="text/javascript">'; |
6870
|
|
- $retstring .= "$(function(){ $('#" . $prefix . "').datepicker({ |
6871
|
|
- dateFormat: '" . $langs->trans("FormatDateShortJQueryInput") . "', |
|
6869
|
+ $retstring .= '<script nonce="'.getNonce().'" type="text/javascript">'; |
|
6870
|
+ $retstring .= "$(function(){ $('#".$prefix."').datepicker({ |
|
6871
|
+ dateFormat: '" . $langs->trans("FormatDateShortJQueryInput")."', |
6872
|
6872
|
autoclose: true, |
6873
|
6873
|
todayHighlight: true, |
6874
|
|
- yearRange: '" . $minYear . ":" . $maxYear . "',"; |
|
6874
|
+ yearRange: '" . $minYear.":".$maxYear."',"; |
6875
|
6875
|
if (!empty($conf->dol_use_jmobile)) { |
6876
|
6876
|
$retstring .= " |
6877
|
6877
|
beforeShow: function (input, datePicker) { |
|
@@ -6886,7 +6886,7 @@ discard block |
|
|
block discarded – undo |
6886
|
6886
|
if (!getDolGlobalString('MAIN_POPUP_CALENDAR_ON_FOCUS')) { |
6887
|
6887
|
$retstring .= " |
6888
|
6888
|
showOn: 'button', /* both has problem with autocompletion */ |
6889
|
|
- buttonImage: '" . DOL_URL_ROOT . "/theme/" . dol_escape_js($conf->theme) . "/img/object_calendarday.png', |
|
6889
|
+ buttonImage: '" . DOL_URL_ROOT."/theme/".dol_escape_js($conf->theme)."/img/object_calendarday.png', |
6890
|
6890
|
buttonImageOnly: true"; |
6891
|
6891
|
} |
6892
|
6892
|
$retstring .= " |
|
@@ -6898,8 +6898,8 @@ discard block |
|
|
block discarded – undo |
6898
|
6898
|
$retstring .= '<div class="nowraponall inline-block divfordateinput">'; |
6899
|
6899
|
$retstring .= '<input id="'.$prefix.'" name="'.$prefix.'" type="text" class="maxwidthdate" maxlength="11" value="'.$formated_date.'"'; |
6900
|
6900
|
$retstring .= ($disabled ? ' disabled' : ''); |
6901
|
|
- $retstring .= ($placeholder ? ' placeholder="' . dol_escape_htmltag($placeholder) . '"' : ''); |
6902
|
|
- $retstring .= ' onChange="dpChangeDay(\'' . dol_escape_js($prefix) . '\',\'' . dol_escape_js($langs->trans("FormatDateShortJavaInput")) . '\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript |
|
6901
|
+ $retstring .= ($placeholder ? ' placeholder="'.dol_escape_htmltag($placeholder).'"' : ''); |
|
6902
|
+ $retstring .= ' onChange="dpChangeDay(\''.dol_escape_js($prefix).'\',\''.dol_escape_js($langs->trans("FormatDateShortJavaInput")).'\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript |
6903
|
6903
|
$retstring .= '>'; |
6904
|
6904
|
|
6905
|
6905
|
// Icone calendrier |
|
@@ -6914,40 +6914,40 @@ discard block |
|
|
block discarded – undo |
6914
|
6914
|
$retstring.='});'; |
6915
|
6915
|
$retstring.="</script>";*/ |
6916
|
6916
|
} else { |
6917
|
|
- $retstringbutton = '<button id="' . $prefix . 'Button" type="button" class="dpInvisibleButtons">' . img_object($langs->trans("Disabled"), 'calendarday', 'class="datecallink"') . '</button>'; |
6918
|
|
- $retsring = $retstringbutton . $retstring; |
|
6917
|
+ $retstringbutton = '<button id="'.$prefix.'Button" type="button" class="dpInvisibleButtons">'.img_object($langs->trans("Disabled"), 'calendarday', 'class="datecallink"').'</button>'; |
|
6918
|
+ $retsring = $retstringbutton.$retstring; |
6919
|
6919
|
} |
6920
|
6920
|
|
6921
|
6921
|
$retstring .= '</div>'; |
6922
|
|
- $retstring .= '<input type="hidden" id="' . $prefix . 'day" name="' . $prefix . 'day" value="' . $sday . '">' . "\n"; |
6923
|
|
- $retstring .= '<input type="hidden" id="' . $prefix . 'month" name="' . $prefix . 'month" value="' . $smonth . '">' . "\n"; |
6924
|
|
- $retstring .= '<input type="hidden" id="' . $prefix . 'year" name="' . $prefix . 'year" value="' . $syear . '">' . "\n"; |
|
6922
|
+ $retstring .= '<input type="hidden" id="'.$prefix.'day" name="'.$prefix.'day" value="'.$sday.'">'."\n"; |
|
6923
|
+ $retstring .= '<input type="hidden" id="'.$prefix.'month" name="'.$prefix.'month" value="'.$smonth.'">'."\n"; |
|
6924
|
+ $retstring .= '<input type="hidden" id="'.$prefix.'year" name="'.$prefix.'year" value="'.$syear.'">'."\n"; |
6925
|
6925
|
} else { |
6926
|
6926
|
$retstring .= "Bad value of MAIN_POPUP_CALENDAR"; |
6927
|
6927
|
} |
6928
|
6928
|
} else { |
6929
|
6929
|
// Show date with combo selects |
6930
|
6930
|
// Day |
6931
|
|
- $retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth50imp" id="' . $prefix . 'day" name="' . $prefix . 'day">'; |
|
6931
|
+ $retstring .= '<select'.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth50imp" id="'.$prefix.'day" name="'.$prefix.'day">'; |
6932
|
6932
|
|
6933
|
6933
|
if ($emptydate || $set_time == -1) { |
6934
|
6934
|
$retstring .= '<option value="0" selected> </option>'; |
6935
|
6935
|
} |
6936
|
6936
|
|
6937
|
6937
|
for ($day = 1; $day <= 31; $day++) { |
6938
|
|
- $retstring .= '<option value="' . $day . '"' . ($day == $sday ? ' selected' : '') . '>' . $day . '</option>'; |
|
6938
|
+ $retstring .= '<option value="'.$day.'"'.($day == $sday ? ' selected' : '').'>'.$day.'</option>'; |
6939
|
6939
|
} |
6940
|
6940
|
|
6941
|
6941
|
$retstring .= "</select>"; |
6942
|
6942
|
|
6943
|
|
- $retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth75imp" id="' . $prefix . 'month" name="' . $prefix . 'month">'; |
|
6943
|
+ $retstring .= '<select'.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth75imp" id="'.$prefix.'month" name="'.$prefix.'month">'; |
6944
|
6944
|
if ($emptydate || $set_time == -1) { |
6945
|
6945
|
$retstring .= '<option value="0" selected> </option>'; |
6946
|
6946
|
} |
6947
|
6947
|
|
6948
|
6948
|
// Month |
6949
|
6949
|
for ($month = 1; $month <= 12; $month++) { |
6950
|
|
- $retstring .= '<option value="' . $month . '"' . ($month == $smonth ? ' selected' : '') . '>'; |
|
6950
|
+ $retstring .= '<option value="'.$month.'"'.($month == $smonth ? ' selected' : '').'>'; |
6951
|
6951
|
$retstring .= dol_print_date(mktime(12, 0, 0, $month, 1, 2000), "%b"); |
6952
|
6952
|
$retstring .= "</option>"; |
6953
|
6953
|
} |
|
@@ -6955,12 +6955,12 @@ discard block |
|
|
block discarded – undo |
6955
|
6955
|
|
6956
|
6956
|
// Year |
6957
|
6957
|
if ($emptydate || $set_time == -1) { |
6958
|
|
- $retstring .= '<input' . ($disabled ? ' disabled' : '') . ' placeholder="' . dol_escape_htmltag($langs->trans("Year")) . '" class="flat maxwidth50imp valignmiddle" type="number" min="0" max="3000" maxlength="4" id="' . $prefix . 'year" name="' . $prefix . 'year" value="' . $syear . '">'; |
|
6958
|
+ $retstring .= '<input'.($disabled ? ' disabled' : '').' placeholder="'.dol_escape_htmltag($langs->trans("Year")).'" class="flat maxwidth50imp valignmiddle" type="number" min="0" max="3000" maxlength="4" id="'.$prefix.'year" name="'.$prefix.'year" value="'.$syear.'">'; |
6959
|
6959
|
} else { |
6960
|
|
- $retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth75imp" id="' . $prefix . 'year" name="' . $prefix . 'year">'; |
|
6960
|
+ $retstring .= '<select'.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth75imp" id="'.$prefix.'year" name="'.$prefix.'year">'; |
6961
|
6961
|
|
6962
|
6962
|
for ($year = $syear - 10; $year < $syear + 10; $year++) { |
6963
|
|
- $retstring .= '<option value="' . $year . '"' . ($year == $syear ? ' selected' : '') . '>' . $year . '</option>'; |
|
6963
|
+ $retstring .= '<option value="'.$year.'"'.($year == $syear ? ' selected' : '').'>'.$year.'</option>'; |
6964
|
6964
|
} |
6965
|
6965
|
$retstring .= "</select>\n"; |
6966
|
6966
|
} |
|
@@ -6984,15 +6984,15 @@ discard block |
|
|
block discarded – undo |
6984
|
6984
|
} |
6985
|
6985
|
} |
6986
|
6986
|
// Show hour |
6987
|
|
- $retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth50 ' . ($fullday ? $fullday . 'hour' : '') . '" id="' . $prefix . 'hour" name="' . $prefix . 'hour">'; |
|
6987
|
+ $retstring .= '<select'.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth50 '.($fullday ? $fullday.'hour' : '').'" id="'.$prefix.'hour" name="'.$prefix.'hour">'; |
6988
|
6988
|
if ($emptyhours) { |
6989
|
6989
|
$retstring .= '<option value="-1"> </option>'; |
6990
|
6990
|
} |
6991
|
6991
|
for ($hour = $hourstart; $hour < $hourend; $hour++) { |
6992
|
6992
|
if (strlen($hour) < 2) { |
6993
|
|
- $hour = "0" . $hour; |
|
6993
|
+ $hour = "0".$hour; |
6994
|
6994
|
} |
6995
|
|
- $retstring .= '<option value="' . $hour . '"' . (($hour == $shour) ? ' selected' : '') . '>' . $hour; |
|
6995
|
+ $retstring .= '<option value="'.$hour.'"'.(($hour == $shour) ? ' selected' : '').'>'.$hour; |
6996
|
6996
|
//$retstring .= (empty($conf->dol_optimize_smallscreen) ? '' : 'H'); |
6997
|
6997
|
$retstring .= '</option>'; |
6998
|
6998
|
} |
|
@@ -7005,19 +7005,19 @@ discard block |
|
|
block discarded – undo |
7005
|
7005
|
|
7006
|
7006
|
if ($m) { |
7007
|
7007
|
// Show minutes |
7008
|
|
- $retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth50 ' . ($fullday ? $fullday . 'min' : '') . '" id="' . $prefix . 'min" name="' . $prefix . 'min">'; |
|
7008
|
+ $retstring .= '<select'.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth50 '.($fullday ? $fullday.'min' : '').'" id="'.$prefix.'min" name="'.$prefix.'min">'; |
7009
|
7009
|
if ($emptyhours) { |
7010
|
7010
|
$retstring .= '<option value="-1"> </option>'; |
7011
|
7011
|
} |
7012
|
7012
|
for ($min = 0; $min < 60; $min += $stepminutes) { |
7013
|
7013
|
if (strlen($min) < 2) { |
7014
|
|
- $min = "0" . $min; |
|
7014
|
+ $min = "0".$min; |
7015
|
7015
|
} |
7016
|
|
- $retstring .= '<option value="' . $min . '"' . (($min == $smin) ? ' selected' : '') . '>' . $min . (empty($conf->dol_optimize_smallscreen) ? '' : '') . '</option>'; |
|
7016
|
+ $retstring .= '<option value="'.$min.'"'.(($min == $smin) ? ' selected' : '').'>'.$min.(empty($conf->dol_optimize_smallscreen) ? '' : '').'</option>'; |
7017
|
7017
|
} |
7018
|
7018
|
$retstring .= '</select>'; |
7019
|
7019
|
|
7020
|
|
- $retstring .= '<input type="hidden" name="' . $prefix . 'sec" value="' . $ssec . '">'; |
|
7020
|
+ $retstring .= '<input type="hidden" name="'.$prefix.'sec" value="'.$ssec.'">'; |
7021
|
7021
|
} |
7022
|
7022
|
|
7023
|
7023
|
if ($d && $h) { |
|
@@ -7040,10 +7040,10 @@ discard block |
|
|
block discarded – undo |
7040
|
7040
|
|
7041
|
7041
|
// Generate the date part, depending on the use or not of the javascript calendar |
7042
|
7042
|
if ($addnowlink == 1) { // server time expressed in user time setup |
7043
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . '\').val(\'' . dol_print_date($nowgmt, 'day', 'tzuserrel') . '\');'; |
7044
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'day\').val(\'' . dol_print_date($nowgmt, '%d', 'tzuserrel') . '\');'; |
7045
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'month\').val(\'' . dol_print_date($nowgmt, '%m', 'tzuserrel') . '\');'; |
7046
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'year\').val(\'' . dol_print_date($nowgmt, '%Y', 'tzuserrel') . '\');'; |
|
7043
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'\').val(\''.dol_print_date($nowgmt, 'day', 'tzuserrel').'\');'; |
|
7044
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'day\').val(\''.dol_print_date($nowgmt, '%d', 'tzuserrel').'\');'; |
|
7045
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(\''.dol_print_date($nowgmt, '%m', 'tzuserrel').'\');'; |
|
7046
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(\''.dol_print_date($nowgmt, '%Y', 'tzuserrel').'\');'; |
7047
|
7047
|
} elseif ($addnowlink == 2) { |
7048
|
7048
|
/* Disabled because the output does not use the string format defined by FormatDateShort key to forge the value into #prefix. |
7049
|
7049
|
* This break application for foreign languages. |
|
@@ -7052,10 +7052,10 @@ discard block |
|
|
block discarded – undo |
7052
|
7052
|
$reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(parseInt(d.getMonth().pad()) + 1);'; |
7053
|
7053
|
$reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(d.getFullYear());'; |
7054
|
7054
|
*/ |
7055
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . '\').val(\'' . dol_print_date($nowgmt, 'day', 'tzuserrel') . '\');'; |
7056
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'day\').val(\'' . dol_print_date($nowgmt, '%d', 'tzuserrel') . '\');'; |
7057
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'month\').val(\'' . dol_print_date($nowgmt, '%m', 'tzuserrel') . '\');'; |
7058
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'year\').val(\'' . dol_print_date($nowgmt, '%Y', 'tzuserrel') . '\');'; |
|
7055
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'\').val(\''.dol_print_date($nowgmt, 'day', 'tzuserrel').'\');'; |
|
7056
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'day\').val(\''.dol_print_date($nowgmt, '%d', 'tzuserrel').'\');'; |
|
7057
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(\''.dol_print_date($nowgmt, '%m', 'tzuserrel').'\');'; |
|
7058
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(\''.dol_print_date($nowgmt, '%Y', 'tzuserrel').'\');'; |
7059
|
7059
|
} |
7060
|
7060
|
/*if ($usecalendar == "eldy") |
7061
|
7061
|
{ |
|
@@ -7075,11 +7075,11 @@ discard block |
|
|
block discarded – undo |
7075
|
7075
|
} |
7076
|
7076
|
//$reset_scripts .= 'this.form.elements[\''.$prefix.'hour\'].value=formatDate(new Date(), \'HH\'); '; |
7077
|
7077
|
if ($addnowlink == 1) { |
7078
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'hour\').val(\'' . dol_print_date($nowgmt, '%H', 'tzuserrel') . '\');'; |
7079
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'hour\').change();'; |
|
7078
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').val(\''.dol_print_date($nowgmt, '%H', 'tzuserrel').'\');'; |
|
7079
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').change();'; |
7080
|
7080
|
} elseif ($addnowlink == 2) { |
7081
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'hour\').val(d.getHours().pad());'; |
7082
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'hour\').change();'; |
|
7081
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').val(d.getHours().pad());'; |
|
7082
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').change();'; |
7083
|
7083
|
} |
7084
|
7084
|
|
7085
|
7085
|
if ($fullday) { |
|
@@ -7093,11 +7093,11 @@ discard block |
|
|
block discarded – undo |
7093
|
7093
|
} |
7094
|
7094
|
//$reset_scripts .= 'this.form.elements[\''.$prefix.'min\'].value=formatDate(new Date(), \'mm\'); '; |
7095
|
7095
|
if ($addnowlink == 1) { |
7096
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'min\').val(\'' . dol_print_date($nowgmt, '%M', 'tzuserrel') . '\');'; |
7097
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'min\').change();'; |
|
7096
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'min\').val(\''.dol_print_date($nowgmt, '%M', 'tzuserrel').'\');'; |
|
7097
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'min\').change();'; |
7098
|
7098
|
} elseif ($addnowlink == 2) { |
7099
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'min\').val(d.getMinutes().pad());'; |
7100
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'min\').change();'; |
|
7099
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'min\').val(d.getMinutes().pad());'; |
|
7100
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'min\').change();'; |
7101
|
7101
|
} |
7102
|
7102
|
if ($fullday) { |
7103
|
7103
|
$reset_scripts .= ' } '; |
|
@@ -7105,7 +7105,7 @@ discard block |
|
|
block discarded – undo |
7105
|
7105
|
} |
7106
|
7106
|
// If reset_scripts is not empty, print the link with the reset_scripts in the onClick |
7107
|
7107
|
if ($reset_scripts && !getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) { |
7108
|
|
- $retstring .= ' <button class="dpInvisibleButtons datenowlink" id="' . $prefix . 'ButtonNow" type="button" name="_useless" value="now" onClick="' . $reset_scripts . '">'; |
|
7108
|
+ $retstring .= ' <button class="dpInvisibleButtons datenowlink" id="'.$prefix.'ButtonNow" type="button" name="_useless" value="now" onClick="'.$reset_scripts.'">'; |
7109
|
7109
|
$retstring .= $langs->trans("Now"); |
7110
|
7110
|
$retstring .= '</button> '; |
7111
|
7111
|
} |
|
@@ -7117,16 +7117,16 @@ discard block |
|
|
block discarded – undo |
7117
|
7117
|
$reset_scripts = ""; |
7118
|
7118
|
|
7119
|
7119
|
// Generate the date part, depending on the use or not of the javascript calendar |
7120
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . '\').val(\'' . dol_print_date($nowgmt, 'dayinputnoreduce', 'tzuserrel') . '\');'; |
7121
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'day\').val(\'' . dol_print_date($nowgmt, '%d', 'tzuserrel') . '\');'; |
7122
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'month\').val(\'' . dol_print_date($nowgmt, '%m', 'tzuserrel') . '\');'; |
7123
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'year\').val(\'' . dol_print_date($nowgmt, '%Y', 'tzuserrel') . '\');'; |
|
7120
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'\').val(\''.dol_print_date($nowgmt, 'dayinputnoreduce', 'tzuserrel').'\');'; |
|
7121
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'day\').val(\''.dol_print_date($nowgmt, '%d', 'tzuserrel').'\');'; |
|
7122
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(\''.dol_print_date($nowgmt, '%m', 'tzuserrel').'\');'; |
|
7123
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(\''.dol_print_date($nowgmt, '%Y', 'tzuserrel').'\');'; |
7124
|
7124
|
// Update the hour part |
7125
|
7125
|
if ($h) { |
7126
|
7126
|
if ($fullday) { |
7127
|
7127
|
$reset_scripts .= " if (jQuery('#fullday:checked').val() == null) {"; |
7128
|
7128
|
} |
7129
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'hour\').val(\'' . dol_print_date($nowgmt, '%H', 'tzuserrel') . '\');'; |
|
7129
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').val(\''.dol_print_date($nowgmt, '%H', 'tzuserrel').'\');'; |
7130
|
7130
|
if ($fullday) { |
7131
|
7131
|
$reset_scripts .= ' } '; |
7132
|
7132
|
} |
|
@@ -7136,14 +7136,14 @@ discard block |
|
|
block discarded – undo |
7136
|
7136
|
if ($fullday) { |
7137
|
7137
|
$reset_scripts .= " if (jQuery('#fullday:checked').val() == null) {"; |
7138
|
7138
|
} |
7139
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'min\').val(\'' . dol_print_date($nowgmt, '%M', 'tzuserrel') . '\');'; |
|
7139
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'min\').val(\''.dol_print_date($nowgmt, '%M', 'tzuserrel').'\');'; |
7140
|
7140
|
if ($fullday) { |
7141
|
7141
|
$reset_scripts .= ' } '; |
7142
|
7142
|
} |
7143
|
7143
|
} |
7144
|
7144
|
// If reset_scripts is not empty, print the link with the reset_scripts in the onClick |
7145
|
7145
|
if ($reset_scripts && empty($conf->dol_optimize_smallscreen)) { |
7146
|
|
- $retstring .= ' <button class="dpInvisibleButtons datenowlink" id="' . $prefix . 'ButtonPlusOne" type="button" name="_useless2" value="plusone" onClick="' . $reset_scripts . '">'; |
|
7146
|
+ $retstring .= ' <button class="dpInvisibleButtons datenowlink" id="'.$prefix.'ButtonPlusOne" type="button" name="_useless2" value="plusone" onClick="'.$reset_scripts.'">'; |
7147
|
7147
|
$retstring .= $langs->trans("DateStartPlusOne"); |
7148
|
7148
|
$retstring .= '</button> '; |
7149
|
7149
|
} |
|
@@ -7201,17 +7201,17 @@ discard block |
|
|
block discarded – undo |
7201
|
7201
|
unset($TDurationTypes[$value]); |
7202
|
7202
|
} |
7203
|
7203
|
|
7204
|
|
- $retstring = '<select class="flat minwidth75 maxwidth100" id="select_' . $prefix . 'type_duration" name="' . $prefix . 'type_duration">'; |
|
7204
|
+ $retstring = '<select class="flat minwidth75 maxwidth100" id="select_'.$prefix.'type_duration" name="'.$prefix.'type_duration">'; |
7205
|
7205
|
foreach ($TDurationTypes as $key => $typeduration) { |
7206
|
|
- $retstring .= '<option value="' . $key . '"'; |
|
7206
|
+ $retstring .= '<option value="'.$key.'"'; |
7207
|
7207
|
if ($key == $selected) { |
7208
|
7208
|
$retstring .= " selected"; |
7209
|
7209
|
} |
7210
|
|
- $retstring .= ">" . $typeduration . "</option>"; |
|
7210
|
+ $retstring .= ">".$typeduration."</option>"; |
7211
|
7211
|
} |
7212
|
7212
|
$retstring .= "</select>"; |
7213
|
7213
|
|
7214
|
|
- $retstring .= ajax_combobox('select_' . $prefix . 'type_duration'); |
|
7214
|
+ $retstring .= ajax_combobox('select_'.$prefix.'type_duration'); |
7215
|
7215
|
|
7216
|
7216
|
return $retstring; |
7217
|
7217
|
} |
|
@@ -7243,30 +7243,30 @@ discard block |
|
|
block discarded – undo |
7243
|
7243
|
|
7244
|
7244
|
// Hours |
7245
|
7245
|
if ($iSecond != '') { |
7246
|
|
- require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php'; |
|
7246
|
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; |
7247
|
7247
|
|
7248
|
7248
|
$hourSelected = convertSecondToTime($iSecond, 'allhour'); |
7249
|
7249
|
$minSelected = convertSecondToTime($iSecond, 'min'); |
7250
|
7250
|
} |
7251
|
7251
|
|
7252
|
7252
|
if ($typehour == 'select') { |
7253
|
|
- $retstring .= '<select class="flat" id="select_' . $prefix . 'hour" name="' . $prefix . 'hour"' . ($disabled ? ' disabled' : '') . '>'; |
|
7253
|
+ $retstring .= '<select class="flat" id="select_'.$prefix.'hour" name="'.$prefix.'hour"'.($disabled ? ' disabled' : '').'>'; |
7254
|
7254
|
for ($hour = 0; $hour < 25; $hour++) { // For a duration, we allow 24 hours |
7255
|
|
- $retstring .= '<option value="' . $hour . '"'; |
|
7255
|
+ $retstring .= '<option value="'.$hour.'"'; |
7256
|
7256
|
if (is_numeric($hourSelected) && $hourSelected == $hour) { |
7257
|
7257
|
$retstring .= " selected"; |
7258
|
7258
|
} |
7259
|
|
- $retstring .= ">" . $hour . "</option>"; |
|
7259
|
+ $retstring .= ">".$hour."</option>"; |
7260
|
7260
|
} |
7261
|
7261
|
$retstring .= "</select>"; |
7262
|
7262
|
} elseif ($typehour == 'text' || $typehour == 'textselect') { |
7263
|
|
- $retstring .= '<input placeholder="' . $langs->trans('HourShort') . '" type="number" min="0" name="' . $prefix . 'hour"' . ($disabled ? ' disabled' : '') . ' class="flat maxwidth50 inputhour right" value="' . (($hourSelected != '') ? ((int) $hourSelected) : '') . '">'; |
|
7263
|
+ $retstring .= '<input placeholder="'.$langs->trans('HourShort').'" type="number" min="0" name="'.$prefix.'hour"'.($disabled ? ' disabled' : '').' class="flat maxwidth50 inputhour right" value="'.(($hourSelected != '') ? ((int) $hourSelected) : '').'">'; |
7264
|
7264
|
} else { |
7265
|
7265
|
return 'BadValueForParameterTypeHour'; |
7266
|
7266
|
} |
7267
|
7267
|
|
7268
|
7268
|
if ($typehour != 'text') { |
7269
|
|
- $retstring .= ' ' . $langs->trans('HourShort'); |
|
7269
|
+ $retstring .= ' '.$langs->trans('HourShort'); |
7270
|
7270
|
} else { |
7271
|
7271
|
$retstring .= '<span class="">:</span>'; |
7272
|
7272
|
} |
|
@@ -7281,21 +7281,21 @@ discard block |
|
|
block discarded – undo |
7281
|
7281
|
} |
7282
|
7282
|
|
7283
|
7283
|
if ($typehour == 'select' || $typehour == 'textselect') { |
7284
|
|
- $retstring .= '<select class="flat" id="select_' . $prefix . 'min" name="' . $prefix . 'min"' . ($disabled ? ' disabled' : '') . '>'; |
|
7284
|
+ $retstring .= '<select class="flat" id="select_'.$prefix.'min" name="'.$prefix.'min"'.($disabled ? ' disabled' : '').'>'; |
7285
|
7285
|
for ($min = 0; $min <= 55; $min = $min + 5) { |
7286
|
|
- $retstring .= '<option value="' . $min . '"'; |
|
7286
|
+ $retstring .= '<option value="'.$min.'"'; |
7287
|
7287
|
if (is_numeric($minSelected) && $minSelected == $min) { |
7288
|
7288
|
$retstring .= ' selected'; |
7289
|
7289
|
} |
7290
|
|
- $retstring .= '>' . $min . '</option>'; |
|
7290
|
+ $retstring .= '>'.$min.'</option>'; |
7291
|
7291
|
} |
7292
|
7292
|
$retstring .= "</select>"; |
7293
|
7293
|
} elseif ($typehour == 'text') { |
7294
|
|
- $retstring .= '<input placeholder="' . $langs->trans('MinuteShort') . '" type="number" min="0" name="' . $prefix . 'min"' . ($disabled ? ' disabled' : '') . ' class="flat maxwidth50 inputminute right" value="' . (($minSelected != '') ? ((int) $minSelected) : '') . '">'; |
|
7294
|
+ $retstring .= '<input placeholder="'.$langs->trans('MinuteShort').'" type="number" min="0" name="'.$prefix.'min"'.($disabled ? ' disabled' : '').' class="flat maxwidth50 inputminute right" value="'.(($minSelected != '') ? ((int) $minSelected) : '').'">'; |
7295
|
7295
|
} |
7296
|
7296
|
|
7297
|
7297
|
if ($typehour != 'text') { |
7298
|
|
- $retstring .= ' ' . $langs->trans('MinuteShort'); |
|
7298
|
+ $retstring .= ' '.$langs->trans('MinuteShort'); |
7299
|
7299
|
} |
7300
|
7300
|
|
7301
|
7301
|
$retstring .= "</span>"; |
|
@@ -7343,7 +7343,7 @@ discard block |
|
|
block discarded – undo |
7343
|
7343
|
$placeholder = ''; |
7344
|
7344
|
|
7345
|
7345
|
if ($selected && empty($selected_input_value)) { |
7346
|
|
- require_once DOL_DOCUMENT_ROOT . '/ticket/class/ticket.class.php'; |
|
7346
|
+ require_once DOL_DOCUMENT_ROOT.'/ticket/class/ticket.class.php'; |
7347
|
7347
|
$tickettmpselect = new Ticket($this->db); |
7348
|
7348
|
$tickettmpselect->fetch($selected); |
7349
|
7349
|
$selected_input_value = $tickettmpselect->ref; |
|
@@ -7351,17 +7351,17 @@ discard block |
|
|
block discarded – undo |
7351
|
7351
|
} |
7352
|
7352
|
|
7353
|
7353
|
$urloption = ''; |
7354
|
|
- $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/ticket/ajax/tickets.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions); |
|
7354
|
+ $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/ticket/ajax/tickets.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions); |
7355
|
7355
|
|
7356
|
7356
|
if (empty($hidelabel)) { |
7357
|
|
- $out .= $langs->trans("RefOrLabel") . ' : '; |
|
7357
|
+ $out .= $langs->trans("RefOrLabel").' : '; |
7358
|
7358
|
} elseif ($hidelabel > 1) { |
7359
|
|
- $placeholder = ' placeholder="' . $langs->trans("RefOrLabel") . '"'; |
|
7359
|
+ $placeholder = ' placeholder="'.$langs->trans("RefOrLabel").'"'; |
7360
|
7360
|
if ($hidelabel == 2) { |
7361
|
7361
|
$out .= img_picto($langs->trans("Search"), 'search'); |
7362
|
7362
|
} |
7363
|
7363
|
} |
7364
|
|
- $out .= '<input type="text" class="minwidth100" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . $placeholder . ' ' . (getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '') . ' />'; |
|
7364
|
+ $out .= '<input type="text" class="minwidth100" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' '.(getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '').' />'; |
7365
|
7365
|
if ($hidelabel == 3) { |
7366
|
7366
|
$out .= img_picto($langs->trans("Search"), 'search'); |
7367
|
7367
|
} |
|
@@ -7405,8 +7405,8 @@ discard block |
|
|
block discarded – undo |
7405
|
7405
|
|
7406
|
7406
|
$sql = "SELECT "; |
7407
|
7407
|
$sql .= $selectFields; |
7408
|
|
- $sql .= " FROM " . $this->db->prefix() . "ticket as p"; |
7409
|
|
- $sql .= ' WHERE p.entity IN (' . getEntity('ticket') . ')'; |
|
7408
|
+ $sql .= " FROM ".$this->db->prefix()."ticket as p"; |
|
7409
|
+ $sql .= ' WHERE p.entity IN ('.getEntity('ticket').')'; |
7410
|
7410
|
|
7411
|
7411
|
// Add criteria on ref/label |
7412
|
7412
|
if ($filterkey != '') { |
|
@@ -7422,7 +7422,7 @@ discard block |
|
|
block discarded – undo |
7422
|
7422
|
if ($i > 0) { |
7423
|
7423
|
$sql .= " AND "; |
7424
|
7424
|
} |
7425
|
|
- $sql .= "(p.ref LIKE '" . $this->db->escape($prefix . $crit) . "%' OR p.subject LIKE '" . $this->db->escape($prefix . $crit) . "%'"; |
|
7425
|
+ $sql .= "(p.ref LIKE '".$this->db->escape($prefix.$crit)."%' OR p.subject LIKE '".$this->db->escape($prefix.$crit)."%'"; |
7426
|
7426
|
$sql .= ")"; |
7427
|
7427
|
$i++; |
7428
|
7428
|
} |
|
@@ -7435,22 +7435,22 @@ discard block |
|
|
block discarded – undo |
7435
|
7435
|
$sql .= $this->db->plimit($limit, 0); |
7436
|
7436
|
|
7437
|
7437
|
// Build output string |
7438
|
|
- dol_syslog(get_class($this) . "::selectTicketsList search tickets", LOG_DEBUG); |
|
7438
|
+ dol_syslog(get_class($this)."::selectTicketsList search tickets", LOG_DEBUG); |
7439
|
7439
|
$result = $this->db->query($sql); |
7440
|
7440
|
if ($result) { |
7441
|
|
- require_once DOL_DOCUMENT_ROOT . '/ticket/class/ticket.class.php'; |
7442
|
|
- require_once DOL_DOCUMENT_ROOT . '/core/lib/ticket.lib.php'; |
|
7441
|
+ require_once DOL_DOCUMENT_ROOT.'/ticket/class/ticket.class.php'; |
|
7442
|
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/ticket.lib.php'; |
7443
|
7443
|
|
7444
|
7444
|
$num = $this->db->num_rows($result); |
7445
|
7445
|
|
7446
|
7446
|
$events = null; |
7447
|
7447
|
|
7448
|
7448
|
if (!$forcecombo) { |
7449
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
7449
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
7450
|
7450
|
$out .= ajax_combobox($htmlname, $events, $conf->global->TICKET_USE_SEARCH_TO_SELECT); |
7451
|
7451
|
} |
7452
|
7452
|
|
7453
|
|
- $out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">'; |
|
7453
|
+ $out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">'; |
7454
|
7454
|
|
7455
|
7455
|
$textifempty = ''; |
7456
|
7456
|
// Do not use textifempty = ' ' or ' ' here, or search on key will search on ' key'. |
|
@@ -7467,7 +7467,7 @@ discard block |
|
|
block discarded – undo |
7467
|
7467
|
} |
7468
|
7468
|
} |
7469
|
7469
|
if ($showempty) { |
7470
|
|
- $out .= '<option value="0" selected>' . $textifempty . '</option>'; |
|
7470
|
+ $out .= '<option value="0" selected>'.$textifempty.'</option>'; |
7471
|
7471
|
} |
7472
|
7472
|
|
7473
|
7473
|
$i = 0; |
|
@@ -7522,13 +7522,13 @@ discard block |
|
|
block discarded – undo |
7522
|
7522
|
$outref = $objp->ref; |
7523
|
7523
|
$outtype = $objp->fk_product_type; |
7524
|
7524
|
|
7525
|
|
- $opt = '<option value="' . $objp->rowid . '"'; |
|
7525
|
+ $opt = '<option value="'.$objp->rowid.'"'; |
7526
|
7526
|
$opt .= ($objp->rowid == $selected) ? ' selected' : ''; |
7527
|
7527
|
$opt .= '>'; |
7528
|
7528
|
$opt .= $objp->ref; |
7529
|
7529
|
$objRef = $objp->ref; |
7530
|
7530
|
if (!empty($filterkey) && $filterkey != '') { |
7531
|
|
- $objRef = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $objRef, 1); |
|
7531
|
+ $objRef = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $objRef, 1); |
7532
|
7532
|
} |
7533
|
7533
|
|
7534
|
7534
|
$opt .= "</option>\n"; |
|
@@ -7569,7 +7569,7 @@ discard block |
|
|
block discarded – undo |
7569
|
7569
|
$placeholder = ''; |
7570
|
7570
|
|
7571
|
7571
|
if ($selected && empty($selected_input_value)) { |
7572
|
|
- require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; |
|
7572
|
+ require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; |
7573
|
7573
|
$projecttmpselect = new Project($this->db); |
7574
|
7574
|
$projecttmpselect->fetch($selected); |
7575
|
7575
|
$selected_input_value = $projecttmpselect->ref; |
|
@@ -7577,17 +7577,17 @@ discard block |
|
|
block discarded – undo |
7577
|
7577
|
} |
7578
|
7578
|
|
7579
|
7579
|
$urloption = ''; |
7580
|
|
- $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/projet/ajax/projects.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions); |
|
7580
|
+ $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/projet/ajax/projects.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions); |
7581
|
7581
|
|
7582
|
7582
|
if (empty($hidelabel)) { |
7583
|
|
- $out .= $langs->trans("RefOrLabel") . ' : '; |
|
7583
|
+ $out .= $langs->trans("RefOrLabel").' : '; |
7584
|
7584
|
} elseif ($hidelabel > 1) { |
7585
|
|
- $placeholder = ' placeholder="' . $langs->trans("RefOrLabel") . '"'; |
|
7585
|
+ $placeholder = ' placeholder="'.$langs->trans("RefOrLabel").'"'; |
7586
|
7586
|
if ($hidelabel == 2) { |
7587
|
7587
|
$out .= img_picto($langs->trans("Search"), 'search'); |
7588
|
7588
|
} |
7589
|
7589
|
} |
7590
|
|
- $out .= '<input type="text" class="minwidth100" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . $placeholder . ' ' . (getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '') . ' />'; |
|
7590
|
+ $out .= '<input type="text" class="minwidth100" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' '.(getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '').' />'; |
7591
|
7591
|
if ($hidelabel == 3) { |
7592
|
7592
|
$out .= img_picto($langs->trans("Search"), 'search'); |
7593
|
7593
|
} |
|
@@ -7630,8 +7630,8 @@ discard block |
|
|
block discarded – undo |
7630
|
7630
|
|
7631
|
7631
|
$sql = "SELECT "; |
7632
|
7632
|
$sql .= $selectFields; |
7633
|
|
- $sql .= " FROM " . $this->db->prefix() . "projet as p"; |
7634
|
|
- $sql .= ' WHERE p.entity IN (' . getEntity('project') . ')'; |
|
7633
|
+ $sql .= " FROM ".$this->db->prefix()."projet as p"; |
|
7634
|
+ $sql .= ' WHERE p.entity IN ('.getEntity('project').')'; |
7635
|
7635
|
|
7636
|
7636
|
// Add criteria on ref/label |
7637
|
7637
|
if ($filterkey != '') { |
|
@@ -7647,7 +7647,7 @@ discard block |
|
|
block discarded – undo |
7647
|
7647
|
if ($i > 0) { |
7648
|
7648
|
$sql .= " AND "; |
7649
|
7649
|
} |
7650
|
|
- $sql .= "p.ref LIKE '" . $this->db->escape($prefix . $crit) . "%'"; |
|
7650
|
+ $sql .= "p.ref LIKE '".$this->db->escape($prefix.$crit)."%'"; |
7651
|
7651
|
$sql .= ""; |
7652
|
7652
|
$i++; |
7653
|
7653
|
} |
|
@@ -7660,22 +7660,22 @@ discard block |
|
|
block discarded – undo |
7660
|
7660
|
$sql .= $this->db->plimit($limit, 0); |
7661
|
7661
|
|
7662
|
7662
|
// Build output string |
7663
|
|
- dol_syslog(get_class($this) . "::selectProjectsList search projects", LOG_DEBUG); |
|
7663
|
+ dol_syslog(get_class($this)."::selectProjectsList search projects", LOG_DEBUG); |
7664
|
7664
|
$result = $this->db->query($sql); |
7665
|
7665
|
if ($result) { |
7666
|
|
- require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; |
7667
|
|
- require_once DOL_DOCUMENT_ROOT . '/core/lib/project.lib.php'; |
|
7666
|
+ require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; |
|
7667
|
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php'; |
7668
|
7668
|
|
7669
|
7669
|
$num = $this->db->num_rows($result); |
7670
|
7670
|
|
7671
|
7671
|
$events = null; |
7672
|
7672
|
|
7673
|
7673
|
if (!$forcecombo) { |
7674
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
7674
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
7675
|
7675
|
$out .= ajax_combobox($htmlname, $events, $conf->global->PROJECT_USE_SEARCH_TO_SELECT); |
7676
|
7676
|
} |
7677
|
7677
|
|
7678
|
|
- $out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">'; |
|
7678
|
+ $out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">'; |
7679
|
7679
|
|
7680
|
7680
|
$textifempty = ''; |
7681
|
7681
|
// Do not use textifempty = ' ' or ' ' here, or search on key will search on ' key'. |
|
@@ -7692,7 +7692,7 @@ discard block |
|
|
block discarded – undo |
7692
|
7692
|
} |
7693
|
7693
|
} |
7694
|
7694
|
if ($showempty) { |
7695
|
|
- $out .= '<option value="0" selected>' . $textifempty . '</option>'; |
|
7695
|
+ $out .= '<option value="0" selected>'.$textifempty.'</option>'; |
7696
|
7696
|
} |
7697
|
7697
|
|
7698
|
7698
|
$i = 0; |
|
@@ -7750,13 +7750,13 @@ discard block |
|
|
block discarded – undo |
7750
|
7750
|
$outlabel = $objp->label; |
7751
|
7751
|
$outtype = $objp->fk_product_type; |
7752
|
7752
|
|
7753
|
|
- $opt = '<option value="' . $objp->rowid . '"'; |
|
7753
|
+ $opt = '<option value="'.$objp->rowid.'"'; |
7754
|
7754
|
$opt .= ($objp->rowid == $selected) ? ' selected' : ''; |
7755
|
7755
|
$opt .= '>'; |
7756
|
7756
|
$opt .= $objp->ref; |
7757
|
7757
|
$objRef = $objp->ref; |
7758
|
7758
|
if (!empty($filterkey) && $filterkey != '') { |
7759
|
|
- $objRef = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $objRef, 1); |
|
7759
|
+ $objRef = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $objRef, 1); |
7760
|
7760
|
} |
7761
|
7761
|
|
7762
|
7762
|
$opt .= "</option>\n"; |
|
@@ -7799,7 +7799,7 @@ discard block |
|
|
block discarded – undo |
7799
|
7799
|
$urloption = ''; |
7800
|
7800
|
|
7801
|
7801
|
if ($selected && empty($selected_input_value)) { |
7802
|
|
- require_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php'; |
|
7802
|
+ require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; |
7803
|
7803
|
$adherenttmpselect = new Adherent($this->db); |
7804
|
7804
|
$adherenttmpselect->fetch($selected); |
7805
|
7805
|
$selected_input_value = $adherenttmpselect->ref; |
|
@@ -7808,17 +7808,17 @@ discard block |
|
|
block discarded – undo |
7808
|
7808
|
|
7809
|
7809
|
$urloption = ''; |
7810
|
7810
|
|
7811
|
|
- $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/adherents/ajax/adherents.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions); |
|
7811
|
+ $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/adherents/ajax/adherents.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions); |
7812
|
7812
|
|
7813
|
7813
|
if (empty($hidelabel)) { |
7814
|
|
- $out .= $langs->trans("RefOrLabel") . ' : '; |
|
7814
|
+ $out .= $langs->trans("RefOrLabel").' : '; |
7815
|
7815
|
} elseif ($hidelabel > 1) { |
7816
|
|
- $placeholder = ' placeholder="' . $langs->trans("RefOrLabel") . '"'; |
|
7816
|
+ $placeholder = ' placeholder="'.$langs->trans("RefOrLabel").'"'; |
7817
|
7817
|
if ($hidelabel == 2) { |
7818
|
7818
|
$out .= img_picto($langs->trans("Search"), 'search'); |
7819
|
7819
|
} |
7820
|
7820
|
} |
7821
|
|
- $out .= '<input type="text" class="minwidth100" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . $placeholder . ' ' . (getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '') . ' />'; |
|
7821
|
+ $out .= '<input type="text" class="minwidth100" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' '.(getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '').' />'; |
7822
|
7822
|
if ($hidelabel == 3) { |
7823
|
7823
|
$out .= img_picto($langs->trans("Search"), 'search'); |
7824
|
7824
|
} |
|
@@ -7863,8 +7863,8 @@ discard block |
|
|
block discarded – undo |
7863
|
7863
|
|
7864
|
7864
|
$sql = "SELECT "; |
7865
|
7865
|
$sql .= $selectFields; |
7866
|
|
- $sql .= " FROM " . $this->db->prefix() . "adherent as p"; |
7867
|
|
- $sql .= ' WHERE p.entity IN (' . getEntity('adherent') . ')'; |
|
7866
|
+ $sql .= " FROM ".$this->db->prefix()."adherent as p"; |
|
7867
|
+ $sql .= ' WHERE p.entity IN ('.getEntity('adherent').')'; |
7868
|
7868
|
|
7869
|
7869
|
// Add criteria on ref/label |
7870
|
7870
|
if ($filterkey != '') { |
|
@@ -7880,8 +7880,8 @@ discard block |
|
|
block discarded – undo |
7880
|
7880
|
if ($i > 0) { |
7881
|
7881
|
$sql .= " AND "; |
7882
|
7882
|
} |
7883
|
|
- $sql .= "(p.firstname LIKE '" . $this->db->escape($prefix . $crit) . "%'"; |
7884
|
|
- $sql .= " OR p.lastname LIKE '" . $this->db->escape($prefix . $crit) . "%')"; |
|
7883
|
+ $sql .= "(p.firstname LIKE '".$this->db->escape($prefix.$crit)."%'"; |
|
7884
|
+ $sql .= " OR p.lastname LIKE '".$this->db->escape($prefix.$crit)."%')"; |
7885
|
7885
|
$i++; |
7886
|
7886
|
} |
7887
|
7887
|
if (count($scrit) > 1) { |
|
@@ -7890,27 +7890,27 @@ discard block |
|
|
block discarded – undo |
7890
|
7890
|
$sql .= ')'; |
7891
|
7891
|
} |
7892
|
7892
|
if ($status != -1) { |
7893
|
|
- $sql .= ' AND statut = ' . ((int) $status); |
|
7893
|
+ $sql .= ' AND statut = '.((int) $status); |
7894
|
7894
|
} |
7895
|
7895
|
$sql .= $this->db->plimit($limit, 0); |
7896
|
7896
|
|
7897
|
7897
|
// Build output string |
7898
|
|
- dol_syslog(get_class($this) . "::selectMembersList search adherents", LOG_DEBUG); |
|
7898
|
+ dol_syslog(get_class($this)."::selectMembersList search adherents", LOG_DEBUG); |
7899
|
7899
|
$result = $this->db->query($sql); |
7900
|
7900
|
if ($result) { |
7901
|
|
- require_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php'; |
7902
|
|
- require_once DOL_DOCUMENT_ROOT . '/core/lib/member.lib.php'; |
|
7901
|
+ require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; |
|
7902
|
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php'; |
7903
|
7903
|
|
7904
|
7904
|
$num = $this->db->num_rows($result); |
7905
|
7905
|
|
7906
|
7906
|
$events = null; |
7907
|
7907
|
|
7908
|
7908
|
if (!$forcecombo) { |
7909
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
7909
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
7910
|
7910
|
$out .= ajax_combobox($htmlname, $events, getDolGlobalString('PROJECT_USE_SEARCH_TO_SELECT') ? $conf->global->PROJECT_USE_SEARCH_TO_SELECT : ''); |
7911
|
7911
|
} |
7912
|
7912
|
|
7913
|
|
- $out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">'; |
|
7913
|
+ $out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">'; |
7914
|
7914
|
|
7915
|
7915
|
$textifempty = ''; |
7916
|
7916
|
// Do not use textifempty = ' ' or ' ' here, or search on key will search on ' key'. |
|
@@ -7927,7 +7927,7 @@ discard block |
|
|
block discarded – undo |
7927
|
7927
|
} |
7928
|
7928
|
} |
7929
|
7929
|
if ($showempty) { |
7930
|
|
- $out .= '<option value="-1" selected>' . $textifempty . '</option>'; |
|
7930
|
+ $out .= '<option value="-1" selected>'.$textifempty.'</option>'; |
7931
|
7931
|
} |
7932
|
7932
|
|
7933
|
7933
|
$i = 0; |
|
@@ -7983,11 +7983,11 @@ discard block |
|
|
block discarded – undo |
7983
|
7983
|
$outlabel = dolGetFirstLastname($objp->firstname, $objp->lastname); |
7984
|
7984
|
$outtype = $objp->fk_adherent_type; |
7985
|
7985
|
|
7986
|
|
- $opt = '<option value="' . $objp->rowid . '"'; |
|
7986
|
+ $opt = '<option value="'.$objp->rowid.'"'; |
7987
|
7987
|
$opt .= ($objp->rowid == $selected) ? ' selected' : ''; |
7988
|
7988
|
$opt .= '>'; |
7989
|
7989
|
if (!empty($filterkey) && $filterkey != '') { |
7990
|
|
- $outlabel = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $outlabel, 1); |
|
7990
|
+ $outlabel = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $outlabel, 1); |
7991
|
7991
|
} |
7992
|
7992
|
$opt .= $outlabel; |
7993
|
7993
|
$opt .= "</option>\n"; |
|
@@ -8059,9 +8059,9 @@ discard block |
|
|
block discarded – undo |
8059
|
8059
|
$vartmp = (empty($InfoFieldList[3]) ? '' : $InfoFieldList[3]); |
8060
|
8060
|
$reg = array(); |
8061
|
8061
|
if (preg_match('/^.*:(\w*)$/', $vartmp, $reg)) { |
8062
|
|
- $InfoFieldList[4] = $reg[1]; // take the sort field |
|
8062
|
+ $InfoFieldList[4] = $reg[1]; // take the sort field |
8063
|
8063
|
} |
8064
|
|
- $InfoFieldList[3] = preg_replace('/:\w*$/', '', $vartmp); // take the filter field |
|
8064
|
+ $InfoFieldList[3] = preg_replace('/:\w*$/', '', $vartmp); // take the filter field |
8065
|
8065
|
|
8066
|
8066
|
$classname = $InfoFieldList[0]; |
8067
|
8067
|
$classpath = $InfoFieldList[1]; |
|
@@ -8092,8 +8092,8 @@ discard block |
|
|
block discarded – undo |
8092
|
8092
|
); |
8093
|
8093
|
|
8094
|
8094
|
if (!is_object($objecttmp)) { |
8095
|
|
- dol_syslog('selectForForms: Error bad setup of field objectdescorig=' . $objectdescorig.', objectfield='.$objectfield, LOG_WARNING); |
8096
|
|
- return 'selectForForms: Error bad setup of field objectdescorig=' . $objectdescorig.', objectfield='.$objectfield; |
|
8095
|
+ dol_syslog('selectForForms: Error bad setup of field objectdescorig='.$objectdescorig.', objectfield='.$objectfield, LOG_WARNING); |
|
8096
|
+ return 'selectForForms: Error bad setup of field objectdescorig='.$objectdescorig.', objectfield='.$objectfield; |
8097
|
8097
|
} |
8098
|
8098
|
|
8099
|
8099
|
//var_dump($filter); |
|
@@ -8104,9 +8104,9 @@ discard block |
|
|
block discarded – undo |
8104
|
8104
|
if ($prefixforautocompletemode == 'product') { |
8105
|
8105
|
$prefixforautocompletemode = 'produit'; |
8106
|
8106
|
} |
8107
|
|
- $confkeyforautocompletemode = strtoupper($prefixforautocompletemode) . '_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT |
|
8107
|
+ $confkeyforautocompletemode = strtoupper($prefixforautocompletemode).'_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT |
8108
|
8108
|
|
8109
|
|
- dol_syslog(get_class($this) . "::selectForForms filter=" . $filter, LOG_DEBUG); |
|
8109
|
+ dol_syslog(get_class($this)."::selectForForms filter=".$filter, LOG_DEBUG); |
8110
|
8110
|
|
8111
|
8111
|
// Generate the combo HTML component |
8112
|
8112
|
$out = ''; |
|
@@ -8120,13 +8120,13 @@ discard block |
|
|
block discarded – undo |
8120
|
8120
|
} |
8121
|
8121
|
|
8122
|
8122
|
// Set url and param to call to get json of the search results |
8123
|
|
- $urlforajaxcall = DOL_URL_ROOT . '/core/ajax/selectobject.php'; |
8124
|
|
- $urloption = 'htmlname=' . urlencode($htmlname) . '&outjson=1&objectdesc=' . urlencode($objectdescorig) . '&objectfield='.urlencode($objectfield) . ($sortfield ? '&sortfield=' . urlencode($sortfield) : ''); |
|
8123
|
+ $urlforajaxcall = DOL_URL_ROOT.'/core/ajax/selectobject.php'; |
|
8124
|
+ $urloption = 'htmlname='.urlencode($htmlname).'&outjson=1&objectdesc='.urlencode($objectdescorig).'&objectfield='.urlencode($objectfield).($sortfield ? '&sortfield='.urlencode($sortfield) : ''); |
8125
|
8125
|
|
8126
|
8126
|
// Activate the auto complete using ajax call. |
8127
|
8127
|
$out .= ajax_autocompleter($preselectedvalue, $htmlname, $urlforajaxcall, $urloption, getDolGlobalString($confkeyforautocompletemode), 0, array()); |
8128
|
8128
|
$out .= '<!-- force css to be higher than dialog popup --><style type="text/css">.ui-autocomplete { z-index: 1010; }</style>'; |
8129
|
|
- $out .= '<input type="text" class="' . $morecss . '"' . ($disabled ? ' disabled="disabled"' : '') . ' name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . ($placeholder ? ' placeholder="' . dol_escape_htmltag($placeholder) . '"' : '') . ' />'; |
|
8129
|
+ $out .= '<input type="text" class="'.$morecss.'"'.($disabled ? ' disabled="disabled"' : '').' name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.($placeholder ? ' placeholder="'.dol_escape_htmltag($placeholder).'"' : '').' />'; |
8130
|
8130
|
} else { |
8131
|
8131
|
// Immediate load of table record. |
8132
|
8132
|
$out .= $this->selectForFormsList($objecttmp, $htmlname, $preselectedvalue, $showempty, $searchkey, $placeholder, $morecss, $moreparams, $forcecombo, 0, $disabled, $sortfield, $filter); |
|
@@ -8166,7 +8166,7 @@ discard block |
|
|
block discarded – undo |
8166
|
8166
|
if ($prefixforautocompletemode == 'societe') { |
8167
|
8167
|
$prefixforautocompletemode = 'company'; |
8168
|
8168
|
} |
8169
|
|
- $confkeyforautocompletemode = strtoupper($prefixforautocompletemode) . '_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT |
|
8169
|
+ $confkeyforautocompletemode = strtoupper($prefixforautocompletemode).'_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT |
8170
|
8170
|
|
8171
|
8171
|
if (!empty($objecttmp->fields)) { // For object that declare it, it is better to use declared fields (like societe, contact, ...) |
8172
|
8172
|
$tmpfieldstoshow = ''; |
|
@@ -8175,7 +8175,7 @@ discard block |
|
|
block discarded – undo |
8175
|
8175
|
continue; |
8176
|
8176
|
} |
8177
|
8177
|
if (!empty($val['showoncombobox'])) { |
8178
|
|
- $tmpfieldstoshow .= ($tmpfieldstoshow ? ',' : '') . 't.' . $key; |
|
8178
|
+ $tmpfieldstoshow .= ($tmpfieldstoshow ? ',' : '').'t.'.$key; |
8179
|
8179
|
} |
8180
|
8180
|
} |
8181
|
8181
|
if ($tmpfieldstoshow) { |
|
@@ -8203,18 +8203,18 @@ discard block |
|
|
block discarded – undo |
8203
|
8203
|
$num = 0; |
8204
|
8204
|
|
8205
|
8205
|
// Search data |
8206
|
|
- $sql = "SELECT t.rowid, " . $fieldstoshow . " FROM " . $this->db->prefix() . $objecttmp->table_element . " as t"; |
|
8206
|
+ $sql = "SELECT t.rowid, ".$fieldstoshow." FROM ".$this->db->prefix().$objecttmp->table_element." as t"; |
8207
|
8207
|
if (!empty($objecttmp->isextrafieldmanaged)) { |
8208
|
|
- $sql .= " LEFT JOIN " . $this->db->prefix() . $objecttmp->table_element . "_extrafields as e ON t.rowid=e.fk_object"; |
|
8208
|
+ $sql .= " LEFT JOIN ".$this->db->prefix().$objecttmp->table_element."_extrafields as e ON t.rowid=e.fk_object"; |
8209
|
8209
|
} |
8210
|
8210
|
if (isset($objecttmp->ismultientitymanaged)) { |
8211
|
8211
|
if (!is_numeric($objecttmp->ismultientitymanaged)) { |
8212
|
8212
|
$tmparray = explode('@', $objecttmp->ismultientitymanaged); |
8213
|
|
- $sql .= " INNER JOIN " . $this->db->prefix() . $tmparray[1] . " as parenttable ON parenttable.rowid = t." . $tmparray[0]; |
|
8213
|
+ $sql .= " INNER JOIN ".$this->db->prefix().$tmparray[1]." as parenttable ON parenttable.rowid = t.".$tmparray[0]; |
8214
|
8214
|
} |
8215
|
8215
|
if ($objecttmp->ismultientitymanaged === 'fk_soc@societe') { |
8216
|
8216
|
if (!$user->hasRight('societe', 'client', 'voir') && !$user->socid) { |
8217
|
|
- $sql .= ", " . $this->db->prefix() . "societe_commerciaux as sc"; |
|
8217
|
+ $sql .= ", ".$this->db->prefix()."societe_commerciaux as sc"; |
8218
|
8218
|
} |
8219
|
8219
|
} |
8220
|
8220
|
} |
|
@@ -8234,21 +8234,21 @@ discard block |
|
|
block discarded – undo |
8234
|
8234
|
$sql .= " WHERE 1=1"; |
8235
|
8235
|
if (isset($objecttmp->ismultientitymanaged)) { |
8236
|
8236
|
if ($objecttmp->ismultientitymanaged == 1) { |
8237
|
|
- $sql .= " AND t.entity IN (" . getEntity($objecttmp->table_element) . ")"; |
|
8237
|
+ $sql .= " AND t.entity IN (".getEntity($objecttmp->table_element).")"; |
8238
|
8238
|
} |
8239
|
8239
|
if (!is_numeric($objecttmp->ismultientitymanaged)) { |
8240
|
|
- $sql .= " AND parenttable.entity = t." . $tmparray[0]; |
|
8240
|
+ $sql .= " AND parenttable.entity = t.".$tmparray[0]; |
8241
|
8241
|
} |
8242
|
8242
|
if ($objecttmp->ismultientitymanaged == 1 && !empty($user->socid)) { |
8243
|
8243
|
if ($objecttmp->element == 'societe') { |
8244
|
|
- $sql .= " AND t.rowid = " . ((int) $user->socid); |
|
8244
|
+ $sql .= " AND t.rowid = ".((int) $user->socid); |
8245
|
8245
|
} else { |
8246
|
|
- $sql .= " AND t.fk_soc = " . ((int) $user->socid); |
|
8246
|
+ $sql .= " AND t.fk_soc = ".((int) $user->socid); |
8247
|
8247
|
} |
8248
|
8248
|
} |
8249
|
8249
|
if ($objecttmp->ismultientitymanaged === 'fk_soc@societe') { |
8250
|
8250
|
if (!$user->hasRight('societe', 'client', 'voir') && !$user->socid) { |
8251
|
|
- $sql .= " AND t.rowid = sc.fk_soc AND sc.fk_user = " . ((int) $user->id); |
|
8251
|
+ $sql .= " AND t.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id); |
8252
|
8252
|
} |
8253
|
8253
|
} |
8254
|
8254
|
} |
|
@@ -8260,7 +8260,7 @@ discard block |
|
|
block discarded – undo |
8260
|
8260
|
$errormessage = ''; |
8261
|
8261
|
$sql .= forgeSQLFromUniversalSearchCriteria($filter, $errormessage); |
8262
|
8262
|
if ($errormessage) { |
8263
|
|
- return 'Error forging a SQL request from an universal criteria: ' . $errormessage; |
|
8263
|
+ return 'Error forging a SQL request from an universal criteria: '.$errormessage; |
8264
|
8264
|
} |
8265
|
8265
|
} |
8266
|
8266
|
} |
|
@@ -8272,7 +8272,7 @@ discard block |
|
|
block discarded – undo |
8272
|
8272
|
$resql = $this->db->query($sql); |
8273
|
8273
|
if ($resql) { |
8274
|
8274
|
// Construct $out and $outarray |
8275
|
|
- $out .= '<select id="' . $htmlname . '" class="flat minwidth100' . ($morecss ? ' ' . $morecss : '') . '"' . ($disabled ? ' disabled="disabled"' : '') . ($moreparams ? ' ' . $moreparams : '') . ' name="' . $htmlname . '">' . "\n"; |
|
8275
|
+ $out .= '<select id="'.$htmlname.'" class="flat minwidth100'.($morecss ? ' '.$morecss : '').'"'.($disabled ? ' disabled="disabled"' : '').($moreparams ? ' '.$moreparams : '').' name="'.$htmlname.'">'."\n"; |
8276
|
8276
|
|
8277
|
8277
|
// Warning: Do not use textifempty = ' ' or ' ' here, or search on key will search on ' key'. Seems it is no more true with selec2 v4 |
8278
|
8278
|
$textifempty = ' '; |
|
@@ -8286,7 +8286,7 @@ discard block |
|
|
block discarded – undo |
8286
|
8286
|
} |
8287
|
8287
|
} |
8288
|
8288
|
if ($showempty) { |
8289
|
|
- $out .= '<option value="-1">' . $textifempty . '</option>' . "\n"; |
|
8289
|
+ $out .= '<option value="-1">'.$textifempty.'</option>'."\n"; |
8290
|
8290
|
} |
8291
|
8291
|
|
8292
|
8292
|
$num = $this->db->num_rows($resql); |
|
@@ -8309,9 +8309,9 @@ discard block |
|
|
block discarded – undo |
8309
|
8309
|
} |
8310
|
8310
|
if (empty($outputmode)) { |
8311
|
8311
|
if ($preselectedvalue > 0 && $preselectedvalue == $obj->rowid) { |
8312
|
|
- $out .= '<option value="' . $obj->rowid . '" selected data-html="' . dol_escape_htmltag($labelhtml, 0, 0, '', 0, 1) . '">' . dol_escape_htmltag($label, 0, 0, '', 0, 1) . '</option>'; |
|
8312
|
+ $out .= '<option value="'.$obj->rowid.'" selected data-html="'.dol_escape_htmltag($labelhtml, 0, 0, '', 0, 1).'">'.dol_escape_htmltag($label, 0, 0, '', 0, 1).'</option>'; |
8313
|
8313
|
} else { |
8314
|
|
- $out .= '<option value="' . $obj->rowid . '" data-html="' . dol_escape_htmltag($labelhtml, 0, 0, '', 0, 1) . '">' . dol_escape_htmltag($label, 0, 0, '', 0, 1) . '</option>'; |
|
8314
|
+ $out .= '<option value="'.$obj->rowid.'" data-html="'.dol_escape_htmltag($labelhtml, 0, 0, '', 0, 1).'">'.dol_escape_htmltag($label, 0, 0, '', 0, 1).'</option>'; |
8315
|
8315
|
} |
8316
|
8316
|
} else { |
8317
|
8317
|
array_push($outarray, array('key' => $obj->rowid, 'value' => $label, 'label' => $label)); |
|
@@ -8324,10 +8324,10 @@ discard block |
|
|
block discarded – undo |
8324
|
8324
|
} |
8325
|
8325
|
} |
8326
|
8326
|
|
8327
|
|
- $out .= '</select>' . "\n"; |
|
8327
|
+ $out .= '</select>'."\n"; |
8328
|
8328
|
|
8329
|
8329
|
if (!$forcecombo) { |
8330
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
8330
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
8331
|
8331
|
$out .= ajax_combobox($htmlname, null, getDolGlobalInt($confkeyforautocompletemode, 0)); |
8332
|
8332
|
} |
8333
|
8333
|
} else { |
|
@@ -8389,8 +8389,8 @@ discard block |
|
|
block discarded – undo |
8389
|
8389
|
} |
8390
|
8390
|
} |
8391
|
8391
|
$idname = str_replace(array('[', ']'), array('', ''), $htmlname); |
8392
|
|
- $out .= '<select id="' . preg_replace('/^\./', '', $idname) . '" ' . ($disabled ? 'disabled="disabled" ' : '') . 'class="flat ' . (preg_replace('/^\./', '', $htmlname)) . ($morecss ? ' ' . $morecss : '') . ' selectformat"'; |
8393
|
|
- $out .= ' name="' . preg_replace('/^\./', '', $htmlname) . '" ' . ($moreparam ? $moreparam : ''); |
|
8392
|
+ $out .= '<select id="'.preg_replace('/^\./', '', $idname).'" '.($disabled ? 'disabled="disabled" ' : '').'class="flat '.(preg_replace('/^\./', '', $htmlname)).($morecss ? ' '.$morecss : '').' selectformat"'; |
|
8393
|
+ $out .= ' name="'.preg_replace('/^\./', '', $htmlname).'" '.($moreparam ? $moreparam : ''); |
8394
|
8394
|
$out .= '>'."\n"; |
8395
|
8395
|
|
8396
|
8396
|
if ($show_empty) { |
|
@@ -8401,7 +8401,7 @@ discard block |
|
|
block discarded – undo |
8401
|
8401
|
if (!is_numeric($show_empty)) { |
8402
|
8402
|
$textforempty = $show_empty; |
8403
|
8403
|
} |
8404
|
|
- $out .= '<option class="optiongrey" ' . ($moreparamonempty ? $moreparamonempty . ' ' : '') . 'value="' . (((int) $show_empty) < 0 ? $show_empty : -1) . '"' . ($id == $show_empty ? ' selected' : '') . '>' . $textforempty . '</option>' . "\n"; |
|
8404
|
+ $out .= '<option class="optiongrey" '.($moreparamonempty ? $moreparamonempty.' ' : '').'value="'.(((int) $show_empty) < 0 ? $show_empty : -1).'"'.($id == $show_empty ? ' selected' : '').'>'.$textforempty.'</option>'."\n"; |
8405
|
8405
|
} |
8406
|
8406
|
if (is_array($array)) { |
8407
|
8407
|
// Translate |
|
@@ -8424,7 +8424,7 @@ discard block |
|
|
block discarded – undo |
8424
|
8424
|
if (is_array($tmpvalue)) { |
8425
|
8425
|
$value = $tmpvalue['label']; |
8426
|
8426
|
$disabled = empty($tmpvalue['disabled']) ? '' : ' disabled'; |
8427
|
|
- $style = empty($tmpvalue['css']) ? '' : ' class="' . $tmpvalue['css'] . '"'; |
|
8427
|
+ $style = empty($tmpvalue['css']) ? '' : ' class="'.$tmpvalue['css'].'"'; |
8428
|
8428
|
} else { |
8429
|
8429
|
$value = $tmpvalue; |
8430
|
8430
|
$disabled = ''; |
|
@@ -8439,9 +8439,9 @@ discard block |
|
|
block discarded – undo |
8439
|
8439
|
} |
8440
|
8440
|
if ($key_in_label) { |
8441
|
8441
|
if (empty($nohtmlescape)) { |
8442
|
|
- $selectOptionValue = dol_escape_htmltag($key . ' - ' . ($maxlen ? dol_trunc($value, $maxlen) : $value)); |
|
8442
|
+ $selectOptionValue = dol_escape_htmltag($key.' - '.($maxlen ? dol_trunc($value, $maxlen) : $value)); |
8443
|
8443
|
} else { |
8444
|
|
- $selectOptionValue = $key . ' - ' . ($maxlen ? dol_trunc($value, $maxlen) : $value); |
|
8444
|
+ $selectOptionValue = $key.' - '.($maxlen ? dol_trunc($value, $maxlen) : $value); |
8445
|
8445
|
} |
8446
|
8446
|
} else { |
8447
|
8447
|
if (empty($nohtmlescape)) { |
|
@@ -8453,8 +8453,8 @@ discard block |
|
|
block discarded – undo |
8453
|
8453
|
$selectOptionValue = ' '; |
8454
|
8454
|
} |
8455
|
8455
|
} |
8456
|
|
- $out .= '<option value="' . $key . '"'; |
8457
|
|
- $out .= $style . $disabled; |
|
8456
|
+ $out .= '<option value="'.$key.'"'; |
|
8457
|
+ $out .= $style.$disabled; |
8458
|
8458
|
if (is_array($id)) { |
8459
|
8459
|
if (in_array($key, $id) && !$disabled) { |
8460
|
8460
|
$out .= ' selected'; // To preselect a value |
|
@@ -8466,7 +8466,7 @@ discard block |
|
|
block discarded – undo |
8466
|
8466
|
} |
8467
|
8467
|
} |
8468
|
8468
|
if ($nohtmlescape) { |
8469
|
|
- $out .= ' data-html="' . dol_escape_htmltag($selectOptionValue) . '"'; |
|
8469
|
+ $out .= ' data-html="'.dol_escape_htmltag($selectOptionValue).'"'; |
8470
|
8470
|
} |
8471
|
8471
|
if (is_array($tmpvalue)) { |
8472
|
8472
|
foreach ($tmpvalue as $keyforvalue => $valueforvalue) { |
|
@@ -8484,7 +8484,7 @@ discard block |
|
|
block discarded – undo |
8484
|
8484
|
// Add code for jquery to use multiselect |
8485
|
8485
|
if ($addjscombo && $jsbeautify) { |
8486
|
8486
|
// Enhance with select2 |
8487
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
8487
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
8488
|
8488
|
$out .= ajax_combobox($idname, array(), 0, 0, 'resolve', (((int) $show_empty) < 0 ? (string) $show_empty : '-1'), $morecss); |
8489
|
8489
|
} |
8490
|
8490
|
|
|
@@ -8516,28 +8516,28 @@ discard block |
|
|
block discarded – undo |
8516
|
8516
|
public static function selectArrayAjax($htmlname, $url, $id = '', $moreparam = '', $moreparamtourl = '', $disabled = 0, $minimumInputLength = 1, $morecss = '', $callurlonselect = 0, $placeholder = '', $acceptdelayedhtml = 0) |
8517
|
8517
|
{ |
8518
|
8518
|
global $conf, $langs; |
8519
|
|
- global $delayedhtmlcontent; // Will be used later outside of this function |
|
8519
|
+ global $delayedhtmlcontent; // Will be used later outside of this function |
8520
|
8520
|
|
8521
|
8521
|
// TODO Use an internal dolibarr component instead of select2 |
8522
|
8522
|
if (!getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') && !defined('REQUIRE_JQUERY_MULTISELECT')) { |
8523
|
8523
|
return ''; |
8524
|
8524
|
} |
8525
|
8525
|
|
8526
|
|
- $out = '<select type="text" class="' . $htmlname . ($morecss ? ' ' . $morecss : '') . '" ' . ($moreparam ? $moreparam . ' ' : '') . 'name="' . $htmlname . '"></select>'; |
|
8526
|
+ $out = '<select type="text" class="'.$htmlname.($morecss ? ' '.$morecss : '').'" '.($moreparam ? $moreparam.' ' : '').'name="'.$htmlname.'"></select>'; |
8527
|
8527
|
|
8528
|
8528
|
$outdelayed = ''; |
8529
|
8529
|
if (!empty($conf->use_javascript_ajax)) { |
8530
|
8530
|
$tmpplugin = 'select2'; |
8531
|
|
- $outdelayed = "\n" . '<!-- JS CODE TO ENABLE ' . $tmpplugin . ' for id ' . $htmlname . ' --> |
8532
|
|
- <script nonce="' . getNonce() . '"> |
|
8531
|
+ $outdelayed = "\n".'<!-- JS CODE TO ENABLE '.$tmpplugin.' for id '.$htmlname.' --> |
|
8532
|
+ <script nonce="' . getNonce().'"> |
8533
|
8533
|
$(document).ready(function () { |
8534
|
8534
|
|
8535
|
|
- ' . ($callurlonselect ? 'var saveRemoteData = [];' : '') . ' |
|
8535
|
+ ' . ($callurlonselect ? 'var saveRemoteData = [];' : '').' |
8536
|
8536
|
|
8537
|
|
- $(".' . $htmlname . '").select2({ |
|
8537
|
+ $(".' . $htmlname.'").select2({ |
8538
|
8538
|
ajax: { |
8539
|
8539
|
dir: "ltr", |
8540
|
|
- url: "' . $url . '", |
|
8540
|
+ url: "' . $url.'", |
8541
|
8541
|
dataType: \'json\', |
8542
|
8542
|
delay: 250, |
8543
|
8543
|
data: function (params) { |
|
@@ -8564,9 +8564,9 @@ discard block |
|
|
block discarded – undo |
8564
|
8564
|
}, |
8565
|
8565
|
language: select2arrayoflanguage, |
8566
|
8566
|
containerCssClass: \':all:\', /* Line to add class of origin SELECT propagated to the new <span class="select2-selection...> tag */ |
8567
|
|
- placeholder: "' . dol_escape_js($placeholder) . '", |
|
8567
|
+ placeholder: "' . dol_escape_js($placeholder).'", |
8568
|
8568
|
escapeMarkup: function (markup) { return markup; }, // let our custom formatter work |
8569
|
|
- minimumInputLength: ' . ((int) $minimumInputLength) . ', |
|
8569
|
+ minimumInputLength: ' . ((int) $minimumInputLength).', |
8570
|
8570
|
formatResult: function (result, container, query, escapeMarkup) { |
8571
|
8571
|
return escapeMarkup(result.text); |
8572
|
8572
|
}, |
|
@@ -8574,10 +8574,10 @@ discard block |
|
|
block discarded – undo |
8574
|
8574
|
|
8575
|
8575
|
' . ($callurlonselect ? ' |
8576
|
8576
|
/* Code to execute a GET when we select a value */ |
8577
|
|
- $(".' . $htmlname . '").change(function() { |
8578
|
|
- var selected = $(".' . $htmlname . '").val(); |
|
8577
|
+ $(".' . $htmlname.'").change(function() { |
|
8578
|
+ var selected = $(".' . $htmlname.'").val(); |
8579
|
8579
|
console.log("We select in selectArrayAjax the entry "+selected) |
8580
|
|
- $(".' . $htmlname . '").val(""); /* reset visible combo value */ |
|
8580
|
+ $(".' . $htmlname.'").val(""); /* reset visible combo value */ |
8581
|
8581
|
$.each( saveRemoteData, function( key, value ) { |
8582
|
8582
|
if (key == selected) |
8583
|
8583
|
{ |
|
@@ -8585,7 +8585,7 @@ discard block |
|
|
block discarded – undo |
8585
|
8585
|
location.assign(value.url); |
8586
|
8586
|
} |
8587
|
8587
|
}); |
8588
|
|
- });' : '') . ' |
|
8588
|
+ });' : '').' |
8589
|
8589
|
|
8590
|
8590
|
}); |
8591
|
8591
|
</script>'; |
|
@@ -8621,14 +8621,14 @@ discard block |
|
|
block discarded – undo |
8621
|
8621
|
public static function selectArrayFilter($htmlname, $array, $id = '', $moreparam = '', $disableFiltering = 0, $disabled = 0, $minimumInputLength = 1, $morecss = '', $callurlonselect = 0, $placeholder = '', $acceptdelayedhtml = 0, $textfortitle = '') |
8622
|
8622
|
{ |
8623
|
8623
|
global $conf, $langs; |
8624
|
|
- global $delayedhtmlcontent; // Will be used later outside of this function |
|
8624
|
+ global $delayedhtmlcontent; // Will be used later outside of this function |
8625
|
8625
|
|
8626
|
8626
|
// TODO Use an internal dolibarr component instead of select2 |
8627
|
8627
|
if (!getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') && !defined('REQUIRE_JQUERY_MULTISELECT')) { |
8628
|
8628
|
return ''; |
8629
|
8629
|
} |
8630
|
8630
|
|
8631
|
|
- $out = '<select type="text"'.($textfortitle ? ' title="'.dol_escape_htmltag($textfortitle).'"' : '').' id="'.$htmlname.'" class="'.$htmlname.($morecss ? ' ' . $morecss : '').'"'.($moreparam ? ' '.$moreparam : '').' name="'.$htmlname.'"><option></option></select>'; |
|
8631
|
+ $out = '<select type="text"'.($textfortitle ? ' title="'.dol_escape_htmltag($textfortitle).'"' : '').' id="'.$htmlname.'" class="'.$htmlname.($morecss ? ' '.$morecss : '').'"'.($moreparam ? ' '.$moreparam : '').' name="'.$htmlname.'"><option></option></select>'; |
8632
|
8632
|
|
8633
|
8633
|
$formattedarrayresult = array(); |
8634
|
8634
|
|
|
@@ -8643,20 +8643,20 @@ discard block |
|
|
block discarded – undo |
8643
|
8643
|
$outdelayed = ''; |
8644
|
8644
|
if (!empty($conf->use_javascript_ajax)) { |
8645
|
8645
|
$tmpplugin = 'select2'; |
8646
|
|
- $outdelayed = "\n" . '<!-- JS CODE TO ENABLE ' . $tmpplugin . ' for id ' . $htmlname . ' --> |
8647
|
|
- <script nonce="' . getNonce() . '"> |
|
8646
|
+ $outdelayed = "\n".'<!-- JS CODE TO ENABLE '.$tmpplugin.' for id '.$htmlname.' --> |
|
8647
|
+ <script nonce="' . getNonce().'"> |
8648
|
8648
|
$(document).ready(function () { |
8649
|
|
- var data = ' . json_encode($formattedarrayresult) . '; |
|
8649
|
+ var data = ' . json_encode($formattedarrayresult).'; |
8650
|
8650
|
|
8651
|
|
- ' . ($callurlonselect ? 'var saveRemoteData = ' . json_encode($array) . ';' : '') . ' |
|
8651
|
+ ' . ($callurlonselect ? 'var saveRemoteData = '.json_encode($array).';' : '').' |
8652
|
8652
|
|
8653
|
|
- $(".' . $htmlname . '").select2({ |
|
8653
|
+ $(".' . $htmlname.'").select2({ |
8654
|
8654
|
data: data, |
8655
|
8655
|
language: select2arrayoflanguage, |
8656
|
8656
|
containerCssClass: \':all:\', /* Line to add class of origin SELECT propagated to the new <span class="select2-selection...> tag */ |
8657
|
|
- placeholder: "' . dol_escape_js($placeholder) . '", |
|
8657
|
+ placeholder: "' . dol_escape_js($placeholder).'", |
8658
|
8658
|
escapeMarkup: function (markup) { return markup; }, // let our custom formatter work |
8659
|
|
- minimumInputLength: ' . $minimumInputLength . ', |
|
8659
|
+ minimumInputLength: ' . $minimumInputLength.', |
8660
|
8660
|
formatResult: function (result, container, query, escapeMarkup) { |
8661
|
8661
|
return escapeMarkup(result.text); |
8662
|
8662
|
}, |
|
@@ -8695,11 +8695,11 @@ discard block |
|
|
block discarded – undo |
8695
|
8695
|
|
8696
|
8696
|
' . ($callurlonselect ? ' |
8697
|
8697
|
/* Code to execute a GET when we select a value */ |
8698
|
|
- $(".' . $htmlname . '").change(function() { |
8699
|
|
- var selected = $(".' . $htmlname . '").val(); |
|
8698
|
+ $(".' . $htmlname.'").change(function() { |
|
8699
|
+ var selected = $(".' . $htmlname.'").val(); |
8700
|
8700
|
console.log("We select "+selected) |
8701
|
8701
|
|
8702
|
|
- $(".' . $htmlname . '").val(""); /* reset visible combo value */ |
|
8702
|
+ $(".' . $htmlname.'").val(""); /* reset visible combo value */ |
8703
|
8703
|
$.each( saveRemoteData, function( key, value ) { |
8704
|
8704
|
if (key == selected) |
8705
|
8705
|
{ |
|
@@ -8707,7 +8707,7 @@ discard block |
|
|
block discarded – undo |
8707
|
8707
|
location.assign(value.url); |
8708
|
8708
|
} |
8709
|
8709
|
}); |
8710
|
|
- });' : '') . ' |
|
8710
|
+ });' : '').' |
8711
|
8711
|
|
8712
|
8712
|
}); |
8713
|
8713
|
</script>'; |
|
@@ -8759,7 +8759,7 @@ discard block |
|
|
block discarded – undo |
8759
|
8759
|
} |
8760
|
8760
|
|
8761
|
8761
|
// Output select component |
8762
|
|
- $out .= '<select id="' . $htmlname . '" class="multiselect' . ($useenhancedmultiselect ? ' multiselectononeline' : '') . ($morecss ? ' ' . $morecss : '') . '" multiple name="' . $htmlname . '[]"' . ($moreattrib ? ' ' . $moreattrib : '') . ($width ? ' style="width: ' . (preg_match('/%/', $width) ? $width : $width . 'px') . '"' : '') . '>' . "\n"; |
|
8762
|
+ $out .= '<select id="'.$htmlname.'" class="multiselect'.($useenhancedmultiselect ? ' multiselectononeline' : '').($morecss ? ' '.$morecss : '').'" multiple name="'.$htmlname.'[]"'.($moreattrib ? ' '.$moreattrib : '').($width ? ' style="width: '.(preg_match('/%/', $width) ? $width : $width.'px').'"' : '').'>'."\n"; |
8763
|
8763
|
if (is_array($array) && !empty($array)) { |
8764
|
8764
|
if ($value_as_key) { |
8765
|
8765
|
$array = array_combine($array, $array); |
|
@@ -8780,57 +8780,57 @@ discard block |
|
|
block discarded – undo |
8780
|
8780
|
$tmplabelhtml = empty($value['labelhtml']) ? '' : $value['labelhtml']; |
8781
|
8781
|
} |
8782
|
8782
|
$newval = ($translate ? $langs->trans($tmpvalue) : $tmpvalue); |
8783
|
|
- $newval = ($key_in_label ? $tmpkey . ' - ' . $newval : $newval); |
|
8783
|
+ $newval = ($key_in_label ? $tmpkey.' - '.$newval : $newval); |
8784
|
8784
|
|
8785
|
|
- $out .= '<option value="' . $tmpkey . '"'; |
|
8785
|
+ $out .= '<option value="'.$tmpkey.'"'; |
8786
|
8786
|
if (is_array($selected) && !empty($selected) && in_array((string) $tmpkey, $selected) && ((string) $tmpkey != '')) { |
8787
|
8787
|
$out .= ' selected'; |
8788
|
8788
|
} |
8789
|
8789
|
if (!empty($tmplabelhtml)) { |
8790
|
|
- $out .= ' data-html="' . dol_escape_htmltag($tmplabelhtml, 0, 0, '', 0, 1) . '"'; |
|
8790
|
+ $out .= ' data-html="'.dol_escape_htmltag($tmplabelhtml, 0, 0, '', 0, 1).'"'; |
8791
|
8791
|
} else { |
8792
|
|
- $tmplabelhtml = ($tmppicto ? img_picto('', $tmppicto, 'class="pictofixedwidth" style="color: #' . $tmpcolor . '"') : '') . $newval; |
8793
|
|
- $out .= ' data-html="' . dol_escape_htmltag($tmplabelhtml, 0, 0, '', 0, 1) . '"'; |
|
8792
|
+ $tmplabelhtml = ($tmppicto ? img_picto('', $tmppicto, 'class="pictofixedwidth" style="color: #'.$tmpcolor.'"') : '').$newval; |
|
8793
|
+ $out .= ' data-html="'.dol_escape_htmltag($tmplabelhtml, 0, 0, '', 0, 1).'"'; |
8794
|
8794
|
} |
8795
|
8795
|
$out .= '>'; |
8796
|
8796
|
$out .= dol_htmlentitiesbr($newval); |
8797
|
|
- $out .= '</option>' . "\n"; |
|
8797
|
+ $out .= '</option>'."\n"; |
8798
|
8798
|
} |
8799
|
8799
|
} |
8800
|
8800
|
} |
8801
|
|
- $out .= '</select>' . "\n"; |
|
8801
|
+ $out .= '</select>'."\n"; |
8802
|
8802
|
|
8803
|
8803
|
// Add code for jquery to use multiselect |
8804
|
8804
|
if (!empty($conf->use_javascript_ajax) && getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') || defined('REQUIRE_JQUERY_MULTISELECT')) { |
8805
|
|
- $out .= "\n" . '<!-- JS CODE TO ENABLE select for id ' . $htmlname . ', addjscombo=' . $addjscombo . ' -->'; |
8806
|
|
- $out .= "\n" . '<script nonce="' . getNonce() . '">' . "\n"; |
|
8805
|
+ $out .= "\n".'<!-- JS CODE TO ENABLE select for id '.$htmlname.', addjscombo='.$addjscombo.' -->'; |
|
8806
|
+ $out .= "\n".'<script nonce="'.getNonce().'">'."\n"; |
8807
|
8807
|
if ($addjscombo == 1) { |
8808
|
8808
|
$tmpplugin = !getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') ? constant('REQUIRE_JQUERY_MULTISELECT') : $conf->global->MAIN_USE_JQUERY_MULTISELECT; |
8809
|
|
- $out .= 'function formatResult(record, container) {' . "\n"; |
|
8809
|
+ $out .= 'function formatResult(record, container) {'."\n"; |
8810
|
8810
|
// If property html set, we decode html entities and use this. |
8811
|
8811
|
// Note that HTML content must have been sanitized from js with dol_escape_htmltag(xxx, 0, 0, '', 0, 1) when building the select option. |
8812
|
8812
|
$out .= ' if ($(record.element).attr("data-html") != undefined) { return htmlEntityDecodeJs($(record.element).attr("data-html")); }'."\n"; |
8813
|
8813
|
$out .= ' return record.text;'; |
8814
|
|
- $out .= '}' . "\n"; |
8815
|
|
- $out .= 'function formatSelection(record) {' . "\n"; |
|
8814
|
+ $out .= '}'."\n"; |
|
8815
|
+ $out .= 'function formatSelection(record) {'."\n"; |
8816
|
8816
|
if ($elemtype == 'category') { |
8817
|
|
- $out .= 'return \'<span><img src="' . DOL_URL_ROOT . '/theme/eldy/img/object_category.png"> \'+record.text+\'</span>\';'; |
|
8817
|
+ $out .= 'return \'<span><img src="'.DOL_URL_ROOT.'/theme/eldy/img/object_category.png"> \'+record.text+\'</span>\';'; |
8818
|
8818
|
} else { |
8819
|
8819
|
$out .= 'return record.text;'; |
8820
|
8820
|
} |
8821
|
|
- $out .= '}' . "\n"; |
|
8821
|
+ $out .= '}'."\n"; |
8822
|
8822
|
$out .= '$(document).ready(function () { |
8823
|
|
- $(\'#' . $htmlname . '\').' . $tmpplugin . '({'; |
|
8823
|
+ $(\'#' . $htmlname.'\').'.$tmpplugin.'({'; |
8824
|
8824
|
if ($placeholder) { |
8825
|
8825
|
$out .= ' |
8826
|
8826
|
placeholder: { |
8827
|
8827
|
id: \'-1\', |
8828
|
|
- text: \'' . dol_escape_js($placeholder) . '\' |
|
8828
|
+ text: \'' . dol_escape_js($placeholder).'\' |
8829
|
8829
|
},'; |
8830
|
8830
|
} |
8831
|
8831
|
$out .= ' dir: \'ltr\', |
8832
|
8832
|
containerCssClass: \':all:\', /* Line to add class of origin SELECT propagated to the new <span class="select2-selection...> tag (ko with multiselect) */ |
8833
|
|
- dropdownCssClass: \'' . $morecss . '\', /* Line to add class on the new <span class="select2-selection...> tag (ok with multiselect) */ |
|
8833
|
+ dropdownCssClass: \'' . $morecss.'\', /* Line to add class on the new <span class="select2-selection...> tag (ok with multiselect) */ |
8834
|
8834
|
// Specify format function for dropdown item |
8835
|
8835
|
formatResult: formatResult, |
8836
|
8836
|
templateResult: formatResult, /* For 4.0 */ |
|
@@ -8842,21 +8842,21 @@ discard block |
|
|
block discarded – undo |
8842
|
8842
|
|
8843
|
8843
|
/* Add also morecss to the css .select2 that is after the #htmlname, for component that are show dynamically after load, because select2 set |
8844
|
8844
|
the size only if component is not hidden by default on load */ |
8845
|
|
- $(\'#' . $htmlname . ' + .select2\').addClass(\'' . $morecss . '\'); |
|
8845
|
+ $(\'#' . $htmlname.' + .select2\').addClass(\''.$morecss.'\'); |
8846
|
8846
|
});' . "\n"; |
8847
|
8847
|
} elseif ($addjscombo == 2 && !defined('DISABLE_MULTISELECT')) { |
8848
|
8848
|
// Add other js lib |
8849
|
8849
|
// TODO external lib multiselect/jquery.multi-select.js must have been loaded to use this multiselect plugin |
8850
|
8850
|
// ... |
8851
|
|
- $out .= 'console.log(\'addjscombo=2 for htmlname=' . $htmlname . '\');'; |
|
8851
|
+ $out .= 'console.log(\'addjscombo=2 for htmlname='.$htmlname.'\');'; |
8852
|
8852
|
$out .= '$(document).ready(function () { |
8853
|
|
- $(\'#' . $htmlname . '\').multiSelect({ |
|
8853
|
+ $(\'#' . $htmlname.'\').multiSelect({ |
8854
|
8854
|
containerHTML: \'<div class="multi-select-container">\', |
8855
|
8855
|
menuHTML: \'<div class="multi-select-menu">\', |
8856
|
|
- buttonHTML: \'<span class="multi-select-button ' . $morecss . '">\', |
|
8856
|
+ buttonHTML: \'<span class="multi-select-button ' . $morecss.'">\', |
8857
|
8857
|
menuItemHTML: \'<label class="multi-select-menuitem">\', |
8858
|
8858
|
activeClass: \'multi-select-container--open\', |
8859
|
|
- noneText: \'' . $placeholder . '\' |
|
8859
|
+ noneText: \'' . $placeholder.'\' |
8860
|
8860
|
}); |
8861
|
8861
|
})'; |
8862
|
8862
|
} |
|
@@ -8888,7 +8888,7 @@ discard block |
|
|
block discarded – undo |
8888
|
8888
|
return ''; |
8889
|
8889
|
} |
8890
|
8890
|
|
8891
|
|
- $tmpvar = "MAIN_SELECTEDFIELDS_" . $varpage; // To get list of saved selected fields to show |
|
8891
|
+ $tmpvar = "MAIN_SELECTEDFIELDS_".$varpage; // To get list of saved selected fields to show |
8892
|
8892
|
|
8893
|
8893
|
if (!empty($user->conf->$tmpvar)) { // A list of fields was already customized for user |
8894
|
8894
|
$tmparray = explode(',', $user->conf->$tmpvar); |
|
@@ -8931,19 +8931,19 @@ discard block |
|
|
block discarded – undo |
8931
|
8931
|
} |
8932
|
8932
|
|
8933
|
8933
|
// Note: $val['checked'] <> 0 means we must show the field into the combo list |
8934
|
|
- $listoffieldsforselection .= '<li><input type="checkbox" id="checkbox' . $key . '" value="' . $key . '"' . ((empty($val['checked']) || $val['checked'] == '-1') ? '' : ' checked="checked"') . '/><label for="checkbox' . $key . '">' . dol_escape_htmltag($langs->trans($val['label'])) . '</label></li>'; |
8935
|
|
- $listcheckedstring .= (empty($val['checked']) ? '' : $key . ','); |
|
8934
|
+ $listoffieldsforselection .= '<li><input type="checkbox" id="checkbox'.$key.'" value="'.$key.'"'.((empty($val['checked']) || $val['checked'] == '-1') ? '' : ' checked="checked"').'/><label for="checkbox'.$key.'">'.dol_escape_htmltag($langs->trans($val['label'])).'</label></li>'; |
|
8935
|
+ $listcheckedstring .= (empty($val['checked']) ? '' : $key.','); |
8936
|
8936
|
} |
8937
|
8937
|
} |
8938
|
8938
|
|
8939
|
|
- $out = '<!-- Component multiSelectArrayWithCheckbox ' . $htmlname . ' --> |
|
8939
|
+ $out = '<!-- Component multiSelectArrayWithCheckbox '.$htmlname.' --> |
8940
|
8940
|
|
8941
|
8941
|
<dl class="dropdown"> |
8942
|
8942
|
<dt> |
8943
|
|
- <a href="#' . $htmlname . '"> |
8944
|
|
- ' . img_picto('', 'list') . ' |
|
8943
|
+ <a href="#' . $htmlname.'"> |
|
8944
|
+ ' . img_picto('', 'list').' |
8945
|
8945
|
</a> |
8946
|
|
- <input type="hidden" class="' . $htmlname . '" name="' . $htmlname . '" value="' . $listcheckedstring . '"> |
|
8946
|
+ <input type="hidden" class="' . $htmlname.'" name="'.$htmlname.'" value="'.$listcheckedstring.'"> |
8947
|
8947
|
</dt> |
8948
|
8948
|
<dd class="dropdowndd"> |
8949
|
8949
|
<div class="multiselectcheckbox'.$htmlname.'"> |
|
@@ -8955,19 +8955,19 @@ discard block |
|
|
block discarded – undo |
8955
|
8955
|
</dd> |
8956
|
8956
|
</dl> |
8957
|
8957
|
|
8958
|
|
- <script nonce="' . getNonce() . '" type="text/javascript"> |
|
8958
|
+ <script nonce="' . getNonce().'" type="text/javascript"> |
8959
|
8959
|
jQuery(document).ready(function () { |
8960
|
|
- $(\'.multiselectcheckbox' . $htmlname . ' input[type="checkbox"]\').on(\'click\', function () { |
|
8960
|
+ $(\'.multiselectcheckbox' . $htmlname.' input[type="checkbox"]\').on(\'click\', function () { |
8961
|
8961
|
console.log("A new field was added/removed, we edit field input[name=formfilteraction]"); |
8962
|
8962
|
|
8963
|
8963
|
$("input:hidden[name=formfilteraction]").val(\'listafterchangingselectedfields\'); // Update field so we know we changed something on selected fields after POST |
8964
|
8964
|
|
8965
|
8965
|
var title = $(this).val() + ","; |
8966
|
8966
|
if ($(this).is(\':checked\')) { |
8967
|
|
- $(\'.' . $htmlname . '\').val(title + $(\'.' . $htmlname . '\').val()); |
|
8967
|
+ $(\'.' . $htmlname.'\').val(title + $(\'.'.$htmlname.'\').val()); |
8968
|
8968
|
} |
8969
|
8969
|
else { |
8970
|
|
- $(\'.' . $htmlname . '\').val( $(\'.' . $htmlname . '\').val().replace(title, \'\') ) |
|
8970
|
+ $(\'.' . $htmlname.'\').val( $(\'.'.$htmlname.'\').val().replace(title, \'\') ) |
8971
|
8971
|
} |
8972
|
8972
|
// Now, we submit page |
8973
|
8973
|
//$(this).parents(\'form:first\').submit(); |
|
@@ -8998,7 +8998,7 @@ discard block |
|
|
block discarded – undo |
8998
|
8998
|
*/ |
8999
|
8999
|
public function showCategories($id, $type, $rendermode = 0, $nolink = 0) |
9000
|
9000
|
{ |
9001
|
|
- include_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; |
|
9001
|
+ include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; |
9002
|
9002
|
|
9003
|
9003
|
$cat = new Categorie($this->db); |
9004
|
9004
|
$categories = $cat->containing($id, $type); |
|
@@ -9008,10 +9008,10 @@ discard block |
|
|
block discarded – undo |
9008
|
9008
|
foreach ($categories as $c) { |
9009
|
9009
|
$ways = $c->print_all_ways(' >> ', ($nolink ? 'none' : ''), 0, 1); // $ways[0] = "ccc2 >> ccc2a >> ccc2a1" with html formated text |
9010
|
9010
|
foreach ($ways as $way) { |
9011
|
|
- $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"' . ($c->color ? ' style="background: #' . $c->color . ';"' : ' style="background: #bbb"') . '>' . $way . '</li>'; |
|
9011
|
+ $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"'.($c->color ? ' style="background: #'.$c->color.';"' : ' style="background: #bbb"').'>'.$way.'</li>'; |
9012
|
9012
|
} |
9013
|
9013
|
} |
9014
|
|
- return '<div class="select2-container-multi-dolibarr"><ul class="select2-choices-dolibarr">' . implode(' ', $toprint) . '</ul></div>'; |
|
9014
|
+ return '<div class="select2-container-multi-dolibarr"><ul class="select2-choices-dolibarr">'.implode(' ', $toprint).'</ul></div>'; |
9015
|
9015
|
} |
9016
|
9016
|
|
9017
|
9017
|
if ($rendermode == 0) { |
|
@@ -9059,15 +9059,15 @@ discard block |
|
|
block discarded – undo |
9059
|
9059
|
|
9060
|
9060
|
|
9061
|
9061
|
print '<div class="div-table-responsive-no-min">'; |
9062
|
|
- print '<table class="noborder allwidth" data-block="showLinkedObject" data-element="' . $object->element . '" data-elementid="' . $object->id . '" >'; |
|
9062
|
+ print '<table class="noborder allwidth" data-block="showLinkedObject" data-element="'.$object->element.'" data-elementid="'.$object->id.'" >'; |
9063
|
9063
|
|
9064
|
9064
|
print '<tr class="liste_titre">'; |
9065
|
|
- print '<td>' . $langs->trans("Type") . '</td>'; |
9066
|
|
- print '<td>' . $langs->trans("Ref") . '</td>'; |
|
9065
|
+ print '<td>'.$langs->trans("Type").'</td>'; |
|
9066
|
+ print '<td>'.$langs->trans("Ref").'</td>'; |
9067
|
9067
|
print '<td class="center"></td>'; |
9068
|
|
- print '<td class="center">' . $langs->trans("Date") . '</td>'; |
9069
|
|
- print '<td class="right">' . $langs->trans("AmountHTShort") . '</td>'; |
9070
|
|
- print '<td class="right">' . $langs->trans("Status") . '</td>'; |
|
9068
|
+ print '<td class="center">'.$langs->trans("Date").'</td>'; |
|
9069
|
+ print '<td class="right">'.$langs->trans("AmountHTShort").'</td>'; |
|
9070
|
+ print '<td class="right">'.$langs->trans("Status").'</td>'; |
9071
|
9071
|
print '<td></td>'; |
9072
|
9072
|
print '</tr>'; |
9073
|
9073
|
|
|
@@ -9086,13 +9086,13 @@ discard block |
|
|
block discarded – undo |
9086
|
9086
|
if ($objecttype != 'supplier_proposal' && preg_match('/^([^_]+)_([^_]+)/i', $objecttype, $regs)) { |
9087
|
9087
|
$element = $regs[1]; |
9088
|
9088
|
$subelement = $regs[2]; |
9089
|
|
- $tplpath = $element . '/' . $subelement; |
|
9089
|
+ $tplpath = $element.'/'.$subelement; |
9090
|
9090
|
} |
9091
|
9091
|
$tplname = 'linkedobjectblock'; |
9092
|
9092
|
|
9093
|
9093
|
// To work with non standard path |
9094
|
9094
|
if ($objecttype == 'facture') { |
9095
|
|
- $tplpath = 'compta/' . $element; |
|
9095
|
+ $tplpath = 'compta/'.$element; |
9096
|
9096
|
if (!isModEnabled('facture')) { |
9097
|
9097
|
continue; // Do not show if module disabled |
9098
|
9098
|
} |
|
@@ -9103,7 +9103,7 @@ discard block |
|
|
block discarded – undo |
9103
|
9103
|
continue; // Do not show if module disabled |
9104
|
9104
|
} |
9105
|
9105
|
} elseif ($objecttype == 'propal') { |
9106
|
|
- $tplpath = 'comm/' . $element; |
|
9106
|
+ $tplpath = 'comm/'.$element; |
9107
|
9107
|
if (!isModEnabled('propal')) { |
9108
|
9108
|
continue; // Do not show if module disabled |
9109
|
9109
|
} |
|
@@ -9154,14 +9154,14 @@ discard block |
|
|
block discarded – undo |
9154
|
9154
|
$linkedObjectBlock = $objects; |
9155
|
9155
|
|
9156
|
9156
|
// Output template part (modules that overwrite templates must declare this into descriptor) |
9157
|
|
- $dirtpls = array_merge($conf->modules_parts['tpl'], array('/' . $tplpath . '/tpl')); |
|
9157
|
+ $dirtpls = array_merge($conf->modules_parts['tpl'], array('/'.$tplpath.'/tpl')); |
9158
|
9158
|
foreach ($dirtpls as $reldir) { |
9159
|
9159
|
if ($nboftypesoutput == ($nbofdifferenttypes - 1)) { // No more type to show after |
9160
|
9160
|
global $noMoreLinkedObjectBlockAfter; |
9161
|
9161
|
$noMoreLinkedObjectBlockAfter = 1; |
9162
|
9162
|
} |
9163
|
9163
|
|
9164
|
|
- $res = @include dol_buildpath($reldir . '/' . $tplname . '.tpl.php'); |
|
9164
|
+ $res = @include dol_buildpath($reldir.'/'.$tplname.'.tpl.php'); |
9165
|
9165
|
if ($res) { |
9166
|
9166
|
$nboftypesoutput++; |
9167
|
9167
|
break; |
|
@@ -9170,7 +9170,7 @@ discard block |
|
|
block discarded – undo |
9170
|
9170
|
} |
9171
|
9171
|
|
9172
|
9172
|
if (!$nboftypesoutput) { |
9173
|
|
- print '<tr><td class="impair" colspan="7"><span class="opacitymedium">' . $langs->trans("None") . '</span></td></tr>'; |
|
9173
|
+ print '<tr><td class="impair" colspan="7"><span class="opacitymedium">'.$langs->trans("None").'</span></td></tr>'; |
9174
|
9174
|
} |
9175
|
9175
|
|
9176
|
9176
|
print '</table>'; |
|
@@ -9210,14 +9210,14 @@ discard block |
|
|
block discarded – undo |
9210
|
9210
|
if (is_object($object->thirdparty) && !empty($object->thirdparty->id) && $object->thirdparty->id > 0) { |
9211
|
9211
|
$listofidcompanytoscan = $object->thirdparty->id; |
9212
|
9212
|
if (($object->thirdparty->parent > 0) && getDolGlobalString('THIRDPARTY_INCLUDE_PARENT_IN_LINKTO')) { |
9213
|
|
- $listofidcompanytoscan .= ',' . $object->thirdparty->parent; |
|
9213
|
+ $listofidcompanytoscan .= ','.$object->thirdparty->parent; |
9214
|
9214
|
} |
9215
|
9215
|
if (($object->fk_project > 0) && getDolGlobalString('THIRDPARTY_INCLUDE_PROJECT_THIRDPARY_IN_LINKTO')) { |
9216
|
|
- include_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; |
|
9216
|
+ include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; |
9217
|
9217
|
$tmpproject = new Project($this->db); |
9218
|
9218
|
$tmpproject->fetch($object->fk_project); |
9219
|
9219
|
if ($tmpproject->socid > 0 && ($tmpproject->socid != $object->thirdparty->id)) { |
9220
|
|
- $listofidcompanytoscan .= ',' . $tmpproject->socid; |
|
9220
|
+ $listofidcompanytoscan .= ','.$tmpproject->socid; |
9221
|
9221
|
} |
9222
|
9222
|
unset($tmpproject); |
9223
|
9223
|
} |
|
@@ -9227,63 +9227,63 @@ discard block |
|
|
block discarded – undo |
9227
|
9227
|
'enabled' => isModEnabled('propal'), |
9228
|
9228
|
'perms' => 1, |
9229
|
9229
|
'label' => 'LinkToProposal', |
9230
|
|
- 'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM " . $this->db->prefix() . "societe as s, " . $this->db->prefix() . "propal as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (" . $this->db->sanitize($listofidcompanytoscan) . ') AND t.entity IN (' . getEntity('propal') . ')'), |
|
9230
|
+ 'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."propal as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('propal').')'), |
9231
|
9231
|
'shipping' => array( |
9232
|
9232
|
'enabled' => isModEnabled('expedition'), |
9233
|
9233
|
'perms' => 1, |
9234
|
9234
|
'label' => 'LinkToExpedition', |
9235
|
|
- 'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref FROM " . $this->db->prefix() . "societe as s, " . $this->db->prefix() . "expedition as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (" . $this->db->sanitize($listofidcompanytoscan) . ') AND t.entity IN (' . getEntity('shipping') . ')'), |
|
9235
|
+ 'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."expedition as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('shipping').')'), |
9236
|
9236
|
'order' => array( |
9237
|
9237
|
'enabled' => isModEnabled('commande'), |
9238
|
9238
|
'perms' => 1, |
9239
|
9239
|
'label' => 'LinkToOrder', |
9240
|
|
- 'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM " . $this->db->prefix() . "societe as s, " . $this->db->prefix() . "commande as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (" . $this->db->sanitize($listofidcompanytoscan) . ') AND t.entity IN (' . getEntity('commande') . ')'), |
|
9240
|
+ 'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."commande as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('commande').')'), |
9241
|
9241
|
'invoice' => array( |
9242
|
9242
|
'enabled' => isModEnabled('facture'), |
9243
|
9243
|
'perms' => 1, |
9244
|
9244
|
'label' => 'LinkToInvoice', |
9245
|
|
- 'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM " . $this->db->prefix() . "societe as s, " . $this->db->prefix() . "facture as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (" . $this->db->sanitize($listofidcompanytoscan) . ') AND t.entity IN (' . getEntity('invoice') . ')'), |
|
9245
|
+ 'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."facture as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('invoice').')'), |
9246
|
9246
|
'invoice_template' => array( |
9247
|
9247
|
'enabled' => isModEnabled('facture'), |
9248
|
9248
|
'perms' => 1, |
9249
|
9249
|
'label' => 'LinkToTemplateInvoice', |
9250
|
|
- 'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.titre as ref, t.total_ht FROM " . $this->db->prefix() . "societe as s, " . $this->db->prefix() . "facture_rec as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (" . $this->db->sanitize($listofidcompanytoscan) . ') AND t.entity IN (' . getEntity('invoice') . ')'), |
|
9250
|
+ 'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.titre as ref, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."facture_rec as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('invoice').')'), |
9251
|
9251
|
'contrat' => array( |
9252
|
9252
|
'enabled' => isModEnabled('contrat'), |
9253
|
9253
|
'perms' => 1, |
9254
|
9254
|
'label' => 'LinkToContract', |
9255
|
9255
|
'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_customer as ref_client, t.ref_supplier, SUM(td.total_ht) as total_ht |
9256
|
|
- FROM " . $this->db->prefix() . "societe as s, " . $this->db->prefix() . "contrat as t, " . $this->db->prefix() . "contratdet as td WHERE t.fk_soc = s.rowid AND td.fk_contrat = t.rowid AND t.fk_soc IN (" . $this->db->sanitize($listofidcompanytoscan) . ') AND t.entity IN (' . getEntity('contract') . ') GROUP BY s.rowid, s.nom, s.client, t.rowid, t.ref, t.ref_customer, t.ref_supplier' |
|
9256
|
+ FROM " . $this->db->prefix()."societe as s, ".$this->db->prefix()."contrat as t, ".$this->db->prefix()."contratdet as td WHERE t.fk_soc = s.rowid AND td.fk_contrat = t.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('contract').') GROUP BY s.rowid, s.nom, s.client, t.rowid, t.ref, t.ref_customer, t.ref_supplier' |
9257
|
9257
|
), |
9258
|
9258
|
'fichinter' => array( |
9259
|
9259
|
'enabled' => isModEnabled('ficheinter'), |
9260
|
9260
|
'perms' => 1, |
9261
|
9261
|
'label' => 'LinkToIntervention', |
9262
|
|
- 'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref FROM " . $this->db->prefix() . "societe as s, " . $this->db->prefix() . "fichinter as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (" . $this->db->sanitize($listofidcompanytoscan) . ') AND t.entity IN (' . getEntity('intervention') . ')'), |
|
9262
|
+ 'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."fichinter as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('intervention').')'), |
9263
|
9263
|
'supplier_proposal' => array( |
9264
|
9264
|
'enabled' => isModEnabled('supplier_proposal'), |
9265
|
9265
|
'perms' => 1, |
9266
|
9266
|
'label' => 'LinkToSupplierProposal', |
9267
|
|
- 'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, '' as ref_supplier, t.total_ht FROM " . $this->db->prefix() . "societe as s, " . $this->db->prefix() . "supplier_proposal as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (" . $this->db->sanitize($listofidcompanytoscan) . ') AND t.entity IN (' . getEntity('supplier_proposal') . ')'), |
|
9267
|
+ 'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, '' as ref_supplier, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."supplier_proposal as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('supplier_proposal').')'), |
9268
|
9268
|
'order_supplier' => array( |
9269
|
9269
|
'enabled' => isModEnabled("supplier_order"), |
9270
|
9270
|
'perms' => 1, |
9271
|
9271
|
'label' => 'LinkToSupplierOrder', |
9272
|
|
- 'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM " . $this->db->prefix() . "societe as s, " . $this->db->prefix() . "commande_fournisseur as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (" . $this->db->sanitize($listofidcompanytoscan) . ') AND t.entity IN (' . getEntity('commande_fournisseur') . ')'), |
|
9272
|
+ 'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."commande_fournisseur as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('commande_fournisseur').')'), |
9273
|
9273
|
'invoice_supplier' => array( |
9274
|
9274
|
'enabled' => isModEnabled("supplier_invoice"), |
9275
|
9275
|
'perms' => 1, 'label' => 'LinkToSupplierInvoice', |
9276
|
|
- 'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM " . $this->db->prefix() . "societe as s, " . $this->db->prefix() . "facture_fourn as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (" . $this->db->sanitize($listofidcompanytoscan) . ') AND t.entity IN (' . getEntity('facture_fourn') . ')'), |
|
9276
|
+ 'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."facture_fourn as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('facture_fourn').')'), |
9277
|
9277
|
'ticket' => array( |
9278
|
9278
|
'enabled' => isModEnabled('ticket'), |
9279
|
9279
|
'perms' => 1, |
9280
|
9280
|
'label' => 'LinkToTicket', |
9281
|
|
- 'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.track_id, '0' as total_ht FROM " . $this->db->prefix() . "societe as s, " . $this->db->prefix() . "ticket as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (" . $this->db->sanitize($listofidcompanytoscan) . ') AND t.entity IN (' . getEntity('ticket') . ')'), |
|
9281
|
+ 'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.track_id, '0' as total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."ticket as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('ticket').')'), |
9282
|
9282
|
'mo' => array( |
9283
|
9283
|
'enabled' => isModEnabled('mrp'), |
9284
|
9284
|
'perms' => 1, |
9285
|
9285
|
'label' => 'LinkToMo', |
9286
|
|
- 'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.rowid, '0' as total_ht FROM " . $this->db->prefix() . "societe as s INNER JOIN " . $this->db->prefix() . "mrp_mo as t ON t.fk_soc = s.rowid WHERE t.fk_soc IN (" . $this->db->sanitize($listofidcompanytoscan) . ') AND t.entity IN (' . getEntity('mo') . ')') |
|
9286
|
+ 'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.rowid, '0' as total_ht FROM ".$this->db->prefix()."societe as s INNER JOIN ".$this->db->prefix()."mrp_mo as t ON t.fk_soc = s.rowid WHERE t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('mo').')') |
9287
|
9287
|
); |
9288
|
9288
|
} |
9289
|
9289
|
|
|
@@ -9318,22 +9318,22 @@ discard block |
|
|
block discarded – undo |
9318
|
9318
|
} |
9319
|
9319
|
|
9320
|
9320
|
if (!empty($possiblelink['perms']) && (empty($restrictlinksto) || in_array($key, $restrictlinksto)) && (empty($excludelinksto) || !in_array($key, $excludelinksto))) { |
9321
|
|
- print '<div id="' . $key . 'list"' . (empty($conf->use_javascript_ajax) ? '' : ' style="display:none"') . '>'; |
|
9321
|
+ print '<div id="'.$key.'list"'.(empty($conf->use_javascript_ajax) ? '' : ' style="display:none"').'>'; |
9322
|
9322
|
|
9323
|
9323
|
if (getDolGlobalString('MAIN_LINK_BY_REF_IN_LINKTO')) { |
9324
|
9324
|
print '<br>'."\n"; |
9325
|
9325
|
print '<!-- form to add a link from anywhere -->'."\n"; |
9326
|
|
- print '<form action="' . $_SERVER["PHP_SELF"] . '" method="POST" name="formlinkedbyref' . $key . '">'; |
9327
|
|
- print '<input type="hidden" name="id" value="' . $object->id . '">'; |
|
9326
|
+ print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" name="formlinkedbyref'.$key.'">'; |
|
9327
|
+ print '<input type="hidden" name="id" value="'.$object->id.'">'; |
9328
|
9328
|
print '<input type="hidden" name="action" value="addlinkbyref">'; |
9329
|
|
- print '<input type="hidden" name="token" value="' . newToken() . '">'; |
9330
|
|
- print '<input type="hidden" name="addlink" value="' . $key . '">'; |
|
9329
|
+ print '<input type="hidden" name="token" value="'.newToken().'">'; |
|
9330
|
+ print '<input type="hidden" name="addlink" value="'.$key.'">'; |
9331
|
9331
|
print '<table class="noborder">'; |
9332
|
9332
|
print '<tr>'; |
9333
|
9333
|
//print '<td>' . $langs->trans("Ref") . '</td>'; |
9334
|
|
- print '<td class="center"><input type="text" placeholder="'.dol_escape_htmltag($langs->trans("Ref")).'" name="reftolinkto" value="' . dol_escape_htmltag(GETPOST('reftolinkto', 'alpha')) . '"> '; |
9335
|
|
- print '<input type="submit" class="button small valignmiddle" value="' . $langs->trans('ToLink') . '"> '; |
9336
|
|
- print '<input type="submit" class="button small" name="cancel" value="' . $langs->trans('Cancel') . '"></td>'; |
|
9334
|
+ print '<td class="center"><input type="text" placeholder="'.dol_escape_htmltag($langs->trans("Ref")).'" name="reftolinkto" value="'.dol_escape_htmltag(GETPOST('reftolinkto', 'alpha')).'"> '; |
|
9335
|
+ print '<input type="submit" class="button small valignmiddle" value="'.$langs->trans('ToLink').'"> '; |
|
9336
|
+ print '<input type="submit" class="button small" name="cancel" value="'.$langs->trans('Cancel').'"></td>'; |
9337
|
9337
|
print '</tr>'; |
9338
|
9338
|
print '</table>'; |
9339
|
9339
|
print '</form>'; |
|
@@ -9348,48 +9348,48 @@ discard block |
|
|
block discarded – undo |
9348
|
9348
|
|
9349
|
9349
|
print '<br>'; |
9350
|
9350
|
print '<!-- form to add a link from object to same thirdparty -->'."\n"; |
9351
|
|
- print '<form action="' . $_SERVER["PHP_SELF"] . '" method="POST" name="formlinked' . $key . '">'; |
|
9351
|
+ print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" name="formlinked'.$key.'">'; |
9352
|
9352
|
print '<input type="hidden" name="action" value="addlink">'; |
9353
|
|
- print '<input type="hidden" name="token" value="' . newToken() . '">'; |
9354
|
|
- print '<input type="hidden" name="id" value="' . $object->id . '">'; |
9355
|
|
- print '<input type="hidden" name="addlink" value="' . $key . '">'; |
|
9353
|
+ print '<input type="hidden" name="token" value="'.newToken().'">'; |
|
9354
|
+ print '<input type="hidden" name="id" value="'.$object->id.'">'; |
|
9355
|
+ print '<input type="hidden" name="addlink" value="'.$key.'">'; |
9356
|
9356
|
print '<table class="noborder">'; |
9357
|
9357
|
print '<tr class="liste_titre">'; |
9358
|
9358
|
print '<td class="nowrap"></td>'; |
9359
|
|
- print '<td class="center">' . $langs->trans("Ref") . '</td>'; |
9360
|
|
- print '<td class="left">' . $langs->trans("RefCustomer") . '</td>'; |
9361
|
|
- print '<td class="right">' . $langs->trans("AmountHTShort") . '</td>'; |
9362
|
|
- print '<td class="left">' . $langs->trans("Company") . '</td>'; |
|
9359
|
+ print '<td class="center">'.$langs->trans("Ref").'</td>'; |
|
9360
|
+ print '<td class="left">'.$langs->trans("RefCustomer").'</td>'; |
|
9361
|
+ print '<td class="right">'.$langs->trans("AmountHTShort").'</td>'; |
|
9362
|
+ print '<td class="left">'.$langs->trans("Company").'</td>'; |
9363
|
9363
|
print '</tr>'; |
9364
|
9364
|
while ($i < $num) { |
9365
|
9365
|
$objp = $this->db->fetch_object($resqllist); |
9366
|
9366
|
|
9367
|
9367
|
print '<tr class="oddeven">'; |
9368
|
9368
|
print '<td class="left">'; |
9369
|
|
- print '<input type="radio" name="idtolinkto" id="' . $key . '_' . $objp->rowid . '" value="' . $objp->rowid . '">'; |
|
9369
|
+ print '<input type="radio" name="idtolinkto" id="'.$key.'_'.$objp->rowid.'" value="'.$objp->rowid.'">'; |
9370
|
9370
|
print '</td>'; |
9371
|
|
- print '<td class="center"><label for="' . $key . '_' . $objp->rowid . '">' . $objp->ref . '</label></td>'; |
9372
|
|
- print '<td>' . (!empty($objp->ref_client) ? $objp->ref_client : (!empty($objp->ref_supplier) ? $objp->ref_supplier : '')) . '</td>'; |
|
9371
|
+ print '<td class="center"><label for="'.$key.'_'.$objp->rowid.'">'.$objp->ref.'</label></td>'; |
|
9372
|
+ print '<td>'.(!empty($objp->ref_client) ? $objp->ref_client : (!empty($objp->ref_supplier) ? $objp->ref_supplier : '')).'</td>'; |
9373
|
9373
|
print '<td class="right">'; |
9374
|
9374
|
if ($possiblelink['label'] == 'LinkToContract') { |
9375
|
9375
|
$form = new Form($this->db); |
9376
|
|
- print $form->textwithpicto('', $langs->trans("InformationOnLinkToContract")) . ' '; |
|
9376
|
+ print $form->textwithpicto('', $langs->trans("InformationOnLinkToContract")).' '; |
9377
|
9377
|
} |
9378
|
|
- print '<span class="amount">' . (isset($objp->total_ht) ? price($objp->total_ht) : '') . '</span>'; |
|
9378
|
+ print '<span class="amount">'.(isset($objp->total_ht) ? price($objp->total_ht) : '').'</span>'; |
9379
|
9379
|
print '</td>'; |
9380
|
|
- print '<td>' . $objp->name . '</td>'; |
|
9380
|
+ print '<td>'.$objp->name.'</td>'; |
9381
|
9381
|
print '</tr>'; |
9382
|
9382
|
$i++; |
9383
|
9383
|
} |
9384
|
9384
|
print '</table>'; |
9385
|
9385
|
print '<div class="center">'; |
9386
|
9386
|
if ($num) { |
9387
|
|
- print '<input type="submit" class="button valignmiddle marginleftonly marginrightonly small" value="' . $langs->trans('ToLink') . '">'; |
|
9387
|
+ print '<input type="submit" class="button valignmiddle marginleftonly marginrightonly small" value="'.$langs->trans('ToLink').'">'; |
9388
|
9388
|
} |
9389
|
9389
|
if (empty($conf->use_javascript_ajax)) { |
9390
|
|
- print '<input type="submit" class="button button-cancel marginleftonly marginrightonly small" name="cancel" value="' . $langs->trans("Cancel") . '"></div>'; |
|
9390
|
+ print '<input type="submit" class="button button-cancel marginleftonly marginrightonly small" name="cancel" value="'.$langs->trans("Cancel").'"></div>'; |
9391
|
9391
|
} else { |
9392
|
|
- print '<input type="submit" onclick="jQuery(\'#' . $key . 'list\').toggle(); return false;" class="button button-cancel marginleftonly marginrightonly small" name="cancel" value="' . $langs->trans("Cancel") . '"></div>'; |
|
9392
|
+ print '<input type="submit" onclick="jQuery(\'#'.$key.'list\').toggle(); return false;" class="button button-cancel marginleftonly marginrightonly small" name="cancel" value="'.$langs->trans("Cancel").'"></div>'; |
9393
|
9393
|
} |
9394
|
9394
|
print '</form>'; |
9395
|
9395
|
$this->db->free($resqllist); |
|
@@ -9400,10 +9400,10 @@ discard block |
|
|
block discarded – undo |
9400
|
9400
|
|
9401
|
9401
|
//$linktoelem.=($linktoelem?' ':''); |
9402
|
9402
|
if ($num > 0 || getDolGlobalString('MAIN_LINK_BY_REF_IN_LINKTO')) { |
9403
|
|
- $linktoelemlist .= '<li><a href="#linkto' . $key . '" class="linkto dropdowncloseonclick" rel="' . $key . '">' . $langs->trans($possiblelink['label']) . ' (' . $num . ')</a></li>'; |
|
9403
|
+ $linktoelemlist .= '<li><a href="#linkto'.$key.'" class="linkto dropdowncloseonclick" rel="'.$key.'">'.$langs->trans($possiblelink['label']).' ('.$num.')</a></li>'; |
9404
|
9404
|
// } else $linktoelem.=$langs->trans($possiblelink['label']); |
9405
|
9405
|
} else { |
9406
|
|
- $linktoelemlist .= '<li><span class="linktodisabled">' . $langs->trans($possiblelink['label']) . ' (0)</span></li>'; |
|
9406
|
+ $linktoelemlist .= '<li><span class="linktodisabled">'.$langs->trans($possiblelink['label']).' (0)</span></li>'; |
9407
|
9407
|
} |
9408
|
9408
|
} |
9409
|
9409
|
} |
|
@@ -9413,11 +9413,11 @@ discard block |
|
|
block discarded – undo |
9413
|
9413
|
<dl class="dropdown" id="linktoobjectname"> |
9414
|
9414
|
'; |
9415
|
9415
|
if (!empty($conf->use_javascript_ajax)) { |
9416
|
|
- $linktoelem .= '<dt><a href="#linktoobjectname"><span class="fas fa-link paddingrightonly"></span>' . $langs->trans("LinkTo") . '...</a></dt>'; |
|
9416
|
+ $linktoelem .= '<dt><a href="#linktoobjectname"><span class="fas fa-link paddingrightonly"></span>'.$langs->trans("LinkTo").'...</a></dt>'; |
9417
|
9417
|
} |
9418
|
9418
|
$linktoelem .= '<dd> |
9419
|
9419
|
<div class="multiselectlinkto"> |
9420
|
|
- <ul class="ulselectedfields">' . $linktoelemlist . ' |
|
9420
|
+ <ul class="ulselectedfields">' . $linktoelemlist.' |
9421
|
9421
|
</ul> |
9422
|
9422
|
</div> |
9423
|
9423
|
</dd> |
|
@@ -9428,7 +9428,7 @@ discard block |
|
|
block discarded – undo |
9428
|
9428
|
|
9429
|
9429
|
if (!empty($conf->use_javascript_ajax)) { |
9430
|
9430
|
print '<!-- Add js to show linkto box --> |
9431
|
|
- <script nonce="' . getNonce() . '"> |
|
9431
|
+ <script nonce="' . getNonce().'"> |
9432
|
9432
|
jQuery(document).ready(function() { |
9433
|
9433
|
jQuery(".linkto").click(function() { |
9434
|
9434
|
console.log("We choose to show/hide links for rel="+jQuery(this).attr(\'rel\')+" so #"+jQuery(this).attr(\'rel\')+"list"); |
|
@@ -9469,19 +9469,19 @@ discard block |
|
|
block discarded – undo |
9469
|
9469
|
|
9470
|
9470
|
$disabled = ($disabled ? ' disabled' : ''); |
9471
|
9471
|
|
9472
|
|
- $resultyesno = '<select class="flat width75' . ($morecss ? ' ' . $morecss : '') . '" id="' . $htmlname . '" name="' . $htmlname . '"' . $disabled . '>' . "\n"; |
|
9472
|
+ $resultyesno = '<select class="flat width75'.($morecss ? ' '.$morecss : '').'" id="'.$htmlname.'" name="'.$htmlname.'"'.$disabled.'>'."\n"; |
9473
|
9473
|
if ($useempty) { |
9474
|
|
- $resultyesno .= '<option value="-1"' . (($value < 0) ? ' selected' : '') . '> </option>' . "\n"; |
|
9474
|
+ $resultyesno .= '<option value="-1"'.(($value < 0) ? ' selected' : '').'> </option>'."\n"; |
9475
|
9475
|
} |
9476
|
9476
|
if (("$value" == 'yes') || ($value == 1)) { |
9477
|
|
- $resultyesno .= '<option value="' . $yes . '" selected>' . $langs->trans($labelyes) . '</option>' . "\n"; |
9478
|
|
- $resultyesno .= '<option value="' . $no . '">' . $langs->trans($labelno) . '</option>' . "\n"; |
|
9477
|
+ $resultyesno .= '<option value="'.$yes.'" selected>'.$langs->trans($labelyes).'</option>'."\n"; |
|
9478
|
+ $resultyesno .= '<option value="'.$no.'">'.$langs->trans($labelno).'</option>'."\n"; |
9479
|
9479
|
} else { |
9480
|
9480
|
$selected = (($useempty && $value != '0' && $value != 'no') ? '' : ' selected'); |
9481
|
|
- $resultyesno .= '<option value="' . $yes . '">' . $langs->trans($labelyes) . '</option>' . "\n"; |
9482
|
|
- $resultyesno .= '<option value="' . $no . '"' . $selected . '>' . $langs->trans($labelno) . '</option>' . "\n"; |
|
9481
|
+ $resultyesno .= '<option value="'.$yes.'">'.$langs->trans($labelyes).'</option>'."\n"; |
|
9482
|
+ $resultyesno .= '<option value="'.$no.'"'.$selected.'>'.$langs->trans($labelno).'</option>'."\n"; |
9483
|
9483
|
} |
9484
|
|
- $resultyesno .= '</select>' . "\n"; |
|
9484
|
+ $resultyesno .= '</select>'."\n"; |
9485
|
9485
|
|
9486
|
9486
|
if ($addjscombo) { |
9487
|
9487
|
$resultyesno .= ajax_combobox($htmlname, array(), 0, 0, 'resolve', ($useempty < 0 ? (string) $useempty : '-1'), $morecss); |
|
@@ -9505,12 +9505,12 @@ discard block |
|
|
block discarded – undo |
9505
|
9505
|
{ |
9506
|
9506
|
// phpcs:enable |
9507
|
9507
|
$sql = "SELECT rowid, label"; |
9508
|
|
- $sql .= " FROM " . $this->db->prefix() . "export_model"; |
9509
|
|
- $sql .= " WHERE type = '" . $this->db->escape($type) . "'"; |
|
9508
|
+ $sql .= " FROM ".$this->db->prefix()."export_model"; |
|
9509
|
+ $sql .= " WHERE type = '".$this->db->escape($type)."'"; |
9510
|
9510
|
$sql .= " ORDER BY rowid"; |
9511
|
9511
|
$result = $this->db->query($sql); |
9512
|
9512
|
if ($result) { |
9513
|
|
- print '<select class="flat" id="select_' . $htmlname . '" name="' . $htmlname . '">'; |
|
9513
|
+ print '<select class="flat" id="select_'.$htmlname.'" name="'.$htmlname.'">'; |
9514
|
9514
|
if ($useempty) { |
9515
|
9515
|
print '<option value="-1"> </option>'; |
9516
|
9516
|
} |
|
@@ -9520,9 +9520,9 @@ discard block |
|
|
block discarded – undo |
9520
|
9520
|
while ($i < $num) { |
9521
|
9521
|
$obj = $this->db->fetch_object($result); |
9522
|
9522
|
if ($selected == $obj->rowid) { |
9523
|
|
- print '<option value="' . $obj->rowid . '" selected>'; |
|
9523
|
+ print '<option value="'.$obj->rowid.'" selected>'; |
9524
|
9524
|
} else { |
9525
|
|
- print '<option value="' . $obj->rowid . '">'; |
|
9525
|
+ print '<option value="'.$obj->rowid.'">'; |
9526
|
9526
|
} |
9527
|
9527
|
print $obj->label; |
9528
|
9528
|
print '</option>'; |
|
@@ -9612,8 +9612,8 @@ discard block |
|
|
block discarded – undo |
9612
|
9612
|
$stringforfirstkey .= ' CTL +'; |
9613
|
9613
|
} |
9614
|
9614
|
|
9615
|
|
- $previous_ref = $object->ref_previous ? '<a accesskey="p" title="' . $stringforfirstkey . ' p" class="classfortooltip" href="' . $navurl . '?' . $paramid . '=' . urlencode($object->ref_previous) . $moreparam . '"><i class="fa fa-chevron-left"></i></a>' : '<span class="inactive"><i class="fa fa-chevron-left opacitymedium"></i></span>'; |
9616
|
|
- $next_ref = $object->ref_next ? '<a accesskey="n" title="' . $stringforfirstkey . ' n" class="classfortooltip" href="' . $navurl . '?' . $paramid . '=' . urlencode($object->ref_next) . $moreparam . '"><i class="fa fa-chevron-right"></i></a>' : '<span class="inactive"><i class="fa fa-chevron-right opacitymedium"></i></span>'; |
|
9615
|
+ $previous_ref = $object->ref_previous ? '<a accesskey="p" title="'.$stringforfirstkey.' p" class="classfortooltip" href="'.$navurl.'?'.$paramid.'='.urlencode($object->ref_previous).$moreparam.'"><i class="fa fa-chevron-left"></i></a>' : '<span class="inactive"><i class="fa fa-chevron-left opacitymedium"></i></span>'; |
|
9616
|
+ $next_ref = $object->ref_next ? '<a accesskey="n" title="'.$stringforfirstkey.' n" class="classfortooltip" href="'.$navurl.'?'.$paramid.'='.urlencode($object->ref_next).$moreparam.'"><i class="fa fa-chevron-right"></i></a>' : '<span class="inactive"><i class="fa fa-chevron-right opacitymedium"></i></span>'; |
9617
|
9617
|
} |
9618
|
9618
|
|
9619
|
9619
|
//print "xx".$previous_ref."x".$next_ref; |
|
@@ -9621,18 +9621,18 @@ discard block |
|
|
block discarded – undo |
9621
|
9621
|
|
9622
|
9622
|
// Right part of banner |
9623
|
9623
|
if ($morehtmlright) { |
9624
|
|
- $ret .= '<div class="inline-block floatleft">' . $morehtmlright . '</div>'; |
|
9624
|
+ $ret .= '<div class="inline-block floatleft">'.$morehtmlright.'</div>'; |
9625
|
9625
|
} |
9626
|
9626
|
|
9627
|
9627
|
if ($previous_ref || $next_ref || $morehtml) { |
9628
|
9628
|
$ret .= '<div class="pagination paginationref"><ul class="right">'; |
9629
|
9629
|
} |
9630
|
9630
|
if ($morehtml) { |
9631
|
|
- $ret .= '<li class="noborder litext' . (($shownav && $previous_ref && $next_ref) ? ' clearbothonsmartphone' : '') . '">' . $morehtml . '</li>'; |
|
9631
|
+ $ret .= '<li class="noborder litext'.(($shownav && $previous_ref && $next_ref) ? ' clearbothonsmartphone' : '').'">'.$morehtml.'</li>'; |
9632
|
9632
|
} |
9633
|
9633
|
if ($shownav && ($previous_ref || $next_ref)) { |
9634
|
|
- $ret .= '<li class="pagination">' . $previous_ref . '</li>'; |
9635
|
|
- $ret .= '<li class="pagination">' . $next_ref . '</li>'; |
|
9634
|
+ $ret .= '<li class="pagination">'.$previous_ref.'</li>'; |
|
9635
|
+ $ret .= '<li class="pagination">'.$next_ref.'</li>'; |
9636
|
9636
|
} |
9637
|
9637
|
if ($previous_ref || $next_ref || $morehtml) { |
9638
|
9638
|
$ret .= '</ul></div>'; |
|
@@ -9647,7 +9647,7 @@ discard block |
|
|
block discarded – undo |
9647
|
9647
|
$morehtmlstatus = $hookmanager->resPrint; |
9648
|
9648
|
} |
9649
|
9649
|
if ($morehtmlstatus) { |
9650
|
|
- $ret .= '<div class="statusref">' . $morehtmlstatus . '</div>'; |
|
9650
|
+ $ret .= '<div class="statusref">'.$morehtmlstatus.'</div>'; |
9651
|
9651
|
} |
9652
|
9652
|
|
9653
|
9653
|
$parameters = array(); |
|
@@ -9661,14 +9661,14 @@ discard block |
|
|
block discarded – undo |
9661
|
9661
|
// Left part of banner |
9662
|
9662
|
if ($morehtmlleft) { |
9663
|
9663
|
if ($conf->browser->layout == 'phone') { |
9664
|
|
- $ret .= '<!-- morehtmlleft --><div class="floatleft">' . $morehtmlleft . '</div>'; |
|
9664
|
+ $ret .= '<!-- morehtmlleft --><div class="floatleft">'.$morehtmlleft.'</div>'; |
9665
|
9665
|
} else { |
9666
|
|
- $ret .= '<!-- morehtmlleft --><div class="inline-block floatleft">' . $morehtmlleft . '</div>'; |
|
9666
|
+ $ret .= '<!-- morehtmlleft --><div class="inline-block floatleft">'.$morehtmlleft.'</div>'; |
9667
|
9667
|
} |
9668
|
9668
|
} |
9669
|
9669
|
|
9670
|
9670
|
//if ($conf->browser->layout == 'phone') $ret.='<div class="clearboth"></div>'; |
9671
|
|
- $ret .= '<div class="inline-block floatleft valignmiddle maxwidth750 marginbottomonly refid' . (($shownav && ($previous_ref || $next_ref)) ? ' refidpadding' : '') . '">'; |
|
9671
|
+ $ret .= '<div class="inline-block floatleft valignmiddle maxwidth750 marginbottomonly refid'.(($shownav && ($previous_ref || $next_ref)) ? ' refidpadding' : '').'">'; |
9672
|
9672
|
|
9673
|
9673
|
// For thirdparty, contact, user, member, the ref is the id, so we show something else |
9674
|
9674
|
if ($object->element == 'societe') { |
|
@@ -9682,7 +9682,7 @@ discard block |
|
|
block discarded – undo |
9682
|
9682
|
|
9683
|
9683
|
if (is_array($arrayoflangcode) && count($arrayoflangcode)) { |
9684
|
9684
|
if (!is_object($extralanguages)) { |
9685
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/class/extralanguages.class.php'; |
|
9685
|
+ include_once DOL_DOCUMENT_ROOT.'/core/class/extralanguages.class.php'; |
9686
|
9686
|
$extralanguages = new ExtraLanguages($this->db); |
9687
|
9687
|
} |
9688
|
9688
|
$extralanguages->fetch_name_extralanguages('societe'); |
|
@@ -9697,27 +9697,27 @@ discard block |
|
|
block discarded – undo |
9697
|
9697
|
if ($object->array_languages['name'][$extralangcode]) { |
9698
|
9698
|
$htmltext .= $object->array_languages['name'][$extralangcode]; |
9699
|
9699
|
} else { |
9700
|
|
- $htmltext .= '<span class="opacitymedium">' . $langs->trans("SwitchInEditModeToAddTranslation") . '</span>'; |
|
9700
|
+ $htmltext .= '<span class="opacitymedium">'.$langs->trans("SwitchInEditModeToAddTranslation").'</span>'; |
9701
|
9701
|
} |
9702
|
9702
|
} |
9703
|
|
- $ret .= '<!-- Show translations of name -->' . "\n"; |
|
9703
|
+ $ret .= '<!-- Show translations of name -->'."\n"; |
9704
|
9704
|
$ret .= $this->textwithpicto('', $htmltext, -1, 'language', 'opacitymedium paddingleft'); |
9705
|
9705
|
} |
9706
|
9706
|
} |
9707
|
9707
|
} elseif ($object->element == 'member') { |
9708
|
|
- $ret .= $object->ref . '<br>'; |
|
9708
|
+ $ret .= $object->ref.'<br>'; |
9709
|
9709
|
$fullname = $object->getFullName($langs); |
9710
|
9710
|
if ($object->morphy == 'mor' && $object->societe) { |
9711
|
|
- $ret .= dol_htmlentities($object->societe) . ((!empty($fullname) && $object->societe != $fullname) ? ' (' . dol_htmlentities($fullname) . $addgendertxt . ')' : ''); |
|
9711
|
+ $ret .= dol_htmlentities($object->societe).((!empty($fullname) && $object->societe != $fullname) ? ' ('.dol_htmlentities($fullname).$addgendertxt.')' : ''); |
9712
|
9712
|
} else { |
9713
|
|
- $ret .= dol_htmlentities($fullname) . $addgendertxt . ((!empty($object->societe) && $object->societe != $fullname) ? ' (' . dol_htmlentities($object->societe) . ')' : ''); |
|
9713
|
+ $ret .= dol_htmlentities($fullname).$addgendertxt.((!empty($object->societe) && $object->societe != $fullname) ? ' ('.dol_htmlentities($object->societe).')' : ''); |
9714
|
9714
|
} |
9715
|
9715
|
} elseif (in_array($object->element, array('contact', 'user'))) { |
9716
|
|
- $ret .= dol_htmlentities($object->getFullName($langs)) . $addgendertxt; |
|
9716
|
+ $ret .= dol_htmlentities($object->getFullName($langs)).$addgendertxt; |
9717
|
9717
|
} elseif ($object->element == 'usergroup') { |
9718
|
9718
|
$ret .= dol_htmlentities($object->name); |
9719
|
9719
|
} elseif (in_array($object->element, array('action', 'agenda'))) { |
9720
|
|
- $ret .= $object->ref . '<br>' . $object->label; |
|
9720
|
+ $ret .= $object->ref.'<br>'.$object->label; |
9721
|
9721
|
} elseif (in_array($object->element, array('adherent_type'))) { |
9722
|
9722
|
$ret .= $object->label; |
9723
|
9723
|
} elseif ($object->element == 'ecm_directories') { |
|
@@ -9769,9 +9769,9 @@ discard block |
|
|
block discarded – undo |
9769
|
9769
|
} |
9770
|
9770
|
|
9771
|
9771
|
// Barcode image |
9772
|
|
- $url = DOL_URL_ROOT . '/viewimage.php?modulepart=barcode&generator=' . urlencode($object->barcode_type_coder) . '&code=' . urlencode($object->barcode) . '&encoding=' . urlencode($object->barcode_type_code); |
9773
|
|
- $out = '<!-- url barcode = ' . $url . ' -->'; |
9774
|
|
- $out .= '<img src="' . $url . '"' . ($morecss ? ' class="' . $morecss . '"' : '') . '>'; |
|
9772
|
+ $url = DOL_URL_ROOT.'/viewimage.php?modulepart=barcode&generator='.urlencode($object->barcode_type_coder).'&code='.urlencode($object->barcode).'&encoding='.urlencode($object->barcode_type_code); |
|
9773
|
+ $out = '<!-- url barcode = '.$url.' -->'; |
|
9774
|
+ $out .= '<img src="'.$url.'"'.($morecss ? ' class="'.$morecss.'"' : '').'>'; |
9775
|
9775
|
|
9776
|
9776
|
return $out; |
9777
|
9777
|
} |
|
@@ -9811,28 +9811,28 @@ discard block |
|
|
block discarded – undo |
9811
|
9811
|
if (!empty($object->logo)) { |
9812
|
9812
|
if (dolIsAllowedForPreview($object->logo)) { |
9813
|
9813
|
if ((string) $imagesize == 'mini') { |
9814
|
|
- $file = get_exdir(0, 0, 0, 0, $object, 'thirdparty') . 'logos/' . getImageFileNameForSize($object->logo, '_mini'); // getImageFileNameForSize include the thumbs |
|
9814
|
+ $file = get_exdir(0, 0, 0, 0, $object, 'thirdparty').'logos/'.getImageFileNameForSize($object->logo, '_mini'); // getImageFileNameForSize include the thumbs |
9815
|
9815
|
} elseif ((string) $imagesize == 'small') { |
9816
|
|
- $file = get_exdir(0, 0, 0, 0, $object, 'thirdparty') . 'logos/' . getImageFileNameForSize($object->logo, '_small'); |
|
9816
|
+ $file = get_exdir(0, 0, 0, 0, $object, 'thirdparty').'logos/'.getImageFileNameForSize($object->logo, '_small'); |
9817
|
9817
|
} else { |
9818
|
|
- $file = get_exdir(0, 0, 0, 0, $object, 'thirdparty') . 'logos/' . $object->logo; |
|
9818
|
+ $file = get_exdir(0, 0, 0, 0, $object, 'thirdparty').'logos/'.$object->logo; |
9819
|
9819
|
} |
9820
|
|
- $originalfile = get_exdir(0, 0, 0, 0, $object, 'thirdparty') . 'logos/' . $object->logo; |
|
9820
|
+ $originalfile = get_exdir(0, 0, 0, 0, $object, 'thirdparty').'logos/'.$object->logo; |
9821
|
9821
|
} |
9822
|
9822
|
} |
9823
|
9823
|
$email = $object->email; |
9824
|
9824
|
} elseif ($modulepart == 'contact') { |
9825
|
|
- $dir = $conf->societe->multidir_output[$entity] . '/contact'; |
|
9825
|
+ $dir = $conf->societe->multidir_output[$entity].'/contact'; |
9826
|
9826
|
if (!empty($object->photo)) { |
9827
|
9827
|
if (dolIsAllowedForPreview($object->photo)) { |
9828
|
9828
|
if ((string) $imagesize == 'mini') { |
9829
|
|
- $file = get_exdir(0, 0, 0, 0, $object, 'contact') . 'photos/' . getImageFileNameForSize($object->photo, '_mini'); |
|
9829
|
+ $file = get_exdir(0, 0, 0, 0, $object, 'contact').'photos/'.getImageFileNameForSize($object->photo, '_mini'); |
9830
|
9830
|
} elseif ((string) $imagesize == 'small') { |
9831
|
|
- $file = get_exdir(0, 0, 0, 0, $object, 'contact') . 'photos/' . getImageFileNameForSize($object->photo, '_small'); |
|
9831
|
+ $file = get_exdir(0, 0, 0, 0, $object, 'contact').'photos/'.getImageFileNameForSize($object->photo, '_small'); |
9832
|
9832
|
} else { |
9833
|
|
- $file = get_exdir(0, 0, 0, 0, $object, 'contact') . 'photos/' . $object->photo; |
|
9833
|
+ $file = get_exdir(0, 0, 0, 0, $object, 'contact').'photos/'.$object->photo; |
9834
|
9834
|
} |
9835
|
|
- $originalfile = get_exdir(0, 0, 0, 0, $object, 'contact') . 'photos/' . $object->photo; |
|
9835
|
+ $originalfile = get_exdir(0, 0, 0, 0, $object, 'contact').'photos/'.$object->photo; |
9836
|
9836
|
} |
9837
|
9837
|
} |
9838
|
9838
|
$email = $object->email; |
|
@@ -9842,17 +9842,17 @@ discard block |
|
|
block discarded – undo |
9842
|
9842
|
if (!empty($object->photo)) { |
9843
|
9843
|
if (dolIsAllowedForPreview($object->photo)) { |
9844
|
9844
|
if ((string) $imagesize == 'mini') { |
9845
|
|
- $file = get_exdir(0, 0, 0, 0, $object, 'user') . 'photos/' . getImageFileNameForSize($object->photo, '_mini'); |
|
9845
|
+ $file = get_exdir(0, 0, 0, 0, $object, 'user').'photos/'.getImageFileNameForSize($object->photo, '_mini'); |
9846
|
9846
|
} elseif ((string) $imagesize == 'small') { |
9847
|
|
- $file = get_exdir(0, 0, 0, 0, $object, 'user') . 'photos/' . getImageFileNameForSize($object->photo, '_small'); |
|
9847
|
+ $file = get_exdir(0, 0, 0, 0, $object, 'user').'photos/'.getImageFileNameForSize($object->photo, '_small'); |
9848
|
9848
|
} else { |
9849
|
|
- $file = get_exdir(0, 0, 0, 0, $object, 'user') . 'photos/' . $object->photo; |
|
9849
|
+ $file = get_exdir(0, 0, 0, 0, $object, 'user').'photos/'.$object->photo; |
9850
|
9850
|
} |
9851
|
|
- $originalfile = get_exdir(0, 0, 0, 0, $object, 'user') . 'photos/' . $object->photo; |
|
9851
|
+ $originalfile = get_exdir(0, 0, 0, 0, $object, 'user').'photos/'.$object->photo; |
9852
|
9852
|
} |
9853
|
9853
|
} |
9854
|
9854
|
if (getDolGlobalString('MAIN_OLD_IMAGE_LINKS')) { |
9855
|
|
- $altfile = $object->id . ".jpg"; // For backward compatibility |
|
9855
|
+ $altfile = $object->id.".jpg"; // For backward compatibility |
9856
|
9856
|
} |
9857
|
9857
|
$email = $object->email; |
9858
|
9858
|
$capture = 'user'; |
|
@@ -9861,17 +9861,17 @@ discard block |
|
|
block discarded – undo |
9861
|
9861
|
if (!empty($object->photo)) { |
9862
|
9862
|
if (dolIsAllowedForPreview($object->photo)) { |
9863
|
9863
|
if ((string) $imagesize == 'mini') { |
9864
|
|
- $file = get_exdir(0, 0, 0, 0, $object, 'member') . 'photos/' . getImageFileNameForSize($object->photo, '_mini'); |
|
9864
|
+ $file = get_exdir(0, 0, 0, 0, $object, 'member').'photos/'.getImageFileNameForSize($object->photo, '_mini'); |
9865
|
9865
|
} elseif ((string) $imagesize == 'small') { |
9866
|
|
- $file = get_exdir(0, 0, 0, 0, $object, 'member') . 'photos/' . getImageFileNameForSize($object->photo, '_small'); |
|
9866
|
+ $file = get_exdir(0, 0, 0, 0, $object, 'member').'photos/'.getImageFileNameForSize($object->photo, '_small'); |
9867
|
9867
|
} else { |
9868
|
|
- $file = get_exdir(0, 0, 0, 0, $object, 'member') . 'photos/' . $object->photo; |
|
9868
|
+ $file = get_exdir(0, 0, 0, 0, $object, 'member').'photos/'.$object->photo; |
9869
|
9869
|
} |
9870
|
|
- $originalfile = get_exdir(0, 0, 0, 0, $object, 'member') . 'photos/' . $object->photo; |
|
9870
|
+ $originalfile = get_exdir(0, 0, 0, 0, $object, 'member').'photos/'.$object->photo; |
9871
|
9871
|
} |
9872
|
9872
|
} |
9873
|
9873
|
if (getDolGlobalString('MAIN_OLD_IMAGE_LINKS')) { |
9874
|
|
- $altfile = $object->id . ".jpg"; // For backward compatibility |
|
9874
|
+ $altfile = $object->id.".jpg"; // For backward compatibility |
9875
|
9875
|
} |
9876
|
9876
|
$email = $object->email; |
9877
|
9877
|
$capture = 'user'; |
|
@@ -9881,17 +9881,17 @@ discard block |
|
|
block discarded – undo |
9881
|
9881
|
if (!empty($object->photo)) { |
9882
|
9882
|
if (dolIsAllowedForPreview($object->photo)) { |
9883
|
9883
|
if ((string) $imagesize == 'mini') { |
9884
|
|
- $file = get_exdir($id, 2, 0, 0, $object, $modulepart) . 'photos/' . getImageFileNameForSize($object->photo, '_mini'); |
|
9884
|
+ $file = get_exdir($id, 2, 0, 0, $object, $modulepart).'photos/'.getImageFileNameForSize($object->photo, '_mini'); |
9885
|
9885
|
} elseif ((string) $imagesize == 'small') { |
9886
|
|
- $file = get_exdir($id, 2, 0, 0, $object, $modulepart) . 'photos/' . getImageFileNameForSize($object->photo, '_small'); |
|
9886
|
+ $file = get_exdir($id, 2, 0, 0, $object, $modulepart).'photos/'.getImageFileNameForSize($object->photo, '_small'); |
9887
|
9887
|
} else { |
9888
|
|
- $file = get_exdir($id, 2, 0, 0, $object, $modulepart) . 'photos/' . $object->photo; |
|
9888
|
+ $file = get_exdir($id, 2, 0, 0, $object, $modulepart).'photos/'.$object->photo; |
9889
|
9889
|
} |
9890
|
|
- $originalfile = get_exdir($id, 2, 0, 0, $object, $modulepart) . 'photos/' . $object->photo; |
|
9890
|
+ $originalfile = get_exdir($id, 2, 0, 0, $object, $modulepart).'photos/'.$object->photo; |
9891
|
9891
|
} |
9892
|
9892
|
} |
9893
|
9893
|
if (getDolGlobalString('MAIN_OLD_IMAGE_LINKS')) { |
9894
|
|
- $altfile = $object->id . ".jpg"; // For backward compatibility |
|
9894
|
+ $altfile = $object->id.".jpg"; // For backward compatibility |
9895
|
9895
|
} |
9896
|
9896
|
$email = $object->email; |
9897
|
9897
|
} |
|
@@ -9901,35 +9901,35 @@ discard block |
|
|
block discarded – undo |
9901
|
9901
|
} |
9902
|
9902
|
|
9903
|
9903
|
if ($dir) { |
9904
|
|
- if ($file && file_exists($dir . "/" . $file)) { |
|
9904
|
+ if ($file && file_exists($dir."/".$file)) { |
9905
|
9905
|
if ($addlinktofullsize) { |
9906
|
|
- $urladvanced = getAdvancedPreviewUrl($modulepart, $originalfile, 0, '&entity=' . $entity); |
|
9906
|
+ $urladvanced = getAdvancedPreviewUrl($modulepart, $originalfile, 0, '&entity='.$entity); |
9907
|
9907
|
if ($urladvanced) { |
9908
|
|
- $ret .= '<a href="' . $urladvanced . '">'; |
|
9908
|
+ $ret .= '<a href="'.$urladvanced.'">'; |
9909
|
9909
|
} else { |
9910
|
|
- $ret .= '<a href="' . DOL_URL_ROOT . '/viewimage.php?modulepart=' . $modulepart . '&entity=' . $entity . '&file=' . urlencode($originalfile) . '&cache=' . $cache . '">'; |
|
9910
|
+ $ret .= '<a href="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$entity.'&file='.urlencode($originalfile).'&cache='.$cache.'">'; |
9911
|
9911
|
} |
9912
|
9912
|
} |
9913
|
|
- $ret .= '<img alt="Photo" class="photo' . $modulepart . ($cssclass ? ' ' . $cssclass : '') . ' photologo' . (preg_replace('/[^a-z]/i', '_', $file)) . '" ' . ($width ? ' width="' . $width . '"' : '') . ($height ? ' height="' . $height . '"' : '') . ' src="' . DOL_URL_ROOT . '/viewimage.php?modulepart=' . $modulepart . '&entity=' . $entity . '&file=' . urlencode($file) . '&cache=' . $cache . '">'; |
|
9913
|
+ $ret .= '<img alt="Photo" class="photo'.$modulepart.($cssclass ? ' '.$cssclass : '').' photologo'.(preg_replace('/[^a-z]/i', '_', $file)).'" '.($width ? ' width="'.$width.'"' : '').($height ? ' height="'.$height.'"' : '').' src="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$entity.'&file='.urlencode($file).'&cache='.$cache.'">'; |
9914
|
9914
|
if ($addlinktofullsize) { |
9915
|
9915
|
$ret .= '</a>'; |
9916
|
9916
|
} |
9917
|
|
- } elseif ($altfile && file_exists($dir . "/" . $altfile)) { |
|
9917
|
+ } elseif ($altfile && file_exists($dir."/".$altfile)) { |
9918
|
9918
|
if ($addlinktofullsize) { |
9919
|
|
- $urladvanced = getAdvancedPreviewUrl($modulepart, $originalfile, 0, '&entity=' . $entity); |
|
9919
|
+ $urladvanced = getAdvancedPreviewUrl($modulepart, $originalfile, 0, '&entity='.$entity); |
9920
|
9920
|
if ($urladvanced) { |
9921
|
|
- $ret .= '<a href="' . $urladvanced . '">'; |
|
9921
|
+ $ret .= '<a href="'.$urladvanced.'">'; |
9922
|
9922
|
} else { |
9923
|
|
- $ret .= '<a href="' . DOL_URL_ROOT . '/viewimage.php?modulepart=' . $modulepart . '&entity=' . $entity . '&file=' . urlencode($originalfile) . '&cache=' . $cache . '">'; |
|
9923
|
+ $ret .= '<a href="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$entity.'&file='.urlencode($originalfile).'&cache='.$cache.'">'; |
9924
|
9924
|
} |
9925
|
9925
|
} |
9926
|
|
- $ret .= '<img class="photo' . $modulepart . ($cssclass ? ' ' . $cssclass : '') . '" alt="Photo alt" id="photologo' . (preg_replace('/[^a-z]/i', '_', $file)) . '" class="' . $cssclass . '" ' . ($width ? ' width="' . $width . '"' : '') . ($height ? ' height="' . $height . '"' : '') . ' src="' . DOL_URL_ROOT . '/viewimage.php?modulepart=' . $modulepart . '&entity=' . $entity . '&file=' . urlencode($altfile) . '&cache=' . $cache . '">'; |
|
9926
|
+ $ret .= '<img class="photo'.$modulepart.($cssclass ? ' '.$cssclass : '').'" alt="Photo alt" id="photologo'.(preg_replace('/[^a-z]/i', '_', $file)).'" class="'.$cssclass.'" '.($width ? ' width="'.$width.'"' : '').($height ? ' height="'.$height.'"' : '').' src="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$entity.'&file='.urlencode($altfile).'&cache='.$cache.'">'; |
9927
|
9927
|
if ($addlinktofullsize) { |
9928
|
9928
|
$ret .= '</a>'; |
9929
|
9929
|
} |
9930
|
9930
|
} else { |
9931
|
9931
|
$nophoto = '/public/theme/common/nophoto.png'; |
9932
|
|
- $defaultimg = 'identicon'; // For gravatar |
|
9932
|
+ $defaultimg = 'identicon'; // For gravatar |
9933
|
9933
|
if (in_array($modulepart, array('societe', 'userphoto', 'contact', 'memberphoto'))) { // For modules that need a special image when photo not found |
9934
|
9934
|
if ($modulepart == 'societe' || ($modulepart == 'memberphoto' && !empty($object->morphy) && strpos($object->morphy, 'mor')) !== false) { |
9935
|
9935
|
$nophoto = 'company'; |
|
@@ -9947,13 +9947,13 @@ discard block |
|
|
block discarded – undo |
9947
|
9947
|
if (isModEnabled('gravatar') && $email && empty($noexternsourceoverwrite)) { |
9948
|
9948
|
// see https://gravatar.com/site/implement/images/php/ |
9949
|
9949
|
$ret .= '<!-- Put link to gravatar -->'; |
9950
|
|
- $ret .= '<img class="photo' . $modulepart . ($cssclass ? ' ' . $cssclass : '') . '" alt="" title="' . $email . ' Gravatar avatar" ' . ($width ? ' width="' . $width . '"' : '') . ($height ? ' height="' . $height . '"' : '') . ' src="https://www.gravatar.com/avatar/' . dol_hash(strtolower(trim($email)), 'sha256', 1) . '?s=' . $width . '&d=' . $defaultimg . '">'; // gravatar need md5 hash |
|
9950
|
+ $ret .= '<img class="photo'.$modulepart.($cssclass ? ' '.$cssclass : '').'" alt="" title="'.$email.' Gravatar avatar" '.($width ? ' width="'.$width.'"' : '').($height ? ' height="'.$height.'"' : '').' src="https://www.gravatar.com/avatar/'.dol_hash(strtolower(trim($email)), 'sha256', 1).'?s='.$width.'&d='.$defaultimg.'">'; // gravatar need md5 hash |
9951
|
9951
|
} else { |
9952
|
9952
|
if ($nophoto == 'company') { |
9953
|
|
- $ret .= '<div class="divforspanimg photo' . $modulepart . ($cssclass ? ' ' . $cssclass : '') . '" alt="" ' . ($width ? ' width="' . $width . '"' : '') . ($height ? ' height="' . $height . '"' : '') . '>' . img_picto('', 'company') . '</div>'; |
|
9953
|
+ $ret .= '<div class="divforspanimg photo'.$modulepart.($cssclass ? ' '.$cssclass : '').'" alt="" '.($width ? ' width="'.$width.'"' : '').($height ? ' height="'.$height.'"' : '').'>'.img_picto('', 'company').'</div>'; |
9954
|
9954
|
$ret .= '<div class="difforspanimgright"></div>'; |
9955
|
9955
|
} else { |
9956
|
|
- $ret .= '<img class="photo' . $modulepart . ($cssclass ? ' ' . $cssclass : '') . '" alt="" ' . ($width ? ' width="' . $width . '"' : '') . ($height ? ' height="' . $height . '"' : '') . ' src="' . DOL_URL_ROOT . $nophoto . '">'; |
|
9956
|
+ $ret .= '<img class="photo'.$modulepart.($cssclass ? ' '.$cssclass : '').'" alt="" '.($width ? ' width="'.$width.'"' : '').($height ? ' height="'.$height.'"' : '').' src="'.DOL_URL_ROOT.$nophoto.'">'; |
9957
|
9957
|
} |
9958
|
9958
|
} |
9959
|
9959
|
} |
|
@@ -9964,15 +9964,15 @@ discard block |
|
|
block discarded – undo |
9964
|
9964
|
} |
9965
|
9965
|
$ret .= '<table class="nobordernopadding centpercent">'; |
9966
|
9966
|
if ($object->photo) { |
9967
|
|
- $ret .= '<tr><td><input type="checkbox" class="flat photodelete" name="deletephoto" id="photodelete"> <label for="photodelete">' . $langs->trans("Delete") . '</label><br><br></td></tr>'; |
|
9967
|
+ $ret .= '<tr><td><input type="checkbox" class="flat photodelete" name="deletephoto" id="photodelete"> <label for="photodelete">'.$langs->trans("Delete").'</label><br><br></td></tr>'; |
9968
|
9968
|
} |
9969
|
9969
|
$ret .= '<tr><td class="tdoverflow">'; |
9970
|
9970
|
$maxfilesizearray = getMaxFileSizeArray(); |
9971
|
9971
|
$maxmin = $maxfilesizearray['maxmin']; |
9972
|
9972
|
if ($maxmin > 0) { |
9973
|
|
- $ret .= '<input type="hidden" name="MAX_FILE_SIZE" value="' . ($maxmin * 1024) . '">'; // MAX_FILE_SIZE must precede the field type=file |
|
9973
|
+ $ret .= '<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).'">'; // MAX_FILE_SIZE must precede the field type=file |
9974
|
9974
|
} |
9975
|
|
- $ret .= '<input type="file" class="flat maxwidth200onsmartphone" name="photo" id="photoinput" accept="image/*"' . ($capture ? ' capture="' . $capture . '"' : '') . '>'; |
|
9975
|
+ $ret .= '<input type="file" class="flat maxwidth200onsmartphone" name="photo" id="photoinput" accept="image/*"'.($capture ? ' capture="'.$capture.'"' : '').'>'; |
9976
|
9976
|
$ret .= '</td></tr>'; |
9977
|
9977
|
$ret .= '</table>'; |
9978
|
9978
|
} |
|
@@ -10026,38 +10026,38 @@ discard block |
|
|
block discarded – undo |
10026
|
10026
|
if (isModEnabled('multicompany') && $conf->entity == 1 && $user->admin && !$user->entity) { |
10027
|
10027
|
$sql .= ", e.label"; |
10028
|
10028
|
} |
10029
|
|
- $sql .= " FROM " . $this->db->prefix() . "usergroup as ug "; |
|
10029
|
+ $sql .= " FROM ".$this->db->prefix()."usergroup as ug "; |
10030
|
10030
|
if (isModEnabled('multicompany') && $conf->entity == 1 && $user->admin && !$user->entity) { |
10031
|
|
- $sql .= " LEFT JOIN " . $this->db->prefix() . "entity as e ON e.rowid=ug.entity"; |
|
10031
|
+ $sql .= " LEFT JOIN ".$this->db->prefix()."entity as e ON e.rowid=ug.entity"; |
10032
|
10032
|
if ($force_entity) { |
10033
|
|
- $sql .= " WHERE ug.entity IN (0, " . $force_entity . ")"; |
|
10033
|
+ $sql .= " WHERE ug.entity IN (0, ".$force_entity.")"; |
10034
|
10034
|
} else { |
10035
|
10035
|
$sql .= " WHERE ug.entity IS NOT NULL"; |
10036
|
10036
|
} |
10037
|
10037
|
} else { |
10038
|
|
- $sql .= " WHERE ug.entity IN (0, " . $conf->entity . ")"; |
|
10038
|
+ $sql .= " WHERE ug.entity IN (0, ".$conf->entity.")"; |
10039
|
10039
|
} |
10040
|
10040
|
if (is_array($exclude) && $excludeGroups) { |
10041
|
|
- $sql .= " AND ug.rowid NOT IN (" . $this->db->sanitize($excludeGroups) . ")"; |
|
10041
|
+ $sql .= " AND ug.rowid NOT IN (".$this->db->sanitize($excludeGroups).")"; |
10042
|
10042
|
} |
10043
|
10043
|
if (is_array($include) && $includeGroups) { |
10044
|
|
- $sql .= " AND ug.rowid IN (" . $this->db->sanitize($includeGroups) . ")"; |
|
10044
|
+ $sql .= " AND ug.rowid IN (".$this->db->sanitize($includeGroups).")"; |
10045
|
10045
|
} |
10046
|
10046
|
$sql .= " ORDER BY ug.nom ASC"; |
10047
|
10047
|
|
10048
|
|
- dol_syslog(get_class($this) . "::select_dolgroups", LOG_DEBUG); |
|
10048
|
+ dol_syslog(get_class($this)."::select_dolgroups", LOG_DEBUG); |
10049
|
10049
|
$resql = $this->db->query($sql); |
10050
|
10050
|
if ($resql) { |
10051
|
10051
|
// Enhance with select2 |
10052
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
10052
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
10053
|
10053
|
|
10054
|
|
- $out .= '<select class="flat minwidth200' . ($morecss ? ' ' . $morecss : '') . '" id="' . $htmlname . '" name="' . $htmlname . ($multiple ? '[]' : '') . '" ' . ($multiple ? 'multiple' : '') . ' ' . ($disabled ? ' disabled' : '') . '>'; |
|
10054
|
+ $out .= '<select class="flat minwidth200'.($morecss ? ' '.$morecss : '').'" id="'.$htmlname.'" name="'.$htmlname.($multiple ? '[]' : '').'" '.($multiple ? 'multiple' : '').' '.($disabled ? ' disabled' : '').'>'; |
10055
|
10055
|
|
10056
|
10056
|
$num = $this->db->num_rows($resql); |
10057
|
10057
|
$i = 0; |
10058
|
10058
|
if ($num) { |
10059
|
10059
|
if ($show_empty && !$multiple) { |
10060
|
|
- $out .= '<option value="-1"' . (in_array(-1, $selected) ? ' selected' : '') . '> </option>' . "\n"; |
|
10060
|
+ $out .= '<option value="-1"'.(in_array(-1, $selected) ? ' selected' : '').'> </option>'."\n"; |
10061
|
10061
|
} |
10062
|
10062
|
|
10063
|
10063
|
while ($i < $num) { |
|
@@ -10070,11 +10070,11 @@ discard block |
|
|
block discarded – undo |
10070
|
10070
|
$label = $obj->name; |
10071
|
10071
|
$labelhtml = $obj->name; |
10072
|
10072
|
if (isModEnabled('multicompany') && !getDolGlobalInt('MULTICOMPANY_TRANSVERSE_MODE') && $conf->entity == 1) { |
10073
|
|
- $label .= " (" . $obj->label . ")"; |
10074
|
|
- $labelhtml .= ' <span class="opacitymedium">(' . $obj->label . ')</span>'; |
|
10073
|
+ $label .= " (".$obj->label.")"; |
|
10074
|
+ $labelhtml .= ' <span class="opacitymedium">('.$obj->label.')</span>'; |
10075
|
10075
|
} |
10076
|
10076
|
|
10077
|
|
- $out .= '<option value="' . $obj->rowid . '"'; |
|
10077
|
+ $out .= '<option value="'.$obj->rowid.'"'; |
10078
|
10078
|
if ($disableline) { |
10079
|
10079
|
$out .= ' disabled'; |
10080
|
10080
|
} |
|
@@ -10089,9 +10089,9 @@ discard block |
|
|
block discarded – undo |
10089
|
10089
|
} |
10090
|
10090
|
} else { |
10091
|
10091
|
if ($show_empty) { |
10092
|
|
- $out .= '<option value="-1"' . (in_array(-1, $selected) ? ' selected' : '') . '></option>' . "\n"; |
|
10092
|
+ $out .= '<option value="-1"'.(in_array(-1, $selected) ? ' selected' : '').'></option>'."\n"; |
10093
|
10093
|
} |
10094
|
|
- $out .= '<option value="" disabled>' . $langs->trans("NoUserGroupDefined") . '</option>'; |
|
10094
|
+ $out .= '<option value="" disabled>'.$langs->trans("NoUserGroupDefined").'</option>'; |
10095
|
10095
|
} |
10096
|
10096
|
$out .= '</select>'; |
10097
|
10097
|
|
|
@@ -10140,25 +10140,25 @@ discard block |
|
|
block discarded – undo |
10140
|
10140
|
$out = ''; |
10141
|
10141
|
|
10142
|
10142
|
if (!empty($conf->use_javascript_ajax)) { |
10143
|
|
- $out .= '<div class="inline-block checkallactions"><input type="checkbox" id="' . $cssclass . 's" name="' . $cssclass . 's" class="checkallactions"></div>'; |
|
10143
|
+ $out .= '<div class="inline-block checkallactions"><input type="checkbox" id="'.$cssclass.'s" name="'.$cssclass.'s" class="checkallactions"></div>'; |
10144
|
10144
|
} |
10145
|
|
- $out .= '<script nonce="' . getNonce() . '"> |
|
10145
|
+ $out .= '<script nonce="'.getNonce().'"> |
10146
|
10146
|
$(document).ready(function() { |
10147
|
|
- $("#' . $cssclass . 's").click(function() { |
|
10147
|
+ $("#' . $cssclass.'s").click(function() { |
10148
|
10148
|
if($(this).is(\':checked\')){ |
10149
|
|
- console.log("We check all ' . $cssclass . ' and trigger the change method"); |
10150
|
|
- $(".' . $cssclass . '").prop(\'checked\', true).trigger(\'change\'); |
|
10149
|
+ console.log("We check all ' . $cssclass.' and trigger the change method"); |
|
10150
|
+ $(".' . $cssclass.'").prop(\'checked\', true).trigger(\'change\'); |
10151
|
10151
|
} |
10152
|
10152
|
else |
10153
|
10153
|
{ |
10154
|
10154
|
console.log("We uncheck all"); |
10155
|
|
- $(".' . $cssclass . '").prop(\'checked\', false).trigger(\'change\'); |
|
10155
|
+ $(".' . $cssclass.'").prop(\'checked\', false).trigger(\'change\'); |
10156
|
10156
|
}' . "\n"; |
10157
|
10157
|
if ($calljsfunction) { |
10158
|
|
- $out .= 'if (typeof initCheckForSelect == \'function\') { initCheckForSelect(0, "' . $massactionname . '", "' . $cssclass . '"); } else { console.log("No function initCheckForSelect found. Call won\'t be done."); }'; |
|
10158
|
+ $out .= 'if (typeof initCheckForSelect == \'function\') { initCheckForSelect(0, "'.$massactionname.'", "'.$cssclass.'"); } else { console.log("No function initCheckForSelect found. Call won\'t be done."); }'; |
10159
|
10159
|
} |
10160
|
10160
|
$out .= ' }); |
10161
|
|
- $(".' . $cssclass . '").change(function() { |
|
10161
|
+ $(".' . $cssclass.'").change(function() { |
10162
|
10162
|
$(this).closest("tr").toggleClass("highlight", this.checked); |
10163
|
10163
|
}); |
10164
|
10164
|
}); |
|
@@ -10203,67 +10203,67 @@ discard block |
|
|
block discarded – undo |
10203
|
10203
|
global $langs, $user; |
10204
|
10204
|
|
10205
|
10205
|
$out = ''; |
10206
|
|
- $sql = "SELECT rowid, label FROM " . $this->db->prefix() . "c_exp_tax_cat WHERE active = 1"; |
10207
|
|
- $sql .= " AND entity IN (0," . getEntity('exp_tax_cat') . ")"; |
|
10206
|
+ $sql = "SELECT rowid, label FROM ".$this->db->prefix()."c_exp_tax_cat WHERE active = 1"; |
|
10207
|
+ $sql .= " AND entity IN (0,".getEntity('exp_tax_cat').")"; |
10208
|
10208
|
if (!empty($excludeid)) { |
10209
|
|
- $sql .= " AND rowid NOT IN (" . $this->db->sanitize(implode(',', $excludeid)) . ")"; |
|
10209
|
+ $sql .= " AND rowid NOT IN (".$this->db->sanitize(implode(',', $excludeid)).")"; |
10210
|
10210
|
} |
10211
|
10211
|
$sql .= " ORDER BY label"; |
10212
|
10212
|
|
10213
|
10213
|
$resql = $this->db->query($sql); |
10214
|
10214
|
if ($resql) { |
10215
|
|
- $out = '<select id="select_' . $htmlname . '" name="' . $htmlname . '" class="' . $htmlname . ' flat minwidth75imp maxwidth200">'; |
|
10215
|
+ $out = '<select id="select_'.$htmlname.'" name="'.$htmlname.'" class="'.$htmlname.' flat minwidth75imp maxwidth200">'; |
10216
|
10216
|
if ($useempty) { |
10217
|
10217
|
$out .= '<option value="0"> </option>'; |
10218
|
10218
|
} |
10219
|
10219
|
|
10220
|
10220
|
while ($obj = $this->db->fetch_object($resql)) { |
10221
|
|
- $out .= '<option ' . ($selected == $obj->rowid ? 'selected="selected"' : '') . ' value="' . $obj->rowid . '">' . $langs->trans($obj->label) . '</option>'; |
|
10221
|
+ $out .= '<option '.($selected == $obj->rowid ? 'selected="selected"' : '').' value="'.$obj->rowid.'">'.$langs->trans($obj->label).'</option>'; |
10222
|
10222
|
} |
10223
|
10223
|
$out .= '</select>'; |
10224
|
|
- $out .= ajax_combobox('select_' . $htmlname); |
|
10224
|
+ $out .= ajax_combobox('select_'.$htmlname); |
10225
|
10225
|
|
10226
|
10226
|
if (!empty($htmlname) && $user->admin && $info_admin) { |
10227
|
|
- $out .= ' ' . info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); |
|
10227
|
+ $out .= ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); |
10228
|
10228
|
} |
10229
|
10229
|
|
10230
|
10230
|
if (!empty($target)) { |
10231
|
|
- $sql = "SELECT c.id FROM " . $this->db->prefix() . "c_type_fees as c WHERE c.code = 'EX_KME' AND c.active = 1"; |
|
10231
|
+ $sql = "SELECT c.id FROM ".$this->db->prefix()."c_type_fees as c WHERE c.code = 'EX_KME' AND c.active = 1"; |
10232
|
10232
|
$resql = $this->db->query($sql); |
10233
|
10233
|
if ($resql) { |
10234
|
10234
|
if ($this->db->num_rows($resql) > 0) { |
10235
|
10235
|
$obj = $this->db->fetch_object($resql); |
10236
|
|
- $out .= '<script nonce="' . getNonce() . '"> |
|
10236
|
+ $out .= '<script nonce="'.getNonce().'"> |
10237
|
10237
|
$(function() { |
10238
|
|
- $("select[name=' . $target . ']").on("change", function() { |
|
10238
|
+ $("select[name=' . $target.']").on("change", function() { |
10239
|
10239
|
var current_val = $(this).val(); |
10240
|
|
- if (current_val == ' . $obj->id . ') {'; |
|
10240
|
+ if (current_val == ' . $obj->id.') {'; |
10241
|
10241
|
if (!empty($default_selected) || !empty($selected)) { |
10242
|
|
- $out .= '$("select[name=' . $htmlname . ']").val("' . ($default_selected > 0 ? $default_selected : $selected) . '");'; |
|
10242
|
+ $out .= '$("select[name='.$htmlname.']").val("'.($default_selected > 0 ? $default_selected : $selected).'");'; |
10243
|
10243
|
} |
10244
|
10244
|
|
10245
|
10245
|
$out .= ' |
10246
|
|
- $("select[name=' . $htmlname . ']").change(); |
|
10246
|
+ $("select[name=' . $htmlname.']").change(); |
10247
|
10247
|
} |
10248
|
10248
|
}); |
10249
|
10249
|
|
10250
|
|
- $("select[name=' . $htmlname . ']").change(function() { |
|
10250
|
+ $("select[name=' . $htmlname.']").change(function() { |
10251
|
10251
|
|
10252
|
|
- if ($("select[name=' . $target . ']").val() == ' . $obj->id . ') { |
|
10252
|
+ if ($("select[name=' . $target.']").val() == '.$obj->id.') { |
10253
|
10253
|
// get price of kilometer to fill the unit price |
10254
|
10254
|
$.ajax({ |
10255
|
10255
|
method: "POST", |
10256
|
10256
|
dataType: "json", |
10257
|
|
- data: { fk_c_exp_tax_cat: $(this).val(), token: \'' . currentToken() . '\' }, |
10258
|
|
- url: "' . (DOL_URL_ROOT . '/expensereport/ajax/ajaxik.php?' . join('&', $params)) . '", |
|
10257
|
+ data: { fk_c_exp_tax_cat: $(this).val(), token: \'' . currentToken().'\' }, |
|
10258
|
+ url: "' . (DOL_URL_ROOT.'/expensereport/ajax/ajaxik.php?'.join('&', $params)).'", |
10259
|
10259
|
}).done(function( data, textStatus, jqXHR ) { |
10260
|
10260
|
console.log(data); |
10261
|
10261
|
if (typeof data.up != "undefined") { |
10262
|
10262
|
$("input[name=value_unit]").val(data.up); |
10263
|
|
- $("select[name=' . $htmlname . ']").attr("title", data.title); |
|
10263
|
+ $("select[name=' . $htmlname.']").attr("title", data.title); |
10264
|
10264
|
} else { |
10265
|
10265
|
$("input[name=value_unit]").val(""); |
10266
|
|
- $("select[name=' . $htmlname . ']").attr("title", ""); |
|
10266
|
+ $("select[name=' . $htmlname.']").attr("title", ""); |
10267
|
10267
|
} |
10268
|
10268
|
}); |
10269
|
10269
|
} |
|
@@ -10293,18 +10293,18 @@ discard block |
|
|
block discarded – undo |
10293
|
10293
|
global $conf, $langs; |
10294
|
10294
|
|
10295
|
10295
|
$out = ''; |
10296
|
|
- $sql = "SELECT rowid, range_ik FROM " . $this->db->prefix() . "c_exp_tax_range"; |
10297
|
|
- $sql .= " WHERE entity = " . $conf->entity . " AND active = 1"; |
|
10296
|
+ $sql = "SELECT rowid, range_ik FROM ".$this->db->prefix()."c_exp_tax_range"; |
|
10297
|
+ $sql .= " WHERE entity = ".$conf->entity." AND active = 1"; |
10298
|
10298
|
|
10299
|
10299
|
$resql = $this->db->query($sql); |
10300
|
10300
|
if ($resql) { |
10301
|
|
- $out = '<select id="select_' . $htmlname . '" name="' . $htmlname . '" class="' . $htmlname . ' flat minwidth75imp">'; |
|
10301
|
+ $out = '<select id="select_'.$htmlname.'" name="'.$htmlname.'" class="'.$htmlname.' flat minwidth75imp">'; |
10302
|
10302
|
if ($useempty) { |
10303
|
10303
|
$out .= '<option value="0"></option>'; |
10304
|
10304
|
} |
10305
|
10305
|
|
10306
|
10306
|
while ($obj = $this->db->fetch_object($resql)) { |
10307
|
|
- $out .= '<option ' . ($selected == $obj->rowid ? 'selected="selected"' : '') . ' value="' . $obj->rowid . '">' . price($obj->range_ik, 0, $langs, 1, 0) . '</option>'; |
|
10307
|
+ $out .= '<option '.($selected == $obj->rowid ? 'selected="selected"' : '').' value="'.$obj->rowid.'">'.price($obj->range_ik, 0, $langs, 1, 0).'</option>'; |
10308
|
10308
|
} |
10309
|
10309
|
$out .= '</select>'; |
10310
|
10310
|
} else { |
|
@@ -10329,17 +10329,17 @@ discard block |
|
|
block discarded – undo |
10329
|
10329
|
global $langs; |
10330
|
10330
|
|
10331
|
10331
|
$out = ''; |
10332
|
|
- $sql = "SELECT id, code, label FROM " . $this->db->prefix() . "c_type_fees"; |
|
10332
|
+ $sql = "SELECT id, code, label FROM ".$this->db->prefix()."c_type_fees"; |
10333
|
10333
|
$sql .= " WHERE active = 1"; |
10334
|
10334
|
|
10335
|
10335
|
$resql = $this->db->query($sql); |
10336
|
10336
|
if ($resql) { |
10337
|
|
- $out = '<select id="select_' . $htmlname . '" name="' . $htmlname . '" class="' . $htmlname . ' flat minwidth75imp">'; |
|
10337
|
+ $out = '<select id="select_'.$htmlname.'" name="'.$htmlname.'" class="'.$htmlname.' flat minwidth75imp">'; |
10338
|
10338
|
if ($useempty) { |
10339
|
10339
|
$out .= '<option value="0"></option>'; |
10340
|
10340
|
} |
10341
|
10341
|
if ($allchoice) { |
10342
|
|
- $out .= '<option value="-1">' . $langs->trans('AllExpenseReport') . '</option>'; |
|
10342
|
+ $out .= '<option value="-1">'.$langs->trans('AllExpenseReport').'</option>'; |
10343
|
10343
|
} |
10344
|
10344
|
|
10345
|
10345
|
$field = 'code'; |
|
@@ -10349,7 +10349,7 @@ discard block |
|
|
block discarded – undo |
10349
|
10349
|
|
10350
|
10350
|
while ($obj = $this->db->fetch_object($resql)) { |
10351
|
10351
|
$key = $langs->trans($obj->code); |
10352
|
|
- $out .= '<option ' . ($selected == $obj->{$field} ? 'selected="selected"' : '') . ' value="' . $obj->{$field} . '">' . ($key != $obj->code ? $key : $obj->label) . '</option>'; |
|
10352
|
+ $out .= '<option '.($selected == $obj->{$field} ? 'selected="selected"' : '').' value="'.$obj->{$field}.'">'.($key != $obj->code ? $key : $obj->label).'</option>'; |
10353
|
10353
|
} |
10354
|
10354
|
$out .= '</select>'; |
10355
|
10355
|
} else { |
|
@@ -10381,7 +10381,7 @@ discard block |
|
|
block discarded – undo |
10381
|
10381
|
{ |
10382
|
10382
|
global $user, $conf, $langs; |
10383
|
10383
|
|
10384
|
|
- require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; |
|
10384
|
+ require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; |
10385
|
10385
|
|
10386
|
10386
|
if (is_null($usertofilter)) { |
10387
|
10387
|
$usertofilter = $user; |
|
@@ -10405,10 +10405,10 @@ discard block |
|
|
block discarded – undo |
10405
|
10405
|
$sql = "SELECT f.rowid, f.ref as fref, 'nolabel' as flabel, p.rowid as pid, f.ref, |
10406
|
10406
|
p.title, p.fk_soc, p.fk_statut, p.public,"; |
10407
|
10407
|
$sql .= ' s.nom as name'; |
10408
|
|
- $sql .= ' FROM ' . $this->db->prefix() . 'projet as p'; |
10409
|
|
- $sql .= ' LEFT JOIN ' . $this->db->prefix() . 'societe as s ON s.rowid = p.fk_soc,'; |
10410
|
|
- $sql .= ' ' . $this->db->prefix() . 'facture as f'; |
10411
|
|
- $sql .= " WHERE p.entity IN (" . getEntity('project') . ")"; |
|
10408
|
+ $sql .= ' FROM '.$this->db->prefix().'projet as p'; |
|
10409
|
+ $sql .= ' LEFT JOIN '.$this->db->prefix().'societe as s ON s.rowid = p.fk_soc,'; |
|
10410
|
+ $sql .= ' '.$this->db->prefix().'facture as f'; |
|
10411
|
+ $sql .= " WHERE p.entity IN (".getEntity('project').")"; |
10412
|
10412
|
$sql .= " AND f.fk_projet = p.rowid AND f.fk_statut=0"; //Brouillons seulement |
10413
|
10413
|
//if ($projectsListId) $sql.= " AND p.rowid IN (".$this->db->sanitize($projectsListId).")"; |
10414
|
10414
|
//if ($socid == 0) $sql.= " AND (p.fk_soc=0 OR p.fk_soc IS NULL)"; |
|
@@ -10419,14 +10419,14 @@ discard block |
|
|
block discarded – undo |
10419
|
10419
|
if ($resql) { |
10420
|
10420
|
// Use select2 selector |
10421
|
10421
|
if (!empty($conf->use_javascript_ajax)) { |
10422
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
10422
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
10423
|
10423
|
$comboenhancement = ajax_combobox($htmlname, '', 0, $forcefocus); |
10424
|
10424
|
$out .= $comboenhancement; |
10425
|
10425
|
$morecss = 'minwidth200imp maxwidth500'; |
10426
|
10426
|
} |
10427
|
10427
|
|
10428
|
10428
|
if (empty($option_only)) { |
10429
|
|
- $out .= '<select class="valignmiddle flat' . ($morecss ? ' ' . $morecss : '') . '"' . ($disabled ? ' disabled="disabled"' : '') . ' id="' . $htmlname . '" name="' . $htmlname . '">'; |
|
10429
|
+ $out .= '<select class="valignmiddle flat'.($morecss ? ' '.$morecss : '').'"'.($disabled ? ' disabled="disabled"' : '').' id="'.$htmlname.'" name="'.$htmlname.'">'; |
10430
|
10430
|
} |
10431
|
10431
|
if (!empty($show_empty)) { |
10432
|
10432
|
$out .= '<option value="0" class="optiongrey">'; |
|
@@ -10456,33 +10456,33 @@ discard block |
|
|
block discarded – undo |
10456
|
10456
|
if ($showproject == 'all') { |
10457
|
10457
|
$labeltoshow .= dol_trunc($obj->ref, 18); // Invoice ref |
10458
|
10458
|
if ($obj->name) { |
10459
|
|
- $labeltoshow .= ' - ' . $obj->name; // Soc name |
|
10459
|
+ $labeltoshow .= ' - '.$obj->name; // Soc name |
10460
|
10460
|
} |
10461
|
10461
|
|
10462
|
10462
|
$disabled = 0; |
10463
|
10463
|
if ($obj->fk_statut == Project::STATUS_DRAFT) { |
10464
|
10464
|
$disabled = 1; |
10465
|
|
- $labeltoshow .= ' - ' . $langs->trans("Draft"); |
|
10465
|
+ $labeltoshow .= ' - '.$langs->trans("Draft"); |
10466
|
10466
|
} elseif ($obj->fk_statut == Project::STATUS_CLOSED) { |
10467
|
10467
|
if ($discard_closed == 2) { |
10468
|
10468
|
$disabled = 1; |
10469
|
10469
|
} |
10470
|
|
- $labeltoshow .= ' - ' . $langs->trans("Closed"); |
|
10470
|
+ $labeltoshow .= ' - '.$langs->trans("Closed"); |
10471
|
10471
|
} elseif ($socid > 0 && (!empty($obj->fk_soc) && $obj->fk_soc != $socid)) { |
10472
|
10472
|
$disabled = 1; |
10473
|
|
- $labeltoshow .= ' - ' . $langs->trans("LinkedToAnotherCompany"); |
|
10473
|
+ $labeltoshow .= ' - '.$langs->trans("LinkedToAnotherCompany"); |
10474
|
10474
|
} |
10475
|
10475
|
} |
10476
|
10476
|
|
10477
|
10477
|
if (!empty($selected) && $selected == $obj->rowid) { |
10478
|
|
- $out .= '<option value="' . $obj->rowid . '" selected'; |
|
10478
|
+ $out .= '<option value="'.$obj->rowid.'" selected'; |
10479
|
10479
|
//if ($disabled) $out.=' disabled'; // with select2, field can't be preselected if disabled |
10480
|
|
- $out .= '>' . $labeltoshow . '</option>'; |
|
10480
|
+ $out .= '>'.$labeltoshow.'</option>'; |
10481
|
10481
|
} else { |
10482
|
10482
|
if ($hideunselectables && $disabled && ($selected != $obj->rowid)) { |
10483
|
10483
|
$resultat = ''; |
10484
|
10484
|
} else { |
10485
|
|
- $resultat = '<option value="' . $obj->rowid . '"'; |
|
10485
|
+ $resultat = '<option value="'.$obj->rowid.'"'; |
10486
|
10486
|
if ($disabled) { |
10487
|
10487
|
$resultat .= ' disabled'; |
10488
|
10488
|
} |
|
@@ -10534,22 +10534,22 @@ discard block |
|
|
block discarded – undo |
10534
|
10534
|
|
10535
|
10535
|
$sql = 'SELECT f.rowid, f.entity, f.titre as title, f.suspended, f.fk_soc'; |
10536
|
10536
|
//$sql.= ', el.fk_source'; |
10537
|
|
- $sql .= ' FROM ' . MAIN_DB_PREFIX . 'facture_rec as f'; |
10538
|
|
- $sql .= " WHERE f.entity IN (" . getEntity('invoice') . ")"; |
|
10537
|
+ $sql .= ' FROM '.MAIN_DB_PREFIX.'facture_rec as f'; |
|
10538
|
+ $sql .= " WHERE f.entity IN (".getEntity('invoice').")"; |
10539
|
10539
|
$sql .= " ORDER BY f.titre ASC"; |
10540
|
10540
|
|
10541
|
10541
|
$resql = $this->db->query($sql); |
10542
|
10542
|
if ($resql) { |
10543
|
10543
|
// Use select2 selector |
10544
|
10544
|
if (!empty($conf->use_javascript_ajax)) { |
10545
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
10545
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
10546
|
10546
|
$comboenhancement = ajax_combobox($htmlname, '', 0, $forcefocus); |
10547
|
10547
|
$out .= $comboenhancement; |
10548
|
10548
|
$morecss = 'minwidth200imp maxwidth500'; |
10549
|
10549
|
} |
10550
|
10550
|
|
10551
|
10551
|
if (empty($option_only)) { |
10552
|
|
- $out .= '<select class="valignmiddle flat' . ($morecss ? ' ' . $morecss : '') . '"' . ($disabled ? ' disabled="disabled"' : '') . ' id="' . $htmlname . '" name="' . $htmlname . '">'; |
|
10552
|
+ $out .= '<select class="valignmiddle flat'.($morecss ? ' '.$morecss : '').'"'.($disabled ? ' disabled="disabled"' : '').' id="'.$htmlname.'" name="'.$htmlname.'">'; |
10553
|
10553
|
} |
10554
|
10554
|
if (!empty($show_empty)) { |
10555
|
10555
|
$out .= '<option value="0" class="optiongrey">'; |
|
@@ -10568,19 +10568,19 @@ discard block |
|
|
block discarded – undo |
10568
|
10568
|
$disabled = 0; |
10569
|
10569
|
if (!empty($obj->suspended)) { |
10570
|
10570
|
$disabled = 1; |
10571
|
|
- $labeltoshow .= ' - ' . $langs->trans("Closed"); |
|
10571
|
+ $labeltoshow .= ' - '.$langs->trans("Closed"); |
10572
|
10572
|
} |
10573
|
10573
|
|
10574
|
10574
|
|
10575
|
10575
|
if (!empty($selected) && $selected == $obj->rowid) { |
10576
|
|
- $out .= '<option value="' . $obj->rowid . '" selected'; |
|
10576
|
+ $out .= '<option value="'.$obj->rowid.'" selected'; |
10577
|
10577
|
//if ($disabled) $out.=' disabled'; // with select2, field can't be preselected if disabled |
10578
|
|
- $out .= '>' . $labeltoshow . '</option>'; |
|
10578
|
+ $out .= '>'.$labeltoshow.'</option>'; |
10579
|
10579
|
} else { |
10580
|
10580
|
if ($disabled && ($selected != $obj->rowid)) { |
10581
|
10581
|
$resultat = ''; |
10582
|
10582
|
} else { |
10583
|
|
- $resultat = '<option value="' . $obj->rowid . '"'; |
|
10583
|
+ $resultat = '<option value="'.$obj->rowid.'"'; |
10584
|
10584
|
if ($disabled) { |
10585
|
10585
|
$resultat .= ' disabled'; |
10586
|
10586
|
} |
|
@@ -10620,14 +10620,14 @@ discard block |
|
|
block discarded – undo |
10620
|
10620
|
global $langs; |
10621
|
10621
|
|
10622
|
10622
|
if ($search_component_params_hidden != '' && !preg_match('/^\(.*\)$/', $search_component_params_hidden)) { // If $search_component_params_hidden does not start and end with () |
10623
|
|
- $search_component_params_hidden = '(' . $search_component_params_hidden . ')'; |
|
10623
|
+ $search_component_params_hidden = '('.$search_component_params_hidden.')'; |
10624
|
10624
|
} |
10625
|
10625
|
|
10626
|
10626
|
$ret = ''; |
10627
|
10627
|
|
10628
|
10628
|
$ret .= '<div class="divadvancedsearchfieldcomp inline-block">'; |
10629
|
10629
|
$ret .= '<a href="#" class="dropdownsearch-toggle unsetcolor">'; |
10630
|
|
- $ret .= '<span class="fas fa-filter linkobject boxfilter paddingright pictofixedwidth" title="' . dol_escape_htmltag($langs->trans("Filters")) . '" id="idsubimgproductdistribution"></span>'; |
|
10630
|
+ $ret .= '<span class="fas fa-filter linkobject boxfilter paddingright pictofixedwidth" title="'.dol_escape_htmltag($langs->trans("Filters")).'" id="idsubimgproductdistribution"></span>'; |
10631
|
10631
|
$ret .= '</a>'; |
10632
|
10632
|
|
10633
|
10633
|
$ret .= '<div class="divadvancedsearchfieldcompinput inline-block minwidth500 maxwidth300onsmartphone">'; |
|
@@ -10654,13 +10654,13 @@ discard block |
|
|
block discarded – undo |
10654
|
10654
|
} |
10655
|
10655
|
|
10656
|
10656
|
if ($countparenthesis == 0) { |
10657
|
|
- $char2 = dol_substr($search_component_params_hidden, $i+1, 1); |
10658
|
|
- $char3 = dol_substr($search_component_params_hidden, $i+2, 1); |
|
10657
|
+ $char2 = dol_substr($search_component_params_hidden, $i + 1, 1); |
|
10658
|
+ $char3 = dol_substr($search_component_params_hidden, $i + 2, 1); |
10659
|
10659
|
if ($char == 'A' && $char2 == 'N' && $char3 == 'D') { |
10660
|
10660
|
// We found a AND |
10661
|
10661
|
$arrayofandtags[] = trim($s); |
10662
|
10662
|
$s = ''; |
10663
|
|
- $i+=2; |
|
10663
|
+ $i += 2; |
10664
|
10664
|
} else { |
10665
|
10665
|
$s .= $char; |
10666
|
10666
|
} |
|
@@ -10684,8 +10684,8 @@ discard block |
|
|
block discarded – undo |
10684
|
10684
|
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; |
10685
|
10685
|
$searchtags = removeGlobalParenthesis($searchtags); |
10686
|
10686
|
|
10687
|
|
- $ret .= '<span class="marginleftonlyshort valignmiddle tagsearch" data-ufilterid="'.($tmpkey+1).'" data-ufilter="'.dol_escape_htmltag($tmpval).'">'; |
10688
|
|
- $ret .= '<span class="tagsearchdelete select2-selection__choice__remove" data-ufilterid="'.($tmpkey+1).'">x</span> '; |
|
10687
|
+ $ret .= '<span class="marginleftonlyshort valignmiddle tagsearch" data-ufilterid="'.($tmpkey + 1).'" data-ufilter="'.dol_escape_htmltag($tmpval).'">'; |
|
10688
|
+ $ret .= '<span class="tagsearchdelete select2-selection__choice__remove" data-ufilterid="'.($tmpkey + 1).'">x</span> '; |
10689
|
10689
|
$ret .= dol_escape_htmltag($searchtags); |
10690
|
10690
|
$ret .= '</span>'; |
10691
|
10691
|
} |
|
@@ -10702,29 +10702,29 @@ discard block |
|
|
block discarded – undo |
10702
|
10702
|
$ret .= '<input type="hidden" name="show_search_component_params_hidden" value="1">'; |
10703
|
10703
|
} |
10704
|
10704
|
$ret .= "<!-- We store the full Universal Search String into this field. For example: (t.ref:like:'SO-%') AND ((t.ref:like:'CO-%') OR (t.ref:like:'AA%')) -->"; |
10705
|
|
- $ret .= '<input type="hidden" name="search_component_params_hidden" value="' . dol_escape_htmltag($search_component_params_hidden) . '">'; |
|
10705
|
+ $ret .= '<input type="hidden" name="search_component_params_hidden" value="'.dol_escape_htmltag($search_component_params_hidden).'">'; |
10706
|
10706
|
// $ret .= "<!-- sql= ".forgeSQLFromUniversalSearchCriteria($search_component_params_hidden, $errormessage)." -->"; |
10707
|
10707
|
|
10708
|
10708
|
// For compatibility with forms that show themself the search criteria in addition of this component, we output these fields |
10709
|
10709
|
foreach ($arrayofcriterias as $criterias) { |
10710
|
10710
|
foreach ($criterias as $criteriafamilykey => $criteriafamilyval) { |
10711
|
|
- if (in_array('search_' . $criteriafamilykey, $arrayofinputfieldsalreadyoutput)) { |
|
10711
|
+ if (in_array('search_'.$criteriafamilykey, $arrayofinputfieldsalreadyoutput)) { |
10712
|
10712
|
continue; |
10713
|
10713
|
} |
10714
|
10714
|
if (in_array($criteriafamilykey, array('rowid', 'ref_ext', 'entity', 'extraparams'))) { |
10715
|
10715
|
continue; |
10716
|
10716
|
} |
10717
|
10717
|
if (in_array($criteriafamilyval['type'], array('date', 'datetime', 'timestamp'))) { |
10718
|
|
- $ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_start">'; |
10719
|
|
- $ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_startyear">'; |
10720
|
|
- $ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_startmonth">'; |
10721
|
|
- $ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_startday">'; |
10722
|
|
- $ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_end">'; |
10723
|
|
- $ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_endyear">'; |
10724
|
|
- $ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_endmonth">'; |
10725
|
|
- $ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_endday">'; |
|
10718
|
+ $ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_start">'; |
|
10719
|
+ $ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_startyear">'; |
|
10720
|
+ $ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_startmonth">'; |
|
10721
|
+ $ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_startday">'; |
|
10722
|
+ $ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_end">'; |
|
10723
|
+ $ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_endyear">'; |
|
10724
|
+ $ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_endmonth">'; |
|
10725
|
+ $ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_endday">'; |
10726
|
10726
|
} else { |
10727
|
|
- $ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '">'; |
|
10727
|
+ $ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'">'; |
10728
|
10728
|
} |
10729
|
10729
|
} |
10730
|
10730
|
} |
|
@@ -10732,7 +10732,7 @@ discard block |
|
|
block discarded – undo |
10732
|
10732
|
$ret .= '</div>'; |
10733
|
10733
|
|
10734
|
10734
|
$ret .= "<!-- Field to enter a generic filter string: t.ref:like:'SO-%', t.date_creation:<:'20160101', t.date_creation:<:'2016-01-01 12:30:00', t.nature:is:NULL, t.field2:isnot:NULL -->\n"; |
10735
|
|
- $ret .= '<input type="text" placeholder="' . $langs->trans("Search") . '" name="search_component_params_input" class="noborderbottom search_component_input" value="">'; |
|
10735
|
+ $ret .= '<input type="text" placeholder="'.$langs->trans("Search").'" name="search_component_params_input" class="noborderbottom search_component_input" value="">'; |
10736
|
10736
|
|
10737
|
10737
|
$ret .= '</div>'; |
10738
|
10738
|
$ret .= '</div>'; |
|
@@ -10768,7 +10768,7 @@ discard block |
|
|
block discarded – undo |
10768
|
10768
|
|
10769
|
10769
|
$TModels = array(); |
10770
|
10770
|
|
10771
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php'; |
|
10771
|
+ include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; |
10772
|
10772
|
$formmail = new FormMail($this->db); |
10773
|
10773
|
$result = $formmail->fetchAllEMailTemplate($modelType, $user, $langs); |
10774
|
10774
|
|
|
@@ -10781,17 +10781,17 @@ discard block |
|
|
block discarded – undo |
10781
|
10781
|
} |
10782
|
10782
|
} |
10783
|
10783
|
|
10784
|
|
- $retstring .= '<select class="flat" id="select_' . $prefix . 'model_mail" name="' . $prefix . 'model_mail">'; |
|
10784
|
+ $retstring .= '<select class="flat" id="select_'.$prefix.'model_mail" name="'.$prefix.'model_mail">'; |
10785
|
10785
|
|
10786
|
10786
|
foreach ($TModels as $id_model => $label_model) { |
10787
|
|
- $retstring .= '<option value="' . $id_model . '"'; |
10788
|
|
- $retstring .= ">" . $label_model . "</option>"; |
|
10787
|
+ $retstring .= '<option value="'.$id_model.'"'; |
|
10788
|
+ $retstring .= ">".$label_model."</option>"; |
10789
|
10789
|
} |
10790
|
10790
|
|
10791
|
10791
|
$retstring .= "</select>"; |
10792
|
10792
|
|
10793
|
10793
|
if ($addjscombo) { |
10794
|
|
- $retstring .= ajax_combobox('select_' . $prefix . 'model_mail'); |
|
10794
|
+ $retstring .= ajax_combobox('select_'.$prefix.'model_mail'); |
10795
|
10795
|
} |
10796
|
10796
|
|
10797
|
10797
|
return $retstring; |
|
@@ -10842,16 +10842,16 @@ discard block |
|
|
block discarded – undo |
10842
|
10842
|
|
10843
|
10843
|
foreach ($buttons as $button) { |
10844
|
10844
|
$addclass = empty($button['addclass']) ? '' : $button['addclass']; |
10845
|
|
- $retstring .= '<input type="submit" class="button button-' . $button['name'] . ($morecss ? ' ' . $morecss : '') . ' ' . $addclass . '" name="' . $button['name'] . '" value="' . dol_escape_htmltag($langs->trans($button['label_key'])) . '">'; |
|
10845
|
+ $retstring .= '<input type="submit" class="button button-'.$button['name'].($morecss ? ' '.$morecss : '').' '.$addclass.'" name="'.$button['name'].'" value="'.dol_escape_htmltag($langs->trans($button['label_key'])).'">'; |
10846
|
10846
|
} |
10847
|
10847
|
$retstring .= $withoutdiv ? '' : '</div>'; |
10848
|
10848
|
|
10849
|
10849
|
if ($dol_openinpopup) { |
10850
|
|
- $retstring .= '<!-- buttons are shown into a $dol_openinpopup=' . $dol_openinpopup . ' context, so we enable the close of dialog on cancel -->' . "\n"; |
10851
|
|
- $retstring .= '<script nonce="' . getNonce() . '">'; |
|
10850
|
+ $retstring .= '<!-- buttons are shown into a $dol_openinpopup='.$dol_openinpopup.' context, so we enable the close of dialog on cancel -->'."\n"; |
|
10851
|
+ $retstring .= '<script nonce="'.getNonce().'">'; |
10852
|
10852
|
$retstring .= 'jQuery(".button-cancel").click(function(e) { |
10853
|
|
- e.preventDefault(); console.log(\'We click on cancel in iframe popup ' . $dol_openinpopup . '\'); |
10854
|
|
- window.parent.jQuery(\'#idfordialog' . $dol_openinpopup . '\').dialog(\'close\'); |
|
10853
|
+ e.preventDefault(); console.log(\'We click on cancel in iframe popup ' . $dol_openinpopup.'\'); |
|
10854
|
+ window.parent.jQuery(\'#idfordialog' . $dol_openinpopup.'\').dialog(\'close\'); |
10855
|
10855
|
});'; |
10856
|
10856
|
$retstring .= '</script>'; |
10857
|
10857
|
} |
|
@@ -10880,7 +10880,7 @@ discard block |
|
|
block discarded – undo |
10880
|
10880
|
dol_syslog(__METHOD__, LOG_DEBUG); |
10881
|
10881
|
|
10882
|
10882
|
$sql = "SELECT rowid, code, label as label"; |
10883
|
|
- $sql .= " FROM " . MAIN_DB_PREFIX . 'c_invoice_subtype'; |
|
10883
|
+ $sql .= " FROM ".MAIN_DB_PREFIX.'c_invoice_subtype'; |
10884
|
10884
|
$sql .= " WHERE active = 1"; |
10885
|
10885
|
|
10886
|
10886
|
$resql = $this->db->query($sql); |
|
@@ -10891,7 +10891,7 @@ discard block |
|
|
block discarded – undo |
10891
|
10891
|
$obj = $this->db->fetch_object($resql); |
10892
|
10892
|
|
10893
|
10893
|
// If translation exists, we use it, otherwise we take the default wording |
10894
|
|
- $label = ($langs->trans("InvoiceSubtype" . $obj->rowid) != ("InvoiceSubtype" . $obj->rowid)) ? $langs->trans("InvoiceSubtype" . $obj->rowid) : (($obj->label != '-') ? $obj->label : ''); |
|
10894
|
+ $label = ($langs->trans("InvoiceSubtype".$obj->rowid) != ("InvoiceSubtype".$obj->rowid)) ? $langs->trans("InvoiceSubtype".$obj->rowid) : (($obj->label != '-') ? $obj->label : ''); |
10895
|
10895
|
$this->cache_invoice_subtype[$obj->rowid]['rowid'] = $obj->rowid; |
10896
|
10896
|
$this->cache_invoice_subtype[$obj->rowid]['code'] = $obj->code; |
10897
|
10897
|
$this->cache_invoice_subtype[$obj->rowid]['label'] = $label; |
|
@@ -10923,18 +10923,18 @@ discard block |
|
|
block discarded – undo |
10923
|
10923
|
global $langs, $user; |
10924
|
10924
|
|
10925
|
10925
|
$out = ''; |
10926
|
|
- dol_syslog(__METHOD__ . " selected=" . $selected . ", htmlname=" . $htmlname, LOG_DEBUG); |
|
10926
|
+ dol_syslog(__METHOD__." selected=".$selected.", htmlname=".$htmlname, LOG_DEBUG); |
10927
|
10927
|
|
10928
|
10928
|
$this->load_cache_invoice_subtype(); |
10929
|
10929
|
|
10930
|
|
- $out .= '<select id="' . $htmlname . '" class="flat selectsubtype' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">'; |
|
10930
|
+ $out .= '<select id="'.$htmlname.'" class="flat selectsubtype'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">'; |
10931
|
10931
|
if ($addempty) { |
10932
|
10932
|
$out .= '<option value="0"> </option>'; |
10933
|
10933
|
} |
10934
|
10934
|
|
10935
|
10935
|
foreach ($this->cache_invoice_subtype as $rowid => $subtype) { |
10936
|
10936
|
$label = $subtype['label']; |
10937
|
|
- $out .= '<option value="' . $subtype['rowid'] . '"'; |
|
10937
|
+ $out .= '<option value="'.$subtype['rowid'].'"'; |
10938
|
10938
|
if ($selected == $subtype['rowid']) { |
10939
|
10939
|
$out .= ' selected="selected"'; |
10940
|
10940
|
} |