|
@@ -123,7 +123,7 @@ discard block |
|
|
block discarded – undo |
123
|
123
|
if (getDolGlobalString('MAIN_USE_JQUERY_JEDITABLE') && !preg_match('/^select;/', $typeofdata)) { |
124
|
124
|
if (!empty($perm)) { |
125
|
125
|
$tmp = explode(':', $typeofdata); |
126
|
|
- $ret .= '<div class="editkey_' . $tmp[0] . (!empty($tmp[1]) ? ' ' . $tmp[1] : '') . '" id="' . $htmlname . '">'; |
|
126
|
+ $ret .= '<div class="editkey_'.$tmp[0].(!empty($tmp[1]) ? ' '.$tmp[1] : '').'" id="'.$htmlname.'">'; |
127
|
127
|
if ($fieldrequired) { |
128
|
128
|
$ret .= '<span class="fieldrequired">'; |
129
|
129
|
} |
|
@@ -135,7 +135,7 @@ discard block |
|
|
block discarded – undo |
135
|
135
|
if ($fieldrequired) { |
136
|
136
|
$ret .= '</span>'; |
137
|
137
|
} |
138
|
|
- $ret .= '</div>' . "\n"; |
|
138
|
+ $ret .= '</div>'."\n"; |
139
|
139
|
} else { |
140
|
140
|
if ($fieldrequired) { |
141
|
141
|
$ret .= '<span class="fieldrequired">'; |
|
@@ -173,8 +173,8 @@ discard block |
|
|
block discarded – undo |
173
|
173
|
if (empty($notabletag) && $perm) { |
174
|
174
|
$ret .= '<td class="right">'; |
175
|
175
|
} |
176
|
|
- if ($htmlname && GETPOST('action', 'aZ09') != 'edit' . $htmlname && $perm) { |
177
|
|
- $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>'; |
|
176
|
+ if ($htmlname && GETPOST('action', 'aZ09') != 'edit'.$htmlname && $perm) { |
|
177
|
+ $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>'; |
178
|
178
|
} |
179
|
179
|
if (!empty($notabletag) && $notabletag == 1) { |
180
|
180
|
if ($text) { |
|
@@ -241,7 +241,7 @@ discard block |
|
|
block discarded – undo |
241
|
241
|
} elseif ($reg[1] == 'int') { |
242
|
242
|
$typeofdata = 'numeric'; |
243
|
243
|
} else { |
244
|
|
- return 'ErrorBadParameter ' . $typeofdata; |
|
244
|
+ return 'ErrorBadParameter '.$typeofdata; |
245
|
245
|
} |
246
|
246
|
} |
247
|
247
|
|
|
@@ -252,13 +252,13 @@ discard block |
|
|
block discarded – undo |
252
|
252
|
if ($editaction == '') { |
253
|
253
|
$editaction = GETPOST('action', 'aZ09'); |
254
|
254
|
} |
255
|
|
- $editmode = ($editaction == 'edit' . $htmlname); |
|
255
|
+ $editmode = ($editaction == 'edit'.$htmlname); |
256
|
256
|
if ($editmode) { // edit mode |
257
|
257
|
$ret .= "<!-- formeditfieldval -->\n"; |
258
|
|
- $ret .= '<form method="post" action="' . $_SERVER["PHP_SELF"] . ($moreparam ? '?' . $moreparam : '') . '">'; |
259
|
|
- $ret .= '<input type="hidden" name="action" value="set' . $htmlname . '">'; |
260
|
|
- $ret .= '<input type="hidden" name="token" value="' . newToken() . '">'; |
261
|
|
- $ret .= '<input type="hidden" name="' . $paramid . '" value="' . $object->id . '">'; |
|
258
|
+ $ret .= '<form method="post" action="'.$_SERVER["PHP_SELF"].($moreparam ? '?'.$moreparam : '').'">'; |
|
259
|
+ $ret .= '<input type="hidden" name="action" value="set'.$htmlname.'">'; |
|
260
|
+ $ret .= '<input type="hidden" name="token" value="'.newToken().'">'; |
|
261
|
+ $ret .= '<input type="hidden" name="'.$paramid.'" value="'.$object->id.'">'; |
262
|
262
|
if (empty($notabletag)) { |
263
|
263
|
$ret .= '<table class="nobordernopadding centpercent">'; |
264
|
264
|
} |
|
@@ -267,28 +267,28 @@ discard block |
|
|
block discarded – undo |
267
|
267
|
} |
268
|
268
|
if (preg_match('/^(string|safehtmlstring|email|phone|url)/', $typeofdata)) { |
269
|
269
|
$tmp = explode(':', $typeofdata); |
270
|
|
- $ret .= '<input type="text" id="' . $htmlname . '" name="' . $htmlname . '" value="' . ($editvalue ? $editvalue : $value) . '"' . (empty($tmp[1]) ? '' : ' size="' . $tmp[1] . '"') . ' autofocus>'; |
|
270
|
+ $ret .= '<input type="text" id="'.$htmlname.'" name="'.$htmlname.'" value="'.($editvalue ? $editvalue : $value).'"'.(empty($tmp[1]) ? '' : ' size="'.$tmp[1].'"').' autofocus>'; |
271
|
271
|
} elseif (preg_match('/^(integer)/', $typeofdata)) { |
272
|
272
|
$tmp = explode(':', $typeofdata); |
273
|
273
|
$valuetoshow = price2num($editvalue ? $editvalue : $value, 0); |
274
|
|
- $ret .= '<input type="text" id="' . $htmlname . '" name="' . $htmlname . '" value="' . $valuetoshow . '"' . (empty($tmp[1]) ? '' : ' size="' . $tmp[1] . '"') . ' autofocus>'; |
|
274
|
+ $ret .= '<input type="text" id="'.$htmlname.'" name="'.$htmlname.'" value="'.$valuetoshow.'"'.(empty($tmp[1]) ? '' : ' size="'.$tmp[1].'"').' autofocus>'; |
275
|
275
|
} elseif (preg_match('/^(numeric|amount)/', $typeofdata)) { |
276
|
276
|
$tmp = explode(':', $typeofdata); |
277
|
277
|
$valuetoshow = price2num($editvalue ? $editvalue : $value); |
278
|
|
- $ret .= '<input type="text" id="' . $htmlname . '" name="' . $htmlname . '" value="' . ($valuetoshow != '' ? price($valuetoshow) : '') . '"' . (empty($tmp[1]) ? '' : ' size="' . $tmp[1] . '"') . ' autofocus>'; |
|
278
|
+ $ret .= '<input type="text" id="'.$htmlname.'" name="'.$htmlname.'" value="'.($valuetoshow != '' ? price($valuetoshow) : '').'"'.(empty($tmp[1]) ? '' : ' size="'.$tmp[1].'"').' autofocus>'; |
279
|
279
|
} elseif (preg_match('/^(checkbox)/', $typeofdata)) { |
280
|
280
|
$tmp = explode(':', $typeofdata); |
281
|
|
- $ret .= '<input type="checkbox" id="' . $htmlname . '" name="' . $htmlname . '" value="' . ($value ? $value : 'on') . '"' . ($value ? ' checked' : '') . (empty($tmp[1]) ? '' : $tmp[1]) . '/>'; |
|
281
|
+ $ret .= '<input type="checkbox" id="'.$htmlname.'" name="'.$htmlname.'" value="'.($value ? $value : 'on').'"'.($value ? ' checked' : '').(empty($tmp[1]) ? '' : $tmp[1]).'/>'; |
282
|
282
|
} elseif (preg_match('/^text/', $typeofdata) || preg_match('/^note/', $typeofdata)) { // if wysiwyg is enabled $typeofdata = 'ckeditor' |
283
|
283
|
$tmp = explode(':', $typeofdata); |
284
|
284
|
$cols = (empty($tmp[2]) ? '' : $tmp[2]); |
285
|
285
|
$morealt = ''; |
286
|
286
|
if (preg_match('/%/', $cols)) { |
287
|
|
- $morealt = ' style="width: ' . $cols . '"'; |
|
287
|
+ $morealt = ' style="width: '.$cols.'"'; |
288
|
288
|
$cols = ''; |
289
|
289
|
} |
290
|
290
|
$valuetoshow = ($editvalue ? $editvalue : $value); |
291
|
|
- $ret .= '<textarea id="' . $htmlname . '" name="' . $htmlname . '" wrap="soft" rows="' . (empty($tmp[1]) ? '20' : $tmp[1]) . '"' . ($cols ? ' cols="' . $cols . '"' : 'class="quatrevingtpercent"') . $morealt . '" autofocus>'; |
|
291
|
+ $ret .= '<textarea id="'.$htmlname.'" name="'.$htmlname.'" wrap="soft" rows="'.(empty($tmp[1]) ? '20' : $tmp[1]).'"'.($cols ? ' cols="'.$cols.'"' : 'class="quatrevingtpercent"').$morealt.'" autofocus>'; |
292
|
292
|
// textarea convert automatically entities chars into simple chars. |
293
|
293
|
// So we convert & into & so a string like 'a < <b>b</b><br>é<br><script>alert('X');<script>' stay a correct html and is not converted by textarea component when wysiwyg is off. |
294
|
294
|
$valuetoshow = str_replace('&', '&', $valuetoshow); |
|
@@ -298,12 +298,12 @@ discard block |
|
|
block discarded – undo |
298
|
298
|
$addnowlink = empty($moreoptions['addnowlink']) ? 0 : $moreoptions['addnowlink']; |
299
|
299
|
$adddateof = empty($moreoptions['adddateof']) ? '' : $moreoptions['adddateof']; |
300
|
300
|
$labeladddateof = empty($moreoptions['labeladddateof']) ? '' : $moreoptions['labeladddateof']; |
301
|
|
- $ret .= $this->selectDate($value, $htmlname, 0, 0, 1, 'form' . $htmlname, 1, $addnowlink, 0, '', '', $adddateof, '', 1, $labeladddateof, '', $gm); |
|
301
|
+ $ret .= $this->selectDate($value, $htmlname, 0, 0, 1, 'form'.$htmlname, 1, $addnowlink, 0, '', '', $adddateof, '', 1, $labeladddateof, '', $gm); |
302
|
302
|
} elseif ($typeofdata == 'dayhour' || $typeofdata == 'datehourpicker') { |
303
|
303
|
$addnowlink = empty($moreoptions['addnowlink']) ? 0 : $moreoptions['addnowlink']; |
304
|
304
|
$adddateof = empty($moreoptions['adddateof']) ? '' : $moreoptions['adddateof']; |
305
|
305
|
$labeladddateof = empty($moreoptions['labeladddateof']) ? '' : $moreoptions['labeladddateof']; |
306
|
|
- $ret .= $this->selectDate($value, $htmlname, 1, 1, 1, 'form' . $htmlname, 1, $addnowlink, 0, '', '', $adddateof, '', 1, $labeladddateof, '', $gm); |
|
306
|
+ $ret .= $this->selectDate($value, $htmlname, 1, 1, 1, 'form'.$htmlname, 1, $addnowlink, 0, '', '', $adddateof, '', 1, $labeladddateof, '', $gm); |
307
|
307
|
} elseif (preg_match('/^select;/', $typeofdata)) { |
308
|
308
|
$arraydata = explode(',', preg_replace('/^select;/', '', $typeofdata)); |
309
|
309
|
$arraylist = array(); |
|
@@ -317,7 +317,7 @@ discard block |
|
|
block discarded – undo |
317
|
317
|
// TODO Not yet implemented. See code for extrafields |
318
|
318
|
} elseif (preg_match('/^ckeditor/', $typeofdata)) { |
319
|
319
|
$tmp = explode(':', $typeofdata); // Example: ckeditor:dolibarr_zzz:width:height:savemethod:toolbarstartexpanded:rows:cols:uselocalbrowser |
320
|
|
- require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php'; |
|
320
|
+ require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; |
321
|
321
|
$doleditor = new DolEditor($htmlname, ($editvalue ? $editvalue : $value), (empty($tmp[2]) ? '' : $tmp[2]), (empty($tmp[3]) ? 100 : (int) $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 : (int) $tmp[6]), (empty($tmp[7]) ? '100' : $tmp[7])); |
322
|
322
|
$ret .= $doleditor->Create(1); |
323
|
323
|
} elseif ($typeofdata == 'asis') { |
|
@@ -332,19 +332,19 @@ discard block |
|
|
block discarded – undo |
332
|
332
|
$ret .= '<td>'; |
333
|
333
|
} |
334
|
334
|
//else $ret.='<div class="clearboth"></div>'; |
335
|
|
- $ret .= '<input type="submit" class="smallpaddingimp nomargingtop nomarginbottom button' . (empty($notabletag) ? '' : ' ') . '" name="modify" value="' . $langs->trans("Modify") . '">'; |
|
335
|
+ $ret .= '<input type="submit" class="smallpaddingimp nomargingtop nomarginbottom button'.(empty($notabletag) ? '' : ' ').'" name="modify" value="'.$langs->trans("Modify").'">'; |
336
|
336
|
if (preg_match('/ckeditor|textarea/', $typeofdata) && empty($notabletag)) { |
337
|
|
- $ret .= '<br>' . "\n"; |
|
337
|
+ $ret .= '<br>'."\n"; |
338
|
338
|
} |
339
|
|
- $ret .= '<input type="submit" class="smallpaddingimp nomargingtop nomarginbottom button button-cancel' . (empty($notabletag) ? '' : ' ') . '" name="cancel" value="' . $langs->trans("Cancel") . '">'; |
|
339
|
+ $ret .= '<input type="submit" class="smallpaddingimp nomargingtop nomarginbottom button button-cancel'.(empty($notabletag) ? '' : ' ').'" name="cancel" value="'.$langs->trans("Cancel").'">'; |
340
|
340
|
if (empty($notabletag)) { |
341
|
341
|
$ret .= '</td>'; |
342
|
342
|
} |
343
|
343
|
|
344
|
344
|
if (empty($notabletag)) { |
345
|
|
- $ret .= '</tr></table>' . "\n"; |
|
345
|
+ $ret .= '</tr></table>'."\n"; |
346
|
346
|
} |
347
|
|
- $ret .= '</form>' . "\n"; |
|
347
|
+ $ret .= '</form>'."\n"; |
348
|
348
|
} else { // view mode |
349
|
349
|
if (preg_match('/^email/', $typeofdata)) { |
350
|
350
|
$ret .= dol_print_email($value, 0, 0, 0, 0, 1); |
|
@@ -356,15 +356,15 @@ discard block |
|
|
block discarded – undo |
356
|
356
|
$ret .= ($value != '' ? price($value, 0, $langs, 0, -1, -1, $conf->currency) : ''); |
357
|
357
|
} elseif (preg_match('/^checkbox/', $typeofdata)) { |
358
|
358
|
$tmp = explode(':', $typeofdata); |
359
|
|
- $ret .= '<input type="checkbox" disabled id="' . $htmlname . '" name="' . $htmlname . '" value="' . $value . '"' . ($value ? ' checked' : '') . ($tmp[1] ? $tmp[1] : '') . '/>'; |
|
359
|
+ $ret .= '<input type="checkbox" disabled id="'.$htmlname.'" name="'.$htmlname.'" value="'.$value.'"'.($value ? ' checked' : '').($tmp[1] ? $tmp[1] : '').'/>'; |
360
|
360
|
} elseif (preg_match('/^text/', $typeofdata) || preg_match('/^note/', $typeofdata)) { |
361
|
361
|
$ret .= dol_htmlwithnojs(dol_string_onlythesehtmltags(dol_htmlentitiesbr($value), 1, 1, 1)); |
362
|
362
|
} elseif (preg_match('/^(safehtmlstring|restricthtml)/', $typeofdata)) { // 'restricthtml' is not an allowed type for editfieldval. Value is 'safehtmlstring' |
363
|
363
|
$ret .= dol_htmlwithnojs(dol_string_onlythesehtmltags($value)); |
364
|
364
|
} elseif ($typeofdata == 'day' || $typeofdata == 'datepicker') { |
365
|
|
- $ret .= '<span class="valuedate">' . dol_print_date($value, 'day', $gm) . '</span>'; |
|
365
|
+ $ret .= '<span class="valuedate">'.dol_print_date($value, 'day', $gm).'</span>'; |
366
|
366
|
} elseif ($typeofdata == 'dayhour' || $typeofdata == 'datehourpicker') { |
367
|
|
- $ret .= '<span class="valuedate">' . dol_print_date($value, 'dayhour', $gm) . '</span>'; |
|
367
|
+ $ret .= '<span class="valuedate">'.dol_print_date($value, 'dayhour', $gm).'</span>'; |
368
|
368
|
} elseif (preg_match('/^select;/', $typeofdata)) { |
369
|
369
|
$arraydata = explode(',', preg_replace('/^select;/', '', $typeofdata)); |
370
|
370
|
$arraylist = array(); |
|
@@ -375,9 +375,9 @@ discard block |
|
|
block discarded – undo |
375
|
375
|
$ret .= $arraylist[$value]; |
376
|
376
|
if ($htmlname == 'fk_product_type') { |
377
|
377
|
if ($value == 0) { |
378
|
|
- $ret = img_picto($langs->trans("Product"), 'product', 'class="paddingleftonly paddingrightonly colorgrey"') . $ret; |
|
378
|
+ $ret = img_picto($langs->trans("Product"), 'product', 'class="paddingleftonly paddingrightonly colorgrey"').$ret; |
379
|
379
|
} else { |
380
|
|
- $ret = img_picto($langs->trans("Service"), 'service', 'class="paddingleftonly paddingrightonly colorgrey"') . $ret; |
|
380
|
+ $ret = img_picto($langs->trans("Service"), 'service', 'class="paddingleftonly paddingrightonly colorgrey"').$ret; |
381
|
381
|
} |
382
|
382
|
} |
383
|
383
|
} elseif (preg_match('/^ckeditor/', $typeofdata)) { |
|
@@ -385,7 +385,7 @@ discard block |
|
|
block discarded – undo |
385
|
385
|
if (getDolGlobalString('MAIN_DISABLE_NOTES_TAB')) { |
386
|
386
|
$firstline = preg_replace('/<br>.*/', '', $tmpcontent); |
387
|
387
|
$firstline = preg_replace('/[\n\r].*/', '', $firstline); |
388
|
|
- $tmpcontent = $firstline . ((strlen($firstline) != strlen($tmpcontent)) ? '...' : ''); |
|
388
|
+ $tmpcontent = $firstline.((strlen($firstline) != strlen($tmpcontent)) ? '...' : ''); |
389
|
389
|
} |
390
|
390
|
// We don't use dol_escape_htmltag to get the html formatting active, but this need we must also |
391
|
391
|
// clean data from some dangerous html |
|
@@ -394,7 +394,7 @@ discard block |
|
|
block discarded – undo |
394
|
394
|
if (empty($moreoptions['valuealreadyhtmlescaped'])) { |
395
|
395
|
$ret .= dol_escape_htmltag($value); |
396
|
396
|
} else { |
397
|
|
- $ret .= $value; // $value must be already html escaped. |
|
397
|
+ $ret .= $value; // $value must be already html escaped. |
398
|
398
|
} |
399
|
399
|
} |
400
|
400
|
|
|
@@ -432,7 +432,7 @@ discard block |
|
|
block discarded – undo |
432
|
432
|
|
433
|
433
|
if (is_array($arrayoflangcode) && count($arrayoflangcode)) { |
434
|
434
|
if (!is_object($extralanguages)) { |
435
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/class/extralanguages.class.php'; |
|
435
|
+ include_once DOL_DOCUMENT_ROOT.'/core/class/extralanguages.class.php'; |
436
|
436
|
$extralanguages = new ExtraLanguages($this->db); |
437
|
437
|
} |
438
|
438
|
$extralanguages->fetch_name_extralanguages('societe'); |
|
@@ -441,17 +441,17 @@ discard block |
|
|
block discarded – undo |
441
|
441
|
return ''; // No extralang field to show |
442
|
442
|
} |
443
|
443
|
|
444
|
|
- $result .= '<!-- Widget for translation -->' . "\n"; |
445
|
|
- $result .= '<div class="inline-block paddingleft image-' . $object->element . '-' . $fieldname . '">'; |
|
444
|
+ $result .= '<!-- Widget for translation -->'."\n"; |
|
445
|
+ $result .= '<div class="inline-block paddingleft image-'.$object->element.'-'.$fieldname.'">'; |
446
|
446
|
$s = img_picto($langs->trans("ShowOtherLanguages"), 'language', '', 0, 0, 0, '', 'fa-15 editfieldlang'); |
447
|
447
|
$result .= $s; |
448
|
448
|
$result .= '</div>'; |
449
|
449
|
|
450
|
|
- $result .= '<div class="inline-block hidden field-' . $object->element . '-' . $fieldname . '">'; |
|
450
|
+ $result .= '<div class="inline-block hidden field-'.$object->element.'-'.$fieldname.'">'; |
451
|
451
|
|
452
|
452
|
$resultforextrlang = ''; |
453
|
453
|
foreach ($arrayoflangcode as $langcode) { |
454
|
|
- $valuetoshow = GETPOSTISSET('field-' . $object->element . "-" . $fieldname . "-" . $langcode) ? GETPOST('field-' . $object->element . '-' . $fieldname . "-" . $langcode, $check) : ''; |
|
454
|
+ $valuetoshow = GETPOSTISSET('field-'.$object->element."-".$fieldname."-".$langcode) ? GETPOST('field-'.$object->element.'-'.$fieldname."-".$langcode, $check) : ''; |
455
|
455
|
if (empty($valuetoshow)) { |
456
|
456
|
$object->fetchValuesForExtraLanguages(); |
457
|
457
|
//var_dump($object->array_languages); |
|
@@ -463,17 +463,17 @@ discard block |
|
|
block discarded – undo |
463
|
463
|
|
464
|
464
|
// TODO Use the showInputField() method of ExtraLanguages object |
465
|
465
|
if ($typeofdata == 'textarea') { |
466
|
|
- $resultforextrlang .= '<textarea name="field-' . $object->element . "-" . $fieldname . "-" . $langcode . '" id="' . $fieldname . "-" . $langcode . '" class="' . $morecss . '" rows="' . ROWS_2 . '" wrap="soft">'; |
|
466
|
+ $resultforextrlang .= '<textarea name="field-'.$object->element."-".$fieldname."-".$langcode.'" id="'.$fieldname."-".$langcode.'" class="'.$morecss.'" rows="'.ROWS_2.'" wrap="soft">'; |
467
|
467
|
$resultforextrlang .= $valuetoshow; |
468
|
468
|
$resultforextrlang .= '</textarea>'; |
469
|
469
|
} else { |
470
|
|
- $resultforextrlang .= '<input type="text" class="inputfieldforlang ' . ($morecss ? ' ' . $morecss : '') . '" name="field-' . $object->element . '-' . $fieldname . '-' . $langcode . '" value="' . $valuetoshow . '">'; |
|
470
|
+ $resultforextrlang .= '<input type="text" class="inputfieldforlang '.($morecss ? ' '.$morecss : '').'" name="field-'.$object->element.'-'.$fieldname.'-'.$langcode.'" value="'.$valuetoshow.'">'; |
471
|
471
|
} |
472
|
472
|
} |
473
|
473
|
$result .= $resultforextrlang; |
474
|
474
|
|
475
|
475
|
$result .= '</div>'; |
476
|
|
- $result .= '<script nonce="' . getNonce() . '">$(".image-' . $object->element . '-' . $fieldname . '").click(function() { console.log("Toggle lang widget"); jQuery(".field-' . $object->element . '-' . $fieldname . '").toggle(); });</script>'; |
|
476
|
+ $result .= '<script nonce="'.getNonce().'">$(".image-'.$object->element.'-'.$fieldname.'").click(function() { console.log("Toggle lang widget"); jQuery(".field-'.$object->element.'-'.$fieldname.'").toggle(); });</script>'; |
477
|
477
|
} |
478
|
478
|
|
479
|
479
|
return $result; |
|
@@ -536,7 +536,7 @@ discard block |
|
|
block discarded – undo |
536
|
536
|
if (!empty($tmp[2])) { |
537
|
537
|
$savemethod = $tmp[2]; |
538
|
538
|
} |
539
|
|
- $out .= '<input id="width_' . $htmlname . '" value="' . $inputOption . '" type="hidden"/>' . "\n"; |
|
539
|
+ $out .= '<input id="width_'.$htmlname.'" value="'.$inputOption.'" type="hidden"/>'."\n"; |
540
|
540
|
} elseif ((preg_match('/^day$/', $inputType)) || (preg_match('/^datepicker/', $inputType)) || (preg_match('/^datehourpicker/', $inputType))) { |
541
|
541
|
$tmp = explode(':', $inputType); |
542
|
542
|
$inputType = $tmp[0]; |
|
@@ -547,7 +547,7 @@ discard block |
|
|
block discarded – undo |
547
|
547
|
$savemethod = $tmp[2]; |
548
|
548
|
} |
549
|
549
|
|
550
|
|
- $out .= '<input id="timestamp" type="hidden"/>' . "\n"; // Use for timestamp format |
|
550
|
+ $out .= '<input id="timestamp" type="hidden"/>'."\n"; // Use for timestamp format |
551
|
551
|
} elseif (preg_match('/^(select|autocomplete)/', $inputType)) { |
552
|
552
|
$tmp = explode(':', $inputType); |
553
|
553
|
$inputType = $tmp[0]; |
|
@@ -578,40 +578,40 @@ discard block |
|
|
block discarded – undo |
578
|
578
|
} |
579
|
579
|
|
580
|
580
|
if (isModEnabled('fckeditor')) { |
581
|
|
- $out .= '<input id="ckeditor_toolbar" value="' . $toolbar . '" type="hidden"/>' . "\n"; |
|
581
|
+ $out .= '<input id="ckeditor_toolbar" value="'.$toolbar.'" type="hidden"/>'."\n"; |
582
|
582
|
} else { |
583
|
583
|
$inputType = 'textarea'; |
584
|
584
|
} |
585
|
585
|
} |
586
|
586
|
|
587
|
|
- $out .= '<input id="element_' . $htmlname . '" value="' . $element . '" type="hidden"/>' . "\n"; |
588
|
|
- $out .= '<input id="table_element_' . $htmlname . '" value="' . $table_element . '" type="hidden"/>' . "\n"; |
589
|
|
- $out .= '<input id="fk_element_' . $htmlname . '" value="' . $fk_element . '" type="hidden"/>' . "\n"; |
590
|
|
- $out .= '<input id="loadmethod_' . $htmlname . '" value="' . $loadmethod . '" type="hidden"/>' . "\n"; |
|
587
|
+ $out .= '<input id="element_'.$htmlname.'" value="'.$element.'" type="hidden"/>'."\n"; |
|
588
|
+ $out .= '<input id="table_element_'.$htmlname.'" value="'.$table_element.'" type="hidden"/>'."\n"; |
|
589
|
+ $out .= '<input id="fk_element_'.$htmlname.'" value="'.$fk_element.'" type="hidden"/>'."\n"; |
|
590
|
+ $out .= '<input id="loadmethod_'.$htmlname.'" value="'.$loadmethod.'" type="hidden"/>'."\n"; |
591
|
591
|
if (!empty($savemethod)) { |
592
|
|
- $out .= '<input id="savemethod_' . $htmlname . '" value="' . $savemethod . '" type="hidden"/>' . "\n"; |
|
592
|
+ $out .= '<input id="savemethod_'.$htmlname.'" value="'.$savemethod.'" type="hidden"/>'."\n"; |
593
|
593
|
} |
594
|
594
|
if (!empty($ext_element)) { |
595
|
|
- $out .= '<input id="ext_element_' . $htmlname . '" value="' . $ext_element . '" type="hidden"/>' . "\n"; |
|
595
|
+ $out .= '<input id="ext_element_'.$htmlname.'" value="'.$ext_element.'" type="hidden"/>'."\n"; |
596
|
596
|
} |
597
|
597
|
if (!empty($custommsg)) { |
598
|
598
|
if (is_array($custommsg)) { |
599
|
599
|
if (!empty($custommsg['success'])) { |
600
|
|
- $out .= '<input id="successmsg_' . $htmlname . '" value="' . $custommsg['success'] . '" type="hidden"/>' . "\n"; |
|
600
|
+ $out .= '<input id="successmsg_'.$htmlname.'" value="'.$custommsg['success'].'" type="hidden"/>'."\n"; |
601
|
601
|
} |
602
|
602
|
if (!empty($custommsg['error'])) { |
603
|
|
- $out .= '<input id="errormsg_' . $htmlname . '" value="' . $custommsg['error'] . '" type="hidden"/>' . "\n"; |
|
603
|
+ $out .= '<input id="errormsg_'.$htmlname.'" value="'.$custommsg['error'].'" type="hidden"/>'."\n"; |
604
|
604
|
} |
605
|
605
|
} else { |
606
|
|
- $out .= '<input id="successmsg_' . $htmlname . '" value="' . $custommsg . '" type="hidden"/>' . "\n"; |
|
606
|
+ $out .= '<input id="successmsg_'.$htmlname.'" value="'.$custommsg.'" type="hidden"/>'."\n"; |
607
|
607
|
} |
608
|
608
|
} |
609
|
609
|
if ($inputType == 'textarea') { |
610
|
|
- $out .= '<input id="textarea_' . $htmlname . '_rows" value="' . $rows . '" type="hidden"/>' . "\n"; |
611
|
|
- $out .= '<input id="textarea_' . $htmlname . '_cols" value="' . $cols . '" type="hidden"/>' . "\n"; |
|
610
|
+ $out .= '<input id="textarea_'.$htmlname.'_rows" value="'.$rows.'" type="hidden"/>'."\n"; |
|
611
|
+ $out .= '<input id="textarea_'.$htmlname.'_cols" value="'.$cols.'" type="hidden"/>'."\n"; |
612
|
612
|
} |
613
|
|
- $out .= '<span id="viewval_' . $htmlname . '" class="viewval_' . $inputType . ($button_only ? ' inactive' : ' active') . '">' . $value . '</span>' . "\n"; |
614
|
|
- $out .= '<span id="editval_' . $htmlname . '" class="editval_' . $inputType . ($button_only ? ' inactive' : ' active') . ' hideobject">' . (!empty($editvalue) ? $editvalue : $value) . '</span>' . "\n"; |
|
613
|
+ $out .= '<span id="viewval_'.$htmlname.'" class="viewval_'.$inputType.($button_only ? ' inactive' : ' active').'">'.$value.'</span>'."\n"; |
|
614
|
+ $out .= '<span id="editval_'.$htmlname.'" class="editval_'.$inputType.($button_only ? ' inactive' : ' active').' hideobject">'.(!empty($editvalue) ? $editvalue : $value).'</span>'."\n"; |
615
|
615
|
} else { |
616
|
616
|
$out = $value; |
617
|
617
|
} |
|
@@ -640,12 +640,12 @@ discard block |
|
|
block discarded – undo |
640
|
640
|
public function textwithtooltip($text, $htmltext, $tooltipon = 1, $direction = 0, $img = '', $extracss = '', $notabs = 3, $incbefore = '', $noencodehtmltext = 0, $tooltiptrigger = '', $forcenowrap = 0) |
641
|
641
|
{ |
642
|
642
|
if ($incbefore) { |
643
|
|
- $text = $incbefore . $text; |
|
643
|
+ $text = $incbefore.$text; |
644
|
644
|
} |
645
|
645
|
if (!$htmltext) { |
646
|
646
|
return $text; |
647
|
647
|
} |
648
|
|
- $direction = (int) $direction; // For backward compatibility when $direction was set to '' instead of 0 |
|
648
|
+ $direction = (int) $direction; // For backward compatibility when $direction was set to '' instead of 0 |
649
|
649
|
|
650
|
650
|
$tag = 'td'; |
651
|
651
|
if ($notabs == 2) { |
|
@@ -659,11 +659,11 @@ discard block |
|
|
block discarded – undo |
659
|
659
|
|
660
|
660
|
$extrastyle = ''; |
661
|
661
|
if ($direction < 0) { |
662
|
|
- $extracss = ($extracss ? $extracss : '') . ($notabs != 3 ? ' inline-block' : ''); |
|
662
|
+ $extracss = ($extracss ? $extracss : '').($notabs != 3 ? ' inline-block' : ''); |
663
|
663
|
$extrastyle = 'padding: 0px; padding-left: 2px;'; |
664
|
664
|
} |
665
|
665
|
if ($direction > 0) { |
666
|
|
- $extracss = ($extracss ? $extracss : '') . ($notabs != 3 ? ' inline-block' : ''); |
|
666
|
+ $extracss = ($extracss ? $extracss : '').($notabs != 3 ? ' inline-block' : ''); |
667
|
667
|
$extrastyle = 'padding: 0px; padding-right: 2px;'; |
668
|
668
|
} |
669
|
669
|
|
|
@@ -676,53 +676,53 @@ discard block |
|
|
block discarded – undo |
676
|
676
|
$htmltext = str_replace('"', '"', $htmltext); |
677
|
677
|
} else { |
678
|
678
|
$classfortooltip = 'classfortooltiponclick'; |
679
|
|
- $textfordialog .= '<div style="display: none;" id="idfortooltiponclick_' . $tooltiptrigger . '" class="classfortooltiponclicktext">' . $htmltext . '</div>'; |
|
679
|
+ $textfordialog .= '<div style="display: none;" id="idfortooltiponclick_'.$tooltiptrigger.'" class="classfortooltiponclicktext">'.$htmltext.'</div>'; |
680
|
680
|
} |
681
|
681
|
if ($tooltipon == 2 || $tooltipon == 3) { |
682
|
|
- $paramfortooltipimg = ' class="' . $classfortooltip . ($notabs != 3 ? ' inline-block' : '') . ($extracss ? ' ' . $extracss : '') . '" style="padding: 0px;' . ($extrastyle ? ' ' . $extrastyle : '') . '"'; |
|
682
|
+ $paramfortooltipimg = ' class="'.$classfortooltip.($notabs != 3 ? ' inline-block' : '').($extracss ? ' '.$extracss : '').'" style="padding: 0px;'.($extrastyle ? ' '.$extrastyle : '').'"'; |
683
|
683
|
if ($tooltiptrigger == '') { |
684
|
|
- $paramfortooltipimg .= ' title="' . ($noencodehtmltext ? $htmltext : dol_escape_htmltag($htmltext, 1)) . '"'; // Attribute to put on img tag to store tooltip |
|
684
|
+ $paramfortooltipimg .= ' title="'.($noencodehtmltext ? $htmltext : dol_escape_htmltag($htmltext, 1)).'"'; // Attribute to put on img tag to store tooltip |
685
|
685
|
} else { |
686
|
|
- $paramfortooltipimg .= ' dolid="' . $tooltiptrigger . '"'; |
|
686
|
+ $paramfortooltipimg .= ' dolid="'.$tooltiptrigger.'"'; |
687
|
687
|
} |
688
|
688
|
} else { |
689
|
|
- $paramfortooltipimg = ($extracss ? ' class="' . $extracss . '"' : '') . ($extrastyle ? ' style="' . $extrastyle . '"' : ''); // Attribute to put on td text tag |
|
689
|
+ $paramfortooltipimg = ($extracss ? ' class="'.$extracss.'"' : '').($extrastyle ? ' style="'.$extrastyle.'"' : ''); // Attribute to put on td text tag |
690
|
690
|
} |
691
|
691
|
if ($tooltipon == 1 || $tooltipon == 3) { |
692
|
|
- $paramfortooltiptd = ' class="' . ($tooltipon == 3 ? 'cursorpointer ' : '') . $classfortooltip . ' inline-block' . ($extracss ? ' ' . $extracss : '') . '" style="padding: 0px;' . ($extrastyle ? ' ' . $extrastyle : '') . '" '; |
|
692
|
+ $paramfortooltiptd = ' class="'.($tooltipon == 3 ? 'cursorpointer ' : '').$classfortooltip.' inline-block'.($extracss ? ' '.$extracss : '').'" style="padding: 0px;'.($extrastyle ? ' '.$extrastyle : '').'" '; |
693
|
693
|
if ($tooltiptrigger == '') { |
694
|
|
- $paramfortooltiptd .= ' title="' . ($noencodehtmltext ? $htmltext : dol_escape_htmltag($htmltext, 1)) . '"'; // Attribute to put on td tag to store tooltip |
|
694
|
+ $paramfortooltiptd .= ' title="'.($noencodehtmltext ? $htmltext : dol_escape_htmltag($htmltext, 1)).'"'; // Attribute to put on td tag to store tooltip |
695
|
695
|
} else { |
696
|
|
- $paramfortooltiptd .= ' dolid="' . $tooltiptrigger . '"'; |
|
696
|
+ $paramfortooltiptd .= ' dolid="'.$tooltiptrigger.'"'; |
697
|
697
|
} |
698
|
698
|
} else { |
699
|
|
- $paramfortooltiptd = ($extracss ? ' class="' . $extracss . '"' : '') . ($extrastyle ? ' style="' . $extrastyle . '"' : ''); // Attribute to put on td text tag |
|
699
|
+ $paramfortooltiptd = ($extracss ? ' class="'.$extracss.'"' : '').($extrastyle ? ' style="'.$extrastyle.'"' : ''); // Attribute to put on td text tag |
700
|
700
|
} |
701
|
701
|
if (empty($notabs)) { |
702
|
702
|
$s .= '<table class="nobordernopadding"><tr style="height: auto;">'; |
703
|
703
|
} elseif ($notabs == 2) { |
704
|
|
- $s .= '<div class="inline-block' . ($forcenowrap ? ' nowrap' : '') . '">'; |
|
704
|
+ $s .= '<div class="inline-block'.($forcenowrap ? ' nowrap' : '').'">'; |
705
|
705
|
} |
706
|
706
|
// Define value if value is before |
707
|
707
|
if ($direction < 0) { |
708
|
|
- $s .= '<' . $tag . $paramfortooltipimg; |
|
708
|
+ $s .= '<'.$tag.$paramfortooltipimg; |
709
|
709
|
if ($tag == 'td') { |
710
|
710
|
$s .= ' class="valigntop" width="14"'; |
711
|
711
|
} |
712
|
|
- $s .= '>' . $textfordialog . $img . '</' . $tag . '>'; |
|
712
|
+ $s .= '>'.$textfordialog.$img.'</'.$tag.'>'; |
713
|
713
|
} |
714
|
714
|
// Use another method to help avoid having a space in value in order to use this value with jquery |
715
|
715
|
// Define label |
716
|
716
|
if ((string) $text != '') { |
717
|
|
- $s .= '<' . $tag . $paramfortooltiptd . '>' . $text . '</' . $tag . '>'; |
|
717
|
+ $s .= '<'.$tag.$paramfortooltiptd.'>'.$text.'</'.$tag.'>'; |
718
|
718
|
} |
719
|
719
|
// Define value if value is after |
720
|
720
|
if ($direction > 0) { |
721
|
|
- $s .= '<' . $tag . $paramfortooltipimg; |
|
721
|
+ $s .= '<'.$tag.$paramfortooltipimg; |
722
|
722
|
if ($tag == 'td') { |
723
|
723
|
$s .= ' class="valignmiddle" width="14"'; |
724
|
724
|
} |
725
|
|
- $s .= '>' . $textfordialog . $img . '</' . $tag . '>'; |
|
725
|
+ $s .= '>'.$textfordialog.$img.'</'.$tag.'>'; |
726
|
726
|
} |
727
|
727
|
if (empty($notabs)) { |
728
|
728
|
$s .= '</tr></table>'; |
|
@@ -829,7 +829,7 @@ discard block |
|
|
block discarded – undo |
829
|
829
|
|
830
|
830
|
$disabled = 0; |
831
|
831
|
$ret = '<div class="centpercent center">'; |
832
|
|
- $ret .= '<select class="flat' . (empty($conf->use_javascript_ajax) ? '' : ' hideobject') . ' ' . $name . ' ' . $name . 'select valignmiddle alignstart" id="' . $name . '" name="' . $name . '"' . ($disabled ? ' disabled="disabled"' : '') . '>'; |
|
832
|
+ $ret .= '<select class="flat'.(empty($conf->use_javascript_ajax) ? '' : ' hideobject').' '.$name.' '.$name.'select valignmiddle alignstart" id="'.$name.'" name="'.$name.'"'.($disabled ? ' disabled="disabled"' : '').'>'; |
833
|
833
|
|
834
|
834
|
// 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. |
835
|
835
|
$parameters = array(); |
|
@@ -840,10 +840,10 @@ discard block |
|
|
block discarded – undo |
840
|
840
|
return; |
841
|
841
|
} |
842
|
842
|
if (empty($reshook)) { |
843
|
|
- $ret .= '<option value="0"' . ($disabled ? ' disabled="disabled"' : '') . '>-- ' . $langs->trans("SelectAction") . ' --</option>'; |
|
843
|
+ $ret .= '<option value="0"'.($disabled ? ' disabled="disabled"' : '').'>-- '.$langs->trans("SelectAction").' --</option>'; |
844
|
844
|
if (is_array($arrayofaction)) { |
845
|
845
|
foreach ($arrayofaction as $code => $label) { |
846
|
|
- $ret .= '<option value="' . $code . '"' . ($disabled ? ' disabled="disabled"' : '') . ' data-html="' . dol_escape_htmltag($label) . '">' . $label . '</option>'; |
|
846
|
+ $ret .= '<option value="'.$code.'"'.($disabled ? ' disabled="disabled"' : '').' data-html="'.dol_escape_htmltag($label).'">'.$label.'</option>'; |
847
|
847
|
} |
848
|
848
|
} |
849
|
849
|
} |
|
@@ -852,17 +852,17 @@ discard block |
|
|
block discarded – undo |
852
|
852
|
$ret .= '</select>'; |
853
|
853
|
|
854
|
854
|
if (empty($conf->dol_optimize_smallscreen)) { |
855
|
|
- $ret .= ajax_combobox('.' . $name . 'select'); |
|
855
|
+ $ret .= ajax_combobox('.'.$name.'select'); |
856
|
856
|
} |
857
|
857
|
|
858
|
858
|
// 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 |
859
|
859
|
$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. |
860
|
|
- $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
|
+ $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")).'">'; |
861
|
861
|
$ret .= '</div>'; |
862
|
862
|
|
863
|
863
|
if (!empty($conf->use_javascript_ajax)) { |
864
|
864
|
$ret .= '<!-- JS CODE TO ENABLE mass action select --> |
865
|
|
- <script nonce="' . getNonce() . '"> |
|
865
|
+ <script nonce="' . getNonce().'"> |
866
|
866
|
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 */ |
867
|
867
|
{ |
868
|
868
|
atleastoneselected=0; |
|
@@ -873,11 +873,11 @@ discard block |
|
|
block discarded – undo |
873
|
873
|
|
874
|
874
|
console.log("initCheckForSelect mode="+mode+" name="+name+" cssclass="+cssclass+" atleastoneselected="+atleastoneselected); |
875
|
875
|
|
876
|
|
- if (atleastoneselected || ' . $alwaysvisible . ') |
|
876
|
+ if (atleastoneselected || ' . $alwaysvisible.') |
877
|
877
|
{ |
878
|
878
|
jQuery("."+name).show(); |
879
|
|
- ' . ($selected ? 'if (atleastoneselected) { jQuery("."+name+"select").val("' . $selected . '").trigger(\'change\'); jQuery("."+name+"confirmed").prop(\'disabled\', false); }' : '') . ' |
880
|
|
- ' . ($selected ? 'if (! atleastoneselected) { jQuery("."+name+"select").val("0").trigger(\'change\'); jQuery("."+name+"confirmed").prop(\'disabled\', true); } ' : '') . ' |
|
879
|
+ ' . ($selected ? 'if (atleastoneselected) { jQuery("."+name+"select").val("'.$selected.'").trigger(\'change\'); jQuery("."+name+"confirmed").prop(\'disabled\', false); }' : '').' |
|
880
|
+ ' . ($selected ? 'if (! atleastoneselected) { jQuery("."+name+"select").val("0").trigger(\'change\'); jQuery("."+name+"confirmed").prop(\'disabled\', true); } ' : '').' |
881
|
881
|
} |
882
|
882
|
else |
883
|
883
|
{ |
|
@@ -887,26 +887,26 @@ discard block |
|
|
block discarded – undo |
887
|
887
|
} |
888
|
888
|
|
889
|
889
|
jQuery(document).ready(function () { |
890
|
|
- initCheckForSelect(0, "' . $name . '", "' . $cssclass . '"); |
891
|
|
- jQuery(".' . $cssclass . '").click(function() { |
892
|
|
- initCheckForSelect(1, "' . $name . '", "' . $cssclass . '"); |
|
890
|
+ initCheckForSelect(0, "' . $name.'", "'.$cssclass.'"); |
|
891
|
+ jQuery(".' . $cssclass.'").click(function() { |
|
892
|
+ initCheckForSelect(1, "' . $name.'", "'.$cssclass.'"); |
893
|
893
|
}); |
894
|
|
- jQuery(".' . $name . 'select").change(function() { |
|
894
|
+ jQuery(".' . $name.'select").change(function() { |
895
|
895
|
var massaction = $( this ).val(); |
896
|
896
|
var urlform = $( this ).closest("form").attr("action").replace("#show_files",""); |
897
|
897
|
if (massaction == "builddoc") { |
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
|
|
- jQuery(".' . $name . 'confirmed").prop(\'disabled\', false); |
905
|
|
- jQuery(".' . $name . 'other").hide(); /* To disable if another div was open */ |
906
|
|
- jQuery(".' . $name . '"+massaction).show(); |
|
904
|
+ jQuery(".' . $name.'confirmed").prop(\'disabled\', false); |
|
905
|
+ jQuery(".' . $name.'other").hide(); /* To disable if another div was open */ |
|
906
|
+ jQuery(".' . $name.'"+massaction).show(); |
907
|
907
|
} else { |
908
|
|
- jQuery(".' . $name . 'confirmed").prop(\'disabled\', true); |
909
|
|
- jQuery(".' . $name . 'other").hide(); /* To disable any div open */ |
|
908
|
+ jQuery(".' . $name.'confirmed").prop(\'disabled\', true); |
|
909
|
+ jQuery(".' . $name.'other").hide(); /* To disable any div open */ |
910
|
910
|
} |
911
|
911
|
}); |
912
|
912
|
}); |
|
@@ -949,14 +949,14 @@ discard block |
|
|
block discarded – undo |
949
|
949
|
$atleastonefavorite = 0; |
950
|
950
|
|
951
|
951
|
$sql = "SELECT rowid, code as code_iso, code_iso as code_iso3, label, favorite, eec"; |
952
|
|
- $sql .= " FROM " . $this->db->prefix() . "c_country"; |
|
952
|
+ $sql .= " FROM ".$this->db->prefix()."c_country"; |
953
|
953
|
$sql .= " WHERE active > 0"; |
954
|
954
|
//$sql.= " ORDER BY code ASC"; |
955
|
955
|
|
956
|
|
- dol_syslog(get_class($this) . "::select_country", LOG_DEBUG); |
|
956
|
+ dol_syslog(get_class($this)."::select_country", LOG_DEBUG); |
957
|
957
|
$resql = $this->db->query($sql); |
958
|
958
|
if ($resql) { |
959
|
|
- $out .= '<select id="select' . $htmlname . '" class="flat maxwidth200onsmartphone selectcountry' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" ' . $htmloption . '>'; |
|
959
|
+ $out .= '<select id="select'.$htmlname.'" class="flat maxwidth200onsmartphone selectcountry'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" '.$htmloption.'>'; |
960
|
960
|
$num = $this->db->num_rows($resql); |
961
|
961
|
$i = 0; |
962
|
962
|
if ($num) { |
|
@@ -966,7 +966,7 @@ discard block |
|
|
block discarded – undo |
966
|
966
|
$countryArray[$i]['rowid'] = $obj->rowid; |
967
|
967
|
$countryArray[$i]['code_iso'] = $obj->code_iso; |
968
|
968
|
$countryArray[$i]['code_iso3'] = $obj->code_iso3; |
969
|
|
- $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 : '')); |
|
969
|
+ $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 : '')); |
970
|
970
|
$countryArray[$i]['favorite'] = $obj->favorite; |
971
|
971
|
$countryArray[$i]['eec'] = $obj->eec; |
972
|
972
|
$favorite[$i] = $obj->favorite; |
|
@@ -984,20 +984,20 @@ discard block |
|
|
block discarded – undo |
984
|
984
|
|
985
|
985
|
if ($showempty) { |
986
|
986
|
if (is_numeric($showempty)) { |
987
|
|
- $out .= '<option value=""> </option>' . "\n"; |
|
987
|
+ $out .= '<option value=""> </option>'."\n"; |
988
|
988
|
} else { |
989
|
|
- $out .= '<option value="-1">' . $langs->trans($showempty) . '</option>' . "\n"; |
|
989
|
+ $out .= '<option value="-1">'.$langs->trans($showempty).'</option>'."\n"; |
990
|
990
|
} |
991
|
991
|
} |
992
|
992
|
|
993
|
993
|
if ($addspecialentries) { // Add dedicated entries for groups of countries |
994
|
994
|
//if ($showempty) $out.= '<option value="" disabled class="selectoptiondisabledwhite">--------------</option>'; |
995
|
|
- $out .= '<option value="special_allnotme"' . ($selected == 'special_allnotme' ? ' selected' : '') . '>' . $langs->trans("CountriesExceptMe", $langs->transnoentitiesnoconv("Country" . $mysoc->country_code)) . '</option>'; |
996
|
|
- $out .= '<option value="special_eec"' . ($selected == 'special_eec' ? ' selected' : '') . '>' . $langs->trans("CountriesInEEC") . '</option>'; |
|
995
|
+ $out .= '<option value="special_allnotme"'.($selected == 'special_allnotme' ? ' selected' : '').'>'.$langs->trans("CountriesExceptMe", $langs->transnoentitiesnoconv("Country".$mysoc->country_code)).'</option>'; |
|
996
|
+ $out .= '<option value="special_eec"'.($selected == 'special_eec' ? ' selected' : '').'>'.$langs->trans("CountriesInEEC").'</option>'; |
997
|
997
|
if ($mysoc->isInEEC()) { |
998
|
|
- $out .= '<option value="special_eecnotme"' . ($selected == 'special_eecnotme' ? ' selected' : '') . '>' . $langs->trans("CountriesInEECExceptMe", $langs->transnoentitiesnoconv("Country" . $mysoc->country_code)) . '</option>'; |
|
998
|
+ $out .= '<option value="special_eecnotme"'.($selected == 'special_eecnotme' ? ' selected' : '').'>'.$langs->trans("CountriesInEECExceptMe", $langs->transnoentitiesnoconv("Country".$mysoc->country_code)).'</option>'; |
999
|
999
|
} |
1000
|
|
- $out .= '<option value="special_noteec"' . ($selected == 'special_noteec' ? ' selected' : '') . '>' . $langs->trans("CountriesNotInEEC") . '</option>'; |
|
1000
|
+ $out .= '<option value="special_noteec"'.($selected == 'special_noteec' ? ' selected' : '').'>'.$langs->trans("CountriesNotInEEC").'</option>'; |
1001
|
1001
|
$out .= '<option value="" disabled class="selectoptiondisabledwhite">------------</option>'; |
1002
|
1002
|
} |
1003
|
1003
|
|
|
@@ -1025,20 +1025,20 @@ discard block |
|
|
block discarded – undo |
1025
|
1025
|
$labeltoshow .= ' '; |
1026
|
1026
|
} |
1027
|
1027
|
if ($row['code_iso']) { |
1028
|
|
- $labeltoshow .= ' <span class="opacitymedium">(' . $row['code_iso'] . ')</span>'; |
|
1028
|
+ $labeltoshow .= ' <span class="opacitymedium">('.$row['code_iso'].')</span>'; |
1029
|
1029
|
if (empty($hideflags)) { |
1030
|
1030
|
$tmpflag = picto_from_langcode($row['code_iso'], 'class="saturatemedium paddingrightonly"', 1); |
1031
|
|
- $labeltoshow = $tmpflag . ' ' . $labeltoshow; |
|
1031
|
+ $labeltoshow = $tmpflag.' '.$labeltoshow; |
1032
|
1032
|
} |
1033
|
1033
|
} |
1034
|
1034
|
|
1035
|
1035
|
if ($selected && $selected != '-1' && ($selected == $row['rowid'] || $selected == $row['code_iso'] || $selected == $row['code_iso3'] || $selected == $row['label'])) { |
1036
|
|
- $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']) . '">'; |
|
1036
|
+ $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']).'">'; |
1037
|
1037
|
} else { |
1038
|
|
- $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']) . '">'; |
|
1038
|
+ $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']).'">'; |
1039
|
1039
|
} |
1040
|
1040
|
$out .= $labeltoshow; |
1041
|
|
- $out .= '</option>' . "\n"; |
|
1041
|
+ $out .= '</option>'."\n"; |
1042
|
1042
|
} |
1043
|
1043
|
} |
1044
|
1044
|
$out .= '</select>'; |
|
@@ -1047,8 +1047,8 @@ discard block |
|
|
block discarded – undo |
1047
|
1047
|
} |
1048
|
1048
|
|
1049
|
1049
|
// Make select dynamic |
1050
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
1051
|
|
- $out .= ajax_combobox('select' . $htmlname, array(), 0, 0, 'resolve'); |
|
1050
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
|
1051
|
+ $out .= ajax_combobox('select'.$htmlname, array(), 0, 0, 'resolve'); |
1052
|
1052
|
|
1053
|
1053
|
return $out; |
1054
|
1054
|
} |
|
@@ -1080,25 +1080,25 @@ discard block |
|
|
block discarded – undo |
1080
|
1080
|
$incotermArray = array(); |
1081
|
1081
|
|
1082
|
1082
|
$sql = "SELECT rowid, code"; |
1083
|
|
- $sql .= " FROM " . $this->db->prefix() . "c_incoterms"; |
|
1083
|
+ $sql .= " FROM ".$this->db->prefix()."c_incoterms"; |
1084
|
1084
|
$sql .= " WHERE active > 0"; |
1085
|
1085
|
$sql .= " ORDER BY code ASC"; |
1086
|
1086
|
|
1087
|
|
- dol_syslog(get_class($this) . "::select_incoterm", LOG_DEBUG); |
|
1087
|
+ dol_syslog(get_class($this)."::select_incoterm", LOG_DEBUG); |
1088
|
1088
|
$resql = $this->db->query($sql); |
1089
|
1089
|
if ($resql) { |
1090
|
1090
|
if ($conf->use_javascript_ajax && !$forcecombo) { |
1091
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
1091
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
1092
|
1092
|
$out .= ajax_combobox($htmlname, $events); |
1093
|
1093
|
} |
1094
|
1094
|
|
1095
|
1095
|
if (!empty($page)) { |
1096
|
|
- $out .= '<form method="post" action="' . $page . '">'; |
|
1096
|
+ $out .= '<form method="post" action="'.$page.'">'; |
1097
|
1097
|
$out .= '<input type="hidden" name="action" value="set_incoterms">'; |
1098
|
|
- $out .= '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
1098
|
+ $out .= '<input type="hidden" name="token" value="'.newToken().'">'; |
1099
|
1099
|
} |
1100
|
1100
|
|
1101
|
|
- $out .= '<select id="' . $htmlname . '" class="flat selectincoterm width75" name="' . $htmlname . '" ' . $htmloption . '>'; |
|
1101
|
+ $out .= '<select id="'.$htmlname.'" class="flat selectincoterm width75" name="'.$htmlname.'" '.$htmloption.'>'; |
1102
|
1102
|
$out .= '<option value="0"> </option>'; |
1103
|
1103
|
$num = $this->db->num_rows($resql); |
1104
|
1104
|
$i = 0; |
|
@@ -1112,9 +1112,9 @@ discard block |
|
|
block discarded – undo |
1112
|
1112
|
|
1113
|
1113
|
foreach ($incotermArray as $row) { |
1114
|
1114
|
if ($selected && ($selected == $row['rowid'] || $selected == $row['code'])) { |
1115
|
|
- $out .= '<option value="' . $row['rowid'] . '" selected>'; |
|
1115
|
+ $out .= '<option value="'.$row['rowid'].'" selected>'; |
1116
|
1116
|
} else { |
1117
|
|
- $out .= '<option value="' . $row['rowid'] . '">'; |
|
1117
|
+ $out .= '<option value="'.$row['rowid'].'">'; |
1118
|
1118
|
} |
1119
|
1119
|
|
1120
|
1120
|
if ($row['code']) { |
|
@@ -1128,13 +1128,13 @@ discard block |
|
|
block discarded – undo |
1128
|
1128
|
$out .= ajax_combobox($htmlname); |
1129
|
1129
|
|
1130
|
1130
|
if ($conf->use_javascript_ajax && empty($disableautocomplete)) { |
1131
|
|
- $out .= ajax_multiautocompleter('location_incoterms', array(), DOL_URL_ROOT . '/core/ajax/locationincoterms.php') . "\n"; |
|
1131
|
+ $out .= ajax_multiautocompleter('location_incoterms', array(), DOL_URL_ROOT.'/core/ajax/locationincoterms.php')."\n"; |
1132
|
1132
|
$moreattrib .= ' autocomplete="off"'; |
1133
|
1133
|
} |
1134
|
|
- $out .= '<input id="location_incoterms" class="maxwidthonsmartphone type="text" name="location_incoterms" value="' . $location_incoterms . '">' . "\n"; |
|
1134
|
+ $out .= '<input id="location_incoterms" class="maxwidthonsmartphone type="text" name="location_incoterms" value="'.$location_incoterms.'">'."\n"; |
1135
|
1135
|
|
1136
|
1136
|
if (!empty($page)) { |
1137
|
|
- $out .= '<input type="submit" class="button valignmiddle smallpaddingimp nomargintop nomarginbottom" value="' . $langs->trans("Modify") . '"></form>'; |
|
1137
|
+ $out .= '<input type="submit" class="button valignmiddle smallpaddingimp nomargintop nomarginbottom" value="'.$langs->trans("Modify").'"></form>'; |
1138
|
1138
|
} |
1139
|
1139
|
} else { |
1140
|
1140
|
dol_print_error($this->db); |
|
@@ -1166,9 +1166,9 @@ discard block |
|
|
block discarded – undo |
1166
|
1166
|
if ($forceall == 1 || (empty($forceall) && isModEnabled("product") && isModEnabled("service")) |
1167
|
1167
|
|| (empty($forceall) && !isModEnabled('product') && !isModEnabled('service'))) { |
1168
|
1168
|
if (empty($hidetext)) { |
1169
|
|
- print $langs->trans("Type") . ': '; |
|
1169
|
+ print $langs->trans("Type").': '; |
1170
|
1170
|
} |
1171
|
|
- print '<select class="flat'.($morecss ? ' '.$morecss : '').'" id="select_' . $htmlname . '" name="' . $htmlname . '">'; |
|
1171
|
+ print '<select class="flat'.($morecss ? ' '.$morecss : '').'" id="select_'.$htmlname.'" name="'.$htmlname.'">'; |
1172
|
1172
|
if ($showempty) { |
1173
|
1173
|
print '<option value="-1"'; |
1174
|
1174
|
if ($selected == -1) { |
|
@@ -1187,28 +1187,28 @@ discard block |
|
|
block discarded – undo |
1187
|
1187
|
if (0 == $selected || ($selected == -1 && getDolGlobalString('MAIN_FREE_PRODUCT_CHECKED_BY_DEFAULT') == 'product')) { |
1188
|
1188
|
print ' selected'; |
1189
|
1189
|
} |
1190
|
|
- print '>' . $langs->trans("Product"); |
|
1190
|
+ print '>'.$langs->trans("Product"); |
1191
|
1191
|
|
1192
|
1192
|
print '<option value="1"'; |
1193
|
1193
|
if (1 == $selected || ($selected == -1 && getDolGlobalString('MAIN_FREE_PRODUCT_CHECKED_BY_DEFAULT') == 'service')) { |
1194
|
1194
|
print ' selected'; |
1195
|
1195
|
} |
1196
|
|
- print '>' . $langs->trans("Service"); |
|
1196
|
+ print '>'.$langs->trans("Service"); |
1197
|
1197
|
|
1198
|
1198
|
print '</select>'; |
1199
|
|
- print ajax_combobox('select_' . $htmlname); |
|
1199
|
+ print ajax_combobox('select_'.$htmlname); |
1200
|
1200
|
//if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); |
1201
|
1201
|
} |
1202
|
1202
|
if ((empty($forceall) && !isModEnabled('product') && isModEnabled("service")) || $forceall == 3) { |
1203
|
1203
|
print $langs->trans("Service"); |
1204
|
|
- print '<input type="hidden" name="' . $htmlname . '" value="1">'; |
|
1204
|
+ print '<input type="hidden" name="'.$htmlname.'" value="1">'; |
1205
|
1205
|
} |
1206
|
1206
|
if ((empty($forceall) && isModEnabled("product") && !isModEnabled('service')) || $forceall == 2) { |
1207
|
1207
|
print $langs->trans("Product"); |
1208
|
|
- print '<input type="hidden" name="' . $htmlname . '" value="0">'; |
|
1208
|
+ print '<input type="hidden" name="'.$htmlname.'" value="0">'; |
1209
|
1209
|
} |
1210
|
1210
|
if ($forceall < 0) { // This should happened only for contracts when both predefined product and service are disabled. |
1211
|
|
- 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 |
|
1211
|
+ 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 |
1212
|
1212
|
} |
1213
|
1213
|
} |
1214
|
1214
|
|
|
@@ -1234,7 +1234,7 @@ discard block |
|
|
block discarded – undo |
1234
|
1234
|
$langs->load("trips"); |
1235
|
1235
|
|
1236
|
1236
|
$sql = "SELECT c.code, c.label"; |
1237
|
|
- $sql .= " FROM " . $this->db->prefix() . "c_type_fees as c"; |
|
1237
|
+ $sql .= " FROM ".$this->db->prefix()."c_type_fees as c"; |
1238
|
1238
|
$sql .= " WHERE active > 0"; |
1239
|
1239
|
|
1240
|
1240
|
$resql = $this->db->query($sql); |
|
@@ -1275,11 +1275,11 @@ discard block |
|
|
block discarded – undo |
1275
|
1275
|
// phpcs:enable |
1276
|
1276
|
global $user, $langs; |
1277
|
1277
|
|
1278
|
|
- dol_syslog(__METHOD__ . " selected=" . $selected . ", htmlname=" . $htmlname, LOG_DEBUG); |
|
1278
|
+ dol_syslog(__METHOD__." selected=".$selected.", htmlname=".$htmlname, LOG_DEBUG); |
1279
|
1279
|
|
1280
|
1280
|
$this->load_cache_types_fees(); |
1281
|
1281
|
|
1282
|
|
- print '<select id="select_' . $htmlname . '" class="flat" name="' . $htmlname . '">'; |
|
1282
|
+ print '<select id="select_'.$htmlname.'" class="flat" name="'.$htmlname.'">'; |
1283
|
1283
|
if ($showempty) { |
1284
|
1284
|
print '<option value="-1"'; |
1285
|
1285
|
if ($selected == -1) { |
|
@@ -1289,7 +1289,7 @@ discard block |
|
|
block discarded – undo |
1289
|
1289
|
} |
1290
|
1290
|
|
1291
|
1291
|
foreach ($this->cache_types_fees as $key => $value) { |
1292
|
|
- print '<option value="' . $key . '"'; |
|
1292
|
+ print '<option value="'.$key.'"'; |
1293
|
1293
|
if ($key == $selected) { |
1294
|
1294
|
print ' selected'; |
1295
|
1295
|
} |
|
@@ -1341,12 +1341,12 @@ discard block |
|
|
block discarded – undo |
1341
|
1341
|
$ajaxoptions = array(); |
1342
|
1342
|
} |
1343
|
1343
|
|
1344
|
|
- require_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
1344
|
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
1345
|
1345
|
|
1346
|
1346
|
// No immediate load of all database |
1347
|
1347
|
$placeholder = ''; |
1348
|
1348
|
if ($selected && empty($selected_input_value)) { |
1349
|
|
- require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; |
|
1349
|
+ require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; |
1350
|
1350
|
$societetmp = new Societe($this->db); |
1351
|
1351
|
$societetmp->fetch($selected); |
1352
|
1352
|
$selected_input_value = $societetmp->name; |
|
@@ -1354,11 +1354,11 @@ discard block |
|
|
block discarded – undo |
1354
|
1354
|
} |
1355
|
1355
|
|
1356
|
1356
|
// mode 1 |
1357
|
|
- $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)) : ''); |
|
1357
|
+ $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)) : ''); |
1358
|
1358
|
|
1359
|
1359
|
$out .= '<!-- force css to be higher than dialog popup --><style type="text/css">.ui-autocomplete { z-index: 1010; }</style>'; |
1360
|
1360
|
if (empty($hidelabel)) { |
1361
|
|
- $out .= $langs->trans("RefOrLabel") . ' : '; |
|
1361
|
+ $out .= $langs->trans("RefOrLabel").' : '; |
1362
|
1362
|
} elseif ($hidelabel == 1 && !is_numeric($showempty)) { |
1363
|
1363
|
$placeholder = $showempty; |
1364
|
1364
|
} elseif ($hidelabel > 1) { |
|
@@ -1367,7 +1367,7 @@ discard block |
|
|
block discarded – undo |
1367
|
1367
|
$out .= img_picto($langs->trans("Search"), 'search'); |
1368
|
1368
|
} |
1369
|
1369
|
} |
1370
|
|
- $out .= '<input type="text" class="' . $morecss . '" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . ($placeholder ? ' placeholder="' . dol_escape_htmltag($placeholder) . '"' : '') . ' ' . (getDolGlobalString('THIRDPARTY_SEARCH_AUTOFOCUS') ? 'autofocus' : '') . ' />'; |
|
1370
|
+ $out .= '<input type="text" class="'.$morecss.'" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.($placeholder ? ' placeholder="'.dol_escape_htmltag($placeholder).'"' : '').' '.(getDolGlobalString('THIRDPARTY_SEARCH_AUTOFOCUS') ? 'autofocus' : '').' />'; |
1371
|
1371
|
if ($hidelabel == 3) { |
1372
|
1372
|
$out .= img_picto($langs->trans("Search"), 'search'); |
1373
|
1373
|
} |
|
@@ -1429,12 +1429,12 @@ discard block |
|
|
block discarded – undo |
1429
|
1429
|
$events = array(); |
1430
|
1430
|
} |
1431
|
1431
|
|
1432
|
|
- require_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
1432
|
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
1433
|
1433
|
|
1434
|
1434
|
// No immediate load of all database |
1435
|
1435
|
$placeholder = ''; |
1436
|
1436
|
if ($selected && empty($selected_input_value)) { |
1437
|
|
- require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php'; |
|
1437
|
+ require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; |
1438
|
1438
|
$contacttmp = new Contact($this->db); |
1439
|
1439
|
$contacttmp->fetch($selected); |
1440
|
1440
|
$selected_input_value = $contacttmp->getFullName($langs); |
|
@@ -1445,11 +1445,11 @@ discard block |
|
|
block discarded – undo |
1445
|
1445
|
} |
1446
|
1446
|
|
1447
|
1447
|
// mode 1 |
1448
|
|
- $urloption = 'htmlname=' . urlencode((string) (str_replace('.', '_', $htmlname))) . '&outjson=1&filter=' . urlencode((string) ($filter)) . (empty($exclude) ? '' : '&exclude=' . urlencode($exclude)) . ($showsoc ? '&showsoc=' . urlencode((string) ($showsoc)) : ''); |
|
1448
|
+ $urloption = 'htmlname='.urlencode((string) (str_replace('.', '_', $htmlname))).'&outjson=1&filter='.urlencode((string) ($filter)).(empty($exclude) ? '' : '&exclude='.urlencode($exclude)).($showsoc ? '&showsoc='.urlencode((string) ($showsoc)) : ''); |
1449
|
1449
|
|
1450
|
1450
|
$out .= '<!-- force css to be higher than dialog popup --><style type="text/css">.ui-autocomplete { z-index: 1010; }</style>'; |
1451
|
1451
|
|
1452
|
|
- $out .= '<input type="text" class="' . $morecss . '" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . ($placeholder ? ' placeholder="' . dol_escape_htmltag($placeholder) . '"' : '') . ' ' . (getDolGlobalString('CONTACT_SEARCH_AUTOFOCUS') ? 'autofocus' : '') . ' />'; |
|
1452
|
+ $out .= '<input type="text" class="'.$morecss.'" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.($placeholder ? ' placeholder="'.dol_escape_htmltag($placeholder).'"' : '').' '.(getDolGlobalString('CONTACT_SEARCH_AUTOFOCUS') ? 'autofocus' : '').' />'; |
1453
|
1453
|
|
1454
|
1454
|
$out .= ajax_event($htmlname, $events); |
1455
|
1455
|
|
|
@@ -1546,30 +1546,30 @@ discard block |
|
|
block discarded – undo |
1546
|
1546
|
$sql .= ", s.address, s.zip, s.town"; |
1547
|
1547
|
$sql .= ", dictp.code as country_code"; |
1548
|
1548
|
} |
1549
|
|
- $sql .= " FROM " . $this->db->prefix() . "societe as s"; |
|
1549
|
+ $sql .= " FROM ".$this->db->prefix()."societe as s"; |
1550
|
1550
|
if (getDolGlobalString('COMPANY_SHOW_ADDRESS_SELECTLIST')) { |
1551
|
|
- $sql .= " LEFT JOIN " . $this->db->prefix() . "c_country as dictp ON dictp.rowid = s.fk_pays"; |
|
1551
|
+ $sql .= " LEFT JOIN ".$this->db->prefix()."c_country as dictp ON dictp.rowid = s.fk_pays"; |
1552
|
1552
|
} |
1553
|
1553
|
if (!$user->hasRight('societe', 'client', 'voir')) { |
1554
|
|
- $sql .= ", " . $this->db->prefix() . "societe_commerciaux as sc"; |
|
1554
|
+ $sql .= ", ".$this->db->prefix()."societe_commerciaux as sc"; |
1555
|
1555
|
} |
1556
|
|
- $sql .= " WHERE s.entity IN (" . getEntity('societe') . ")"; |
|
1556
|
+ $sql .= " WHERE s.entity IN (".getEntity('societe').")"; |
1557
|
1557
|
if (!empty($user->socid)) { |
1558
|
|
- $sql .= " AND s.rowid = " . ((int) $user->socid); |
|
1558
|
+ $sql .= " AND s.rowid = ".((int) $user->socid); |
1559
|
1559
|
} |
1560
|
1560
|
if ($filter) { |
1561
|
1561
|
// $filter is safe because, if it contains '(' or ')', it has been sanitized by testSqlAndScriptInject() and forgeSQLFromUniversalSearchCriteria() |
1562
|
1562
|
// if not, by testSqlAndScriptInject() only. |
1563
|
|
- $sql .= " AND (" . $filter . ")"; |
|
1563
|
+ $sql .= " AND (".$filter.")"; |
1564
|
1564
|
} |
1565
|
1565
|
if (!$user->hasRight('societe', 'client', 'voir')) { |
1566
|
|
- $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " . ((int) $user->id); |
|
1566
|
+ $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id); |
1567
|
1567
|
} |
1568
|
1568
|
if (getDolGlobalString('COMPANY_HIDE_INACTIVE_IN_COMBOBOX')) { |
1569
|
1569
|
$sql .= " AND s.status <> 0"; |
1570
|
1570
|
} |
1571
|
1571
|
if (!empty($excludeids)) { |
1572
|
|
- $sql .= " AND s.rowid NOT IN (" . $this->db->sanitize(implode(',', $excludeids)) . ")"; |
|
1572
|
+ $sql .= " AND s.rowid NOT IN (".$this->db->sanitize(implode(',', $excludeids)).")"; |
1573
|
1573
|
} |
1574
|
1574
|
// Add where from hooks |
1575
|
1575
|
$parameters = array(); |
|
@@ -1589,17 +1589,17 @@ discard block |
|
|
block discarded – undo |
1589
|
1589
|
if ($i > 0) { |
1590
|
1590
|
$sql .= " AND "; |
1591
|
1591
|
} |
1592
|
|
- $sql .= "(s.nom LIKE '" . $this->db->escape($prefix . $crit) . "%')"; |
|
1592
|
+ $sql .= "(s.nom LIKE '".$this->db->escape($prefix.$crit)."%')"; |
1593
|
1593
|
$i++; |
1594
|
1594
|
} |
1595
|
1595
|
if (count($search_crit) > 1) { |
1596
|
1596
|
$sql .= ")"; |
1597
|
1597
|
} |
1598
|
1598
|
if (isModEnabled('barcode')) { |
1599
|
|
- $sql .= " OR s.barcode LIKE '" . $this->db->escape($prefix . $filterkey) . "%'"; |
|
1599
|
+ $sql .= " OR s.barcode LIKE '".$this->db->escape($prefix.$filterkey)."%'"; |
1600
|
1600
|
} |
1601
|
|
- $sql .= " OR s.code_client LIKE '" . $this->db->escape($prefix . $filterkey) . "%' OR s.code_fournisseur LIKE '" . $this->db->escape($prefix . $filterkey) . "%'"; |
1602
|
|
- $sql .= " OR s.name_alias LIKE '" . $this->db->escape($prefix . $filterkey) . "%' OR s.tva_intra LIKE '" . $this->db->escape($prefix . $filterkey) . "%'"; |
|
1601
|
+ $sql .= " OR s.code_client LIKE '".$this->db->escape($prefix.$filterkey)."%' OR s.code_fournisseur LIKE '".$this->db->escape($prefix.$filterkey)."%'"; |
|
1602
|
+ $sql .= " OR s.name_alias LIKE '".$this->db->escape($prefix.$filterkey)."%' OR s.tva_intra LIKE '".$this->db->escape($prefix.$filterkey)."%'"; |
1603
|
1603
|
$sql .= ")"; |
1604
|
1604
|
} |
1605
|
1605
|
$sql .= $this->db->order("nom", "ASC"); |
|
@@ -1610,7 +1610,7 @@ discard block |
|
|
block discarded – undo |
1610
|
1610
|
$resql = $this->db->query($sql); |
1611
|
1611
|
if ($resql) { |
1612
|
1612
|
// Construct $out and $outarray |
1613
|
|
- $out .= '<select id="' . $htmlname . '" class="flat' . ($morecss ? ' ' . $morecss : '') . '"' . ($moreparam ? ' ' . $moreparam : '') . ' name="' . $htmlname . ($multiple ? '[]' : '') . '" ' . ($multiple ? 'multiple' : '') . '>' . "\n"; |
|
1613
|
+ $out .= '<select id="'.$htmlname.'" class="flat'.($morecss ? ' '.$morecss : '').'"'.($moreparam ? ' '.$moreparam : '').' name="'.$htmlname.($multiple ? '[]' : '').'" '.($multiple ? 'multiple' : '').'>'."\n"; |
1614
|
1614
|
|
1615
|
1615
|
$textifempty = (($showempty && !is_numeric($showempty)) ? $langs->trans($showempty) : ''); |
1616
|
1616
|
if (getDolGlobalString('COMPANY_USE_SEARCH_TO_SELECT')) { |
|
@@ -1623,7 +1623,7 @@ discard block |
|
|
block discarded – undo |
1623
|
1623
|
} |
1624
|
1624
|
} |
1625
|
1625
|
if ($showempty) { |
1626
|
|
- $out .= '<option value="-1" data-html="' . dol_escape_htmltag('<span class="opacitymedium">' . ($textifempty ? $textifempty : ' ') . '</span>') . '">' . $textifempty . '</option>' . "\n"; |
|
1626
|
+ $out .= '<option value="-1" data-html="'.dol_escape_htmltag('<span class="opacitymedium">'.($textifempty ? $textifempty : ' ').'</span>').'">'.$textifempty.'</option>'."\n"; |
1627
|
1627
|
} |
1628
|
1628
|
|
1629
|
1629
|
$companytemp = new Societe($this->db); |
|
@@ -1636,18 +1636,18 @@ discard block |
|
|
block discarded – undo |
1636
|
1636
|
$label = ''; |
1637
|
1637
|
if ($showcode || getDolGlobalString('SOCIETE_ADD_REF_IN_LIST')) { |
1638
|
1638
|
if (($obj->client) && (!empty($obj->code_client))) { |
1639
|
|
- $label = $obj->code_client . ' - '; |
|
1639
|
+ $label = $obj->code_client.' - '; |
1640
|
1640
|
} |
1641
|
1641
|
if (($obj->fournisseur) && (!empty($obj->code_fournisseur))) { |
1642
|
|
- $label .= $obj->code_fournisseur . ' - '; |
|
1642
|
+ $label .= $obj->code_fournisseur.' - '; |
1643
|
1643
|
} |
1644
|
|
- $label .= ' ' . $obj->name; |
|
1644
|
+ $label .= ' '.$obj->name; |
1645
|
1645
|
} else { |
1646
|
1646
|
$label = $obj->name; |
1647
|
1647
|
} |
1648
|
1648
|
|
1649
|
1649
|
if (!empty($obj->name_alias)) { |
1650
|
|
- $label .= ' (' . $obj->name_alias . ')'; |
|
1650
|
+ $label .= ' ('.$obj->name_alias.')'; |
1651
|
1651
|
} |
1652
|
1652
|
|
1653
|
1653
|
if (getDolGlobalString('SOCIETE_SHOW_VAT_IN_LIST') && !empty($obj->tva_intra)) { |
|
@@ -1662,7 +1662,7 @@ discard block |
|
|
block discarded – undo |
1662
|
1662
|
$companytemp->fournisseur = $obj->fournisseur; |
1663
|
1663
|
$tmptype = $companytemp->getTypeUrl(1, '', 0, 'span'); |
1664
|
1664
|
if ($tmptype) { |
1665
|
|
- $labelhtml .= ' ' . $tmptype; |
|
1665
|
+ $labelhtml .= ' '.$tmptype; |
1666
|
1666
|
} |
1667
|
1667
|
|
1668
|
1668
|
if ($obj->client || $obj->fournisseur) { |
|
@@ -1672,10 +1672,10 @@ discard block |
|
|
block discarded – undo |
1672
|
1672
|
$label .= $langs->trans("Customer"); |
1673
|
1673
|
} |
1674
|
1674
|
if ($obj->client == 2 || $obj->client == 3) { |
1675
|
|
- $label .= ($obj->client == 3 ? ', ' : '') . $langs->trans("Prospect"); |
|
1675
|
+ $label .= ($obj->client == 3 ? ', ' : '').$langs->trans("Prospect"); |
1676
|
1676
|
} |
1677
|
1677
|
if ($obj->fournisseur) { |
1678
|
|
- $label .= ($obj->client ? ', ' : '') . $langs->trans("Supplier"); |
|
1678
|
+ $label .= ($obj->client ? ', ' : '').$langs->trans("Supplier"); |
1679
|
1679
|
} |
1680
|
1680
|
if ($obj->client || $obj->fournisseur) { |
1681
|
1681
|
$label .= ')'; |
|
@@ -1683,9 +1683,9 @@ discard block |
|
|
block discarded – undo |
1683
|
1683
|
} |
1684
|
1684
|
|
1685
|
1685
|
if (getDolGlobalString('COMPANY_SHOW_ADDRESS_SELECTLIST')) { |
1686
|
|
- $s = ($obj->address ? ' - ' . $obj->address : '') . ($obj->zip ? ' - ' . $obj->zip : '') . ($obj->town ? ' ' . $obj->town : ''); |
|
1686
|
+ $s = ($obj->address ? ' - '.$obj->address : '').($obj->zip ? ' - '.$obj->zip : '').($obj->town ? ' '.$obj->town : ''); |
1687
|
1687
|
if (!empty($obj->country_code)) { |
1688
|
|
- $s .= ', ' . $langs->trans('Country' . $obj->country_code); |
|
1688
|
+ $s .= ', '.$langs->trans('Country'.$obj->country_code); |
1689
|
1689
|
} |
1690
|
1690
|
$label .= $s; |
1691
|
1691
|
$labelhtml .= $s; |
|
@@ -1693,9 +1693,9 @@ discard block |
|
|
block discarded – undo |
1693
|
1693
|
|
1694
|
1694
|
if (empty($outputmode)) { |
1695
|
1695
|
if (in_array($obj->rowid, $selected)) { |
1696
|
|
- $out .= '<option value="' . $obj->rowid . '" selected data-html="' . dol_escape_htmltag($labelhtml, 0, 0, '', 0, 1) . '">' . dol_escape_htmltag($label, 0, 0, '', 0, 1) . '</option>'; |
|
1696
|
+ $out .= '<option value="'.$obj->rowid.'" selected data-html="'.dol_escape_htmltag($labelhtml, 0, 0, '', 0, 1).'">'.dol_escape_htmltag($label, 0, 0, '', 0, 1).'</option>'; |
1697
|
1697
|
} else { |
1698
|
|
- $out .= '<option value="' . $obj->rowid . '" data-html="' . dol_escape_htmltag($labelhtml, 0, 0, '', 0, 1) . '">' . dol_escape_htmltag($label, 0, 0, '', 0, 1) . '</option>'; |
|
1698
|
+ $out .= '<option value="'.$obj->rowid.'" data-html="'.dol_escape_htmltag($labelhtml, 0, 0, '', 0, 1).'">'.dol_escape_htmltag($label, 0, 0, '', 0, 1).'</option>'; |
1699
|
1699
|
} |
1700
|
1700
|
} else { |
1701
|
1701
|
array_push($outarray, array('key' => $obj->rowid, 'value' => $label, 'label' => $label, 'labelhtml' => $labelhtml)); |
|
@@ -1707,9 +1707,9 @@ discard block |
|
|
block discarded – undo |
1707
|
1707
|
} |
1708
|
1708
|
} |
1709
|
1709
|
} |
1710
|
|
- $out .= '</select>' . "\n"; |
|
1710
|
+ $out .= '</select>'."\n"; |
1711
|
1711
|
if (!$forcecombo) { |
1712
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
1712
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
1713
|
1713
|
$out .= ajax_combobox($htmlname, $events, getDolGlobalInt("COMPANY_USE_SEARCH_TO_SELECT")); |
1714
|
1714
|
} |
1715
|
1715
|
} else { |
|
@@ -1798,7 +1798,7 @@ discard block |
|
|
block discarded – undo |
1798
|
1798
|
} |
1799
|
1799
|
|
1800
|
1800
|
if (!is_object($hookmanager)) { |
1801
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/class/hookmanager.class.php'; |
|
1801
|
+ include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; |
1802
|
1802
|
$hookmanager = new HookManager($this->db); |
1803
|
1803
|
} |
1804
|
1804
|
|
|
@@ -1807,14 +1807,14 @@ discard block |
|
|
block discarded – undo |
1807
|
1807
|
if ($showsoc > 0 || getDolGlobalString('CONTACT_SHOW_EMAIL_PHONE_TOWN_SELECTLIST')) { |
1808
|
1808
|
$sql .= ", s.nom as company, s.town AS company_town"; |
1809
|
1809
|
} |
1810
|
|
- $sql .= " FROM " . $this->db->prefix() . "socpeople as sp"; |
|
1810
|
+ $sql .= " FROM ".$this->db->prefix()."socpeople as sp"; |
1811
|
1811
|
if ($showsoc > 0 || getDolGlobalString('CONTACT_SHOW_EMAIL_PHONE_TOWN_SELECTLIST')) { |
1812
|
|
- $sql .= " LEFT OUTER JOIN " . $this->db->prefix() . "societe as s ON s.rowid=sp.fk_soc"; |
|
1812
|
+ $sql .= " LEFT OUTER JOIN ".$this->db->prefix()."societe as s ON s.rowid=sp.fk_soc"; |
1813
|
1813
|
} |
1814
|
|
- $sql .= " WHERE sp.entity IN (" . getEntity('contact') . ")"; |
|
1814
|
+ $sql .= " WHERE sp.entity IN (".getEntity('contact').")"; |
1815
|
1815
|
$sql .= " AND ((sp.fk_user_creat = ".((int) $user->id)." AND sp.priv = 1) OR sp.priv = 0)"; // check if this is a private contact |
1816
|
1816
|
if ($socid > 0 || $socid == -1) { |
1817
|
|
- $sql .= " AND sp.fk_soc = " . ((int) $socid); |
|
1817
|
+ $sql .= " AND sp.fk_soc = ".((int) $socid); |
1818
|
1818
|
} |
1819
|
1819
|
if (getDolGlobalString('CONTACT_HIDE_INACTIVE_IN_COMBOBOX')) { |
1820
|
1820
|
$sql .= " AND sp.statut <> 0"; |
|
@@ -1822,7 +1822,7 @@ discard block |
|
|
block discarded – undo |
1822
|
1822
|
if ($filter) { |
1823
|
1823
|
// $filter is safe because, if it contains '(' or ')', it has been sanitized by testSqlAndScriptInject() and forgeSQLFromUniversalSearchCriteria() |
1824
|
1824
|
// if not, by testSqlAndScriptInject() only. |
1825
|
|
- $sql .= " AND (" . $filter . ")"; |
|
1825
|
+ $sql .= " AND (".$filter.")"; |
1826
|
1826
|
} |
1827
|
1827
|
// Add where from hooks |
1828
|
1828
|
$parameters = array(); |
|
@@ -1830,30 +1830,30 @@ discard block |
|
|
block discarded – undo |
1830
|
1830
|
$sql .= $hookmanager->resPrint; |
1831
|
1831
|
$sql .= " ORDER BY sp.lastname ASC"; |
1832
|
1832
|
|
1833
|
|
- dol_syslog(get_class($this) . "::selectcontacts", LOG_DEBUG); |
|
1833
|
+ dol_syslog(get_class($this)."::selectcontacts", LOG_DEBUG); |
1834
|
1834
|
$resql = $this->db->query($sql); |
1835
|
1835
|
if ($resql) { |
1836
|
1836
|
$num = $this->db->num_rows($resql); |
1837
|
1837
|
|
1838
|
1838
|
if ($htmlname != 'none' && !$options_only) { |
1839
|
|
- $out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" id="' . $htmlid . '" name="' . $htmlname . ($multiple ? '[]' : '') . '" ' . (($num || empty($disableifempty)) ? '' : ' disabled') . ($multiple ? 'multiple' : '') . ' ' . (!empty($moreparam) ? $moreparam : '') . '>'; |
|
1839
|
+ $out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" id="'.$htmlid.'" name="'.$htmlname.($multiple ? '[]' : '').'" '.(($num || empty($disableifempty)) ? '' : ' disabled').($multiple ? 'multiple' : '').' '.(!empty($moreparam) ? $moreparam : '').'>'; |
1840
|
1840
|
} |
1841
|
1841
|
|
1842
|
1842
|
if ($showempty && !is_numeric($showempty)) { |
1843
|
1843
|
$textforempty = $showempty; |
1844
|
|
- $out .= '<option class="optiongrey" value="-1"' . (in_array(-1, $selected) ? ' selected' : '') . '>' . $textforempty . '</option>'; |
|
1844
|
+ $out .= '<option class="optiongrey" value="-1"'.(in_array(-1, $selected) ? ' selected' : '').'>'.$textforempty.'</option>'; |
1845
|
1845
|
} else { |
1846
|
1846
|
if (($showempty == 1 || ($showempty == 3 && $num > 1)) && !$multiple) { |
1847
|
|
- $out .= '<option value="0"' . (in_array(0, $selected) ? ' selected' : '') . '> </option>'; |
|
1847
|
+ $out .= '<option value="0"'.(in_array(0, $selected) ? ' selected' : '').'> </option>'; |
1848
|
1848
|
} |
1849
|
1849
|
if ($showempty == 2) { |
1850
|
|
- $out .= '<option value="0"' . (in_array(0, $selected) ? ' selected' : '') . '>-- ' . $langs->trans("Internal") . ' --</option>'; |
|
1850
|
+ $out .= '<option value="0"'.(in_array(0, $selected) ? ' selected' : '').'>-- '.$langs->trans("Internal").' --</option>'; |
1851
|
1851
|
} |
1852
|
1852
|
} |
1853
|
1853
|
|
1854
|
1854
|
$i = 0; |
1855
|
1855
|
if ($num) { |
1856
|
|
- include_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php'; |
|
1856
|
+ include_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; |
1857
|
1857
|
$contactstatic = new Contact($this->db); |
1858
|
1858
|
|
1859
|
1859
|
while ($i < $num) { |
|
@@ -1889,7 +1889,7 @@ discard block |
|
|
block discarded – undo |
1889
|
1889
|
} |
1890
|
1890
|
$extendedInfos = implode(' - ', $extendedInfos); |
1891
|
1891
|
if (!empty($extendedInfos)) { |
1892
|
|
- $extendedInfos = ' - ' . $extendedInfos; |
|
1892
|
+ $extendedInfos = ' - '.$extendedInfos; |
1893
|
1893
|
} |
1894
|
1894
|
} |
1895
|
1895
|
|
|
@@ -1907,35 +1907,35 @@ discard block |
|
|
block discarded – undo |
1907
|
1907
|
$disabled = 1; |
1908
|
1908
|
} |
1909
|
1909
|
if (!empty($selected) && in_array($obj->rowid, $selected)) { |
1910
|
|
- $out .= '<option value="' . $obj->rowid . '"'; |
|
1910
|
+ $out .= '<option value="'.$obj->rowid.'"'; |
1911
|
1911
|
if ($disabled) { |
1912
|
1912
|
$out .= ' disabled'; |
1913
|
1913
|
} |
1914
|
1914
|
$out .= ' selected>'; |
1915
|
1915
|
|
1916
|
|
- $tmplabel = $contactstatic->getFullName($langs) . $extendedInfos; |
|
1916
|
+ $tmplabel = $contactstatic->getFullName($langs).$extendedInfos; |
1917
|
1917
|
if ($showfunction && $obj->poste) { |
1918
|
|
- $tmplabel .= ' (' . $obj->poste . ')'; |
|
1918
|
+ $tmplabel .= ' ('.$obj->poste.')'; |
1919
|
1919
|
} |
1920
|
1920
|
if (($showsoc > 0) && $obj->company) { |
1921
|
|
- $tmplabel .= ' - (' . $obj->company . ')'; |
|
1921
|
+ $tmplabel .= ' - ('.$obj->company.')'; |
1922
|
1922
|
} |
1923
|
1923
|
|
1924
|
1924
|
$out .= $tmplabel; |
1925
|
1925
|
$out .= '</option>'; |
1926
|
1926
|
} else { |
1927
|
|
- $out .= '<option value="' . $obj->rowid . '"'; |
|
1927
|
+ $out .= '<option value="'.$obj->rowid.'"'; |
1928
|
1928
|
if ($disabled) { |
1929
|
1929
|
$out .= ' disabled'; |
1930
|
1930
|
} |
1931
|
1931
|
$out .= '>'; |
1932
|
1932
|
|
1933
|
|
- $tmplabel = $contactstatic->getFullName($langs) . $extendedInfos; |
|
1933
|
+ $tmplabel = $contactstatic->getFullName($langs).$extendedInfos; |
1934
|
1934
|
if ($showfunction && $obj->poste) { |
1935
|
|
- $tmplabel .= ' (' . $obj->poste . ')'; |
|
1935
|
+ $tmplabel .= ' ('.$obj->poste.')'; |
1936
|
1936
|
} |
1937
|
1937
|
if (($showsoc > 0) && $obj->company) { |
1938
|
|
- $tmplabel .= ' - (' . $obj->company . ')'; |
|
1938
|
+ $tmplabel .= ' - ('.$obj->company.')'; |
1939
|
1939
|
} |
1940
|
1940
|
|
1941
|
1941
|
$out .= $tmplabel; |
|
@@ -1943,12 +1943,12 @@ discard block |
|
|
block discarded – undo |
1943
|
1943
|
} |
1944
|
1944
|
} else { |
1945
|
1945
|
if (in_array($obj->rowid, $selected)) { |
1946
|
|
- $tmplabel = $contactstatic->getFullName($langs) . $extendedInfos; |
|
1946
|
+ $tmplabel = $contactstatic->getFullName($langs).$extendedInfos; |
1947
|
1947
|
if ($showfunction && $obj->poste) { |
1948
|
|
- $tmplabel .= ' (' . $obj->poste . ')'; |
|
1948
|
+ $tmplabel .= ' ('.$obj->poste.')'; |
1949
|
1949
|
} |
1950
|
1950
|
if (($showsoc > 0) && $obj->company) { |
1951
|
|
- $tmplabel .= ' - (' . $obj->company . ')'; |
|
1951
|
+ $tmplabel .= ' - ('.$obj->company.')'; |
1952
|
1952
|
} |
1953
|
1953
|
|
1954
|
1954
|
$out .= $tmplabel; |
|
@@ -1963,7 +1963,7 @@ discard block |
|
|
block discarded – undo |
1963
|
1963
|
} |
1964
|
1964
|
} else { |
1965
|
1965
|
$labeltoshow = ($socid != -1) ? ($langs->trans($socid ? "NoContactDefinedForThirdParty" : "NoContactDefined")) : $langs->trans('SelectAThirdPartyFirst'); |
1966
|
|
- $out .= '<option class="disabled" value="-1"' . (($showempty == 2 || $multiple) ? '' : ' selected') . ' disabled="disabled">'; |
|
1966
|
+ $out .= '<option class="disabled" value="-1"'.(($showempty == 2 || $multiple) ? '' : ' selected').' disabled="disabled">'; |
1967
|
1967
|
$out .= $labeltoshow; |
1968
|
1968
|
$out .= '</option>'; |
1969
|
1969
|
} |
|
@@ -1984,7 +1984,7 @@ discard block |
|
|
block discarded – undo |
1984
|
1984
|
} |
1985
|
1985
|
|
1986
|
1986
|
if ($conf->use_javascript_ajax && !$forcecombo && !$options_only) { |
1987
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
1987
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
1988
|
1988
|
$out .= ajax_combobox($htmlid, $events, getDolGlobalInt("CONTACT_USE_SEARCH_TO_SELECT")); |
1989
|
1989
|
} |
1990
|
1990
|
|
|
@@ -2023,18 +2023,18 @@ discard block |
|
|
block discarded – undo |
2023
|
2023
|
// On recherche les remises |
2024
|
2024
|
$sql = "SELECT re.rowid, re.amount_ht, re.amount_tva, re.amount_ttc,"; |
2025
|
2025
|
$sql .= " re.description, re.fk_facture_source"; |
2026
|
|
- $sql .= " FROM " . $this->db->prefix() . "societe_remise_except as re"; |
2027
|
|
- $sql .= " WHERE re.fk_soc = " . (int) $socid; |
2028
|
|
- $sql .= " AND re.entity = " . $conf->entity; |
|
2026
|
+ $sql .= " FROM ".$this->db->prefix()."societe_remise_except as re"; |
|
2027
|
+ $sql .= " WHERE re.fk_soc = ".(int) $socid; |
|
2028
|
+ $sql .= " AND re.entity = ".$conf->entity; |
2029
|
2029
|
if ($filter) { |
2030
|
|
- $sql .= " AND " . $filter; |
|
2030
|
+ $sql .= " AND ".$filter; |
2031
|
2031
|
} |
2032
|
2032
|
$sql .= " ORDER BY re.description ASC"; |
2033
|
2033
|
|
2034
|
|
- dol_syslog(get_class($this) . "::select_remises", LOG_DEBUG); |
|
2034
|
+ dol_syslog(get_class($this)."::select_remises", LOG_DEBUG); |
2035
|
2035
|
$resql = $this->db->query($sql); |
2036
|
2036
|
if ($resql) { |
2037
|
|
- print '<select id="select_' . $htmlname . '" class="flat maxwidthonsmartphone" name="' . $htmlname . '">'; |
|
2037
|
+ print '<select id="select_'.$htmlname.'" class="flat maxwidthonsmartphone" name="'.$htmlname.'">'; |
2038
|
2038
|
$num = $this->db->num_rows($resql); |
2039
|
2039
|
|
2040
|
2040
|
$qualifiedlines = $num; |
|
@@ -2072,16 +2072,16 @@ discard block |
|
|
block discarded – undo |
2072
|
2072
|
if (getDolGlobalString('MAIN_SHOW_FACNUMBER_IN_DISCOUNT_LIST') && !empty($obj->fk_facture_source)) { |
2073
|
2073
|
$tmpfac = new Facture($this->db); |
2074
|
2074
|
if ($tmpfac->fetch($obj->fk_facture_source) > 0) { |
2075
|
|
- $desc = $desc . ' - ' . $tmpfac->ref; |
|
2075
|
+ $desc = $desc.' - '.$tmpfac->ref; |
2076
|
2076
|
} |
2077
|
2077
|
} |
2078
|
2078
|
|
2079
|
|
- print '<option value="' . $obj->rowid . '"' . $selectstring . $disabled . '>' . $desc . ' (' . price($obj->amount_ht) . ' ' . $langs->trans("HT") . ' - ' . price($obj->amount_ttc) . ' ' . $langs->trans("TTC") . ')</option>'; |
|
2079
|
+ print '<option value="'.$obj->rowid.'"'.$selectstring.$disabled.'>'.$desc.' ('.price($obj->amount_ht).' '.$langs->trans("HT").' - '.price($obj->amount_ttc).' '.$langs->trans("TTC").')</option>'; |
2080
|
2080
|
$i++; |
2081
|
2081
|
} |
2082
|
2082
|
} |
2083
|
2083
|
print '</select>'; |
2084
|
|
- print ajax_combobox('select_' . $htmlname); |
|
2084
|
+ print ajax_combobox('select_'.$htmlname); |
2085
|
2085
|
|
2086
|
2086
|
return $qualifiedlines; |
2087
|
2087
|
} else { |
|
@@ -2190,14 +2190,14 @@ discard block |
|
|
block discarded – undo |
2190
|
2190
|
if ($showlabelofentity) { |
2191
|
2191
|
$sql .= ", e.label"; |
2192
|
2192
|
} |
2193
|
|
- $sql .= " FROM " . $this->db->prefix() . "user as u"; |
|
2193
|
+ $sql .= " FROM ".$this->db->prefix()."user as u"; |
2194
|
2194
|
if ($showlabelofentity) { |
2195
|
|
- $sql .= " LEFT JOIN " . $this->db->prefix() . "entity as e ON e.rowid = u.entity"; |
|
2195
|
+ $sql .= " LEFT JOIN ".$this->db->prefix()."entity as e ON e.rowid = u.entity"; |
2196
|
2196
|
} |
2197
|
2197
|
// Condition here should be the same than into societe->getSalesRepresentatives(). |
2198
|
2198
|
if ($userissuperadminentityone && $force_entity != 'default') { |
2199
|
2199
|
if (!empty($force_entity)) { |
2200
|
|
- $sql .= " WHERE u.entity IN (0, " . $this->db->sanitize($force_entity) . ")"; |
|
2200
|
+ $sql .= " WHERE u.entity IN (0, ".$this->db->sanitize($force_entity).")"; |
2201
|
2201
|
} else { |
2202
|
2202
|
$sql .= " WHERE u.entity IS NOT NULL"; |
2203
|
2203
|
} |
|
@@ -2205,18 +2205,18 @@ discard block |
|
|
block discarded – undo |
2205
|
2205
|
if (isModEnabled('multicompany') && getDolGlobalInt('MULTICOMPANY_TRANSVERSE_MODE')) { |
2206
|
2206
|
$sql .= " WHERE u.rowid IN (SELECT ug.fk_user FROM ".$this->db->prefix()."usergroup_user as ug WHERE ug.entity IN (".getEntity('usergroup')."))"; |
2207
|
2207
|
} else { |
2208
|
|
- $sql .= " WHERE u.entity IN (" . getEntity('user') . ")"; |
|
2208
|
+ $sql .= " WHERE u.entity IN (".getEntity('user').")"; |
2209
|
2209
|
} |
2210
|
2210
|
} |
2211
|
2211
|
|
2212
|
2212
|
if (!empty($user->socid)) { |
2213
|
|
- $sql .= " AND u.fk_soc = " . ((int) $user->socid); |
|
2213
|
+ $sql .= " AND u.fk_soc = ".((int) $user->socid); |
2214
|
2214
|
} |
2215
|
2215
|
if (is_array($exclude) && $excludeUsers) { |
2216
|
|
- $sql .= " AND u.rowid NOT IN (" . $this->db->sanitize($excludeUsers) . ")"; |
|
2216
|
+ $sql .= " AND u.rowid NOT IN (".$this->db->sanitize($excludeUsers).")"; |
2217
|
2217
|
} |
2218
|
2218
|
if ($includeUsers) { |
2219
|
|
- $sql .= " AND u.rowid IN (" . $this->db->sanitize($includeUsers) . ")"; |
|
2219
|
+ $sql .= " AND u.rowid IN (".$this->db->sanitize($includeUsers).")"; |
2220
|
2220
|
} |
2221
|
2221
|
if (getDolGlobalString('USER_HIDE_INACTIVE_IN_COMBOBOX') || $notdisabled) { |
2222
|
2222
|
$sql .= " AND u.statut <> 0"; |
|
@@ -2228,7 +2228,7 @@ discard block |
|
|
block discarded – undo |
2228
|
2228
|
$sql .= " AND u.fk_soc IS NULL"; |
2229
|
2229
|
} |
2230
|
2230
|
if (!empty($morefilter)) { |
2231
|
|
- $sql .= " " . $morefilter; |
|
2231
|
+ $sql .= " ".$morefilter; |
2232
|
2232
|
} |
2233
|
2233
|
|
2234
|
2234
|
//Add hook to filter on user (for example on usergroup define in custom modules) |
|
@@ -2243,7 +2243,7 @@ discard block |
|
|
block discarded – undo |
2243
|
2243
|
$sql .= " ORDER BY u.statut DESC, u.lastname ASC, u.firstname ASC"; |
2244
|
2244
|
} |
2245
|
2245
|
|
2246
|
|
- dol_syslog(get_class($this) . "::select_dolusers", LOG_DEBUG); |
|
2246
|
+ dol_syslog(get_class($this)."::select_dolusers", LOG_DEBUG); |
2247
|
2247
|
|
2248
|
2248
|
$resql = $this->db->query($sql); |
2249
|
2249
|
if ($resql) { |
|
@@ -2251,7 +2251,7 @@ discard block |
|
|
block discarded – undo |
2251
|
2251
|
$i = 0; |
2252
|
2252
|
if ($num) { |
2253
|
2253
|
// do not use maxwidthonsmartphone by default. Set it by caller so auto size to 100% will work when not defined |
2254
|
|
- $out .= '<select class="flat' . ($morecss ? ' ' . $morecss : ' minwidth200') . '" id="' . $htmlname . '" name="' . $htmlname . ($multiple ? '[]' : '') . '" ' . ($multiple ? 'multiple' : '') . ' ' . ($disabled ? ' disabled' : '') . '>'; |
|
2254
|
+ $out .= '<select class="flat'.($morecss ? ' '.$morecss : ' minwidth200').'" id="'.$htmlname.'" name="'.$htmlname.($multiple ? '[]' : '').'" '.($multiple ? 'multiple' : '').' '.($disabled ? ' disabled' : '').'>'; |
2255
|
2255
|
if ($show_empty && !$multiple) { |
2256
|
2256
|
$textforempty = ' '; |
2257
|
2257
|
if (!empty($conf->use_javascript_ajax)) { |
|
@@ -2260,7 +2260,7 @@ discard block |
|
|
block discarded – undo |
2260
|
2260
|
if (!is_numeric($show_empty)) { |
2261
|
2261
|
$textforempty = $show_empty; |
2262
|
2262
|
} |
2263
|
|
- $out .= '<option class="optiongrey" value="' . ($show_empty < 0 ? $show_empty : -1) . '"' . ((empty($selected) || in_array(-1, $selected)) ? ' selected' : '') . '>' . $textforempty . '</option>' . "\n"; |
|
2263
|
+ $out .= '<option class="optiongrey" value="'.($show_empty < 0 ? $show_empty : -1).'"'.((empty($selected) || in_array(-1, $selected)) ? ' selected' : '').'>'.$textforempty.'</option>'."\n"; |
2264
|
2264
|
|
2265
|
2265
|
$outarray[($show_empty < 0 ? $show_empty : -1)] = $textforempty; |
2266
|
2266
|
$outarray2[($show_empty < 0 ? $show_empty : -1)] = array( |
|
@@ -2272,13 +2272,13 @@ discard block |
|
|
block discarded – undo |
2272
|
2272
|
); |
2273
|
2273
|
} |
2274
|
2274
|
if ($show_every) { |
2275
|
|
- $out .= '<option value="-2"' . ((in_array(-2, $selected)) ? ' selected' : '') . '>-- ' . $langs->trans("Everybody") . ' --</option>' . "\n"; |
|
2275
|
+ $out .= '<option value="-2"'.((in_array(-2, $selected)) ? ' selected' : '').'>-- '.$langs->trans("Everybody").' --</option>'."\n"; |
2276
|
2276
|
|
2277
|
|
- $outarray[-2] = '-- ' . $langs->trans("Everybody") . ' --'; |
|
2277
|
+ $outarray[-2] = '-- '.$langs->trans("Everybody").' --'; |
2278
|
2278
|
$outarray2[-2] = array( |
2279
|
2279
|
'id' => -2, |
2280
|
|
- 'label' => '-- ' . $langs->trans("Everybody") . ' --', |
2281
|
|
- 'labelhtml' => '-- ' . $langs->trans("Everybody") . ' --', |
|
2280
|
+ 'label' => '-- '.$langs->trans("Everybody").' --', |
|
2281
|
+ 'labelhtml' => '-- '.$langs->trans("Everybody").' --', |
2282
|
2282
|
'color' => '', |
2283
|
2283
|
'picto' => '' |
2284
|
2284
|
); |
|
@@ -2329,21 +2329,21 @@ discard block |
|
|
block discarded – undo |
2329
|
2329
|
} |
2330
|
2330
|
if ($showstatus >= 0) { |
2331
|
2331
|
if ($obj->status == 1 && $showstatus == 1) { |
2332
|
|
- $moreinfo .= ($moreinfo ? ' - ' : ' (') . $langs->trans('Enabled'); |
2333
|
|
- $moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(') . $langs->trans('Enabled'); |
|
2332
|
+ $moreinfo .= ($moreinfo ? ' - ' : ' (').$langs->trans('Enabled'); |
|
2333
|
+ $moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(').$langs->trans('Enabled'); |
2334
|
2334
|
} |
2335
|
2335
|
if ($obj->status == 0 && $showstatus == 1) { |
2336
|
|
- $moreinfo .= ($moreinfo ? ' - ' : ' (') . $langs->trans('Disabled'); |
2337
|
|
- $moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(') . $langs->trans('Disabled'); |
|
2336
|
+ $moreinfo .= ($moreinfo ? ' - ' : ' (').$langs->trans('Disabled'); |
|
2337
|
+ $moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(').$langs->trans('Disabled'); |
2338
|
2338
|
} |
2339
|
2339
|
} |
2340
|
2340
|
if ($showlabelofentity) { |
2341
|
2341
|
if (empty($obj->entity)) { |
2342
|
|
- $moreinfo .= ($moreinfo ? ' - ' : ' (') . $langs->trans("AllEntities"); |
2343
|
|
- $moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(') . $langs->trans("AllEntities"); |
|
2342
|
+ $moreinfo .= ($moreinfo ? ' - ' : ' (').$langs->trans("AllEntities"); |
|
2343
|
+ $moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(').$langs->trans("AllEntities"); |
2344
|
2344
|
} else { |
2345
|
2345
|
if ($obj->entity != $conf->entity) { |
2346
|
|
- $moreinfo .= ($moreinfo ? ' - ' : ' (') . ($obj->label ? $obj->label : $langs->trans("EntityNameNotDefined")); |
|
2346
|
+ $moreinfo .= ($moreinfo ? ' - ' : ' (').($obj->label ? $obj->label : $langs->trans("EntityNameNotDefined")); |
2347
|
2347
|
$moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(').($obj->label ? $obj->label : $langs->trans("EntityNameNotDefined")); |
2348
|
2348
|
} |
2349
|
2349
|
} |
|
@@ -2352,13 +2352,13 @@ discard block |
|
|
block discarded – undo |
2352
|
2352
|
$moreinfohtml .= (!empty($moreinfohtml) ? ')</span>' : ''); |
2353
|
2353
|
if (!empty($disableline) && $disableline != '1') { |
2354
|
2354
|
// Add text from $enableonlytext parameter |
2355
|
|
- $moreinfo .= ' - ' . $disableline; |
2356
|
|
- $moreinfohtml .= ' - ' . $disableline; |
|
2355
|
+ $moreinfo .= ' - '.$disableline; |
|
2356
|
+ $moreinfohtml .= ' - '.$disableline; |
2357
|
2357
|
} |
2358
|
2358
|
$labeltoshow .= $moreinfo; |
2359
|
2359
|
$labeltoshowhtml .= $moreinfohtml; |
2360
|
2360
|
|
2361
|
|
- $out .= '<option value="' . $obj->rowid . '"'; |
|
2361
|
+ $out .= '<option value="'.$obj->rowid.'"'; |
2362
|
2362
|
if (!empty($disableline)) { |
2363
|
2363
|
$out .= ' disabled'; |
2364
|
2364
|
} |
|
@@ -2367,7 +2367,7 @@ discard block |
|
|
block discarded – undo |
2367
|
2367
|
} |
2368
|
2368
|
$out .= ' data-html="'; |
2369
|
2369
|
|
2370
|
|
- $outhtml = $userstatic->getNomUrl(-3, '', 0, 1, 24, 1, 'login', '', 1) . ' '; |
|
2370
|
+ $outhtml = $userstatic->getNomUrl(-3, '', 0, 1, 24, 1, 'login', '', 1).' '; |
2371
|
2371
|
if ($showstatus >= 0 && $obj->status == 0) { |
2372
|
2372
|
$outhtml .= '<strike class="opacitymediumxxx">'; |
2373
|
2373
|
} |
|
@@ -2382,7 +2382,7 @@ discard block |
|
|
block discarded – undo |
2382
|
2382
|
$out .= $labeltoshow; |
2383
|
2383
|
$out .= '</option>'; |
2384
|
2384
|
|
2385
|
|
- $outarray[$userstatic->id] = $userstatic->getFullName($langs, $fullNameMode, -1, $maxlength) . $moreinfo; |
|
2385
|
+ $outarray[$userstatic->id] = $userstatic->getFullName($langs, $fullNameMode, -1, $maxlength).$moreinfo; |
2386
|
2386
|
$outarray2[$userstatic->id] = array( |
2387
|
2387
|
'id' => $userstatic->id, |
2388
|
2388
|
'label' => $labeltoshow, |
|
@@ -2394,14 +2394,14 @@ discard block |
|
|
block discarded – undo |
2394
|
2394
|
$i++; |
2395
|
2395
|
} |
2396
|
2396
|
} else { |
2397
|
|
- $out .= '<select class="flat" id="' . $htmlname . '" name="' . $htmlname . '" disabled>'; |
2398
|
|
- $out .= '<option value="">' . $langs->trans("None") . '</option>'; |
|
2397
|
+ $out .= '<select class="flat" id="'.$htmlname.'" name="'.$htmlname.'" disabled>'; |
|
2398
|
+ $out .= '<option value="">'.$langs->trans("None").'</option>'; |
2399
|
2399
|
} |
2400
|
2400
|
$out .= '</select>'; |
2401
|
2401
|
|
2402
|
2402
|
if ($num && !$forcecombo) { |
2403
|
2403
|
// Enhance with select2 |
2404
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
2404
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
2405
|
2405
|
$out .= ajax_combobox($htmlname); |
2406
|
2406
|
} |
2407
|
2407
|
} else { |
|
@@ -2477,16 +2477,16 @@ discard block |
|
|
block discarded – undo |
2477
|
2477
|
$out .= $userstatic->getNomUrl(-1); |
2478
|
2478
|
if ($i == 0) { |
2479
|
2479
|
$ownerid = $value['id']; |
2480
|
|
- $out .= ' (' . $langs->trans("Owner") . ')'; |
|
2480
|
+ $out .= ' ('.$langs->trans("Owner").')'; |
2481
|
2481
|
} |
2482
|
2482
|
if ($nbassignetouser > 1 && $action != 'view') { |
2483
|
|
- $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 . '">'; |
|
2483
|
+ $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.'">'; |
2484
|
2484
|
} |
2485
|
2485
|
// Show my availability |
2486
|
2486
|
if ($showproperties) { |
2487
|
2487
|
if ($ownerid == $value['id'] && is_array($listofuserid) && count($listofuserid) && in_array($ownerid, array_keys($listofuserid))) { |
2488
|
2488
|
$out .= '<div class="myavailability inline-block">'; |
2489
|
|
- $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>'; |
|
2489
|
+ $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>'; |
2490
|
2490
|
$out .= '</div>'; |
2491
|
2491
|
} |
2492
|
2492
|
} |
|
@@ -2503,15 +2503,15 @@ discard block |
|
|
block discarded – undo |
2503
|
2503
|
// Method with no ajax |
2504
|
2504
|
if ($action != 'view') { |
2505
|
2505
|
$out .= '<input type="hidden" class="removedassignedhidden" name="removedassigned" value="">'; |
2506
|
|
- $out .= '<script nonce="' . getNonce() . '" type="text/javascript">jQuery(document).ready(function () {'; |
|
2506
|
+ $out .= '<script nonce="'.getNonce().'" type="text/javascript">jQuery(document).ready(function () {'; |
2507
|
2507
|
$out .= 'jQuery(".removedassigned").click(function() { jQuery(".removedassignedhidden").val(jQuery(this).val()); });'; |
2508
|
2508
|
$out .= 'jQuery(".assignedtouser").change(function() { console.log(jQuery(".assignedtouser option:selected").val());'; |
2509
|
|
- $out .= ' if (jQuery(".assignedtouser option:selected").val() > 0) { jQuery("#' . $action . 'assignedtouser").attr("disabled", false); }'; |
2510
|
|
- $out .= ' else { jQuery("#' . $action . 'assignedtouser").attr("disabled", true); }'; |
|
2509
|
+ $out .= ' if (jQuery(".assignedtouser option:selected").val() > 0) { jQuery("#'.$action.'assignedtouser").attr("disabled", false); }'; |
|
2510
|
+ $out .= ' else { jQuery("#'.$action.'assignedtouser").attr("disabled", true); }'; |
2511
|
2511
|
$out .= '});'; |
2512
|
2512
|
$out .= '})</script>'; |
2513
|
2513
|
$out .= $this->select_dolusers('', $htmlname, $show_empty, $exclude, $disabled, $include, $enableonly, $force_entity, $maxlength, $showstatus, $morefilter); |
2514
|
|
- $out .= ' <input type="submit" disabled class="button valignmiddle smallpaddingimp reposition" id="' . $action . 'assignedtouser" name="' . $action . 'assignedtouser" value="' . dol_escape_htmltag($langs->trans("Add")) . '">'; |
|
2514
|
+ $out .= ' <input type="submit" disabled class="button valignmiddle smallpaddingimp reposition" id="'.$action.'assignedtouser" name="'.$action.'assignedtouser" value="'.dol_escape_htmltag($langs->trans("Add")).'">'; |
2515
|
2515
|
$out .= '<br>'; |
2516
|
2516
|
} |
2517
|
2517
|
|
|
@@ -2570,13 +2570,13 @@ discard block |
|
|
block discarded – undo |
2570
|
2570
|
$resourcestatic->fetch($value['id']); |
2571
|
2571
|
$out .= $resourcestatic->getNomUrl(-1); |
2572
|
2572
|
if ($nbassignetoresource > 1 && $action != 'view') { |
2573
|
|
- $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 . '">'; |
|
2573
|
+ $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.'">'; |
2574
|
2574
|
} |
2575
|
2575
|
// Show my availability |
2576
|
2576
|
if ($showproperties) { |
2577
|
2577
|
if (is_array($listofresourceid) && count($listofresourceid)) { |
2578
|
2578
|
$out .= '<div class="myavailability inline-block">'; |
2579
|
|
- $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>'; |
|
2579
|
+ $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>'; |
2580
|
2580
|
$out .= '</div>'; |
2581
|
2581
|
} |
2582
|
2582
|
} |
|
@@ -2593,11 +2593,11 @@ discard block |
|
|
block discarded – undo |
2593
|
2593
|
// Method with no ajax |
2594
|
2594
|
if ($action != 'view') { |
2595
|
2595
|
$out .= '<input type="hidden" class="removedassignedhidden" name="removedassignedresource" value="">'; |
2596
|
|
- $out .= '<script nonce="' . getNonce() . '" type="text/javascript">jQuery(document).ready(function () {'; |
|
2596
|
+ $out .= '<script nonce="'.getNonce().'" type="text/javascript">jQuery(document).ready(function () {'; |
2597
|
2597
|
$out .= 'jQuery(".removedassignedresource").click(function() { jQuery(".removedassignedresourcehidden").val(jQuery(this).val()); });'; |
2598
|
2598
|
$out .= 'jQuery(".assignedtoresource").change(function() { console.log(jQuery(".assignedtoresource option:selected").val());'; |
2599
|
|
- $out .= ' if (jQuery(".assignedtoresource option:selected").val() > 0) { jQuery("#' . $action . 'assignedtoresource").attr("disabled", false); }'; |
2600
|
|
- $out .= ' else { jQuery("#' . $action . 'assignedtoresource").attr("disabled", true); }'; |
|
2599
|
+ $out .= ' if (jQuery(".assignedtoresource option:selected").val() > 0) { jQuery("#'.$action.'assignedtoresource").attr("disabled", false); }'; |
|
2600
|
+ $out .= ' else { jQuery("#'.$action.'assignedtoresource").attr("disabled", true); }'; |
2601
|
2601
|
$out .= '});'; |
2602
|
2602
|
$out .= '})</script>'; |
2603
|
2603
|
|
|
@@ -2605,7 +2605,7 @@ discard block |
|
|
block discarded – undo |
2605
|
2605
|
$out .= img_picto('', 'resource', 'class="pictofixedwidth"'); |
2606
|
2606
|
$out .= $formresources->select_resource_list(0, $htmlname, [], 1, 1, 0, $events, array(), 2, 0); |
2607
|
2607
|
//$out .= $this->select_dolusers('', $htmlname, $show_empty, $exclude, $disabled, $include, $enableonly, $force_entity, $maxlength, $showstatus, $morefilter); |
2608
|
|
- $out .= ' <input type="submit" disabled class="button valignmiddle smallpaddingimp reposition" id="' . $action . 'assignedtoresource" name="' . $action . 'assignedtoresource" value="' . dol_escape_htmltag($langs->trans("Add")) . '">'; |
|
2608
|
+ $out .= ' <input type="submit" disabled class="button valignmiddle smallpaddingimp reposition" id="'.$action.'assignedtoresource" name="'.$action.'assignedtoresource" value="'.dol_escape_htmltag($langs->trans("Add")).'">'; |
2609
|
2609
|
$out .= '<br>'; |
2610
|
2610
|
} |
2611
|
2611
|
|
|
@@ -2669,7 +2669,7 @@ discard block |
|
|
block discarded – undo |
2669
|
2669
|
$placeholder = ''; |
2670
|
2670
|
|
2671
|
2671
|
if ($selected && empty($selected_input_value)) { |
2672
|
|
- require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; |
|
2672
|
+ require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; |
2673
|
2673
|
$producttmpselect = new Product($this->db); |
2674
|
2674
|
$producttmpselect->fetch($selected); |
2675
|
2675
|
$selected_input_value = $producttmpselect->ref; |
|
@@ -2684,20 +2684,20 @@ discard block |
|
|
block discarded – undo |
2684
|
2684
|
} |
2685
|
2685
|
} |
2686
|
2686
|
// mode=1 means customers products |
2687
|
|
- $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; |
|
2687
|
+ $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; |
2688
|
2688
|
if ((int) $warehouseId > 0) { |
2689
|
|
- $urloption .= '&warehouseid=' . (int) $warehouseId; |
|
2689
|
+ $urloption .= '&warehouseid='.(int) $warehouseId; |
2690
|
2690
|
} |
2691
|
|
- $out .= ajax_autocompleter((string) $selected, $htmlname, DOL_URL_ROOT . '/product/ajax/products.php', $urloption, getDolGlobalInt('PRODUIT_USE_SEARCH_TO_SELECT'), getDolGlobalInt('PRODUCT_SEARCH_AUTO_SELECT_IF_ONLY_ONE', 1), $ajaxoptions); |
|
2691
|
+ $out .= ajax_autocompleter((string) $selected, $htmlname, DOL_URL_ROOT.'/product/ajax/products.php', $urloption, getDolGlobalInt('PRODUIT_USE_SEARCH_TO_SELECT'), getDolGlobalInt('PRODUCT_SEARCH_AUTO_SELECT_IF_ONLY_ONE', 1), $ajaxoptions); |
2692
|
2692
|
|
2693
|
2693
|
if (isModEnabled('variants') && is_array($selected_combinations)) { |
2694
|
2694
|
// Code to automatically insert with javascript the select of attributes under the select of product |
2695
|
2695
|
// when a parent of variant has been selected. |
2696
|
2696
|
$out .= ' |
2697
|
2697
|
<!-- script to auto show attributes select tags if a variant was selected --> |
2698
|
|
- <script nonce="' . getNonce() . '"> |
|
2698
|
+ <script nonce="' . getNonce().'"> |
2699
|
2699
|
// auto show attributes fields |
2700
|
|
- selected = ' . json_encode($selected_combinations) . '; |
|
2700
|
+ selected = ' . json_encode($selected_combinations).'; |
2701
|
2701
|
combvalues = {}; |
2702
|
2702
|
|
2703
|
2703
|
jQuery(document).ready(function () { |
|
@@ -2708,7 +2708,7 @@ discard block |
|
|
block discarded – undo |
2708
|
2708
|
} |
2709
|
2709
|
}); |
2710
|
2710
|
|
2711
|
|
- jQuery("input#' . $htmlname . '").change(function () { |
|
2711
|
+ jQuery("input#' . $htmlname.'").change(function () { |
2712
|
2712
|
|
2713
|
2713
|
if (!jQuery(this).val()) { |
2714
|
2714
|
jQuery(\'div#attributes_box\').empty(); |
|
@@ -2717,7 +2717,7 @@ discard block |
|
|
block discarded – undo |
2717
|
2717
|
|
2718
|
2718
|
console.log("A change has started. We get variants fields to inject html select"); |
2719
|
2719
|
|
2720
|
|
- jQuery.getJSON("' . DOL_URL_ROOT . '/variants/ajax/getCombinations.php", { |
|
2720
|
+ jQuery.getJSON("' . DOL_URL_ROOT.'/variants/ajax/getCombinations.php", { |
2721
|
2721
|
id: jQuery(this).val() |
2722
|
2722
|
}, function (data) { |
2723
|
2723
|
jQuery(\'div#attributes_box\').empty(); |
|
@@ -2760,21 +2760,21 @@ discard block |
|
|
block discarded – undo |
2760
|
2760
|
}) |
2761
|
2761
|
}); |
2762
|
2762
|
|
2763
|
|
- ' . ($selected ? 'jQuery("input#' . $htmlname . '").change();' : '') . ' |
|
2763
|
+ ' . ($selected ? 'jQuery("input#'.$htmlname.'").change();' : '').' |
2764
|
2764
|
}); |
2765
|
2765
|
</script> |
2766
|
2766
|
'; |
2767
|
2767
|
} |
2768
|
2768
|
|
2769
|
2769
|
if (empty($hidelabel)) { |
2770
|
|
- $out .= $langs->trans("RefOrLabel") . ' : '; |
|
2770
|
+ $out .= $langs->trans("RefOrLabel").' : '; |
2771
|
2771
|
} elseif ($hidelabel > 1) { |
2772
|
|
- $placeholder = ' placeholder="' . $langs->trans("RefOrLabel") . '"'; |
|
2772
|
+ $placeholder = ' placeholder="'.$langs->trans("RefOrLabel").'"'; |
2773
|
2773
|
if ($hidelabel == 2) { |
2774
|
2774
|
$out .= img_picto($langs->trans("Search"), 'search'); |
2775
|
2775
|
} |
2776
|
2776
|
} |
2777
|
|
- $out .= '<input type="text" class="minwidth100' . ($morecss ? ' ' . $morecss : '') . '" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . $placeholder . ' ' . (getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '') . ' />'; |
|
2777
|
+ $out .= '<input type="text" class="minwidth100'.($morecss ? ' '.$morecss : '').'" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' '.(getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '').' />'; |
2778
|
2778
|
if ($hidelabel == 3) { |
2779
|
2779
|
$out .= img_picto($langs->trans("Search"), 'search'); |
2780
|
2780
|
} |
|
@@ -2811,33 +2811,33 @@ discard block |
|
|
block discarded – undo |
2811
|
2811
|
// phpcs:enable |
2812
|
2812
|
global $db; |
2813
|
2813
|
|
2814
|
|
- require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; |
|
2814
|
+ require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; |
2815
|
2815
|
|
2816
|
2816
|
$error = 0; |
2817
|
2817
|
$out = ''; |
2818
|
2818
|
|
2819
|
2819
|
if (!$forcecombo) { |
2820
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
2820
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
2821
|
2821
|
$events = array(); |
2822
|
2822
|
$out .= ajax_combobox($htmlname, $events, getDolGlobalInt("PRODUIT_USE_SEARCH_TO_SELECT")); |
2823
|
2823
|
} |
2824
|
2824
|
|
2825
|
|
- $out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">'; |
|
2825
|
+ $out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">'; |
2826
|
2826
|
|
2827
|
2827
|
$sql = 'SELECT b.rowid, b.ref, b.label, b.fk_product'; |
2828
|
|
- $sql .= ' FROM ' . MAIN_DB_PREFIX . 'bom_bom as b'; |
2829
|
|
- $sql .= ' WHERE b.entity IN (' . getEntity('bom') . ')'; |
|
2828
|
+ $sql .= ' FROM '.MAIN_DB_PREFIX.'bom_bom as b'; |
|
2829
|
+ $sql .= ' WHERE b.entity IN ('.getEntity('bom').')'; |
2830
|
2830
|
if (!empty($status)) { |
2831
|
|
- $sql .= ' AND status = ' . (int) $status; |
|
2831
|
+ $sql .= ' AND status = '.(int) $status; |
2832
|
2832
|
} |
2833
|
2833
|
if (!empty($type)) { |
2834
|
|
- $sql .= ' AND bomtype = ' . (int) $type; |
|
2834
|
+ $sql .= ' AND bomtype = '.(int) $type; |
2835
|
2835
|
} |
2836
|
2836
|
if (!empty($TProducts)) { |
2837
|
|
- $sql .= ' AND fk_product IN (' . $this->db->sanitize(implode(',', $TProducts)) . ')'; |
|
2837
|
+ $sql .= ' AND fk_product IN ('.$this->db->sanitize(implode(',', $TProducts)).')'; |
2838
|
2838
|
} |
2839
|
2839
|
if (!empty($limit)) { |
2840
|
|
- $sql .= ' LIMIT ' . (int) $limit; |
|
2840
|
+ $sql .= ' LIMIT '.(int) $limit; |
2841
|
2841
|
} |
2842
|
2842
|
$resql = $db->query($sql); |
2843
|
2843
|
if ($resql) { |
|
@@ -2851,11 +2851,11 @@ discard block |
|
|
block discarded – undo |
2851
|
2851
|
while ($obj = $db->fetch_object($resql)) { |
2852
|
2852
|
$product = new Product($db); |
2853
|
2853
|
$res = $product->fetch($obj->fk_product); |
2854
|
|
- $out .= '<option value="' . $obj->rowid . '"'; |
|
2854
|
+ $out .= '<option value="'.$obj->rowid.'"'; |
2855
|
2855
|
if ($obj->rowid == $selected) { |
2856
|
2856
|
$out .= 'selected'; |
2857
|
2857
|
} |
2858
|
|
- $out .= '>' . $obj->ref . ' - ' . $product->label . ' - ' . $obj->label . '</option>'; |
|
2858
|
+ $out .= '>'.$obj->ref.' - '.$product->label.' - '.$obj->label.'</option>'; |
2859
|
2859
|
} |
2860
|
2860
|
} else { |
2861
|
2861
|
$error++; |
|
@@ -2913,7 +2913,7 @@ discard block |
|
|
block discarded – undo |
2913
|
2913
|
|
2914
|
2914
|
$warehouseStatusArray = array(); |
2915
|
2915
|
if (!empty($warehouseStatus)) { |
2916
|
|
- require_once DOL_DOCUMENT_ROOT . '/product/stock/class/entrepot.class.php'; |
|
2916
|
+ require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php'; |
2917
|
2917
|
if (preg_match('/warehouseclosed/', $warehouseStatus)) { |
2918
|
2918
|
$warehouseStatusArray[] = Entrepot::STATUS_CLOSED; |
2919
|
2919
|
} |
|
@@ -2927,9 +2927,9 @@ discard block |
|
|
block discarded – undo |
2927
|
2927
|
|
2928
|
2928
|
$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"; |
2929
|
2929
|
if (count($warehouseStatusArray)) { |
2930
|
|
- $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 |
|
2930
|
+ $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 |
2931
|
2931
|
} else { |
2932
|
|
- $selectFieldsGrouped = ", " . $this->db->ifsql("p.stock IS NULL", 0, "p.stock") . " AS stock"; |
|
2932
|
+ $selectFieldsGrouped = ", ".$this->db->ifsql("p.stock IS NULL", 0, "p.stock")." AS stock"; |
2933
|
2933
|
} |
2934
|
2934
|
|
2935
|
2935
|
$sql = "SELECT "; |
|
@@ -2945,9 +2945,9 @@ discard block |
|
|
block discarded – undo |
2945
|
2945
|
|
2946
|
2946
|
if (getDolGlobalString('PRODUCT_SORT_BY_CATEGORY')) { |
2947
|
2947
|
//Product category |
2948
|
|
- $sql .= ", (SELECT " . $this->db->prefix() . "categorie_product.fk_categorie |
2949
|
|
- FROM " . $this->db->prefix() . "categorie_product |
2950
|
|
- WHERE " . $this->db->prefix() . "categorie_product.fk_product=p.rowid |
|
2948
|
+ $sql .= ", (SELECT ".$this->db->prefix()."categorie_product.fk_categorie |
|
2949
|
+ FROM " . $this->db->prefix()."categorie_product |
|
2950
|
+ WHERE " . $this->db->prefix()."categorie_product.fk_product=p.rowid |
2951
|
2951
|
LIMIT 1 |
2952
|
2952
|
) AS categorie_product_id "; |
2953
|
2953
|
} |
|
@@ -2973,15 +2973,15 @@ discard block |
|
|
block discarded – undo |
2973
|
2973
|
} |
2974
|
2974
|
// Price by quantity |
2975
|
2975
|
if (getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES')) { |
2976
|
|
- $sql .= ", (SELECT pp.rowid FROM " . $this->db->prefix() . "product_price as pp WHERE pp.fk_product = p.rowid"; |
|
2976
|
+ $sql .= ", (SELECT pp.rowid FROM ".$this->db->prefix()."product_price as pp WHERE pp.fk_product = p.rowid"; |
2977
|
2977
|
if ($price_level >= 1 && getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES')) { |
2978
|
|
- $sql .= " AND price_level = " . ((int) $price_level); |
|
2978
|
+ $sql .= " AND price_level = ".((int) $price_level); |
2979
|
2979
|
} |
2980
|
2980
|
$sql .= " ORDER BY date_price"; |
2981
|
2981
|
$sql .= " DESC LIMIT 1) as price_rowid"; |
2982
|
|
- $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 |
|
2982
|
+ $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 |
2983
|
2983
|
if ($price_level >= 1 && getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES')) { |
2984
|
|
- $sql .= " AND price_level = " . ((int) $price_level); |
|
2984
|
+ $sql .= " AND price_level = ".((int) $price_level); |
2985
|
2985
|
} |
2986
|
2986
|
$sql .= " ORDER BY date_price"; |
2987
|
2987
|
$sql .= " DESC LIMIT 1) as price_by_qty"; |
|
@@ -2991,7 +2991,7 @@ discard block |
|
|
block discarded – undo |
2991
|
2991
|
$sql .= " FROM ".$this->db->prefix()."product as p"; |
2992
|
2992
|
|
2993
|
2993
|
if (getDolGlobalString('MAIN_SEARCH_PRODUCT_FORCE_INDEX')) { |
2994
|
|
- $sql .= " USE INDEX (" . $this->db->sanitize(getDolGlobalString('MAIN_PRODUCT_FORCE_INDEX')) . ")"; |
|
2994
|
+ $sql .= " USE INDEX (".$this->db->sanitize(getDolGlobalString('MAIN_PRODUCT_FORCE_INDEX')).")"; |
2995
|
2995
|
} |
2996
|
2996
|
|
2997
|
2997
|
// Add from (left join) from hooks |
|
@@ -3000,53 +3000,53 @@ discard block |
|
|
block discarded – undo |
3000
|
3000
|
$sql .= $hookmanager->resPrint; |
3001
|
3001
|
|
3002
|
3002
|
if (count($warehouseStatusArray)) { |
3003
|
|
- $sql .= " LEFT JOIN " . $this->db->prefix() . "product_stock as ps on ps.fk_product = p.rowid"; |
3004
|
|
- $sql .= " LEFT JOIN " . $this->db->prefix() . "entrepot as e on ps.fk_entrepot = e.rowid AND e.entity IN (" . getEntity('stock') . ")"; |
3005
|
|
- $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. |
|
3003
|
+ $sql .= " LEFT JOIN ".$this->db->prefix()."product_stock as ps on ps.fk_product = p.rowid"; |
|
3004
|
+ $sql .= " LEFT JOIN ".$this->db->prefix()."entrepot as e on ps.fk_entrepot = e.rowid AND e.entity IN (".getEntity('stock').")"; |
|
3005
|
+ $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. |
3006
|
3006
|
} |
3007
|
3007
|
|
3008
|
3008
|
// include search in supplier ref |
3009
|
3009
|
if (getDolGlobalString('MAIN_SEARCH_PRODUCT_BY_FOURN_REF')) { |
3010
|
|
- $sql .= " LEFT JOIN " . $this->db->prefix() . "product_fournisseur_price as pfp ON p.rowid = pfp.fk_product"; |
|
3010
|
+ $sql .= " LEFT JOIN ".$this->db->prefix()."product_fournisseur_price as pfp ON p.rowid = pfp.fk_product"; |
3011
|
3011
|
} |
3012
|
3012
|
|
3013
|
3013
|
//Price by customer |
3014
|
3014
|
if ((getDolGlobalString('PRODUIT_CUSTOMER_PRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES')) && !empty($socid)) { |
3015
|
|
- $sql .= " LEFT JOIN " . $this->db->prefix() . "product_customer_price as pcp ON pcp.fk_soc=" . ((int) $socid) . " AND pcp.fk_product=p.rowid"; |
|
3015
|
+ $sql .= " LEFT JOIN ".$this->db->prefix()."product_customer_price as pcp ON pcp.fk_soc=".((int) $socid)." AND pcp.fk_product=p.rowid"; |
3016
|
3016
|
} |
3017
|
3017
|
// Units |
3018
|
3018
|
if (getDolGlobalInt('PRODUCT_USE_UNITS')) { |
3019
|
|
- $sql .= " LEFT JOIN " . $this->db->prefix() . "c_units u ON u.rowid = p.fk_unit"; |
|
3019
|
+ $sql .= " LEFT JOIN ".$this->db->prefix()."c_units u ON u.rowid = p.fk_unit"; |
3020
|
3020
|
} |
3021
|
3021
|
// Multilang : we add translation |
3022
|
3022
|
if (getDolGlobalInt('MAIN_MULTILANGS')) { |
3023
|
|
- $sql .= " LEFT JOIN " . $this->db->prefix() . "product_lang as pl ON pl.fk_product = p.rowid "; |
|
3023
|
+ $sql .= " LEFT JOIN ".$this->db->prefix()."product_lang as pl ON pl.fk_product = p.rowid "; |
3024
|
3024
|
if (getDolGlobalString('PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE') && !empty($socid)) { |
3025
|
|
- require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; |
|
3025
|
+ require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; |
3026
|
3026
|
$soc = new Societe($this->db); |
3027
|
3027
|
$result = $soc->fetch($socid); |
3028
|
3028
|
if ($result > 0 && !empty($soc->default_lang)) { |
3029
|
|
- $sql .= " AND pl.lang = '" . $this->db->escape($soc->default_lang) . "'"; |
|
3029
|
+ $sql .= " AND pl.lang = '".$this->db->escape($soc->default_lang)."'"; |
3030
|
3030
|
} else { |
3031
|
|
- $sql .= " AND pl.lang = '" . $this->db->escape($langs->getDefaultLang()) . "'"; |
|
3031
|
+ $sql .= " AND pl.lang = '".$this->db->escape($langs->getDefaultLang())."'"; |
3032
|
3032
|
} |
3033
|
3033
|
} else { |
3034
|
|
- $sql .= " AND pl.lang = '" . $this->db->escape($langs->getDefaultLang()) . "'"; |
|
3034
|
+ $sql .= " AND pl.lang = '".$this->db->escape($langs->getDefaultLang())."'"; |
3035
|
3035
|
} |
3036
|
3036
|
} |
3037
|
3037
|
|
3038
|
3038
|
if (getDolGlobalString('PRODUIT_ATTRIBUTES_HIDECHILD')) { |
3039
|
|
- $sql .= " LEFT JOIN " . $this->db->prefix() . "product_attribute_combination pac ON pac.fk_product_child = p.rowid"; |
|
3039
|
+ $sql .= " LEFT JOIN ".$this->db->prefix()."product_attribute_combination pac ON pac.fk_product_child = p.rowid"; |
3040
|
3040
|
} |
3041
|
3041
|
|
3042
|
|
- $sql .= ' WHERE p.entity IN (' . getEntity('product') . ')'; |
|
3042
|
+ $sql .= ' WHERE p.entity IN ('.getEntity('product').')'; |
3043
|
3043
|
|
3044
|
3044
|
if (getDolGlobalString('PRODUIT_ATTRIBUTES_HIDECHILD')) { |
3045
|
3045
|
$sql .= " AND pac.rowid IS NULL"; |
3046
|
3046
|
} |
3047
|
3047
|
|
3048
|
3048
|
if ($finished == 0) { |
3049
|
|
- $sql .= " AND p.finished = " . ((int) $finished); |
|
3049
|
+ $sql .= " AND p.finished = ".((int) $finished); |
3050
|
3050
|
} elseif ($finished == 1) { |
3051
|
3051
|
$sql .= " AND p.finished = ".((int) $finished); |
3052
|
3052
|
} |
|
@@ -3054,11 +3054,11 @@ discard block |
|
|
block discarded – undo |
3054
|
3054
|
$sql .= " AND p.tosell = ".((int) $status); |
3055
|
3055
|
} |
3056
|
3056
|
if ($status_purchase >= 0) { |
3057
|
|
- $sql .= " AND p.tobuy = " . ((int) $status_purchase); |
|
3057
|
+ $sql .= " AND p.tobuy = ".((int) $status_purchase); |
3058
|
3058
|
} |
3059
|
3059
|
// Filter by product type |
3060
|
3060
|
if (strval($filtertype) != '') { |
3061
|
|
- $sql .= " AND p.fk_product_type = " . ((int) $filtertype); |
|
3061
|
+ $sql .= " AND p.fk_product_type = ".((int) $filtertype); |
3062
|
3062
|
} elseif (!isModEnabled('product')) { // when product module is disabled, show services only |
3063
|
3063
|
$sql .= " AND p.fk_product_type = 1"; |
3064
|
3064
|
} elseif (!isModEnabled('service')) { // when service module is disabled, show products only |
|
@@ -3066,7 +3066,7 @@ discard block |
|
|
block discarded – undo |
3066
|
3066
|
} |
3067
|
3067
|
|
3068
|
3068
|
if ((int) $warehouseId > 0) { |
3069
|
|
- $sql .= " AND EXISTS (SELECT psw.fk_product FROM " . $this->db->prefix() . "product_stock as psw WHERE psw.reel>0 AND psw.fk_entrepot=".(int) $warehouseId." AND psw.fk_product = p.rowid)"; |
|
3069
|
+ $sql .= " AND EXISTS (SELECT psw.fk_product FROM ".$this->db->prefix()."product_stock as psw WHERE psw.reel>0 AND psw.fk_entrepot=".(int) $warehouseId." AND psw.fk_product = p.rowid)"; |
3070
|
3070
|
} |
3071
|
3071
|
|
3072
|
3072
|
// Add where from hooks |
|
@@ -3087,21 +3087,21 @@ discard block |
|
|
block discarded – undo |
3087
|
3087
|
if ($i > 0) { |
3088
|
3088
|
$sql .= " AND "; |
3089
|
3089
|
} |
3090
|
|
- $sql .= "(p.ref LIKE '" . $this->db->escape($prefix . $crit) . "%' OR p.label LIKE '" . $this->db->escape($prefix . $crit) . "%'"; |
|
3090
|
+ $sql .= "(p.ref LIKE '".$this->db->escape($prefix.$crit)."%' OR p.label LIKE '".$this->db->escape($prefix.$crit)."%'"; |
3091
|
3091
|
if (getDolGlobalInt('MAIN_MULTILANGS')) { |
3092
|
|
- $sql .= " OR pl.label LIKE '" . $this->db->escape($prefix . $crit) . "%'"; |
|
3092
|
+ $sql .= " OR pl.label LIKE '".$this->db->escape($prefix.$crit)."%'"; |
3093
|
3093
|
} |
3094
|
3094
|
if ((getDolGlobalString('PRODUIT_CUSTOMER_PRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES')) && !empty($socid)) { |
3095
|
|
- $sql .= " OR pcp.ref_customer LIKE '" . $this->db->escape($prefix . $crit) . "%'"; |
|
3095
|
+ $sql .= " OR pcp.ref_customer LIKE '".$this->db->escape($prefix.$crit)."%'"; |
3096
|
3096
|
} |
3097
|
3097
|
if (getDolGlobalString('PRODUCT_AJAX_SEARCH_ON_DESCRIPTION')) { |
3098
|
|
- $sql .= " OR p.description LIKE '" . $this->db->escape($prefix . $crit) . "%'"; |
|
3098
|
+ $sql .= " OR p.description LIKE '".$this->db->escape($prefix.$crit)."%'"; |
3099
|
3099
|
if (getDolGlobalInt('MAIN_MULTILANGS')) { |
3100
|
|
- $sql .= " OR pl.description LIKE '" . $this->db->escape($prefix . $crit) . "%'"; |
|
3100
|
+ $sql .= " OR pl.description LIKE '".$this->db->escape($prefix.$crit)."%'"; |
3101
|
3101
|
} |
3102
|
3102
|
} |
3103
|
3103
|
if (getDolGlobalString('MAIN_SEARCH_PRODUCT_BY_FOURN_REF')) { |
3104
|
|
- $sql .= " OR pfp.ref_fourn LIKE '" . $this->db->escape($prefix . $crit) . "%'"; |
|
3104
|
+ $sql .= " OR pfp.ref_fourn LIKE '".$this->db->escape($prefix.$crit)."%'"; |
3105
|
3105
|
} |
3106
|
3106
|
$sql .= ")"; |
3107
|
3107
|
$i++; |
|
@@ -3110,12 +3110,12 @@ discard block |
|
|
block discarded – undo |
3110
|
3110
|
$sql .= ")"; |
3111
|
3111
|
} |
3112
|
3112
|
if (isModEnabled('barcode')) { |
3113
|
|
- $sql .= " OR p.barcode LIKE '" . $this->db->escape($prefix . $filterkey) . "%'"; |
|
3113
|
+ $sql .= " OR p.barcode LIKE '".$this->db->escape($prefix.$filterkey)."%'"; |
3114
|
3114
|
} |
3115
|
3115
|
$sql .= ')'; |
3116
|
3116
|
} |
3117
|
3117
|
if (count($warehouseStatusArray)) { |
3118
|
|
- $sql .= " GROUP BY " . $selectFields; |
|
3118
|
+ $sql .= " GROUP BY ".$selectFields; |
3119
|
3119
|
} |
3120
|
3120
|
|
3121
|
3121
|
//Sort by category |
|
@@ -3130,23 +3130,23 @@ discard block |
|
|
block discarded – undo |
3130
|
3130
|
$sql .= $this->db->plimit($limit, 0); |
3131
|
3131
|
|
3132
|
3132
|
// Build output string |
3133
|
|
- dol_syslog(get_class($this) . "::select_produits_list search products", LOG_DEBUG); |
|
3133
|
+ dol_syslog(get_class($this)."::select_produits_list search products", LOG_DEBUG); |
3134
|
3134
|
$result = $this->db->query($sql); |
3135
|
3135
|
if ($result) { |
3136
|
|
- require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; |
3137
|
|
- require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php'; |
3138
|
|
- require_once DOL_DOCUMENT_ROOT . '/core/lib/product.lib.php'; |
|
3136
|
+ require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; |
|
3137
|
+ require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php'; |
|
3138
|
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php'; |
3139
|
3139
|
|
3140
|
3140
|
$num = $this->db->num_rows($result); |
3141
|
3141
|
|
3142
|
3142
|
$events = array(); |
3143
|
3143
|
|
3144
|
3144
|
if (!$forcecombo) { |
3145
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
3145
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
3146
|
3146
|
$out .= ajax_combobox($htmlname, $events, getDolGlobalInt("PRODUIT_USE_SEARCH_TO_SELECT")); |
3147
|
3147
|
} |
3148
|
3148
|
|
3149
|
|
- $out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">'; |
|
3149
|
+ $out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">'; |
3150
|
3150
|
|
3151
|
3151
|
$textifempty = ''; |
3152
|
3152
|
// Do not use textifempty = ' ' or ' ' here, or search on key will search on ' key'. |
|
@@ -3163,7 +3163,7 @@ discard block |
|
|
block discarded – undo |
3163
|
3163
|
} |
3164
|
3164
|
} |
3165
|
3165
|
if ($showempty) { |
3166
|
|
- $out .= '<option value="-1" selected>' . ($textifempty ? $textifempty : ' ') . '</option>'; |
|
3166
|
+ $out .= '<option value="-1" selected>'.($textifempty ? $textifempty : ' ').'</option>'; |
3167
|
3167
|
} |
3168
|
3168
|
|
3169
|
3169
|
$i = 0; |
|
@@ -3174,11 +3174,11 @@ discard block |
|
|
block discarded – undo |
3174
|
3174
|
|
3175
|
3175
|
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 |
3176
|
3176
|
$sql = "SELECT rowid, quantity, price, unitprice, remise_percent, remise, price_base_type"; |
3177
|
|
- $sql .= " FROM " . $this->db->prefix() . "product_price_by_qty"; |
3178
|
|
- $sql .= " WHERE fk_product_price = " . ((int) $objp->price_rowid); |
|
3177
|
+ $sql .= " FROM ".$this->db->prefix()."product_price_by_qty"; |
|
3178
|
+ $sql .= " WHERE fk_product_price = ".((int) $objp->price_rowid); |
3179
|
3179
|
$sql .= " ORDER BY quantity ASC"; |
3180
|
3180
|
|
3181
|
|
- dol_syslog(get_class($this) . "::select_produits_list search prices by qty", LOG_DEBUG); |
|
3181
|
+ dol_syslog(get_class($this)."::select_produits_list search prices by qty", LOG_DEBUG); |
3182
|
3182
|
$result2 = $this->db->query($sql); |
3183
|
3183
|
if ($result2) { |
3184
|
3184
|
$nb_prices = $this->db->num_rows($result2); |
|
@@ -3216,7 +3216,7 @@ discard block |
|
|
block discarded – undo |
3216
|
3216
|
$price_product = new Product($this->db); |
3217
|
3217
|
$price_product->fetch($objp->rowid, '', '', 1); |
3218
|
3218
|
|
3219
|
|
- require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php'; |
|
3219
|
+ require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php'; |
3220
|
3220
|
$priceparser = new PriceParser($this->db); |
3221
|
3221
|
$price_result = $priceparser->parseProduct($price_product); |
3222
|
3222
|
if ($price_result >= 0) { |
|
@@ -3302,7 +3302,7 @@ discard block |
|
|
block discarded – undo |
3302
|
3302
|
$label = $objp->label_translated; |
3303
|
3303
|
} |
3304
|
3304
|
if (!empty($filterkey) && $filterkey != '') { |
3305
|
|
- $label = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $label, 1); |
|
3305
|
+ $label = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $label, 1); |
3306
|
3306
|
} |
3307
|
3307
|
|
3308
|
3308
|
$outkey = $objp->rowid; |
|
@@ -3323,32 +3323,32 @@ discard block |
|
|
block discarded – undo |
3323
|
3323
|
$outdurationunit = $outtype == Product::TYPE_SERVICE ? substr($objp->duration, -1) : ''; |
3324
|
3324
|
|
3325
|
3325
|
if ($outorigin && getDolGlobalString('PRODUCT_SHOW_ORIGIN_IN_COMBO')) { |
3326
|
|
- require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php'; |
|
3326
|
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; |
3327
|
3327
|
} |
3328
|
3328
|
|
3329
|
3329
|
// Units |
3330
|
3330
|
$outvalUnits = ''; |
3331
|
3331
|
if (getDolGlobalInt('PRODUCT_USE_UNITS')) { |
3332
|
3332
|
if (!empty($objp->unit_short)) { |
3333
|
|
- $outvalUnits .= ' - ' . $objp->unit_short; |
|
3333
|
+ $outvalUnits .= ' - '.$objp->unit_short; |
3334
|
3334
|
} |
3335
|
3335
|
} |
3336
|
3336
|
if (getDolGlobalString('PRODUCT_SHOW_DIMENSIONS_IN_COMBO')) { |
3337
|
3337
|
if (!empty($objp->weight) && $objp->weight_units !== null) { |
3338
|
3338
|
$unitToShow = showDimensionInBestUnit($objp->weight, $objp->weight_units, 'weight', $langs); |
3339
|
|
- $outvalUnits .= ' - ' . $unitToShow; |
|
3339
|
+ $outvalUnits .= ' - '.$unitToShow; |
3340
|
3340
|
} |
3341
|
3341
|
if ((!empty($objp->length) || !empty($objp->width) || !empty($objp->height)) && $objp->length_units !== null) { |
3342
|
|
- $unitToShow = $objp->length . ' x ' . $objp->width . ' x ' . $objp->height . ' ' . measuringUnitString(0, 'size', $objp->length_units); |
3343
|
|
- $outvalUnits .= ' - ' . $unitToShow; |
|
3342
|
+ $unitToShow = $objp->length.' x '.$objp->width.' x '.$objp->height.' '.measuringUnitString(0, 'size', $objp->length_units); |
|
3343
|
+ $outvalUnits .= ' - '.$unitToShow; |
3344
|
3344
|
} |
3345
|
3345
|
if (!empty($objp->surface) && $objp->surface_units !== null) { |
3346
|
3346
|
$unitToShow = showDimensionInBestUnit($objp->surface, $objp->surface_units, 'surface', $langs); |
3347
|
|
- $outvalUnits .= ' - ' . $unitToShow; |
|
3347
|
+ $outvalUnits .= ' - '.$unitToShow; |
3348
|
3348
|
} |
3349
|
3349
|
if (!empty($objp->volume) && $objp->volume_units !== null) { |
3350
|
3350
|
$unitToShow = showDimensionInBestUnit($objp->volume, $objp->volume_units, 'volume', $langs); |
3351
|
|
- $outvalUnits .= ' - ' . $unitToShow; |
|
3351
|
+ $outvalUnits .= ' - '.$unitToShow; |
3352
|
3352
|
} |
3353
|
3353
|
} |
3354
|
3354
|
if ($outdurationvalue && $outdurationunit) { |
|
@@ -3360,7 +3360,7 @@ discard block |
|
|
block discarded – undo |
3360
|
3360
|
'y' => $langs->trans('Year') |
3361
|
3361
|
); |
3362
|
3362
|
if (isset($da[$outdurationunit])) { |
3363
|
|
- $outvalUnits .= ' - ' . $outdurationvalue . ' ' . $langs->transnoentities($da[$outdurationunit] . ($outdurationvalue > 1 ? 's' : '')); |
|
3363
|
+ $outvalUnits .= ' - '.$outdurationvalue.' '.$langs->transnoentities($da[$outdurationunit].($outdurationvalue > 1 ? 's' : '')); |
3364
|
3364
|
} |
3365
|
3365
|
} |
3366
|
3366
|
|
|
@@ -3380,31 +3380,31 @@ discard block |
|
|
block discarded – undo |
3380
|
3380
|
$labeltoshow = ''; |
3381
|
3381
|
$labeltoshow .= $objp->ref; |
3382
|
3382
|
if (!empty($objp->custref)) { |
3383
|
|
- $labeltoshow .= ' (' . $objp->custref . ')'; |
|
3383
|
+ $labeltoshow .= ' ('.$objp->custref.')'; |
3384
|
3384
|
} |
3385
|
3385
|
if ($outbarcode) { |
3386
|
|
- $labeltoshow .= ' (' . $outbarcode . ')'; |
|
3386
|
+ $labeltoshow .= ' ('.$outbarcode.')'; |
3387
|
3387
|
} |
3388
|
|
- $labeltoshow .= ' - ' . dol_trunc($label, $maxlengtharticle); |
|
3388
|
+ $labeltoshow .= ' - '.dol_trunc($label, $maxlengtharticle); |
3389
|
3389
|
if ($outorigin && getDolGlobalString('PRODUCT_SHOW_ORIGIN_IN_COMBO')) { |
3390
|
|
- $labeltoshow .= ' (' . getCountry($outorigin, '1') . ')'; |
|
3390
|
+ $labeltoshow .= ' ('.getCountry($outorigin, '1').')'; |
3391
|
3391
|
} |
3392
|
3392
|
|
3393
|
3393
|
// Set $labltoshowhtml |
3394
|
3394
|
$labeltoshowhtml = ''; |
3395
|
3395
|
$labeltoshowhtml .= $objp->ref; |
3396
|
3396
|
if (!empty($objp->custref)) { |
3397
|
|
- $labeltoshowhtml .= ' (' . $objp->custref . ')'; |
|
3397
|
+ $labeltoshowhtml .= ' ('.$objp->custref.')'; |
3398
|
3398
|
} |
3399
|
3399
|
if (!empty($filterkey) && $filterkey != '') { |
3400
|
|
- $labeltoshowhtml = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $labeltoshowhtml, 1); |
|
3400
|
+ $labeltoshowhtml = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $labeltoshowhtml, 1); |
3401
|
3401
|
} |
3402
|
3402
|
if ($outbarcode) { |
3403
|
|
- $labeltoshowhtml .= ' (' . $outbarcode . ')'; |
|
3403
|
+ $labeltoshowhtml .= ' ('.$outbarcode.')'; |
3404
|
3404
|
} |
3405
|
|
- $labeltoshowhtml .= ' - ' . dol_trunc($label, $maxlengtharticle); |
|
3405
|
+ $labeltoshowhtml .= ' - '.dol_trunc($label, $maxlengtharticle); |
3406
|
3406
|
if ($outorigin && getDolGlobalString('PRODUCT_SHOW_ORIGIN_IN_COMBO')) { |
3407
|
|
- $labeltoshowhtml .= ' (' . getCountry($outorigin, '1') . ')'; |
|
3407
|
+ $labeltoshowhtml .= ' ('.getCountry($outorigin, '1').')'; |
3408
|
3408
|
} |
3409
|
3409
|
|
3410
|
3410
|
// Stock |
|
@@ -3412,14 +3412,14 @@ discard block |
|
|
block discarded – undo |
3412
|
3412
|
$labeltoshowhtmlstock = ''; |
3413
|
3413
|
if (isModEnabled('stock') && isset($objp->stock) && ($objp->fk_product_type == Product::TYPE_PRODUCT || getDolGlobalString('STOCK_SUPPORTS_SERVICES'))) { |
3414
|
3414
|
if ($user->hasRight('stock', 'lire')) { |
3415
|
|
- $labeltoshowstock .= ' - ' . $langs->trans("Stock") . ': ' . price(price2num($objp->stock, 'MS'), 0, $langs, 0, 0); |
|
3415
|
+ $labeltoshowstock .= ' - '.$langs->trans("Stock").': '.price(price2num($objp->stock, 'MS'), 0, $langs, 0, 0); |
3416
|
3416
|
|
3417
|
3417
|
if ($objp->stock > 0) { |
3418
|
3418
|
$labeltoshowhtmlstock .= ' - <span class="product_line_stock_ok">'; |
3419
|
3419
|
} elseif ($objp->stock <= 0) { |
3420
|
3420
|
$labeltoshowhtmlstock .= ' - <span class="product_line_stock_too_low">'; |
3421
|
3421
|
} |
3422
|
|
- $labeltoshowhtmlstock .= $langs->transnoentities("Stock") . ': ' . price(price2num($objp->stock, 'MS'), 0, $langs, 0, 0); |
|
3422
|
+ $labeltoshowhtmlstock .= $langs->transnoentities("Stock").': '.price(price2num($objp->stock, 'MS'), 0, $langs, 0, 0); |
3423
|
3423
|
$labeltoshowhtmlstock .= '</span>'; |
3424
|
3424
|
|
3425
|
3425
|
if (empty($novirtualstock) && getDolGlobalString('STOCK_SHOW_VIRTUAL_STOCK_IN_PRODUCTS_COMBO')) { // Warning, this option may slow down combo list generation |
|
@@ -3430,9 +3430,9 @@ discard block |
|
|
block discarded – undo |
3430
|
3430
|
$tmpproduct->load_virtual_stock(); |
3431
|
3431
|
$virtualstock = $tmpproduct->stock_theorique; |
3432
|
3432
|
|
3433
|
|
- $labeltoshowstock .= ' - ' . $langs->trans("VirtualStock") . ':' . $virtualstock; |
|
3433
|
+ $labeltoshowstock .= ' - '.$langs->trans("VirtualStock").':'.$virtualstock; |
3434
|
3434
|
|
3435
|
|
- $labeltoshowhtmlstock .= ' - ' . $langs->transnoentities("VirtualStock") . ':'; |
|
3435
|
+ $labeltoshowhtmlstock .= ' - '.$langs->transnoentities("VirtualStock").':'; |
3436
|
3436
|
if ($virtualstock > 0) { |
3437
|
3437
|
$labeltoshowhtmlstock .= '<span class="product_line_stock_ok">'; |
3438
|
3438
|
} elseif ($virtualstock <= 0) { |
|
@@ -3453,35 +3453,35 @@ discard block |
|
|
block discarded – undo |
3453
|
3453
|
// If we need a particular price level (from 1 to n) |
3454
|
3454
|
if (empty($hidepriceinlabel) && $price_level >= 1 && (getDolGlobalString('PRODUIT_MULTIPRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES'))) { |
3455
|
3455
|
$sql = "SELECT price, price_ttc, price_base_type, tva_tx, default_vat_code"; |
3456
|
|
- $sql .= " FROM " . $this->db->prefix() . "product_price"; |
3457
|
|
- $sql .= " WHERE fk_product = " . ((int) $objp->rowid); |
3458
|
|
- $sql .= " AND entity IN (" . getEntity('productprice') . ")"; |
3459
|
|
- $sql .= " AND price_level = " . ((int) $price_level); |
|
3456
|
+ $sql .= " FROM ".$this->db->prefix()."product_price"; |
|
3457
|
+ $sql .= " WHERE fk_product = ".((int) $objp->rowid); |
|
3458
|
+ $sql .= " AND entity IN (".getEntity('productprice').")"; |
|
3459
|
+ $sql .= " AND price_level = ".((int) $price_level); |
3460
|
3460
|
$sql .= " ORDER BY date_price DESC, rowid DESC"; // Warning DESC must be both on date_price and rowid. |
3461
|
3461
|
$sql .= " LIMIT 1"; |
3462
|
3462
|
|
3463
|
|
- dol_syslog(get_class($this) . '::constructProductListOption search price for product ' . $objp->rowid . ' AND level ' . $price_level, LOG_DEBUG); |
|
3463
|
+ dol_syslog(get_class($this).'::constructProductListOption search price for product '.$objp->rowid.' AND level '.$price_level, LOG_DEBUG); |
3464
|
3464
|
$result2 = $this->db->query($sql); |
3465
|
3465
|
if ($result2) { |
3466
|
3466
|
$objp2 = $this->db->fetch_object($result2); |
3467
|
3467
|
if ($objp2) { |
3468
|
3468
|
$found = 1; |
3469
|
3469
|
if ($objp2->price_base_type == 'HT') { |
3470
|
|
- $labeltoshowprice .= ' - ' . price($objp2->price, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("HT"); |
3471
|
|
- $labeltoshowhtmlprice .= ' - ' . price($objp2->price, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("HT"); |
|
3470
|
+ $labeltoshowprice .= ' - '.price($objp2->price, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("HT"); |
|
3471
|
+ $labeltoshowhtmlprice .= ' - '.price($objp2->price, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("HT"); |
3472
|
3472
|
} else { |
3473
|
|
- $labeltoshowprice .= ' - ' . price($objp2->price_ttc, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("TTC"); |
3474
|
|
- $labeltoshowhtmlprice .= ' - ' . price($objp2->price_ttc, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("TTC"); |
|
3473
|
+ $labeltoshowprice .= ' - '.price($objp2->price_ttc, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("TTC"); |
|
3474
|
+ $labeltoshowhtmlprice .= ' - '.price($objp2->price_ttc, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("TTC"); |
3475
|
3475
|
} |
3476
|
3476
|
$outprice_ht = price($objp2->price); |
3477
|
3477
|
$outprice_ttc = price($objp2->price_ttc); |
3478
|
3478
|
$outpricebasetype = $objp2->price_base_type; |
3479
|
3479
|
if (getDolGlobalString('PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL')) { // using this option is a bug. kept for backward compatibility |
3480
|
|
- $outtva_tx = $objp2->tva_tx; // We use the vat rate on line of multiprice |
3481
|
|
- $outdefault_vat_code = $objp2->default_vat_code; // We use the vat code on line of multiprice |
|
3480
|
+ $outtva_tx = $objp2->tva_tx; // We use the vat rate on line of multiprice |
|
3481
|
+ $outdefault_vat_code = $objp2->default_vat_code; // We use the vat code on line of multiprice |
3482
|
3482
|
} else { |
3483
|
|
- $outtva_tx = $objp->tva_tx; // We use the vat rate of product, not the one on line of multiprice |
3484
|
|
- $outdefault_vat_code = $objp->default_vat_code; // We use the vat code or product, not the one on line of multiprice |
|
3483
|
+ $outtva_tx = $objp->tva_tx; // We use the vat rate of product, not the one on line of multiprice |
|
3484
|
+ $outdefault_vat_code = $objp->default_vat_code; // We use the vat code or product, not the one on line of multiprice |
3485
|
3485
|
} |
3486
|
3486
|
} |
3487
|
3487
|
} else { |
|
@@ -3495,13 +3495,13 @@ discard block |
|
|
block discarded – undo |
3495
|
3495
|
$outqty = $objp->quantity; |
3496
|
3496
|
$outdiscount = $objp->remise_percent; |
3497
|
3497
|
if ($objp->quantity == 1) { |
3498
|
|
- $labeltoshowprice .= ' - ' . price($objp->unitprice, 1, $langs, 0, 0, -1, $conf->currency) . "/"; |
3499
|
|
- $labeltoshowhtmlprice .= ' - ' . price($objp->unitprice, 0, $langs, 0, 0, -1, $conf->currency) . "/"; |
|
3498
|
+ $labeltoshowprice .= ' - '.price($objp->unitprice, 1, $langs, 0, 0, -1, $conf->currency)."/"; |
|
3499
|
+ $labeltoshowhtmlprice .= ' - '.price($objp->unitprice, 0, $langs, 0, 0, -1, $conf->currency)."/"; |
3500
|
3500
|
$labeltoshowprice .= $langs->trans("Unit"); // Do not use strtolower because it breaks utf8 encoding |
3501
|
3501
|
$labeltoshowhtmlprice .= $langs->transnoentities("Unit"); |
3502
|
3502
|
} else { |
3503
|
|
- $labeltoshowprice .= ' - ' . price($objp->price, 1, $langs, 0, 0, -1, $conf->currency) . "/" . $objp->quantity; |
3504
|
|
- $labeltoshowhtmlprice .= ' - ' . price($objp->price, 0, $langs, 0, 0, -1, $conf->currency) . "/" . $objp->quantity; |
|
3503
|
+ $labeltoshowprice .= ' - '.price($objp->price, 1, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity; |
|
3504
|
+ $labeltoshowhtmlprice .= ' - '.price($objp->price, 0, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity; |
3505
|
3505
|
$labeltoshowprice .= $langs->trans("Units"); // Do not use strtolower because it breaks utf8 encoding |
3506
|
3506
|
$labeltoshowhtmlprice .= $langs->transnoentities("Units"); |
3507
|
3507
|
} |
|
@@ -3509,16 +3509,16 @@ discard block |
|
|
block discarded – undo |
3509
|
3509
|
$outprice_ht = price($objp->unitprice); |
3510
|
3510
|
$outprice_ttc = price($objp->unitprice * (1 + ($objp->tva_tx / 100))); |
3511
|
3511
|
$outpricebasetype = $objp->price_base_type; |
3512
|
|
- $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 |
3513
|
|
- $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 |
|
3512
|
+ $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 |
|
3513
|
+ $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 |
3514
|
3514
|
} |
3515
|
3515
|
if (empty($hidepriceinlabel) && !empty($objp->quantity) && $objp->quantity >= 1) { |
3516
|
|
- $labeltoshowprice .= " (" . price($objp->unitprice, 1, $langs, 0, 0, -1, $conf->currency) . "/" . $langs->trans("Unit") . ")"; // Do not use strtolower because it breaks utf8 encoding |
3517
|
|
- $labeltoshowhtmlprice .= " (" . price($objp->unitprice, 0, $langs, 0, 0, -1, $conf->currency) . "/" . $langs->transnoentities("Unit") . ")"; // Do not use strtolower because it breaks utf8 encoding |
|
3516
|
+ $labeltoshowprice .= " (".price($objp->unitprice, 1, $langs, 0, 0, -1, $conf->currency)."/".$langs->trans("Unit").")"; // Do not use strtolower because it breaks utf8 encoding |
|
3517
|
+ $labeltoshowhtmlprice .= " (".price($objp->unitprice, 0, $langs, 0, 0, -1, $conf->currency)."/".$langs->transnoentities("Unit").")"; // Do not use strtolower because it breaks utf8 encoding |
3518
|
3518
|
} |
3519
|
3519
|
if (empty($hidepriceinlabel) && !empty($objp->remise_percent) && $objp->remise_percent >= 1) { |
3520
|
|
- $labeltoshowprice .= " - " . $langs->trans("Discount") . " : " . vatrate($objp->remise_percent) . ' %'; |
3521
|
|
- $labeltoshowhtmlprice .= " - " . $langs->transnoentities("Discount") . " : " . vatrate($objp->remise_percent) . ' %'; |
|
3520
|
+ $labeltoshowprice .= " - ".$langs->trans("Discount")." : ".vatrate($objp->remise_percent).' %'; |
|
3521
|
+ $labeltoshowhtmlprice .= " - ".$langs->transnoentities("Discount")." : ".vatrate($objp->remise_percent).' %'; |
3522
|
3522
|
} |
3523
|
3523
|
|
3524
|
3524
|
// Price by customer |
|
@@ -3527,11 +3527,11 @@ discard block |
|
|
block discarded – undo |
3527
|
3527
|
$found = 1; |
3528
|
3528
|
|
3529
|
3529
|
if ($objp->custprice_base_type == 'HT') { |
3530
|
|
- $labeltoshowprice .= ' - ' . price($objp->custprice, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("HT"); |
3531
|
|
- $labeltoshowhtmlprice .= ' - ' . price($objp->custprice, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("HT"); |
|
3530
|
+ $labeltoshowprice .= ' - '.price($objp->custprice, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("HT"); |
|
3531
|
+ $labeltoshowhtmlprice .= ' - '.price($objp->custprice, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("HT"); |
3532
|
3532
|
} else { |
3533
|
|
- $labeltoshowprice .= ' - ' . price($objp->custprice_ttc, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("TTC"); |
3534
|
|
- $labeltoshowhtmlprice .= ' - ' . price($objp->custprice_ttc, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("TTC"); |
|
3533
|
+ $labeltoshowprice .= ' - '.price($objp->custprice_ttc, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("TTC"); |
|
3534
|
+ $labeltoshowhtmlprice .= ' - '.price($objp->custprice_ttc, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("TTC"); |
3535
|
3535
|
} |
3536
|
3536
|
|
3537
|
3537
|
$outprice_ht = price($objp->custprice); |
|
@@ -3545,11 +3545,11 @@ discard block |
|
|
block discarded – undo |
3545
|
3545
|
// If level no defined or multiprice not found, we used the default price |
3546
|
3546
|
if (empty($hidepriceinlabel) && !$found) { |
3547
|
3547
|
if ($objp->price_base_type == 'HT') { |
3548
|
|
- $labeltoshowprice .= ' - ' . price($objp->price, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("HT"); |
3549
|
|
- $labeltoshowhtmlprice .= ' - ' . price($objp->price, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("HT"); |
|
3548
|
+ $labeltoshowprice .= ' - '.price($objp->price, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("HT"); |
|
3549
|
+ $labeltoshowhtmlprice .= ' - '.price($objp->price, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("HT"); |
3550
|
3550
|
} else { |
3551
|
|
- $labeltoshowprice .= ' - ' . price($objp->price_ttc, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("TTC"); |
3552
|
|
- $labeltoshowhtmlprice .= ' - ' . price($objp->price_ttc, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("TTC"); |
|
3551
|
+ $labeltoshowprice .= ' - '.price($objp->price_ttc, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("TTC"); |
|
3552
|
+ $labeltoshowhtmlprice .= ' - '.price($objp->price_ttc, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("TTC"); |
3553
|
3553
|
} |
3554
|
3554
|
$outprice_ht = price($objp->price); |
3555
|
3555
|
$outprice_ttc = price($objp->price_ttc); |
|
@@ -3559,14 +3559,14 @@ discard block |
|
|
block discarded – undo |
3559
|
3559
|
} |
3560
|
3560
|
|
3561
|
3561
|
// Build options |
3562
|
|
- $opt = '<option value="' . $objp->rowid . '"'; |
|
3562
|
+ $opt = '<option value="'.$objp->rowid.'"'; |
3563
|
3563
|
$opt .= ($objp->rowid == $selected) ? ' selected' : ''; |
3564
|
3564
|
if (!empty($objp->price_by_qty_rowid) && $objp->price_by_qty_rowid > 0) { |
3565
|
|
- $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 . '"'; |
|
3565
|
+ $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.'"'; |
3566
|
3566
|
} |
3567
|
3567
|
if (getDolGlobalString('PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE')) { |
3568
|
|
- $opt .= ' data-labeltrans="' . $outlabel_translated . '"'; |
3569
|
|
- $opt .= ' data-desctrans="' . dol_escape_htmltag($outdesc_translated) . '"'; |
|
3568
|
+ $opt .= ' data-labeltrans="'.$outlabel_translated.'"'; |
|
3569
|
+ $opt .= ' data-desctrans="'.dol_escape_htmltag($outdesc_translated).'"'; |
3570
|
3570
|
} |
3571
|
3571
|
|
3572
|
3572
|
if ($stocktag == 1) { |
|
@@ -3661,7 +3661,7 @@ discard block |
|
|
block discarded – undo |
3661
|
3661
|
$selected_input_value = ''; |
3662
|
3662
|
if (!empty($conf->use_javascript_ajax) && getDolGlobalString('PRODUIT_USE_SEARCH_TO_SELECT')) { |
3663
|
3663
|
if ($selected > 0) { |
3664
|
|
- require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; |
|
3664
|
+ require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; |
3665
|
3665
|
$producttmpselect = new Product($this->db); |
3666
|
3666
|
$producttmpselect->fetch($selected); |
3667
|
3667
|
$selected_input_value = $producttmpselect->ref; |
|
@@ -3669,10 +3669,10 @@ discard block |
|
|
block discarded – undo |
3669
|
3669
|
} |
3670
|
3670
|
|
3671
|
3671
|
// mode=2 means suppliers products |
3672
|
|
- $urloption = ($socid > 0 ? 'socid=' . $socid . '&' : '') . 'htmlname=' . $htmlname . '&outjson=1&price_level=' . $price_level . '&type=' . $filtertype . '&mode=2&status=' . $status . '&finished=' . $finished . '&alsoproductwithnosupplierprice=' . $alsoproductwithnosupplierprice; |
3673
|
|
- print ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/product/ajax/products.php', $urloption, getDolGlobalInt('PRODUIT_USE_SEARCH_TO_SELECT'), 0, $ajaxoptions); |
|
3672
|
+ $urloption = ($socid > 0 ? 'socid='.$socid.'&' : '').'htmlname='.$htmlname.'&outjson=1&price_level='.$price_level.'&type='.$filtertype.'&mode=2&status='.$status.'&finished='.$finished.'&alsoproductwithnosupplierprice='.$alsoproductwithnosupplierprice; |
|
3673
|
+ print ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/product/ajax/products.php', $urloption, getDolGlobalInt('PRODUIT_USE_SEARCH_TO_SELECT'), 0, $ajaxoptions); |
3674
|
3674
|
|
3675
|
|
- print($hidelabel ? '' : $langs->trans("RefOrLabel") . ' : ') . '<input type="text" class="'.$morecss.'" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . ($placeholder ? ' placeholder="' . $placeholder . '"' : '') . '>'; |
|
3675
|
+ print($hidelabel ? '' : $langs->trans("RefOrLabel").' : ').'<input type="text" class="'.$morecss.'" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.($placeholder ? ' placeholder="'.$placeholder.'"' : '').'>'; |
3676
|
3676
|
} else { |
3677
|
3677
|
print $this->select_produits_fournisseurs_list($socid, $selected, $htmlname, $filtertype, $filtre, '', $status, 0, 0, $alsoproductwithnosupplierprice, $morecss, 0, $placeholder); |
3678
|
3678
|
} |
|
@@ -3730,25 +3730,25 @@ discard block |
|
|
block discarded – undo |
3730
|
3730
|
if (getDolGlobalInt('PRODUCT_USE_UNITS')) { |
3731
|
3731
|
$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"; |
3732
|
3732
|
} |
3733
|
|
- $sql .= " FROM " . $this->db->prefix() . "product as p"; |
3734
|
|
- $sql .= " LEFT JOIN " . $this->db->prefix() . "product_fournisseur_price as pfp ON ( p.rowid = pfp.fk_product AND pfp.entity IN (" . getEntity('product') . ") )"; |
|
3733
|
+ $sql .= " FROM ".$this->db->prefix()."product as p"; |
|
3734
|
+ $sql .= " LEFT JOIN ".$this->db->prefix()."product_fournisseur_price as pfp ON ( p.rowid = pfp.fk_product AND pfp.entity IN (".getEntity('product').") )"; |
3735
|
3735
|
if ($socid > 0) { |
3736
|
|
- $sql .= " AND pfp.fk_soc = " . ((int) $socid); |
|
3736
|
+ $sql .= " AND pfp.fk_soc = ".((int) $socid); |
3737
|
3737
|
} |
3738
|
|
- $sql .= " LEFT JOIN " . $this->db->prefix() . "societe as s ON pfp.fk_soc = s.rowid"; |
|
3738
|
+ $sql .= " LEFT JOIN ".$this->db->prefix()."societe as s ON pfp.fk_soc = s.rowid"; |
3739
|
3739
|
// Units |
3740
|
3740
|
if (getDolGlobalInt('PRODUCT_USE_UNITS')) { |
3741
|
|
- $sql .= " LEFT JOIN " . $this->db->prefix() . "c_units u ON u.rowid = p.fk_unit"; |
|
3741
|
+ $sql .= " LEFT JOIN ".$this->db->prefix()."c_units u ON u.rowid = p.fk_unit"; |
3742
|
3742
|
} |
3743
|
|
- $sql .= " WHERE p.entity IN (" . getEntity('product') . ")"; |
|
3743
|
+ $sql .= " WHERE p.entity IN (".getEntity('product').")"; |
3744
|
3744
|
if ($statut != -1) { |
3745
|
|
- $sql .= " AND p.tobuy = " . ((int) $statut); |
|
3745
|
+ $sql .= " AND p.tobuy = ".((int) $statut); |
3746
|
3746
|
} |
3747
|
3747
|
if (strval($filtertype) != '') { |
3748
|
|
- $sql .= " AND p.fk_product_type = " . ((int) $filtertype); |
|
3748
|
+ $sql .= " AND p.fk_product_type = ".((int) $filtertype); |
3749
|
3749
|
} |
3750
|
3750
|
if (!empty($filtre)) { |
3751
|
|
- $sql .= " " . $filtre; |
|
3751
|
+ $sql .= " ".$filtre; |
3752
|
3752
|
} |
3753
|
3753
|
// Add where from hooks |
3754
|
3754
|
$parameters = array(); |
|
@@ -3768,9 +3768,9 @@ discard block |
|
|
block discarded – undo |
3768
|
3768
|
if ($i > 0) { |
3769
|
3769
|
$sql .= " AND "; |
3770
|
3770
|
} |
3771
|
|
- $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) . "%'"; |
|
3771
|
+ $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)."%'"; |
3772
|
3772
|
if (getDolGlobalString('PRODUIT_FOURN_TEXTS')) { |
3773
|
|
- $sql .= " OR pfp.desc_fourn LIKE '" . $this->db->escape($prefix . $crit) . "%'"; |
|
3773
|
+ $sql .= " OR pfp.desc_fourn LIKE '".$this->db->escape($prefix.$crit)."%'"; |
3774
|
3774
|
} |
3775
|
3775
|
$sql .= ")"; |
3776
|
3776
|
$i++; |
|
@@ -3779,8 +3779,8 @@ discard block |
|
|
block discarded – undo |
3779
|
3779
|
$sql .= ")"; |
3780
|
3780
|
} |
3781
|
3781
|
if (isModEnabled('barcode')) { |
3782
|
|
- $sql .= " OR p.barcode LIKE '" . $this->db->escape($prefix . $filterkey) . "%'"; |
3783
|
|
- $sql .= " OR pfp.barcode LIKE '" . $this->db->escape($prefix . $filterkey) . "%'"; |
|
3782
|
+ $sql .= " OR p.barcode LIKE '".$this->db->escape($prefix.$filterkey)."%'"; |
|
3783
|
+ $sql .= " OR pfp.barcode LIKE '".$this->db->escape($prefix.$filterkey)."%'"; |
3784
|
3784
|
} |
3785
|
3785
|
$sql .= ')'; |
3786
|
3786
|
} |
|
@@ -3789,20 +3789,20 @@ discard block |
|
|
block discarded – undo |
3789
|
3789
|
|
3790
|
3790
|
// Build output string |
3791
|
3791
|
|
3792
|
|
- dol_syslog(get_class($this) . "::select_produits_fournisseurs_list", LOG_DEBUG); |
|
3792
|
+ dol_syslog(get_class($this)."::select_produits_fournisseurs_list", LOG_DEBUG); |
3793
|
3793
|
$result = $this->db->query($sql); |
3794
|
3794
|
if ($result) { |
3795
|
|
- require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php'; |
3796
|
|
- require_once DOL_DOCUMENT_ROOT . '/core/lib/product.lib.php'; |
|
3795
|
+ require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php'; |
|
3796
|
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php'; |
3797
|
3797
|
|
3798
|
3798
|
$num = $this->db->num_rows($result); |
3799
|
3799
|
|
3800
|
3800
|
//$out.='<select class="flat" id="select'.$htmlname.'" name="'.$htmlname.'">'; // remove select to have id same with combo and ajax |
3801
|
|
- $out .= '<select class="flat ' . ($morecss ? ' ' . $morecss : '') . '" id="' . $htmlname . '" name="' . $htmlname . '">'; |
|
3801
|
+ $out .= '<select class="flat '.($morecss ? ' '.$morecss : '').'" id="'.$htmlname.'" name="'.$htmlname.'">'; |
3802
|
3802
|
if (!$selected) { |
3803
|
|
- $out .= '<option value="-1" selected>' . ($placeholder ? $placeholder : ' ') . '</option>'; |
|
3803
|
+ $out .= '<option value="-1" selected>'.($placeholder ? $placeholder : ' ').'</option>'; |
3804
|
3804
|
} else { |
3805
|
|
- $out .= '<option value="-1">' . ($placeholder ? $placeholder : ' ') . '</option>'; |
|
3805
|
+ $out .= '<option value="-1">'.($placeholder ? $placeholder : ' ').'</option>'; |
3806
|
3806
|
} |
3807
|
3807
|
|
3808
|
3808
|
$i = 0; |
|
@@ -3817,7 +3817,7 @@ discard block |
|
|
block discarded – undo |
3817
|
3817
|
|
3818
|
3818
|
$outkey = $objp->idprodfournprice; // id in table of price |
3819
|
3819
|
if (!$outkey && $alsoproductwithnosupplierprice) { |
3820
|
|
- $outkey = 'idprod_' . $objp->rowid; // id of product |
|
3820
|
+ $outkey = 'idprod_'.$objp->rowid; // id of product |
3821
|
3821
|
} |
3822
|
3822
|
|
3823
|
3823
|
$outref = $objp->ref; |
|
@@ -3832,23 +3832,23 @@ discard block |
|
|
block discarded – undo |
3832
|
3832
|
$outvalUnits = ''; |
3833
|
3833
|
if (getDolGlobalInt('PRODUCT_USE_UNITS')) { |
3834
|
3834
|
if (!empty($objp->unit_short)) { |
3835
|
|
- $outvalUnits .= ' - ' . $objp->unit_short; |
|
3835
|
+ $outvalUnits .= ' - '.$objp->unit_short; |
3836
|
3836
|
} |
3837
|
3837
|
if (!empty($objp->weight) && $objp->weight_units !== null) { |
3838
|
3838
|
$unitToShow = showDimensionInBestUnit($objp->weight, $objp->weight_units, 'weight', $langs); |
3839
|
|
- $outvalUnits .= ' - ' . $unitToShow; |
|
3839
|
+ $outvalUnits .= ' - '.$unitToShow; |
3840
|
3840
|
} |
3841
|
3841
|
if ((!empty($objp->length) || !empty($objp->width) || !empty($objp->height)) && $objp->length_units !== null) { |
3842
|
|
- $unitToShow = $objp->length . ' x ' . $objp->width . ' x ' . $objp->height . ' ' . measuringUnitString(0, 'size', $objp->length_units); |
3843
|
|
- $outvalUnits .= ' - ' . $unitToShow; |
|
3842
|
+ $unitToShow = $objp->length.' x '.$objp->width.' x '.$objp->height.' '.measuringUnitString(0, 'size', $objp->length_units); |
|
3843
|
+ $outvalUnits .= ' - '.$unitToShow; |
3844
|
3844
|
} |
3845
|
3845
|
if (!empty($objp->surface) && $objp->surface_units !== null) { |
3846
|
3846
|
$unitToShow = showDimensionInBestUnit($objp->surface, $objp->surface_units, 'surface', $langs); |
3847
|
|
- $outvalUnits .= ' - ' . $unitToShow; |
|
3847
|
+ $outvalUnits .= ' - '.$unitToShow; |
3848
|
3848
|
} |
3849
|
3849
|
if (!empty($objp->volume) && $objp->volume_units !== null) { |
3850
|
3850
|
$unitToShow = showDimensionInBestUnit($objp->volume, $objp->volume_units, 'volume', $langs); |
3851
|
|
- $outvalUnits .= ' - ' . $unitToShow; |
|
3851
|
+ $outvalUnits .= ' - '.$unitToShow; |
3852
|
3852
|
} |
3853
|
3853
|
if ($outdurationvalue && $outdurationunit) { |
3854
|
3854
|
$da = array( |
|
@@ -3859,22 +3859,22 @@ discard block |
|
|
block discarded – undo |
3859
|
3859
|
'y' => $langs->trans('Year') |
3860
|
3860
|
); |
3861
|
3861
|
if (isset($da[$outdurationunit])) { |
3862
|
|
- $outvalUnits .= ' - ' . $outdurationvalue . ' ' . $langs->transnoentities($da[$outdurationunit] . ($outdurationvalue > 1 ? 's' : '')); |
|
3862
|
+ $outvalUnits .= ' - '.$outdurationvalue.' '.$langs->transnoentities($da[$outdurationunit].($outdurationvalue > 1 ? 's' : '')); |
3863
|
3863
|
} |
3864
|
3864
|
} |
3865
|
3865
|
} |
3866
|
3866
|
|
3867
|
3867
|
$objRef = $objp->ref; |
3868
|
3868
|
if ($filterkey && $filterkey != '') { |
3869
|
|
- $objRef = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $objRef, 1); |
|
3869
|
+ $objRef = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $objRef, 1); |
3870
|
3870
|
} |
3871
|
3871
|
$objRefFourn = $objp->ref_fourn; |
3872
|
3872
|
if ($filterkey && $filterkey != '') { |
3873
|
|
- $objRefFourn = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $objRefFourn, 1); |
|
3873
|
+ $objRefFourn = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $objRefFourn, 1); |
3874
|
3874
|
} |
3875
|
3875
|
$label = $objp->label; |
3876
|
3876
|
if ($filterkey && $filterkey != '') { |
3877
|
|
- $label = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $label, 1); |
|
3877
|
+ $label = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $label, 1); |
3878
|
3878
|
} |
3879
|
3879
|
|
3880
|
3880
|
switch ($objp->fk_product_type) { |
|
@@ -3897,21 +3897,21 @@ discard block |
|
|
block discarded – undo |
3897
|
3897
|
|
3898
|
3898
|
$optlabel .= $objp->ref; |
3899
|
3899
|
if (!empty($objp->idprodfournprice) && ($objp->ref != $objp->ref_fourn)) { |
3900
|
|
- $optlabel .= ' <span class="opacitymedium">(' . $objp->ref_fourn . ')</span>'; |
|
3900
|
+ $optlabel .= ' <span class="opacitymedium">('.$objp->ref_fourn.')</span>'; |
3901
|
3901
|
} |
3902
|
3902
|
if (isModEnabled('barcode') && !empty($objp->barcode)) { |
3903
|
|
- $optlabel .= ' (' . $outbarcode . ')'; |
|
3903
|
+ $optlabel .= ' ('.$outbarcode.')'; |
3904
|
3904
|
} |
3905
|
|
- $optlabel .= ' - ' . dol_trunc($label, $maxlengtharticle); |
|
3905
|
+ $optlabel .= ' - '.dol_trunc($label, $maxlengtharticle); |
3906
|
3906
|
|
3907
|
3907
|
$outvallabel = $objRef; |
3908
|
3908
|
if (!empty($objp->idprodfournprice) && ($objp->ref != $objp->ref_fourn)) { |
3909
|
|
- $outvallabel .= ' (' . $objRefFourn . ')'; |
|
3909
|
+ $outvallabel .= ' ('.$objRefFourn.')'; |
3910
|
3910
|
} |
3911
|
3911
|
if (isModEnabled('barcode') && !empty($objp->barcode)) { |
3912
|
|
- $outvallabel .= ' (' . $outbarcode . ')'; |
|
3912
|
+ $outvallabel .= ' ('.$outbarcode.')'; |
3913
|
3913
|
} |
3914
|
|
- $outvallabel .= ' - ' . dol_trunc($label, $maxlengtharticle); |
|
3914
|
+ $outvallabel .= ' - '.dol_trunc($label, $maxlengtharticle); |
3915
|
3915
|
|
3916
|
3916
|
// Units |
3917
|
3917
|
$optlabel .= $outvalUnits; |
|
@@ -3928,7 +3928,7 @@ discard block |
|
|
block discarded – undo |
3928
|
3928
|
$prod_supplier->fourn_tva_tx = $objp->tva_tx; |
3929
|
3929
|
$prod_supplier->fk_supplier_price_expression = $objp->fk_supplier_price_expression; |
3930
|
3930
|
|
3931
|
|
- require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php'; |
|
3931
|
+ require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php'; |
3932
|
3932
|
$priceparser = new PriceParser($this->db); |
3933
|
3933
|
$price_result = $priceparser->parseProductSupplier($prod_supplier); |
3934
|
3934
|
if ($price_result >= 0) { |
|
@@ -3939,57 +3939,57 @@ discard block |
|
|
block discarded – undo |
3939
|
3939
|
} |
3940
|
3940
|
} |
3941
|
3941
|
if ($objp->quantity == 1) { |
3942
|
|
- $optlabel .= ' - ' . price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency) . "/"; |
3943
|
|
- $outvallabel .= ' - ' . price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 0, $langs, 0, 0, -1, $conf->currency) . "/"; |
|
3942
|
+ $optlabel .= ' - '.price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency)."/"; |
|
3943
|
+ $outvallabel .= ' - '.price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 0, $langs, 0, 0, -1, $conf->currency)."/"; |
3944
|
3944
|
$optlabel .= $langs->trans("Unit"); // Do not use strtolower because it breaks utf8 encoding |
3945
|
3945
|
$outvallabel .= $langs->transnoentities("Unit"); |
3946
|
3946
|
} else { |
3947
|
|
- $optlabel .= ' - ' . price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency) . "/" . $objp->quantity; |
3948
|
|
- $outvallabel .= ' - ' . price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 0, $langs, 0, 0, -1, $conf->currency) . "/" . $objp->quantity; |
3949
|
|
- $optlabel .= ' ' . $langs->trans("Units"); // Do not use strtolower because it breaks utf8 encoding |
3950
|
|
- $outvallabel .= ' ' . $langs->transnoentities("Units"); |
|
3947
|
+ $optlabel .= ' - '.price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity; |
|
3948
|
+ $outvallabel .= ' - '.price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 0, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity; |
|
3949
|
+ $optlabel .= ' '.$langs->trans("Units"); // Do not use strtolower because it breaks utf8 encoding |
|
3950
|
+ $outvallabel .= ' '.$langs->transnoentities("Units"); |
3951
|
3951
|
} |
3952
|
3952
|
|
3953
|
3953
|
if ($objp->quantity > 1) { |
3954
|
|
- $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 |
3955
|
|
- $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 |
|
3954
|
+ $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 |
|
3955
|
+ $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 |
3956
|
3956
|
} |
3957
|
3957
|
if ($objp->remise_percent >= 1) { |
3958
|
|
- $optlabel .= " - " . $langs->trans("Discount") . " : " . vatrate($objp->remise_percent) . ' %'; |
3959
|
|
- $outvallabel .= " - " . $langs->transnoentities("Discount") . " : " . vatrate($objp->remise_percent) . ' %'; |
|
3958
|
+ $optlabel .= " - ".$langs->trans("Discount")." : ".vatrate($objp->remise_percent).' %'; |
|
3959
|
+ $outvallabel .= " - ".$langs->transnoentities("Discount")." : ".vatrate($objp->remise_percent).' %'; |
3960
|
3960
|
} |
3961
|
3961
|
if ($objp->duration) { |
3962
|
|
- $optlabel .= " - " . $objp->duration; |
3963
|
|
- $outvallabel .= " - " . $objp->duration; |
|
3962
|
+ $optlabel .= " - ".$objp->duration; |
|
3963
|
+ $outvallabel .= " - ".$objp->duration; |
3964
|
3964
|
} |
3965
|
3965
|
if (!$socid) { |
3966
|
|
- $optlabel .= " - " . dol_trunc($objp->name, 8); |
3967
|
|
- $outvallabel .= " - " . dol_trunc($objp->name, 8); |
|
3966
|
+ $optlabel .= " - ".dol_trunc($objp->name, 8); |
|
3967
|
+ $outvallabel .= " - ".dol_trunc($objp->name, 8); |
3968
|
3968
|
} |
3969
|
3969
|
if ($objp->supplier_reputation) { |
3970
|
3970
|
//TODO dictionary |
3971
|
3971
|
$reputations = array('' => $langs->trans('Standard'), 'FAVORITE' => $langs->trans('Favorite'), 'NOTTHGOOD' => $langs->trans('NotTheGoodQualitySupplier'), 'DONOTORDER' => $langs->trans('DoNotOrderThisProductToThisSupplier')); |
3972
|
3972
|
|
3973
|
|
- $optlabel .= " - " . $reputations[$objp->supplier_reputation]; |
3974
|
|
- $outvallabel .= " - " . $reputations[$objp->supplier_reputation]; |
|
3973
|
+ $optlabel .= " - ".$reputations[$objp->supplier_reputation]; |
|
3974
|
+ $outvallabel .= " - ".$reputations[$objp->supplier_reputation]; |
3975
|
3975
|
} |
3976
|
3976
|
} else { |
3977
|
|
- $optlabel .= " - <span class='opacitymedium'>" . $langs->trans("NoPriceDefinedForThisSupplier") . '</span>'; |
3978
|
|
- $outvallabel .= ' - ' . $langs->transnoentities("NoPriceDefinedForThisSupplier"); |
|
3977
|
+ $optlabel .= " - <span class='opacitymedium'>".$langs->trans("NoPriceDefinedForThisSupplier").'</span>'; |
|
3978
|
+ $outvallabel .= ' - '.$langs->transnoentities("NoPriceDefinedForThisSupplier"); |
3979
|
3979
|
} |
3980
|
3980
|
|
3981
|
3981
|
if (isModEnabled('stock') && $showstockinlist && isset($objp->stock) && ($objp->fk_product_type == Product::TYPE_PRODUCT || getDolGlobalString('STOCK_SUPPORTS_SERVICES'))) { |
3982
|
3982
|
$novirtualstock = ($showstockinlist == 2); |
3983
|
3983
|
|
3984
|
3984
|
if ($user->hasRight('stock', 'lire')) { |
3985
|
|
- $outvallabel .= ' - ' . $langs->trans("Stock") . ': ' . price(price2num($objp->stock, 'MS'), 0, $langs, 0, 0); |
|
3985
|
+ $outvallabel .= ' - '.$langs->trans("Stock").': '.price(price2num($objp->stock, 'MS'), 0, $langs, 0, 0); |
3986
|
3986
|
|
3987
|
3987
|
if ($objp->stock > 0) { |
3988
|
3988
|
$optlabel .= ' - <span class="product_line_stock_ok">'; |
3989
|
3989
|
} elseif ($objp->stock <= 0) { |
3990
|
3990
|
$optlabel .= ' - <span class="product_line_stock_too_low">'; |
3991
|
3991
|
} |
3992
|
|
- $optlabel .= $langs->transnoentities("Stock") . ':' . price(price2num($objp->stock, 'MS')); |
|
3992
|
+ $optlabel .= $langs->transnoentities("Stock").':'.price(price2num($objp->stock, 'MS')); |
3993
|
3993
|
$optlabel .= '</span>'; |
3994
|
3994
|
if (empty($novirtualstock) && getDolGlobalString('STOCK_SHOW_VIRTUAL_STOCK_IN_PRODUCTS_COMBO')) { // Warning, this option may slow down combo list generation |
3995
|
3995
|
$langs->load("stocks"); |
|
@@ -3999,9 +3999,9 @@ discard block |
|
|
block discarded – undo |
3999
|
3999
|
$tmpproduct->load_virtual_stock(); |
4000
|
4000
|
$virtualstock = $tmpproduct->stock_theorique; |
4001
|
4001
|
|
4002
|
|
- $outvallabel .= ' - ' . $langs->trans("VirtualStock") . ':' . $virtualstock; |
|
4002
|
+ $outvallabel .= ' - '.$langs->trans("VirtualStock").':'.$virtualstock; |
4003
|
4003
|
|
4004
|
|
- $optlabel .= ' - ' . $langs->transnoentities("VirtualStock") . ':'; |
|
4004
|
+ $optlabel .= ' - '.$langs->transnoentities("VirtualStock").':'; |
4005
|
4005
|
if ($virtualstock > 0) { |
4006
|
4006
|
$optlabel .= '<span class="product_line_stock_ok">'; |
4007
|
4007
|
} elseif ($virtualstock <= 0) { |
|
@@ -4015,7 +4015,7 @@ discard block |
|
|
block discarded – undo |
4015
|
4015
|
} |
4016
|
4016
|
} |
4017
|
4017
|
|
4018
|
|
- $optstart = '<option value="' . $outkey . '"'; |
|
4018
|
+ $optstart = '<option value="'.$outkey.'"'; |
4019
|
4019
|
if ($selected && $selected == $objp->idprodfournprice) { |
4020
|
4020
|
$optstart .= ' selected'; |
4021
|
4021
|
} |
|
@@ -4024,31 +4024,31 @@ discard block |
|
|
block discarded – undo |
4024
|
4024
|
} |
4025
|
4025
|
|
4026
|
4026
|
if (!empty($objp->idprodfournprice) && $objp->idprodfournprice > 0) { |
4027
|
|
- $optstart .= ' data-product-id="' . dol_escape_htmltag($objp->rowid) . '"'; |
4028
|
|
- $optstart .= ' data-price-id="' . dol_escape_htmltag($objp->idprodfournprice) . '"'; |
4029
|
|
- $optstart .= ' data-qty="' . dol_escape_htmltag($objp->quantity) . '"'; |
4030
|
|
- $optstart .= ' data-up="' . dol_escape_htmltag(price2num($objp->unitprice)) . '"'; |
4031
|
|
- $optstart .= ' data-up-locale="' . dol_escape_htmltag(price($objp->unitprice)) . '"'; |
4032
|
|
- $optstart .= ' data-discount="' . dol_escape_htmltag($outdiscount) . '"'; |
4033
|
|
- $optstart .= ' data-tvatx="' . dol_escape_htmltag(price2num($objp->tva_tx)) . '"'; |
4034
|
|
- $optstart .= ' data-tvatx-formated="' . dol_escape_htmltag(price($objp->tva_tx, 0, $langs, 1, -1, 2)) . '"'; |
4035
|
|
- $optstart .= ' data-default-vat-code="' . dol_escape_htmltag($objp->default_vat_code) . '"'; |
4036
|
|
- $optstart .= ' data-supplier-ref="' . dol_escape_htmltag($objp->ref_fourn) . '"'; |
|
4027
|
+ $optstart .= ' data-product-id="'.dol_escape_htmltag($objp->rowid).'"'; |
|
4028
|
+ $optstart .= ' data-price-id="'.dol_escape_htmltag($objp->idprodfournprice).'"'; |
|
4029
|
+ $optstart .= ' data-qty="'.dol_escape_htmltag($objp->quantity).'"'; |
|
4030
|
+ $optstart .= ' data-up="'.dol_escape_htmltag(price2num($objp->unitprice)).'"'; |
|
4031
|
+ $optstart .= ' data-up-locale="'.dol_escape_htmltag(price($objp->unitprice)).'"'; |
|
4032
|
+ $optstart .= ' data-discount="'.dol_escape_htmltag($outdiscount).'"'; |
|
4033
|
+ $optstart .= ' data-tvatx="'.dol_escape_htmltag(price2num($objp->tva_tx)).'"'; |
|
4034
|
+ $optstart .= ' data-tvatx-formated="'.dol_escape_htmltag(price($objp->tva_tx, 0, $langs, 1, -1, 2)).'"'; |
|
4035
|
+ $optstart .= ' data-default-vat-code="'.dol_escape_htmltag($objp->default_vat_code).'"'; |
|
4036
|
+ $optstart .= ' data-supplier-ref="'.dol_escape_htmltag($objp->ref_fourn).'"'; |
4037
|
4037
|
if (isModEnabled('multicurrency')) { |
4038
|
|
- $optstart .= ' data-multicurrency-code="' . dol_escape_htmltag($objp->multicurrency_code) . '"'; |
4039
|
|
- $optstart .= ' data-multicurrency-up="' . dol_escape_htmltag($objp->multicurrency_unitprice) . '"'; |
|
4038
|
+ $optstart .= ' data-multicurrency-code="'.dol_escape_htmltag($objp->multicurrency_code).'"'; |
|
4039
|
+ $optstart .= ' data-multicurrency-up="'.dol_escape_htmltag($objp->multicurrency_unitprice).'"'; |
4040
|
4040
|
} |
4041
|
4041
|
} |
4042
|
|
- $optstart .= ' data-description="' . dol_escape_htmltag($objp->description, 0, 1) . '"'; |
|
4042
|
+ $optstart .= ' data-description="'.dol_escape_htmltag($objp->description, 0, 1).'"'; |
4043
|
4043
|
|
4044
|
4044
|
$outarrayentry = array( |
4045
|
4045
|
'key' => $outkey, |
4046
|
4046
|
'value' => $outref, |
4047
|
4047
|
'label' => $outvallabel, |
4048
|
4048
|
'qty' => $outqty, |
4049
|
|
- 'price_qty_ht' => price2num($objp->fprice, 'MU'), // Keep higher resolution for price for the min qty |
4050
|
|
- 'price_unit_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price |
4051
|
|
- 'price_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price (for compatibility) |
|
4049
|
+ 'price_qty_ht' => price2num($objp->fprice, 'MU'), // Keep higher resolution for price for the min qty |
|
4050
|
+ 'price_unit_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price |
|
4051
|
+ 'price_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price (for compatibility) |
4052
|
4052
|
'tva_tx_formated' => price($objp->tva_tx, 0, $langs, 1, -1, 2), |
4053
|
4053
|
'tva_tx' => price2num($objp->tva_tx), |
4054
|
4054
|
'default_vat_code' => $objp->default_vat_code, |
|
@@ -4079,17 +4079,17 @@ discard block |
|
|
block discarded – undo |
4079
|
4079
|
// Add new entry |
4080
|
4080
|
// "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 |
4081
|
4081
|
// "label" value of json key array is used by jQuery automatically as text for combo box |
4082
|
|
- $out .= $optstart . ' data-html="' . dol_escape_htmltag($optlabel) . '">' . $optlabel . "</option>\n"; |
|
4082
|
+ $out .= $optstart.' data-html="'.dol_escape_htmltag($optlabel).'">'.$optlabel."</option>\n"; |
4083
|
4083
|
$outarraypush = array( |
4084
|
4084
|
'key' => $outkey, |
4085
|
4085
|
'value' => $outref, |
4086
|
4086
|
'label' => $outvallabel, |
4087
|
4087
|
'qty' => $outqty, |
4088
|
|
- 'price_qty_ht' => price2num($objp->fprice, 'MU'), // Keep higher resolution for price for the min qty |
|
4088
|
+ 'price_qty_ht' => price2num($objp->fprice, 'MU'), // Keep higher resolution for price for the min qty |
4089
|
4089
|
'price_qty_ht_locale' => price($objp->fprice), |
4090
|
|
- 'price_unit_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price |
|
4090
|
+ 'price_unit_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price |
4091
|
4091
|
'price_unit_ht_locale' => price($objp->unitprice), |
4092
|
|
- 'price_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price (for compatibility) |
|
4092
|
+ 'price_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price (for compatibility) |
4093
|
4093
|
'tva_tx_formated' => price($objp->tva_tx), |
4094
|
4094
|
'tva_tx' => price2num($objp->tva_tx), |
4095
|
4095
|
'default_vat_code' => $objp->default_vat_code, |
|
@@ -4122,7 +4122,7 @@ discard block |
|
|
block discarded – undo |
4122
|
4122
|
|
4123
|
4123
|
$this->db->free($result); |
4124
|
4124
|
|
4125
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
4125
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
4126
|
4126
|
$out .= ajax_combobox($htmlname); |
4127
|
4127
|
} else { |
4128
|
4128
|
dol_print_error($this->db); |
|
@@ -4154,43 +4154,43 @@ discard block |
|
|
block discarded – undo |
4154
|
4154
|
$sql = "SELECT p.rowid, p.ref, p.label, p.price, p.duration, pfp.fk_soc,"; |
4155
|
4155
|
$sql .= " pfp.ref_fourn, pfp.rowid as idprodfournprice, pfp.price as fprice, pfp.remise_percent, pfp.quantity, pfp.unitprice,"; |
4156
|
4156
|
$sql .= " pfp.fk_supplier_price_expression, pfp.fk_product, pfp.tva_tx, s.nom as name"; |
4157
|
|
- $sql .= " FROM " . $this->db->prefix() . "product as p"; |
4158
|
|
- $sql .= " LEFT JOIN " . $this->db->prefix() . "product_fournisseur_price as pfp ON p.rowid = pfp.fk_product"; |
4159
|
|
- $sql .= " LEFT JOIN " . $this->db->prefix() . "societe as s ON pfp.fk_soc = s.rowid"; |
4160
|
|
- $sql .= " WHERE pfp.entity IN (" . getEntity('productsupplierprice') . ")"; |
|
4157
|
+ $sql .= " FROM ".$this->db->prefix()."product as p"; |
|
4158
|
+ $sql .= " LEFT JOIN ".$this->db->prefix()."product_fournisseur_price as pfp ON p.rowid = pfp.fk_product"; |
|
4159
|
+ $sql .= " LEFT JOIN ".$this->db->prefix()."societe as s ON pfp.fk_soc = s.rowid"; |
|
4160
|
+ $sql .= " WHERE pfp.entity IN (".getEntity('productsupplierprice').")"; |
4161
|
4161
|
$sql .= " AND p.tobuy = 1"; |
4162
|
4162
|
$sql .= " AND s.fournisseur = 1"; |
4163
|
|
- $sql .= " AND p.rowid = " . ((int) $productid); |
|
4163
|
+ $sql .= " AND p.rowid = ".((int) $productid); |
4164
|
4164
|
if (!getDolGlobalString('PRODUCT_BEST_SUPPLIER_PRICE_PRESELECTED')) { |
4165
|
4165
|
$sql .= " ORDER BY s.nom, pfp.ref_fourn DESC"; |
4166
|
4166
|
} else { |
4167
|
4167
|
$sql .= " ORDER BY pfp.unitprice ASC"; |
4168
|
4168
|
} |
4169
|
4169
|
|
4170
|
|
- dol_syslog(get_class($this) . "::select_product_fourn_price", LOG_DEBUG); |
|
4170
|
+ dol_syslog(get_class($this)."::select_product_fourn_price", LOG_DEBUG); |
4171
|
4171
|
$result = $this->db->query($sql); |
4172
|
4172
|
|
4173
|
4173
|
if ($result) { |
4174
|
4174
|
$num = $this->db->num_rows($result); |
4175
|
4175
|
|
4176
|
|
- $form = '<select class="flat" id="select_' . $htmlname . '" name="' . $htmlname . '">'; |
|
4176
|
+ $form = '<select class="flat" id="select_'.$htmlname.'" name="'.$htmlname.'">'; |
4177
|
4177
|
|
4178
|
4178
|
if (!$num) { |
4179
|
|
- $form .= '<option value="0">-- ' . $langs->trans("NoSupplierPriceDefinedForThisProduct") . ' --</option>'; |
|
4179
|
+ $form .= '<option value="0">-- '.$langs->trans("NoSupplierPriceDefinedForThisProduct").' --</option>'; |
4180
|
4180
|
} else { |
4181
|
|
- require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php'; |
|
4181
|
+ require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php'; |
4182
|
4182
|
$form .= '<option value="0"> </option>'; |
4183
|
4183
|
|
4184
|
4184
|
$i = 0; |
4185
|
4185
|
while ($i < $num) { |
4186
|
4186
|
$objp = $this->db->fetch_object($result); |
4187
|
4187
|
|
4188
|
|
- $opt = '<option value="' . $objp->idprodfournprice . '"'; |
|
4188
|
+ $opt = '<option value="'.$objp->idprodfournprice.'"'; |
4189
|
4189
|
//if there is only one supplier, preselect it |
4190
|
4190
|
if ($num == 1 || ($selected_supplier > 0 && $objp->fk_soc == $selected_supplier) || ($i == 0 && getDolGlobalString('PRODUCT_BEST_SUPPLIER_PRICE_PRESELECTED'))) { |
4191
|
4191
|
$opt .= ' selected'; |
4192
|
4192
|
} |
4193
|
|
- $opt .= '>' . $objp->name . ' - ' . $objp->ref_fourn . ' - '; |
|
4193
|
+ $opt .= '>'.$objp->name.' - '.$objp->ref_fourn.' - '; |
4194
|
4194
|
|
4195
|
4195
|
if (isModEnabled('dynamicprices') && !empty($objp->fk_supplier_price_expression)) { |
4196
|
4196
|
$prod_supplier = new ProductFournisseur($this->db); |
|
@@ -4200,7 +4200,7 @@ discard block |
|
|
block discarded – undo |
4200
|
4200
|
$prod_supplier->fourn_tva_tx = $objp->tva_tx; |
4201
|
4201
|
$prod_supplier->fk_supplier_price_expression = $objp->fk_supplier_price_expression; |
4202
|
4202
|
|
4203
|
|
- require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php'; |
|
4203
|
+ require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php'; |
4204
|
4204
|
$priceparser = new PriceParser($this->db); |
4205
|
4205
|
$price_result = $priceparser->parseProductSupplier($prod_supplier); |
4206
|
4206
|
if ($price_result >= 0) { |
|
@@ -4211,10 +4211,10 @@ discard block |
|
|
block discarded – undo |
4211
|
4211
|
} |
4212
|
4212
|
} |
4213
|
4213
|
if ($objp->quantity == 1) { |
4214
|
|
- $opt .= price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency) . "/"; |
|
4214
|
+ $opt .= price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency)."/"; |
4215
|
4215
|
} |
4216
|
4216
|
|
4217
|
|
- $opt .= $objp->quantity . ' '; |
|
4217
|
+ $opt .= $objp->quantity.' '; |
4218
|
4218
|
|
4219
|
4219
|
if ($objp->quantity == 1) { |
4220
|
4220
|
$opt .= $langs->trans("Unit"); |
|
@@ -4223,10 +4223,10 @@ discard block |
|
|
block discarded – undo |
4223
|
4223
|
} |
4224
|
4224
|
if ($objp->quantity > 1) { |
4225
|
4225
|
$opt .= " - "; |
4226
|
|
- $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"); |
|
4226
|
+ $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"); |
4227
|
4227
|
} |
4228
|
4228
|
if ($objp->duration) { |
4229
|
|
- $opt .= " - " . $objp->duration; |
|
4229
|
+ $opt .= " - ".$objp->duration; |
4230
|
4230
|
} |
4231
|
4231
|
$opt .= "</option>\n"; |
4232
|
4232
|
|
|
@@ -4264,8 +4264,8 @@ discard block |
|
|
block discarded – undo |
4264
|
4264
|
dol_syslog(__METHOD__, LOG_DEBUG); |
4265
|
4265
|
|
4266
|
4266
|
$sql = "SELECT rowid, code, libelle as label, deposit_percent"; |
4267
|
|
- $sql .= " FROM " . $this->db->prefix() . 'c_payment_term'; |
4268
|
|
- $sql .= " WHERE entity IN (" . getEntity('c_payment_term') . ")"; |
|
4267
|
+ $sql .= " FROM ".$this->db->prefix().'c_payment_term'; |
|
4268
|
+ $sql .= " WHERE entity IN (".getEntity('c_payment_term').")"; |
4269
|
4269
|
$sql .= " AND active > 0"; |
4270
|
4270
|
$sql .= " ORDER BY sortorder"; |
4271
|
4271
|
|
|
@@ -4277,7 +4277,7 @@ discard block |
|
|
block discarded – undo |
4277
|
4277
|
$obj = $this->db->fetch_object($resql); |
4278
|
4278
|
|
4279
|
4279
|
// Si traduction existe, on l'utilise, sinon on prend le libelle par default |
4280
|
|
- $label = ($langs->trans("PaymentConditionShort" . $obj->code) != "PaymentConditionShort" . $obj->code ? $langs->trans("PaymentConditionShort" . $obj->code) : ($obj->label != '-' ? $obj->label : '')); |
|
4280
|
+ $label = ($langs->trans("PaymentConditionShort".$obj->code) != "PaymentConditionShort".$obj->code ? $langs->trans("PaymentConditionShort".$obj->code) : ($obj->label != '-' ? $obj->label : '')); |
4281
|
4281
|
$this->cache_conditions_paiements[$obj->rowid]['code'] = $obj->code; |
4282
|
4282
|
$this->cache_conditions_paiements[$obj->rowid]['label'] = $label; |
4283
|
4283
|
$this->cache_conditions_paiements[$obj->rowid]['deposit_percent'] = $obj->deposit_percent; |
|
@@ -4305,7 +4305,7 @@ discard block |
|
|
block discarded – undo |
4305
|
4305
|
// phpcs:enable |
4306
|
4306
|
global $langs; |
4307
|
4307
|
|
4308
|
|
- $num = count($this->cache_availability); // TODO Use $conf->cache['availability'] instead of $this->cache_availability |
|
4308
|
+ $num = count($this->cache_availability); // TODO Use $conf->cache['availability'] instead of $this->cache_availability |
4309
|
4309
|
if ($num > 0) { |
4310
|
4310
|
return 0; // Cache already loaded |
4311
|
4311
|
} |
|
@@ -4315,7 +4315,7 @@ discard block |
|
|
block discarded – undo |
4315
|
4315
|
$langs->load('propal'); |
4316
|
4316
|
|
4317
|
4317
|
$sql = "SELECT rowid, code, label, position"; |
4318
|
|
- $sql .= " FROM " . $this->db->prefix() . 'c_availability'; |
|
4318
|
+ $sql .= " FROM ".$this->db->prefix().'c_availability'; |
4319
|
4319
|
$sql .= " WHERE active > 0"; |
4320
|
4320
|
|
4321
|
4321
|
$resql = $this->db->query($sql); |
|
@@ -4326,7 +4326,7 @@ discard block |
|
|
block discarded – undo |
4326
|
4326
|
$obj = $this->db->fetch_object($resql); |
4327
|
4327
|
|
4328
|
4328
|
// Si traduction existe, on l'utilise, sinon on prend le libelle par default |
4329
|
|
- $label = ($langs->trans("AvailabilityType" . $obj->code) != "AvailabilityType" . $obj->code ? $langs->trans("AvailabilityType" . $obj->code) : ($obj->label != '-' ? $obj->label : '')); |
|
4329
|
+ $label = ($langs->trans("AvailabilityType".$obj->code) != "AvailabilityType".$obj->code ? $langs->trans("AvailabilityType".$obj->code) : ($obj->label != '-' ? $obj->label : '')); |
4330
|
4330
|
$this->cache_availability[$obj->rowid]['code'] = $obj->code; |
4331
|
4331
|
$this->cache_availability[$obj->rowid]['label'] = $label; |
4332
|
4332
|
$this->cache_availability[$obj->rowid]['position'] = $obj->position; |
|
@@ -4358,17 +4358,17 @@ discard block |
|
|
block discarded – undo |
4358
|
4358
|
|
4359
|
4359
|
$this->load_cache_availability(); |
4360
|
4360
|
|
4361
|
|
- dol_syslog(__METHOD__ . " selected=" . $selected . ", htmlname=" . $htmlname, LOG_DEBUG); |
|
4361
|
+ dol_syslog(__METHOD__." selected=".$selected.", htmlname=".$htmlname, LOG_DEBUG); |
4362
|
4362
|
|
4363
|
|
- print '<select id="' . $htmlname . '" class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">'; |
|
4363
|
+ print '<select id="'.$htmlname.'" class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">'; |
4364
|
4364
|
if ($addempty) { |
4365
|
4365
|
print '<option value="0"> </option>'; |
4366
|
4366
|
} |
4367
|
4367
|
foreach ($this->cache_availability as $id => $arrayavailability) { |
4368
|
4368
|
if ($selected == $id) { |
4369
|
|
- print '<option value="' . $id . '" selected>'; |
|
4369
|
+ print '<option value="'.$id.'" selected>'; |
4370
|
4370
|
} else { |
4371
|
|
- print '<option value="' . $id . '">'; |
|
4371
|
+ print '<option value="'.$id.'">'; |
4372
|
4372
|
} |
4373
|
4373
|
print dol_escape_htmltag($arrayavailability['label']); |
4374
|
4374
|
print '</option>'; |
|
@@ -4389,13 +4389,13 @@ discard block |
|
|
block discarded – undo |
4389
|
4389
|
{ |
4390
|
4390
|
global $langs; |
4391
|
4391
|
|
4392
|
|
- $num = count($this->cache_demand_reason); // TODO Use $conf->cache['input_reason'] instead of $this->cache_demand_reason |
|
4392
|
+ $num = count($this->cache_demand_reason); // TODO Use $conf->cache['input_reason'] instead of $this->cache_demand_reason |
4393
|
4393
|
if ($num > 0) { |
4394
|
4394
|
return 0; // Cache already loaded |
4395
|
4395
|
} |
4396
|
4396
|
|
4397
|
4397
|
$sql = "SELECT rowid, code, label"; |
4398
|
|
- $sql .= " FROM " . $this->db->prefix() . 'c_input_reason'; |
|
4398
|
+ $sql .= " FROM ".$this->db->prefix().'c_input_reason'; |
4399
|
4399
|
$sql .= " WHERE active > 0"; |
4400
|
4400
|
|
4401
|
4401
|
$resql = $this->db->query($sql); |
|
@@ -4408,8 +4408,8 @@ discard block |
|
|
block discarded – undo |
4408
|
4408
|
|
4409
|
4409
|
// Si traduction existe, on l'utilise, sinon on prend le libelle par default |
4410
|
4410
|
$label = ($obj->label != '-' ? $obj->label : ''); |
4411
|
|
- if ($langs->trans("DemandReasonType" . $obj->code) != "DemandReasonType" . $obj->code) { |
4412
|
|
- $label = $langs->trans("DemandReasonType" . $obj->code); // So translation key DemandReasonTypeSRC_XXX will work |
|
4411
|
+ if ($langs->trans("DemandReasonType".$obj->code) != "DemandReasonType".$obj->code) { |
|
4412
|
+ $label = $langs->trans("DemandReasonType".$obj->code); // So translation key DemandReasonTypeSRC_XXX will work |
4413
|
4413
|
} |
4414
|
4414
|
if ($langs->trans($obj->code) != $obj->code) { |
4415
|
4415
|
$label = $langs->trans($obj->code); // So translation key SRC_XXX will work |
|
@@ -4449,9 +4449,9 @@ discard block |
|
|
block discarded – undo |
4449
|
4449
|
|
4450
|
4450
|
$this->loadCacheInputReason(); |
4451
|
4451
|
|
4452
|
|
- print '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" id="select_' . $htmlname . '" name="' . $htmlname . '">'; |
|
4452
|
+ print '<select class="flat'.($morecss ? ' '.$morecss : '').'" id="select_'.$htmlname.'" name="'.$htmlname.'">'; |
4453
|
4453
|
if ($addempty) { |
4454
|
|
- print '<option value="0"' . (empty($selected) ? ' selected' : '') . '> </option>'; |
|
4454
|
+ print '<option value="0"'.(empty($selected) ? ' selected' : '').'> </option>'; |
4455
|
4455
|
} |
4456
|
4456
|
foreach ($this->cache_demand_reason as $id => $arraydemandreason) { |
4457
|
4457
|
if ($arraydemandreason['code'] == $exclude) { |
|
@@ -4459,9 +4459,9 @@ discard block |
|
|
block discarded – undo |
4459
|
4459
|
} |
4460
|
4460
|
|
4461
|
4461
|
if ($selected && ($selected == $arraydemandreason['id'] || $selected == $arraydemandreason['code'])) { |
4462
|
|
- print '<option value="' . $arraydemandreason['id'] . '" selected>'; |
|
4462
|
+ print '<option value="'.$arraydemandreason['id'].'" selected>'; |
4463
|
4463
|
} else { |
4464
|
|
- print '<option value="' . $arraydemandreason['id'] . '">'; |
|
4464
|
+ print '<option value="'.$arraydemandreason['id'].'">'; |
4465
|
4465
|
} |
4466
|
4466
|
$label = $arraydemandreason['label']; // Translation of label was already done into the ->loadCacheInputReason |
4467
|
4467
|
print $langs->trans($label); |
|
@@ -4471,7 +4471,7 @@ discard block |
|
|
block discarded – undo |
4471
|
4471
|
if ($user->admin && empty($notooltip)) { |
4472
|
4472
|
print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); |
4473
|
4473
|
} |
4474
|
|
- print ajax_combobox('select_' . $htmlname); |
|
4474
|
+ print ajax_combobox('select_'.$htmlname); |
4475
|
4475
|
} |
4476
|
4476
|
|
4477
|
4477
|
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
@@ -4486,7 +4486,7 @@ discard block |
|
|
block discarded – undo |
4486
|
4486
|
// phpcs:enable |
4487
|
4487
|
global $langs; |
4488
|
4488
|
|
4489
|
|
- $num = count($this->cache_types_paiements); // TODO Use $conf->cache['payment_mode'] instead of $this->cache_types_paiements |
|
4489
|
+ $num = count($this->cache_types_paiements); // TODO Use $conf->cache['payment_mode'] instead of $this->cache_types_paiements |
4490
|
4490
|
if ($num > 0) { |
4491
|
4491
|
return $num; // Cache already loaded |
4492
|
4492
|
} |
|
@@ -4496,8 +4496,8 @@ discard block |
|
|
block discarded – undo |
4496
|
4496
|
$this->cache_types_paiements = array(); |
4497
|
4497
|
|
4498
|
4498
|
$sql = "SELECT id, code, libelle as label, type, active"; |
4499
|
|
- $sql .= " FROM " . $this->db->prefix() . "c_paiement"; |
4500
|
|
- $sql .= " WHERE entity IN (" . getEntity('c_paiement') . ")"; |
|
4499
|
+ $sql .= " FROM ".$this->db->prefix()."c_paiement"; |
|
4500
|
+ $sql .= " WHERE entity IN (".getEntity('c_paiement').")"; |
4501
|
4501
|
|
4502
|
4502
|
$resql = $this->db->query($sql); |
4503
|
4503
|
if ($resql) { |
|
@@ -4507,7 +4507,7 @@ discard block |
|
|
block discarded – undo |
4507
|
4507
|
$obj = $this->db->fetch_object($resql); |
4508
|
4508
|
|
4509
|
4509
|
// Si traduction existe, on l'utilise, sinon on prend le libelle par default |
4510
|
|
- $label = ($langs->transnoentitiesnoconv("PaymentTypeShort" . $obj->code) != "PaymentTypeShort" . $obj->code ? $langs->transnoentitiesnoconv("PaymentTypeShort" . $obj->code) : ($obj->label != '-' ? $obj->label : '')); |
|
4510
|
+ $label = ($langs->transnoentitiesnoconv("PaymentTypeShort".$obj->code) != "PaymentTypeShort".$obj->code ? $langs->transnoentitiesnoconv("PaymentTypeShort".$obj->code) : ($obj->label != '-' ? $obj->label : '')); |
4511
|
4511
|
$this->cache_types_paiements[$obj->id]['id'] = $obj->id; |
4512
|
4512
|
$this->cache_types_paiements[$obj->id]['code'] = $obj->code; |
4513
|
4513
|
$this->cache_types_paiements[$obj->id]['label'] = $label; |
|
@@ -4579,17 +4579,17 @@ discard block |
|
|
block discarded – undo |
4579
|
4579
|
global $langs, $user, $conf; |
4580
|
4580
|
|
4581
|
4581
|
$out = ''; |
4582
|
|
- dol_syslog(__METHOD__ . " selected=" . $selected . ", htmlname=" . $htmlname, LOG_DEBUG); |
|
4582
|
+ dol_syslog(__METHOD__." selected=".$selected.", htmlname=".$htmlname, LOG_DEBUG); |
4583
|
4583
|
|
4584
|
4584
|
$this->load_cache_conditions_paiements(); |
4585
|
4585
|
|
4586
|
4586
|
// Set default value if not already set by caller |
4587
|
4587
|
if (empty($selected) && getDolGlobalString('MAIN_DEFAULT_PAYMENT_TERM_ID')) { |
4588
|
|
- dol_syslog(__METHOD__ . "Using deprecated option MAIN_DEFAULT_PAYMENT_TERM_ID", LOG_NOTICE); |
|
4588
|
+ dol_syslog(__METHOD__."Using deprecated option MAIN_DEFAULT_PAYMENT_TERM_ID", LOG_NOTICE); |
4589
|
4589
|
$selected = getDolGlobalString('MAIN_DEFAULT_PAYMENT_TERM_ID'); |
4590
|
4590
|
} |
4591
|
4591
|
|
4592
|
|
- $out .= '<select id="' . $htmlname . '" class="flat selectpaymentterms' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">'; |
|
4592
|
+ $out .= '<select id="'.$htmlname.'" class="flat selectpaymentterms'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">'; |
4593
|
4593
|
if ($addempty) { |
4594
|
4594
|
$out .= '<option value="0"> </option>'; |
4595
|
4595
|
} |
|
@@ -4603,9 +4603,9 @@ discard block |
|
|
block discarded – undo |
4603
|
4603
|
|
4604
|
4604
|
if ($selected == $id) { |
4605
|
4605
|
$selectedDepositPercent = $deposit_percent > 0 ? $deposit_percent : $arrayconditions['deposit_percent']; |
4606
|
|
- $out .= '<option value="' . $id . '" data-deposit_percent="' . $arrayconditions['deposit_percent'] . '" selected>'; |
|
4606
|
+ $out .= '<option value="'.$id.'" data-deposit_percent="'.$arrayconditions['deposit_percent'].'" selected>'; |
4607
|
4607
|
} else { |
4608
|
|
- $out .= '<option value="' . $id . '" data-deposit_percent="' . $arrayconditions['deposit_percent'] . '">'; |
|
4608
|
+ $out .= '<option value="'.$id.'" data-deposit_percent="'.$arrayconditions['deposit_percent'].'">'; |
4609
|
4609
|
} |
4610
|
4610
|
$label = $arrayconditions['label']; |
4611
|
4611
|
|
|
@@ -4623,21 +4623,21 @@ discard block |
|
|
block discarded – undo |
4623
|
4623
|
$out .= ajax_combobox($htmlname); |
4624
|
4624
|
|
4625
|
4625
|
if ($deposit_percent >= 0) { |
4626
|
|
- $out .= ' <span id="' . $htmlname . '_deposit_percent_container"' . (empty($selectedDepositPercent) ? ' style="display: none"' : '') . '>'; |
4627
|
|
- $out .= $langs->trans('DepositPercent') . ' : '; |
4628
|
|
- $out .= '<input id="' . $htmlname . '_deposit_percent" name="' . $htmlname . '_deposit_percent" class="maxwidth50" value="' . $deposit_percent . '" />'; |
|
4626
|
+ $out .= ' <span id="'.$htmlname.'_deposit_percent_container"'.(empty($selectedDepositPercent) ? ' style="display: none"' : '').'>'; |
|
4627
|
+ $out .= $langs->trans('DepositPercent').' : '; |
|
4628
|
+ $out .= '<input id="'.$htmlname.'_deposit_percent" name="'.$htmlname.'_deposit_percent" class="maxwidth50" value="'.$deposit_percent.'" />'; |
4629
|
4629
|
$out .= '</span>'; |
4630
|
4630
|
$out .= ' |
4631
|
|
- <script nonce="' . getNonce() . '"> |
|
4631
|
+ <script nonce="' . getNonce().'"> |
4632
|
4632
|
$(document).ready(function () { |
4633
|
|
- $("#' . $htmlname . '").change(function () { |
|
4633
|
+ $("#' . $htmlname.'").change(function () { |
4634
|
4634
|
let $selected = $(this).find("option:selected"); |
4635
|
4635
|
let depositPercent = $selected.attr("data-deposit_percent"); |
4636
|
4636
|
|
4637
|
4637
|
if (depositPercent.length > 0) { |
4638
|
|
- $("#' . $htmlname . '_deposit_percent_container").show().find("#' . $htmlname . '_deposit_percent").val(depositPercent); |
|
4638
|
+ $("#' . $htmlname.'_deposit_percent_container").show().find("#'.$htmlname.'_deposit_percent").val(depositPercent); |
4639
|
4639
|
} else { |
4640
|
|
- $("#' . $htmlname . '_deposit_percent_container").hide(); |
|
4640
|
+ $("#' . $htmlname.'_deposit_percent_container").hide(); |
4641
|
4641
|
} |
4642
|
4642
|
|
4643
|
4643
|
return true; |
|
@@ -4675,7 +4675,7 @@ discard block |
|
|
block discarded – undo |
4675
|
4675
|
|
4676
|
4676
|
$out = ''; |
4677
|
4677
|
|
4678
|
|
- dol_syslog(__METHOD__ . " " . $selected . ", " . $htmlname . ", " . $filtertype . ", " . $format, LOG_DEBUG); |
|
4678
|
+ dol_syslog(__METHOD__." ".$selected.", ".$htmlname.", ".$filtertype.", ".$format, LOG_DEBUG); |
4679
|
4679
|
|
4680
|
4680
|
$filterarray = array(); |
4681
|
4681
|
if ($filtertype == 'CRDT') { |
|
@@ -4690,11 +4690,11 @@ discard block |
|
|
block discarded – undo |
4690
|
4690
|
|
4691
|
4691
|
// Set default value if not already set by caller |
4692
|
4692
|
if (empty($selected) && getDolGlobalString('MAIN_DEFAULT_PAYMENT_TYPE_ID')) { |
4693
|
|
- dol_syslog(__METHOD__ . "Using deprecated option MAIN_DEFAULT_PAYMENT_TYPE_ID", LOG_NOTICE); |
|
4693
|
+ dol_syslog(__METHOD__."Using deprecated option MAIN_DEFAULT_PAYMENT_TYPE_ID", LOG_NOTICE); |
4694
|
4694
|
$selected = getDolGlobalString('MAIN_DEFAULT_PAYMENT_TYPE_ID'); |
4695
|
4695
|
} |
4696
|
4696
|
|
4697
|
|
- $out .= '<select id="select' . $htmlname . '" class="flat selectpaymenttypes' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">'; |
|
4697
|
+ $out .= '<select id="select'.$htmlname.'" class="flat selectpaymenttypes'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">'; |
4698
|
4698
|
if ($empty) { |
4699
|
4699
|
$out .= '<option value=""> </option>'; |
4700
|
4700
|
} |
|
@@ -4715,13 +4715,13 @@ discard block |
|
|
block discarded – undo |
4715
|
4715
|
} |
4716
|
4716
|
|
4717
|
4717
|
if ($format == 0) { |
4718
|
|
- $out .= '<option value="' . $id . '"'; |
|
4718
|
+ $out .= '<option value="'.$id.'"'; |
4719
|
4719
|
} elseif ($format == 1) { |
4720
|
|
- $out .= '<option value="' . $arraytypes['code'] . '"'; |
|
4720
|
+ $out .= '<option value="'.$arraytypes['code'].'"'; |
4721
|
4721
|
} elseif ($format == 2) { |
4722
|
|
- $out .= '<option value="' . $arraytypes['code'] . '"'; |
|
4722
|
+ $out .= '<option value="'.$arraytypes['code'].'"'; |
4723
|
4723
|
} elseif ($format == 3) { |
4724
|
|
- $out .= '<option value="' . $id . '"'; |
|
4724
|
+ $out .= '<option value="'.$id.'"'; |
4725
|
4725
|
} |
4726
|
4726
|
// Print attribute selected or not |
4727
|
4727
|
if ($format == 1 || $format == 2) { |
|
@@ -4751,7 +4751,7 @@ discard block |
|
|
block discarded – undo |
4751
|
4751
|
if ($user->admin && !$noadmininfo) { |
4752
|
4752
|
$out .= info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); |
4753
|
4753
|
} |
4754
|
|
- $out .= ajax_combobox('select' . $htmlname); |
|
4754
|
+ $out .= ajax_combobox('select'.$htmlname); |
4755
|
4755
|
|
4756
|
4756
|
if (empty($nooutput)) { |
4757
|
4757
|
print $out; |
|
@@ -4773,22 +4773,22 @@ discard block |
|
|
block discarded – undo |
4773
|
4773
|
{ |
4774
|
4774
|
global $langs; |
4775
|
4775
|
|
4776
|
|
- $return = '<select class="flat maxwidth100" id="select_' . $htmlname . '" name="' . $htmlname . '">'; |
|
4776
|
+ $return = '<select class="flat maxwidth100" id="select_'.$htmlname.'" name="'.$htmlname.'">'; |
4777
|
4777
|
$options = array( |
4778
|
4778
|
'HT' => $langs->trans("HT"), |
4779
|
4779
|
'TTC' => $langs->trans("TTC") |
4780
|
4780
|
); |
4781
|
4781
|
foreach ($options as $id => $value) { |
4782
|
4782
|
if ($selected == $id) { |
4783
|
|
- $return .= '<option value="' . $id . '" selected>' . $value; |
|
4783
|
+ $return .= '<option value="'.$id.'" selected>'.$value; |
4784
|
4784
|
} else { |
4785
|
|
- $return .= '<option value="' . $id . '">' . $value; |
|
4785
|
+ $return .= '<option value="'.$id.'">'.$value; |
4786
|
4786
|
} |
4787
|
4787
|
$return .= '</option>'; |
4788
|
4788
|
} |
4789
|
4789
|
$return .= '</select>'; |
4790
|
4790
|
if ($addjscombo) { |
4791
|
|
- $return .= ajax_combobox('select_' . $htmlname); |
|
4791
|
+ $return .= ajax_combobox('select_'.$htmlname); |
4792
|
4792
|
} |
4793
|
4793
|
|
4794
|
4794
|
return $return; |
|
@@ -4806,7 +4806,7 @@ discard block |
|
|
block discarded – undo |
4806
|
4806
|
// phpcs:enable |
4807
|
4807
|
global $langs; |
4808
|
4808
|
|
4809
|
|
- $num = count($this->cache_transport_mode); // TODO Use $conf->cache['payment_mode'] instead of $this->cache_transport_mode |
|
4809
|
+ $num = count($this->cache_transport_mode); // TODO Use $conf->cache['payment_mode'] instead of $this->cache_transport_mode |
4810
|
4810
|
if ($num > 0) { |
4811
|
4811
|
return $num; // Cache already loaded |
4812
|
4812
|
} |
|
@@ -4816,8 +4816,8 @@ discard block |
|
|
block discarded – undo |
4816
|
4816
|
$this->cache_transport_mode = array(); |
4817
|
4817
|
|
4818
|
4818
|
$sql = "SELECT rowid, code, label, active"; |
4819
|
|
- $sql .= " FROM " . $this->db->prefix() . "c_transport_mode"; |
4820
|
|
- $sql .= " WHERE entity IN (" . getEntity('c_transport_mode') . ")"; |
|
4819
|
+ $sql .= " FROM ".$this->db->prefix()."c_transport_mode"; |
|
4820
|
+ $sql .= " WHERE entity IN (".getEntity('c_transport_mode').")"; |
4821
|
4821
|
|
4822
|
4822
|
$resql = $this->db->query($sql); |
4823
|
4823
|
if ($resql) { |
|
@@ -4827,7 +4827,7 @@ discard block |
|
|
block discarded – undo |
4827
|
4827
|
$obj = $this->db->fetch_object($resql); |
4828
|
4828
|
|
4829
|
4829
|
// If traduction exist, we use it else we take the default label |
4830
|
|
- $label = ($langs->transnoentitiesnoconv("PaymentTypeShort" . $obj->code) != "PaymentTypeShort" . $obj->code ? $langs->transnoentitiesnoconv("PaymentTypeShort" . $obj->code) : ($obj->label != '-' ? $obj->label : '')); |
|
4830
|
+ $label = ($langs->transnoentitiesnoconv("PaymentTypeShort".$obj->code) != "PaymentTypeShort".$obj->code ? $langs->transnoentitiesnoconv("PaymentTypeShort".$obj->code) : ($obj->label != '-' ? $obj->label : '')); |
4831
|
4831
|
$this->cache_transport_mode[$obj->rowid]['rowid'] = $obj->rowid; |
4832
|
4832
|
$this->cache_transport_mode[$obj->rowid]['code'] = $obj->code; |
4833
|
4833
|
$this->cache_transport_mode[$obj->rowid]['label'] = $label; |
|
@@ -4861,11 +4861,11 @@ discard block |
|
|
block discarded – undo |
4861
|
4861
|
{ |
4862
|
4862
|
global $langs, $user; |
4863
|
4863
|
|
4864
|
|
- dol_syslog(__METHOD__ . " " . $selected . ", " . $htmlname . ", " . $format, LOG_DEBUG); |
|
4864
|
+ dol_syslog(__METHOD__." ".$selected.", ".$htmlname.", ".$format, LOG_DEBUG); |
4865
|
4865
|
|
4866
|
4866
|
$this->load_cache_transport_mode(); |
4867
|
4867
|
|
4868
|
|
- print '<select id="select' . $htmlname . '" class="flat selectmodetransport' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">'; |
|
4868
|
+ print '<select id="select'.$htmlname.'" class="flat selectmodetransport'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">'; |
4869
|
4869
|
if ($empty) { |
4870
|
4870
|
print '<option value=""> </option>'; |
4871
|
4871
|
} |
|
@@ -4881,13 +4881,13 @@ discard block |
|
|
block discarded – undo |
4881
|
4881
|
} |
4882
|
4882
|
|
4883
|
4883
|
if ($format == 0) { |
4884
|
|
- print '<option value="' . $id . '"'; |
|
4884
|
+ print '<option value="'.$id.'"'; |
4885
|
4885
|
} elseif ($format == 1) { |
4886
|
|
- print '<option value="' . $arraytypes['code'] . '"'; |
|
4886
|
+ print '<option value="'.$arraytypes['code'].'"'; |
4887
|
4887
|
} elseif ($format == 2) { |
4888
|
|
- print '<option value="' . $arraytypes['code'] . '"'; |
|
4888
|
+ print '<option value="'.$arraytypes['code'].'"'; |
4889
|
4889
|
} elseif ($format == 3) { |
4890
|
|
- print '<option value="' . $id . '"'; |
|
4890
|
+ print '<option value="'.$id.'"'; |
4891
|
4891
|
} |
4892
|
4892
|
// If text is selected, we compare with code, else with id |
4893
|
4893
|
if (preg_match('/[a-z]/i', $selected) && $selected == $arraytypes['code']) { |
|
@@ -4935,31 +4935,31 @@ discard block |
|
|
block discarded – undo |
4935
|
4935
|
$langs->load("deliveries"); |
4936
|
4936
|
|
4937
|
4937
|
$sql = "SELECT rowid, code, libelle as label"; |
4938
|
|
- $sql .= " FROM " . $this->db->prefix() . "c_shipment_mode"; |
|
4938
|
+ $sql .= " FROM ".$this->db->prefix()."c_shipment_mode"; |
4939
|
4939
|
$sql .= " WHERE active > 0"; |
4940
|
4940
|
if ($filtre) { |
4941
|
|
- $sql .= " AND " . $filtre; |
|
4941
|
+ $sql .= " AND ".$filtre; |
4942
|
4942
|
} |
4943
|
4943
|
$sql .= " ORDER BY libelle ASC"; |
4944
|
4944
|
|
4945
|
|
- dol_syslog(get_class($this) . "::selectShippingMode", LOG_DEBUG); |
|
4945
|
+ dol_syslog(get_class($this)."::selectShippingMode", LOG_DEBUG); |
4946
|
4946
|
$result = $this->db->query($sql); |
4947
|
4947
|
if ($result) { |
4948
|
4948
|
$num = $this->db->num_rows($result); |
4949
|
4949
|
$i = 0; |
4950
|
4950
|
if ($num) { |
4951
|
|
- print '<select id="select' . $htmlname . '" class="flat selectshippingmethod' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '"' . ($moreattrib ? ' ' . $moreattrib : '') . '>'; |
|
4951
|
+ print '<select id="select'.$htmlname.'" class="flat selectshippingmethod'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'"'.($moreattrib ? ' '.$moreattrib : '').'>'; |
4952
|
4952
|
if ($useempty == 1 || ($useempty == 2 && $num > 1)) { |
4953
|
4953
|
print '<option value="-1"> </option>'; |
4954
|
4954
|
} |
4955
|
4955
|
while ($i < $num) { |
4956
|
4956
|
$obj = $this->db->fetch_object($result); |
4957
|
4957
|
if ($selected == $obj->rowid) { |
4958
|
|
- print '<option value="' . $obj->rowid . '" selected>'; |
|
4958
|
+ print '<option value="'.$obj->rowid.'" selected>'; |
4959
|
4959
|
} else { |
4960
|
|
- print '<option value="' . $obj->rowid . '">'; |
|
4960
|
+ print '<option value="'.$obj->rowid.'">'; |
4961
|
4961
|
} |
4962
|
|
- print ($langs->trans("SendingMethod" . strtoupper($obj->code)) != "SendingMethod" . strtoupper($obj->code)) ? $langs->trans("SendingMethod" . strtoupper($obj->code)) : $obj->label; |
|
4962
|
+ print ($langs->trans("SendingMethod".strtoupper($obj->code)) != "SendingMethod".strtoupper($obj->code)) ? $langs->trans("SendingMethod".strtoupper($obj->code)) : $obj->label; |
4963
|
4963
|
print '</option>'; |
4964
|
4964
|
$i++; |
4965
|
4965
|
} |
|
@@ -4968,7 +4968,7 @@ discard block |
|
|
block discarded – undo |
4968
|
4968
|
print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); |
4969
|
4969
|
} |
4970
|
4970
|
|
4971
|
|
- print ajax_combobox('select' . $htmlname); |
|
4971
|
+ print ajax_combobox('select'.$htmlname); |
4972
|
4972
|
} else { |
4973
|
4973
|
print $langs->trans("NoShippingMethodDefined"); |
4974
|
4974
|
} |
|
@@ -4993,16 +4993,16 @@ discard block |
|
|
block discarded – undo |
4993
|
4993
|
$langs->load("deliveries"); |
4994
|
4994
|
|
4995
|
4995
|
if ($htmlname != "none") { |
4996
|
|
- print '<form method="POST" action="' . $page . '">'; |
|
4996
|
+ print '<form method="POST" action="'.$page.'">'; |
4997
|
4997
|
print '<input type="hidden" name="action" value="setshippingmethod">'; |
4998
|
|
- print '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
4998
|
+ print '<input type="hidden" name="token" value="'.newToken().'">'; |
4999
|
4999
|
$this->selectShippingMethod($selected, $htmlname, '', $addempty); |
5000
|
|
- print '<input type="submit" class="button valignmiddle" value="' . $langs->trans("Modify") . '">'; |
|
5000
|
+ print '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">'; |
5001
|
5001
|
print '</form>'; |
5002
|
5002
|
} else { |
5003
|
5003
|
if ($selected) { |
5004
|
5004
|
$code = $langs->getLabelFromKey($this->db, $selected, 'c_shipment_mode', 'rowid', 'code'); |
5005
|
|
- print $langs->trans("SendingMethod" . strtoupper($code)); |
|
5005
|
+ print $langs->trans("SendingMethod".strtoupper($code)); |
5006
|
5006
|
} else { |
5007
|
5007
|
print " "; |
5008
|
5008
|
} |
|
@@ -5025,10 +5025,10 @@ discard block |
|
|
block discarded – undo |
5025
|
5025
|
|
5026
|
5026
|
$opt = '<option value="" selected></option>'; |
5027
|
5027
|
$sql = "SELECT rowid, ref, situation_cycle_ref, situation_counter, situation_final, fk_soc"; |
5028
|
|
- $sql .= ' FROM ' . $this->db->prefix() . 'facture'; |
5029
|
|
- $sql .= ' WHERE entity IN (' . getEntity('invoice') . ')'; |
|
5028
|
+ $sql .= ' FROM '.$this->db->prefix().'facture'; |
|
5029
|
+ $sql .= ' WHERE entity IN ('.getEntity('invoice').')'; |
5030
|
5030
|
$sql .= ' AND situation_counter >= 1'; |
5031
|
|
- $sql .= ' AND fk_soc = ' . (int) $socid; |
|
5031
|
+ $sql .= ' AND fk_soc = '.(int) $socid; |
5032
|
5032
|
$sql .= ' AND type <> 2'; |
5033
|
5033
|
$sql .= ' ORDER by situation_cycle_ref, situation_counter desc'; |
5034
|
5034
|
$resql = $this->db->query($sql); |
|
@@ -5046,19 +5046,19 @@ discard block |
|
|
block discarded – undo |
5046
|
5046
|
//Not prov? |
5047
|
5047
|
if (substr($obj->ref, 1, 4) != 'PROV') { |
5048
|
5048
|
if ($selected == $obj->rowid) { |
5049
|
|
- $opt .= '<option value="' . $obj->rowid . '" selected>' . $obj->ref . '</option>'; |
|
5049
|
+ $opt .= '<option value="'.$obj->rowid.'" selected>'.$obj->ref.'</option>'; |
5050
|
5050
|
} else { |
5051
|
|
- $opt .= '<option value="' . $obj->rowid . '">' . $obj->ref . '</option>'; |
|
5051
|
+ $opt .= '<option value="'.$obj->rowid.'">'.$obj->ref.'</option>'; |
5052
|
5052
|
} |
5053
|
5053
|
} |
5054
|
5054
|
} |
5055
|
5055
|
} |
5056
|
5056
|
} |
5057
|
5057
|
} else { |
5058
|
|
- dol_syslog("Error sql=" . $sql . ", error=" . $this->error, LOG_ERR); |
|
5058
|
+ dol_syslog("Error sql=".$sql.", error=".$this->error, LOG_ERR); |
5059
|
5059
|
} |
5060
|
5060
|
if ($opt == '<option value ="" selected></option>') { |
5061
|
|
- $opt = '<option value ="0" selected>' . $langs->trans('NoSituations') . '</option>'; |
|
5061
|
+ $opt = '<option value ="0" selected>'.$langs->trans('NoSituations').'</option>'; |
5062
|
5062
|
} |
5063
|
5063
|
return $opt; |
5064
|
5064
|
} |
|
@@ -5078,12 +5078,12 @@ discard block |
|
|
block discarded – undo |
5078
|
5078
|
|
5079
|
5079
|
$langs->load('products'); |
5080
|
5080
|
|
5081
|
|
- $return = '<select class="flat" id="' . $htmlname . '" name="' . $htmlname . '">'; |
|
5081
|
+ $return = '<select class="flat" id="'.$htmlname.'" name="'.$htmlname.'">'; |
5082
|
5082
|
|
5083
|
|
- $sql = "SELECT rowid, label, code FROM " . $this->db->prefix() . "c_units"; |
|
5083
|
+ $sql = "SELECT rowid, label, code FROM ".$this->db->prefix()."c_units"; |
5084
|
5084
|
$sql .= ' WHERE active > 0'; |
5085
|
5085
|
if (!empty($unit_type)) { |
5086
|
|
- $sql .= " AND unit_type = '" . $this->db->escape($unit_type) . "'"; |
|
5086
|
+ $sql .= " AND unit_type = '".$this->db->escape($unit_type)."'"; |
5087
|
5087
|
} |
5088
|
5088
|
$sql .= " ORDER BY sortorder"; |
5089
|
5089
|
|
|
@@ -5095,14 +5095,14 @@ discard block |
|
|
block discarded – undo |
5095
|
5095
|
|
5096
|
5096
|
while ($res = $this->db->fetch_object($resql)) { |
5097
|
5097
|
$unitLabel = $res->label; |
5098
|
|
- if (!empty($langs->tab_translate['unit' . $res->code])) { // check if Translation is available before |
5099
|
|
- $unitLabel = $langs->trans('unit' . $res->code) != $res->label ? $langs->trans('unit' . $res->code) : $res->label; |
|
5098
|
+ if (!empty($langs->tab_translate['unit'.$res->code])) { // check if Translation is available before |
|
5099
|
+ $unitLabel = $langs->trans('unit'.$res->code) != $res->label ? $langs->trans('unit'.$res->code) : $res->label; |
5100
|
5100
|
} |
5101
|
5101
|
|
5102
|
5102
|
if ($selected == $res->rowid) { |
5103
|
|
- $return .= '<option value="' . $res->rowid . '" selected>' . $unitLabel . '</option>'; |
|
5103
|
+ $return .= '<option value="'.$res->rowid.'" selected>'.$unitLabel.'</option>'; |
5104
|
5104
|
} else { |
5105
|
|
- $return .= '<option value="' . $res->rowid . '">' . $unitLabel . '</option>'; |
|
5105
|
+ $return .= '<option value="'.$res->rowid.'">'.$unitLabel.'</option>'; |
5106
|
5106
|
} |
5107
|
5107
|
} |
5108
|
5108
|
$return .= '</select>'; |
|
@@ -5137,29 +5137,29 @@ discard block |
|
|
block discarded – undo |
5137
|
5137
|
$num = 0; |
5138
|
5138
|
|
5139
|
5139
|
$sql = "SELECT rowid, label, bank, clos as status, currency_code"; |
5140
|
|
- $sql .= " FROM " . $this->db->prefix() . "bank_account"; |
5141
|
|
- $sql .= " WHERE entity IN (" . getEntity('bank_account') . ")"; |
|
5140
|
+ $sql .= " FROM ".$this->db->prefix()."bank_account"; |
|
5141
|
+ $sql .= " WHERE entity IN (".getEntity('bank_account').")"; |
5142
|
5142
|
if ($status != 2) { |
5143
|
|
- $sql .= " AND clos = " . (int) $status; |
|
5143
|
+ $sql .= " AND clos = ".(int) $status; |
5144
|
5144
|
} |
5145
|
5145
|
if ($filtre) { // TODO Support USF |
5146
|
|
- $sql .= " AND " . $filtre; |
|
5146
|
+ $sql .= " AND ".$filtre; |
5147
|
5147
|
} |
5148
|
5148
|
$sql .= " ORDER BY label"; |
5149
|
5149
|
|
5150
|
|
- dol_syslog(get_class($this) . "::select_comptes", LOG_DEBUG); |
|
5150
|
+ dol_syslog(get_class($this)."::select_comptes", LOG_DEBUG); |
5151
|
5151
|
$result = $this->db->query($sql); |
5152
|
5152
|
if ($result) { |
5153
|
5153
|
$num = $this->db->num_rows($result); |
5154
|
5154
|
$i = 0; |
5155
|
5155
|
|
5156
|
|
- $out .= '<select id="select' . $htmlname . '" class="flat selectbankaccount' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '"' . ($moreattrib ? ' ' . $moreattrib : '') . '>'; |
|
5156
|
+ $out .= '<select id="select'.$htmlname.'" class="flat selectbankaccount'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'"'.($moreattrib ? ' '.$moreattrib : '').'>'; |
5157
|
5157
|
|
5158
|
5158
|
if ($num == 0) { |
5159
|
5159
|
if ($status == 0) { |
5160
|
|
- $out .= '<option class="opacitymedium" value="-1">' . $langs->trans("NoActiveBankAccountDefined") . '</span>'; |
|
5160
|
+ $out .= '<option class="opacitymedium" value="-1">'.$langs->trans("NoActiveBankAccountDefined").'</span>'; |
5161
|
5161
|
} else { |
5162
|
|
- $out .= '<option class="opacitymedium" value="-1">' . $langs->trans("NoBankAccountFound") . '</span>'; |
|
5162
|
+ $out .= '<option class="opacitymedium" value="-1">'.$langs->trans("NoBankAccountFound").'</span>'; |
5163
|
5163
|
} |
5164
|
5164
|
} else { |
5165
|
5165
|
if (!empty($useempty) && !is_numeric($useempty)) { |
|
@@ -5172,22 +5172,22 @@ discard block |
|
|
block discarded – undo |
5172
|
5172
|
while ($i < $num) { |
5173
|
5173
|
$obj = $this->db->fetch_object($result); |
5174
|
5174
|
if ($selected == $obj->rowid || ($useempty == 2 && $num == 1 && empty($selected))) { |
5175
|
|
- $out .= '<option value="' . $obj->rowid . '" data-currency-code="' . $obj->currency_code . '" selected>'; |
|
5175
|
+ $out .= '<option value="'.$obj->rowid.'" data-currency-code="'.$obj->currency_code.'" selected>'; |
5176
|
5176
|
} else { |
5177
|
|
- $out .= '<option value="' . $obj->rowid . '" data-currency-code="' . $obj->currency_code . '">'; |
|
5177
|
+ $out .= '<option value="'.$obj->rowid.'" data-currency-code="'.$obj->currency_code.'">'; |
5178
|
5178
|
} |
5179
|
5179
|
$out .= trim($obj->label); |
5180
|
5180
|
if ($showcurrency) { |
5181
|
|
- $out .= ' (' . $obj->currency_code . ')'; |
|
5181
|
+ $out .= ' ('.$obj->currency_code.')'; |
5182
|
5182
|
} |
5183
|
5183
|
if ($status == 2 && $obj->status == 1) { |
5184
|
|
- $out .= ' (' . $langs->trans("Closed") . ')'; |
|
5184
|
+ $out .= ' ('.$langs->trans("Closed").')'; |
5185
|
5185
|
} |
5186
|
5186
|
$out .= '</option>'; |
5187
|
5187
|
$i++; |
5188
|
5188
|
} |
5189
|
5189
|
$out .= "</select>"; |
5190
|
|
- $out .= ajax_combobox('select' . $htmlname); |
|
5190
|
+ $out .= ajax_combobox('select'.$htmlname); |
5191
|
5191
|
} else { |
5192
|
5192
|
dol_print_error($this->db); |
5193
|
5193
|
} |
|
@@ -5221,23 +5221,23 @@ discard block |
|
|
block discarded – undo |
5221
|
5221
|
$num = 0; |
5222
|
5222
|
|
5223
|
5223
|
$sql = "SELECT rowid, name, fk_country, status, entity"; |
5224
|
|
- $sql .= " FROM " . $this->db->prefix() . "establishment"; |
|
5224
|
+ $sql .= " FROM ".$this->db->prefix()."establishment"; |
5225
|
5225
|
$sql .= " WHERE 1=1"; |
5226
|
5226
|
if ($status != 2) { |
5227
|
|
- $sql .= " AND status = " . (int) $status; |
|
5227
|
+ $sql .= " AND status = ".(int) $status; |
5228
|
5228
|
} |
5229
|
5229
|
if ($filtre) { // TODO Support USF |
5230
|
|
- $sql .= " AND " . $filtre; |
|
5230
|
+ $sql .= " AND ".$filtre; |
5231
|
5231
|
} |
5232
|
5232
|
$sql .= " ORDER BY name"; |
5233
|
5233
|
|
5234
|
|
- dol_syslog(get_class($this) . "::select_establishment", LOG_DEBUG); |
|
5234
|
+ dol_syslog(get_class($this)."::select_establishment", LOG_DEBUG); |
5235
|
5235
|
$result = $this->db->query($sql); |
5236
|
5236
|
if ($result) { |
5237
|
5237
|
$num = $this->db->num_rows($result); |
5238
|
5238
|
$i = 0; |
5239
|
5239
|
if ($num) { |
5240
|
|
- print '<select id="select' . $htmlname . '" class="flat selectestablishment" name="' . $htmlname . '"' . ($moreattrib ? ' ' . $moreattrib : '') . '>'; |
|
5240
|
+ print '<select id="select'.$htmlname.'" class="flat selectestablishment" name="'.$htmlname.'"'.($moreattrib ? ' '.$moreattrib : '').'>'; |
5241
|
5241
|
if ($useempty == 1 || ($useempty == 2 && $num > 1)) { |
5242
|
5242
|
print '<option value="-1"> </option>'; |
5243
|
5243
|
} |
|
@@ -5245,13 +5245,13 @@ discard block |
|
|
block discarded – undo |
5245
|
5245
|
while ($i < $num) { |
5246
|
5246
|
$obj = $this->db->fetch_object($result); |
5247
|
5247
|
if ($selected == $obj->rowid) { |
5248
|
|
- print '<option value="' . $obj->rowid . '" selected>'; |
|
5248
|
+ print '<option value="'.$obj->rowid.'" selected>'; |
5249
|
5249
|
} else { |
5250
|
|
- print '<option value="' . $obj->rowid . '">'; |
|
5250
|
+ print '<option value="'.$obj->rowid.'">'; |
5251
|
5251
|
} |
5252
|
5252
|
print trim($obj->name); |
5253
|
5253
|
if ($status == 2 && $obj->status == 1) { |
5254
|
|
- print ' (' . $langs->trans("Closed") . ')'; |
|
5254
|
+ print ' ('.$langs->trans("Closed").')'; |
5255
|
5255
|
} |
5256
|
5256
|
print '</option>'; |
5257
|
5257
|
$i++; |
|
@@ -5259,9 +5259,9 @@ discard block |
|
|
block discarded – undo |
5259
|
5259
|
print "</select>"; |
5260
|
5260
|
} else { |
5261
|
5261
|
if ($status == 0) { |
5262
|
|
- print '<span class="opacitymedium">' . $langs->trans("NoActiveEstablishmentDefined") . '</span>'; |
|
5262
|
+ print '<span class="opacitymedium">'.$langs->trans("NoActiveEstablishmentDefined").'</span>'; |
5263
|
5263
|
} else { |
5264
|
|
- print '<span class="opacitymedium">' . $langs->trans("NoEstablishmentFound") . '</span>'; |
|
5264
|
+ print '<span class="opacitymedium">'.$langs->trans("NoEstablishmentFound").'</span>'; |
5265
|
5265
|
} |
5266
|
5266
|
} |
5267
|
5267
|
|
|
@@ -5285,20 +5285,20 @@ discard block |
|
|
block discarded – undo |
5285
|
5285
|
{ |
5286
|
5286
|
global $langs; |
5287
|
5287
|
if ($htmlname != "none") { |
5288
|
|
- print '<form method="POST" action="' . $page . '">'; |
|
5288
|
+ print '<form method="POST" action="'.$page.'">'; |
5289
|
5289
|
print '<input type="hidden" name="action" value="setbankaccount">'; |
5290
|
|
- print '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
5290
|
+ print '<input type="hidden" name="token" value="'.newToken().'">'; |
5291
|
5291
|
print img_picto('', 'bank_account', 'class="pictofixedwidth"'); |
5292
|
5292
|
$nbaccountfound = $this->select_comptes($selected, $htmlname, 0, '', $addempty); |
5293
|
5293
|
if ($nbaccountfound > 0) { |
5294
|
|
- print '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">'; |
|
5294
|
+ print '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">'; |
5295
|
5295
|
} |
5296
|
5296
|
print '</form>'; |
5297
|
5297
|
} else { |
5298
|
5298
|
$langs->load('banks'); |
5299
|
5299
|
|
5300
|
5300
|
if ($selected) { |
5301
|
|
- require_once DOL_DOCUMENT_ROOT . '/compta/bank/class/account.class.php'; |
|
5301
|
+ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; |
5302
|
5302
|
$bankstatic = new Account($this->db); |
5303
|
5303
|
$result = $bankstatic->fetch($selected); |
5304
|
5304
|
if ($result) { |
|
@@ -5337,11 +5337,11 @@ discard block |
|
|
block discarded – undo |
5337
|
5337
|
global $conf, $langs; |
5338
|
5338
|
$langs->load("categories"); |
5339
|
5339
|
|
5340
|
|
- include_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; |
|
5340
|
+ include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; |
5341
|
5341
|
|
5342
|
5342
|
// For backward compatibility |
5343
|
5343
|
if (is_numeric($type)) { |
5344
|
|
- dol_syslog(__METHOD__ . ': using numeric value for parameter type is deprecated. Use string code instead.', LOG_WARNING); |
|
5344
|
+ dol_syslog(__METHOD__.': using numeric value for parameter type is deprecated. Use string code instead.', LOG_WARNING); |
5345
|
5345
|
} |
5346
|
5346
|
|
5347
|
5347
|
if ($type === Categorie::TYPE_BANK_LINE) { |
|
@@ -5349,8 +5349,8 @@ discard block |
|
|
block discarded – undo |
5349
|
5349
|
$cat = new Categorie($this->db); |
5350
|
5350
|
$cate_arbo = array(); |
5351
|
5351
|
$sql = "SELECT c.label, c.rowid"; |
5352
|
|
- $sql .= " FROM " . $this->db->prefix() . "categorie as c"; |
5353
|
|
- $sql .= " WHERE entity = " . $conf->entity . " AND type = " . ((int) $cat->getMapId()[$type]); |
|
5352
|
+ $sql .= " FROM ".$this->db->prefix()."categorie as c"; |
|
5353
|
+ $sql .= " WHERE entity = ".$conf->entity." AND type = ".((int) $cat->getMapId()[$type]); |
5354
|
5354
|
$sql .= " ORDER BY c.label"; |
5355
|
5355
|
$result = $this->db->query($sql); |
5356
|
5356
|
if ($result) { |
|
@@ -5376,12 +5376,12 @@ discard block |
|
|
block discarded – undo |
5376
|
5376
|
$outarrayrichhtml = array(); |
5377
|
5377
|
|
5378
|
5378
|
|
5379
|
|
- $output = '<select class="flat minwidth100' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">'; |
|
5379
|
+ $output = '<select class="flat minwidth100'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">'; |
5380
|
5380
|
if (is_array($cate_arbo)) { |
5381
|
5381
|
$num = count($cate_arbo); |
5382
|
5382
|
|
5383
|
5383
|
if (!$num) { |
5384
|
|
- $output .= '<option value="-1" disabled>' . $langs->trans("NoCategoriesDefined") . '</option>'; |
|
5384
|
+ $output .= '<option value="-1" disabled>'.$langs->trans("NoCategoriesDefined").'</option>'; |
5385
|
5385
|
} else { |
5386
|
5386
|
if ($useempty == 1 || ($useempty == 2 && $num > 1)) { |
5387
|
5387
|
$output .= '<option value="-1"> </option>'; |
|
@@ -5393,15 +5393,15 @@ discard block |
|
|
block discarded – undo |
5393
|
5393
|
$add = ''; |
5394
|
5394
|
} |
5395
|
5395
|
|
5396
|
|
- $labeltoshow = img_picto('', 'category', 'class="pictofixedwidth" style="color: #' . $cate_arbo[$key]['color'] . '"'); |
|
5396
|
+ $labeltoshow = img_picto('', 'category', 'class="pictofixedwidth" style="color: #'.$cate_arbo[$key]['color'].'"'); |
5397
|
5397
|
$labeltoshow .= dol_trunc($cate_arbo[$key]['fulllabel'], $maxlength, 'middle'); |
5398
|
5398
|
|
5399
|
5399
|
$outarray[$cate_arbo[$key]['id']] = $cate_arbo[$key]['fulllabel']; |
5400
|
5400
|
|
5401
|
5401
|
$outarrayrichhtml[$cate_arbo[$key]['id']] = $labeltoshow; |
5402
|
5402
|
|
5403
|
|
- $output .= '<option ' . $add . 'value="' . $cate_arbo[$key]['id'] . '"'; |
5404
|
|
- $output .= ' data-html="' . dol_escape_htmltag($labeltoshow) . '"'; |
|
5403
|
+ $output .= '<option '.$add.'value="'.$cate_arbo[$key]['id'].'"'; |
|
5404
|
+ $output .= ' data-html="'.dol_escape_htmltag($labeltoshow).'"'; |
5405
|
5405
|
$output .= '>'; |
5406
|
5406
|
$output .= dol_trunc($cate_arbo[$key]['fulllabel'], $maxlength, 'middle'); |
5407
|
5407
|
$output .= '</option>'; |
|
@@ -5447,7 +5447,7 @@ discard block |
|
|
block discarded – undo |
5447
|
5447
|
public function form_confirm($page, $title, $question, $action, $formquestion = array(), $selectedchoice = "", $useajax = 0, $height = 170, $width = 500) |
5448
|
5448
|
{ |
5449
|
5449
|
// phpcs:enable |
5450
|
|
- dol_syslog(__METHOD__ . ': using form_confirm is deprecated. Use formconfim instead.', LOG_WARNING); |
|
5450
|
+ dol_syslog(__METHOD__.': using form_confirm is deprecated. Use formconfim instead.', LOG_WARNING); |
5451
|
5451
|
print $this->formconfirm($page, $title, $question, $action, $formquestion, $selectedchoice, $useajax, $height, $width); |
5452
|
5452
|
} |
5453
|
5453
|
|
|
@@ -5482,7 +5482,7 @@ discard block |
|
|
block discarded – undo |
5482
|
5482
|
{ |
5483
|
5483
|
global $langs, $conf; |
5484
|
5484
|
|
5485
|
|
- $more = '<!-- formconfirm - before call, page=' . dol_escape_htmltag($page) . ' -->'; |
|
5485
|
+ $more = '<!-- formconfirm - before call, page='.dol_escape_htmltag($page).' -->'; |
5486
|
5486
|
$formconfirm = ''; |
5487
|
5487
|
$inputok = array(); |
5488
|
5488
|
$inputko = array(); |
|
@@ -5506,27 +5506,27 @@ discard block |
|
|
block discarded – undo |
5506
|
5506
|
foreach ($formquestion as $key => $input) { |
5507
|
5507
|
if (is_array($input) && !empty($input)) { |
5508
|
5508
|
if ($input['type'] == 'hidden') { |
5509
|
|
- $moreattr = (!empty($input['moreattr']) ? ' ' . $input['moreattr'] : ''); |
5510
|
|
- $morecss = (!empty($input['morecss']) ? ' ' . $input['morecss'] : ''); |
|
5509
|
+ $moreattr = (!empty($input['moreattr']) ? ' '.$input['moreattr'] : ''); |
|
5510
|
+ $morecss = (!empty($input['morecss']) ? ' '.$input['morecss'] : ''); |
5511
|
5511
|
|
5512
|
|
- $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"; |
|
5512
|
+ $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"; |
5513
|
5513
|
} |
5514
|
5514
|
} |
5515
|
5515
|
} |
5516
|
5516
|
|
5517
|
5517
|
// Now add questions |
5518
|
5518
|
$moreonecolumn = ''; |
5519
|
|
- $more .= '<div class="tagtable paddingtopbottomonly centpercent noborderspacing">' . "\n"; |
|
5519
|
+ $more .= '<div class="tagtable paddingtopbottomonly centpercent noborderspacing">'."\n"; |
5520
|
5520
|
foreach ($formquestion as $key => $input) { |
5521
|
5521
|
if (is_array($input) && !empty($input)) { |
5522
|
|
- $size = (!empty($input['size']) ? ' size="' . $input['size'] . '"' : ''); // deprecated. Use morecss instead. |
5523
|
|
- $moreattr = (!empty($input['moreattr']) ? ' ' . $input['moreattr'] : ''); |
5524
|
|
- $morecss = (!empty($input['morecss']) ? ' ' . $input['morecss'] : ''); |
|
5522
|
+ $size = (!empty($input['size']) ? ' size="'.$input['size'].'"' : ''); // deprecated. Use morecss instead. |
|
5523
|
+ $moreattr = (!empty($input['moreattr']) ? ' '.$input['moreattr'] : ''); |
|
5524
|
+ $morecss = (!empty($input['morecss']) ? ' '.$input['morecss'] : ''); |
5525
|
5525
|
|
5526
|
5526
|
if ($input['type'] == 'text') { |
5527
|
|
- $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"; |
|
5527
|
+ $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"; |
5528
|
5528
|
} elseif ($input['type'] == 'password') { |
5529
|
|
- $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"; |
|
5529
|
+ $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"; |
5530
|
5530
|
} elseif ($input['type'] == 'textarea') { |
5531
|
5531
|
/*$more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">'.$input['label'].'</div><div class="tagtd">'; |
5532
|
5532
|
$more .= '<textarea name="'.$input['name'].'" class="'.$morecss.'"'.$moreattr.'>'; |
|
@@ -5534,8 +5534,8 @@ discard block |
|
|
block discarded – undo |
5534
|
5534
|
$more .= '</textarea>'; |
5535
|
5535
|
$more .= '</div></div>'."\n";*/ |
5536
|
5536
|
$moreonecolumn .= '<div class="margintoponly">'; |
5537
|
|
- $moreonecolumn .= $input['label'] . '<br>'; |
5538
|
|
- $moreonecolumn .= '<textarea name="' . dol_escape_htmltag($input['name']) . '" id="' . dol_escape_htmltag($input['name']) . '" class="' . $morecss . '"' . $moreattr . '>'; |
|
5537
|
+ $moreonecolumn .= $input['label'].'<br>'; |
|
5538
|
+ $moreonecolumn .= '<textarea name="'.dol_escape_htmltag($input['name']).'" id="'.dol_escape_htmltag($input['name']).'" class="'.$morecss.'"'.$moreattr.'>'; |
5539
|
5539
|
$moreonecolumn .= $input['value']; |
5540
|
5540
|
$moreonecolumn .= '</textarea>'; |
5541
|
5541
|
$moreonecolumn .= '</div>'; |
|
@@ -5552,20 +5552,20 @@ discard block |
|
|
block discarded – undo |
5552
|
5552
|
$disabled = isset($input['select_disabled']) ? $input['select_disabled'] : 0; |
5553
|
5553
|
$sort = isset($input['select_sort']) ? $input['select_sort'] : ''; |
5554
|
5554
|
|
5555
|
|
- $more .= '<div class="tagtr"><div class="tagtd' . (empty($input['tdclass']) ? '' : (' ' . $input['tdclass'])) . '">'; |
|
5555
|
+ $more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">'; |
5556
|
5556
|
if (!empty($input['label'])) { |
5557
|
|
- $more .= $input['label'] . '</div><div class="tagtd left">'; |
|
5557
|
+ $more .= $input['label'].'</div><div class="tagtd left">'; |
5558
|
5558
|
} |
5559
|
5559
|
if ($input['type'] == 'select') { |
5560
|
5560
|
$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); |
5561
|
5561
|
} else { |
5562
|
5562
|
$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); |
5563
|
5563
|
} |
5564
|
|
- $more .= '</div></div>' . "\n"; |
|
5564
|
+ $more .= '</div></div>'."\n"; |
5565
|
5565
|
} elseif ($input['type'] == 'checkbox') { |
5566
|
5566
|
$more .= '<div class="tagtr">'; |
5567
|
|
- $more .= '<div class="tagtd' . (empty($input['tdclass']) ? '' : (' ' . $input['tdclass'])) . '"><label for="' . dol_escape_htmltag($input['name']) . '">' . $input['label'] . '</label></div><div class="tagtd">'; |
5568
|
|
- $more .= '<input type="checkbox" class="flat' . ($morecss ? ' ' . $morecss : '') . '" id="' . dol_escape_htmltag($input['name']) . '" name="' . dol_escape_htmltag($input['name']) . '"' . $moreattr; |
|
5567
|
+ $more .= '<div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'"><label for="'.dol_escape_htmltag($input['name']).'">'.$input['label'].'</label></div><div class="tagtd">'; |
|
5568
|
+ $more .= '<input type="checkbox" class="flat'.($morecss ? ' '.$morecss : '').'" id="'.dol_escape_htmltag($input['name']).'" name="'.dol_escape_htmltag($input['name']).'"'.$moreattr; |
5569
|
5569
|
if (!is_bool($input['value']) && $input['value'] != 'false' && $input['value'] != '0' && $input['value'] != '') { |
5570
|
5570
|
$more .= ' checked'; |
5571
|
5571
|
} |
|
@@ -5576,19 +5576,19 @@ discard block |
|
|
block discarded – undo |
5576
|
5576
|
$more .= ' disabled'; |
5577
|
5577
|
} |
5578
|
5578
|
$more .= ' /></div>'; |
5579
|
|
- $more .= '</div>' . "\n"; |
|
5579
|
+ $more .= '</div>'."\n"; |
5580
|
5580
|
} elseif ($input['type'] == 'radio') { |
5581
|
5581
|
$i = 0; |
5582
|
5582
|
foreach ($input['values'] as $selkey => $selval) { |
5583
|
5583
|
$more .= '<div class="tagtr">'; |
5584
|
5584
|
if (isset($input['label'])) { |
5585
|
5585
|
if ($i == 0) { |
5586
|
|
- $more .= '<div class="tagtd' . (empty($input['tdclass']) ? ' tdtop' : (' tdtop ' . $input['tdclass'])) . '">' . $input['label'] . '</div>'; |
|
5586
|
+ $more .= '<div class="tagtd'.(empty($input['tdclass']) ? ' tdtop' : (' tdtop '.$input['tdclass'])).'">'.$input['label'].'</div>'; |
5587
|
5587
|
} else { |
5588
|
|
- $more .= '<div class="tagtd' . (empty($input['tdclass']) ? '' : (' "' . $input['tdclass'])) . '"> </div>'; |
|
5588
|
+ $more .= '<div class="tagtd'.(empty($input['tdclass']) ? '' : (' "'.$input['tdclass'])).'"> </div>'; |
5589
|
5589
|
} |
5590
|
5590
|
} |
5591
|
|
- $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; |
|
5591
|
+ $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; |
5592
|
5592
|
if (!empty($input['disabled'])) { |
5593
|
5593
|
$more .= ' disabled'; |
5594
|
5594
|
} |
|
@@ -5596,12 +5596,12 @@ discard block |
|
|
block discarded – undo |
5596
|
5596
|
$more .= ' checked="checked"'; |
5597
|
5597
|
} |
5598
|
5598
|
$more .= ' /> '; |
5599
|
|
- $more .= '<label for="' . dol_escape_htmltag($input['name'] . $selkey) . '" class="valignmiddle">' . $selval . '</label>'; |
5600
|
|
- $more .= '</div></div>' . "\n"; |
|
5599
|
+ $more .= '<label for="'.dol_escape_htmltag($input['name'].$selkey).'" class="valignmiddle">'.$selval.'</label>'; |
|
5600
|
+ $more .= '</div></div>'."\n"; |
5601
|
5601
|
$i++; |
5602
|
5602
|
} |
5603
|
5603
|
} elseif ($input['type'] == 'date' || $input['type'] == 'datetime') { |
5604
|
|
- $more .= '<div class="tagtr"><div class="tagtd' . (empty($input['tdclass']) ? '' : (' ' . $input['tdclass'])) . '">' . $input['label'] . '</div>'; |
|
5604
|
+ $more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">'.$input['label'].'</div>'; |
5605
|
5605
|
$more .= '<div class="tagtd">'; |
5606
|
5606
|
$addnowlink = (empty($input['datenow']) ? 0 : 1); |
5607
|
5607
|
$h = $m = 0; |
|
@@ -5619,24 +5619,24 @@ discard block |
|
|
block discarded – undo |
5619
|
5619
|
} elseif ($input['type'] == 'other') { // can be 1 column or 2 depending if label is set or not |
5620
|
5620
|
$more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">'; |
5621
|
5621
|
if (!empty($input['label'])) { |
5622
|
|
- $more .= $input['label'] . '</div><div class="tagtd">'; |
|
5622
|
+ $more .= $input['label'].'</div><div class="tagtd">'; |
5623
|
5623
|
} |
5624
|
5624
|
$more .= $input['value']; |
5625
|
|
- $more .= '</div></div>' . "\n"; |
|
5625
|
+ $more .= '</div></div>'."\n"; |
5626
|
5626
|
} elseif ($input['type'] == 'onecolumn') { |
5627
|
5627
|
$moreonecolumn .= '<div class="margintoponly">'; |
5628
|
5628
|
$moreonecolumn .= $input['value']; |
5629
|
|
- $moreonecolumn .= '</div>' . "\n"; |
|
5629
|
+ $moreonecolumn .= '</div>'."\n"; |
5630
|
5630
|
} elseif ($input['type'] == 'hidden') { |
5631
|
5631
|
// Do nothing more, already added by a previous loop |
5632
|
5632
|
} elseif ($input['type'] == 'separator') { |
5633
|
5633
|
$more .= '<br>'; |
5634
|
5634
|
} else { |
5635
|
|
- $more .= 'Error type ' . $input['type'] . ' for the confirm box is not a supported type'; |
|
5635
|
+ $more .= 'Error type '.$input['type'].' for the confirm box is not a supported type'; |
5636
|
5636
|
} |
5637
|
5637
|
} |
5638
|
5638
|
} |
5639
|
|
- $more .= '</div>' . "\n"; |
|
5639
|
+ $more .= '</div>'."\n"; |
5640
|
5640
|
$more .= $moreonecolumn; |
5641
|
5641
|
} |
5642
|
5642
|
|
|
@@ -5658,10 +5658,10 @@ discard block |
|
|
block discarded – undo |
5658
|
5658
|
$button = $useajax; |
5659
|
5659
|
$useajax = 1; |
5660
|
5660
|
$autoOpen = false; |
5661
|
|
- $dialogconfirm .= '-' . $button; |
|
5661
|
+ $dialogconfirm .= '-'.$button; |
5662
|
5662
|
} |
5663
|
|
- $pageyes = $page . (preg_match('/\?/', $page) ? '&' : '?') . 'action=' . urlencode($action) . '&confirm=yes'; |
5664
|
|
- $pageno = ($useajax == 2 ? $page . (preg_match('/\?/', $page) ? '&' : '?') . 'action=' . urlencode($action) . '&confirm=no' : ''); |
|
5663
|
+ $pageyes = $page.(preg_match('/\?/', $page) ? '&' : '?').'action='.urlencode($action).'&confirm=yes'; |
|
5664
|
+ $pageno = ($useajax == 2 ? $page.(preg_match('/\?/', $page) ? '&' : '?').'action='.urlencode($action).'&confirm=no' : ''); |
5665
|
5665
|
|
5666
|
5666
|
// Add input fields into list of fields to read during submit (inputok and inputko) |
5667
|
5667
|
if (is_array($formquestion)) { |
|
@@ -5684,24 +5684,24 @@ discard block |
|
|
block discarded – undo |
5684
|
5684
|
} |
5685
|
5685
|
|
5686
|
5686
|
// Show JQuery confirm box. |
5687
|
|
- $formconfirm .= '<div id="' . $dialogconfirm . '" title="' . dol_escape_htmltag($title) . '" style="display: none;">'; |
|
5687
|
+ $formconfirm .= '<div id="'.$dialogconfirm.'" title="'.dol_escape_htmltag($title).'" style="display: none;">'; |
5688
|
5688
|
if (is_array($formquestion) && array_key_exists('text', $formquestion) && !empty($formquestion['text'])) { |
5689
|
|
- $formconfirm .= '<div class="confirmtext">' . $formquestion['text'] . '</div>' . "\n"; |
|
5689
|
+ $formconfirm .= '<div class="confirmtext">'.$formquestion['text'].'</div>'."\n"; |
5690
|
5690
|
} |
5691
|
5691
|
if (!empty($more)) { |
5692
|
|
- $formconfirm .= '<div class="confirmquestions">' . $more . '</div>' . "\n"; |
|
5692
|
+ $formconfirm .= '<div class="confirmquestions">'.$more.'</div>'."\n"; |
5693
|
5693
|
} |
5694
|
|
- $formconfirm .= ($question ? '<div class="confirmmessage">' . img_help(0, '') . ' ' . $question . '</div>' : ''); |
5695
|
|
- $formconfirm .= '</div>' . "\n"; |
|
5694
|
+ $formconfirm .= ($question ? '<div class="confirmmessage">'.img_help(0, '').' '.$question.'</div>' : ''); |
|
5695
|
+ $formconfirm .= '</div>'."\n"; |
5696
|
5696
|
|
5697
|
|
- $formconfirm .= "\n<!-- begin code of popup for formconfirm page=" . $page . " -->\n"; |
5698
|
|
- $formconfirm .= '<script nonce="' . getNonce() . '" type="text/javascript">' . "\n"; |
|
5697
|
+ $formconfirm .= "\n<!-- begin code of popup for formconfirm page=".$page." -->\n"; |
|
5698
|
+ $formconfirm .= '<script nonce="'.getNonce().'" type="text/javascript">'."\n"; |
5699
|
5699
|
$formconfirm .= "/* Code for the jQuery('#dialogforpopup').dialog() */\n"; |
5700
|
5700
|
$formconfirm .= 'jQuery(document).ready(function() { |
5701
|
5701
|
$(function() { |
5702
|
|
- $( "#' . $dialogconfirm . '" ).dialog( |
|
5702
|
+ $( "#' . $dialogconfirm.'" ).dialog( |
5703
|
5703
|
{ |
5704
|
|
- autoOpen: ' . ($autoOpen ? "true" : "false") . ','; |
|
5704
|
+ autoOpen: ' . ($autoOpen ? "true" : "false").','; |
5705
|
5705
|
if ($newselectedchoice == 'no') { |
5706
|
5706
|
$formconfirm .= ' |
5707
|
5707
|
open: function() { |
|
@@ -5711,24 +5711,24 @@ discard block |
|
|
block discarded – undo |
5711
|
5711
|
|
5712
|
5712
|
$jsforcursor = ''; |
5713
|
5713
|
if ($useajax == 1) { |
5714
|
|
- $jsforcursor = '// The call to urljump can be slow, so we set the wait cursor' . "\n"; |
5715
|
|
- $jsforcursor .= 'jQuery("html,body,#id-container").addClass("cursorwait");' . "\n"; |
|
5714
|
+ $jsforcursor = '// The call to urljump can be slow, so we set the wait cursor'."\n"; |
|
5715
|
+ $jsforcursor .= 'jQuery("html,body,#id-container").addClass("cursorwait");'."\n"; |
5716
|
5716
|
} |
5717
|
5717
|
|
5718
|
5718
|
$postconfirmas = 'GET'; |
5719
|
5719
|
|
5720
|
5720
|
$formconfirm .= ' |
5721
|
5721
|
resizable: false, |
5722
|
|
- height: "' . $height . '", |
5723
|
|
- width: "' . $width . '", |
|
5722
|
+ height: "' . $height.'", |
|
5723
|
+ width: "' . $width.'", |
5724
|
5724
|
modal: true, |
5725
|
5725
|
closeOnEscape: false, |
5726
|
5726
|
buttons: { |
5727
|
|
- "' . dol_escape_js($langs->transnoentities($labelbuttonyes)) . '": function() { |
5728
|
|
- var options = "token=' . urlencode(newToken()) . '"; |
5729
|
|
- var inputok = ' . json_encode($inputok) . '; /* List of fields into form */ |
5730
|
|
- var page = "' . dol_escape_js(!empty($page) ? $page : '') . '"; |
5731
|
|
- var pageyes = "' . dol_escape_js(!empty($pageyes) ? $pageyes : '') . '"; |
|
5727
|
+ "' . dol_escape_js($langs->transnoentities($labelbuttonyes)).'": function() { |
|
5728
|
+ var options = "token=' . urlencode(newToken()).'"; |
|
5729
|
+ var inputok = ' . json_encode($inputok).'; /* List of fields into form */ |
|
5730
|
+ var page = "' . dol_escape_js(!empty($page) ? $page : '').'"; |
|
5731
|
+ var pageyes = "' . dol_escape_js(!empty($pageyes) ? $pageyes : '').'"; |
5732
|
5732
|
|
5733
|
5733
|
if (inputok.length > 0) { |
5734
|
5734
|
$.each(inputok, function(i, inputname) { |
|
@@ -5762,11 +5762,11 @@ discard block |
|
|
block discarded – undo |
5762
|
5762
|
} |
5763
|
5763
|
$(this).dialog("close"); |
5764
|
5764
|
}, |
5765
|
|
- "' . dol_escape_js($langs->transnoentities($labelbuttonno)) . '": function() { |
5766
|
|
- var options = "token=' . urlencode(newToken()) . '"; |
5767
|
|
- var inputko = ' . json_encode($inputko) . '; /* List of fields into form */ |
5768
|
|
- var page = "' . dol_escape_js(!empty($page) ? $page : '') . '"; |
5769
|
|
- var pageno="' . dol_escape_js(!empty($pageno) ? $pageno : '') . '"; |
|
5765
|
+ "' . dol_escape_js($langs->transnoentities($labelbuttonno)).'": function() { |
|
5766
|
+ var options = "token=' . urlencode(newToken()).'"; |
|
5767
|
+ var inputko = ' . json_encode($inputko).'; /* List of fields into form */ |
|
5768
|
+ var page = "' . dol_escape_js(!empty($page) ? $page : '').'"; |
|
5769
|
+ var pageno="' . dol_escape_js(!empty($pageno) ? $pageno : '').'"; |
5770
|
5770
|
if (inputko.length > 0) { |
5771
|
5771
|
$.each(inputko, function(i, inputname) { |
5772
|
5772
|
var more = ""; |
|
@@ -5798,10 +5798,10 @@ discard block |
|
|
block discarded – undo |
5798
|
5798
|
} |
5799
|
5799
|
); |
5800
|
5800
|
|
5801
|
|
- var button = "' . $button . '"; |
|
5801
|
+ var button = "' . $button.'"; |
5802
|
5802
|
if (button.length > 0) { |
5803
|
5803
|
$( "#" + button ).click(function() { |
5804
|
|
- $("#' . $dialogconfirm . '").dialog("open"); |
|
5804
|
+ $("#' . $dialogconfirm.'").dialog("open"); |
5805
|
5805
|
}); |
5806
|
5806
|
} |
5807
|
5807
|
}); |
|
@@ -5809,44 +5809,44 @@ discard block |
|
|
block discarded – undo |
5809
|
5809
|
</script>'; |
5810
|
5810
|
$formconfirm .= "<!-- end ajax formconfirm -->\n"; |
5811
|
5811
|
} else { |
5812
|
|
- $formconfirm .= "\n<!-- begin formconfirm page=" . dol_escape_htmltag($page) . " -->\n"; |
|
5812
|
+ $formconfirm .= "\n<!-- begin formconfirm page=".dol_escape_htmltag($page)." -->\n"; |
5813
|
5813
|
|
5814
|
5814
|
if (empty($disableformtag)) { |
5815
|
|
- $formconfirm .= '<form method="POST" action="' . $page . '" class="notoptoleftnoright">' . "\n"; |
|
5815
|
+ $formconfirm .= '<form method="POST" action="'.$page.'" class="notoptoleftnoright">'."\n"; |
5816
|
5816
|
} |
5817
|
5817
|
|
5818
|
|
- $formconfirm .= '<input type="hidden" name="action" value="' . $action . '">' . "\n"; |
5819
|
|
- $formconfirm .= '<input type="hidden" name="token" value="' . newToken() . '">' . "\n"; |
|
5818
|
+ $formconfirm .= '<input type="hidden" name="action" value="'.$action.'">'."\n"; |
|
5819
|
+ $formconfirm .= '<input type="hidden" name="token" value="'.newToken().'">'."\n"; |
5820
|
5820
|
|
5821
|
|
- $formconfirm .= '<table class="valid centpercent">' . "\n"; |
|
5821
|
+ $formconfirm .= '<table class="valid centpercent">'."\n"; |
5822
|
5822
|
|
5823
|
5823
|
// Line title |
5824
|
5824
|
$formconfirm .= '<tr class="validtitre"><td class="validtitre" colspan="2">'; |
5825
|
|
- $formconfirm .= img_picto('', 'pictoconfirm') . ' ' . $title; |
5826
|
|
- $formconfirm .= '</td></tr>' . "\n"; |
|
5825
|
+ $formconfirm .= img_picto('', 'pictoconfirm').' '.$title; |
|
5826
|
+ $formconfirm .= '</td></tr>'."\n"; |
5827
|
5827
|
|
5828
|
5828
|
// Line text |
5829
|
5829
|
if (is_array($formquestion) && array_key_exists('text', $formquestion) && !empty($formquestion['text'])) { |
5830
|
|
- $formconfirm .= '<tr class="valid"><td class="valid" colspan="2">' . $formquestion['text'] . '</td></tr>' . "\n"; |
|
5830
|
+ $formconfirm .= '<tr class="valid"><td class="valid" colspan="2">'.$formquestion['text'].'</td></tr>'."\n"; |
5831
|
5831
|
} |
5832
|
5832
|
|
5833
|
5833
|
// Line form fields |
5834
|
5834
|
if ($more) { |
5835
|
|
- $formconfirm .= '<tr class="valid"><td class="valid" colspan="2">' . "\n"; |
|
5835
|
+ $formconfirm .= '<tr class="valid"><td class="valid" colspan="2">'."\n"; |
5836
|
5836
|
$formconfirm .= $more; |
5837
|
|
- $formconfirm .= '</td></tr>' . "\n"; |
|
5837
|
+ $formconfirm .= '</td></tr>'."\n"; |
5838
|
5838
|
} |
5839
|
5839
|
|
5840
|
5840
|
// Line with question |
5841
|
5841
|
$formconfirm .= '<tr class="valid">'; |
5842
|
|
- $formconfirm .= '<td class="valid">' . $question . '</td>'; |
|
5842
|
+ $formconfirm .= '<td class="valid">'.$question.'</td>'; |
5843
|
5843
|
$formconfirm .= '<td class="valid center">'; |
5844
|
5844
|
$formconfirm .= $this->selectyesno("confirm", $newselectedchoice, 0, false, 0, 0, 'marginleftonly marginrightonly', $labelbuttonyes, $labelbuttonno); |
5845
|
|
- $formconfirm .= '<input class="button valignmiddle confirmvalidatebutton small" type="submit" value="' . $langs->trans("Validate") . '">'; |
|
5845
|
+ $formconfirm .= '<input class="button valignmiddle confirmvalidatebutton small" type="submit" value="'.$langs->trans("Validate").'">'; |
5846
|
5846
|
$formconfirm .= '</td>'; |
5847
|
|
- $formconfirm .= '</tr>' . "\n"; |
|
5847
|
+ $formconfirm .= '</tr>'."\n"; |
5848
|
5848
|
|
5849
|
|
- $formconfirm .= '</table>' . "\n"; |
|
5849
|
+ $formconfirm .= '</table>'."\n"; |
5850
|
5850
|
|
5851
|
5851
|
if (empty($disableformtag)) { |
5852
|
5852
|
$formconfirm .= "</form>\n"; |
|
@@ -5855,7 +5855,7 @@ discard block |
|
|
block discarded – undo |
5855
|
5855
|
|
5856
|
5856
|
if (!empty($conf->use_javascript_ajax)) { |
5857
|
5857
|
$formconfirm .= '<!-- code to disable button to avoid double clic -->'; |
5858
|
|
- $formconfirm .= '<script nonce="' . getNonce() . '" type="text/javascript">' . "\n"; |
|
5858
|
+ $formconfirm .= '<script nonce="'.getNonce().'" type="text/javascript">'."\n"; |
5859
|
5859
|
$formconfirm .= ' |
5860
|
5860
|
$(document).ready(function () { |
5861
|
5861
|
$(".confirmvalidatebutton").on("click", function() { |
|
@@ -5867,7 +5867,7 @@ discard block |
|
|
block discarded – undo |
5867
|
5867
|
}); |
5868
|
5868
|
}); |
5869
|
5869
|
'; |
5870
|
|
- $formconfirm .= '</script>' . "\n"; |
|
5870
|
+ $formconfirm .= '</script>'."\n"; |
5871
|
5871
|
} |
5872
|
5872
|
|
5873
|
5873
|
$formconfirm .= "<!-- end formconfirm -->\n"; |
|
@@ -5899,8 +5899,8 @@ discard block |
|
|
block discarded – undo |
5899
|
5899
|
// phpcs:enable |
5900
|
5900
|
global $langs; |
5901
|
5901
|
|
5902
|
|
- require_once DOL_DOCUMENT_ROOT . '/core/lib/project.lib.php'; |
5903
|
|
- require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php'; |
|
5902
|
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php'; |
|
5903
|
+ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; |
5904
|
5904
|
|
5905
|
5905
|
$out = ''; |
5906
|
5906
|
|
|
@@ -5908,11 +5908,11 @@ discard block |
|
|
block discarded – undo |
5908
|
5908
|
|
5909
|
5909
|
$langs->load("project"); |
5910
|
5910
|
if ($htmlname != "none") { |
5911
|
|
- $out .= '<form method="post" action="' . $page . '">'; |
|
5911
|
+ $out .= '<form method="post" action="'.$page.'">'; |
5912
|
5912
|
$out .= '<input type="hidden" name="action" value="classin">'; |
5913
|
|
- $out .= '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
5913
|
+ $out .= '<input type="hidden" name="token" value="'.newToken().'">'; |
5914
|
5914
|
$out .= $formproject->select_projects($socid, $selected, $htmlname, $maxlength, 0, 1, $discard_closed, $forcefocus, 0, 0, '', 1, 0, $morecss); |
5915
|
|
- $out .= '<input type="submit" class="button smallpaddingimp" value="' . $langs->trans("Modify") . '">'; |
|
5915
|
+ $out .= '<input type="submit" class="button smallpaddingimp" value="'.$langs->trans("Modify").'">'; |
5916
|
5916
|
$out .= '</form>'; |
5917
|
5917
|
} else { |
5918
|
5918
|
$out .= '<span class="project_head_block">'; |
|
@@ -5921,7 +5921,7 @@ discard block |
|
|
block discarded – undo |
5921
|
5921
|
$projet->fetch($selected); |
5922
|
5922
|
$out .= $projet->getNomUrl(0, '', 1); |
5923
|
5923
|
} else { |
5924
|
|
- $out .= '<span class="opacitymedium">' . $textifnoproject . '</span>'; |
|
5924
|
+ $out .= '<span class="opacitymedium">'.$textifnoproject.'</span>'; |
5925
|
5925
|
} |
5926
|
5926
|
$out .= '</span>'; |
5927
|
5927
|
} |
|
@@ -5958,14 +5958,14 @@ discard block |
|
|
block discarded – undo |
5958
|
5958
|
$out = ''; |
5959
|
5959
|
|
5960
|
5960
|
if ($htmlname != "none") { |
5961
|
|
- $out .= '<form method="POST" action="' . $page . '">'; |
|
5961
|
+ $out .= '<form method="POST" action="'.$page.'">'; |
5962
|
5962
|
$out .= '<input type="hidden" name="action" value="setconditions">'; |
5963
|
|
- $out .= '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
5963
|
+ $out .= '<input type="hidden" name="token" value="'.newToken().'">'; |
5964
|
5964
|
if ($type) { |
5965
|
|
- $out .= '<input type="hidden" name="type" value="' . dol_escape_htmltag($type) . '">'; |
|
5965
|
+ $out .= '<input type="hidden" name="type" value="'.dol_escape_htmltag($type).'">'; |
5966
|
5966
|
} |
5967
|
5967
|
$out .= $this->getSelectConditionsPaiements($selected, $htmlname, $filtertype, $addempty, 0, '', $deposit_percent); |
5968
|
|
- $out .= '<input type="submit" class="button valignmiddle smallpaddingimp" value="' . $langs->trans("Modify") . '">'; |
|
5968
|
+ $out .= '<input type="submit" class="button valignmiddle smallpaddingimp" value="'.$langs->trans("Modify").'">'; |
5969
|
5969
|
$out .= '</form>'; |
5970
|
5970
|
} else { |
5971
|
5971
|
if ($selected) { |
|
@@ -6010,12 +6010,12 @@ discard block |
|
|
block discarded – undo |
6010
|
6010
|
// phpcs:enable |
6011
|
6011
|
global $langs; |
6012
|
6012
|
if ($htmlname != "none") { |
6013
|
|
- print '<form method="post" action="' . $page . '">'; |
|
6013
|
+ print '<form method="post" action="'.$page.'">'; |
6014
|
6014
|
print '<input type="hidden" name="action" value="setavailability">'; |
6015
|
|
- print '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
6015
|
+ print '<input type="hidden" name="token" value="'.newToken().'">'; |
6016
|
6016
|
$this->selectAvailabilityDelay($selected, $htmlname, '', $addempty); |
6017
|
|
- print '<input type="submit" name="modify" class="button smallpaddingimp" value="' . $langs->trans("Modify") . '">'; |
6018
|
|
- print '<input type="submit" name="cancel" class="button smallpaddingimp" value="' . $langs->trans("Cancel") . '">'; |
|
6017
|
+ print '<input type="submit" name="modify" class="button smallpaddingimp" value="'.$langs->trans("Modify").'">'; |
|
6018
|
+ print '<input type="submit" name="cancel" class="button smallpaddingimp" value="'.$langs->trans("Cancel").'">'; |
6019
|
6019
|
print '</form>'; |
6020
|
6020
|
} else { |
6021
|
6021
|
if ($selected) { |
|
@@ -6041,11 +6041,11 @@ discard block |
|
|
block discarded – undo |
6041
|
6041
|
{ |
6042
|
6042
|
global $langs; |
6043
|
6043
|
if ($htmlname != "none") { |
6044
|
|
- print '<form method="post" action="' . $page . '">'; |
|
6044
|
+ print '<form method="post" action="'.$page.'">'; |
6045
|
6045
|
print '<input type="hidden" name="action" value="setdemandreason">'; |
6046
|
|
- print '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
6046
|
+ print '<input type="hidden" name="token" value="'.newToken().'">'; |
6047
|
6047
|
$this->selectInputReason($selected, $htmlname, '-1', $addempty); |
6048
|
|
- print '<input type="submit" class="button smallpaddingimp" value="' . $langs->trans("Modify") . '">'; |
|
6048
|
+ print '<input type="submit" class="button smallpaddingimp" value="'.$langs->trans("Modify").'">'; |
6049
|
6049
|
print '</form>'; |
6050
|
6050
|
} else { |
6051
|
6051
|
if ($selected) { |
|
@@ -6085,17 +6085,17 @@ discard block |
|
|
block discarded – undo |
6085
|
6085
|
$ret = ''; |
6086
|
6086
|
|
6087
|
6087
|
if ($htmlname != "none") { |
6088
|
|
- $ret .= '<form method="POST" action="' . $page . '" name="form' . $htmlname . '">'; |
6089
|
|
- $ret .= '<input type="hidden" name="action" value="set' . $htmlname . '">'; |
6090
|
|
- $ret .= '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
6088
|
+ $ret .= '<form method="POST" action="'.$page.'" name="form'.$htmlname.'">'; |
|
6089
|
+ $ret .= '<input type="hidden" name="action" value="set'.$htmlname.'">'; |
|
6090
|
+ $ret .= '<input type="hidden" name="token" value="'.newToken().'">'; |
6091
|
6091
|
if ($type) { |
6092
|
|
- $ret .= '<input type="hidden" name="type" value="' . dol_escape_htmltag($type) . '">'; |
|
6092
|
+ $ret .= '<input type="hidden" name="type" value="'.dol_escape_htmltag($type).'">'; |
6093
|
6093
|
} |
6094
|
6094
|
$ret .= '<table class="nobordernopadding">'; |
6095
|
6095
|
$ret .= '<tr><td>'; |
6096
|
|
- $ret .= $this->selectDate($selected, $htmlname, $displayhour, $displaymin, 1, 'form' . $htmlname, 1, 0); |
|
6096
|
+ $ret .= $this->selectDate($selected, $htmlname, $displayhour, $displaymin, 1, 'form'.$htmlname, 1, 0); |
6097
|
6097
|
$ret .= '</td>'; |
6098
|
|
- $ret .= '<td class="left"><input type="submit" class="button smallpaddingimp" value="' . $langs->trans("Modify") . '"></td>'; |
|
6098
|
+ $ret .= '<td class="left"><input type="submit" class="button smallpaddingimp" value="'.$langs->trans("Modify").'"></td>'; |
6099
|
6099
|
$ret .= '</tr></table></form>'; |
6100
|
6100
|
} else { |
6101
|
6101
|
if ($displayhour) { |
|
@@ -6130,15 +6130,15 @@ discard block |
|
|
block discarded – undo |
6130
|
6130
|
global $langs; |
6131
|
6131
|
|
6132
|
6132
|
if ($htmlname != "none") { |
6133
|
|
- print '<form method="POST" action="' . $page . '" name="form' . $htmlname . '">'; |
6134
|
|
- print '<input type="hidden" name="action" value="set' . $htmlname . '">'; |
6135
|
|
- print '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
6133
|
+ print '<form method="POST" action="'.$page.'" name="form'.$htmlname.'">'; |
|
6134
|
+ print '<input type="hidden" name="action" value="set'.$htmlname.'">'; |
|
6135
|
+ print '<input type="hidden" name="token" value="'.newToken().'">'; |
6136
|
6136
|
print $this->select_dolusers($selected, $htmlname, 1, $exclude, 0, $include); |
6137
|
|
- print '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">'; |
|
6137
|
+ print '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">'; |
6138
|
6138
|
print '</form>'; |
6139
|
6139
|
} else { |
6140
|
6140
|
if ($selected) { |
6141
|
|
- require_once DOL_DOCUMENT_ROOT . '/user/class/user.class.php'; |
|
6141
|
+ require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; |
6142
|
6142
|
$theuser = new User($this->db); |
6143
|
6143
|
$theuser->fetch($selected); |
6144
|
6144
|
print $theuser->getNomUrl(1); |
|
@@ -6171,14 +6171,14 @@ discard block |
|
|
block discarded – undo |
6171
|
6171
|
|
6172
|
6172
|
$out = ''; |
6173
|
6173
|
if ($htmlname != "none") { |
6174
|
|
- $out .= '<form method="POST" action="' . $page . '">'; |
|
6174
|
+ $out .= '<form method="POST" action="'.$page.'">'; |
6175
|
6175
|
$out .= '<input type="hidden" name="action" value="setmode">'; |
6176
|
|
- $out .= '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
6176
|
+ $out .= '<input type="hidden" name="token" value="'.newToken().'">'; |
6177
|
6177
|
if ($type) { |
6178
|
|
- $out .= '<input type="hidden" name="type" value="' . dol_escape_htmltag($type) . '">'; |
|
6178
|
+ $out .= '<input type="hidden" name="type" value="'.dol_escape_htmltag($type).'">'; |
6179
|
6179
|
} |
6180
|
6180
|
$out .= $this->select_types_paiements($selected, $htmlname, $filtertype, 0, $addempty, 0, 0, $active, '', 1); |
6181
|
|
- $out .= '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">'; |
|
6181
|
+ $out .= '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">'; |
6182
|
6182
|
$out .= '</form>'; |
6183
|
6183
|
} else { |
6184
|
6184
|
if ($selected) { |
|
@@ -6211,11 +6211,11 @@ discard block |
|
|
block discarded – undo |
6211
|
6211
|
{ |
6212
|
6212
|
global $langs; |
6213
|
6213
|
if ($htmlname != "none") { |
6214
|
|
- print '<form method="POST" action="' . $page . '">'; |
|
6214
|
+ print '<form method="POST" action="'.$page.'">'; |
6215
|
6215
|
print '<input type="hidden" name="action" value="settransportmode">'; |
6216
|
|
- print '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
6216
|
+ print '<input type="hidden" name="token" value="'.newToken().'">'; |
6217
|
6217
|
$this->selectTransportMode($selected, $htmlname, 0, $addempty, 0, 0, $active); |
6218
|
|
- print '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">'; |
|
6218
|
+ print '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">'; |
6219
|
6219
|
print '</form>'; |
6220
|
6220
|
} else { |
6221
|
6221
|
if ($selected) { |
|
@@ -6242,14 +6242,14 @@ discard block |
|
|
block discarded – undo |
6242
|
6242
|
// phpcs:enable |
6243
|
6243
|
global $langs; |
6244
|
6244
|
if ($htmlname != "none") { |
6245
|
|
- print '<form method="POST" action="' . $page . '">'; |
|
6245
|
+ print '<form method="POST" action="'.$page.'">'; |
6246
|
6246
|
print '<input type="hidden" name="action" value="setmulticurrencycode">'; |
6247
|
|
- print '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
6247
|
+ print '<input type="hidden" name="token" value="'.newToken().'">'; |
6248
|
6248
|
print $this->selectMultiCurrency($selected, $htmlname, 0); |
6249
|
|
- print '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">'; |
|
6249
|
+ print '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">'; |
6250
|
6250
|
print '</form>'; |
6251
|
6251
|
} else { |
6252
|
|
- require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php'; |
|
6252
|
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; |
6253
|
6253
|
print !empty($selected) ? currency_name($selected, 1) : ' '; |
6254
|
6254
|
} |
6255
|
6255
|
} |
|
@@ -6271,22 +6271,22 @@ discard block |
|
|
block discarded – undo |
6271
|
6271
|
global $langs, $mysoc, $conf; |
6272
|
6272
|
|
6273
|
6273
|
if ($htmlname != "none") { |
6274
|
|
- print '<form method="POST" action="' . $page . '">'; |
|
6274
|
+ print '<form method="POST" action="'.$page.'">'; |
6275
|
6275
|
print '<input type="hidden" name="action" value="setmulticurrencyrate">'; |
6276
|
|
- print '<input type="hidden" name="token" value="' . newToken() . '">'; |
6277
|
|
- print '<input type="text" class="maxwidth75" name="' . $htmlname . '" value="' . (!empty($rate) ? price(price2num($rate, 'CU')) : 1) . '" /> '; |
|
6276
|
+ print '<input type="hidden" name="token" value="'.newToken().'">'; |
|
6277
|
+ print '<input type="text" class="maxwidth75" name="'.$htmlname.'" value="'.(!empty($rate) ? price(price2num($rate, 'CU')) : 1).'" /> '; |
6278
|
6278
|
print '<select name="calculation_mode" id="calculation_mode">'; |
6279
|
|
- print '<option value="1">Change ' . $langs->trans("PriceUHT") . ' of lines</option>'; |
6280
|
|
- print '<option value="2">Change ' . $langs->trans("PriceUHTCurrency") . ' of lines</option>'; |
|
6279
|
+ print '<option value="1">Change '.$langs->trans("PriceUHT").' of lines</option>'; |
|
6280
|
+ print '<option value="2">Change '.$langs->trans("PriceUHTCurrency").' of lines</option>'; |
6281
|
6281
|
print '</select> '; |
6282
|
6282
|
print ajax_combobox("calculation_mode"); |
6283
|
|
- print '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">'; |
|
6283
|
+ print '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">'; |
6284
|
6284
|
print '</form>'; |
6285
|
6285
|
} else { |
6286
|
6286
|
if (!empty($rate)) { |
6287
|
6287
|
print price($rate, 1, $langs, 0, 0); |
6288
|
6288
|
if ($currency && $rate != 1) { |
6289
|
|
- print ' <span class="opacitymedium">(' . price($rate, 1, $langs, 0, 0) . ' ' . $currency . ' = 1 ' . $conf->currency . ')</span>'; |
|
6289
|
+ print ' <span class="opacitymedium">('.price($rate, 1, $langs, 0, 0).' '.$currency.' = 1 '.$conf->currency.')</span>'; |
6290
|
6290
|
} |
6291
|
6291
|
} else { |
6292
|
6292
|
print 1; |
|
@@ -6317,9 +6317,9 @@ discard block |
|
|
block discarded – undo |
6317
|
6317
|
// phpcs:enable |
6318
|
6318
|
global $conf, $langs; |
6319
|
6319
|
if ($htmlname != "none") { |
6320
|
|
- print '<form method="post" action="' . $page . '">'; |
|
6320
|
+ print '<form method="post" action="'.$page.'">'; |
6321
|
6321
|
print '<input type="hidden" name="action" value="setabsolutediscount">'; |
6322
|
|
- print '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
6322
|
+ print '<input type="hidden" name="token" value="'.newToken().'">'; |
6323
|
6323
|
print '<div class="inline-block">'; |
6324
|
6324
|
if (!empty($discount_type)) { |
6325
|
6325
|
if (getDolGlobalString('FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS')) { |
|
@@ -6357,24 +6357,24 @@ discard block |
|
|
block discarded – undo |
6357
|
6357
|
print '</div>'; |
6358
|
6358
|
if (empty($hidelist)) { |
6359
|
6359
|
print '<div class="inline-block" style="padding-right: 10px">'; |
6360
|
|
- $newfilter = 'discount_type=' . intval($discount_type); |
|
6360
|
+ $newfilter = 'discount_type='.intval($discount_type); |
6361
|
6361
|
if (!empty($discount_type)) { |
6362
|
6362
|
$newfilter .= ' AND fk_invoice_supplier IS NULL AND fk_invoice_supplier_line IS NULL'; // Supplier discounts available |
6363
|
6363
|
} else { |
6364
|
6364
|
$newfilter .= ' AND fk_facture IS NULL AND fk_facture_line IS NULL'; // Customer discounts available |
6365
|
6365
|
} |
6366
|
6366
|
if ($filter) { |
6367
|
|
- $newfilter .= ' AND (' . $filter . ')'; |
|
6367
|
+ $newfilter .= ' AND ('.$filter.')'; |
6368
|
6368
|
} |
6369
|
6369
|
// output the combo of discounts |
6370
|
6370
|
$nbqualifiedlines = $this->select_remises((string) $selected, $htmlname, $newfilter, $socid, $maxvalue); |
6371
|
6371
|
if ($nbqualifiedlines > 0) { |
6372
|
|
- print ' <input type="submit" class="button smallpaddingimp" value="' . dol_escape_htmltag($langs->trans("UseLine")) . '"'; |
|
6372
|
+ print ' <input type="submit" class="button smallpaddingimp" value="'.dol_escape_htmltag($langs->trans("UseLine")).'"'; |
6373
|
6373
|
if (!empty($discount_type) && $filter && $filter != "fk_invoice_supplier_source IS NULL OR (description LIKE '(DEPOSIT)%' AND description NOT LIKE '(EXCESS PAID)%')") { |
6374
|
|
- print ' title="' . $langs->trans("UseCreditNoteInInvoicePayment") . '"'; |
|
6374
|
+ print ' title="'.$langs->trans("UseCreditNoteInInvoicePayment").'"'; |
6375
|
6375
|
} |
6376
|
6376
|
if (empty($discount_type) && $filter && $filter != "fk_facture_source IS NULL OR (description LIKE '(DEPOSIT)%' AND description NOT LIKE '(EXCESS RECEIVED)%')") { |
6377
|
|
- print ' title="' . $langs->trans("UseCreditNoteInInvoicePayment") . '"'; |
|
6377
|
+ print ' title="'.$langs->trans("UseCreditNoteInInvoicePayment").'"'; |
6378
|
6378
|
} |
6379
|
6379
|
|
6380
|
6380
|
print '>'; |
|
@@ -6414,23 +6414,23 @@ discard block |
|
|
block discarded – undo |
6414
|
6414
|
global $langs; |
6415
|
6415
|
|
6416
|
6416
|
if ($htmlname != "none") { |
6417
|
|
- print '<form method="post" action="' . $page . '">'; |
|
6417
|
+ print '<form method="post" action="'.$page.'">'; |
6418
|
6418
|
print '<input type="hidden" name="action" value="set_contact">'; |
6419
|
|
- print '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
6419
|
+ print '<input type="hidden" name="token" value="'.newToken().'">'; |
6420
|
6420
|
print '<table class="nobordernopadding">'; |
6421
|
6421
|
print '<tr><td>'; |
6422
|
6422
|
print $this->selectcontacts($societe->id, $selected, $htmlname); |
6423
|
6423
|
$num = $this->num; |
6424
|
6424
|
if ($num == 0) { |
6425
|
6425
|
$addcontact = (getDolGlobalString('SOCIETE_ADDRESSES_MANAGEMENT') ? $langs->trans("AddContact") : $langs->trans("AddContactAddress")); |
6426
|
|
- print '<a href="' . DOL_URL_ROOT . '/contact/card.php?socid=' . $societe->id . '&action=create&backtoreferer=1">' . $addcontact . '</a>'; |
|
6426
|
+ print '<a href="'.DOL_URL_ROOT.'/contact/card.php?socid='.$societe->id.'&action=create&backtoreferer=1">'.$addcontact.'</a>'; |
6427
|
6427
|
} |
6428
|
6428
|
print '</td>'; |
6429
|
|
- print '<td class="left"><input type="submit" class="button smallpaddingimp" value="' . $langs->trans("Modify") . '"></td>'; |
|
6429
|
+ print '<td class="left"><input type="submit" class="button smallpaddingimp" value="'.$langs->trans("Modify").'"></td>'; |
6430
|
6430
|
print '</tr></table></form>'; |
6431
|
6431
|
} else { |
6432
|
6432
|
if ($selected) { |
6433
|
|
- require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php'; |
|
6433
|
+ require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; |
6434
|
6434
|
$contact = new Contact($this->db); |
6435
|
6435
|
$contact->fetch($selected); |
6436
|
6436
|
print $contact->getFullName($langs); |
|
@@ -6465,20 +6465,20 @@ discard block |
|
|
block discarded – undo |
6465
|
6465
|
|
6466
|
6466
|
$out = ''; |
6467
|
6467
|
if ($htmlname != "none") { |
6468
|
|
- $out .= '<form method="post" action="' . $page . '">'; |
|
6468
|
+ $out .= '<form method="post" action="'.$page.'">'; |
6469
|
6469
|
$out .= '<input type="hidden" name="action" value="set_thirdparty">'; |
6470
|
|
- $out .= '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
6470
|
+ $out .= '<input type="hidden" name="token" value="'.newToken().'">'; |
6471
|
6471
|
$out .= $this->select_company($selected, $htmlname, $filter, $showempty, $showtype, $forcecombo, $events, 0, 'minwidth100', '', '', 1, array(), false, $excludeids); |
6472
|
|
- $out .= '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">'; |
|
6472
|
+ $out .= '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">'; |
6473
|
6473
|
$out .= '</form>'; |
6474
|
6474
|
} else { |
6475
|
6475
|
if ($selected) { |
6476
|
|
- require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; |
|
6476
|
+ require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; |
6477
|
6477
|
$soc = new Societe($this->db); |
6478
|
6478
|
$soc->fetch($selected); |
6479
|
6479
|
$out .= $soc->getNomUrl(0, ''); |
6480
|
6480
|
} else { |
6481
|
|
- $out .= '<span class="opacitymedium">' . $textifnothirdparty . '</span>'; |
|
6481
|
+ $out .= '<span class="opacitymedium">'.$textifnothirdparty.'</span>'; |
6482
|
6482
|
} |
6483
|
6483
|
} |
6484
|
6484
|
|
|
@@ -6528,22 +6528,22 @@ discard block |
|
|
block discarded – undo |
6528
|
6528
|
$selected = 'EUR'; // Pour compatibilite |
6529
|
6529
|
} |
6530
|
6530
|
|
6531
|
|
- $out .= '<select class="flat maxwidth200onsmartphone minwidth300" name="' . $htmlname . '" id="' . $htmlname . '">'; |
|
6531
|
+ $out .= '<select class="flat maxwidth200onsmartphone minwidth300" name="'.$htmlname.'" id="'.$htmlname.'">'; |
6532
|
6532
|
if ($useempty) { |
6533
|
6533
|
$out .= '<option value="-1" selected></option>'; |
6534
|
6534
|
} |
6535
|
6535
|
foreach ($langs->cache_currencies as $code_iso => $currency) { |
6536
|
6536
|
$labeltoshow = $currency['label']; |
6537
|
6537
|
if ($mode == 1) { |
6538
|
|
- $labeltoshow .= ' <span class="opacitymedium">(' . $code_iso . ')</span>'; |
|
6538
|
+ $labeltoshow .= ' <span class="opacitymedium">('.$code_iso.')</span>'; |
6539
|
6539
|
} else { |
6540
|
|
- $labeltoshow .= ' <span class="opacitymedium">(' . $langs->getCurrencySymbol($code_iso) . ')</span>'; |
|
6540
|
+ $labeltoshow .= ' <span class="opacitymedium">('.$langs->getCurrencySymbol($code_iso).')</span>'; |
6541
|
6541
|
} |
6542
|
6542
|
|
6543
|
6543
|
if ($selected && $selected == $code_iso) { |
6544
|
|
- $out .= '<option value="' . $code_iso . '" selected data-html="' . dol_escape_htmltag($labeltoshow) . '">'; |
|
6544
|
+ $out .= '<option value="'.$code_iso.'" selected data-html="'.dol_escape_htmltag($labeltoshow).'">'; |
6545
|
6545
|
} else { |
6546
|
|
- $out .= '<option value="' . $code_iso . '" data-html="' . dol_escape_htmltag($labeltoshow) . '">'; |
|
6546
|
+ $out .= '<option value="'.$code_iso.'" data-html="'.dol_escape_htmltag($labeltoshow).'">'; |
6547
|
6547
|
} |
6548
|
6548
|
$out .= $labeltoshow; |
6549
|
6549
|
$out .= '</option>'; |
|
@@ -6554,7 +6554,7 @@ discard block |
|
|
block discarded – undo |
6554
|
6554
|
} |
6555
|
6555
|
|
6556
|
6556
|
// Make select dynamic |
6557
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
6557
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
6558
|
6558
|
$out .= ajax_combobox($htmlname); |
6559
|
6559
|
|
6560
|
6560
|
return $out; |
|
@@ -6580,10 +6580,10 @@ discard block |
|
|
block discarded – undo |
6580
|
6580
|
|
6581
|
6581
|
$TCurrency = array(); |
6582
|
6582
|
|
6583
|
|
- $sql = "SELECT code FROM " . $this->db->prefix() . "multicurrency"; |
6584
|
|
- $sql .= " WHERE entity IN ('" . getEntity('mutlicurrency') . "')"; |
|
6583
|
+ $sql = "SELECT code FROM ".$this->db->prefix()."multicurrency"; |
|
6584
|
+ $sql .= " WHERE entity IN ('".getEntity('mutlicurrency')."')"; |
6585
|
6585
|
if ($filter) { |
6586
|
|
- $sql .= " AND " . $filter; |
|
6586
|
+ $sql .= " AND ".$filter; |
6587
|
6587
|
} |
6588
|
6588
|
$resql = $this->db->query($sql); |
6589
|
6589
|
if ($resql) { |
|
@@ -6593,7 +6593,7 @@ discard block |
|
|
block discarded – undo |
6593
|
6593
|
} |
6594
|
6594
|
|
6595
|
6595
|
$out = ''; |
6596
|
|
- $out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">'; |
|
6596
|
+ $out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">'; |
6597
|
6597
|
if ($useempty) { |
6598
|
6598
|
$out .= '<option value=""> </option>'; |
6599
|
6599
|
} |
|
@@ -6605,13 +6605,13 @@ discard block |
|
|
block discarded – undo |
6605
|
6605
|
foreach ($langs->cache_currencies as $code_iso => $currency) { |
6606
|
6606
|
if (isset($TCurrency[$code_iso])) { |
6607
|
6607
|
if (!empty($selected) && $selected == $code_iso) { |
6608
|
|
- $out .= '<option value="' . $code_iso . '" selected="selected">'; |
|
6608
|
+ $out .= '<option value="'.$code_iso.'" selected="selected">'; |
6609
|
6609
|
} else { |
6610
|
|
- $out .= '<option value="' . $code_iso . '">'; |
|
6610
|
+ $out .= '<option value="'.$code_iso.'">'; |
6611
|
6611
|
} |
6612
|
6612
|
|
6613
|
6613
|
$out .= $currency['label']; |
6614
|
|
- $out .= ' (' . $langs->getCurrencySymbol($code_iso) . ')'; |
|
6614
|
+ $out .= ' ('.$langs->getCurrencySymbol($code_iso).')'; |
6615
|
6615
|
$out .= '</option>'; |
6616
|
6616
|
} |
6617
|
6617
|
} |
|
@@ -6620,7 +6620,7 @@ discard block |
|
|
block discarded – undo |
6620
|
6620
|
$out .= '</select>'; |
6621
|
6621
|
|
6622
|
6622
|
// Make select dynamic |
6623
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
6623
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
6624
|
6624
|
$out .= ajax_combobox($htmlname); |
6625
|
6625
|
|
6626
|
6626
|
return $out; |
|
@@ -6651,7 +6651,7 @@ discard block |
|
|
block discarded – undo |
6651
|
6651
|
$sql .= " WHERE t.fk_pays = c.rowid"; |
6652
|
6652
|
$sql .= " AND t.active > 0"; |
6653
|
6653
|
$sql .= " AND t.entity IN (".getEntity('c_tva').")"; |
6654
|
|
- $sql .= " AND c.code IN (" . $this->db->sanitize($country_code, 1) . ")"; |
|
6654
|
+ $sql .= " AND c.code IN (".$this->db->sanitize($country_code, 1).")"; |
6655
|
6655
|
$sql .= " ORDER BY t.code ASC, t.taux ASC, t.recuperableonly ASC"; |
6656
|
6656
|
|
6657
|
6657
|
$resql = $this->db->query($sql); |
|
@@ -6663,30 +6663,30 @@ discard block |
|
|
block discarded – undo |
6663
|
6663
|
|
6664
|
6664
|
$tmparray = array(); |
6665
|
6665
|
$tmparray['rowid'] = $obj->rowid; |
6666
|
|
- $tmparray['type_vat'] = $obj->type_vat; |
6667
|
|
- $tmparray['code'] = $obj->code; |
|
6666
|
+ $tmparray['type_vat'] = $obj->type_vat; |
|
6667
|
+ $tmparray['code'] = $obj->code; |
6668
|
6668
|
$tmparray['txtva'] = $obj->taux; |
6669
|
|
- $tmparray['nprtva'] = $obj->recuperableonly; |
|
6669
|
+ $tmparray['nprtva'] = $obj->recuperableonly; |
6670
|
6670
|
$tmparray['localtax1'] = $obj->localtax1; |
6671
|
6671
|
$tmparray['localtax1_type'] = $obj->localtax1_type; |
6672
|
6672
|
$tmparray['localtax2'] = $obj->localtax2; |
6673
|
6673
|
$tmparray['localtax2_type'] = $obj->localtax1_type; |
6674
|
|
- $tmparray['label'] = $obj->taux . '%' . ($obj->code ? ' (' . $obj->code . ')' : ''); // Label must contains only 0-9 , . % or * |
6675
|
|
- $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 |
|
6674
|
+ $tmparray['label'] = $obj->taux.'%'.($obj->code ? ' ('.$obj->code.')' : ''); // Label must contains only 0-9 , . % or * |
|
6675
|
+ $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 |
6676
|
6676
|
$positiverates = ''; |
6677
|
6677
|
if ($obj->taux) { |
6678
|
|
- $positiverates .= ($positiverates ? '/' : '') . $obj->taux; |
|
6678
|
+ $positiverates .= ($positiverates ? '/' : '').$obj->taux; |
6679
|
6679
|
} |
6680
|
6680
|
if ($obj->localtax1) { |
6681
|
|
- $positiverates .= ($positiverates ? '/' : '') . $obj->localtax1; |
|
6681
|
+ $positiverates .= ($positiverates ? '/' : '').$obj->localtax1; |
6682
|
6682
|
} |
6683
|
6683
|
if ($obj->localtax2) { |
6684
|
|
- $positiverates .= ($positiverates ? '/' : '') . $obj->localtax2; |
|
6684
|
+ $positiverates .= ($positiverates ? '/' : '').$obj->localtax2; |
6685
|
6685
|
} |
6686
|
6686
|
if (empty($positiverates)) { |
6687
|
6687
|
$positiverates = '0'; |
6688
|
6688
|
} |
6689
|
|
- $tmparray['labelpositiverates'] = $positiverates . ($obj->code ? ' (' . $obj->code . ')' : ''); // Must never be used as key, only label |
|
6689
|
+ $tmparray['labelpositiverates'] = $positiverates.($obj->code ? ' ('.$obj->code.')' : ''); // Must never be used as key, only label |
6690
|
6690
|
|
6691
|
6691
|
$this->cache_vatrates[$obj->rowid] = $tmparray; |
6692
|
6692
|
} |
|
@@ -6706,7 +6706,7 @@ discard block |
|
|
block discarded – undo |
6706
|
6706
|
return -1; |
6707
|
6707
|
} |
6708
|
6708
|
} else { |
6709
|
|
- $this->error = '<span class="error">' . $this->db->error() . '</span>'; |
|
6709
|
+ $this->error = '<span class="error">'.$this->db->error().'</span>'; |
6710
|
6710
|
return -2; |
6711
|
6711
|
} |
6712
|
6712
|
} |
|
@@ -6759,9 +6759,9 @@ discard block |
|
|
block discarded – undo |
6759
|
6759
|
// Check parameters |
6760
|
6760
|
if (is_object($societe_vendeuse) && !$societe_vendeuse->country_code) { |
6761
|
6761
|
if ($societe_vendeuse->id == $mysoc->id) { |
6762
|
|
- $return .= '<span class="error">' . $langs->trans("ErrorYourCountryIsNotDefined") . '</span>'; |
|
6762
|
+ $return .= '<span class="error">'.$langs->trans("ErrorYourCountryIsNotDefined").'</span>'; |
6763
|
6763
|
} else { |
6764
|
|
- $return .= '<span class="error">' . $langs->trans("ErrorSupplierCountryIsNotDefined") . '</span>'; |
|
6764
|
+ $return .= '<span class="error">'.$langs->trans("ErrorSupplierCountryIsNotDefined").'</span>'; |
6765
|
6765
|
} |
6766
|
6766
|
return $return; |
6767
|
6767
|
} |
|
@@ -6773,12 +6773,12 @@ discard block |
|
|
block discarded – undo |
6773
|
6773
|
// Define list of countries to use to search VAT rates to show |
6774
|
6774
|
// First we defined code_country to use to find list |
6775
|
6775
|
if (is_object($societe_vendeuse)) { |
6776
|
|
- $code_country = "'" . $societe_vendeuse->country_code . "'"; |
|
6776
|
+ $code_country = "'".$societe_vendeuse->country_code."'"; |
6777
|
6777
|
} else { |
6778
|
|
- $code_country = "'" . $mysoc->country_code . "'"; // Pour compatibilite ascendente |
|
6778
|
+ $code_country = "'".$mysoc->country_code."'"; // Pour compatibilite ascendente |
6779
|
6779
|
} |
6780
|
6780
|
if (getDolGlobalString('SERVICE_ARE_ECOMMERCE_200238EC')) { // If option to have vat for end customer for services is on |
6781
|
|
- require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php'; |
|
6781
|
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; |
6782
|
6782
|
// If SERVICE_ARE_ECOMMERCE_200238EC=1 combo list vat rate of purchaser and seller countries |
6783
|
6783
|
// If SERVICE_ARE_ECOMMERCE_200238EC=2 combo list only the vat rate of the purchaser country |
6784
|
6784
|
$selectVatComboMode = getDolGlobalString('SERVICE_ARE_ECOMMERCE_200238EC'); |
|
@@ -6788,27 +6788,27 @@ discard block |
|
|
block discarded – undo |
6788
|
6788
|
if ($type == 1) { // We know product is a service |
6789
|
6789
|
switch ($selectVatComboMode) { |
6790
|
6790
|
case '1': |
6791
|
|
- $code_country .= ",'" . $societe_acheteuse->country_code . "'"; |
|
6791
|
+ $code_country .= ",'".$societe_acheteuse->country_code."'"; |
6792
|
6792
|
break; |
6793
|
6793
|
case '2': |
6794
|
|
- $code_country = "'" . $societe_acheteuse->country_code . "'"; |
|
6794
|
+ $code_country = "'".$societe_acheteuse->country_code."'"; |
6795
|
6795
|
break; |
6796
|
6796
|
} |
6797
|
6797
|
} |
6798
|
6798
|
} elseif (!$idprod) { // We don't know type of product |
6799
|
6799
|
switch ($selectVatComboMode) { |
6800
|
6800
|
case '1': |
6801
|
|
- $code_country .= ",'" . $societe_acheteuse->country_code . "'"; |
|
6801
|
+ $code_country .= ",'".$societe_acheteuse->country_code."'"; |
6802
|
6802
|
break; |
6803
|
6803
|
case '2': |
6804
|
|
- $code_country = "'" . $societe_acheteuse->country_code . "'"; |
|
6804
|
+ $code_country = "'".$societe_acheteuse->country_code."'"; |
6805
|
6805
|
break; |
6806
|
6806
|
} |
6807
|
6807
|
} else { |
6808
|
6808
|
$prodstatic = new Product($this->db); |
6809
|
6809
|
$prodstatic->fetch($idprod); |
6810
|
6810
|
if ($prodstatic->type == Product::TYPE_SERVICE) { // We know product is a service |
6811
|
|
- $code_country .= ",'" . $societe_acheteuse->country_code . "'"; |
|
6811
|
+ $code_country .= ",'".$societe_acheteuse->country_code."'"; |
6812
|
6812
|
} |
6813
|
6813
|
} |
6814
|
6814
|
} |
|
@@ -6870,13 +6870,13 @@ discard block |
|
|
block discarded – undo |
6870
|
6870
|
// Override/enable VAT for expense report regardless of global setting - needed if expense report used for business expenses instead |
6871
|
6871
|
// of using supplier invoices (this is a very bad idea !) |
6872
|
6872
|
if (!getDolGlobalString('EXPENSEREPORT_OVERRIDE_VAT')) { |
6873
|
|
- $title = ' title="' . dol_escape_htmltag($langs->trans('VATIsNotUsed')) . '"'; |
|
6873
|
+ $title = ' title="'.dol_escape_htmltag($langs->trans('VATIsNotUsed')).'"'; |
6874
|
6874
|
$disabled = true; |
6875
|
6875
|
} |
6876
|
6876
|
} |
6877
|
6877
|
|
6878
|
6878
|
if (!$options_only) { |
6879
|
|
- $return .= '<select class="flat minwidth75imp maxwidth100 right" id="' . $htmlname . '" name="' . $htmlname . '"' . ($disabled ? ' disabled' : '') . $title . '>'; |
|
6879
|
+ $return .= '<select class="flat minwidth75imp maxwidth100 right" id="'.$htmlname.'" name="'.$htmlname.'"'.($disabled ? ' disabled' : '').$title.'>'; |
6880
|
6880
|
} |
6881
|
6881
|
|
6882
|
6882
|
$selectedfound = false; |
|
@@ -6890,13 +6890,13 @@ discard block |
|
|
block discarded – undo |
6890
|
6890
|
$key = $rate['txtva']; |
6891
|
6891
|
$key .= $rate['nprtva'] ? '*' : ''; |
6892
|
6892
|
if ($mode > 0 && $rate['code']) { |
6893
|
|
- $key .= ' (' . $rate['code'] . ')'; |
|
6893
|
+ $key .= ' ('.$rate['code'].')'; |
6894
|
6894
|
} |
6895
|
6895
|
if ($mode < 0) { |
6896
|
6896
|
$key = $rate['rowid']; |
6897
|
6897
|
} |
6898
|
6898
|
|
6899
|
|
- $return .= '<option value="' . $key . '"'; |
|
6899
|
+ $return .= '<option value="'.$key.'"'; |
6900
|
6900
|
if (!$selectedfound) { |
6901
|
6901
|
if ($defaultcode) { // If defaultcode is defined, we used it in priority to select combo option instead of using rate+npr flag |
6902
|
6902
|
if ($defaultcode == $rate['code']) { |
|
@@ -6967,7 +6967,7 @@ discard block |
|
|
block discarded – undo |
6967
|
6967
|
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 = '') |
6968
|
6968
|
{ |
6969
|
6969
|
// phpcs:enable |
6970
|
|
- dol_syslog(__METHOD__ . ': using select_date is deprecated. Use selectDate instead.', LOG_WARNING); |
|
6970
|
+ dol_syslog(__METHOD__.': using select_date is deprecated. Use selectDate instead.', LOG_WARNING); |
6971
|
6971
|
$retstring = $this->selectDate($set_time, $prefix, $h, $m, $empty, $form_name, $d, $addnowlink, $disabled, $fullday, $addplusone, $adddateof); |
6972
|
6972
|
if (!empty($nooutput)) { |
6973
|
6973
|
return $retstring; |
|
@@ -6996,11 +6996,11 @@ discard block |
|
|
block discarded – undo |
6996
|
6996
|
{ |
6997
|
6997
|
global $langs; |
6998
|
6998
|
|
6999
|
|
- $ret = $this->selectDate($set_time, $prefix . '_start', 0, 0, $empty, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("from"), 'tzuserrel'); |
|
6999
|
+ $ret = $this->selectDate($set_time, $prefix.'_start', 0, 0, $empty, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("from"), 'tzuserrel'); |
7000
|
7000
|
if ($forcenewline) { |
7001
|
7001
|
$ret .= '<br>'; |
7002
|
7002
|
} |
7003
|
|
- $ret .= $this->selectDate($set_time_end, $prefix . '_end', 0, 0, $empty, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"), 'tzuserrel'); |
|
7003
|
+ $ret .= $this->selectDate($set_time_end, $prefix.'_end', 0, 0, $empty, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"), 'tzuserrel'); |
7004
|
7004
|
return $ret; |
7005
|
7005
|
} |
7006
|
7006
|
|
|
@@ -7066,7 +7066,7 @@ discard block |
|
|
block discarded – undo |
7066
|
7066
|
$orig_set_time = $set_time; |
7067
|
7067
|
|
7068
|
7068
|
if ($set_time === '' && $emptydate == 0) { |
7069
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php'; |
|
7069
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; |
7070
|
7070
|
if ($gm == 'tzuser' || $gm == 'tzuserrel') { |
7071
|
7071
|
$set_time = dol_now($gm); |
7072
|
7072
|
} else { |
|
@@ -7138,38 +7138,38 @@ discard block |
|
|
block discarded – undo |
7138
|
7138
|
// Calendrier popup version eldy |
7139
|
7139
|
if ($usecalendar == "eldy") { |
7140
|
7140
|
// Input area to enter date manually |
7141
|
|
- $retstring .= '<input id="' . $prefix . '" name="' . $prefix . '" type="text" class="maxwidthdate center" maxlength="11" value="' . $formated_date . '"'; |
|
7141
|
+ $retstring .= '<input id="'.$prefix.'" name="'.$prefix.'" type="text" class="maxwidthdate center" maxlength="11" value="'.$formated_date.'"'; |
7142
|
7142
|
$retstring .= ($disabled ? ' disabled' : ''); |
7143
|
|
- $retstring .= ' onChange="dpChangeDay(\'' . $prefix . '\',\'' . $langs->trans("FormatDateShortJavaInput") . '\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript |
|
7143
|
+ $retstring .= ' onChange="dpChangeDay(\''.$prefix.'\',\''.$langs->trans("FormatDateShortJavaInput").'\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript |
7144
|
7144
|
$retstring .= ' autocomplete="off">'; |
7145
|
7145
|
|
7146
|
7146
|
// Icon calendar |
7147
|
7147
|
$retstringbuttom = ''; |
7148
|
7148
|
if (!$disabled) { |
7149
|
|
- $retstringbuttom = '<button id="' . $prefix . 'Button" type="button" class="dpInvisibleButtons"'; |
7150
|
|
- $base = DOL_URL_ROOT . '/core/'; |
7151
|
|
- $retstringbuttom .= ' onClick="showDP(\'' . $base . '\',\'' . $prefix . '\',\'' . $langs->trans("FormatDateShortJavaInput") . '\',\'' . $langs->defaultlang . '\');"'; |
7152
|
|
- $retstringbuttom .= '>' . img_object($langs->trans("SelectDate"), 'calendarday', 'class="datecallink"') . '</button>'; |
|
7149
|
+ $retstringbuttom = '<button id="'.$prefix.'Button" type="button" class="dpInvisibleButtons"'; |
|
7150
|
+ $base = DOL_URL_ROOT.'/core/'; |
|
7151
|
+ $retstringbuttom .= ' onClick="showDP(\''.$base.'\',\''.$prefix.'\',\''.$langs->trans("FormatDateShortJavaInput").'\',\''.$langs->defaultlang.'\');"'; |
|
7152
|
+ $retstringbuttom .= '>'.img_object($langs->trans("SelectDate"), 'calendarday', 'class="datecallink"').'</button>'; |
7153
|
7153
|
} else { |
7154
|
|
- $retstringbuttom = '<button id="' . $prefix . 'Button" type="button" class="dpInvisibleButtons">' . img_object($langs->trans("Disabled"), 'calendarday', 'class="datecallink"') . '</button>'; |
|
7154
|
+ $retstringbuttom = '<button id="'.$prefix.'Button" type="button" class="dpInvisibleButtons">'.img_object($langs->trans("Disabled"), 'calendarday', 'class="datecallink"').'</button>'; |
7155
|
7155
|
} |
7156
|
|
- $retstring = $retstringbuttom . $retstring; |
|
7156
|
+ $retstring = $retstringbuttom.$retstring; |
7157
|
7157
|
|
7158
|
|
- $retstring .= '<input type="hidden" id="' . $prefix . 'day" name="' . $prefix . 'day" value="' . $sday . '">' . "\n"; |
7159
|
|
- $retstring .= '<input type="hidden" id="' . $prefix . 'month" name="' . $prefix . 'month" value="' . $smonth . '">' . "\n"; |
7160
|
|
- $retstring .= '<input type="hidden" id="' . $prefix . 'year" name="' . $prefix . 'year" value="' . $syear . '">' . "\n"; |
|
7158
|
+ $retstring .= '<input type="hidden" id="'.$prefix.'day" name="'.$prefix.'day" value="'.$sday.'">'."\n"; |
|
7159
|
+ $retstring .= '<input type="hidden" id="'.$prefix.'month" name="'.$prefix.'month" value="'.$smonth.'">'."\n"; |
|
7160
|
+ $retstring .= '<input type="hidden" id="'.$prefix.'year" name="'.$prefix.'year" value="'.$syear.'">'."\n"; |
7161
|
7161
|
} elseif ($usecalendar == 'jquery' || $usecalendar == 'html') { |
7162
|
7162
|
if (!$disabled && $usecalendar != 'html') { |
7163
|
7163
|
// Output javascript for datepicker |
7164
|
7164
|
$minYear = getDolGlobalInt('MIN_YEAR_SELECT_DATE', (idate('Y') - 100)); |
7165
|
7165
|
$maxYear = getDolGlobalInt('MAX_YEAR_SELECT_DATE', (idate('Y') + 100)); |
7166
|
7166
|
|
7167
|
|
- $retstring .= '<script nonce="' . getNonce() . '" type="text/javascript">'; |
7168
|
|
- $retstring .= "$(function(){ $('#" . $prefix . "').datepicker({ |
7169
|
|
- dateFormat: '" . $langs->trans("FormatDateShortJQueryInput") . "', |
|
7167
|
+ $retstring .= '<script nonce="'.getNonce().'" type="text/javascript">'; |
|
7168
|
+ $retstring .= "$(function(){ $('#".$prefix."').datepicker({ |
|
7169
|
+ dateFormat: '" . $langs->trans("FormatDateShortJQueryInput")."', |
7170
|
7170
|
autoclose: true, |
7171
|
7171
|
todayHighlight: true, |
7172
|
|
- yearRange: '" . $minYear . ":" . $maxYear . "',"; |
|
7172
|
+ yearRange: '" . $minYear.":".$maxYear."',"; |
7173
|
7173
|
if (!empty($conf->dol_use_jmobile)) { |
7174
|
7174
|
$retstring .= " |
7175
|
7175
|
beforeShow: function (input, datePicker) { |
|
@@ -7184,7 +7184,7 @@ discard block |
|
|
block discarded – undo |
7184
|
7184
|
if (!getDolGlobalString('MAIN_POPUP_CALENDAR_ON_FOCUS')) { |
7185
|
7185
|
$retstring .= " |
7186
|
7186
|
showOn: 'button', /* both has problem with autocompletion */ |
7187
|
|
- buttonImage: '" . DOL_URL_ROOT . "/theme/" . dol_escape_js($conf->theme) . "/img/object_calendarday.png', |
|
7187
|
+ buttonImage: '" . DOL_URL_ROOT."/theme/".dol_escape_js($conf->theme)."/img/object_calendarday.png', |
7188
|
7188
|
buttonImageOnly: true"; |
7189
|
7189
|
} |
7190
|
7190
|
$retstring .= " |
|
@@ -7196,46 +7196,46 @@ discard block |
|
|
block discarded – undo |
7196
|
7196
|
$retstring .= '<div class="nowraponall inline-block divfordateinput">'; |
7197
|
7197
|
$retstring .= '<input id="'.$prefix.'" name="'.$prefix.'" type="text" class="maxwidthdate center" maxlength="11" value="'.$formated_date.'"'; |
7198
|
7198
|
$retstring .= ($disabled ? ' disabled' : ''); |
7199
|
|
- $retstring .= ($placeholder ? ' placeholder="' . dol_escape_htmltag($placeholder) . '"' : ''); |
7200
|
|
- $retstring .= ' onChange="dpChangeDay(\'' . dol_escape_js($prefix) . '\',\'' . dol_escape_js($langs->trans("FormatDateShortJavaInput")) . '\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript |
|
7199
|
+ $retstring .= ($placeholder ? ' placeholder="'.dol_escape_htmltag($placeholder).'"' : ''); |
|
7200
|
+ $retstring .= ' onChange="dpChangeDay(\''.dol_escape_js($prefix).'\',\''.dol_escape_js($langs->trans("FormatDateShortJavaInput")).'\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript |
7201
|
7201
|
$retstring .= ' autocomplete="off">'; |
7202
|
7202
|
|
7203
|
7203
|
// Icone calendrier |
7204
|
7204
|
if ($disabled) { |
7205
|
|
- $retstringbutton = '<button id="' . $prefix . 'Button" type="button" class="dpInvisibleButtons">' . img_object($langs->trans("Disabled"), 'calendarday', 'class="datecallink"') . '</button>'; |
7206
|
|
- $retstring = $retstringbutton . $retstring; |
|
7205
|
+ $retstringbutton = '<button id="'.$prefix.'Button" type="button" class="dpInvisibleButtons">'.img_object($langs->trans("Disabled"), 'calendarday', 'class="datecallink"').'</button>'; |
|
7206
|
+ $retstring = $retstringbutton.$retstring; |
7207
|
7207
|
} |
7208
|
7208
|
|
7209
|
7209
|
$retstring .= '</div>'; |
7210
|
|
- $retstring .= '<input type="hidden" id="' . $prefix . 'day" name="' . $prefix . 'day" value="' . $sday . '">' . "\n"; |
7211
|
|
- $retstring .= '<input type="hidden" id="' . $prefix . 'month" name="' . $prefix . 'month" value="' . $smonth . '">' . "\n"; |
7212
|
|
- $retstring .= '<input type="hidden" id="' . $prefix . 'year" name="' . $prefix . 'year" value="' . $syear . '">' . "\n"; |
|
7210
|
+ $retstring .= '<input type="hidden" id="'.$prefix.'day" name="'.$prefix.'day" value="'.$sday.'">'."\n"; |
|
7211
|
+ $retstring .= '<input type="hidden" id="'.$prefix.'month" name="'.$prefix.'month" value="'.$smonth.'">'."\n"; |
|
7212
|
+ $retstring .= '<input type="hidden" id="'.$prefix.'year" name="'.$prefix.'year" value="'.$syear.'">'."\n"; |
7213
|
7213
|
} else { |
7214
|
7214
|
$retstring .= "Bad value of MAIN_POPUP_CALENDAR"; |
7215
|
7215
|
} |
7216
|
7216
|
} else { |
7217
|
7217
|
// Show date with combo selects |
7218
|
7218
|
// Day |
7219
|
|
- $retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth50imp" id="' . $prefix . 'day" name="' . $prefix . 'day">'; |
|
7219
|
+ $retstring .= '<select'.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth50imp" id="'.$prefix.'day" name="'.$prefix.'day">'; |
7220
|
7220
|
|
7221
|
7221
|
if ($emptydate || $set_time == -1) { |
7222
|
7222
|
$retstring .= '<option value="0" selected> </option>'; |
7223
|
7223
|
} |
7224
|
7224
|
|
7225
|
7225
|
for ($day = 1; $day <= 31; $day++) { |
7226
|
|
- $retstring .= '<option value="' . $day . '"' . ($day == $sday ? ' selected' : '') . '>' . $day . '</option>'; |
|
7226
|
+ $retstring .= '<option value="'.$day.'"'.($day == $sday ? ' selected' : '').'>'.$day.'</option>'; |
7227
|
7227
|
} |
7228
|
7228
|
|
7229
|
7229
|
$retstring .= "</select>"; |
7230
|
7230
|
|
7231
|
|
- $retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth75imp" id="' . $prefix . 'month" name="' . $prefix . 'month">'; |
|
7231
|
+ $retstring .= '<select'.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth75imp" id="'.$prefix.'month" name="'.$prefix.'month">'; |
7232
|
7232
|
if ($emptydate || $set_time == -1) { |
7233
|
7233
|
$retstring .= '<option value="0" selected> </option>'; |
7234
|
7234
|
} |
7235
|
7235
|
|
7236
|
7236
|
// Month |
7237
|
7237
|
for ($month = 1; $month <= 12; $month++) { |
7238
|
|
- $retstring .= '<option value="' . $month . '"' . ($month == $smonth ? ' selected' : '') . '>'; |
|
7238
|
+ $retstring .= '<option value="'.$month.'"'.($month == $smonth ? ' selected' : '').'>'; |
7239
|
7239
|
$retstring .= dol_print_date(mktime(12, 0, 0, $month, 1, 2000), "%b"); |
7240
|
7240
|
$retstring .= "</option>"; |
7241
|
7241
|
} |
|
@@ -7243,13 +7243,13 @@ discard block |
|
|
block discarded – undo |
7243
|
7243
|
|
7244
|
7244
|
// Year |
7245
|
7245
|
if ($emptydate || $set_time == -1) { |
7246
|
|
- $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 . '">'; |
|
7246
|
+ $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.'">'; |
7247
|
7247
|
} else { |
7248
|
|
- $retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth75imp" id="' . $prefix . 'year" name="' . $prefix . 'year">'; |
|
7248
|
+ $retstring .= '<select'.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth75imp" id="'.$prefix.'year" name="'.$prefix.'year">'; |
7249
|
7249
|
|
7250
|
7250
|
$syear = (int) $syear; |
7251
|
7251
|
for ($year = $syear - 10; $year < (int) $syear + 10; $year++) { |
7252
|
|
- $retstring .= '<option value="' . $year . '"' . ($year == $syear ? ' selected' : '') . '>' . $year . '</option>'; |
|
7252
|
+ $retstring .= '<option value="'.$year.'"'.($year == $syear ? ' selected' : '').'>'.$year.'</option>'; |
7253
|
7253
|
} |
7254
|
7254
|
$retstring .= "</select>\n"; |
7255
|
7255
|
} |
|
@@ -7273,15 +7273,15 @@ discard block |
|
|
block discarded – undo |
7273
|
7273
|
} |
7274
|
7274
|
} |
7275
|
7275
|
// Show hour |
7276
|
|
- $retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth50 ' . ($fullday ? $fullday . 'hour' : '') . '" id="' . $prefix . 'hour" name="' . $prefix . 'hour">'; |
|
7276
|
+ $retstring .= '<select'.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth50 '.($fullday ? $fullday.'hour' : '').'" id="'.$prefix.'hour" name="'.$prefix.'hour">'; |
7277
|
7277
|
if ($emptyhours) { |
7278
|
7278
|
$retstring .= '<option value="-1"> </option>'; |
7279
|
7279
|
} |
7280
|
7280
|
for ($hour = $hourstart; $hour < $hourend; $hour++) { |
7281
|
7281
|
if (strlen($hour) < 2) { |
7282
|
|
- $hour = "0" . $hour; |
|
7282
|
+ $hour = "0".$hour; |
7283
|
7283
|
} |
7284
|
|
- $retstring .= '<option value="' . $hour . '"' . (($hour == $shour) ? ' selected' : '') . '>' . $hour; |
|
7284
|
+ $retstring .= '<option value="'.$hour.'"'.(($hour == $shour) ? ' selected' : '').'>'.$hour; |
7285
|
7285
|
//$retstring .= (empty($conf->dol_optimize_smallscreen) ? '' : 'H'); |
7286
|
7286
|
$retstring .= '</option>'; |
7287
|
7287
|
} |
|
@@ -7294,17 +7294,17 @@ discard block |
|
|
block discarded – undo |
7294
|
7294
|
|
7295
|
7295
|
if ($m) { |
7296
|
7296
|
// Show minutes |
7297
|
|
- $retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth50 ' . ($fullday ? $fullday . 'min' : '') . '" id="' . $prefix . 'min" name="' . $prefix . 'min">'; |
|
7297
|
+ $retstring .= '<select'.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth50 '.($fullday ? $fullday.'min' : '').'" id="'.$prefix.'min" name="'.$prefix.'min">'; |
7298
|
7298
|
if ($emptyhours) { |
7299
|
7299
|
$retstring .= '<option value="-1"> </option>'; |
7300
|
7300
|
} |
7301
|
7301
|
for ($min = 0; $min < 60; $min += $stepminutes) { |
7302
|
7302
|
$min_str = sprintf("%02d", $min); |
7303
|
|
- $retstring .= '<option value="' . $min_str . '"' . (($min_str == $smin) ? ' selected' : '') . '>' . $min_str . '</option>'; |
|
7303
|
+ $retstring .= '<option value="'.$min_str.'"'.(($min_str == $smin) ? ' selected' : '').'>'.$min_str.'</option>'; |
7304
|
7304
|
} |
7305
|
7305
|
$retstring .= '</select>'; |
7306
|
7306
|
|
7307
|
|
- $retstring .= '<input type="hidden" name="' . $prefix . 'sec" value="' . $ssec . '">'; |
|
7307
|
+ $retstring .= '<input type="hidden" name="'.$prefix.'sec" value="'.$ssec.'">'; |
7308
|
7308
|
} |
7309
|
7309
|
|
7310
|
7310
|
if ($d && $h) { |
|
@@ -7327,10 +7327,10 @@ discard block |
|
|
block discarded – undo |
7327
|
7327
|
|
7328
|
7328
|
// Generate the date part, depending on the use or not of the javascript calendar |
7329
|
7329
|
if ($addnowlink == 1) { // server time expressed in user time setup |
7330
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . '\').val(\'' . dol_print_date($nowgmt, 'day', 'tzuserrel') . '\');'; |
7331
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'day\').val(\'' . dol_print_date($nowgmt, '%d', 'tzuserrel') . '\');'; |
7332
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'month\').val(\'' . dol_print_date($nowgmt, '%m', 'tzuserrel') . '\');'; |
7333
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'year\').val(\'' . dol_print_date($nowgmt, '%Y', 'tzuserrel') . '\');'; |
|
7330
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'\').val(\''.dol_print_date($nowgmt, 'day', 'tzuserrel').'\');'; |
|
7331
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'day\').val(\''.dol_print_date($nowgmt, '%d', 'tzuserrel').'\');'; |
|
7332
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(\''.dol_print_date($nowgmt, '%m', 'tzuserrel').'\');'; |
|
7333
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(\''.dol_print_date($nowgmt, '%Y', 'tzuserrel').'\');'; |
7334
|
7334
|
} elseif ($addnowlink == 2) { |
7335
|
7335
|
/* Disabled because the output does not use the string format defined by FormatDateShort key to forge the value into #prefix. |
7336
|
7336
|
* This break application for foreign languages. |
|
@@ -7339,10 +7339,10 @@ discard block |
|
|
block discarded – undo |
7339
|
7339
|
$reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(parseInt(d.getMonth().pad()) + 1);'; |
7340
|
7340
|
$reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(d.getFullYear());'; |
7341
|
7341
|
*/ |
7342
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . '\').val(\'' . dol_print_date($nowgmt, 'day', 'tzuserrel') . '\');'; |
7343
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'day\').val(\'' . dol_print_date($nowgmt, '%d', 'tzuserrel') . '\');'; |
7344
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'month\').val(\'' . dol_print_date($nowgmt, '%m', 'tzuserrel') . '\');'; |
7345
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'year\').val(\'' . dol_print_date($nowgmt, '%Y', 'tzuserrel') . '\');'; |
|
7342
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'\').val(\''.dol_print_date($nowgmt, 'day', 'tzuserrel').'\');'; |
|
7343
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'day\').val(\''.dol_print_date($nowgmt, '%d', 'tzuserrel').'\');'; |
|
7344
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(\''.dol_print_date($nowgmt, '%m', 'tzuserrel').'\');'; |
|
7345
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(\''.dol_print_date($nowgmt, '%Y', 'tzuserrel').'\');'; |
7346
|
7346
|
} |
7347
|
7347
|
/*if ($usecalendar == "eldy") |
7348
|
7348
|
{ |
|
@@ -7362,11 +7362,11 @@ discard block |
|
|
block discarded – undo |
7362
|
7362
|
} |
7363
|
7363
|
//$reset_scripts .= 'this.form.elements[\''.$prefix.'hour\'].value=formatDate(new Date(), \'HH\'); '; |
7364
|
7364
|
if ($addnowlink == 1) { |
7365
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'hour\').val(\'' . dol_print_date($nowgmt, '%H', 'tzuserrel') . '\');'; |
7366
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'hour\').change();'; |
|
7365
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').val(\''.dol_print_date($nowgmt, '%H', 'tzuserrel').'\');'; |
|
7366
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').change();'; |
7367
|
7367
|
} elseif ($addnowlink == 2) { |
7368
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'hour\').val(d.getHours().pad());'; |
7369
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'hour\').change();'; |
|
7368
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').val(d.getHours().pad());'; |
|
7369
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').change();'; |
7370
|
7370
|
} |
7371
|
7371
|
|
7372
|
7372
|
if ($fullday) { |
|
@@ -7380,11 +7380,11 @@ discard block |
|
|
block discarded – undo |
7380
|
7380
|
} |
7381
|
7381
|
//$reset_scripts .= 'this.form.elements[\''.$prefix.'min\'].value=formatDate(new Date(), \'mm\'); '; |
7382
|
7382
|
if ($addnowlink == 1) { |
7383
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'min\').val(\'' . dol_print_date($nowgmt, '%M', 'tzuserrel') . '\');'; |
7384
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'min\').change();'; |
|
7383
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'min\').val(\''.dol_print_date($nowgmt, '%M', 'tzuserrel').'\');'; |
|
7384
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'min\').change();'; |
7385
|
7385
|
} elseif ($addnowlink == 2) { |
7386
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'min\').val(d.getMinutes().pad());'; |
7387
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'min\').change();'; |
|
7386
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'min\').val(d.getMinutes().pad());'; |
|
7387
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'min\').change();'; |
7388
|
7388
|
} |
7389
|
7389
|
if ($fullday) { |
7390
|
7390
|
$reset_scripts .= ' } '; |
|
@@ -7392,7 +7392,7 @@ discard block |
|
|
block discarded – undo |
7392
|
7392
|
} |
7393
|
7393
|
// If reset_scripts is not empty, print the link with the reset_scripts in the onClick |
7394
|
7394
|
if ($reset_scripts && !getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) { |
7395
|
|
- $retstring .= ' <button class="dpInvisibleButtons datenowlink" id="' . $prefix . 'ButtonNow" type="button" name="_useless" value="now" onClick="' . $reset_scripts . '">'; |
|
7395
|
+ $retstring .= ' <button class="dpInvisibleButtons datenowlink" id="'.$prefix.'ButtonNow" type="button" name="_useless" value="now" onClick="'.$reset_scripts.'">'; |
7396
|
7396
|
$retstring .= $langs->trans("Now"); |
7397
|
7397
|
$retstring .= '</button> '; |
7398
|
7398
|
} |
|
@@ -7404,16 +7404,16 @@ discard block |
|
|
block discarded – undo |
7404
|
7404
|
$reset_scripts = ""; |
7405
|
7405
|
|
7406
|
7406
|
// Generate the date part, depending on the use or not of the javascript calendar |
7407
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . '\').val(\'' . dol_print_date($nowgmt, 'dayinputnoreduce', 'tzuserrel') . '\');'; |
7408
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'day\').val(\'' . dol_print_date($nowgmt, '%d', 'tzuserrel') . '\');'; |
7409
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'month\').val(\'' . dol_print_date($nowgmt, '%m', 'tzuserrel') . '\');'; |
7410
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'year\').val(\'' . dol_print_date($nowgmt, '%Y', 'tzuserrel') . '\');'; |
|
7407
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'\').val(\''.dol_print_date($nowgmt, 'dayinputnoreduce', 'tzuserrel').'\');'; |
|
7408
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'day\').val(\''.dol_print_date($nowgmt, '%d', 'tzuserrel').'\');'; |
|
7409
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(\''.dol_print_date($nowgmt, '%m', 'tzuserrel').'\');'; |
|
7410
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(\''.dol_print_date($nowgmt, '%Y', 'tzuserrel').'\');'; |
7411
|
7411
|
// Update the hour part |
7412
|
7412
|
if ($h) { |
7413
|
7413
|
if ($fullday) { |
7414
|
7414
|
$reset_scripts .= " if (jQuery('#fullday:checked').val() == null) {"; |
7415
|
7415
|
} |
7416
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'hour\').val(\'' . dol_print_date($nowgmt, '%H', 'tzuserrel') . '\');'; |
|
7416
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').val(\''.dol_print_date($nowgmt, '%H', 'tzuserrel').'\');'; |
7417
|
7417
|
if ($fullday) { |
7418
|
7418
|
$reset_scripts .= ' } '; |
7419
|
7419
|
} |
|
@@ -7423,14 +7423,14 @@ discard block |
|
|
block discarded – undo |
7423
|
7423
|
if ($fullday) { |
7424
|
7424
|
$reset_scripts .= " if (jQuery('#fullday:checked').val() == null) {"; |
7425
|
7425
|
} |
7426
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'min\').val(\'' . dol_print_date($nowgmt, '%M', 'tzuserrel') . '\');'; |
|
7426
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'min\').val(\''.dol_print_date($nowgmt, '%M', 'tzuserrel').'\');'; |
7427
|
7427
|
if ($fullday) { |
7428
|
7428
|
$reset_scripts .= ' } '; |
7429
|
7429
|
} |
7430
|
7430
|
} |
7431
|
7431
|
// If reset_scripts is not empty, print the link with the reset_scripts in the onClick |
7432
|
7432
|
if ($reset_scripts && empty($conf->dol_optimize_smallscreen)) { |
7433
|
|
- $retstring .= ' <button class="dpInvisibleButtons datenowlink" id="' . $prefix . 'ButtonPlusOne" type="button" name="_useless2" value="plusone" onClick="' . $reset_scripts . '">'; |
|
7433
|
+ $retstring .= ' <button class="dpInvisibleButtons datenowlink" id="'.$prefix.'ButtonPlusOne" type="button" name="_useless2" value="plusone" onClick="'.$reset_scripts.'">'; |
7434
|
7434
|
$retstring .= $langs->trans("DateStartPlusOne"); |
7435
|
7435
|
$retstring .= '</button> '; |
7436
|
7436
|
} |
|
@@ -7488,17 +7488,17 @@ discard block |
|
|
block discarded – undo |
7488
|
7488
|
unset($TDurationTypes[$value]); |
7489
|
7489
|
} |
7490
|
7490
|
|
7491
|
|
- $retstring = '<select class="flat minwidth75 maxwidth100" id="select_' . $prefix . 'type_duration" name="' . $prefix . 'type_duration">'; |
|
7491
|
+ $retstring = '<select class="flat minwidth75 maxwidth100" id="select_'.$prefix.'type_duration" name="'.$prefix.'type_duration">'; |
7492
|
7492
|
foreach ($TDurationTypes as $key => $typeduration) { |
7493
|
|
- $retstring .= '<option value="' . $key . '"'; |
|
7493
|
+ $retstring .= '<option value="'.$key.'"'; |
7494
|
7494
|
if ($key == $selected) { |
7495
|
7495
|
$retstring .= " selected"; |
7496
|
7496
|
} |
7497
|
|
- $retstring .= ">" . $typeduration . "</option>"; |
|
7497
|
+ $retstring .= ">".$typeduration."</option>"; |
7498
|
7498
|
} |
7499
|
7499
|
$retstring .= "</select>"; |
7500
|
7500
|
|
7501
|
|
- $retstring .= ajax_combobox('select_' . $prefix . 'type_duration'); |
|
7501
|
+ $retstring .= ajax_combobox('select_'.$prefix.'type_duration'); |
7502
|
7502
|
|
7503
|
7503
|
return $retstring; |
7504
|
7504
|
} |
|
@@ -7530,30 +7530,30 @@ discard block |
|
|
block discarded – undo |
7530
|
7530
|
|
7531
|
7531
|
// Hours |
7532
|
7532
|
if ($iSecond != '') { |
7533
|
|
- require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php'; |
|
7533
|
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; |
7534
|
7534
|
|
7535
|
7535
|
$hourSelected = convertSecondToTime($iSecond, 'allhour'); |
7536
|
7536
|
$minSelected = convertSecondToTime($iSecond, 'min'); |
7537
|
7537
|
} |
7538
|
7538
|
|
7539
|
7539
|
if ($typehour == 'select') { |
7540
|
|
- $retstring .= '<select class="flat" id="select_' . $prefix . 'hour" name="' . $prefix . 'hour"' . ($disabled ? ' disabled' : '') . '>'; |
|
7540
|
+ $retstring .= '<select class="flat" id="select_'.$prefix.'hour" name="'.$prefix.'hour"'.($disabled ? ' disabled' : '').'>'; |
7541
|
7541
|
for ($hour = 0; $hour < 25; $hour++) { // For a duration, we allow 24 hours |
7542
|
|
- $retstring .= '<option value="' . $hour . '"'; |
|
7542
|
+ $retstring .= '<option value="'.$hour.'"'; |
7543
|
7543
|
if (is_numeric($hourSelected) && $hourSelected == $hour) { |
7544
|
7544
|
$retstring .= " selected"; |
7545
|
7545
|
} |
7546
|
|
- $retstring .= ">" . $hour . "</option>"; |
|
7546
|
+ $retstring .= ">".$hour."</option>"; |
7547
|
7547
|
} |
7548
|
7548
|
$retstring .= "</select>"; |
7549
|
7549
|
} elseif ($typehour == 'text' || $typehour == 'textselect') { |
7550
|
|
- $retstring .= '<input placeholder="' . $langs->trans('HourShort') . '" type="number" min="0" name="' . $prefix . 'hour"' . ($disabled ? ' disabled' : '') . ' class="flat maxwidth50 inputhour right" value="' . (($hourSelected != '') ? ((int) $hourSelected) : '') . '">'; |
|
7550
|
+ $retstring .= '<input placeholder="'.$langs->trans('HourShort').'" type="number" min="0" name="'.$prefix.'hour"'.($disabled ? ' disabled' : '').' class="flat maxwidth50 inputhour right" value="'.(($hourSelected != '') ? ((int) $hourSelected) : '').'">'; |
7551
|
7551
|
} else { |
7552
|
7552
|
return 'BadValueForParameterTypeHour'; |
7553
|
7553
|
} |
7554
|
7554
|
|
7555
|
7555
|
if ($typehour != 'text') { |
7556
|
|
- $retstring .= ' ' . $langs->trans('HourShort'); |
|
7556
|
+ $retstring .= ' '.$langs->trans('HourShort'); |
7557
|
7557
|
} else { |
7558
|
7558
|
$retstring .= '<span class="">:</span>'; |
7559
|
7559
|
} |
|
@@ -7568,21 +7568,21 @@ discard block |
|
|
block discarded – undo |
7568
|
7568
|
} |
7569
|
7569
|
|
7570
|
7570
|
if ($typehour == 'select' || $typehour == 'textselect') { |
7571
|
|
- $retstring .= '<select class="flat" id="select_' . $prefix . 'min" name="' . $prefix . 'min"' . ($disabled ? ' disabled' : '') . '>'; |
|
7571
|
+ $retstring .= '<select class="flat" id="select_'.$prefix.'min" name="'.$prefix.'min"'.($disabled ? ' disabled' : '').'>'; |
7572
|
7572
|
for ($min = 0; $min <= 55; $min += 5) { |
7573
|
|
- $retstring .= '<option value="' . $min . '"'; |
|
7573
|
+ $retstring .= '<option value="'.$min.'"'; |
7574
|
7574
|
if (is_numeric($minSelected) && $minSelected == $min) { |
7575
|
7575
|
$retstring .= ' selected'; |
7576
|
7576
|
} |
7577
|
|
- $retstring .= '>' . $min . '</option>'; |
|
7577
|
+ $retstring .= '>'.$min.'</option>'; |
7578
|
7578
|
} |
7579
|
7579
|
$retstring .= "</select>"; |
7580
|
7580
|
} elseif ($typehour == 'text') { |
7581
|
|
- $retstring .= '<input placeholder="' . $langs->trans('MinuteShort') . '" type="number" min="0" name="' . $prefix . 'min"' . ($disabled ? ' disabled' : '') . ' class="flat maxwidth50 inputminute right" value="' . (($minSelected != '') ? ((int) $minSelected) : '') . '">'; |
|
7581
|
+ $retstring .= '<input placeholder="'.$langs->trans('MinuteShort').'" type="number" min="0" name="'.$prefix.'min"'.($disabled ? ' disabled' : '').' class="flat maxwidth50 inputminute right" value="'.(($minSelected != '') ? ((int) $minSelected) : '').'">'; |
7582
|
7582
|
} |
7583
|
7583
|
|
7584
|
7584
|
if ($typehour != 'text') { |
7585
|
|
- $retstring .= ' ' . $langs->trans('MinuteShort'); |
|
7585
|
+ $retstring .= ' '.$langs->trans('MinuteShort'); |
7586
|
7586
|
} |
7587
|
7587
|
|
7588
|
7588
|
$retstring .= "</span>"; |
|
@@ -7630,7 +7630,7 @@ discard block |
|
|
block discarded – undo |
7630
|
7630
|
$placeholder = ''; |
7631
|
7631
|
|
7632
|
7632
|
if ($selected && empty($selected_input_value)) { |
7633
|
|
- require_once DOL_DOCUMENT_ROOT . '/ticket/class/ticket.class.php'; |
|
7633
|
+ require_once DOL_DOCUMENT_ROOT.'/ticket/class/ticket.class.php'; |
7634
|
7634
|
$tickettmpselect = new Ticket($this->db); |
7635
|
7635
|
$tickettmpselect->fetch($selected); |
7636
|
7636
|
$selected_input_value = $tickettmpselect->ref; |
|
@@ -7638,17 +7638,17 @@ discard block |
|
|
block discarded – undo |
7638
|
7638
|
} |
7639
|
7639
|
|
7640
|
7640
|
$urloption = ''; |
7641
|
|
- $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/ticket/ajax/tickets.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions); |
|
7641
|
+ $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/ticket/ajax/tickets.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions); |
7642
|
7642
|
|
7643
|
7643
|
if (empty($hidelabel)) { |
7644
|
|
- $out .= $langs->trans("RefOrLabel") . ' : '; |
|
7644
|
+ $out .= $langs->trans("RefOrLabel").' : '; |
7645
|
7645
|
} elseif ($hidelabel > 1) { |
7646
|
|
- $placeholder = ' placeholder="' . $langs->trans("RefOrLabel") . '"'; |
|
7646
|
+ $placeholder = ' placeholder="'.$langs->trans("RefOrLabel").'"'; |
7647
|
7647
|
if ($hidelabel == 2) { |
7648
|
7648
|
$out .= img_picto($langs->trans("Search"), 'search'); |
7649
|
7649
|
} |
7650
|
7650
|
} |
7651
|
|
- $out .= '<input type="text" class="minwidth100" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . $placeholder . ' ' . (getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '') . ' />'; |
|
7651
|
+ $out .= '<input type="text" class="minwidth100" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' '.(getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '').' />'; |
7652
|
7652
|
if ($hidelabel == 3) { |
7653
|
7653
|
$out .= img_picto($langs->trans("Search"), 'search'); |
7654
|
7654
|
} |
|
@@ -7692,8 +7692,8 @@ discard block |
|
|
block discarded – undo |
7692
|
7692
|
|
7693
|
7693
|
$sql = "SELECT "; |
7694
|
7694
|
$sql .= $selectFields; |
7695
|
|
- $sql .= " FROM " . $this->db->prefix() . "ticket as p"; |
7696
|
|
- $sql .= ' WHERE p.entity IN (' . getEntity('ticket') . ')'; |
|
7695
|
+ $sql .= " FROM ".$this->db->prefix()."ticket as p"; |
|
7696
|
+ $sql .= ' WHERE p.entity IN ('.getEntity('ticket').')'; |
7697
|
7697
|
|
7698
|
7698
|
// Add criteria on ref/label |
7699
|
7699
|
if ($filterkey != '') { |
|
@@ -7709,7 +7709,7 @@ discard block |
|
|
block discarded – undo |
7709
|
7709
|
if ($i > 0) { |
7710
|
7710
|
$sql .= " AND "; |
7711
|
7711
|
} |
7712
|
|
- $sql .= "(p.ref LIKE '" . $this->db->escape($prefix . $crit) . "%' OR p.subject LIKE '" . $this->db->escape($prefix . $crit) . "%'"; |
|
7712
|
+ $sql .= "(p.ref LIKE '".$this->db->escape($prefix.$crit)."%' OR p.subject LIKE '".$this->db->escape($prefix.$crit)."%'"; |
7713
|
7713
|
$sql .= ")"; |
7714
|
7714
|
$i++; |
7715
|
7715
|
} |
|
@@ -7722,22 +7722,22 @@ discard block |
|
|
block discarded – undo |
7722
|
7722
|
$sql .= $this->db->plimit($limit, 0); |
7723
|
7723
|
|
7724
|
7724
|
// Build output string |
7725
|
|
- dol_syslog(get_class($this) . "::selectTicketsList search tickets", LOG_DEBUG); |
|
7725
|
+ dol_syslog(get_class($this)."::selectTicketsList search tickets", LOG_DEBUG); |
7726
|
7726
|
$result = $this->db->query($sql); |
7727
|
7727
|
if ($result) { |
7728
|
|
- require_once DOL_DOCUMENT_ROOT . '/ticket/class/ticket.class.php'; |
7729
|
|
- require_once DOL_DOCUMENT_ROOT . '/core/lib/ticket.lib.php'; |
|
7728
|
+ require_once DOL_DOCUMENT_ROOT.'/ticket/class/ticket.class.php'; |
|
7729
|
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/ticket.lib.php'; |
7730
|
7730
|
|
7731
|
7731
|
$num = $this->db->num_rows($result); |
7732
|
7732
|
|
7733
|
7733
|
$events = array(); |
7734
|
7734
|
|
7735
|
7735
|
if (!$forcecombo) { |
7736
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
7736
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
7737
|
7737
|
$out .= ajax_combobox($htmlname, $events, getDolGlobalInt('TICKET_USE_SEARCH_TO_SELECT')); |
7738
|
7738
|
} |
7739
|
7739
|
|
7740
|
|
- $out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">'; |
|
7740
|
+ $out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">'; |
7741
|
7741
|
|
7742
|
7742
|
$textifempty = ''; |
7743
|
7743
|
// Do not use textifempty = ' ' or ' ' here, or search on key will search on ' key'. |
|
@@ -7754,7 +7754,7 @@ discard block |
|
|
block discarded – undo |
7754
|
7754
|
} |
7755
|
7755
|
} |
7756
|
7756
|
if ($showempty) { |
7757
|
|
- $out .= '<option value="0" selected>' . $textifempty . '</option>'; |
|
7757
|
+ $out .= '<option value="0" selected>'.$textifempty.'</option>'; |
7758
|
7758
|
} |
7759
|
7759
|
|
7760
|
7760
|
$i = 0; |
|
@@ -7808,13 +7808,13 @@ discard block |
|
|
block discarded – undo |
7808
|
7808
|
$outkey = $objp->rowid; |
7809
|
7809
|
$outref = $objp->ref; |
7810
|
7810
|
|
7811
|
|
- $opt = '<option value="' . $objp->rowid . '"'; |
|
7811
|
+ $opt = '<option value="'.$objp->rowid.'"'; |
7812
|
7812
|
$opt .= ($objp->rowid == $selected) ? ' selected' : ''; |
7813
|
7813
|
$opt .= '>'; |
7814
|
7814
|
$opt .= $objp->ref; |
7815
|
7815
|
$objRef = $objp->ref; |
7816
|
7816
|
if (!empty($filterkey) && $filterkey != '') { |
7817
|
|
- $objRef = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $objRef, 1); |
|
7817
|
+ $objRef = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $objRef, 1); |
7818
|
7818
|
} |
7819
|
7819
|
|
7820
|
7820
|
$opt .= "</option>\n"; |
|
@@ -7855,7 +7855,7 @@ discard block |
|
|
block discarded – undo |
7855
|
7855
|
$placeholder = ''; |
7856
|
7856
|
|
7857
|
7857
|
if ($selected && empty($selected_input_value)) { |
7858
|
|
- require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; |
|
7858
|
+ require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; |
7859
|
7859
|
$projecttmpselect = new Project($this->db); |
7860
|
7860
|
$projecttmpselect->fetch($selected); |
7861
|
7861
|
$selected_input_value = $projecttmpselect->ref; |
|
@@ -7863,17 +7863,17 @@ discard block |
|
|
block discarded – undo |
7863
|
7863
|
} |
7864
|
7864
|
|
7865
|
7865
|
$urloption = ''; |
7866
|
|
- $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/projet/ajax/projects.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions); |
|
7866
|
+ $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/projet/ajax/projects.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions); |
7867
|
7867
|
|
7868
|
7868
|
if (empty($hidelabel)) { |
7869
|
|
- $out .= $langs->trans("RefOrLabel") . ' : '; |
|
7869
|
+ $out .= $langs->trans("RefOrLabel").' : '; |
7870
|
7870
|
} elseif ($hidelabel > 1) { |
7871
|
|
- $placeholder = ' placeholder="' . $langs->trans("RefOrLabel") . '"'; |
|
7871
|
+ $placeholder = ' placeholder="'.$langs->trans("RefOrLabel").'"'; |
7872
|
7872
|
if ($hidelabel == 2) { |
7873
|
7873
|
$out .= img_picto($langs->trans("Search"), 'search'); |
7874
|
7874
|
} |
7875
|
7875
|
} |
7876
|
|
- $out .= '<input type="text" class="minwidth100" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . $placeholder . ' ' . (getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '') . ' />'; |
|
7876
|
+ $out .= '<input type="text" class="minwidth100" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' '.(getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '').' />'; |
7877
|
7877
|
if ($hidelabel == 3) { |
7878
|
7878
|
$out .= img_picto($langs->trans("Search"), 'search'); |
7879
|
7879
|
} |
|
@@ -7916,8 +7916,8 @@ discard block |
|
|
block discarded – undo |
7916
|
7916
|
|
7917
|
7917
|
$sql = "SELECT "; |
7918
|
7918
|
$sql .= $selectFields; |
7919
|
|
- $sql .= " FROM " . $this->db->prefix() . "projet as p"; |
7920
|
|
- $sql .= ' WHERE p.entity IN (' . getEntity('project') . ')'; |
|
7919
|
+ $sql .= " FROM ".$this->db->prefix()."projet as p"; |
|
7920
|
+ $sql .= ' WHERE p.entity IN ('.getEntity('project').')'; |
7921
|
7921
|
|
7922
|
7922
|
// Add criteria on ref/label |
7923
|
7923
|
if ($filterkey != '') { |
|
@@ -7933,7 +7933,7 @@ discard block |
|
|
block discarded – undo |
7933
|
7933
|
if ($i > 0) { |
7934
|
7934
|
$sql .= " AND "; |
7935
|
7935
|
} |
7936
|
|
- $sql .= "p.ref LIKE '" . $this->db->escape($prefix . $crit) . "%'"; |
|
7936
|
+ $sql .= "p.ref LIKE '".$this->db->escape($prefix.$crit)."%'"; |
7937
|
7937
|
$sql .= ""; |
7938
|
7938
|
$i++; |
7939
|
7939
|
} |
|
@@ -7946,22 +7946,22 @@ discard block |
|
|
block discarded – undo |
7946
|
7946
|
$sql .= $this->db->plimit($limit, 0); |
7947
|
7947
|
|
7948
|
7948
|
// Build output string |
7949
|
|
- dol_syslog(get_class($this) . "::selectProjectsList search projects", LOG_DEBUG); |
|
7949
|
+ dol_syslog(get_class($this)."::selectProjectsList search projects", LOG_DEBUG); |
7950
|
7950
|
$result = $this->db->query($sql); |
7951
|
7951
|
if ($result) { |
7952
|
|
- require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; |
7953
|
|
- require_once DOL_DOCUMENT_ROOT . '/core/lib/project.lib.php'; |
|
7952
|
+ require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; |
|
7953
|
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php'; |
7954
|
7954
|
|
7955
|
7955
|
$num = $this->db->num_rows($result); |
7956
|
7956
|
|
7957
|
7957
|
$events = array(); |
7958
|
7958
|
|
7959
|
7959
|
if (!$forcecombo) { |
7960
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
7960
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
7961
|
7961
|
$out .= ajax_combobox($htmlname, $events, getDolGlobalInt('PROJECT_USE_SEARCH_TO_SELECT')); |
7962
|
7962
|
} |
7963
|
7963
|
|
7964
|
|
- $out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">'; |
|
7964
|
+ $out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">'; |
7965
|
7965
|
|
7966
|
7966
|
$textifempty = ''; |
7967
|
7967
|
// Do not use textifempty = ' ' or ' ' here, or search on key will search on ' key'. |
|
@@ -7978,7 +7978,7 @@ discard block |
|
|
block discarded – undo |
7978
|
7978
|
} |
7979
|
7979
|
} |
7980
|
7980
|
if ($showempty) { |
7981
|
|
- $out .= '<option value="0" selected>' . $textifempty . '</option>'; |
|
7981
|
+ $out .= '<option value="0" selected>'.$textifempty.'</option>'; |
7982
|
7982
|
} |
7983
|
7983
|
|
7984
|
7984
|
$i = 0; |
|
@@ -8036,13 +8036,13 @@ discard block |
|
|
block discarded – undo |
8036
|
8036
|
$outlabel = $objp->label; |
8037
|
8037
|
$outtype = $objp->fk_product_type; |
8038
|
8038
|
|
8039
|
|
- $opt = '<option value="' . $objp->rowid . '"'; |
|
8039
|
+ $opt = '<option value="'.$objp->rowid.'"'; |
8040
|
8040
|
$opt .= ($objp->rowid == $selected) ? ' selected' : ''; |
8041
|
8041
|
$opt .= '>'; |
8042
|
8042
|
$opt .= $objp->ref; |
8043
|
8043
|
$objRef = $objp->ref; |
8044
|
8044
|
if (!empty($filterkey) && $filterkey != '') { |
8045
|
|
- $objRef = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $objRef, 1); |
|
8045
|
+ $objRef = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $objRef, 1); |
8046
|
8046
|
} |
8047
|
8047
|
|
8048
|
8048
|
$opt .= "</option>\n"; |
|
@@ -8084,7 +8084,7 @@ discard block |
|
|
block discarded – undo |
8084
|
8084
|
$placeholder = ''; |
8085
|
8085
|
|
8086
|
8086
|
if ($selected && empty($selected_input_value)) { |
8087
|
|
- require_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php'; |
|
8087
|
+ require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; |
8088
|
8088
|
$adherenttmpselect = new Adherent($this->db); |
8089
|
8089
|
$adherenttmpselect->fetch($selected); |
8090
|
8090
|
$selected_input_value = $adherenttmpselect->ref; |
|
@@ -8093,17 +8093,17 @@ discard block |
|
|
block discarded – undo |
8093
|
8093
|
|
8094
|
8094
|
$urloption = ''; |
8095
|
8095
|
|
8096
|
|
- $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/adherents/ajax/adherents.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions); |
|
8096
|
+ $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/adherents/ajax/adherents.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions); |
8097
|
8097
|
|
8098
|
8098
|
if (empty($hidelabel)) { |
8099
|
|
- $out .= $langs->trans("RefOrLabel") . ' : '; |
|
8099
|
+ $out .= $langs->trans("RefOrLabel").' : '; |
8100
|
8100
|
} elseif ($hidelabel > 1) { |
8101
|
|
- $placeholder = ' placeholder="' . $langs->trans("RefOrLabel") . '"'; |
|
8101
|
+ $placeholder = ' placeholder="'.$langs->trans("RefOrLabel").'"'; |
8102
|
8102
|
if ($hidelabel == 2) { |
8103
|
8103
|
$out .= img_picto($langs->trans("Search"), 'search'); |
8104
|
8104
|
} |
8105
|
8105
|
} |
8106
|
|
- $out .= '<input type="text" class="minwidth100" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . $placeholder . ' ' . (getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '') . ' />'; |
|
8106
|
+ $out .= '<input type="text" class="minwidth100" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' '.(getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '').' />'; |
8107
|
8107
|
if ($hidelabel == 3) { |
8108
|
8108
|
$out .= img_picto($langs->trans("Search"), 'search'); |
8109
|
8109
|
} |
|
@@ -8148,8 +8148,8 @@ discard block |
|
|
block discarded – undo |
8148
|
8148
|
|
8149
|
8149
|
$sql = "SELECT "; |
8150
|
8150
|
$sql .= $selectFields; |
8151
|
|
- $sql .= " FROM " . $this->db->prefix() . "adherent as p"; |
8152
|
|
- $sql .= ' WHERE p.entity IN (' . getEntity('adherent') . ')'; |
|
8151
|
+ $sql .= " FROM ".$this->db->prefix()."adherent as p"; |
|
8152
|
+ $sql .= ' WHERE p.entity IN ('.getEntity('adherent').')'; |
8153
|
8153
|
|
8154
|
8154
|
// Add criteria on ref/label |
8155
|
8155
|
if ($filterkey != '') { |
|
@@ -8165,8 +8165,8 @@ discard block |
|
|
block discarded – undo |
8165
|
8165
|
if ($i > 0) { |
8166
|
8166
|
$sql .= " AND "; |
8167
|
8167
|
} |
8168
|
|
- $sql .= "(p.firstname LIKE '" . $this->db->escape($prefix . $crit) . "%'"; |
8169
|
|
- $sql .= " OR p.lastname LIKE '" . $this->db->escape($prefix . $crit) . "%')"; |
|
8168
|
+ $sql .= "(p.firstname LIKE '".$this->db->escape($prefix.$crit)."%'"; |
|
8169
|
+ $sql .= " OR p.lastname LIKE '".$this->db->escape($prefix.$crit)."%')"; |
8170
|
8170
|
$i++; |
8171
|
8171
|
} |
8172
|
8172
|
if (count($search_crit) > 1) { |
|
@@ -8175,27 +8175,27 @@ discard block |
|
|
block discarded – undo |
8175
|
8175
|
$sql .= ')'; |
8176
|
8176
|
} |
8177
|
8177
|
if ($status != -1) { |
8178
|
|
- $sql .= ' AND statut = ' . ((int) $status); |
|
8178
|
+ $sql .= ' AND statut = '.((int) $status); |
8179
|
8179
|
} |
8180
|
8180
|
$sql .= $this->db->plimit($limit, 0); |
8181
|
8181
|
|
8182
|
8182
|
// Build output string |
8183
|
|
- dol_syslog(get_class($this) . "::selectMembersList search adherents", LOG_DEBUG); |
|
8183
|
+ dol_syslog(get_class($this)."::selectMembersList search adherents", LOG_DEBUG); |
8184
|
8184
|
$result = $this->db->query($sql); |
8185
|
8185
|
if ($result) { |
8186
|
|
- require_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php'; |
8187
|
|
- require_once DOL_DOCUMENT_ROOT . '/core/lib/member.lib.php'; |
|
8186
|
+ require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; |
|
8187
|
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php'; |
8188
|
8188
|
|
8189
|
8189
|
$num = $this->db->num_rows($result); |
8190
|
8190
|
|
8191
|
8191
|
$events = array(); |
8192
|
8192
|
|
8193
|
8193
|
if (!$forcecombo) { |
8194
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
8194
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
8195
|
8195
|
$out .= ajax_combobox($htmlname, $events, getDolGlobalString('PROJECT_USE_SEARCH_TO_SELECT') ? $conf->global->PROJECT_USE_SEARCH_TO_SELECT : ''); |
8196
|
8196
|
} |
8197
|
8197
|
|
8198
|
|
- $out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">'; |
|
8198
|
+ $out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">'; |
8199
|
8199
|
|
8200
|
8200
|
$textifempty = ''; |
8201
|
8201
|
// Do not use textifempty = ' ' or ' ' here, or search on key will search on ' key'. |
|
@@ -8212,7 +8212,7 @@ discard block |
|
|
block discarded – undo |
8212
|
8212
|
} |
8213
|
8213
|
} |
8214
|
8214
|
if ($showempty) { |
8215
|
|
- $out .= '<option value="-1" selected>' . $textifempty . '</option>'; |
|
8215
|
+ $out .= '<option value="-1" selected>'.$textifempty.'</option>'; |
8216
|
8216
|
} |
8217
|
8217
|
|
8218
|
8218
|
$i = 0; |
|
@@ -8268,11 +8268,11 @@ discard block |
|
|
block discarded – undo |
8268
|
8268
|
$outlabel = dolGetFirstLastname($objp->firstname, $objp->lastname); |
8269
|
8269
|
$outtype = $objp->fk_adherent_type; |
8270
|
8270
|
|
8271
|
|
- $opt = '<option value="' . $objp->rowid . '"'; |
|
8271
|
+ $opt = '<option value="'.$objp->rowid.'"'; |
8272
|
8272
|
$opt .= ($objp->rowid == $selected) ? ' selected' : ''; |
8273
|
8273
|
$opt .= '>'; |
8274
|
8274
|
if (!empty($filterkey) && $filterkey != '') { |
8275
|
|
- $outlabel = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $outlabel, 1); |
|
8275
|
+ $outlabel = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $outlabel, 1); |
8276
|
8276
|
} |
8277
|
8277
|
$opt .= $outlabel; |
8278
|
8278
|
$opt .= "</option>\n"; |
|
@@ -8327,8 +8327,8 @@ discard block |
|
|
block discarded – undo |
8327
|
8327
|
$objecttmp = null; |
8328
|
8328
|
$InfoFieldList = array(); |
8329
|
8329
|
$classname = ''; |
8330
|
|
- $filter = ''; // Ensure filter has value (for static analysis) |
8331
|
|
- $sortfield = ''; // Ensure filter has value (for static analysis) |
|
8330
|
+ $filter = ''; // Ensure filter has value (for static analysis) |
|
8331
|
+ $sortfield = ''; // Ensure filter has value (for static analysis) |
8332
|
8332
|
|
8333
|
8333
|
if ($objectfield) { // We must retrieve the objectdesc from the field or extrafield |
8334
|
8334
|
// Example: $objectfield = 'product:options_package' or 'myobject@mymodule:options_myfield' |
|
@@ -8372,9 +8372,9 @@ discard block |
|
|
block discarded – undo |
8372
|
8372
|
$vartmp = (empty($InfoFieldList[3]) ? '' : $InfoFieldList[3]); |
8373
|
8373
|
$reg = array(); |
8374
|
8374
|
if (preg_match('/^.*:(\w*)$/', $vartmp, $reg)) { |
8375
|
|
- $InfoFieldList[4] = $reg[1]; // take the sort field |
|
8375
|
+ $InfoFieldList[4] = $reg[1]; // take the sort field |
8376
|
8376
|
} |
8377
|
|
- $InfoFieldList[3] = preg_replace('/:\w*$/', '', $vartmp); // take the filter field |
|
8377
|
+ $InfoFieldList[3] = preg_replace('/:\w*$/', '', $vartmp); // take the filter field |
8378
|
8378
|
|
8379
|
8379
|
$classname = $InfoFieldList[0]; |
8380
|
8380
|
$classpath = empty($InfoFieldList[1]) ? '' : $InfoFieldList[1]; |
|
@@ -8405,8 +8405,8 @@ discard block |
|
|
block discarded – undo |
8405
|
8405
|
); |
8406
|
8406
|
|
8407
|
8407
|
if (!is_object($objecttmp)) { |
8408
|
|
- dol_syslog('selectForForms: Error bad setup of field objectdescorig=' . $objectdescorig.', objectfield='.$objectfield.', objectdesc='.$objectdesc, LOG_WARNING); |
8409
|
|
- return 'selectForForms: Error bad setup of field objectdescorig=' . $objectdescorig.', objectfield='.$objectfield.', objectdesc='.$objectdesc; |
|
8408
|
+ dol_syslog('selectForForms: Error bad setup of field objectdescorig='.$objectdescorig.', objectfield='.$objectfield.', objectdesc='.$objectdesc, LOG_WARNING); |
|
8409
|
+ return 'selectForForms: Error bad setup of field objectdescorig='.$objectdescorig.', objectfield='.$objectfield.', objectdesc='.$objectdesc; |
8410
|
8410
|
} |
8411
|
8411
|
'@phan-var-force CommonObject $objecttmp'; |
8412
|
8412
|
|
|
@@ -8418,9 +8418,9 @@ discard block |
|
|
block discarded – undo |
8418
|
8418
|
if ($prefixforautocompletemode == 'product') { |
8419
|
8419
|
$prefixforautocompletemode = 'produit'; |
8420
|
8420
|
} |
8421
|
|
- $confkeyforautocompletemode = strtoupper($prefixforautocompletemode) . '_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT |
|
8421
|
+ $confkeyforautocompletemode = strtoupper($prefixforautocompletemode).'_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT |
8422
|
8422
|
|
8423
|
|
- dol_syslog(get_class($this) . "::selectForForms filter=" . $filter, LOG_DEBUG); |
|
8423
|
+ dol_syslog(get_class($this)."::selectForForms filter=".$filter, LOG_DEBUG); |
8424
|
8424
|
|
8425
|
8425
|
// Generate the combo HTML component |
8426
|
8426
|
$out = ''; |
|
@@ -8449,13 +8449,13 @@ discard block |
|
|
block discarded – undo |
8449
|
8449
|
} |
8450
|
8450
|
|
8451
|
8451
|
// Set url and param to call to get json of the search results |
8452
|
|
- $urlforajaxcall = DOL_URL_ROOT . '/core/ajax/selectobject.php'; |
8453
|
|
- $urloption = 'htmlname=' . urlencode($htmlname) . '&outjson=1&objectdesc=' . urlencode($objectdescorig) . '&objectfield='.urlencode($objectfield) . ($sortfield ? '&sortfield=' . urlencode($sortfield) : ''); |
|
8452
|
+ $urlforajaxcall = DOL_URL_ROOT.'/core/ajax/selectobject.php'; |
|
8453
|
+ $urloption = 'htmlname='.urlencode($htmlname).'&outjson=1&objectdesc='.urlencode($objectdescorig).'&objectfield='.urlencode($objectfield).($sortfield ? '&sortfield='.urlencode($sortfield) : ''); |
8454
|
8454
|
|
8455
|
8455
|
// Activate the auto complete using ajax call. |
8456
|
8456
|
$out .= ajax_autocompleter((string) $preSelectedValue, $htmlname, $urlforajaxcall, $urloption, getDolGlobalInt($confkeyforautocompletemode), 0); |
8457
|
8457
|
$out .= '<!-- force css to be higher than dialog popup --><style type="text/css">.ui-autocomplete { z-index: 1010; }</style>'; |
8458
|
|
- $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) . '"' : '') . ' />'; |
|
8458
|
+ $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).'"' : '').' />'; |
8459
|
8459
|
} else { |
8460
|
8460
|
// Immediate load of table record. |
8461
|
8461
|
$out .= $this->selectForFormsList($objecttmp, $htmlname, $preSelectedValue, $showempty, $searchkey, $placeholder, $morecss, $moreparams, $forcecombo, 0, $disabled, $sortfield, $filter); |
|
@@ -8495,16 +8495,16 @@ discard block |
|
|
block discarded – undo |
8495
|
8495
|
if ($prefixforautocompletemode == 'societe') { |
8496
|
8496
|
$prefixforautocompletemode = 'company'; |
8497
|
8497
|
} |
8498
|
|
- $confkeyforautocompletemode = strtoupper($prefixforautocompletemode) . '_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT |
|
8498
|
+ $confkeyforautocompletemode = strtoupper($prefixforautocompletemode).'_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT |
8499
|
8499
|
|
8500
|
8500
|
if (!empty($objecttmp->fields)) { // For object that declare it, it is better to use declared fields (like societe, contact, ...) |
8501
|
8501
|
$tmpfieldstoshow = ''; |
8502
|
8502
|
foreach ($objecttmp->fields as $key => $val) { |
8503
|
|
- if (! (int) dol_eval($val['enabled'], 1, 1, '1')) { |
|
8503
|
+ if (!(int) dol_eval($val['enabled'], 1, 1, '1')) { |
8504
|
8504
|
continue; |
8505
|
8505
|
} |
8506
|
8506
|
if (!empty($val['showoncombobox'])) { |
8507
|
|
- $tmpfieldstoshow .= ($tmpfieldstoshow ? ',' : '') . 't.' . $key; |
|
8507
|
+ $tmpfieldstoshow .= ($tmpfieldstoshow ? ',' : '').'t.'.$key; |
8508
|
8508
|
} |
8509
|
8509
|
} |
8510
|
8510
|
if ($tmpfieldstoshow) { |
|
@@ -8532,18 +8532,18 @@ discard block |
|
|
block discarded – undo |
8532
|
8532
|
$num = 0; |
8533
|
8533
|
|
8534
|
8534
|
// Search data |
8535
|
|
- $sql = "SELECT t.rowid, " . $fieldstoshow . " FROM " . $this->db->prefix() . $objecttmp->table_element . " as t"; |
|
8535
|
+ $sql = "SELECT t.rowid, ".$fieldstoshow." FROM ".$this->db->prefix().$objecttmp->table_element." as t"; |
8536
|
8536
|
if (!empty($objecttmp->isextrafieldmanaged)) { |
8537
|
|
- $sql .= " LEFT JOIN " . $this->db->prefix() . $objecttmp->table_element . "_extrafields as e ON t.rowid=e.fk_object"; |
|
8537
|
+ $sql .= " LEFT JOIN ".$this->db->prefix().$objecttmp->table_element."_extrafields as e ON t.rowid=e.fk_object"; |
8538
|
8538
|
} |
8539
|
8539
|
if (isset($objecttmp->ismultientitymanaged)) { |
8540
|
8540
|
if (!is_numeric($objecttmp->ismultientitymanaged)) { |
8541
|
8541
|
$tmparray = explode('@', $objecttmp->ismultientitymanaged); |
8542
|
|
- $sql .= " INNER JOIN " . $this->db->prefix() . $tmparray[1] . " as parenttable ON parenttable.rowid = t." . $tmparray[0]; |
|
8542
|
+ $sql .= " INNER JOIN ".$this->db->prefix().$tmparray[1]." as parenttable ON parenttable.rowid = t.".$tmparray[0]; |
8543
|
8543
|
} |
8544
|
8544
|
if ($objecttmp->ismultientitymanaged === 'fk_soc@societe') { |
8545
|
8545
|
if (!$user->hasRight('societe', 'client', 'voir')) { |
8546
|
|
- $sql .= ", " . $this->db->prefix() . "societe_commerciaux as sc"; |
|
8546
|
+ $sql .= ", ".$this->db->prefix()."societe_commerciaux as sc"; |
8547
|
8547
|
} |
8548
|
8548
|
} |
8549
|
8549
|
} |
|
@@ -8563,21 +8563,21 @@ discard block |
|
|
block discarded – undo |
8563
|
8563
|
$sql .= " WHERE 1=1"; |
8564
|
8564
|
if (isset($objecttmp->ismultientitymanaged)) { |
8565
|
8565
|
if ($objecttmp->ismultientitymanaged == 1) { |
8566
|
|
- $sql .= " AND t.entity IN (" . getEntity($objecttmp->table_element) . ")"; |
|
8566
|
+ $sql .= " AND t.entity IN (".getEntity($objecttmp->table_element).")"; |
8567
|
8567
|
} |
8568
|
8568
|
if (!is_numeric($objecttmp->ismultientitymanaged)) { |
8569
|
|
- $sql .= " AND parenttable.entity = t." . $tmparray[0]; |
|
8569
|
+ $sql .= " AND parenttable.entity = t.".$tmparray[0]; |
8570
|
8570
|
} |
8571
|
8571
|
if ($objecttmp->ismultientitymanaged == 1 && !empty($user->socid)) { |
8572
|
8572
|
if ($objecttmp->element == 'societe') { |
8573
|
|
- $sql .= " AND t.rowid = " . ((int) $user->socid); |
|
8573
|
+ $sql .= " AND t.rowid = ".((int) $user->socid); |
8574
|
8574
|
} else { |
8575
|
|
- $sql .= " AND t.fk_soc = " . ((int) $user->socid); |
|
8575
|
+ $sql .= " AND t.fk_soc = ".((int) $user->socid); |
8576
|
8576
|
} |
8577
|
8577
|
} |
8578
|
8578
|
if ($objecttmp->ismultientitymanaged === 'fk_soc@societe') { |
8579
|
8579
|
if (!$user->hasRight('societe', 'client', 'voir')) { |
8580
|
|
- $sql .= " AND t.rowid = sc.fk_soc AND sc.fk_user = " . ((int) $user->id); |
|
8580
|
+ $sql .= " AND t.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id); |
8581
|
8581
|
} |
8582
|
8582
|
} |
8583
|
8583
|
} |
|
@@ -8589,7 +8589,7 @@ discard block |
|
|
block discarded – undo |
8589
|
8589
|
$errormessage = ''; |
8590
|
8590
|
$sql .= forgeSQLFromUniversalSearchCriteria($filter, $errormessage); |
8591
|
8591
|
if ($errormessage) { |
8592
|
|
- return 'Error forging a SQL request from an universal criteria: ' . $errormessage; |
|
8592
|
+ return 'Error forging a SQL request from an universal criteria: '.$errormessage; |
8593
|
8593
|
} |
8594
|
8594
|
} |
8595
|
8595
|
} |
|
@@ -8601,7 +8601,7 @@ discard block |
|
|
block discarded – undo |
8601
|
8601
|
$resql = $this->db->query($sql); |
8602
|
8602
|
if ($resql) { |
8603
|
8603
|
// Construct $out and $outarray |
8604
|
|
- $out .= '<select id="' . $htmlname . '" class="flat minwidth100' . ($morecss ? ' ' . $morecss : '') . '"' . ($disabled ? ' disabled="disabled"' : '') . ($moreparams ? ' ' . $moreparams : '') . ' name="' . $htmlname . '">' . "\n"; |
|
8604
|
+ $out .= '<select id="'.$htmlname.'" class="flat minwidth100'.($morecss ? ' '.$morecss : '').'"'.($disabled ? ' disabled="disabled"' : '').($moreparams ? ' '.$moreparams : '').' name="'.$htmlname.'">'."\n"; |
8605
|
8605
|
|
8606
|
8606
|
// Warning: Do not use textifempty = ' ' or ' ' here, or search on key will search on ' key'. Seems it is no more true with selec2 v4 |
8607
|
8607
|
$textifempty = ' '; |
|
@@ -8615,7 +8615,7 @@ discard block |
|
|
block discarded – undo |
8615
|
8615
|
} |
8616
|
8616
|
} |
8617
|
8617
|
if ($showempty) { |
8618
|
|
- $out .= '<option value="-1">' . $textifempty . '</option>' . "\n"; |
|
8618
|
+ $out .= '<option value="-1">'.$textifempty.'</option>'."\n"; |
8619
|
8619
|
} |
8620
|
8620
|
|
8621
|
8621
|
$num = $this->db->num_rows($resql); |
|
@@ -8638,9 +8638,9 @@ discard block |
|
|
block discarded – undo |
8638
|
8638
|
} |
8639
|
8639
|
if (empty($outputmode)) { |
8640
|
8640
|
if ($preselectedvalue > 0 && $preselectedvalue == $obj->rowid) { |
8641
|
|
- $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>'; |
|
8641
|
+ $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>'; |
8642
|
8642
|
} else { |
8643
|
|
- $out .= '<option value="' . $obj->rowid . '" data-html="' . dol_escape_htmltag($labelhtml, 0, 0, '', 0, 1) . '">' . dol_escape_htmltag($label, 0, 0, '', 0, 1) . '</option>'; |
|
8643
|
+ $out .= '<option value="'.$obj->rowid.'" data-html="'.dol_escape_htmltag($labelhtml, 0, 0, '', 0, 1).'">'.dol_escape_htmltag($label, 0, 0, '', 0, 1).'</option>'; |
8644
|
8644
|
} |
8645
|
8645
|
} else { |
8646
|
8646
|
array_push($outarray, array('key' => $obj->rowid, 'value' => $label, 'label' => $label)); |
|
@@ -8653,10 +8653,10 @@ discard block |
|
|
block discarded – undo |
8653
|
8653
|
} |
8654
|
8654
|
} |
8655
|
8655
|
|
8656
|
|
- $out .= '</select>' . "\n"; |
|
8656
|
+ $out .= '</select>'."\n"; |
8657
|
8657
|
|
8658
|
8658
|
if (!$forcecombo) { |
8659
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
8659
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
8660
|
8660
|
$out .= ajax_combobox($htmlname, array(), getDolGlobalInt($confkeyforautocompletemode, 0)); |
8661
|
8661
|
} |
8662
|
8662
|
} else { |
|
@@ -8720,8 +8720,8 @@ discard block |
|
|
block discarded – undo |
8720
|
8720
|
} |
8721
|
8721
|
} |
8722
|
8722
|
$idname = str_replace(array('[', ']'), array('', ''), $htmlname); |
8723
|
|
- $out .= '<select id="' . preg_replace('/^\./', '', $idname) . '" ' . ($disabled ? 'disabled="disabled" ' : '') . 'class="flat ' . (preg_replace('/^\./', '', $htmlname)) . ($morecss ? ' ' . $morecss : '') . ' selectformat"'; |
8724
|
|
- $out .= ' name="' . preg_replace('/^\./', '', $htmlname) . '" ' . ($moreparam ? $moreparam : ''); |
|
8723
|
+ $out .= '<select id="'.preg_replace('/^\./', '', $idname).'" '.($disabled ? 'disabled="disabled" ' : '').'class="flat '.(preg_replace('/^\./', '', $htmlname)).($morecss ? ' '.$morecss : '').' selectformat"'; |
|
8724
|
+ $out .= ' name="'.preg_replace('/^\./', '', $htmlname).'" '.($moreparam ? $moreparam : ''); |
8725
|
8725
|
$out .= '>'."\n"; |
8726
|
8726
|
|
8727
|
8727
|
if ($show_empty) { |
|
@@ -8732,7 +8732,7 @@ discard block |
|
|
block discarded – undo |
8732
|
8732
|
if (!is_numeric($show_empty)) { |
8733
|
8733
|
$textforempty = $show_empty; |
8734
|
8734
|
} |
8735
|
|
- $out .= '<option class="optiongrey" ' . ($moreparamonempty ? $moreparamonempty . ' ' : '') . 'value="' . (((int) $show_empty) < 0 ? $show_empty : -1) . '"' . ($id == $show_empty ? ' selected' : '') . '>' . $textforempty . '</option>' . "\n"; |
|
8735
|
+ $out .= '<option class="optiongrey" '.($moreparamonempty ? $moreparamonempty.' ' : '').'value="'.(((int) $show_empty) < 0 ? $show_empty : -1).'"'.($id == $show_empty ? ' selected' : '').'>'.$textforempty.'</option>'."\n"; |
8736
|
8736
|
} |
8737
|
8737
|
if (is_array($array)) { |
8738
|
8738
|
// Translate |
|
@@ -8757,7 +8757,7 @@ discard block |
|
|
block discarded – undo |
8757
|
8757
|
$value = $tmpvalue['label']; |
8758
|
8758
|
//$valuehtml = empty($tmpvalue['data-html']) ? $value : $tmpvalue['data-html']; |
8759
|
8759
|
$disabled = empty($tmpvalue['disabled']) ? '' : ' disabled'; |
8760
|
|
- $style = empty($tmpvalue['css']) ? '' : ' class="' . $tmpvalue['css'] . '"'; |
|
8760
|
+ $style = empty($tmpvalue['css']) ? '' : ' class="'.$tmpvalue['css'].'"'; |
8761
|
8761
|
} else { |
8762
|
8762
|
$value = $tmpvalue; |
8763
|
8763
|
//$valuehtml = $tmpvalue; |
|
@@ -8773,9 +8773,9 @@ discard block |
|
|
block discarded – undo |
8773
|
8773
|
} |
8774
|
8774
|
if ($key_in_label) { |
8775
|
8775
|
if (empty($nohtmlescape)) { |
8776
|
|
- $selectOptionValue = dol_escape_htmltag($key . ' - ' . ($maxlen ? dol_trunc($value, $maxlen) : $value)); |
|
8776
|
+ $selectOptionValue = dol_escape_htmltag($key.' - '.($maxlen ? dol_trunc($value, $maxlen) : $value)); |
8777
|
8777
|
} else { |
8778
|
|
- $selectOptionValue = $key . ' - ' . ($maxlen ? dol_trunc($value, $maxlen) : $value); |
|
8778
|
+ $selectOptionValue = $key.' - '.($maxlen ? dol_trunc($value, $maxlen) : $value); |
8779
|
8779
|
} |
8780
|
8780
|
} else { |
8781
|
8781
|
if (empty($nohtmlescape)) { |
|
@@ -8787,8 +8787,8 @@ discard block |
|
|
block discarded – undo |
8787
|
8787
|
$selectOptionValue = ' '; |
8788
|
8788
|
} |
8789
|
8789
|
} |
8790
|
|
- $out .= '<option value="' . $key . '"'; |
8791
|
|
- $out .= $style . $disabled; |
|
8790
|
+ $out .= '<option value="'.$key.'"'; |
|
8791
|
+ $out .= $style.$disabled; |
8792
|
8792
|
if (is_array($id)) { |
8793
|
8793
|
if (in_array($key, $id) && !$disabled) { |
8794
|
8794
|
$out .= ' selected'; // To preselect a value |
|
@@ -8800,7 +8800,7 @@ discard block |
|
|
block discarded – undo |
8800
|
8800
|
} |
8801
|
8801
|
} |
8802
|
8802
|
if (!empty($nohtmlescape)) { // deprecated. Use instead the key 'data-html' into input $array, managed at next step to use HTML content. |
8803
|
|
- $out .= ' data-html="' . dol_escape_htmltag($selectOptionValue) . '"'; |
|
8803
|
+ $out .= ' data-html="'.dol_escape_htmltag($selectOptionValue).'"'; |
8804
|
8804
|
} |
8805
|
8805
|
|
8806
|
8806
|
if (is_array($tmpvalue)) { |
|
@@ -8823,7 +8823,7 @@ discard block |
|
|
block discarded – undo |
8823
|
8823
|
// Add code for jquery to use multiselect |
8824
|
8824
|
if ($addjscombo && $jsbeautify) { |
8825
|
8825
|
// Enhance with select2 |
8826
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
8826
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
8827
|
8827
|
$out .= ajax_combobox($idname, array(), 0, 0, 'resolve', (((int) $show_empty) < 0 ? (string) $show_empty : '-1'), $morecss); |
8828
|
8828
|
} |
8829
|
8829
|
|
|
@@ -8851,28 +8851,28 @@ discard block |
|
|
block discarded – undo |
8851
|
8851
|
public static function selectArrayAjax($htmlname, $url, $id = '', $moreparam = '', $moreparamtourl = '', $disabled = 0, $minimumInputLength = 1, $morecss = '', $callurlonselect = 0, $placeholder = '', $acceptdelayedhtml = 0) |
8852
|
8852
|
{ |
8853
|
8853
|
global $conf, $langs; |
8854
|
|
- global $delayedhtmlcontent; // Will be used later outside of this function |
|
8854
|
+ global $delayedhtmlcontent; // Will be used later outside of this function |
8855
|
8855
|
|
8856
|
8856
|
// TODO Use an internal dolibarr component instead of select2 |
8857
|
8857
|
if (!getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') && !defined('REQUIRE_JQUERY_MULTISELECT')) { |
8858
|
8858
|
return ''; |
8859
|
8859
|
} |
8860
|
8860
|
|
8861
|
|
- $out = '<select type="text" class="' . $htmlname . ($morecss ? ' ' . $morecss : '') . '" ' . ($moreparam ? $moreparam . ' ' : '') . 'name="' . $htmlname . '"></select>'; |
|
8861
|
+ $out = '<select type="text" class="'.$htmlname.($morecss ? ' '.$morecss : '').'" '.($moreparam ? $moreparam.' ' : '').'name="'.$htmlname.'"></select>'; |
8862
|
8862
|
|
8863
|
8863
|
$outdelayed = ''; |
8864
|
8864
|
if (!empty($conf->use_javascript_ajax)) { |
8865
|
8865
|
$tmpplugin = 'select2'; |
8866
|
|
- $outdelayed = "\n" . '<!-- JS CODE TO ENABLE ' . $tmpplugin . ' for id ' . $htmlname . ' --> |
8867
|
|
- <script nonce="' . getNonce() . '"> |
|
8866
|
+ $outdelayed = "\n".'<!-- JS CODE TO ENABLE '.$tmpplugin.' for id '.$htmlname.' --> |
|
8867
|
+ <script nonce="' . getNonce().'"> |
8868
|
8868
|
$(document).ready(function () { |
8869
|
8869
|
|
8870
|
|
- ' . ($callurlonselect ? 'var saveRemoteData = [];' : '') . ' |
|
8870
|
+ ' . ($callurlonselect ? 'var saveRemoteData = [];' : '').' |
8871
|
8871
|
|
8872
|
|
- $(".' . $htmlname . '").select2({ |
|
8872
|
+ $(".' . $htmlname.'").select2({ |
8873
|
8873
|
ajax: { |
8874
|
8874
|
dir: "ltr", |
8875
|
|
- url: "' . $url . '", |
|
8875
|
+ url: "' . $url.'", |
8876
|
8876
|
dataType: \'json\', |
8877
|
8877
|
delay: 250, |
8878
|
8878
|
data: function (params) { |
|
@@ -8899,9 +8899,9 @@ discard block |
|
|
block discarded – undo |
8899
|
8899
|
}, |
8900
|
8900
|
language: select2arrayoflanguage, |
8901
|
8901
|
containerCssClass: \':all:\', /* Line to add class from the original SELECT propagated to the new <span class="select2-selection...> tag */ |
8902
|
|
- placeholder: "' . dol_escape_js($placeholder) . '", |
|
8902
|
+ placeholder: "' . dol_escape_js($placeholder).'", |
8903
|
8903
|
escapeMarkup: function (markup) { return markup; }, // let our custom formatter work |
8904
|
|
- minimumInputLength: ' . ((int) $minimumInputLength) . ', |
|
8904
|
+ minimumInputLength: ' . ((int) $minimumInputLength).', |
8905
|
8905
|
formatResult: function (result, container, query, escapeMarkup) { |
8906
|
8906
|
return escapeMarkup(result.text); |
8907
|
8907
|
}, |
|
@@ -8909,10 +8909,10 @@ discard block |
|
|
block discarded – undo |
8909
|
8909
|
|
8910
|
8910
|
' . ($callurlonselect ? ' |
8911
|
8911
|
/* Code to execute a GET when we select a value */ |
8912
|
|
- $(".' . $htmlname . '").change(function() { |
8913
|
|
- var selected = $(".' . $htmlname . '").val(); |
|
8912
|
+ $(".' . $htmlname.'").change(function() { |
|
8913
|
+ var selected = $(".' . $htmlname.'").val(); |
8914
|
8914
|
console.log("We select in selectArrayAjax the entry "+selected) |
8915
|
|
- $(".' . $htmlname . '").val(""); /* reset visible combo value */ |
|
8915
|
+ $(".' . $htmlname.'").val(""); /* reset visible combo value */ |
8916
|
8916
|
$.each( saveRemoteData, function( key, value ) { |
8917
|
8917
|
if (key == selected) |
8918
|
8918
|
{ |
|
@@ -8920,7 +8920,7 @@ discard block |
|
|
block discarded – undo |
8920
|
8920
|
location.assign(value.url); |
8921
|
8921
|
} |
8922
|
8922
|
}); |
8923
|
|
- });' : '') . ' |
|
8923
|
+ });' : '').' |
8924
|
8924
|
|
8925
|
8925
|
}); |
8926
|
8926
|
</script>'; |
|
@@ -8956,14 +8956,14 @@ discard block |
|
|
block discarded – undo |
8956
|
8956
|
public static function selectArrayFilter($htmlname, $array, $id = '', $moreparam = '', $disableFiltering = 0, $disabled = 0, $minimumInputLength = 1, $morecss = '', $callurlonselect = 0, $placeholder = '', $acceptdelayedhtml = 0, $textfortitle = '') |
8957
|
8957
|
{ |
8958
|
8958
|
global $conf, $langs; |
8959
|
|
- global $delayedhtmlcontent; // Will be used later outside of this function |
|
8959
|
+ global $delayedhtmlcontent; // Will be used later outside of this function |
8960
|
8960
|
|
8961
|
8961
|
// TODO Use an internal dolibarr component instead of select2 |
8962
|
8962
|
if (!getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') && !defined('REQUIRE_JQUERY_MULTISELECT')) { |
8963
|
8963
|
return ''; |
8964
|
8964
|
} |
8965
|
8965
|
|
8966
|
|
- $out = '<select type="text"'.($textfortitle ? ' title="'.dol_escape_htmltag($textfortitle).'"' : '').' id="'.$htmlname.'" class="'.$htmlname.($morecss ? ' ' . $morecss : '').'"'.($moreparam ? ' '.$moreparam : '').' name="'.$htmlname.'"><option></option></select>'; |
|
8966
|
+ $out = '<select type="text"'.($textfortitle ? ' title="'.dol_escape_htmltag($textfortitle).'"' : '').' id="'.$htmlname.'" class="'.$htmlname.($morecss ? ' '.$morecss : '').'"'.($moreparam ? ' '.$moreparam : '').' name="'.$htmlname.'"><option></option></select>'; |
8967
|
8967
|
|
8968
|
8968
|
$formattedarrayresult = array(); |
8969
|
8969
|
|
|
@@ -8978,20 +8978,20 @@ discard block |
|
|
block discarded – undo |
8978
|
8978
|
$outdelayed = ''; |
8979
|
8979
|
if (!empty($conf->use_javascript_ajax)) { |
8980
|
8980
|
$tmpplugin = 'select2'; |
8981
|
|
- $outdelayed = "\n" . '<!-- JS CODE TO ENABLE ' . $tmpplugin . ' for id ' . $htmlname . ' --> |
8982
|
|
- <script nonce="' . getNonce() . '"> |
|
8981
|
+ $outdelayed = "\n".'<!-- JS CODE TO ENABLE '.$tmpplugin.' for id '.$htmlname.' --> |
|
8982
|
+ <script nonce="' . getNonce().'"> |
8983
|
8983
|
$(document).ready(function () { |
8984
|
|
- var data = ' . json_encode($formattedarrayresult) . '; |
|
8984
|
+ var data = ' . json_encode($formattedarrayresult).'; |
8985
|
8985
|
|
8986
|
|
- ' . ($callurlonselect ? 'var saveRemoteData = ' . json_encode($array) . ';' : '') . ' |
|
8986
|
+ ' . ($callurlonselect ? 'var saveRemoteData = '.json_encode($array).';' : '').' |
8987
|
8987
|
|
8988
|
|
- $(".' . $htmlname . '").select2({ |
|
8988
|
+ $(".' . $htmlname.'").select2({ |
8989
|
8989
|
data: data, |
8990
|
8990
|
language: select2arrayoflanguage, |
8991
|
8991
|
containerCssClass: \':all:\', /* Line to add class from the original SELECT propagated to the new <span class="select2-selection...> tag */ |
8992
|
|
- placeholder: "' . dol_escape_js($placeholder) . '", |
|
8992
|
+ placeholder: "' . dol_escape_js($placeholder).'", |
8993
|
8993
|
escapeMarkup: function (markup) { return markup; }, // let our custom formatter work |
8994
|
|
- minimumInputLength: ' . $minimumInputLength . ', |
|
8994
|
+ minimumInputLength: ' . $minimumInputLength.', |
8995
|
8995
|
formatResult: function (result, container, query, escapeMarkup) { |
8996
|
8996
|
return escapeMarkup(result.text); |
8997
|
8997
|
}, |
|
@@ -9030,11 +9030,11 @@ discard block |
|
|
block discarded – undo |
9030
|
9030
|
|
9031
|
9031
|
' . ($callurlonselect ? ' |
9032
|
9032
|
/* Code to execute a GET when we select a value */ |
9033
|
|
- $(".' . $htmlname . '").change(function() { |
9034
|
|
- var selected = $(".' . $htmlname . '").val(); |
|
9033
|
+ $(".' . $htmlname.'").change(function() { |
|
9034
|
+ var selected = $(".' . $htmlname.'").val(); |
9035
|
9035
|
console.log("We select "+selected) |
9036
|
9036
|
|
9037
|
|
- $(".' . $htmlname . '").val(""); /* reset visible combo value */ |
|
9037
|
+ $(".' . $htmlname.'").val(""); /* reset visible combo value */ |
9038
|
9038
|
$.each( saveRemoteData, function( key, value ) { |
9039
|
9039
|
if (key == selected) |
9040
|
9040
|
{ |
|
@@ -9042,7 +9042,7 @@ discard block |
|
|
block discarded – undo |
9042
|
9042
|
location.assign(value.url); |
9043
|
9043
|
} |
9044
|
9044
|
}); |
9045
|
|
- });' : '') . ' |
|
9045
|
+ });' : '').' |
9046
|
9046
|
|
9047
|
9047
|
}); |
9048
|
9048
|
</script>'; |
|
@@ -9091,7 +9091,7 @@ discard block |
|
|
block discarded – undo |
9091
|
9091
|
$useenhancedmultiselect = 0; |
9092
|
9092
|
if (!empty($conf->use_javascript_ajax) && !defined('MAIN_DO_NOT_USE_JQUERY_MULTISELECT') && (getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') || defined('REQUIRE_JQUERY_MULTISELECT'))) { |
9093
|
9093
|
if ($addjscombo) { |
9094
|
|
- $useenhancedmultiselect = 1; // Use the js multiselect in one line. Possible only if $addjscombo not 0. |
|
9094
|
+ $useenhancedmultiselect = 1; // Use the js multiselect in one line. Possible only if $addjscombo not 0. |
9095
|
9095
|
} |
9096
|
9096
|
} |
9097
|
9097
|
|
|
@@ -9100,7 +9100,7 @@ discard block |
|
|
block discarded – undo |
9100
|
9100
|
// submitted to nothing. |
9101
|
9101
|
$out .= '<input type="hidden" name="'.$htmlname.'_multiselect" value="1">'; |
9102
|
9102
|
// Output select component |
9103
|
|
- $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"; |
|
9103
|
+ $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"; |
9104
|
9104
|
if (is_array($array) && !empty($array)) { |
9105
|
9105
|
if ($value_as_key) { |
9106
|
9106
|
$array = array_combine($array, $array); |
|
@@ -9121,33 +9121,33 @@ discard block |
|
|
block discarded – undo |
9121
|
9121
|
$tmplabelhtml = empty($value['labelhtml']) ? (empty($value['data-html']) ? '' : $value['data-html']) : $value['labelhtml']; |
9122
|
9122
|
} |
9123
|
9123
|
$newval = ($translate ? $langs->trans($tmpvalue) : $tmpvalue); |
9124
|
|
- $newval = ($key_in_label ? $tmpkey . ' - ' . $newval : $newval); |
|
9124
|
+ $newval = ($key_in_label ? $tmpkey.' - '.$newval : $newval); |
9125
|
9125
|
|
9126
|
|
- $out .= '<option value="' . $tmpkey . '"'; |
|
9126
|
+ $out .= '<option value="'.$tmpkey.'"'; |
9127
|
9127
|
if (is_array($selected) && !empty($selected) && in_array((string) $tmpkey, $selected) && ((string) $tmpkey != '')) { |
9128
|
9128
|
$out .= ' selected'; |
9129
|
9129
|
} |
9130
|
9130
|
if (!empty($tmplabelhtml)) { |
9131
|
|
- $out .= ' data-html="' . dol_escape_htmltag($tmplabelhtml, 0, 0, '', 0, 1) . '"'; |
|
9131
|
+ $out .= ' data-html="'.dol_escape_htmltag($tmplabelhtml, 0, 0, '', 0, 1).'"'; |
9132
|
9132
|
} else { |
9133
|
|
- $tmplabelhtml = ($tmppicto ? img_picto('', $tmppicto, 'class="pictofixedwidth" style="color: #' . $tmpcolor . '"') : '') . $newval; |
9134
|
|
- $out .= ' data-html="' . dol_escape_htmltag($tmplabelhtml, 0, 0, '', 0, 1) . '"'; |
|
9133
|
+ $tmplabelhtml = ($tmppicto ? img_picto('', $tmppicto, 'class="pictofixedwidth" style="color: #'.$tmpcolor.'"') : '').$newval; |
|
9134
|
+ $out .= ' data-html="'.dol_escape_htmltag($tmplabelhtml, 0, 0, '', 0, 1).'"'; |
9135
|
9135
|
} |
9136
|
9136
|
$out .= '>'; |
9137
|
9137
|
$out .= dol_htmlentitiesbr($newval); |
9138
|
|
- $out .= '</option>' . "\n"; |
|
9138
|
+ $out .= '</option>'."\n"; |
9139
|
9139
|
} |
9140
|
9140
|
} |
9141
|
9141
|
} |
9142
|
|
- $out .= '</select>' . "\n"; |
|
9142
|
+ $out .= '</select>'."\n"; |
9143
|
9143
|
|
9144
|
9144
|
// Add code for jquery to use multiselect |
9145
|
9145
|
if (!empty($conf->use_javascript_ajax) && getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') || defined('REQUIRE_JQUERY_MULTISELECT')) { |
9146
|
|
- $out .= "\n" . '<!-- JS CODE TO ENABLE select for id ' . $htmlname . ', addjscombo=' . $addjscombo . ' -->'; |
9147
|
|
- $out .= "\n" . '<script nonce="' . getNonce() . '">' . "\n"; |
|
9146
|
+ $out .= "\n".'<!-- JS CODE TO ENABLE select for id '.$htmlname.', addjscombo='.$addjscombo.' -->'; |
|
9147
|
+ $out .= "\n".'<script nonce="'.getNonce().'">'."\n"; |
9148
|
9148
|
if ($addjscombo == 1) { |
9149
|
9149
|
$tmpplugin = !getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') ? constant('REQUIRE_JQUERY_MULTISELECT') : $conf->global->MAIN_USE_JQUERY_MULTISELECT; |
9150
|
|
- $out .= 'function formatResult(record, container) {' . "\n"; |
|
9150
|
+ $out .= 'function formatResult(record, container) {'."\n"; |
9151
|
9151
|
// If property data-html set, we decode html entities and use this. |
9152
|
9152
|
// Note that HTML content must have been sanitized from js with dol_escape_htmltag(xxx, 0, 0, '', 0, 1) when building the select option. |
9153
|
9153
|
$out .= ' if ($(record.element).attr("data-html") != undefined && typeof htmlEntityDecodeJs === "function") {'; |
|
@@ -9155,26 +9155,26 @@ discard block |
|
|
block discarded – undo |
9155
|
9155
|
$out .= ' return htmlEntityDecodeJs($(record.element).attr("data-html"));'; |
9156
|
9156
|
$out .= ' }'."\n"; |
9157
|
9157
|
$out .= ' return record.text;'; |
9158
|
|
- $out .= '}' . "\n"; |
9159
|
|
- $out .= 'function formatSelection(record) {' . "\n"; |
|
9158
|
+ $out .= '}'."\n"; |
|
9159
|
+ $out .= 'function formatSelection(record) {'."\n"; |
9160
|
9160
|
if ($elemtype == 'category') { |
9161
|
|
- $out .= 'return \'<span><img src="' . DOL_URL_ROOT . '/theme/eldy/img/object_category.png"> \'+record.text+\'</span>\';'; |
|
9161
|
+ $out .= 'return \'<span><img src="'.DOL_URL_ROOT.'/theme/eldy/img/object_category.png"> \'+record.text+\'</span>\';'; |
9162
|
9162
|
} else { |
9163
|
9163
|
$out .= 'return record.text;'; |
9164
|
9164
|
} |
9165
|
|
- $out .= '}' . "\n"; |
|
9165
|
+ $out .= '}'."\n"; |
9166
|
9166
|
$out .= '$(document).ready(function () { |
9167
|
|
- $(\'#' . $htmlname . '\').' . $tmpplugin . '({'; |
|
9167
|
+ $(\'#' . $htmlname.'\').'.$tmpplugin.'({'; |
9168
|
9168
|
if ($placeholder) { |
9169
|
9169
|
$out .= ' |
9170
|
9170
|
placeholder: { |
9171
|
9171
|
id: \'-1\', |
9172
|
|
- text: \'' . dol_escape_js($placeholder) . '\' |
|
9172
|
+ text: \'' . dol_escape_js($placeholder).'\' |
9173
|
9173
|
},'; |
9174
|
9174
|
} |
9175
|
9175
|
$out .= ' dir: \'ltr\', |
9176
|
9176
|
containerCssClass: \':all:\', /* Line to add class of origin SELECT propagated to the new <span class="select2-selection...> tag (ko with multiselect) */ |
9177
|
|
- dropdownCssClass: \'' . $morecss . '\', /* Line to add class on the new <span class="select2-selection...> tag (ok with multiselect). Need full version of select2. */ |
|
9177
|
+ dropdownCssClass: \'' . $morecss.'\', /* Line to add class on the new <span class="select2-selection...> tag (ok with multiselect). Need full version of select2. */ |
9178
|
9178
|
// Specify format function for dropdown item |
9179
|
9179
|
formatResult: formatResult, |
9180
|
9180
|
templateResult: formatResult, /* For 4.0 */ |
|
@@ -9186,21 +9186,21 @@ discard block |
|
|
block discarded – undo |
9186
|
9186
|
|
9187
|
9187
|
/* Add also morecss to the css .select2 that is after the #htmlname, for component that are show dynamically after load, because select2 set |
9188
|
9188
|
the size only if component is not hidden by default on load */ |
9189
|
|
- $(\'#' . $htmlname . ' + .select2\').addClass(\'' . $morecss . '\'); |
|
9189
|
+ $(\'#' . $htmlname.' + .select2\').addClass(\''.$morecss.'\'); |
9190
|
9190
|
});' . "\n"; |
9191
|
9191
|
} elseif ($addjscombo == 2 && !defined('DISABLE_MULTISELECT')) { |
9192
|
9192
|
// Add other js lib |
9193
|
9193
|
// TODO external lib multiselect/jquery.multi-select.js must have been loaded to use this multiselect plugin |
9194
|
9194
|
// ... |
9195
|
|
- $out .= 'console.log(\'addjscombo=2 for htmlname=' . $htmlname . '\');'; |
|
9195
|
+ $out .= 'console.log(\'addjscombo=2 for htmlname='.$htmlname.'\');'; |
9196
|
9196
|
$out .= '$(document).ready(function () { |
9197
|
|
- $(\'#' . $htmlname . '\').multiSelect({ |
|
9197
|
+ $(\'#' . $htmlname.'\').multiSelect({ |
9198
|
9198
|
containerHTML: \'<div class="multi-select-container">\', |
9199
|
9199
|
menuHTML: \'<div class="multi-select-menu">\', |
9200
|
|
- buttonHTML: \'<span class="multi-select-button ' . $morecss . '">\', |
|
9200
|
+ buttonHTML: \'<span class="multi-select-button ' . $morecss.'">\', |
9201
|
9201
|
menuItemHTML: \'<label class="multi-select-menuitem">\', |
9202
|
9202
|
activeClass: \'multi-select-container--open\', |
9203
|
|
- noneText: \'' . $placeholder . '\' |
|
9203
|
+ noneText: \'' . $placeholder.'\' |
9204
|
9204
|
}); |
9205
|
9205
|
})'; |
9206
|
9206
|
} |
|
@@ -9233,7 +9233,7 @@ discard block |
|
|
block discarded – undo |
9233
|
9233
|
return ''; |
9234
|
9234
|
} |
9235
|
9235
|
|
9236
|
|
- $tmpvar = "MAIN_SELECTEDFIELDS_" . $varpage; // To get list of saved selected fields to show |
|
9236
|
+ $tmpvar = "MAIN_SELECTEDFIELDS_".$varpage; // To get list of saved selected fields to show |
9237
|
9237
|
|
9238
|
9238
|
if (!empty($user->conf->$tmpvar)) { // A list of fields was already customized for user |
9239
|
9239
|
$tmparray = explode(',', $user->conf->$tmpvar); |
|
@@ -9276,19 +9276,19 @@ discard block |
|
|
block discarded – undo |
9276
|
9276
|
} |
9277
|
9277
|
|
9278
|
9278
|
// Note: $val['checked'] <> 0 means we must show the field into the combo list @phan-suppress-next-line PhanTypePossiblyInvalidDimOffset |
9279
|
|
- $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>'; |
9280
|
|
- $listcheckedstring .= (empty($val['checked']) ? '' : $key . ','); |
|
9279
|
+ $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>'; |
|
9280
|
+ $listcheckedstring .= (empty($val['checked']) ? '' : $key.','); |
9281
|
9281
|
} |
9282
|
9282
|
} |
9283
|
9283
|
|
9284
|
|
- $out = '<!-- Component multiSelectArrayWithCheckbox ' . $htmlname . ' --> |
|
9284
|
+ $out = '<!-- Component multiSelectArrayWithCheckbox '.$htmlname.' --> |
9285
|
9285
|
|
9286
|
9286
|
<dl class="dropdown"> |
9287
|
9287
|
<dt> |
9288
|
|
- <a href="#' . $htmlname . '"> |
9289
|
|
- ' . img_picto('', 'list') . ' |
|
9288
|
+ <a href="#' . $htmlname.'"> |
|
9289
|
+ ' . img_picto('', 'list').' |
9290
|
9290
|
</a> |
9291
|
|
- <input type="hidden" class="' . $htmlname . '" name="' . $htmlname . '" value="' . $listcheckedstring . '"> |
|
9291
|
+ <input type="hidden" class="' . $htmlname.'" name="'.$htmlname.'" value="'.$listcheckedstring.'"> |
9292
|
9292
|
</dt> |
9293
|
9293
|
<dd class="dropdowndd"> |
9294
|
9294
|
<div class="multiselectcheckbox'.$htmlname.'"> |
|
@@ -9300,19 +9300,19 @@ discard block |
|
|
block discarded – undo |
9300
|
9300
|
</dd> |
9301
|
9301
|
</dl> |
9302
|
9302
|
|
9303
|
|
- <script nonce="' . getNonce() . '" type="text/javascript"> |
|
9303
|
+ <script nonce="' . getNonce().'" type="text/javascript"> |
9304
|
9304
|
jQuery(document).ready(function () { |
9305
|
|
- $(\'.multiselectcheckbox' . $htmlname . ' input[type="checkbox"]\').on(\'click\', function () { |
|
9305
|
+ $(\'.multiselectcheckbox' . $htmlname.' input[type="checkbox"]\').on(\'click\', function () { |
9306
|
9306
|
console.log("A new field was added/removed, we edit field input[name=formfilteraction]"); |
9307
|
9307
|
|
9308
|
9308
|
$("input:hidden[name=formfilteraction]").val(\'listafterchangingselectedfields\'); // Update field so we know we changed something on selected fields after POST |
9309
|
9309
|
|
9310
|
9310
|
var title = $(this).val() + ","; |
9311
|
9311
|
if ($(this).is(\':checked\')) { |
9312
|
|
- $(\'.' . $htmlname . '\').val(title + $(\'.' . $htmlname . '\').val()); |
|
9312
|
+ $(\'.' . $htmlname.'\').val(title + $(\'.'.$htmlname.'\').val()); |
9313
|
9313
|
} |
9314
|
9314
|
else { |
9315
|
|
- $(\'.' . $htmlname . '\').val( $(\'.' . $htmlname . '\').val().replace(title, \'\') ) |
|
9315
|
+ $(\'.' . $htmlname.'\').val( $(\'.'.$htmlname.'\').val().replace(title, \'\') ) |
9316
|
9316
|
} |
9317
|
9317
|
// Now, we submit page |
9318
|
9318
|
//$(this).parents(\'form:first\').submit(); |
|
@@ -9343,7 +9343,7 @@ discard block |
|
|
block discarded – undo |
9343
|
9343
|
*/ |
9344
|
9344
|
public function showCategories($id, $type, $rendermode = 0, $nolink = 0) |
9345
|
9345
|
{ |
9346
|
|
- include_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; |
|
9346
|
+ include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; |
9347
|
9347
|
|
9348
|
9348
|
$cat = new Categorie($this->db); |
9349
|
9349
|
$categories = $cat->containing($id, $type); |
|
@@ -9353,13 +9353,13 @@ discard block |
|
|
block discarded – undo |
9353
|
9353
|
foreach ($categories as $c) { |
9354
|
9354
|
$ways = $c->print_all_ways(' >> ', ($nolink ? 'none' : ''), 0, 1); // $ways[0] = "ccc2 >> ccc2a >> ccc2a1" with html formatted text |
9355
|
9355
|
foreach ($ways as $way) { |
9356
|
|
- $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"' . ($c->color ? ' style="background: #' . $c->color . ';"' : ' style="background: #bbb"') . '>' . $way . '</li>'; |
|
9356
|
+ $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"'.($c->color ? ' style="background: #'.$c->color.';"' : ' style="background: #bbb"').'>'.$way.'</li>'; |
9357
|
9357
|
} |
9358
|
9358
|
} |
9359
|
9359
|
if (empty($toprint)) { |
9360
|
9360
|
return ''; |
9361
|
9361
|
} else { |
9362
|
|
- return '<div class="select2-container-multi-dolibarr"><ul class="select2-choices-dolibarr">' . implode(' ', $toprint) . '</ul></div>'; |
|
9362
|
+ return '<div class="select2-container-multi-dolibarr"><ul class="select2-choices-dolibarr">'.implode(' ', $toprint).'</ul></div>'; |
9363
|
9363
|
} |
9364
|
9364
|
} |
9365
|
9365
|
|
|
@@ -9408,15 +9408,15 @@ discard block |
|
|
block discarded – undo |
9408
|
9408
|
|
9409
|
9409
|
|
9410
|
9410
|
print '<div class="div-table-responsive-no-min">'; |
9411
|
|
- print '<table class="noborder allwidth" data-block="showLinkedObject" data-element="' . $object->element . '" data-elementid="' . $object->id . '" >'; |
|
9411
|
+ print '<table class="noborder allwidth" data-block="showLinkedObject" data-element="'.$object->element.'" data-elementid="'.$object->id.'" >'; |
9412
|
9412
|
|
9413
|
9413
|
print '<tr class="liste_titre">'; |
9414
|
|
- print '<td>' . $langs->trans("Type") . '</td>'; |
9415
|
|
- print '<td>' . $langs->trans("Ref") . '</td>'; |
|
9414
|
+ print '<td>'.$langs->trans("Type").'</td>'; |
|
9415
|
+ print '<td>'.$langs->trans("Ref").'</td>'; |
9416
|
9416
|
print '<td class="center"></td>'; |
9417
|
|
- print '<td class="center">' . $langs->trans("Date") . '</td>'; |
9418
|
|
- print '<td class="right">' . $langs->trans("AmountHTShort") . '</td>'; |
9419
|
|
- print '<td class="right">' . $langs->trans("Status") . '</td>'; |
|
9417
|
+ print '<td class="center">'.$langs->trans("Date").'</td>'; |
|
9418
|
+ print '<td class="right">'.$langs->trans("AmountHTShort").'</td>'; |
|
9419
|
+ print '<td class="right">'.$langs->trans("Status").'</td>'; |
9420
|
9420
|
print '<td></td>'; |
9421
|
9421
|
print '</tr>'; |
9422
|
9422
|
|
|
@@ -9435,13 +9435,13 @@ discard block |
|
|
block discarded – undo |
9435
|
9435
|
if ($objecttype != 'supplier_proposal' && preg_match('/^([^_]+)_([^_]+)/i', $objecttype, $regs)) { |
9436
|
9436
|
$element = $regs[1]; |
9437
|
9437
|
$subelement = $regs[2]; |
9438
|
|
- $tplpath = $element . '/' . $subelement; |
|
9438
|
+ $tplpath = $element.'/'.$subelement; |
9439
|
9439
|
} |
9440
|
9440
|
$tplname = 'linkedobjectblock'; |
9441
|
9441
|
|
9442
|
9442
|
// To work with non standard path |
9443
|
9443
|
if ($objecttype == 'facture') { |
9444
|
|
- $tplpath = 'compta/' . $element; |
|
9444
|
+ $tplpath = 'compta/'.$element; |
9445
|
9445
|
if (!isModEnabled('invoice')) { |
9446
|
9446
|
continue; // Do not show if module disabled |
9447
|
9447
|
} |
|
@@ -9452,7 +9452,7 @@ discard block |
|
|
block discarded – undo |
9452
|
9452
|
continue; // Do not show if module disabled |
9453
|
9453
|
} |
9454
|
9454
|
} elseif ($objecttype == 'propal') { |
9455
|
|
- $tplpath = 'comm/' . $element; |
|
9455
|
+ $tplpath = 'comm/'.$element; |
9456
|
9456
|
if (!isModEnabled('propal')) { |
9457
|
9457
|
continue; // Do not show if module disabled |
9458
|
9458
|
} |
|
@@ -9505,7 +9505,7 @@ discard block |
|
|
block discarded – undo |
9505
|
9505
|
$linkedObjectBlock = $objects; |
9506
|
9506
|
|
9507
|
9507
|
// Output template part (modules that overwrite templates must declare this into descriptor) |
9508
|
|
- $dirtpls = array_merge($conf->modules_parts['tpl'], array('/' . $tplpath . '/tpl')); |
|
9508
|
+ $dirtpls = array_merge($conf->modules_parts['tpl'], array('/'.$tplpath.'/tpl')); |
9509
|
9509
|
foreach ($dirtpls as $reldir) { |
9510
|
9510
|
$reldir = rtrim($reldir, '/'); |
9511
|
9511
|
if ($nboftypesoutput == ($nbofdifferenttypes - 1)) { // No more type to show after |
|
@@ -9513,7 +9513,7 @@ discard block |
|
|
block discarded – undo |
9513
|
9513
|
$noMoreLinkedObjectBlockAfter = 1; |
9514
|
9514
|
} |
9515
|
9515
|
|
9516
|
|
- $res = @include dol_buildpath($reldir . '/' . $tplname . '.tpl.php'); |
|
9516
|
+ $res = @include dol_buildpath($reldir.'/'.$tplname.'.tpl.php'); |
9517
|
9517
|
if ($res) { |
9518
|
9518
|
$nboftypesoutput++; |
9519
|
9519
|
break; |
|
@@ -9522,7 +9522,7 @@ discard block |
|
|
block discarded – undo |
9522
|
9522
|
} |
9523
|
9523
|
|
9524
|
9524
|
if (!$nboftypesoutput) { |
9525
|
|
- print '<tr><td colspan="7"><span class="opacitymedium">' . $langs->trans("None") . '</span></td></tr>'; |
|
9525
|
+ print '<tr><td colspan="7"><span class="opacitymedium">'.$langs->trans("None").'</span></td></tr>'; |
9526
|
9526
|
} |
9527
|
9527
|
|
9528
|
9528
|
print '</table>'; |
|
@@ -9568,14 +9568,14 @@ discard block |
|
|
block discarded – undo |
9568
|
9568
|
if (is_object($object->thirdparty) && !empty($object->thirdparty->id) && $object->thirdparty->id > 0) { |
9569
|
9569
|
$listofidcompanytoscan = $object->thirdparty->id; |
9570
|
9570
|
if (($object->thirdparty->parent > 0) && getDolGlobalString('THIRDPARTY_INCLUDE_PARENT_IN_LINKTO')) { |
9571
|
|
- $listofidcompanytoscan .= ',' . $object->thirdparty->parent; |
|
9571
|
+ $listofidcompanytoscan .= ','.$object->thirdparty->parent; |
9572
|
9572
|
} |
9573
|
9573
|
if (($object->fk_project > 0) && getDolGlobalString('THIRDPARTY_INCLUDE_PROJECT_THIRDPARY_IN_LINKTO')) { |
9574
|
|
- include_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; |
|
9574
|
+ include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; |
9575
|
9575
|
$tmpproject = new Project($this->db); |
9576
|
9576
|
$tmpproject->fetch($object->fk_project); |
9577
|
9577
|
if ($tmpproject->socid > 0 && ($tmpproject->socid != $object->thirdparty->id)) { |
9578
|
|
- $listofidcompanytoscan .= ',' . $tmpproject->socid; |
|
9578
|
+ $listofidcompanytoscan .= ','.$tmpproject->socid; |
9579
|
9579
|
} |
9580
|
9580
|
unset($tmpproject); |
9581
|
9581
|
} |
|
@@ -9585,63 +9585,63 @@ discard block |
|
|
block discarded – undo |
9585
|
9585
|
'enabled' => isModEnabled('propal'), |
9586
|
9586
|
'perms' => 1, |
9587
|
9587
|
'label' => 'LinkToProposal', |
9588
|
|
- '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') . ')'.($dontIncludeCompletedItems ? ' AND t.fk_statut < 4' : '')), |
|
9588
|
+ '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').')'.($dontIncludeCompletedItems ? ' AND t.fk_statut < 4' : '')), |
9589
|
9589
|
'shipping' => array( |
9590
|
9590
|
'enabled' => isModEnabled('shipping'), |
9591
|
9591
|
'perms' => 1, |
9592
|
9592
|
'label' => 'LinkToExpedition', |
9593
|
|
- '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') . ')'.($dontIncludeCompletedItems ? ' AND t.fk_statut < 2' : '')), |
|
9593
|
+ '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').')'.($dontIncludeCompletedItems ? ' AND t.fk_statut < 2' : '')), |
9594
|
9594
|
'order' => array( |
9595
|
9595
|
'enabled' => isModEnabled('order'), |
9596
|
9596
|
'perms' => 1, |
9597
|
9597
|
'label' => 'LinkToOrder', |
9598
|
|
- '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') . ')'.($dontIncludeCompletedItems ? ' AND t.facture < 1' : '')), |
|
9598
|
+ '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').')'.($dontIncludeCompletedItems ? ' AND t.facture < 1' : '')), |
9599
|
9599
|
'invoice' => array( |
9600
|
9600
|
'enabled' => isModEnabled('invoice'), |
9601
|
9601
|
'perms' => 1, |
9602
|
9602
|
'label' => 'LinkToInvoice', |
9603
|
|
- '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') . ')'.($dontIncludeCompletedItems ? ' AND t.paye < 1' : '')), |
|
9603
|
+ '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').')'.($dontIncludeCompletedItems ? ' AND t.paye < 1' : '')), |
9604
|
9604
|
'invoice_template' => array( |
9605
|
9605
|
'enabled' => isModEnabled('invoice'), |
9606
|
9606
|
'perms' => 1, |
9607
|
9607
|
'label' => 'LinkToTemplateInvoice', |
9608
|
|
- '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') . ')'.($dontIncludeCompletedItems ? ' AND t.paye < 1' : '')), |
|
9608
|
+ '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').')'.($dontIncludeCompletedItems ? ' AND t.paye < 1' : '')), |
9609
|
9609
|
'contrat' => array( |
9610
|
9610
|
'enabled' => isModEnabled('contract'), |
9611
|
9611
|
'perms' => 1, |
9612
|
9612
|
'label' => 'LinkToContract', |
9613
|
9613
|
'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 |
9614
|
|
- 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' |
|
9614
|
+ 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' |
9615
|
9615
|
), |
9616
|
9616
|
'fichinter' => array( |
9617
|
9617
|
'enabled' => isModEnabled('intervention'), |
9618
|
9618
|
'perms' => 1, |
9619
|
9619
|
'label' => 'LinkToIntervention', |
9620
|
|
- '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') . ')'), |
|
9620
|
+ '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').')'), |
9621
|
9621
|
'supplier_proposal' => array( |
9622
|
9622
|
'enabled' => isModEnabled('supplier_proposal'), |
9623
|
9623
|
'perms' => 1, |
9624
|
9624
|
'label' => 'LinkToSupplierProposal', |
9625
|
|
- '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') . ')'.($dontIncludeCompletedItems ? ' AND t.fk_statut < 4' : '')), |
|
9625
|
+ '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').')'.($dontIncludeCompletedItems ? ' AND t.fk_statut < 4' : '')), |
9626
|
9626
|
'order_supplier' => array( |
9627
|
9627
|
'enabled' => isModEnabled("supplier_order"), |
9628
|
9628
|
'perms' => 1, |
9629
|
9629
|
'label' => 'LinkToSupplierOrder', |
9630
|
|
- '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') . ')'.($dontIncludeCompletedItems ? ' AND t.billed < 1' : '')), |
|
9630
|
+ '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').')'.($dontIncludeCompletedItems ? ' AND t.billed < 1' : '')), |
9631
|
9631
|
'invoice_supplier' => array( |
9632
|
9632
|
'enabled' => isModEnabled("supplier_invoice"), |
9633
|
9633
|
'perms' => 1, 'label' => 'LinkToSupplierInvoice', |
9634
|
|
- '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') . ')'.($dontIncludeCompletedItems ? ' AND t.paye < 1' : '')), |
|
9634
|
+ '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').')'.($dontIncludeCompletedItems ? ' AND t.paye < 1' : '')), |
9635
|
9635
|
'ticket' => array( |
9636
|
9636
|
'enabled' => isModEnabled('ticket'), |
9637
|
9637
|
'perms' => 1, |
9638
|
9638
|
'label' => 'LinkToTicket', |
9639
|
|
- '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') . ')'.($dontIncludeCompletedItems ? ' AND t.fk_statut < 8' : '')), |
|
9639
|
+ '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').')'.($dontIncludeCompletedItems ? ' AND t.fk_statut < 8' : '')), |
9640
|
9640
|
'mo' => array( |
9641
|
9641
|
'enabled' => isModEnabled('mrp'), |
9642
|
9642
|
'perms' => 1, |
9643
|
9643
|
'label' => 'LinkToMo', |
9644
|
|
- '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') . ')'.($dontIncludeCompletedItems ? ' AND t.status < 3' : '')) |
|
9644
|
+ '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').')'.($dontIncludeCompletedItems ? ' AND t.status < 3' : '')) |
9645
|
9645
|
); |
9646
|
9646
|
} |
9647
|
9647
|
|
|
@@ -9679,23 +9679,23 @@ discard block |
|
|
block discarded – undo |
9679
|
9679
|
} |
9680
|
9680
|
|
9681
|
9681
|
if (!empty($possiblelink['perms']) && (empty($restrictlinksto) || in_array($key, $restrictlinksto)) && (empty($excludelinksto) || !in_array($key, $excludelinksto))) { |
9682
|
|
- $htmltoenteralink .= '<div id="' . $key . 'list"' . (empty($conf->use_javascript_ajax) ? '' : ' style="display:none"') . '>'; |
|
9682
|
+ $htmltoenteralink .= '<div id="'.$key.'list"'.(empty($conf->use_javascript_ajax) ? '' : ' style="display:none"').'>'; |
9683
|
9683
|
|
9684
|
9684
|
// Section for free ref input |
9685
|
9685
|
if (!getDolGlobalString('MAIN_HIDE_LINK_BY_REF_IN_LINKTO')) { |
9686
|
9686
|
$htmltoenteralink .= '<br>'."\n"; |
9687
|
9687
|
$htmltoenteralink .= '<!-- form to add a link from anywhere -->'."\n"; |
9688
|
|
- $htmltoenteralink .= '<form action="' . $_SERVER["PHP_SELF"] . '" method="POST" name="formlinkedbyref' . $key . '">'; |
9689
|
|
- $htmltoenteralink .= '<input type="hidden" name="id" value="' . $object->id . '">'; |
|
9688
|
+ $htmltoenteralink .= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" name="formlinkedbyref'.$key.'">'; |
|
9689
|
+ $htmltoenteralink .= '<input type="hidden" name="id" value="'.$object->id.'">'; |
9690
|
9690
|
$htmltoenteralink .= '<input type="hidden" name="action" value="addlinkbyref">'; |
9691
|
|
- $htmltoenteralink .= '<input type="hidden" name="token" value="' . newToken() . '">'; |
9692
|
|
- $htmltoenteralink .= '<input type="hidden" name="addlink" value="' . $key . '">'; |
|
9691
|
+ $htmltoenteralink .= '<input type="hidden" name="token" value="'.newToken().'">'; |
|
9692
|
+ $htmltoenteralink .= '<input type="hidden" name="addlink" value="'.$key.'">'; |
9693
|
9693
|
$htmltoenteralink .= '<table class="noborder">'; |
9694
|
9694
|
$htmltoenteralink .= '<tr>'; |
9695
|
9695
|
//print '<td>' . $langs->trans("Ref") . '</td>'; |
9696
|
|
- $htmltoenteralink .= '<td class="center"><input type="text" placeholder="'.dol_escape_htmltag($langs->trans("Ref")).'" name="reftolinkto" value="' . dol_escape_htmltag(GETPOST('reftolinkto', 'alpha')) . '"> '; |
9697
|
|
- $htmltoenteralink .= '<input type="submit" class="button small valignmiddle" value="' . $langs->trans('ToLink') . '"> '; |
9698
|
|
- $htmltoenteralink .= '<input type="submit" class="button small" name="cancel" value="' . $langs->trans('Cancel') . '"></td>'; |
|
9696
|
+ $htmltoenteralink .= '<td class="center"><input type="text" placeholder="'.dol_escape_htmltag($langs->trans("Ref")).'" name="reftolinkto" value="'.dol_escape_htmltag(GETPOST('reftolinkto', 'alpha')).'"> '; |
|
9697
|
+ $htmltoenteralink .= '<input type="submit" class="button small valignmiddle" value="'.$langs->trans('ToLink').'"> '; |
|
9698
|
+ $htmltoenteralink .= '<input type="submit" class="button small" name="cancel" value="'.$langs->trans('Cancel').'"></td>'; |
9699
|
9699
|
$htmltoenteralink .= '</tr>'; |
9700
|
9700
|
$htmltoenteralink .= '</table>'; |
9701
|
9701
|
$htmltoenteralink .= '</form>'; |
|
@@ -9712,47 +9712,47 @@ discard block |
|
|
block discarded – undo |
9712
|
9712
|
// Section for free predefined list |
9713
|
9713
|
$htmltoenteralink .= '<br>'; |
9714
|
9714
|
$htmltoenteralink .= '<!-- form to add a link from object to same thirdparty -->'."\n"; |
9715
|
|
- $htmltoenteralink .= '<form action="' . $_SERVER["PHP_SELF"] . '" method="POST" name="formlinked' . $key . '">'; |
|
9715
|
+ $htmltoenteralink .= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" name="formlinked'.$key.'">'; |
9716
|
9716
|
$htmltoenteralink .= '<input type="hidden" name="action" value="addlink">'; |
9717
|
|
- $htmltoenteralink .= '<input type="hidden" name="token" value="' . newToken() . '">'; |
9718
|
|
- $htmltoenteralink .= '<input type="hidden" name="id" value="' . $object->id . '">'; |
9719
|
|
- $htmltoenteralink .= '<input type="hidden" name="addlink" value="' . $key . '">'; |
|
9717
|
+ $htmltoenteralink .= '<input type="hidden" name="token" value="'.newToken().'">'; |
|
9718
|
+ $htmltoenteralink .= '<input type="hidden" name="id" value="'.$object->id.'">'; |
|
9719
|
+ $htmltoenteralink .= '<input type="hidden" name="addlink" value="'.$key.'">'; |
9720
|
9720
|
$htmltoenteralink .= '<table class="noborder">'; |
9721
|
9721
|
$htmltoenteralink .= '<tr class="liste_titre">'; |
9722
|
9722
|
$htmltoenteralink .= '<td class="nowrap"></td>'; |
9723
|
|
- $htmltoenteralink .= '<td>' . $langs->trans("Ref") . '</td>'; |
9724
|
|
- $htmltoenteralink .= '<td>' . $langs->trans("RefCustomer") . '</td>'; |
9725
|
|
- $htmltoenteralink .= '<td class="right">' . $langs->trans("AmountHTShort") . '</td>'; |
9726
|
|
- $htmltoenteralink .= '<td>' . $langs->trans("Company") . '</td>'; |
|
9723
|
+ $htmltoenteralink .= '<td>'.$langs->trans("Ref").'</td>'; |
|
9724
|
+ $htmltoenteralink .= '<td>'.$langs->trans("RefCustomer").'</td>'; |
|
9725
|
+ $htmltoenteralink .= '<td class="right">'.$langs->trans("AmountHTShort").'</td>'; |
|
9726
|
+ $htmltoenteralink .= '<td>'.$langs->trans("Company").'</td>'; |
9727
|
9727
|
$htmltoenteralink .= '</tr>'; |
9728
|
9728
|
while ($i < $num) { |
9729
|
9729
|
$objp = $this->db->fetch_object($resqllist); |
9730
|
9730
|
|
9731
|
9731
|
$htmltoenteralink .= '<tr class="oddeven">'; |
9732
|
9732
|
$htmltoenteralink .= '<td>'; |
9733
|
|
- $htmltoenteralink .= '<input type="checkbox" name="idtolinkto[' . $key . '_' . $objp->rowid . ']" id="' . $key . '_' . $objp->rowid . '" value="' . $objp->rowid . '">'; |
|
9733
|
+ $htmltoenteralink .= '<input type="checkbox" name="idtolinkto['.$key.'_'.$objp->rowid.']" id="'.$key.'_'.$objp->rowid.'" value="'.$objp->rowid.'">'; |
9734
|
9734
|
$htmltoenteralink .= '</td>'; |
9735
|
|
- $htmltoenteralink .= '<td><label for="' . $key . '_' . $objp->rowid . '">' . $objp->ref . '</label></td>'; |
9736
|
|
- $htmltoenteralink .= '<td>' . (!empty($objp->ref_client) ? $objp->ref_client : (!empty($objp->ref_supplier) ? $objp->ref_supplier : '')) . '</td>'; |
|
9735
|
+ $htmltoenteralink .= '<td><label for="'.$key.'_'.$objp->rowid.'">'.$objp->ref.'</label></td>'; |
|
9736
|
+ $htmltoenteralink .= '<td>'.(!empty($objp->ref_client) ? $objp->ref_client : (!empty($objp->ref_supplier) ? $objp->ref_supplier : '')).'</td>'; |
9737
|
9737
|
$htmltoenteralink .= '<td class="right">'; |
9738
|
9738
|
if ($possiblelink['label'] == 'LinkToContract') { |
9739
|
|
- $htmltoenteralink .= $form->textwithpicto('', $langs->trans("InformationOnLinkToContract")) . ' '; |
|
9739
|
+ $htmltoenteralink .= $form->textwithpicto('', $langs->trans("InformationOnLinkToContract")).' '; |
9740
|
9740
|
} |
9741
|
|
- $htmltoenteralink .= '<span class="amount">' . (isset($objp->total_ht) ? price($objp->total_ht) : '') . '</span>'; |
|
9741
|
+ $htmltoenteralink .= '<span class="amount">'.(isset($objp->total_ht) ? price($objp->total_ht) : '').'</span>'; |
9742
|
9742
|
$htmltoenteralink .= '</td>'; |
9743
|
|
- $htmltoenteralink .= '<td>' . $objp->name . '</td>'; |
|
9743
|
+ $htmltoenteralink .= '<td>'.$objp->name.'</td>'; |
9744
|
9744
|
$htmltoenteralink .= '</tr>'; |
9745
|
9745
|
$i++; |
9746
|
9746
|
} |
9747
|
9747
|
$htmltoenteralink .= '</table>'; |
9748
|
9748
|
$htmltoenteralink .= '<div class="center">'; |
9749
|
9749
|
if ($num) { |
9750
|
|
- $htmltoenteralink .= '<input type="submit" class="button valignmiddle marginleftonly marginrightonly small" value="' . $langs->trans('ToLink') . '">'; |
|
9750
|
+ $htmltoenteralink .= '<input type="submit" class="button valignmiddle marginleftonly marginrightonly small" value="'.$langs->trans('ToLink').'">'; |
9751
|
9751
|
} |
9752
|
9752
|
if (empty($conf->use_javascript_ajax)) { |
9753
|
|
- $htmltoenteralink .= '<input type="submit" class="button button-cancel marginleftonly marginrightonly small" name="cancel" value="' . $langs->trans("Cancel") . '"></div>'; |
|
9753
|
+ $htmltoenteralink .= '<input type="submit" class="button button-cancel marginleftonly marginrightonly small" name="cancel" value="'.$langs->trans("Cancel").'"></div>'; |
9754
|
9754
|
} else { |
9755
|
|
- $htmltoenteralink .= '<input type="submit" onclick="jQuery(\'#' . $key . 'list\').toggle(); return false;" class="button button-cancel marginleftonly marginrightonly small" name="cancel" value="' . $langs->trans("Cancel") . '"></div>'; |
|
9755
|
+ $htmltoenteralink .= '<input type="submit" onclick="jQuery(\'#'.$key.'list\').toggle(); return false;" class="button button-cancel marginleftonly marginrightonly small" name="cancel" value="'.$langs->trans("Cancel").'"></div>'; |
9756
|
9756
|
} |
9757
|
9757
|
$htmltoenteralink .= '</form>'; |
9758
|
9758
|
} |
|
@@ -9766,10 +9766,10 @@ discard block |
|
|
block discarded – undo |
9766
|
9766
|
|
9767
|
9767
|
// Complete the list for the combo box |
9768
|
9768
|
if ($num > 0 || !getDolGlobalString('MAIN_HIDE_LINK_BY_REF_IN_LINKTO')) { |
9769
|
|
- $linktoelemlist .= '<li><a href="#linkto' . $key . '" class="linkto dropdowncloseonclick" rel="' . $key . '">' . $langs->trans($possiblelink['label']) . ' (' . $num . ')</a></li>'; |
|
9769
|
+ $linktoelemlist .= '<li><a href="#linkto'.$key.'" class="linkto dropdowncloseonclick" rel="'.$key.'">'.$langs->trans($possiblelink['label']).' ('.$num.')</a></li>'; |
9770
|
9770
|
// } else $linktoelem.=$langs->trans($possiblelink['label']); |
9771
|
9771
|
} else { |
9772
|
|
- $linktoelemlist .= '<li><span class="linktodisabled">' . $langs->trans($possiblelink['label']) . ' (0)</span></li>'; |
|
9772
|
+ $linktoelemlist .= '<li><span class="linktodisabled">'.$langs->trans($possiblelink['label']).' (0)</span></li>'; |
9773
|
9773
|
} |
9774
|
9774
|
} |
9775
|
9775
|
} |
|
@@ -9779,11 +9779,11 @@ discard block |
|
|
block discarded – undo |
9779
|
9779
|
<dl class="dropdown" id="linktoobjectname"> |
9780
|
9780
|
'; |
9781
|
9781
|
if (!empty($conf->use_javascript_ajax)) { |
9782
|
|
- $linktoelem .= '<dt><a href="#linktoobjectname"><span class="fas fa-link paddingrightonly"></span>' . $langs->trans("LinkTo") . '...</a></dt>'; |
|
9782
|
+ $linktoelem .= '<dt><a href="#linktoobjectname"><span class="fas fa-link paddingrightonly"></span>'.$langs->trans("LinkTo").'...</a></dt>'; |
9783
|
9783
|
} |
9784
|
9784
|
$linktoelem .= '<dd> |
9785
|
9785
|
<div class="multiselectlinkto"> |
9786
|
|
- <ul class="ulselectedfields">' . $linktoelemlist . ' |
|
9786
|
+ <ul class="ulselectedfields">' . $linktoelemlist.' |
9787
|
9787
|
</ul> |
9788
|
9788
|
</div> |
9789
|
9789
|
</dd> |
|
@@ -9794,7 +9794,7 @@ discard block |
|
|
block discarded – undo |
9794
|
9794
|
|
9795
|
9795
|
if (!empty($conf->use_javascript_ajax)) { |
9796
|
9796
|
print '<!-- Add js to show linkto box --> |
9797
|
|
- <script nonce="' . getNonce() . '"> |
|
9797
|
+ <script nonce="' . getNonce().'"> |
9798
|
9798
|
jQuery(document).ready(function() { |
9799
|
9799
|
jQuery(".linkto").click(function() { |
9800
|
9800
|
console.log("We choose to show/hide links for rel="+jQuery(this).attr(\'rel\')+" so #"+jQuery(this).attr(\'rel\')+"list"); |
|
@@ -9841,19 +9841,19 @@ discard block |
|
|
block discarded – undo |
9841
|
9841
|
|
9842
|
9842
|
$disabled = ($disabled ? ' disabled' : ''); |
9843
|
9843
|
|
9844
|
|
- $resultyesno = '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" id="' . $htmlname . '" name="' . $htmlname . '"' . $disabled . '>' . "\n"; |
|
9844
|
+ $resultyesno = '<select class="flat'.($morecss ? ' '.$morecss : '').'" id="'.$htmlname.'" name="'.$htmlname.'"'.$disabled.'>'."\n"; |
9845
|
9845
|
if ($useempty) { |
9846
|
|
- $resultyesno .= '<option value="-1"' . (($value < 0) ? ' selected' : '') . '> </option>' . "\n"; |
|
9846
|
+ $resultyesno .= '<option value="-1"'.(($value < 0) ? ' selected' : '').'> </option>'."\n"; |
9847
|
9847
|
} |
9848
|
9848
|
if (("$value" == 'yes') || ($value == 1)) { |
9849
|
|
- $resultyesno .= '<option value="' . $yes . '" selected>' . $langs->trans($labelyes) . '</option>' . "\n"; |
9850
|
|
- $resultyesno .= '<option value="' . $no . '">' . $langs->trans($labelno) . '</option>' . "\n"; |
|
9849
|
+ $resultyesno .= '<option value="'.$yes.'" selected>'.$langs->trans($labelyes).'</option>'."\n"; |
|
9850
|
+ $resultyesno .= '<option value="'.$no.'">'.$langs->trans($labelno).'</option>'."\n"; |
9851
|
9851
|
} else { |
9852
|
9852
|
$selected = (($useempty && $value != '0' && $value != 'no') ? '' : ' selected'); |
9853
|
|
- $resultyesno .= '<option value="' . $yes . '">' . $langs->trans($labelyes) . '</option>' . "\n"; |
9854
|
|
- $resultyesno .= '<option value="' . $no . '"' . $selected . '>' . $langs->trans($labelno) . '</option>' . "\n"; |
|
9853
|
+ $resultyesno .= '<option value="'.$yes.'">'.$langs->trans($labelyes).'</option>'."\n"; |
|
9854
|
+ $resultyesno .= '<option value="'.$no.'"'.$selected.'>'.$langs->trans($labelno).'</option>'."\n"; |
9855
|
9855
|
} |
9856
|
|
- $resultyesno .= '</select>' . "\n"; |
|
9856
|
+ $resultyesno .= '</select>'."\n"; |
9857
|
9857
|
|
9858
|
9858
|
if ($addjscombo) { |
9859
|
9859
|
$resultyesno .= ajax_combobox($htmlname, array(), 0, 0, 'resolve', ($useempty < 0 ? (string) $useempty : '-1'), $morecss); |
|
@@ -9877,12 +9877,12 @@ discard block |
|
|
block discarded – undo |
9877
|
9877
|
{ |
9878
|
9878
|
// phpcs:enable |
9879
|
9879
|
$sql = "SELECT rowid, label"; |
9880
|
|
- $sql .= " FROM " . $this->db->prefix() . "export_model"; |
9881
|
|
- $sql .= " WHERE type = '" . $this->db->escape($type) . "'"; |
|
9880
|
+ $sql .= " FROM ".$this->db->prefix()."export_model"; |
|
9881
|
+ $sql .= " WHERE type = '".$this->db->escape($type)."'"; |
9882
|
9882
|
$sql .= " ORDER BY rowid"; |
9883
|
9883
|
$result = $this->db->query($sql); |
9884
|
9884
|
if ($result) { |
9885
|
|
- print '<select class="flat" id="select_' . $htmlname . '" name="' . $htmlname . '">'; |
|
9885
|
+ print '<select class="flat" id="select_'.$htmlname.'" name="'.$htmlname.'">'; |
9886
|
9886
|
if ($useempty) { |
9887
|
9887
|
print '<option value="-1"> </option>'; |
9888
|
9888
|
} |
|
@@ -9892,9 +9892,9 @@ discard block |
|
|
block discarded – undo |
9892
|
9892
|
while ($i < $num) { |
9893
|
9893
|
$obj = $this->db->fetch_object($result); |
9894
|
9894
|
if ($selected == $obj->rowid) { |
9895
|
|
- print '<option value="' . $obj->rowid . '" selected>'; |
|
9895
|
+ print '<option value="'.$obj->rowid.'" selected>'; |
9896
|
9896
|
} else { |
9897
|
|
- print '<option value="' . $obj->rowid . '">'; |
|
9897
|
+ print '<option value="'.$obj->rowid.'">'; |
9898
|
9898
|
} |
9899
|
9899
|
print $obj->label; |
9900
|
9900
|
print '</option>'; |
|
@@ -9985,8 +9985,8 @@ discard block |
|
|
block discarded – undo |
9985
|
9985
|
$stringforfirstkey .= ' CTL +'; |
9986
|
9986
|
} |
9987
|
9987
|
|
9988
|
|
- $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>'; |
9989
|
|
- $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>'; |
|
9988
|
+ $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>'; |
|
9989
|
+ $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>'; |
9990
|
9990
|
} |
9991
|
9991
|
|
9992
|
9992
|
//print "xx".$previous_ref."x".$next_ref; |
|
@@ -9994,18 +9994,18 @@ discard block |
|
|
block discarded – undo |
9994
|
9994
|
|
9995
|
9995
|
// Right part of banner |
9996
|
9996
|
if ($morehtmlright) { |
9997
|
|
- $ret .= '<div class="inline-block floatleft">' . $morehtmlright . '</div>'; |
|
9997
|
+ $ret .= '<div class="inline-block floatleft">'.$morehtmlright.'</div>'; |
9998
|
9998
|
} |
9999
|
9999
|
|
10000
|
10000
|
if ($previous_ref || $next_ref || $morehtml) { |
10001
|
10001
|
$ret .= '<div class="pagination paginationref"><ul class="right">'; |
10002
|
10002
|
} |
10003
|
10003
|
if ($morehtml && getDolGlobalInt('MAIN_OPTIMIZEFORTEXTBROWSER') < 2) { |
10004
|
|
- $ret .= '<!-- morehtml --><li class="noborder litext' . (($shownav && $previous_ref && $next_ref) ? ' clearbothonsmartphone' : '') . '">' . $morehtml . '</li>'; |
|
10004
|
+ $ret .= '<!-- morehtml --><li class="noborder litext'.(($shownav && $previous_ref && $next_ref) ? ' clearbothonsmartphone' : '').'">'.$morehtml.'</li>'; |
10005
|
10005
|
} |
10006
|
10006
|
if ($shownav && ($previous_ref || $next_ref)) { |
10007
|
|
- $ret .= '<li class="pagination">' . $previous_ref . '</li>'; |
10008
|
|
- $ret .= '<li class="pagination">' . $next_ref . '</li>'; |
|
10007
|
+ $ret .= '<li class="pagination">'.$previous_ref.'</li>'; |
|
10008
|
+ $ret .= '<li class="pagination">'.$next_ref.'</li>'; |
10009
|
10009
|
} |
10010
|
10010
|
if ($previous_ref || $next_ref || $morehtml) { |
10011
|
10011
|
$ret .= '</ul></div>'; |
|
@@ -10020,7 +10020,7 @@ discard block |
|
|
block discarded – undo |
10020
|
10020
|
$morehtmlstatus = $hookmanager->resPrint; |
10021
|
10021
|
} |
10022
|
10022
|
if ($morehtmlstatus) { |
10023
|
|
- $ret .= '<div class="statusref">' . $morehtmlstatus . '</div>'; |
|
10023
|
+ $ret .= '<div class="statusref">'.$morehtmlstatus.'</div>'; |
10024
|
10024
|
} |
10025
|
10025
|
|
10026
|
10026
|
$parameters = array(); |
|
@@ -10034,14 +10034,14 @@ discard block |
|
|
block discarded – undo |
10034
|
10034
|
// Left part of banner |
10035
|
10035
|
if ($morehtmlleft) { |
10036
|
10036
|
if ($conf->browser->layout == 'phone') { |
10037
|
|
- $ret .= '<!-- morehtmlleft --><div class="floatleft">' . $morehtmlleft . '</div>'; |
|
10037
|
+ $ret .= '<!-- morehtmlleft --><div class="floatleft">'.$morehtmlleft.'</div>'; |
10038
|
10038
|
} else { |
10039
|
|
- $ret .= '<!-- morehtmlleft --><div class="inline-block floatleft">' . $morehtmlleft . '</div>'; |
|
10039
|
+ $ret .= '<!-- morehtmlleft --><div class="inline-block floatleft">'.$morehtmlleft.'</div>'; |
10040
|
10040
|
} |
10041
|
10041
|
} |
10042
|
10042
|
|
10043
|
10043
|
//if ($conf->browser->layout == 'phone') $ret.='<div class="clearboth"></div>'; |
10044
|
|
- $ret .= '<div class="inline-block floatleft valignmiddle maxwidth750 marginbottomonly refid' . (($shownav && ($previous_ref || $next_ref)) ? ' refidpadding' : '') . '">'; |
|
10044
|
+ $ret .= '<div class="inline-block floatleft valignmiddle maxwidth750 marginbottomonly refid'.(($shownav && ($previous_ref || $next_ref)) ? ' refidpadding' : '').'">'; |
10045
|
10045
|
|
10046
|
10046
|
// For thirdparty, contact, user, member, the ref is the id, so we show something else |
10047
|
10047
|
if ($object->element == 'societe') { |
|
@@ -10055,7 +10055,7 @@ discard block |
|
|
block discarded – undo |
10055
|
10055
|
|
10056
|
10056
|
if (is_array($arrayoflangcode) && count($arrayoflangcode)) { |
10057
|
10057
|
if (!is_object($extralanguages)) { |
10058
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/class/extralanguages.class.php'; |
|
10058
|
+ include_once DOL_DOCUMENT_ROOT.'/core/class/extralanguages.class.php'; |
10059
|
10059
|
$extralanguages = new ExtraLanguages($this->db); |
10060
|
10060
|
} |
10061
|
10061
|
$extralanguages->fetch_name_extralanguages('societe'); |
|
@@ -10070,21 +10070,21 @@ discard block |
|
|
block discarded – undo |
10070
|
10070
|
if ($object->array_languages['name'][$extralangcode]) { |
10071
|
10071
|
$htmltext .= $object->array_languages['name'][$extralangcode]; |
10072
|
10072
|
} else { |
10073
|
|
- $htmltext .= '<span class="opacitymedium">' . $langs->trans("SwitchInEditModeToAddTranslation") . '</span>'; |
|
10073
|
+ $htmltext .= '<span class="opacitymedium">'.$langs->trans("SwitchInEditModeToAddTranslation").'</span>'; |
10074
|
10074
|
} |
10075
|
10075
|
} |
10076
|
|
- $ret .= '<!-- Show translations of name -->' . "\n"; |
|
10076
|
+ $ret .= '<!-- Show translations of name -->'."\n"; |
10077
|
10077
|
$ret .= $this->textwithpicto('', $htmltext, -1, 'language', 'opacitymedium paddingleft'); |
10078
|
10078
|
} |
10079
|
10079
|
} |
10080
|
10080
|
} elseif ($object->element == 'member') { |
10081
|
10081
|
'@phan-var-force Adherent $object'; |
10082
|
|
- $ret .= $object->ref . '<br>'; |
|
10082
|
+ $ret .= $object->ref.'<br>'; |
10083
|
10083
|
$fullname = $object->getFullName($langs); |
10084
|
10084
|
if ($object->morphy == 'mor' && $object->societe) { |
10085
|
|
- $ret .= dol_htmlentities($object->societe) . ((!empty($fullname) && $object->societe != $fullname) ? ' (' . dol_htmlentities($fullname) . $addgendertxt . ')' : ''); |
|
10085
|
+ $ret .= dol_htmlentities($object->societe).((!empty($fullname) && $object->societe != $fullname) ? ' ('.dol_htmlentities($fullname).$addgendertxt.')' : ''); |
10086
|
10086
|
} else { |
10087
|
|
- $ret .= dol_htmlentities($fullname) . $addgendertxt . ((!empty($object->societe) && $object->societe != $fullname) ? ' (' . dol_htmlentities($object->societe) . ')' : ''); |
|
10087
|
+ $ret .= dol_htmlentities($fullname).$addgendertxt.((!empty($object->societe) && $object->societe != $fullname) ? ' ('.dol_htmlentities($object->societe).')' : ''); |
10088
|
10088
|
} |
10089
|
10089
|
} elseif (in_array($object->element, array('contact', 'user'))) { |
10090
|
10090
|
$ret .= '<span class="valignmiddle">'.dol_htmlentities($object->getFullName($langs)).'</span>'.$addgendertxt; |
|
@@ -10092,7 +10092,7 @@ discard block |
|
|
block discarded – undo |
10092
|
10092
|
$ret .= dol_htmlentities($object->name); |
10093
|
10093
|
} elseif (in_array($object->element, array('action', 'agenda'))) { |
10094
|
10094
|
'@phan-var-force ActionComm $object'; |
10095
|
|
- $ret .= $object->ref . '<br>' . $object->label; |
|
10095
|
+ $ret .= $object->ref.'<br>'.$object->label; |
10096
|
10096
|
} elseif (in_array($object->element, array('adherent_type'))) { |
10097
|
10097
|
$ret .= $object->label; |
10098
|
10098
|
} elseif ($object->element == 'ecm_directories') { |
|
@@ -10145,9 +10145,9 @@ discard block |
|
|
block discarded – undo |
10145
|
10145
|
} |
10146
|
10146
|
|
10147
|
10147
|
// Barcode image @phan-suppress-next-line PhanUndeclaredProperty |
10148
|
|
- $url = DOL_URL_ROOT . '/viewimage.php?modulepart=barcode&generator=' . urlencode($object->barcode_type_coder) . '&code=' . urlencode($object->barcode) . '&encoding=' . urlencode($object->barcode_type_code); |
10149
|
|
- $out = '<!-- url barcode = ' . $url . ' -->'; |
10150
|
|
- $out .= '<img src="' . $url . '"' . ($morecss ? ' class="' . $morecss . '"' : '') . '>'; |
|
10148
|
+ $url = DOL_URL_ROOT.'/viewimage.php?modulepart=barcode&generator='.urlencode($object->barcode_type_coder).'&code='.urlencode($object->barcode).'&encoding='.urlencode($object->barcode_type_code); |
|
10149
|
+ $out = '<!-- url barcode = '.$url.' -->'; |
|
10150
|
+ $out .= '<img src="'.$url.'"'.($morecss ? ' class="'.$morecss.'"' : '').'>'; |
10151
|
10151
|
|
10152
|
10152
|
return $out; |
10153
|
10153
|
} |
|
@@ -10174,7 +10174,7 @@ discard block |
|
|
block discarded – undo |
10174
|
10174
|
global $conf, $langs; |
10175
|
10175
|
|
10176
|
10176
|
$entity = (empty($object->entity) ? $conf->entity : $object->entity); |
10177
|
|
- $id = (empty($object->id) ? $object->rowid : $object->id); // @phan-suppress-current-line PhanUndeclaredProperty (->rowid) |
|
10177
|
+ $id = (empty($object->id) ? $object->rowid : $object->id); // @phan-suppress-current-line PhanUndeclaredProperty (->rowid) |
10178
|
10178
|
|
10179
|
10179
|
$dir = ''; |
10180
|
10180
|
$file = ''; |
|
@@ -10187,28 +10187,28 @@ discard block |
|
|
block discarded – undo |
10187
|
10187
|
if (!empty($object->logo)) { |
10188
|
10188
|
if (dolIsAllowedForPreview($object->logo)) { |
10189
|
10189
|
if ((string) $imagesize == 'mini') { |
10190
|
|
- $file = get_exdir(0, 0, 0, 0, $object, 'thirdparty') . 'logos/' . getImageFileNameForSize($object->logo, '_mini'); // getImageFileNameForSize include the thumbs |
|
10190
|
+ $file = get_exdir(0, 0, 0, 0, $object, 'thirdparty').'logos/'.getImageFileNameForSize($object->logo, '_mini'); // getImageFileNameForSize include the thumbs |
10191
|
10191
|
} elseif ((string) $imagesize == 'small') { |
10192
|
|
- $file = get_exdir(0, 0, 0, 0, $object, 'thirdparty') . 'logos/' . getImageFileNameForSize($object->logo, '_small'); |
|
10192
|
+ $file = get_exdir(0, 0, 0, 0, $object, 'thirdparty').'logos/'.getImageFileNameForSize($object->logo, '_small'); |
10193
|
10193
|
} else { |
10194
|
|
- $file = get_exdir(0, 0, 0, 0, $object, 'thirdparty') . 'logos/' . $object->logo; |
|
10194
|
+ $file = get_exdir(0, 0, 0, 0, $object, 'thirdparty').'logos/'.$object->logo; |
10195
|
10195
|
} |
10196
|
|
- $originalfile = get_exdir(0, 0, 0, 0, $object, 'thirdparty') . 'logos/' . $object->logo; |
|
10196
|
+ $originalfile = get_exdir(0, 0, 0, 0, $object, 'thirdparty').'logos/'.$object->logo; |
10197
|
10197
|
} |
10198
|
10198
|
} |
10199
|
10199
|
$email = $object->email; |
10200
|
10200
|
} elseif ($modulepart == 'contact') { |
10201
|
|
- $dir = $conf->societe->multidir_output[$entity] . '/contact'; |
|
10201
|
+ $dir = $conf->societe->multidir_output[$entity].'/contact'; |
10202
|
10202
|
if (!empty($object->photo)) { |
10203
|
10203
|
if (dolIsAllowedForPreview($object->photo)) { |
10204
|
10204
|
if ((string) $imagesize == 'mini') { |
10205
|
|
- $file = get_exdir(0, 0, 0, 0, $object, 'contact') . 'photos/' . getImageFileNameForSize($object->photo, '_mini'); |
|
10205
|
+ $file = get_exdir(0, 0, 0, 0, $object, 'contact').'photos/'.getImageFileNameForSize($object->photo, '_mini'); |
10206
|
10206
|
} elseif ((string) $imagesize == 'small') { |
10207
|
|
- $file = get_exdir(0, 0, 0, 0, $object, 'contact') . 'photos/' . getImageFileNameForSize($object->photo, '_small'); |
|
10207
|
+ $file = get_exdir(0, 0, 0, 0, $object, 'contact').'photos/'.getImageFileNameForSize($object->photo, '_small'); |
10208
|
10208
|
} else { |
10209
|
|
- $file = get_exdir(0, 0, 0, 0, $object, 'contact') . 'photos/' . $object->photo; |
|
10209
|
+ $file = get_exdir(0, 0, 0, 0, $object, 'contact').'photos/'.$object->photo; |
10210
|
10210
|
} |
10211
|
|
- $originalfile = get_exdir(0, 0, 0, 0, $object, 'contact') . 'photos/' . $object->photo; |
|
10211
|
+ $originalfile = get_exdir(0, 0, 0, 0, $object, 'contact').'photos/'.$object->photo; |
10212
|
10212
|
} |
10213
|
10213
|
} |
10214
|
10214
|
$email = $object->email; |
|
@@ -10218,17 +10218,17 @@ discard block |
|
|
block discarded – undo |
10218
|
10218
|
if (!empty($object->photo)) { |
10219
|
10219
|
if (dolIsAllowedForPreview($object->photo)) { |
10220
|
10220
|
if ((string) $imagesize == 'mini') { |
10221
|
|
- $file = get_exdir(0, 0, 0, 0, $object, 'user') . 'photos/' . getImageFileNameForSize($object->photo, '_mini'); |
|
10221
|
+ $file = get_exdir(0, 0, 0, 0, $object, 'user').'photos/'.getImageFileNameForSize($object->photo, '_mini'); |
10222
|
10222
|
} elseif ((string) $imagesize == 'small') { |
10223
|
|
- $file = get_exdir(0, 0, 0, 0, $object, 'user') . 'photos/' . getImageFileNameForSize($object->photo, '_small'); |
|
10223
|
+ $file = get_exdir(0, 0, 0, 0, $object, 'user').'photos/'.getImageFileNameForSize($object->photo, '_small'); |
10224
|
10224
|
} else { |
10225
|
|
- $file = get_exdir(0, 0, 0, 0, $object, 'user') . 'photos/' . $object->photo; |
|
10225
|
+ $file = get_exdir(0, 0, 0, 0, $object, 'user').'photos/'.$object->photo; |
10226
|
10226
|
} |
10227
|
|
- $originalfile = get_exdir(0, 0, 0, 0, $object, 'user') . 'photos/' . $object->photo; |
|
10227
|
+ $originalfile = get_exdir(0, 0, 0, 0, $object, 'user').'photos/'.$object->photo; |
10228
|
10228
|
} |
10229
|
10229
|
} |
10230
|
10230
|
if (getDolGlobalString('MAIN_OLD_IMAGE_LINKS')) { |
10231
|
|
- $altfile = $object->id . ".jpg"; // For backward compatibility |
|
10231
|
+ $altfile = $object->id.".jpg"; // For backward compatibility |
10232
|
10232
|
} |
10233
|
10233
|
$email = $object->email; |
10234
|
10234
|
$capture = 'user'; |
|
@@ -10237,17 +10237,17 @@ discard block |
|
|
block discarded – undo |
10237
|
10237
|
if (!empty($object->photo)) { |
10238
|
10238
|
if (dolIsAllowedForPreview($object->photo)) { |
10239
|
10239
|
if ((string) $imagesize == 'mini') { |
10240
|
|
- $file = get_exdir(0, 0, 0, 0, $object, 'member') . 'photos/' . getImageFileNameForSize($object->photo, '_mini'); |
|
10240
|
+ $file = get_exdir(0, 0, 0, 0, $object, 'member').'photos/'.getImageFileNameForSize($object->photo, '_mini'); |
10241
|
10241
|
} elseif ((string) $imagesize == 'small') { |
10242
|
|
- $file = get_exdir(0, 0, 0, 0, $object, 'member') . 'photos/' . getImageFileNameForSize($object->photo, '_small'); |
|
10242
|
+ $file = get_exdir(0, 0, 0, 0, $object, 'member').'photos/'.getImageFileNameForSize($object->photo, '_small'); |
10243
|
10243
|
} else { |
10244
|
|
- $file = get_exdir(0, 0, 0, 0, $object, 'member') . 'photos/' . $object->photo; |
|
10244
|
+ $file = get_exdir(0, 0, 0, 0, $object, 'member').'photos/'.$object->photo; |
10245
|
10245
|
} |
10246
|
|
- $originalfile = get_exdir(0, 0, 0, 0, $object, 'member') . 'photos/' . $object->photo; |
|
10246
|
+ $originalfile = get_exdir(0, 0, 0, 0, $object, 'member').'photos/'.$object->photo; |
10247
|
10247
|
} |
10248
|
10248
|
} |
10249
|
10249
|
if (getDolGlobalString('MAIN_OLD_IMAGE_LINKS')) { |
10250
|
|
- $altfile = $object->id . ".jpg"; // For backward compatibility |
|
10250
|
+ $altfile = $object->id.".jpg"; // For backward compatibility |
10251
|
10251
|
} |
10252
|
10252
|
$email = $object->email; |
10253
|
10253
|
$capture = 'user'; |
|
@@ -10273,35 +10273,35 @@ discard block |
|
|
block discarded – undo |
10273
|
10273
|
$ret = ''; |
10274
|
10274
|
|
10275
|
10275
|
if ($dir) { |
10276
|
|
- if ($file && file_exists($dir . "/" . $file)) { |
|
10276
|
+ if ($file && file_exists($dir."/".$file)) { |
10277
|
10277
|
if ($addlinktofullsize) { |
10278
|
|
- $urladvanced = getAdvancedPreviewUrl($modulepart, $originalfile, 0, '&entity=' . $entity); |
|
10278
|
+ $urladvanced = getAdvancedPreviewUrl($modulepart, $originalfile, 0, '&entity='.$entity); |
10279
|
10279
|
if ($urladvanced) { |
10280
|
|
- $ret .= '<a href="' . $urladvanced . '">'; |
|
10280
|
+ $ret .= '<a href="'.$urladvanced.'">'; |
10281
|
10281
|
} else { |
10282
|
|
- $ret .= '<a href="' . DOL_URL_ROOT . '/viewimage.php?modulepart=' . $modulepart . '&entity=' . $entity . '&file=' . urlencode($originalfile) . '&cache=' . $cache . '">'; |
|
10282
|
+ $ret .= '<a href="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$entity.'&file='.urlencode($originalfile).'&cache='.$cache.'">'; |
10283
|
10283
|
} |
10284
|
10284
|
} |
10285
|
|
- $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 . '">'; |
|
10285
|
+ $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.'">'; |
10286
|
10286
|
if ($addlinktofullsize) { |
10287
|
10287
|
$ret .= '</a>'; |
10288
|
10288
|
} |
10289
|
|
- } elseif ($altfile && file_exists($dir . "/" . $altfile)) { |
|
10289
|
+ } elseif ($altfile && file_exists($dir."/".$altfile)) { |
10290
|
10290
|
if ($addlinktofullsize) { |
10291
|
|
- $urladvanced = getAdvancedPreviewUrl($modulepart, $originalfile, 0, '&entity=' . $entity); |
|
10291
|
+ $urladvanced = getAdvancedPreviewUrl($modulepart, $originalfile, 0, '&entity='.$entity); |
10292
|
10292
|
if ($urladvanced) { |
10293
|
|
- $ret .= '<a href="' . $urladvanced . '">'; |
|
10293
|
+ $ret .= '<a href="'.$urladvanced.'">'; |
10294
|
10294
|
} else { |
10295
|
|
- $ret .= '<a href="' . DOL_URL_ROOT . '/viewimage.php?modulepart=' . $modulepart . '&entity=' . $entity . '&file=' . urlencode($originalfile) . '&cache=' . $cache . '">'; |
|
10295
|
+ $ret .= '<a href="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$entity.'&file='.urlencode($originalfile).'&cache='.$cache.'">'; |
10296
|
10296
|
} |
10297
|
10297
|
} |
10298
|
|
- $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 . '">'; |
|
10298
|
+ $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.'">'; |
10299
|
10299
|
if ($addlinktofullsize) { |
10300
|
10300
|
$ret .= '</a>'; |
10301
|
10301
|
} |
10302
|
10302
|
} else { |
10303
|
10303
|
$nophoto = '/public/theme/common/nophoto.png'; |
10304
|
|
- $defaultimg = 'identicon'; // For gravatar |
|
10304
|
+ $defaultimg = 'identicon'; // For gravatar |
10305
|
10305
|
if (in_array($modulepart, array('societe', 'userphoto', 'contact', 'memberphoto'))) { // For modules that need a special image when photo not found |
10306
|
10306
|
if ($modulepart == 'societe' || ($modulepart == 'memberphoto' && !empty($object->morphy) && strpos($object->morphy, 'mor') !== false)) { |
10307
|
10307
|
$nophoto = 'company'; |
|
@@ -10319,13 +10319,13 @@ discard block |
|
|
block discarded – undo |
10319
|
10319
|
if (isModEnabled('gravatar') && $email && empty($noexternsourceoverwrite)) { |
10320
|
10320
|
// see https://gravatar.com/site/implement/images/php/ |
10321
|
10321
|
$ret .= '<!-- Put link to gravatar -->'; |
10322
|
|
- $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 |
|
10322
|
+ $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 |
10323
|
10323
|
} else { |
10324
|
10324
|
if ($nophoto == 'company') { |
10325
|
|
- $ret .= '<div class="divforspanimg valignmiddle center photo' . $modulepart . ($cssclass ? ' ' . $cssclass : '') . '" alt="" ' . ($width ? ' width="' . $width . '"' : '') . ($height ? ' height="' . $height . '"' : '') . '>' . img_picto('', 'company') . '</div>'; |
|
10325
|
+ $ret .= '<div class="divforspanimg valignmiddle center photo'.$modulepart.($cssclass ? ' '.$cssclass : '').'" alt="" '.($width ? ' width="'.$width.'"' : '').($height ? ' height="'.$height.'"' : '').'>'.img_picto('', 'company').'</div>'; |
10326
|
10326
|
//$ret .= '<div class="difforspanimgright"></div>'; |
10327
|
10327
|
} else { |
10328
|
|
- $ret .= '<img class="photo' . $modulepart . ($cssclass ? ' ' . $cssclass : '') . '" alt="" ' . ($width ? ' width="' . $width . '"' : '') . ($height ? ' height="' . $height . '"' : '') . ' src="' . DOL_URL_ROOT . $nophoto . '">'; |
|
10328
|
+ $ret .= '<img class="photo'.$modulepart.($cssclass ? ' '.$cssclass : '').'" alt="" '.($width ? ' width="'.$width.'"' : '').($height ? ' height="'.$height.'"' : '').' src="'.DOL_URL_ROOT.$nophoto.'">'; |
10329
|
10329
|
} |
10330
|
10330
|
} |
10331
|
10331
|
} |
|
@@ -10336,15 +10336,15 @@ discard block |
|
|
block discarded – undo |
10336
|
10336
|
} |
10337
|
10337
|
$ret .= '<table class="nobordernopadding centpercent">'; |
10338
|
10338
|
if ($object->photo) { |
10339
|
|
- $ret .= '<tr><td><input type="checkbox" class="flat photodelete" name="deletephoto" id="photodelete"> <label for="photodelete">' . $langs->trans("Delete") . '</label><br><br></td></tr>'; |
|
10339
|
+ $ret .= '<tr><td><input type="checkbox" class="flat photodelete" name="deletephoto" id="photodelete"> <label for="photodelete">'.$langs->trans("Delete").'</label><br><br></td></tr>'; |
10340
|
10340
|
} |
10341
|
10341
|
$ret .= '<tr><td class="tdoverflow">'; |
10342
|
10342
|
$maxfilesizearray = getMaxFileSizeArray(); |
10343
|
10343
|
$maxmin = $maxfilesizearray['maxmin']; |
10344
|
10344
|
if ($maxmin > 0) { |
10345
|
|
- $ret .= '<input type="hidden" name="MAX_FILE_SIZE" value="' . ($maxmin * 1024) . '">'; // MAX_FILE_SIZE must precede the field type=file |
|
10345
|
+ $ret .= '<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).'">'; // MAX_FILE_SIZE must precede the field type=file |
10346
|
10346
|
} |
10347
|
|
- $ret .= '<input type="file" class="flat maxwidth200onsmartphone" name="photo" id="photoinput" accept="image/*"' . ($capture ? ' capture="' . $capture . '"' : '') . '>'; |
|
10347
|
+ $ret .= '<input type="file" class="flat maxwidth200onsmartphone" name="photo" id="photoinput" accept="image/*"'.($capture ? ' capture="'.$capture.'"' : '').'>'; |
10348
|
10348
|
$ret .= '</td></tr>'; |
10349
|
10349
|
$ret .= '</table>'; |
10350
|
10350
|
} |
|
@@ -10398,38 +10398,38 @@ discard block |
|
|
block discarded – undo |
10398
|
10398
|
if (isModEnabled('multicompany') && $conf->entity == 1 && $user->admin && !$user->entity) { |
10399
|
10399
|
$sql .= ", e.label"; |
10400
|
10400
|
} |
10401
|
|
- $sql .= " FROM " . $this->db->prefix() . "usergroup as ug "; |
|
10401
|
+ $sql .= " FROM ".$this->db->prefix()."usergroup as ug "; |
10402
|
10402
|
if (isModEnabled('multicompany') && $conf->entity == 1 && $user->admin && !$user->entity) { |
10403
|
|
- $sql .= " LEFT JOIN " . $this->db->prefix() . "entity as e ON e.rowid=ug.entity"; |
|
10403
|
+ $sql .= " LEFT JOIN ".$this->db->prefix()."entity as e ON e.rowid=ug.entity"; |
10404
|
10404
|
if ($force_entity) { |
10405
|
|
- $sql .= " WHERE ug.entity IN (0, " . $force_entity . ")"; |
|
10405
|
+ $sql .= " WHERE ug.entity IN (0, ".$force_entity.")"; |
10406
|
10406
|
} else { |
10407
|
10407
|
$sql .= " WHERE ug.entity IS NOT NULL"; |
10408
|
10408
|
} |
10409
|
10409
|
} else { |
10410
|
|
- $sql .= " WHERE ug.entity IN (0, " . $conf->entity . ")"; |
|
10410
|
+ $sql .= " WHERE ug.entity IN (0, ".$conf->entity.")"; |
10411
|
10411
|
} |
10412
|
10412
|
if (is_array($exclude) && $excludeGroups) { |
10413
|
|
- $sql .= " AND ug.rowid NOT IN (" . $this->db->sanitize($excludeGroups) . ")"; |
|
10413
|
+ $sql .= " AND ug.rowid NOT IN (".$this->db->sanitize($excludeGroups).")"; |
10414
|
10414
|
} |
10415
|
10415
|
if (is_array($include) && $includeGroups) { |
10416
|
|
- $sql .= " AND ug.rowid IN (" . $this->db->sanitize($includeGroups) . ")"; |
|
10416
|
+ $sql .= " AND ug.rowid IN (".$this->db->sanitize($includeGroups).")"; |
10417
|
10417
|
} |
10418
|
10418
|
$sql .= " ORDER BY ug.nom ASC"; |
10419
|
10419
|
|
10420
|
|
- dol_syslog(get_class($this) . "::select_dolgroups", LOG_DEBUG); |
|
10420
|
+ dol_syslog(get_class($this)."::select_dolgroups", LOG_DEBUG); |
10421
|
10421
|
$resql = $this->db->query($sql); |
10422
|
10422
|
if ($resql) { |
10423
|
10423
|
// Enhance with select2 |
10424
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
10424
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
10425
|
10425
|
|
10426
|
|
- $out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" id="' . $htmlname . '" name="' . $htmlname . ($multiple ? '[]' : '') . '" ' . ($multiple ? 'multiple' : '') . ' ' . ($disabled ? ' disabled' : '') . '>'; |
|
10426
|
+ $out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" id="'.$htmlname.'" name="'.$htmlname.($multiple ? '[]' : '').'" '.($multiple ? 'multiple' : '').' '.($disabled ? ' disabled' : '').'>'; |
10427
|
10427
|
|
10428
|
10428
|
$num = $this->db->num_rows($resql); |
10429
|
10429
|
$i = 0; |
10430
|
10430
|
if ($num) { |
10431
|
10431
|
if ($show_empty && !$multiple) { |
10432
|
|
- $out .= '<option value="-1"' . (in_array(-1, $selected) ? ' selected' : '') . '> </option>' . "\n"; |
|
10432
|
+ $out .= '<option value="-1"'.(in_array(-1, $selected) ? ' selected' : '').'> </option>'."\n"; |
10433
|
10433
|
} |
10434
|
10434
|
|
10435
|
10435
|
while ($i < $num) { |
|
@@ -10442,11 +10442,11 @@ discard block |
|
|
block discarded – undo |
10442
|
10442
|
$label = $obj->name; |
10443
|
10443
|
$labelhtml = $obj->name; |
10444
|
10444
|
if (isModEnabled('multicompany') && !getDolGlobalInt('MULTICOMPANY_TRANSVERSE_MODE') && $conf->entity == 1) { |
10445
|
|
- $label .= " (" . $obj->label . ")"; |
10446
|
|
- $labelhtml .= ' <span class="opacitymedium">(' . $obj->label . ')</span>'; |
|
10445
|
+ $label .= " (".$obj->label.")"; |
|
10446
|
+ $labelhtml .= ' <span class="opacitymedium">('.$obj->label.')</span>'; |
10447
|
10447
|
} |
10448
|
10448
|
|
10449
|
|
- $out .= '<option value="' . $obj->rowid . '"'; |
|
10449
|
+ $out .= '<option value="'.$obj->rowid.'"'; |
10450
|
10450
|
if ($disableline) { |
10451
|
10451
|
$out .= ' disabled'; |
10452
|
10452
|
} |
|
@@ -10462,9 +10462,9 @@ discard block |
|
|
block discarded – undo |
10462
|
10462
|
} |
10463
|
10463
|
} else { |
10464
|
10464
|
if ($show_empty) { |
10465
|
|
- $out .= '<option value="-1"' . (in_array(-1, $selected) ? ' selected' : '') . '></option>' . "\n"; |
|
10465
|
+ $out .= '<option value="-1"'.(in_array(-1, $selected) ? ' selected' : '').'></option>'."\n"; |
10466
|
10466
|
} |
10467
|
|
- $out .= '<option value="" disabled>' . $langs->trans("NoUserGroupDefined") . '</option>'; |
|
10467
|
+ $out .= '<option value="" disabled>'.$langs->trans("NoUserGroupDefined").'</option>'; |
10468
|
10468
|
} |
10469
|
10469
|
$out .= '</select>'; |
10470
|
10470
|
|
|
@@ -10508,25 +10508,25 @@ discard block |
|
|
block discarded – undo |
10508
|
10508
|
$out = ''; |
10509
|
10509
|
|
10510
|
10510
|
if (!empty($conf->use_javascript_ajax)) { |
10511
|
|
- $out .= '<div class="inline-block checkallactions"><input type="checkbox" id="' . $cssclass . 's" name="' . $cssclass . 's" class="checkallactions"></div>'; |
|
10511
|
+ $out .= '<div class="inline-block checkallactions"><input type="checkbox" id="'.$cssclass.'s" name="'.$cssclass.'s" class="checkallactions"></div>'; |
10512
|
10512
|
} |
10513
|
|
- $out .= '<script nonce="' . getNonce() . '"> |
|
10513
|
+ $out .= '<script nonce="'.getNonce().'"> |
10514
|
10514
|
$(document).ready(function() { |
10515
|
|
- $("#' . $cssclass . 's").click(function() { |
|
10515
|
+ $("#' . $cssclass.'s").click(function() { |
10516
|
10516
|
if($(this).is(\':checked\')){ |
10517
|
|
- console.log("We check all ' . $cssclass . ' and trigger the change method"); |
10518
|
|
- $(".' . $cssclass . '").prop(\'checked\', true).trigger(\'change\'); |
|
10517
|
+ console.log("We check all ' . $cssclass.' and trigger the change method"); |
|
10518
|
+ $(".' . $cssclass.'").prop(\'checked\', true).trigger(\'change\'); |
10519
|
10519
|
} |
10520
|
10520
|
else |
10521
|
10521
|
{ |
10522
|
10522
|
console.log("We uncheck all"); |
10523
|
|
- $(".' . $cssclass . '").prop(\'checked\', false).trigger(\'change\'); |
|
10523
|
+ $(".' . $cssclass.'").prop(\'checked\', false).trigger(\'change\'); |
10524
|
10524
|
}' . "\n"; |
10525
|
10525
|
if ($calljsfunction) { |
10526
|
|
- $out .= 'if (typeof initCheckForSelect == \'function\') { initCheckForSelect(0, "' . $massactionname . '", "' . $cssclass . '"); } else { console.log("No function initCheckForSelect found. Call won\'t be done."); }'; |
|
10526
|
+ $out .= 'if (typeof initCheckForSelect == \'function\') { initCheckForSelect(0, "'.$massactionname.'", "'.$cssclass.'"); } else { console.log("No function initCheckForSelect found. Call won\'t be done."); }'; |
10527
|
10527
|
} |
10528
|
10528
|
$out .= ' }); |
10529
|
|
- $(".' . $cssclass . '").change(function() { |
|
10529
|
+ $(".' . $cssclass.'").change(function() { |
10530
|
10530
|
$(this).closest("tr").toggleClass("highlight", this.checked); |
10531
|
10531
|
}); |
10532
|
10532
|
}); |
|
@@ -10571,67 +10571,67 @@ discard block |
|
|
block discarded – undo |
10571
|
10571
|
global $langs, $user; |
10572
|
10572
|
|
10573
|
10573
|
$out = ''; |
10574
|
|
- $sql = "SELECT rowid, label FROM " . $this->db->prefix() . "c_exp_tax_cat WHERE active = 1"; |
10575
|
|
- $sql .= " AND entity IN (0," . getEntity('exp_tax_cat') . ")"; |
|
10574
|
+ $sql = "SELECT rowid, label FROM ".$this->db->prefix()."c_exp_tax_cat WHERE active = 1"; |
|
10575
|
+ $sql .= " AND entity IN (0,".getEntity('exp_tax_cat').")"; |
10576
|
10576
|
if (!empty($excludeid)) { |
10577
|
|
- $sql .= " AND rowid NOT IN (" . $this->db->sanitize(implode(',', $excludeid)) . ")"; |
|
10577
|
+ $sql .= " AND rowid NOT IN (".$this->db->sanitize(implode(',', $excludeid)).")"; |
10578
|
10578
|
} |
10579
|
10579
|
$sql .= " ORDER BY label"; |
10580
|
10580
|
|
10581
|
10581
|
$resql = $this->db->query($sql); |
10582
|
10582
|
if ($resql) { |
10583
|
|
- $out = '<select id="select_' . $htmlname . '" name="' . $htmlname . '" class="' . $htmlname . ' flat minwidth75imp maxwidth200">'; |
|
10583
|
+ $out = '<select id="select_'.$htmlname.'" name="'.$htmlname.'" class="'.$htmlname.' flat minwidth75imp maxwidth200">'; |
10584
|
10584
|
if ($useempty) { |
10585
|
10585
|
$out .= '<option value="0"> </option>'; |
10586
|
10586
|
} |
10587
|
10587
|
|
10588
|
10588
|
while ($obj = $this->db->fetch_object($resql)) { |
10589
|
|
- $out .= '<option ' . ($selected == $obj->rowid ? 'selected="selected"' : '') . ' value="' . $obj->rowid . '">' . $langs->trans($obj->label) . '</option>'; |
|
10589
|
+ $out .= '<option '.($selected == $obj->rowid ? 'selected="selected"' : '').' value="'.$obj->rowid.'">'.$langs->trans($obj->label).'</option>'; |
10590
|
10590
|
} |
10591
|
10591
|
$out .= '</select>'; |
10592
|
|
- $out .= ajax_combobox('select_' . $htmlname); |
|
10592
|
+ $out .= ajax_combobox('select_'.$htmlname); |
10593
|
10593
|
|
10594
|
10594
|
if (!empty($htmlname) && $user->admin && $info_admin) { |
10595
|
|
- $out .= ' ' . info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); |
|
10595
|
+ $out .= ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); |
10596
|
10596
|
} |
10597
|
10597
|
|
10598
|
10598
|
if (!empty($target)) { |
10599
|
|
- $sql = "SELECT c.id FROM " . $this->db->prefix() . "c_type_fees as c WHERE c.code = 'EX_KME' AND c.active = 1"; |
|
10599
|
+ $sql = "SELECT c.id FROM ".$this->db->prefix()."c_type_fees as c WHERE c.code = 'EX_KME' AND c.active = 1"; |
10600
|
10600
|
$resql = $this->db->query($sql); |
10601
|
10601
|
if ($resql) { |
10602
|
10602
|
if ($this->db->num_rows($resql) > 0) { |
10603
|
10603
|
$obj = $this->db->fetch_object($resql); |
10604
|
|
- $out .= '<script nonce="' . getNonce() . '"> |
|
10604
|
+ $out .= '<script nonce="'.getNonce().'"> |
10605
|
10605
|
$(function() { |
10606
|
|
- $("select[name=' . $target . ']").on("change", function() { |
|
10606
|
+ $("select[name=' . $target.']").on("change", function() { |
10607
|
10607
|
var current_val = $(this).val(); |
10608
|
|
- if (current_val == ' . $obj->id . ') {'; |
|
10608
|
+ if (current_val == ' . $obj->id.') {'; |
10609
|
10609
|
if (!empty($default_selected) || !empty($selected)) { |
10610
|
|
- $out .= '$("select[name=' . $htmlname . ']").val("' . ($default_selected > 0 ? $default_selected : $selected) . '");'; |
|
10610
|
+ $out .= '$("select[name='.$htmlname.']").val("'.($default_selected > 0 ? $default_selected : $selected).'");'; |
10611
|
10611
|
} |
10612
|
10612
|
|
10613
|
10613
|
$out .= ' |
10614
|
|
- $("select[name=' . $htmlname . ']").change(); |
|
10614
|
+ $("select[name=' . $htmlname.']").change(); |
10615
|
10615
|
} |
10616
|
10616
|
}); |
10617
|
10617
|
|
10618
|
|
- $("select[name=' . $htmlname . ']").change(function() { |
|
10618
|
+ $("select[name=' . $htmlname.']").change(function() { |
10619
|
10619
|
|
10620
|
|
- if ($("select[name=' . $target . ']").val() == ' . $obj->id . ') { |
|
10620
|
+ if ($("select[name=' . $target.']").val() == '.$obj->id.') { |
10621
|
10621
|
// get price of kilometer to fill the unit price |
10622
|
10622
|
$.ajax({ |
10623
|
10623
|
method: "POST", |
10624
|
10624
|
dataType: "json", |
10625
|
|
- data: { fk_c_exp_tax_cat: $(this).val(), token: \'' . currentToken() . '\' }, |
10626
|
|
- url: "' . (DOL_URL_ROOT . '/expensereport/ajax/ajaxik.php?' . implode('&', $params)) . '", |
|
10625
|
+ data: { fk_c_exp_tax_cat: $(this).val(), token: \'' . currentToken().'\' }, |
|
10626
|
+ url: "' . (DOL_URL_ROOT.'/expensereport/ajax/ajaxik.php?'.implode('&', $params)).'", |
10627
|
10627
|
}).done(function( data, textStatus, jqXHR ) { |
10628
|
10628
|
console.log(data); |
10629
|
10629
|
if (typeof data.up != "undefined") { |
10630
|
10630
|
$("input[name=value_unit]").val(data.up); |
10631
|
|
- $("select[name=' . $htmlname . ']").attr("title", data.title); |
|
10631
|
+ $("select[name=' . $htmlname.']").attr("title", data.title); |
10632
|
10632
|
} else { |
10633
|
10633
|
$("input[name=value_unit]").val(""); |
10634
|
|
- $("select[name=' . $htmlname . ']").attr("title", ""); |
|
10634
|
+ $("select[name=' . $htmlname.']").attr("title", ""); |
10635
|
10635
|
} |
10636
|
10636
|
}); |
10637
|
10637
|
} |
|
@@ -10661,18 +10661,18 @@ discard block |
|
|
block discarded – undo |
10661
|
10661
|
global $conf, $langs; |
10662
|
10662
|
|
10663
|
10663
|
$out = ''; |
10664
|
|
- $sql = "SELECT rowid, range_ik FROM " . $this->db->prefix() . "c_exp_tax_range"; |
10665
|
|
- $sql .= " WHERE entity = " . $conf->entity . " AND active = 1"; |
|
10664
|
+ $sql = "SELECT rowid, range_ik FROM ".$this->db->prefix()."c_exp_tax_range"; |
|
10665
|
+ $sql .= " WHERE entity = ".$conf->entity." AND active = 1"; |
10666
|
10666
|
|
10667
|
10667
|
$resql = $this->db->query($sql); |
10668
|
10668
|
if ($resql) { |
10669
|
|
- $out = '<select id="select_' . $htmlname . '" name="' . $htmlname . '" class="' . $htmlname . ' flat minwidth75imp">'; |
|
10669
|
+ $out = '<select id="select_'.$htmlname.'" name="'.$htmlname.'" class="'.$htmlname.' flat minwidth75imp">'; |
10670
|
10670
|
if ($useempty) { |
10671
|
10671
|
$out .= '<option value="0"></option>'; |
10672
|
10672
|
} |
10673
|
10673
|
|
10674
|
10674
|
while ($obj = $this->db->fetch_object($resql)) { |
10675
|
|
- $out .= '<option ' . ($selected == $obj->rowid ? 'selected="selected"' : '') . ' value="' . $obj->rowid . '">' . price($obj->range_ik, 0, $langs, 1, 0) . '</option>'; |
|
10675
|
+ $out .= '<option '.($selected == $obj->rowid ? 'selected="selected"' : '').' value="'.$obj->rowid.'">'.price($obj->range_ik, 0, $langs, 1, 0).'</option>'; |
10676
|
10676
|
} |
10677
|
10677
|
$out .= '</select>'; |
10678
|
10678
|
} else { |
|
@@ -10703,12 +10703,12 @@ discard block |
|
|
block discarded – undo |
10703
|
10703
|
|
10704
|
10704
|
$resql = $this->db->query($sql); |
10705
|
10705
|
if ($resql) { |
10706
|
|
- $out = '<select id="select_' . $htmlname . '" name="' . $htmlname . '" class="' . $htmlname . ' flat minwidth75imp">'; |
|
10706
|
+ $out = '<select id="select_'.$htmlname.'" name="'.$htmlname.'" class="'.$htmlname.' flat minwidth75imp">'; |
10707
|
10707
|
if ($useempty) { |
10708
|
10708
|
$out .= '<option value="0"></option>'; |
10709
|
10709
|
} |
10710
|
10710
|
if ($allchoice) { |
10711
|
|
- $out .= '<option value="-1">' . $langs->trans('AllExpenseReport') . '</option>'; |
|
10711
|
+ $out .= '<option value="-1">'.$langs->trans('AllExpenseReport').'</option>'; |
10712
|
10712
|
} |
10713
|
10713
|
|
10714
|
10714
|
$field = 'code'; |
|
@@ -10718,7 +10718,7 @@ discard block |
|
|
block discarded – undo |
10718
|
10718
|
|
10719
|
10719
|
while ($obj = $this->db->fetch_object($resql)) { |
10720
|
10720
|
$key = $langs->trans($obj->code); |
10721
|
|
- $out .= '<option ' . ($selected == $obj->{$field} ? 'selected="selected"' : '') . ' value="' . $obj->{$field} . '">' . ($key != $obj->code ? $key : $obj->label) . '</option>'; |
|
10721
|
+ $out .= '<option '.($selected == $obj->{$field} ? 'selected="selected"' : '').' value="'.$obj->{$field}.'">'.($key != $obj->code ? $key : $obj->label).'</option>'; |
10722
|
10722
|
} |
10723
|
10723
|
$out .= '</select>'; |
10724
|
10724
|
|
|
@@ -10752,7 +10752,7 @@ discard block |
|
|
block discarded – undo |
10752
|
10752
|
{ |
10753
|
10753
|
global $user, $conf, $langs; |
10754
|
10754
|
|
10755
|
|
- require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; |
|
10755
|
+ require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; |
10756
|
10756
|
|
10757
|
10757
|
if (is_null($usertofilter)) { |
10758
|
10758
|
$usertofilter = $user; |
|
@@ -10776,10 +10776,10 @@ discard block |
|
|
block discarded – undo |
10776
|
10776
|
$sql = "SELECT f.rowid, f.ref as fref, 'nolabel' as flabel, p.rowid as pid, f.ref, |
10777
|
10777
|
p.title, p.fk_soc, p.fk_statut, p.public,"; |
10778
|
10778
|
$sql .= ' s.nom as name'; |
10779
|
|
- $sql .= ' FROM ' . $this->db->prefix() . 'projet as p'; |
10780
|
|
- $sql .= ' LEFT JOIN ' . $this->db->prefix() . 'societe as s ON s.rowid = p.fk_soc,'; |
10781
|
|
- $sql .= ' ' . $this->db->prefix() . 'facture as f'; |
10782
|
|
- $sql .= " WHERE p.entity IN (" . getEntity('project') . ")"; |
|
10779
|
+ $sql .= ' FROM '.$this->db->prefix().'projet as p'; |
|
10780
|
+ $sql .= ' LEFT JOIN '.$this->db->prefix().'societe as s ON s.rowid = p.fk_soc,'; |
|
10781
|
+ $sql .= ' '.$this->db->prefix().'facture as f'; |
|
10782
|
+ $sql .= " WHERE p.entity IN (".getEntity('project').")"; |
10783
|
10783
|
$sql .= " AND f.fk_projet = p.rowid AND f.fk_statut=0"; //Brouillons seulement |
10784
|
10784
|
//if ($projectsListId) $sql.= " AND p.rowid IN (".$this->db->sanitize($projectsListId).")"; |
10785
|
10785
|
//if ($socid == 0) $sql.= " AND (p.fk_soc=0 OR p.fk_soc IS NULL)"; |
|
@@ -10790,14 +10790,14 @@ discard block |
|
|
block discarded – undo |
10790
|
10790
|
if ($resql) { |
10791
|
10791
|
// Use select2 selector |
10792
|
10792
|
if (!empty($conf->use_javascript_ajax)) { |
10793
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
10793
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
10794
|
10794
|
$comboenhancement = ajax_combobox($htmlname, array(), 0, $forcefocus); |
10795
|
10795
|
$out .= $comboenhancement; |
10796
|
10796
|
$morecss = 'minwidth200imp maxwidth500'; |
10797
|
10797
|
} |
10798
|
10798
|
|
10799
|
10799
|
if (empty($option_only)) { |
10800
|
|
- $out .= '<select class="valignmiddle flat' . ($morecss ? ' ' . $morecss : '') . '"' . ($disabled ? ' disabled="disabled"' : '') . ' id="' . $htmlname . '" name="' . $htmlname . '">'; |
|
10800
|
+ $out .= '<select class="valignmiddle flat'.($morecss ? ' '.$morecss : '').'"'.($disabled ? ' disabled="disabled"' : '').' id="'.$htmlname.'" name="'.$htmlname.'">'; |
10801
|
10801
|
} |
10802
|
10802
|
if (!empty($show_empty)) { |
10803
|
10803
|
$out .= '<option value="0" class="optiongrey">'; |
|
@@ -10827,33 +10827,33 @@ discard block |
|
|
block discarded – undo |
10827
|
10827
|
if ($showproject == 'all') { |
10828
|
10828
|
$labeltoshow .= dol_trunc($obj->ref, 18); // Invoice ref |
10829
|
10829
|
if ($obj->name) { |
10830
|
|
- $labeltoshow .= ' - ' . $obj->name; // Soc name |
|
10830
|
+ $labeltoshow .= ' - '.$obj->name; // Soc name |
10831
|
10831
|
} |
10832
|
10832
|
|
10833
|
10833
|
$disabled = 0; |
10834
|
10834
|
if ($obj->fk_statut == Project::STATUS_DRAFT) { |
10835
|
10835
|
$disabled = 1; |
10836
|
|
- $labeltoshow .= ' - ' . $langs->trans("Draft"); |
|
10836
|
+ $labeltoshow .= ' - '.$langs->trans("Draft"); |
10837
|
10837
|
} elseif ($obj->fk_statut == Project::STATUS_CLOSED) { |
10838
|
10838
|
if ($discard_closed == 2) { |
10839
|
10839
|
$disabled = 1; |
10840
|
10840
|
} |
10841
|
|
- $labeltoshow .= ' - ' . $langs->trans("Closed"); |
|
10841
|
+ $labeltoshow .= ' - '.$langs->trans("Closed"); |
10842
|
10842
|
} elseif ($socid > 0 && (!empty($obj->fk_soc) && $obj->fk_soc != $socid)) { |
10843
|
10843
|
$disabled = 1; |
10844
|
|
- $labeltoshow .= ' - ' . $langs->trans("LinkedToAnotherCompany"); |
|
10844
|
+ $labeltoshow .= ' - '.$langs->trans("LinkedToAnotherCompany"); |
10845
|
10845
|
} |
10846
|
10846
|
} |
10847
|
10847
|
|
10848
|
10848
|
if (!empty($selected) && $selected == $obj->rowid) { |
10849
|
|
- $out .= '<option value="' . $obj->rowid . '" selected'; |
|
10849
|
+ $out .= '<option value="'.$obj->rowid.'" selected'; |
10850
|
10850
|
//if ($disabled) $out.=' disabled'; // with select2, field can't be preselected if disabled |
10851
|
|
- $out .= '>' . $labeltoshow . '</option>'; |
|
10851
|
+ $out .= '>'.$labeltoshow.'</option>'; |
10852
|
10852
|
} else { |
10853
|
10853
|
if ($hideunselectables && $disabled && ($selected != $obj->rowid)) { |
10854
|
10854
|
$resultat = ''; |
10855
|
10855
|
} else { |
10856
|
|
- $resultat = '<option value="' . $obj->rowid . '"'; |
|
10856
|
+ $resultat = '<option value="'.$obj->rowid.'"'; |
10857
|
10857
|
if ($disabled) { |
10858
|
10858
|
$resultat .= ' disabled'; |
10859
|
10859
|
} |
|
@@ -10905,22 +10905,22 @@ discard block |
|
|
block discarded – undo |
10905
|
10905
|
|
10906
|
10906
|
$sql = 'SELECT f.rowid, f.entity, f.titre as title, f.suspended, f.fk_soc'; |
10907
|
10907
|
//$sql.= ', el.fk_source'; |
10908
|
|
- $sql .= ' FROM ' . MAIN_DB_PREFIX . 'facture_rec as f'; |
10909
|
|
- $sql .= " WHERE f.entity IN (" . getEntity('invoice') . ")"; |
|
10908
|
+ $sql .= ' FROM '.MAIN_DB_PREFIX.'facture_rec as f'; |
|
10909
|
+ $sql .= " WHERE f.entity IN (".getEntity('invoice').")"; |
10910
|
10910
|
$sql .= " ORDER BY f.titre ASC"; |
10911
|
10911
|
|
10912
|
10912
|
$resql = $this->db->query($sql); |
10913
|
10913
|
if ($resql) { |
10914
|
10914
|
// Use select2 selector |
10915
|
10915
|
if (!empty($conf->use_javascript_ajax)) { |
10916
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
10916
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
10917
|
10917
|
$comboenhancement = ajax_combobox($htmlname, array(), 0, $forcefocus); |
10918
|
10918
|
$out .= $comboenhancement; |
10919
|
10919
|
$morecss = 'minwidth200imp maxwidth500'; |
10920
|
10920
|
} |
10921
|
10921
|
|
10922
|
10922
|
if (empty($option_only)) { |
10923
|
|
- $out .= '<select class="valignmiddle flat' . ($morecss ? ' ' . $morecss : '') . '"' . ($disabled ? ' disabled="disabled"' : '') . ' id="' . $htmlname . '" name="' . $htmlname . '">'; |
|
10923
|
+ $out .= '<select class="valignmiddle flat'.($morecss ? ' '.$morecss : '').'"'.($disabled ? ' disabled="disabled"' : '').' id="'.$htmlname.'" name="'.$htmlname.'">'; |
10924
|
10924
|
} |
10925
|
10925
|
if (!empty($show_empty)) { |
10926
|
10926
|
$out .= '<option value="0" class="optiongrey">'; |
|
@@ -10939,19 +10939,19 @@ discard block |
|
|
block discarded – undo |
10939
|
10939
|
$disabled = 0; |
10940
|
10940
|
if (!empty($obj->suspended)) { |
10941
|
10941
|
$disabled = 1; |
10942
|
|
- $labeltoshow .= ' - ' . $langs->trans("Closed"); |
|
10942
|
+ $labeltoshow .= ' - '.$langs->trans("Closed"); |
10943
|
10943
|
} |
10944
|
10944
|
|
10945
|
10945
|
|
10946
|
10946
|
if (!empty($selected) && $selected == $obj->rowid) { |
10947
|
|
- $out .= '<option value="' . $obj->rowid . '" selected'; |
|
10947
|
+ $out .= '<option value="'.$obj->rowid.'" selected'; |
10948
|
10948
|
//if ($disabled) $out.=' disabled'; // with select2, field can't be preselected if disabled |
10949
|
|
- $out .= '>' . $labeltoshow . '</option>'; |
|
10949
|
+ $out .= '>'.$labeltoshow.'</option>'; |
10950
|
10950
|
} else { |
10951
|
10951
|
if ($disabled && ($selected != $obj->rowid)) { |
10952
|
10952
|
$resultat = ''; |
10953
|
10953
|
} else { |
10954
|
|
- $resultat = '<option value="' . $obj->rowid . '"'; |
|
10954
|
+ $resultat = '<option value="'.$obj->rowid.'"'; |
10955
|
10955
|
if ($disabled) { |
10956
|
10956
|
$resultat .= ' disabled'; |
10957
|
10957
|
} |
|
@@ -10991,14 +10991,14 @@ discard block |
|
|
block discarded – undo |
10991
|
10991
|
global $langs; |
10992
|
10992
|
|
10993
|
10993
|
if ($search_component_params_hidden != '' && !preg_match('/^\(.*\)$/', $search_component_params_hidden)) { // If $search_component_params_hidden does not start and end with () |
10994
|
|
- $search_component_params_hidden = '(' . $search_component_params_hidden . ')'; |
|
10994
|
+ $search_component_params_hidden = '('.$search_component_params_hidden.')'; |
10995
|
10995
|
} |
10996
|
10996
|
|
10997
|
10997
|
$ret = ''; |
10998
|
10998
|
|
10999
|
10999
|
$ret .= '<div class="divadvancedsearchfieldcomp centpercent inline-block">'; |
11000
|
11000
|
$ret .= '<a href="#" class="dropdownsearch-toggle unsetcolor">'; |
11001
|
|
- $ret .= '<span class="fas fa-filter linkobject boxfilter paddingright pictofixedwidth" title="' . dol_escape_htmltag($langs->trans("Filters")) . '" id="idsubimgproductdistribution"></span>'; |
|
11001
|
+ $ret .= '<span class="fas fa-filter linkobject boxfilter paddingright pictofixedwidth" title="'.dol_escape_htmltag($langs->trans("Filters")).'" id="idsubimgproductdistribution"></span>'; |
11002
|
11002
|
$ret .= '</a>'; |
11003
|
11003
|
|
11004
|
11004
|
$ret .= '<div class="divadvancedsearchfieldcompinput inline-block minwidth500 maxwidth300onsmartphone">'; |
|
@@ -11042,29 +11042,29 @@ discard block |
|
|
block discarded – undo |
11042
|
11042
|
$ret .= '<input type="hidden" name="show_search_component_params_hidden" value="1">'; |
11043
|
11043
|
} |
11044
|
11044
|
$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%')) -->"; |
11045
|
|
- $ret .= '<input type="hidden" id="search_component_params_hidden" name="search_component_params_hidden" value="' . dol_escape_htmltag($search_component_params_hidden) . '">'; |
|
11045
|
+ $ret .= '<input type="hidden" id="search_component_params_hidden" name="search_component_params_hidden" value="'.dol_escape_htmltag($search_component_params_hidden).'">'; |
11046
|
11046
|
// $ret .= "<!-- sql= ".forgeSQLFromUniversalSearchCriteria($search_component_params_hidden, $errormessage)." -->"; |
11047
|
11047
|
|
11048
|
11048
|
// For compatibility with forms that show themself the search criteria in addition of this component, we output these fields |
11049
|
11049
|
foreach ($arrayofcriterias as $criteria) { |
11050
|
11050
|
foreach ($criteria as $criteriafamilykey => $criteriafamilyval) { |
11051
|
|
- if (in_array('search_' . $criteriafamilykey, $arrayofinputfieldsalreadyoutput)) { |
|
11051
|
+ if (in_array('search_'.$criteriafamilykey, $arrayofinputfieldsalreadyoutput)) { |
11052
|
11052
|
continue; |
11053
|
11053
|
} |
11054
|
11054
|
if (in_array($criteriafamilykey, array('rowid', 'ref_ext', 'entity', 'extraparams'))) { |
11055
|
11055
|
continue; |
11056
|
11056
|
} |
11057
|
11057
|
if (in_array($criteriafamilyval['type'], array('date', 'datetime', 'timestamp'))) { |
11058
|
|
- $ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_start">'; |
11059
|
|
- $ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_startyear">'; |
11060
|
|
- $ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_startmonth">'; |
11061
|
|
- $ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_startday">'; |
11062
|
|
- $ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_end">'; |
11063
|
|
- $ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_endyear">'; |
11064
|
|
- $ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_endmonth">'; |
11065
|
|
- $ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_endday">'; |
|
11058
|
+ $ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_start">'; |
|
11059
|
+ $ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_startyear">'; |
|
11060
|
+ $ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_startmonth">'; |
|
11061
|
+ $ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_startday">'; |
|
11062
|
+ $ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_end">'; |
|
11063
|
+ $ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_endyear">'; |
|
11064
|
+ $ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_endmonth">'; |
|
11065
|
+ $ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_endday">'; |
11066
|
11066
|
} else { |
11067
|
|
- $ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '">'; |
|
11067
|
+ $ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'">'; |
11068
|
11068
|
} |
11069
|
11069
|
} |
11070
|
11070
|
} |
|
@@ -11072,7 +11072,7 @@ discard block |
|
|
block discarded – undo |
11072
|
11072
|
$ret .= '</div>'; |
11073
|
11073
|
|
11074
|
11074
|
$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"; |
11075
|
|
- $ret .= '<input type="text" placeholder="' . $langs->trans("Filters") . '" id="search_component_params_input" name="search_component_params_input" class="noborderbottom search_component_input" value="">'; |
|
11075
|
+ $ret .= '<input type="text" placeholder="'.$langs->trans("Filters").'" id="search_component_params_input" name="search_component_params_input" class="noborderbottom search_component_input" value="">'; |
11076
|
11076
|
|
11077
|
11077
|
$ret .= '</div>'; |
11078
|
11078
|
$ret .= '</div>'; |
|
@@ -11146,7 +11146,7 @@ discard block |
|
|
block discarded – undo |
11146
|
11146
|
|
11147
|
11147
|
$TModels = array(); |
11148
|
11148
|
|
11149
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php'; |
|
11149
|
+ include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; |
11150
|
11150
|
$formmail = new FormMail($this->db); |
11151
|
11151
|
$result = $formmail->fetchAllEMailTemplate($modelType, $user, $langs); |
11152
|
11152
|
|
|
@@ -11159,17 +11159,17 @@ discard block |
|
|
block discarded – undo |
11159
|
11159
|
} |
11160
|
11160
|
} |
11161
|
11161
|
|
11162
|
|
- $retstring .= '<select class="flat" id="select_' . $prefix . 'model_mail" name="' . $prefix . 'model_mail">'; |
|
11162
|
+ $retstring .= '<select class="flat" id="select_'.$prefix.'model_mail" name="'.$prefix.'model_mail">'; |
11163
|
11163
|
|
11164
|
11164
|
foreach ($TModels as $id_model => $label_model) { |
11165
|
|
- $retstring .= '<option value="' . $id_model . '"'; |
11166
|
|
- $retstring .= ">" . $label_model . "</option>"; |
|
11165
|
+ $retstring .= '<option value="'.$id_model.'"'; |
|
11166
|
+ $retstring .= ">".$label_model."</option>"; |
11167
|
11167
|
} |
11168
|
11168
|
|
11169
|
11169
|
$retstring .= "</select>"; |
11170
|
11170
|
|
11171
|
11171
|
if ($addjscombo) { |
11172
|
|
- $retstring .= ajax_combobox('select_' . $prefix . 'model_mail'); |
|
11172
|
+ $retstring .= ajax_combobox('select_'.$prefix.'model_mail'); |
11173
|
11173
|
} |
11174
|
11174
|
|
11175
|
11175
|
return $retstring; |
|
@@ -11220,16 +11220,16 @@ discard block |
|
|
block discarded – undo |
11220
|
11220
|
|
11221
|
11221
|
foreach ($buttons as $button) { |
11222
|
11222
|
$addclass = empty($button['addclass']) ? '' : $button['addclass']; |
11223
|
|
- $retstring .= '<input type="submit" class="button button-' . $button['name'] . ($morecss ? ' ' . $morecss : '') . ' ' . $addclass . '" name="' . $button['name'] . '" value="' . dol_escape_htmltag($langs->trans($button['label_key'])) . '">'; |
|
11223
|
+ $retstring .= '<input type="submit" class="button button-'.$button['name'].($morecss ? ' '.$morecss : '').' '.$addclass.'" name="'.$button['name'].'" value="'.dol_escape_htmltag($langs->trans($button['label_key'])).'">'; |
11224
|
11224
|
} |
11225
|
11225
|
$retstring .= $withoutdiv ? '' : '</div>'; |
11226
|
11226
|
|
11227
|
11227
|
if ($dol_openinpopup) { |
11228
|
|
- $retstring .= '<!-- buttons are shown into a $dol_openinpopup=' . dol_escape_htmltag($dol_openinpopup) . ' context, so we enable the close of dialog on cancel -->' . "\n"; |
11229
|
|
- $retstring .= '<script nonce="' . getNonce() . '">'; |
|
11228
|
+ $retstring .= '<!-- buttons are shown into a $dol_openinpopup='.dol_escape_htmltag($dol_openinpopup).' context, so we enable the close of dialog on cancel -->'."\n"; |
|
11229
|
+ $retstring .= '<script nonce="'.getNonce().'">'; |
11230
|
11230
|
$retstring .= 'jQuery(".button-cancel").click(function(e) { |
11231
|
|
- e.preventDefault(); console.log(\'We click on cancel in iframe popup ' . dol_escape_js($dol_openinpopup) . '\'); |
11232
|
|
- window.parent.jQuery(\'#idfordialog' . dol_escape_js($dol_openinpopup) . '\').dialog(\'close\'); |
|
11231
|
+ e.preventDefault(); console.log(\'We click on cancel in iframe popup ' . dol_escape_js($dol_openinpopup).'\'); |
|
11232
|
+ window.parent.jQuery(\'#idfordialog' . dol_escape_js($dol_openinpopup).'\').dialog(\'close\'); |
11233
|
11233
|
});'; |
11234
|
11234
|
$retstring .= '</script>'; |
11235
|
11235
|
} |
|
@@ -11258,7 +11258,7 @@ discard block |
|
|
block discarded – undo |
11258
|
11258
|
dol_syslog(__METHOD__, LOG_DEBUG); |
11259
|
11259
|
|
11260
|
11260
|
$sql = "SELECT rowid, code, label as label"; |
11261
|
|
- $sql .= " FROM " . MAIN_DB_PREFIX . 'c_invoice_subtype'; |
|
11261
|
+ $sql .= " FROM ".MAIN_DB_PREFIX.'c_invoice_subtype'; |
11262
|
11262
|
$sql .= " WHERE active = 1"; |
11263
|
11263
|
|
11264
|
11264
|
$resql = $this->db->query($sql); |
|
@@ -11269,7 +11269,7 @@ discard block |
|
|
block discarded – undo |
11269
|
11269
|
$obj = $this->db->fetch_object($resql); |
11270
|
11270
|
|
11271
|
11271
|
// If translation exists, we use it, otherwise we take the default wording |
11272
|
|
- $label = ($langs->trans("InvoiceSubtype" . $obj->rowid) != "InvoiceSubtype" . $obj->rowid) ? $langs->trans("InvoiceSubtype" . $obj->rowid) : (($obj->label != '-') ? $obj->label : ''); |
|
11272
|
+ $label = ($langs->trans("InvoiceSubtype".$obj->rowid) != "InvoiceSubtype".$obj->rowid) ? $langs->trans("InvoiceSubtype".$obj->rowid) : (($obj->label != '-') ? $obj->label : ''); |
11273
|
11273
|
$this->cache_invoice_subtype[$obj->rowid]['rowid'] = $obj->rowid; |
11274
|
11274
|
$this->cache_invoice_subtype[$obj->rowid]['code'] = $obj->code; |
11275
|
11275
|
$this->cache_invoice_subtype[$obj->rowid]['label'] = $label; |
|
@@ -11301,18 +11301,18 @@ discard block |
|
|
block discarded – undo |
11301
|
11301
|
global $langs, $user; |
11302
|
11302
|
|
11303
|
11303
|
$out = ''; |
11304
|
|
- dol_syslog(__METHOD__ . " selected=" . $selected . ", htmlname=" . $htmlname, LOG_DEBUG); |
|
11304
|
+ dol_syslog(__METHOD__." selected=".$selected.", htmlname=".$htmlname, LOG_DEBUG); |
11305
|
11305
|
|
11306
|
11306
|
$this->load_cache_invoice_subtype(); |
11307
|
11307
|
|
11308
|
|
- $out .= '<select id="' . $htmlname . '" class="flat selectsubtype' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">'; |
|
11308
|
+ $out .= '<select id="'.$htmlname.'" class="flat selectsubtype'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">'; |
11309
|
11309
|
if ($addempty) { |
11310
|
11310
|
$out .= '<option value="0"> </option>'; |
11311
|
11311
|
} |
11312
|
11312
|
|
11313
|
11313
|
foreach ($this->cache_invoice_subtype as $rowid => $subtype) { |
11314
|
11314
|
$label = $subtype['label']; |
11315
|
|
- $out .= '<option value="' . $subtype['rowid'] . '"'; |
|
11315
|
+ $out .= '<option value="'.$subtype['rowid'].'"'; |
11316
|
11316
|
if ($selected == $subtype['rowid']) { |
11317
|
11317
|
$out .= ' selected="selected"'; |
11318
|
11318
|
} |