|
@@ -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 .= "\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 button' . (empty($notabletag) ? '' : ' ') . '" name="modify" value="' . $langs->trans("Modify") . '">'; |
|
335
|
+ $ret .= '<input type="submit" class="smallpaddingimp 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 button button-cancel' . (empty($notabletag) ? '' : ' ') . '" name="cancel" value="' . $langs->trans("Cancel") . '">'; |
|
339
|
+ $ret .= '<input type="submit" class="smallpaddingimp 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']) { |
|
@@ -1127,13 +1127,13 @@ discard block |
|
|
block discarded – undo |
1127
|
1127
|
$out .= '</select>'; |
1128
|
1128
|
|
1129
|
1129
|
if ($conf->use_javascript_ajax && empty($disableautocomplete)) { |
1130
|
|
- $out .= ajax_multiautocompleter('location_incoterms', array(), DOL_URL_ROOT . '/core/ajax/locationincoterms.php') . "\n"; |
|
1130
|
+ $out .= ajax_multiautocompleter('location_incoterms', array(), DOL_URL_ROOT.'/core/ajax/locationincoterms.php')."\n"; |
1131
|
1131
|
$moreattrib .= ' autocomplete="off"'; |
1132
|
1132
|
} |
1133
|
|
- $out .= '<input id="location_incoterms" class="maxwidthonsmartphone type="text" name="location_incoterms" value="' . $location_incoterms . '">' . "\n"; |
|
1133
|
+ $out .= '<input id="location_incoterms" class="maxwidthonsmartphone type="text" name="location_incoterms" value="'.$location_incoterms.'">'."\n"; |
1134
|
1134
|
|
1135
|
1135
|
if (!empty($page)) { |
1136
|
|
- $out .= '<input type="submit" class="button valignmiddle smallpaddingimp nomargintop nomarginbottom" value="' . $langs->trans("Modify") . '"></form>'; |
|
1136
|
+ $out .= '<input type="submit" class="button valignmiddle smallpaddingimp nomargintop nomarginbottom" value="'.$langs->trans("Modify").'"></form>'; |
1137
|
1137
|
} |
1138
|
1138
|
} else { |
1139
|
1139
|
dol_print_error($this->db); |
|
@@ -1165,9 +1165,9 @@ discard block |
|
|
block discarded – undo |
1165
|
1165
|
if ($forceall == 1 || (empty($forceall) && isModEnabled("product") && isModEnabled("service")) |
1166
|
1166
|
|| (empty($forceall) && !isModEnabled('product') && !isModEnabled('service'))) { |
1167
|
1167
|
if (empty($hidetext)) { |
1168
|
|
- print $langs->trans("Type") . ': '; |
|
1168
|
+ print $langs->trans("Type").': '; |
1169
|
1169
|
} |
1170
|
|
- print '<select class="flat'.($morecss ? ' '.$morecss : '').'" id="select_' . $htmlname . '" name="' . $htmlname . '">'; |
|
1170
|
+ print '<select class="flat'.($morecss ? ' '.$morecss : '').'" id="select_'.$htmlname.'" name="'.$htmlname.'">'; |
1171
|
1171
|
if ($showempty) { |
1172
|
1172
|
print '<option value="-1"'; |
1173
|
1173
|
if ($selected == -1) { |
|
@@ -1186,28 +1186,28 @@ discard block |
|
|
block discarded – undo |
1186
|
1186
|
if (0 == $selected || ($selected == -1 && getDolGlobalString('MAIN_FREE_PRODUCT_CHECKED_BY_DEFAULT') == 'product')) { |
1187
|
1187
|
print ' selected'; |
1188
|
1188
|
} |
1189
|
|
- print '>' . $langs->trans("Product"); |
|
1189
|
+ print '>'.$langs->trans("Product"); |
1190
|
1190
|
|
1191
|
1191
|
print '<option value="1"'; |
1192
|
1192
|
if (1 == $selected || ($selected == -1 && getDolGlobalString('MAIN_FREE_PRODUCT_CHECKED_BY_DEFAULT') == 'service')) { |
1193
|
1193
|
print ' selected'; |
1194
|
1194
|
} |
1195
|
|
- print '>' . $langs->trans("Service"); |
|
1195
|
+ print '>'.$langs->trans("Service"); |
1196
|
1196
|
|
1197
|
1197
|
print '</select>'; |
1198
|
|
- print ajax_combobox('select_' . $htmlname); |
|
1198
|
+ print ajax_combobox('select_'.$htmlname); |
1199
|
1199
|
//if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); |
1200
|
1200
|
} |
1201
|
1201
|
if ((empty($forceall) && !isModEnabled('product') && isModEnabled("service")) || $forceall == 3) { |
1202
|
1202
|
print $langs->trans("Service"); |
1203
|
|
- print '<input type="hidden" name="' . $htmlname . '" value="1">'; |
|
1203
|
+ print '<input type="hidden" name="'.$htmlname.'" value="1">'; |
1204
|
1204
|
} |
1205
|
1205
|
if ((empty($forceall) && isModEnabled("product") && !isModEnabled('service')) || $forceall == 2) { |
1206
|
1206
|
print $langs->trans("Product"); |
1207
|
|
- print '<input type="hidden" name="' . $htmlname . '" value="0">'; |
|
1207
|
+ print '<input type="hidden" name="'.$htmlname.'" value="0">'; |
1208
|
1208
|
} |
1209
|
1209
|
if ($forceall < 0) { // This should happened only for contracts when both predefined product and service are disabled. |
1210
|
|
- 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 |
|
1210
|
+ 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
|
1211
|
} |
1212
|
1212
|
} |
1213
|
1213
|
|
|
@@ -1233,7 +1233,7 @@ discard block |
|
|
block discarded – undo |
1233
|
1233
|
$langs->load("trips"); |
1234
|
1234
|
|
1235
|
1235
|
$sql = "SELECT c.code, c.label"; |
1236
|
|
- $sql .= " FROM " . $this->db->prefix() . "c_type_fees as c"; |
|
1236
|
+ $sql .= " FROM ".$this->db->prefix()."c_type_fees as c"; |
1237
|
1237
|
$sql .= " WHERE active > 0"; |
1238
|
1238
|
|
1239
|
1239
|
$resql = $this->db->query($sql); |
|
@@ -1274,11 +1274,11 @@ discard block |
|
|
block discarded – undo |
1274
|
1274
|
// phpcs:enable |
1275
|
1275
|
global $user, $langs; |
1276
|
1276
|
|
1277
|
|
- dol_syslog(__METHOD__ . " selected=" . $selected . ", htmlname=" . $htmlname, LOG_DEBUG); |
|
1277
|
+ dol_syslog(__METHOD__." selected=".$selected.", htmlname=".$htmlname, LOG_DEBUG); |
1278
|
1278
|
|
1279
|
1279
|
$this->load_cache_types_fees(); |
1280
|
1280
|
|
1281
|
|
- print '<select id="select_' . $htmlname . '" class="flat" name="' . $htmlname . '">'; |
|
1281
|
+ print '<select id="select_'.$htmlname.'" class="flat" name="'.$htmlname.'">'; |
1282
|
1282
|
if ($showempty) { |
1283
|
1283
|
print '<option value="-1"'; |
1284
|
1284
|
if ($selected == -1) { |
|
@@ -1288,7 +1288,7 @@ discard block |
|
|
block discarded – undo |
1288
|
1288
|
} |
1289
|
1289
|
|
1290
|
1290
|
foreach ($this->cache_types_fees as $key => $value) { |
1291
|
|
- print '<option value="' . $key . '"'; |
|
1291
|
+ print '<option value="'.$key.'"'; |
1292
|
1292
|
if ($key == $selected) { |
1293
|
1293
|
print ' selected'; |
1294
|
1294
|
} |
|
@@ -1340,12 +1340,12 @@ discard block |
|
|
block discarded – undo |
1340
|
1340
|
$ajaxoptions = array(); |
1341
|
1341
|
} |
1342
|
1342
|
|
1343
|
|
- require_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
1343
|
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
1344
|
1344
|
|
1345
|
1345
|
// No immediate load of all database |
1346
|
1346
|
$placeholder = ''; |
1347
|
1347
|
if ($selected && empty($selected_input_value)) { |
1348
|
|
- require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; |
|
1348
|
+ require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; |
1349
|
1349
|
$societetmp = new Societe($this->db); |
1350
|
1350
|
$societetmp->fetch($selected); |
1351
|
1351
|
$selected_input_value = $societetmp->name; |
|
@@ -1353,18 +1353,18 @@ discard block |
|
|
block discarded – undo |
1353
|
1353
|
} |
1354
|
1354
|
|
1355
|
1355
|
// mode 1 |
1356
|
|
- $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)) : ''); |
|
1356
|
+ $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
|
1357
|
|
1358
|
1358
|
$out .= '<!-- force css to be higher than dialog popup --><style type="text/css">.ui-autocomplete { z-index: 1010; }</style>'; |
1359
|
1359
|
if (empty($hidelabel)) { |
1360
|
|
- print $langs->trans("RefOrLabel") . ' : '; |
|
1360
|
+ print $langs->trans("RefOrLabel").' : '; |
1361
|
1361
|
} elseif ($hidelabel > 1) { |
1362
|
1362
|
$placeholder = $langs->trans("RefOrLabel"); |
1363
|
1363
|
if ($hidelabel == 2) { |
1364
|
1364
|
$out .= img_picto($langs->trans("Search"), 'search'); |
1365
|
1365
|
} |
1366
|
1366
|
} |
1367
|
|
- $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' : '') . ' />'; |
|
1367
|
+ $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' : '').' />'; |
1368
|
1368
|
if ($hidelabel == 3) { |
1369
|
1369
|
$out .= img_picto($langs->trans("Search"), 'search'); |
1370
|
1370
|
} |
|
@@ -1426,12 +1426,12 @@ discard block |
|
|
block discarded – undo |
1426
|
1426
|
$events = array(); |
1427
|
1427
|
} |
1428
|
1428
|
|
1429
|
|
- require_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
1429
|
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
1430
|
1430
|
|
1431
|
1431
|
// No immediate load of all database |
1432
|
1432
|
$placeholder = ''; |
1433
|
1433
|
if ($selected && empty($selected_input_value)) { |
1434
|
|
- require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php'; |
|
1434
|
+ require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; |
1435
|
1435
|
$contacttmp = new Contact($this->db); |
1436
|
1436
|
$contacttmp->fetch($selected); |
1437
|
1437
|
$selected_input_value = $contacttmp->getFullName($langs); |
|
@@ -1442,11 +1442,11 @@ discard block |
|
|
block discarded – undo |
1442
|
1442
|
} |
1443
|
1443
|
|
1444
|
1444
|
// mode 1 |
1445
|
|
- $urloption = 'htmlname=' . urlencode((string) (str_replace('.', '_', $htmlname))) . '&outjson=1&filter=' . urlencode((string) ($filter)) . (empty($exclude) ? '' : '&exclude=' . urlencode($exclude)) . ($showsoc ? '&showsoc=' . urlencode((string) ($showsoc)) : ''); |
|
1445
|
+ $urloption = 'htmlname='.urlencode((string) (str_replace('.', '_', $htmlname))).'&outjson=1&filter='.urlencode((string) ($filter)).(empty($exclude) ? '' : '&exclude='.urlencode($exclude)).($showsoc ? '&showsoc='.urlencode((string) ($showsoc)) : ''); |
1446
|
1446
|
|
1447
|
1447
|
$out .= '<!-- force css to be higher than dialog popup --><style type="text/css">.ui-autocomplete { z-index: 1010; }</style>'; |
1448
|
1448
|
|
1449
|
|
- $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' : '') . ' />'; |
|
1449
|
+ $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' : '').' />'; |
1450
|
1450
|
|
1451
|
1451
|
$out .= ajax_event($htmlname, $events); |
1452
|
1452
|
|
|
@@ -1543,30 +1543,30 @@ discard block |
|
|
block discarded – undo |
1543
|
1543
|
$sql .= ", s.address, s.zip, s.town"; |
1544
|
1544
|
$sql .= ", dictp.code as country_code"; |
1545
|
1545
|
} |
1546
|
|
- $sql .= " FROM " . $this->db->prefix() . "societe as s"; |
|
1546
|
+ $sql .= " FROM ".$this->db->prefix()."societe as s"; |
1547
|
1547
|
if (getDolGlobalString('COMPANY_SHOW_ADDRESS_SELECTLIST')) { |
1548
|
|
- $sql .= " LEFT JOIN " . $this->db->prefix() . "c_country as dictp ON dictp.rowid = s.fk_pays"; |
|
1548
|
+ $sql .= " LEFT JOIN ".$this->db->prefix()."c_country as dictp ON dictp.rowid = s.fk_pays"; |
1549
|
1549
|
} |
1550
|
1550
|
if (!$user->hasRight('societe', 'client', 'voir')) { |
1551
|
|
- $sql .= ", " . $this->db->prefix() . "societe_commerciaux as sc"; |
|
1551
|
+ $sql .= ", ".$this->db->prefix()."societe_commerciaux as sc"; |
1552
|
1552
|
} |
1553
|
|
- $sql .= " WHERE s.entity IN (" . getEntity('societe') . ")"; |
|
1553
|
+ $sql .= " WHERE s.entity IN (".getEntity('societe').")"; |
1554
|
1554
|
if (!empty($user->socid)) { |
1555
|
|
- $sql .= " AND s.rowid = " . ((int) $user->socid); |
|
1555
|
+ $sql .= " AND s.rowid = ".((int) $user->socid); |
1556
|
1556
|
} |
1557
|
1557
|
if ($filter) { |
1558
|
1558
|
// $filter is safe because, if it contains '(' or ')', it has been sanitized by testSqlAndScriptInject() and forgeSQLFromUniversalSearchCriteria() |
1559
|
1559
|
// if not, by testSqlAndScriptInject() only. |
1560
|
|
- $sql .= " AND (" . $filter . ")"; |
|
1560
|
+ $sql .= " AND (".$filter.")"; |
1561
|
1561
|
} |
1562
|
1562
|
if (!$user->hasRight('societe', 'client', 'voir')) { |
1563
|
|
- $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " . ((int) $user->id); |
|
1563
|
+ $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id); |
1564
|
1564
|
} |
1565
|
1565
|
if (getDolGlobalString('COMPANY_HIDE_INACTIVE_IN_COMBOBOX')) { |
1566
|
1566
|
$sql .= " AND s.status <> 0"; |
1567
|
1567
|
} |
1568
|
1568
|
if (!empty($excludeids)) { |
1569
|
|
- $sql .= " AND s.rowid NOT IN (" . $this->db->sanitize(implode(',', $excludeids)) . ")"; |
|
1569
|
+ $sql .= " AND s.rowid NOT IN (".$this->db->sanitize(implode(',', $excludeids)).")"; |
1570
|
1570
|
} |
1571
|
1571
|
// Add where from hooks |
1572
|
1572
|
$parameters = array(); |
|
@@ -1586,17 +1586,17 @@ discard block |
|
|
block discarded – undo |
1586
|
1586
|
if ($i > 0) { |
1587
|
1587
|
$sql .= " AND "; |
1588
|
1588
|
} |
1589
|
|
- $sql .= "(s.nom LIKE '" . $this->db->escape($prefix . $crit) . "%')"; |
|
1589
|
+ $sql .= "(s.nom LIKE '".$this->db->escape($prefix.$crit)."%')"; |
1590
|
1590
|
$i++; |
1591
|
1591
|
} |
1592
|
1592
|
if (count($search_crit) > 1) { |
1593
|
1593
|
$sql .= ")"; |
1594
|
1594
|
} |
1595
|
1595
|
if (isModEnabled('barcode')) { |
1596
|
|
- $sql .= " OR s.barcode LIKE '" . $this->db->escape($prefix . $filterkey) . "%'"; |
|
1596
|
+ $sql .= " OR s.barcode LIKE '".$this->db->escape($prefix.$filterkey)."%'"; |
1597
|
1597
|
} |
1598
|
|
- $sql .= " OR s.code_client LIKE '" . $this->db->escape($prefix . $filterkey) . "%' OR s.code_fournisseur LIKE '" . $this->db->escape($prefix . $filterkey) . "%'"; |
1599
|
|
- $sql .= " OR s.name_alias LIKE '" . $this->db->escape($prefix . $filterkey) . "%' OR s.tva_intra LIKE '" . $this->db->escape($prefix . $filterkey) . "%'"; |
|
1598
|
+ $sql .= " OR s.code_client LIKE '".$this->db->escape($prefix.$filterkey)."%' OR s.code_fournisseur LIKE '".$this->db->escape($prefix.$filterkey)."%'"; |
|
1599
|
+ $sql .= " OR s.name_alias LIKE '".$this->db->escape($prefix.$filterkey)."%' OR s.tva_intra LIKE '".$this->db->escape($prefix.$filterkey)."%'"; |
1600
|
1600
|
$sql .= ")"; |
1601
|
1601
|
} |
1602
|
1602
|
$sql .= $this->db->order("nom", "ASC"); |
|
@@ -1607,7 +1607,7 @@ discard block |
|
|
block discarded – undo |
1607
|
1607
|
$resql = $this->db->query($sql); |
1608
|
1608
|
if ($resql) { |
1609
|
1609
|
// Construct $out and $outarray |
1610
|
|
- $out .= '<select id="' . $htmlname . '" class="flat' . ($morecss ? ' ' . $morecss : '') . '"' . ($moreparam ? ' ' . $moreparam : '') . ' name="' . $htmlname . ($multiple ? '[]' : '') . '" ' . ($multiple ? 'multiple' : '') . '>' . "\n"; |
|
1610
|
+ $out .= '<select id="'.$htmlname.'" class="flat'.($morecss ? ' '.$morecss : '').'"'.($moreparam ? ' '.$moreparam : '').' name="'.$htmlname.($multiple ? '[]' : '').'" '.($multiple ? 'multiple' : '').'>'."\n"; |
1611
|
1611
|
|
1612
|
1612
|
$textifempty = (($showempty && !is_numeric($showempty)) ? $langs->trans($showempty) : ''); |
1613
|
1613
|
if (getDolGlobalString('COMPANY_USE_SEARCH_TO_SELECT')) { |
|
@@ -1620,7 +1620,7 @@ discard block |
|
|
block discarded – undo |
1620
|
1620
|
} |
1621
|
1621
|
} |
1622
|
1622
|
if ($showempty) { |
1623
|
|
- $out .= '<option value="-1" data-html="' . dol_escape_htmltag('<span class="opacitymedium">' . ($textifempty ? $textifempty : ' ') . '</span>') . '">' . $textifempty . '</option>' . "\n"; |
|
1623
|
+ $out .= '<option value="-1" data-html="'.dol_escape_htmltag('<span class="opacitymedium">'.($textifempty ? $textifempty : ' ').'</span>').'">'.$textifempty.'</option>'."\n"; |
1624
|
1624
|
} |
1625
|
1625
|
|
1626
|
1626
|
$companytemp = new Societe($this->db); |
|
@@ -1633,18 +1633,18 @@ discard block |
|
|
block discarded – undo |
1633
|
1633
|
$label = ''; |
1634
|
1634
|
if ($showcode || getDolGlobalString('SOCIETE_ADD_REF_IN_LIST')) { |
1635
|
1635
|
if (($obj->client) && (!empty($obj->code_client))) { |
1636
|
|
- $label = $obj->code_client . ' - '; |
|
1636
|
+ $label = $obj->code_client.' - '; |
1637
|
1637
|
} |
1638
|
1638
|
if (($obj->fournisseur) && (!empty($obj->code_fournisseur))) { |
1639
|
|
- $label .= $obj->code_fournisseur . ' - '; |
|
1639
|
+ $label .= $obj->code_fournisseur.' - '; |
1640
|
1640
|
} |
1641
|
|
- $label .= ' ' . $obj->name; |
|
1641
|
+ $label .= ' '.$obj->name; |
1642
|
1642
|
} else { |
1643
|
1643
|
$label = $obj->name; |
1644
|
1644
|
} |
1645
|
1645
|
|
1646
|
1646
|
if (!empty($obj->name_alias)) { |
1647
|
|
- $label .= ' (' . $obj->name_alias . ')'; |
|
1647
|
+ $label .= ' ('.$obj->name_alias.')'; |
1648
|
1648
|
} |
1649
|
1649
|
|
1650
|
1650
|
if (getDolGlobalString('SOCIETE_SHOW_VAT_IN_LIST') && !empty($obj->tva_intra)) { |
|
@@ -1659,7 +1659,7 @@ discard block |
|
|
block discarded – undo |
1659
|
1659
|
$companytemp->fournisseur = $obj->fournisseur; |
1660
|
1660
|
$tmptype = $companytemp->getTypeUrl(1, '', 0, 'span'); |
1661
|
1661
|
if ($tmptype) { |
1662
|
|
- $labelhtml .= ' ' . $tmptype; |
|
1662
|
+ $labelhtml .= ' '.$tmptype; |
1663
|
1663
|
} |
1664
|
1664
|
|
1665
|
1665
|
if ($obj->client || $obj->fournisseur) { |
|
@@ -1669,10 +1669,10 @@ discard block |
|
|
block discarded – undo |
1669
|
1669
|
$label .= $langs->trans("Customer"); |
1670
|
1670
|
} |
1671
|
1671
|
if ($obj->client == 2 || $obj->client == 3) { |
1672
|
|
- $label .= ($obj->client == 3 ? ', ' : '') . $langs->trans("Prospect"); |
|
1672
|
+ $label .= ($obj->client == 3 ? ', ' : '').$langs->trans("Prospect"); |
1673
|
1673
|
} |
1674
|
1674
|
if ($obj->fournisseur) { |
1675
|
|
- $label .= ($obj->client ? ', ' : '') . $langs->trans("Supplier"); |
|
1675
|
+ $label .= ($obj->client ? ', ' : '').$langs->trans("Supplier"); |
1676
|
1676
|
} |
1677
|
1677
|
if ($obj->client || $obj->fournisseur) { |
1678
|
1678
|
$label .= ')'; |
|
@@ -1680,9 +1680,9 @@ discard block |
|
|
block discarded – undo |
1680
|
1680
|
} |
1681
|
1681
|
|
1682
|
1682
|
if (getDolGlobalString('COMPANY_SHOW_ADDRESS_SELECTLIST')) { |
1683
|
|
- $s = ($obj->address ? ' - ' . $obj->address : '') . ($obj->zip ? ' - ' . $obj->zip : '') . ($obj->town ? ' ' . $obj->town : ''); |
|
1683
|
+ $s = ($obj->address ? ' - '.$obj->address : '').($obj->zip ? ' - '.$obj->zip : '').($obj->town ? ' '.$obj->town : ''); |
1684
|
1684
|
if (!empty($obj->country_code)) { |
1685
|
|
- $s .= ', ' . $langs->trans('Country' . $obj->country_code); |
|
1685
|
+ $s .= ', '.$langs->trans('Country'.$obj->country_code); |
1686
|
1686
|
} |
1687
|
1687
|
$label .= $s; |
1688
|
1688
|
$labelhtml .= $s; |
|
@@ -1690,9 +1690,9 @@ discard block |
|
|
block discarded – undo |
1690
|
1690
|
|
1691
|
1691
|
if (empty($outputmode)) { |
1692
|
1692
|
if (in_array($obj->rowid, $selected)) { |
1693
|
|
- $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>'; |
|
1693
|
+ $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>'; |
1694
|
1694
|
} else { |
1695
|
|
- $out .= '<option value="' . $obj->rowid . '" data-html="' . dol_escape_htmltag($labelhtml, 0, 0, '', 0, 1) . '">' . dol_escape_htmltag($label, 0, 0, '', 0, 1) . '</option>'; |
|
1695
|
+ $out .= '<option value="'.$obj->rowid.'" data-html="'.dol_escape_htmltag($labelhtml, 0, 0, '', 0, 1).'">'.dol_escape_htmltag($label, 0, 0, '', 0, 1).'</option>'; |
1696
|
1696
|
} |
1697
|
1697
|
} else { |
1698
|
1698
|
array_push($outarray, array('key' => $obj->rowid, 'value' => $label, 'label' => $label, 'labelhtml' => $labelhtml)); |
|
@@ -1704,9 +1704,9 @@ discard block |
|
|
block discarded – undo |
1704
|
1704
|
} |
1705
|
1705
|
} |
1706
|
1706
|
} |
1707
|
|
- $out .= '</select>' . "\n"; |
|
1707
|
+ $out .= '</select>'."\n"; |
1708
|
1708
|
if (!$forcecombo) { |
1709
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
1709
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
1710
|
1710
|
$out .= ajax_combobox($htmlname, $events, getDolGlobalInt("COMPANY_USE_SEARCH_TO_SELECT")); |
1711
|
1711
|
} |
1712
|
1712
|
} else { |
|
@@ -1795,7 +1795,7 @@ discard block |
|
|
block discarded – undo |
1795
|
1795
|
} |
1796
|
1796
|
|
1797
|
1797
|
if (!is_object($hookmanager)) { |
1798
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/class/hookmanager.class.php'; |
|
1798
|
+ include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; |
1799
|
1799
|
$hookmanager = new HookManager($this->db); |
1800
|
1800
|
} |
1801
|
1801
|
|
|
@@ -1804,13 +1804,13 @@ discard block |
|
|
block discarded – undo |
1804
|
1804
|
if ($showsoc > 0 || getDolGlobalString('CONTACT_SHOW_EMAIL_PHONE_TOWN_SELECTLIST')) { |
1805
|
1805
|
$sql .= ", s.nom as company, s.town AS company_town"; |
1806
|
1806
|
} |
1807
|
|
- $sql .= " FROM " . $this->db->prefix() . "socpeople as sp"; |
|
1807
|
+ $sql .= " FROM ".$this->db->prefix()."socpeople as sp"; |
1808
|
1808
|
if ($showsoc > 0 || getDolGlobalString('CONTACT_SHOW_EMAIL_PHONE_TOWN_SELECTLIST')) { |
1809
|
|
- $sql .= " LEFT OUTER JOIN " . $this->db->prefix() . "societe as s ON s.rowid=sp.fk_soc"; |
|
1809
|
+ $sql .= " LEFT OUTER JOIN ".$this->db->prefix()."societe as s ON s.rowid=sp.fk_soc"; |
1810
|
1810
|
} |
1811
|
|
- $sql .= " WHERE sp.entity IN (" . getEntity('contact') . ")"; |
|
1811
|
+ $sql .= " WHERE sp.entity IN (".getEntity('contact').")"; |
1812
|
1812
|
if ($socid > 0 || $socid == -1) { |
1813
|
|
- $sql .= " AND sp.fk_soc = " . ((int) $socid); |
|
1813
|
+ $sql .= " AND sp.fk_soc = ".((int) $socid); |
1814
|
1814
|
} |
1815
|
1815
|
if (getDolGlobalString('CONTACT_HIDE_INACTIVE_IN_COMBOBOX')) { |
1816
|
1816
|
$sql .= " AND sp.statut <> 0"; |
|
@@ -1818,7 +1818,7 @@ discard block |
|
|
block discarded – undo |
1818
|
1818
|
if ($filter) { |
1819
|
1819
|
// $filter is safe because, if it contains '(' or ')', it has been sanitized by testSqlAndScriptInject() and forgeSQLFromUniversalSearchCriteria() |
1820
|
1820
|
// if not, by testSqlAndScriptInject() only. |
1821
|
|
- $sql .= " AND (" . $filter . ")"; |
|
1821
|
+ $sql .= " AND (".$filter.")"; |
1822
|
1822
|
} |
1823
|
1823
|
// Add where from hooks |
1824
|
1824
|
$parameters = array(); |
|
@@ -1826,30 +1826,30 @@ discard block |
|
|
block discarded – undo |
1826
|
1826
|
$sql .= $hookmanager->resPrint; |
1827
|
1827
|
$sql .= " ORDER BY sp.lastname ASC"; |
1828
|
1828
|
|
1829
|
|
- dol_syslog(get_class($this) . "::selectcontacts", LOG_DEBUG); |
|
1829
|
+ dol_syslog(get_class($this)."::selectcontacts", LOG_DEBUG); |
1830
|
1830
|
$resql = $this->db->query($sql); |
1831
|
1831
|
if ($resql) { |
1832
|
1832
|
$num = $this->db->num_rows($resql); |
1833
|
1833
|
|
1834
|
1834
|
if ($htmlname != 'none' && !$options_only) { |
1835
|
|
- $out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" id="' . $htmlid . '" name="' . $htmlname . ($multiple ? '[]' : '') . '" ' . (($num || empty($disableifempty)) ? '' : ' disabled') . ($multiple ? 'multiple' : '') . ' ' . (!empty($moreparam) ? $moreparam : '') . '>'; |
|
1835
|
+ $out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" id="'.$htmlid.'" name="'.$htmlname.($multiple ? '[]' : '').'" '.(($num || empty($disableifempty)) ? '' : ' disabled').($multiple ? 'multiple' : '').' '.(!empty($moreparam) ? $moreparam : '').'>'; |
1836
|
1836
|
} |
1837
|
1837
|
|
1838
|
1838
|
if ($showempty && !is_numeric($showempty)) { |
1839
|
1839
|
$textforempty = $showempty; |
1840
|
|
- $out .= '<option class="optiongrey" value="-1"' . (in_array(-1, $selected) ? ' selected' : '') . '>' . $textforempty . '</option>'; |
|
1840
|
+ $out .= '<option class="optiongrey" value="-1"'.(in_array(-1, $selected) ? ' selected' : '').'>'.$textforempty.'</option>'; |
1841
|
1841
|
} else { |
1842
|
1842
|
if (($showempty == 1 || ($showempty == 3 && $num > 1)) && !$multiple) { |
1843
|
|
- $out .= '<option value="0"' . (in_array(0, $selected) ? ' selected' : '') . '> </option>'; |
|
1843
|
+ $out .= '<option value="0"'.(in_array(0, $selected) ? ' selected' : '').'> </option>'; |
1844
|
1844
|
} |
1845
|
1845
|
if ($showempty == 2) { |
1846
|
|
- $out .= '<option value="0"' . (in_array(0, $selected) ? ' selected' : '') . '>-- ' . $langs->trans("Internal") . ' --</option>'; |
|
1846
|
+ $out .= '<option value="0"'.(in_array(0, $selected) ? ' selected' : '').'>-- '.$langs->trans("Internal").' --</option>'; |
1847
|
1847
|
} |
1848
|
1848
|
} |
1849
|
1849
|
|
1850
|
1850
|
$i = 0; |
1851
|
1851
|
if ($num) { |
1852
|
|
- include_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php'; |
|
1852
|
+ include_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; |
1853
|
1853
|
$contactstatic = new Contact($this->db); |
1854
|
1854
|
|
1855
|
1855
|
while ($i < $num) { |
|
@@ -1885,7 +1885,7 @@ discard block |
|
|
block discarded – undo |
1885
|
1885
|
} |
1886
|
1886
|
$extendedInfos = implode(' - ', $extendedInfos); |
1887
|
1887
|
if (!empty($extendedInfos)) { |
1888
|
|
- $extendedInfos = ' - ' . $extendedInfos; |
|
1888
|
+ $extendedInfos = ' - '.$extendedInfos; |
1889
|
1889
|
} |
1890
|
1890
|
} |
1891
|
1891
|
|
|
@@ -1903,35 +1903,35 @@ discard block |
|
|
block discarded – undo |
1903
|
1903
|
$disabled = 1; |
1904
|
1904
|
} |
1905
|
1905
|
if (!empty($selected) && in_array($obj->rowid, $selected)) { |
1906
|
|
- $out .= '<option value="' . $obj->rowid . '"'; |
|
1906
|
+ $out .= '<option value="'.$obj->rowid.'"'; |
1907
|
1907
|
if ($disabled) { |
1908
|
1908
|
$out .= ' disabled'; |
1909
|
1909
|
} |
1910
|
1910
|
$out .= ' selected>'; |
1911
|
1911
|
|
1912
|
|
- $tmplabel = $contactstatic->getFullName($langs) . $extendedInfos; |
|
1912
|
+ $tmplabel = $contactstatic->getFullName($langs).$extendedInfos; |
1913
|
1913
|
if ($showfunction && $obj->poste) { |
1914
|
|
- $tmplabel .= ' (' . $obj->poste . ')'; |
|
1914
|
+ $tmplabel .= ' ('.$obj->poste.')'; |
1915
|
1915
|
} |
1916
|
1916
|
if (($showsoc > 0) && $obj->company) { |
1917
|
|
- $tmplabel .= ' - (' . $obj->company . ')'; |
|
1917
|
+ $tmplabel .= ' - ('.$obj->company.')'; |
1918
|
1918
|
} |
1919
|
1919
|
|
1920
|
1920
|
$out .= $tmplabel; |
1921
|
1921
|
$out .= '</option>'; |
1922
|
1922
|
} else { |
1923
|
|
- $out .= '<option value="' . $obj->rowid . '"'; |
|
1923
|
+ $out .= '<option value="'.$obj->rowid.'"'; |
1924
|
1924
|
if ($disabled) { |
1925
|
1925
|
$out .= ' disabled'; |
1926
|
1926
|
} |
1927
|
1927
|
$out .= '>'; |
1928
|
1928
|
|
1929
|
|
- $tmplabel = $contactstatic->getFullName($langs) . $extendedInfos; |
|
1929
|
+ $tmplabel = $contactstatic->getFullName($langs).$extendedInfos; |
1930
|
1930
|
if ($showfunction && $obj->poste) { |
1931
|
|
- $tmplabel .= ' (' . $obj->poste . ')'; |
|
1931
|
+ $tmplabel .= ' ('.$obj->poste.')'; |
1932
|
1932
|
} |
1933
|
1933
|
if (($showsoc > 0) && $obj->company) { |
1934
|
|
- $tmplabel .= ' - (' . $obj->company . ')'; |
|
1934
|
+ $tmplabel .= ' - ('.$obj->company.')'; |
1935
|
1935
|
} |
1936
|
1936
|
|
1937
|
1937
|
$out .= $tmplabel; |
|
@@ -1939,12 +1939,12 @@ discard block |
|
|
block discarded – undo |
1939
|
1939
|
} |
1940
|
1940
|
} else { |
1941
|
1941
|
if (in_array($obj->rowid, $selected)) { |
1942
|
|
- $tmplabel = $contactstatic->getFullName($langs) . $extendedInfos; |
|
1942
|
+ $tmplabel = $contactstatic->getFullName($langs).$extendedInfos; |
1943
|
1943
|
if ($showfunction && $obj->poste) { |
1944
|
|
- $tmplabel .= ' (' . $obj->poste . ')'; |
|
1944
|
+ $tmplabel .= ' ('.$obj->poste.')'; |
1945
|
1945
|
} |
1946
|
1946
|
if (($showsoc > 0) && $obj->company) { |
1947
|
|
- $tmplabel .= ' - (' . $obj->company . ')'; |
|
1947
|
+ $tmplabel .= ' - ('.$obj->company.')'; |
1948
|
1948
|
} |
1949
|
1949
|
|
1950
|
1950
|
$out .= $tmplabel; |
|
@@ -1959,7 +1959,7 @@ discard block |
|
|
block discarded – undo |
1959
|
1959
|
} |
1960
|
1960
|
} else { |
1961
|
1961
|
$labeltoshow = ($socid != -1) ? ($langs->trans($socid ? "NoContactDefinedForThirdParty" : "NoContactDefined")) : $langs->trans('SelectAThirdPartyFirst'); |
1962
|
|
- $out .= '<option class="disabled" value="-1"' . (($showempty == 2 || $multiple) ? '' : ' selected') . ' disabled="disabled">'; |
|
1962
|
+ $out .= '<option class="disabled" value="-1"'.(($showempty == 2 || $multiple) ? '' : ' selected').' disabled="disabled">'; |
1963
|
1963
|
$out .= $labeltoshow; |
1964
|
1964
|
$out .= '</option>'; |
1965
|
1965
|
} |
|
@@ -1980,7 +1980,7 @@ discard block |
|
|
block discarded – undo |
1980
|
1980
|
} |
1981
|
1981
|
|
1982
|
1982
|
if ($conf->use_javascript_ajax && !$forcecombo && !$options_only) { |
1983
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
1983
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
1984
|
1984
|
$out .= ajax_combobox($htmlid, $events, getDolGlobalInt("CONTACT_USE_SEARCH_TO_SELECT")); |
1985
|
1985
|
} |
1986
|
1986
|
|
|
@@ -2019,18 +2019,18 @@ discard block |
|
|
block discarded – undo |
2019
|
2019
|
// On recherche les remises |
2020
|
2020
|
$sql = "SELECT re.rowid, re.amount_ht, re.amount_tva, re.amount_ttc,"; |
2021
|
2021
|
$sql .= " re.description, re.fk_facture_source"; |
2022
|
|
- $sql .= " FROM " . $this->db->prefix() . "societe_remise_except as re"; |
2023
|
|
- $sql .= " WHERE re.fk_soc = " . (int) $socid; |
2024
|
|
- $sql .= " AND re.entity = " . $conf->entity; |
|
2022
|
+ $sql .= " FROM ".$this->db->prefix()."societe_remise_except as re"; |
|
2023
|
+ $sql .= " WHERE re.fk_soc = ".(int) $socid; |
|
2024
|
+ $sql .= " AND re.entity = ".$conf->entity; |
2025
|
2025
|
if ($filter) { |
2026
|
|
- $sql .= " AND " . $filter; |
|
2026
|
+ $sql .= " AND ".$filter; |
2027
|
2027
|
} |
2028
|
2028
|
$sql .= " ORDER BY re.description ASC"; |
2029
|
2029
|
|
2030
|
|
- dol_syslog(get_class($this) . "::select_remises", LOG_DEBUG); |
|
2030
|
+ dol_syslog(get_class($this)."::select_remises", LOG_DEBUG); |
2031
|
2031
|
$resql = $this->db->query($sql); |
2032
|
2032
|
if ($resql) { |
2033
|
|
- print '<select id="select_' . $htmlname . '" class="flat maxwidthonsmartphone" name="' . $htmlname . '">'; |
|
2033
|
+ print '<select id="select_'.$htmlname.'" class="flat maxwidthonsmartphone" name="'.$htmlname.'">'; |
2034
|
2034
|
$num = $this->db->num_rows($resql); |
2035
|
2035
|
|
2036
|
2036
|
$qualifiedlines = $num; |
|
@@ -2068,16 +2068,16 @@ discard block |
|
|
block discarded – undo |
2068
|
2068
|
if (getDolGlobalString('MAIN_SHOW_FACNUMBER_IN_DISCOUNT_LIST') && !empty($obj->fk_facture_source)) { |
2069
|
2069
|
$tmpfac = new Facture($this->db); |
2070
|
2070
|
if ($tmpfac->fetch($obj->fk_facture_source) > 0) { |
2071
|
|
- $desc = $desc . ' - ' . $tmpfac->ref; |
|
2071
|
+ $desc = $desc.' - '.$tmpfac->ref; |
2072
|
2072
|
} |
2073
|
2073
|
} |
2074
|
2074
|
|
2075
|
|
- print '<option value="' . $obj->rowid . '"' . $selectstring . $disabled . '>' . $desc . ' (' . price($obj->amount_ht) . ' ' . $langs->trans("HT") . ' - ' . price($obj->amount_ttc) . ' ' . $langs->trans("TTC") . ')</option>'; |
|
2075
|
+ print '<option value="'.$obj->rowid.'"'.$selectstring.$disabled.'>'.$desc.' ('.price($obj->amount_ht).' '.$langs->trans("HT").' - '.price($obj->amount_ttc).' '.$langs->trans("TTC").')</option>'; |
2076
|
2076
|
$i++; |
2077
|
2077
|
} |
2078
|
2078
|
} |
2079
|
2079
|
print '</select>'; |
2080
|
|
- print ajax_combobox('select_' . $htmlname); |
|
2080
|
+ print ajax_combobox('select_'.$htmlname); |
2081
|
2081
|
|
2082
|
2082
|
return $qualifiedlines; |
2083
|
2083
|
} else { |
|
@@ -2186,14 +2186,14 @@ discard block |
|
|
block discarded – undo |
2186
|
2186
|
if ($showlabelofentity) { |
2187
|
2187
|
$sql .= ", e.label"; |
2188
|
2188
|
} |
2189
|
|
- $sql .= " FROM " . $this->db->prefix() . "user as u"; |
|
2189
|
+ $sql .= " FROM ".$this->db->prefix()."user as u"; |
2190
|
2190
|
if ($showlabelofentity) { |
2191
|
|
- $sql .= " LEFT JOIN " . $this->db->prefix() . "entity as e ON e.rowid = u.entity"; |
|
2191
|
+ $sql .= " LEFT JOIN ".$this->db->prefix()."entity as e ON e.rowid = u.entity"; |
2192
|
2192
|
} |
2193
|
2193
|
// Condition here should be the same than into societe->getSalesRepresentatives(). |
2194
|
2194
|
if ($userissuperadminentityone && $force_entity != 'default') { |
2195
|
2195
|
if (!empty($force_entity)) { |
2196
|
|
- $sql .= " WHERE u.entity IN (0, " . $this->db->sanitize($force_entity) . ")"; |
|
2196
|
+ $sql .= " WHERE u.entity IN (0, ".$this->db->sanitize($force_entity).")"; |
2197
|
2197
|
} else { |
2198
|
2198
|
$sql .= " WHERE u.entity IS NOT NULL"; |
2199
|
2199
|
} |
|
@@ -2201,18 +2201,18 @@ discard block |
|
|
block discarded – undo |
2201
|
2201
|
if (isModEnabled('multicompany') && getDolGlobalInt('MULTICOMPANY_TRANSVERSE_MODE')) { |
2202
|
2202
|
$sql .= " WHERE u.rowid IN (SELECT ug.fk_user FROM ".$this->db->prefix()."usergroup_user as ug WHERE ug.entity IN (".getEntity('usergroup')."))"; |
2203
|
2203
|
} else { |
2204
|
|
- $sql .= " WHERE u.entity IN (" . getEntity('user') . ")"; |
|
2204
|
+ $sql .= " WHERE u.entity IN (".getEntity('user').")"; |
2205
|
2205
|
} |
2206
|
2206
|
} |
2207
|
2207
|
|
2208
|
2208
|
if (!empty($user->socid)) { |
2209
|
|
- $sql .= " AND u.fk_soc = " . ((int) $user->socid); |
|
2209
|
+ $sql .= " AND u.fk_soc = ".((int) $user->socid); |
2210
|
2210
|
} |
2211
|
2211
|
if (is_array($exclude) && $excludeUsers) { |
2212
|
|
- $sql .= " AND u.rowid NOT IN (" . $this->db->sanitize($excludeUsers) . ")"; |
|
2212
|
+ $sql .= " AND u.rowid NOT IN (".$this->db->sanitize($excludeUsers).")"; |
2213
|
2213
|
} |
2214
|
2214
|
if ($includeUsers) { |
2215
|
|
- $sql .= " AND u.rowid IN (" . $this->db->sanitize($includeUsers) . ")"; |
|
2215
|
+ $sql .= " AND u.rowid IN (".$this->db->sanitize($includeUsers).")"; |
2216
|
2216
|
} |
2217
|
2217
|
if (getDolGlobalString('USER_HIDE_INACTIVE_IN_COMBOBOX') || $notdisabled) { |
2218
|
2218
|
$sql .= " AND u.statut <> 0"; |
|
@@ -2224,7 +2224,7 @@ discard block |
|
|
block discarded – undo |
2224
|
2224
|
$sql .= " AND u.fk_soc IS NULL"; |
2225
|
2225
|
} |
2226
|
2226
|
if (!empty($morefilter)) { |
2227
|
|
- $sql .= " " . $morefilter; |
|
2227
|
+ $sql .= " ".$morefilter; |
2228
|
2228
|
} |
2229
|
2229
|
|
2230
|
2230
|
//Add hook to filter on user (for example on usergroup define in custom modules) |
|
@@ -2239,7 +2239,7 @@ discard block |
|
|
block discarded – undo |
2239
|
2239
|
$sql .= " ORDER BY u.statut DESC, u.lastname ASC, u.firstname ASC"; |
2240
|
2240
|
} |
2241
|
2241
|
|
2242
|
|
- dol_syslog(get_class($this) . "::select_dolusers", LOG_DEBUG); |
|
2242
|
+ dol_syslog(get_class($this)."::select_dolusers", LOG_DEBUG); |
2243
|
2243
|
|
2244
|
2244
|
$resql = $this->db->query($sql); |
2245
|
2245
|
if ($resql) { |
|
@@ -2247,7 +2247,7 @@ discard block |
|
|
block discarded – undo |
2247
|
2247
|
$i = 0; |
2248
|
2248
|
if ($num) { |
2249
|
2249
|
// do not use maxwidthonsmartphone by default. Set it by caller so auto size to 100% will work when not defined |
2250
|
|
- $out .= '<select class="flat' . ($morecss ? ' ' . $morecss : ' minwidth200') . '" id="' . $htmlname . '" name="' . $htmlname . ($multiple ? '[]' : '') . '" ' . ($multiple ? 'multiple' : '') . ' ' . ($disabled ? ' disabled' : '') . '>'; |
|
2250
|
+ $out .= '<select class="flat'.($morecss ? ' '.$morecss : ' minwidth200').'" id="'.$htmlname.'" name="'.$htmlname.($multiple ? '[]' : '').'" '.($multiple ? 'multiple' : '').' '.($disabled ? ' disabled' : '').'>'; |
2251
|
2251
|
if ($show_empty && !$multiple) { |
2252
|
2252
|
$textforempty = ' '; |
2253
|
2253
|
if (!empty($conf->use_javascript_ajax)) { |
|
@@ -2256,7 +2256,7 @@ discard block |
|
|
block discarded – undo |
2256
|
2256
|
if (!is_numeric($show_empty)) { |
2257
|
2257
|
$textforempty = $show_empty; |
2258
|
2258
|
} |
2259
|
|
- $out .= '<option class="optiongrey" value="' . ($show_empty < 0 ? $show_empty : -1) . '"' . ((empty($selected) || in_array(-1, $selected)) ? ' selected' : '') . '>' . $textforempty . '</option>' . "\n"; |
|
2259
|
+ $out .= '<option class="optiongrey" value="'.($show_empty < 0 ? $show_empty : -1).'"'.((empty($selected) || in_array(-1, $selected)) ? ' selected' : '').'>'.$textforempty.'</option>'."\n"; |
2260
|
2260
|
|
2261
|
2261
|
$outarray[($show_empty < 0 ? $show_empty : -1)] = $textforempty; |
2262
|
2262
|
$outarray2[($show_empty < 0 ? $show_empty : -1)] = array( |
|
@@ -2268,13 +2268,13 @@ discard block |
|
|
block discarded – undo |
2268
|
2268
|
); |
2269
|
2269
|
} |
2270
|
2270
|
if ($show_every) { |
2271
|
|
- $out .= '<option value="-2"' . ((in_array(-2, $selected)) ? ' selected' : '') . '>-- ' . $langs->trans("Everybody") . ' --</option>' . "\n"; |
|
2271
|
+ $out .= '<option value="-2"'.((in_array(-2, $selected)) ? ' selected' : '').'>-- '.$langs->trans("Everybody").' --</option>'."\n"; |
2272
|
2272
|
|
2273
|
|
- $outarray[-2] = '-- ' . $langs->trans("Everybody") . ' --'; |
|
2273
|
+ $outarray[-2] = '-- '.$langs->trans("Everybody").' --'; |
2274
|
2274
|
$outarray2[-2] = array( |
2275
|
2275
|
'id' => -2, |
2276
|
|
- 'label' => '-- ' . $langs->trans("Everybody") . ' --', |
2277
|
|
- 'labelhtml' => '-- ' . $langs->trans("Everybody") . ' --', |
|
2276
|
+ 'label' => '-- '.$langs->trans("Everybody").' --', |
|
2277
|
+ 'labelhtml' => '-- '.$langs->trans("Everybody").' --', |
2278
|
2278
|
'color' => '', |
2279
|
2279
|
'picto' => '' |
2280
|
2280
|
); |
|
@@ -2325,21 +2325,21 @@ discard block |
|
|
block discarded – undo |
2325
|
2325
|
} |
2326
|
2326
|
if ($showstatus >= 0) { |
2327
|
2327
|
if ($obj->status == 1 && $showstatus == 1) { |
2328
|
|
- $moreinfo .= ($moreinfo ? ' - ' : ' (') . $langs->trans('Enabled'); |
2329
|
|
- $moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(') . $langs->trans('Enabled'); |
|
2328
|
+ $moreinfo .= ($moreinfo ? ' - ' : ' (').$langs->trans('Enabled'); |
|
2329
|
+ $moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(').$langs->trans('Enabled'); |
2330
|
2330
|
} |
2331
|
2331
|
if ($obj->status == 0 && $showstatus == 1) { |
2332
|
|
- $moreinfo .= ($moreinfo ? ' - ' : ' (') . $langs->trans('Disabled'); |
2333
|
|
- $moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(') . $langs->trans('Disabled'); |
|
2332
|
+ $moreinfo .= ($moreinfo ? ' - ' : ' (').$langs->trans('Disabled'); |
|
2333
|
+ $moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(').$langs->trans('Disabled'); |
2334
|
2334
|
} |
2335
|
2335
|
} |
2336
|
2336
|
if ($showlabelofentity) { |
2337
|
2337
|
if (empty($obj->entity)) { |
2338
|
|
- $moreinfo .= ($moreinfo ? ' - ' : ' (') . $langs->trans("AllEntities"); |
2339
|
|
- $moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(') . $langs->trans("AllEntities"); |
|
2338
|
+ $moreinfo .= ($moreinfo ? ' - ' : ' (').$langs->trans("AllEntities"); |
|
2339
|
+ $moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(').$langs->trans("AllEntities"); |
2340
|
2340
|
} else { |
2341
|
2341
|
if ($obj->entity != $conf->entity) { |
2342
|
|
- $moreinfo .= ($moreinfo ? ' - ' : ' (') . ($obj->label ? $obj->label : $langs->trans("EntityNameNotDefined")); |
|
2342
|
+ $moreinfo .= ($moreinfo ? ' - ' : ' (').($obj->label ? $obj->label : $langs->trans("EntityNameNotDefined")); |
2343
|
2343
|
$moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(').($obj->label ? $obj->label : $langs->trans("EntityNameNotDefined")); |
2344
|
2344
|
} |
2345
|
2345
|
} |
|
@@ -2348,13 +2348,13 @@ discard block |
|
|
block discarded – undo |
2348
|
2348
|
$moreinfohtml .= (!empty($moreinfohtml) ? ')</span>' : ''); |
2349
|
2349
|
if (!empty($disableline) && $disableline != '1') { |
2350
|
2350
|
// Add text from $enableonlytext parameter |
2351
|
|
- $moreinfo .= ' - ' . $disableline; |
2352
|
|
- $moreinfohtml .= ' - ' . $disableline; |
|
2351
|
+ $moreinfo .= ' - '.$disableline; |
|
2352
|
+ $moreinfohtml .= ' - '.$disableline; |
2353
|
2353
|
} |
2354
|
2354
|
$labeltoshow .= $moreinfo; |
2355
|
2355
|
$labeltoshowhtml .= $moreinfohtml; |
2356
|
2356
|
|
2357
|
|
- $out .= '<option value="' . $obj->rowid . '"'; |
|
2357
|
+ $out .= '<option value="'.$obj->rowid.'"'; |
2358
|
2358
|
if (!empty($disableline)) { |
2359
|
2359
|
$out .= ' disabled'; |
2360
|
2360
|
} |
|
@@ -2363,7 +2363,7 @@ discard block |
|
|
block discarded – undo |
2363
|
2363
|
} |
2364
|
2364
|
$out .= ' data-html="'; |
2365
|
2365
|
|
2366
|
|
- $outhtml = $userstatic->getNomUrl(-3, '', 0, 1, 24, 1, 'login', '', 1) . ' '; |
|
2366
|
+ $outhtml = $userstatic->getNomUrl(-3, '', 0, 1, 24, 1, 'login', '', 1).' '; |
2367
|
2367
|
if ($showstatus >= 0 && $obj->status == 0) { |
2368
|
2368
|
$outhtml .= '<strike class="opacitymediumxxx">'; |
2369
|
2369
|
} |
|
@@ -2378,7 +2378,7 @@ discard block |
|
|
block discarded – undo |
2378
|
2378
|
$out .= $labeltoshow; |
2379
|
2379
|
$out .= '</option>'; |
2380
|
2380
|
|
2381
|
|
- $outarray[$userstatic->id] = $userstatic->getFullName($langs, $fullNameMode, -1, $maxlength) . $moreinfo; |
|
2381
|
+ $outarray[$userstatic->id] = $userstatic->getFullName($langs, $fullNameMode, -1, $maxlength).$moreinfo; |
2382
|
2382
|
$outarray2[$userstatic->id] = array( |
2383
|
2383
|
'id' => $userstatic->id, |
2384
|
2384
|
'label' => $labeltoshow, |
|
@@ -2390,14 +2390,14 @@ discard block |
|
|
block discarded – undo |
2390
|
2390
|
$i++; |
2391
|
2391
|
} |
2392
|
2392
|
} else { |
2393
|
|
- $out .= '<select class="flat" id="' . $htmlname . '" name="' . $htmlname . '" disabled>'; |
2394
|
|
- $out .= '<option value="">' . $langs->trans("None") . '</option>'; |
|
2393
|
+ $out .= '<select class="flat" id="'.$htmlname.'" name="'.$htmlname.'" disabled>'; |
|
2394
|
+ $out .= '<option value="">'.$langs->trans("None").'</option>'; |
2395
|
2395
|
} |
2396
|
2396
|
$out .= '</select>'; |
2397
|
2397
|
|
2398
|
2398
|
if ($num && !$forcecombo) { |
2399
|
2399
|
// Enhance with select2 |
2400
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
2400
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
2401
|
2401
|
$out .= ajax_combobox($htmlname); |
2402
|
2402
|
} |
2403
|
2403
|
} else { |
|
@@ -2473,16 +2473,16 @@ discard block |
|
|
block discarded – undo |
2473
|
2473
|
$out .= $userstatic->getNomUrl(-1); |
2474
|
2474
|
if ($i == 0) { |
2475
|
2475
|
$ownerid = $value['id']; |
2476
|
|
- $out .= ' (' . $langs->trans("Owner") . ')'; |
|
2476
|
+ $out .= ' ('.$langs->trans("Owner").')'; |
2477
|
2477
|
} |
2478
|
2478
|
if ($nbassignetouser > 1 && $action != 'view') { |
2479
|
|
- $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 . '">'; |
|
2479
|
+ $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.'">'; |
2480
|
2480
|
} |
2481
|
2481
|
// Show my availability |
2482
|
2482
|
if ($showproperties) { |
2483
|
2483
|
if ($ownerid == $value['id'] && is_array($listofuserid) && count($listofuserid) && in_array($ownerid, array_keys($listofuserid))) { |
2484
|
2484
|
$out .= '<div class="myavailability inline-block">'; |
2485
|
|
- $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>'; |
|
2485
|
+ $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>'; |
2486
|
2486
|
$out .= '</div>'; |
2487
|
2487
|
} |
2488
|
2488
|
} |
|
@@ -2499,15 +2499,15 @@ discard block |
|
|
block discarded – undo |
2499
|
2499
|
// Method with no ajax |
2500
|
2500
|
if ($action != 'view') { |
2501
|
2501
|
$out .= '<input type="hidden" class="removedassignedhidden" name="removedassigned" value="">'; |
2502
|
|
- $out .= '<script nonce="' . getNonce() . '" type="text/javascript">jQuery(document).ready(function () {'; |
|
2502
|
+ $out .= '<script nonce="'.getNonce().'" type="text/javascript">jQuery(document).ready(function () {'; |
2503
|
2503
|
$out .= 'jQuery(".removedassigned").click(function() { jQuery(".removedassignedhidden").val(jQuery(this).val()); });'; |
2504
|
2504
|
$out .= 'jQuery(".assignedtouser").change(function() { console.log(jQuery(".assignedtouser option:selected").val());'; |
2505
|
|
- $out .= ' if (jQuery(".assignedtouser option:selected").val() > 0) { jQuery("#' . $action . 'assignedtouser").attr("disabled", false); }'; |
2506
|
|
- $out .= ' else { jQuery("#' . $action . 'assignedtouser").attr("disabled", true); }'; |
|
2505
|
+ $out .= ' if (jQuery(".assignedtouser option:selected").val() > 0) { jQuery("#'.$action.'assignedtouser").attr("disabled", false); }'; |
|
2506
|
+ $out .= ' else { jQuery("#'.$action.'assignedtouser").attr("disabled", true); }'; |
2507
|
2507
|
$out .= '});'; |
2508
|
2508
|
$out .= '})</script>'; |
2509
|
2509
|
$out .= $this->select_dolusers('', $htmlname, $show_empty, $exclude, $disabled, $include, $enableonly, $force_entity, $maxlength, $showstatus, $morefilter); |
2510
|
|
- $out .= ' <input type="submit" disabled class="button valignmiddle smallpaddingimp reposition" id="' . $action . 'assignedtouser" name="' . $action . 'assignedtouser" value="' . dol_escape_htmltag($langs->trans("Add")) . '">'; |
|
2510
|
+ $out .= ' <input type="submit" disabled class="button valignmiddle smallpaddingimp reposition" id="'.$action.'assignedtouser" name="'.$action.'assignedtouser" value="'.dol_escape_htmltag($langs->trans("Add")).'">'; |
2511
|
2511
|
$out .= '<br>'; |
2512
|
2512
|
} |
2513
|
2513
|
|
|
@@ -2566,13 +2566,13 @@ discard block |
|
|
block discarded – undo |
2566
|
2566
|
$resourcestatic->fetch($value['id']); |
2567
|
2567
|
$out .= $resourcestatic->getNomUrl(-1); |
2568
|
2568
|
if ($nbassignetoresource > 1 && $action != 'view') { |
2569
|
|
- $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 . '">'; |
|
2569
|
+ $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.'">'; |
2570
|
2570
|
} |
2571
|
2571
|
// Show my availability |
2572
|
2572
|
if ($showproperties) { |
2573
|
2573
|
if (is_array($listofresourceid) && count($listofresourceid)) { |
2574
|
2574
|
$out .= '<div class="myavailability inline-block">'; |
2575
|
|
- $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>'; |
|
2575
|
+ $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>'; |
2576
|
2576
|
$out .= '</div>'; |
2577
|
2577
|
} |
2578
|
2578
|
} |
|
@@ -2589,11 +2589,11 @@ discard block |
|
|
block discarded – undo |
2589
|
2589
|
// Method with no ajax |
2590
|
2590
|
if ($action != 'view') { |
2591
|
2591
|
$out .= '<input type="hidden" class="removedassignedhidden" name="removedassignedresource" value="">'; |
2592
|
|
- $out .= '<script nonce="' . getNonce() . '" type="text/javascript">jQuery(document).ready(function () {'; |
|
2592
|
+ $out .= '<script nonce="'.getNonce().'" type="text/javascript">jQuery(document).ready(function () {'; |
2593
|
2593
|
$out .= 'jQuery(".removedassignedresource").click(function() { jQuery(".removedassignedresourcehidden").val(jQuery(this).val()); });'; |
2594
|
2594
|
$out .= 'jQuery(".assignedtoresource").change(function() { console.log(jQuery(".assignedtoresource option:selected").val());'; |
2595
|
|
- $out .= ' if (jQuery(".assignedtoresource option:selected").val() > 0) { jQuery("#' . $action . 'assignedtoresource").attr("disabled", false); }'; |
2596
|
|
- $out .= ' else { jQuery("#' . $action . 'assignedtoresource").attr("disabled", true); }'; |
|
2595
|
+ $out .= ' if (jQuery(".assignedtoresource option:selected").val() > 0) { jQuery("#'.$action.'assignedtoresource").attr("disabled", false); }'; |
|
2596
|
+ $out .= ' else { jQuery("#'.$action.'assignedtoresource").attr("disabled", true); }'; |
2597
|
2597
|
$out .= '});'; |
2598
|
2598
|
$out .= '})</script>'; |
2599
|
2599
|
|
|
@@ -2601,7 +2601,7 @@ discard block |
|
|
block discarded – undo |
2601
|
2601
|
$out .= img_picto('', 'resource', 'class="pictofixedwidth"'); |
2602
|
2602
|
$out .= $formresources->select_resource_list(0, $htmlname, [], 1, 1, 0, $events, array(), 2, 0); |
2603
|
2603
|
//$out .= $this->select_dolusers('', $htmlname, $show_empty, $exclude, $disabled, $include, $enableonly, $force_entity, $maxlength, $showstatus, $morefilter); |
2604
|
|
- $out .= ' <input type="submit" disabled class="button valignmiddle smallpaddingimp reposition" id="' . $action . 'assignedtoresource" name="' . $action . 'assignedtoresource" value="' . dol_escape_htmltag($langs->trans("Add")) . '">'; |
|
2604
|
+ $out .= ' <input type="submit" disabled class="button valignmiddle smallpaddingimp reposition" id="'.$action.'assignedtoresource" name="'.$action.'assignedtoresource" value="'.dol_escape_htmltag($langs->trans("Add")).'">'; |
2605
|
2605
|
$out .= '<br>'; |
2606
|
2606
|
} |
2607
|
2607
|
|
|
@@ -2665,7 +2665,7 @@ discard block |
|
|
block discarded – undo |
2665
|
2665
|
$placeholder = ''; |
2666
|
2666
|
|
2667
|
2667
|
if ($selected && empty($selected_input_value)) { |
2668
|
|
- require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; |
|
2668
|
+ require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; |
2669
|
2669
|
$producttmpselect = new Product($this->db); |
2670
|
2670
|
$producttmpselect->fetch($selected); |
2671
|
2671
|
$selected_input_value = $producttmpselect->ref; |
|
@@ -2680,20 +2680,20 @@ discard block |
|
|
block discarded – undo |
2680
|
2680
|
} |
2681
|
2681
|
} |
2682
|
2682
|
// mode=1 means customers products |
2683
|
|
- $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; |
|
2683
|
+ $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; |
2684
|
2684
|
if ((int) $warehouseId > 0) { |
2685
|
|
- $urloption .= '&warehouseid=' . (int) $warehouseId; |
|
2685
|
+ $urloption .= '&warehouseid='.(int) $warehouseId; |
2686
|
2686
|
} |
2687
|
|
- $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); |
|
2687
|
+ $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); |
2688
|
2688
|
|
2689
|
2689
|
if (isModEnabled('variants') && is_array($selected_combinations)) { |
2690
|
2690
|
// Code to automatically insert with javascript the select of attributes under the select of product |
2691
|
2691
|
// when a parent of variant has been selected. |
2692
|
2692
|
$out .= ' |
2693
|
2693
|
<!-- script to auto show attributes select tags if a variant was selected --> |
2694
|
|
- <script nonce="' . getNonce() . '"> |
|
2694
|
+ <script nonce="' . getNonce().'"> |
2695
|
2695
|
// auto show attributes fields |
2696
|
|
- selected = ' . json_encode($selected_combinations) . '; |
|
2696
|
+ selected = ' . json_encode($selected_combinations).'; |
2697
|
2697
|
combvalues = {}; |
2698
|
2698
|
|
2699
|
2699
|
jQuery(document).ready(function () { |
|
@@ -2704,7 +2704,7 @@ discard block |
|
|
block discarded – undo |
2704
|
2704
|
} |
2705
|
2705
|
}); |
2706
|
2706
|
|
2707
|
|
- jQuery("input#' . $htmlname . '").change(function () { |
|
2707
|
+ jQuery("input#' . $htmlname.'").change(function () { |
2708
|
2708
|
|
2709
|
2709
|
if (!jQuery(this).val()) { |
2710
|
2710
|
jQuery(\'div#attributes_box\').empty(); |
|
@@ -2713,7 +2713,7 @@ discard block |
|
|
block discarded – undo |
2713
|
2713
|
|
2714
|
2714
|
console.log("A change has started. We get variants fields to inject html select"); |
2715
|
2715
|
|
2716
|
|
- jQuery.getJSON("' . DOL_URL_ROOT . '/variants/ajax/getCombinations.php", { |
|
2716
|
+ jQuery.getJSON("' . DOL_URL_ROOT.'/variants/ajax/getCombinations.php", { |
2717
|
2717
|
id: jQuery(this).val() |
2718
|
2718
|
}, function (data) { |
2719
|
2719
|
jQuery(\'div#attributes_box\').empty(); |
|
@@ -2756,21 +2756,21 @@ discard block |
|
|
block discarded – undo |
2756
|
2756
|
}) |
2757
|
2757
|
}); |
2758
|
2758
|
|
2759
|
|
- ' . ($selected ? 'jQuery("input#' . $htmlname . '").change();' : '') . ' |
|
2759
|
+ ' . ($selected ? 'jQuery("input#'.$htmlname.'").change();' : '').' |
2760
|
2760
|
}); |
2761
|
2761
|
</script> |
2762
|
2762
|
'; |
2763
|
2763
|
} |
2764
|
2764
|
|
2765
|
2765
|
if (empty($hidelabel)) { |
2766
|
|
- $out .= $langs->trans("RefOrLabel") . ' : '; |
|
2766
|
+ $out .= $langs->trans("RefOrLabel").' : '; |
2767
|
2767
|
} elseif ($hidelabel > 1) { |
2768
|
|
- $placeholder = ' placeholder="' . $langs->trans("RefOrLabel") . '"'; |
|
2768
|
+ $placeholder = ' placeholder="'.$langs->trans("RefOrLabel").'"'; |
2769
|
2769
|
if ($hidelabel == 2) { |
2770
|
2770
|
$out .= img_picto($langs->trans("Search"), 'search'); |
2771
|
2771
|
} |
2772
|
2772
|
} |
2773
|
|
- $out .= '<input type="text" class="minwidth100' . ($morecss ? ' ' . $morecss : '') . '" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . $placeholder . ' ' . (getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '') . ' />'; |
|
2773
|
+ $out .= '<input type="text" class="minwidth100'.($morecss ? ' '.$morecss : '').'" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' '.(getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '').' />'; |
2774
|
2774
|
if ($hidelabel == 3) { |
2775
|
2775
|
$out .= img_picto($langs->trans("Search"), 'search'); |
2776
|
2776
|
} |
|
@@ -2807,33 +2807,33 @@ discard block |
|
|
block discarded – undo |
2807
|
2807
|
// phpcs:enable |
2808
|
2808
|
global $db; |
2809
|
2809
|
|
2810
|
|
- require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; |
|
2810
|
+ require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; |
2811
|
2811
|
|
2812
|
2812
|
$error = 0; |
2813
|
2813
|
$out = ''; |
2814
|
2814
|
|
2815
|
2815
|
if (!$forcecombo) { |
2816
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
2816
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
2817
|
2817
|
$events = array(); |
2818
|
2818
|
$out .= ajax_combobox($htmlname, $events, getDolGlobalInt("PRODUIT_USE_SEARCH_TO_SELECT")); |
2819
|
2819
|
} |
2820
|
2820
|
|
2821
|
|
- $out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">'; |
|
2821
|
+ $out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">'; |
2822
|
2822
|
|
2823
|
2823
|
$sql = 'SELECT b.rowid, b.ref, b.label, b.fk_product'; |
2824
|
|
- $sql .= ' FROM ' . MAIN_DB_PREFIX . 'bom_bom as b'; |
2825
|
|
- $sql .= ' WHERE b.entity IN (' . getEntity('bom') . ')'; |
|
2824
|
+ $sql .= ' FROM '.MAIN_DB_PREFIX.'bom_bom as b'; |
|
2825
|
+ $sql .= ' WHERE b.entity IN ('.getEntity('bom').')'; |
2826
|
2826
|
if (!empty($status)) { |
2827
|
|
- $sql .= ' AND status = ' . (int) $status; |
|
2827
|
+ $sql .= ' AND status = '.(int) $status; |
2828
|
2828
|
} |
2829
|
2829
|
if (!empty($type)) { |
2830
|
|
- $sql .= ' AND bomtype = ' . (int) $type; |
|
2830
|
+ $sql .= ' AND bomtype = '.(int) $type; |
2831
|
2831
|
} |
2832
|
2832
|
if (!empty($TProducts)) { |
2833
|
|
- $sql .= ' AND fk_product IN (' . $this->db->sanitize(implode(',', $TProducts)) . ')'; |
|
2833
|
+ $sql .= ' AND fk_product IN ('.$this->db->sanitize(implode(',', $TProducts)).')'; |
2834
|
2834
|
} |
2835
|
2835
|
if (!empty($limit)) { |
2836
|
|
- $sql .= ' LIMIT ' . (int) $limit; |
|
2836
|
+ $sql .= ' LIMIT '.(int) $limit; |
2837
|
2837
|
} |
2838
|
2838
|
$resql = $db->query($sql); |
2839
|
2839
|
if ($resql) { |
|
@@ -2847,11 +2847,11 @@ discard block |
|
|
block discarded – undo |
2847
|
2847
|
while ($obj = $db->fetch_object($resql)) { |
2848
|
2848
|
$product = new Product($db); |
2849
|
2849
|
$res = $product->fetch($obj->fk_product); |
2850
|
|
- $out .= '<option value="' . $obj->rowid . '"'; |
|
2850
|
+ $out .= '<option value="'.$obj->rowid.'"'; |
2851
|
2851
|
if ($obj->rowid == $selected) { |
2852
|
2852
|
$out .= 'selected'; |
2853
|
2853
|
} |
2854
|
|
- $out .= '>' . $obj->ref . ' - ' . $product->label . ' - ' . $obj->label . '</option>'; |
|
2854
|
+ $out .= '>'.$obj->ref.' - '.$product->label.' - '.$obj->label.'</option>'; |
2855
|
2855
|
} |
2856
|
2856
|
} else { |
2857
|
2857
|
$error++; |
|
@@ -2909,7 +2909,7 @@ discard block |
|
|
block discarded – undo |
2909
|
2909
|
|
2910
|
2910
|
$warehouseStatusArray = array(); |
2911
|
2911
|
if (!empty($warehouseStatus)) { |
2912
|
|
- require_once DOL_DOCUMENT_ROOT . '/product/stock/class/entrepot.class.php'; |
|
2912
|
+ require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php'; |
2913
|
2913
|
if (preg_match('/warehouseclosed/', $warehouseStatus)) { |
2914
|
2914
|
$warehouseStatusArray[] = Entrepot::STATUS_CLOSED; |
2915
|
2915
|
} |
|
@@ -2923,9 +2923,9 @@ discard block |
|
|
block discarded – undo |
2923
|
2923
|
|
2924
|
2924
|
$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"; |
2925
|
2925
|
if (count($warehouseStatusArray)) { |
2926
|
|
- $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 |
|
2926
|
+ $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 |
2927
|
2927
|
} else { |
2928
|
|
- $selectFieldsGrouped = ", " . $this->db->ifsql("p.stock IS NULL", 0, "p.stock") . " AS stock"; |
|
2928
|
+ $selectFieldsGrouped = ", ".$this->db->ifsql("p.stock IS NULL", 0, "p.stock")." AS stock"; |
2929
|
2929
|
} |
2930
|
2930
|
|
2931
|
2931
|
$sql = "SELECT "; |
|
@@ -2941,9 +2941,9 @@ discard block |
|
|
block discarded – undo |
2941
|
2941
|
|
2942
|
2942
|
if (getDolGlobalString('PRODUCT_SORT_BY_CATEGORY')) { |
2943
|
2943
|
//Product category |
2944
|
|
- $sql .= ", (SELECT " . $this->db->prefix() . "categorie_product.fk_categorie |
2945
|
|
- FROM " . $this->db->prefix() . "categorie_product |
2946
|
|
- WHERE " . $this->db->prefix() . "categorie_product.fk_product=p.rowid |
|
2944
|
+ $sql .= ", (SELECT ".$this->db->prefix()."categorie_product.fk_categorie |
|
2945
|
+ FROM " . $this->db->prefix()."categorie_product |
|
2946
|
+ WHERE " . $this->db->prefix()."categorie_product.fk_product=p.rowid |
2947
|
2947
|
LIMIT 1 |
2948
|
2948
|
) AS categorie_product_id "; |
2949
|
2949
|
} |
|
@@ -2969,15 +2969,15 @@ discard block |
|
|
block discarded – undo |
2969
|
2969
|
} |
2970
|
2970
|
// Price by quantity |
2971
|
2971
|
if (getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES')) { |
2972
|
|
- $sql .= ", (SELECT pp.rowid FROM " . $this->db->prefix() . "product_price as pp WHERE pp.fk_product = p.rowid"; |
|
2972
|
+ $sql .= ", (SELECT pp.rowid FROM ".$this->db->prefix()."product_price as pp WHERE pp.fk_product = p.rowid"; |
2973
|
2973
|
if ($price_level >= 1 && getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES')) { |
2974
|
|
- $sql .= " AND price_level = " . ((int) $price_level); |
|
2974
|
+ $sql .= " AND price_level = ".((int) $price_level); |
2975
|
2975
|
} |
2976
|
2976
|
$sql .= " ORDER BY date_price"; |
2977
|
2977
|
$sql .= " DESC LIMIT 1) as price_rowid"; |
2978
|
|
- $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 |
|
2978
|
+ $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 |
2979
|
2979
|
if ($price_level >= 1 && getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES')) { |
2980
|
|
- $sql .= " AND price_level = " . ((int) $price_level); |
|
2980
|
+ $sql .= " AND price_level = ".((int) $price_level); |
2981
|
2981
|
} |
2982
|
2982
|
$sql .= " ORDER BY date_price"; |
2983
|
2983
|
$sql .= " DESC LIMIT 1) as price_by_qty"; |
|
@@ -2987,7 +2987,7 @@ discard block |
|
|
block discarded – undo |
2987
|
2987
|
$sql .= " FROM ".$this->db->prefix()."product as p"; |
2988
|
2988
|
|
2989
|
2989
|
if (getDolGlobalString('MAIN_SEARCH_PRODUCT_FORCE_INDEX')) { |
2990
|
|
- $sql .= " USE INDEX (" . $this->db->sanitize(getDolGlobalString('MAIN_PRODUCT_FORCE_INDEX')) . ")"; |
|
2990
|
+ $sql .= " USE INDEX (".$this->db->sanitize(getDolGlobalString('MAIN_PRODUCT_FORCE_INDEX')).")"; |
2991
|
2991
|
} |
2992
|
2992
|
|
2993
|
2993
|
// Add from (left join) from hooks |
|
@@ -2996,53 +2996,53 @@ discard block |
|
|
block discarded – undo |
2996
|
2996
|
$sql .= $hookmanager->resPrint; |
2997
|
2997
|
|
2998
|
2998
|
if (count($warehouseStatusArray)) { |
2999
|
|
- $sql .= " LEFT JOIN " . $this->db->prefix() . "product_stock as ps on ps.fk_product = p.rowid"; |
3000
|
|
- $sql .= " LEFT JOIN " . $this->db->prefix() . "entrepot as e on ps.fk_entrepot = e.rowid AND e.entity IN (" . getEntity('stock') . ")"; |
3001
|
|
- $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. |
|
2999
|
+ $sql .= " LEFT JOIN ".$this->db->prefix()."product_stock as ps on ps.fk_product = p.rowid"; |
|
3000
|
+ $sql .= " LEFT JOIN ".$this->db->prefix()."entrepot as e on ps.fk_entrepot = e.rowid AND e.entity IN (".getEntity('stock').")"; |
|
3001
|
+ $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. |
3002
|
3002
|
} |
3003
|
3003
|
|
3004
|
3004
|
// include search in supplier ref |
3005
|
3005
|
if (getDolGlobalString('MAIN_SEARCH_PRODUCT_BY_FOURN_REF')) { |
3006
|
|
- $sql .= " LEFT JOIN " . $this->db->prefix() . "product_fournisseur_price as pfp ON p.rowid = pfp.fk_product"; |
|
3006
|
+ $sql .= " LEFT JOIN ".$this->db->prefix()."product_fournisseur_price as pfp ON p.rowid = pfp.fk_product"; |
3007
|
3007
|
} |
3008
|
3008
|
|
3009
|
3009
|
//Price by customer |
3010
|
3010
|
if ((getDolGlobalString('PRODUIT_CUSTOMER_PRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES')) && !empty($socid)) { |
3011
|
|
- $sql .= " LEFT JOIN " . $this->db->prefix() . "product_customer_price as pcp ON pcp.fk_soc=" . ((int) $socid) . " AND pcp.fk_product=p.rowid"; |
|
3011
|
+ $sql .= " LEFT JOIN ".$this->db->prefix()."product_customer_price as pcp ON pcp.fk_soc=".((int) $socid)." AND pcp.fk_product=p.rowid"; |
3012
|
3012
|
} |
3013
|
3013
|
// Units |
3014
|
3014
|
if (getDolGlobalInt('PRODUCT_USE_UNITS')) { |
3015
|
|
- $sql .= " LEFT JOIN " . $this->db->prefix() . "c_units u ON u.rowid = p.fk_unit"; |
|
3015
|
+ $sql .= " LEFT JOIN ".$this->db->prefix()."c_units u ON u.rowid = p.fk_unit"; |
3016
|
3016
|
} |
3017
|
3017
|
// Multilang : we add translation |
3018
|
3018
|
if (getDolGlobalInt('MAIN_MULTILANGS')) { |
3019
|
|
- $sql .= " LEFT JOIN " . $this->db->prefix() . "product_lang as pl ON pl.fk_product = p.rowid "; |
|
3019
|
+ $sql .= " LEFT JOIN ".$this->db->prefix()."product_lang as pl ON pl.fk_product = p.rowid "; |
3020
|
3020
|
if (getDolGlobalString('PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE') && !empty($socid)) { |
3021
|
|
- require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; |
|
3021
|
+ require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; |
3022
|
3022
|
$soc = new Societe($this->db); |
3023
|
3023
|
$result = $soc->fetch($socid); |
3024
|
3024
|
if ($result > 0 && !empty($soc->default_lang)) { |
3025
|
|
- $sql .= " AND pl.lang = '" . $this->db->escape($soc->default_lang) . "'"; |
|
3025
|
+ $sql .= " AND pl.lang = '".$this->db->escape($soc->default_lang)."'"; |
3026
|
3026
|
} else { |
3027
|
|
- $sql .= " AND pl.lang = '" . $this->db->escape($langs->getDefaultLang()) . "'"; |
|
3027
|
+ $sql .= " AND pl.lang = '".$this->db->escape($langs->getDefaultLang())."'"; |
3028
|
3028
|
} |
3029
|
3029
|
} else { |
3030
|
|
- $sql .= " AND pl.lang = '" . $this->db->escape($langs->getDefaultLang()) . "'"; |
|
3030
|
+ $sql .= " AND pl.lang = '".$this->db->escape($langs->getDefaultLang())."'"; |
3031
|
3031
|
} |
3032
|
3032
|
} |
3033
|
3033
|
|
3034
|
3034
|
if (getDolGlobalString('PRODUIT_ATTRIBUTES_HIDECHILD')) { |
3035
|
|
- $sql .= " LEFT JOIN " . $this->db->prefix() . "product_attribute_combination pac ON pac.fk_product_child = p.rowid"; |
|
3035
|
+ $sql .= " LEFT JOIN ".$this->db->prefix()."product_attribute_combination pac ON pac.fk_product_child = p.rowid"; |
3036
|
3036
|
} |
3037
|
3037
|
|
3038
|
|
- $sql .= ' WHERE p.entity IN (' . getEntity('product') . ')'; |
|
3038
|
+ $sql .= ' WHERE p.entity IN ('.getEntity('product').')'; |
3039
|
3039
|
|
3040
|
3040
|
if (getDolGlobalString('PRODUIT_ATTRIBUTES_HIDECHILD')) { |
3041
|
3041
|
$sql .= " AND pac.rowid IS NULL"; |
3042
|
3042
|
} |
3043
|
3043
|
|
3044
|
3044
|
if ($finished == 0) { |
3045
|
|
- $sql .= " AND p.finished = " . ((int) $finished); |
|
3045
|
+ $sql .= " AND p.finished = ".((int) $finished); |
3046
|
3046
|
} elseif ($finished == 1) { |
3047
|
3047
|
$sql .= " AND p.finished = ".((int) $finished); |
3048
|
3048
|
} |
|
@@ -3050,11 +3050,11 @@ discard block |
|
|
block discarded – undo |
3050
|
3050
|
$sql .= " AND p.tosell = ".((int) $status); |
3051
|
3051
|
} |
3052
|
3052
|
if ($status_purchase >= 0) { |
3053
|
|
- $sql .= " AND p.tobuy = " . ((int) $status_purchase); |
|
3053
|
+ $sql .= " AND p.tobuy = ".((int) $status_purchase); |
3054
|
3054
|
} |
3055
|
3055
|
// Filter by product type |
3056
|
3056
|
if (strval($filtertype) != '') { |
3057
|
|
- $sql .= " AND p.fk_product_type = " . ((int) $filtertype); |
|
3057
|
+ $sql .= " AND p.fk_product_type = ".((int) $filtertype); |
3058
|
3058
|
} elseif (!isModEnabled('product')) { // when product module is disabled, show services only |
3059
|
3059
|
$sql .= " AND p.fk_product_type = 1"; |
3060
|
3060
|
} elseif (!isModEnabled('service')) { // when service module is disabled, show products only |
|
@@ -3062,7 +3062,7 @@ discard block |
|
|
block discarded – undo |
3062
|
3062
|
} |
3063
|
3063
|
|
3064
|
3064
|
if ((int) $warehouseId > 0) { |
3065
|
|
- $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)"; |
|
3065
|
+ $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)"; |
3066
|
3066
|
} |
3067
|
3067
|
|
3068
|
3068
|
// Add where from hooks |
|
@@ -3083,21 +3083,21 @@ discard block |
|
|
block discarded – undo |
3083
|
3083
|
if ($i > 0) { |
3084
|
3084
|
$sql .= " AND "; |
3085
|
3085
|
} |
3086
|
|
- $sql .= "(p.ref LIKE '" . $this->db->escape($prefix . $crit) . "%' OR p.label LIKE '" . $this->db->escape($prefix . $crit) . "%'"; |
|
3086
|
+ $sql .= "(p.ref LIKE '".$this->db->escape($prefix.$crit)."%' OR p.label LIKE '".$this->db->escape($prefix.$crit)."%'"; |
3087
|
3087
|
if (getDolGlobalInt('MAIN_MULTILANGS')) { |
3088
|
|
- $sql .= " OR pl.label LIKE '" . $this->db->escape($prefix . $crit) . "%'"; |
|
3088
|
+ $sql .= " OR pl.label LIKE '".$this->db->escape($prefix.$crit)."%'"; |
3089
|
3089
|
} |
3090
|
3090
|
if ((getDolGlobalString('PRODUIT_CUSTOMER_PRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES')) && !empty($socid)) { |
3091
|
|
- $sql .= " OR pcp.ref_customer LIKE '" . $this->db->escape($prefix . $crit) . "%'"; |
|
3091
|
+ $sql .= " OR pcp.ref_customer LIKE '".$this->db->escape($prefix.$crit)."%'"; |
3092
|
3092
|
} |
3093
|
3093
|
if (getDolGlobalString('PRODUCT_AJAX_SEARCH_ON_DESCRIPTION')) { |
3094
|
|
- $sql .= " OR p.description LIKE '" . $this->db->escape($prefix . $crit) . "%'"; |
|
3094
|
+ $sql .= " OR p.description LIKE '".$this->db->escape($prefix.$crit)."%'"; |
3095
|
3095
|
if (getDolGlobalInt('MAIN_MULTILANGS')) { |
3096
|
|
- $sql .= " OR pl.description LIKE '" . $this->db->escape($prefix . $crit) . "%'"; |
|
3096
|
+ $sql .= " OR pl.description LIKE '".$this->db->escape($prefix.$crit)."%'"; |
3097
|
3097
|
} |
3098
|
3098
|
} |
3099
|
3099
|
if (getDolGlobalString('MAIN_SEARCH_PRODUCT_BY_FOURN_REF')) { |
3100
|
|
- $sql .= " OR pfp.ref_fourn LIKE '" . $this->db->escape($prefix . $crit) . "%'"; |
|
3100
|
+ $sql .= " OR pfp.ref_fourn LIKE '".$this->db->escape($prefix.$crit)."%'"; |
3101
|
3101
|
} |
3102
|
3102
|
$sql .= ")"; |
3103
|
3103
|
$i++; |
|
@@ -3106,12 +3106,12 @@ discard block |
|
|
block discarded – undo |
3106
|
3106
|
$sql .= ")"; |
3107
|
3107
|
} |
3108
|
3108
|
if (isModEnabled('barcode')) { |
3109
|
|
- $sql .= " OR p.barcode LIKE '" . $this->db->escape($prefix . $filterkey) . "%'"; |
|
3109
|
+ $sql .= " OR p.barcode LIKE '".$this->db->escape($prefix.$filterkey)."%'"; |
3110
|
3110
|
} |
3111
|
3111
|
$sql .= ')'; |
3112
|
3112
|
} |
3113
|
3113
|
if (count($warehouseStatusArray)) { |
3114
|
|
- $sql .= " GROUP BY " . $selectFields; |
|
3114
|
+ $sql .= " GROUP BY ".$selectFields; |
3115
|
3115
|
} |
3116
|
3116
|
|
3117
|
3117
|
//Sort by category |
|
@@ -3126,23 +3126,23 @@ discard block |
|
|
block discarded – undo |
3126
|
3126
|
$sql .= $this->db->plimit($limit, 0); |
3127
|
3127
|
|
3128
|
3128
|
// Build output string |
3129
|
|
- dol_syslog(get_class($this) . "::select_produits_list search products", LOG_DEBUG); |
|
3129
|
+ dol_syslog(get_class($this)."::select_produits_list search products", LOG_DEBUG); |
3130
|
3130
|
$result = $this->db->query($sql); |
3131
|
3131
|
if ($result) { |
3132
|
|
- require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; |
3133
|
|
- require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php'; |
3134
|
|
- require_once DOL_DOCUMENT_ROOT . '/core/lib/product.lib.php'; |
|
3132
|
+ require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; |
|
3133
|
+ require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php'; |
|
3134
|
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php'; |
3135
|
3135
|
|
3136
|
3136
|
$num = $this->db->num_rows($result); |
3137
|
3137
|
|
3138
|
3138
|
$events = array(); |
3139
|
3139
|
|
3140
|
3140
|
if (!$forcecombo) { |
3141
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
3141
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
3142
|
3142
|
$out .= ajax_combobox($htmlname, $events, getDolGlobalInt("PRODUIT_USE_SEARCH_TO_SELECT")); |
3143
|
3143
|
} |
3144
|
3144
|
|
3145
|
|
- $out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">'; |
|
3145
|
+ $out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">'; |
3146
|
3146
|
|
3147
|
3147
|
$textifempty = ''; |
3148
|
3148
|
// Do not use textifempty = ' ' or ' ' here, or search on key will search on ' key'. |
|
@@ -3159,7 +3159,7 @@ discard block |
|
|
block discarded – undo |
3159
|
3159
|
} |
3160
|
3160
|
} |
3161
|
3161
|
if ($showempty) { |
3162
|
|
- $out .= '<option value="-1" selected>' . ($textifempty ? $textifempty : ' ') . '</option>'; |
|
3162
|
+ $out .= '<option value="-1" selected>'.($textifempty ? $textifempty : ' ').'</option>'; |
3163
|
3163
|
} |
3164
|
3164
|
|
3165
|
3165
|
$i = 0; |
|
@@ -3170,11 +3170,11 @@ discard block |
|
|
block discarded – undo |
3170
|
3170
|
|
3171
|
3171
|
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 |
3172
|
3172
|
$sql = "SELECT rowid, quantity, price, unitprice, remise_percent, remise, price_base_type"; |
3173
|
|
- $sql .= " FROM " . $this->db->prefix() . "product_price_by_qty"; |
3174
|
|
- $sql .= " WHERE fk_product_price = " . ((int) $objp->price_rowid); |
|
3173
|
+ $sql .= " FROM ".$this->db->prefix()."product_price_by_qty"; |
|
3174
|
+ $sql .= " WHERE fk_product_price = ".((int) $objp->price_rowid); |
3175
|
3175
|
$sql .= " ORDER BY quantity ASC"; |
3176
|
3176
|
|
3177
|
|
- dol_syslog(get_class($this) . "::select_produits_list search prices by qty", LOG_DEBUG); |
|
3177
|
+ dol_syslog(get_class($this)."::select_produits_list search prices by qty", LOG_DEBUG); |
3178
|
3178
|
$result2 = $this->db->query($sql); |
3179
|
3179
|
if ($result2) { |
3180
|
3180
|
$nb_prices = $this->db->num_rows($result2); |
|
@@ -3212,7 +3212,7 @@ discard block |
|
|
block discarded – undo |
3212
|
3212
|
$price_product = new Product($this->db); |
3213
|
3213
|
$price_product->fetch($objp->rowid, '', '', 1); |
3214
|
3214
|
|
3215
|
|
- require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php'; |
|
3215
|
+ require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php'; |
3216
|
3216
|
$priceparser = new PriceParser($this->db); |
3217
|
3217
|
$price_result = $priceparser->parseProduct($price_product); |
3218
|
3218
|
if ($price_result >= 0) { |
|
@@ -3298,7 +3298,7 @@ discard block |
|
|
block discarded – undo |
3298
|
3298
|
$label = $objp->label_translated; |
3299
|
3299
|
} |
3300
|
3300
|
if (!empty($filterkey) && $filterkey != '') { |
3301
|
|
- $label = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $label, 1); |
|
3301
|
+ $label = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $label, 1); |
3302
|
3302
|
} |
3303
|
3303
|
|
3304
|
3304
|
$outkey = $objp->rowid; |
|
@@ -3319,32 +3319,32 @@ discard block |
|
|
block discarded – undo |
3319
|
3319
|
$outdurationunit = $outtype == Product::TYPE_SERVICE ? substr($objp->duration, -1) : ''; |
3320
|
3320
|
|
3321
|
3321
|
if ($outorigin && getDolGlobalString('PRODUCT_SHOW_ORIGIN_IN_COMBO')) { |
3322
|
|
- require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php'; |
|
3322
|
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; |
3323
|
3323
|
} |
3324
|
3324
|
|
3325
|
3325
|
// Units |
3326
|
3326
|
$outvalUnits = ''; |
3327
|
3327
|
if (getDolGlobalInt('PRODUCT_USE_UNITS')) { |
3328
|
3328
|
if (!empty($objp->unit_short)) { |
3329
|
|
- $outvalUnits .= ' - ' . $objp->unit_short; |
|
3329
|
+ $outvalUnits .= ' - '.$objp->unit_short; |
3330
|
3330
|
} |
3331
|
3331
|
} |
3332
|
3332
|
if (getDolGlobalString('PRODUCT_SHOW_DIMENSIONS_IN_COMBO')) { |
3333
|
3333
|
if (!empty($objp->weight) && $objp->weight_units !== null) { |
3334
|
3334
|
$unitToShow = showDimensionInBestUnit($objp->weight, $objp->weight_units, 'weight', $langs); |
3335
|
|
- $outvalUnits .= ' - ' . $unitToShow; |
|
3335
|
+ $outvalUnits .= ' - '.$unitToShow; |
3336
|
3336
|
} |
3337
|
3337
|
if ((!empty($objp->length) || !empty($objp->width) || !empty($objp->height)) && $objp->length_units !== null) { |
3338
|
|
- $unitToShow = $objp->length . ' x ' . $objp->width . ' x ' . $objp->height . ' ' . measuringUnitString(0, 'size', $objp->length_units); |
3339
|
|
- $outvalUnits .= ' - ' . $unitToShow; |
|
3338
|
+ $unitToShow = $objp->length.' x '.$objp->width.' x '.$objp->height.' '.measuringUnitString(0, 'size', $objp->length_units); |
|
3339
|
+ $outvalUnits .= ' - '.$unitToShow; |
3340
|
3340
|
} |
3341
|
3341
|
if (!empty($objp->surface) && $objp->surface_units !== null) { |
3342
|
3342
|
$unitToShow = showDimensionInBestUnit($objp->surface, $objp->surface_units, 'surface', $langs); |
3343
|
|
- $outvalUnits .= ' - ' . $unitToShow; |
|
3343
|
+ $outvalUnits .= ' - '.$unitToShow; |
3344
|
3344
|
} |
3345
|
3345
|
if (!empty($objp->volume) && $objp->volume_units !== null) { |
3346
|
3346
|
$unitToShow = showDimensionInBestUnit($objp->volume, $objp->volume_units, 'volume', $langs); |
3347
|
|
- $outvalUnits .= ' - ' . $unitToShow; |
|
3347
|
+ $outvalUnits .= ' - '.$unitToShow; |
3348
|
3348
|
} |
3349
|
3349
|
} |
3350
|
3350
|
if ($outdurationvalue && $outdurationunit) { |
|
@@ -3356,7 +3356,7 @@ discard block |
|
|
block discarded – undo |
3356
|
3356
|
'y' => $langs->trans('Year') |
3357
|
3357
|
); |
3358
|
3358
|
if (isset($da[$outdurationunit])) { |
3359
|
|
- $outvalUnits .= ' - ' . $outdurationvalue . ' ' . $langs->transnoentities($da[$outdurationunit] . ($outdurationvalue > 1 ? 's' : '')); |
|
3359
|
+ $outvalUnits .= ' - '.$outdurationvalue.' '.$langs->transnoentities($da[$outdurationunit].($outdurationvalue > 1 ? 's' : '')); |
3360
|
3360
|
} |
3361
|
3361
|
} |
3362
|
3362
|
|
|
@@ -3376,31 +3376,31 @@ discard block |
|
|
block discarded – undo |
3376
|
3376
|
$labeltoshow = ''; |
3377
|
3377
|
$labeltoshow .= $objp->ref; |
3378
|
3378
|
if (!empty($objp->custref)) { |
3379
|
|
- $labeltoshow .= ' (' . $objp->custref . ')'; |
|
3379
|
+ $labeltoshow .= ' ('.$objp->custref.')'; |
3380
|
3380
|
} |
3381
|
3381
|
if ($outbarcode) { |
3382
|
|
- $labeltoshow .= ' (' . $outbarcode . ')'; |
|
3382
|
+ $labeltoshow .= ' ('.$outbarcode.')'; |
3383
|
3383
|
} |
3384
|
|
- $labeltoshow .= ' - ' . dol_trunc($label, $maxlengtharticle); |
|
3384
|
+ $labeltoshow .= ' - '.dol_trunc($label, $maxlengtharticle); |
3385
|
3385
|
if ($outorigin && getDolGlobalString('PRODUCT_SHOW_ORIGIN_IN_COMBO')) { |
3386
|
|
- $labeltoshow .= ' (' . getCountry($outorigin, '1') . ')'; |
|
3386
|
+ $labeltoshow .= ' ('.getCountry($outorigin, '1').')'; |
3387
|
3387
|
} |
3388
|
3388
|
|
3389
|
3389
|
// Set $labltoshowhtml |
3390
|
3390
|
$labeltoshowhtml = ''; |
3391
|
3391
|
$labeltoshowhtml .= $objp->ref; |
3392
|
3392
|
if (!empty($objp->custref)) { |
3393
|
|
- $labeltoshowhtml .= ' (' . $objp->custref . ')'; |
|
3393
|
+ $labeltoshowhtml .= ' ('.$objp->custref.')'; |
3394
|
3394
|
} |
3395
|
3395
|
if (!empty($filterkey) && $filterkey != '') { |
3396
|
|
- $labeltoshowhtml = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $labeltoshowhtml, 1); |
|
3396
|
+ $labeltoshowhtml = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $labeltoshowhtml, 1); |
3397
|
3397
|
} |
3398
|
3398
|
if ($outbarcode) { |
3399
|
|
- $labeltoshowhtml .= ' (' . $outbarcode . ')'; |
|
3399
|
+ $labeltoshowhtml .= ' ('.$outbarcode.')'; |
3400
|
3400
|
} |
3401
|
|
- $labeltoshowhtml .= ' - ' . dol_trunc($label, $maxlengtharticle); |
|
3401
|
+ $labeltoshowhtml .= ' - '.dol_trunc($label, $maxlengtharticle); |
3402
|
3402
|
if ($outorigin && getDolGlobalString('PRODUCT_SHOW_ORIGIN_IN_COMBO')) { |
3403
|
|
- $labeltoshowhtml .= ' (' . getCountry($outorigin, '1') . ')'; |
|
3403
|
+ $labeltoshowhtml .= ' ('.getCountry($outorigin, '1').')'; |
3404
|
3404
|
} |
3405
|
3405
|
|
3406
|
3406
|
// Stock |
|
@@ -3408,14 +3408,14 @@ discard block |
|
|
block discarded – undo |
3408
|
3408
|
$labeltoshowhtmlstock = ''; |
3409
|
3409
|
if (isModEnabled('stock') && isset($objp->stock) && ($objp->fk_product_type == Product::TYPE_PRODUCT || getDolGlobalString('STOCK_SUPPORTS_SERVICES'))) { |
3410
|
3410
|
if ($user->hasRight('stock', 'lire')) { |
3411
|
|
- $labeltoshowstock .= ' - ' . $langs->trans("Stock") . ': ' . price(price2num($objp->stock, 'MS')); |
|
3411
|
+ $labeltoshowstock .= ' - '.$langs->trans("Stock").': '.price(price2num($objp->stock, 'MS')); |
3412
|
3412
|
|
3413
|
3413
|
if ($objp->stock > 0) { |
3414
|
3414
|
$labeltoshowhtmlstock .= ' - <span class="product_line_stock_ok">'; |
3415
|
3415
|
} elseif ($objp->stock <= 0) { |
3416
|
3416
|
$labeltoshowhtmlstock .= ' - <span class="product_line_stock_too_low">'; |
3417
|
3417
|
} |
3418
|
|
- $labeltoshowhtmlstock .= $langs->transnoentities("Stock") . ': ' . price(price2num($objp->stock, 'MS')); |
|
3418
|
+ $labeltoshowhtmlstock .= $langs->transnoentities("Stock").': '.price(price2num($objp->stock, 'MS')); |
3419
|
3419
|
$labeltoshowhtmlstock .= '</span>'; |
3420
|
3420
|
|
3421
|
3421
|
if (empty($novirtualstock) && getDolGlobalString('STOCK_SHOW_VIRTUAL_STOCK_IN_PRODUCTS_COMBO')) { // Warning, this option may slow down combo list generation |
|
@@ -3426,9 +3426,9 @@ discard block |
|
|
block discarded – undo |
3426
|
3426
|
$tmpproduct->load_virtual_stock(); |
3427
|
3427
|
$virtualstock = $tmpproduct->stock_theorique; |
3428
|
3428
|
|
3429
|
|
- $labeltoshowstock .= ' - ' . $langs->trans("VirtualStock") . ':' . $virtualstock; |
|
3429
|
+ $labeltoshowstock .= ' - '.$langs->trans("VirtualStock").':'.$virtualstock; |
3430
|
3430
|
|
3431
|
|
- $labeltoshowhtmlstock .= ' - ' . $langs->transnoentities("VirtualStock") . ':'; |
|
3431
|
+ $labeltoshowhtmlstock .= ' - '.$langs->transnoentities("VirtualStock").':'; |
3432
|
3432
|
if ($virtualstock > 0) { |
3433
|
3433
|
$labeltoshowhtmlstock .= '<span class="product_line_stock_ok">'; |
3434
|
3434
|
} elseif ($virtualstock <= 0) { |
|
@@ -3449,35 +3449,35 @@ discard block |
|
|
block discarded – undo |
3449
|
3449
|
// If we need a particular price level (from 1 to n) |
3450
|
3450
|
if (empty($hidepriceinlabel) && $price_level >= 1 && (getDolGlobalString('PRODUIT_MULTIPRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES'))) { |
3451
|
3451
|
$sql = "SELECT price, price_ttc, price_base_type, tva_tx, default_vat_code"; |
3452
|
|
- $sql .= " FROM " . $this->db->prefix() . "product_price"; |
3453
|
|
- $sql .= " WHERE fk_product = " . ((int) $objp->rowid); |
3454
|
|
- $sql .= " AND entity IN (" . getEntity('productprice') . ")"; |
3455
|
|
- $sql .= " AND price_level = " . ((int) $price_level); |
|
3452
|
+ $sql .= " FROM ".$this->db->prefix()."product_price"; |
|
3453
|
+ $sql .= " WHERE fk_product = ".((int) $objp->rowid); |
|
3454
|
+ $sql .= " AND entity IN (".getEntity('productprice').")"; |
|
3455
|
+ $sql .= " AND price_level = ".((int) $price_level); |
3456
|
3456
|
$sql .= " ORDER BY date_price DESC, rowid DESC"; // Warning DESC must be both on date_price and rowid. |
3457
|
3457
|
$sql .= " LIMIT 1"; |
3458
|
3458
|
|
3459
|
|
- dol_syslog(get_class($this) . '::constructProductListOption search price for product ' . $objp->rowid . ' AND level ' . $price_level, LOG_DEBUG); |
|
3459
|
+ dol_syslog(get_class($this).'::constructProductListOption search price for product '.$objp->rowid.' AND level '.$price_level, LOG_DEBUG); |
3460
|
3460
|
$result2 = $this->db->query($sql); |
3461
|
3461
|
if ($result2) { |
3462
|
3462
|
$objp2 = $this->db->fetch_object($result2); |
3463
|
3463
|
if ($objp2) { |
3464
|
3464
|
$found = 1; |
3465
|
3465
|
if ($objp2->price_base_type == 'HT') { |
3466
|
|
- $labeltoshowprice .= ' - ' . price($objp2->price, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("HT"); |
3467
|
|
- $labeltoshowhtmlprice .= ' - ' . price($objp2->price, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("HT"); |
|
3466
|
+ $labeltoshowprice .= ' - '.price($objp2->price, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("HT"); |
|
3467
|
+ $labeltoshowhtmlprice .= ' - '.price($objp2->price, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("HT"); |
3468
|
3468
|
} else { |
3469
|
|
- $labeltoshowprice .= ' - ' . price($objp2->price_ttc, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("TTC"); |
3470
|
|
- $labeltoshowhtmlprice .= ' - ' . price($objp2->price_ttc, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("TTC"); |
|
3469
|
+ $labeltoshowprice .= ' - '.price($objp2->price_ttc, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("TTC"); |
|
3470
|
+ $labeltoshowhtmlprice .= ' - '.price($objp2->price_ttc, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("TTC"); |
3471
|
3471
|
} |
3472
|
3472
|
$outprice_ht = price($objp2->price); |
3473
|
3473
|
$outprice_ttc = price($objp2->price_ttc); |
3474
|
3474
|
$outpricebasetype = $objp2->price_base_type; |
3475
|
3475
|
if (getDolGlobalString('PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL')) { // using this option is a bug. kept for backward compatibility |
3476
|
|
- $outtva_tx = $objp2->tva_tx; // We use the vat rate on line of multiprice |
3477
|
|
- $outdefault_vat_code = $objp2->default_vat_code; // We use the vat code on line of multiprice |
|
3476
|
+ $outtva_tx = $objp2->tva_tx; // We use the vat rate on line of multiprice |
|
3477
|
+ $outdefault_vat_code = $objp2->default_vat_code; // We use the vat code on line of multiprice |
3478
|
3478
|
} else { |
3479
|
|
- $outtva_tx = $objp->tva_tx; // We use the vat rate of product, not the one on line of multiprice |
3480
|
|
- $outdefault_vat_code = $objp->default_vat_code; // We use the vat code or product, not the one on line of multiprice |
|
3479
|
+ $outtva_tx = $objp->tva_tx; // We use the vat rate of product, not the one on line of multiprice |
|
3480
|
+ $outdefault_vat_code = $objp->default_vat_code; // We use the vat code or product, not the one on line of multiprice |
3481
|
3481
|
} |
3482
|
3482
|
} |
3483
|
3483
|
} else { |
|
@@ -3491,13 +3491,13 @@ discard block |
|
|
block discarded – undo |
3491
|
3491
|
$outqty = $objp->quantity; |
3492
|
3492
|
$outdiscount = $objp->remise_percent; |
3493
|
3493
|
if ($objp->quantity == 1) { |
3494
|
|
- $labeltoshowprice .= ' - ' . price($objp->unitprice, 1, $langs, 0, 0, -1, $conf->currency) . "/"; |
3495
|
|
- $labeltoshowhtmlprice .= ' - ' . price($objp->unitprice, 0, $langs, 0, 0, -1, $conf->currency) . "/"; |
|
3494
|
+ $labeltoshowprice .= ' - '.price($objp->unitprice, 1, $langs, 0, 0, -1, $conf->currency)."/"; |
|
3495
|
+ $labeltoshowhtmlprice .= ' - '.price($objp->unitprice, 0, $langs, 0, 0, -1, $conf->currency)."/"; |
3496
|
3496
|
$labeltoshowprice .= $langs->trans("Unit"); // Do not use strtolower because it breaks utf8 encoding |
3497
|
3497
|
$labeltoshowhtmlprice .= $langs->transnoentities("Unit"); |
3498
|
3498
|
} else { |
3499
|
|
- $labeltoshowprice .= ' - ' . price($objp->price, 1, $langs, 0, 0, -1, $conf->currency) . "/" . $objp->quantity; |
3500
|
|
- $labeltoshowhtmlprice .= ' - ' . price($objp->price, 0, $langs, 0, 0, -1, $conf->currency) . "/" . $objp->quantity; |
|
3499
|
+ $labeltoshowprice .= ' - '.price($objp->price, 1, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity; |
|
3500
|
+ $labeltoshowhtmlprice .= ' - '.price($objp->price, 0, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity; |
3501
|
3501
|
$labeltoshowprice .= $langs->trans("Units"); // Do not use strtolower because it breaks utf8 encoding |
3502
|
3502
|
$labeltoshowhtmlprice .= $langs->transnoentities("Units"); |
3503
|
3503
|
} |
|
@@ -3505,16 +3505,16 @@ discard block |
|
|
block discarded – undo |
3505
|
3505
|
$outprice_ht = price($objp->unitprice); |
3506
|
3506
|
$outprice_ttc = price($objp->unitprice * (1 + ($objp->tva_tx / 100))); |
3507
|
3507
|
$outpricebasetype = $objp->price_base_type; |
3508
|
|
- $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 |
3509
|
|
- $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 |
|
3508
|
+ $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 |
|
3509
|
+ $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 |
3510
|
3510
|
} |
3511
|
3511
|
if (empty($hidepriceinlabel) && !empty($objp->quantity) && $objp->quantity >= 1) { |
3512
|
|
- $labeltoshowprice .= " (" . price($objp->unitprice, 1, $langs, 0, 0, -1, $conf->currency) . "/" . $langs->trans("Unit") . ")"; // Do not use strtolower because it breaks utf8 encoding |
3513
|
|
- $labeltoshowhtmlprice .= " (" . price($objp->unitprice, 0, $langs, 0, 0, -1, $conf->currency) . "/" . $langs->transnoentities("Unit") . ")"; // Do not use strtolower because it breaks utf8 encoding |
|
3512
|
+ $labeltoshowprice .= " (".price($objp->unitprice, 1, $langs, 0, 0, -1, $conf->currency)."/".$langs->trans("Unit").")"; // Do not use strtolower because it breaks utf8 encoding |
|
3513
|
+ $labeltoshowhtmlprice .= " (".price($objp->unitprice, 0, $langs, 0, 0, -1, $conf->currency)."/".$langs->transnoentities("Unit").")"; // Do not use strtolower because it breaks utf8 encoding |
3514
|
3514
|
} |
3515
|
3515
|
if (empty($hidepriceinlabel) && !empty($objp->remise_percent) && $objp->remise_percent >= 1) { |
3516
|
|
- $labeltoshowprice .= " - " . $langs->trans("Discount") . " : " . vatrate($objp->remise_percent) . ' %'; |
3517
|
|
- $labeltoshowhtmlprice .= " - " . $langs->transnoentities("Discount") . " : " . vatrate($objp->remise_percent) . ' %'; |
|
3516
|
+ $labeltoshowprice .= " - ".$langs->trans("Discount")." : ".vatrate($objp->remise_percent).' %'; |
|
3517
|
+ $labeltoshowhtmlprice .= " - ".$langs->transnoentities("Discount")." : ".vatrate($objp->remise_percent).' %'; |
3518
|
3518
|
} |
3519
|
3519
|
|
3520
|
3520
|
// Price by customer |
|
@@ -3523,11 +3523,11 @@ discard block |
|
|
block discarded – undo |
3523
|
3523
|
$found = 1; |
3524
|
3524
|
|
3525
|
3525
|
if ($objp->custprice_base_type == 'HT') { |
3526
|
|
- $labeltoshowprice .= ' - ' . price($objp->custprice, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("HT"); |
3527
|
|
- $labeltoshowhtmlprice .= ' - ' . price($objp->custprice, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("HT"); |
|
3526
|
+ $labeltoshowprice .= ' - '.price($objp->custprice, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("HT"); |
|
3527
|
+ $labeltoshowhtmlprice .= ' - '.price($objp->custprice, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("HT"); |
3528
|
3528
|
} else { |
3529
|
|
- $labeltoshowprice .= ' - ' . price($objp->custprice_ttc, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("TTC"); |
3530
|
|
- $labeltoshowhtmlprice .= ' - ' . price($objp->custprice_ttc, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("TTC"); |
|
3529
|
+ $labeltoshowprice .= ' - '.price($objp->custprice_ttc, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("TTC"); |
|
3530
|
+ $labeltoshowhtmlprice .= ' - '.price($objp->custprice_ttc, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("TTC"); |
3531
|
3531
|
} |
3532
|
3532
|
|
3533
|
3533
|
$outprice_ht = price($objp->custprice); |
|
@@ -3541,11 +3541,11 @@ discard block |
|
|
block discarded – undo |
3541
|
3541
|
// If level no defined or multiprice not found, we used the default price |
3542
|
3542
|
if (empty($hidepriceinlabel) && !$found) { |
3543
|
3543
|
if ($objp->price_base_type == 'HT') { |
3544
|
|
- $labeltoshowprice .= ' - ' . price($objp->price, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("HT"); |
3545
|
|
- $labeltoshowhtmlprice .= ' - ' . price($objp->price, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("HT"); |
|
3544
|
+ $labeltoshowprice .= ' - '.price($objp->price, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("HT"); |
|
3545
|
+ $labeltoshowhtmlprice .= ' - '.price($objp->price, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("HT"); |
3546
|
3546
|
} else { |
3547
|
|
- $labeltoshowprice .= ' - ' . price($objp->price_ttc, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("TTC"); |
3548
|
|
- $labeltoshowhtmlprice .= ' - ' . price($objp->price_ttc, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("TTC"); |
|
3547
|
+ $labeltoshowprice .= ' - '.price($objp->price_ttc, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("TTC"); |
|
3548
|
+ $labeltoshowhtmlprice .= ' - '.price($objp->price_ttc, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("TTC"); |
3549
|
3549
|
} |
3550
|
3550
|
$outprice_ht = price($objp->price); |
3551
|
3551
|
$outprice_ttc = price($objp->price_ttc); |
|
@@ -3556,14 +3556,14 @@ discard block |
|
|
block discarded – undo |
3556
|
3556
|
|
3557
|
3557
|
|
3558
|
3558
|
// Build options |
3559
|
|
- $opt = '<option value="' . $objp->rowid . '"'; |
|
3559
|
+ $opt = '<option value="'.$objp->rowid.'"'; |
3560
|
3560
|
$opt .= ($objp->rowid == $selected) ? ' selected' : ''; |
3561
|
3561
|
if (!empty($objp->price_by_qty_rowid) && $objp->price_by_qty_rowid > 0) { |
3562
|
|
- $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 . '"'; |
|
3562
|
+ $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.'"'; |
3563
|
3563
|
} |
3564
|
3564
|
if (getDolGlobalString('PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE')) { |
3565
|
|
- $opt .= ' data-labeltrans="' . $outlabel_translated . '"'; |
3566
|
|
- $opt .= ' data-desctrans="' . dol_escape_htmltag($outdesc_translated) . '"'; |
|
3565
|
+ $opt .= ' data-labeltrans="'.$outlabel_translated.'"'; |
|
3566
|
+ $opt .= ' data-desctrans="'.dol_escape_htmltag($outdesc_translated).'"'; |
3567
|
3567
|
} |
3568
|
3568
|
|
3569
|
3569
|
if ($stocktag == 1) { |
|
@@ -3658,7 +3658,7 @@ discard block |
|
|
block discarded – undo |
3658
|
3658
|
$selected_input_value = ''; |
3659
|
3659
|
if (!empty($conf->use_javascript_ajax) && getDolGlobalString('PRODUIT_USE_SEARCH_TO_SELECT')) { |
3660
|
3660
|
if ($selected > 0) { |
3661
|
|
- require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; |
|
3661
|
+ require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; |
3662
|
3662
|
$producttmpselect = new Product($this->db); |
3663
|
3663
|
$producttmpselect->fetch($selected); |
3664
|
3664
|
$selected_input_value = $producttmpselect->ref; |
|
@@ -3666,10 +3666,10 @@ discard block |
|
|
block discarded – undo |
3666
|
3666
|
} |
3667
|
3667
|
|
3668
|
3668
|
// mode=2 means suppliers products |
3669
|
|
- $urloption = ($socid > 0 ? 'socid=' . $socid . '&' : '') . 'htmlname=' . $htmlname . '&outjson=1&price_level=' . $price_level . '&type=' . $filtertype . '&mode=2&status=' . $status . '&finished=' . $finished . '&alsoproductwithnosupplierprice=' . $alsoproductwithnosupplierprice; |
3670
|
|
- print ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/product/ajax/products.php', $urloption, getDolGlobalInt('PRODUIT_USE_SEARCH_TO_SELECT'), 0, $ajaxoptions); |
|
3669
|
+ $urloption = ($socid > 0 ? 'socid='.$socid.'&' : '').'htmlname='.$htmlname.'&outjson=1&price_level='.$price_level.'&type='.$filtertype.'&mode=2&status='.$status.'&finished='.$finished.'&alsoproductwithnosupplierprice='.$alsoproductwithnosupplierprice; |
|
3670
|
+ print ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/product/ajax/products.php', $urloption, getDolGlobalInt('PRODUIT_USE_SEARCH_TO_SELECT'), 0, $ajaxoptions); |
3671
|
3671
|
|
3672
|
|
- print($hidelabel ? '' : $langs->trans("RefOrLabel") . ' : ') . '<input type="text" class="'.$morecss.'" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . ($placeholder ? ' placeholder="' . $placeholder . '"' : '') . '>'; |
|
3672
|
+ print($hidelabel ? '' : $langs->trans("RefOrLabel").' : ').'<input type="text" class="'.$morecss.'" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.($placeholder ? ' placeholder="'.$placeholder.'"' : '').'>'; |
3673
|
3673
|
} else { |
3674
|
3674
|
print $this->select_produits_fournisseurs_list($socid, $selected, $htmlname, $filtertype, $filtre, '', $status, 0, 0, $alsoproductwithnosupplierprice, $morecss, 0, $placeholder); |
3675
|
3675
|
} |
|
@@ -3727,25 +3727,25 @@ discard block |
|
|
block discarded – undo |
3727
|
3727
|
if (getDolGlobalInt('PRODUCT_USE_UNITS')) { |
3728
|
3728
|
$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"; |
3729
|
3729
|
} |
3730
|
|
- $sql .= " FROM " . $this->db->prefix() . "product as p"; |
3731
|
|
- $sql .= " LEFT JOIN " . $this->db->prefix() . "product_fournisseur_price as pfp ON ( p.rowid = pfp.fk_product AND pfp.entity IN (" . getEntity('product') . ") )"; |
|
3730
|
+ $sql .= " FROM ".$this->db->prefix()."product as p"; |
|
3731
|
+ $sql .= " LEFT JOIN ".$this->db->prefix()."product_fournisseur_price as pfp ON ( p.rowid = pfp.fk_product AND pfp.entity IN (".getEntity('product').") )"; |
3732
|
3732
|
if ($socid > 0) { |
3733
|
|
- $sql .= " AND pfp.fk_soc = " . ((int) $socid); |
|
3733
|
+ $sql .= " AND pfp.fk_soc = ".((int) $socid); |
3734
|
3734
|
} |
3735
|
|
- $sql .= " LEFT JOIN " . $this->db->prefix() . "societe as s ON pfp.fk_soc = s.rowid"; |
|
3735
|
+ $sql .= " LEFT JOIN ".$this->db->prefix()."societe as s ON pfp.fk_soc = s.rowid"; |
3736
|
3736
|
// Units |
3737
|
3737
|
if (getDolGlobalInt('PRODUCT_USE_UNITS')) { |
3738
|
|
- $sql .= " LEFT JOIN " . $this->db->prefix() . "c_units u ON u.rowid = p.fk_unit"; |
|
3738
|
+ $sql .= " LEFT JOIN ".$this->db->prefix()."c_units u ON u.rowid = p.fk_unit"; |
3739
|
3739
|
} |
3740
|
|
- $sql .= " WHERE p.entity IN (" . getEntity('product') . ")"; |
|
3740
|
+ $sql .= " WHERE p.entity IN (".getEntity('product').")"; |
3741
|
3741
|
if ($statut != -1) { |
3742
|
|
- $sql .= " AND p.tobuy = " . ((int) $statut); |
|
3742
|
+ $sql .= " AND p.tobuy = ".((int) $statut); |
3743
|
3743
|
} |
3744
|
3744
|
if (strval($filtertype) != '') { |
3745
|
|
- $sql .= " AND p.fk_product_type = " . ((int) $filtertype); |
|
3745
|
+ $sql .= " AND p.fk_product_type = ".((int) $filtertype); |
3746
|
3746
|
} |
3747
|
3747
|
if (!empty($filtre)) { |
3748
|
|
- $sql .= " " . $filtre; |
|
3748
|
+ $sql .= " ".$filtre; |
3749
|
3749
|
} |
3750
|
3750
|
// Add where from hooks |
3751
|
3751
|
$parameters = array(); |
|
@@ -3765,9 +3765,9 @@ discard block |
|
|
block discarded – undo |
3765
|
3765
|
if ($i > 0) { |
3766
|
3766
|
$sql .= " AND "; |
3767
|
3767
|
} |
3768
|
|
- $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) . "%'"; |
|
3768
|
+ $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)."%'"; |
3769
|
3769
|
if (getDolGlobalString('PRODUIT_FOURN_TEXTS')) { |
3770
|
|
- $sql .= " OR pfp.desc_fourn LIKE '" . $this->db->escape($prefix . $crit) . "%'"; |
|
3770
|
+ $sql .= " OR pfp.desc_fourn LIKE '".$this->db->escape($prefix.$crit)."%'"; |
3771
|
3771
|
} |
3772
|
3772
|
$sql .= ")"; |
3773
|
3773
|
$i++; |
|
@@ -3776,8 +3776,8 @@ discard block |
|
|
block discarded – undo |
3776
|
3776
|
$sql .= ")"; |
3777
|
3777
|
} |
3778
|
3778
|
if (isModEnabled('barcode')) { |
3779
|
|
- $sql .= " OR p.barcode LIKE '" . $this->db->escape($prefix . $filterkey) . "%'"; |
3780
|
|
- $sql .= " OR pfp.barcode LIKE '" . $this->db->escape($prefix . $filterkey) . "%'"; |
|
3779
|
+ $sql .= " OR p.barcode LIKE '".$this->db->escape($prefix.$filterkey)."%'"; |
|
3780
|
+ $sql .= " OR pfp.barcode LIKE '".$this->db->escape($prefix.$filterkey)."%'"; |
3781
|
3781
|
} |
3782
|
3782
|
$sql .= ')'; |
3783
|
3783
|
} |
|
@@ -3786,20 +3786,20 @@ discard block |
|
|
block discarded – undo |
3786
|
3786
|
|
3787
|
3787
|
// Build output string |
3788
|
3788
|
|
3789
|
|
- dol_syslog(get_class($this) . "::select_produits_fournisseurs_list", LOG_DEBUG); |
|
3789
|
+ dol_syslog(get_class($this)."::select_produits_fournisseurs_list", LOG_DEBUG); |
3790
|
3790
|
$result = $this->db->query($sql); |
3791
|
3791
|
if ($result) { |
3792
|
|
- require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php'; |
3793
|
|
- require_once DOL_DOCUMENT_ROOT . '/core/lib/product.lib.php'; |
|
3792
|
+ require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php'; |
|
3793
|
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php'; |
3794
|
3794
|
|
3795
|
3795
|
$num = $this->db->num_rows($result); |
3796
|
3796
|
|
3797
|
3797
|
//$out.='<select class="flat" id="select'.$htmlname.'" name="'.$htmlname.'">'; // remove select to have id same with combo and ajax |
3798
|
|
- $out .= '<select class="flat ' . ($morecss ? ' ' . $morecss : '') . '" id="' . $htmlname . '" name="' . $htmlname . '">'; |
|
3798
|
+ $out .= '<select class="flat '.($morecss ? ' '.$morecss : '').'" id="'.$htmlname.'" name="'.$htmlname.'">'; |
3799
|
3799
|
if (!$selected) { |
3800
|
|
- $out .= '<option value="-1" selected>' . ($placeholder ? $placeholder : ' ') . '</option>'; |
|
3800
|
+ $out .= '<option value="-1" selected>'.($placeholder ? $placeholder : ' ').'</option>'; |
3801
|
3801
|
} else { |
3802
|
|
- $out .= '<option value="-1">' . ($placeholder ? $placeholder : ' ') . '</option>'; |
|
3802
|
+ $out .= '<option value="-1">'.($placeholder ? $placeholder : ' ').'</option>'; |
3803
|
3803
|
} |
3804
|
3804
|
|
3805
|
3805
|
$i = 0; |
|
@@ -3814,7 +3814,7 @@ discard block |
|
|
block discarded – undo |
3814
|
3814
|
|
3815
|
3815
|
$outkey = $objp->idprodfournprice; // id in table of price |
3816
|
3816
|
if (!$outkey && $alsoproductwithnosupplierprice) { |
3817
|
|
- $outkey = 'idprod_' . $objp->rowid; // id of product |
|
3817
|
+ $outkey = 'idprod_'.$objp->rowid; // id of product |
3818
|
3818
|
} |
3819
|
3819
|
|
3820
|
3820
|
$outref = $objp->ref; |
|
@@ -3829,23 +3829,23 @@ discard block |
|
|
block discarded – undo |
3829
|
3829
|
$outvalUnits = ''; |
3830
|
3830
|
if (getDolGlobalInt('PRODUCT_USE_UNITS')) { |
3831
|
3831
|
if (!empty($objp->unit_short)) { |
3832
|
|
- $outvalUnits .= ' - ' . $objp->unit_short; |
|
3832
|
+ $outvalUnits .= ' - '.$objp->unit_short; |
3833
|
3833
|
} |
3834
|
3834
|
if (!empty($objp->weight) && $objp->weight_units !== null) { |
3835
|
3835
|
$unitToShow = showDimensionInBestUnit($objp->weight, $objp->weight_units, 'weight', $langs); |
3836
|
|
- $outvalUnits .= ' - ' . $unitToShow; |
|
3836
|
+ $outvalUnits .= ' - '.$unitToShow; |
3837
|
3837
|
} |
3838
|
3838
|
if ((!empty($objp->length) || !empty($objp->width) || !empty($objp->height)) && $objp->length_units !== null) { |
3839
|
|
- $unitToShow = $objp->length . ' x ' . $objp->width . ' x ' . $objp->height . ' ' . measuringUnitString(0, 'size', $objp->length_units); |
3840
|
|
- $outvalUnits .= ' - ' . $unitToShow; |
|
3839
|
+ $unitToShow = $objp->length.' x '.$objp->width.' x '.$objp->height.' '.measuringUnitString(0, 'size', $objp->length_units); |
|
3840
|
+ $outvalUnits .= ' - '.$unitToShow; |
3841
|
3841
|
} |
3842
|
3842
|
if (!empty($objp->surface) && $objp->surface_units !== null) { |
3843
|
3843
|
$unitToShow = showDimensionInBestUnit($objp->surface, $objp->surface_units, 'surface', $langs); |
3844
|
|
- $outvalUnits .= ' - ' . $unitToShow; |
|
3844
|
+ $outvalUnits .= ' - '.$unitToShow; |
3845
|
3845
|
} |
3846
|
3846
|
if (!empty($objp->volume) && $objp->volume_units !== null) { |
3847
|
3847
|
$unitToShow = showDimensionInBestUnit($objp->volume, $objp->volume_units, 'volume', $langs); |
3848
|
|
- $outvalUnits .= ' - ' . $unitToShow; |
|
3848
|
+ $outvalUnits .= ' - '.$unitToShow; |
3849
|
3849
|
} |
3850
|
3850
|
if ($outdurationvalue && $outdurationunit) { |
3851
|
3851
|
$da = array( |
|
@@ -3856,22 +3856,22 @@ discard block |
|
|
block discarded – undo |
3856
|
3856
|
'y' => $langs->trans('Year') |
3857
|
3857
|
); |
3858
|
3858
|
if (isset($da[$outdurationunit])) { |
3859
|
|
- $outvalUnits .= ' - ' . $outdurationvalue . ' ' . $langs->transnoentities($da[$outdurationunit] . ($outdurationvalue > 1 ? 's' : '')); |
|
3859
|
+ $outvalUnits .= ' - '.$outdurationvalue.' '.$langs->transnoentities($da[$outdurationunit].($outdurationvalue > 1 ? 's' : '')); |
3860
|
3860
|
} |
3861
|
3861
|
} |
3862
|
3862
|
} |
3863
|
3863
|
|
3864
|
3864
|
$objRef = $objp->ref; |
3865
|
3865
|
if ($filterkey && $filterkey != '') { |
3866
|
|
- $objRef = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $objRef, 1); |
|
3866
|
+ $objRef = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $objRef, 1); |
3867
|
3867
|
} |
3868
|
3868
|
$objRefFourn = $objp->ref_fourn; |
3869
|
3869
|
if ($filterkey && $filterkey != '') { |
3870
|
|
- $objRefFourn = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $objRefFourn, 1); |
|
3870
|
+ $objRefFourn = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $objRefFourn, 1); |
3871
|
3871
|
} |
3872
|
3872
|
$label = $objp->label; |
3873
|
3873
|
if ($filterkey && $filterkey != '') { |
3874
|
|
- $label = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $label, 1); |
|
3874
|
+ $label = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $label, 1); |
3875
|
3875
|
} |
3876
|
3876
|
|
3877
|
3877
|
switch ($objp->fk_product_type) { |
|
@@ -3894,21 +3894,21 @@ discard block |
|
|
block discarded – undo |
3894
|
3894
|
|
3895
|
3895
|
$optlabel .= $objp->ref; |
3896
|
3896
|
if (!empty($objp->idprodfournprice) && ($objp->ref != $objp->ref_fourn)) { |
3897
|
|
- $optlabel .= ' <span class="opacitymedium">(' . $objp->ref_fourn . ')</span>'; |
|
3897
|
+ $optlabel .= ' <span class="opacitymedium">('.$objp->ref_fourn.')</span>'; |
3898
|
3898
|
} |
3899
|
3899
|
if (isModEnabled('barcode') && !empty($objp->barcode)) { |
3900
|
|
- $optlabel .= ' (' . $outbarcode . ')'; |
|
3900
|
+ $optlabel .= ' ('.$outbarcode.')'; |
3901
|
3901
|
} |
3902
|
|
- $optlabel .= ' - ' . dol_trunc($label, $maxlengtharticle); |
|
3902
|
+ $optlabel .= ' - '.dol_trunc($label, $maxlengtharticle); |
3903
|
3903
|
|
3904
|
3904
|
$outvallabel = $objRef; |
3905
|
3905
|
if (!empty($objp->idprodfournprice) && ($objp->ref != $objp->ref_fourn)) { |
3906
|
|
- $outvallabel .= ' (' . $objRefFourn . ')'; |
|
3906
|
+ $outvallabel .= ' ('.$objRefFourn.')'; |
3907
|
3907
|
} |
3908
|
3908
|
if (isModEnabled('barcode') && !empty($objp->barcode)) { |
3909
|
|
- $outvallabel .= ' (' . $outbarcode . ')'; |
|
3909
|
+ $outvallabel .= ' ('.$outbarcode.')'; |
3910
|
3910
|
} |
3911
|
|
- $outvallabel .= ' - ' . dol_trunc($label, $maxlengtharticle); |
|
3911
|
+ $outvallabel .= ' - '.dol_trunc($label, $maxlengtharticle); |
3912
|
3912
|
|
3913
|
3913
|
// Units |
3914
|
3914
|
$optlabel .= $outvalUnits; |
|
@@ -3925,7 +3925,7 @@ discard block |
|
|
block discarded – undo |
3925
|
3925
|
$prod_supplier->fourn_tva_tx = $objp->tva_tx; |
3926
|
3926
|
$prod_supplier->fk_supplier_price_expression = $objp->fk_supplier_price_expression; |
3927
|
3927
|
|
3928
|
|
- require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php'; |
|
3928
|
+ require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php'; |
3929
|
3929
|
$priceparser = new PriceParser($this->db); |
3930
|
3930
|
$price_result = $priceparser->parseProductSupplier($prod_supplier); |
3931
|
3931
|
if ($price_result >= 0) { |
|
@@ -3936,57 +3936,57 @@ discard block |
|
|
block discarded – undo |
3936
|
3936
|
} |
3937
|
3937
|
} |
3938
|
3938
|
if ($objp->quantity == 1) { |
3939
|
|
- $optlabel .= ' - ' . price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency) . "/"; |
3940
|
|
- $outvallabel .= ' - ' . price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 0, $langs, 0, 0, -1, $conf->currency) . "/"; |
|
3939
|
+ $optlabel .= ' - '.price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency)."/"; |
|
3940
|
+ $outvallabel .= ' - '.price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 0, $langs, 0, 0, -1, $conf->currency)."/"; |
3941
|
3941
|
$optlabel .= $langs->trans("Unit"); // Do not use strtolower because it breaks utf8 encoding |
3942
|
3942
|
$outvallabel .= $langs->transnoentities("Unit"); |
3943
|
3943
|
} else { |
3944
|
|
- $optlabel .= ' - ' . price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency) . "/" . $objp->quantity; |
3945
|
|
- $outvallabel .= ' - ' . price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 0, $langs, 0, 0, -1, $conf->currency) . "/" . $objp->quantity; |
3946
|
|
- $optlabel .= ' ' . $langs->trans("Units"); // Do not use strtolower because it breaks utf8 encoding |
3947
|
|
- $outvallabel .= ' ' . $langs->transnoentities("Units"); |
|
3944
|
+ $optlabel .= ' - '.price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity; |
|
3945
|
+ $outvallabel .= ' - '.price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 0, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity; |
|
3946
|
+ $optlabel .= ' '.$langs->trans("Units"); // Do not use strtolower because it breaks utf8 encoding |
|
3947
|
+ $outvallabel .= ' '.$langs->transnoentities("Units"); |
3948
|
3948
|
} |
3949
|
3949
|
|
3950
|
3950
|
if ($objp->quantity > 1) { |
3951
|
|
- $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 |
3952
|
|
- $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 |
|
3951
|
+ $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 |
|
3952
|
+ $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 |
3953
|
3953
|
} |
3954
|
3954
|
if ($objp->remise_percent >= 1) { |
3955
|
|
- $optlabel .= " - " . $langs->trans("Discount") . " : " . vatrate($objp->remise_percent) . ' %'; |
3956
|
|
- $outvallabel .= " - " . $langs->transnoentities("Discount") . " : " . vatrate($objp->remise_percent) . ' %'; |
|
3955
|
+ $optlabel .= " - ".$langs->trans("Discount")." : ".vatrate($objp->remise_percent).' %'; |
|
3956
|
+ $outvallabel .= " - ".$langs->transnoentities("Discount")." : ".vatrate($objp->remise_percent).' %'; |
3957
|
3957
|
} |
3958
|
3958
|
if ($objp->duration) { |
3959
|
|
- $optlabel .= " - " . $objp->duration; |
3960
|
|
- $outvallabel .= " - " . $objp->duration; |
|
3959
|
+ $optlabel .= " - ".$objp->duration; |
|
3960
|
+ $outvallabel .= " - ".$objp->duration; |
3961
|
3961
|
} |
3962
|
3962
|
if (!$socid) { |
3963
|
|
- $optlabel .= " - " . dol_trunc($objp->name, 8); |
3964
|
|
- $outvallabel .= " - " . dol_trunc($objp->name, 8); |
|
3963
|
+ $optlabel .= " - ".dol_trunc($objp->name, 8); |
|
3964
|
+ $outvallabel .= " - ".dol_trunc($objp->name, 8); |
3965
|
3965
|
} |
3966
|
3966
|
if ($objp->supplier_reputation) { |
3967
|
3967
|
//TODO dictionary |
3968
|
3968
|
$reputations = array('' => $langs->trans('Standard'), 'FAVORITE' => $langs->trans('Favorite'), 'NOTTHGOOD' => $langs->trans('NotTheGoodQualitySupplier'), 'DONOTORDER' => $langs->trans('DoNotOrderThisProductToThisSupplier')); |
3969
|
3969
|
|
3970
|
|
- $optlabel .= " - " . $reputations[$objp->supplier_reputation]; |
3971
|
|
- $outvallabel .= " - " . $reputations[$objp->supplier_reputation]; |
|
3970
|
+ $optlabel .= " - ".$reputations[$objp->supplier_reputation]; |
|
3971
|
+ $outvallabel .= " - ".$reputations[$objp->supplier_reputation]; |
3972
|
3972
|
} |
3973
|
3973
|
} else { |
3974
|
|
- $optlabel .= " - <span class='opacitymedium'>" . $langs->trans("NoPriceDefinedForThisSupplier") . '</span>'; |
3975
|
|
- $outvallabel .= ' - ' . $langs->transnoentities("NoPriceDefinedForThisSupplier"); |
|
3974
|
+ $optlabel .= " - <span class='opacitymedium'>".$langs->trans("NoPriceDefinedForThisSupplier").'</span>'; |
|
3975
|
+ $outvallabel .= ' - '.$langs->transnoentities("NoPriceDefinedForThisSupplier"); |
3976
|
3976
|
} |
3977
|
3977
|
|
3978
|
3978
|
if (isModEnabled('stock') && $showstockinlist && isset($objp->stock) && ($objp->fk_product_type == Product::TYPE_PRODUCT || getDolGlobalString('STOCK_SUPPORTS_SERVICES'))) { |
3979
|
3979
|
$novirtualstock = ($showstockinlist == 2); |
3980
|
3980
|
|
3981
|
3981
|
if ($user->hasRight('stock', 'lire')) { |
3982
|
|
- $outvallabel .= ' - ' . $langs->trans("Stock") . ': ' . price(price2num($objp->stock, 'MS')); |
|
3982
|
+ $outvallabel .= ' - '.$langs->trans("Stock").': '.price(price2num($objp->stock, 'MS')); |
3983
|
3983
|
|
3984
|
3984
|
if ($objp->stock > 0) { |
3985
|
3985
|
$optlabel .= ' - <span class="product_line_stock_ok">'; |
3986
|
3986
|
} elseif ($objp->stock <= 0) { |
3987
|
3987
|
$optlabel .= ' - <span class="product_line_stock_too_low">'; |
3988
|
3988
|
} |
3989
|
|
- $optlabel .= $langs->transnoentities("Stock") . ':' . price(price2num($objp->stock, 'MS')); |
|
3989
|
+ $optlabel .= $langs->transnoentities("Stock").':'.price(price2num($objp->stock, 'MS')); |
3990
|
3990
|
$optlabel .= '</span>'; |
3991
|
3991
|
if (empty($novirtualstock) && getDolGlobalString('STOCK_SHOW_VIRTUAL_STOCK_IN_PRODUCTS_COMBO')) { // Warning, this option may slow down combo list generation |
3992
|
3992
|
$langs->load("stocks"); |
|
@@ -3996,9 +3996,9 @@ discard block |
|
|
block discarded – undo |
3996
|
3996
|
$tmpproduct->load_virtual_stock(); |
3997
|
3997
|
$virtualstock = $tmpproduct->stock_theorique; |
3998
|
3998
|
|
3999
|
|
- $outvallabel .= ' - ' . $langs->trans("VirtualStock") . ':' . $virtualstock; |
|
3999
|
+ $outvallabel .= ' - '.$langs->trans("VirtualStock").':'.$virtualstock; |
4000
|
4000
|
|
4001
|
|
- $optlabel .= ' - ' . $langs->transnoentities("VirtualStock") . ':'; |
|
4001
|
+ $optlabel .= ' - '.$langs->transnoentities("VirtualStock").':'; |
4002
|
4002
|
if ($virtualstock > 0) { |
4003
|
4003
|
$optlabel .= '<span class="product_line_stock_ok">'; |
4004
|
4004
|
} elseif ($virtualstock <= 0) { |
|
@@ -4012,7 +4012,7 @@ discard block |
|
|
block discarded – undo |
4012
|
4012
|
} |
4013
|
4013
|
} |
4014
|
4014
|
|
4015
|
|
- $optstart = '<option value="' . $outkey . '"'; |
|
4015
|
+ $optstart = '<option value="'.$outkey.'"'; |
4016
|
4016
|
if ($selected && $selected == $objp->idprodfournprice) { |
4017
|
4017
|
$optstart .= ' selected'; |
4018
|
4018
|
} |
|
@@ -4021,31 +4021,31 @@ discard block |
|
|
block discarded – undo |
4021
|
4021
|
} |
4022
|
4022
|
|
4023
|
4023
|
if (!empty($objp->idprodfournprice) && $objp->idprodfournprice > 0) { |
4024
|
|
- $optstart .= ' data-product-id="' . dol_escape_htmltag($objp->rowid) . '"'; |
4025
|
|
- $optstart .= ' data-price-id="' . dol_escape_htmltag($objp->idprodfournprice) . '"'; |
4026
|
|
- $optstart .= ' data-qty="' . dol_escape_htmltag($objp->quantity) . '"'; |
4027
|
|
- $optstart .= ' data-up="' . dol_escape_htmltag(price2num($objp->unitprice)) . '"'; |
4028
|
|
- $optstart .= ' data-up-locale="' . dol_escape_htmltag(price($objp->unitprice)) . '"'; |
4029
|
|
- $optstart .= ' data-discount="' . dol_escape_htmltag($outdiscount) . '"'; |
4030
|
|
- $optstart .= ' data-tvatx="' . dol_escape_htmltag(price2num($objp->tva_tx)) . '"'; |
4031
|
|
- $optstart .= ' data-tvatx-formated="' . dol_escape_htmltag(price($objp->tva_tx, 0, $langs, 1, -1, 2)) . '"'; |
4032
|
|
- $optstart .= ' data-default-vat-code="' . dol_escape_htmltag($objp->default_vat_code) . '"'; |
4033
|
|
- $optstart .= ' data-supplier-ref="' . dol_escape_htmltag($objp->ref_fourn) . '"'; |
|
4024
|
+ $optstart .= ' data-product-id="'.dol_escape_htmltag($objp->rowid).'"'; |
|
4025
|
+ $optstart .= ' data-price-id="'.dol_escape_htmltag($objp->idprodfournprice).'"'; |
|
4026
|
+ $optstart .= ' data-qty="'.dol_escape_htmltag($objp->quantity).'"'; |
|
4027
|
+ $optstart .= ' data-up="'.dol_escape_htmltag(price2num($objp->unitprice)).'"'; |
|
4028
|
+ $optstart .= ' data-up-locale="'.dol_escape_htmltag(price($objp->unitprice)).'"'; |
|
4029
|
+ $optstart .= ' data-discount="'.dol_escape_htmltag($outdiscount).'"'; |
|
4030
|
+ $optstart .= ' data-tvatx="'.dol_escape_htmltag(price2num($objp->tva_tx)).'"'; |
|
4031
|
+ $optstart .= ' data-tvatx-formated="'.dol_escape_htmltag(price($objp->tva_tx, 0, $langs, 1, -1, 2)).'"'; |
|
4032
|
+ $optstart .= ' data-default-vat-code="'.dol_escape_htmltag($objp->default_vat_code).'"'; |
|
4033
|
+ $optstart .= ' data-supplier-ref="'.dol_escape_htmltag($objp->ref_fourn).'"'; |
4034
|
4034
|
if (isModEnabled('multicurrency')) { |
4035
|
|
- $optstart .= ' data-multicurrency-code="' . dol_escape_htmltag($objp->multicurrency_code) . '"'; |
4036
|
|
- $optstart .= ' data-multicurrency-up="' . dol_escape_htmltag($objp->multicurrency_unitprice) . '"'; |
|
4035
|
+ $optstart .= ' data-multicurrency-code="'.dol_escape_htmltag($objp->multicurrency_code).'"'; |
|
4036
|
+ $optstart .= ' data-multicurrency-up="'.dol_escape_htmltag($objp->multicurrency_unitprice).'"'; |
4037
|
4037
|
} |
4038
|
4038
|
} |
4039
|
|
- $optstart .= ' data-description="' . dol_escape_htmltag($objp->description, 0, 1) . '"'; |
|
4039
|
+ $optstart .= ' data-description="'.dol_escape_htmltag($objp->description, 0, 1).'"'; |
4040
|
4040
|
|
4041
|
4041
|
$outarrayentry = array( |
4042
|
4042
|
'key' => $outkey, |
4043
|
4043
|
'value' => $outref, |
4044
|
4044
|
'label' => $outvallabel, |
4045
|
4045
|
'qty' => $outqty, |
4046
|
|
- 'price_qty_ht' => price2num($objp->fprice, 'MU'), // Keep higher resolution for price for the min qty |
4047
|
|
- 'price_unit_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price |
4048
|
|
- 'price_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price (for compatibility) |
|
4046
|
+ 'price_qty_ht' => price2num($objp->fprice, 'MU'), // Keep higher resolution for price for the min qty |
|
4047
|
+ 'price_unit_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price |
|
4048
|
+ 'price_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price (for compatibility) |
4049
|
4049
|
'tva_tx_formated' => price($objp->tva_tx, 0, $langs, 1, -1, 2), |
4050
|
4050
|
'tva_tx' => price2num($objp->tva_tx), |
4051
|
4051
|
'default_vat_code' => $objp->default_vat_code, |
|
@@ -4076,17 +4076,17 @@ discard block |
|
|
block discarded – undo |
4076
|
4076
|
// Add new entry |
4077
|
4077
|
// "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 |
4078
|
4078
|
// "label" value of json key array is used by jQuery automatically as text for combo box |
4079
|
|
- $out .= $optstart . ' data-html="' . dol_escape_htmltag($optlabel) . '">' . $optlabel . "</option>\n"; |
|
4079
|
+ $out .= $optstart.' data-html="'.dol_escape_htmltag($optlabel).'">'.$optlabel."</option>\n"; |
4080
|
4080
|
$outarraypush = array( |
4081
|
4081
|
'key' => $outkey, |
4082
|
4082
|
'value' => $outref, |
4083
|
4083
|
'label' => $outvallabel, |
4084
|
4084
|
'qty' => $outqty, |
4085
|
|
- 'price_qty_ht' => price2num($objp->fprice, 'MU'), // Keep higher resolution for price for the min qty |
|
4085
|
+ 'price_qty_ht' => price2num($objp->fprice, 'MU'), // Keep higher resolution for price for the min qty |
4086
|
4086
|
'price_qty_ht_locale' => price($objp->fprice), |
4087
|
|
- 'price_unit_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price |
|
4087
|
+ 'price_unit_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price |
4088
|
4088
|
'price_unit_ht_locale' => price($objp->unitprice), |
4089
|
|
- 'price_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price (for compatibility) |
|
4089
|
+ 'price_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price (for compatibility) |
4090
|
4090
|
'tva_tx_formated' => price($objp->tva_tx), |
4091
|
4091
|
'tva_tx' => price2num($objp->tva_tx), |
4092
|
4092
|
'default_vat_code' => $objp->default_vat_code, |
|
@@ -4119,7 +4119,7 @@ discard block |
|
|
block discarded – undo |
4119
|
4119
|
|
4120
|
4120
|
$this->db->free($result); |
4121
|
4121
|
|
4122
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
4122
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
4123
|
4123
|
$out .= ajax_combobox($htmlname); |
4124
|
4124
|
} else { |
4125
|
4125
|
dol_print_error($this->db); |
|
@@ -4151,43 +4151,43 @@ discard block |
|
|
block discarded – undo |
4151
|
4151
|
$sql = "SELECT p.rowid, p.ref, p.label, p.price, p.duration, pfp.fk_soc,"; |
4152
|
4152
|
$sql .= " pfp.ref_fourn, pfp.rowid as idprodfournprice, pfp.price as fprice, pfp.remise_percent, pfp.quantity, pfp.unitprice,"; |
4153
|
4153
|
$sql .= " pfp.fk_supplier_price_expression, pfp.fk_product, pfp.tva_tx, s.nom as name"; |
4154
|
|
- $sql .= " FROM " . $this->db->prefix() . "product as p"; |
4155
|
|
- $sql .= " LEFT JOIN " . $this->db->prefix() . "product_fournisseur_price as pfp ON p.rowid = pfp.fk_product"; |
4156
|
|
- $sql .= " LEFT JOIN " . $this->db->prefix() . "societe as s ON pfp.fk_soc = s.rowid"; |
4157
|
|
- $sql .= " WHERE pfp.entity IN (" . getEntity('productsupplierprice') . ")"; |
|
4154
|
+ $sql .= " FROM ".$this->db->prefix()."product as p"; |
|
4155
|
+ $sql .= " LEFT JOIN ".$this->db->prefix()."product_fournisseur_price as pfp ON p.rowid = pfp.fk_product"; |
|
4156
|
+ $sql .= " LEFT JOIN ".$this->db->prefix()."societe as s ON pfp.fk_soc = s.rowid"; |
|
4157
|
+ $sql .= " WHERE pfp.entity IN (".getEntity('productsupplierprice').")"; |
4158
|
4158
|
$sql .= " AND p.tobuy = 1"; |
4159
|
4159
|
$sql .= " AND s.fournisseur = 1"; |
4160
|
|
- $sql .= " AND p.rowid = " . ((int) $productid); |
|
4160
|
+ $sql .= " AND p.rowid = ".((int) $productid); |
4161
|
4161
|
if (!getDolGlobalString('PRODUCT_BEST_SUPPLIER_PRICE_PRESELECTED')) { |
4162
|
4162
|
$sql .= " ORDER BY s.nom, pfp.ref_fourn DESC"; |
4163
|
4163
|
} else { |
4164
|
4164
|
$sql .= " ORDER BY pfp.unitprice ASC"; |
4165
|
4165
|
} |
4166
|
4166
|
|
4167
|
|
- dol_syslog(get_class($this) . "::select_product_fourn_price", LOG_DEBUG); |
|
4167
|
+ dol_syslog(get_class($this)."::select_product_fourn_price", LOG_DEBUG); |
4168
|
4168
|
$result = $this->db->query($sql); |
4169
|
4169
|
|
4170
|
4170
|
if ($result) { |
4171
|
4171
|
$num = $this->db->num_rows($result); |
4172
|
4172
|
|
4173
|
|
- $form = '<select class="flat" id="select_' . $htmlname . '" name="' . $htmlname . '">'; |
|
4173
|
+ $form = '<select class="flat" id="select_'.$htmlname.'" name="'.$htmlname.'">'; |
4174
|
4174
|
|
4175
|
4175
|
if (!$num) { |
4176
|
|
- $form .= '<option value="0">-- ' . $langs->trans("NoSupplierPriceDefinedForThisProduct") . ' --</option>'; |
|
4176
|
+ $form .= '<option value="0">-- '.$langs->trans("NoSupplierPriceDefinedForThisProduct").' --</option>'; |
4177
|
4177
|
} else { |
4178
|
|
- require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php'; |
|
4178
|
+ require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php'; |
4179
|
4179
|
$form .= '<option value="0"> </option>'; |
4180
|
4180
|
|
4181
|
4181
|
$i = 0; |
4182
|
4182
|
while ($i < $num) { |
4183
|
4183
|
$objp = $this->db->fetch_object($result); |
4184
|
4184
|
|
4185
|
|
- $opt = '<option value="' . $objp->idprodfournprice . '"'; |
|
4185
|
+ $opt = '<option value="'.$objp->idprodfournprice.'"'; |
4186
|
4186
|
//if there is only one supplier, preselect it |
4187
|
4187
|
if ($num == 1 || ($selected_supplier > 0 && $objp->fk_soc == $selected_supplier) || ($i == 0 && getDolGlobalString('PRODUCT_BEST_SUPPLIER_PRICE_PRESELECTED'))) { |
4188
|
4188
|
$opt .= ' selected'; |
4189
|
4189
|
} |
4190
|
|
- $opt .= '>' . $objp->name . ' - ' . $objp->ref_fourn . ' - '; |
|
4190
|
+ $opt .= '>'.$objp->name.' - '.$objp->ref_fourn.' - '; |
4191
|
4191
|
|
4192
|
4192
|
if (isModEnabled('dynamicprices') && !empty($objp->fk_supplier_price_expression)) { |
4193
|
4193
|
$prod_supplier = new ProductFournisseur($this->db); |
|
@@ -4197,7 +4197,7 @@ discard block |
|
|
block discarded – undo |
4197
|
4197
|
$prod_supplier->fourn_tva_tx = $objp->tva_tx; |
4198
|
4198
|
$prod_supplier->fk_supplier_price_expression = $objp->fk_supplier_price_expression; |
4199
|
4199
|
|
4200
|
|
- require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php'; |
|
4200
|
+ require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php'; |
4201
|
4201
|
$priceparser = new PriceParser($this->db); |
4202
|
4202
|
$price_result = $priceparser->parseProductSupplier($prod_supplier); |
4203
|
4203
|
if ($price_result >= 0) { |
|
@@ -4208,10 +4208,10 @@ discard block |
|
|
block discarded – undo |
4208
|
4208
|
} |
4209
|
4209
|
} |
4210
|
4210
|
if ($objp->quantity == 1) { |
4211
|
|
- $opt .= price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency) . "/"; |
|
4211
|
+ $opt .= price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency)."/"; |
4212
|
4212
|
} |
4213
|
4213
|
|
4214
|
|
- $opt .= $objp->quantity . ' '; |
|
4214
|
+ $opt .= $objp->quantity.' '; |
4215
|
4215
|
|
4216
|
4216
|
if ($objp->quantity == 1) { |
4217
|
4217
|
$opt .= $langs->trans("Unit"); |
|
@@ -4220,10 +4220,10 @@ discard block |
|
|
block discarded – undo |
4220
|
4220
|
} |
4221
|
4221
|
if ($objp->quantity > 1) { |
4222
|
4222
|
$opt .= " - "; |
4223
|
|
- $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"); |
|
4223
|
+ $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"); |
4224
|
4224
|
} |
4225
|
4225
|
if ($objp->duration) { |
4226
|
|
- $opt .= " - " . $objp->duration; |
|
4226
|
+ $opt .= " - ".$objp->duration; |
4227
|
4227
|
} |
4228
|
4228
|
$opt .= "</option>\n"; |
4229
|
4229
|
|
|
@@ -4261,8 +4261,8 @@ discard block |
|
|
block discarded – undo |
4261
|
4261
|
dol_syslog(__METHOD__, LOG_DEBUG); |
4262
|
4262
|
|
4263
|
4263
|
$sql = "SELECT rowid, code, libelle as label, deposit_percent"; |
4264
|
|
- $sql .= " FROM " . $this->db->prefix() . 'c_payment_term'; |
4265
|
|
- $sql .= " WHERE entity IN (" . getEntity('c_payment_term') . ")"; |
|
4264
|
+ $sql .= " FROM ".$this->db->prefix().'c_payment_term'; |
|
4265
|
+ $sql .= " WHERE entity IN (".getEntity('c_payment_term').")"; |
4266
|
4266
|
$sql .= " AND active > 0"; |
4267
|
4267
|
$sql .= " ORDER BY sortorder"; |
4268
|
4268
|
|
|
@@ -4274,7 +4274,7 @@ discard block |
|
|
block discarded – undo |
4274
|
4274
|
$obj = $this->db->fetch_object($resql); |
4275
|
4275
|
|
4276
|
4276
|
// Si traduction existe, on l'utilise, sinon on prend le libelle par default |
4277
|
|
- $label = ($langs->trans("PaymentConditionShort" . $obj->code) != "PaymentConditionShort" . $obj->code ? $langs->trans("PaymentConditionShort" . $obj->code) : ($obj->label != '-' ? $obj->label : '')); |
|
4277
|
+ $label = ($langs->trans("PaymentConditionShort".$obj->code) != "PaymentConditionShort".$obj->code ? $langs->trans("PaymentConditionShort".$obj->code) : ($obj->label != '-' ? $obj->label : '')); |
4278
|
4278
|
$this->cache_conditions_paiements[$obj->rowid]['code'] = $obj->code; |
4279
|
4279
|
$this->cache_conditions_paiements[$obj->rowid]['label'] = $label; |
4280
|
4280
|
$this->cache_conditions_paiements[$obj->rowid]['deposit_percent'] = $obj->deposit_percent; |
|
@@ -4302,7 +4302,7 @@ discard block |
|
|
block discarded – undo |
4302
|
4302
|
// phpcs:enable |
4303
|
4303
|
global $langs; |
4304
|
4304
|
|
4305
|
|
- $num = count($this->cache_availability); // TODO Use $conf->cache['availability'] instead of $this->cache_availability |
|
4305
|
+ $num = count($this->cache_availability); // TODO Use $conf->cache['availability'] instead of $this->cache_availability |
4306
|
4306
|
if ($num > 0) { |
4307
|
4307
|
return 0; // Cache already loaded |
4308
|
4308
|
} |
|
@@ -4312,7 +4312,7 @@ discard block |
|
|
block discarded – undo |
4312
|
4312
|
$langs->load('propal'); |
4313
|
4313
|
|
4314
|
4314
|
$sql = "SELECT rowid, code, label, position"; |
4315
|
|
- $sql .= " FROM " . $this->db->prefix() . 'c_availability'; |
|
4315
|
+ $sql .= " FROM ".$this->db->prefix().'c_availability'; |
4316
|
4316
|
$sql .= " WHERE active > 0"; |
4317
|
4317
|
|
4318
|
4318
|
$resql = $this->db->query($sql); |
|
@@ -4323,7 +4323,7 @@ discard block |
|
|
block discarded – undo |
4323
|
4323
|
$obj = $this->db->fetch_object($resql); |
4324
|
4324
|
|
4325
|
4325
|
// Si traduction existe, on l'utilise, sinon on prend le libelle par default |
4326
|
|
- $label = ($langs->trans("AvailabilityType" . $obj->code) != "AvailabilityType" . $obj->code ? $langs->trans("AvailabilityType" . $obj->code) : ($obj->label != '-' ? $obj->label : '')); |
|
4326
|
+ $label = ($langs->trans("AvailabilityType".$obj->code) != "AvailabilityType".$obj->code ? $langs->trans("AvailabilityType".$obj->code) : ($obj->label != '-' ? $obj->label : '')); |
4327
|
4327
|
$this->cache_availability[$obj->rowid]['code'] = $obj->code; |
4328
|
4328
|
$this->cache_availability[$obj->rowid]['label'] = $label; |
4329
|
4329
|
$this->cache_availability[$obj->rowid]['position'] = $obj->position; |
|
@@ -4355,17 +4355,17 @@ discard block |
|
|
block discarded – undo |
4355
|
4355
|
|
4356
|
4356
|
$this->load_cache_availability(); |
4357
|
4357
|
|
4358
|
|
- dol_syslog(__METHOD__ . " selected=" . $selected . ", htmlname=" . $htmlname, LOG_DEBUG); |
|
4358
|
+ dol_syslog(__METHOD__." selected=".$selected.", htmlname=".$htmlname, LOG_DEBUG); |
4359
|
4359
|
|
4360
|
|
- print '<select id="' . $htmlname . '" class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">'; |
|
4360
|
+ print '<select id="'.$htmlname.'" class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">'; |
4361
|
4361
|
if ($addempty) { |
4362
|
4362
|
print '<option value="0"> </option>'; |
4363
|
4363
|
} |
4364
|
4364
|
foreach ($this->cache_availability as $id => $arrayavailability) { |
4365
|
4365
|
if ($selected == $id) { |
4366
|
|
- print '<option value="' . $id . '" selected>'; |
|
4366
|
+ print '<option value="'.$id.'" selected>'; |
4367
|
4367
|
} else { |
4368
|
|
- print '<option value="' . $id . '">'; |
|
4368
|
+ print '<option value="'.$id.'">'; |
4369
|
4369
|
} |
4370
|
4370
|
print dol_escape_htmltag($arrayavailability['label']); |
4371
|
4371
|
print '</option>'; |
|
@@ -4386,13 +4386,13 @@ discard block |
|
|
block discarded – undo |
4386
|
4386
|
{ |
4387
|
4387
|
global $langs; |
4388
|
4388
|
|
4389
|
|
- $num = count($this->cache_demand_reason); // TODO Use $conf->cache['input_reason'] instead of $this->cache_demand_reason |
|
4389
|
+ $num = count($this->cache_demand_reason); // TODO Use $conf->cache['input_reason'] instead of $this->cache_demand_reason |
4390
|
4390
|
if ($num > 0) { |
4391
|
4391
|
return 0; // Cache already loaded |
4392
|
4392
|
} |
4393
|
4393
|
|
4394
|
4394
|
$sql = "SELECT rowid, code, label"; |
4395
|
|
- $sql .= " FROM " . $this->db->prefix() . 'c_input_reason'; |
|
4395
|
+ $sql .= " FROM ".$this->db->prefix().'c_input_reason'; |
4396
|
4396
|
$sql .= " WHERE active > 0"; |
4397
|
4397
|
|
4398
|
4398
|
$resql = $this->db->query($sql); |
|
@@ -4405,8 +4405,8 @@ discard block |
|
|
block discarded – undo |
4405
|
4405
|
|
4406
|
4406
|
// Si traduction existe, on l'utilise, sinon on prend le libelle par default |
4407
|
4407
|
$label = ($obj->label != '-' ? $obj->label : ''); |
4408
|
|
- if ($langs->trans("DemandReasonType" . $obj->code) != "DemandReasonType" . $obj->code) { |
4409
|
|
- $label = $langs->trans("DemandReasonType" . $obj->code); // So translation key DemandReasonTypeSRC_XXX will work |
|
4408
|
+ if ($langs->trans("DemandReasonType".$obj->code) != "DemandReasonType".$obj->code) { |
|
4409
|
+ $label = $langs->trans("DemandReasonType".$obj->code); // So translation key DemandReasonTypeSRC_XXX will work |
4410
|
4410
|
} |
4411
|
4411
|
if ($langs->trans($obj->code) != $obj->code) { |
4412
|
4412
|
$label = $langs->trans($obj->code); // So translation key SRC_XXX will work |
|
@@ -4446,9 +4446,9 @@ discard block |
|
|
block discarded – undo |
4446
|
4446
|
|
4447
|
4447
|
$this->loadCacheInputReason(); |
4448
|
4448
|
|
4449
|
|
- print '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" id="select_' . $htmlname . '" name="' . $htmlname . '">'; |
|
4449
|
+ print '<select class="flat'.($morecss ? ' '.$morecss : '').'" id="select_'.$htmlname.'" name="'.$htmlname.'">'; |
4450
|
4450
|
if ($addempty) { |
4451
|
|
- print '<option value="0"' . (empty($selected) ? ' selected' : '') . '> </option>'; |
|
4451
|
+ print '<option value="0"'.(empty($selected) ? ' selected' : '').'> </option>'; |
4452
|
4452
|
} |
4453
|
4453
|
foreach ($this->cache_demand_reason as $id => $arraydemandreason) { |
4454
|
4454
|
if ($arraydemandreason['code'] == $exclude) { |
|
@@ -4456,9 +4456,9 @@ discard block |
|
|
block discarded – undo |
4456
|
4456
|
} |
4457
|
4457
|
|
4458
|
4458
|
if ($selected && ($selected == $arraydemandreason['id'] || $selected == $arraydemandreason['code'])) { |
4459
|
|
- print '<option value="' . $arraydemandreason['id'] . '" selected>'; |
|
4459
|
+ print '<option value="'.$arraydemandreason['id'].'" selected>'; |
4460
|
4460
|
} else { |
4461
|
|
- print '<option value="' . $arraydemandreason['id'] . '">'; |
|
4461
|
+ print '<option value="'.$arraydemandreason['id'].'">'; |
4462
|
4462
|
} |
4463
|
4463
|
$label = $arraydemandreason['label']; // Translation of label was already done into the ->loadCacheInputReason |
4464
|
4464
|
print $langs->trans($label); |
|
@@ -4468,7 +4468,7 @@ discard block |
|
|
block discarded – undo |
4468
|
4468
|
if ($user->admin && empty($notooltip)) { |
4469
|
4469
|
print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); |
4470
|
4470
|
} |
4471
|
|
- print ajax_combobox('select_' . $htmlname); |
|
4471
|
+ print ajax_combobox('select_'.$htmlname); |
4472
|
4472
|
} |
4473
|
4473
|
|
4474
|
4474
|
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
@@ -4483,7 +4483,7 @@ discard block |
|
|
block discarded – undo |
4483
|
4483
|
// phpcs:enable |
4484
|
4484
|
global $langs; |
4485
|
4485
|
|
4486
|
|
- $num = count($this->cache_types_paiements); // TODO Use $conf->cache['payment_mode'] instead of $this->cache_types_paiements |
|
4486
|
+ $num = count($this->cache_types_paiements); // TODO Use $conf->cache['payment_mode'] instead of $this->cache_types_paiements |
4487
|
4487
|
if ($num > 0) { |
4488
|
4488
|
return $num; // Cache already loaded |
4489
|
4489
|
} |
|
@@ -4493,8 +4493,8 @@ discard block |
|
|
block discarded – undo |
4493
|
4493
|
$this->cache_types_paiements = array(); |
4494
|
4494
|
|
4495
|
4495
|
$sql = "SELECT id, code, libelle as label, type, active"; |
4496
|
|
- $sql .= " FROM " . $this->db->prefix() . "c_paiement"; |
4497
|
|
- $sql .= " WHERE entity IN (" . getEntity('c_paiement') . ")"; |
|
4496
|
+ $sql .= " FROM ".$this->db->prefix()."c_paiement"; |
|
4497
|
+ $sql .= " WHERE entity IN (".getEntity('c_paiement').")"; |
4498
|
4498
|
|
4499
|
4499
|
$resql = $this->db->query($sql); |
4500
|
4500
|
if ($resql) { |
|
@@ -4504,7 +4504,7 @@ discard block |
|
|
block discarded – undo |
4504
|
4504
|
$obj = $this->db->fetch_object($resql); |
4505
|
4505
|
|
4506
|
4506
|
// Si traduction existe, on l'utilise, sinon on prend le libelle par default |
4507
|
|
- $label = ($langs->transnoentitiesnoconv("PaymentTypeShort" . $obj->code) != "PaymentTypeShort" . $obj->code ? $langs->transnoentitiesnoconv("PaymentTypeShort" . $obj->code) : ($obj->label != '-' ? $obj->label : '')); |
|
4507
|
+ $label = ($langs->transnoentitiesnoconv("PaymentTypeShort".$obj->code) != "PaymentTypeShort".$obj->code ? $langs->transnoentitiesnoconv("PaymentTypeShort".$obj->code) : ($obj->label != '-' ? $obj->label : '')); |
4508
|
4508
|
$this->cache_types_paiements[$obj->id]['id'] = $obj->id; |
4509
|
4509
|
$this->cache_types_paiements[$obj->id]['code'] = $obj->code; |
4510
|
4510
|
$this->cache_types_paiements[$obj->id]['label'] = $label; |
|
@@ -4576,17 +4576,17 @@ discard block |
|
|
block discarded – undo |
4576
|
4576
|
global $langs, $user, $conf; |
4577
|
4577
|
|
4578
|
4578
|
$out = ''; |
4579
|
|
- dol_syslog(__METHOD__ . " selected=" . $selected . ", htmlname=" . $htmlname, LOG_DEBUG); |
|
4579
|
+ dol_syslog(__METHOD__." selected=".$selected.", htmlname=".$htmlname, LOG_DEBUG); |
4580
|
4580
|
|
4581
|
4581
|
$this->load_cache_conditions_paiements(); |
4582
|
4582
|
|
4583
|
4583
|
// Set default value if not already set by caller |
4584
|
4584
|
if (empty($selected) && getDolGlobalString('MAIN_DEFAULT_PAYMENT_TERM_ID')) { |
4585
|
|
- dol_syslog(__METHOD__ . "Using deprecated option MAIN_DEFAULT_PAYMENT_TERM_ID", LOG_NOTICE); |
|
4585
|
+ dol_syslog(__METHOD__."Using deprecated option MAIN_DEFAULT_PAYMENT_TERM_ID", LOG_NOTICE); |
4586
|
4586
|
$selected = getDolGlobalString('MAIN_DEFAULT_PAYMENT_TERM_ID'); |
4587
|
4587
|
} |
4588
|
4588
|
|
4589
|
|
- $out .= '<select id="' . $htmlname . '" class="flat selectpaymentterms' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">'; |
|
4589
|
+ $out .= '<select id="'.$htmlname.'" class="flat selectpaymentterms'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">'; |
4590
|
4590
|
if ($addempty) { |
4591
|
4591
|
$out .= '<option value="0"> </option>'; |
4592
|
4592
|
} |
|
@@ -4600,9 +4600,9 @@ discard block |
|
|
block discarded – undo |
4600
|
4600
|
|
4601
|
4601
|
if ($selected == $id) { |
4602
|
4602
|
$selectedDepositPercent = $deposit_percent > 0 ? $deposit_percent : $arrayconditions['deposit_percent']; |
4603
|
|
- $out .= '<option value="' . $id . '" data-deposit_percent="' . $arrayconditions['deposit_percent'] . '" selected>'; |
|
4603
|
+ $out .= '<option value="'.$id.'" data-deposit_percent="'.$arrayconditions['deposit_percent'].'" selected>'; |
4604
|
4604
|
} else { |
4605
|
|
- $out .= '<option value="' . $id . '" data-deposit_percent="' . $arrayconditions['deposit_percent'] . '">'; |
|
4605
|
+ $out .= '<option value="'.$id.'" data-deposit_percent="'.$arrayconditions['deposit_percent'].'">'; |
4606
|
4606
|
} |
4607
|
4607
|
$label = $arrayconditions['label']; |
4608
|
4608
|
|
|
@@ -4620,21 +4620,21 @@ discard block |
|
|
block discarded – undo |
4620
|
4620
|
$out .= ajax_combobox($htmlname); |
4621
|
4621
|
|
4622
|
4622
|
if ($deposit_percent >= 0) { |
4623
|
|
- $out .= ' <span id="' . $htmlname . '_deposit_percent_container"' . (empty($selectedDepositPercent) ? ' style="display: none"' : '') . '>'; |
4624
|
|
- $out .= $langs->trans('DepositPercent') . ' : '; |
4625
|
|
- $out .= '<input id="' . $htmlname . '_deposit_percent" name="' . $htmlname . '_deposit_percent" class="maxwidth50" value="' . $deposit_percent . '" />'; |
|
4623
|
+ $out .= ' <span id="'.$htmlname.'_deposit_percent_container"'.(empty($selectedDepositPercent) ? ' style="display: none"' : '').'>'; |
|
4624
|
+ $out .= $langs->trans('DepositPercent').' : '; |
|
4625
|
+ $out .= '<input id="'.$htmlname.'_deposit_percent" name="'.$htmlname.'_deposit_percent" class="maxwidth50" value="'.$deposit_percent.'" />'; |
4626
|
4626
|
$out .= '</span>'; |
4627
|
4627
|
$out .= ' |
4628
|
|
- <script nonce="' . getNonce() . '"> |
|
4628
|
+ <script nonce="' . getNonce().'"> |
4629
|
4629
|
$(document).ready(function () { |
4630
|
|
- $("#' . $htmlname . '").change(function () { |
|
4630
|
+ $("#' . $htmlname.'").change(function () { |
4631
|
4631
|
let $selected = $(this).find("option:selected"); |
4632
|
4632
|
let depositPercent = $selected.attr("data-deposit_percent"); |
4633
|
4633
|
|
4634
|
4634
|
if (depositPercent.length > 0) { |
4635
|
|
- $("#' . $htmlname . '_deposit_percent_container").show().find("#' . $htmlname . '_deposit_percent").val(depositPercent); |
|
4635
|
+ $("#' . $htmlname.'_deposit_percent_container").show().find("#'.$htmlname.'_deposit_percent").val(depositPercent); |
4636
|
4636
|
} else { |
4637
|
|
- $("#' . $htmlname . '_deposit_percent_container").hide(); |
|
4637
|
+ $("#' . $htmlname.'_deposit_percent_container").hide(); |
4638
|
4638
|
} |
4639
|
4639
|
|
4640
|
4640
|
return true; |
|
@@ -4672,7 +4672,7 @@ discard block |
|
|
block discarded – undo |
4672
|
4672
|
|
4673
|
4673
|
$out = ''; |
4674
|
4674
|
|
4675
|
|
- dol_syslog(__METHOD__ . " " . $selected . ", " . $htmlname . ", " . $filtertype . ", " . $format, LOG_DEBUG); |
|
4675
|
+ dol_syslog(__METHOD__." ".$selected.", ".$htmlname.", ".$filtertype.", ".$format, LOG_DEBUG); |
4676
|
4676
|
|
4677
|
4677
|
$filterarray = array(); |
4678
|
4678
|
if ($filtertype == 'CRDT') { |
|
@@ -4687,11 +4687,11 @@ discard block |
|
|
block discarded – undo |
4687
|
4687
|
|
4688
|
4688
|
// Set default value if not already set by caller |
4689
|
4689
|
if (empty($selected) && getDolGlobalString('MAIN_DEFAULT_PAYMENT_TYPE_ID')) { |
4690
|
|
- dol_syslog(__METHOD__ . "Using deprecated option MAIN_DEFAULT_PAYMENT_TYPE_ID", LOG_NOTICE); |
|
4690
|
+ dol_syslog(__METHOD__."Using deprecated option MAIN_DEFAULT_PAYMENT_TYPE_ID", LOG_NOTICE); |
4691
|
4691
|
$selected = getDolGlobalString('MAIN_DEFAULT_PAYMENT_TYPE_ID'); |
4692
|
4692
|
} |
4693
|
4693
|
|
4694
|
|
- $out .= '<select id="select' . $htmlname . '" class="flat selectpaymenttypes' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">'; |
|
4694
|
+ $out .= '<select id="select'.$htmlname.'" class="flat selectpaymenttypes'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">'; |
4695
|
4695
|
if ($empty) { |
4696
|
4696
|
$out .= '<option value=""> </option>'; |
4697
|
4697
|
} |
|
@@ -4712,13 +4712,13 @@ discard block |
|
|
block discarded – undo |
4712
|
4712
|
} |
4713
|
4713
|
|
4714
|
4714
|
if ($format == 0) { |
4715
|
|
- $out .= '<option value="' . $id . '"'; |
|
4715
|
+ $out .= '<option value="'.$id.'"'; |
4716
|
4716
|
} elseif ($format == 1) { |
4717
|
|
- $out .= '<option value="' . $arraytypes['code'] . '"'; |
|
4717
|
+ $out .= '<option value="'.$arraytypes['code'].'"'; |
4718
|
4718
|
} elseif ($format == 2) { |
4719
|
|
- $out .= '<option value="' . $arraytypes['code'] . '"'; |
|
4719
|
+ $out .= '<option value="'.$arraytypes['code'].'"'; |
4720
|
4720
|
} elseif ($format == 3) { |
4721
|
|
- $out .= '<option value="' . $id . '"'; |
|
4721
|
+ $out .= '<option value="'.$id.'"'; |
4722
|
4722
|
} |
4723
|
4723
|
// Print attribute selected or not |
4724
|
4724
|
if ($format == 1 || $format == 2) { |
|
@@ -4748,7 +4748,7 @@ discard block |
|
|
block discarded – undo |
4748
|
4748
|
if ($user->admin && !$noadmininfo) { |
4749
|
4749
|
$out .= info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); |
4750
|
4750
|
} |
4751
|
|
- $out .= ajax_combobox('select' . $htmlname); |
|
4751
|
+ $out .= ajax_combobox('select'.$htmlname); |
4752
|
4752
|
|
4753
|
4753
|
if (empty($nooutput)) { |
4754
|
4754
|
print $out; |
|
@@ -4770,22 +4770,22 @@ discard block |
|
|
block discarded – undo |
4770
|
4770
|
{ |
4771
|
4771
|
global $langs; |
4772
|
4772
|
|
4773
|
|
- $return = '<select class="flat maxwidth100" id="select_' . $htmlname . '" name="' . $htmlname . '">'; |
|
4773
|
+ $return = '<select class="flat maxwidth100" id="select_'.$htmlname.'" name="'.$htmlname.'">'; |
4774
|
4774
|
$options = array( |
4775
|
4775
|
'HT' => $langs->trans("HT"), |
4776
|
4776
|
'TTC' => $langs->trans("TTC") |
4777
|
4777
|
); |
4778
|
4778
|
foreach ($options as $id => $value) { |
4779
|
4779
|
if ($selected == $id) { |
4780
|
|
- $return .= '<option value="' . $id . '" selected>' . $value; |
|
4780
|
+ $return .= '<option value="'.$id.'" selected>'.$value; |
4781
|
4781
|
} else { |
4782
|
|
- $return .= '<option value="' . $id . '">' . $value; |
|
4782
|
+ $return .= '<option value="'.$id.'">'.$value; |
4783
|
4783
|
} |
4784
|
4784
|
$return .= '</option>'; |
4785
|
4785
|
} |
4786
|
4786
|
$return .= '</select>'; |
4787
|
4787
|
if ($addjscombo) { |
4788
|
|
- $return .= ajax_combobox('select_' . $htmlname); |
|
4788
|
+ $return .= ajax_combobox('select_'.$htmlname); |
4789
|
4789
|
} |
4790
|
4790
|
|
4791
|
4791
|
return $return; |
|
@@ -4803,7 +4803,7 @@ discard block |
|
|
block discarded – undo |
4803
|
4803
|
// phpcs:enable |
4804
|
4804
|
global $langs; |
4805
|
4805
|
|
4806
|
|
- $num = count($this->cache_transport_mode); // TODO Use $conf->cache['payment_mode'] instead of $this->cache_transport_mode |
|
4806
|
+ $num = count($this->cache_transport_mode); // TODO Use $conf->cache['payment_mode'] instead of $this->cache_transport_mode |
4807
|
4807
|
if ($num > 0) { |
4808
|
4808
|
return $num; // Cache already loaded |
4809
|
4809
|
} |
|
@@ -4813,8 +4813,8 @@ discard block |
|
|
block discarded – undo |
4813
|
4813
|
$this->cache_transport_mode = array(); |
4814
|
4814
|
|
4815
|
4815
|
$sql = "SELECT rowid, code, label, active"; |
4816
|
|
- $sql .= " FROM " . $this->db->prefix() . "c_transport_mode"; |
4817
|
|
- $sql .= " WHERE entity IN (" . getEntity('c_transport_mode') . ")"; |
|
4816
|
+ $sql .= " FROM ".$this->db->prefix()."c_transport_mode"; |
|
4817
|
+ $sql .= " WHERE entity IN (".getEntity('c_transport_mode').")"; |
4818
|
4818
|
|
4819
|
4819
|
$resql = $this->db->query($sql); |
4820
|
4820
|
if ($resql) { |
|
@@ -4824,7 +4824,7 @@ discard block |
|
|
block discarded – undo |
4824
|
4824
|
$obj = $this->db->fetch_object($resql); |
4825
|
4825
|
|
4826
|
4826
|
// If traduction exist, we use it else we take the default label |
4827
|
|
- $label = ($langs->transnoentitiesnoconv("PaymentTypeShort" . $obj->code) != "PaymentTypeShort" . $obj->code ? $langs->transnoentitiesnoconv("PaymentTypeShort" . $obj->code) : ($obj->label != '-' ? $obj->label : '')); |
|
4827
|
+ $label = ($langs->transnoentitiesnoconv("PaymentTypeShort".$obj->code) != "PaymentTypeShort".$obj->code ? $langs->transnoentitiesnoconv("PaymentTypeShort".$obj->code) : ($obj->label != '-' ? $obj->label : '')); |
4828
|
4828
|
$this->cache_transport_mode[$obj->rowid]['rowid'] = $obj->rowid; |
4829
|
4829
|
$this->cache_transport_mode[$obj->rowid]['code'] = $obj->code; |
4830
|
4830
|
$this->cache_transport_mode[$obj->rowid]['label'] = $label; |
|
@@ -4858,11 +4858,11 @@ discard block |
|
|
block discarded – undo |
4858
|
4858
|
{ |
4859
|
4859
|
global $langs, $user; |
4860
|
4860
|
|
4861
|
|
- dol_syslog(__METHOD__ . " " . $selected . ", " . $htmlname . ", " . $format, LOG_DEBUG); |
|
4861
|
+ dol_syslog(__METHOD__." ".$selected.", ".$htmlname.", ".$format, LOG_DEBUG); |
4862
|
4862
|
|
4863
|
4863
|
$this->load_cache_transport_mode(); |
4864
|
4864
|
|
4865
|
|
- print '<select id="select' . $htmlname . '" class="flat selectmodetransport' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">'; |
|
4865
|
+ print '<select id="select'.$htmlname.'" class="flat selectmodetransport'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">'; |
4866
|
4866
|
if ($empty) { |
4867
|
4867
|
print '<option value=""> </option>'; |
4868
|
4868
|
} |
|
@@ -4878,13 +4878,13 @@ discard block |
|
|
block discarded – undo |
4878
|
4878
|
} |
4879
|
4879
|
|
4880
|
4880
|
if ($format == 0) { |
4881
|
|
- print '<option value="' . $id . '"'; |
|
4881
|
+ print '<option value="'.$id.'"'; |
4882
|
4882
|
} elseif ($format == 1) { |
4883
|
|
- print '<option value="' . $arraytypes['code'] . '"'; |
|
4883
|
+ print '<option value="'.$arraytypes['code'].'"'; |
4884
|
4884
|
} elseif ($format == 2) { |
4885
|
|
- print '<option value="' . $arraytypes['code'] . '"'; |
|
4885
|
+ print '<option value="'.$arraytypes['code'].'"'; |
4886
|
4886
|
} elseif ($format == 3) { |
4887
|
|
- print '<option value="' . $id . '"'; |
|
4887
|
+ print '<option value="'.$id.'"'; |
4888
|
4888
|
} |
4889
|
4889
|
// If text is selected, we compare with code, else with id |
4890
|
4890
|
if (preg_match('/[a-z]/i', $selected) && $selected == $arraytypes['code']) { |
|
@@ -4932,31 +4932,31 @@ discard block |
|
|
block discarded – undo |
4932
|
4932
|
$langs->load("deliveries"); |
4933
|
4933
|
|
4934
|
4934
|
$sql = "SELECT rowid, code, libelle as label"; |
4935
|
|
- $sql .= " FROM " . $this->db->prefix() . "c_shipment_mode"; |
|
4935
|
+ $sql .= " FROM ".$this->db->prefix()."c_shipment_mode"; |
4936
|
4936
|
$sql .= " WHERE active > 0"; |
4937
|
4937
|
if ($filtre) { |
4938
|
|
- $sql .= " AND " . $filtre; |
|
4938
|
+ $sql .= " AND ".$filtre; |
4939
|
4939
|
} |
4940
|
4940
|
$sql .= " ORDER BY libelle ASC"; |
4941
|
4941
|
|
4942
|
|
- dol_syslog(get_class($this) . "::selectShippingMode", LOG_DEBUG); |
|
4942
|
+ dol_syslog(get_class($this)."::selectShippingMode", LOG_DEBUG); |
4943
|
4943
|
$result = $this->db->query($sql); |
4944
|
4944
|
if ($result) { |
4945
|
4945
|
$num = $this->db->num_rows($result); |
4946
|
4946
|
$i = 0; |
4947
|
4947
|
if ($num) { |
4948
|
|
- print '<select id="select' . $htmlname . '" class="flat selectshippingmethod' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '"' . ($moreattrib ? ' ' . $moreattrib : '') . '>'; |
|
4948
|
+ print '<select id="select'.$htmlname.'" class="flat selectshippingmethod'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'"'.($moreattrib ? ' '.$moreattrib : '').'>'; |
4949
|
4949
|
if ($useempty == 1 || ($useempty == 2 && $num > 1)) { |
4950
|
4950
|
print '<option value="-1"> </option>'; |
4951
|
4951
|
} |
4952
|
4952
|
while ($i < $num) { |
4953
|
4953
|
$obj = $this->db->fetch_object($result); |
4954
|
4954
|
if ($selected == $obj->rowid) { |
4955
|
|
- print '<option value="' . $obj->rowid . '" selected>'; |
|
4955
|
+ print '<option value="'.$obj->rowid.'" selected>'; |
4956
|
4956
|
} else { |
4957
|
|
- print '<option value="' . $obj->rowid . '">'; |
|
4957
|
+ print '<option value="'.$obj->rowid.'">'; |
4958
|
4958
|
} |
4959
|
|
- print ($langs->trans("SendingMethod" . strtoupper($obj->code)) != "SendingMethod" . strtoupper($obj->code)) ? $langs->trans("SendingMethod" . strtoupper($obj->code)) : $obj->label; |
|
4959
|
+ print ($langs->trans("SendingMethod".strtoupper($obj->code)) != "SendingMethod".strtoupper($obj->code)) ? $langs->trans("SendingMethod".strtoupper($obj->code)) : $obj->label; |
4960
|
4960
|
print '</option>'; |
4961
|
4961
|
$i++; |
4962
|
4962
|
} |
|
@@ -4965,7 +4965,7 @@ discard block |
|
|
block discarded – undo |
4965
|
4965
|
print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); |
4966
|
4966
|
} |
4967
|
4967
|
|
4968
|
|
- print ajax_combobox('select' . $htmlname); |
|
4968
|
+ print ajax_combobox('select'.$htmlname); |
4969
|
4969
|
} else { |
4970
|
4970
|
print $langs->trans("NoShippingMethodDefined"); |
4971
|
4971
|
} |
|
@@ -4990,16 +4990,16 @@ discard block |
|
|
block discarded – undo |
4990
|
4990
|
$langs->load("deliveries"); |
4991
|
4991
|
|
4992
|
4992
|
if ($htmlname != "none") { |
4993
|
|
- print '<form method="POST" action="' . $page . '">'; |
|
4993
|
+ print '<form method="POST" action="'.$page.'">'; |
4994
|
4994
|
print '<input type="hidden" name="action" value="setshippingmethod">'; |
4995
|
|
- print '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
4995
|
+ print '<input type="hidden" name="token" value="'.newToken().'">'; |
4996
|
4996
|
$this->selectShippingMethod($selected, $htmlname, '', $addempty); |
4997
|
|
- print '<input type="submit" class="button valignmiddle" value="' . $langs->trans("Modify") . '">'; |
|
4997
|
+ print '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">'; |
4998
|
4998
|
print '</form>'; |
4999
|
4999
|
} else { |
5000
|
5000
|
if ($selected) { |
5001
|
5001
|
$code = $langs->getLabelFromKey($this->db, $selected, 'c_shipment_mode', 'rowid', 'code'); |
5002
|
|
- print $langs->trans("SendingMethod" . strtoupper($code)); |
|
5002
|
+ print $langs->trans("SendingMethod".strtoupper($code)); |
5003
|
5003
|
} else { |
5004
|
5004
|
print " "; |
5005
|
5005
|
} |
|
@@ -5022,10 +5022,10 @@ discard block |
|
|
block discarded – undo |
5022
|
5022
|
|
5023
|
5023
|
$opt = '<option value="" selected></option>'; |
5024
|
5024
|
$sql = "SELECT rowid, ref, situation_cycle_ref, situation_counter, situation_final, fk_soc"; |
5025
|
|
- $sql .= ' FROM ' . $this->db->prefix() . 'facture'; |
5026
|
|
- $sql .= ' WHERE entity IN (' . getEntity('invoice') . ')'; |
|
5025
|
+ $sql .= ' FROM '.$this->db->prefix().'facture'; |
|
5026
|
+ $sql .= ' WHERE entity IN ('.getEntity('invoice').')'; |
5027
|
5027
|
$sql .= ' AND situation_counter >= 1'; |
5028
|
|
- $sql .= ' AND fk_soc = ' . (int) $socid; |
|
5028
|
+ $sql .= ' AND fk_soc = '.(int) $socid; |
5029
|
5029
|
$sql .= ' AND type <> 2'; |
5030
|
5030
|
$sql .= ' ORDER by situation_cycle_ref, situation_counter desc'; |
5031
|
5031
|
$resql = $this->db->query($sql); |
|
@@ -5043,19 +5043,19 @@ discard block |
|
|
block discarded – undo |
5043
|
5043
|
//Not prov? |
5044
|
5044
|
if (substr($obj->ref, 1, 4) != 'PROV') { |
5045
|
5045
|
if ($selected == $obj->rowid) { |
5046
|
|
- $opt .= '<option value="' . $obj->rowid . '" selected>' . $obj->ref . '</option>'; |
|
5046
|
+ $opt .= '<option value="'.$obj->rowid.'" selected>'.$obj->ref.'</option>'; |
5047
|
5047
|
} else { |
5048
|
|
- $opt .= '<option value="' . $obj->rowid . '">' . $obj->ref . '</option>'; |
|
5048
|
+ $opt .= '<option value="'.$obj->rowid.'">'.$obj->ref.'</option>'; |
5049
|
5049
|
} |
5050
|
5050
|
} |
5051
|
5051
|
} |
5052
|
5052
|
} |
5053
|
5053
|
} |
5054
|
5054
|
} else { |
5055
|
|
- dol_syslog("Error sql=" . $sql . ", error=" . $this->error, LOG_ERR); |
|
5055
|
+ dol_syslog("Error sql=".$sql.", error=".$this->error, LOG_ERR); |
5056
|
5056
|
} |
5057
|
5057
|
if ($opt == '<option value ="" selected></option>') { |
5058
|
|
- $opt = '<option value ="0" selected>' . $langs->trans('NoSituations') . '</option>'; |
|
5058
|
+ $opt = '<option value ="0" selected>'.$langs->trans('NoSituations').'</option>'; |
5059
|
5059
|
} |
5060
|
5060
|
return $opt; |
5061
|
5061
|
} |
|
@@ -5075,12 +5075,12 @@ discard block |
|
|
block discarded – undo |
5075
|
5075
|
|
5076
|
5076
|
$langs->load('products'); |
5077
|
5077
|
|
5078
|
|
- $return = '<select class="flat" id="' . $htmlname . '" name="' . $htmlname . '">'; |
|
5078
|
+ $return = '<select class="flat" id="'.$htmlname.'" name="'.$htmlname.'">'; |
5079
|
5079
|
|
5080
|
|
- $sql = "SELECT rowid, label, code FROM " . $this->db->prefix() . "c_units"; |
|
5080
|
+ $sql = "SELECT rowid, label, code FROM ".$this->db->prefix()."c_units"; |
5081
|
5081
|
$sql .= ' WHERE active > 0'; |
5082
|
5082
|
if (!empty($unit_type)) { |
5083
|
|
- $sql .= " AND unit_type = '" . $this->db->escape($unit_type) . "'"; |
|
5083
|
+ $sql .= " AND unit_type = '".$this->db->escape($unit_type)."'"; |
5084
|
5084
|
} |
5085
|
5085
|
$sql .= " ORDER BY sortorder"; |
5086
|
5086
|
|
|
@@ -5092,14 +5092,14 @@ discard block |
|
|
block discarded – undo |
5092
|
5092
|
|
5093
|
5093
|
while ($res = $this->db->fetch_object($resql)) { |
5094
|
5094
|
$unitLabel = $res->label; |
5095
|
|
- if (!empty($langs->tab_translate['unit' . $res->code])) { // check if Translation is available before |
5096
|
|
- $unitLabel = $langs->trans('unit' . $res->code) != $res->label ? $langs->trans('unit' . $res->code) : $res->label; |
|
5095
|
+ if (!empty($langs->tab_translate['unit'.$res->code])) { // check if Translation is available before |
|
5096
|
+ $unitLabel = $langs->trans('unit'.$res->code) != $res->label ? $langs->trans('unit'.$res->code) : $res->label; |
5097
|
5097
|
} |
5098
|
5098
|
|
5099
|
5099
|
if ($selected == $res->rowid) { |
5100
|
|
- $return .= '<option value="' . $res->rowid . '" selected>' . $unitLabel . '</option>'; |
|
5100
|
+ $return .= '<option value="'.$res->rowid.'" selected>'.$unitLabel.'</option>'; |
5101
|
5101
|
} else { |
5102
|
|
- $return .= '<option value="' . $res->rowid . '">' . $unitLabel . '</option>'; |
|
5102
|
+ $return .= '<option value="'.$res->rowid.'">'.$unitLabel.'</option>'; |
5103
|
5103
|
} |
5104
|
5104
|
} |
5105
|
5105
|
$return .= '</select>'; |
|
@@ -5134,23 +5134,23 @@ discard block |
|
|
block discarded – undo |
5134
|
5134
|
$num = 0; |
5135
|
5135
|
|
5136
|
5136
|
$sql = "SELECT rowid, label, bank, clos as status, currency_code"; |
5137
|
|
- $sql .= " FROM " . $this->db->prefix() . "bank_account"; |
5138
|
|
- $sql .= " WHERE entity IN (" . getEntity('bank_account') . ")"; |
|
5137
|
+ $sql .= " FROM ".$this->db->prefix()."bank_account"; |
|
5138
|
+ $sql .= " WHERE entity IN (".getEntity('bank_account').")"; |
5139
|
5139
|
if ($status != 2) { |
5140
|
|
- $sql .= " AND clos = " . (int) $status; |
|
5140
|
+ $sql .= " AND clos = ".(int) $status; |
5141
|
5141
|
} |
5142
|
5142
|
if ($filtre) { // TODO Support USF |
5143
|
|
- $sql .= " AND " . $filtre; |
|
5143
|
+ $sql .= " AND ".$filtre; |
5144
|
5144
|
} |
5145
|
5145
|
$sql .= " ORDER BY label"; |
5146
|
5146
|
|
5147
|
|
- dol_syslog(get_class($this) . "::select_comptes", LOG_DEBUG); |
|
5147
|
+ dol_syslog(get_class($this)."::select_comptes", LOG_DEBUG); |
5148
|
5148
|
$result = $this->db->query($sql); |
5149
|
5149
|
if ($result) { |
5150
|
5150
|
$num = $this->db->num_rows($result); |
5151
|
5151
|
$i = 0; |
5152
|
5152
|
if ($num) { |
5153
|
|
- $out .= '<select id="select' . $htmlname . '" class="flat selectbankaccount' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '"' . ($moreattrib ? ' ' . $moreattrib : '') . '>'; |
|
5153
|
+ $out .= '<select id="select'.$htmlname.'" class="flat selectbankaccount'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'"'.($moreattrib ? ' '.$moreattrib : '').'>'; |
5154
|
5154
|
|
5155
|
5155
|
if (!empty($useempty) && !is_numeric($useempty)) { |
5156
|
5156
|
$out .= '<option value="-1">'.$langs->trans($useempty).'</option>'; |
|
@@ -5161,27 +5161,27 @@ discard block |
|
|
block discarded – undo |
5161
|
5161
|
while ($i < $num) { |
5162
|
5162
|
$obj = $this->db->fetch_object($result); |
5163
|
5163
|
if ($selected == $obj->rowid || ($useempty == 2 && $num == 1 && empty($selected))) { |
5164
|
|
- $out .= '<option value="' . $obj->rowid . '" data-currency-code="' . $obj->currency_code . '" selected>'; |
|
5164
|
+ $out .= '<option value="'.$obj->rowid.'" data-currency-code="'.$obj->currency_code.'" selected>'; |
5165
|
5165
|
} else { |
5166
|
|
- $out .= '<option value="' . $obj->rowid . '" data-currency-code="' . $obj->currency_code . '">'; |
|
5166
|
+ $out .= '<option value="'.$obj->rowid.'" data-currency-code="'.$obj->currency_code.'">'; |
5167
|
5167
|
} |
5168
|
5168
|
$out .= trim($obj->label); |
5169
|
5169
|
if ($showcurrency) { |
5170
|
|
- $out .= ' (' . $obj->currency_code . ')'; |
|
5170
|
+ $out .= ' ('.$obj->currency_code.')'; |
5171
|
5171
|
} |
5172
|
5172
|
if ($status == 2 && $obj->status == 1) { |
5173
|
|
- $out .= ' (' . $langs->trans("Closed") . ')'; |
|
5173
|
+ $out .= ' ('.$langs->trans("Closed").')'; |
5174
|
5174
|
} |
5175
|
5175
|
$out .= '</option>'; |
5176
|
5176
|
$i++; |
5177
|
5177
|
} |
5178
|
5178
|
$out .= "</select>"; |
5179
|
|
- $out .= ajax_combobox('select' . $htmlname); |
|
5179
|
+ $out .= ajax_combobox('select'.$htmlname); |
5180
|
5180
|
} else { |
5181
|
5181
|
if ($status == 0) { |
5182
|
|
- $out .= '<span class="opacitymedium">' . $langs->trans("NoActiveBankAccountDefined") . '</span>'; |
|
5182
|
+ $out .= '<span class="opacitymedium">'.$langs->trans("NoActiveBankAccountDefined").'</span>'; |
5183
|
5183
|
} else { |
5184
|
|
- $out .= '<span class="opacitymedium">' . $langs->trans("NoBankAccountFound") . '</span>'; |
|
5184
|
+ $out .= '<span class="opacitymedium">'.$langs->trans("NoBankAccountFound").'</span>'; |
5185
|
5185
|
} |
5186
|
5186
|
} |
5187
|
5187
|
} else { |
|
@@ -5217,23 +5217,23 @@ discard block |
|
|
block discarded – undo |
5217
|
5217
|
$num = 0; |
5218
|
5218
|
|
5219
|
5219
|
$sql = "SELECT rowid, name, fk_country, status, entity"; |
5220
|
|
- $sql .= " FROM " . $this->db->prefix() . "establishment"; |
|
5220
|
+ $sql .= " FROM ".$this->db->prefix()."establishment"; |
5221
|
5221
|
$sql .= " WHERE 1=1"; |
5222
|
5222
|
if ($status != 2) { |
5223
|
|
- $sql .= " AND status = " . (int) $status; |
|
5223
|
+ $sql .= " AND status = ".(int) $status; |
5224
|
5224
|
} |
5225
|
5225
|
if ($filtre) { // TODO Support USF |
5226
|
|
- $sql .= " AND " . $filtre; |
|
5226
|
+ $sql .= " AND ".$filtre; |
5227
|
5227
|
} |
5228
|
5228
|
$sql .= " ORDER BY name"; |
5229
|
5229
|
|
5230
|
|
- dol_syslog(get_class($this) . "::select_establishment", LOG_DEBUG); |
|
5230
|
+ dol_syslog(get_class($this)."::select_establishment", LOG_DEBUG); |
5231
|
5231
|
$result = $this->db->query($sql); |
5232
|
5232
|
if ($result) { |
5233
|
5233
|
$num = $this->db->num_rows($result); |
5234
|
5234
|
$i = 0; |
5235
|
5235
|
if ($num) { |
5236
|
|
- print '<select id="select' . $htmlname . '" class="flat selectestablishment" name="' . $htmlname . '"' . ($moreattrib ? ' ' . $moreattrib : '') . '>'; |
|
5236
|
+ print '<select id="select'.$htmlname.'" class="flat selectestablishment" name="'.$htmlname.'"'.($moreattrib ? ' '.$moreattrib : '').'>'; |
5237
|
5237
|
if ($useempty == 1 || ($useempty == 2 && $num > 1)) { |
5238
|
5238
|
print '<option value="-1"> </option>'; |
5239
|
5239
|
} |
|
@@ -5241,13 +5241,13 @@ discard block |
|
|
block discarded – undo |
5241
|
5241
|
while ($i < $num) { |
5242
|
5242
|
$obj = $this->db->fetch_object($result); |
5243
|
5243
|
if ($selected == $obj->rowid) { |
5244
|
|
- print '<option value="' . $obj->rowid . '" selected>'; |
|
5244
|
+ print '<option value="'.$obj->rowid.'" selected>'; |
5245
|
5245
|
} else { |
5246
|
|
- print '<option value="' . $obj->rowid . '">'; |
|
5246
|
+ print '<option value="'.$obj->rowid.'">'; |
5247
|
5247
|
} |
5248
|
5248
|
print trim($obj->name); |
5249
|
5249
|
if ($status == 2 && $obj->status == 1) { |
5250
|
|
- print ' (' . $langs->trans("Closed") . ')'; |
|
5250
|
+ print ' ('.$langs->trans("Closed").')'; |
5251
|
5251
|
} |
5252
|
5252
|
print '</option>'; |
5253
|
5253
|
$i++; |
|
@@ -5255,9 +5255,9 @@ discard block |
|
|
block discarded – undo |
5255
|
5255
|
print "</select>"; |
5256
|
5256
|
} else { |
5257
|
5257
|
if ($status == 0) { |
5258
|
|
- print '<span class="opacitymedium">' . $langs->trans("NoActiveEstablishmentDefined") . '</span>'; |
|
5258
|
+ print '<span class="opacitymedium">'.$langs->trans("NoActiveEstablishmentDefined").'</span>'; |
5259
|
5259
|
} else { |
5260
|
|
- print '<span class="opacitymedium">' . $langs->trans("NoEstablishmentFound") . '</span>'; |
|
5260
|
+ print '<span class="opacitymedium">'.$langs->trans("NoEstablishmentFound").'</span>'; |
5261
|
5261
|
} |
5262
|
5262
|
} |
5263
|
5263
|
|
|
@@ -5281,20 +5281,20 @@ discard block |
|
|
block discarded – undo |
5281
|
5281
|
{ |
5282
|
5282
|
global $langs; |
5283
|
5283
|
if ($htmlname != "none") { |
5284
|
|
- print '<form method="POST" action="' . $page . '">'; |
|
5284
|
+ print '<form method="POST" action="'.$page.'">'; |
5285
|
5285
|
print '<input type="hidden" name="action" value="setbankaccount">'; |
5286
|
|
- print '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
5286
|
+ print '<input type="hidden" name="token" value="'.newToken().'">'; |
5287
|
5287
|
print img_picto('', 'bank_account', 'class="pictofixedwidth"'); |
5288
|
5288
|
$nbaccountfound = $this->select_comptes($selected, $htmlname, 0, '', $addempty); |
5289
|
5289
|
if ($nbaccountfound > 0) { |
5290
|
|
- print '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">'; |
|
5290
|
+ print '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">'; |
5291
|
5291
|
} |
5292
|
5292
|
print '</form>'; |
5293
|
5293
|
} else { |
5294
|
5294
|
$langs->load('banks'); |
5295
|
5295
|
|
5296
|
5296
|
if ($selected) { |
5297
|
|
- require_once DOL_DOCUMENT_ROOT . '/compta/bank/class/account.class.php'; |
|
5297
|
+ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; |
5298
|
5298
|
$bankstatic = new Account($this->db); |
5299
|
5299
|
$result = $bankstatic->fetch($selected); |
5300
|
5300
|
if ($result) { |
|
@@ -5333,19 +5333,19 @@ discard block |
|
|
block discarded – undo |
5333
|
5333
|
global $conf, $langs; |
5334
|
5334
|
$langs->load("categories"); |
5335
|
5335
|
|
5336
|
|
- include_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; |
|
5336
|
+ include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; |
5337
|
5337
|
|
5338
|
5338
|
// For backward compatibility |
5339
|
5339
|
if (is_numeric($type)) { |
5340
|
|
- dol_syslog(__METHOD__ . ': using numeric value for parameter type is deprecated. Use string code instead.', LOG_WARNING); |
|
5340
|
+ dol_syslog(__METHOD__.': using numeric value for parameter type is deprecated. Use string code instead.', LOG_WARNING); |
5341
|
5341
|
} |
5342
|
5342
|
|
5343
|
5343
|
if ($type === Categorie::TYPE_BANK_LINE) { |
5344
|
5344
|
// TODO Move this into common category feature |
5345
|
5345
|
$cate_arbo = array(); |
5346
|
5346
|
$sql = "SELECT c.label, c.rowid"; |
5347
|
|
- $sql .= " FROM " . $this->db->prefix() . "category_bank as c"; |
5348
|
|
- $sql .= " WHERE entity = " . $conf->entity; |
|
5347
|
+ $sql .= " FROM ".$this->db->prefix()."category_bank as c"; |
|
5348
|
+ $sql .= " WHERE entity = ".$conf->entity; |
5349
|
5349
|
$sql .= " ORDER BY c.label"; |
5350
|
5350
|
$result = $this->db->query($sql); |
5351
|
5351
|
if ($result) { |
|
@@ -5371,12 +5371,12 @@ discard block |
|
|
block discarded – undo |
5371
|
5371
|
$outarrayrichhtml = array(); |
5372
|
5372
|
|
5373
|
5373
|
|
5374
|
|
- $output = '<select class="flat minwidth100' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">'; |
|
5374
|
+ $output = '<select class="flat minwidth100'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">'; |
5375
|
5375
|
if (is_array($cate_arbo)) { |
5376
|
5376
|
$num = count($cate_arbo); |
5377
|
5377
|
|
5378
|
5378
|
if (!$num) { |
5379
|
|
- $output .= '<option value="-1" disabled>' . $langs->trans("NoCategoriesDefined") . '</option>'; |
|
5379
|
+ $output .= '<option value="-1" disabled>'.$langs->trans("NoCategoriesDefined").'</option>'; |
5380
|
5380
|
} else { |
5381
|
5381
|
if ($useempty == 1 || ($useempty == 2 && $num > 1)) { |
5382
|
5382
|
$output .= '<option value="-1"> </option>'; |
|
@@ -5388,15 +5388,15 @@ discard block |
|
|
block discarded – undo |
5388
|
5388
|
$add = ''; |
5389
|
5389
|
} |
5390
|
5390
|
|
5391
|
|
- $labeltoshow = img_picto('', 'category', 'class="pictofixedwidth" style="color: #' . $cate_arbo[$key]['color'] . '"'); |
|
5391
|
+ $labeltoshow = img_picto('', 'category', 'class="pictofixedwidth" style="color: #'.$cate_arbo[$key]['color'].'"'); |
5392
|
5392
|
$labeltoshow .= dol_trunc($cate_arbo[$key]['fulllabel'], $maxlength, 'middle'); |
5393
|
5393
|
|
5394
|
5394
|
$outarray[$cate_arbo[$key]['id']] = $cate_arbo[$key]['fulllabel']; |
5395
|
5395
|
|
5396
|
5396
|
$outarrayrichhtml[$cate_arbo[$key]['id']] = $labeltoshow; |
5397
|
5397
|
|
5398
|
|
- $output .= '<option ' . $add . 'value="' . $cate_arbo[$key]['id'] . '"'; |
5399
|
|
- $output .= ' data-html="' . dol_escape_htmltag($labeltoshow) . '"'; |
|
5398
|
+ $output .= '<option '.$add.'value="'.$cate_arbo[$key]['id'].'"'; |
|
5399
|
+ $output .= ' data-html="'.dol_escape_htmltag($labeltoshow).'"'; |
5400
|
5400
|
$output .= '>'; |
5401
|
5401
|
$output .= dol_trunc($cate_arbo[$key]['fulllabel'], $maxlength, 'middle'); |
5402
|
5402
|
$output .= '</option>'; |
|
@@ -5440,7 +5440,7 @@ discard block |
|
|
block discarded – undo |
5440
|
5440
|
public function form_confirm($page, $title, $question, $action, $formquestion = array(), $selectedchoice = "", $useajax = 0, $height = 170, $width = 500) |
5441
|
5441
|
{ |
5442
|
5442
|
// phpcs:enable |
5443
|
|
- dol_syslog(__METHOD__ . ': using form_confirm is deprecated. Use formconfim instead.', LOG_WARNING); |
|
5443
|
+ dol_syslog(__METHOD__.': using form_confirm is deprecated. Use formconfim instead.', LOG_WARNING); |
5444
|
5444
|
print $this->formconfirm($page, $title, $question, $action, $formquestion, $selectedchoice, $useajax, $height, $width); |
5445
|
5445
|
} |
5446
|
5446
|
|
|
@@ -5475,7 +5475,7 @@ discard block |
|
|
block discarded – undo |
5475
|
5475
|
{ |
5476
|
5476
|
global $langs, $conf; |
5477
|
5477
|
|
5478
|
|
- $more = '<!-- formconfirm - before call, page=' . dol_escape_htmltag($page) . ' -->'; |
|
5478
|
+ $more = '<!-- formconfirm - before call, page='.dol_escape_htmltag($page).' -->'; |
5479
|
5479
|
$formconfirm = ''; |
5480
|
5480
|
$inputok = array(); |
5481
|
5481
|
$inputko = array(); |
|
@@ -5499,27 +5499,27 @@ discard block |
|
|
block discarded – undo |
5499
|
5499
|
foreach ($formquestion as $key => $input) { |
5500
|
5500
|
if (is_array($input) && !empty($input)) { |
5501
|
5501
|
if ($input['type'] == 'hidden') { |
5502
|
|
- $moreattr = (!empty($input['moreattr']) ? ' ' . $input['moreattr'] : ''); |
5503
|
|
- $morecss = (!empty($input['morecss']) ? ' ' . $input['morecss'] : ''); |
|
5502
|
+ $moreattr = (!empty($input['moreattr']) ? ' '.$input['moreattr'] : ''); |
|
5503
|
+ $morecss = (!empty($input['morecss']) ? ' '.$input['morecss'] : ''); |
5504
|
5504
|
|
5505
|
|
- $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"; |
|
5505
|
+ $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"; |
5506
|
5506
|
} |
5507
|
5507
|
} |
5508
|
5508
|
} |
5509
|
5509
|
|
5510
|
5510
|
// Now add questions |
5511
|
5511
|
$moreonecolumn = ''; |
5512
|
|
- $more .= '<div class="tagtable paddingtopbottomonly centpercent noborderspacing">' . "\n"; |
|
5512
|
+ $more .= '<div class="tagtable paddingtopbottomonly centpercent noborderspacing">'."\n"; |
5513
|
5513
|
foreach ($formquestion as $key => $input) { |
5514
|
5514
|
if (is_array($input) && !empty($input)) { |
5515
|
|
- $size = (!empty($input['size']) ? ' size="' . $input['size'] . '"' : ''); // deprecated. Use morecss instead. |
5516
|
|
- $moreattr = (!empty($input['moreattr']) ? ' ' . $input['moreattr'] : ''); |
5517
|
|
- $morecss = (!empty($input['morecss']) ? ' ' . $input['morecss'] : ''); |
|
5515
|
+ $size = (!empty($input['size']) ? ' size="'.$input['size'].'"' : ''); // deprecated. Use morecss instead. |
|
5516
|
+ $moreattr = (!empty($input['moreattr']) ? ' '.$input['moreattr'] : ''); |
|
5517
|
+ $morecss = (!empty($input['morecss']) ? ' '.$input['morecss'] : ''); |
5518
|
5518
|
|
5519
|
5519
|
if ($input['type'] == 'text') { |
5520
|
|
- $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"; |
|
5520
|
+ $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"; |
5521
|
5521
|
} elseif ($input['type'] == 'password') { |
5522
|
|
- $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"; |
|
5522
|
+ $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"; |
5523
|
5523
|
} elseif ($input['type'] == 'textarea') { |
5524
|
5524
|
/*$more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">'.$input['label'].'</div><div class="tagtd">'; |
5525
|
5525
|
$more .= '<textarea name="'.$input['name'].'" class="'.$morecss.'"'.$moreattr.'>'; |
|
@@ -5527,8 +5527,8 @@ discard block |
|
|
block discarded – undo |
5527
|
5527
|
$more .= '</textarea>'; |
5528
|
5528
|
$more .= '</div></div>'."\n";*/ |
5529
|
5529
|
$moreonecolumn .= '<div class="margintoponly">'; |
5530
|
|
- $moreonecolumn .= $input['label'] . '<br>'; |
5531
|
|
- $moreonecolumn .= '<textarea name="' . dol_escape_htmltag($input['name']) . '" id="' . dol_escape_htmltag($input['name']) . '" class="' . $morecss . '"' . $moreattr . '>'; |
|
5530
|
+ $moreonecolumn .= $input['label'].'<br>'; |
|
5531
|
+ $moreonecolumn .= '<textarea name="'.dol_escape_htmltag($input['name']).'" id="'.dol_escape_htmltag($input['name']).'" class="'.$morecss.'"'.$moreattr.'>'; |
5532
|
5532
|
$moreonecolumn .= $input['value']; |
5533
|
5533
|
$moreonecolumn .= '</textarea>'; |
5534
|
5534
|
$moreonecolumn .= '</div>'; |
|
@@ -5545,20 +5545,20 @@ discard block |
|
|
block discarded – undo |
5545
|
5545
|
$disabled = isset($input['select_disabled']) ? $input['select_disabled'] : 0; |
5546
|
5546
|
$sort = isset($input['select_sort']) ? $input['select_sort'] : ''; |
5547
|
5547
|
|
5548
|
|
- $more .= '<div class="tagtr"><div class="tagtd' . (empty($input['tdclass']) ? '' : (' ' . $input['tdclass'])) . '">'; |
|
5548
|
+ $more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">'; |
5549
|
5549
|
if (!empty($input['label'])) { |
5550
|
|
- $more .= $input['label'] . '</div><div class="tagtd left">'; |
|
5550
|
+ $more .= $input['label'].'</div><div class="tagtd left">'; |
5551
|
5551
|
} |
5552
|
5552
|
if ($input['type'] == 'select') { |
5553
|
5553
|
$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); |
5554
|
5554
|
} else { |
5555
|
5555
|
$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); |
5556
|
5556
|
} |
5557
|
|
- $more .= '</div></div>' . "\n"; |
|
5557
|
+ $more .= '</div></div>'."\n"; |
5558
|
5558
|
} elseif ($input['type'] == 'checkbox') { |
5559
|
5559
|
$more .= '<div class="tagtr">'; |
5560
|
|
- $more .= '<div class="tagtd' . (empty($input['tdclass']) ? '' : (' ' . $input['tdclass'])) . '"><label for="' . dol_escape_htmltag($input['name']) . '">' . $input['label'] . '</label></div><div class="tagtd">'; |
5561
|
|
- $more .= '<input type="checkbox" class="flat' . ($morecss ? ' ' . $morecss : '') . '" id="' . dol_escape_htmltag($input['name']) . '" name="' . dol_escape_htmltag($input['name']) . '"' . $moreattr; |
|
5560
|
+ $more .= '<div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'"><label for="'.dol_escape_htmltag($input['name']).'">'.$input['label'].'</label></div><div class="tagtd">'; |
|
5561
|
+ $more .= '<input type="checkbox" class="flat'.($morecss ? ' '.$morecss : '').'" id="'.dol_escape_htmltag($input['name']).'" name="'.dol_escape_htmltag($input['name']).'"'.$moreattr; |
5562
|
5562
|
if (!is_bool($input['value']) && $input['value'] != 'false' && $input['value'] != '0' && $input['value'] != '') { |
5563
|
5563
|
$more .= ' checked'; |
5564
|
5564
|
} |
|
@@ -5569,19 +5569,19 @@ discard block |
|
|
block discarded – undo |
5569
|
5569
|
$more .= ' disabled'; |
5570
|
5570
|
} |
5571
|
5571
|
$more .= ' /></div>'; |
5572
|
|
- $more .= '</div>' . "\n"; |
|
5572
|
+ $more .= '</div>'."\n"; |
5573
|
5573
|
} elseif ($input['type'] == 'radio') { |
5574
|
5574
|
$i = 0; |
5575
|
5575
|
foreach ($input['values'] as $selkey => $selval) { |
5576
|
5576
|
$more .= '<div class="tagtr">'; |
5577
|
5577
|
if (isset($input['label'])) { |
5578
|
5578
|
if ($i == 0) { |
5579
|
|
- $more .= '<div class="tagtd' . (empty($input['tdclass']) ? ' tdtop' : (' tdtop ' . $input['tdclass'])) . '">' . $input['label'] . '</div>'; |
|
5579
|
+ $more .= '<div class="tagtd'.(empty($input['tdclass']) ? ' tdtop' : (' tdtop '.$input['tdclass'])).'">'.$input['label'].'</div>'; |
5580
|
5580
|
} else { |
5581
|
|
- $more .= '<div class="tagtd' . (empty($input['tdclass']) ? '' : (' "' . $input['tdclass'])) . '"> </div>'; |
|
5581
|
+ $more .= '<div class="tagtd'.(empty($input['tdclass']) ? '' : (' "'.$input['tdclass'])).'"> </div>'; |
5582
|
5582
|
} |
5583
|
5583
|
} |
5584
|
|
- $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; |
|
5584
|
+ $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; |
5585
|
5585
|
if (!empty($input['disabled'])) { |
5586
|
5586
|
$more .= ' disabled'; |
5587
|
5587
|
} |
|
@@ -5589,12 +5589,12 @@ discard block |
|
|
block discarded – undo |
5589
|
5589
|
$more .= ' checked="checked"'; |
5590
|
5590
|
} |
5591
|
5591
|
$more .= ' /> '; |
5592
|
|
- $more .= '<label for="' . dol_escape_htmltag($input['name'] . $selkey) . '" class="valignmiddle">' . $selval . '</label>'; |
5593
|
|
- $more .= '</div></div>' . "\n"; |
|
5592
|
+ $more .= '<label for="'.dol_escape_htmltag($input['name'].$selkey).'" class="valignmiddle">'.$selval.'</label>'; |
|
5593
|
+ $more .= '</div></div>'."\n"; |
5594
|
5594
|
$i++; |
5595
|
5595
|
} |
5596
|
5596
|
} elseif ($input['type'] == 'date' || $input['type'] == 'datetime') { |
5597
|
|
- $more .= '<div class="tagtr"><div class="tagtd' . (empty($input['tdclass']) ? '' : (' ' . $input['tdclass'])) . '">' . $input['label'] . '</div>'; |
|
5597
|
+ $more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">'.$input['label'].'</div>'; |
5598
|
5598
|
$more .= '<div class="tagtd">'; |
5599
|
5599
|
$addnowlink = (empty($input['datenow']) ? 0 : 1); |
5600
|
5600
|
$h = $m = 0; |
|
@@ -5612,24 +5612,24 @@ discard block |
|
|
block discarded – undo |
5612
|
5612
|
} elseif ($input['type'] == 'other') { // can be 1 column or 2 depending if label is set or not |
5613
|
5613
|
$more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">'; |
5614
|
5614
|
if (!empty($input['label'])) { |
5615
|
|
- $more .= $input['label'] . '</div><div class="tagtd">'; |
|
5615
|
+ $more .= $input['label'].'</div><div class="tagtd">'; |
5616
|
5616
|
} |
5617
|
5617
|
$more .= $input['value']; |
5618
|
|
- $more .= '</div></div>' . "\n"; |
|
5618
|
+ $more .= '</div></div>'."\n"; |
5619
|
5619
|
} elseif ($input['type'] == 'onecolumn') { |
5620
|
5620
|
$moreonecolumn .= '<div class="margintoponly">'; |
5621
|
5621
|
$moreonecolumn .= $input['value']; |
5622
|
|
- $moreonecolumn .= '</div>' . "\n"; |
|
5622
|
+ $moreonecolumn .= '</div>'."\n"; |
5623
|
5623
|
} elseif ($input['type'] == 'hidden') { |
5624
|
5624
|
// Do nothing more, already added by a previous loop |
5625
|
5625
|
} elseif ($input['type'] == 'separator') { |
5626
|
5626
|
$more .= '<br>'; |
5627
|
5627
|
} else { |
5628
|
|
- $more .= 'Error type ' . $input['type'] . ' for the confirm box is not a supported type'; |
|
5628
|
+ $more .= 'Error type '.$input['type'].' for the confirm box is not a supported type'; |
5629
|
5629
|
} |
5630
|
5630
|
} |
5631
|
5631
|
} |
5632
|
|
- $more .= '</div>' . "\n"; |
|
5632
|
+ $more .= '</div>'."\n"; |
5633
|
5633
|
$more .= $moreonecolumn; |
5634
|
5634
|
} |
5635
|
5635
|
|
|
@@ -5651,10 +5651,10 @@ discard block |
|
|
block discarded – undo |
5651
|
5651
|
$button = $useajax; |
5652
|
5652
|
$useajax = 1; |
5653
|
5653
|
$autoOpen = false; |
5654
|
|
- $dialogconfirm .= '-' . $button; |
|
5654
|
+ $dialogconfirm .= '-'.$button; |
5655
|
5655
|
} |
5656
|
|
- $pageyes = $page . (preg_match('/\?/', $page) ? '&' : '?') . 'action=' . urlencode($action) . '&confirm=yes'; |
5657
|
|
- $pageno = ($useajax == 2 ? $page . (preg_match('/\?/', $page) ? '&' : '?') . 'action=' . urlencode($action) . '&confirm=no' : ''); |
|
5656
|
+ $pageyes = $page.(preg_match('/\?/', $page) ? '&' : '?').'action='.urlencode($action).'&confirm=yes'; |
|
5657
|
+ $pageno = ($useajax == 2 ? $page.(preg_match('/\?/', $page) ? '&' : '?').'action='.urlencode($action).'&confirm=no' : ''); |
5658
|
5658
|
|
5659
|
5659
|
// Add input fields into list of fields to read during submit (inputok and inputko) |
5660
|
5660
|
if (is_array($formquestion)) { |
|
@@ -5677,24 +5677,24 @@ discard block |
|
|
block discarded – undo |
5677
|
5677
|
} |
5678
|
5678
|
|
5679
|
5679
|
// Show JQuery confirm box. |
5680
|
|
- $formconfirm .= '<div id="' . $dialogconfirm . '" title="' . dol_escape_htmltag($title) . '" style="display: none;">'; |
|
5680
|
+ $formconfirm .= '<div id="'.$dialogconfirm.'" title="'.dol_escape_htmltag($title).'" style="display: none;">'; |
5681
|
5681
|
if (is_array($formquestion) && array_key_exists('text', $formquestion) && !empty($formquestion['text'])) { |
5682
|
|
- $formconfirm .= '<div class="confirmtext">' . $formquestion['text'] . '</div>' . "\n"; |
|
5682
|
+ $formconfirm .= '<div class="confirmtext">'.$formquestion['text'].'</div>'."\n"; |
5683
|
5683
|
} |
5684
|
5684
|
if (!empty($more)) { |
5685
|
|
- $formconfirm .= '<div class="confirmquestions">' . $more . '</div>' . "\n"; |
|
5685
|
+ $formconfirm .= '<div class="confirmquestions">'.$more.'</div>'."\n"; |
5686
|
5686
|
} |
5687
|
|
- $formconfirm .= ($question ? '<div class="confirmmessage">' . img_help(0, '') . ' ' . $question . '</div>' : ''); |
5688
|
|
- $formconfirm .= '</div>' . "\n"; |
|
5687
|
+ $formconfirm .= ($question ? '<div class="confirmmessage">'.img_help(0, '').' '.$question.'</div>' : ''); |
|
5688
|
+ $formconfirm .= '</div>'."\n"; |
5689
|
5689
|
|
5690
|
|
- $formconfirm .= "\n<!-- begin code of popup for formconfirm page=" . $page . " -->\n"; |
5691
|
|
- $formconfirm .= '<script nonce="' . getNonce() . '" type="text/javascript">' . "\n"; |
|
5690
|
+ $formconfirm .= "\n<!-- begin code of popup for formconfirm page=".$page." -->\n"; |
|
5691
|
+ $formconfirm .= '<script nonce="'.getNonce().'" type="text/javascript">'."\n"; |
5692
|
5692
|
$formconfirm .= "/* Code for the jQuery('#dialogforpopup').dialog() */\n"; |
5693
|
5693
|
$formconfirm .= 'jQuery(document).ready(function() { |
5694
|
5694
|
$(function() { |
5695
|
|
- $( "#' . $dialogconfirm . '" ).dialog( |
|
5695
|
+ $( "#' . $dialogconfirm.'" ).dialog( |
5696
|
5696
|
{ |
5697
|
|
- autoOpen: ' . ($autoOpen ? "true" : "false") . ','; |
|
5697
|
+ autoOpen: ' . ($autoOpen ? "true" : "false").','; |
5698
|
5698
|
if ($newselectedchoice == 'no') { |
5699
|
5699
|
$formconfirm .= ' |
5700
|
5700
|
open: function() { |
|
@@ -5704,24 +5704,24 @@ discard block |
|
|
block discarded – undo |
5704
|
5704
|
|
5705
|
5705
|
$jsforcursor = ''; |
5706
|
5706
|
if ($useajax == 1) { |
5707
|
|
- $jsforcursor = '// The call to urljump can be slow, so we set the wait cursor' . "\n"; |
5708
|
|
- $jsforcursor .= 'jQuery("html,body,#id-container").addClass("cursorwait");' . "\n"; |
|
5707
|
+ $jsforcursor = '// The call to urljump can be slow, so we set the wait cursor'."\n"; |
|
5708
|
+ $jsforcursor .= 'jQuery("html,body,#id-container").addClass("cursorwait");'."\n"; |
5709
|
5709
|
} |
5710
|
5710
|
|
5711
|
5711
|
$postconfirmas = 'GET'; |
5712
|
5712
|
|
5713
|
5713
|
$formconfirm .= ' |
5714
|
5714
|
resizable: false, |
5715
|
|
- height: "' . $height . '", |
5716
|
|
- width: "' . $width . '", |
|
5715
|
+ height: "' . $height.'", |
|
5716
|
+ width: "' . $width.'", |
5717
|
5717
|
modal: true, |
5718
|
5718
|
closeOnEscape: false, |
5719
|
5719
|
buttons: { |
5720
|
|
- "' . dol_escape_js($langs->transnoentities($labelbuttonyes)) . '": function() { |
5721
|
|
- var options = "token=' . urlencode(newToken()) . '"; |
5722
|
|
- var inputok = ' . json_encode($inputok) . '; /* List of fields into form */ |
5723
|
|
- var page = "' . dol_escape_js(!empty($page) ? $page : '') . '"; |
5724
|
|
- var pageyes = "' . dol_escape_js(!empty($pageyes) ? $pageyes : '') . '"; |
|
5720
|
+ "' . dol_escape_js($langs->transnoentities($labelbuttonyes)).'": function() { |
|
5721
|
+ var options = "token=' . urlencode(newToken()).'"; |
|
5722
|
+ var inputok = ' . json_encode($inputok).'; /* List of fields into form */ |
|
5723
|
+ var page = "' . dol_escape_js(!empty($page) ? $page : '').'"; |
|
5724
|
+ var pageyes = "' . dol_escape_js(!empty($pageyes) ? $pageyes : '').'"; |
5725
|
5725
|
|
5726
|
5726
|
if (inputok.length > 0) { |
5727
|
5727
|
$.each(inputok, function(i, inputname) { |
|
@@ -5755,11 +5755,11 @@ discard block |
|
|
block discarded – undo |
5755
|
5755
|
} |
5756
|
5756
|
$(this).dialog("close"); |
5757
|
5757
|
}, |
5758
|
|
- "' . dol_escape_js($langs->transnoentities($labelbuttonno)) . '": function() { |
5759
|
|
- var options = "token=' . urlencode(newToken()) . '"; |
5760
|
|
- var inputko = ' . json_encode($inputko) . '; /* List of fields into form */ |
5761
|
|
- var page = "' . dol_escape_js(!empty($page) ? $page : '') . '"; |
5762
|
|
- var pageno="' . dol_escape_js(!empty($pageno) ? $pageno : '') . '"; |
|
5758
|
+ "' . dol_escape_js($langs->transnoentities($labelbuttonno)).'": function() { |
|
5759
|
+ var options = "token=' . urlencode(newToken()).'"; |
|
5760
|
+ var inputko = ' . json_encode($inputko).'; /* List of fields into form */ |
|
5761
|
+ var page = "' . dol_escape_js(!empty($page) ? $page : '').'"; |
|
5762
|
+ var pageno="' . dol_escape_js(!empty($pageno) ? $pageno : '').'"; |
5763
|
5763
|
if (inputko.length > 0) { |
5764
|
5764
|
$.each(inputko, function(i, inputname) { |
5765
|
5765
|
var more = ""; |
|
@@ -5791,10 +5791,10 @@ discard block |
|
|
block discarded – undo |
5791
|
5791
|
} |
5792
|
5792
|
); |
5793
|
5793
|
|
5794
|
|
- var button = "' . $button . '"; |
|
5794
|
+ var button = "' . $button.'"; |
5795
|
5795
|
if (button.length > 0) { |
5796
|
5796
|
$( "#" + button ).click(function() { |
5797
|
|
- $("#' . $dialogconfirm . '").dialog("open"); |
|
5797
|
+ $("#' . $dialogconfirm.'").dialog("open"); |
5798
|
5798
|
}); |
5799
|
5799
|
} |
5800
|
5800
|
}); |
|
@@ -5802,44 +5802,44 @@ discard block |
|
|
block discarded – undo |
5802
|
5802
|
</script>'; |
5803
|
5803
|
$formconfirm .= "<!-- end ajax formconfirm -->\n"; |
5804
|
5804
|
} else { |
5805
|
|
- $formconfirm .= "\n<!-- begin formconfirm page=" . dol_escape_htmltag($page) . " -->\n"; |
|
5805
|
+ $formconfirm .= "\n<!-- begin formconfirm page=".dol_escape_htmltag($page)." -->\n"; |
5806
|
5806
|
|
5807
|
5807
|
if (empty($disableformtag)) { |
5808
|
|
- $formconfirm .= '<form method="POST" action="' . $page . '" class="notoptoleftroright">' . "\n"; |
|
5808
|
+ $formconfirm .= '<form method="POST" action="'.$page.'" class="notoptoleftroright">'."\n"; |
5809
|
5809
|
} |
5810
|
5810
|
|
5811
|
|
- $formconfirm .= '<input type="hidden" name="action" value="' . $action . '">' . "\n"; |
5812
|
|
- $formconfirm .= '<input type="hidden" name="token" value="' . newToken() . '">' . "\n"; |
|
5811
|
+ $formconfirm .= '<input type="hidden" name="action" value="'.$action.'">'."\n"; |
|
5812
|
+ $formconfirm .= '<input type="hidden" name="token" value="'.newToken().'">'."\n"; |
5813
|
5813
|
|
5814
|
|
- $formconfirm .= '<table class="valid centpercent">' . "\n"; |
|
5814
|
+ $formconfirm .= '<table class="valid centpercent">'."\n"; |
5815
|
5815
|
|
5816
|
5816
|
// Line title |
5817
|
5817
|
$formconfirm .= '<tr class="validtitre"><td class="validtitre" colspan="2">'; |
5818
|
|
- $formconfirm .= img_picto('', 'pictoconfirm') . ' ' . $title; |
5819
|
|
- $formconfirm .= '</td></tr>' . "\n"; |
|
5818
|
+ $formconfirm .= img_picto('', 'pictoconfirm').' '.$title; |
|
5819
|
+ $formconfirm .= '</td></tr>'."\n"; |
5820
|
5820
|
|
5821
|
5821
|
// Line text |
5822
|
5822
|
if (is_array($formquestion) && array_key_exists('text', $formquestion) && !empty($formquestion['text'])) { |
5823
|
|
- $formconfirm .= '<tr class="valid"><td class="valid" colspan="2">' . $formquestion['text'] . '</td></tr>' . "\n"; |
|
5823
|
+ $formconfirm .= '<tr class="valid"><td class="valid" colspan="2">'.$formquestion['text'].'</td></tr>'."\n"; |
5824
|
5824
|
} |
5825
|
5825
|
|
5826
|
5826
|
// Line form fields |
5827
|
5827
|
if ($more) { |
5828
|
|
- $formconfirm .= '<tr class="valid"><td class="valid" colspan="2">' . "\n"; |
|
5828
|
+ $formconfirm .= '<tr class="valid"><td class="valid" colspan="2">'."\n"; |
5829
|
5829
|
$formconfirm .= $more; |
5830
|
|
- $formconfirm .= '</td></tr>' . "\n"; |
|
5830
|
+ $formconfirm .= '</td></tr>'."\n"; |
5831
|
5831
|
} |
5832
|
5832
|
|
5833
|
5833
|
// Line with question |
5834
|
5834
|
$formconfirm .= '<tr class="valid">'; |
5835
|
|
- $formconfirm .= '<td class="valid">' . $question . '</td>'; |
|
5835
|
+ $formconfirm .= '<td class="valid">'.$question.'</td>'; |
5836
|
5836
|
$formconfirm .= '<td class="valid center">'; |
5837
|
5837
|
$formconfirm .= $this->selectyesno("confirm", $newselectedchoice, 0, false, 0, 0, 'marginleftonly marginrightonly', $labelbuttonyes, $labelbuttonno); |
5838
|
|
- $formconfirm .= '<input class="button valignmiddle confirmvalidatebutton small" type="submit" value="' . $langs->trans("Validate") . '">'; |
|
5838
|
+ $formconfirm .= '<input class="button valignmiddle confirmvalidatebutton small" type="submit" value="'.$langs->trans("Validate").'">'; |
5839
|
5839
|
$formconfirm .= '</td>'; |
5840
|
|
- $formconfirm .= '</tr>' . "\n"; |
|
5840
|
+ $formconfirm .= '</tr>'."\n"; |
5841
|
5841
|
|
5842
|
|
- $formconfirm .= '</table>' . "\n"; |
|
5842
|
+ $formconfirm .= '</table>'."\n"; |
5843
|
5843
|
|
5844
|
5844
|
if (empty($disableformtag)) { |
5845
|
5845
|
$formconfirm .= "</form>\n"; |
|
@@ -5848,7 +5848,7 @@ discard block |
|
|
block discarded – undo |
5848
|
5848
|
|
5849
|
5849
|
if (!empty($conf->use_javascript_ajax)) { |
5850
|
5850
|
$formconfirm .= '<!-- code to disable button to avoid double clic -->'; |
5851
|
|
- $formconfirm .= '<script nonce="' . getNonce() . '" type="text/javascript">' . "\n"; |
|
5851
|
+ $formconfirm .= '<script nonce="'.getNonce().'" type="text/javascript">'."\n"; |
5852
|
5852
|
$formconfirm .= ' |
5853
|
5853
|
$(document).ready(function () { |
5854
|
5854
|
$(".confirmvalidatebutton").on("click", function() { |
|
@@ -5860,7 +5860,7 @@ discard block |
|
|
block discarded – undo |
5860
|
5860
|
}); |
5861
|
5861
|
}); |
5862
|
5862
|
'; |
5863
|
|
- $formconfirm .= '</script>' . "\n"; |
|
5863
|
+ $formconfirm .= '</script>'."\n"; |
5864
|
5864
|
} |
5865
|
5865
|
|
5866
|
5866
|
$formconfirm .= "<!-- end formconfirm -->\n"; |
|
@@ -5892,8 +5892,8 @@ discard block |
|
|
block discarded – undo |
5892
|
5892
|
// phpcs:enable |
5893
|
5893
|
global $langs; |
5894
|
5894
|
|
5895
|
|
- require_once DOL_DOCUMENT_ROOT . '/core/lib/project.lib.php'; |
5896
|
|
- require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php'; |
|
5895
|
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php'; |
|
5896
|
+ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; |
5897
|
5897
|
|
5898
|
5898
|
$out = ''; |
5899
|
5899
|
|
|
@@ -5901,11 +5901,11 @@ discard block |
|
|
block discarded – undo |
5901
|
5901
|
|
5902
|
5902
|
$langs->load("project"); |
5903
|
5903
|
if ($htmlname != "none") { |
5904
|
|
- $out .= '<form method="post" action="' . $page . '">'; |
|
5904
|
+ $out .= '<form method="post" action="'.$page.'">'; |
5905
|
5905
|
$out .= '<input type="hidden" name="action" value="classin">'; |
5906
|
|
- $out .= '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
5906
|
+ $out .= '<input type="hidden" name="token" value="'.newToken().'">'; |
5907
|
5907
|
$out .= $formproject->select_projects($socid, $selected, $htmlname, $maxlength, 0, 1, $discard_closed, $forcefocus, 0, 0, '', 1, 0, $morecss); |
5908
|
|
- $out .= '<input type="submit" class="button smallpaddingimp" value="' . $langs->trans("Modify") . '">'; |
|
5908
|
+ $out .= '<input type="submit" class="button smallpaddingimp" value="'.$langs->trans("Modify").'">'; |
5909
|
5909
|
$out .= '</form>'; |
5910
|
5910
|
} else { |
5911
|
5911
|
$out .= '<span class="project_head_block">'; |
|
@@ -5914,7 +5914,7 @@ discard block |
|
|
block discarded – undo |
5914
|
5914
|
$projet->fetch($selected); |
5915
|
5915
|
$out .= $projet->getNomUrl(0, '', 1); |
5916
|
5916
|
} else { |
5917
|
|
- $out .= '<span class="opacitymedium">' . $textifnoproject . '</span>'; |
|
5917
|
+ $out .= '<span class="opacitymedium">'.$textifnoproject.'</span>'; |
5918
|
5918
|
} |
5919
|
5919
|
$out .= '</span>'; |
5920
|
5920
|
} |
|
@@ -5951,14 +5951,14 @@ discard block |
|
|
block discarded – undo |
5951
|
5951
|
$out = ''; |
5952
|
5952
|
|
5953
|
5953
|
if ($htmlname != "none") { |
5954
|
|
- $out .= '<form method="POST" action="' . $page . '">'; |
|
5954
|
+ $out .= '<form method="POST" action="'.$page.'">'; |
5955
|
5955
|
$out .= '<input type="hidden" name="action" value="setconditions">'; |
5956
|
|
- $out .= '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
5956
|
+ $out .= '<input type="hidden" name="token" value="'.newToken().'">'; |
5957
|
5957
|
if ($type) { |
5958
|
|
- $out .= '<input type="hidden" name="type" value="' . dol_escape_htmltag($type) . '">'; |
|
5958
|
+ $out .= '<input type="hidden" name="type" value="'.dol_escape_htmltag($type).'">'; |
5959
|
5959
|
} |
5960
|
5960
|
$out .= $this->getSelectConditionsPaiements($selected, $htmlname, $filtertype, $addempty, 0, '', $deposit_percent); |
5961
|
|
- $out .= '<input type="submit" class="button valignmiddle smallpaddingimp" value="' . $langs->trans("Modify") . '">'; |
|
5961
|
+ $out .= '<input type="submit" class="button valignmiddle smallpaddingimp" value="'.$langs->trans("Modify").'">'; |
5962
|
5962
|
$out .= '</form>'; |
5963
|
5963
|
} else { |
5964
|
5964
|
if ($selected) { |
|
@@ -6003,12 +6003,12 @@ discard block |
|
|
block discarded – undo |
6003
|
6003
|
// phpcs:enable |
6004
|
6004
|
global $langs; |
6005
|
6005
|
if ($htmlname != "none") { |
6006
|
|
- print '<form method="post" action="' . $page . '">'; |
|
6006
|
+ print '<form method="post" action="'.$page.'">'; |
6007
|
6007
|
print '<input type="hidden" name="action" value="setavailability">'; |
6008
|
|
- print '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
6008
|
+ print '<input type="hidden" name="token" value="'.newToken().'">'; |
6009
|
6009
|
$this->selectAvailabilityDelay($selected, $htmlname, '', $addempty); |
6010
|
|
- print '<input type="submit" name="modify" class="button smallpaddingimp" value="' . $langs->trans("Modify") . '">'; |
6011
|
|
- print '<input type="submit" name="cancel" class="button smallpaddingimp" value="' . $langs->trans("Cancel") . '">'; |
|
6010
|
+ print '<input type="submit" name="modify" class="button smallpaddingimp" value="'.$langs->trans("Modify").'">'; |
|
6011
|
+ print '<input type="submit" name="cancel" class="button smallpaddingimp" value="'.$langs->trans("Cancel").'">'; |
6012
|
6012
|
print '</form>'; |
6013
|
6013
|
} else { |
6014
|
6014
|
if ($selected) { |
|
@@ -6034,11 +6034,11 @@ discard block |
|
|
block discarded – undo |
6034
|
6034
|
{ |
6035
|
6035
|
global $langs; |
6036
|
6036
|
if ($htmlname != "none") { |
6037
|
|
- print '<form method="post" action="' . $page . '">'; |
|
6037
|
+ print '<form method="post" action="'.$page.'">'; |
6038
|
6038
|
print '<input type="hidden" name="action" value="setdemandreason">'; |
6039
|
|
- print '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
6039
|
+ print '<input type="hidden" name="token" value="'.newToken().'">'; |
6040
|
6040
|
$this->selectInputReason($selected, $htmlname, '-1', $addempty); |
6041
|
|
- print '<input type="submit" class="button smallpaddingimp" value="' . $langs->trans("Modify") . '">'; |
|
6041
|
+ print '<input type="submit" class="button smallpaddingimp" value="'.$langs->trans("Modify").'">'; |
6042
|
6042
|
print '</form>'; |
6043
|
6043
|
} else { |
6044
|
6044
|
if ($selected) { |
|
@@ -6078,17 +6078,17 @@ discard block |
|
|
block discarded – undo |
6078
|
6078
|
$ret = ''; |
6079
|
6079
|
|
6080
|
6080
|
if ($htmlname != "none") { |
6081
|
|
- $ret .= '<form method="POST" action="' . $page . '" name="form' . $htmlname . '">'; |
6082
|
|
- $ret .= '<input type="hidden" name="action" value="set' . $htmlname . '">'; |
6083
|
|
- $ret .= '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
6081
|
+ $ret .= '<form method="POST" action="'.$page.'" name="form'.$htmlname.'">'; |
|
6082
|
+ $ret .= '<input type="hidden" name="action" value="set'.$htmlname.'">'; |
|
6083
|
+ $ret .= '<input type="hidden" name="token" value="'.newToken().'">'; |
6084
|
6084
|
if ($type) { |
6085
|
|
- $ret .= '<input type="hidden" name="type" value="' . dol_escape_htmltag($type) . '">'; |
|
6085
|
+ $ret .= '<input type="hidden" name="type" value="'.dol_escape_htmltag($type).'">'; |
6086
|
6086
|
} |
6087
|
6087
|
$ret .= '<table class="nobordernopadding">'; |
6088
|
6088
|
$ret .= '<tr><td>'; |
6089
|
|
- $ret .= $this->selectDate($selected, $htmlname, $displayhour, $displaymin, 1, 'form' . $htmlname, 1, 0); |
|
6089
|
+ $ret .= $this->selectDate($selected, $htmlname, $displayhour, $displaymin, 1, 'form'.$htmlname, 1, 0); |
6090
|
6090
|
$ret .= '</td>'; |
6091
|
|
- $ret .= '<td class="left"><input type="submit" class="button smallpaddingimp" value="' . $langs->trans("Modify") . '"></td>'; |
|
6091
|
+ $ret .= '<td class="left"><input type="submit" class="button smallpaddingimp" value="'.$langs->trans("Modify").'"></td>'; |
6092
|
6092
|
$ret .= '</tr></table></form>'; |
6093
|
6093
|
} else { |
6094
|
6094
|
if ($displayhour) { |
|
@@ -6123,15 +6123,15 @@ discard block |
|
|
block discarded – undo |
6123
|
6123
|
global $langs; |
6124
|
6124
|
|
6125
|
6125
|
if ($htmlname != "none") { |
6126
|
|
- print '<form method="POST" action="' . $page . '" name="form' . $htmlname . '">'; |
6127
|
|
- print '<input type="hidden" name="action" value="set' . $htmlname . '">'; |
6128
|
|
- print '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
6126
|
+ print '<form method="POST" action="'.$page.'" name="form'.$htmlname.'">'; |
|
6127
|
+ print '<input type="hidden" name="action" value="set'.$htmlname.'">'; |
|
6128
|
+ print '<input type="hidden" name="token" value="'.newToken().'">'; |
6129
|
6129
|
print $this->select_dolusers($selected, $htmlname, 1, $exclude, 0, $include); |
6130
|
|
- print '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">'; |
|
6130
|
+ print '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">'; |
6131
|
6131
|
print '</form>'; |
6132
|
6132
|
} else { |
6133
|
6133
|
if ($selected) { |
6134
|
|
- require_once DOL_DOCUMENT_ROOT . '/user/class/user.class.php'; |
|
6134
|
+ require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; |
6135
|
6135
|
$theuser = new User($this->db); |
6136
|
6136
|
$theuser->fetch($selected); |
6137
|
6137
|
print $theuser->getNomUrl(1); |
|
@@ -6164,14 +6164,14 @@ discard block |
|
|
block discarded – undo |
6164
|
6164
|
|
6165
|
6165
|
$out = ''; |
6166
|
6166
|
if ($htmlname != "none") { |
6167
|
|
- $out .= '<form method="POST" action="' . $page . '">'; |
|
6167
|
+ $out .= '<form method="POST" action="'.$page.'">'; |
6168
|
6168
|
$out .= '<input type="hidden" name="action" value="setmode">'; |
6169
|
|
- $out .= '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
6169
|
+ $out .= '<input type="hidden" name="token" value="'.newToken().'">'; |
6170
|
6170
|
if ($type) { |
6171
|
|
- $out .= '<input type="hidden" name="type" value="' . dol_escape_htmltag($type) . '">'; |
|
6171
|
+ $out .= '<input type="hidden" name="type" value="'.dol_escape_htmltag($type).'">'; |
6172
|
6172
|
} |
6173
|
6173
|
$out .= $this->select_types_paiements($selected, $htmlname, $filtertype, 0, $addempty, 0, 0, $active, '', 1); |
6174
|
|
- $out .= '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">'; |
|
6174
|
+ $out .= '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">'; |
6175
|
6175
|
$out .= '</form>'; |
6176
|
6176
|
} else { |
6177
|
6177
|
if ($selected) { |
|
@@ -6204,11 +6204,11 @@ discard block |
|
|
block discarded – undo |
6204
|
6204
|
{ |
6205
|
6205
|
global $langs; |
6206
|
6206
|
if ($htmlname != "none") { |
6207
|
|
- print '<form method="POST" action="' . $page . '">'; |
|
6207
|
+ print '<form method="POST" action="'.$page.'">'; |
6208
|
6208
|
print '<input type="hidden" name="action" value="settransportmode">'; |
6209
|
|
- print '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
6209
|
+ print '<input type="hidden" name="token" value="'.newToken().'">'; |
6210
|
6210
|
$this->selectTransportMode($selected, $htmlname, 0, $addempty, 0, 0, $active); |
6211
|
|
- print '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">'; |
|
6211
|
+ print '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">'; |
6212
|
6212
|
print '</form>'; |
6213
|
6213
|
} else { |
6214
|
6214
|
if ($selected) { |
|
@@ -6235,14 +6235,14 @@ discard block |
|
|
block discarded – undo |
6235
|
6235
|
// phpcs:enable |
6236
|
6236
|
global $langs; |
6237
|
6237
|
if ($htmlname != "none") { |
6238
|
|
- print '<form method="POST" action="' . $page . '">'; |
|
6238
|
+ print '<form method="POST" action="'.$page.'">'; |
6239
|
6239
|
print '<input type="hidden" name="action" value="setmulticurrencycode">'; |
6240
|
|
- print '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
6240
|
+ print '<input type="hidden" name="token" value="'.newToken().'">'; |
6241
|
6241
|
print $this->selectMultiCurrency($selected, $htmlname, 0); |
6242
|
|
- print '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">'; |
|
6242
|
+ print '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">'; |
6243
|
6243
|
print '</form>'; |
6244
|
6244
|
} else { |
6245
|
|
- require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php'; |
|
6245
|
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; |
6246
|
6246
|
print !empty($selected) ? currency_name($selected, 1) : ' '; |
6247
|
6247
|
} |
6248
|
6248
|
} |
|
@@ -6264,22 +6264,22 @@ discard block |
|
|
block discarded – undo |
6264
|
6264
|
global $langs, $mysoc, $conf; |
6265
|
6265
|
|
6266
|
6266
|
if ($htmlname != "none") { |
6267
|
|
- print '<form method="POST" action="' . $page . '">'; |
|
6267
|
+ print '<form method="POST" action="'.$page.'">'; |
6268
|
6268
|
print '<input type="hidden" name="action" value="setmulticurrencyrate">'; |
6269
|
|
- print '<input type="hidden" name="token" value="' . newToken() . '">'; |
6270
|
|
- print '<input type="text" class="maxwidth75" name="' . $htmlname . '" value="' . (!empty($rate) ? price(price2num($rate, 'CU')) : 1) . '" /> '; |
|
6269
|
+ print '<input type="hidden" name="token" value="'.newToken().'">'; |
|
6270
|
+ print '<input type="text" class="maxwidth75" name="'.$htmlname.'" value="'.(!empty($rate) ? price(price2num($rate, 'CU')) : 1).'" /> '; |
6271
|
6271
|
print '<select name="calculation_mode" id="calculation_mode">'; |
6272
|
|
- print '<option value="1">Change ' . $langs->trans("PriceUHT") . ' of lines</option>'; |
6273
|
|
- print '<option value="2">Change ' . $langs->trans("PriceUHTCurrency") . ' of lines</option>'; |
|
6272
|
+ print '<option value="1">Change '.$langs->trans("PriceUHT").' of lines</option>'; |
|
6273
|
+ print '<option value="2">Change '.$langs->trans("PriceUHTCurrency").' of lines</option>'; |
6274
|
6274
|
print '</select> '; |
6275
|
6275
|
print ajax_combobox("calculation_mode"); |
6276
|
|
- print '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">'; |
|
6276
|
+ print '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">'; |
6277
|
6277
|
print '</form>'; |
6278
|
6278
|
} else { |
6279
|
6279
|
if (!empty($rate)) { |
6280
|
6280
|
print price($rate, 1, $langs, 0, 0); |
6281
|
6281
|
if ($currency && $rate != 1) { |
6282
|
|
- print ' <span class="opacitymedium">(' . price($rate, 1, $langs, 0, 0) . ' ' . $currency . ' = 1 ' . $conf->currency . ')</span>'; |
|
6282
|
+ print ' <span class="opacitymedium">('.price($rate, 1, $langs, 0, 0).' '.$currency.' = 1 '.$conf->currency.')</span>'; |
6283
|
6283
|
} |
6284
|
6284
|
} else { |
6285
|
6285
|
print 1; |
|
@@ -6310,9 +6310,9 @@ discard block |
|
|
block discarded – undo |
6310
|
6310
|
// phpcs:enable |
6311
|
6311
|
global $conf, $langs; |
6312
|
6312
|
if ($htmlname != "none") { |
6313
|
|
- print '<form method="post" action="' . $page . '">'; |
|
6313
|
+ print '<form method="post" action="'.$page.'">'; |
6314
|
6314
|
print '<input type="hidden" name="action" value="setabsolutediscount">'; |
6315
|
|
- print '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
6315
|
+ print '<input type="hidden" name="token" value="'.newToken().'">'; |
6316
|
6316
|
print '<div class="inline-block">'; |
6317
|
6317
|
if (!empty($discount_type)) { |
6318
|
6318
|
if (getDolGlobalString('FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS')) { |
|
@@ -6350,24 +6350,24 @@ discard block |
|
|
block discarded – undo |
6350
|
6350
|
print '</div>'; |
6351
|
6351
|
if (empty($hidelist)) { |
6352
|
6352
|
print '<div class="inline-block" style="padding-right: 10px">'; |
6353
|
|
- $newfilter = 'discount_type=' . intval($discount_type); |
|
6353
|
+ $newfilter = 'discount_type='.intval($discount_type); |
6354
|
6354
|
if (!empty($discount_type)) { |
6355
|
6355
|
$newfilter .= ' AND fk_invoice_supplier IS NULL AND fk_invoice_supplier_line IS NULL'; // Supplier discounts available |
6356
|
6356
|
} else { |
6357
|
6357
|
$newfilter .= ' AND fk_facture IS NULL AND fk_facture_line IS NULL'; // Customer discounts available |
6358
|
6358
|
} |
6359
|
6359
|
if ($filter) { |
6360
|
|
- $newfilter .= ' AND (' . $filter . ')'; |
|
6360
|
+ $newfilter .= ' AND ('.$filter.')'; |
6361
|
6361
|
} |
6362
|
6362
|
// output the combo of discounts |
6363
|
6363
|
$nbqualifiedlines = $this->select_remises((string) $selected, $htmlname, $newfilter, $socid, $maxvalue); |
6364
|
6364
|
if ($nbqualifiedlines > 0) { |
6365
|
|
- print ' <input type="submit" class="button smallpaddingimp" value="' . dol_escape_htmltag($langs->trans("UseLine")) . '"'; |
|
6365
|
+ print ' <input type="submit" class="button smallpaddingimp" value="'.dol_escape_htmltag($langs->trans("UseLine")).'"'; |
6366
|
6366
|
if (!empty($discount_type) && $filter && $filter != "fk_invoice_supplier_source IS NULL OR (description LIKE '(DEPOSIT)%' AND description NOT LIKE '(EXCESS PAID)%')") { |
6367
|
|
- print ' title="' . $langs->trans("UseCreditNoteInInvoicePayment") . '"'; |
|
6367
|
+ print ' title="'.$langs->trans("UseCreditNoteInInvoicePayment").'"'; |
6368
|
6368
|
} |
6369
|
6369
|
if (empty($discount_type) && $filter && $filter != "fk_facture_source IS NULL OR (description LIKE '(DEPOSIT)%' AND description NOT LIKE '(EXCESS RECEIVED)%')") { |
6370
|
|
- print ' title="' . $langs->trans("UseCreditNoteInInvoicePayment") . '"'; |
|
6370
|
+ print ' title="'.$langs->trans("UseCreditNoteInInvoicePayment").'"'; |
6371
|
6371
|
} |
6372
|
6372
|
|
6373
|
6373
|
print '>'; |
|
@@ -6407,23 +6407,23 @@ discard block |
|
|
block discarded – undo |
6407
|
6407
|
global $langs; |
6408
|
6408
|
|
6409
|
6409
|
if ($htmlname != "none") { |
6410
|
|
- print '<form method="post" action="' . $page . '">'; |
|
6410
|
+ print '<form method="post" action="'.$page.'">'; |
6411
|
6411
|
print '<input type="hidden" name="action" value="set_contact">'; |
6412
|
|
- print '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
6412
|
+ print '<input type="hidden" name="token" value="'.newToken().'">'; |
6413
|
6413
|
print '<table class="nobordernopadding">'; |
6414
|
6414
|
print '<tr><td>'; |
6415
|
6415
|
print $this->selectcontacts($societe->id, $selected, $htmlname); |
6416
|
6416
|
$num = $this->num; |
6417
|
6417
|
if ($num == 0) { |
6418
|
6418
|
$addcontact = (getDolGlobalString('SOCIETE_ADDRESSES_MANAGEMENT') ? $langs->trans("AddContact") : $langs->trans("AddContactAddress")); |
6419
|
|
- print '<a href="' . DOL_URL_ROOT . '/contact/card.php?socid=' . $societe->id . '&action=create&backtoreferer=1">' . $addcontact . '</a>'; |
|
6419
|
+ print '<a href="'.DOL_URL_ROOT.'/contact/card.php?socid='.$societe->id.'&action=create&backtoreferer=1">'.$addcontact.'</a>'; |
6420
|
6420
|
} |
6421
|
6421
|
print '</td>'; |
6422
|
|
- print '<td class="left"><input type="submit" class="button smallpaddingimp" value="' . $langs->trans("Modify") . '"></td>'; |
|
6422
|
+ print '<td class="left"><input type="submit" class="button smallpaddingimp" value="'.$langs->trans("Modify").'"></td>'; |
6423
|
6423
|
print '</tr></table></form>'; |
6424
|
6424
|
} else { |
6425
|
6425
|
if ($selected) { |
6426
|
|
- require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php'; |
|
6426
|
+ require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; |
6427
|
6427
|
$contact = new Contact($this->db); |
6428
|
6428
|
$contact->fetch($selected); |
6429
|
6429
|
print $contact->getFullName($langs); |
|
@@ -6458,20 +6458,20 @@ discard block |
|
|
block discarded – undo |
6458
|
6458
|
|
6459
|
6459
|
$out = ''; |
6460
|
6460
|
if ($htmlname != "none") { |
6461
|
|
- $out .= '<form method="post" action="' . $page . '">'; |
|
6461
|
+ $out .= '<form method="post" action="'.$page.'">'; |
6462
|
6462
|
$out .= '<input type="hidden" name="action" value="set_thirdparty">'; |
6463
|
|
- $out .= '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
6463
|
+ $out .= '<input type="hidden" name="token" value="'.newToken().'">'; |
6464
|
6464
|
$out .= $this->select_company($selected, $htmlname, $filter, $showempty, $showtype, $forcecombo, $events, 0, 'minwidth100', '', '', 1, array(), false, $excludeids); |
6465
|
|
- $out .= '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">'; |
|
6465
|
+ $out .= '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">'; |
6466
|
6466
|
$out .= '</form>'; |
6467
|
6467
|
} else { |
6468
|
6468
|
if ($selected) { |
6469
|
|
- require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; |
|
6469
|
+ require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; |
6470
|
6470
|
$soc = new Societe($this->db); |
6471
|
6471
|
$soc->fetch($selected); |
6472
|
6472
|
$out .= $soc->getNomUrl(0, ''); |
6473
|
6473
|
} else { |
6474
|
|
- $out .= '<span class="opacitymedium">' . $textifnothirdparty . '</span>'; |
|
6474
|
+ $out .= '<span class="opacitymedium">'.$textifnothirdparty.'</span>'; |
6475
|
6475
|
} |
6476
|
6476
|
} |
6477
|
6477
|
|
|
@@ -6521,22 +6521,22 @@ discard block |
|
|
block discarded – undo |
6521
|
6521
|
$selected = 'EUR'; // Pour compatibilite |
6522
|
6522
|
} |
6523
|
6523
|
|
6524
|
|
- $out .= '<select class="flat maxwidth200onsmartphone minwidth300" name="' . $htmlname . '" id="' . $htmlname . '">'; |
|
6524
|
+ $out .= '<select class="flat maxwidth200onsmartphone minwidth300" name="'.$htmlname.'" id="'.$htmlname.'">'; |
6525
|
6525
|
if ($useempty) { |
6526
|
6526
|
$out .= '<option value="-1" selected></option>'; |
6527
|
6527
|
} |
6528
|
6528
|
foreach ($langs->cache_currencies as $code_iso => $currency) { |
6529
|
6529
|
$labeltoshow = $currency['label']; |
6530
|
6530
|
if ($mode == 1) { |
6531
|
|
- $labeltoshow .= ' <span class="opacitymedium">(' . $code_iso . ')</span>'; |
|
6531
|
+ $labeltoshow .= ' <span class="opacitymedium">('.$code_iso.')</span>'; |
6532
|
6532
|
} else { |
6533
|
|
- $labeltoshow .= ' <span class="opacitymedium">(' . $langs->getCurrencySymbol($code_iso) . ')</span>'; |
|
6533
|
+ $labeltoshow .= ' <span class="opacitymedium">('.$langs->getCurrencySymbol($code_iso).')</span>'; |
6534
|
6534
|
} |
6535
|
6535
|
|
6536
|
6536
|
if ($selected && $selected == $code_iso) { |
6537
|
|
- $out .= '<option value="' . $code_iso . '" selected data-html="' . dol_escape_htmltag($labeltoshow) . '">'; |
|
6537
|
+ $out .= '<option value="'.$code_iso.'" selected data-html="'.dol_escape_htmltag($labeltoshow).'">'; |
6538
|
6538
|
} else { |
6539
|
|
- $out .= '<option value="' . $code_iso . '" data-html="' . dol_escape_htmltag($labeltoshow) . '">'; |
|
6539
|
+ $out .= '<option value="'.$code_iso.'" data-html="'.dol_escape_htmltag($labeltoshow).'">'; |
6540
|
6540
|
} |
6541
|
6541
|
$out .= $labeltoshow; |
6542
|
6542
|
$out .= '</option>'; |
|
@@ -6547,7 +6547,7 @@ discard block |
|
|
block discarded – undo |
6547
|
6547
|
} |
6548
|
6548
|
|
6549
|
6549
|
// Make select dynamic |
6550
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
6550
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
6551
|
6551
|
$out .= ajax_combobox($htmlname); |
6552
|
6552
|
|
6553
|
6553
|
return $out; |
|
@@ -6573,10 +6573,10 @@ discard block |
|
|
block discarded – undo |
6573
|
6573
|
|
6574
|
6574
|
$TCurrency = array(); |
6575
|
6575
|
|
6576
|
|
- $sql = "SELECT code FROM " . $this->db->prefix() . "multicurrency"; |
6577
|
|
- $sql .= " WHERE entity IN ('" . getEntity('mutlicurrency') . "')"; |
|
6576
|
+ $sql = "SELECT code FROM ".$this->db->prefix()."multicurrency"; |
|
6577
|
+ $sql .= " WHERE entity IN ('".getEntity('mutlicurrency')."')"; |
6578
|
6578
|
if ($filter) { |
6579
|
|
- $sql .= " AND " . $filter; |
|
6579
|
+ $sql .= " AND ".$filter; |
6580
|
6580
|
} |
6581
|
6581
|
$resql = $this->db->query($sql); |
6582
|
6582
|
if ($resql) { |
|
@@ -6586,7 +6586,7 @@ discard block |
|
|
block discarded – undo |
6586
|
6586
|
} |
6587
|
6587
|
|
6588
|
6588
|
$out = ''; |
6589
|
|
- $out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">'; |
|
6589
|
+ $out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">'; |
6590
|
6590
|
if ($useempty) { |
6591
|
6591
|
$out .= '<option value=""> </option>'; |
6592
|
6592
|
} |
|
@@ -6598,13 +6598,13 @@ discard block |
|
|
block discarded – undo |
6598
|
6598
|
foreach ($langs->cache_currencies as $code_iso => $currency) { |
6599
|
6599
|
if (isset($TCurrency[$code_iso])) { |
6600
|
6600
|
if (!empty($selected) && $selected == $code_iso) { |
6601
|
|
- $out .= '<option value="' . $code_iso . '" selected="selected">'; |
|
6601
|
+ $out .= '<option value="'.$code_iso.'" selected="selected">'; |
6602
|
6602
|
} else { |
6603
|
|
- $out .= '<option value="' . $code_iso . '">'; |
|
6603
|
+ $out .= '<option value="'.$code_iso.'">'; |
6604
|
6604
|
} |
6605
|
6605
|
|
6606
|
6606
|
$out .= $currency['label']; |
6607
|
|
- $out .= ' (' . $langs->getCurrencySymbol($code_iso) . ')'; |
|
6607
|
+ $out .= ' ('.$langs->getCurrencySymbol($code_iso).')'; |
6608
|
6608
|
$out .= '</option>'; |
6609
|
6609
|
} |
6610
|
6610
|
} |
|
@@ -6613,7 +6613,7 @@ discard block |
|
|
block discarded – undo |
6613
|
6613
|
$out .= '</select>'; |
6614
|
6614
|
|
6615
|
6615
|
// Make select dynamic |
6616
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
6616
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
6617
|
6617
|
$out .= ajax_combobox($htmlname); |
6618
|
6618
|
|
6619
|
6619
|
return $out; |
|
@@ -6644,7 +6644,7 @@ discard block |
|
|
block discarded – undo |
6644
|
6644
|
$sql .= " WHERE t.fk_pays = c.rowid"; |
6645
|
6645
|
$sql .= " AND t.active > 0"; |
6646
|
6646
|
$sql .= " AND t.entity IN (".getEntity('c_tva').")"; |
6647
|
|
- $sql .= " AND c.code IN (" . $this->db->sanitize($country_code, 1) . ")"; |
|
6647
|
+ $sql .= " AND c.code IN (".$this->db->sanitize($country_code, 1).")"; |
6648
|
6648
|
$sql .= " ORDER BY t.code ASC, t.taux ASC, t.recuperableonly ASC"; |
6649
|
6649
|
|
6650
|
6650
|
$resql = $this->db->query($sql); |
|
@@ -6656,30 +6656,30 @@ discard block |
|
|
block discarded – undo |
6656
|
6656
|
|
6657
|
6657
|
$tmparray = array(); |
6658
|
6658
|
$tmparray['rowid'] = $obj->rowid; |
6659
|
|
- $tmparray['type_vat'] = $obj->type_vat; |
6660
|
|
- $tmparray['code'] = $obj->code; |
|
6659
|
+ $tmparray['type_vat'] = $obj->type_vat; |
|
6660
|
+ $tmparray['code'] = $obj->code; |
6661
|
6661
|
$tmparray['txtva'] = $obj->taux; |
6662
|
|
- $tmparray['nprtva'] = $obj->recuperableonly; |
|
6662
|
+ $tmparray['nprtva'] = $obj->recuperableonly; |
6663
|
6663
|
$tmparray['localtax1'] = $obj->localtax1; |
6664
|
6664
|
$tmparray['localtax1_type'] = $obj->localtax1_type; |
6665
|
6665
|
$tmparray['localtax2'] = $obj->localtax2; |
6666
|
6666
|
$tmparray['localtax2_type'] = $obj->localtax1_type; |
6667
|
|
- $tmparray['label'] = $obj->taux . '%' . ($obj->code ? ' (' . $obj->code . ')' : ''); // Label must contains only 0-9 , . % or * |
6668
|
|
- $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 |
|
6667
|
+ $tmparray['label'] = $obj->taux.'%'.($obj->code ? ' ('.$obj->code.')' : ''); // Label must contains only 0-9 , . % or * |
|
6668
|
+ $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 |
6669
|
6669
|
$positiverates = ''; |
6670
|
6670
|
if ($obj->taux) { |
6671
|
|
- $positiverates .= ($positiverates ? '/' : '') . $obj->taux; |
|
6671
|
+ $positiverates .= ($positiverates ? '/' : '').$obj->taux; |
6672
|
6672
|
} |
6673
|
6673
|
if ($obj->localtax1) { |
6674
|
|
- $positiverates .= ($positiverates ? '/' : '') . $obj->localtax1; |
|
6674
|
+ $positiverates .= ($positiverates ? '/' : '').$obj->localtax1; |
6675
|
6675
|
} |
6676
|
6676
|
if ($obj->localtax2) { |
6677
|
|
- $positiverates .= ($positiverates ? '/' : '') . $obj->localtax2; |
|
6677
|
+ $positiverates .= ($positiverates ? '/' : '').$obj->localtax2; |
6678
|
6678
|
} |
6679
|
6679
|
if (empty($positiverates)) { |
6680
|
6680
|
$positiverates = '0'; |
6681
|
6681
|
} |
6682
|
|
- $tmparray['labelpositiverates'] = $positiverates . ($obj->code ? ' (' . $obj->code . ')' : ''); // Must never be used as key, only label |
|
6682
|
+ $tmparray['labelpositiverates'] = $positiverates.($obj->code ? ' ('.$obj->code.')' : ''); // Must never be used as key, only label |
6683
|
6683
|
|
6684
|
6684
|
$this->cache_vatrates[$obj->rowid] = $tmparray; |
6685
|
6685
|
} |
|
@@ -6699,7 +6699,7 @@ discard block |
|
|
block discarded – undo |
6699
|
6699
|
return -1; |
6700
|
6700
|
} |
6701
|
6701
|
} else { |
6702
|
|
- $this->error = '<span class="error">' . $this->db->error() . '</span>'; |
|
6702
|
+ $this->error = '<span class="error">'.$this->db->error().'</span>'; |
6703
|
6703
|
return -2; |
6704
|
6704
|
} |
6705
|
6705
|
} |
|
@@ -6752,9 +6752,9 @@ discard block |
|
|
block discarded – undo |
6752
|
6752
|
// Check parameters |
6753
|
6753
|
if (is_object($societe_vendeuse) && !$societe_vendeuse->country_code) { |
6754
|
6754
|
if ($societe_vendeuse->id == $mysoc->id) { |
6755
|
|
- $return .= '<span class="error">' . $langs->trans("ErrorYourCountryIsNotDefined") . '</span>'; |
|
6755
|
+ $return .= '<span class="error">'.$langs->trans("ErrorYourCountryIsNotDefined").'</span>'; |
6756
|
6756
|
} else { |
6757
|
|
- $return .= '<span class="error">' . $langs->trans("ErrorSupplierCountryIsNotDefined") . '</span>'; |
|
6757
|
+ $return .= '<span class="error">'.$langs->trans("ErrorSupplierCountryIsNotDefined").'</span>'; |
6758
|
6758
|
} |
6759
|
6759
|
return $return; |
6760
|
6760
|
} |
|
@@ -6766,12 +6766,12 @@ discard block |
|
|
block discarded – undo |
6766
|
6766
|
// Define list of countries to use to search VAT rates to show |
6767
|
6767
|
// First we defined code_country to use to find list |
6768
|
6768
|
if (is_object($societe_vendeuse)) { |
6769
|
|
- $code_country = "'" . $societe_vendeuse->country_code . "'"; |
|
6769
|
+ $code_country = "'".$societe_vendeuse->country_code."'"; |
6770
|
6770
|
} else { |
6771
|
|
- $code_country = "'" . $mysoc->country_code . "'"; // Pour compatibilite ascendente |
|
6771
|
+ $code_country = "'".$mysoc->country_code."'"; // Pour compatibilite ascendente |
6772
|
6772
|
} |
6773
|
6773
|
if (getDolGlobalString('SERVICE_ARE_ECOMMERCE_200238EC')) { // If option to have vat for end customer for services is on |
6774
|
|
- require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php'; |
|
6774
|
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; |
6775
|
6775
|
// If SERVICE_ARE_ECOMMERCE_200238EC=1 combo list vat rate of purchaser and seller countries |
6776
|
6776
|
// If SERVICE_ARE_ECOMMERCE_200238EC=2 combo list only the vat rate of the purchaser country |
6777
|
6777
|
$selectVatComboMode = getDolGlobalString('SERVICE_ARE_ECOMMERCE_200238EC'); |
|
@@ -6781,27 +6781,27 @@ discard block |
|
|
block discarded – undo |
6781
|
6781
|
if ($type == 1) { // We know product is a service |
6782
|
6782
|
switch ($selectVatComboMode) { |
6783
|
6783
|
case '1': |
6784
|
|
- $code_country .= ",'" . $societe_acheteuse->country_code . "'"; |
|
6784
|
+ $code_country .= ",'".$societe_acheteuse->country_code."'"; |
6785
|
6785
|
break; |
6786
|
6786
|
case '2': |
6787
|
|
- $code_country = "'" . $societe_acheteuse->country_code . "'"; |
|
6787
|
+ $code_country = "'".$societe_acheteuse->country_code."'"; |
6788
|
6788
|
break; |
6789
|
6789
|
} |
6790
|
6790
|
} |
6791
|
6791
|
} elseif (!$idprod) { // We don't know type of product |
6792
|
6792
|
switch ($selectVatComboMode) { |
6793
|
6793
|
case '1': |
6794
|
|
- $code_country .= ",'" . $societe_acheteuse->country_code . "'"; |
|
6794
|
+ $code_country .= ",'".$societe_acheteuse->country_code."'"; |
6795
|
6795
|
break; |
6796
|
6796
|
case '2': |
6797
|
|
- $code_country = "'" . $societe_acheteuse->country_code . "'"; |
|
6797
|
+ $code_country = "'".$societe_acheteuse->country_code."'"; |
6798
|
6798
|
break; |
6799
|
6799
|
} |
6800
|
6800
|
} else { |
6801
|
6801
|
$prodstatic = new Product($this->db); |
6802
|
6802
|
$prodstatic->fetch($idprod); |
6803
|
6803
|
if ($prodstatic->type == Product::TYPE_SERVICE) { // We know product is a service |
6804
|
|
- $code_country .= ",'" . $societe_acheteuse->country_code . "'"; |
|
6804
|
+ $code_country .= ",'".$societe_acheteuse->country_code."'"; |
6805
|
6805
|
} |
6806
|
6806
|
} |
6807
|
6807
|
} |
|
@@ -6863,13 +6863,13 @@ discard block |
|
|
block discarded – undo |
6863
|
6863
|
// Override/enable VAT for expense report regardless of global setting - needed if expense report used for business expenses instead |
6864
|
6864
|
// of using supplier invoices (this is a very bad idea !) |
6865
|
6865
|
if (!getDolGlobalString('EXPENSEREPORT_OVERRIDE_VAT')) { |
6866
|
|
- $title = ' title="' . dol_escape_htmltag($langs->trans('VATIsNotUsed')) . '"'; |
|
6866
|
+ $title = ' title="'.dol_escape_htmltag($langs->trans('VATIsNotUsed')).'"'; |
6867
|
6867
|
$disabled = true; |
6868
|
6868
|
} |
6869
|
6869
|
} |
6870
|
6870
|
|
6871
|
6871
|
if (!$options_only) { |
6872
|
|
- $return .= '<select class="flat minwidth75imp maxwidth100 right" id="' . $htmlname . '" name="' . $htmlname . '"' . ($disabled ? ' disabled' : '') . $title . '>'; |
|
6872
|
+ $return .= '<select class="flat minwidth75imp maxwidth100 right" id="'.$htmlname.'" name="'.$htmlname.'"'.($disabled ? ' disabled' : '').$title.'>'; |
6873
|
6873
|
} |
6874
|
6874
|
|
6875
|
6875
|
$selectedfound = false; |
|
@@ -6883,13 +6883,13 @@ discard block |
|
|
block discarded – undo |
6883
|
6883
|
$key = $rate['txtva']; |
6884
|
6884
|
$key .= $rate['nprtva'] ? '*' : ''; |
6885
|
6885
|
if ($mode > 0 && $rate['code']) { |
6886
|
|
- $key .= ' (' . $rate['code'] . ')'; |
|
6886
|
+ $key .= ' ('.$rate['code'].')'; |
6887
|
6887
|
} |
6888
|
6888
|
if ($mode < 0) { |
6889
|
6889
|
$key = $rate['rowid']; |
6890
|
6890
|
} |
6891
|
6891
|
|
6892
|
|
- $return .= '<option value="' . $key . '"'; |
|
6892
|
+ $return .= '<option value="'.$key.'"'; |
6893
|
6893
|
if (!$selectedfound) { |
6894
|
6894
|
if ($defaultcode) { // If defaultcode is defined, we used it in priority to select combo option instead of using rate+npr flag |
6895
|
6895
|
if ($defaultcode == $rate['code']) { |
|
@@ -6960,7 +6960,7 @@ discard block |
|
|
block discarded – undo |
6960
|
6960
|
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 = '') |
6961
|
6961
|
{ |
6962
|
6962
|
// phpcs:enable |
6963
|
|
- dol_syslog(__METHOD__ . ': using select_date is deprecated. Use selectDate instead.', LOG_WARNING); |
|
6963
|
+ dol_syslog(__METHOD__.': using select_date is deprecated. Use selectDate instead.', LOG_WARNING); |
6964
|
6964
|
$retstring = $this->selectDate($set_time, $prefix, $h, $m, $empty, $form_name, $d, $addnowlink, $disabled, $fullday, $addplusone, $adddateof); |
6965
|
6965
|
if (!empty($nooutput)) { |
6966
|
6966
|
return $retstring; |
|
@@ -6989,11 +6989,11 @@ discard block |
|
|
block discarded – undo |
6989
|
6989
|
{ |
6990
|
6990
|
global $langs; |
6991
|
6991
|
|
6992
|
|
- $ret = $this->selectDate($set_time, $prefix . '_start', 0, 0, $empty, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("from"), 'tzuserrel'); |
|
6992
|
+ $ret = $this->selectDate($set_time, $prefix.'_start', 0, 0, $empty, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("from"), 'tzuserrel'); |
6993
|
6993
|
if ($forcenewline) { |
6994
|
6994
|
$ret .= '<br>'; |
6995
|
6995
|
} |
6996
|
|
- $ret .= $this->selectDate($set_time_end, $prefix . '_end', 0, 0, $empty, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"), 'tzuserrel'); |
|
6996
|
+ $ret .= $this->selectDate($set_time_end, $prefix.'_end', 0, 0, $empty, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"), 'tzuserrel'); |
6997
|
6997
|
return $ret; |
6998
|
6998
|
} |
6999
|
6999
|
|
|
@@ -7059,7 +7059,7 @@ discard block |
|
|
block discarded – undo |
7059
|
7059
|
$orig_set_time = $set_time; |
7060
|
7060
|
|
7061
|
7061
|
if ($set_time === '' && $emptydate == 0) { |
7062
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php'; |
|
7062
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; |
7063
|
7063
|
if ($gm == 'tzuser' || $gm == 'tzuserrel') { |
7064
|
7064
|
$set_time = dol_now($gm); |
7065
|
7065
|
} else { |
|
@@ -7131,38 +7131,38 @@ discard block |
|
|
block discarded – undo |
7131
|
7131
|
// Calendrier popup version eldy |
7132
|
7132
|
if ($usecalendar == "eldy") { |
7133
|
7133
|
// Input area to enter date manually |
7134
|
|
- $retstring .= '<input id="' . $prefix . '" name="' . $prefix . '" type="text" class="maxwidthdate center" maxlength="11" value="' . $formated_date . '"'; |
|
7134
|
+ $retstring .= '<input id="'.$prefix.'" name="'.$prefix.'" type="text" class="maxwidthdate center" maxlength="11" value="'.$formated_date.'"'; |
7135
|
7135
|
$retstring .= ($disabled ? ' disabled' : ''); |
7136
|
|
- $retstring .= ' onChange="dpChangeDay(\'' . $prefix . '\',\'' . $langs->trans("FormatDateShortJavaInput") . '\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript |
|
7136
|
+ $retstring .= ' onChange="dpChangeDay(\''.$prefix.'\',\''.$langs->trans("FormatDateShortJavaInput").'\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript |
7137
|
7137
|
$retstring .= ' autocomplete="off">'; |
7138
|
7138
|
|
7139
|
7139
|
// Icon calendar |
7140
|
7140
|
$retstringbuttom = ''; |
7141
|
7141
|
if (!$disabled) { |
7142
|
|
- $retstringbuttom = '<button id="' . $prefix . 'Button" type="button" class="dpInvisibleButtons"'; |
7143
|
|
- $base = DOL_URL_ROOT . '/core/'; |
7144
|
|
- $retstringbuttom .= ' onClick="showDP(\'' . $base . '\',\'' . $prefix . '\',\'' . $langs->trans("FormatDateShortJavaInput") . '\',\'' . $langs->defaultlang . '\');"'; |
7145
|
|
- $retstringbuttom .= '>' . img_object($langs->trans("SelectDate"), 'calendarday', 'class="datecallink"') . '</button>'; |
|
7142
|
+ $retstringbuttom = '<button id="'.$prefix.'Button" type="button" class="dpInvisibleButtons"'; |
|
7143
|
+ $base = DOL_URL_ROOT.'/core/'; |
|
7144
|
+ $retstringbuttom .= ' onClick="showDP(\''.$base.'\',\''.$prefix.'\',\''.$langs->trans("FormatDateShortJavaInput").'\',\''.$langs->defaultlang.'\');"'; |
|
7145
|
+ $retstringbuttom .= '>'.img_object($langs->trans("SelectDate"), 'calendarday', 'class="datecallink"').'</button>'; |
7146
|
7146
|
} else { |
7147
|
|
- $retstringbuttom = '<button id="' . $prefix . 'Button" type="button" class="dpInvisibleButtons">' . img_object($langs->trans("Disabled"), 'calendarday', 'class="datecallink"') . '</button>'; |
|
7147
|
+ $retstringbuttom = '<button id="'.$prefix.'Button" type="button" class="dpInvisibleButtons">'.img_object($langs->trans("Disabled"), 'calendarday', 'class="datecallink"').'</button>'; |
7148
|
7148
|
} |
7149
|
|
- $retstring = $retstringbuttom . $retstring; |
|
7149
|
+ $retstring = $retstringbuttom.$retstring; |
7150
|
7150
|
|
7151
|
|
- $retstring .= '<input type="hidden" id="' . $prefix . 'day" name="' . $prefix . 'day" value="' . $sday . '">' . "\n"; |
7152
|
|
- $retstring .= '<input type="hidden" id="' . $prefix . 'month" name="' . $prefix . 'month" value="' . $smonth . '">' . "\n"; |
7153
|
|
- $retstring .= '<input type="hidden" id="' . $prefix . 'year" name="' . $prefix . 'year" value="' . $syear . '">' . "\n"; |
|
7151
|
+ $retstring .= '<input type="hidden" id="'.$prefix.'day" name="'.$prefix.'day" value="'.$sday.'">'."\n"; |
|
7152
|
+ $retstring .= '<input type="hidden" id="'.$prefix.'month" name="'.$prefix.'month" value="'.$smonth.'">'."\n"; |
|
7153
|
+ $retstring .= '<input type="hidden" id="'.$prefix.'year" name="'.$prefix.'year" value="'.$syear.'">'."\n"; |
7154
|
7154
|
} elseif ($usecalendar == 'jquery' || $usecalendar == 'html') { |
7155
|
7155
|
if (!$disabled && $usecalendar != 'html') { |
7156
|
7156
|
// Output javascript for datepicker |
7157
|
7157
|
$minYear = getDolGlobalInt('MIN_YEAR_SELECT_DATE', (idate('Y') - 100)); |
7158
|
7158
|
$maxYear = getDolGlobalInt('MAX_YEAR_SELECT_DATE', (idate('Y') + 100)); |
7159
|
7159
|
|
7160
|
|
- $retstring .= '<script nonce="' . getNonce() . '" type="text/javascript">'; |
7161
|
|
- $retstring .= "$(function(){ $('#" . $prefix . "').datepicker({ |
7162
|
|
- dateFormat: '" . $langs->trans("FormatDateShortJQueryInput") . "', |
|
7160
|
+ $retstring .= '<script nonce="'.getNonce().'" type="text/javascript">'; |
|
7161
|
+ $retstring .= "$(function(){ $('#".$prefix."').datepicker({ |
|
7162
|
+ dateFormat: '" . $langs->trans("FormatDateShortJQueryInput")."', |
7163
|
7163
|
autoclose: true, |
7164
|
7164
|
todayHighlight: true, |
7165
|
|
- yearRange: '" . $minYear . ":" . $maxYear . "',"; |
|
7165
|
+ yearRange: '" . $minYear.":".$maxYear."',"; |
7166
|
7166
|
if (!empty($conf->dol_use_jmobile)) { |
7167
|
7167
|
$retstring .= " |
7168
|
7168
|
beforeShow: function (input, datePicker) { |
|
@@ -7177,7 +7177,7 @@ discard block |
|
|
block discarded – undo |
7177
|
7177
|
if (!getDolGlobalString('MAIN_POPUP_CALENDAR_ON_FOCUS')) { |
7178
|
7178
|
$retstring .= " |
7179
|
7179
|
showOn: 'button', /* both has problem with autocompletion */ |
7180
|
|
- buttonImage: '" . DOL_URL_ROOT . "/theme/" . dol_escape_js($conf->theme) . "/img/object_calendarday.png', |
|
7180
|
+ buttonImage: '" . DOL_URL_ROOT."/theme/".dol_escape_js($conf->theme)."/img/object_calendarday.png', |
7181
|
7181
|
buttonImageOnly: true"; |
7182
|
7182
|
} |
7183
|
7183
|
$retstring .= " |
|
@@ -7189,46 +7189,46 @@ discard block |
|
|
block discarded – undo |
7189
|
7189
|
$retstring .= '<div class="nowraponall inline-block divfordateinput">'; |
7190
|
7190
|
$retstring .= '<input id="'.$prefix.'" name="'.$prefix.'" type="text" class="maxwidthdate center" maxlength="11" value="'.$formated_date.'"'; |
7191
|
7191
|
$retstring .= ($disabled ? ' disabled' : ''); |
7192
|
|
- $retstring .= ($placeholder ? ' placeholder="' . dol_escape_htmltag($placeholder) . '"' : ''); |
7193
|
|
- $retstring .= ' onChange="dpChangeDay(\'' . dol_escape_js($prefix) . '\',\'' . dol_escape_js($langs->trans("FormatDateShortJavaInput")) . '\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript |
|
7192
|
+ $retstring .= ($placeholder ? ' placeholder="'.dol_escape_htmltag($placeholder).'"' : ''); |
|
7193
|
+ $retstring .= ' onChange="dpChangeDay(\''.dol_escape_js($prefix).'\',\''.dol_escape_js($langs->trans("FormatDateShortJavaInput")).'\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript |
7194
|
7194
|
$retstring .= ' autocomplete="off">'; |
7195
|
7195
|
|
7196
|
7196
|
// Icone calendrier |
7197
|
7197
|
if ($disabled) { |
7198
|
|
- $retstringbutton = '<button id="' . $prefix . 'Button" type="button" class="dpInvisibleButtons">' . img_object($langs->trans("Disabled"), 'calendarday', 'class="datecallink"') . '</button>'; |
7199
|
|
- $retstring = $retstringbutton . $retstring; |
|
7198
|
+ $retstringbutton = '<button id="'.$prefix.'Button" type="button" class="dpInvisibleButtons">'.img_object($langs->trans("Disabled"), 'calendarday', 'class="datecallink"').'</button>'; |
|
7199
|
+ $retstring = $retstringbutton.$retstring; |
7200
|
7200
|
} |
7201
|
7201
|
|
7202
|
7202
|
$retstring .= '</div>'; |
7203
|
|
- $retstring .= '<input type="hidden" id="' . $prefix . 'day" name="' . $prefix . 'day" value="' . $sday . '">' . "\n"; |
7204
|
|
- $retstring .= '<input type="hidden" id="' . $prefix . 'month" name="' . $prefix . 'month" value="' . $smonth . '">' . "\n"; |
7205
|
|
- $retstring .= '<input type="hidden" id="' . $prefix . 'year" name="' . $prefix . 'year" value="' . $syear . '">' . "\n"; |
|
7203
|
+ $retstring .= '<input type="hidden" id="'.$prefix.'day" name="'.$prefix.'day" value="'.$sday.'">'."\n"; |
|
7204
|
+ $retstring .= '<input type="hidden" id="'.$prefix.'month" name="'.$prefix.'month" value="'.$smonth.'">'."\n"; |
|
7205
|
+ $retstring .= '<input type="hidden" id="'.$prefix.'year" name="'.$prefix.'year" value="'.$syear.'">'."\n"; |
7206
|
7206
|
} else { |
7207
|
7207
|
$retstring .= "Bad value of MAIN_POPUP_CALENDAR"; |
7208
|
7208
|
} |
7209
|
7209
|
} else { |
7210
|
7210
|
// Show date with combo selects |
7211
|
7211
|
// Day |
7212
|
|
- $retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth50imp" id="' . $prefix . 'day" name="' . $prefix . 'day">'; |
|
7212
|
+ $retstring .= '<select'.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth50imp" id="'.$prefix.'day" name="'.$prefix.'day">'; |
7213
|
7213
|
|
7214
|
7214
|
if ($emptydate || $set_time == -1) { |
7215
|
7215
|
$retstring .= '<option value="0" selected> </option>'; |
7216
|
7216
|
} |
7217
|
7217
|
|
7218
|
7218
|
for ($day = 1; $day <= 31; $day++) { |
7219
|
|
- $retstring .= '<option value="' . $day . '"' . ($day == $sday ? ' selected' : '') . '>' . $day . '</option>'; |
|
7219
|
+ $retstring .= '<option value="'.$day.'"'.($day == $sday ? ' selected' : '').'>'.$day.'</option>'; |
7220
|
7220
|
} |
7221
|
7221
|
|
7222
|
7222
|
$retstring .= "</select>"; |
7223
|
7223
|
|
7224
|
|
- $retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth75imp" id="' . $prefix . 'month" name="' . $prefix . 'month">'; |
|
7224
|
+ $retstring .= '<select'.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth75imp" id="'.$prefix.'month" name="'.$prefix.'month">'; |
7225
|
7225
|
if ($emptydate || $set_time == -1) { |
7226
|
7226
|
$retstring .= '<option value="0" selected> </option>'; |
7227
|
7227
|
} |
7228
|
7228
|
|
7229
|
7229
|
// Month |
7230
|
7230
|
for ($month = 1; $month <= 12; $month++) { |
7231
|
|
- $retstring .= '<option value="' . $month . '"' . ($month == $smonth ? ' selected' : '') . '>'; |
|
7231
|
+ $retstring .= '<option value="'.$month.'"'.($month == $smonth ? ' selected' : '').'>'; |
7232
|
7232
|
$retstring .= dol_print_date(mktime(12, 0, 0, $month, 1, 2000), "%b"); |
7233
|
7233
|
$retstring .= "</option>"; |
7234
|
7234
|
} |
|
@@ -7236,13 +7236,13 @@ discard block |
|
|
block discarded – undo |
7236
|
7236
|
|
7237
|
7237
|
// Year |
7238
|
7238
|
if ($emptydate || $set_time == -1) { |
7239
|
|
- $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 . '">'; |
|
7239
|
+ $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.'">'; |
7240
|
7240
|
} else { |
7241
|
|
- $retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth75imp" id="' . $prefix . 'year" name="' . $prefix . 'year">'; |
|
7241
|
+ $retstring .= '<select'.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth75imp" id="'.$prefix.'year" name="'.$prefix.'year">'; |
7242
|
7242
|
|
7243
|
7243
|
$syear = (int) $syear; |
7244
|
7244
|
for ($year = $syear - 10; $year < (int) $syear + 10; $year++) { |
7245
|
|
- $retstring .= '<option value="' . $year . '"' . ($year == $syear ? ' selected' : '') . '>' . $year . '</option>'; |
|
7245
|
+ $retstring .= '<option value="'.$year.'"'.($year == $syear ? ' selected' : '').'>'.$year.'</option>'; |
7246
|
7246
|
} |
7247
|
7247
|
$retstring .= "</select>\n"; |
7248
|
7248
|
} |
|
@@ -7266,15 +7266,15 @@ discard block |
|
|
block discarded – undo |
7266
|
7266
|
} |
7267
|
7267
|
} |
7268
|
7268
|
// Show hour |
7269
|
|
- $retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth50 ' . ($fullday ? $fullday . 'hour' : '') . '" id="' . $prefix . 'hour" name="' . $prefix . 'hour">'; |
|
7269
|
+ $retstring .= '<select'.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth50 '.($fullday ? $fullday.'hour' : '').'" id="'.$prefix.'hour" name="'.$prefix.'hour">'; |
7270
|
7270
|
if ($emptyhours) { |
7271
|
7271
|
$retstring .= '<option value="-1"> </option>'; |
7272
|
7272
|
} |
7273
|
7273
|
for ($hour = $hourstart; $hour < $hourend; $hour++) { |
7274
|
7274
|
if (strlen($hour) < 2) { |
7275
|
|
- $hour = "0" . $hour; |
|
7275
|
+ $hour = "0".$hour; |
7276
|
7276
|
} |
7277
|
|
- $retstring .= '<option value="' . $hour . '"' . (($hour == $shour) ? ' selected' : '') . '>' . $hour; |
|
7277
|
+ $retstring .= '<option value="'.$hour.'"'.(($hour == $shour) ? ' selected' : '').'>'.$hour; |
7278
|
7278
|
//$retstring .= (empty($conf->dol_optimize_smallscreen) ? '' : 'H'); |
7279
|
7279
|
$retstring .= '</option>'; |
7280
|
7280
|
} |
|
@@ -7287,17 +7287,17 @@ discard block |
|
|
block discarded – undo |
7287
|
7287
|
|
7288
|
7288
|
if ($m) { |
7289
|
7289
|
// Show minutes |
7290
|
|
- $retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth50 ' . ($fullday ? $fullday . 'min' : '') . '" id="' . $prefix . 'min" name="' . $prefix . 'min">'; |
|
7290
|
+ $retstring .= '<select'.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth50 '.($fullday ? $fullday.'min' : '').'" id="'.$prefix.'min" name="'.$prefix.'min">'; |
7291
|
7291
|
if ($emptyhours) { |
7292
|
7292
|
$retstring .= '<option value="-1"> </option>'; |
7293
|
7293
|
} |
7294
|
7294
|
for ($min = 0; $min < 60; $min += $stepminutes) { |
7295
|
7295
|
$min_str = sprintf("%02d", $min); |
7296
|
|
- $retstring .= '<option value="' . $min_str . '"' . (($min_str == $smin) ? ' selected' : '') . '>' . $min_str . '</option>'; |
|
7296
|
+ $retstring .= '<option value="'.$min_str.'"'.(($min_str == $smin) ? ' selected' : '').'>'.$min_str.'</option>'; |
7297
|
7297
|
} |
7298
|
7298
|
$retstring .= '</select>'; |
7299
|
7299
|
|
7300
|
|
- $retstring .= '<input type="hidden" name="' . $prefix . 'sec" value="' . $ssec . '">'; |
|
7300
|
+ $retstring .= '<input type="hidden" name="'.$prefix.'sec" value="'.$ssec.'">'; |
7301
|
7301
|
} |
7302
|
7302
|
|
7303
|
7303
|
if ($d && $h) { |
|
@@ -7320,10 +7320,10 @@ discard block |
|
|
block discarded – undo |
7320
|
7320
|
|
7321
|
7321
|
// Generate the date part, depending on the use or not of the javascript calendar |
7322
|
7322
|
if ($addnowlink == 1) { // server time expressed in user time setup |
7323
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . '\').val(\'' . dol_print_date($nowgmt, 'day', 'tzuserrel') . '\');'; |
7324
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'day\').val(\'' . dol_print_date($nowgmt, '%d', 'tzuserrel') . '\');'; |
7325
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'month\').val(\'' . dol_print_date($nowgmt, '%m', 'tzuserrel') . '\');'; |
7326
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'year\').val(\'' . dol_print_date($nowgmt, '%Y', 'tzuserrel') . '\');'; |
|
7323
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'\').val(\''.dol_print_date($nowgmt, 'day', 'tzuserrel').'\');'; |
|
7324
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'day\').val(\''.dol_print_date($nowgmt, '%d', 'tzuserrel').'\');'; |
|
7325
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(\''.dol_print_date($nowgmt, '%m', 'tzuserrel').'\');'; |
|
7326
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(\''.dol_print_date($nowgmt, '%Y', 'tzuserrel').'\');'; |
7327
|
7327
|
} elseif ($addnowlink == 2) { |
7328
|
7328
|
/* Disabled because the output does not use the string format defined by FormatDateShort key to forge the value into #prefix. |
7329
|
7329
|
* This break application for foreign languages. |
|
@@ -7332,10 +7332,10 @@ discard block |
|
|
block discarded – undo |
7332
|
7332
|
$reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(parseInt(d.getMonth().pad()) + 1);'; |
7333
|
7333
|
$reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(d.getFullYear());'; |
7334
|
7334
|
*/ |
7335
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . '\').val(\'' . dol_print_date($nowgmt, 'day', 'tzuserrel') . '\');'; |
7336
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'day\').val(\'' . dol_print_date($nowgmt, '%d', 'tzuserrel') . '\');'; |
7337
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'month\').val(\'' . dol_print_date($nowgmt, '%m', 'tzuserrel') . '\');'; |
7338
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'year\').val(\'' . dol_print_date($nowgmt, '%Y', 'tzuserrel') . '\');'; |
|
7335
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'\').val(\''.dol_print_date($nowgmt, 'day', 'tzuserrel').'\');'; |
|
7336
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'day\').val(\''.dol_print_date($nowgmt, '%d', 'tzuserrel').'\');'; |
|
7337
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(\''.dol_print_date($nowgmt, '%m', 'tzuserrel').'\');'; |
|
7338
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(\''.dol_print_date($nowgmt, '%Y', 'tzuserrel').'\');'; |
7339
|
7339
|
} |
7340
|
7340
|
/*if ($usecalendar == "eldy") |
7341
|
7341
|
{ |
|
@@ -7355,11 +7355,11 @@ discard block |
|
|
block discarded – undo |
7355
|
7355
|
} |
7356
|
7356
|
//$reset_scripts .= 'this.form.elements[\''.$prefix.'hour\'].value=formatDate(new Date(), \'HH\'); '; |
7357
|
7357
|
if ($addnowlink == 1) { |
7358
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'hour\').val(\'' . dol_print_date($nowgmt, '%H', 'tzuserrel') . '\');'; |
7359
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'hour\').change();'; |
|
7358
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').val(\''.dol_print_date($nowgmt, '%H', 'tzuserrel').'\');'; |
|
7359
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').change();'; |
7360
|
7360
|
} elseif ($addnowlink == 2) { |
7361
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'hour\').val(d.getHours().pad());'; |
7362
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'hour\').change();'; |
|
7361
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').val(d.getHours().pad());'; |
|
7362
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').change();'; |
7363
|
7363
|
} |
7364
|
7364
|
|
7365
|
7365
|
if ($fullday) { |
|
@@ -7373,11 +7373,11 @@ discard block |
|
|
block discarded – undo |
7373
|
7373
|
} |
7374
|
7374
|
//$reset_scripts .= 'this.form.elements[\''.$prefix.'min\'].value=formatDate(new Date(), \'mm\'); '; |
7375
|
7375
|
if ($addnowlink == 1) { |
7376
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'min\').val(\'' . dol_print_date($nowgmt, '%M', 'tzuserrel') . '\');'; |
7377
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'min\').change();'; |
|
7376
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'min\').val(\''.dol_print_date($nowgmt, '%M', 'tzuserrel').'\');'; |
|
7377
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'min\').change();'; |
7378
|
7378
|
} elseif ($addnowlink == 2) { |
7379
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'min\').val(d.getMinutes().pad());'; |
7380
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'min\').change();'; |
|
7379
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'min\').val(d.getMinutes().pad());'; |
|
7380
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'min\').change();'; |
7381
|
7381
|
} |
7382
|
7382
|
if ($fullday) { |
7383
|
7383
|
$reset_scripts .= ' } '; |
|
@@ -7385,7 +7385,7 @@ discard block |
|
|
block discarded – undo |
7385
|
7385
|
} |
7386
|
7386
|
// If reset_scripts is not empty, print the link with the reset_scripts in the onClick |
7387
|
7387
|
if ($reset_scripts && !getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) { |
7388
|
|
- $retstring .= ' <button class="dpInvisibleButtons datenowlink" id="' . $prefix . 'ButtonNow" type="button" name="_useless" value="now" onClick="' . $reset_scripts . '">'; |
|
7388
|
+ $retstring .= ' <button class="dpInvisibleButtons datenowlink" id="'.$prefix.'ButtonNow" type="button" name="_useless" value="now" onClick="'.$reset_scripts.'">'; |
7389
|
7389
|
$retstring .= $langs->trans("Now"); |
7390
|
7390
|
$retstring .= '</button> '; |
7391
|
7391
|
} |
|
@@ -7397,16 +7397,16 @@ discard block |
|
|
block discarded – undo |
7397
|
7397
|
$reset_scripts = ""; |
7398
|
7398
|
|
7399
|
7399
|
// Generate the date part, depending on the use or not of the javascript calendar |
7400
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . '\').val(\'' . dol_print_date($nowgmt, 'dayinputnoreduce', 'tzuserrel') . '\');'; |
7401
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'day\').val(\'' . dol_print_date($nowgmt, '%d', 'tzuserrel') . '\');'; |
7402
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'month\').val(\'' . dol_print_date($nowgmt, '%m', 'tzuserrel') . '\');'; |
7403
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'year\').val(\'' . dol_print_date($nowgmt, '%Y', 'tzuserrel') . '\');'; |
|
7400
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'\').val(\''.dol_print_date($nowgmt, 'dayinputnoreduce', 'tzuserrel').'\');'; |
|
7401
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'day\').val(\''.dol_print_date($nowgmt, '%d', 'tzuserrel').'\');'; |
|
7402
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(\''.dol_print_date($nowgmt, '%m', 'tzuserrel').'\');'; |
|
7403
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(\''.dol_print_date($nowgmt, '%Y', 'tzuserrel').'\');'; |
7404
|
7404
|
// Update the hour part |
7405
|
7405
|
if ($h) { |
7406
|
7406
|
if ($fullday) { |
7407
|
7407
|
$reset_scripts .= " if (jQuery('#fullday:checked').val() == null) {"; |
7408
|
7408
|
} |
7409
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'hour\').val(\'' . dol_print_date($nowgmt, '%H', 'tzuserrel') . '\');'; |
|
7409
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').val(\''.dol_print_date($nowgmt, '%H', 'tzuserrel').'\');'; |
7410
|
7410
|
if ($fullday) { |
7411
|
7411
|
$reset_scripts .= ' } '; |
7412
|
7412
|
} |
|
@@ -7416,14 +7416,14 @@ discard block |
|
|
block discarded – undo |
7416
|
7416
|
if ($fullday) { |
7417
|
7417
|
$reset_scripts .= " if (jQuery('#fullday:checked').val() == null) {"; |
7418
|
7418
|
} |
7419
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'min\').val(\'' . dol_print_date($nowgmt, '%M', 'tzuserrel') . '\');'; |
|
7419
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'min\').val(\''.dol_print_date($nowgmt, '%M', 'tzuserrel').'\');'; |
7420
|
7420
|
if ($fullday) { |
7421
|
7421
|
$reset_scripts .= ' } '; |
7422
|
7422
|
} |
7423
|
7423
|
} |
7424
|
7424
|
// If reset_scripts is not empty, print the link with the reset_scripts in the onClick |
7425
|
7425
|
if ($reset_scripts && empty($conf->dol_optimize_smallscreen)) { |
7426
|
|
- $retstring .= ' <button class="dpInvisibleButtons datenowlink" id="' . $prefix . 'ButtonPlusOne" type="button" name="_useless2" value="plusone" onClick="' . $reset_scripts . '">'; |
|
7426
|
+ $retstring .= ' <button class="dpInvisibleButtons datenowlink" id="'.$prefix.'ButtonPlusOne" type="button" name="_useless2" value="plusone" onClick="'.$reset_scripts.'">'; |
7427
|
7427
|
$retstring .= $langs->trans("DateStartPlusOne"); |
7428
|
7428
|
$retstring .= '</button> '; |
7429
|
7429
|
} |
|
@@ -7481,17 +7481,17 @@ discard block |
|
|
block discarded – undo |
7481
|
7481
|
unset($TDurationTypes[$value]); |
7482
|
7482
|
} |
7483
|
7483
|
|
7484
|
|
- $retstring = '<select class="flat minwidth75 maxwidth100" id="select_' . $prefix . 'type_duration" name="' . $prefix . 'type_duration">'; |
|
7484
|
+ $retstring = '<select class="flat minwidth75 maxwidth100" id="select_'.$prefix.'type_duration" name="'.$prefix.'type_duration">'; |
7485
|
7485
|
foreach ($TDurationTypes as $key => $typeduration) { |
7486
|
|
- $retstring .= '<option value="' . $key . '"'; |
|
7486
|
+ $retstring .= '<option value="'.$key.'"'; |
7487
|
7487
|
if ($key == $selected) { |
7488
|
7488
|
$retstring .= " selected"; |
7489
|
7489
|
} |
7490
|
|
- $retstring .= ">" . $typeduration . "</option>"; |
|
7490
|
+ $retstring .= ">".$typeduration."</option>"; |
7491
|
7491
|
} |
7492
|
7492
|
$retstring .= "</select>"; |
7493
|
7493
|
|
7494
|
|
- $retstring .= ajax_combobox('select_' . $prefix . 'type_duration'); |
|
7494
|
+ $retstring .= ajax_combobox('select_'.$prefix.'type_duration'); |
7495
|
7495
|
|
7496
|
7496
|
return $retstring; |
7497
|
7497
|
} |
|
@@ -7523,30 +7523,30 @@ discard block |
|
|
block discarded – undo |
7523
|
7523
|
|
7524
|
7524
|
// Hours |
7525
|
7525
|
if ($iSecond != '') { |
7526
|
|
- require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php'; |
|
7526
|
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; |
7527
|
7527
|
|
7528
|
7528
|
$hourSelected = convertSecondToTime($iSecond, 'allhour'); |
7529
|
7529
|
$minSelected = convertSecondToTime($iSecond, 'min'); |
7530
|
7530
|
} |
7531
|
7531
|
|
7532
|
7532
|
if ($typehour == 'select') { |
7533
|
|
- $retstring .= '<select class="flat" id="select_' . $prefix . 'hour" name="' . $prefix . 'hour"' . ($disabled ? ' disabled' : '') . '>'; |
|
7533
|
+ $retstring .= '<select class="flat" id="select_'.$prefix.'hour" name="'.$prefix.'hour"'.($disabled ? ' disabled' : '').'>'; |
7534
|
7534
|
for ($hour = 0; $hour < 25; $hour++) { // For a duration, we allow 24 hours |
7535
|
|
- $retstring .= '<option value="' . $hour . '"'; |
|
7535
|
+ $retstring .= '<option value="'.$hour.'"'; |
7536
|
7536
|
if (is_numeric($hourSelected) && $hourSelected == $hour) { |
7537
|
7537
|
$retstring .= " selected"; |
7538
|
7538
|
} |
7539
|
|
- $retstring .= ">" . $hour . "</option>"; |
|
7539
|
+ $retstring .= ">".$hour."</option>"; |
7540
|
7540
|
} |
7541
|
7541
|
$retstring .= "</select>"; |
7542
|
7542
|
} elseif ($typehour == 'text' || $typehour == 'textselect') { |
7543
|
|
- $retstring .= '<input placeholder="' . $langs->trans('HourShort') . '" type="number" min="0" name="' . $prefix . 'hour"' . ($disabled ? ' disabled' : '') . ' class="flat maxwidth50 inputhour right" value="' . (($hourSelected != '') ? ((int) $hourSelected) : '') . '">'; |
|
7543
|
+ $retstring .= '<input placeholder="'.$langs->trans('HourShort').'" type="number" min="0" name="'.$prefix.'hour"'.($disabled ? ' disabled' : '').' class="flat maxwidth50 inputhour right" value="'.(($hourSelected != '') ? ((int) $hourSelected) : '').'">'; |
7544
|
7544
|
} else { |
7545
|
7545
|
return 'BadValueForParameterTypeHour'; |
7546
|
7546
|
} |
7547
|
7547
|
|
7548
|
7548
|
if ($typehour != 'text') { |
7549
|
|
- $retstring .= ' ' . $langs->trans('HourShort'); |
|
7549
|
+ $retstring .= ' '.$langs->trans('HourShort'); |
7550
|
7550
|
} else { |
7551
|
7551
|
$retstring .= '<span class="">:</span>'; |
7552
|
7552
|
} |
|
@@ -7561,21 +7561,21 @@ discard block |
|
|
block discarded – undo |
7561
|
7561
|
} |
7562
|
7562
|
|
7563
|
7563
|
if ($typehour == 'select' || $typehour == 'textselect') { |
7564
|
|
- $retstring .= '<select class="flat" id="select_' . $prefix . 'min" name="' . $prefix . 'min"' . ($disabled ? ' disabled' : '') . '>'; |
|
7564
|
+ $retstring .= '<select class="flat" id="select_'.$prefix.'min" name="'.$prefix.'min"'.($disabled ? ' disabled' : '').'>'; |
7565
|
7565
|
for ($min = 0; $min <= 55; $min += 5) { |
7566
|
|
- $retstring .= '<option value="' . $min . '"'; |
|
7566
|
+ $retstring .= '<option value="'.$min.'"'; |
7567
|
7567
|
if (is_numeric($minSelected) && $minSelected == $min) { |
7568
|
7568
|
$retstring .= ' selected'; |
7569
|
7569
|
} |
7570
|
|
- $retstring .= '>' . $min . '</option>'; |
|
7570
|
+ $retstring .= '>'.$min.'</option>'; |
7571
|
7571
|
} |
7572
|
7572
|
$retstring .= "</select>"; |
7573
|
7573
|
} elseif ($typehour == 'text') { |
7574
|
|
- $retstring .= '<input placeholder="' . $langs->trans('MinuteShort') . '" type="number" min="0" name="' . $prefix . 'min"' . ($disabled ? ' disabled' : '') . ' class="flat maxwidth50 inputminute right" value="' . (($minSelected != '') ? ((int) $minSelected) : '') . '">'; |
|
7574
|
+ $retstring .= '<input placeholder="'.$langs->trans('MinuteShort').'" type="number" min="0" name="'.$prefix.'min"'.($disabled ? ' disabled' : '').' class="flat maxwidth50 inputminute right" value="'.(($minSelected != '') ? ((int) $minSelected) : '').'">'; |
7575
|
7575
|
} |
7576
|
7576
|
|
7577
|
7577
|
if ($typehour != 'text') { |
7578
|
|
- $retstring .= ' ' . $langs->trans('MinuteShort'); |
|
7578
|
+ $retstring .= ' '.$langs->trans('MinuteShort'); |
7579
|
7579
|
} |
7580
|
7580
|
|
7581
|
7581
|
$retstring .= "</span>"; |
|
@@ -7623,7 +7623,7 @@ discard block |
|
|
block discarded – undo |
7623
|
7623
|
$placeholder = ''; |
7624
|
7624
|
|
7625
|
7625
|
if ($selected && empty($selected_input_value)) { |
7626
|
|
- require_once DOL_DOCUMENT_ROOT . '/ticket/class/ticket.class.php'; |
|
7626
|
+ require_once DOL_DOCUMENT_ROOT.'/ticket/class/ticket.class.php'; |
7627
|
7627
|
$tickettmpselect = new Ticket($this->db); |
7628
|
7628
|
$tickettmpselect->fetch($selected); |
7629
|
7629
|
$selected_input_value = $tickettmpselect->ref; |
|
@@ -7631,17 +7631,17 @@ discard block |
|
|
block discarded – undo |
7631
|
7631
|
} |
7632
|
7632
|
|
7633
|
7633
|
$urloption = ''; |
7634
|
|
- $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/ticket/ajax/tickets.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions); |
|
7634
|
+ $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/ticket/ajax/tickets.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions); |
7635
|
7635
|
|
7636
|
7636
|
if (empty($hidelabel)) { |
7637
|
|
- $out .= $langs->trans("RefOrLabel") . ' : '; |
|
7637
|
+ $out .= $langs->trans("RefOrLabel").' : '; |
7638
|
7638
|
} elseif ($hidelabel > 1) { |
7639
|
|
- $placeholder = ' placeholder="' . $langs->trans("RefOrLabel") . '"'; |
|
7639
|
+ $placeholder = ' placeholder="'.$langs->trans("RefOrLabel").'"'; |
7640
|
7640
|
if ($hidelabel == 2) { |
7641
|
7641
|
$out .= img_picto($langs->trans("Search"), 'search'); |
7642
|
7642
|
} |
7643
|
7643
|
} |
7644
|
|
- $out .= '<input type="text" class="minwidth100" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . $placeholder . ' ' . (getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '') . ' />'; |
|
7644
|
+ $out .= '<input type="text" class="minwidth100" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' '.(getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '').' />'; |
7645
|
7645
|
if ($hidelabel == 3) { |
7646
|
7646
|
$out .= img_picto($langs->trans("Search"), 'search'); |
7647
|
7647
|
} |
|
@@ -7685,8 +7685,8 @@ discard block |
|
|
block discarded – undo |
7685
|
7685
|
|
7686
|
7686
|
$sql = "SELECT "; |
7687
|
7687
|
$sql .= $selectFields; |
7688
|
|
- $sql .= " FROM " . $this->db->prefix() . "ticket as p"; |
7689
|
|
- $sql .= ' WHERE p.entity IN (' . getEntity('ticket') . ')'; |
|
7688
|
+ $sql .= " FROM ".$this->db->prefix()."ticket as p"; |
|
7689
|
+ $sql .= ' WHERE p.entity IN ('.getEntity('ticket').')'; |
7690
|
7690
|
|
7691
|
7691
|
// Add criteria on ref/label |
7692
|
7692
|
if ($filterkey != '') { |
|
@@ -7702,7 +7702,7 @@ discard block |
|
|
block discarded – undo |
7702
|
7702
|
if ($i > 0) { |
7703
|
7703
|
$sql .= " AND "; |
7704
|
7704
|
} |
7705
|
|
- $sql .= "(p.ref LIKE '" . $this->db->escape($prefix . $crit) . "%' OR p.subject LIKE '" . $this->db->escape($prefix . $crit) . "%'"; |
|
7705
|
+ $sql .= "(p.ref LIKE '".$this->db->escape($prefix.$crit)."%' OR p.subject LIKE '".$this->db->escape($prefix.$crit)."%'"; |
7706
|
7706
|
$sql .= ")"; |
7707
|
7707
|
$i++; |
7708
|
7708
|
} |
|
@@ -7715,22 +7715,22 @@ discard block |
|
|
block discarded – undo |
7715
|
7715
|
$sql .= $this->db->plimit($limit, 0); |
7716
|
7716
|
|
7717
|
7717
|
// Build output string |
7718
|
|
- dol_syslog(get_class($this) . "::selectTicketsList search tickets", LOG_DEBUG); |
|
7718
|
+ dol_syslog(get_class($this)."::selectTicketsList search tickets", LOG_DEBUG); |
7719
|
7719
|
$result = $this->db->query($sql); |
7720
|
7720
|
if ($result) { |
7721
|
|
- require_once DOL_DOCUMENT_ROOT . '/ticket/class/ticket.class.php'; |
7722
|
|
- require_once DOL_DOCUMENT_ROOT . '/core/lib/ticket.lib.php'; |
|
7721
|
+ require_once DOL_DOCUMENT_ROOT.'/ticket/class/ticket.class.php'; |
|
7722
|
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/ticket.lib.php'; |
7723
|
7723
|
|
7724
|
7724
|
$num = $this->db->num_rows($result); |
7725
|
7725
|
|
7726
|
7726
|
$events = array(); |
7727
|
7727
|
|
7728
|
7728
|
if (!$forcecombo) { |
7729
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
7729
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
7730
|
7730
|
$out .= ajax_combobox($htmlname, $events, getDolGlobalInt('TICKET_USE_SEARCH_TO_SELECT')); |
7731
|
7731
|
} |
7732
|
7732
|
|
7733
|
|
- $out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">'; |
|
7733
|
+ $out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">'; |
7734
|
7734
|
|
7735
|
7735
|
$textifempty = ''; |
7736
|
7736
|
// Do not use textifempty = ' ' or ' ' here, or search on key will search on ' key'. |
|
@@ -7747,7 +7747,7 @@ discard block |
|
|
block discarded – undo |
7747
|
7747
|
} |
7748
|
7748
|
} |
7749
|
7749
|
if ($showempty) { |
7750
|
|
- $out .= '<option value="0" selected>' . $textifempty . '</option>'; |
|
7750
|
+ $out .= '<option value="0" selected>'.$textifempty.'</option>'; |
7751
|
7751
|
} |
7752
|
7752
|
|
7753
|
7753
|
$i = 0; |
|
@@ -7801,13 +7801,13 @@ discard block |
|
|
block discarded – undo |
7801
|
7801
|
$outkey = $objp->rowid; |
7802
|
7802
|
$outref = $objp->ref; |
7803
|
7803
|
|
7804
|
|
- $opt = '<option value="' . $objp->rowid . '"'; |
|
7804
|
+ $opt = '<option value="'.$objp->rowid.'"'; |
7805
|
7805
|
$opt .= ($objp->rowid == $selected) ? ' selected' : ''; |
7806
|
7806
|
$opt .= '>'; |
7807
|
7807
|
$opt .= $objp->ref; |
7808
|
7808
|
$objRef = $objp->ref; |
7809
|
7809
|
if (!empty($filterkey) && $filterkey != '') { |
7810
|
|
- $objRef = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $objRef, 1); |
|
7810
|
+ $objRef = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $objRef, 1); |
7811
|
7811
|
} |
7812
|
7812
|
|
7813
|
7813
|
$opt .= "</option>\n"; |
|
@@ -7848,7 +7848,7 @@ discard block |
|
|
block discarded – undo |
7848
|
7848
|
$placeholder = ''; |
7849
|
7849
|
|
7850
|
7850
|
if ($selected && empty($selected_input_value)) { |
7851
|
|
- require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; |
|
7851
|
+ require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; |
7852
|
7852
|
$projecttmpselect = new Project($this->db); |
7853
|
7853
|
$projecttmpselect->fetch($selected); |
7854
|
7854
|
$selected_input_value = $projecttmpselect->ref; |
|
@@ -7856,17 +7856,17 @@ discard block |
|
|
block discarded – undo |
7856
|
7856
|
} |
7857
|
7857
|
|
7858
|
7858
|
$urloption = ''; |
7859
|
|
- $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/projet/ajax/projects.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions); |
|
7859
|
+ $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/projet/ajax/projects.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions); |
7860
|
7860
|
|
7861
|
7861
|
if (empty($hidelabel)) { |
7862
|
|
- $out .= $langs->trans("RefOrLabel") . ' : '; |
|
7862
|
+ $out .= $langs->trans("RefOrLabel").' : '; |
7863
|
7863
|
} elseif ($hidelabel > 1) { |
7864
|
|
- $placeholder = ' placeholder="' . $langs->trans("RefOrLabel") . '"'; |
|
7864
|
+ $placeholder = ' placeholder="'.$langs->trans("RefOrLabel").'"'; |
7865
|
7865
|
if ($hidelabel == 2) { |
7866
|
7866
|
$out .= img_picto($langs->trans("Search"), 'search'); |
7867
|
7867
|
} |
7868
|
7868
|
} |
7869
|
|
- $out .= '<input type="text" class="minwidth100" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . $placeholder . ' ' . (getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '') . ' />'; |
|
7869
|
+ $out .= '<input type="text" class="minwidth100" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' '.(getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '').' />'; |
7870
|
7870
|
if ($hidelabel == 3) { |
7871
|
7871
|
$out .= img_picto($langs->trans("Search"), 'search'); |
7872
|
7872
|
} |
|
@@ -7909,8 +7909,8 @@ discard block |
|
|
block discarded – undo |
7909
|
7909
|
|
7910
|
7910
|
$sql = "SELECT "; |
7911
|
7911
|
$sql .= $selectFields; |
7912
|
|
- $sql .= " FROM " . $this->db->prefix() . "projet as p"; |
7913
|
|
- $sql .= ' WHERE p.entity IN (' . getEntity('project') . ')'; |
|
7912
|
+ $sql .= " FROM ".$this->db->prefix()."projet as p"; |
|
7913
|
+ $sql .= ' WHERE p.entity IN ('.getEntity('project').')'; |
7914
|
7914
|
|
7915
|
7915
|
// Add criteria on ref/label |
7916
|
7916
|
if ($filterkey != '') { |
|
@@ -7926,7 +7926,7 @@ discard block |
|
|
block discarded – undo |
7926
|
7926
|
if ($i > 0) { |
7927
|
7927
|
$sql .= " AND "; |
7928
|
7928
|
} |
7929
|
|
- $sql .= "p.ref LIKE '" . $this->db->escape($prefix . $crit) . "%'"; |
|
7929
|
+ $sql .= "p.ref LIKE '".$this->db->escape($prefix.$crit)."%'"; |
7930
|
7930
|
$sql .= ""; |
7931
|
7931
|
$i++; |
7932
|
7932
|
} |
|
@@ -7939,22 +7939,22 @@ discard block |
|
|
block discarded – undo |
7939
|
7939
|
$sql .= $this->db->plimit($limit, 0); |
7940
|
7940
|
|
7941
|
7941
|
// Build output string |
7942
|
|
- dol_syslog(get_class($this) . "::selectProjectsList search projects", LOG_DEBUG); |
|
7942
|
+ dol_syslog(get_class($this)."::selectProjectsList search projects", LOG_DEBUG); |
7943
|
7943
|
$result = $this->db->query($sql); |
7944
|
7944
|
if ($result) { |
7945
|
|
- require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; |
7946
|
|
- require_once DOL_DOCUMENT_ROOT . '/core/lib/project.lib.php'; |
|
7945
|
+ require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; |
|
7946
|
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php'; |
7947
|
7947
|
|
7948
|
7948
|
$num = $this->db->num_rows($result); |
7949
|
7949
|
|
7950
|
7950
|
$events = array(); |
7951
|
7951
|
|
7952
|
7952
|
if (!$forcecombo) { |
7953
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
7953
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
7954
|
7954
|
$out .= ajax_combobox($htmlname, $events, getDolGlobalInt('PROJECT_USE_SEARCH_TO_SELECT')); |
7955
|
7955
|
} |
7956
|
7956
|
|
7957
|
|
- $out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">'; |
|
7957
|
+ $out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">'; |
7958
|
7958
|
|
7959
|
7959
|
$textifempty = ''; |
7960
|
7960
|
// Do not use textifempty = ' ' or ' ' here, or search on key will search on ' key'. |
|
@@ -7971,7 +7971,7 @@ discard block |
|
|
block discarded – undo |
7971
|
7971
|
} |
7972
|
7972
|
} |
7973
|
7973
|
if ($showempty) { |
7974
|
|
- $out .= '<option value="0" selected>' . $textifempty . '</option>'; |
|
7974
|
+ $out .= '<option value="0" selected>'.$textifempty.'</option>'; |
7975
|
7975
|
} |
7976
|
7976
|
|
7977
|
7977
|
$i = 0; |
|
@@ -8029,13 +8029,13 @@ discard block |
|
|
block discarded – undo |
8029
|
8029
|
$outlabel = $objp->label; |
8030
|
8030
|
$outtype = $objp->fk_product_type; |
8031
|
8031
|
|
8032
|
|
- $opt = '<option value="' . $objp->rowid . '"'; |
|
8032
|
+ $opt = '<option value="'.$objp->rowid.'"'; |
8033
|
8033
|
$opt .= ($objp->rowid == $selected) ? ' selected' : ''; |
8034
|
8034
|
$opt .= '>'; |
8035
|
8035
|
$opt .= $objp->ref; |
8036
|
8036
|
$objRef = $objp->ref; |
8037
|
8037
|
if (!empty($filterkey) && $filterkey != '') { |
8038
|
|
- $objRef = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $objRef, 1); |
|
8038
|
+ $objRef = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $objRef, 1); |
8039
|
8039
|
} |
8040
|
8040
|
|
8041
|
8041
|
$opt .= "</option>\n"; |
|
@@ -8077,7 +8077,7 @@ discard block |
|
|
block discarded – undo |
8077
|
8077
|
$placeholder = ''; |
8078
|
8078
|
|
8079
|
8079
|
if ($selected && empty($selected_input_value)) { |
8080
|
|
- require_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php'; |
|
8080
|
+ require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; |
8081
|
8081
|
$adherenttmpselect = new Adherent($this->db); |
8082
|
8082
|
$adherenttmpselect->fetch($selected); |
8083
|
8083
|
$selected_input_value = $adherenttmpselect->ref; |
|
@@ -8086,17 +8086,17 @@ discard block |
|
|
block discarded – undo |
8086
|
8086
|
|
8087
|
8087
|
$urloption = ''; |
8088
|
8088
|
|
8089
|
|
- $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/adherents/ajax/adherents.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions); |
|
8089
|
+ $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/adherents/ajax/adherents.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions); |
8090
|
8090
|
|
8091
|
8091
|
if (empty($hidelabel)) { |
8092
|
|
- $out .= $langs->trans("RefOrLabel") . ' : '; |
|
8092
|
+ $out .= $langs->trans("RefOrLabel").' : '; |
8093
|
8093
|
} elseif ($hidelabel > 1) { |
8094
|
|
- $placeholder = ' placeholder="' . $langs->trans("RefOrLabel") . '"'; |
|
8094
|
+ $placeholder = ' placeholder="'.$langs->trans("RefOrLabel").'"'; |
8095
|
8095
|
if ($hidelabel == 2) { |
8096
|
8096
|
$out .= img_picto($langs->trans("Search"), 'search'); |
8097
|
8097
|
} |
8098
|
8098
|
} |
8099
|
|
- $out .= '<input type="text" class="minwidth100" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . $placeholder . ' ' . (getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '') . ' />'; |
|
8099
|
+ $out .= '<input type="text" class="minwidth100" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' '.(getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '').' />'; |
8100
|
8100
|
if ($hidelabel == 3) { |
8101
|
8101
|
$out .= img_picto($langs->trans("Search"), 'search'); |
8102
|
8102
|
} |
|
@@ -8141,8 +8141,8 @@ discard block |
|
|
block discarded – undo |
8141
|
8141
|
|
8142
|
8142
|
$sql = "SELECT "; |
8143
|
8143
|
$sql .= $selectFields; |
8144
|
|
- $sql .= " FROM " . $this->db->prefix() . "adherent as p"; |
8145
|
|
- $sql .= ' WHERE p.entity IN (' . getEntity('adherent') . ')'; |
|
8144
|
+ $sql .= " FROM ".$this->db->prefix()."adherent as p"; |
|
8145
|
+ $sql .= ' WHERE p.entity IN ('.getEntity('adherent').')'; |
8146
|
8146
|
|
8147
|
8147
|
// Add criteria on ref/label |
8148
|
8148
|
if ($filterkey != '') { |
|
@@ -8158,8 +8158,8 @@ discard block |
|
|
block discarded – undo |
8158
|
8158
|
if ($i > 0) { |
8159
|
8159
|
$sql .= " AND "; |
8160
|
8160
|
} |
8161
|
|
- $sql .= "(p.firstname LIKE '" . $this->db->escape($prefix . $crit) . "%'"; |
8162
|
|
- $sql .= " OR p.lastname LIKE '" . $this->db->escape($prefix . $crit) . "%')"; |
|
8161
|
+ $sql .= "(p.firstname LIKE '".$this->db->escape($prefix.$crit)."%'"; |
|
8162
|
+ $sql .= " OR p.lastname LIKE '".$this->db->escape($prefix.$crit)."%')"; |
8163
|
8163
|
$i++; |
8164
|
8164
|
} |
8165
|
8165
|
if (count($search_crit) > 1) { |
|
@@ -8168,27 +8168,27 @@ discard block |
|
|
block discarded – undo |
8168
|
8168
|
$sql .= ')'; |
8169
|
8169
|
} |
8170
|
8170
|
if ($status != -1) { |
8171
|
|
- $sql .= ' AND statut = ' . ((int) $status); |
|
8171
|
+ $sql .= ' AND statut = '.((int) $status); |
8172
|
8172
|
} |
8173
|
8173
|
$sql .= $this->db->plimit($limit, 0); |
8174
|
8174
|
|
8175
|
8175
|
// Build output string |
8176
|
|
- dol_syslog(get_class($this) . "::selectMembersList search adherents", LOG_DEBUG); |
|
8176
|
+ dol_syslog(get_class($this)."::selectMembersList search adherents", LOG_DEBUG); |
8177
|
8177
|
$result = $this->db->query($sql); |
8178
|
8178
|
if ($result) { |
8179
|
|
- require_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php'; |
8180
|
|
- require_once DOL_DOCUMENT_ROOT . '/core/lib/member.lib.php'; |
|
8179
|
+ require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; |
|
8180
|
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php'; |
8181
|
8181
|
|
8182
|
8182
|
$num = $this->db->num_rows($result); |
8183
|
8183
|
|
8184
|
8184
|
$events = array(); |
8185
|
8185
|
|
8186
|
8186
|
if (!$forcecombo) { |
8187
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
8187
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
8188
|
8188
|
$out .= ajax_combobox($htmlname, $events, getDolGlobalString('PROJECT_USE_SEARCH_TO_SELECT') ? $conf->global->PROJECT_USE_SEARCH_TO_SELECT : ''); |
8189
|
8189
|
} |
8190
|
8190
|
|
8191
|
|
- $out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">'; |
|
8191
|
+ $out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">'; |
8192
|
8192
|
|
8193
|
8193
|
$textifempty = ''; |
8194
|
8194
|
// Do not use textifempty = ' ' or ' ' here, or search on key will search on ' key'. |
|
@@ -8205,7 +8205,7 @@ discard block |
|
|
block discarded – undo |
8205
|
8205
|
} |
8206
|
8206
|
} |
8207
|
8207
|
if ($showempty) { |
8208
|
|
- $out .= '<option value="-1" selected>' . $textifempty . '</option>'; |
|
8208
|
+ $out .= '<option value="-1" selected>'.$textifempty.'</option>'; |
8209
|
8209
|
} |
8210
|
8210
|
|
8211
|
8211
|
$i = 0; |
|
@@ -8261,11 +8261,11 @@ discard block |
|
|
block discarded – undo |
8261
|
8261
|
$outlabel = dolGetFirstLastname($objp->firstname, $objp->lastname); |
8262
|
8262
|
$outtype = $objp->fk_adherent_type; |
8263
|
8263
|
|
8264
|
|
- $opt = '<option value="' . $objp->rowid . '"'; |
|
8264
|
+ $opt = '<option value="'.$objp->rowid.'"'; |
8265
|
8265
|
$opt .= ($objp->rowid == $selected) ? ' selected' : ''; |
8266
|
8266
|
$opt .= '>'; |
8267
|
8267
|
if (!empty($filterkey) && $filterkey != '') { |
8268
|
|
- $outlabel = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $outlabel, 1); |
|
8268
|
+ $outlabel = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $outlabel, 1); |
8269
|
8269
|
} |
8270
|
8270
|
$opt .= $outlabel; |
8271
|
8271
|
$opt .= "</option>\n"; |
|
@@ -8320,8 +8320,8 @@ discard block |
|
|
block discarded – undo |
8320
|
8320
|
$objecttmp = null; |
8321
|
8321
|
$InfoFieldList = array(); |
8322
|
8322
|
$classname = ''; |
8323
|
|
- $filter = ''; // Ensure filter has value (for static analysis) |
8324
|
|
- $sortfield = ''; // Ensure filter has value (for static analysis) |
|
8323
|
+ $filter = ''; // Ensure filter has value (for static analysis) |
|
8324
|
+ $sortfield = ''; // Ensure filter has value (for static analysis) |
8325
|
8325
|
|
8326
|
8326
|
if ($objectfield) { // We must retrieve the objectdesc from the field or extrafield |
8327
|
8327
|
// Example: $objectfield = 'product:options_package' or 'myobject@mymodule:options_myfield' |
|
@@ -8365,9 +8365,9 @@ discard block |
|
|
block discarded – undo |
8365
|
8365
|
$vartmp = (empty($InfoFieldList[3]) ? '' : $InfoFieldList[3]); |
8366
|
8366
|
$reg = array(); |
8367
|
8367
|
if (preg_match('/^.*:(\w*)$/', $vartmp, $reg)) { |
8368
|
|
- $InfoFieldList[4] = $reg[1]; // take the sort field |
|
8368
|
+ $InfoFieldList[4] = $reg[1]; // take the sort field |
8369
|
8369
|
} |
8370
|
|
- $InfoFieldList[3] = preg_replace('/:\w*$/', '', $vartmp); // take the filter field |
|
8370
|
+ $InfoFieldList[3] = preg_replace('/:\w*$/', '', $vartmp); // take the filter field |
8371
|
8371
|
|
8372
|
8372
|
$classname = $InfoFieldList[0]; |
8373
|
8373
|
$classpath = empty($InfoFieldList[1]) ? '' : $InfoFieldList[1]; |
|
@@ -8398,8 +8398,8 @@ discard block |
|
|
block discarded – undo |
8398
|
8398
|
); |
8399
|
8399
|
|
8400
|
8400
|
if (!is_object($objecttmp)) { |
8401
|
|
- dol_syslog('selectForForms: Error bad setup of field objectdescorig=' . $objectdescorig.', objectfield='.$objectfield.', objectdesc='.$objectdesc, LOG_WARNING); |
8402
|
|
- return 'selectForForms: Error bad setup of field objectdescorig=' . $objectdescorig.', objectfield='.$objectfield.', objectdesc='.$objectdesc; |
|
8401
|
+ dol_syslog('selectForForms: Error bad setup of field objectdescorig='.$objectdescorig.', objectfield='.$objectfield.', objectdesc='.$objectdesc, LOG_WARNING); |
|
8402
|
+ return 'selectForForms: Error bad setup of field objectdescorig='.$objectdescorig.', objectfield='.$objectfield.', objectdesc='.$objectdesc; |
8403
|
8403
|
} |
8404
|
8404
|
'@phan-var-force CommonObject $objecttmp'; |
8405
|
8405
|
|
|
@@ -8411,9 +8411,9 @@ discard block |
|
|
block discarded – undo |
8411
|
8411
|
if ($prefixforautocompletemode == 'product') { |
8412
|
8412
|
$prefixforautocompletemode = 'produit'; |
8413
|
8413
|
} |
8414
|
|
- $confkeyforautocompletemode = strtoupper($prefixforautocompletemode) . '_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT |
|
8414
|
+ $confkeyforautocompletemode = strtoupper($prefixforautocompletemode).'_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT |
8415
|
8415
|
|
8416
|
|
- dol_syslog(get_class($this) . "::selectForForms filter=" . $filter, LOG_DEBUG); |
|
8416
|
+ dol_syslog(get_class($this)."::selectForForms filter=".$filter, LOG_DEBUG); |
8417
|
8417
|
|
8418
|
8418
|
// Generate the combo HTML component |
8419
|
8419
|
$out = ''; |
|
@@ -8442,13 +8442,13 @@ discard block |
|
|
block discarded – undo |
8442
|
8442
|
} |
8443
|
8443
|
|
8444
|
8444
|
// Set url and param to call to get json of the search results |
8445
|
|
- $urlforajaxcall = DOL_URL_ROOT . '/core/ajax/selectobject.php'; |
8446
|
|
- $urloption = 'htmlname=' . urlencode($htmlname) . '&outjson=1&objectdesc=' . urlencode($objectdescorig) . '&objectfield='.urlencode($objectfield) . ($sortfield ? '&sortfield=' . urlencode($sortfield) : ''); |
|
8445
|
+ $urlforajaxcall = DOL_URL_ROOT.'/core/ajax/selectobject.php'; |
|
8446
|
+ $urloption = 'htmlname='.urlencode($htmlname).'&outjson=1&objectdesc='.urlencode($objectdescorig).'&objectfield='.urlencode($objectfield).($sortfield ? '&sortfield='.urlencode($sortfield) : ''); |
8447
|
8447
|
|
8448
|
8448
|
// Activate the auto complete using ajax call. |
8449
|
8449
|
$out .= ajax_autocompleter((string) $preSelectedValue, $htmlname, $urlforajaxcall, $urloption, getDolGlobalInt($confkeyforautocompletemode), 0); |
8450
|
8450
|
$out .= '<!-- force css to be higher than dialog popup --><style type="text/css">.ui-autocomplete { z-index: 1010; }</style>'; |
8451
|
|
- $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) . '"' : '') . ' />'; |
|
8451
|
+ $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).'"' : '').' />'; |
8452
|
8452
|
} else { |
8453
|
8453
|
// Immediate load of table record. |
8454
|
8454
|
$out .= $this->selectForFormsList($objecttmp, $htmlname, $preSelectedValue, $showempty, $searchkey, $placeholder, $morecss, $moreparams, $forcecombo, 0, $disabled, $sortfield, $filter); |
|
@@ -8488,16 +8488,16 @@ discard block |
|
|
block discarded – undo |
8488
|
8488
|
if ($prefixforautocompletemode == 'societe') { |
8489
|
8489
|
$prefixforautocompletemode = 'company'; |
8490
|
8490
|
} |
8491
|
|
- $confkeyforautocompletemode = strtoupper($prefixforautocompletemode) . '_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT |
|
8491
|
+ $confkeyforautocompletemode = strtoupper($prefixforautocompletemode).'_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT |
8492
|
8492
|
|
8493
|
8493
|
if (!empty($objecttmp->fields)) { // For object that declare it, it is better to use declared fields (like societe, contact, ...) |
8494
|
8494
|
$tmpfieldstoshow = ''; |
8495
|
8495
|
foreach ($objecttmp->fields as $key => $val) { |
8496
|
|
- if (! (int) dol_eval($val['enabled'], 1, 1, '1')) { |
|
8496
|
+ if (!(int) dol_eval($val['enabled'], 1, 1, '1')) { |
8497
|
8497
|
continue; |
8498
|
8498
|
} |
8499
|
8499
|
if (!empty($val['showoncombobox'])) { |
8500
|
|
- $tmpfieldstoshow .= ($tmpfieldstoshow ? ',' : '') . 't.' . $key; |
|
8500
|
+ $tmpfieldstoshow .= ($tmpfieldstoshow ? ',' : '').'t.'.$key; |
8501
|
8501
|
} |
8502
|
8502
|
} |
8503
|
8503
|
if ($tmpfieldstoshow) { |
|
@@ -8525,18 +8525,18 @@ discard block |
|
|
block discarded – undo |
8525
|
8525
|
$num = 0; |
8526
|
8526
|
|
8527
|
8527
|
// Search data |
8528
|
|
- $sql = "SELECT t.rowid, " . $fieldstoshow . " FROM " . $this->db->prefix() . $objecttmp->table_element . " as t"; |
|
8528
|
+ $sql = "SELECT t.rowid, ".$fieldstoshow." FROM ".$this->db->prefix().$objecttmp->table_element." as t"; |
8529
|
8529
|
if (!empty($objecttmp->isextrafieldmanaged)) { |
8530
|
|
- $sql .= " LEFT JOIN " . $this->db->prefix() . $objecttmp->table_element . "_extrafields as e ON t.rowid=e.fk_object"; |
|
8530
|
+ $sql .= " LEFT JOIN ".$this->db->prefix().$objecttmp->table_element."_extrafields as e ON t.rowid=e.fk_object"; |
8531
|
8531
|
} |
8532
|
8532
|
if (isset($objecttmp->ismultientitymanaged)) { |
8533
|
8533
|
if (!is_numeric($objecttmp->ismultientitymanaged)) { |
8534
|
8534
|
$tmparray = explode('@', $objecttmp->ismultientitymanaged); |
8535
|
|
- $sql .= " INNER JOIN " . $this->db->prefix() . $tmparray[1] . " as parenttable ON parenttable.rowid = t." . $tmparray[0]; |
|
8535
|
+ $sql .= " INNER JOIN ".$this->db->prefix().$tmparray[1]." as parenttable ON parenttable.rowid = t.".$tmparray[0]; |
8536
|
8536
|
} |
8537
|
8537
|
if ($objecttmp->ismultientitymanaged === 'fk_soc@societe') { |
8538
|
8538
|
if (!$user->hasRight('societe', 'client', 'voir')) { |
8539
|
|
- $sql .= ", " . $this->db->prefix() . "societe_commerciaux as sc"; |
|
8539
|
+ $sql .= ", ".$this->db->prefix()."societe_commerciaux as sc"; |
8540
|
8540
|
} |
8541
|
8541
|
} |
8542
|
8542
|
} |
|
@@ -8556,21 +8556,21 @@ discard block |
|
|
block discarded – undo |
8556
|
8556
|
$sql .= " WHERE 1=1"; |
8557
|
8557
|
if (isset($objecttmp->ismultientitymanaged)) { |
8558
|
8558
|
if ($objecttmp->ismultientitymanaged == 1) { |
8559
|
|
- $sql .= " AND t.entity IN (" . getEntity($objecttmp->table_element) . ")"; |
|
8559
|
+ $sql .= " AND t.entity IN (".getEntity($objecttmp->table_element).")"; |
8560
|
8560
|
} |
8561
|
8561
|
if (!is_numeric($objecttmp->ismultientitymanaged)) { |
8562
|
|
- $sql .= " AND parenttable.entity = t." . $tmparray[0]; |
|
8562
|
+ $sql .= " AND parenttable.entity = t.".$tmparray[0]; |
8563
|
8563
|
} |
8564
|
8564
|
if ($objecttmp->ismultientitymanaged == 1 && !empty($user->socid)) { |
8565
|
8565
|
if ($objecttmp->element == 'societe') { |
8566
|
|
- $sql .= " AND t.rowid = " . ((int) $user->socid); |
|
8566
|
+ $sql .= " AND t.rowid = ".((int) $user->socid); |
8567
|
8567
|
} else { |
8568
|
|
- $sql .= " AND t.fk_soc = " . ((int) $user->socid); |
|
8568
|
+ $sql .= " AND t.fk_soc = ".((int) $user->socid); |
8569
|
8569
|
} |
8570
|
8570
|
} |
8571
|
8571
|
if ($objecttmp->ismultientitymanaged === 'fk_soc@societe') { |
8572
|
8572
|
if (!$user->hasRight('societe', 'client', 'voir')) { |
8573
|
|
- $sql .= " AND t.rowid = sc.fk_soc AND sc.fk_user = " . ((int) $user->id); |
|
8573
|
+ $sql .= " AND t.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id); |
8574
|
8574
|
} |
8575
|
8575
|
} |
8576
|
8576
|
} |
|
@@ -8582,7 +8582,7 @@ discard block |
|
|
block discarded – undo |
8582
|
8582
|
$errormessage = ''; |
8583
|
8583
|
$sql .= forgeSQLFromUniversalSearchCriteria($filter, $errormessage); |
8584
|
8584
|
if ($errormessage) { |
8585
|
|
- return 'Error forging a SQL request from an universal criteria: ' . $errormessage; |
|
8585
|
+ return 'Error forging a SQL request from an universal criteria: '.$errormessage; |
8586
|
8586
|
} |
8587
|
8587
|
} |
8588
|
8588
|
} |
|
@@ -8594,7 +8594,7 @@ discard block |
|
|
block discarded – undo |
8594
|
8594
|
$resql = $this->db->query($sql); |
8595
|
8595
|
if ($resql) { |
8596
|
8596
|
// Construct $out and $outarray |
8597
|
|
- $out .= '<select id="' . $htmlname . '" class="flat minwidth100' . ($morecss ? ' ' . $morecss : '') . '"' . ($disabled ? ' disabled="disabled"' : '') . ($moreparams ? ' ' . $moreparams : '') . ' name="' . $htmlname . '">' . "\n"; |
|
8597
|
+ $out .= '<select id="'.$htmlname.'" class="flat minwidth100'.($morecss ? ' '.$morecss : '').'"'.($disabled ? ' disabled="disabled"' : '').($moreparams ? ' '.$moreparams : '').' name="'.$htmlname.'">'."\n"; |
8598
|
8598
|
|
8599
|
8599
|
// Warning: Do not use textifempty = ' ' or ' ' here, or search on key will search on ' key'. Seems it is no more true with selec2 v4 |
8600
|
8600
|
$textifempty = ' '; |
|
@@ -8608,7 +8608,7 @@ discard block |
|
|
block discarded – undo |
8608
|
8608
|
} |
8609
|
8609
|
} |
8610
|
8610
|
if ($showempty) { |
8611
|
|
- $out .= '<option value="-1">' . $textifempty . '</option>' . "\n"; |
|
8611
|
+ $out .= '<option value="-1">'.$textifempty.'</option>'."\n"; |
8612
|
8612
|
} |
8613
|
8613
|
|
8614
|
8614
|
$num = $this->db->num_rows($resql); |
|
@@ -8631,9 +8631,9 @@ discard block |
|
|
block discarded – undo |
8631
|
8631
|
} |
8632
|
8632
|
if (empty($outputmode)) { |
8633
|
8633
|
if ($preselectedvalue > 0 && $preselectedvalue == $obj->rowid) { |
8634
|
|
- $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>'; |
|
8634
|
+ $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>'; |
8635
|
8635
|
} else { |
8636
|
|
- $out .= '<option value="' . $obj->rowid . '" data-html="' . dol_escape_htmltag($labelhtml, 0, 0, '', 0, 1) . '">' . dol_escape_htmltag($label, 0, 0, '', 0, 1) . '</option>'; |
|
8636
|
+ $out .= '<option value="'.$obj->rowid.'" data-html="'.dol_escape_htmltag($labelhtml, 0, 0, '', 0, 1).'">'.dol_escape_htmltag($label, 0, 0, '', 0, 1).'</option>'; |
8637
|
8637
|
} |
8638
|
8638
|
} else { |
8639
|
8639
|
array_push($outarray, array('key' => $obj->rowid, 'value' => $label, 'label' => $label)); |
|
@@ -8646,10 +8646,10 @@ discard block |
|
|
block discarded – undo |
8646
|
8646
|
} |
8647
|
8647
|
} |
8648
|
8648
|
|
8649
|
|
- $out .= '</select>' . "\n"; |
|
8649
|
+ $out .= '</select>'."\n"; |
8650
|
8650
|
|
8651
|
8651
|
if (!$forcecombo) { |
8652
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
8652
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
8653
|
8653
|
$out .= ajax_combobox($htmlname, array(), getDolGlobalInt($confkeyforautocompletemode, 0)); |
8654
|
8654
|
} |
8655
|
8655
|
} else { |
|
@@ -8713,8 +8713,8 @@ discard block |
|
|
block discarded – undo |
8713
|
8713
|
} |
8714
|
8714
|
} |
8715
|
8715
|
$idname = str_replace(array('[', ']'), array('', ''), $htmlname); |
8716
|
|
- $out .= '<select id="' . preg_replace('/^\./', '', $idname) . '" ' . ($disabled ? 'disabled="disabled" ' : '') . 'class="flat ' . (preg_replace('/^\./', '', $htmlname)) . ($morecss ? ' ' . $morecss : '') . ' selectformat"'; |
8717
|
|
- $out .= ' name="' . preg_replace('/^\./', '', $htmlname) . '" ' . ($moreparam ? $moreparam : ''); |
|
8716
|
+ $out .= '<select id="'.preg_replace('/^\./', '', $idname).'" '.($disabled ? 'disabled="disabled" ' : '').'class="flat '.(preg_replace('/^\./', '', $htmlname)).($morecss ? ' '.$morecss : '').' selectformat"'; |
|
8717
|
+ $out .= ' name="'.preg_replace('/^\./', '', $htmlname).'" '.($moreparam ? $moreparam : ''); |
8718
|
8718
|
$out .= '>'."\n"; |
8719
|
8719
|
|
8720
|
8720
|
if ($show_empty) { |
|
@@ -8725,7 +8725,7 @@ discard block |
|
|
block discarded – undo |
8725
|
8725
|
if (!is_numeric($show_empty)) { |
8726
|
8726
|
$textforempty = $show_empty; |
8727
|
8727
|
} |
8728
|
|
- $out .= '<option class="optiongrey" ' . ($moreparamonempty ? $moreparamonempty . ' ' : '') . 'value="' . (((int) $show_empty) < 0 ? $show_empty : -1) . '"' . ($id == $show_empty ? ' selected' : '') . '>' . $textforempty . '</option>' . "\n"; |
|
8728
|
+ $out .= '<option class="optiongrey" '.($moreparamonempty ? $moreparamonempty.' ' : '').'value="'.(((int) $show_empty) < 0 ? $show_empty : -1).'"'.($id == $show_empty ? ' selected' : '').'>'.$textforempty.'</option>'."\n"; |
8729
|
8729
|
} |
8730
|
8730
|
if (is_array($array)) { |
8731
|
8731
|
// Translate |
|
@@ -8750,7 +8750,7 @@ discard block |
|
|
block discarded – undo |
8750
|
8750
|
$value = $tmpvalue['label']; |
8751
|
8751
|
//$valuehtml = empty($tmpvalue['data-html']) ? $value : $tmpvalue['data-html']; |
8752
|
8752
|
$disabled = empty($tmpvalue['disabled']) ? '' : ' disabled'; |
8753
|
|
- $style = empty($tmpvalue['css']) ? '' : ' class="' . $tmpvalue['css'] . '"'; |
|
8753
|
+ $style = empty($tmpvalue['css']) ? '' : ' class="'.$tmpvalue['css'].'"'; |
8754
|
8754
|
} else { |
8755
|
8755
|
$value = $tmpvalue; |
8756
|
8756
|
//$valuehtml = $tmpvalue; |
|
@@ -8766,9 +8766,9 @@ discard block |
|
|
block discarded – undo |
8766
|
8766
|
} |
8767
|
8767
|
if ($key_in_label) { |
8768
|
8768
|
if (empty($nohtmlescape)) { |
8769
|
|
- $selectOptionValue = dol_escape_htmltag($key . ' - ' . ($maxlen ? dol_trunc($value, $maxlen) : $value)); |
|
8769
|
+ $selectOptionValue = dol_escape_htmltag($key.' - '.($maxlen ? dol_trunc($value, $maxlen) : $value)); |
8770
|
8770
|
} else { |
8771
|
|
- $selectOptionValue = $key . ' - ' . ($maxlen ? dol_trunc($value, $maxlen) : $value); |
|
8771
|
+ $selectOptionValue = $key.' - '.($maxlen ? dol_trunc($value, $maxlen) : $value); |
8772
|
8772
|
} |
8773
|
8773
|
} else { |
8774
|
8774
|
if (empty($nohtmlescape)) { |
|
@@ -8780,8 +8780,8 @@ discard block |
|
|
block discarded – undo |
8780
|
8780
|
$selectOptionValue = ' '; |
8781
|
8781
|
} |
8782
|
8782
|
} |
8783
|
|
- $out .= '<option value="' . $key . '"'; |
8784
|
|
- $out .= $style . $disabled; |
|
8783
|
+ $out .= '<option value="'.$key.'"'; |
|
8784
|
+ $out .= $style.$disabled; |
8785
|
8785
|
if (is_array($id)) { |
8786
|
8786
|
if (in_array($key, $id) && !$disabled) { |
8787
|
8787
|
$out .= ' selected'; // To preselect a value |
|
@@ -8793,7 +8793,7 @@ discard block |
|
|
block discarded – undo |
8793
|
8793
|
} |
8794
|
8794
|
} |
8795
|
8795
|
if (!empty($nohtmlescape)) { // deprecated. Use instead the key 'data-html' into input $array, managed at next step to use HTML content. |
8796
|
|
- $out .= ' data-html="' . dol_escape_htmltag($selectOptionValue) . '"'; |
|
8796
|
+ $out .= ' data-html="'.dol_escape_htmltag($selectOptionValue).'"'; |
8797
|
8797
|
} |
8798
|
8798
|
|
8799
|
8799
|
if (is_array($tmpvalue)) { |
|
@@ -8816,7 +8816,7 @@ discard block |
|
|
block discarded – undo |
8816
|
8816
|
// Add code for jquery to use multiselect |
8817
|
8817
|
if ($addjscombo && $jsbeautify) { |
8818
|
8818
|
// Enhance with select2 |
8819
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
8819
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
8820
|
8820
|
$out .= ajax_combobox($idname, array(), 0, 0, 'resolve', (((int) $show_empty) < 0 ? (string) $show_empty : '-1'), $morecss); |
8821
|
8821
|
} |
8822
|
8822
|
|
|
@@ -8844,28 +8844,28 @@ discard block |
|
|
block discarded – undo |
8844
|
8844
|
public static function selectArrayAjax($htmlname, $url, $id = '', $moreparam = '', $moreparamtourl = '', $disabled = 0, $minimumInputLength = 1, $morecss = '', $callurlonselect = 0, $placeholder = '', $acceptdelayedhtml = 0) |
8845
|
8845
|
{ |
8846
|
8846
|
global $conf, $langs; |
8847
|
|
- global $delayedhtmlcontent; // Will be used later outside of this function |
|
8847
|
+ global $delayedhtmlcontent; // Will be used later outside of this function |
8848
|
8848
|
|
8849
|
8849
|
// TODO Use an internal dolibarr component instead of select2 |
8850
|
8850
|
if (!getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') && !defined('REQUIRE_JQUERY_MULTISELECT')) { |
8851
|
8851
|
return ''; |
8852
|
8852
|
} |
8853
|
8853
|
|
8854
|
|
- $out = '<select type="text" class="' . $htmlname . ($morecss ? ' ' . $morecss : '') . '" ' . ($moreparam ? $moreparam . ' ' : '') . 'name="' . $htmlname . '"></select>'; |
|
8854
|
+ $out = '<select type="text" class="'.$htmlname.($morecss ? ' '.$morecss : '').'" '.($moreparam ? $moreparam.' ' : '').'name="'.$htmlname.'"></select>'; |
8855
|
8855
|
|
8856
|
8856
|
$outdelayed = ''; |
8857
|
8857
|
if (!empty($conf->use_javascript_ajax)) { |
8858
|
8858
|
$tmpplugin = 'select2'; |
8859
|
|
- $outdelayed = "\n" . '<!-- JS CODE TO ENABLE ' . $tmpplugin . ' for id ' . $htmlname . ' --> |
8860
|
|
- <script nonce="' . getNonce() . '"> |
|
8859
|
+ $outdelayed = "\n".'<!-- JS CODE TO ENABLE '.$tmpplugin.' for id '.$htmlname.' --> |
|
8860
|
+ <script nonce="' . getNonce().'"> |
8861
|
8861
|
$(document).ready(function () { |
8862
|
8862
|
|
8863
|
|
- ' . ($callurlonselect ? 'var saveRemoteData = [];' : '') . ' |
|
8863
|
+ ' . ($callurlonselect ? 'var saveRemoteData = [];' : '').' |
8864
|
8864
|
|
8865
|
|
- $(".' . $htmlname . '").select2({ |
|
8865
|
+ $(".' . $htmlname.'").select2({ |
8866
|
8866
|
ajax: { |
8867
|
8867
|
dir: "ltr", |
8868
|
|
- url: "' . $url . '", |
|
8868
|
+ url: "' . $url.'", |
8869
|
8869
|
dataType: \'json\', |
8870
|
8870
|
delay: 250, |
8871
|
8871
|
data: function (params) { |
|
@@ -8892,9 +8892,9 @@ discard block |
|
|
block discarded – undo |
8892
|
8892
|
}, |
8893
|
8893
|
language: select2arrayoflanguage, |
8894
|
8894
|
containerCssClass: \':all:\', /* Line to add class of origin SELECT propagated to the new <span class="select2-selection...> tag */ |
8895
|
|
- placeholder: "' . dol_escape_js($placeholder) . '", |
|
8895
|
+ placeholder: "' . dol_escape_js($placeholder).'", |
8896
|
8896
|
escapeMarkup: function (markup) { return markup; }, // let our custom formatter work |
8897
|
|
- minimumInputLength: ' . ((int) $minimumInputLength) . ', |
|
8897
|
+ minimumInputLength: ' . ((int) $minimumInputLength).', |
8898
|
8898
|
formatResult: function (result, container, query, escapeMarkup) { |
8899
|
8899
|
return escapeMarkup(result.text); |
8900
|
8900
|
}, |
|
@@ -8902,10 +8902,10 @@ discard block |
|
|
block discarded – undo |
8902
|
8902
|
|
8903
|
8903
|
' . ($callurlonselect ? ' |
8904
|
8904
|
/* Code to execute a GET when we select a value */ |
8905
|
|
- $(".' . $htmlname . '").change(function() { |
8906
|
|
- var selected = $(".' . $htmlname . '").val(); |
|
8905
|
+ $(".' . $htmlname.'").change(function() { |
|
8906
|
+ var selected = $(".' . $htmlname.'").val(); |
8907
|
8907
|
console.log("We select in selectArrayAjax the entry "+selected) |
8908
|
|
- $(".' . $htmlname . '").val(""); /* reset visible combo value */ |
|
8908
|
+ $(".' . $htmlname.'").val(""); /* reset visible combo value */ |
8909
|
8909
|
$.each( saveRemoteData, function( key, value ) { |
8910
|
8910
|
if (key == selected) |
8911
|
8911
|
{ |
|
@@ -8913,7 +8913,7 @@ discard block |
|
|
block discarded – undo |
8913
|
8913
|
location.assign(value.url); |
8914
|
8914
|
} |
8915
|
8915
|
}); |
8916
|
|
- });' : '') . ' |
|
8916
|
+ });' : '').' |
8917
|
8917
|
|
8918
|
8918
|
}); |
8919
|
8919
|
</script>'; |
|
@@ -8949,14 +8949,14 @@ discard block |
|
|
block discarded – undo |
8949
|
8949
|
public static function selectArrayFilter($htmlname, $array, $id = '', $moreparam = '', $disableFiltering = 0, $disabled = 0, $minimumInputLength = 1, $morecss = '', $callurlonselect = 0, $placeholder = '', $acceptdelayedhtml = 0, $textfortitle = '') |
8950
|
8950
|
{ |
8951
|
8951
|
global $conf, $langs; |
8952
|
|
- global $delayedhtmlcontent; // Will be used later outside of this function |
|
8952
|
+ global $delayedhtmlcontent; // Will be used later outside of this function |
8953
|
8953
|
|
8954
|
8954
|
// TODO Use an internal dolibarr component instead of select2 |
8955
|
8955
|
if (!getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') && !defined('REQUIRE_JQUERY_MULTISELECT')) { |
8956
|
8956
|
return ''; |
8957
|
8957
|
} |
8958
|
8958
|
|
8959
|
|
- $out = '<select type="text"'.($textfortitle ? ' title="'.dol_escape_htmltag($textfortitle).'"' : '').' id="'.$htmlname.'" class="'.$htmlname.($morecss ? ' ' . $morecss : '').'"'.($moreparam ? ' '.$moreparam : '').' name="'.$htmlname.'"><option></option></select>'; |
|
8959
|
+ $out = '<select type="text"'.($textfortitle ? ' title="'.dol_escape_htmltag($textfortitle).'"' : '').' id="'.$htmlname.'" class="'.$htmlname.($morecss ? ' '.$morecss : '').'"'.($moreparam ? ' '.$moreparam : '').' name="'.$htmlname.'"><option></option></select>'; |
8960
|
8960
|
|
8961
|
8961
|
$formattedarrayresult = array(); |
8962
|
8962
|
|
|
@@ -8971,20 +8971,20 @@ discard block |
|
|
block discarded – undo |
8971
|
8971
|
$outdelayed = ''; |
8972
|
8972
|
if (!empty($conf->use_javascript_ajax)) { |
8973
|
8973
|
$tmpplugin = 'select2'; |
8974
|
|
- $outdelayed = "\n" . '<!-- JS CODE TO ENABLE ' . $tmpplugin . ' for id ' . $htmlname . ' --> |
8975
|
|
- <script nonce="' . getNonce() . '"> |
|
8974
|
+ $outdelayed = "\n".'<!-- JS CODE TO ENABLE '.$tmpplugin.' for id '.$htmlname.' --> |
|
8975
|
+ <script nonce="' . getNonce().'"> |
8976
|
8976
|
$(document).ready(function () { |
8977
|
|
- var data = ' . json_encode($formattedarrayresult) . '; |
|
8977
|
+ var data = ' . json_encode($formattedarrayresult).'; |
8978
|
8978
|
|
8979
|
|
- ' . ($callurlonselect ? 'var saveRemoteData = ' . json_encode($array) . ';' : '') . ' |
|
8979
|
+ ' . ($callurlonselect ? 'var saveRemoteData = '.json_encode($array).';' : '').' |
8980
|
8980
|
|
8981
|
|
- $(".' . $htmlname . '").select2({ |
|
8981
|
+ $(".' . $htmlname.'").select2({ |
8982
|
8982
|
data: data, |
8983
|
8983
|
language: select2arrayoflanguage, |
8984
|
8984
|
containerCssClass: \':all:\', /* Line to add class of origin SELECT propagated to the new <span class="select2-selection...> tag */ |
8985
|
|
- placeholder: "' . dol_escape_js($placeholder) . '", |
|
8985
|
+ placeholder: "' . dol_escape_js($placeholder).'", |
8986
|
8986
|
escapeMarkup: function (markup) { return markup; }, // let our custom formatter work |
8987
|
|
- minimumInputLength: ' . $minimumInputLength . ', |
|
8987
|
+ minimumInputLength: ' . $minimumInputLength.', |
8988
|
8988
|
formatResult: function (result, container, query, escapeMarkup) { |
8989
|
8989
|
return escapeMarkup(result.text); |
8990
|
8990
|
}, |
|
@@ -9023,11 +9023,11 @@ discard block |
|
|
block discarded – undo |
9023
|
9023
|
|
9024
|
9024
|
' . ($callurlonselect ? ' |
9025
|
9025
|
/* Code to execute a GET when we select a value */ |
9026
|
|
- $(".' . $htmlname . '").change(function() { |
9027
|
|
- var selected = $(".' . $htmlname . '").val(); |
|
9026
|
+ $(".' . $htmlname.'").change(function() { |
|
9027
|
+ var selected = $(".' . $htmlname.'").val(); |
9028
|
9028
|
console.log("We select "+selected) |
9029
|
9029
|
|
9030
|
|
- $(".' . $htmlname . '").val(""); /* reset visible combo value */ |
|
9030
|
+ $(".' . $htmlname.'").val(""); /* reset visible combo value */ |
9031
|
9031
|
$.each( saveRemoteData, function( key, value ) { |
9032
|
9032
|
if (key == selected) |
9033
|
9033
|
{ |
|
@@ -9035,7 +9035,7 @@ discard block |
|
|
block discarded – undo |
9035
|
9035
|
location.assign(value.url); |
9036
|
9036
|
} |
9037
|
9037
|
}); |
9038
|
|
- });' : '') . ' |
|
9038
|
+ });' : '').' |
9039
|
9039
|
|
9040
|
9040
|
}); |
9041
|
9041
|
</script>'; |
|
@@ -9084,7 +9084,7 @@ discard block |
|
|
block discarded – undo |
9084
|
9084
|
$useenhancedmultiselect = 0; |
9085
|
9085
|
if (!empty($conf->use_javascript_ajax) && !defined('MAIN_DO_NOT_USE_JQUERY_MULTISELECT') && (getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') || defined('REQUIRE_JQUERY_MULTISELECT'))) { |
9086
|
9086
|
if ($addjscombo) { |
9087
|
|
- $useenhancedmultiselect = 1; // Use the js multiselect in one line. Possible only if $addjscombo not 0. |
|
9087
|
+ $useenhancedmultiselect = 1; // Use the js multiselect in one line. Possible only if $addjscombo not 0. |
9088
|
9088
|
} |
9089
|
9089
|
} |
9090
|
9090
|
|
|
@@ -9093,7 +9093,7 @@ discard block |
|
|
block discarded – undo |
9093
|
9093
|
// submitted to nothing. |
9094
|
9094
|
$out .= '<input type="hidden" name="'.$htmlname.'_multiselect" value="1">'; |
9095
|
9095
|
// Output select component |
9096
|
|
- $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"; |
|
9096
|
+ $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"; |
9097
|
9097
|
if (is_array($array) && !empty($array)) { |
9098
|
9098
|
if ($value_as_key) { |
9099
|
9099
|
$array = array_combine($array, $array); |
|
@@ -9114,33 +9114,33 @@ discard block |
|
|
block discarded – undo |
9114
|
9114
|
$tmplabelhtml = empty($value['labelhtml']) ? (empty($value['data-html']) ? '' : $value['data-html']) : $value['labelhtml']; |
9115
|
9115
|
} |
9116
|
9116
|
$newval = ($translate ? $langs->trans($tmpvalue) : $tmpvalue); |
9117
|
|
- $newval = ($key_in_label ? $tmpkey . ' - ' . $newval : $newval); |
|
9117
|
+ $newval = ($key_in_label ? $tmpkey.' - '.$newval : $newval); |
9118
|
9118
|
|
9119
|
|
- $out .= '<option value="' . $tmpkey . '"'; |
|
9119
|
+ $out .= '<option value="'.$tmpkey.'"'; |
9120
|
9120
|
if (is_array($selected) && !empty($selected) && in_array((string) $tmpkey, $selected) && ((string) $tmpkey != '')) { |
9121
|
9121
|
$out .= ' selected'; |
9122
|
9122
|
} |
9123
|
9123
|
if (!empty($tmplabelhtml)) { |
9124
|
|
- $out .= ' data-html="' . dol_escape_htmltag($tmplabelhtml, 0, 0, '', 0, 1) . '"'; |
|
9124
|
+ $out .= ' data-html="'.dol_escape_htmltag($tmplabelhtml, 0, 0, '', 0, 1).'"'; |
9125
|
9125
|
} else { |
9126
|
|
- $tmplabelhtml = ($tmppicto ? img_picto('', $tmppicto, 'class="pictofixedwidth" style="color: #' . $tmpcolor . '"') : '') . $newval; |
9127
|
|
- $out .= ' data-html="' . dol_escape_htmltag($tmplabelhtml, 0, 0, '', 0, 1) . '"'; |
|
9126
|
+ $tmplabelhtml = ($tmppicto ? img_picto('', $tmppicto, 'class="pictofixedwidth" style="color: #'.$tmpcolor.'"') : '').$newval; |
|
9127
|
+ $out .= ' data-html="'.dol_escape_htmltag($tmplabelhtml, 0, 0, '', 0, 1).'"'; |
9128
|
9128
|
} |
9129
|
9129
|
$out .= '>'; |
9130
|
9130
|
$out .= dol_htmlentitiesbr($newval); |
9131
|
|
- $out .= '</option>' . "\n"; |
|
9131
|
+ $out .= '</option>'."\n"; |
9132
|
9132
|
} |
9133
|
9133
|
} |
9134
|
9134
|
} |
9135
|
|
- $out .= '</select>' . "\n"; |
|
9135
|
+ $out .= '</select>'."\n"; |
9136
|
9136
|
|
9137
|
9137
|
// Add code for jquery to use multiselect |
9138
|
9138
|
if (!empty($conf->use_javascript_ajax) && getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') || defined('REQUIRE_JQUERY_MULTISELECT')) { |
9139
|
|
- $out .= "\n" . '<!-- JS CODE TO ENABLE select for id ' . $htmlname . ', addjscombo=' . $addjscombo . ' -->'; |
9140
|
|
- $out .= "\n" . '<script nonce="' . getNonce() . '">' . "\n"; |
|
9139
|
+ $out .= "\n".'<!-- JS CODE TO ENABLE select for id '.$htmlname.', addjscombo='.$addjscombo.' -->'; |
|
9140
|
+ $out .= "\n".'<script nonce="'.getNonce().'">'."\n"; |
9141
|
9141
|
if ($addjscombo == 1) { |
9142
|
9142
|
$tmpplugin = !getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') ? constant('REQUIRE_JQUERY_MULTISELECT') : $conf->global->MAIN_USE_JQUERY_MULTISELECT; |
9143
|
|
- $out .= 'function formatResult(record, container) {' . "\n"; |
|
9143
|
+ $out .= 'function formatResult(record, container) {'."\n"; |
9144
|
9144
|
// If property data-html set, we decode html entities and use this. |
9145
|
9145
|
// Note that HTML content must have been sanitized from js with dol_escape_htmltag(xxx, 0, 0, '', 0, 1) when building the select option. |
9146
|
9146
|
$out .= ' if ($(record.element).attr("data-html") != undefined && typeof htmlEntityDecodeJs === "function") {'; |
|
@@ -9148,26 +9148,26 @@ discard block |
|
|
block discarded – undo |
9148
|
9148
|
$out .= ' return htmlEntityDecodeJs($(record.element).attr("data-html"));'; |
9149
|
9149
|
$out .= ' }'."\n"; |
9150
|
9150
|
$out .= ' return record.text;'; |
9151
|
|
- $out .= '}' . "\n"; |
9152
|
|
- $out .= 'function formatSelection(record) {' . "\n"; |
|
9151
|
+ $out .= '}'."\n"; |
|
9152
|
+ $out .= 'function formatSelection(record) {'."\n"; |
9153
|
9153
|
if ($elemtype == 'category') { |
9154
|
|
- $out .= 'return \'<span><img src="' . DOL_URL_ROOT . '/theme/eldy/img/object_category.png"> \'+record.text+\'</span>\';'; |
|
9154
|
+ $out .= 'return \'<span><img src="'.DOL_URL_ROOT.'/theme/eldy/img/object_category.png"> \'+record.text+\'</span>\';'; |
9155
|
9155
|
} else { |
9156
|
9156
|
$out .= 'return record.text;'; |
9157
|
9157
|
} |
9158
|
|
- $out .= '}' . "\n"; |
|
9158
|
+ $out .= '}'."\n"; |
9159
|
9159
|
$out .= '$(document).ready(function () { |
9160
|
|
- $(\'#' . $htmlname . '\').' . $tmpplugin . '({'; |
|
9160
|
+ $(\'#' . $htmlname.'\').'.$tmpplugin.'({'; |
9161
|
9161
|
if ($placeholder) { |
9162
|
9162
|
$out .= ' |
9163
|
9163
|
placeholder: { |
9164
|
9164
|
id: \'-1\', |
9165
|
|
- text: \'' . dol_escape_js($placeholder) . '\' |
|
9165
|
+ text: \'' . dol_escape_js($placeholder).'\' |
9166
|
9166
|
},'; |
9167
|
9167
|
} |
9168
|
9168
|
$out .= ' dir: \'ltr\', |
9169
|
9169
|
containerCssClass: \':all:\', /* Line to add class of origin SELECT propagated to the new <span class="select2-selection...> tag (ko with multiselect) */ |
9170
|
|
- dropdownCssClass: \'' . $morecss . '\', /* Line to add class on the new <span class="select2-selection...> tag (ok with multiselect). Need full version of select2. */ |
|
9170
|
+ dropdownCssClass: \'' . $morecss.'\', /* Line to add class on the new <span class="select2-selection...> tag (ok with multiselect). Need full version of select2. */ |
9171
|
9171
|
// Specify format function for dropdown item |
9172
|
9172
|
formatResult: formatResult, |
9173
|
9173
|
templateResult: formatResult, /* For 4.0 */ |
|
@@ -9179,21 +9179,21 @@ discard block |
|
|
block discarded – undo |
9179
|
9179
|
|
9180
|
9180
|
/* Add also morecss to the css .select2 that is after the #htmlname, for component that are show dynamically after load, because select2 set |
9181
|
9181
|
the size only if component is not hidden by default on load */ |
9182
|
|
- $(\'#' . $htmlname . ' + .select2\').addClass(\'' . $morecss . '\'); |
|
9182
|
+ $(\'#' . $htmlname.' + .select2\').addClass(\''.$morecss.'\'); |
9183
|
9183
|
});' . "\n"; |
9184
|
9184
|
} elseif ($addjscombo == 2 && !defined('DISABLE_MULTISELECT')) { |
9185
|
9185
|
// Add other js lib |
9186
|
9186
|
// TODO external lib multiselect/jquery.multi-select.js must have been loaded to use this multiselect plugin |
9187
|
9187
|
// ... |
9188
|
|
- $out .= 'console.log(\'addjscombo=2 for htmlname=' . $htmlname . '\');'; |
|
9188
|
+ $out .= 'console.log(\'addjscombo=2 for htmlname='.$htmlname.'\');'; |
9189
|
9189
|
$out .= '$(document).ready(function () { |
9190
|
|
- $(\'#' . $htmlname . '\').multiSelect({ |
|
9190
|
+ $(\'#' . $htmlname.'\').multiSelect({ |
9191
|
9191
|
containerHTML: \'<div class="multi-select-container">\', |
9192
|
9192
|
menuHTML: \'<div class="multi-select-menu">\', |
9193
|
|
- buttonHTML: \'<span class="multi-select-button ' . $morecss . '">\', |
|
9193
|
+ buttonHTML: \'<span class="multi-select-button ' . $morecss.'">\', |
9194
|
9194
|
menuItemHTML: \'<label class="multi-select-menuitem">\', |
9195
|
9195
|
activeClass: \'multi-select-container--open\', |
9196
|
|
- noneText: \'' . $placeholder . '\' |
|
9196
|
+ noneText: \'' . $placeholder.'\' |
9197
|
9197
|
}); |
9198
|
9198
|
})'; |
9199
|
9199
|
} |
|
@@ -9226,7 +9226,7 @@ discard block |
|
|
block discarded – undo |
9226
|
9226
|
return ''; |
9227
|
9227
|
} |
9228
|
9228
|
|
9229
|
|
- $tmpvar = "MAIN_SELECTEDFIELDS_" . $varpage; // To get list of saved selected fields to show |
|
9229
|
+ $tmpvar = "MAIN_SELECTEDFIELDS_".$varpage; // To get list of saved selected fields to show |
9230
|
9230
|
|
9231
|
9231
|
if (!empty($user->conf->$tmpvar)) { // A list of fields was already customized for user |
9232
|
9232
|
$tmparray = explode(',', $user->conf->$tmpvar); |
|
@@ -9269,19 +9269,19 @@ discard block |
|
|
block discarded – undo |
9269
|
9269
|
} |
9270
|
9270
|
|
9271
|
9271
|
// Note: $val['checked'] <> 0 means we must show the field into the combo list @phan-suppress-next-line PhanTypePossiblyInvalidDimOffset |
9272
|
|
- $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>'; |
9273
|
|
- $listcheckedstring .= (empty($val['checked']) ? '' : $key . ','); |
|
9272
|
+ $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>'; |
|
9273
|
+ $listcheckedstring .= (empty($val['checked']) ? '' : $key.','); |
9274
|
9274
|
} |
9275
|
9275
|
} |
9276
|
9276
|
|
9277
|
|
- $out = '<!-- Component multiSelectArrayWithCheckbox ' . $htmlname . ' --> |
|
9277
|
+ $out = '<!-- Component multiSelectArrayWithCheckbox '.$htmlname.' --> |
9278
|
9278
|
|
9279
|
9279
|
<dl class="dropdown"> |
9280
|
9280
|
<dt> |
9281
|
|
- <a href="#' . $htmlname . '"> |
9282
|
|
- ' . img_picto('', 'list') . ' |
|
9281
|
+ <a href="#' . $htmlname.'"> |
|
9282
|
+ ' . img_picto('', 'list').' |
9283
|
9283
|
</a> |
9284
|
|
- <input type="hidden" class="' . $htmlname . '" name="' . $htmlname . '" value="' . $listcheckedstring . '"> |
|
9284
|
+ <input type="hidden" class="' . $htmlname.'" name="'.$htmlname.'" value="'.$listcheckedstring.'"> |
9285
|
9285
|
</dt> |
9286
|
9286
|
<dd class="dropdowndd"> |
9287
|
9287
|
<div class="multiselectcheckbox'.$htmlname.'"> |
|
@@ -9293,19 +9293,19 @@ discard block |
|
|
block discarded – undo |
9293
|
9293
|
</dd> |
9294
|
9294
|
</dl> |
9295
|
9295
|
|
9296
|
|
- <script nonce="' . getNonce() . '" type="text/javascript"> |
|
9296
|
+ <script nonce="' . getNonce().'" type="text/javascript"> |
9297
|
9297
|
jQuery(document).ready(function () { |
9298
|
|
- $(\'.multiselectcheckbox' . $htmlname . ' input[type="checkbox"]\').on(\'click\', function () { |
|
9298
|
+ $(\'.multiselectcheckbox' . $htmlname.' input[type="checkbox"]\').on(\'click\', function () { |
9299
|
9299
|
console.log("A new field was added/removed, we edit field input[name=formfilteraction]"); |
9300
|
9300
|
|
9301
|
9301
|
$("input:hidden[name=formfilteraction]").val(\'listafterchangingselectedfields\'); // Update field so we know we changed something on selected fields after POST |
9302
|
9302
|
|
9303
|
9303
|
var title = $(this).val() + ","; |
9304
|
9304
|
if ($(this).is(\':checked\')) { |
9305
|
|
- $(\'.' . $htmlname . '\').val(title + $(\'.' . $htmlname . '\').val()); |
|
9305
|
+ $(\'.' . $htmlname.'\').val(title + $(\'.'.$htmlname.'\').val()); |
9306
|
9306
|
} |
9307
|
9307
|
else { |
9308
|
|
- $(\'.' . $htmlname . '\').val( $(\'.' . $htmlname . '\').val().replace(title, \'\') ) |
|
9308
|
+ $(\'.' . $htmlname.'\').val( $(\'.'.$htmlname.'\').val().replace(title, \'\') ) |
9309
|
9309
|
} |
9310
|
9310
|
// Now, we submit page |
9311
|
9311
|
//$(this).parents(\'form:first\').submit(); |
|
@@ -9336,7 +9336,7 @@ discard block |
|
|
block discarded – undo |
9336
|
9336
|
*/ |
9337
|
9337
|
public function showCategories($id, $type, $rendermode = 0, $nolink = 0) |
9338
|
9338
|
{ |
9339
|
|
- include_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; |
|
9339
|
+ include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; |
9340
|
9340
|
|
9341
|
9341
|
$cat = new Categorie($this->db); |
9342
|
9342
|
$categories = $cat->containing($id, $type); |
|
@@ -9346,13 +9346,13 @@ discard block |
|
|
block discarded – undo |
9346
|
9346
|
foreach ($categories as $c) { |
9347
|
9347
|
$ways = $c->print_all_ways(' >> ', ($nolink ? 'none' : ''), 0, 1); // $ways[0] = "ccc2 >> ccc2a >> ccc2a1" with html formatted text |
9348
|
9348
|
foreach ($ways as $way) { |
9349
|
|
- $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"' . ($c->color ? ' style="background: #' . $c->color . ';"' : ' style="background: #bbb"') . '>' . $way . '</li>'; |
|
9349
|
+ $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"'.($c->color ? ' style="background: #'.$c->color.';"' : ' style="background: #bbb"').'>'.$way.'</li>'; |
9350
|
9350
|
} |
9351
|
9351
|
} |
9352
|
9352
|
if (empty($toprint)) { |
9353
|
9353
|
return ''; |
9354
|
9354
|
} else { |
9355
|
|
- return '<div class="select2-container-multi-dolibarr"><ul class="select2-choices-dolibarr">' . implode(' ', $toprint) . '</ul></div>'; |
|
9355
|
+ return '<div class="select2-container-multi-dolibarr"><ul class="select2-choices-dolibarr">'.implode(' ', $toprint).'</ul></div>'; |
9356
|
9356
|
} |
9357
|
9357
|
} |
9358
|
9358
|
|
|
@@ -9401,15 +9401,15 @@ discard block |
|
|
block discarded – undo |
9401
|
9401
|
|
9402
|
9402
|
|
9403
|
9403
|
print '<div class="div-table-responsive-no-min">'; |
9404
|
|
- print '<table class="noborder allwidth" data-block="showLinkedObject" data-element="' . $object->element . '" data-elementid="' . $object->id . '" >'; |
|
9404
|
+ print '<table class="noborder allwidth" data-block="showLinkedObject" data-element="'.$object->element.'" data-elementid="'.$object->id.'" >'; |
9405
|
9405
|
|
9406
|
9406
|
print '<tr class="liste_titre">'; |
9407
|
|
- print '<td>' . $langs->trans("Type") . '</td>'; |
9408
|
|
- print '<td>' . $langs->trans("Ref") . '</td>'; |
|
9407
|
+ print '<td>'.$langs->trans("Type").'</td>'; |
|
9408
|
+ print '<td>'.$langs->trans("Ref").'</td>'; |
9409
|
9409
|
print '<td class="center"></td>'; |
9410
|
|
- print '<td class="center">' . $langs->trans("Date") . '</td>'; |
9411
|
|
- print '<td class="right">' . $langs->trans("AmountHTShort") . '</td>'; |
9412
|
|
- print '<td class="right">' . $langs->trans("Status") . '</td>'; |
|
9410
|
+ print '<td class="center">'.$langs->trans("Date").'</td>'; |
|
9411
|
+ print '<td class="right">'.$langs->trans("AmountHTShort").'</td>'; |
|
9412
|
+ print '<td class="right">'.$langs->trans("Status").'</td>'; |
9413
|
9413
|
print '<td></td>'; |
9414
|
9414
|
print '</tr>'; |
9415
|
9415
|
|
|
@@ -9428,13 +9428,13 @@ discard block |
|
|
block discarded – undo |
9428
|
9428
|
if ($objecttype != 'supplier_proposal' && preg_match('/^([^_]+)_([^_]+)/i', $objecttype, $regs)) { |
9429
|
9429
|
$element = $regs[1]; |
9430
|
9430
|
$subelement = $regs[2]; |
9431
|
|
- $tplpath = $element . '/' . $subelement; |
|
9431
|
+ $tplpath = $element.'/'.$subelement; |
9432
|
9432
|
} |
9433
|
9433
|
$tplname = 'linkedobjectblock'; |
9434
|
9434
|
|
9435
|
9435
|
// To work with non standard path |
9436
|
9436
|
if ($objecttype == 'facture') { |
9437
|
|
- $tplpath = 'compta/' . $element; |
|
9437
|
+ $tplpath = 'compta/'.$element; |
9438
|
9438
|
if (!isModEnabled('invoice')) { |
9439
|
9439
|
continue; // Do not show if module disabled |
9440
|
9440
|
} |
|
@@ -9445,7 +9445,7 @@ discard block |
|
|
block discarded – undo |
9445
|
9445
|
continue; // Do not show if module disabled |
9446
|
9446
|
} |
9447
|
9447
|
} elseif ($objecttype == 'propal') { |
9448
|
|
- $tplpath = 'comm/' . $element; |
|
9448
|
+ $tplpath = 'comm/'.$element; |
9449
|
9449
|
if (!isModEnabled('propal')) { |
9450
|
9450
|
continue; // Do not show if module disabled |
9451
|
9451
|
} |
|
@@ -9498,7 +9498,7 @@ discard block |
|
|
block discarded – undo |
9498
|
9498
|
$linkedObjectBlock = $objects; |
9499
|
9499
|
|
9500
|
9500
|
// Output template part (modules that overwrite templates must declare this into descriptor) |
9501
|
|
- $dirtpls = array_merge($conf->modules_parts['tpl'], array('/' . $tplpath . '/tpl')); |
|
9501
|
+ $dirtpls = array_merge($conf->modules_parts['tpl'], array('/'.$tplpath.'/tpl')); |
9502
|
9502
|
foreach ($dirtpls as $reldir) { |
9503
|
9503
|
$reldir = rtrim($reldir, '/'); |
9504
|
9504
|
if ($nboftypesoutput == ($nbofdifferenttypes - 1)) { // No more type to show after |
|
@@ -9506,7 +9506,7 @@ discard block |
|
|
block discarded – undo |
9506
|
9506
|
$noMoreLinkedObjectBlockAfter = 1; |
9507
|
9507
|
} |
9508
|
9508
|
|
9509
|
|
- $res = @include dol_buildpath($reldir . '/' . $tplname . '.tpl.php'); |
|
9509
|
+ $res = @include dol_buildpath($reldir.'/'.$tplname.'.tpl.php'); |
9510
|
9510
|
if ($res) { |
9511
|
9511
|
$nboftypesoutput++; |
9512
|
9512
|
break; |
|
@@ -9515,7 +9515,7 @@ discard block |
|
|
block discarded – undo |
9515
|
9515
|
} |
9516
|
9516
|
|
9517
|
9517
|
if (!$nboftypesoutput) { |
9518
|
|
- print '<tr><td colspan="7"><span class="opacitymedium">' . $langs->trans("None") . '</span></td></tr>'; |
|
9518
|
+ print '<tr><td colspan="7"><span class="opacitymedium">'.$langs->trans("None").'</span></td></tr>'; |
9519
|
9519
|
} |
9520
|
9520
|
|
9521
|
9521
|
print '</table>'; |
|
@@ -9558,14 +9558,14 @@ discard block |
|
|
block discarded – undo |
9558
|
9558
|
if (is_object($object->thirdparty) && !empty($object->thirdparty->id) && $object->thirdparty->id > 0) { |
9559
|
9559
|
$listofidcompanytoscan = $object->thirdparty->id; |
9560
|
9560
|
if (($object->thirdparty->parent > 0) && getDolGlobalString('THIRDPARTY_INCLUDE_PARENT_IN_LINKTO')) { |
9561
|
|
- $listofidcompanytoscan .= ',' . $object->thirdparty->parent; |
|
9561
|
+ $listofidcompanytoscan .= ','.$object->thirdparty->parent; |
9562
|
9562
|
} |
9563
|
9563
|
if (($object->fk_project > 0) && getDolGlobalString('THIRDPARTY_INCLUDE_PROJECT_THIRDPARY_IN_LINKTO')) { |
9564
|
|
- include_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; |
|
9564
|
+ include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; |
9565
|
9565
|
$tmpproject = new Project($this->db); |
9566
|
9566
|
$tmpproject->fetch($object->fk_project); |
9567
|
9567
|
if ($tmpproject->socid > 0 && ($tmpproject->socid != $object->thirdparty->id)) { |
9568
|
|
- $listofidcompanytoscan .= ',' . $tmpproject->socid; |
|
9568
|
+ $listofidcompanytoscan .= ','.$tmpproject->socid; |
9569
|
9569
|
} |
9570
|
9570
|
unset($tmpproject); |
9571
|
9571
|
} |
|
@@ -9575,63 +9575,63 @@ discard block |
|
|
block discarded – undo |
9575
|
9575
|
'enabled' => isModEnabled('propal'), |
9576
|
9576
|
'perms' => 1, |
9577
|
9577
|
'label' => 'LinkToProposal', |
9578
|
|
- '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') . ')'), |
|
9578
|
+ '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').')'), |
9579
|
9579
|
'shipping' => array( |
9580
|
9580
|
'enabled' => isModEnabled('shipping'), |
9581
|
9581
|
'perms' => 1, |
9582
|
9582
|
'label' => 'LinkToExpedition', |
9583
|
|
- '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') . ')'), |
|
9583
|
+ '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').')'), |
9584
|
9584
|
'order' => array( |
9585
|
9585
|
'enabled' => isModEnabled('order'), |
9586
|
9586
|
'perms' => 1, |
9587
|
9587
|
'label' => 'LinkToOrder', |
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() . "commande as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (" . $this->db->sanitize($listofidcompanytoscan) . ') AND t.entity IN (' . getEntity('commande') . ')'), |
|
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()."commande as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('commande').')'), |
9589
|
9589
|
'invoice' => array( |
9590
|
9590
|
'enabled' => isModEnabled('invoice'), |
9591
|
9591
|
'perms' => 1, |
9592
|
9592
|
'label' => 'LinkToInvoice', |
9593
|
|
- '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') . ')'), |
|
9593
|
+ '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').')'), |
9594
|
9594
|
'invoice_template' => array( |
9595
|
9595
|
'enabled' => isModEnabled('invoice'), |
9596
|
9596
|
'perms' => 1, |
9597
|
9597
|
'label' => 'LinkToTemplateInvoice', |
9598
|
|
- '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') . ')'), |
|
9598
|
+ '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').')'), |
9599
|
9599
|
'contrat' => array( |
9600
|
9600
|
'enabled' => isModEnabled('contract'), |
9601
|
9601
|
'perms' => 1, |
9602
|
9602
|
'label' => 'LinkToContract', |
9603
|
9603
|
'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 |
9604
|
|
- 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' |
|
9604
|
+ 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' |
9605
|
9605
|
), |
9606
|
9606
|
'fichinter' => array( |
9607
|
9607
|
'enabled' => isModEnabled('intervention'), |
9608
|
9608
|
'perms' => 1, |
9609
|
9609
|
'label' => 'LinkToIntervention', |
9610
|
|
- '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') . ')'), |
|
9610
|
+ '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').')'), |
9611
|
9611
|
'supplier_proposal' => array( |
9612
|
9612
|
'enabled' => isModEnabled('supplier_proposal'), |
9613
|
9613
|
'perms' => 1, |
9614
|
9614
|
'label' => 'LinkToSupplierProposal', |
9615
|
|
- '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') . ')'), |
|
9615
|
+ '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').')'), |
9616
|
9616
|
'order_supplier' => array( |
9617
|
9617
|
'enabled' => isModEnabled("supplier_order"), |
9618
|
9618
|
'perms' => 1, |
9619
|
9619
|
'label' => 'LinkToSupplierOrder', |
9620
|
|
- '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') . ')'), |
|
9620
|
+ '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').')'), |
9621
|
9621
|
'invoice_supplier' => array( |
9622
|
9622
|
'enabled' => isModEnabled("supplier_invoice"), |
9623
|
9623
|
'perms' => 1, 'label' => 'LinkToSupplierInvoice', |
9624
|
|
- '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') . ')'), |
|
9624
|
+ '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').')'), |
9625
|
9625
|
'ticket' => array( |
9626
|
9626
|
'enabled' => isModEnabled('ticket'), |
9627
|
9627
|
'perms' => 1, |
9628
|
9628
|
'label' => 'LinkToTicket', |
9629
|
|
- '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') . ')'), |
|
9629
|
+ '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').')'), |
9630
|
9630
|
'mo' => array( |
9631
|
9631
|
'enabled' => isModEnabled('mrp'), |
9632
|
9632
|
'perms' => 1, |
9633
|
9633
|
'label' => 'LinkToMo', |
9634
|
|
- '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') . ')') |
|
9634
|
+ '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').')') |
9635
|
9635
|
); |
9636
|
9636
|
} |
9637
|
9637
|
|
|
@@ -9669,23 +9669,23 @@ discard block |
|
|
block discarded – undo |
9669
|
9669
|
} |
9670
|
9670
|
|
9671
|
9671
|
if (!empty($possiblelink['perms']) && (empty($restrictlinksto) || in_array($key, $restrictlinksto)) && (empty($excludelinksto) || !in_array($key, $excludelinksto))) { |
9672
|
|
- $htmltoenteralink .= '<div id="' . $key . 'list"' . (empty($conf->use_javascript_ajax) ? '' : ' style="display:none"') . '>'; |
|
9672
|
+ $htmltoenteralink .= '<div id="'.$key.'list"'.(empty($conf->use_javascript_ajax) ? '' : ' style="display:none"').'>'; |
9673
|
9673
|
|
9674
|
9674
|
// Section for free ref input |
9675
|
9675
|
if (!getDolGlobalString('MAIN_HIDE_LINK_BY_REF_IN_LINKTO')) { |
9676
|
9676
|
$htmltoenteralink .= '<br>'."\n"; |
9677
|
9677
|
$htmltoenteralink .= '<!-- form to add a link from anywhere -->'."\n"; |
9678
|
|
- $htmltoenteralink .= '<form action="' . $_SERVER["PHP_SELF"] . '" method="POST" name="formlinkedbyref' . $key . '">'; |
9679
|
|
- $htmltoenteralink .= '<input type="hidden" name="id" value="' . $object->id . '">'; |
|
9678
|
+ $htmltoenteralink .= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" name="formlinkedbyref'.$key.'">'; |
|
9679
|
+ $htmltoenteralink .= '<input type="hidden" name="id" value="'.$object->id.'">'; |
9680
|
9680
|
$htmltoenteralink .= '<input type="hidden" name="action" value="addlinkbyref">'; |
9681
|
|
- $htmltoenteralink .= '<input type="hidden" name="token" value="' . newToken() . '">'; |
9682
|
|
- $htmltoenteralink .= '<input type="hidden" name="addlink" value="' . $key . '">'; |
|
9681
|
+ $htmltoenteralink .= '<input type="hidden" name="token" value="'.newToken().'">'; |
|
9682
|
+ $htmltoenteralink .= '<input type="hidden" name="addlink" value="'.$key.'">'; |
9683
|
9683
|
$htmltoenteralink .= '<table class="noborder">'; |
9684
|
9684
|
$htmltoenteralink .= '<tr>'; |
9685
|
9685
|
//print '<td>' . $langs->trans("Ref") . '</td>'; |
9686
|
|
- $htmltoenteralink .= '<td class="center"><input type="text" placeholder="'.dol_escape_htmltag($langs->trans("Ref")).'" name="reftolinkto" value="' . dol_escape_htmltag(GETPOST('reftolinkto', 'alpha')) . '"> '; |
9687
|
|
- $htmltoenteralink .= '<input type="submit" class="button small valignmiddle" value="' . $langs->trans('ToLink') . '"> '; |
9688
|
|
- $htmltoenteralink .= '<input type="submit" class="button small" name="cancel" value="' . $langs->trans('Cancel') . '"></td>'; |
|
9686
|
+ $htmltoenteralink .= '<td class="center"><input type="text" placeholder="'.dol_escape_htmltag($langs->trans("Ref")).'" name="reftolinkto" value="'.dol_escape_htmltag(GETPOST('reftolinkto', 'alpha')).'"> '; |
|
9687
|
+ $htmltoenteralink .= '<input type="submit" class="button small valignmiddle" value="'.$langs->trans('ToLink').'"> '; |
|
9688
|
+ $htmltoenteralink .= '<input type="submit" class="button small" name="cancel" value="'.$langs->trans('Cancel').'"></td>'; |
9689
|
9689
|
$htmltoenteralink .= '</tr>'; |
9690
|
9690
|
$htmltoenteralink .= '</table>'; |
9691
|
9691
|
$htmltoenteralink .= '</form>'; |
|
@@ -9702,47 +9702,47 @@ discard block |
|
|
block discarded – undo |
9702
|
9702
|
// Section for free predefined list |
9703
|
9703
|
$htmltoenteralink .= '<br>'; |
9704
|
9704
|
$htmltoenteralink .= '<!-- form to add a link from object to same thirdparty -->'."\n"; |
9705
|
|
- $htmltoenteralink .= '<form action="' . $_SERVER["PHP_SELF"] . '" method="POST" name="formlinked' . $key . '">'; |
|
9705
|
+ $htmltoenteralink .= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" name="formlinked'.$key.'">'; |
9706
|
9706
|
$htmltoenteralink .= '<input type="hidden" name="action" value="addlink">'; |
9707
|
|
- $htmltoenteralink .= '<input type="hidden" name="token" value="' . newToken() . '">'; |
9708
|
|
- $htmltoenteralink .= '<input type="hidden" name="id" value="' . $object->id . '">'; |
9709
|
|
- $htmltoenteralink .= '<input type="hidden" name="addlink" value="' . $key . '">'; |
|
9707
|
+ $htmltoenteralink .= '<input type="hidden" name="token" value="'.newToken().'">'; |
|
9708
|
+ $htmltoenteralink .= '<input type="hidden" name="id" value="'.$object->id.'">'; |
|
9709
|
+ $htmltoenteralink .= '<input type="hidden" name="addlink" value="'.$key.'">'; |
9710
|
9710
|
$htmltoenteralink .= '<table class="noborder">'; |
9711
|
9711
|
$htmltoenteralink .= '<tr class="liste_titre">'; |
9712
|
9712
|
$htmltoenteralink .= '<td class="nowrap"></td>'; |
9713
|
|
- $htmltoenteralink .= '<td>' . $langs->trans("Ref") . '</td>'; |
9714
|
|
- $htmltoenteralink .= '<td>' . $langs->trans("RefCustomer") . '</td>'; |
9715
|
|
- $htmltoenteralink .= '<td class="right">' . $langs->trans("AmountHTShort") . '</td>'; |
9716
|
|
- $htmltoenteralink .= '<td>' . $langs->trans("Company") . '</td>'; |
|
9713
|
+ $htmltoenteralink .= '<td>'.$langs->trans("Ref").'</td>'; |
|
9714
|
+ $htmltoenteralink .= '<td>'.$langs->trans("RefCustomer").'</td>'; |
|
9715
|
+ $htmltoenteralink .= '<td class="right">'.$langs->trans("AmountHTShort").'</td>'; |
|
9716
|
+ $htmltoenteralink .= '<td>'.$langs->trans("Company").'</td>'; |
9717
|
9717
|
$htmltoenteralink .= '</tr>'; |
9718
|
9718
|
while ($i < $num) { |
9719
|
9719
|
$objp = $this->db->fetch_object($resqllist); |
9720
|
9720
|
|
9721
|
9721
|
$htmltoenteralink .= '<tr class="oddeven">'; |
9722
|
9722
|
$htmltoenteralink .= '<td>'; |
9723
|
|
- $htmltoenteralink .= '<input type="checkbox" name="idtolinkto[' . $key . '_' . $objp->rowid . ']" id="' . $key . '_' . $objp->rowid . '" value="' . $objp->rowid . '">'; |
|
9723
|
+ $htmltoenteralink .= '<input type="checkbox" name="idtolinkto['.$key.'_'.$objp->rowid.']" id="'.$key.'_'.$objp->rowid.'" value="'.$objp->rowid.'">'; |
9724
|
9724
|
$htmltoenteralink .= '</td>'; |
9725
|
|
- $htmltoenteralink .= '<td><label for="' . $key . '_' . $objp->rowid . '">' . $objp->ref . '</label></td>'; |
9726
|
|
- $htmltoenteralink .= '<td>' . (!empty($objp->ref_client) ? $objp->ref_client : (!empty($objp->ref_supplier) ? $objp->ref_supplier : '')) . '</td>'; |
|
9725
|
+ $htmltoenteralink .= '<td><label for="'.$key.'_'.$objp->rowid.'">'.$objp->ref.'</label></td>'; |
|
9726
|
+ $htmltoenteralink .= '<td>'.(!empty($objp->ref_client) ? $objp->ref_client : (!empty($objp->ref_supplier) ? $objp->ref_supplier : '')).'</td>'; |
9727
|
9727
|
$htmltoenteralink .= '<td class="right">'; |
9728
|
9728
|
if ($possiblelink['label'] == 'LinkToContract') { |
9729
|
|
- $htmltoenteralink .= $form->textwithpicto('', $langs->trans("InformationOnLinkToContract")) . ' '; |
|
9729
|
+ $htmltoenteralink .= $form->textwithpicto('', $langs->trans("InformationOnLinkToContract")).' '; |
9730
|
9730
|
} |
9731
|
|
- $htmltoenteralink .= '<span class="amount">' . (isset($objp->total_ht) ? price($objp->total_ht) : '') . '</span>'; |
|
9731
|
+ $htmltoenteralink .= '<span class="amount">'.(isset($objp->total_ht) ? price($objp->total_ht) : '').'</span>'; |
9732
|
9732
|
$htmltoenteralink .= '</td>'; |
9733
|
|
- $htmltoenteralink .= '<td>' . $objp->name . '</td>'; |
|
9733
|
+ $htmltoenteralink .= '<td>'.$objp->name.'</td>'; |
9734
|
9734
|
$htmltoenteralink .= '</tr>'; |
9735
|
9735
|
$i++; |
9736
|
9736
|
} |
9737
|
9737
|
$htmltoenteralink .= '</table>'; |
9738
|
9738
|
$htmltoenteralink .= '<div class="center">'; |
9739
|
9739
|
if ($num) { |
9740
|
|
- $htmltoenteralink .= '<input type="submit" class="button valignmiddle marginleftonly marginrightonly small" value="' . $langs->trans('ToLink') . '">'; |
|
9740
|
+ $htmltoenteralink .= '<input type="submit" class="button valignmiddle marginleftonly marginrightonly small" value="'.$langs->trans('ToLink').'">'; |
9741
|
9741
|
} |
9742
|
9742
|
if (empty($conf->use_javascript_ajax)) { |
9743
|
|
- $htmltoenteralink .= '<input type="submit" class="button button-cancel marginleftonly marginrightonly small" name="cancel" value="' . $langs->trans("Cancel") . '"></div>'; |
|
9743
|
+ $htmltoenteralink .= '<input type="submit" class="button button-cancel marginleftonly marginrightonly small" name="cancel" value="'.$langs->trans("Cancel").'"></div>'; |
9744
|
9744
|
} else { |
9745
|
|
- $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>'; |
|
9745
|
+ $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>'; |
9746
|
9746
|
} |
9747
|
9747
|
$htmltoenteralink .= '</form>'; |
9748
|
9748
|
} |
|
@@ -9756,10 +9756,10 @@ discard block |
|
|
block discarded – undo |
9756
|
9756
|
|
9757
|
9757
|
// Complete the list for the combo box |
9758
|
9758
|
if ($num > 0 || !getDolGlobalString('MAIN_HIDE_LINK_BY_REF_IN_LINKTO')) { |
9759
|
|
- $linktoelemlist .= '<li><a href="#linkto' . $key . '" class="linkto dropdowncloseonclick" rel="' . $key . '">' . $langs->trans($possiblelink['label']) . ' (' . $num . ')</a></li>'; |
|
9759
|
+ $linktoelemlist .= '<li><a href="#linkto'.$key.'" class="linkto dropdowncloseonclick" rel="'.$key.'">'.$langs->trans($possiblelink['label']).' ('.$num.')</a></li>'; |
9760
|
9760
|
// } else $linktoelem.=$langs->trans($possiblelink['label']); |
9761
|
9761
|
} else { |
9762
|
|
- $linktoelemlist .= '<li><span class="linktodisabled">' . $langs->trans($possiblelink['label']) . ' (0)</span></li>'; |
|
9762
|
+ $linktoelemlist .= '<li><span class="linktodisabled">'.$langs->trans($possiblelink['label']).' (0)</span></li>'; |
9763
|
9763
|
} |
9764
|
9764
|
} |
9765
|
9765
|
} |
|
@@ -9769,11 +9769,11 @@ discard block |
|
|
block discarded – undo |
9769
|
9769
|
<dl class="dropdown" id="linktoobjectname"> |
9770
|
9770
|
'; |
9771
|
9771
|
if (!empty($conf->use_javascript_ajax)) { |
9772
|
|
- $linktoelem .= '<dt><a href="#linktoobjectname"><span class="fas fa-link paddingrightonly"></span>' . $langs->trans("LinkTo") . '...</a></dt>'; |
|
9772
|
+ $linktoelem .= '<dt><a href="#linktoobjectname"><span class="fas fa-link paddingrightonly"></span>'.$langs->trans("LinkTo").'...</a></dt>'; |
9773
|
9773
|
} |
9774
|
9774
|
$linktoelem .= '<dd> |
9775
|
9775
|
<div class="multiselectlinkto"> |
9776
|
|
- <ul class="ulselectedfields">' . $linktoelemlist . ' |
|
9776
|
+ <ul class="ulselectedfields">' . $linktoelemlist.' |
9777
|
9777
|
</ul> |
9778
|
9778
|
</div> |
9779
|
9779
|
</dd> |
|
@@ -9784,7 +9784,7 @@ discard block |
|
|
block discarded – undo |
9784
|
9784
|
|
9785
|
9785
|
if (!empty($conf->use_javascript_ajax)) { |
9786
|
9786
|
print '<!-- Add js to show linkto box --> |
9787
|
|
- <script nonce="' . getNonce() . '"> |
|
9787
|
+ <script nonce="' . getNonce().'"> |
9788
|
9788
|
jQuery(document).ready(function() { |
9789
|
9789
|
jQuery(".linkto").click(function() { |
9790
|
9790
|
console.log("We choose to show/hide links for rel="+jQuery(this).attr(\'rel\')+" so #"+jQuery(this).attr(\'rel\')+"list"); |
|
@@ -9831,19 +9831,19 @@ discard block |
|
|
block discarded – undo |
9831
|
9831
|
|
9832
|
9832
|
$disabled = ($disabled ? ' disabled' : ''); |
9833
|
9833
|
|
9834
|
|
- $resultyesno = '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" id="' . $htmlname . '" name="' . $htmlname . '"' . $disabled . '>' . "\n"; |
|
9834
|
+ $resultyesno = '<select class="flat'.($morecss ? ' '.$morecss : '').'" id="'.$htmlname.'" name="'.$htmlname.'"'.$disabled.'>'."\n"; |
9835
|
9835
|
if ($useempty) { |
9836
|
|
- $resultyesno .= '<option value="-1"' . (($value < 0) ? ' selected' : '') . '> </option>' . "\n"; |
|
9836
|
+ $resultyesno .= '<option value="-1"'.(($value < 0) ? ' selected' : '').'> </option>'."\n"; |
9837
|
9837
|
} |
9838
|
9838
|
if (("$value" == 'yes') || ($value == 1)) { |
9839
|
|
- $resultyesno .= '<option value="' . $yes . '" selected>' . $langs->trans($labelyes) . '</option>' . "\n"; |
9840
|
|
- $resultyesno .= '<option value="' . $no . '">' . $langs->trans($labelno) . '</option>' . "\n"; |
|
9839
|
+ $resultyesno .= '<option value="'.$yes.'" selected>'.$langs->trans($labelyes).'</option>'."\n"; |
|
9840
|
+ $resultyesno .= '<option value="'.$no.'">'.$langs->trans($labelno).'</option>'."\n"; |
9841
|
9841
|
} else { |
9842
|
9842
|
$selected = (($useempty && $value != '0' && $value != 'no') ? '' : ' selected'); |
9843
|
|
- $resultyesno .= '<option value="' . $yes . '">' . $langs->trans($labelyes) . '</option>' . "\n"; |
9844
|
|
- $resultyesno .= '<option value="' . $no . '"' . $selected . '>' . $langs->trans($labelno) . '</option>' . "\n"; |
|
9843
|
+ $resultyesno .= '<option value="'.$yes.'">'.$langs->trans($labelyes).'</option>'."\n"; |
|
9844
|
+ $resultyesno .= '<option value="'.$no.'"'.$selected.'>'.$langs->trans($labelno).'</option>'."\n"; |
9845
|
9845
|
} |
9846
|
|
- $resultyesno .= '</select>' . "\n"; |
|
9846
|
+ $resultyesno .= '</select>'."\n"; |
9847
|
9847
|
|
9848
|
9848
|
if ($addjscombo) { |
9849
|
9849
|
$resultyesno .= ajax_combobox($htmlname, array(), 0, 0, 'resolve', ($useempty < 0 ? (string) $useempty : '-1'), $morecss); |
|
@@ -9867,12 +9867,12 @@ discard block |
|
|
block discarded – undo |
9867
|
9867
|
{ |
9868
|
9868
|
// phpcs:enable |
9869
|
9869
|
$sql = "SELECT rowid, label"; |
9870
|
|
- $sql .= " FROM " . $this->db->prefix() . "export_model"; |
9871
|
|
- $sql .= " WHERE type = '" . $this->db->escape($type) . "'"; |
|
9870
|
+ $sql .= " FROM ".$this->db->prefix()."export_model"; |
|
9871
|
+ $sql .= " WHERE type = '".$this->db->escape($type)."'"; |
9872
|
9872
|
$sql .= " ORDER BY rowid"; |
9873
|
9873
|
$result = $this->db->query($sql); |
9874
|
9874
|
if ($result) { |
9875
|
|
- print '<select class="flat" id="select_' . $htmlname . '" name="' . $htmlname . '">'; |
|
9875
|
+ print '<select class="flat" id="select_'.$htmlname.'" name="'.$htmlname.'">'; |
9876
|
9876
|
if ($useempty) { |
9877
|
9877
|
print '<option value="-1"> </option>'; |
9878
|
9878
|
} |
|
@@ -9882,9 +9882,9 @@ discard block |
|
|
block discarded – undo |
9882
|
9882
|
while ($i < $num) { |
9883
|
9883
|
$obj = $this->db->fetch_object($result); |
9884
|
9884
|
if ($selected == $obj->rowid) { |
9885
|
|
- print '<option value="' . $obj->rowid . '" selected>'; |
|
9885
|
+ print '<option value="'.$obj->rowid.'" selected>'; |
9886
|
9886
|
} else { |
9887
|
|
- print '<option value="' . $obj->rowid . '">'; |
|
9887
|
+ print '<option value="'.$obj->rowid.'">'; |
9888
|
9888
|
} |
9889
|
9889
|
print $obj->label; |
9890
|
9890
|
print '</option>'; |
|
@@ -9975,8 +9975,8 @@ discard block |
|
|
block discarded – undo |
9975
|
9975
|
$stringforfirstkey .= ' CTL +'; |
9976
|
9976
|
} |
9977
|
9977
|
|
9978
|
|
- $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>'; |
9979
|
|
- $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>'; |
|
9978
|
+ $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>'; |
|
9979
|
+ $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>'; |
9980
|
9980
|
} |
9981
|
9981
|
|
9982
|
9982
|
//print "xx".$previous_ref."x".$next_ref; |
|
@@ -9984,18 +9984,18 @@ discard block |
|
|
block discarded – undo |
9984
|
9984
|
|
9985
|
9985
|
// Right part of banner |
9986
|
9986
|
if ($morehtmlright) { |
9987
|
|
- $ret .= '<div class="inline-block floatleft">' . $morehtmlright . '</div>'; |
|
9987
|
+ $ret .= '<div class="inline-block floatleft">'.$morehtmlright.'</div>'; |
9988
|
9988
|
} |
9989
|
9989
|
|
9990
|
9990
|
if ($previous_ref || $next_ref || $morehtml) { |
9991
|
9991
|
$ret .= '<div class="pagination paginationref"><ul class="right">'; |
9992
|
9992
|
} |
9993
|
9993
|
if ($morehtml && getDolGlobalInt('MAIN_OPTIMIZEFORTEXTBROWSER') < 2) { |
9994
|
|
- $ret .= '<!-- morehtml --><li class="noborder litext' . (($shownav && $previous_ref && $next_ref) ? ' clearbothonsmartphone' : '') . '">' . $morehtml . '</li>'; |
|
9994
|
+ $ret .= '<!-- morehtml --><li class="noborder litext'.(($shownav && $previous_ref && $next_ref) ? ' clearbothonsmartphone' : '').'">'.$morehtml.'</li>'; |
9995
|
9995
|
} |
9996
|
9996
|
if ($shownav && ($previous_ref || $next_ref)) { |
9997
|
|
- $ret .= '<li class="pagination">' . $previous_ref . '</li>'; |
9998
|
|
- $ret .= '<li class="pagination">' . $next_ref . '</li>'; |
|
9997
|
+ $ret .= '<li class="pagination">'.$previous_ref.'</li>'; |
|
9998
|
+ $ret .= '<li class="pagination">'.$next_ref.'</li>'; |
9999
|
9999
|
} |
10000
|
10000
|
if ($previous_ref || $next_ref || $morehtml) { |
10001
|
10001
|
$ret .= '</ul></div>'; |
|
@@ -10010,7 +10010,7 @@ discard block |
|
|
block discarded – undo |
10010
|
10010
|
$morehtmlstatus = $hookmanager->resPrint; |
10011
|
10011
|
} |
10012
|
10012
|
if ($morehtmlstatus) { |
10013
|
|
- $ret .= '<div class="statusref">' . $morehtmlstatus . '</div>'; |
|
10013
|
+ $ret .= '<div class="statusref">'.$morehtmlstatus.'</div>'; |
10014
|
10014
|
} |
10015
|
10015
|
|
10016
|
10016
|
$parameters = array(); |
|
@@ -10024,14 +10024,14 @@ discard block |
|
|
block discarded – undo |
10024
|
10024
|
// Left part of banner |
10025
|
10025
|
if ($morehtmlleft) { |
10026
|
10026
|
if ($conf->browser->layout == 'phone') { |
10027
|
|
- $ret .= '<!-- morehtmlleft --><div class="floatleft">' . $morehtmlleft . '</div>'; |
|
10027
|
+ $ret .= '<!-- morehtmlleft --><div class="floatleft">'.$morehtmlleft.'</div>'; |
10028
|
10028
|
} else { |
10029
|
|
- $ret .= '<!-- morehtmlleft --><div class="inline-block floatleft">' . $morehtmlleft . '</div>'; |
|
10029
|
+ $ret .= '<!-- morehtmlleft --><div class="inline-block floatleft">'.$morehtmlleft.'</div>'; |
10030
|
10030
|
} |
10031
|
10031
|
} |
10032
|
10032
|
|
10033
|
10033
|
//if ($conf->browser->layout == 'phone') $ret.='<div class="clearboth"></div>'; |
10034
|
|
- $ret .= '<div class="inline-block floatleft valignmiddle maxwidth750 marginbottomonly refid' . (($shownav && ($previous_ref || $next_ref)) ? ' refidpadding' : '') . '">'; |
|
10034
|
+ $ret .= '<div class="inline-block floatleft valignmiddle maxwidth750 marginbottomonly refid'.(($shownav && ($previous_ref || $next_ref)) ? ' refidpadding' : '').'">'; |
10035
|
10035
|
|
10036
|
10036
|
// For thirdparty, contact, user, member, the ref is the id, so we show something else |
10037
|
10037
|
if ($object->element == 'societe') { |
|
@@ -10045,7 +10045,7 @@ discard block |
|
|
block discarded – undo |
10045
|
10045
|
|
10046
|
10046
|
if (is_array($arrayoflangcode) && count($arrayoflangcode)) { |
10047
|
10047
|
if (!is_object($extralanguages)) { |
10048
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/class/extralanguages.class.php'; |
|
10048
|
+ include_once DOL_DOCUMENT_ROOT.'/core/class/extralanguages.class.php'; |
10049
|
10049
|
$extralanguages = new ExtraLanguages($this->db); |
10050
|
10050
|
} |
10051
|
10051
|
$extralanguages->fetch_name_extralanguages('societe'); |
|
@@ -10060,29 +10060,29 @@ discard block |
|
|
block discarded – undo |
10060
|
10060
|
if ($object->array_languages['name'][$extralangcode]) { |
10061
|
10061
|
$htmltext .= $object->array_languages['name'][$extralangcode]; |
10062
|
10062
|
} else { |
10063
|
|
- $htmltext .= '<span class="opacitymedium">' . $langs->trans("SwitchInEditModeToAddTranslation") . '</span>'; |
|
10063
|
+ $htmltext .= '<span class="opacitymedium">'.$langs->trans("SwitchInEditModeToAddTranslation").'</span>'; |
10064
|
10064
|
} |
10065
|
10065
|
} |
10066
|
|
- $ret .= '<!-- Show translations of name -->' . "\n"; |
|
10066
|
+ $ret .= '<!-- Show translations of name -->'."\n"; |
10067
|
10067
|
$ret .= $this->textwithpicto('', $htmltext, -1, 'language', 'opacitymedium paddingleft'); |
10068
|
10068
|
} |
10069
|
10069
|
} |
10070
|
10070
|
} elseif ($object->element == 'member') { |
10071
|
10071
|
'@phan-var-force Adherent $object'; |
10072
|
|
- $ret .= $object->ref . '<br>'; |
|
10072
|
+ $ret .= $object->ref.'<br>'; |
10073
|
10073
|
$fullname = $object->getFullName($langs); |
10074
|
10074
|
if ($object->morphy == 'mor' && $object->societe) { |
10075
|
|
- $ret .= dol_htmlentities($object->societe) . ((!empty($fullname) && $object->societe != $fullname) ? ' (' . dol_htmlentities($fullname) . $addgendertxt . ')' : ''); |
|
10075
|
+ $ret .= dol_htmlentities($object->societe).((!empty($fullname) && $object->societe != $fullname) ? ' ('.dol_htmlentities($fullname).$addgendertxt.')' : ''); |
10076
|
10076
|
} else { |
10077
|
|
- $ret .= dol_htmlentities($fullname) . $addgendertxt . ((!empty($object->societe) && $object->societe != $fullname) ? ' (' . dol_htmlentities($object->societe) . ')' : ''); |
|
10077
|
+ $ret .= dol_htmlentities($fullname).$addgendertxt.((!empty($object->societe) && $object->societe != $fullname) ? ' ('.dol_htmlentities($object->societe).')' : ''); |
10078
|
10078
|
} |
10079
|
10079
|
} elseif (in_array($object->element, array('contact', 'user'))) { |
10080
|
|
- $ret .= dol_htmlentities($object->getFullName($langs)) . $addgendertxt; |
|
10080
|
+ $ret .= dol_htmlentities($object->getFullName($langs)).$addgendertxt; |
10081
|
10081
|
} elseif ($object->element == 'usergroup') { |
10082
|
10082
|
$ret .= dol_htmlentities($object->name); |
10083
|
10083
|
} elseif (in_array($object->element, array('action', 'agenda'))) { |
10084
|
10084
|
'@phan-var-force ActionComm $object'; |
10085
|
|
- $ret .= $object->ref . '<br>' . $object->label; |
|
10085
|
+ $ret .= $object->ref.'<br>'.$object->label; |
10086
|
10086
|
} elseif (in_array($object->element, array('adherent_type'))) { |
10087
|
10087
|
$ret .= $object->label; |
10088
|
10088
|
} elseif ($object->element == 'ecm_directories') { |
|
@@ -10135,9 +10135,9 @@ discard block |
|
|
block discarded – undo |
10135
|
10135
|
} |
10136
|
10136
|
|
10137
|
10137
|
// Barcode image @phan-suppress-next-line PhanUndeclaredProperty |
10138
|
|
- $url = DOL_URL_ROOT . '/viewimage.php?modulepart=barcode&generator=' . urlencode($object->barcode_type_coder) . '&code=' . urlencode($object->barcode) . '&encoding=' . urlencode($object->barcode_type_code); |
10139
|
|
- $out = '<!-- url barcode = ' . $url . ' -->'; |
10140
|
|
- $out .= '<img src="' . $url . '"' . ($morecss ? ' class="' . $morecss . '"' : '') . '>'; |
|
10138
|
+ $url = DOL_URL_ROOT.'/viewimage.php?modulepart=barcode&generator='.urlencode($object->barcode_type_coder).'&code='.urlencode($object->barcode).'&encoding='.urlencode($object->barcode_type_code); |
|
10139
|
+ $out = '<!-- url barcode = '.$url.' -->'; |
|
10140
|
+ $out .= '<img src="'.$url.'"'.($morecss ? ' class="'.$morecss.'"' : '').'>'; |
10141
|
10141
|
|
10142
|
10142
|
return $out; |
10143
|
10143
|
} |
|
@@ -10164,7 +10164,7 @@ discard block |
|
|
block discarded – undo |
10164
|
10164
|
global $conf, $langs; |
10165
|
10165
|
|
10166
|
10166
|
$entity = (empty($object->entity) ? $conf->entity : $object->entity); |
10167
|
|
- $id = (empty($object->id) ? $object->rowid : $object->id); // @phan-suppress-current-line PhanUndeclaredProperty (->rowid) |
|
10167
|
+ $id = (empty($object->id) ? $object->rowid : $object->id); // @phan-suppress-current-line PhanUndeclaredProperty (->rowid) |
10168
|
10168
|
|
10169
|
10169
|
$dir = ''; |
10170
|
10170
|
$file = ''; |
|
@@ -10177,28 +10177,28 @@ discard block |
|
|
block discarded – undo |
10177
|
10177
|
if (!empty($object->logo)) { |
10178
|
10178
|
if (dolIsAllowedForPreview($object->logo)) { |
10179
|
10179
|
if ((string) $imagesize == 'mini') { |
10180
|
|
- $file = get_exdir(0, 0, 0, 0, $object, 'thirdparty') . 'logos/' . getImageFileNameForSize($object->logo, '_mini'); // getImageFileNameForSize include the thumbs |
|
10180
|
+ $file = get_exdir(0, 0, 0, 0, $object, 'thirdparty').'logos/'.getImageFileNameForSize($object->logo, '_mini'); // getImageFileNameForSize include the thumbs |
10181
|
10181
|
} elseif ((string) $imagesize == 'small') { |
10182
|
|
- $file = get_exdir(0, 0, 0, 0, $object, 'thirdparty') . 'logos/' . getImageFileNameForSize($object->logo, '_small'); |
|
10182
|
+ $file = get_exdir(0, 0, 0, 0, $object, 'thirdparty').'logos/'.getImageFileNameForSize($object->logo, '_small'); |
10183
|
10183
|
} else { |
10184
|
|
- $file = get_exdir(0, 0, 0, 0, $object, 'thirdparty') . 'logos/' . $object->logo; |
|
10184
|
+ $file = get_exdir(0, 0, 0, 0, $object, 'thirdparty').'logos/'.$object->logo; |
10185
|
10185
|
} |
10186
|
|
- $originalfile = get_exdir(0, 0, 0, 0, $object, 'thirdparty') . 'logos/' . $object->logo; |
|
10186
|
+ $originalfile = get_exdir(0, 0, 0, 0, $object, 'thirdparty').'logos/'.$object->logo; |
10187
|
10187
|
} |
10188
|
10188
|
} |
10189
|
10189
|
$email = $object->email; |
10190
|
10190
|
} elseif ($modulepart == 'contact') { |
10191
|
|
- $dir = $conf->societe->multidir_output[$entity] . '/contact'; |
|
10191
|
+ $dir = $conf->societe->multidir_output[$entity].'/contact'; |
10192
|
10192
|
if (!empty($object->photo)) { |
10193
|
10193
|
if (dolIsAllowedForPreview($object->photo)) { |
10194
|
10194
|
if ((string) $imagesize == 'mini') { |
10195
|
|
- $file = get_exdir(0, 0, 0, 0, $object, 'contact') . 'photos/' . getImageFileNameForSize($object->photo, '_mini'); |
|
10195
|
+ $file = get_exdir(0, 0, 0, 0, $object, 'contact').'photos/'.getImageFileNameForSize($object->photo, '_mini'); |
10196
|
10196
|
} elseif ((string) $imagesize == 'small') { |
10197
|
|
- $file = get_exdir(0, 0, 0, 0, $object, 'contact') . 'photos/' . getImageFileNameForSize($object->photo, '_small'); |
|
10197
|
+ $file = get_exdir(0, 0, 0, 0, $object, 'contact').'photos/'.getImageFileNameForSize($object->photo, '_small'); |
10198
|
10198
|
} else { |
10199
|
|
- $file = get_exdir(0, 0, 0, 0, $object, 'contact') . 'photos/' . $object->photo; |
|
10199
|
+ $file = get_exdir(0, 0, 0, 0, $object, 'contact').'photos/'.$object->photo; |
10200
|
10200
|
} |
10201
|
|
- $originalfile = get_exdir(0, 0, 0, 0, $object, 'contact') . 'photos/' . $object->photo; |
|
10201
|
+ $originalfile = get_exdir(0, 0, 0, 0, $object, 'contact').'photos/'.$object->photo; |
10202
|
10202
|
} |
10203
|
10203
|
} |
10204
|
10204
|
$email = $object->email; |
|
@@ -10208,17 +10208,17 @@ discard block |
|
|
block discarded – undo |
10208
|
10208
|
if (!empty($object->photo)) { |
10209
|
10209
|
if (dolIsAllowedForPreview($object->photo)) { |
10210
|
10210
|
if ((string) $imagesize == 'mini') { |
10211
|
|
- $file = get_exdir(0, 0, 0, 0, $object, 'user') . 'photos/' . getImageFileNameForSize($object->photo, '_mini'); |
|
10211
|
+ $file = get_exdir(0, 0, 0, 0, $object, 'user').'photos/'.getImageFileNameForSize($object->photo, '_mini'); |
10212
|
10212
|
} elseif ((string) $imagesize == 'small') { |
10213
|
|
- $file = get_exdir(0, 0, 0, 0, $object, 'user') . 'photos/' . getImageFileNameForSize($object->photo, '_small'); |
|
10213
|
+ $file = get_exdir(0, 0, 0, 0, $object, 'user').'photos/'.getImageFileNameForSize($object->photo, '_small'); |
10214
|
10214
|
} else { |
10215
|
|
- $file = get_exdir(0, 0, 0, 0, $object, 'user') . 'photos/' . $object->photo; |
|
10215
|
+ $file = get_exdir(0, 0, 0, 0, $object, 'user').'photos/'.$object->photo; |
10216
|
10216
|
} |
10217
|
|
- $originalfile = get_exdir(0, 0, 0, 0, $object, 'user') . 'photos/' . $object->photo; |
|
10217
|
+ $originalfile = get_exdir(0, 0, 0, 0, $object, 'user').'photos/'.$object->photo; |
10218
|
10218
|
} |
10219
|
10219
|
} |
10220
|
10220
|
if (getDolGlobalString('MAIN_OLD_IMAGE_LINKS')) { |
10221
|
|
- $altfile = $object->id . ".jpg"; // For backward compatibility |
|
10221
|
+ $altfile = $object->id.".jpg"; // For backward compatibility |
10222
|
10222
|
} |
10223
|
10223
|
$email = $object->email; |
10224
|
10224
|
$capture = 'user'; |
|
@@ -10227,17 +10227,17 @@ discard block |
|
|
block discarded – undo |
10227
|
10227
|
if (!empty($object->photo)) { |
10228
|
10228
|
if (dolIsAllowedForPreview($object->photo)) { |
10229
|
10229
|
if ((string) $imagesize == 'mini') { |
10230
|
|
- $file = get_exdir(0, 0, 0, 0, $object, 'member') . 'photos/' . getImageFileNameForSize($object->photo, '_mini'); |
|
10230
|
+ $file = get_exdir(0, 0, 0, 0, $object, 'member').'photos/'.getImageFileNameForSize($object->photo, '_mini'); |
10231
|
10231
|
} elseif ((string) $imagesize == 'small') { |
10232
|
|
- $file = get_exdir(0, 0, 0, 0, $object, 'member') . 'photos/' . getImageFileNameForSize($object->photo, '_small'); |
|
10232
|
+ $file = get_exdir(0, 0, 0, 0, $object, 'member').'photos/'.getImageFileNameForSize($object->photo, '_small'); |
10233
|
10233
|
} else { |
10234
|
|
- $file = get_exdir(0, 0, 0, 0, $object, 'member') . 'photos/' . $object->photo; |
|
10234
|
+ $file = get_exdir(0, 0, 0, 0, $object, 'member').'photos/'.$object->photo; |
10235
|
10235
|
} |
10236
|
|
- $originalfile = get_exdir(0, 0, 0, 0, $object, 'member') . 'photos/' . $object->photo; |
|
10236
|
+ $originalfile = get_exdir(0, 0, 0, 0, $object, 'member').'photos/'.$object->photo; |
10237
|
10237
|
} |
10238
|
10238
|
} |
10239
|
10239
|
if (getDolGlobalString('MAIN_OLD_IMAGE_LINKS')) { |
10240
|
|
- $altfile = $object->id . ".jpg"; // For backward compatibility |
|
10240
|
+ $altfile = $object->id.".jpg"; // For backward compatibility |
10241
|
10241
|
} |
10242
|
10242
|
$email = $object->email; |
10243
|
10243
|
$capture = 'user'; |
|
@@ -10263,35 +10263,35 @@ discard block |
|
|
block discarded – undo |
10263
|
10263
|
$ret = ''; |
10264
|
10264
|
|
10265
|
10265
|
if ($dir) { |
10266
|
|
- if ($file && file_exists($dir . "/" . $file)) { |
|
10266
|
+ if ($file && file_exists($dir."/".$file)) { |
10267
|
10267
|
if ($addlinktofullsize) { |
10268
|
|
- $urladvanced = getAdvancedPreviewUrl($modulepart, $originalfile, 0, '&entity=' . $entity); |
|
10268
|
+ $urladvanced = getAdvancedPreviewUrl($modulepart, $originalfile, 0, '&entity='.$entity); |
10269
|
10269
|
if ($urladvanced) { |
10270
|
|
- $ret .= '<a href="' . $urladvanced . '">'; |
|
10270
|
+ $ret .= '<a href="'.$urladvanced.'">'; |
10271
|
10271
|
} else { |
10272
|
|
- $ret .= '<a href="' . DOL_URL_ROOT . '/viewimage.php?modulepart=' . $modulepart . '&entity=' . $entity . '&file=' . urlencode($originalfile) . '&cache=' . $cache . '">'; |
|
10272
|
+ $ret .= '<a href="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$entity.'&file='.urlencode($originalfile).'&cache='.$cache.'">'; |
10273
|
10273
|
} |
10274
|
10274
|
} |
10275
|
|
- $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 . '">'; |
|
10275
|
+ $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.'">'; |
10276
|
10276
|
if ($addlinktofullsize) { |
10277
|
10277
|
$ret .= '</a>'; |
10278
|
10278
|
} |
10279
|
|
- } elseif ($altfile && file_exists($dir . "/" . $altfile)) { |
|
10279
|
+ } elseif ($altfile && file_exists($dir."/".$altfile)) { |
10280
|
10280
|
if ($addlinktofullsize) { |
10281
|
|
- $urladvanced = getAdvancedPreviewUrl($modulepart, $originalfile, 0, '&entity=' . $entity); |
|
10281
|
+ $urladvanced = getAdvancedPreviewUrl($modulepart, $originalfile, 0, '&entity='.$entity); |
10282
|
10282
|
if ($urladvanced) { |
10283
|
|
- $ret .= '<a href="' . $urladvanced . '">'; |
|
10283
|
+ $ret .= '<a href="'.$urladvanced.'">'; |
10284
|
10284
|
} else { |
10285
|
|
- $ret .= '<a href="' . DOL_URL_ROOT . '/viewimage.php?modulepart=' . $modulepart . '&entity=' . $entity . '&file=' . urlencode($originalfile) . '&cache=' . $cache . '">'; |
|
10285
|
+ $ret .= '<a href="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$entity.'&file='.urlencode($originalfile).'&cache='.$cache.'">'; |
10286
|
10286
|
} |
10287
|
10287
|
} |
10288
|
|
- $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 . '">'; |
|
10288
|
+ $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.'">'; |
10289
|
10289
|
if ($addlinktofullsize) { |
10290
|
10290
|
$ret .= '</a>'; |
10291
|
10291
|
} |
10292
|
10292
|
} else { |
10293
|
10293
|
$nophoto = '/public/theme/common/nophoto.png'; |
10294
|
|
- $defaultimg = 'identicon'; // For gravatar |
|
10294
|
+ $defaultimg = 'identicon'; // For gravatar |
10295
|
10295
|
if (in_array($modulepart, array('societe', 'userphoto', 'contact', 'memberphoto'))) { // For modules that need a special image when photo not found |
10296
|
10296
|
if ($modulepart == 'societe' || ($modulepart == 'memberphoto' && !empty($object->morphy) && strpos($object->morphy, 'mor') !== false)) { |
10297
|
10297
|
$nophoto = 'company'; |
|
@@ -10309,13 +10309,13 @@ discard block |
|
|
block discarded – undo |
10309
|
10309
|
if (isModEnabled('gravatar') && $email && empty($noexternsourceoverwrite)) { |
10310
|
10310
|
// see https://gravatar.com/site/implement/images/php/ |
10311
|
10311
|
$ret .= '<!-- Put link to gravatar -->'; |
10312
|
|
- $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 |
|
10312
|
+ $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 |
10313
|
10313
|
} else { |
10314
|
10314
|
if ($nophoto == 'company') { |
10315
|
|
- $ret .= '<div class="divforspanimg valignmiddle center photo' . $modulepart . ($cssclass ? ' ' . $cssclass : '') . '" alt="" ' . ($width ? ' width="' . $width . '"' : '') . ($height ? ' height="' . $height . '"' : '') . '>' . img_picto('', 'company') . '</div>'; |
|
10315
|
+ $ret .= '<div class="divforspanimg valignmiddle center photo'.$modulepart.($cssclass ? ' '.$cssclass : '').'" alt="" '.($width ? ' width="'.$width.'"' : '').($height ? ' height="'.$height.'"' : '').'>'.img_picto('', 'company').'</div>'; |
10316
|
10316
|
//$ret .= '<div class="difforspanimgright"></div>'; |
10317
|
10317
|
} else { |
10318
|
|
- $ret .= '<img class="photo' . $modulepart . ($cssclass ? ' ' . $cssclass : '') . '" alt="" ' . ($width ? ' width="' . $width . '"' : '') . ($height ? ' height="' . $height . '"' : '') . ' src="' . DOL_URL_ROOT . $nophoto . '">'; |
|
10318
|
+ $ret .= '<img class="photo'.$modulepart.($cssclass ? ' '.$cssclass : '').'" alt="" '.($width ? ' width="'.$width.'"' : '').($height ? ' height="'.$height.'"' : '').' src="'.DOL_URL_ROOT.$nophoto.'">'; |
10319
|
10319
|
} |
10320
|
10320
|
} |
10321
|
10321
|
} |
|
@@ -10326,15 +10326,15 @@ discard block |
|
|
block discarded – undo |
10326
|
10326
|
} |
10327
|
10327
|
$ret .= '<table class="nobordernopadding centpercent">'; |
10328
|
10328
|
if ($object->photo) { |
10329
|
|
- $ret .= '<tr><td><input type="checkbox" class="flat photodelete" name="deletephoto" id="photodelete"> <label for="photodelete">' . $langs->trans("Delete") . '</label><br><br></td></tr>'; |
|
10329
|
+ $ret .= '<tr><td><input type="checkbox" class="flat photodelete" name="deletephoto" id="photodelete"> <label for="photodelete">'.$langs->trans("Delete").'</label><br><br></td></tr>'; |
10330
|
10330
|
} |
10331
|
10331
|
$ret .= '<tr><td class="tdoverflow">'; |
10332
|
10332
|
$maxfilesizearray = getMaxFileSizeArray(); |
10333
|
10333
|
$maxmin = $maxfilesizearray['maxmin']; |
10334
|
10334
|
if ($maxmin > 0) { |
10335
|
|
- $ret .= '<input type="hidden" name="MAX_FILE_SIZE" value="' . ($maxmin * 1024) . '">'; // MAX_FILE_SIZE must precede the field type=file |
|
10335
|
+ $ret .= '<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).'">'; // MAX_FILE_SIZE must precede the field type=file |
10336
|
10336
|
} |
10337
|
|
- $ret .= '<input type="file" class="flat maxwidth200onsmartphone" name="photo" id="photoinput" accept="image/*"' . ($capture ? ' capture="' . $capture . '"' : '') . '>'; |
|
10337
|
+ $ret .= '<input type="file" class="flat maxwidth200onsmartphone" name="photo" id="photoinput" accept="image/*"'.($capture ? ' capture="'.$capture.'"' : '').'>'; |
10338
|
10338
|
$ret .= '</td></tr>'; |
10339
|
10339
|
$ret .= '</table>'; |
10340
|
10340
|
} |
|
@@ -10388,38 +10388,38 @@ discard block |
|
|
block discarded – undo |
10388
|
10388
|
if (isModEnabled('multicompany') && $conf->entity == 1 && $user->admin && !$user->entity) { |
10389
|
10389
|
$sql .= ", e.label"; |
10390
|
10390
|
} |
10391
|
|
- $sql .= " FROM " . $this->db->prefix() . "usergroup as ug "; |
|
10391
|
+ $sql .= " FROM ".$this->db->prefix()."usergroup as ug "; |
10392
|
10392
|
if (isModEnabled('multicompany') && $conf->entity == 1 && $user->admin && !$user->entity) { |
10393
|
|
- $sql .= " LEFT JOIN " . $this->db->prefix() . "entity as e ON e.rowid=ug.entity"; |
|
10393
|
+ $sql .= " LEFT JOIN ".$this->db->prefix()."entity as e ON e.rowid=ug.entity"; |
10394
|
10394
|
if ($force_entity) { |
10395
|
|
- $sql .= " WHERE ug.entity IN (0, " . $force_entity . ")"; |
|
10395
|
+ $sql .= " WHERE ug.entity IN (0, ".$force_entity.")"; |
10396
|
10396
|
} else { |
10397
|
10397
|
$sql .= " WHERE ug.entity IS NOT NULL"; |
10398
|
10398
|
} |
10399
|
10399
|
} else { |
10400
|
|
- $sql .= " WHERE ug.entity IN (0, " . $conf->entity . ")"; |
|
10400
|
+ $sql .= " WHERE ug.entity IN (0, ".$conf->entity.")"; |
10401
|
10401
|
} |
10402
|
10402
|
if (is_array($exclude) && $excludeGroups) { |
10403
|
|
- $sql .= " AND ug.rowid NOT IN (" . $this->db->sanitize($excludeGroups) . ")"; |
|
10403
|
+ $sql .= " AND ug.rowid NOT IN (".$this->db->sanitize($excludeGroups).")"; |
10404
|
10404
|
} |
10405
|
10405
|
if (is_array($include) && $includeGroups) { |
10406
|
|
- $sql .= " AND ug.rowid IN (" . $this->db->sanitize($includeGroups) . ")"; |
|
10406
|
+ $sql .= " AND ug.rowid IN (".$this->db->sanitize($includeGroups).")"; |
10407
|
10407
|
} |
10408
|
10408
|
$sql .= " ORDER BY ug.nom ASC"; |
10409
|
10409
|
|
10410
|
|
- dol_syslog(get_class($this) . "::select_dolgroups", LOG_DEBUG); |
|
10410
|
+ dol_syslog(get_class($this)."::select_dolgroups", LOG_DEBUG); |
10411
|
10411
|
$resql = $this->db->query($sql); |
10412
|
10412
|
if ($resql) { |
10413
|
10413
|
// Enhance with select2 |
10414
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
10414
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
10415
|
10415
|
|
10416
|
|
- $out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" id="' . $htmlname . '" name="' . $htmlname . ($multiple ? '[]' : '') . '" ' . ($multiple ? 'multiple' : '') . ' ' . ($disabled ? ' disabled' : '') . '>'; |
|
10416
|
+ $out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" id="'.$htmlname.'" name="'.$htmlname.($multiple ? '[]' : '').'" '.($multiple ? 'multiple' : '').' '.($disabled ? ' disabled' : '').'>'; |
10417
|
10417
|
|
10418
|
10418
|
$num = $this->db->num_rows($resql); |
10419
|
10419
|
$i = 0; |
10420
|
10420
|
if ($num) { |
10421
|
10421
|
if ($show_empty && !$multiple) { |
10422
|
|
- $out .= '<option value="-1"' . (in_array(-1, $selected) ? ' selected' : '') . '> </option>' . "\n"; |
|
10422
|
+ $out .= '<option value="-1"'.(in_array(-1, $selected) ? ' selected' : '').'> </option>'."\n"; |
10423
|
10423
|
} |
10424
|
10424
|
|
10425
|
10425
|
while ($i < $num) { |
|
@@ -10432,11 +10432,11 @@ discard block |
|
|
block discarded – undo |
10432
|
10432
|
$label = $obj->name; |
10433
|
10433
|
$labelhtml = $obj->name; |
10434
|
10434
|
if (isModEnabled('multicompany') && !getDolGlobalInt('MULTICOMPANY_TRANSVERSE_MODE') && $conf->entity == 1) { |
10435
|
|
- $label .= " (" . $obj->label . ")"; |
10436
|
|
- $labelhtml .= ' <span class="opacitymedium">(' . $obj->label . ')</span>'; |
|
10435
|
+ $label .= " (".$obj->label.")"; |
|
10436
|
+ $labelhtml .= ' <span class="opacitymedium">('.$obj->label.')</span>'; |
10437
|
10437
|
} |
10438
|
10438
|
|
10439
|
|
- $out .= '<option value="' . $obj->rowid . '"'; |
|
10439
|
+ $out .= '<option value="'.$obj->rowid.'"'; |
10440
|
10440
|
if ($disableline) { |
10441
|
10441
|
$out .= ' disabled'; |
10442
|
10442
|
} |
|
@@ -10452,9 +10452,9 @@ discard block |
|
|
block discarded – undo |
10452
|
10452
|
} |
10453
|
10453
|
} else { |
10454
|
10454
|
if ($show_empty) { |
10455
|
|
- $out .= '<option value="-1"' . (in_array(-1, $selected) ? ' selected' : '') . '></option>' . "\n"; |
|
10455
|
+ $out .= '<option value="-1"'.(in_array(-1, $selected) ? ' selected' : '').'></option>'."\n"; |
10456
|
10456
|
} |
10457
|
|
- $out .= '<option value="" disabled>' . $langs->trans("NoUserGroupDefined") . '</option>'; |
|
10457
|
+ $out .= '<option value="" disabled>'.$langs->trans("NoUserGroupDefined").'</option>'; |
10458
|
10458
|
} |
10459
|
10459
|
$out .= '</select>'; |
10460
|
10460
|
|
|
@@ -10498,25 +10498,25 @@ discard block |
|
|
block discarded – undo |
10498
|
10498
|
$out = ''; |
10499
|
10499
|
|
10500
|
10500
|
if (!empty($conf->use_javascript_ajax)) { |
10501
|
|
- $out .= '<div class="inline-block checkallactions"><input type="checkbox" id="' . $cssclass . 's" name="' . $cssclass . 's" class="checkallactions"></div>'; |
|
10501
|
+ $out .= '<div class="inline-block checkallactions"><input type="checkbox" id="'.$cssclass.'s" name="'.$cssclass.'s" class="checkallactions"></div>'; |
10502
|
10502
|
} |
10503
|
|
- $out .= '<script nonce="' . getNonce() . '"> |
|
10503
|
+ $out .= '<script nonce="'.getNonce().'"> |
10504
|
10504
|
$(document).ready(function() { |
10505
|
|
- $("#' . $cssclass . 's").click(function() { |
|
10505
|
+ $("#' . $cssclass.'s").click(function() { |
10506
|
10506
|
if($(this).is(\':checked\')){ |
10507
|
|
- console.log("We check all ' . $cssclass . ' and trigger the change method"); |
10508
|
|
- $(".' . $cssclass . '").prop(\'checked\', true).trigger(\'change\'); |
|
10507
|
+ console.log("We check all ' . $cssclass.' and trigger the change method"); |
|
10508
|
+ $(".' . $cssclass.'").prop(\'checked\', true).trigger(\'change\'); |
10509
|
10509
|
} |
10510
|
10510
|
else |
10511
|
10511
|
{ |
10512
|
10512
|
console.log("We uncheck all"); |
10513
|
|
- $(".' . $cssclass . '").prop(\'checked\', false).trigger(\'change\'); |
|
10513
|
+ $(".' . $cssclass.'").prop(\'checked\', false).trigger(\'change\'); |
10514
|
10514
|
}' . "\n"; |
10515
|
10515
|
if ($calljsfunction) { |
10516
|
|
- $out .= 'if (typeof initCheckForSelect == \'function\') { initCheckForSelect(0, "' . $massactionname . '", "' . $cssclass . '"); } else { console.log("No function initCheckForSelect found. Call won\'t be done."); }'; |
|
10516
|
+ $out .= 'if (typeof initCheckForSelect == \'function\') { initCheckForSelect(0, "'.$massactionname.'", "'.$cssclass.'"); } else { console.log("No function initCheckForSelect found. Call won\'t be done."); }'; |
10517
|
10517
|
} |
10518
|
10518
|
$out .= ' }); |
10519
|
|
- $(".' . $cssclass . '").change(function() { |
|
10519
|
+ $(".' . $cssclass.'").change(function() { |
10520
|
10520
|
$(this).closest("tr").toggleClass("highlight", this.checked); |
10521
|
10521
|
}); |
10522
|
10522
|
}); |
|
@@ -10561,67 +10561,67 @@ discard block |
|
|
block discarded – undo |
10561
|
10561
|
global $langs, $user; |
10562
|
10562
|
|
10563
|
10563
|
$out = ''; |
10564
|
|
- $sql = "SELECT rowid, label FROM " . $this->db->prefix() . "c_exp_tax_cat WHERE active = 1"; |
10565
|
|
- $sql .= " AND entity IN (0," . getEntity('exp_tax_cat') . ")"; |
|
10564
|
+ $sql = "SELECT rowid, label FROM ".$this->db->prefix()."c_exp_tax_cat WHERE active = 1"; |
|
10565
|
+ $sql .= " AND entity IN (0,".getEntity('exp_tax_cat').")"; |
10566
|
10566
|
if (!empty($excludeid)) { |
10567
|
|
- $sql .= " AND rowid NOT IN (" . $this->db->sanitize(implode(',', $excludeid)) . ")"; |
|
10567
|
+ $sql .= " AND rowid NOT IN (".$this->db->sanitize(implode(',', $excludeid)).")"; |
10568
|
10568
|
} |
10569
|
10569
|
$sql .= " ORDER BY label"; |
10570
|
10570
|
|
10571
|
10571
|
$resql = $this->db->query($sql); |
10572
|
10572
|
if ($resql) { |
10573
|
|
- $out = '<select id="select_' . $htmlname . '" name="' . $htmlname . '" class="' . $htmlname . ' flat minwidth75imp maxwidth200">'; |
|
10573
|
+ $out = '<select id="select_'.$htmlname.'" name="'.$htmlname.'" class="'.$htmlname.' flat minwidth75imp maxwidth200">'; |
10574
|
10574
|
if ($useempty) { |
10575
|
10575
|
$out .= '<option value="0"> </option>'; |
10576
|
10576
|
} |
10577
|
10577
|
|
10578
|
10578
|
while ($obj = $this->db->fetch_object($resql)) { |
10579
|
|
- $out .= '<option ' . ($selected == $obj->rowid ? 'selected="selected"' : '') . ' value="' . $obj->rowid . '">' . $langs->trans($obj->label) . '</option>'; |
|
10579
|
+ $out .= '<option '.($selected == $obj->rowid ? 'selected="selected"' : '').' value="'.$obj->rowid.'">'.$langs->trans($obj->label).'</option>'; |
10580
|
10580
|
} |
10581
|
10581
|
$out .= '</select>'; |
10582
|
|
- $out .= ajax_combobox('select_' . $htmlname); |
|
10582
|
+ $out .= ajax_combobox('select_'.$htmlname); |
10583
|
10583
|
|
10584
|
10584
|
if (!empty($htmlname) && $user->admin && $info_admin) { |
10585
|
|
- $out .= ' ' . info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); |
|
10585
|
+ $out .= ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); |
10586
|
10586
|
} |
10587
|
10587
|
|
10588
|
10588
|
if (!empty($target)) { |
10589
|
|
- $sql = "SELECT c.id FROM " . $this->db->prefix() . "c_type_fees as c WHERE c.code = 'EX_KME' AND c.active = 1"; |
|
10589
|
+ $sql = "SELECT c.id FROM ".$this->db->prefix()."c_type_fees as c WHERE c.code = 'EX_KME' AND c.active = 1"; |
10590
|
10590
|
$resql = $this->db->query($sql); |
10591
|
10591
|
if ($resql) { |
10592
|
10592
|
if ($this->db->num_rows($resql) > 0) { |
10593
|
10593
|
$obj = $this->db->fetch_object($resql); |
10594
|
|
- $out .= '<script nonce="' . getNonce() . '"> |
|
10594
|
+ $out .= '<script nonce="'.getNonce().'"> |
10595
|
10595
|
$(function() { |
10596
|
|
- $("select[name=' . $target . ']").on("change", function() { |
|
10596
|
+ $("select[name=' . $target.']").on("change", function() { |
10597
|
10597
|
var current_val = $(this).val(); |
10598
|
|
- if (current_val == ' . $obj->id . ') {'; |
|
10598
|
+ if (current_val == ' . $obj->id.') {'; |
10599
|
10599
|
if (!empty($default_selected) || !empty($selected)) { |
10600
|
|
- $out .= '$("select[name=' . $htmlname . ']").val("' . ($default_selected > 0 ? $default_selected : $selected) . '");'; |
|
10600
|
+ $out .= '$("select[name='.$htmlname.']").val("'.($default_selected > 0 ? $default_selected : $selected).'");'; |
10601
|
10601
|
} |
10602
|
10602
|
|
10603
|
10603
|
$out .= ' |
10604
|
|
- $("select[name=' . $htmlname . ']").change(); |
|
10604
|
+ $("select[name=' . $htmlname.']").change(); |
10605
|
10605
|
} |
10606
|
10606
|
}); |
10607
|
10607
|
|
10608
|
|
- $("select[name=' . $htmlname . ']").change(function() { |
|
10608
|
+ $("select[name=' . $htmlname.']").change(function() { |
10609
|
10609
|
|
10610
|
|
- if ($("select[name=' . $target . ']").val() == ' . $obj->id . ') { |
|
10610
|
+ if ($("select[name=' . $target.']").val() == '.$obj->id.') { |
10611
|
10611
|
// get price of kilometer to fill the unit price |
10612
|
10612
|
$.ajax({ |
10613
|
10613
|
method: "POST", |
10614
|
10614
|
dataType: "json", |
10615
|
|
- data: { fk_c_exp_tax_cat: $(this).val(), token: \'' . currentToken() . '\' }, |
10616
|
|
- url: "' . (DOL_URL_ROOT . '/expensereport/ajax/ajaxik.php?' . implode('&', $params)) . '", |
|
10615
|
+ data: { fk_c_exp_tax_cat: $(this).val(), token: \'' . currentToken().'\' }, |
|
10616
|
+ url: "' . (DOL_URL_ROOT.'/expensereport/ajax/ajaxik.php?'.implode('&', $params)).'", |
10617
|
10617
|
}).done(function( data, textStatus, jqXHR ) { |
10618
|
10618
|
console.log(data); |
10619
|
10619
|
if (typeof data.up != "undefined") { |
10620
|
10620
|
$("input[name=value_unit]").val(data.up); |
10621
|
|
- $("select[name=' . $htmlname . ']").attr("title", data.title); |
|
10621
|
+ $("select[name=' . $htmlname.']").attr("title", data.title); |
10622
|
10622
|
} else { |
10623
|
10623
|
$("input[name=value_unit]").val(""); |
10624
|
|
- $("select[name=' . $htmlname . ']").attr("title", ""); |
|
10624
|
+ $("select[name=' . $htmlname.']").attr("title", ""); |
10625
|
10625
|
} |
10626
|
10626
|
}); |
10627
|
10627
|
} |
|
@@ -10651,18 +10651,18 @@ discard block |
|
|
block discarded – undo |
10651
|
10651
|
global $conf, $langs; |
10652
|
10652
|
|
10653
|
10653
|
$out = ''; |
10654
|
|
- $sql = "SELECT rowid, range_ik FROM " . $this->db->prefix() . "c_exp_tax_range"; |
10655
|
|
- $sql .= " WHERE entity = " . $conf->entity . " AND active = 1"; |
|
10654
|
+ $sql = "SELECT rowid, range_ik FROM ".$this->db->prefix()."c_exp_tax_range"; |
|
10655
|
+ $sql .= " WHERE entity = ".$conf->entity." AND active = 1"; |
10656
|
10656
|
|
10657
|
10657
|
$resql = $this->db->query($sql); |
10658
|
10658
|
if ($resql) { |
10659
|
|
- $out = '<select id="select_' . $htmlname . '" name="' . $htmlname . '" class="' . $htmlname . ' flat minwidth75imp">'; |
|
10659
|
+ $out = '<select id="select_'.$htmlname.'" name="'.$htmlname.'" class="'.$htmlname.' flat minwidth75imp">'; |
10660
|
10660
|
if ($useempty) { |
10661
|
10661
|
$out .= '<option value="0"></option>'; |
10662
|
10662
|
} |
10663
|
10663
|
|
10664
|
10664
|
while ($obj = $this->db->fetch_object($resql)) { |
10665
|
|
- $out .= '<option ' . ($selected == $obj->rowid ? 'selected="selected"' : '') . ' value="' . $obj->rowid . '">' . price($obj->range_ik, 0, $langs, 1, 0) . '</option>'; |
|
10665
|
+ $out .= '<option '.($selected == $obj->rowid ? 'selected="selected"' : '').' value="'.$obj->rowid.'">'.price($obj->range_ik, 0, $langs, 1, 0).'</option>'; |
10666
|
10666
|
} |
10667
|
10667
|
$out .= '</select>'; |
10668
|
10668
|
} else { |
|
@@ -10693,12 +10693,12 @@ discard block |
|
|
block discarded – undo |
10693
|
10693
|
|
10694
|
10694
|
$resql = $this->db->query($sql); |
10695
|
10695
|
if ($resql) { |
10696
|
|
- $out = '<select id="select_' . $htmlname . '" name="' . $htmlname . '" class="' . $htmlname . ' flat minwidth75imp">'; |
|
10696
|
+ $out = '<select id="select_'.$htmlname.'" name="'.$htmlname.'" class="'.$htmlname.' flat minwidth75imp">'; |
10697
|
10697
|
if ($useempty) { |
10698
|
10698
|
$out .= '<option value="0"></option>'; |
10699
|
10699
|
} |
10700
|
10700
|
if ($allchoice) { |
10701
|
|
- $out .= '<option value="-1">' . $langs->trans('AllExpenseReport') . '</option>'; |
|
10701
|
+ $out .= '<option value="-1">'.$langs->trans('AllExpenseReport').'</option>'; |
10702
|
10702
|
} |
10703
|
10703
|
|
10704
|
10704
|
$field = 'code'; |
|
@@ -10708,7 +10708,7 @@ discard block |
|
|
block discarded – undo |
10708
|
10708
|
|
10709
|
10709
|
while ($obj = $this->db->fetch_object($resql)) { |
10710
|
10710
|
$key = $langs->trans($obj->code); |
10711
|
|
- $out .= '<option ' . ($selected == $obj->{$field} ? 'selected="selected"' : '') . ' value="' . $obj->{$field} . '">' . ($key != $obj->code ? $key : $obj->label) . '</option>'; |
|
10711
|
+ $out .= '<option '.($selected == $obj->{$field} ? 'selected="selected"' : '').' value="'.$obj->{$field}.'">'.($key != $obj->code ? $key : $obj->label).'</option>'; |
10712
|
10712
|
} |
10713
|
10713
|
$out .= '</select>'; |
10714
|
10714
|
|
|
@@ -10742,7 +10742,7 @@ discard block |
|
|
block discarded – undo |
10742
|
10742
|
{ |
10743
|
10743
|
global $user, $conf, $langs; |
10744
|
10744
|
|
10745
|
|
- require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; |
|
10745
|
+ require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; |
10746
|
10746
|
|
10747
|
10747
|
if (is_null($usertofilter)) { |
10748
|
10748
|
$usertofilter = $user; |
|
@@ -10766,10 +10766,10 @@ discard block |
|
|
block discarded – undo |
10766
|
10766
|
$sql = "SELECT f.rowid, f.ref as fref, 'nolabel' as flabel, p.rowid as pid, f.ref, |
10767
|
10767
|
p.title, p.fk_soc, p.fk_statut, p.public,"; |
10768
|
10768
|
$sql .= ' s.nom as name'; |
10769
|
|
- $sql .= ' FROM ' . $this->db->prefix() . 'projet as p'; |
10770
|
|
- $sql .= ' LEFT JOIN ' . $this->db->prefix() . 'societe as s ON s.rowid = p.fk_soc,'; |
10771
|
|
- $sql .= ' ' . $this->db->prefix() . 'facture as f'; |
10772
|
|
- $sql .= " WHERE p.entity IN (" . getEntity('project') . ")"; |
|
10769
|
+ $sql .= ' FROM '.$this->db->prefix().'projet as p'; |
|
10770
|
+ $sql .= ' LEFT JOIN '.$this->db->prefix().'societe as s ON s.rowid = p.fk_soc,'; |
|
10771
|
+ $sql .= ' '.$this->db->prefix().'facture as f'; |
|
10772
|
+ $sql .= " WHERE p.entity IN (".getEntity('project').")"; |
10773
|
10773
|
$sql .= " AND f.fk_projet = p.rowid AND f.fk_statut=0"; //Brouillons seulement |
10774
|
10774
|
//if ($projectsListId) $sql.= " AND p.rowid IN (".$this->db->sanitize($projectsListId).")"; |
10775
|
10775
|
//if ($socid == 0) $sql.= " AND (p.fk_soc=0 OR p.fk_soc IS NULL)"; |
|
@@ -10780,14 +10780,14 @@ discard block |
|
|
block discarded – undo |
10780
|
10780
|
if ($resql) { |
10781
|
10781
|
// Use select2 selector |
10782
|
10782
|
if (!empty($conf->use_javascript_ajax)) { |
10783
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
10783
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
10784
|
10784
|
$comboenhancement = ajax_combobox($htmlname, array(), 0, $forcefocus); |
10785
|
10785
|
$out .= $comboenhancement; |
10786
|
10786
|
$morecss = 'minwidth200imp maxwidth500'; |
10787
|
10787
|
} |
10788
|
10788
|
|
10789
|
10789
|
if (empty($option_only)) { |
10790
|
|
- $out .= '<select class="valignmiddle flat' . ($morecss ? ' ' . $morecss : '') . '"' . ($disabled ? ' disabled="disabled"' : '') . ' id="' . $htmlname . '" name="' . $htmlname . '">'; |
|
10790
|
+ $out .= '<select class="valignmiddle flat'.($morecss ? ' '.$morecss : '').'"'.($disabled ? ' disabled="disabled"' : '').' id="'.$htmlname.'" name="'.$htmlname.'">'; |
10791
|
10791
|
} |
10792
|
10792
|
if (!empty($show_empty)) { |
10793
|
10793
|
$out .= '<option value="0" class="optiongrey">'; |
|
@@ -10817,33 +10817,33 @@ discard block |
|
|
block discarded – undo |
10817
|
10817
|
if ($showproject == 'all') { |
10818
|
10818
|
$labeltoshow .= dol_trunc($obj->ref, 18); // Invoice ref |
10819
|
10819
|
if ($obj->name) { |
10820
|
|
- $labeltoshow .= ' - ' . $obj->name; // Soc name |
|
10820
|
+ $labeltoshow .= ' - '.$obj->name; // Soc name |
10821
|
10821
|
} |
10822
|
10822
|
|
10823
|
10823
|
$disabled = 0; |
10824
|
10824
|
if ($obj->fk_statut == Project::STATUS_DRAFT) { |
10825
|
10825
|
$disabled = 1; |
10826
|
|
- $labeltoshow .= ' - ' . $langs->trans("Draft"); |
|
10826
|
+ $labeltoshow .= ' - '.$langs->trans("Draft"); |
10827
|
10827
|
} elseif ($obj->fk_statut == Project::STATUS_CLOSED) { |
10828
|
10828
|
if ($discard_closed == 2) { |
10829
|
10829
|
$disabled = 1; |
10830
|
10830
|
} |
10831
|
|
- $labeltoshow .= ' - ' . $langs->trans("Closed"); |
|
10831
|
+ $labeltoshow .= ' - '.$langs->trans("Closed"); |
10832
|
10832
|
} elseif ($socid > 0 && (!empty($obj->fk_soc) && $obj->fk_soc != $socid)) { |
10833
|
10833
|
$disabled = 1; |
10834
|
|
- $labeltoshow .= ' - ' . $langs->trans("LinkedToAnotherCompany"); |
|
10834
|
+ $labeltoshow .= ' - '.$langs->trans("LinkedToAnotherCompany"); |
10835
|
10835
|
} |
10836
|
10836
|
} |
10837
|
10837
|
|
10838
|
10838
|
if (!empty($selected) && $selected == $obj->rowid) { |
10839
|
|
- $out .= '<option value="' . $obj->rowid . '" selected'; |
|
10839
|
+ $out .= '<option value="'.$obj->rowid.'" selected'; |
10840
|
10840
|
//if ($disabled) $out.=' disabled'; // with select2, field can't be preselected if disabled |
10841
|
|
- $out .= '>' . $labeltoshow . '</option>'; |
|
10841
|
+ $out .= '>'.$labeltoshow.'</option>'; |
10842
|
10842
|
} else { |
10843
|
10843
|
if ($hideunselectables && $disabled && ($selected != $obj->rowid)) { |
10844
|
10844
|
$resultat = ''; |
10845
|
10845
|
} else { |
10846
|
|
- $resultat = '<option value="' . $obj->rowid . '"'; |
|
10846
|
+ $resultat = '<option value="'.$obj->rowid.'"'; |
10847
|
10847
|
if ($disabled) { |
10848
|
10848
|
$resultat .= ' disabled'; |
10849
|
10849
|
} |
|
@@ -10895,22 +10895,22 @@ discard block |
|
|
block discarded – undo |
10895
|
10895
|
|
10896
|
10896
|
$sql = 'SELECT f.rowid, f.entity, f.titre as title, f.suspended, f.fk_soc'; |
10897
|
10897
|
//$sql.= ', el.fk_source'; |
10898
|
|
- $sql .= ' FROM ' . MAIN_DB_PREFIX . 'facture_rec as f'; |
10899
|
|
- $sql .= " WHERE f.entity IN (" . getEntity('invoice') . ")"; |
|
10898
|
+ $sql .= ' FROM '.MAIN_DB_PREFIX.'facture_rec as f'; |
|
10899
|
+ $sql .= " WHERE f.entity IN (".getEntity('invoice').")"; |
10900
|
10900
|
$sql .= " ORDER BY f.titre ASC"; |
10901
|
10901
|
|
10902
|
10902
|
$resql = $this->db->query($sql); |
10903
|
10903
|
if ($resql) { |
10904
|
10904
|
// Use select2 selector |
10905
|
10905
|
if (!empty($conf->use_javascript_ajax)) { |
10906
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
10906
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
10907
|
10907
|
$comboenhancement = ajax_combobox($htmlname, array(), 0, $forcefocus); |
10908
|
10908
|
$out .= $comboenhancement; |
10909
|
10909
|
$morecss = 'minwidth200imp maxwidth500'; |
10910
|
10910
|
} |
10911
|
10911
|
|
10912
|
10912
|
if (empty($option_only)) { |
10913
|
|
- $out .= '<select class="valignmiddle flat' . ($morecss ? ' ' . $morecss : '') . '"' . ($disabled ? ' disabled="disabled"' : '') . ' id="' . $htmlname . '" name="' . $htmlname . '">'; |
|
10913
|
+ $out .= '<select class="valignmiddle flat'.($morecss ? ' '.$morecss : '').'"'.($disabled ? ' disabled="disabled"' : '').' id="'.$htmlname.'" name="'.$htmlname.'">'; |
10914
|
10914
|
} |
10915
|
10915
|
if (!empty($show_empty)) { |
10916
|
10916
|
$out .= '<option value="0" class="optiongrey">'; |
|
@@ -10929,19 +10929,19 @@ discard block |
|
|
block discarded – undo |
10929
|
10929
|
$disabled = 0; |
10930
|
10930
|
if (!empty($obj->suspended)) { |
10931
|
10931
|
$disabled = 1; |
10932
|
|
- $labeltoshow .= ' - ' . $langs->trans("Closed"); |
|
10932
|
+ $labeltoshow .= ' - '.$langs->trans("Closed"); |
10933
|
10933
|
} |
10934
|
10934
|
|
10935
|
10935
|
|
10936
|
10936
|
if (!empty($selected) && $selected == $obj->rowid) { |
10937
|
|
- $out .= '<option value="' . $obj->rowid . '" selected'; |
|
10937
|
+ $out .= '<option value="'.$obj->rowid.'" selected'; |
10938
|
10938
|
//if ($disabled) $out.=' disabled'; // with select2, field can't be preselected if disabled |
10939
|
|
- $out .= '>' . $labeltoshow . '</option>'; |
|
10939
|
+ $out .= '>'.$labeltoshow.'</option>'; |
10940
|
10940
|
} else { |
10941
|
10941
|
if ($disabled && ($selected != $obj->rowid)) { |
10942
|
10942
|
$resultat = ''; |
10943
|
10943
|
} else { |
10944
|
|
- $resultat = '<option value="' . $obj->rowid . '"'; |
|
10944
|
+ $resultat = '<option value="'.$obj->rowid.'"'; |
10945
|
10945
|
if ($disabled) { |
10946
|
10946
|
$resultat .= ' disabled'; |
10947
|
10947
|
} |
|
@@ -10981,14 +10981,14 @@ discard block |
|
|
block discarded – undo |
10981
|
10981
|
global $langs; |
10982
|
10982
|
|
10983
|
10983
|
if ($search_component_params_hidden != '' && !preg_match('/^\(.*\)$/', $search_component_params_hidden)) { // If $search_component_params_hidden does not start and end with () |
10984
|
|
- $search_component_params_hidden = '(' . $search_component_params_hidden . ')'; |
|
10984
|
+ $search_component_params_hidden = '('.$search_component_params_hidden.')'; |
10985
|
10985
|
} |
10986
|
10986
|
|
10987
|
10987
|
$ret = ''; |
10988
|
10988
|
|
10989
|
10989
|
$ret .= '<div class="divadvancedsearchfieldcomp centpercent inline-block">'; |
10990
|
10990
|
$ret .= '<a href="#" class="dropdownsearch-toggle unsetcolor">'; |
10991
|
|
- $ret .= '<span class="fas fa-filter linkobject boxfilter paddingright pictofixedwidth" title="' . dol_escape_htmltag($langs->trans("Filters")) . '" id="idsubimgproductdistribution"></span>'; |
|
10991
|
+ $ret .= '<span class="fas fa-filter linkobject boxfilter paddingright pictofixedwidth" title="'.dol_escape_htmltag($langs->trans("Filters")).'" id="idsubimgproductdistribution"></span>'; |
10992
|
10992
|
$ret .= '</a>'; |
10993
|
10993
|
|
10994
|
10994
|
$ret .= '<div class="divadvancedsearchfieldcompinput inline-block minwidth500 maxwidth300onsmartphone">'; |
|
@@ -11032,29 +11032,29 @@ discard block |
|
|
block discarded – undo |
11032
|
11032
|
$ret .= '<input type="hidden" name="show_search_component_params_hidden" value="1">'; |
11033
|
11033
|
} |
11034
|
11034
|
$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%')) -->"; |
11035
|
|
- $ret .= '<input type="hidden" id="search_component_params_hidden" name="search_component_params_hidden" value="' . dol_escape_htmltag($search_component_params_hidden) . '">'; |
|
11035
|
+ $ret .= '<input type="hidden" id="search_component_params_hidden" name="search_component_params_hidden" value="'.dol_escape_htmltag($search_component_params_hidden).'">'; |
11036
|
11036
|
// $ret .= "<!-- sql= ".forgeSQLFromUniversalSearchCriteria($search_component_params_hidden, $errormessage)." -->"; |
11037
|
11037
|
|
11038
|
11038
|
// For compatibility with forms that show themself the search criteria in addition of this component, we output these fields |
11039
|
11039
|
foreach ($arrayofcriterias as $criteria) { |
11040
|
11040
|
foreach ($criteria as $criteriafamilykey => $criteriafamilyval) { |
11041
|
|
- if (in_array('search_' . $criteriafamilykey, $arrayofinputfieldsalreadyoutput)) { |
|
11041
|
+ if (in_array('search_'.$criteriafamilykey, $arrayofinputfieldsalreadyoutput)) { |
11042
|
11042
|
continue; |
11043
|
11043
|
} |
11044
|
11044
|
if (in_array($criteriafamilykey, array('rowid', 'ref_ext', 'entity', 'extraparams'))) { |
11045
|
11045
|
continue; |
11046
|
11046
|
} |
11047
|
11047
|
if (in_array($criteriafamilyval['type'], array('date', 'datetime', 'timestamp'))) { |
11048
|
|
- $ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_start">'; |
11049
|
|
- $ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_startyear">'; |
11050
|
|
- $ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_startmonth">'; |
11051
|
|
- $ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_startday">'; |
11052
|
|
- $ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_end">'; |
11053
|
|
- $ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_endyear">'; |
11054
|
|
- $ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_endmonth">'; |
11055
|
|
- $ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_endday">'; |
|
11048
|
+ $ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_start">'; |
|
11049
|
+ $ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_startyear">'; |
|
11050
|
+ $ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_startmonth">'; |
|
11051
|
+ $ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_startday">'; |
|
11052
|
+ $ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_end">'; |
|
11053
|
+ $ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_endyear">'; |
|
11054
|
+ $ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_endmonth">'; |
|
11055
|
+ $ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_endday">'; |
11056
|
11056
|
} else { |
11057
|
|
- $ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '">'; |
|
11057
|
+ $ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'">'; |
11058
|
11058
|
} |
11059
|
11059
|
} |
11060
|
11060
|
} |
|
@@ -11062,7 +11062,7 @@ discard block |
|
|
block discarded – undo |
11062
|
11062
|
$ret .= '</div>'; |
11063
|
11063
|
|
11064
|
11064
|
$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"; |
11065
|
|
- $ret .= '<input type="text" placeholder="' . $langs->trans("Filters") . '" id="search_component_params_input" name="search_component_params_input" class="noborderbottom search_component_input" value="">'; |
|
11065
|
+ $ret .= '<input type="text" placeholder="'.$langs->trans("Filters").'" id="search_component_params_input" name="search_component_params_input" class="noborderbottom search_component_input" value="">'; |
11066
|
11066
|
|
11067
|
11067
|
$ret .= '</div>'; |
11068
|
11068
|
$ret .= '</div>'; |
|
@@ -11136,7 +11136,7 @@ discard block |
|
|
block discarded – undo |
11136
|
11136
|
|
11137
|
11137
|
$TModels = array(); |
11138
|
11138
|
|
11139
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php'; |
|
11139
|
+ include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; |
11140
|
11140
|
$formmail = new FormMail($this->db); |
11141
|
11141
|
$result = $formmail->fetchAllEMailTemplate($modelType, $user, $langs); |
11142
|
11142
|
|
|
@@ -11149,17 +11149,17 @@ discard block |
|
|
block discarded – undo |
11149
|
11149
|
} |
11150
|
11150
|
} |
11151
|
11151
|
|
11152
|
|
- $retstring .= '<select class="flat" id="select_' . $prefix . 'model_mail" name="' . $prefix . 'model_mail">'; |
|
11152
|
+ $retstring .= '<select class="flat" id="select_'.$prefix.'model_mail" name="'.$prefix.'model_mail">'; |
11153
|
11153
|
|
11154
|
11154
|
foreach ($TModels as $id_model => $label_model) { |
11155
|
|
- $retstring .= '<option value="' . $id_model . '"'; |
11156
|
|
- $retstring .= ">" . $label_model . "</option>"; |
|
11155
|
+ $retstring .= '<option value="'.$id_model.'"'; |
|
11156
|
+ $retstring .= ">".$label_model."</option>"; |
11157
|
11157
|
} |
11158
|
11158
|
|
11159
|
11159
|
$retstring .= "</select>"; |
11160
|
11160
|
|
11161
|
11161
|
if ($addjscombo) { |
11162
|
|
- $retstring .= ajax_combobox('select_' . $prefix . 'model_mail'); |
|
11162
|
+ $retstring .= ajax_combobox('select_'.$prefix.'model_mail'); |
11163
|
11163
|
} |
11164
|
11164
|
|
11165
|
11165
|
return $retstring; |
|
@@ -11210,16 +11210,16 @@ discard block |
|
|
block discarded – undo |
11210
|
11210
|
|
11211
|
11211
|
foreach ($buttons as $button) { |
11212
|
11212
|
$addclass = empty($button['addclass']) ? '' : $button['addclass']; |
11213
|
|
- $retstring .= '<input type="submit" class="button button-' . $button['name'] . ($morecss ? ' ' . $morecss : '') . ' ' . $addclass . '" name="' . $button['name'] . '" value="' . dol_escape_htmltag($langs->trans($button['label_key'])) . '">'; |
|
11213
|
+ $retstring .= '<input type="submit" class="button button-'.$button['name'].($morecss ? ' '.$morecss : '').' '.$addclass.'" name="'.$button['name'].'" value="'.dol_escape_htmltag($langs->trans($button['label_key'])).'">'; |
11214
|
11214
|
} |
11215
|
11215
|
$retstring .= $withoutdiv ? '' : '</div>'; |
11216
|
11216
|
|
11217
|
11217
|
if ($dol_openinpopup) { |
11218
|
|
- $retstring .= '<!-- buttons are shown into a $dol_openinpopup=' . dol_escape_htmltag($dol_openinpopup) . ' context, so we enable the close of dialog on cancel -->' . "\n"; |
11219
|
|
- $retstring .= '<script nonce="' . getNonce() . '">'; |
|
11218
|
+ $retstring .= '<!-- buttons are shown into a $dol_openinpopup='.dol_escape_htmltag($dol_openinpopup).' context, so we enable the close of dialog on cancel -->'."\n"; |
|
11219
|
+ $retstring .= '<script nonce="'.getNonce().'">'; |
11220
|
11220
|
$retstring .= 'jQuery(".button-cancel").click(function(e) { |
11221
|
|
- e.preventDefault(); console.log(\'We click on cancel in iframe popup ' . dol_escape_js($dol_openinpopup) . '\'); |
11222
|
|
- window.parent.jQuery(\'#idfordialog' . dol_escape_js($dol_openinpopup) . '\').dialog(\'close\'); |
|
11221
|
+ e.preventDefault(); console.log(\'We click on cancel in iframe popup ' . dol_escape_js($dol_openinpopup).'\'); |
|
11222
|
+ window.parent.jQuery(\'#idfordialog' . dol_escape_js($dol_openinpopup).'\').dialog(\'close\'); |
11223
|
11223
|
});'; |
11224
|
11224
|
$retstring .= '</script>'; |
11225
|
11225
|
} |
|
@@ -11248,7 +11248,7 @@ discard block |
|
|
block discarded – undo |
11248
|
11248
|
dol_syslog(__METHOD__, LOG_DEBUG); |
11249
|
11249
|
|
11250
|
11250
|
$sql = "SELECT rowid, code, label as label"; |
11251
|
|
- $sql .= " FROM " . MAIN_DB_PREFIX . 'c_invoice_subtype'; |
|
11251
|
+ $sql .= " FROM ".MAIN_DB_PREFIX.'c_invoice_subtype'; |
11252
|
11252
|
$sql .= " WHERE active = 1"; |
11253
|
11253
|
|
11254
|
11254
|
$resql = $this->db->query($sql); |
|
@@ -11259,7 +11259,7 @@ discard block |
|
|
block discarded – undo |
11259
|
11259
|
$obj = $this->db->fetch_object($resql); |
11260
|
11260
|
|
11261
|
11261
|
// If translation exists, we use it, otherwise we take the default wording |
11262
|
|
- $label = ($langs->trans("InvoiceSubtype" . $obj->rowid) != "InvoiceSubtype" . $obj->rowid) ? $langs->trans("InvoiceSubtype" . $obj->rowid) : (($obj->label != '-') ? $obj->label : ''); |
|
11262
|
+ $label = ($langs->trans("InvoiceSubtype".$obj->rowid) != "InvoiceSubtype".$obj->rowid) ? $langs->trans("InvoiceSubtype".$obj->rowid) : (($obj->label != '-') ? $obj->label : ''); |
11263
|
11263
|
$this->cache_invoice_subtype[$obj->rowid]['rowid'] = $obj->rowid; |
11264
|
11264
|
$this->cache_invoice_subtype[$obj->rowid]['code'] = $obj->code; |
11265
|
11265
|
$this->cache_invoice_subtype[$obj->rowid]['label'] = $label; |
|
@@ -11291,18 +11291,18 @@ discard block |
|
|
block discarded – undo |
11291
|
11291
|
global $langs, $user; |
11292
|
11292
|
|
11293
|
11293
|
$out = ''; |
11294
|
|
- dol_syslog(__METHOD__ . " selected=" . $selected . ", htmlname=" . $htmlname, LOG_DEBUG); |
|
11294
|
+ dol_syslog(__METHOD__." selected=".$selected.", htmlname=".$htmlname, LOG_DEBUG); |
11295
|
11295
|
|
11296
|
11296
|
$this->load_cache_invoice_subtype(); |
11297
|
11297
|
|
11298
|
|
- $out .= '<select id="' . $htmlname . '" class="flat selectsubtype' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">'; |
|
11298
|
+ $out .= '<select id="'.$htmlname.'" class="flat selectsubtype'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">'; |
11299
|
11299
|
if ($addempty) { |
11300
|
11300
|
$out .= '<option value="0"> </option>'; |
11301
|
11301
|
} |
11302
|
11302
|
|
11303
|
11303
|
foreach ($this->cache_invoice_subtype as $rowid => $subtype) { |
11304
|
11304
|
$label = $subtype['label']; |
11305
|
|
- $out .= '<option value="' . $subtype['rowid'] . '"'; |
|
11305
|
+ $out .= '<option value="'.$subtype['rowid'].'"'; |
11306
|
11306
|
if ($selected == $subtype['rowid']) { |
11307
|
11307
|
$out .= ' selected="selected"'; |
11308
|
11308
|
} |