|
@@ -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 wysiwig 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: 3px;'; |
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: 3px;'; |
667
|
667
|
} |
668
|
668
|
|
|
@@ -675,53 +675,53 @@ discard block |
|
|
block discarded – undo |
675
|
675
|
$htmltext = str_replace('"', '"', $htmltext); |
676
|
676
|
} else { |
677
|
677
|
$classfortooltip = 'classfortooltiponclick'; |
678
|
|
- $textfordialog .= '<div style="display: none;" id="idfortooltiponclick_' . $tooltiptrigger . '" class="classfortooltiponclicktext">' . $htmltext . '</div>'; |
|
678
|
+ $textfordialog .= '<div style="display: none;" id="idfortooltiponclick_'.$tooltiptrigger.'" class="classfortooltiponclicktext">'.$htmltext.'</div>'; |
679
|
679
|
} |
680
|
680
|
if ($tooltipon == 2 || $tooltipon == 3) { |
681
|
|
- $paramfortooltipimg = ' class="' . $classfortooltip . ($notabs != 3 ? ' inline-block' : '') . ($extracss ? ' ' . $extracss : '') . '" style="padding: 0px;' . ($extrastyle ? ' ' . $extrastyle : '') . '"'; |
|
681
|
+ $paramfortooltipimg = ' class="'.$classfortooltip.($notabs != 3 ? ' inline-block' : '').($extracss ? ' '.$extracss : '').'" style="padding: 0px;'.($extrastyle ? ' '.$extrastyle : '').'"'; |
682
|
682
|
if ($tooltiptrigger == '') { |
683
|
|
- $paramfortooltipimg .= ' title="' . ($noencodehtmltext ? $htmltext : dol_escape_htmltag($htmltext, 1)) . '"'; // Attribute to put on img tag to store tooltip |
|
683
|
+ $paramfortooltipimg .= ' title="'.($noencodehtmltext ? $htmltext : dol_escape_htmltag($htmltext, 1)).'"'; // Attribute to put on img tag to store tooltip |
684
|
684
|
} else { |
685
|
|
- $paramfortooltipimg .= ' dolid="' . $tooltiptrigger . '"'; |
|
685
|
+ $paramfortooltipimg .= ' dolid="'.$tooltiptrigger.'"'; |
686
|
686
|
} |
687
|
687
|
} else { |
688
|
|
- $paramfortooltipimg = ($extracss ? ' class="' . $extracss . '"' : '') . ($extrastyle ? ' style="' . $extrastyle . '"' : ''); // Attribute to put on td text tag |
|
688
|
+ $paramfortooltipimg = ($extracss ? ' class="'.$extracss.'"' : '').($extrastyle ? ' style="'.$extrastyle.'"' : ''); // Attribute to put on td text tag |
689
|
689
|
} |
690
|
690
|
if ($tooltipon == 1 || $tooltipon == 3) { |
691
|
|
- $paramfortooltiptd = ' class="' . ($tooltipon == 3 ? 'cursorpointer ' : '') . $classfortooltip . ' inline-block' . ($extracss ? ' ' . $extracss : '') . '" style="padding: 0px;' . ($extrastyle ? ' ' . $extrastyle : '') . '" '; |
|
691
|
+ $paramfortooltiptd = ' class="'.($tooltipon == 3 ? 'cursorpointer ' : '').$classfortooltip.' inline-block'.($extracss ? ' '.$extracss : '').'" style="padding: 0px;'.($extrastyle ? ' '.$extrastyle : '').'" '; |
692
|
692
|
if ($tooltiptrigger == '') { |
693
|
|
- $paramfortooltiptd .= ' title="' . ($noencodehtmltext ? $htmltext : dol_escape_htmltag($htmltext, 1)) . '"'; // Attribute to put on td tag to store tooltip |
|
693
|
+ $paramfortooltiptd .= ' title="'.($noencodehtmltext ? $htmltext : dol_escape_htmltag($htmltext, 1)).'"'; // Attribute to put on td tag to store tooltip |
694
|
694
|
} else { |
695
|
|
- $paramfortooltiptd .= ' dolid="' . $tooltiptrigger . '"'; |
|
695
|
+ $paramfortooltiptd .= ' dolid="'.$tooltiptrigger.'"'; |
696
|
696
|
} |
697
|
697
|
} else { |
698
|
|
- $paramfortooltiptd = ($extracss ? ' class="' . $extracss . '"' : '') . ($extrastyle ? ' style="' . $extrastyle . '"' : ''); // Attribute to put on td text tag |
|
698
|
+ $paramfortooltiptd = ($extracss ? ' class="'.$extracss.'"' : '').($extrastyle ? ' style="'.$extrastyle.'"' : ''); // Attribute to put on td text tag |
699
|
699
|
} |
700
|
700
|
if (empty($notabs)) { |
701
|
701
|
$s .= '<table class="nobordernopadding"><tr style="height: auto;">'; |
702
|
702
|
} elseif ($notabs == 2) { |
703
|
|
- $s .= '<div class="inline-block' . ($forcenowrap ? ' nowrap' : '') . '">'; |
|
703
|
+ $s .= '<div class="inline-block'.($forcenowrap ? ' nowrap' : '').'">'; |
704
|
704
|
} |
705
|
705
|
// Define value if value is before |
706
|
706
|
if ($direction < 0) { |
707
|
|
- $s .= '<' . $tag . $paramfortooltipimg; |
|
707
|
+ $s .= '<'.$tag.$paramfortooltipimg; |
708
|
708
|
if ($tag == 'td') { |
709
|
709
|
$s .= ' class="valigntop" width="14"'; |
710
|
710
|
} |
711
|
|
- $s .= '>' . $textfordialog . $img . '</' . $tag . '>'; |
|
711
|
+ $s .= '>'.$textfordialog.$img.'</'.$tag.'>'; |
712
|
712
|
} |
713
|
713
|
// Use another method to help avoid having a space in value in order to use this value with jquery |
714
|
714
|
// Define label |
715
|
715
|
if ((string) $text != '') { |
716
|
|
- $s .= '<' . $tag . $paramfortooltiptd . '>' . $text . '</' . $tag . '>'; |
|
716
|
+ $s .= '<'.$tag.$paramfortooltiptd.'>'.$text.'</'.$tag.'>'; |
717
|
717
|
} |
718
|
718
|
// Define value if value is after |
719
|
719
|
if ($direction > 0) { |
720
|
|
- $s .= '<' . $tag . $paramfortooltipimg; |
|
720
|
+ $s .= '<'.$tag.$paramfortooltipimg; |
721
|
721
|
if ($tag == 'td') { |
722
|
722
|
$s .= ' class="valignmiddle" width="14"'; |
723
|
723
|
} |
724
|
|
- $s .= '>' . $textfordialog . $img . '</' . $tag . '>'; |
|
724
|
+ $s .= '>'.$textfordialog.$img.'</'.$tag.'>'; |
725
|
725
|
} |
726
|
726
|
if (empty($notabs)) { |
727
|
727
|
$s .= '</tr></table>'; |
|
@@ -828,7 +828,7 @@ discard block |
|
|
block discarded – undo |
828
|
828
|
|
829
|
829
|
$disabled = 0; |
830
|
830
|
$ret = '<div class="centpercent center">'; |
831
|
|
- $ret .= '<select class="flat' . (empty($conf->use_javascript_ajax) ? '' : ' hideobject') . ' ' . $name . ' ' . $name . 'select valignmiddle alignstart" id="' . $name . '" name="' . $name . '"' . ($disabled ? ' disabled="disabled"' : '') . '>'; |
|
831
|
+ $ret .= '<select class="flat'.(empty($conf->use_javascript_ajax) ? '' : ' hideobject').' '.$name.' '.$name.'select valignmiddle alignstart" id="'.$name.'" name="'.$name.'"'.($disabled ? ' disabled="disabled"' : '').'>'; |
832
|
832
|
|
833
|
833
|
// Complete list with data from external modules. THe module can use $_SERVER['PHP_SELF'] to know on which page we are, or use the $parameters['currentcontext'] completed by executeHooks. |
834
|
834
|
$parameters = array(); |
|
@@ -839,10 +839,10 @@ discard block |
|
|
block discarded – undo |
839
|
839
|
return; |
840
|
840
|
} |
841
|
841
|
if (empty($reshook)) { |
842
|
|
- $ret .= '<option value="0"' . ($disabled ? ' disabled="disabled"' : '') . '>-- ' . $langs->trans("SelectAction") . ' --</option>'; |
|
842
|
+ $ret .= '<option value="0"'.($disabled ? ' disabled="disabled"' : '').'>-- '.$langs->trans("SelectAction").' --</option>'; |
843
|
843
|
if (is_array($arrayofaction)) { |
844
|
844
|
foreach ($arrayofaction as $code => $label) { |
845
|
|
- $ret .= '<option value="' . $code . '"' . ($disabled ? ' disabled="disabled"' : '') . ' data-html="' . dol_escape_htmltag($label) . '">' . $label . '</option>'; |
|
845
|
+ $ret .= '<option value="'.$code.'"'.($disabled ? ' disabled="disabled"' : '').' data-html="'.dol_escape_htmltag($label).'">'.$label.'</option>'; |
846
|
846
|
} |
847
|
847
|
} |
848
|
848
|
} |
|
@@ -851,17 +851,17 @@ discard block |
|
|
block discarded – undo |
851
|
851
|
$ret .= '</select>'; |
852
|
852
|
|
853
|
853
|
if (empty($conf->dol_optimize_smallscreen)) { |
854
|
|
- $ret .= ajax_combobox('.' . $name . 'select'); |
|
854
|
+ $ret .= ajax_combobox('.'.$name.'select'); |
855
|
855
|
} |
856
|
856
|
|
857
|
857
|
// Warning: if you set submit button to disabled, post using 'Enter' will no more work if there is no another input submit. So we add a hidden button |
858
|
858
|
$ret .= '<input type="submit" name="confirmmassactioninvisible" style="display: none" tabindex="-1">'; // Hidden button BEFORE so it is the one used when we submit with ENTER. |
859
|
|
- $ret .= '<input type="submit" disabled name="confirmmassaction"' . (empty($conf->use_javascript_ajax) ? '' : ' style="display: none"') . ' class="reposition button smallpaddingimp' . (empty($conf->use_javascript_ajax) ? '' : ' hideobject') . ' ' . $name . ' ' . $name . 'confirmed" value="' . dol_escape_htmltag($langs->trans("Confirm")) . '">'; |
|
859
|
+ $ret .= '<input type="submit" disabled name="confirmmassaction"'.(empty($conf->use_javascript_ajax) ? '' : ' style="display: none"').' class="reposition button smallpaddingimp'.(empty($conf->use_javascript_ajax) ? '' : ' hideobject').' '.$name.' '.$name.'confirmed" value="'.dol_escape_htmltag($langs->trans("Confirm")).'">'; |
860
|
860
|
$ret .= '</div>'; |
861
|
861
|
|
862
|
862
|
if (!empty($conf->use_javascript_ajax)) { |
863
|
863
|
$ret .= '<!-- JS CODE TO ENABLE mass action select --> |
864
|
|
- <script nonce="' . getNonce() . '"> |
|
864
|
+ <script nonce="' . getNonce().'"> |
865
|
865
|
function initCheckForSelect(mode, name, cssclass) /* mode is 0 during init of page or click all, 1 when we click on 1 checkboxi, "name" refers to the class of the massaction button, "cssclass" to the class of the checkfor select boxes */ |
866
|
866
|
{ |
867
|
867
|
atleastoneselected=0; |
|
@@ -872,11 +872,11 @@ discard block |
|
|
block discarded – undo |
872
|
872
|
|
873
|
873
|
console.log("initCheckForSelect mode="+mode+" name="+name+" cssclass="+cssclass+" atleastoneselected="+atleastoneselected); |
874
|
874
|
|
875
|
|
- if (atleastoneselected || ' . $alwaysvisible . ') |
|
875
|
+ if (atleastoneselected || ' . $alwaysvisible.') |
876
|
876
|
{ |
877
|
877
|
jQuery("."+name).show(); |
878
|
|
- ' . ($selected ? 'if (atleastoneselected) { jQuery("."+name+"select").val("' . $selected . '").trigger(\'change\'); jQuery("."+name+"confirmed").prop(\'disabled\', false); }' : '') . ' |
879
|
|
- ' . ($selected ? 'if (! atleastoneselected) { jQuery("."+name+"select").val("0").trigger(\'change\'); jQuery("."+name+"confirmed").prop(\'disabled\', true); } ' : '') . ' |
|
878
|
+ ' . ($selected ? 'if (atleastoneselected) { jQuery("."+name+"select").val("'.$selected.'").trigger(\'change\'); jQuery("."+name+"confirmed").prop(\'disabled\', false); }' : '').' |
|
879
|
+ ' . ($selected ? 'if (! atleastoneselected) { jQuery("."+name+"select").val("0").trigger(\'change\'); jQuery("."+name+"confirmed").prop(\'disabled\', true); } ' : '').' |
880
|
880
|
} |
881
|
881
|
else |
882
|
882
|
{ |
|
@@ -886,11 +886,11 @@ discard block |
|
|
block discarded – undo |
886
|
886
|
} |
887
|
887
|
|
888
|
888
|
jQuery(document).ready(function () { |
889
|
|
- initCheckForSelect(0, "' . $name . '", "' . $cssclass . '"); |
890
|
|
- jQuery(".' . $cssclass . '").click(function() { |
891
|
|
- initCheckForSelect(1, "' . $name . '", "' . $cssclass . '"); |
|
889
|
+ initCheckForSelect(0, "' . $name.'", "'.$cssclass.'"); |
|
890
|
+ jQuery(".' . $cssclass.'").click(function() { |
|
891
|
+ initCheckForSelect(1, "' . $name.'", "'.$cssclass.'"); |
892
|
892
|
}); |
893
|
|
- jQuery(".' . $name . 'select").change(function() { |
|
893
|
+ jQuery(".' . $name.'select").change(function() { |
894
|
894
|
var massaction = $( this ).val(); |
895
|
895
|
var urlform = $( this ).closest("form").attr("action").replace("#show_files",""); |
896
|
896
|
if (massaction == "builddoc") |
|
@@ -898,18 +898,18 @@ discard block |
|
|
block discarded – undo |
898
|
898
|
urlform = urlform + "#show_files"; |
899
|
899
|
} |
900
|
900
|
$( this ).closest("form").attr("action", urlform); |
901
|
|
- console.log("we select a mass action name=' . $name . ' massaction="+massaction+" - "+urlform); |
|
901
|
+ console.log("we select a mass action name=' . $name.' massaction="+massaction+" - "+urlform); |
902
|
902
|
/* Warning: if you set submit button to disabled, post using Enter will no more work if there is no other button */ |
903
|
903
|
if ($(this).val() != \'0\') |
904
|
904
|
{ |
905
|
|
- jQuery(".' . $name . 'confirmed").prop(\'disabled\', false); |
906
|
|
- jQuery(".' . $name . 'other").hide(); /* To disable if another div was open */ |
907
|
|
- jQuery(".' . $name . '"+massaction).show(); |
|
905
|
+ jQuery(".' . $name.'confirmed").prop(\'disabled\', false); |
|
906
|
+ jQuery(".' . $name.'other").hide(); /* To disable if another div was open */ |
|
907
|
+ jQuery(".' . $name.'"+massaction).show(); |
908
|
908
|
} |
909
|
909
|
else |
910
|
910
|
{ |
911
|
|
- jQuery(".' . $name . 'confirmed").prop(\'disabled\', true); |
912
|
|
- jQuery(".' . $name . 'other").hide(); /* To disable any div open */ |
|
911
|
+ jQuery(".' . $name.'confirmed").prop(\'disabled\', true); |
|
912
|
+ jQuery(".' . $name.'other").hide(); /* To disable any div open */ |
913
|
913
|
} |
914
|
914
|
}); |
915
|
915
|
}); |
|
@@ -952,14 +952,14 @@ discard block |
|
|
block discarded – undo |
952
|
952
|
$atleastonefavorite = 0; |
953
|
953
|
|
954
|
954
|
$sql = "SELECT rowid, code as code_iso, code_iso as code_iso3, label, favorite, eec"; |
955
|
|
- $sql .= " FROM " . $this->db->prefix() . "c_country"; |
|
955
|
+ $sql .= " FROM ".$this->db->prefix()."c_country"; |
956
|
956
|
$sql .= " WHERE active > 0"; |
957
|
957
|
//$sql.= " ORDER BY code ASC"; |
958
|
958
|
|
959
|
|
- dol_syslog(get_class($this) . "::select_country", LOG_DEBUG); |
|
959
|
+ dol_syslog(get_class($this)."::select_country", LOG_DEBUG); |
960
|
960
|
$resql = $this->db->query($sql); |
961
|
961
|
if ($resql) { |
962
|
|
- $out .= '<select id="select' . $htmlname . '" class="flat maxwidth200onsmartphone selectcountry' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" ' . $htmloption . '>'; |
|
962
|
+ $out .= '<select id="select'.$htmlname.'" class="flat maxwidth200onsmartphone selectcountry'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" '.$htmloption.'>'; |
963
|
963
|
$num = $this->db->num_rows($resql); |
964
|
964
|
$i = 0; |
965
|
965
|
if ($num) { |
|
@@ -969,7 +969,7 @@ discard block |
|
|
block discarded – undo |
969
|
969
|
$countryArray[$i]['rowid'] = $obj->rowid; |
970
|
970
|
$countryArray[$i]['code_iso'] = $obj->code_iso; |
971
|
971
|
$countryArray[$i]['code_iso3'] = $obj->code_iso3; |
972
|
|
- $countryArray[$i]['label'] = ($obj->code_iso && $langs->transnoentitiesnoconv("Country" . $obj->code_iso) != "Country" . $obj->code_iso ? $langs->transnoentitiesnoconv("Country" . $obj->code_iso) : ($obj->label != '-' ? $obj->label : '')); |
|
972
|
+ $countryArray[$i]['label'] = ($obj->code_iso && $langs->transnoentitiesnoconv("Country".$obj->code_iso) != "Country".$obj->code_iso ? $langs->transnoentitiesnoconv("Country".$obj->code_iso) : ($obj->label != '-' ? $obj->label : '')); |
973
|
973
|
$countryArray[$i]['favorite'] = $obj->favorite; |
974
|
974
|
$countryArray[$i]['eec'] = $obj->eec; |
975
|
975
|
$favorite[$i] = $obj->favorite; |
|
@@ -987,20 +987,20 @@ discard block |
|
|
block discarded – undo |
987
|
987
|
|
988
|
988
|
if ($showempty) { |
989
|
989
|
if (is_numeric($showempty)) { |
990
|
|
- $out .= '<option value=""> </option>' . "\n"; |
|
990
|
+ $out .= '<option value=""> </option>'."\n"; |
991
|
991
|
} else { |
992
|
|
- $out .= '<option value="-1">' . $langs->trans($showempty) . '</option>' . "\n"; |
|
992
|
+ $out .= '<option value="-1">'.$langs->trans($showempty).'</option>'."\n"; |
993
|
993
|
} |
994
|
994
|
} |
995
|
995
|
|
996
|
996
|
if ($addspecialentries) { // Add dedicated entries for groups of countries |
997
|
997
|
//if ($showempty) $out.= '<option value="" disabled class="selectoptiondisabledwhite">--------------</option>'; |
998
|
|
- $out .= '<option value="special_allnotme"' . ($selected == 'special_allnotme' ? ' selected' : '') . '>' . $langs->trans("CountriesExceptMe", $langs->transnoentitiesnoconv("Country" . $mysoc->country_code)) . '</option>'; |
999
|
|
- $out .= '<option value="special_eec"' . ($selected == 'special_eec' ? ' selected' : '') . '>' . $langs->trans("CountriesInEEC") . '</option>'; |
|
998
|
+ $out .= '<option value="special_allnotme"'.($selected == 'special_allnotme' ? ' selected' : '').'>'.$langs->trans("CountriesExceptMe", $langs->transnoentitiesnoconv("Country".$mysoc->country_code)).'</option>'; |
|
999
|
+ $out .= '<option value="special_eec"'.($selected == 'special_eec' ? ' selected' : '').'>'.$langs->trans("CountriesInEEC").'</option>'; |
1000
|
1000
|
if ($mysoc->isInEEC()) { |
1001
|
|
- $out .= '<option value="special_eecnotme"' . ($selected == 'special_eecnotme' ? ' selected' : '') . '>' . $langs->trans("CountriesInEECExceptMe", $langs->transnoentitiesnoconv("Country" . $mysoc->country_code)) . '</option>'; |
|
1001
|
+ $out .= '<option value="special_eecnotme"'.($selected == 'special_eecnotme' ? ' selected' : '').'>'.$langs->trans("CountriesInEECExceptMe", $langs->transnoentitiesnoconv("Country".$mysoc->country_code)).'</option>'; |
1002
|
1002
|
} |
1003
|
|
- $out .= '<option value="special_noteec"' . ($selected == 'special_noteec' ? ' selected' : '') . '>' . $langs->trans("CountriesNotInEEC") . '</option>'; |
|
1003
|
+ $out .= '<option value="special_noteec"'.($selected == 'special_noteec' ? ' selected' : '').'>'.$langs->trans("CountriesNotInEEC").'</option>'; |
1004
|
1004
|
$out .= '<option value="" disabled class="selectoptiondisabledwhite">------------</option>'; |
1005
|
1005
|
} |
1006
|
1006
|
|
|
@@ -1028,20 +1028,20 @@ discard block |
|
|
block discarded – undo |
1028
|
1028
|
$labeltoshow .= ' '; |
1029
|
1029
|
} |
1030
|
1030
|
if ($row['code_iso']) { |
1031
|
|
- $labeltoshow .= ' <span class="opacitymedium">(' . $row['code_iso'] . ')</span>'; |
|
1031
|
+ $labeltoshow .= ' <span class="opacitymedium">('.$row['code_iso'].')</span>'; |
1032
|
1032
|
if (empty($hideflags)) { |
1033
|
1033
|
$tmpflag = picto_from_langcode($row['code_iso'], 'class="saturatemedium paddingrightonly"', 1); |
1034
|
|
- $labeltoshow = $tmpflag . ' ' . $labeltoshow; |
|
1034
|
+ $labeltoshow = $tmpflag.' '.$labeltoshow; |
1035
|
1035
|
} |
1036
|
1036
|
} |
1037
|
1037
|
|
1038
|
1038
|
if ($selected && $selected != '-1' && ($selected == $row['rowid'] || $selected == $row['code_iso'] || $selected == $row['code_iso3'] || $selected == $row['label'])) { |
1039
|
|
- $out .= '<option value="' . ($usecodeaskey ? ($usecodeaskey == 'code2' ? $row['code_iso'] : $row['code_iso3']) : $row['rowid']) . '" selected data-html="' . dol_escape_htmltag($labeltoshow) . '" data-eec="' . ((int) $row['eec']) . '">'; |
|
1039
|
+ $out .= '<option value="'.($usecodeaskey ? ($usecodeaskey == 'code2' ? $row['code_iso'] : $row['code_iso3']) : $row['rowid']).'" selected data-html="'.dol_escape_htmltag($labeltoshow).'" data-eec="'.((int) $row['eec']).'">'; |
1040
|
1040
|
} else { |
1041
|
|
- $out .= '<option value="' . ($usecodeaskey ? ($usecodeaskey == 'code2' ? $row['code_iso'] : $row['code_iso3']) : $row['rowid']) . '" data-html="' . dol_escape_htmltag($labeltoshow) . '" data-eec="' . ((int) $row['eec']) . '">'; |
|
1041
|
+ $out .= '<option value="'.($usecodeaskey ? ($usecodeaskey == 'code2' ? $row['code_iso'] : $row['code_iso3']) : $row['rowid']).'" data-html="'.dol_escape_htmltag($labeltoshow).'" data-eec="'.((int) $row['eec']).'">'; |
1042
|
1042
|
} |
1043
|
1043
|
$out .= $labeltoshow; |
1044
|
|
- $out .= '</option>' . "\n"; |
|
1044
|
+ $out .= '</option>'."\n"; |
1045
|
1045
|
} |
1046
|
1046
|
} |
1047
|
1047
|
$out .= '</select>'; |
|
@@ -1050,8 +1050,8 @@ discard block |
|
|
block discarded – undo |
1050
|
1050
|
} |
1051
|
1051
|
|
1052
|
1052
|
// Make select dynamic |
1053
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
1054
|
|
- $out .= ajax_combobox('select' . $htmlname, array(), 0, 0, 'resolve'); |
|
1053
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
|
1054
|
+ $out .= ajax_combobox('select'.$htmlname, array(), 0, 0, 'resolve'); |
1055
|
1055
|
|
1056
|
1056
|
return $out; |
1057
|
1057
|
} |
|
@@ -1083,25 +1083,25 @@ discard block |
|
|
block discarded – undo |
1083
|
1083
|
$incotermArray = array(); |
1084
|
1084
|
|
1085
|
1085
|
$sql = "SELECT rowid, code"; |
1086
|
|
- $sql .= " FROM " . $this->db->prefix() . "c_incoterms"; |
|
1086
|
+ $sql .= " FROM ".$this->db->prefix()."c_incoterms"; |
1087
|
1087
|
$sql .= " WHERE active > 0"; |
1088
|
1088
|
$sql .= " ORDER BY code ASC"; |
1089
|
1089
|
|
1090
|
|
- dol_syslog(get_class($this) . "::select_incoterm", LOG_DEBUG); |
|
1090
|
+ dol_syslog(get_class($this)."::select_incoterm", LOG_DEBUG); |
1091
|
1091
|
$resql = $this->db->query($sql); |
1092
|
1092
|
if ($resql) { |
1093
|
1093
|
if ($conf->use_javascript_ajax && !$forcecombo) { |
1094
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
1094
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
1095
|
1095
|
$out .= ajax_combobox($htmlname, $events); |
1096
|
1096
|
} |
1097
|
1097
|
|
1098
|
1098
|
if (!empty($page)) { |
1099
|
|
- $out .= '<form method="post" action="' . $page . '">'; |
|
1099
|
+ $out .= '<form method="post" action="'.$page.'">'; |
1100
|
1100
|
$out .= '<input type="hidden" name="action" value="set_incoterms">'; |
1101
|
|
- $out .= '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
1101
|
+ $out .= '<input type="hidden" name="token" value="'.newToken().'">'; |
1102
|
1102
|
} |
1103
|
1103
|
|
1104
|
|
- $out .= '<select id="' . $htmlname . '" class="flat selectincoterm width75" name="' . $htmlname . '" ' . $htmloption . '>'; |
|
1104
|
+ $out .= '<select id="'.$htmlname.'" class="flat selectincoterm width75" name="'.$htmlname.'" '.$htmloption.'>'; |
1105
|
1105
|
$out .= '<option value="0"> </option>'; |
1106
|
1106
|
$num = $this->db->num_rows($resql); |
1107
|
1107
|
$i = 0; |
|
@@ -1115,9 +1115,9 @@ discard block |
|
|
block discarded – undo |
1115
|
1115
|
|
1116
|
1116
|
foreach ($incotermArray as $row) { |
1117
|
1117
|
if ($selected && ($selected == $row['rowid'] || $selected == $row['code'])) { |
1118
|
|
- $out .= '<option value="' . $row['rowid'] . '" selected>'; |
|
1118
|
+ $out .= '<option value="'.$row['rowid'].'" selected>'; |
1119
|
1119
|
} else { |
1120
|
|
- $out .= '<option value="' . $row['rowid'] . '">'; |
|
1120
|
+ $out .= '<option value="'.$row['rowid'].'">'; |
1121
|
1121
|
} |
1122
|
1122
|
|
1123
|
1123
|
if ($row['code']) { |
|
@@ -1130,13 +1130,13 @@ discard block |
|
|
block discarded – undo |
1130
|
1130
|
$out .= '</select>'; |
1131
|
1131
|
|
1132
|
1132
|
if ($conf->use_javascript_ajax && empty($disableautocomplete)) { |
1133
|
|
- $out .= ajax_multiautocompleter('location_incoterms', array(), DOL_URL_ROOT . '/core/ajax/locationincoterms.php') . "\n"; |
|
1133
|
+ $out .= ajax_multiautocompleter('location_incoterms', array(), DOL_URL_ROOT.'/core/ajax/locationincoterms.php')."\n"; |
1134
|
1134
|
$moreattrib .= ' autocomplete="off"'; |
1135
|
1135
|
} |
1136
|
|
- $out .= '<input id="location_incoterms" class="maxwidthonsmartphone type="text" name="location_incoterms" value="' . $location_incoterms . '">' . "\n"; |
|
1136
|
+ $out .= '<input id="location_incoterms" class="maxwidthonsmartphone type="text" name="location_incoterms" value="'.$location_incoterms.'">'."\n"; |
1137
|
1137
|
|
1138
|
1138
|
if (!empty($page)) { |
1139
|
|
- $out .= '<input type="submit" class="button valignmiddle smallpaddingimp nomargintop nomarginbottom" value="' . $langs->trans("Modify") . '"></form>'; |
|
1139
|
+ $out .= '<input type="submit" class="button valignmiddle smallpaddingimp nomargintop nomarginbottom" value="'.$langs->trans("Modify").'"></form>'; |
1140
|
1140
|
} |
1141
|
1141
|
} else { |
1142
|
1142
|
dol_print_error($this->db); |
|
@@ -1168,9 +1168,9 @@ discard block |
|
|
block discarded – undo |
1168
|
1168
|
if ($forceall == 1 || (empty($forceall) && isModEnabled("product") && isModEnabled("service")) |
1169
|
1169
|
|| (empty($forceall) && !isModEnabled('product') && !isModEnabled('service'))) { |
1170
|
1170
|
if (empty($hidetext)) { |
1171
|
|
- print $langs->trans("Type") . ': '; |
|
1171
|
+ print $langs->trans("Type").': '; |
1172
|
1172
|
} |
1173
|
|
- print '<select class="flat'.($morecss ? ' '.$morecss : '').'" id="select_' . $htmlname . '" name="' . $htmlname . '">'; |
|
1173
|
+ print '<select class="flat'.($morecss ? ' '.$morecss : '').'" id="select_'.$htmlname.'" name="'.$htmlname.'">'; |
1174
|
1174
|
if ($showempty) { |
1175
|
1175
|
print '<option value="-1"'; |
1176
|
1176
|
if ($selected == -1) { |
|
@@ -1189,28 +1189,28 @@ discard block |
|
|
block discarded – undo |
1189
|
1189
|
if (0 == $selected || ($selected == -1 && getDolGlobalString('MAIN_FREE_PRODUCT_CHECKED_BY_DEFAULT') == 'product')) { |
1190
|
1190
|
print ' selected'; |
1191
|
1191
|
} |
1192
|
|
- print '>' . $langs->trans("Product"); |
|
1192
|
+ print '>'.$langs->trans("Product"); |
1193
|
1193
|
|
1194
|
1194
|
print '<option value="1"'; |
1195
|
1195
|
if (1 == $selected || ($selected == -1 && getDolGlobalString('MAIN_FREE_PRODUCT_CHECKED_BY_DEFAULT') == 'service')) { |
1196
|
1196
|
print ' selected'; |
1197
|
1197
|
} |
1198
|
|
- print '>' . $langs->trans("Service"); |
|
1198
|
+ print '>'.$langs->trans("Service"); |
1199
|
1199
|
|
1200
|
1200
|
print '</select>'; |
1201
|
|
- print ajax_combobox('select_' . $htmlname); |
|
1201
|
+ print ajax_combobox('select_'.$htmlname); |
1202
|
1202
|
//if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); |
1203
|
1203
|
} |
1204
|
1204
|
if ((empty($forceall) && !isModEnabled('product') && isModEnabled("service")) || $forceall == 3) { |
1205
|
1205
|
print $langs->trans("Service"); |
1206
|
|
- print '<input type="hidden" name="' . $htmlname . '" value="1">'; |
|
1206
|
+ print '<input type="hidden" name="'.$htmlname.'" value="1">'; |
1207
|
1207
|
} |
1208
|
1208
|
if ((empty($forceall) && isModEnabled("product") && !isModEnabled('service')) || $forceall == 2) { |
1209
|
1209
|
print $langs->trans("Product"); |
1210
|
|
- print '<input type="hidden" name="' . $htmlname . '" value="0">'; |
|
1210
|
+ print '<input type="hidden" name="'.$htmlname.'" value="0">'; |
1211
|
1211
|
} |
1212
|
1212
|
if ($forceall < 0) { // This should happened only for contracts when both predefined product and service are disabled. |
1213
|
|
- print '<input type="hidden" name="' . $htmlname . '" value="1">'; // By default we set on service for contract. If CONTRACT_SUPPORT_PRODUCTS is set, forceall should be 1 not -1 |
|
1213
|
+ print '<input type="hidden" name="'.$htmlname.'" value="1">'; // By default we set on service for contract. If CONTRACT_SUPPORT_PRODUCTS is set, forceall should be 1 not -1 |
1214
|
1214
|
} |
1215
|
1215
|
} |
1216
|
1216
|
|
|
@@ -1236,7 +1236,7 @@ discard block |
|
|
block discarded – undo |
1236
|
1236
|
$langs->load("trips"); |
1237
|
1237
|
|
1238
|
1238
|
$sql = "SELECT c.code, c.label"; |
1239
|
|
- $sql .= " FROM " . $this->db->prefix() . "c_type_fees as c"; |
|
1239
|
+ $sql .= " FROM ".$this->db->prefix()."c_type_fees as c"; |
1240
|
1240
|
$sql .= " WHERE active > 0"; |
1241
|
1241
|
|
1242
|
1242
|
$resql = $this->db->query($sql); |
|
@@ -1277,11 +1277,11 @@ discard block |
|
|
block discarded – undo |
1277
|
1277
|
// phpcs:enable |
1278
|
1278
|
global $user, $langs; |
1279
|
1279
|
|
1280
|
|
- dol_syslog(__METHOD__ . " selected=" . $selected . ", htmlname=" . $htmlname, LOG_DEBUG); |
|
1280
|
+ dol_syslog(__METHOD__." selected=".$selected.", htmlname=".$htmlname, LOG_DEBUG); |
1281
|
1281
|
|
1282
|
1282
|
$this->load_cache_types_fees(); |
1283
|
1283
|
|
1284
|
|
- print '<select id="select_' . $htmlname . '" class="flat" name="' . $htmlname . '">'; |
|
1284
|
+ print '<select id="select_'.$htmlname.'" class="flat" name="'.$htmlname.'">'; |
1285
|
1285
|
if ($showempty) { |
1286
|
1286
|
print '<option value="-1"'; |
1287
|
1287
|
if ($selected == -1) { |
|
@@ -1291,7 +1291,7 @@ discard block |
|
|
block discarded – undo |
1291
|
1291
|
} |
1292
|
1292
|
|
1293
|
1293
|
foreach ($this->cache_types_fees as $key => $value) { |
1294
|
|
- print '<option value="' . $key . '"'; |
|
1294
|
+ print '<option value="'.$key.'"'; |
1295
|
1295
|
if ($key == $selected) { |
1296
|
1296
|
print ' selected'; |
1297
|
1297
|
} |
|
@@ -1343,12 +1343,12 @@ discard block |
|
|
block discarded – undo |
1343
|
1343
|
$ajaxoptions = array(); |
1344
|
1344
|
} |
1345
|
1345
|
|
1346
|
|
- require_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
1346
|
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
1347
|
1347
|
|
1348
|
1348
|
// No immediate load of all database |
1349
|
1349
|
$placeholder = ''; |
1350
|
1350
|
if ($selected && empty($selected_input_value)) { |
1351
|
|
- require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; |
|
1351
|
+ require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; |
1352
|
1352
|
$societetmp = new Societe($this->db); |
1353
|
1353
|
$societetmp->fetch($selected); |
1354
|
1354
|
$selected_input_value = $societetmp->name; |
|
@@ -1356,18 +1356,18 @@ discard block |
|
|
block discarded – undo |
1356
|
1356
|
} |
1357
|
1357
|
|
1358
|
1358
|
// mode 1 |
1359
|
|
- $urloption = 'htmlname=' . urlencode((string) (str_replace('.', '_', $htmlname))) . '&outjson=1&filter=' . urlencode((string) ($filter)) . (empty($excludeids) ? '' : '&excludeids=' . implode(',', $excludeids)) . ($showtype ? '&showtype=' . urlencode((string) ($showtype)) : '') . ($showcode ? '&showcode=' . urlencode((string) ($showcode)) : ''); |
|
1359
|
+ $urloption = 'htmlname='.urlencode((string) (str_replace('.', '_', $htmlname))).'&outjson=1&filter='.urlencode((string) ($filter)).(empty($excludeids) ? '' : '&excludeids='.implode(',', $excludeids)).($showtype ? '&showtype='.urlencode((string) ($showtype)) : '').($showcode ? '&showcode='.urlencode((string) ($showcode)) : ''); |
1360
|
1360
|
|
1361
|
1361
|
$out .= '<!-- force css to be higher than dialog popup --><style type="text/css">.ui-autocomplete { z-index: 1010; }</style>'; |
1362
|
1362
|
if (empty($hidelabel)) { |
1363
|
|
- print $langs->trans("RefOrLabel") . ' : '; |
|
1363
|
+ print $langs->trans("RefOrLabel").' : '; |
1364
|
1364
|
} elseif ($hidelabel > 1) { |
1365
|
1365
|
$placeholder = $langs->trans("RefOrLabel"); |
1366
|
1366
|
if ($hidelabel == 2) { |
1367
|
1367
|
$out .= img_picto($langs->trans("Search"), 'search'); |
1368
|
1368
|
} |
1369
|
1369
|
} |
1370
|
|
- $out .= '<input type="text" class="' . $morecss . '" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . ($placeholder ? ' placeholder="' . dol_escape_htmltag($placeholder) . '"' : '') . ' ' . (getDolGlobalString('THIRDPARTY_SEARCH_AUTOFOCUS') ? 'autofocus' : '') . ' />'; |
|
1370
|
+ $out .= '<input type="text" class="'.$morecss.'" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.($placeholder ? ' placeholder="'.dol_escape_htmltag($placeholder).'"' : '').' '.(getDolGlobalString('THIRDPARTY_SEARCH_AUTOFOCUS') ? 'autofocus' : '').' />'; |
1371
|
1371
|
if ($hidelabel == 3) { |
1372
|
1372
|
$out .= img_picto($langs->trans("Search"), 'search'); |
1373
|
1373
|
} |
|
@@ -1429,12 +1429,12 @@ discard block |
|
|
block discarded – undo |
1429
|
1429
|
$events = array(); |
1430
|
1430
|
} |
1431
|
1431
|
|
1432
|
|
- require_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
1432
|
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
1433
|
1433
|
|
1434
|
1434
|
// No immediate load of all database |
1435
|
1435
|
$placeholder = ''; |
1436
|
1436
|
if ($selected && empty($selected_input_value)) { |
1437
|
|
- require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php'; |
|
1437
|
+ require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; |
1438
|
1438
|
$contacttmp = new Contact($this->db); |
1439
|
1439
|
$contacttmp->fetch($selected); |
1440
|
1440
|
$selected_input_value = $contacttmp->getFullName($langs); |
|
@@ -1445,11 +1445,11 @@ discard block |
|
|
block discarded – undo |
1445
|
1445
|
} |
1446
|
1446
|
|
1447
|
1447
|
// mode 1 |
1448
|
|
- $urloption = 'htmlname=' . urlencode((string) (str_replace('.', '_', $htmlname))) . '&outjson=1&filter=' . urlencode((string) ($filter)) . (empty($exclude) ? '' : '&exclude=' . urlencode($exclude)) . ($showsoc ? '&showsoc=' . urlencode((string) ($showsoc)) : ''); |
|
1448
|
+ $urloption = 'htmlname='.urlencode((string) (str_replace('.', '_', $htmlname))).'&outjson=1&filter='.urlencode((string) ($filter)).(empty($exclude) ? '' : '&exclude='.urlencode($exclude)).($showsoc ? '&showsoc='.urlencode((string) ($showsoc)) : ''); |
1449
|
1449
|
|
1450
|
1450
|
$out .= '<!-- force css to be higher than dialog popup --><style type="text/css">.ui-autocomplete { z-index: 1010; }</style>'; |
1451
|
1451
|
|
1452
|
|
- $out .= '<input type="text" class="' . $morecss . '" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . ($placeholder ? ' placeholder="' . dol_escape_htmltag($placeholder) . '"' : '') . ' ' . (getDolGlobalString('CONTACT_SEARCH_AUTOFOCUS') ? 'autofocus' : '') . ' />'; |
|
1452
|
+ $out .= '<input type="text" class="'.$morecss.'" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.($placeholder ? ' placeholder="'.dol_escape_htmltag($placeholder).'"' : '').' '.(getDolGlobalString('CONTACT_SEARCH_AUTOFOCUS') ? 'autofocus' : '').' />'; |
1453
|
1453
|
|
1454
|
1454
|
$out .= ajax_event($htmlname, $events); |
1455
|
1455
|
|
|
@@ -1546,30 +1546,30 @@ discard block |
|
|
block discarded – undo |
1546
|
1546
|
$sql .= ", s.address, s.zip, s.town"; |
1547
|
1547
|
$sql .= ", dictp.code as country_code"; |
1548
|
1548
|
} |
1549
|
|
- $sql .= " FROM " . $this->db->prefix() . "societe as s"; |
|
1549
|
+ $sql .= " FROM ".$this->db->prefix()."societe as s"; |
1550
|
1550
|
if (getDolGlobalString('COMPANY_SHOW_ADDRESS_SELECTLIST')) { |
1551
|
|
- $sql .= " LEFT JOIN " . $this->db->prefix() . "c_country as dictp ON dictp.rowid = s.fk_pays"; |
|
1551
|
+ $sql .= " LEFT JOIN ".$this->db->prefix()."c_country as dictp ON dictp.rowid = s.fk_pays"; |
1552
|
1552
|
} |
1553
|
1553
|
if (!$user->hasRight('societe', 'client', 'voir')) { |
1554
|
|
- $sql .= ", " . $this->db->prefix() . "societe_commerciaux as sc"; |
|
1554
|
+ $sql .= ", ".$this->db->prefix()."societe_commerciaux as sc"; |
1555
|
1555
|
} |
1556
|
|
- $sql .= " WHERE s.entity IN (" . getEntity('societe') . ")"; |
|
1556
|
+ $sql .= " WHERE s.entity IN (".getEntity('societe').")"; |
1557
|
1557
|
if (!empty($user->socid)) { |
1558
|
|
- $sql .= " AND s.rowid = " . ((int) $user->socid); |
|
1558
|
+ $sql .= " AND s.rowid = ".((int) $user->socid); |
1559
|
1559
|
} |
1560
|
1560
|
if ($filter) { |
1561
|
1561
|
// $filter is safe because, if it contains '(' or ')', it has been sanitized by testSqlAndScriptInject() and forgeSQLFromUniversalSearchCriteria() |
1562
|
1562
|
// if not, by testSqlAndScriptInject() only. |
1563
|
|
- $sql .= " AND (" . $filter . ")"; |
|
1563
|
+ $sql .= " AND (".$filter.")"; |
1564
|
1564
|
} |
1565
|
1565
|
if (!$user->hasRight('societe', 'client', 'voir')) { |
1566
|
|
- $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " . ((int) $user->id); |
|
1566
|
+ $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id); |
1567
|
1567
|
} |
1568
|
1568
|
if (getDolGlobalString('COMPANY_HIDE_INACTIVE_IN_COMBOBOX')) { |
1569
|
1569
|
$sql .= " AND s.status <> 0"; |
1570
|
1570
|
} |
1571
|
1571
|
if (!empty($excludeids)) { |
1572
|
|
- $sql .= " AND s.rowid NOT IN (" . $this->db->sanitize(implode(',', $excludeids)) . ")"; |
|
1572
|
+ $sql .= " AND s.rowid NOT IN (".$this->db->sanitize(implode(',', $excludeids)).")"; |
1573
|
1573
|
} |
1574
|
1574
|
// Add where from hooks |
1575
|
1575
|
$parameters = array(); |
|
@@ -1589,17 +1589,17 @@ discard block |
|
|
block discarded – undo |
1589
|
1589
|
if ($i > 0) { |
1590
|
1590
|
$sql .= " AND "; |
1591
|
1591
|
} |
1592
|
|
- $sql .= "(s.nom LIKE '" . $this->db->escape($prefix . $crit) . "%')"; |
|
1592
|
+ $sql .= "(s.nom LIKE '".$this->db->escape($prefix.$crit)."%')"; |
1593
|
1593
|
$i++; |
1594
|
1594
|
} |
1595
|
1595
|
if (count($search_crit) > 1) { |
1596
|
1596
|
$sql .= ")"; |
1597
|
1597
|
} |
1598
|
1598
|
if (isModEnabled('barcode')) { |
1599
|
|
- $sql .= " OR s.barcode LIKE '" . $this->db->escape($prefix . $filterkey) . "%'"; |
|
1599
|
+ $sql .= " OR s.barcode LIKE '".$this->db->escape($prefix.$filterkey)."%'"; |
1600
|
1600
|
} |
1601
|
|
- $sql .= " OR s.code_client LIKE '" . $this->db->escape($prefix . $filterkey) . "%' OR s.code_fournisseur LIKE '" . $this->db->escape($prefix . $filterkey) . "%'"; |
1602
|
|
- $sql .= " OR s.name_alias LIKE '" . $this->db->escape($prefix . $filterkey) . "%' OR s.tva_intra LIKE '" . $this->db->escape($prefix . $filterkey) . "%'"; |
|
1601
|
+ $sql .= " OR s.code_client LIKE '".$this->db->escape($prefix.$filterkey)."%' OR s.code_fournisseur LIKE '".$this->db->escape($prefix.$filterkey)."%'"; |
|
1602
|
+ $sql .= " OR s.name_alias LIKE '".$this->db->escape($prefix.$filterkey)."%' OR s.tva_intra LIKE '".$this->db->escape($prefix.$filterkey)."%'"; |
1603
|
1603
|
$sql .= ")"; |
1604
|
1604
|
} |
1605
|
1605
|
$sql .= $this->db->order("nom", "ASC"); |
|
@@ -1610,7 +1610,7 @@ discard block |
|
|
block discarded – undo |
1610
|
1610
|
$resql = $this->db->query($sql); |
1611
|
1611
|
if ($resql) { |
1612
|
1612
|
// Construct $out and $outarray |
1613
|
|
- $out .= '<select id="' . $htmlname . '" class="flat' . ($morecss ? ' ' . $morecss : '') . '"' . ($moreparam ? ' ' . $moreparam : '') . ' name="' . $htmlname . ($multiple ? '[]' : '') . '" ' . ($multiple ? 'multiple' : '') . '>' . "\n"; |
|
1613
|
+ $out .= '<select id="'.$htmlname.'" class="flat'.($morecss ? ' '.$morecss : '').'"'.($moreparam ? ' '.$moreparam : '').' name="'.$htmlname.($multiple ? '[]' : '').'" '.($multiple ? 'multiple' : '').'>'."\n"; |
1614
|
1614
|
|
1615
|
1615
|
$textifempty = (($showempty && !is_numeric($showempty)) ? $langs->trans($showempty) : ''); |
1616
|
1616
|
if (getDolGlobalString('COMPANY_USE_SEARCH_TO_SELECT')) { |
|
@@ -1623,7 +1623,7 @@ discard block |
|
|
block discarded – undo |
1623
|
1623
|
} |
1624
|
1624
|
} |
1625
|
1625
|
if ($showempty) { |
1626
|
|
- $out .= '<option value="-1" data-html="' . dol_escape_htmltag('<span class="opacitymedium">' . ($textifempty ? $textifempty : ' ') . '</span>') . '">' . $textifempty . '</option>' . "\n"; |
|
1626
|
+ $out .= '<option value="-1" data-html="'.dol_escape_htmltag('<span class="opacitymedium">'.($textifempty ? $textifempty : ' ').'</span>').'">'.$textifempty.'</option>'."\n"; |
1627
|
1627
|
} |
1628
|
1628
|
|
1629
|
1629
|
$companytemp = new Societe($this->db); |
|
@@ -1636,18 +1636,18 @@ discard block |
|
|
block discarded – undo |
1636
|
1636
|
$label = ''; |
1637
|
1637
|
if ($showcode || getDolGlobalString('SOCIETE_ADD_REF_IN_LIST')) { |
1638
|
1638
|
if (($obj->client) && (!empty($obj->code_client))) { |
1639
|
|
- $label = $obj->code_client . ' - '; |
|
1639
|
+ $label = $obj->code_client.' - '; |
1640
|
1640
|
} |
1641
|
1641
|
if (($obj->fournisseur) && (!empty($obj->code_fournisseur))) { |
1642
|
|
- $label .= $obj->code_fournisseur . ' - '; |
|
1642
|
+ $label .= $obj->code_fournisseur.' - '; |
1643
|
1643
|
} |
1644
|
|
- $label .= ' ' . $obj->name; |
|
1644
|
+ $label .= ' '.$obj->name; |
1645
|
1645
|
} else { |
1646
|
1646
|
$label = $obj->name; |
1647
|
1647
|
} |
1648
|
1648
|
|
1649
|
1649
|
if (!empty($obj->name_alias)) { |
1650
|
|
- $label .= ' (' . $obj->name_alias . ')'; |
|
1650
|
+ $label .= ' ('.$obj->name_alias.')'; |
1651
|
1651
|
} |
1652
|
1652
|
|
1653
|
1653
|
if (getDolGlobalString('SOCIETE_SHOW_VAT_IN_LIST') && !empty($obj->tva_intra)) { |
|
@@ -1662,7 +1662,7 @@ discard block |
|
|
block discarded – undo |
1662
|
1662
|
$companytemp->fournisseur = $obj->fournisseur; |
1663
|
1663
|
$tmptype = $companytemp->getTypeUrl(1, '', 0, 'span'); |
1664
|
1664
|
if ($tmptype) { |
1665
|
|
- $labelhtml .= ' ' . $tmptype; |
|
1665
|
+ $labelhtml .= ' '.$tmptype; |
1666
|
1666
|
} |
1667
|
1667
|
|
1668
|
1668
|
if ($obj->client || $obj->fournisseur) { |
|
@@ -1672,10 +1672,10 @@ discard block |
|
|
block discarded – undo |
1672
|
1672
|
$label .= $langs->trans("Customer"); |
1673
|
1673
|
} |
1674
|
1674
|
if ($obj->client == 2 || $obj->client == 3) { |
1675
|
|
- $label .= ($obj->client == 3 ? ', ' : '') . $langs->trans("Prospect"); |
|
1675
|
+ $label .= ($obj->client == 3 ? ', ' : '').$langs->trans("Prospect"); |
1676
|
1676
|
} |
1677
|
1677
|
if ($obj->fournisseur) { |
1678
|
|
- $label .= ($obj->client ? ', ' : '') . $langs->trans("Supplier"); |
|
1678
|
+ $label .= ($obj->client ? ', ' : '').$langs->trans("Supplier"); |
1679
|
1679
|
} |
1680
|
1680
|
if ($obj->client || $obj->fournisseur) { |
1681
|
1681
|
$label .= ')'; |
|
@@ -1683,9 +1683,9 @@ discard block |
|
|
block discarded – undo |
1683
|
1683
|
} |
1684
|
1684
|
|
1685
|
1685
|
if (getDolGlobalString('COMPANY_SHOW_ADDRESS_SELECTLIST')) { |
1686
|
|
- $s = ($obj->address ? ' - ' . $obj->address : '') . ($obj->zip ? ' - ' . $obj->zip : '') . ($obj->town ? ' ' . $obj->town : ''); |
|
1686
|
+ $s = ($obj->address ? ' - '.$obj->address : '').($obj->zip ? ' - '.$obj->zip : '').($obj->town ? ' '.$obj->town : ''); |
1687
|
1687
|
if (!empty($obj->country_code)) { |
1688
|
|
- $s .= ', ' . $langs->trans('Country' . $obj->country_code); |
|
1688
|
+ $s .= ', '.$langs->trans('Country'.$obj->country_code); |
1689
|
1689
|
} |
1690
|
1690
|
$label .= $s; |
1691
|
1691
|
$labelhtml .= $s; |
|
@@ -1693,9 +1693,9 @@ discard block |
|
|
block discarded – undo |
1693
|
1693
|
|
1694
|
1694
|
if (empty($outputmode)) { |
1695
|
1695
|
if (in_array($obj->rowid, $selected)) { |
1696
|
|
- $out .= '<option value="' . $obj->rowid . '" selected data-html="' . dol_escape_htmltag($labelhtml, 0, 0, '', 0, 1) . '">' . dol_escape_htmltag($label, 0, 0, '', 0, 1) . '</option>'; |
|
1696
|
+ $out .= '<option value="'.$obj->rowid.'" selected data-html="'.dol_escape_htmltag($labelhtml, 0, 0, '', 0, 1).'">'.dol_escape_htmltag($label, 0, 0, '', 0, 1).'</option>'; |
1697
|
1697
|
} else { |
1698
|
|
- $out .= '<option value="' . $obj->rowid . '" data-html="' . dol_escape_htmltag($labelhtml, 0, 0, '', 0, 1) . '">' . dol_escape_htmltag($label, 0, 0, '', 0, 1) . '</option>'; |
|
1698
|
+ $out .= '<option value="'.$obj->rowid.'" data-html="'.dol_escape_htmltag($labelhtml, 0, 0, '', 0, 1).'">'.dol_escape_htmltag($label, 0, 0, '', 0, 1).'</option>'; |
1699
|
1699
|
} |
1700
|
1700
|
} else { |
1701
|
1701
|
array_push($outarray, array('key' => $obj->rowid, 'value' => $label, 'label' => $label, 'labelhtml' => $labelhtml)); |
|
@@ -1707,9 +1707,9 @@ discard block |
|
|
block discarded – undo |
1707
|
1707
|
} |
1708
|
1708
|
} |
1709
|
1709
|
} |
1710
|
|
- $out .= '</select>' . "\n"; |
|
1710
|
+ $out .= '</select>'."\n"; |
1711
|
1711
|
if (!$forcecombo) { |
1712
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
1712
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
1713
|
1713
|
$out .= ajax_combobox($htmlname, $events, getDolGlobalInt("COMPANY_USE_SEARCH_TO_SELECT")); |
1714
|
1714
|
} |
1715
|
1715
|
} else { |
|
@@ -1799,7 +1799,7 @@ discard block |
|
|
block discarded – undo |
1799
|
1799
|
} |
1800
|
1800
|
|
1801
|
1801
|
if (!is_object($hookmanager)) { |
1802
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/class/hookmanager.class.php'; |
|
1802
|
+ include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; |
1803
|
1803
|
$hookmanager = new HookManager($this->db); |
1804
|
1804
|
} |
1805
|
1805
|
|
|
@@ -1808,13 +1808,13 @@ discard block |
|
|
block discarded – undo |
1808
|
1808
|
if ($showsoc > 0 || getDolGlobalString('CONTACT_SHOW_EMAIL_PHONE_TOWN_SELECTLIST')) { |
1809
|
1809
|
$sql .= ", s.nom as company, s.town AS company_town"; |
1810
|
1810
|
} |
1811
|
|
- $sql .= " FROM " . $this->db->prefix() . "socpeople as sp"; |
|
1811
|
+ $sql .= " FROM ".$this->db->prefix()."socpeople as sp"; |
1812
|
1812
|
if ($showsoc > 0 || getDolGlobalString('CONTACT_SHOW_EMAIL_PHONE_TOWN_SELECTLIST')) { |
1813
|
|
- $sql .= " LEFT OUTER JOIN " . $this->db->prefix() . "societe as s ON s.rowid=sp.fk_soc"; |
|
1813
|
+ $sql .= " LEFT OUTER JOIN ".$this->db->prefix()."societe as s ON s.rowid=sp.fk_soc"; |
1814
|
1814
|
} |
1815
|
|
- $sql .= " WHERE sp.entity IN (" . getEntity('contact') . ")"; |
|
1815
|
+ $sql .= " WHERE sp.entity IN (".getEntity('contact').")"; |
1816
|
1816
|
if ($socid > 0 || $socid == -1) { |
1817
|
|
- $sql .= " AND sp.fk_soc = " . ((int) $socid); |
|
1817
|
+ $sql .= " AND sp.fk_soc = ".((int) $socid); |
1818
|
1818
|
} |
1819
|
1819
|
if (getDolGlobalString('CONTACT_HIDE_INACTIVE_IN_COMBOBOX')) { |
1820
|
1820
|
$sql .= " AND sp.statut <> 0"; |
|
@@ -1822,7 +1822,7 @@ discard block |
|
|
block discarded – undo |
1822
|
1822
|
if ($filter) { |
1823
|
1823
|
// $filter is safe because, if it contains '(' or ')', it has been sanitized by testSqlAndScriptInject() and forgeSQLFromUniversalSearchCriteria() |
1824
|
1824
|
// if not, by testSqlAndScriptInject() only. |
1825
|
|
- $sql .= " AND (" . $filter . ")"; |
|
1825
|
+ $sql .= " AND (".$filter.")"; |
1826
|
1826
|
} |
1827
|
1827
|
// Add where from hooks |
1828
|
1828
|
$parameters = array(); |
|
@@ -1830,30 +1830,30 @@ discard block |
|
|
block discarded – undo |
1830
|
1830
|
$sql .= $hookmanager->resPrint; |
1831
|
1831
|
$sql .= " ORDER BY sp.lastname ASC"; |
1832
|
1832
|
|
1833
|
|
- dol_syslog(get_class($this) . "::selectcontacts", LOG_DEBUG); |
|
1833
|
+ dol_syslog(get_class($this)."::selectcontacts", LOG_DEBUG); |
1834
|
1834
|
$resql = $this->db->query($sql); |
1835
|
1835
|
if ($resql) { |
1836
|
1836
|
$num = $this->db->num_rows($resql); |
1837
|
1837
|
|
1838
|
1838
|
if ($htmlname != 'none' && !$options_only) { |
1839
|
|
- $out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" id="' . $htmlid . '" name="' . $htmlname . ($multiple ? '[]' : '') . '" ' . (($num || empty($disableifempty)) ? '' : ' disabled') . ($multiple ? 'multiple' : '') . ' ' . (!empty($moreparam) ? $moreparam : '') . '>'; |
|
1839
|
+ $out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" id="'.$htmlid.'" name="'.$htmlname.($multiple ? '[]' : '').'" '.(($num || empty($disableifempty)) ? '' : ' disabled').($multiple ? 'multiple' : '').' '.(!empty($moreparam) ? $moreparam : '').'>'; |
1840
|
1840
|
} |
1841
|
1841
|
|
1842
|
1842
|
if ($showempty && !is_numeric($showempty)) { |
1843
|
1843
|
$textforempty = $showempty; |
1844
|
|
- $out .= '<option class="optiongrey" value="-1"' . (in_array(-1, $selected) ? ' selected' : '') . '>' . $textforempty . '</option>'; |
|
1844
|
+ $out .= '<option class="optiongrey" value="-1"'.(in_array(-1, $selected) ? ' selected' : '').'>'.$textforempty.'</option>'; |
1845
|
1845
|
} else { |
1846
|
1846
|
if (($showempty == 1 || ($showempty == 3 && $num > 1)) && !$multiple) { |
1847
|
|
- $out .= '<option value="0"' . (in_array(0, $selected) ? ' selected' : '') . '> </option>'; |
|
1847
|
+ $out .= '<option value="0"'.(in_array(0, $selected) ? ' selected' : '').'> </option>'; |
1848
|
1848
|
} |
1849
|
1849
|
if ($showempty == 2) { |
1850
|
|
- $out .= '<option value="0"' . (in_array(0, $selected) ? ' selected' : '') . '>-- ' . $langs->trans("Internal") . ' --</option>'; |
|
1850
|
+ $out .= '<option value="0"'.(in_array(0, $selected) ? ' selected' : '').'>-- '.$langs->trans("Internal").' --</option>'; |
1851
|
1851
|
} |
1852
|
1852
|
} |
1853
|
1853
|
|
1854
|
1854
|
$i = 0; |
1855
|
1855
|
if ($num) { |
1856
|
|
- include_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php'; |
|
1856
|
+ include_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; |
1857
|
1857
|
$contactstatic = new Contact($this->db); |
1858
|
1858
|
|
1859
|
1859
|
while ($i < $num) { |
|
@@ -1889,7 +1889,7 @@ discard block |
|
|
block discarded – undo |
1889
|
1889
|
} |
1890
|
1890
|
$extendedInfos = implode(' - ', $extendedInfos); |
1891
|
1891
|
if (!empty($extendedInfos)) { |
1892
|
|
- $extendedInfos = ' - ' . $extendedInfos; |
|
1892
|
+ $extendedInfos = ' - '.$extendedInfos; |
1893
|
1893
|
} |
1894
|
1894
|
} |
1895
|
1895
|
|
|
@@ -1907,35 +1907,35 @@ discard block |
|
|
block discarded – undo |
1907
|
1907
|
$disabled = 1; |
1908
|
1908
|
} |
1909
|
1909
|
if (!empty($selected) && in_array($obj->rowid, $selected)) { |
1910
|
|
- $out .= '<option value="' . $obj->rowid . '"'; |
|
1910
|
+ $out .= '<option value="'.$obj->rowid.'"'; |
1911
|
1911
|
if ($disabled) { |
1912
|
1912
|
$out .= ' disabled'; |
1913
|
1913
|
} |
1914
|
1914
|
$out .= ' selected>'; |
1915
|
1915
|
|
1916
|
|
- $tmplabel = $contactstatic->getFullName($langs) . $extendedInfos; |
|
1916
|
+ $tmplabel = $contactstatic->getFullName($langs).$extendedInfos; |
1917
|
1917
|
if ($showfunction && $obj->poste) { |
1918
|
|
- $tmplabel .= ' (' . $obj->poste . ')'; |
|
1918
|
+ $tmplabel .= ' ('.$obj->poste.')'; |
1919
|
1919
|
} |
1920
|
1920
|
if (($showsoc > 0) && $obj->company) { |
1921
|
|
- $tmplabel .= ' - (' . $obj->company . ')'; |
|
1921
|
+ $tmplabel .= ' - ('.$obj->company.')'; |
1922
|
1922
|
} |
1923
|
1923
|
|
1924
|
1924
|
$out .= $tmplabel; |
1925
|
1925
|
$out .= '</option>'; |
1926
|
1926
|
} else { |
1927
|
|
- $out .= '<option value="' . $obj->rowid . '"'; |
|
1927
|
+ $out .= '<option value="'.$obj->rowid.'"'; |
1928
|
1928
|
if ($disabled) { |
1929
|
1929
|
$out .= ' disabled'; |
1930
|
1930
|
} |
1931
|
1931
|
$out .= '>'; |
1932
|
1932
|
|
1933
|
|
- $tmplabel = $contactstatic->getFullName($langs) . $extendedInfos; |
|
1933
|
+ $tmplabel = $contactstatic->getFullName($langs).$extendedInfos; |
1934
|
1934
|
if ($showfunction && $obj->poste) { |
1935
|
|
- $tmplabel .= ' (' . $obj->poste . ')'; |
|
1935
|
+ $tmplabel .= ' ('.$obj->poste.')'; |
1936
|
1936
|
} |
1937
|
1937
|
if (($showsoc > 0) && $obj->company) { |
1938
|
|
- $tmplabel .= ' - (' . $obj->company . ')'; |
|
1938
|
+ $tmplabel .= ' - ('.$obj->company.')'; |
1939
|
1939
|
} |
1940
|
1940
|
|
1941
|
1941
|
$out .= $tmplabel; |
|
@@ -1943,12 +1943,12 @@ discard block |
|
|
block discarded – undo |
1943
|
1943
|
} |
1944
|
1944
|
} else { |
1945
|
1945
|
if (in_array($obj->rowid, $selected)) { |
1946
|
|
- $tmplabel = $contactstatic->getFullName($langs) . $extendedInfos; |
|
1946
|
+ $tmplabel = $contactstatic->getFullName($langs).$extendedInfos; |
1947
|
1947
|
if ($showfunction && $obj->poste) { |
1948
|
|
- $tmplabel .= ' (' . $obj->poste . ')'; |
|
1948
|
+ $tmplabel .= ' ('.$obj->poste.')'; |
1949
|
1949
|
} |
1950
|
1950
|
if (($showsoc > 0) && $obj->company) { |
1951
|
|
- $tmplabel .= ' - (' . $obj->company . ')'; |
|
1951
|
+ $tmplabel .= ' - ('.$obj->company.')'; |
1952
|
1952
|
} |
1953
|
1953
|
|
1954
|
1954
|
$out .= $tmplabel; |
|
@@ -1963,7 +1963,7 @@ discard block |
|
|
block discarded – undo |
1963
|
1963
|
} |
1964
|
1964
|
} else { |
1965
|
1965
|
$labeltoshow = ($socid != -1) ? ($langs->trans($socid ? "NoContactDefinedForThirdParty" : "NoContactDefined")) : $langs->trans('SelectAThirdPartyFirst'); |
1966
|
|
- $out .= '<option class="disabled" value="-1"' . (($showempty == 2 || $multiple) ? '' : ' selected') . ' disabled="disabled">'; |
|
1966
|
+ $out .= '<option class="disabled" value="-1"'.(($showempty == 2 || $multiple) ? '' : ' selected').' disabled="disabled">'; |
1967
|
1967
|
$out .= $labeltoshow; |
1968
|
1968
|
$out .= '</option>'; |
1969
|
1969
|
} |
|
@@ -1984,7 +1984,7 @@ discard block |
|
|
block discarded – undo |
1984
|
1984
|
} |
1985
|
1985
|
|
1986
|
1986
|
if ($conf->use_javascript_ajax && !$forcecombo && !$options_only) { |
1987
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
1987
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
1988
|
1988
|
$out .= ajax_combobox($htmlid, $events, getDolGlobalInt("CONTACT_USE_SEARCH_TO_SELECT")); |
1989
|
1989
|
} |
1990
|
1990
|
|
|
@@ -2023,18 +2023,18 @@ discard block |
|
|
block discarded – undo |
2023
|
2023
|
// On recherche les remises |
2024
|
2024
|
$sql = "SELECT re.rowid, re.amount_ht, re.amount_tva, re.amount_ttc,"; |
2025
|
2025
|
$sql .= " re.description, re.fk_facture_source"; |
2026
|
|
- $sql .= " FROM " . $this->db->prefix() . "societe_remise_except as re"; |
2027
|
|
- $sql .= " WHERE re.fk_soc = " . (int) $socid; |
2028
|
|
- $sql .= " AND re.entity = " . $conf->entity; |
|
2026
|
+ $sql .= " FROM ".$this->db->prefix()."societe_remise_except as re"; |
|
2027
|
+ $sql .= " WHERE re.fk_soc = ".(int) $socid; |
|
2028
|
+ $sql .= " AND re.entity = ".$conf->entity; |
2029
|
2029
|
if ($filter) { |
2030
|
|
- $sql .= " AND " . $filter; |
|
2030
|
+ $sql .= " AND ".$filter; |
2031
|
2031
|
} |
2032
|
2032
|
$sql .= " ORDER BY re.description ASC"; |
2033
|
2033
|
|
2034
|
|
- dol_syslog(get_class($this) . "::select_remises", LOG_DEBUG); |
|
2034
|
+ dol_syslog(get_class($this)."::select_remises", LOG_DEBUG); |
2035
|
2035
|
$resql = $this->db->query($sql); |
2036
|
2036
|
if ($resql) { |
2037
|
|
- print '<select id="select_' . $htmlname . '" class="flat maxwidthonsmartphone" name="' . $htmlname . '">'; |
|
2037
|
+ print '<select id="select_'.$htmlname.'" class="flat maxwidthonsmartphone" name="'.$htmlname.'">'; |
2038
|
2038
|
$num = $this->db->num_rows($resql); |
2039
|
2039
|
|
2040
|
2040
|
$qualifiedlines = $num; |
|
@@ -2072,16 +2072,16 @@ discard block |
|
|
block discarded – undo |
2072
|
2072
|
if (getDolGlobalString('MAIN_SHOW_FACNUMBER_IN_DISCOUNT_LIST') && !empty($obj->fk_facture_source)) { |
2073
|
2073
|
$tmpfac = new Facture($this->db); |
2074
|
2074
|
if ($tmpfac->fetch($obj->fk_facture_source) > 0) { |
2075
|
|
- $desc = $desc . ' - ' . $tmpfac->ref; |
|
2075
|
+ $desc = $desc.' - '.$tmpfac->ref; |
2076
|
2076
|
} |
2077
|
2077
|
} |
2078
|
2078
|
|
2079
|
|
- print '<option value="' . $obj->rowid . '"' . $selectstring . $disabled . '>' . $desc . ' (' . price($obj->amount_ht) . ' ' . $langs->trans("HT") . ' - ' . price($obj->amount_ttc) . ' ' . $langs->trans("TTC") . ')</option>'; |
|
2079
|
+ print '<option value="'.$obj->rowid.'"'.$selectstring.$disabled.'>'.$desc.' ('.price($obj->amount_ht).' '.$langs->trans("HT").' - '.price($obj->amount_ttc).' '.$langs->trans("TTC").')</option>'; |
2080
|
2080
|
$i++; |
2081
|
2081
|
} |
2082
|
2082
|
} |
2083
|
2083
|
print '</select>'; |
2084
|
|
- print ajax_combobox('select_' . $htmlname); |
|
2084
|
+ print ajax_combobox('select_'.$htmlname); |
2085
|
2085
|
|
2086
|
2086
|
return $qualifiedlines; |
2087
|
2087
|
} else { |
|
@@ -2188,14 +2188,14 @@ discard block |
|
|
block discarded – undo |
2188
|
2188
|
if ($showlabelofentity) { |
2189
|
2189
|
$sql .= ", e.label"; |
2190
|
2190
|
} |
2191
|
|
- $sql .= " FROM " . $this->db->prefix() . "user as u"; |
|
2191
|
+ $sql .= " FROM ".$this->db->prefix()."user as u"; |
2192
|
2192
|
if ($showlabelofentity) { |
2193
|
|
- $sql .= " LEFT JOIN " . $this->db->prefix() . "entity as e ON e.rowid = u.entity"; |
|
2193
|
+ $sql .= " LEFT JOIN ".$this->db->prefix()."entity as e ON e.rowid = u.entity"; |
2194
|
2194
|
} |
2195
|
2195
|
// Condition here should be the same than into societe->getSalesRepresentatives(). |
2196
|
2196
|
if ($userissuperadminentityone && $force_entity != 'default') { |
2197
|
2197
|
if (!empty($force_entity)) { |
2198
|
|
- $sql .= " WHERE u.entity IN (0, " . $this->db->sanitize($force_entity) . ")"; |
|
2198
|
+ $sql .= " WHERE u.entity IN (0, ".$this->db->sanitize($force_entity).")"; |
2199
|
2199
|
} else { |
2200
|
2200
|
$sql .= " WHERE u.entity IS NOT NULL"; |
2201
|
2201
|
} |
|
@@ -2203,18 +2203,18 @@ discard block |
|
|
block discarded – undo |
2203
|
2203
|
if (isModEnabled('multicompany') && getDolGlobalInt('MULTICOMPANY_TRANSVERSE_MODE')) { |
2204
|
2204
|
$sql .= " WHERE u.rowid IN (SELECT ug.fk_user FROM ".$this->db->prefix()."usergroup_user as ug WHERE ug.entity IN (".getEntity('usergroup')."))"; |
2205
|
2205
|
} else { |
2206
|
|
- $sql .= " WHERE u.entity IN (" . getEntity('user') . ")"; |
|
2206
|
+ $sql .= " WHERE u.entity IN (".getEntity('user').")"; |
2207
|
2207
|
} |
2208
|
2208
|
} |
2209
|
2209
|
|
2210
|
2210
|
if (!empty($user->socid)) { |
2211
|
|
- $sql .= " AND u.fk_soc = " . ((int) $user->socid); |
|
2211
|
+ $sql .= " AND u.fk_soc = ".((int) $user->socid); |
2212
|
2212
|
} |
2213
|
2213
|
if (is_array($exclude) && $excludeUsers) { |
2214
|
|
- $sql .= " AND u.rowid NOT IN (" . $this->db->sanitize($excludeUsers) . ")"; |
|
2214
|
+ $sql .= " AND u.rowid NOT IN (".$this->db->sanitize($excludeUsers).")"; |
2215
|
2215
|
} |
2216
|
2216
|
if ($includeUsers) { |
2217
|
|
- $sql .= " AND u.rowid IN (" . $this->db->sanitize($includeUsers) . ")"; |
|
2217
|
+ $sql .= " AND u.rowid IN (".$this->db->sanitize($includeUsers).")"; |
2218
|
2218
|
} |
2219
|
2219
|
if (getDolGlobalString('USER_HIDE_INACTIVE_IN_COMBOBOX') || $notdisabled) { |
2220
|
2220
|
$sql .= " AND u.statut <> 0"; |
|
@@ -2226,7 +2226,7 @@ discard block |
|
|
block discarded – undo |
2226
|
2226
|
$sql .= " AND u.fk_soc IS NULL"; |
2227
|
2227
|
} |
2228
|
2228
|
if (!empty($morefilter)) { |
2229
|
|
- $sql .= " " . $morefilter; |
|
2229
|
+ $sql .= " ".$morefilter; |
2230
|
2230
|
} |
2231
|
2231
|
|
2232
|
2232
|
//Add hook to filter on user (for example on usergroup define in custom modules) |
|
@@ -2241,7 +2241,7 @@ discard block |
|
|
block discarded – undo |
2241
|
2241
|
$sql .= " ORDER BY u.statut DESC, u.lastname ASC, u.firstname ASC"; |
2242
|
2242
|
} |
2243
|
2243
|
|
2244
|
|
- dol_syslog(get_class($this) . "::select_dolusers", LOG_DEBUG); |
|
2244
|
+ dol_syslog(get_class($this)."::select_dolusers", LOG_DEBUG); |
2245
|
2245
|
|
2246
|
2246
|
$resql = $this->db->query($sql); |
2247
|
2247
|
if ($resql) { |
|
@@ -2249,7 +2249,7 @@ discard block |
|
|
block discarded – undo |
2249
|
2249
|
$i = 0; |
2250
|
2250
|
if ($num) { |
2251
|
2251
|
// do not use maxwidthonsmartphone by default. Set it by caller so auto size to 100% will work when not defined |
2252
|
|
- $out .= '<select class="flat' . ($morecss ? ' ' . $morecss : ' minwidth200') . '" id="' . $htmlname . '" name="' . $htmlname . ($multiple ? '[]' : '') . '" ' . ($multiple ? 'multiple' : '') . ' ' . ($disabled ? ' disabled' : '') . '>'; |
|
2252
|
+ $out .= '<select class="flat'.($morecss ? ' '.$morecss : ' minwidth200').'" id="'.$htmlname.'" name="'.$htmlname.($multiple ? '[]' : '').'" '.($multiple ? 'multiple' : '').' '.($disabled ? ' disabled' : '').'>'; |
2253
|
2253
|
if ($show_empty && !$multiple) { |
2254
|
2254
|
$textforempty = ' '; |
2255
|
2255
|
if (!empty($conf->use_javascript_ajax)) { |
|
@@ -2258,10 +2258,10 @@ discard block |
|
|
block discarded – undo |
2258
|
2258
|
if (!is_numeric($show_empty)) { |
2259
|
2259
|
$textforempty = $show_empty; |
2260
|
2260
|
} |
2261
|
|
- $out .= '<option class="optiongrey" value="' . ($show_empty < 0 ? $show_empty : -1) . '"' . ((empty($selected) || in_array(-1, $selected)) ? ' selected' : '') . '>' . $textforempty . '</option>' . "\n"; |
|
2261
|
+ $out .= '<option class="optiongrey" value="'.($show_empty < 0 ? $show_empty : -1).'"'.((empty($selected) || in_array(-1, $selected)) ? ' selected' : '').'>'.$textforempty.'</option>'."\n"; |
2262
|
2262
|
} |
2263
|
2263
|
if ($show_every) { |
2264
|
|
- $out .= '<option value="-2"' . ((in_array(-2, $selected)) ? ' selected' : '') . '>-- ' . $langs->trans("Everybody") . ' --</option>' . "\n"; |
|
2264
|
+ $out .= '<option value="-2"'.((in_array(-2, $selected)) ? ' selected' : '').'>-- '.$langs->trans("Everybody").' --</option>'."\n"; |
2265
|
2265
|
} |
2266
|
2266
|
|
2267
|
2267
|
$userstatic = new User($this->db); |
|
@@ -2308,21 +2308,21 @@ discard block |
|
|
block discarded – undo |
2308
|
2308
|
} |
2309
|
2309
|
if ($showstatus >= 0) { |
2310
|
2310
|
if ($obj->status == 1 && $showstatus == 1) { |
2311
|
|
- $moreinfo .= ($moreinfo ? ' - ' : ' (') . $langs->trans('Enabled'); |
2312
|
|
- $moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(') . $langs->trans('Enabled'); |
|
2311
|
+ $moreinfo .= ($moreinfo ? ' - ' : ' (').$langs->trans('Enabled'); |
|
2312
|
+ $moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(').$langs->trans('Enabled'); |
2313
|
2313
|
} |
2314
|
2314
|
if ($obj->status == 0 && $showstatus == 1) { |
2315
|
|
- $moreinfo .= ($moreinfo ? ' - ' : ' (') . $langs->trans('Disabled'); |
2316
|
|
- $moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(') . $langs->trans('Disabled'); |
|
2315
|
+ $moreinfo .= ($moreinfo ? ' - ' : ' (').$langs->trans('Disabled'); |
|
2316
|
+ $moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(').$langs->trans('Disabled'); |
2317
|
2317
|
} |
2318
|
2318
|
} |
2319
|
2319
|
if ($showlabelofentity) { |
2320
|
2320
|
if (empty($obj->entity)) { |
2321
|
|
- $moreinfo .= ($moreinfo ? ' - ' : ' (') . $langs->trans("AllEntities"); |
2322
|
|
- $moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(') . $langs->trans("AllEntities"); |
|
2321
|
+ $moreinfo .= ($moreinfo ? ' - ' : ' (').$langs->trans("AllEntities"); |
|
2322
|
+ $moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(').$langs->trans("AllEntities"); |
2323
|
2323
|
} else { |
2324
|
2324
|
if ($obj->entity != $conf->entity) { |
2325
|
|
- $moreinfo .= ($moreinfo ? ' - ' : ' (') . ($obj->label ? $obj->label : $langs->trans("EntityNameNotDefined")); |
|
2325
|
+ $moreinfo .= ($moreinfo ? ' - ' : ' (').($obj->label ? $obj->label : $langs->trans("EntityNameNotDefined")); |
2326
|
2326
|
$moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(').($obj->label ? $obj->label : $langs->trans("EntityNameNotDefined")); |
2327
|
2327
|
} |
2328
|
2328
|
} |
|
@@ -2331,13 +2331,13 @@ discard block |
|
|
block discarded – undo |
2331
|
2331
|
$moreinfohtml .= (!empty($moreinfohtml) ? ')</span>' : ''); |
2332
|
2332
|
if (!empty($disableline) && $disableline != '1') { |
2333
|
2333
|
// Add text from $enableonlytext parameter |
2334
|
|
- $moreinfo .= ' - ' . $disableline; |
2335
|
|
- $moreinfohtml .= ' - ' . $disableline; |
|
2334
|
+ $moreinfo .= ' - '.$disableline; |
|
2335
|
+ $moreinfohtml .= ' - '.$disableline; |
2336
|
2336
|
} |
2337
|
2337
|
$labeltoshow .= $moreinfo; |
2338
|
2338
|
$labeltoshowhtml .= $moreinfohtml; |
2339
|
2339
|
|
2340
|
|
- $out .= '<option value="' . $obj->rowid . '"'; |
|
2340
|
+ $out .= '<option value="'.$obj->rowid.'"'; |
2341
|
2341
|
if (!empty($disableline)) { |
2342
|
2342
|
$out .= ' disabled'; |
2343
|
2343
|
} |
|
@@ -2345,7 +2345,7 @@ discard block |
|
|
block discarded – undo |
2345
|
2345
|
$out .= ' selected'; |
2346
|
2346
|
} |
2347
|
2347
|
$out .= ' data-html="'; |
2348
|
|
- $outhtml = $userstatic->getNomUrl(-3, '', 0, 1, 24, 1, 'login', '', 1) . ' '; |
|
2348
|
+ $outhtml = $userstatic->getNomUrl(-3, '', 0, 1, 24, 1, 'login', '', 1).' '; |
2349
|
2349
|
if ($showstatus >= 0 && $obj->status == 0) { |
2350
|
2350
|
$outhtml .= '<strike class="opacitymediumxxx">'; |
2351
|
2351
|
} |
|
@@ -2358,7 +2358,7 @@ discard block |
|
|
block discarded – undo |
2358
|
2358
|
$out .= $labeltoshow; |
2359
|
2359
|
$out .= '</option>'; |
2360
|
2360
|
|
2361
|
|
- $outarray[$userstatic->id] = $userstatic->getFullName($langs, $fullNameMode, -1, $maxlength) . $moreinfo; |
|
2361
|
+ $outarray[$userstatic->id] = $userstatic->getFullName($langs, $fullNameMode, -1, $maxlength).$moreinfo; |
2362
|
2362
|
$outarray2[$userstatic->id] = array( |
2363
|
2363
|
'id' => $userstatic->id, |
2364
|
2364
|
'label' => $labeltoshow, |
|
@@ -2370,14 +2370,14 @@ discard block |
|
|
block discarded – undo |
2370
|
2370
|
$i++; |
2371
|
2371
|
} |
2372
|
2372
|
} else { |
2373
|
|
- $out .= '<select class="flat" id="' . $htmlname . '" name="' . $htmlname . '" disabled>'; |
2374
|
|
- $out .= '<option value="">' . $langs->trans("None") . '</option>'; |
|
2373
|
+ $out .= '<select class="flat" id="'.$htmlname.'" name="'.$htmlname.'" disabled>'; |
|
2374
|
+ $out .= '<option value="">'.$langs->trans("None").'</option>'; |
2375
|
2375
|
} |
2376
|
2376
|
$out .= '</select>'; |
2377
|
2377
|
|
2378
|
2378
|
if ($num && !$forcecombo) { |
2379
|
2379
|
// Enhance with select2 |
2380
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
2380
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
2381
|
2381
|
$out .= ajax_combobox($htmlname); |
2382
|
2382
|
} |
2383
|
2383
|
} else { |
|
@@ -2451,16 +2451,16 @@ discard block |
|
|
block discarded – undo |
2451
|
2451
|
$out .= $userstatic->getNomUrl(-1); |
2452
|
2452
|
if ($i == 0) { |
2453
|
2453
|
$ownerid = $value['id']; |
2454
|
|
- $out .= ' (' . $langs->trans("Owner") . ')'; |
|
2454
|
+ $out .= ' ('.$langs->trans("Owner").')'; |
2455
|
2455
|
} |
2456
|
2456
|
if ($nbassignetouser > 1 && $action != 'view') { |
2457
|
|
- $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 . '">'; |
|
2457
|
+ $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.'">'; |
2458
|
2458
|
} |
2459
|
2459
|
// Show my availability |
2460
|
2460
|
if ($showproperties) { |
2461
|
2461
|
if ($ownerid == $value['id'] && is_array($listofuserid) && count($listofuserid) && in_array($ownerid, array_keys($listofuserid))) { |
2462
|
2462
|
$out .= '<div class="myavailability inline-block">'; |
2463
|
|
- $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>'; |
|
2463
|
+ $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>'; |
2464
|
2464
|
$out .= '</div>'; |
2465
|
2465
|
} |
2466
|
2466
|
} |
|
@@ -2477,15 +2477,15 @@ discard block |
|
|
block discarded – undo |
2477
|
2477
|
// Method with no ajax |
2478
|
2478
|
if ($action != 'view') { |
2479
|
2479
|
$out .= '<input type="hidden" class="removedassignedhidden" name="removedassigned" value="">'; |
2480
|
|
- $out .= '<script nonce="' . getNonce() . '" type="text/javascript">jQuery(document).ready(function () {'; |
|
2480
|
+ $out .= '<script nonce="'.getNonce().'" type="text/javascript">jQuery(document).ready(function () {'; |
2481
|
2481
|
$out .= 'jQuery(".removedassigned").click(function() { jQuery(".removedassignedhidden").val(jQuery(this).val()); });'; |
2482
|
2482
|
$out .= 'jQuery(".assignedtouser").change(function() { console.log(jQuery(".assignedtouser option:selected").val());'; |
2483
|
|
- $out .= ' if (jQuery(".assignedtouser option:selected").val() > 0) { jQuery("#' . $action . 'assignedtouser").attr("disabled", false); }'; |
2484
|
|
- $out .= ' else { jQuery("#' . $action . 'assignedtouser").attr("disabled", true); }'; |
|
2483
|
+ $out .= ' if (jQuery(".assignedtouser option:selected").val() > 0) { jQuery("#'.$action.'assignedtouser").attr("disabled", false); }'; |
|
2484
|
+ $out .= ' else { jQuery("#'.$action.'assignedtouser").attr("disabled", true); }'; |
2485
|
2485
|
$out .= '});'; |
2486
|
2486
|
$out .= '})</script>'; |
2487
|
2487
|
$out .= $this->select_dolusers('', $htmlname, $show_empty, $exclude, $disabled, $include, $enableonly, $force_entity, $maxlength, $showstatus, $morefilter); |
2488
|
|
- $out .= ' <input type="submit" disabled class="button valignmiddle smallpaddingimp reposition" id="' . $action . 'assignedtouser" name="' . $action . 'assignedtouser" value="' . dol_escape_htmltag($langs->trans("Add")) . '">'; |
|
2488
|
+ $out .= ' <input type="submit" disabled class="button valignmiddle smallpaddingimp reposition" id="'.$action.'assignedtouser" name="'.$action.'assignedtouser" value="'.dol_escape_htmltag($langs->trans("Add")).'">'; |
2489
|
2489
|
$out .= '<br>'; |
2490
|
2490
|
} |
2491
|
2491
|
|
|
@@ -2544,13 +2544,13 @@ discard block |
|
|
block discarded – undo |
2544
|
2544
|
$resourcestatic->fetch($value['id']); |
2545
|
2545
|
$out .= $resourcestatic->getNomUrl(-1); |
2546
|
2546
|
if ($nbassignetoresource > 1 && $action != 'view') { |
2547
|
|
- $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 . '">'; |
|
2547
|
+ $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.'">'; |
2548
|
2548
|
} |
2549
|
2549
|
// Show my availability |
2550
|
2550
|
if ($showproperties) { |
2551
|
2551
|
if (is_array($listofresourceid) && count($listofresourceid)) { |
2552
|
2552
|
$out .= '<div class="myavailability inline-block">'; |
2553
|
|
- $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>'; |
|
2553
|
+ $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>'; |
2554
|
2554
|
$out .= '</div>'; |
2555
|
2555
|
} |
2556
|
2556
|
} |
|
@@ -2567,11 +2567,11 @@ discard block |
|
|
block discarded – undo |
2567
|
2567
|
// Method with no ajax |
2568
|
2568
|
if ($action != 'view') { |
2569
|
2569
|
$out .= '<input type="hidden" class="removedassignedhidden" name="removedassignedresource" value="">'; |
2570
|
|
- $out .= '<script nonce="' . getNonce() . '" type="text/javascript">jQuery(document).ready(function () {'; |
|
2570
|
+ $out .= '<script nonce="'.getNonce().'" type="text/javascript">jQuery(document).ready(function () {'; |
2571
|
2571
|
$out .= 'jQuery(".removedassignedresource").click(function() { jQuery(".removedassignedresourcehidden").val(jQuery(this).val()); });'; |
2572
|
2572
|
$out .= 'jQuery(".assignedtoresource").change(function() { console.log(jQuery(".assignedtoresource option:selected").val());'; |
2573
|
|
- $out .= ' if (jQuery(".assignedtoresource option:selected").val() > 0) { jQuery("#' . $action . 'assignedtoresource").attr("disabled", false); }'; |
2574
|
|
- $out .= ' else { jQuery("#' . $action . 'assignedtoresource").attr("disabled", true); }'; |
|
2573
|
+ $out .= ' if (jQuery(".assignedtoresource option:selected").val() > 0) { jQuery("#'.$action.'assignedtoresource").attr("disabled", false); }'; |
|
2574
|
+ $out .= ' else { jQuery("#'.$action.'assignedtoresource").attr("disabled", true); }'; |
2575
|
2575
|
$out .= '});'; |
2576
|
2576
|
$out .= '})</script>'; |
2577
|
2577
|
|
|
@@ -2579,7 +2579,7 @@ discard block |
|
|
block discarded – undo |
2579
|
2579
|
$out .= img_picto('', 'resource', 'class="pictofixedwidth"'); |
2580
|
2580
|
$out .= $formresources->select_resource_list(0, $htmlname, [], 1, 1, 0, $events, array(), 2, 0); |
2581
|
2581
|
//$out .= $this->select_dolusers('', $htmlname, $show_empty, $exclude, $disabled, $include, $enableonly, $force_entity, $maxlength, $showstatus, $morefilter); |
2582
|
|
- $out .= ' <input type="submit" disabled class="button valignmiddle smallpaddingimp reposition" id="' . $action . 'assignedtoresource" name="' . $action . 'assignedtoresource" value="' . dol_escape_htmltag($langs->trans("Add")) . '">'; |
|
2582
|
+ $out .= ' <input type="submit" disabled class="button valignmiddle smallpaddingimp reposition" id="'.$action.'assignedtoresource" name="'.$action.'assignedtoresource" value="'.dol_escape_htmltag($langs->trans("Add")).'">'; |
2583
|
2583
|
$out .= '<br>'; |
2584
|
2584
|
} |
2585
|
2585
|
|
|
@@ -2641,7 +2641,7 @@ discard block |
|
|
block discarded – undo |
2641
|
2641
|
$placeholder = ''; |
2642
|
2642
|
|
2643
|
2643
|
if ($selected && empty($selected_input_value)) { |
2644
|
|
- require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; |
|
2644
|
+ require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; |
2645
|
2645
|
$producttmpselect = new Product($this->db); |
2646
|
2646
|
$producttmpselect->fetch($selected); |
2647
|
2647
|
$selected_input_value = $producttmpselect->ref; |
|
@@ -2656,17 +2656,17 @@ discard block |
|
|
block discarded – undo |
2656
|
2656
|
} |
2657
|
2657
|
} |
2658
|
2658
|
// mode=1 means customers products |
2659
|
|
- $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; |
2660
|
|
- $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/product/ajax/products.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions); |
|
2659
|
+ $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; |
|
2660
|
+ $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/product/ajax/products.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions); |
2661
|
2661
|
|
2662
|
2662
|
if (isModEnabled('variants') && is_array($selected_combinations)) { |
2663
|
2663
|
// Code to automatically insert with javascript the select of attributes under the select of product |
2664
|
2664
|
// when a parent of variant has been selected. |
2665
|
2665
|
$out .= ' |
2666
|
2666
|
<!-- script to auto show attributes select tags if a variant was selected --> |
2667
|
|
- <script nonce="' . getNonce() . '"> |
|
2667
|
+ <script nonce="' . getNonce().'"> |
2668
|
2668
|
// auto show attributes fields |
2669
|
|
- selected = ' . json_encode($selected_combinations) . '; |
|
2669
|
+ selected = ' . json_encode($selected_combinations).'; |
2670
|
2670
|
combvalues = {}; |
2671
|
2671
|
|
2672
|
2672
|
jQuery(document).ready(function () { |
|
@@ -2677,7 +2677,7 @@ discard block |
|
|
block discarded – undo |
2677
|
2677
|
} |
2678
|
2678
|
}); |
2679
|
2679
|
|
2680
|
|
- jQuery("input#' . $htmlname . '").change(function () { |
|
2680
|
+ jQuery("input#' . $htmlname.'").change(function () { |
2681
|
2681
|
|
2682
|
2682
|
if (!jQuery(this).val()) { |
2683
|
2683
|
jQuery(\'div#attributes_box\').empty(); |
|
@@ -2686,7 +2686,7 @@ discard block |
|
|
block discarded – undo |
2686
|
2686
|
|
2687
|
2687
|
console.log("A change has started. We get variants fields to inject html select"); |
2688
|
2688
|
|
2689
|
|
- jQuery.getJSON("' . DOL_URL_ROOT . '/variants/ajax/getCombinations.php", { |
|
2689
|
+ jQuery.getJSON("' . DOL_URL_ROOT.'/variants/ajax/getCombinations.php", { |
2690
|
2690
|
id: jQuery(this).val() |
2691
|
2691
|
}, function (data) { |
2692
|
2692
|
jQuery(\'div#attributes_box\').empty(); |
|
@@ -2729,21 +2729,21 @@ discard block |
|
|
block discarded – undo |
2729
|
2729
|
}) |
2730
|
2730
|
}); |
2731
|
2731
|
|
2732
|
|
- ' . ($selected ? 'jQuery("input#' . $htmlname . '").change();' : '') . ' |
|
2732
|
+ ' . ($selected ? 'jQuery("input#'.$htmlname.'").change();' : '').' |
2733
|
2733
|
}); |
2734
|
2734
|
</script> |
2735
|
2735
|
'; |
2736
|
2736
|
} |
2737
|
2737
|
|
2738
|
2738
|
if (empty($hidelabel)) { |
2739
|
|
- $out .= $langs->trans("RefOrLabel") . ' : '; |
|
2739
|
+ $out .= $langs->trans("RefOrLabel").' : '; |
2740
|
2740
|
} elseif ($hidelabel > 1) { |
2741
|
|
- $placeholder = ' placeholder="' . $langs->trans("RefOrLabel") . '"'; |
|
2741
|
+ $placeholder = ' placeholder="'.$langs->trans("RefOrLabel").'"'; |
2742
|
2742
|
if ($hidelabel == 2) { |
2743
|
2743
|
$out .= img_picto($langs->trans("Search"), 'search'); |
2744
|
2744
|
} |
2745
|
2745
|
} |
2746
|
|
- $out .= '<input type="text" class="minwidth100' . ($morecss ? ' ' . $morecss : '') . '" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . $placeholder . ' ' . (getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '') . ' />'; |
|
2746
|
+ $out .= '<input type="text" class="minwidth100'.($morecss ? ' '.$morecss : '').'" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' '.(getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '').' />'; |
2747
|
2747
|
if ($hidelabel == 3) { |
2748
|
2748
|
$out .= img_picto($langs->trans("Search"), 'search'); |
2749
|
2749
|
} |
|
@@ -2780,33 +2780,33 @@ discard block |
|
|
block discarded – undo |
2780
|
2780
|
// phpcs:enable |
2781
|
2781
|
global $db; |
2782
|
2782
|
|
2783
|
|
- require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; |
|
2783
|
+ require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; |
2784
|
2784
|
|
2785
|
2785
|
$error = 0; |
2786
|
2786
|
$out = ''; |
2787
|
2787
|
|
2788
|
2788
|
if (!$forcecombo) { |
2789
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
2789
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
2790
|
2790
|
$events = array(); |
2791
|
2791
|
$out .= ajax_combobox($htmlname, $events, getDolGlobalInt("PRODUIT_USE_SEARCH_TO_SELECT")); |
2792
|
2792
|
} |
2793
|
2793
|
|
2794
|
|
- $out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">'; |
|
2794
|
+ $out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">'; |
2795
|
2795
|
|
2796
|
2796
|
$sql = 'SELECT b.rowid, b.ref, b.label, b.fk_product'; |
2797
|
|
- $sql .= ' FROM ' . MAIN_DB_PREFIX . 'bom_bom as b'; |
2798
|
|
- $sql .= ' WHERE b.entity IN (' . getEntity('bom') . ')'; |
|
2797
|
+ $sql .= ' FROM '.MAIN_DB_PREFIX.'bom_bom as b'; |
|
2798
|
+ $sql .= ' WHERE b.entity IN ('.getEntity('bom').')'; |
2799
|
2799
|
if (!empty($status)) { |
2800
|
|
- $sql .= ' AND status = ' . (int) $status; |
|
2800
|
+ $sql .= ' AND status = '.(int) $status; |
2801
|
2801
|
} |
2802
|
2802
|
if (!empty($type)) { |
2803
|
|
- $sql .= ' AND bomtype = ' . (int) $type; |
|
2803
|
+ $sql .= ' AND bomtype = '.(int) $type; |
2804
|
2804
|
} |
2805
|
2805
|
if (!empty($TProducts)) { |
2806
|
|
- $sql .= ' AND fk_product IN (' . $this->db->sanitize(implode(',', $TProducts)) . ')'; |
|
2806
|
+ $sql .= ' AND fk_product IN ('.$this->db->sanitize(implode(',', $TProducts)).')'; |
2807
|
2807
|
} |
2808
|
2808
|
if (!empty($limit)) { |
2809
|
|
- $sql .= ' LIMIT ' . (int) $limit; |
|
2809
|
+ $sql .= ' LIMIT '.(int) $limit; |
2810
|
2810
|
} |
2811
|
2811
|
$resql = $db->query($sql); |
2812
|
2812
|
if ($resql) { |
|
@@ -2820,11 +2820,11 @@ discard block |
|
|
block discarded – undo |
2820
|
2820
|
while ($obj = $db->fetch_object($resql)) { |
2821
|
2821
|
$product = new Product($db); |
2822
|
2822
|
$res = $product->fetch($obj->fk_product); |
2823
|
|
- $out .= '<option value="' . $obj->rowid . '"'; |
|
2823
|
+ $out .= '<option value="'.$obj->rowid.'"'; |
2824
|
2824
|
if ($obj->rowid == $selected) { |
2825
|
2825
|
$out .= 'selected'; |
2826
|
2826
|
} |
2827
|
|
- $out .= '>' . $obj->ref . ' - ' . $product->label . ' - ' . $obj->label . '</option>'; |
|
2827
|
+ $out .= '>'.$obj->ref.' - '.$product->label.' - '.$obj->label.'</option>'; |
2828
|
2828
|
} |
2829
|
2829
|
} else { |
2830
|
2830
|
$error++; |
|
@@ -2881,7 +2881,7 @@ discard block |
|
|
block discarded – undo |
2881
|
2881
|
|
2882
|
2882
|
$warehouseStatusArray = array(); |
2883
|
2883
|
if (!empty($warehouseStatus)) { |
2884
|
|
- require_once DOL_DOCUMENT_ROOT . '/product/stock/class/entrepot.class.php'; |
|
2884
|
+ require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php'; |
2885
|
2885
|
if (preg_match('/warehouseclosed/', $warehouseStatus)) { |
2886
|
2886
|
$warehouseStatusArray[] = Entrepot::STATUS_CLOSED; |
2887
|
2887
|
} |
|
@@ -2895,9 +2895,9 @@ discard block |
|
|
block discarded – undo |
2895
|
2895
|
|
2896
|
2896
|
$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"; |
2897
|
2897
|
if (count($warehouseStatusArray)) { |
2898
|
|
- $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 |
|
2898
|
+ $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 |
2899
|
2899
|
} else { |
2900
|
|
- $selectFieldsGrouped = ", " . $this->db->ifsql("p.stock IS NULL", 0, "p.stock") . " AS stock"; |
|
2900
|
+ $selectFieldsGrouped = ", ".$this->db->ifsql("p.stock IS NULL", 0, "p.stock")." AS stock"; |
2901
|
2901
|
} |
2902
|
2902
|
|
2903
|
2903
|
$sql = "SELECT "; |
|
@@ -2913,9 +2913,9 @@ discard block |
|
|
block discarded – undo |
2913
|
2913
|
|
2914
|
2914
|
if (getDolGlobalString('PRODUCT_SORT_BY_CATEGORY')) { |
2915
|
2915
|
//Product category |
2916
|
|
- $sql .= ", (SELECT " . $this->db->prefix() . "categorie_product.fk_categorie |
2917
|
|
- FROM " . $this->db->prefix() . "categorie_product |
2918
|
|
- WHERE " . $this->db->prefix() . "categorie_product.fk_product=p.rowid |
|
2916
|
+ $sql .= ", (SELECT ".$this->db->prefix()."categorie_product.fk_categorie |
|
2917
|
+ FROM " . $this->db->prefix()."categorie_product |
|
2918
|
+ WHERE " . $this->db->prefix()."categorie_product.fk_product=p.rowid |
2919
|
2919
|
LIMIT 1 |
2920
|
2920
|
) AS categorie_product_id "; |
2921
|
2921
|
} |
|
@@ -2941,15 +2941,15 @@ discard block |
|
|
block discarded – undo |
2941
|
2941
|
} |
2942
|
2942
|
// Price by quantity |
2943
|
2943
|
if (getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES')) { |
2944
|
|
- $sql .= ", (SELECT pp.rowid FROM " . $this->db->prefix() . "product_price as pp WHERE pp.fk_product = p.rowid"; |
|
2944
|
+ $sql .= ", (SELECT pp.rowid FROM ".$this->db->prefix()."product_price as pp WHERE pp.fk_product = p.rowid"; |
2945
|
2945
|
if ($price_level >= 1 && getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES')) { |
2946
|
|
- $sql .= " AND price_level = " . ((int) $price_level); |
|
2946
|
+ $sql .= " AND price_level = ".((int) $price_level); |
2947
|
2947
|
} |
2948
|
2948
|
$sql .= " ORDER BY date_price"; |
2949
|
2949
|
$sql .= " DESC LIMIT 1) as price_rowid"; |
2950
|
|
- $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 |
|
2950
|
+ $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 |
2951
|
2951
|
if ($price_level >= 1 && getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES')) { |
2952
|
|
- $sql .= " AND price_level = " . ((int) $price_level); |
|
2952
|
+ $sql .= " AND price_level = ".((int) $price_level); |
2953
|
2953
|
} |
2954
|
2954
|
$sql .= " ORDER BY date_price"; |
2955
|
2955
|
$sql .= " DESC LIMIT 1) as price_by_qty"; |
|
@@ -2958,58 +2958,58 @@ discard block |
|
|
block discarded – undo |
2958
|
2958
|
|
2959
|
2959
|
$sql .= " FROM ".$this->db->prefix()."product as p"; |
2960
|
2960
|
// Add from (left join) from hooks |
2961
|
|
- $parameters = array(); // @phan-suppress-current-line PhanPluginRedundantAssignment |
|
2961
|
+ $parameters = array(); // @phan-suppress-current-line PhanPluginRedundantAssignment |
2962
|
2962
|
$reshook = $hookmanager->executeHooks('selectProductsListFrom', $parameters); // Note that $action and $object may have been modified by hook |
2963
|
2963
|
$sql .= $hookmanager->resPrint; |
2964
|
2964
|
|
2965
|
2965
|
if (count($warehouseStatusArray)) { |
2966
|
|
- $sql .= " LEFT JOIN " . $this->db->prefix() . "product_stock as ps on ps.fk_product = p.rowid"; |
2967
|
|
- $sql .= " LEFT JOIN " . $this->db->prefix() . "entrepot as e on ps.fk_entrepot = e.rowid AND e.entity IN (" . getEntity('stock') . ")"; |
2968
|
|
- $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. |
|
2966
|
+ $sql .= " LEFT JOIN ".$this->db->prefix()."product_stock as ps on ps.fk_product = p.rowid"; |
|
2967
|
+ $sql .= " LEFT JOIN ".$this->db->prefix()."entrepot as e on ps.fk_entrepot = e.rowid AND e.entity IN (".getEntity('stock').")"; |
|
2968
|
+ $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. |
2969
|
2969
|
} |
2970
|
2970
|
|
2971
|
2971
|
// include search in supplier ref |
2972
|
2972
|
if (getDolGlobalString('MAIN_SEARCH_PRODUCT_BY_FOURN_REF')) { |
2973
|
|
- $sql .= " LEFT JOIN " . $this->db->prefix() . "product_fournisseur_price as pfp ON p.rowid = pfp.fk_product"; |
|
2973
|
+ $sql .= " LEFT JOIN ".$this->db->prefix()."product_fournisseur_price as pfp ON p.rowid = pfp.fk_product"; |
2974
|
2974
|
} |
2975
|
2975
|
|
2976
|
2976
|
//Price by customer |
2977
|
2977
|
if (getDolGlobalString('PRODUIT_CUSTOMER_PRICES') && !empty($socid)) { |
2978
|
|
- $sql .= " LEFT JOIN " . $this->db->prefix() . "product_customer_price as pcp ON pcp.fk_soc=" . ((int) $socid) . " AND pcp.fk_product=p.rowid"; |
|
2978
|
+ $sql .= " LEFT JOIN ".$this->db->prefix()."product_customer_price as pcp ON pcp.fk_soc=".((int) $socid)." AND pcp.fk_product=p.rowid"; |
2979
|
2979
|
} |
2980
|
2980
|
// Units |
2981
|
2981
|
if (getDolGlobalInt('PRODUCT_USE_UNITS')) { |
2982
|
|
- $sql .= " LEFT JOIN " . $this->db->prefix() . "c_units u ON u.rowid = p.fk_unit"; |
|
2982
|
+ $sql .= " LEFT JOIN ".$this->db->prefix()."c_units u ON u.rowid = p.fk_unit"; |
2983
|
2983
|
} |
2984
|
2984
|
// Multilang : we add translation |
2985
|
2985
|
if (getDolGlobalInt('MAIN_MULTILANGS')) { |
2986
|
|
- $sql .= " LEFT JOIN " . $this->db->prefix() . "product_lang as pl ON pl.fk_product = p.rowid "; |
|
2986
|
+ $sql .= " LEFT JOIN ".$this->db->prefix()."product_lang as pl ON pl.fk_product = p.rowid "; |
2987
|
2987
|
if (getDolGlobalString('PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE') && !empty($socid)) { |
2988
|
|
- require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; |
|
2988
|
+ require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; |
2989
|
2989
|
$soc = new Societe($this->db); |
2990
|
2990
|
$result = $soc->fetch($socid); |
2991
|
2991
|
if ($result > 0 && !empty($soc->default_lang)) { |
2992
|
|
- $sql .= " AND pl.lang = '" . $this->db->escape($soc->default_lang) . "'"; |
|
2992
|
+ $sql .= " AND pl.lang = '".$this->db->escape($soc->default_lang)."'"; |
2993
|
2993
|
} else { |
2994
|
|
- $sql .= " AND pl.lang = '" . $this->db->escape($langs->getDefaultLang()) . "'"; |
|
2994
|
+ $sql .= " AND pl.lang = '".$this->db->escape($langs->getDefaultLang())."'"; |
2995
|
2995
|
} |
2996
|
2996
|
} else { |
2997
|
|
- $sql .= " AND pl.lang = '" . $this->db->escape($langs->getDefaultLang()) . "'"; |
|
2997
|
+ $sql .= " AND pl.lang = '".$this->db->escape($langs->getDefaultLang())."'"; |
2998
|
2998
|
} |
2999
|
2999
|
} |
3000
|
3000
|
|
3001
|
3001
|
if (getDolGlobalString('PRODUIT_ATTRIBUTES_HIDECHILD')) { |
3002
|
|
- $sql .= " LEFT JOIN " . $this->db->prefix() . "product_attribute_combination pac ON pac.fk_product_child = p.rowid"; |
|
3002
|
+ $sql .= " LEFT JOIN ".$this->db->prefix()."product_attribute_combination pac ON pac.fk_product_child = p.rowid"; |
3003
|
3003
|
} |
3004
|
3004
|
|
3005
|
|
- $sql .= ' WHERE p.entity IN (' . getEntity('product') . ')'; |
|
3005
|
+ $sql .= ' WHERE p.entity IN ('.getEntity('product').')'; |
3006
|
3006
|
|
3007
|
3007
|
if (getDolGlobalString('PRODUIT_ATTRIBUTES_HIDECHILD')) { |
3008
|
3008
|
$sql .= " AND pac.rowid IS NULL"; |
3009
|
3009
|
} |
3010
|
3010
|
|
3011
|
3011
|
if ($finished == 0) { |
3012
|
|
- $sql .= " AND p.finished = " . ((int) $finished); |
|
3012
|
+ $sql .= " AND p.finished = ".((int) $finished); |
3013
|
3013
|
} elseif ($finished == 1) { |
3014
|
3014
|
$sql .= " AND p.finished = ".((int) $finished); |
3015
|
3015
|
} |
|
@@ -3017,18 +3017,18 @@ discard block |
|
|
block discarded – undo |
3017
|
3017
|
$sql .= " AND p.tosell = ".((int) $status); |
3018
|
3018
|
} |
3019
|
3019
|
if ($status_purchase >= 0) { |
3020
|
|
- $sql .= " AND p.tobuy = " . ((int) $status_purchase); |
|
3020
|
+ $sql .= " AND p.tobuy = ".((int) $status_purchase); |
3021
|
3021
|
} |
3022
|
3022
|
// Filter by product type |
3023
|
3023
|
if (strval($filtertype) != '') { |
3024
|
|
- $sql .= " AND p.fk_product_type = " . ((int) $filtertype); |
|
3024
|
+ $sql .= " AND p.fk_product_type = ".((int) $filtertype); |
3025
|
3025
|
} elseif (!isModEnabled('product')) { // when product module is disabled, show services only |
3026
|
3026
|
$sql .= " AND p.fk_product_type = 1"; |
3027
|
3027
|
} elseif (!isModEnabled('service')) { // when service module is disabled, show products only |
3028
|
3028
|
$sql .= " AND p.fk_product_type = 0"; |
3029
|
3029
|
} |
3030
|
3030
|
// Add where from hooks |
3031
|
|
- $parameters = array(); // @phan-suppress-current-line PhanPluginRedundantAssignment |
|
3031
|
+ $parameters = array(); // @phan-suppress-current-line PhanPluginRedundantAssignment |
3032
|
3032
|
$reshook = $hookmanager->executeHooks('selectProductsListWhere', $parameters); // Note that $action and $object may have been modified by hook |
3033
|
3033
|
$sql .= $hookmanager->resPrint; |
3034
|
3034
|
// Add criteria on ref/label |
|
@@ -3045,21 +3045,21 @@ discard block |
|
|
block discarded – undo |
3045
|
3045
|
if ($i > 0) { |
3046
|
3046
|
$sql .= " AND "; |
3047
|
3047
|
} |
3048
|
|
- $sql .= "(p.ref LIKE '" . $this->db->escape($prefix . $crit) . "%' OR p.label LIKE '" . $this->db->escape($prefix . $crit) . "%'"; |
|
3048
|
+ $sql .= "(p.ref LIKE '".$this->db->escape($prefix.$crit)."%' OR p.label LIKE '".$this->db->escape($prefix.$crit)."%'"; |
3049
|
3049
|
if (getDolGlobalInt('MAIN_MULTILANGS')) { |
3050
|
|
- $sql .= " OR pl.label LIKE '" . $this->db->escape($prefix . $crit) . "%'"; |
|
3050
|
+ $sql .= " OR pl.label LIKE '".$this->db->escape($prefix.$crit)."%'"; |
3051
|
3051
|
} |
3052
|
3052
|
if (getDolGlobalString('PRODUIT_CUSTOMER_PRICES') && !empty($socid)) { |
3053
|
|
- $sql .= " OR pcp.ref_customer LIKE '" . $this->db->escape($prefix . $crit) . "%'"; |
|
3053
|
+ $sql .= " OR pcp.ref_customer LIKE '".$this->db->escape($prefix.$crit)."%'"; |
3054
|
3054
|
} |
3055
|
3055
|
if (getDolGlobalString('PRODUCT_AJAX_SEARCH_ON_DESCRIPTION')) { |
3056
|
|
- $sql .= " OR p.description LIKE '" . $this->db->escape($prefix . $crit) . "%'"; |
|
3056
|
+ $sql .= " OR p.description LIKE '".$this->db->escape($prefix.$crit)."%'"; |
3057
|
3057
|
if (getDolGlobalInt('MAIN_MULTILANGS')) { |
3058
|
|
- $sql .= " OR pl.description LIKE '" . $this->db->escape($prefix . $crit) . "%'"; |
|
3058
|
+ $sql .= " OR pl.description LIKE '".$this->db->escape($prefix.$crit)."%'"; |
3059
|
3059
|
} |
3060
|
3060
|
} |
3061
|
3061
|
if (getDolGlobalString('MAIN_SEARCH_PRODUCT_BY_FOURN_REF')) { |
3062
|
|
- $sql .= " OR pfp.ref_fourn LIKE '" . $this->db->escape($prefix . $crit) . "%'"; |
|
3062
|
+ $sql .= " OR pfp.ref_fourn LIKE '".$this->db->escape($prefix.$crit)."%'"; |
3063
|
3063
|
} |
3064
|
3064
|
$sql .= ")"; |
3065
|
3065
|
$i++; |
|
@@ -3068,12 +3068,12 @@ discard block |
|
|
block discarded – undo |
3068
|
3068
|
$sql .= ")"; |
3069
|
3069
|
} |
3070
|
3070
|
if (isModEnabled('barcode')) { |
3071
|
|
- $sql .= " OR p.barcode LIKE '" . $this->db->escape($prefix . $filterkey) . "%'"; |
|
3071
|
+ $sql .= " OR p.barcode LIKE '".$this->db->escape($prefix.$filterkey)."%'"; |
3072
|
3072
|
} |
3073
|
3073
|
$sql .= ')'; |
3074
|
3074
|
} |
3075
|
3075
|
if (count($warehouseStatusArray)) { |
3076
|
|
- $sql .= " GROUP BY " . $selectFields; |
|
3076
|
+ $sql .= " GROUP BY ".$selectFields; |
3077
|
3077
|
} |
3078
|
3078
|
|
3079
|
3079
|
//Sort by category |
|
@@ -3088,23 +3088,23 @@ discard block |
|
|
block discarded – undo |
3088
|
3088
|
$sql .= $this->db->plimit($limit, 0); |
3089
|
3089
|
|
3090
|
3090
|
// Build output string |
3091
|
|
- dol_syslog(get_class($this) . "::select_produits_list search products", LOG_DEBUG); |
|
3091
|
+ dol_syslog(get_class($this)."::select_produits_list search products", LOG_DEBUG); |
3092
|
3092
|
$result = $this->db->query($sql); |
3093
|
3093
|
if ($result) { |
3094
|
|
- require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; |
3095
|
|
- require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php'; |
3096
|
|
- require_once DOL_DOCUMENT_ROOT . '/core/lib/product.lib.php'; |
|
3094
|
+ require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; |
|
3095
|
+ require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php'; |
|
3096
|
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php'; |
3097
|
3097
|
|
3098
|
3098
|
$num = $this->db->num_rows($result); |
3099
|
3099
|
|
3100
|
3100
|
$events = array(); |
3101
|
3101
|
|
3102
|
3102
|
if (!$forcecombo) { |
3103
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
3103
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
3104
|
3104
|
$out .= ajax_combobox($htmlname, $events, getDolGlobalInt("PRODUIT_USE_SEARCH_TO_SELECT")); |
3105
|
3105
|
} |
3106
|
3106
|
|
3107
|
|
- $out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">'; |
|
3107
|
+ $out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">'; |
3108
|
3108
|
|
3109
|
3109
|
$textifempty = ''; |
3110
|
3110
|
// Do not use textifempty = ' ' or ' ' here, or search on key will search on ' key'. |
|
@@ -3121,7 +3121,7 @@ discard block |
|
|
block discarded – undo |
3121
|
3121
|
} |
3122
|
3122
|
} |
3123
|
3123
|
if ($showempty) { |
3124
|
|
- $out .= '<option value="-1" selected>' . ($textifempty ? $textifempty : ' ') . '</option>'; |
|
3124
|
+ $out .= '<option value="-1" selected>'.($textifempty ? $textifempty : ' ').'</option>'; |
3125
|
3125
|
} |
3126
|
3126
|
|
3127
|
3127
|
$i = 0; |
|
@@ -3132,11 +3132,11 @@ discard block |
|
|
block discarded – undo |
3132
|
3132
|
|
3133
|
3133
|
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 |
3134
|
3134
|
$sql = "SELECT rowid, quantity, price, unitprice, remise_percent, remise, price_base_type"; |
3135
|
|
- $sql .= " FROM " . $this->db->prefix() . "product_price_by_qty"; |
3136
|
|
- $sql .= " WHERE fk_product_price = " . ((int) $objp->price_rowid); |
|
3135
|
+ $sql .= " FROM ".$this->db->prefix()."product_price_by_qty"; |
|
3136
|
+ $sql .= " WHERE fk_product_price = ".((int) $objp->price_rowid); |
3137
|
3137
|
$sql .= " ORDER BY quantity ASC"; |
3138
|
3138
|
|
3139
|
|
- dol_syslog(get_class($this) . "::select_produits_list search prices by qty", LOG_DEBUG); |
|
3139
|
+ dol_syslog(get_class($this)."::select_produits_list search prices by qty", LOG_DEBUG); |
3140
|
3140
|
$result2 = $this->db->query($sql); |
3141
|
3141
|
if ($result2) { |
3142
|
3142
|
$nb_prices = $this->db->num_rows($result2); |
|
@@ -3174,7 +3174,7 @@ discard block |
|
|
block discarded – undo |
3174
|
3174
|
$price_product = new Product($this->db); |
3175
|
3175
|
$price_product->fetch($objp->rowid, '', '', 1); |
3176
|
3176
|
|
3177
|
|
- require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php'; |
|
3177
|
+ require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php'; |
3178
|
3178
|
$priceparser = new PriceParser($this->db); |
3179
|
3179
|
$price_result = $priceparser->parseProduct($price_product); |
3180
|
3180
|
if ($price_result >= 0) { |
|
@@ -3258,7 +3258,7 @@ discard block |
|
|
block discarded – undo |
3258
|
3258
|
$label = $objp->label_translated; |
3259
|
3259
|
} |
3260
|
3260
|
if (!empty($filterkey) && $filterkey != '') { |
3261
|
|
- $label = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $label, 1); |
|
3261
|
+ $label = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $label, 1); |
3262
|
3262
|
} |
3263
|
3263
|
|
3264
|
3264
|
$outkey = $objp->rowid; |
|
@@ -3279,32 +3279,32 @@ discard block |
|
|
block discarded – undo |
3279
|
3279
|
$outdurationunit = $outtype == Product::TYPE_SERVICE ? substr($objp->duration, -1) : ''; |
3280
|
3280
|
|
3281
|
3281
|
if ($outorigin && getDolGlobalString('PRODUCT_SHOW_ORIGIN_IN_COMBO')) { |
3282
|
|
- require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php'; |
|
3282
|
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; |
3283
|
3283
|
} |
3284
|
3284
|
|
3285
|
3285
|
// Units |
3286
|
3286
|
$outvalUnits = ''; |
3287
|
3287
|
if (getDolGlobalInt('PRODUCT_USE_UNITS')) { |
3288
|
3288
|
if (!empty($objp->unit_short)) { |
3289
|
|
- $outvalUnits .= ' - ' . $objp->unit_short; |
|
3289
|
+ $outvalUnits .= ' - '.$objp->unit_short; |
3290
|
3290
|
} |
3291
|
3291
|
} |
3292
|
3292
|
if (getDolGlobalString('PRODUCT_SHOW_DIMENSIONS_IN_COMBO')) { |
3293
|
3293
|
if (!empty($objp->weight) && $objp->weight_units !== null) { |
3294
|
3294
|
$unitToShow = showDimensionInBestUnit($objp->weight, $objp->weight_units, 'weight', $langs); |
3295
|
|
- $outvalUnits .= ' - ' . $unitToShow; |
|
3295
|
+ $outvalUnits .= ' - '.$unitToShow; |
3296
|
3296
|
} |
3297
|
3297
|
if ((!empty($objp->length) || !empty($objp->width) || !empty($objp->height)) && $objp->length_units !== null) { |
3298
|
|
- $unitToShow = $objp->length . ' x ' . $objp->width . ' x ' . $objp->height . ' ' . measuringUnitString(0, 'size', $objp->length_units); |
3299
|
|
- $outvalUnits .= ' - ' . $unitToShow; |
|
3298
|
+ $unitToShow = $objp->length.' x '.$objp->width.' x '.$objp->height.' '.measuringUnitString(0, 'size', $objp->length_units); |
|
3299
|
+ $outvalUnits .= ' - '.$unitToShow; |
3300
|
3300
|
} |
3301
|
3301
|
if (!empty($objp->surface) && $objp->surface_units !== null) { |
3302
|
3302
|
$unitToShow = showDimensionInBestUnit($objp->surface, $objp->surface_units, 'surface', $langs); |
3303
|
|
- $outvalUnits .= ' - ' . $unitToShow; |
|
3303
|
+ $outvalUnits .= ' - '.$unitToShow; |
3304
|
3304
|
} |
3305
|
3305
|
if (!empty($objp->volume) && $objp->volume_units !== null) { |
3306
|
3306
|
$unitToShow = showDimensionInBestUnit($objp->volume, $objp->volume_units, 'volume', $langs); |
3307
|
|
- $outvalUnits .= ' - ' . $unitToShow; |
|
3307
|
+ $outvalUnits .= ' - '.$unitToShow; |
3308
|
3308
|
} |
3309
|
3309
|
} |
3310
|
3310
|
if ($outdurationvalue && $outdurationunit) { |
|
@@ -3316,14 +3316,14 @@ discard block |
|
|
block discarded – undo |
3316
|
3316
|
'y' => $langs->trans('Year') |
3317
|
3317
|
); |
3318
|
3318
|
if (isset($da[$outdurationunit])) { |
3319
|
|
- $outvalUnits .= ' - ' . $outdurationvalue . ' ' . $langs->transnoentities($da[$outdurationunit] . ($outdurationvalue > 1 ? 's' : '')); |
|
3319
|
+ $outvalUnits .= ' - '.$outdurationvalue.' '.$langs->transnoentities($da[$outdurationunit].($outdurationvalue > 1 ? 's' : '')); |
3320
|
3320
|
} |
3321
|
3321
|
} |
3322
|
3322
|
|
3323
|
|
- $opt = '<option value="' . $objp->rowid . '"'; |
|
3323
|
+ $opt = '<option value="'.$objp->rowid.'"'; |
3324
|
3324
|
$opt .= ($objp->rowid == $selected) ? ' selected' : ''; |
3325
|
3325
|
if (!empty($objp->price_by_qty_rowid) && $objp->price_by_qty_rowid > 0) { |
3326
|
|
- $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 . '"'; |
|
3326
|
+ $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.'"'; |
3327
|
3327
|
} |
3328
|
3328
|
if (isModEnabled('stock') && isset($objp->stock) && ($objp->fk_product_type == Product::TYPE_PRODUCT || getDolGlobalString('STOCK_SUPPORTS_SERVICES'))) { |
3329
|
3329
|
if ($user->hasRight('stock', 'lire')) { |
|
@@ -3335,36 +3335,36 @@ discard block |
|
|
block discarded – undo |
3335
|
3335
|
} |
3336
|
3336
|
} |
3337
|
3337
|
if (getDolGlobalString('PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE')) { |
3338
|
|
- $opt .= ' data-labeltrans="' . $outlabel_translated . '"'; |
3339
|
|
- $opt .= ' data-desctrans="' . dol_escape_htmltag($outdesc_translated) . '"'; |
|
3338
|
+ $opt .= ' data-labeltrans="'.$outlabel_translated.'"'; |
|
3339
|
+ $opt .= ' data-desctrans="'.dol_escape_htmltag($outdesc_translated).'"'; |
3340
|
3340
|
} |
3341
|
3341
|
$opt .= '>'; |
3342
|
3342
|
$opt .= $objp->ref; |
3343
|
3343
|
if (!empty($objp->custref)) { |
3344
|
|
- $opt .= ' (' . $objp->custref . ')'; |
|
3344
|
+ $opt .= ' ('.$objp->custref.')'; |
3345
|
3345
|
} |
3346
|
3346
|
if ($outbarcode) { |
3347
|
|
- $opt .= ' (' . $outbarcode . ')'; |
|
3347
|
+ $opt .= ' ('.$outbarcode.')'; |
3348
|
3348
|
} |
3349
|
|
- $opt .= ' - ' . dol_trunc($label, $maxlengtharticle); |
|
3349
|
+ $opt .= ' - '.dol_trunc($label, $maxlengtharticle); |
3350
|
3350
|
if ($outorigin && getDolGlobalString('PRODUCT_SHOW_ORIGIN_IN_COMBO')) { |
3351
|
|
- $opt .= ' (' . getCountry($outorigin, 1) . ')'; |
|
3351
|
+ $opt .= ' ('.getCountry($outorigin, 1).')'; |
3352
|
3352
|
} |
3353
|
3353
|
|
3354
|
3354
|
$objRef = $objp->ref; |
3355
|
3355
|
if (!empty($objp->custref)) { |
3356
|
|
- $objRef .= ' (' . $objp->custref . ')'; |
|
3356
|
+ $objRef .= ' ('.$objp->custref.')'; |
3357
|
3357
|
} |
3358
|
3358
|
if (!empty($filterkey) && $filterkey != '') { |
3359
|
|
- $objRef = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $objRef, 1); |
|
3359
|
+ $objRef = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $objRef, 1); |
3360
|
3360
|
} |
3361
|
3361
|
$outval .= $objRef; |
3362
|
3362
|
if ($outbarcode) { |
3363
|
|
- $outval .= ' (' . $outbarcode . ')'; |
|
3363
|
+ $outval .= ' ('.$outbarcode.')'; |
3364
|
3364
|
} |
3365
|
|
- $outval .= ' - ' . dol_trunc($label, $maxlengtharticle); |
|
3365
|
+ $outval .= ' - '.dol_trunc($label, $maxlengtharticle); |
3366
|
3366
|
if ($outorigin && getDolGlobalString('PRODUCT_SHOW_ORIGIN_IN_COMBO')) { |
3367
|
|
- $outval .= ' (' . getCountry($outorigin, 1) . ')'; |
|
3367
|
+ $outval .= ' ('.getCountry($outorigin, 1).')'; |
3368
|
3368
|
} |
3369
|
3369
|
|
3370
|
3370
|
// Units |
|
@@ -3377,35 +3377,35 @@ discard block |
|
|
block discarded – undo |
3377
|
3377
|
// If we need a particular price level (from 1 to n) |
3378
|
3378
|
if (empty($hidepriceinlabel) && $price_level >= 1 && (getDolGlobalString('PRODUIT_MULTIPRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES'))) { |
3379
|
3379
|
$sql = "SELECT price, price_ttc, price_base_type, tva_tx, default_vat_code"; |
3380
|
|
- $sql .= " FROM " . $this->db->prefix() . "product_price"; |
3381
|
|
- $sql .= " WHERE fk_product = " . ((int) $objp->rowid); |
3382
|
|
- $sql .= " AND entity IN (" . getEntity('productprice') . ")"; |
3383
|
|
- $sql .= " AND price_level = " . ((int) $price_level); |
|
3380
|
+ $sql .= " FROM ".$this->db->prefix()."product_price"; |
|
3381
|
+ $sql .= " WHERE fk_product = ".((int) $objp->rowid); |
|
3382
|
+ $sql .= " AND entity IN (".getEntity('productprice').")"; |
|
3383
|
+ $sql .= " AND price_level = ".((int) $price_level); |
3384
|
3384
|
$sql .= " ORDER BY date_price DESC, rowid DESC"; // Warning DESC must be both on date_price and rowid. |
3385
|
3385
|
$sql .= " LIMIT 1"; |
3386
|
3386
|
|
3387
|
|
- dol_syslog(get_class($this) . '::constructProductListOption search price for product ' . $objp->rowid . ' AND level ' . $price_level, LOG_DEBUG); |
|
3387
|
+ dol_syslog(get_class($this).'::constructProductListOption search price for product '.$objp->rowid.' AND level '.$price_level, LOG_DEBUG); |
3388
|
3388
|
$result2 = $this->db->query($sql); |
3389
|
3389
|
if ($result2) { |
3390
|
3390
|
$objp2 = $this->db->fetch_object($result2); |
3391
|
3391
|
if ($objp2) { |
3392
|
3392
|
$found = 1; |
3393
|
3393
|
if ($objp2->price_base_type == 'HT') { |
3394
|
|
- $opt .= ' - ' . price($objp2->price, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("HT"); |
3395
|
|
- $outval .= ' - ' . price($objp2->price, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("HT"); |
|
3394
|
+ $opt .= ' - '.price($objp2->price, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("HT"); |
|
3395
|
+ $outval .= ' - '.price($objp2->price, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("HT"); |
3396
|
3396
|
} else { |
3397
|
|
- $opt .= ' - ' . price($objp2->price_ttc, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("TTC"); |
3398
|
|
- $outval .= ' - ' . price($objp2->price_ttc, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("TTC"); |
|
3397
|
+ $opt .= ' - '.price($objp2->price_ttc, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("TTC"); |
|
3398
|
+ $outval .= ' - '.price($objp2->price_ttc, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("TTC"); |
3399
|
3399
|
} |
3400
|
3400
|
$outprice_ht = price($objp2->price); |
3401
|
3401
|
$outprice_ttc = price($objp2->price_ttc); |
3402
|
3402
|
$outpricebasetype = $objp2->price_base_type; |
3403
|
3403
|
if (getDolGlobalString('PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL')) { // using this option is a bug. kept for backward compatibility |
3404
|
|
- $outtva_tx = $objp2->tva_tx; // We use the vat rate on line of multiprice |
3405
|
|
- $outdefault_vat_code = $objp2->default_vat_code; // We use the vat code on line of multiprice |
|
3404
|
+ $outtva_tx = $objp2->tva_tx; // We use the vat rate on line of multiprice |
|
3405
|
+ $outdefault_vat_code = $objp2->default_vat_code; // We use the vat code on line of multiprice |
3406
|
3406
|
} else { |
3407
|
|
- $outtva_tx = $objp->tva_tx; // We use the vat rate of product, not the one on line of multiprice |
3408
|
|
- $outdefault_vat_code = $objp->default_vat_code; // We use the vat code or product, not the one on line of multiprice |
|
3407
|
+ $outtva_tx = $objp->tva_tx; // We use the vat rate of product, not the one on line of multiprice |
|
3408
|
+ $outdefault_vat_code = $objp->default_vat_code; // We use the vat code or product, not the one on line of multiprice |
3409
|
3409
|
} |
3410
|
3410
|
} |
3411
|
3411
|
} else { |
|
@@ -3419,13 +3419,13 @@ discard block |
|
|
block discarded – undo |
3419
|
3419
|
$outqty = $objp->quantity; |
3420
|
3420
|
$outdiscount = $objp->remise_percent; |
3421
|
3421
|
if ($objp->quantity == 1) { |
3422
|
|
- $opt .= ' - ' . price($objp->unitprice, 1, $langs, 0, 0, -1, $conf->currency) . "/"; |
3423
|
|
- $outval .= ' - ' . price($objp->unitprice, 0, $langs, 0, 0, -1, $conf->currency) . "/"; |
|
3422
|
+ $opt .= ' - '.price($objp->unitprice, 1, $langs, 0, 0, -1, $conf->currency)."/"; |
|
3423
|
+ $outval .= ' - '.price($objp->unitprice, 0, $langs, 0, 0, -1, $conf->currency)."/"; |
3424
|
3424
|
$opt .= $langs->trans("Unit"); // Do not use strtolower because it breaks utf8 encoding |
3425
|
3425
|
$outval .= $langs->transnoentities("Unit"); |
3426
|
3426
|
} else { |
3427
|
|
- $opt .= ' - ' . price($objp->price, 1, $langs, 0, 0, -1, $conf->currency) . "/" . $objp->quantity; |
3428
|
|
- $outval .= ' - ' . price($objp->price, 0, $langs, 0, 0, -1, $conf->currency) . "/" . $objp->quantity; |
|
3427
|
+ $opt .= ' - '.price($objp->price, 1, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity; |
|
3428
|
+ $outval .= ' - '.price($objp->price, 0, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity; |
3429
|
3429
|
$opt .= $langs->trans("Units"); // Do not use strtolower because it breaks utf8 encoding |
3430
|
3430
|
$outval .= $langs->transnoentities("Units"); |
3431
|
3431
|
} |
|
@@ -3433,16 +3433,16 @@ discard block |
|
|
block discarded – undo |
3433
|
3433
|
$outprice_ht = price($objp->unitprice); |
3434
|
3434
|
$outprice_ttc = price($objp->unitprice * (1 + ($objp->tva_tx / 100))); |
3435
|
3435
|
$outpricebasetype = $objp->price_base_type; |
3436
|
|
- $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 |
3437
|
|
- $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 |
|
3436
|
+ $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 |
|
3437
|
+ $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 |
3438
|
3438
|
} |
3439
|
3439
|
if (empty($hidepriceinlabel) && !empty($objp->quantity) && $objp->quantity >= 1) { |
3440
|
|
- $opt .= " (" . price($objp->unitprice, 1, $langs, 0, 0, -1, $conf->currency) . "/" . $langs->trans("Unit") . ")"; // Do not use strtolower because it breaks utf8 encoding |
3441
|
|
- $outval .= " (" . price($objp->unitprice, 0, $langs, 0, 0, -1, $conf->currency) . "/" . $langs->transnoentities("Unit") . ")"; // Do not use strtolower because it breaks utf8 encoding |
|
3440
|
+ $opt .= " (".price($objp->unitprice, 1, $langs, 0, 0, -1, $conf->currency)."/".$langs->trans("Unit").")"; // Do not use strtolower because it breaks utf8 encoding |
|
3441
|
+ $outval .= " (".price($objp->unitprice, 0, $langs, 0, 0, -1, $conf->currency)."/".$langs->transnoentities("Unit").")"; // Do not use strtolower because it breaks utf8 encoding |
3442
|
3442
|
} |
3443
|
3443
|
if (empty($hidepriceinlabel) && !empty($objp->remise_percent) && $objp->remise_percent >= 1) { |
3444
|
|
- $opt .= " - " . $langs->trans("Discount") . " : " . vatrate($objp->remise_percent) . ' %'; |
3445
|
|
- $outval .= " - " . $langs->transnoentities("Discount") . " : " . vatrate($objp->remise_percent) . ' %'; |
|
3444
|
+ $opt .= " - ".$langs->trans("Discount")." : ".vatrate($objp->remise_percent).' %'; |
|
3445
|
+ $outval .= " - ".$langs->transnoentities("Discount")." : ".vatrate($objp->remise_percent).' %'; |
3446
|
3446
|
} |
3447
|
3447
|
|
3448
|
3448
|
// Price by customer |
|
@@ -3451,11 +3451,11 @@ discard block |
|
|
block discarded – undo |
3451
|
3451
|
$found = 1; |
3452
|
3452
|
|
3453
|
3453
|
if ($objp->custprice_base_type == 'HT') { |
3454
|
|
- $opt .= ' - ' . price($objp->custprice, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("HT"); |
3455
|
|
- $outval .= ' - ' . price($objp->custprice, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("HT"); |
|
3454
|
+ $opt .= ' - '.price($objp->custprice, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("HT"); |
|
3455
|
+ $outval .= ' - '.price($objp->custprice, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("HT"); |
3456
|
3456
|
} else { |
3457
|
|
- $opt .= ' - ' . price($objp->custprice_ttc, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("TTC"); |
3458
|
|
- $outval .= ' - ' . price($objp->custprice_ttc, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("TTC"); |
|
3457
|
+ $opt .= ' - '.price($objp->custprice_ttc, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("TTC"); |
|
3458
|
+ $outval .= ' - '.price($objp->custprice_ttc, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("TTC"); |
3459
|
3459
|
} |
3460
|
3460
|
|
3461
|
3461
|
$outprice_ht = price($objp->custprice); |
|
@@ -3469,11 +3469,11 @@ discard block |
|
|
block discarded – undo |
3469
|
3469
|
// If level no defined or multiprice not found, we used the default price |
3470
|
3470
|
if (empty($hidepriceinlabel) && !$found) { |
3471
|
3471
|
if ($objp->price_base_type == 'HT') { |
3472
|
|
- $opt .= ' - ' . price($objp->price, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("HT"); |
3473
|
|
- $outval .= ' - ' . price($objp->price, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("HT"); |
|
3472
|
+ $opt .= ' - '.price($objp->price, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("HT"); |
|
3473
|
+ $outval .= ' - '.price($objp->price, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("HT"); |
3474
|
3474
|
} else { |
3475
|
|
- $opt .= ' - ' . price($objp->price_ttc, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("TTC"); |
3476
|
|
- $outval .= ' - ' . price($objp->price_ttc, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("TTC"); |
|
3475
|
+ $opt .= ' - '.price($objp->price_ttc, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("TTC"); |
|
3476
|
+ $outval .= ' - '.price($objp->price_ttc, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("TTC"); |
3477
|
3477
|
} |
3478
|
3478
|
$outprice_ht = price($objp->price); |
3479
|
3479
|
$outprice_ttc = price($objp->price_ttc); |
|
@@ -3484,14 +3484,14 @@ discard block |
|
|
block discarded – undo |
3484
|
3484
|
|
3485
|
3485
|
if (isModEnabled('stock') && isset($objp->stock) && ($objp->fk_product_type == Product::TYPE_PRODUCT || getDolGlobalString('STOCK_SUPPORTS_SERVICES'))) { |
3486
|
3486
|
if ($user->hasRight('stock', 'lire')) { |
3487
|
|
- $opt .= ' - ' . $langs->trans("Stock") . ': ' . price(price2num($objp->stock, 'MS')); |
|
3487
|
+ $opt .= ' - '.$langs->trans("Stock").': '.price(price2num($objp->stock, 'MS')); |
3488
|
3488
|
|
3489
|
3489
|
if ($objp->stock > 0) { |
3490
|
3490
|
$outval .= ' - <span class="product_line_stock_ok">'; |
3491
|
3491
|
} elseif ($objp->stock <= 0) { |
3492
|
3492
|
$outval .= ' - <span class="product_line_stock_too_low">'; |
3493
|
3493
|
} |
3494
|
|
- $outval .= $langs->transnoentities("Stock") . ': ' . price(price2num($objp->stock, 'MS')); |
|
3494
|
+ $outval .= $langs->transnoentities("Stock").': '.price(price2num($objp->stock, 'MS')); |
3495
|
3495
|
$outval .= '</span>'; |
3496
|
3496
|
if (empty($novirtualstock) && getDolGlobalString('STOCK_SHOW_VIRTUAL_STOCK_IN_PRODUCTS_COMBO')) { // Warning, this option may slow down combo list generation |
3497
|
3497
|
$langs->load("stocks"); |
|
@@ -3501,9 +3501,9 @@ discard block |
|
|
block discarded – undo |
3501
|
3501
|
$tmpproduct->load_virtual_stock(); |
3502
|
3502
|
$virtualstock = $tmpproduct->stock_theorique; |
3503
|
3503
|
|
3504
|
|
- $opt .= ' - ' . $langs->trans("VirtualStock") . ':' . $virtualstock; |
|
3504
|
+ $opt .= ' - '.$langs->trans("VirtualStock").':'.$virtualstock; |
3505
|
3505
|
|
3506
|
|
- $outval .= ' - ' . $langs->transnoentities("VirtualStock") . ':'; |
|
3506
|
+ $outval .= ' - '.$langs->transnoentities("VirtualStock").':'; |
3507
|
3507
|
if ($virtualstock > 0) { |
3508
|
3508
|
$outval .= '<span class="product_line_stock_ok">'; |
3509
|
3509
|
} elseif ($virtualstock <= 0) { |
|
@@ -3581,7 +3581,7 @@ discard block |
|
|
block discarded – undo |
3581
|
3581
|
$selected_input_value = ''; |
3582
|
3582
|
if (!empty($conf->use_javascript_ajax) && getDolGlobalString('PRODUIT_USE_SEARCH_TO_SELECT')) { |
3583
|
3583
|
if ($selected > 0) { |
3584
|
|
- require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; |
|
3584
|
+ require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; |
3585
|
3585
|
$producttmpselect = new Product($this->db); |
3586
|
3586
|
$producttmpselect->fetch($selected); |
3587
|
3587
|
$selected_input_value = $producttmpselect->ref; |
|
@@ -3589,10 +3589,10 @@ discard block |
|
|
block discarded – undo |
3589
|
3589
|
} |
3590
|
3590
|
|
3591
|
3591
|
// mode=2 means suppliers products |
3592
|
|
- $urloption = ($socid > 0 ? 'socid=' . $socid . '&' : '') . 'htmlname=' . $htmlname . '&outjson=1&price_level=' . $price_level . '&type=' . $filtertype . '&mode=2&status=' . $status . '&finished=' . $finished . '&alsoproductwithnosupplierprice=' . $alsoproductwithnosupplierprice; |
3593
|
|
- print ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/product/ajax/products.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 0, $ajaxoptions); |
|
3592
|
+ $urloption = ($socid > 0 ? 'socid='.$socid.'&' : '').'htmlname='.$htmlname.'&outjson=1&price_level='.$price_level.'&type='.$filtertype.'&mode=2&status='.$status.'&finished='.$finished.'&alsoproductwithnosupplierprice='.$alsoproductwithnosupplierprice; |
|
3593
|
+ print ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/product/ajax/products.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 0, $ajaxoptions); |
3594
|
3594
|
|
3595
|
|
- print($hidelabel ? '' : $langs->trans("RefOrLabel") . ' : ') . '<input type="text" class="minwidth300" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . ($placeholder ? ' placeholder="' . $placeholder . '"' : '') . '>'; |
|
3595
|
+ print($hidelabel ? '' : $langs->trans("RefOrLabel").' : ').'<input type="text" class="minwidth300" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.($placeholder ? ' placeholder="'.$placeholder.'"' : '').'>'; |
3596
|
3596
|
} else { |
3597
|
3597
|
print $this->select_produits_fournisseurs_list($socid, $selected, $htmlname, $filtertype, $filtre, '', $status, 0, 0, $alsoproductwithnosupplierprice, $morecss, 0, $placeholder); |
3598
|
3598
|
} |
|
@@ -3652,25 +3652,25 @@ discard block |
|
|
block discarded – undo |
3652
|
3652
|
if (getDolGlobalInt('PRODUCT_USE_UNITS')) { |
3653
|
3653
|
$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"; |
3654
|
3654
|
} |
3655
|
|
- $sql .= " FROM " . $this->db->prefix() . "product as p"; |
3656
|
|
- $sql .= " LEFT JOIN " . $this->db->prefix() . "product_fournisseur_price as pfp ON ( p.rowid = pfp.fk_product AND pfp.entity IN (" . getEntity('product') . ") )"; |
|
3655
|
+ $sql .= " FROM ".$this->db->prefix()."product as p"; |
|
3656
|
+ $sql .= " LEFT JOIN ".$this->db->prefix()."product_fournisseur_price as pfp ON ( p.rowid = pfp.fk_product AND pfp.entity IN (".getEntity('product').") )"; |
3657
|
3657
|
if ($socid > 0) { |
3658
|
|
- $sql .= " AND pfp.fk_soc = " . ((int) $socid); |
|
3658
|
+ $sql .= " AND pfp.fk_soc = ".((int) $socid); |
3659
|
3659
|
} |
3660
|
|
- $sql .= " LEFT JOIN " . $this->db->prefix() . "societe as s ON pfp.fk_soc = s.rowid"; |
|
3660
|
+ $sql .= " LEFT JOIN ".$this->db->prefix()."societe as s ON pfp.fk_soc = s.rowid"; |
3661
|
3661
|
// Units |
3662
|
3662
|
if (getDolGlobalInt('PRODUCT_USE_UNITS')) { |
3663
|
|
- $sql .= " LEFT JOIN " . $this->db->prefix() . "c_units u ON u.rowid = p.fk_unit"; |
|
3663
|
+ $sql .= " LEFT JOIN ".$this->db->prefix()."c_units u ON u.rowid = p.fk_unit"; |
3664
|
3664
|
} |
3665
|
|
- $sql .= " WHERE p.entity IN (" . getEntity('product') . ")"; |
|
3665
|
+ $sql .= " WHERE p.entity IN (".getEntity('product').")"; |
3666
|
3666
|
if ($statut != -1) { |
3667
|
|
- $sql .= " AND p.tobuy = " . ((int) $statut); |
|
3667
|
+ $sql .= " AND p.tobuy = ".((int) $statut); |
3668
|
3668
|
} |
3669
|
3669
|
if (strval($filtertype) != '') { |
3670
|
|
- $sql .= " AND p.fk_product_type = " . ((int) $filtertype); |
|
3670
|
+ $sql .= " AND p.fk_product_type = ".((int) $filtertype); |
3671
|
3671
|
} |
3672
|
3672
|
if (!empty($filtre)) { |
3673
|
|
- $sql .= " " . $filtre; |
|
3673
|
+ $sql .= " ".$filtre; |
3674
|
3674
|
} |
3675
|
3675
|
// Add where from hooks |
3676
|
3676
|
$parameters = array(); |
|
@@ -3690,9 +3690,9 @@ discard block |
|
|
block discarded – undo |
3690
|
3690
|
if ($i > 0) { |
3691
|
3691
|
$sql .= " AND "; |
3692
|
3692
|
} |
3693
|
|
- $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) . "%'"; |
|
3693
|
+ $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)."%'"; |
3694
|
3694
|
if (getDolGlobalString('PRODUIT_FOURN_TEXTS')) { |
3695
|
|
- $sql .= " OR pfp.desc_fourn LIKE '" . $this->db->escape($prefix . $crit) . "%'"; |
|
3695
|
+ $sql .= " OR pfp.desc_fourn LIKE '".$this->db->escape($prefix.$crit)."%'"; |
3696
|
3696
|
} |
3697
|
3697
|
$sql .= ")"; |
3698
|
3698
|
$i++; |
|
@@ -3701,8 +3701,8 @@ discard block |
|
|
block discarded – undo |
3701
|
3701
|
$sql .= ")"; |
3702
|
3702
|
} |
3703
|
3703
|
if (isModEnabled('barcode')) { |
3704
|
|
- $sql .= " OR p.barcode LIKE '" . $this->db->escape($prefix . $filterkey) . "%'"; |
3705
|
|
- $sql .= " OR pfp.barcode LIKE '" . $this->db->escape($prefix . $filterkey) . "%'"; |
|
3704
|
+ $sql .= " OR p.barcode LIKE '".$this->db->escape($prefix.$filterkey)."%'"; |
|
3705
|
+ $sql .= " OR pfp.barcode LIKE '".$this->db->escape($prefix.$filterkey)."%'"; |
3706
|
3706
|
} |
3707
|
3707
|
$sql .= ')'; |
3708
|
3708
|
} |
|
@@ -3711,20 +3711,20 @@ discard block |
|
|
block discarded – undo |
3711
|
3711
|
|
3712
|
3712
|
// Build output string |
3713
|
3713
|
|
3714
|
|
- dol_syslog(get_class($this) . "::select_produits_fournisseurs_list", LOG_DEBUG); |
|
3714
|
+ dol_syslog(get_class($this)."::select_produits_fournisseurs_list", LOG_DEBUG); |
3715
|
3715
|
$result = $this->db->query($sql); |
3716
|
3716
|
if ($result) { |
3717
|
|
- require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php'; |
3718
|
|
- require_once DOL_DOCUMENT_ROOT . '/core/lib/product.lib.php'; |
|
3717
|
+ require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php'; |
|
3718
|
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php'; |
3719
|
3719
|
|
3720
|
3720
|
$num = $this->db->num_rows($result); |
3721
|
3721
|
|
3722
|
3722
|
//$out.='<select class="flat" id="select'.$htmlname.'" name="'.$htmlname.'">'; // remove select to have id same with combo and ajax |
3723
|
|
- $out .= '<select class="flat ' . ($morecss ? ' ' . $morecss : '') . '" id="' . $htmlname . '" name="' . $htmlname . '">'; |
|
3723
|
+ $out .= '<select class="flat '.($morecss ? ' '.$morecss : '').'" id="'.$htmlname.'" name="'.$htmlname.'">'; |
3724
|
3724
|
if (!$selected) { |
3725
|
|
- $out .= '<option value="-1" selected>' . ($placeholder ? $placeholder : ' ') . '</option>'; |
|
3725
|
+ $out .= '<option value="-1" selected>'.($placeholder ? $placeholder : ' ').'</option>'; |
3726
|
3726
|
} else { |
3727
|
|
- $out .= '<option value="-1">' . ($placeholder ? $placeholder : ' ') . '</option>'; |
|
3727
|
+ $out .= '<option value="-1">'.($placeholder ? $placeholder : ' ').'</option>'; |
3728
|
3728
|
} |
3729
|
3729
|
|
3730
|
3730
|
$i = 0; |
|
@@ -3739,7 +3739,7 @@ discard block |
|
|
block discarded – undo |
3739
|
3739
|
|
3740
|
3740
|
$outkey = $objp->idprodfournprice; // id in table of price |
3741
|
3741
|
if (!$outkey && $alsoproductwithnosupplierprice) { |
3742
|
|
- $outkey = 'idprod_' . $objp->rowid; // id of product |
|
3742
|
+ $outkey = 'idprod_'.$objp->rowid; // id of product |
3743
|
3743
|
} |
3744
|
3744
|
|
3745
|
3745
|
$outref = $objp->ref; |
|
@@ -3754,23 +3754,23 @@ discard block |
|
|
block discarded – undo |
3754
|
3754
|
$outvalUnits = ''; |
3755
|
3755
|
if (getDolGlobalInt('PRODUCT_USE_UNITS')) { |
3756
|
3756
|
if (!empty($objp->unit_short)) { |
3757
|
|
- $outvalUnits .= ' - ' . $objp->unit_short; |
|
3757
|
+ $outvalUnits .= ' - '.$objp->unit_short; |
3758
|
3758
|
} |
3759
|
3759
|
if (!empty($objp->weight) && $objp->weight_units !== null) { |
3760
|
3760
|
$unitToShow = showDimensionInBestUnit($objp->weight, $objp->weight_units, 'weight', $langs); |
3761
|
|
- $outvalUnits .= ' - ' . $unitToShow; |
|
3761
|
+ $outvalUnits .= ' - '.$unitToShow; |
3762
|
3762
|
} |
3763
|
3763
|
if ((!empty($objp->length) || !empty($objp->width) || !empty($objp->height)) && $objp->length_units !== null) { |
3764
|
|
- $unitToShow = $objp->length . ' x ' . $objp->width . ' x ' . $objp->height . ' ' . measuringUnitString(0, 'size', $objp->length_units); |
3765
|
|
- $outvalUnits .= ' - ' . $unitToShow; |
|
3764
|
+ $unitToShow = $objp->length.' x '.$objp->width.' x '.$objp->height.' '.measuringUnitString(0, 'size', $objp->length_units); |
|
3765
|
+ $outvalUnits .= ' - '.$unitToShow; |
3766
|
3766
|
} |
3767
|
3767
|
if (!empty($objp->surface) && $objp->surface_units !== null) { |
3768
|
3768
|
$unitToShow = showDimensionInBestUnit($objp->surface, $objp->surface_units, 'surface', $langs); |
3769
|
|
- $outvalUnits .= ' - ' . $unitToShow; |
|
3769
|
+ $outvalUnits .= ' - '.$unitToShow; |
3770
|
3770
|
} |
3771
|
3771
|
if (!empty($objp->volume) && $objp->volume_units !== null) { |
3772
|
3772
|
$unitToShow = showDimensionInBestUnit($objp->volume, $objp->volume_units, 'volume', $langs); |
3773
|
|
- $outvalUnits .= ' - ' . $unitToShow; |
|
3773
|
+ $outvalUnits .= ' - '.$unitToShow; |
3774
|
3774
|
} |
3775
|
3775
|
if ($outdurationvalue && $outdurationunit) { |
3776
|
3776
|
$da = array( |
|
@@ -3781,22 +3781,22 @@ discard block |
|
|
block discarded – undo |
3781
|
3781
|
'y' => $langs->trans('Year') |
3782
|
3782
|
); |
3783
|
3783
|
if (isset($da[$outdurationunit])) { |
3784
|
|
- $outvalUnits .= ' - ' . $outdurationvalue . ' ' . $langs->transnoentities($da[$outdurationunit] . ($outdurationvalue > 1 ? 's' : '')); |
|
3784
|
+ $outvalUnits .= ' - '.$outdurationvalue.' '.$langs->transnoentities($da[$outdurationunit].($outdurationvalue > 1 ? 's' : '')); |
3785
|
3785
|
} |
3786
|
3786
|
} |
3787
|
3787
|
} |
3788
|
3788
|
|
3789
|
3789
|
$objRef = $objp->ref; |
3790
|
3790
|
if ($filterkey && $filterkey != '') { |
3791
|
|
- $objRef = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $objRef, 1); |
|
3791
|
+ $objRef = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $objRef, 1); |
3792
|
3792
|
} |
3793
|
3793
|
$objRefFourn = $objp->ref_fourn; |
3794
|
3794
|
if ($filterkey && $filterkey != '') { |
3795
|
|
- $objRefFourn = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $objRefFourn, 1); |
|
3795
|
+ $objRefFourn = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $objRefFourn, 1); |
3796
|
3796
|
} |
3797
|
3797
|
$label = $objp->label; |
3798
|
3798
|
if ($filterkey && $filterkey != '') { |
3799
|
|
- $label = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $label, 1); |
|
3799
|
+ $label = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $label, 1); |
3800
|
3800
|
} |
3801
|
3801
|
|
3802
|
3802
|
switch ($objp->fk_product_type) { |
|
@@ -3819,21 +3819,21 @@ discard block |
|
|
block discarded – undo |
3819
|
3819
|
|
3820
|
3820
|
$optlabel .= $objp->ref; |
3821
|
3821
|
if (!empty($objp->idprodfournprice) && ($objp->ref != $objp->ref_fourn)) { |
3822
|
|
- $optlabel .= ' <span class="opacitymedium">(' . $objp->ref_fourn . ')</span>'; |
|
3822
|
+ $optlabel .= ' <span class="opacitymedium">('.$objp->ref_fourn.')</span>'; |
3823
|
3823
|
} |
3824
|
3824
|
if (isModEnabled('barcode') && !empty($objp->barcode)) { |
3825
|
|
- $optlabel .= ' (' . $outbarcode . ')'; |
|
3825
|
+ $optlabel .= ' ('.$outbarcode.')'; |
3826
|
3826
|
} |
3827
|
|
- $optlabel .= ' - ' . dol_trunc($label, $maxlengtharticle); |
|
3827
|
+ $optlabel .= ' - '.dol_trunc($label, $maxlengtharticle); |
3828
|
3828
|
|
3829
|
3829
|
$outvallabel = $objRef; |
3830
|
3830
|
if (!empty($objp->idprodfournprice) && ($objp->ref != $objp->ref_fourn)) { |
3831
|
|
- $outvallabel .= ' (' . $objRefFourn . ')'; |
|
3831
|
+ $outvallabel .= ' ('.$objRefFourn.')'; |
3832
|
3832
|
} |
3833
|
3833
|
if (isModEnabled('barcode') && !empty($objp->barcode)) { |
3834
|
|
- $outvallabel .= ' (' . $outbarcode . ')'; |
|
3834
|
+ $outvallabel .= ' ('.$outbarcode.')'; |
3835
|
3835
|
} |
3836
|
|
- $outvallabel .= ' - ' . dol_trunc($label, $maxlengtharticle); |
|
3836
|
+ $outvallabel .= ' - '.dol_trunc($label, $maxlengtharticle); |
3837
|
3837
|
|
3838
|
3838
|
// Units |
3839
|
3839
|
$optlabel .= $outvalUnits; |
|
@@ -3850,7 +3850,7 @@ discard block |
|
|
block discarded – undo |
3850
|
3850
|
$prod_supplier->fourn_tva_tx = $objp->tva_tx; |
3851
|
3851
|
$prod_supplier->fk_supplier_price_expression = $objp->fk_supplier_price_expression; |
3852
|
3852
|
|
3853
|
|
- require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php'; |
|
3853
|
+ require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php'; |
3854
|
3854
|
$priceparser = new PriceParser($this->db); |
3855
|
3855
|
$price_result = $priceparser->parseProductSupplier($prod_supplier); |
3856
|
3856
|
if ($price_result >= 0) { |
|
@@ -3861,57 +3861,57 @@ discard block |
|
|
block discarded – undo |
3861
|
3861
|
} |
3862
|
3862
|
} |
3863
|
3863
|
if ($objp->quantity == 1) { |
3864
|
|
- $optlabel .= ' - ' . price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency) . "/"; |
3865
|
|
- $outvallabel .= ' - ' . price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 0, $langs, 0, 0, -1, $conf->currency) . "/"; |
|
3864
|
+ $optlabel .= ' - '.price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency)."/"; |
|
3865
|
+ $outvallabel .= ' - '.price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 0, $langs, 0, 0, -1, $conf->currency)."/"; |
3866
|
3866
|
$optlabel .= $langs->trans("Unit"); // Do not use strtolower because it breaks utf8 encoding |
3867
|
3867
|
$outvallabel .= $langs->transnoentities("Unit"); |
3868
|
3868
|
} else { |
3869
|
|
- $optlabel .= ' - ' . price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency) . "/" . $objp->quantity; |
3870
|
|
- $outvallabel .= ' - ' . price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 0, $langs, 0, 0, -1, $conf->currency) . "/" . $objp->quantity; |
3871
|
|
- $optlabel .= ' ' . $langs->trans("Units"); // Do not use strtolower because it breaks utf8 encoding |
3872
|
|
- $outvallabel .= ' ' . $langs->transnoentities("Units"); |
|
3869
|
+ $optlabel .= ' - '.price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity; |
|
3870
|
+ $outvallabel .= ' - '.price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 0, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity; |
|
3871
|
+ $optlabel .= ' '.$langs->trans("Units"); // Do not use strtolower because it breaks utf8 encoding |
|
3872
|
+ $outvallabel .= ' '.$langs->transnoentities("Units"); |
3873
|
3873
|
} |
3874
|
3874
|
|
3875
|
3875
|
if ($objp->quantity > 1) { |
3876
|
|
- $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 |
3877
|
|
- $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 |
|
3876
|
+ $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 |
|
3877
|
+ $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 |
3878
|
3878
|
} |
3879
|
3879
|
if ($objp->remise_percent >= 1) { |
3880
|
|
- $optlabel .= " - " . $langs->trans("Discount") . " : " . vatrate($objp->remise_percent) . ' %'; |
3881
|
|
- $outvallabel .= " - " . $langs->transnoentities("Discount") . " : " . vatrate($objp->remise_percent) . ' %'; |
|
3880
|
+ $optlabel .= " - ".$langs->trans("Discount")." : ".vatrate($objp->remise_percent).' %'; |
|
3881
|
+ $outvallabel .= " - ".$langs->transnoentities("Discount")." : ".vatrate($objp->remise_percent).' %'; |
3882
|
3882
|
} |
3883
|
3883
|
if ($objp->duration) { |
3884
|
|
- $optlabel .= " - " . $objp->duration; |
3885
|
|
- $outvallabel .= " - " . $objp->duration; |
|
3884
|
+ $optlabel .= " - ".$objp->duration; |
|
3885
|
+ $outvallabel .= " - ".$objp->duration; |
3886
|
3886
|
} |
3887
|
3887
|
if (!$socid) { |
3888
|
|
- $optlabel .= " - " . dol_trunc($objp->name, 8); |
3889
|
|
- $outvallabel .= " - " . dol_trunc($objp->name, 8); |
|
3888
|
+ $optlabel .= " - ".dol_trunc($objp->name, 8); |
|
3889
|
+ $outvallabel .= " - ".dol_trunc($objp->name, 8); |
3890
|
3890
|
} |
3891
|
3891
|
if ($objp->supplier_reputation) { |
3892
|
3892
|
//TODO dictionary |
3893
|
3893
|
$reputations = array('' => $langs->trans('Standard'), 'FAVORITE' => $langs->trans('Favorite'), 'NOTTHGOOD' => $langs->trans('NotTheGoodQualitySupplier'), 'DONOTORDER' => $langs->trans('DoNotOrderThisProductToThisSupplier')); |
3894
|
3894
|
|
3895
|
|
- $optlabel .= " - " . $reputations[$objp->supplier_reputation]; |
3896
|
|
- $outvallabel .= " - " . $reputations[$objp->supplier_reputation]; |
|
3895
|
+ $optlabel .= " - ".$reputations[$objp->supplier_reputation]; |
|
3896
|
+ $outvallabel .= " - ".$reputations[$objp->supplier_reputation]; |
3897
|
3897
|
} |
3898
|
3898
|
} else { |
3899
|
|
- $optlabel .= " - <span class='opacitymedium'>" . $langs->trans("NoPriceDefinedForThisSupplier") . '</span>'; |
3900
|
|
- $outvallabel .= ' - ' . $langs->transnoentities("NoPriceDefinedForThisSupplier"); |
|
3899
|
+ $optlabel .= " - <span class='opacitymedium'>".$langs->trans("NoPriceDefinedForThisSupplier").'</span>'; |
|
3900
|
+ $outvallabel .= ' - '.$langs->transnoentities("NoPriceDefinedForThisSupplier"); |
3901
|
3901
|
} |
3902
|
3902
|
|
3903
|
3903
|
if (isModEnabled('stock') && $showstockinlist && isset($objp->stock) && ($objp->fk_product_type == Product::TYPE_PRODUCT || getDolGlobalString('STOCK_SUPPORTS_SERVICES'))) { |
3904
|
3904
|
$novirtualstock = ($showstockinlist == 2); |
3905
|
3905
|
|
3906
|
3906
|
if ($user->hasRight('stock', 'lire')) { |
3907
|
|
- $outvallabel .= ' - ' . $langs->trans("Stock") . ': ' . price(price2num($objp->stock, 'MS')); |
|
3907
|
+ $outvallabel .= ' - '.$langs->trans("Stock").': '.price(price2num($objp->stock, 'MS')); |
3908
|
3908
|
|
3909
|
3909
|
if ($objp->stock > 0) { |
3910
|
3910
|
$optlabel .= ' - <span class="product_line_stock_ok">'; |
3911
|
3911
|
} elseif ($objp->stock <= 0) { |
3912
|
3912
|
$optlabel .= ' - <span class="product_line_stock_too_low">'; |
3913
|
3913
|
} |
3914
|
|
- $optlabel .= $langs->transnoentities("Stock") . ':' . price(price2num($objp->stock, 'MS')); |
|
3914
|
+ $optlabel .= $langs->transnoentities("Stock").':'.price(price2num($objp->stock, 'MS')); |
3915
|
3915
|
$optlabel .= '</span>'; |
3916
|
3916
|
if (empty($novirtualstock) && getDolGlobalString('STOCK_SHOW_VIRTUAL_STOCK_IN_PRODUCTS_COMBO')) { // Warning, this option may slow down combo list generation |
3917
|
3917
|
$langs->load("stocks"); |
|
@@ -3921,9 +3921,9 @@ discard block |
|
|
block discarded – undo |
3921
|
3921
|
$tmpproduct->load_virtual_stock(); |
3922
|
3922
|
$virtualstock = $tmpproduct->stock_theorique; |
3923
|
3923
|
|
3924
|
|
- $outvallabel .= ' - ' . $langs->trans("VirtualStock") . ':' . $virtualstock; |
|
3924
|
+ $outvallabel .= ' - '.$langs->trans("VirtualStock").':'.$virtualstock; |
3925
|
3925
|
|
3926
|
|
- $optlabel .= ' - ' . $langs->transnoentities("VirtualStock") . ':'; |
|
3926
|
+ $optlabel .= ' - '.$langs->transnoentities("VirtualStock").':'; |
3927
|
3927
|
if ($virtualstock > 0) { |
3928
|
3928
|
$optlabel .= '<span class="product_line_stock_ok">'; |
3929
|
3929
|
} elseif ($virtualstock <= 0) { |
|
@@ -3937,7 +3937,7 @@ discard block |
|
|
block discarded – undo |
3937
|
3937
|
} |
3938
|
3938
|
} |
3939
|
3939
|
|
3940
|
|
- $optstart = '<option value="' . $outkey . '"'; |
|
3940
|
+ $optstart = '<option value="'.$outkey.'"'; |
3941
|
3941
|
if ($selected && $selected == $objp->idprodfournprice) { |
3942
|
3942
|
$optstart .= ' selected'; |
3943
|
3943
|
} |
|
@@ -3946,31 +3946,31 @@ discard block |
|
|
block discarded – undo |
3946
|
3946
|
} |
3947
|
3947
|
|
3948
|
3948
|
if (!empty($objp->idprodfournprice) && $objp->idprodfournprice > 0) { |
3949
|
|
- $optstart .= ' data-product-id="' . dol_escape_htmltag($objp->rowid) . '"'; |
3950
|
|
- $optstart .= ' data-price-id="' . dol_escape_htmltag($objp->idprodfournprice) . '"'; |
3951
|
|
- $optstart .= ' data-qty="' . dol_escape_htmltag($objp->quantity) . '"'; |
3952
|
|
- $optstart .= ' data-up="' . dol_escape_htmltag(price2num($objp->unitprice)) . '"'; |
3953
|
|
- $optstart .= ' data-up-locale="' . dol_escape_htmltag(price($objp->unitprice)) . '"'; |
3954
|
|
- $optstart .= ' data-discount="' . dol_escape_htmltag($outdiscount) . '"'; |
3955
|
|
- $optstart .= ' data-tvatx="' . dol_escape_htmltag(price2num($objp->tva_tx)) . '"'; |
3956
|
|
- $optstart .= ' data-tvatx-formated="' . dol_escape_htmltag(price($objp->tva_tx, 0, $langs, 1, -1, 2)) . '"'; |
3957
|
|
- $optstart .= ' data-default-vat-code="' . dol_escape_htmltag($objp->default_vat_code) . '"'; |
3958
|
|
- $optstart .= ' data-supplier-ref="' . dol_escape_htmltag($objp->ref_fourn) . '"'; |
|
3949
|
+ $optstart .= ' data-product-id="'.dol_escape_htmltag($objp->rowid).'"'; |
|
3950
|
+ $optstart .= ' data-price-id="'.dol_escape_htmltag($objp->idprodfournprice).'"'; |
|
3951
|
+ $optstart .= ' data-qty="'.dol_escape_htmltag($objp->quantity).'"'; |
|
3952
|
+ $optstart .= ' data-up="'.dol_escape_htmltag(price2num($objp->unitprice)).'"'; |
|
3953
|
+ $optstart .= ' data-up-locale="'.dol_escape_htmltag(price($objp->unitprice)).'"'; |
|
3954
|
+ $optstart .= ' data-discount="'.dol_escape_htmltag($outdiscount).'"'; |
|
3955
|
+ $optstart .= ' data-tvatx="'.dol_escape_htmltag(price2num($objp->tva_tx)).'"'; |
|
3956
|
+ $optstart .= ' data-tvatx-formated="'.dol_escape_htmltag(price($objp->tva_tx, 0, $langs, 1, -1, 2)).'"'; |
|
3957
|
+ $optstart .= ' data-default-vat-code="'.dol_escape_htmltag($objp->default_vat_code).'"'; |
|
3958
|
+ $optstart .= ' data-supplier-ref="'.dol_escape_htmltag($objp->ref_fourn).'"'; |
3959
|
3959
|
if (isModEnabled('multicurrency')) { |
3960
|
|
- $optstart .= ' data-multicurrency-code="' . dol_escape_htmltag($objp->multicurrency_code) . '"'; |
3961
|
|
- $optstart .= ' data-multicurrency-up="' . dol_escape_htmltag($objp->multicurrency_unitprice) . '"'; |
|
3960
|
+ $optstart .= ' data-multicurrency-code="'.dol_escape_htmltag($objp->multicurrency_code).'"'; |
|
3961
|
+ $optstart .= ' data-multicurrency-up="'.dol_escape_htmltag($objp->multicurrency_unitprice).'"'; |
3962
|
3962
|
} |
3963
|
3963
|
} |
3964
|
|
- $optstart .= ' data-description="' . dol_escape_htmltag($objp->description, 0, 1) . '"'; |
|
3964
|
+ $optstart .= ' data-description="'.dol_escape_htmltag($objp->description, 0, 1).'"'; |
3965
|
3965
|
|
3966
|
3966
|
$outarrayentry = array( |
3967
|
3967
|
'key' => $outkey, |
3968
|
3968
|
'value' => $outref, |
3969
|
3969
|
'label' => $outvallabel, |
3970
|
3970
|
'qty' => $outqty, |
3971
|
|
- 'price_qty_ht' => price2num($objp->fprice, 'MU'), // Keep higher resolution for price for the min qty |
3972
|
|
- 'price_unit_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price |
3973
|
|
- 'price_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price (for compatibility) |
|
3971
|
+ 'price_qty_ht' => price2num($objp->fprice, 'MU'), // Keep higher resolution for price for the min qty |
|
3972
|
+ 'price_unit_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price |
|
3973
|
+ 'price_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price (for compatibility) |
3974
|
3974
|
'tva_tx_formated' => price($objp->tva_tx, 0, $langs, 1, -1, 2), |
3975
|
3975
|
'tva_tx' => price2num($objp->tva_tx), |
3976
|
3976
|
'default_vat_code' => $objp->default_vat_code, |
|
@@ -4000,17 +4000,17 @@ discard block |
|
|
block discarded – undo |
4000
|
4000
|
// Add new entry |
4001
|
4001
|
// "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 |
4002
|
4002
|
// "label" value of json key array is used by jQuery automatically as text for combo box |
4003
|
|
- $out .= $optstart . ' data-html="' . dol_escape_htmltag($optlabel) . '">' . $optlabel . "</option>\n"; |
|
4003
|
+ $out .= $optstart.' data-html="'.dol_escape_htmltag($optlabel).'">'.$optlabel."</option>\n"; |
4004
|
4004
|
$outarraypush = array( |
4005
|
4005
|
'key' => $outkey, |
4006
|
4006
|
'value' => $outref, |
4007
|
4007
|
'label' => $outvallabel, |
4008
|
4008
|
'qty' => $outqty, |
4009
|
|
- 'price_qty_ht' => price2num($objp->fprice, 'MU'), // Keep higher resolution for price for the min qty |
|
4009
|
+ 'price_qty_ht' => price2num($objp->fprice, 'MU'), // Keep higher resolution for price for the min qty |
4010
|
4010
|
'price_qty_ht_locale' => price($objp->fprice), |
4011
|
|
- 'price_unit_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price |
|
4011
|
+ 'price_unit_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price |
4012
|
4012
|
'price_unit_ht_locale' => price($objp->unitprice), |
4013
|
|
- 'price_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price (for compatibility) |
|
4013
|
+ 'price_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price (for compatibility) |
4014
|
4014
|
'tva_tx_formated' => price($objp->tva_tx), |
4015
|
4015
|
'tva_tx' => price2num($objp->tva_tx), |
4016
|
4016
|
'default_vat_code' => $objp->default_vat_code, |
|
@@ -4043,7 +4043,7 @@ discard block |
|
|
block discarded – undo |
4043
|
4043
|
|
4044
|
4044
|
$this->db->free($result); |
4045
|
4045
|
|
4046
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
4046
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
4047
|
4047
|
$out .= ajax_combobox($htmlname); |
4048
|
4048
|
} else { |
4049
|
4049
|
dol_print_error($this->db); |
|
@@ -4075,43 +4075,43 @@ discard block |
|
|
block discarded – undo |
4075
|
4075
|
$sql = "SELECT p.rowid, p.ref, p.label, p.price, p.duration, pfp.fk_soc,"; |
4076
|
4076
|
$sql .= " pfp.ref_fourn, pfp.rowid as idprodfournprice, pfp.price as fprice, pfp.remise_percent, pfp.quantity, pfp.unitprice,"; |
4077
|
4077
|
$sql .= " pfp.fk_supplier_price_expression, pfp.fk_product, pfp.tva_tx, s.nom as name"; |
4078
|
|
- $sql .= " FROM " . $this->db->prefix() . "product as p"; |
4079
|
|
- $sql .= " LEFT JOIN " . $this->db->prefix() . "product_fournisseur_price as pfp ON p.rowid = pfp.fk_product"; |
4080
|
|
- $sql .= " LEFT JOIN " . $this->db->prefix() . "societe as s ON pfp.fk_soc = s.rowid"; |
4081
|
|
- $sql .= " WHERE pfp.entity IN (" . getEntity('productsupplierprice') . ")"; |
|
4078
|
+ $sql .= " FROM ".$this->db->prefix()."product as p"; |
|
4079
|
+ $sql .= " LEFT JOIN ".$this->db->prefix()."product_fournisseur_price as pfp ON p.rowid = pfp.fk_product"; |
|
4080
|
+ $sql .= " LEFT JOIN ".$this->db->prefix()."societe as s ON pfp.fk_soc = s.rowid"; |
|
4081
|
+ $sql .= " WHERE pfp.entity IN (".getEntity('productsupplierprice').")"; |
4082
|
4082
|
$sql .= " AND p.tobuy = 1"; |
4083
|
4083
|
$sql .= " AND s.fournisseur = 1"; |
4084
|
|
- $sql .= " AND p.rowid = " . ((int) $productid); |
|
4084
|
+ $sql .= " AND p.rowid = ".((int) $productid); |
4085
|
4085
|
if (!getDolGlobalString('PRODUCT_BEST_SUPPLIER_PRICE_PRESELECTED')) { |
4086
|
4086
|
$sql .= " ORDER BY s.nom, pfp.ref_fourn DESC"; |
4087
|
4087
|
} else { |
4088
|
4088
|
$sql .= " ORDER BY pfp.unitprice ASC"; |
4089
|
4089
|
} |
4090
|
4090
|
|
4091
|
|
- dol_syslog(get_class($this) . "::select_product_fourn_price", LOG_DEBUG); |
|
4091
|
+ dol_syslog(get_class($this)."::select_product_fourn_price", LOG_DEBUG); |
4092
|
4092
|
$result = $this->db->query($sql); |
4093
|
4093
|
|
4094
|
4094
|
if ($result) { |
4095
|
4095
|
$num = $this->db->num_rows($result); |
4096
|
4096
|
|
4097
|
|
- $form = '<select class="flat" id="select_' . $htmlname . '" name="' . $htmlname . '">'; |
|
4097
|
+ $form = '<select class="flat" id="select_'.$htmlname.'" name="'.$htmlname.'">'; |
4098
|
4098
|
|
4099
|
4099
|
if (!$num) { |
4100
|
|
- $form .= '<option value="0">-- ' . $langs->trans("NoSupplierPriceDefinedForThisProduct") . ' --</option>'; |
|
4100
|
+ $form .= '<option value="0">-- '.$langs->trans("NoSupplierPriceDefinedForThisProduct").' --</option>'; |
4101
|
4101
|
} else { |
4102
|
|
- require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php'; |
|
4102
|
+ require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php'; |
4103
|
4103
|
$form .= '<option value="0"> </option>'; |
4104
|
4104
|
|
4105
|
4105
|
$i = 0; |
4106
|
4106
|
while ($i < $num) { |
4107
|
4107
|
$objp = $this->db->fetch_object($result); |
4108
|
4108
|
|
4109
|
|
- $opt = '<option value="' . $objp->idprodfournprice . '"'; |
|
4109
|
+ $opt = '<option value="'.$objp->idprodfournprice.'"'; |
4110
|
4110
|
//if there is only one supplier, preselect it |
4111
|
4111
|
if ($num == 1 || ($selected_supplier > 0 && $objp->fk_soc == $selected_supplier) || ($i == 0 && getDolGlobalString('PRODUCT_BEST_SUPPLIER_PRICE_PRESELECTED'))) { |
4112
|
4112
|
$opt .= ' selected'; |
4113
|
4113
|
} |
4114
|
|
- $opt .= '>' . $objp->name . ' - ' . $objp->ref_fourn . ' - '; |
|
4114
|
+ $opt .= '>'.$objp->name.' - '.$objp->ref_fourn.' - '; |
4115
|
4115
|
|
4116
|
4116
|
if (isModEnabled('dynamicprices') && !empty($objp->fk_supplier_price_expression)) { |
4117
|
4117
|
$prod_supplier = new ProductFournisseur($this->db); |
|
@@ -4121,7 +4121,7 @@ discard block |
|
|
block discarded – undo |
4121
|
4121
|
$prod_supplier->fourn_tva_tx = $objp->tva_tx; |
4122
|
4122
|
$prod_supplier->fk_supplier_price_expression = $objp->fk_supplier_price_expression; |
4123
|
4123
|
|
4124
|
|
- require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php'; |
|
4124
|
+ require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php'; |
4125
|
4125
|
$priceparser = new PriceParser($this->db); |
4126
|
4126
|
$price_result = $priceparser->parseProductSupplier($prod_supplier); |
4127
|
4127
|
if ($price_result >= 0) { |
|
@@ -4132,10 +4132,10 @@ discard block |
|
|
block discarded – undo |
4132
|
4132
|
} |
4133
|
4133
|
} |
4134
|
4134
|
if ($objp->quantity == 1) { |
4135
|
|
- $opt .= price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency) . "/"; |
|
4135
|
+ $opt .= price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency)."/"; |
4136
|
4136
|
} |
4137
|
4137
|
|
4138
|
|
- $opt .= $objp->quantity . ' '; |
|
4138
|
+ $opt .= $objp->quantity.' '; |
4139
|
4139
|
|
4140
|
4140
|
if ($objp->quantity == 1) { |
4141
|
4141
|
$opt .= $langs->trans("Unit"); |
|
@@ -4144,10 +4144,10 @@ discard block |
|
|
block discarded – undo |
4144
|
4144
|
} |
4145
|
4145
|
if ($objp->quantity > 1) { |
4146
|
4146
|
$opt .= " - "; |
4147
|
|
- $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"); |
|
4147
|
+ $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"); |
4148
|
4148
|
} |
4149
|
4149
|
if ($objp->duration) { |
4150
|
|
- $opt .= " - " . $objp->duration; |
|
4150
|
+ $opt .= " - ".$objp->duration; |
4151
|
4151
|
} |
4152
|
4152
|
$opt .= "</option>\n"; |
4153
|
4153
|
|
|
@@ -4185,8 +4185,8 @@ discard block |
|
|
block discarded – undo |
4185
|
4185
|
dol_syslog(__METHOD__, LOG_DEBUG); |
4186
|
4186
|
|
4187
|
4187
|
$sql = "SELECT rowid, code, libelle as label, deposit_percent"; |
4188
|
|
- $sql .= " FROM " . $this->db->prefix() . 'c_payment_term'; |
4189
|
|
- $sql .= " WHERE entity IN (" . getEntity('c_payment_term') . ")"; |
|
4188
|
+ $sql .= " FROM ".$this->db->prefix().'c_payment_term'; |
|
4189
|
+ $sql .= " WHERE entity IN (".getEntity('c_payment_term').")"; |
4190
|
4190
|
$sql .= " AND active > 0"; |
4191
|
4191
|
$sql .= " ORDER BY sortorder"; |
4192
|
4192
|
|
|
@@ -4198,7 +4198,7 @@ discard block |
|
|
block discarded – undo |
4198
|
4198
|
$obj = $this->db->fetch_object($resql); |
4199
|
4199
|
|
4200
|
4200
|
// Si traduction existe, on l'utilise, sinon on prend le libelle par default |
4201
|
|
- $label = ($langs->trans("PaymentConditionShort" . $obj->code) != "PaymentConditionShort" . $obj->code ? $langs->trans("PaymentConditionShort" . $obj->code) : ($obj->label != '-' ? $obj->label : '')); |
|
4201
|
+ $label = ($langs->trans("PaymentConditionShort".$obj->code) != "PaymentConditionShort".$obj->code ? $langs->trans("PaymentConditionShort".$obj->code) : ($obj->label != '-' ? $obj->label : '')); |
4202
|
4202
|
$this->cache_conditions_paiements[$obj->rowid]['code'] = $obj->code; |
4203
|
4203
|
$this->cache_conditions_paiements[$obj->rowid]['label'] = $label; |
4204
|
4204
|
$this->cache_conditions_paiements[$obj->rowid]['deposit_percent'] = $obj->deposit_percent; |
|
@@ -4226,7 +4226,7 @@ discard block |
|
|
block discarded – undo |
4226
|
4226
|
// phpcs:enable |
4227
|
4227
|
global $langs; |
4228
|
4228
|
|
4229
|
|
- $num = count($this->cache_availability); // TODO Use $conf->cache['availability'] instead of $this->cache_availability |
|
4229
|
+ $num = count($this->cache_availability); // TODO Use $conf->cache['availability'] instead of $this->cache_availability |
4230
|
4230
|
if ($num > 0) { |
4231
|
4231
|
return 0; // Cache already loaded |
4232
|
4232
|
} |
|
@@ -4236,7 +4236,7 @@ discard block |
|
|
block discarded – undo |
4236
|
4236
|
$langs->load('propal'); |
4237
|
4237
|
|
4238
|
4238
|
$sql = "SELECT rowid, code, label, position"; |
4239
|
|
- $sql .= " FROM " . $this->db->prefix() . 'c_availability'; |
|
4239
|
+ $sql .= " FROM ".$this->db->prefix().'c_availability'; |
4240
|
4240
|
$sql .= " WHERE active > 0"; |
4241
|
4241
|
|
4242
|
4242
|
$resql = $this->db->query($sql); |
|
@@ -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("AvailabilityType" . $obj->code) != "AvailabilityType" . $obj->code ? $langs->trans("AvailabilityType" . $obj->code) : ($obj->label != '-' ? $obj->label : '')); |
|
4250
|
+ $label = ($langs->trans("AvailabilityType".$obj->code) != "AvailabilityType".$obj->code ? $langs->trans("AvailabilityType".$obj->code) : ($obj->label != '-' ? $obj->label : '')); |
4251
|
4251
|
$this->cache_availability[$obj->rowid]['code'] = $obj->code; |
4252
|
4252
|
$this->cache_availability[$obj->rowid]['label'] = $label; |
4253
|
4253
|
$this->cache_availability[$obj->rowid]['position'] = $obj->position; |
|
@@ -4279,17 +4279,17 @@ discard block |
|
|
block discarded – undo |
4279
|
4279
|
|
4280
|
4280
|
$this->load_cache_availability(); |
4281
|
4281
|
|
4282
|
|
- dol_syslog(__METHOD__ . " selected=" . $selected . ", htmlname=" . $htmlname, LOG_DEBUG); |
|
4282
|
+ dol_syslog(__METHOD__." selected=".$selected.", htmlname=".$htmlname, LOG_DEBUG); |
4283
|
4283
|
|
4284
|
|
- print '<select id="' . $htmlname . '" class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">'; |
|
4284
|
+ print '<select id="'.$htmlname.'" class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">'; |
4285
|
4285
|
if ($addempty) { |
4286
|
4286
|
print '<option value="0"> </option>'; |
4287
|
4287
|
} |
4288
|
4288
|
foreach ($this->cache_availability as $id => $arrayavailability) { |
4289
|
4289
|
if ($selected == $id) { |
4290
|
|
- print '<option value="' . $id . '" selected>'; |
|
4290
|
+ print '<option value="'.$id.'" selected>'; |
4291
|
4291
|
} else { |
4292
|
|
- print '<option value="' . $id . '">'; |
|
4292
|
+ print '<option value="'.$id.'">'; |
4293
|
4293
|
} |
4294
|
4294
|
print dol_escape_htmltag($arrayavailability['label']); |
4295
|
4295
|
print '</option>'; |
|
@@ -4310,13 +4310,13 @@ discard block |
|
|
block discarded – undo |
4310
|
4310
|
{ |
4311
|
4311
|
global $langs; |
4312
|
4312
|
|
4313
|
|
- $num = count($this->cache_demand_reason); // TODO Use $conf->cache['input_reason'] instead of $this->cache_demand_reason |
|
4313
|
+ $num = count($this->cache_demand_reason); // TODO Use $conf->cache['input_reason'] instead of $this->cache_demand_reason |
4314
|
4314
|
if ($num > 0) { |
4315
|
4315
|
return 0; // Cache already loaded |
4316
|
4316
|
} |
4317
|
4317
|
|
4318
|
4318
|
$sql = "SELECT rowid, code, label"; |
4319
|
|
- $sql .= " FROM " . $this->db->prefix() . 'c_input_reason'; |
|
4319
|
+ $sql .= " FROM ".$this->db->prefix().'c_input_reason'; |
4320
|
4320
|
$sql .= " WHERE active > 0"; |
4321
|
4321
|
|
4322
|
4322
|
$resql = $this->db->query($sql); |
|
@@ -4329,8 +4329,8 @@ discard block |
|
|
block discarded – undo |
4329
|
4329
|
|
4330
|
4330
|
// Si traduction existe, on l'utilise, sinon on prend le libelle par default |
4331
|
4331
|
$label = ($obj->label != '-' ? $obj->label : ''); |
4332
|
|
- if ($langs->trans("DemandReasonType" . $obj->code) != "DemandReasonType" . $obj->code) { |
4333
|
|
- $label = $langs->trans("DemandReasonType" . $obj->code); // So translation key DemandReasonTypeSRC_XXX will work |
|
4332
|
+ if ($langs->trans("DemandReasonType".$obj->code) != "DemandReasonType".$obj->code) { |
|
4333
|
+ $label = $langs->trans("DemandReasonType".$obj->code); // So translation key DemandReasonTypeSRC_XXX will work |
4334
|
4334
|
} |
4335
|
4335
|
if ($langs->trans($obj->code) != $obj->code) { |
4336
|
4336
|
$label = $langs->trans($obj->code); // So translation key SRC_XXX will work |
|
@@ -4370,9 +4370,9 @@ discard block |
|
|
block discarded – undo |
4370
|
4370
|
|
4371
|
4371
|
$this->loadCacheInputReason(); |
4372
|
4372
|
|
4373
|
|
- print '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" id="select_' . $htmlname . '" name="' . $htmlname . '">'; |
|
4373
|
+ print '<select class="flat'.($morecss ? ' '.$morecss : '').'" id="select_'.$htmlname.'" name="'.$htmlname.'">'; |
4374
|
4374
|
if ($addempty) { |
4375
|
|
- print '<option value="0"' . (empty($selected) ? ' selected' : '') . '> </option>'; |
|
4375
|
+ print '<option value="0"'.(empty($selected) ? ' selected' : '').'> </option>'; |
4376
|
4376
|
} |
4377
|
4377
|
foreach ($this->cache_demand_reason as $id => $arraydemandreason) { |
4378
|
4378
|
if ($arraydemandreason['code'] == $exclude) { |
|
@@ -4380,9 +4380,9 @@ discard block |
|
|
block discarded – undo |
4380
|
4380
|
} |
4381
|
4381
|
|
4382
|
4382
|
if ($selected && ($selected == $arraydemandreason['id'] || $selected == $arraydemandreason['code'])) { |
4383
|
|
- print '<option value="' . $arraydemandreason['id'] . '" selected>'; |
|
4383
|
+ print '<option value="'.$arraydemandreason['id'].'" selected>'; |
4384
|
4384
|
} else { |
4385
|
|
- print '<option value="' . $arraydemandreason['id'] . '">'; |
|
4385
|
+ print '<option value="'.$arraydemandreason['id'].'">'; |
4386
|
4386
|
} |
4387
|
4387
|
$label = $arraydemandreason['label']; // Translation of label was already done into the ->loadCacheInputReason |
4388
|
4388
|
print $langs->trans($label); |
|
@@ -4392,7 +4392,7 @@ discard block |
|
|
block discarded – undo |
4392
|
4392
|
if ($user->admin && empty($notooltip)) { |
4393
|
4393
|
print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); |
4394
|
4394
|
} |
4395
|
|
- print ajax_combobox('select_' . $htmlname); |
|
4395
|
+ print ajax_combobox('select_'.$htmlname); |
4396
|
4396
|
} |
4397
|
4397
|
|
4398
|
4398
|
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
@@ -4407,7 +4407,7 @@ discard block |
|
|
block discarded – undo |
4407
|
4407
|
// phpcs:enable |
4408
|
4408
|
global $langs; |
4409
|
4409
|
|
4410
|
|
- $num = count($this->cache_types_paiements); // TODO Use $conf->cache['payment_mode'] instead of $this->cache_types_paiements |
|
4410
|
+ $num = count($this->cache_types_paiements); // TODO Use $conf->cache['payment_mode'] instead of $this->cache_types_paiements |
4411
|
4411
|
if ($num > 0) { |
4412
|
4412
|
return $num; // Cache already loaded |
4413
|
4413
|
} |
|
@@ -4417,8 +4417,8 @@ discard block |
|
|
block discarded – undo |
4417
|
4417
|
$this->cache_types_paiements = array(); |
4418
|
4418
|
|
4419
|
4419
|
$sql = "SELECT id, code, libelle as label, type, active"; |
4420
|
|
- $sql .= " FROM " . $this->db->prefix() . "c_paiement"; |
4421
|
|
- $sql .= " WHERE entity IN (" . getEntity('c_paiement') . ")"; |
|
4420
|
+ $sql .= " FROM ".$this->db->prefix()."c_paiement"; |
|
4421
|
+ $sql .= " WHERE entity IN (".getEntity('c_paiement').")"; |
4422
|
4422
|
|
4423
|
4423
|
$resql = $this->db->query($sql); |
4424
|
4424
|
if ($resql) { |
|
@@ -4428,7 +4428,7 @@ discard block |
|
|
block discarded – undo |
4428
|
4428
|
$obj = $this->db->fetch_object($resql); |
4429
|
4429
|
|
4430
|
4430
|
// Si traduction existe, on l'utilise, sinon on prend le libelle par default |
4431
|
|
- $label = ($langs->transnoentitiesnoconv("PaymentTypeShort" . $obj->code) != "PaymentTypeShort" . $obj->code ? $langs->transnoentitiesnoconv("PaymentTypeShort" . $obj->code) : ($obj->label != '-' ? $obj->label : '')); |
|
4431
|
+ $label = ($langs->transnoentitiesnoconv("PaymentTypeShort".$obj->code) != "PaymentTypeShort".$obj->code ? $langs->transnoentitiesnoconv("PaymentTypeShort".$obj->code) : ($obj->label != '-' ? $obj->label : '')); |
4432
|
4432
|
$this->cache_types_paiements[$obj->id]['id'] = $obj->id; |
4433
|
4433
|
$this->cache_types_paiements[$obj->id]['code'] = $obj->code; |
4434
|
4434
|
$this->cache_types_paiements[$obj->id]['label'] = $label; |
|
@@ -4500,17 +4500,17 @@ discard block |
|
|
block discarded – undo |
4500
|
4500
|
global $langs, $user, $conf; |
4501
|
4501
|
|
4502
|
4502
|
$out = ''; |
4503
|
|
- dol_syslog(__METHOD__ . " selected=" . $selected . ", htmlname=" . $htmlname, LOG_DEBUG); |
|
4503
|
+ dol_syslog(__METHOD__." selected=".$selected.", htmlname=".$htmlname, LOG_DEBUG); |
4504
|
4504
|
|
4505
|
4505
|
$this->load_cache_conditions_paiements(); |
4506
|
4506
|
|
4507
|
4507
|
// Set default value if not already set by caller |
4508
|
4508
|
if (empty($selected) && getDolGlobalString('MAIN_DEFAULT_PAYMENT_TERM_ID')) { |
4509
|
|
- dol_syslog(__METHOD__ . "Using deprecated option MAIN_DEFAULT_PAYMENT_TERM_ID", LOG_NOTICE); |
|
4509
|
+ dol_syslog(__METHOD__."Using deprecated option MAIN_DEFAULT_PAYMENT_TERM_ID", LOG_NOTICE); |
4510
|
4510
|
$selected = getDolGlobalString('MAIN_DEFAULT_PAYMENT_TERM_ID'); |
4511
|
4511
|
} |
4512
|
4512
|
|
4513
|
|
- $out .= '<select id="' . $htmlname . '" class="flat selectpaymentterms' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">'; |
|
4513
|
+ $out .= '<select id="'.$htmlname.'" class="flat selectpaymentterms'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">'; |
4514
|
4514
|
if ($addempty) { |
4515
|
4515
|
$out .= '<option value="0"> </option>'; |
4516
|
4516
|
} |
|
@@ -4524,9 +4524,9 @@ discard block |
|
|
block discarded – undo |
4524
|
4524
|
|
4525
|
4525
|
if ($selected == $id) { |
4526
|
4526
|
$selectedDepositPercent = $deposit_percent > 0 ? $deposit_percent : $arrayconditions['deposit_percent']; |
4527
|
|
- $out .= '<option value="' . $id . '" data-deposit_percent="' . $arrayconditions['deposit_percent'] . '" selected>'; |
|
4527
|
+ $out .= '<option value="'.$id.'" data-deposit_percent="'.$arrayconditions['deposit_percent'].'" selected>'; |
4528
|
4528
|
} else { |
4529
|
|
- $out .= '<option value="' . $id . '" data-deposit_percent="' . $arrayconditions['deposit_percent'] . '">'; |
|
4529
|
+ $out .= '<option value="'.$id.'" data-deposit_percent="'.$arrayconditions['deposit_percent'].'">'; |
4530
|
4530
|
} |
4531
|
4531
|
$label = $arrayconditions['label']; |
4532
|
4532
|
|
|
@@ -4544,21 +4544,21 @@ discard block |
|
|
block discarded – undo |
4544
|
4544
|
$out .= ajax_combobox($htmlname); |
4545
|
4545
|
|
4546
|
4546
|
if ($deposit_percent >= 0) { |
4547
|
|
- $out .= ' <span id="' . $htmlname . '_deposit_percent_container"' . (empty($selectedDepositPercent) ? ' style="display: none"' : '') . '>'; |
4548
|
|
- $out .= $langs->trans('DepositPercent') . ' : '; |
4549
|
|
- $out .= '<input id="' . $htmlname . '_deposit_percent" name="' . $htmlname . '_deposit_percent" class="maxwidth50" value="' . $deposit_percent . '" />'; |
|
4547
|
+ $out .= ' <span id="'.$htmlname.'_deposit_percent_container"'.(empty($selectedDepositPercent) ? ' style="display: none"' : '').'>'; |
|
4548
|
+ $out .= $langs->trans('DepositPercent').' : '; |
|
4549
|
+ $out .= '<input id="'.$htmlname.'_deposit_percent" name="'.$htmlname.'_deposit_percent" class="maxwidth50" value="'.$deposit_percent.'" />'; |
4550
|
4550
|
$out .= '</span>'; |
4551
|
4551
|
$out .= ' |
4552
|
|
- <script nonce="' . getNonce() . '"> |
|
4552
|
+ <script nonce="' . getNonce().'"> |
4553
|
4553
|
$(document).ready(function () { |
4554
|
|
- $("#' . $htmlname . '").change(function () { |
|
4554
|
+ $("#' . $htmlname.'").change(function () { |
4555
|
4555
|
let $selected = $(this).find("option:selected"); |
4556
|
4556
|
let depositPercent = $selected.attr("data-deposit_percent"); |
4557
|
4557
|
|
4558
|
4558
|
if (depositPercent.length > 0) { |
4559
|
|
- $("#' . $htmlname . '_deposit_percent_container").show().find("#' . $htmlname . '_deposit_percent").val(depositPercent); |
|
4559
|
+ $("#' . $htmlname.'_deposit_percent_container").show().find("#'.$htmlname.'_deposit_percent").val(depositPercent); |
4560
|
4560
|
} else { |
4561
|
|
- $("#' . $htmlname . '_deposit_percent_container").hide(); |
|
4561
|
+ $("#' . $htmlname.'_deposit_percent_container").hide(); |
4562
|
4562
|
} |
4563
|
4563
|
|
4564
|
4564
|
return true; |
|
@@ -4596,7 +4596,7 @@ discard block |
|
|
block discarded – undo |
4596
|
4596
|
|
4597
|
4597
|
$out = ''; |
4598
|
4598
|
|
4599
|
|
- dol_syslog(__METHOD__ . " " . $selected . ", " . $htmlname . ", " . $filtertype . ", " . $format, LOG_DEBUG); |
|
4599
|
+ dol_syslog(__METHOD__." ".$selected.", ".$htmlname.", ".$filtertype.", ".$format, LOG_DEBUG); |
4600
|
4600
|
|
4601
|
4601
|
$filterarray = array(); |
4602
|
4602
|
if ($filtertype == 'CRDT') { |
|
@@ -4611,11 +4611,11 @@ discard block |
|
|
block discarded – undo |
4611
|
4611
|
|
4612
|
4612
|
// Set default value if not already set by caller |
4613
|
4613
|
if (empty($selected) && getDolGlobalString('MAIN_DEFAULT_PAYMENT_TYPE_ID')) { |
4614
|
|
- dol_syslog(__METHOD__ . "Using deprecated option MAIN_DEFAULT_PAYMENT_TYPE_ID", LOG_NOTICE); |
|
4614
|
+ dol_syslog(__METHOD__."Using deprecated option MAIN_DEFAULT_PAYMENT_TYPE_ID", LOG_NOTICE); |
4615
|
4615
|
$selected = getDolGlobalString('MAIN_DEFAULT_PAYMENT_TYPE_ID'); |
4616
|
4616
|
} |
4617
|
4617
|
|
4618
|
|
- $out .= '<select id="select' . $htmlname . '" class="flat selectpaymenttypes' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">'; |
|
4618
|
+ $out .= '<select id="select'.$htmlname.'" class="flat selectpaymenttypes'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">'; |
4619
|
4619
|
if ($empty) { |
4620
|
4620
|
$out .= '<option value=""> </option>'; |
4621
|
4621
|
} |
|
@@ -4636,13 +4636,13 @@ discard block |
|
|
block discarded – undo |
4636
|
4636
|
} |
4637
|
4637
|
|
4638
|
4638
|
if ($format == 0) { |
4639
|
|
- $out .= '<option value="' . $id . '"'; |
|
4639
|
+ $out .= '<option value="'.$id.'"'; |
4640
|
4640
|
} elseif ($format == 1) { |
4641
|
|
- $out .= '<option value="' . $arraytypes['code'] . '"'; |
|
4641
|
+ $out .= '<option value="'.$arraytypes['code'].'"'; |
4642
|
4642
|
} elseif ($format == 2) { |
4643
|
|
- $out .= '<option value="' . $arraytypes['code'] . '"'; |
|
4643
|
+ $out .= '<option value="'.$arraytypes['code'].'"'; |
4644
|
4644
|
} elseif ($format == 3) { |
4645
|
|
- $out .= '<option value="' . $id . '"'; |
|
4645
|
+ $out .= '<option value="'.$id.'"'; |
4646
|
4646
|
} |
4647
|
4647
|
// Print attribute selected or not |
4648
|
4648
|
if ($format == 1 || $format == 2) { |
|
@@ -4672,7 +4672,7 @@ discard block |
|
|
block discarded – undo |
4672
|
4672
|
if ($user->admin && !$noadmininfo) { |
4673
|
4673
|
$out .= info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); |
4674
|
4674
|
} |
4675
|
|
- $out .= ajax_combobox('select' . $htmlname); |
|
4675
|
+ $out .= ajax_combobox('select'.$htmlname); |
4676
|
4676
|
|
4677
|
4677
|
if (empty($nooutput)) { |
4678
|
4678
|
print $out; |
|
@@ -4694,22 +4694,22 @@ discard block |
|
|
block discarded – undo |
4694
|
4694
|
{ |
4695
|
4695
|
global $langs; |
4696
|
4696
|
|
4697
|
|
- $return = '<select class="flat maxwidth100" id="select_' . $htmlname . '" name="' . $htmlname . '">'; |
|
4697
|
+ $return = '<select class="flat maxwidth100" id="select_'.$htmlname.'" name="'.$htmlname.'">'; |
4698
|
4698
|
$options = array( |
4699
|
4699
|
'HT' => $langs->trans("HT"), |
4700
|
4700
|
'TTC' => $langs->trans("TTC") |
4701
|
4701
|
); |
4702
|
4702
|
foreach ($options as $id => $value) { |
4703
|
4703
|
if ($selected == $id) { |
4704
|
|
- $return .= '<option value="' . $id . '" selected>' . $value; |
|
4704
|
+ $return .= '<option value="'.$id.'" selected>'.$value; |
4705
|
4705
|
} else { |
4706
|
|
- $return .= '<option value="' . $id . '">' . $value; |
|
4706
|
+ $return .= '<option value="'.$id.'">'.$value; |
4707
|
4707
|
} |
4708
|
4708
|
$return .= '</option>'; |
4709
|
4709
|
} |
4710
|
4710
|
$return .= '</select>'; |
4711
|
4711
|
if ($addjscombo) { |
4712
|
|
- $return .= ajax_combobox('select_' . $htmlname); |
|
4712
|
+ $return .= ajax_combobox('select_'.$htmlname); |
4713
|
4713
|
} |
4714
|
4714
|
|
4715
|
4715
|
return $return; |
|
@@ -4727,7 +4727,7 @@ discard block |
|
|
block discarded – undo |
4727
|
4727
|
// phpcs:enable |
4728
|
4728
|
global $langs; |
4729
|
4729
|
|
4730
|
|
- $num = count($this->cache_transport_mode); // TODO Use $conf->cache['payment_mode'] instead of $this->cache_transport_mode |
|
4730
|
+ $num = count($this->cache_transport_mode); // TODO Use $conf->cache['payment_mode'] instead of $this->cache_transport_mode |
4731
|
4731
|
if ($num > 0) { |
4732
|
4732
|
return $num; // Cache already loaded |
4733
|
4733
|
} |
|
@@ -4737,8 +4737,8 @@ discard block |
|
|
block discarded – undo |
4737
|
4737
|
$this->cache_transport_mode = array(); |
4738
|
4738
|
|
4739
|
4739
|
$sql = "SELECT rowid, code, label, active"; |
4740
|
|
- $sql .= " FROM " . $this->db->prefix() . "c_transport_mode"; |
4741
|
|
- $sql .= " WHERE entity IN (" . getEntity('c_transport_mode') . ")"; |
|
4740
|
+ $sql .= " FROM ".$this->db->prefix()."c_transport_mode"; |
|
4741
|
+ $sql .= " WHERE entity IN (".getEntity('c_transport_mode').")"; |
4742
|
4742
|
|
4743
|
4743
|
$resql = $this->db->query($sql); |
4744
|
4744
|
if ($resql) { |
|
@@ -4748,7 +4748,7 @@ discard block |
|
|
block discarded – undo |
4748
|
4748
|
$obj = $this->db->fetch_object($resql); |
4749
|
4749
|
|
4750
|
4750
|
// If traduction exist, we use it else we take the default label |
4751
|
|
- $label = ($langs->transnoentitiesnoconv("PaymentTypeShort" . $obj->code) != "PaymentTypeShort" . $obj->code ? $langs->transnoentitiesnoconv("PaymentTypeShort" . $obj->code) : ($obj->label != '-' ? $obj->label : '')); |
|
4751
|
+ $label = ($langs->transnoentitiesnoconv("PaymentTypeShort".$obj->code) != "PaymentTypeShort".$obj->code ? $langs->transnoentitiesnoconv("PaymentTypeShort".$obj->code) : ($obj->label != '-' ? $obj->label : '')); |
4752
|
4752
|
$this->cache_transport_mode[$obj->rowid]['rowid'] = $obj->rowid; |
4753
|
4753
|
$this->cache_transport_mode[$obj->rowid]['code'] = $obj->code; |
4754
|
4754
|
$this->cache_transport_mode[$obj->rowid]['label'] = $label; |
|
@@ -4782,11 +4782,11 @@ discard block |
|
|
block discarded – undo |
4782
|
4782
|
{ |
4783
|
4783
|
global $langs, $user; |
4784
|
4784
|
|
4785
|
|
- dol_syslog(__METHOD__ . " " . $selected . ", " . $htmlname . ", " . $format, LOG_DEBUG); |
|
4785
|
+ dol_syslog(__METHOD__." ".$selected.", ".$htmlname.", ".$format, LOG_DEBUG); |
4786
|
4786
|
|
4787
|
4787
|
$this->load_cache_transport_mode(); |
4788
|
4788
|
|
4789
|
|
- print '<select id="select' . $htmlname . '" class="flat selectmodetransport' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">'; |
|
4789
|
+ print '<select id="select'.$htmlname.'" class="flat selectmodetransport'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">'; |
4790
|
4790
|
if ($empty) { |
4791
|
4791
|
print '<option value=""> </option>'; |
4792
|
4792
|
} |
|
@@ -4802,13 +4802,13 @@ discard block |
|
|
block discarded – undo |
4802
|
4802
|
} |
4803
|
4803
|
|
4804
|
4804
|
if ($format == 0) { |
4805
|
|
- print '<option value="' . $id . '"'; |
|
4805
|
+ print '<option value="'.$id.'"'; |
4806
|
4806
|
} elseif ($format == 1) { |
4807
|
|
- print '<option value="' . $arraytypes['code'] . '"'; |
|
4807
|
+ print '<option value="'.$arraytypes['code'].'"'; |
4808
|
4808
|
} elseif ($format == 2) { |
4809
|
|
- print '<option value="' . $arraytypes['code'] . '"'; |
|
4809
|
+ print '<option value="'.$arraytypes['code'].'"'; |
4810
|
4810
|
} elseif ($format == 3) { |
4811
|
|
- print '<option value="' . $id . '"'; |
|
4811
|
+ print '<option value="'.$id.'"'; |
4812
|
4812
|
} |
4813
|
4813
|
// If text is selected, we compare with code, else with id |
4814
|
4814
|
if (preg_match('/[a-z]/i', $selected) && $selected == $arraytypes['code']) { |
|
@@ -4856,31 +4856,31 @@ discard block |
|
|
block discarded – undo |
4856
|
4856
|
$langs->load("deliveries"); |
4857
|
4857
|
|
4858
|
4858
|
$sql = "SELECT rowid, code, libelle as label"; |
4859
|
|
- $sql .= " FROM " . $this->db->prefix() . "c_shipment_mode"; |
|
4859
|
+ $sql .= " FROM ".$this->db->prefix()."c_shipment_mode"; |
4860
|
4860
|
$sql .= " WHERE active > 0"; |
4861
|
4861
|
if ($filtre) { |
4862
|
|
- $sql .= " AND " . $filtre; |
|
4862
|
+ $sql .= " AND ".$filtre; |
4863
|
4863
|
} |
4864
|
4864
|
$sql .= " ORDER BY libelle ASC"; |
4865
|
4865
|
|
4866
|
|
- dol_syslog(get_class($this) . "::selectShippingMode", LOG_DEBUG); |
|
4866
|
+ dol_syslog(get_class($this)."::selectShippingMode", LOG_DEBUG); |
4867
|
4867
|
$result = $this->db->query($sql); |
4868
|
4868
|
if ($result) { |
4869
|
4869
|
$num = $this->db->num_rows($result); |
4870
|
4870
|
$i = 0; |
4871
|
4871
|
if ($num) { |
4872
|
|
- print '<select id="select' . $htmlname . '" class="flat selectshippingmethod' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '"' . ($moreattrib ? ' ' . $moreattrib : '') . '>'; |
|
4872
|
+ print '<select id="select'.$htmlname.'" class="flat selectshippingmethod'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'"'.($moreattrib ? ' '.$moreattrib : '').'>'; |
4873
|
4873
|
if ($useempty == 1 || ($useempty == 2 && $num > 1)) { |
4874
|
4874
|
print '<option value="-1"> </option>'; |
4875
|
4875
|
} |
4876
|
4876
|
while ($i < $num) { |
4877
|
4877
|
$obj = $this->db->fetch_object($result); |
4878
|
4878
|
if ($selected == $obj->rowid) { |
4879
|
|
- print '<option value="' . $obj->rowid . '" selected>'; |
|
4879
|
+ print '<option value="'.$obj->rowid.'" selected>'; |
4880
|
4880
|
} else { |
4881
|
|
- print '<option value="' . $obj->rowid . '">'; |
|
4881
|
+ print '<option value="'.$obj->rowid.'">'; |
4882
|
4882
|
} |
4883
|
|
- print ($langs->trans("SendingMethod" . strtoupper($obj->code)) != "SendingMethod" . strtoupper($obj->code)) ? $langs->trans("SendingMethod" . strtoupper($obj->code)) : $obj->label; |
|
4883
|
+ print ($langs->trans("SendingMethod".strtoupper($obj->code)) != "SendingMethod".strtoupper($obj->code)) ? $langs->trans("SendingMethod".strtoupper($obj->code)) : $obj->label; |
4884
|
4884
|
print '</option>'; |
4885
|
4885
|
$i++; |
4886
|
4886
|
} |
|
@@ -4889,7 +4889,7 @@ discard block |
|
|
block discarded – undo |
4889
|
4889
|
print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); |
4890
|
4890
|
} |
4891
|
4891
|
|
4892
|
|
- print ajax_combobox('select' . $htmlname); |
|
4892
|
+ print ajax_combobox('select'.$htmlname); |
4893
|
4893
|
} else { |
4894
|
4894
|
print $langs->trans("NoShippingMethodDefined"); |
4895
|
4895
|
} |
|
@@ -4914,16 +4914,16 @@ discard block |
|
|
block discarded – undo |
4914
|
4914
|
$langs->load("deliveries"); |
4915
|
4915
|
|
4916
|
4916
|
if ($htmlname != "none") { |
4917
|
|
- print '<form method="POST" action="' . $page . '">'; |
|
4917
|
+ print '<form method="POST" action="'.$page.'">'; |
4918
|
4918
|
print '<input type="hidden" name="action" value="setshippingmethod">'; |
4919
|
|
- print '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
4919
|
+ print '<input type="hidden" name="token" value="'.newToken().'">'; |
4920
|
4920
|
$this->selectShippingMethod($selected, $htmlname, '', $addempty); |
4921
|
|
- print '<input type="submit" class="button valignmiddle" value="' . $langs->trans("Modify") . '">'; |
|
4921
|
+ print '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">'; |
4922
|
4922
|
print '</form>'; |
4923
|
4923
|
} else { |
4924
|
4924
|
if ($selected) { |
4925
|
4925
|
$code = $langs->getLabelFromKey($this->db, $selected, 'c_shipment_mode', 'rowid', 'code'); |
4926
|
|
- print $langs->trans("SendingMethod" . strtoupper($code)); |
|
4926
|
+ print $langs->trans("SendingMethod".strtoupper($code)); |
4927
|
4927
|
} else { |
4928
|
4928
|
print " "; |
4929
|
4929
|
} |
|
@@ -4946,10 +4946,10 @@ discard block |
|
|
block discarded – undo |
4946
|
4946
|
|
4947
|
4947
|
$opt = '<option value="" selected></option>'; |
4948
|
4948
|
$sql = "SELECT rowid, ref, situation_cycle_ref, situation_counter, situation_final, fk_soc"; |
4949
|
|
- $sql .= ' FROM ' . $this->db->prefix() . 'facture'; |
4950
|
|
- $sql .= ' WHERE entity IN (' . getEntity('invoice') . ')'; |
|
4949
|
+ $sql .= ' FROM '.$this->db->prefix().'facture'; |
|
4950
|
+ $sql .= ' WHERE entity IN ('.getEntity('invoice').')'; |
4951
|
4951
|
$sql .= ' AND situation_counter >= 1'; |
4952
|
|
- $sql .= ' AND fk_soc = ' . (int) $socid; |
|
4952
|
+ $sql .= ' AND fk_soc = '.(int) $socid; |
4953
|
4953
|
$sql .= ' AND type <> 2'; |
4954
|
4954
|
$sql .= ' ORDER by situation_cycle_ref, situation_counter desc'; |
4955
|
4955
|
$resql = $this->db->query($sql); |
|
@@ -4967,19 +4967,19 @@ discard block |
|
|
block discarded – undo |
4967
|
4967
|
//Not prov? |
4968
|
4968
|
if (substr($obj->ref, 1, 4) != 'PROV') { |
4969
|
4969
|
if ($selected == $obj->rowid) { |
4970
|
|
- $opt .= '<option value="' . $obj->rowid . '" selected>' . $obj->ref . '</option>'; |
|
4970
|
+ $opt .= '<option value="'.$obj->rowid.'" selected>'.$obj->ref.'</option>'; |
4971
|
4971
|
} else { |
4972
|
|
- $opt .= '<option value="' . $obj->rowid . '">' . $obj->ref . '</option>'; |
|
4972
|
+ $opt .= '<option value="'.$obj->rowid.'">'.$obj->ref.'</option>'; |
4973
|
4973
|
} |
4974
|
4974
|
} |
4975
|
4975
|
} |
4976
|
4976
|
} |
4977
|
4977
|
} |
4978
|
4978
|
} else { |
4979
|
|
- dol_syslog("Error sql=" . $sql . ", error=" . $this->error, LOG_ERR); |
|
4979
|
+ dol_syslog("Error sql=".$sql.", error=".$this->error, LOG_ERR); |
4980
|
4980
|
} |
4981
|
4981
|
if ($opt == '<option value ="" selected></option>') { |
4982
|
|
- $opt = '<option value ="0" selected>' . $langs->trans('NoSituations') . '</option>'; |
|
4982
|
+ $opt = '<option value ="0" selected>'.$langs->trans('NoSituations').'</option>'; |
4983
|
4983
|
} |
4984
|
4984
|
return $opt; |
4985
|
4985
|
} |
|
@@ -4999,12 +4999,12 @@ discard block |
|
|
block discarded – undo |
4999
|
4999
|
|
5000
|
5000
|
$langs->load('products'); |
5001
|
5001
|
|
5002
|
|
- $return = '<select class="flat" id="' . $htmlname . '" name="' . $htmlname . '">'; |
|
5002
|
+ $return = '<select class="flat" id="'.$htmlname.'" name="'.$htmlname.'">'; |
5003
|
5003
|
|
5004
|
|
- $sql = "SELECT rowid, label, code FROM " . $this->db->prefix() . "c_units"; |
|
5004
|
+ $sql = "SELECT rowid, label, code FROM ".$this->db->prefix()."c_units"; |
5005
|
5005
|
$sql .= ' WHERE active > 0'; |
5006
|
5006
|
if (!empty($unit_type)) { |
5007
|
|
- $sql .= " AND unit_type = '" . $this->db->escape($unit_type) . "'"; |
|
5007
|
+ $sql .= " AND unit_type = '".$this->db->escape($unit_type)."'"; |
5008
|
5008
|
} |
5009
|
5009
|
$sql .= " ORDER BY sortorder"; |
5010
|
5010
|
|
|
@@ -5016,14 +5016,14 @@ discard block |
|
|
block discarded – undo |
5016
|
5016
|
|
5017
|
5017
|
while ($res = $this->db->fetch_object($resql)) { |
5018
|
5018
|
$unitLabel = $res->label; |
5019
|
|
- if (!empty($langs->tab_translate['unit' . $res->code])) { // check if Translation is available before |
5020
|
|
- $unitLabel = $langs->trans('unit' . $res->code) != $res->label ? $langs->trans('unit' . $res->code) : $res->label; |
|
5019
|
+ if (!empty($langs->tab_translate['unit'.$res->code])) { // check if Translation is available before |
|
5020
|
+ $unitLabel = $langs->trans('unit'.$res->code) != $res->label ? $langs->trans('unit'.$res->code) : $res->label; |
5021
|
5021
|
} |
5022
|
5022
|
|
5023
|
5023
|
if ($selected == $res->rowid) { |
5024
|
|
- $return .= '<option value="' . $res->rowid . '" selected>' . $unitLabel . '</option>'; |
|
5024
|
+ $return .= '<option value="'.$res->rowid.'" selected>'.$unitLabel.'</option>'; |
5025
|
5025
|
} else { |
5026
|
|
- $return .= '<option value="' . $res->rowid . '">' . $unitLabel . '</option>'; |
|
5026
|
+ $return .= '<option value="'.$res->rowid.'">'.$unitLabel.'</option>'; |
5027
|
5027
|
} |
5028
|
5028
|
} |
5029
|
5029
|
$return .= '</select>'; |
|
@@ -5058,23 +5058,23 @@ discard block |
|
|
block discarded – undo |
5058
|
5058
|
$num = 0; |
5059
|
5059
|
|
5060
|
5060
|
$sql = "SELECT rowid, label, bank, clos as status, currency_code"; |
5061
|
|
- $sql .= " FROM " . $this->db->prefix() . "bank_account"; |
5062
|
|
- $sql .= " WHERE entity IN (" . getEntity('bank_account') . ")"; |
|
5061
|
+ $sql .= " FROM ".$this->db->prefix()."bank_account"; |
|
5062
|
+ $sql .= " WHERE entity IN (".getEntity('bank_account').")"; |
5063
|
5063
|
if ($status != 2) { |
5064
|
|
- $sql .= " AND clos = " . (int) $status; |
|
5064
|
+ $sql .= " AND clos = ".(int) $status; |
5065
|
5065
|
} |
5066
|
5066
|
if ($filtre) { // TODO Support USF |
5067
|
|
- $sql .= " AND " . $filtre; |
|
5067
|
+ $sql .= " AND ".$filtre; |
5068
|
5068
|
} |
5069
|
5069
|
$sql .= " ORDER BY label"; |
5070
|
5070
|
|
5071
|
|
- dol_syslog(get_class($this) . "::select_comptes", LOG_DEBUG); |
|
5071
|
+ dol_syslog(get_class($this)."::select_comptes", LOG_DEBUG); |
5072
|
5072
|
$result = $this->db->query($sql); |
5073
|
5073
|
if ($result) { |
5074
|
5074
|
$num = $this->db->num_rows($result); |
5075
|
5075
|
$i = 0; |
5076
|
5076
|
if ($num) { |
5077
|
|
- $out .= '<select id="select' . $htmlname . '" class="flat selectbankaccount' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '"' . ($moreattrib ? ' ' . $moreattrib : '') . '>'; |
|
5077
|
+ $out .= '<select id="select'.$htmlname.'" class="flat selectbankaccount'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'"'.($moreattrib ? ' '.$moreattrib : '').'>'; |
5078
|
5078
|
if ($useempty == 1 || ($useempty == 2 && $num > 1)) { |
5079
|
5079
|
$out .= '<option value="-1"> </option>'; |
5080
|
5080
|
} |
|
@@ -5082,27 +5082,27 @@ discard block |
|
|
block discarded – undo |
5082
|
5082
|
while ($i < $num) { |
5083
|
5083
|
$obj = $this->db->fetch_object($result); |
5084
|
5084
|
if ($selected == $obj->rowid || ($useempty == 2 && $num == 1 && empty($selected))) { |
5085
|
|
- $out .= '<option value="' . $obj->rowid . '" data-currency-code="' . $obj->currency_code . '" selected>'; |
|
5085
|
+ $out .= '<option value="'.$obj->rowid.'" data-currency-code="'.$obj->currency_code.'" selected>'; |
5086
|
5086
|
} else { |
5087
|
|
- $out .= '<option value="' . $obj->rowid . '" data-currency-code="' . $obj->currency_code . '">'; |
|
5087
|
+ $out .= '<option value="'.$obj->rowid.'" data-currency-code="'.$obj->currency_code.'">'; |
5088
|
5088
|
} |
5089
|
5089
|
$out .= trim($obj->label); |
5090
|
5090
|
if ($showcurrency) { |
5091
|
|
- $out .= ' (' . $obj->currency_code . ')'; |
|
5091
|
+ $out .= ' ('.$obj->currency_code.')'; |
5092
|
5092
|
} |
5093
|
5093
|
if ($status == 2 && $obj->status == 1) { |
5094
|
|
- $out .= ' (' . $langs->trans("Closed") . ')'; |
|
5094
|
+ $out .= ' ('.$langs->trans("Closed").')'; |
5095
|
5095
|
} |
5096
|
5096
|
$out .= '</option>'; |
5097
|
5097
|
$i++; |
5098
|
5098
|
} |
5099
|
5099
|
$out .= "</select>"; |
5100
|
|
- $out .= ajax_combobox('select' . $htmlname); |
|
5100
|
+ $out .= ajax_combobox('select'.$htmlname); |
5101
|
5101
|
} else { |
5102
|
5102
|
if ($status == 0) { |
5103
|
|
- $out .= '<span class="opacitymedium">' . $langs->trans("NoActiveBankAccountDefined") . '</span>'; |
|
5103
|
+ $out .= '<span class="opacitymedium">'.$langs->trans("NoActiveBankAccountDefined").'</span>'; |
5104
|
5104
|
} else { |
5105
|
|
- $out .= '<span class="opacitymedium">' . $langs->trans("NoBankAccountFound") . '</span>'; |
|
5105
|
+ $out .= '<span class="opacitymedium">'.$langs->trans("NoBankAccountFound").'</span>'; |
5106
|
5106
|
} |
5107
|
5107
|
} |
5108
|
5108
|
} else { |
|
@@ -5138,23 +5138,23 @@ discard block |
|
|
block discarded – undo |
5138
|
5138
|
$num = 0; |
5139
|
5139
|
|
5140
|
5140
|
$sql = "SELECT rowid, name, fk_country, status, entity"; |
5141
|
|
- $sql .= " FROM " . $this->db->prefix() . "establishment"; |
|
5141
|
+ $sql .= " FROM ".$this->db->prefix()."establishment"; |
5142
|
5142
|
$sql .= " WHERE 1=1"; |
5143
|
5143
|
if ($status != 2) { |
5144
|
|
- $sql .= " AND status = " . (int) $status; |
|
5144
|
+ $sql .= " AND status = ".(int) $status; |
5145
|
5145
|
} |
5146
|
5146
|
if ($filtre) { // TODO Support USF |
5147
|
|
- $sql .= " AND " . $filtre; |
|
5147
|
+ $sql .= " AND ".$filtre; |
5148
|
5148
|
} |
5149
|
5149
|
$sql .= " ORDER BY name"; |
5150
|
5150
|
|
5151
|
|
- dol_syslog(get_class($this) . "::select_establishment", LOG_DEBUG); |
|
5151
|
+ dol_syslog(get_class($this)."::select_establishment", LOG_DEBUG); |
5152
|
5152
|
$result = $this->db->query($sql); |
5153
|
5153
|
if ($result) { |
5154
|
5154
|
$num = $this->db->num_rows($result); |
5155
|
5155
|
$i = 0; |
5156
|
5156
|
if ($num) { |
5157
|
|
- print '<select id="select' . $htmlname . '" class="flat selectestablishment" name="' . $htmlname . '"' . ($moreattrib ? ' ' . $moreattrib : '') . '>'; |
|
5157
|
+ print '<select id="select'.$htmlname.'" class="flat selectestablishment" name="'.$htmlname.'"'.($moreattrib ? ' '.$moreattrib : '').'>'; |
5158
|
5158
|
if ($useempty == 1 || ($useempty == 2 && $num > 1)) { |
5159
|
5159
|
print '<option value="-1"> </option>'; |
5160
|
5160
|
} |
|
@@ -5162,13 +5162,13 @@ discard block |
|
|
block discarded – undo |
5162
|
5162
|
while ($i < $num) { |
5163
|
5163
|
$obj = $this->db->fetch_object($result); |
5164
|
5164
|
if ($selected == $obj->rowid) { |
5165
|
|
- print '<option value="' . $obj->rowid . '" selected>'; |
|
5165
|
+ print '<option value="'.$obj->rowid.'" selected>'; |
5166
|
5166
|
} else { |
5167
|
|
- print '<option value="' . $obj->rowid . '">'; |
|
5167
|
+ print '<option value="'.$obj->rowid.'">'; |
5168
|
5168
|
} |
5169
|
5169
|
print trim($obj->name); |
5170
|
5170
|
if ($status == 2 && $obj->status == 1) { |
5171
|
|
- print ' (' . $langs->trans("Closed") . ')'; |
|
5171
|
+ print ' ('.$langs->trans("Closed").')'; |
5172
|
5172
|
} |
5173
|
5173
|
print '</option>'; |
5174
|
5174
|
$i++; |
|
@@ -5176,9 +5176,9 @@ discard block |
|
|
block discarded – undo |
5176
|
5176
|
print "</select>"; |
5177
|
5177
|
} else { |
5178
|
5178
|
if ($status == 0) { |
5179
|
|
- print '<span class="opacitymedium">' . $langs->trans("NoActiveEstablishmentDefined") . '</span>'; |
|
5179
|
+ print '<span class="opacitymedium">'.$langs->trans("NoActiveEstablishmentDefined").'</span>'; |
5180
|
5180
|
} else { |
5181
|
|
- print '<span class="opacitymedium">' . $langs->trans("NoEstablishmentFound") . '</span>'; |
|
5181
|
+ print '<span class="opacitymedium">'.$langs->trans("NoEstablishmentFound").'</span>'; |
5182
|
5182
|
} |
5183
|
5183
|
} |
5184
|
5184
|
|
|
@@ -5202,20 +5202,20 @@ discard block |
|
|
block discarded – undo |
5202
|
5202
|
{ |
5203
|
5203
|
global $langs; |
5204
|
5204
|
if ($htmlname != "none") { |
5205
|
|
- print '<form method="POST" action="' . $page . '">'; |
|
5205
|
+ print '<form method="POST" action="'.$page.'">'; |
5206
|
5206
|
print '<input type="hidden" name="action" value="setbankaccount">'; |
5207
|
|
- print '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
5207
|
+ print '<input type="hidden" name="token" value="'.newToken().'">'; |
5208
|
5208
|
print img_picto('', 'bank_account', 'class="pictofixedwidth"'); |
5209
|
5209
|
$nbaccountfound = $this->select_comptes($selected, $htmlname, 0, '', $addempty); |
5210
|
5210
|
if ($nbaccountfound > 0) { |
5211
|
|
- print '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">'; |
|
5211
|
+ print '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">'; |
5212
|
5212
|
} |
5213
|
5213
|
print '</form>'; |
5214
|
5214
|
} else { |
5215
|
5215
|
$langs->load('banks'); |
5216
|
5216
|
|
5217
|
5217
|
if ($selected) { |
5218
|
|
- require_once DOL_DOCUMENT_ROOT . '/compta/bank/class/account.class.php'; |
|
5218
|
+ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; |
5219
|
5219
|
$bankstatic = new Account($this->db); |
5220
|
5220
|
$result = $bankstatic->fetch($selected); |
5221
|
5221
|
if ($result) { |
|
@@ -5254,19 +5254,19 @@ discard block |
|
|
block discarded – undo |
5254
|
5254
|
global $conf, $langs; |
5255
|
5255
|
$langs->load("categories"); |
5256
|
5256
|
|
5257
|
|
- include_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; |
|
5257
|
+ include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; |
5258
|
5258
|
|
5259
|
5259
|
// For backward compatibility |
5260
|
5260
|
if (is_numeric($type)) { |
5261
|
|
- dol_syslog(__METHOD__ . ': using numeric value for parameter type is deprecated. Use string code instead.', LOG_WARNING); |
|
5261
|
+ dol_syslog(__METHOD__.': using numeric value for parameter type is deprecated. Use string code instead.', LOG_WARNING); |
5262
|
5262
|
} |
5263
|
5263
|
|
5264
|
5264
|
if ($type === Categorie::TYPE_BANK_LINE) { |
5265
|
5265
|
// TODO Move this into common category feature |
5266
|
5266
|
$cate_arbo = array(); |
5267
|
5267
|
$sql = "SELECT c.label, c.rowid"; |
5268
|
|
- $sql .= " FROM " . $this->db->prefix() . "bank_categ as c"; |
5269
|
|
- $sql .= " WHERE entity = " . $conf->entity; |
|
5268
|
+ $sql .= " FROM ".$this->db->prefix()."bank_categ as c"; |
|
5269
|
+ $sql .= " WHERE entity = ".$conf->entity; |
5270
|
5270
|
$sql .= " ORDER BY c.label"; |
5271
|
5271
|
$result = $this->db->query($sql); |
5272
|
5272
|
if ($result) { |
|
@@ -5292,12 +5292,12 @@ discard block |
|
|
block discarded – undo |
5292
|
5292
|
$outarrayrichhtml = array(); |
5293
|
5293
|
|
5294
|
5294
|
|
5295
|
|
- $output = '<select class="flat minwidth100' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">'; |
|
5295
|
+ $output = '<select class="flat minwidth100'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">'; |
5296
|
5296
|
if (is_array($cate_arbo)) { |
5297
|
5297
|
$num = count($cate_arbo); |
5298
|
5298
|
|
5299
|
5299
|
if (!$num) { |
5300
|
|
- $output .= '<option value="-1" disabled>' . $langs->trans("NoCategoriesDefined") . '</option>'; |
|
5300
|
+ $output .= '<option value="-1" disabled>'.$langs->trans("NoCategoriesDefined").'</option>'; |
5301
|
5301
|
} else { |
5302
|
5302
|
if ($useempty == 1 || ($useempty == 2 && $num > 1)) { |
5303
|
5303
|
$output .= '<option value="-1"> </option>'; |
|
@@ -5309,15 +5309,15 @@ discard block |
|
|
block discarded – undo |
5309
|
5309
|
$add = ''; |
5310
|
5310
|
} |
5311
|
5311
|
|
5312
|
|
- $labeltoshow = img_picto('', 'category', 'class="pictofixedwidth" style="color: #' . $cate_arbo[$key]['color'] . '"'); |
|
5312
|
+ $labeltoshow = img_picto('', 'category', 'class="pictofixedwidth" style="color: #'.$cate_arbo[$key]['color'].'"'); |
5313
|
5313
|
$labeltoshow .= dol_trunc($cate_arbo[$key]['fulllabel'], $maxlength, 'middle'); |
5314
|
5314
|
|
5315
|
5315
|
$outarray[$cate_arbo[$key]['id']] = $cate_arbo[$key]['fulllabel']; |
5316
|
5316
|
|
5317
|
5317
|
$outarrayrichhtml[$cate_arbo[$key]['id']] = $labeltoshow; |
5318
|
5318
|
|
5319
|
|
- $output .= '<option ' . $add . 'value="' . $cate_arbo[$key]['id'] . '"'; |
5320
|
|
- $output .= ' data-html="' . dol_escape_htmltag($labeltoshow) . '"'; |
|
5319
|
+ $output .= '<option '.$add.'value="'.$cate_arbo[$key]['id'].'"'; |
|
5320
|
+ $output .= ' data-html="'.dol_escape_htmltag($labeltoshow).'"'; |
5321
|
5321
|
$output .= '>'; |
5322
|
5322
|
$output .= dol_trunc($cate_arbo[$key]['fulllabel'], $maxlength, 'middle'); |
5323
|
5323
|
$output .= '</option>'; |
|
@@ -5359,7 +5359,7 @@ discard block |
|
|
block discarded – undo |
5359
|
5359
|
public function form_confirm($page, $title, $question, $action, $formquestion = array(), $selectedchoice = "", $useajax = 0, $height = 170, $width = 500) |
5360
|
5360
|
{ |
5361
|
5361
|
// phpcs:enable |
5362
|
|
- dol_syslog(__METHOD__ . ': using form_confirm is deprecated. Use formconfim instead.', LOG_WARNING); |
|
5362
|
+ dol_syslog(__METHOD__.': using form_confirm is deprecated. Use formconfim instead.', LOG_WARNING); |
5363
|
5363
|
print $this->formconfirm($page, $title, $question, $action, $formquestion, $selectedchoice, $useajax, $height, $width); |
5364
|
5364
|
} |
5365
|
5365
|
|
|
@@ -5394,7 +5394,7 @@ discard block |
|
|
block discarded – undo |
5394
|
5394
|
{ |
5395
|
5395
|
global $langs, $conf; |
5396
|
5396
|
|
5397
|
|
- $more = '<!-- formconfirm - before call, page=' . dol_escape_htmltag($page) . ' -->'; |
|
5397
|
+ $more = '<!-- formconfirm - before call, page='.dol_escape_htmltag($page).' -->'; |
5398
|
5398
|
$formconfirm = ''; |
5399
|
5399
|
$inputok = array(); |
5400
|
5400
|
$inputko = array(); |
|
@@ -5418,27 +5418,27 @@ discard block |
|
|
block discarded – undo |
5418
|
5418
|
foreach ($formquestion as $key => $input) { |
5419
|
5419
|
if (is_array($input) && !empty($input)) { |
5420
|
5420
|
if ($input['type'] == 'hidden') { |
5421
|
|
- $moreattr = (!empty($input['moreattr']) ? ' ' . $input['moreattr'] : ''); |
5422
|
|
- $morecss = (!empty($input['morecss']) ? ' ' . $input['morecss'] : ''); |
|
5421
|
+ $moreattr = (!empty($input['moreattr']) ? ' '.$input['moreattr'] : ''); |
|
5422
|
+ $morecss = (!empty($input['morecss']) ? ' '.$input['morecss'] : ''); |
5423
|
5423
|
|
5424
|
|
- $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"; |
|
5424
|
+ $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"; |
5425
|
5425
|
} |
5426
|
5426
|
} |
5427
|
5427
|
} |
5428
|
5428
|
|
5429
|
5429
|
// Now add questions |
5430
|
5430
|
$moreonecolumn = ''; |
5431
|
|
- $more .= '<div class="tagtable paddingtopbottomonly centpercent noborderspacing">' . "\n"; |
|
5431
|
+ $more .= '<div class="tagtable paddingtopbottomonly centpercent noborderspacing">'."\n"; |
5432
|
5432
|
foreach ($formquestion as $key => $input) { |
5433
|
5433
|
if (is_array($input) && !empty($input)) { |
5434
|
|
- $size = (!empty($input['size']) ? ' size="' . $input['size'] . '"' : ''); // deprecated. Use morecss instead. |
5435
|
|
- $moreattr = (!empty($input['moreattr']) ? ' ' . $input['moreattr'] : ''); |
5436
|
|
- $morecss = (!empty($input['morecss']) ? ' ' . $input['morecss'] : ''); |
|
5434
|
+ $size = (!empty($input['size']) ? ' size="'.$input['size'].'"' : ''); // deprecated. Use morecss instead. |
|
5435
|
+ $moreattr = (!empty($input['moreattr']) ? ' '.$input['moreattr'] : ''); |
|
5436
|
+ $morecss = (!empty($input['morecss']) ? ' '.$input['morecss'] : ''); |
5437
|
5437
|
|
5438
|
5438
|
if ($input['type'] == 'text') { |
5439
|
|
- $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"; |
|
5439
|
+ $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"; |
5440
|
5440
|
} elseif ($input['type'] == 'password') { |
5441
|
|
- $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"; |
|
5441
|
+ $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"; |
5442
|
5442
|
} elseif ($input['type'] == 'textarea') { |
5443
|
5443
|
/*$more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">'.$input['label'].'</div><div class="tagtd">'; |
5444
|
5444
|
$more .= '<textarea name="'.$input['name'].'" class="'.$morecss.'"'.$moreattr.'>'; |
|
@@ -5446,8 +5446,8 @@ discard block |
|
|
block discarded – undo |
5446
|
5446
|
$more .= '</textarea>'; |
5447
|
5447
|
$more .= '</div></div>'."\n";*/ |
5448
|
5448
|
$moreonecolumn .= '<div class="margintoponly">'; |
5449
|
|
- $moreonecolumn .= $input['label'] . '<br>'; |
5450
|
|
- $moreonecolumn .= '<textarea name="' . dol_escape_htmltag($input['name']) . '" id="' . dol_escape_htmltag($input['name']) . '" class="' . $morecss . '"' . $moreattr . '>'; |
|
5449
|
+ $moreonecolumn .= $input['label'].'<br>'; |
|
5450
|
+ $moreonecolumn .= '<textarea name="'.dol_escape_htmltag($input['name']).'" id="'.dol_escape_htmltag($input['name']).'" class="'.$morecss.'"'.$moreattr.'>'; |
5451
|
5451
|
$moreonecolumn .= $input['value']; |
5452
|
5452
|
$moreonecolumn .= '</textarea>'; |
5453
|
5453
|
$moreonecolumn .= '</div>'; |
|
@@ -5464,20 +5464,20 @@ discard block |
|
|
block discarded – undo |
5464
|
5464
|
$disabled = isset($input['select_disabled']) ? $input['select_disabled'] : 0; |
5465
|
5465
|
$sort = isset($input['select_sort']) ? $input['select_sort'] : ''; |
5466
|
5466
|
|
5467
|
|
- $more .= '<div class="tagtr"><div class="tagtd' . (empty($input['tdclass']) ? '' : (' ' . $input['tdclass'])) . '">'; |
|
5467
|
+ $more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">'; |
5468
|
5468
|
if (!empty($input['label'])) { |
5469
|
|
- $more .= $input['label'] . '</div><div class="tagtd left">'; |
|
5469
|
+ $more .= $input['label'].'</div><div class="tagtd left">'; |
5470
|
5470
|
} |
5471
|
5471
|
if ($input['type'] == 'select') { |
5472
|
5472
|
$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); |
5473
|
5473
|
} else { |
5474
|
5474
|
$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); |
5475
|
5475
|
} |
5476
|
|
- $more .= '</div></div>' . "\n"; |
|
5476
|
+ $more .= '</div></div>'."\n"; |
5477
|
5477
|
} elseif ($input['type'] == 'checkbox') { |
5478
|
5478
|
$more .= '<div class="tagtr">'; |
5479
|
|
- $more .= '<div class="tagtd' . (empty($input['tdclass']) ? '' : (' ' . $input['tdclass'])) . '"><label for="' . dol_escape_htmltag($input['name']) . '">' . $input['label'] . '</label></div><div class="tagtd">'; |
5480
|
|
- $more .= '<input type="checkbox" class="flat' . ($morecss ? ' ' . $morecss : '') . '" id="' . dol_escape_htmltag($input['name']) . '" name="' . dol_escape_htmltag($input['name']) . '"' . $moreattr; |
|
5479
|
+ $more .= '<div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'"><label for="'.dol_escape_htmltag($input['name']).'">'.$input['label'].'</label></div><div class="tagtd">'; |
|
5480
|
+ $more .= '<input type="checkbox" class="flat'.($morecss ? ' '.$morecss : '').'" id="'.dol_escape_htmltag($input['name']).'" name="'.dol_escape_htmltag($input['name']).'"'.$moreattr; |
5481
|
5481
|
if (!is_bool($input['value']) && $input['value'] != 'false' && $input['value'] != '0' && $input['value'] != '') { |
5482
|
5482
|
$more .= ' checked'; |
5483
|
5483
|
} |
|
@@ -5488,19 +5488,19 @@ discard block |
|
|
block discarded – undo |
5488
|
5488
|
$more .= ' disabled'; |
5489
|
5489
|
} |
5490
|
5490
|
$more .= ' /></div>'; |
5491
|
|
- $more .= '</div>' . "\n"; |
|
5491
|
+ $more .= '</div>'."\n"; |
5492
|
5492
|
} elseif ($input['type'] == 'radio') { |
5493
|
5493
|
$i = 0; |
5494
|
5494
|
foreach ($input['values'] as $selkey => $selval) { |
5495
|
5495
|
$more .= '<div class="tagtr">'; |
5496
|
5496
|
if (isset($input['label'])) { |
5497
|
5497
|
if ($i == 0) { |
5498
|
|
- $more .= '<div class="tagtd' . (empty($input['tdclass']) ? ' tdtop' : (' tdtop ' . $input['tdclass'])) . '">' . $input['label'] . '</div>'; |
|
5498
|
+ $more .= '<div class="tagtd'.(empty($input['tdclass']) ? ' tdtop' : (' tdtop '.$input['tdclass'])).'">'.$input['label'].'</div>'; |
5499
|
5499
|
} else { |
5500
|
|
- $more .= '<div class="tagtd' . (empty($input['tdclass']) ? '' : (' "' . $input['tdclass'])) . '"> </div>'; |
|
5500
|
+ $more .= '<div class="tagtd'.(empty($input['tdclass']) ? '' : (' "'.$input['tdclass'])).'"> </div>'; |
5501
|
5501
|
} |
5502
|
5502
|
} |
5503
|
|
- $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; |
|
5503
|
+ $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; |
5504
|
5504
|
if (!empty($input['disabled'])) { |
5505
|
5505
|
$more .= ' disabled'; |
5506
|
5506
|
} |
|
@@ -5508,12 +5508,12 @@ discard block |
|
|
block discarded – undo |
5508
|
5508
|
$more .= ' checked="checked"'; |
5509
|
5509
|
} |
5510
|
5510
|
$more .= ' /> '; |
5511
|
|
- $more .= '<label for="' . dol_escape_htmltag($input['name'] . $selkey) . '" class="valignmiddle">' . $selval . '</label>'; |
5512
|
|
- $more .= '</div></div>' . "\n"; |
|
5511
|
+ $more .= '<label for="'.dol_escape_htmltag($input['name'].$selkey).'" class="valignmiddle">'.$selval.'</label>'; |
|
5512
|
+ $more .= '</div></div>'."\n"; |
5513
|
5513
|
$i++; |
5514
|
5514
|
} |
5515
|
5515
|
} elseif ($input['type'] == 'date' || $input['type'] == 'datetime') { |
5516
|
|
- $more .= '<div class="tagtr"><div class="tagtd' . (empty($input['tdclass']) ? '' : (' ' . $input['tdclass'])) . '">' . $input['label'] . '</div>'; |
|
5516
|
+ $more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">'.$input['label'].'</div>'; |
5517
|
5517
|
$more .= '<div class="tagtd">'; |
5518
|
5518
|
$addnowlink = (empty($input['datenow']) ? 0 : 1); |
5519
|
5519
|
$h = $m = 0; |
|
@@ -5531,24 +5531,24 @@ discard block |
|
|
block discarded – undo |
5531
|
5531
|
} elseif ($input['type'] == 'other') { // can be 1 column or 2 depending if label is set or not |
5532
|
5532
|
$more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">'; |
5533
|
5533
|
if (!empty($input['label'])) { |
5534
|
|
- $more .= $input['label'] . '</div><div class="tagtd">'; |
|
5534
|
+ $more .= $input['label'].'</div><div class="tagtd">'; |
5535
|
5535
|
} |
5536
|
5536
|
$more .= $input['value']; |
5537
|
|
- $more .= '</div></div>' . "\n"; |
|
5537
|
+ $more .= '</div></div>'."\n"; |
5538
|
5538
|
} elseif ($input['type'] == 'onecolumn') { |
5539
|
5539
|
$moreonecolumn .= '<div class="margintoponly">'; |
5540
|
5540
|
$moreonecolumn .= $input['value']; |
5541
|
|
- $moreonecolumn .= '</div>' . "\n"; |
|
5541
|
+ $moreonecolumn .= '</div>'."\n"; |
5542
|
5542
|
} elseif ($input['type'] == 'hidden') { |
5543
|
5543
|
// Do nothing more, already added by a previous loop |
5544
|
5544
|
} elseif ($input['type'] == 'separator') { |
5545
|
5545
|
$more .= '<br>'; |
5546
|
5546
|
} else { |
5547
|
|
- $more .= 'Error type ' . $input['type'] . ' for the confirm box is not a supported type'; |
|
5547
|
+ $more .= 'Error type '.$input['type'].' for the confirm box is not a supported type'; |
5548
|
5548
|
} |
5549
|
5549
|
} |
5550
|
5550
|
} |
5551
|
|
- $more .= '</div>' . "\n"; |
|
5551
|
+ $more .= '</div>'."\n"; |
5552
|
5552
|
$more .= $moreonecolumn; |
5553
|
5553
|
} |
5554
|
5554
|
|
|
@@ -5570,10 +5570,10 @@ discard block |
|
|
block discarded – undo |
5570
|
5570
|
$button = $useajax; |
5571
|
5571
|
$useajax = 1; |
5572
|
5572
|
$autoOpen = false; |
5573
|
|
- $dialogconfirm .= '-' . $button; |
|
5573
|
+ $dialogconfirm .= '-'.$button; |
5574
|
5574
|
} |
5575
|
|
- $pageyes = $page . (preg_match('/\?/', $page) ? '&' : '?') . 'action=' . urlencode($action) . '&confirm=yes'; |
5576
|
|
- $pageno = ($useajax == 2 ? $page . (preg_match('/\?/', $page) ? '&' : '?') . 'action=' . urlencode($action) . '&confirm=no' : ''); |
|
5575
|
+ $pageyes = $page.(preg_match('/\?/', $page) ? '&' : '?').'action='.urlencode($action).'&confirm=yes'; |
|
5576
|
+ $pageno = ($useajax == 2 ? $page.(preg_match('/\?/', $page) ? '&' : '?').'action='.urlencode($action).'&confirm=no' : ''); |
5577
|
5577
|
|
5578
|
5578
|
// Add input fields into list of fields to read during submit (inputok and inputko) |
5579
|
5579
|
if (is_array($formquestion)) { |
|
@@ -5596,24 +5596,24 @@ discard block |
|
|
block discarded – undo |
5596
|
5596
|
} |
5597
|
5597
|
|
5598
|
5598
|
// Show JQuery confirm box. |
5599
|
|
- $formconfirm .= '<div id="' . $dialogconfirm . '" title="' . dol_escape_htmltag($title) . '" style="display: none;">'; |
|
5599
|
+ $formconfirm .= '<div id="'.$dialogconfirm.'" title="'.dol_escape_htmltag($title).'" style="display: none;">'; |
5600
|
5600
|
if (is_array($formquestion) && array_key_exists('text', $formquestion) && !empty($formquestion['text'])) { |
5601
|
|
- $formconfirm .= '<div class="confirmtext">' . $formquestion['text'] . '</div>' . "\n"; |
|
5601
|
+ $formconfirm .= '<div class="confirmtext">'.$formquestion['text'].'</div>'."\n"; |
5602
|
5602
|
} |
5603
|
5603
|
if (!empty($more)) { |
5604
|
|
- $formconfirm .= '<div class="confirmquestions">' . $more . '</div>' . "\n"; |
|
5604
|
+ $formconfirm .= '<div class="confirmquestions">'.$more.'</div>'."\n"; |
5605
|
5605
|
} |
5606
|
|
- $formconfirm .= ($question ? '<div class="confirmmessage">' . img_help(0, '') . ' ' . $question . '</div>' : ''); |
5607
|
|
- $formconfirm .= '</div>' . "\n"; |
|
5606
|
+ $formconfirm .= ($question ? '<div class="confirmmessage">'.img_help(0, '').' '.$question.'</div>' : ''); |
|
5607
|
+ $formconfirm .= '</div>'."\n"; |
5608
|
5608
|
|
5609
|
|
- $formconfirm .= "\n<!-- begin code of popup for formconfirm page=" . $page . " -->\n"; |
5610
|
|
- $formconfirm .= '<script nonce="' . getNonce() . '" type="text/javascript">' . "\n"; |
|
5609
|
+ $formconfirm .= "\n<!-- begin code of popup for formconfirm page=".$page." -->\n"; |
|
5610
|
+ $formconfirm .= '<script nonce="'.getNonce().'" type="text/javascript">'."\n"; |
5611
|
5611
|
$formconfirm .= "/* Code for the jQuery('#dialogforpopup').dialog() */\n"; |
5612
|
5612
|
$formconfirm .= 'jQuery(document).ready(function() { |
5613
|
5613
|
$(function() { |
5614
|
|
- $( "#' . $dialogconfirm . '" ).dialog( |
|
5614
|
+ $( "#' . $dialogconfirm.'" ).dialog( |
5615
|
5615
|
{ |
5616
|
|
- autoOpen: ' . ($autoOpen ? "true" : "false") . ','; |
|
5616
|
+ autoOpen: ' . ($autoOpen ? "true" : "false").','; |
5617
|
5617
|
if ($newselectedchoice == 'no') { |
5618
|
5618
|
$formconfirm .= ' |
5619
|
5619
|
open: function() { |
|
@@ -5623,24 +5623,24 @@ discard block |
|
|
block discarded – undo |
5623
|
5623
|
|
5624
|
5624
|
$jsforcursor = ''; |
5625
|
5625
|
if ($useajax == 1) { |
5626
|
|
- $jsforcursor = '// The call to urljump can be slow, so we set the wait cursor' . "\n"; |
5627
|
|
- $jsforcursor .= 'jQuery("html,body,#id-container").addClass("cursorwait");' . "\n"; |
|
5626
|
+ $jsforcursor = '// The call to urljump can be slow, so we set the wait cursor'."\n"; |
|
5627
|
+ $jsforcursor .= 'jQuery("html,body,#id-container").addClass("cursorwait");'."\n"; |
5628
|
5628
|
} |
5629
|
5629
|
|
5630
|
5630
|
$postconfirmas = 'GET'; |
5631
|
5631
|
|
5632
|
5632
|
$formconfirm .= ' |
5633
|
5633
|
resizable: false, |
5634
|
|
- height: "' . $height . '", |
5635
|
|
- width: "' . $width . '", |
|
5634
|
+ height: "' . $height.'", |
|
5635
|
+ width: "' . $width.'", |
5636
|
5636
|
modal: true, |
5637
|
5637
|
closeOnEscape: false, |
5638
|
5638
|
buttons: { |
5639
|
|
- "' . dol_escape_js($langs->transnoentities($labelbuttonyes)) . '": function() { |
5640
|
|
- var options = "token=' . urlencode(newToken()) . '"; |
5641
|
|
- var inputok = ' . json_encode($inputok) . '; /* List of fields into form */ |
5642
|
|
- var page = "' . dol_escape_js(!empty($page) ? $page : '') . '"; |
5643
|
|
- var pageyes = "' . dol_escape_js(!empty($pageyes) ? $pageyes : '') . '"; |
|
5639
|
+ "' . dol_escape_js($langs->transnoentities($labelbuttonyes)).'": function() { |
|
5640
|
+ var options = "token=' . urlencode(newToken()).'"; |
|
5641
|
+ var inputok = ' . json_encode($inputok).'; /* List of fields into form */ |
|
5642
|
+ var page = "' . dol_escape_js(!empty($page) ? $page : '').'"; |
|
5643
|
+ var pageyes = "' . dol_escape_js(!empty($pageyes) ? $pageyes : '').'"; |
5644
|
5644
|
|
5645
|
5645
|
if (inputok.length > 0) { |
5646
|
5646
|
$.each(inputok, function(i, inputname) { |
|
@@ -5674,11 +5674,11 @@ discard block |
|
|
block discarded – undo |
5674
|
5674
|
} |
5675
|
5675
|
$(this).dialog("close"); |
5676
|
5676
|
}, |
5677
|
|
- "' . dol_escape_js($langs->transnoentities($labelbuttonno)) . '": function() { |
5678
|
|
- var options = "token=' . urlencode(newToken()) . '"; |
5679
|
|
- var inputko = ' . json_encode($inputko) . '; /* List of fields into form */ |
5680
|
|
- var page = "' . dol_escape_js(!empty($page) ? $page : '') . '"; |
5681
|
|
- var pageno="' . dol_escape_js(!empty($pageno) ? $pageno : '') . '"; |
|
5677
|
+ "' . dol_escape_js($langs->transnoentities($labelbuttonno)).'": function() { |
|
5678
|
+ var options = "token=' . urlencode(newToken()).'"; |
|
5679
|
+ var inputko = ' . json_encode($inputko).'; /* List of fields into form */ |
|
5680
|
+ var page = "' . dol_escape_js(!empty($page) ? $page : '').'"; |
|
5681
|
+ var pageno="' . dol_escape_js(!empty($pageno) ? $pageno : '').'"; |
5682
|
5682
|
if (inputko.length > 0) { |
5683
|
5683
|
$.each(inputko, function(i, inputname) { |
5684
|
5684
|
var more = ""; |
|
@@ -5710,10 +5710,10 @@ discard block |
|
|
block discarded – undo |
5710
|
5710
|
} |
5711
|
5711
|
); |
5712
|
5712
|
|
5713
|
|
- var button = "' . $button . '"; |
|
5713
|
+ var button = "' . $button.'"; |
5714
|
5714
|
if (button.length > 0) { |
5715
|
5715
|
$( "#" + button ).click(function() { |
5716
|
|
- $("#' . $dialogconfirm . '").dialog("open"); |
|
5716
|
+ $("#' . $dialogconfirm.'").dialog("open"); |
5717
|
5717
|
}); |
5718
|
5718
|
} |
5719
|
5719
|
}); |
|
@@ -5721,44 +5721,44 @@ discard block |
|
|
block discarded – undo |
5721
|
5721
|
</script>'; |
5722
|
5722
|
$formconfirm .= "<!-- end ajax formconfirm -->\n"; |
5723
|
5723
|
} else { |
5724
|
|
- $formconfirm .= "\n<!-- begin formconfirm page=" . dol_escape_htmltag($page) . " -->\n"; |
|
5724
|
+ $formconfirm .= "\n<!-- begin formconfirm page=".dol_escape_htmltag($page)." -->\n"; |
5725
|
5725
|
|
5726
|
5726
|
if (empty($disableformtag)) { |
5727
|
|
- $formconfirm .= '<form method="POST" action="' . $page . '" class="notoptoleftroright">' . "\n"; |
|
5727
|
+ $formconfirm .= '<form method="POST" action="'.$page.'" class="notoptoleftroright">'."\n"; |
5728
|
5728
|
} |
5729
|
5729
|
|
5730
|
|
- $formconfirm .= '<input type="hidden" name="action" value="' . $action . '">' . "\n"; |
5731
|
|
- $formconfirm .= '<input type="hidden" name="token" value="' . newToken() . '">' . "\n"; |
|
5730
|
+ $formconfirm .= '<input type="hidden" name="action" value="'.$action.'">'."\n"; |
|
5731
|
+ $formconfirm .= '<input type="hidden" name="token" value="'.newToken().'">'."\n"; |
5732
|
5732
|
|
5733
|
|
- $formconfirm .= '<table class="valid centpercent">' . "\n"; |
|
5733
|
+ $formconfirm .= '<table class="valid centpercent">'."\n"; |
5734
|
5734
|
|
5735
|
5735
|
// Line title |
5736
|
5736
|
$formconfirm .= '<tr class="validtitre"><td class="validtitre" colspan="2">'; |
5737
|
|
- $formconfirm .= img_picto('', 'pictoconfirm') . ' ' . $title; |
5738
|
|
- $formconfirm .= '</td></tr>' . "\n"; |
|
5737
|
+ $formconfirm .= img_picto('', 'pictoconfirm').' '.$title; |
|
5738
|
+ $formconfirm .= '</td></tr>'."\n"; |
5739
|
5739
|
|
5740
|
5740
|
// Line text |
5741
|
5741
|
if (is_array($formquestion) && array_key_exists('text', $formquestion) && !empty($formquestion['text'])) { |
5742
|
|
- $formconfirm .= '<tr class="valid"><td class="valid" colspan="2">' . $formquestion['text'] . '</td></tr>' . "\n"; |
|
5742
|
+ $formconfirm .= '<tr class="valid"><td class="valid" colspan="2">'.$formquestion['text'].'</td></tr>'."\n"; |
5743
|
5743
|
} |
5744
|
5744
|
|
5745
|
5745
|
// Line form fields |
5746
|
5746
|
if ($more) { |
5747
|
|
- $formconfirm .= '<tr class="valid"><td class="valid" colspan="2">' . "\n"; |
|
5747
|
+ $formconfirm .= '<tr class="valid"><td class="valid" colspan="2">'."\n"; |
5748
|
5748
|
$formconfirm .= $more; |
5749
|
|
- $formconfirm .= '</td></tr>' . "\n"; |
|
5749
|
+ $formconfirm .= '</td></tr>'."\n"; |
5750
|
5750
|
} |
5751
|
5751
|
|
5752
|
5752
|
// Line with question |
5753
|
5753
|
$formconfirm .= '<tr class="valid">'; |
5754
|
|
- $formconfirm .= '<td class="valid">' . $question . '</td>'; |
|
5754
|
+ $formconfirm .= '<td class="valid">'.$question.'</td>'; |
5755
|
5755
|
$formconfirm .= '<td class="valid center">'; |
5756
|
5756
|
$formconfirm .= $this->selectyesno("confirm", $newselectedchoice, 0, false, 0, 0, 'marginleftonly marginrightonly', $labelbuttonyes, $labelbuttonno); |
5757
|
|
- $formconfirm .= '<input class="button valignmiddle confirmvalidatebutton small" type="submit" value="' . $langs->trans("Validate") . '">'; |
|
5757
|
+ $formconfirm .= '<input class="button valignmiddle confirmvalidatebutton small" type="submit" value="'.$langs->trans("Validate").'">'; |
5758
|
5758
|
$formconfirm .= '</td>'; |
5759
|
|
- $formconfirm .= '</tr>' . "\n"; |
|
5759
|
+ $formconfirm .= '</tr>'."\n"; |
5760
|
5760
|
|
5761
|
|
- $formconfirm .= '</table>' . "\n"; |
|
5761
|
+ $formconfirm .= '</table>'."\n"; |
5762
|
5762
|
|
5763
|
5763
|
if (empty($disableformtag)) { |
5764
|
5764
|
$formconfirm .= "</form>\n"; |
|
@@ -5767,7 +5767,7 @@ discard block |
|
|
block discarded – undo |
5767
|
5767
|
|
5768
|
5768
|
if (!empty($conf->use_javascript_ajax)) { |
5769
|
5769
|
$formconfirm .= '<!-- code to disable button to avoid double clic -->'; |
5770
|
|
- $formconfirm .= '<script nonce="' . getNonce() . '" type="text/javascript">' . "\n"; |
|
5770
|
+ $formconfirm .= '<script nonce="'.getNonce().'" type="text/javascript">'."\n"; |
5771
|
5771
|
$formconfirm .= ' |
5772
|
5772
|
$(document).ready(function () { |
5773
|
5773
|
$(".confirmvalidatebutton").on("click", function() { |
|
@@ -5779,7 +5779,7 @@ discard block |
|
|
block discarded – undo |
5779
|
5779
|
}); |
5780
|
5780
|
}); |
5781
|
5781
|
'; |
5782
|
|
- $formconfirm .= '</script>' . "\n"; |
|
5782
|
+ $formconfirm .= '</script>'."\n"; |
5783
|
5783
|
} |
5784
|
5784
|
|
5785
|
5785
|
$formconfirm .= "<!-- end formconfirm -->\n"; |
|
@@ -5811,8 +5811,8 @@ discard block |
|
|
block discarded – undo |
5811
|
5811
|
// phpcs:enable |
5812
|
5812
|
global $langs; |
5813
|
5813
|
|
5814
|
|
- require_once DOL_DOCUMENT_ROOT . '/core/lib/project.lib.php'; |
5815
|
|
- require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php'; |
|
5814
|
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php'; |
|
5815
|
+ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; |
5816
|
5816
|
|
5817
|
5817
|
$out = ''; |
5818
|
5818
|
|
|
@@ -5820,11 +5820,11 @@ discard block |
|
|
block discarded – undo |
5820
|
5820
|
|
5821
|
5821
|
$langs->load("project"); |
5822
|
5822
|
if ($htmlname != "none") { |
5823
|
|
- $out .= '<form method="post" action="' . $page . '">'; |
|
5823
|
+ $out .= '<form method="post" action="'.$page.'">'; |
5824
|
5824
|
$out .= '<input type="hidden" name="action" value="classin">'; |
5825
|
|
- $out .= '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
5825
|
+ $out .= '<input type="hidden" name="token" value="'.newToken().'">'; |
5826
|
5826
|
$out .= $formproject->select_projects($socid, $selected, $htmlname, $maxlength, 0, 1, $discard_closed, $forcefocus, 0, 0, '', 1, 0, $morecss); |
5827
|
|
- $out .= '<input type="submit" class="button smallpaddingimp" value="' . $langs->trans("Modify") . '">'; |
|
5827
|
+ $out .= '<input type="submit" class="button smallpaddingimp" value="'.$langs->trans("Modify").'">'; |
5828
|
5828
|
$out .= '</form>'; |
5829
|
5829
|
} else { |
5830
|
5830
|
$out .= '<span class="project_head_block">'; |
|
@@ -5833,7 +5833,7 @@ discard block |
|
|
block discarded – undo |
5833
|
5833
|
$projet->fetch($selected); |
5834
|
5834
|
$out .= $projet->getNomUrl(0, '', 1); |
5835
|
5835
|
} else { |
5836
|
|
- $out .= '<span class="opacitymedium">' . $textifnoproject . '</span>'; |
|
5836
|
+ $out .= '<span class="opacitymedium">'.$textifnoproject.'</span>'; |
5837
|
5837
|
} |
5838
|
5838
|
$out .= '</span>'; |
5839
|
5839
|
} |
|
@@ -5870,14 +5870,14 @@ discard block |
|
|
block discarded – undo |
5870
|
5870
|
$out = ''; |
5871
|
5871
|
|
5872
|
5872
|
if ($htmlname != "none") { |
5873
|
|
- $out .= '<form method="POST" action="' . $page . '">'; |
|
5873
|
+ $out .= '<form method="POST" action="'.$page.'">'; |
5874
|
5874
|
$out .= '<input type="hidden" name="action" value="setconditions">'; |
5875
|
|
- $out .= '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
5875
|
+ $out .= '<input type="hidden" name="token" value="'.newToken().'">'; |
5876
|
5876
|
if ($type) { |
5877
|
|
- $out .= '<input type="hidden" name="type" value="' . dol_escape_htmltag($type) . '">'; |
|
5877
|
+ $out .= '<input type="hidden" name="type" value="'.dol_escape_htmltag($type).'">'; |
5878
|
5878
|
} |
5879
|
5879
|
$out .= $this->getSelectConditionsPaiements($selected, $htmlname, $filtertype, $addempty, 0, '', $deposit_percent); |
5880
|
|
- $out .= '<input type="submit" class="button valignmiddle smallpaddingimp" value="' . $langs->trans("Modify") . '">'; |
|
5880
|
+ $out .= '<input type="submit" class="button valignmiddle smallpaddingimp" value="'.$langs->trans("Modify").'">'; |
5881
|
5881
|
$out .= '</form>'; |
5882
|
5882
|
} else { |
5883
|
5883
|
if ($selected) { |
|
@@ -5922,12 +5922,12 @@ discard block |
|
|
block discarded – undo |
5922
|
5922
|
// phpcs:enable |
5923
|
5923
|
global $langs; |
5924
|
5924
|
if ($htmlname != "none") { |
5925
|
|
- print '<form method="post" action="' . $page . '">'; |
|
5925
|
+ print '<form method="post" action="'.$page.'">'; |
5926
|
5926
|
print '<input type="hidden" name="action" value="setavailability">'; |
5927
|
|
- print '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
5927
|
+ print '<input type="hidden" name="token" value="'.newToken().'">'; |
5928
|
5928
|
$this->selectAvailabilityDelay($selected, $htmlname, -1, $addempty); |
5929
|
|
- print '<input type="submit" name="modify" class="button smallpaddingimp" value="' . $langs->trans("Modify") . '">'; |
5930
|
|
- print '<input type="submit" name="cancel" class="button smallpaddingimp" value="' . $langs->trans("Cancel") . '">'; |
|
5929
|
+ print '<input type="submit" name="modify" class="button smallpaddingimp" value="'.$langs->trans("Modify").'">'; |
|
5930
|
+ print '<input type="submit" name="cancel" class="button smallpaddingimp" value="'.$langs->trans("Cancel").'">'; |
5931
|
5931
|
print '</form>'; |
5932
|
5932
|
} else { |
5933
|
5933
|
if ($selected) { |
|
@@ -5953,11 +5953,11 @@ discard block |
|
|
block discarded – undo |
5953
|
5953
|
{ |
5954
|
5954
|
global $langs; |
5955
|
5955
|
if ($htmlname != "none") { |
5956
|
|
- print '<form method="post" action="' . $page . '">'; |
|
5956
|
+ print '<form method="post" action="'.$page.'">'; |
5957
|
5957
|
print '<input type="hidden" name="action" value="setdemandreason">'; |
5958
|
|
- print '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
5958
|
+ print '<input type="hidden" name="token" value="'.newToken().'">'; |
5959
|
5959
|
$this->selectInputReason($selected, $htmlname, -1, $addempty); |
5960
|
|
- print '<input type="submit" class="button smallpaddingimp" value="' . $langs->trans("Modify") . '">'; |
|
5960
|
+ print '<input type="submit" class="button smallpaddingimp" value="'.$langs->trans("Modify").'">'; |
5961
|
5961
|
print '</form>'; |
5962
|
5962
|
} else { |
5963
|
5963
|
if ($selected) { |
|
@@ -5997,17 +5997,17 @@ discard block |
|
|
block discarded – undo |
5997
|
5997
|
$ret = ''; |
5998
|
5998
|
|
5999
|
5999
|
if ($htmlname != "none") { |
6000
|
|
- $ret .= '<form method="POST" action="' . $page . '" name="form' . $htmlname . '">'; |
6001
|
|
- $ret .= '<input type="hidden" name="action" value="set' . $htmlname . '">'; |
6002
|
|
- $ret .= '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
6000
|
+ $ret .= '<form method="POST" action="'.$page.'" name="form'.$htmlname.'">'; |
|
6001
|
+ $ret .= '<input type="hidden" name="action" value="set'.$htmlname.'">'; |
|
6002
|
+ $ret .= '<input type="hidden" name="token" value="'.newToken().'">'; |
6003
|
6003
|
if ($type) { |
6004
|
|
- $ret .= '<input type="hidden" name="type" value="' . dol_escape_htmltag($type) . '">'; |
|
6004
|
+ $ret .= '<input type="hidden" name="type" value="'.dol_escape_htmltag($type).'">'; |
6005
|
6005
|
} |
6006
|
6006
|
$ret .= '<table class="nobordernopadding">'; |
6007
|
6007
|
$ret .= '<tr><td>'; |
6008
|
|
- $ret .= $this->selectDate($selected, $htmlname, $displayhour, $displaymin, 1, 'form' . $htmlname, 1, 0); |
|
6008
|
+ $ret .= $this->selectDate($selected, $htmlname, $displayhour, $displaymin, 1, 'form'.$htmlname, 1, 0); |
6009
|
6009
|
$ret .= '</td>'; |
6010
|
|
- $ret .= '<td class="left"><input type="submit" class="button smallpaddingimp" value="' . $langs->trans("Modify") . '"></td>'; |
|
6010
|
+ $ret .= '<td class="left"><input type="submit" class="button smallpaddingimp" value="'.$langs->trans("Modify").'"></td>'; |
6011
|
6011
|
$ret .= '</tr></table></form>'; |
6012
|
6012
|
} else { |
6013
|
6013
|
if ($displayhour) { |
|
@@ -6042,15 +6042,15 @@ discard block |
|
|
block discarded – undo |
6042
|
6042
|
global $langs; |
6043
|
6043
|
|
6044
|
6044
|
if ($htmlname != "none") { |
6045
|
|
- print '<form method="POST" action="' . $page . '" name="form' . $htmlname . '">'; |
6046
|
|
- print '<input type="hidden" name="action" value="set' . $htmlname . '">'; |
6047
|
|
- print '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
6045
|
+ print '<form method="POST" action="'.$page.'" name="form'.$htmlname.'">'; |
|
6046
|
+ print '<input type="hidden" name="action" value="set'.$htmlname.'">'; |
|
6047
|
+ print '<input type="hidden" name="token" value="'.newToken().'">'; |
6048
|
6048
|
print $this->select_dolusers($selected, $htmlname, 1, $exclude, 0, $include); |
6049
|
|
- print '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">'; |
|
6049
|
+ print '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">'; |
6050
|
6050
|
print '</form>'; |
6051
|
6051
|
} else { |
6052
|
6052
|
if ($selected) { |
6053
|
|
- require_once DOL_DOCUMENT_ROOT . '/user/class/user.class.php'; |
|
6053
|
+ require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; |
6054
|
6054
|
$theuser = new User($this->db); |
6055
|
6055
|
$theuser->fetch($selected); |
6056
|
6056
|
print $theuser->getNomUrl(1); |
|
@@ -6083,14 +6083,14 @@ discard block |
|
|
block discarded – undo |
6083
|
6083
|
|
6084
|
6084
|
$out = ''; |
6085
|
6085
|
if ($htmlname != "none") { |
6086
|
|
- $out .= '<form method="POST" action="' . $page . '">'; |
|
6086
|
+ $out .= '<form method="POST" action="'.$page.'">'; |
6087
|
6087
|
$out .= '<input type="hidden" name="action" value="setmode">'; |
6088
|
|
- $out .= '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
6088
|
+ $out .= '<input type="hidden" name="token" value="'.newToken().'">'; |
6089
|
6089
|
if ($type) { |
6090
|
|
- $out .= '<input type="hidden" name="type" value="' . dol_escape_htmltag($type) . '">'; |
|
6090
|
+ $out .= '<input type="hidden" name="type" value="'.dol_escape_htmltag($type).'">'; |
6091
|
6091
|
} |
6092
|
6092
|
$out .= $this->select_types_paiements($selected, $htmlname, $filtertype, 0, $addempty, 0, 0, $active, '', 1); |
6093
|
|
- $out .= '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">'; |
|
6093
|
+ $out .= '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">'; |
6094
|
6094
|
$out .= '</form>'; |
6095
|
6095
|
} else { |
6096
|
6096
|
if ($selected) { |
|
@@ -6123,11 +6123,11 @@ discard block |
|
|
block discarded – undo |
6123
|
6123
|
{ |
6124
|
6124
|
global $langs; |
6125
|
6125
|
if ($htmlname != "none") { |
6126
|
|
- print '<form method="POST" action="' . $page . '">'; |
|
6126
|
+ print '<form method="POST" action="'.$page.'">'; |
6127
|
6127
|
print '<input type="hidden" name="action" value="settransportmode">'; |
6128
|
|
- print '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
6128
|
+ print '<input type="hidden" name="token" value="'.newToken().'">'; |
6129
|
6129
|
$this->selectTransportMode($selected, $htmlname, 0, $addempty, 0, 0, $active); |
6130
|
|
- print '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">'; |
|
6130
|
+ print '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">'; |
6131
|
6131
|
print '</form>'; |
6132
|
6132
|
} else { |
6133
|
6133
|
if ($selected) { |
|
@@ -6154,14 +6154,14 @@ discard block |
|
|
block discarded – undo |
6154
|
6154
|
// phpcs:enable |
6155
|
6155
|
global $langs; |
6156
|
6156
|
if ($htmlname != "none") { |
6157
|
|
- print '<form method="POST" action="' . $page . '">'; |
|
6157
|
+ print '<form method="POST" action="'.$page.'">'; |
6158
|
6158
|
print '<input type="hidden" name="action" value="setmulticurrencycode">'; |
6159
|
|
- print '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
6159
|
+ print '<input type="hidden" name="token" value="'.newToken().'">'; |
6160
|
6160
|
print $this->selectMultiCurrency($selected, $htmlname, 0); |
6161
|
|
- print '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">'; |
|
6161
|
+ print '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">'; |
6162
|
6162
|
print '</form>'; |
6163
|
6163
|
} else { |
6164
|
|
- require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php'; |
|
6164
|
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; |
6165
|
6165
|
print !empty($selected) ? currency_name($selected, 1) : ' '; |
6166
|
6166
|
} |
6167
|
6167
|
} |
|
@@ -6183,21 +6183,21 @@ discard block |
|
|
block discarded – undo |
6183
|
6183
|
global $langs, $mysoc, $conf; |
6184
|
6184
|
|
6185
|
6185
|
if ($htmlname != "none") { |
6186
|
|
- print '<form method="POST" action="' . $page . '">'; |
|
6186
|
+ print '<form method="POST" action="'.$page.'">'; |
6187
|
6187
|
print '<input type="hidden" name="action" value="setmulticurrencyrate">'; |
6188
|
|
- print '<input type="hidden" name="token" value="' . newToken() . '">'; |
6189
|
|
- print '<input type="text" class="maxwidth100" name="' . $htmlname . '" value="' . (!empty($rate) ? price(price2num($rate, 'CU')) : 1) . '" /> '; |
|
6188
|
+ print '<input type="hidden" name="token" value="'.newToken().'">'; |
|
6189
|
+ print '<input type="text" class="maxwidth100" name="'.$htmlname.'" value="'.(!empty($rate) ? price(price2num($rate, 'CU')) : 1).'" /> '; |
6190
|
6190
|
print '<select name="calculation_mode">'; |
6191
|
|
- print '<option value="1">Change ' . $langs->trans("PriceUHT") . ' of lines</option>'; |
6192
|
|
- print '<option value="2">Change ' . $langs->trans("PriceUHTCurrency") . ' of lines</option>'; |
|
6191
|
+ print '<option value="1">Change '.$langs->trans("PriceUHT").' of lines</option>'; |
|
6192
|
+ print '<option value="2">Change '.$langs->trans("PriceUHTCurrency").' of lines</option>'; |
6193
|
6193
|
print '</select> '; |
6194
|
|
- print '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">'; |
|
6194
|
+ print '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">'; |
6195
|
6195
|
print '</form>'; |
6196
|
6196
|
} else { |
6197
|
6197
|
if (!empty($rate)) { |
6198
|
6198
|
print price($rate, 1, $langs, 0, 0); |
6199
|
6199
|
if ($currency && $rate != 1) { |
6200
|
|
- print ' (' . price($rate, 1, $langs, 0, 0) . ' ' . $currency . ' = 1 ' . $conf->currency . ')'; |
|
6200
|
+ print ' ('.price($rate, 1, $langs, 0, 0).' '.$currency.' = 1 '.$conf->currency.')'; |
6201
|
6201
|
} |
6202
|
6202
|
} else { |
6203
|
6203
|
print 1; |
|
@@ -6228,9 +6228,9 @@ discard block |
|
|
block discarded – undo |
6228
|
6228
|
// phpcs:enable |
6229
|
6229
|
global $conf, $langs; |
6230
|
6230
|
if ($htmlname != "none") { |
6231
|
|
- print '<form method="post" action="' . $page . '">'; |
|
6231
|
+ print '<form method="post" action="'.$page.'">'; |
6232
|
6232
|
print '<input type="hidden" name="action" value="setabsolutediscount">'; |
6233
|
|
- print '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
6233
|
+ print '<input type="hidden" name="token" value="'.newToken().'">'; |
6234
|
6234
|
print '<div class="inline-block">'; |
6235
|
6235
|
if (!empty($discount_type)) { |
6236
|
6236
|
if (getDolGlobalString('FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS')) { |
|
@@ -6268,24 +6268,24 @@ discard block |
|
|
block discarded – undo |
6268
|
6268
|
print '</div>'; |
6269
|
6269
|
if (empty($hidelist)) { |
6270
|
6270
|
print '<div class="inline-block" style="padding-right: 10px">'; |
6271
|
|
- $newfilter = 'discount_type=' . intval($discount_type); |
|
6271
|
+ $newfilter = 'discount_type='.intval($discount_type); |
6272
|
6272
|
if (!empty($discount_type)) { |
6273
|
6273
|
$newfilter .= ' AND fk_invoice_supplier IS NULL AND fk_invoice_supplier_line IS NULL'; // Supplier discounts available |
6274
|
6274
|
} else { |
6275
|
6275
|
$newfilter .= ' AND fk_facture IS NULL AND fk_facture_line IS NULL'; // Customer discounts available |
6276
|
6276
|
} |
6277
|
6277
|
if ($filter) { |
6278
|
|
- $newfilter .= ' AND (' . $filter . ')'; |
|
6278
|
+ $newfilter .= ' AND ('.$filter.')'; |
6279
|
6279
|
} |
6280
|
6280
|
// output the combo of discounts |
6281
|
6281
|
$nbqualifiedlines = $this->select_remises($selected, $htmlname, $newfilter, $socid, $maxvalue); |
6282
|
6282
|
if ($nbqualifiedlines > 0) { |
6283
|
|
- print ' <input type="submit" class="button smallpaddingimp" value="' . dol_escape_htmltag($langs->trans("UseLine")) . '"'; |
|
6283
|
+ print ' <input type="submit" class="button smallpaddingimp" value="'.dol_escape_htmltag($langs->trans("UseLine")).'"'; |
6284
|
6284
|
if (!empty($discount_type) && $filter && $filter != "fk_invoice_supplier_source IS NULL OR (description LIKE '(DEPOSIT)%' AND description NOT LIKE '(EXCESS PAID)%')") { |
6285
|
|
- print ' title="' . $langs->trans("UseCreditNoteInInvoicePayment") . '"'; |
|
6285
|
+ print ' title="'.$langs->trans("UseCreditNoteInInvoicePayment").'"'; |
6286
|
6286
|
} |
6287
|
6287
|
if (empty($discount_type) && $filter && $filter != "fk_facture_source IS NULL OR (description LIKE '(DEPOSIT)%' AND description NOT LIKE '(EXCESS RECEIVED)%')") { |
6288
|
|
- print ' title="' . $langs->trans("UseCreditNoteInInvoicePayment") . '"'; |
|
6288
|
+ print ' title="'.$langs->trans("UseCreditNoteInInvoicePayment").'"'; |
6289
|
6289
|
} |
6290
|
6290
|
|
6291
|
6291
|
print '>'; |
|
@@ -6325,23 +6325,23 @@ discard block |
|
|
block discarded – undo |
6325
|
6325
|
global $langs; |
6326
|
6326
|
|
6327
|
6327
|
if ($htmlname != "none") { |
6328
|
|
- print '<form method="post" action="' . $page . '">'; |
|
6328
|
+ print '<form method="post" action="'.$page.'">'; |
6329
|
6329
|
print '<input type="hidden" name="action" value="set_contact">'; |
6330
|
|
- print '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
6330
|
+ print '<input type="hidden" name="token" value="'.newToken().'">'; |
6331
|
6331
|
print '<table class="nobordernopadding">'; |
6332
|
6332
|
print '<tr><td>'; |
6333
|
6333
|
print $this->selectcontacts($societe->id, $selected, $htmlname); |
6334
|
6334
|
$num = $this->num; |
6335
|
6335
|
if ($num == 0) { |
6336
|
6336
|
$addcontact = (getDolGlobalString('SOCIETE_ADDRESSES_MANAGEMENT') ? $langs->trans("AddContact") : $langs->trans("AddContactAddress")); |
6337
|
|
- print '<a href="' . DOL_URL_ROOT . '/contact/card.php?socid=' . $societe->id . '&action=create&backtoreferer=1">' . $addcontact . '</a>'; |
|
6337
|
+ print '<a href="'.DOL_URL_ROOT.'/contact/card.php?socid='.$societe->id.'&action=create&backtoreferer=1">'.$addcontact.'</a>'; |
6338
|
6338
|
} |
6339
|
6339
|
print '</td>'; |
6340
|
|
- print '<td class="left"><input type="submit" class="button smallpaddingimp" value="' . $langs->trans("Modify") . '"></td>'; |
|
6340
|
+ print '<td class="left"><input type="submit" class="button smallpaddingimp" value="'.$langs->trans("Modify").'"></td>'; |
6341
|
6341
|
print '</tr></table></form>'; |
6342
|
6342
|
} else { |
6343
|
6343
|
if ($selected) { |
6344
|
|
- require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php'; |
|
6344
|
+ require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; |
6345
|
6345
|
$contact = new Contact($this->db); |
6346
|
6346
|
$contact->fetch($selected); |
6347
|
6347
|
print $contact->getFullName($langs); |
|
@@ -6376,20 +6376,20 @@ discard block |
|
|
block discarded – undo |
6376
|
6376
|
|
6377
|
6377
|
$out = ''; |
6378
|
6378
|
if ($htmlname != "none") { |
6379
|
|
- $out .= '<form method="post" action="' . $page . '">'; |
|
6379
|
+ $out .= '<form method="post" action="'.$page.'">'; |
6380
|
6380
|
$out .= '<input type="hidden" name="action" value="set_thirdparty">'; |
6381
|
|
- $out .= '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
6381
|
+ $out .= '<input type="hidden" name="token" value="'.newToken().'">'; |
6382
|
6382
|
$out .= $this->select_company($selected, $htmlname, $filter, $showempty, $showtype, $forcecombo, $events, 0, 'minwidth100', '', '', 1, array(), false, $excludeids); |
6383
|
|
- $out .= '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">'; |
|
6383
|
+ $out .= '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">'; |
6384
|
6384
|
$out .= '</form>'; |
6385
|
6385
|
} else { |
6386
|
6386
|
if ($selected) { |
6387
|
|
- require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; |
|
6387
|
+ require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; |
6388
|
6388
|
$soc = new Societe($this->db); |
6389
|
6389
|
$soc->fetch($selected); |
6390
|
6390
|
$out .= $soc->getNomUrl(0, ''); |
6391
|
6391
|
} else { |
6392
|
|
- $out .= '<span class="opacitymedium">' . $textifnothirdparty . '</span>'; |
|
6392
|
+ $out .= '<span class="opacitymedium">'.$textifnothirdparty.'</span>'; |
6393
|
6393
|
} |
6394
|
6394
|
} |
6395
|
6395
|
|
|
@@ -6439,22 +6439,22 @@ discard block |
|
|
block discarded – undo |
6439
|
6439
|
$selected = 'EUR'; // Pour compatibilite |
6440
|
6440
|
} |
6441
|
6441
|
|
6442
|
|
- $out .= '<select class="flat maxwidth200onsmartphone minwidth300" name="' . $htmlname . '" id="' . $htmlname . '">'; |
|
6442
|
+ $out .= '<select class="flat maxwidth200onsmartphone minwidth300" name="'.$htmlname.'" id="'.$htmlname.'">'; |
6443
|
6443
|
if ($useempty) { |
6444
|
6444
|
$out .= '<option value="-1" selected></option>'; |
6445
|
6445
|
} |
6446
|
6446
|
foreach ($langs->cache_currencies as $code_iso => $currency) { |
6447
|
6447
|
$labeltoshow = $currency['label']; |
6448
|
6448
|
if ($mode == 1) { |
6449
|
|
- $labeltoshow .= ' <span class="opacitymedium">(' . $code_iso . ')</span>'; |
|
6449
|
+ $labeltoshow .= ' <span class="opacitymedium">('.$code_iso.')</span>'; |
6450
|
6450
|
} else { |
6451
|
|
- $labeltoshow .= ' <span class="opacitymedium">(' . $langs->getCurrencySymbol($code_iso) . ')</span>'; |
|
6451
|
+ $labeltoshow .= ' <span class="opacitymedium">('.$langs->getCurrencySymbol($code_iso).')</span>'; |
6452
|
6452
|
} |
6453
|
6453
|
|
6454
|
6454
|
if ($selected && $selected == $code_iso) { |
6455
|
|
- $out .= '<option value="' . $code_iso . '" selected data-html="' . dol_escape_htmltag($labeltoshow) . '">'; |
|
6455
|
+ $out .= '<option value="'.$code_iso.'" selected data-html="'.dol_escape_htmltag($labeltoshow).'">'; |
6456
|
6456
|
} else { |
6457
|
|
- $out .= '<option value="' . $code_iso . '" data-html="' . dol_escape_htmltag($labeltoshow) . '">'; |
|
6457
|
+ $out .= '<option value="'.$code_iso.'" data-html="'.dol_escape_htmltag($labeltoshow).'">'; |
6458
|
6458
|
} |
6459
|
6459
|
$out .= $labeltoshow; |
6460
|
6460
|
$out .= '</option>'; |
|
@@ -6465,7 +6465,7 @@ discard block |
|
|
block discarded – undo |
6465
|
6465
|
} |
6466
|
6466
|
|
6467
|
6467
|
// Make select dynamic |
6468
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
6468
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
6469
|
6469
|
$out .= ajax_combobox($htmlname); |
6470
|
6470
|
|
6471
|
6471
|
return $out; |
|
@@ -6491,10 +6491,10 @@ discard block |
|
|
block discarded – undo |
6491
|
6491
|
|
6492
|
6492
|
$TCurrency = array(); |
6493
|
6493
|
|
6494
|
|
- $sql = "SELECT code FROM " . $this->db->prefix() . "multicurrency"; |
6495
|
|
- $sql .= " WHERE entity IN ('" . getEntity('mutlicurrency') . "')"; |
|
6494
|
+ $sql = "SELECT code FROM ".$this->db->prefix()."multicurrency"; |
|
6495
|
+ $sql .= " WHERE entity IN ('".getEntity('mutlicurrency')."')"; |
6496
|
6496
|
if ($filter) { |
6497
|
|
- $sql .= " AND " . $filter; |
|
6497
|
+ $sql .= " AND ".$filter; |
6498
|
6498
|
} |
6499
|
6499
|
$resql = $this->db->query($sql); |
6500
|
6500
|
if ($resql) { |
|
@@ -6504,7 +6504,7 @@ discard block |
|
|
block discarded – undo |
6504
|
6504
|
} |
6505
|
6505
|
|
6506
|
6506
|
$out = ''; |
6507
|
|
- $out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">'; |
|
6507
|
+ $out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">'; |
6508
|
6508
|
if ($useempty) { |
6509
|
6509
|
$out .= '<option value=""> </option>'; |
6510
|
6510
|
} |
|
@@ -6516,13 +6516,13 @@ discard block |
|
|
block discarded – undo |
6516
|
6516
|
foreach ($langs->cache_currencies as $code_iso => $currency) { |
6517
|
6517
|
if (isset($TCurrency[$code_iso])) { |
6518
|
6518
|
if (!empty($selected) && $selected == $code_iso) { |
6519
|
|
- $out .= '<option value="' . $code_iso . '" selected="selected">'; |
|
6519
|
+ $out .= '<option value="'.$code_iso.'" selected="selected">'; |
6520
|
6520
|
} else { |
6521
|
|
- $out .= '<option value="' . $code_iso . '">'; |
|
6521
|
+ $out .= '<option value="'.$code_iso.'">'; |
6522
|
6522
|
} |
6523
|
6523
|
|
6524
|
6524
|
$out .= $currency['label']; |
6525
|
|
- $out .= ' (' . $langs->getCurrencySymbol($code_iso) . ')'; |
|
6525
|
+ $out .= ' ('.$langs->getCurrencySymbol($code_iso).')'; |
6526
|
6526
|
$out .= '</option>'; |
6527
|
6527
|
} |
6528
|
6528
|
} |
|
@@ -6531,7 +6531,7 @@ discard block |
|
|
block discarded – undo |
6531
|
6531
|
$out .= '</select>'; |
6532
|
6532
|
|
6533
|
6533
|
// Make select dynamic |
6534
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
6534
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
6535
|
6535
|
$out .= ajax_combobox($htmlname); |
6536
|
6536
|
|
6537
|
6537
|
return $out; |
|
@@ -6562,7 +6562,7 @@ discard block |
|
|
block discarded – undo |
6562
|
6562
|
$sql .= " WHERE t.fk_pays = c.rowid"; |
6563
|
6563
|
$sql .= " AND t.active > 0"; |
6564
|
6564
|
$sql .= " AND t.entity IN (".getEntity('c_tva').")"; |
6565
|
|
- $sql .= " AND c.code IN (" . $this->db->sanitize($country_code, 1) . ")"; |
|
6565
|
+ $sql .= " AND c.code IN (".$this->db->sanitize($country_code, 1).")"; |
6566
|
6566
|
$sql .= " ORDER BY t.code ASC, t.taux ASC, t.recuperableonly ASC"; |
6567
|
6567
|
|
6568
|
6568
|
$resql = $this->db->query($sql); |
|
@@ -6574,30 +6574,30 @@ discard block |
|
|
block discarded – undo |
6574
|
6574
|
|
6575
|
6575
|
$tmparray = array(); |
6576
|
6576
|
$tmparray['rowid'] = $obj->rowid; |
6577
|
|
- $tmparray['type_vat'] = $obj->type_vat; |
6578
|
|
- $tmparray['code'] = $obj->code; |
|
6577
|
+ $tmparray['type_vat'] = $obj->type_vat; |
|
6578
|
+ $tmparray['code'] = $obj->code; |
6579
|
6579
|
$tmparray['txtva'] = $obj->taux; |
6580
|
|
- $tmparray['nprtva'] = $obj->recuperableonly; |
|
6580
|
+ $tmparray['nprtva'] = $obj->recuperableonly; |
6581
|
6581
|
$tmparray['localtax1'] = $obj->localtax1; |
6582
|
6582
|
$tmparray['localtax1_type'] = $obj->localtax1_type; |
6583
|
6583
|
$tmparray['localtax2'] = $obj->localtax2; |
6584
|
6584
|
$tmparray['localtax2_type'] = $obj->localtax1_type; |
6585
|
|
- $tmparray['label'] = $obj->taux . '%' . ($obj->code ? ' (' . $obj->code . ')' : ''); // Label must contains only 0-9 , . % or * |
6586
|
|
- $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 |
|
6585
|
+ $tmparray['label'] = $obj->taux.'%'.($obj->code ? ' ('.$obj->code.')' : ''); // Label must contains only 0-9 , . % or * |
|
6586
|
+ $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 |
6587
|
6587
|
$positiverates = ''; |
6588
|
6588
|
if ($obj->taux) { |
6589
|
|
- $positiverates .= ($positiverates ? '/' : '') . $obj->taux; |
|
6589
|
+ $positiverates .= ($positiverates ? '/' : '').$obj->taux; |
6590
|
6590
|
} |
6591
|
6591
|
if ($obj->localtax1) { |
6592
|
|
- $positiverates .= ($positiverates ? '/' : '') . $obj->localtax1; |
|
6592
|
+ $positiverates .= ($positiverates ? '/' : '').$obj->localtax1; |
6593
|
6593
|
} |
6594
|
6594
|
if ($obj->localtax2) { |
6595
|
|
- $positiverates .= ($positiverates ? '/' : '') . $obj->localtax2; |
|
6595
|
+ $positiverates .= ($positiverates ? '/' : '').$obj->localtax2; |
6596
|
6596
|
} |
6597
|
6597
|
if (empty($positiverates)) { |
6598
|
6598
|
$positiverates = '0'; |
6599
|
6599
|
} |
6600
|
|
- $tmparray['labelpositiverates'] = $positiverates . ($obj->code ? ' (' . $obj->code . ')' : ''); // Must never be used as key, only label |
|
6600
|
+ $tmparray['labelpositiverates'] = $positiverates.($obj->code ? ' ('.$obj->code.')' : ''); // Must never be used as key, only label |
6601
|
6601
|
|
6602
|
6602
|
$this->cache_vatrates[$obj->rowid] = $tmparray; |
6603
|
6603
|
} |
|
@@ -6617,7 +6617,7 @@ discard block |
|
|
block discarded – undo |
6617
|
6617
|
return -1; |
6618
|
6618
|
} |
6619
|
6619
|
} else { |
6620
|
|
- $this->error = '<span class="error">' . $this->db->error() . '</span>'; |
|
6620
|
+ $this->error = '<span class="error">'.$this->db->error().'</span>'; |
6621
|
6621
|
return -2; |
6622
|
6622
|
} |
6623
|
6623
|
} |
|
@@ -6670,9 +6670,9 @@ discard block |
|
|
block discarded – undo |
6670
|
6670
|
// Check parameters |
6671
|
6671
|
if (is_object($societe_vendeuse) && !$societe_vendeuse->country_code) { |
6672
|
6672
|
if ($societe_vendeuse->id == $mysoc->id) { |
6673
|
|
- $return .= '<span class="error">' . $langs->trans("ErrorYourCountryIsNotDefined") . '</span>'; |
|
6673
|
+ $return .= '<span class="error">'.$langs->trans("ErrorYourCountryIsNotDefined").'</span>'; |
6674
|
6674
|
} else { |
6675
|
|
- $return .= '<span class="error">' . $langs->trans("ErrorSupplierCountryIsNotDefined") . '</span>'; |
|
6675
|
+ $return .= '<span class="error">'.$langs->trans("ErrorSupplierCountryIsNotDefined").'</span>'; |
6676
|
6676
|
} |
6677
|
6677
|
return $return; |
6678
|
6678
|
} |
|
@@ -6684,12 +6684,12 @@ discard block |
|
|
block discarded – undo |
6684
|
6684
|
// Define list of countries to use to search VAT rates to show |
6685
|
6685
|
// First we defined code_country to use to find list |
6686
|
6686
|
if (is_object($societe_vendeuse)) { |
6687
|
|
- $code_country = "'" . $societe_vendeuse->country_code . "'"; |
|
6687
|
+ $code_country = "'".$societe_vendeuse->country_code."'"; |
6688
|
6688
|
} else { |
6689
|
|
- $code_country = "'" . $mysoc->country_code . "'"; // Pour compatibilite ascendente |
|
6689
|
+ $code_country = "'".$mysoc->country_code."'"; // Pour compatibilite ascendente |
6690
|
6690
|
} |
6691
|
6691
|
if (getDolGlobalString('SERVICE_ARE_ECOMMERCE_200238EC')) { // If option to have vat for end customer for services is on |
6692
|
|
- require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php'; |
|
6692
|
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; |
6693
|
6693
|
// If SERVICE_ARE_ECOMMERCE_200238EC=1 combo list vat rate of purchaser and seller countries |
6694
|
6694
|
// If SERVICE_ARE_ECOMMERCE_200238EC=2 combo list only the vat rate of the purchaser country |
6695
|
6695
|
$selectVatComboMode = getDolGlobalString('SERVICE_ARE_ECOMMERCE_200238EC'); |
|
@@ -6699,27 +6699,27 @@ discard block |
|
|
block discarded – undo |
6699
|
6699
|
if ($type == 1) { // We know product is a service |
6700
|
6700
|
switch ($selectVatComboMode) { |
6701
|
6701
|
case '1': |
6702
|
|
- $code_country .= ",'" . $societe_acheteuse->country_code . "'"; |
|
6702
|
+ $code_country .= ",'".$societe_acheteuse->country_code."'"; |
6703
|
6703
|
break; |
6704
|
6704
|
case '2': |
6705
|
|
- $code_country = "'" . $societe_acheteuse->country_code . "'"; |
|
6705
|
+ $code_country = "'".$societe_acheteuse->country_code."'"; |
6706
|
6706
|
break; |
6707
|
6707
|
} |
6708
|
6708
|
} |
6709
|
6709
|
} elseif (!$idprod) { // We don't know type of product |
6710
|
6710
|
switch ($selectVatComboMode) { |
6711
|
6711
|
case '1': |
6712
|
|
- $code_country .= ",'" . $societe_acheteuse->country_code . "'"; |
|
6712
|
+ $code_country .= ",'".$societe_acheteuse->country_code."'"; |
6713
|
6713
|
break; |
6714
|
6714
|
case '2': |
6715
|
|
- $code_country = "'" . $societe_acheteuse->country_code . "'"; |
|
6715
|
+ $code_country = "'".$societe_acheteuse->country_code."'"; |
6716
|
6716
|
break; |
6717
|
6717
|
} |
6718
|
6718
|
} else { |
6719
|
6719
|
$prodstatic = new Product($this->db); |
6720
|
6720
|
$prodstatic->fetch($idprod); |
6721
|
6721
|
if ($prodstatic->type == Product::TYPE_SERVICE) { // We know product is a service |
6722
|
|
- $code_country .= ",'" . $societe_acheteuse->country_code . "'"; |
|
6722
|
+ $code_country .= ",'".$societe_acheteuse->country_code."'"; |
6723
|
6723
|
} |
6724
|
6724
|
} |
6725
|
6725
|
} |
|
@@ -6781,13 +6781,13 @@ discard block |
|
|
block discarded – undo |
6781
|
6781
|
// Override/enable VAT for expense report regardless of global setting - needed if expense report used for business expenses instead |
6782
|
6782
|
// of using supplier invoices (this is a very bad idea !) |
6783
|
6783
|
if (!getDolGlobalString('EXPENSEREPORT_OVERRIDE_VAT')) { |
6784
|
|
- $title = ' title="' . dol_escape_htmltag($langs->trans('VATIsNotUsed')) . '"'; |
|
6784
|
+ $title = ' title="'.dol_escape_htmltag($langs->trans('VATIsNotUsed')).'"'; |
6785
|
6785
|
$disabled = true; |
6786
|
6786
|
} |
6787
|
6787
|
} |
6788
|
6788
|
|
6789
|
6789
|
if (!$options_only) { |
6790
|
|
- $return .= '<select class="flat minwidth75imp maxwidth100 right" id="' . $htmlname . '" name="' . $htmlname . '"' . ($disabled ? ' disabled' : '') . $title . '>'; |
|
6790
|
+ $return .= '<select class="flat minwidth75imp maxwidth100 right" id="'.$htmlname.'" name="'.$htmlname.'"'.($disabled ? ' disabled' : '').$title.'>'; |
6791
|
6791
|
} |
6792
|
6792
|
|
6793
|
6793
|
$selectedfound = false; |
|
@@ -6801,13 +6801,13 @@ discard block |
|
|
block discarded – undo |
6801
|
6801
|
$key = $rate['txtva']; |
6802
|
6802
|
$key .= $rate['nprtva'] ? '*' : ''; |
6803
|
6803
|
if ($mode > 0 && $rate['code']) { |
6804
|
|
- $key .= ' (' . $rate['code'] . ')'; |
|
6804
|
+ $key .= ' ('.$rate['code'].')'; |
6805
|
6805
|
} |
6806
|
6806
|
if ($mode < 0) { |
6807
|
6807
|
$key = $rate['rowid']; |
6808
|
6808
|
} |
6809
|
6809
|
|
6810
|
|
- $return .= '<option value="' . $key . '"'; |
|
6810
|
+ $return .= '<option value="'.$key.'"'; |
6811
|
6811
|
if (!$selectedfound) { |
6812
|
6812
|
if ($defaultcode) { // If defaultcode is defined, we used it in priority to select combo option instead of using rate+npr flag |
6813
|
6813
|
if ($defaultcode == $rate['code']) { |
|
@@ -6878,7 +6878,7 @@ discard block |
|
|
block discarded – undo |
6878
|
6878
|
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 = '') |
6879
|
6879
|
{ |
6880
|
6880
|
// phpcs:enable |
6881
|
|
- dol_syslog(__METHOD__ . ': using select_date is deprecated. Use selectDate instead.', LOG_WARNING); |
|
6881
|
+ dol_syslog(__METHOD__.': using select_date is deprecated. Use selectDate instead.', LOG_WARNING); |
6882
|
6882
|
$retstring = $this->selectDate($set_time, $prefix, $h, $m, $empty, $form_name, $d, $addnowlink, $disabled, $fullday, $addplusone, $adddateof); |
6883
|
6883
|
if (!empty($nooutput)) { |
6884
|
6884
|
return $retstring; |
|
@@ -6907,11 +6907,11 @@ discard block |
|
|
block discarded – undo |
6907
|
6907
|
{ |
6908
|
6908
|
global $langs; |
6909
|
6909
|
|
6910
|
|
- $ret = $this->selectDate($set_time, $prefix . '_start', 0, 0, $empty, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("from"), 'tzuserrel'); |
|
6910
|
+ $ret = $this->selectDate($set_time, $prefix.'_start', 0, 0, $empty, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("from"), 'tzuserrel'); |
6911
|
6911
|
if ($forcenewline) { |
6912
|
6912
|
$ret .= '<br>'; |
6913
|
6913
|
} |
6914
|
|
- $ret .= $this->selectDate($set_time_end, $prefix . '_end', 0, 0, $empty, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"), 'tzuserrel'); |
|
6914
|
+ $ret .= $this->selectDate($set_time_end, $prefix.'_end', 0, 0, $empty, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"), 'tzuserrel'); |
6915
|
6915
|
return $ret; |
6916
|
6916
|
} |
6917
|
6917
|
|
|
@@ -6977,7 +6977,7 @@ discard block |
|
|
block discarded – undo |
6977
|
6977
|
$orig_set_time = $set_time; |
6978
|
6978
|
|
6979
|
6979
|
if ($set_time === '' && $emptydate == 0) { |
6980
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php'; |
|
6980
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; |
6981
|
6981
|
if ($gm == 'tzuser' || $gm == 'tzuserrel') { |
6982
|
6982
|
$set_time = dol_now($gm); |
6983
|
6983
|
} else { |
|
@@ -7049,38 +7049,38 @@ discard block |
|
|
block discarded – undo |
7049
|
7049
|
// Calendrier popup version eldy |
7050
|
7050
|
if ($usecalendar == "eldy") { |
7051
|
7051
|
// Input area to enter date manually |
7052
|
|
- $retstring .= '<input id="' . $prefix . '" name="' . $prefix . '" type="text" class="maxwidthdate" maxlength="11" value="' . $formated_date . '"'; |
|
7052
|
+ $retstring .= '<input id="'.$prefix.'" name="'.$prefix.'" type="text" class="maxwidthdate" maxlength="11" value="'.$formated_date.'"'; |
7053
|
7053
|
$retstring .= ($disabled ? ' disabled' : ''); |
7054
|
|
- $retstring .= ' onChange="dpChangeDay(\'' . $prefix . '\',\'' . $langs->trans("FormatDateShortJavaInput") . '\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript |
|
7054
|
+ $retstring .= ' onChange="dpChangeDay(\''.$prefix.'\',\''.$langs->trans("FormatDateShortJavaInput").'\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript |
7055
|
7055
|
$retstring .= ' autocomplete="off">'; |
7056
|
7056
|
|
7057
|
7057
|
// Icon calendar |
7058
|
7058
|
$retstringbuttom = ''; |
7059
|
7059
|
if (!$disabled) { |
7060
|
|
- $retstringbuttom = '<button id="' . $prefix . 'Button" type="button" class="dpInvisibleButtons"'; |
7061
|
|
- $base = DOL_URL_ROOT . '/core/'; |
7062
|
|
- $retstringbuttom .= ' onClick="showDP(\'' . $base . '\',\'' . $prefix . '\',\'' . $langs->trans("FormatDateShortJavaInput") . '\',\'' . $langs->defaultlang . '\');"'; |
7063
|
|
- $retstringbuttom .= '>' . img_object($langs->trans("SelectDate"), 'calendarday', 'class="datecallink"') . '</button>'; |
|
7060
|
+ $retstringbuttom = '<button id="'.$prefix.'Button" type="button" class="dpInvisibleButtons"'; |
|
7061
|
+ $base = DOL_URL_ROOT.'/core/'; |
|
7062
|
+ $retstringbuttom .= ' onClick="showDP(\''.$base.'\',\''.$prefix.'\',\''.$langs->trans("FormatDateShortJavaInput").'\',\''.$langs->defaultlang.'\');"'; |
|
7063
|
+ $retstringbuttom .= '>'.img_object($langs->trans("SelectDate"), 'calendarday', 'class="datecallink"').'</button>'; |
7064
|
7064
|
} else { |
7065
|
|
- $retstringbuttom = '<button id="' . $prefix . 'Button" type="button" class="dpInvisibleButtons">' . img_object($langs->trans("Disabled"), 'calendarday', 'class="datecallink"') . '</button>'; |
|
7065
|
+ $retstringbuttom = '<button id="'.$prefix.'Button" type="button" class="dpInvisibleButtons">'.img_object($langs->trans("Disabled"), 'calendarday', 'class="datecallink"').'</button>'; |
7066
|
7066
|
} |
7067
|
|
- $retstring = $retstringbuttom . $retstring; |
|
7067
|
+ $retstring = $retstringbuttom.$retstring; |
7068
|
7068
|
|
7069
|
|
- $retstring .= '<input type="hidden" id="' . $prefix . 'day" name="' . $prefix . 'day" value="' . $sday . '">' . "\n"; |
7070
|
|
- $retstring .= '<input type="hidden" id="' . $prefix . 'month" name="' . $prefix . 'month" value="' . $smonth . '">' . "\n"; |
7071
|
|
- $retstring .= '<input type="hidden" id="' . $prefix . 'year" name="' . $prefix . 'year" value="' . $syear . '">' . "\n"; |
|
7069
|
+ $retstring .= '<input type="hidden" id="'.$prefix.'day" name="'.$prefix.'day" value="'.$sday.'">'."\n"; |
|
7070
|
+ $retstring .= '<input type="hidden" id="'.$prefix.'month" name="'.$prefix.'month" value="'.$smonth.'">'."\n"; |
|
7071
|
+ $retstring .= '<input type="hidden" id="'.$prefix.'year" name="'.$prefix.'year" value="'.$syear.'">'."\n"; |
7072
|
7072
|
} elseif ($usecalendar == 'jquery' || $usecalendar == 'html') { |
7073
|
7073
|
if (!$disabled && $usecalendar != 'html') { |
7074
|
7074
|
// Output javascript for datepicker |
7075
|
7075
|
$minYear = getDolGlobalInt('MIN_YEAR_SELECT_DATE', (idate('Y') - 100)); |
7076
|
7076
|
$maxYear = getDolGlobalInt('MAX_YEAR_SELECT_DATE', (idate('Y') + 100)); |
7077
|
7077
|
|
7078
|
|
- $retstring .= '<script nonce="' . getNonce() . '" type="text/javascript">'; |
7079
|
|
- $retstring .= "$(function(){ $('#" . $prefix . "').datepicker({ |
7080
|
|
- dateFormat: '" . $langs->trans("FormatDateShortJQueryInput") . "', |
|
7078
|
+ $retstring .= '<script nonce="'.getNonce().'" type="text/javascript">'; |
|
7079
|
+ $retstring .= "$(function(){ $('#".$prefix."').datepicker({ |
|
7080
|
+ dateFormat: '" . $langs->trans("FormatDateShortJQueryInput")."', |
7081
|
7081
|
autoclose: true, |
7082
|
7082
|
todayHighlight: true, |
7083
|
|
- yearRange: '" . $minYear . ":" . $maxYear . "',"; |
|
7083
|
+ yearRange: '" . $minYear.":".$maxYear."',"; |
7084
|
7084
|
if (!empty($conf->dol_use_jmobile)) { |
7085
|
7085
|
$retstring .= " |
7086
|
7086
|
beforeShow: function (input, datePicker) { |
|
@@ -7095,7 +7095,7 @@ discard block |
|
|
block discarded – undo |
7095
|
7095
|
if (!getDolGlobalString('MAIN_POPUP_CALENDAR_ON_FOCUS')) { |
7096
|
7096
|
$retstring .= " |
7097
|
7097
|
showOn: 'button', /* both has problem with autocompletion */ |
7098
|
|
- buttonImage: '" . DOL_URL_ROOT . "/theme/" . dol_escape_js($conf->theme) . "/img/object_calendarday.png', |
|
7098
|
+ buttonImage: '" . DOL_URL_ROOT."/theme/".dol_escape_js($conf->theme)."/img/object_calendarday.png', |
7099
|
7099
|
buttonImageOnly: true"; |
7100
|
7100
|
} |
7101
|
7101
|
$retstring .= " |
|
@@ -7107,46 +7107,46 @@ discard block |
|
|
block discarded – undo |
7107
|
7107
|
$retstring .= '<div class="nowraponall inline-block divfordateinput">'; |
7108
|
7108
|
$retstring .= '<input id="'.$prefix.'" name="'.$prefix.'" type="text" class="maxwidthdate" maxlength="11" value="'.$formated_date.'"'; |
7109
|
7109
|
$retstring .= ($disabled ? ' disabled' : ''); |
7110
|
|
- $retstring .= ($placeholder ? ' placeholder="' . dol_escape_htmltag($placeholder) . '"' : ''); |
7111
|
|
- $retstring .= ' onChange="dpChangeDay(\'' . dol_escape_js($prefix) . '\',\'' . dol_escape_js($langs->trans("FormatDateShortJavaInput")) . '\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript |
|
7110
|
+ $retstring .= ($placeholder ? ' placeholder="'.dol_escape_htmltag($placeholder).'"' : ''); |
|
7111
|
+ $retstring .= ' onChange="dpChangeDay(\''.dol_escape_js($prefix).'\',\''.dol_escape_js($langs->trans("FormatDateShortJavaInput")).'\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript |
7112
|
7112
|
$retstring .= ' autocomplete="off">'; |
7113
|
7113
|
|
7114
|
7114
|
// Icone calendrier |
7115
|
7115
|
if ($disabled) { |
7116
|
|
- $retstringbutton = '<button id="' . $prefix . 'Button" type="button" class="dpInvisibleButtons">' . img_object($langs->trans("Disabled"), 'calendarday', 'class="datecallink"') . '</button>'; |
7117
|
|
- $retstring = $retstringbutton . $retstring; |
|
7116
|
+ $retstringbutton = '<button id="'.$prefix.'Button" type="button" class="dpInvisibleButtons">'.img_object($langs->trans("Disabled"), 'calendarday', 'class="datecallink"').'</button>'; |
|
7117
|
+ $retstring = $retstringbutton.$retstring; |
7118
|
7118
|
} |
7119
|
7119
|
|
7120
|
7120
|
$retstring .= '</div>'; |
7121
|
|
- $retstring .= '<input type="hidden" id="' . $prefix . 'day" name="' . $prefix . 'day" value="' . $sday . '">' . "\n"; |
7122
|
|
- $retstring .= '<input type="hidden" id="' . $prefix . 'month" name="' . $prefix . 'month" value="' . $smonth . '">' . "\n"; |
7123
|
|
- $retstring .= '<input type="hidden" id="' . $prefix . 'year" name="' . $prefix . 'year" value="' . $syear . '">' . "\n"; |
|
7121
|
+ $retstring .= '<input type="hidden" id="'.$prefix.'day" name="'.$prefix.'day" value="'.$sday.'">'."\n"; |
|
7122
|
+ $retstring .= '<input type="hidden" id="'.$prefix.'month" name="'.$prefix.'month" value="'.$smonth.'">'."\n"; |
|
7123
|
+ $retstring .= '<input type="hidden" id="'.$prefix.'year" name="'.$prefix.'year" value="'.$syear.'">'."\n"; |
7124
|
7124
|
} else { |
7125
|
7125
|
$retstring .= "Bad value of MAIN_POPUP_CALENDAR"; |
7126
|
7126
|
} |
7127
|
7127
|
} else { |
7128
|
7128
|
// Show date with combo selects |
7129
|
7129
|
// Day |
7130
|
|
- $retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth50imp" id="' . $prefix . 'day" name="' . $prefix . 'day">'; |
|
7130
|
+ $retstring .= '<select'.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth50imp" id="'.$prefix.'day" name="'.$prefix.'day">'; |
7131
|
7131
|
|
7132
|
7132
|
if ($emptydate || $set_time == -1) { |
7133
|
7133
|
$retstring .= '<option value="0" selected> </option>'; |
7134
|
7134
|
} |
7135
|
7135
|
|
7136
|
7136
|
for ($day = 1; $day <= 31; $day++) { |
7137
|
|
- $retstring .= '<option value="' . $day . '"' . ($day == $sday ? ' selected' : '') . '>' . $day . '</option>'; |
|
7137
|
+ $retstring .= '<option value="'.$day.'"'.($day == $sday ? ' selected' : '').'>'.$day.'</option>'; |
7138
|
7138
|
} |
7139
|
7139
|
|
7140
|
7140
|
$retstring .= "</select>"; |
7141
|
7141
|
|
7142
|
|
- $retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth75imp" id="' . $prefix . 'month" name="' . $prefix . 'month">'; |
|
7142
|
+ $retstring .= '<select'.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth75imp" id="'.$prefix.'month" name="'.$prefix.'month">'; |
7143
|
7143
|
if ($emptydate || $set_time == -1) { |
7144
|
7144
|
$retstring .= '<option value="0" selected> </option>'; |
7145
|
7145
|
} |
7146
|
7146
|
|
7147
|
7147
|
// Month |
7148
|
7148
|
for ($month = 1; $month <= 12; $month++) { |
7149
|
|
- $retstring .= '<option value="' . $month . '"' . ($month == $smonth ? ' selected' : '') . '>'; |
|
7149
|
+ $retstring .= '<option value="'.$month.'"'.($month == $smonth ? ' selected' : '').'>'; |
7150
|
7150
|
$retstring .= dol_print_date(mktime(12, 0, 0, $month, 1, 2000), "%b"); |
7151
|
7151
|
$retstring .= "</option>"; |
7152
|
7152
|
} |
|
@@ -7154,13 +7154,13 @@ discard block |
|
|
block discarded – undo |
7154
|
7154
|
|
7155
|
7155
|
// Year |
7156
|
7156
|
if ($emptydate || $set_time == -1) { |
7157
|
|
- $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 . '">'; |
|
7157
|
+ $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.'">'; |
7158
|
7158
|
} else { |
7159
|
|
- $retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth75imp" id="' . $prefix . 'year" name="' . $prefix . 'year">'; |
|
7159
|
+ $retstring .= '<select'.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth75imp" id="'.$prefix.'year" name="'.$prefix.'year">'; |
7160
|
7160
|
|
7161
|
7161
|
$syear = (int) $syear; |
7162
|
7162
|
for ($year = $syear - 10; $year < (int) $syear + 10; $year++) { |
7163
|
|
- $retstring .= '<option value="' . $year . '"' . ($year == $syear ? ' selected' : '') . '>' . $year . '</option>'; |
|
7163
|
+ $retstring .= '<option value="'.$year.'"'.($year == $syear ? ' selected' : '').'>'.$year.'</option>'; |
7164
|
7164
|
} |
7165
|
7165
|
$retstring .= "</select>\n"; |
7166
|
7166
|
} |
|
@@ -7184,15 +7184,15 @@ discard block |
|
|
block discarded – undo |
7184
|
7184
|
} |
7185
|
7185
|
} |
7186
|
7186
|
// Show hour |
7187
|
|
- $retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth50 ' . ($fullday ? $fullday . 'hour' : '') . '" id="' . $prefix . 'hour" name="' . $prefix . 'hour">'; |
|
7187
|
+ $retstring .= '<select'.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth50 '.($fullday ? $fullday.'hour' : '').'" id="'.$prefix.'hour" name="'.$prefix.'hour">'; |
7188
|
7188
|
if ($emptyhours) { |
7189
|
7189
|
$retstring .= '<option value="-1"> </option>'; |
7190
|
7190
|
} |
7191
|
7191
|
for ($hour = $hourstart; $hour < $hourend; $hour++) { |
7192
|
7192
|
if (strlen($hour) < 2) { |
7193
|
|
- $hour = "0" . $hour; |
|
7193
|
+ $hour = "0".$hour; |
7194
|
7194
|
} |
7195
|
|
- $retstring .= '<option value="' . $hour . '"' . (($hour == $shour) ? ' selected' : '') . '>' . $hour; |
|
7195
|
+ $retstring .= '<option value="'.$hour.'"'.(($hour == $shour) ? ' selected' : '').'>'.$hour; |
7196
|
7196
|
//$retstring .= (empty($conf->dol_optimize_smallscreen) ? '' : 'H'); |
7197
|
7197
|
$retstring .= '</option>'; |
7198
|
7198
|
} |
|
@@ -7205,17 +7205,17 @@ discard block |
|
|
block discarded – undo |
7205
|
7205
|
|
7206
|
7206
|
if ($m) { |
7207
|
7207
|
// Show minutes |
7208
|
|
- $retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth50 ' . ($fullday ? $fullday . 'min' : '') . '" id="' . $prefix . 'min" name="' . $prefix . 'min">'; |
|
7208
|
+ $retstring .= '<select'.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth50 '.($fullday ? $fullday.'min' : '').'" id="'.$prefix.'min" name="'.$prefix.'min">'; |
7209
|
7209
|
if ($emptyhours) { |
7210
|
7210
|
$retstring .= '<option value="-1"> </option>'; |
7211
|
7211
|
} |
7212
|
7212
|
for ($min = 0; $min < 60; $min += $stepminutes) { |
7213
|
7213
|
$min_str = sprintf("%02d", $min); |
7214
|
|
- $retstring .= '<option value="' . $min_str . '"' . (($min_str == $smin) ? ' selected' : '') . '>' . $min_str . '</option>'; |
|
7214
|
+ $retstring .= '<option value="'.$min_str.'"'.(($min_str == $smin) ? ' selected' : '').'>'.$min_str.'</option>'; |
7215
|
7215
|
} |
7216
|
7216
|
$retstring .= '</select>'; |
7217
|
7217
|
|
7218
|
|
- $retstring .= '<input type="hidden" name="' . $prefix . 'sec" value="' . $ssec . '">'; |
|
7218
|
+ $retstring .= '<input type="hidden" name="'.$prefix.'sec" value="'.$ssec.'">'; |
7219
|
7219
|
} |
7220
|
7220
|
|
7221
|
7221
|
if ($d && $h) { |
|
@@ -7238,10 +7238,10 @@ discard block |
|
|
block discarded – undo |
7238
|
7238
|
|
7239
|
7239
|
// Generate the date part, depending on the use or not of the javascript calendar |
7240
|
7240
|
if ($addnowlink == 1) { // server time expressed in user time setup |
7241
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . '\').val(\'' . dol_print_date($nowgmt, 'day', 'tzuserrel') . '\');'; |
7242
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'day\').val(\'' . dol_print_date($nowgmt, '%d', 'tzuserrel') . '\');'; |
7243
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'month\').val(\'' . dol_print_date($nowgmt, '%m', 'tzuserrel') . '\');'; |
7244
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'year\').val(\'' . dol_print_date($nowgmt, '%Y', 'tzuserrel') . '\');'; |
|
7241
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'\').val(\''.dol_print_date($nowgmt, 'day', 'tzuserrel').'\');'; |
|
7242
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'day\').val(\''.dol_print_date($nowgmt, '%d', 'tzuserrel').'\');'; |
|
7243
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(\''.dol_print_date($nowgmt, '%m', 'tzuserrel').'\');'; |
|
7244
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(\''.dol_print_date($nowgmt, '%Y', 'tzuserrel').'\');'; |
7245
|
7245
|
} elseif ($addnowlink == 2) { |
7246
|
7246
|
/* Disabled because the output does not use the string format defined by FormatDateShort key to forge the value into #prefix. |
7247
|
7247
|
* This break application for foreign languages. |
|
@@ -7250,10 +7250,10 @@ discard block |
|
|
block discarded – undo |
7250
|
7250
|
$reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(parseInt(d.getMonth().pad()) + 1);'; |
7251
|
7251
|
$reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(d.getFullYear());'; |
7252
|
7252
|
*/ |
7253
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . '\').val(\'' . dol_print_date($nowgmt, 'day', 'tzuserrel') . '\');'; |
7254
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'day\').val(\'' . dol_print_date($nowgmt, '%d', 'tzuserrel') . '\');'; |
7255
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'month\').val(\'' . dol_print_date($nowgmt, '%m', 'tzuserrel') . '\');'; |
7256
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'year\').val(\'' . dol_print_date($nowgmt, '%Y', 'tzuserrel') . '\');'; |
|
7253
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'\').val(\''.dol_print_date($nowgmt, 'day', 'tzuserrel').'\');'; |
|
7254
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'day\').val(\''.dol_print_date($nowgmt, '%d', 'tzuserrel').'\');'; |
|
7255
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(\''.dol_print_date($nowgmt, '%m', 'tzuserrel').'\');'; |
|
7256
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(\''.dol_print_date($nowgmt, '%Y', 'tzuserrel').'\');'; |
7257
|
7257
|
} |
7258
|
7258
|
/*if ($usecalendar == "eldy") |
7259
|
7259
|
{ |
|
@@ -7273,11 +7273,11 @@ discard block |
|
|
block discarded – undo |
7273
|
7273
|
} |
7274
|
7274
|
//$reset_scripts .= 'this.form.elements[\''.$prefix.'hour\'].value=formatDate(new Date(), \'HH\'); '; |
7275
|
7275
|
if ($addnowlink == 1) { |
7276
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'hour\').val(\'' . dol_print_date($nowgmt, '%H', 'tzuserrel') . '\');'; |
7277
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'hour\').change();'; |
|
7276
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').val(\''.dol_print_date($nowgmt, '%H', 'tzuserrel').'\');'; |
|
7277
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').change();'; |
7278
|
7278
|
} elseif ($addnowlink == 2) { |
7279
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'hour\').val(d.getHours().pad());'; |
7280
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'hour\').change();'; |
|
7279
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').val(d.getHours().pad());'; |
|
7280
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').change();'; |
7281
|
7281
|
} |
7282
|
7282
|
|
7283
|
7283
|
if ($fullday) { |
|
@@ -7291,11 +7291,11 @@ discard block |
|
|
block discarded – undo |
7291
|
7291
|
} |
7292
|
7292
|
//$reset_scripts .= 'this.form.elements[\''.$prefix.'min\'].value=formatDate(new Date(), \'mm\'); '; |
7293
|
7293
|
if ($addnowlink == 1) { |
7294
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'min\').val(\'' . dol_print_date($nowgmt, '%M', 'tzuserrel') . '\');'; |
7295
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'min\').change();'; |
|
7294
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'min\').val(\''.dol_print_date($nowgmt, '%M', 'tzuserrel').'\');'; |
|
7295
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'min\').change();'; |
7296
|
7296
|
} elseif ($addnowlink == 2) { |
7297
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'min\').val(d.getMinutes().pad());'; |
7298
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'min\').change();'; |
|
7297
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'min\').val(d.getMinutes().pad());'; |
|
7298
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'min\').change();'; |
7299
|
7299
|
} |
7300
|
7300
|
if ($fullday) { |
7301
|
7301
|
$reset_scripts .= ' } '; |
|
@@ -7303,7 +7303,7 @@ discard block |
|
|
block discarded – undo |
7303
|
7303
|
} |
7304
|
7304
|
// If reset_scripts is not empty, print the link with the reset_scripts in the onClick |
7305
|
7305
|
if ($reset_scripts && !getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) { |
7306
|
|
- $retstring .= ' <button class="dpInvisibleButtons datenowlink" id="' . $prefix . 'ButtonNow" type="button" name="_useless" value="now" onClick="' . $reset_scripts . '">'; |
|
7306
|
+ $retstring .= ' <button class="dpInvisibleButtons datenowlink" id="'.$prefix.'ButtonNow" type="button" name="_useless" value="now" onClick="'.$reset_scripts.'">'; |
7307
|
7307
|
$retstring .= $langs->trans("Now"); |
7308
|
7308
|
$retstring .= '</button> '; |
7309
|
7309
|
} |
|
@@ -7315,16 +7315,16 @@ discard block |
|
|
block discarded – undo |
7315
|
7315
|
$reset_scripts = ""; |
7316
|
7316
|
|
7317
|
7317
|
// Generate the date part, depending on the use or not of the javascript calendar |
7318
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . '\').val(\'' . dol_print_date($nowgmt, 'dayinputnoreduce', 'tzuserrel') . '\');'; |
7319
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'day\').val(\'' . dol_print_date($nowgmt, '%d', 'tzuserrel') . '\');'; |
7320
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'month\').val(\'' . dol_print_date($nowgmt, '%m', 'tzuserrel') . '\');'; |
7321
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'year\').val(\'' . dol_print_date($nowgmt, '%Y', 'tzuserrel') . '\');'; |
|
7318
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'\').val(\''.dol_print_date($nowgmt, 'dayinputnoreduce', 'tzuserrel').'\');'; |
|
7319
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'day\').val(\''.dol_print_date($nowgmt, '%d', 'tzuserrel').'\');'; |
|
7320
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(\''.dol_print_date($nowgmt, '%m', 'tzuserrel').'\');'; |
|
7321
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(\''.dol_print_date($nowgmt, '%Y', 'tzuserrel').'\');'; |
7322
|
7322
|
// Update the hour part |
7323
|
7323
|
if ($h) { |
7324
|
7324
|
if ($fullday) { |
7325
|
7325
|
$reset_scripts .= " if (jQuery('#fullday:checked').val() == null) {"; |
7326
|
7326
|
} |
7327
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'hour\').val(\'' . dol_print_date($nowgmt, '%H', 'tzuserrel') . '\');'; |
|
7327
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').val(\''.dol_print_date($nowgmt, '%H', 'tzuserrel').'\');'; |
7328
|
7328
|
if ($fullday) { |
7329
|
7329
|
$reset_scripts .= ' } '; |
7330
|
7330
|
} |
|
@@ -7334,14 +7334,14 @@ discard block |
|
|
block discarded – undo |
7334
|
7334
|
if ($fullday) { |
7335
|
7335
|
$reset_scripts .= " if (jQuery('#fullday:checked').val() == null) {"; |
7336
|
7336
|
} |
7337
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'min\').val(\'' . dol_print_date($nowgmt, '%M', 'tzuserrel') . '\');'; |
|
7337
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'min\').val(\''.dol_print_date($nowgmt, '%M', 'tzuserrel').'\');'; |
7338
|
7338
|
if ($fullday) { |
7339
|
7339
|
$reset_scripts .= ' } '; |
7340
|
7340
|
} |
7341
|
7341
|
} |
7342
|
7342
|
// If reset_scripts is not empty, print the link with the reset_scripts in the onClick |
7343
|
7343
|
if ($reset_scripts && empty($conf->dol_optimize_smallscreen)) { |
7344
|
|
- $retstring .= ' <button class="dpInvisibleButtons datenowlink" id="' . $prefix . 'ButtonPlusOne" type="button" name="_useless2" value="plusone" onClick="' . $reset_scripts . '">'; |
|
7344
|
+ $retstring .= ' <button class="dpInvisibleButtons datenowlink" id="'.$prefix.'ButtonPlusOne" type="button" name="_useless2" value="plusone" onClick="'.$reset_scripts.'">'; |
7345
|
7345
|
$retstring .= $langs->trans("DateStartPlusOne"); |
7346
|
7346
|
$retstring .= '</button> '; |
7347
|
7347
|
} |
|
@@ -7399,17 +7399,17 @@ discard block |
|
|
block discarded – undo |
7399
|
7399
|
unset($TDurationTypes[$value]); |
7400
|
7400
|
} |
7401
|
7401
|
|
7402
|
|
- $retstring = '<select class="flat minwidth75 maxwidth100" id="select_' . $prefix . 'type_duration" name="' . $prefix . 'type_duration">'; |
|
7402
|
+ $retstring = '<select class="flat minwidth75 maxwidth100" id="select_'.$prefix.'type_duration" name="'.$prefix.'type_duration">'; |
7403
|
7403
|
foreach ($TDurationTypes as $key => $typeduration) { |
7404
|
|
- $retstring .= '<option value="' . $key . '"'; |
|
7404
|
+ $retstring .= '<option value="'.$key.'"'; |
7405
|
7405
|
if ($key == $selected) { |
7406
|
7406
|
$retstring .= " selected"; |
7407
|
7407
|
} |
7408
|
|
- $retstring .= ">" . $typeduration . "</option>"; |
|
7408
|
+ $retstring .= ">".$typeduration."</option>"; |
7409
|
7409
|
} |
7410
|
7410
|
$retstring .= "</select>"; |
7411
|
7411
|
|
7412
|
|
- $retstring .= ajax_combobox('select_' . $prefix . 'type_duration'); |
|
7412
|
+ $retstring .= ajax_combobox('select_'.$prefix.'type_duration'); |
7413
|
7413
|
|
7414
|
7414
|
return $retstring; |
7415
|
7415
|
} |
|
@@ -7441,30 +7441,30 @@ discard block |
|
|
block discarded – undo |
7441
|
7441
|
|
7442
|
7442
|
// Hours |
7443
|
7443
|
if ($iSecond != '') { |
7444
|
|
- require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php'; |
|
7444
|
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; |
7445
|
7445
|
|
7446
|
7446
|
$hourSelected = convertSecondToTime($iSecond, 'allhour'); |
7447
|
7447
|
$minSelected = convertSecondToTime($iSecond, 'min'); |
7448
|
7448
|
} |
7449
|
7449
|
|
7450
|
7450
|
if ($typehour == 'select') { |
7451
|
|
- $retstring .= '<select class="flat" id="select_' . $prefix . 'hour" name="' . $prefix . 'hour"' . ($disabled ? ' disabled' : '') . '>'; |
|
7451
|
+ $retstring .= '<select class="flat" id="select_'.$prefix.'hour" name="'.$prefix.'hour"'.($disabled ? ' disabled' : '').'>'; |
7452
|
7452
|
for ($hour = 0; $hour < 25; $hour++) { // For a duration, we allow 24 hours |
7453
|
|
- $retstring .= '<option value="' . $hour . '"'; |
|
7453
|
+ $retstring .= '<option value="'.$hour.'"'; |
7454
|
7454
|
if (is_numeric($hourSelected) && $hourSelected == $hour) { |
7455
|
7455
|
$retstring .= " selected"; |
7456
|
7456
|
} |
7457
|
|
- $retstring .= ">" . $hour . "</option>"; |
|
7457
|
+ $retstring .= ">".$hour."</option>"; |
7458
|
7458
|
} |
7459
|
7459
|
$retstring .= "</select>"; |
7460
|
7460
|
} elseif ($typehour == 'text' || $typehour == 'textselect') { |
7461
|
|
- $retstring .= '<input placeholder="' . $langs->trans('HourShort') . '" type="number" min="0" name="' . $prefix . 'hour"' . ($disabled ? ' disabled' : '') . ' class="flat maxwidth50 inputhour right" value="' . (($hourSelected != '') ? ((int) $hourSelected) : '') . '">'; |
|
7461
|
+ $retstring .= '<input placeholder="'.$langs->trans('HourShort').'" type="number" min="0" name="'.$prefix.'hour"'.($disabled ? ' disabled' : '').' class="flat maxwidth50 inputhour right" value="'.(($hourSelected != '') ? ((int) $hourSelected) : '').'">'; |
7462
|
7462
|
} else { |
7463
|
7463
|
return 'BadValueForParameterTypeHour'; |
7464
|
7464
|
} |
7465
|
7465
|
|
7466
|
7466
|
if ($typehour != 'text') { |
7467
|
|
- $retstring .= ' ' . $langs->trans('HourShort'); |
|
7467
|
+ $retstring .= ' '.$langs->trans('HourShort'); |
7468
|
7468
|
} else { |
7469
|
7469
|
$retstring .= '<span class="">:</span>'; |
7470
|
7470
|
} |
|
@@ -7479,21 +7479,21 @@ discard block |
|
|
block discarded – undo |
7479
|
7479
|
} |
7480
|
7480
|
|
7481
|
7481
|
if ($typehour == 'select' || $typehour == 'textselect') { |
7482
|
|
- $retstring .= '<select class="flat" id="select_' . $prefix . 'min" name="' . $prefix . 'min"' . ($disabled ? ' disabled' : '') . '>'; |
|
7482
|
+ $retstring .= '<select class="flat" id="select_'.$prefix.'min" name="'.$prefix.'min"'.($disabled ? ' disabled' : '').'>'; |
7483
|
7483
|
for ($min = 0; $min <= 55; $min += 5) { |
7484
|
|
- $retstring .= '<option value="' . $min . '"'; |
|
7484
|
+ $retstring .= '<option value="'.$min.'"'; |
7485
|
7485
|
if (is_numeric($minSelected) && $minSelected == $min) { |
7486
|
7486
|
$retstring .= ' selected'; |
7487
|
7487
|
} |
7488
|
|
- $retstring .= '>' . $min . '</option>'; |
|
7488
|
+ $retstring .= '>'.$min.'</option>'; |
7489
|
7489
|
} |
7490
|
7490
|
$retstring .= "</select>"; |
7491
|
7491
|
} elseif ($typehour == 'text') { |
7492
|
|
- $retstring .= '<input placeholder="' . $langs->trans('MinuteShort') . '" type="number" min="0" name="' . $prefix . 'min"' . ($disabled ? ' disabled' : '') . ' class="flat maxwidth50 inputminute right" value="' . (($minSelected != '') ? ((int) $minSelected) : '') . '">'; |
|
7492
|
+ $retstring .= '<input placeholder="'.$langs->trans('MinuteShort').'" type="number" min="0" name="'.$prefix.'min"'.($disabled ? ' disabled' : '').' class="flat maxwidth50 inputminute right" value="'.(($minSelected != '') ? ((int) $minSelected) : '').'">'; |
7493
|
7493
|
} |
7494
|
7494
|
|
7495
|
7495
|
if ($typehour != 'text') { |
7496
|
|
- $retstring .= ' ' . $langs->trans('MinuteShort'); |
|
7496
|
+ $retstring .= ' '.$langs->trans('MinuteShort'); |
7497
|
7497
|
} |
7498
|
7498
|
|
7499
|
7499
|
$retstring .= "</span>"; |
|
@@ -7541,7 +7541,7 @@ discard block |
|
|
block discarded – undo |
7541
|
7541
|
$placeholder = ''; |
7542
|
7542
|
|
7543
|
7543
|
if ($selected && empty($selected_input_value)) { |
7544
|
|
- require_once DOL_DOCUMENT_ROOT . '/ticket/class/ticket.class.php'; |
|
7544
|
+ require_once DOL_DOCUMENT_ROOT.'/ticket/class/ticket.class.php'; |
7545
|
7545
|
$tickettmpselect = new Ticket($this->db); |
7546
|
7546
|
$tickettmpselect->fetch($selected); |
7547
|
7547
|
$selected_input_value = $tickettmpselect->ref; |
|
@@ -7549,17 +7549,17 @@ discard block |
|
|
block discarded – undo |
7549
|
7549
|
} |
7550
|
7550
|
|
7551
|
7551
|
$urloption = ''; |
7552
|
|
- $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/ticket/ajax/tickets.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions); |
|
7552
|
+ $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/ticket/ajax/tickets.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions); |
7553
|
7553
|
|
7554
|
7554
|
if (empty($hidelabel)) { |
7555
|
|
- $out .= $langs->trans("RefOrLabel") . ' : '; |
|
7555
|
+ $out .= $langs->trans("RefOrLabel").' : '; |
7556
|
7556
|
} elseif ($hidelabel > 1) { |
7557
|
|
- $placeholder = ' placeholder="' . $langs->trans("RefOrLabel") . '"'; |
|
7557
|
+ $placeholder = ' placeholder="'.$langs->trans("RefOrLabel").'"'; |
7558
|
7558
|
if ($hidelabel == 2) { |
7559
|
7559
|
$out .= img_picto($langs->trans("Search"), 'search'); |
7560
|
7560
|
} |
7561
|
7561
|
} |
7562
|
|
- $out .= '<input type="text" class="minwidth100" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . $placeholder . ' ' . (getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '') . ' />'; |
|
7562
|
+ $out .= '<input type="text" class="minwidth100" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' '.(getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '').' />'; |
7563
|
7563
|
if ($hidelabel == 3) { |
7564
|
7564
|
$out .= img_picto($langs->trans("Search"), 'search'); |
7565
|
7565
|
} |
|
@@ -7603,8 +7603,8 @@ discard block |
|
|
block discarded – undo |
7603
|
7603
|
|
7604
|
7604
|
$sql = "SELECT "; |
7605
|
7605
|
$sql .= $selectFields; |
7606
|
|
- $sql .= " FROM " . $this->db->prefix() . "ticket as p"; |
7607
|
|
- $sql .= ' WHERE p.entity IN (' . getEntity('ticket') . ')'; |
|
7606
|
+ $sql .= " FROM ".$this->db->prefix()."ticket as p"; |
|
7607
|
+ $sql .= ' WHERE p.entity IN ('.getEntity('ticket').')'; |
7608
|
7608
|
|
7609
|
7609
|
// Add criteria on ref/label |
7610
|
7610
|
if ($filterkey != '') { |
|
@@ -7620,7 +7620,7 @@ discard block |
|
|
block discarded – undo |
7620
|
7620
|
if ($i > 0) { |
7621
|
7621
|
$sql .= " AND "; |
7622
|
7622
|
} |
7623
|
|
- $sql .= "(p.ref LIKE '" . $this->db->escape($prefix . $crit) . "%' OR p.subject LIKE '" . $this->db->escape($prefix . $crit) . "%'"; |
|
7623
|
+ $sql .= "(p.ref LIKE '".$this->db->escape($prefix.$crit)."%' OR p.subject LIKE '".$this->db->escape($prefix.$crit)."%'"; |
7624
|
7624
|
$sql .= ")"; |
7625
|
7625
|
$i++; |
7626
|
7626
|
} |
|
@@ -7633,22 +7633,22 @@ discard block |
|
|
block discarded – undo |
7633
|
7633
|
$sql .= $this->db->plimit($limit, 0); |
7634
|
7634
|
|
7635
|
7635
|
// Build output string |
7636
|
|
- dol_syslog(get_class($this) . "::selectTicketsList search tickets", LOG_DEBUG); |
|
7636
|
+ dol_syslog(get_class($this)."::selectTicketsList search tickets", LOG_DEBUG); |
7637
|
7637
|
$result = $this->db->query($sql); |
7638
|
7638
|
if ($result) { |
7639
|
|
- require_once DOL_DOCUMENT_ROOT . '/ticket/class/ticket.class.php'; |
7640
|
|
- require_once DOL_DOCUMENT_ROOT . '/core/lib/ticket.lib.php'; |
|
7639
|
+ require_once DOL_DOCUMENT_ROOT.'/ticket/class/ticket.class.php'; |
|
7640
|
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/ticket.lib.php'; |
7641
|
7641
|
|
7642
|
7642
|
$num = $this->db->num_rows($result); |
7643
|
7643
|
|
7644
|
7644
|
$events = array(); |
7645
|
7645
|
|
7646
|
7646
|
if (!$forcecombo) { |
7647
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
7647
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
7648
|
7648
|
$out .= ajax_combobox($htmlname, $events, $conf->global->TICKET_USE_SEARCH_TO_SELECT); |
7649
|
7649
|
} |
7650
|
7650
|
|
7651
|
|
- $out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">'; |
|
7651
|
+ $out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">'; |
7652
|
7652
|
|
7653
|
7653
|
$textifempty = ''; |
7654
|
7654
|
// Do not use textifempty = ' ' or ' ' here, or search on key will search on ' key'. |
|
@@ -7665,7 +7665,7 @@ discard block |
|
|
block discarded – undo |
7665
|
7665
|
} |
7666
|
7666
|
} |
7667
|
7667
|
if ($showempty) { |
7668
|
|
- $out .= '<option value="0" selected>' . $textifempty . '</option>'; |
|
7668
|
+ $out .= '<option value="0" selected>'.$textifempty.'</option>'; |
7669
|
7669
|
} |
7670
|
7670
|
|
7671
|
7671
|
$i = 0; |
|
@@ -7720,13 +7720,13 @@ discard block |
|
|
block discarded – undo |
7720
|
7720
|
$outref = $objp->ref; |
7721
|
7721
|
$outtype = $objp->fk_product_type; |
7722
|
7722
|
|
7723
|
|
- $opt = '<option value="' . $objp->rowid . '"'; |
|
7723
|
+ $opt = '<option value="'.$objp->rowid.'"'; |
7724
|
7724
|
$opt .= ($objp->rowid == $selected) ? ' selected' : ''; |
7725
|
7725
|
$opt .= '>'; |
7726
|
7726
|
$opt .= $objp->ref; |
7727
|
7727
|
$objRef = $objp->ref; |
7728
|
7728
|
if (!empty($filterkey) && $filterkey != '') { |
7729
|
|
- $objRef = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $objRef, 1); |
|
7729
|
+ $objRef = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $objRef, 1); |
7730
|
7730
|
} |
7731
|
7731
|
|
7732
|
7732
|
$opt .= "</option>\n"; |
|
@@ -7767,7 +7767,7 @@ discard block |
|
|
block discarded – undo |
7767
|
7767
|
$placeholder = ''; |
7768
|
7768
|
|
7769
|
7769
|
if ($selected && empty($selected_input_value)) { |
7770
|
|
- require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; |
|
7770
|
+ require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; |
7771
|
7771
|
$projecttmpselect = new Project($this->db); |
7772
|
7772
|
$projecttmpselect->fetch($selected); |
7773
|
7773
|
$selected_input_value = $projecttmpselect->ref; |
|
@@ -7775,17 +7775,17 @@ discard block |
|
|
block discarded – undo |
7775
|
7775
|
} |
7776
|
7776
|
|
7777
|
7777
|
$urloption = ''; |
7778
|
|
- $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/projet/ajax/projects.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions); |
|
7778
|
+ $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/projet/ajax/projects.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions); |
7779
|
7779
|
|
7780
|
7780
|
if (empty($hidelabel)) { |
7781
|
|
- $out .= $langs->trans("RefOrLabel") . ' : '; |
|
7781
|
+ $out .= $langs->trans("RefOrLabel").' : '; |
7782
|
7782
|
} elseif ($hidelabel > 1) { |
7783
|
|
- $placeholder = ' placeholder="' . $langs->trans("RefOrLabel") . '"'; |
|
7783
|
+ $placeholder = ' placeholder="'.$langs->trans("RefOrLabel").'"'; |
7784
|
7784
|
if ($hidelabel == 2) { |
7785
|
7785
|
$out .= img_picto($langs->trans("Search"), 'search'); |
7786
|
7786
|
} |
7787
|
7787
|
} |
7788
|
|
- $out .= '<input type="text" class="minwidth100" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . $placeholder . ' ' . (getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '') . ' />'; |
|
7788
|
+ $out .= '<input type="text" class="minwidth100" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' '.(getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '').' />'; |
7789
|
7789
|
if ($hidelabel == 3) { |
7790
|
7790
|
$out .= img_picto($langs->trans("Search"), 'search'); |
7791
|
7791
|
} |
|
@@ -7828,8 +7828,8 @@ discard block |
|
|
block discarded – undo |
7828
|
7828
|
|
7829
|
7829
|
$sql = "SELECT "; |
7830
|
7830
|
$sql .= $selectFields; |
7831
|
|
- $sql .= " FROM " . $this->db->prefix() . "projet as p"; |
7832
|
|
- $sql .= ' WHERE p.entity IN (' . getEntity('project') . ')'; |
|
7831
|
+ $sql .= " FROM ".$this->db->prefix()."projet as p"; |
|
7832
|
+ $sql .= ' WHERE p.entity IN ('.getEntity('project').')'; |
7833
|
7833
|
|
7834
|
7834
|
// Add criteria on ref/label |
7835
|
7835
|
if ($filterkey != '') { |
|
@@ -7845,7 +7845,7 @@ discard block |
|
|
block discarded – undo |
7845
|
7845
|
if ($i > 0) { |
7846
|
7846
|
$sql .= " AND "; |
7847
|
7847
|
} |
7848
|
|
- $sql .= "p.ref LIKE '" . $this->db->escape($prefix . $crit) . "%'"; |
|
7848
|
+ $sql .= "p.ref LIKE '".$this->db->escape($prefix.$crit)."%'"; |
7849
|
7849
|
$sql .= ""; |
7850
|
7850
|
$i++; |
7851
|
7851
|
} |
|
@@ -7858,22 +7858,22 @@ discard block |
|
|
block discarded – undo |
7858
|
7858
|
$sql .= $this->db->plimit($limit, 0); |
7859
|
7859
|
|
7860
|
7860
|
// Build output string |
7861
|
|
- dol_syslog(get_class($this) . "::selectProjectsList search projects", LOG_DEBUG); |
|
7861
|
+ dol_syslog(get_class($this)."::selectProjectsList search projects", LOG_DEBUG); |
7862
|
7862
|
$result = $this->db->query($sql); |
7863
|
7863
|
if ($result) { |
7864
|
|
- require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; |
7865
|
|
- require_once DOL_DOCUMENT_ROOT . '/core/lib/project.lib.php'; |
|
7864
|
+ require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; |
|
7865
|
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php'; |
7866
|
7866
|
|
7867
|
7867
|
$num = $this->db->num_rows($result); |
7868
|
7868
|
|
7869
|
7869
|
$events = array(); |
7870
|
7870
|
|
7871
|
7871
|
if (!$forcecombo) { |
7872
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
7872
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
7873
|
7873
|
$out .= ajax_combobox($htmlname, $events, $conf->global->PROJECT_USE_SEARCH_TO_SELECT); |
7874
|
7874
|
} |
7875
|
7875
|
|
7876
|
|
- $out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">'; |
|
7876
|
+ $out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">'; |
7877
|
7877
|
|
7878
|
7878
|
$textifempty = ''; |
7879
|
7879
|
// Do not use textifempty = ' ' or ' ' here, or search on key will search on ' key'. |
|
@@ -7890,7 +7890,7 @@ discard block |
|
|
block discarded – undo |
7890
|
7890
|
} |
7891
|
7891
|
} |
7892
|
7892
|
if ($showempty) { |
7893
|
|
- $out .= '<option value="0" selected>' . $textifempty . '</option>'; |
|
7893
|
+ $out .= '<option value="0" selected>'.$textifempty.'</option>'; |
7894
|
7894
|
} |
7895
|
7895
|
|
7896
|
7896
|
$i = 0; |
|
@@ -7948,13 +7948,13 @@ discard block |
|
|
block discarded – undo |
7948
|
7948
|
$outlabel = $objp->label; |
7949
|
7949
|
$outtype = $objp->fk_product_type; |
7950
|
7950
|
|
7951
|
|
- $opt = '<option value="' . $objp->rowid . '"'; |
|
7951
|
+ $opt = '<option value="'.$objp->rowid.'"'; |
7952
|
7952
|
$opt .= ($objp->rowid == $selected) ? ' selected' : ''; |
7953
|
7953
|
$opt .= '>'; |
7954
|
7954
|
$opt .= $objp->ref; |
7955
|
7955
|
$objRef = $objp->ref; |
7956
|
7956
|
if (!empty($filterkey) && $filterkey != '') { |
7957
|
|
- $objRef = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $objRef, 1); |
|
7957
|
+ $objRef = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $objRef, 1); |
7958
|
7958
|
} |
7959
|
7959
|
|
7960
|
7960
|
$opt .= "</option>\n"; |
|
@@ -7996,7 +7996,7 @@ discard block |
|
|
block discarded – undo |
7996
|
7996
|
$placeholder = ''; |
7997
|
7997
|
|
7998
|
7998
|
if ($selected && empty($selected_input_value)) { |
7999
|
|
- require_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php'; |
|
7999
|
+ require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; |
8000
|
8000
|
$adherenttmpselect = new Adherent($this->db); |
8001
|
8001
|
$adherenttmpselect->fetch($selected); |
8002
|
8002
|
$selected_input_value = $adherenttmpselect->ref; |
|
@@ -8005,17 +8005,17 @@ discard block |
|
|
block discarded – undo |
8005
|
8005
|
|
8006
|
8006
|
$urloption = ''; |
8007
|
8007
|
|
8008
|
|
- $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/adherents/ajax/adherents.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions); |
|
8008
|
+ $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/adherents/ajax/adherents.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions); |
8009
|
8009
|
|
8010
|
8010
|
if (empty($hidelabel)) { |
8011
|
|
- $out .= $langs->trans("RefOrLabel") . ' : '; |
|
8011
|
+ $out .= $langs->trans("RefOrLabel").' : '; |
8012
|
8012
|
} elseif ($hidelabel > 1) { |
8013
|
|
- $placeholder = ' placeholder="' . $langs->trans("RefOrLabel") . '"'; |
|
8013
|
+ $placeholder = ' placeholder="'.$langs->trans("RefOrLabel").'"'; |
8014
|
8014
|
if ($hidelabel == 2) { |
8015
|
8015
|
$out .= img_picto($langs->trans("Search"), 'search'); |
8016
|
8016
|
} |
8017
|
8017
|
} |
8018
|
|
- $out .= '<input type="text" class="minwidth100" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . $placeholder . ' ' . (getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '') . ' />'; |
|
8018
|
+ $out .= '<input type="text" class="minwidth100" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' '.(getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '').' />'; |
8019
|
8019
|
if ($hidelabel == 3) { |
8020
|
8020
|
$out .= img_picto($langs->trans("Search"), 'search'); |
8021
|
8021
|
} |
|
@@ -8060,8 +8060,8 @@ discard block |
|
|
block discarded – undo |
8060
|
8060
|
|
8061
|
8061
|
$sql = "SELECT "; |
8062
|
8062
|
$sql .= $selectFields; |
8063
|
|
- $sql .= " FROM " . $this->db->prefix() . "adherent as p"; |
8064
|
|
- $sql .= ' WHERE p.entity IN (' . getEntity('adherent') . ')'; |
|
8063
|
+ $sql .= " FROM ".$this->db->prefix()."adherent as p"; |
|
8064
|
+ $sql .= ' WHERE p.entity IN ('.getEntity('adherent').')'; |
8065
|
8065
|
|
8066
|
8066
|
// Add criteria on ref/label |
8067
|
8067
|
if ($filterkey != '') { |
|
@@ -8077,8 +8077,8 @@ discard block |
|
|
block discarded – undo |
8077
|
8077
|
if ($i > 0) { |
8078
|
8078
|
$sql .= " AND "; |
8079
|
8079
|
} |
8080
|
|
- $sql .= "(p.firstname LIKE '" . $this->db->escape($prefix . $crit) . "%'"; |
8081
|
|
- $sql .= " OR p.lastname LIKE '" . $this->db->escape($prefix . $crit) . "%')"; |
|
8080
|
+ $sql .= "(p.firstname LIKE '".$this->db->escape($prefix.$crit)."%'"; |
|
8081
|
+ $sql .= " OR p.lastname LIKE '".$this->db->escape($prefix.$crit)."%')"; |
8082
|
8082
|
$i++; |
8083
|
8083
|
} |
8084
|
8084
|
if (count($search_crit) > 1) { |
|
@@ -8087,27 +8087,27 @@ discard block |
|
|
block discarded – undo |
8087
|
8087
|
$sql .= ')'; |
8088
|
8088
|
} |
8089
|
8089
|
if ($status != -1) { |
8090
|
|
- $sql .= ' AND statut = ' . ((int) $status); |
|
8090
|
+ $sql .= ' AND statut = '.((int) $status); |
8091
|
8091
|
} |
8092
|
8092
|
$sql .= $this->db->plimit($limit, 0); |
8093
|
8093
|
|
8094
|
8094
|
// Build output string |
8095
|
|
- dol_syslog(get_class($this) . "::selectMembersList search adherents", LOG_DEBUG); |
|
8095
|
+ dol_syslog(get_class($this)."::selectMembersList search adherents", LOG_DEBUG); |
8096
|
8096
|
$result = $this->db->query($sql); |
8097
|
8097
|
if ($result) { |
8098
|
|
- require_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php'; |
8099
|
|
- require_once DOL_DOCUMENT_ROOT . '/core/lib/member.lib.php'; |
|
8098
|
+ require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; |
|
8099
|
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php'; |
8100
|
8100
|
|
8101
|
8101
|
$num = $this->db->num_rows($result); |
8102
|
8102
|
|
8103
|
8103
|
$events = array(); |
8104
|
8104
|
|
8105
|
8105
|
if (!$forcecombo) { |
8106
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
8106
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
8107
|
8107
|
$out .= ajax_combobox($htmlname, $events, getDolGlobalString('PROJECT_USE_SEARCH_TO_SELECT') ? $conf->global->PROJECT_USE_SEARCH_TO_SELECT : ''); |
8108
|
8108
|
} |
8109
|
8109
|
|
8110
|
|
- $out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">'; |
|
8110
|
+ $out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">'; |
8111
|
8111
|
|
8112
|
8112
|
$textifempty = ''; |
8113
|
8113
|
// Do not use textifempty = ' ' or ' ' here, or search on key will search on ' key'. |
|
@@ -8124,7 +8124,7 @@ discard block |
|
|
block discarded – undo |
8124
|
8124
|
} |
8125
|
8125
|
} |
8126
|
8126
|
if ($showempty) { |
8127
|
|
- $out .= '<option value="-1" selected>' . $textifempty . '</option>'; |
|
8127
|
+ $out .= '<option value="-1" selected>'.$textifempty.'</option>'; |
8128
|
8128
|
} |
8129
|
8129
|
|
8130
|
8130
|
$i = 0; |
|
@@ -8180,11 +8180,11 @@ discard block |
|
|
block discarded – undo |
8180
|
8180
|
$outlabel = dolGetFirstLastname($objp->firstname, $objp->lastname); |
8181
|
8181
|
$outtype = $objp->fk_adherent_type; |
8182
|
8182
|
|
8183
|
|
- $opt = '<option value="' . $objp->rowid . '"'; |
|
8183
|
+ $opt = '<option value="'.$objp->rowid.'"'; |
8184
|
8184
|
$opt .= ($objp->rowid == $selected) ? ' selected' : ''; |
8185
|
8185
|
$opt .= '>'; |
8186
|
8186
|
if (!empty($filterkey) && $filterkey != '') { |
8187
|
|
- $outlabel = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $outlabel, 1); |
|
8187
|
+ $outlabel = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $outlabel, 1); |
8188
|
8188
|
} |
8189
|
8189
|
$opt .= $outlabel; |
8190
|
8190
|
$opt .= "</option>\n"; |
|
@@ -8220,8 +8220,8 @@ discard block |
|
|
block discarded – undo |
8220
|
8220
|
$objecttmp = null; |
8221
|
8221
|
$InfoFieldList = array(); |
8222
|
8222
|
$classname = ''; |
8223
|
|
- $filter = ''; // Ensure filter has value (for static analysis) |
8224
|
|
- $sortfield = ''; // Ensure filter has value (for static analysis) |
|
8223
|
+ $filter = ''; // Ensure filter has value (for static analysis) |
|
8224
|
+ $sortfield = ''; // Ensure filter has value (for static analysis) |
8225
|
8225
|
|
8226
|
8226
|
if ($objectfield) { // We must retrieve the objectdesc from the field or extrafield |
8227
|
8227
|
// Example: $objectfield = 'product:options_package' or 'myobject@mymodule:options_myfield' |
|
@@ -8247,7 +8247,7 @@ discard block |
|
|
block discarded – undo |
8247
|
8247
|
} else { |
8248
|
8248
|
// For a property in ->fields |
8249
|
8249
|
if (array_key_exists($tmparray[1], $objectforfieldstmp->fields)) { |
8250
|
|
- $objectdesc = $objectforfieldstmp->fields[$tmparray[1]]['type']; // should be integer:ObjectClass... |
|
8250
|
+ $objectdesc = $objectforfieldstmp->fields[$tmparray[1]]['type']; // should be integer:ObjectClass... |
8251
|
8251
|
$objectdesc = preg_replace('/^integer[^:]*:/', '', $objectdesc); |
8252
|
8252
|
} |
8253
|
8253
|
} |
|
@@ -8262,9 +8262,9 @@ discard block |
|
|
block discarded – undo |
8262
|
8262
|
$vartmp = (empty($InfoFieldList[3]) ? '' : $InfoFieldList[3]); |
8263
|
8263
|
$reg = array(); |
8264
|
8264
|
if (preg_match('/^.*:(\w*)$/', $vartmp, $reg)) { |
8265
|
|
- $InfoFieldList[4] = $reg[1]; // take the sort field |
|
8265
|
+ $InfoFieldList[4] = $reg[1]; // take the sort field |
8266
|
8266
|
} |
8267
|
|
- $InfoFieldList[3] = preg_replace('/:\w*$/', '', $vartmp); // take the filter field |
|
8267
|
+ $InfoFieldList[3] = preg_replace('/:\w*$/', '', $vartmp); // take the filter field |
8268
|
8268
|
|
8269
|
8269
|
$classname = $InfoFieldList[0]; |
8270
|
8270
|
$classpath = $InfoFieldList[1]; |
|
@@ -8295,8 +8295,8 @@ discard block |
|
|
block discarded – undo |
8295
|
8295
|
); |
8296
|
8296
|
|
8297
|
8297
|
if (!is_object($objecttmp)) { |
8298
|
|
- dol_syslog('selectForForms: Error bad setup of field objectdescorig=' . $objectdescorig.', objectfield='.$objectfield.', objectdesc='.$objectdesc, LOG_WARNING); |
8299
|
|
- return 'selectForForms: Error bad setup of field objectdescorig=' . $objectdescorig.', objectfield='.$objectfield.', objectdesc='.$objectdesc; |
|
8298
|
+ dol_syslog('selectForForms: Error bad setup of field objectdescorig='.$objectdescorig.', objectfield='.$objectfield.', objectdesc='.$objectdesc, LOG_WARNING); |
|
8299
|
+ return 'selectForForms: Error bad setup of field objectdescorig='.$objectdescorig.', objectfield='.$objectfield.', objectdesc='.$objectdesc; |
8300
|
8300
|
} |
8301
|
8301
|
'@phan-var-force CommonObject $objecttmp'; |
8302
|
8302
|
|
|
@@ -8308,9 +8308,9 @@ discard block |
|
|
block discarded – undo |
8308
|
8308
|
if ($prefixforautocompletemode == 'product') { |
8309
|
8309
|
$prefixforautocompletemode = 'produit'; |
8310
|
8310
|
} |
8311
|
|
- $confkeyforautocompletemode = strtoupper($prefixforautocompletemode) . '_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT |
|
8311
|
+ $confkeyforautocompletemode = strtoupper($prefixforautocompletemode).'_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT |
8312
|
8312
|
|
8313
|
|
- dol_syslog(get_class($this) . "::selectForForms filter=" . $filter, LOG_DEBUG); |
|
8313
|
+ dol_syslog(get_class($this)."::selectForForms filter=".$filter, LOG_DEBUG); |
8314
|
8314
|
|
8315
|
8315
|
// Generate the combo HTML component |
8316
|
8316
|
$out = ''; |
|
@@ -8339,13 +8339,13 @@ discard block |
|
|
block discarded – undo |
8339
|
8339
|
} |
8340
|
8340
|
|
8341
|
8341
|
// Set url and param to call to get json of the search results |
8342
|
|
- $urlforajaxcall = DOL_URL_ROOT . '/core/ajax/selectobject.php'; |
8343
|
|
- $urloption = 'htmlname=' . urlencode($htmlname) . '&outjson=1&objectdesc=' . urlencode($objectdescorig) . '&objectfield='.urlencode($objectfield) . ($sortfield ? '&sortfield=' . urlencode($sortfield) : ''); |
|
8342
|
+ $urlforajaxcall = DOL_URL_ROOT.'/core/ajax/selectobject.php'; |
|
8343
|
+ $urloption = 'htmlname='.urlencode($htmlname).'&outjson=1&objectdesc='.urlencode($objectdescorig).'&objectfield='.urlencode($objectfield).($sortfield ? '&sortfield='.urlencode($sortfield) : ''); |
8344
|
8344
|
|
8345
|
8345
|
// Activate the auto complete using ajax call. |
8346
|
8346
|
$out .= ajax_autocompleter($preSelectedValue, $htmlname, $urlforajaxcall, $urloption, getDolGlobalString($confkeyforautocompletemode), 0); |
8347
|
8347
|
$out .= '<!-- force css to be higher than dialog popup --><style type="text/css">.ui-autocomplete { z-index: 1010; }</style>'; |
8348
|
|
- $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) . '"' : '') . ' />'; |
|
8348
|
+ $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).'"' : '').' />'; |
8349
|
8349
|
} else { |
8350
|
8350
|
// Immediate load of table record. |
8351
|
8351
|
$out .= $this->selectForFormsList($objecttmp, $htmlname, $preSelectedValue, $showempty, $searchkey, $placeholder, $morecss, $moreparams, $forcecombo, 0, $disabled, $sortfield, $filter); |
|
@@ -8385,16 +8385,16 @@ discard block |
|
|
block discarded – undo |
8385
|
8385
|
if ($prefixforautocompletemode == 'societe') { |
8386
|
8386
|
$prefixforautocompletemode = 'company'; |
8387
|
8387
|
} |
8388
|
|
- $confkeyforautocompletemode = strtoupper($prefixforautocompletemode) . '_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT |
|
8388
|
+ $confkeyforautocompletemode = strtoupper($prefixforautocompletemode).'_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT |
8389
|
8389
|
|
8390
|
8390
|
if (!empty($objecttmp->fields)) { // For object that declare it, it is better to use declared fields (like societe, contact, ...) |
8391
|
8391
|
$tmpfieldstoshow = ''; |
8392
|
8392
|
foreach ($objecttmp->fields as $key => $val) { |
8393
|
|
- if (! (int) dol_eval($val['enabled'], 1, 1, '1')) { |
|
8393
|
+ if (!(int) dol_eval($val['enabled'], 1, 1, '1')) { |
8394
|
8394
|
continue; |
8395
|
8395
|
} |
8396
|
8396
|
if (!empty($val['showoncombobox'])) { |
8397
|
|
- $tmpfieldstoshow .= ($tmpfieldstoshow ? ',' : '') . 't.' . $key; |
|
8397
|
+ $tmpfieldstoshow .= ($tmpfieldstoshow ? ',' : '').'t.'.$key; |
8398
|
8398
|
} |
8399
|
8399
|
} |
8400
|
8400
|
if ($tmpfieldstoshow) { |
|
@@ -8422,18 +8422,18 @@ discard block |
|
|
block discarded – undo |
8422
|
8422
|
$num = 0; |
8423
|
8423
|
|
8424
|
8424
|
// Search data |
8425
|
|
- $sql = "SELECT t.rowid, " . $fieldstoshow . " FROM " . $this->db->prefix() . $objecttmp->table_element . " as t"; |
|
8425
|
+ $sql = "SELECT t.rowid, ".$fieldstoshow." FROM ".$this->db->prefix().$objecttmp->table_element." as t"; |
8426
|
8426
|
if (!empty($objecttmp->isextrafieldmanaged)) { |
8427
|
|
- $sql .= " LEFT JOIN " . $this->db->prefix() . $objecttmp->table_element . "_extrafields as e ON t.rowid=e.fk_object"; |
|
8427
|
+ $sql .= " LEFT JOIN ".$this->db->prefix().$objecttmp->table_element."_extrafields as e ON t.rowid=e.fk_object"; |
8428
|
8428
|
} |
8429
|
8429
|
if (isset($objecttmp->ismultientitymanaged)) { |
8430
|
8430
|
if (!is_numeric($objecttmp->ismultientitymanaged)) { |
8431
|
8431
|
$tmparray = explode('@', $objecttmp->ismultientitymanaged); |
8432
|
|
- $sql .= " INNER JOIN " . $this->db->prefix() . $tmparray[1] . " as parenttable ON parenttable.rowid = t." . $tmparray[0]; |
|
8432
|
+ $sql .= " INNER JOIN ".$this->db->prefix().$tmparray[1]." as parenttable ON parenttable.rowid = t.".$tmparray[0]; |
8433
|
8433
|
} |
8434
|
8434
|
if ($objecttmp->ismultientitymanaged === 'fk_soc@societe') { |
8435
|
8435
|
if (!$user->hasRight('societe', 'client', 'voir')) { |
8436
|
|
- $sql .= ", " . $this->db->prefix() . "societe_commerciaux as sc"; |
|
8436
|
+ $sql .= ", ".$this->db->prefix()."societe_commerciaux as sc"; |
8437
|
8437
|
} |
8438
|
8438
|
} |
8439
|
8439
|
} |
|
@@ -8453,21 +8453,21 @@ discard block |
|
|
block discarded – undo |
8453
|
8453
|
$sql .= " WHERE 1=1"; |
8454
|
8454
|
if (isset($objecttmp->ismultientitymanaged)) { |
8455
|
8455
|
if ($objecttmp->ismultientitymanaged == 1) { |
8456
|
|
- $sql .= " AND t.entity IN (" . getEntity($objecttmp->table_element) . ")"; |
|
8456
|
+ $sql .= " AND t.entity IN (".getEntity($objecttmp->table_element).")"; |
8457
|
8457
|
} |
8458
|
8458
|
if (!is_numeric($objecttmp->ismultientitymanaged)) { |
8459
|
|
- $sql .= " AND parenttable.entity = t." . $tmparray[0]; |
|
8459
|
+ $sql .= " AND parenttable.entity = t.".$tmparray[0]; |
8460
|
8460
|
} |
8461
|
8461
|
if ($objecttmp->ismultientitymanaged == 1 && !empty($user->socid)) { |
8462
|
8462
|
if ($objecttmp->element == 'societe') { |
8463
|
|
- $sql .= " AND t.rowid = " . ((int) $user->socid); |
|
8463
|
+ $sql .= " AND t.rowid = ".((int) $user->socid); |
8464
|
8464
|
} else { |
8465
|
|
- $sql .= " AND t.fk_soc = " . ((int) $user->socid); |
|
8465
|
+ $sql .= " AND t.fk_soc = ".((int) $user->socid); |
8466
|
8466
|
} |
8467
|
8467
|
} |
8468
|
8468
|
if ($objecttmp->ismultientitymanaged === 'fk_soc@societe') { |
8469
|
8469
|
if (!$user->hasRight('societe', 'client', 'voir')) { |
8470
|
|
- $sql .= " AND t.rowid = sc.fk_soc AND sc.fk_user = " . ((int) $user->id); |
|
8470
|
+ $sql .= " AND t.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id); |
8471
|
8471
|
} |
8472
|
8472
|
} |
8473
|
8473
|
} |
|
@@ -8479,7 +8479,7 @@ discard block |
|
|
block discarded – undo |
8479
|
8479
|
$errormessage = ''; |
8480
|
8480
|
$sql .= forgeSQLFromUniversalSearchCriteria($filter, $errormessage); |
8481
|
8481
|
if ($errormessage) { |
8482
|
|
- return 'Error forging a SQL request from an universal criteria: ' . $errormessage; |
|
8482
|
+ return 'Error forging a SQL request from an universal criteria: '.$errormessage; |
8483
|
8483
|
} |
8484
|
8484
|
} |
8485
|
8485
|
} |
|
@@ -8491,7 +8491,7 @@ discard block |
|
|
block discarded – undo |
8491
|
8491
|
$resql = $this->db->query($sql); |
8492
|
8492
|
if ($resql) { |
8493
|
8493
|
// Construct $out and $outarray |
8494
|
|
- $out .= '<select id="' . $htmlname . '" class="flat minwidth100' . ($morecss ? ' ' . $morecss : '') . '"' . ($disabled ? ' disabled="disabled"' : '') . ($moreparams ? ' ' . $moreparams : '') . ' name="' . $htmlname . '">' . "\n"; |
|
8494
|
+ $out .= '<select id="'.$htmlname.'" class="flat minwidth100'.($morecss ? ' '.$morecss : '').'"'.($disabled ? ' disabled="disabled"' : '').($moreparams ? ' '.$moreparams : '').' name="'.$htmlname.'">'."\n"; |
8495
|
8495
|
|
8496
|
8496
|
// Warning: Do not use textifempty = ' ' or ' ' here, or search on key will search on ' key'. Seems it is no more true with selec2 v4 |
8497
|
8497
|
$textifempty = ' '; |
|
@@ -8505,7 +8505,7 @@ discard block |
|
|
block discarded – undo |
8505
|
8505
|
} |
8506
|
8506
|
} |
8507
|
8507
|
if ($showempty) { |
8508
|
|
- $out .= '<option value="-1">' . $textifempty . '</option>' . "\n"; |
|
8508
|
+ $out .= '<option value="-1">'.$textifempty.'</option>'."\n"; |
8509
|
8509
|
} |
8510
|
8510
|
|
8511
|
8511
|
$num = $this->db->num_rows($resql); |
|
@@ -8528,9 +8528,9 @@ discard block |
|
|
block discarded – undo |
8528
|
8528
|
} |
8529
|
8529
|
if (empty($outputmode)) { |
8530
|
8530
|
if ($preselectedvalue > 0 && $preselectedvalue == $obj->rowid) { |
8531
|
|
- $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>'; |
|
8531
|
+ $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>'; |
8532
|
8532
|
} else { |
8533
|
|
- $out .= '<option value="' . $obj->rowid . '" data-html="' . dol_escape_htmltag($labelhtml, 0, 0, '', 0, 1) . '">' . dol_escape_htmltag($label, 0, 0, '', 0, 1) . '</option>'; |
|
8533
|
+ $out .= '<option value="'.$obj->rowid.'" data-html="'.dol_escape_htmltag($labelhtml, 0, 0, '', 0, 1).'">'.dol_escape_htmltag($label, 0, 0, '', 0, 1).'</option>'; |
8534
|
8534
|
} |
8535
|
8535
|
} else { |
8536
|
8536
|
array_push($outarray, array('key' => $obj->rowid, 'value' => $label, 'label' => $label)); |
|
@@ -8543,10 +8543,10 @@ discard block |
|
|
block discarded – undo |
8543
|
8543
|
} |
8544
|
8544
|
} |
8545
|
8545
|
|
8546
|
|
- $out .= '</select>' . "\n"; |
|
8546
|
+ $out .= '</select>'."\n"; |
8547
|
8547
|
|
8548
|
8548
|
if (!$forcecombo) { |
8549
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
8549
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
8550
|
8550
|
$out .= ajax_combobox($htmlname, array(), getDolGlobalInt($confkeyforautocompletemode, 0)); |
8551
|
8551
|
} |
8552
|
8552
|
} else { |
|
@@ -8610,8 +8610,8 @@ discard block |
|
|
block discarded – undo |
8610
|
8610
|
} |
8611
|
8611
|
} |
8612
|
8612
|
$idname = str_replace(array('[', ']'), array('', ''), $htmlname); |
8613
|
|
- $out .= '<select id="' . preg_replace('/^\./', '', $idname) . '" ' . ($disabled ? 'disabled="disabled" ' : '') . 'class="flat ' . (preg_replace('/^\./', '', $htmlname)) . ($morecss ? ' ' . $morecss : '') . ' selectformat"'; |
8614
|
|
- $out .= ' name="' . preg_replace('/^\./', '', $htmlname) . '" ' . ($moreparam ? $moreparam : ''); |
|
8613
|
+ $out .= '<select id="'.preg_replace('/^\./', '', $idname).'" '.($disabled ? 'disabled="disabled" ' : '').'class="flat '.(preg_replace('/^\./', '', $htmlname)).($morecss ? ' '.$morecss : '').' selectformat"'; |
|
8614
|
+ $out .= ' name="'.preg_replace('/^\./', '', $htmlname).'" '.($moreparam ? $moreparam : ''); |
8615
|
8615
|
$out .= '>'."\n"; |
8616
|
8616
|
|
8617
|
8617
|
if ($show_empty) { |
|
@@ -8622,7 +8622,7 @@ discard block |
|
|
block discarded – undo |
8622
|
8622
|
if (!is_numeric($show_empty)) { |
8623
|
8623
|
$textforempty = $show_empty; |
8624
|
8624
|
} |
8625
|
|
- $out .= '<option class="optiongrey" ' . ($moreparamonempty ? $moreparamonempty . ' ' : '') . 'value="' . (((int) $show_empty) < 0 ? $show_empty : -1) . '"' . ($id == $show_empty ? ' selected' : '') . '>' . $textforempty . '</option>' . "\n"; |
|
8625
|
+ $out .= '<option class="optiongrey" '.($moreparamonempty ? $moreparamonempty.' ' : '').'value="'.(((int) $show_empty) < 0 ? $show_empty : -1).'"'.($id == $show_empty ? ' selected' : '').'>'.$textforempty.'</option>'."\n"; |
8626
|
8626
|
} |
8627
|
8627
|
if (is_array($array)) { |
8628
|
8628
|
// Translate |
|
@@ -8647,7 +8647,7 @@ discard block |
|
|
block discarded – undo |
8647
|
8647
|
$value = $tmpvalue['label']; |
8648
|
8648
|
//$valuehtml = empty($tmpvalue['data-html']) ? $value : $tmpvalue['data-html']; |
8649
|
8649
|
$disabled = empty($tmpvalue['disabled']) ? '' : ' disabled'; |
8650
|
|
- $style = empty($tmpvalue['css']) ? '' : ' class="' . $tmpvalue['css'] . '"'; |
|
8650
|
+ $style = empty($tmpvalue['css']) ? '' : ' class="'.$tmpvalue['css'].'"'; |
8651
|
8651
|
} else { |
8652
|
8652
|
$value = $tmpvalue; |
8653
|
8653
|
//$valuehtml = $tmpvalue; |
|
@@ -8663,9 +8663,9 @@ discard block |
|
|
block discarded – undo |
8663
|
8663
|
} |
8664
|
8664
|
if ($key_in_label) { |
8665
|
8665
|
if (empty($nohtmlescape)) { |
8666
|
|
- $selectOptionValue = dol_escape_htmltag($key . ' - ' . ($maxlen ? dol_trunc($value, $maxlen) : $value)); |
|
8666
|
+ $selectOptionValue = dol_escape_htmltag($key.' - '.($maxlen ? dol_trunc($value, $maxlen) : $value)); |
8667
|
8667
|
} else { |
8668
|
|
- $selectOptionValue = $key . ' - ' . ($maxlen ? dol_trunc($value, $maxlen) : $value); |
|
8668
|
+ $selectOptionValue = $key.' - '.($maxlen ? dol_trunc($value, $maxlen) : $value); |
8669
|
8669
|
} |
8670
|
8670
|
} else { |
8671
|
8671
|
if (empty($nohtmlescape)) { |
|
@@ -8677,8 +8677,8 @@ discard block |
|
|
block discarded – undo |
8677
|
8677
|
$selectOptionValue = ' '; |
8678
|
8678
|
} |
8679
|
8679
|
} |
8680
|
|
- $out .= '<option value="' . $key . '"'; |
8681
|
|
- $out .= $style . $disabled; |
|
8680
|
+ $out .= '<option value="'.$key.'"'; |
|
8681
|
+ $out .= $style.$disabled; |
8682
|
8682
|
if (is_array($id)) { |
8683
|
8683
|
if (in_array($key, $id) && !$disabled) { |
8684
|
8684
|
$out .= ' selected'; // To preselect a value |
|
@@ -8690,7 +8690,7 @@ discard block |
|
|
block discarded – undo |
8690
|
8690
|
} |
8691
|
8691
|
} |
8692
|
8692
|
if (!empty($nohtmlescape)) { // deprecated. Use instead the key 'data-html' into input $array, managed at next step to use HTML content. |
8693
|
|
- $out .= ' data-html="' . dol_escape_htmltag($selectOptionValue) . '"'; |
|
8693
|
+ $out .= ' data-html="'.dol_escape_htmltag($selectOptionValue).'"'; |
8694
|
8694
|
} |
8695
|
8695
|
|
8696
|
8696
|
if (is_array($tmpvalue)) { |
|
@@ -8710,7 +8710,7 @@ discard block |
|
|
block discarded – undo |
8710
|
8710
|
// Add code for jquery to use multiselect |
8711
|
8711
|
if ($addjscombo && $jsbeautify) { |
8712
|
8712
|
// Enhance with select2 |
8713
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
8713
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
8714
|
8714
|
$out .= ajax_combobox($idname, array(), 0, 0, 'resolve', (((int) $show_empty) < 0 ? (string) $show_empty : '-1'), $morecss); |
8715
|
8715
|
} |
8716
|
8716
|
|
|
@@ -8738,28 +8738,28 @@ discard block |
|
|
block discarded – undo |
8738
|
8738
|
public static function selectArrayAjax($htmlname, $url, $id = '', $moreparam = '', $moreparamtourl = '', $disabled = 0, $minimumInputLength = 1, $morecss = '', $callurlonselect = 0, $placeholder = '', $acceptdelayedhtml = 0) |
8739
|
8739
|
{ |
8740
|
8740
|
global $conf, $langs; |
8741
|
|
- global $delayedhtmlcontent; // Will be used later outside of this function |
|
8741
|
+ global $delayedhtmlcontent; // Will be used later outside of this function |
8742
|
8742
|
|
8743
|
8743
|
// TODO Use an internal dolibarr component instead of select2 |
8744
|
8744
|
if (!getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') && !defined('REQUIRE_JQUERY_MULTISELECT')) { |
8745
|
8745
|
return ''; |
8746
|
8746
|
} |
8747
|
8747
|
|
8748
|
|
- $out = '<select type="text" class="' . $htmlname . ($morecss ? ' ' . $morecss : '') . '" ' . ($moreparam ? $moreparam . ' ' : '') . 'name="' . $htmlname . '"></select>'; |
|
8748
|
+ $out = '<select type="text" class="'.$htmlname.($morecss ? ' '.$morecss : '').'" '.($moreparam ? $moreparam.' ' : '').'name="'.$htmlname.'"></select>'; |
8749
|
8749
|
|
8750
|
8750
|
$outdelayed = ''; |
8751
|
8751
|
if (!empty($conf->use_javascript_ajax)) { |
8752
|
8752
|
$tmpplugin = 'select2'; |
8753
|
|
- $outdelayed = "\n" . '<!-- JS CODE TO ENABLE ' . $tmpplugin . ' for id ' . $htmlname . ' --> |
8754
|
|
- <script nonce="' . getNonce() . '"> |
|
8753
|
+ $outdelayed = "\n".'<!-- JS CODE TO ENABLE '.$tmpplugin.' for id '.$htmlname.' --> |
|
8754
|
+ <script nonce="' . getNonce().'"> |
8755
|
8755
|
$(document).ready(function () { |
8756
|
8756
|
|
8757
|
|
- ' . ($callurlonselect ? 'var saveRemoteData = [];' : '') . ' |
|
8757
|
+ ' . ($callurlonselect ? 'var saveRemoteData = [];' : '').' |
8758
|
8758
|
|
8759
|
|
- $(".' . $htmlname . '").select2({ |
|
8759
|
+ $(".' . $htmlname.'").select2({ |
8760
|
8760
|
ajax: { |
8761
|
8761
|
dir: "ltr", |
8762
|
|
- url: "' . $url . '", |
|
8762
|
+ url: "' . $url.'", |
8763
|
8763
|
dataType: \'json\', |
8764
|
8764
|
delay: 250, |
8765
|
8765
|
data: function (params) { |
|
@@ -8786,9 +8786,9 @@ discard block |
|
|
block discarded – undo |
8786
|
8786
|
}, |
8787
|
8787
|
language: select2arrayoflanguage, |
8788
|
8788
|
containerCssClass: \':all:\', /* Line to add class of origin SELECT propagated to the new <span class="select2-selection...> tag */ |
8789
|
|
- placeholder: "' . dol_escape_js($placeholder) . '", |
|
8789
|
+ placeholder: "' . dol_escape_js($placeholder).'", |
8790
|
8790
|
escapeMarkup: function (markup) { return markup; }, // let our custom formatter work |
8791
|
|
- minimumInputLength: ' . ((int) $minimumInputLength) . ', |
|
8791
|
+ minimumInputLength: ' . ((int) $minimumInputLength).', |
8792
|
8792
|
formatResult: function (result, container, query, escapeMarkup) { |
8793
|
8793
|
return escapeMarkup(result.text); |
8794
|
8794
|
}, |
|
@@ -8796,10 +8796,10 @@ discard block |
|
|
block discarded – undo |
8796
|
8796
|
|
8797
|
8797
|
' . ($callurlonselect ? ' |
8798
|
8798
|
/* Code to execute a GET when we select a value */ |
8799
|
|
- $(".' . $htmlname . '").change(function() { |
8800
|
|
- var selected = $(".' . $htmlname . '").val(); |
|
8799
|
+ $(".' . $htmlname.'").change(function() { |
|
8800
|
+ var selected = $(".' . $htmlname.'").val(); |
8801
|
8801
|
console.log("We select in selectArrayAjax the entry "+selected) |
8802
|
|
- $(".' . $htmlname . '").val(""); /* reset visible combo value */ |
|
8802
|
+ $(".' . $htmlname.'").val(""); /* reset visible combo value */ |
8803
|
8803
|
$.each( saveRemoteData, function( key, value ) { |
8804
|
8804
|
if (key == selected) |
8805
|
8805
|
{ |
|
@@ -8807,7 +8807,7 @@ discard block |
|
|
block discarded – undo |
8807
|
8807
|
location.assign(value.url); |
8808
|
8808
|
} |
8809
|
8809
|
}); |
8810
|
|
- });' : '') . ' |
|
8810
|
+ });' : '').' |
8811
|
8811
|
|
8812
|
8812
|
}); |
8813
|
8813
|
</script>'; |
|
@@ -8843,14 +8843,14 @@ discard block |
|
|
block discarded – undo |
8843
|
8843
|
public static function selectArrayFilter($htmlname, $array, $id = '', $moreparam = '', $disableFiltering = 0, $disabled = 0, $minimumInputLength = 1, $morecss = '', $callurlonselect = 0, $placeholder = '', $acceptdelayedhtml = 0, $textfortitle = '') |
8844
|
8844
|
{ |
8845
|
8845
|
global $conf, $langs; |
8846
|
|
- global $delayedhtmlcontent; // Will be used later outside of this function |
|
8846
|
+ global $delayedhtmlcontent; // Will be used later outside of this function |
8847
|
8847
|
|
8848
|
8848
|
// TODO Use an internal dolibarr component instead of select2 |
8849
|
8849
|
if (!getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') && !defined('REQUIRE_JQUERY_MULTISELECT')) { |
8850
|
8850
|
return ''; |
8851
|
8851
|
} |
8852
|
8852
|
|
8853
|
|
- $out = '<select type="text"'.($textfortitle ? ' title="'.dol_escape_htmltag($textfortitle).'"' : '').' id="'.$htmlname.'" class="'.$htmlname.($morecss ? ' ' . $morecss : '').'"'.($moreparam ? ' '.$moreparam : '').' name="'.$htmlname.'"><option></option></select>'; |
|
8853
|
+ $out = '<select type="text"'.($textfortitle ? ' title="'.dol_escape_htmltag($textfortitle).'"' : '').' id="'.$htmlname.'" class="'.$htmlname.($morecss ? ' '.$morecss : '').'"'.($moreparam ? ' '.$moreparam : '').' name="'.$htmlname.'"><option></option></select>'; |
8854
|
8854
|
|
8855
|
8855
|
$formattedarrayresult = array(); |
8856
|
8856
|
|
|
@@ -8865,20 +8865,20 @@ discard block |
|
|
block discarded – undo |
8865
|
8865
|
$outdelayed = ''; |
8866
|
8866
|
if (!empty($conf->use_javascript_ajax)) { |
8867
|
8867
|
$tmpplugin = 'select2'; |
8868
|
|
- $outdelayed = "\n" . '<!-- JS CODE TO ENABLE ' . $tmpplugin . ' for id ' . $htmlname . ' --> |
8869
|
|
- <script nonce="' . getNonce() . '"> |
|
8868
|
+ $outdelayed = "\n".'<!-- JS CODE TO ENABLE '.$tmpplugin.' for id '.$htmlname.' --> |
|
8869
|
+ <script nonce="' . getNonce().'"> |
8870
|
8870
|
$(document).ready(function () { |
8871
|
|
- var data = ' . json_encode($formattedarrayresult) . '; |
|
8871
|
+ var data = ' . json_encode($formattedarrayresult).'; |
8872
|
8872
|
|
8873
|
|
- ' . ($callurlonselect ? 'var saveRemoteData = ' . json_encode($array) . ';' : '') . ' |
|
8873
|
+ ' . ($callurlonselect ? 'var saveRemoteData = '.json_encode($array).';' : '').' |
8874
|
8874
|
|
8875
|
|
- $(".' . $htmlname . '").select2({ |
|
8875
|
+ $(".' . $htmlname.'").select2({ |
8876
|
8876
|
data: data, |
8877
|
8877
|
language: select2arrayoflanguage, |
8878
|
8878
|
containerCssClass: \':all:\', /* Line to add class of origin SELECT propagated to the new <span class="select2-selection...> tag */ |
8879
|
|
- placeholder: "' . dol_escape_js($placeholder) . '", |
|
8879
|
+ placeholder: "' . dol_escape_js($placeholder).'", |
8880
|
8880
|
escapeMarkup: function (markup) { return markup; }, // let our custom formatter work |
8881
|
|
- minimumInputLength: ' . $minimumInputLength . ', |
|
8881
|
+ minimumInputLength: ' . $minimumInputLength.', |
8882
|
8882
|
formatResult: function (result, container, query, escapeMarkup) { |
8883
|
8883
|
return escapeMarkup(result.text); |
8884
|
8884
|
}, |
|
@@ -8917,11 +8917,11 @@ discard block |
|
|
block discarded – undo |
8917
|
8917
|
|
8918
|
8918
|
' . ($callurlonselect ? ' |
8919
|
8919
|
/* Code to execute a GET when we select a value */ |
8920
|
|
- $(".' . $htmlname . '").change(function() { |
8921
|
|
- var selected = $(".' . $htmlname . '").val(); |
|
8920
|
+ $(".' . $htmlname.'").change(function() { |
|
8921
|
+ var selected = $(".' . $htmlname.'").val(); |
8922
|
8922
|
console.log("We select "+selected) |
8923
|
8923
|
|
8924
|
|
- $(".' . $htmlname . '").val(""); /* reset visible combo value */ |
|
8924
|
+ $(".' . $htmlname.'").val(""); /* reset visible combo value */ |
8925
|
8925
|
$.each( saveRemoteData, function( key, value ) { |
8926
|
8926
|
if (key == selected) |
8927
|
8927
|
{ |
|
@@ -8929,7 +8929,7 @@ discard block |
|
|
block discarded – undo |
8929
|
8929
|
location.assign(value.url); |
8930
|
8930
|
} |
8931
|
8931
|
}); |
8932
|
|
- });' : '') . ' |
|
8932
|
+ });' : '').' |
8933
|
8933
|
|
8934
|
8934
|
}); |
8935
|
8935
|
</script>'; |
|
@@ -8978,7 +8978,7 @@ discard block |
|
|
block discarded – undo |
8978
|
8978
|
$useenhancedmultiselect = 0; |
8979
|
8979
|
if (!empty($conf->use_javascript_ajax) && !defined('MAIN_DO_NOT_USE_JQUERY_MULTISELECT') && (getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') || defined('REQUIRE_JQUERY_MULTISELECT'))) { |
8980
|
8980
|
if ($addjscombo) { |
8981
|
|
- $useenhancedmultiselect = 1; // Use the js multiselect in one line. Possible only if $addjscombo not 0. |
|
8981
|
+ $useenhancedmultiselect = 1; // Use the js multiselect in one line. Possible only if $addjscombo not 0. |
8982
|
8982
|
} |
8983
|
8983
|
} |
8984
|
8984
|
|
|
@@ -8987,7 +8987,7 @@ discard block |
|
|
block discarded – undo |
8987
|
8987
|
// submitted to nothing. |
8988
|
8988
|
$out .= '<input type="hidden" name="'.$htmlname.'_multiselect" value="1">'; |
8989
|
8989
|
// Output select component |
8990
|
|
- $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"; |
|
8990
|
+ $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"; |
8991
|
8991
|
if (is_array($array) && !empty($array)) { |
8992
|
8992
|
if ($value_as_key) { |
8993
|
8993
|
$array = array_combine($array, $array); |
|
@@ -9008,33 +9008,33 @@ discard block |
|
|
block discarded – undo |
9008
|
9008
|
$tmplabelhtml = empty($value['labelhtml']) ? '' : $value['labelhtml']; |
9009
|
9009
|
} |
9010
|
9010
|
$newval = ($translate ? $langs->trans($tmpvalue) : $tmpvalue); |
9011
|
|
- $newval = ($key_in_label ? $tmpkey . ' - ' . $newval : $newval); |
|
9011
|
+ $newval = ($key_in_label ? $tmpkey.' - '.$newval : $newval); |
9012
|
9012
|
|
9013
|
|
- $out .= '<option value="' . $tmpkey . '"'; |
|
9013
|
+ $out .= '<option value="'.$tmpkey.'"'; |
9014
|
9014
|
if (is_array($selected) && !empty($selected) && in_array((string) $tmpkey, $selected) && ((string) $tmpkey != '')) { |
9015
|
9015
|
$out .= ' selected'; |
9016
|
9016
|
} |
9017
|
9017
|
if (!empty($tmplabelhtml)) { |
9018
|
|
- $out .= ' data-html="' . dol_escape_htmltag($tmplabelhtml, 0, 0, '', 0, 1) . '"'; |
|
9018
|
+ $out .= ' data-html="'.dol_escape_htmltag($tmplabelhtml, 0, 0, '', 0, 1).'"'; |
9019
|
9019
|
} else { |
9020
|
|
- $tmplabelhtml = ($tmppicto ? img_picto('', $tmppicto, 'class="pictofixedwidth" style="color: #' . $tmpcolor . '"') : '') . $newval; |
9021
|
|
- $out .= ' data-html="' . dol_escape_htmltag($tmplabelhtml, 0, 0, '', 0, 1) . '"'; |
|
9020
|
+ $tmplabelhtml = ($tmppicto ? img_picto('', $tmppicto, 'class="pictofixedwidth" style="color: #'.$tmpcolor.'"') : '').$newval; |
|
9021
|
+ $out .= ' data-html="'.dol_escape_htmltag($tmplabelhtml, 0, 0, '', 0, 1).'"'; |
9022
|
9022
|
} |
9023
|
9023
|
$out .= '>'; |
9024
|
9024
|
$out .= dol_htmlentitiesbr($newval); |
9025
|
|
- $out .= '</option>' . "\n"; |
|
9025
|
+ $out .= '</option>'."\n"; |
9026
|
9026
|
} |
9027
|
9027
|
} |
9028
|
9028
|
} |
9029
|
|
- $out .= '</select>' . "\n"; |
|
9029
|
+ $out .= '</select>'."\n"; |
9030
|
9030
|
|
9031
|
9031
|
// Add code for jquery to use multiselect |
9032
|
9032
|
if (!empty($conf->use_javascript_ajax) && getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') || defined('REQUIRE_JQUERY_MULTISELECT')) { |
9033
|
|
- $out .= "\n" . '<!-- JS CODE TO ENABLE select for id ' . $htmlname . ', addjscombo=' . $addjscombo . ' -->'; |
9034
|
|
- $out .= "\n" . '<script nonce="' . getNonce() . '">' . "\n"; |
|
9033
|
+ $out .= "\n".'<!-- JS CODE TO ENABLE select for id '.$htmlname.', addjscombo='.$addjscombo.' -->'; |
|
9034
|
+ $out .= "\n".'<script nonce="'.getNonce().'">'."\n"; |
9035
|
9035
|
if ($addjscombo == 1) { |
9036
|
9036
|
$tmpplugin = !getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') ? constant('REQUIRE_JQUERY_MULTISELECT') : $conf->global->MAIN_USE_JQUERY_MULTISELECT; |
9037
|
|
- $out .= 'function formatResult(record, container) {' . "\n"; |
|
9037
|
+ $out .= 'function formatResult(record, container) {'."\n"; |
9038
|
9038
|
// If property data-html set, we decode html entities and use this. |
9039
|
9039
|
// Note that HTML content must have been sanitized from js with dol_escape_htmltag(xxx, 0, 0, '', 0, 1) when building the select option. |
9040
|
9040
|
$out .= ' if ($(record.element).attr("data-html") != undefined && typeof htmlEntityDecodeJs === "function") {'; |
|
@@ -9042,26 +9042,26 @@ discard block |
|
|
block discarded – undo |
9042
|
9042
|
$out .= ' return htmlEntityDecodeJs($(record.element).attr("data-html"));'; |
9043
|
9043
|
$out .= ' }'."\n"; |
9044
|
9044
|
$out .= ' return record.text;'; |
9045
|
|
- $out .= '}' . "\n"; |
9046
|
|
- $out .= 'function formatSelection(record) {' . "\n"; |
|
9045
|
+ $out .= '}'."\n"; |
|
9046
|
+ $out .= 'function formatSelection(record) {'."\n"; |
9047
|
9047
|
if ($elemtype == 'category') { |
9048
|
|
- $out .= 'return \'<span><img src="' . DOL_URL_ROOT . '/theme/eldy/img/object_category.png"> \'+record.text+\'</span>\';'; |
|
9048
|
+ $out .= 'return \'<span><img src="'.DOL_URL_ROOT.'/theme/eldy/img/object_category.png"> \'+record.text+\'</span>\';'; |
9049
|
9049
|
} else { |
9050
|
9050
|
$out .= 'return record.text;'; |
9051
|
9051
|
} |
9052
|
|
- $out .= '}' . "\n"; |
|
9052
|
+ $out .= '}'."\n"; |
9053
|
9053
|
$out .= '$(document).ready(function () { |
9054
|
|
- $(\'#' . $htmlname . '\').' . $tmpplugin . '({'; |
|
9054
|
+ $(\'#' . $htmlname.'\').'.$tmpplugin.'({'; |
9055
|
9055
|
if ($placeholder) { |
9056
|
9056
|
$out .= ' |
9057
|
9057
|
placeholder: { |
9058
|
9058
|
id: \'-1\', |
9059
|
|
- text: \'' . dol_escape_js($placeholder) . '\' |
|
9059
|
+ text: \'' . dol_escape_js($placeholder).'\' |
9060
|
9060
|
},'; |
9061
|
9061
|
} |
9062
|
9062
|
$out .= ' dir: \'ltr\', |
9063
|
9063
|
containerCssClass: \':all:\', /* Line to add class of origin SELECT propagated to the new <span class="select2-selection...> tag (ko with multiselect) */ |
9064
|
|
- dropdownCssClass: \'' . $morecss . '\', /* Line to add class on the new <span class="select2-selection...> tag (ok with multiselect). Need full version of select2. */ |
|
9064
|
+ dropdownCssClass: \'' . $morecss.'\', /* Line to add class on the new <span class="select2-selection...> tag (ok with multiselect). Need full version of select2. */ |
9065
|
9065
|
// Specify format function for dropdown item |
9066
|
9066
|
formatResult: formatResult, |
9067
|
9067
|
templateResult: formatResult, /* For 4.0 */ |
|
@@ -9073,21 +9073,21 @@ discard block |
|
|
block discarded – undo |
9073
|
9073
|
|
9074
|
9074
|
/* Add also morecss to the css .select2 that is after the #htmlname, for component that are show dynamically after load, because select2 set |
9075
|
9075
|
the size only if component is not hidden by default on load */ |
9076
|
|
- $(\'#' . $htmlname . ' + .select2\').addClass(\'' . $morecss . '\'); |
|
9076
|
+ $(\'#' . $htmlname.' + .select2\').addClass(\''.$morecss.'\'); |
9077
|
9077
|
});' . "\n"; |
9078
|
9078
|
} elseif ($addjscombo == 2 && !defined('DISABLE_MULTISELECT')) { |
9079
|
9079
|
// Add other js lib |
9080
|
9080
|
// TODO external lib multiselect/jquery.multi-select.js must have been loaded to use this multiselect plugin |
9081
|
9081
|
// ... |
9082
|
|
- $out .= 'console.log(\'addjscombo=2 for htmlname=' . $htmlname . '\');'; |
|
9082
|
+ $out .= 'console.log(\'addjscombo=2 for htmlname='.$htmlname.'\');'; |
9083
|
9083
|
$out .= '$(document).ready(function () { |
9084
|
|
- $(\'#' . $htmlname . '\').multiSelect({ |
|
9084
|
+ $(\'#' . $htmlname.'\').multiSelect({ |
9085
|
9085
|
containerHTML: \'<div class="multi-select-container">\', |
9086
|
9086
|
menuHTML: \'<div class="multi-select-menu">\', |
9087
|
|
- buttonHTML: \'<span class="multi-select-button ' . $morecss . '">\', |
|
9087
|
+ buttonHTML: \'<span class="multi-select-button ' . $morecss.'">\', |
9088
|
9088
|
menuItemHTML: \'<label class="multi-select-menuitem">\', |
9089
|
9089
|
activeClass: \'multi-select-container--open\', |
9090
|
|
- noneText: \'' . $placeholder . '\' |
|
9090
|
+ noneText: \'' . $placeholder.'\' |
9091
|
9091
|
}); |
9092
|
9092
|
})'; |
9093
|
9093
|
} |
|
@@ -9120,7 +9120,7 @@ discard block |
|
|
block discarded – undo |
9120
|
9120
|
return ''; |
9121
|
9121
|
} |
9122
|
9122
|
|
9123
|
|
- $tmpvar = "MAIN_SELECTEDFIELDS_" . $varpage; // To get list of saved selected fields to show |
|
9123
|
+ $tmpvar = "MAIN_SELECTEDFIELDS_".$varpage; // To get list of saved selected fields to show |
9124
|
9124
|
|
9125
|
9125
|
if (!empty($user->conf->$tmpvar)) { // A list of fields was already customized for user |
9126
|
9126
|
$tmparray = explode(',', $user->conf->$tmpvar); |
|
@@ -9163,19 +9163,19 @@ discard block |
|
|
block discarded – undo |
9163
|
9163
|
} |
9164
|
9164
|
|
9165
|
9165
|
// Note: $val['checked'] <> 0 means we must show the field into the combo list @phan-suppress-next-line PhanTypePossiblyInvalidDimOffset |
9166
|
|
- $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>'; |
9167
|
|
- $listcheckedstring .= (empty($val['checked']) ? '' : $key . ','); |
|
9166
|
+ $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>'; |
|
9167
|
+ $listcheckedstring .= (empty($val['checked']) ? '' : $key.','); |
9168
|
9168
|
} |
9169
|
9169
|
} |
9170
|
9170
|
|
9171
|
|
- $out = '<!-- Component multiSelectArrayWithCheckbox ' . $htmlname . ' --> |
|
9171
|
+ $out = '<!-- Component multiSelectArrayWithCheckbox '.$htmlname.' --> |
9172
|
9172
|
|
9173
|
9173
|
<dl class="dropdown"> |
9174
|
9174
|
<dt> |
9175
|
|
- <a href="#' . $htmlname . '"> |
9176
|
|
- ' . img_picto('', 'list') . ' |
|
9175
|
+ <a href="#' . $htmlname.'"> |
|
9176
|
+ ' . img_picto('', 'list').' |
9177
|
9177
|
</a> |
9178
|
|
- <input type="hidden" class="' . $htmlname . '" name="' . $htmlname . '" value="' . $listcheckedstring . '"> |
|
9178
|
+ <input type="hidden" class="' . $htmlname.'" name="'.$htmlname.'" value="'.$listcheckedstring.'"> |
9179
|
9179
|
</dt> |
9180
|
9180
|
<dd class="dropdowndd"> |
9181
|
9181
|
<div class="multiselectcheckbox'.$htmlname.'"> |
|
@@ -9187,19 +9187,19 @@ discard block |
|
|
block discarded – undo |
9187
|
9187
|
</dd> |
9188
|
9188
|
</dl> |
9189
|
9189
|
|
9190
|
|
- <script nonce="' . getNonce() . '" type="text/javascript"> |
|
9190
|
+ <script nonce="' . getNonce().'" type="text/javascript"> |
9191
|
9191
|
jQuery(document).ready(function () { |
9192
|
|
- $(\'.multiselectcheckbox' . $htmlname . ' input[type="checkbox"]\').on(\'click\', function () { |
|
9192
|
+ $(\'.multiselectcheckbox' . $htmlname.' input[type="checkbox"]\').on(\'click\', function () { |
9193
|
9193
|
console.log("A new field was added/removed, we edit field input[name=formfilteraction]"); |
9194
|
9194
|
|
9195
|
9195
|
$("input:hidden[name=formfilteraction]").val(\'listafterchangingselectedfields\'); // Update field so we know we changed something on selected fields after POST |
9196
|
9196
|
|
9197
|
9197
|
var title = $(this).val() + ","; |
9198
|
9198
|
if ($(this).is(\':checked\')) { |
9199
|
|
- $(\'.' . $htmlname . '\').val(title + $(\'.' . $htmlname . '\').val()); |
|
9199
|
+ $(\'.' . $htmlname.'\').val(title + $(\'.'.$htmlname.'\').val()); |
9200
|
9200
|
} |
9201
|
9201
|
else { |
9202
|
|
- $(\'.' . $htmlname . '\').val( $(\'.' . $htmlname . '\').val().replace(title, \'\') ) |
|
9202
|
+ $(\'.' . $htmlname.'\').val( $(\'.'.$htmlname.'\').val().replace(title, \'\') ) |
9203
|
9203
|
} |
9204
|
9204
|
// Now, we submit page |
9205
|
9205
|
//$(this).parents(\'form:first\').submit(); |
|
@@ -9230,7 +9230,7 @@ discard block |
|
|
block discarded – undo |
9230
|
9230
|
*/ |
9231
|
9231
|
public function showCategories($id, $type, $rendermode = 0, $nolink = 0) |
9232
|
9232
|
{ |
9233
|
|
- include_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; |
|
9233
|
+ include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; |
9234
|
9234
|
|
9235
|
9235
|
$cat = new Categorie($this->db); |
9236
|
9236
|
$categories = $cat->containing($id, $type); |
|
@@ -9240,10 +9240,10 @@ discard block |
|
|
block discarded – undo |
9240
|
9240
|
foreach ($categories as $c) { |
9241
|
9241
|
$ways = $c->print_all_ways(' >> ', ($nolink ? 'none' : ''), 0, 1); // $ways[0] = "ccc2 >> ccc2a >> ccc2a1" with html formatted text |
9242
|
9242
|
foreach ($ways as $way) { |
9243
|
|
- $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"' . ($c->color ? ' style="background: #' . $c->color . ';"' : ' style="background: #bbb"') . '>' . $way . '</li>'; |
|
9243
|
+ $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"'.($c->color ? ' style="background: #'.$c->color.';"' : ' style="background: #bbb"').'>'.$way.'</li>'; |
9244
|
9244
|
} |
9245
|
9245
|
} |
9246
|
|
- return '<div class="select2-container-multi-dolibarr"><ul class="select2-choices-dolibarr">' . implode(' ', $toprint) . '</ul></div>'; |
|
9246
|
+ return '<div class="select2-container-multi-dolibarr"><ul class="select2-choices-dolibarr">'.implode(' ', $toprint).'</ul></div>'; |
9247
|
9247
|
} |
9248
|
9248
|
|
9249
|
9249
|
if ($rendermode == 0) { |
|
@@ -9291,15 +9291,15 @@ discard block |
|
|
block discarded – undo |
9291
|
9291
|
|
9292
|
9292
|
|
9293
|
9293
|
print '<div class="div-table-responsive-no-min">'; |
9294
|
|
- print '<table class="noborder allwidth" data-block="showLinkedObject" data-element="' . $object->element . '" data-elementid="' . $object->id . '" >'; |
|
9294
|
+ print '<table class="noborder allwidth" data-block="showLinkedObject" data-element="'.$object->element.'" data-elementid="'.$object->id.'" >'; |
9295
|
9295
|
|
9296
|
9296
|
print '<tr class="liste_titre">'; |
9297
|
|
- print '<td>' . $langs->trans("Type") . '</td>'; |
9298
|
|
- print '<td>' . $langs->trans("Ref") . '</td>'; |
|
9297
|
+ print '<td>'.$langs->trans("Type").'</td>'; |
|
9298
|
+ print '<td>'.$langs->trans("Ref").'</td>'; |
9299
|
9299
|
print '<td class="center"></td>'; |
9300
|
|
- print '<td class="center">' . $langs->trans("Date") . '</td>'; |
9301
|
|
- print '<td class="right">' . $langs->trans("AmountHTShort") . '</td>'; |
9302
|
|
- print '<td class="right">' . $langs->trans("Status") . '</td>'; |
|
9300
|
+ print '<td class="center">'.$langs->trans("Date").'</td>'; |
|
9301
|
+ print '<td class="right">'.$langs->trans("AmountHTShort").'</td>'; |
|
9302
|
+ print '<td class="right">'.$langs->trans("Status").'</td>'; |
9303
|
9303
|
print '<td></td>'; |
9304
|
9304
|
print '</tr>'; |
9305
|
9305
|
|
|
@@ -9318,13 +9318,13 @@ discard block |
|
|
block discarded – undo |
9318
|
9318
|
if ($objecttype != 'supplier_proposal' && preg_match('/^([^_]+)_([^_]+)/i', $objecttype, $regs)) { |
9319
|
9319
|
$element = $regs[1]; |
9320
|
9320
|
$subelement = $regs[2]; |
9321
|
|
- $tplpath = $element . '/' . $subelement; |
|
9321
|
+ $tplpath = $element.'/'.$subelement; |
9322
|
9322
|
} |
9323
|
9323
|
$tplname = 'linkedobjectblock'; |
9324
|
9324
|
|
9325
|
9325
|
// To work with non standard path |
9326
|
9326
|
if ($objecttype == 'facture') { |
9327
|
|
- $tplpath = 'compta/' . $element; |
|
9327
|
+ $tplpath = 'compta/'.$element; |
9328
|
9328
|
if (!isModEnabled('invoice')) { |
9329
|
9329
|
continue; // Do not show if module disabled |
9330
|
9330
|
} |
|
@@ -9335,7 +9335,7 @@ discard block |
|
|
block discarded – undo |
9335
|
9335
|
continue; // Do not show if module disabled |
9336
|
9336
|
} |
9337
|
9337
|
} elseif ($objecttype == 'propal') { |
9338
|
|
- $tplpath = 'comm/' . $element; |
|
9338
|
+ $tplpath = 'comm/'.$element; |
9339
|
9339
|
if (!isModEnabled('propal')) { |
9340
|
9340
|
continue; // Do not show if module disabled |
9341
|
9341
|
} |
|
@@ -9386,7 +9386,7 @@ discard block |
|
|
block discarded – undo |
9386
|
9386
|
$linkedObjectBlock = $objects; |
9387
|
9387
|
|
9388
|
9388
|
// Output template part (modules that overwrite templates must declare this into descriptor) |
9389
|
|
- $dirtpls = array_merge($conf->modules_parts['tpl'], array('/' . $tplpath . '/tpl')); |
|
9389
|
+ $dirtpls = array_merge($conf->modules_parts['tpl'], array('/'.$tplpath.'/tpl')); |
9390
|
9390
|
foreach ($dirtpls as $reldir) { |
9391
|
9391
|
$reldir = rtrim($reldir, '/'); |
9392
|
9392
|
if ($nboftypesoutput == ($nbofdifferenttypes - 1)) { // No more type to show after |
|
@@ -9394,7 +9394,7 @@ discard block |
|
|
block discarded – undo |
9394
|
9394
|
$noMoreLinkedObjectBlockAfter = 1; |
9395
|
9395
|
} |
9396
|
9396
|
|
9397
|
|
- $res = @include dol_buildpath($reldir . '/' . $tplname . '.tpl.php'); |
|
9397
|
+ $res = @include dol_buildpath($reldir.'/'.$tplname.'.tpl.php'); |
9398
|
9398
|
if ($res) { |
9399
|
9399
|
$nboftypesoutput++; |
9400
|
9400
|
break; |
|
@@ -9403,7 +9403,7 @@ discard block |
|
|
block discarded – undo |
9403
|
9403
|
} |
9404
|
9404
|
|
9405
|
9405
|
if (!$nboftypesoutput) { |
9406
|
|
- print '<tr><td class="impair" colspan="7"><span class="opacitymedium">' . $langs->trans("None") . '</span></td></tr>'; |
|
9406
|
+ print '<tr><td class="impair" colspan="7"><span class="opacitymedium">'.$langs->trans("None").'</span></td></tr>'; |
9407
|
9407
|
} |
9408
|
9408
|
|
9409
|
9409
|
print '</table>'; |
|
@@ -9443,14 +9443,14 @@ discard block |
|
|
block discarded – undo |
9443
|
9443
|
if (is_object($object->thirdparty) && !empty($object->thirdparty->id) && $object->thirdparty->id > 0) { |
9444
|
9444
|
$listofidcompanytoscan = $object->thirdparty->id; |
9445
|
9445
|
if (($object->thirdparty->parent > 0) && getDolGlobalString('THIRDPARTY_INCLUDE_PARENT_IN_LINKTO')) { |
9446
|
|
- $listofidcompanytoscan .= ',' . $object->thirdparty->parent; |
|
9446
|
+ $listofidcompanytoscan .= ','.$object->thirdparty->parent; |
9447
|
9447
|
} |
9448
|
9448
|
if (($object->fk_project > 0) && getDolGlobalString('THIRDPARTY_INCLUDE_PROJECT_THIRDPARY_IN_LINKTO')) { |
9449
|
|
- include_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; |
|
9449
|
+ include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; |
9450
|
9450
|
$tmpproject = new Project($this->db); |
9451
|
9451
|
$tmpproject->fetch($object->fk_project); |
9452
|
9452
|
if ($tmpproject->socid > 0 && ($tmpproject->socid != $object->thirdparty->id)) { |
9453
|
|
- $listofidcompanytoscan .= ',' . $tmpproject->socid; |
|
9453
|
+ $listofidcompanytoscan .= ','.$tmpproject->socid; |
9454
|
9454
|
} |
9455
|
9455
|
unset($tmpproject); |
9456
|
9456
|
} |
|
@@ -9460,63 +9460,63 @@ discard block |
|
|
block discarded – undo |
9460
|
9460
|
'enabled' => isModEnabled('propal'), |
9461
|
9461
|
'perms' => 1, |
9462
|
9462
|
'label' => 'LinkToProposal', |
9463
|
|
- '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') . ')'), |
|
9463
|
+ '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').')'), |
9464
|
9464
|
'shipping' => array( |
9465
|
9465
|
'enabled' => isModEnabled('shipping'), |
9466
|
9466
|
'perms' => 1, |
9467
|
9467
|
'label' => 'LinkToExpedition', |
9468
|
|
- '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') . ')'), |
|
9468
|
+ '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').')'), |
9469
|
9469
|
'order' => array( |
9470
|
9470
|
'enabled' => isModEnabled('order'), |
9471
|
9471
|
'perms' => 1, |
9472
|
9472
|
'label' => 'LinkToOrder', |
9473
|
|
- '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') . ')'), |
|
9473
|
+ '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').')'), |
9474
|
9474
|
'invoice' => array( |
9475
|
9475
|
'enabled' => isModEnabled('invoice'), |
9476
|
9476
|
'perms' => 1, |
9477
|
9477
|
'label' => 'LinkToInvoice', |
9478
|
|
- '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') . ')'), |
|
9478
|
+ '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').')'), |
9479
|
9479
|
'invoice_template' => array( |
9480
|
9480
|
'enabled' => isModEnabled('invoice'), |
9481
|
9481
|
'perms' => 1, |
9482
|
9482
|
'label' => 'LinkToTemplateInvoice', |
9483
|
|
- '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') . ')'), |
|
9483
|
+ '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').')'), |
9484
|
9484
|
'contrat' => array( |
9485
|
9485
|
'enabled' => isModEnabled('contract'), |
9486
|
9486
|
'perms' => 1, |
9487
|
9487
|
'label' => 'LinkToContract', |
9488
|
9488
|
'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 |
9489
|
|
- 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' |
|
9489
|
+ 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' |
9490
|
9490
|
), |
9491
|
9491
|
'fichinter' => array( |
9492
|
9492
|
'enabled' => isModEnabled('intervention'), |
9493
|
9493
|
'perms' => 1, |
9494
|
9494
|
'label' => 'LinkToIntervention', |
9495
|
|
- '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') . ')'), |
|
9495
|
+ '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').')'), |
9496
|
9496
|
'supplier_proposal' => array( |
9497
|
9497
|
'enabled' => isModEnabled('supplier_proposal'), |
9498
|
9498
|
'perms' => 1, |
9499
|
9499
|
'label' => 'LinkToSupplierProposal', |
9500
|
|
- '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') . ')'), |
|
9500
|
+ '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').')'), |
9501
|
9501
|
'order_supplier' => array( |
9502
|
9502
|
'enabled' => isModEnabled("supplier_order"), |
9503
|
9503
|
'perms' => 1, |
9504
|
9504
|
'label' => 'LinkToSupplierOrder', |
9505
|
|
- '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') . ')'), |
|
9505
|
+ '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').')'), |
9506
|
9506
|
'invoice_supplier' => array( |
9507
|
9507
|
'enabled' => isModEnabled("supplier_invoice"), |
9508
|
9508
|
'perms' => 1, 'label' => 'LinkToSupplierInvoice', |
9509
|
|
- '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') . ')'), |
|
9509
|
+ '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').')'), |
9510
|
9510
|
'ticket' => array( |
9511
|
9511
|
'enabled' => isModEnabled('ticket'), |
9512
|
9512
|
'perms' => 1, |
9513
|
9513
|
'label' => 'LinkToTicket', |
9514
|
|
- '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') . ')'), |
|
9514
|
+ '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').')'), |
9515
|
9515
|
'mo' => array( |
9516
|
9516
|
'enabled' => isModEnabled('mrp'), |
9517
|
9517
|
'perms' => 1, |
9518
|
9518
|
'label' => 'LinkToMo', |
9519
|
|
- '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') . ')') |
|
9519
|
+ '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').')') |
9520
|
9520
|
); |
9521
|
9521
|
} |
9522
|
9522
|
|
|
@@ -9552,22 +9552,22 @@ discard block |
|
|
block discarded – undo |
9552
|
9552
|
} |
9553
|
9553
|
|
9554
|
9554
|
if (!empty($possiblelink['perms']) && (empty($restrictlinksto) || in_array($key, $restrictlinksto)) && (empty($excludelinksto) || !in_array($key, $excludelinksto))) { |
9555
|
|
- print '<div id="' . $key . 'list"' . (empty($conf->use_javascript_ajax) ? '' : ' style="display:none"') . '>'; |
|
9555
|
+ print '<div id="'.$key.'list"'.(empty($conf->use_javascript_ajax) ? '' : ' style="display:none"').'>'; |
9556
|
9556
|
|
9557
|
9557
|
if (getDolGlobalString('MAIN_LINK_BY_REF_IN_LINKTO')) { |
9558
|
9558
|
print '<br>'."\n"; |
9559
|
9559
|
print '<!-- form to add a link from anywhere -->'."\n"; |
9560
|
|
- print '<form action="' . $_SERVER["PHP_SELF"] . '" method="POST" name="formlinkedbyref' . $key . '">'; |
9561
|
|
- print '<input type="hidden" name="id" value="' . $object->id . '">'; |
|
9560
|
+ print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" name="formlinkedbyref'.$key.'">'; |
|
9561
|
+ print '<input type="hidden" name="id" value="'.$object->id.'">'; |
9562
|
9562
|
print '<input type="hidden" name="action" value="addlinkbyref">'; |
9563
|
|
- print '<input type="hidden" name="token" value="' . newToken() . '">'; |
9564
|
|
- print '<input type="hidden" name="addlink" value="' . $key . '">'; |
|
9563
|
+ print '<input type="hidden" name="token" value="'.newToken().'">'; |
|
9564
|
+ print '<input type="hidden" name="addlink" value="'.$key.'">'; |
9565
|
9565
|
print '<table class="noborder">'; |
9566
|
9566
|
print '<tr>'; |
9567
|
9567
|
//print '<td>' . $langs->trans("Ref") . '</td>'; |
9568
|
|
- print '<td class="center"><input type="text" placeholder="'.dol_escape_htmltag($langs->trans("Ref")).'" name="reftolinkto" value="' . dol_escape_htmltag(GETPOST('reftolinkto', 'alpha')) . '"> '; |
9569
|
|
- print '<input type="submit" class="button small valignmiddle" value="' . $langs->trans('ToLink') . '"> '; |
9570
|
|
- print '<input type="submit" class="button small" name="cancel" value="' . $langs->trans('Cancel') . '"></td>'; |
|
9568
|
+ print '<td class="center"><input type="text" placeholder="'.dol_escape_htmltag($langs->trans("Ref")).'" name="reftolinkto" value="'.dol_escape_htmltag(GETPOST('reftolinkto', 'alpha')).'"> '; |
|
9569
|
+ print '<input type="submit" class="button small valignmiddle" value="'.$langs->trans('ToLink').'"> '; |
|
9570
|
+ print '<input type="submit" class="button small" name="cancel" value="'.$langs->trans('Cancel').'"></td>'; |
9571
|
9571
|
print '</tr>'; |
9572
|
9572
|
print '</table>'; |
9573
|
9573
|
print '</form>'; |
|
@@ -9582,48 +9582,48 @@ discard block |
|
|
block discarded – undo |
9582
|
9582
|
|
9583
|
9583
|
print '<br>'; |
9584
|
9584
|
print '<!-- form to add a link from object to same thirdparty -->'."\n"; |
9585
|
|
- print '<form action="' . $_SERVER["PHP_SELF"] . '" method="POST" name="formlinked' . $key . '">'; |
|
9585
|
+ print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" name="formlinked'.$key.'">'; |
9586
|
9586
|
print '<input type="hidden" name="action" value="addlink">'; |
9587
|
|
- print '<input type="hidden" name="token" value="' . newToken() . '">'; |
9588
|
|
- print '<input type="hidden" name="id" value="' . $object->id . '">'; |
9589
|
|
- print '<input type="hidden" name="addlink" value="' . $key . '">'; |
|
9587
|
+ print '<input type="hidden" name="token" value="'.newToken().'">'; |
|
9588
|
+ print '<input type="hidden" name="id" value="'.$object->id.'">'; |
|
9589
|
+ print '<input type="hidden" name="addlink" value="'.$key.'">'; |
9590
|
9590
|
print '<table class="noborder">'; |
9591
|
9591
|
print '<tr class="liste_titre">'; |
9592
|
9592
|
print '<td class="nowrap"></td>'; |
9593
|
|
- print '<td class="center">' . $langs->trans("Ref") . '</td>'; |
9594
|
|
- print '<td class="left">' . $langs->trans("RefCustomer") . '</td>'; |
9595
|
|
- print '<td class="right">' . $langs->trans("AmountHTShort") . '</td>'; |
9596
|
|
- print '<td class="left">' . $langs->trans("Company") . '</td>'; |
|
9593
|
+ print '<td class="center">'.$langs->trans("Ref").'</td>'; |
|
9594
|
+ print '<td class="left">'.$langs->trans("RefCustomer").'</td>'; |
|
9595
|
+ print '<td class="right">'.$langs->trans("AmountHTShort").'</td>'; |
|
9596
|
+ print '<td class="left">'.$langs->trans("Company").'</td>'; |
9597
|
9597
|
print '</tr>'; |
9598
|
9598
|
while ($i < $num) { |
9599
|
9599
|
$objp = $this->db->fetch_object($resqllist); |
9600
|
9600
|
|
9601
|
9601
|
print '<tr class="oddeven">'; |
9602
|
9602
|
print '<td class="left">'; |
9603
|
|
- print '<input type="radio" name="idtolinkto" id="' . $key . '_' . $objp->rowid . '" value="' . $objp->rowid . '">'; |
|
9603
|
+ print '<input type="radio" name="idtolinkto" id="'.$key.'_'.$objp->rowid.'" value="'.$objp->rowid.'">'; |
9604
|
9604
|
print '</td>'; |
9605
|
|
- print '<td class="center"><label for="' . $key . '_' . $objp->rowid . '">' . $objp->ref . '</label></td>'; |
9606
|
|
- print '<td>' . (!empty($objp->ref_client) ? $objp->ref_client : (!empty($objp->ref_supplier) ? $objp->ref_supplier : '')) . '</td>'; |
|
9605
|
+ print '<td class="center"><label for="'.$key.'_'.$objp->rowid.'">'.$objp->ref.'</label></td>'; |
|
9606
|
+ print '<td>'.(!empty($objp->ref_client) ? $objp->ref_client : (!empty($objp->ref_supplier) ? $objp->ref_supplier : '')).'</td>'; |
9607
|
9607
|
print '<td class="right">'; |
9608
|
9608
|
if ($possiblelink['label'] == 'LinkToContract') { |
9609
|
9609
|
$form = new Form($this->db); |
9610
|
|
- print $form->textwithpicto('', $langs->trans("InformationOnLinkToContract")) . ' '; |
|
9610
|
+ print $form->textwithpicto('', $langs->trans("InformationOnLinkToContract")).' '; |
9611
|
9611
|
} |
9612
|
|
- print '<span class="amount">' . (isset($objp->total_ht) ? price($objp->total_ht) : '') . '</span>'; |
|
9612
|
+ print '<span class="amount">'.(isset($objp->total_ht) ? price($objp->total_ht) : '').'</span>'; |
9613
|
9613
|
print '</td>'; |
9614
|
|
- print '<td>' . $objp->name . '</td>'; |
|
9614
|
+ print '<td>'.$objp->name.'</td>'; |
9615
|
9615
|
print '</tr>'; |
9616
|
9616
|
$i++; |
9617
|
9617
|
} |
9618
|
9618
|
print '</table>'; |
9619
|
9619
|
print '<div class="center">'; |
9620
|
9620
|
if ($num) { |
9621
|
|
- print '<input type="submit" class="button valignmiddle marginleftonly marginrightonly small" value="' . $langs->trans('ToLink') . '">'; |
|
9621
|
+ print '<input type="submit" class="button valignmiddle marginleftonly marginrightonly small" value="'.$langs->trans('ToLink').'">'; |
9622
|
9622
|
} |
9623
|
9623
|
if (empty($conf->use_javascript_ajax)) { |
9624
|
|
- print '<input type="submit" class="button button-cancel marginleftonly marginrightonly small" name="cancel" value="' . $langs->trans("Cancel") . '"></div>'; |
|
9624
|
+ print '<input type="submit" class="button button-cancel marginleftonly marginrightonly small" name="cancel" value="'.$langs->trans("Cancel").'"></div>'; |
9625
|
9625
|
} else { |
9626
|
|
- 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>'; |
|
9626
|
+ 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>'; |
9627
|
9627
|
} |
9628
|
9628
|
print '</form>'; |
9629
|
9629
|
$this->db->free($resqllist); |
|
@@ -9634,10 +9634,10 @@ discard block |
|
|
block discarded – undo |
9634
|
9634
|
|
9635
|
9635
|
//$linktoelem.=($linktoelem?' ':''); |
9636
|
9636
|
if ($num > 0 || getDolGlobalString('MAIN_LINK_BY_REF_IN_LINKTO')) { |
9637
|
|
- $linktoelemlist .= '<li><a href="#linkto' . $key . '" class="linkto dropdowncloseonclick" rel="' . $key . '">' . $langs->trans($possiblelink['label']) . ' (' . $num . ')</a></li>'; |
|
9637
|
+ $linktoelemlist .= '<li><a href="#linkto'.$key.'" class="linkto dropdowncloseonclick" rel="'.$key.'">'.$langs->trans($possiblelink['label']).' ('.$num.')</a></li>'; |
9638
|
9638
|
// } else $linktoelem.=$langs->trans($possiblelink['label']); |
9639
|
9639
|
} else { |
9640
|
|
- $linktoelemlist .= '<li><span class="linktodisabled">' . $langs->trans($possiblelink['label']) . ' (0)</span></li>'; |
|
9640
|
+ $linktoelemlist .= '<li><span class="linktodisabled">'.$langs->trans($possiblelink['label']).' (0)</span></li>'; |
9641
|
9641
|
} |
9642
|
9642
|
} |
9643
|
9643
|
} |
|
@@ -9647,22 +9647,22 @@ discard block |
|
|
block discarded – undo |
9647
|
9647
|
<dl class="dropdown" id="linktoobjectname"> |
9648
|
9648
|
'; |
9649
|
9649
|
if (!empty($conf->use_javascript_ajax)) { |
9650
|
|
- $linktoelem .= '<dt><a href="#linktoobjectname"><span class="fas fa-link paddingrightonly"></span>' . $langs->trans("LinkTo") . '...</a></dt>'; |
|
9650
|
+ $linktoelem .= '<dt><a href="#linktoobjectname"><span class="fas fa-link paddingrightonly"></span>'.$langs->trans("LinkTo").'...</a></dt>'; |
9651
|
9651
|
} |
9652
|
9652
|
$linktoelem .= '<dd> |
9653
|
9653
|
<div class="multiselectlinkto"> |
9654
|
|
- <ul class="ulselectedfields">' . $linktoelemlist . ' |
|
9654
|
+ <ul class="ulselectedfields">' . $linktoelemlist.' |
9655
|
9655
|
</ul> |
9656
|
9656
|
</div> |
9657
|
9657
|
</dd> |
9658
|
9658
|
</dl>'; |
9659
|
9659
|
} else { |
9660
|
|
- $linktoelem = ''; // @phan-suppress-current-line PhanPluginRedundantAssignment |
|
9660
|
+ $linktoelem = ''; // @phan-suppress-current-line PhanPluginRedundantAssignment |
9661
|
9661
|
} |
9662
|
9662
|
|
9663
|
9663
|
if (!empty($conf->use_javascript_ajax)) { |
9664
|
9664
|
print '<!-- Add js to show linkto box --> |
9665
|
|
- <script nonce="' . getNonce() . '"> |
|
9665
|
+ <script nonce="' . getNonce().'"> |
9666
|
9666
|
jQuery(document).ready(function() { |
9667
|
9667
|
jQuery(".linkto").click(function() { |
9668
|
9668
|
console.log("We choose to show/hide links for rel="+jQuery(this).attr(\'rel\')+" so #"+jQuery(this).attr(\'rel\')+"list"); |
|
@@ -9703,19 +9703,19 @@ discard block |
|
|
block discarded – undo |
9703
|
9703
|
|
9704
|
9704
|
$disabled = ($disabled ? ' disabled' : ''); |
9705
|
9705
|
|
9706
|
|
- $resultyesno = '<select class="flat width75' . ($morecss ? ' ' . $morecss : '') . '" id="' . $htmlname . '" name="' . $htmlname . '"' . $disabled . '>' . "\n"; |
|
9706
|
+ $resultyesno = '<select class="flat width75'.($morecss ? ' '.$morecss : '').'" id="'.$htmlname.'" name="'.$htmlname.'"'.$disabled.'>'."\n"; |
9707
|
9707
|
if ($useempty) { |
9708
|
|
- $resultyesno .= '<option value="-1"' . (($value < 0) ? ' selected' : '') . '> </option>' . "\n"; |
|
9708
|
+ $resultyesno .= '<option value="-1"'.(($value < 0) ? ' selected' : '').'> </option>'."\n"; |
9709
|
9709
|
} |
9710
|
9710
|
if (("$value" == 'yes') || ($value == 1)) { |
9711
|
|
- $resultyesno .= '<option value="' . $yes . '" selected>' . $langs->trans($labelyes) . '</option>' . "\n"; |
9712
|
|
- $resultyesno .= '<option value="' . $no . '">' . $langs->trans($labelno) . '</option>' . "\n"; |
|
9711
|
+ $resultyesno .= '<option value="'.$yes.'" selected>'.$langs->trans($labelyes).'</option>'."\n"; |
|
9712
|
+ $resultyesno .= '<option value="'.$no.'">'.$langs->trans($labelno).'</option>'."\n"; |
9713
|
9713
|
} else { |
9714
|
9714
|
$selected = (($useempty && $value != '0' && $value != 'no') ? '' : ' selected'); |
9715
|
|
- $resultyesno .= '<option value="' . $yes . '">' . $langs->trans($labelyes) . '</option>' . "\n"; |
9716
|
|
- $resultyesno .= '<option value="' . $no . '"' . $selected . '>' . $langs->trans($labelno) . '</option>' . "\n"; |
|
9715
|
+ $resultyesno .= '<option value="'.$yes.'">'.$langs->trans($labelyes).'</option>'."\n"; |
|
9716
|
+ $resultyesno .= '<option value="'.$no.'"'.$selected.'>'.$langs->trans($labelno).'</option>'."\n"; |
9717
|
9717
|
} |
9718
|
|
- $resultyesno .= '</select>' . "\n"; |
|
9718
|
+ $resultyesno .= '</select>'."\n"; |
9719
|
9719
|
|
9720
|
9720
|
if ($addjscombo) { |
9721
|
9721
|
$resultyesno .= ajax_combobox($htmlname, array(), 0, 0, 'resolve', ($useempty < 0 ? (string) $useempty : '-1'), $morecss); |
|
@@ -9739,12 +9739,12 @@ discard block |
|
|
block discarded – undo |
9739
|
9739
|
{ |
9740
|
9740
|
// phpcs:enable |
9741
|
9741
|
$sql = "SELECT rowid, label"; |
9742
|
|
- $sql .= " FROM " . $this->db->prefix() . "export_model"; |
9743
|
|
- $sql .= " WHERE type = '" . $this->db->escape($type) . "'"; |
|
9742
|
+ $sql .= " FROM ".$this->db->prefix()."export_model"; |
|
9743
|
+ $sql .= " WHERE type = '".$this->db->escape($type)."'"; |
9744
|
9744
|
$sql .= " ORDER BY rowid"; |
9745
|
9745
|
$result = $this->db->query($sql); |
9746
|
9746
|
if ($result) { |
9747
|
|
- print '<select class="flat" id="select_' . $htmlname . '" name="' . $htmlname . '">'; |
|
9747
|
+ print '<select class="flat" id="select_'.$htmlname.'" name="'.$htmlname.'">'; |
9748
|
9748
|
if ($useempty) { |
9749
|
9749
|
print '<option value="-1"> </option>'; |
9750
|
9750
|
} |
|
@@ -9754,9 +9754,9 @@ discard block |
|
|
block discarded – undo |
9754
|
9754
|
while ($i < $num) { |
9755
|
9755
|
$obj = $this->db->fetch_object($result); |
9756
|
9756
|
if ($selected == $obj->rowid) { |
9757
|
|
- print '<option value="' . $obj->rowid . '" selected>'; |
|
9757
|
+ print '<option value="'.$obj->rowid.'" selected>'; |
9758
|
9758
|
} else { |
9759
|
|
- print '<option value="' . $obj->rowid . '">'; |
|
9759
|
+ print '<option value="'.$obj->rowid.'">'; |
9760
|
9760
|
} |
9761
|
9761
|
print $obj->label; |
9762
|
9762
|
print '</option>'; |
|
@@ -9847,8 +9847,8 @@ discard block |
|
|
block discarded – undo |
9847
|
9847
|
$stringforfirstkey .= ' CTL +'; |
9848
|
9848
|
} |
9849
|
9849
|
|
9850
|
|
- $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>'; |
9851
|
|
- $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>'; |
|
9850
|
+ $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>'; |
|
9851
|
+ $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>'; |
9852
|
9852
|
} |
9853
|
9853
|
|
9854
|
9854
|
//print "xx".$previous_ref."x".$next_ref; |
|
@@ -9856,18 +9856,18 @@ discard block |
|
|
block discarded – undo |
9856
|
9856
|
|
9857
|
9857
|
// Right part of banner |
9858
|
9858
|
if ($morehtmlright) { |
9859
|
|
- $ret .= '<div class="inline-block floatleft">' . $morehtmlright . '</div>'; |
|
9859
|
+ $ret .= '<div class="inline-block floatleft">'.$morehtmlright.'</div>'; |
9860
|
9860
|
} |
9861
|
9861
|
|
9862
|
9862
|
if ($previous_ref || $next_ref || $morehtml) { |
9863
|
9863
|
$ret .= '<div class="pagination paginationref"><ul class="right">'; |
9864
|
9864
|
} |
9865
|
9865
|
if ($morehtml && getDolGlobalInt('MAIN_OPTIMIZEFORTEXTBROWSER') < 2) { |
9866
|
|
- $ret .= '<!-- morehtml --><li class="noborder litext' . (($shownav && $previous_ref && $next_ref) ? ' clearbothonsmartphone' : '') . '">' . $morehtml . '</li>'; |
|
9866
|
+ $ret .= '<!-- morehtml --><li class="noborder litext'.(($shownav && $previous_ref && $next_ref) ? ' clearbothonsmartphone' : '').'">'.$morehtml.'</li>'; |
9867
|
9867
|
} |
9868
|
9868
|
if ($shownav && ($previous_ref || $next_ref)) { |
9869
|
|
- $ret .= '<li class="pagination">' . $previous_ref . '</li>'; |
9870
|
|
- $ret .= '<li class="pagination">' . $next_ref . '</li>'; |
|
9869
|
+ $ret .= '<li class="pagination">'.$previous_ref.'</li>'; |
|
9870
|
+ $ret .= '<li class="pagination">'.$next_ref.'</li>'; |
9871
|
9871
|
} |
9872
|
9872
|
if ($previous_ref || $next_ref || $morehtml) { |
9873
|
9873
|
$ret .= '</ul></div>'; |
|
@@ -9882,7 +9882,7 @@ discard block |
|
|
block discarded – undo |
9882
|
9882
|
$morehtmlstatus = $hookmanager->resPrint; |
9883
|
9883
|
} |
9884
|
9884
|
if ($morehtmlstatus) { |
9885
|
|
- $ret .= '<div class="statusref">' . $morehtmlstatus . '</div>'; |
|
9885
|
+ $ret .= '<div class="statusref">'.$morehtmlstatus.'</div>'; |
9886
|
9886
|
} |
9887
|
9887
|
|
9888
|
9888
|
$parameters = array(); |
|
@@ -9896,14 +9896,14 @@ discard block |
|
|
block discarded – undo |
9896
|
9896
|
// Left part of banner |
9897
|
9897
|
if ($morehtmlleft) { |
9898
|
9898
|
if ($conf->browser->layout == 'phone') { |
9899
|
|
- $ret .= '<!-- morehtmlleft --><div class="floatleft">' . $morehtmlleft . '</div>'; |
|
9899
|
+ $ret .= '<!-- morehtmlleft --><div class="floatleft">'.$morehtmlleft.'</div>'; |
9900
|
9900
|
} else { |
9901
|
|
- $ret .= '<!-- morehtmlleft --><div class="inline-block floatleft">' . $morehtmlleft . '</div>'; |
|
9901
|
+ $ret .= '<!-- morehtmlleft --><div class="inline-block floatleft">'.$morehtmlleft.'</div>'; |
9902
|
9902
|
} |
9903
|
9903
|
} |
9904
|
9904
|
|
9905
|
9905
|
//if ($conf->browser->layout == 'phone') $ret.='<div class="clearboth"></div>'; |
9906
|
|
- $ret .= '<div class="inline-block floatleft valignmiddle maxwidth750 marginbottomonly refid' . (($shownav && ($previous_ref || $next_ref)) ? ' refidpadding' : '') . '">'; |
|
9906
|
+ $ret .= '<div class="inline-block floatleft valignmiddle maxwidth750 marginbottomonly refid'.(($shownav && ($previous_ref || $next_ref)) ? ' refidpadding' : '').'">'; |
9907
|
9907
|
|
9908
|
9908
|
// For thirdparty, contact, user, member, the ref is the id, so we show something else |
9909
|
9909
|
if ($object->element == 'societe') { |
|
@@ -9917,7 +9917,7 @@ discard block |
|
|
block discarded – undo |
9917
|
9917
|
|
9918
|
9918
|
if (is_array($arrayoflangcode) && count($arrayoflangcode)) { |
9919
|
9919
|
if (!is_object($extralanguages)) { |
9920
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/class/extralanguages.class.php'; |
|
9920
|
+ include_once DOL_DOCUMENT_ROOT.'/core/class/extralanguages.class.php'; |
9921
|
9921
|
$extralanguages = new ExtraLanguages($this->db); |
9922
|
9922
|
} |
9923
|
9923
|
$extralanguages->fetch_name_extralanguages('societe'); |
|
@@ -9932,29 +9932,29 @@ discard block |
|
|
block discarded – undo |
9932
|
9932
|
if ($object->array_languages['name'][$extralangcode]) { |
9933
|
9933
|
$htmltext .= $object->array_languages['name'][$extralangcode]; |
9934
|
9934
|
} else { |
9935
|
|
- $htmltext .= '<span class="opacitymedium">' . $langs->trans("SwitchInEditModeToAddTranslation") . '</span>'; |
|
9935
|
+ $htmltext .= '<span class="opacitymedium">'.$langs->trans("SwitchInEditModeToAddTranslation").'</span>'; |
9936
|
9936
|
} |
9937
|
9937
|
} |
9938
|
|
- $ret .= '<!-- Show translations of name -->' . "\n"; |
|
9938
|
+ $ret .= '<!-- Show translations of name -->'."\n"; |
9939
|
9939
|
$ret .= $this->textwithpicto('', $htmltext, -1, 'language', 'opacitymedium paddingleft'); |
9940
|
9940
|
} |
9941
|
9941
|
} |
9942
|
9942
|
} elseif ($object->element == 'member') { |
9943
|
9943
|
'@phan-var-force Adherent $object'; |
9944
|
|
- $ret .= $object->ref . '<br>'; |
|
9944
|
+ $ret .= $object->ref.'<br>'; |
9945
|
9945
|
$fullname = $object->getFullName($langs); |
9946
|
9946
|
if ($object->morphy == 'mor' && $object->societe) { |
9947
|
|
- $ret .= dol_htmlentities($object->societe) . ((!empty($fullname) && $object->societe != $fullname) ? ' (' . dol_htmlentities($fullname) . $addgendertxt . ')' : ''); |
|
9947
|
+ $ret .= dol_htmlentities($object->societe).((!empty($fullname) && $object->societe != $fullname) ? ' ('.dol_htmlentities($fullname).$addgendertxt.')' : ''); |
9948
|
9948
|
} else { |
9949
|
|
- $ret .= dol_htmlentities($fullname) . $addgendertxt . ((!empty($object->societe) && $object->societe != $fullname) ? ' (' . dol_htmlentities($object->societe) . ')' : ''); |
|
9949
|
+ $ret .= dol_htmlentities($fullname).$addgendertxt.((!empty($object->societe) && $object->societe != $fullname) ? ' ('.dol_htmlentities($object->societe).')' : ''); |
9950
|
9950
|
} |
9951
|
9951
|
} elseif (in_array($object->element, array('contact', 'user'))) { |
9952
|
|
- $ret .= dol_htmlentities($object->getFullName($langs)) . $addgendertxt; |
|
9952
|
+ $ret .= dol_htmlentities($object->getFullName($langs)).$addgendertxt; |
9953
|
9953
|
} elseif ($object->element == 'usergroup') { |
9954
|
9954
|
$ret .= dol_htmlentities($object->name); |
9955
|
9955
|
} elseif (in_array($object->element, array('action', 'agenda'))) { |
9956
|
9956
|
'@phan-var-force ActionComm $object'; |
9957
|
|
- $ret .= $object->ref . '<br>' . $object->label; |
|
9957
|
+ $ret .= $object->ref.'<br>'.$object->label; |
9958
|
9958
|
} elseif (in_array($object->element, array('adherent_type'))) { |
9959
|
9959
|
$ret .= $object->label; |
9960
|
9960
|
} elseif ($object->element == 'ecm_directories') { |
|
@@ -10007,9 +10007,9 @@ discard block |
|
|
block discarded – undo |
10007
|
10007
|
} |
10008
|
10008
|
|
10009
|
10009
|
// Barcode image @phan-suppress-next-line PhanUndeclaredProperty |
10010
|
|
- $url = DOL_URL_ROOT . '/viewimage.php?modulepart=barcode&generator=' . urlencode($object->barcode_type_coder) . '&code=' . urlencode($object->barcode) . '&encoding=' . urlencode($object->barcode_type_code); |
10011
|
|
- $out = '<!-- url barcode = ' . $url . ' -->'; |
10012
|
|
- $out .= '<img src="' . $url . '"' . ($morecss ? ' class="' . $morecss . '"' : '') . '>'; |
|
10010
|
+ $url = DOL_URL_ROOT.'/viewimage.php?modulepart=barcode&generator='.urlencode($object->barcode_type_coder).'&code='.urlencode($object->barcode).'&encoding='.urlencode($object->barcode_type_code); |
|
10011
|
+ $out = '<!-- url barcode = '.$url.' -->'; |
|
10012
|
+ $out .= '<img src="'.$url.'"'.($morecss ? ' class="'.$morecss.'"' : '').'>'; |
10013
|
10013
|
|
10014
|
10014
|
return $out; |
10015
|
10015
|
} |
|
@@ -10036,7 +10036,7 @@ discard block |
|
|
block discarded – undo |
10036
|
10036
|
global $conf, $langs; |
10037
|
10037
|
|
10038
|
10038
|
$entity = (empty($object->entity) ? $conf->entity : $object->entity); |
10039
|
|
- $id = (empty($object->id) ? $object->rowid : $object->id); // @phan-suppress-current-line PhanUndeclaredProperty (->rowid) |
|
10039
|
+ $id = (empty($object->id) ? $object->rowid : $object->id); // @phan-suppress-current-line PhanUndeclaredProperty (->rowid) |
10040
|
10040
|
|
10041
|
10041
|
$dir = ''; |
10042
|
10042
|
$file = ''; |
|
@@ -10049,28 +10049,28 @@ discard block |
|
|
block discarded – undo |
10049
|
10049
|
if (!empty($object->logo)) { |
10050
|
10050
|
if (dolIsAllowedForPreview($object->logo)) { |
10051
|
10051
|
if ((string) $imagesize == 'mini') { |
10052
|
|
- $file = get_exdir(0, 0, 0, 0, $object, 'thirdparty') . 'logos/' . getImageFileNameForSize($object->logo, '_mini'); // getImageFileNameForSize include the thumbs |
|
10052
|
+ $file = get_exdir(0, 0, 0, 0, $object, 'thirdparty').'logos/'.getImageFileNameForSize($object->logo, '_mini'); // getImageFileNameForSize include the thumbs |
10053
|
10053
|
} elseif ((string) $imagesize == 'small') { |
10054
|
|
- $file = get_exdir(0, 0, 0, 0, $object, 'thirdparty') . 'logos/' . getImageFileNameForSize($object->logo, '_small'); |
|
10054
|
+ $file = get_exdir(0, 0, 0, 0, $object, 'thirdparty').'logos/'.getImageFileNameForSize($object->logo, '_small'); |
10055
|
10055
|
} else { |
10056
|
|
- $file = get_exdir(0, 0, 0, 0, $object, 'thirdparty') . 'logos/' . $object->logo; |
|
10056
|
+ $file = get_exdir(0, 0, 0, 0, $object, 'thirdparty').'logos/'.$object->logo; |
10057
|
10057
|
} |
10058
|
|
- $originalfile = get_exdir(0, 0, 0, 0, $object, 'thirdparty') . 'logos/' . $object->logo; |
|
10058
|
+ $originalfile = get_exdir(0, 0, 0, 0, $object, 'thirdparty').'logos/'.$object->logo; |
10059
|
10059
|
} |
10060
|
10060
|
} |
10061
|
10061
|
$email = $object->email; |
10062
|
10062
|
} elseif ($modulepart == 'contact') { |
10063
|
|
- $dir = $conf->societe->multidir_output[$entity] . '/contact'; |
|
10063
|
+ $dir = $conf->societe->multidir_output[$entity].'/contact'; |
10064
|
10064
|
if (!empty($object->photo)) { |
10065
|
10065
|
if (dolIsAllowedForPreview($object->photo)) { |
10066
|
10066
|
if ((string) $imagesize == 'mini') { |
10067
|
|
- $file = get_exdir(0, 0, 0, 0, $object, 'contact') . 'photos/' . getImageFileNameForSize($object->photo, '_mini'); |
|
10067
|
+ $file = get_exdir(0, 0, 0, 0, $object, 'contact').'photos/'.getImageFileNameForSize($object->photo, '_mini'); |
10068
|
10068
|
} elseif ((string) $imagesize == 'small') { |
10069
|
|
- $file = get_exdir(0, 0, 0, 0, $object, 'contact') . 'photos/' . getImageFileNameForSize($object->photo, '_small'); |
|
10069
|
+ $file = get_exdir(0, 0, 0, 0, $object, 'contact').'photos/'.getImageFileNameForSize($object->photo, '_small'); |
10070
|
10070
|
} else { |
10071
|
|
- $file = get_exdir(0, 0, 0, 0, $object, 'contact') . 'photos/' . $object->photo; |
|
10071
|
+ $file = get_exdir(0, 0, 0, 0, $object, 'contact').'photos/'.$object->photo; |
10072
|
10072
|
} |
10073
|
|
- $originalfile = get_exdir(0, 0, 0, 0, $object, 'contact') . 'photos/' . $object->photo; |
|
10073
|
+ $originalfile = get_exdir(0, 0, 0, 0, $object, 'contact').'photos/'.$object->photo; |
10074
|
10074
|
} |
10075
|
10075
|
} |
10076
|
10076
|
$email = $object->email; |
|
@@ -10080,17 +10080,17 @@ discard block |
|
|
block discarded – undo |
10080
|
10080
|
if (!empty($object->photo)) { |
10081
|
10081
|
if (dolIsAllowedForPreview($object->photo)) { |
10082
|
10082
|
if ((string) $imagesize == 'mini') { |
10083
|
|
- $file = get_exdir(0, 0, 0, 0, $object, 'user') . 'photos/' . getImageFileNameForSize($object->photo, '_mini'); |
|
10083
|
+ $file = get_exdir(0, 0, 0, 0, $object, 'user').'photos/'.getImageFileNameForSize($object->photo, '_mini'); |
10084
|
10084
|
} elseif ((string) $imagesize == 'small') { |
10085
|
|
- $file = get_exdir(0, 0, 0, 0, $object, 'user') . 'photos/' . getImageFileNameForSize($object->photo, '_small'); |
|
10085
|
+ $file = get_exdir(0, 0, 0, 0, $object, 'user').'photos/'.getImageFileNameForSize($object->photo, '_small'); |
10086
|
10086
|
} else { |
10087
|
|
- $file = get_exdir(0, 0, 0, 0, $object, 'user') . 'photos/' . $object->photo; |
|
10087
|
+ $file = get_exdir(0, 0, 0, 0, $object, 'user').'photos/'.$object->photo; |
10088
|
10088
|
} |
10089
|
|
- $originalfile = get_exdir(0, 0, 0, 0, $object, 'user') . 'photos/' . $object->photo; |
|
10089
|
+ $originalfile = get_exdir(0, 0, 0, 0, $object, 'user').'photos/'.$object->photo; |
10090
|
10090
|
} |
10091
|
10091
|
} |
10092
|
10092
|
if (getDolGlobalString('MAIN_OLD_IMAGE_LINKS')) { |
10093
|
|
- $altfile = $object->id . ".jpg"; // For backward compatibility |
|
10093
|
+ $altfile = $object->id.".jpg"; // For backward compatibility |
10094
|
10094
|
} |
10095
|
10095
|
$email = $object->email; |
10096
|
10096
|
$capture = 'user'; |
|
@@ -10099,17 +10099,17 @@ discard block |
|
|
block discarded – undo |
10099
|
10099
|
if (!empty($object->photo)) { |
10100
|
10100
|
if (dolIsAllowedForPreview($object->photo)) { |
10101
|
10101
|
if ((string) $imagesize == 'mini') { |
10102
|
|
- $file = get_exdir(0, 0, 0, 0, $object, 'member') . 'photos/' . getImageFileNameForSize($object->photo, '_mini'); |
|
10102
|
+ $file = get_exdir(0, 0, 0, 0, $object, 'member').'photos/'.getImageFileNameForSize($object->photo, '_mini'); |
10103
|
10103
|
} elseif ((string) $imagesize == 'small') { |
10104
|
|
- $file = get_exdir(0, 0, 0, 0, $object, 'member') . 'photos/' . getImageFileNameForSize($object->photo, '_small'); |
|
10104
|
+ $file = get_exdir(0, 0, 0, 0, $object, 'member').'photos/'.getImageFileNameForSize($object->photo, '_small'); |
10105
|
10105
|
} else { |
10106
|
|
- $file = get_exdir(0, 0, 0, 0, $object, 'member') . 'photos/' . $object->photo; |
|
10106
|
+ $file = get_exdir(0, 0, 0, 0, $object, 'member').'photos/'.$object->photo; |
10107
|
10107
|
} |
10108
|
|
- $originalfile = get_exdir(0, 0, 0, 0, $object, 'member') . 'photos/' . $object->photo; |
|
10108
|
+ $originalfile = get_exdir(0, 0, 0, 0, $object, 'member').'photos/'.$object->photo; |
10109
|
10109
|
} |
10110
|
10110
|
} |
10111
|
10111
|
if (getDolGlobalString('MAIN_OLD_IMAGE_LINKS')) { |
10112
|
|
- $altfile = $object->id . ".jpg"; // For backward compatibility |
|
10112
|
+ $altfile = $object->id.".jpg"; // For backward compatibility |
10113
|
10113
|
} |
10114
|
10114
|
$email = $object->email; |
10115
|
10115
|
$capture = 'user'; |
|
@@ -10135,35 +10135,35 @@ discard block |
|
|
block discarded – undo |
10135
|
10135
|
$ret = ''; |
10136
|
10136
|
|
10137
|
10137
|
if ($dir) { |
10138
|
|
- if ($file && file_exists($dir . "/" . $file)) { |
|
10138
|
+ if ($file && file_exists($dir."/".$file)) { |
10139
|
10139
|
if ($addlinktofullsize) { |
10140
|
|
- $urladvanced = getAdvancedPreviewUrl($modulepart, $originalfile, 0, '&entity=' . $entity); |
|
10140
|
+ $urladvanced = getAdvancedPreviewUrl($modulepart, $originalfile, 0, '&entity='.$entity); |
10141
|
10141
|
if ($urladvanced) { |
10142
|
|
- $ret .= '<a href="' . $urladvanced . '">'; |
|
10142
|
+ $ret .= '<a href="'.$urladvanced.'">'; |
10143
|
10143
|
} else { |
10144
|
|
- $ret .= '<a href="' . DOL_URL_ROOT . '/viewimage.php?modulepart=' . $modulepart . '&entity=' . $entity . '&file=' . urlencode($originalfile) . '&cache=' . $cache . '">'; |
|
10144
|
+ $ret .= '<a href="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$entity.'&file='.urlencode($originalfile).'&cache='.$cache.'">'; |
10145
|
10145
|
} |
10146
|
10146
|
} |
10147
|
|
- $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 . '">'; |
|
10147
|
+ $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.'">'; |
10148
|
10148
|
if ($addlinktofullsize) { |
10149
|
10149
|
$ret .= '</a>'; |
10150
|
10150
|
} |
10151
|
|
- } elseif ($altfile && file_exists($dir . "/" . $altfile)) { |
|
10151
|
+ } elseif ($altfile && file_exists($dir."/".$altfile)) { |
10152
|
10152
|
if ($addlinktofullsize) { |
10153
|
|
- $urladvanced = getAdvancedPreviewUrl($modulepart, $originalfile, 0, '&entity=' . $entity); |
|
10153
|
+ $urladvanced = getAdvancedPreviewUrl($modulepart, $originalfile, 0, '&entity='.$entity); |
10154
|
10154
|
if ($urladvanced) { |
10155
|
|
- $ret .= '<a href="' . $urladvanced . '">'; |
|
10155
|
+ $ret .= '<a href="'.$urladvanced.'">'; |
10156
|
10156
|
} else { |
10157
|
|
- $ret .= '<a href="' . DOL_URL_ROOT . '/viewimage.php?modulepart=' . $modulepart . '&entity=' . $entity . '&file=' . urlencode($originalfile) . '&cache=' . $cache . '">'; |
|
10157
|
+ $ret .= '<a href="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$entity.'&file='.urlencode($originalfile).'&cache='.$cache.'">'; |
10158
|
10158
|
} |
10159
|
10159
|
} |
10160
|
|
- $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 . '">'; |
|
10160
|
+ $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.'">'; |
10161
|
10161
|
if ($addlinktofullsize) { |
10162
|
10162
|
$ret .= '</a>'; |
10163
|
10163
|
} |
10164
|
10164
|
} else { |
10165
|
10165
|
$nophoto = '/public/theme/common/nophoto.png'; |
10166
|
|
- $defaultimg = 'identicon'; // For gravatar |
|
10166
|
+ $defaultimg = 'identicon'; // For gravatar |
10167
|
10167
|
if (in_array($modulepart, array('societe', 'userphoto', 'contact', 'memberphoto'))) { // For modules that need a special image when photo not found |
10168
|
10168
|
if ($modulepart == 'societe' || ($modulepart == 'memberphoto' && !empty($object->morphy) && strpos($object->morphy, 'mor') !== false)) { |
10169
|
10169
|
$nophoto = 'company'; |
|
@@ -10181,13 +10181,13 @@ discard block |
|
|
block discarded – undo |
10181
|
10181
|
if (isModEnabled('gravatar') && $email && empty($noexternsourceoverwrite)) { |
10182
|
10182
|
// see https://gravatar.com/site/implement/images/php/ |
10183
|
10183
|
$ret .= '<!-- Put link to gravatar -->'; |
10184
|
|
- $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 |
|
10184
|
+ $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 |
10185
|
10185
|
} else { |
10186
|
10186
|
if ($nophoto == 'company') { |
10187
|
|
- $ret .= '<div class="divforspanimg valignmiddle center photo' . $modulepart . ($cssclass ? ' ' . $cssclass : '') . '" alt="" ' . ($width ? ' width="' . $width . '"' : '') . ($height ? ' height="' . $height . '"' : '') . '>' . img_picto('', 'company') . '</div>'; |
|
10187
|
+ $ret .= '<div class="divforspanimg valignmiddle center photo'.$modulepart.($cssclass ? ' '.$cssclass : '').'" alt="" '.($width ? ' width="'.$width.'"' : '').($height ? ' height="'.$height.'"' : '').'>'.img_picto('', 'company').'</div>'; |
10188
|
10188
|
//$ret .= '<div class="difforspanimgright"></div>'; |
10189
|
10189
|
} else { |
10190
|
|
- $ret .= '<img class="photo' . $modulepart . ($cssclass ? ' ' . $cssclass : '') . '" alt="" ' . ($width ? ' width="' . $width . '"' : '') . ($height ? ' height="' . $height . '"' : '') . ' src="' . DOL_URL_ROOT . $nophoto . '">'; |
|
10190
|
+ $ret .= '<img class="photo'.$modulepart.($cssclass ? ' '.$cssclass : '').'" alt="" '.($width ? ' width="'.$width.'"' : '').($height ? ' height="'.$height.'"' : '').' src="'.DOL_URL_ROOT.$nophoto.'">'; |
10191
|
10191
|
} |
10192
|
10192
|
} |
10193
|
10193
|
} |
|
@@ -10198,15 +10198,15 @@ discard block |
|
|
block discarded – undo |
10198
|
10198
|
} |
10199
|
10199
|
$ret .= '<table class="nobordernopadding centpercent">'; |
10200
|
10200
|
if ($object->photo) { |
10201
|
|
- $ret .= '<tr><td><input type="checkbox" class="flat photodelete" name="deletephoto" id="photodelete"> <label for="photodelete">' . $langs->trans("Delete") . '</label><br><br></td></tr>'; |
|
10201
|
+ $ret .= '<tr><td><input type="checkbox" class="flat photodelete" name="deletephoto" id="photodelete"> <label for="photodelete">'.$langs->trans("Delete").'</label><br><br></td></tr>'; |
10202
|
10202
|
} |
10203
|
10203
|
$ret .= '<tr><td class="tdoverflow">'; |
10204
|
10204
|
$maxfilesizearray = getMaxFileSizeArray(); |
10205
|
10205
|
$maxmin = $maxfilesizearray['maxmin']; |
10206
|
10206
|
if ($maxmin > 0) { |
10207
|
|
- $ret .= '<input type="hidden" name="MAX_FILE_SIZE" value="' . ($maxmin * 1024) . '">'; // MAX_FILE_SIZE must precede the field type=file |
|
10207
|
+ $ret .= '<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).'">'; // MAX_FILE_SIZE must precede the field type=file |
10208
|
10208
|
} |
10209
|
|
- $ret .= '<input type="file" class="flat maxwidth200onsmartphone" name="photo" id="photoinput" accept="image/*"' . ($capture ? ' capture="' . $capture . '"' : '') . '>'; |
|
10209
|
+ $ret .= '<input type="file" class="flat maxwidth200onsmartphone" name="photo" id="photoinput" accept="image/*"'.($capture ? ' capture="'.$capture.'"' : '').'>'; |
10210
|
10210
|
$ret .= '</td></tr>'; |
10211
|
10211
|
$ret .= '</table>'; |
10212
|
10212
|
} |
|
@@ -10260,38 +10260,38 @@ discard block |
|
|
block discarded – undo |
10260
|
10260
|
if (isModEnabled('multicompany') && $conf->entity == 1 && $user->admin && !$user->entity) { |
10261
|
10261
|
$sql .= ", e.label"; |
10262
|
10262
|
} |
10263
|
|
- $sql .= " FROM " . $this->db->prefix() . "usergroup as ug "; |
|
10263
|
+ $sql .= " FROM ".$this->db->prefix()."usergroup as ug "; |
10264
|
10264
|
if (isModEnabled('multicompany') && $conf->entity == 1 && $user->admin && !$user->entity) { |
10265
|
|
- $sql .= " LEFT JOIN " . $this->db->prefix() . "entity as e ON e.rowid=ug.entity"; |
|
10265
|
+ $sql .= " LEFT JOIN ".$this->db->prefix()."entity as e ON e.rowid=ug.entity"; |
10266
|
10266
|
if ($force_entity) { |
10267
|
|
- $sql .= " WHERE ug.entity IN (0, " . $force_entity . ")"; |
|
10267
|
+ $sql .= " WHERE ug.entity IN (0, ".$force_entity.")"; |
10268
|
10268
|
} else { |
10269
|
10269
|
$sql .= " WHERE ug.entity IS NOT NULL"; |
10270
|
10270
|
} |
10271
|
10271
|
} else { |
10272
|
|
- $sql .= " WHERE ug.entity IN (0, " . $conf->entity . ")"; |
|
10272
|
+ $sql .= " WHERE ug.entity IN (0, ".$conf->entity.")"; |
10273
|
10273
|
} |
10274
|
10274
|
if (is_array($exclude) && $excludeGroups) { |
10275
|
|
- $sql .= " AND ug.rowid NOT IN (" . $this->db->sanitize($excludeGroups) . ")"; |
|
10275
|
+ $sql .= " AND ug.rowid NOT IN (".$this->db->sanitize($excludeGroups).")"; |
10276
|
10276
|
} |
10277
|
10277
|
if (is_array($include) && $includeGroups) { |
10278
|
|
- $sql .= " AND ug.rowid IN (" . $this->db->sanitize($includeGroups) . ")"; |
|
10278
|
+ $sql .= " AND ug.rowid IN (".$this->db->sanitize($includeGroups).")"; |
10279
|
10279
|
} |
10280
|
10280
|
$sql .= " ORDER BY ug.nom ASC"; |
10281
|
10281
|
|
10282
|
|
- dol_syslog(get_class($this) . "::select_dolgroups", LOG_DEBUG); |
|
10282
|
+ dol_syslog(get_class($this)."::select_dolgroups", LOG_DEBUG); |
10283
|
10283
|
$resql = $this->db->query($sql); |
10284
|
10284
|
if ($resql) { |
10285
|
10285
|
// Enhance with select2 |
10286
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
10286
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
10287
|
10287
|
|
10288
|
|
- $out .= '<select class="flat minwidth200' . ($morecss ? ' ' . $morecss : '') . '" id="' . $htmlname . '" name="' . $htmlname . ($multiple ? '[]' : '') . '" ' . ($multiple ? 'multiple' : '') . ' ' . ($disabled ? ' disabled' : '') . '>'; |
|
10288
|
+ $out .= '<select class="flat minwidth200'.($morecss ? ' '.$morecss : '').'" id="'.$htmlname.'" name="'.$htmlname.($multiple ? '[]' : '').'" '.($multiple ? 'multiple' : '').' '.($disabled ? ' disabled' : '').'>'; |
10289
|
10289
|
|
10290
|
10290
|
$num = $this->db->num_rows($resql); |
10291
|
10291
|
$i = 0; |
10292
|
10292
|
if ($num) { |
10293
|
10293
|
if ($show_empty && !$multiple) { |
10294
|
|
- $out .= '<option value="-1"' . (in_array(-1, $selected) ? ' selected' : '') . '> </option>' . "\n"; |
|
10294
|
+ $out .= '<option value="-1"'.(in_array(-1, $selected) ? ' selected' : '').'> </option>'."\n"; |
10295
|
10295
|
} |
10296
|
10296
|
|
10297
|
10297
|
while ($i < $num) { |
|
@@ -10304,11 +10304,11 @@ discard block |
|
|
block discarded – undo |
10304
|
10304
|
$label = $obj->name; |
10305
|
10305
|
$labelhtml = $obj->name; |
10306
|
10306
|
if (isModEnabled('multicompany') && !getDolGlobalInt('MULTICOMPANY_TRANSVERSE_MODE') && $conf->entity == 1) { |
10307
|
|
- $label .= " (" . $obj->label . ")"; |
10308
|
|
- $labelhtml .= ' <span class="opacitymedium">(' . $obj->label . ')</span>'; |
|
10307
|
+ $label .= " (".$obj->label.")"; |
|
10308
|
+ $labelhtml .= ' <span class="opacitymedium">('.$obj->label.')</span>'; |
10309
|
10309
|
} |
10310
|
10310
|
|
10311
|
|
- $out .= '<option value="' . $obj->rowid . '"'; |
|
10311
|
+ $out .= '<option value="'.$obj->rowid.'"'; |
10312
|
10312
|
if ($disableline) { |
10313
|
10313
|
$out .= ' disabled'; |
10314
|
10314
|
} |
|
@@ -10324,9 +10324,9 @@ discard block |
|
|
block discarded – undo |
10324
|
10324
|
} |
10325
|
10325
|
} else { |
10326
|
10326
|
if ($show_empty) { |
10327
|
|
- $out .= '<option value="-1"' . (in_array(-1, $selected) ? ' selected' : '') . '></option>' . "\n"; |
|
10327
|
+ $out .= '<option value="-1"'.(in_array(-1, $selected) ? ' selected' : '').'></option>'."\n"; |
10328
|
10328
|
} |
10329
|
|
- $out .= '<option value="" disabled>' . $langs->trans("NoUserGroupDefined") . '</option>'; |
|
10329
|
+ $out .= '<option value="" disabled>'.$langs->trans("NoUserGroupDefined").'</option>'; |
10330
|
10330
|
} |
10331
|
10331
|
$out .= '</select>'; |
10332
|
10332
|
|
|
@@ -10370,25 +10370,25 @@ discard block |
|
|
block discarded – undo |
10370
|
10370
|
$out = ''; |
10371
|
10371
|
|
10372
|
10372
|
if (!empty($conf->use_javascript_ajax)) { |
10373
|
|
- $out .= '<div class="inline-block checkallactions"><input type="checkbox" id="' . $cssclass . 's" name="' . $cssclass . 's" class="checkallactions"></div>'; |
|
10373
|
+ $out .= '<div class="inline-block checkallactions"><input type="checkbox" id="'.$cssclass.'s" name="'.$cssclass.'s" class="checkallactions"></div>'; |
10374
|
10374
|
} |
10375
|
|
- $out .= '<script nonce="' . getNonce() . '"> |
|
10375
|
+ $out .= '<script nonce="'.getNonce().'"> |
10376
|
10376
|
$(document).ready(function() { |
10377
|
|
- $("#' . $cssclass . 's").click(function() { |
|
10377
|
+ $("#' . $cssclass.'s").click(function() { |
10378
|
10378
|
if($(this).is(\':checked\')){ |
10379
|
|
- console.log("We check all ' . $cssclass . ' and trigger the change method"); |
10380
|
|
- $(".' . $cssclass . '").prop(\'checked\', true).trigger(\'change\'); |
|
10379
|
+ console.log("We check all ' . $cssclass.' and trigger the change method"); |
|
10380
|
+ $(".' . $cssclass.'").prop(\'checked\', true).trigger(\'change\'); |
10381
|
10381
|
} |
10382
|
10382
|
else |
10383
|
10383
|
{ |
10384
|
10384
|
console.log("We uncheck all"); |
10385
|
|
- $(".' . $cssclass . '").prop(\'checked\', false).trigger(\'change\'); |
|
10385
|
+ $(".' . $cssclass.'").prop(\'checked\', false).trigger(\'change\'); |
10386
|
10386
|
}' . "\n"; |
10387
|
10387
|
if ($calljsfunction) { |
10388
|
|
- $out .= 'if (typeof initCheckForSelect == \'function\') { initCheckForSelect(0, "' . $massactionname . '", "' . $cssclass . '"); } else { console.log("No function initCheckForSelect found. Call won\'t be done."); }'; |
|
10388
|
+ $out .= 'if (typeof initCheckForSelect == \'function\') { initCheckForSelect(0, "'.$massactionname.'", "'.$cssclass.'"); } else { console.log("No function initCheckForSelect found. Call won\'t be done."); }'; |
10389
|
10389
|
} |
10390
|
10390
|
$out .= ' }); |
10391
|
|
- $(".' . $cssclass . '").change(function() { |
|
10391
|
+ $(".' . $cssclass.'").change(function() { |
10392
|
10392
|
$(this).closest("tr").toggleClass("highlight", this.checked); |
10393
|
10393
|
}); |
10394
|
10394
|
}); |
|
@@ -10433,67 +10433,67 @@ discard block |
|
|
block discarded – undo |
10433
|
10433
|
global $langs, $user; |
10434
|
10434
|
|
10435
|
10435
|
$out = ''; |
10436
|
|
- $sql = "SELECT rowid, label FROM " . $this->db->prefix() . "c_exp_tax_cat WHERE active = 1"; |
10437
|
|
- $sql .= " AND entity IN (0," . getEntity('exp_tax_cat') . ")"; |
|
10436
|
+ $sql = "SELECT rowid, label FROM ".$this->db->prefix()."c_exp_tax_cat WHERE active = 1"; |
|
10437
|
+ $sql .= " AND entity IN (0,".getEntity('exp_tax_cat').")"; |
10438
|
10438
|
if (!empty($excludeid)) { |
10439
|
|
- $sql .= " AND rowid NOT IN (" . $this->db->sanitize(implode(',', $excludeid)) . ")"; |
|
10439
|
+ $sql .= " AND rowid NOT IN (".$this->db->sanitize(implode(',', $excludeid)).")"; |
10440
|
10440
|
} |
10441
|
10441
|
$sql .= " ORDER BY label"; |
10442
|
10442
|
|
10443
|
10443
|
$resql = $this->db->query($sql); |
10444
|
10444
|
if ($resql) { |
10445
|
|
- $out = '<select id="select_' . $htmlname . '" name="' . $htmlname . '" class="' . $htmlname . ' flat minwidth75imp maxwidth200">'; |
|
10445
|
+ $out = '<select id="select_'.$htmlname.'" name="'.$htmlname.'" class="'.$htmlname.' flat minwidth75imp maxwidth200">'; |
10446
|
10446
|
if ($useempty) { |
10447
|
10447
|
$out .= '<option value="0"> </option>'; |
10448
|
10448
|
} |
10449
|
10449
|
|
10450
|
10450
|
while ($obj = $this->db->fetch_object($resql)) { |
10451
|
|
- $out .= '<option ' . ($selected == $obj->rowid ? 'selected="selected"' : '') . ' value="' . $obj->rowid . '">' . $langs->trans($obj->label) . '</option>'; |
|
10451
|
+ $out .= '<option '.($selected == $obj->rowid ? 'selected="selected"' : '').' value="'.$obj->rowid.'">'.$langs->trans($obj->label).'</option>'; |
10452
|
10452
|
} |
10453
|
10453
|
$out .= '</select>'; |
10454
|
|
- $out .= ajax_combobox('select_' . $htmlname); |
|
10454
|
+ $out .= ajax_combobox('select_'.$htmlname); |
10455
|
10455
|
|
10456
|
10456
|
if (!empty($htmlname) && $user->admin && $info_admin) { |
10457
|
|
- $out .= ' ' . info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); |
|
10457
|
+ $out .= ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); |
10458
|
10458
|
} |
10459
|
10459
|
|
10460
|
10460
|
if (!empty($target)) { |
10461
|
|
- $sql = "SELECT c.id FROM " . $this->db->prefix() . "c_type_fees as c WHERE c.code = 'EX_KME' AND c.active = 1"; |
|
10461
|
+ $sql = "SELECT c.id FROM ".$this->db->prefix()."c_type_fees as c WHERE c.code = 'EX_KME' AND c.active = 1"; |
10462
|
10462
|
$resql = $this->db->query($sql); |
10463
|
10463
|
if ($resql) { |
10464
|
10464
|
if ($this->db->num_rows($resql) > 0) { |
10465
|
10465
|
$obj = $this->db->fetch_object($resql); |
10466
|
|
- $out .= '<script nonce="' . getNonce() . '"> |
|
10466
|
+ $out .= '<script nonce="'.getNonce().'"> |
10467
|
10467
|
$(function() { |
10468
|
|
- $("select[name=' . $target . ']").on("change", function() { |
|
10468
|
+ $("select[name=' . $target.']").on("change", function() { |
10469
|
10469
|
var current_val = $(this).val(); |
10470
|
|
- if (current_val == ' . $obj->id . ') {'; |
|
10470
|
+ if (current_val == ' . $obj->id.') {'; |
10471
|
10471
|
if (!empty($default_selected) || !empty($selected)) { |
10472
|
|
- $out .= '$("select[name=' . $htmlname . ']").val("' . ($default_selected > 0 ? $default_selected : $selected) . '");'; |
|
10472
|
+ $out .= '$("select[name='.$htmlname.']").val("'.($default_selected > 0 ? $default_selected : $selected).'");'; |
10473
|
10473
|
} |
10474
|
10474
|
|
10475
|
10475
|
$out .= ' |
10476
|
|
- $("select[name=' . $htmlname . ']").change(); |
|
10476
|
+ $("select[name=' . $htmlname.']").change(); |
10477
|
10477
|
} |
10478
|
10478
|
}); |
10479
|
10479
|
|
10480
|
|
- $("select[name=' . $htmlname . ']").change(function() { |
|
10480
|
+ $("select[name=' . $htmlname.']").change(function() { |
10481
|
10481
|
|
10482
|
|
- if ($("select[name=' . $target . ']").val() == ' . $obj->id . ') { |
|
10482
|
+ if ($("select[name=' . $target.']").val() == '.$obj->id.') { |
10483
|
10483
|
// get price of kilometer to fill the unit price |
10484
|
10484
|
$.ajax({ |
10485
|
10485
|
method: "POST", |
10486
|
10486
|
dataType: "json", |
10487
|
|
- data: { fk_c_exp_tax_cat: $(this).val(), token: \'' . currentToken() . '\' }, |
10488
|
|
- url: "' . (DOL_URL_ROOT . '/expensereport/ajax/ajaxik.php?' . implode('&', $params)) . '", |
|
10487
|
+ data: { fk_c_exp_tax_cat: $(this).val(), token: \'' . currentToken().'\' }, |
|
10488
|
+ url: "' . (DOL_URL_ROOT.'/expensereport/ajax/ajaxik.php?'.implode('&', $params)).'", |
10489
|
10489
|
}).done(function( data, textStatus, jqXHR ) { |
10490
|
10490
|
console.log(data); |
10491
|
10491
|
if (typeof data.up != "undefined") { |
10492
|
10492
|
$("input[name=value_unit]").val(data.up); |
10493
|
|
- $("select[name=' . $htmlname . ']").attr("title", data.title); |
|
10493
|
+ $("select[name=' . $htmlname.']").attr("title", data.title); |
10494
|
10494
|
} else { |
10495
|
10495
|
$("input[name=value_unit]").val(""); |
10496
|
|
- $("select[name=' . $htmlname . ']").attr("title", ""); |
|
10496
|
+ $("select[name=' . $htmlname.']").attr("title", ""); |
10497
|
10497
|
} |
10498
|
10498
|
}); |
10499
|
10499
|
} |
|
@@ -10523,18 +10523,18 @@ discard block |
|
|
block discarded – undo |
10523
|
10523
|
global $conf, $langs; |
10524
|
10524
|
|
10525
|
10525
|
$out = ''; |
10526
|
|
- $sql = "SELECT rowid, range_ik FROM " . $this->db->prefix() . "c_exp_tax_range"; |
10527
|
|
- $sql .= " WHERE entity = " . $conf->entity . " AND active = 1"; |
|
10526
|
+ $sql = "SELECT rowid, range_ik FROM ".$this->db->prefix()."c_exp_tax_range"; |
|
10527
|
+ $sql .= " WHERE entity = ".$conf->entity." AND active = 1"; |
10528
|
10528
|
|
10529
|
10529
|
$resql = $this->db->query($sql); |
10530
|
10530
|
if ($resql) { |
10531
|
|
- $out = '<select id="select_' . $htmlname . '" name="' . $htmlname . '" class="' . $htmlname . ' flat minwidth75imp">'; |
|
10531
|
+ $out = '<select id="select_'.$htmlname.'" name="'.$htmlname.'" class="'.$htmlname.' flat minwidth75imp">'; |
10532
|
10532
|
if ($useempty) { |
10533
|
10533
|
$out .= '<option value="0"></option>'; |
10534
|
10534
|
} |
10535
|
10535
|
|
10536
|
10536
|
while ($obj = $this->db->fetch_object($resql)) { |
10537
|
|
- $out .= '<option ' . ($selected == $obj->rowid ? 'selected="selected"' : '') . ' value="' . $obj->rowid . '">' . price($obj->range_ik, 0, $langs, 1, 0) . '</option>'; |
|
10537
|
+ $out .= '<option '.($selected == $obj->rowid ? 'selected="selected"' : '').' value="'.$obj->rowid.'">'.price($obj->range_ik, 0, $langs, 1, 0).'</option>'; |
10538
|
10538
|
} |
10539
|
10539
|
$out .= '</select>'; |
10540
|
10540
|
} else { |
|
@@ -10565,12 +10565,12 @@ discard block |
|
|
block discarded – undo |
10565
|
10565
|
|
10566
|
10566
|
$resql = $this->db->query($sql); |
10567
|
10567
|
if ($resql) { |
10568
|
|
- $out = '<select id="select_' . $htmlname . '" name="' . $htmlname . '" class="' . $htmlname . ' flat minwidth75imp">'; |
|
10568
|
+ $out = '<select id="select_'.$htmlname.'" name="'.$htmlname.'" class="'.$htmlname.' flat minwidth75imp">'; |
10569
|
10569
|
if ($useempty) { |
10570
|
10570
|
$out .= '<option value="0"></option>'; |
10571
|
10571
|
} |
10572
|
10572
|
if ($allchoice) { |
10573
|
|
- $out .= '<option value="-1">' . $langs->trans('AllExpenseReport') . '</option>'; |
|
10573
|
+ $out .= '<option value="-1">'.$langs->trans('AllExpenseReport').'</option>'; |
10574
|
10574
|
} |
10575
|
10575
|
|
10576
|
10576
|
$field = 'code'; |
|
@@ -10580,7 +10580,7 @@ discard block |
|
|
block discarded – undo |
10580
|
10580
|
|
10581
|
10581
|
while ($obj = $this->db->fetch_object($resql)) { |
10582
|
10582
|
$key = $langs->trans($obj->code); |
10583
|
|
- $out .= '<option ' . ($selected == $obj->{$field} ? 'selected="selected"' : '') . ' value="' . $obj->{$field} . '">' . ($key != $obj->code ? $key : $obj->label) . '</option>'; |
|
10583
|
+ $out .= '<option '.($selected == $obj->{$field} ? 'selected="selected"' : '').' value="'.$obj->{$field}.'">'.($key != $obj->code ? $key : $obj->label).'</option>'; |
10584
|
10584
|
} |
10585
|
10585
|
$out .= '</select>'; |
10586
|
10586
|
|
|
@@ -10614,7 +10614,7 @@ discard block |
|
|
block discarded – undo |
10614
|
10614
|
{ |
10615
|
10615
|
global $user, $conf, $langs; |
10616
|
10616
|
|
10617
|
|
- require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; |
|
10617
|
+ require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; |
10618
|
10618
|
|
10619
|
10619
|
if (is_null($usertofilter)) { |
10620
|
10620
|
$usertofilter = $user; |
|
@@ -10638,10 +10638,10 @@ discard block |
|
|
block discarded – undo |
10638
|
10638
|
$sql = "SELECT f.rowid, f.ref as fref, 'nolabel' as flabel, p.rowid as pid, f.ref, |
10639
|
10639
|
p.title, p.fk_soc, p.fk_statut, p.public,"; |
10640
|
10640
|
$sql .= ' s.nom as name'; |
10641
|
|
- $sql .= ' FROM ' . $this->db->prefix() . 'projet as p'; |
10642
|
|
- $sql .= ' LEFT JOIN ' . $this->db->prefix() . 'societe as s ON s.rowid = p.fk_soc,'; |
10643
|
|
- $sql .= ' ' . $this->db->prefix() . 'facture as f'; |
10644
|
|
- $sql .= " WHERE p.entity IN (" . getEntity('project') . ")"; |
|
10641
|
+ $sql .= ' FROM '.$this->db->prefix().'projet as p'; |
|
10642
|
+ $sql .= ' LEFT JOIN '.$this->db->prefix().'societe as s ON s.rowid = p.fk_soc,'; |
|
10643
|
+ $sql .= ' '.$this->db->prefix().'facture as f'; |
|
10644
|
+ $sql .= " WHERE p.entity IN (".getEntity('project').")"; |
10645
|
10645
|
$sql .= " AND f.fk_projet = p.rowid AND f.fk_statut=0"; //Brouillons seulement |
10646
|
10646
|
//if ($projectsListId) $sql.= " AND p.rowid IN (".$this->db->sanitize($projectsListId).")"; |
10647
|
10647
|
//if ($socid == 0) $sql.= " AND (p.fk_soc=0 OR p.fk_soc IS NULL)"; |
|
@@ -10652,14 +10652,14 @@ discard block |
|
|
block discarded – undo |
10652
|
10652
|
if ($resql) { |
10653
|
10653
|
// Use select2 selector |
10654
|
10654
|
if (!empty($conf->use_javascript_ajax)) { |
10655
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
10655
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
10656
|
10656
|
$comboenhancement = ajax_combobox($htmlname, array(), 0, $forcefocus); |
10657
|
10657
|
$out .= $comboenhancement; |
10658
|
10658
|
$morecss = 'minwidth200imp maxwidth500'; |
10659
|
10659
|
} |
10660
|
10660
|
|
10661
|
10661
|
if (empty($option_only)) { |
10662
|
|
- $out .= '<select class="valignmiddle flat' . ($morecss ? ' ' . $morecss : '') . '"' . ($disabled ? ' disabled="disabled"' : '') . ' id="' . $htmlname . '" name="' . $htmlname . '">'; |
|
10662
|
+ $out .= '<select class="valignmiddle flat'.($morecss ? ' '.$morecss : '').'"'.($disabled ? ' disabled="disabled"' : '').' id="'.$htmlname.'" name="'.$htmlname.'">'; |
10663
|
10663
|
} |
10664
|
10664
|
if (!empty($show_empty)) { |
10665
|
10665
|
$out .= '<option value="0" class="optiongrey">'; |
|
@@ -10689,33 +10689,33 @@ discard block |
|
|
block discarded – undo |
10689
|
10689
|
if ($showproject == 'all') { |
10690
|
10690
|
$labeltoshow .= dol_trunc($obj->ref, 18); // Invoice ref |
10691
|
10691
|
if ($obj->name) { |
10692
|
|
- $labeltoshow .= ' - ' . $obj->name; // Soc name |
|
10692
|
+ $labeltoshow .= ' - '.$obj->name; // Soc name |
10693
|
10693
|
} |
10694
|
10694
|
|
10695
|
10695
|
$disabled = 0; |
10696
|
10696
|
if ($obj->fk_statut == Project::STATUS_DRAFT) { |
10697
|
10697
|
$disabled = 1; |
10698
|
|
- $labeltoshow .= ' - ' . $langs->trans("Draft"); |
|
10698
|
+ $labeltoshow .= ' - '.$langs->trans("Draft"); |
10699
|
10699
|
} elseif ($obj->fk_statut == Project::STATUS_CLOSED) { |
10700
|
10700
|
if ($discard_closed == 2) { |
10701
|
10701
|
$disabled = 1; |
10702
|
10702
|
} |
10703
|
|
- $labeltoshow .= ' - ' . $langs->trans("Closed"); |
|
10703
|
+ $labeltoshow .= ' - '.$langs->trans("Closed"); |
10704
|
10704
|
} elseif ($socid > 0 && (!empty($obj->fk_soc) && $obj->fk_soc != $socid)) { |
10705
|
10705
|
$disabled = 1; |
10706
|
|
- $labeltoshow .= ' - ' . $langs->trans("LinkedToAnotherCompany"); |
|
10706
|
+ $labeltoshow .= ' - '.$langs->trans("LinkedToAnotherCompany"); |
10707
|
10707
|
} |
10708
|
10708
|
} |
10709
|
10709
|
|
10710
|
10710
|
if (!empty($selected) && $selected == $obj->rowid) { |
10711
|
|
- $out .= '<option value="' . $obj->rowid . '" selected'; |
|
10711
|
+ $out .= '<option value="'.$obj->rowid.'" selected'; |
10712
|
10712
|
//if ($disabled) $out.=' disabled'; // with select2, field can't be preselected if disabled |
10713
|
|
- $out .= '>' . $labeltoshow . '</option>'; |
|
10713
|
+ $out .= '>'.$labeltoshow.'</option>'; |
10714
|
10714
|
} else { |
10715
|
10715
|
if ($hideunselectables && $disabled && ($selected != $obj->rowid)) { |
10716
|
10716
|
$resultat = ''; |
10717
|
10717
|
} else { |
10718
|
|
- $resultat = '<option value="' . $obj->rowid . '"'; |
|
10718
|
+ $resultat = '<option value="'.$obj->rowid.'"'; |
10719
|
10719
|
if ($disabled) { |
10720
|
10720
|
$resultat .= ' disabled'; |
10721
|
10721
|
} |
|
@@ -10767,22 +10767,22 @@ discard block |
|
|
block discarded – undo |
10767
|
10767
|
|
10768
|
10768
|
$sql = 'SELECT f.rowid, f.entity, f.titre as title, f.suspended, f.fk_soc'; |
10769
|
10769
|
//$sql.= ', el.fk_source'; |
10770
|
|
- $sql .= ' FROM ' . MAIN_DB_PREFIX . 'facture_rec as f'; |
10771
|
|
- $sql .= " WHERE f.entity IN (" . getEntity('invoice') . ")"; |
|
10770
|
+ $sql .= ' FROM '.MAIN_DB_PREFIX.'facture_rec as f'; |
|
10771
|
+ $sql .= " WHERE f.entity IN (".getEntity('invoice').")"; |
10772
|
10772
|
$sql .= " ORDER BY f.titre ASC"; |
10773
|
10773
|
|
10774
|
10774
|
$resql = $this->db->query($sql); |
10775
|
10775
|
if ($resql) { |
10776
|
10776
|
// Use select2 selector |
10777
|
10777
|
if (!empty($conf->use_javascript_ajax)) { |
10778
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
10778
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
10779
|
10779
|
$comboenhancement = ajax_combobox($htmlname, array(), 0, $forcefocus); |
10780
|
10780
|
$out .= $comboenhancement; |
10781
|
10781
|
$morecss = 'minwidth200imp maxwidth500'; |
10782
|
10782
|
} |
10783
|
10783
|
|
10784
|
10784
|
if (empty($option_only)) { |
10785
|
|
- $out .= '<select class="valignmiddle flat' . ($morecss ? ' ' . $morecss : '') . '"' . ($disabled ? ' disabled="disabled"' : '') . ' id="' . $htmlname . '" name="' . $htmlname . '">'; |
|
10785
|
+ $out .= '<select class="valignmiddle flat'.($morecss ? ' '.$morecss : '').'"'.($disabled ? ' disabled="disabled"' : '').' id="'.$htmlname.'" name="'.$htmlname.'">'; |
10786
|
10786
|
} |
10787
|
10787
|
if (!empty($show_empty)) { |
10788
|
10788
|
$out .= '<option value="0" class="optiongrey">'; |
|
@@ -10801,19 +10801,19 @@ discard block |
|
|
block discarded – undo |
10801
|
10801
|
$disabled = 0; |
10802
|
10802
|
if (!empty($obj->suspended)) { |
10803
|
10803
|
$disabled = 1; |
10804
|
|
- $labeltoshow .= ' - ' . $langs->trans("Closed"); |
|
10804
|
+ $labeltoshow .= ' - '.$langs->trans("Closed"); |
10805
|
10805
|
} |
10806
|
10806
|
|
10807
|
10807
|
|
10808
|
10808
|
if (!empty($selected) && $selected == $obj->rowid) { |
10809
|
|
- $out .= '<option value="' . $obj->rowid . '" selected'; |
|
10809
|
+ $out .= '<option value="'.$obj->rowid.'" selected'; |
10810
|
10810
|
//if ($disabled) $out.=' disabled'; // with select2, field can't be preselected if disabled |
10811
|
|
- $out .= '>' . $labeltoshow . '</option>'; |
|
10811
|
+ $out .= '>'.$labeltoshow.'</option>'; |
10812
|
10812
|
} else { |
10813
|
10813
|
if ($disabled && ($selected != $obj->rowid)) { |
10814
|
10814
|
$resultat = ''; |
10815
|
10815
|
} else { |
10816
|
|
- $resultat = '<option value="' . $obj->rowid . '"'; |
|
10816
|
+ $resultat = '<option value="'.$obj->rowid.'"'; |
10817
|
10817
|
if ($disabled) { |
10818
|
10818
|
$resultat .= ' disabled'; |
10819
|
10819
|
} |
|
@@ -10853,14 +10853,14 @@ discard block |
|
|
block discarded – undo |
10853
|
10853
|
global $langs; |
10854
|
10854
|
|
10855
|
10855
|
if ($search_component_params_hidden != '' && !preg_match('/^\(.*\)$/', $search_component_params_hidden)) { // If $search_component_params_hidden does not start and end with () |
10856
|
|
- $search_component_params_hidden = '(' . $search_component_params_hidden . ')'; |
|
10856
|
+ $search_component_params_hidden = '('.$search_component_params_hidden.')'; |
10857
|
10857
|
} |
10858
|
10858
|
|
10859
|
10859
|
$ret = ''; |
10860
|
10860
|
|
10861
|
10861
|
$ret .= '<div class="divadvancedsearchfieldcomp centpercent inline-block">'; |
10862
|
10862
|
$ret .= '<a href="#" class="dropdownsearch-toggle unsetcolor">'; |
10863
|
|
- $ret .= '<span class="fas fa-filter linkobject boxfilter paddingright pictofixedwidth hideonsmartphone" title="' . dol_escape_htmltag($langs->trans("Filters")) . '" id="idsubimgproductdistribution"></span>'; |
|
10863
|
+ $ret .= '<span class="fas fa-filter linkobject boxfilter paddingright pictofixedwidth hideonsmartphone" title="'.dol_escape_htmltag($langs->trans("Filters")).'" id="idsubimgproductdistribution"></span>'; |
10864
|
10864
|
$ret .= '</a>'; |
10865
|
10865
|
|
10866
|
10866
|
$ret .= '<div class="divadvancedsearchfieldcompinput inline-block minwidth500 maxwidth300onsmartphone">'; |
|
@@ -10904,29 +10904,29 @@ discard block |
|
|
block discarded – undo |
10904
|
10904
|
$ret .= '<input type="hidden" name="show_search_component_params_hidden" value="1">'; |
10905
|
10905
|
} |
10906
|
10906
|
$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%')) -->"; |
10907
|
|
- $ret .= '<input type="hidden" id="search_component_params_hidden" name="search_component_params_hidden" value="' . dol_escape_htmltag($search_component_params_hidden) . '">'; |
|
10907
|
+ $ret .= '<input type="hidden" id="search_component_params_hidden" name="search_component_params_hidden" value="'.dol_escape_htmltag($search_component_params_hidden).'">'; |
10908
|
10908
|
// $ret .= "<!-- sql= ".forgeSQLFromUniversalSearchCriteria($search_component_params_hidden, $errormessage)." -->"; |
10909
|
10909
|
|
10910
|
10910
|
// For compatibility with forms that show themself the search criteria in addition of this component, we output these fields |
10911
|
10911
|
foreach ($arrayofcriterias as $criteria) { |
10912
|
10912
|
foreach ($criteria as $criteriafamilykey => $criteriafamilyval) { |
10913
|
|
- if (in_array('search_' . $criteriafamilykey, $arrayofinputfieldsalreadyoutput)) { |
|
10913
|
+ if (in_array('search_'.$criteriafamilykey, $arrayofinputfieldsalreadyoutput)) { |
10914
|
10914
|
continue; |
10915
|
10915
|
} |
10916
|
10916
|
if (in_array($criteriafamilykey, array('rowid', 'ref_ext', 'entity', 'extraparams'))) { |
10917
|
10917
|
continue; |
10918
|
10918
|
} |
10919
|
10919
|
if (in_array($criteriafamilyval['type'], array('date', 'datetime', 'timestamp'))) { |
10920
|
|
- $ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_start">'; |
10921
|
|
- $ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_startyear">'; |
10922
|
|
- $ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_startmonth">'; |
10923
|
|
- $ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_startday">'; |
10924
|
|
- $ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_end">'; |
10925
|
|
- $ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_endyear">'; |
10926
|
|
- $ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_endmonth">'; |
10927
|
|
- $ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_endday">'; |
|
10920
|
+ $ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_start">'; |
|
10921
|
+ $ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_startyear">'; |
|
10922
|
+ $ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_startmonth">'; |
|
10923
|
+ $ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_startday">'; |
|
10924
|
+ $ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_end">'; |
|
10925
|
+ $ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_endyear">'; |
|
10926
|
+ $ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_endmonth">'; |
|
10927
|
+ $ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_endday">'; |
10928
|
10928
|
} else { |
10929
|
|
- $ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '">'; |
|
10929
|
+ $ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'">'; |
10930
|
10930
|
} |
10931
|
10931
|
} |
10932
|
10932
|
} |
|
@@ -10934,7 +10934,7 @@ discard block |
|
|
block discarded – undo |
10934
|
10934
|
$ret .= '</div>'; |
10935
|
10935
|
|
10936
|
10936
|
$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"; |
10937
|
|
- $ret .= '<input type="text" placeholder="' . $langs->trans("Filters") . '" id="search_component_params_input" name="search_component_params_input" class="noborderbottom search_component_input" value="">'; |
|
10937
|
+ $ret .= '<input type="text" placeholder="'.$langs->trans("Filters").'" id="search_component_params_input" name="search_component_params_input" class="noborderbottom search_component_input" value="">'; |
10938
|
10938
|
|
10939
|
10939
|
$ret .= '</div>'; |
10940
|
10940
|
$ret .= '</div>'; |
|
@@ -11008,7 +11008,7 @@ discard block |
|
|
block discarded – undo |
11008
|
11008
|
|
11009
|
11009
|
$TModels = array(); |
11010
|
11010
|
|
11011
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php'; |
|
11011
|
+ include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; |
11012
|
11012
|
$formmail = new FormMail($this->db); |
11013
|
11013
|
$result = $formmail->fetchAllEMailTemplate($modelType, $user, $langs); |
11014
|
11014
|
|
|
@@ -11021,17 +11021,17 @@ discard block |
|
|
block discarded – undo |
11021
|
11021
|
} |
11022
|
11022
|
} |
11023
|
11023
|
|
11024
|
|
- $retstring .= '<select class="flat" id="select_' . $prefix . 'model_mail" name="' . $prefix . 'model_mail">'; |
|
11024
|
+ $retstring .= '<select class="flat" id="select_'.$prefix.'model_mail" name="'.$prefix.'model_mail">'; |
11025
|
11025
|
|
11026
|
11026
|
foreach ($TModels as $id_model => $label_model) { |
11027
|
|
- $retstring .= '<option value="' . $id_model . '"'; |
11028
|
|
- $retstring .= ">" . $label_model . "</option>"; |
|
11027
|
+ $retstring .= '<option value="'.$id_model.'"'; |
|
11028
|
+ $retstring .= ">".$label_model."</option>"; |
11029
|
11029
|
} |
11030
|
11030
|
|
11031
|
11031
|
$retstring .= "</select>"; |
11032
|
11032
|
|
11033
|
11033
|
if ($addjscombo) { |
11034
|
|
- $retstring .= ajax_combobox('select_' . $prefix . 'model_mail'); |
|
11034
|
+ $retstring .= ajax_combobox('select_'.$prefix.'model_mail'); |
11035
|
11035
|
} |
11036
|
11036
|
|
11037
|
11037
|
return $retstring; |
|
@@ -11082,16 +11082,16 @@ discard block |
|
|
block discarded – undo |
11082
|
11082
|
|
11083
|
11083
|
foreach ($buttons as $button) { |
11084
|
11084
|
$addclass = empty($button['addclass']) ? '' : $button['addclass']; |
11085
|
|
- $retstring .= '<input type="submit" class="button button-' . $button['name'] . ($morecss ? ' ' . $morecss : '') . ' ' . $addclass . '" name="' . $button['name'] . '" value="' . dol_escape_htmltag($langs->trans($button['label_key'])) . '">'; |
|
11085
|
+ $retstring .= '<input type="submit" class="button button-'.$button['name'].($morecss ? ' '.$morecss : '').' '.$addclass.'" name="'.$button['name'].'" value="'.dol_escape_htmltag($langs->trans($button['label_key'])).'">'; |
11086
|
11086
|
} |
11087
|
11087
|
$retstring .= $withoutdiv ? '' : '</div>'; |
11088
|
11088
|
|
11089
|
11089
|
if ($dol_openinpopup) { |
11090
|
|
- $retstring .= '<!-- buttons are shown into a $dol_openinpopup=' . $dol_openinpopup . ' context, so we enable the close of dialog on cancel -->' . "\n"; |
11091
|
|
- $retstring .= '<script nonce="' . getNonce() . '">'; |
|
11090
|
+ $retstring .= '<!-- buttons are shown into a $dol_openinpopup='.$dol_openinpopup.' context, so we enable the close of dialog on cancel -->'."\n"; |
|
11091
|
+ $retstring .= '<script nonce="'.getNonce().'">'; |
11092
|
11092
|
$retstring .= 'jQuery(".button-cancel").click(function(e) { |
11093
|
|
- e.preventDefault(); console.log(\'We click on cancel in iframe popup ' . $dol_openinpopup . '\'); |
11094
|
|
- window.parent.jQuery(\'#idfordialog' . $dol_openinpopup . '\').dialog(\'close\'); |
|
11093
|
+ e.preventDefault(); console.log(\'We click on cancel in iframe popup ' . $dol_openinpopup.'\'); |
|
11094
|
+ window.parent.jQuery(\'#idfordialog' . $dol_openinpopup.'\').dialog(\'close\'); |
11095
|
11095
|
});'; |
11096
|
11096
|
$retstring .= '</script>'; |
11097
|
11097
|
} |
|
@@ -11120,7 +11120,7 @@ discard block |
|
|
block discarded – undo |
11120
|
11120
|
dol_syslog(__METHOD__, LOG_DEBUG); |
11121
|
11121
|
|
11122
|
11122
|
$sql = "SELECT rowid, code, label as label"; |
11123
|
|
- $sql .= " FROM " . MAIN_DB_PREFIX . 'c_invoice_subtype'; |
|
11123
|
+ $sql .= " FROM ".MAIN_DB_PREFIX.'c_invoice_subtype'; |
11124
|
11124
|
$sql .= " WHERE active = 1"; |
11125
|
11125
|
|
11126
|
11126
|
$resql = $this->db->query($sql); |
|
@@ -11131,7 +11131,7 @@ discard block |
|
|
block discarded – undo |
11131
|
11131
|
$obj = $this->db->fetch_object($resql); |
11132
|
11132
|
|
11133
|
11133
|
// If translation exists, we use it, otherwise we take the default wording |
11134
|
|
- $label = ($langs->trans("InvoiceSubtype" . $obj->rowid) != "InvoiceSubtype" . $obj->rowid) ? $langs->trans("InvoiceSubtype" . $obj->rowid) : (($obj->label != '-') ? $obj->label : ''); |
|
11134
|
+ $label = ($langs->trans("InvoiceSubtype".$obj->rowid) != "InvoiceSubtype".$obj->rowid) ? $langs->trans("InvoiceSubtype".$obj->rowid) : (($obj->label != '-') ? $obj->label : ''); |
11135
|
11135
|
$this->cache_invoice_subtype[$obj->rowid]['rowid'] = $obj->rowid; |
11136
|
11136
|
$this->cache_invoice_subtype[$obj->rowid]['code'] = $obj->code; |
11137
|
11137
|
$this->cache_invoice_subtype[$obj->rowid]['label'] = $label; |
|
@@ -11163,18 +11163,18 @@ discard block |
|
|
block discarded – undo |
11163
|
11163
|
global $langs, $user; |
11164
|
11164
|
|
11165
|
11165
|
$out = ''; |
11166
|
|
- dol_syslog(__METHOD__ . " selected=" . $selected . ", htmlname=" . $htmlname, LOG_DEBUG); |
|
11166
|
+ dol_syslog(__METHOD__." selected=".$selected.", htmlname=".$htmlname, LOG_DEBUG); |
11167
|
11167
|
|
11168
|
11168
|
$this->load_cache_invoice_subtype(); |
11169
|
11169
|
|
11170
|
|
- $out .= '<select id="' . $htmlname . '" class="flat selectsubtype' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">'; |
|
11170
|
+ $out .= '<select id="'.$htmlname.'" class="flat selectsubtype'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">'; |
11171
|
11171
|
if ($addempty) { |
11172
|
11172
|
$out .= '<option value="0"> </option>'; |
11173
|
11173
|
} |
11174
|
11174
|
|
11175
|
11175
|
foreach ($this->cache_invoice_subtype as $rowid => $subtype) { |
11176
|
11176
|
$label = $subtype['label']; |
11177
|
|
- $out .= '<option value="' . $subtype['rowid'] . '"'; |
|
11177
|
+ $out .= '<option value="'.$subtype['rowid'].'"'; |
11178
|
11178
|
if ($selected == $subtype['rowid']) { |
11179
|
11179
|
$out .= ' selected="selected"'; |
11180
|
11180
|
} |