|
@@ -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 { |
|
@@ -1798,7 +1798,7 @@ discard block |
|
|
block discarded – undo |
1798
|
1798
|
} |
1799
|
1799
|
|
1800
|
1800
|
if (!is_object($hookmanager)) { |
1801
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/class/hookmanager.class.php'; |
|
1801
|
+ include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; |
1802
|
1802
|
$hookmanager = new HookManager($this->db); |
1803
|
1803
|
} |
1804
|
1804
|
|
|
@@ -1807,13 +1807,13 @@ discard block |
|
|
block discarded – undo |
1807
|
1807
|
if ($showsoc > 0 || getDolGlobalString('CONTACT_SHOW_EMAIL_PHONE_TOWN_SELECTLIST')) { |
1808
|
1808
|
$sql .= ", s.nom as company, s.town AS company_town"; |
1809
|
1809
|
} |
1810
|
|
- $sql .= " FROM " . $this->db->prefix() . "socpeople as sp"; |
|
1810
|
+ $sql .= " FROM ".$this->db->prefix()."socpeople as sp"; |
1811
|
1811
|
if ($showsoc > 0 || getDolGlobalString('CONTACT_SHOW_EMAIL_PHONE_TOWN_SELECTLIST')) { |
1812
|
|
- $sql .= " LEFT OUTER JOIN " . $this->db->prefix() . "societe as s ON s.rowid=sp.fk_soc"; |
|
1812
|
+ $sql .= " LEFT OUTER JOIN ".$this->db->prefix()."societe as s ON s.rowid=sp.fk_soc"; |
1813
|
1813
|
} |
1814
|
|
- $sql .= " WHERE sp.entity IN (" . getEntity('contact') . ")"; |
|
1814
|
+ $sql .= " WHERE sp.entity IN (".getEntity('contact').")"; |
1815
|
1815
|
if ($socid > 0 || $socid == -1) { |
1816
|
|
- $sql .= " AND sp.fk_soc = " . ((int) $socid); |
|
1816
|
+ $sql .= " AND sp.fk_soc = ".((int) $socid); |
1817
|
1817
|
} |
1818
|
1818
|
if (getDolGlobalString('CONTACT_HIDE_INACTIVE_IN_COMBOBOX')) { |
1819
|
1819
|
$sql .= " AND sp.statut <> 0"; |
|
@@ -1821,7 +1821,7 @@ discard block |
|
|
block discarded – undo |
1821
|
1821
|
if ($filter) { |
1822
|
1822
|
// $filter is safe because, if it contains '(' or ')', it has been sanitized by testSqlAndScriptInject() and forgeSQLFromUniversalSearchCriteria() |
1823
|
1823
|
// if not, by testSqlAndScriptInject() only. |
1824
|
|
- $sql .= " AND (" . $filter . ")"; |
|
1824
|
+ $sql .= " AND (".$filter.")"; |
1825
|
1825
|
} |
1826
|
1826
|
// Add where from hooks |
1827
|
1827
|
$parameters = array(); |
|
@@ -1829,30 +1829,30 @@ discard block |
|
|
block discarded – undo |
1829
|
1829
|
$sql .= $hookmanager->resPrint; |
1830
|
1830
|
$sql .= " ORDER BY sp.lastname ASC"; |
1831
|
1831
|
|
1832
|
|
- dol_syslog(get_class($this) . "::selectcontacts", LOG_DEBUG); |
|
1832
|
+ dol_syslog(get_class($this)."::selectcontacts", LOG_DEBUG); |
1833
|
1833
|
$resql = $this->db->query($sql); |
1834
|
1834
|
if ($resql) { |
1835
|
1835
|
$num = $this->db->num_rows($resql); |
1836
|
1836
|
|
1837
|
1837
|
if ($htmlname != 'none' && !$options_only) { |
1838
|
|
- $out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" id="' . $htmlid . '" name="' . $htmlname . ($multiple ? '[]' : '') . '" ' . (($num || empty($disableifempty)) ? '' : ' disabled') . ($multiple ? 'multiple' : '') . ' ' . (!empty($moreparam) ? $moreparam : '') . '>'; |
|
1838
|
+ $out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" id="'.$htmlid.'" name="'.$htmlname.($multiple ? '[]' : '').'" '.(($num || empty($disableifempty)) ? '' : ' disabled').($multiple ? 'multiple' : '').' '.(!empty($moreparam) ? $moreparam : '').'>'; |
1839
|
1839
|
} |
1840
|
1840
|
|
1841
|
1841
|
if ($showempty && !is_numeric($showempty)) { |
1842
|
1842
|
$textforempty = $showempty; |
1843
|
|
- $out .= '<option class="optiongrey" value="-1"' . (in_array(-1, $selected) ? ' selected' : '') . '>' . $textforempty . '</option>'; |
|
1843
|
+ $out .= '<option class="optiongrey" value="-1"'.(in_array(-1, $selected) ? ' selected' : '').'>'.$textforempty.'</option>'; |
1844
|
1844
|
} else { |
1845
|
1845
|
if (($showempty == 1 || ($showempty == 3 && $num > 1)) && !$multiple) { |
1846
|
|
- $out .= '<option value="0"' . (in_array(0, $selected) ? ' selected' : '') . '> </option>'; |
|
1846
|
+ $out .= '<option value="0"'.(in_array(0, $selected) ? ' selected' : '').'> </option>'; |
1847
|
1847
|
} |
1848
|
1848
|
if ($showempty == 2) { |
1849
|
|
- $out .= '<option value="0"' . (in_array(0, $selected) ? ' selected' : '') . '>-- ' . $langs->trans("Internal") . ' --</option>'; |
|
1849
|
+ $out .= '<option value="0"'.(in_array(0, $selected) ? ' selected' : '').'>-- '.$langs->trans("Internal").' --</option>'; |
1850
|
1850
|
} |
1851
|
1851
|
} |
1852
|
1852
|
|
1853
|
1853
|
$i = 0; |
1854
|
1854
|
if ($num) { |
1855
|
|
- include_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php'; |
|
1855
|
+ include_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; |
1856
|
1856
|
$contactstatic = new Contact($this->db); |
1857
|
1857
|
|
1858
|
1858
|
while ($i < $num) { |
|
@@ -1888,7 +1888,7 @@ discard block |
|
|
block discarded – undo |
1888
|
1888
|
} |
1889
|
1889
|
$extendedInfos = implode(' - ', $extendedInfos); |
1890
|
1890
|
if (!empty($extendedInfos)) { |
1891
|
|
- $extendedInfos = ' - ' . $extendedInfos; |
|
1891
|
+ $extendedInfos = ' - '.$extendedInfos; |
1892
|
1892
|
} |
1893
|
1893
|
} |
1894
|
1894
|
|
|
@@ -1906,35 +1906,35 @@ discard block |
|
|
block discarded – undo |
1906
|
1906
|
$disabled = 1; |
1907
|
1907
|
} |
1908
|
1908
|
if (!empty($selected) && in_array($obj->rowid, $selected)) { |
1909
|
|
- $out .= '<option value="' . $obj->rowid . '"'; |
|
1909
|
+ $out .= '<option value="'.$obj->rowid.'"'; |
1910
|
1910
|
if ($disabled) { |
1911
|
1911
|
$out .= ' disabled'; |
1912
|
1912
|
} |
1913
|
1913
|
$out .= ' selected>'; |
1914
|
1914
|
|
1915
|
|
- $tmplabel = $contactstatic->getFullName($langs) . $extendedInfos; |
|
1915
|
+ $tmplabel = $contactstatic->getFullName($langs).$extendedInfos; |
1916
|
1916
|
if ($showfunction && $obj->poste) { |
1917
|
|
- $tmplabel .= ' (' . $obj->poste . ')'; |
|
1917
|
+ $tmplabel .= ' ('.$obj->poste.')'; |
1918
|
1918
|
} |
1919
|
1919
|
if (($showsoc > 0) && $obj->company) { |
1920
|
|
- $tmplabel .= ' - (' . $obj->company . ')'; |
|
1920
|
+ $tmplabel .= ' - ('.$obj->company.')'; |
1921
|
1921
|
} |
1922
|
1922
|
|
1923
|
1923
|
$out .= $tmplabel; |
1924
|
1924
|
$out .= '</option>'; |
1925
|
1925
|
} else { |
1926
|
|
- $out .= '<option value="' . $obj->rowid . '"'; |
|
1926
|
+ $out .= '<option value="'.$obj->rowid.'"'; |
1927
|
1927
|
if ($disabled) { |
1928
|
1928
|
$out .= ' disabled'; |
1929
|
1929
|
} |
1930
|
1930
|
$out .= '>'; |
1931
|
1931
|
|
1932
|
|
- $tmplabel = $contactstatic->getFullName($langs) . $extendedInfos; |
|
1932
|
+ $tmplabel = $contactstatic->getFullName($langs).$extendedInfos; |
1933
|
1933
|
if ($showfunction && $obj->poste) { |
1934
|
|
- $tmplabel .= ' (' . $obj->poste . ')'; |
|
1934
|
+ $tmplabel .= ' ('.$obj->poste.')'; |
1935
|
1935
|
} |
1936
|
1936
|
if (($showsoc > 0) && $obj->company) { |
1937
|
|
- $tmplabel .= ' - (' . $obj->company . ')'; |
|
1937
|
+ $tmplabel .= ' - ('.$obj->company.')'; |
1938
|
1938
|
} |
1939
|
1939
|
|
1940
|
1940
|
$out .= $tmplabel; |
|
@@ -1942,12 +1942,12 @@ discard block |
|
|
block discarded – undo |
1942
|
1942
|
} |
1943
|
1943
|
} else { |
1944
|
1944
|
if (in_array($obj->rowid, $selected)) { |
1945
|
|
- $tmplabel = $contactstatic->getFullName($langs) . $extendedInfos; |
|
1945
|
+ $tmplabel = $contactstatic->getFullName($langs).$extendedInfos; |
1946
|
1946
|
if ($showfunction && $obj->poste) { |
1947
|
|
- $tmplabel .= ' (' . $obj->poste . ')'; |
|
1947
|
+ $tmplabel .= ' ('.$obj->poste.')'; |
1948
|
1948
|
} |
1949
|
1949
|
if (($showsoc > 0) && $obj->company) { |
1950
|
|
- $tmplabel .= ' - (' . $obj->company . ')'; |
|
1950
|
+ $tmplabel .= ' - ('.$obj->company.')'; |
1951
|
1951
|
} |
1952
|
1952
|
|
1953
|
1953
|
$out .= $tmplabel; |
|
@@ -1962,7 +1962,7 @@ discard block |
|
|
block discarded – undo |
1962
|
1962
|
} |
1963
|
1963
|
} else { |
1964
|
1964
|
$labeltoshow = ($socid != -1) ? ($langs->trans($socid ? "NoContactDefinedForThirdParty" : "NoContactDefined")) : $langs->trans('SelectAThirdPartyFirst'); |
1965
|
|
- $out .= '<option class="disabled" value="-1"' . (($showempty == 2 || $multiple) ? '' : ' selected') . ' disabled="disabled">'; |
|
1965
|
+ $out .= '<option class="disabled" value="-1"'.(($showempty == 2 || $multiple) ? '' : ' selected').' disabled="disabled">'; |
1966
|
1966
|
$out .= $labeltoshow; |
1967
|
1967
|
$out .= '</option>'; |
1968
|
1968
|
} |
|
@@ -1983,7 +1983,7 @@ discard block |
|
|
block discarded – undo |
1983
|
1983
|
} |
1984
|
1984
|
|
1985
|
1985
|
if ($conf->use_javascript_ajax && !$forcecombo && !$options_only) { |
1986
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
1986
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
1987
|
1987
|
$out .= ajax_combobox($htmlid, $events, getDolGlobalInt("CONTACT_USE_SEARCH_TO_SELECT")); |
1988
|
1988
|
} |
1989
|
1989
|
|
|
@@ -2022,18 +2022,18 @@ discard block |
|
|
block discarded – undo |
2022
|
2022
|
// On recherche les remises |
2023
|
2023
|
$sql = "SELECT re.rowid, re.amount_ht, re.amount_tva, re.amount_ttc,"; |
2024
|
2024
|
$sql .= " re.description, re.fk_facture_source"; |
2025
|
|
- $sql .= " FROM " . $this->db->prefix() . "societe_remise_except as re"; |
2026
|
|
- $sql .= " WHERE re.fk_soc = " . (int) $socid; |
2027
|
|
- $sql .= " AND re.entity = " . $conf->entity; |
|
2025
|
+ $sql .= " FROM ".$this->db->prefix()."societe_remise_except as re"; |
|
2026
|
+ $sql .= " WHERE re.fk_soc = ".(int) $socid; |
|
2027
|
+ $sql .= " AND re.entity = ".$conf->entity; |
2028
|
2028
|
if ($filter) { |
2029
|
|
- $sql .= " AND " . $filter; |
|
2029
|
+ $sql .= " AND ".$filter; |
2030
|
2030
|
} |
2031
|
2031
|
$sql .= " ORDER BY re.description ASC"; |
2032
|
2032
|
|
2033
|
|
- dol_syslog(get_class($this) . "::select_remises", LOG_DEBUG); |
|
2033
|
+ dol_syslog(get_class($this)."::select_remises", LOG_DEBUG); |
2034
|
2034
|
$resql = $this->db->query($sql); |
2035
|
2035
|
if ($resql) { |
2036
|
|
- print '<select id="select_' . $htmlname . '" class="flat maxwidthonsmartphone" name="' . $htmlname . '">'; |
|
2036
|
+ print '<select id="select_'.$htmlname.'" class="flat maxwidthonsmartphone" name="'.$htmlname.'">'; |
2037
|
2037
|
$num = $this->db->num_rows($resql); |
2038
|
2038
|
|
2039
|
2039
|
$qualifiedlines = $num; |
|
@@ -2071,16 +2071,16 @@ discard block |
|
|
block discarded – undo |
2071
|
2071
|
if (getDolGlobalString('MAIN_SHOW_FACNUMBER_IN_DISCOUNT_LIST') && !empty($obj->fk_facture_source)) { |
2072
|
2072
|
$tmpfac = new Facture($this->db); |
2073
|
2073
|
if ($tmpfac->fetch($obj->fk_facture_source) > 0) { |
2074
|
|
- $desc = $desc . ' - ' . $tmpfac->ref; |
|
2074
|
+ $desc = $desc.' - '.$tmpfac->ref; |
2075
|
2075
|
} |
2076
|
2076
|
} |
2077
|
2077
|
|
2078
|
|
- print '<option value="' . $obj->rowid . '"' . $selectstring . $disabled . '>' . $desc . ' (' . price($obj->amount_ht) . ' ' . $langs->trans("HT") . ' - ' . price($obj->amount_ttc) . ' ' . $langs->trans("TTC") . ')</option>'; |
|
2078
|
+ print '<option value="'.$obj->rowid.'"'.$selectstring.$disabled.'>'.$desc.' ('.price($obj->amount_ht).' '.$langs->trans("HT").' - '.price($obj->amount_ttc).' '.$langs->trans("TTC").')</option>'; |
2079
|
2079
|
$i++; |
2080
|
2080
|
} |
2081
|
2081
|
} |
2082
|
2082
|
print '</select>'; |
2083
|
|
- print ajax_combobox('select_' . $htmlname); |
|
2083
|
+ print ajax_combobox('select_'.$htmlname); |
2084
|
2084
|
|
2085
|
2085
|
return $qualifiedlines; |
2086
|
2086
|
} else { |
|
@@ -2189,14 +2189,14 @@ discard block |
|
|
block discarded – undo |
2189
|
2189
|
if ($showlabelofentity) { |
2190
|
2190
|
$sql .= ", e.label"; |
2191
|
2191
|
} |
2192
|
|
- $sql .= " FROM " . $this->db->prefix() . "user as u"; |
|
2192
|
+ $sql .= " FROM ".$this->db->prefix()."user as u"; |
2193
|
2193
|
if ($showlabelofentity) { |
2194
|
|
- $sql .= " LEFT JOIN " . $this->db->prefix() . "entity as e ON e.rowid = u.entity"; |
|
2194
|
+ $sql .= " LEFT JOIN ".$this->db->prefix()."entity as e ON e.rowid = u.entity"; |
2195
|
2195
|
} |
2196
|
2196
|
// Condition here should be the same than into societe->getSalesRepresentatives(). |
2197
|
2197
|
if ($userissuperadminentityone && $force_entity != 'default') { |
2198
|
2198
|
if (!empty($force_entity)) { |
2199
|
|
- $sql .= " WHERE u.entity IN (0, " . $this->db->sanitize($force_entity) . ")"; |
|
2199
|
+ $sql .= " WHERE u.entity IN (0, ".$this->db->sanitize($force_entity).")"; |
2200
|
2200
|
} else { |
2201
|
2201
|
$sql .= " WHERE u.entity IS NOT NULL"; |
2202
|
2202
|
} |
|
@@ -2204,18 +2204,18 @@ discard block |
|
|
block discarded – undo |
2204
|
2204
|
if (isModEnabled('multicompany') && getDolGlobalInt('MULTICOMPANY_TRANSVERSE_MODE')) { |
2205
|
2205
|
$sql .= " WHERE u.rowid IN (SELECT ug.fk_user FROM ".$this->db->prefix()."usergroup_user as ug WHERE ug.entity IN (".getEntity('usergroup')."))"; |
2206
|
2206
|
} else { |
2207
|
|
- $sql .= " WHERE u.entity IN (" . getEntity('user') . ")"; |
|
2207
|
+ $sql .= " WHERE u.entity IN (".getEntity('user').")"; |
2208
|
2208
|
} |
2209
|
2209
|
} |
2210
|
2210
|
|
2211
|
2211
|
if (!empty($user->socid)) { |
2212
|
|
- $sql .= " AND u.fk_soc = " . ((int) $user->socid); |
|
2212
|
+ $sql .= " AND u.fk_soc = ".((int) $user->socid); |
2213
|
2213
|
} |
2214
|
2214
|
if (is_array($exclude) && $excludeUsers) { |
2215
|
|
- $sql .= " AND u.rowid NOT IN (" . $this->db->sanitize($excludeUsers) . ")"; |
|
2215
|
+ $sql .= " AND u.rowid NOT IN (".$this->db->sanitize($excludeUsers).")"; |
2216
|
2216
|
} |
2217
|
2217
|
if ($includeUsers) { |
2218
|
|
- $sql .= " AND u.rowid IN (" . $this->db->sanitize($includeUsers) . ")"; |
|
2218
|
+ $sql .= " AND u.rowid IN (".$this->db->sanitize($includeUsers).")"; |
2219
|
2219
|
} |
2220
|
2220
|
if (getDolGlobalString('USER_HIDE_INACTIVE_IN_COMBOBOX') || $notdisabled) { |
2221
|
2221
|
$sql .= " AND u.statut <> 0"; |
|
@@ -2227,7 +2227,7 @@ discard block |
|
|
block discarded – undo |
2227
|
2227
|
$sql .= " AND u.fk_soc IS NULL"; |
2228
|
2228
|
} |
2229
|
2229
|
if (!empty($morefilter)) { |
2230
|
|
- $sql .= " " . $morefilter; |
|
2230
|
+ $sql .= " ".$morefilter; |
2231
|
2231
|
} |
2232
|
2232
|
|
2233
|
2233
|
//Add hook to filter on user (for example on usergroup define in custom modules) |
|
@@ -2242,7 +2242,7 @@ discard block |
|
|
block discarded – undo |
2242
|
2242
|
$sql .= " ORDER BY u.statut DESC, u.lastname ASC, u.firstname ASC"; |
2243
|
2243
|
} |
2244
|
2244
|
|
2245
|
|
- dol_syslog(get_class($this) . "::select_dolusers", LOG_DEBUG); |
|
2245
|
+ dol_syslog(get_class($this)."::select_dolusers", LOG_DEBUG); |
2246
|
2246
|
|
2247
|
2247
|
$resql = $this->db->query($sql); |
2248
|
2248
|
if ($resql) { |
|
@@ -2250,7 +2250,7 @@ discard block |
|
|
block discarded – undo |
2250
|
2250
|
$i = 0; |
2251
|
2251
|
if ($num) { |
2252
|
2252
|
// do not use maxwidthonsmartphone by default. Set it by caller so auto size to 100% will work when not defined |
2253
|
|
- $out .= '<select class="flat' . ($morecss ? ' ' . $morecss : ' minwidth200') . '" id="' . $htmlname . '" name="' . $htmlname . ($multiple ? '[]' : '') . '" ' . ($multiple ? 'multiple' : '') . ' ' . ($disabled ? ' disabled' : '') . '>'; |
|
2253
|
+ $out .= '<select class="flat'.($morecss ? ' '.$morecss : ' minwidth200').'" id="'.$htmlname.'" name="'.$htmlname.($multiple ? '[]' : '').'" '.($multiple ? 'multiple' : '').' '.($disabled ? ' disabled' : '').'>'; |
2254
|
2254
|
if ($show_empty && !$multiple) { |
2255
|
2255
|
$textforempty = ' '; |
2256
|
2256
|
if (!empty($conf->use_javascript_ajax)) { |
|
@@ -2259,10 +2259,10 @@ discard block |
|
|
block discarded – undo |
2259
|
2259
|
if (!is_numeric($show_empty)) { |
2260
|
2260
|
$textforempty = $show_empty; |
2261
|
2261
|
} |
2262
|
|
- $out .= '<option class="optiongrey" value="' . ($show_empty < 0 ? $show_empty : -1) . '"' . ((empty($selected) || in_array(-1, $selected)) ? ' selected' : '') . '>' . $textforempty . '</option>' . "\n"; |
|
2262
|
+ $out .= '<option class="optiongrey" value="'.($show_empty < 0 ? $show_empty : -1).'"'.((empty($selected) || in_array(-1, $selected)) ? ' selected' : '').'>'.$textforempty.'</option>'."\n"; |
2263
|
2263
|
} |
2264
|
2264
|
if ($show_every) { |
2265
|
|
- $out .= '<option value="-2"' . ((in_array(-2, $selected)) ? ' selected' : '') . '>-- ' . $langs->trans("Everybody") . ' --</option>' . "\n"; |
|
2265
|
+ $out .= '<option value="-2"'.((in_array(-2, $selected)) ? ' selected' : '').'>-- '.$langs->trans("Everybody").' --</option>'."\n"; |
2266
|
2266
|
} |
2267
|
2267
|
|
2268
|
2268
|
$userstatic = new User($this->db); |
|
@@ -2310,21 +2310,21 @@ discard block |
|
|
block discarded – undo |
2310
|
2310
|
} |
2311
|
2311
|
if ($showstatus >= 0) { |
2312
|
2312
|
if ($obj->status == 1 && $showstatus == 1) { |
2313
|
|
- $moreinfo .= ($moreinfo ? ' - ' : ' (') . $langs->trans('Enabled'); |
2314
|
|
- $moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(') . $langs->trans('Enabled'); |
|
2313
|
+ $moreinfo .= ($moreinfo ? ' - ' : ' (').$langs->trans('Enabled'); |
|
2314
|
+ $moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(').$langs->trans('Enabled'); |
2315
|
2315
|
} |
2316
|
2316
|
if ($obj->status == 0 && $showstatus == 1) { |
2317
|
|
- $moreinfo .= ($moreinfo ? ' - ' : ' (') . $langs->trans('Disabled'); |
2318
|
|
- $moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(') . $langs->trans('Disabled'); |
|
2317
|
+ $moreinfo .= ($moreinfo ? ' - ' : ' (').$langs->trans('Disabled'); |
|
2318
|
+ $moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(').$langs->trans('Disabled'); |
2319
|
2319
|
} |
2320
|
2320
|
} |
2321
|
2321
|
if ($showlabelofentity) { |
2322
|
2322
|
if (empty($obj->entity)) { |
2323
|
|
- $moreinfo .= ($moreinfo ? ' - ' : ' (') . $langs->trans("AllEntities"); |
2324
|
|
- $moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(') . $langs->trans("AllEntities"); |
|
2323
|
+ $moreinfo .= ($moreinfo ? ' - ' : ' (').$langs->trans("AllEntities"); |
|
2324
|
+ $moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(').$langs->trans("AllEntities"); |
2325
|
2325
|
} else { |
2326
|
2326
|
if ($obj->entity != $conf->entity) { |
2327
|
|
- $moreinfo .= ($moreinfo ? ' - ' : ' (') . ($obj->label ? $obj->label : $langs->trans("EntityNameNotDefined")); |
|
2327
|
+ $moreinfo .= ($moreinfo ? ' - ' : ' (').($obj->label ? $obj->label : $langs->trans("EntityNameNotDefined")); |
2328
|
2328
|
$moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(').($obj->label ? $obj->label : $langs->trans("EntityNameNotDefined")); |
2329
|
2329
|
} |
2330
|
2330
|
} |
|
@@ -2333,13 +2333,13 @@ discard block |
|
|
block discarded – undo |
2333
|
2333
|
$moreinfohtml .= (!empty($moreinfohtml) ? ')</span>' : ''); |
2334
|
2334
|
if (!empty($disableline) && $disableline != '1') { |
2335
|
2335
|
// Add text from $enableonlytext parameter |
2336
|
|
- $moreinfo .= ' - ' . $disableline; |
2337
|
|
- $moreinfohtml .= ' - ' . $disableline; |
|
2336
|
+ $moreinfo .= ' - '.$disableline; |
|
2337
|
+ $moreinfohtml .= ' - '.$disableline; |
2338
|
2338
|
} |
2339
|
2339
|
$labeltoshow .= $moreinfo; |
2340
|
2340
|
$labeltoshowhtml .= $moreinfohtml; |
2341
|
2341
|
|
2342
|
|
- $out .= '<option value="' . $obj->rowid . '"'; |
|
2342
|
+ $out .= '<option value="'.$obj->rowid.'"'; |
2343
|
2343
|
if (!empty($disableline)) { |
2344
|
2344
|
$out .= ' disabled'; |
2345
|
2345
|
} |
|
@@ -2348,7 +2348,7 @@ discard block |
|
|
block discarded – undo |
2348
|
2348
|
} |
2349
|
2349
|
$out .= ' data-html="'; |
2350
|
2350
|
|
2351
|
|
- $outhtml = $userstatic->getNomUrl(-3, '', 0, 1, 24, 1, 'login', '', 1) . ' '; |
|
2351
|
+ $outhtml = $userstatic->getNomUrl(-3, '', 0, 1, 24, 1, 'login', '', 1).' '; |
2352
|
2352
|
if ($showstatus >= 0 && $obj->status == 0) { |
2353
|
2353
|
$outhtml .= '<strike class="opacitymediumxxx">'; |
2354
|
2354
|
} |
|
@@ -2363,7 +2363,7 @@ discard block |
|
|
block discarded – undo |
2363
|
2363
|
$out .= $labeltoshow; |
2364
|
2364
|
$out .= '</option>'; |
2365
|
2365
|
|
2366
|
|
- $outarray[$userstatic->id] = $userstatic->getFullName($langs, $fullNameMode, -1, $maxlength) . $moreinfo; |
|
2366
|
+ $outarray[$userstatic->id] = $userstatic->getFullName($langs, $fullNameMode, -1, $maxlength).$moreinfo; |
2367
|
2367
|
$outarray2[$userstatic->id] = array( |
2368
|
2368
|
'id' => $userstatic->id, |
2369
|
2369
|
'label' => $labeltoshow, |
|
@@ -2375,14 +2375,14 @@ discard block |
|
|
block discarded – undo |
2375
|
2375
|
$i++; |
2376
|
2376
|
} |
2377
|
2377
|
} else { |
2378
|
|
- $out .= '<select class="flat" id="' . $htmlname . '" name="' . $htmlname . '" disabled>'; |
2379
|
|
- $out .= '<option value="">' . $langs->trans("None") . '</option>'; |
|
2378
|
+ $out .= '<select class="flat" id="'.$htmlname.'" name="'.$htmlname.'" disabled>'; |
|
2379
|
+ $out .= '<option value="">'.$langs->trans("None").'</option>'; |
2380
|
2380
|
} |
2381
|
2381
|
$out .= '</select>'; |
2382
|
2382
|
|
2383
|
2383
|
if ($num && !$forcecombo) { |
2384
|
2384
|
// Enhance with select2 |
2385
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
2385
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
2386
|
2386
|
$out .= ajax_combobox($htmlname); |
2387
|
2387
|
} |
2388
|
2388
|
} else { |
|
@@ -2458,16 +2458,16 @@ discard block |
|
|
block discarded – undo |
2458
|
2458
|
$out .= $userstatic->getNomUrl(-1); |
2459
|
2459
|
if ($i == 0) { |
2460
|
2460
|
$ownerid = $value['id']; |
2461
|
|
- $out .= ' (' . $langs->trans("Owner") . ')'; |
|
2461
|
+ $out .= ' ('.$langs->trans("Owner").')'; |
2462
|
2462
|
} |
2463
|
2463
|
if ($nbassignetouser > 1 && $action != 'view') { |
2464
|
|
- $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 . '">'; |
|
2464
|
+ $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
|
2465
|
} |
2466
|
2466
|
// Show my availability |
2467
|
2467
|
if ($showproperties) { |
2468
|
2468
|
if ($ownerid == $value['id'] && is_array($listofuserid) && count($listofuserid) && in_array($ownerid, array_keys($listofuserid))) { |
2469
|
2469
|
$out .= '<div class="myavailability inline-block">'; |
2470
|
|
- $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>'; |
|
2470
|
+ $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
|
2471
|
$out .= '</div>'; |
2472
|
2472
|
} |
2473
|
2473
|
} |
|
@@ -2484,15 +2484,15 @@ discard block |
|
|
block discarded – undo |
2484
|
2484
|
// Method with no ajax |
2485
|
2485
|
if ($action != 'view') { |
2486
|
2486
|
$out .= '<input type="hidden" class="removedassignedhidden" name="removedassigned" value="">'; |
2487
|
|
- $out .= '<script nonce="' . getNonce() . '" type="text/javascript">jQuery(document).ready(function () {'; |
|
2487
|
+ $out .= '<script nonce="'.getNonce().'" type="text/javascript">jQuery(document).ready(function () {'; |
2488
|
2488
|
$out .= 'jQuery(".removedassigned").click(function() { jQuery(".removedassignedhidden").val(jQuery(this).val()); });'; |
2489
|
2489
|
$out .= 'jQuery(".assignedtouser").change(function() { console.log(jQuery(".assignedtouser option:selected").val());'; |
2490
|
|
- $out .= ' if (jQuery(".assignedtouser option:selected").val() > 0) { jQuery("#' . $action . 'assignedtouser").attr("disabled", false); }'; |
2491
|
|
- $out .= ' else { jQuery("#' . $action . 'assignedtouser").attr("disabled", true); }'; |
|
2490
|
+ $out .= ' if (jQuery(".assignedtouser option:selected").val() > 0) { jQuery("#'.$action.'assignedtouser").attr("disabled", false); }'; |
|
2491
|
+ $out .= ' else { jQuery("#'.$action.'assignedtouser").attr("disabled", true); }'; |
2492
|
2492
|
$out .= '});'; |
2493
|
2493
|
$out .= '})</script>'; |
2494
|
2494
|
$out .= $this->select_dolusers('', $htmlname, $show_empty, $exclude, $disabled, $include, $enableonly, $force_entity, $maxlength, $showstatus, $morefilter); |
2495
|
|
- $out .= ' <input type="submit" disabled class="button valignmiddle smallpaddingimp reposition" id="' . $action . 'assignedtouser" name="' . $action . 'assignedtouser" value="' . dol_escape_htmltag($langs->trans("Add")) . '">'; |
|
2495
|
+ $out .= ' <input type="submit" disabled class="button valignmiddle smallpaddingimp reposition" id="'.$action.'assignedtouser" name="'.$action.'assignedtouser" value="'.dol_escape_htmltag($langs->trans("Add")).'">'; |
2496
|
2496
|
$out .= '<br>'; |
2497
|
2497
|
} |
2498
|
2498
|
|
|
@@ -2551,13 +2551,13 @@ discard block |
|
|
block discarded – undo |
2551
|
2551
|
$resourcestatic->fetch($value['id']); |
2552
|
2552
|
$out .= $resourcestatic->getNomUrl(-1); |
2553
|
2553
|
if ($nbassignetoresource > 1 && $action != 'view') { |
2554
|
|
- $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 . '">'; |
|
2554
|
+ $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
|
2555
|
} |
2556
|
2556
|
// Show my availability |
2557
|
2557
|
if ($showproperties) { |
2558
|
2558
|
if (is_array($listofresourceid) && count($listofresourceid)) { |
2559
|
2559
|
$out .= '<div class="myavailability inline-block">'; |
2560
|
|
- $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>'; |
|
2560
|
+ $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
|
2561
|
$out .= '</div>'; |
2562
|
2562
|
} |
2563
|
2563
|
} |
|
@@ -2574,11 +2574,11 @@ discard block |
|
|
block discarded – undo |
2574
|
2574
|
// Method with no ajax |
2575
|
2575
|
if ($action != 'view') { |
2576
|
2576
|
$out .= '<input type="hidden" class="removedassignedhidden" name="removedassignedresource" value="">'; |
2577
|
|
- $out .= '<script nonce="' . getNonce() . '" type="text/javascript">jQuery(document).ready(function () {'; |
|
2577
|
+ $out .= '<script nonce="'.getNonce().'" type="text/javascript">jQuery(document).ready(function () {'; |
2578
|
2578
|
$out .= 'jQuery(".removedassignedresource").click(function() { jQuery(".removedassignedresourcehidden").val(jQuery(this).val()); });'; |
2579
|
2579
|
$out .= 'jQuery(".assignedtoresource").change(function() { console.log(jQuery(".assignedtoresource option:selected").val());'; |
2580
|
|
- $out .= ' if (jQuery(".assignedtoresource option:selected").val() > 0) { jQuery("#' . $action . 'assignedtoresource").attr("disabled", false); }'; |
2581
|
|
- $out .= ' else { jQuery("#' . $action . 'assignedtoresource").attr("disabled", true); }'; |
|
2580
|
+ $out .= ' if (jQuery(".assignedtoresource option:selected").val() > 0) { jQuery("#'.$action.'assignedtoresource").attr("disabled", false); }'; |
|
2581
|
+ $out .= ' else { jQuery("#'.$action.'assignedtoresource").attr("disabled", true); }'; |
2582
|
2582
|
$out .= '});'; |
2583
|
2583
|
$out .= '})</script>'; |
2584
|
2584
|
|
|
@@ -2586,7 +2586,7 @@ discard block |
|
|
block discarded – undo |
2586
|
2586
|
$out .= img_picto('', 'resource', 'class="pictofixedwidth"'); |
2587
|
2587
|
$out .= $formresources->select_resource_list(0, $htmlname, [], 1, 1, 0, $events, array(), 2, 0); |
2588
|
2588
|
//$out .= $this->select_dolusers('', $htmlname, $show_empty, $exclude, $disabled, $include, $enableonly, $force_entity, $maxlength, $showstatus, $morefilter); |
2589
|
|
- $out .= ' <input type="submit" disabled class="button valignmiddle smallpaddingimp reposition" id="' . $action . 'assignedtoresource" name="' . $action . 'assignedtoresource" value="' . dol_escape_htmltag($langs->trans("Add")) . '">'; |
|
2589
|
+ $out .= ' <input type="submit" disabled class="button valignmiddle smallpaddingimp reposition" id="'.$action.'assignedtoresource" name="'.$action.'assignedtoresource" value="'.dol_escape_htmltag($langs->trans("Add")).'">'; |
2590
|
2590
|
$out .= '<br>'; |
2591
|
2591
|
} |
2592
|
2592
|
|
|
@@ -2648,7 +2648,7 @@ discard block |
|
|
block discarded – undo |
2648
|
2648
|
$placeholder = ''; |
2649
|
2649
|
|
2650
|
2650
|
if ($selected && empty($selected_input_value)) { |
2651
|
|
- require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; |
|
2651
|
+ require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; |
2652
|
2652
|
$producttmpselect = new Product($this->db); |
2653
|
2653
|
$producttmpselect->fetch($selected); |
2654
|
2654
|
$selected_input_value = $producttmpselect->ref; |
|
@@ -2663,17 +2663,17 @@ discard block |
|
|
block discarded – undo |
2663
|
2663
|
} |
2664
|
2664
|
} |
2665
|
2665
|
// mode=1 means customers products |
2666
|
|
- $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; |
2667
|
|
- $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/product/ajax/products.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions); |
|
2666
|
+ $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; |
|
2667
|
+ $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/product/ajax/products.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions); |
2668
|
2668
|
|
2669
|
2669
|
if (isModEnabled('variants') && is_array($selected_combinations)) { |
2670
|
2670
|
// Code to automatically insert with javascript the select of attributes under the select of product |
2671
|
2671
|
// when a parent of variant has been selected. |
2672
|
2672
|
$out .= ' |
2673
|
2673
|
<!-- script to auto show attributes select tags if a variant was selected --> |
2674
|
|
- <script nonce="' . getNonce() . '"> |
|
2674
|
+ <script nonce="' . getNonce().'"> |
2675
|
2675
|
// auto show attributes fields |
2676
|
|
- selected = ' . json_encode($selected_combinations) . '; |
|
2676
|
+ selected = ' . json_encode($selected_combinations).'; |
2677
|
2677
|
combvalues = {}; |
2678
|
2678
|
|
2679
|
2679
|
jQuery(document).ready(function () { |
|
@@ -2684,7 +2684,7 @@ discard block |
|
|
block discarded – undo |
2684
|
2684
|
} |
2685
|
2685
|
}); |
2686
|
2686
|
|
2687
|
|
- jQuery("input#' . $htmlname . '").change(function () { |
|
2687
|
+ jQuery("input#' . $htmlname.'").change(function () { |
2688
|
2688
|
|
2689
|
2689
|
if (!jQuery(this).val()) { |
2690
|
2690
|
jQuery(\'div#attributes_box\').empty(); |
|
@@ -2693,7 +2693,7 @@ discard block |
|
|
block discarded – undo |
2693
|
2693
|
|
2694
|
2694
|
console.log("A change has started. We get variants fields to inject html select"); |
2695
|
2695
|
|
2696
|
|
- jQuery.getJSON("' . DOL_URL_ROOT . '/variants/ajax/getCombinations.php", { |
|
2696
|
+ jQuery.getJSON("' . DOL_URL_ROOT.'/variants/ajax/getCombinations.php", { |
2697
|
2697
|
id: jQuery(this).val() |
2698
|
2698
|
}, function (data) { |
2699
|
2699
|
jQuery(\'div#attributes_box\').empty(); |
|
@@ -2736,21 +2736,21 @@ discard block |
|
|
block discarded – undo |
2736
|
2736
|
}) |
2737
|
2737
|
}); |
2738
|
2738
|
|
2739
|
|
- ' . ($selected ? 'jQuery("input#' . $htmlname . '").change();' : '') . ' |
|
2739
|
+ ' . ($selected ? 'jQuery("input#'.$htmlname.'").change();' : '').' |
2740
|
2740
|
}); |
2741
|
2741
|
</script> |
2742
|
2742
|
'; |
2743
|
2743
|
} |
2744
|
2744
|
|
2745
|
2745
|
if (empty($hidelabel)) { |
2746
|
|
- $out .= $langs->trans("RefOrLabel") . ' : '; |
|
2746
|
+ $out .= $langs->trans("RefOrLabel").' : '; |
2747
|
2747
|
} elseif ($hidelabel > 1) { |
2748
|
|
- $placeholder = ' placeholder="' . $langs->trans("RefOrLabel") . '"'; |
|
2748
|
+ $placeholder = ' placeholder="'.$langs->trans("RefOrLabel").'"'; |
2749
|
2749
|
if ($hidelabel == 2) { |
2750
|
2750
|
$out .= img_picto($langs->trans("Search"), 'search'); |
2751
|
2751
|
} |
2752
|
2752
|
} |
2753
|
|
- $out .= '<input type="text" class="minwidth100' . ($morecss ? ' ' . $morecss : '') . '" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . $placeholder . ' ' . (getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '') . ' />'; |
|
2753
|
+ $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
|
2754
|
if ($hidelabel == 3) { |
2755
|
2755
|
$out .= img_picto($langs->trans("Search"), 'search'); |
2756
|
2756
|
} |
|
@@ -2787,33 +2787,33 @@ discard block |
|
|
block discarded – undo |
2787
|
2787
|
// phpcs:enable |
2788
|
2788
|
global $db; |
2789
|
2789
|
|
2790
|
|
- require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; |
|
2790
|
+ require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; |
2791
|
2791
|
|
2792
|
2792
|
$error = 0; |
2793
|
2793
|
$out = ''; |
2794
|
2794
|
|
2795
|
2795
|
if (!$forcecombo) { |
2796
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
2796
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
2797
|
2797
|
$events = array(); |
2798
|
2798
|
$out .= ajax_combobox($htmlname, $events, getDolGlobalInt("PRODUIT_USE_SEARCH_TO_SELECT")); |
2799
|
2799
|
} |
2800
|
2800
|
|
2801
|
|
- $out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">'; |
|
2801
|
+ $out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">'; |
2802
|
2802
|
|
2803
|
2803
|
$sql = 'SELECT b.rowid, b.ref, b.label, b.fk_product'; |
2804
|
|
- $sql .= ' FROM ' . MAIN_DB_PREFIX . 'bom_bom as b'; |
2805
|
|
- $sql .= ' WHERE b.entity IN (' . getEntity('bom') . ')'; |
|
2804
|
+ $sql .= ' FROM '.MAIN_DB_PREFIX.'bom_bom as b'; |
|
2805
|
+ $sql .= ' WHERE b.entity IN ('.getEntity('bom').')'; |
2806
|
2806
|
if (!empty($status)) { |
2807
|
|
- $sql .= ' AND status = ' . (int) $status; |
|
2807
|
+ $sql .= ' AND status = '.(int) $status; |
2808
|
2808
|
} |
2809
|
2809
|
if (!empty($type)) { |
2810
|
|
- $sql .= ' AND bomtype = ' . (int) $type; |
|
2810
|
+ $sql .= ' AND bomtype = '.(int) $type; |
2811
|
2811
|
} |
2812
|
2812
|
if (!empty($TProducts)) { |
2813
|
|
- $sql .= ' AND fk_product IN (' . $this->db->sanitize(implode(',', $TProducts)) . ')'; |
|
2813
|
+ $sql .= ' AND fk_product IN ('.$this->db->sanitize(implode(',', $TProducts)).')'; |
2814
|
2814
|
} |
2815
|
2815
|
if (!empty($limit)) { |
2816
|
|
- $sql .= ' LIMIT ' . (int) $limit; |
|
2816
|
+ $sql .= ' LIMIT '.(int) $limit; |
2817
|
2817
|
} |
2818
|
2818
|
$resql = $db->query($sql); |
2819
|
2819
|
if ($resql) { |
|
@@ -2827,11 +2827,11 @@ discard block |
|
|
block discarded – undo |
2827
|
2827
|
while ($obj = $db->fetch_object($resql)) { |
2828
|
2828
|
$product = new Product($db); |
2829
|
2829
|
$res = $product->fetch($obj->fk_product); |
2830
|
|
- $out .= '<option value="' . $obj->rowid . '"'; |
|
2830
|
+ $out .= '<option value="'.$obj->rowid.'"'; |
2831
|
2831
|
if ($obj->rowid == $selected) { |
2832
|
2832
|
$out .= 'selected'; |
2833
|
2833
|
} |
2834
|
|
- $out .= '>' . $obj->ref . ' - ' . $product->label . ' - ' . $obj->label . '</option>'; |
|
2834
|
+ $out .= '>'.$obj->ref.' - '.$product->label.' - '.$obj->label.'</option>'; |
2835
|
2835
|
} |
2836
|
2836
|
} else { |
2837
|
2837
|
$error++; |
|
@@ -2888,7 +2888,7 @@ discard block |
|
|
block discarded – undo |
2888
|
2888
|
|
2889
|
2889
|
$warehouseStatusArray = array(); |
2890
|
2890
|
if (!empty($warehouseStatus)) { |
2891
|
|
- require_once DOL_DOCUMENT_ROOT . '/product/stock/class/entrepot.class.php'; |
|
2891
|
+ require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php'; |
2892
|
2892
|
if (preg_match('/warehouseclosed/', $warehouseStatus)) { |
2893
|
2893
|
$warehouseStatusArray[] = Entrepot::STATUS_CLOSED; |
2894
|
2894
|
} |
|
@@ -2902,9 +2902,9 @@ discard block |
|
|
block discarded – undo |
2902
|
2902
|
|
2903
|
2903
|
$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"; |
2904
|
2904
|
if (count($warehouseStatusArray)) { |
2905
|
|
- $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 |
|
2905
|
+ $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
|
2906
|
} else { |
2907
|
|
- $selectFieldsGrouped = ", " . $this->db->ifsql("p.stock IS NULL", 0, "p.stock") . " AS stock"; |
|
2907
|
+ $selectFieldsGrouped = ", ".$this->db->ifsql("p.stock IS NULL", 0, "p.stock")." AS stock"; |
2908
|
2908
|
} |
2909
|
2909
|
|
2910
|
2910
|
$sql = "SELECT "; |
|
@@ -2920,9 +2920,9 @@ discard block |
|
|
block discarded – undo |
2920
|
2920
|
|
2921
|
2921
|
if (getDolGlobalString('PRODUCT_SORT_BY_CATEGORY')) { |
2922
|
2922
|
//Product category |
2923
|
|
- $sql .= ", (SELECT " . $this->db->prefix() . "categorie_product.fk_categorie |
2924
|
|
- FROM " . $this->db->prefix() . "categorie_product |
2925
|
|
- WHERE " . $this->db->prefix() . "categorie_product.fk_product=p.rowid |
|
2923
|
+ $sql .= ", (SELECT ".$this->db->prefix()."categorie_product.fk_categorie |
|
2924
|
+ FROM " . $this->db->prefix()."categorie_product |
|
2925
|
+ WHERE " . $this->db->prefix()."categorie_product.fk_product=p.rowid |
2926
|
2926
|
LIMIT 1 |
2927
|
2927
|
) AS categorie_product_id "; |
2928
|
2928
|
} |
|
@@ -2948,15 +2948,15 @@ discard block |
|
|
block discarded – undo |
2948
|
2948
|
} |
2949
|
2949
|
// Price by quantity |
2950
|
2950
|
if (getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES')) { |
2951
|
|
- $sql .= ", (SELECT pp.rowid FROM " . $this->db->prefix() . "product_price as pp WHERE pp.fk_product = p.rowid"; |
|
2951
|
+ $sql .= ", (SELECT pp.rowid FROM ".$this->db->prefix()."product_price as pp WHERE pp.fk_product = p.rowid"; |
2952
|
2952
|
if ($price_level >= 1 && getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES')) { |
2953
|
|
- $sql .= " AND price_level = " . ((int) $price_level); |
|
2953
|
+ $sql .= " AND price_level = ".((int) $price_level); |
2954
|
2954
|
} |
2955
|
2955
|
$sql .= " ORDER BY date_price"; |
2956
|
2956
|
$sql .= " DESC LIMIT 1) as price_rowid"; |
2957
|
|
- $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 |
|
2957
|
+ $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
|
2958
|
if ($price_level >= 1 && getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES')) { |
2959
|
|
- $sql .= " AND price_level = " . ((int) $price_level); |
|
2959
|
+ $sql .= " AND price_level = ".((int) $price_level); |
2960
|
2960
|
} |
2961
|
2961
|
$sql .= " ORDER BY date_price"; |
2962
|
2962
|
$sql .= " DESC LIMIT 1) as price_by_qty"; |
|
@@ -2966,7 +2966,7 @@ discard block |
|
|
block discarded – undo |
2966
|
2966
|
$sql .= " FROM ".$this->db->prefix()."product as p"; |
2967
|
2967
|
|
2968
|
2968
|
if (getDolGlobalString('MAIN_SEARCH_PRODUCT_FORCE_INDEX')) { |
2969
|
|
- $sql .= " USE INDEX (" . $this->db->sanitize(getDolGlobalString('MAIN_PRODUCT_FORCE_INDEX')) . ")"; |
|
2969
|
+ $sql .= " USE INDEX (".$this->db->sanitize(getDolGlobalString('MAIN_PRODUCT_FORCE_INDEX')).")"; |
2970
|
2970
|
} |
2971
|
2971
|
|
2972
|
2972
|
// Add from (left join) from hooks |
|
@@ -2975,53 +2975,53 @@ discard block |
|
|
block discarded – undo |
2975
|
2975
|
$sql .= $hookmanager->resPrint; |
2976
|
2976
|
|
2977
|
2977
|
if (count($warehouseStatusArray)) { |
2978
|
|
- $sql .= " LEFT JOIN " . $this->db->prefix() . "product_stock as ps on ps.fk_product = p.rowid"; |
2979
|
|
- $sql .= " LEFT JOIN " . $this->db->prefix() . "entrepot as e on ps.fk_entrepot = e.rowid AND e.entity IN (" . getEntity('stock') . ")"; |
2980
|
|
- $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. |
|
2978
|
+ $sql .= " LEFT JOIN ".$this->db->prefix()."product_stock as ps on ps.fk_product = p.rowid"; |
|
2979
|
+ $sql .= " LEFT JOIN ".$this->db->prefix()."entrepot as e on ps.fk_entrepot = e.rowid AND e.entity IN (".getEntity('stock').")"; |
|
2980
|
+ $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. |
2981
|
2981
|
} |
2982
|
2982
|
|
2983
|
2983
|
// include search in supplier ref |
2984
|
2984
|
if (getDolGlobalString('MAIN_SEARCH_PRODUCT_BY_FOURN_REF')) { |
2985
|
|
- $sql .= " LEFT JOIN " . $this->db->prefix() . "product_fournisseur_price as pfp ON p.rowid = pfp.fk_product"; |
|
2985
|
+ $sql .= " LEFT JOIN ".$this->db->prefix()."product_fournisseur_price as pfp ON p.rowid = pfp.fk_product"; |
2986
|
2986
|
} |
2987
|
2987
|
|
2988
|
2988
|
//Price by customer |
2989
|
2989
|
if (getDolGlobalString('PRODUIT_CUSTOMER_PRICES') && !empty($socid)) { |
2990
|
|
- $sql .= " LEFT JOIN " . $this->db->prefix() . "product_customer_price as pcp ON pcp.fk_soc=" . ((int) $socid) . " AND pcp.fk_product=p.rowid"; |
|
2990
|
+ $sql .= " LEFT JOIN ".$this->db->prefix()."product_customer_price as pcp ON pcp.fk_soc=".((int) $socid)." AND pcp.fk_product=p.rowid"; |
2991
|
2991
|
} |
2992
|
2992
|
// Units |
2993
|
2993
|
if (getDolGlobalInt('PRODUCT_USE_UNITS')) { |
2994
|
|
- $sql .= " LEFT JOIN " . $this->db->prefix() . "c_units u ON u.rowid = p.fk_unit"; |
|
2994
|
+ $sql .= " LEFT JOIN ".$this->db->prefix()."c_units u ON u.rowid = p.fk_unit"; |
2995
|
2995
|
} |
2996
|
2996
|
// Multilang : we add translation |
2997
|
2997
|
if (getDolGlobalInt('MAIN_MULTILANGS')) { |
2998
|
|
- $sql .= " LEFT JOIN " . $this->db->prefix() . "product_lang as pl ON pl.fk_product = p.rowid "; |
|
2998
|
+ $sql .= " LEFT JOIN ".$this->db->prefix()."product_lang as pl ON pl.fk_product = p.rowid "; |
2999
|
2999
|
if (getDolGlobalString('PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE') && !empty($socid)) { |
3000
|
|
- require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; |
|
3000
|
+ require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; |
3001
|
3001
|
$soc = new Societe($this->db); |
3002
|
3002
|
$result = $soc->fetch($socid); |
3003
|
3003
|
if ($result > 0 && !empty($soc->default_lang)) { |
3004
|
|
- $sql .= " AND pl.lang = '" . $this->db->escape($soc->default_lang) . "'"; |
|
3004
|
+ $sql .= " AND pl.lang = '".$this->db->escape($soc->default_lang)."'"; |
3005
|
3005
|
} else { |
3006
|
|
- $sql .= " AND pl.lang = '" . $this->db->escape($langs->getDefaultLang()) . "'"; |
|
3006
|
+ $sql .= " AND pl.lang = '".$this->db->escape($langs->getDefaultLang())."'"; |
3007
|
3007
|
} |
3008
|
3008
|
} else { |
3009
|
|
- $sql .= " AND pl.lang = '" . $this->db->escape($langs->getDefaultLang()) . "'"; |
|
3009
|
+ $sql .= " AND pl.lang = '".$this->db->escape($langs->getDefaultLang())."'"; |
3010
|
3010
|
} |
3011
|
3011
|
} |
3012
|
3012
|
|
3013
|
3013
|
if (getDolGlobalString('PRODUIT_ATTRIBUTES_HIDECHILD')) { |
3014
|
|
- $sql .= " LEFT JOIN " . $this->db->prefix() . "product_attribute_combination pac ON pac.fk_product_child = p.rowid"; |
|
3014
|
+ $sql .= " LEFT JOIN ".$this->db->prefix()."product_attribute_combination pac ON pac.fk_product_child = p.rowid"; |
3015
|
3015
|
} |
3016
|
3016
|
|
3017
|
|
- $sql .= ' WHERE p.entity IN (' . getEntity('product') . ')'; |
|
3017
|
+ $sql .= ' WHERE p.entity IN ('.getEntity('product').')'; |
3018
|
3018
|
|
3019
|
3019
|
if (getDolGlobalString('PRODUIT_ATTRIBUTES_HIDECHILD')) { |
3020
|
3020
|
$sql .= " AND pac.rowid IS NULL"; |
3021
|
3021
|
} |
3022
|
3022
|
|
3023
|
3023
|
if ($finished == 0) { |
3024
|
|
- $sql .= " AND p.finished = " . ((int) $finished); |
|
3024
|
+ $sql .= " AND p.finished = ".((int) $finished); |
3025
|
3025
|
} elseif ($finished == 1) { |
3026
|
3026
|
$sql .= " AND p.finished = ".((int) $finished); |
3027
|
3027
|
} |
|
@@ -3029,11 +3029,11 @@ discard block |
|
|
block discarded – undo |
3029
|
3029
|
$sql .= " AND p.tosell = ".((int) $status); |
3030
|
3030
|
} |
3031
|
3031
|
if ($status_purchase >= 0) { |
3032
|
|
- $sql .= " AND p.tobuy = " . ((int) $status_purchase); |
|
3032
|
+ $sql .= " AND p.tobuy = ".((int) $status_purchase); |
3033
|
3033
|
} |
3034
|
3034
|
// Filter by product type |
3035
|
3035
|
if (strval($filtertype) != '') { |
3036
|
|
- $sql .= " AND p.fk_product_type = " . ((int) $filtertype); |
|
3036
|
+ $sql .= " AND p.fk_product_type = ".((int) $filtertype); |
3037
|
3037
|
} elseif (!isModEnabled('product')) { // when product module is disabled, show services only |
3038
|
3038
|
$sql .= " AND p.fk_product_type = 1"; |
3039
|
3039
|
} elseif (!isModEnabled('service')) { // when service module is disabled, show products only |
|
@@ -3057,21 +3057,21 @@ discard block |
|
|
block discarded – undo |
3057
|
3057
|
if ($i > 0) { |
3058
|
3058
|
$sql .= " AND "; |
3059
|
3059
|
} |
3060
|
|
- $sql .= "(p.ref LIKE '" . $this->db->escape($prefix . $crit) . "%' OR p.label LIKE '" . $this->db->escape($prefix . $crit) . "%'"; |
|
3060
|
+ $sql .= "(p.ref LIKE '".$this->db->escape($prefix.$crit)."%' OR p.label LIKE '".$this->db->escape($prefix.$crit)."%'"; |
3061
|
3061
|
if (getDolGlobalInt('MAIN_MULTILANGS')) { |
3062
|
|
- $sql .= " OR pl.label LIKE '" . $this->db->escape($prefix . $crit) . "%'"; |
|
3062
|
+ $sql .= " OR pl.label LIKE '".$this->db->escape($prefix.$crit)."%'"; |
3063
|
3063
|
} |
3064
|
3064
|
if (getDolGlobalString('PRODUIT_CUSTOMER_PRICES') && !empty($socid)) { |
3065
|
|
- $sql .= " OR pcp.ref_customer LIKE '" . $this->db->escape($prefix . $crit) . "%'"; |
|
3065
|
+ $sql .= " OR pcp.ref_customer LIKE '".$this->db->escape($prefix.$crit)."%'"; |
3066
|
3066
|
} |
3067
|
3067
|
if (getDolGlobalString('PRODUCT_AJAX_SEARCH_ON_DESCRIPTION')) { |
3068
|
|
- $sql .= " OR p.description LIKE '" . $this->db->escape($prefix . $crit) . "%'"; |
|
3068
|
+ $sql .= " OR p.description LIKE '".$this->db->escape($prefix.$crit)."%'"; |
3069
|
3069
|
if (getDolGlobalInt('MAIN_MULTILANGS')) { |
3070
|
|
- $sql .= " OR pl.description LIKE '" . $this->db->escape($prefix . $crit) . "%'"; |
|
3070
|
+ $sql .= " OR pl.description LIKE '".$this->db->escape($prefix.$crit)."%'"; |
3071
|
3071
|
} |
3072
|
3072
|
} |
3073
|
3073
|
if (getDolGlobalString('MAIN_SEARCH_PRODUCT_BY_FOURN_REF')) { |
3074
|
|
- $sql .= " OR pfp.ref_fourn LIKE '" . $this->db->escape($prefix . $crit) . "%'"; |
|
3074
|
+ $sql .= " OR pfp.ref_fourn LIKE '".$this->db->escape($prefix.$crit)."%'"; |
3075
|
3075
|
} |
3076
|
3076
|
$sql .= ")"; |
3077
|
3077
|
$i++; |
|
@@ -3080,12 +3080,12 @@ discard block |
|
|
block discarded – undo |
3080
|
3080
|
$sql .= ")"; |
3081
|
3081
|
} |
3082
|
3082
|
if (isModEnabled('barcode')) { |
3083
|
|
- $sql .= " OR p.barcode LIKE '" . $this->db->escape($prefix . $filterkey) . "%'"; |
|
3083
|
+ $sql .= " OR p.barcode LIKE '".$this->db->escape($prefix.$filterkey)."%'"; |
3084
|
3084
|
} |
3085
|
3085
|
$sql .= ')'; |
3086
|
3086
|
} |
3087
|
3087
|
if (count($warehouseStatusArray)) { |
3088
|
|
- $sql .= " GROUP BY " . $selectFields; |
|
3088
|
+ $sql .= " GROUP BY ".$selectFields; |
3089
|
3089
|
} |
3090
|
3090
|
|
3091
|
3091
|
//Sort by category |
|
@@ -3100,23 +3100,23 @@ discard block |
|
|
block discarded – undo |
3100
|
3100
|
$sql .= $this->db->plimit($limit, 0); |
3101
|
3101
|
|
3102
|
3102
|
// Build output string |
3103
|
|
- dol_syslog(get_class($this) . "::select_produits_list search products", LOG_DEBUG); |
|
3103
|
+ dol_syslog(get_class($this)."::select_produits_list search products", LOG_DEBUG); |
3104
|
3104
|
$result = $this->db->query($sql); |
3105
|
3105
|
if ($result) { |
3106
|
|
- require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; |
3107
|
|
- require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php'; |
3108
|
|
- require_once DOL_DOCUMENT_ROOT . '/core/lib/product.lib.php'; |
|
3106
|
+ require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; |
|
3107
|
+ require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php'; |
|
3108
|
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php'; |
3109
|
3109
|
|
3110
|
3110
|
$num = $this->db->num_rows($result); |
3111
|
3111
|
|
3112
|
3112
|
$events = array(); |
3113
|
3113
|
|
3114
|
3114
|
if (!$forcecombo) { |
3115
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
3115
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
3116
|
3116
|
$out .= ajax_combobox($htmlname, $events, getDolGlobalInt("PRODUIT_USE_SEARCH_TO_SELECT")); |
3117
|
3117
|
} |
3118
|
3118
|
|
3119
|
|
- $out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">'; |
|
3119
|
+ $out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">'; |
3120
|
3120
|
|
3121
|
3121
|
$textifempty = ''; |
3122
|
3122
|
// Do not use textifempty = ' ' or ' ' here, or search on key will search on ' key'. |
|
@@ -3133,7 +3133,7 @@ discard block |
|
|
block discarded – undo |
3133
|
3133
|
} |
3134
|
3134
|
} |
3135
|
3135
|
if ($showempty) { |
3136
|
|
- $out .= '<option value="-1" selected>' . ($textifempty ? $textifempty : ' ') . '</option>'; |
|
3136
|
+ $out .= '<option value="-1" selected>'.($textifempty ? $textifempty : ' ').'</option>'; |
3137
|
3137
|
} |
3138
|
3138
|
|
3139
|
3139
|
$i = 0; |
|
@@ -3144,11 +3144,11 @@ discard block |
|
|
block discarded – undo |
3144
|
3144
|
|
3145
|
3145
|
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 |
3146
|
3146
|
$sql = "SELECT rowid, quantity, price, unitprice, remise_percent, remise, price_base_type"; |
3147
|
|
- $sql .= " FROM " . $this->db->prefix() . "product_price_by_qty"; |
3148
|
|
- $sql .= " WHERE fk_product_price = " . ((int) $objp->price_rowid); |
|
3147
|
+ $sql .= " FROM ".$this->db->prefix()."product_price_by_qty"; |
|
3148
|
+ $sql .= " WHERE fk_product_price = ".((int) $objp->price_rowid); |
3149
|
3149
|
$sql .= " ORDER BY quantity ASC"; |
3150
|
3150
|
|
3151
|
|
- dol_syslog(get_class($this) . "::select_produits_list search prices by qty", LOG_DEBUG); |
|
3151
|
+ dol_syslog(get_class($this)."::select_produits_list search prices by qty", LOG_DEBUG); |
3152
|
3152
|
$result2 = $this->db->query($sql); |
3153
|
3153
|
if ($result2) { |
3154
|
3154
|
$nb_prices = $this->db->num_rows($result2); |
|
@@ -3186,7 +3186,7 @@ discard block |
|
|
block discarded – undo |
3186
|
3186
|
$price_product = new Product($this->db); |
3187
|
3187
|
$price_product->fetch($objp->rowid, '', '', 1); |
3188
|
3188
|
|
3189
|
|
- require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php'; |
|
3189
|
+ require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php'; |
3190
|
3190
|
$priceparser = new PriceParser($this->db); |
3191
|
3191
|
$price_result = $priceparser->parseProduct($price_product); |
3192
|
3192
|
if ($price_result >= 0) { |
|
@@ -3270,7 +3270,7 @@ discard block |
|
|
block discarded – undo |
3270
|
3270
|
$label = $objp->label_translated; |
3271
|
3271
|
} |
3272
|
3272
|
if (!empty($filterkey) && $filterkey != '') { |
3273
|
|
- $label = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $label, 1); |
|
3273
|
+ $label = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $label, 1); |
3274
|
3274
|
} |
3275
|
3275
|
|
3276
|
3276
|
$outkey = $objp->rowid; |
|
@@ -3291,32 +3291,32 @@ discard block |
|
|
block discarded – undo |
3291
|
3291
|
$outdurationunit = $outtype == Product::TYPE_SERVICE ? substr($objp->duration, -1) : ''; |
3292
|
3292
|
|
3293
|
3293
|
if ($outorigin && getDolGlobalString('PRODUCT_SHOW_ORIGIN_IN_COMBO')) { |
3294
|
|
- require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php'; |
|
3294
|
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; |
3295
|
3295
|
} |
3296
|
3296
|
|
3297
|
3297
|
// Units |
3298
|
3298
|
$outvalUnits = ''; |
3299
|
3299
|
if (getDolGlobalInt('PRODUCT_USE_UNITS')) { |
3300
|
3300
|
if (!empty($objp->unit_short)) { |
3301
|
|
- $outvalUnits .= ' - ' . $objp->unit_short; |
|
3301
|
+ $outvalUnits .= ' - '.$objp->unit_short; |
3302
|
3302
|
} |
3303
|
3303
|
} |
3304
|
3304
|
if (getDolGlobalString('PRODUCT_SHOW_DIMENSIONS_IN_COMBO')) { |
3305
|
3305
|
if (!empty($objp->weight) && $objp->weight_units !== null) { |
3306
|
3306
|
$unitToShow = showDimensionInBestUnit($objp->weight, $objp->weight_units, 'weight', $langs); |
3307
|
|
- $outvalUnits .= ' - ' . $unitToShow; |
|
3307
|
+ $outvalUnits .= ' - '.$unitToShow; |
3308
|
3308
|
} |
3309
|
3309
|
if ((!empty($objp->length) || !empty($objp->width) || !empty($objp->height)) && $objp->length_units !== null) { |
3310
|
|
- $unitToShow = $objp->length . ' x ' . $objp->width . ' x ' . $objp->height . ' ' . measuringUnitString(0, 'size', $objp->length_units); |
3311
|
|
- $outvalUnits .= ' - ' . $unitToShow; |
|
3310
|
+ $unitToShow = $objp->length.' x '.$objp->width.' x '.$objp->height.' '.measuringUnitString(0, 'size', $objp->length_units); |
|
3311
|
+ $outvalUnits .= ' - '.$unitToShow; |
3312
|
3312
|
} |
3313
|
3313
|
if (!empty($objp->surface) && $objp->surface_units !== null) { |
3314
|
3314
|
$unitToShow = showDimensionInBestUnit($objp->surface, $objp->surface_units, 'surface', $langs); |
3315
|
|
- $outvalUnits .= ' - ' . $unitToShow; |
|
3315
|
+ $outvalUnits .= ' - '.$unitToShow; |
3316
|
3316
|
} |
3317
|
3317
|
if (!empty($objp->volume) && $objp->volume_units !== null) { |
3318
|
3318
|
$unitToShow = showDimensionInBestUnit($objp->volume, $objp->volume_units, 'volume', $langs); |
3319
|
|
- $outvalUnits .= ' - ' . $unitToShow; |
|
3319
|
+ $outvalUnits .= ' - '.$unitToShow; |
3320
|
3320
|
} |
3321
|
3321
|
} |
3322
|
3322
|
if ($outdurationvalue && $outdurationunit) { |
|
@@ -3328,7 +3328,7 @@ discard block |
|
|
block discarded – undo |
3328
|
3328
|
'y' => $langs->trans('Year') |
3329
|
3329
|
); |
3330
|
3330
|
if (isset($da[$outdurationunit])) { |
3331
|
|
- $outvalUnits .= ' - ' . $outdurationvalue . ' ' . $langs->transnoentities($da[$outdurationunit] . ($outdurationvalue > 1 ? 's' : '')); |
|
3331
|
+ $outvalUnits .= ' - '.$outdurationvalue.' '.$langs->transnoentities($da[$outdurationunit].($outdurationvalue > 1 ? 's' : '')); |
3332
|
3332
|
} |
3333
|
3333
|
} |
3334
|
3334
|
|
|
@@ -3348,31 +3348,31 @@ discard block |
|
|
block discarded – undo |
3348
|
3348
|
$labeltoshow = ''; |
3349
|
3349
|
$labeltoshow .= $objp->ref; |
3350
|
3350
|
if (!empty($objp->custref)) { |
3351
|
|
- $labeltoshow .= ' (' . $objp->custref . ')'; |
|
3351
|
+ $labeltoshow .= ' ('.$objp->custref.')'; |
3352
|
3352
|
} |
3353
|
3353
|
if ($outbarcode) { |
3354
|
|
- $labeltoshow .= ' (' . $outbarcode . ')'; |
|
3354
|
+ $labeltoshow .= ' ('.$outbarcode.')'; |
3355
|
3355
|
} |
3356
|
|
- $labeltoshow .= ' - ' . dol_trunc($label, $maxlengtharticle); |
|
3356
|
+ $labeltoshow .= ' - '.dol_trunc($label, $maxlengtharticle); |
3357
|
3357
|
if ($outorigin && getDolGlobalString('PRODUCT_SHOW_ORIGIN_IN_COMBO')) { |
3358
|
|
- $labeltoshow .= ' (' . getCountry($outorigin, 1) . ')'; |
|
3358
|
+ $labeltoshow .= ' ('.getCountry($outorigin, 1).')'; |
3359
|
3359
|
} |
3360
|
3360
|
|
3361
|
3361
|
// Set $labltoshowhtml |
3362
|
3362
|
$labeltoshowhtml = ''; |
3363
|
3363
|
$labeltoshowhtml .= $objp->ref; |
3364
|
3364
|
if (!empty($objp->custref)) { |
3365
|
|
- $labeltoshowhtml .= ' (' . $objp->custref . ')'; |
|
3365
|
+ $labeltoshowhtml .= ' ('.$objp->custref.')'; |
3366
|
3366
|
} |
3367
|
3367
|
if (!empty($filterkey) && $filterkey != '') { |
3368
|
|
- $labeltoshowhtml = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $labeltoshowhtml, 1); |
|
3368
|
+ $labeltoshowhtml = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $labeltoshowhtml, 1); |
3369
|
3369
|
} |
3370
|
3370
|
if ($outbarcode) { |
3371
|
|
- $labeltoshowhtml .= ' (' . $outbarcode . ')'; |
|
3371
|
+ $labeltoshowhtml .= ' ('.$outbarcode.')'; |
3372
|
3372
|
} |
3373
|
|
- $labeltoshowhtml .= ' - ' . dol_trunc($label, $maxlengtharticle); |
|
3373
|
+ $labeltoshowhtml .= ' - '.dol_trunc($label, $maxlengtharticle); |
3374
|
3374
|
if ($outorigin && getDolGlobalString('PRODUCT_SHOW_ORIGIN_IN_COMBO')) { |
3375
|
|
- $labeltoshowhtml .= ' (' . getCountry($outorigin, 1) . ')'; |
|
3375
|
+ $labeltoshowhtml .= ' ('.getCountry($outorigin, 1).')'; |
3376
|
3376
|
} |
3377
|
3377
|
|
3378
|
3378
|
// Stock |
|
@@ -3380,14 +3380,14 @@ discard block |
|
|
block discarded – undo |
3380
|
3380
|
$labeltoshowhtmlstock = ''; |
3381
|
3381
|
if (isModEnabled('stock') && isset($objp->stock) && ($objp->fk_product_type == Product::TYPE_PRODUCT || getDolGlobalString('STOCK_SUPPORTS_SERVICES'))) { |
3382
|
3382
|
if ($user->hasRight('stock', 'lire')) { |
3383
|
|
- $labeltoshowstock .= ' - ' . $langs->trans("Stock") . ': ' . price(price2num($objp->stock, 'MS')); |
|
3383
|
+ $labeltoshowstock .= ' - '.$langs->trans("Stock").': '.price(price2num($objp->stock, 'MS')); |
3384
|
3384
|
|
3385
|
3385
|
if ($objp->stock > 0) { |
3386
|
3386
|
$labeltoshowhtmlstock .= ' - <span class="product_line_stock_ok">'; |
3387
|
3387
|
} elseif ($objp->stock <= 0) { |
3388
|
3388
|
$labeltoshowhtmlstock .= ' - <span class="product_line_stock_too_low">'; |
3389
|
3389
|
} |
3390
|
|
- $labeltoshowhtmlstock .= $langs->transnoentities("Stock") . ': ' . price(price2num($objp->stock, 'MS')); |
|
3390
|
+ $labeltoshowhtmlstock .= $langs->transnoentities("Stock").': '.price(price2num($objp->stock, 'MS')); |
3391
|
3391
|
$labeltoshowhtmlstock .= '</span>'; |
3392
|
3392
|
|
3393
|
3393
|
if (empty($novirtualstock) && getDolGlobalString('STOCK_SHOW_VIRTUAL_STOCK_IN_PRODUCTS_COMBO')) { // Warning, this option may slow down combo list generation |
|
@@ -3398,9 +3398,9 @@ discard block |
|
|
block discarded – undo |
3398
|
3398
|
$tmpproduct->load_virtual_stock(); |
3399
|
3399
|
$virtualstock = $tmpproduct->stock_theorique; |
3400
|
3400
|
|
3401
|
|
- $labeltoshowstock .= ' - ' . $langs->trans("VirtualStock") . ':' . $virtualstock; |
|
3401
|
+ $labeltoshowstock .= ' - '.$langs->trans("VirtualStock").':'.$virtualstock; |
3402
|
3402
|
|
3403
|
|
- $labeltoshowhtmlstock .= ' - ' . $langs->transnoentities("VirtualStock") . ':'; |
|
3403
|
+ $labeltoshowhtmlstock .= ' - '.$langs->transnoentities("VirtualStock").':'; |
3404
|
3404
|
if ($virtualstock > 0) { |
3405
|
3405
|
$labeltoshowhtmlstock .= '<span class="product_line_stock_ok">'; |
3406
|
3406
|
} elseif ($virtualstock <= 0) { |
|
@@ -3421,35 +3421,35 @@ discard block |
|
|
block discarded – undo |
3421
|
3421
|
// If we need a particular price level (from 1 to n) |
3422
|
3422
|
if (empty($hidepriceinlabel) && $price_level >= 1 && (getDolGlobalString('PRODUIT_MULTIPRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES'))) { |
3423
|
3423
|
$sql = "SELECT price, price_ttc, price_base_type, tva_tx, default_vat_code"; |
3424
|
|
- $sql .= " FROM " . $this->db->prefix() . "product_price"; |
3425
|
|
- $sql .= " WHERE fk_product = " . ((int) $objp->rowid); |
3426
|
|
- $sql .= " AND entity IN (" . getEntity('productprice') . ")"; |
3427
|
|
- $sql .= " AND price_level = " . ((int) $price_level); |
|
3424
|
+ $sql .= " FROM ".$this->db->prefix()."product_price"; |
|
3425
|
+ $sql .= " WHERE fk_product = ".((int) $objp->rowid); |
|
3426
|
+ $sql .= " AND entity IN (".getEntity('productprice').")"; |
|
3427
|
+ $sql .= " AND price_level = ".((int) $price_level); |
3428
|
3428
|
$sql .= " ORDER BY date_price DESC, rowid DESC"; // Warning DESC must be both on date_price and rowid. |
3429
|
3429
|
$sql .= " LIMIT 1"; |
3430
|
3430
|
|
3431
|
|
- dol_syslog(get_class($this) . '::constructProductListOption search price for product ' . $objp->rowid . ' AND level ' . $price_level, LOG_DEBUG); |
|
3431
|
+ dol_syslog(get_class($this).'::constructProductListOption search price for product '.$objp->rowid.' AND level '.$price_level, LOG_DEBUG); |
3432
|
3432
|
$result2 = $this->db->query($sql); |
3433
|
3433
|
if ($result2) { |
3434
|
3434
|
$objp2 = $this->db->fetch_object($result2); |
3435
|
3435
|
if ($objp2) { |
3436
|
3436
|
$found = 1; |
3437
|
3437
|
if ($objp2->price_base_type == 'HT') { |
3438
|
|
- $labeltoshowprice .= ' - ' . price($objp2->price, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("HT"); |
3439
|
|
- $labeltoshowhtmlprice .= ' - ' . price($objp2->price, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("HT"); |
|
3438
|
+ $labeltoshowprice .= ' - '.price($objp2->price, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("HT"); |
|
3439
|
+ $labeltoshowhtmlprice .= ' - '.price($objp2->price, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("HT"); |
3440
|
3440
|
} else { |
3441
|
|
- $labeltoshowprice .= ' - ' . price($objp2->price_ttc, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("TTC"); |
3442
|
|
- $labeltoshowhtmlprice .= ' - ' . price($objp2->price_ttc, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("TTC"); |
|
3441
|
+ $labeltoshowprice .= ' - '.price($objp2->price_ttc, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("TTC"); |
|
3442
|
+ $labeltoshowhtmlprice .= ' - '.price($objp2->price_ttc, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("TTC"); |
3443
|
3443
|
} |
3444
|
3444
|
$outprice_ht = price($objp2->price); |
3445
|
3445
|
$outprice_ttc = price($objp2->price_ttc); |
3446
|
3446
|
$outpricebasetype = $objp2->price_base_type; |
3447
|
3447
|
if (getDolGlobalString('PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL')) { // using this option is a bug. kept for backward compatibility |
3448
|
|
- $outtva_tx = $objp2->tva_tx; // We use the vat rate on line of multiprice |
3449
|
|
- $outdefault_vat_code = $objp2->default_vat_code; // We use the vat code on line of multiprice |
|
3448
|
+ $outtva_tx = $objp2->tva_tx; // We use the vat rate on line of multiprice |
|
3449
|
+ $outdefault_vat_code = $objp2->default_vat_code; // We use the vat code on line of multiprice |
3450
|
3450
|
} else { |
3451
|
|
- $outtva_tx = $objp->tva_tx; // We use the vat rate of product, not the one on line of multiprice |
3452
|
|
- $outdefault_vat_code = $objp->default_vat_code; // We use the vat code or product, not the one on line of multiprice |
|
3451
|
+ $outtva_tx = $objp->tva_tx; // We use the vat rate of product, not the one on line of multiprice |
|
3452
|
+ $outdefault_vat_code = $objp->default_vat_code; // We use the vat code or product, not the one on line of multiprice |
3453
|
3453
|
} |
3454
|
3454
|
} |
3455
|
3455
|
} else { |
|
@@ -3463,13 +3463,13 @@ discard block |
|
|
block discarded – undo |
3463
|
3463
|
$outqty = $objp->quantity; |
3464
|
3464
|
$outdiscount = $objp->remise_percent; |
3465
|
3465
|
if ($objp->quantity == 1) { |
3466
|
|
- $labeltoshowprice .= ' - ' . price($objp->unitprice, 1, $langs, 0, 0, -1, $conf->currency) . "/"; |
3467
|
|
- $labeltoshowhtmlprice .= ' - ' . price($objp->unitprice, 0, $langs, 0, 0, -1, $conf->currency) . "/"; |
|
3466
|
+ $labeltoshowprice .= ' - '.price($objp->unitprice, 1, $langs, 0, 0, -1, $conf->currency)."/"; |
|
3467
|
+ $labeltoshowhtmlprice .= ' - '.price($objp->unitprice, 0, $langs, 0, 0, -1, $conf->currency)."/"; |
3468
|
3468
|
$labeltoshowprice .= $langs->trans("Unit"); // Do not use strtolower because it breaks utf8 encoding |
3469
|
3469
|
$labeltoshowhtmlprice .= $langs->transnoentities("Unit"); |
3470
|
3470
|
} else { |
3471
|
|
- $labeltoshowprice .= ' - ' . price($objp->price, 1, $langs, 0, 0, -1, $conf->currency) . "/" . $objp->quantity; |
3472
|
|
- $labeltoshowhtmlprice .= ' - ' . price($objp->price, 0, $langs, 0, 0, -1, $conf->currency) . "/" . $objp->quantity; |
|
3471
|
+ $labeltoshowprice .= ' - '.price($objp->price, 1, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity; |
|
3472
|
+ $labeltoshowhtmlprice .= ' - '.price($objp->price, 0, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity; |
3473
|
3473
|
$labeltoshowprice .= $langs->trans("Units"); // Do not use strtolower because it breaks utf8 encoding |
3474
|
3474
|
$labeltoshowhtmlprice .= $langs->transnoentities("Units"); |
3475
|
3475
|
} |
|
@@ -3477,16 +3477,16 @@ discard block |
|
|
block discarded – undo |
3477
|
3477
|
$outprice_ht = price($objp->unitprice); |
3478
|
3478
|
$outprice_ttc = price($objp->unitprice * (1 + ($objp->tva_tx / 100))); |
3479
|
3479
|
$outpricebasetype = $objp->price_base_type; |
3480
|
|
- $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 |
3481
|
|
- $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 |
|
3480
|
+ $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 |
|
3481
|
+ $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 |
3482
|
3482
|
} |
3483
|
3483
|
if (empty($hidepriceinlabel) && !empty($objp->quantity) && $objp->quantity >= 1) { |
3484
|
|
- $labeltoshowprice .= " (" . price($objp->unitprice, 1, $langs, 0, 0, -1, $conf->currency) . "/" . $langs->trans("Unit") . ")"; // Do not use strtolower because it breaks utf8 encoding |
3485
|
|
- $labeltoshowhtmlprice .= " (" . price($objp->unitprice, 0, $langs, 0, 0, -1, $conf->currency) . "/" . $langs->transnoentities("Unit") . ")"; // Do not use strtolower because it breaks utf8 encoding |
|
3484
|
+ $labeltoshowprice .= " (".price($objp->unitprice, 1, $langs, 0, 0, -1, $conf->currency)."/".$langs->trans("Unit").")"; // Do not use strtolower because it breaks utf8 encoding |
|
3485
|
+ $labeltoshowhtmlprice .= " (".price($objp->unitprice, 0, $langs, 0, 0, -1, $conf->currency)."/".$langs->transnoentities("Unit").")"; // Do not use strtolower because it breaks utf8 encoding |
3486
|
3486
|
} |
3487
|
3487
|
if (empty($hidepriceinlabel) && !empty($objp->remise_percent) && $objp->remise_percent >= 1) { |
3488
|
|
- $labeltoshowprice .= " - " . $langs->trans("Discount") . " : " . vatrate($objp->remise_percent) . ' %'; |
3489
|
|
- $labeltoshowhtmlprice .= " - " . $langs->transnoentities("Discount") . " : " . vatrate($objp->remise_percent) . ' %'; |
|
3488
|
+ $labeltoshowprice .= " - ".$langs->trans("Discount")." : ".vatrate($objp->remise_percent).' %'; |
|
3489
|
+ $labeltoshowhtmlprice .= " - ".$langs->transnoentities("Discount")." : ".vatrate($objp->remise_percent).' %'; |
3490
|
3490
|
} |
3491
|
3491
|
|
3492
|
3492
|
// Price by customer |
|
@@ -3495,11 +3495,11 @@ discard block |
|
|
block discarded – undo |
3495
|
3495
|
$found = 1; |
3496
|
3496
|
|
3497
|
3497
|
if ($objp->custprice_base_type == 'HT') { |
3498
|
|
- $labeltoshowprice .= ' - ' . price($objp->custprice, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("HT"); |
3499
|
|
- $labeltoshowhtmlprice .= ' - ' . price($objp->custprice, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("HT"); |
|
3498
|
+ $labeltoshowprice .= ' - '.price($objp->custprice, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("HT"); |
|
3499
|
+ $labeltoshowhtmlprice .= ' - '.price($objp->custprice, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("HT"); |
3500
|
3500
|
} else { |
3501
|
|
- $labeltoshowprice .= ' - ' . price($objp->custprice_ttc, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("TTC"); |
3502
|
|
- $labeltoshowhtmlprice .= ' - ' . price($objp->custprice_ttc, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("TTC"); |
|
3501
|
+ $labeltoshowprice .= ' - '.price($objp->custprice_ttc, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("TTC"); |
|
3502
|
+ $labeltoshowhtmlprice .= ' - '.price($objp->custprice_ttc, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("TTC"); |
3503
|
3503
|
} |
3504
|
3504
|
|
3505
|
3505
|
$outprice_ht = price($objp->custprice); |
|
@@ -3513,11 +3513,11 @@ discard block |
|
|
block discarded – undo |
3513
|
3513
|
// If level no defined or multiprice not found, we used the default price |
3514
|
3514
|
if (empty($hidepriceinlabel) && !$found) { |
3515
|
3515
|
if ($objp->price_base_type == 'HT') { |
3516
|
|
- $labeltoshowprice .= ' - ' . price($objp->price, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("HT"); |
3517
|
|
- $labeltoshowhtmlprice .= ' - ' . price($objp->price, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("HT"); |
|
3516
|
+ $labeltoshowprice .= ' - '.price($objp->price, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("HT"); |
|
3517
|
+ $labeltoshowhtmlprice .= ' - '.price($objp->price, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("HT"); |
3518
|
3518
|
} else { |
3519
|
|
- $labeltoshowprice .= ' - ' . price($objp->price_ttc, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("TTC"); |
3520
|
|
- $labeltoshowhtmlprice .= ' - ' . price($objp->price_ttc, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("TTC"); |
|
3519
|
+ $labeltoshowprice .= ' - '.price($objp->price_ttc, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("TTC"); |
|
3520
|
+ $labeltoshowhtmlprice .= ' - '.price($objp->price_ttc, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("TTC"); |
3521
|
3521
|
} |
3522
|
3522
|
$outprice_ht = price($objp->price); |
3523
|
3523
|
$outprice_ttc = price($objp->price_ttc); |
|
@@ -3528,14 +3528,14 @@ discard block |
|
|
block discarded – undo |
3528
|
3528
|
|
3529
|
3529
|
|
3530
|
3530
|
// Build options |
3531
|
|
- $opt = '<option value="' . $objp->rowid . '"'; |
|
3531
|
+ $opt = '<option value="'.$objp->rowid.'"'; |
3532
|
3532
|
$opt .= ($objp->rowid == $selected) ? ' selected' : ''; |
3533
|
3533
|
if (!empty($objp->price_by_qty_rowid) && $objp->price_by_qty_rowid > 0) { |
3534
|
|
- $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 . '"'; |
|
3534
|
+ $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
|
3535
|
} |
3536
|
3536
|
if (getDolGlobalString('PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE')) { |
3537
|
|
- $opt .= ' data-labeltrans="' . $outlabel_translated . '"'; |
3538
|
|
- $opt .= ' data-desctrans="' . dol_escape_htmltag($outdesc_translated) . '"'; |
|
3537
|
+ $opt .= ' data-labeltrans="'.$outlabel_translated.'"'; |
|
3538
|
+ $opt .= ' data-desctrans="'.dol_escape_htmltag($outdesc_translated).'"'; |
3539
|
3539
|
} |
3540
|
3540
|
|
3541
|
3541
|
if ($stocktag == 1) { |
|
@@ -3630,7 +3630,7 @@ discard block |
|
|
block discarded – undo |
3630
|
3630
|
$selected_input_value = ''; |
3631
|
3631
|
if (!empty($conf->use_javascript_ajax) && getDolGlobalString('PRODUIT_USE_SEARCH_TO_SELECT')) { |
3632
|
3632
|
if ($selected > 0) { |
3633
|
|
- require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; |
|
3633
|
+ require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; |
3634
|
3634
|
$producttmpselect = new Product($this->db); |
3635
|
3635
|
$producttmpselect->fetch($selected); |
3636
|
3636
|
$selected_input_value = $producttmpselect->ref; |
|
@@ -3638,10 +3638,10 @@ discard block |
|
|
block discarded – undo |
3638
|
3638
|
} |
3639
|
3639
|
|
3640
|
3640
|
// mode=2 means suppliers products |
3641
|
|
- $urloption = ($socid > 0 ? 'socid=' . $socid . '&' : '') . 'htmlname=' . $htmlname . '&outjson=1&price_level=' . $price_level . '&type=' . $filtertype . '&mode=2&status=' . $status . '&finished=' . $finished . '&alsoproductwithnosupplierprice=' . $alsoproductwithnosupplierprice; |
3642
|
|
- print ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/product/ajax/products.php', $urloption, getDolGlobalString('PRODUIT_USE_SEARCH_TO_SELECT'), 0, $ajaxoptions); |
|
3641
|
+ $urloption = ($socid > 0 ? 'socid='.$socid.'&' : '').'htmlname='.$htmlname.'&outjson=1&price_level='.$price_level.'&type='.$filtertype.'&mode=2&status='.$status.'&finished='.$finished.'&alsoproductwithnosupplierprice='.$alsoproductwithnosupplierprice; |
|
3642
|
+ print ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/product/ajax/products.php', $urloption, getDolGlobalString('PRODUIT_USE_SEARCH_TO_SELECT'), 0, $ajaxoptions); |
3643
|
3643
|
|
3644
|
|
- print($hidelabel ? '' : $langs->trans("RefOrLabel") . ' : ') . '<input type="text" class="'.$morecss.'" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . ($placeholder ? ' placeholder="' . $placeholder . '"' : '') . '>'; |
|
3644
|
+ print($hidelabel ? '' : $langs->trans("RefOrLabel").' : ').'<input type="text" class="'.$morecss.'" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.($placeholder ? ' placeholder="'.$placeholder.'"' : '').'>'; |
3645
|
3645
|
} else { |
3646
|
3646
|
print $this->select_produits_fournisseurs_list($socid, $selected, $htmlname, $filtertype, $filtre, '', $status, 0, 0, $alsoproductwithnosupplierprice, $morecss, 0, $placeholder); |
3647
|
3647
|
} |
|
@@ -3701,25 +3701,25 @@ discard block |
|
|
block discarded – undo |
3701
|
3701
|
if (getDolGlobalInt('PRODUCT_USE_UNITS')) { |
3702
|
3702
|
$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"; |
3703
|
3703
|
} |
3704
|
|
- $sql .= " FROM " . $this->db->prefix() . "product as p"; |
3705
|
|
- $sql .= " LEFT JOIN " . $this->db->prefix() . "product_fournisseur_price as pfp ON ( p.rowid = pfp.fk_product AND pfp.entity IN (" . getEntity('product') . ") )"; |
|
3704
|
+ $sql .= " FROM ".$this->db->prefix()."product as p"; |
|
3705
|
+ $sql .= " LEFT JOIN ".$this->db->prefix()."product_fournisseur_price as pfp ON ( p.rowid = pfp.fk_product AND pfp.entity IN (".getEntity('product').") )"; |
3706
|
3706
|
if ($socid > 0) { |
3707
|
|
- $sql .= " AND pfp.fk_soc = " . ((int) $socid); |
|
3707
|
+ $sql .= " AND pfp.fk_soc = ".((int) $socid); |
3708
|
3708
|
} |
3709
|
|
- $sql .= " LEFT JOIN " . $this->db->prefix() . "societe as s ON pfp.fk_soc = s.rowid"; |
|
3709
|
+ $sql .= " LEFT JOIN ".$this->db->prefix()."societe as s ON pfp.fk_soc = s.rowid"; |
3710
|
3710
|
// Units |
3711
|
3711
|
if (getDolGlobalInt('PRODUCT_USE_UNITS')) { |
3712
|
|
- $sql .= " LEFT JOIN " . $this->db->prefix() . "c_units u ON u.rowid = p.fk_unit"; |
|
3712
|
+ $sql .= " LEFT JOIN ".$this->db->prefix()."c_units u ON u.rowid = p.fk_unit"; |
3713
|
3713
|
} |
3714
|
|
- $sql .= " WHERE p.entity IN (" . getEntity('product') . ")"; |
|
3714
|
+ $sql .= " WHERE p.entity IN (".getEntity('product').")"; |
3715
|
3715
|
if ($statut != -1) { |
3716
|
|
- $sql .= " AND p.tobuy = " . ((int) $statut); |
|
3716
|
+ $sql .= " AND p.tobuy = ".((int) $statut); |
3717
|
3717
|
} |
3718
|
3718
|
if (strval($filtertype) != '') { |
3719
|
|
- $sql .= " AND p.fk_product_type = " . ((int) $filtertype); |
|
3719
|
+ $sql .= " AND p.fk_product_type = ".((int) $filtertype); |
3720
|
3720
|
} |
3721
|
3721
|
if (!empty($filtre)) { |
3722
|
|
- $sql .= " " . $filtre; |
|
3722
|
+ $sql .= " ".$filtre; |
3723
|
3723
|
} |
3724
|
3724
|
// Add where from hooks |
3725
|
3725
|
$parameters = array(); |
|
@@ -3739,9 +3739,9 @@ discard block |
|
|
block discarded – undo |
3739
|
3739
|
if ($i > 0) { |
3740
|
3740
|
$sql .= " AND "; |
3741
|
3741
|
} |
3742
|
|
- $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) . "%'"; |
|
3742
|
+ $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
|
3743
|
if (getDolGlobalString('PRODUIT_FOURN_TEXTS')) { |
3744
|
|
- $sql .= " OR pfp.desc_fourn LIKE '" . $this->db->escape($prefix . $crit) . "%'"; |
|
3744
|
+ $sql .= " OR pfp.desc_fourn LIKE '".$this->db->escape($prefix.$crit)."%'"; |
3745
|
3745
|
} |
3746
|
3746
|
$sql .= ")"; |
3747
|
3747
|
$i++; |
|
@@ -3750,8 +3750,8 @@ discard block |
|
|
block discarded – undo |
3750
|
3750
|
$sql .= ")"; |
3751
|
3751
|
} |
3752
|
3752
|
if (isModEnabled('barcode')) { |
3753
|
|
- $sql .= " OR p.barcode LIKE '" . $this->db->escape($prefix . $filterkey) . "%'"; |
3754
|
|
- $sql .= " OR pfp.barcode LIKE '" . $this->db->escape($prefix . $filterkey) . "%'"; |
|
3753
|
+ $sql .= " OR p.barcode LIKE '".$this->db->escape($prefix.$filterkey)."%'"; |
|
3754
|
+ $sql .= " OR pfp.barcode LIKE '".$this->db->escape($prefix.$filterkey)."%'"; |
3755
|
3755
|
} |
3756
|
3756
|
$sql .= ')'; |
3757
|
3757
|
} |
|
@@ -3760,20 +3760,20 @@ discard block |
|
|
block discarded – undo |
3760
|
3760
|
|
3761
|
3761
|
// Build output string |
3762
|
3762
|
|
3763
|
|
- dol_syslog(get_class($this) . "::select_produits_fournisseurs_list", LOG_DEBUG); |
|
3763
|
+ dol_syslog(get_class($this)."::select_produits_fournisseurs_list", LOG_DEBUG); |
3764
|
3764
|
$result = $this->db->query($sql); |
3765
|
3765
|
if ($result) { |
3766
|
|
- require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php'; |
3767
|
|
- require_once DOL_DOCUMENT_ROOT . '/core/lib/product.lib.php'; |
|
3766
|
+ require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php'; |
|
3767
|
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php'; |
3768
|
3768
|
|
3769
|
3769
|
$num = $this->db->num_rows($result); |
3770
|
3770
|
|
3771
|
3771
|
//$out.='<select class="flat" id="select'.$htmlname.'" name="'.$htmlname.'">'; // remove select to have id same with combo and ajax |
3772
|
|
- $out .= '<select class="flat ' . ($morecss ? ' ' . $morecss : '') . '" id="' . $htmlname . '" name="' . $htmlname . '">'; |
|
3772
|
+ $out .= '<select class="flat '.($morecss ? ' '.$morecss : '').'" id="'.$htmlname.'" name="'.$htmlname.'">'; |
3773
|
3773
|
if (!$selected) { |
3774
|
|
- $out .= '<option value="-1" selected>' . ($placeholder ? $placeholder : ' ') . '</option>'; |
|
3774
|
+ $out .= '<option value="-1" selected>'.($placeholder ? $placeholder : ' ').'</option>'; |
3775
|
3775
|
} else { |
3776
|
|
- $out .= '<option value="-1">' . ($placeholder ? $placeholder : ' ') . '</option>'; |
|
3776
|
+ $out .= '<option value="-1">'.($placeholder ? $placeholder : ' ').'</option>'; |
3777
|
3777
|
} |
3778
|
3778
|
|
3779
|
3779
|
$i = 0; |
|
@@ -3788,7 +3788,7 @@ discard block |
|
|
block discarded – undo |
3788
|
3788
|
|
3789
|
3789
|
$outkey = $objp->idprodfournprice; // id in table of price |
3790
|
3790
|
if (!$outkey && $alsoproductwithnosupplierprice) { |
3791
|
|
- $outkey = 'idprod_' . $objp->rowid; // id of product |
|
3791
|
+ $outkey = 'idprod_'.$objp->rowid; // id of product |
3792
|
3792
|
} |
3793
|
3793
|
|
3794
|
3794
|
$outref = $objp->ref; |
|
@@ -3803,23 +3803,23 @@ discard block |
|
|
block discarded – undo |
3803
|
3803
|
$outvalUnits = ''; |
3804
|
3804
|
if (getDolGlobalInt('PRODUCT_USE_UNITS')) { |
3805
|
3805
|
if (!empty($objp->unit_short)) { |
3806
|
|
- $outvalUnits .= ' - ' . $objp->unit_short; |
|
3806
|
+ $outvalUnits .= ' - '.$objp->unit_short; |
3807
|
3807
|
} |
3808
|
3808
|
if (!empty($objp->weight) && $objp->weight_units !== null) { |
3809
|
3809
|
$unitToShow = showDimensionInBestUnit($objp->weight, $objp->weight_units, 'weight', $langs); |
3810
|
|
- $outvalUnits .= ' - ' . $unitToShow; |
|
3810
|
+ $outvalUnits .= ' - '.$unitToShow; |
3811
|
3811
|
} |
3812
|
3812
|
if ((!empty($objp->length) || !empty($objp->width) || !empty($objp->height)) && $objp->length_units !== null) { |
3813
|
|
- $unitToShow = $objp->length . ' x ' . $objp->width . ' x ' . $objp->height . ' ' . measuringUnitString(0, 'size', $objp->length_units); |
3814
|
|
- $outvalUnits .= ' - ' . $unitToShow; |
|
3813
|
+ $unitToShow = $objp->length.' x '.$objp->width.' x '.$objp->height.' '.measuringUnitString(0, 'size', $objp->length_units); |
|
3814
|
+ $outvalUnits .= ' - '.$unitToShow; |
3815
|
3815
|
} |
3816
|
3816
|
if (!empty($objp->surface) && $objp->surface_units !== null) { |
3817
|
3817
|
$unitToShow = showDimensionInBestUnit($objp->surface, $objp->surface_units, 'surface', $langs); |
3818
|
|
- $outvalUnits .= ' - ' . $unitToShow; |
|
3818
|
+ $outvalUnits .= ' - '.$unitToShow; |
3819
|
3819
|
} |
3820
|
3820
|
if (!empty($objp->volume) && $objp->volume_units !== null) { |
3821
|
3821
|
$unitToShow = showDimensionInBestUnit($objp->volume, $objp->volume_units, 'volume', $langs); |
3822
|
|
- $outvalUnits .= ' - ' . $unitToShow; |
|
3822
|
+ $outvalUnits .= ' - '.$unitToShow; |
3823
|
3823
|
} |
3824
|
3824
|
if ($outdurationvalue && $outdurationunit) { |
3825
|
3825
|
$da = array( |
|
@@ -3830,22 +3830,22 @@ discard block |
|
|
block discarded – undo |
3830
|
3830
|
'y' => $langs->trans('Year') |
3831
|
3831
|
); |
3832
|
3832
|
if (isset($da[$outdurationunit])) { |
3833
|
|
- $outvalUnits .= ' - ' . $outdurationvalue . ' ' . $langs->transnoentities($da[$outdurationunit] . ($outdurationvalue > 1 ? 's' : '')); |
|
3833
|
+ $outvalUnits .= ' - '.$outdurationvalue.' '.$langs->transnoentities($da[$outdurationunit].($outdurationvalue > 1 ? 's' : '')); |
3834
|
3834
|
} |
3835
|
3835
|
} |
3836
|
3836
|
} |
3837
|
3837
|
|
3838
|
3838
|
$objRef = $objp->ref; |
3839
|
3839
|
if ($filterkey && $filterkey != '') { |
3840
|
|
- $objRef = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $objRef, 1); |
|
3840
|
+ $objRef = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $objRef, 1); |
3841
|
3841
|
} |
3842
|
3842
|
$objRefFourn = $objp->ref_fourn; |
3843
|
3843
|
if ($filterkey && $filterkey != '') { |
3844
|
|
- $objRefFourn = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $objRefFourn, 1); |
|
3844
|
+ $objRefFourn = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $objRefFourn, 1); |
3845
|
3845
|
} |
3846
|
3846
|
$label = $objp->label; |
3847
|
3847
|
if ($filterkey && $filterkey != '') { |
3848
|
|
- $label = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $label, 1); |
|
3848
|
+ $label = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $label, 1); |
3849
|
3849
|
} |
3850
|
3850
|
|
3851
|
3851
|
switch ($objp->fk_product_type) { |
|
@@ -3868,21 +3868,21 @@ discard block |
|
|
block discarded – undo |
3868
|
3868
|
|
3869
|
3869
|
$optlabel .= $objp->ref; |
3870
|
3870
|
if (!empty($objp->idprodfournprice) && ($objp->ref != $objp->ref_fourn)) { |
3871
|
|
- $optlabel .= ' <span class="opacitymedium">(' . $objp->ref_fourn . ')</span>'; |
|
3871
|
+ $optlabel .= ' <span class="opacitymedium">('.$objp->ref_fourn.')</span>'; |
3872
|
3872
|
} |
3873
|
3873
|
if (isModEnabled('barcode') && !empty($objp->barcode)) { |
3874
|
|
- $optlabel .= ' (' . $outbarcode . ')'; |
|
3874
|
+ $optlabel .= ' ('.$outbarcode.')'; |
3875
|
3875
|
} |
3876
|
|
- $optlabel .= ' - ' . dol_trunc($label, $maxlengtharticle); |
|
3876
|
+ $optlabel .= ' - '.dol_trunc($label, $maxlengtharticle); |
3877
|
3877
|
|
3878
|
3878
|
$outvallabel = $objRef; |
3879
|
3879
|
if (!empty($objp->idprodfournprice) && ($objp->ref != $objp->ref_fourn)) { |
3880
|
|
- $outvallabel .= ' (' . $objRefFourn . ')'; |
|
3880
|
+ $outvallabel .= ' ('.$objRefFourn.')'; |
3881
|
3881
|
} |
3882
|
3882
|
if (isModEnabled('barcode') && !empty($objp->barcode)) { |
3883
|
|
- $outvallabel .= ' (' . $outbarcode . ')'; |
|
3883
|
+ $outvallabel .= ' ('.$outbarcode.')'; |
3884
|
3884
|
} |
3885
|
|
- $outvallabel .= ' - ' . dol_trunc($label, $maxlengtharticle); |
|
3885
|
+ $outvallabel .= ' - '.dol_trunc($label, $maxlengtharticle); |
3886
|
3886
|
|
3887
|
3887
|
// Units |
3888
|
3888
|
$optlabel .= $outvalUnits; |
|
@@ -3899,7 +3899,7 @@ discard block |
|
|
block discarded – undo |
3899
|
3899
|
$prod_supplier->fourn_tva_tx = $objp->tva_tx; |
3900
|
3900
|
$prod_supplier->fk_supplier_price_expression = $objp->fk_supplier_price_expression; |
3901
|
3901
|
|
3902
|
|
- require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php'; |
|
3902
|
+ require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php'; |
3903
|
3903
|
$priceparser = new PriceParser($this->db); |
3904
|
3904
|
$price_result = $priceparser->parseProductSupplier($prod_supplier); |
3905
|
3905
|
if ($price_result >= 0) { |
|
@@ -3910,57 +3910,57 @@ discard block |
|
|
block discarded – undo |
3910
|
3910
|
} |
3911
|
3911
|
} |
3912
|
3912
|
if ($objp->quantity == 1) { |
3913
|
|
- $optlabel .= ' - ' . price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency) . "/"; |
3914
|
|
- $outvallabel .= ' - ' . price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 0, $langs, 0, 0, -1, $conf->currency) . "/"; |
|
3913
|
+ $optlabel .= ' - '.price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency)."/"; |
|
3914
|
+ $outvallabel .= ' - '.price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 0, $langs, 0, 0, -1, $conf->currency)."/"; |
3915
|
3915
|
$optlabel .= $langs->trans("Unit"); // Do not use strtolower because it breaks utf8 encoding |
3916
|
3916
|
$outvallabel .= $langs->transnoentities("Unit"); |
3917
|
3917
|
} else { |
3918
|
|
- $optlabel .= ' - ' . price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency) . "/" . $objp->quantity; |
3919
|
|
- $outvallabel .= ' - ' . price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 0, $langs, 0, 0, -1, $conf->currency) . "/" . $objp->quantity; |
3920
|
|
- $optlabel .= ' ' . $langs->trans("Units"); // Do not use strtolower because it breaks utf8 encoding |
3921
|
|
- $outvallabel .= ' ' . $langs->transnoentities("Units"); |
|
3918
|
+ $optlabel .= ' - '.price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity; |
|
3919
|
+ $outvallabel .= ' - '.price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 0, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity; |
|
3920
|
+ $optlabel .= ' '.$langs->trans("Units"); // Do not use strtolower because it breaks utf8 encoding |
|
3921
|
+ $outvallabel .= ' '.$langs->transnoentities("Units"); |
3922
|
3922
|
} |
3923
|
3923
|
|
3924
|
3924
|
if ($objp->quantity > 1) { |
3925
|
|
- $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 |
3926
|
|
- $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 |
|
3925
|
+ $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 |
|
3926
|
+ $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 |
3927
|
3927
|
} |
3928
|
3928
|
if ($objp->remise_percent >= 1) { |
3929
|
|
- $optlabel .= " - " . $langs->trans("Discount") . " : " . vatrate($objp->remise_percent) . ' %'; |
3930
|
|
- $outvallabel .= " - " . $langs->transnoentities("Discount") . " : " . vatrate($objp->remise_percent) . ' %'; |
|
3929
|
+ $optlabel .= " - ".$langs->trans("Discount")." : ".vatrate($objp->remise_percent).' %'; |
|
3930
|
+ $outvallabel .= " - ".$langs->transnoentities("Discount")." : ".vatrate($objp->remise_percent).' %'; |
3931
|
3931
|
} |
3932
|
3932
|
if ($objp->duration) { |
3933
|
|
- $optlabel .= " - " . $objp->duration; |
3934
|
|
- $outvallabel .= " - " . $objp->duration; |
|
3933
|
+ $optlabel .= " - ".$objp->duration; |
|
3934
|
+ $outvallabel .= " - ".$objp->duration; |
3935
|
3935
|
} |
3936
|
3936
|
if (!$socid) { |
3937
|
|
- $optlabel .= " - " . dol_trunc($objp->name, 8); |
3938
|
|
- $outvallabel .= " - " . dol_trunc($objp->name, 8); |
|
3937
|
+ $optlabel .= " - ".dol_trunc($objp->name, 8); |
|
3938
|
+ $outvallabel .= " - ".dol_trunc($objp->name, 8); |
3939
|
3939
|
} |
3940
|
3940
|
if ($objp->supplier_reputation) { |
3941
|
3941
|
//TODO dictionary |
3942
|
3942
|
$reputations = array('' => $langs->trans('Standard'), 'FAVORITE' => $langs->trans('Favorite'), 'NOTTHGOOD' => $langs->trans('NotTheGoodQualitySupplier'), 'DONOTORDER' => $langs->trans('DoNotOrderThisProductToThisSupplier')); |
3943
|
3943
|
|
3944
|
|
- $optlabel .= " - " . $reputations[$objp->supplier_reputation]; |
3945
|
|
- $outvallabel .= " - " . $reputations[$objp->supplier_reputation]; |
|
3944
|
+ $optlabel .= " - ".$reputations[$objp->supplier_reputation]; |
|
3945
|
+ $outvallabel .= " - ".$reputations[$objp->supplier_reputation]; |
3946
|
3946
|
} |
3947
|
3947
|
} else { |
3948
|
|
- $optlabel .= " - <span class='opacitymedium'>" . $langs->trans("NoPriceDefinedForThisSupplier") . '</span>'; |
3949
|
|
- $outvallabel .= ' - ' . $langs->transnoentities("NoPriceDefinedForThisSupplier"); |
|
3948
|
+ $optlabel .= " - <span class='opacitymedium'>".$langs->trans("NoPriceDefinedForThisSupplier").'</span>'; |
|
3949
|
+ $outvallabel .= ' - '.$langs->transnoentities("NoPriceDefinedForThisSupplier"); |
3950
|
3950
|
} |
3951
|
3951
|
|
3952
|
3952
|
if (isModEnabled('stock') && $showstockinlist && isset($objp->stock) && ($objp->fk_product_type == Product::TYPE_PRODUCT || getDolGlobalString('STOCK_SUPPORTS_SERVICES'))) { |
3953
|
3953
|
$novirtualstock = ($showstockinlist == 2); |
3954
|
3954
|
|
3955
|
3955
|
if ($user->hasRight('stock', 'lire')) { |
3956
|
|
- $outvallabel .= ' - ' . $langs->trans("Stock") . ': ' . price(price2num($objp->stock, 'MS')); |
|
3956
|
+ $outvallabel .= ' - '.$langs->trans("Stock").': '.price(price2num($objp->stock, 'MS')); |
3957
|
3957
|
|
3958
|
3958
|
if ($objp->stock > 0) { |
3959
|
3959
|
$optlabel .= ' - <span class="product_line_stock_ok">'; |
3960
|
3960
|
} elseif ($objp->stock <= 0) { |
3961
|
3961
|
$optlabel .= ' - <span class="product_line_stock_too_low">'; |
3962
|
3962
|
} |
3963
|
|
- $optlabel .= $langs->transnoentities("Stock") . ':' . price(price2num($objp->stock, 'MS')); |
|
3963
|
+ $optlabel .= $langs->transnoentities("Stock").':'.price(price2num($objp->stock, 'MS')); |
3964
|
3964
|
$optlabel .= '</span>'; |
3965
|
3965
|
if (empty($novirtualstock) && getDolGlobalString('STOCK_SHOW_VIRTUAL_STOCK_IN_PRODUCTS_COMBO')) { // Warning, this option may slow down combo list generation |
3966
|
3966
|
$langs->load("stocks"); |
|
@@ -3970,9 +3970,9 @@ discard block |
|
|
block discarded – undo |
3970
|
3970
|
$tmpproduct->load_virtual_stock(); |
3971
|
3971
|
$virtualstock = $tmpproduct->stock_theorique; |
3972
|
3972
|
|
3973
|
|
- $outvallabel .= ' - ' . $langs->trans("VirtualStock") . ':' . $virtualstock; |
|
3973
|
+ $outvallabel .= ' - '.$langs->trans("VirtualStock").':'.$virtualstock; |
3974
|
3974
|
|
3975
|
|
- $optlabel .= ' - ' . $langs->transnoentities("VirtualStock") . ':'; |
|
3975
|
+ $optlabel .= ' - '.$langs->transnoentities("VirtualStock").':'; |
3976
|
3976
|
if ($virtualstock > 0) { |
3977
|
3977
|
$optlabel .= '<span class="product_line_stock_ok">'; |
3978
|
3978
|
} elseif ($virtualstock <= 0) { |
|
@@ -3986,7 +3986,7 @@ discard block |
|
|
block discarded – undo |
3986
|
3986
|
} |
3987
|
3987
|
} |
3988
|
3988
|
|
3989
|
|
- $optstart = '<option value="' . $outkey . '"'; |
|
3989
|
+ $optstart = '<option value="'.$outkey.'"'; |
3990
|
3990
|
if ($selected && $selected == $objp->idprodfournprice) { |
3991
|
3991
|
$optstart .= ' selected'; |
3992
|
3992
|
} |
|
@@ -3995,31 +3995,31 @@ discard block |
|
|
block discarded – undo |
3995
|
3995
|
} |
3996
|
3996
|
|
3997
|
3997
|
if (!empty($objp->idprodfournprice) && $objp->idprodfournprice > 0) { |
3998
|
|
- $optstart .= ' data-product-id="' . dol_escape_htmltag($objp->rowid) . '"'; |
3999
|
|
- $optstart .= ' data-price-id="' . dol_escape_htmltag($objp->idprodfournprice) . '"'; |
4000
|
|
- $optstart .= ' data-qty="' . dol_escape_htmltag($objp->quantity) . '"'; |
4001
|
|
- $optstart .= ' data-up="' . dol_escape_htmltag(price2num($objp->unitprice)) . '"'; |
4002
|
|
- $optstart .= ' data-up-locale="' . dol_escape_htmltag(price($objp->unitprice)) . '"'; |
4003
|
|
- $optstart .= ' data-discount="' . dol_escape_htmltag($outdiscount) . '"'; |
4004
|
|
- $optstart .= ' data-tvatx="' . dol_escape_htmltag(price2num($objp->tva_tx)) . '"'; |
4005
|
|
- $optstart .= ' data-tvatx-formated="' . dol_escape_htmltag(price($objp->tva_tx, 0, $langs, 1, -1, 2)) . '"'; |
4006
|
|
- $optstart .= ' data-default-vat-code="' . dol_escape_htmltag($objp->default_vat_code) . '"'; |
4007
|
|
- $optstart .= ' data-supplier-ref="' . dol_escape_htmltag($objp->ref_fourn) . '"'; |
|
3998
|
+ $optstart .= ' data-product-id="'.dol_escape_htmltag($objp->rowid).'"'; |
|
3999
|
+ $optstart .= ' data-price-id="'.dol_escape_htmltag($objp->idprodfournprice).'"'; |
|
4000
|
+ $optstart .= ' data-qty="'.dol_escape_htmltag($objp->quantity).'"'; |
|
4001
|
+ $optstart .= ' data-up="'.dol_escape_htmltag(price2num($objp->unitprice)).'"'; |
|
4002
|
+ $optstart .= ' data-up-locale="'.dol_escape_htmltag(price($objp->unitprice)).'"'; |
|
4003
|
+ $optstart .= ' data-discount="'.dol_escape_htmltag($outdiscount).'"'; |
|
4004
|
+ $optstart .= ' data-tvatx="'.dol_escape_htmltag(price2num($objp->tva_tx)).'"'; |
|
4005
|
+ $optstart .= ' data-tvatx-formated="'.dol_escape_htmltag(price($objp->tva_tx, 0, $langs, 1, -1, 2)).'"'; |
|
4006
|
+ $optstart .= ' data-default-vat-code="'.dol_escape_htmltag($objp->default_vat_code).'"'; |
|
4007
|
+ $optstart .= ' data-supplier-ref="'.dol_escape_htmltag($objp->ref_fourn).'"'; |
4008
|
4008
|
if (isModEnabled('multicurrency')) { |
4009
|
|
- $optstart .= ' data-multicurrency-code="' . dol_escape_htmltag($objp->multicurrency_code) . '"'; |
4010
|
|
- $optstart .= ' data-multicurrency-up="' . dol_escape_htmltag($objp->multicurrency_unitprice) . '"'; |
|
4009
|
+ $optstart .= ' data-multicurrency-code="'.dol_escape_htmltag($objp->multicurrency_code).'"'; |
|
4010
|
+ $optstart .= ' data-multicurrency-up="'.dol_escape_htmltag($objp->multicurrency_unitprice).'"'; |
4011
|
4011
|
} |
4012
|
4012
|
} |
4013
|
|
- $optstart .= ' data-description="' . dol_escape_htmltag($objp->description, 0, 1) . '"'; |
|
4013
|
+ $optstart .= ' data-description="'.dol_escape_htmltag($objp->description, 0, 1).'"'; |
4014
|
4014
|
|
4015
|
4015
|
$outarrayentry = array( |
4016
|
4016
|
'key' => $outkey, |
4017
|
4017
|
'value' => $outref, |
4018
|
4018
|
'label' => $outvallabel, |
4019
|
4019
|
'qty' => $outqty, |
4020
|
|
- 'price_qty_ht' => price2num($objp->fprice, 'MU'), // Keep higher resolution for price for the min qty |
4021
|
|
- 'price_unit_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price |
4022
|
|
- 'price_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price (for compatibility) |
|
4020
|
+ 'price_qty_ht' => price2num($objp->fprice, 'MU'), // Keep higher resolution for price for the min qty |
|
4021
|
+ 'price_unit_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price |
|
4022
|
+ 'price_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price (for compatibility) |
4023
|
4023
|
'tva_tx_formated' => price($objp->tva_tx, 0, $langs, 1, -1, 2), |
4024
|
4024
|
'tva_tx' => price2num($objp->tva_tx), |
4025
|
4025
|
'default_vat_code' => $objp->default_vat_code, |
|
@@ -4049,17 +4049,17 @@ discard block |
|
|
block discarded – undo |
4049
|
4049
|
// Add new entry |
4050
|
4050
|
// "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 |
4051
|
4051
|
// "label" value of json key array is used by jQuery automatically as text for combo box |
4052
|
|
- $out .= $optstart . ' data-html="' . dol_escape_htmltag($optlabel) . '">' . $optlabel . "</option>\n"; |
|
4052
|
+ $out .= $optstart.' data-html="'.dol_escape_htmltag($optlabel).'">'.$optlabel."</option>\n"; |
4053
|
4053
|
$outarraypush = array( |
4054
|
4054
|
'key' => $outkey, |
4055
|
4055
|
'value' => $outref, |
4056
|
4056
|
'label' => $outvallabel, |
4057
|
4057
|
'qty' => $outqty, |
4058
|
|
- 'price_qty_ht' => price2num($objp->fprice, 'MU'), // Keep higher resolution for price for the min qty |
|
4058
|
+ 'price_qty_ht' => price2num($objp->fprice, 'MU'), // Keep higher resolution for price for the min qty |
4059
|
4059
|
'price_qty_ht_locale' => price($objp->fprice), |
4060
|
|
- 'price_unit_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price |
|
4060
|
+ 'price_unit_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price |
4061
|
4061
|
'price_unit_ht_locale' => price($objp->unitprice), |
4062
|
|
- 'price_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price (for compatibility) |
|
4062
|
+ 'price_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price (for compatibility) |
4063
|
4063
|
'tva_tx_formated' => price($objp->tva_tx), |
4064
|
4064
|
'tva_tx' => price2num($objp->tva_tx), |
4065
|
4065
|
'default_vat_code' => $objp->default_vat_code, |
|
@@ -4092,7 +4092,7 @@ discard block |
|
|
block discarded – undo |
4092
|
4092
|
|
4093
|
4093
|
$this->db->free($result); |
4094
|
4094
|
|
4095
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
4095
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
4096
|
4096
|
$out .= ajax_combobox($htmlname); |
4097
|
4097
|
} else { |
4098
|
4098
|
dol_print_error($this->db); |
|
@@ -4124,43 +4124,43 @@ discard block |
|
|
block discarded – undo |
4124
|
4124
|
$sql = "SELECT p.rowid, p.ref, p.label, p.price, p.duration, pfp.fk_soc,"; |
4125
|
4125
|
$sql .= " pfp.ref_fourn, pfp.rowid as idprodfournprice, pfp.price as fprice, pfp.remise_percent, pfp.quantity, pfp.unitprice,"; |
4126
|
4126
|
$sql .= " pfp.fk_supplier_price_expression, pfp.fk_product, pfp.tva_tx, s.nom as name"; |
4127
|
|
- $sql .= " FROM " . $this->db->prefix() . "product as p"; |
4128
|
|
- $sql .= " LEFT JOIN " . $this->db->prefix() . "product_fournisseur_price as pfp ON p.rowid = pfp.fk_product"; |
4129
|
|
- $sql .= " LEFT JOIN " . $this->db->prefix() . "societe as s ON pfp.fk_soc = s.rowid"; |
4130
|
|
- $sql .= " WHERE pfp.entity IN (" . getEntity('productsupplierprice') . ")"; |
|
4127
|
+ $sql .= " FROM ".$this->db->prefix()."product as p"; |
|
4128
|
+ $sql .= " LEFT JOIN ".$this->db->prefix()."product_fournisseur_price as pfp ON p.rowid = pfp.fk_product"; |
|
4129
|
+ $sql .= " LEFT JOIN ".$this->db->prefix()."societe as s ON pfp.fk_soc = s.rowid"; |
|
4130
|
+ $sql .= " WHERE pfp.entity IN (".getEntity('productsupplierprice').")"; |
4131
|
4131
|
$sql .= " AND p.tobuy = 1"; |
4132
|
4132
|
$sql .= " AND s.fournisseur = 1"; |
4133
|
|
- $sql .= " AND p.rowid = " . ((int) $productid); |
|
4133
|
+ $sql .= " AND p.rowid = ".((int) $productid); |
4134
|
4134
|
if (!getDolGlobalString('PRODUCT_BEST_SUPPLIER_PRICE_PRESELECTED')) { |
4135
|
4135
|
$sql .= " ORDER BY s.nom, pfp.ref_fourn DESC"; |
4136
|
4136
|
} else { |
4137
|
4137
|
$sql .= " ORDER BY pfp.unitprice ASC"; |
4138
|
4138
|
} |
4139
|
4139
|
|
4140
|
|
- dol_syslog(get_class($this) . "::select_product_fourn_price", LOG_DEBUG); |
|
4140
|
+ dol_syslog(get_class($this)."::select_product_fourn_price", LOG_DEBUG); |
4141
|
4141
|
$result = $this->db->query($sql); |
4142
|
4142
|
|
4143
|
4143
|
if ($result) { |
4144
|
4144
|
$num = $this->db->num_rows($result); |
4145
|
4145
|
|
4146
|
|
- $form = '<select class="flat" id="select_' . $htmlname . '" name="' . $htmlname . '">'; |
|
4146
|
+ $form = '<select class="flat" id="select_'.$htmlname.'" name="'.$htmlname.'">'; |
4147
|
4147
|
|
4148
|
4148
|
if (!$num) { |
4149
|
|
- $form .= '<option value="0">-- ' . $langs->trans("NoSupplierPriceDefinedForThisProduct") . ' --</option>'; |
|
4149
|
+ $form .= '<option value="0">-- '.$langs->trans("NoSupplierPriceDefinedForThisProduct").' --</option>'; |
4150
|
4150
|
} else { |
4151
|
|
- require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php'; |
|
4151
|
+ require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php'; |
4152
|
4152
|
$form .= '<option value="0"> </option>'; |
4153
|
4153
|
|
4154
|
4154
|
$i = 0; |
4155
|
4155
|
while ($i < $num) { |
4156
|
4156
|
$objp = $this->db->fetch_object($result); |
4157
|
4157
|
|
4158
|
|
- $opt = '<option value="' . $objp->idprodfournprice . '"'; |
|
4158
|
+ $opt = '<option value="'.$objp->idprodfournprice.'"'; |
4159
|
4159
|
//if there is only one supplier, preselect it |
4160
|
4160
|
if ($num == 1 || ($selected_supplier > 0 && $objp->fk_soc == $selected_supplier) || ($i == 0 && getDolGlobalString('PRODUCT_BEST_SUPPLIER_PRICE_PRESELECTED'))) { |
4161
|
4161
|
$opt .= ' selected'; |
4162
|
4162
|
} |
4163
|
|
- $opt .= '>' . $objp->name . ' - ' . $objp->ref_fourn . ' - '; |
|
4163
|
+ $opt .= '>'.$objp->name.' - '.$objp->ref_fourn.' - '; |
4164
|
4164
|
|
4165
|
4165
|
if (isModEnabled('dynamicprices') && !empty($objp->fk_supplier_price_expression)) { |
4166
|
4166
|
$prod_supplier = new ProductFournisseur($this->db); |
|
@@ -4170,7 +4170,7 @@ discard block |
|
|
block discarded – undo |
4170
|
4170
|
$prod_supplier->fourn_tva_tx = $objp->tva_tx; |
4171
|
4171
|
$prod_supplier->fk_supplier_price_expression = $objp->fk_supplier_price_expression; |
4172
|
4172
|
|
4173
|
|
- require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php'; |
|
4173
|
+ require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php'; |
4174
|
4174
|
$priceparser = new PriceParser($this->db); |
4175
|
4175
|
$price_result = $priceparser->parseProductSupplier($prod_supplier); |
4176
|
4176
|
if ($price_result >= 0) { |
|
@@ -4181,10 +4181,10 @@ discard block |
|
|
block discarded – undo |
4181
|
4181
|
} |
4182
|
4182
|
} |
4183
|
4183
|
if ($objp->quantity == 1) { |
4184
|
|
- $opt .= price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency) . "/"; |
|
4184
|
+ $opt .= price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency)."/"; |
4185
|
4185
|
} |
4186
|
4186
|
|
4187
|
|
- $opt .= $objp->quantity . ' '; |
|
4187
|
+ $opt .= $objp->quantity.' '; |
4188
|
4188
|
|
4189
|
4189
|
if ($objp->quantity == 1) { |
4190
|
4190
|
$opt .= $langs->trans("Unit"); |
|
@@ -4193,10 +4193,10 @@ discard block |
|
|
block discarded – undo |
4193
|
4193
|
} |
4194
|
4194
|
if ($objp->quantity > 1) { |
4195
|
4195
|
$opt .= " - "; |
4196
|
|
- $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"); |
|
4196
|
+ $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
|
4197
|
} |
4198
|
4198
|
if ($objp->duration) { |
4199
|
|
- $opt .= " - " . $objp->duration; |
|
4199
|
+ $opt .= " - ".$objp->duration; |
4200
|
4200
|
} |
4201
|
4201
|
$opt .= "</option>\n"; |
4202
|
4202
|
|
|
@@ -4234,8 +4234,8 @@ discard block |
|
|
block discarded – undo |
4234
|
4234
|
dol_syslog(__METHOD__, LOG_DEBUG); |
4235
|
4235
|
|
4236
|
4236
|
$sql = "SELECT rowid, code, libelle as label, deposit_percent"; |
4237
|
|
- $sql .= " FROM " . $this->db->prefix() . 'c_payment_term'; |
4238
|
|
- $sql .= " WHERE entity IN (" . getEntity('c_payment_term') . ")"; |
|
4237
|
+ $sql .= " FROM ".$this->db->prefix().'c_payment_term'; |
|
4238
|
+ $sql .= " WHERE entity IN (".getEntity('c_payment_term').")"; |
4239
|
4239
|
$sql .= " AND active > 0"; |
4240
|
4240
|
$sql .= " ORDER BY sortorder"; |
4241
|
4241
|
|
|
@@ -4247,7 +4247,7 @@ discard block |
|
|
block discarded – undo |
4247
|
4247
|
$obj = $this->db->fetch_object($resql); |
4248
|
4248
|
|
4249
|
4249
|
// Si traduction existe, on l'utilise, sinon on prend le libelle par default |
4250
|
|
- $label = ($langs->trans("PaymentConditionShort" . $obj->code) != "PaymentConditionShort" . $obj->code ? $langs->trans("PaymentConditionShort" . $obj->code) : ($obj->label != '-' ? $obj->label : '')); |
|
4250
|
+ $label = ($langs->trans("PaymentConditionShort".$obj->code) != "PaymentConditionShort".$obj->code ? $langs->trans("PaymentConditionShort".$obj->code) : ($obj->label != '-' ? $obj->label : '')); |
4251
|
4251
|
$this->cache_conditions_paiements[$obj->rowid]['code'] = $obj->code; |
4252
|
4252
|
$this->cache_conditions_paiements[$obj->rowid]['label'] = $label; |
4253
|
4253
|
$this->cache_conditions_paiements[$obj->rowid]['deposit_percent'] = $obj->deposit_percent; |
|
@@ -4275,7 +4275,7 @@ discard block |
|
|
block discarded – undo |
4275
|
4275
|
// phpcs:enable |
4276
|
4276
|
global $langs; |
4277
|
4277
|
|
4278
|
|
- $num = count($this->cache_availability); // TODO Use $conf->cache['availability'] instead of $this->cache_availability |
|
4278
|
+ $num = count($this->cache_availability); // TODO Use $conf->cache['availability'] instead of $this->cache_availability |
4279
|
4279
|
if ($num > 0) { |
4280
|
4280
|
return 0; // Cache already loaded |
4281
|
4281
|
} |
|
@@ -4285,7 +4285,7 @@ discard block |
|
|
block discarded – undo |
4285
|
4285
|
$langs->load('propal'); |
4286
|
4286
|
|
4287
|
4287
|
$sql = "SELECT rowid, code, label, position"; |
4288
|
|
- $sql .= " FROM " . $this->db->prefix() . 'c_availability'; |
|
4288
|
+ $sql .= " FROM ".$this->db->prefix().'c_availability'; |
4289
|
4289
|
$sql .= " WHERE active > 0"; |
4290
|
4290
|
|
4291
|
4291
|
$resql = $this->db->query($sql); |
|
@@ -4296,7 +4296,7 @@ discard block |
|
|
block discarded – undo |
4296
|
4296
|
$obj = $this->db->fetch_object($resql); |
4297
|
4297
|
|
4298
|
4298
|
// Si traduction existe, on l'utilise, sinon on prend le libelle par default |
4299
|
|
- $label = ($langs->trans("AvailabilityType" . $obj->code) != "AvailabilityType" . $obj->code ? $langs->trans("AvailabilityType" . $obj->code) : ($obj->label != '-' ? $obj->label : '')); |
|
4299
|
+ $label = ($langs->trans("AvailabilityType".$obj->code) != "AvailabilityType".$obj->code ? $langs->trans("AvailabilityType".$obj->code) : ($obj->label != '-' ? $obj->label : '')); |
4300
|
4300
|
$this->cache_availability[$obj->rowid]['code'] = $obj->code; |
4301
|
4301
|
$this->cache_availability[$obj->rowid]['label'] = $label; |
4302
|
4302
|
$this->cache_availability[$obj->rowid]['position'] = $obj->position; |
|
@@ -4328,17 +4328,17 @@ discard block |
|
|
block discarded – undo |
4328
|
4328
|
|
4329
|
4329
|
$this->load_cache_availability(); |
4330
|
4330
|
|
4331
|
|
- dol_syslog(__METHOD__ . " selected=" . $selected . ", htmlname=" . $htmlname, LOG_DEBUG); |
|
4331
|
+ dol_syslog(__METHOD__." selected=".$selected.", htmlname=".$htmlname, LOG_DEBUG); |
4332
|
4332
|
|
4333
|
|
- print '<select id="' . $htmlname . '" class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">'; |
|
4333
|
+ print '<select id="'.$htmlname.'" class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">'; |
4334
|
4334
|
if ($addempty) { |
4335
|
4335
|
print '<option value="0"> </option>'; |
4336
|
4336
|
} |
4337
|
4337
|
foreach ($this->cache_availability as $id => $arrayavailability) { |
4338
|
4338
|
if ($selected == $id) { |
4339
|
|
- print '<option value="' . $id . '" selected>'; |
|
4339
|
+ print '<option value="'.$id.'" selected>'; |
4340
|
4340
|
} else { |
4341
|
|
- print '<option value="' . $id . '">'; |
|
4341
|
+ print '<option value="'.$id.'">'; |
4342
|
4342
|
} |
4343
|
4343
|
print dol_escape_htmltag($arrayavailability['label']); |
4344
|
4344
|
print '</option>'; |
|
@@ -4359,13 +4359,13 @@ discard block |
|
|
block discarded – undo |
4359
|
4359
|
{ |
4360
|
4360
|
global $langs; |
4361
|
4361
|
|
4362
|
|
- $num = count($this->cache_demand_reason); // TODO Use $conf->cache['input_reason'] instead of $this->cache_demand_reason |
|
4362
|
+ $num = count($this->cache_demand_reason); // TODO Use $conf->cache['input_reason'] instead of $this->cache_demand_reason |
4363
|
4363
|
if ($num > 0) { |
4364
|
4364
|
return 0; // Cache already loaded |
4365
|
4365
|
} |
4366
|
4366
|
|
4367
|
4367
|
$sql = "SELECT rowid, code, label"; |
4368
|
|
- $sql .= " FROM " . $this->db->prefix() . 'c_input_reason'; |
|
4368
|
+ $sql .= " FROM ".$this->db->prefix().'c_input_reason'; |
4369
|
4369
|
$sql .= " WHERE active > 0"; |
4370
|
4370
|
|
4371
|
4371
|
$resql = $this->db->query($sql); |
|
@@ -4378,8 +4378,8 @@ discard block |
|
|
block discarded – undo |
4378
|
4378
|
|
4379
|
4379
|
// Si traduction existe, on l'utilise, sinon on prend le libelle par default |
4380
|
4380
|
$label = ($obj->label != '-' ? $obj->label : ''); |
4381
|
|
- if ($langs->trans("DemandReasonType" . $obj->code) != "DemandReasonType" . $obj->code) { |
4382
|
|
- $label = $langs->trans("DemandReasonType" . $obj->code); // So translation key DemandReasonTypeSRC_XXX will work |
|
4381
|
+ if ($langs->trans("DemandReasonType".$obj->code) != "DemandReasonType".$obj->code) { |
|
4382
|
+ $label = $langs->trans("DemandReasonType".$obj->code); // So translation key DemandReasonTypeSRC_XXX will work |
4383
|
4383
|
} |
4384
|
4384
|
if ($langs->trans($obj->code) != $obj->code) { |
4385
|
4385
|
$label = $langs->trans($obj->code); // So translation key SRC_XXX will work |
|
@@ -4419,9 +4419,9 @@ discard block |
|
|
block discarded – undo |
4419
|
4419
|
|
4420
|
4420
|
$this->loadCacheInputReason(); |
4421
|
4421
|
|
4422
|
|
- print '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" id="select_' . $htmlname . '" name="' . $htmlname . '">'; |
|
4422
|
+ print '<select class="flat'.($morecss ? ' '.$morecss : '').'" id="select_'.$htmlname.'" name="'.$htmlname.'">'; |
4423
|
4423
|
if ($addempty) { |
4424
|
|
- print '<option value="0"' . (empty($selected) ? ' selected' : '') . '> </option>'; |
|
4424
|
+ print '<option value="0"'.(empty($selected) ? ' selected' : '').'> </option>'; |
4425
|
4425
|
} |
4426
|
4426
|
foreach ($this->cache_demand_reason as $id => $arraydemandreason) { |
4427
|
4427
|
if ($arraydemandreason['code'] == $exclude) { |
|
@@ -4429,9 +4429,9 @@ discard block |
|
|
block discarded – undo |
4429
|
4429
|
} |
4430
|
4430
|
|
4431
|
4431
|
if ($selected && ($selected == $arraydemandreason['id'] || $selected == $arraydemandreason['code'])) { |
4432
|
|
- print '<option value="' . $arraydemandreason['id'] . '" selected>'; |
|
4432
|
+ print '<option value="'.$arraydemandreason['id'].'" selected>'; |
4433
|
4433
|
} else { |
4434
|
|
- print '<option value="' . $arraydemandreason['id'] . '">'; |
|
4434
|
+ print '<option value="'.$arraydemandreason['id'].'">'; |
4435
|
4435
|
} |
4436
|
4436
|
$label = $arraydemandreason['label']; // Translation of label was already done into the ->loadCacheInputReason |
4437
|
4437
|
print $langs->trans($label); |
|
@@ -4441,7 +4441,7 @@ discard block |
|
|
block discarded – undo |
4441
|
4441
|
if ($user->admin && empty($notooltip)) { |
4442
|
4442
|
print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); |
4443
|
4443
|
} |
4444
|
|
- print ajax_combobox('select_' . $htmlname); |
|
4444
|
+ print ajax_combobox('select_'.$htmlname); |
4445
|
4445
|
} |
4446
|
4446
|
|
4447
|
4447
|
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
@@ -4456,7 +4456,7 @@ discard block |
|
|
block discarded – undo |
4456
|
4456
|
// phpcs:enable |
4457
|
4457
|
global $langs; |
4458
|
4458
|
|
4459
|
|
- $num = count($this->cache_types_paiements); // TODO Use $conf->cache['payment_mode'] instead of $this->cache_types_paiements |
|
4459
|
+ $num = count($this->cache_types_paiements); // TODO Use $conf->cache['payment_mode'] instead of $this->cache_types_paiements |
4460
|
4460
|
if ($num > 0) { |
4461
|
4461
|
return $num; // Cache already loaded |
4462
|
4462
|
} |
|
@@ -4466,8 +4466,8 @@ discard block |
|
|
block discarded – undo |
4466
|
4466
|
$this->cache_types_paiements = array(); |
4467
|
4467
|
|
4468
|
4468
|
$sql = "SELECT id, code, libelle as label, type, active"; |
4469
|
|
- $sql .= " FROM " . $this->db->prefix() . "c_paiement"; |
4470
|
|
- $sql .= " WHERE entity IN (" . getEntity('c_paiement') . ")"; |
|
4469
|
+ $sql .= " FROM ".$this->db->prefix()."c_paiement"; |
|
4470
|
+ $sql .= " WHERE entity IN (".getEntity('c_paiement').")"; |
4471
|
4471
|
|
4472
|
4472
|
$resql = $this->db->query($sql); |
4473
|
4473
|
if ($resql) { |
|
@@ -4477,7 +4477,7 @@ discard block |
|
|
block discarded – undo |
4477
|
4477
|
$obj = $this->db->fetch_object($resql); |
4478
|
4478
|
|
4479
|
4479
|
// Si traduction existe, on l'utilise, sinon on prend le libelle par default |
4480
|
|
- $label = ($langs->transnoentitiesnoconv("PaymentTypeShort" . $obj->code) != "PaymentTypeShort" . $obj->code ? $langs->transnoentitiesnoconv("PaymentTypeShort" . $obj->code) : ($obj->label != '-' ? $obj->label : '')); |
|
4480
|
+ $label = ($langs->transnoentitiesnoconv("PaymentTypeShort".$obj->code) != "PaymentTypeShort".$obj->code ? $langs->transnoentitiesnoconv("PaymentTypeShort".$obj->code) : ($obj->label != '-' ? $obj->label : '')); |
4481
|
4481
|
$this->cache_types_paiements[$obj->id]['id'] = $obj->id; |
4482
|
4482
|
$this->cache_types_paiements[$obj->id]['code'] = $obj->code; |
4483
|
4483
|
$this->cache_types_paiements[$obj->id]['label'] = $label; |
|
@@ -4549,17 +4549,17 @@ discard block |
|
|
block discarded – undo |
4549
|
4549
|
global $langs, $user, $conf; |
4550
|
4550
|
|
4551
|
4551
|
$out = ''; |
4552
|
|
- dol_syslog(__METHOD__ . " selected=" . $selected . ", htmlname=" . $htmlname, LOG_DEBUG); |
|
4552
|
+ dol_syslog(__METHOD__." selected=".$selected.", htmlname=".$htmlname, LOG_DEBUG); |
4553
|
4553
|
|
4554
|
4554
|
$this->load_cache_conditions_paiements(); |
4555
|
4555
|
|
4556
|
4556
|
// Set default value if not already set by caller |
4557
|
4557
|
if (empty($selected) && getDolGlobalString('MAIN_DEFAULT_PAYMENT_TERM_ID')) { |
4558
|
|
- dol_syslog(__METHOD__ . "Using deprecated option MAIN_DEFAULT_PAYMENT_TERM_ID", LOG_NOTICE); |
|
4558
|
+ dol_syslog(__METHOD__."Using deprecated option MAIN_DEFAULT_PAYMENT_TERM_ID", LOG_NOTICE); |
4559
|
4559
|
$selected = getDolGlobalString('MAIN_DEFAULT_PAYMENT_TERM_ID'); |
4560
|
4560
|
} |
4561
|
4561
|
|
4562
|
|
- $out .= '<select id="' . $htmlname . '" class="flat selectpaymentterms' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">'; |
|
4562
|
+ $out .= '<select id="'.$htmlname.'" class="flat selectpaymentterms'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">'; |
4563
|
4563
|
if ($addempty) { |
4564
|
4564
|
$out .= '<option value="0"> </option>'; |
4565
|
4565
|
} |
|
@@ -4573,9 +4573,9 @@ discard block |
|
|
block discarded – undo |
4573
|
4573
|
|
4574
|
4574
|
if ($selected == $id) { |
4575
|
4575
|
$selectedDepositPercent = $deposit_percent > 0 ? $deposit_percent : $arrayconditions['deposit_percent']; |
4576
|
|
- $out .= '<option value="' . $id . '" data-deposit_percent="' . $arrayconditions['deposit_percent'] . '" selected>'; |
|
4576
|
+ $out .= '<option value="'.$id.'" data-deposit_percent="'.$arrayconditions['deposit_percent'].'" selected>'; |
4577
|
4577
|
} else { |
4578
|
|
- $out .= '<option value="' . $id . '" data-deposit_percent="' . $arrayconditions['deposit_percent'] . '">'; |
|
4578
|
+ $out .= '<option value="'.$id.'" data-deposit_percent="'.$arrayconditions['deposit_percent'].'">'; |
4579
|
4579
|
} |
4580
|
4580
|
$label = $arrayconditions['label']; |
4581
|
4581
|
|
|
@@ -4593,21 +4593,21 @@ discard block |
|
|
block discarded – undo |
4593
|
4593
|
$out .= ajax_combobox($htmlname); |
4594
|
4594
|
|
4595
|
4595
|
if ($deposit_percent >= 0) { |
4596
|
|
- $out .= ' <span id="' . $htmlname . '_deposit_percent_container"' . (empty($selectedDepositPercent) ? ' style="display: none"' : '') . '>'; |
4597
|
|
- $out .= $langs->trans('DepositPercent') . ' : '; |
4598
|
|
- $out .= '<input id="' . $htmlname . '_deposit_percent" name="' . $htmlname . '_deposit_percent" class="maxwidth50" value="' . $deposit_percent . '" />'; |
|
4596
|
+ $out .= ' <span id="'.$htmlname.'_deposit_percent_container"'.(empty($selectedDepositPercent) ? ' style="display: none"' : '').'>'; |
|
4597
|
+ $out .= $langs->trans('DepositPercent').' : '; |
|
4598
|
+ $out .= '<input id="'.$htmlname.'_deposit_percent" name="'.$htmlname.'_deposit_percent" class="maxwidth50" value="'.$deposit_percent.'" />'; |
4599
|
4599
|
$out .= '</span>'; |
4600
|
4600
|
$out .= ' |
4601
|
|
- <script nonce="' . getNonce() . '"> |
|
4601
|
+ <script nonce="' . getNonce().'"> |
4602
|
4602
|
$(document).ready(function () { |
4603
|
|
- $("#' . $htmlname . '").change(function () { |
|
4603
|
+ $("#' . $htmlname.'").change(function () { |
4604
|
4604
|
let $selected = $(this).find("option:selected"); |
4605
|
4605
|
let depositPercent = $selected.attr("data-deposit_percent"); |
4606
|
4606
|
|
4607
|
4607
|
if (depositPercent.length > 0) { |
4608
|
|
- $("#' . $htmlname . '_deposit_percent_container").show().find("#' . $htmlname . '_deposit_percent").val(depositPercent); |
|
4608
|
+ $("#' . $htmlname.'_deposit_percent_container").show().find("#'.$htmlname.'_deposit_percent").val(depositPercent); |
4609
|
4609
|
} else { |
4610
|
|
- $("#' . $htmlname . '_deposit_percent_container").hide(); |
|
4610
|
+ $("#' . $htmlname.'_deposit_percent_container").hide(); |
4611
|
4611
|
} |
4612
|
4612
|
|
4613
|
4613
|
return true; |
|
@@ -4645,7 +4645,7 @@ discard block |
|
|
block discarded – undo |
4645
|
4645
|
|
4646
|
4646
|
$out = ''; |
4647
|
4647
|
|
4648
|
|
- dol_syslog(__METHOD__ . " " . $selected . ", " . $htmlname . ", " . $filtertype . ", " . $format, LOG_DEBUG); |
|
4648
|
+ dol_syslog(__METHOD__." ".$selected.", ".$htmlname.", ".$filtertype.", ".$format, LOG_DEBUG); |
4649
|
4649
|
|
4650
|
4650
|
$filterarray = array(); |
4651
|
4651
|
if ($filtertype == 'CRDT') { |
|
@@ -4660,11 +4660,11 @@ discard block |
|
|
block discarded – undo |
4660
|
4660
|
|
4661
|
4661
|
// Set default value if not already set by caller |
4662
|
4662
|
if (empty($selected) && getDolGlobalString('MAIN_DEFAULT_PAYMENT_TYPE_ID')) { |
4663
|
|
- dol_syslog(__METHOD__ . "Using deprecated option MAIN_DEFAULT_PAYMENT_TYPE_ID", LOG_NOTICE); |
|
4663
|
+ dol_syslog(__METHOD__."Using deprecated option MAIN_DEFAULT_PAYMENT_TYPE_ID", LOG_NOTICE); |
4664
|
4664
|
$selected = getDolGlobalString('MAIN_DEFAULT_PAYMENT_TYPE_ID'); |
4665
|
4665
|
} |
4666
|
4666
|
|
4667
|
|
- $out .= '<select id="select' . $htmlname . '" class="flat selectpaymenttypes' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">'; |
|
4667
|
+ $out .= '<select id="select'.$htmlname.'" class="flat selectpaymenttypes'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">'; |
4668
|
4668
|
if ($empty) { |
4669
|
4669
|
$out .= '<option value=""> </option>'; |
4670
|
4670
|
} |
|
@@ -4685,13 +4685,13 @@ discard block |
|
|
block discarded – undo |
4685
|
4685
|
} |
4686
|
4686
|
|
4687
|
4687
|
if ($format == 0) { |
4688
|
|
- $out .= '<option value="' . $id . '"'; |
|
4688
|
+ $out .= '<option value="'.$id.'"'; |
4689
|
4689
|
} elseif ($format == 1) { |
4690
|
|
- $out .= '<option value="' . $arraytypes['code'] . '"'; |
|
4690
|
+ $out .= '<option value="'.$arraytypes['code'].'"'; |
4691
|
4691
|
} elseif ($format == 2) { |
4692
|
|
- $out .= '<option value="' . $arraytypes['code'] . '"'; |
|
4692
|
+ $out .= '<option value="'.$arraytypes['code'].'"'; |
4693
|
4693
|
} elseif ($format == 3) { |
4694
|
|
- $out .= '<option value="' . $id . '"'; |
|
4694
|
+ $out .= '<option value="'.$id.'"'; |
4695
|
4695
|
} |
4696
|
4696
|
// Print attribute selected or not |
4697
|
4697
|
if ($format == 1 || $format == 2) { |
|
@@ -4721,7 +4721,7 @@ discard block |
|
|
block discarded – undo |
4721
|
4721
|
if ($user->admin && !$noadmininfo) { |
4722
|
4722
|
$out .= info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); |
4723
|
4723
|
} |
4724
|
|
- $out .= ajax_combobox('select' . $htmlname); |
|
4724
|
+ $out .= ajax_combobox('select'.$htmlname); |
4725
|
4725
|
|
4726
|
4726
|
if (empty($nooutput)) { |
4727
|
4727
|
print $out; |
|
@@ -4743,22 +4743,22 @@ discard block |
|
|
block discarded – undo |
4743
|
4743
|
{ |
4744
|
4744
|
global $langs; |
4745
|
4745
|
|
4746
|
|
- $return = '<select class="flat maxwidth100" id="select_' . $htmlname . '" name="' . $htmlname . '">'; |
|
4746
|
+ $return = '<select class="flat maxwidth100" id="select_'.$htmlname.'" name="'.$htmlname.'">'; |
4747
|
4747
|
$options = array( |
4748
|
4748
|
'HT' => $langs->trans("HT"), |
4749
|
4749
|
'TTC' => $langs->trans("TTC") |
4750
|
4750
|
); |
4751
|
4751
|
foreach ($options as $id => $value) { |
4752
|
4752
|
if ($selected == $id) { |
4753
|
|
- $return .= '<option value="' . $id . '" selected>' . $value; |
|
4753
|
+ $return .= '<option value="'.$id.'" selected>'.$value; |
4754
|
4754
|
} else { |
4755
|
|
- $return .= '<option value="' . $id . '">' . $value; |
|
4755
|
+ $return .= '<option value="'.$id.'">'.$value; |
4756
|
4756
|
} |
4757
|
4757
|
$return .= '</option>'; |
4758
|
4758
|
} |
4759
|
4759
|
$return .= '</select>'; |
4760
|
4760
|
if ($addjscombo) { |
4761
|
|
- $return .= ajax_combobox('select_' . $htmlname); |
|
4761
|
+ $return .= ajax_combobox('select_'.$htmlname); |
4762
|
4762
|
} |
4763
|
4763
|
|
4764
|
4764
|
return $return; |
|
@@ -4776,7 +4776,7 @@ discard block |
|
|
block discarded – undo |
4776
|
4776
|
// phpcs:enable |
4777
|
4777
|
global $langs; |
4778
|
4778
|
|
4779
|
|
- $num = count($this->cache_transport_mode); // TODO Use $conf->cache['payment_mode'] instead of $this->cache_transport_mode |
|
4779
|
+ $num = count($this->cache_transport_mode); // TODO Use $conf->cache['payment_mode'] instead of $this->cache_transport_mode |
4780
|
4780
|
if ($num > 0) { |
4781
|
4781
|
return $num; // Cache already loaded |
4782
|
4782
|
} |
|
@@ -4786,8 +4786,8 @@ discard block |
|
|
block discarded – undo |
4786
|
4786
|
$this->cache_transport_mode = array(); |
4787
|
4787
|
|
4788
|
4788
|
$sql = "SELECT rowid, code, label, active"; |
4789
|
|
- $sql .= " FROM " . $this->db->prefix() . "c_transport_mode"; |
4790
|
|
- $sql .= " WHERE entity IN (" . getEntity('c_transport_mode') . ")"; |
|
4789
|
+ $sql .= " FROM ".$this->db->prefix()."c_transport_mode"; |
|
4790
|
+ $sql .= " WHERE entity IN (".getEntity('c_transport_mode').")"; |
4791
|
4791
|
|
4792
|
4792
|
$resql = $this->db->query($sql); |
4793
|
4793
|
if ($resql) { |
|
@@ -4797,7 +4797,7 @@ discard block |
|
|
block discarded – undo |
4797
|
4797
|
$obj = $this->db->fetch_object($resql); |
4798
|
4798
|
|
4799
|
4799
|
// If traduction exist, we use it else we take the default label |
4800
|
|
- $label = ($langs->transnoentitiesnoconv("PaymentTypeShort" . $obj->code) != "PaymentTypeShort" . $obj->code ? $langs->transnoentitiesnoconv("PaymentTypeShort" . $obj->code) : ($obj->label != '-' ? $obj->label : '')); |
|
4800
|
+ $label = ($langs->transnoentitiesnoconv("PaymentTypeShort".$obj->code) != "PaymentTypeShort".$obj->code ? $langs->transnoentitiesnoconv("PaymentTypeShort".$obj->code) : ($obj->label != '-' ? $obj->label : '')); |
4801
|
4801
|
$this->cache_transport_mode[$obj->rowid]['rowid'] = $obj->rowid; |
4802
|
4802
|
$this->cache_transport_mode[$obj->rowid]['code'] = $obj->code; |
4803
|
4803
|
$this->cache_transport_mode[$obj->rowid]['label'] = $label; |
|
@@ -4831,11 +4831,11 @@ discard block |
|
|
block discarded – undo |
4831
|
4831
|
{ |
4832
|
4832
|
global $langs, $user; |
4833
|
4833
|
|
4834
|
|
- dol_syslog(__METHOD__ . " " . $selected . ", " . $htmlname . ", " . $format, LOG_DEBUG); |
|
4834
|
+ dol_syslog(__METHOD__." ".$selected.", ".$htmlname.", ".$format, LOG_DEBUG); |
4835
|
4835
|
|
4836
|
4836
|
$this->load_cache_transport_mode(); |
4837
|
4837
|
|
4838
|
|
- print '<select id="select' . $htmlname . '" class="flat selectmodetransport' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">'; |
|
4838
|
+ print '<select id="select'.$htmlname.'" class="flat selectmodetransport'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">'; |
4839
|
4839
|
if ($empty) { |
4840
|
4840
|
print '<option value=""> </option>'; |
4841
|
4841
|
} |
|
@@ -4851,13 +4851,13 @@ discard block |
|
|
block discarded – undo |
4851
|
4851
|
} |
4852
|
4852
|
|
4853
|
4853
|
if ($format == 0) { |
4854
|
|
- print '<option value="' . $id . '"'; |
|
4854
|
+ print '<option value="'.$id.'"'; |
4855
|
4855
|
} elseif ($format == 1) { |
4856
|
|
- print '<option value="' . $arraytypes['code'] . '"'; |
|
4856
|
+ print '<option value="'.$arraytypes['code'].'"'; |
4857
|
4857
|
} elseif ($format == 2) { |
4858
|
|
- print '<option value="' . $arraytypes['code'] . '"'; |
|
4858
|
+ print '<option value="'.$arraytypes['code'].'"'; |
4859
|
4859
|
} elseif ($format == 3) { |
4860
|
|
- print '<option value="' . $id . '"'; |
|
4860
|
+ print '<option value="'.$id.'"'; |
4861
|
4861
|
} |
4862
|
4862
|
// If text is selected, we compare with code, else with id |
4863
|
4863
|
if (preg_match('/[a-z]/i', $selected) && $selected == $arraytypes['code']) { |
|
@@ -4905,31 +4905,31 @@ discard block |
|
|
block discarded – undo |
4905
|
4905
|
$langs->load("deliveries"); |
4906
|
4906
|
|
4907
|
4907
|
$sql = "SELECT rowid, code, libelle as label"; |
4908
|
|
- $sql .= " FROM " . $this->db->prefix() . "c_shipment_mode"; |
|
4908
|
+ $sql .= " FROM ".$this->db->prefix()."c_shipment_mode"; |
4909
|
4909
|
$sql .= " WHERE active > 0"; |
4910
|
4910
|
if ($filtre) { |
4911
|
|
- $sql .= " AND " . $filtre; |
|
4911
|
+ $sql .= " AND ".$filtre; |
4912
|
4912
|
} |
4913
|
4913
|
$sql .= " ORDER BY libelle ASC"; |
4914
|
4914
|
|
4915
|
|
- dol_syslog(get_class($this) . "::selectShippingMode", LOG_DEBUG); |
|
4915
|
+ dol_syslog(get_class($this)."::selectShippingMode", LOG_DEBUG); |
4916
|
4916
|
$result = $this->db->query($sql); |
4917
|
4917
|
if ($result) { |
4918
|
4918
|
$num = $this->db->num_rows($result); |
4919
|
4919
|
$i = 0; |
4920
|
4920
|
if ($num) { |
4921
|
|
- print '<select id="select' . $htmlname . '" class="flat selectshippingmethod' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '"' . ($moreattrib ? ' ' . $moreattrib : '') . '>'; |
|
4921
|
+ print '<select id="select'.$htmlname.'" class="flat selectshippingmethod'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'"'.($moreattrib ? ' '.$moreattrib : '').'>'; |
4922
|
4922
|
if ($useempty == 1 || ($useempty == 2 && $num > 1)) { |
4923
|
4923
|
print '<option value="-1"> </option>'; |
4924
|
4924
|
} |
4925
|
4925
|
while ($i < $num) { |
4926
|
4926
|
$obj = $this->db->fetch_object($result); |
4927
|
4927
|
if ($selected == $obj->rowid) { |
4928
|
|
- print '<option value="' . $obj->rowid . '" selected>'; |
|
4928
|
+ print '<option value="'.$obj->rowid.'" selected>'; |
4929
|
4929
|
} else { |
4930
|
|
- print '<option value="' . $obj->rowid . '">'; |
|
4930
|
+ print '<option value="'.$obj->rowid.'">'; |
4931
|
4931
|
} |
4932
|
|
- print ($langs->trans("SendingMethod" . strtoupper($obj->code)) != "SendingMethod" . strtoupper($obj->code)) ? $langs->trans("SendingMethod" . strtoupper($obj->code)) : $obj->label; |
|
4932
|
+ print ($langs->trans("SendingMethod".strtoupper($obj->code)) != "SendingMethod".strtoupper($obj->code)) ? $langs->trans("SendingMethod".strtoupper($obj->code)) : $obj->label; |
4933
|
4933
|
print '</option>'; |
4934
|
4934
|
$i++; |
4935
|
4935
|
} |
|
@@ -4938,7 +4938,7 @@ discard block |
|
|
block discarded – undo |
4938
|
4938
|
print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); |
4939
|
4939
|
} |
4940
|
4940
|
|
4941
|
|
- print ajax_combobox('select' . $htmlname); |
|
4941
|
+ print ajax_combobox('select'.$htmlname); |
4942
|
4942
|
} else { |
4943
|
4943
|
print $langs->trans("NoShippingMethodDefined"); |
4944
|
4944
|
} |
|
@@ -4963,16 +4963,16 @@ discard block |
|
|
block discarded – undo |
4963
|
4963
|
$langs->load("deliveries"); |
4964
|
4964
|
|
4965
|
4965
|
if ($htmlname != "none") { |
4966
|
|
- print '<form method="POST" action="' . $page . '">'; |
|
4966
|
+ print '<form method="POST" action="'.$page.'">'; |
4967
|
4967
|
print '<input type="hidden" name="action" value="setshippingmethod">'; |
4968
|
|
- print '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
4968
|
+ print '<input type="hidden" name="token" value="'.newToken().'">'; |
4969
|
4969
|
$this->selectShippingMethod($selected, $htmlname, '', $addempty); |
4970
|
|
- print '<input type="submit" class="button valignmiddle" value="' . $langs->trans("Modify") . '">'; |
|
4970
|
+ print '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">'; |
4971
|
4971
|
print '</form>'; |
4972
|
4972
|
} else { |
4973
|
4973
|
if ($selected) { |
4974
|
4974
|
$code = $langs->getLabelFromKey($this->db, $selected, 'c_shipment_mode', 'rowid', 'code'); |
4975
|
|
- print $langs->trans("SendingMethod" . strtoupper($code)); |
|
4975
|
+ print $langs->trans("SendingMethod".strtoupper($code)); |
4976
|
4976
|
} else { |
4977
|
4977
|
print " "; |
4978
|
4978
|
} |
|
@@ -4995,10 +4995,10 @@ discard block |
|
|
block discarded – undo |
4995
|
4995
|
|
4996
|
4996
|
$opt = '<option value="" selected></option>'; |
4997
|
4997
|
$sql = "SELECT rowid, ref, situation_cycle_ref, situation_counter, situation_final, fk_soc"; |
4998
|
|
- $sql .= ' FROM ' . $this->db->prefix() . 'facture'; |
4999
|
|
- $sql .= ' WHERE entity IN (' . getEntity('invoice') . ')'; |
|
4998
|
+ $sql .= ' FROM '.$this->db->prefix().'facture'; |
|
4999
|
+ $sql .= ' WHERE entity IN ('.getEntity('invoice').')'; |
5000
|
5000
|
$sql .= ' AND situation_counter >= 1'; |
5001
|
|
- $sql .= ' AND fk_soc = ' . (int) $socid; |
|
5001
|
+ $sql .= ' AND fk_soc = '.(int) $socid; |
5002
|
5002
|
$sql .= ' AND type <> 2'; |
5003
|
5003
|
$sql .= ' ORDER by situation_cycle_ref, situation_counter desc'; |
5004
|
5004
|
$resql = $this->db->query($sql); |
|
@@ -5016,19 +5016,19 @@ discard block |
|
|
block discarded – undo |
5016
|
5016
|
//Not prov? |
5017
|
5017
|
if (substr($obj->ref, 1, 4) != 'PROV') { |
5018
|
5018
|
if ($selected == $obj->rowid) { |
5019
|
|
- $opt .= '<option value="' . $obj->rowid . '" selected>' . $obj->ref . '</option>'; |
|
5019
|
+ $opt .= '<option value="'.$obj->rowid.'" selected>'.$obj->ref.'</option>'; |
5020
|
5020
|
} else { |
5021
|
|
- $opt .= '<option value="' . $obj->rowid . '">' . $obj->ref . '</option>'; |
|
5021
|
+ $opt .= '<option value="'.$obj->rowid.'">'.$obj->ref.'</option>'; |
5022
|
5022
|
} |
5023
|
5023
|
} |
5024
|
5024
|
} |
5025
|
5025
|
} |
5026
|
5026
|
} |
5027
|
5027
|
} else { |
5028
|
|
- dol_syslog("Error sql=" . $sql . ", error=" . $this->error, LOG_ERR); |
|
5028
|
+ dol_syslog("Error sql=".$sql.", error=".$this->error, LOG_ERR); |
5029
|
5029
|
} |
5030
|
5030
|
if ($opt == '<option value ="" selected></option>') { |
5031
|
|
- $opt = '<option value ="0" selected>' . $langs->trans('NoSituations') . '</option>'; |
|
5031
|
+ $opt = '<option value ="0" selected>'.$langs->trans('NoSituations').'</option>'; |
5032
|
5032
|
} |
5033
|
5033
|
return $opt; |
5034
|
5034
|
} |
|
@@ -5048,12 +5048,12 @@ discard block |
|
|
block discarded – undo |
5048
|
5048
|
|
5049
|
5049
|
$langs->load('products'); |
5050
|
5050
|
|
5051
|
|
- $return = '<select class="flat" id="' . $htmlname . '" name="' . $htmlname . '">'; |
|
5051
|
+ $return = '<select class="flat" id="'.$htmlname.'" name="'.$htmlname.'">'; |
5052
|
5052
|
|
5053
|
|
- $sql = "SELECT rowid, label, code FROM " . $this->db->prefix() . "c_units"; |
|
5053
|
+ $sql = "SELECT rowid, label, code FROM ".$this->db->prefix()."c_units"; |
5054
|
5054
|
$sql .= ' WHERE active > 0'; |
5055
|
5055
|
if (!empty($unit_type)) { |
5056
|
|
- $sql .= " AND unit_type = '" . $this->db->escape($unit_type) . "'"; |
|
5056
|
+ $sql .= " AND unit_type = '".$this->db->escape($unit_type)."'"; |
5057
|
5057
|
} |
5058
|
5058
|
$sql .= " ORDER BY sortorder"; |
5059
|
5059
|
|
|
@@ -5065,14 +5065,14 @@ discard block |
|
|
block discarded – undo |
5065
|
5065
|
|
5066
|
5066
|
while ($res = $this->db->fetch_object($resql)) { |
5067
|
5067
|
$unitLabel = $res->label; |
5068
|
|
- if (!empty($langs->tab_translate['unit' . $res->code])) { // check if Translation is available before |
5069
|
|
- $unitLabel = $langs->trans('unit' . $res->code) != $res->label ? $langs->trans('unit' . $res->code) : $res->label; |
|
5068
|
+ if (!empty($langs->tab_translate['unit'.$res->code])) { // check if Translation is available before |
|
5069
|
+ $unitLabel = $langs->trans('unit'.$res->code) != $res->label ? $langs->trans('unit'.$res->code) : $res->label; |
5070
|
5070
|
} |
5071
|
5071
|
|
5072
|
5072
|
if ($selected == $res->rowid) { |
5073
|
|
- $return .= '<option value="' . $res->rowid . '" selected>' . $unitLabel . '</option>'; |
|
5073
|
+ $return .= '<option value="'.$res->rowid.'" selected>'.$unitLabel.'</option>'; |
5074
|
5074
|
} else { |
5075
|
|
- $return .= '<option value="' . $res->rowid . '">' . $unitLabel . '</option>'; |
|
5075
|
+ $return .= '<option value="'.$res->rowid.'">'.$unitLabel.'</option>'; |
5076
|
5076
|
} |
5077
|
5077
|
} |
5078
|
5078
|
$return .= '</select>'; |
|
@@ -5107,23 +5107,23 @@ discard block |
|
|
block discarded – undo |
5107
|
5107
|
$num = 0; |
5108
|
5108
|
|
5109
|
5109
|
$sql = "SELECT rowid, label, bank, clos as status, currency_code"; |
5110
|
|
- $sql .= " FROM " . $this->db->prefix() . "bank_account"; |
5111
|
|
- $sql .= " WHERE entity IN (" . getEntity('bank_account') . ")"; |
|
5110
|
+ $sql .= " FROM ".$this->db->prefix()."bank_account"; |
|
5111
|
+ $sql .= " WHERE entity IN (".getEntity('bank_account').")"; |
5112
|
5112
|
if ($status != 2) { |
5113
|
|
- $sql .= " AND clos = " . (int) $status; |
|
5113
|
+ $sql .= " AND clos = ".(int) $status; |
5114
|
5114
|
} |
5115
|
5115
|
if ($filtre) { // TODO Support USF |
5116
|
|
- $sql .= " AND " . $filtre; |
|
5116
|
+ $sql .= " AND ".$filtre; |
5117
|
5117
|
} |
5118
|
5118
|
$sql .= " ORDER BY label"; |
5119
|
5119
|
|
5120
|
|
- dol_syslog(get_class($this) . "::select_comptes", LOG_DEBUG); |
|
5120
|
+ dol_syslog(get_class($this)."::select_comptes", LOG_DEBUG); |
5121
|
5121
|
$result = $this->db->query($sql); |
5122
|
5122
|
if ($result) { |
5123
|
5123
|
$num = $this->db->num_rows($result); |
5124
|
5124
|
$i = 0; |
5125
|
5125
|
if ($num) { |
5126
|
|
- $out .= '<select id="select' . $htmlname . '" class="flat selectbankaccount' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '"' . ($moreattrib ? ' ' . $moreattrib : '') . '>'; |
|
5126
|
+ $out .= '<select id="select'.$htmlname.'" class="flat selectbankaccount'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'"'.($moreattrib ? ' '.$moreattrib : '').'>'; |
5127
|
5127
|
|
5128
|
5128
|
if (!empty($useempty) && !is_numeric($useempty)) { |
5129
|
5129
|
$out .= '<option value="-1">'.$langs->trans($useempty).'</option>'; |
|
@@ -5134,27 +5134,27 @@ discard block |
|
|
block discarded – undo |
5134
|
5134
|
while ($i < $num) { |
5135
|
5135
|
$obj = $this->db->fetch_object($result); |
5136
|
5136
|
if ($selected == $obj->rowid || ($useempty == 2 && $num == 1 && empty($selected))) { |
5137
|
|
- $out .= '<option value="' . $obj->rowid . '" data-currency-code="' . $obj->currency_code . '" selected>'; |
|
5137
|
+ $out .= '<option value="'.$obj->rowid.'" data-currency-code="'.$obj->currency_code.'" selected>'; |
5138
|
5138
|
} else { |
5139
|
|
- $out .= '<option value="' . $obj->rowid . '" data-currency-code="' . $obj->currency_code . '">'; |
|
5139
|
+ $out .= '<option value="'.$obj->rowid.'" data-currency-code="'.$obj->currency_code.'">'; |
5140
|
5140
|
} |
5141
|
5141
|
$out .= trim($obj->label); |
5142
|
5142
|
if ($showcurrency) { |
5143
|
|
- $out .= ' (' . $obj->currency_code . ')'; |
|
5143
|
+ $out .= ' ('.$obj->currency_code.')'; |
5144
|
5144
|
} |
5145
|
5145
|
if ($status == 2 && $obj->status == 1) { |
5146
|
|
- $out .= ' (' . $langs->trans("Closed") . ')'; |
|
5146
|
+ $out .= ' ('.$langs->trans("Closed").')'; |
5147
|
5147
|
} |
5148
|
5148
|
$out .= '</option>'; |
5149
|
5149
|
$i++; |
5150
|
5150
|
} |
5151
|
5151
|
$out .= "</select>"; |
5152
|
|
- $out .= ajax_combobox('select' . $htmlname); |
|
5152
|
+ $out .= ajax_combobox('select'.$htmlname); |
5153
|
5153
|
} else { |
5154
|
5154
|
if ($status == 0) { |
5155
|
|
- $out .= '<span class="opacitymedium">' . $langs->trans("NoActiveBankAccountDefined") . '</span>'; |
|
5155
|
+ $out .= '<span class="opacitymedium">'.$langs->trans("NoActiveBankAccountDefined").'</span>'; |
5156
|
5156
|
} else { |
5157
|
|
- $out .= '<span class="opacitymedium">' . $langs->trans("NoBankAccountFound") . '</span>'; |
|
5157
|
+ $out .= '<span class="opacitymedium">'.$langs->trans("NoBankAccountFound").'</span>'; |
5158
|
5158
|
} |
5159
|
5159
|
} |
5160
|
5160
|
} else { |
|
@@ -5190,23 +5190,23 @@ discard block |
|
|
block discarded – undo |
5190
|
5190
|
$num = 0; |
5191
|
5191
|
|
5192
|
5192
|
$sql = "SELECT rowid, name, fk_country, status, entity"; |
5193
|
|
- $sql .= " FROM " . $this->db->prefix() . "establishment"; |
|
5193
|
+ $sql .= " FROM ".$this->db->prefix()."establishment"; |
5194
|
5194
|
$sql .= " WHERE 1=1"; |
5195
|
5195
|
if ($status != 2) { |
5196
|
|
- $sql .= " AND status = " . (int) $status; |
|
5196
|
+ $sql .= " AND status = ".(int) $status; |
5197
|
5197
|
} |
5198
|
5198
|
if ($filtre) { // TODO Support USF |
5199
|
|
- $sql .= " AND " . $filtre; |
|
5199
|
+ $sql .= " AND ".$filtre; |
5200
|
5200
|
} |
5201
|
5201
|
$sql .= " ORDER BY name"; |
5202
|
5202
|
|
5203
|
|
- dol_syslog(get_class($this) . "::select_establishment", LOG_DEBUG); |
|
5203
|
+ dol_syslog(get_class($this)."::select_establishment", LOG_DEBUG); |
5204
|
5204
|
$result = $this->db->query($sql); |
5205
|
5205
|
if ($result) { |
5206
|
5206
|
$num = $this->db->num_rows($result); |
5207
|
5207
|
$i = 0; |
5208
|
5208
|
if ($num) { |
5209
|
|
- print '<select id="select' . $htmlname . '" class="flat selectestablishment" name="' . $htmlname . '"' . ($moreattrib ? ' ' . $moreattrib : '') . '>'; |
|
5209
|
+ print '<select id="select'.$htmlname.'" class="flat selectestablishment" name="'.$htmlname.'"'.($moreattrib ? ' '.$moreattrib : '').'>'; |
5210
|
5210
|
if ($useempty == 1 || ($useempty == 2 && $num > 1)) { |
5211
|
5211
|
print '<option value="-1"> </option>'; |
5212
|
5212
|
} |
|
@@ -5214,13 +5214,13 @@ discard block |
|
|
block discarded – undo |
5214
|
5214
|
while ($i < $num) { |
5215
|
5215
|
$obj = $this->db->fetch_object($result); |
5216
|
5216
|
if ($selected == $obj->rowid) { |
5217
|
|
- print '<option value="' . $obj->rowid . '" selected>'; |
|
5217
|
+ print '<option value="'.$obj->rowid.'" selected>'; |
5218
|
5218
|
} else { |
5219
|
|
- print '<option value="' . $obj->rowid . '">'; |
|
5219
|
+ print '<option value="'.$obj->rowid.'">'; |
5220
|
5220
|
} |
5221
|
5221
|
print trim($obj->name); |
5222
|
5222
|
if ($status == 2 && $obj->status == 1) { |
5223
|
|
- print ' (' . $langs->trans("Closed") . ')'; |
|
5223
|
+ print ' ('.$langs->trans("Closed").')'; |
5224
|
5224
|
} |
5225
|
5225
|
print '</option>'; |
5226
|
5226
|
$i++; |
|
@@ -5228,9 +5228,9 @@ discard block |
|
|
block discarded – undo |
5228
|
5228
|
print "</select>"; |
5229
|
5229
|
} else { |
5230
|
5230
|
if ($status == 0) { |
5231
|
|
- print '<span class="opacitymedium">' . $langs->trans("NoActiveEstablishmentDefined") . '</span>'; |
|
5231
|
+ print '<span class="opacitymedium">'.$langs->trans("NoActiveEstablishmentDefined").'</span>'; |
5232
|
5232
|
} else { |
5233
|
|
- print '<span class="opacitymedium">' . $langs->trans("NoEstablishmentFound") . '</span>'; |
|
5233
|
+ print '<span class="opacitymedium">'.$langs->trans("NoEstablishmentFound").'</span>'; |
5234
|
5234
|
} |
5235
|
5235
|
} |
5236
|
5236
|
|
|
@@ -5254,20 +5254,20 @@ discard block |
|
|
block discarded – undo |
5254
|
5254
|
{ |
5255
|
5255
|
global $langs; |
5256
|
5256
|
if ($htmlname != "none") { |
5257
|
|
- print '<form method="POST" action="' . $page . '">'; |
|
5257
|
+ print '<form method="POST" action="'.$page.'">'; |
5258
|
5258
|
print '<input type="hidden" name="action" value="setbankaccount">'; |
5259
|
|
- print '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
5259
|
+ print '<input type="hidden" name="token" value="'.newToken().'">'; |
5260
|
5260
|
print img_picto('', 'bank_account', 'class="pictofixedwidth"'); |
5261
|
5261
|
$nbaccountfound = $this->select_comptes($selected, $htmlname, 0, '', $addempty); |
5262
|
5262
|
if ($nbaccountfound > 0) { |
5263
|
|
- print '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">'; |
|
5263
|
+ print '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">'; |
5264
|
5264
|
} |
5265
|
5265
|
print '</form>'; |
5266
|
5266
|
} else { |
5267
|
5267
|
$langs->load('banks'); |
5268
|
5268
|
|
5269
|
5269
|
if ($selected) { |
5270
|
|
- require_once DOL_DOCUMENT_ROOT . '/compta/bank/class/account.class.php'; |
|
5270
|
+ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; |
5271
|
5271
|
$bankstatic = new Account($this->db); |
5272
|
5272
|
$result = $bankstatic->fetch($selected); |
5273
|
5273
|
if ($result) { |
|
@@ -5306,19 +5306,19 @@ discard block |
|
|
block discarded – undo |
5306
|
5306
|
global $conf, $langs; |
5307
|
5307
|
$langs->load("categories"); |
5308
|
5308
|
|
5309
|
|
- include_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; |
|
5309
|
+ include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; |
5310
|
5310
|
|
5311
|
5311
|
// For backward compatibility |
5312
|
5312
|
if (is_numeric($type)) { |
5313
|
|
- dol_syslog(__METHOD__ . ': using numeric value for parameter type is deprecated. Use string code instead.', LOG_WARNING); |
|
5313
|
+ dol_syslog(__METHOD__.': using numeric value for parameter type is deprecated. Use string code instead.', LOG_WARNING); |
5314
|
5314
|
} |
5315
|
5315
|
|
5316
|
5316
|
if ($type === Categorie::TYPE_BANK_LINE) { |
5317
|
5317
|
// TODO Move this into common category feature |
5318
|
5318
|
$cate_arbo = array(); |
5319
|
5319
|
$sql = "SELECT c.label, c.rowid"; |
5320
|
|
- $sql .= " FROM " . $this->db->prefix() . "category_bank as c"; |
5321
|
|
- $sql .= " WHERE entity = " . $conf->entity; |
|
5320
|
+ $sql .= " FROM ".$this->db->prefix()."category_bank as c"; |
|
5321
|
+ $sql .= " WHERE entity = ".$conf->entity; |
5322
|
5322
|
$sql .= " ORDER BY c.label"; |
5323
|
5323
|
$result = $this->db->query($sql); |
5324
|
5324
|
if ($result) { |
|
@@ -5344,12 +5344,12 @@ discard block |
|
|
block discarded – undo |
5344
|
5344
|
$outarrayrichhtml = array(); |
5345
|
5345
|
|
5346
|
5346
|
|
5347
|
|
- $output = '<select class="flat minwidth100' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">'; |
|
5347
|
+ $output = '<select class="flat minwidth100'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">'; |
5348
|
5348
|
if (is_array($cate_arbo)) { |
5349
|
5349
|
$num = count($cate_arbo); |
5350
|
5350
|
|
5351
|
5351
|
if (!$num) { |
5352
|
|
- $output .= '<option value="-1" disabled>' . $langs->trans("NoCategoriesDefined") . '</option>'; |
|
5352
|
+ $output .= '<option value="-1" disabled>'.$langs->trans("NoCategoriesDefined").'</option>'; |
5353
|
5353
|
} else { |
5354
|
5354
|
if ($useempty == 1 || ($useempty == 2 && $num > 1)) { |
5355
|
5355
|
$output .= '<option value="-1"> </option>'; |
|
@@ -5361,15 +5361,15 @@ discard block |
|
|
block discarded – undo |
5361
|
5361
|
$add = ''; |
5362
|
5362
|
} |
5363
|
5363
|
|
5364
|
|
- $labeltoshow = img_picto('', 'category', 'class="pictofixedwidth" style="color: #' . $cate_arbo[$key]['color'] . '"'); |
|
5364
|
+ $labeltoshow = img_picto('', 'category', 'class="pictofixedwidth" style="color: #'.$cate_arbo[$key]['color'].'"'); |
5365
|
5365
|
$labeltoshow .= dol_trunc($cate_arbo[$key]['fulllabel'], $maxlength, 'middle'); |
5366
|
5366
|
|
5367
|
5367
|
$outarray[$cate_arbo[$key]['id']] = $cate_arbo[$key]['fulllabel']; |
5368
|
5368
|
|
5369
|
5369
|
$outarrayrichhtml[$cate_arbo[$key]['id']] = $labeltoshow; |
5370
|
5370
|
|
5371
|
|
- $output .= '<option ' . $add . 'value="' . $cate_arbo[$key]['id'] . '"'; |
5372
|
|
- $output .= ' data-html="' . dol_escape_htmltag($labeltoshow) . '"'; |
|
5371
|
+ $output .= '<option '.$add.'value="'.$cate_arbo[$key]['id'].'"'; |
|
5372
|
+ $output .= ' data-html="'.dol_escape_htmltag($labeltoshow).'"'; |
5373
|
5373
|
$output .= '>'; |
5374
|
5374
|
$output .= dol_trunc($cate_arbo[$key]['fulllabel'], $maxlength, 'middle'); |
5375
|
5375
|
$output .= '</option>'; |
|
@@ -5413,7 +5413,7 @@ discard block |
|
|
block discarded – undo |
5413
|
5413
|
public function form_confirm($page, $title, $question, $action, $formquestion = array(), $selectedchoice = "", $useajax = 0, $height = 170, $width = 500) |
5414
|
5414
|
{ |
5415
|
5415
|
// phpcs:enable |
5416
|
|
- dol_syslog(__METHOD__ . ': using form_confirm is deprecated. Use formconfim instead.', LOG_WARNING); |
|
5416
|
+ dol_syslog(__METHOD__.': using form_confirm is deprecated. Use formconfim instead.', LOG_WARNING); |
5417
|
5417
|
print $this->formconfirm($page, $title, $question, $action, $formquestion, $selectedchoice, $useajax, $height, $width); |
5418
|
5418
|
} |
5419
|
5419
|
|
|
@@ -5448,7 +5448,7 @@ discard block |
|
|
block discarded – undo |
5448
|
5448
|
{ |
5449
|
5449
|
global $langs, $conf; |
5450
|
5450
|
|
5451
|
|
- $more = '<!-- formconfirm - before call, page=' . dol_escape_htmltag($page) . ' -->'; |
|
5451
|
+ $more = '<!-- formconfirm - before call, page='.dol_escape_htmltag($page).' -->'; |
5452
|
5452
|
$formconfirm = ''; |
5453
|
5453
|
$inputok = array(); |
5454
|
5454
|
$inputko = array(); |
|
@@ -5472,27 +5472,27 @@ discard block |
|
|
block discarded – undo |
5472
|
5472
|
foreach ($formquestion as $key => $input) { |
5473
|
5473
|
if (is_array($input) && !empty($input)) { |
5474
|
5474
|
if ($input['type'] == 'hidden') { |
5475
|
|
- $moreattr = (!empty($input['moreattr']) ? ' ' . $input['moreattr'] : ''); |
5476
|
|
- $morecss = (!empty($input['morecss']) ? ' ' . $input['morecss'] : ''); |
|
5475
|
+ $moreattr = (!empty($input['moreattr']) ? ' '.$input['moreattr'] : ''); |
|
5476
|
+ $morecss = (!empty($input['morecss']) ? ' '.$input['morecss'] : ''); |
5477
|
5477
|
|
5478
|
|
- $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"; |
|
5478
|
+ $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
|
5479
|
} |
5480
|
5480
|
} |
5481
|
5481
|
} |
5482
|
5482
|
|
5483
|
5483
|
// Now add questions |
5484
|
5484
|
$moreonecolumn = ''; |
5485
|
|
- $more .= '<div class="tagtable paddingtopbottomonly centpercent noborderspacing">' . "\n"; |
|
5485
|
+ $more .= '<div class="tagtable paddingtopbottomonly centpercent noborderspacing">'."\n"; |
5486
|
5486
|
foreach ($formquestion as $key => $input) { |
5487
|
5487
|
if (is_array($input) && !empty($input)) { |
5488
|
|
- $size = (!empty($input['size']) ? ' size="' . $input['size'] . '"' : ''); // deprecated. Use morecss instead. |
5489
|
|
- $moreattr = (!empty($input['moreattr']) ? ' ' . $input['moreattr'] : ''); |
5490
|
|
- $morecss = (!empty($input['morecss']) ? ' ' . $input['morecss'] : ''); |
|
5488
|
+ $size = (!empty($input['size']) ? ' size="'.$input['size'].'"' : ''); // deprecated. Use morecss instead. |
|
5489
|
+ $moreattr = (!empty($input['moreattr']) ? ' '.$input['moreattr'] : ''); |
|
5490
|
+ $morecss = (!empty($input['morecss']) ? ' '.$input['morecss'] : ''); |
5491
|
5491
|
|
5492
|
5492
|
if ($input['type'] == 'text') { |
5493
|
|
- $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"; |
|
5493
|
+ $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
|
5494
|
} elseif ($input['type'] == 'password') { |
5495
|
|
- $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"; |
|
5495
|
+ $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
|
5496
|
} elseif ($input['type'] == 'textarea') { |
5497
|
5497
|
/*$more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">'.$input['label'].'</div><div class="tagtd">'; |
5498
|
5498
|
$more .= '<textarea name="'.$input['name'].'" class="'.$morecss.'"'.$moreattr.'>'; |
|
@@ -5500,8 +5500,8 @@ discard block |
|
|
block discarded – undo |
5500
|
5500
|
$more .= '</textarea>'; |
5501
|
5501
|
$more .= '</div></div>'."\n";*/ |
5502
|
5502
|
$moreonecolumn .= '<div class="margintoponly">'; |
5503
|
|
- $moreonecolumn .= $input['label'] . '<br>'; |
5504
|
|
- $moreonecolumn .= '<textarea name="' . dol_escape_htmltag($input['name']) . '" id="' . dol_escape_htmltag($input['name']) . '" class="' . $morecss . '"' . $moreattr . '>'; |
|
5503
|
+ $moreonecolumn .= $input['label'].'<br>'; |
|
5504
|
+ $moreonecolumn .= '<textarea name="'.dol_escape_htmltag($input['name']).'" id="'.dol_escape_htmltag($input['name']).'" class="'.$morecss.'"'.$moreattr.'>'; |
5505
|
5505
|
$moreonecolumn .= $input['value']; |
5506
|
5506
|
$moreonecolumn .= '</textarea>'; |
5507
|
5507
|
$moreonecolumn .= '</div>'; |
|
@@ -5518,20 +5518,20 @@ discard block |
|
|
block discarded – undo |
5518
|
5518
|
$disabled = isset($input['select_disabled']) ? $input['select_disabled'] : 0; |
5519
|
5519
|
$sort = isset($input['select_sort']) ? $input['select_sort'] : ''; |
5520
|
5520
|
|
5521
|
|
- $more .= '<div class="tagtr"><div class="tagtd' . (empty($input['tdclass']) ? '' : (' ' . $input['tdclass'])) . '">'; |
|
5521
|
+ $more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">'; |
5522
|
5522
|
if (!empty($input['label'])) { |
5523
|
|
- $more .= $input['label'] . '</div><div class="tagtd left">'; |
|
5523
|
+ $more .= $input['label'].'</div><div class="tagtd left">'; |
5524
|
5524
|
} |
5525
|
5525
|
if ($input['type'] == 'select') { |
5526
|
5526
|
$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); |
5527
|
5527
|
} else { |
5528
|
5528
|
$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); |
5529
|
5529
|
} |
5530
|
|
- $more .= '</div></div>' . "\n"; |
|
5530
|
+ $more .= '</div></div>'."\n"; |
5531
|
5531
|
} elseif ($input['type'] == 'checkbox') { |
5532
|
5532
|
$more .= '<div class="tagtr">'; |
5533
|
|
- $more .= '<div class="tagtd' . (empty($input['tdclass']) ? '' : (' ' . $input['tdclass'])) . '"><label for="' . dol_escape_htmltag($input['name']) . '">' . $input['label'] . '</label></div><div class="tagtd">'; |
5534
|
|
- $more .= '<input type="checkbox" class="flat' . ($morecss ? ' ' . $morecss : '') . '" id="' . dol_escape_htmltag($input['name']) . '" name="' . dol_escape_htmltag($input['name']) . '"' . $moreattr; |
|
5533
|
+ $more .= '<div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'"><label for="'.dol_escape_htmltag($input['name']).'">'.$input['label'].'</label></div><div class="tagtd">'; |
|
5534
|
+ $more .= '<input type="checkbox" class="flat'.($morecss ? ' '.$morecss : '').'" id="'.dol_escape_htmltag($input['name']).'" name="'.dol_escape_htmltag($input['name']).'"'.$moreattr; |
5535
|
5535
|
if (!is_bool($input['value']) && $input['value'] != 'false' && $input['value'] != '0' && $input['value'] != '') { |
5536
|
5536
|
$more .= ' checked'; |
5537
|
5537
|
} |
|
@@ -5542,19 +5542,19 @@ discard block |
|
|
block discarded – undo |
5542
|
5542
|
$more .= ' disabled'; |
5543
|
5543
|
} |
5544
|
5544
|
$more .= ' /></div>'; |
5545
|
|
- $more .= '</div>' . "\n"; |
|
5545
|
+ $more .= '</div>'."\n"; |
5546
|
5546
|
} elseif ($input['type'] == 'radio') { |
5547
|
5547
|
$i = 0; |
5548
|
5548
|
foreach ($input['values'] as $selkey => $selval) { |
5549
|
5549
|
$more .= '<div class="tagtr">'; |
5550
|
5550
|
if (isset($input['label'])) { |
5551
|
5551
|
if ($i == 0) { |
5552
|
|
- $more .= '<div class="tagtd' . (empty($input['tdclass']) ? ' tdtop' : (' tdtop ' . $input['tdclass'])) . '">' . $input['label'] . '</div>'; |
|
5552
|
+ $more .= '<div class="tagtd'.(empty($input['tdclass']) ? ' tdtop' : (' tdtop '.$input['tdclass'])).'">'.$input['label'].'</div>'; |
5553
|
5553
|
} else { |
5554
|
|
- $more .= '<div class="tagtd' . (empty($input['tdclass']) ? '' : (' "' . $input['tdclass'])) . '"> </div>'; |
|
5554
|
+ $more .= '<div class="tagtd'.(empty($input['tdclass']) ? '' : (' "'.$input['tdclass'])).'"> </div>'; |
5555
|
5555
|
} |
5556
|
5556
|
} |
5557
|
|
- $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; |
|
5557
|
+ $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
|
5558
|
if (!empty($input['disabled'])) { |
5559
|
5559
|
$more .= ' disabled'; |
5560
|
5560
|
} |
|
@@ -5562,12 +5562,12 @@ discard block |
|
|
block discarded – undo |
5562
|
5562
|
$more .= ' checked="checked"'; |
5563
|
5563
|
} |
5564
|
5564
|
$more .= ' /> '; |
5565
|
|
- $more .= '<label for="' . dol_escape_htmltag($input['name'] . $selkey) . '" class="valignmiddle">' . $selval . '</label>'; |
5566
|
|
- $more .= '</div></div>' . "\n"; |
|
5565
|
+ $more .= '<label for="'.dol_escape_htmltag($input['name'].$selkey).'" class="valignmiddle">'.$selval.'</label>'; |
|
5566
|
+ $more .= '</div></div>'."\n"; |
5567
|
5567
|
$i++; |
5568
|
5568
|
} |
5569
|
5569
|
} elseif ($input['type'] == 'date' || $input['type'] == 'datetime') { |
5570
|
|
- $more .= '<div class="tagtr"><div class="tagtd' . (empty($input['tdclass']) ? '' : (' ' . $input['tdclass'])) . '">' . $input['label'] . '</div>'; |
|
5570
|
+ $more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">'.$input['label'].'</div>'; |
5571
|
5571
|
$more .= '<div class="tagtd">'; |
5572
|
5572
|
$addnowlink = (empty($input['datenow']) ? 0 : 1); |
5573
|
5573
|
$h = $m = 0; |
|
@@ -5585,24 +5585,24 @@ discard block |
|
|
block discarded – undo |
5585
|
5585
|
} elseif ($input['type'] == 'other') { // can be 1 column or 2 depending if label is set or not |
5586
|
5586
|
$more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">'; |
5587
|
5587
|
if (!empty($input['label'])) { |
5588
|
|
- $more .= $input['label'] . '</div><div class="tagtd">'; |
|
5588
|
+ $more .= $input['label'].'</div><div class="tagtd">'; |
5589
|
5589
|
} |
5590
|
5590
|
$more .= $input['value']; |
5591
|
|
- $more .= '</div></div>' . "\n"; |
|
5591
|
+ $more .= '</div></div>'."\n"; |
5592
|
5592
|
} elseif ($input['type'] == 'onecolumn') { |
5593
|
5593
|
$moreonecolumn .= '<div class="margintoponly">'; |
5594
|
5594
|
$moreonecolumn .= $input['value']; |
5595
|
|
- $moreonecolumn .= '</div>' . "\n"; |
|
5595
|
+ $moreonecolumn .= '</div>'."\n"; |
5596
|
5596
|
} elseif ($input['type'] == 'hidden') { |
5597
|
5597
|
// Do nothing more, already added by a previous loop |
5598
|
5598
|
} elseif ($input['type'] == 'separator') { |
5599
|
5599
|
$more .= '<br>'; |
5600
|
5600
|
} else { |
5601
|
|
- $more .= 'Error type ' . $input['type'] . ' for the confirm box is not a supported type'; |
|
5601
|
+ $more .= 'Error type '.$input['type'].' for the confirm box is not a supported type'; |
5602
|
5602
|
} |
5603
|
5603
|
} |
5604
|
5604
|
} |
5605
|
|
- $more .= '</div>' . "\n"; |
|
5605
|
+ $more .= '</div>'."\n"; |
5606
|
5606
|
$more .= $moreonecolumn; |
5607
|
5607
|
} |
5608
|
5608
|
|
|
@@ -5624,10 +5624,10 @@ discard block |
|
|
block discarded – undo |
5624
|
5624
|
$button = $useajax; |
5625
|
5625
|
$useajax = 1; |
5626
|
5626
|
$autoOpen = false; |
5627
|
|
- $dialogconfirm .= '-' . $button; |
|
5627
|
+ $dialogconfirm .= '-'.$button; |
5628
|
5628
|
} |
5629
|
|
- $pageyes = $page . (preg_match('/\?/', $page) ? '&' : '?') . 'action=' . urlencode($action) . '&confirm=yes'; |
5630
|
|
- $pageno = ($useajax == 2 ? $page . (preg_match('/\?/', $page) ? '&' : '?') . 'action=' . urlencode($action) . '&confirm=no' : ''); |
|
5629
|
+ $pageyes = $page.(preg_match('/\?/', $page) ? '&' : '?').'action='.urlencode($action).'&confirm=yes'; |
|
5630
|
+ $pageno = ($useajax == 2 ? $page.(preg_match('/\?/', $page) ? '&' : '?').'action='.urlencode($action).'&confirm=no' : ''); |
5631
|
5631
|
|
5632
|
5632
|
// Add input fields into list of fields to read during submit (inputok and inputko) |
5633
|
5633
|
if (is_array($formquestion)) { |
|
@@ -5650,24 +5650,24 @@ discard block |
|
|
block discarded – undo |
5650
|
5650
|
} |
5651
|
5651
|
|
5652
|
5652
|
// Show JQuery confirm box. |
5653
|
|
- $formconfirm .= '<div id="' . $dialogconfirm . '" title="' . dol_escape_htmltag($title) . '" style="display: none;">'; |
|
5653
|
+ $formconfirm .= '<div id="'.$dialogconfirm.'" title="'.dol_escape_htmltag($title).'" style="display: none;">'; |
5654
|
5654
|
if (is_array($formquestion) && array_key_exists('text', $formquestion) && !empty($formquestion['text'])) { |
5655
|
|
- $formconfirm .= '<div class="confirmtext">' . $formquestion['text'] . '</div>' . "\n"; |
|
5655
|
+ $formconfirm .= '<div class="confirmtext">'.$formquestion['text'].'</div>'."\n"; |
5656
|
5656
|
} |
5657
|
5657
|
if (!empty($more)) { |
5658
|
|
- $formconfirm .= '<div class="confirmquestions">' . $more . '</div>' . "\n"; |
|
5658
|
+ $formconfirm .= '<div class="confirmquestions">'.$more.'</div>'."\n"; |
5659
|
5659
|
} |
5660
|
|
- $formconfirm .= ($question ? '<div class="confirmmessage">' . img_help(0, '') . ' ' . $question . '</div>' : ''); |
5661
|
|
- $formconfirm .= '</div>' . "\n"; |
|
5660
|
+ $formconfirm .= ($question ? '<div class="confirmmessage">'.img_help(0, '').' '.$question.'</div>' : ''); |
|
5661
|
+ $formconfirm .= '</div>'."\n"; |
5662
|
5662
|
|
5663
|
|
- $formconfirm .= "\n<!-- begin code of popup for formconfirm page=" . $page . " -->\n"; |
5664
|
|
- $formconfirm .= '<script nonce="' . getNonce() . '" type="text/javascript">' . "\n"; |
|
5663
|
+ $formconfirm .= "\n<!-- begin code of popup for formconfirm page=".$page." -->\n"; |
|
5664
|
+ $formconfirm .= '<script nonce="'.getNonce().'" type="text/javascript">'."\n"; |
5665
|
5665
|
$formconfirm .= "/* Code for the jQuery('#dialogforpopup').dialog() */\n"; |
5666
|
5666
|
$formconfirm .= 'jQuery(document).ready(function() { |
5667
|
5667
|
$(function() { |
5668
|
|
- $( "#' . $dialogconfirm . '" ).dialog( |
|
5668
|
+ $( "#' . $dialogconfirm.'" ).dialog( |
5669
|
5669
|
{ |
5670
|
|
- autoOpen: ' . ($autoOpen ? "true" : "false") . ','; |
|
5670
|
+ autoOpen: ' . ($autoOpen ? "true" : "false").','; |
5671
|
5671
|
if ($newselectedchoice == 'no') { |
5672
|
5672
|
$formconfirm .= ' |
5673
|
5673
|
open: function() { |
|
@@ -5677,24 +5677,24 @@ discard block |
|
|
block discarded – undo |
5677
|
5677
|
|
5678
|
5678
|
$jsforcursor = ''; |
5679
|
5679
|
if ($useajax == 1) { |
5680
|
|
- $jsforcursor = '// The call to urljump can be slow, so we set the wait cursor' . "\n"; |
5681
|
|
- $jsforcursor .= 'jQuery("html,body,#id-container").addClass("cursorwait");' . "\n"; |
|
5680
|
+ $jsforcursor = '// The call to urljump can be slow, so we set the wait cursor'."\n"; |
|
5681
|
+ $jsforcursor .= 'jQuery("html,body,#id-container").addClass("cursorwait");'."\n"; |
5682
|
5682
|
} |
5683
|
5683
|
|
5684
|
5684
|
$postconfirmas = 'GET'; |
5685
|
5685
|
|
5686
|
5686
|
$formconfirm .= ' |
5687
|
5687
|
resizable: false, |
5688
|
|
- height: "' . $height . '", |
5689
|
|
- width: "' . $width . '", |
|
5688
|
+ height: "' . $height.'", |
|
5689
|
+ width: "' . $width.'", |
5690
|
5690
|
modal: true, |
5691
|
5691
|
closeOnEscape: false, |
5692
|
5692
|
buttons: { |
5693
|
|
- "' . dol_escape_js($langs->transnoentities($labelbuttonyes)) . '": function() { |
5694
|
|
- var options = "token=' . urlencode(newToken()) . '"; |
5695
|
|
- var inputok = ' . json_encode($inputok) . '; /* List of fields into form */ |
5696
|
|
- var page = "' . dol_escape_js(!empty($page) ? $page : '') . '"; |
5697
|
|
- var pageyes = "' . dol_escape_js(!empty($pageyes) ? $pageyes : '') . '"; |
|
5693
|
+ "' . dol_escape_js($langs->transnoentities($labelbuttonyes)).'": function() { |
|
5694
|
+ var options = "token=' . urlencode(newToken()).'"; |
|
5695
|
+ var inputok = ' . json_encode($inputok).'; /* List of fields into form */ |
|
5696
|
+ var page = "' . dol_escape_js(!empty($page) ? $page : '').'"; |
|
5697
|
+ var pageyes = "' . dol_escape_js(!empty($pageyes) ? $pageyes : '').'"; |
5698
|
5698
|
|
5699
|
5699
|
if (inputok.length > 0) { |
5700
|
5700
|
$.each(inputok, function(i, inputname) { |
|
@@ -5728,11 +5728,11 @@ discard block |
|
|
block discarded – undo |
5728
|
5728
|
} |
5729
|
5729
|
$(this).dialog("close"); |
5730
|
5730
|
}, |
5731
|
|
- "' . dol_escape_js($langs->transnoentities($labelbuttonno)) . '": function() { |
5732
|
|
- var options = "token=' . urlencode(newToken()) . '"; |
5733
|
|
- var inputko = ' . json_encode($inputko) . '; /* List of fields into form */ |
5734
|
|
- var page = "' . dol_escape_js(!empty($page) ? $page : '') . '"; |
5735
|
|
- var pageno="' . dol_escape_js(!empty($pageno) ? $pageno : '') . '"; |
|
5731
|
+ "' . dol_escape_js($langs->transnoentities($labelbuttonno)).'": function() { |
|
5732
|
+ var options = "token=' . urlencode(newToken()).'"; |
|
5733
|
+ var inputko = ' . json_encode($inputko).'; /* List of fields into form */ |
|
5734
|
+ var page = "' . dol_escape_js(!empty($page) ? $page : '').'"; |
|
5735
|
+ var pageno="' . dol_escape_js(!empty($pageno) ? $pageno : '').'"; |
5736
|
5736
|
if (inputko.length > 0) { |
5737
|
5737
|
$.each(inputko, function(i, inputname) { |
5738
|
5738
|
var more = ""; |
|
@@ -5764,10 +5764,10 @@ discard block |
|
|
block discarded – undo |
5764
|
5764
|
} |
5765
|
5765
|
); |
5766
|
5766
|
|
5767
|
|
- var button = "' . $button . '"; |
|
5767
|
+ var button = "' . $button.'"; |
5768
|
5768
|
if (button.length > 0) { |
5769
|
5769
|
$( "#" + button ).click(function() { |
5770
|
|
- $("#' . $dialogconfirm . '").dialog("open"); |
|
5770
|
+ $("#' . $dialogconfirm.'").dialog("open"); |
5771
|
5771
|
}); |
5772
|
5772
|
} |
5773
|
5773
|
}); |
|
@@ -5775,44 +5775,44 @@ discard block |
|
|
block discarded – undo |
5775
|
5775
|
</script>'; |
5776
|
5776
|
$formconfirm .= "<!-- end ajax formconfirm -->\n"; |
5777
|
5777
|
} else { |
5778
|
|
- $formconfirm .= "\n<!-- begin formconfirm page=" . dol_escape_htmltag($page) . " -->\n"; |
|
5778
|
+ $formconfirm .= "\n<!-- begin formconfirm page=".dol_escape_htmltag($page)." -->\n"; |
5779
|
5779
|
|
5780
|
5780
|
if (empty($disableformtag)) { |
5781
|
|
- $formconfirm .= '<form method="POST" action="' . $page . '" class="notoptoleftroright">' . "\n"; |
|
5781
|
+ $formconfirm .= '<form method="POST" action="'.$page.'" class="notoptoleftroright">'."\n"; |
5782
|
5782
|
} |
5783
|
5783
|
|
5784
|
|
- $formconfirm .= '<input type="hidden" name="action" value="' . $action . '">' . "\n"; |
5785
|
|
- $formconfirm .= '<input type="hidden" name="token" value="' . newToken() . '">' . "\n"; |
|
5784
|
+ $formconfirm .= '<input type="hidden" name="action" value="'.$action.'">'."\n"; |
|
5785
|
+ $formconfirm .= '<input type="hidden" name="token" value="'.newToken().'">'."\n"; |
5786
|
5786
|
|
5787
|
|
- $formconfirm .= '<table class="valid centpercent">' . "\n"; |
|
5787
|
+ $formconfirm .= '<table class="valid centpercent">'."\n"; |
5788
|
5788
|
|
5789
|
5789
|
// Line title |
5790
|
5790
|
$formconfirm .= '<tr class="validtitre"><td class="validtitre" colspan="2">'; |
5791
|
|
- $formconfirm .= img_picto('', 'pictoconfirm') . ' ' . $title; |
5792
|
|
- $formconfirm .= '</td></tr>' . "\n"; |
|
5791
|
+ $formconfirm .= img_picto('', 'pictoconfirm').' '.$title; |
|
5792
|
+ $formconfirm .= '</td></tr>'."\n"; |
5793
|
5793
|
|
5794
|
5794
|
// Line text |
5795
|
5795
|
if (is_array($formquestion) && array_key_exists('text', $formquestion) && !empty($formquestion['text'])) { |
5796
|
|
- $formconfirm .= '<tr class="valid"><td class="valid" colspan="2">' . $formquestion['text'] . '</td></tr>' . "\n"; |
|
5796
|
+ $formconfirm .= '<tr class="valid"><td class="valid" colspan="2">'.$formquestion['text'].'</td></tr>'."\n"; |
5797
|
5797
|
} |
5798
|
5798
|
|
5799
|
5799
|
// Line form fields |
5800
|
5800
|
if ($more) { |
5801
|
|
- $formconfirm .= '<tr class="valid"><td class="valid" colspan="2">' . "\n"; |
|
5801
|
+ $formconfirm .= '<tr class="valid"><td class="valid" colspan="2">'."\n"; |
5802
|
5802
|
$formconfirm .= $more; |
5803
|
|
- $formconfirm .= '</td></tr>' . "\n"; |
|
5803
|
+ $formconfirm .= '</td></tr>'."\n"; |
5804
|
5804
|
} |
5805
|
5805
|
|
5806
|
5806
|
// Line with question |
5807
|
5807
|
$formconfirm .= '<tr class="valid">'; |
5808
|
|
- $formconfirm .= '<td class="valid">' . $question . '</td>'; |
|
5808
|
+ $formconfirm .= '<td class="valid">'.$question.'</td>'; |
5809
|
5809
|
$formconfirm .= '<td class="valid center">'; |
5810
|
5810
|
$formconfirm .= $this->selectyesno("confirm", $newselectedchoice, 0, false, 0, 0, 'marginleftonly marginrightonly', $labelbuttonyes, $labelbuttonno); |
5811
|
|
- $formconfirm .= '<input class="button valignmiddle confirmvalidatebutton small" type="submit" value="' . $langs->trans("Validate") . '">'; |
|
5811
|
+ $formconfirm .= '<input class="button valignmiddle confirmvalidatebutton small" type="submit" value="'.$langs->trans("Validate").'">'; |
5812
|
5812
|
$formconfirm .= '</td>'; |
5813
|
|
- $formconfirm .= '</tr>' . "\n"; |
|
5813
|
+ $formconfirm .= '</tr>'."\n"; |
5814
|
5814
|
|
5815
|
|
- $formconfirm .= '</table>' . "\n"; |
|
5815
|
+ $formconfirm .= '</table>'."\n"; |
5816
|
5816
|
|
5817
|
5817
|
if (empty($disableformtag)) { |
5818
|
5818
|
$formconfirm .= "</form>\n"; |
|
@@ -5821,7 +5821,7 @@ discard block |
|
|
block discarded – undo |
5821
|
5821
|
|
5822
|
5822
|
if (!empty($conf->use_javascript_ajax)) { |
5823
|
5823
|
$formconfirm .= '<!-- code to disable button to avoid double clic -->'; |
5824
|
|
- $formconfirm .= '<script nonce="' . getNonce() . '" type="text/javascript">' . "\n"; |
|
5824
|
+ $formconfirm .= '<script nonce="'.getNonce().'" type="text/javascript">'."\n"; |
5825
|
5825
|
$formconfirm .= ' |
5826
|
5826
|
$(document).ready(function () { |
5827
|
5827
|
$(".confirmvalidatebutton").on("click", function() { |
|
@@ -5833,7 +5833,7 @@ discard block |
|
|
block discarded – undo |
5833
|
5833
|
}); |
5834
|
5834
|
}); |
5835
|
5835
|
'; |
5836
|
|
- $formconfirm .= '</script>' . "\n"; |
|
5836
|
+ $formconfirm .= '</script>'."\n"; |
5837
|
5837
|
} |
5838
|
5838
|
|
5839
|
5839
|
$formconfirm .= "<!-- end formconfirm -->\n"; |
|
@@ -5865,8 +5865,8 @@ discard block |
|
|
block discarded – undo |
5865
|
5865
|
// phpcs:enable |
5866
|
5866
|
global $langs; |
5867
|
5867
|
|
5868
|
|
- require_once DOL_DOCUMENT_ROOT . '/core/lib/project.lib.php'; |
5869
|
|
- require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php'; |
|
5868
|
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php'; |
|
5869
|
+ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; |
5870
|
5870
|
|
5871
|
5871
|
$out = ''; |
5872
|
5872
|
|
|
@@ -5874,11 +5874,11 @@ discard block |
|
|
block discarded – undo |
5874
|
5874
|
|
5875
|
5875
|
$langs->load("project"); |
5876
|
5876
|
if ($htmlname != "none") { |
5877
|
|
- $out .= '<form method="post" action="' . $page . '">'; |
|
5877
|
+ $out .= '<form method="post" action="'.$page.'">'; |
5878
|
5878
|
$out .= '<input type="hidden" name="action" value="classin">'; |
5879
|
|
- $out .= '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
5879
|
+ $out .= '<input type="hidden" name="token" value="'.newToken().'">'; |
5880
|
5880
|
$out .= $formproject->select_projects($socid, $selected, $htmlname, $maxlength, 0, 1, $discard_closed, $forcefocus, 0, 0, '', 1, 0, $morecss); |
5881
|
|
- $out .= '<input type="submit" class="button smallpaddingimp" value="' . $langs->trans("Modify") . '">'; |
|
5881
|
+ $out .= '<input type="submit" class="button smallpaddingimp" value="'.$langs->trans("Modify").'">'; |
5882
|
5882
|
$out .= '</form>'; |
5883
|
5883
|
} else { |
5884
|
5884
|
$out .= '<span class="project_head_block">'; |
|
@@ -5887,7 +5887,7 @@ discard block |
|
|
block discarded – undo |
5887
|
5887
|
$projet->fetch($selected); |
5888
|
5888
|
$out .= $projet->getNomUrl(0, '', 1); |
5889
|
5889
|
} else { |
5890
|
|
- $out .= '<span class="opacitymedium">' . $textifnoproject . '</span>'; |
|
5890
|
+ $out .= '<span class="opacitymedium">'.$textifnoproject.'</span>'; |
5891
|
5891
|
} |
5892
|
5892
|
$out .= '</span>'; |
5893
|
5893
|
} |
|
@@ -5924,14 +5924,14 @@ discard block |
|
|
block discarded – undo |
5924
|
5924
|
$out = ''; |
5925
|
5925
|
|
5926
|
5926
|
if ($htmlname != "none") { |
5927
|
|
- $out .= '<form method="POST" action="' . $page . '">'; |
|
5927
|
+ $out .= '<form method="POST" action="'.$page.'">'; |
5928
|
5928
|
$out .= '<input type="hidden" name="action" value="setconditions">'; |
5929
|
|
- $out .= '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
5929
|
+ $out .= '<input type="hidden" name="token" value="'.newToken().'">'; |
5930
|
5930
|
if ($type) { |
5931
|
|
- $out .= '<input type="hidden" name="type" value="' . dol_escape_htmltag($type) . '">'; |
|
5931
|
+ $out .= '<input type="hidden" name="type" value="'.dol_escape_htmltag($type).'">'; |
5932
|
5932
|
} |
5933
|
5933
|
$out .= $this->getSelectConditionsPaiements($selected, $htmlname, $filtertype, $addempty, 0, '', $deposit_percent); |
5934
|
|
- $out .= '<input type="submit" class="button valignmiddle smallpaddingimp" value="' . $langs->trans("Modify") . '">'; |
|
5934
|
+ $out .= '<input type="submit" class="button valignmiddle smallpaddingimp" value="'.$langs->trans("Modify").'">'; |
5935
|
5935
|
$out .= '</form>'; |
5936
|
5936
|
} else { |
5937
|
5937
|
if ($selected) { |
|
@@ -5976,12 +5976,12 @@ discard block |
|
|
block discarded – undo |
5976
|
5976
|
// phpcs:enable |
5977
|
5977
|
global $langs; |
5978
|
5978
|
if ($htmlname != "none") { |
5979
|
|
- print '<form method="post" action="' . $page . '">'; |
|
5979
|
+ print '<form method="post" action="'.$page.'">'; |
5980
|
5980
|
print '<input type="hidden" name="action" value="setavailability">'; |
5981
|
|
- print '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
5981
|
+ print '<input type="hidden" name="token" value="'.newToken().'">'; |
5982
|
5982
|
$this->selectAvailabilityDelay($selected, $htmlname, -1, $addempty); |
5983
|
|
- print '<input type="submit" name="modify" class="button smallpaddingimp" value="' . $langs->trans("Modify") . '">'; |
5984
|
|
- print '<input type="submit" name="cancel" class="button smallpaddingimp" value="' . $langs->trans("Cancel") . '">'; |
|
5983
|
+ print '<input type="submit" name="modify" class="button smallpaddingimp" value="'.$langs->trans("Modify").'">'; |
|
5984
|
+ print '<input type="submit" name="cancel" class="button smallpaddingimp" value="'.$langs->trans("Cancel").'">'; |
5985
|
5985
|
print '</form>'; |
5986
|
5986
|
} else { |
5987
|
5987
|
if ($selected) { |
|
@@ -6007,11 +6007,11 @@ discard block |
|
|
block discarded – undo |
6007
|
6007
|
{ |
6008
|
6008
|
global $langs; |
6009
|
6009
|
if ($htmlname != "none") { |
6010
|
|
- print '<form method="post" action="' . $page . '">'; |
|
6010
|
+ print '<form method="post" action="'.$page.'">'; |
6011
|
6011
|
print '<input type="hidden" name="action" value="setdemandreason">'; |
6012
|
|
- print '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
6012
|
+ print '<input type="hidden" name="token" value="'.newToken().'">'; |
6013
|
6013
|
$this->selectInputReason($selected, $htmlname, -1, $addempty); |
6014
|
|
- print '<input type="submit" class="button smallpaddingimp" value="' . $langs->trans("Modify") . '">'; |
|
6014
|
+ print '<input type="submit" class="button smallpaddingimp" value="'.$langs->trans("Modify").'">'; |
6015
|
6015
|
print '</form>'; |
6016
|
6016
|
} else { |
6017
|
6017
|
if ($selected) { |
|
@@ -6051,17 +6051,17 @@ discard block |
|
|
block discarded – undo |
6051
|
6051
|
$ret = ''; |
6052
|
6052
|
|
6053
|
6053
|
if ($htmlname != "none") { |
6054
|
|
- $ret .= '<form method="POST" action="' . $page . '" name="form' . $htmlname . '">'; |
6055
|
|
- $ret .= '<input type="hidden" name="action" value="set' . $htmlname . '">'; |
6056
|
|
- $ret .= '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
6054
|
+ $ret .= '<form method="POST" action="'.$page.'" name="form'.$htmlname.'">'; |
|
6055
|
+ $ret .= '<input type="hidden" name="action" value="set'.$htmlname.'">'; |
|
6056
|
+ $ret .= '<input type="hidden" name="token" value="'.newToken().'">'; |
6057
|
6057
|
if ($type) { |
6058
|
|
- $ret .= '<input type="hidden" name="type" value="' . dol_escape_htmltag($type) . '">'; |
|
6058
|
+ $ret .= '<input type="hidden" name="type" value="'.dol_escape_htmltag($type).'">'; |
6059
|
6059
|
} |
6060
|
6060
|
$ret .= '<table class="nobordernopadding">'; |
6061
|
6061
|
$ret .= '<tr><td>'; |
6062
|
|
- $ret .= $this->selectDate($selected, $htmlname, $displayhour, $displaymin, 1, 'form' . $htmlname, 1, 0); |
|
6062
|
+ $ret .= $this->selectDate($selected, $htmlname, $displayhour, $displaymin, 1, 'form'.$htmlname, 1, 0); |
6063
|
6063
|
$ret .= '</td>'; |
6064
|
|
- $ret .= '<td class="left"><input type="submit" class="button smallpaddingimp" value="' . $langs->trans("Modify") . '"></td>'; |
|
6064
|
+ $ret .= '<td class="left"><input type="submit" class="button smallpaddingimp" value="'.$langs->trans("Modify").'"></td>'; |
6065
|
6065
|
$ret .= '</tr></table></form>'; |
6066
|
6066
|
} else { |
6067
|
6067
|
if ($displayhour) { |
|
@@ -6096,15 +6096,15 @@ discard block |
|
|
block discarded – undo |
6096
|
6096
|
global $langs; |
6097
|
6097
|
|
6098
|
6098
|
if ($htmlname != "none") { |
6099
|
|
- print '<form method="POST" action="' . $page . '" name="form' . $htmlname . '">'; |
6100
|
|
- print '<input type="hidden" name="action" value="set' . $htmlname . '">'; |
6101
|
|
- print '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
6099
|
+ print '<form method="POST" action="'.$page.'" name="form'.$htmlname.'">'; |
|
6100
|
+ print '<input type="hidden" name="action" value="set'.$htmlname.'">'; |
|
6101
|
+ print '<input type="hidden" name="token" value="'.newToken().'">'; |
6102
|
6102
|
print $this->select_dolusers($selected, $htmlname, 1, $exclude, 0, $include); |
6103
|
|
- print '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">'; |
|
6103
|
+ print '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">'; |
6104
|
6104
|
print '</form>'; |
6105
|
6105
|
} else { |
6106
|
6106
|
if ($selected) { |
6107
|
|
- require_once DOL_DOCUMENT_ROOT . '/user/class/user.class.php'; |
|
6107
|
+ require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; |
6108
|
6108
|
$theuser = new User($this->db); |
6109
|
6109
|
$theuser->fetch($selected); |
6110
|
6110
|
print $theuser->getNomUrl(1); |
|
@@ -6137,14 +6137,14 @@ discard block |
|
|
block discarded – undo |
6137
|
6137
|
|
6138
|
6138
|
$out = ''; |
6139
|
6139
|
if ($htmlname != "none") { |
6140
|
|
- $out .= '<form method="POST" action="' . $page . '">'; |
|
6140
|
+ $out .= '<form method="POST" action="'.$page.'">'; |
6141
|
6141
|
$out .= '<input type="hidden" name="action" value="setmode">'; |
6142
|
|
- $out .= '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
6142
|
+ $out .= '<input type="hidden" name="token" value="'.newToken().'">'; |
6143
|
6143
|
if ($type) { |
6144
|
|
- $out .= '<input type="hidden" name="type" value="' . dol_escape_htmltag($type) . '">'; |
|
6144
|
+ $out .= '<input type="hidden" name="type" value="'.dol_escape_htmltag($type).'">'; |
6145
|
6145
|
} |
6146
|
6146
|
$out .= $this->select_types_paiements($selected, $htmlname, $filtertype, 0, $addempty, 0, 0, $active, '', 1); |
6147
|
|
- $out .= '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">'; |
|
6147
|
+ $out .= '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">'; |
6148
|
6148
|
$out .= '</form>'; |
6149
|
6149
|
} else { |
6150
|
6150
|
if ($selected) { |
|
@@ -6177,11 +6177,11 @@ discard block |
|
|
block discarded – undo |
6177
|
6177
|
{ |
6178
|
6178
|
global $langs; |
6179
|
6179
|
if ($htmlname != "none") { |
6180
|
|
- print '<form method="POST" action="' . $page . '">'; |
|
6180
|
+ print '<form method="POST" action="'.$page.'">'; |
6181
|
6181
|
print '<input type="hidden" name="action" value="settransportmode">'; |
6182
|
|
- print '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
6182
|
+ print '<input type="hidden" name="token" value="'.newToken().'">'; |
6183
|
6183
|
$this->selectTransportMode($selected, $htmlname, 0, $addempty, 0, 0, $active); |
6184
|
|
- print '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">'; |
|
6184
|
+ print '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">'; |
6185
|
6185
|
print '</form>'; |
6186
|
6186
|
} else { |
6187
|
6187
|
if ($selected) { |
|
@@ -6208,14 +6208,14 @@ discard block |
|
|
block discarded – undo |
6208
|
6208
|
// phpcs:enable |
6209
|
6209
|
global $langs; |
6210
|
6210
|
if ($htmlname != "none") { |
6211
|
|
- print '<form method="POST" action="' . $page . '">'; |
|
6211
|
+ print '<form method="POST" action="'.$page.'">'; |
6212
|
6212
|
print '<input type="hidden" name="action" value="setmulticurrencycode">'; |
6213
|
|
- print '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
6213
|
+ print '<input type="hidden" name="token" value="'.newToken().'">'; |
6214
|
6214
|
print $this->selectMultiCurrency($selected, $htmlname, 0); |
6215
|
|
- print '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">'; |
|
6215
|
+ print '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">'; |
6216
|
6216
|
print '</form>'; |
6217
|
6217
|
} else { |
6218
|
|
- require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php'; |
|
6218
|
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; |
6219
|
6219
|
print !empty($selected) ? currency_name($selected, 1) : ' '; |
6220
|
6220
|
} |
6221
|
6221
|
} |
|
@@ -6237,21 +6237,21 @@ discard block |
|
|
block discarded – undo |
6237
|
6237
|
global $langs, $mysoc, $conf; |
6238
|
6238
|
|
6239
|
6239
|
if ($htmlname != "none") { |
6240
|
|
- print '<form method="POST" action="' . $page . '">'; |
|
6240
|
+ print '<form method="POST" action="'.$page.'">'; |
6241
|
6241
|
print '<input type="hidden" name="action" value="setmulticurrencyrate">'; |
6242
|
|
- print '<input type="hidden" name="token" value="' . newToken() . '">'; |
6243
|
|
- print '<input type="text" class="maxwidth100" name="' . $htmlname . '" value="' . (!empty($rate) ? price(price2num($rate, 'CU')) : 1) . '" /> '; |
|
6242
|
+ print '<input type="hidden" name="token" value="'.newToken().'">'; |
|
6243
|
+ print '<input type="text" class="maxwidth100" name="'.$htmlname.'" value="'.(!empty($rate) ? price(price2num($rate, 'CU')) : 1).'" /> '; |
6244
|
6244
|
print '<select name="calculation_mode">'; |
6245
|
|
- print '<option value="1">Change ' . $langs->trans("PriceUHT") . ' of lines</option>'; |
6246
|
|
- print '<option value="2">Change ' . $langs->trans("PriceUHTCurrency") . ' of lines</option>'; |
|
6245
|
+ print '<option value="1">Change '.$langs->trans("PriceUHT").' of lines</option>'; |
|
6246
|
+ print '<option value="2">Change '.$langs->trans("PriceUHTCurrency").' of lines</option>'; |
6247
|
6247
|
print '</select> '; |
6248
|
|
- print '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">'; |
|
6248
|
+ print '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">'; |
6249
|
6249
|
print '</form>'; |
6250
|
6250
|
} else { |
6251
|
6251
|
if (!empty($rate)) { |
6252
|
6252
|
print price($rate, 1, $langs, 0, 0); |
6253
|
6253
|
if ($currency && $rate != 1) { |
6254
|
|
- print ' (' . price($rate, 1, $langs, 0, 0) . ' ' . $currency . ' = 1 ' . $conf->currency . ')'; |
|
6254
|
+ print ' ('.price($rate, 1, $langs, 0, 0).' '.$currency.' = 1 '.$conf->currency.')'; |
6255
|
6255
|
} |
6256
|
6256
|
} else { |
6257
|
6257
|
print 1; |
|
@@ -6282,9 +6282,9 @@ discard block |
|
|
block discarded – undo |
6282
|
6282
|
// phpcs:enable |
6283
|
6283
|
global $conf, $langs; |
6284
|
6284
|
if ($htmlname != "none") { |
6285
|
|
- print '<form method="post" action="' . $page . '">'; |
|
6285
|
+ print '<form method="post" action="'.$page.'">'; |
6286
|
6286
|
print '<input type="hidden" name="action" value="setabsolutediscount">'; |
6287
|
|
- print '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
6287
|
+ print '<input type="hidden" name="token" value="'.newToken().'">'; |
6288
|
6288
|
print '<div class="inline-block">'; |
6289
|
6289
|
if (!empty($discount_type)) { |
6290
|
6290
|
if (getDolGlobalString('FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS')) { |
|
@@ -6322,24 +6322,24 @@ discard block |
|
|
block discarded – undo |
6322
|
6322
|
print '</div>'; |
6323
|
6323
|
if (empty($hidelist)) { |
6324
|
6324
|
print '<div class="inline-block" style="padding-right: 10px">'; |
6325
|
|
- $newfilter = 'discount_type=' . intval($discount_type); |
|
6325
|
+ $newfilter = 'discount_type='.intval($discount_type); |
6326
|
6326
|
if (!empty($discount_type)) { |
6327
|
6327
|
$newfilter .= ' AND fk_invoice_supplier IS NULL AND fk_invoice_supplier_line IS NULL'; // Supplier discounts available |
6328
|
6328
|
} else { |
6329
|
6329
|
$newfilter .= ' AND fk_facture IS NULL AND fk_facture_line IS NULL'; // Customer discounts available |
6330
|
6330
|
} |
6331
|
6331
|
if ($filter) { |
6332
|
|
- $newfilter .= ' AND (' . $filter . ')'; |
|
6332
|
+ $newfilter .= ' AND ('.$filter.')'; |
6333
|
6333
|
} |
6334
|
6334
|
// output the combo of discounts |
6335
|
6335
|
$nbqualifiedlines = $this->select_remises($selected, $htmlname, $newfilter, $socid, $maxvalue); |
6336
|
6336
|
if ($nbqualifiedlines > 0) { |
6337
|
|
- print ' <input type="submit" class="button smallpaddingimp" value="' . dol_escape_htmltag($langs->trans("UseLine")) . '"'; |
|
6337
|
+ print ' <input type="submit" class="button smallpaddingimp" value="'.dol_escape_htmltag($langs->trans("UseLine")).'"'; |
6338
|
6338
|
if (!empty($discount_type) && $filter && $filter != "fk_invoice_supplier_source IS NULL OR (description LIKE '(DEPOSIT)%' AND description NOT LIKE '(EXCESS PAID)%')") { |
6339
|
|
- print ' title="' . $langs->trans("UseCreditNoteInInvoicePayment") . '"'; |
|
6339
|
+ print ' title="'.$langs->trans("UseCreditNoteInInvoicePayment").'"'; |
6340
|
6340
|
} |
6341
|
6341
|
if (empty($discount_type) && $filter && $filter != "fk_facture_source IS NULL OR (description LIKE '(DEPOSIT)%' AND description NOT LIKE '(EXCESS RECEIVED)%')") { |
6342
|
|
- print ' title="' . $langs->trans("UseCreditNoteInInvoicePayment") . '"'; |
|
6342
|
+ print ' title="'.$langs->trans("UseCreditNoteInInvoicePayment").'"'; |
6343
|
6343
|
} |
6344
|
6344
|
|
6345
|
6345
|
print '>'; |
|
@@ -6379,23 +6379,23 @@ discard block |
|
|
block discarded – undo |
6379
|
6379
|
global $langs; |
6380
|
6380
|
|
6381
|
6381
|
if ($htmlname != "none") { |
6382
|
|
- print '<form method="post" action="' . $page . '">'; |
|
6382
|
+ print '<form method="post" action="'.$page.'">'; |
6383
|
6383
|
print '<input type="hidden" name="action" value="set_contact">'; |
6384
|
|
- print '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
6384
|
+ print '<input type="hidden" name="token" value="'.newToken().'">'; |
6385
|
6385
|
print '<table class="nobordernopadding">'; |
6386
|
6386
|
print '<tr><td>'; |
6387
|
6387
|
print $this->selectcontacts($societe->id, $selected, $htmlname); |
6388
|
6388
|
$num = $this->num; |
6389
|
6389
|
if ($num == 0) { |
6390
|
6390
|
$addcontact = (getDolGlobalString('SOCIETE_ADDRESSES_MANAGEMENT') ? $langs->trans("AddContact") : $langs->trans("AddContactAddress")); |
6391
|
|
- print '<a href="' . DOL_URL_ROOT . '/contact/card.php?socid=' . $societe->id . '&action=create&backtoreferer=1">' . $addcontact . '</a>'; |
|
6391
|
+ print '<a href="'.DOL_URL_ROOT.'/contact/card.php?socid='.$societe->id.'&action=create&backtoreferer=1">'.$addcontact.'</a>'; |
6392
|
6392
|
} |
6393
|
6393
|
print '</td>'; |
6394
|
|
- print '<td class="left"><input type="submit" class="button smallpaddingimp" value="' . $langs->trans("Modify") . '"></td>'; |
|
6394
|
+ print '<td class="left"><input type="submit" class="button smallpaddingimp" value="'.$langs->trans("Modify").'"></td>'; |
6395
|
6395
|
print '</tr></table></form>'; |
6396
|
6396
|
} else { |
6397
|
6397
|
if ($selected) { |
6398
|
|
- require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php'; |
|
6398
|
+ require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; |
6399
|
6399
|
$contact = new Contact($this->db); |
6400
|
6400
|
$contact->fetch($selected); |
6401
|
6401
|
print $contact->getFullName($langs); |
|
@@ -6430,20 +6430,20 @@ discard block |
|
|
block discarded – undo |
6430
|
6430
|
|
6431
|
6431
|
$out = ''; |
6432
|
6432
|
if ($htmlname != "none") { |
6433
|
|
- $out .= '<form method="post" action="' . $page . '">'; |
|
6433
|
+ $out .= '<form method="post" action="'.$page.'">'; |
6434
|
6434
|
$out .= '<input type="hidden" name="action" value="set_thirdparty">'; |
6435
|
|
- $out .= '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
6435
|
+ $out .= '<input type="hidden" name="token" value="'.newToken().'">'; |
6436
|
6436
|
$out .= $this->select_company($selected, $htmlname, $filter, $showempty, $showtype, $forcecombo, $events, 0, 'minwidth100', '', '', 1, array(), false, $excludeids); |
6437
|
|
- $out .= '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">'; |
|
6437
|
+ $out .= '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">'; |
6438
|
6438
|
$out .= '</form>'; |
6439
|
6439
|
} else { |
6440
|
6440
|
if ($selected) { |
6441
|
|
- require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; |
|
6441
|
+ require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; |
6442
|
6442
|
$soc = new Societe($this->db); |
6443
|
6443
|
$soc->fetch($selected); |
6444
|
6444
|
$out .= $soc->getNomUrl(0, ''); |
6445
|
6445
|
} else { |
6446
|
|
- $out .= '<span class="opacitymedium">' . $textifnothirdparty . '</span>'; |
|
6446
|
+ $out .= '<span class="opacitymedium">'.$textifnothirdparty.'</span>'; |
6447
|
6447
|
} |
6448
|
6448
|
} |
6449
|
6449
|
|
|
@@ -6493,22 +6493,22 @@ discard block |
|
|
block discarded – undo |
6493
|
6493
|
$selected = 'EUR'; // Pour compatibilite |
6494
|
6494
|
} |
6495
|
6495
|
|
6496
|
|
- $out .= '<select class="flat maxwidth200onsmartphone minwidth300" name="' . $htmlname . '" id="' . $htmlname . '">'; |
|
6496
|
+ $out .= '<select class="flat maxwidth200onsmartphone minwidth300" name="'.$htmlname.'" id="'.$htmlname.'">'; |
6497
|
6497
|
if ($useempty) { |
6498
|
6498
|
$out .= '<option value="-1" selected></option>'; |
6499
|
6499
|
} |
6500
|
6500
|
foreach ($langs->cache_currencies as $code_iso => $currency) { |
6501
|
6501
|
$labeltoshow = $currency['label']; |
6502
|
6502
|
if ($mode == 1) { |
6503
|
|
- $labeltoshow .= ' <span class="opacitymedium">(' . $code_iso . ')</span>'; |
|
6503
|
+ $labeltoshow .= ' <span class="opacitymedium">('.$code_iso.')</span>'; |
6504
|
6504
|
} else { |
6505
|
|
- $labeltoshow .= ' <span class="opacitymedium">(' . $langs->getCurrencySymbol($code_iso) . ')</span>'; |
|
6505
|
+ $labeltoshow .= ' <span class="opacitymedium">('.$langs->getCurrencySymbol($code_iso).')</span>'; |
6506
|
6506
|
} |
6507
|
6507
|
|
6508
|
6508
|
if ($selected && $selected == $code_iso) { |
6509
|
|
- $out .= '<option value="' . $code_iso . '" selected data-html="' . dol_escape_htmltag($labeltoshow) . '">'; |
|
6509
|
+ $out .= '<option value="'.$code_iso.'" selected data-html="'.dol_escape_htmltag($labeltoshow).'">'; |
6510
|
6510
|
} else { |
6511
|
|
- $out .= '<option value="' . $code_iso . '" data-html="' . dol_escape_htmltag($labeltoshow) . '">'; |
|
6511
|
+ $out .= '<option value="'.$code_iso.'" data-html="'.dol_escape_htmltag($labeltoshow).'">'; |
6512
|
6512
|
} |
6513
|
6513
|
$out .= $labeltoshow; |
6514
|
6514
|
$out .= '</option>'; |
|
@@ -6519,7 +6519,7 @@ discard block |
|
|
block discarded – undo |
6519
|
6519
|
} |
6520
|
6520
|
|
6521
|
6521
|
// Make select dynamic |
6522
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
6522
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
6523
|
6523
|
$out .= ajax_combobox($htmlname); |
6524
|
6524
|
|
6525
|
6525
|
return $out; |
|
@@ -6545,10 +6545,10 @@ discard block |
|
|
block discarded – undo |
6545
|
6545
|
|
6546
|
6546
|
$TCurrency = array(); |
6547
|
6547
|
|
6548
|
|
- $sql = "SELECT code FROM " . $this->db->prefix() . "multicurrency"; |
6549
|
|
- $sql .= " WHERE entity IN ('" . getEntity('mutlicurrency') . "')"; |
|
6548
|
+ $sql = "SELECT code FROM ".$this->db->prefix()."multicurrency"; |
|
6549
|
+ $sql .= " WHERE entity IN ('".getEntity('mutlicurrency')."')"; |
6550
|
6550
|
if ($filter) { |
6551
|
|
- $sql .= " AND " . $filter; |
|
6551
|
+ $sql .= " AND ".$filter; |
6552
|
6552
|
} |
6553
|
6553
|
$resql = $this->db->query($sql); |
6554
|
6554
|
if ($resql) { |
|
@@ -6558,7 +6558,7 @@ discard block |
|
|
block discarded – undo |
6558
|
6558
|
} |
6559
|
6559
|
|
6560
|
6560
|
$out = ''; |
6561
|
|
- $out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">'; |
|
6561
|
+ $out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">'; |
6562
|
6562
|
if ($useempty) { |
6563
|
6563
|
$out .= '<option value=""> </option>'; |
6564
|
6564
|
} |
|
@@ -6570,13 +6570,13 @@ discard block |
|
|
block discarded – undo |
6570
|
6570
|
foreach ($langs->cache_currencies as $code_iso => $currency) { |
6571
|
6571
|
if (isset($TCurrency[$code_iso])) { |
6572
|
6572
|
if (!empty($selected) && $selected == $code_iso) { |
6573
|
|
- $out .= '<option value="' . $code_iso . '" selected="selected">'; |
|
6573
|
+ $out .= '<option value="'.$code_iso.'" selected="selected">'; |
6574
|
6574
|
} else { |
6575
|
|
- $out .= '<option value="' . $code_iso . '">'; |
|
6575
|
+ $out .= '<option value="'.$code_iso.'">'; |
6576
|
6576
|
} |
6577
|
6577
|
|
6578
|
6578
|
$out .= $currency['label']; |
6579
|
|
- $out .= ' (' . $langs->getCurrencySymbol($code_iso) . ')'; |
|
6579
|
+ $out .= ' ('.$langs->getCurrencySymbol($code_iso).')'; |
6580
|
6580
|
$out .= '</option>'; |
6581
|
6581
|
} |
6582
|
6582
|
} |
|
@@ -6585,7 +6585,7 @@ discard block |
|
|
block discarded – undo |
6585
|
6585
|
$out .= '</select>'; |
6586
|
6586
|
|
6587
|
6587
|
// Make select dynamic |
6588
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
6588
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
6589
|
6589
|
$out .= ajax_combobox($htmlname); |
6590
|
6590
|
|
6591
|
6591
|
return $out; |
|
@@ -6616,7 +6616,7 @@ discard block |
|
|
block discarded – undo |
6616
|
6616
|
$sql .= " WHERE t.fk_pays = c.rowid"; |
6617
|
6617
|
$sql .= " AND t.active > 0"; |
6618
|
6618
|
$sql .= " AND t.entity IN (".getEntity('c_tva').")"; |
6619
|
|
- $sql .= " AND c.code IN (" . $this->db->sanitize($country_code, 1) . ")"; |
|
6619
|
+ $sql .= " AND c.code IN (".$this->db->sanitize($country_code, 1).")"; |
6620
|
6620
|
$sql .= " ORDER BY t.code ASC, t.taux ASC, t.recuperableonly ASC"; |
6621
|
6621
|
|
6622
|
6622
|
$resql = $this->db->query($sql); |
|
@@ -6628,30 +6628,30 @@ discard block |
|
|
block discarded – undo |
6628
|
6628
|
|
6629
|
6629
|
$tmparray = array(); |
6630
|
6630
|
$tmparray['rowid'] = $obj->rowid; |
6631
|
|
- $tmparray['type_vat'] = $obj->type_vat; |
6632
|
|
- $tmparray['code'] = $obj->code; |
|
6631
|
+ $tmparray['type_vat'] = $obj->type_vat; |
|
6632
|
+ $tmparray['code'] = $obj->code; |
6633
|
6633
|
$tmparray['txtva'] = $obj->taux; |
6634
|
|
- $tmparray['nprtva'] = $obj->recuperableonly; |
|
6634
|
+ $tmparray['nprtva'] = $obj->recuperableonly; |
6635
|
6635
|
$tmparray['localtax1'] = $obj->localtax1; |
6636
|
6636
|
$tmparray['localtax1_type'] = $obj->localtax1_type; |
6637
|
6637
|
$tmparray['localtax2'] = $obj->localtax2; |
6638
|
6638
|
$tmparray['localtax2_type'] = $obj->localtax1_type; |
6639
|
|
- $tmparray['label'] = $obj->taux . '%' . ($obj->code ? ' (' . $obj->code . ')' : ''); // Label must contains only 0-9 , . % or * |
6640
|
|
- $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 |
|
6639
|
+ $tmparray['label'] = $obj->taux.'%'.($obj->code ? ' ('.$obj->code.')' : ''); // Label must contains only 0-9 , . % or * |
|
6640
|
+ $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 |
6641
|
6641
|
$positiverates = ''; |
6642
|
6642
|
if ($obj->taux) { |
6643
|
|
- $positiverates .= ($positiverates ? '/' : '') . $obj->taux; |
|
6643
|
+ $positiverates .= ($positiverates ? '/' : '').$obj->taux; |
6644
|
6644
|
} |
6645
|
6645
|
if ($obj->localtax1) { |
6646
|
|
- $positiverates .= ($positiverates ? '/' : '') . $obj->localtax1; |
|
6646
|
+ $positiverates .= ($positiverates ? '/' : '').$obj->localtax1; |
6647
|
6647
|
} |
6648
|
6648
|
if ($obj->localtax2) { |
6649
|
|
- $positiverates .= ($positiverates ? '/' : '') . $obj->localtax2; |
|
6649
|
+ $positiverates .= ($positiverates ? '/' : '').$obj->localtax2; |
6650
|
6650
|
} |
6651
|
6651
|
if (empty($positiverates)) { |
6652
|
6652
|
$positiverates = '0'; |
6653
|
6653
|
} |
6654
|
|
- $tmparray['labelpositiverates'] = $positiverates . ($obj->code ? ' (' . $obj->code . ')' : ''); // Must never be used as key, only label |
|
6654
|
+ $tmparray['labelpositiverates'] = $positiverates.($obj->code ? ' ('.$obj->code.')' : ''); // Must never be used as key, only label |
6655
|
6655
|
|
6656
|
6656
|
$this->cache_vatrates[$obj->rowid] = $tmparray; |
6657
|
6657
|
} |
|
@@ -6671,7 +6671,7 @@ discard block |
|
|
block discarded – undo |
6671
|
6671
|
return -1; |
6672
|
6672
|
} |
6673
|
6673
|
} else { |
6674
|
|
- $this->error = '<span class="error">' . $this->db->error() . '</span>'; |
|
6674
|
+ $this->error = '<span class="error">'.$this->db->error().'</span>'; |
6675
|
6675
|
return -2; |
6676
|
6676
|
} |
6677
|
6677
|
} |
|
@@ -6724,9 +6724,9 @@ discard block |
|
|
block discarded – undo |
6724
|
6724
|
// Check parameters |
6725
|
6725
|
if (is_object($societe_vendeuse) && !$societe_vendeuse->country_code) { |
6726
|
6726
|
if ($societe_vendeuse->id == $mysoc->id) { |
6727
|
|
- $return .= '<span class="error">' . $langs->trans("ErrorYourCountryIsNotDefined") . '</span>'; |
|
6727
|
+ $return .= '<span class="error">'.$langs->trans("ErrorYourCountryIsNotDefined").'</span>'; |
6728
|
6728
|
} else { |
6729
|
|
- $return .= '<span class="error">' . $langs->trans("ErrorSupplierCountryIsNotDefined") . '</span>'; |
|
6729
|
+ $return .= '<span class="error">'.$langs->trans("ErrorSupplierCountryIsNotDefined").'</span>'; |
6730
|
6730
|
} |
6731
|
6731
|
return $return; |
6732
|
6732
|
} |
|
@@ -6738,12 +6738,12 @@ discard block |
|
|
block discarded – undo |
6738
|
6738
|
// Define list of countries to use to search VAT rates to show |
6739
|
6739
|
// First we defined code_country to use to find list |
6740
|
6740
|
if (is_object($societe_vendeuse)) { |
6741
|
|
- $code_country = "'" . $societe_vendeuse->country_code . "'"; |
|
6741
|
+ $code_country = "'".$societe_vendeuse->country_code."'"; |
6742
|
6742
|
} else { |
6743
|
|
- $code_country = "'" . $mysoc->country_code . "'"; // Pour compatibilite ascendente |
|
6743
|
+ $code_country = "'".$mysoc->country_code."'"; // Pour compatibilite ascendente |
6744
|
6744
|
} |
6745
|
6745
|
if (getDolGlobalString('SERVICE_ARE_ECOMMERCE_200238EC')) { // If option to have vat for end customer for services is on |
6746
|
|
- require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php'; |
|
6746
|
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; |
6747
|
6747
|
// If SERVICE_ARE_ECOMMERCE_200238EC=1 combo list vat rate of purchaser and seller countries |
6748
|
6748
|
// If SERVICE_ARE_ECOMMERCE_200238EC=2 combo list only the vat rate of the purchaser country |
6749
|
6749
|
$selectVatComboMode = getDolGlobalString('SERVICE_ARE_ECOMMERCE_200238EC'); |
|
@@ -6753,27 +6753,27 @@ discard block |
|
|
block discarded – undo |
6753
|
6753
|
if ($type == 1) { // We know product is a service |
6754
|
6754
|
switch ($selectVatComboMode) { |
6755
|
6755
|
case '1': |
6756
|
|
- $code_country .= ",'" . $societe_acheteuse->country_code . "'"; |
|
6756
|
+ $code_country .= ",'".$societe_acheteuse->country_code."'"; |
6757
|
6757
|
break; |
6758
|
6758
|
case '2': |
6759
|
|
- $code_country = "'" . $societe_acheteuse->country_code . "'"; |
|
6759
|
+ $code_country = "'".$societe_acheteuse->country_code."'"; |
6760
|
6760
|
break; |
6761
|
6761
|
} |
6762
|
6762
|
} |
6763
|
6763
|
} elseif (!$idprod) { // We don't know type of product |
6764
|
6764
|
switch ($selectVatComboMode) { |
6765
|
6765
|
case '1': |
6766
|
|
- $code_country .= ",'" . $societe_acheteuse->country_code . "'"; |
|
6766
|
+ $code_country .= ",'".$societe_acheteuse->country_code."'"; |
6767
|
6767
|
break; |
6768
|
6768
|
case '2': |
6769
|
|
- $code_country = "'" . $societe_acheteuse->country_code . "'"; |
|
6769
|
+ $code_country = "'".$societe_acheteuse->country_code."'"; |
6770
|
6770
|
break; |
6771
|
6771
|
} |
6772
|
6772
|
} else { |
6773
|
6773
|
$prodstatic = new Product($this->db); |
6774
|
6774
|
$prodstatic->fetch($idprod); |
6775
|
6775
|
if ($prodstatic->type == Product::TYPE_SERVICE) { // We know product is a service |
6776
|
|
- $code_country .= ",'" . $societe_acheteuse->country_code . "'"; |
|
6776
|
+ $code_country .= ",'".$societe_acheteuse->country_code."'"; |
6777
|
6777
|
} |
6778
|
6778
|
} |
6779
|
6779
|
} |
|
@@ -6835,13 +6835,13 @@ discard block |
|
|
block discarded – undo |
6835
|
6835
|
// Override/enable VAT for expense report regardless of global setting - needed if expense report used for business expenses instead |
6836
|
6836
|
// of using supplier invoices (this is a very bad idea !) |
6837
|
6837
|
if (!getDolGlobalString('EXPENSEREPORT_OVERRIDE_VAT')) { |
6838
|
|
- $title = ' title="' . dol_escape_htmltag($langs->trans('VATIsNotUsed')) . '"'; |
|
6838
|
+ $title = ' title="'.dol_escape_htmltag($langs->trans('VATIsNotUsed')).'"'; |
6839
|
6839
|
$disabled = true; |
6840
|
6840
|
} |
6841
|
6841
|
} |
6842
|
6842
|
|
6843
|
6843
|
if (!$options_only) { |
6844
|
|
- $return .= '<select class="flat minwidth75imp maxwidth100 right" id="' . $htmlname . '" name="' . $htmlname . '"' . ($disabled ? ' disabled' : '') . $title . '>'; |
|
6844
|
+ $return .= '<select class="flat minwidth75imp maxwidth100 right" id="'.$htmlname.'" name="'.$htmlname.'"'.($disabled ? ' disabled' : '').$title.'>'; |
6845
|
6845
|
} |
6846
|
6846
|
|
6847
|
6847
|
$selectedfound = false; |
|
@@ -6855,13 +6855,13 @@ discard block |
|
|
block discarded – undo |
6855
|
6855
|
$key = $rate['txtva']; |
6856
|
6856
|
$key .= $rate['nprtva'] ? '*' : ''; |
6857
|
6857
|
if ($mode > 0 && $rate['code']) { |
6858
|
|
- $key .= ' (' . $rate['code'] . ')'; |
|
6858
|
+ $key .= ' ('.$rate['code'].')'; |
6859
|
6859
|
} |
6860
|
6860
|
if ($mode < 0) { |
6861
|
6861
|
$key = $rate['rowid']; |
6862
|
6862
|
} |
6863
|
6863
|
|
6864
|
|
- $return .= '<option value="' . $key . '"'; |
|
6864
|
+ $return .= '<option value="'.$key.'"'; |
6865
|
6865
|
if (!$selectedfound) { |
6866
|
6866
|
if ($defaultcode) { // If defaultcode is defined, we used it in priority to select combo option instead of using rate+npr flag |
6867
|
6867
|
if ($defaultcode == $rate['code']) { |
|
@@ -6932,7 +6932,7 @@ discard block |
|
|
block discarded – undo |
6932
|
6932
|
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 = '') |
6933
|
6933
|
{ |
6934
|
6934
|
// phpcs:enable |
6935
|
|
- dol_syslog(__METHOD__ . ': using select_date is deprecated. Use selectDate instead.', LOG_WARNING); |
|
6935
|
+ dol_syslog(__METHOD__.': using select_date is deprecated. Use selectDate instead.', LOG_WARNING); |
6936
|
6936
|
$retstring = $this->selectDate($set_time, $prefix, $h, $m, $empty, $form_name, $d, $addnowlink, $disabled, $fullday, $addplusone, $adddateof); |
6937
|
6937
|
if (!empty($nooutput)) { |
6938
|
6938
|
return $retstring; |
|
@@ -6961,11 +6961,11 @@ discard block |
|
|
block discarded – undo |
6961
|
6961
|
{ |
6962
|
6962
|
global $langs; |
6963
|
6963
|
|
6964
|
|
- $ret = $this->selectDate($set_time, $prefix . '_start', 0, 0, $empty, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("from"), 'tzuserrel'); |
|
6964
|
+ $ret = $this->selectDate($set_time, $prefix.'_start', 0, 0, $empty, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("from"), 'tzuserrel'); |
6965
|
6965
|
if ($forcenewline) { |
6966
|
6966
|
$ret .= '<br>'; |
6967
|
6967
|
} |
6968
|
|
- $ret .= $this->selectDate($set_time_end, $prefix . '_end', 0, 0, $empty, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"), 'tzuserrel'); |
|
6968
|
+ $ret .= $this->selectDate($set_time_end, $prefix.'_end', 0, 0, $empty, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"), 'tzuserrel'); |
6969
|
6969
|
return $ret; |
6970
|
6970
|
} |
6971
|
6971
|
|
|
@@ -7031,7 +7031,7 @@ discard block |
|
|
block discarded – undo |
7031
|
7031
|
$orig_set_time = $set_time; |
7032
|
7032
|
|
7033
|
7033
|
if ($set_time === '' && $emptydate == 0) { |
7034
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php'; |
|
7034
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; |
7035
|
7035
|
if ($gm == 'tzuser' || $gm == 'tzuserrel') { |
7036
|
7036
|
$set_time = dol_now($gm); |
7037
|
7037
|
} else { |
|
@@ -7103,38 +7103,38 @@ discard block |
|
|
block discarded – undo |
7103
|
7103
|
// Calendrier popup version eldy |
7104
|
7104
|
if ($usecalendar == "eldy") { |
7105
|
7105
|
// Input area to enter date manually |
7106
|
|
- $retstring .= '<input id="' . $prefix . '" name="' . $prefix . '" type="text" class="maxwidthdate center" maxlength="11" value="' . $formated_date . '"'; |
|
7106
|
+ $retstring .= '<input id="'.$prefix.'" name="'.$prefix.'" type="text" class="maxwidthdate center" maxlength="11" value="'.$formated_date.'"'; |
7107
|
7107
|
$retstring .= ($disabled ? ' disabled' : ''); |
7108
|
|
- $retstring .= ' onChange="dpChangeDay(\'' . $prefix . '\',\'' . $langs->trans("FormatDateShortJavaInput") . '\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript |
|
7108
|
+ $retstring .= ' onChange="dpChangeDay(\''.$prefix.'\',\''.$langs->trans("FormatDateShortJavaInput").'\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript |
7109
|
7109
|
$retstring .= ' autocomplete="off">'; |
7110
|
7110
|
|
7111
|
7111
|
// Icon calendar |
7112
|
7112
|
$retstringbuttom = ''; |
7113
|
7113
|
if (!$disabled) { |
7114
|
|
- $retstringbuttom = '<button id="' . $prefix . 'Button" type="button" class="dpInvisibleButtons"'; |
7115
|
|
- $base = DOL_URL_ROOT . '/core/'; |
7116
|
|
- $retstringbuttom .= ' onClick="showDP(\'' . $base . '\',\'' . $prefix . '\',\'' . $langs->trans("FormatDateShortJavaInput") . '\',\'' . $langs->defaultlang . '\');"'; |
7117
|
|
- $retstringbuttom .= '>' . img_object($langs->trans("SelectDate"), 'calendarday', 'class="datecallink"') . '</button>'; |
|
7114
|
+ $retstringbuttom = '<button id="'.$prefix.'Button" type="button" class="dpInvisibleButtons"'; |
|
7115
|
+ $base = DOL_URL_ROOT.'/core/'; |
|
7116
|
+ $retstringbuttom .= ' onClick="showDP(\''.$base.'\',\''.$prefix.'\',\''.$langs->trans("FormatDateShortJavaInput").'\',\''.$langs->defaultlang.'\');"'; |
|
7117
|
+ $retstringbuttom .= '>'.img_object($langs->trans("SelectDate"), 'calendarday', 'class="datecallink"').'</button>'; |
7118
|
7118
|
} else { |
7119
|
|
- $retstringbuttom = '<button id="' . $prefix . 'Button" type="button" class="dpInvisibleButtons">' . img_object($langs->trans("Disabled"), 'calendarday', 'class="datecallink"') . '</button>'; |
|
7119
|
+ $retstringbuttom = '<button id="'.$prefix.'Button" type="button" class="dpInvisibleButtons">'.img_object($langs->trans("Disabled"), 'calendarday', 'class="datecallink"').'</button>'; |
7120
|
7120
|
} |
7121
|
|
- $retstring = $retstringbuttom . $retstring; |
|
7121
|
+ $retstring = $retstringbuttom.$retstring; |
7122
|
7122
|
|
7123
|
|
- $retstring .= '<input type="hidden" id="' . $prefix . 'day" name="' . $prefix . 'day" value="' . $sday . '">' . "\n"; |
7124
|
|
- $retstring .= '<input type="hidden" id="' . $prefix . 'month" name="' . $prefix . 'month" value="' . $smonth . '">' . "\n"; |
7125
|
|
- $retstring .= '<input type="hidden" id="' . $prefix . 'year" name="' . $prefix . 'year" value="' . $syear . '">' . "\n"; |
|
7123
|
+ $retstring .= '<input type="hidden" id="'.$prefix.'day" name="'.$prefix.'day" value="'.$sday.'">'."\n"; |
|
7124
|
+ $retstring .= '<input type="hidden" id="'.$prefix.'month" name="'.$prefix.'month" value="'.$smonth.'">'."\n"; |
|
7125
|
+ $retstring .= '<input type="hidden" id="'.$prefix.'year" name="'.$prefix.'year" value="'.$syear.'">'."\n"; |
7126
|
7126
|
} elseif ($usecalendar == 'jquery' || $usecalendar == 'html') { |
7127
|
7127
|
if (!$disabled && $usecalendar != 'html') { |
7128
|
7128
|
// Output javascript for datepicker |
7129
|
7129
|
$minYear = getDolGlobalInt('MIN_YEAR_SELECT_DATE', (idate('Y') - 100)); |
7130
|
7130
|
$maxYear = getDolGlobalInt('MAX_YEAR_SELECT_DATE', (idate('Y') + 100)); |
7131
|
7131
|
|
7132
|
|
- $retstring .= '<script nonce="' . getNonce() . '" type="text/javascript">'; |
7133
|
|
- $retstring .= "$(function(){ $('#" . $prefix . "').datepicker({ |
7134
|
|
- dateFormat: '" . $langs->trans("FormatDateShortJQueryInput") . "', |
|
7132
|
+ $retstring .= '<script nonce="'.getNonce().'" type="text/javascript">'; |
|
7133
|
+ $retstring .= "$(function(){ $('#".$prefix."').datepicker({ |
|
7134
|
+ dateFormat: '" . $langs->trans("FormatDateShortJQueryInput")."', |
7135
|
7135
|
autoclose: true, |
7136
|
7136
|
todayHighlight: true, |
7137
|
|
- yearRange: '" . $minYear . ":" . $maxYear . "',"; |
|
7137
|
+ yearRange: '" . $minYear.":".$maxYear."',"; |
7138
|
7138
|
if (!empty($conf->dol_use_jmobile)) { |
7139
|
7139
|
$retstring .= " |
7140
|
7140
|
beforeShow: function (input, datePicker) { |
|
@@ -7149,7 +7149,7 @@ discard block |
|
|
block discarded – undo |
7149
|
7149
|
if (!getDolGlobalString('MAIN_POPUP_CALENDAR_ON_FOCUS')) { |
7150
|
7150
|
$retstring .= " |
7151
|
7151
|
showOn: 'button', /* both has problem with autocompletion */ |
7152
|
|
- buttonImage: '" . DOL_URL_ROOT . "/theme/" . dol_escape_js($conf->theme) . "/img/object_calendarday.png', |
|
7152
|
+ buttonImage: '" . DOL_URL_ROOT."/theme/".dol_escape_js($conf->theme)."/img/object_calendarday.png', |
7153
|
7153
|
buttonImageOnly: true"; |
7154
|
7154
|
} |
7155
|
7155
|
$retstring .= " |
|
@@ -7161,46 +7161,46 @@ discard block |
|
|
block discarded – undo |
7161
|
7161
|
$retstring .= '<div class="nowraponall inline-block divfordateinput">'; |
7162
|
7162
|
$retstring .= '<input id="'.$prefix.'" name="'.$prefix.'" type="text" class="maxwidthdate center" maxlength="11" value="'.$formated_date.'"'; |
7163
|
7163
|
$retstring .= ($disabled ? ' disabled' : ''); |
7164
|
|
- $retstring .= ($placeholder ? ' placeholder="' . dol_escape_htmltag($placeholder) . '"' : ''); |
7165
|
|
- $retstring .= ' onChange="dpChangeDay(\'' . dol_escape_js($prefix) . '\',\'' . dol_escape_js($langs->trans("FormatDateShortJavaInput")) . '\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript |
|
7164
|
+ $retstring .= ($placeholder ? ' placeholder="'.dol_escape_htmltag($placeholder).'"' : ''); |
|
7165
|
+ $retstring .= ' onChange="dpChangeDay(\''.dol_escape_js($prefix).'\',\''.dol_escape_js($langs->trans("FormatDateShortJavaInput")).'\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript |
7166
|
7166
|
$retstring .= ' autocomplete="off">'; |
7167
|
7167
|
|
7168
|
7168
|
// Icone calendrier |
7169
|
7169
|
if ($disabled) { |
7170
|
|
- $retstringbutton = '<button id="' . $prefix . 'Button" type="button" class="dpInvisibleButtons">' . img_object($langs->trans("Disabled"), 'calendarday', 'class="datecallink"') . '</button>'; |
7171
|
|
- $retstring = $retstringbutton . $retstring; |
|
7170
|
+ $retstringbutton = '<button id="'.$prefix.'Button" type="button" class="dpInvisibleButtons">'.img_object($langs->trans("Disabled"), 'calendarday', 'class="datecallink"').'</button>'; |
|
7171
|
+ $retstring = $retstringbutton.$retstring; |
7172
|
7172
|
} |
7173
|
7173
|
|
7174
|
7174
|
$retstring .= '</div>'; |
7175
|
|
- $retstring .= '<input type="hidden" id="' . $prefix . 'day" name="' . $prefix . 'day" value="' . $sday . '">' . "\n"; |
7176
|
|
- $retstring .= '<input type="hidden" id="' . $prefix . 'month" name="' . $prefix . 'month" value="' . $smonth . '">' . "\n"; |
7177
|
|
- $retstring .= '<input type="hidden" id="' . $prefix . 'year" name="' . $prefix . 'year" value="' . $syear . '">' . "\n"; |
|
7175
|
+ $retstring .= '<input type="hidden" id="'.$prefix.'day" name="'.$prefix.'day" value="'.$sday.'">'."\n"; |
|
7176
|
+ $retstring .= '<input type="hidden" id="'.$prefix.'month" name="'.$prefix.'month" value="'.$smonth.'">'."\n"; |
|
7177
|
+ $retstring .= '<input type="hidden" id="'.$prefix.'year" name="'.$prefix.'year" value="'.$syear.'">'."\n"; |
7178
|
7178
|
} else { |
7179
|
7179
|
$retstring .= "Bad value of MAIN_POPUP_CALENDAR"; |
7180
|
7180
|
} |
7181
|
7181
|
} else { |
7182
|
7182
|
// Show date with combo selects |
7183
|
7183
|
// Day |
7184
|
|
- $retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth50imp" id="' . $prefix . 'day" name="' . $prefix . 'day">'; |
|
7184
|
+ $retstring .= '<select'.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth50imp" id="'.$prefix.'day" name="'.$prefix.'day">'; |
7185
|
7185
|
|
7186
|
7186
|
if ($emptydate || $set_time == -1) { |
7187
|
7187
|
$retstring .= '<option value="0" selected> </option>'; |
7188
|
7188
|
} |
7189
|
7189
|
|
7190
|
7190
|
for ($day = 1; $day <= 31; $day++) { |
7191
|
|
- $retstring .= '<option value="' . $day . '"' . ($day == $sday ? ' selected' : '') . '>' . $day . '</option>'; |
|
7191
|
+ $retstring .= '<option value="'.$day.'"'.($day == $sday ? ' selected' : '').'>'.$day.'</option>'; |
7192
|
7192
|
} |
7193
|
7193
|
|
7194
|
7194
|
$retstring .= "</select>"; |
7195
|
7195
|
|
7196
|
|
- $retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth75imp" id="' . $prefix . 'month" name="' . $prefix . 'month">'; |
|
7196
|
+ $retstring .= '<select'.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth75imp" id="'.$prefix.'month" name="'.$prefix.'month">'; |
7197
|
7197
|
if ($emptydate || $set_time == -1) { |
7198
|
7198
|
$retstring .= '<option value="0" selected> </option>'; |
7199
|
7199
|
} |
7200
|
7200
|
|
7201
|
7201
|
// Month |
7202
|
7202
|
for ($month = 1; $month <= 12; $month++) { |
7203
|
|
- $retstring .= '<option value="' . $month . '"' . ($month == $smonth ? ' selected' : '') . '>'; |
|
7203
|
+ $retstring .= '<option value="'.$month.'"'.($month == $smonth ? ' selected' : '').'>'; |
7204
|
7204
|
$retstring .= dol_print_date(mktime(12, 0, 0, $month, 1, 2000), "%b"); |
7205
|
7205
|
$retstring .= "</option>"; |
7206
|
7206
|
} |
|
@@ -7208,13 +7208,13 @@ discard block |
|
|
block discarded – undo |
7208
|
7208
|
|
7209
|
7209
|
// Year |
7210
|
7210
|
if ($emptydate || $set_time == -1) { |
7211
|
|
- $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 . '">'; |
|
7211
|
+ $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
|
7212
|
} else { |
7213
|
|
- $retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth75imp" id="' . $prefix . 'year" name="' . $prefix . 'year">'; |
|
7213
|
+ $retstring .= '<select'.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth75imp" id="'.$prefix.'year" name="'.$prefix.'year">'; |
7214
|
7214
|
|
7215
|
7215
|
$syear = (int) $syear; |
7216
|
7216
|
for ($year = $syear - 10; $year < (int) $syear + 10; $year++) { |
7217
|
|
- $retstring .= '<option value="' . $year . '"' . ($year == $syear ? ' selected' : '') . '>' . $year . '</option>'; |
|
7217
|
+ $retstring .= '<option value="'.$year.'"'.($year == $syear ? ' selected' : '').'>'.$year.'</option>'; |
7218
|
7218
|
} |
7219
|
7219
|
$retstring .= "</select>\n"; |
7220
|
7220
|
} |
|
@@ -7238,15 +7238,15 @@ discard block |
|
|
block discarded – undo |
7238
|
7238
|
} |
7239
|
7239
|
} |
7240
|
7240
|
// Show hour |
7241
|
|
- $retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth50 ' . ($fullday ? $fullday . 'hour' : '') . '" id="' . $prefix . 'hour" name="' . $prefix . 'hour">'; |
|
7241
|
+ $retstring .= '<select'.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth50 '.($fullday ? $fullday.'hour' : '').'" id="'.$prefix.'hour" name="'.$prefix.'hour">'; |
7242
|
7242
|
if ($emptyhours) { |
7243
|
7243
|
$retstring .= '<option value="-1"> </option>'; |
7244
|
7244
|
} |
7245
|
7245
|
for ($hour = $hourstart; $hour < $hourend; $hour++) { |
7246
|
7246
|
if (strlen($hour) < 2) { |
7247
|
|
- $hour = "0" . $hour; |
|
7247
|
+ $hour = "0".$hour; |
7248
|
7248
|
} |
7249
|
|
- $retstring .= '<option value="' . $hour . '"' . (($hour == $shour) ? ' selected' : '') . '>' . $hour; |
|
7249
|
+ $retstring .= '<option value="'.$hour.'"'.(($hour == $shour) ? ' selected' : '').'>'.$hour; |
7250
|
7250
|
//$retstring .= (empty($conf->dol_optimize_smallscreen) ? '' : 'H'); |
7251
|
7251
|
$retstring .= '</option>'; |
7252
|
7252
|
} |
|
@@ -7259,17 +7259,17 @@ discard block |
|
|
block discarded – undo |
7259
|
7259
|
|
7260
|
7260
|
if ($m) { |
7261
|
7261
|
// Show minutes |
7262
|
|
- $retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth50 ' . ($fullday ? $fullday . 'min' : '') . '" id="' . $prefix . 'min" name="' . $prefix . 'min">'; |
|
7262
|
+ $retstring .= '<select'.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth50 '.($fullday ? $fullday.'min' : '').'" id="'.$prefix.'min" name="'.$prefix.'min">'; |
7263
|
7263
|
if ($emptyhours) { |
7264
|
7264
|
$retstring .= '<option value="-1"> </option>'; |
7265
|
7265
|
} |
7266
|
7266
|
for ($min = 0; $min < 60; $min += $stepminutes) { |
7267
|
7267
|
$min_str = sprintf("%02d", $min); |
7268
|
|
- $retstring .= '<option value="' . $min_str . '"' . (($min_str == $smin) ? ' selected' : '') . '>' . $min_str . '</option>'; |
|
7268
|
+ $retstring .= '<option value="'.$min_str.'"'.(($min_str == $smin) ? ' selected' : '').'>'.$min_str.'</option>'; |
7269
|
7269
|
} |
7270
|
7270
|
$retstring .= '</select>'; |
7271
|
7271
|
|
7272
|
|
- $retstring .= '<input type="hidden" name="' . $prefix . 'sec" value="' . $ssec . '">'; |
|
7272
|
+ $retstring .= '<input type="hidden" name="'.$prefix.'sec" value="'.$ssec.'">'; |
7273
|
7273
|
} |
7274
|
7274
|
|
7275
|
7275
|
if ($d && $h) { |
|
@@ -7292,10 +7292,10 @@ discard block |
|
|
block discarded – undo |
7292
|
7292
|
|
7293
|
7293
|
// Generate the date part, depending on the use or not of the javascript calendar |
7294
|
7294
|
if ($addnowlink == 1) { // server time expressed in user time setup |
7295
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . '\').val(\'' . dol_print_date($nowgmt, 'day', 'tzuserrel') . '\');'; |
7296
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'day\').val(\'' . dol_print_date($nowgmt, '%d', 'tzuserrel') . '\');'; |
7297
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'month\').val(\'' . dol_print_date($nowgmt, '%m', 'tzuserrel') . '\');'; |
7298
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'year\').val(\'' . dol_print_date($nowgmt, '%Y', 'tzuserrel') . '\');'; |
|
7295
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'\').val(\''.dol_print_date($nowgmt, 'day', 'tzuserrel').'\');'; |
|
7296
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'day\').val(\''.dol_print_date($nowgmt, '%d', 'tzuserrel').'\');'; |
|
7297
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(\''.dol_print_date($nowgmt, '%m', 'tzuserrel').'\');'; |
|
7298
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(\''.dol_print_date($nowgmt, '%Y', 'tzuserrel').'\');'; |
7299
|
7299
|
} elseif ($addnowlink == 2) { |
7300
|
7300
|
/* Disabled because the output does not use the string format defined by FormatDateShort key to forge the value into #prefix. |
7301
|
7301
|
* This break application for foreign languages. |
|
@@ -7304,10 +7304,10 @@ discard block |
|
|
block discarded – undo |
7304
|
7304
|
$reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(parseInt(d.getMonth().pad()) + 1);'; |
7305
|
7305
|
$reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(d.getFullYear());'; |
7306
|
7306
|
*/ |
7307
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . '\').val(\'' . dol_print_date($nowgmt, 'day', 'tzuserrel') . '\');'; |
7308
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'day\').val(\'' . dol_print_date($nowgmt, '%d', 'tzuserrel') . '\');'; |
7309
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'month\').val(\'' . dol_print_date($nowgmt, '%m', 'tzuserrel') . '\');'; |
7310
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'year\').val(\'' . dol_print_date($nowgmt, '%Y', 'tzuserrel') . '\');'; |
|
7307
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'\').val(\''.dol_print_date($nowgmt, 'day', 'tzuserrel').'\');'; |
|
7308
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'day\').val(\''.dol_print_date($nowgmt, '%d', 'tzuserrel').'\');'; |
|
7309
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(\''.dol_print_date($nowgmt, '%m', 'tzuserrel').'\');'; |
|
7310
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(\''.dol_print_date($nowgmt, '%Y', 'tzuserrel').'\');'; |
7311
|
7311
|
} |
7312
|
7312
|
/*if ($usecalendar == "eldy") |
7313
|
7313
|
{ |
|
@@ -7327,11 +7327,11 @@ discard block |
|
|
block discarded – undo |
7327
|
7327
|
} |
7328
|
7328
|
//$reset_scripts .= 'this.form.elements[\''.$prefix.'hour\'].value=formatDate(new Date(), \'HH\'); '; |
7329
|
7329
|
if ($addnowlink == 1) { |
7330
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'hour\').val(\'' . dol_print_date($nowgmt, '%H', 'tzuserrel') . '\');'; |
7331
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'hour\').change();'; |
|
7330
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').val(\''.dol_print_date($nowgmt, '%H', 'tzuserrel').'\');'; |
|
7331
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').change();'; |
7332
|
7332
|
} elseif ($addnowlink == 2) { |
7333
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'hour\').val(d.getHours().pad());'; |
7334
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'hour\').change();'; |
|
7333
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').val(d.getHours().pad());'; |
|
7334
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').change();'; |
7335
|
7335
|
} |
7336
|
7336
|
|
7337
|
7337
|
if ($fullday) { |
|
@@ -7345,11 +7345,11 @@ discard block |
|
|
block discarded – undo |
7345
|
7345
|
} |
7346
|
7346
|
//$reset_scripts .= 'this.form.elements[\''.$prefix.'min\'].value=formatDate(new Date(), \'mm\'); '; |
7347
|
7347
|
if ($addnowlink == 1) { |
7348
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'min\').val(\'' . dol_print_date($nowgmt, '%M', 'tzuserrel') . '\');'; |
7349
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'min\').change();'; |
|
7348
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'min\').val(\''.dol_print_date($nowgmt, '%M', 'tzuserrel').'\');'; |
|
7349
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'min\').change();'; |
7350
|
7350
|
} elseif ($addnowlink == 2) { |
7351
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'min\').val(d.getMinutes().pad());'; |
7352
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'min\').change();'; |
|
7351
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'min\').val(d.getMinutes().pad());'; |
|
7352
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'min\').change();'; |
7353
|
7353
|
} |
7354
|
7354
|
if ($fullday) { |
7355
|
7355
|
$reset_scripts .= ' } '; |
|
@@ -7357,7 +7357,7 @@ discard block |
|
|
block discarded – undo |
7357
|
7357
|
} |
7358
|
7358
|
// If reset_scripts is not empty, print the link with the reset_scripts in the onClick |
7359
|
7359
|
if ($reset_scripts && !getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) { |
7360
|
|
- $retstring .= ' <button class="dpInvisibleButtons datenowlink" id="' . $prefix . 'ButtonNow" type="button" name="_useless" value="now" onClick="' . $reset_scripts . '">'; |
|
7360
|
+ $retstring .= ' <button class="dpInvisibleButtons datenowlink" id="'.$prefix.'ButtonNow" type="button" name="_useless" value="now" onClick="'.$reset_scripts.'">'; |
7361
|
7361
|
$retstring .= $langs->trans("Now"); |
7362
|
7362
|
$retstring .= '</button> '; |
7363
|
7363
|
} |
|
@@ -7369,16 +7369,16 @@ discard block |
|
|
block discarded – undo |
7369
|
7369
|
$reset_scripts = ""; |
7370
|
7370
|
|
7371
|
7371
|
// Generate the date part, depending on the use or not of the javascript calendar |
7372
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . '\').val(\'' . dol_print_date($nowgmt, 'dayinputnoreduce', 'tzuserrel') . '\');'; |
7373
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'day\').val(\'' . dol_print_date($nowgmt, '%d', 'tzuserrel') . '\');'; |
7374
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'month\').val(\'' . dol_print_date($nowgmt, '%m', 'tzuserrel') . '\');'; |
7375
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'year\').val(\'' . dol_print_date($nowgmt, '%Y', 'tzuserrel') . '\');'; |
|
7372
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'\').val(\''.dol_print_date($nowgmt, 'dayinputnoreduce', 'tzuserrel').'\');'; |
|
7373
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'day\').val(\''.dol_print_date($nowgmt, '%d', 'tzuserrel').'\');'; |
|
7374
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(\''.dol_print_date($nowgmt, '%m', 'tzuserrel').'\');'; |
|
7375
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(\''.dol_print_date($nowgmt, '%Y', 'tzuserrel').'\');'; |
7376
|
7376
|
// Update the hour part |
7377
|
7377
|
if ($h) { |
7378
|
7378
|
if ($fullday) { |
7379
|
7379
|
$reset_scripts .= " if (jQuery('#fullday:checked').val() == null) {"; |
7380
|
7380
|
} |
7381
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'hour\').val(\'' . dol_print_date($nowgmt, '%H', 'tzuserrel') . '\');'; |
|
7381
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').val(\''.dol_print_date($nowgmt, '%H', 'tzuserrel').'\');'; |
7382
|
7382
|
if ($fullday) { |
7383
|
7383
|
$reset_scripts .= ' } '; |
7384
|
7384
|
} |
|
@@ -7388,14 +7388,14 @@ discard block |
|
|
block discarded – undo |
7388
|
7388
|
if ($fullday) { |
7389
|
7389
|
$reset_scripts .= " if (jQuery('#fullday:checked').val() == null) {"; |
7390
|
7390
|
} |
7391
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'min\').val(\'' . dol_print_date($nowgmt, '%M', 'tzuserrel') . '\');'; |
|
7391
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'min\').val(\''.dol_print_date($nowgmt, '%M', 'tzuserrel').'\');'; |
7392
|
7392
|
if ($fullday) { |
7393
|
7393
|
$reset_scripts .= ' } '; |
7394
|
7394
|
} |
7395
|
7395
|
} |
7396
|
7396
|
// If reset_scripts is not empty, print the link with the reset_scripts in the onClick |
7397
|
7397
|
if ($reset_scripts && empty($conf->dol_optimize_smallscreen)) { |
7398
|
|
- $retstring .= ' <button class="dpInvisibleButtons datenowlink" id="' . $prefix . 'ButtonPlusOne" type="button" name="_useless2" value="plusone" onClick="' . $reset_scripts . '">'; |
|
7398
|
+ $retstring .= ' <button class="dpInvisibleButtons datenowlink" id="'.$prefix.'ButtonPlusOne" type="button" name="_useless2" value="plusone" onClick="'.$reset_scripts.'">'; |
7399
|
7399
|
$retstring .= $langs->trans("DateStartPlusOne"); |
7400
|
7400
|
$retstring .= '</button> '; |
7401
|
7401
|
} |
|
@@ -7453,17 +7453,17 @@ discard block |
|
|
block discarded – undo |
7453
|
7453
|
unset($TDurationTypes[$value]); |
7454
|
7454
|
} |
7455
|
7455
|
|
7456
|
|
- $retstring = '<select class="flat minwidth75 maxwidth100" id="select_' . $prefix . 'type_duration" name="' . $prefix . 'type_duration">'; |
|
7456
|
+ $retstring = '<select class="flat minwidth75 maxwidth100" id="select_'.$prefix.'type_duration" name="'.$prefix.'type_duration">'; |
7457
|
7457
|
foreach ($TDurationTypes as $key => $typeduration) { |
7458
|
|
- $retstring .= '<option value="' . $key . '"'; |
|
7458
|
+ $retstring .= '<option value="'.$key.'"'; |
7459
|
7459
|
if ($key == $selected) { |
7460
|
7460
|
$retstring .= " selected"; |
7461
|
7461
|
} |
7462
|
|
- $retstring .= ">" . $typeduration . "</option>"; |
|
7462
|
+ $retstring .= ">".$typeduration."</option>"; |
7463
|
7463
|
} |
7464
|
7464
|
$retstring .= "</select>"; |
7465
|
7465
|
|
7466
|
|
- $retstring .= ajax_combobox('select_' . $prefix . 'type_duration'); |
|
7466
|
+ $retstring .= ajax_combobox('select_'.$prefix.'type_duration'); |
7467
|
7467
|
|
7468
|
7468
|
return $retstring; |
7469
|
7469
|
} |
|
@@ -7495,30 +7495,30 @@ discard block |
|
|
block discarded – undo |
7495
|
7495
|
|
7496
|
7496
|
// Hours |
7497
|
7497
|
if ($iSecond != '') { |
7498
|
|
- require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php'; |
|
7498
|
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; |
7499
|
7499
|
|
7500
|
7500
|
$hourSelected = convertSecondToTime($iSecond, 'allhour'); |
7501
|
7501
|
$minSelected = convertSecondToTime($iSecond, 'min'); |
7502
|
7502
|
} |
7503
|
7503
|
|
7504
|
7504
|
if ($typehour == 'select') { |
7505
|
|
- $retstring .= '<select class="flat" id="select_' . $prefix . 'hour" name="' . $prefix . 'hour"' . ($disabled ? ' disabled' : '') . '>'; |
|
7505
|
+ $retstring .= '<select class="flat" id="select_'.$prefix.'hour" name="'.$prefix.'hour"'.($disabled ? ' disabled' : '').'>'; |
7506
|
7506
|
for ($hour = 0; $hour < 25; $hour++) { // For a duration, we allow 24 hours |
7507
|
|
- $retstring .= '<option value="' . $hour . '"'; |
|
7507
|
+ $retstring .= '<option value="'.$hour.'"'; |
7508
|
7508
|
if (is_numeric($hourSelected) && $hourSelected == $hour) { |
7509
|
7509
|
$retstring .= " selected"; |
7510
|
7510
|
} |
7511
|
|
- $retstring .= ">" . $hour . "</option>"; |
|
7511
|
+ $retstring .= ">".$hour."</option>"; |
7512
|
7512
|
} |
7513
|
7513
|
$retstring .= "</select>"; |
7514
|
7514
|
} elseif ($typehour == 'text' || $typehour == 'textselect') { |
7515
|
|
- $retstring .= '<input placeholder="' . $langs->trans('HourShort') . '" type="number" min="0" name="' . $prefix . 'hour"' . ($disabled ? ' disabled' : '') . ' class="flat maxwidth50 inputhour right" value="' . (($hourSelected != '') ? ((int) $hourSelected) : '') . '">'; |
|
7515
|
+ $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
|
7516
|
} else { |
7517
|
7517
|
return 'BadValueForParameterTypeHour'; |
7518
|
7518
|
} |
7519
|
7519
|
|
7520
|
7520
|
if ($typehour != 'text') { |
7521
|
|
- $retstring .= ' ' . $langs->trans('HourShort'); |
|
7521
|
+ $retstring .= ' '.$langs->trans('HourShort'); |
7522
|
7522
|
} else { |
7523
|
7523
|
$retstring .= '<span class="">:</span>'; |
7524
|
7524
|
} |
|
@@ -7533,21 +7533,21 @@ discard block |
|
|
block discarded – undo |
7533
|
7533
|
} |
7534
|
7534
|
|
7535
|
7535
|
if ($typehour == 'select' || $typehour == 'textselect') { |
7536
|
|
- $retstring .= '<select class="flat" id="select_' . $prefix . 'min" name="' . $prefix . 'min"' . ($disabled ? ' disabled' : '') . '>'; |
|
7536
|
+ $retstring .= '<select class="flat" id="select_'.$prefix.'min" name="'.$prefix.'min"'.($disabled ? ' disabled' : '').'>'; |
7537
|
7537
|
for ($min = 0; $min <= 55; $min += 5) { |
7538
|
|
- $retstring .= '<option value="' . $min . '"'; |
|
7538
|
+ $retstring .= '<option value="'.$min.'"'; |
7539
|
7539
|
if (is_numeric($minSelected) && $minSelected == $min) { |
7540
|
7540
|
$retstring .= ' selected'; |
7541
|
7541
|
} |
7542
|
|
- $retstring .= '>' . $min . '</option>'; |
|
7542
|
+ $retstring .= '>'.$min.'</option>'; |
7543
|
7543
|
} |
7544
|
7544
|
$retstring .= "</select>"; |
7545
|
7545
|
} elseif ($typehour == 'text') { |
7546
|
|
- $retstring .= '<input placeholder="' . $langs->trans('MinuteShort') . '" type="number" min="0" name="' . $prefix . 'min"' . ($disabled ? ' disabled' : '') . ' class="flat maxwidth50 inputminute right" value="' . (($minSelected != '') ? ((int) $minSelected) : '') . '">'; |
|
7546
|
+ $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
|
7547
|
} |
7548
|
7548
|
|
7549
|
7549
|
if ($typehour != 'text') { |
7550
|
|
- $retstring .= ' ' . $langs->trans('MinuteShort'); |
|
7550
|
+ $retstring .= ' '.$langs->trans('MinuteShort'); |
7551
|
7551
|
} |
7552
|
7552
|
|
7553
|
7553
|
$retstring .= "</span>"; |
|
@@ -7595,7 +7595,7 @@ discard block |
|
|
block discarded – undo |
7595
|
7595
|
$placeholder = ''; |
7596
|
7596
|
|
7597
|
7597
|
if ($selected && empty($selected_input_value)) { |
7598
|
|
- require_once DOL_DOCUMENT_ROOT . '/ticket/class/ticket.class.php'; |
|
7598
|
+ require_once DOL_DOCUMENT_ROOT.'/ticket/class/ticket.class.php'; |
7599
|
7599
|
$tickettmpselect = new Ticket($this->db); |
7600
|
7600
|
$tickettmpselect->fetch($selected); |
7601
|
7601
|
$selected_input_value = $tickettmpselect->ref; |
|
@@ -7603,17 +7603,17 @@ discard block |
|
|
block discarded – undo |
7603
|
7603
|
} |
7604
|
7604
|
|
7605
|
7605
|
$urloption = ''; |
7606
|
|
- $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/ticket/ajax/tickets.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions); |
|
7606
|
+ $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/ticket/ajax/tickets.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions); |
7607
|
7607
|
|
7608
|
7608
|
if (empty($hidelabel)) { |
7609
|
|
- $out .= $langs->trans("RefOrLabel") . ' : '; |
|
7609
|
+ $out .= $langs->trans("RefOrLabel").' : '; |
7610
|
7610
|
} elseif ($hidelabel > 1) { |
7611
|
|
- $placeholder = ' placeholder="' . $langs->trans("RefOrLabel") . '"'; |
|
7611
|
+ $placeholder = ' placeholder="'.$langs->trans("RefOrLabel").'"'; |
7612
|
7612
|
if ($hidelabel == 2) { |
7613
|
7613
|
$out .= img_picto($langs->trans("Search"), 'search'); |
7614
|
7614
|
} |
7615
|
7615
|
} |
7616
|
|
- $out .= '<input type="text" class="minwidth100" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . $placeholder . ' ' . (getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '') . ' />'; |
|
7616
|
+ $out .= '<input type="text" class="minwidth100" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' '.(getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '').' />'; |
7617
|
7617
|
if ($hidelabel == 3) { |
7618
|
7618
|
$out .= img_picto($langs->trans("Search"), 'search'); |
7619
|
7619
|
} |
|
@@ -7657,8 +7657,8 @@ discard block |
|
|
block discarded – undo |
7657
|
7657
|
|
7658
|
7658
|
$sql = "SELECT "; |
7659
|
7659
|
$sql .= $selectFields; |
7660
|
|
- $sql .= " FROM " . $this->db->prefix() . "ticket as p"; |
7661
|
|
- $sql .= ' WHERE p.entity IN (' . getEntity('ticket') . ')'; |
|
7660
|
+ $sql .= " FROM ".$this->db->prefix()."ticket as p"; |
|
7661
|
+ $sql .= ' WHERE p.entity IN ('.getEntity('ticket').')'; |
7662
|
7662
|
|
7663
|
7663
|
// Add criteria on ref/label |
7664
|
7664
|
if ($filterkey != '') { |
|
@@ -7674,7 +7674,7 @@ discard block |
|
|
block discarded – undo |
7674
|
7674
|
if ($i > 0) { |
7675
|
7675
|
$sql .= " AND "; |
7676
|
7676
|
} |
7677
|
|
- $sql .= "(p.ref LIKE '" . $this->db->escape($prefix . $crit) . "%' OR p.subject LIKE '" . $this->db->escape($prefix . $crit) . "%'"; |
|
7677
|
+ $sql .= "(p.ref LIKE '".$this->db->escape($prefix.$crit)."%' OR p.subject LIKE '".$this->db->escape($prefix.$crit)."%'"; |
7678
|
7678
|
$sql .= ")"; |
7679
|
7679
|
$i++; |
7680
|
7680
|
} |
|
@@ -7687,22 +7687,22 @@ discard block |
|
|
block discarded – undo |
7687
|
7687
|
$sql .= $this->db->plimit($limit, 0); |
7688
|
7688
|
|
7689
|
7689
|
// Build output string |
7690
|
|
- dol_syslog(get_class($this) . "::selectTicketsList search tickets", LOG_DEBUG); |
|
7690
|
+ dol_syslog(get_class($this)."::selectTicketsList search tickets", LOG_DEBUG); |
7691
|
7691
|
$result = $this->db->query($sql); |
7692
|
7692
|
if ($result) { |
7693
|
|
- require_once DOL_DOCUMENT_ROOT . '/ticket/class/ticket.class.php'; |
7694
|
|
- require_once DOL_DOCUMENT_ROOT . '/core/lib/ticket.lib.php'; |
|
7693
|
+ require_once DOL_DOCUMENT_ROOT.'/ticket/class/ticket.class.php'; |
|
7694
|
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/ticket.lib.php'; |
7695
|
7695
|
|
7696
|
7696
|
$num = $this->db->num_rows($result); |
7697
|
7697
|
|
7698
|
7698
|
$events = array(); |
7699
|
7699
|
|
7700
|
7700
|
if (!$forcecombo) { |
7701
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
7701
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
7702
|
7702
|
$out .= ajax_combobox($htmlname, $events, $conf->global->TICKET_USE_SEARCH_TO_SELECT); |
7703
|
7703
|
} |
7704
|
7704
|
|
7705
|
|
- $out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">'; |
|
7705
|
+ $out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">'; |
7706
|
7706
|
|
7707
|
7707
|
$textifempty = ''; |
7708
|
7708
|
// Do not use textifempty = ' ' or ' ' here, or search on key will search on ' key'. |
|
@@ -7719,7 +7719,7 @@ discard block |
|
|
block discarded – undo |
7719
|
7719
|
} |
7720
|
7720
|
} |
7721
|
7721
|
if ($showempty) { |
7722
|
|
- $out .= '<option value="0" selected>' . $textifempty . '</option>'; |
|
7722
|
+ $out .= '<option value="0" selected>'.$textifempty.'</option>'; |
7723
|
7723
|
} |
7724
|
7724
|
|
7725
|
7725
|
$i = 0; |
|
@@ -7774,13 +7774,13 @@ discard block |
|
|
block discarded – undo |
7774
|
7774
|
$outref = $objp->ref; |
7775
|
7775
|
$outtype = $objp->fk_product_type; |
7776
|
7776
|
|
7777
|
|
- $opt = '<option value="' . $objp->rowid . '"'; |
|
7777
|
+ $opt = '<option value="'.$objp->rowid.'"'; |
7778
|
7778
|
$opt .= ($objp->rowid == $selected) ? ' selected' : ''; |
7779
|
7779
|
$opt .= '>'; |
7780
|
7780
|
$opt .= $objp->ref; |
7781
|
7781
|
$objRef = $objp->ref; |
7782
|
7782
|
if (!empty($filterkey) && $filterkey != '') { |
7783
|
|
- $objRef = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $objRef, 1); |
|
7783
|
+ $objRef = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $objRef, 1); |
7784
|
7784
|
} |
7785
|
7785
|
|
7786
|
7786
|
$opt .= "</option>\n"; |
|
@@ -7821,7 +7821,7 @@ discard block |
|
|
block discarded – undo |
7821
|
7821
|
$placeholder = ''; |
7822
|
7822
|
|
7823
|
7823
|
if ($selected && empty($selected_input_value)) { |
7824
|
|
- require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; |
|
7824
|
+ require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; |
7825
|
7825
|
$projecttmpselect = new Project($this->db); |
7826
|
7826
|
$projecttmpselect->fetch($selected); |
7827
|
7827
|
$selected_input_value = $projecttmpselect->ref; |
|
@@ -7829,17 +7829,17 @@ discard block |
|
|
block discarded – undo |
7829
|
7829
|
} |
7830
|
7830
|
|
7831
|
7831
|
$urloption = ''; |
7832
|
|
- $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/projet/ajax/projects.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions); |
|
7832
|
+ $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/projet/ajax/projects.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions); |
7833
|
7833
|
|
7834
|
7834
|
if (empty($hidelabel)) { |
7835
|
|
- $out .= $langs->trans("RefOrLabel") . ' : '; |
|
7835
|
+ $out .= $langs->trans("RefOrLabel").' : '; |
7836
|
7836
|
} elseif ($hidelabel > 1) { |
7837
|
|
- $placeholder = ' placeholder="' . $langs->trans("RefOrLabel") . '"'; |
|
7837
|
+ $placeholder = ' placeholder="'.$langs->trans("RefOrLabel").'"'; |
7838
|
7838
|
if ($hidelabel == 2) { |
7839
|
7839
|
$out .= img_picto($langs->trans("Search"), 'search'); |
7840
|
7840
|
} |
7841
|
7841
|
} |
7842
|
|
- $out .= '<input type="text" class="minwidth100" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . $placeholder . ' ' . (getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '') . ' />'; |
|
7842
|
+ $out .= '<input type="text" class="minwidth100" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' '.(getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '').' />'; |
7843
|
7843
|
if ($hidelabel == 3) { |
7844
|
7844
|
$out .= img_picto($langs->trans("Search"), 'search'); |
7845
|
7845
|
} |
|
@@ -7882,8 +7882,8 @@ discard block |
|
|
block discarded – undo |
7882
|
7882
|
|
7883
|
7883
|
$sql = "SELECT "; |
7884
|
7884
|
$sql .= $selectFields; |
7885
|
|
- $sql .= " FROM " . $this->db->prefix() . "projet as p"; |
7886
|
|
- $sql .= ' WHERE p.entity IN (' . getEntity('project') . ')'; |
|
7885
|
+ $sql .= " FROM ".$this->db->prefix()."projet as p"; |
|
7886
|
+ $sql .= ' WHERE p.entity IN ('.getEntity('project').')'; |
7887
|
7887
|
|
7888
|
7888
|
// Add criteria on ref/label |
7889
|
7889
|
if ($filterkey != '') { |
|
@@ -7899,7 +7899,7 @@ discard block |
|
|
block discarded – undo |
7899
|
7899
|
if ($i > 0) { |
7900
|
7900
|
$sql .= " AND "; |
7901
|
7901
|
} |
7902
|
|
- $sql .= "p.ref LIKE '" . $this->db->escape($prefix . $crit) . "%'"; |
|
7902
|
+ $sql .= "p.ref LIKE '".$this->db->escape($prefix.$crit)."%'"; |
7903
|
7903
|
$sql .= ""; |
7904
|
7904
|
$i++; |
7905
|
7905
|
} |
|
@@ -7912,22 +7912,22 @@ discard block |
|
|
block discarded – undo |
7912
|
7912
|
$sql .= $this->db->plimit($limit, 0); |
7913
|
7913
|
|
7914
|
7914
|
// Build output string |
7915
|
|
- dol_syslog(get_class($this) . "::selectProjectsList search projects", LOG_DEBUG); |
|
7915
|
+ dol_syslog(get_class($this)."::selectProjectsList search projects", LOG_DEBUG); |
7916
|
7916
|
$result = $this->db->query($sql); |
7917
|
7917
|
if ($result) { |
7918
|
|
- require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; |
7919
|
|
- require_once DOL_DOCUMENT_ROOT . '/core/lib/project.lib.php'; |
|
7918
|
+ require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; |
|
7919
|
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php'; |
7920
|
7920
|
|
7921
|
7921
|
$num = $this->db->num_rows($result); |
7922
|
7922
|
|
7923
|
7923
|
$events = array(); |
7924
|
7924
|
|
7925
|
7925
|
if (!$forcecombo) { |
7926
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
7926
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
7927
|
7927
|
$out .= ajax_combobox($htmlname, $events, $conf->global->PROJECT_USE_SEARCH_TO_SELECT); |
7928
|
7928
|
} |
7929
|
7929
|
|
7930
|
|
- $out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">'; |
|
7930
|
+ $out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">'; |
7931
|
7931
|
|
7932
|
7932
|
$textifempty = ''; |
7933
|
7933
|
// Do not use textifempty = ' ' or ' ' here, or search on key will search on ' key'. |
|
@@ -7944,7 +7944,7 @@ discard block |
|
|
block discarded – undo |
7944
|
7944
|
} |
7945
|
7945
|
} |
7946
|
7946
|
if ($showempty) { |
7947
|
|
- $out .= '<option value="0" selected>' . $textifempty . '</option>'; |
|
7947
|
+ $out .= '<option value="0" selected>'.$textifempty.'</option>'; |
7948
|
7948
|
} |
7949
|
7949
|
|
7950
|
7950
|
$i = 0; |
|
@@ -8002,13 +8002,13 @@ discard block |
|
|
block discarded – undo |
8002
|
8002
|
$outlabel = $objp->label; |
8003
|
8003
|
$outtype = $objp->fk_product_type; |
8004
|
8004
|
|
8005
|
|
- $opt = '<option value="' . $objp->rowid . '"'; |
|
8005
|
+ $opt = '<option value="'.$objp->rowid.'"'; |
8006
|
8006
|
$opt .= ($objp->rowid == $selected) ? ' selected' : ''; |
8007
|
8007
|
$opt .= '>'; |
8008
|
8008
|
$opt .= $objp->ref; |
8009
|
8009
|
$objRef = $objp->ref; |
8010
|
8010
|
if (!empty($filterkey) && $filterkey != '') { |
8011
|
|
- $objRef = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $objRef, 1); |
|
8011
|
+ $objRef = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $objRef, 1); |
8012
|
8012
|
} |
8013
|
8013
|
|
8014
|
8014
|
$opt .= "</option>\n"; |
|
@@ -8050,7 +8050,7 @@ discard block |
|
|
block discarded – undo |
8050
|
8050
|
$placeholder = ''; |
8051
|
8051
|
|
8052
|
8052
|
if ($selected && empty($selected_input_value)) { |
8053
|
|
- require_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php'; |
|
8053
|
+ require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; |
8054
|
8054
|
$adherenttmpselect = new Adherent($this->db); |
8055
|
8055
|
$adherenttmpselect->fetch($selected); |
8056
|
8056
|
$selected_input_value = $adherenttmpselect->ref; |
|
@@ -8059,17 +8059,17 @@ discard block |
|
|
block discarded – undo |
8059
|
8059
|
|
8060
|
8060
|
$urloption = ''; |
8061
|
8061
|
|
8062
|
|
- $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/adherents/ajax/adherents.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions); |
|
8062
|
+ $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/adherents/ajax/adherents.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions); |
8063
|
8063
|
|
8064
|
8064
|
if (empty($hidelabel)) { |
8065
|
|
- $out .= $langs->trans("RefOrLabel") . ' : '; |
|
8065
|
+ $out .= $langs->trans("RefOrLabel").' : '; |
8066
|
8066
|
} elseif ($hidelabel > 1) { |
8067
|
|
- $placeholder = ' placeholder="' . $langs->trans("RefOrLabel") . '"'; |
|
8067
|
+ $placeholder = ' placeholder="'.$langs->trans("RefOrLabel").'"'; |
8068
|
8068
|
if ($hidelabel == 2) { |
8069
|
8069
|
$out .= img_picto($langs->trans("Search"), 'search'); |
8070
|
8070
|
} |
8071
|
8071
|
} |
8072
|
|
- $out .= '<input type="text" class="minwidth100" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . $placeholder . ' ' . (getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '') . ' />'; |
|
8072
|
+ $out .= '<input type="text" class="minwidth100" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' '.(getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '').' />'; |
8073
|
8073
|
if ($hidelabel == 3) { |
8074
|
8074
|
$out .= img_picto($langs->trans("Search"), 'search'); |
8075
|
8075
|
} |
|
@@ -8114,8 +8114,8 @@ discard block |
|
|
block discarded – undo |
8114
|
8114
|
|
8115
|
8115
|
$sql = "SELECT "; |
8116
|
8116
|
$sql .= $selectFields; |
8117
|
|
- $sql .= " FROM " . $this->db->prefix() . "adherent as p"; |
8118
|
|
- $sql .= ' WHERE p.entity IN (' . getEntity('adherent') . ')'; |
|
8117
|
+ $sql .= " FROM ".$this->db->prefix()."adherent as p"; |
|
8118
|
+ $sql .= ' WHERE p.entity IN ('.getEntity('adherent').')'; |
8119
|
8119
|
|
8120
|
8120
|
// Add criteria on ref/label |
8121
|
8121
|
if ($filterkey != '') { |
|
@@ -8131,8 +8131,8 @@ discard block |
|
|
block discarded – undo |
8131
|
8131
|
if ($i > 0) { |
8132
|
8132
|
$sql .= " AND "; |
8133
|
8133
|
} |
8134
|
|
- $sql .= "(p.firstname LIKE '" . $this->db->escape($prefix . $crit) . "%'"; |
8135
|
|
- $sql .= " OR p.lastname LIKE '" . $this->db->escape($prefix . $crit) . "%')"; |
|
8134
|
+ $sql .= "(p.firstname LIKE '".$this->db->escape($prefix.$crit)."%'"; |
|
8135
|
+ $sql .= " OR p.lastname LIKE '".$this->db->escape($prefix.$crit)."%')"; |
8136
|
8136
|
$i++; |
8137
|
8137
|
} |
8138
|
8138
|
if (count($search_crit) > 1) { |
|
@@ -8141,27 +8141,27 @@ discard block |
|
|
block discarded – undo |
8141
|
8141
|
$sql .= ')'; |
8142
|
8142
|
} |
8143
|
8143
|
if ($status != -1) { |
8144
|
|
- $sql .= ' AND statut = ' . ((int) $status); |
|
8144
|
+ $sql .= ' AND statut = '.((int) $status); |
8145
|
8145
|
} |
8146
|
8146
|
$sql .= $this->db->plimit($limit, 0); |
8147
|
8147
|
|
8148
|
8148
|
// Build output string |
8149
|
|
- dol_syslog(get_class($this) . "::selectMembersList search adherents", LOG_DEBUG); |
|
8149
|
+ dol_syslog(get_class($this)."::selectMembersList search adherents", LOG_DEBUG); |
8150
|
8150
|
$result = $this->db->query($sql); |
8151
|
8151
|
if ($result) { |
8152
|
|
- require_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php'; |
8153
|
|
- require_once DOL_DOCUMENT_ROOT . '/core/lib/member.lib.php'; |
|
8152
|
+ require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; |
|
8153
|
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php'; |
8154
|
8154
|
|
8155
|
8155
|
$num = $this->db->num_rows($result); |
8156
|
8156
|
|
8157
|
8157
|
$events = array(); |
8158
|
8158
|
|
8159
|
8159
|
if (!$forcecombo) { |
8160
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
8160
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
8161
|
8161
|
$out .= ajax_combobox($htmlname, $events, getDolGlobalString('PROJECT_USE_SEARCH_TO_SELECT') ? $conf->global->PROJECT_USE_SEARCH_TO_SELECT : ''); |
8162
|
8162
|
} |
8163
|
8163
|
|
8164
|
|
- $out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">'; |
|
8164
|
+ $out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">'; |
8165
|
8165
|
|
8166
|
8166
|
$textifempty = ''; |
8167
|
8167
|
// Do not use textifempty = ' ' or ' ' here, or search on key will search on ' key'. |
|
@@ -8178,7 +8178,7 @@ discard block |
|
|
block discarded – undo |
8178
|
8178
|
} |
8179
|
8179
|
} |
8180
|
8180
|
if ($showempty) { |
8181
|
|
- $out .= '<option value="-1" selected>' . $textifempty . '</option>'; |
|
8181
|
+ $out .= '<option value="-1" selected>'.$textifempty.'</option>'; |
8182
|
8182
|
} |
8183
|
8183
|
|
8184
|
8184
|
$i = 0; |
|
@@ -8234,11 +8234,11 @@ discard block |
|
|
block discarded – undo |
8234
|
8234
|
$outlabel = dolGetFirstLastname($objp->firstname, $objp->lastname); |
8235
|
8235
|
$outtype = $objp->fk_adherent_type; |
8236
|
8236
|
|
8237
|
|
- $opt = '<option value="' . $objp->rowid . '"'; |
|
8237
|
+ $opt = '<option value="'.$objp->rowid.'"'; |
8238
|
8238
|
$opt .= ($objp->rowid == $selected) ? ' selected' : ''; |
8239
|
8239
|
$opt .= '>'; |
8240
|
8240
|
if (!empty($filterkey) && $filterkey != '') { |
8241
|
|
- $outlabel = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $outlabel, 1); |
|
8241
|
+ $outlabel = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $outlabel, 1); |
8242
|
8242
|
} |
8243
|
8243
|
$opt .= $outlabel; |
8244
|
8244
|
$opt .= "</option>\n"; |
|
@@ -8276,8 +8276,8 @@ discard block |
|
|
block discarded – undo |
8276
|
8276
|
$objecttmp = null; |
8277
|
8277
|
$InfoFieldList = array(); |
8278
|
8278
|
$classname = ''; |
8279
|
|
- $filter = ''; // Ensure filter has value (for static analysis) |
8280
|
|
- $sortfield = ''; // Ensure filter has value (for static analysis) |
|
8279
|
+ $filter = ''; // Ensure filter has value (for static analysis) |
|
8280
|
+ $sortfield = ''; // Ensure filter has value (for static analysis) |
8281
|
8281
|
|
8282
|
8282
|
if ($objectfield) { // We must retrieve the objectdesc from the field or extrafield |
8283
|
8283
|
// Example: $objectfield = 'product:options_package' or 'myobject@mymodule:options_myfield' |
|
@@ -8321,9 +8321,9 @@ discard block |
|
|
block discarded – undo |
8321
|
8321
|
$vartmp = (empty($InfoFieldList[3]) ? '' : $InfoFieldList[3]); |
8322
|
8322
|
$reg = array(); |
8323
|
8323
|
if (preg_match('/^.*:(\w*)$/', $vartmp, $reg)) { |
8324
|
|
- $InfoFieldList[4] = $reg[1]; // take the sort field |
|
8324
|
+ $InfoFieldList[4] = $reg[1]; // take the sort field |
8325
|
8325
|
} |
8326
|
|
- $InfoFieldList[3] = preg_replace('/:\w*$/', '', $vartmp); // take the filter field |
|
8326
|
+ $InfoFieldList[3] = preg_replace('/:\w*$/', '', $vartmp); // take the filter field |
8327
|
8327
|
|
8328
|
8328
|
$classname = $InfoFieldList[0]; |
8329
|
8329
|
$classpath = empty($InfoFieldList[1]) ? '' : $InfoFieldList[1]; |
|
@@ -8354,8 +8354,8 @@ discard block |
|
|
block discarded – undo |
8354
|
8354
|
); |
8355
|
8355
|
|
8356
|
8356
|
if (!is_object($objecttmp)) { |
8357
|
|
- dol_syslog('selectForForms: Error bad setup of field objectdescorig=' . $objectdescorig.', objectfield='.$objectfield.', objectdesc='.$objectdesc, LOG_WARNING); |
8358
|
|
- return 'selectForForms: Error bad setup of field objectdescorig=' . $objectdescorig.', objectfield='.$objectfield.', objectdesc='.$objectdesc; |
|
8357
|
+ dol_syslog('selectForForms: Error bad setup of field objectdescorig='.$objectdescorig.', objectfield='.$objectfield.', objectdesc='.$objectdesc, LOG_WARNING); |
|
8358
|
+ return 'selectForForms: Error bad setup of field objectdescorig='.$objectdescorig.', objectfield='.$objectfield.', objectdesc='.$objectdesc; |
8359
|
8359
|
} |
8360
|
8360
|
'@phan-var-force CommonObject $objecttmp'; |
8361
|
8361
|
|
|
@@ -8367,9 +8367,9 @@ discard block |
|
|
block discarded – undo |
8367
|
8367
|
if ($prefixforautocompletemode == 'product') { |
8368
|
8368
|
$prefixforautocompletemode = 'produit'; |
8369
|
8369
|
} |
8370
|
|
- $confkeyforautocompletemode = strtoupper($prefixforautocompletemode) . '_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT |
|
8370
|
+ $confkeyforautocompletemode = strtoupper($prefixforautocompletemode).'_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT |
8371
|
8371
|
|
8372
|
|
- dol_syslog(get_class($this) . "::selectForForms filter=" . $filter, LOG_DEBUG); |
|
8372
|
+ dol_syslog(get_class($this)."::selectForForms filter=".$filter, LOG_DEBUG); |
8373
|
8373
|
|
8374
|
8374
|
// Generate the combo HTML component |
8375
|
8375
|
$out = ''; |
|
@@ -8398,13 +8398,13 @@ discard block |
|
|
block discarded – undo |
8398
|
8398
|
} |
8399
|
8399
|
|
8400
|
8400
|
// Set url and param to call to get json of the search results |
8401
|
|
- $urlforajaxcall = DOL_URL_ROOT . '/core/ajax/selectobject.php'; |
8402
|
|
- $urloption = 'htmlname=' . urlencode($htmlname) . '&outjson=1&objectdesc=' . urlencode($objectdescorig) . '&objectfield='.urlencode($objectfield) . ($sortfield ? '&sortfield=' . urlencode($sortfield) : ''); |
|
8401
|
+ $urlforajaxcall = DOL_URL_ROOT.'/core/ajax/selectobject.php'; |
|
8402
|
+ $urloption = 'htmlname='.urlencode($htmlname).'&outjson=1&objectdesc='.urlencode($objectdescorig).'&objectfield='.urlencode($objectfield).($sortfield ? '&sortfield='.urlencode($sortfield) : ''); |
8403
|
8403
|
|
8404
|
8404
|
// Activate the auto complete using ajax call. |
8405
|
8405
|
$out .= ajax_autocompleter($preSelectedValue, $htmlname, $urlforajaxcall, $urloption, getDolGlobalString($confkeyforautocompletemode), 0); |
8406
|
8406
|
$out .= '<!-- force css to be higher than dialog popup --><style type="text/css">.ui-autocomplete { z-index: 1010; }</style>'; |
8407
|
|
- $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) . '"' : '') . ' />'; |
|
8407
|
+ $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
|
8408
|
} else { |
8409
|
8409
|
// Immediate load of table record. |
8410
|
8410
|
$out .= $this->selectForFormsList($objecttmp, $htmlname, $preSelectedValue, $showempty, $searchkey, $placeholder, $morecss, $moreparams, $forcecombo, 0, $disabled, $sortfield, $filter); |
|
@@ -8444,16 +8444,16 @@ discard block |
|
|
block discarded – undo |
8444
|
8444
|
if ($prefixforautocompletemode == 'societe') { |
8445
|
8445
|
$prefixforautocompletemode = 'company'; |
8446
|
8446
|
} |
8447
|
|
- $confkeyforautocompletemode = strtoupper($prefixforautocompletemode) . '_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT |
|
8447
|
+ $confkeyforautocompletemode = strtoupper($prefixforautocompletemode).'_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT |
8448
|
8448
|
|
8449
|
8449
|
if (!empty($objecttmp->fields)) { // For object that declare it, it is better to use declared fields (like societe, contact, ...) |
8450
|
8450
|
$tmpfieldstoshow = ''; |
8451
|
8451
|
foreach ($objecttmp->fields as $key => $val) { |
8452
|
|
- if (! (int) dol_eval($val['enabled'], 1, 1, '1')) { |
|
8452
|
+ if (!(int) dol_eval($val['enabled'], 1, 1, '1')) { |
8453
|
8453
|
continue; |
8454
|
8454
|
} |
8455
|
8455
|
if (!empty($val['showoncombobox'])) { |
8456
|
|
- $tmpfieldstoshow .= ($tmpfieldstoshow ? ',' : '') . 't.' . $key; |
|
8456
|
+ $tmpfieldstoshow .= ($tmpfieldstoshow ? ',' : '').'t.'.$key; |
8457
|
8457
|
} |
8458
|
8458
|
} |
8459
|
8459
|
if ($tmpfieldstoshow) { |
|
@@ -8481,18 +8481,18 @@ discard block |
|
|
block discarded – undo |
8481
|
8481
|
$num = 0; |
8482
|
8482
|
|
8483
|
8483
|
// Search data |
8484
|
|
- $sql = "SELECT t.rowid, " . $fieldstoshow . " FROM " . $this->db->prefix() . $objecttmp->table_element . " as t"; |
|
8484
|
+ $sql = "SELECT t.rowid, ".$fieldstoshow." FROM ".$this->db->prefix().$objecttmp->table_element." as t"; |
8485
|
8485
|
if (!empty($objecttmp->isextrafieldmanaged)) { |
8486
|
|
- $sql .= " LEFT JOIN " . $this->db->prefix() . $objecttmp->table_element . "_extrafields as e ON t.rowid=e.fk_object"; |
|
8486
|
+ $sql .= " LEFT JOIN ".$this->db->prefix().$objecttmp->table_element."_extrafields as e ON t.rowid=e.fk_object"; |
8487
|
8487
|
} |
8488
|
8488
|
if (isset($objecttmp->ismultientitymanaged)) { |
8489
|
8489
|
if (!is_numeric($objecttmp->ismultientitymanaged)) { |
8490
|
8490
|
$tmparray = explode('@', $objecttmp->ismultientitymanaged); |
8491
|
|
- $sql .= " INNER JOIN " . $this->db->prefix() . $tmparray[1] . " as parenttable ON parenttable.rowid = t." . $tmparray[0]; |
|
8491
|
+ $sql .= " INNER JOIN ".$this->db->prefix().$tmparray[1]." as parenttable ON parenttable.rowid = t.".$tmparray[0]; |
8492
|
8492
|
} |
8493
|
8493
|
if ($objecttmp->ismultientitymanaged === 'fk_soc@societe') { |
8494
|
8494
|
if (!$user->hasRight('societe', 'client', 'voir')) { |
8495
|
|
- $sql .= ", " . $this->db->prefix() . "societe_commerciaux as sc"; |
|
8495
|
+ $sql .= ", ".$this->db->prefix()."societe_commerciaux as sc"; |
8496
|
8496
|
} |
8497
|
8497
|
} |
8498
|
8498
|
} |
|
@@ -8512,21 +8512,21 @@ discard block |
|
|
block discarded – undo |
8512
|
8512
|
$sql .= " WHERE 1=1"; |
8513
|
8513
|
if (isset($objecttmp->ismultientitymanaged)) { |
8514
|
8514
|
if ($objecttmp->ismultientitymanaged == 1) { |
8515
|
|
- $sql .= " AND t.entity IN (" . getEntity($objecttmp->table_element) . ")"; |
|
8515
|
+ $sql .= " AND t.entity IN (".getEntity($objecttmp->table_element).")"; |
8516
|
8516
|
} |
8517
|
8517
|
if (!is_numeric($objecttmp->ismultientitymanaged)) { |
8518
|
|
- $sql .= " AND parenttable.entity = t." . $tmparray[0]; |
|
8518
|
+ $sql .= " AND parenttable.entity = t.".$tmparray[0]; |
8519
|
8519
|
} |
8520
|
8520
|
if ($objecttmp->ismultientitymanaged == 1 && !empty($user->socid)) { |
8521
|
8521
|
if ($objecttmp->element == 'societe') { |
8522
|
|
- $sql .= " AND t.rowid = " . ((int) $user->socid); |
|
8522
|
+ $sql .= " AND t.rowid = ".((int) $user->socid); |
8523
|
8523
|
} else { |
8524
|
|
- $sql .= " AND t.fk_soc = " . ((int) $user->socid); |
|
8524
|
+ $sql .= " AND t.fk_soc = ".((int) $user->socid); |
8525
|
8525
|
} |
8526
|
8526
|
} |
8527
|
8527
|
if ($objecttmp->ismultientitymanaged === 'fk_soc@societe') { |
8528
|
8528
|
if (!$user->hasRight('societe', 'client', 'voir')) { |
8529
|
|
- $sql .= " AND t.rowid = sc.fk_soc AND sc.fk_user = " . ((int) $user->id); |
|
8529
|
+ $sql .= " AND t.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id); |
8530
|
8530
|
} |
8531
|
8531
|
} |
8532
|
8532
|
} |
|
@@ -8538,7 +8538,7 @@ discard block |
|
|
block discarded – undo |
8538
|
8538
|
$errormessage = ''; |
8539
|
8539
|
$sql .= forgeSQLFromUniversalSearchCriteria($filter, $errormessage); |
8540
|
8540
|
if ($errormessage) { |
8541
|
|
- return 'Error forging a SQL request from an universal criteria: ' . $errormessage; |
|
8541
|
+ return 'Error forging a SQL request from an universal criteria: '.$errormessage; |
8542
|
8542
|
} |
8543
|
8543
|
} |
8544
|
8544
|
} |
|
@@ -8550,7 +8550,7 @@ discard block |
|
|
block discarded – undo |
8550
|
8550
|
$resql = $this->db->query($sql); |
8551
|
8551
|
if ($resql) { |
8552
|
8552
|
// Construct $out and $outarray |
8553
|
|
- $out .= '<select id="' . $htmlname . '" class="flat minwidth100' . ($morecss ? ' ' . $morecss : '') . '"' . ($disabled ? ' disabled="disabled"' : '') . ($moreparams ? ' ' . $moreparams : '') . ' name="' . $htmlname . '">' . "\n"; |
|
8553
|
+ $out .= '<select id="'.$htmlname.'" class="flat minwidth100'.($morecss ? ' '.$morecss : '').'"'.($disabled ? ' disabled="disabled"' : '').($moreparams ? ' '.$moreparams : '').' name="'.$htmlname.'">'."\n"; |
8554
|
8554
|
|
8555
|
8555
|
// Warning: Do not use textifempty = ' ' or ' ' here, or search on key will search on ' key'. Seems it is no more true with selec2 v4 |
8556
|
8556
|
$textifempty = ' '; |
|
@@ -8564,7 +8564,7 @@ discard block |
|
|
block discarded – undo |
8564
|
8564
|
} |
8565
|
8565
|
} |
8566
|
8566
|
if ($showempty) { |
8567
|
|
- $out .= '<option value="-1">' . $textifempty . '</option>' . "\n"; |
|
8567
|
+ $out .= '<option value="-1">'.$textifempty.'</option>'."\n"; |
8568
|
8568
|
} |
8569
|
8569
|
|
8570
|
8570
|
$num = $this->db->num_rows($resql); |
|
@@ -8587,9 +8587,9 @@ discard block |
|
|
block discarded – undo |
8587
|
8587
|
} |
8588
|
8588
|
if (empty($outputmode)) { |
8589
|
8589
|
if ($preselectedvalue > 0 && $preselectedvalue == $obj->rowid) { |
8590
|
|
- $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>'; |
|
8590
|
+ $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
|
8591
|
} else { |
8592
|
|
- $out .= '<option value="' . $obj->rowid . '" data-html="' . dol_escape_htmltag($labelhtml, 0, 0, '', 0, 1) . '">' . dol_escape_htmltag($label, 0, 0, '', 0, 1) . '</option>'; |
|
8592
|
+ $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
|
8593
|
} |
8594
|
8594
|
} else { |
8595
|
8595
|
array_push($outarray, array('key' => $obj->rowid, 'value' => $label, 'label' => $label)); |
|
@@ -8602,10 +8602,10 @@ discard block |
|
|
block discarded – undo |
8602
|
8602
|
} |
8603
|
8603
|
} |
8604
|
8604
|
|
8605
|
|
- $out .= '</select>' . "\n"; |
|
8605
|
+ $out .= '</select>'."\n"; |
8606
|
8606
|
|
8607
|
8607
|
if (!$forcecombo) { |
8608
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
8608
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
8609
|
8609
|
$out .= ajax_combobox($htmlname, array(), getDolGlobalInt($confkeyforautocompletemode, 0)); |
8610
|
8610
|
} |
8611
|
8611
|
} else { |
|
@@ -8669,8 +8669,8 @@ discard block |
|
|
block discarded – undo |
8669
|
8669
|
} |
8670
|
8670
|
} |
8671
|
8671
|
$idname = str_replace(array('[', ']'), array('', ''), $htmlname); |
8672
|
|
- $out .= '<select id="' . preg_replace('/^\./', '', $idname) . '" ' . ($disabled ? 'disabled="disabled" ' : '') . 'class="flat ' . (preg_replace('/^\./', '', $htmlname)) . ($morecss ? ' ' . $morecss : '') . ' selectformat"'; |
8673
|
|
- $out .= ' name="' . preg_replace('/^\./', '', $htmlname) . '" ' . ($moreparam ? $moreparam : ''); |
|
8672
|
+ $out .= '<select id="'.preg_replace('/^\./', '', $idname).'" '.($disabled ? 'disabled="disabled" ' : '').'class="flat '.(preg_replace('/^\./', '', $htmlname)).($morecss ? ' '.$morecss : '').' selectformat"'; |
|
8673
|
+ $out .= ' name="'.preg_replace('/^\./', '', $htmlname).'" '.($moreparam ? $moreparam : ''); |
8674
|
8674
|
$out .= '>'."\n"; |
8675
|
8675
|
|
8676
|
8676
|
if ($show_empty) { |
|
@@ -8681,7 +8681,7 @@ discard block |
|
|
block discarded – undo |
8681
|
8681
|
if (!is_numeric($show_empty)) { |
8682
|
8682
|
$textforempty = $show_empty; |
8683
|
8683
|
} |
8684
|
|
- $out .= '<option class="optiongrey" ' . ($moreparamonempty ? $moreparamonempty . ' ' : '') . 'value="' . (((int) $show_empty) < 0 ? $show_empty : -1) . '"' . ($id == $show_empty ? ' selected' : '') . '>' . $textforempty . '</option>' . "\n"; |
|
8684
|
+ $out .= '<option class="optiongrey" '.($moreparamonempty ? $moreparamonempty.' ' : '').'value="'.(((int) $show_empty) < 0 ? $show_empty : -1).'"'.($id == $show_empty ? ' selected' : '').'>'.$textforempty.'</option>'."\n"; |
8685
|
8685
|
} |
8686
|
8686
|
if (is_array($array)) { |
8687
|
8687
|
// Translate |
|
@@ -8706,7 +8706,7 @@ discard block |
|
|
block discarded – undo |
8706
|
8706
|
$value = $tmpvalue['label']; |
8707
|
8707
|
//$valuehtml = empty($tmpvalue['data-html']) ? $value : $tmpvalue['data-html']; |
8708
|
8708
|
$disabled = empty($tmpvalue['disabled']) ? '' : ' disabled'; |
8709
|
|
- $style = empty($tmpvalue['css']) ? '' : ' class="' . $tmpvalue['css'] . '"'; |
|
8709
|
+ $style = empty($tmpvalue['css']) ? '' : ' class="'.$tmpvalue['css'].'"'; |
8710
|
8710
|
} else { |
8711
|
8711
|
$value = $tmpvalue; |
8712
|
8712
|
//$valuehtml = $tmpvalue; |
|
@@ -8722,9 +8722,9 @@ discard block |
|
|
block discarded – undo |
8722
|
8722
|
} |
8723
|
8723
|
if ($key_in_label) { |
8724
|
8724
|
if (empty($nohtmlescape)) { |
8725
|
|
- $selectOptionValue = dol_escape_htmltag($key . ' - ' . ($maxlen ? dol_trunc($value, $maxlen) : $value)); |
|
8725
|
+ $selectOptionValue = dol_escape_htmltag($key.' - '.($maxlen ? dol_trunc($value, $maxlen) : $value)); |
8726
|
8726
|
} else { |
8727
|
|
- $selectOptionValue = $key . ' - ' . ($maxlen ? dol_trunc($value, $maxlen) : $value); |
|
8727
|
+ $selectOptionValue = $key.' - '.($maxlen ? dol_trunc($value, $maxlen) : $value); |
8728
|
8728
|
} |
8729
|
8729
|
} else { |
8730
|
8730
|
if (empty($nohtmlescape)) { |
|
@@ -8736,8 +8736,8 @@ discard block |
|
|
block discarded – undo |
8736
|
8736
|
$selectOptionValue = ' '; |
8737
|
8737
|
} |
8738
|
8738
|
} |
8739
|
|
- $out .= '<option value="' . $key . '"'; |
8740
|
|
- $out .= $style . $disabled; |
|
8739
|
+ $out .= '<option value="'.$key.'"'; |
|
8740
|
+ $out .= $style.$disabled; |
8741
|
8741
|
if (is_array($id)) { |
8742
|
8742
|
if (in_array($key, $id) && !$disabled) { |
8743
|
8743
|
$out .= ' selected'; // To preselect a value |
|
@@ -8749,7 +8749,7 @@ discard block |
|
|
block discarded – undo |
8749
|
8749
|
} |
8750
|
8750
|
} |
8751
|
8751
|
if (!empty($nohtmlescape)) { // deprecated. Use instead the key 'data-html' into input $array, managed at next step to use HTML content. |
8752
|
|
- $out .= ' data-html="' . dol_escape_htmltag($selectOptionValue) . '"'; |
|
8752
|
+ $out .= ' data-html="'.dol_escape_htmltag($selectOptionValue).'"'; |
8753
|
8753
|
} |
8754
|
8754
|
|
8755
|
8755
|
if (is_array($tmpvalue)) { |
|
@@ -8772,7 +8772,7 @@ discard block |
|
|
block discarded – undo |
8772
|
8772
|
// Add code for jquery to use multiselect |
8773
|
8773
|
if ($addjscombo && $jsbeautify) { |
8774
|
8774
|
// Enhance with select2 |
8775
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
8775
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
8776
|
8776
|
$out .= ajax_combobox($idname, array(), 0, 0, 'resolve', (((int) $show_empty) < 0 ? (string) $show_empty : '-1'), $morecss); |
8777
|
8777
|
} |
8778
|
8778
|
|
|
@@ -8800,28 +8800,28 @@ discard block |
|
|
block discarded – undo |
8800
|
8800
|
public static function selectArrayAjax($htmlname, $url, $id = '', $moreparam = '', $moreparamtourl = '', $disabled = 0, $minimumInputLength = 1, $morecss = '', $callurlonselect = 0, $placeholder = '', $acceptdelayedhtml = 0) |
8801
|
8801
|
{ |
8802
|
8802
|
global $conf, $langs; |
8803
|
|
- global $delayedhtmlcontent; // Will be used later outside of this function |
|
8803
|
+ global $delayedhtmlcontent; // Will be used later outside of this function |
8804
|
8804
|
|
8805
|
8805
|
// TODO Use an internal dolibarr component instead of select2 |
8806
|
8806
|
if (!getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') && !defined('REQUIRE_JQUERY_MULTISELECT')) { |
8807
|
8807
|
return ''; |
8808
|
8808
|
} |
8809
|
8809
|
|
8810
|
|
- $out = '<select type="text" class="' . $htmlname . ($morecss ? ' ' . $morecss : '') . '" ' . ($moreparam ? $moreparam . ' ' : '') . 'name="' . $htmlname . '"></select>'; |
|
8810
|
+ $out = '<select type="text" class="'.$htmlname.($morecss ? ' '.$morecss : '').'" '.($moreparam ? $moreparam.' ' : '').'name="'.$htmlname.'"></select>'; |
8811
|
8811
|
|
8812
|
8812
|
$outdelayed = ''; |
8813
|
8813
|
if (!empty($conf->use_javascript_ajax)) { |
8814
|
8814
|
$tmpplugin = 'select2'; |
8815
|
|
- $outdelayed = "\n" . '<!-- JS CODE TO ENABLE ' . $tmpplugin . ' for id ' . $htmlname . ' --> |
8816
|
|
- <script nonce="' . getNonce() . '"> |
|
8815
|
+ $outdelayed = "\n".'<!-- JS CODE TO ENABLE '.$tmpplugin.' for id '.$htmlname.' --> |
|
8816
|
+ <script nonce="' . getNonce().'"> |
8817
|
8817
|
$(document).ready(function () { |
8818
|
8818
|
|
8819
|
|
- ' . ($callurlonselect ? 'var saveRemoteData = [];' : '') . ' |
|
8819
|
+ ' . ($callurlonselect ? 'var saveRemoteData = [];' : '').' |
8820
|
8820
|
|
8821
|
|
- $(".' . $htmlname . '").select2({ |
|
8821
|
+ $(".' . $htmlname.'").select2({ |
8822
|
8822
|
ajax: { |
8823
|
8823
|
dir: "ltr", |
8824
|
|
- url: "' . $url . '", |
|
8824
|
+ url: "' . $url.'", |
8825
|
8825
|
dataType: \'json\', |
8826
|
8826
|
delay: 250, |
8827
|
8827
|
data: function (params) { |
|
@@ -8848,9 +8848,9 @@ discard block |
|
|
block discarded – undo |
8848
|
8848
|
}, |
8849
|
8849
|
language: select2arrayoflanguage, |
8850
|
8850
|
containerCssClass: \':all:\', /* Line to add class of origin SELECT propagated to the new <span class="select2-selection...> tag */ |
8851
|
|
- placeholder: "' . dol_escape_js($placeholder) . '", |
|
8851
|
+ placeholder: "' . dol_escape_js($placeholder).'", |
8852
|
8852
|
escapeMarkup: function (markup) { return markup; }, // let our custom formatter work |
8853
|
|
- minimumInputLength: ' . ((int) $minimumInputLength) . ', |
|
8853
|
+ minimumInputLength: ' . ((int) $minimumInputLength).', |
8854
|
8854
|
formatResult: function (result, container, query, escapeMarkup) { |
8855
|
8855
|
return escapeMarkup(result.text); |
8856
|
8856
|
}, |
|
@@ -8858,10 +8858,10 @@ discard block |
|
|
block discarded – undo |
8858
|
8858
|
|
8859
|
8859
|
' . ($callurlonselect ? ' |
8860
|
8860
|
/* Code to execute a GET when we select a value */ |
8861
|
|
- $(".' . $htmlname . '").change(function() { |
8862
|
|
- var selected = $(".' . $htmlname . '").val(); |
|
8861
|
+ $(".' . $htmlname.'").change(function() { |
|
8862
|
+ var selected = $(".' . $htmlname.'").val(); |
8863
|
8863
|
console.log("We select in selectArrayAjax the entry "+selected) |
8864
|
|
- $(".' . $htmlname . '").val(""); /* reset visible combo value */ |
|
8864
|
+ $(".' . $htmlname.'").val(""); /* reset visible combo value */ |
8865
|
8865
|
$.each( saveRemoteData, function( key, value ) { |
8866
|
8866
|
if (key == selected) |
8867
|
8867
|
{ |
|
@@ -8869,7 +8869,7 @@ discard block |
|
|
block discarded – undo |
8869
|
8869
|
location.assign(value.url); |
8870
|
8870
|
} |
8871
|
8871
|
}); |
8872
|
|
- });' : '') . ' |
|
8872
|
+ });' : '').' |
8873
|
8873
|
|
8874
|
8874
|
}); |
8875
|
8875
|
</script>'; |
|
@@ -8905,14 +8905,14 @@ discard block |
|
|
block discarded – undo |
8905
|
8905
|
public static function selectArrayFilter($htmlname, $array, $id = '', $moreparam = '', $disableFiltering = 0, $disabled = 0, $minimumInputLength = 1, $morecss = '', $callurlonselect = 0, $placeholder = '', $acceptdelayedhtml = 0, $textfortitle = '') |
8906
|
8906
|
{ |
8907
|
8907
|
global $conf, $langs; |
8908
|
|
- global $delayedhtmlcontent; // Will be used later outside of this function |
|
8908
|
+ global $delayedhtmlcontent; // Will be used later outside of this function |
8909
|
8909
|
|
8910
|
8910
|
// TODO Use an internal dolibarr component instead of select2 |
8911
|
8911
|
if (!getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') && !defined('REQUIRE_JQUERY_MULTISELECT')) { |
8912
|
8912
|
return ''; |
8913
|
8913
|
} |
8914
|
8914
|
|
8915
|
|
- $out = '<select type="text"'.($textfortitle ? ' title="'.dol_escape_htmltag($textfortitle).'"' : '').' id="'.$htmlname.'" class="'.$htmlname.($morecss ? ' ' . $morecss : '').'"'.($moreparam ? ' '.$moreparam : '').' name="'.$htmlname.'"><option></option></select>'; |
|
8915
|
+ $out = '<select type="text"'.($textfortitle ? ' title="'.dol_escape_htmltag($textfortitle).'"' : '').' id="'.$htmlname.'" class="'.$htmlname.($morecss ? ' '.$morecss : '').'"'.($moreparam ? ' '.$moreparam : '').' name="'.$htmlname.'"><option></option></select>'; |
8916
|
8916
|
|
8917
|
8917
|
$formattedarrayresult = array(); |
8918
|
8918
|
|
|
@@ -8927,20 +8927,20 @@ discard block |
|
|
block discarded – undo |
8927
|
8927
|
$outdelayed = ''; |
8928
|
8928
|
if (!empty($conf->use_javascript_ajax)) { |
8929
|
8929
|
$tmpplugin = 'select2'; |
8930
|
|
- $outdelayed = "\n" . '<!-- JS CODE TO ENABLE ' . $tmpplugin . ' for id ' . $htmlname . ' --> |
8931
|
|
- <script nonce="' . getNonce() . '"> |
|
8930
|
+ $outdelayed = "\n".'<!-- JS CODE TO ENABLE '.$tmpplugin.' for id '.$htmlname.' --> |
|
8931
|
+ <script nonce="' . getNonce().'"> |
8932
|
8932
|
$(document).ready(function () { |
8933
|
|
- var data = ' . json_encode($formattedarrayresult) . '; |
|
8933
|
+ var data = ' . json_encode($formattedarrayresult).'; |
8934
|
8934
|
|
8935
|
|
- ' . ($callurlonselect ? 'var saveRemoteData = ' . json_encode($array) . ';' : '') . ' |
|
8935
|
+ ' . ($callurlonselect ? 'var saveRemoteData = '.json_encode($array).';' : '').' |
8936
|
8936
|
|
8937
|
|
- $(".' . $htmlname . '").select2({ |
|
8937
|
+ $(".' . $htmlname.'").select2({ |
8938
|
8938
|
data: data, |
8939
|
8939
|
language: select2arrayoflanguage, |
8940
|
8940
|
containerCssClass: \':all:\', /* Line to add class of origin SELECT propagated to the new <span class="select2-selection...> tag */ |
8941
|
|
- placeholder: "' . dol_escape_js($placeholder) . '", |
|
8941
|
+ placeholder: "' . dol_escape_js($placeholder).'", |
8942
|
8942
|
escapeMarkup: function (markup) { return markup; }, // let our custom formatter work |
8943
|
|
- minimumInputLength: ' . $minimumInputLength . ', |
|
8943
|
+ minimumInputLength: ' . $minimumInputLength.', |
8944
|
8944
|
formatResult: function (result, container, query, escapeMarkup) { |
8945
|
8945
|
return escapeMarkup(result.text); |
8946
|
8946
|
}, |
|
@@ -8979,11 +8979,11 @@ discard block |
|
|
block discarded – undo |
8979
|
8979
|
|
8980
|
8980
|
' . ($callurlonselect ? ' |
8981
|
8981
|
/* Code to execute a GET when we select a value */ |
8982
|
|
- $(".' . $htmlname . '").change(function() { |
8983
|
|
- var selected = $(".' . $htmlname . '").val(); |
|
8982
|
+ $(".' . $htmlname.'").change(function() { |
|
8983
|
+ var selected = $(".' . $htmlname.'").val(); |
8984
|
8984
|
console.log("We select "+selected) |
8985
|
8985
|
|
8986
|
|
- $(".' . $htmlname . '").val(""); /* reset visible combo value */ |
|
8986
|
+ $(".' . $htmlname.'").val(""); /* reset visible combo value */ |
8987
|
8987
|
$.each( saveRemoteData, function( key, value ) { |
8988
|
8988
|
if (key == selected) |
8989
|
8989
|
{ |
|
@@ -8991,7 +8991,7 @@ discard block |
|
|
block discarded – undo |
8991
|
8991
|
location.assign(value.url); |
8992
|
8992
|
} |
8993
|
8993
|
}); |
8994
|
|
- });' : '') . ' |
|
8994
|
+ });' : '').' |
8995
|
8995
|
|
8996
|
8996
|
}); |
8997
|
8997
|
</script>'; |
|
@@ -9040,7 +9040,7 @@ discard block |
|
|
block discarded – undo |
9040
|
9040
|
$useenhancedmultiselect = 0; |
9041
|
9041
|
if (!empty($conf->use_javascript_ajax) && !defined('MAIN_DO_NOT_USE_JQUERY_MULTISELECT') && (getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') || defined('REQUIRE_JQUERY_MULTISELECT'))) { |
9042
|
9042
|
if ($addjscombo) { |
9043
|
|
- $useenhancedmultiselect = 1; // Use the js multiselect in one line. Possible only if $addjscombo not 0. |
|
9043
|
+ $useenhancedmultiselect = 1; // Use the js multiselect in one line. Possible only if $addjscombo not 0. |
9044
|
9044
|
} |
9045
|
9045
|
} |
9046
|
9046
|
|
|
@@ -9049,7 +9049,7 @@ discard block |
|
|
block discarded – undo |
9049
|
9049
|
// submitted to nothing. |
9050
|
9050
|
$out .= '<input type="hidden" name="'.$htmlname.'_multiselect" value="1">'; |
9051
|
9051
|
// Output select component |
9052
|
|
- $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"; |
|
9052
|
+ $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"; |
9053
|
9053
|
if (is_array($array) && !empty($array)) { |
9054
|
9054
|
if ($value_as_key) { |
9055
|
9055
|
$array = array_combine($array, $array); |
|
@@ -9067,36 +9067,36 @@ discard block |
|
|
block discarded – undo |
9067
|
9067
|
$tmpvalue = empty($value['label']) ? '' : $value['label']; |
9068
|
9068
|
$tmpcolor = empty($value['color']) ? '' : $value['color']; |
9069
|
9069
|
$tmppicto = empty($value['picto']) ? '' : $value['picto']; |
9070
|
|
- $tmplabelhtml = empty($value['labelhtml']) ? (empty($value['data-html']) ? '' : $value['data-html']): $value['labelhtml']; |
|
9070
|
+ $tmplabelhtml = empty($value['labelhtml']) ? (empty($value['data-html']) ? '' : $value['data-html']) : $value['labelhtml']; |
9071
|
9071
|
} |
9072
|
9072
|
$newval = ($translate ? $langs->trans($tmpvalue) : $tmpvalue); |
9073
|
|
- $newval = ($key_in_label ? $tmpkey . ' - ' . $newval : $newval); |
|
9073
|
+ $newval = ($key_in_label ? $tmpkey.' - '.$newval : $newval); |
9074
|
9074
|
|
9075
|
|
- $out .= '<option value="' . $tmpkey . '"'; |
|
9075
|
+ $out .= '<option value="'.$tmpkey.'"'; |
9076
|
9076
|
if (is_array($selected) && !empty($selected) && in_array((string) $tmpkey, $selected) && ((string) $tmpkey != '')) { |
9077
|
9077
|
$out .= ' selected'; |
9078
|
9078
|
} |
9079
|
9079
|
if (!empty($tmplabelhtml)) { |
9080
|
|
- $out .= ' data-html="' . dol_escape_htmltag($tmplabelhtml, 0, 0, '', 0, 1) . '"'; |
|
9080
|
+ $out .= ' data-html="'.dol_escape_htmltag($tmplabelhtml, 0, 0, '', 0, 1).'"'; |
9081
|
9081
|
} else { |
9082
|
|
- $tmplabelhtml = ($tmppicto ? img_picto('', $tmppicto, 'class="pictofixedwidth" style="color: #' . $tmpcolor . '"') : '') . $newval; |
9083
|
|
- $out .= ' data-html="' . dol_escape_htmltag($tmplabelhtml, 0, 0, '', 0, 1) . '"'; |
|
9082
|
+ $tmplabelhtml = ($tmppicto ? img_picto('', $tmppicto, 'class="pictofixedwidth" style="color: #'.$tmpcolor.'"') : '').$newval; |
|
9083
|
+ $out .= ' data-html="'.dol_escape_htmltag($tmplabelhtml, 0, 0, '', 0, 1).'"'; |
9084
|
9084
|
} |
9085
|
9085
|
$out .= '>'; |
9086
|
9086
|
$out .= dol_htmlentitiesbr($newval); |
9087
|
|
- $out .= '</option>' . "\n"; |
|
9087
|
+ $out .= '</option>'."\n"; |
9088
|
9088
|
} |
9089
|
9089
|
} |
9090
|
9090
|
} |
9091
|
|
- $out .= '</select>' . "\n"; |
|
9091
|
+ $out .= '</select>'."\n"; |
9092
|
9092
|
|
9093
|
9093
|
// Add code for jquery to use multiselect |
9094
|
9094
|
if (!empty($conf->use_javascript_ajax) && getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') || defined('REQUIRE_JQUERY_MULTISELECT')) { |
9095
|
|
- $out .= "\n" . '<!-- JS CODE TO ENABLE select for id ' . $htmlname . ', addjscombo=' . $addjscombo . ' -->'; |
9096
|
|
- $out .= "\n" . '<script nonce="' . getNonce() . '">' . "\n"; |
|
9095
|
+ $out .= "\n".'<!-- JS CODE TO ENABLE select for id '.$htmlname.', addjscombo='.$addjscombo.' -->'; |
|
9096
|
+ $out .= "\n".'<script nonce="'.getNonce().'">'."\n"; |
9097
|
9097
|
if ($addjscombo == 1) { |
9098
|
9098
|
$tmpplugin = !getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') ? constant('REQUIRE_JQUERY_MULTISELECT') : $conf->global->MAIN_USE_JQUERY_MULTISELECT; |
9099
|
|
- $out .= 'function formatResult(record, container) {' . "\n"; |
|
9099
|
+ $out .= 'function formatResult(record, container) {'."\n"; |
9100
|
9100
|
// If property data-html set, we decode html entities and use this. |
9101
|
9101
|
// Note that HTML content must have been sanitized from js with dol_escape_htmltag(xxx, 0, 0, '', 0, 1) when building the select option. |
9102
|
9102
|
$out .= ' if ($(record.element).attr("data-html") != undefined && typeof htmlEntityDecodeJs === "function") {'; |
|
@@ -9104,26 +9104,26 @@ discard block |
|
|
block discarded – undo |
9104
|
9104
|
$out .= ' return htmlEntityDecodeJs($(record.element).attr("data-html"));'; |
9105
|
9105
|
$out .= ' }'."\n"; |
9106
|
9106
|
$out .= ' return record.text;'; |
9107
|
|
- $out .= '}' . "\n"; |
9108
|
|
- $out .= 'function formatSelection(record) {' . "\n"; |
|
9107
|
+ $out .= '}'."\n"; |
|
9108
|
+ $out .= 'function formatSelection(record) {'."\n"; |
9109
|
9109
|
if ($elemtype == 'category') { |
9110
|
|
- $out .= 'return \'<span><img src="' . DOL_URL_ROOT . '/theme/eldy/img/object_category.png"> \'+record.text+\'</span>\';'; |
|
9110
|
+ $out .= 'return \'<span><img src="'.DOL_URL_ROOT.'/theme/eldy/img/object_category.png"> \'+record.text+\'</span>\';'; |
9111
|
9111
|
} else { |
9112
|
9112
|
$out .= 'return record.text;'; |
9113
|
9113
|
} |
9114
|
|
- $out .= '}' . "\n"; |
|
9114
|
+ $out .= '}'."\n"; |
9115
|
9115
|
$out .= '$(document).ready(function () { |
9116
|
|
- $(\'#' . $htmlname . '\').' . $tmpplugin . '({'; |
|
9116
|
+ $(\'#' . $htmlname.'\').'.$tmpplugin.'({'; |
9117
|
9117
|
if ($placeholder) { |
9118
|
9118
|
$out .= ' |
9119
|
9119
|
placeholder: { |
9120
|
9120
|
id: \'-1\', |
9121
|
|
- text: \'' . dol_escape_js($placeholder) . '\' |
|
9121
|
+ text: \'' . dol_escape_js($placeholder).'\' |
9122
|
9122
|
},'; |
9123
|
9123
|
} |
9124
|
9124
|
$out .= ' dir: \'ltr\', |
9125
|
9125
|
containerCssClass: \':all:\', /* Line to add class of origin SELECT propagated to the new <span class="select2-selection...> tag (ko with multiselect) */ |
9126
|
|
- dropdownCssClass: \'' . $morecss . '\', /* Line to add class on the new <span class="select2-selection...> tag (ok with multiselect). Need full version of select2. */ |
|
9126
|
+ dropdownCssClass: \'' . $morecss.'\', /* Line to add class on the new <span class="select2-selection...> tag (ok with multiselect). Need full version of select2. */ |
9127
|
9127
|
// Specify format function for dropdown item |
9128
|
9128
|
formatResult: formatResult, |
9129
|
9129
|
templateResult: formatResult, /* For 4.0 */ |
|
@@ -9135,21 +9135,21 @@ discard block |
|
|
block discarded – undo |
9135
|
9135
|
|
9136
|
9136
|
/* Add also morecss to the css .select2 that is after the #htmlname, for component that are show dynamically after load, because select2 set |
9137
|
9137
|
the size only if component is not hidden by default on load */ |
9138
|
|
- $(\'#' . $htmlname . ' + .select2\').addClass(\'' . $morecss . '\'); |
|
9138
|
+ $(\'#' . $htmlname.' + .select2\').addClass(\''.$morecss.'\'); |
9139
|
9139
|
});' . "\n"; |
9140
|
9140
|
} elseif ($addjscombo == 2 && !defined('DISABLE_MULTISELECT')) { |
9141
|
9141
|
// Add other js lib |
9142
|
9142
|
// TODO external lib multiselect/jquery.multi-select.js must have been loaded to use this multiselect plugin |
9143
|
9143
|
// ... |
9144
|
|
- $out .= 'console.log(\'addjscombo=2 for htmlname=' . $htmlname . '\');'; |
|
9144
|
+ $out .= 'console.log(\'addjscombo=2 for htmlname='.$htmlname.'\');'; |
9145
|
9145
|
$out .= '$(document).ready(function () { |
9146
|
|
- $(\'#' . $htmlname . '\').multiSelect({ |
|
9146
|
+ $(\'#' . $htmlname.'\').multiSelect({ |
9147
|
9147
|
containerHTML: \'<div class="multi-select-container">\', |
9148
|
9148
|
menuHTML: \'<div class="multi-select-menu">\', |
9149
|
|
- buttonHTML: \'<span class="multi-select-button ' . $morecss . '">\', |
|
9149
|
+ buttonHTML: \'<span class="multi-select-button ' . $morecss.'">\', |
9150
|
9150
|
menuItemHTML: \'<label class="multi-select-menuitem">\', |
9151
|
9151
|
activeClass: \'multi-select-container--open\', |
9152
|
|
- noneText: \'' . $placeholder . '\' |
|
9152
|
+ noneText: \'' . $placeholder.'\' |
9153
|
9153
|
}); |
9154
|
9154
|
})'; |
9155
|
9155
|
} |
|
@@ -9182,7 +9182,7 @@ discard block |
|
|
block discarded – undo |
9182
|
9182
|
return ''; |
9183
|
9183
|
} |
9184
|
9184
|
|
9185
|
|
- $tmpvar = "MAIN_SELECTEDFIELDS_" . $varpage; // To get list of saved selected fields to show |
|
9185
|
+ $tmpvar = "MAIN_SELECTEDFIELDS_".$varpage; // To get list of saved selected fields to show |
9186
|
9186
|
|
9187
|
9187
|
if (!empty($user->conf->$tmpvar)) { // A list of fields was already customized for user |
9188
|
9188
|
$tmparray = explode(',', $user->conf->$tmpvar); |
|
@@ -9225,19 +9225,19 @@ discard block |
|
|
block discarded – undo |
9225
|
9225
|
} |
9226
|
9226
|
|
9227
|
9227
|
// Note: $val['checked'] <> 0 means we must show the field into the combo list @phan-suppress-next-line PhanTypePossiblyInvalidDimOffset |
9228
|
|
- $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>'; |
9229
|
|
- $listcheckedstring .= (empty($val['checked']) ? '' : $key . ','); |
|
9228
|
+ $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>'; |
|
9229
|
+ $listcheckedstring .= (empty($val['checked']) ? '' : $key.','); |
9230
|
9230
|
} |
9231
|
9231
|
} |
9232
|
9232
|
|
9233
|
|
- $out = '<!-- Component multiSelectArrayWithCheckbox ' . $htmlname . ' --> |
|
9233
|
+ $out = '<!-- Component multiSelectArrayWithCheckbox '.$htmlname.' --> |
9234
|
9234
|
|
9235
|
9235
|
<dl class="dropdown"> |
9236
|
9236
|
<dt> |
9237
|
|
- <a href="#' . $htmlname . '"> |
9238
|
|
- ' . img_picto('', 'list') . ' |
|
9237
|
+ <a href="#' . $htmlname.'"> |
|
9238
|
+ ' . img_picto('', 'list').' |
9239
|
9239
|
</a> |
9240
|
|
- <input type="hidden" class="' . $htmlname . '" name="' . $htmlname . '" value="' . $listcheckedstring . '"> |
|
9240
|
+ <input type="hidden" class="' . $htmlname.'" name="'.$htmlname.'" value="'.$listcheckedstring.'"> |
9241
|
9241
|
</dt> |
9242
|
9242
|
<dd class="dropdowndd"> |
9243
|
9243
|
<div class="multiselectcheckbox'.$htmlname.'"> |
|
@@ -9249,19 +9249,19 @@ discard block |
|
|
block discarded – undo |
9249
|
9249
|
</dd> |
9250
|
9250
|
</dl> |
9251
|
9251
|
|
9252
|
|
- <script nonce="' . getNonce() . '" type="text/javascript"> |
|
9252
|
+ <script nonce="' . getNonce().'" type="text/javascript"> |
9253
|
9253
|
jQuery(document).ready(function () { |
9254
|
|
- $(\'.multiselectcheckbox' . $htmlname . ' input[type="checkbox"]\').on(\'click\', function () { |
|
9254
|
+ $(\'.multiselectcheckbox' . $htmlname.' input[type="checkbox"]\').on(\'click\', function () { |
9255
|
9255
|
console.log("A new field was added/removed, we edit field input[name=formfilteraction]"); |
9256
|
9256
|
|
9257
|
9257
|
$("input:hidden[name=formfilteraction]").val(\'listafterchangingselectedfields\'); // Update field so we know we changed something on selected fields after POST |
9258
|
9258
|
|
9259
|
9259
|
var title = $(this).val() + ","; |
9260
|
9260
|
if ($(this).is(\':checked\')) { |
9261
|
|
- $(\'.' . $htmlname . '\').val(title + $(\'.' . $htmlname . '\').val()); |
|
9261
|
+ $(\'.' . $htmlname.'\').val(title + $(\'.'.$htmlname.'\').val()); |
9262
|
9262
|
} |
9263
|
9263
|
else { |
9264
|
|
- $(\'.' . $htmlname . '\').val( $(\'.' . $htmlname . '\').val().replace(title, \'\') ) |
|
9264
|
+ $(\'.' . $htmlname.'\').val( $(\'.'.$htmlname.'\').val().replace(title, \'\') ) |
9265
|
9265
|
} |
9266
|
9266
|
// Now, we submit page |
9267
|
9267
|
//$(this).parents(\'form:first\').submit(); |
|
@@ -9292,7 +9292,7 @@ discard block |
|
|
block discarded – undo |
9292
|
9292
|
*/ |
9293
|
9293
|
public function showCategories($id, $type, $rendermode = 0, $nolink = 0) |
9294
|
9294
|
{ |
9295
|
|
- include_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; |
|
9295
|
+ include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; |
9296
|
9296
|
|
9297
|
9297
|
$cat = new Categorie($this->db); |
9298
|
9298
|
$categories = $cat->containing($id, $type); |
|
@@ -9302,13 +9302,13 @@ discard block |
|
|
block discarded – undo |
9302
|
9302
|
foreach ($categories as $c) { |
9303
|
9303
|
$ways = $c->print_all_ways(' >> ', ($nolink ? 'none' : ''), 0, 1); // $ways[0] = "ccc2 >> ccc2a >> ccc2a1" with html formatted text |
9304
|
9304
|
foreach ($ways as $way) { |
9305
|
|
- $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"' . ($c->color ? ' style="background: #' . $c->color . ';"' : ' style="background: #bbb"') . '>' . $way . '</li>'; |
|
9305
|
+ $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"'.($c->color ? ' style="background: #'.$c->color.';"' : ' style="background: #bbb"').'>'.$way.'</li>'; |
9306
|
9306
|
} |
9307
|
9307
|
} |
9308
|
9308
|
if (empty($toprint)) { |
9309
|
9309
|
return ''; |
9310
|
9310
|
} else { |
9311
|
|
- return '<div class="select2-container-multi-dolibarr"><ul class="select2-choices-dolibarr">' . implode(' ', $toprint) . '</ul></div>'; |
|
9311
|
+ return '<div class="select2-container-multi-dolibarr"><ul class="select2-choices-dolibarr">'.implode(' ', $toprint).'</ul></div>'; |
9312
|
9312
|
} |
9313
|
9313
|
} |
9314
|
9314
|
|
|
@@ -9357,15 +9357,15 @@ discard block |
|
|
block discarded – undo |
9357
|
9357
|
|
9358
|
9358
|
|
9359
|
9359
|
print '<div class="div-table-responsive-no-min">'; |
9360
|
|
- print '<table class="noborder allwidth" data-block="showLinkedObject" data-element="' . $object->element . '" data-elementid="' . $object->id . '" >'; |
|
9360
|
+ print '<table class="noborder allwidth" data-block="showLinkedObject" data-element="'.$object->element.'" data-elementid="'.$object->id.'" >'; |
9361
|
9361
|
|
9362
|
9362
|
print '<tr class="liste_titre">'; |
9363
|
|
- print '<td>' . $langs->trans("Type") . '</td>'; |
9364
|
|
- print '<td>' . $langs->trans("Ref") . '</td>'; |
|
9363
|
+ print '<td>'.$langs->trans("Type").'</td>'; |
|
9364
|
+ print '<td>'.$langs->trans("Ref").'</td>'; |
9365
|
9365
|
print '<td class="center"></td>'; |
9366
|
|
- print '<td class="center">' . $langs->trans("Date") . '</td>'; |
9367
|
|
- print '<td class="right">' . $langs->trans("AmountHTShort") . '</td>'; |
9368
|
|
- print '<td class="right">' . $langs->trans("Status") . '</td>'; |
|
9366
|
+ print '<td class="center">'.$langs->trans("Date").'</td>'; |
|
9367
|
+ print '<td class="right">'.$langs->trans("AmountHTShort").'</td>'; |
|
9368
|
+ print '<td class="right">'.$langs->trans("Status").'</td>'; |
9369
|
9369
|
print '<td></td>'; |
9370
|
9370
|
print '</tr>'; |
9371
|
9371
|
|
|
@@ -9384,13 +9384,13 @@ discard block |
|
|
block discarded – undo |
9384
|
9384
|
if ($objecttype != 'supplier_proposal' && preg_match('/^([^_]+)_([^_]+)/i', $objecttype, $regs)) { |
9385
|
9385
|
$element = $regs[1]; |
9386
|
9386
|
$subelement = $regs[2]; |
9387
|
|
- $tplpath = $element . '/' . $subelement; |
|
9387
|
+ $tplpath = $element.'/'.$subelement; |
9388
|
9388
|
} |
9389
|
9389
|
$tplname = 'linkedobjectblock'; |
9390
|
9390
|
|
9391
|
9391
|
// To work with non standard path |
9392
|
9392
|
if ($objecttype == 'facture') { |
9393
|
|
- $tplpath = 'compta/' . $element; |
|
9393
|
+ $tplpath = 'compta/'.$element; |
9394
|
9394
|
if (!isModEnabled('invoice')) { |
9395
|
9395
|
continue; // Do not show if module disabled |
9396
|
9396
|
} |
|
@@ -9401,7 +9401,7 @@ discard block |
|
|
block discarded – undo |
9401
|
9401
|
continue; // Do not show if module disabled |
9402
|
9402
|
} |
9403
|
9403
|
} elseif ($objecttype == 'propal') { |
9404
|
|
- $tplpath = 'comm/' . $element; |
|
9404
|
+ $tplpath = 'comm/'.$element; |
9405
|
9405
|
if (!isModEnabled('propal')) { |
9406
|
9406
|
continue; // Do not show if module disabled |
9407
|
9407
|
} |
|
@@ -9454,7 +9454,7 @@ discard block |
|
|
block discarded – undo |
9454
|
9454
|
$linkedObjectBlock = $objects; |
9455
|
9455
|
|
9456
|
9456
|
// Output template part (modules that overwrite templates must declare this into descriptor) |
9457
|
|
- $dirtpls = array_merge($conf->modules_parts['tpl'], array('/' . $tplpath . '/tpl')); |
|
9457
|
+ $dirtpls = array_merge($conf->modules_parts['tpl'], array('/'.$tplpath.'/tpl')); |
9458
|
9458
|
foreach ($dirtpls as $reldir) { |
9459
|
9459
|
$reldir = rtrim($reldir, '/'); |
9460
|
9460
|
if ($nboftypesoutput == ($nbofdifferenttypes - 1)) { // No more type to show after |
|
@@ -9462,7 +9462,7 @@ discard block |
|
|
block discarded – undo |
9462
|
9462
|
$noMoreLinkedObjectBlockAfter = 1; |
9463
|
9463
|
} |
9464
|
9464
|
|
9465
|
|
- $res = @include dol_buildpath($reldir . '/' . $tplname . '.tpl.php'); |
|
9465
|
+ $res = @include dol_buildpath($reldir.'/'.$tplname.'.tpl.php'); |
9466
|
9466
|
if ($res) { |
9467
|
9467
|
$nboftypesoutput++; |
9468
|
9468
|
break; |
|
@@ -9471,7 +9471,7 @@ discard block |
|
|
block discarded – undo |
9471
|
9471
|
} |
9472
|
9472
|
|
9473
|
9473
|
if (!$nboftypesoutput) { |
9474
|
|
- print '<tr><td colspan="7"><span class="opacitymedium">' . $langs->trans("None") . '</span></td></tr>'; |
|
9474
|
+ print '<tr><td colspan="7"><span class="opacitymedium">'.$langs->trans("None").'</span></td></tr>'; |
9475
|
9475
|
} |
9476
|
9476
|
|
9477
|
9477
|
print '</table>'; |
|
@@ -9511,14 +9511,14 @@ discard block |
|
|
block discarded – undo |
9511
|
9511
|
if (is_object($object->thirdparty) && !empty($object->thirdparty->id) && $object->thirdparty->id > 0) { |
9512
|
9512
|
$listofidcompanytoscan = $object->thirdparty->id; |
9513
|
9513
|
if (($object->thirdparty->parent > 0) && getDolGlobalString('THIRDPARTY_INCLUDE_PARENT_IN_LINKTO')) { |
9514
|
|
- $listofidcompanytoscan .= ',' . $object->thirdparty->parent; |
|
9514
|
+ $listofidcompanytoscan .= ','.$object->thirdparty->parent; |
9515
|
9515
|
} |
9516
|
9516
|
if (($object->fk_project > 0) && getDolGlobalString('THIRDPARTY_INCLUDE_PROJECT_THIRDPARY_IN_LINKTO')) { |
9517
|
|
- include_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; |
|
9517
|
+ include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; |
9518
|
9518
|
$tmpproject = new Project($this->db); |
9519
|
9519
|
$tmpproject->fetch($object->fk_project); |
9520
|
9520
|
if ($tmpproject->socid > 0 && ($tmpproject->socid != $object->thirdparty->id)) { |
9521
|
|
- $listofidcompanytoscan .= ',' . $tmpproject->socid; |
|
9521
|
+ $listofidcompanytoscan .= ','.$tmpproject->socid; |
9522
|
9522
|
} |
9523
|
9523
|
unset($tmpproject); |
9524
|
9524
|
} |
|
@@ -9528,63 +9528,63 @@ discard block |
|
|
block discarded – undo |
9528
|
9528
|
'enabled' => isModEnabled('propal'), |
9529
|
9529
|
'perms' => 1, |
9530
|
9530
|
'label' => 'LinkToProposal', |
9531
|
|
- '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') . ')'), |
|
9531
|
+ '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').')'), |
9532
|
9532
|
'shipping' => array( |
9533
|
9533
|
'enabled' => isModEnabled('shipping'), |
9534
|
9534
|
'perms' => 1, |
9535
|
9535
|
'label' => 'LinkToExpedition', |
9536
|
|
- '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') . ')'), |
|
9536
|
+ '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').')'), |
9537
|
9537
|
'order' => array( |
9538
|
9538
|
'enabled' => isModEnabled('order'), |
9539
|
9539
|
'perms' => 1, |
9540
|
9540
|
'label' => 'LinkToOrder', |
9541
|
|
- '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') . ')'), |
|
9541
|
+ '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').')'), |
9542
|
9542
|
'invoice' => array( |
9543
|
9543
|
'enabled' => isModEnabled('invoice'), |
9544
|
9544
|
'perms' => 1, |
9545
|
9545
|
'label' => 'LinkToInvoice', |
9546
|
|
- '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') . ')'), |
|
9546
|
+ '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').')'), |
9547
|
9547
|
'invoice_template' => array( |
9548
|
9548
|
'enabled' => isModEnabled('invoice'), |
9549
|
9549
|
'perms' => 1, |
9550
|
9550
|
'label' => 'LinkToTemplateInvoice', |
9551
|
|
- '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') . ')'), |
|
9551
|
+ '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').')'), |
9552
|
9552
|
'contrat' => array( |
9553
|
9553
|
'enabled' => isModEnabled('contract'), |
9554
|
9554
|
'perms' => 1, |
9555
|
9555
|
'label' => 'LinkToContract', |
9556
|
9556
|
'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 |
9557
|
|
- 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' |
|
9557
|
+ 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' |
9558
|
9558
|
), |
9559
|
9559
|
'fichinter' => array( |
9560
|
9560
|
'enabled' => isModEnabled('intervention'), |
9561
|
9561
|
'perms' => 1, |
9562
|
9562
|
'label' => 'LinkToIntervention', |
9563
|
|
- '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') . ')'), |
|
9563
|
+ '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').')'), |
9564
|
9564
|
'supplier_proposal' => array( |
9565
|
9565
|
'enabled' => isModEnabled('supplier_proposal'), |
9566
|
9566
|
'perms' => 1, |
9567
|
9567
|
'label' => 'LinkToSupplierProposal', |
9568
|
|
- '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') . ')'), |
|
9568
|
+ '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').')'), |
9569
|
9569
|
'order_supplier' => array( |
9570
|
9570
|
'enabled' => isModEnabled("supplier_order"), |
9571
|
9571
|
'perms' => 1, |
9572
|
9572
|
'label' => 'LinkToSupplierOrder', |
9573
|
|
- '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') . ')'), |
|
9573
|
+ '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').')'), |
9574
|
9574
|
'invoice_supplier' => array( |
9575
|
9575
|
'enabled' => isModEnabled("supplier_invoice"), |
9576
|
9576
|
'perms' => 1, 'label' => 'LinkToSupplierInvoice', |
9577
|
|
- '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') . ')'), |
|
9577
|
+ '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').')'), |
9578
|
9578
|
'ticket' => array( |
9579
|
9579
|
'enabled' => isModEnabled('ticket'), |
9580
|
9580
|
'perms' => 1, |
9581
|
9581
|
'label' => 'LinkToTicket', |
9582
|
|
- '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') . ')'), |
|
9582
|
+ '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').')'), |
9583
|
9583
|
'mo' => array( |
9584
|
9584
|
'enabled' => isModEnabled('mrp'), |
9585
|
9585
|
'perms' => 1, |
9586
|
9586
|
'label' => 'LinkToMo', |
9587
|
|
- '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') . ')') |
|
9587
|
+ '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').')') |
9588
|
9588
|
); |
9589
|
9589
|
} |
9590
|
9590
|
|
|
@@ -9620,22 +9620,22 @@ discard block |
|
|
block discarded – undo |
9620
|
9620
|
} |
9621
|
9621
|
|
9622
|
9622
|
if (!empty($possiblelink['perms']) && (empty($restrictlinksto) || in_array($key, $restrictlinksto)) && (empty($excludelinksto) || !in_array($key, $excludelinksto))) { |
9623
|
|
- print '<div id="' . $key . 'list"' . (empty($conf->use_javascript_ajax) ? '' : ' style="display:none"') . '>'; |
|
9623
|
+ print '<div id="'.$key.'list"'.(empty($conf->use_javascript_ajax) ? '' : ' style="display:none"').'>'; |
9624
|
9624
|
|
9625
|
9625
|
if (getDolGlobalString('MAIN_LINK_BY_REF_IN_LINKTO')) { |
9626
|
9626
|
print '<br>'."\n"; |
9627
|
9627
|
print '<!-- form to add a link from anywhere -->'."\n"; |
9628
|
|
- print '<form action="' . $_SERVER["PHP_SELF"] . '" method="POST" name="formlinkedbyref' . $key . '">'; |
9629
|
|
- print '<input type="hidden" name="id" value="' . $object->id . '">'; |
|
9628
|
+ print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" name="formlinkedbyref'.$key.'">'; |
|
9629
|
+ print '<input type="hidden" name="id" value="'.$object->id.'">'; |
9630
|
9630
|
print '<input type="hidden" name="action" value="addlinkbyref">'; |
9631
|
|
- print '<input type="hidden" name="token" value="' . newToken() . '">'; |
9632
|
|
- print '<input type="hidden" name="addlink" value="' . $key . '">'; |
|
9631
|
+ print '<input type="hidden" name="token" value="'.newToken().'">'; |
|
9632
|
+ print '<input type="hidden" name="addlink" value="'.$key.'">'; |
9633
|
9633
|
print '<table class="noborder">'; |
9634
|
9634
|
print '<tr>'; |
9635
|
9635
|
//print '<td>' . $langs->trans("Ref") . '</td>'; |
9636
|
|
- print '<td class="center"><input type="text" placeholder="'.dol_escape_htmltag($langs->trans("Ref")).'" name="reftolinkto" value="' . dol_escape_htmltag(GETPOST('reftolinkto', 'alpha')) . '"> '; |
9637
|
|
- print '<input type="submit" class="button small valignmiddle" value="' . $langs->trans('ToLink') . '"> '; |
9638
|
|
- print '<input type="submit" class="button small" name="cancel" value="' . $langs->trans('Cancel') . '"></td>'; |
|
9636
|
+ print '<td class="center"><input type="text" placeholder="'.dol_escape_htmltag($langs->trans("Ref")).'" name="reftolinkto" value="'.dol_escape_htmltag(GETPOST('reftolinkto', 'alpha')).'"> '; |
|
9637
|
+ print '<input type="submit" class="button small valignmiddle" value="'.$langs->trans('ToLink').'"> '; |
|
9638
|
+ print '<input type="submit" class="button small" name="cancel" value="'.$langs->trans('Cancel').'"></td>'; |
9639
|
9639
|
print '</tr>'; |
9640
|
9640
|
print '</table>'; |
9641
|
9641
|
print '</form>'; |
|
@@ -9650,48 +9650,48 @@ discard block |
|
|
block discarded – undo |
9650
|
9650
|
|
9651
|
9651
|
print '<br>'; |
9652
|
9652
|
print '<!-- form to add a link from object to same thirdparty -->'."\n"; |
9653
|
|
- print '<form action="' . $_SERVER["PHP_SELF"] . '" method="POST" name="formlinked' . $key . '">'; |
|
9653
|
+ print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" name="formlinked'.$key.'">'; |
9654
|
9654
|
print '<input type="hidden" name="action" value="addlink">'; |
9655
|
|
- print '<input type="hidden" name="token" value="' . newToken() . '">'; |
9656
|
|
- print '<input type="hidden" name="id" value="' . $object->id . '">'; |
9657
|
|
- print '<input type="hidden" name="addlink" value="' . $key . '">'; |
|
9655
|
+ print '<input type="hidden" name="token" value="'.newToken().'">'; |
|
9656
|
+ print '<input type="hidden" name="id" value="'.$object->id.'">'; |
|
9657
|
+ print '<input type="hidden" name="addlink" value="'.$key.'">'; |
9658
|
9658
|
print '<table class="noborder">'; |
9659
|
9659
|
print '<tr class="liste_titre">'; |
9660
|
9660
|
print '<td class="nowrap"></td>'; |
9661
|
|
- print '<td class="center">' . $langs->trans("Ref") . '</td>'; |
9662
|
|
- print '<td class="left">' . $langs->trans("RefCustomer") . '</td>'; |
9663
|
|
- print '<td class="right">' . $langs->trans("AmountHTShort") . '</td>'; |
9664
|
|
- print '<td class="left">' . $langs->trans("Company") . '</td>'; |
|
9661
|
+ print '<td class="center">'.$langs->trans("Ref").'</td>'; |
|
9662
|
+ print '<td class="left">'.$langs->trans("RefCustomer").'</td>'; |
|
9663
|
+ print '<td class="right">'.$langs->trans("AmountHTShort").'</td>'; |
|
9664
|
+ print '<td class="left">'.$langs->trans("Company").'</td>'; |
9665
|
9665
|
print '</tr>'; |
9666
|
9666
|
while ($i < $num) { |
9667
|
9667
|
$objp = $this->db->fetch_object($resqllist); |
9668
|
9668
|
|
9669
|
9669
|
print '<tr class="oddeven">'; |
9670
|
9670
|
print '<td class="left">'; |
9671
|
|
- print '<input type="radio" name="idtolinkto" id="' . $key . '_' . $objp->rowid . '" value="' . $objp->rowid . '">'; |
|
9671
|
+ print '<input type="radio" name="idtolinkto" id="'.$key.'_'.$objp->rowid.'" value="'.$objp->rowid.'">'; |
9672
|
9672
|
print '</td>'; |
9673
|
|
- print '<td class="center"><label for="' . $key . '_' . $objp->rowid . '">' . $objp->ref . '</label></td>'; |
9674
|
|
- print '<td>' . (!empty($objp->ref_client) ? $objp->ref_client : (!empty($objp->ref_supplier) ? $objp->ref_supplier : '')) . '</td>'; |
|
9673
|
+ print '<td class="center"><label for="'.$key.'_'.$objp->rowid.'">'.$objp->ref.'</label></td>'; |
|
9674
|
+ print '<td>'.(!empty($objp->ref_client) ? $objp->ref_client : (!empty($objp->ref_supplier) ? $objp->ref_supplier : '')).'</td>'; |
9675
|
9675
|
print '<td class="right">'; |
9676
|
9676
|
if ($possiblelink['label'] == 'LinkToContract') { |
9677
|
9677
|
$form = new Form($this->db); |
9678
|
|
- print $form->textwithpicto('', $langs->trans("InformationOnLinkToContract")) . ' '; |
|
9678
|
+ print $form->textwithpicto('', $langs->trans("InformationOnLinkToContract")).' '; |
9679
|
9679
|
} |
9680
|
|
- print '<span class="amount">' . (isset($objp->total_ht) ? price($objp->total_ht) : '') . '</span>'; |
|
9680
|
+ print '<span class="amount">'.(isset($objp->total_ht) ? price($objp->total_ht) : '').'</span>'; |
9681
|
9681
|
print '</td>'; |
9682
|
|
- print '<td>' . $objp->name . '</td>'; |
|
9682
|
+ print '<td>'.$objp->name.'</td>'; |
9683
|
9683
|
print '</tr>'; |
9684
|
9684
|
$i++; |
9685
|
9685
|
} |
9686
|
9686
|
print '</table>'; |
9687
|
9687
|
print '<div class="center">'; |
9688
|
9688
|
if ($num) { |
9689
|
|
- print '<input type="submit" class="button valignmiddle marginleftonly marginrightonly small" value="' . $langs->trans('ToLink') . '">'; |
|
9689
|
+ print '<input type="submit" class="button valignmiddle marginleftonly marginrightonly small" value="'.$langs->trans('ToLink').'">'; |
9690
|
9690
|
} |
9691
|
9691
|
if (empty($conf->use_javascript_ajax)) { |
9692
|
|
- print '<input type="submit" class="button button-cancel marginleftonly marginrightonly small" name="cancel" value="' . $langs->trans("Cancel") . '"></div>'; |
|
9692
|
+ print '<input type="submit" class="button button-cancel marginleftonly marginrightonly small" name="cancel" value="'.$langs->trans("Cancel").'"></div>'; |
9693
|
9693
|
} else { |
9694
|
|
- 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>'; |
|
9694
|
+ 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>'; |
9695
|
9695
|
} |
9696
|
9696
|
print '</form>'; |
9697
|
9697
|
$this->db->free($resqllist); |
|
@@ -9702,10 +9702,10 @@ discard block |
|
|
block discarded – undo |
9702
|
9702
|
|
9703
|
9703
|
//$linktoelem.=($linktoelem?' ':''); |
9704
|
9704
|
if ($num > 0 || getDolGlobalString('MAIN_LINK_BY_REF_IN_LINKTO')) { |
9705
|
|
- $linktoelemlist .= '<li><a href="#linkto' . $key . '" class="linkto dropdowncloseonclick" rel="' . $key . '">' . $langs->trans($possiblelink['label']) . ' (' . $num . ')</a></li>'; |
|
9705
|
+ $linktoelemlist .= '<li><a href="#linkto'.$key.'" class="linkto dropdowncloseonclick" rel="'.$key.'">'.$langs->trans($possiblelink['label']).' ('.$num.')</a></li>'; |
9706
|
9706
|
// } else $linktoelem.=$langs->trans($possiblelink['label']); |
9707
|
9707
|
} else { |
9708
|
|
- $linktoelemlist .= '<li><span class="linktodisabled">' . $langs->trans($possiblelink['label']) . ' (0)</span></li>'; |
|
9708
|
+ $linktoelemlist .= '<li><span class="linktodisabled">'.$langs->trans($possiblelink['label']).' (0)</span></li>'; |
9709
|
9709
|
} |
9710
|
9710
|
} |
9711
|
9711
|
} |
|
@@ -9715,11 +9715,11 @@ discard block |
|
|
block discarded – undo |
9715
|
9715
|
<dl class="dropdown" id="linktoobjectname"> |
9716
|
9716
|
'; |
9717
|
9717
|
if (!empty($conf->use_javascript_ajax)) { |
9718
|
|
- $linktoelem .= '<dt><a href="#linktoobjectname"><span class="fas fa-link paddingrightonly"></span>' . $langs->trans("LinkTo") . '...</a></dt>'; |
|
9718
|
+ $linktoelem .= '<dt><a href="#linktoobjectname"><span class="fas fa-link paddingrightonly"></span>'.$langs->trans("LinkTo").'...</a></dt>'; |
9719
|
9719
|
} |
9720
|
9720
|
$linktoelem .= '<dd> |
9721
|
9721
|
<div class="multiselectlinkto"> |
9722
|
|
- <ul class="ulselectedfields">' . $linktoelemlist . ' |
|
9722
|
+ <ul class="ulselectedfields">' . $linktoelemlist.' |
9723
|
9723
|
</ul> |
9724
|
9724
|
</div> |
9725
|
9725
|
</dd> |
|
@@ -9730,7 +9730,7 @@ discard block |
|
|
block discarded – undo |
9730
|
9730
|
|
9731
|
9731
|
if (!empty($conf->use_javascript_ajax)) { |
9732
|
9732
|
print '<!-- Add js to show linkto box --> |
9733
|
|
- <script nonce="' . getNonce() . '"> |
|
9733
|
+ <script nonce="' . getNonce().'"> |
9734
|
9734
|
jQuery(document).ready(function() { |
9735
|
9735
|
jQuery(".linkto").click(function() { |
9736
|
9736
|
console.log("We choose to show/hide links for rel="+jQuery(this).attr(\'rel\')+" so #"+jQuery(this).attr(\'rel\')+"list"); |
|
@@ -9771,19 +9771,19 @@ discard block |
|
|
block discarded – undo |
9771
|
9771
|
|
9772
|
9772
|
$disabled = ($disabled ? ' disabled' : ''); |
9773
|
9773
|
|
9774
|
|
- $resultyesno = '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" id="' . $htmlname . '" name="' . $htmlname . '"' . $disabled . '>' . "\n"; |
|
9774
|
+ $resultyesno = '<select class="flat'.($morecss ? ' '.$morecss : '').'" id="'.$htmlname.'" name="'.$htmlname.'"'.$disabled.'>'."\n"; |
9775
|
9775
|
if ($useempty) { |
9776
|
|
- $resultyesno .= '<option value="-1"' . (($value < 0) ? ' selected' : '') . '> </option>' . "\n"; |
|
9776
|
+ $resultyesno .= '<option value="-1"'.(($value < 0) ? ' selected' : '').'> </option>'."\n"; |
9777
|
9777
|
} |
9778
|
9778
|
if (("$value" == 'yes') || ($value == 1)) { |
9779
|
|
- $resultyesno .= '<option value="' . $yes . '" selected>' . $langs->trans($labelyes) . '</option>' . "\n"; |
9780
|
|
- $resultyesno .= '<option value="' . $no . '">' . $langs->trans($labelno) . '</option>' . "\n"; |
|
9779
|
+ $resultyesno .= '<option value="'.$yes.'" selected>'.$langs->trans($labelyes).'</option>'."\n"; |
|
9780
|
+ $resultyesno .= '<option value="'.$no.'">'.$langs->trans($labelno).'</option>'."\n"; |
9781
|
9781
|
} else { |
9782
|
9782
|
$selected = (($useempty && $value != '0' && $value != 'no') ? '' : ' selected'); |
9783
|
|
- $resultyesno .= '<option value="' . $yes . '">' . $langs->trans($labelyes) . '</option>' . "\n"; |
9784
|
|
- $resultyesno .= '<option value="' . $no . '"' . $selected . '>' . $langs->trans($labelno) . '</option>' . "\n"; |
|
9783
|
+ $resultyesno .= '<option value="'.$yes.'">'.$langs->trans($labelyes).'</option>'."\n"; |
|
9784
|
+ $resultyesno .= '<option value="'.$no.'"'.$selected.'>'.$langs->trans($labelno).'</option>'."\n"; |
9785
|
9785
|
} |
9786
|
|
- $resultyesno .= '</select>' . "\n"; |
|
9786
|
+ $resultyesno .= '</select>'."\n"; |
9787
|
9787
|
|
9788
|
9788
|
if ($addjscombo) { |
9789
|
9789
|
$resultyesno .= ajax_combobox($htmlname, array(), 0, 0, 'resolve', ($useempty < 0 ? (string) $useempty : '-1'), $morecss); |
|
@@ -9807,12 +9807,12 @@ discard block |
|
|
block discarded – undo |
9807
|
9807
|
{ |
9808
|
9808
|
// phpcs:enable |
9809
|
9809
|
$sql = "SELECT rowid, label"; |
9810
|
|
- $sql .= " FROM " . $this->db->prefix() . "export_model"; |
9811
|
|
- $sql .= " WHERE type = '" . $this->db->escape($type) . "'"; |
|
9810
|
+ $sql .= " FROM ".$this->db->prefix()."export_model"; |
|
9811
|
+ $sql .= " WHERE type = '".$this->db->escape($type)."'"; |
9812
|
9812
|
$sql .= " ORDER BY rowid"; |
9813
|
9813
|
$result = $this->db->query($sql); |
9814
|
9814
|
if ($result) { |
9815
|
|
- print '<select class="flat" id="select_' . $htmlname . '" name="' . $htmlname . '">'; |
|
9815
|
+ print '<select class="flat" id="select_'.$htmlname.'" name="'.$htmlname.'">'; |
9816
|
9816
|
if ($useempty) { |
9817
|
9817
|
print '<option value="-1"> </option>'; |
9818
|
9818
|
} |
|
@@ -9822,9 +9822,9 @@ discard block |
|
|
block discarded – undo |
9822
|
9822
|
while ($i < $num) { |
9823
|
9823
|
$obj = $this->db->fetch_object($result); |
9824
|
9824
|
if ($selected == $obj->rowid) { |
9825
|
|
- print '<option value="' . $obj->rowid . '" selected>'; |
|
9825
|
+ print '<option value="'.$obj->rowid.'" selected>'; |
9826
|
9826
|
} else { |
9827
|
|
- print '<option value="' . $obj->rowid . '">'; |
|
9827
|
+ print '<option value="'.$obj->rowid.'">'; |
9828
|
9828
|
} |
9829
|
9829
|
print $obj->label; |
9830
|
9830
|
print '</option>'; |
|
@@ -9915,8 +9915,8 @@ discard block |
|
|
block discarded – undo |
9915
|
9915
|
$stringforfirstkey .= ' CTL +'; |
9916
|
9916
|
} |
9917
|
9917
|
|
9918
|
|
- $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>'; |
9919
|
|
- $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>'; |
|
9918
|
+ $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>'; |
|
9919
|
+ $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>'; |
9920
|
9920
|
} |
9921
|
9921
|
|
9922
|
9922
|
//print "xx".$previous_ref."x".$next_ref; |
|
@@ -9924,18 +9924,18 @@ discard block |
|
|
block discarded – undo |
9924
|
9924
|
|
9925
|
9925
|
// Right part of banner |
9926
|
9926
|
if ($morehtmlright) { |
9927
|
|
- $ret .= '<div class="inline-block floatleft">' . $morehtmlright . '</div>'; |
|
9927
|
+ $ret .= '<div class="inline-block floatleft">'.$morehtmlright.'</div>'; |
9928
|
9928
|
} |
9929
|
9929
|
|
9930
|
9930
|
if ($previous_ref || $next_ref || $morehtml) { |
9931
|
9931
|
$ret .= '<div class="pagination paginationref"><ul class="right">'; |
9932
|
9932
|
} |
9933
|
9933
|
if ($morehtml && getDolGlobalInt('MAIN_OPTIMIZEFORTEXTBROWSER') < 2) { |
9934
|
|
- $ret .= '<!-- morehtml --><li class="noborder litext' . (($shownav && $previous_ref && $next_ref) ? ' clearbothonsmartphone' : '') . '">' . $morehtml . '</li>'; |
|
9934
|
+ $ret .= '<!-- morehtml --><li class="noborder litext'.(($shownav && $previous_ref && $next_ref) ? ' clearbothonsmartphone' : '').'">'.$morehtml.'</li>'; |
9935
|
9935
|
} |
9936
|
9936
|
if ($shownav && ($previous_ref || $next_ref)) { |
9937
|
|
- $ret .= '<li class="pagination">' . $previous_ref . '</li>'; |
9938
|
|
- $ret .= '<li class="pagination">' . $next_ref . '</li>'; |
|
9937
|
+ $ret .= '<li class="pagination">'.$previous_ref.'</li>'; |
|
9938
|
+ $ret .= '<li class="pagination">'.$next_ref.'</li>'; |
9939
|
9939
|
} |
9940
|
9940
|
if ($previous_ref || $next_ref || $morehtml) { |
9941
|
9941
|
$ret .= '</ul></div>'; |
|
@@ -9950,7 +9950,7 @@ discard block |
|
|
block discarded – undo |
9950
|
9950
|
$morehtmlstatus = $hookmanager->resPrint; |
9951
|
9951
|
} |
9952
|
9952
|
if ($morehtmlstatus) { |
9953
|
|
- $ret .= '<div class="statusref">' . $morehtmlstatus . '</div>'; |
|
9953
|
+ $ret .= '<div class="statusref">'.$morehtmlstatus.'</div>'; |
9954
|
9954
|
} |
9955
|
9955
|
|
9956
|
9956
|
$parameters = array(); |
|
@@ -9964,14 +9964,14 @@ discard block |
|
|
block discarded – undo |
9964
|
9964
|
// Left part of banner |
9965
|
9965
|
if ($morehtmlleft) { |
9966
|
9966
|
if ($conf->browser->layout == 'phone') { |
9967
|
|
- $ret .= '<!-- morehtmlleft --><div class="floatleft">' . $morehtmlleft . '</div>'; |
|
9967
|
+ $ret .= '<!-- morehtmlleft --><div class="floatleft">'.$morehtmlleft.'</div>'; |
9968
|
9968
|
} else { |
9969
|
|
- $ret .= '<!-- morehtmlleft --><div class="inline-block floatleft">' . $morehtmlleft . '</div>'; |
|
9969
|
+ $ret .= '<!-- morehtmlleft --><div class="inline-block floatleft">'.$morehtmlleft.'</div>'; |
9970
|
9970
|
} |
9971
|
9971
|
} |
9972
|
9972
|
|
9973
|
9973
|
//if ($conf->browser->layout == 'phone') $ret.='<div class="clearboth"></div>'; |
9974
|
|
- $ret .= '<div class="inline-block floatleft valignmiddle maxwidth750 marginbottomonly refid' . (($shownav && ($previous_ref || $next_ref)) ? ' refidpadding' : '') . '">'; |
|
9974
|
+ $ret .= '<div class="inline-block floatleft valignmiddle maxwidth750 marginbottomonly refid'.(($shownav && ($previous_ref || $next_ref)) ? ' refidpadding' : '').'">'; |
9975
|
9975
|
|
9976
|
9976
|
// For thirdparty, contact, user, member, the ref is the id, so we show something else |
9977
|
9977
|
if ($object->element == 'societe') { |
|
@@ -9985,7 +9985,7 @@ discard block |
|
|
block discarded – undo |
9985
|
9985
|
|
9986
|
9986
|
if (is_array($arrayoflangcode) && count($arrayoflangcode)) { |
9987
|
9987
|
if (!is_object($extralanguages)) { |
9988
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/class/extralanguages.class.php'; |
|
9988
|
+ include_once DOL_DOCUMENT_ROOT.'/core/class/extralanguages.class.php'; |
9989
|
9989
|
$extralanguages = new ExtraLanguages($this->db); |
9990
|
9990
|
} |
9991
|
9991
|
$extralanguages->fetch_name_extralanguages('societe'); |
|
@@ -10000,29 +10000,29 @@ discard block |
|
|
block discarded – undo |
10000
|
10000
|
if ($object->array_languages['name'][$extralangcode]) { |
10001
|
10001
|
$htmltext .= $object->array_languages['name'][$extralangcode]; |
10002
|
10002
|
} else { |
10003
|
|
- $htmltext .= '<span class="opacitymedium">' . $langs->trans("SwitchInEditModeToAddTranslation") . '</span>'; |
|
10003
|
+ $htmltext .= '<span class="opacitymedium">'.$langs->trans("SwitchInEditModeToAddTranslation").'</span>'; |
10004
|
10004
|
} |
10005
|
10005
|
} |
10006
|
|
- $ret .= '<!-- Show translations of name -->' . "\n"; |
|
10006
|
+ $ret .= '<!-- Show translations of name -->'."\n"; |
10007
|
10007
|
$ret .= $this->textwithpicto('', $htmltext, -1, 'language', 'opacitymedium paddingleft'); |
10008
|
10008
|
} |
10009
|
10009
|
} |
10010
|
10010
|
} elseif ($object->element == 'member') { |
10011
|
10011
|
'@phan-var-force Adherent $object'; |
10012
|
|
- $ret .= $object->ref . '<br>'; |
|
10012
|
+ $ret .= $object->ref.'<br>'; |
10013
|
10013
|
$fullname = $object->getFullName($langs); |
10014
|
10014
|
if ($object->morphy == 'mor' && $object->societe) { |
10015
|
|
- $ret .= dol_htmlentities($object->societe) . ((!empty($fullname) && $object->societe != $fullname) ? ' (' . dol_htmlentities($fullname) . $addgendertxt . ')' : ''); |
|
10015
|
+ $ret .= dol_htmlentities($object->societe).((!empty($fullname) && $object->societe != $fullname) ? ' ('.dol_htmlentities($fullname).$addgendertxt.')' : ''); |
10016
|
10016
|
} else { |
10017
|
|
- $ret .= dol_htmlentities($fullname) . $addgendertxt . ((!empty($object->societe) && $object->societe != $fullname) ? ' (' . dol_htmlentities($object->societe) . ')' : ''); |
|
10017
|
+ $ret .= dol_htmlentities($fullname).$addgendertxt.((!empty($object->societe) && $object->societe != $fullname) ? ' ('.dol_htmlentities($object->societe).')' : ''); |
10018
|
10018
|
} |
10019
|
10019
|
} elseif (in_array($object->element, array('contact', 'user'))) { |
10020
|
|
- $ret .= dol_htmlentities($object->getFullName($langs)) . $addgendertxt; |
|
10020
|
+ $ret .= dol_htmlentities($object->getFullName($langs)).$addgendertxt; |
10021
|
10021
|
} elseif ($object->element == 'usergroup') { |
10022
|
10022
|
$ret .= dol_htmlentities($object->name); |
10023
|
10023
|
} elseif (in_array($object->element, array('action', 'agenda'))) { |
10024
|
10024
|
'@phan-var-force ActionComm $object'; |
10025
|
|
- $ret .= $object->ref . '<br>' . $object->label; |
|
10025
|
+ $ret .= $object->ref.'<br>'.$object->label; |
10026
|
10026
|
} elseif (in_array($object->element, array('adherent_type'))) { |
10027
|
10027
|
$ret .= $object->label; |
10028
|
10028
|
} elseif ($object->element == 'ecm_directories') { |
|
@@ -10075,9 +10075,9 @@ discard block |
|
|
block discarded – undo |
10075
|
10075
|
} |
10076
|
10076
|
|
10077
|
10077
|
// Barcode image @phan-suppress-next-line PhanUndeclaredProperty |
10078
|
|
- $url = DOL_URL_ROOT . '/viewimage.php?modulepart=barcode&generator=' . urlencode($object->barcode_type_coder) . '&code=' . urlencode($object->barcode) . '&encoding=' . urlencode($object->barcode_type_code); |
10079
|
|
- $out = '<!-- url barcode = ' . $url . ' -->'; |
10080
|
|
- $out .= '<img src="' . $url . '"' . ($morecss ? ' class="' . $morecss . '"' : '') . '>'; |
|
10078
|
+ $url = DOL_URL_ROOT.'/viewimage.php?modulepart=barcode&generator='.urlencode($object->barcode_type_coder).'&code='.urlencode($object->barcode).'&encoding='.urlencode($object->barcode_type_code); |
|
10079
|
+ $out = '<!-- url barcode = '.$url.' -->'; |
|
10080
|
+ $out .= '<img src="'.$url.'"'.($morecss ? ' class="'.$morecss.'"' : '').'>'; |
10081
|
10081
|
|
10082
|
10082
|
return $out; |
10083
|
10083
|
} |
|
@@ -10104,7 +10104,7 @@ discard block |
|
|
block discarded – undo |
10104
|
10104
|
global $conf, $langs; |
10105
|
10105
|
|
10106
|
10106
|
$entity = (empty($object->entity) ? $conf->entity : $object->entity); |
10107
|
|
- $id = (empty($object->id) ? $object->rowid : $object->id); // @phan-suppress-current-line PhanUndeclaredProperty (->rowid) |
|
10107
|
+ $id = (empty($object->id) ? $object->rowid : $object->id); // @phan-suppress-current-line PhanUndeclaredProperty (->rowid) |
10108
|
10108
|
|
10109
|
10109
|
$dir = ''; |
10110
|
10110
|
$file = ''; |
|
@@ -10117,28 +10117,28 @@ discard block |
|
|
block discarded – undo |
10117
|
10117
|
if (!empty($object->logo)) { |
10118
|
10118
|
if (dolIsAllowedForPreview($object->logo)) { |
10119
|
10119
|
if ((string) $imagesize == 'mini') { |
10120
|
|
- $file = get_exdir(0, 0, 0, 0, $object, 'thirdparty') . 'logos/' . getImageFileNameForSize($object->logo, '_mini'); // getImageFileNameForSize include the thumbs |
|
10120
|
+ $file = get_exdir(0, 0, 0, 0, $object, 'thirdparty').'logos/'.getImageFileNameForSize($object->logo, '_mini'); // getImageFileNameForSize include the thumbs |
10121
|
10121
|
} elseif ((string) $imagesize == 'small') { |
10122
|
|
- $file = get_exdir(0, 0, 0, 0, $object, 'thirdparty') . 'logos/' . getImageFileNameForSize($object->logo, '_small'); |
|
10122
|
+ $file = get_exdir(0, 0, 0, 0, $object, 'thirdparty').'logos/'.getImageFileNameForSize($object->logo, '_small'); |
10123
|
10123
|
} else { |
10124
|
|
- $file = get_exdir(0, 0, 0, 0, $object, 'thirdparty') . 'logos/' . $object->logo; |
|
10124
|
+ $file = get_exdir(0, 0, 0, 0, $object, 'thirdparty').'logos/'.$object->logo; |
10125
|
10125
|
} |
10126
|
|
- $originalfile = get_exdir(0, 0, 0, 0, $object, 'thirdparty') . 'logos/' . $object->logo; |
|
10126
|
+ $originalfile = get_exdir(0, 0, 0, 0, $object, 'thirdparty').'logos/'.$object->logo; |
10127
|
10127
|
} |
10128
|
10128
|
} |
10129
|
10129
|
$email = $object->email; |
10130
|
10130
|
} elseif ($modulepart == 'contact') { |
10131
|
|
- $dir = $conf->societe->multidir_output[$entity] . '/contact'; |
|
10131
|
+ $dir = $conf->societe->multidir_output[$entity].'/contact'; |
10132
|
10132
|
if (!empty($object->photo)) { |
10133
|
10133
|
if (dolIsAllowedForPreview($object->photo)) { |
10134
|
10134
|
if ((string) $imagesize == 'mini') { |
10135
|
|
- $file = get_exdir(0, 0, 0, 0, $object, 'contact') . 'photos/' . getImageFileNameForSize($object->photo, '_mini'); |
|
10135
|
+ $file = get_exdir(0, 0, 0, 0, $object, 'contact').'photos/'.getImageFileNameForSize($object->photo, '_mini'); |
10136
|
10136
|
} elseif ((string) $imagesize == 'small') { |
10137
|
|
- $file = get_exdir(0, 0, 0, 0, $object, 'contact') . 'photos/' . getImageFileNameForSize($object->photo, '_small'); |
|
10137
|
+ $file = get_exdir(0, 0, 0, 0, $object, 'contact').'photos/'.getImageFileNameForSize($object->photo, '_small'); |
10138
|
10138
|
} else { |
10139
|
|
- $file = get_exdir(0, 0, 0, 0, $object, 'contact') . 'photos/' . $object->photo; |
|
10139
|
+ $file = get_exdir(0, 0, 0, 0, $object, 'contact').'photos/'.$object->photo; |
10140
|
10140
|
} |
10141
|
|
- $originalfile = get_exdir(0, 0, 0, 0, $object, 'contact') . 'photos/' . $object->photo; |
|
10141
|
+ $originalfile = get_exdir(0, 0, 0, 0, $object, 'contact').'photos/'.$object->photo; |
10142
|
10142
|
} |
10143
|
10143
|
} |
10144
|
10144
|
$email = $object->email; |
|
@@ -10148,17 +10148,17 @@ discard block |
|
|
block discarded – undo |
10148
|
10148
|
if (!empty($object->photo)) { |
10149
|
10149
|
if (dolIsAllowedForPreview($object->photo)) { |
10150
|
10150
|
if ((string) $imagesize == 'mini') { |
10151
|
|
- $file = get_exdir(0, 0, 0, 0, $object, 'user') . 'photos/' . getImageFileNameForSize($object->photo, '_mini'); |
|
10151
|
+ $file = get_exdir(0, 0, 0, 0, $object, 'user').'photos/'.getImageFileNameForSize($object->photo, '_mini'); |
10152
|
10152
|
} elseif ((string) $imagesize == 'small') { |
10153
|
|
- $file = get_exdir(0, 0, 0, 0, $object, 'user') . 'photos/' . getImageFileNameForSize($object->photo, '_small'); |
|
10153
|
+ $file = get_exdir(0, 0, 0, 0, $object, 'user').'photos/'.getImageFileNameForSize($object->photo, '_small'); |
10154
|
10154
|
} else { |
10155
|
|
- $file = get_exdir(0, 0, 0, 0, $object, 'user') . 'photos/' . $object->photo; |
|
10155
|
+ $file = get_exdir(0, 0, 0, 0, $object, 'user').'photos/'.$object->photo; |
10156
|
10156
|
} |
10157
|
|
- $originalfile = get_exdir(0, 0, 0, 0, $object, 'user') . 'photos/' . $object->photo; |
|
10157
|
+ $originalfile = get_exdir(0, 0, 0, 0, $object, 'user').'photos/'.$object->photo; |
10158
|
10158
|
} |
10159
|
10159
|
} |
10160
|
10160
|
if (getDolGlobalString('MAIN_OLD_IMAGE_LINKS')) { |
10161
|
|
- $altfile = $object->id . ".jpg"; // For backward compatibility |
|
10161
|
+ $altfile = $object->id.".jpg"; // For backward compatibility |
10162
|
10162
|
} |
10163
|
10163
|
$email = $object->email; |
10164
|
10164
|
$capture = 'user'; |
|
@@ -10167,17 +10167,17 @@ discard block |
|
|
block discarded – undo |
10167
|
10167
|
if (!empty($object->photo)) { |
10168
|
10168
|
if (dolIsAllowedForPreview($object->photo)) { |
10169
|
10169
|
if ((string) $imagesize == 'mini') { |
10170
|
|
- $file = get_exdir(0, 0, 0, 0, $object, 'member') . 'photos/' . getImageFileNameForSize($object->photo, '_mini'); |
|
10170
|
+ $file = get_exdir(0, 0, 0, 0, $object, 'member').'photos/'.getImageFileNameForSize($object->photo, '_mini'); |
10171
|
10171
|
} elseif ((string) $imagesize == 'small') { |
10172
|
|
- $file = get_exdir(0, 0, 0, 0, $object, 'member') . 'photos/' . getImageFileNameForSize($object->photo, '_small'); |
|
10172
|
+ $file = get_exdir(0, 0, 0, 0, $object, 'member').'photos/'.getImageFileNameForSize($object->photo, '_small'); |
10173
|
10173
|
} else { |
10174
|
|
- $file = get_exdir(0, 0, 0, 0, $object, 'member') . 'photos/' . $object->photo; |
|
10174
|
+ $file = get_exdir(0, 0, 0, 0, $object, 'member').'photos/'.$object->photo; |
10175
|
10175
|
} |
10176
|
|
- $originalfile = get_exdir(0, 0, 0, 0, $object, 'member') . 'photos/' . $object->photo; |
|
10176
|
+ $originalfile = get_exdir(0, 0, 0, 0, $object, 'member').'photos/'.$object->photo; |
10177
|
10177
|
} |
10178
|
10178
|
} |
10179
|
10179
|
if (getDolGlobalString('MAIN_OLD_IMAGE_LINKS')) { |
10180
|
|
- $altfile = $object->id . ".jpg"; // For backward compatibility |
|
10180
|
+ $altfile = $object->id.".jpg"; // For backward compatibility |
10181
|
10181
|
} |
10182
|
10182
|
$email = $object->email; |
10183
|
10183
|
$capture = 'user'; |
|
@@ -10203,35 +10203,35 @@ discard block |
|
|
block discarded – undo |
10203
|
10203
|
$ret = ''; |
10204
|
10204
|
|
10205
|
10205
|
if ($dir) { |
10206
|
|
- if ($file && file_exists($dir . "/" . $file)) { |
|
10206
|
+ if ($file && file_exists($dir."/".$file)) { |
10207
|
10207
|
if ($addlinktofullsize) { |
10208
|
|
- $urladvanced = getAdvancedPreviewUrl($modulepart, $originalfile, 0, '&entity=' . $entity); |
|
10208
|
+ $urladvanced = getAdvancedPreviewUrl($modulepart, $originalfile, 0, '&entity='.$entity); |
10209
|
10209
|
if ($urladvanced) { |
10210
|
|
- $ret .= '<a href="' . $urladvanced . '">'; |
|
10210
|
+ $ret .= '<a href="'.$urladvanced.'">'; |
10211
|
10211
|
} else { |
10212
|
|
- $ret .= '<a href="' . DOL_URL_ROOT . '/viewimage.php?modulepart=' . $modulepart . '&entity=' . $entity . '&file=' . urlencode($originalfile) . '&cache=' . $cache . '">'; |
|
10212
|
+ $ret .= '<a href="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$entity.'&file='.urlencode($originalfile).'&cache='.$cache.'">'; |
10213
|
10213
|
} |
10214
|
10214
|
} |
10215
|
|
- $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 . '">'; |
|
10215
|
+ $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.'">'; |
10216
|
10216
|
if ($addlinktofullsize) { |
10217
|
10217
|
$ret .= '</a>'; |
10218
|
10218
|
} |
10219
|
|
- } elseif ($altfile && file_exists($dir . "/" . $altfile)) { |
|
10219
|
+ } elseif ($altfile && file_exists($dir."/".$altfile)) { |
10220
|
10220
|
if ($addlinktofullsize) { |
10221
|
|
- $urladvanced = getAdvancedPreviewUrl($modulepart, $originalfile, 0, '&entity=' . $entity); |
|
10221
|
+ $urladvanced = getAdvancedPreviewUrl($modulepart, $originalfile, 0, '&entity='.$entity); |
10222
|
10222
|
if ($urladvanced) { |
10223
|
|
- $ret .= '<a href="' . $urladvanced . '">'; |
|
10223
|
+ $ret .= '<a href="'.$urladvanced.'">'; |
10224
|
10224
|
} else { |
10225
|
|
- $ret .= '<a href="' . DOL_URL_ROOT . '/viewimage.php?modulepart=' . $modulepart . '&entity=' . $entity . '&file=' . urlencode($originalfile) . '&cache=' . $cache . '">'; |
|
10225
|
+ $ret .= '<a href="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$entity.'&file='.urlencode($originalfile).'&cache='.$cache.'">'; |
10226
|
10226
|
} |
10227
|
10227
|
} |
10228
|
|
- $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 . '">'; |
|
10228
|
+ $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.'">'; |
10229
|
10229
|
if ($addlinktofullsize) { |
10230
|
10230
|
$ret .= '</a>'; |
10231
|
10231
|
} |
10232
|
10232
|
} else { |
10233
|
10233
|
$nophoto = '/public/theme/common/nophoto.png'; |
10234
|
|
- $defaultimg = 'identicon'; // For gravatar |
|
10234
|
+ $defaultimg = 'identicon'; // For gravatar |
10235
|
10235
|
if (in_array($modulepart, array('societe', 'userphoto', 'contact', 'memberphoto'))) { // For modules that need a special image when photo not found |
10236
|
10236
|
if ($modulepart == 'societe' || ($modulepart == 'memberphoto' && !empty($object->morphy) && strpos($object->morphy, 'mor') !== false)) { |
10237
|
10237
|
$nophoto = 'company'; |
|
@@ -10249,13 +10249,13 @@ discard block |
|
|
block discarded – undo |
10249
|
10249
|
if (isModEnabled('gravatar') && $email && empty($noexternsourceoverwrite)) { |
10250
|
10250
|
// see https://gravatar.com/site/implement/images/php/ |
10251
|
10251
|
$ret .= '<!-- Put link to gravatar -->'; |
10252
|
|
- $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 |
|
10252
|
+ $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 |
10253
|
10253
|
} else { |
10254
|
10254
|
if ($nophoto == 'company') { |
10255
|
|
- $ret .= '<div class="divforspanimg valignmiddle center photo' . $modulepart . ($cssclass ? ' ' . $cssclass : '') . '" alt="" ' . ($width ? ' width="' . $width . '"' : '') . ($height ? ' height="' . $height . '"' : '') . '>' . img_picto('', 'company') . '</div>'; |
|
10255
|
+ $ret .= '<div class="divforspanimg valignmiddle center photo'.$modulepart.($cssclass ? ' '.$cssclass : '').'" alt="" '.($width ? ' width="'.$width.'"' : '').($height ? ' height="'.$height.'"' : '').'>'.img_picto('', 'company').'</div>'; |
10256
|
10256
|
//$ret .= '<div class="difforspanimgright"></div>'; |
10257
|
10257
|
} else { |
10258
|
|
- $ret .= '<img class="photo' . $modulepart . ($cssclass ? ' ' . $cssclass : '') . '" alt="" ' . ($width ? ' width="' . $width . '"' : '') . ($height ? ' height="' . $height . '"' : '') . ' src="' . DOL_URL_ROOT . $nophoto . '">'; |
|
10258
|
+ $ret .= '<img class="photo'.$modulepart.($cssclass ? ' '.$cssclass : '').'" alt="" '.($width ? ' width="'.$width.'"' : '').($height ? ' height="'.$height.'"' : '').' src="'.DOL_URL_ROOT.$nophoto.'">'; |
10259
|
10259
|
} |
10260
|
10260
|
} |
10261
|
10261
|
} |
|
@@ -10266,15 +10266,15 @@ discard block |
|
|
block discarded – undo |
10266
|
10266
|
} |
10267
|
10267
|
$ret .= '<table class="nobordernopadding centpercent">'; |
10268
|
10268
|
if ($object->photo) { |
10269
|
|
- $ret .= '<tr><td><input type="checkbox" class="flat photodelete" name="deletephoto" id="photodelete"> <label for="photodelete">' . $langs->trans("Delete") . '</label><br><br></td></tr>'; |
|
10269
|
+ $ret .= '<tr><td><input type="checkbox" class="flat photodelete" name="deletephoto" id="photodelete"> <label for="photodelete">'.$langs->trans("Delete").'</label><br><br></td></tr>'; |
10270
|
10270
|
} |
10271
|
10271
|
$ret .= '<tr><td class="tdoverflow">'; |
10272
|
10272
|
$maxfilesizearray = getMaxFileSizeArray(); |
10273
|
10273
|
$maxmin = $maxfilesizearray['maxmin']; |
10274
|
10274
|
if ($maxmin > 0) { |
10275
|
|
- $ret .= '<input type="hidden" name="MAX_FILE_SIZE" value="' . ($maxmin * 1024) . '">'; // MAX_FILE_SIZE must precede the field type=file |
|
10275
|
+ $ret .= '<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).'">'; // MAX_FILE_SIZE must precede the field type=file |
10276
|
10276
|
} |
10277
|
|
- $ret .= '<input type="file" class="flat maxwidth200onsmartphone" name="photo" id="photoinput" accept="image/*"' . ($capture ? ' capture="' . $capture . '"' : '') . '>'; |
|
10277
|
+ $ret .= '<input type="file" class="flat maxwidth200onsmartphone" name="photo" id="photoinput" accept="image/*"'.($capture ? ' capture="'.$capture.'"' : '').'>'; |
10278
|
10278
|
$ret .= '</td></tr>'; |
10279
|
10279
|
$ret .= '</table>'; |
10280
|
10280
|
} |
|
@@ -10328,38 +10328,38 @@ discard block |
|
|
block discarded – undo |
10328
|
10328
|
if (isModEnabled('multicompany') && $conf->entity == 1 && $user->admin && !$user->entity) { |
10329
|
10329
|
$sql .= ", e.label"; |
10330
|
10330
|
} |
10331
|
|
- $sql .= " FROM " . $this->db->prefix() . "usergroup as ug "; |
|
10331
|
+ $sql .= " FROM ".$this->db->prefix()."usergroup as ug "; |
10332
|
10332
|
if (isModEnabled('multicompany') && $conf->entity == 1 && $user->admin && !$user->entity) { |
10333
|
|
- $sql .= " LEFT JOIN " . $this->db->prefix() . "entity as e ON e.rowid=ug.entity"; |
|
10333
|
+ $sql .= " LEFT JOIN ".$this->db->prefix()."entity as e ON e.rowid=ug.entity"; |
10334
|
10334
|
if ($force_entity) { |
10335
|
|
- $sql .= " WHERE ug.entity IN (0, " . $force_entity . ")"; |
|
10335
|
+ $sql .= " WHERE ug.entity IN (0, ".$force_entity.")"; |
10336
|
10336
|
} else { |
10337
|
10337
|
$sql .= " WHERE ug.entity IS NOT NULL"; |
10338
|
10338
|
} |
10339
|
10339
|
} else { |
10340
|
|
- $sql .= " WHERE ug.entity IN (0, " . $conf->entity . ")"; |
|
10340
|
+ $sql .= " WHERE ug.entity IN (0, ".$conf->entity.")"; |
10341
|
10341
|
} |
10342
|
10342
|
if (is_array($exclude) && $excludeGroups) { |
10343
|
|
- $sql .= " AND ug.rowid NOT IN (" . $this->db->sanitize($excludeGroups) . ")"; |
|
10343
|
+ $sql .= " AND ug.rowid NOT IN (".$this->db->sanitize($excludeGroups).")"; |
10344
|
10344
|
} |
10345
|
10345
|
if (is_array($include) && $includeGroups) { |
10346
|
|
- $sql .= " AND ug.rowid IN (" . $this->db->sanitize($includeGroups) . ")"; |
|
10346
|
+ $sql .= " AND ug.rowid IN (".$this->db->sanitize($includeGroups).")"; |
10347
|
10347
|
} |
10348
|
10348
|
$sql .= " ORDER BY ug.nom ASC"; |
10349
|
10349
|
|
10350
|
|
- dol_syslog(get_class($this) . "::select_dolgroups", LOG_DEBUG); |
|
10350
|
+ dol_syslog(get_class($this)."::select_dolgroups", LOG_DEBUG); |
10351
|
10351
|
$resql = $this->db->query($sql); |
10352
|
10352
|
if ($resql) { |
10353
|
10353
|
// Enhance with select2 |
10354
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
10354
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
10355
|
10355
|
|
10356
|
|
- $out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" id="' . $htmlname . '" name="' . $htmlname . ($multiple ? '[]' : '') . '" ' . ($multiple ? 'multiple' : '') . ' ' . ($disabled ? ' disabled' : '') . '>'; |
|
10356
|
+ $out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" id="'.$htmlname.'" name="'.$htmlname.($multiple ? '[]' : '').'" '.($multiple ? 'multiple' : '').' '.($disabled ? ' disabled' : '').'>'; |
10357
|
10357
|
|
10358
|
10358
|
$num = $this->db->num_rows($resql); |
10359
|
10359
|
$i = 0; |
10360
|
10360
|
if ($num) { |
10361
|
10361
|
if ($show_empty && !$multiple) { |
10362
|
|
- $out .= '<option value="-1"' . (in_array(-1, $selected) ? ' selected' : '') . '> </option>' . "\n"; |
|
10362
|
+ $out .= '<option value="-1"'.(in_array(-1, $selected) ? ' selected' : '').'> </option>'."\n"; |
10363
|
10363
|
} |
10364
|
10364
|
|
10365
|
10365
|
while ($i < $num) { |
|
@@ -10372,11 +10372,11 @@ discard block |
|
|
block discarded – undo |
10372
|
10372
|
$label = $obj->name; |
10373
|
10373
|
$labelhtml = $obj->name; |
10374
|
10374
|
if (isModEnabled('multicompany') && !getDolGlobalInt('MULTICOMPANY_TRANSVERSE_MODE') && $conf->entity == 1) { |
10375
|
|
- $label .= " (" . $obj->label . ")"; |
10376
|
|
- $labelhtml .= ' <span class="opacitymedium">(' . $obj->label . ')</span>'; |
|
10375
|
+ $label .= " (".$obj->label.")"; |
|
10376
|
+ $labelhtml .= ' <span class="opacitymedium">('.$obj->label.')</span>'; |
10377
|
10377
|
} |
10378
|
10378
|
|
10379
|
|
- $out .= '<option value="' . $obj->rowid . '"'; |
|
10379
|
+ $out .= '<option value="'.$obj->rowid.'"'; |
10380
|
10380
|
if ($disableline) { |
10381
|
10381
|
$out .= ' disabled'; |
10382
|
10382
|
} |
|
@@ -10392,9 +10392,9 @@ discard block |
|
|
block discarded – undo |
10392
|
10392
|
} |
10393
|
10393
|
} else { |
10394
|
10394
|
if ($show_empty) { |
10395
|
|
- $out .= '<option value="-1"' . (in_array(-1, $selected) ? ' selected' : '') . '></option>' . "\n"; |
|
10395
|
+ $out .= '<option value="-1"'.(in_array(-1, $selected) ? ' selected' : '').'></option>'."\n"; |
10396
|
10396
|
} |
10397
|
|
- $out .= '<option value="" disabled>' . $langs->trans("NoUserGroupDefined") . '</option>'; |
|
10397
|
+ $out .= '<option value="" disabled>'.$langs->trans("NoUserGroupDefined").'</option>'; |
10398
|
10398
|
} |
10399
|
10399
|
$out .= '</select>'; |
10400
|
10400
|
|
|
@@ -10438,25 +10438,25 @@ discard block |
|
|
block discarded – undo |
10438
|
10438
|
$out = ''; |
10439
|
10439
|
|
10440
|
10440
|
if (!empty($conf->use_javascript_ajax)) { |
10441
|
|
- $out .= '<div class="inline-block checkallactions"><input type="checkbox" id="' . $cssclass . 's" name="' . $cssclass . 's" class="checkallactions"></div>'; |
|
10441
|
+ $out .= '<div class="inline-block checkallactions"><input type="checkbox" id="'.$cssclass.'s" name="'.$cssclass.'s" class="checkallactions"></div>'; |
10442
|
10442
|
} |
10443
|
|
- $out .= '<script nonce="' . getNonce() . '"> |
|
10443
|
+ $out .= '<script nonce="'.getNonce().'"> |
10444
|
10444
|
$(document).ready(function() { |
10445
|
|
- $("#' . $cssclass . 's").click(function() { |
|
10445
|
+ $("#' . $cssclass.'s").click(function() { |
10446
|
10446
|
if($(this).is(\':checked\')){ |
10447
|
|
- console.log("We check all ' . $cssclass . ' and trigger the change method"); |
10448
|
|
- $(".' . $cssclass . '").prop(\'checked\', true).trigger(\'change\'); |
|
10447
|
+ console.log("We check all ' . $cssclass.' and trigger the change method"); |
|
10448
|
+ $(".' . $cssclass.'").prop(\'checked\', true).trigger(\'change\'); |
10449
|
10449
|
} |
10450
|
10450
|
else |
10451
|
10451
|
{ |
10452
|
10452
|
console.log("We uncheck all"); |
10453
|
|
- $(".' . $cssclass . '").prop(\'checked\', false).trigger(\'change\'); |
|
10453
|
+ $(".' . $cssclass.'").prop(\'checked\', false).trigger(\'change\'); |
10454
|
10454
|
}' . "\n"; |
10455
|
10455
|
if ($calljsfunction) { |
10456
|
|
- $out .= 'if (typeof initCheckForSelect == \'function\') { initCheckForSelect(0, "' . $massactionname . '", "' . $cssclass . '"); } else { console.log("No function initCheckForSelect found. Call won\'t be done."); }'; |
|
10456
|
+ $out .= 'if (typeof initCheckForSelect == \'function\') { initCheckForSelect(0, "'.$massactionname.'", "'.$cssclass.'"); } else { console.log("No function initCheckForSelect found. Call won\'t be done."); }'; |
10457
|
10457
|
} |
10458
|
10458
|
$out .= ' }); |
10459
|
|
- $(".' . $cssclass . '").change(function() { |
|
10459
|
+ $(".' . $cssclass.'").change(function() { |
10460
|
10460
|
$(this).closest("tr").toggleClass("highlight", this.checked); |
10461
|
10461
|
}); |
10462
|
10462
|
}); |
|
@@ -10501,67 +10501,67 @@ discard block |
|
|
block discarded – undo |
10501
|
10501
|
global $langs, $user; |
10502
|
10502
|
|
10503
|
10503
|
$out = ''; |
10504
|
|
- $sql = "SELECT rowid, label FROM " . $this->db->prefix() . "c_exp_tax_cat WHERE active = 1"; |
10505
|
|
- $sql .= " AND entity IN (0," . getEntity('exp_tax_cat') . ")"; |
|
10504
|
+ $sql = "SELECT rowid, label FROM ".$this->db->prefix()."c_exp_tax_cat WHERE active = 1"; |
|
10505
|
+ $sql .= " AND entity IN (0,".getEntity('exp_tax_cat').")"; |
10506
|
10506
|
if (!empty($excludeid)) { |
10507
|
|
- $sql .= " AND rowid NOT IN (" . $this->db->sanitize(implode(',', $excludeid)) . ")"; |
|
10507
|
+ $sql .= " AND rowid NOT IN (".$this->db->sanitize(implode(',', $excludeid)).")"; |
10508
|
10508
|
} |
10509
|
10509
|
$sql .= " ORDER BY label"; |
10510
|
10510
|
|
10511
|
10511
|
$resql = $this->db->query($sql); |
10512
|
10512
|
if ($resql) { |
10513
|
|
- $out = '<select id="select_' . $htmlname . '" name="' . $htmlname . '" class="' . $htmlname . ' flat minwidth75imp maxwidth200">'; |
|
10513
|
+ $out = '<select id="select_'.$htmlname.'" name="'.$htmlname.'" class="'.$htmlname.' flat minwidth75imp maxwidth200">'; |
10514
|
10514
|
if ($useempty) { |
10515
|
10515
|
$out .= '<option value="0"> </option>'; |
10516
|
10516
|
} |
10517
|
10517
|
|
10518
|
10518
|
while ($obj = $this->db->fetch_object($resql)) { |
10519
|
|
- $out .= '<option ' . ($selected == $obj->rowid ? 'selected="selected"' : '') . ' value="' . $obj->rowid . '">' . $langs->trans($obj->label) . '</option>'; |
|
10519
|
+ $out .= '<option '.($selected == $obj->rowid ? 'selected="selected"' : '').' value="'.$obj->rowid.'">'.$langs->trans($obj->label).'</option>'; |
10520
|
10520
|
} |
10521
|
10521
|
$out .= '</select>'; |
10522
|
|
- $out .= ajax_combobox('select_' . $htmlname); |
|
10522
|
+ $out .= ajax_combobox('select_'.$htmlname); |
10523
|
10523
|
|
10524
|
10524
|
if (!empty($htmlname) && $user->admin && $info_admin) { |
10525
|
|
- $out .= ' ' . info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); |
|
10525
|
+ $out .= ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); |
10526
|
10526
|
} |
10527
|
10527
|
|
10528
|
10528
|
if (!empty($target)) { |
10529
|
|
- $sql = "SELECT c.id FROM " . $this->db->prefix() . "c_type_fees as c WHERE c.code = 'EX_KME' AND c.active = 1"; |
|
10529
|
+ $sql = "SELECT c.id FROM ".$this->db->prefix()."c_type_fees as c WHERE c.code = 'EX_KME' AND c.active = 1"; |
10530
|
10530
|
$resql = $this->db->query($sql); |
10531
|
10531
|
if ($resql) { |
10532
|
10532
|
if ($this->db->num_rows($resql) > 0) { |
10533
|
10533
|
$obj = $this->db->fetch_object($resql); |
10534
|
|
- $out .= '<script nonce="' . getNonce() . '"> |
|
10534
|
+ $out .= '<script nonce="'.getNonce().'"> |
10535
|
10535
|
$(function() { |
10536
|
|
- $("select[name=' . $target . ']").on("change", function() { |
|
10536
|
+ $("select[name=' . $target.']").on("change", function() { |
10537
|
10537
|
var current_val = $(this).val(); |
10538
|
|
- if (current_val == ' . $obj->id . ') {'; |
|
10538
|
+ if (current_val == ' . $obj->id.') {'; |
10539
|
10539
|
if (!empty($default_selected) || !empty($selected)) { |
10540
|
|
- $out .= '$("select[name=' . $htmlname . ']").val("' . ($default_selected > 0 ? $default_selected : $selected) . '");'; |
|
10540
|
+ $out .= '$("select[name='.$htmlname.']").val("'.($default_selected > 0 ? $default_selected : $selected).'");'; |
10541
|
10541
|
} |
10542
|
10542
|
|
10543
|
10543
|
$out .= ' |
10544
|
|
- $("select[name=' . $htmlname . ']").change(); |
|
10544
|
+ $("select[name=' . $htmlname.']").change(); |
10545
|
10545
|
} |
10546
|
10546
|
}); |
10547
|
10547
|
|
10548
|
|
- $("select[name=' . $htmlname . ']").change(function() { |
|
10548
|
+ $("select[name=' . $htmlname.']").change(function() { |
10549
|
10549
|
|
10550
|
|
- if ($("select[name=' . $target . ']").val() == ' . $obj->id . ') { |
|
10550
|
+ if ($("select[name=' . $target.']").val() == '.$obj->id.') { |
10551
|
10551
|
// get price of kilometer to fill the unit price |
10552
|
10552
|
$.ajax({ |
10553
|
10553
|
method: "POST", |
10554
|
10554
|
dataType: "json", |
10555
|
|
- data: { fk_c_exp_tax_cat: $(this).val(), token: \'' . currentToken() . '\' }, |
10556
|
|
- url: "' . (DOL_URL_ROOT . '/expensereport/ajax/ajaxik.php?' . implode('&', $params)) . '", |
|
10555
|
+ data: { fk_c_exp_tax_cat: $(this).val(), token: \'' . currentToken().'\' }, |
|
10556
|
+ url: "' . (DOL_URL_ROOT.'/expensereport/ajax/ajaxik.php?'.implode('&', $params)).'", |
10557
|
10557
|
}).done(function( data, textStatus, jqXHR ) { |
10558
|
10558
|
console.log(data); |
10559
|
10559
|
if (typeof data.up != "undefined") { |
10560
|
10560
|
$("input[name=value_unit]").val(data.up); |
10561
|
|
- $("select[name=' . $htmlname . ']").attr("title", data.title); |
|
10561
|
+ $("select[name=' . $htmlname.']").attr("title", data.title); |
10562
|
10562
|
} else { |
10563
|
10563
|
$("input[name=value_unit]").val(""); |
10564
|
|
- $("select[name=' . $htmlname . ']").attr("title", ""); |
|
10564
|
+ $("select[name=' . $htmlname.']").attr("title", ""); |
10565
|
10565
|
} |
10566
|
10566
|
}); |
10567
|
10567
|
} |
|
@@ -10591,18 +10591,18 @@ discard block |
|
|
block discarded – undo |
10591
|
10591
|
global $conf, $langs; |
10592
|
10592
|
|
10593
|
10593
|
$out = ''; |
10594
|
|
- $sql = "SELECT rowid, range_ik FROM " . $this->db->prefix() . "c_exp_tax_range"; |
10595
|
|
- $sql .= " WHERE entity = " . $conf->entity . " AND active = 1"; |
|
10594
|
+ $sql = "SELECT rowid, range_ik FROM ".$this->db->prefix()."c_exp_tax_range"; |
|
10595
|
+ $sql .= " WHERE entity = ".$conf->entity." AND active = 1"; |
10596
|
10596
|
|
10597
|
10597
|
$resql = $this->db->query($sql); |
10598
|
10598
|
if ($resql) { |
10599
|
|
- $out = '<select id="select_' . $htmlname . '" name="' . $htmlname . '" class="' . $htmlname . ' flat minwidth75imp">'; |
|
10599
|
+ $out = '<select id="select_'.$htmlname.'" name="'.$htmlname.'" class="'.$htmlname.' flat minwidth75imp">'; |
10600
|
10600
|
if ($useempty) { |
10601
|
10601
|
$out .= '<option value="0"></option>'; |
10602
|
10602
|
} |
10603
|
10603
|
|
10604
|
10604
|
while ($obj = $this->db->fetch_object($resql)) { |
10605
|
|
- $out .= '<option ' . ($selected == $obj->rowid ? 'selected="selected"' : '') . ' value="' . $obj->rowid . '">' . price($obj->range_ik, 0, $langs, 1, 0) . '</option>'; |
|
10605
|
+ $out .= '<option '.($selected == $obj->rowid ? 'selected="selected"' : '').' value="'.$obj->rowid.'">'.price($obj->range_ik, 0, $langs, 1, 0).'</option>'; |
10606
|
10606
|
} |
10607
|
10607
|
$out .= '</select>'; |
10608
|
10608
|
} else { |
|
@@ -10633,12 +10633,12 @@ discard block |
|
|
block discarded – undo |
10633
|
10633
|
|
10634
|
10634
|
$resql = $this->db->query($sql); |
10635
|
10635
|
if ($resql) { |
10636
|
|
- $out = '<select id="select_' . $htmlname . '" name="' . $htmlname . '" class="' . $htmlname . ' flat minwidth75imp">'; |
|
10636
|
+ $out = '<select id="select_'.$htmlname.'" name="'.$htmlname.'" class="'.$htmlname.' flat minwidth75imp">'; |
10637
|
10637
|
if ($useempty) { |
10638
|
10638
|
$out .= '<option value="0"></option>'; |
10639
|
10639
|
} |
10640
|
10640
|
if ($allchoice) { |
10641
|
|
- $out .= '<option value="-1">' . $langs->trans('AllExpenseReport') . '</option>'; |
|
10641
|
+ $out .= '<option value="-1">'.$langs->trans('AllExpenseReport').'</option>'; |
10642
|
10642
|
} |
10643
|
10643
|
|
10644
|
10644
|
$field = 'code'; |
|
@@ -10648,7 +10648,7 @@ discard block |
|
|
block discarded – undo |
10648
|
10648
|
|
10649
|
10649
|
while ($obj = $this->db->fetch_object($resql)) { |
10650
|
10650
|
$key = $langs->trans($obj->code); |
10651
|
|
- $out .= '<option ' . ($selected == $obj->{$field} ? 'selected="selected"' : '') . ' value="' . $obj->{$field} . '">' . ($key != $obj->code ? $key : $obj->label) . '</option>'; |
|
10651
|
+ $out .= '<option '.($selected == $obj->{$field} ? 'selected="selected"' : '').' value="'.$obj->{$field}.'">'.($key != $obj->code ? $key : $obj->label).'</option>'; |
10652
|
10652
|
} |
10653
|
10653
|
$out .= '</select>'; |
10654
|
10654
|
|
|
@@ -10682,7 +10682,7 @@ discard block |
|
|
block discarded – undo |
10682
|
10682
|
{ |
10683
|
10683
|
global $user, $conf, $langs; |
10684
|
10684
|
|
10685
|
|
- require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; |
|
10685
|
+ require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; |
10686
|
10686
|
|
10687
|
10687
|
if (is_null($usertofilter)) { |
10688
|
10688
|
$usertofilter = $user; |
|
@@ -10706,10 +10706,10 @@ discard block |
|
|
block discarded – undo |
10706
|
10706
|
$sql = "SELECT f.rowid, f.ref as fref, 'nolabel' as flabel, p.rowid as pid, f.ref, |
10707
|
10707
|
p.title, p.fk_soc, p.fk_statut, p.public,"; |
10708
|
10708
|
$sql .= ' s.nom as name'; |
10709
|
|
- $sql .= ' FROM ' . $this->db->prefix() . 'projet as p'; |
10710
|
|
- $sql .= ' LEFT JOIN ' . $this->db->prefix() . 'societe as s ON s.rowid = p.fk_soc,'; |
10711
|
|
- $sql .= ' ' . $this->db->prefix() . 'facture as f'; |
10712
|
|
- $sql .= " WHERE p.entity IN (" . getEntity('project') . ")"; |
|
10709
|
+ $sql .= ' FROM '.$this->db->prefix().'projet as p'; |
|
10710
|
+ $sql .= ' LEFT JOIN '.$this->db->prefix().'societe as s ON s.rowid = p.fk_soc,'; |
|
10711
|
+ $sql .= ' '.$this->db->prefix().'facture as f'; |
|
10712
|
+ $sql .= " WHERE p.entity IN (".getEntity('project').")"; |
10713
|
10713
|
$sql .= " AND f.fk_projet = p.rowid AND f.fk_statut=0"; //Brouillons seulement |
10714
|
10714
|
//if ($projectsListId) $sql.= " AND p.rowid IN (".$this->db->sanitize($projectsListId).")"; |
10715
|
10715
|
//if ($socid == 0) $sql.= " AND (p.fk_soc=0 OR p.fk_soc IS NULL)"; |
|
@@ -10720,14 +10720,14 @@ discard block |
|
|
block discarded – undo |
10720
|
10720
|
if ($resql) { |
10721
|
10721
|
// Use select2 selector |
10722
|
10722
|
if (!empty($conf->use_javascript_ajax)) { |
10723
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
10723
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
10724
|
10724
|
$comboenhancement = ajax_combobox($htmlname, array(), 0, $forcefocus); |
10725
|
10725
|
$out .= $comboenhancement; |
10726
|
10726
|
$morecss = 'minwidth200imp maxwidth500'; |
10727
|
10727
|
} |
10728
|
10728
|
|
10729
|
10729
|
if (empty($option_only)) { |
10730
|
|
- $out .= '<select class="valignmiddle flat' . ($morecss ? ' ' . $morecss : '') . '"' . ($disabled ? ' disabled="disabled"' : '') . ' id="' . $htmlname . '" name="' . $htmlname . '">'; |
|
10730
|
+ $out .= '<select class="valignmiddle flat'.($morecss ? ' '.$morecss : '').'"'.($disabled ? ' disabled="disabled"' : '').' id="'.$htmlname.'" name="'.$htmlname.'">'; |
10731
|
10731
|
} |
10732
|
10732
|
if (!empty($show_empty)) { |
10733
|
10733
|
$out .= '<option value="0" class="optiongrey">'; |
|
@@ -10757,33 +10757,33 @@ discard block |
|
|
block discarded – undo |
10757
|
10757
|
if ($showproject == 'all') { |
10758
|
10758
|
$labeltoshow .= dol_trunc($obj->ref, 18); // Invoice ref |
10759
|
10759
|
if ($obj->name) { |
10760
|
|
- $labeltoshow .= ' - ' . $obj->name; // Soc name |
|
10760
|
+ $labeltoshow .= ' - '.$obj->name; // Soc name |
10761
|
10761
|
} |
10762
|
10762
|
|
10763
|
10763
|
$disabled = 0; |
10764
|
10764
|
if ($obj->fk_statut == Project::STATUS_DRAFT) { |
10765
|
10765
|
$disabled = 1; |
10766
|
|
- $labeltoshow .= ' - ' . $langs->trans("Draft"); |
|
10766
|
+ $labeltoshow .= ' - '.$langs->trans("Draft"); |
10767
|
10767
|
} elseif ($obj->fk_statut == Project::STATUS_CLOSED) { |
10768
|
10768
|
if ($discard_closed == 2) { |
10769
|
10769
|
$disabled = 1; |
10770
|
10770
|
} |
10771
|
|
- $labeltoshow .= ' - ' . $langs->trans("Closed"); |
|
10771
|
+ $labeltoshow .= ' - '.$langs->trans("Closed"); |
10772
|
10772
|
} elseif ($socid > 0 && (!empty($obj->fk_soc) && $obj->fk_soc != $socid)) { |
10773
|
10773
|
$disabled = 1; |
10774
|
|
- $labeltoshow .= ' - ' . $langs->trans("LinkedToAnotherCompany"); |
|
10774
|
+ $labeltoshow .= ' - '.$langs->trans("LinkedToAnotherCompany"); |
10775
|
10775
|
} |
10776
|
10776
|
} |
10777
|
10777
|
|
10778
|
10778
|
if (!empty($selected) && $selected == $obj->rowid) { |
10779
|
|
- $out .= '<option value="' . $obj->rowid . '" selected'; |
|
10779
|
+ $out .= '<option value="'.$obj->rowid.'" selected'; |
10780
|
10780
|
//if ($disabled) $out.=' disabled'; // with select2, field can't be preselected if disabled |
10781
|
|
- $out .= '>' . $labeltoshow . '</option>'; |
|
10781
|
+ $out .= '>'.$labeltoshow.'</option>'; |
10782
|
10782
|
} else { |
10783
|
10783
|
if ($hideunselectables && $disabled && ($selected != $obj->rowid)) { |
10784
|
10784
|
$resultat = ''; |
10785
|
10785
|
} else { |
10786
|
|
- $resultat = '<option value="' . $obj->rowid . '"'; |
|
10786
|
+ $resultat = '<option value="'.$obj->rowid.'"'; |
10787
|
10787
|
if ($disabled) { |
10788
|
10788
|
$resultat .= ' disabled'; |
10789
|
10789
|
} |
|
@@ -10835,22 +10835,22 @@ discard block |
|
|
block discarded – undo |
10835
|
10835
|
|
10836
|
10836
|
$sql = 'SELECT f.rowid, f.entity, f.titre as title, f.suspended, f.fk_soc'; |
10837
|
10837
|
//$sql.= ', el.fk_source'; |
10838
|
|
- $sql .= ' FROM ' . MAIN_DB_PREFIX . 'facture_rec as f'; |
10839
|
|
- $sql .= " WHERE f.entity IN (" . getEntity('invoice') . ")"; |
|
10838
|
+ $sql .= ' FROM '.MAIN_DB_PREFIX.'facture_rec as f'; |
|
10839
|
+ $sql .= " WHERE f.entity IN (".getEntity('invoice').")"; |
10840
|
10840
|
$sql .= " ORDER BY f.titre ASC"; |
10841
|
10841
|
|
10842
|
10842
|
$resql = $this->db->query($sql); |
10843
|
10843
|
if ($resql) { |
10844
|
10844
|
// Use select2 selector |
10845
|
10845
|
if (!empty($conf->use_javascript_ajax)) { |
10846
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
10846
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
10847
|
10847
|
$comboenhancement = ajax_combobox($htmlname, array(), 0, $forcefocus); |
10848
|
10848
|
$out .= $comboenhancement; |
10849
|
10849
|
$morecss = 'minwidth200imp maxwidth500'; |
10850
|
10850
|
} |
10851
|
10851
|
|
10852
|
10852
|
if (empty($option_only)) { |
10853
|
|
- $out .= '<select class="valignmiddle flat' . ($morecss ? ' ' . $morecss : '') . '"' . ($disabled ? ' disabled="disabled"' : '') . ' id="' . $htmlname . '" name="' . $htmlname . '">'; |
|
10853
|
+ $out .= '<select class="valignmiddle flat'.($morecss ? ' '.$morecss : '').'"'.($disabled ? ' disabled="disabled"' : '').' id="'.$htmlname.'" name="'.$htmlname.'">'; |
10854
|
10854
|
} |
10855
|
10855
|
if (!empty($show_empty)) { |
10856
|
10856
|
$out .= '<option value="0" class="optiongrey">'; |
|
@@ -10869,19 +10869,19 @@ discard block |
|
|
block discarded – undo |
10869
|
10869
|
$disabled = 0; |
10870
|
10870
|
if (!empty($obj->suspended)) { |
10871
|
10871
|
$disabled = 1; |
10872
|
|
- $labeltoshow .= ' - ' . $langs->trans("Closed"); |
|
10872
|
+ $labeltoshow .= ' - '.$langs->trans("Closed"); |
10873
|
10873
|
} |
10874
|
10874
|
|
10875
|
10875
|
|
10876
|
10876
|
if (!empty($selected) && $selected == $obj->rowid) { |
10877
|
|
- $out .= '<option value="' . $obj->rowid . '" selected'; |
|
10877
|
+ $out .= '<option value="'.$obj->rowid.'" selected'; |
10878
|
10878
|
//if ($disabled) $out.=' disabled'; // with select2, field can't be preselected if disabled |
10879
|
|
- $out .= '>' . $labeltoshow . '</option>'; |
|
10879
|
+ $out .= '>'.$labeltoshow.'</option>'; |
10880
|
10880
|
} else { |
10881
|
10881
|
if ($disabled && ($selected != $obj->rowid)) { |
10882
|
10882
|
$resultat = ''; |
10883
|
10883
|
} else { |
10884
|
|
- $resultat = '<option value="' . $obj->rowid . '"'; |
|
10884
|
+ $resultat = '<option value="'.$obj->rowid.'"'; |
10885
|
10885
|
if ($disabled) { |
10886
|
10886
|
$resultat .= ' disabled'; |
10887
|
10887
|
} |
|
@@ -10921,14 +10921,14 @@ discard block |
|
|
block discarded – undo |
10921
|
10921
|
global $langs; |
10922
|
10922
|
|
10923
|
10923
|
if ($search_component_params_hidden != '' && !preg_match('/^\(.*\)$/', $search_component_params_hidden)) { // If $search_component_params_hidden does not start and end with () |
10924
|
|
- $search_component_params_hidden = '(' . $search_component_params_hidden . ')'; |
|
10924
|
+ $search_component_params_hidden = '('.$search_component_params_hidden.')'; |
10925
|
10925
|
} |
10926
|
10926
|
|
10927
|
10927
|
$ret = ''; |
10928
|
10928
|
|
10929
|
10929
|
$ret .= '<div class="divadvancedsearchfieldcomp centpercent inline-block">'; |
10930
|
10930
|
$ret .= '<a href="#" class="dropdownsearch-toggle unsetcolor">'; |
10931
|
|
- $ret .= '<span class="fas fa-filter linkobject boxfilter paddingright pictofixedwidth" title="' . dol_escape_htmltag($langs->trans("Filters")) . '" id="idsubimgproductdistribution"></span>'; |
|
10931
|
+ $ret .= '<span class="fas fa-filter linkobject boxfilter paddingright pictofixedwidth" title="'.dol_escape_htmltag($langs->trans("Filters")).'" id="idsubimgproductdistribution"></span>'; |
10932
|
10932
|
$ret .= '</a>'; |
10933
|
10933
|
|
10934
|
10934
|
$ret .= '<div class="divadvancedsearchfieldcompinput inline-block minwidth500 maxwidth300onsmartphone">'; |
|
@@ -10972,29 +10972,29 @@ discard block |
|
|
block discarded – undo |
10972
|
10972
|
$ret .= '<input type="hidden" name="show_search_component_params_hidden" value="1">'; |
10973
|
10973
|
} |
10974
|
10974
|
$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%')) -->"; |
10975
|
|
- $ret .= '<input type="hidden" id="search_component_params_hidden" name="search_component_params_hidden" value="' . dol_escape_htmltag($search_component_params_hidden) . '">'; |
|
10975
|
+ $ret .= '<input type="hidden" id="search_component_params_hidden" name="search_component_params_hidden" value="'.dol_escape_htmltag($search_component_params_hidden).'">'; |
10976
|
10976
|
// $ret .= "<!-- sql= ".forgeSQLFromUniversalSearchCriteria($search_component_params_hidden, $errormessage)." -->"; |
10977
|
10977
|
|
10978
|
10978
|
// For compatibility with forms that show themself the search criteria in addition of this component, we output these fields |
10979
|
10979
|
foreach ($arrayofcriterias as $criteria) { |
10980
|
10980
|
foreach ($criteria as $criteriafamilykey => $criteriafamilyval) { |
10981
|
|
- if (in_array('search_' . $criteriafamilykey, $arrayofinputfieldsalreadyoutput)) { |
|
10981
|
+ if (in_array('search_'.$criteriafamilykey, $arrayofinputfieldsalreadyoutput)) { |
10982
|
10982
|
continue; |
10983
|
10983
|
} |
10984
|
10984
|
if (in_array($criteriafamilykey, array('rowid', 'ref_ext', 'entity', 'extraparams'))) { |
10985
|
10985
|
continue; |
10986
|
10986
|
} |
10987
|
10987
|
if (in_array($criteriafamilyval['type'], array('date', 'datetime', 'timestamp'))) { |
10988
|
|
- $ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_start">'; |
10989
|
|
- $ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_startyear">'; |
10990
|
|
- $ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_startmonth">'; |
10991
|
|
- $ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_startday">'; |
10992
|
|
- $ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_end">'; |
10993
|
|
- $ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_endyear">'; |
10994
|
|
- $ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_endmonth">'; |
10995
|
|
- $ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_endday">'; |
|
10988
|
+ $ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_start">'; |
|
10989
|
+ $ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_startyear">'; |
|
10990
|
+ $ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_startmonth">'; |
|
10991
|
+ $ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_startday">'; |
|
10992
|
+ $ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_end">'; |
|
10993
|
+ $ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_endyear">'; |
|
10994
|
+ $ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_endmonth">'; |
|
10995
|
+ $ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_endday">'; |
10996
|
10996
|
} else { |
10997
|
|
- $ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '">'; |
|
10997
|
+ $ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'">'; |
10998
|
10998
|
} |
10999
|
10999
|
} |
11000
|
11000
|
} |
|
@@ -11002,7 +11002,7 @@ discard block |
|
|
block discarded – undo |
11002
|
11002
|
$ret .= '</div>'; |
11003
|
11003
|
|
11004
|
11004
|
$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"; |
11005
|
|
- $ret .= '<input type="text" placeholder="' . $langs->trans("Filters") . '" id="search_component_params_input" name="search_component_params_input" class="noborderbottom search_component_input" value="">'; |
|
11005
|
+ $ret .= '<input type="text" placeholder="'.$langs->trans("Filters").'" id="search_component_params_input" name="search_component_params_input" class="noborderbottom search_component_input" value="">'; |
11006
|
11006
|
|
11007
|
11007
|
$ret .= '</div>'; |
11008
|
11008
|
$ret .= '</div>'; |
|
@@ -11076,7 +11076,7 @@ discard block |
|
|
block discarded – undo |
11076
|
11076
|
|
11077
|
11077
|
$TModels = array(); |
11078
|
11078
|
|
11079
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php'; |
|
11079
|
+ include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; |
11080
|
11080
|
$formmail = new FormMail($this->db); |
11081
|
11081
|
$result = $formmail->fetchAllEMailTemplate($modelType, $user, $langs); |
11082
|
11082
|
|
|
@@ -11089,17 +11089,17 @@ discard block |
|
|
block discarded – undo |
11089
|
11089
|
} |
11090
|
11090
|
} |
11091
|
11091
|
|
11092
|
|
- $retstring .= '<select class="flat" id="select_' . $prefix . 'model_mail" name="' . $prefix . 'model_mail">'; |
|
11092
|
+ $retstring .= '<select class="flat" id="select_'.$prefix.'model_mail" name="'.$prefix.'model_mail">'; |
11093
|
11093
|
|
11094
|
11094
|
foreach ($TModels as $id_model => $label_model) { |
11095
|
|
- $retstring .= '<option value="' . $id_model . '"'; |
11096
|
|
- $retstring .= ">" . $label_model . "</option>"; |
|
11095
|
+ $retstring .= '<option value="'.$id_model.'"'; |
|
11096
|
+ $retstring .= ">".$label_model."</option>"; |
11097
|
11097
|
} |
11098
|
11098
|
|
11099
|
11099
|
$retstring .= "</select>"; |
11100
|
11100
|
|
11101
|
11101
|
if ($addjscombo) { |
11102
|
|
- $retstring .= ajax_combobox('select_' . $prefix . 'model_mail'); |
|
11102
|
+ $retstring .= ajax_combobox('select_'.$prefix.'model_mail'); |
11103
|
11103
|
} |
11104
|
11104
|
|
11105
|
11105
|
return $retstring; |
|
@@ -11150,16 +11150,16 @@ discard block |
|
|
block discarded – undo |
11150
|
11150
|
|
11151
|
11151
|
foreach ($buttons as $button) { |
11152
|
11152
|
$addclass = empty($button['addclass']) ? '' : $button['addclass']; |
11153
|
|
- $retstring .= '<input type="submit" class="button button-' . $button['name'] . ($morecss ? ' ' . $morecss : '') . ' ' . $addclass . '" name="' . $button['name'] . '" value="' . dol_escape_htmltag($langs->trans($button['label_key'])) . '">'; |
|
11153
|
+ $retstring .= '<input type="submit" class="button button-'.$button['name'].($morecss ? ' '.$morecss : '').' '.$addclass.'" name="'.$button['name'].'" value="'.dol_escape_htmltag($langs->trans($button['label_key'])).'">'; |
11154
|
11154
|
} |
11155
|
11155
|
$retstring .= $withoutdiv ? '' : '</div>'; |
11156
|
11156
|
|
11157
|
11157
|
if ($dol_openinpopup) { |
11158
|
|
- $retstring .= '<!-- buttons are shown into a $dol_openinpopup=' . $dol_openinpopup . ' context, so we enable the close of dialog on cancel -->' . "\n"; |
11159
|
|
- $retstring .= '<script nonce="' . getNonce() . '">'; |
|
11158
|
+ $retstring .= '<!-- buttons are shown into a $dol_openinpopup='.$dol_openinpopup.' context, so we enable the close of dialog on cancel -->'."\n"; |
|
11159
|
+ $retstring .= '<script nonce="'.getNonce().'">'; |
11160
|
11160
|
$retstring .= 'jQuery(".button-cancel").click(function(e) { |
11161
|
|
- e.preventDefault(); console.log(\'We click on cancel in iframe popup ' . $dol_openinpopup . '\'); |
11162
|
|
- window.parent.jQuery(\'#idfordialog' . $dol_openinpopup . '\').dialog(\'close\'); |
|
11161
|
+ e.preventDefault(); console.log(\'We click on cancel in iframe popup ' . $dol_openinpopup.'\'); |
|
11162
|
+ window.parent.jQuery(\'#idfordialog' . $dol_openinpopup.'\').dialog(\'close\'); |
11163
|
11163
|
});'; |
11164
|
11164
|
$retstring .= '</script>'; |
11165
|
11165
|
} |
|
@@ -11188,7 +11188,7 @@ discard block |
|
|
block discarded – undo |
11188
|
11188
|
dol_syslog(__METHOD__, LOG_DEBUG); |
11189
|
11189
|
|
11190
|
11190
|
$sql = "SELECT rowid, code, label as label"; |
11191
|
|
- $sql .= " FROM " . MAIN_DB_PREFIX . 'c_invoice_subtype'; |
|
11191
|
+ $sql .= " FROM ".MAIN_DB_PREFIX.'c_invoice_subtype'; |
11192
|
11192
|
$sql .= " WHERE active = 1"; |
11193
|
11193
|
|
11194
|
11194
|
$resql = $this->db->query($sql); |
|
@@ -11199,7 +11199,7 @@ discard block |
|
|
block discarded – undo |
11199
|
11199
|
$obj = $this->db->fetch_object($resql); |
11200
|
11200
|
|
11201
|
11201
|
// If translation exists, we use it, otherwise we take the default wording |
11202
|
|
- $label = ($langs->trans("InvoiceSubtype" . $obj->rowid) != "InvoiceSubtype" . $obj->rowid) ? $langs->trans("InvoiceSubtype" . $obj->rowid) : (($obj->label != '-') ? $obj->label : ''); |
|
11202
|
+ $label = ($langs->trans("InvoiceSubtype".$obj->rowid) != "InvoiceSubtype".$obj->rowid) ? $langs->trans("InvoiceSubtype".$obj->rowid) : (($obj->label != '-') ? $obj->label : ''); |
11203
|
11203
|
$this->cache_invoice_subtype[$obj->rowid]['rowid'] = $obj->rowid; |
11204
|
11204
|
$this->cache_invoice_subtype[$obj->rowid]['code'] = $obj->code; |
11205
|
11205
|
$this->cache_invoice_subtype[$obj->rowid]['label'] = $label; |
|
@@ -11231,18 +11231,18 @@ discard block |
|
|
block discarded – undo |
11231
|
11231
|
global $langs, $user; |
11232
|
11232
|
|
11233
|
11233
|
$out = ''; |
11234
|
|
- dol_syslog(__METHOD__ . " selected=" . $selected . ", htmlname=" . $htmlname, LOG_DEBUG); |
|
11234
|
+ dol_syslog(__METHOD__." selected=".$selected.", htmlname=".$htmlname, LOG_DEBUG); |
11235
|
11235
|
|
11236
|
11236
|
$this->load_cache_invoice_subtype(); |
11237
|
11237
|
|
11238
|
|
- $out .= '<select id="' . $htmlname . '" class="flat selectsubtype' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">'; |
|
11238
|
+ $out .= '<select id="'.$htmlname.'" class="flat selectsubtype'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">'; |
11239
|
11239
|
if ($addempty) { |
11240
|
11240
|
$out .= '<option value="0"> </option>'; |
11241
|
11241
|
} |
11242
|
11242
|
|
11243
|
11243
|
foreach ($this->cache_invoice_subtype as $rowid => $subtype) { |
11244
|
11244
|
$label = $subtype['label']; |
11245
|
|
- $out .= '<option value="' . $subtype['rowid'] . '"'; |
|
11245
|
+ $out .= '<option value="'.$subtype['rowid'].'"'; |
11246
|
11246
|
if ($selected == $subtype['rowid']) { |
11247
|
11247
|
$out .= ' selected="selected"'; |
11248
|
11248
|
} |