|
@@ -122,7 +122,7 @@ discard block |
|
|
block discarded – undo |
122
|
122
|
if (getDolGlobalString('MAIN_USE_JQUERY_JEDITABLE') && !preg_match('/^select;/', $typeofdata)) { |
123
|
123
|
if (!empty($perm)) { |
124
|
124
|
$tmp = explode(':', $typeofdata); |
125
|
|
- $ret .= '<div class="editkey_' . $tmp[0] . (!empty($tmp[1]) ? ' ' . $tmp[1] : '') . '" id="' . $htmlname . '">'; |
|
125
|
+ $ret .= '<div class="editkey_'.$tmp[0].(!empty($tmp[1]) ? ' '.$tmp[1] : '').'" id="'.$htmlname.'">'; |
126
|
126
|
if ($fieldrequired) { |
127
|
127
|
$ret .= '<span class="fieldrequired">'; |
128
|
128
|
} |
|
@@ -134,7 +134,7 @@ discard block |
|
|
block discarded – undo |
134
|
134
|
if ($fieldrequired) { |
135
|
135
|
$ret .= '</span>'; |
136
|
136
|
} |
137
|
|
- $ret .= '</div>' . "\n"; |
|
137
|
+ $ret .= '</div>'."\n"; |
138
|
138
|
} else { |
139
|
139
|
if ($fieldrequired) { |
140
|
140
|
$ret .= '<span class="fieldrequired">'; |
|
@@ -172,8 +172,8 @@ discard block |
|
|
block discarded – undo |
172
|
172
|
if (empty($notabletag) && $perm) { |
173
|
173
|
$ret .= '<td class="right">'; |
174
|
174
|
} |
175
|
|
- if ($htmlname && GETPOST('action', 'aZ09') != 'edit' . $htmlname && $perm) { |
176
|
|
- $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>'; |
|
175
|
+ if ($htmlname && GETPOST('action', 'aZ09') != 'edit'.$htmlname && $perm) { |
|
176
|
+ $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>'; |
177
|
177
|
} |
178
|
178
|
if (!empty($notabletag) && $notabletag == 1) { |
179
|
179
|
if ($text) { |
|
@@ -240,7 +240,7 @@ discard block |
|
|
block discarded – undo |
240
|
240
|
} elseif ($reg[1] == 'int') { |
241
|
241
|
$typeofdata = 'numeric'; |
242
|
242
|
} else { |
243
|
|
- return 'ErrorBadParameter ' . $typeofdata; |
|
243
|
+ return 'ErrorBadParameter '.$typeofdata; |
244
|
244
|
} |
245
|
245
|
} |
246
|
246
|
|
|
@@ -251,13 +251,13 @@ discard block |
|
|
block discarded – undo |
251
|
251
|
if ($editaction == '') { |
252
|
252
|
$editaction = GETPOST('action', 'aZ09'); |
253
|
253
|
} |
254
|
|
- $editmode = ($editaction == 'edit' . $htmlname); |
|
254
|
+ $editmode = ($editaction == 'edit'.$htmlname); |
255
|
255
|
if ($editmode) { // edit mode |
256
|
256
|
$ret .= "\n"; |
257
|
|
- $ret .= '<form method="post" action="' . $_SERVER["PHP_SELF"] . ($moreparam ? '?' . $moreparam : '') . '">'; |
258
|
|
- $ret .= '<input type="hidden" name="action" value="set' . $htmlname . '">'; |
259
|
|
- $ret .= '<input type="hidden" name="token" value="' . newToken() . '">'; |
260
|
|
- $ret .= '<input type="hidden" name="' . $paramid . '" value="' . $object->id . '">'; |
|
257
|
+ $ret .= '<form method="post" action="'.$_SERVER["PHP_SELF"].($moreparam ? '?'.$moreparam : '').'">'; |
|
258
|
+ $ret .= '<input type="hidden" name="action" value="set'.$htmlname.'">'; |
|
259
|
+ $ret .= '<input type="hidden" name="token" value="'.newToken().'">'; |
|
260
|
+ $ret .= '<input type="hidden" name="'.$paramid.'" value="'.$object->id.'">'; |
261
|
261
|
if (empty($notabletag)) { |
262
|
262
|
$ret .= '<table class="nobordernopadding centpercent">'; |
263
|
263
|
} |
|
@@ -266,28 +266,28 @@ discard block |
|
|
block discarded – undo |
266
|
266
|
} |
267
|
267
|
if (preg_match('/^(string|safehtmlstring|email|phone|url)/', $typeofdata)) { |
268
|
268
|
$tmp = explode(':', $typeofdata); |
269
|
|
- $ret .= '<input type="text" id="' . $htmlname . '" name="' . $htmlname . '" value="' . ($editvalue ? $editvalue : $value) . '"' . (empty($tmp[1]) ? '' : ' size="' . $tmp[1] . '"') . ' autofocus>'; |
|
269
|
+ $ret .= '<input type="text" id="'.$htmlname.'" name="'.$htmlname.'" value="'.($editvalue ? $editvalue : $value).'"'.(empty($tmp[1]) ? '' : ' size="'.$tmp[1].'"').' autofocus>'; |
270
|
270
|
} elseif (preg_match('/^(integer)/', $typeofdata)) { |
271
|
271
|
$tmp = explode(':', $typeofdata); |
272
|
272
|
$valuetoshow = price2num($editvalue ? $editvalue : $value, 0); |
273
|
|
- $ret .= '<input type="text" id="' . $htmlname . '" name="' . $htmlname . '" value="' . $valuetoshow . '"' . (empty($tmp[1]) ? '' : ' size="' . $tmp[1] . '"') . ' autofocus>'; |
|
273
|
+ $ret .= '<input type="text" id="'.$htmlname.'" name="'.$htmlname.'" value="'.$valuetoshow.'"'.(empty($tmp[1]) ? '' : ' size="'.$tmp[1].'"').' autofocus>'; |
274
|
274
|
} elseif (preg_match('/^(numeric|amount)/', $typeofdata)) { |
275
|
275
|
$tmp = explode(':', $typeofdata); |
276
|
276
|
$valuetoshow = price2num($editvalue ? $editvalue : $value); |
277
|
|
- $ret .= '<input type="text" id="' . $htmlname . '" name="' . $htmlname . '" value="' . ($valuetoshow != '' ? price($valuetoshow) : '') . '"' . (empty($tmp[1]) ? '' : ' size="' . $tmp[1] . '"') . ' autofocus>'; |
|
277
|
+ $ret .= '<input type="text" id="'.$htmlname.'" name="'.$htmlname.'" value="'.($valuetoshow != '' ? price($valuetoshow) : '').'"'.(empty($tmp[1]) ? '' : ' size="'.$tmp[1].'"').' autofocus>'; |
278
|
278
|
} elseif (preg_match('/^(checkbox)/', $typeofdata)) { |
279
|
279
|
$tmp = explode(':', $typeofdata); |
280
|
|
- $ret .= '<input type="checkbox" id="' . $htmlname . '" name="' . $htmlname . '" value="' . ($value ? $value : 'on') . '"' . ($value ? ' checked' : '') . (empty($tmp[1]) ? '' : $tmp[1]) . '/>'; |
|
280
|
+ $ret .= '<input type="checkbox" id="'.$htmlname.'" name="'.$htmlname.'" value="'.($value ? $value : 'on').'"'.($value ? ' checked' : '').(empty($tmp[1]) ? '' : $tmp[1]).'/>'; |
281
|
281
|
} elseif (preg_match('/^text/', $typeofdata) || preg_match('/^note/', $typeofdata)) { // if wysiwyg is enabled $typeofdata = 'ckeditor' |
282
|
282
|
$tmp = explode(':', $typeofdata); |
283
|
283
|
$cols = (empty($tmp[2]) ? '' : $tmp[2]); |
284
|
284
|
$morealt = ''; |
285
|
285
|
if (preg_match('/%/', $cols)) { |
286
|
|
- $morealt = ' style="width: ' . $cols . '"'; |
|
286
|
+ $morealt = ' style="width: '.$cols.'"'; |
287
|
287
|
$cols = ''; |
288
|
288
|
} |
289
|
289
|
$valuetoshow = ($editvalue ? $editvalue : $value); |
290
|
|
- $ret .= '<textarea id="' . $htmlname . '" name="' . $htmlname . '" wrap="soft" rows="' . (empty($tmp[1]) ? '20' : $tmp[1]) . '"' . ($cols ? ' cols="' . $cols . '"' : 'class="quatrevingtpercent"') . $morealt . '" autofocus>'; |
|
290
|
+ $ret .= '<textarea id="'.$htmlname.'" name="'.$htmlname.'" wrap="soft" rows="'.(empty($tmp[1]) ? '20' : $tmp[1]).'"'.($cols ? ' cols="'.$cols.'"' : 'class="quatrevingtpercent"').$morealt.'" autofocus>'; |
291
|
291
|
// textarea convert automatically entities chars into simple chars. |
292
|
292
|
// 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 wysiwyg is off. |
293
|
293
|
$valuetoshow = str_replace('&', '&', $valuetoshow); |
|
@@ -297,12 +297,12 @@ discard block |
|
|
block discarded – undo |
297
|
297
|
$addnowlink = empty($moreoptions['addnowlink']) ? 0 : $moreoptions['addnowlink']; |
298
|
298
|
$adddateof = empty($moreoptions['adddateof']) ? '' : $moreoptions['adddateof']; |
299
|
299
|
$labeladddateof = empty($moreoptions['labeladddateof']) ? '' : $moreoptions['labeladddateof']; |
300
|
|
- $ret .= $this->selectDate($value, $htmlname, 0, 0, 1, 'form' . $htmlname, 1, $addnowlink, 0, '', '', $adddateof, '', 1, $labeladddateof, '', $gm); |
|
300
|
+ $ret .= $this->selectDate($value, $htmlname, 0, 0, 1, 'form'.$htmlname, 1, $addnowlink, 0, '', '', $adddateof, '', 1, $labeladddateof, '', $gm); |
301
|
301
|
} elseif ($typeofdata == 'dayhour' || $typeofdata == 'datehourpicker') { |
302
|
302
|
$addnowlink = empty($moreoptions['addnowlink']) ? 0 : $moreoptions['addnowlink']; |
303
|
303
|
$adddateof = empty($moreoptions['adddateof']) ? '' : $moreoptions['adddateof']; |
304
|
304
|
$labeladddateof = empty($moreoptions['labeladddateof']) ? '' : $moreoptions['labeladddateof']; |
305
|
|
- $ret .= $this->selectDate($value, $htmlname, 1, 1, 1, 'form' . $htmlname, 1, $addnowlink, 0, '', '', $adddateof, '', 1, $labeladddateof, '', $gm); |
|
305
|
+ $ret .= $this->selectDate($value, $htmlname, 1, 1, 1, 'form'.$htmlname, 1, $addnowlink, 0, '', '', $adddateof, '', 1, $labeladddateof, '', $gm); |
306
|
306
|
} elseif (preg_match('/^select;/', $typeofdata)) { |
307
|
307
|
$arraydata = explode(',', preg_replace('/^select;/', '', $typeofdata)); |
308
|
308
|
$arraylist = array(); |
|
@@ -316,7 +316,7 @@ discard block |
|
|
block discarded – undo |
316
|
316
|
// TODO Not yet implemented. See code for extrafields |
317
|
317
|
} elseif (preg_match('/^ckeditor/', $typeofdata)) { |
318
|
318
|
$tmp = explode(':', $typeofdata); // Example: ckeditor:dolibarr_zzz:width:height:savemethod:toolbarstartexpanded:rows:cols:uselocalbrowser |
319
|
|
- require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php'; |
|
319
|
+ require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; |
320
|
320
|
$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])); |
321
|
321
|
$ret .= $doleditor->Create(1); |
322
|
322
|
} elseif ($typeofdata == 'asis') { |
|
@@ -331,19 +331,19 @@ discard block |
|
|
block discarded – undo |
331
|
331
|
$ret .= '<td>'; |
332
|
332
|
} |
333
|
333
|
//else $ret.='<div class="clearboth"></div>'; |
334
|
|
- $ret .= '<input type="submit" class="smallpaddingimp button' . (empty($notabletag) ? '' : ' ') . '" name="modify" value="' . $langs->trans("Modify") . '">'; |
|
334
|
+ $ret .= '<input type="submit" class="smallpaddingimp button'.(empty($notabletag) ? '' : ' ').'" name="modify" value="'.$langs->trans("Modify").'">'; |
335
|
335
|
if (preg_match('/ckeditor|textarea/', $typeofdata) && empty($notabletag)) { |
336
|
|
- $ret .= '<br>' . "\n"; |
|
336
|
+ $ret .= '<br>'."\n"; |
337
|
337
|
} |
338
|
|
- $ret .= '<input type="submit" class="smallpaddingimp button button-cancel' . (empty($notabletag) ? '' : ' ') . '" name="cancel" value="' . $langs->trans("Cancel") . '">'; |
|
338
|
+ $ret .= '<input type="submit" class="smallpaddingimp button button-cancel'.(empty($notabletag) ? '' : ' ').'" name="cancel" value="'.$langs->trans("Cancel").'">'; |
339
|
339
|
if (empty($notabletag)) { |
340
|
340
|
$ret .= '</td>'; |
341
|
341
|
} |
342
|
342
|
|
343
|
343
|
if (empty($notabletag)) { |
344
|
|
- $ret .= '</tr></table>' . "\n"; |
|
344
|
+ $ret .= '</tr></table>'."\n"; |
345
|
345
|
} |
346
|
|
- $ret .= '</form>' . "\n"; |
|
346
|
+ $ret .= '</form>'."\n"; |
347
|
347
|
} else { // view mode |
348
|
348
|
if (preg_match('/^email/', $typeofdata)) { |
349
|
349
|
$ret .= dol_print_email($value, 0, 0, 0, 0, 1); |
|
@@ -355,15 +355,15 @@ discard block |
|
|
block discarded – undo |
355
|
355
|
$ret .= ($value != '' ? price($value, 0, $langs, 0, -1, -1, $conf->currency) : ''); |
356
|
356
|
} elseif (preg_match('/^checkbox/', $typeofdata)) { |
357
|
357
|
$tmp = explode(':', $typeofdata); |
358
|
|
- $ret .= '<input type="checkbox" disabled id="' . $htmlname . '" name="' . $htmlname . '" value="' . $value . '"' . ($value ? ' checked' : '') . ($tmp[1] ? $tmp[1] : '') . '/>'; |
|
358
|
+ $ret .= '<input type="checkbox" disabled id="'.$htmlname.'" name="'.$htmlname.'" value="'.$value.'"'.($value ? ' checked' : '').($tmp[1] ? $tmp[1] : '').'/>'; |
359
|
359
|
} elseif (preg_match('/^text/', $typeofdata) || preg_match('/^note/', $typeofdata)) { |
360
|
360
|
$ret .= dol_htmlwithnojs(dol_string_onlythesehtmltags(dol_htmlentitiesbr($value), 1, 1, 1)); |
361
|
361
|
} elseif (preg_match('/^(safehtmlstring|restricthtml)/', $typeofdata)) { // 'restricthtml' is not an allowed type for editfieldval. Value is 'safehtmlstring' |
362
|
362
|
$ret .= dol_htmlwithnojs(dol_string_onlythesehtmltags($value)); |
363
|
363
|
} elseif ($typeofdata == 'day' || $typeofdata == 'datepicker') { |
364
|
|
- $ret .= '<span class="valuedate">' . dol_print_date($value, 'day', $gm) . '</span>'; |
|
364
|
+ $ret .= '<span class="valuedate">'.dol_print_date($value, 'day', $gm).'</span>'; |
365
|
365
|
} elseif ($typeofdata == 'dayhour' || $typeofdata == 'datehourpicker') { |
366
|
|
- $ret .= '<span class="valuedate">' . dol_print_date($value, 'dayhour', $gm) . '</span>'; |
|
366
|
+ $ret .= '<span class="valuedate">'.dol_print_date($value, 'dayhour', $gm).'</span>'; |
367
|
367
|
} elseif (preg_match('/^select;/', $typeofdata)) { |
368
|
368
|
$arraydata = explode(',', preg_replace('/^select;/', '', $typeofdata)); |
369
|
369
|
$arraylist = array(); |
|
@@ -374,9 +374,9 @@ discard block |
|
|
block discarded – undo |
374
|
374
|
$ret .= $arraylist[$value]; |
375
|
375
|
if ($htmlname == 'fk_product_type') { |
376
|
376
|
if ($value == 0) { |
377
|
|
- $ret = img_picto($langs->trans("Product"), 'product', 'class="paddingleftonly paddingrightonly colorgrey"') . $ret; |
|
377
|
+ $ret = img_picto($langs->trans("Product"), 'product', 'class="paddingleftonly paddingrightonly colorgrey"').$ret; |
378
|
378
|
} else { |
379
|
|
- $ret = img_picto($langs->trans("Service"), 'service', 'class="paddingleftonly paddingrightonly colorgrey"') . $ret; |
|
379
|
+ $ret = img_picto($langs->trans("Service"), 'service', 'class="paddingleftonly paddingrightonly colorgrey"').$ret; |
380
|
380
|
} |
381
|
381
|
} |
382
|
382
|
} elseif (preg_match('/^ckeditor/', $typeofdata)) { |
|
@@ -384,7 +384,7 @@ discard block |
|
|
block discarded – undo |
384
|
384
|
if (getDolGlobalString('MAIN_DISABLE_NOTES_TAB')) { |
385
|
385
|
$firstline = preg_replace('/<br>.*/', '', $tmpcontent); |
386
|
386
|
$firstline = preg_replace('/[\n\r].*/', '', $firstline); |
387
|
|
- $tmpcontent = $firstline . ((strlen($firstline) != strlen($tmpcontent)) ? '...' : ''); |
|
387
|
+ $tmpcontent = $firstline.((strlen($firstline) != strlen($tmpcontent)) ? '...' : ''); |
388
|
388
|
} |
389
|
389
|
// We don't use dol_escape_htmltag to get the html formatting active, but this need we must also |
390
|
390
|
// clean data from some dangerous html |
|
@@ -393,7 +393,7 @@ discard block |
|
|
block discarded – undo |
393
|
393
|
if (empty($moreoptions['valuealreadyhtmlescaped'])) { |
394
|
394
|
$ret .= dol_escape_htmltag($value); |
395
|
395
|
} else { |
396
|
|
- $ret .= $value; // $value must be already html escaped. |
|
396
|
+ $ret .= $value; // $value must be already html escaped. |
397
|
397
|
} |
398
|
398
|
} |
399
|
399
|
|
|
@@ -431,7 +431,7 @@ discard block |
|
|
block discarded – undo |
431
|
431
|
|
432
|
432
|
if (is_array($arrayoflangcode) && count($arrayoflangcode)) { |
433
|
433
|
if (!is_object($extralanguages)) { |
434
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/class/extralanguages.class.php'; |
|
434
|
+ include_once DOL_DOCUMENT_ROOT.'/core/class/extralanguages.class.php'; |
435
|
435
|
$extralanguages = new ExtraLanguages($this->db); |
436
|
436
|
} |
437
|
437
|
$extralanguages->fetch_name_extralanguages('societe'); |
|
@@ -440,17 +440,17 @@ discard block |
|
|
block discarded – undo |
440
|
440
|
return ''; // No extralang field to show |
441
|
441
|
} |
442
|
442
|
|
443
|
|
- $result .= '<!-- Widget for translation -->' . "\n"; |
444
|
|
- $result .= '<div class="inline-block paddingleft image-' . $object->element . '-' . $fieldname . '">'; |
|
443
|
+ $result .= '<!-- Widget for translation -->'."\n"; |
|
444
|
+ $result .= '<div class="inline-block paddingleft image-'.$object->element.'-'.$fieldname.'">'; |
445
|
445
|
$s = img_picto($langs->trans("ShowOtherLanguages"), 'language', '', false, 0, 0, '', 'fa-15 editfieldlang'); |
446
|
446
|
$result .= $s; |
447
|
447
|
$result .= '</div>'; |
448
|
448
|
|
449
|
|
- $result .= '<div class="inline-block hidden field-' . $object->element . '-' . $fieldname . '">'; |
|
449
|
+ $result .= '<div class="inline-block hidden field-'.$object->element.'-'.$fieldname.'">'; |
450
|
450
|
|
451
|
451
|
$resultforextrlang = ''; |
452
|
452
|
foreach ($arrayoflangcode as $langcode) { |
453
|
|
- $valuetoshow = GETPOSTISSET('field-' . $object->element . "-" . $fieldname . "-" . $langcode) ? GETPOST('field-' . $object->element . '-' . $fieldname . "-" . $langcode, $check) : ''; |
|
453
|
+ $valuetoshow = GETPOSTISSET('field-'.$object->element."-".$fieldname."-".$langcode) ? GETPOST('field-'.$object->element.'-'.$fieldname."-".$langcode, $check) : ''; |
454
|
454
|
if (empty($valuetoshow)) { |
455
|
455
|
$object->fetchValuesForExtraLanguages(); |
456
|
456
|
//var_dump($object->array_languages); |
|
@@ -462,17 +462,17 @@ discard block |
|
|
block discarded – undo |
462
|
462
|
|
463
|
463
|
// TODO Use the showInputField() method of ExtraLanguages object |
464
|
464
|
if ($typeofdata == 'textarea') { |
465
|
|
- $resultforextrlang .= '<textarea name="field-' . $object->element . "-" . $fieldname . "-" . $langcode . '" id="' . $fieldname . "-" . $langcode . '" class="' . $morecss . '" rows="' . ROWS_2 . '" wrap="soft">'; |
|
465
|
+ $resultforextrlang .= '<textarea name="field-'.$object->element."-".$fieldname."-".$langcode.'" id="'.$fieldname."-".$langcode.'" class="'.$morecss.'" rows="'.ROWS_2.'" wrap="soft">'; |
466
|
466
|
$resultforextrlang .= $valuetoshow; |
467
|
467
|
$resultforextrlang .= '</textarea>'; |
468
|
468
|
} else { |
469
|
|
- $resultforextrlang .= '<input type="text" class="inputfieldforlang ' . ($morecss ? ' ' . $morecss : '') . '" name="field-' . $object->element . '-' . $fieldname . '-' . $langcode . '" value="' . $valuetoshow . '">'; |
|
469
|
+ $resultforextrlang .= '<input type="text" class="inputfieldforlang '.($morecss ? ' '.$morecss : '').'" name="field-'.$object->element.'-'.$fieldname.'-'.$langcode.'" value="'.$valuetoshow.'">'; |
470
|
470
|
} |
471
|
471
|
} |
472
|
472
|
$result .= $resultforextrlang; |
473
|
473
|
|
474
|
474
|
$result .= '</div>'; |
475
|
|
- $result .= '<script nonce="' . getNonce() . '">$(".image-' . $object->element . '-' . $fieldname . '").click(function() { console.log("Toggle lang widget"); jQuery(".field-' . $object->element . '-' . $fieldname . '").toggle(); });</script>'; |
|
475
|
+ $result .= '<script nonce="'.getNonce().'">$(".image-'.$object->element.'-'.$fieldname.'").click(function() { console.log("Toggle lang widget"); jQuery(".field-'.$object->element.'-'.$fieldname.'").toggle(); });</script>'; |
476
|
476
|
} |
477
|
477
|
|
478
|
478
|
return $result; |
|
@@ -535,7 +535,7 @@ discard block |
|
|
block discarded – undo |
535
|
535
|
if (!empty($tmp[2])) { |
536
|
536
|
$savemethod = $tmp[2]; |
537
|
537
|
} |
538
|
|
- $out .= '<input id="width_' . $htmlname . '" value="' . $inputOption . '" type="hidden"/>' . "\n"; |
|
538
|
+ $out .= '<input id="width_'.$htmlname.'" value="'.$inputOption.'" type="hidden"/>'."\n"; |
539
|
539
|
} elseif ((preg_match('/^day$/', $inputType)) || (preg_match('/^datepicker/', $inputType)) || (preg_match('/^datehourpicker/', $inputType))) { |
540
|
540
|
$tmp = explode(':', $inputType); |
541
|
541
|
$inputType = $tmp[0]; |
|
@@ -546,7 +546,7 @@ discard block |
|
|
block discarded – undo |
546
|
546
|
$savemethod = $tmp[2]; |
547
|
547
|
} |
548
|
548
|
|
549
|
|
- $out .= '<input id="timestamp" type="hidden"/>' . "\n"; // Use for timestamp format |
|
549
|
+ $out .= '<input id="timestamp" type="hidden"/>'."\n"; // Use for timestamp format |
550
|
550
|
} elseif (preg_match('/^(select|autocomplete)/', $inputType)) { |
551
|
551
|
$tmp = explode(':', $inputType); |
552
|
552
|
$inputType = $tmp[0]; |
|
@@ -577,40 +577,40 @@ discard block |
|
|
block discarded – undo |
577
|
577
|
} |
578
|
578
|
|
579
|
579
|
if (isModEnabled('fckeditor')) { |
580
|
|
- $out .= '<input id="ckeditor_toolbar" value="' . $toolbar . '" type="hidden"/>' . "\n"; |
|
580
|
+ $out .= '<input id="ckeditor_toolbar" value="'.$toolbar.'" type="hidden"/>'."\n"; |
581
|
581
|
} else { |
582
|
582
|
$inputType = 'textarea'; |
583
|
583
|
} |
584
|
584
|
} |
585
|
585
|
|
586
|
|
- $out .= '<input id="element_' . $htmlname . '" value="' . $element . '" type="hidden"/>' . "\n"; |
587
|
|
- $out .= '<input id="table_element_' . $htmlname . '" value="' . $table_element . '" type="hidden"/>' . "\n"; |
588
|
|
- $out .= '<input id="fk_element_' . $htmlname . '" value="' . $fk_element . '" type="hidden"/>' . "\n"; |
589
|
|
- $out .= '<input id="loadmethod_' . $htmlname . '" value="' . $loadmethod . '" type="hidden"/>' . "\n"; |
|
586
|
+ $out .= '<input id="element_'.$htmlname.'" value="'.$element.'" type="hidden"/>'."\n"; |
|
587
|
+ $out .= '<input id="table_element_'.$htmlname.'" value="'.$table_element.'" type="hidden"/>'."\n"; |
|
588
|
+ $out .= '<input id="fk_element_'.$htmlname.'" value="'.$fk_element.'" type="hidden"/>'."\n"; |
|
589
|
+ $out .= '<input id="loadmethod_'.$htmlname.'" value="'.$loadmethod.'" type="hidden"/>'."\n"; |
590
|
590
|
if (!empty($savemethod)) { |
591
|
|
- $out .= '<input id="savemethod_' . $htmlname . '" value="' . $savemethod . '" type="hidden"/>' . "\n"; |
|
591
|
+ $out .= '<input id="savemethod_'.$htmlname.'" value="'.$savemethod.'" type="hidden"/>'."\n"; |
592
|
592
|
} |
593
|
593
|
if (!empty($ext_element)) { |
594
|
|
- $out .= '<input id="ext_element_' . $htmlname . '" value="' . $ext_element . '" type="hidden"/>' . "\n"; |
|
594
|
+ $out .= '<input id="ext_element_'.$htmlname.'" value="'.$ext_element.'" type="hidden"/>'."\n"; |
595
|
595
|
} |
596
|
596
|
if (!empty($custommsg)) { |
597
|
597
|
if (is_array($custommsg)) { |
598
|
598
|
if (!empty($custommsg['success'])) { |
599
|
|
- $out .= '<input id="successmsg_' . $htmlname . '" value="' . $custommsg['success'] . '" type="hidden"/>' . "\n"; |
|
599
|
+ $out .= '<input id="successmsg_'.$htmlname.'" value="'.$custommsg['success'].'" type="hidden"/>'."\n"; |
600
|
600
|
} |
601
|
601
|
if (!empty($custommsg['error'])) { |
602
|
|
- $out .= '<input id="errormsg_' . $htmlname . '" value="' . $custommsg['error'] . '" type="hidden"/>' . "\n"; |
|
602
|
+ $out .= '<input id="errormsg_'.$htmlname.'" value="'.$custommsg['error'].'" type="hidden"/>'."\n"; |
603
|
603
|
} |
604
|
604
|
} else { |
605
|
|
- $out .= '<input id="successmsg_' . $htmlname . '" value="' . $custommsg . '" type="hidden"/>' . "\n"; |
|
605
|
+ $out .= '<input id="successmsg_'.$htmlname.'" value="'.$custommsg.'" type="hidden"/>'."\n"; |
606
|
606
|
} |
607
|
607
|
} |
608
|
608
|
if ($inputType == 'textarea') { |
609
|
|
- $out .= '<input id="textarea_' . $htmlname . '_rows" value="' . $rows . '" type="hidden"/>' . "\n"; |
610
|
|
- $out .= '<input id="textarea_' . $htmlname . '_cols" value="' . $cols . '" type="hidden"/>' . "\n"; |
|
609
|
+ $out .= '<input id="textarea_'.$htmlname.'_rows" value="'.$rows.'" type="hidden"/>'."\n"; |
|
610
|
+ $out .= '<input id="textarea_'.$htmlname.'_cols" value="'.$cols.'" type="hidden"/>'."\n"; |
611
|
611
|
} |
612
|
|
- $out .= '<span id="viewval_' . $htmlname . '" class="viewval_' . $inputType . ($button_only ? ' inactive' : ' active') . '">' . $value . '</span>' . "\n"; |
613
|
|
- $out .= '<span id="editval_' . $htmlname . '" class="editval_' . $inputType . ($button_only ? ' inactive' : ' active') . ' hideobject">' . (!empty($editvalue) ? $editvalue : $value) . '</span>' . "\n"; |
|
612
|
+ $out .= '<span id="viewval_'.$htmlname.'" class="viewval_'.$inputType.($button_only ? ' inactive' : ' active').'">'.$value.'</span>'."\n"; |
|
613
|
+ $out .= '<span id="editval_'.$htmlname.'" class="editval_'.$inputType.($button_only ? ' inactive' : ' active').' hideobject">'.(!empty($editvalue) ? $editvalue : $value).'</span>'."\n"; |
614
|
614
|
} else { |
615
|
615
|
$out = $value; |
616
|
616
|
} |
|
@@ -639,12 +639,12 @@ discard block |
|
|
block discarded – undo |
639
|
639
|
public function textwithtooltip($text, $htmltext, $tooltipon = 1, $direction = 0, $img = '', $extracss = '', $notabs = 3, $incbefore = '', $noencodehtmltext = 0, $tooltiptrigger = '', $forcenowrap = 0) |
640
|
640
|
{ |
641
|
641
|
if ($incbefore) { |
642
|
|
- $text = $incbefore . $text; |
|
642
|
+ $text = $incbefore.$text; |
643
|
643
|
} |
644
|
644
|
if (!$htmltext) { |
645
|
645
|
return $text; |
646
|
646
|
} |
647
|
|
- $direction = (int) $direction; // For backward compatibility when $direction was set to '' instead of 0 |
|
647
|
+ $direction = (int) $direction; // For backward compatibility when $direction was set to '' instead of 0 |
648
|
648
|
|
649
|
649
|
$tag = 'td'; |
650
|
650
|
if ($notabs == 2) { |
|
@@ -658,11 +658,11 @@ discard block |
|
|
block discarded – undo |
658
|
658
|
|
659
|
659
|
$extrastyle = ''; |
660
|
660
|
if ($direction < 0) { |
661
|
|
- $extracss = ($extracss ? $extracss . ' ' : '') . ($notabs != 3 ? 'inline-block' : ''); |
|
661
|
+ $extracss = ($extracss ? $extracss.' ' : '').($notabs != 3 ? 'inline-block' : ''); |
662
|
662
|
$extrastyle = 'padding: 0px; padding-left: 2px;'; |
663
|
663
|
} |
664
|
664
|
if ($direction > 0) { |
665
|
|
- $extracss = ($extracss ? $extracss . ' ' : '') . ($notabs != 3 ? 'inline-block' : ''); |
|
665
|
+ $extracss = ($extracss ? $extracss.' ' : '').($notabs != 3 ? 'inline-block' : ''); |
666
|
666
|
$extrastyle = 'padding: 0px; padding-right: 2px;'; |
667
|
667
|
} |
668
|
668
|
|
|
@@ -675,53 +675,53 @@ discard block |
|
|
block discarded – undo |
675
|
675
|
$htmltext = str_replace('"', '"', $htmltext); |
676
|
676
|
} else { |
677
|
677
|
$classfortooltip = 'classfortooltiponclick'; |
678
|
|
- $textfordialog .= '<div style="display: none;" id="idfortooltiponclick_' . $tooltiptrigger . '" class="classfortooltiponclicktext">' . $htmltext . '</div>'; |
|
678
|
+ $textfordialog .= '<div style="display: none;" id="idfortooltiponclick_'.$tooltiptrigger.'" class="classfortooltiponclicktext">'.$htmltext.'</div>'; |
679
|
679
|
} |
680
|
680
|
if ($tooltipon == 2 || $tooltipon == 3) { |
681
|
|
- $paramfortooltipimg = ' class="' . $classfortooltip . ($notabs != 3 ? ' inline-block' : '') . ($extracss ? ' ' . $extracss : '') . '" style="padding: 0px;' . ($extrastyle ? ' ' . $extrastyle : '') . '"'; |
|
681
|
+ $paramfortooltipimg = ' class="'.$classfortooltip.($notabs != 3 ? ' inline-block' : '').($extracss ? ' '.$extracss : '').'" style="padding: 0px;'.($extrastyle ? ' '.$extrastyle : '').'"'; |
682
|
682
|
if ($tooltiptrigger == '') { |
683
|
|
- $paramfortooltipimg .= ' title="' . ($noencodehtmltext ? $htmltext : dol_escape_htmltag($htmltext, 1)) . '"'; // Attribute to put on img tag to store tooltip |
|
683
|
+ $paramfortooltipimg .= ' title="'.($noencodehtmltext ? $htmltext : dol_escape_htmltag($htmltext, 1)).'"'; // Attribute to put on img tag to store tooltip |
684
|
684
|
} else { |
685
|
|
- $paramfortooltipimg .= ' dolid="' . $tooltiptrigger . '"'; |
|
685
|
+ $paramfortooltipimg .= ' dolid="'.$tooltiptrigger.'"'; |
686
|
686
|
} |
687
|
687
|
} else { |
688
|
|
- $paramfortooltipimg = ($extracss ? ' class="' . $extracss . '"' : '') . ($extrastyle ? ' style="' . $extrastyle . '"' : ''); // Attribute to put on td text tag |
|
688
|
+ $paramfortooltipimg = ($extracss ? ' class="'.$extracss.'"' : '').($extrastyle ? ' style="'.$extrastyle.'"' : ''); // Attribute to put on td text tag |
689
|
689
|
} |
690
|
690
|
if ($tooltipon == 1 || $tooltipon == 3) { |
691
|
|
- $paramfortooltiptd = ' class="' . ($tooltipon == 3 ? 'cursorpointer ' : '') . $classfortooltip . ' inline-block' . ($extracss ? ' ' . $extracss : '') . '" style="padding: 0px;' . ($extrastyle ? ' ' . $extrastyle : '') . '" '; |
|
691
|
+ $paramfortooltiptd = ' class="'.($tooltipon == 3 ? 'cursorpointer ' : '').$classfortooltip.' inline-block'.($extracss ? ' '.$extracss : '').'" style="padding: 0px;'.($extrastyle ? ' '.$extrastyle : '').'" '; |
692
|
692
|
if ($tooltiptrigger == '') { |
693
|
|
- $paramfortooltiptd .= ' title="' . ($noencodehtmltext ? $htmltext : dol_escape_htmltag($htmltext, 1)) . '"'; // Attribute to put on td tag to store tooltip |
|
693
|
+ $paramfortooltiptd .= ' title="'.($noencodehtmltext ? $htmltext : dol_escape_htmltag($htmltext, 1)).'"'; // Attribute to put on td tag to store tooltip |
694
|
694
|
} else { |
695
|
|
- $paramfortooltiptd .= ' dolid="' . $tooltiptrigger . '"'; |
|
695
|
+ $paramfortooltiptd .= ' dolid="'.$tooltiptrigger.'"'; |
696
|
696
|
} |
697
|
697
|
} else { |
698
|
|
- $paramfortooltiptd = ($extracss ? ' class="' . $extracss . '"' : '') . ($extrastyle ? ' style="' . $extrastyle . '"' : ''); // Attribute to put on td text tag |
|
698
|
+ $paramfortooltiptd = ($extracss ? ' class="'.$extracss.'"' : '').($extrastyle ? ' style="'.$extrastyle.'"' : ''); // Attribute to put on td text tag |
699
|
699
|
} |
700
|
700
|
if (empty($notabs)) { |
701
|
701
|
$s .= '<table class="nobordernopadding"><tr style="height: auto;">'; |
702
|
702
|
} elseif ($notabs == 2) { |
703
|
|
- $s .= '<div class="inline-block' . ($forcenowrap ? ' nowrap' : '') . '">'; |
|
703
|
+ $s .= '<div class="inline-block'.($forcenowrap ? ' nowrap' : '').'">'; |
704
|
704
|
} |
705
|
705
|
// Define value if value is before |
706
|
706
|
if ($direction < 0) { |
707
|
|
- $s .= '<' . $tag . $paramfortooltipimg; |
|
707
|
+ $s .= '<'.$tag.$paramfortooltipimg; |
708
|
708
|
if ($tag == 'td') { |
709
|
709
|
$s .= ' class="valigntop" width="14"'; |
710
|
710
|
} |
711
|
|
- $s .= '>' . $textfordialog . $img . '</' . $tag . '>'; |
|
711
|
+ $s .= '>'.$textfordialog.$img.'</'.$tag.'>'; |
712
|
712
|
} |
713
|
713
|
// Use another method to help avoid having a space in value in order to use this value with jquery |
714
|
714
|
// Define label |
715
|
715
|
if ((string) $text != '') { |
716
|
|
- $s .= '<' . $tag . $paramfortooltiptd . '>' . $text . '</' . $tag . '>'; |
|
716
|
+ $s .= '<'.$tag.$paramfortooltiptd.'>'.$text.'</'.$tag.'>'; |
717
|
717
|
} |
718
|
718
|
// Define value if value is after |
719
|
719
|
if ($direction > 0) { |
720
|
|
- $s .= '<' . $tag . $paramfortooltipimg; |
|
720
|
+ $s .= '<'.$tag.$paramfortooltipimg; |
721
|
721
|
if ($tag == 'td') { |
722
|
722
|
$s .= ' class="valignmiddle" width="14"'; |
723
|
723
|
} |
724
|
|
- $s .= '>' . $textfordialog . $img . '</' . $tag . '>'; |
|
724
|
+ $s .= '>'.$textfordialog.$img.'</'.$tag.'>'; |
725
|
725
|
} |
726
|
726
|
if (empty($notabs)) { |
727
|
727
|
$s .= '</tr></table>'; |
|
@@ -828,7 +828,7 @@ discard block |
|
|
block discarded – undo |
828
|
828
|
|
829
|
829
|
$disabled = 0; |
830
|
830
|
$ret = '<div class="centpercent center">'; |
831
|
|
- $ret .= '<select class="flat' . (empty($conf->use_javascript_ajax) ? '' : ' hideobject') . ' ' . $name . ' ' . $name . 'select valignmiddle alignstart" id="' . $name . '" name="' . $name . '"' . ($disabled ? ' disabled="disabled"' : '') . '>'; |
|
831
|
+ $ret .= '<select class="flat'.(empty($conf->use_javascript_ajax) ? '' : ' hideobject').' '.$name.' '.$name.'select valignmiddle alignstart" id="'.$name.'" name="'.$name.'"'.($disabled ? ' disabled="disabled"' : '').'>'; |
832
|
832
|
|
833
|
833
|
// 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. |
834
|
834
|
$parameters = array(); |
|
@@ -839,10 +839,10 @@ discard block |
|
|
block discarded – undo |
839
|
839
|
return; |
840
|
840
|
} |
841
|
841
|
if (empty($reshook)) { |
842
|
|
- $ret .= '<option value="0"' . ($disabled ? ' disabled="disabled"' : '') . '>-- ' . $langs->trans("SelectAction") . ' --</option>'; |
|
842
|
+ $ret .= '<option value="0"'.($disabled ? ' disabled="disabled"' : '').'>-- '.$langs->trans("SelectAction").' --</option>'; |
843
|
843
|
if (is_array($arrayofaction)) { |
844
|
844
|
foreach ($arrayofaction as $code => $label) { |
845
|
|
- $ret .= '<option value="' . $code . '"' . ($disabled ? ' disabled="disabled"' : '') . ' data-html="' . dol_escape_htmltag($label) . '">' . $label . '</option>'; |
|
845
|
+ $ret .= '<option value="'.$code.'"'.($disabled ? ' disabled="disabled"' : '').' data-html="'.dol_escape_htmltag($label).'">'.$label.'</option>'; |
846
|
846
|
} |
847
|
847
|
} |
848
|
848
|
} |
|
@@ -851,17 +851,17 @@ discard block |
|
|
block discarded – undo |
851
|
851
|
$ret .= '</select>'; |
852
|
852
|
|
853
|
853
|
if (empty($conf->dol_optimize_smallscreen)) { |
854
|
|
- $ret .= ajax_combobox('.' . $name . 'select'); |
|
854
|
+ $ret .= ajax_combobox('.'.$name.'select'); |
855
|
855
|
} |
856
|
856
|
|
857
|
857
|
// 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 |
858
|
858
|
$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. |
859
|
|
- $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")) . '">'; |
|
859
|
+ $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")).'">'; |
860
|
860
|
$ret .= '</div>'; |
861
|
861
|
|
862
|
862
|
if (!empty($conf->use_javascript_ajax)) { |
863
|
863
|
$ret .= '<!-- JS CODE TO ENABLE mass action select --> |
864
|
|
- <script nonce="' . getNonce() . '"> |
|
864
|
+ <script nonce="' . getNonce().'"> |
865
|
865
|
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 */ |
866
|
866
|
{ |
867
|
867
|
atleastoneselected=0; |
|
@@ -872,11 +872,11 @@ discard block |
|
|
block discarded – undo |
872
|
872
|
|
873
|
873
|
console.log("initCheckForSelect mode="+mode+" name="+name+" cssclass="+cssclass+" atleastoneselected="+atleastoneselected); |
874
|
874
|
|
875
|
|
- if (atleastoneselected || ' . $alwaysvisible . ') |
|
875
|
+ if (atleastoneselected || ' . $alwaysvisible.') |
876
|
876
|
{ |
877
|
877
|
jQuery("."+name).show(); |
878
|
|
- ' . ($selected ? 'if (atleastoneselected) { jQuery("."+name+"select").val("' . $selected . '").trigger(\'change\'); jQuery("."+name+"confirmed").prop(\'disabled\', false); }' : '') . ' |
879
|
|
- ' . ($selected ? 'if (! atleastoneselected) { jQuery("."+name+"select").val("0").trigger(\'change\'); jQuery("."+name+"confirmed").prop(\'disabled\', true); } ' : '') . ' |
|
878
|
+ ' . ($selected ? 'if (atleastoneselected) { jQuery("."+name+"select").val("'.$selected.'").trigger(\'change\'); jQuery("."+name+"confirmed").prop(\'disabled\', false); }' : '').' |
|
879
|
+ ' . ($selected ? 'if (! atleastoneselected) { jQuery("."+name+"select").val("0").trigger(\'change\'); jQuery("."+name+"confirmed").prop(\'disabled\', true); } ' : '').' |
880
|
880
|
} |
881
|
881
|
else |
882
|
882
|
{ |
|
@@ -886,11 +886,11 @@ discard block |
|
|
block discarded – undo |
886
|
886
|
} |
887
|
887
|
|
888
|
888
|
jQuery(document).ready(function () { |
889
|
|
- initCheckForSelect(0, "' . $name . '", "' . $cssclass . '"); |
890
|
|
- jQuery(".' . $cssclass . '").click(function() { |
891
|
|
- initCheckForSelect(1, "' . $name . '", "' . $cssclass . '"); |
|
889
|
+ initCheckForSelect(0, "' . $name.'", "'.$cssclass.'"); |
|
890
|
+ jQuery(".' . $cssclass.'").click(function() { |
|
891
|
+ initCheckForSelect(1, "' . $name.'", "'.$cssclass.'"); |
892
|
892
|
}); |
893
|
|
- jQuery(".' . $name . 'select").change(function() { |
|
893
|
+ jQuery(".' . $name.'select").change(function() { |
894
|
894
|
var massaction = $( this ).val(); |
895
|
895
|
var urlform = $( this ).closest("form").attr("action").replace("#show_files",""); |
896
|
896
|
if (massaction == "builddoc") |
|
@@ -898,18 +898,18 @@ discard block |
|
|
block discarded – undo |
898
|
898
|
urlform = urlform + "#show_files"; |
899
|
899
|
} |
900
|
900
|
$( this ).closest("form").attr("action", urlform); |
901
|
|
- console.log("we select a mass action name=' . $name . ' massaction="+massaction+" - "+urlform); |
|
901
|
+ console.log("we select a mass action name=' . $name.' massaction="+massaction+" - "+urlform); |
902
|
902
|
/* Warning: if you set submit button to disabled, post using Enter will no more work if there is no other button */ |
903
|
903
|
if ($(this).val() != \'0\') |
904
|
904
|
{ |
905
|
|
- jQuery(".' . $name . 'confirmed").prop(\'disabled\', false); |
906
|
|
- jQuery(".' . $name . 'other").hide(); /* To disable if another div was open */ |
907
|
|
- jQuery(".' . $name . '"+massaction).show(); |
|
905
|
+ jQuery(".' . $name.'confirmed").prop(\'disabled\', false); |
|
906
|
+ jQuery(".' . $name.'other").hide(); /* To disable if another div was open */ |
|
907
|
+ jQuery(".' . $name.'"+massaction).show(); |
908
|
908
|
} |
909
|
909
|
else |
910
|
910
|
{ |
911
|
|
- jQuery(".' . $name . 'confirmed").prop(\'disabled\', true); |
912
|
|
- jQuery(".' . $name . 'other").hide(); /* To disable any div open */ |
|
911
|
+ jQuery(".' . $name.'confirmed").prop(\'disabled\', true); |
|
912
|
+ jQuery(".' . $name.'other").hide(); /* To disable any div open */ |
913
|
913
|
} |
914
|
914
|
}); |
915
|
915
|
}); |
|
@@ -952,14 +952,14 @@ discard block |
|
|
block discarded – undo |
952
|
952
|
$atleastonefavorite = 0; |
953
|
953
|
|
954
|
954
|
$sql = "SELECT rowid, code as code_iso, code_iso as code_iso3, label, favorite, eec"; |
955
|
|
- $sql .= " FROM " . $this->db->prefix() . "c_country"; |
|
955
|
+ $sql .= " FROM ".$this->db->prefix()."c_country"; |
956
|
956
|
$sql .= " WHERE active > 0"; |
957
|
957
|
//$sql.= " ORDER BY code ASC"; |
958
|
958
|
|
959
|
|
- dol_syslog(get_class($this) . "::select_country", LOG_DEBUG); |
|
959
|
+ dol_syslog(get_class($this)."::select_country", LOG_DEBUG); |
960
|
960
|
$resql = $this->db->query($sql); |
961
|
961
|
if ($resql) { |
962
|
|
- $out .= '<select id="select' . $htmlname . '" class="flat maxwidth200onsmartphone selectcountry' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" ' . $htmloption . '>'; |
|
962
|
+ $out .= '<select id="select'.$htmlname.'" class="flat maxwidth200onsmartphone selectcountry'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" '.$htmloption.'>'; |
963
|
963
|
$num = $this->db->num_rows($resql); |
964
|
964
|
$i = 0; |
965
|
965
|
if ($num) { |
|
@@ -969,7 +969,7 @@ discard block |
|
|
block discarded – undo |
969
|
969
|
$countryArray[$i]['rowid'] = $obj->rowid; |
970
|
970
|
$countryArray[$i]['code_iso'] = $obj->code_iso; |
971
|
971
|
$countryArray[$i]['code_iso3'] = $obj->code_iso3; |
972
|
|
- $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 : '')); |
|
972
|
+ $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 : '')); |
973
|
973
|
$countryArray[$i]['favorite'] = $obj->favorite; |
974
|
974
|
$countryArray[$i]['eec'] = $obj->eec; |
975
|
975
|
$favorite[$i] = $obj->favorite; |
|
@@ -987,20 +987,20 @@ discard block |
|
|
block discarded – undo |
987
|
987
|
|
988
|
988
|
if ($showempty) { |
989
|
989
|
if (is_numeric($showempty)) { |
990
|
|
- $out .= '<option value=""> </option>' . "\n"; |
|
990
|
+ $out .= '<option value=""> </option>'."\n"; |
991
|
991
|
} else { |
992
|
|
- $out .= '<option value="-1">' . $langs->trans($showempty) . '</option>' . "\n"; |
|
992
|
+ $out .= '<option value="-1">'.$langs->trans($showempty).'</option>'."\n"; |
993
|
993
|
} |
994
|
994
|
} |
995
|
995
|
|
996
|
996
|
if ($addspecialentries) { // Add dedicated entries for groups of countries |
997
|
997
|
//if ($showempty) $out.= '<option value="" disabled class="selectoptiondisabledwhite">--------------</option>'; |
998
|
|
- $out .= '<option value="special_allnotme"' . ($selected == 'special_allnotme' ? ' selected' : '') . '>' . $langs->trans("CountriesExceptMe", $langs->transnoentitiesnoconv("Country" . $mysoc->country_code)) . '</option>'; |
999
|
|
- $out .= '<option value="special_eec"' . ($selected == 'special_eec' ? ' selected' : '') . '>' . $langs->trans("CountriesInEEC") . '</option>'; |
|
998
|
+ $out .= '<option value="special_allnotme"'.($selected == 'special_allnotme' ? ' selected' : '').'>'.$langs->trans("CountriesExceptMe", $langs->transnoentitiesnoconv("Country".$mysoc->country_code)).'</option>'; |
|
999
|
+ $out .= '<option value="special_eec"'.($selected == 'special_eec' ? ' selected' : '').'>'.$langs->trans("CountriesInEEC").'</option>'; |
1000
|
1000
|
if ($mysoc->isInEEC()) { |
1001
|
|
- $out .= '<option value="special_eecnotme"' . ($selected == 'special_eecnotme' ? ' selected' : '') . '>' . $langs->trans("CountriesInEECExceptMe", $langs->transnoentitiesnoconv("Country" . $mysoc->country_code)) . '</option>'; |
|
1001
|
+ $out .= '<option value="special_eecnotme"'.($selected == 'special_eecnotme' ? ' selected' : '').'>'.$langs->trans("CountriesInEECExceptMe", $langs->transnoentitiesnoconv("Country".$mysoc->country_code)).'</option>'; |
1002
|
1002
|
} |
1003
|
|
- $out .= '<option value="special_noteec"' . ($selected == 'special_noteec' ? ' selected' : '') . '>' . $langs->trans("CountriesNotInEEC") . '</option>'; |
|
1003
|
+ $out .= '<option value="special_noteec"'.($selected == 'special_noteec' ? ' selected' : '').'>'.$langs->trans("CountriesNotInEEC").'</option>'; |
1004
|
1004
|
$out .= '<option value="" disabled class="selectoptiondisabledwhite">------------</option>'; |
1005
|
1005
|
} |
1006
|
1006
|
|
|
@@ -1028,20 +1028,20 @@ discard block |
|
|
block discarded – undo |
1028
|
1028
|
$labeltoshow .= ' '; |
1029
|
1029
|
} |
1030
|
1030
|
if ($row['code_iso']) { |
1031
|
|
- $labeltoshow .= ' <span class="opacitymedium">(' . $row['code_iso'] . ')</span>'; |
|
1031
|
+ $labeltoshow .= ' <span class="opacitymedium">('.$row['code_iso'].')</span>'; |
1032
|
1032
|
if (empty($hideflags)) { |
1033
|
1033
|
$tmpflag = picto_from_langcode($row['code_iso'], 'class="saturatemedium paddingrightonly"', 1); |
1034
|
|
- $labeltoshow = $tmpflag . ' ' . $labeltoshow; |
|
1034
|
+ $labeltoshow = $tmpflag.' '.$labeltoshow; |
1035
|
1035
|
} |
1036
|
1036
|
} |
1037
|
1037
|
|
1038
|
1038
|
if ($selected && $selected != '-1' && ($selected == $row['rowid'] || $selected == $row['code_iso'] || $selected == $row['code_iso3'] || $selected == $row['label'])) { |
1039
|
|
- $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']) . '">'; |
|
1039
|
+ $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']).'">'; |
1040
|
1040
|
} else { |
1041
|
|
- $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']) . '">'; |
|
1041
|
+ $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']).'">'; |
1042
|
1042
|
} |
1043
|
1043
|
$out .= $labeltoshow; |
1044
|
|
- $out .= '</option>' . "\n"; |
|
1044
|
+ $out .= '</option>'."\n"; |
1045
|
1045
|
} |
1046
|
1046
|
} |
1047
|
1047
|
$out .= '</select>'; |
|
@@ -1050,8 +1050,8 @@ discard block |
|
|
block discarded – undo |
1050
|
1050
|
} |
1051
|
1051
|
|
1052
|
1052
|
// Make select dynamic |
1053
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
1054
|
|
- $out .= ajax_combobox('select' . $htmlname, array(), 0, 0, 'resolve'); |
|
1053
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
|
1054
|
+ $out .= ajax_combobox('select'.$htmlname, array(), 0, 0, 'resolve'); |
1055
|
1055
|
|
1056
|
1056
|
return $out; |
1057
|
1057
|
} |
|
@@ -1083,25 +1083,25 @@ discard block |
|
|
block discarded – undo |
1083
|
1083
|
$incotermArray = array(); |
1084
|
1084
|
|
1085
|
1085
|
$sql = "SELECT rowid, code"; |
1086
|
|
- $sql .= " FROM " . $this->db->prefix() . "c_incoterms"; |
|
1086
|
+ $sql .= " FROM ".$this->db->prefix()."c_incoterms"; |
1087
|
1087
|
$sql .= " WHERE active > 0"; |
1088
|
1088
|
$sql .= " ORDER BY code ASC"; |
1089
|
1089
|
|
1090
|
|
- dol_syslog(get_class($this) . "::select_incoterm", LOG_DEBUG); |
|
1090
|
+ dol_syslog(get_class($this)."::select_incoterm", LOG_DEBUG); |
1091
|
1091
|
$resql = $this->db->query($sql); |
1092
|
1092
|
if ($resql) { |
1093
|
1093
|
if ($conf->use_javascript_ajax && !$forcecombo) { |
1094
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
1094
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
1095
|
1095
|
$out .= ajax_combobox($htmlname, $events); |
1096
|
1096
|
} |
1097
|
1097
|
|
1098
|
1098
|
if (!empty($page)) { |
1099
|
|
- $out .= '<form method="post" action="' . $page . '">'; |
|
1099
|
+ $out .= '<form method="post" action="'.$page.'">'; |
1100
|
1100
|
$out .= '<input type="hidden" name="action" value="set_incoterms">'; |
1101
|
|
- $out .= '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
1101
|
+ $out .= '<input type="hidden" name="token" value="'.newToken().'">'; |
1102
|
1102
|
} |
1103
|
1103
|
|
1104
|
|
- $out .= '<select id="' . $htmlname . '" class="flat selectincoterm width75" name="' . $htmlname . '" ' . $htmloption . '>'; |
|
1104
|
+ $out .= '<select id="'.$htmlname.'" class="flat selectincoterm width75" name="'.$htmlname.'" '.$htmloption.'>'; |
1105
|
1105
|
$out .= '<option value="0"> </option>'; |
1106
|
1106
|
$num = $this->db->num_rows($resql); |
1107
|
1107
|
$i = 0; |
|
@@ -1115,9 +1115,9 @@ discard block |
|
|
block discarded – undo |
1115
|
1115
|
|
1116
|
1116
|
foreach ($incotermArray as $row) { |
1117
|
1117
|
if ($selected && ($selected == $row['rowid'] || $selected == $row['code'])) { |
1118
|
|
- $out .= '<option value="' . $row['rowid'] . '" selected>'; |
|
1118
|
+ $out .= '<option value="'.$row['rowid'].'" selected>'; |
1119
|
1119
|
} else { |
1120
|
|
- $out .= '<option value="' . $row['rowid'] . '">'; |
|
1120
|
+ $out .= '<option value="'.$row['rowid'].'">'; |
1121
|
1121
|
} |
1122
|
1122
|
|
1123
|
1123
|
if ($row['code']) { |
|
@@ -1130,13 +1130,13 @@ discard block |
|
|
block discarded – undo |
1130
|
1130
|
$out .= '</select>'; |
1131
|
1131
|
|
1132
|
1132
|
if ($conf->use_javascript_ajax && empty($disableautocomplete)) { |
1133
|
|
- $out .= ajax_multiautocompleter('location_incoterms', array(), DOL_URL_ROOT . '/core/ajax/locationincoterms.php') . "\n"; |
|
1133
|
+ $out .= ajax_multiautocompleter('location_incoterms', array(), DOL_URL_ROOT.'/core/ajax/locationincoterms.php')."\n"; |
1134
|
1134
|
$moreattrib .= ' autocomplete="off"'; |
1135
|
1135
|
} |
1136
|
|
- $out .= '<input id="location_incoterms" class="maxwidthonsmartphone type="text" name="location_incoterms" value="' . $location_incoterms . '">' . "\n"; |
|
1136
|
+ $out .= '<input id="location_incoterms" class="maxwidthonsmartphone type="text" name="location_incoterms" value="'.$location_incoterms.'">'."\n"; |
1137
|
1137
|
|
1138
|
1138
|
if (!empty($page)) { |
1139
|
|
- $out .= '<input type="submit" class="button valignmiddle smallpaddingimp nomargintop nomarginbottom" value="' . $langs->trans("Modify") . '"></form>'; |
|
1139
|
+ $out .= '<input type="submit" class="button valignmiddle smallpaddingimp nomargintop nomarginbottom" value="'.$langs->trans("Modify").'"></form>'; |
1140
|
1140
|
} |
1141
|
1141
|
} else { |
1142
|
1142
|
dol_print_error($this->db); |
|
@@ -1168,9 +1168,9 @@ discard block |
|
|
block discarded – undo |
1168
|
1168
|
if ($forceall == 1 || (empty($forceall) && isModEnabled("product") && isModEnabled("service")) |
1169
|
1169
|
|| (empty($forceall) && !isModEnabled('product') && !isModEnabled('service'))) { |
1170
|
1170
|
if (empty($hidetext)) { |
1171
|
|
- print $langs->trans("Type") . ': '; |
|
1171
|
+ print $langs->trans("Type").': '; |
1172
|
1172
|
} |
1173
|
|
- print '<select class="flat'.($morecss ? ' '.$morecss : '').'" id="select_' . $htmlname . '" name="' . $htmlname . '">'; |
|
1173
|
+ print '<select class="flat'.($morecss ? ' '.$morecss : '').'" id="select_'.$htmlname.'" name="'.$htmlname.'">'; |
1174
|
1174
|
if ($showempty) { |
1175
|
1175
|
print '<option value="-1"'; |
1176
|
1176
|
if ($selected == -1) { |
|
@@ -1189,28 +1189,28 @@ discard block |
|
|
block discarded – undo |
1189
|
1189
|
if (0 == $selected || ($selected == -1 && getDolGlobalString('MAIN_FREE_PRODUCT_CHECKED_BY_DEFAULT') == 'product')) { |
1190
|
1190
|
print ' selected'; |
1191
|
1191
|
} |
1192
|
|
- print '>' . $langs->trans("Product"); |
|
1192
|
+ print '>'.$langs->trans("Product"); |
1193
|
1193
|
|
1194
|
1194
|
print '<option value="1"'; |
1195
|
1195
|
if (1 == $selected || ($selected == -1 && getDolGlobalString('MAIN_FREE_PRODUCT_CHECKED_BY_DEFAULT') == 'service')) { |
1196
|
1196
|
print ' selected'; |
1197
|
1197
|
} |
1198
|
|
- print '>' . $langs->trans("Service"); |
|
1198
|
+ print '>'.$langs->trans("Service"); |
1199
|
1199
|
|
1200
|
1200
|
print '</select>'; |
1201
|
|
- print ajax_combobox('select_' . $htmlname); |
|
1201
|
+ print ajax_combobox('select_'.$htmlname); |
1202
|
1202
|
//if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); |
1203
|
1203
|
} |
1204
|
1204
|
if ((empty($forceall) && !isModEnabled('product') && isModEnabled("service")) || $forceall == 3) { |
1205
|
1205
|
print $langs->trans("Service"); |
1206
|
|
- print '<input type="hidden" name="' . $htmlname . '" value="1">'; |
|
1206
|
+ print '<input type="hidden" name="'.$htmlname.'" value="1">'; |
1207
|
1207
|
} |
1208
|
1208
|
if ((empty($forceall) && isModEnabled("product") && !isModEnabled('service')) || $forceall == 2) { |
1209
|
1209
|
print $langs->trans("Product"); |
1210
|
|
- print '<input type="hidden" name="' . $htmlname . '" value="0">'; |
|
1210
|
+ print '<input type="hidden" name="'.$htmlname.'" value="0">'; |
1211
|
1211
|
} |
1212
|
1212
|
if ($forceall < 0) { // This should happened only for contracts when both predefined product and service are disabled. |
1213
|
|
- 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 |
|
1213
|
+ 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 |
1214
|
1214
|
} |
1215
|
1215
|
} |
1216
|
1216
|
|
|
@@ -1236,7 +1236,7 @@ discard block |
|
|
block discarded – undo |
1236
|
1236
|
$langs->load("trips"); |
1237
|
1237
|
|
1238
|
1238
|
$sql = "SELECT c.code, c.label"; |
1239
|
|
- $sql .= " FROM " . $this->db->prefix() . "c_type_fees as c"; |
|
1239
|
+ $sql .= " FROM ".$this->db->prefix()."c_type_fees as c"; |
1240
|
1240
|
$sql .= " WHERE active > 0"; |
1241
|
1241
|
|
1242
|
1242
|
$resql = $this->db->query($sql); |
|
@@ -1277,11 +1277,11 @@ discard block |
|
|
block discarded – undo |
1277
|
1277
|
// phpcs:enable |
1278
|
1278
|
global $user, $langs; |
1279
|
1279
|
|
1280
|
|
- dol_syslog(__METHOD__ . " selected=" . $selected . ", htmlname=" . $htmlname, LOG_DEBUG); |
|
1280
|
+ dol_syslog(__METHOD__." selected=".$selected.", htmlname=".$htmlname, LOG_DEBUG); |
1281
|
1281
|
|
1282
|
1282
|
$this->load_cache_types_fees(); |
1283
|
1283
|
|
1284
|
|
- print '<select id="select_' . $htmlname . '" class="flat" name="' . $htmlname . '">'; |
|
1284
|
+ print '<select id="select_'.$htmlname.'" class="flat" name="'.$htmlname.'">'; |
1285
|
1285
|
if ($showempty) { |
1286
|
1286
|
print '<option value="-1"'; |
1287
|
1287
|
if ($selected == -1) { |
|
@@ -1291,7 +1291,7 @@ discard block |
|
|
block discarded – undo |
1291
|
1291
|
} |
1292
|
1292
|
|
1293
|
1293
|
foreach ($this->cache_types_fees as $key => $value) { |
1294
|
|
- print '<option value="' . $key . '"'; |
|
1294
|
+ print '<option value="'.$key.'"'; |
1295
|
1295
|
if ($key == $selected) { |
1296
|
1296
|
print ' selected'; |
1297
|
1297
|
} |
|
@@ -1343,12 +1343,12 @@ discard block |
|
|
block discarded – undo |
1343
|
1343
|
$ajaxoptions = array(); |
1344
|
1344
|
} |
1345
|
1345
|
|
1346
|
|
- require_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
1346
|
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
1347
|
1347
|
|
1348
|
1348
|
// No immediate load of all database |
1349
|
1349
|
$placeholder = ''; |
1350
|
1350
|
if ($selected && empty($selected_input_value)) { |
1351
|
|
- require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; |
|
1351
|
+ require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; |
1352
|
1352
|
$societetmp = new Societe($this->db); |
1353
|
1353
|
$societetmp->fetch($selected); |
1354
|
1354
|
$selected_input_value = $societetmp->name; |
|
@@ -1356,18 +1356,18 @@ discard block |
|
|
block discarded – undo |
1356
|
1356
|
} |
1357
|
1357
|
|
1358
|
1358
|
// mode 1 |
1359
|
|
- $urloption = 'htmlname=' . urlencode((string) (str_replace('.', '_', $htmlname))) . '&outjson=1&filter=' . urlencode((string) ($filter)) . (empty($excludeids) ? '' : '&excludeids=' . implode(',', $excludeids)) . ($showtype ? '&showtype=' . urlencode((string) ($showtype)) : '') . ($showcode ? '&showcode=' . urlencode((string) ($showcode)) : ''); |
|
1359
|
+ $urloption = 'htmlname='.urlencode((string) (str_replace('.', '_', $htmlname))).'&outjson=1&filter='.urlencode((string) ($filter)).(empty($excludeids) ? '' : '&excludeids='.implode(',', $excludeids)).($showtype ? '&showtype='.urlencode((string) ($showtype)) : '').($showcode ? '&showcode='.urlencode((string) ($showcode)) : ''); |
1360
|
1360
|
|
1361
|
1361
|
$out .= '<!-- force css to be higher than dialog popup --><style type="text/css">.ui-autocomplete { z-index: 1010; }</style>'; |
1362
|
1362
|
if (empty($hidelabel)) { |
1363
|
|
- print $langs->trans("RefOrLabel") . ' : '; |
|
1363
|
+ print $langs->trans("RefOrLabel").' : '; |
1364
|
1364
|
} elseif ($hidelabel > 1) { |
1365
|
1365
|
$placeholder = $langs->trans("RefOrLabel"); |
1366
|
1366
|
if ($hidelabel == 2) { |
1367
|
1367
|
$out .= img_picto($langs->trans("Search"), 'search'); |
1368
|
1368
|
} |
1369
|
1369
|
} |
1370
|
|
- $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' : '') . ' />'; |
|
1370
|
+ $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' : '').' />'; |
1371
|
1371
|
if ($hidelabel == 3) { |
1372
|
1372
|
$out .= img_picto($langs->trans("Search"), 'search'); |
1373
|
1373
|
} |
|
@@ -1429,12 +1429,12 @@ discard block |
|
|
block discarded – undo |
1429
|
1429
|
$events = array(); |
1430
|
1430
|
} |
1431
|
1431
|
|
1432
|
|
- require_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
1432
|
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
1433
|
1433
|
|
1434
|
1434
|
// No immediate load of all database |
1435
|
1435
|
$placeholder = ''; |
1436
|
1436
|
if ($selected && empty($selected_input_value)) { |
1437
|
|
- require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php'; |
|
1437
|
+ require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; |
1438
|
1438
|
$contacttmp = new Contact($this->db); |
1439
|
1439
|
$contacttmp->fetch($selected); |
1440
|
1440
|
$selected_input_value = $contacttmp->getFullName($langs); |
|
@@ -1445,11 +1445,11 @@ discard block |
|
|
block discarded – undo |
1445
|
1445
|
} |
1446
|
1446
|
|
1447
|
1447
|
// mode 1 |
1448
|
|
- $urloption = 'htmlname=' . urlencode((string) (str_replace('.', '_', $htmlname))) . '&outjson=1&filter=' . urlencode((string) ($filter)) . (empty($exclude) ? '' : '&exclude=' . urlencode($exclude)) . ($showsoc ? '&showsoc=' . urlencode((string) ($showsoc)) : ''); |
|
1448
|
+ $urloption = 'htmlname='.urlencode((string) (str_replace('.', '_', $htmlname))).'&outjson=1&filter='.urlencode((string) ($filter)).(empty($exclude) ? '' : '&exclude='.urlencode($exclude)).($showsoc ? '&showsoc='.urlencode((string) ($showsoc)) : ''); |
1449
|
1449
|
|
1450
|
1450
|
$out .= '<!-- force css to be higher than dialog popup --><style type="text/css">.ui-autocomplete { z-index: 1010; }</style>'; |
1451
|
1451
|
|
1452
|
|
- $out .= '<input type="text" class="' . $morecss . '" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . ($placeholder ? ' placeholder="' . dol_escape_htmltag($placeholder) . '"' : '') . ' ' . (getDolGlobalString('CONTACT_SEARCH_AUTOFOCUS') ? 'autofocus' : '') . ' />'; |
|
1452
|
+ $out .= '<input type="text" class="'.$morecss.'" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.($placeholder ? ' placeholder="'.dol_escape_htmltag($placeholder).'"' : '').' '.(getDolGlobalString('CONTACT_SEARCH_AUTOFOCUS') ? 'autofocus' : '').' />'; |
1453
|
1453
|
|
1454
|
1454
|
$out .= ajax_event($htmlname, $events); |
1455
|
1455
|
|
|
@@ -1546,30 +1546,30 @@ discard block |
|
|
block discarded – undo |
1546
|
1546
|
$sql .= ", s.address, s.zip, s.town"; |
1547
|
1547
|
$sql .= ", dictp.code as country_code"; |
1548
|
1548
|
} |
1549
|
|
- $sql .= " FROM " . $this->db->prefix() . "societe as s"; |
|
1549
|
+ $sql .= " FROM ".$this->db->prefix()."societe as s"; |
1550
|
1550
|
if (getDolGlobalString('COMPANY_SHOW_ADDRESS_SELECTLIST')) { |
1551
|
|
- $sql .= " LEFT JOIN " . $this->db->prefix() . "c_country as dictp ON dictp.rowid = s.fk_pays"; |
|
1551
|
+ $sql .= " LEFT JOIN ".$this->db->prefix()."c_country as dictp ON dictp.rowid = s.fk_pays"; |
1552
|
1552
|
} |
1553
|
1553
|
if (!$user->hasRight('societe', 'client', 'voir')) { |
1554
|
|
- $sql .= ", " . $this->db->prefix() . "societe_commerciaux as sc"; |
|
1554
|
+ $sql .= ", ".$this->db->prefix()."societe_commerciaux as sc"; |
1555
|
1555
|
} |
1556
|
|
- $sql .= " WHERE s.entity IN (" . getEntity('societe') . ")"; |
|
1556
|
+ $sql .= " WHERE s.entity IN (".getEntity('societe').")"; |
1557
|
1557
|
if (!empty($user->socid)) { |
1558
|
|
- $sql .= " AND s.rowid = " . ((int) $user->socid); |
|
1558
|
+ $sql .= " AND s.rowid = ".((int) $user->socid); |
1559
|
1559
|
} |
1560
|
1560
|
if ($filter) { |
1561
|
1561
|
// $filter is safe because, if it contains '(' or ')', it has been sanitized by testSqlAndScriptInject() and forgeSQLFromUniversalSearchCriteria() |
1562
|
1562
|
// if not, by testSqlAndScriptInject() only. |
1563
|
|
- $sql .= " AND (" . $filter . ")"; |
|
1563
|
+ $sql .= " AND (".$filter.")"; |
1564
|
1564
|
} |
1565
|
1565
|
if (!$user->hasRight('societe', 'client', 'voir')) { |
1566
|
|
- $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " . ((int) $user->id); |
|
1566
|
+ $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id); |
1567
|
1567
|
} |
1568
|
1568
|
if (getDolGlobalString('COMPANY_HIDE_INACTIVE_IN_COMBOBOX')) { |
1569
|
1569
|
$sql .= " AND s.status <> 0"; |
1570
|
1570
|
} |
1571
|
1571
|
if (!empty($excludeids)) { |
1572
|
|
- $sql .= " AND s.rowid NOT IN (" . $this->db->sanitize(implode(',', $excludeids)) . ")"; |
|
1572
|
+ $sql .= " AND s.rowid NOT IN (".$this->db->sanitize(implode(',', $excludeids)).")"; |
1573
|
1573
|
} |
1574
|
1574
|
// Add where from hooks |
1575
|
1575
|
$parameters = array(); |
|
@@ -1589,17 +1589,17 @@ discard block |
|
|
block discarded – undo |
1589
|
1589
|
if ($i > 0) { |
1590
|
1590
|
$sql .= " AND "; |
1591
|
1591
|
} |
1592
|
|
- $sql .= "(s.nom LIKE '" . $this->db->escape($prefix . $crit) . "%')"; |
|
1592
|
+ $sql .= "(s.nom LIKE '".$this->db->escape($prefix.$crit)."%')"; |
1593
|
1593
|
$i++; |
1594
|
1594
|
} |
1595
|
1595
|
if (count($search_crit) > 1) { |
1596
|
1596
|
$sql .= ")"; |
1597
|
1597
|
} |
1598
|
1598
|
if (isModEnabled('barcode')) { |
1599
|
|
- $sql .= " OR s.barcode LIKE '" . $this->db->escape($prefix . $filterkey) . "%'"; |
|
1599
|
+ $sql .= " OR s.barcode LIKE '".$this->db->escape($prefix.$filterkey)."%'"; |
1600
|
1600
|
} |
1601
|
|
- $sql .= " OR s.code_client LIKE '" . $this->db->escape($prefix . $filterkey) . "%' OR s.code_fournisseur LIKE '" . $this->db->escape($prefix . $filterkey) . "%'"; |
1602
|
|
- $sql .= " OR s.name_alias LIKE '" . $this->db->escape($prefix . $filterkey) . "%' OR s.tva_intra LIKE '" . $this->db->escape($prefix . $filterkey) . "%'"; |
|
1601
|
+ $sql .= " OR s.code_client LIKE '".$this->db->escape($prefix.$filterkey)."%' OR s.code_fournisseur LIKE '".$this->db->escape($prefix.$filterkey)."%'"; |
|
1602
|
+ $sql .= " OR s.name_alias LIKE '".$this->db->escape($prefix.$filterkey)."%' OR s.tva_intra LIKE '".$this->db->escape($prefix.$filterkey)."%'"; |
1603
|
1603
|
$sql .= ")"; |
1604
|
1604
|
} |
1605
|
1605
|
$sql .= $this->db->order("nom", "ASC"); |
|
@@ -1610,7 +1610,7 @@ discard block |
|
|
block discarded – undo |
1610
|
1610
|
$resql = $this->db->query($sql); |
1611
|
1611
|
if ($resql) { |
1612
|
1612
|
// Construct $out and $outarray |
1613
|
|
- $out .= '<select id="' . $htmlname . '" class="flat' . ($morecss ? ' ' . $morecss : '') . '"' . ($moreparam ? ' ' . $moreparam : '') . ' name="' . $htmlname . ($multiple ? '[]' : '') . '" ' . ($multiple ? 'multiple' : '') . '>' . "\n"; |
|
1613
|
+ $out .= '<select id="'.$htmlname.'" class="flat'.($morecss ? ' '.$morecss : '').'"'.($moreparam ? ' '.$moreparam : '').' name="'.$htmlname.($multiple ? '[]' : '').'" '.($multiple ? 'multiple' : '').'>'."\n"; |
1614
|
1614
|
|
1615
|
1615
|
$textifempty = (($showempty && !is_numeric($showempty)) ? $langs->trans($showempty) : ''); |
1616
|
1616
|
if (getDolGlobalString('COMPANY_USE_SEARCH_TO_SELECT')) { |
|
@@ -1623,7 +1623,7 @@ discard block |
|
|
block discarded – undo |
1623
|
1623
|
} |
1624
|
1624
|
} |
1625
|
1625
|
if ($showempty) { |
1626
|
|
- $out .= '<option value="-1" data-html="' . dol_escape_htmltag('<span class="opacitymedium">' . ($textifempty ? $textifempty : ' ') . '</span>') . '">' . $textifempty . '</option>' . "\n"; |
|
1626
|
+ $out .= '<option value="-1" data-html="'.dol_escape_htmltag('<span class="opacitymedium">'.($textifempty ? $textifempty : ' ').'</span>').'">'.$textifempty.'</option>'."\n"; |
1627
|
1627
|
} |
1628
|
1628
|
|
1629
|
1629
|
$companytemp = new Societe($this->db); |
|
@@ -1636,18 +1636,18 @@ discard block |
|
|
block discarded – undo |
1636
|
1636
|
$label = ''; |
1637
|
1637
|
if ($showcode || getDolGlobalString('SOCIETE_ADD_REF_IN_LIST')) { |
1638
|
1638
|
if (($obj->client) && (!empty($obj->code_client))) { |
1639
|
|
- $label = $obj->code_client . ' - '; |
|
1639
|
+ $label = $obj->code_client.' - '; |
1640
|
1640
|
} |
1641
|
1641
|
if (($obj->fournisseur) && (!empty($obj->code_fournisseur))) { |
1642
|
|
- $label .= $obj->code_fournisseur . ' - '; |
|
1642
|
+ $label .= $obj->code_fournisseur.' - '; |
1643
|
1643
|
} |
1644
|
|
- $label .= ' ' . $obj->name; |
|
1644
|
+ $label .= ' '.$obj->name; |
1645
|
1645
|
} else { |
1646
|
1646
|
$label = $obj->name; |
1647
|
1647
|
} |
1648
|
1648
|
|
1649
|
1649
|
if (!empty($obj->name_alias)) { |
1650
|
|
- $label .= ' (' . $obj->name_alias . ')'; |
|
1650
|
+ $label .= ' ('.$obj->name_alias.')'; |
1651
|
1651
|
} |
1652
|
1652
|
|
1653
|
1653
|
if (getDolGlobalString('SOCIETE_SHOW_VAT_IN_LIST') && !empty($obj->tva_intra)) { |
|
@@ -1662,7 +1662,7 @@ discard block |
|
|
block discarded – undo |
1662
|
1662
|
$companytemp->fournisseur = $obj->fournisseur; |
1663
|
1663
|
$tmptype = $companytemp->getTypeUrl(1, '', 0, 'span'); |
1664
|
1664
|
if ($tmptype) { |
1665
|
|
- $labelhtml .= ' ' . $tmptype; |
|
1665
|
+ $labelhtml .= ' '.$tmptype; |
1666
|
1666
|
} |
1667
|
1667
|
|
1668
|
1668
|
if ($obj->client || $obj->fournisseur) { |
|
@@ -1672,10 +1672,10 @@ discard block |
|
|
block discarded – undo |
1672
|
1672
|
$label .= $langs->trans("Customer"); |
1673
|
1673
|
} |
1674
|
1674
|
if ($obj->client == 2 || $obj->client == 3) { |
1675
|
|
- $label .= ($obj->client == 3 ? ', ' : '') . $langs->trans("Prospect"); |
|
1675
|
+ $label .= ($obj->client == 3 ? ', ' : '').$langs->trans("Prospect"); |
1676
|
1676
|
} |
1677
|
1677
|
if ($obj->fournisseur) { |
1678
|
|
- $label .= ($obj->client ? ', ' : '') . $langs->trans("Supplier"); |
|
1678
|
+ $label .= ($obj->client ? ', ' : '').$langs->trans("Supplier"); |
1679
|
1679
|
} |
1680
|
1680
|
if ($obj->client || $obj->fournisseur) { |
1681
|
1681
|
$label .= ')'; |
|
@@ -1683,9 +1683,9 @@ discard block |
|
|
block discarded – undo |
1683
|
1683
|
} |
1684
|
1684
|
|
1685
|
1685
|
if (getDolGlobalString('COMPANY_SHOW_ADDRESS_SELECTLIST')) { |
1686
|
|
- $s = ($obj->address ? ' - ' . $obj->address : '') . ($obj->zip ? ' - ' . $obj->zip : '') . ($obj->town ? ' ' . $obj->town : ''); |
|
1686
|
+ $s = ($obj->address ? ' - '.$obj->address : '').($obj->zip ? ' - '.$obj->zip : '').($obj->town ? ' '.$obj->town : ''); |
1687
|
1687
|
if (!empty($obj->country_code)) { |
1688
|
|
- $s .= ', ' . $langs->trans('Country' . $obj->country_code); |
|
1688
|
+ $s .= ', '.$langs->trans('Country'.$obj->country_code); |
1689
|
1689
|
} |
1690
|
1690
|
$label .= $s; |
1691
|
1691
|
$labelhtml .= $s; |
|
@@ -1693,9 +1693,9 @@ discard block |
|
|
block discarded – undo |
1693
|
1693
|
|
1694
|
1694
|
if (empty($outputmode)) { |
1695
|
1695
|
if (in_array($obj->rowid, $selected)) { |
1696
|
|
- $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>'; |
|
1696
|
+ $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>'; |
1697
|
1697
|
} else { |
1698
|
|
- $out .= '<option value="' . $obj->rowid . '" data-html="' . dol_escape_htmltag($labelhtml, 0, 0, '', 0, 1) . '">' . dol_escape_htmltag($label, 0, 0, '', 0, 1) . '</option>'; |
|
1698
|
+ $out .= '<option value="'.$obj->rowid.'" data-html="'.dol_escape_htmltag($labelhtml, 0, 0, '', 0, 1).'">'.dol_escape_htmltag($label, 0, 0, '', 0, 1).'</option>'; |
1699
|
1699
|
} |
1700
|
1700
|
} else { |
1701
|
1701
|
array_push($outarray, array('key' => $obj->rowid, 'value' => $label, 'label' => $label, 'labelhtml' => $labelhtml)); |
|
@@ -1707,9 +1707,9 @@ discard block |
|
|
block discarded – undo |
1707
|
1707
|
} |
1708
|
1708
|
} |
1709
|
1709
|
} |
1710
|
|
- $out .= '</select>' . "\n"; |
|
1710
|
+ $out .= '</select>'."\n"; |
1711
|
1711
|
if (!$forcecombo) { |
1712
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
1712
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
1713
|
1713
|
$out .= ajax_combobox($htmlname, $events, getDolGlobalInt("COMPANY_USE_SEARCH_TO_SELECT")); |
1714
|
1714
|
} |
1715
|
1715
|
} else { |
|
@@ -1799,7 +1799,7 @@ discard block |
|
|
block discarded – undo |
1799
|
1799
|
} |
1800
|
1800
|
|
1801
|
1801
|
if (!is_object($hookmanager)) { |
1802
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/class/hookmanager.class.php'; |
|
1802
|
+ include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; |
1803
|
1803
|
$hookmanager = new HookManager($this->db); |
1804
|
1804
|
} |
1805
|
1805
|
|
|
@@ -1808,13 +1808,13 @@ discard block |
|
|
block discarded – undo |
1808
|
1808
|
if ($showsoc > 0 || getDolGlobalString('CONTACT_SHOW_EMAIL_PHONE_TOWN_SELECTLIST')) { |
1809
|
1809
|
$sql .= ", s.nom as company, s.town AS company_town"; |
1810
|
1810
|
} |
1811
|
|
- $sql .= " FROM " . $this->db->prefix() . "socpeople as sp"; |
|
1811
|
+ $sql .= " FROM ".$this->db->prefix()."socpeople as sp"; |
1812
|
1812
|
if ($showsoc > 0 || getDolGlobalString('CONTACT_SHOW_EMAIL_PHONE_TOWN_SELECTLIST')) { |
1813
|
|
- $sql .= " LEFT OUTER JOIN " . $this->db->prefix() . "societe as s ON s.rowid=sp.fk_soc"; |
|
1813
|
+ $sql .= " LEFT OUTER JOIN ".$this->db->prefix()."societe as s ON s.rowid=sp.fk_soc"; |
1814
|
1814
|
} |
1815
|
|
- $sql .= " WHERE sp.entity IN (" . getEntity('contact') . ")"; |
|
1815
|
+ $sql .= " WHERE sp.entity IN (".getEntity('contact').")"; |
1816
|
1816
|
if ($socid > 0 || $socid == -1) { |
1817
|
|
- $sql .= " AND sp.fk_soc = " . ((int) $socid); |
|
1817
|
+ $sql .= " AND sp.fk_soc = ".((int) $socid); |
1818
|
1818
|
} |
1819
|
1819
|
if (getDolGlobalString('CONTACT_HIDE_INACTIVE_IN_COMBOBOX')) { |
1820
|
1820
|
$sql .= " AND sp.statut <> 0"; |
|
@@ -1822,7 +1822,7 @@ discard block |
|
|
block discarded – undo |
1822
|
1822
|
if ($filter) { |
1823
|
1823
|
// $filter is safe because, if it contains '(' or ')', it has been sanitized by testSqlAndScriptInject() and forgeSQLFromUniversalSearchCriteria() |
1824
|
1824
|
// if not, by testSqlAndScriptInject() only. |
1825
|
|
- $sql .= " AND (" . $filter . ")"; |
|
1825
|
+ $sql .= " AND (".$filter.")"; |
1826
|
1826
|
} |
1827
|
1827
|
// Add where from hooks |
1828
|
1828
|
$parameters = array(); |
|
@@ -1830,30 +1830,30 @@ discard block |
|
|
block discarded – undo |
1830
|
1830
|
$sql .= $hookmanager->resPrint; |
1831
|
1831
|
$sql .= " ORDER BY sp.lastname ASC"; |
1832
|
1832
|
|
1833
|
|
- dol_syslog(get_class($this) . "::selectcontacts", LOG_DEBUG); |
|
1833
|
+ dol_syslog(get_class($this)."::selectcontacts", LOG_DEBUG); |
1834
|
1834
|
$resql = $this->db->query($sql); |
1835
|
1835
|
if ($resql) { |
1836
|
1836
|
$num = $this->db->num_rows($resql); |
1837
|
1837
|
|
1838
|
1838
|
if ($htmlname != 'none' && !$options_only) { |
1839
|
|
- $out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" id="' . $htmlid . '" name="' . $htmlname . ($multiple ? '[]' : '') . '" ' . (($num || empty($disableifempty)) ? '' : ' disabled') . ($multiple ? 'multiple' : '') . ' ' . (!empty($moreparam) ? $moreparam : '') . '>'; |
|
1839
|
+ $out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" id="'.$htmlid.'" name="'.$htmlname.($multiple ? '[]' : '').'" '.(($num || empty($disableifempty)) ? '' : ' disabled').($multiple ? 'multiple' : '').' '.(!empty($moreparam) ? $moreparam : '').'>'; |
1840
|
1840
|
} |
1841
|
1841
|
|
1842
|
1842
|
if ($showempty && !is_numeric($showempty)) { |
1843
|
1843
|
$textforempty = $showempty; |
1844
|
|
- $out .= '<option class="optiongrey" value="-1"' . (in_array(-1, $selected) ? ' selected' : '') . '>' . $textforempty . '</option>'; |
|
1844
|
+ $out .= '<option class="optiongrey" value="-1"'.(in_array(-1, $selected) ? ' selected' : '').'>'.$textforempty.'</option>'; |
1845
|
1845
|
} else { |
1846
|
1846
|
if (($showempty == 1 || ($showempty == 3 && $num > 1)) && !$multiple) { |
1847
|
|
- $out .= '<option value="0"' . (in_array(0, $selected) ? ' selected' : '') . '> </option>'; |
|
1847
|
+ $out .= '<option value="0"'.(in_array(0, $selected) ? ' selected' : '').'> </option>'; |
1848
|
1848
|
} |
1849
|
1849
|
if ($showempty == 2) { |
1850
|
|
- $out .= '<option value="0"' . (in_array(0, $selected) ? ' selected' : '') . '>-- ' . $langs->trans("Internal") . ' --</option>'; |
|
1850
|
+ $out .= '<option value="0"'.(in_array(0, $selected) ? ' selected' : '').'>-- '.$langs->trans("Internal").' --</option>'; |
1851
|
1851
|
} |
1852
|
1852
|
} |
1853
|
1853
|
|
1854
|
1854
|
$i = 0; |
1855
|
1855
|
if ($num) { |
1856
|
|
- include_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php'; |
|
1856
|
+ include_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; |
1857
|
1857
|
$contactstatic = new Contact($this->db); |
1858
|
1858
|
|
1859
|
1859
|
while ($i < $num) { |
|
@@ -1889,7 +1889,7 @@ discard block |
|
|
block discarded – undo |
1889
|
1889
|
} |
1890
|
1890
|
$extendedInfos = implode(' - ', $extendedInfos); |
1891
|
1891
|
if (!empty($extendedInfos)) { |
1892
|
|
- $extendedInfos = ' - ' . $extendedInfos; |
|
1892
|
+ $extendedInfos = ' - '.$extendedInfos; |
1893
|
1893
|
} |
1894
|
1894
|
} |
1895
|
1895
|
|
|
@@ -1907,35 +1907,35 @@ discard block |
|
|
block discarded – undo |
1907
|
1907
|
$disabled = 1; |
1908
|
1908
|
} |
1909
|
1909
|
if (!empty($selected) && in_array($obj->rowid, $selected)) { |
1910
|
|
- $out .= '<option value="' . $obj->rowid . '"'; |
|
1910
|
+ $out .= '<option value="'.$obj->rowid.'"'; |
1911
|
1911
|
if ($disabled) { |
1912
|
1912
|
$out .= ' disabled'; |
1913
|
1913
|
} |
1914
|
1914
|
$out .= ' selected>'; |
1915
|
1915
|
|
1916
|
|
- $tmplabel = $contactstatic->getFullName($langs) . $extendedInfos; |
|
1916
|
+ $tmplabel = $contactstatic->getFullName($langs).$extendedInfos; |
1917
|
1917
|
if ($showfunction && $obj->poste) { |
1918
|
|
- $tmplabel .= ' (' . $obj->poste . ')'; |
|
1918
|
+ $tmplabel .= ' ('.$obj->poste.')'; |
1919
|
1919
|
} |
1920
|
1920
|
if (($showsoc > 0) && $obj->company) { |
1921
|
|
- $tmplabel .= ' - (' . $obj->company . ')'; |
|
1921
|
+ $tmplabel .= ' - ('.$obj->company.')'; |
1922
|
1922
|
} |
1923
|
1923
|
|
1924
|
1924
|
$out .= $tmplabel; |
1925
|
1925
|
$out .= '</option>'; |
1926
|
1926
|
} else { |
1927
|
|
- $out .= '<option value="' . $obj->rowid . '"'; |
|
1927
|
+ $out .= '<option value="'.$obj->rowid.'"'; |
1928
|
1928
|
if ($disabled) { |
1929
|
1929
|
$out .= ' disabled'; |
1930
|
1930
|
} |
1931
|
1931
|
$out .= '>'; |
1932
|
1932
|
|
1933
|
|
- $tmplabel = $contactstatic->getFullName($langs) . $extendedInfos; |
|
1933
|
+ $tmplabel = $contactstatic->getFullName($langs).$extendedInfos; |
1934
|
1934
|
if ($showfunction && $obj->poste) { |
1935
|
|
- $tmplabel .= ' (' . $obj->poste . ')'; |
|
1935
|
+ $tmplabel .= ' ('.$obj->poste.')'; |
1936
|
1936
|
} |
1937
|
1937
|
if (($showsoc > 0) && $obj->company) { |
1938
|
|
- $tmplabel .= ' - (' . $obj->company . ')'; |
|
1938
|
+ $tmplabel .= ' - ('.$obj->company.')'; |
1939
|
1939
|
} |
1940
|
1940
|
|
1941
|
1941
|
$out .= $tmplabel; |
|
@@ -1943,12 +1943,12 @@ discard block |
|
|
block discarded – undo |
1943
|
1943
|
} |
1944
|
1944
|
} else { |
1945
|
1945
|
if (in_array($obj->rowid, $selected)) { |
1946
|
|
- $tmplabel = $contactstatic->getFullName($langs) . $extendedInfos; |
|
1946
|
+ $tmplabel = $contactstatic->getFullName($langs).$extendedInfos; |
1947
|
1947
|
if ($showfunction && $obj->poste) { |
1948
|
|
- $tmplabel .= ' (' . $obj->poste . ')'; |
|
1948
|
+ $tmplabel .= ' ('.$obj->poste.')'; |
1949
|
1949
|
} |
1950
|
1950
|
if (($showsoc > 0) && $obj->company) { |
1951
|
|
- $tmplabel .= ' - (' . $obj->company . ')'; |
|
1951
|
+ $tmplabel .= ' - ('.$obj->company.')'; |
1952
|
1952
|
} |
1953
|
1953
|
|
1954
|
1954
|
$out .= $tmplabel; |
|
@@ -1963,7 +1963,7 @@ discard block |
|
|
block discarded – undo |
1963
|
1963
|
} |
1964
|
1964
|
} else { |
1965
|
1965
|
$labeltoshow = ($socid != -1) ? ($langs->trans($socid ? "NoContactDefinedForThirdParty" : "NoContactDefined")) : $langs->trans('SelectAThirdPartyFirst'); |
1966
|
|
- $out .= '<option class="disabled" value="-1"' . (($showempty == 2 || $multiple) ? '' : ' selected') . ' disabled="disabled">'; |
|
1966
|
+ $out .= '<option class="disabled" value="-1"'.(($showempty == 2 || $multiple) ? '' : ' selected').' disabled="disabled">'; |
1967
|
1967
|
$out .= $labeltoshow; |
1968
|
1968
|
$out .= '</option>'; |
1969
|
1969
|
} |
|
@@ -1984,7 +1984,7 @@ discard block |
|
|
block discarded – undo |
1984
|
1984
|
} |
1985
|
1985
|
|
1986
|
1986
|
if ($conf->use_javascript_ajax && !$forcecombo && !$options_only) { |
1987
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
1987
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
1988
|
1988
|
$out .= ajax_combobox($htmlid, $events, getDolGlobalInt("CONTACT_USE_SEARCH_TO_SELECT")); |
1989
|
1989
|
} |
1990
|
1990
|
|
|
@@ -2023,18 +2023,18 @@ discard block |
|
|
block discarded – undo |
2023
|
2023
|
// On recherche les remises |
2024
|
2024
|
$sql = "SELECT re.rowid, re.amount_ht, re.amount_tva, re.amount_ttc,"; |
2025
|
2025
|
$sql .= " re.description, re.fk_facture_source"; |
2026
|
|
- $sql .= " FROM " . $this->db->prefix() . "societe_remise_except as re"; |
2027
|
|
- $sql .= " WHERE re.fk_soc = " . (int) $socid; |
2028
|
|
- $sql .= " AND re.entity = " . $conf->entity; |
|
2026
|
+ $sql .= " FROM ".$this->db->prefix()."societe_remise_except as re"; |
|
2027
|
+ $sql .= " WHERE re.fk_soc = ".(int) $socid; |
|
2028
|
+ $sql .= " AND re.entity = ".$conf->entity; |
2029
|
2029
|
if ($filter) { |
2030
|
|
- $sql .= " AND " . $filter; |
|
2030
|
+ $sql .= " AND ".$filter; |
2031
|
2031
|
} |
2032
|
2032
|
$sql .= " ORDER BY re.description ASC"; |
2033
|
2033
|
|
2034
|
|
- dol_syslog(get_class($this) . "::select_remises", LOG_DEBUG); |
|
2034
|
+ dol_syslog(get_class($this)."::select_remises", LOG_DEBUG); |
2035
|
2035
|
$resql = $this->db->query($sql); |
2036
|
2036
|
if ($resql) { |
2037
|
|
- print '<select id="select_' . $htmlname . '" class="flat maxwidthonsmartphone" name="' . $htmlname . '">'; |
|
2037
|
+ print '<select id="select_'.$htmlname.'" class="flat maxwidthonsmartphone" name="'.$htmlname.'">'; |
2038
|
2038
|
$num = $this->db->num_rows($resql); |
2039
|
2039
|
|
2040
|
2040
|
$qualifiedlines = $num; |
|
@@ -2072,16 +2072,16 @@ discard block |
|
|
block discarded – undo |
2072
|
2072
|
if (getDolGlobalString('MAIN_SHOW_FACNUMBER_IN_DISCOUNT_LIST') && !empty($obj->fk_facture_source)) { |
2073
|
2073
|
$tmpfac = new Facture($this->db); |
2074
|
2074
|
if ($tmpfac->fetch($obj->fk_facture_source) > 0) { |
2075
|
|
- $desc = $desc . ' - ' . $tmpfac->ref; |
|
2075
|
+ $desc = $desc.' - '.$tmpfac->ref; |
2076
|
2076
|
} |
2077
|
2077
|
} |
2078
|
2078
|
|
2079
|
|
- print '<option value="' . $obj->rowid . '"' . $selectstring . $disabled . '>' . $desc . ' (' . price($obj->amount_ht) . ' ' . $langs->trans("HT") . ' - ' . price($obj->amount_ttc) . ' ' . $langs->trans("TTC") . ')</option>'; |
|
2079
|
+ print '<option value="'.$obj->rowid.'"'.$selectstring.$disabled.'>'.$desc.' ('.price($obj->amount_ht).' '.$langs->trans("HT").' - '.price($obj->amount_ttc).' '.$langs->trans("TTC").')</option>'; |
2080
|
2080
|
$i++; |
2081
|
2081
|
} |
2082
|
2082
|
} |
2083
|
2083
|
print '</select>'; |
2084
|
|
- print ajax_combobox('select_' . $htmlname); |
|
2084
|
+ print ajax_combobox('select_'.$htmlname); |
2085
|
2085
|
|
2086
|
2086
|
return $qualifiedlines; |
2087
|
2087
|
} else { |
|
@@ -2190,14 +2190,14 @@ discard block |
|
|
block discarded – undo |
2190
|
2190
|
if ($showlabelofentity) { |
2191
|
2191
|
$sql .= ", e.label"; |
2192
|
2192
|
} |
2193
|
|
- $sql .= " FROM " . $this->db->prefix() . "user as u"; |
|
2193
|
+ $sql .= " FROM ".$this->db->prefix()."user as u"; |
2194
|
2194
|
if ($showlabelofentity) { |
2195
|
|
- $sql .= " LEFT JOIN " . $this->db->prefix() . "entity as e ON e.rowid = u.entity"; |
|
2195
|
+ $sql .= " LEFT JOIN ".$this->db->prefix()."entity as e ON e.rowid = u.entity"; |
2196
|
2196
|
} |
2197
|
2197
|
// Condition here should be the same than into societe->getSalesRepresentatives(). |
2198
|
2198
|
if ($userissuperadminentityone && $force_entity != 'default') { |
2199
|
2199
|
if (!empty($force_entity)) { |
2200
|
|
- $sql .= " WHERE u.entity IN (0, " . $this->db->sanitize($force_entity) . ")"; |
|
2200
|
+ $sql .= " WHERE u.entity IN (0, ".$this->db->sanitize($force_entity).")"; |
2201
|
2201
|
} else { |
2202
|
2202
|
$sql .= " WHERE u.entity IS NOT NULL"; |
2203
|
2203
|
} |
|
@@ -2205,18 +2205,18 @@ discard block |
|
|
block discarded – undo |
2205
|
2205
|
if (isModEnabled('multicompany') && getDolGlobalInt('MULTICOMPANY_TRANSVERSE_MODE')) { |
2206
|
2206
|
$sql .= " WHERE u.rowid IN (SELECT ug.fk_user FROM ".$this->db->prefix()."usergroup_user as ug WHERE ug.entity IN (".getEntity('usergroup')."))"; |
2207
|
2207
|
} else { |
2208
|
|
- $sql .= " WHERE u.entity IN (" . getEntity('user') . ")"; |
|
2208
|
+ $sql .= " WHERE u.entity IN (".getEntity('user').")"; |
2209
|
2209
|
} |
2210
|
2210
|
} |
2211
|
2211
|
|
2212
|
2212
|
if (!empty($user->socid)) { |
2213
|
|
- $sql .= " AND u.fk_soc = " . ((int) $user->socid); |
|
2213
|
+ $sql .= " AND u.fk_soc = ".((int) $user->socid); |
2214
|
2214
|
} |
2215
|
2215
|
if (is_array($exclude) && $excludeUsers) { |
2216
|
|
- $sql .= " AND u.rowid NOT IN (" . $this->db->sanitize($excludeUsers) . ")"; |
|
2216
|
+ $sql .= " AND u.rowid NOT IN (".$this->db->sanitize($excludeUsers).")"; |
2217
|
2217
|
} |
2218
|
2218
|
if ($includeUsers) { |
2219
|
|
- $sql .= " AND u.rowid IN (" . $this->db->sanitize($includeUsers) . ")"; |
|
2219
|
+ $sql .= " AND u.rowid IN (".$this->db->sanitize($includeUsers).")"; |
2220
|
2220
|
} |
2221
|
2221
|
if (getDolGlobalString('USER_HIDE_INACTIVE_IN_COMBOBOX') || $notdisabled) { |
2222
|
2222
|
$sql .= " AND u.statut <> 0"; |
|
@@ -2228,7 +2228,7 @@ discard block |
|
|
block discarded – undo |
2228
|
2228
|
$sql .= " AND u.fk_soc IS NULL"; |
2229
|
2229
|
} |
2230
|
2230
|
if (!empty($morefilter)) { |
2231
|
|
- $sql .= " " . $morefilter; |
|
2231
|
+ $sql .= " ".$morefilter; |
2232
|
2232
|
} |
2233
|
2233
|
|
2234
|
2234
|
//Add hook to filter on user (for example on usergroup define in custom modules) |
|
@@ -2243,7 +2243,7 @@ discard block |
|
|
block discarded – undo |
2243
|
2243
|
$sql .= " ORDER BY u.statut DESC, u.lastname ASC, u.firstname ASC"; |
2244
|
2244
|
} |
2245
|
2245
|
|
2246
|
|
- dol_syslog(get_class($this) . "::select_dolusers", LOG_DEBUG); |
|
2246
|
+ dol_syslog(get_class($this)."::select_dolusers", LOG_DEBUG); |
2247
|
2247
|
|
2248
|
2248
|
$resql = $this->db->query($sql); |
2249
|
2249
|
if ($resql) { |
|
@@ -2251,7 +2251,7 @@ discard block |
|
|
block discarded – undo |
2251
|
2251
|
$i = 0; |
2252
|
2252
|
if ($num) { |
2253
|
2253
|
// do not use maxwidthonsmartphone by default. Set it by caller so auto size to 100% will work when not defined |
2254
|
|
- $out .= '<select class="flat' . ($morecss ? ' ' . $morecss : ' minwidth200') . '" id="' . $htmlname . '" name="' . $htmlname . ($multiple ? '[]' : '') . '" ' . ($multiple ? 'multiple' : '') . ' ' . ($disabled ? ' disabled' : '') . '>'; |
|
2254
|
+ $out .= '<select class="flat'.($morecss ? ' '.$morecss : ' minwidth200').'" id="'.$htmlname.'" name="'.$htmlname.($multiple ? '[]' : '').'" '.($multiple ? 'multiple' : '').' '.($disabled ? ' disabled' : '').'>'; |
2255
|
2255
|
if ($show_empty && !$multiple) { |
2256
|
2256
|
$textforempty = ' '; |
2257
|
2257
|
if (!empty($conf->use_javascript_ajax)) { |
|
@@ -2260,10 +2260,10 @@ discard block |
|
|
block discarded – undo |
2260
|
2260
|
if (!is_numeric($show_empty)) { |
2261
|
2261
|
$textforempty = $show_empty; |
2262
|
2262
|
} |
2263
|
|
- $out .= '<option class="optiongrey" value="' . ($show_empty < 0 ? $show_empty : -1) . '"' . ((empty($selected) || in_array(-1, $selected)) ? ' selected' : '') . '>' . $textforempty . '</option>' . "\n"; |
|
2263
|
+ $out .= '<option class="optiongrey" value="'.($show_empty < 0 ? $show_empty : -1).'"'.((empty($selected) || in_array(-1, $selected)) ? ' selected' : '').'>'.$textforempty.'</option>'."\n"; |
2264
|
2264
|
} |
2265
|
2265
|
if ($show_every) { |
2266
|
|
- $out .= '<option value="-2"' . ((in_array(-2, $selected)) ? ' selected' : '') . '>-- ' . $langs->trans("Everybody") . ' --</option>' . "\n"; |
|
2266
|
+ $out .= '<option value="-2"'.((in_array(-2, $selected)) ? ' selected' : '').'>-- '.$langs->trans("Everybody").' --</option>'."\n"; |
2267
|
2267
|
} |
2268
|
2268
|
|
2269
|
2269
|
$userstatic = new User($this->db); |
|
@@ -2311,21 +2311,21 @@ discard block |
|
|
block discarded – undo |
2311
|
2311
|
} |
2312
|
2312
|
if ($showstatus >= 0) { |
2313
|
2313
|
if ($obj->status == 1 && $showstatus == 1) { |
2314
|
|
- $moreinfo .= ($moreinfo ? ' - ' : ' (') . $langs->trans('Enabled'); |
2315
|
|
- $moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(') . $langs->trans('Enabled'); |
|
2314
|
+ $moreinfo .= ($moreinfo ? ' - ' : ' (').$langs->trans('Enabled'); |
|
2315
|
+ $moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(').$langs->trans('Enabled'); |
2316
|
2316
|
} |
2317
|
2317
|
if ($obj->status == 0 && $showstatus == 1) { |
2318
|
|
- $moreinfo .= ($moreinfo ? ' - ' : ' (') . $langs->trans('Disabled'); |
2319
|
|
- $moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(') . $langs->trans('Disabled'); |
|
2318
|
+ $moreinfo .= ($moreinfo ? ' - ' : ' (').$langs->trans('Disabled'); |
|
2319
|
+ $moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(').$langs->trans('Disabled'); |
2320
|
2320
|
} |
2321
|
2321
|
} |
2322
|
2322
|
if ($showlabelofentity) { |
2323
|
2323
|
if (empty($obj->entity)) { |
2324
|
|
- $moreinfo .= ($moreinfo ? ' - ' : ' (') . $langs->trans("AllEntities"); |
2325
|
|
- $moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(') . $langs->trans("AllEntities"); |
|
2324
|
+ $moreinfo .= ($moreinfo ? ' - ' : ' (').$langs->trans("AllEntities"); |
|
2325
|
+ $moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(').$langs->trans("AllEntities"); |
2326
|
2326
|
} else { |
2327
|
2327
|
if ($obj->entity != $conf->entity) { |
2328
|
|
- $moreinfo .= ($moreinfo ? ' - ' : ' (') . ($obj->label ? $obj->label : $langs->trans("EntityNameNotDefined")); |
|
2328
|
+ $moreinfo .= ($moreinfo ? ' - ' : ' (').($obj->label ? $obj->label : $langs->trans("EntityNameNotDefined")); |
2329
|
2329
|
$moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(').($obj->label ? $obj->label : $langs->trans("EntityNameNotDefined")); |
2330
|
2330
|
} |
2331
|
2331
|
} |
|
@@ -2334,13 +2334,13 @@ discard block |
|
|
block discarded – undo |
2334
|
2334
|
$moreinfohtml .= (!empty($moreinfohtml) ? ')</span>' : ''); |
2335
|
2335
|
if (!empty($disableline) && $disableline != '1') { |
2336
|
2336
|
// Add text from $enableonlytext parameter |
2337
|
|
- $moreinfo .= ' - ' . $disableline; |
2338
|
|
- $moreinfohtml .= ' - ' . $disableline; |
|
2337
|
+ $moreinfo .= ' - '.$disableline; |
|
2338
|
+ $moreinfohtml .= ' - '.$disableline; |
2339
|
2339
|
} |
2340
|
2340
|
$labeltoshow .= $moreinfo; |
2341
|
2341
|
$labeltoshowhtml .= $moreinfohtml; |
2342
|
2342
|
|
2343
|
|
- $out .= '<option value="' . $obj->rowid . '"'; |
|
2343
|
+ $out .= '<option value="'.$obj->rowid.'"'; |
2344
|
2344
|
if (!empty($disableline)) { |
2345
|
2345
|
$out .= ' disabled'; |
2346
|
2346
|
} |
|
@@ -2349,7 +2349,7 @@ discard block |
|
|
block discarded – undo |
2349
|
2349
|
} |
2350
|
2350
|
$out .= ' data-html="'; |
2351
|
2351
|
|
2352
|
|
- $outhtml = $userstatic->getNomUrl(-3, '', 0, 1, 24, 1, 'login', '', 1) . ' '; |
|
2352
|
+ $outhtml = $userstatic->getNomUrl(-3, '', 0, 1, 24, 1, 'login', '', 1).' '; |
2353
|
2353
|
if ($showstatus >= 0 && $obj->status == 0) { |
2354
|
2354
|
$outhtml .= '<strike class="opacitymediumxxx">'; |
2355
|
2355
|
} |
|
@@ -2364,7 +2364,7 @@ discard block |
|
|
block discarded – undo |
2364
|
2364
|
$out .= $labeltoshow; |
2365
|
2365
|
$out .= '</option>'; |
2366
|
2366
|
|
2367
|
|
- $outarray[$userstatic->id] = $userstatic->getFullName($langs, $fullNameMode, -1, $maxlength) . $moreinfo; |
|
2367
|
+ $outarray[$userstatic->id] = $userstatic->getFullName($langs, $fullNameMode, -1, $maxlength).$moreinfo; |
2368
|
2368
|
$outarray2[$userstatic->id] = array( |
2369
|
2369
|
'id' => $userstatic->id, |
2370
|
2370
|
'label' => $labeltoshow, |
|
@@ -2376,14 +2376,14 @@ discard block |
|
|
block discarded – undo |
2376
|
2376
|
$i++; |
2377
|
2377
|
} |
2378
|
2378
|
} else { |
2379
|
|
- $out .= '<select class="flat" id="' . $htmlname . '" name="' . $htmlname . '" disabled>'; |
2380
|
|
- $out .= '<option value="">' . $langs->trans("None") . '</option>'; |
|
2379
|
+ $out .= '<select class="flat" id="'.$htmlname.'" name="'.$htmlname.'" disabled>'; |
|
2380
|
+ $out .= '<option value="">'.$langs->trans("None").'</option>'; |
2381
|
2381
|
} |
2382
|
2382
|
$out .= '</select>'; |
2383
|
2383
|
|
2384
|
2384
|
if ($num && !$forcecombo) { |
2385
|
2385
|
// Enhance with select2 |
2386
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
2386
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
2387
|
2387
|
$out .= ajax_combobox($htmlname); |
2388
|
2388
|
} |
2389
|
2389
|
} else { |
|
@@ -2459,16 +2459,16 @@ discard block |
|
|
block discarded – undo |
2459
|
2459
|
$out .= $userstatic->getNomUrl(-1); |
2460
|
2460
|
if ($i == 0) { |
2461
|
2461
|
$ownerid = $value['id']; |
2462
|
|
- $out .= ' (' . $langs->trans("Owner") . ')'; |
|
2462
|
+ $out .= ' ('.$langs->trans("Owner").')'; |
2463
|
2463
|
} |
2464
|
2464
|
if ($nbassignetouser > 1 && $action != 'view') { |
2465
|
|
- $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 . '">'; |
|
2465
|
+ $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.'">'; |
2466
|
2466
|
} |
2467
|
2467
|
// Show my availability |
2468
|
2468
|
if ($showproperties) { |
2469
|
2469
|
if ($ownerid == $value['id'] && is_array($listofuserid) && count($listofuserid) && in_array($ownerid, array_keys($listofuserid))) { |
2470
|
2470
|
$out .= '<div class="myavailability inline-block">'; |
2471
|
|
- $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>'; |
|
2471
|
+ $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>'; |
2472
|
2472
|
$out .= '</div>'; |
2473
|
2473
|
} |
2474
|
2474
|
} |
|
@@ -2485,15 +2485,15 @@ discard block |
|
|
block discarded – undo |
2485
|
2485
|
// Method with no ajax |
2486
|
2486
|
if ($action != 'view') { |
2487
|
2487
|
$out .= '<input type="hidden" class="removedassignedhidden" name="removedassigned" value="">'; |
2488
|
|
- $out .= '<script nonce="' . getNonce() . '" type="text/javascript">jQuery(document).ready(function () {'; |
|
2488
|
+ $out .= '<script nonce="'.getNonce().'" type="text/javascript">jQuery(document).ready(function () {'; |
2489
|
2489
|
$out .= 'jQuery(".removedassigned").click(function() { jQuery(".removedassignedhidden").val(jQuery(this).val()); });'; |
2490
|
2490
|
$out .= 'jQuery(".assignedtouser").change(function() { console.log(jQuery(".assignedtouser option:selected").val());'; |
2491
|
|
- $out .= ' if (jQuery(".assignedtouser option:selected").val() > 0) { jQuery("#' . $action . 'assignedtouser").attr("disabled", false); }'; |
2492
|
|
- $out .= ' else { jQuery("#' . $action . 'assignedtouser").attr("disabled", true); }'; |
|
2491
|
+ $out .= ' if (jQuery(".assignedtouser option:selected").val() > 0) { jQuery("#'.$action.'assignedtouser").attr("disabled", false); }'; |
|
2492
|
+ $out .= ' else { jQuery("#'.$action.'assignedtouser").attr("disabled", true); }'; |
2493
|
2493
|
$out .= '});'; |
2494
|
2494
|
$out .= '})</script>'; |
2495
|
2495
|
$out .= $this->select_dolusers('', $htmlname, $show_empty, $exclude, $disabled, $include, $enableonly, $force_entity, $maxlength, $showstatus, $morefilter); |
2496
|
|
- $out .= ' <input type="submit" disabled class="button valignmiddle smallpaddingimp reposition" id="' . $action . 'assignedtouser" name="' . $action . 'assignedtouser" value="' . dol_escape_htmltag($langs->trans("Add")) . '">'; |
|
2496
|
+ $out .= ' <input type="submit" disabled class="button valignmiddle smallpaddingimp reposition" id="'.$action.'assignedtouser" name="'.$action.'assignedtouser" value="'.dol_escape_htmltag($langs->trans("Add")).'">'; |
2497
|
2497
|
$out .= '<br>'; |
2498
|
2498
|
} |
2499
|
2499
|
|
|
@@ -2552,13 +2552,13 @@ discard block |
|
|
block discarded – undo |
2552
|
2552
|
$resourcestatic->fetch($value['id']); |
2553
|
2553
|
$out .= $resourcestatic->getNomUrl(-1); |
2554
|
2554
|
if ($nbassignetoresource > 1 && $action != 'view') { |
2555
|
|
- $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 . '">'; |
|
2555
|
+ $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.'">'; |
2556
|
2556
|
} |
2557
|
2557
|
// Show my availability |
2558
|
2558
|
if ($showproperties) { |
2559
|
2559
|
if (is_array($listofresourceid) && count($listofresourceid)) { |
2560
|
2560
|
$out .= '<div class="myavailability inline-block">'; |
2561
|
|
- $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>'; |
|
2561
|
+ $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>'; |
2562
|
2562
|
$out .= '</div>'; |
2563
|
2563
|
} |
2564
|
2564
|
} |
|
@@ -2575,11 +2575,11 @@ discard block |
|
|
block discarded – undo |
2575
|
2575
|
// Method with no ajax |
2576
|
2576
|
if ($action != 'view') { |
2577
|
2577
|
$out .= '<input type="hidden" class="removedassignedhidden" name="removedassignedresource" value="">'; |
2578
|
|
- $out .= '<script nonce="' . getNonce() . '" type="text/javascript">jQuery(document).ready(function () {'; |
|
2578
|
+ $out .= '<script nonce="'.getNonce().'" type="text/javascript">jQuery(document).ready(function () {'; |
2579
|
2579
|
$out .= 'jQuery(".removedassignedresource").click(function() { jQuery(".removedassignedresourcehidden").val(jQuery(this).val()); });'; |
2580
|
2580
|
$out .= 'jQuery(".assignedtoresource").change(function() { console.log(jQuery(".assignedtoresource option:selected").val());'; |
2581
|
|
- $out .= ' if (jQuery(".assignedtoresource option:selected").val() > 0) { jQuery("#' . $action . 'assignedtoresource").attr("disabled", false); }'; |
2582
|
|
- $out .= ' else { jQuery("#' . $action . 'assignedtoresource").attr("disabled", true); }'; |
|
2581
|
+ $out .= ' if (jQuery(".assignedtoresource option:selected").val() > 0) { jQuery("#'.$action.'assignedtoresource").attr("disabled", false); }'; |
|
2582
|
+ $out .= ' else { jQuery("#'.$action.'assignedtoresource").attr("disabled", true); }'; |
2583
|
2583
|
$out .= '});'; |
2584
|
2584
|
$out .= '})</script>'; |
2585
|
2585
|
|
|
@@ -2587,7 +2587,7 @@ discard block |
|
|
block discarded – undo |
2587
|
2587
|
$out .= img_picto('', 'resource', 'class="pictofixedwidth"'); |
2588
|
2588
|
$out .= $formresources->select_resource_list(0, $htmlname, [], 1, 1, 0, $events, array(), 2, 0); |
2589
|
2589
|
//$out .= $this->select_dolusers('', $htmlname, $show_empty, $exclude, $disabled, $include, $enableonly, $force_entity, $maxlength, $showstatus, $morefilter); |
2590
|
|
- $out .= ' <input type="submit" disabled class="button valignmiddle smallpaddingimp reposition" id="' . $action . 'assignedtoresource" name="' . $action . 'assignedtoresource" value="' . dol_escape_htmltag($langs->trans("Add")) . '">'; |
|
2590
|
+ $out .= ' <input type="submit" disabled class="button valignmiddle smallpaddingimp reposition" id="'.$action.'assignedtoresource" name="'.$action.'assignedtoresource" value="'.dol_escape_htmltag($langs->trans("Add")).'">'; |
2591
|
2591
|
$out .= '<br>'; |
2592
|
2592
|
} |
2593
|
2593
|
|
|
@@ -2649,7 +2649,7 @@ discard block |
|
|
block discarded – undo |
2649
|
2649
|
$placeholder = ''; |
2650
|
2650
|
|
2651
|
2651
|
if ($selected && empty($selected_input_value)) { |
2652
|
|
- require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; |
|
2652
|
+ require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; |
2653
|
2653
|
$producttmpselect = new Product($this->db); |
2654
|
2654
|
$producttmpselect->fetch($selected); |
2655
|
2655
|
$selected_input_value = $producttmpselect->ref; |
|
@@ -2664,17 +2664,17 @@ discard block |
|
|
block discarded – undo |
2664
|
2664
|
} |
2665
|
2665
|
} |
2666
|
2666
|
// mode=1 means customers products |
2667
|
|
- $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; |
2668
|
|
- $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/product/ajax/products.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions); |
|
2667
|
+ $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; |
|
2668
|
+ $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/product/ajax/products.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions); |
2669
|
2669
|
|
2670
|
2670
|
if (isModEnabled('variants') && is_array($selected_combinations)) { |
2671
|
2671
|
// Code to automatically insert with javascript the select of attributes under the select of product |
2672
|
2672
|
// when a parent of variant has been selected. |
2673
|
2673
|
$out .= ' |
2674
|
2674
|
<!-- script to auto show attributes select tags if a variant was selected --> |
2675
|
|
- <script nonce="' . getNonce() . '"> |
|
2675
|
+ <script nonce="' . getNonce().'"> |
2676
|
2676
|
// auto show attributes fields |
2677
|
|
- selected = ' . json_encode($selected_combinations) . '; |
|
2677
|
+ selected = ' . json_encode($selected_combinations).'; |
2678
|
2678
|
combvalues = {}; |
2679
|
2679
|
|
2680
|
2680
|
jQuery(document).ready(function () { |
|
@@ -2685,7 +2685,7 @@ discard block |
|
|
block discarded – undo |
2685
|
2685
|
} |
2686
|
2686
|
}); |
2687
|
2687
|
|
2688
|
|
- jQuery("input#' . $htmlname . '").change(function () { |
|
2688
|
+ jQuery("input#' . $htmlname.'").change(function () { |
2689
|
2689
|
|
2690
|
2690
|
if (!jQuery(this).val()) { |
2691
|
2691
|
jQuery(\'div#attributes_box\').empty(); |
|
@@ -2694,7 +2694,7 @@ discard block |
|
|
block discarded – undo |
2694
|
2694
|
|
2695
|
2695
|
console.log("A change has started. We get variants fields to inject html select"); |
2696
|
2696
|
|
2697
|
|
- jQuery.getJSON("' . DOL_URL_ROOT . '/variants/ajax/getCombinations.php", { |
|
2697
|
+ jQuery.getJSON("' . DOL_URL_ROOT.'/variants/ajax/getCombinations.php", { |
2698
|
2698
|
id: jQuery(this).val() |
2699
|
2699
|
}, function (data) { |
2700
|
2700
|
jQuery(\'div#attributes_box\').empty(); |
|
@@ -2737,21 +2737,21 @@ discard block |
|
|
block discarded – undo |
2737
|
2737
|
}) |
2738
|
2738
|
}); |
2739
|
2739
|
|
2740
|
|
- ' . ($selected ? 'jQuery("input#' . $htmlname . '").change();' : '') . ' |
|
2740
|
+ ' . ($selected ? 'jQuery("input#'.$htmlname.'").change();' : '').' |
2741
|
2741
|
}); |
2742
|
2742
|
</script> |
2743
|
2743
|
'; |
2744
|
2744
|
} |
2745
|
2745
|
|
2746
|
2746
|
if (empty($hidelabel)) { |
2747
|
|
- $out .= $langs->trans("RefOrLabel") . ' : '; |
|
2747
|
+ $out .= $langs->trans("RefOrLabel").' : '; |
2748
|
2748
|
} elseif ($hidelabel > 1) { |
2749
|
|
- $placeholder = ' placeholder="' . $langs->trans("RefOrLabel") . '"'; |
|
2749
|
+ $placeholder = ' placeholder="'.$langs->trans("RefOrLabel").'"'; |
2750
|
2750
|
if ($hidelabel == 2) { |
2751
|
2751
|
$out .= img_picto($langs->trans("Search"), 'search'); |
2752
|
2752
|
} |
2753
|
2753
|
} |
2754
|
|
- $out .= '<input type="text" class="minwidth100' . ($morecss ? ' ' . $morecss : '') . '" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . $placeholder . ' ' . (getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '') . ' />'; |
|
2754
|
+ $out .= '<input type="text" class="minwidth100'.($morecss ? ' '.$morecss : '').'" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' '.(getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '').' />'; |
2755
|
2755
|
if ($hidelabel == 3) { |
2756
|
2756
|
$out .= img_picto($langs->trans("Search"), 'search'); |
2757
|
2757
|
} |
|
@@ -2788,33 +2788,33 @@ discard block |
|
|
block discarded – undo |
2788
|
2788
|
// phpcs:enable |
2789
|
2789
|
global $db; |
2790
|
2790
|
|
2791
|
|
- require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; |
|
2791
|
+ require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; |
2792
|
2792
|
|
2793
|
2793
|
$error = 0; |
2794
|
2794
|
$out = ''; |
2795
|
2795
|
|
2796
|
2796
|
if (!$forcecombo) { |
2797
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
2797
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
2798
|
2798
|
$events = array(); |
2799
|
2799
|
$out .= ajax_combobox($htmlname, $events, getDolGlobalInt("PRODUIT_USE_SEARCH_TO_SELECT")); |
2800
|
2800
|
} |
2801
|
2801
|
|
2802
|
|
- $out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">'; |
|
2802
|
+ $out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">'; |
2803
|
2803
|
|
2804
|
2804
|
$sql = 'SELECT b.rowid, b.ref, b.label, b.fk_product'; |
2805
|
|
- $sql .= ' FROM ' . MAIN_DB_PREFIX . 'bom_bom as b'; |
2806
|
|
- $sql .= ' WHERE b.entity IN (' . getEntity('bom') . ')'; |
|
2805
|
+ $sql .= ' FROM '.MAIN_DB_PREFIX.'bom_bom as b'; |
|
2806
|
+ $sql .= ' WHERE b.entity IN ('.getEntity('bom').')'; |
2807
|
2807
|
if (!empty($status)) { |
2808
|
|
- $sql .= ' AND status = ' . (int) $status; |
|
2808
|
+ $sql .= ' AND status = '.(int) $status; |
2809
|
2809
|
} |
2810
|
2810
|
if (!empty($type)) { |
2811
|
|
- $sql .= ' AND bomtype = ' . (int) $type; |
|
2811
|
+ $sql .= ' AND bomtype = '.(int) $type; |
2812
|
2812
|
} |
2813
|
2813
|
if (!empty($TProducts)) { |
2814
|
|
- $sql .= ' AND fk_product IN (' . $this->db->sanitize(implode(',', $TProducts)) . ')'; |
|
2814
|
+ $sql .= ' AND fk_product IN ('.$this->db->sanitize(implode(',', $TProducts)).')'; |
2815
|
2815
|
} |
2816
|
2816
|
if (!empty($limit)) { |
2817
|
|
- $sql .= ' LIMIT ' . (int) $limit; |
|
2817
|
+ $sql .= ' LIMIT '.(int) $limit; |
2818
|
2818
|
} |
2819
|
2819
|
$resql = $db->query($sql); |
2820
|
2820
|
if ($resql) { |
|
@@ -2828,11 +2828,11 @@ discard block |
|
|
block discarded – undo |
2828
|
2828
|
while ($obj = $db->fetch_object($resql)) { |
2829
|
2829
|
$product = new Product($db); |
2830
|
2830
|
$res = $product->fetch($obj->fk_product); |
2831
|
|
- $out .= '<option value="' . $obj->rowid . '"'; |
|
2831
|
+ $out .= '<option value="'.$obj->rowid.'"'; |
2832
|
2832
|
if ($obj->rowid == $selected) { |
2833
|
2833
|
$out .= 'selected'; |
2834
|
2834
|
} |
2835
|
|
- $out .= '>' . $obj->ref . ' - ' . $product->label . ' - ' . $obj->label . '</option>'; |
|
2835
|
+ $out .= '>'.$obj->ref.' - '.$product->label.' - '.$obj->label.'</option>'; |
2836
|
2836
|
} |
2837
|
2837
|
} else { |
2838
|
2838
|
$error++; |
|
@@ -2889,7 +2889,7 @@ discard block |
|
|
block discarded – undo |
2889
|
2889
|
|
2890
|
2890
|
$warehouseStatusArray = array(); |
2891
|
2891
|
if (!empty($warehouseStatus)) { |
2892
|
|
- require_once DOL_DOCUMENT_ROOT . '/product/stock/class/entrepot.class.php'; |
|
2892
|
+ require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php'; |
2893
|
2893
|
if (preg_match('/warehouseclosed/', $warehouseStatus)) { |
2894
|
2894
|
$warehouseStatusArray[] = Entrepot::STATUS_CLOSED; |
2895
|
2895
|
} |
|
@@ -2903,9 +2903,9 @@ discard block |
|
|
block discarded – undo |
2903
|
2903
|
|
2904
|
2904
|
$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"; |
2905
|
2905
|
if (count($warehouseStatusArray)) { |
2906
|
|
- $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 |
|
2906
|
+ $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 |
2907
|
2907
|
} else { |
2908
|
|
- $selectFieldsGrouped = ", " . $this->db->ifsql("p.stock IS NULL", 0, "p.stock") . " AS stock"; |
|
2908
|
+ $selectFieldsGrouped = ", ".$this->db->ifsql("p.stock IS NULL", 0, "p.stock")." AS stock"; |
2909
|
2909
|
} |
2910
|
2910
|
|
2911
|
2911
|
$sql = "SELECT "; |
|
@@ -2921,9 +2921,9 @@ discard block |
|
|
block discarded – undo |
2921
|
2921
|
|
2922
|
2922
|
if (getDolGlobalString('PRODUCT_SORT_BY_CATEGORY')) { |
2923
|
2923
|
//Product category |
2924
|
|
- $sql .= ", (SELECT " . $this->db->prefix() . "categorie_product.fk_categorie |
2925
|
|
- FROM " . $this->db->prefix() . "categorie_product |
2926
|
|
- WHERE " . $this->db->prefix() . "categorie_product.fk_product=p.rowid |
|
2924
|
+ $sql .= ", (SELECT ".$this->db->prefix()."categorie_product.fk_categorie |
|
2925
|
+ FROM " . $this->db->prefix()."categorie_product |
|
2926
|
+ WHERE " . $this->db->prefix()."categorie_product.fk_product=p.rowid |
2927
|
2927
|
LIMIT 1 |
2928
|
2928
|
) AS categorie_product_id "; |
2929
|
2929
|
} |
|
@@ -2949,15 +2949,15 @@ discard block |
|
|
block discarded – undo |
2949
|
2949
|
} |
2950
|
2950
|
// Price by quantity |
2951
|
2951
|
if (getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES')) { |
2952
|
|
- $sql .= ", (SELECT pp.rowid FROM " . $this->db->prefix() . "product_price as pp WHERE pp.fk_product = p.rowid"; |
|
2952
|
+ $sql .= ", (SELECT pp.rowid FROM ".$this->db->prefix()."product_price as pp WHERE pp.fk_product = p.rowid"; |
2953
|
2953
|
if ($price_level >= 1 && getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES')) { |
2954
|
|
- $sql .= " AND price_level = " . ((int) $price_level); |
|
2954
|
+ $sql .= " AND price_level = ".((int) $price_level); |
2955
|
2955
|
} |
2956
|
2956
|
$sql .= " ORDER BY date_price"; |
2957
|
2957
|
$sql .= " DESC LIMIT 1) as price_rowid"; |
2958
|
|
- $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 |
|
2958
|
+ $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 |
2959
|
2959
|
if ($price_level >= 1 && getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES')) { |
2960
|
|
- $sql .= " AND price_level = " . ((int) $price_level); |
|
2960
|
+ $sql .= " AND price_level = ".((int) $price_level); |
2961
|
2961
|
} |
2962
|
2962
|
$sql .= " ORDER BY date_price"; |
2963
|
2963
|
$sql .= " DESC LIMIT 1) as price_by_qty"; |
|
@@ -2967,7 +2967,7 @@ discard block |
|
|
block discarded – undo |
2967
|
2967
|
$sql .= " FROM ".$this->db->prefix()."product as p"; |
2968
|
2968
|
|
2969
|
2969
|
if (getDolGlobalString('MAIN_SEARCH_PRODUCT_FORCE_INDEX')) { |
2970
|
|
- $sql .= " USE INDEX (" . $this->db->sanitize(getDolGlobalString('MAIN_PRODUCT_FORCE_INDEX')) . ")"; |
|
2970
|
+ $sql .= " USE INDEX (".$this->db->sanitize(getDolGlobalString('MAIN_PRODUCT_FORCE_INDEX')).")"; |
2971
|
2971
|
} |
2972
|
2972
|
|
2973
|
2973
|
// Add from (left join) from hooks |
|
@@ -2976,53 +2976,53 @@ discard block |
|
|
block discarded – undo |
2976
|
2976
|
$sql .= $hookmanager->resPrint; |
2977
|
2977
|
|
2978
|
2978
|
if (count($warehouseStatusArray)) { |
2979
|
|
- $sql .= " LEFT JOIN " . $this->db->prefix() . "product_stock as ps on ps.fk_product = p.rowid"; |
2980
|
|
- $sql .= " LEFT JOIN " . $this->db->prefix() . "entrepot as e on ps.fk_entrepot = e.rowid AND e.entity IN (" . getEntity('stock') . ")"; |
2981
|
|
- $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. |
|
2979
|
+ $sql .= " LEFT JOIN ".$this->db->prefix()."product_stock as ps on ps.fk_product = p.rowid"; |
|
2980
|
+ $sql .= " LEFT JOIN ".$this->db->prefix()."entrepot as e on ps.fk_entrepot = e.rowid AND e.entity IN (".getEntity('stock').")"; |
|
2981
|
+ $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. |
2982
|
2982
|
} |
2983
|
2983
|
|
2984
|
2984
|
// include search in supplier ref |
2985
|
2985
|
if (getDolGlobalString('MAIN_SEARCH_PRODUCT_BY_FOURN_REF')) { |
2986
|
|
- $sql .= " LEFT JOIN " . $this->db->prefix() . "product_fournisseur_price as pfp ON p.rowid = pfp.fk_product"; |
|
2986
|
+ $sql .= " LEFT JOIN ".$this->db->prefix()."product_fournisseur_price as pfp ON p.rowid = pfp.fk_product"; |
2987
|
2987
|
} |
2988
|
2988
|
|
2989
|
2989
|
//Price by customer |
2990
|
2990
|
if (getDolGlobalString('PRODUIT_CUSTOMER_PRICES') && !empty($socid)) { |
2991
|
|
- $sql .= " LEFT JOIN " . $this->db->prefix() . "product_customer_price as pcp ON pcp.fk_soc=" . ((int) $socid) . " AND pcp.fk_product=p.rowid"; |
|
2991
|
+ $sql .= " LEFT JOIN ".$this->db->prefix()."product_customer_price as pcp ON pcp.fk_soc=".((int) $socid)." AND pcp.fk_product=p.rowid"; |
2992
|
2992
|
} |
2993
|
2993
|
// Units |
2994
|
2994
|
if (getDolGlobalInt('PRODUCT_USE_UNITS')) { |
2995
|
|
- $sql .= " LEFT JOIN " . $this->db->prefix() . "c_units u ON u.rowid = p.fk_unit"; |
|
2995
|
+ $sql .= " LEFT JOIN ".$this->db->prefix()."c_units u ON u.rowid = p.fk_unit"; |
2996
|
2996
|
} |
2997
|
2997
|
// Multilang : we add translation |
2998
|
2998
|
if (getDolGlobalInt('MAIN_MULTILANGS')) { |
2999
|
|
- $sql .= " LEFT JOIN " . $this->db->prefix() . "product_lang as pl ON pl.fk_product = p.rowid "; |
|
2999
|
+ $sql .= " LEFT JOIN ".$this->db->prefix()."product_lang as pl ON pl.fk_product = p.rowid "; |
3000
|
3000
|
if (getDolGlobalString('PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE') && !empty($socid)) { |
3001
|
|
- require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; |
|
3001
|
+ require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; |
3002
|
3002
|
$soc = new Societe($this->db); |
3003
|
3003
|
$result = $soc->fetch($socid); |
3004
|
3004
|
if ($result > 0 && !empty($soc->default_lang)) { |
3005
|
|
- $sql .= " AND pl.lang = '" . $this->db->escape($soc->default_lang) . "'"; |
|
3005
|
+ $sql .= " AND pl.lang = '".$this->db->escape($soc->default_lang)."'"; |
3006
|
3006
|
} else { |
3007
|
|
- $sql .= " AND pl.lang = '" . $this->db->escape($langs->getDefaultLang()) . "'"; |
|
3007
|
+ $sql .= " AND pl.lang = '".$this->db->escape($langs->getDefaultLang())."'"; |
3008
|
3008
|
} |
3009
|
3009
|
} else { |
3010
|
|
- $sql .= " AND pl.lang = '" . $this->db->escape($langs->getDefaultLang()) . "'"; |
|
3010
|
+ $sql .= " AND pl.lang = '".$this->db->escape($langs->getDefaultLang())."'"; |
3011
|
3011
|
} |
3012
|
3012
|
} |
3013
|
3013
|
|
3014
|
3014
|
if (getDolGlobalString('PRODUIT_ATTRIBUTES_HIDECHILD')) { |
3015
|
|
- $sql .= " LEFT JOIN " . $this->db->prefix() . "product_attribute_combination pac ON pac.fk_product_child = p.rowid"; |
|
3015
|
+ $sql .= " LEFT JOIN ".$this->db->prefix()."product_attribute_combination pac ON pac.fk_product_child = p.rowid"; |
3016
|
3016
|
} |
3017
|
3017
|
|
3018
|
|
- $sql .= ' WHERE p.entity IN (' . getEntity('product') . ')'; |
|
3018
|
+ $sql .= ' WHERE p.entity IN ('.getEntity('product').')'; |
3019
|
3019
|
|
3020
|
3020
|
if (getDolGlobalString('PRODUIT_ATTRIBUTES_HIDECHILD')) { |
3021
|
3021
|
$sql .= " AND pac.rowid IS NULL"; |
3022
|
3022
|
} |
3023
|
3023
|
|
3024
|
3024
|
if ($finished == 0) { |
3025
|
|
- $sql .= " AND p.finished = " . ((int) $finished); |
|
3025
|
+ $sql .= " AND p.finished = ".((int) $finished); |
3026
|
3026
|
} elseif ($finished == 1) { |
3027
|
3027
|
$sql .= " AND p.finished = ".((int) $finished); |
3028
|
3028
|
} |
|
@@ -3030,11 +3030,11 @@ discard block |
|
|
block discarded – undo |
3030
|
3030
|
$sql .= " AND p.tosell = ".((int) $status); |
3031
|
3031
|
} |
3032
|
3032
|
if ($status_purchase >= 0) { |
3033
|
|
- $sql .= " AND p.tobuy = " . ((int) $status_purchase); |
|
3033
|
+ $sql .= " AND p.tobuy = ".((int) $status_purchase); |
3034
|
3034
|
} |
3035
|
3035
|
// Filter by product type |
3036
|
3036
|
if (strval($filtertype) != '') { |
3037
|
|
- $sql .= " AND p.fk_product_type = " . ((int) $filtertype); |
|
3037
|
+ $sql .= " AND p.fk_product_type = ".((int) $filtertype); |
3038
|
3038
|
} elseif (!isModEnabled('product')) { // when product module is disabled, show services only |
3039
|
3039
|
$sql .= " AND p.fk_product_type = 1"; |
3040
|
3040
|
} elseif (!isModEnabled('service')) { // when service module is disabled, show products only |
|
@@ -3058,21 +3058,21 @@ discard block |
|
|
block discarded – undo |
3058
|
3058
|
if ($i > 0) { |
3059
|
3059
|
$sql .= " AND "; |
3060
|
3060
|
} |
3061
|
|
- $sql .= "(p.ref LIKE '" . $this->db->escape($prefix . $crit) . "%' OR p.label LIKE '" . $this->db->escape($prefix . $crit) . "%'"; |
|
3061
|
+ $sql .= "(p.ref LIKE '".$this->db->escape($prefix.$crit)."%' OR p.label LIKE '".$this->db->escape($prefix.$crit)."%'"; |
3062
|
3062
|
if (getDolGlobalInt('MAIN_MULTILANGS')) { |
3063
|
|
- $sql .= " OR pl.label LIKE '" . $this->db->escape($prefix . $crit) . "%'"; |
|
3063
|
+ $sql .= " OR pl.label LIKE '".$this->db->escape($prefix.$crit)."%'"; |
3064
|
3064
|
} |
3065
|
3065
|
if (getDolGlobalString('PRODUIT_CUSTOMER_PRICES') && !empty($socid)) { |
3066
|
|
- $sql .= " OR pcp.ref_customer LIKE '" . $this->db->escape($prefix . $crit) . "%'"; |
|
3066
|
+ $sql .= " OR pcp.ref_customer LIKE '".$this->db->escape($prefix.$crit)."%'"; |
3067
|
3067
|
} |
3068
|
3068
|
if (getDolGlobalString('PRODUCT_AJAX_SEARCH_ON_DESCRIPTION')) { |
3069
|
|
- $sql .= " OR p.description LIKE '" . $this->db->escape($prefix . $crit) . "%'"; |
|
3069
|
+ $sql .= " OR p.description LIKE '".$this->db->escape($prefix.$crit)."%'"; |
3070
|
3070
|
if (getDolGlobalInt('MAIN_MULTILANGS')) { |
3071
|
|
- $sql .= " OR pl.description LIKE '" . $this->db->escape($prefix . $crit) . "%'"; |
|
3071
|
+ $sql .= " OR pl.description LIKE '".$this->db->escape($prefix.$crit)."%'"; |
3072
|
3072
|
} |
3073
|
3073
|
} |
3074
|
3074
|
if (getDolGlobalString('MAIN_SEARCH_PRODUCT_BY_FOURN_REF')) { |
3075
|
|
- $sql .= " OR pfp.ref_fourn LIKE '" . $this->db->escape($prefix . $crit) . "%'"; |
|
3075
|
+ $sql .= " OR pfp.ref_fourn LIKE '".$this->db->escape($prefix.$crit)."%'"; |
3076
|
3076
|
} |
3077
|
3077
|
$sql .= ")"; |
3078
|
3078
|
$i++; |
|
@@ -3081,12 +3081,12 @@ discard block |
|
|
block discarded – undo |
3081
|
3081
|
$sql .= ")"; |
3082
|
3082
|
} |
3083
|
3083
|
if (isModEnabled('barcode')) { |
3084
|
|
- $sql .= " OR p.barcode LIKE '" . $this->db->escape($prefix . $filterkey) . "%'"; |
|
3084
|
+ $sql .= " OR p.barcode LIKE '".$this->db->escape($prefix.$filterkey)."%'"; |
3085
|
3085
|
} |
3086
|
3086
|
$sql .= ')'; |
3087
|
3087
|
} |
3088
|
3088
|
if (count($warehouseStatusArray)) { |
3089
|
|
- $sql .= " GROUP BY " . $selectFields; |
|
3089
|
+ $sql .= " GROUP BY ".$selectFields; |
3090
|
3090
|
} |
3091
|
3091
|
|
3092
|
3092
|
//Sort by category |
|
@@ -3101,23 +3101,23 @@ discard block |
|
|
block discarded – undo |
3101
|
3101
|
$sql .= $this->db->plimit($limit, 0); |
3102
|
3102
|
|
3103
|
3103
|
// Build output string |
3104
|
|
- dol_syslog(get_class($this) . "::select_produits_list search products", LOG_DEBUG); |
|
3104
|
+ dol_syslog(get_class($this)."::select_produits_list search products", LOG_DEBUG); |
3105
|
3105
|
$result = $this->db->query($sql); |
3106
|
3106
|
if ($result) { |
3107
|
|
- require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; |
3108
|
|
- require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php'; |
3109
|
|
- require_once DOL_DOCUMENT_ROOT . '/core/lib/product.lib.php'; |
|
3107
|
+ require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; |
|
3108
|
+ require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php'; |
|
3109
|
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php'; |
3110
|
3110
|
|
3111
|
3111
|
$num = $this->db->num_rows($result); |
3112
|
3112
|
|
3113
|
3113
|
$events = array(); |
3114
|
3114
|
|
3115
|
3115
|
if (!$forcecombo) { |
3116
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
3116
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
3117
|
3117
|
$out .= ajax_combobox($htmlname, $events, getDolGlobalInt("PRODUIT_USE_SEARCH_TO_SELECT")); |
3118
|
3118
|
} |
3119
|
3119
|
|
3120
|
|
- $out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">'; |
|
3120
|
+ $out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">'; |
3121
|
3121
|
|
3122
|
3122
|
$textifempty = ''; |
3123
|
3123
|
// Do not use textifempty = ' ' or ' ' here, or search on key will search on ' key'. |
|
@@ -3134,7 +3134,7 @@ discard block |
|
|
block discarded – undo |
3134
|
3134
|
} |
3135
|
3135
|
} |
3136
|
3136
|
if ($showempty) { |
3137
|
|
- $out .= '<option value="-1" selected>' . ($textifempty ? $textifempty : ' ') . '</option>'; |
|
3137
|
+ $out .= '<option value="-1" selected>'.($textifempty ? $textifempty : ' ').'</option>'; |
3138
|
3138
|
} |
3139
|
3139
|
|
3140
|
3140
|
$i = 0; |
|
@@ -3145,11 +3145,11 @@ discard block |
|
|
block discarded – undo |
3145
|
3145
|
|
3146
|
3146
|
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 |
3147
|
3147
|
$sql = "SELECT rowid, quantity, price, unitprice, remise_percent, remise, price_base_type"; |
3148
|
|
- $sql .= " FROM " . $this->db->prefix() . "product_price_by_qty"; |
3149
|
|
- $sql .= " WHERE fk_product_price = " . ((int) $objp->price_rowid); |
|
3148
|
+ $sql .= " FROM ".$this->db->prefix()."product_price_by_qty"; |
|
3149
|
+ $sql .= " WHERE fk_product_price = ".((int) $objp->price_rowid); |
3150
|
3150
|
$sql .= " ORDER BY quantity ASC"; |
3151
|
3151
|
|
3152
|
|
- dol_syslog(get_class($this) . "::select_produits_list search prices by qty", LOG_DEBUG); |
|
3152
|
+ dol_syslog(get_class($this)."::select_produits_list search prices by qty", LOG_DEBUG); |
3153
|
3153
|
$result2 = $this->db->query($sql); |
3154
|
3154
|
if ($result2) { |
3155
|
3155
|
$nb_prices = $this->db->num_rows($result2); |
|
@@ -3187,7 +3187,7 @@ discard block |
|
|
block discarded – undo |
3187
|
3187
|
$price_product = new Product($this->db); |
3188
|
3188
|
$price_product->fetch($objp->rowid, '', '', 1); |
3189
|
3189
|
|
3190
|
|
- require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php'; |
|
3190
|
+ require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php'; |
3191
|
3191
|
$priceparser = new PriceParser($this->db); |
3192
|
3192
|
$price_result = $priceparser->parseProduct($price_product); |
3193
|
3193
|
if ($price_result >= 0) { |
|
@@ -3271,7 +3271,7 @@ discard block |
|
|
block discarded – undo |
3271
|
3271
|
$label = $objp->label_translated; |
3272
|
3272
|
} |
3273
|
3273
|
if (!empty($filterkey) && $filterkey != '') { |
3274
|
|
- $label = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $label, 1); |
|
3274
|
+ $label = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $label, 1); |
3275
|
3275
|
} |
3276
|
3276
|
|
3277
|
3277
|
$outkey = $objp->rowid; |
|
@@ -3292,32 +3292,32 @@ discard block |
|
|
block discarded – undo |
3292
|
3292
|
$outdurationunit = $outtype == Product::TYPE_SERVICE ? substr($objp->duration, -1) : ''; |
3293
|
3293
|
|
3294
|
3294
|
if ($outorigin && getDolGlobalString('PRODUCT_SHOW_ORIGIN_IN_COMBO')) { |
3295
|
|
- require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php'; |
|
3295
|
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; |
3296
|
3296
|
} |
3297
|
3297
|
|
3298
|
3298
|
// Units |
3299
|
3299
|
$outvalUnits = ''; |
3300
|
3300
|
if (getDolGlobalInt('PRODUCT_USE_UNITS')) { |
3301
|
3301
|
if (!empty($objp->unit_short)) { |
3302
|
|
- $outvalUnits .= ' - ' . $objp->unit_short; |
|
3302
|
+ $outvalUnits .= ' - '.$objp->unit_short; |
3303
|
3303
|
} |
3304
|
3304
|
} |
3305
|
3305
|
if (getDolGlobalString('PRODUCT_SHOW_DIMENSIONS_IN_COMBO')) { |
3306
|
3306
|
if (!empty($objp->weight) && $objp->weight_units !== null) { |
3307
|
3307
|
$unitToShow = showDimensionInBestUnit($objp->weight, $objp->weight_units, 'weight', $langs); |
3308
|
|
- $outvalUnits .= ' - ' . $unitToShow; |
|
3308
|
+ $outvalUnits .= ' - '.$unitToShow; |
3309
|
3309
|
} |
3310
|
3310
|
if ((!empty($objp->length) || !empty($objp->width) || !empty($objp->height)) && $objp->length_units !== null) { |
3311
|
|
- $unitToShow = $objp->length . ' x ' . $objp->width . ' x ' . $objp->height . ' ' . measuringUnitString(0, 'size', $objp->length_units); |
3312
|
|
- $outvalUnits .= ' - ' . $unitToShow; |
|
3311
|
+ $unitToShow = $objp->length.' x '.$objp->width.' x '.$objp->height.' '.measuringUnitString(0, 'size', $objp->length_units); |
|
3312
|
+ $outvalUnits .= ' - '.$unitToShow; |
3313
|
3313
|
} |
3314
|
3314
|
if (!empty($objp->surface) && $objp->surface_units !== null) { |
3315
|
3315
|
$unitToShow = showDimensionInBestUnit($objp->surface, $objp->surface_units, 'surface', $langs); |
3316
|
|
- $outvalUnits .= ' - ' . $unitToShow; |
|
3316
|
+ $outvalUnits .= ' - '.$unitToShow; |
3317
|
3317
|
} |
3318
|
3318
|
if (!empty($objp->volume) && $objp->volume_units !== null) { |
3319
|
3319
|
$unitToShow = showDimensionInBestUnit($objp->volume, $objp->volume_units, 'volume', $langs); |
3320
|
|
- $outvalUnits .= ' - ' . $unitToShow; |
|
3320
|
+ $outvalUnits .= ' - '.$unitToShow; |
3321
|
3321
|
} |
3322
|
3322
|
} |
3323
|
3323
|
if ($outdurationvalue && $outdurationunit) { |
|
@@ -3329,7 +3329,7 @@ discard block |
|
|
block discarded – undo |
3329
|
3329
|
'y' => $langs->trans('Year') |
3330
|
3330
|
); |
3331
|
3331
|
if (isset($da[$outdurationunit])) { |
3332
|
|
- $outvalUnits .= ' - ' . $outdurationvalue . ' ' . $langs->transnoentities($da[$outdurationunit] . ($outdurationvalue > 1 ? 's' : '')); |
|
3332
|
+ $outvalUnits .= ' - '.$outdurationvalue.' '.$langs->transnoentities($da[$outdurationunit].($outdurationvalue > 1 ? 's' : '')); |
3333
|
3333
|
} |
3334
|
3334
|
} |
3335
|
3335
|
|
|
@@ -3349,31 +3349,31 @@ discard block |
|
|
block discarded – undo |
3349
|
3349
|
$labeltoshow = ''; |
3350
|
3350
|
$labeltoshow .= $objp->ref; |
3351
|
3351
|
if (!empty($objp->custref)) { |
3352
|
|
- $labeltoshow .= ' (' . $objp->custref . ')'; |
|
3352
|
+ $labeltoshow .= ' ('.$objp->custref.')'; |
3353
|
3353
|
} |
3354
|
3354
|
if ($outbarcode) { |
3355
|
|
- $labeltoshow .= ' (' . $outbarcode . ')'; |
|
3355
|
+ $labeltoshow .= ' ('.$outbarcode.')'; |
3356
|
3356
|
} |
3357
|
|
- $labeltoshow .= ' - ' . dol_trunc($label, $maxlengtharticle); |
|
3357
|
+ $labeltoshow .= ' - '.dol_trunc($label, $maxlengtharticle); |
3358
|
3358
|
if ($outorigin && getDolGlobalString('PRODUCT_SHOW_ORIGIN_IN_COMBO')) { |
3359
|
|
- $labeltoshow .= ' (' . getCountry($outorigin, 1) . ')'; |
|
3359
|
+ $labeltoshow .= ' ('.getCountry($outorigin, 1).')'; |
3360
|
3360
|
} |
3361
|
3361
|
|
3362
|
3362
|
// Set $labltoshowhtml |
3363
|
3363
|
$labeltoshowhtml = ''; |
3364
|
3364
|
$labeltoshowhtml .= $objp->ref; |
3365
|
3365
|
if (!empty($objp->custref)) { |
3366
|
|
- $labeltoshowhtml .= ' (' . $objp->custref . ')'; |
|
3366
|
+ $labeltoshowhtml .= ' ('.$objp->custref.')'; |
3367
|
3367
|
} |
3368
|
3368
|
if (!empty($filterkey) && $filterkey != '') { |
3369
|
|
- $labeltoshowhtml = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $labeltoshowhtml, 1); |
|
3369
|
+ $labeltoshowhtml = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $labeltoshowhtml, 1); |
3370
|
3370
|
} |
3371
|
3371
|
if ($outbarcode) { |
3372
|
|
- $labeltoshowhtml .= ' (' . $outbarcode . ')'; |
|
3372
|
+ $labeltoshowhtml .= ' ('.$outbarcode.')'; |
3373
|
3373
|
} |
3374
|
|
- $labeltoshowhtml .= ' - ' . dol_trunc($label, $maxlengtharticle); |
|
3374
|
+ $labeltoshowhtml .= ' - '.dol_trunc($label, $maxlengtharticle); |
3375
|
3375
|
if ($outorigin && getDolGlobalString('PRODUCT_SHOW_ORIGIN_IN_COMBO')) { |
3376
|
|
- $labeltoshowhtml .= ' (' . getCountry($outorigin, 1) . ')'; |
|
3376
|
+ $labeltoshowhtml .= ' ('.getCountry($outorigin, 1).')'; |
3377
|
3377
|
} |
3378
|
3378
|
|
3379
|
3379
|
// Stock |
|
@@ -3381,14 +3381,14 @@ discard block |
|
|
block discarded – undo |
3381
|
3381
|
$labeltoshowhtmlstock = ''; |
3382
|
3382
|
if (isModEnabled('stock') && isset($objp->stock) && ($objp->fk_product_type == Product::TYPE_PRODUCT || getDolGlobalString('STOCK_SUPPORTS_SERVICES'))) { |
3383
|
3383
|
if ($user->hasRight('stock', 'lire')) { |
3384
|
|
- $labeltoshowstock .= ' - ' . $langs->trans("Stock") . ': ' . price(price2num($objp->stock, 'MS')); |
|
3384
|
+ $labeltoshowstock .= ' - '.$langs->trans("Stock").': '.price(price2num($objp->stock, 'MS')); |
3385
|
3385
|
|
3386
|
3386
|
if ($objp->stock > 0) { |
3387
|
3387
|
$labeltoshowhtmlstock .= ' - <span class="product_line_stock_ok">'; |
3388
|
3388
|
} elseif ($objp->stock <= 0) { |
3389
|
3389
|
$labeltoshowhtmlstock .= ' - <span class="product_line_stock_too_low">'; |
3390
|
3390
|
} |
3391
|
|
- $labeltoshowhtmlstock .= $langs->transnoentities("Stock") . ': ' . price(price2num($objp->stock, 'MS')); |
|
3391
|
+ $labeltoshowhtmlstock .= $langs->transnoentities("Stock").': '.price(price2num($objp->stock, 'MS')); |
3392
|
3392
|
$labeltoshowhtmlstock .= '</span>'; |
3393
|
3393
|
|
3394
|
3394
|
if (empty($novirtualstock) && getDolGlobalString('STOCK_SHOW_VIRTUAL_STOCK_IN_PRODUCTS_COMBO')) { // Warning, this option may slow down combo list generation |
|
@@ -3399,9 +3399,9 @@ discard block |
|
|
block discarded – undo |
3399
|
3399
|
$tmpproduct->load_virtual_stock(); |
3400
|
3400
|
$virtualstock = $tmpproduct->stock_theorique; |
3401
|
3401
|
|
3402
|
|
- $labeltoshowstock .= ' - ' . $langs->trans("VirtualStock") . ':' . $virtualstock; |
|
3402
|
+ $labeltoshowstock .= ' - '.$langs->trans("VirtualStock").':'.$virtualstock; |
3403
|
3403
|
|
3404
|
|
- $labeltoshowhtmlstock .= ' - ' . $langs->transnoentities("VirtualStock") . ':'; |
|
3404
|
+ $labeltoshowhtmlstock .= ' - '.$langs->transnoentities("VirtualStock").':'; |
3405
|
3405
|
if ($virtualstock > 0) { |
3406
|
3406
|
$labeltoshowhtmlstock .= '<span class="product_line_stock_ok">'; |
3407
|
3407
|
} elseif ($virtualstock <= 0) { |
|
@@ -3422,35 +3422,35 @@ discard block |
|
|
block discarded – undo |
3422
|
3422
|
// If we need a particular price level (from 1 to n) |
3423
|
3423
|
if (empty($hidepriceinlabel) && $price_level >= 1 && (getDolGlobalString('PRODUIT_MULTIPRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES'))) { |
3424
|
3424
|
$sql = "SELECT price, price_ttc, price_base_type, tva_tx, default_vat_code"; |
3425
|
|
- $sql .= " FROM " . $this->db->prefix() . "product_price"; |
3426
|
|
- $sql .= " WHERE fk_product = " . ((int) $objp->rowid); |
3427
|
|
- $sql .= " AND entity IN (" . getEntity('productprice') . ")"; |
3428
|
|
- $sql .= " AND price_level = " . ((int) $price_level); |
|
3425
|
+ $sql .= " FROM ".$this->db->prefix()."product_price"; |
|
3426
|
+ $sql .= " WHERE fk_product = ".((int) $objp->rowid); |
|
3427
|
+ $sql .= " AND entity IN (".getEntity('productprice').")"; |
|
3428
|
+ $sql .= " AND price_level = ".((int) $price_level); |
3429
|
3429
|
$sql .= " ORDER BY date_price DESC, rowid DESC"; // Warning DESC must be both on date_price and rowid. |
3430
|
3430
|
$sql .= " LIMIT 1"; |
3431
|
3431
|
|
3432
|
|
- dol_syslog(get_class($this) . '::constructProductListOption search price for product ' . $objp->rowid . ' AND level ' . $price_level, LOG_DEBUG); |
|
3432
|
+ dol_syslog(get_class($this).'::constructProductListOption search price for product '.$objp->rowid.' AND level '.$price_level, LOG_DEBUG); |
3433
|
3433
|
$result2 = $this->db->query($sql); |
3434
|
3434
|
if ($result2) { |
3435
|
3435
|
$objp2 = $this->db->fetch_object($result2); |
3436
|
3436
|
if ($objp2) { |
3437
|
3437
|
$found = 1; |
3438
|
3438
|
if ($objp2->price_base_type == 'HT') { |
3439
|
|
- $labeltoshowprice .= ' - ' . price($objp2->price, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("HT"); |
3440
|
|
- $labeltoshowhtmlprice .= ' - ' . price($objp2->price, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("HT"); |
|
3439
|
+ $labeltoshowprice .= ' - '.price($objp2->price, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("HT"); |
|
3440
|
+ $labeltoshowhtmlprice .= ' - '.price($objp2->price, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("HT"); |
3441
|
3441
|
} else { |
3442
|
|
- $labeltoshowprice .= ' - ' . price($objp2->price_ttc, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("TTC"); |
3443
|
|
- $labeltoshowhtmlprice .= ' - ' . price($objp2->price_ttc, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("TTC"); |
|
3442
|
+ $labeltoshowprice .= ' - '.price($objp2->price_ttc, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("TTC"); |
|
3443
|
+ $labeltoshowhtmlprice .= ' - '.price($objp2->price_ttc, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("TTC"); |
3444
|
3444
|
} |
3445
|
3445
|
$outprice_ht = price($objp2->price); |
3446
|
3446
|
$outprice_ttc = price($objp2->price_ttc); |
3447
|
3447
|
$outpricebasetype = $objp2->price_base_type; |
3448
|
3448
|
if (getDolGlobalString('PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL')) { // using this option is a bug. kept for backward compatibility |
3449
|
|
- $outtva_tx = $objp2->tva_tx; // We use the vat rate on line of multiprice |
3450
|
|
- $outdefault_vat_code = $objp2->default_vat_code; // We use the vat code on line of multiprice |
|
3449
|
+ $outtva_tx = $objp2->tva_tx; // We use the vat rate on line of multiprice |
|
3450
|
+ $outdefault_vat_code = $objp2->default_vat_code; // We use the vat code on line of multiprice |
3451
|
3451
|
} else { |
3452
|
|
- $outtva_tx = $objp->tva_tx; // We use the vat rate of product, not the one on line of multiprice |
3453
|
|
- $outdefault_vat_code = $objp->default_vat_code; // We use the vat code or product, not the one on line of multiprice |
|
3452
|
+ $outtva_tx = $objp->tva_tx; // We use the vat rate of product, not the one on line of multiprice |
|
3453
|
+ $outdefault_vat_code = $objp->default_vat_code; // We use the vat code or product, not the one on line of multiprice |
3454
|
3454
|
} |
3455
|
3455
|
} |
3456
|
3456
|
} else { |
|
@@ -3464,13 +3464,13 @@ discard block |
|
|
block discarded – undo |
3464
|
3464
|
$outqty = $objp->quantity; |
3465
|
3465
|
$outdiscount = $objp->remise_percent; |
3466
|
3466
|
if ($objp->quantity == 1) { |
3467
|
|
- $labeltoshowprice .= ' - ' . price($objp->unitprice, 1, $langs, 0, 0, -1, $conf->currency) . "/"; |
3468
|
|
- $labeltoshowhtmlprice .= ' - ' . price($objp->unitprice, 0, $langs, 0, 0, -1, $conf->currency) . "/"; |
|
3467
|
+ $labeltoshowprice .= ' - '.price($objp->unitprice, 1, $langs, 0, 0, -1, $conf->currency)."/"; |
|
3468
|
+ $labeltoshowhtmlprice .= ' - '.price($objp->unitprice, 0, $langs, 0, 0, -1, $conf->currency)."/"; |
3469
|
3469
|
$labeltoshowprice .= $langs->trans("Unit"); // Do not use strtolower because it breaks utf8 encoding |
3470
|
3470
|
$labeltoshowhtmlprice .= $langs->transnoentities("Unit"); |
3471
|
3471
|
} else { |
3472
|
|
- $labeltoshowprice .= ' - ' . price($objp->price, 1, $langs, 0, 0, -1, $conf->currency) . "/" . $objp->quantity; |
3473
|
|
- $labeltoshowhtmlprice .= ' - ' . price($objp->price, 0, $langs, 0, 0, -1, $conf->currency) . "/" . $objp->quantity; |
|
3472
|
+ $labeltoshowprice .= ' - '.price($objp->price, 1, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity; |
|
3473
|
+ $labeltoshowhtmlprice .= ' - '.price($objp->price, 0, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity; |
3474
|
3474
|
$labeltoshowprice .= $langs->trans("Units"); // Do not use strtolower because it breaks utf8 encoding |
3475
|
3475
|
$labeltoshowhtmlprice .= $langs->transnoentities("Units"); |
3476
|
3476
|
} |
|
@@ -3478,16 +3478,16 @@ discard block |
|
|
block discarded – undo |
3478
|
3478
|
$outprice_ht = price($objp->unitprice); |
3479
|
3479
|
$outprice_ttc = price($objp->unitprice * (1 + ($objp->tva_tx / 100))); |
3480
|
3480
|
$outpricebasetype = $objp->price_base_type; |
3481
|
|
- $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 |
3482
|
|
- $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 |
|
3481
|
+ $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 |
|
3482
|
+ $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 |
3483
|
3483
|
} |
3484
|
3484
|
if (empty($hidepriceinlabel) && !empty($objp->quantity) && $objp->quantity >= 1) { |
3485
|
|
- $labeltoshowprice .= " (" . price($objp->unitprice, 1, $langs, 0, 0, -1, $conf->currency) . "/" . $langs->trans("Unit") . ")"; // Do not use strtolower because it breaks utf8 encoding |
3486
|
|
- $labeltoshowhtmlprice .= " (" . price($objp->unitprice, 0, $langs, 0, 0, -1, $conf->currency) . "/" . $langs->transnoentities("Unit") . ")"; // Do not use strtolower because it breaks utf8 encoding |
|
3485
|
+ $labeltoshowprice .= " (".price($objp->unitprice, 1, $langs, 0, 0, -1, $conf->currency)."/".$langs->trans("Unit").")"; // Do not use strtolower because it breaks utf8 encoding |
|
3486
|
+ $labeltoshowhtmlprice .= " (".price($objp->unitprice, 0, $langs, 0, 0, -1, $conf->currency)."/".$langs->transnoentities("Unit").")"; // Do not use strtolower because it breaks utf8 encoding |
3487
|
3487
|
} |
3488
|
3488
|
if (empty($hidepriceinlabel) && !empty($objp->remise_percent) && $objp->remise_percent >= 1) { |
3489
|
|
- $labeltoshowprice .= " - " . $langs->trans("Discount") . " : " . vatrate($objp->remise_percent) . ' %'; |
3490
|
|
- $labeltoshowhtmlprice .= " - " . $langs->transnoentities("Discount") . " : " . vatrate($objp->remise_percent) . ' %'; |
|
3489
|
+ $labeltoshowprice .= " - ".$langs->trans("Discount")." : ".vatrate($objp->remise_percent).' %'; |
|
3490
|
+ $labeltoshowhtmlprice .= " - ".$langs->transnoentities("Discount")." : ".vatrate($objp->remise_percent).' %'; |
3491
|
3491
|
} |
3492
|
3492
|
|
3493
|
3493
|
// Price by customer |
|
@@ -3496,11 +3496,11 @@ discard block |
|
|
block discarded – undo |
3496
|
3496
|
$found = 1; |
3497
|
3497
|
|
3498
|
3498
|
if ($objp->custprice_base_type == 'HT') { |
3499
|
|
- $labeltoshowprice .= ' - ' . price($objp->custprice, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("HT"); |
3500
|
|
- $labeltoshowhtmlprice .= ' - ' . price($objp->custprice, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("HT"); |
|
3499
|
+ $labeltoshowprice .= ' - '.price($objp->custprice, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("HT"); |
|
3500
|
+ $labeltoshowhtmlprice .= ' - '.price($objp->custprice, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("HT"); |
3501
|
3501
|
} else { |
3502
|
|
- $labeltoshowprice .= ' - ' . price($objp->custprice_ttc, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("TTC"); |
3503
|
|
- $labeltoshowhtmlprice .= ' - ' . price($objp->custprice_ttc, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("TTC"); |
|
3502
|
+ $labeltoshowprice .= ' - '.price($objp->custprice_ttc, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("TTC"); |
|
3503
|
+ $labeltoshowhtmlprice .= ' - '.price($objp->custprice_ttc, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("TTC"); |
3504
|
3504
|
} |
3505
|
3505
|
|
3506
|
3506
|
$outprice_ht = price($objp->custprice); |
|
@@ -3514,11 +3514,11 @@ discard block |
|
|
block discarded – undo |
3514
|
3514
|
// If level no defined or multiprice not found, we used the default price |
3515
|
3515
|
if (empty($hidepriceinlabel) && !$found) { |
3516
|
3516
|
if ($objp->price_base_type == 'HT') { |
3517
|
|
- $labeltoshowprice .= ' - ' . price($objp->price, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("HT"); |
3518
|
|
- $labeltoshowhtmlprice .= ' - ' . price($objp->price, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("HT"); |
|
3517
|
+ $labeltoshowprice .= ' - '.price($objp->price, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("HT"); |
|
3518
|
+ $labeltoshowhtmlprice .= ' - '.price($objp->price, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("HT"); |
3519
|
3519
|
} else { |
3520
|
|
- $labeltoshowprice .= ' - ' . price($objp->price_ttc, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("TTC"); |
3521
|
|
- $labeltoshowhtmlprice .= ' - ' . price($objp->price_ttc, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("TTC"); |
|
3520
|
+ $labeltoshowprice .= ' - '.price($objp->price_ttc, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("TTC"); |
|
3521
|
+ $labeltoshowhtmlprice .= ' - '.price($objp->price_ttc, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("TTC"); |
3522
|
3522
|
} |
3523
|
3523
|
$outprice_ht = price($objp->price); |
3524
|
3524
|
$outprice_ttc = price($objp->price_ttc); |
|
@@ -3529,14 +3529,14 @@ discard block |
|
|
block discarded – undo |
3529
|
3529
|
|
3530
|
3530
|
|
3531
|
3531
|
// Build options |
3532
|
|
- $opt = '<option value="' . $objp->rowid . '"'; |
|
3532
|
+ $opt = '<option value="'.$objp->rowid.'"'; |
3533
|
3533
|
$opt .= ($objp->rowid == $selected) ? ' selected' : ''; |
3534
|
3534
|
if (!empty($objp->price_by_qty_rowid) && $objp->price_by_qty_rowid > 0) { |
3535
|
|
- $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 . '"'; |
|
3535
|
+ $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.'"'; |
3536
|
3536
|
} |
3537
|
3537
|
if (getDolGlobalString('PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE')) { |
3538
|
|
- $opt .= ' data-labeltrans="' . $outlabel_translated . '"'; |
3539
|
|
- $opt .= ' data-desctrans="' . dol_escape_htmltag($outdesc_translated) . '"'; |
|
3538
|
+ $opt .= ' data-labeltrans="'.$outlabel_translated.'"'; |
|
3539
|
+ $opt .= ' data-desctrans="'.dol_escape_htmltag($outdesc_translated).'"'; |
3540
|
3540
|
} |
3541
|
3541
|
|
3542
|
3542
|
if ($stocktag == 1) { |
|
@@ -3631,7 +3631,7 @@ discard block |
|
|
block discarded – undo |
3631
|
3631
|
$selected_input_value = ''; |
3632
|
3632
|
if (!empty($conf->use_javascript_ajax) && getDolGlobalString('PRODUIT_USE_SEARCH_TO_SELECT')) { |
3633
|
3633
|
if ($selected > 0) { |
3634
|
|
- require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; |
|
3634
|
+ require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; |
3635
|
3635
|
$producttmpselect = new Product($this->db); |
3636
|
3636
|
$producttmpselect->fetch($selected); |
3637
|
3637
|
$selected_input_value = $producttmpselect->ref; |
|
@@ -3639,10 +3639,10 @@ discard block |
|
|
block discarded – undo |
3639
|
3639
|
} |
3640
|
3640
|
|
3641
|
3641
|
// mode=2 means suppliers products |
3642
|
|
- $urloption = ($socid > 0 ? 'socid=' . $socid . '&' : '') . 'htmlname=' . $htmlname . '&outjson=1&price_level=' . $price_level . '&type=' . $filtertype . '&mode=2&status=' . $status . '&finished=' . $finished . '&alsoproductwithnosupplierprice=' . $alsoproductwithnosupplierprice; |
3643
|
|
- print ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/product/ajax/products.php', $urloption, getDolGlobalString('PRODUIT_USE_SEARCH_TO_SELECT'), 0, $ajaxoptions); |
|
3642
|
+ $urloption = ($socid > 0 ? 'socid='.$socid.'&' : '').'htmlname='.$htmlname.'&outjson=1&price_level='.$price_level.'&type='.$filtertype.'&mode=2&status='.$status.'&finished='.$finished.'&alsoproductwithnosupplierprice='.$alsoproductwithnosupplierprice; |
|
3643
|
+ print ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/product/ajax/products.php', $urloption, getDolGlobalString('PRODUIT_USE_SEARCH_TO_SELECT'), 0, $ajaxoptions); |
3644
|
3644
|
|
3645
|
|
- print($hidelabel ? '' : $langs->trans("RefOrLabel") . ' : ') . '<input type="text" class="'.$morecss.'" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . ($placeholder ? ' placeholder="' . $placeholder . '"' : '') . '>'; |
|
3645
|
+ print($hidelabel ? '' : $langs->trans("RefOrLabel").' : ').'<input type="text" class="'.$morecss.'" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.($placeholder ? ' placeholder="'.$placeholder.'"' : '').'>'; |
3646
|
3646
|
} else { |
3647
|
3647
|
print $this->select_produits_fournisseurs_list($socid, $selected, $htmlname, $filtertype, $filtre, '', $status, 0, 0, $alsoproductwithnosupplierprice, $morecss, 0, $placeholder); |
3648
|
3648
|
} |
|
@@ -3702,25 +3702,25 @@ discard block |
|
|
block discarded – undo |
3702
|
3702
|
if (getDolGlobalInt('PRODUCT_USE_UNITS')) { |
3703
|
3703
|
$sql .= ", u.label as unit_long, u.short_label as unit_short, p.weight, p.weight_units, p.length, p.length_units, p.width, p.width_units, p.height, p.height_units, p.surface, p.surface_units, p.volume, p.volume_units"; |
3704
|
3704
|
} |
3705
|
|
- $sql .= " FROM " . $this->db->prefix() . "product as p"; |
3706
|
|
- $sql .= " LEFT JOIN " . $this->db->prefix() . "product_fournisseur_price as pfp ON ( p.rowid = pfp.fk_product AND pfp.entity IN (" . getEntity('product') . ") )"; |
|
3705
|
+ $sql .= " FROM ".$this->db->prefix()."product as p"; |
|
3706
|
+ $sql .= " LEFT JOIN ".$this->db->prefix()."product_fournisseur_price as pfp ON ( p.rowid = pfp.fk_product AND pfp.entity IN (".getEntity('product').") )"; |
3707
|
3707
|
if ($socid > 0) { |
3708
|
|
- $sql .= " AND pfp.fk_soc = " . ((int) $socid); |
|
3708
|
+ $sql .= " AND pfp.fk_soc = ".((int) $socid); |
3709
|
3709
|
} |
3710
|
|
- $sql .= " LEFT JOIN " . $this->db->prefix() . "societe as s ON pfp.fk_soc = s.rowid"; |
|
3710
|
+ $sql .= " LEFT JOIN ".$this->db->prefix()."societe as s ON pfp.fk_soc = s.rowid"; |
3711
|
3711
|
// Units |
3712
|
3712
|
if (getDolGlobalInt('PRODUCT_USE_UNITS')) { |
3713
|
|
- $sql .= " LEFT JOIN " . $this->db->prefix() . "c_units u ON u.rowid = p.fk_unit"; |
|
3713
|
+ $sql .= " LEFT JOIN ".$this->db->prefix()."c_units u ON u.rowid = p.fk_unit"; |
3714
|
3714
|
} |
3715
|
|
- $sql .= " WHERE p.entity IN (" . getEntity('product') . ")"; |
|
3715
|
+ $sql .= " WHERE p.entity IN (".getEntity('product').")"; |
3716
|
3716
|
if ($statut != -1) { |
3717
|
|
- $sql .= " AND p.tobuy = " . ((int) $statut); |
|
3717
|
+ $sql .= " AND p.tobuy = ".((int) $statut); |
3718
|
3718
|
} |
3719
|
3719
|
if (strval($filtertype) != '') { |
3720
|
|
- $sql .= " AND p.fk_product_type = " . ((int) $filtertype); |
|
3720
|
+ $sql .= " AND p.fk_product_type = ".((int) $filtertype); |
3721
|
3721
|
} |
3722
|
3722
|
if (!empty($filtre)) { |
3723
|
|
- $sql .= " " . $filtre; |
|
3723
|
+ $sql .= " ".$filtre; |
3724
|
3724
|
} |
3725
|
3725
|
// Add where from hooks |
3726
|
3726
|
$parameters = array(); |
|
@@ -3740,9 +3740,9 @@ discard block |
|
|
block discarded – undo |
3740
|
3740
|
if ($i > 0) { |
3741
|
3741
|
$sql .= " AND "; |
3742
|
3742
|
} |
3743
|
|
- $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) . "%'"; |
|
3743
|
+ $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)."%'"; |
3744
|
3744
|
if (getDolGlobalString('PRODUIT_FOURN_TEXTS')) { |
3745
|
|
- $sql .= " OR pfp.desc_fourn LIKE '" . $this->db->escape($prefix . $crit) . "%'"; |
|
3745
|
+ $sql .= " OR pfp.desc_fourn LIKE '".$this->db->escape($prefix.$crit)."%'"; |
3746
|
3746
|
} |
3747
|
3747
|
$sql .= ")"; |
3748
|
3748
|
$i++; |
|
@@ -3751,8 +3751,8 @@ discard block |
|
|
block discarded – undo |
3751
|
3751
|
$sql .= ")"; |
3752
|
3752
|
} |
3753
|
3753
|
if (isModEnabled('barcode')) { |
3754
|
|
- $sql .= " OR p.barcode LIKE '" . $this->db->escape($prefix . $filterkey) . "%'"; |
3755
|
|
- $sql .= " OR pfp.barcode LIKE '" . $this->db->escape($prefix . $filterkey) . "%'"; |
|
3754
|
+ $sql .= " OR p.barcode LIKE '".$this->db->escape($prefix.$filterkey)."%'"; |
|
3755
|
+ $sql .= " OR pfp.barcode LIKE '".$this->db->escape($prefix.$filterkey)."%'"; |
3756
|
3756
|
} |
3757
|
3757
|
$sql .= ')'; |
3758
|
3758
|
} |
|
@@ -3761,20 +3761,20 @@ discard block |
|
|
block discarded – undo |
3761
|
3761
|
|
3762
|
3762
|
// Build output string |
3763
|
3763
|
|
3764
|
|
- dol_syslog(get_class($this) . "::select_produits_fournisseurs_list", LOG_DEBUG); |
|
3764
|
+ dol_syslog(get_class($this)."::select_produits_fournisseurs_list", LOG_DEBUG); |
3765
|
3765
|
$result = $this->db->query($sql); |
3766
|
3766
|
if ($result) { |
3767
|
|
- require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php'; |
3768
|
|
- require_once DOL_DOCUMENT_ROOT . '/core/lib/product.lib.php'; |
|
3767
|
+ require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php'; |
|
3768
|
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php'; |
3769
|
3769
|
|
3770
|
3770
|
$num = $this->db->num_rows($result); |
3771
|
3771
|
|
3772
|
3772
|
//$out.='<select class="flat" id="select'.$htmlname.'" name="'.$htmlname.'">'; // remove select to have id same with combo and ajax |
3773
|
|
- $out .= '<select class="flat ' . ($morecss ? ' ' . $morecss : '') . '" id="' . $htmlname . '" name="' . $htmlname . '">'; |
|
3773
|
+ $out .= '<select class="flat '.($morecss ? ' '.$morecss : '').'" id="'.$htmlname.'" name="'.$htmlname.'">'; |
3774
|
3774
|
if (!$selected) { |
3775
|
|
- $out .= '<option value="-1" selected>' . ($placeholder ? $placeholder : ' ') . '</option>'; |
|
3775
|
+ $out .= '<option value="-1" selected>'.($placeholder ? $placeholder : ' ').'</option>'; |
3776
|
3776
|
} else { |
3777
|
|
- $out .= '<option value="-1">' . ($placeholder ? $placeholder : ' ') . '</option>'; |
|
3777
|
+ $out .= '<option value="-1">'.($placeholder ? $placeholder : ' ').'</option>'; |
3778
|
3778
|
} |
3779
|
3779
|
|
3780
|
3780
|
$i = 0; |
|
@@ -3789,7 +3789,7 @@ discard block |
|
|
block discarded – undo |
3789
|
3789
|
|
3790
|
3790
|
$outkey = $objp->idprodfournprice; // id in table of price |
3791
|
3791
|
if (!$outkey && $alsoproductwithnosupplierprice) { |
3792
|
|
- $outkey = 'idprod_' . $objp->rowid; // id of product |
|
3792
|
+ $outkey = 'idprod_'.$objp->rowid; // id of product |
3793
|
3793
|
} |
3794
|
3794
|
|
3795
|
3795
|
$outref = $objp->ref; |
|
@@ -3804,23 +3804,23 @@ discard block |
|
|
block discarded – undo |
3804
|
3804
|
$outvalUnits = ''; |
3805
|
3805
|
if (getDolGlobalInt('PRODUCT_USE_UNITS')) { |
3806
|
3806
|
if (!empty($objp->unit_short)) { |
3807
|
|
- $outvalUnits .= ' - ' . $objp->unit_short; |
|
3807
|
+ $outvalUnits .= ' - '.$objp->unit_short; |
3808
|
3808
|
} |
3809
|
3809
|
if (!empty($objp->weight) && $objp->weight_units !== null) { |
3810
|
3810
|
$unitToShow = showDimensionInBestUnit($objp->weight, $objp->weight_units, 'weight', $langs); |
3811
|
|
- $outvalUnits .= ' - ' . $unitToShow; |
|
3811
|
+ $outvalUnits .= ' - '.$unitToShow; |
3812
|
3812
|
} |
3813
|
3813
|
if ((!empty($objp->length) || !empty($objp->width) || !empty($objp->height)) && $objp->length_units !== null) { |
3814
|
|
- $unitToShow = $objp->length . ' x ' . $objp->width . ' x ' . $objp->height . ' ' . measuringUnitString(0, 'size', $objp->length_units); |
3815
|
|
- $outvalUnits .= ' - ' . $unitToShow; |
|
3814
|
+ $unitToShow = $objp->length.' x '.$objp->width.' x '.$objp->height.' '.measuringUnitString(0, 'size', $objp->length_units); |
|
3815
|
+ $outvalUnits .= ' - '.$unitToShow; |
3816
|
3816
|
} |
3817
|
3817
|
if (!empty($objp->surface) && $objp->surface_units !== null) { |
3818
|
3818
|
$unitToShow = showDimensionInBestUnit($objp->surface, $objp->surface_units, 'surface', $langs); |
3819
|
|
- $outvalUnits .= ' - ' . $unitToShow; |
|
3819
|
+ $outvalUnits .= ' - '.$unitToShow; |
3820
|
3820
|
} |
3821
|
3821
|
if (!empty($objp->volume) && $objp->volume_units !== null) { |
3822
|
3822
|
$unitToShow = showDimensionInBestUnit($objp->volume, $objp->volume_units, 'volume', $langs); |
3823
|
|
- $outvalUnits .= ' - ' . $unitToShow; |
|
3823
|
+ $outvalUnits .= ' - '.$unitToShow; |
3824
|
3824
|
} |
3825
|
3825
|
if ($outdurationvalue && $outdurationunit) { |
3826
|
3826
|
$da = array( |
|
@@ -3831,22 +3831,22 @@ discard block |
|
|
block discarded – undo |
3831
|
3831
|
'y' => $langs->trans('Year') |
3832
|
3832
|
); |
3833
|
3833
|
if (isset($da[$outdurationunit])) { |
3834
|
|
- $outvalUnits .= ' - ' . $outdurationvalue . ' ' . $langs->transnoentities($da[$outdurationunit] . ($outdurationvalue > 1 ? 's' : '')); |
|
3834
|
+ $outvalUnits .= ' - '.$outdurationvalue.' '.$langs->transnoentities($da[$outdurationunit].($outdurationvalue > 1 ? 's' : '')); |
3835
|
3835
|
} |
3836
|
3836
|
} |
3837
|
3837
|
} |
3838
|
3838
|
|
3839
|
3839
|
$objRef = $objp->ref; |
3840
|
3840
|
if ($filterkey && $filterkey != '') { |
3841
|
|
- $objRef = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $objRef, 1); |
|
3841
|
+ $objRef = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $objRef, 1); |
3842
|
3842
|
} |
3843
|
3843
|
$objRefFourn = $objp->ref_fourn; |
3844
|
3844
|
if ($filterkey && $filterkey != '') { |
3845
|
|
- $objRefFourn = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $objRefFourn, 1); |
|
3845
|
+ $objRefFourn = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $objRefFourn, 1); |
3846
|
3846
|
} |
3847
|
3847
|
$label = $objp->label; |
3848
|
3848
|
if ($filterkey && $filterkey != '') { |
3849
|
|
- $label = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $label, 1); |
|
3849
|
+ $label = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $label, 1); |
3850
|
3850
|
} |
3851
|
3851
|
|
3852
|
3852
|
switch ($objp->fk_product_type) { |
|
@@ -3869,21 +3869,21 @@ discard block |
|
|
block discarded – undo |
3869
|
3869
|
|
3870
|
3870
|
$optlabel .= $objp->ref; |
3871
|
3871
|
if (!empty($objp->idprodfournprice) && ($objp->ref != $objp->ref_fourn)) { |
3872
|
|
- $optlabel .= ' <span class="opacitymedium">(' . $objp->ref_fourn . ')</span>'; |
|
3872
|
+ $optlabel .= ' <span class="opacitymedium">('.$objp->ref_fourn.')</span>'; |
3873
|
3873
|
} |
3874
|
3874
|
if (isModEnabled('barcode') && !empty($objp->barcode)) { |
3875
|
|
- $optlabel .= ' (' . $outbarcode . ')'; |
|
3875
|
+ $optlabel .= ' ('.$outbarcode.')'; |
3876
|
3876
|
} |
3877
|
|
- $optlabel .= ' - ' . dol_trunc($label, $maxlengtharticle); |
|
3877
|
+ $optlabel .= ' - '.dol_trunc($label, $maxlengtharticle); |
3878
|
3878
|
|
3879
|
3879
|
$outvallabel = $objRef; |
3880
|
3880
|
if (!empty($objp->idprodfournprice) && ($objp->ref != $objp->ref_fourn)) { |
3881
|
|
- $outvallabel .= ' (' . $objRefFourn . ')'; |
|
3881
|
+ $outvallabel .= ' ('.$objRefFourn.')'; |
3882
|
3882
|
} |
3883
|
3883
|
if (isModEnabled('barcode') && !empty($objp->barcode)) { |
3884
|
|
- $outvallabel .= ' (' . $outbarcode . ')'; |
|
3884
|
+ $outvallabel .= ' ('.$outbarcode.')'; |
3885
|
3885
|
} |
3886
|
|
- $outvallabel .= ' - ' . dol_trunc($label, $maxlengtharticle); |
|
3886
|
+ $outvallabel .= ' - '.dol_trunc($label, $maxlengtharticle); |
3887
|
3887
|
|
3888
|
3888
|
// Units |
3889
|
3889
|
$optlabel .= $outvalUnits; |
|
@@ -3900,7 +3900,7 @@ discard block |
|
|
block discarded – undo |
3900
|
3900
|
$prod_supplier->fourn_tva_tx = $objp->tva_tx; |
3901
|
3901
|
$prod_supplier->fk_supplier_price_expression = $objp->fk_supplier_price_expression; |
3902
|
3902
|
|
3903
|
|
- require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php'; |
|
3903
|
+ require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php'; |
3904
|
3904
|
$priceparser = new PriceParser($this->db); |
3905
|
3905
|
$price_result = $priceparser->parseProductSupplier($prod_supplier); |
3906
|
3906
|
if ($price_result >= 0) { |
|
@@ -3911,57 +3911,57 @@ discard block |
|
|
block discarded – undo |
3911
|
3911
|
} |
3912
|
3912
|
} |
3913
|
3913
|
if ($objp->quantity == 1) { |
3914
|
|
- $optlabel .= ' - ' . price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency) . "/"; |
3915
|
|
- $outvallabel .= ' - ' . price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 0, $langs, 0, 0, -1, $conf->currency) . "/"; |
|
3914
|
+ $optlabel .= ' - '.price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency)."/"; |
|
3915
|
+ $outvallabel .= ' - '.price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 0, $langs, 0, 0, -1, $conf->currency)."/"; |
3916
|
3916
|
$optlabel .= $langs->trans("Unit"); // Do not use strtolower because it breaks utf8 encoding |
3917
|
3917
|
$outvallabel .= $langs->transnoentities("Unit"); |
3918
|
3918
|
} else { |
3919
|
|
- $optlabel .= ' - ' . price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency) . "/" . $objp->quantity; |
3920
|
|
- $outvallabel .= ' - ' . price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 0, $langs, 0, 0, -1, $conf->currency) . "/" . $objp->quantity; |
3921
|
|
- $optlabel .= ' ' . $langs->trans("Units"); // Do not use strtolower because it breaks utf8 encoding |
3922
|
|
- $outvallabel .= ' ' . $langs->transnoentities("Units"); |
|
3919
|
+ $optlabel .= ' - '.price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity; |
|
3920
|
+ $outvallabel .= ' - '.price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 0, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity; |
|
3921
|
+ $optlabel .= ' '.$langs->trans("Units"); // Do not use strtolower because it breaks utf8 encoding |
|
3922
|
+ $outvallabel .= ' '.$langs->transnoentities("Units"); |
3923
|
3923
|
} |
3924
|
3924
|
|
3925
|
3925
|
if ($objp->quantity > 1) { |
3926
|
|
- $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 |
3927
|
|
- $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 |
|
3926
|
+ $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 |
|
3927
|
+ $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 |
3928
|
3928
|
} |
3929
|
3929
|
if ($objp->remise_percent >= 1) { |
3930
|
|
- $optlabel .= " - " . $langs->trans("Discount") . " : " . vatrate($objp->remise_percent) . ' %'; |
3931
|
|
- $outvallabel .= " - " . $langs->transnoentities("Discount") . " : " . vatrate($objp->remise_percent) . ' %'; |
|
3930
|
+ $optlabel .= " - ".$langs->trans("Discount")." : ".vatrate($objp->remise_percent).' %'; |
|
3931
|
+ $outvallabel .= " - ".$langs->transnoentities("Discount")." : ".vatrate($objp->remise_percent).' %'; |
3932
|
3932
|
} |
3933
|
3933
|
if ($objp->duration) { |
3934
|
|
- $optlabel .= " - " . $objp->duration; |
3935
|
|
- $outvallabel .= " - " . $objp->duration; |
|
3934
|
+ $optlabel .= " - ".$objp->duration; |
|
3935
|
+ $outvallabel .= " - ".$objp->duration; |
3936
|
3936
|
} |
3937
|
3937
|
if (!$socid) { |
3938
|
|
- $optlabel .= " - " . dol_trunc($objp->name, 8); |
3939
|
|
- $outvallabel .= " - " . dol_trunc($objp->name, 8); |
|
3938
|
+ $optlabel .= " - ".dol_trunc($objp->name, 8); |
|
3939
|
+ $outvallabel .= " - ".dol_trunc($objp->name, 8); |
3940
|
3940
|
} |
3941
|
3941
|
if ($objp->supplier_reputation) { |
3942
|
3942
|
//TODO dictionary |
3943
|
3943
|
$reputations = array('' => $langs->trans('Standard'), 'FAVORITE' => $langs->trans('Favorite'), 'NOTTHGOOD' => $langs->trans('NotTheGoodQualitySupplier'), 'DONOTORDER' => $langs->trans('DoNotOrderThisProductToThisSupplier')); |
3944
|
3944
|
|
3945
|
|
- $optlabel .= " - " . $reputations[$objp->supplier_reputation]; |
3946
|
|
- $outvallabel .= " - " . $reputations[$objp->supplier_reputation]; |
|
3945
|
+ $optlabel .= " - ".$reputations[$objp->supplier_reputation]; |
|
3946
|
+ $outvallabel .= " - ".$reputations[$objp->supplier_reputation]; |
3947
|
3947
|
} |
3948
|
3948
|
} else { |
3949
|
|
- $optlabel .= " - <span class='opacitymedium'>" . $langs->trans("NoPriceDefinedForThisSupplier") . '</span>'; |
3950
|
|
- $outvallabel .= ' - ' . $langs->transnoentities("NoPriceDefinedForThisSupplier"); |
|
3949
|
+ $optlabel .= " - <span class='opacitymedium'>".$langs->trans("NoPriceDefinedForThisSupplier").'</span>'; |
|
3950
|
+ $outvallabel .= ' - '.$langs->transnoentities("NoPriceDefinedForThisSupplier"); |
3951
|
3951
|
} |
3952
|
3952
|
|
3953
|
3953
|
if (isModEnabled('stock') && $showstockinlist && isset($objp->stock) && ($objp->fk_product_type == Product::TYPE_PRODUCT || getDolGlobalString('STOCK_SUPPORTS_SERVICES'))) { |
3954
|
3954
|
$novirtualstock = ($showstockinlist == 2); |
3955
|
3955
|
|
3956
|
3956
|
if ($user->hasRight('stock', 'lire')) { |
3957
|
|
- $outvallabel .= ' - ' . $langs->trans("Stock") . ': ' . price(price2num($objp->stock, 'MS')); |
|
3957
|
+ $outvallabel .= ' - '.$langs->trans("Stock").': '.price(price2num($objp->stock, 'MS')); |
3958
|
3958
|
|
3959
|
3959
|
if ($objp->stock > 0) { |
3960
|
3960
|
$optlabel .= ' - <span class="product_line_stock_ok">'; |
3961
|
3961
|
} elseif ($objp->stock <= 0) { |
3962
|
3962
|
$optlabel .= ' - <span class="product_line_stock_too_low">'; |
3963
|
3963
|
} |
3964
|
|
- $optlabel .= $langs->transnoentities("Stock") . ':' . price(price2num($objp->stock, 'MS')); |
|
3964
|
+ $optlabel .= $langs->transnoentities("Stock").':'.price(price2num($objp->stock, 'MS')); |
3965
|
3965
|
$optlabel .= '</span>'; |
3966
|
3966
|
if (empty($novirtualstock) && getDolGlobalString('STOCK_SHOW_VIRTUAL_STOCK_IN_PRODUCTS_COMBO')) { // Warning, this option may slow down combo list generation |
3967
|
3967
|
$langs->load("stocks"); |
|
@@ -3971,9 +3971,9 @@ discard block |
|
|
block discarded – undo |
3971
|
3971
|
$tmpproduct->load_virtual_stock(); |
3972
|
3972
|
$virtualstock = $tmpproduct->stock_theorique; |
3973
|
3973
|
|
3974
|
|
- $outvallabel .= ' - ' . $langs->trans("VirtualStock") . ':' . $virtualstock; |
|
3974
|
+ $outvallabel .= ' - '.$langs->trans("VirtualStock").':'.$virtualstock; |
3975
|
3975
|
|
3976
|
|
- $optlabel .= ' - ' . $langs->transnoentities("VirtualStock") . ':'; |
|
3976
|
+ $optlabel .= ' - '.$langs->transnoentities("VirtualStock").':'; |
3977
|
3977
|
if ($virtualstock > 0) { |
3978
|
3978
|
$optlabel .= '<span class="product_line_stock_ok">'; |
3979
|
3979
|
} elseif ($virtualstock <= 0) { |
|
@@ -3987,7 +3987,7 @@ discard block |
|
|
block discarded – undo |
3987
|
3987
|
} |
3988
|
3988
|
} |
3989
|
3989
|
|
3990
|
|
- $optstart = '<option value="' . $outkey . '"'; |
|
3990
|
+ $optstart = '<option value="'.$outkey.'"'; |
3991
|
3991
|
if ($selected && $selected == $objp->idprodfournprice) { |
3992
|
3992
|
$optstart .= ' selected'; |
3993
|
3993
|
} |
|
@@ -3996,31 +3996,31 @@ discard block |
|
|
block discarded – undo |
3996
|
3996
|
} |
3997
|
3997
|
|
3998
|
3998
|
if (!empty($objp->idprodfournprice) && $objp->idprodfournprice > 0) { |
3999
|
|
- $optstart .= ' data-product-id="' . dol_escape_htmltag($objp->rowid) . '"'; |
4000
|
|
- $optstart .= ' data-price-id="' . dol_escape_htmltag($objp->idprodfournprice) . '"'; |
4001
|
|
- $optstart .= ' data-qty="' . dol_escape_htmltag($objp->quantity) . '"'; |
4002
|
|
- $optstart .= ' data-up="' . dol_escape_htmltag(price2num($objp->unitprice)) . '"'; |
4003
|
|
- $optstart .= ' data-up-locale="' . dol_escape_htmltag(price($objp->unitprice)) . '"'; |
4004
|
|
- $optstart .= ' data-discount="' . dol_escape_htmltag($outdiscount) . '"'; |
4005
|
|
- $optstart .= ' data-tvatx="' . dol_escape_htmltag(price2num($objp->tva_tx)) . '"'; |
4006
|
|
- $optstart .= ' data-tvatx-formated="' . dol_escape_htmltag(price($objp->tva_tx, 0, $langs, 1, -1, 2)) . '"'; |
4007
|
|
- $optstart .= ' data-default-vat-code="' . dol_escape_htmltag($objp->default_vat_code) . '"'; |
4008
|
|
- $optstart .= ' data-supplier-ref="' . dol_escape_htmltag($objp->ref_fourn) . '"'; |
|
3999
|
+ $optstart .= ' data-product-id="'.dol_escape_htmltag($objp->rowid).'"'; |
|
4000
|
+ $optstart .= ' data-price-id="'.dol_escape_htmltag($objp->idprodfournprice).'"'; |
|
4001
|
+ $optstart .= ' data-qty="'.dol_escape_htmltag($objp->quantity).'"'; |
|
4002
|
+ $optstart .= ' data-up="'.dol_escape_htmltag(price2num($objp->unitprice)).'"'; |
|
4003
|
+ $optstart .= ' data-up-locale="'.dol_escape_htmltag(price($objp->unitprice)).'"'; |
|
4004
|
+ $optstart .= ' data-discount="'.dol_escape_htmltag($outdiscount).'"'; |
|
4005
|
+ $optstart .= ' data-tvatx="'.dol_escape_htmltag(price2num($objp->tva_tx)).'"'; |
|
4006
|
+ $optstart .= ' data-tvatx-formated="'.dol_escape_htmltag(price($objp->tva_tx, 0, $langs, 1, -1, 2)).'"'; |
|
4007
|
+ $optstart .= ' data-default-vat-code="'.dol_escape_htmltag($objp->default_vat_code).'"'; |
|
4008
|
+ $optstart .= ' data-supplier-ref="'.dol_escape_htmltag($objp->ref_fourn).'"'; |
4009
|
4009
|
if (isModEnabled('multicurrency')) { |
4010
|
|
- $optstart .= ' data-multicurrency-code="' . dol_escape_htmltag($objp->multicurrency_code) . '"'; |
4011
|
|
- $optstart .= ' data-multicurrency-up="' . dol_escape_htmltag($objp->multicurrency_unitprice) . '"'; |
|
4010
|
+ $optstart .= ' data-multicurrency-code="'.dol_escape_htmltag($objp->multicurrency_code).'"'; |
|
4011
|
+ $optstart .= ' data-multicurrency-up="'.dol_escape_htmltag($objp->multicurrency_unitprice).'"'; |
4012
|
4012
|
} |
4013
|
4013
|
} |
4014
|
|
- $optstart .= ' data-description="' . dol_escape_htmltag($objp->description, 0, 1) . '"'; |
|
4014
|
+ $optstart .= ' data-description="'.dol_escape_htmltag($objp->description, 0, 1).'"'; |
4015
|
4015
|
|
4016
|
4016
|
$outarrayentry = array( |
4017
|
4017
|
'key' => $outkey, |
4018
|
4018
|
'value' => $outref, |
4019
|
4019
|
'label' => $outvallabel, |
4020
|
4020
|
'qty' => $outqty, |
4021
|
|
- 'price_qty_ht' => price2num($objp->fprice, 'MU'), // Keep higher resolution for price for the min qty |
4022
|
|
- 'price_unit_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price |
4023
|
|
- 'price_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price (for compatibility) |
|
4021
|
+ 'price_qty_ht' => price2num($objp->fprice, 'MU'), // Keep higher resolution for price for the min qty |
|
4022
|
+ 'price_unit_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price |
|
4023
|
+ 'price_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price (for compatibility) |
4024
|
4024
|
'tva_tx_formated' => price($objp->tva_tx, 0, $langs, 1, -1, 2), |
4025
|
4025
|
'tva_tx' => price2num($objp->tva_tx), |
4026
|
4026
|
'default_vat_code' => $objp->default_vat_code, |
|
@@ -4050,17 +4050,17 @@ discard block |
|
|
block discarded – undo |
4050
|
4050
|
// Add new entry |
4051
|
4051
|
// "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 |
4052
|
4052
|
// "label" value of json key array is used by jQuery automatically as text for combo box |
4053
|
|
- $out .= $optstart . ' data-html="' . dol_escape_htmltag($optlabel) . '">' . $optlabel . "</option>\n"; |
|
4053
|
+ $out .= $optstart.' data-html="'.dol_escape_htmltag($optlabel).'">'.$optlabel."</option>\n"; |
4054
|
4054
|
$outarraypush = array( |
4055
|
4055
|
'key' => $outkey, |
4056
|
4056
|
'value' => $outref, |
4057
|
4057
|
'label' => $outvallabel, |
4058
|
4058
|
'qty' => $outqty, |
4059
|
|
- 'price_qty_ht' => price2num($objp->fprice, 'MU'), // Keep higher resolution for price for the min qty |
|
4059
|
+ 'price_qty_ht' => price2num($objp->fprice, 'MU'), // Keep higher resolution for price for the min qty |
4060
|
4060
|
'price_qty_ht_locale' => price($objp->fprice), |
4061
|
|
- 'price_unit_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price |
|
4061
|
+ 'price_unit_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price |
4062
|
4062
|
'price_unit_ht_locale' => price($objp->unitprice), |
4063
|
|
- 'price_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price (for compatibility) |
|
4063
|
+ 'price_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price (for compatibility) |
4064
|
4064
|
'tva_tx_formated' => price($objp->tva_tx), |
4065
|
4065
|
'tva_tx' => price2num($objp->tva_tx), |
4066
|
4066
|
'default_vat_code' => $objp->default_vat_code, |
|
@@ -4093,7 +4093,7 @@ discard block |
|
|
block discarded – undo |
4093
|
4093
|
|
4094
|
4094
|
$this->db->free($result); |
4095
|
4095
|
|
4096
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
4096
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
4097
|
4097
|
$out .= ajax_combobox($htmlname); |
4098
|
4098
|
} else { |
4099
|
4099
|
dol_print_error($this->db); |
|
@@ -4125,43 +4125,43 @@ discard block |
|
|
block discarded – undo |
4125
|
4125
|
$sql = "SELECT p.rowid, p.ref, p.label, p.price, p.duration, pfp.fk_soc,"; |
4126
|
4126
|
$sql .= " pfp.ref_fourn, pfp.rowid as idprodfournprice, pfp.price as fprice, pfp.remise_percent, pfp.quantity, pfp.unitprice,"; |
4127
|
4127
|
$sql .= " pfp.fk_supplier_price_expression, pfp.fk_product, pfp.tva_tx, s.nom as name"; |
4128
|
|
- $sql .= " FROM " . $this->db->prefix() . "product as p"; |
4129
|
|
- $sql .= " LEFT JOIN " . $this->db->prefix() . "product_fournisseur_price as pfp ON p.rowid = pfp.fk_product"; |
4130
|
|
- $sql .= " LEFT JOIN " . $this->db->prefix() . "societe as s ON pfp.fk_soc = s.rowid"; |
4131
|
|
- $sql .= " WHERE pfp.entity IN (" . getEntity('productsupplierprice') . ")"; |
|
4128
|
+ $sql .= " FROM ".$this->db->prefix()."product as p"; |
|
4129
|
+ $sql .= " LEFT JOIN ".$this->db->prefix()."product_fournisseur_price as pfp ON p.rowid = pfp.fk_product"; |
|
4130
|
+ $sql .= " LEFT JOIN ".$this->db->prefix()."societe as s ON pfp.fk_soc = s.rowid"; |
|
4131
|
+ $sql .= " WHERE pfp.entity IN (".getEntity('productsupplierprice').")"; |
4132
|
4132
|
$sql .= " AND p.tobuy = 1"; |
4133
|
4133
|
$sql .= " AND s.fournisseur = 1"; |
4134
|
|
- $sql .= " AND p.rowid = " . ((int) $productid); |
|
4134
|
+ $sql .= " AND p.rowid = ".((int) $productid); |
4135
|
4135
|
if (!getDolGlobalString('PRODUCT_BEST_SUPPLIER_PRICE_PRESELECTED')) { |
4136
|
4136
|
$sql .= " ORDER BY s.nom, pfp.ref_fourn DESC"; |
4137
|
4137
|
} else { |
4138
|
4138
|
$sql .= " ORDER BY pfp.unitprice ASC"; |
4139
|
4139
|
} |
4140
|
4140
|
|
4141
|
|
- dol_syslog(get_class($this) . "::select_product_fourn_price", LOG_DEBUG); |
|
4141
|
+ dol_syslog(get_class($this)."::select_product_fourn_price", LOG_DEBUG); |
4142
|
4142
|
$result = $this->db->query($sql); |
4143
|
4143
|
|
4144
|
4144
|
if ($result) { |
4145
|
4145
|
$num = $this->db->num_rows($result); |
4146
|
4146
|
|
4147
|
|
- $form = '<select class="flat" id="select_' . $htmlname . '" name="' . $htmlname . '">'; |
|
4147
|
+ $form = '<select class="flat" id="select_'.$htmlname.'" name="'.$htmlname.'">'; |
4148
|
4148
|
|
4149
|
4149
|
if (!$num) { |
4150
|
|
- $form .= '<option value="0">-- ' . $langs->trans("NoSupplierPriceDefinedForThisProduct") . ' --</option>'; |
|
4150
|
+ $form .= '<option value="0">-- '.$langs->trans("NoSupplierPriceDefinedForThisProduct").' --</option>'; |
4151
|
4151
|
} else { |
4152
|
|
- require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php'; |
|
4152
|
+ require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php'; |
4153
|
4153
|
$form .= '<option value="0"> </option>'; |
4154
|
4154
|
|
4155
|
4155
|
$i = 0; |
4156
|
4156
|
while ($i < $num) { |
4157
|
4157
|
$objp = $this->db->fetch_object($result); |
4158
|
4158
|
|
4159
|
|
- $opt = '<option value="' . $objp->idprodfournprice . '"'; |
|
4159
|
+ $opt = '<option value="'.$objp->idprodfournprice.'"'; |
4160
|
4160
|
//if there is only one supplier, preselect it |
4161
|
4161
|
if ($num == 1 || ($selected_supplier > 0 && $objp->fk_soc == $selected_supplier) || ($i == 0 && getDolGlobalString('PRODUCT_BEST_SUPPLIER_PRICE_PRESELECTED'))) { |
4162
|
4162
|
$opt .= ' selected'; |
4163
|
4163
|
} |
4164
|
|
- $opt .= '>' . $objp->name . ' - ' . $objp->ref_fourn . ' - '; |
|
4164
|
+ $opt .= '>'.$objp->name.' - '.$objp->ref_fourn.' - '; |
4165
|
4165
|
|
4166
|
4166
|
if (isModEnabled('dynamicprices') && !empty($objp->fk_supplier_price_expression)) { |
4167
|
4167
|
$prod_supplier = new ProductFournisseur($this->db); |
|
@@ -4171,7 +4171,7 @@ discard block |
|
|
block discarded – undo |
4171
|
4171
|
$prod_supplier->fourn_tva_tx = $objp->tva_tx; |
4172
|
4172
|
$prod_supplier->fk_supplier_price_expression = $objp->fk_supplier_price_expression; |
4173
|
4173
|
|
4174
|
|
- require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php'; |
|
4174
|
+ require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php'; |
4175
|
4175
|
$priceparser = new PriceParser($this->db); |
4176
|
4176
|
$price_result = $priceparser->parseProductSupplier($prod_supplier); |
4177
|
4177
|
if ($price_result >= 0) { |
|
@@ -4182,10 +4182,10 @@ discard block |
|
|
block discarded – undo |
4182
|
4182
|
} |
4183
|
4183
|
} |
4184
|
4184
|
if ($objp->quantity == 1) { |
4185
|
|
- $opt .= price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency) . "/"; |
|
4185
|
+ $opt .= price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency)."/"; |
4186
|
4186
|
} |
4187
|
4187
|
|
4188
|
|
- $opt .= $objp->quantity . ' '; |
|
4188
|
+ $opt .= $objp->quantity.' '; |
4189
|
4189
|
|
4190
|
4190
|
if ($objp->quantity == 1) { |
4191
|
4191
|
$opt .= $langs->trans("Unit"); |
|
@@ -4194,10 +4194,10 @@ discard block |
|
|
block discarded – undo |
4194
|
4194
|
} |
4195
|
4195
|
if ($objp->quantity > 1) { |
4196
|
4196
|
$opt .= " - "; |
4197
|
|
- $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"); |
|
4197
|
+ $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"); |
4198
|
4198
|
} |
4199
|
4199
|
if ($objp->duration) { |
4200
|
|
- $opt .= " - " . $objp->duration; |
|
4200
|
+ $opt .= " - ".$objp->duration; |
4201
|
4201
|
} |
4202
|
4202
|
$opt .= "</option>\n"; |
4203
|
4203
|
|
|
@@ -4235,8 +4235,8 @@ discard block |
|
|
block discarded – undo |
4235
|
4235
|
dol_syslog(__METHOD__, LOG_DEBUG); |
4236
|
4236
|
|
4237
|
4237
|
$sql = "SELECT rowid, code, libelle as label, deposit_percent"; |
4238
|
|
- $sql .= " FROM " . $this->db->prefix() . 'c_payment_term'; |
4239
|
|
- $sql .= " WHERE entity IN (" . getEntity('c_payment_term') . ")"; |
|
4238
|
+ $sql .= " FROM ".$this->db->prefix().'c_payment_term'; |
|
4239
|
+ $sql .= " WHERE entity IN (".getEntity('c_payment_term').")"; |
4240
|
4240
|
$sql .= " AND active > 0"; |
4241
|
4241
|
$sql .= " ORDER BY sortorder"; |
4242
|
4242
|
|
|
@@ -4248,7 +4248,7 @@ discard block |
|
|
block discarded – undo |
4248
|
4248
|
$obj = $this->db->fetch_object($resql); |
4249
|
4249
|
|
4250
|
4250
|
// Si traduction existe, on l'utilise, sinon on prend le libelle par default |
4251
|
|
- $label = ($langs->trans("PaymentConditionShort" . $obj->code) != "PaymentConditionShort" . $obj->code ? $langs->trans("PaymentConditionShort" . $obj->code) : ($obj->label != '-' ? $obj->label : '')); |
|
4251
|
+ $label = ($langs->trans("PaymentConditionShort".$obj->code) != "PaymentConditionShort".$obj->code ? $langs->trans("PaymentConditionShort".$obj->code) : ($obj->label != '-' ? $obj->label : '')); |
4252
|
4252
|
$this->cache_conditions_paiements[$obj->rowid]['code'] = $obj->code; |
4253
|
4253
|
$this->cache_conditions_paiements[$obj->rowid]['label'] = $label; |
4254
|
4254
|
$this->cache_conditions_paiements[$obj->rowid]['deposit_percent'] = $obj->deposit_percent; |
|
@@ -4276,7 +4276,7 @@ discard block |
|
|
block discarded – undo |
4276
|
4276
|
// phpcs:enable |
4277
|
4277
|
global $langs; |
4278
|
4278
|
|
4279
|
|
- $num = count($this->cache_availability); // TODO Use $conf->cache['availability'] instead of $this->cache_availability |
|
4279
|
+ $num = count($this->cache_availability); // TODO Use $conf->cache['availability'] instead of $this->cache_availability |
4280
|
4280
|
if ($num > 0) { |
4281
|
4281
|
return 0; // Cache already loaded |
4282
|
4282
|
} |
|
@@ -4286,7 +4286,7 @@ discard block |
|
|
block discarded – undo |
4286
|
4286
|
$langs->load('propal'); |
4287
|
4287
|
|
4288
|
4288
|
$sql = "SELECT rowid, code, label, position"; |
4289
|
|
- $sql .= " FROM " . $this->db->prefix() . 'c_availability'; |
|
4289
|
+ $sql .= " FROM ".$this->db->prefix().'c_availability'; |
4290
|
4290
|
$sql .= " WHERE active > 0"; |
4291
|
4291
|
|
4292
|
4292
|
$resql = $this->db->query($sql); |
|
@@ -4297,7 +4297,7 @@ discard block |
|
|
block discarded – undo |
4297
|
4297
|
$obj = $this->db->fetch_object($resql); |
4298
|
4298
|
|
4299
|
4299
|
// Si traduction existe, on l'utilise, sinon on prend le libelle par default |
4300
|
|
- $label = ($langs->trans("AvailabilityType" . $obj->code) != "AvailabilityType" . $obj->code ? $langs->trans("AvailabilityType" . $obj->code) : ($obj->label != '-' ? $obj->label : '')); |
|
4300
|
+ $label = ($langs->trans("AvailabilityType".$obj->code) != "AvailabilityType".$obj->code ? $langs->trans("AvailabilityType".$obj->code) : ($obj->label != '-' ? $obj->label : '')); |
4301
|
4301
|
$this->cache_availability[$obj->rowid]['code'] = $obj->code; |
4302
|
4302
|
$this->cache_availability[$obj->rowid]['label'] = $label; |
4303
|
4303
|
$this->cache_availability[$obj->rowid]['position'] = $obj->position; |
|
@@ -4329,17 +4329,17 @@ discard block |
|
|
block discarded – undo |
4329
|
4329
|
|
4330
|
4330
|
$this->load_cache_availability(); |
4331
|
4331
|
|
4332
|
|
- dol_syslog(__METHOD__ . " selected=" . $selected . ", htmlname=" . $htmlname, LOG_DEBUG); |
|
4332
|
+ dol_syslog(__METHOD__." selected=".$selected.", htmlname=".$htmlname, LOG_DEBUG); |
4333
|
4333
|
|
4334
|
|
- print '<select id="' . $htmlname . '" class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">'; |
|
4334
|
+ print '<select id="'.$htmlname.'" class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">'; |
4335
|
4335
|
if ($addempty) { |
4336
|
4336
|
print '<option value="0"> </option>'; |
4337
|
4337
|
} |
4338
|
4338
|
foreach ($this->cache_availability as $id => $arrayavailability) { |
4339
|
4339
|
if ($selected == $id) { |
4340
|
|
- print '<option value="' . $id . '" selected>'; |
|
4340
|
+ print '<option value="'.$id.'" selected>'; |
4341
|
4341
|
} else { |
4342
|
|
- print '<option value="' . $id . '">'; |
|
4342
|
+ print '<option value="'.$id.'">'; |
4343
|
4343
|
} |
4344
|
4344
|
print dol_escape_htmltag($arrayavailability['label']); |
4345
|
4345
|
print '</option>'; |
|
@@ -4360,13 +4360,13 @@ discard block |
|
|
block discarded – undo |
4360
|
4360
|
{ |
4361
|
4361
|
global $langs; |
4362
|
4362
|
|
4363
|
|
- $num = count($this->cache_demand_reason); // TODO Use $conf->cache['input_reason'] instead of $this->cache_demand_reason |
|
4363
|
+ $num = count($this->cache_demand_reason); // TODO Use $conf->cache['input_reason'] instead of $this->cache_demand_reason |
4364
|
4364
|
if ($num > 0) { |
4365
|
4365
|
return 0; // Cache already loaded |
4366
|
4366
|
} |
4367
|
4367
|
|
4368
|
4368
|
$sql = "SELECT rowid, code, label"; |
4369
|
|
- $sql .= " FROM " . $this->db->prefix() . 'c_input_reason'; |
|
4369
|
+ $sql .= " FROM ".$this->db->prefix().'c_input_reason'; |
4370
|
4370
|
$sql .= " WHERE active > 0"; |
4371
|
4371
|
|
4372
|
4372
|
$resql = $this->db->query($sql); |
|
@@ -4379,8 +4379,8 @@ discard block |
|
|
block discarded – undo |
4379
|
4379
|
|
4380
|
4380
|
// Si traduction existe, on l'utilise, sinon on prend le libelle par default |
4381
|
4381
|
$label = ($obj->label != '-' ? $obj->label : ''); |
4382
|
|
- if ($langs->trans("DemandReasonType" . $obj->code) != "DemandReasonType" . $obj->code) { |
4383
|
|
- $label = $langs->trans("DemandReasonType" . $obj->code); // So translation key DemandReasonTypeSRC_XXX will work |
|
4382
|
+ if ($langs->trans("DemandReasonType".$obj->code) != "DemandReasonType".$obj->code) { |
|
4383
|
+ $label = $langs->trans("DemandReasonType".$obj->code); // So translation key DemandReasonTypeSRC_XXX will work |
4384
|
4384
|
} |
4385
|
4385
|
if ($langs->trans($obj->code) != $obj->code) { |
4386
|
4386
|
$label = $langs->trans($obj->code); // So translation key SRC_XXX will work |
|
@@ -4420,9 +4420,9 @@ discard block |
|
|
block discarded – undo |
4420
|
4420
|
|
4421
|
4421
|
$this->loadCacheInputReason(); |
4422
|
4422
|
|
4423
|
|
- print '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" id="select_' . $htmlname . '" name="' . $htmlname . '">'; |
|
4423
|
+ print '<select class="flat'.($morecss ? ' '.$morecss : '').'" id="select_'.$htmlname.'" name="'.$htmlname.'">'; |
4424
|
4424
|
if ($addempty) { |
4425
|
|
- print '<option value="0"' . (empty($selected) ? ' selected' : '') . '> </option>'; |
|
4425
|
+ print '<option value="0"'.(empty($selected) ? ' selected' : '').'> </option>'; |
4426
|
4426
|
} |
4427
|
4427
|
foreach ($this->cache_demand_reason as $id => $arraydemandreason) { |
4428
|
4428
|
if ($arraydemandreason['code'] == $exclude) { |
|
@@ -4430,9 +4430,9 @@ discard block |
|
|
block discarded – undo |
4430
|
4430
|
} |
4431
|
4431
|
|
4432
|
4432
|
if ($selected && ($selected == $arraydemandreason['id'] || $selected == $arraydemandreason['code'])) { |
4433
|
|
- print '<option value="' . $arraydemandreason['id'] . '" selected>'; |
|
4433
|
+ print '<option value="'.$arraydemandreason['id'].'" selected>'; |
4434
|
4434
|
} else { |
4435
|
|
- print '<option value="' . $arraydemandreason['id'] . '">'; |
|
4435
|
+ print '<option value="'.$arraydemandreason['id'].'">'; |
4436
|
4436
|
} |
4437
|
4437
|
$label = $arraydemandreason['label']; // Translation of label was already done into the ->loadCacheInputReason |
4438
|
4438
|
print $langs->trans($label); |
|
@@ -4442,7 +4442,7 @@ discard block |
|
|
block discarded – undo |
4442
|
4442
|
if ($user->admin && empty($notooltip)) { |
4443
|
4443
|
print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); |
4444
|
4444
|
} |
4445
|
|
- print ajax_combobox('select_' . $htmlname); |
|
4445
|
+ print ajax_combobox('select_'.$htmlname); |
4446
|
4446
|
} |
4447
|
4447
|
|
4448
|
4448
|
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
@@ -4457,7 +4457,7 @@ discard block |
|
|
block discarded – undo |
4457
|
4457
|
// phpcs:enable |
4458
|
4458
|
global $langs; |
4459
|
4459
|
|
4460
|
|
- $num = count($this->cache_types_paiements); // TODO Use $conf->cache['payment_mode'] instead of $this->cache_types_paiements |
|
4460
|
+ $num = count($this->cache_types_paiements); // TODO Use $conf->cache['payment_mode'] instead of $this->cache_types_paiements |
4461
|
4461
|
if ($num > 0) { |
4462
|
4462
|
return $num; // Cache already loaded |
4463
|
4463
|
} |
|
@@ -4467,8 +4467,8 @@ discard block |
|
|
block discarded – undo |
4467
|
4467
|
$this->cache_types_paiements = array(); |
4468
|
4468
|
|
4469
|
4469
|
$sql = "SELECT id, code, libelle as label, type, active"; |
4470
|
|
- $sql .= " FROM " . $this->db->prefix() . "c_paiement"; |
4471
|
|
- $sql .= " WHERE entity IN (" . getEntity('c_paiement') . ")"; |
|
4470
|
+ $sql .= " FROM ".$this->db->prefix()."c_paiement"; |
|
4471
|
+ $sql .= " WHERE entity IN (".getEntity('c_paiement').")"; |
4472
|
4472
|
|
4473
|
4473
|
$resql = $this->db->query($sql); |
4474
|
4474
|
if ($resql) { |
|
@@ -4478,7 +4478,7 @@ discard block |
|
|
block discarded – undo |
4478
|
4478
|
$obj = $this->db->fetch_object($resql); |
4479
|
4479
|
|
4480
|
4480
|
// Si traduction existe, on l'utilise, sinon on prend le libelle par default |
4481
|
|
- $label = ($langs->transnoentitiesnoconv("PaymentTypeShort" . $obj->code) != "PaymentTypeShort" . $obj->code ? $langs->transnoentitiesnoconv("PaymentTypeShort" . $obj->code) : ($obj->label != '-' ? $obj->label : '')); |
|
4481
|
+ $label = ($langs->transnoentitiesnoconv("PaymentTypeShort".$obj->code) != "PaymentTypeShort".$obj->code ? $langs->transnoentitiesnoconv("PaymentTypeShort".$obj->code) : ($obj->label != '-' ? $obj->label : '')); |
4482
|
4482
|
$this->cache_types_paiements[$obj->id]['id'] = $obj->id; |
4483
|
4483
|
$this->cache_types_paiements[$obj->id]['code'] = $obj->code; |
4484
|
4484
|
$this->cache_types_paiements[$obj->id]['label'] = $label; |
|
@@ -4550,17 +4550,17 @@ discard block |
|
|
block discarded – undo |
4550
|
4550
|
global $langs, $user, $conf; |
4551
|
4551
|
|
4552
|
4552
|
$out = ''; |
4553
|
|
- dol_syslog(__METHOD__ . " selected=" . $selected . ", htmlname=" . $htmlname, LOG_DEBUG); |
|
4553
|
+ dol_syslog(__METHOD__." selected=".$selected.", htmlname=".$htmlname, LOG_DEBUG); |
4554
|
4554
|
|
4555
|
4555
|
$this->load_cache_conditions_paiements(); |
4556
|
4556
|
|
4557
|
4557
|
// Set default value if not already set by caller |
4558
|
4558
|
if (empty($selected) && getDolGlobalString('MAIN_DEFAULT_PAYMENT_TERM_ID')) { |
4559
|
|
- dol_syslog(__METHOD__ . "Using deprecated option MAIN_DEFAULT_PAYMENT_TERM_ID", LOG_NOTICE); |
|
4559
|
+ dol_syslog(__METHOD__."Using deprecated option MAIN_DEFAULT_PAYMENT_TERM_ID", LOG_NOTICE); |
4560
|
4560
|
$selected = getDolGlobalString('MAIN_DEFAULT_PAYMENT_TERM_ID'); |
4561
|
4561
|
} |
4562
|
4562
|
|
4563
|
|
- $out .= '<select id="' . $htmlname . '" class="flat selectpaymentterms' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">'; |
|
4563
|
+ $out .= '<select id="'.$htmlname.'" class="flat selectpaymentterms'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">'; |
4564
|
4564
|
if ($addempty) { |
4565
|
4565
|
$out .= '<option value="0"> </option>'; |
4566
|
4566
|
} |
|
@@ -4574,9 +4574,9 @@ discard block |
|
|
block discarded – undo |
4574
|
4574
|
|
4575
|
4575
|
if ($selected == $id) { |
4576
|
4576
|
$selectedDepositPercent = $deposit_percent > 0 ? $deposit_percent : $arrayconditions['deposit_percent']; |
4577
|
|
- $out .= '<option value="' . $id . '" data-deposit_percent="' . $arrayconditions['deposit_percent'] . '" selected>'; |
|
4577
|
+ $out .= '<option value="'.$id.'" data-deposit_percent="'.$arrayconditions['deposit_percent'].'" selected>'; |
4578
|
4578
|
} else { |
4579
|
|
- $out .= '<option value="' . $id . '" data-deposit_percent="' . $arrayconditions['deposit_percent'] . '">'; |
|
4579
|
+ $out .= '<option value="'.$id.'" data-deposit_percent="'.$arrayconditions['deposit_percent'].'">'; |
4580
|
4580
|
} |
4581
|
4581
|
$label = $arrayconditions['label']; |
4582
|
4582
|
|
|
@@ -4594,21 +4594,21 @@ discard block |
|
|
block discarded – undo |
4594
|
4594
|
$out .= ajax_combobox($htmlname); |
4595
|
4595
|
|
4596
|
4596
|
if ($deposit_percent >= 0) { |
4597
|
|
- $out .= ' <span id="' . $htmlname . '_deposit_percent_container"' . (empty($selectedDepositPercent) ? ' style="display: none"' : '') . '>'; |
4598
|
|
- $out .= $langs->trans('DepositPercent') . ' : '; |
4599
|
|
- $out .= '<input id="' . $htmlname . '_deposit_percent" name="' . $htmlname . '_deposit_percent" class="maxwidth50" value="' . $deposit_percent . '" />'; |
|
4597
|
+ $out .= ' <span id="'.$htmlname.'_deposit_percent_container"'.(empty($selectedDepositPercent) ? ' style="display: none"' : '').'>'; |
|
4598
|
+ $out .= $langs->trans('DepositPercent').' : '; |
|
4599
|
+ $out .= '<input id="'.$htmlname.'_deposit_percent" name="'.$htmlname.'_deposit_percent" class="maxwidth50" value="'.$deposit_percent.'" />'; |
4600
|
4600
|
$out .= '</span>'; |
4601
|
4601
|
$out .= ' |
4602
|
|
- <script nonce="' . getNonce() . '"> |
|
4602
|
+ <script nonce="' . getNonce().'"> |
4603
|
4603
|
$(document).ready(function () { |
4604
|
|
- $("#' . $htmlname . '").change(function () { |
|
4604
|
+ $("#' . $htmlname.'").change(function () { |
4605
|
4605
|
let $selected = $(this).find("option:selected"); |
4606
|
4606
|
let depositPercent = $selected.attr("data-deposit_percent"); |
4607
|
4607
|
|
4608
|
4608
|
if (depositPercent.length > 0) { |
4609
|
|
- $("#' . $htmlname . '_deposit_percent_container").show().find("#' . $htmlname . '_deposit_percent").val(depositPercent); |
|
4609
|
+ $("#' . $htmlname.'_deposit_percent_container").show().find("#'.$htmlname.'_deposit_percent").val(depositPercent); |
4610
|
4610
|
} else { |
4611
|
|
- $("#' . $htmlname . '_deposit_percent_container").hide(); |
|
4611
|
+ $("#' . $htmlname.'_deposit_percent_container").hide(); |
4612
|
4612
|
} |
4613
|
4613
|
|
4614
|
4614
|
return true; |
|
@@ -4646,7 +4646,7 @@ discard block |
|
|
block discarded – undo |
4646
|
4646
|
|
4647
|
4647
|
$out = ''; |
4648
|
4648
|
|
4649
|
|
- dol_syslog(__METHOD__ . " " . $selected . ", " . $htmlname . ", " . $filtertype . ", " . $format, LOG_DEBUG); |
|
4649
|
+ dol_syslog(__METHOD__." ".$selected.", ".$htmlname.", ".$filtertype.", ".$format, LOG_DEBUG); |
4650
|
4650
|
|
4651
|
4651
|
$filterarray = array(); |
4652
|
4652
|
if ($filtertype == 'CRDT') { |
|
@@ -4661,11 +4661,11 @@ discard block |
|
|
block discarded – undo |
4661
|
4661
|
|
4662
|
4662
|
// Set default value if not already set by caller |
4663
|
4663
|
if (empty($selected) && getDolGlobalString('MAIN_DEFAULT_PAYMENT_TYPE_ID')) { |
4664
|
|
- dol_syslog(__METHOD__ . "Using deprecated option MAIN_DEFAULT_PAYMENT_TYPE_ID", LOG_NOTICE); |
|
4664
|
+ dol_syslog(__METHOD__."Using deprecated option MAIN_DEFAULT_PAYMENT_TYPE_ID", LOG_NOTICE); |
4665
|
4665
|
$selected = getDolGlobalString('MAIN_DEFAULT_PAYMENT_TYPE_ID'); |
4666
|
4666
|
} |
4667
|
4667
|
|
4668
|
|
- $out .= '<select id="select' . $htmlname . '" class="flat selectpaymenttypes' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">'; |
|
4668
|
+ $out .= '<select id="select'.$htmlname.'" class="flat selectpaymenttypes'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">'; |
4669
|
4669
|
if ($empty) { |
4670
|
4670
|
$out .= '<option value=""> </option>'; |
4671
|
4671
|
} |
|
@@ -4686,13 +4686,13 @@ discard block |
|
|
block discarded – undo |
4686
|
4686
|
} |
4687
|
4687
|
|
4688
|
4688
|
if ($format == 0) { |
4689
|
|
- $out .= '<option value="' . $id . '"'; |
|
4689
|
+ $out .= '<option value="'.$id.'"'; |
4690
|
4690
|
} elseif ($format == 1) { |
4691
|
|
- $out .= '<option value="' . $arraytypes['code'] . '"'; |
|
4691
|
+ $out .= '<option value="'.$arraytypes['code'].'"'; |
4692
|
4692
|
} elseif ($format == 2) { |
4693
|
|
- $out .= '<option value="' . $arraytypes['code'] . '"'; |
|
4693
|
+ $out .= '<option value="'.$arraytypes['code'].'"'; |
4694
|
4694
|
} elseif ($format == 3) { |
4695
|
|
- $out .= '<option value="' . $id . '"'; |
|
4695
|
+ $out .= '<option value="'.$id.'"'; |
4696
|
4696
|
} |
4697
|
4697
|
// Print attribute selected or not |
4698
|
4698
|
if ($format == 1 || $format == 2) { |
|
@@ -4722,7 +4722,7 @@ discard block |
|
|
block discarded – undo |
4722
|
4722
|
if ($user->admin && !$noadmininfo) { |
4723
|
4723
|
$out .= info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); |
4724
|
4724
|
} |
4725
|
|
- $out .= ajax_combobox('select' . $htmlname); |
|
4725
|
+ $out .= ajax_combobox('select'.$htmlname); |
4726
|
4726
|
|
4727
|
4727
|
if (empty($nooutput)) { |
4728
|
4728
|
print $out; |
|
@@ -4744,22 +4744,22 @@ discard block |
|
|
block discarded – undo |
4744
|
4744
|
{ |
4745
|
4745
|
global $langs; |
4746
|
4746
|
|
4747
|
|
- $return = '<select class="flat maxwidth100" id="select_' . $htmlname . '" name="' . $htmlname . '">'; |
|
4747
|
+ $return = '<select class="flat maxwidth100" id="select_'.$htmlname.'" name="'.$htmlname.'">'; |
4748
|
4748
|
$options = array( |
4749
|
4749
|
'HT' => $langs->trans("HT"), |
4750
|
4750
|
'TTC' => $langs->trans("TTC") |
4751
|
4751
|
); |
4752
|
4752
|
foreach ($options as $id => $value) { |
4753
|
4753
|
if ($selected == $id) { |
4754
|
|
- $return .= '<option value="' . $id . '" selected>' . $value; |
|
4754
|
+ $return .= '<option value="'.$id.'" selected>'.$value; |
4755
|
4755
|
} else { |
4756
|
|
- $return .= '<option value="' . $id . '">' . $value; |
|
4756
|
+ $return .= '<option value="'.$id.'">'.$value; |
4757
|
4757
|
} |
4758
|
4758
|
$return .= '</option>'; |
4759
|
4759
|
} |
4760
|
4760
|
$return .= '</select>'; |
4761
|
4761
|
if ($addjscombo) { |
4762
|
|
- $return .= ajax_combobox('select_' . $htmlname); |
|
4762
|
+ $return .= ajax_combobox('select_'.$htmlname); |
4763
|
4763
|
} |
4764
|
4764
|
|
4765
|
4765
|
return $return; |
|
@@ -4777,7 +4777,7 @@ discard block |
|
|
block discarded – undo |
4777
|
4777
|
// phpcs:enable |
4778
|
4778
|
global $langs; |
4779
|
4779
|
|
4780
|
|
- $num = count($this->cache_transport_mode); // TODO Use $conf->cache['payment_mode'] instead of $this->cache_transport_mode |
|
4780
|
+ $num = count($this->cache_transport_mode); // TODO Use $conf->cache['payment_mode'] instead of $this->cache_transport_mode |
4781
|
4781
|
if ($num > 0) { |
4782
|
4782
|
return $num; // Cache already loaded |
4783
|
4783
|
} |
|
@@ -4787,8 +4787,8 @@ discard block |
|
|
block discarded – undo |
4787
|
4787
|
$this->cache_transport_mode = array(); |
4788
|
4788
|
|
4789
|
4789
|
$sql = "SELECT rowid, code, label, active"; |
4790
|
|
- $sql .= " FROM " . $this->db->prefix() . "c_transport_mode"; |
4791
|
|
- $sql .= " WHERE entity IN (" . getEntity('c_transport_mode') . ")"; |
|
4790
|
+ $sql .= " FROM ".$this->db->prefix()."c_transport_mode"; |
|
4791
|
+ $sql .= " WHERE entity IN (".getEntity('c_transport_mode').")"; |
4792
|
4792
|
|
4793
|
4793
|
$resql = $this->db->query($sql); |
4794
|
4794
|
if ($resql) { |
|
@@ -4798,7 +4798,7 @@ discard block |
|
|
block discarded – undo |
4798
|
4798
|
$obj = $this->db->fetch_object($resql); |
4799
|
4799
|
|
4800
|
4800
|
// If traduction exist, we use it else we take the default label |
4801
|
|
- $label = ($langs->transnoentitiesnoconv("PaymentTypeShort" . $obj->code) != "PaymentTypeShort" . $obj->code ? $langs->transnoentitiesnoconv("PaymentTypeShort" . $obj->code) : ($obj->label != '-' ? $obj->label : '')); |
|
4801
|
+ $label = ($langs->transnoentitiesnoconv("PaymentTypeShort".$obj->code) != "PaymentTypeShort".$obj->code ? $langs->transnoentitiesnoconv("PaymentTypeShort".$obj->code) : ($obj->label != '-' ? $obj->label : '')); |
4802
|
4802
|
$this->cache_transport_mode[$obj->rowid]['rowid'] = $obj->rowid; |
4803
|
4803
|
$this->cache_transport_mode[$obj->rowid]['code'] = $obj->code; |
4804
|
4804
|
$this->cache_transport_mode[$obj->rowid]['label'] = $label; |
|
@@ -4832,11 +4832,11 @@ discard block |
|
|
block discarded – undo |
4832
|
4832
|
{ |
4833
|
4833
|
global $langs, $user; |
4834
|
4834
|
|
4835
|
|
- dol_syslog(__METHOD__ . " " . $selected . ", " . $htmlname . ", " . $format, LOG_DEBUG); |
|
4835
|
+ dol_syslog(__METHOD__." ".$selected.", ".$htmlname.", ".$format, LOG_DEBUG); |
4836
|
4836
|
|
4837
|
4837
|
$this->load_cache_transport_mode(); |
4838
|
4838
|
|
4839
|
|
- print '<select id="select' . $htmlname . '" class="flat selectmodetransport' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">'; |
|
4839
|
+ print '<select id="select'.$htmlname.'" class="flat selectmodetransport'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">'; |
4840
|
4840
|
if ($empty) { |
4841
|
4841
|
print '<option value=""> </option>'; |
4842
|
4842
|
} |
|
@@ -4852,13 +4852,13 @@ discard block |
|
|
block discarded – undo |
4852
|
4852
|
} |
4853
|
4853
|
|
4854
|
4854
|
if ($format == 0) { |
4855
|
|
- print '<option value="' . $id . '"'; |
|
4855
|
+ print '<option value="'.$id.'"'; |
4856
|
4856
|
} elseif ($format == 1) { |
4857
|
|
- print '<option value="' . $arraytypes['code'] . '"'; |
|
4857
|
+ print '<option value="'.$arraytypes['code'].'"'; |
4858
|
4858
|
} elseif ($format == 2) { |
4859
|
|
- print '<option value="' . $arraytypes['code'] . '"'; |
|
4859
|
+ print '<option value="'.$arraytypes['code'].'"'; |
4860
|
4860
|
} elseif ($format == 3) { |
4861
|
|
- print '<option value="' . $id . '"'; |
|
4861
|
+ print '<option value="'.$id.'"'; |
4862
|
4862
|
} |
4863
|
4863
|
// If text is selected, we compare with code, else with id |
4864
|
4864
|
if (preg_match('/[a-z]/i', $selected) && $selected == $arraytypes['code']) { |
|
@@ -4906,31 +4906,31 @@ discard block |
|
|
block discarded – undo |
4906
|
4906
|
$langs->load("deliveries"); |
4907
|
4907
|
|
4908
|
4908
|
$sql = "SELECT rowid, code, libelle as label"; |
4909
|
|
- $sql .= " FROM " . $this->db->prefix() . "c_shipment_mode"; |
|
4909
|
+ $sql .= " FROM ".$this->db->prefix()."c_shipment_mode"; |
4910
|
4910
|
$sql .= " WHERE active > 0"; |
4911
|
4911
|
if ($filtre) { |
4912
|
|
- $sql .= " AND " . $filtre; |
|
4912
|
+ $sql .= " AND ".$filtre; |
4913
|
4913
|
} |
4914
|
4914
|
$sql .= " ORDER BY libelle ASC"; |
4915
|
4915
|
|
4916
|
|
- dol_syslog(get_class($this) . "::selectShippingMode", LOG_DEBUG); |
|
4916
|
+ dol_syslog(get_class($this)."::selectShippingMode", LOG_DEBUG); |
4917
|
4917
|
$result = $this->db->query($sql); |
4918
|
4918
|
if ($result) { |
4919
|
4919
|
$num = $this->db->num_rows($result); |
4920
|
4920
|
$i = 0; |
4921
|
4921
|
if ($num) { |
4922
|
|
- print '<select id="select' . $htmlname . '" class="flat selectshippingmethod' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '"' . ($moreattrib ? ' ' . $moreattrib : '') . '>'; |
|
4922
|
+ print '<select id="select'.$htmlname.'" class="flat selectshippingmethod'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'"'.($moreattrib ? ' '.$moreattrib : '').'>'; |
4923
|
4923
|
if ($useempty == 1 || ($useempty == 2 && $num > 1)) { |
4924
|
4924
|
print '<option value="-1"> </option>'; |
4925
|
4925
|
} |
4926
|
4926
|
while ($i < $num) { |
4927
|
4927
|
$obj = $this->db->fetch_object($result); |
4928
|
4928
|
if ($selected == $obj->rowid) { |
4929
|
|
- print '<option value="' . $obj->rowid . '" selected>'; |
|
4929
|
+ print '<option value="'.$obj->rowid.'" selected>'; |
4930
|
4930
|
} else { |
4931
|
|
- print '<option value="' . $obj->rowid . '">'; |
|
4931
|
+ print '<option value="'.$obj->rowid.'">'; |
4932
|
4932
|
} |
4933
|
|
- print ($langs->trans("SendingMethod" . strtoupper($obj->code)) != "SendingMethod" . strtoupper($obj->code)) ? $langs->trans("SendingMethod" . strtoupper($obj->code)) : $obj->label; |
|
4933
|
+ print ($langs->trans("SendingMethod".strtoupper($obj->code)) != "SendingMethod".strtoupper($obj->code)) ? $langs->trans("SendingMethod".strtoupper($obj->code)) : $obj->label; |
4934
|
4934
|
print '</option>'; |
4935
|
4935
|
$i++; |
4936
|
4936
|
} |
|
@@ -4939,7 +4939,7 @@ discard block |
|
|
block discarded – undo |
4939
|
4939
|
print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); |
4940
|
4940
|
} |
4941
|
4941
|
|
4942
|
|
- print ajax_combobox('select' . $htmlname); |
|
4942
|
+ print ajax_combobox('select'.$htmlname); |
4943
|
4943
|
} else { |
4944
|
4944
|
print $langs->trans("NoShippingMethodDefined"); |
4945
|
4945
|
} |
|
@@ -4964,16 +4964,16 @@ discard block |
|
|
block discarded – undo |
4964
|
4964
|
$langs->load("deliveries"); |
4965
|
4965
|
|
4966
|
4966
|
if ($htmlname != "none") { |
4967
|
|
- print '<form method="POST" action="' . $page . '">'; |
|
4967
|
+ print '<form method="POST" action="'.$page.'">'; |
4968
|
4968
|
print '<input type="hidden" name="action" value="setshippingmethod">'; |
4969
|
|
- print '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
4969
|
+ print '<input type="hidden" name="token" value="'.newToken().'">'; |
4970
|
4970
|
$this->selectShippingMethod($selected, $htmlname, '', $addempty); |
4971
|
|
- print '<input type="submit" class="button valignmiddle" value="' . $langs->trans("Modify") . '">'; |
|
4971
|
+ print '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">'; |
4972
|
4972
|
print '</form>'; |
4973
|
4973
|
} else { |
4974
|
4974
|
if ($selected) { |
4975
|
4975
|
$code = $langs->getLabelFromKey($this->db, $selected, 'c_shipment_mode', 'rowid', 'code'); |
4976
|
|
- print $langs->trans("SendingMethod" . strtoupper($code)); |
|
4976
|
+ print $langs->trans("SendingMethod".strtoupper($code)); |
4977
|
4977
|
} else { |
4978
|
4978
|
print " "; |
4979
|
4979
|
} |
|
@@ -4996,10 +4996,10 @@ discard block |
|
|
block discarded – undo |
4996
|
4996
|
|
4997
|
4997
|
$opt = '<option value="" selected></option>'; |
4998
|
4998
|
$sql = "SELECT rowid, ref, situation_cycle_ref, situation_counter, situation_final, fk_soc"; |
4999
|
|
- $sql .= ' FROM ' . $this->db->prefix() . 'facture'; |
5000
|
|
- $sql .= ' WHERE entity IN (' . getEntity('invoice') . ')'; |
|
4999
|
+ $sql .= ' FROM '.$this->db->prefix().'facture'; |
|
5000
|
+ $sql .= ' WHERE entity IN ('.getEntity('invoice').')'; |
5001
|
5001
|
$sql .= ' AND situation_counter >= 1'; |
5002
|
|
- $sql .= ' AND fk_soc = ' . (int) $socid; |
|
5002
|
+ $sql .= ' AND fk_soc = '.(int) $socid; |
5003
|
5003
|
$sql .= ' AND type <> 2'; |
5004
|
5004
|
$sql .= ' ORDER by situation_cycle_ref, situation_counter desc'; |
5005
|
5005
|
$resql = $this->db->query($sql); |
|
@@ -5017,19 +5017,19 @@ discard block |
|
|
block discarded – undo |
5017
|
5017
|
//Not prov? |
5018
|
5018
|
if (substr($obj->ref, 1, 4) != 'PROV') { |
5019
|
5019
|
if ($selected == $obj->rowid) { |
5020
|
|
- $opt .= '<option value="' . $obj->rowid . '" selected>' . $obj->ref . '</option>'; |
|
5020
|
+ $opt .= '<option value="'.$obj->rowid.'" selected>'.$obj->ref.'</option>'; |
5021
|
5021
|
} else { |
5022
|
|
- $opt .= '<option value="' . $obj->rowid . '">' . $obj->ref . '</option>'; |
|
5022
|
+ $opt .= '<option value="'.$obj->rowid.'">'.$obj->ref.'</option>'; |
5023
|
5023
|
} |
5024
|
5024
|
} |
5025
|
5025
|
} |
5026
|
5026
|
} |
5027
|
5027
|
} |
5028
|
5028
|
} else { |
5029
|
|
- dol_syslog("Error sql=" . $sql . ", error=" . $this->error, LOG_ERR); |
|
5029
|
+ dol_syslog("Error sql=".$sql.", error=".$this->error, LOG_ERR); |
5030
|
5030
|
} |
5031
|
5031
|
if ($opt == '<option value ="" selected></option>') { |
5032
|
|
- $opt = '<option value ="0" selected>' . $langs->trans('NoSituations') . '</option>'; |
|
5032
|
+ $opt = '<option value ="0" selected>'.$langs->trans('NoSituations').'</option>'; |
5033
|
5033
|
} |
5034
|
5034
|
return $opt; |
5035
|
5035
|
} |
|
@@ -5049,12 +5049,12 @@ discard block |
|
|
block discarded – undo |
5049
|
5049
|
|
5050
|
5050
|
$langs->load('products'); |
5051
|
5051
|
|
5052
|
|
- $return = '<select class="flat" id="' . $htmlname . '" name="' . $htmlname . '">'; |
|
5052
|
+ $return = '<select class="flat" id="'.$htmlname.'" name="'.$htmlname.'">'; |
5053
|
5053
|
|
5054
|
|
- $sql = "SELECT rowid, label, code FROM " . $this->db->prefix() . "c_units"; |
|
5054
|
+ $sql = "SELECT rowid, label, code FROM ".$this->db->prefix()."c_units"; |
5055
|
5055
|
$sql .= ' WHERE active > 0'; |
5056
|
5056
|
if (!empty($unit_type)) { |
5057
|
|
- $sql .= " AND unit_type = '" . $this->db->escape($unit_type) . "'"; |
|
5057
|
+ $sql .= " AND unit_type = '".$this->db->escape($unit_type)."'"; |
5058
|
5058
|
} |
5059
|
5059
|
$sql .= " ORDER BY sortorder"; |
5060
|
5060
|
|
|
@@ -5066,14 +5066,14 @@ discard block |
|
|
block discarded – undo |
5066
|
5066
|
|
5067
|
5067
|
while ($res = $this->db->fetch_object($resql)) { |
5068
|
5068
|
$unitLabel = $res->label; |
5069
|
|
- if (!empty($langs->tab_translate['unit' . $res->code])) { // check if Translation is available before |
5070
|
|
- $unitLabel = $langs->trans('unit' . $res->code) != $res->label ? $langs->trans('unit' . $res->code) : $res->label; |
|
5069
|
+ if (!empty($langs->tab_translate['unit'.$res->code])) { // check if Translation is available before |
|
5070
|
+ $unitLabel = $langs->trans('unit'.$res->code) != $res->label ? $langs->trans('unit'.$res->code) : $res->label; |
5071
|
5071
|
} |
5072
|
5072
|
|
5073
|
5073
|
if ($selected == $res->rowid) { |
5074
|
|
- $return .= '<option value="' . $res->rowid . '" selected>' . $unitLabel . '</option>'; |
|
5074
|
+ $return .= '<option value="'.$res->rowid.'" selected>'.$unitLabel.'</option>'; |
5075
|
5075
|
} else { |
5076
|
|
- $return .= '<option value="' . $res->rowid . '">' . $unitLabel . '</option>'; |
|
5076
|
+ $return .= '<option value="'.$res->rowid.'">'.$unitLabel.'</option>'; |
5077
|
5077
|
} |
5078
|
5078
|
} |
5079
|
5079
|
$return .= '</select>'; |
|
@@ -5108,23 +5108,23 @@ discard block |
|
|
block discarded – undo |
5108
|
5108
|
$num = 0; |
5109
|
5109
|
|
5110
|
5110
|
$sql = "SELECT rowid, label, bank, clos as status, currency_code"; |
5111
|
|
- $sql .= " FROM " . $this->db->prefix() . "bank_account"; |
5112
|
|
- $sql .= " WHERE entity IN (" . getEntity('bank_account') . ")"; |
|
5111
|
+ $sql .= " FROM ".$this->db->prefix()."bank_account"; |
|
5112
|
+ $sql .= " WHERE entity IN (".getEntity('bank_account').")"; |
5113
|
5113
|
if ($status != 2) { |
5114
|
|
- $sql .= " AND clos = " . (int) $status; |
|
5114
|
+ $sql .= " AND clos = ".(int) $status; |
5115
|
5115
|
} |
5116
|
5116
|
if ($filtre) { // TODO Support USF |
5117
|
|
- $sql .= " AND " . $filtre; |
|
5117
|
+ $sql .= " AND ".$filtre; |
5118
|
5118
|
} |
5119
|
5119
|
$sql .= " ORDER BY label"; |
5120
|
5120
|
|
5121
|
|
- dol_syslog(get_class($this) . "::select_comptes", LOG_DEBUG); |
|
5121
|
+ dol_syslog(get_class($this)."::select_comptes", LOG_DEBUG); |
5122
|
5122
|
$result = $this->db->query($sql); |
5123
|
5123
|
if ($result) { |
5124
|
5124
|
$num = $this->db->num_rows($result); |
5125
|
5125
|
$i = 0; |
5126
|
5126
|
if ($num) { |
5127
|
|
- $out .= '<select id="select' . $htmlname . '" class="flat selectbankaccount' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '"' . ($moreattrib ? ' ' . $moreattrib : '') . '>'; |
|
5127
|
+ $out .= '<select id="select'.$htmlname.'" class="flat selectbankaccount'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'"'.($moreattrib ? ' '.$moreattrib : '').'>'; |
5128
|
5128
|
|
5129
|
5129
|
if (!empty($useempty) && !is_numeric($useempty)) { |
5130
|
5130
|
$out .= '<option value="-1">'.$langs->trans($useempty).'</option>'; |
|
@@ -5135,27 +5135,27 @@ discard block |
|
|
block discarded – undo |
5135
|
5135
|
while ($i < $num) { |
5136
|
5136
|
$obj = $this->db->fetch_object($result); |
5137
|
5137
|
if ($selected == $obj->rowid || ($useempty == 2 && $num == 1 && empty($selected))) { |
5138
|
|
- $out .= '<option value="' . $obj->rowid . '" data-currency-code="' . $obj->currency_code . '" selected>'; |
|
5138
|
+ $out .= '<option value="'.$obj->rowid.'" data-currency-code="'.$obj->currency_code.'" selected>'; |
5139
|
5139
|
} else { |
5140
|
|
- $out .= '<option value="' . $obj->rowid . '" data-currency-code="' . $obj->currency_code . '">'; |
|
5140
|
+ $out .= '<option value="'.$obj->rowid.'" data-currency-code="'.$obj->currency_code.'">'; |
5141
|
5141
|
} |
5142
|
5142
|
$out .= trim($obj->label); |
5143
|
5143
|
if ($showcurrency) { |
5144
|
|
- $out .= ' (' . $obj->currency_code . ')'; |
|
5144
|
+ $out .= ' ('.$obj->currency_code.')'; |
5145
|
5145
|
} |
5146
|
5146
|
if ($status == 2 && $obj->status == 1) { |
5147
|
|
- $out .= ' (' . $langs->trans("Closed") . ')'; |
|
5147
|
+ $out .= ' ('.$langs->trans("Closed").')'; |
5148
|
5148
|
} |
5149
|
5149
|
$out .= '</option>'; |
5150
|
5150
|
$i++; |
5151
|
5151
|
} |
5152
|
5152
|
$out .= "</select>"; |
5153
|
|
- $out .= ajax_combobox('select' . $htmlname); |
|
5153
|
+ $out .= ajax_combobox('select'.$htmlname); |
5154
|
5154
|
} else { |
5155
|
5155
|
if ($status == 0) { |
5156
|
|
- $out .= '<span class="opacitymedium">' . $langs->trans("NoActiveBankAccountDefined") . '</span>'; |
|
5156
|
+ $out .= '<span class="opacitymedium">'.$langs->trans("NoActiveBankAccountDefined").'</span>'; |
5157
|
5157
|
} else { |
5158
|
|
- $out .= '<span class="opacitymedium">' . $langs->trans("NoBankAccountFound") . '</span>'; |
|
5158
|
+ $out .= '<span class="opacitymedium">'.$langs->trans("NoBankAccountFound").'</span>'; |
5159
|
5159
|
} |
5160
|
5160
|
} |
5161
|
5161
|
} else { |
|
@@ -5191,23 +5191,23 @@ discard block |
|
|
block discarded – undo |
5191
|
5191
|
$num = 0; |
5192
|
5192
|
|
5193
|
5193
|
$sql = "SELECT rowid, name, fk_country, status, entity"; |
5194
|
|
- $sql .= " FROM " . $this->db->prefix() . "establishment"; |
|
5194
|
+ $sql .= " FROM ".$this->db->prefix()."establishment"; |
5195
|
5195
|
$sql .= " WHERE 1=1"; |
5196
|
5196
|
if ($status != 2) { |
5197
|
|
- $sql .= " AND status = " . (int) $status; |
|
5197
|
+ $sql .= " AND status = ".(int) $status; |
5198
|
5198
|
} |
5199
|
5199
|
if ($filtre) { // TODO Support USF |
5200
|
|
- $sql .= " AND " . $filtre; |
|
5200
|
+ $sql .= " AND ".$filtre; |
5201
|
5201
|
} |
5202
|
5202
|
$sql .= " ORDER BY name"; |
5203
|
5203
|
|
5204
|
|
- dol_syslog(get_class($this) . "::select_establishment", LOG_DEBUG); |
|
5204
|
+ dol_syslog(get_class($this)."::select_establishment", LOG_DEBUG); |
5205
|
5205
|
$result = $this->db->query($sql); |
5206
|
5206
|
if ($result) { |
5207
|
5207
|
$num = $this->db->num_rows($result); |
5208
|
5208
|
$i = 0; |
5209
|
5209
|
if ($num) { |
5210
|
|
- print '<select id="select' . $htmlname . '" class="flat selectestablishment" name="' . $htmlname . '"' . ($moreattrib ? ' ' . $moreattrib : '') . '>'; |
|
5210
|
+ print '<select id="select'.$htmlname.'" class="flat selectestablishment" name="'.$htmlname.'"'.($moreattrib ? ' '.$moreattrib : '').'>'; |
5211
|
5211
|
if ($useempty == 1 || ($useempty == 2 && $num > 1)) { |
5212
|
5212
|
print '<option value="-1"> </option>'; |
5213
|
5213
|
} |
|
@@ -5215,13 +5215,13 @@ discard block |
|
|
block discarded – undo |
5215
|
5215
|
while ($i < $num) { |
5216
|
5216
|
$obj = $this->db->fetch_object($result); |
5217
|
5217
|
if ($selected == $obj->rowid) { |
5218
|
|
- print '<option value="' . $obj->rowid . '" selected>'; |
|
5218
|
+ print '<option value="'.$obj->rowid.'" selected>'; |
5219
|
5219
|
} else { |
5220
|
|
- print '<option value="' . $obj->rowid . '">'; |
|
5220
|
+ print '<option value="'.$obj->rowid.'">'; |
5221
|
5221
|
} |
5222
|
5222
|
print trim($obj->name); |
5223
|
5223
|
if ($status == 2 && $obj->status == 1) { |
5224
|
|
- print ' (' . $langs->trans("Closed") . ')'; |
|
5224
|
+ print ' ('.$langs->trans("Closed").')'; |
5225
|
5225
|
} |
5226
|
5226
|
print '</option>'; |
5227
|
5227
|
$i++; |
|
@@ -5229,9 +5229,9 @@ discard block |
|
|
block discarded – undo |
5229
|
5229
|
print "</select>"; |
5230
|
5230
|
} else { |
5231
|
5231
|
if ($status == 0) { |
5232
|
|
- print '<span class="opacitymedium">' . $langs->trans("NoActiveEstablishmentDefined") . '</span>'; |
|
5232
|
+ print '<span class="opacitymedium">'.$langs->trans("NoActiveEstablishmentDefined").'</span>'; |
5233
|
5233
|
} else { |
5234
|
|
- print '<span class="opacitymedium">' . $langs->trans("NoEstablishmentFound") . '</span>'; |
|
5234
|
+ print '<span class="opacitymedium">'.$langs->trans("NoEstablishmentFound").'</span>'; |
5235
|
5235
|
} |
5236
|
5236
|
} |
5237
|
5237
|
|
|
@@ -5255,20 +5255,20 @@ discard block |
|
|
block discarded – undo |
5255
|
5255
|
{ |
5256
|
5256
|
global $langs; |
5257
|
5257
|
if ($htmlname != "none") { |
5258
|
|
- print '<form method="POST" action="' . $page . '">'; |
|
5258
|
+ print '<form method="POST" action="'.$page.'">'; |
5259
|
5259
|
print '<input type="hidden" name="action" value="setbankaccount">'; |
5260
|
|
- print '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
5260
|
+ print '<input type="hidden" name="token" value="'.newToken().'">'; |
5261
|
5261
|
print img_picto('', 'bank_account', 'class="pictofixedwidth"'); |
5262
|
5262
|
$nbaccountfound = $this->select_comptes($selected, $htmlname, 0, '', $addempty); |
5263
|
5263
|
if ($nbaccountfound > 0) { |
5264
|
|
- print '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">'; |
|
5264
|
+ print '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">'; |
5265
|
5265
|
} |
5266
|
5266
|
print '</form>'; |
5267
|
5267
|
} else { |
5268
|
5268
|
$langs->load('banks'); |
5269
|
5269
|
|
5270
|
5270
|
if ($selected) { |
5271
|
|
- require_once DOL_DOCUMENT_ROOT . '/compta/bank/class/account.class.php'; |
|
5271
|
+ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; |
5272
|
5272
|
$bankstatic = new Account($this->db); |
5273
|
5273
|
$result = $bankstatic->fetch($selected); |
5274
|
5274
|
if ($result) { |
|
@@ -5307,19 +5307,19 @@ discard block |
|
|
block discarded – undo |
5307
|
5307
|
global $conf, $langs; |
5308
|
5308
|
$langs->load("categories"); |
5309
|
5309
|
|
5310
|
|
- include_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; |
|
5310
|
+ include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; |
5311
|
5311
|
|
5312
|
5312
|
// For backward compatibility |
5313
|
5313
|
if (is_numeric($type)) { |
5314
|
|
- dol_syslog(__METHOD__ . ': using numeric value for parameter type is deprecated. Use string code instead.', LOG_WARNING); |
|
5314
|
+ dol_syslog(__METHOD__.': using numeric value for parameter type is deprecated. Use string code instead.', LOG_WARNING); |
5315
|
5315
|
} |
5316
|
5316
|
|
5317
|
5317
|
if ($type === Categorie::TYPE_BANK_LINE) { |
5318
|
5318
|
// TODO Move this into common category feature |
5319
|
5319
|
$cate_arbo = array(); |
5320
|
5320
|
$sql = "SELECT c.label, c.rowid"; |
5321
|
|
- $sql .= " FROM " . $this->db->prefix() . "category_bank as c"; |
5322
|
|
- $sql .= " WHERE entity = " . $conf->entity; |
|
5321
|
+ $sql .= " FROM ".$this->db->prefix()."category_bank as c"; |
|
5322
|
+ $sql .= " WHERE entity = ".$conf->entity; |
5323
|
5323
|
$sql .= " ORDER BY c.label"; |
5324
|
5324
|
$result = $this->db->query($sql); |
5325
|
5325
|
if ($result) { |
|
@@ -5345,12 +5345,12 @@ discard block |
|
|
block discarded – undo |
5345
|
5345
|
$outarrayrichhtml = array(); |
5346
|
5346
|
|
5347
|
5347
|
|
5348
|
|
- $output = '<select class="flat minwidth100' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">'; |
|
5348
|
+ $output = '<select class="flat minwidth100'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">'; |
5349
|
5349
|
if (is_array($cate_arbo)) { |
5350
|
5350
|
$num = count($cate_arbo); |
5351
|
5351
|
|
5352
|
5352
|
if (!$num) { |
5353
|
|
- $output .= '<option value="-1" disabled>' . $langs->trans("NoCategoriesDefined") . '</option>'; |
|
5353
|
+ $output .= '<option value="-1" disabled>'.$langs->trans("NoCategoriesDefined").'</option>'; |
5354
|
5354
|
} else { |
5355
|
5355
|
if ($useempty == 1 || ($useempty == 2 && $num > 1)) { |
5356
|
5356
|
$output .= '<option value="-1"> </option>'; |
|
@@ -5362,15 +5362,15 @@ discard block |
|
|
block discarded – undo |
5362
|
5362
|
$add = ''; |
5363
|
5363
|
} |
5364
|
5364
|
|
5365
|
|
- $labeltoshow = img_picto('', 'category', 'class="pictofixedwidth" style="color: #' . $cate_arbo[$key]['color'] . '"'); |
|
5365
|
+ $labeltoshow = img_picto('', 'category', 'class="pictofixedwidth" style="color: #'.$cate_arbo[$key]['color'].'"'); |
5366
|
5366
|
$labeltoshow .= dol_trunc($cate_arbo[$key]['fulllabel'], $maxlength, 'middle'); |
5367
|
5367
|
|
5368
|
5368
|
$outarray[$cate_arbo[$key]['id']] = $cate_arbo[$key]['fulllabel']; |
5369
|
5369
|
|
5370
|
5370
|
$outarrayrichhtml[$cate_arbo[$key]['id']] = $labeltoshow; |
5371
|
5371
|
|
5372
|
|
- $output .= '<option ' . $add . 'value="' . $cate_arbo[$key]['id'] . '"'; |
5373
|
|
- $output .= ' data-html="' . dol_escape_htmltag($labeltoshow) . '"'; |
|
5372
|
+ $output .= '<option '.$add.'value="'.$cate_arbo[$key]['id'].'"'; |
|
5373
|
+ $output .= ' data-html="'.dol_escape_htmltag($labeltoshow).'"'; |
5374
|
5374
|
$output .= '>'; |
5375
|
5375
|
$output .= dol_trunc($cate_arbo[$key]['fulllabel'], $maxlength, 'middle'); |
5376
|
5376
|
$output .= '</option>'; |
|
@@ -5414,7 +5414,7 @@ discard block |
|
|
block discarded – undo |
5414
|
5414
|
public function form_confirm($page, $title, $question, $action, $formquestion = array(), $selectedchoice = "", $useajax = 0, $height = 170, $width = 500) |
5415
|
5415
|
{ |
5416
|
5416
|
// phpcs:enable |
5417
|
|
- dol_syslog(__METHOD__ . ': using form_confirm is deprecated. Use formconfim instead.', LOG_WARNING); |
|
5417
|
+ dol_syslog(__METHOD__.': using form_confirm is deprecated. Use formconfim instead.', LOG_WARNING); |
5418
|
5418
|
print $this->formconfirm($page, $title, $question, $action, $formquestion, $selectedchoice, $useajax, $height, $width); |
5419
|
5419
|
} |
5420
|
5420
|
|
|
@@ -5449,7 +5449,7 @@ discard block |
|
|
block discarded – undo |
5449
|
5449
|
{ |
5450
|
5450
|
global $langs, $conf; |
5451
|
5451
|
|
5452
|
|
- $more = '<!-- formconfirm - before call, page=' . dol_escape_htmltag($page) . ' -->'; |
|
5452
|
+ $more = '<!-- formconfirm - before call, page='.dol_escape_htmltag($page).' -->'; |
5453
|
5453
|
$formconfirm = ''; |
5454
|
5454
|
$inputok = array(); |
5455
|
5455
|
$inputko = array(); |
|
@@ -5473,27 +5473,27 @@ discard block |
|
|
block discarded – undo |
5473
|
5473
|
foreach ($formquestion as $key => $input) { |
5474
|
5474
|
if (is_array($input) && !empty($input)) { |
5475
|
5475
|
if ($input['type'] == 'hidden') { |
5476
|
|
- $moreattr = (!empty($input['moreattr']) ? ' ' . $input['moreattr'] : ''); |
5477
|
|
- $morecss = (!empty($input['morecss']) ? ' ' . $input['morecss'] : ''); |
|
5476
|
+ $moreattr = (!empty($input['moreattr']) ? ' '.$input['moreattr'] : ''); |
|
5477
|
+ $morecss = (!empty($input['morecss']) ? ' '.$input['morecss'] : ''); |
5478
|
5478
|
|
5479
|
|
- $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"; |
|
5479
|
+ $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"; |
5480
|
5480
|
} |
5481
|
5481
|
} |
5482
|
5482
|
} |
5483
|
5483
|
|
5484
|
5484
|
// Now add questions |
5485
|
5485
|
$moreonecolumn = ''; |
5486
|
|
- $more .= '<div class="tagtable paddingtopbottomonly centpercent noborderspacing">' . "\n"; |
|
5486
|
+ $more .= '<div class="tagtable paddingtopbottomonly centpercent noborderspacing">'."\n"; |
5487
|
5487
|
foreach ($formquestion as $key => $input) { |
5488
|
5488
|
if (is_array($input) && !empty($input)) { |
5489
|
|
- $size = (!empty($input['size']) ? ' size="' . $input['size'] . '"' : ''); // deprecated. Use morecss instead. |
5490
|
|
- $moreattr = (!empty($input['moreattr']) ? ' ' . $input['moreattr'] : ''); |
5491
|
|
- $morecss = (!empty($input['morecss']) ? ' ' . $input['morecss'] : ''); |
|
5489
|
+ $size = (!empty($input['size']) ? ' size="'.$input['size'].'"' : ''); // deprecated. Use morecss instead. |
|
5490
|
+ $moreattr = (!empty($input['moreattr']) ? ' '.$input['moreattr'] : ''); |
|
5491
|
+ $morecss = (!empty($input['morecss']) ? ' '.$input['morecss'] : ''); |
5492
|
5492
|
|
5493
|
5493
|
if ($input['type'] == 'text') { |
5494
|
|
- $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"; |
|
5494
|
+ $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"; |
5495
|
5495
|
} elseif ($input['type'] == 'password') { |
5496
|
|
- $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"; |
|
5496
|
+ $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"; |
5497
|
5497
|
} elseif ($input['type'] == 'textarea') { |
5498
|
5498
|
/*$more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">'.$input['label'].'</div><div class="tagtd">'; |
5499
|
5499
|
$more .= '<textarea name="'.$input['name'].'" class="'.$morecss.'"'.$moreattr.'>'; |
|
@@ -5501,8 +5501,8 @@ discard block |
|
|
block discarded – undo |
5501
|
5501
|
$more .= '</textarea>'; |
5502
|
5502
|
$more .= '</div></div>'."\n";*/ |
5503
|
5503
|
$moreonecolumn .= '<div class="margintoponly">'; |
5504
|
|
- $moreonecolumn .= $input['label'] . '<br>'; |
5505
|
|
- $moreonecolumn .= '<textarea name="' . dol_escape_htmltag($input['name']) . '" id="' . dol_escape_htmltag($input['name']) . '" class="' . $morecss . '"' . $moreattr . '>'; |
|
5504
|
+ $moreonecolumn .= $input['label'].'<br>'; |
|
5505
|
+ $moreonecolumn .= '<textarea name="'.dol_escape_htmltag($input['name']).'" id="'.dol_escape_htmltag($input['name']).'" class="'.$morecss.'"'.$moreattr.'>'; |
5506
|
5506
|
$moreonecolumn .= $input['value']; |
5507
|
5507
|
$moreonecolumn .= '</textarea>'; |
5508
|
5508
|
$moreonecolumn .= '</div>'; |
|
@@ -5519,20 +5519,20 @@ discard block |
|
|
block discarded – undo |
5519
|
5519
|
$disabled = isset($input['select_disabled']) ? $input['select_disabled'] : 0; |
5520
|
5520
|
$sort = isset($input['select_sort']) ? $input['select_sort'] : ''; |
5521
|
5521
|
|
5522
|
|
- $more .= '<div class="tagtr"><div class="tagtd' . (empty($input['tdclass']) ? '' : (' ' . $input['tdclass'])) . '">'; |
|
5522
|
+ $more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">'; |
5523
|
5523
|
if (!empty($input['label'])) { |
5524
|
|
- $more .= $input['label'] . '</div><div class="tagtd left">'; |
|
5524
|
+ $more .= $input['label'].'</div><div class="tagtd left">'; |
5525
|
5525
|
} |
5526
|
5526
|
if ($input['type'] == 'select') { |
5527
|
5527
|
$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); |
5528
|
5528
|
} else { |
5529
|
5529
|
$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); |
5530
|
5530
|
} |
5531
|
|
- $more .= '</div></div>' . "\n"; |
|
5531
|
+ $more .= '</div></div>'."\n"; |
5532
|
5532
|
} elseif ($input['type'] == 'checkbox') { |
5533
|
5533
|
$more .= '<div class="tagtr">'; |
5534
|
|
- $more .= '<div class="tagtd' . (empty($input['tdclass']) ? '' : (' ' . $input['tdclass'])) . '"><label for="' . dol_escape_htmltag($input['name']) . '">' . $input['label'] . '</label></div><div class="tagtd">'; |
5535
|
|
- $more .= '<input type="checkbox" class="flat' . ($morecss ? ' ' . $morecss : '') . '" id="' . dol_escape_htmltag($input['name']) . '" name="' . dol_escape_htmltag($input['name']) . '"' . $moreattr; |
|
5534
|
+ $more .= '<div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'"><label for="'.dol_escape_htmltag($input['name']).'">'.$input['label'].'</label></div><div class="tagtd">'; |
|
5535
|
+ $more .= '<input type="checkbox" class="flat'.($morecss ? ' '.$morecss : '').'" id="'.dol_escape_htmltag($input['name']).'" name="'.dol_escape_htmltag($input['name']).'"'.$moreattr; |
5536
|
5536
|
if (!is_bool($input['value']) && $input['value'] != 'false' && $input['value'] != '0' && $input['value'] != '') { |
5537
|
5537
|
$more .= ' checked'; |
5538
|
5538
|
} |
|
@@ -5543,19 +5543,19 @@ discard block |
|
|
block discarded – undo |
5543
|
5543
|
$more .= ' disabled'; |
5544
|
5544
|
} |
5545
|
5545
|
$more .= ' /></div>'; |
5546
|
|
- $more .= '</div>' . "\n"; |
|
5546
|
+ $more .= '</div>'."\n"; |
5547
|
5547
|
} elseif ($input['type'] == 'radio') { |
5548
|
5548
|
$i = 0; |
5549
|
5549
|
foreach ($input['values'] as $selkey => $selval) { |
5550
|
5550
|
$more .= '<div class="tagtr">'; |
5551
|
5551
|
if (isset($input['label'])) { |
5552
|
5552
|
if ($i == 0) { |
5553
|
|
- $more .= '<div class="tagtd' . (empty($input['tdclass']) ? ' tdtop' : (' tdtop ' . $input['tdclass'])) . '">' . $input['label'] . '</div>'; |
|
5553
|
+ $more .= '<div class="tagtd'.(empty($input['tdclass']) ? ' tdtop' : (' tdtop '.$input['tdclass'])).'">'.$input['label'].'</div>'; |
5554
|
5554
|
} else { |
5555
|
|
- $more .= '<div class="tagtd' . (empty($input['tdclass']) ? '' : (' "' . $input['tdclass'])) . '"> </div>'; |
|
5555
|
+ $more .= '<div class="tagtd'.(empty($input['tdclass']) ? '' : (' "'.$input['tdclass'])).'"> </div>'; |
5556
|
5556
|
} |
5557
|
5557
|
} |
5558
|
|
- $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; |
|
5558
|
+ $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; |
5559
|
5559
|
if (!empty($input['disabled'])) { |
5560
|
5560
|
$more .= ' disabled'; |
5561
|
5561
|
} |
|
@@ -5563,12 +5563,12 @@ discard block |
|
|
block discarded – undo |
5563
|
5563
|
$more .= ' checked="checked"'; |
5564
|
5564
|
} |
5565
|
5565
|
$more .= ' /> '; |
5566
|
|
- $more .= '<label for="' . dol_escape_htmltag($input['name'] . $selkey) . '" class="valignmiddle">' . $selval . '</label>'; |
5567
|
|
- $more .= '</div></div>' . "\n"; |
|
5566
|
+ $more .= '<label for="'.dol_escape_htmltag($input['name'].$selkey).'" class="valignmiddle">'.$selval.'</label>'; |
|
5567
|
+ $more .= '</div></div>'."\n"; |
5568
|
5568
|
$i++; |
5569
|
5569
|
} |
5570
|
5570
|
} elseif ($input['type'] == 'date' || $input['type'] == 'datetime') { |
5571
|
|
- $more .= '<div class="tagtr"><div class="tagtd' . (empty($input['tdclass']) ? '' : (' ' . $input['tdclass'])) . '">' . $input['label'] . '</div>'; |
|
5571
|
+ $more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">'.$input['label'].'</div>'; |
5572
|
5572
|
$more .= '<div class="tagtd">'; |
5573
|
5573
|
$addnowlink = (empty($input['datenow']) ? 0 : 1); |
5574
|
5574
|
$h = $m = 0; |
|
@@ -5586,24 +5586,24 @@ discard block |
|
|
block discarded – undo |
5586
|
5586
|
} elseif ($input['type'] == 'other') { // can be 1 column or 2 depending if label is set or not |
5587
|
5587
|
$more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">'; |
5588
|
5588
|
if (!empty($input['label'])) { |
5589
|
|
- $more .= $input['label'] . '</div><div class="tagtd">'; |
|
5589
|
+ $more .= $input['label'].'</div><div class="tagtd">'; |
5590
|
5590
|
} |
5591
|
5591
|
$more .= $input['value']; |
5592
|
|
- $more .= '</div></div>' . "\n"; |
|
5592
|
+ $more .= '</div></div>'."\n"; |
5593
|
5593
|
} elseif ($input['type'] == 'onecolumn') { |
5594
|
5594
|
$moreonecolumn .= '<div class="margintoponly">'; |
5595
|
5595
|
$moreonecolumn .= $input['value']; |
5596
|
|
- $moreonecolumn .= '</div>' . "\n"; |
|
5596
|
+ $moreonecolumn .= '</div>'."\n"; |
5597
|
5597
|
} elseif ($input['type'] == 'hidden') { |
5598
|
5598
|
// Do nothing more, already added by a previous loop |
5599
|
5599
|
} elseif ($input['type'] == 'separator') { |
5600
|
5600
|
$more .= '<br>'; |
5601
|
5601
|
} else { |
5602
|
|
- $more .= 'Error type ' . $input['type'] . ' for the confirm box is not a supported type'; |
|
5602
|
+ $more .= 'Error type '.$input['type'].' for the confirm box is not a supported type'; |
5603
|
5603
|
} |
5604
|
5604
|
} |
5605
|
5605
|
} |
5606
|
|
- $more .= '</div>' . "\n"; |
|
5606
|
+ $more .= '</div>'."\n"; |
5607
|
5607
|
$more .= $moreonecolumn; |
5608
|
5608
|
} |
5609
|
5609
|
|
|
@@ -5625,10 +5625,10 @@ discard block |
|
|
block discarded – undo |
5625
|
5625
|
$button = $useajax; |
5626
|
5626
|
$useajax = 1; |
5627
|
5627
|
$autoOpen = false; |
5628
|
|
- $dialogconfirm .= '-' . $button; |
|
5628
|
+ $dialogconfirm .= '-'.$button; |
5629
|
5629
|
} |
5630
|
|
- $pageyes = $page . (preg_match('/\?/', $page) ? '&' : '?') . 'action=' . urlencode($action) . '&confirm=yes'; |
5631
|
|
- $pageno = ($useajax == 2 ? $page . (preg_match('/\?/', $page) ? '&' : '?') . 'action=' . urlencode($action) . '&confirm=no' : ''); |
|
5630
|
+ $pageyes = $page.(preg_match('/\?/', $page) ? '&' : '?').'action='.urlencode($action).'&confirm=yes'; |
|
5631
|
+ $pageno = ($useajax == 2 ? $page.(preg_match('/\?/', $page) ? '&' : '?').'action='.urlencode($action).'&confirm=no' : ''); |
5632
|
5632
|
|
5633
|
5633
|
// Add input fields into list of fields to read during submit (inputok and inputko) |
5634
|
5634
|
if (is_array($formquestion)) { |
|
@@ -5651,24 +5651,24 @@ discard block |
|
|
block discarded – undo |
5651
|
5651
|
} |
5652
|
5652
|
|
5653
|
5653
|
// Show JQuery confirm box. |
5654
|
|
- $formconfirm .= '<div id="' . $dialogconfirm . '" title="' . dol_escape_htmltag($title) . '" style="display: none;">'; |
|
5654
|
+ $formconfirm .= '<div id="'.$dialogconfirm.'" title="'.dol_escape_htmltag($title).'" style="display: none;">'; |
5655
|
5655
|
if (is_array($formquestion) && array_key_exists('text', $formquestion) && !empty($formquestion['text'])) { |
5656
|
|
- $formconfirm .= '<div class="confirmtext">' . $formquestion['text'] . '</div>' . "\n"; |
|
5656
|
+ $formconfirm .= '<div class="confirmtext">'.$formquestion['text'].'</div>'."\n"; |
5657
|
5657
|
} |
5658
|
5658
|
if (!empty($more)) { |
5659
|
|
- $formconfirm .= '<div class="confirmquestions">' . $more . '</div>' . "\n"; |
|
5659
|
+ $formconfirm .= '<div class="confirmquestions">'.$more.'</div>'."\n"; |
5660
|
5660
|
} |
5661
|
|
- $formconfirm .= ($question ? '<div class="confirmmessage">' . img_help(0, '') . ' ' . $question . '</div>' : ''); |
5662
|
|
- $formconfirm .= '</div>' . "\n"; |
|
5661
|
+ $formconfirm .= ($question ? '<div class="confirmmessage">'.img_help(0, '').' '.$question.'</div>' : ''); |
|
5662
|
+ $formconfirm .= '</div>'."\n"; |
5663
|
5663
|
|
5664
|
|
- $formconfirm .= "\n<!-- begin code of popup for formconfirm page=" . $page . " -->\n"; |
5665
|
|
- $formconfirm .= '<script nonce="' . getNonce() . '" type="text/javascript">' . "\n"; |
|
5664
|
+ $formconfirm .= "\n<!-- begin code of popup for formconfirm page=".$page." -->\n"; |
|
5665
|
+ $formconfirm .= '<script nonce="'.getNonce().'" type="text/javascript">'."\n"; |
5666
|
5666
|
$formconfirm .= "/* Code for the jQuery('#dialogforpopup').dialog() */\n"; |
5667
|
5667
|
$formconfirm .= 'jQuery(document).ready(function() { |
5668
|
5668
|
$(function() { |
5669
|
|
- $( "#' . $dialogconfirm . '" ).dialog( |
|
5669
|
+ $( "#' . $dialogconfirm.'" ).dialog( |
5670
|
5670
|
{ |
5671
|
|
- autoOpen: ' . ($autoOpen ? "true" : "false") . ','; |
|
5671
|
+ autoOpen: ' . ($autoOpen ? "true" : "false").','; |
5672
|
5672
|
if ($newselectedchoice == 'no') { |
5673
|
5673
|
$formconfirm .= ' |
5674
|
5674
|
open: function() { |
|
@@ -5678,24 +5678,24 @@ discard block |
|
|
block discarded – undo |
5678
|
5678
|
|
5679
|
5679
|
$jsforcursor = ''; |
5680
|
5680
|
if ($useajax == 1) { |
5681
|
|
- $jsforcursor = '// The call to urljump can be slow, so we set the wait cursor' . "\n"; |
5682
|
|
- $jsforcursor .= 'jQuery("html,body,#id-container").addClass("cursorwait");' . "\n"; |
|
5681
|
+ $jsforcursor = '// The call to urljump can be slow, so we set the wait cursor'."\n"; |
|
5682
|
+ $jsforcursor .= 'jQuery("html,body,#id-container").addClass("cursorwait");'."\n"; |
5683
|
5683
|
} |
5684
|
5684
|
|
5685
|
5685
|
$postconfirmas = 'GET'; |
5686
|
5686
|
|
5687
|
5687
|
$formconfirm .= ' |
5688
|
5688
|
resizable: false, |
5689
|
|
- height: "' . $height . '", |
5690
|
|
- width: "' . $width . '", |
|
5689
|
+ height: "' . $height.'", |
|
5690
|
+ width: "' . $width.'", |
5691
|
5691
|
modal: true, |
5692
|
5692
|
closeOnEscape: false, |
5693
|
5693
|
buttons: { |
5694
|
|
- "' . dol_escape_js($langs->transnoentities($labelbuttonyes)) . '": function() { |
5695
|
|
- var options = "token=' . urlencode(newToken()) . '"; |
5696
|
|
- var inputok = ' . json_encode($inputok) . '; /* List of fields into form */ |
5697
|
|
- var page = "' . dol_escape_js(!empty($page) ? $page : '') . '"; |
5698
|
|
- var pageyes = "' . dol_escape_js(!empty($pageyes) ? $pageyes : '') . '"; |
|
5694
|
+ "' . dol_escape_js($langs->transnoentities($labelbuttonyes)).'": function() { |
|
5695
|
+ var options = "token=' . urlencode(newToken()).'"; |
|
5696
|
+ var inputok = ' . json_encode($inputok).'; /* List of fields into form */ |
|
5697
|
+ var page = "' . dol_escape_js(!empty($page) ? $page : '').'"; |
|
5698
|
+ var pageyes = "' . dol_escape_js(!empty($pageyes) ? $pageyes : '').'"; |
5699
|
5699
|
|
5700
|
5700
|
if (inputok.length > 0) { |
5701
|
5701
|
$.each(inputok, function(i, inputname) { |
|
@@ -5729,11 +5729,11 @@ discard block |
|
|
block discarded – undo |
5729
|
5729
|
} |
5730
|
5730
|
$(this).dialog("close"); |
5731
|
5731
|
}, |
5732
|
|
- "' . dol_escape_js($langs->transnoentities($labelbuttonno)) . '": function() { |
5733
|
|
- var options = "token=' . urlencode(newToken()) . '"; |
5734
|
|
- var inputko = ' . json_encode($inputko) . '; /* List of fields into form */ |
5735
|
|
- var page = "' . dol_escape_js(!empty($page) ? $page : '') . '"; |
5736
|
|
- var pageno="' . dol_escape_js(!empty($pageno) ? $pageno : '') . '"; |
|
5732
|
+ "' . dol_escape_js($langs->transnoentities($labelbuttonno)).'": function() { |
|
5733
|
+ var options = "token=' . urlencode(newToken()).'"; |
|
5734
|
+ var inputko = ' . json_encode($inputko).'; /* List of fields into form */ |
|
5735
|
+ var page = "' . dol_escape_js(!empty($page) ? $page : '').'"; |
|
5736
|
+ var pageno="' . dol_escape_js(!empty($pageno) ? $pageno : '').'"; |
5737
|
5737
|
if (inputko.length > 0) { |
5738
|
5738
|
$.each(inputko, function(i, inputname) { |
5739
|
5739
|
var more = ""; |
|
@@ -5765,10 +5765,10 @@ discard block |
|
|
block discarded – undo |
5765
|
5765
|
} |
5766
|
5766
|
); |
5767
|
5767
|
|
5768
|
|
- var button = "' . $button . '"; |
|
5768
|
+ var button = "' . $button.'"; |
5769
|
5769
|
if (button.length > 0) { |
5770
|
5770
|
$( "#" + button ).click(function() { |
5771
|
|
- $("#' . $dialogconfirm . '").dialog("open"); |
|
5771
|
+ $("#' . $dialogconfirm.'").dialog("open"); |
5772
|
5772
|
}); |
5773
|
5773
|
} |
5774
|
5774
|
}); |
|
@@ -5776,44 +5776,44 @@ discard block |
|
|
block discarded – undo |
5776
|
5776
|
</script>'; |
5777
|
5777
|
$formconfirm .= "<!-- end ajax formconfirm -->\n"; |
5778
|
5778
|
} else { |
5779
|
|
- $formconfirm .= "\n<!-- begin formconfirm page=" . dol_escape_htmltag($page) . " -->\n"; |
|
5779
|
+ $formconfirm .= "\n<!-- begin formconfirm page=".dol_escape_htmltag($page)." -->\n"; |
5780
|
5780
|
|
5781
|
5781
|
if (empty($disableformtag)) { |
5782
|
|
- $formconfirm .= '<form method="POST" action="' . $page . '" class="notoptoleftroright">' . "\n"; |
|
5782
|
+ $formconfirm .= '<form method="POST" action="'.$page.'" class="notoptoleftroright">'."\n"; |
5783
|
5783
|
} |
5784
|
5784
|
|
5785
|
|
- $formconfirm .= '<input type="hidden" name="action" value="' . $action . '">' . "\n"; |
5786
|
|
- $formconfirm .= '<input type="hidden" name="token" value="' . newToken() . '">' . "\n"; |
|
5785
|
+ $formconfirm .= '<input type="hidden" name="action" value="'.$action.'">'."\n"; |
|
5786
|
+ $formconfirm .= '<input type="hidden" name="token" value="'.newToken().'">'."\n"; |
5787
|
5787
|
|
5788
|
|
- $formconfirm .= '<table class="valid centpercent">' . "\n"; |
|
5788
|
+ $formconfirm .= '<table class="valid centpercent">'."\n"; |
5789
|
5789
|
|
5790
|
5790
|
// Line title |
5791
|
5791
|
$formconfirm .= '<tr class="validtitre"><td class="validtitre" colspan="2">'; |
5792
|
|
- $formconfirm .= img_picto('', 'pictoconfirm') . ' ' . $title; |
5793
|
|
- $formconfirm .= '</td></tr>' . "\n"; |
|
5792
|
+ $formconfirm .= img_picto('', 'pictoconfirm').' '.$title; |
|
5793
|
+ $formconfirm .= '</td></tr>'."\n"; |
5794
|
5794
|
|
5795
|
5795
|
// Line text |
5796
|
5796
|
if (is_array($formquestion) && array_key_exists('text', $formquestion) && !empty($formquestion['text'])) { |
5797
|
|
- $formconfirm .= '<tr class="valid"><td class="valid" colspan="2">' . $formquestion['text'] . '</td></tr>' . "\n"; |
|
5797
|
+ $formconfirm .= '<tr class="valid"><td class="valid" colspan="2">'.$formquestion['text'].'</td></tr>'."\n"; |
5798
|
5798
|
} |
5799
|
5799
|
|
5800
|
5800
|
// Line form fields |
5801
|
5801
|
if ($more) { |
5802
|
|
- $formconfirm .= '<tr class="valid"><td class="valid" colspan="2">' . "\n"; |
|
5802
|
+ $formconfirm .= '<tr class="valid"><td class="valid" colspan="2">'."\n"; |
5803
|
5803
|
$formconfirm .= $more; |
5804
|
|
- $formconfirm .= '</td></tr>' . "\n"; |
|
5804
|
+ $formconfirm .= '</td></tr>'."\n"; |
5805
|
5805
|
} |
5806
|
5806
|
|
5807
|
5807
|
// Line with question |
5808
|
5808
|
$formconfirm .= '<tr class="valid">'; |
5809
|
|
- $formconfirm .= '<td class="valid">' . $question . '</td>'; |
|
5809
|
+ $formconfirm .= '<td class="valid">'.$question.'</td>'; |
5810
|
5810
|
$formconfirm .= '<td class="valid center">'; |
5811
|
5811
|
$formconfirm .= $this->selectyesno("confirm", $newselectedchoice, 0, false, 0, 0, 'marginleftonly marginrightonly', $labelbuttonyes, $labelbuttonno); |
5812
|
|
- $formconfirm .= '<input class="button valignmiddle confirmvalidatebutton small" type="submit" value="' . $langs->trans("Validate") . '">'; |
|
5812
|
+ $formconfirm .= '<input class="button valignmiddle confirmvalidatebutton small" type="submit" value="'.$langs->trans("Validate").'">'; |
5813
|
5813
|
$formconfirm .= '</td>'; |
5814
|
|
- $formconfirm .= '</tr>' . "\n"; |
|
5814
|
+ $formconfirm .= '</tr>'."\n"; |
5815
|
5815
|
|
5816
|
|
- $formconfirm .= '</table>' . "\n"; |
|
5816
|
+ $formconfirm .= '</table>'."\n"; |
5817
|
5817
|
|
5818
|
5818
|
if (empty($disableformtag)) { |
5819
|
5819
|
$formconfirm .= "</form>\n"; |
|
@@ -5822,7 +5822,7 @@ discard block |
|
|
block discarded – undo |
5822
|
5822
|
|
5823
|
5823
|
if (!empty($conf->use_javascript_ajax)) { |
5824
|
5824
|
$formconfirm .= '<!-- code to disable button to avoid double clic -->'; |
5825
|
|
- $formconfirm .= '<script nonce="' . getNonce() . '" type="text/javascript">' . "\n"; |
|
5825
|
+ $formconfirm .= '<script nonce="'.getNonce().'" type="text/javascript">'."\n"; |
5826
|
5826
|
$formconfirm .= ' |
5827
|
5827
|
$(document).ready(function () { |
5828
|
5828
|
$(".confirmvalidatebutton").on("click", function() { |
|
@@ -5834,7 +5834,7 @@ discard block |
|
|
block discarded – undo |
5834
|
5834
|
}); |
5835
|
5835
|
}); |
5836
|
5836
|
'; |
5837
|
|
- $formconfirm .= '</script>' . "\n"; |
|
5837
|
+ $formconfirm .= '</script>'."\n"; |
5838
|
5838
|
} |
5839
|
5839
|
|
5840
|
5840
|
$formconfirm .= "<!-- end formconfirm -->\n"; |
|
@@ -5866,8 +5866,8 @@ discard block |
|
|
block discarded – undo |
5866
|
5866
|
// phpcs:enable |
5867
|
5867
|
global $langs; |
5868
|
5868
|
|
5869
|
|
- require_once DOL_DOCUMENT_ROOT . '/core/lib/project.lib.php'; |
5870
|
|
- require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php'; |
|
5869
|
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php'; |
|
5870
|
+ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; |
5871
|
5871
|
|
5872
|
5872
|
$out = ''; |
5873
|
5873
|
|
|
@@ -5875,11 +5875,11 @@ discard block |
|
|
block discarded – undo |
5875
|
5875
|
|
5876
|
5876
|
$langs->load("project"); |
5877
|
5877
|
if ($htmlname != "none") { |
5878
|
|
- $out .= '<form method="post" action="' . $page . '">'; |
|
5878
|
+ $out .= '<form method="post" action="'.$page.'">'; |
5879
|
5879
|
$out .= '<input type="hidden" name="action" value="classin">'; |
5880
|
|
- $out .= '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
5880
|
+ $out .= '<input type="hidden" name="token" value="'.newToken().'">'; |
5881
|
5881
|
$out .= $formproject->select_projects($socid, $selected, $htmlname, $maxlength, 0, 1, $discard_closed, $forcefocus, 0, 0, '', 1, 0, $morecss); |
5882
|
|
- $out .= '<input type="submit" class="button smallpaddingimp" value="' . $langs->trans("Modify") . '">'; |
|
5882
|
+ $out .= '<input type="submit" class="button smallpaddingimp" value="'.$langs->trans("Modify").'">'; |
5883
|
5883
|
$out .= '</form>'; |
5884
|
5884
|
} else { |
5885
|
5885
|
$out .= '<span class="project_head_block">'; |
|
@@ -5888,7 +5888,7 @@ discard block |
|
|
block discarded – undo |
5888
|
5888
|
$projet->fetch($selected); |
5889
|
5889
|
$out .= $projet->getNomUrl(0, '', 1); |
5890
|
5890
|
} else { |
5891
|
|
- $out .= '<span class="opacitymedium">' . $textifnoproject . '</span>'; |
|
5891
|
+ $out .= '<span class="opacitymedium">'.$textifnoproject.'</span>'; |
5892
|
5892
|
} |
5893
|
5893
|
$out .= '</span>'; |
5894
|
5894
|
} |
|
@@ -5925,14 +5925,14 @@ discard block |
|
|
block discarded – undo |
5925
|
5925
|
$out = ''; |
5926
|
5926
|
|
5927
|
5927
|
if ($htmlname != "none") { |
5928
|
|
- $out .= '<form method="POST" action="' . $page . '">'; |
|
5928
|
+ $out .= '<form method="POST" action="'.$page.'">'; |
5929
|
5929
|
$out .= '<input type="hidden" name="action" value="setconditions">'; |
5930
|
|
- $out .= '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
5930
|
+ $out .= '<input type="hidden" name="token" value="'.newToken().'">'; |
5931
|
5931
|
if ($type) { |
5932
|
|
- $out .= '<input type="hidden" name="type" value="' . dol_escape_htmltag($type) . '">'; |
|
5932
|
+ $out .= '<input type="hidden" name="type" value="'.dol_escape_htmltag($type).'">'; |
5933
|
5933
|
} |
5934
|
5934
|
$out .= $this->getSelectConditionsPaiements($selected, $htmlname, $filtertype, $addempty, 0, '', $deposit_percent); |
5935
|
|
- $out .= '<input type="submit" class="button valignmiddle smallpaddingimp" value="' . $langs->trans("Modify") . '">'; |
|
5935
|
+ $out .= '<input type="submit" class="button valignmiddle smallpaddingimp" value="'.$langs->trans("Modify").'">'; |
5936
|
5936
|
$out .= '</form>'; |
5937
|
5937
|
} else { |
5938
|
5938
|
if ($selected) { |
|
@@ -5977,12 +5977,12 @@ discard block |
|
|
block discarded – undo |
5977
|
5977
|
// phpcs:enable |
5978
|
5978
|
global $langs; |
5979
|
5979
|
if ($htmlname != "none") { |
5980
|
|
- print '<form method="post" action="' . $page . '">'; |
|
5980
|
+ print '<form method="post" action="'.$page.'">'; |
5981
|
5981
|
print '<input type="hidden" name="action" value="setavailability">'; |
5982
|
|
- print '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
5982
|
+ print '<input type="hidden" name="token" value="'.newToken().'">'; |
5983
|
5983
|
$this->selectAvailabilityDelay($selected, $htmlname, -1, $addempty); |
5984
|
|
- print '<input type="submit" name="modify" class="button smallpaddingimp" value="' . $langs->trans("Modify") . '">'; |
5985
|
|
- print '<input type="submit" name="cancel" class="button smallpaddingimp" value="' . $langs->trans("Cancel") . '">'; |
|
5984
|
+ print '<input type="submit" name="modify" class="button smallpaddingimp" value="'.$langs->trans("Modify").'">'; |
|
5985
|
+ print '<input type="submit" name="cancel" class="button smallpaddingimp" value="'.$langs->trans("Cancel").'">'; |
5986
|
5986
|
print '</form>'; |
5987
|
5987
|
} else { |
5988
|
5988
|
if ($selected) { |
|
@@ -6008,11 +6008,11 @@ discard block |
|
|
block discarded – undo |
6008
|
6008
|
{ |
6009
|
6009
|
global $langs; |
6010
|
6010
|
if ($htmlname != "none") { |
6011
|
|
- print '<form method="post" action="' . $page . '">'; |
|
6011
|
+ print '<form method="post" action="'.$page.'">'; |
6012
|
6012
|
print '<input type="hidden" name="action" value="setdemandreason">'; |
6013
|
|
- print '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
6013
|
+ print '<input type="hidden" name="token" value="'.newToken().'">'; |
6014
|
6014
|
$this->selectInputReason($selected, $htmlname, -1, $addempty); |
6015
|
|
- print '<input type="submit" class="button smallpaddingimp" value="' . $langs->trans("Modify") . '">'; |
|
6015
|
+ print '<input type="submit" class="button smallpaddingimp" value="'.$langs->trans("Modify").'">'; |
6016
|
6016
|
print '</form>'; |
6017
|
6017
|
} else { |
6018
|
6018
|
if ($selected) { |
|
@@ -6052,17 +6052,17 @@ discard block |
|
|
block discarded – undo |
6052
|
6052
|
$ret = ''; |
6053
|
6053
|
|
6054
|
6054
|
if ($htmlname != "none") { |
6055
|
|
- $ret .= '<form method="POST" action="' . $page . '" name="form' . $htmlname . '">'; |
6056
|
|
- $ret .= '<input type="hidden" name="action" value="set' . $htmlname . '">'; |
6057
|
|
- $ret .= '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
6055
|
+ $ret .= '<form method="POST" action="'.$page.'" name="form'.$htmlname.'">'; |
|
6056
|
+ $ret .= '<input type="hidden" name="action" value="set'.$htmlname.'">'; |
|
6057
|
+ $ret .= '<input type="hidden" name="token" value="'.newToken().'">'; |
6058
|
6058
|
if ($type) { |
6059
|
|
- $ret .= '<input type="hidden" name="type" value="' . dol_escape_htmltag($type) . '">'; |
|
6059
|
+ $ret .= '<input type="hidden" name="type" value="'.dol_escape_htmltag($type).'">'; |
6060
|
6060
|
} |
6061
|
6061
|
$ret .= '<table class="nobordernopadding">'; |
6062
|
6062
|
$ret .= '<tr><td>'; |
6063
|
|
- $ret .= $this->selectDate($selected, $htmlname, $displayhour, $displaymin, 1, 'form' . $htmlname, 1, 0); |
|
6063
|
+ $ret .= $this->selectDate($selected, $htmlname, $displayhour, $displaymin, 1, 'form'.$htmlname, 1, 0); |
6064
|
6064
|
$ret .= '</td>'; |
6065
|
|
- $ret .= '<td class="left"><input type="submit" class="button smallpaddingimp" value="' . $langs->trans("Modify") . '"></td>'; |
|
6065
|
+ $ret .= '<td class="left"><input type="submit" class="button smallpaddingimp" value="'.$langs->trans("Modify").'"></td>'; |
6066
|
6066
|
$ret .= '</tr></table></form>'; |
6067
|
6067
|
} else { |
6068
|
6068
|
if ($displayhour) { |
|
@@ -6097,15 +6097,15 @@ discard block |
|
|
block discarded – undo |
6097
|
6097
|
global $langs; |
6098
|
6098
|
|
6099
|
6099
|
if ($htmlname != "none") { |
6100
|
|
- print '<form method="POST" action="' . $page . '" name="form' . $htmlname . '">'; |
6101
|
|
- print '<input type="hidden" name="action" value="set' . $htmlname . '">'; |
6102
|
|
- print '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
6100
|
+ print '<form method="POST" action="'.$page.'" name="form'.$htmlname.'">'; |
|
6101
|
+ print '<input type="hidden" name="action" value="set'.$htmlname.'">'; |
|
6102
|
+ print '<input type="hidden" name="token" value="'.newToken().'">'; |
6103
|
6103
|
print $this->select_dolusers($selected, $htmlname, 1, $exclude, 0, $include); |
6104
|
|
- print '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">'; |
|
6104
|
+ print '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">'; |
6105
|
6105
|
print '</form>'; |
6106
|
6106
|
} else { |
6107
|
6107
|
if ($selected) { |
6108
|
|
- require_once DOL_DOCUMENT_ROOT . '/user/class/user.class.php'; |
|
6108
|
+ require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; |
6109
|
6109
|
$theuser = new User($this->db); |
6110
|
6110
|
$theuser->fetch($selected); |
6111
|
6111
|
print $theuser->getNomUrl(1); |
|
@@ -6138,14 +6138,14 @@ discard block |
|
|
block discarded – undo |
6138
|
6138
|
|
6139
|
6139
|
$out = ''; |
6140
|
6140
|
if ($htmlname != "none") { |
6141
|
|
- $out .= '<form method="POST" action="' . $page . '">'; |
|
6141
|
+ $out .= '<form method="POST" action="'.$page.'">'; |
6142
|
6142
|
$out .= '<input type="hidden" name="action" value="setmode">'; |
6143
|
|
- $out .= '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
6143
|
+ $out .= '<input type="hidden" name="token" value="'.newToken().'">'; |
6144
|
6144
|
if ($type) { |
6145
|
|
- $out .= '<input type="hidden" name="type" value="' . dol_escape_htmltag($type) . '">'; |
|
6145
|
+ $out .= '<input type="hidden" name="type" value="'.dol_escape_htmltag($type).'">'; |
6146
|
6146
|
} |
6147
|
6147
|
$out .= $this->select_types_paiements($selected, $htmlname, $filtertype, 0, $addempty, 0, 0, $active, '', 1); |
6148
|
|
- $out .= '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">'; |
|
6148
|
+ $out .= '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">'; |
6149
|
6149
|
$out .= '</form>'; |
6150
|
6150
|
} else { |
6151
|
6151
|
if ($selected) { |
|
@@ -6178,11 +6178,11 @@ discard block |
|
|
block discarded – undo |
6178
|
6178
|
{ |
6179
|
6179
|
global $langs; |
6180
|
6180
|
if ($htmlname != "none") { |
6181
|
|
- print '<form method="POST" action="' . $page . '">'; |
|
6181
|
+ print '<form method="POST" action="'.$page.'">'; |
6182
|
6182
|
print '<input type="hidden" name="action" value="settransportmode">'; |
6183
|
|
- print '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
6183
|
+ print '<input type="hidden" name="token" value="'.newToken().'">'; |
6184
|
6184
|
$this->selectTransportMode($selected, $htmlname, 0, $addempty, 0, 0, $active); |
6185
|
|
- print '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">'; |
|
6185
|
+ print '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">'; |
6186
|
6186
|
print '</form>'; |
6187
|
6187
|
} else { |
6188
|
6188
|
if ($selected) { |
|
@@ -6209,14 +6209,14 @@ discard block |
|
|
block discarded – undo |
6209
|
6209
|
// phpcs:enable |
6210
|
6210
|
global $langs; |
6211
|
6211
|
if ($htmlname != "none") { |
6212
|
|
- print '<form method="POST" action="' . $page . '">'; |
|
6212
|
+ print '<form method="POST" action="'.$page.'">'; |
6213
|
6213
|
print '<input type="hidden" name="action" value="setmulticurrencycode">'; |
6214
|
|
- print '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
6214
|
+ print '<input type="hidden" name="token" value="'.newToken().'">'; |
6215
|
6215
|
print $this->selectMultiCurrency($selected, $htmlname, 0); |
6216
|
|
- print '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">'; |
|
6216
|
+ print '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">'; |
6217
|
6217
|
print '</form>'; |
6218
|
6218
|
} else { |
6219
|
|
- require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php'; |
|
6219
|
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; |
6220
|
6220
|
print !empty($selected) ? currency_name($selected, 1) : ' '; |
6221
|
6221
|
} |
6222
|
6222
|
} |
|
@@ -6238,21 +6238,21 @@ discard block |
|
|
block discarded – undo |
6238
|
6238
|
global $langs, $mysoc, $conf; |
6239
|
6239
|
|
6240
|
6240
|
if ($htmlname != "none") { |
6241
|
|
- print '<form method="POST" action="' . $page . '">'; |
|
6241
|
+ print '<form method="POST" action="'.$page.'">'; |
6242
|
6242
|
print '<input type="hidden" name="action" value="setmulticurrencyrate">'; |
6243
|
|
- print '<input type="hidden" name="token" value="' . newToken() . '">'; |
6244
|
|
- print '<input type="text" class="maxwidth100" name="' . $htmlname . '" value="' . (!empty($rate) ? price(price2num($rate, 'CU')) : 1) . '" /> '; |
|
6243
|
+ print '<input type="hidden" name="token" value="'.newToken().'">'; |
|
6244
|
+ print '<input type="text" class="maxwidth100" name="'.$htmlname.'" value="'.(!empty($rate) ? price(price2num($rate, 'CU')) : 1).'" /> '; |
6245
|
6245
|
print '<select name="calculation_mode">'; |
6246
|
|
- print '<option value="1">Change ' . $langs->trans("PriceUHT") . ' of lines</option>'; |
6247
|
|
- print '<option value="2">Change ' . $langs->trans("PriceUHTCurrency") . ' of lines</option>'; |
|
6246
|
+ print '<option value="1">Change '.$langs->trans("PriceUHT").' of lines</option>'; |
|
6247
|
+ print '<option value="2">Change '.$langs->trans("PriceUHTCurrency").' of lines</option>'; |
6248
|
6248
|
print '</select> '; |
6249
|
|
- print '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">'; |
|
6249
|
+ print '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">'; |
6250
|
6250
|
print '</form>'; |
6251
|
6251
|
} else { |
6252
|
6252
|
if (!empty($rate)) { |
6253
|
6253
|
print price($rate, 1, $langs, 0, 0); |
6254
|
6254
|
if ($currency && $rate != 1) { |
6255
|
|
- print ' (' . price($rate, 1, $langs, 0, 0) . ' ' . $currency . ' = 1 ' . $conf->currency . ')'; |
|
6255
|
+ print ' ('.price($rate, 1, $langs, 0, 0).' '.$currency.' = 1 '.$conf->currency.')'; |
6256
|
6256
|
} |
6257
|
6257
|
} else { |
6258
|
6258
|
print 1; |
|
@@ -6283,9 +6283,9 @@ discard block |
|
|
block discarded – undo |
6283
|
6283
|
// phpcs:enable |
6284
|
6284
|
global $conf, $langs; |
6285
|
6285
|
if ($htmlname != "none") { |
6286
|
|
- print '<form method="post" action="' . $page . '">'; |
|
6286
|
+ print '<form method="post" action="'.$page.'">'; |
6287
|
6287
|
print '<input type="hidden" name="action" value="setabsolutediscount">'; |
6288
|
|
- print '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
6288
|
+ print '<input type="hidden" name="token" value="'.newToken().'">'; |
6289
|
6289
|
print '<div class="inline-block">'; |
6290
|
6290
|
if (!empty($discount_type)) { |
6291
|
6291
|
if (getDolGlobalString('FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS')) { |
|
@@ -6323,24 +6323,24 @@ discard block |
|
|
block discarded – undo |
6323
|
6323
|
print '</div>'; |
6324
|
6324
|
if (empty($hidelist)) { |
6325
|
6325
|
print '<div class="inline-block" style="padding-right: 10px">'; |
6326
|
|
- $newfilter = 'discount_type=' . intval($discount_type); |
|
6326
|
+ $newfilter = 'discount_type='.intval($discount_type); |
6327
|
6327
|
if (!empty($discount_type)) { |
6328
|
6328
|
$newfilter .= ' AND fk_invoice_supplier IS NULL AND fk_invoice_supplier_line IS NULL'; // Supplier discounts available |
6329
|
6329
|
} else { |
6330
|
6330
|
$newfilter .= ' AND fk_facture IS NULL AND fk_facture_line IS NULL'; // Customer discounts available |
6331
|
6331
|
} |
6332
|
6332
|
if ($filter) { |
6333
|
|
- $newfilter .= ' AND (' . $filter . ')'; |
|
6333
|
+ $newfilter .= ' AND ('.$filter.')'; |
6334
|
6334
|
} |
6335
|
6335
|
// output the combo of discounts |
6336
|
6336
|
$nbqualifiedlines = $this->select_remises($selected, $htmlname, $newfilter, $socid, $maxvalue); |
6337
|
6337
|
if ($nbqualifiedlines > 0) { |
6338
|
|
- print ' <input type="submit" class="button smallpaddingimp" value="' . dol_escape_htmltag($langs->trans("UseLine")) . '"'; |
|
6338
|
+ print ' <input type="submit" class="button smallpaddingimp" value="'.dol_escape_htmltag($langs->trans("UseLine")).'"'; |
6339
|
6339
|
if (!empty($discount_type) && $filter && $filter != "fk_invoice_supplier_source IS NULL OR (description LIKE '(DEPOSIT)%' AND description NOT LIKE '(EXCESS PAID)%')") { |
6340
|
|
- print ' title="' . $langs->trans("UseCreditNoteInInvoicePayment") . '"'; |
|
6340
|
+ print ' title="'.$langs->trans("UseCreditNoteInInvoicePayment").'"'; |
6341
|
6341
|
} |
6342
|
6342
|
if (empty($discount_type) && $filter && $filter != "fk_facture_source IS NULL OR (description LIKE '(DEPOSIT)%' AND description NOT LIKE '(EXCESS RECEIVED)%')") { |
6343
|
|
- print ' title="' . $langs->trans("UseCreditNoteInInvoicePayment") . '"'; |
|
6343
|
+ print ' title="'.$langs->trans("UseCreditNoteInInvoicePayment").'"'; |
6344
|
6344
|
} |
6345
|
6345
|
|
6346
|
6346
|
print '>'; |
|
@@ -6380,23 +6380,23 @@ discard block |
|
|
block discarded – undo |
6380
|
6380
|
global $langs; |
6381
|
6381
|
|
6382
|
6382
|
if ($htmlname != "none") { |
6383
|
|
- print '<form method="post" action="' . $page . '">'; |
|
6383
|
+ print '<form method="post" action="'.$page.'">'; |
6384
|
6384
|
print '<input type="hidden" name="action" value="set_contact">'; |
6385
|
|
- print '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
6385
|
+ print '<input type="hidden" name="token" value="'.newToken().'">'; |
6386
|
6386
|
print '<table class="nobordernopadding">'; |
6387
|
6387
|
print '<tr><td>'; |
6388
|
6388
|
print $this->selectcontacts($societe->id, $selected, $htmlname); |
6389
|
6389
|
$num = $this->num; |
6390
|
6390
|
if ($num == 0) { |
6391
|
6391
|
$addcontact = (getDolGlobalString('SOCIETE_ADDRESSES_MANAGEMENT') ? $langs->trans("AddContact") : $langs->trans("AddContactAddress")); |
6392
|
|
- print '<a href="' . DOL_URL_ROOT . '/contact/card.php?socid=' . $societe->id . '&action=create&backtoreferer=1">' . $addcontact . '</a>'; |
|
6392
|
+ print '<a href="'.DOL_URL_ROOT.'/contact/card.php?socid='.$societe->id.'&action=create&backtoreferer=1">'.$addcontact.'</a>'; |
6393
|
6393
|
} |
6394
|
6394
|
print '</td>'; |
6395
|
|
- print '<td class="left"><input type="submit" class="button smallpaddingimp" value="' . $langs->trans("Modify") . '"></td>'; |
|
6395
|
+ print '<td class="left"><input type="submit" class="button smallpaddingimp" value="'.$langs->trans("Modify").'"></td>'; |
6396
|
6396
|
print '</tr></table></form>'; |
6397
|
6397
|
} else { |
6398
|
6398
|
if ($selected) { |
6399
|
|
- require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php'; |
|
6399
|
+ require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; |
6400
|
6400
|
$contact = new Contact($this->db); |
6401
|
6401
|
$contact->fetch($selected); |
6402
|
6402
|
print $contact->getFullName($langs); |
|
@@ -6431,20 +6431,20 @@ discard block |
|
|
block discarded – undo |
6431
|
6431
|
|
6432
|
6432
|
$out = ''; |
6433
|
6433
|
if ($htmlname != "none") { |
6434
|
|
- $out .= '<form method="post" action="' . $page . '">'; |
|
6434
|
+ $out .= '<form method="post" action="'.$page.'">'; |
6435
|
6435
|
$out .= '<input type="hidden" name="action" value="set_thirdparty">'; |
6436
|
|
- $out .= '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
6436
|
+ $out .= '<input type="hidden" name="token" value="'.newToken().'">'; |
6437
|
6437
|
$out .= $this->select_company($selected, $htmlname, $filter, $showempty, $showtype, $forcecombo, $events, 0, 'minwidth100', '', '', 1, array(), false, $excludeids); |
6438
|
|
- $out .= '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">'; |
|
6438
|
+ $out .= '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">'; |
6439
|
6439
|
$out .= '</form>'; |
6440
|
6440
|
} else { |
6441
|
6441
|
if ($selected) { |
6442
|
|
- require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; |
|
6442
|
+ require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; |
6443
|
6443
|
$soc = new Societe($this->db); |
6444
|
6444
|
$soc->fetch($selected); |
6445
|
6445
|
$out .= $soc->getNomUrl(0, ''); |
6446
|
6446
|
} else { |
6447
|
|
- $out .= '<span class="opacitymedium">' . $textifnothirdparty . '</span>'; |
|
6447
|
+ $out .= '<span class="opacitymedium">'.$textifnothirdparty.'</span>'; |
6448
|
6448
|
} |
6449
|
6449
|
} |
6450
|
6450
|
|
|
@@ -6494,22 +6494,22 @@ discard block |
|
|
block discarded – undo |
6494
|
6494
|
$selected = 'EUR'; // Pour compatibilite |
6495
|
6495
|
} |
6496
|
6496
|
|
6497
|
|
- $out .= '<select class="flat maxwidth200onsmartphone minwidth300" name="' . $htmlname . '" id="' . $htmlname . '">'; |
|
6497
|
+ $out .= '<select class="flat maxwidth200onsmartphone minwidth300" name="'.$htmlname.'" id="'.$htmlname.'">'; |
6498
|
6498
|
if ($useempty) { |
6499
|
6499
|
$out .= '<option value="-1" selected></option>'; |
6500
|
6500
|
} |
6501
|
6501
|
foreach ($langs->cache_currencies as $code_iso => $currency) { |
6502
|
6502
|
$labeltoshow = $currency['label']; |
6503
|
6503
|
if ($mode == 1) { |
6504
|
|
- $labeltoshow .= ' <span class="opacitymedium">(' . $code_iso . ')</span>'; |
|
6504
|
+ $labeltoshow .= ' <span class="opacitymedium">('.$code_iso.')</span>'; |
6505
|
6505
|
} else { |
6506
|
|
- $labeltoshow .= ' <span class="opacitymedium">(' . $langs->getCurrencySymbol($code_iso) . ')</span>'; |
|
6506
|
+ $labeltoshow .= ' <span class="opacitymedium">('.$langs->getCurrencySymbol($code_iso).')</span>'; |
6507
|
6507
|
} |
6508
|
6508
|
|
6509
|
6509
|
if ($selected && $selected == $code_iso) { |
6510
|
|
- $out .= '<option value="' . $code_iso . '" selected data-html="' . dol_escape_htmltag($labeltoshow) . '">'; |
|
6510
|
+ $out .= '<option value="'.$code_iso.'" selected data-html="'.dol_escape_htmltag($labeltoshow).'">'; |
6511
|
6511
|
} else { |
6512
|
|
- $out .= '<option value="' . $code_iso . '" data-html="' . dol_escape_htmltag($labeltoshow) . '">'; |
|
6512
|
+ $out .= '<option value="'.$code_iso.'" data-html="'.dol_escape_htmltag($labeltoshow).'">'; |
6513
|
6513
|
} |
6514
|
6514
|
$out .= $labeltoshow; |
6515
|
6515
|
$out .= '</option>'; |
|
@@ -6520,7 +6520,7 @@ discard block |
|
|
block discarded – undo |
6520
|
6520
|
} |
6521
|
6521
|
|
6522
|
6522
|
// Make select dynamic |
6523
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
6523
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
6524
|
6524
|
$out .= ajax_combobox($htmlname); |
6525
|
6525
|
|
6526
|
6526
|
return $out; |
|
@@ -6546,10 +6546,10 @@ discard block |
|
|
block discarded – undo |
6546
|
6546
|
|
6547
|
6547
|
$TCurrency = array(); |
6548
|
6548
|
|
6549
|
|
- $sql = "SELECT code FROM " . $this->db->prefix() . "multicurrency"; |
6550
|
|
- $sql .= " WHERE entity IN ('" . getEntity('mutlicurrency') . "')"; |
|
6549
|
+ $sql = "SELECT code FROM ".$this->db->prefix()."multicurrency"; |
|
6550
|
+ $sql .= " WHERE entity IN ('".getEntity('mutlicurrency')."')"; |
6551
|
6551
|
if ($filter) { |
6552
|
|
- $sql .= " AND " . $filter; |
|
6552
|
+ $sql .= " AND ".$filter; |
6553
|
6553
|
} |
6554
|
6554
|
$resql = $this->db->query($sql); |
6555
|
6555
|
if ($resql) { |
|
@@ -6559,7 +6559,7 @@ discard block |
|
|
block discarded – undo |
6559
|
6559
|
} |
6560
|
6560
|
|
6561
|
6561
|
$out = ''; |
6562
|
|
- $out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">'; |
|
6562
|
+ $out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">'; |
6563
|
6563
|
if ($useempty) { |
6564
|
6564
|
$out .= '<option value=""> </option>'; |
6565
|
6565
|
} |
|
@@ -6571,13 +6571,13 @@ discard block |
|
|
block discarded – undo |
6571
|
6571
|
foreach ($langs->cache_currencies as $code_iso => $currency) { |
6572
|
6572
|
if (isset($TCurrency[$code_iso])) { |
6573
|
6573
|
if (!empty($selected) && $selected == $code_iso) { |
6574
|
|
- $out .= '<option value="' . $code_iso . '" selected="selected">'; |
|
6574
|
+ $out .= '<option value="'.$code_iso.'" selected="selected">'; |
6575
|
6575
|
} else { |
6576
|
|
- $out .= '<option value="' . $code_iso . '">'; |
|
6576
|
+ $out .= '<option value="'.$code_iso.'">'; |
6577
|
6577
|
} |
6578
|
6578
|
|
6579
|
6579
|
$out .= $currency['label']; |
6580
|
|
- $out .= ' (' . $langs->getCurrencySymbol($code_iso) . ')'; |
|
6580
|
+ $out .= ' ('.$langs->getCurrencySymbol($code_iso).')'; |
6581
|
6581
|
$out .= '</option>'; |
6582
|
6582
|
} |
6583
|
6583
|
} |
|
@@ -6586,7 +6586,7 @@ discard block |
|
|
block discarded – undo |
6586
|
6586
|
$out .= '</select>'; |
6587
|
6587
|
|
6588
|
6588
|
// Make select dynamic |
6589
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
6589
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
6590
|
6590
|
$out .= ajax_combobox($htmlname); |
6591
|
6591
|
|
6592
|
6592
|
return $out; |
|
@@ -6617,7 +6617,7 @@ discard block |
|
|
block discarded – undo |
6617
|
6617
|
$sql .= " WHERE t.fk_pays = c.rowid"; |
6618
|
6618
|
$sql .= " AND t.active > 0"; |
6619
|
6619
|
$sql .= " AND t.entity IN (".getEntity('c_tva').")"; |
6620
|
|
- $sql .= " AND c.code IN (" . $this->db->sanitize($country_code, 1) . ")"; |
|
6620
|
+ $sql .= " AND c.code IN (".$this->db->sanitize($country_code, 1).")"; |
6621
|
6621
|
$sql .= " ORDER BY t.code ASC, t.taux ASC, t.recuperableonly ASC"; |
6622
|
6622
|
|
6623
|
6623
|
$resql = $this->db->query($sql); |
|
@@ -6629,30 +6629,30 @@ discard block |
|
|
block discarded – undo |
6629
|
6629
|
|
6630
|
6630
|
$tmparray = array(); |
6631
|
6631
|
$tmparray['rowid'] = $obj->rowid; |
6632
|
|
- $tmparray['type_vat'] = $obj->type_vat; |
6633
|
|
- $tmparray['code'] = $obj->code; |
|
6632
|
+ $tmparray['type_vat'] = $obj->type_vat; |
|
6633
|
+ $tmparray['code'] = $obj->code; |
6634
|
6634
|
$tmparray['txtva'] = $obj->taux; |
6635
|
|
- $tmparray['nprtva'] = $obj->recuperableonly; |
|
6635
|
+ $tmparray['nprtva'] = $obj->recuperableonly; |
6636
|
6636
|
$tmparray['localtax1'] = $obj->localtax1; |
6637
|
6637
|
$tmparray['localtax1_type'] = $obj->localtax1_type; |
6638
|
6638
|
$tmparray['localtax2'] = $obj->localtax2; |
6639
|
6639
|
$tmparray['localtax2_type'] = $obj->localtax1_type; |
6640
|
|
- $tmparray['label'] = $obj->taux . '%' . ($obj->code ? ' (' . $obj->code . ')' : ''); // Label must contains only 0-9 , . % or * |
6641
|
|
- $tmparray['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 |
|
6640
|
+ $tmparray['label'] = $obj->taux.'%'.($obj->code ? ' ('.$obj->code.')' : ''); // Label must contains only 0-9 , . % or * |
|
6641
|
+ $tmparray['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 |
6642
|
6642
|
$positiverates = ''; |
6643
|
6643
|
if ($obj->taux) { |
6644
|
|
- $positiverates .= ($positiverates ? '/' : '') . $obj->taux; |
|
6644
|
+ $positiverates .= ($positiverates ? '/' : '').$obj->taux; |
6645
|
6645
|
} |
6646
|
6646
|
if ($obj->localtax1) { |
6647
|
|
- $positiverates .= ($positiverates ? '/' : '') . $obj->localtax1; |
|
6647
|
+ $positiverates .= ($positiverates ? '/' : '').$obj->localtax1; |
6648
|
6648
|
} |
6649
|
6649
|
if ($obj->localtax2) { |
6650
|
|
- $positiverates .= ($positiverates ? '/' : '') . $obj->localtax2; |
|
6650
|
+ $positiverates .= ($positiverates ? '/' : '').$obj->localtax2; |
6651
|
6651
|
} |
6652
|
6652
|
if (empty($positiverates)) { |
6653
|
6653
|
$positiverates = '0'; |
6654
|
6654
|
} |
6655
|
|
- $tmparray['labelpositiverates'] = $positiverates . ($obj->code ? ' (' . $obj->code . ')' : ''); // Must never be used as key, only label |
|
6655
|
+ $tmparray['labelpositiverates'] = $positiverates.($obj->code ? ' ('.$obj->code.')' : ''); // Must never be used as key, only label |
6656
|
6656
|
|
6657
|
6657
|
$this->cache_vatrates[$obj->rowid] = $tmparray; |
6658
|
6658
|
} |
|
@@ -6672,7 +6672,7 @@ discard block |
|
|
block discarded – undo |
6672
|
6672
|
return -1; |
6673
|
6673
|
} |
6674
|
6674
|
} else { |
6675
|
|
- $this->error = '<span class="error">' . $this->db->error() . '</span>'; |
|
6675
|
+ $this->error = '<span class="error">'.$this->db->error().'</span>'; |
6676
|
6676
|
return -2; |
6677
|
6677
|
} |
6678
|
6678
|
} |
|
@@ -6725,9 +6725,9 @@ discard block |
|
|
block discarded – undo |
6725
|
6725
|
// Check parameters |
6726
|
6726
|
if (is_object($societe_vendeuse) && !$societe_vendeuse->country_code) { |
6727
|
6727
|
if ($societe_vendeuse->id == $mysoc->id) { |
6728
|
|
- $return .= '<span class="error">' . $langs->trans("ErrorYourCountryIsNotDefined") . '</span>'; |
|
6728
|
+ $return .= '<span class="error">'.$langs->trans("ErrorYourCountryIsNotDefined").'</span>'; |
6729
|
6729
|
} else { |
6730
|
|
- $return .= '<span class="error">' . $langs->trans("ErrorSupplierCountryIsNotDefined") . '</span>'; |
|
6730
|
+ $return .= '<span class="error">'.$langs->trans("ErrorSupplierCountryIsNotDefined").'</span>'; |
6731
|
6731
|
} |
6732
|
6732
|
return $return; |
6733
|
6733
|
} |
|
@@ -6739,12 +6739,12 @@ discard block |
|
|
block discarded – undo |
6739
|
6739
|
// Define list of countries to use to search VAT rates to show |
6740
|
6740
|
// First we defined code_country to use to find list |
6741
|
6741
|
if (is_object($societe_vendeuse)) { |
6742
|
|
- $code_country = "'" . $societe_vendeuse->country_code . "'"; |
|
6742
|
+ $code_country = "'".$societe_vendeuse->country_code."'"; |
6743
|
6743
|
} else { |
6744
|
|
- $code_country = "'" . $mysoc->country_code . "'"; // Pour compatibilite ascendente |
|
6744
|
+ $code_country = "'".$mysoc->country_code."'"; // Pour compatibilite ascendente |
6745
|
6745
|
} |
6746
|
6746
|
if (getDolGlobalString('SERVICE_ARE_ECOMMERCE_200238EC')) { // If option to have vat for end customer for services is on |
6747
|
|
- require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php'; |
|
6747
|
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; |
6748
|
6748
|
// If SERVICE_ARE_ECOMMERCE_200238EC=1 combo list vat rate of purchaser and seller countries |
6749
|
6749
|
// If SERVICE_ARE_ECOMMERCE_200238EC=2 combo list only the vat rate of the purchaser country |
6750
|
6750
|
$selectVatComboMode = getDolGlobalString('SERVICE_ARE_ECOMMERCE_200238EC'); |
|
@@ -6754,27 +6754,27 @@ discard block |
|
|
block discarded – undo |
6754
|
6754
|
if ($type == 1) { // We know product is a service |
6755
|
6755
|
switch ($selectVatComboMode) { |
6756
|
6756
|
case '1': |
6757
|
|
- $code_country .= ",'" . $societe_acheteuse->country_code . "'"; |
|
6757
|
+ $code_country .= ",'".$societe_acheteuse->country_code."'"; |
6758
|
6758
|
break; |
6759
|
6759
|
case '2': |
6760
|
|
- $code_country = "'" . $societe_acheteuse->country_code . "'"; |
|
6760
|
+ $code_country = "'".$societe_acheteuse->country_code."'"; |
6761
|
6761
|
break; |
6762
|
6762
|
} |
6763
|
6763
|
} |
6764
|
6764
|
} elseif (!$idprod) { // We don't know type of product |
6765
|
6765
|
switch ($selectVatComboMode) { |
6766
|
6766
|
case '1': |
6767
|
|
- $code_country .= ",'" . $societe_acheteuse->country_code . "'"; |
|
6767
|
+ $code_country .= ",'".$societe_acheteuse->country_code."'"; |
6768
|
6768
|
break; |
6769
|
6769
|
case '2': |
6770
|
|
- $code_country = "'" . $societe_acheteuse->country_code . "'"; |
|
6770
|
+ $code_country = "'".$societe_acheteuse->country_code."'"; |
6771
|
6771
|
break; |
6772
|
6772
|
} |
6773
|
6773
|
} else { |
6774
|
6774
|
$prodstatic = new Product($this->db); |
6775
|
6775
|
$prodstatic->fetch($idprod); |
6776
|
6776
|
if ($prodstatic->type == Product::TYPE_SERVICE) { // We know product is a service |
6777
|
|
- $code_country .= ",'" . $societe_acheteuse->country_code . "'"; |
|
6777
|
+ $code_country .= ",'".$societe_acheteuse->country_code."'"; |
6778
|
6778
|
} |
6779
|
6779
|
} |
6780
|
6780
|
} |
|
@@ -6836,13 +6836,13 @@ discard block |
|
|
block discarded – undo |
6836
|
6836
|
// Override/enable VAT for expense report regardless of global setting - needed if expense report used for business expenses instead |
6837
|
6837
|
// of using supplier invoices (this is a very bad idea !) |
6838
|
6838
|
if (!getDolGlobalString('EXPENSEREPORT_OVERRIDE_VAT')) { |
6839
|
|
- $title = ' title="' . dol_escape_htmltag($langs->trans('VATIsNotUsed')) . '"'; |
|
6839
|
+ $title = ' title="'.dol_escape_htmltag($langs->trans('VATIsNotUsed')).'"'; |
6840
|
6840
|
$disabled = true; |
6841
|
6841
|
} |
6842
|
6842
|
} |
6843
|
6843
|
|
6844
|
6844
|
if (!$options_only) { |
6845
|
|
- $return .= '<select class="flat minwidth75imp maxwidth100 right" id="' . $htmlname . '" name="' . $htmlname . '"' . ($disabled ? ' disabled' : '') . $title . '>'; |
|
6845
|
+ $return .= '<select class="flat minwidth75imp maxwidth100 right" id="'.$htmlname.'" name="'.$htmlname.'"'.($disabled ? ' disabled' : '').$title.'>'; |
6846
|
6846
|
} |
6847
|
6847
|
|
6848
|
6848
|
$selectedfound = false; |
|
@@ -6856,13 +6856,13 @@ discard block |
|
|
block discarded – undo |
6856
|
6856
|
$key = $rate['txtva']; |
6857
|
6857
|
$key .= $rate['nprtva'] ? '*' : ''; |
6858
|
6858
|
if ($mode > 0 && $rate['code']) { |
6859
|
|
- $key .= ' (' . $rate['code'] . ')'; |
|
6859
|
+ $key .= ' ('.$rate['code'].')'; |
6860
|
6860
|
} |
6861
|
6861
|
if ($mode < 0) { |
6862
|
6862
|
$key = $rate['rowid']; |
6863
|
6863
|
} |
6864
|
6864
|
|
6865
|
|
- $return .= '<option value="' . $key . '"'; |
|
6865
|
+ $return .= '<option value="'.$key.'"'; |
6866
|
6866
|
if (!$selectedfound) { |
6867
|
6867
|
if ($defaultcode) { // If defaultcode is defined, we used it in priority to select combo option instead of using rate+npr flag |
6868
|
6868
|
if ($defaultcode == $rate['code']) { |
|
@@ -6933,7 +6933,7 @@ discard block |
|
|
block discarded – undo |
6933
|
6933
|
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 = 0, $addplusone = '', $adddateof = '') |
6934
|
6934
|
{ |
6935
|
6935
|
// phpcs:enable |
6936
|
|
- dol_syslog(__METHOD__ . ': using select_date is deprecated. Use selectDate instead.', LOG_WARNING); |
|
6936
|
+ dol_syslog(__METHOD__.': using select_date is deprecated. Use selectDate instead.', LOG_WARNING); |
6937
|
6937
|
$retstring = $this->selectDate($set_time, $prefix, $h, $m, $empty, $form_name, $d, $addnowlink, $disabled, $fullday, $addplusone, $adddateof); |
6938
|
6938
|
if (!empty($nooutput)) { |
6939
|
6939
|
return $retstring; |
|
@@ -6962,11 +6962,11 @@ discard block |
|
|
block discarded – undo |
6962
|
6962
|
{ |
6963
|
6963
|
global $langs; |
6964
|
6964
|
|
6965
|
|
- $ret = $this->selectDate($set_time, $prefix . '_start', 0, 0, $empty, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("from"), 'tzuserrel'); |
|
6965
|
+ $ret = $this->selectDate($set_time, $prefix.'_start', 0, 0, $empty, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("from"), 'tzuserrel'); |
6966
|
6966
|
if ($forcenewline) { |
6967
|
6967
|
$ret .= '<br>'; |
6968
|
6968
|
} |
6969
|
|
- $ret .= $this->selectDate($set_time_end, $prefix . '_end', 0, 0, $empty, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"), 'tzuserrel'); |
|
6969
|
+ $ret .= $this->selectDate($set_time_end, $prefix.'_end', 0, 0, $empty, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"), 'tzuserrel'); |
6970
|
6970
|
return $ret; |
6971
|
6971
|
} |
6972
|
6972
|
|
|
@@ -7032,7 +7032,7 @@ discard block |
|
|
block discarded – undo |
7032
|
7032
|
$orig_set_time = $set_time; |
7033
|
7033
|
|
7034
|
7034
|
if ($set_time === '' && $emptydate == 0) { |
7035
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php'; |
|
7035
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; |
7036
|
7036
|
if ($gm == 'tzuser' || $gm == 'tzuserrel') { |
7037
|
7037
|
$set_time = dol_now($gm); |
7038
|
7038
|
} else { |
|
@@ -7104,38 +7104,38 @@ discard block |
|
|
block discarded – undo |
7104
|
7104
|
// Calendrier popup version eldy |
7105
|
7105
|
if ($usecalendar == "eldy") { |
7106
|
7106
|
// Input area to enter date manually |
7107
|
|
- $retstring .= '<input id="' . $prefix . '" name="' . $prefix . '" type="text" class="maxwidthdate center" maxlength="11" value="' . $formated_date . '"'; |
|
7107
|
+ $retstring .= '<input id="'.$prefix.'" name="'.$prefix.'" type="text" class="maxwidthdate center" maxlength="11" value="'.$formated_date.'"'; |
7108
|
7108
|
$retstring .= ($disabled ? ' disabled' : ''); |
7109
|
|
- $retstring .= ' onChange="dpChangeDay(\'' . $prefix . '\',\'' . $langs->trans("FormatDateShortJavaInput") . '\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript |
|
7109
|
+ $retstring .= ' onChange="dpChangeDay(\''.$prefix.'\',\''.$langs->trans("FormatDateShortJavaInput").'\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript |
7110
|
7110
|
$retstring .= ' autocomplete="off">'; |
7111
|
7111
|
|
7112
|
7112
|
// Icon calendar |
7113
|
7113
|
$retstringbuttom = ''; |
7114
|
7114
|
if (!$disabled) { |
7115
|
|
- $retstringbuttom = '<button id="' . $prefix . 'Button" type="button" class="dpInvisibleButtons"'; |
7116
|
|
- $base = DOL_URL_ROOT . '/core/'; |
7117
|
|
- $retstringbuttom .= ' onClick="showDP(\'' . $base . '\',\'' . $prefix . '\',\'' . $langs->trans("FormatDateShortJavaInput") . '\',\'' . $langs->defaultlang . '\');"'; |
7118
|
|
- $retstringbuttom .= '>' . img_object($langs->trans("SelectDate"), 'calendarday', 'class="datecallink"') . '</button>'; |
|
7115
|
+ $retstringbuttom = '<button id="'.$prefix.'Button" type="button" class="dpInvisibleButtons"'; |
|
7116
|
+ $base = DOL_URL_ROOT.'/core/'; |
|
7117
|
+ $retstringbuttom .= ' onClick="showDP(\''.$base.'\',\''.$prefix.'\',\''.$langs->trans("FormatDateShortJavaInput").'\',\''.$langs->defaultlang.'\');"'; |
|
7118
|
+ $retstringbuttom .= '>'.img_object($langs->trans("SelectDate"), 'calendarday', 'class="datecallink"').'</button>'; |
7119
|
7119
|
} else { |
7120
|
|
- $retstringbuttom = '<button id="' . $prefix . 'Button" type="button" class="dpInvisibleButtons">' . img_object($langs->trans("Disabled"), 'calendarday', 'class="datecallink"') . '</button>'; |
|
7120
|
+ $retstringbuttom = '<button id="'.$prefix.'Button" type="button" class="dpInvisibleButtons">'.img_object($langs->trans("Disabled"), 'calendarday', 'class="datecallink"').'</button>'; |
7121
|
7121
|
} |
7122
|
|
- $retstring = $retstringbuttom . $retstring; |
|
7122
|
+ $retstring = $retstringbuttom.$retstring; |
7123
|
7123
|
|
7124
|
|
- $retstring .= '<input type="hidden" id="' . $prefix . 'day" name="' . $prefix . 'day" value="' . $sday . '">' . "\n"; |
7125
|
|
- $retstring .= '<input type="hidden" id="' . $prefix . 'month" name="' . $prefix . 'month" value="' . $smonth . '">' . "\n"; |
7126
|
|
- $retstring .= '<input type="hidden" id="' . $prefix . 'year" name="' . $prefix . 'year" value="' . $syear . '">' . "\n"; |
|
7124
|
+ $retstring .= '<input type="hidden" id="'.$prefix.'day" name="'.$prefix.'day" value="'.$sday.'">'."\n"; |
|
7125
|
+ $retstring .= '<input type="hidden" id="'.$prefix.'month" name="'.$prefix.'month" value="'.$smonth.'">'."\n"; |
|
7126
|
+ $retstring .= '<input type="hidden" id="'.$prefix.'year" name="'.$prefix.'year" value="'.$syear.'">'."\n"; |
7127
|
7127
|
} elseif ($usecalendar == 'jquery' || $usecalendar == 'html') { |
7128
|
7128
|
if (!$disabled && $usecalendar != 'html') { |
7129
|
7129
|
// Output javascript for datepicker |
7130
|
7130
|
$minYear = getDolGlobalInt('MIN_YEAR_SELECT_DATE', (idate('Y') - 100)); |
7131
|
7131
|
$maxYear = getDolGlobalInt('MAX_YEAR_SELECT_DATE', (idate('Y') + 100)); |
7132
|
7132
|
|
7133
|
|
- $retstring .= '<script nonce="' . getNonce() . '" type="text/javascript">'; |
7134
|
|
- $retstring .= "$(function(){ $('#" . $prefix . "').datepicker({ |
7135
|
|
- dateFormat: '" . $langs->trans("FormatDateShortJQueryInput") . "', |
|
7133
|
+ $retstring .= '<script nonce="'.getNonce().'" type="text/javascript">'; |
|
7134
|
+ $retstring .= "$(function(){ $('#".$prefix."').datepicker({ |
|
7135
|
+ dateFormat: '" . $langs->trans("FormatDateShortJQueryInput")."', |
7136
|
7136
|
autoclose: true, |
7137
|
7137
|
todayHighlight: true, |
7138
|
|
- yearRange: '" . $minYear . ":" . $maxYear . "',"; |
|
7138
|
+ yearRange: '" . $minYear.":".$maxYear."',"; |
7139
|
7139
|
if (!empty($conf->dol_use_jmobile)) { |
7140
|
7140
|
$retstring .= " |
7141
|
7141
|
beforeShow: function (input, datePicker) { |
|
@@ -7150,7 +7150,7 @@ discard block |
|
|
block discarded – undo |
7150
|
7150
|
if (!getDolGlobalString('MAIN_POPUP_CALENDAR_ON_FOCUS')) { |
7151
|
7151
|
$retstring .= " |
7152
|
7152
|
showOn: 'button', /* both has problem with autocompletion */ |
7153
|
|
- buttonImage: '" . DOL_URL_ROOT . "/theme/" . dol_escape_js($conf->theme) . "/img/object_calendarday.png', |
|
7153
|
+ buttonImage: '" . DOL_URL_ROOT."/theme/".dol_escape_js($conf->theme)."/img/object_calendarday.png', |
7154
|
7154
|
buttonImageOnly: true"; |
7155
|
7155
|
} |
7156
|
7156
|
$retstring .= " |
|
@@ -7162,46 +7162,46 @@ discard block |
|
|
block discarded – undo |
7162
|
7162
|
$retstring .= '<div class="nowraponall inline-block divfordateinput">'; |
7163
|
7163
|
$retstring .= '<input id="'.$prefix.'" name="'.$prefix.'" type="text" class="maxwidthdate center" maxlength="11" value="'.$formated_date.'"'; |
7164
|
7164
|
$retstring .= ($disabled ? ' disabled' : ''); |
7165
|
|
- $retstring .= ($placeholder ? ' placeholder="' . dol_escape_htmltag($placeholder) . '"' : ''); |
7166
|
|
- $retstring .= ' onChange="dpChangeDay(\'' . dol_escape_js($prefix) . '\',\'' . dol_escape_js($langs->trans("FormatDateShortJavaInput")) . '\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript |
|
7165
|
+ $retstring .= ($placeholder ? ' placeholder="'.dol_escape_htmltag($placeholder).'"' : ''); |
|
7166
|
+ $retstring .= ' onChange="dpChangeDay(\''.dol_escape_js($prefix).'\',\''.dol_escape_js($langs->trans("FormatDateShortJavaInput")).'\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript |
7167
|
7167
|
$retstring .= ' autocomplete="off">'; |
7168
|
7168
|
|
7169
|
7169
|
// Icone calendrier |
7170
|
7170
|
if ($disabled) { |
7171
|
|
- $retstringbutton = '<button id="' . $prefix . 'Button" type="button" class="dpInvisibleButtons">' . img_object($langs->trans("Disabled"), 'calendarday', 'class="datecallink"') . '</button>'; |
7172
|
|
- $retstring = $retstringbutton . $retstring; |
|
7171
|
+ $retstringbutton = '<button id="'.$prefix.'Button" type="button" class="dpInvisibleButtons">'.img_object($langs->trans("Disabled"), 'calendarday', 'class="datecallink"').'</button>'; |
|
7172
|
+ $retstring = $retstringbutton.$retstring; |
7173
|
7173
|
} |
7174
|
7174
|
|
7175
|
7175
|
$retstring .= '</div>'; |
7176
|
|
- $retstring .= '<input type="hidden" id="' . $prefix . 'day" name="' . $prefix . 'day" value="' . $sday . '">' . "\n"; |
7177
|
|
- $retstring .= '<input type="hidden" id="' . $prefix . 'month" name="' . $prefix . 'month" value="' . $smonth . '">' . "\n"; |
7178
|
|
- $retstring .= '<input type="hidden" id="' . $prefix . 'year" name="' . $prefix . 'year" value="' . $syear . '">' . "\n"; |
|
7176
|
+ $retstring .= '<input type="hidden" id="'.$prefix.'day" name="'.$prefix.'day" value="'.$sday.'">'."\n"; |
|
7177
|
+ $retstring .= '<input type="hidden" id="'.$prefix.'month" name="'.$prefix.'month" value="'.$smonth.'">'."\n"; |
|
7178
|
+ $retstring .= '<input type="hidden" id="'.$prefix.'year" name="'.$prefix.'year" value="'.$syear.'">'."\n"; |
7179
|
7179
|
} else { |
7180
|
7180
|
$retstring .= "Bad value of MAIN_POPUP_CALENDAR"; |
7181
|
7181
|
} |
7182
|
7182
|
} else { |
7183
|
7183
|
// Show date with combo selects |
7184
|
7184
|
// Day |
7185
|
|
- $retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth50imp" id="' . $prefix . 'day" name="' . $prefix . 'day">'; |
|
7185
|
+ $retstring .= '<select'.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth50imp" id="'.$prefix.'day" name="'.$prefix.'day">'; |
7186
|
7186
|
|
7187
|
7187
|
if ($emptydate || $set_time == -1) { |
7188
|
7188
|
$retstring .= '<option value="0" selected> </option>'; |
7189
|
7189
|
} |
7190
|
7190
|
|
7191
|
7191
|
for ($day = 1; $day <= 31; $day++) { |
7192
|
|
- $retstring .= '<option value="' . $day . '"' . ($day == $sday ? ' selected' : '') . '>' . $day . '</option>'; |
|
7192
|
+ $retstring .= '<option value="'.$day.'"'.($day == $sday ? ' selected' : '').'>'.$day.'</option>'; |
7193
|
7193
|
} |
7194
|
7194
|
|
7195
|
7195
|
$retstring .= "</select>"; |
7196
|
7196
|
|
7197
|
|
- $retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth75imp" id="' . $prefix . 'month" name="' . $prefix . 'month">'; |
|
7197
|
+ $retstring .= '<select'.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth75imp" id="'.$prefix.'month" name="'.$prefix.'month">'; |
7198
|
7198
|
if ($emptydate || $set_time == -1) { |
7199
|
7199
|
$retstring .= '<option value="0" selected> </option>'; |
7200
|
7200
|
} |
7201
|
7201
|
|
7202
|
7202
|
// Month |
7203
|
7203
|
for ($month = 1; $month <= 12; $month++) { |
7204
|
|
- $retstring .= '<option value="' . $month . '"' . ($month == $smonth ? ' selected' : '') . '>'; |
|
7204
|
+ $retstring .= '<option value="'.$month.'"'.($month == $smonth ? ' selected' : '').'>'; |
7205
|
7205
|
$retstring .= dol_print_date(mktime(12, 0, 0, $month, 1, 2000), "%b"); |
7206
|
7206
|
$retstring .= "</option>"; |
7207
|
7207
|
} |
|
@@ -7209,13 +7209,13 @@ discard block |
|
|
block discarded – undo |
7209
|
7209
|
|
7210
|
7210
|
// Year |
7211
|
7211
|
if ($emptydate || $set_time == -1) { |
7212
|
|
- $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 . '">'; |
|
7212
|
+ $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.'">'; |
7213
|
7213
|
} else { |
7214
|
|
- $retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth75imp" id="' . $prefix . 'year" name="' . $prefix . 'year">'; |
|
7214
|
+ $retstring .= '<select'.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth75imp" id="'.$prefix.'year" name="'.$prefix.'year">'; |
7215
|
7215
|
|
7216
|
7216
|
$syear = (int) $syear; |
7217
|
7217
|
for ($year = $syear - 10; $year < (int) $syear + 10; $year++) { |
7218
|
|
- $retstring .= '<option value="' . $year . '"' . ($year == $syear ? ' selected' : '') . '>' . $year . '</option>'; |
|
7218
|
+ $retstring .= '<option value="'.$year.'"'.($year == $syear ? ' selected' : '').'>'.$year.'</option>'; |
7219
|
7219
|
} |
7220
|
7220
|
$retstring .= "</select>\n"; |
7221
|
7221
|
} |
|
@@ -7239,15 +7239,15 @@ discard block |
|
|
block discarded – undo |
7239
|
7239
|
} |
7240
|
7240
|
} |
7241
|
7241
|
// Show hour |
7242
|
|
- $retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth50 ' . ($fullday ? $fullday . 'hour' : '') . '" id="' . $prefix . 'hour" name="' . $prefix . 'hour">'; |
|
7242
|
+ $retstring .= '<select'.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth50 '.($fullday ? $fullday.'hour' : '').'" id="'.$prefix.'hour" name="'.$prefix.'hour">'; |
7243
|
7243
|
if ($emptyhours) { |
7244
|
7244
|
$retstring .= '<option value="-1"> </option>'; |
7245
|
7245
|
} |
7246
|
7246
|
for ($hour = $hourstart; $hour < $hourend; $hour++) { |
7247
|
7247
|
if (strlen($hour) < 2) { |
7248
|
|
- $hour = "0" . $hour; |
|
7248
|
+ $hour = "0".$hour; |
7249
|
7249
|
} |
7250
|
|
- $retstring .= '<option value="' . $hour . '"' . (($hour == $shour) ? ' selected' : '') . '>' . $hour; |
|
7250
|
+ $retstring .= '<option value="'.$hour.'"'.(($hour == $shour) ? ' selected' : '').'>'.$hour; |
7251
|
7251
|
//$retstring .= (empty($conf->dol_optimize_smallscreen) ? '' : 'H'); |
7252
|
7252
|
$retstring .= '</option>'; |
7253
|
7253
|
} |
|
@@ -7260,17 +7260,17 @@ discard block |
|
|
block discarded – undo |
7260
|
7260
|
|
7261
|
7261
|
if ($m) { |
7262
|
7262
|
// Show minutes |
7263
|
|
- $retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth50 ' . ($fullday ? $fullday . 'min' : '') . '" id="' . $prefix . 'min" name="' . $prefix . 'min">'; |
|
7263
|
+ $retstring .= '<select'.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth50 '.($fullday ? $fullday.'min' : '').'" id="'.$prefix.'min" name="'.$prefix.'min">'; |
7264
|
7264
|
if ($emptyhours) { |
7265
|
7265
|
$retstring .= '<option value="-1"> </option>'; |
7266
|
7266
|
} |
7267
|
7267
|
for ($min = 0; $min < 60; $min += $stepminutes) { |
7268
|
7268
|
$min_str = sprintf("%02d", $min); |
7269
|
|
- $retstring .= '<option value="' . $min_str . '"' . (($min_str == $smin) ? ' selected' : '') . '>' . $min_str . '</option>'; |
|
7269
|
+ $retstring .= '<option value="'.$min_str.'"'.(($min_str == $smin) ? ' selected' : '').'>'.$min_str.'</option>'; |
7270
|
7270
|
} |
7271
|
7271
|
$retstring .= '</select>'; |
7272
|
7272
|
|
7273
|
|
- $retstring .= '<input type="hidden" name="' . $prefix . 'sec" value="' . $ssec . '">'; |
|
7273
|
+ $retstring .= '<input type="hidden" name="'.$prefix.'sec" value="'.$ssec.'">'; |
7274
|
7274
|
} |
7275
|
7275
|
|
7276
|
7276
|
if ($d && $h) { |
|
@@ -7293,10 +7293,10 @@ discard block |
|
|
block discarded – undo |
7293
|
7293
|
|
7294
|
7294
|
// Generate the date part, depending on the use or not of the javascript calendar |
7295
|
7295
|
if ($addnowlink == 1) { // server time expressed in user time setup |
7296
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . '\').val(\'' . dol_print_date($nowgmt, 'day', 'tzuserrel') . '\');'; |
7297
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'day\').val(\'' . dol_print_date($nowgmt, '%d', 'tzuserrel') . '\');'; |
7298
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'month\').val(\'' . dol_print_date($nowgmt, '%m', 'tzuserrel') . '\');'; |
7299
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'year\').val(\'' . dol_print_date($nowgmt, '%Y', 'tzuserrel') . '\');'; |
|
7296
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'\').val(\''.dol_print_date($nowgmt, 'day', 'tzuserrel').'\');'; |
|
7297
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'day\').val(\''.dol_print_date($nowgmt, '%d', 'tzuserrel').'\');'; |
|
7298
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(\''.dol_print_date($nowgmt, '%m', 'tzuserrel').'\');'; |
|
7299
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(\''.dol_print_date($nowgmt, '%Y', 'tzuserrel').'\');'; |
7300
|
7300
|
} elseif ($addnowlink == 2) { |
7301
|
7301
|
/* Disabled because the output does not use the string format defined by FormatDateShort key to forge the value into #prefix. |
7302
|
7302
|
* This break application for foreign languages. |
|
@@ -7305,10 +7305,10 @@ discard block |
|
|
block discarded – undo |
7305
|
7305
|
$reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(parseInt(d.getMonth().pad()) + 1);'; |
7306
|
7306
|
$reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(d.getFullYear());'; |
7307
|
7307
|
*/ |
7308
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . '\').val(\'' . dol_print_date($nowgmt, 'day', 'tzuserrel') . '\');'; |
7309
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'day\').val(\'' . dol_print_date($nowgmt, '%d', 'tzuserrel') . '\');'; |
7310
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'month\').val(\'' . dol_print_date($nowgmt, '%m', 'tzuserrel') . '\');'; |
7311
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'year\').val(\'' . dol_print_date($nowgmt, '%Y', 'tzuserrel') . '\');'; |
|
7308
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'\').val(\''.dol_print_date($nowgmt, 'day', 'tzuserrel').'\');'; |
|
7309
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'day\').val(\''.dol_print_date($nowgmt, '%d', 'tzuserrel').'\');'; |
|
7310
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(\''.dol_print_date($nowgmt, '%m', 'tzuserrel').'\');'; |
|
7311
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(\''.dol_print_date($nowgmt, '%Y', 'tzuserrel').'\');'; |
7312
|
7312
|
} |
7313
|
7313
|
/*if ($usecalendar == "eldy") |
7314
|
7314
|
{ |
|
@@ -7328,11 +7328,11 @@ discard block |
|
|
block discarded – undo |
7328
|
7328
|
} |
7329
|
7329
|
//$reset_scripts .= 'this.form.elements[\''.$prefix.'hour\'].value=formatDate(new Date(), \'HH\'); '; |
7330
|
7330
|
if ($addnowlink == 1) { |
7331
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'hour\').val(\'' . dol_print_date($nowgmt, '%H', 'tzuserrel') . '\');'; |
7332
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'hour\').change();'; |
|
7331
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').val(\''.dol_print_date($nowgmt, '%H', 'tzuserrel').'\');'; |
|
7332
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').change();'; |
7333
|
7333
|
} elseif ($addnowlink == 2) { |
7334
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'hour\').val(d.getHours().pad());'; |
7335
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'hour\').change();'; |
|
7334
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').val(d.getHours().pad());'; |
|
7335
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').change();'; |
7336
|
7336
|
} |
7337
|
7337
|
|
7338
|
7338
|
if ($fullday) { |
|
@@ -7346,11 +7346,11 @@ discard block |
|
|
block discarded – undo |
7346
|
7346
|
} |
7347
|
7347
|
//$reset_scripts .= 'this.form.elements[\''.$prefix.'min\'].value=formatDate(new Date(), \'mm\'); '; |
7348
|
7348
|
if ($addnowlink == 1) { |
7349
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'min\').val(\'' . dol_print_date($nowgmt, '%M', 'tzuserrel') . '\');'; |
7350
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'min\').change();'; |
|
7349
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'min\').val(\''.dol_print_date($nowgmt, '%M', 'tzuserrel').'\');'; |
|
7350
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'min\').change();'; |
7351
|
7351
|
} elseif ($addnowlink == 2) { |
7352
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'min\').val(d.getMinutes().pad());'; |
7353
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'min\').change();'; |
|
7352
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'min\').val(d.getMinutes().pad());'; |
|
7353
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'min\').change();'; |
7354
|
7354
|
} |
7355
|
7355
|
if ($fullday) { |
7356
|
7356
|
$reset_scripts .= ' } '; |
|
@@ -7358,7 +7358,7 @@ discard block |
|
|
block discarded – undo |
7358
|
7358
|
} |
7359
|
7359
|
// If reset_scripts is not empty, print the link with the reset_scripts in the onClick |
7360
|
7360
|
if ($reset_scripts && !getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) { |
7361
|
|
- $retstring .= ' <button class="dpInvisibleButtons datenowlink" id="' . $prefix . 'ButtonNow" type="button" name="_useless" value="now" onClick="' . $reset_scripts . '">'; |
|
7361
|
+ $retstring .= ' <button class="dpInvisibleButtons datenowlink" id="'.$prefix.'ButtonNow" type="button" name="_useless" value="now" onClick="'.$reset_scripts.'">'; |
7362
|
7362
|
$retstring .= $langs->trans("Now"); |
7363
|
7363
|
$retstring .= '</button> '; |
7364
|
7364
|
} |
|
@@ -7370,16 +7370,16 @@ discard block |
|
|
block discarded – undo |
7370
|
7370
|
$reset_scripts = ""; |
7371
|
7371
|
|
7372
|
7372
|
// Generate the date part, depending on the use or not of the javascript calendar |
7373
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . '\').val(\'' . dol_print_date($nowgmt, 'dayinputnoreduce', 'tzuserrel') . '\');'; |
7374
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'day\').val(\'' . dol_print_date($nowgmt, '%d', 'tzuserrel') . '\');'; |
7375
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'month\').val(\'' . dol_print_date($nowgmt, '%m', 'tzuserrel') . '\');'; |
7376
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'year\').val(\'' . dol_print_date($nowgmt, '%Y', 'tzuserrel') . '\');'; |
|
7373
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'\').val(\''.dol_print_date($nowgmt, 'dayinputnoreduce', 'tzuserrel').'\');'; |
|
7374
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'day\').val(\''.dol_print_date($nowgmt, '%d', 'tzuserrel').'\');'; |
|
7375
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(\''.dol_print_date($nowgmt, '%m', 'tzuserrel').'\');'; |
|
7376
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(\''.dol_print_date($nowgmt, '%Y', 'tzuserrel').'\');'; |
7377
|
7377
|
// Update the hour part |
7378
|
7378
|
if ($h) { |
7379
|
7379
|
if ($fullday) { |
7380
|
7380
|
$reset_scripts .= " if (jQuery('#fullday:checked').val() == null) {"; |
7381
|
7381
|
} |
7382
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'hour\').val(\'' . dol_print_date($nowgmt, '%H', 'tzuserrel') . '\');'; |
|
7382
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').val(\''.dol_print_date($nowgmt, '%H', 'tzuserrel').'\');'; |
7383
|
7383
|
if ($fullday) { |
7384
|
7384
|
$reset_scripts .= ' } '; |
7385
|
7385
|
} |
|
@@ -7389,14 +7389,14 @@ discard block |
|
|
block discarded – undo |
7389
|
7389
|
if ($fullday) { |
7390
|
7390
|
$reset_scripts .= " if (jQuery('#fullday:checked').val() == null) {"; |
7391
|
7391
|
} |
7392
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'min\').val(\'' . dol_print_date($nowgmt, '%M', 'tzuserrel') . '\');'; |
|
7392
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'min\').val(\''.dol_print_date($nowgmt, '%M', 'tzuserrel').'\');'; |
7393
|
7393
|
if ($fullday) { |
7394
|
7394
|
$reset_scripts .= ' } '; |
7395
|
7395
|
} |
7396
|
7396
|
} |
7397
|
7397
|
// If reset_scripts is not empty, print the link with the reset_scripts in the onClick |
7398
|
7398
|
if ($reset_scripts && empty($conf->dol_optimize_smallscreen)) { |
7399
|
|
- $retstring .= ' <button class="dpInvisibleButtons datenowlink" id="' . $prefix . 'ButtonPlusOne" type="button" name="_useless2" value="plusone" onClick="' . $reset_scripts . '">'; |
|
7399
|
+ $retstring .= ' <button class="dpInvisibleButtons datenowlink" id="'.$prefix.'ButtonPlusOne" type="button" name="_useless2" value="plusone" onClick="'.$reset_scripts.'">'; |
7400
|
7400
|
$retstring .= $langs->trans("DateStartPlusOne"); |
7401
|
7401
|
$retstring .= '</button> '; |
7402
|
7402
|
} |
|
@@ -7454,17 +7454,17 @@ discard block |
|
|
block discarded – undo |
7454
|
7454
|
unset($TDurationTypes[$value]); |
7455
|
7455
|
} |
7456
|
7456
|
|
7457
|
|
- $retstring = '<select class="flat minwidth75 maxwidth100" id="select_' . $prefix . 'type_duration" name="' . $prefix . 'type_duration">'; |
|
7457
|
+ $retstring = '<select class="flat minwidth75 maxwidth100" id="select_'.$prefix.'type_duration" name="'.$prefix.'type_duration">'; |
7458
|
7458
|
foreach ($TDurationTypes as $key => $typeduration) { |
7459
|
|
- $retstring .= '<option value="' . $key . '"'; |
|
7459
|
+ $retstring .= '<option value="'.$key.'"'; |
7460
|
7460
|
if ($key == $selected) { |
7461
|
7461
|
$retstring .= " selected"; |
7462
|
7462
|
} |
7463
|
|
- $retstring .= ">" . $typeduration . "</option>"; |
|
7463
|
+ $retstring .= ">".$typeduration."</option>"; |
7464
|
7464
|
} |
7465
|
7465
|
$retstring .= "</select>"; |
7466
|
7466
|
|
7467
|
|
- $retstring .= ajax_combobox('select_' . $prefix . 'type_duration'); |
|
7467
|
+ $retstring .= ajax_combobox('select_'.$prefix.'type_duration'); |
7468
|
7468
|
|
7469
|
7469
|
return $retstring; |
7470
|
7470
|
} |
|
@@ -7496,30 +7496,30 @@ discard block |
|
|
block discarded – undo |
7496
|
7496
|
|
7497
|
7497
|
// Hours |
7498
|
7498
|
if ($iSecond != '') { |
7499
|
|
- require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php'; |
|
7499
|
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; |
7500
|
7500
|
|
7501
|
7501
|
$hourSelected = convertSecondToTime($iSecond, 'allhour'); |
7502
|
7502
|
$minSelected = convertSecondToTime($iSecond, 'min'); |
7503
|
7503
|
} |
7504
|
7504
|
|
7505
|
7505
|
if ($typehour == 'select') { |
7506
|
|
- $retstring .= '<select class="flat" id="select_' . $prefix . 'hour" name="' . $prefix . 'hour"' . ($disabled ? ' disabled' : '') . '>'; |
|
7506
|
+ $retstring .= '<select class="flat" id="select_'.$prefix.'hour" name="'.$prefix.'hour"'.($disabled ? ' disabled' : '').'>'; |
7507
|
7507
|
for ($hour = 0; $hour < 25; $hour++) { // For a duration, we allow 24 hours |
7508
|
|
- $retstring .= '<option value="' . $hour . '"'; |
|
7508
|
+ $retstring .= '<option value="'.$hour.'"'; |
7509
|
7509
|
if (is_numeric($hourSelected) && $hourSelected == $hour) { |
7510
|
7510
|
$retstring .= " selected"; |
7511
|
7511
|
} |
7512
|
|
- $retstring .= ">" . $hour . "</option>"; |
|
7512
|
+ $retstring .= ">".$hour."</option>"; |
7513
|
7513
|
} |
7514
|
7514
|
$retstring .= "</select>"; |
7515
|
7515
|
} elseif ($typehour == 'text' || $typehour == 'textselect') { |
7516
|
|
- $retstring .= '<input placeholder="' . $langs->trans('HourShort') . '" type="number" min="0" name="' . $prefix . 'hour"' . ($disabled ? ' disabled' : '') . ' class="flat maxwidth50 inputhour right" value="' . (($hourSelected != '') ? ((int) $hourSelected) : '') . '">'; |
|
7516
|
+ $retstring .= '<input placeholder="'.$langs->trans('HourShort').'" type="number" min="0" name="'.$prefix.'hour"'.($disabled ? ' disabled' : '').' class="flat maxwidth50 inputhour right" value="'.(($hourSelected != '') ? ((int) $hourSelected) : '').'">'; |
7517
|
7517
|
} else { |
7518
|
7518
|
return 'BadValueForParameterTypeHour'; |
7519
|
7519
|
} |
7520
|
7520
|
|
7521
|
7521
|
if ($typehour != 'text') { |
7522
|
|
- $retstring .= ' ' . $langs->trans('HourShort'); |
|
7522
|
+ $retstring .= ' '.$langs->trans('HourShort'); |
7523
|
7523
|
} else { |
7524
|
7524
|
$retstring .= '<span class="">:</span>'; |
7525
|
7525
|
} |
|
@@ -7534,21 +7534,21 @@ discard block |
|
|
block discarded – undo |
7534
|
7534
|
} |
7535
|
7535
|
|
7536
|
7536
|
if ($typehour == 'select' || $typehour == 'textselect') { |
7537
|
|
- $retstring .= '<select class="flat" id="select_' . $prefix . 'min" name="' . $prefix . 'min"' . ($disabled ? ' disabled' : '') . '>'; |
|
7537
|
+ $retstring .= '<select class="flat" id="select_'.$prefix.'min" name="'.$prefix.'min"'.($disabled ? ' disabled' : '').'>'; |
7538
|
7538
|
for ($min = 0; $min <= 55; $min += 5) { |
7539
|
|
- $retstring .= '<option value="' . $min . '"'; |
|
7539
|
+ $retstring .= '<option value="'.$min.'"'; |
7540
|
7540
|
if (is_numeric($minSelected) && $minSelected == $min) { |
7541
|
7541
|
$retstring .= ' selected'; |
7542
|
7542
|
} |
7543
|
|
- $retstring .= '>' . $min . '</option>'; |
|
7543
|
+ $retstring .= '>'.$min.'</option>'; |
7544
|
7544
|
} |
7545
|
7545
|
$retstring .= "</select>"; |
7546
|
7546
|
} elseif ($typehour == 'text') { |
7547
|
|
- $retstring .= '<input placeholder="' . $langs->trans('MinuteShort') . '" type="number" min="0" name="' . $prefix . 'min"' . ($disabled ? ' disabled' : '') . ' class="flat maxwidth50 inputminute right" value="' . (($minSelected != '') ? ((int) $minSelected) : '') . '">'; |
|
7547
|
+ $retstring .= '<input placeholder="'.$langs->trans('MinuteShort').'" type="number" min="0" name="'.$prefix.'min"'.($disabled ? ' disabled' : '').' class="flat maxwidth50 inputminute right" value="'.(($minSelected != '') ? ((int) $minSelected) : '').'">'; |
7548
|
7548
|
} |
7549
|
7549
|
|
7550
|
7550
|
if ($typehour != 'text') { |
7551
|
|
- $retstring .= ' ' . $langs->trans('MinuteShort'); |
|
7551
|
+ $retstring .= ' '.$langs->trans('MinuteShort'); |
7552
|
7552
|
} |
7553
|
7553
|
|
7554
|
7554
|
$retstring .= "</span>"; |
|
@@ -7596,7 +7596,7 @@ discard block |
|
|
block discarded – undo |
7596
|
7596
|
$placeholder = ''; |
7597
|
7597
|
|
7598
|
7598
|
if ($selected && empty($selected_input_value)) { |
7599
|
|
- require_once DOL_DOCUMENT_ROOT . '/ticket/class/ticket.class.php'; |
|
7599
|
+ require_once DOL_DOCUMENT_ROOT.'/ticket/class/ticket.class.php'; |
7600
|
7600
|
$tickettmpselect = new Ticket($this->db); |
7601
|
7601
|
$tickettmpselect->fetch($selected); |
7602
|
7602
|
$selected_input_value = $tickettmpselect->ref; |
|
@@ -7604,17 +7604,17 @@ discard block |
|
|
block discarded – undo |
7604
|
7604
|
} |
7605
|
7605
|
|
7606
|
7606
|
$urloption = ''; |
7607
|
|
- $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/ticket/ajax/tickets.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions); |
|
7607
|
+ $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/ticket/ajax/tickets.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions); |
7608
|
7608
|
|
7609
|
7609
|
if (empty($hidelabel)) { |
7610
|
|
- $out .= $langs->trans("RefOrLabel") . ' : '; |
|
7610
|
+ $out .= $langs->trans("RefOrLabel").' : '; |
7611
|
7611
|
} elseif ($hidelabel > 1) { |
7612
|
|
- $placeholder = ' placeholder="' . $langs->trans("RefOrLabel") . '"'; |
|
7612
|
+ $placeholder = ' placeholder="'.$langs->trans("RefOrLabel").'"'; |
7613
|
7613
|
if ($hidelabel == 2) { |
7614
|
7614
|
$out .= img_picto($langs->trans("Search"), 'search'); |
7615
|
7615
|
} |
7616
|
7616
|
} |
7617
|
|
- $out .= '<input type="text" class="minwidth100" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . $placeholder . ' ' . (getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '') . ' />'; |
|
7617
|
+ $out .= '<input type="text" class="minwidth100" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' '.(getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '').' />'; |
7618
|
7618
|
if ($hidelabel == 3) { |
7619
|
7619
|
$out .= img_picto($langs->trans("Search"), 'search'); |
7620
|
7620
|
} |
|
@@ -7658,8 +7658,8 @@ discard block |
|
|
block discarded – undo |
7658
|
7658
|
|
7659
|
7659
|
$sql = "SELECT "; |
7660
|
7660
|
$sql .= $selectFields; |
7661
|
|
- $sql .= " FROM " . $this->db->prefix() . "ticket as p"; |
7662
|
|
- $sql .= ' WHERE p.entity IN (' . getEntity('ticket') . ')'; |
|
7661
|
+ $sql .= " FROM ".$this->db->prefix()."ticket as p"; |
|
7662
|
+ $sql .= ' WHERE p.entity IN ('.getEntity('ticket').')'; |
7663
|
7663
|
|
7664
|
7664
|
// Add criteria on ref/label |
7665
|
7665
|
if ($filterkey != '') { |
|
@@ -7675,7 +7675,7 @@ discard block |
|
|
block discarded – undo |
7675
|
7675
|
if ($i > 0) { |
7676
|
7676
|
$sql .= " AND "; |
7677
|
7677
|
} |
7678
|
|
- $sql .= "(p.ref LIKE '" . $this->db->escape($prefix . $crit) . "%' OR p.subject LIKE '" . $this->db->escape($prefix . $crit) . "%'"; |
|
7678
|
+ $sql .= "(p.ref LIKE '".$this->db->escape($prefix.$crit)."%' OR p.subject LIKE '".$this->db->escape($prefix.$crit)."%'"; |
7679
|
7679
|
$sql .= ")"; |
7680
|
7680
|
$i++; |
7681
|
7681
|
} |
|
@@ -7688,22 +7688,22 @@ discard block |
|
|
block discarded – undo |
7688
|
7688
|
$sql .= $this->db->plimit($limit, 0); |
7689
|
7689
|
|
7690
|
7690
|
// Build output string |
7691
|
|
- dol_syslog(get_class($this) . "::selectTicketsList search tickets", LOG_DEBUG); |
|
7691
|
+ dol_syslog(get_class($this)."::selectTicketsList search tickets", LOG_DEBUG); |
7692
|
7692
|
$result = $this->db->query($sql); |
7693
|
7693
|
if ($result) { |
7694
|
|
- require_once DOL_DOCUMENT_ROOT . '/ticket/class/ticket.class.php'; |
7695
|
|
- require_once DOL_DOCUMENT_ROOT . '/core/lib/ticket.lib.php'; |
|
7694
|
+ require_once DOL_DOCUMENT_ROOT.'/ticket/class/ticket.class.php'; |
|
7695
|
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/ticket.lib.php'; |
7696
|
7696
|
|
7697
|
7697
|
$num = $this->db->num_rows($result); |
7698
|
7698
|
|
7699
|
7699
|
$events = array(); |
7700
|
7700
|
|
7701
|
7701
|
if (!$forcecombo) { |
7702
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
7702
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
7703
|
7703
|
$out .= ajax_combobox($htmlname, $events, $conf->global->TICKET_USE_SEARCH_TO_SELECT); |
7704
|
7704
|
} |
7705
|
7705
|
|
7706
|
|
- $out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">'; |
|
7706
|
+ $out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">'; |
7707
|
7707
|
|
7708
|
7708
|
$textifempty = ''; |
7709
|
7709
|
// Do not use textifempty = ' ' or ' ' here, or search on key will search on ' key'. |
|
@@ -7720,7 +7720,7 @@ discard block |
|
|
block discarded – undo |
7720
|
7720
|
} |
7721
|
7721
|
} |
7722
|
7722
|
if ($showempty) { |
7723
|
|
- $out .= '<option value="0" selected>' . $textifempty . '</option>'; |
|
7723
|
+ $out .= '<option value="0" selected>'.$textifempty.'</option>'; |
7724
|
7724
|
} |
7725
|
7725
|
|
7726
|
7726
|
$i = 0; |
|
@@ -7775,13 +7775,13 @@ discard block |
|
|
block discarded – undo |
7775
|
7775
|
$outref = $objp->ref; |
7776
|
7776
|
$outtype = $objp->fk_product_type; |
7777
|
7777
|
|
7778
|
|
- $opt = '<option value="' . $objp->rowid . '"'; |
|
7778
|
+ $opt = '<option value="'.$objp->rowid.'"'; |
7779
|
7779
|
$opt .= ($objp->rowid == $selected) ? ' selected' : ''; |
7780
|
7780
|
$opt .= '>'; |
7781
|
7781
|
$opt .= $objp->ref; |
7782
|
7782
|
$objRef = $objp->ref; |
7783
|
7783
|
if (!empty($filterkey) && $filterkey != '') { |
7784
|
|
- $objRef = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $objRef, 1); |
|
7784
|
+ $objRef = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $objRef, 1); |
7785
|
7785
|
} |
7786
|
7786
|
|
7787
|
7787
|
$opt .= "</option>\n"; |
|
@@ -7822,7 +7822,7 @@ discard block |
|
|
block discarded – undo |
7822
|
7822
|
$placeholder = ''; |
7823
|
7823
|
|
7824
|
7824
|
if ($selected && empty($selected_input_value)) { |
7825
|
|
- require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; |
|
7825
|
+ require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; |
7826
|
7826
|
$projecttmpselect = new Project($this->db); |
7827
|
7827
|
$projecttmpselect->fetch($selected); |
7828
|
7828
|
$selected_input_value = $projecttmpselect->ref; |
|
@@ -7830,17 +7830,17 @@ discard block |
|
|
block discarded – undo |
7830
|
7830
|
} |
7831
|
7831
|
|
7832
|
7832
|
$urloption = ''; |
7833
|
|
- $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/projet/ajax/projects.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions); |
|
7833
|
+ $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/projet/ajax/projects.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions); |
7834
|
7834
|
|
7835
|
7835
|
if (empty($hidelabel)) { |
7836
|
|
- $out .= $langs->trans("RefOrLabel") . ' : '; |
|
7836
|
+ $out .= $langs->trans("RefOrLabel").' : '; |
7837
|
7837
|
} elseif ($hidelabel > 1) { |
7838
|
|
- $placeholder = ' placeholder="' . $langs->trans("RefOrLabel") . '"'; |
|
7838
|
+ $placeholder = ' placeholder="'.$langs->trans("RefOrLabel").'"'; |
7839
|
7839
|
if ($hidelabel == 2) { |
7840
|
7840
|
$out .= img_picto($langs->trans("Search"), 'search'); |
7841
|
7841
|
} |
7842
|
7842
|
} |
7843
|
|
- $out .= '<input type="text" class="minwidth100" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . $placeholder . ' ' . (getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '') . ' />'; |
|
7843
|
+ $out .= '<input type="text" class="minwidth100" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' '.(getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '').' />'; |
7844
|
7844
|
if ($hidelabel == 3) { |
7845
|
7845
|
$out .= img_picto($langs->trans("Search"), 'search'); |
7846
|
7846
|
} |
|
@@ -7883,8 +7883,8 @@ discard block |
|
|
block discarded – undo |
7883
|
7883
|
|
7884
|
7884
|
$sql = "SELECT "; |
7885
|
7885
|
$sql .= $selectFields; |
7886
|
|
- $sql .= " FROM " . $this->db->prefix() . "projet as p"; |
7887
|
|
- $sql .= ' WHERE p.entity IN (' . getEntity('project') . ')'; |
|
7886
|
+ $sql .= " FROM ".$this->db->prefix()."projet as p"; |
|
7887
|
+ $sql .= ' WHERE p.entity IN ('.getEntity('project').')'; |
7888
|
7888
|
|
7889
|
7889
|
// Add criteria on ref/label |
7890
|
7890
|
if ($filterkey != '') { |
|
@@ -7900,7 +7900,7 @@ discard block |
|
|
block discarded – undo |
7900
|
7900
|
if ($i > 0) { |
7901
|
7901
|
$sql .= " AND "; |
7902
|
7902
|
} |
7903
|
|
- $sql .= "p.ref LIKE '" . $this->db->escape($prefix . $crit) . "%'"; |
|
7903
|
+ $sql .= "p.ref LIKE '".$this->db->escape($prefix.$crit)."%'"; |
7904
|
7904
|
$sql .= ""; |
7905
|
7905
|
$i++; |
7906
|
7906
|
} |
|
@@ -7913,22 +7913,22 @@ discard block |
|
|
block discarded – undo |
7913
|
7913
|
$sql .= $this->db->plimit($limit, 0); |
7914
|
7914
|
|
7915
|
7915
|
// Build output string |
7916
|
|
- dol_syslog(get_class($this) . "::selectProjectsList search projects", LOG_DEBUG); |
|
7916
|
+ dol_syslog(get_class($this)."::selectProjectsList search projects", LOG_DEBUG); |
7917
|
7917
|
$result = $this->db->query($sql); |
7918
|
7918
|
if ($result) { |
7919
|
|
- require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; |
7920
|
|
- require_once DOL_DOCUMENT_ROOT . '/core/lib/project.lib.php'; |
|
7919
|
+ require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; |
|
7920
|
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php'; |
7921
|
7921
|
|
7922
|
7922
|
$num = $this->db->num_rows($result); |
7923
|
7923
|
|
7924
|
7924
|
$events = array(); |
7925
|
7925
|
|
7926
|
7926
|
if (!$forcecombo) { |
7927
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
7927
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
7928
|
7928
|
$out .= ajax_combobox($htmlname, $events, $conf->global->PROJECT_USE_SEARCH_TO_SELECT); |
7929
|
7929
|
} |
7930
|
7930
|
|
7931
|
|
- $out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">'; |
|
7931
|
+ $out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">'; |
7932
|
7932
|
|
7933
|
7933
|
$textifempty = ''; |
7934
|
7934
|
// Do not use textifempty = ' ' or ' ' here, or search on key will search on ' key'. |
|
@@ -7945,7 +7945,7 @@ discard block |
|
|
block discarded – undo |
7945
|
7945
|
} |
7946
|
7946
|
} |
7947
|
7947
|
if ($showempty) { |
7948
|
|
- $out .= '<option value="0" selected>' . $textifempty . '</option>'; |
|
7948
|
+ $out .= '<option value="0" selected>'.$textifempty.'</option>'; |
7949
|
7949
|
} |
7950
|
7950
|
|
7951
|
7951
|
$i = 0; |
|
@@ -8003,13 +8003,13 @@ discard block |
|
|
block discarded – undo |
8003
|
8003
|
$outlabel = $objp->label; |
8004
|
8004
|
$outtype = $objp->fk_product_type; |
8005
|
8005
|
|
8006
|
|
- $opt = '<option value="' . $objp->rowid . '"'; |
|
8006
|
+ $opt = '<option value="'.$objp->rowid.'"'; |
8007
|
8007
|
$opt .= ($objp->rowid == $selected) ? ' selected' : ''; |
8008
|
8008
|
$opt .= '>'; |
8009
|
8009
|
$opt .= $objp->ref; |
8010
|
8010
|
$objRef = $objp->ref; |
8011
|
8011
|
if (!empty($filterkey) && $filterkey != '') { |
8012
|
|
- $objRef = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $objRef, 1); |
|
8012
|
+ $objRef = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $objRef, 1); |
8013
|
8013
|
} |
8014
|
8014
|
|
8015
|
8015
|
$opt .= "</option>\n"; |
|
@@ -8051,7 +8051,7 @@ discard block |
|
|
block discarded – undo |
8051
|
8051
|
$placeholder = ''; |
8052
|
8052
|
|
8053
|
8053
|
if ($selected && empty($selected_input_value)) { |
8054
|
|
- require_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php'; |
|
8054
|
+ require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; |
8055
|
8055
|
$adherenttmpselect = new Adherent($this->db); |
8056
|
8056
|
$adherenttmpselect->fetch($selected); |
8057
|
8057
|
$selected_input_value = $adherenttmpselect->ref; |
|
@@ -8060,17 +8060,17 @@ discard block |
|
|
block discarded – undo |
8060
|
8060
|
|
8061
|
8061
|
$urloption = ''; |
8062
|
8062
|
|
8063
|
|
- $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/adherents/ajax/adherents.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions); |
|
8063
|
+ $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/adherents/ajax/adherents.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions); |
8064
|
8064
|
|
8065
|
8065
|
if (empty($hidelabel)) { |
8066
|
|
- $out .= $langs->trans("RefOrLabel") . ' : '; |
|
8066
|
+ $out .= $langs->trans("RefOrLabel").' : '; |
8067
|
8067
|
} elseif ($hidelabel > 1) { |
8068
|
|
- $placeholder = ' placeholder="' . $langs->trans("RefOrLabel") . '"'; |
|
8068
|
+ $placeholder = ' placeholder="'.$langs->trans("RefOrLabel").'"'; |
8069
|
8069
|
if ($hidelabel == 2) { |
8070
|
8070
|
$out .= img_picto($langs->trans("Search"), 'search'); |
8071
|
8071
|
} |
8072
|
8072
|
} |
8073
|
|
- $out .= '<input type="text" class="minwidth100" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . $placeholder . ' ' . (getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '') . ' />'; |
|
8073
|
+ $out .= '<input type="text" class="minwidth100" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' '.(getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '').' />'; |
8074
|
8074
|
if ($hidelabel == 3) { |
8075
|
8075
|
$out .= img_picto($langs->trans("Search"), 'search'); |
8076
|
8076
|
} |
|
@@ -8115,8 +8115,8 @@ discard block |
|
|
block discarded – undo |
8115
|
8115
|
|
8116
|
8116
|
$sql = "SELECT "; |
8117
|
8117
|
$sql .= $selectFields; |
8118
|
|
- $sql .= " FROM " . $this->db->prefix() . "adherent as p"; |
8119
|
|
- $sql .= ' WHERE p.entity IN (' . getEntity('adherent') . ')'; |
|
8118
|
+ $sql .= " FROM ".$this->db->prefix()."adherent as p"; |
|
8119
|
+ $sql .= ' WHERE p.entity IN ('.getEntity('adherent').')'; |
8120
|
8120
|
|
8121
|
8121
|
// Add criteria on ref/label |
8122
|
8122
|
if ($filterkey != '') { |
|
@@ -8132,8 +8132,8 @@ discard block |
|
|
block discarded – undo |
8132
|
8132
|
if ($i > 0) { |
8133
|
8133
|
$sql .= " AND "; |
8134
|
8134
|
} |
8135
|
|
- $sql .= "(p.firstname LIKE '" . $this->db->escape($prefix . $crit) . "%'"; |
8136
|
|
- $sql .= " OR p.lastname LIKE '" . $this->db->escape($prefix . $crit) . "%')"; |
|
8135
|
+ $sql .= "(p.firstname LIKE '".$this->db->escape($prefix.$crit)."%'"; |
|
8136
|
+ $sql .= " OR p.lastname LIKE '".$this->db->escape($prefix.$crit)."%')"; |
8137
|
8137
|
$i++; |
8138
|
8138
|
} |
8139
|
8139
|
if (count($search_crit) > 1) { |
|
@@ -8142,27 +8142,27 @@ discard block |
|
|
block discarded – undo |
8142
|
8142
|
$sql .= ')'; |
8143
|
8143
|
} |
8144
|
8144
|
if ($status != -1) { |
8145
|
|
- $sql .= ' AND statut = ' . ((int) $status); |
|
8145
|
+ $sql .= ' AND statut = '.((int) $status); |
8146
|
8146
|
} |
8147
|
8147
|
$sql .= $this->db->plimit($limit, 0); |
8148
|
8148
|
|
8149
|
8149
|
// Build output string |
8150
|
|
- dol_syslog(get_class($this) . "::selectMembersList search adherents", LOG_DEBUG); |
|
8150
|
+ dol_syslog(get_class($this)."::selectMembersList search adherents", LOG_DEBUG); |
8151
|
8151
|
$result = $this->db->query($sql); |
8152
|
8152
|
if ($result) { |
8153
|
|
- require_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php'; |
8154
|
|
- require_once DOL_DOCUMENT_ROOT . '/core/lib/member.lib.php'; |
|
8153
|
+ require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; |
|
8154
|
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php'; |
8155
|
8155
|
|
8156
|
8156
|
$num = $this->db->num_rows($result); |
8157
|
8157
|
|
8158
|
8158
|
$events = array(); |
8159
|
8159
|
|
8160
|
8160
|
if (!$forcecombo) { |
8161
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
8161
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
8162
|
8162
|
$out .= ajax_combobox($htmlname, $events, getDolGlobalString('PROJECT_USE_SEARCH_TO_SELECT') ? $conf->global->PROJECT_USE_SEARCH_TO_SELECT : ''); |
8163
|
8163
|
} |
8164
|
8164
|
|
8165
|
|
- $out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">'; |
|
8165
|
+ $out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">'; |
8166
|
8166
|
|
8167
|
8167
|
$textifempty = ''; |
8168
|
8168
|
// Do not use textifempty = ' ' or ' ' here, or search on key will search on ' key'. |
|
@@ -8179,7 +8179,7 @@ discard block |
|
|
block discarded – undo |
8179
|
8179
|
} |
8180
|
8180
|
} |
8181
|
8181
|
if ($showempty) { |
8182
|
|
- $out .= '<option value="-1" selected>' . $textifempty . '</option>'; |
|
8182
|
+ $out .= '<option value="-1" selected>'.$textifempty.'</option>'; |
8183
|
8183
|
} |
8184
|
8184
|
|
8185
|
8185
|
$i = 0; |
|
@@ -8235,11 +8235,11 @@ discard block |
|
|
block discarded – undo |
8235
|
8235
|
$outlabel = dolGetFirstLastname($objp->firstname, $objp->lastname); |
8236
|
8236
|
$outtype = $objp->fk_adherent_type; |
8237
|
8237
|
|
8238
|
|
- $opt = '<option value="' . $objp->rowid . '"'; |
|
8238
|
+ $opt = '<option value="'.$objp->rowid.'"'; |
8239
|
8239
|
$opt .= ($objp->rowid == $selected) ? ' selected' : ''; |
8240
|
8240
|
$opt .= '>'; |
8241
|
8241
|
if (!empty($filterkey) && $filterkey != '') { |
8242
|
|
- $outlabel = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $outlabel, 1); |
|
8242
|
+ $outlabel = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $outlabel, 1); |
8243
|
8243
|
} |
8244
|
8244
|
$opt .= $outlabel; |
8245
|
8245
|
$opt .= "</option>\n"; |
|
@@ -8277,8 +8277,8 @@ discard block |
|
|
block discarded – undo |
8277
|
8277
|
$objecttmp = null; |
8278
|
8278
|
$InfoFieldList = array(); |
8279
|
8279
|
$classname = ''; |
8280
|
|
- $filter = ''; // Ensure filter has value (for static analysis) |
8281
|
|
- $sortfield = ''; // Ensure filter has value (for static analysis) |
|
8280
|
+ $filter = ''; // Ensure filter has value (for static analysis) |
|
8281
|
+ $sortfield = ''; // Ensure filter has value (for static analysis) |
8282
|
8282
|
|
8283
|
8283
|
if ($objectfield) { // We must retrieve the objectdesc from the field or extrafield |
8284
|
8284
|
// Example: $objectfield = 'product:options_package' or 'myobject@mymodule:options_myfield' |
|
@@ -8322,9 +8322,9 @@ discard block |
|
|
block discarded – undo |
8322
|
8322
|
$vartmp = (empty($InfoFieldList[3]) ? '' : $InfoFieldList[3]); |
8323
|
8323
|
$reg = array(); |
8324
|
8324
|
if (preg_match('/^.*:(\w*)$/', $vartmp, $reg)) { |
8325
|
|
- $InfoFieldList[4] = $reg[1]; // take the sort field |
|
8325
|
+ $InfoFieldList[4] = $reg[1]; // take the sort field |
8326
|
8326
|
} |
8327
|
|
- $InfoFieldList[3] = preg_replace('/:\w*$/', '', $vartmp); // take the filter field |
|
8327
|
+ $InfoFieldList[3] = preg_replace('/:\w*$/', '', $vartmp); // take the filter field |
8328
|
8328
|
|
8329
|
8329
|
$classname = $InfoFieldList[0]; |
8330
|
8330
|
$classpath = empty($InfoFieldList[1]) ? '' : $InfoFieldList[1]; |
|
@@ -8355,8 +8355,8 @@ discard block |
|
|
block discarded – undo |
8355
|
8355
|
); |
8356
|
8356
|
|
8357
|
8357
|
if (!is_object($objecttmp)) { |
8358
|
|
- dol_syslog('selectForForms: Error bad setup of field objectdescorig=' . $objectdescorig.', objectfield='.$objectfield.', objectdesc='.$objectdesc, LOG_WARNING); |
8359
|
|
- return 'selectForForms: Error bad setup of field objectdescorig=' . $objectdescorig.', objectfield='.$objectfield.', objectdesc='.$objectdesc; |
|
8358
|
+ dol_syslog('selectForForms: Error bad setup of field objectdescorig='.$objectdescorig.', objectfield='.$objectfield.', objectdesc='.$objectdesc, LOG_WARNING); |
|
8359
|
+ return 'selectForForms: Error bad setup of field objectdescorig='.$objectdescorig.', objectfield='.$objectfield.', objectdesc='.$objectdesc; |
8360
|
8360
|
} |
8361
|
8361
|
'@phan-var-force CommonObject $objecttmp'; |
8362
|
8362
|
|
|
@@ -8368,9 +8368,9 @@ discard block |
|
|
block discarded – undo |
8368
|
8368
|
if ($prefixforautocompletemode == 'product') { |
8369
|
8369
|
$prefixforautocompletemode = 'produit'; |
8370
|
8370
|
} |
8371
|
|
- $confkeyforautocompletemode = strtoupper($prefixforautocompletemode) . '_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT |
|
8371
|
+ $confkeyforautocompletemode = strtoupper($prefixforautocompletemode).'_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT |
8372
|
8372
|
|
8373
|
|
- dol_syslog(get_class($this) . "::selectForForms filter=" . $filter, LOG_DEBUG); |
|
8373
|
+ dol_syslog(get_class($this)."::selectForForms filter=".$filter, LOG_DEBUG); |
8374
|
8374
|
|
8375
|
8375
|
// Generate the combo HTML component |
8376
|
8376
|
$out = ''; |
|
@@ -8399,13 +8399,13 @@ discard block |
|
|
block discarded – undo |
8399
|
8399
|
} |
8400
|
8400
|
|
8401
|
8401
|
// Set url and param to call to get json of the search results |
8402
|
|
- $urlforajaxcall = DOL_URL_ROOT . '/core/ajax/selectobject.php'; |
8403
|
|
- $urloption = 'htmlname=' . urlencode($htmlname) . '&outjson=1&objectdesc=' . urlencode($objectdescorig) . '&objectfield='.urlencode($objectfield) . ($sortfield ? '&sortfield=' . urlencode($sortfield) : ''); |
|
8402
|
+ $urlforajaxcall = DOL_URL_ROOT.'/core/ajax/selectobject.php'; |
|
8403
|
+ $urloption = 'htmlname='.urlencode($htmlname).'&outjson=1&objectdesc='.urlencode($objectdescorig).'&objectfield='.urlencode($objectfield).($sortfield ? '&sortfield='.urlencode($sortfield) : ''); |
8404
|
8404
|
|
8405
|
8405
|
// Activate the auto complete using ajax call. |
8406
|
8406
|
$out .= ajax_autocompleter($preSelectedValue, $htmlname, $urlforajaxcall, $urloption, getDolGlobalString($confkeyforautocompletemode), 0); |
8407
|
8407
|
$out .= '<!-- force css to be higher than dialog popup --><style type="text/css">.ui-autocomplete { z-index: 1010; }</style>'; |
8408
|
|
- $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) . '"' : '') . ' />'; |
|
8408
|
+ $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).'"' : '').' />'; |
8409
|
8409
|
} else { |
8410
|
8410
|
// Immediate load of table record. |
8411
|
8411
|
$out .= $this->selectForFormsList($objecttmp, $htmlname, $preSelectedValue, $showempty, $searchkey, $placeholder, $morecss, $moreparams, $forcecombo, 0, $disabled, $sortfield, $filter); |
|
@@ -8445,16 +8445,16 @@ discard block |
|
|
block discarded – undo |
8445
|
8445
|
if ($prefixforautocompletemode == 'societe') { |
8446
|
8446
|
$prefixforautocompletemode = 'company'; |
8447
|
8447
|
} |
8448
|
|
- $confkeyforautocompletemode = strtoupper($prefixforautocompletemode) . '_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT |
|
8448
|
+ $confkeyforautocompletemode = strtoupper($prefixforautocompletemode).'_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT |
8449
|
8449
|
|
8450
|
8450
|
if (!empty($objecttmp->fields)) { // For object that declare it, it is better to use declared fields (like societe, contact, ...) |
8451
|
8451
|
$tmpfieldstoshow = ''; |
8452
|
8452
|
foreach ($objecttmp->fields as $key => $val) { |
8453
|
|
- if (! (int) dol_eval($val['enabled'], 1, 1, '1')) { |
|
8453
|
+ if (!(int) dol_eval($val['enabled'], 1, 1, '1')) { |
8454
|
8454
|
continue; |
8455
|
8455
|
} |
8456
|
8456
|
if (!empty($val['showoncombobox'])) { |
8457
|
|
- $tmpfieldstoshow .= ($tmpfieldstoshow ? ',' : '') . 't.' . $key; |
|
8457
|
+ $tmpfieldstoshow .= ($tmpfieldstoshow ? ',' : '').'t.'.$key; |
8458
|
8458
|
} |
8459
|
8459
|
} |
8460
|
8460
|
if ($tmpfieldstoshow) { |
|
@@ -8482,18 +8482,18 @@ discard block |
|
|
block discarded – undo |
8482
|
8482
|
$num = 0; |
8483
|
8483
|
|
8484
|
8484
|
// Search data |
8485
|
|
- $sql = "SELECT t.rowid, " . $fieldstoshow . " FROM " . $this->db->prefix() . $objecttmp->table_element . " as t"; |
|
8485
|
+ $sql = "SELECT t.rowid, ".$fieldstoshow." FROM ".$this->db->prefix().$objecttmp->table_element." as t"; |
8486
|
8486
|
if (!empty($objecttmp->isextrafieldmanaged)) { |
8487
|
|
- $sql .= " LEFT JOIN " . $this->db->prefix() . $objecttmp->table_element . "_extrafields as e ON t.rowid=e.fk_object"; |
|
8487
|
+ $sql .= " LEFT JOIN ".$this->db->prefix().$objecttmp->table_element."_extrafields as e ON t.rowid=e.fk_object"; |
8488
|
8488
|
} |
8489
|
8489
|
if (isset($objecttmp->ismultientitymanaged)) { |
8490
|
8490
|
if (!is_numeric($objecttmp->ismultientitymanaged)) { |
8491
|
8491
|
$tmparray = explode('@', $objecttmp->ismultientitymanaged); |
8492
|
|
- $sql .= " INNER JOIN " . $this->db->prefix() . $tmparray[1] . " as parenttable ON parenttable.rowid = t." . $tmparray[0]; |
|
8492
|
+ $sql .= " INNER JOIN ".$this->db->prefix().$tmparray[1]." as parenttable ON parenttable.rowid = t.".$tmparray[0]; |
8493
|
8493
|
} |
8494
|
8494
|
if ($objecttmp->ismultientitymanaged === 'fk_soc@societe') { |
8495
|
8495
|
if (!$user->hasRight('societe', 'client', 'voir')) { |
8496
|
|
- $sql .= ", " . $this->db->prefix() . "societe_commerciaux as sc"; |
|
8496
|
+ $sql .= ", ".$this->db->prefix()."societe_commerciaux as sc"; |
8497
|
8497
|
} |
8498
|
8498
|
} |
8499
|
8499
|
} |
|
@@ -8513,21 +8513,21 @@ discard block |
|
|
block discarded – undo |
8513
|
8513
|
$sql .= " WHERE 1=1"; |
8514
|
8514
|
if (isset($objecttmp->ismultientitymanaged)) { |
8515
|
8515
|
if ($objecttmp->ismultientitymanaged == 1) { |
8516
|
|
- $sql .= " AND t.entity IN (" . getEntity($objecttmp->table_element) . ")"; |
|
8516
|
+ $sql .= " AND t.entity IN (".getEntity($objecttmp->table_element).")"; |
8517
|
8517
|
} |
8518
|
8518
|
if (!is_numeric($objecttmp->ismultientitymanaged)) { |
8519
|
|
- $sql .= " AND parenttable.entity = t." . $tmparray[0]; |
|
8519
|
+ $sql .= " AND parenttable.entity = t.".$tmparray[0]; |
8520
|
8520
|
} |
8521
|
8521
|
if ($objecttmp->ismultientitymanaged == 1 && !empty($user->socid)) { |
8522
|
8522
|
if ($objecttmp->element == 'societe') { |
8523
|
|
- $sql .= " AND t.rowid = " . ((int) $user->socid); |
|
8523
|
+ $sql .= " AND t.rowid = ".((int) $user->socid); |
8524
|
8524
|
} else { |
8525
|
|
- $sql .= " AND t.fk_soc = " . ((int) $user->socid); |
|
8525
|
+ $sql .= " AND t.fk_soc = ".((int) $user->socid); |
8526
|
8526
|
} |
8527
|
8527
|
} |
8528
|
8528
|
if ($objecttmp->ismultientitymanaged === 'fk_soc@societe') { |
8529
|
8529
|
if (!$user->hasRight('societe', 'client', 'voir')) { |
8530
|
|
- $sql .= " AND t.rowid = sc.fk_soc AND sc.fk_user = " . ((int) $user->id); |
|
8530
|
+ $sql .= " AND t.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id); |
8531
|
8531
|
} |
8532
|
8532
|
} |
8533
|
8533
|
} |
|
@@ -8539,7 +8539,7 @@ discard block |
|
|
block discarded – undo |
8539
|
8539
|
$errormessage = ''; |
8540
|
8540
|
$sql .= forgeSQLFromUniversalSearchCriteria($filter, $errormessage); |
8541
|
8541
|
if ($errormessage) { |
8542
|
|
- return 'Error forging a SQL request from an universal criteria: ' . $errormessage; |
|
8542
|
+ return 'Error forging a SQL request from an universal criteria: '.$errormessage; |
8543
|
8543
|
} |
8544
|
8544
|
} |
8545
|
8545
|
} |
|
@@ -8551,7 +8551,7 @@ discard block |
|
|
block discarded – undo |
8551
|
8551
|
$resql = $this->db->query($sql); |
8552
|
8552
|
if ($resql) { |
8553
|
8553
|
// Construct $out and $outarray |
8554
|
|
- $out .= '<select id="' . $htmlname . '" class="flat minwidth100' . ($morecss ? ' ' . $morecss : '') . '"' . ($disabled ? ' disabled="disabled"' : '') . ($moreparams ? ' ' . $moreparams : '') . ' name="' . $htmlname . '">' . "\n"; |
|
8554
|
+ $out .= '<select id="'.$htmlname.'" class="flat minwidth100'.($morecss ? ' '.$morecss : '').'"'.($disabled ? ' disabled="disabled"' : '').($moreparams ? ' '.$moreparams : '').' name="'.$htmlname.'">'."\n"; |
8555
|
8555
|
|
8556
|
8556
|
// Warning: Do not use textifempty = ' ' or ' ' here, or search on key will search on ' key'. Seems it is no more true with selec2 v4 |
8557
|
8557
|
$textifempty = ' '; |
|
@@ -8565,7 +8565,7 @@ discard block |
|
|
block discarded – undo |
8565
|
8565
|
} |
8566
|
8566
|
} |
8567
|
8567
|
if ($showempty) { |
8568
|
|
- $out .= '<option value="-1">' . $textifempty . '</option>' . "\n"; |
|
8568
|
+ $out .= '<option value="-1">'.$textifempty.'</option>'."\n"; |
8569
|
8569
|
} |
8570
|
8570
|
|
8571
|
8571
|
$num = $this->db->num_rows($resql); |
|
@@ -8588,9 +8588,9 @@ discard block |
|
|
block discarded – undo |
8588
|
8588
|
} |
8589
|
8589
|
if (empty($outputmode)) { |
8590
|
8590
|
if ($preselectedvalue > 0 && $preselectedvalue == $obj->rowid) { |
8591
|
|
- $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>'; |
|
8591
|
+ $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>'; |
8592
|
8592
|
} else { |
8593
|
|
- $out .= '<option value="' . $obj->rowid . '" data-html="' . dol_escape_htmltag($labelhtml, 0, 0, '', 0, 1) . '">' . dol_escape_htmltag($label, 0, 0, '', 0, 1) . '</option>'; |
|
8593
|
+ $out .= '<option value="'.$obj->rowid.'" data-html="'.dol_escape_htmltag($labelhtml, 0, 0, '', 0, 1).'">'.dol_escape_htmltag($label, 0, 0, '', 0, 1).'</option>'; |
8594
|
8594
|
} |
8595
|
8595
|
} else { |
8596
|
8596
|
array_push($outarray, array('key' => $obj->rowid, 'value' => $label, 'label' => $label)); |
|
@@ -8603,10 +8603,10 @@ discard block |
|
|
block discarded – undo |
8603
|
8603
|
} |
8604
|
8604
|
} |
8605
|
8605
|
|
8606
|
|
- $out .= '</select>' . "\n"; |
|
8606
|
+ $out .= '</select>'."\n"; |
8607
|
8607
|
|
8608
|
8608
|
if (!$forcecombo) { |
8609
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
8609
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
8610
|
8610
|
$out .= ajax_combobox($htmlname, array(), getDolGlobalInt($confkeyforautocompletemode, 0)); |
8611
|
8611
|
} |
8612
|
8612
|
} else { |
|
@@ -8670,8 +8670,8 @@ discard block |
|
|
block discarded – undo |
8670
|
8670
|
} |
8671
|
8671
|
} |
8672
|
8672
|
$idname = str_replace(array('[', ']'), array('', ''), $htmlname); |
8673
|
|
- $out .= '<select id="' . preg_replace('/^\./', '', $idname) . '" ' . ($disabled ? 'disabled="disabled" ' : '') . 'class="flat ' . (preg_replace('/^\./', '', $htmlname)) . ($morecss ? ' ' . $morecss : '') . ' selectformat"'; |
8674
|
|
- $out .= ' name="' . preg_replace('/^\./', '', $htmlname) . '" ' . ($moreparam ? $moreparam : ''); |
|
8673
|
+ $out .= '<select id="'.preg_replace('/^\./', '', $idname).'" '.($disabled ? 'disabled="disabled" ' : '').'class="flat '.(preg_replace('/^\./', '', $htmlname)).($morecss ? ' '.$morecss : '').' selectformat"'; |
|
8674
|
+ $out .= ' name="'.preg_replace('/^\./', '', $htmlname).'" '.($moreparam ? $moreparam : ''); |
8675
|
8675
|
$out .= '>'."\n"; |
8676
|
8676
|
|
8677
|
8677
|
if ($show_empty) { |
|
@@ -8682,7 +8682,7 @@ discard block |
|
|
block discarded – undo |
8682
|
8682
|
if (!is_numeric($show_empty)) { |
8683
|
8683
|
$textforempty = $show_empty; |
8684
|
8684
|
} |
8685
|
|
- $out .= '<option class="optiongrey" ' . ($moreparamonempty ? $moreparamonempty . ' ' : '') . 'value="' . (((int) $show_empty) < 0 ? $show_empty : -1) . '"' . ($id == $show_empty ? ' selected' : '') . '>' . $textforempty . '</option>' . "\n"; |
|
8685
|
+ $out .= '<option class="optiongrey" '.($moreparamonempty ? $moreparamonempty.' ' : '').'value="'.(((int) $show_empty) < 0 ? $show_empty : -1).'"'.($id == $show_empty ? ' selected' : '').'>'.$textforempty.'</option>'."\n"; |
8686
|
8686
|
} |
8687
|
8687
|
if (is_array($array)) { |
8688
|
8688
|
// Translate |
|
@@ -8707,7 +8707,7 @@ discard block |
|
|
block discarded – undo |
8707
|
8707
|
$value = $tmpvalue['label']; |
8708
|
8708
|
//$valuehtml = empty($tmpvalue['data-html']) ? $value : $tmpvalue['data-html']; |
8709
|
8709
|
$disabled = empty($tmpvalue['disabled']) ? '' : ' disabled'; |
8710
|
|
- $style = empty($tmpvalue['css']) ? '' : ' class="' . $tmpvalue['css'] . '"'; |
|
8710
|
+ $style = empty($tmpvalue['css']) ? '' : ' class="'.$tmpvalue['css'].'"'; |
8711
|
8711
|
} else { |
8712
|
8712
|
$value = $tmpvalue; |
8713
|
8713
|
//$valuehtml = $tmpvalue; |
|
@@ -8723,9 +8723,9 @@ discard block |
|
|
block discarded – undo |
8723
|
8723
|
} |
8724
|
8724
|
if ($key_in_label) { |
8725
|
8725
|
if (empty($nohtmlescape)) { |
8726
|
|
- $selectOptionValue = dol_escape_htmltag($key . ' - ' . ($maxlen ? dol_trunc($value, $maxlen) : $value)); |
|
8726
|
+ $selectOptionValue = dol_escape_htmltag($key.' - '.($maxlen ? dol_trunc($value, $maxlen) : $value)); |
8727
|
8727
|
} else { |
8728
|
|
- $selectOptionValue = $key . ' - ' . ($maxlen ? dol_trunc($value, $maxlen) : $value); |
|
8728
|
+ $selectOptionValue = $key.' - '.($maxlen ? dol_trunc($value, $maxlen) : $value); |
8729
|
8729
|
} |
8730
|
8730
|
} else { |
8731
|
8731
|
if (empty($nohtmlescape)) { |
|
@@ -8737,8 +8737,8 @@ discard block |
|
|
block discarded – undo |
8737
|
8737
|
$selectOptionValue = ' '; |
8738
|
8738
|
} |
8739
|
8739
|
} |
8740
|
|
- $out .= '<option value="' . $key . '"'; |
8741
|
|
- $out .= $style . $disabled; |
|
8740
|
+ $out .= '<option value="'.$key.'"'; |
|
8741
|
+ $out .= $style.$disabled; |
8742
|
8742
|
if (is_array($id)) { |
8743
|
8743
|
if (in_array($key, $id) && !$disabled) { |
8744
|
8744
|
$out .= ' selected'; // To preselect a value |
|
@@ -8750,7 +8750,7 @@ discard block |
|
|
block discarded – undo |
8750
|
8750
|
} |
8751
|
8751
|
} |
8752
|
8752
|
if (!empty($nohtmlescape)) { // deprecated. Use instead the key 'data-html' into input $array, managed at next step to use HTML content. |
8753
|
|
- $out .= ' data-html="' . dol_escape_htmltag($selectOptionValue) . '"'; |
|
8753
|
+ $out .= ' data-html="'.dol_escape_htmltag($selectOptionValue).'"'; |
8754
|
8754
|
} |
8755
|
8755
|
|
8756
|
8756
|
if (is_array($tmpvalue)) { |
|
@@ -8770,7 +8770,7 @@ discard block |
|
|
block discarded – undo |
8770
|
8770
|
// Add code for jquery to use multiselect |
8771
|
8771
|
if ($addjscombo && $jsbeautify) { |
8772
|
8772
|
// Enhance with select2 |
8773
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
8773
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
8774
|
8774
|
$out .= ajax_combobox($idname, array(), 0, 0, 'resolve', (((int) $show_empty) < 0 ? (string) $show_empty : '-1'), $morecss); |
8775
|
8775
|
} |
8776
|
8776
|
|
|
@@ -8798,28 +8798,28 @@ discard block |
|
|
block discarded – undo |
8798
|
8798
|
public static function selectArrayAjax($htmlname, $url, $id = '', $moreparam = '', $moreparamtourl = '', $disabled = 0, $minimumInputLength = 1, $morecss = '', $callurlonselect = 0, $placeholder = '', $acceptdelayedhtml = 0) |
8799
|
8799
|
{ |
8800
|
8800
|
global $conf, $langs; |
8801
|
|
- global $delayedhtmlcontent; // Will be used later outside of this function |
|
8801
|
+ global $delayedhtmlcontent; // Will be used later outside of this function |
8802
|
8802
|
|
8803
|
8803
|
// TODO Use an internal dolibarr component instead of select2 |
8804
|
8804
|
if (!getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') && !defined('REQUIRE_JQUERY_MULTISELECT')) { |
8805
|
8805
|
return ''; |
8806
|
8806
|
} |
8807
|
8807
|
|
8808
|
|
- $out = '<select type="text" class="' . $htmlname . ($morecss ? ' ' . $morecss : '') . '" ' . ($moreparam ? $moreparam . ' ' : '') . 'name="' . $htmlname . '"></select>'; |
|
8808
|
+ $out = '<select type="text" class="'.$htmlname.($morecss ? ' '.$morecss : '').'" '.($moreparam ? $moreparam.' ' : '').'name="'.$htmlname.'"></select>'; |
8809
|
8809
|
|
8810
|
8810
|
$outdelayed = ''; |
8811
|
8811
|
if (!empty($conf->use_javascript_ajax)) { |
8812
|
8812
|
$tmpplugin = 'select2'; |
8813
|
|
- $outdelayed = "\n" . '<!-- JS CODE TO ENABLE ' . $tmpplugin . ' for id ' . $htmlname . ' --> |
8814
|
|
- <script nonce="' . getNonce() . '"> |
|
8813
|
+ $outdelayed = "\n".'<!-- JS CODE TO ENABLE '.$tmpplugin.' for id '.$htmlname.' --> |
|
8814
|
+ <script nonce="' . getNonce().'"> |
8815
|
8815
|
$(document).ready(function () { |
8816
|
8816
|
|
8817
|
|
- ' . ($callurlonselect ? 'var saveRemoteData = [];' : '') . ' |
|
8817
|
+ ' . ($callurlonselect ? 'var saveRemoteData = [];' : '').' |
8818
|
8818
|
|
8819
|
|
- $(".' . $htmlname . '").select2({ |
|
8819
|
+ $(".' . $htmlname.'").select2({ |
8820
|
8820
|
ajax: { |
8821
|
8821
|
dir: "ltr", |
8822
|
|
- url: "' . $url . '", |
|
8822
|
+ url: "' . $url.'", |
8823
|
8823
|
dataType: \'json\', |
8824
|
8824
|
delay: 250, |
8825
|
8825
|
data: function (params) { |
|
@@ -8846,9 +8846,9 @@ discard block |
|
|
block discarded – undo |
8846
|
8846
|
}, |
8847
|
8847
|
language: select2arrayoflanguage, |
8848
|
8848
|
containerCssClass: \':all:\', /* Line to add class of origin SELECT propagated to the new <span class="select2-selection...> tag */ |
8849
|
|
- placeholder: "' . dol_escape_js($placeholder) . '", |
|
8849
|
+ placeholder: "' . dol_escape_js($placeholder).'", |
8850
|
8850
|
escapeMarkup: function (markup) { return markup; }, // let our custom formatter work |
8851
|
|
- minimumInputLength: ' . ((int) $minimumInputLength) . ', |
|
8851
|
+ minimumInputLength: ' . ((int) $minimumInputLength).', |
8852
|
8852
|
formatResult: function (result, container, query, escapeMarkup) { |
8853
|
8853
|
return escapeMarkup(result.text); |
8854
|
8854
|
}, |
|
@@ -8856,10 +8856,10 @@ discard block |
|
|
block discarded – undo |
8856
|
8856
|
|
8857
|
8857
|
' . ($callurlonselect ? ' |
8858
|
8858
|
/* Code to execute a GET when we select a value */ |
8859
|
|
- $(".' . $htmlname . '").change(function() { |
8860
|
|
- var selected = $(".' . $htmlname . '").val(); |
|
8859
|
+ $(".' . $htmlname.'").change(function() { |
|
8860
|
+ var selected = $(".' . $htmlname.'").val(); |
8861
|
8861
|
console.log("We select in selectArrayAjax the entry "+selected) |
8862
|
|
- $(".' . $htmlname . '").val(""); /* reset visible combo value */ |
|
8862
|
+ $(".' . $htmlname.'").val(""); /* reset visible combo value */ |
8863
|
8863
|
$.each( saveRemoteData, function( key, value ) { |
8864
|
8864
|
if (key == selected) |
8865
|
8865
|
{ |
|
@@ -8867,7 +8867,7 @@ discard block |
|
|
block discarded – undo |
8867
|
8867
|
location.assign(value.url); |
8868
|
8868
|
} |
8869
|
8869
|
}); |
8870
|
|
- });' : '') . ' |
|
8870
|
+ });' : '').' |
8871
|
8871
|
|
8872
|
8872
|
}); |
8873
|
8873
|
</script>'; |
|
@@ -8903,14 +8903,14 @@ discard block |
|
|
block discarded – undo |
8903
|
8903
|
public static function selectArrayFilter($htmlname, $array, $id = '', $moreparam = '', $disableFiltering = 0, $disabled = 0, $minimumInputLength = 1, $morecss = '', $callurlonselect = 0, $placeholder = '', $acceptdelayedhtml = 0, $textfortitle = '') |
8904
|
8904
|
{ |
8905
|
8905
|
global $conf, $langs; |
8906
|
|
- global $delayedhtmlcontent; // Will be used later outside of this function |
|
8906
|
+ global $delayedhtmlcontent; // Will be used later outside of this function |
8907
|
8907
|
|
8908
|
8908
|
// TODO Use an internal dolibarr component instead of select2 |
8909
|
8909
|
if (!getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') && !defined('REQUIRE_JQUERY_MULTISELECT')) { |
8910
|
8910
|
return ''; |
8911
|
8911
|
} |
8912
|
8912
|
|
8913
|
|
- $out = '<select type="text"'.($textfortitle ? ' title="'.dol_escape_htmltag($textfortitle).'"' : '').' id="'.$htmlname.'" class="'.$htmlname.($morecss ? ' ' . $morecss : '').'"'.($moreparam ? ' '.$moreparam : '').' name="'.$htmlname.'"><option></option></select>'; |
|
8913
|
+ $out = '<select type="text"'.($textfortitle ? ' title="'.dol_escape_htmltag($textfortitle).'"' : '').' id="'.$htmlname.'" class="'.$htmlname.($morecss ? ' '.$morecss : '').'"'.($moreparam ? ' '.$moreparam : '').' name="'.$htmlname.'"><option></option></select>'; |
8914
|
8914
|
|
8915
|
8915
|
$formattedarrayresult = array(); |
8916
|
8916
|
|
|
@@ -8925,20 +8925,20 @@ discard block |
|
|
block discarded – undo |
8925
|
8925
|
$outdelayed = ''; |
8926
|
8926
|
if (!empty($conf->use_javascript_ajax)) { |
8927
|
8927
|
$tmpplugin = 'select2'; |
8928
|
|
- $outdelayed = "\n" . '<!-- JS CODE TO ENABLE ' . $tmpplugin . ' for id ' . $htmlname . ' --> |
8929
|
|
- <script nonce="' . getNonce() . '"> |
|
8928
|
+ $outdelayed = "\n".'<!-- JS CODE TO ENABLE '.$tmpplugin.' for id '.$htmlname.' --> |
|
8929
|
+ <script nonce="' . getNonce().'"> |
8930
|
8930
|
$(document).ready(function () { |
8931
|
|
- var data = ' . json_encode($formattedarrayresult) . '; |
|
8931
|
+ var data = ' . json_encode($formattedarrayresult).'; |
8932
|
8932
|
|
8933
|
|
- ' . ($callurlonselect ? 'var saveRemoteData = ' . json_encode($array) . ';' : '') . ' |
|
8933
|
+ ' . ($callurlonselect ? 'var saveRemoteData = '.json_encode($array).';' : '').' |
8934
|
8934
|
|
8935
|
|
- $(".' . $htmlname . '").select2({ |
|
8935
|
+ $(".' . $htmlname.'").select2({ |
8936
|
8936
|
data: data, |
8937
|
8937
|
language: select2arrayoflanguage, |
8938
|
8938
|
containerCssClass: \':all:\', /* Line to add class of origin SELECT propagated to the new <span class="select2-selection...> tag */ |
8939
|
|
- placeholder: "' . dol_escape_js($placeholder) . '", |
|
8939
|
+ placeholder: "' . dol_escape_js($placeholder).'", |
8940
|
8940
|
escapeMarkup: function (markup) { return markup; }, // let our custom formatter work |
8941
|
|
- minimumInputLength: ' . $minimumInputLength . ', |
|
8941
|
+ minimumInputLength: ' . $minimumInputLength.', |
8942
|
8942
|
formatResult: function (result, container, query, escapeMarkup) { |
8943
|
8943
|
return escapeMarkup(result.text); |
8944
|
8944
|
}, |
|
@@ -8977,11 +8977,11 @@ discard block |
|
|
block discarded – undo |
8977
|
8977
|
|
8978
|
8978
|
' . ($callurlonselect ? ' |
8979
|
8979
|
/* Code to execute a GET when we select a value */ |
8980
|
|
- $(".' . $htmlname . '").change(function() { |
8981
|
|
- var selected = $(".' . $htmlname . '").val(); |
|
8980
|
+ $(".' . $htmlname.'").change(function() { |
|
8981
|
+ var selected = $(".' . $htmlname.'").val(); |
8982
|
8982
|
console.log("We select "+selected) |
8983
|
8983
|
|
8984
|
|
- $(".' . $htmlname . '").val(""); /* reset visible combo value */ |
|
8984
|
+ $(".' . $htmlname.'").val(""); /* reset visible combo value */ |
8985
|
8985
|
$.each( saveRemoteData, function( key, value ) { |
8986
|
8986
|
if (key == selected) |
8987
|
8987
|
{ |
|
@@ -8989,7 +8989,7 @@ discard block |
|
|
block discarded – undo |
8989
|
8989
|
location.assign(value.url); |
8990
|
8990
|
} |
8991
|
8991
|
}); |
8992
|
|
- });' : '') . ' |
|
8992
|
+ });' : '').' |
8993
|
8993
|
|
8994
|
8994
|
}); |
8995
|
8995
|
</script>'; |
|
@@ -9038,7 +9038,7 @@ discard block |
|
|
block discarded – undo |
9038
|
9038
|
$useenhancedmultiselect = 0; |
9039
|
9039
|
if (!empty($conf->use_javascript_ajax) && !defined('MAIN_DO_NOT_USE_JQUERY_MULTISELECT') && (getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') || defined('REQUIRE_JQUERY_MULTISELECT'))) { |
9040
|
9040
|
if ($addjscombo) { |
9041
|
|
- $useenhancedmultiselect = 1; // Use the js multiselect in one line. Possible only if $addjscombo not 0. |
|
9041
|
+ $useenhancedmultiselect = 1; // Use the js multiselect in one line. Possible only if $addjscombo not 0. |
9042
|
9042
|
} |
9043
|
9043
|
} |
9044
|
9044
|
|
|
@@ -9047,7 +9047,7 @@ discard block |
|
|
block discarded – undo |
9047
|
9047
|
// submitted to nothing. |
9048
|
9048
|
$out .= '<input type="hidden" name="'.$htmlname.'_multiselect" value="1">'; |
9049
|
9049
|
// Output select component |
9050
|
|
- $out .= '<select id="' . $htmlname . '" class="multiselect' . ($useenhancedmultiselect ? ' multiselectononeline' : '') . ($morecss ? ' ' . $morecss : '') . '" multiple name="' . $htmlname . '[]"' . ($moreattrib ? ' ' . $moreattrib : '') . ($width ? ' style="width: ' . (preg_match('/%/', (string) $width) ? $width : $width . 'px') . '"' : '') . '>' . "\n"; |
|
9050
|
+ $out .= '<select id="'.$htmlname.'" class="multiselect'.($useenhancedmultiselect ? ' multiselectononeline' : '').($morecss ? ' '.$morecss : '').'" multiple name="'.$htmlname.'[]"'.($moreattrib ? ' '.$moreattrib : '').($width ? ' style="width: '.(preg_match('/%/', (string) $width) ? $width : $width.'px').'"' : '').'>'."\n"; |
9051
|
9051
|
if (is_array($array) && !empty($array)) { |
9052
|
9052
|
if ($value_as_key) { |
9053
|
9053
|
$array = array_combine($array, $array); |
|
@@ -9065,36 +9065,36 @@ discard block |
|
|
block discarded – undo |
9065
|
9065
|
$tmpvalue = empty($value['label']) ? '' : $value['label']; |
9066
|
9066
|
$tmpcolor = empty($value['color']) ? '' : $value['color']; |
9067
|
9067
|
$tmppicto = empty($value['picto']) ? '' : $value['picto']; |
9068
|
|
- $tmplabelhtml = empty($value['labelhtml']) ? (empty($value['data-html']) ? '' : $value['data-html']): $value['labelhtml']; |
|
9068
|
+ $tmplabelhtml = empty($value['labelhtml']) ? (empty($value['data-html']) ? '' : $value['data-html']) : $value['labelhtml']; |
9069
|
9069
|
} |
9070
|
9070
|
$newval = ($translate ? $langs->trans($tmpvalue) : $tmpvalue); |
9071
|
|
- $newval = ($key_in_label ? $tmpkey . ' - ' . $newval : $newval); |
|
9071
|
+ $newval = ($key_in_label ? $tmpkey.' - '.$newval : $newval); |
9072
|
9072
|
|
9073
|
|
- $out .= '<option value="' . $tmpkey . '"'; |
|
9073
|
+ $out .= '<option value="'.$tmpkey.'"'; |
9074
|
9074
|
if (is_array($selected) && !empty($selected) && in_array((string) $tmpkey, $selected) && ((string) $tmpkey != '')) { |
9075
|
9075
|
$out .= ' selected'; |
9076
|
9076
|
} |
9077
|
9077
|
if (!empty($tmplabelhtml)) { |
9078
|
|
- $out .= ' data-html="' . dol_escape_htmltag($tmplabelhtml, 0, 0, '', 0, 1) . '"'; |
|
9078
|
+ $out .= ' data-html="'.dol_escape_htmltag($tmplabelhtml, 0, 0, '', 0, 1).'"'; |
9079
|
9079
|
} else { |
9080
|
|
- $tmplabelhtml = ($tmppicto ? img_picto('', $tmppicto, 'class="pictofixedwidth" style="color: #' . $tmpcolor . '"') : '') . $newval; |
9081
|
|
- $out .= ' data-html="' . dol_escape_htmltag($tmplabelhtml, 0, 0, '', 0, 1) . '"'; |
|
9080
|
+ $tmplabelhtml = ($tmppicto ? img_picto('', $tmppicto, 'class="pictofixedwidth" style="color: #'.$tmpcolor.'"') : '').$newval; |
|
9081
|
+ $out .= ' data-html="'.dol_escape_htmltag($tmplabelhtml, 0, 0, '', 0, 1).'"'; |
9082
|
9082
|
} |
9083
|
9083
|
$out .= '>'; |
9084
|
9084
|
$out .= dol_htmlentitiesbr($newval); |
9085
|
|
- $out .= '</option>' . "\n"; |
|
9085
|
+ $out .= '</option>'."\n"; |
9086
|
9086
|
} |
9087
|
9087
|
} |
9088
|
9088
|
} |
9089
|
|
- $out .= '</select>' . "\n"; |
|
9089
|
+ $out .= '</select>'."\n"; |
9090
|
9090
|
|
9091
|
9091
|
// Add code for jquery to use multiselect |
9092
|
9092
|
if (!empty($conf->use_javascript_ajax) && getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') || defined('REQUIRE_JQUERY_MULTISELECT')) { |
9093
|
|
- $out .= "\n" . '<!-- JS CODE TO ENABLE select for id ' . $htmlname . ', addjscombo=' . $addjscombo . ' -->'; |
9094
|
|
- $out .= "\n" . '<script nonce="' . getNonce() . '">' . "\n"; |
|
9093
|
+ $out .= "\n".'<!-- JS CODE TO ENABLE select for id '.$htmlname.', addjscombo='.$addjscombo.' -->'; |
|
9094
|
+ $out .= "\n".'<script nonce="'.getNonce().'">'."\n"; |
9095
|
9095
|
if ($addjscombo == 1) { |
9096
|
9096
|
$tmpplugin = !getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') ? constant('REQUIRE_JQUERY_MULTISELECT') : $conf->global->MAIN_USE_JQUERY_MULTISELECT; |
9097
|
|
- $out .= 'function formatResult(record, container) {' . "\n"; |
|
9097
|
+ $out .= 'function formatResult(record, container) {'."\n"; |
9098
|
9098
|
// If property data-html set, we decode html entities and use this. |
9099
|
9099
|
// Note that HTML content must have been sanitized from js with dol_escape_htmltag(xxx, 0, 0, '', 0, 1) when building the select option. |
9100
|
9100
|
$out .= ' if ($(record.element).attr("data-html") != undefined && typeof htmlEntityDecodeJs === "function") {'; |
|
@@ -9102,26 +9102,26 @@ discard block |
|
|
block discarded – undo |
9102
|
9102
|
$out .= ' return htmlEntityDecodeJs($(record.element).attr("data-html"));'; |
9103
|
9103
|
$out .= ' }'."\n"; |
9104
|
9104
|
$out .= ' return record.text;'; |
9105
|
|
- $out .= '}' . "\n"; |
9106
|
|
- $out .= 'function formatSelection(record) {' . "\n"; |
|
9105
|
+ $out .= '}'."\n"; |
|
9106
|
+ $out .= 'function formatSelection(record) {'."\n"; |
9107
|
9107
|
if ($elemtype == 'category') { |
9108
|
|
- $out .= 'return \'<span><img src="' . DOL_URL_ROOT . '/theme/eldy/img/object_category.png"> \'+record.text+\'</span>\';'; |
|
9108
|
+ $out .= 'return \'<span><img src="'.DOL_URL_ROOT.'/theme/eldy/img/object_category.png"> \'+record.text+\'</span>\';'; |
9109
|
9109
|
} else { |
9110
|
9110
|
$out .= 'return record.text;'; |
9111
|
9111
|
} |
9112
|
|
- $out .= '}' . "\n"; |
|
9112
|
+ $out .= '}'."\n"; |
9113
|
9113
|
$out .= '$(document).ready(function () { |
9114
|
|
- $(\'#' . $htmlname . '\').' . $tmpplugin . '({'; |
|
9114
|
+ $(\'#' . $htmlname.'\').'.$tmpplugin.'({'; |
9115
|
9115
|
if ($placeholder) { |
9116
|
9116
|
$out .= ' |
9117
|
9117
|
placeholder: { |
9118
|
9118
|
id: \'-1\', |
9119
|
|
- text: \'' . dol_escape_js($placeholder) . '\' |
|
9119
|
+ text: \'' . dol_escape_js($placeholder).'\' |
9120
|
9120
|
},'; |
9121
|
9121
|
} |
9122
|
9122
|
$out .= ' dir: \'ltr\', |
9123
|
9123
|
containerCssClass: \':all:\', /* Line to add class of origin SELECT propagated to the new <span class="select2-selection...> tag (ko with multiselect) */ |
9124
|
|
- dropdownCssClass: \'' . $morecss . '\', /* Line to add class on the new <span class="select2-selection...> tag (ok with multiselect). Need full version of select2. */ |
|
9124
|
+ dropdownCssClass: \'' . $morecss.'\', /* Line to add class on the new <span class="select2-selection...> tag (ok with multiselect). Need full version of select2. */ |
9125
|
9125
|
// Specify format function for dropdown item |
9126
|
9126
|
formatResult: formatResult, |
9127
|
9127
|
templateResult: formatResult, /* For 4.0 */ |
|
@@ -9133,21 +9133,21 @@ discard block |
|
|
block discarded – undo |
9133
|
9133
|
|
9134
|
9134
|
/* Add also morecss to the css .select2 that is after the #htmlname, for component that are show dynamically after load, because select2 set |
9135
|
9135
|
the size only if component is not hidden by default on load */ |
9136
|
|
- $(\'#' . $htmlname . ' + .select2\').addClass(\'' . $morecss . '\'); |
|
9136
|
+ $(\'#' . $htmlname.' + .select2\').addClass(\''.$morecss.'\'); |
9137
|
9137
|
});' . "\n"; |
9138
|
9138
|
} elseif ($addjscombo == 2 && !defined('DISABLE_MULTISELECT')) { |
9139
|
9139
|
// Add other js lib |
9140
|
9140
|
// TODO external lib multiselect/jquery.multi-select.js must have been loaded to use this multiselect plugin |
9141
|
9141
|
// ... |
9142
|
|
- $out .= 'console.log(\'addjscombo=2 for htmlname=' . $htmlname . '\');'; |
|
9142
|
+ $out .= 'console.log(\'addjscombo=2 for htmlname='.$htmlname.'\');'; |
9143
|
9143
|
$out .= '$(document).ready(function () { |
9144
|
|
- $(\'#' . $htmlname . '\').multiSelect({ |
|
9144
|
+ $(\'#' . $htmlname.'\').multiSelect({ |
9145
|
9145
|
containerHTML: \'<div class="multi-select-container">\', |
9146
|
9146
|
menuHTML: \'<div class="multi-select-menu">\', |
9147
|
|
- buttonHTML: \'<span class="multi-select-button ' . $morecss . '">\', |
|
9147
|
+ buttonHTML: \'<span class="multi-select-button ' . $morecss.'">\', |
9148
|
9148
|
menuItemHTML: \'<label class="multi-select-menuitem">\', |
9149
|
9149
|
activeClass: \'multi-select-container--open\', |
9150
|
|
- noneText: \'' . $placeholder . '\' |
|
9150
|
+ noneText: \'' . $placeholder.'\' |
9151
|
9151
|
}); |
9152
|
9152
|
})'; |
9153
|
9153
|
} |
|
@@ -9180,7 +9180,7 @@ discard block |
|
|
block discarded – undo |
9180
|
9180
|
return ''; |
9181
|
9181
|
} |
9182
|
9182
|
|
9183
|
|
- $tmpvar = "MAIN_SELECTEDFIELDS_" . $varpage; // To get list of saved selected fields to show |
|
9183
|
+ $tmpvar = "MAIN_SELECTEDFIELDS_".$varpage; // To get list of saved selected fields to show |
9184
|
9184
|
|
9185
|
9185
|
if (!empty($user->conf->$tmpvar)) { // A list of fields was already customized for user |
9186
|
9186
|
$tmparray = explode(',', $user->conf->$tmpvar); |
|
@@ -9223,19 +9223,19 @@ discard block |
|
|
block discarded – undo |
9223
|
9223
|
} |
9224
|
9224
|
|
9225
|
9225
|
// Note: $val['checked'] <> 0 means we must show the field into the combo list @phan-suppress-next-line PhanTypePossiblyInvalidDimOffset |
9226
|
|
- $listoffieldsforselection .= '<li><input type="checkbox" id="checkbox' . $key . '" value="' . $key . '"' . ((!array_key_exists('checked', $val) || empty($val['checked']) || $val['checked'] == '-1') ? '' : ' checked="checked"') . '/><label for="checkbox' . $key . '">' . dol_escape_htmltag($langs->trans($val['label'])) . '</label></li>'; |
9227
|
|
- $listcheckedstring .= (empty($val['checked']) ? '' : $key . ','); |
|
9226
|
+ $listoffieldsforselection .= '<li><input type="checkbox" id="checkbox'.$key.'" value="'.$key.'"'.((!array_key_exists('checked', $val) || empty($val['checked']) || $val['checked'] == '-1') ? '' : ' checked="checked"').'/><label for="checkbox'.$key.'">'.dol_escape_htmltag($langs->trans($val['label'])).'</label></li>'; |
|
9227
|
+ $listcheckedstring .= (empty($val['checked']) ? '' : $key.','); |
9228
|
9228
|
} |
9229
|
9229
|
} |
9230
|
9230
|
|
9231
|
|
- $out = '<!-- Component multiSelectArrayWithCheckbox ' . $htmlname . ' --> |
|
9231
|
+ $out = '<!-- Component multiSelectArrayWithCheckbox '.$htmlname.' --> |
9232
|
9232
|
|
9233
|
9233
|
<dl class="dropdown"> |
9234
|
9234
|
<dt> |
9235
|
|
- <a href="#' . $htmlname . '"> |
9236
|
|
- ' . img_picto('', 'list') . ' |
|
9235
|
+ <a href="#' . $htmlname.'"> |
|
9236
|
+ ' . img_picto('', 'list').' |
9237
|
9237
|
</a> |
9238
|
|
- <input type="hidden" class="' . $htmlname . '" name="' . $htmlname . '" value="' . $listcheckedstring . '"> |
|
9238
|
+ <input type="hidden" class="' . $htmlname.'" name="'.$htmlname.'" value="'.$listcheckedstring.'"> |
9239
|
9239
|
</dt> |
9240
|
9240
|
<dd class="dropdowndd"> |
9241
|
9241
|
<div class="multiselectcheckbox'.$htmlname.'"> |
|
@@ -9247,19 +9247,19 @@ discard block |
|
|
block discarded – undo |
9247
|
9247
|
</dd> |
9248
|
9248
|
</dl> |
9249
|
9249
|
|
9250
|
|
- <script nonce="' . getNonce() . '" type="text/javascript"> |
|
9250
|
+ <script nonce="' . getNonce().'" type="text/javascript"> |
9251
|
9251
|
jQuery(document).ready(function () { |
9252
|
|
- $(\'.multiselectcheckbox' . $htmlname . ' input[type="checkbox"]\').on(\'click\', function () { |
|
9252
|
+ $(\'.multiselectcheckbox' . $htmlname.' input[type="checkbox"]\').on(\'click\', function () { |
9253
|
9253
|
console.log("A new field was added/removed, we edit field input[name=formfilteraction]"); |
9254
|
9254
|
|
9255
|
9255
|
$("input:hidden[name=formfilteraction]").val(\'listafterchangingselectedfields\'); // Update field so we know we changed something on selected fields after POST |
9256
|
9256
|
|
9257
|
9257
|
var title = $(this).val() + ","; |
9258
|
9258
|
if ($(this).is(\':checked\')) { |
9259
|
|
- $(\'.' . $htmlname . '\').val(title + $(\'.' . $htmlname . '\').val()); |
|
9259
|
+ $(\'.' . $htmlname.'\').val(title + $(\'.'.$htmlname.'\').val()); |
9260
|
9260
|
} |
9261
|
9261
|
else { |
9262
|
|
- $(\'.' . $htmlname . '\').val( $(\'.' . $htmlname . '\').val().replace(title, \'\') ) |
|
9262
|
+ $(\'.' . $htmlname.'\').val( $(\'.'.$htmlname.'\').val().replace(title, \'\') ) |
9263
|
9263
|
} |
9264
|
9264
|
// Now, we submit page |
9265
|
9265
|
//$(this).parents(\'form:first\').submit(); |
|
@@ -9290,7 +9290,7 @@ discard block |
|
|
block discarded – undo |
9290
|
9290
|
*/ |
9291
|
9291
|
public function showCategories($id, $type, $rendermode = 0, $nolink = 0) |
9292
|
9292
|
{ |
9293
|
|
- include_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; |
|
9293
|
+ include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; |
9294
|
9294
|
|
9295
|
9295
|
$cat = new Categorie($this->db); |
9296
|
9296
|
$categories = $cat->containing($id, $type); |
|
@@ -9300,10 +9300,10 @@ discard block |
|
|
block discarded – undo |
9300
|
9300
|
foreach ($categories as $c) { |
9301
|
9301
|
$ways = $c->print_all_ways(' >> ', ($nolink ? 'none' : ''), 0, 1); // $ways[0] = "ccc2 >> ccc2a >> ccc2a1" with html formatted text |
9302
|
9302
|
foreach ($ways as $way) { |
9303
|
|
- $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"' . ($c->color ? ' style="background: #' . $c->color . ';"' : ' style="background: #bbb"') . '>' . $way . '</li>'; |
|
9303
|
+ $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"'.($c->color ? ' style="background: #'.$c->color.';"' : ' style="background: #bbb"').'>'.$way.'</li>'; |
9304
|
9304
|
} |
9305
|
9305
|
} |
9306
|
|
- return '<div class="select2-container-multi-dolibarr"><ul class="select2-choices-dolibarr">' . implode(' ', $toprint) . '</ul></div>'; |
|
9306
|
+ return '<div class="select2-container-multi-dolibarr"><ul class="select2-choices-dolibarr">'.implode(' ', $toprint).'</ul></div>'; |
9307
|
9307
|
} |
9308
|
9308
|
|
9309
|
9309
|
if ($rendermode == 0) { |
|
@@ -9351,15 +9351,15 @@ discard block |
|
|
block discarded – undo |
9351
|
9351
|
|
9352
|
9352
|
|
9353
|
9353
|
print '<div class="div-table-responsive-no-min">'; |
9354
|
|
- print '<table class="noborder allwidth" data-block="showLinkedObject" data-element="' . $object->element . '" data-elementid="' . $object->id . '" >'; |
|
9354
|
+ print '<table class="noborder allwidth" data-block="showLinkedObject" data-element="'.$object->element.'" data-elementid="'.$object->id.'" >'; |
9355
|
9355
|
|
9356
|
9356
|
print '<tr class="liste_titre">'; |
9357
|
|
- print '<td>' . $langs->trans("Type") . '</td>'; |
9358
|
|
- print '<td>' . $langs->trans("Ref") . '</td>'; |
|
9357
|
+ print '<td>'.$langs->trans("Type").'</td>'; |
|
9358
|
+ print '<td>'.$langs->trans("Ref").'</td>'; |
9359
|
9359
|
print '<td class="center"></td>'; |
9360
|
|
- print '<td class="center">' . $langs->trans("Date") . '</td>'; |
9361
|
|
- print '<td class="right">' . $langs->trans("AmountHTShort") . '</td>'; |
9362
|
|
- print '<td class="right">' . $langs->trans("Status") . '</td>'; |
|
9360
|
+ print '<td class="center">'.$langs->trans("Date").'</td>'; |
|
9361
|
+ print '<td class="right">'.$langs->trans("AmountHTShort").'</td>'; |
|
9362
|
+ print '<td class="right">'.$langs->trans("Status").'</td>'; |
9363
|
9363
|
print '<td></td>'; |
9364
|
9364
|
print '</tr>'; |
9365
|
9365
|
|
|
@@ -9378,13 +9378,13 @@ discard block |
|
|
block discarded – undo |
9378
|
9378
|
if ($objecttype != 'supplier_proposal' && preg_match('/^([^_]+)_([^_]+)/i', $objecttype, $regs)) { |
9379
|
9379
|
$element = $regs[1]; |
9380
|
9380
|
$subelement = $regs[2]; |
9381
|
|
- $tplpath = $element . '/' . $subelement; |
|
9381
|
+ $tplpath = $element.'/'.$subelement; |
9382
|
9382
|
} |
9383
|
9383
|
$tplname = 'linkedobjectblock'; |
9384
|
9384
|
|
9385
|
9385
|
// To work with non standard path |
9386
|
9386
|
if ($objecttype == 'facture') { |
9387
|
|
- $tplpath = 'compta/' . $element; |
|
9387
|
+ $tplpath = 'compta/'.$element; |
9388
|
9388
|
if (!isModEnabled('invoice')) { |
9389
|
9389
|
continue; // Do not show if module disabled |
9390
|
9390
|
} |
|
@@ -9395,7 +9395,7 @@ discard block |
|
|
block discarded – undo |
9395
|
9395
|
continue; // Do not show if module disabled |
9396
|
9396
|
} |
9397
|
9397
|
} elseif ($objecttype == 'propal') { |
9398
|
|
- $tplpath = 'comm/' . $element; |
|
9398
|
+ $tplpath = 'comm/'.$element; |
9399
|
9399
|
if (!isModEnabled('propal')) { |
9400
|
9400
|
continue; // Do not show if module disabled |
9401
|
9401
|
} |
|
@@ -9446,7 +9446,7 @@ discard block |
|
|
block discarded – undo |
9446
|
9446
|
$linkedObjectBlock = $objects; |
9447
|
9447
|
|
9448
|
9448
|
// Output template part (modules that overwrite templates must declare this into descriptor) |
9449
|
|
- $dirtpls = array_merge($conf->modules_parts['tpl'], array('/' . $tplpath . '/tpl')); |
|
9449
|
+ $dirtpls = array_merge($conf->modules_parts['tpl'], array('/'.$tplpath.'/tpl')); |
9450
|
9450
|
foreach ($dirtpls as $reldir) { |
9451
|
9451
|
$reldir = rtrim($reldir, '/'); |
9452
|
9452
|
if ($nboftypesoutput == ($nbofdifferenttypes - 1)) { // No more type to show after |
|
@@ -9454,7 +9454,7 @@ discard block |
|
|
block discarded – undo |
9454
|
9454
|
$noMoreLinkedObjectBlockAfter = 1; |
9455
|
9455
|
} |
9456
|
9456
|
|
9457
|
|
- $res = @include dol_buildpath($reldir . '/' . $tplname . '.tpl.php'); |
|
9457
|
+ $res = @include dol_buildpath($reldir.'/'.$tplname.'.tpl.php'); |
9458
|
9458
|
if ($res) { |
9459
|
9459
|
$nboftypesoutput++; |
9460
|
9460
|
break; |
|
@@ -9463,7 +9463,7 @@ discard block |
|
|
block discarded – undo |
9463
|
9463
|
} |
9464
|
9464
|
|
9465
|
9465
|
if (!$nboftypesoutput) { |
9466
|
|
- print '<tr><td class="impair" colspan="7"><span class="opacitymedium">' . $langs->trans("None") . '</span></td></tr>'; |
|
9466
|
+ print '<tr><td class="impair" colspan="7"><span class="opacitymedium">'.$langs->trans("None").'</span></td></tr>'; |
9467
|
9467
|
} |
9468
|
9468
|
|
9469
|
9469
|
print '</table>'; |
|
@@ -9503,14 +9503,14 @@ discard block |
|
|
block discarded – undo |
9503
|
9503
|
if (is_object($object->thirdparty) && !empty($object->thirdparty->id) && $object->thirdparty->id > 0) { |
9504
|
9504
|
$listofidcompanytoscan = $object->thirdparty->id; |
9505
|
9505
|
if (($object->thirdparty->parent > 0) && getDolGlobalString('THIRDPARTY_INCLUDE_PARENT_IN_LINKTO')) { |
9506
|
|
- $listofidcompanytoscan .= ',' . $object->thirdparty->parent; |
|
9506
|
+ $listofidcompanytoscan .= ','.$object->thirdparty->parent; |
9507
|
9507
|
} |
9508
|
9508
|
if (($object->fk_project > 0) && getDolGlobalString('THIRDPARTY_INCLUDE_PROJECT_THIRDPARY_IN_LINKTO')) { |
9509
|
|
- include_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; |
|
9509
|
+ include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; |
9510
|
9510
|
$tmpproject = new Project($this->db); |
9511
|
9511
|
$tmpproject->fetch($object->fk_project); |
9512
|
9512
|
if ($tmpproject->socid > 0 && ($tmpproject->socid != $object->thirdparty->id)) { |
9513
|
|
- $listofidcompanytoscan .= ',' . $tmpproject->socid; |
|
9513
|
+ $listofidcompanytoscan .= ','.$tmpproject->socid; |
9514
|
9514
|
} |
9515
|
9515
|
unset($tmpproject); |
9516
|
9516
|
} |
|
@@ -9520,63 +9520,63 @@ discard block |
|
|
block discarded – undo |
9520
|
9520
|
'enabled' => isModEnabled('propal'), |
9521
|
9521
|
'perms' => 1, |
9522
|
9522
|
'label' => 'LinkToProposal', |
9523
|
|
- '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') . ')'), |
|
9523
|
+ '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').')'), |
9524
|
9524
|
'shipping' => array( |
9525
|
9525
|
'enabled' => isModEnabled('shipping'), |
9526
|
9526
|
'perms' => 1, |
9527
|
9527
|
'label' => 'LinkToExpedition', |
9528
|
|
- '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') . ')'), |
|
9528
|
+ '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').')'), |
9529
|
9529
|
'order' => array( |
9530
|
9530
|
'enabled' => isModEnabled('order'), |
9531
|
9531
|
'perms' => 1, |
9532
|
9532
|
'label' => 'LinkToOrder', |
9533
|
|
- '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') . ')'), |
|
9533
|
+ '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').')'), |
9534
|
9534
|
'invoice' => array( |
9535
|
9535
|
'enabled' => isModEnabled('invoice'), |
9536
|
9536
|
'perms' => 1, |
9537
|
9537
|
'label' => 'LinkToInvoice', |
9538
|
|
- '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') . ')'), |
|
9538
|
+ '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').')'), |
9539
|
9539
|
'invoice_template' => array( |
9540
|
9540
|
'enabled' => isModEnabled('invoice'), |
9541
|
9541
|
'perms' => 1, |
9542
|
9542
|
'label' => 'LinkToTemplateInvoice', |
9543
|
|
- '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') . ')'), |
|
9543
|
+ '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').')'), |
9544
|
9544
|
'contrat' => array( |
9545
|
9545
|
'enabled' => isModEnabled('contract'), |
9546
|
9546
|
'perms' => 1, |
9547
|
9547
|
'label' => 'LinkToContract', |
9548
|
9548
|
'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 |
9549
|
|
- 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' |
|
9549
|
+ 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' |
9550
|
9550
|
), |
9551
|
9551
|
'fichinter' => array( |
9552
|
9552
|
'enabled' => isModEnabled('intervention'), |
9553
|
9553
|
'perms' => 1, |
9554
|
9554
|
'label' => 'LinkToIntervention', |
9555
|
|
- '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') . ')'), |
|
9555
|
+ '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').')'), |
9556
|
9556
|
'supplier_proposal' => array( |
9557
|
9557
|
'enabled' => isModEnabled('supplier_proposal'), |
9558
|
9558
|
'perms' => 1, |
9559
|
9559
|
'label' => 'LinkToSupplierProposal', |
9560
|
|
- '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') . ')'), |
|
9560
|
+ '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').')'), |
9561
|
9561
|
'order_supplier' => array( |
9562
|
9562
|
'enabled' => isModEnabled("supplier_order"), |
9563
|
9563
|
'perms' => 1, |
9564
|
9564
|
'label' => 'LinkToSupplierOrder', |
9565
|
|
- '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') . ')'), |
|
9565
|
+ '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').')'), |
9566
|
9566
|
'invoice_supplier' => array( |
9567
|
9567
|
'enabled' => isModEnabled("supplier_invoice"), |
9568
|
9568
|
'perms' => 1, 'label' => 'LinkToSupplierInvoice', |
9569
|
|
- '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') . ')'), |
|
9569
|
+ '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').')'), |
9570
|
9570
|
'ticket' => array( |
9571
|
9571
|
'enabled' => isModEnabled('ticket'), |
9572
|
9572
|
'perms' => 1, |
9573
|
9573
|
'label' => 'LinkToTicket', |
9574
|
|
- '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') . ')'), |
|
9574
|
+ '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').')'), |
9575
|
9575
|
'mo' => array( |
9576
|
9576
|
'enabled' => isModEnabled('mrp'), |
9577
|
9577
|
'perms' => 1, |
9578
|
9578
|
'label' => 'LinkToMo', |
9579
|
|
- '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') . ')') |
|
9579
|
+ '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').')') |
9580
|
9580
|
); |
9581
|
9581
|
} |
9582
|
9582
|
|
|
@@ -9612,22 +9612,22 @@ discard block |
|
|
block discarded – undo |
9612
|
9612
|
} |
9613
|
9613
|
|
9614
|
9614
|
if (!empty($possiblelink['perms']) && (empty($restrictlinksto) || in_array($key, $restrictlinksto)) && (empty($excludelinksto) || !in_array($key, $excludelinksto))) { |
9615
|
|
- print '<div id="' . $key . 'list"' . (empty($conf->use_javascript_ajax) ? '' : ' style="display:none"') . '>'; |
|
9615
|
+ print '<div id="'.$key.'list"'.(empty($conf->use_javascript_ajax) ? '' : ' style="display:none"').'>'; |
9616
|
9616
|
|
9617
|
9617
|
if (getDolGlobalString('MAIN_LINK_BY_REF_IN_LINKTO')) { |
9618
|
9618
|
print '<br>'."\n"; |
9619
|
9619
|
print '<!-- form to add a link from anywhere -->'."\n"; |
9620
|
|
- print '<form action="' . $_SERVER["PHP_SELF"] . '" method="POST" name="formlinkedbyref' . $key . '">'; |
9621
|
|
- print '<input type="hidden" name="id" value="' . $object->id . '">'; |
|
9620
|
+ print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" name="formlinkedbyref'.$key.'">'; |
|
9621
|
+ print '<input type="hidden" name="id" value="'.$object->id.'">'; |
9622
|
9622
|
print '<input type="hidden" name="action" value="addlinkbyref">'; |
9623
|
|
- print '<input type="hidden" name="token" value="' . newToken() . '">'; |
9624
|
|
- print '<input type="hidden" name="addlink" value="' . $key . '">'; |
|
9623
|
+ print '<input type="hidden" name="token" value="'.newToken().'">'; |
|
9624
|
+ print '<input type="hidden" name="addlink" value="'.$key.'">'; |
9625
|
9625
|
print '<table class="noborder">'; |
9626
|
9626
|
print '<tr>'; |
9627
|
9627
|
//print '<td>' . $langs->trans("Ref") . '</td>'; |
9628
|
|
- print '<td class="center"><input type="text" placeholder="'.dol_escape_htmltag($langs->trans("Ref")).'" name="reftolinkto" value="' . dol_escape_htmltag(GETPOST('reftolinkto', 'alpha')) . '"> '; |
9629
|
|
- print '<input type="submit" class="button small valignmiddle" value="' . $langs->trans('ToLink') . '"> '; |
9630
|
|
- print '<input type="submit" class="button small" name="cancel" value="' . $langs->trans('Cancel') . '"></td>'; |
|
9628
|
+ print '<td class="center"><input type="text" placeholder="'.dol_escape_htmltag($langs->trans("Ref")).'" name="reftolinkto" value="'.dol_escape_htmltag(GETPOST('reftolinkto', 'alpha')).'"> '; |
|
9629
|
+ print '<input type="submit" class="button small valignmiddle" value="'.$langs->trans('ToLink').'"> '; |
|
9630
|
+ print '<input type="submit" class="button small" name="cancel" value="'.$langs->trans('Cancel').'"></td>'; |
9631
|
9631
|
print '</tr>'; |
9632
|
9632
|
print '</table>'; |
9633
|
9633
|
print '</form>'; |
|
@@ -9642,48 +9642,48 @@ discard block |
|
|
block discarded – undo |
9642
|
9642
|
|
9643
|
9643
|
print '<br>'; |
9644
|
9644
|
print '<!-- form to add a link from object to same thirdparty -->'."\n"; |
9645
|
|
- print '<form action="' . $_SERVER["PHP_SELF"] . '" method="POST" name="formlinked' . $key . '">'; |
|
9645
|
+ print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" name="formlinked'.$key.'">'; |
9646
|
9646
|
print '<input type="hidden" name="action" value="addlink">'; |
9647
|
|
- print '<input type="hidden" name="token" value="' . newToken() . '">'; |
9648
|
|
- print '<input type="hidden" name="id" value="' . $object->id . '">'; |
9649
|
|
- print '<input type="hidden" name="addlink" value="' . $key . '">'; |
|
9647
|
+ print '<input type="hidden" name="token" value="'.newToken().'">'; |
|
9648
|
+ print '<input type="hidden" name="id" value="'.$object->id.'">'; |
|
9649
|
+ print '<input type="hidden" name="addlink" value="'.$key.'">'; |
9650
|
9650
|
print '<table class="noborder">'; |
9651
|
9651
|
print '<tr class="liste_titre">'; |
9652
|
9652
|
print '<td class="nowrap"></td>'; |
9653
|
|
- print '<td class="center">' . $langs->trans("Ref") . '</td>'; |
9654
|
|
- print '<td class="left">' . $langs->trans("RefCustomer") . '</td>'; |
9655
|
|
- print '<td class="right">' . $langs->trans("AmountHTShort") . '</td>'; |
9656
|
|
- print '<td class="left">' . $langs->trans("Company") . '</td>'; |
|
9653
|
+ print '<td class="center">'.$langs->trans("Ref").'</td>'; |
|
9654
|
+ print '<td class="left">'.$langs->trans("RefCustomer").'</td>'; |
|
9655
|
+ print '<td class="right">'.$langs->trans("AmountHTShort").'</td>'; |
|
9656
|
+ print '<td class="left">'.$langs->trans("Company").'</td>'; |
9657
|
9657
|
print '</tr>'; |
9658
|
9658
|
while ($i < $num) { |
9659
|
9659
|
$objp = $this->db->fetch_object($resqllist); |
9660
|
9660
|
|
9661
|
9661
|
print '<tr class="oddeven">'; |
9662
|
9662
|
print '<td class="left">'; |
9663
|
|
- print '<input type="radio" name="idtolinkto" id="' . $key . '_' . $objp->rowid . '" value="' . $objp->rowid . '">'; |
|
9663
|
+ print '<input type="radio" name="idtolinkto" id="'.$key.'_'.$objp->rowid.'" value="'.$objp->rowid.'">'; |
9664
|
9664
|
print '</td>'; |
9665
|
|
- print '<td class="center"><label for="' . $key . '_' . $objp->rowid . '">' . $objp->ref . '</label></td>'; |
9666
|
|
- print '<td>' . (!empty($objp->ref_client) ? $objp->ref_client : (!empty($objp->ref_supplier) ? $objp->ref_supplier : '')) . '</td>'; |
|
9665
|
+ print '<td class="center"><label for="'.$key.'_'.$objp->rowid.'">'.$objp->ref.'</label></td>'; |
|
9666
|
+ print '<td>'.(!empty($objp->ref_client) ? $objp->ref_client : (!empty($objp->ref_supplier) ? $objp->ref_supplier : '')).'</td>'; |
9667
|
9667
|
print '<td class="right">'; |
9668
|
9668
|
if ($possiblelink['label'] == 'LinkToContract') { |
9669
|
9669
|
$form = new Form($this->db); |
9670
|
|
- print $form->textwithpicto('', $langs->trans("InformationOnLinkToContract")) . ' '; |
|
9670
|
+ print $form->textwithpicto('', $langs->trans("InformationOnLinkToContract")).' '; |
9671
|
9671
|
} |
9672
|
|
- print '<span class="amount">' . (isset($objp->total_ht) ? price($objp->total_ht) : '') . '</span>'; |
|
9672
|
+ print '<span class="amount">'.(isset($objp->total_ht) ? price($objp->total_ht) : '').'</span>'; |
9673
|
9673
|
print '</td>'; |
9674
|
|
- print '<td>' . $objp->name . '</td>'; |
|
9674
|
+ print '<td>'.$objp->name.'</td>'; |
9675
|
9675
|
print '</tr>'; |
9676
|
9676
|
$i++; |
9677
|
9677
|
} |
9678
|
9678
|
print '</table>'; |
9679
|
9679
|
print '<div class="center">'; |
9680
|
9680
|
if ($num) { |
9681
|
|
- print '<input type="submit" class="button valignmiddle marginleftonly marginrightonly small" value="' . $langs->trans('ToLink') . '">'; |
|
9681
|
+ print '<input type="submit" class="button valignmiddle marginleftonly marginrightonly small" value="'.$langs->trans('ToLink').'">'; |
9682
|
9682
|
} |
9683
|
9683
|
if (empty($conf->use_javascript_ajax)) { |
9684
|
|
- print '<input type="submit" class="button button-cancel marginleftonly marginrightonly small" name="cancel" value="' . $langs->trans("Cancel") . '"></div>'; |
|
9684
|
+ print '<input type="submit" class="button button-cancel marginleftonly marginrightonly small" name="cancel" value="'.$langs->trans("Cancel").'"></div>'; |
9685
|
9685
|
} else { |
9686
|
|
- 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>'; |
|
9686
|
+ 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>'; |
9687
|
9687
|
} |
9688
|
9688
|
print '</form>'; |
9689
|
9689
|
$this->db->free($resqllist); |
|
@@ -9694,10 +9694,10 @@ discard block |
|
|
block discarded – undo |
9694
|
9694
|
|
9695
|
9695
|
//$linktoelem.=($linktoelem?' ':''); |
9696
|
9696
|
if ($num > 0 || getDolGlobalString('MAIN_LINK_BY_REF_IN_LINKTO')) { |
9697
|
|
- $linktoelemlist .= '<li><a href="#linkto' . $key . '" class="linkto dropdowncloseonclick" rel="' . $key . '">' . $langs->trans($possiblelink['label']) . ' (' . $num . ')</a></li>'; |
|
9697
|
+ $linktoelemlist .= '<li><a href="#linkto'.$key.'" class="linkto dropdowncloseonclick" rel="'.$key.'">'.$langs->trans($possiblelink['label']).' ('.$num.')</a></li>'; |
9698
|
9698
|
// } else $linktoelem.=$langs->trans($possiblelink['label']); |
9699
|
9699
|
} else { |
9700
|
|
- $linktoelemlist .= '<li><span class="linktodisabled">' . $langs->trans($possiblelink['label']) . ' (0)</span></li>'; |
|
9700
|
+ $linktoelemlist .= '<li><span class="linktodisabled">'.$langs->trans($possiblelink['label']).' (0)</span></li>'; |
9701
|
9701
|
} |
9702
|
9702
|
} |
9703
|
9703
|
} |
|
@@ -9707,11 +9707,11 @@ discard block |
|
|
block discarded – undo |
9707
|
9707
|
<dl class="dropdown" id="linktoobjectname"> |
9708
|
9708
|
'; |
9709
|
9709
|
if (!empty($conf->use_javascript_ajax)) { |
9710
|
|
- $linktoelem .= '<dt><a href="#linktoobjectname"><span class="fas fa-link paddingrightonly"></span>' . $langs->trans("LinkTo") . '...</a></dt>'; |
|
9710
|
+ $linktoelem .= '<dt><a href="#linktoobjectname"><span class="fas fa-link paddingrightonly"></span>'.$langs->trans("LinkTo").'...</a></dt>'; |
9711
|
9711
|
} |
9712
|
9712
|
$linktoelem .= '<dd> |
9713
|
9713
|
<div class="multiselectlinkto"> |
9714
|
|
- <ul class="ulselectedfields">' . $linktoelemlist . ' |
|
9714
|
+ <ul class="ulselectedfields">' . $linktoelemlist.' |
9715
|
9715
|
</ul> |
9716
|
9716
|
</div> |
9717
|
9717
|
</dd> |
|
@@ -9722,7 +9722,7 @@ discard block |
|
|
block discarded – undo |
9722
|
9722
|
|
9723
|
9723
|
if (!empty($conf->use_javascript_ajax)) { |
9724
|
9724
|
print '<!-- Add js to show linkto box --> |
9725
|
|
- <script nonce="' . getNonce() . '"> |
|
9725
|
+ <script nonce="' . getNonce().'"> |
9726
|
9726
|
jQuery(document).ready(function() { |
9727
|
9727
|
jQuery(".linkto").click(function() { |
9728
|
9728
|
console.log("We choose to show/hide links for rel="+jQuery(this).attr(\'rel\')+" so #"+jQuery(this).attr(\'rel\')+"list"); |
|
@@ -9763,19 +9763,19 @@ discard block |
|
|
block discarded – undo |
9763
|
9763
|
|
9764
|
9764
|
$disabled = ($disabled ? ' disabled' : ''); |
9765
|
9765
|
|
9766
|
|
- $resultyesno = '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" id="' . $htmlname . '" name="' . $htmlname . '"' . $disabled . '>' . "\n"; |
|
9766
|
+ $resultyesno = '<select class="flat'.($morecss ? ' '.$morecss : '').'" id="'.$htmlname.'" name="'.$htmlname.'"'.$disabled.'>'."\n"; |
9767
|
9767
|
if ($useempty) { |
9768
|
|
- $resultyesno .= '<option value="-1"' . (($value < 0) ? ' selected' : '') . '> </option>' . "\n"; |
|
9768
|
+ $resultyesno .= '<option value="-1"'.(($value < 0) ? ' selected' : '').'> </option>'."\n"; |
9769
|
9769
|
} |
9770
|
9770
|
if (("$value" == 'yes') || ($value == 1)) { |
9771
|
|
- $resultyesno .= '<option value="' . $yes . '" selected>' . $langs->trans($labelyes) . '</option>' . "\n"; |
9772
|
|
- $resultyesno .= '<option value="' . $no . '">' . $langs->trans($labelno) . '</option>' . "\n"; |
|
9771
|
+ $resultyesno .= '<option value="'.$yes.'" selected>'.$langs->trans($labelyes).'</option>'."\n"; |
|
9772
|
+ $resultyesno .= '<option value="'.$no.'">'.$langs->trans($labelno).'</option>'."\n"; |
9773
|
9773
|
} else { |
9774
|
9774
|
$selected = (($useempty && $value != '0' && $value != 'no') ? '' : ' selected'); |
9775
|
|
- $resultyesno .= '<option value="' . $yes . '">' . $langs->trans($labelyes) . '</option>' . "\n"; |
9776
|
|
- $resultyesno .= '<option value="' . $no . '"' . $selected . '>' . $langs->trans($labelno) . '</option>' . "\n"; |
|
9775
|
+ $resultyesno .= '<option value="'.$yes.'">'.$langs->trans($labelyes).'</option>'."\n"; |
|
9776
|
+ $resultyesno .= '<option value="'.$no.'"'.$selected.'>'.$langs->trans($labelno).'</option>'."\n"; |
9777
|
9777
|
} |
9778
|
|
- $resultyesno .= '</select>' . "\n"; |
|
9778
|
+ $resultyesno .= '</select>'."\n"; |
9779
|
9779
|
|
9780
|
9780
|
if ($addjscombo) { |
9781
|
9781
|
$resultyesno .= ajax_combobox($htmlname, array(), 0, 0, 'resolve', ($useempty < 0 ? (string) $useempty : '-1'), $morecss); |
|
@@ -9799,12 +9799,12 @@ discard block |
|
|
block discarded – undo |
9799
|
9799
|
{ |
9800
|
9800
|
// phpcs:enable |
9801
|
9801
|
$sql = "SELECT rowid, label"; |
9802
|
|
- $sql .= " FROM " . $this->db->prefix() . "export_model"; |
9803
|
|
- $sql .= " WHERE type = '" . $this->db->escape($type) . "'"; |
|
9802
|
+ $sql .= " FROM ".$this->db->prefix()."export_model"; |
|
9803
|
+ $sql .= " WHERE type = '".$this->db->escape($type)."'"; |
9804
|
9804
|
$sql .= " ORDER BY rowid"; |
9805
|
9805
|
$result = $this->db->query($sql); |
9806
|
9806
|
if ($result) { |
9807
|
|
- print '<select class="flat" id="select_' . $htmlname . '" name="' . $htmlname . '">'; |
|
9807
|
+ print '<select class="flat" id="select_'.$htmlname.'" name="'.$htmlname.'">'; |
9808
|
9808
|
if ($useempty) { |
9809
|
9809
|
print '<option value="-1"> </option>'; |
9810
|
9810
|
} |
|
@@ -9814,9 +9814,9 @@ discard block |
|
|
block discarded – undo |
9814
|
9814
|
while ($i < $num) { |
9815
|
9815
|
$obj = $this->db->fetch_object($result); |
9816
|
9816
|
if ($selected == $obj->rowid) { |
9817
|
|
- print '<option value="' . $obj->rowid . '" selected>'; |
|
9817
|
+ print '<option value="'.$obj->rowid.'" selected>'; |
9818
|
9818
|
} else { |
9819
|
|
- print '<option value="' . $obj->rowid . '">'; |
|
9819
|
+ print '<option value="'.$obj->rowid.'">'; |
9820
|
9820
|
} |
9821
|
9821
|
print $obj->label; |
9822
|
9822
|
print '</option>'; |
|
@@ -9907,8 +9907,8 @@ discard block |
|
|
block discarded – undo |
9907
|
9907
|
$stringforfirstkey .= ' CTL +'; |
9908
|
9908
|
} |
9909
|
9909
|
|
9910
|
|
- $previous_ref = $object->ref_previous ? '<a accesskey="p" alt="'.dol_escape_htmltag($langs->trans("Previous")).'" 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>'; |
9911
|
|
- $next_ref = $object->ref_next ? '<a accesskey="n" alt="'.dol_escape_htmltag($langs->trans("Next")).'" 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>'; |
|
9910
|
+ $previous_ref = $object->ref_previous ? '<a accesskey="p" alt="'.dol_escape_htmltag($langs->trans("Previous")).'" 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>'; |
|
9911
|
+ $next_ref = $object->ref_next ? '<a accesskey="n" alt="'.dol_escape_htmltag($langs->trans("Next")).'" 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>'; |
9912
|
9912
|
} |
9913
|
9913
|
|
9914
|
9914
|
//print "xx".$previous_ref."x".$next_ref; |
|
@@ -9916,18 +9916,18 @@ discard block |
|
|
block discarded – undo |
9916
|
9916
|
|
9917
|
9917
|
// Right part of banner |
9918
|
9918
|
if ($morehtmlright) { |
9919
|
|
- $ret .= '<div class="inline-block floatleft">' . $morehtmlright . '</div>'; |
|
9919
|
+ $ret .= '<div class="inline-block floatleft">'.$morehtmlright.'</div>'; |
9920
|
9920
|
} |
9921
|
9921
|
|
9922
|
9922
|
if ($previous_ref || $next_ref || $morehtml) { |
9923
|
9923
|
$ret .= '<div class="pagination paginationref"><ul class="right">'; |
9924
|
9924
|
} |
9925
|
9925
|
if ($morehtml && getDolGlobalInt('MAIN_OPTIMIZEFORTEXTBROWSER') < 2) { |
9926
|
|
- $ret .= '<!-- morehtml --><li class="noborder litext' . (($shownav && $previous_ref && $next_ref) ? ' clearbothonsmartphone' : '') . '">' . $morehtml . '</li>'; |
|
9926
|
+ $ret .= '<!-- morehtml --><li class="noborder litext'.(($shownav && $previous_ref && $next_ref) ? ' clearbothonsmartphone' : '').'">'.$morehtml.'</li>'; |
9927
|
9927
|
} |
9928
|
9928
|
if ($shownav && ($previous_ref || $next_ref)) { |
9929
|
|
- $ret .= '<li class="pagination">' . $previous_ref . '</li>'; |
9930
|
|
- $ret .= '<li class="pagination">' . $next_ref . '</li>'; |
|
9929
|
+ $ret .= '<li class="pagination">'.$previous_ref.'</li>'; |
|
9930
|
+ $ret .= '<li class="pagination">'.$next_ref.'</li>'; |
9931
|
9931
|
} |
9932
|
9932
|
if ($previous_ref || $next_ref || $morehtml) { |
9933
|
9933
|
$ret .= '</ul></div>'; |
|
@@ -9942,7 +9942,7 @@ discard block |
|
|
block discarded – undo |
9942
|
9942
|
$morehtmlstatus = $hookmanager->resPrint; |
9943
|
9943
|
} |
9944
|
9944
|
if ($morehtmlstatus) { |
9945
|
|
- $ret .= '<div class="statusref">' . $morehtmlstatus . '</div>'; |
|
9945
|
+ $ret .= '<div class="statusref">'.$morehtmlstatus.'</div>'; |
9946
|
9946
|
} |
9947
|
9947
|
|
9948
|
9948
|
$parameters = array(); |
|
@@ -9956,14 +9956,14 @@ discard block |
|
|
block discarded – undo |
9956
|
9956
|
// Left part of banner |
9957
|
9957
|
if ($morehtmlleft) { |
9958
|
9958
|
if ($conf->browser->layout == 'phone') { |
9959
|
|
- $ret .= '<!-- morehtmlleft --><div class="floatleft">' . $morehtmlleft . '</div>'; |
|
9959
|
+ $ret .= '<!-- morehtmlleft --><div class="floatleft">'.$morehtmlleft.'</div>'; |
9960
|
9960
|
} else { |
9961
|
|
- $ret .= '<!-- morehtmlleft --><div class="inline-block floatleft">' . $morehtmlleft . '</div>'; |
|
9961
|
+ $ret .= '<!-- morehtmlleft --><div class="inline-block floatleft">'.$morehtmlleft.'</div>'; |
9962
|
9962
|
} |
9963
|
9963
|
} |
9964
|
9964
|
|
9965
|
9965
|
//if ($conf->browser->layout == 'phone') $ret.='<div class="clearboth"></div>'; |
9966
|
|
- $ret .= '<div class="inline-block floatleft valignmiddle maxwidth750 marginbottomonly refid' . (($shownav && ($previous_ref || $next_ref)) ? ' refidpadding' : '') . '">'; |
|
9966
|
+ $ret .= '<div class="inline-block floatleft valignmiddle maxwidth750 marginbottomonly refid'.(($shownav && ($previous_ref || $next_ref)) ? ' refidpadding' : '').'">'; |
9967
|
9967
|
|
9968
|
9968
|
// For thirdparty, contact, user, member, the ref is the id, so we show something else |
9969
|
9969
|
if ($object->element == 'societe') { |
|
@@ -9977,7 +9977,7 @@ discard block |
|
|
block discarded – undo |
9977
|
9977
|
|
9978
|
9978
|
if (is_array($arrayoflangcode) && count($arrayoflangcode)) { |
9979
|
9979
|
if (!is_object($extralanguages)) { |
9980
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/class/extralanguages.class.php'; |
|
9980
|
+ include_once DOL_DOCUMENT_ROOT.'/core/class/extralanguages.class.php'; |
9981
|
9981
|
$extralanguages = new ExtraLanguages($this->db); |
9982
|
9982
|
} |
9983
|
9983
|
$extralanguages->fetch_name_extralanguages('societe'); |
|
@@ -9992,29 +9992,29 @@ discard block |
|
|
block discarded – undo |
9992
|
9992
|
if ($object->array_languages['name'][$extralangcode]) { |
9993
|
9993
|
$htmltext .= $object->array_languages['name'][$extralangcode]; |
9994
|
9994
|
} else { |
9995
|
|
- $htmltext .= '<span class="opacitymedium">' . $langs->trans("SwitchInEditModeToAddTranslation") . '</span>'; |
|
9995
|
+ $htmltext .= '<span class="opacitymedium">'.$langs->trans("SwitchInEditModeToAddTranslation").'</span>'; |
9996
|
9996
|
} |
9997
|
9997
|
} |
9998
|
|
- $ret .= '<!-- Show translations of name -->' . "\n"; |
|
9998
|
+ $ret .= '<!-- Show translations of name -->'."\n"; |
9999
|
9999
|
$ret .= $this->textwithpicto('', $htmltext, -1, 'language', 'opacitymedium paddingleft'); |
10000
|
10000
|
} |
10001
|
10001
|
} |
10002
|
10002
|
} elseif ($object->element == 'member') { |
10003
|
10003
|
'@phan-var-force Adherent $object'; |
10004
|
|
- $ret .= $object->ref . '<br>'; |
|
10004
|
+ $ret .= $object->ref.'<br>'; |
10005
|
10005
|
$fullname = $object->getFullName($langs); |
10006
|
10006
|
if ($object->morphy == 'mor' && $object->societe) { |
10007
|
|
- $ret .= dol_htmlentities($object->societe) . ((!empty($fullname) && $object->societe != $fullname) ? ' (' . dol_htmlentities($fullname) . $addgendertxt . ')' : ''); |
|
10007
|
+ $ret .= dol_htmlentities($object->societe).((!empty($fullname) && $object->societe != $fullname) ? ' ('.dol_htmlentities($fullname).$addgendertxt.')' : ''); |
10008
|
10008
|
} else { |
10009
|
|
- $ret .= dol_htmlentities($fullname) . $addgendertxt . ((!empty($object->societe) && $object->societe != $fullname) ? ' (' . dol_htmlentities($object->societe) . ')' : ''); |
|
10009
|
+ $ret .= dol_htmlentities($fullname).$addgendertxt.((!empty($object->societe) && $object->societe != $fullname) ? ' ('.dol_htmlentities($object->societe).')' : ''); |
10010
|
10010
|
} |
10011
|
10011
|
} elseif (in_array($object->element, array('contact', 'user'))) { |
10012
|
|
- $ret .= dol_htmlentities($object->getFullName($langs)) . $addgendertxt; |
|
10012
|
+ $ret .= dol_htmlentities($object->getFullName($langs)).$addgendertxt; |
10013
|
10013
|
} elseif ($object->element == 'usergroup') { |
10014
|
10014
|
$ret .= dol_htmlentities($object->name); |
10015
|
10015
|
} elseif (in_array($object->element, array('action', 'agenda'))) { |
10016
|
10016
|
'@phan-var-force ActionComm $object'; |
10017
|
|
- $ret .= $object->ref . '<br>' . $object->label; |
|
10017
|
+ $ret .= $object->ref.'<br>'.$object->label; |
10018
|
10018
|
} elseif (in_array($object->element, array('adherent_type'))) { |
10019
|
10019
|
$ret .= $object->label; |
10020
|
10020
|
} elseif ($object->element == 'ecm_directories') { |
|
@@ -10067,9 +10067,9 @@ discard block |
|
|
block discarded – undo |
10067
|
10067
|
} |
10068
|
10068
|
|
10069
|
10069
|
// Barcode image @phan-suppress-next-line PhanUndeclaredProperty |
10070
|
|
- $url = DOL_URL_ROOT . '/viewimage.php?modulepart=barcode&generator=' . urlencode($object->barcode_type_coder) . '&code=' . urlencode($object->barcode) . '&encoding=' . urlencode($object->barcode_type_code); |
10071
|
|
- $out = '<!-- url barcode = ' . $url . ' -->'; |
10072
|
|
- $out .= '<img src="' . $url . '"' . ($morecss ? ' class="' . $morecss . '"' : '') . '>'; |
|
10070
|
+ $url = DOL_URL_ROOT.'/viewimage.php?modulepart=barcode&generator='.urlencode($object->barcode_type_coder).'&code='.urlencode($object->barcode).'&encoding='.urlencode($object->barcode_type_code); |
|
10071
|
+ $out = '<!-- url barcode = '.$url.' -->'; |
|
10072
|
+ $out .= '<img src="'.$url.'"'.($morecss ? ' class="'.$morecss.'"' : '').'>'; |
10073
|
10073
|
|
10074
|
10074
|
return $out; |
10075
|
10075
|
} |
|
@@ -10096,7 +10096,7 @@ discard block |
|
|
block discarded – undo |
10096
|
10096
|
global $conf, $langs; |
10097
|
10097
|
|
10098
|
10098
|
$entity = (empty($object->entity) ? $conf->entity : $object->entity); |
10099
|
|
- $id = (empty($object->id) ? $object->rowid : $object->id); // @phan-suppress-current-line PhanUndeclaredProperty (->rowid) |
|
10099
|
+ $id = (empty($object->id) ? $object->rowid : $object->id); // @phan-suppress-current-line PhanUndeclaredProperty (->rowid) |
10100
|
10100
|
|
10101
|
10101
|
$dir = ''; |
10102
|
10102
|
$file = ''; |
|
@@ -10109,28 +10109,28 @@ discard block |
|
|
block discarded – undo |
10109
|
10109
|
if (!empty($object->logo)) { |
10110
|
10110
|
if (dolIsAllowedForPreview($object->logo)) { |
10111
|
10111
|
if ((string) $imagesize == 'mini') { |
10112
|
|
- $file = get_exdir(0, 0, 0, 0, $object, 'thirdparty') . 'logos/' . getImageFileNameForSize($object->logo, '_mini'); // getImageFileNameForSize include the thumbs |
|
10112
|
+ $file = get_exdir(0, 0, 0, 0, $object, 'thirdparty').'logos/'.getImageFileNameForSize($object->logo, '_mini'); // getImageFileNameForSize include the thumbs |
10113
|
10113
|
} elseif ((string) $imagesize == 'small') { |
10114
|
|
- $file = get_exdir(0, 0, 0, 0, $object, 'thirdparty') . 'logos/' . getImageFileNameForSize($object->logo, '_small'); |
|
10114
|
+ $file = get_exdir(0, 0, 0, 0, $object, 'thirdparty').'logos/'.getImageFileNameForSize($object->logo, '_small'); |
10115
|
10115
|
} else { |
10116
|
|
- $file = get_exdir(0, 0, 0, 0, $object, 'thirdparty') . 'logos/' . $object->logo; |
|
10116
|
+ $file = get_exdir(0, 0, 0, 0, $object, 'thirdparty').'logos/'.$object->logo; |
10117
|
10117
|
} |
10118
|
|
- $originalfile = get_exdir(0, 0, 0, 0, $object, 'thirdparty') . 'logos/' . $object->logo; |
|
10118
|
+ $originalfile = get_exdir(0, 0, 0, 0, $object, 'thirdparty').'logos/'.$object->logo; |
10119
|
10119
|
} |
10120
|
10120
|
} |
10121
|
10121
|
$email = $object->email; |
10122
|
10122
|
} elseif ($modulepart == 'contact') { |
10123
|
|
- $dir = $conf->societe->multidir_output[$entity] . '/contact'; |
|
10123
|
+ $dir = $conf->societe->multidir_output[$entity].'/contact'; |
10124
|
10124
|
if (!empty($object->photo)) { |
10125
|
10125
|
if (dolIsAllowedForPreview($object->photo)) { |
10126
|
10126
|
if ((string) $imagesize == 'mini') { |
10127
|
|
- $file = get_exdir(0, 0, 0, 0, $object, 'contact') . 'photos/' . getImageFileNameForSize($object->photo, '_mini'); |
|
10127
|
+ $file = get_exdir(0, 0, 0, 0, $object, 'contact').'photos/'.getImageFileNameForSize($object->photo, '_mini'); |
10128
|
10128
|
} elseif ((string) $imagesize == 'small') { |
10129
|
|
- $file = get_exdir(0, 0, 0, 0, $object, 'contact') . 'photos/' . getImageFileNameForSize($object->photo, '_small'); |
|
10129
|
+ $file = get_exdir(0, 0, 0, 0, $object, 'contact').'photos/'.getImageFileNameForSize($object->photo, '_small'); |
10130
|
10130
|
} else { |
10131
|
|
- $file = get_exdir(0, 0, 0, 0, $object, 'contact') . 'photos/' . $object->photo; |
|
10131
|
+ $file = get_exdir(0, 0, 0, 0, $object, 'contact').'photos/'.$object->photo; |
10132
|
10132
|
} |
10133
|
|
- $originalfile = get_exdir(0, 0, 0, 0, $object, 'contact') . 'photos/' . $object->photo; |
|
10133
|
+ $originalfile = get_exdir(0, 0, 0, 0, $object, 'contact').'photos/'.$object->photo; |
10134
|
10134
|
} |
10135
|
10135
|
} |
10136
|
10136
|
$email = $object->email; |
|
@@ -10140,17 +10140,17 @@ discard block |
|
|
block discarded – undo |
10140
|
10140
|
if (!empty($object->photo)) { |
10141
|
10141
|
if (dolIsAllowedForPreview($object->photo)) { |
10142
|
10142
|
if ((string) $imagesize == 'mini') { |
10143
|
|
- $file = get_exdir(0, 0, 0, 0, $object, 'user') . 'photos/' . getImageFileNameForSize($object->photo, '_mini'); |
|
10143
|
+ $file = get_exdir(0, 0, 0, 0, $object, 'user').'photos/'.getImageFileNameForSize($object->photo, '_mini'); |
10144
|
10144
|
} elseif ((string) $imagesize == 'small') { |
10145
|
|
- $file = get_exdir(0, 0, 0, 0, $object, 'user') . 'photos/' . getImageFileNameForSize($object->photo, '_small'); |
|
10145
|
+ $file = get_exdir(0, 0, 0, 0, $object, 'user').'photos/'.getImageFileNameForSize($object->photo, '_small'); |
10146
|
10146
|
} else { |
10147
|
|
- $file = get_exdir(0, 0, 0, 0, $object, 'user') . 'photos/' . $object->photo; |
|
10147
|
+ $file = get_exdir(0, 0, 0, 0, $object, 'user').'photos/'.$object->photo; |
10148
|
10148
|
} |
10149
|
|
- $originalfile = get_exdir(0, 0, 0, 0, $object, 'user') . 'photos/' . $object->photo; |
|
10149
|
+ $originalfile = get_exdir(0, 0, 0, 0, $object, 'user').'photos/'.$object->photo; |
10150
|
10150
|
} |
10151
|
10151
|
} |
10152
|
10152
|
if (getDolGlobalString('MAIN_OLD_IMAGE_LINKS')) { |
10153
|
|
- $altfile = $object->id . ".jpg"; // For backward compatibility |
|
10153
|
+ $altfile = $object->id.".jpg"; // For backward compatibility |
10154
|
10154
|
} |
10155
|
10155
|
$email = $object->email; |
10156
|
10156
|
$capture = 'user'; |
|
@@ -10159,17 +10159,17 @@ discard block |
|
|
block discarded – undo |
10159
|
10159
|
if (!empty($object->photo)) { |
10160
|
10160
|
if (dolIsAllowedForPreview($object->photo)) { |
10161
|
10161
|
if ((string) $imagesize == 'mini') { |
10162
|
|
- $file = get_exdir(0, 0, 0, 0, $object, 'member') . 'photos/' . getImageFileNameForSize($object->photo, '_mini'); |
|
10162
|
+ $file = get_exdir(0, 0, 0, 0, $object, 'member').'photos/'.getImageFileNameForSize($object->photo, '_mini'); |
10163
|
10163
|
} elseif ((string) $imagesize == 'small') { |
10164
|
|
- $file = get_exdir(0, 0, 0, 0, $object, 'member') . 'photos/' . getImageFileNameForSize($object->photo, '_small'); |
|
10164
|
+ $file = get_exdir(0, 0, 0, 0, $object, 'member').'photos/'.getImageFileNameForSize($object->photo, '_small'); |
10165
|
10165
|
} else { |
10166
|
|
- $file = get_exdir(0, 0, 0, 0, $object, 'member') . 'photos/' . $object->photo; |
|
10166
|
+ $file = get_exdir(0, 0, 0, 0, $object, 'member').'photos/'.$object->photo; |
10167
|
10167
|
} |
10168
|
|
- $originalfile = get_exdir(0, 0, 0, 0, $object, 'member') . 'photos/' . $object->photo; |
|
10168
|
+ $originalfile = get_exdir(0, 0, 0, 0, $object, 'member').'photos/'.$object->photo; |
10169
|
10169
|
} |
10170
|
10170
|
} |
10171
|
10171
|
if (getDolGlobalString('MAIN_OLD_IMAGE_LINKS')) { |
10172
|
|
- $altfile = $object->id . ".jpg"; // For backward compatibility |
|
10172
|
+ $altfile = $object->id.".jpg"; // For backward compatibility |
10173
|
10173
|
} |
10174
|
10174
|
$email = $object->email; |
10175
|
10175
|
$capture = 'user'; |
|
@@ -10195,35 +10195,35 @@ discard block |
|
|
block discarded – undo |
10195
|
10195
|
$ret = ''; |
10196
|
10196
|
|
10197
|
10197
|
if ($dir) { |
10198
|
|
- if ($file && file_exists($dir . "/" . $file)) { |
|
10198
|
+ if ($file && file_exists($dir."/".$file)) { |
10199
|
10199
|
if ($addlinktofullsize) { |
10200
|
|
- $urladvanced = getAdvancedPreviewUrl($modulepart, $originalfile, 0, '&entity=' . $entity); |
|
10200
|
+ $urladvanced = getAdvancedPreviewUrl($modulepart, $originalfile, 0, '&entity='.$entity); |
10201
|
10201
|
if ($urladvanced) { |
10202
|
|
- $ret .= '<a href="' . $urladvanced . '">'; |
|
10202
|
+ $ret .= '<a href="'.$urladvanced.'">'; |
10203
|
10203
|
} else { |
10204
|
|
- $ret .= '<a href="' . DOL_URL_ROOT . '/viewimage.php?modulepart=' . $modulepart . '&entity=' . $entity . '&file=' . urlencode($originalfile) . '&cache=' . $cache . '">'; |
|
10204
|
+ $ret .= '<a href="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$entity.'&file='.urlencode($originalfile).'&cache='.$cache.'">'; |
10205
|
10205
|
} |
10206
|
10206
|
} |
10207
|
|
- $ret .= '<img alt="" 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 . '">'; |
|
10207
|
+ $ret .= '<img alt="" 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.'">'; |
10208
|
10208
|
if ($addlinktofullsize) { |
10209
|
10209
|
$ret .= '</a>'; |
10210
|
10210
|
} |
10211
|
|
- } elseif ($altfile && file_exists($dir . "/" . $altfile)) { |
|
10211
|
+ } elseif ($altfile && file_exists($dir."/".$altfile)) { |
10212
|
10212
|
if ($addlinktofullsize) { |
10213
|
|
- $urladvanced = getAdvancedPreviewUrl($modulepart, $originalfile, 0, '&entity=' . $entity); |
|
10213
|
+ $urladvanced = getAdvancedPreviewUrl($modulepart, $originalfile, 0, '&entity='.$entity); |
10214
|
10214
|
if ($urladvanced) { |
10215
|
|
- $ret .= '<a href="' . $urladvanced . '">'; |
|
10215
|
+ $ret .= '<a href="'.$urladvanced.'">'; |
10216
|
10216
|
} else { |
10217
|
|
- $ret .= '<a href="' . DOL_URL_ROOT . '/viewimage.php?modulepart=' . $modulepart . '&entity=' . $entity . '&file=' . urlencode($originalfile) . '&cache=' . $cache . '">'; |
|
10217
|
+ $ret .= '<a href="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$entity.'&file='.urlencode($originalfile).'&cache='.$cache.'">'; |
10218
|
10218
|
} |
10219
|
10219
|
} |
10220
|
|
- $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 . '">'; |
|
10220
|
+ $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.'">'; |
10221
|
10221
|
if ($addlinktofullsize) { |
10222
|
10222
|
$ret .= '</a>'; |
10223
|
10223
|
} |
10224
|
10224
|
} else { |
10225
|
10225
|
$nophoto = '/public/theme/common/nophoto.png'; |
10226
|
|
- $defaultimg = 'identicon'; // For gravatar |
|
10226
|
+ $defaultimg = 'identicon'; // For gravatar |
10227
|
10227
|
if (in_array($modulepart, array('societe', 'userphoto', 'contact', 'memberphoto'))) { // For modules that need a special image when photo not found |
10228
|
10228
|
if ($modulepart == 'societe' || ($modulepart == 'memberphoto' && !empty($object->morphy) && strpos($object->morphy, 'mor') !== false)) { |
10229
|
10229
|
$nophoto = 'company'; |
|
@@ -10241,13 +10241,13 @@ discard block |
|
|
block discarded – undo |
10241
|
10241
|
if (isModEnabled('gravatar') && $email && empty($noexternsourceoverwrite)) { |
10242
|
10242
|
// see https://gravatar.com/site/implement/images/php/ |
10243
|
10243
|
$ret .= '<!-- Put link to gravatar -->'; |
10244
|
|
- $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 |
|
10244
|
+ $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 |
10245
|
10245
|
} else { |
10246
|
10246
|
if ($nophoto == 'company') { |
10247
|
|
- $ret .= '<div class="divforspanimg valignmiddle center photo' . $modulepart . ($cssclass ? ' ' . $cssclass : '') . '" alt="" ' . ($width ? ' width="' . $width . '"' : '') . ($height ? ' height="' . $height . '"' : '') . '>' . img_picto('', 'company') . '</div>'; |
|
10247
|
+ $ret .= '<div class="divforspanimg valignmiddle center photo'.$modulepart.($cssclass ? ' '.$cssclass : '').'" alt="" '.($width ? ' width="'.$width.'"' : '').($height ? ' height="'.$height.'"' : '').'>'.img_picto('', 'company').'</div>'; |
10248
|
10248
|
//$ret .= '<div class="difforspanimgright"></div>'; |
10249
|
10249
|
} else { |
10250
|
|
- $ret .= '<img class="photo' . $modulepart . ($cssclass ? ' ' . $cssclass : '') . '" alt="" ' . ($width ? ' width="' . $width . '"' : '') . ($height ? ' height="' . $height . '"' : '') . ' src="' . DOL_URL_ROOT . $nophoto . '">'; |
|
10250
|
+ $ret .= '<img class="photo'.$modulepart.($cssclass ? ' '.$cssclass : '').'" alt="" '.($width ? ' width="'.$width.'"' : '').($height ? ' height="'.$height.'"' : '').' src="'.DOL_URL_ROOT.$nophoto.'">'; |
10251
|
10251
|
} |
10252
|
10252
|
} |
10253
|
10253
|
} |
|
@@ -10258,15 +10258,15 @@ discard block |
|
|
block discarded – undo |
10258
|
10258
|
} |
10259
|
10259
|
$ret .= '<table class="nobordernopadding centpercent">'; |
10260
|
10260
|
if ($object->photo) { |
10261
|
|
- $ret .= '<tr><td><input type="checkbox" class="flat photodelete" name="deletephoto" id="photodelete"> <label for="photodelete">' . $langs->trans("Delete") . '</label><br><br></td></tr>'; |
|
10261
|
+ $ret .= '<tr><td><input type="checkbox" class="flat photodelete" name="deletephoto" id="photodelete"> <label for="photodelete">'.$langs->trans("Delete").'</label><br><br></td></tr>'; |
10262
|
10262
|
} |
10263
|
10263
|
$ret .= '<tr><td class="tdoverflow">'; |
10264
|
10264
|
$maxfilesizearray = getMaxFileSizeArray(); |
10265
|
10265
|
$maxmin = $maxfilesizearray['maxmin']; |
10266
|
10266
|
if ($maxmin > 0) { |
10267
|
|
- $ret .= '<input type="hidden" name="MAX_FILE_SIZE" value="' . ($maxmin * 1024) . '">'; // MAX_FILE_SIZE must precede the field type=file |
|
10267
|
+ $ret .= '<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).'">'; // MAX_FILE_SIZE must precede the field type=file |
10268
|
10268
|
} |
10269
|
|
- $ret .= '<input type="file" class="flat maxwidth200onsmartphone" name="photo" id="photoinput" accept="image/*"' . ($capture ? ' capture="' . $capture . '"' : '') . '>'; |
|
10269
|
+ $ret .= '<input type="file" class="flat maxwidth200onsmartphone" name="photo" id="photoinput" accept="image/*"'.($capture ? ' capture="'.$capture.'"' : '').'>'; |
10270
|
10270
|
$ret .= '</td></tr>'; |
10271
|
10271
|
$ret .= '</table>'; |
10272
|
10272
|
} |
|
@@ -10320,38 +10320,38 @@ discard block |
|
|
block discarded – undo |
10320
|
10320
|
if (isModEnabled('multicompany') && $conf->entity == 1 && $user->admin && !$user->entity) { |
10321
|
10321
|
$sql .= ", e.label"; |
10322
|
10322
|
} |
10323
|
|
- $sql .= " FROM " . $this->db->prefix() . "usergroup as ug "; |
|
10323
|
+ $sql .= " FROM ".$this->db->prefix()."usergroup as ug "; |
10324
|
10324
|
if (isModEnabled('multicompany') && $conf->entity == 1 && $user->admin && !$user->entity) { |
10325
|
|
- $sql .= " LEFT JOIN " . $this->db->prefix() . "entity as e ON e.rowid=ug.entity"; |
|
10325
|
+ $sql .= " LEFT JOIN ".$this->db->prefix()."entity as e ON e.rowid=ug.entity"; |
10326
|
10326
|
if ($force_entity) { |
10327
|
|
- $sql .= " WHERE ug.entity IN (0, " . $force_entity . ")"; |
|
10327
|
+ $sql .= " WHERE ug.entity IN (0, ".$force_entity.")"; |
10328
|
10328
|
} else { |
10329
|
10329
|
$sql .= " WHERE ug.entity IS NOT NULL"; |
10330
|
10330
|
} |
10331
|
10331
|
} else { |
10332
|
|
- $sql .= " WHERE ug.entity IN (0, " . $conf->entity . ")"; |
|
10332
|
+ $sql .= " WHERE ug.entity IN (0, ".$conf->entity.")"; |
10333
|
10333
|
} |
10334
|
10334
|
if (is_array($exclude) && $excludeGroups) { |
10335
|
|
- $sql .= " AND ug.rowid NOT IN (" . $this->db->sanitize($excludeGroups) . ")"; |
|
10335
|
+ $sql .= " AND ug.rowid NOT IN (".$this->db->sanitize($excludeGroups).")"; |
10336
|
10336
|
} |
10337
|
10337
|
if (is_array($include) && $includeGroups) { |
10338
|
|
- $sql .= " AND ug.rowid IN (" . $this->db->sanitize($includeGroups) . ")"; |
|
10338
|
+ $sql .= " AND ug.rowid IN (".$this->db->sanitize($includeGroups).")"; |
10339
|
10339
|
} |
10340
|
10340
|
$sql .= " ORDER BY ug.nom ASC"; |
10341
|
10341
|
|
10342
|
|
- dol_syslog(get_class($this) . "::select_dolgroups", LOG_DEBUG); |
|
10342
|
+ dol_syslog(get_class($this)."::select_dolgroups", LOG_DEBUG); |
10343
|
10343
|
$resql = $this->db->query($sql); |
10344
|
10344
|
if ($resql) { |
10345
|
10345
|
// Enhance with select2 |
10346
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
10346
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
10347
|
10347
|
|
10348
|
|
- $out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" id="' . $htmlname . '" name="' . $htmlname . ($multiple ? '[]' : '') . '" ' . ($multiple ? 'multiple' : '') . ' ' . ($disabled ? ' disabled' : '') . '>'; |
|
10348
|
+ $out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" id="'.$htmlname.'" name="'.$htmlname.($multiple ? '[]' : '').'" '.($multiple ? 'multiple' : '').' '.($disabled ? ' disabled' : '').'>'; |
10349
|
10349
|
|
10350
|
10350
|
$num = $this->db->num_rows($resql); |
10351
|
10351
|
$i = 0; |
10352
|
10352
|
if ($num) { |
10353
|
10353
|
if ($show_empty && !$multiple) { |
10354
|
|
- $out .= '<option value="-1"' . (in_array(-1, $selected) ? ' selected' : '') . '> </option>' . "\n"; |
|
10354
|
+ $out .= '<option value="-1"'.(in_array(-1, $selected) ? ' selected' : '').'> </option>'."\n"; |
10355
|
10355
|
} |
10356
|
10356
|
|
10357
|
10357
|
while ($i < $num) { |
|
@@ -10364,11 +10364,11 @@ discard block |
|
|
block discarded – undo |
10364
|
10364
|
$label = $obj->name; |
10365
|
10365
|
$labelhtml = $obj->name; |
10366
|
10366
|
if (isModEnabled('multicompany') && !getDolGlobalInt('MULTICOMPANY_TRANSVERSE_MODE') && $conf->entity == 1) { |
10367
|
|
- $label .= " (" . $obj->label . ")"; |
10368
|
|
- $labelhtml .= ' <span class="opacitymedium">(' . $obj->label . ')</span>'; |
|
10367
|
+ $label .= " (".$obj->label.")"; |
|
10368
|
+ $labelhtml .= ' <span class="opacitymedium">('.$obj->label.')</span>'; |
10369
|
10369
|
} |
10370
|
10370
|
|
10371
|
|
- $out .= '<option value="' . $obj->rowid . '"'; |
|
10371
|
+ $out .= '<option value="'.$obj->rowid.'"'; |
10372
|
10372
|
if ($disableline) { |
10373
|
10373
|
$out .= ' disabled'; |
10374
|
10374
|
} |
|
@@ -10384,9 +10384,9 @@ discard block |
|
|
block discarded – undo |
10384
|
10384
|
} |
10385
|
10385
|
} else { |
10386
|
10386
|
if ($show_empty) { |
10387
|
|
- $out .= '<option value="-1"' . (in_array(-1, $selected) ? ' selected' : '') . '></option>' . "\n"; |
|
10387
|
+ $out .= '<option value="-1"'.(in_array(-1, $selected) ? ' selected' : '').'></option>'."\n"; |
10388
|
10388
|
} |
10389
|
|
- $out .= '<option value="" disabled>' . $langs->trans("NoUserGroupDefined") . '</option>'; |
|
10389
|
+ $out .= '<option value="" disabled>'.$langs->trans("NoUserGroupDefined").'</option>'; |
10390
|
10390
|
} |
10391
|
10391
|
$out .= '</select>'; |
10392
|
10392
|
|
|
@@ -10430,25 +10430,25 @@ discard block |
|
|
block discarded – undo |
10430
|
10430
|
$out = ''; |
10431
|
10431
|
|
10432
|
10432
|
if (!empty($conf->use_javascript_ajax)) { |
10433
|
|
- $out .= '<div class="inline-block checkallactions"><input type="checkbox" id="' . $cssclass . 's" name="' . $cssclass . 's" class="checkallactions"></div>'; |
|
10433
|
+ $out .= '<div class="inline-block checkallactions"><input type="checkbox" id="'.$cssclass.'s" name="'.$cssclass.'s" class="checkallactions"></div>'; |
10434
|
10434
|
} |
10435
|
|
- $out .= '<script nonce="' . getNonce() . '"> |
|
10435
|
+ $out .= '<script nonce="'.getNonce().'"> |
10436
|
10436
|
$(document).ready(function() { |
10437
|
|
- $("#' . $cssclass . 's").click(function() { |
|
10437
|
+ $("#' . $cssclass.'s").click(function() { |
10438
|
10438
|
if($(this).is(\':checked\')){ |
10439
|
|
- console.log("We check all ' . $cssclass . ' and trigger the change method"); |
10440
|
|
- $(".' . $cssclass . '").prop(\'checked\', true).trigger(\'change\'); |
|
10439
|
+ console.log("We check all ' . $cssclass.' and trigger the change method"); |
|
10440
|
+ $(".' . $cssclass.'").prop(\'checked\', true).trigger(\'change\'); |
10441
|
10441
|
} |
10442
|
10442
|
else |
10443
|
10443
|
{ |
10444
|
10444
|
console.log("We uncheck all"); |
10445
|
|
- $(".' . $cssclass . '").prop(\'checked\', false).trigger(\'change\'); |
|
10445
|
+ $(".' . $cssclass.'").prop(\'checked\', false).trigger(\'change\'); |
10446
|
10446
|
}' . "\n"; |
10447
|
10447
|
if ($calljsfunction) { |
10448
|
|
- $out .= 'if (typeof initCheckForSelect == \'function\') { initCheckForSelect(0, "' . $massactionname . '", "' . $cssclass . '"); } else { console.log("No function initCheckForSelect found. Call won\'t be done."); }'; |
|
10448
|
+ $out .= 'if (typeof initCheckForSelect == \'function\') { initCheckForSelect(0, "'.$massactionname.'", "'.$cssclass.'"); } else { console.log("No function initCheckForSelect found. Call won\'t be done."); }'; |
10449
|
10449
|
} |
10450
|
10450
|
$out .= ' }); |
10451
|
|
- $(".' . $cssclass . '").change(function() { |
|
10451
|
+ $(".' . $cssclass.'").change(function() { |
10452
|
10452
|
$(this).closest("tr").toggleClass("highlight", this.checked); |
10453
|
10453
|
}); |
10454
|
10454
|
}); |
|
@@ -10493,67 +10493,67 @@ discard block |
|
|
block discarded – undo |
10493
|
10493
|
global $langs, $user; |
10494
|
10494
|
|
10495
|
10495
|
$out = ''; |
10496
|
|
- $sql = "SELECT rowid, label FROM " . $this->db->prefix() . "c_exp_tax_cat WHERE active = 1"; |
10497
|
|
- $sql .= " AND entity IN (0," . getEntity('exp_tax_cat') . ")"; |
|
10496
|
+ $sql = "SELECT rowid, label FROM ".$this->db->prefix()."c_exp_tax_cat WHERE active = 1"; |
|
10497
|
+ $sql .= " AND entity IN (0,".getEntity('exp_tax_cat').")"; |
10498
|
10498
|
if (!empty($excludeid)) { |
10499
|
|
- $sql .= " AND rowid NOT IN (" . $this->db->sanitize(implode(',', $excludeid)) . ")"; |
|
10499
|
+ $sql .= " AND rowid NOT IN (".$this->db->sanitize(implode(',', $excludeid)).")"; |
10500
|
10500
|
} |
10501
|
10501
|
$sql .= " ORDER BY label"; |
10502
|
10502
|
|
10503
|
10503
|
$resql = $this->db->query($sql); |
10504
|
10504
|
if ($resql) { |
10505
|
|
- $out = '<select id="select_' . $htmlname . '" name="' . $htmlname . '" class="' . $htmlname . ' flat minwidth75imp maxwidth200">'; |
|
10505
|
+ $out = '<select id="select_'.$htmlname.'" name="'.$htmlname.'" class="'.$htmlname.' flat minwidth75imp maxwidth200">'; |
10506
|
10506
|
if ($useempty) { |
10507
|
10507
|
$out .= '<option value="0"> </option>'; |
10508
|
10508
|
} |
10509
|
10509
|
|
10510
|
10510
|
while ($obj = $this->db->fetch_object($resql)) { |
10511
|
|
- $out .= '<option ' . ($selected == $obj->rowid ? 'selected="selected"' : '') . ' value="' . $obj->rowid . '">' . $langs->trans($obj->label) . '</option>'; |
|
10511
|
+ $out .= '<option '.($selected == $obj->rowid ? 'selected="selected"' : '').' value="'.$obj->rowid.'">'.$langs->trans($obj->label).'</option>'; |
10512
|
10512
|
} |
10513
|
10513
|
$out .= '</select>'; |
10514
|
|
- $out .= ajax_combobox('select_' . $htmlname); |
|
10514
|
+ $out .= ajax_combobox('select_'.$htmlname); |
10515
|
10515
|
|
10516
|
10516
|
if (!empty($htmlname) && $user->admin && $info_admin) { |
10517
|
|
- $out .= ' ' . info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); |
|
10517
|
+ $out .= ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); |
10518
|
10518
|
} |
10519
|
10519
|
|
10520
|
10520
|
if (!empty($target)) { |
10521
|
|
- $sql = "SELECT c.id FROM " . $this->db->prefix() . "c_type_fees as c WHERE c.code = 'EX_KME' AND c.active = 1"; |
|
10521
|
+ $sql = "SELECT c.id FROM ".$this->db->prefix()."c_type_fees as c WHERE c.code = 'EX_KME' AND c.active = 1"; |
10522
|
10522
|
$resql = $this->db->query($sql); |
10523
|
10523
|
if ($resql) { |
10524
|
10524
|
if ($this->db->num_rows($resql) > 0) { |
10525
|
10525
|
$obj = $this->db->fetch_object($resql); |
10526
|
|
- $out .= '<script nonce="' . getNonce() . '"> |
|
10526
|
+ $out .= '<script nonce="'.getNonce().'"> |
10527
|
10527
|
$(function() { |
10528
|
|
- $("select[name=' . $target . ']").on("change", function() { |
|
10528
|
+ $("select[name=' . $target.']").on("change", function() { |
10529
|
10529
|
var current_val = $(this).val(); |
10530
|
|
- if (current_val == ' . $obj->id . ') {'; |
|
10530
|
+ if (current_val == ' . $obj->id.') {'; |
10531
|
10531
|
if (!empty($default_selected) || !empty($selected)) { |
10532
|
|
- $out .= '$("select[name=' . $htmlname . ']").val("' . ($default_selected > 0 ? $default_selected : $selected) . '");'; |
|
10532
|
+ $out .= '$("select[name='.$htmlname.']").val("'.($default_selected > 0 ? $default_selected : $selected).'");'; |
10533
|
10533
|
} |
10534
|
10534
|
|
10535
|
10535
|
$out .= ' |
10536
|
|
- $("select[name=' . $htmlname . ']").change(); |
|
10536
|
+ $("select[name=' . $htmlname.']").change(); |
10537
|
10537
|
} |
10538
|
10538
|
}); |
10539
|
10539
|
|
10540
|
|
- $("select[name=' . $htmlname . ']").change(function() { |
|
10540
|
+ $("select[name=' . $htmlname.']").change(function() { |
10541
|
10541
|
|
10542
|
|
- if ($("select[name=' . $target . ']").val() == ' . $obj->id . ') { |
|
10542
|
+ if ($("select[name=' . $target.']").val() == '.$obj->id.') { |
10543
|
10543
|
// get price of kilometer to fill the unit price |
10544
|
10544
|
$.ajax({ |
10545
|
10545
|
method: "POST", |
10546
|
10546
|
dataType: "json", |
10547
|
|
- data: { fk_c_exp_tax_cat: $(this).val(), token: \'' . currentToken() . '\' }, |
10548
|
|
- url: "' . (DOL_URL_ROOT . '/expensereport/ajax/ajaxik.php?' . implode('&', $params)) . '", |
|
10547
|
+ data: { fk_c_exp_tax_cat: $(this).val(), token: \'' . currentToken().'\' }, |
|
10548
|
+ url: "' . (DOL_URL_ROOT.'/expensereport/ajax/ajaxik.php?'.implode('&', $params)).'", |
10549
|
10549
|
}).done(function( data, textStatus, jqXHR ) { |
10550
|
10550
|
console.log(data); |
10551
|
10551
|
if (typeof data.up != "undefined") { |
10552
|
10552
|
$("input[name=value_unit]").val(data.up); |
10553
|
|
- $("select[name=' . $htmlname . ']").attr("title", data.title); |
|
10553
|
+ $("select[name=' . $htmlname.']").attr("title", data.title); |
10554
|
10554
|
} else { |
10555
|
10555
|
$("input[name=value_unit]").val(""); |
10556
|
|
- $("select[name=' . $htmlname . ']").attr("title", ""); |
|
10556
|
+ $("select[name=' . $htmlname.']").attr("title", ""); |
10557
|
10557
|
} |
10558
|
10558
|
}); |
10559
|
10559
|
} |
|
@@ -10583,18 +10583,18 @@ discard block |
|
|
block discarded – undo |
10583
|
10583
|
global $conf, $langs; |
10584
|
10584
|
|
10585
|
10585
|
$out = ''; |
10586
|
|
- $sql = "SELECT rowid, range_ik FROM " . $this->db->prefix() . "c_exp_tax_range"; |
10587
|
|
- $sql .= " WHERE entity = " . $conf->entity . " AND active = 1"; |
|
10586
|
+ $sql = "SELECT rowid, range_ik FROM ".$this->db->prefix()."c_exp_tax_range"; |
|
10587
|
+ $sql .= " WHERE entity = ".$conf->entity." AND active = 1"; |
10588
|
10588
|
|
10589
|
10589
|
$resql = $this->db->query($sql); |
10590
|
10590
|
if ($resql) { |
10591
|
|
- $out = '<select id="select_' . $htmlname . '" name="' . $htmlname . '" class="' . $htmlname . ' flat minwidth75imp">'; |
|
10591
|
+ $out = '<select id="select_'.$htmlname.'" name="'.$htmlname.'" class="'.$htmlname.' flat minwidth75imp">'; |
10592
|
10592
|
if ($useempty) { |
10593
|
10593
|
$out .= '<option value="0"></option>'; |
10594
|
10594
|
} |
10595
|
10595
|
|
10596
|
10596
|
while ($obj = $this->db->fetch_object($resql)) { |
10597
|
|
- $out .= '<option ' . ($selected == $obj->rowid ? 'selected="selected"' : '') . ' value="' . $obj->rowid . '">' . price($obj->range_ik, 0, $langs, 1, 0) . '</option>'; |
|
10597
|
+ $out .= '<option '.($selected == $obj->rowid ? 'selected="selected"' : '').' value="'.$obj->rowid.'">'.price($obj->range_ik, 0, $langs, 1, 0).'</option>'; |
10598
|
10598
|
} |
10599
|
10599
|
$out .= '</select>'; |
10600
|
10600
|
} else { |
|
@@ -10625,12 +10625,12 @@ discard block |
|
|
block discarded – undo |
10625
|
10625
|
|
10626
|
10626
|
$resql = $this->db->query($sql); |
10627
|
10627
|
if ($resql) { |
10628
|
|
- $out = '<select id="select_' . $htmlname . '" name="' . $htmlname . '" class="' . $htmlname . ' flat minwidth75imp">'; |
|
10628
|
+ $out = '<select id="select_'.$htmlname.'" name="'.$htmlname.'" class="'.$htmlname.' flat minwidth75imp">'; |
10629
|
10629
|
if ($useempty) { |
10630
|
10630
|
$out .= '<option value="0"></option>'; |
10631
|
10631
|
} |
10632
|
10632
|
if ($allchoice) { |
10633
|
|
- $out .= '<option value="-1">' . $langs->trans('AllExpenseReport') . '</option>'; |
|
10633
|
+ $out .= '<option value="-1">'.$langs->trans('AllExpenseReport').'</option>'; |
10634
|
10634
|
} |
10635
|
10635
|
|
10636
|
10636
|
$field = 'code'; |
|
@@ -10640,7 +10640,7 @@ discard block |
|
|
block discarded – undo |
10640
|
10640
|
|
10641
|
10641
|
while ($obj = $this->db->fetch_object($resql)) { |
10642
|
10642
|
$key = $langs->trans($obj->code); |
10643
|
|
- $out .= '<option ' . ($selected == $obj->{$field} ? 'selected="selected"' : '') . ' value="' . $obj->{$field} . '">' . ($key != $obj->code ? $key : $obj->label) . '</option>'; |
|
10643
|
+ $out .= '<option '.($selected == $obj->{$field} ? 'selected="selected"' : '').' value="'.$obj->{$field}.'">'.($key != $obj->code ? $key : $obj->label).'</option>'; |
10644
|
10644
|
} |
10645
|
10645
|
$out .= '</select>'; |
10646
|
10646
|
|
|
@@ -10674,7 +10674,7 @@ discard block |
|
|
block discarded – undo |
10674
|
10674
|
{ |
10675
|
10675
|
global $user, $conf, $langs; |
10676
|
10676
|
|
10677
|
|
- require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; |
|
10677
|
+ require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; |
10678
|
10678
|
|
10679
|
10679
|
if (is_null($usertofilter)) { |
10680
|
10680
|
$usertofilter = $user; |
|
@@ -10698,10 +10698,10 @@ discard block |
|
|
block discarded – undo |
10698
|
10698
|
$sql = "SELECT f.rowid, f.ref as fref, 'nolabel' as flabel, p.rowid as pid, f.ref, |
10699
|
10699
|
p.title, p.fk_soc, p.fk_statut, p.public,"; |
10700
|
10700
|
$sql .= ' s.nom as name'; |
10701
|
|
- $sql .= ' FROM ' . $this->db->prefix() . 'projet as p'; |
10702
|
|
- $sql .= ' LEFT JOIN ' . $this->db->prefix() . 'societe as s ON s.rowid = p.fk_soc,'; |
10703
|
|
- $sql .= ' ' . $this->db->prefix() . 'facture as f'; |
10704
|
|
- $sql .= " WHERE p.entity IN (" . getEntity('project') . ")"; |
|
10701
|
+ $sql .= ' FROM '.$this->db->prefix().'projet as p'; |
|
10702
|
+ $sql .= ' LEFT JOIN '.$this->db->prefix().'societe as s ON s.rowid = p.fk_soc,'; |
|
10703
|
+ $sql .= ' '.$this->db->prefix().'facture as f'; |
|
10704
|
+ $sql .= " WHERE p.entity IN (".getEntity('project').")"; |
10705
|
10705
|
$sql .= " AND f.fk_projet = p.rowid AND f.fk_statut=0"; //Brouillons seulement |
10706
|
10706
|
//if ($projectsListId) $sql.= " AND p.rowid IN (".$this->db->sanitize($projectsListId).")"; |
10707
|
10707
|
//if ($socid == 0) $sql.= " AND (p.fk_soc=0 OR p.fk_soc IS NULL)"; |
|
@@ -10712,14 +10712,14 @@ discard block |
|
|
block discarded – undo |
10712
|
10712
|
if ($resql) { |
10713
|
10713
|
// Use select2 selector |
10714
|
10714
|
if (!empty($conf->use_javascript_ajax)) { |
10715
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
10715
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
10716
|
10716
|
$comboenhancement = ajax_combobox($htmlname, array(), 0, $forcefocus); |
10717
|
10717
|
$out .= $comboenhancement; |
10718
|
10718
|
$morecss = 'minwidth200imp maxwidth500'; |
10719
|
10719
|
} |
10720
|
10720
|
|
10721
|
10721
|
if (empty($option_only)) { |
10722
|
|
- $out .= '<select class="valignmiddle flat' . ($morecss ? ' ' . $morecss : '') . '"' . ($disabled ? ' disabled="disabled"' : '') . ' id="' . $htmlname . '" name="' . $htmlname . '">'; |
|
10722
|
+ $out .= '<select class="valignmiddle flat'.($morecss ? ' '.$morecss : '').'"'.($disabled ? ' disabled="disabled"' : '').' id="'.$htmlname.'" name="'.$htmlname.'">'; |
10723
|
10723
|
} |
10724
|
10724
|
if (!empty($show_empty)) { |
10725
|
10725
|
$out .= '<option value="0" class="optiongrey">'; |
|
@@ -10749,33 +10749,33 @@ discard block |
|
|
block discarded – undo |
10749
|
10749
|
if ($showproject == 'all') { |
10750
|
10750
|
$labeltoshow .= dol_trunc($obj->ref, 18); // Invoice ref |
10751
|
10751
|
if ($obj->name) { |
10752
|
|
- $labeltoshow .= ' - ' . $obj->name; // Soc name |
|
10752
|
+ $labeltoshow .= ' - '.$obj->name; // Soc name |
10753
|
10753
|
} |
10754
|
10754
|
|
10755
|
10755
|
$disabled = 0; |
10756
|
10756
|
if ($obj->fk_statut == Project::STATUS_DRAFT) { |
10757
|
10757
|
$disabled = 1; |
10758
|
|
- $labeltoshow .= ' - ' . $langs->trans("Draft"); |
|
10758
|
+ $labeltoshow .= ' - '.$langs->trans("Draft"); |
10759
|
10759
|
} elseif ($obj->fk_statut == Project::STATUS_CLOSED) { |
10760
|
10760
|
if ($discard_closed == 2) { |
10761
|
10761
|
$disabled = 1; |
10762
|
10762
|
} |
10763
|
|
- $labeltoshow .= ' - ' . $langs->trans("Closed"); |
|
10763
|
+ $labeltoshow .= ' - '.$langs->trans("Closed"); |
10764
|
10764
|
} elseif ($socid > 0 && (!empty($obj->fk_soc) && $obj->fk_soc != $socid)) { |
10765
|
10765
|
$disabled = 1; |
10766
|
|
- $labeltoshow .= ' - ' . $langs->trans("LinkedToAnotherCompany"); |
|
10766
|
+ $labeltoshow .= ' - '.$langs->trans("LinkedToAnotherCompany"); |
10767
|
10767
|
} |
10768
|
10768
|
} |
10769
|
10769
|
|
10770
|
10770
|
if (!empty($selected) && $selected == $obj->rowid) { |
10771
|
|
- $out .= '<option value="' . $obj->rowid . '" selected'; |
|
10771
|
+ $out .= '<option value="'.$obj->rowid.'" selected'; |
10772
|
10772
|
//if ($disabled) $out.=' disabled'; // with select2, field can't be preselected if disabled |
10773
|
|
- $out .= '>' . $labeltoshow . '</option>'; |
|
10773
|
+ $out .= '>'.$labeltoshow.'</option>'; |
10774
|
10774
|
} else { |
10775
|
10775
|
if ($hideunselectables && $disabled && ($selected != $obj->rowid)) { |
10776
|
10776
|
$resultat = ''; |
10777
|
10777
|
} else { |
10778
|
|
- $resultat = '<option value="' . $obj->rowid . '"'; |
|
10778
|
+ $resultat = '<option value="'.$obj->rowid.'"'; |
10779
|
10779
|
if ($disabled) { |
10780
|
10780
|
$resultat .= ' disabled'; |
10781
|
10781
|
} |
|
@@ -10827,22 +10827,22 @@ discard block |
|
|
block discarded – undo |
10827
|
10827
|
|
10828
|
10828
|
$sql = 'SELECT f.rowid, f.entity, f.titre as title, f.suspended, f.fk_soc'; |
10829
|
10829
|
//$sql.= ', el.fk_source'; |
10830
|
|
- $sql .= ' FROM ' . MAIN_DB_PREFIX . 'facture_rec as f'; |
10831
|
|
- $sql .= " WHERE f.entity IN (" . getEntity('invoice') . ")"; |
|
10830
|
+ $sql .= ' FROM '.MAIN_DB_PREFIX.'facture_rec as f'; |
|
10831
|
+ $sql .= " WHERE f.entity IN (".getEntity('invoice').")"; |
10832
|
10832
|
$sql .= " ORDER BY f.titre ASC"; |
10833
|
10833
|
|
10834
|
10834
|
$resql = $this->db->query($sql); |
10835
|
10835
|
if ($resql) { |
10836
|
10836
|
// Use select2 selector |
10837
|
10837
|
if (!empty($conf->use_javascript_ajax)) { |
10838
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
10838
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
10839
|
10839
|
$comboenhancement = ajax_combobox($htmlname, array(), 0, $forcefocus); |
10840
|
10840
|
$out .= $comboenhancement; |
10841
|
10841
|
$morecss = 'minwidth200imp maxwidth500'; |
10842
|
10842
|
} |
10843
|
10843
|
|
10844
|
10844
|
if (empty($option_only)) { |
10845
|
|
- $out .= '<select class="valignmiddle flat' . ($morecss ? ' ' . $morecss : '') . '"' . ($disabled ? ' disabled="disabled"' : '') . ' id="' . $htmlname . '" name="' . $htmlname . '">'; |
|
10845
|
+ $out .= '<select class="valignmiddle flat'.($morecss ? ' '.$morecss : '').'"'.($disabled ? ' disabled="disabled"' : '').' id="'.$htmlname.'" name="'.$htmlname.'">'; |
10846
|
10846
|
} |
10847
|
10847
|
if (!empty($show_empty)) { |
10848
|
10848
|
$out .= '<option value="0" class="optiongrey">'; |
|
@@ -10861,19 +10861,19 @@ discard block |
|
|
block discarded – undo |
10861
|
10861
|
$disabled = 0; |
10862
|
10862
|
if (!empty($obj->suspended)) { |
10863
|
10863
|
$disabled = 1; |
10864
|
|
- $labeltoshow .= ' - ' . $langs->trans("Closed"); |
|
10864
|
+ $labeltoshow .= ' - '.$langs->trans("Closed"); |
10865
|
10865
|
} |
10866
|
10866
|
|
10867
|
10867
|
|
10868
|
10868
|
if (!empty($selected) && $selected == $obj->rowid) { |
10869
|
|
- $out .= '<option value="' . $obj->rowid . '" selected'; |
|
10869
|
+ $out .= '<option value="'.$obj->rowid.'" selected'; |
10870
|
10870
|
//if ($disabled) $out.=' disabled'; // with select2, field can't be preselected if disabled |
10871
|
|
- $out .= '>' . $labeltoshow . '</option>'; |
|
10871
|
+ $out .= '>'.$labeltoshow.'</option>'; |
10872
|
10872
|
} else { |
10873
|
10873
|
if ($disabled && ($selected != $obj->rowid)) { |
10874
|
10874
|
$resultat = ''; |
10875
|
10875
|
} else { |
10876
|
|
- $resultat = '<option value="' . $obj->rowid . '"'; |
|
10876
|
+ $resultat = '<option value="'.$obj->rowid.'"'; |
10877
|
10877
|
if ($disabled) { |
10878
|
10878
|
$resultat .= ' disabled'; |
10879
|
10879
|
} |
|
@@ -10913,14 +10913,14 @@ discard block |
|
|
block discarded – undo |
10913
|
10913
|
global $langs; |
10914
|
10914
|
|
10915
|
10915
|
if ($search_component_params_hidden != '' && !preg_match('/^\(.*\)$/', $search_component_params_hidden)) { // If $search_component_params_hidden does not start and end with () |
10916
|
|
- $search_component_params_hidden = '(' . $search_component_params_hidden . ')'; |
|
10916
|
+ $search_component_params_hidden = '('.$search_component_params_hidden.')'; |
10917
|
10917
|
} |
10918
|
10918
|
|
10919
|
10919
|
$ret = ''; |
10920
|
10920
|
|
10921
|
10921
|
$ret .= '<div class="divadvancedsearchfieldcomp centpercent inline-block">'; |
10922
|
10922
|
$ret .= '<a href="#" class="dropdownsearch-toggle unsetcolor">'; |
10923
|
|
- $ret .= '<span class="fas fa-filter linkobject boxfilter paddingright pictofixedwidth" title="' . dol_escape_htmltag($langs->trans("Filters")) . '" id="idsubimgproductdistribution"></span>'; |
|
10923
|
+ $ret .= '<span class="fas fa-filter linkobject boxfilter paddingright pictofixedwidth" title="'.dol_escape_htmltag($langs->trans("Filters")).'" id="idsubimgproductdistribution"></span>'; |
10924
|
10924
|
$ret .= '</a>'; |
10925
|
10925
|
|
10926
|
10926
|
$ret .= '<div class="divadvancedsearchfieldcompinput inline-block minwidth500 maxwidth300onsmartphone">'; |
|
@@ -10964,29 +10964,29 @@ discard block |
|
|
block discarded – undo |
10964
|
10964
|
$ret .= '<input type="hidden" name="show_search_component_params_hidden" value="1">'; |
10965
|
10965
|
} |
10966
|
10966
|
$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%')) -->"; |
10967
|
|
- $ret .= '<input type="hidden" id="search_component_params_hidden" name="search_component_params_hidden" value="' . dol_escape_htmltag($search_component_params_hidden) . '">'; |
|
10967
|
+ $ret .= '<input type="hidden" id="search_component_params_hidden" name="search_component_params_hidden" value="'.dol_escape_htmltag($search_component_params_hidden).'">'; |
10968
|
10968
|
// $ret .= "<!-- sql= ".forgeSQLFromUniversalSearchCriteria($search_component_params_hidden, $errormessage)." -->"; |
10969
|
10969
|
|
10970
|
10970
|
// For compatibility with forms that show themself the search criteria in addition of this component, we output these fields |
10971
|
10971
|
foreach ($arrayofcriterias as $criteria) { |
10972
|
10972
|
foreach ($criteria as $criteriafamilykey => $criteriafamilyval) { |
10973
|
|
- if (in_array('search_' . $criteriafamilykey, $arrayofinputfieldsalreadyoutput)) { |
|
10973
|
+ if (in_array('search_'.$criteriafamilykey, $arrayofinputfieldsalreadyoutput)) { |
10974
|
10974
|
continue; |
10975
|
10975
|
} |
10976
|
10976
|
if (in_array($criteriafamilykey, array('rowid', 'ref_ext', 'entity', 'extraparams'))) { |
10977
|
10977
|
continue; |
10978
|
10978
|
} |
10979
|
10979
|
if (in_array($criteriafamilyval['type'], array('date', 'datetime', 'timestamp'))) { |
10980
|
|
- $ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_start">'; |
10981
|
|
- $ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_startyear">'; |
10982
|
|
- $ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_startmonth">'; |
10983
|
|
- $ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_startday">'; |
10984
|
|
- $ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_end">'; |
10985
|
|
- $ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_endyear">'; |
10986
|
|
- $ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_endmonth">'; |
10987
|
|
- $ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_endday">'; |
|
10980
|
+ $ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_start">'; |
|
10981
|
+ $ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_startyear">'; |
|
10982
|
+ $ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_startmonth">'; |
|
10983
|
+ $ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_startday">'; |
|
10984
|
+ $ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_end">'; |
|
10985
|
+ $ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_endyear">'; |
|
10986
|
+ $ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_endmonth">'; |
|
10987
|
+ $ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_endday">'; |
10988
|
10988
|
} else { |
10989
|
|
- $ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '">'; |
|
10989
|
+ $ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'">'; |
10990
|
10990
|
} |
10991
|
10991
|
} |
10992
|
10992
|
} |
|
@@ -10994,7 +10994,7 @@ discard block |
|
|
block discarded – undo |
10994
|
10994
|
$ret .= '</div>'; |
10995
|
10995
|
|
10996
|
10996
|
$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"; |
10997
|
|
- $ret .= '<input type="text" placeholder="' . $langs->trans("Filters") . '" id="search_component_params_input" name="search_component_params_input" class="noborderbottom search_component_input" value="">'; |
|
10997
|
+ $ret .= '<input type="text" placeholder="'.$langs->trans("Filters").'" id="search_component_params_input" name="search_component_params_input" class="noborderbottom search_component_input" value="">'; |
10998
|
10998
|
|
10999
|
10999
|
$ret .= '</div>'; |
11000
|
11000
|
$ret .= '</div>'; |
|
@@ -11068,7 +11068,7 @@ discard block |
|
|
block discarded – undo |
11068
|
11068
|
|
11069
|
11069
|
$TModels = array(); |
11070
|
11070
|
|
11071
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php'; |
|
11071
|
+ include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; |
11072
|
11072
|
$formmail = new FormMail($this->db); |
11073
|
11073
|
$result = $formmail->fetchAllEMailTemplate($modelType, $user, $langs); |
11074
|
11074
|
|
|
@@ -11081,17 +11081,17 @@ discard block |
|
|
block discarded – undo |
11081
|
11081
|
} |
11082
|
11082
|
} |
11083
|
11083
|
|
11084
|
|
- $retstring .= '<select class="flat" id="select_' . $prefix . 'model_mail" name="' . $prefix . 'model_mail">'; |
|
11084
|
+ $retstring .= '<select class="flat" id="select_'.$prefix.'model_mail" name="'.$prefix.'model_mail">'; |
11085
|
11085
|
|
11086
|
11086
|
foreach ($TModels as $id_model => $label_model) { |
11087
|
|
- $retstring .= '<option value="' . $id_model . '"'; |
11088
|
|
- $retstring .= ">" . $label_model . "</option>"; |
|
11087
|
+ $retstring .= '<option value="'.$id_model.'"'; |
|
11088
|
+ $retstring .= ">".$label_model."</option>"; |
11089
|
11089
|
} |
11090
|
11090
|
|
11091
|
11091
|
$retstring .= "</select>"; |
11092
|
11092
|
|
11093
|
11093
|
if ($addjscombo) { |
11094
|
|
- $retstring .= ajax_combobox('select_' . $prefix . 'model_mail'); |
|
11094
|
+ $retstring .= ajax_combobox('select_'.$prefix.'model_mail'); |
11095
|
11095
|
} |
11096
|
11096
|
|
11097
|
11097
|
return $retstring; |
|
@@ -11142,16 +11142,16 @@ discard block |
|
|
block discarded – undo |
11142
|
11142
|
|
11143
|
11143
|
foreach ($buttons as $button) { |
11144
|
11144
|
$addclass = empty($button['addclass']) ? '' : $button['addclass']; |
11145
|
|
- $retstring .= '<input type="submit" class="button button-' . $button['name'] . ($morecss ? ' ' . $morecss : '') . ' ' . $addclass . '" name="' . $button['name'] . '" value="' . dol_escape_htmltag($langs->trans($button['label_key'])) . '">'; |
|
11145
|
+ $retstring .= '<input type="submit" class="button button-'.$button['name'].($morecss ? ' '.$morecss : '').' '.$addclass.'" name="'.$button['name'].'" value="'.dol_escape_htmltag($langs->trans($button['label_key'])).'">'; |
11146
|
11146
|
} |
11147
|
11147
|
$retstring .= $withoutdiv ? '' : '</div>'; |
11148
|
11148
|
|
11149
|
11149
|
if ($dol_openinpopup) { |
11150
|
|
- $retstring .= '<!-- buttons are shown into a $dol_openinpopup=' . $dol_openinpopup . ' context, so we enable the close of dialog on cancel -->' . "\n"; |
11151
|
|
- $retstring .= '<script nonce="' . getNonce() . '">'; |
|
11150
|
+ $retstring .= '<!-- buttons are shown into a $dol_openinpopup='.$dol_openinpopup.' context, so we enable the close of dialog on cancel -->'."\n"; |
|
11151
|
+ $retstring .= '<script nonce="'.getNonce().'">'; |
11152
|
11152
|
$retstring .= 'jQuery(".button-cancel").click(function(e) { |
11153
|
|
- e.preventDefault(); console.log(\'We click on cancel in iframe popup ' . $dol_openinpopup . '\'); |
11154
|
|
- window.parent.jQuery(\'#idfordialog' . $dol_openinpopup . '\').dialog(\'close\'); |
|
11153
|
+ e.preventDefault(); console.log(\'We click on cancel in iframe popup ' . $dol_openinpopup.'\'); |
|
11154
|
+ window.parent.jQuery(\'#idfordialog' . $dol_openinpopup.'\').dialog(\'close\'); |
11155
|
11155
|
});'; |
11156
|
11156
|
$retstring .= '</script>'; |
11157
|
11157
|
} |
|
@@ -11180,7 +11180,7 @@ discard block |
|
|
block discarded – undo |
11180
|
11180
|
dol_syslog(__METHOD__, LOG_DEBUG); |
11181
|
11181
|
|
11182
|
11182
|
$sql = "SELECT rowid, code, label as label"; |
11183
|
|
- $sql .= " FROM " . MAIN_DB_PREFIX . 'c_invoice_subtype'; |
|
11183
|
+ $sql .= " FROM ".MAIN_DB_PREFIX.'c_invoice_subtype'; |
11184
|
11184
|
$sql .= " WHERE active = 1"; |
11185
|
11185
|
|
11186
|
11186
|
$resql = $this->db->query($sql); |
|
@@ -11191,7 +11191,7 @@ discard block |
|
|
block discarded – undo |
11191
|
11191
|
$obj = $this->db->fetch_object($resql); |
11192
|
11192
|
|
11193
|
11193
|
// If translation exists, we use it, otherwise we take the default wording |
11194
|
|
- $label = ($langs->trans("InvoiceSubtype" . $obj->rowid) != "InvoiceSubtype" . $obj->rowid) ? $langs->trans("InvoiceSubtype" . $obj->rowid) : (($obj->label != '-') ? $obj->label : ''); |
|
11194
|
+ $label = ($langs->trans("InvoiceSubtype".$obj->rowid) != "InvoiceSubtype".$obj->rowid) ? $langs->trans("InvoiceSubtype".$obj->rowid) : (($obj->label != '-') ? $obj->label : ''); |
11195
|
11195
|
$this->cache_invoice_subtype[$obj->rowid]['rowid'] = $obj->rowid; |
11196
|
11196
|
$this->cache_invoice_subtype[$obj->rowid]['code'] = $obj->code; |
11197
|
11197
|
$this->cache_invoice_subtype[$obj->rowid]['label'] = $label; |
|
@@ -11223,18 +11223,18 @@ discard block |
|
|
block discarded – undo |
11223
|
11223
|
global $langs, $user; |
11224
|
11224
|
|
11225
|
11225
|
$out = ''; |
11226
|
|
- dol_syslog(__METHOD__ . " selected=" . $selected . ", htmlname=" . $htmlname, LOG_DEBUG); |
|
11226
|
+ dol_syslog(__METHOD__." selected=".$selected.", htmlname=".$htmlname, LOG_DEBUG); |
11227
|
11227
|
|
11228
|
11228
|
$this->load_cache_invoice_subtype(); |
11229
|
11229
|
|
11230
|
|
- $out .= '<select id="' . $htmlname . '" class="flat selectsubtype' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">'; |
|
11230
|
+ $out .= '<select id="'.$htmlname.'" class="flat selectsubtype'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">'; |
11231
|
11231
|
if ($addempty) { |
11232
|
11232
|
$out .= '<option value="0"> </option>'; |
11233
|
11233
|
} |
11234
|
11234
|
|
11235
|
11235
|
foreach ($this->cache_invoice_subtype as $rowid => $subtype) { |
11236
|
11236
|
$label = $subtype['label']; |
11237
|
|
- $out .= '<option value="' . $subtype['rowid'] . '"'; |
|
11237
|
+ $out .= '<option value="'.$subtype['rowid'].'"'; |
11238
|
11238
|
if ($selected == $subtype['rowid']) { |
11239
|
11239
|
$out .= ' selected="selected"'; |
11240
|
11240
|
} |