|
@@ -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', '', false, 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,11 +887,11 @@ 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") |
|
@@ -899,18 +899,18 @@ discard block |
|
|
block discarded – undo |
899
|
899
|
urlform = urlform + "#show_files"; |
900
|
900
|
} |
901
|
901
|
$( this ).closest("form").attr("action", urlform); |
902
|
|
- console.log("we select a mass action name=' . $name . ' massaction="+massaction+" - "+urlform); |
|
902
|
+ console.log("we select a mass action name=' . $name.' massaction="+massaction+" - "+urlform); |
903
|
903
|
/* Warning: if you set submit button to disabled, post using Enter will no more work if there is no other button */ |
904
|
904
|
if ($(this).val() != \'0\') |
905
|
905
|
{ |
906
|
|
- jQuery(".' . $name . 'confirmed").prop(\'disabled\', false); |
907
|
|
- jQuery(".' . $name . 'other").hide(); /* To disable if another div was open */ |
908
|
|
- jQuery(".' . $name . '"+massaction).show(); |
|
906
|
+ jQuery(".' . $name.'confirmed").prop(\'disabled\', false); |
|
907
|
+ jQuery(".' . $name.'other").hide(); /* To disable if another div was open */ |
|
908
|
+ jQuery(".' . $name.'"+massaction).show(); |
909
|
909
|
} |
910
|
910
|
else |
911
|
911
|
{ |
912
|
|
- jQuery(".' . $name . 'confirmed").prop(\'disabled\', true); |
913
|
|
- jQuery(".' . $name . 'other").hide(); /* To disable any div open */ |
|
912
|
+ jQuery(".' . $name.'confirmed").prop(\'disabled\', true); |
|
913
|
+ jQuery(".' . $name.'other").hide(); /* To disable any div open */ |
914
|
914
|
} |
915
|
915
|
}); |
916
|
916
|
}); |
|
@@ -953,14 +953,14 @@ discard block |
|
|
block discarded – undo |
953
|
953
|
$atleastonefavorite = 0; |
954
|
954
|
|
955
|
955
|
$sql = "SELECT rowid, code as code_iso, code_iso as code_iso3, label, favorite, eec"; |
956
|
|
- $sql .= " FROM " . $this->db->prefix() . "c_country"; |
|
956
|
+ $sql .= " FROM ".$this->db->prefix()."c_country"; |
957
|
957
|
$sql .= " WHERE active > 0"; |
958
|
958
|
//$sql.= " ORDER BY code ASC"; |
959
|
959
|
|
960
|
|
- dol_syslog(get_class($this) . "::select_country", LOG_DEBUG); |
|
960
|
+ dol_syslog(get_class($this)."::select_country", LOG_DEBUG); |
961
|
961
|
$resql = $this->db->query($sql); |
962
|
962
|
if ($resql) { |
963
|
|
- $out .= '<select id="select' . $htmlname . '" class="flat maxwidth200onsmartphone selectcountry' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" ' . $htmloption . '>'; |
|
963
|
+ $out .= '<select id="select'.$htmlname.'" class="flat maxwidth200onsmartphone selectcountry'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" '.$htmloption.'>'; |
964
|
964
|
$num = $this->db->num_rows($resql); |
965
|
965
|
$i = 0; |
966
|
966
|
if ($num) { |
|
@@ -970,7 +970,7 @@ discard block |
|
|
block discarded – undo |
970
|
970
|
$countryArray[$i]['rowid'] = $obj->rowid; |
971
|
971
|
$countryArray[$i]['code_iso'] = $obj->code_iso; |
972
|
972
|
$countryArray[$i]['code_iso3'] = $obj->code_iso3; |
973
|
|
- $countryArray[$i]['label'] = ($obj->code_iso && $langs->transnoentitiesnoconv("Country" . $obj->code_iso) != "Country" . $obj->code_iso ? $langs->transnoentitiesnoconv("Country" . $obj->code_iso) : ($obj->label != '-' ? $obj->label : '')); |
|
973
|
+ $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 : '')); |
974
|
974
|
$countryArray[$i]['favorite'] = $obj->favorite; |
975
|
975
|
$countryArray[$i]['eec'] = $obj->eec; |
976
|
976
|
$favorite[$i] = $obj->favorite; |
|
@@ -988,20 +988,20 @@ discard block |
|
|
block discarded – undo |
988
|
988
|
|
989
|
989
|
if ($showempty) { |
990
|
990
|
if (is_numeric($showempty)) { |
991
|
|
- $out .= '<option value=""> </option>' . "\n"; |
|
991
|
+ $out .= '<option value=""> </option>'."\n"; |
992
|
992
|
} else { |
993
|
|
- $out .= '<option value="-1">' . $langs->trans($showempty) . '</option>' . "\n"; |
|
993
|
+ $out .= '<option value="-1">'.$langs->trans($showempty).'</option>'."\n"; |
994
|
994
|
} |
995
|
995
|
} |
996
|
996
|
|
997
|
997
|
if ($addspecialentries) { // Add dedicated entries for groups of countries |
998
|
998
|
//if ($showempty) $out.= '<option value="" disabled class="selectoptiondisabledwhite">--------------</option>'; |
999
|
|
- $out .= '<option value="special_allnotme"' . ($selected == 'special_allnotme' ? ' selected' : '') . '>' . $langs->trans("CountriesExceptMe", $langs->transnoentitiesnoconv("Country" . $mysoc->country_code)) . '</option>'; |
1000
|
|
- $out .= '<option value="special_eec"' . ($selected == 'special_eec' ? ' selected' : '') . '>' . $langs->trans("CountriesInEEC") . '</option>'; |
|
999
|
+ $out .= '<option value="special_allnotme"'.($selected == 'special_allnotme' ? ' selected' : '').'>'.$langs->trans("CountriesExceptMe", $langs->transnoentitiesnoconv("Country".$mysoc->country_code)).'</option>'; |
|
1000
|
+ $out .= '<option value="special_eec"'.($selected == 'special_eec' ? ' selected' : '').'>'.$langs->trans("CountriesInEEC").'</option>'; |
1001
|
1001
|
if ($mysoc->isInEEC()) { |
1002
|
|
- $out .= '<option value="special_eecnotme"' . ($selected == 'special_eecnotme' ? ' selected' : '') . '>' . $langs->trans("CountriesInEECExceptMe", $langs->transnoentitiesnoconv("Country" . $mysoc->country_code)) . '</option>'; |
|
1002
|
+ $out .= '<option value="special_eecnotme"'.($selected == 'special_eecnotme' ? ' selected' : '').'>'.$langs->trans("CountriesInEECExceptMe", $langs->transnoentitiesnoconv("Country".$mysoc->country_code)).'</option>'; |
1003
|
1003
|
} |
1004
|
|
- $out .= '<option value="special_noteec"' . ($selected == 'special_noteec' ? ' selected' : '') . '>' . $langs->trans("CountriesNotInEEC") . '</option>'; |
|
1004
|
+ $out .= '<option value="special_noteec"'.($selected == 'special_noteec' ? ' selected' : '').'>'.$langs->trans("CountriesNotInEEC").'</option>'; |
1005
|
1005
|
$out .= '<option value="" disabled class="selectoptiondisabledwhite">------------</option>'; |
1006
|
1006
|
} |
1007
|
1007
|
|
|
@@ -1029,20 +1029,20 @@ discard block |
|
|
block discarded – undo |
1029
|
1029
|
$labeltoshow .= ' '; |
1030
|
1030
|
} |
1031
|
1031
|
if ($row['code_iso']) { |
1032
|
|
- $labeltoshow .= ' <span class="opacitymedium">(' . $row['code_iso'] . ')</span>'; |
|
1032
|
+ $labeltoshow .= ' <span class="opacitymedium">('.$row['code_iso'].')</span>'; |
1033
|
1033
|
if (empty($hideflags)) { |
1034
|
1034
|
$tmpflag = picto_from_langcode($row['code_iso'], 'class="saturatemedium paddingrightonly"', 1); |
1035
|
|
- $labeltoshow = $tmpflag . ' ' . $labeltoshow; |
|
1035
|
+ $labeltoshow = $tmpflag.' '.$labeltoshow; |
1036
|
1036
|
} |
1037
|
1037
|
} |
1038
|
1038
|
|
1039
|
1039
|
if ($selected && $selected != '-1' && ($selected == $row['rowid'] || $selected == $row['code_iso'] || $selected == $row['code_iso3'] || $selected == $row['label'])) { |
1040
|
|
- $out .= '<option value="' . ($usecodeaskey ? ($usecodeaskey == 'code2' ? $row['code_iso'] : $row['code_iso3']) : $row['rowid']) . '" selected data-html="' . dol_escape_htmltag($labeltoshow) . '" data-eec="' . ((int) $row['eec']) . '">'; |
|
1040
|
+ $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']).'">'; |
1041
|
1041
|
} else { |
1042
|
|
- $out .= '<option value="' . ($usecodeaskey ? ($usecodeaskey == 'code2' ? $row['code_iso'] : $row['code_iso3']) : $row['rowid']) . '" data-html="' . dol_escape_htmltag($labeltoshow) . '" data-eec="' . ((int) $row['eec']) . '">'; |
|
1042
|
+ $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']).'">'; |
1043
|
1043
|
} |
1044
|
1044
|
$out .= $labeltoshow; |
1045
|
|
- $out .= '</option>' . "\n"; |
|
1045
|
+ $out .= '</option>'."\n"; |
1046
|
1046
|
} |
1047
|
1047
|
} |
1048
|
1048
|
$out .= '</select>'; |
|
@@ -1051,8 +1051,8 @@ discard block |
|
|
block discarded – undo |
1051
|
1051
|
} |
1052
|
1052
|
|
1053
|
1053
|
// Make select dynamic |
1054
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
1055
|
|
- $out .= ajax_combobox('select' . $htmlname, array(), 0, 0, 'resolve'); |
|
1054
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
|
1055
|
+ $out .= ajax_combobox('select'.$htmlname, array(), 0, 0, 'resolve'); |
1056
|
1056
|
|
1057
|
1057
|
return $out; |
1058
|
1058
|
} |
|
@@ -1084,25 +1084,25 @@ discard block |
|
|
block discarded – undo |
1084
|
1084
|
$incotermArray = array(); |
1085
|
1085
|
|
1086
|
1086
|
$sql = "SELECT rowid, code"; |
1087
|
|
- $sql .= " FROM " . $this->db->prefix() . "c_incoterms"; |
|
1087
|
+ $sql .= " FROM ".$this->db->prefix()."c_incoterms"; |
1088
|
1088
|
$sql .= " WHERE active > 0"; |
1089
|
1089
|
$sql .= " ORDER BY code ASC"; |
1090
|
1090
|
|
1091
|
|
- dol_syslog(get_class($this) . "::select_incoterm", LOG_DEBUG); |
|
1091
|
+ dol_syslog(get_class($this)."::select_incoterm", LOG_DEBUG); |
1092
|
1092
|
$resql = $this->db->query($sql); |
1093
|
1093
|
if ($resql) { |
1094
|
1094
|
if ($conf->use_javascript_ajax && !$forcecombo) { |
1095
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
1095
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
1096
|
1096
|
$out .= ajax_combobox($htmlname, $events); |
1097
|
1097
|
} |
1098
|
1098
|
|
1099
|
1099
|
if (!empty($page)) { |
1100
|
|
- $out .= '<form method="post" action="' . $page . '">'; |
|
1100
|
+ $out .= '<form method="post" action="'.$page.'">'; |
1101
|
1101
|
$out .= '<input type="hidden" name="action" value="set_incoterms">'; |
1102
|
|
- $out .= '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
1102
|
+ $out .= '<input type="hidden" name="token" value="'.newToken().'">'; |
1103
|
1103
|
} |
1104
|
1104
|
|
1105
|
|
- $out .= '<select id="' . $htmlname . '" class="flat selectincoterm width75" name="' . $htmlname . '" ' . $htmloption . '>'; |
|
1105
|
+ $out .= '<select id="'.$htmlname.'" class="flat selectincoterm width75" name="'.$htmlname.'" '.$htmloption.'>'; |
1106
|
1106
|
$out .= '<option value="0"> </option>'; |
1107
|
1107
|
$num = $this->db->num_rows($resql); |
1108
|
1108
|
$i = 0; |
|
@@ -1116,9 +1116,9 @@ discard block |
|
|
block discarded – undo |
1116
|
1116
|
|
1117
|
1117
|
foreach ($incotermArray as $row) { |
1118
|
1118
|
if ($selected && ($selected == $row['rowid'] || $selected == $row['code'])) { |
1119
|
|
- $out .= '<option value="' . $row['rowid'] . '" selected>'; |
|
1119
|
+ $out .= '<option value="'.$row['rowid'].'" selected>'; |
1120
|
1120
|
} else { |
1121
|
|
- $out .= '<option value="' . $row['rowid'] . '">'; |
|
1121
|
+ $out .= '<option value="'.$row['rowid'].'">'; |
1122
|
1122
|
} |
1123
|
1123
|
|
1124
|
1124
|
if ($row['code']) { |
|
@@ -1131,13 +1131,13 @@ discard block |
|
|
block discarded – undo |
1131
|
1131
|
$out .= '</select>'; |
1132
|
1132
|
|
1133
|
1133
|
if ($conf->use_javascript_ajax && empty($disableautocomplete)) { |
1134
|
|
- $out .= ajax_multiautocompleter('location_incoterms', array(), DOL_URL_ROOT . '/core/ajax/locationincoterms.php') . "\n"; |
|
1134
|
+ $out .= ajax_multiautocompleter('location_incoterms', array(), DOL_URL_ROOT.'/core/ajax/locationincoterms.php')."\n"; |
1135
|
1135
|
$moreattrib .= ' autocomplete="off"'; |
1136
|
1136
|
} |
1137
|
|
- $out .= '<input id="location_incoterms" class="maxwidthonsmartphone type="text" name="location_incoterms" value="' . $location_incoterms . '">' . "\n"; |
|
1137
|
+ $out .= '<input id="location_incoterms" class="maxwidthonsmartphone type="text" name="location_incoterms" value="'.$location_incoterms.'">'."\n"; |
1138
|
1138
|
|
1139
|
1139
|
if (!empty($page)) { |
1140
|
|
- $out .= '<input type="submit" class="button valignmiddle smallpaddingimp nomargintop nomarginbottom" value="' . $langs->trans("Modify") . '"></form>'; |
|
1140
|
+ $out .= '<input type="submit" class="button valignmiddle smallpaddingimp nomargintop nomarginbottom" value="'.$langs->trans("Modify").'"></form>'; |
1141
|
1141
|
} |
1142
|
1142
|
} else { |
1143
|
1143
|
dol_print_error($this->db); |
|
@@ -1169,9 +1169,9 @@ discard block |
|
|
block discarded – undo |
1169
|
1169
|
if ($forceall == 1 || (empty($forceall) && isModEnabled("product") && isModEnabled("service")) |
1170
|
1170
|
|| (empty($forceall) && !isModEnabled('product') && !isModEnabled('service'))) { |
1171
|
1171
|
if (empty($hidetext)) { |
1172
|
|
- print $langs->trans("Type") . ': '; |
|
1172
|
+ print $langs->trans("Type").': '; |
1173
|
1173
|
} |
1174
|
|
- print '<select class="flat'.($morecss ? ' '.$morecss : '').'" id="select_' . $htmlname . '" name="' . $htmlname . '">'; |
|
1174
|
+ print '<select class="flat'.($morecss ? ' '.$morecss : '').'" id="select_'.$htmlname.'" name="'.$htmlname.'">'; |
1175
|
1175
|
if ($showempty) { |
1176
|
1176
|
print '<option value="-1"'; |
1177
|
1177
|
if ($selected == -1) { |
|
@@ -1190,28 +1190,28 @@ discard block |
|
|
block discarded – undo |
1190
|
1190
|
if (0 == $selected || ($selected == -1 && getDolGlobalString('MAIN_FREE_PRODUCT_CHECKED_BY_DEFAULT') == 'product')) { |
1191
|
1191
|
print ' selected'; |
1192
|
1192
|
} |
1193
|
|
- print '>' . $langs->trans("Product"); |
|
1193
|
+ print '>'.$langs->trans("Product"); |
1194
|
1194
|
|
1195
|
1195
|
print '<option value="1"'; |
1196
|
1196
|
if (1 == $selected || ($selected == -1 && getDolGlobalString('MAIN_FREE_PRODUCT_CHECKED_BY_DEFAULT') == 'service')) { |
1197
|
1197
|
print ' selected'; |
1198
|
1198
|
} |
1199
|
|
- print '>' . $langs->trans("Service"); |
|
1199
|
+ print '>'.$langs->trans("Service"); |
1200
|
1200
|
|
1201
|
1201
|
print '</select>'; |
1202
|
|
- print ajax_combobox('select_' . $htmlname); |
|
1202
|
+ print ajax_combobox('select_'.$htmlname); |
1203
|
1203
|
//if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); |
1204
|
1204
|
} |
1205
|
1205
|
if ((empty($forceall) && !isModEnabled('product') && isModEnabled("service")) || $forceall == 3) { |
1206
|
1206
|
print $langs->trans("Service"); |
1207
|
|
- print '<input type="hidden" name="' . $htmlname . '" value="1">'; |
|
1207
|
+ print '<input type="hidden" name="'.$htmlname.'" value="1">'; |
1208
|
1208
|
} |
1209
|
1209
|
if ((empty($forceall) && isModEnabled("product") && !isModEnabled('service')) || $forceall == 2) { |
1210
|
1210
|
print $langs->trans("Product"); |
1211
|
|
- print '<input type="hidden" name="' . $htmlname . '" value="0">'; |
|
1211
|
+ print '<input type="hidden" name="'.$htmlname.'" value="0">'; |
1212
|
1212
|
} |
1213
|
1213
|
if ($forceall < 0) { // This should happened only for contracts when both predefined product and service are disabled. |
1214
|
|
- print '<input type="hidden" name="' . $htmlname . '" value="1">'; // By default we set on service for contract. If CONTRACT_SUPPORT_PRODUCTS is set, forceall should be 1 not -1 |
|
1214
|
+ 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 |
1215
|
1215
|
} |
1216
|
1216
|
} |
1217
|
1217
|
|
|
@@ -1237,7 +1237,7 @@ discard block |
|
|
block discarded – undo |
1237
|
1237
|
$langs->load("trips"); |
1238
|
1238
|
|
1239
|
1239
|
$sql = "SELECT c.code, c.label"; |
1240
|
|
- $sql .= " FROM " . $this->db->prefix() . "c_type_fees as c"; |
|
1240
|
+ $sql .= " FROM ".$this->db->prefix()."c_type_fees as c"; |
1241
|
1241
|
$sql .= " WHERE active > 0"; |
1242
|
1242
|
|
1243
|
1243
|
$resql = $this->db->query($sql); |
|
@@ -1278,11 +1278,11 @@ discard block |
|
|
block discarded – undo |
1278
|
1278
|
// phpcs:enable |
1279
|
1279
|
global $user, $langs; |
1280
|
1280
|
|
1281
|
|
- dol_syslog(__METHOD__ . " selected=" . $selected . ", htmlname=" . $htmlname, LOG_DEBUG); |
|
1281
|
+ dol_syslog(__METHOD__." selected=".$selected.", htmlname=".$htmlname, LOG_DEBUG); |
1282
|
1282
|
|
1283
|
1283
|
$this->load_cache_types_fees(); |
1284
|
1284
|
|
1285
|
|
- print '<select id="select_' . $htmlname . '" class="flat" name="' . $htmlname . '">'; |
|
1285
|
+ print '<select id="select_'.$htmlname.'" class="flat" name="'.$htmlname.'">'; |
1286
|
1286
|
if ($showempty) { |
1287
|
1287
|
print '<option value="-1"'; |
1288
|
1288
|
if ($selected == -1) { |
|
@@ -1292,7 +1292,7 @@ discard block |
|
|
block discarded – undo |
1292
|
1292
|
} |
1293
|
1293
|
|
1294
|
1294
|
foreach ($this->cache_types_fees as $key => $value) { |
1295
|
|
- print '<option value="' . $key . '"'; |
|
1295
|
+ print '<option value="'.$key.'"'; |
1296
|
1296
|
if ($key == $selected) { |
1297
|
1297
|
print ' selected'; |
1298
|
1298
|
} |
|
@@ -1344,12 +1344,12 @@ discard block |
|
|
block discarded – undo |
1344
|
1344
|
$ajaxoptions = array(); |
1345
|
1345
|
} |
1346
|
1346
|
|
1347
|
|
- require_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
1347
|
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
1348
|
1348
|
|
1349
|
1349
|
// No immediate load of all database |
1350
|
1350
|
$placeholder = ''; |
1351
|
1351
|
if ($selected && empty($selected_input_value)) { |
1352
|
|
- require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; |
|
1352
|
+ require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; |
1353
|
1353
|
$societetmp = new Societe($this->db); |
1354
|
1354
|
$societetmp->fetch($selected); |
1355
|
1355
|
$selected_input_value = $societetmp->name; |
|
@@ -1357,18 +1357,18 @@ discard block |
|
|
block discarded – undo |
1357
|
1357
|
} |
1358
|
1358
|
|
1359
|
1359
|
// mode 1 |
1360
|
|
- $urloption = 'htmlname=' . urlencode((string) (str_replace('.', '_', $htmlname))) . '&outjson=1&filter=' . urlencode((string) ($filter)) . (empty($excludeids) ? '' : '&excludeids=' . implode(',', $excludeids)) . ($showtype ? '&showtype=' . urlencode((string) ($showtype)) : '') . ($showcode ? '&showcode=' . urlencode((string) ($showcode)) : ''); |
|
1360
|
+ $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)) : ''); |
1361
|
1361
|
|
1362
|
1362
|
$out .= '<!-- force css to be higher than dialog popup --><style type="text/css">.ui-autocomplete { z-index: 1010; }</style>'; |
1363
|
1363
|
if (empty($hidelabel)) { |
1364
|
|
- print $langs->trans("RefOrLabel") . ' : '; |
|
1364
|
+ print $langs->trans("RefOrLabel").' : '; |
1365
|
1365
|
} elseif ($hidelabel > 1) { |
1366
|
1366
|
$placeholder = $langs->trans("RefOrLabel"); |
1367
|
1367
|
if ($hidelabel == 2) { |
1368
|
1368
|
$out .= img_picto($langs->trans("Search"), 'search'); |
1369
|
1369
|
} |
1370
|
1370
|
} |
1371
|
|
- $out .= '<input type="text" class="' . $morecss . '" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . ($placeholder ? ' placeholder="' . dol_escape_htmltag($placeholder) . '"' : '') . ' ' . (getDolGlobalString('THIRDPARTY_SEARCH_AUTOFOCUS') ? 'autofocus' : '') . ' />'; |
|
1371
|
+ $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' : '').' />'; |
1372
|
1372
|
if ($hidelabel == 3) { |
1373
|
1373
|
$out .= img_picto($langs->trans("Search"), 'search'); |
1374
|
1374
|
} |
|
@@ -1430,12 +1430,12 @@ discard block |
|
|
block discarded – undo |
1430
|
1430
|
$events = array(); |
1431
|
1431
|
} |
1432
|
1432
|
|
1433
|
|
- require_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
1433
|
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
1434
|
1434
|
|
1435
|
1435
|
// No immediate load of all database |
1436
|
1436
|
$placeholder = ''; |
1437
|
1437
|
if ($selected && empty($selected_input_value)) { |
1438
|
|
- require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php'; |
|
1438
|
+ require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; |
1439
|
1439
|
$contacttmp = new Contact($this->db); |
1440
|
1440
|
$contacttmp->fetch($selected); |
1441
|
1441
|
$selected_input_value = $contacttmp->getFullName($langs); |
|
@@ -1446,11 +1446,11 @@ discard block |
|
|
block discarded – undo |
1446
|
1446
|
} |
1447
|
1447
|
|
1448
|
1448
|
// mode 1 |
1449
|
|
- $urloption = 'htmlname=' . urlencode((string) (str_replace('.', '_', $htmlname))) . '&outjson=1&filter=' . urlencode((string) ($filter)) . (empty($exclude) ? '' : '&exclude=' . urlencode($exclude)) . ($showsoc ? '&showsoc=' . urlencode((string) ($showsoc)) : ''); |
|
1449
|
+ $urloption = 'htmlname='.urlencode((string) (str_replace('.', '_', $htmlname))).'&outjson=1&filter='.urlencode((string) ($filter)).(empty($exclude) ? '' : '&exclude='.urlencode($exclude)).($showsoc ? '&showsoc='.urlencode((string) ($showsoc)) : ''); |
1450
|
1450
|
|
1451
|
1451
|
$out .= '<!-- force css to be higher than dialog popup --><style type="text/css">.ui-autocomplete { z-index: 1010; }</style>'; |
1452
|
1452
|
|
1453
|
|
- $out .= '<input type="text" class="' . $morecss . '" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . ($placeholder ? ' placeholder="' . dol_escape_htmltag($placeholder) . '"' : '') . ' ' . (getDolGlobalString('CONTACT_SEARCH_AUTOFOCUS') ? 'autofocus' : '') . ' />'; |
|
1453
|
+ $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' : '').' />'; |
1454
|
1454
|
|
1455
|
1455
|
$out .= ajax_event($htmlname, $events); |
1456
|
1456
|
|
|
@@ -1547,30 +1547,30 @@ discard block |
|
|
block discarded – undo |
1547
|
1547
|
$sql .= ", s.address, s.zip, s.town"; |
1548
|
1548
|
$sql .= ", dictp.code as country_code"; |
1549
|
1549
|
} |
1550
|
|
- $sql .= " FROM " . $this->db->prefix() . "societe as s"; |
|
1550
|
+ $sql .= " FROM ".$this->db->prefix()."societe as s"; |
1551
|
1551
|
if (getDolGlobalString('COMPANY_SHOW_ADDRESS_SELECTLIST')) { |
1552
|
|
- $sql .= " LEFT JOIN " . $this->db->prefix() . "c_country as dictp ON dictp.rowid = s.fk_pays"; |
|
1552
|
+ $sql .= " LEFT JOIN ".$this->db->prefix()."c_country as dictp ON dictp.rowid = s.fk_pays"; |
1553
|
1553
|
} |
1554
|
1554
|
if (!$user->hasRight('societe', 'client', 'voir')) { |
1555
|
|
- $sql .= ", " . $this->db->prefix() . "societe_commerciaux as sc"; |
|
1555
|
+ $sql .= ", ".$this->db->prefix()."societe_commerciaux as sc"; |
1556
|
1556
|
} |
1557
|
|
- $sql .= " WHERE s.entity IN (" . getEntity('societe') . ")"; |
|
1557
|
+ $sql .= " WHERE s.entity IN (".getEntity('societe').")"; |
1558
|
1558
|
if (!empty($user->socid)) { |
1559
|
|
- $sql .= " AND s.rowid = " . ((int) $user->socid); |
|
1559
|
+ $sql .= " AND s.rowid = ".((int) $user->socid); |
1560
|
1560
|
} |
1561
|
1561
|
if ($filter) { |
1562
|
1562
|
// $filter is safe because, if it contains '(' or ')', it has been sanitized by testSqlAndScriptInject() and forgeSQLFromUniversalSearchCriteria() |
1563
|
1563
|
// if not, by testSqlAndScriptInject() only. |
1564
|
|
- $sql .= " AND (" . $filter . ")"; |
|
1564
|
+ $sql .= " AND (".$filter.")"; |
1565
|
1565
|
} |
1566
|
1566
|
if (!$user->hasRight('societe', 'client', 'voir')) { |
1567
|
|
- $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " . ((int) $user->id); |
|
1567
|
+ $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id); |
1568
|
1568
|
} |
1569
|
1569
|
if (getDolGlobalString('COMPANY_HIDE_INACTIVE_IN_COMBOBOX')) { |
1570
|
1570
|
$sql .= " AND s.status <> 0"; |
1571
|
1571
|
} |
1572
|
1572
|
if (!empty($excludeids)) { |
1573
|
|
- $sql .= " AND s.rowid NOT IN (" . $this->db->sanitize(implode(',', $excludeids)) . ")"; |
|
1573
|
+ $sql .= " AND s.rowid NOT IN (".$this->db->sanitize(implode(',', $excludeids)).")"; |
1574
|
1574
|
} |
1575
|
1575
|
// Add where from hooks |
1576
|
1576
|
$parameters = array(); |
|
@@ -1590,17 +1590,17 @@ discard block |
|
|
block discarded – undo |
1590
|
1590
|
if ($i > 0) { |
1591
|
1591
|
$sql .= " AND "; |
1592
|
1592
|
} |
1593
|
|
- $sql .= "(s.nom LIKE '" . $this->db->escape($prefix . $crit) . "%')"; |
|
1593
|
+ $sql .= "(s.nom LIKE '".$this->db->escape($prefix.$crit)."%')"; |
1594
|
1594
|
$i++; |
1595
|
1595
|
} |
1596
|
1596
|
if (count($search_crit) > 1) { |
1597
|
1597
|
$sql .= ")"; |
1598
|
1598
|
} |
1599
|
1599
|
if (isModEnabled('barcode')) { |
1600
|
|
- $sql .= " OR s.barcode LIKE '" . $this->db->escape($prefix . $filterkey) . "%'"; |
|
1600
|
+ $sql .= " OR s.barcode LIKE '".$this->db->escape($prefix.$filterkey)."%'"; |
1601
|
1601
|
} |
1602
|
|
- $sql .= " OR s.code_client LIKE '" . $this->db->escape($prefix . $filterkey) . "%' OR s.code_fournisseur LIKE '" . $this->db->escape($prefix . $filterkey) . "%'"; |
1603
|
|
- $sql .= " OR s.name_alias LIKE '" . $this->db->escape($prefix . $filterkey) . "%' OR s.tva_intra LIKE '" . $this->db->escape($prefix . $filterkey) . "%'"; |
|
1602
|
+ $sql .= " OR s.code_client LIKE '".$this->db->escape($prefix.$filterkey)."%' OR s.code_fournisseur LIKE '".$this->db->escape($prefix.$filterkey)."%'"; |
|
1603
|
+ $sql .= " OR s.name_alias LIKE '".$this->db->escape($prefix.$filterkey)."%' OR s.tva_intra LIKE '".$this->db->escape($prefix.$filterkey)."%'"; |
1604
|
1604
|
$sql .= ")"; |
1605
|
1605
|
} |
1606
|
1606
|
$sql .= $this->db->order("nom", "ASC"); |
|
@@ -1611,7 +1611,7 @@ discard block |
|
|
block discarded – undo |
1611
|
1611
|
$resql = $this->db->query($sql); |
1612
|
1612
|
if ($resql) { |
1613
|
1613
|
// Construct $out and $outarray |
1614
|
|
- $out .= '<select id="' . $htmlname . '" class="flat' . ($morecss ? ' ' . $morecss : '') . '"' . ($moreparam ? ' ' . $moreparam : '') . ' name="' . $htmlname . ($multiple ? '[]' : '') . '" ' . ($multiple ? 'multiple' : '') . '>' . "\n"; |
|
1614
|
+ $out .= '<select id="'.$htmlname.'" class="flat'.($morecss ? ' '.$morecss : '').'"'.($moreparam ? ' '.$moreparam : '').' name="'.$htmlname.($multiple ? '[]' : '').'" '.($multiple ? 'multiple' : '').'>'."\n"; |
1615
|
1615
|
|
1616
|
1616
|
$textifempty = (($showempty && !is_numeric($showempty)) ? $langs->trans($showempty) : ''); |
1617
|
1617
|
if (getDolGlobalString('COMPANY_USE_SEARCH_TO_SELECT')) { |
|
@@ -1624,7 +1624,7 @@ discard block |
|
|
block discarded – undo |
1624
|
1624
|
} |
1625
|
1625
|
} |
1626
|
1626
|
if ($showempty) { |
1627
|
|
- $out .= '<option value="-1" data-html="' . dol_escape_htmltag('<span class="opacitymedium">' . ($textifempty ? $textifempty : ' ') . '</span>') . '">' . $textifempty . '</option>' . "\n"; |
|
1627
|
+ $out .= '<option value="-1" data-html="'.dol_escape_htmltag('<span class="opacitymedium">'.($textifempty ? $textifempty : ' ').'</span>').'">'.$textifempty.'</option>'."\n"; |
1628
|
1628
|
} |
1629
|
1629
|
|
1630
|
1630
|
$companytemp = new Societe($this->db); |
|
@@ -1637,18 +1637,18 @@ discard block |
|
|
block discarded – undo |
1637
|
1637
|
$label = ''; |
1638
|
1638
|
if ($showcode || getDolGlobalString('SOCIETE_ADD_REF_IN_LIST')) { |
1639
|
1639
|
if (($obj->client) && (!empty($obj->code_client))) { |
1640
|
|
- $label = $obj->code_client . ' - '; |
|
1640
|
+ $label = $obj->code_client.' - '; |
1641
|
1641
|
} |
1642
|
1642
|
if (($obj->fournisseur) && (!empty($obj->code_fournisseur))) { |
1643
|
|
- $label .= $obj->code_fournisseur . ' - '; |
|
1643
|
+ $label .= $obj->code_fournisseur.' - '; |
1644
|
1644
|
} |
1645
|
|
- $label .= ' ' . $obj->name; |
|
1645
|
+ $label .= ' '.$obj->name; |
1646
|
1646
|
} else { |
1647
|
1647
|
$label = $obj->name; |
1648
|
1648
|
} |
1649
|
1649
|
|
1650
|
1650
|
if (!empty($obj->name_alias)) { |
1651
|
|
- $label .= ' (' . $obj->name_alias . ')'; |
|
1651
|
+ $label .= ' ('.$obj->name_alias.')'; |
1652
|
1652
|
} |
1653
|
1653
|
|
1654
|
1654
|
if (getDolGlobalString('SOCIETE_SHOW_VAT_IN_LIST') && !empty($obj->tva_intra)) { |
|
@@ -1663,7 +1663,7 @@ discard block |
|
|
block discarded – undo |
1663
|
1663
|
$companytemp->fournisseur = $obj->fournisseur; |
1664
|
1664
|
$tmptype = $companytemp->getTypeUrl(1, '', 0, 'span'); |
1665
|
1665
|
if ($tmptype) { |
1666
|
|
- $labelhtml .= ' ' . $tmptype; |
|
1666
|
+ $labelhtml .= ' '.$tmptype; |
1667
|
1667
|
} |
1668
|
1668
|
|
1669
|
1669
|
if ($obj->client || $obj->fournisseur) { |
|
@@ -1673,10 +1673,10 @@ discard block |
|
|
block discarded – undo |
1673
|
1673
|
$label .= $langs->trans("Customer"); |
1674
|
1674
|
} |
1675
|
1675
|
if ($obj->client == 2 || $obj->client == 3) { |
1676
|
|
- $label .= ($obj->client == 3 ? ', ' : '') . $langs->trans("Prospect"); |
|
1676
|
+ $label .= ($obj->client == 3 ? ', ' : '').$langs->trans("Prospect"); |
1677
|
1677
|
} |
1678
|
1678
|
if ($obj->fournisseur) { |
1679
|
|
- $label .= ($obj->client ? ', ' : '') . $langs->trans("Supplier"); |
|
1679
|
+ $label .= ($obj->client ? ', ' : '').$langs->trans("Supplier"); |
1680
|
1680
|
} |
1681
|
1681
|
if ($obj->client || $obj->fournisseur) { |
1682
|
1682
|
$label .= ')'; |
|
@@ -1684,9 +1684,9 @@ discard block |
|
|
block discarded – undo |
1684
|
1684
|
} |
1685
|
1685
|
|
1686
|
1686
|
if (getDolGlobalString('COMPANY_SHOW_ADDRESS_SELECTLIST')) { |
1687
|
|
- $s = ($obj->address ? ' - ' . $obj->address : '') . ($obj->zip ? ' - ' . $obj->zip : '') . ($obj->town ? ' ' . $obj->town : ''); |
|
1687
|
+ $s = ($obj->address ? ' - '.$obj->address : '').($obj->zip ? ' - '.$obj->zip : '').($obj->town ? ' '.$obj->town : ''); |
1688
|
1688
|
if (!empty($obj->country_code)) { |
1689
|
|
- $s .= ', ' . $langs->trans('Country' . $obj->country_code); |
|
1689
|
+ $s .= ', '.$langs->trans('Country'.$obj->country_code); |
1690
|
1690
|
} |
1691
|
1691
|
$label .= $s; |
1692
|
1692
|
$labelhtml .= $s; |
|
@@ -1694,9 +1694,9 @@ discard block |
|
|
block discarded – undo |
1694
|
1694
|
|
1695
|
1695
|
if (empty($outputmode)) { |
1696
|
1696
|
if (in_array($obj->rowid, $selected)) { |
1697
|
|
- $out .= '<option value="' . $obj->rowid . '" selected data-html="' . dol_escape_htmltag($labelhtml, 0, 0, '', 0, 1) . '">' . dol_escape_htmltag($label, 0, 0, '', 0, 1) . '</option>'; |
|
1697
|
+ $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>'; |
1698
|
1698
|
} else { |
1699
|
|
- $out .= '<option value="' . $obj->rowid . '" data-html="' . dol_escape_htmltag($labelhtml, 0, 0, '', 0, 1) . '">' . dol_escape_htmltag($label, 0, 0, '', 0, 1) . '</option>'; |
|
1699
|
+ $out .= '<option value="'.$obj->rowid.'" data-html="'.dol_escape_htmltag($labelhtml, 0, 0, '', 0, 1).'">'.dol_escape_htmltag($label, 0, 0, '', 0, 1).'</option>'; |
1700
|
1700
|
} |
1701
|
1701
|
} else { |
1702
|
1702
|
array_push($outarray, array('key' => $obj->rowid, 'value' => $label, 'label' => $label, 'labelhtml' => $labelhtml)); |
|
@@ -1708,9 +1708,9 @@ discard block |
|
|
block discarded – undo |
1708
|
1708
|
} |
1709
|
1709
|
} |
1710
|
1710
|
} |
1711
|
|
- $out .= '</select>' . "\n"; |
|
1711
|
+ $out .= '</select>'."\n"; |
1712
|
1712
|
if (!$forcecombo) { |
1713
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
1713
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
1714
|
1714
|
$out .= ajax_combobox($htmlname, $events, getDolGlobalInt("COMPANY_USE_SEARCH_TO_SELECT")); |
1715
|
1715
|
} |
1716
|
1716
|
} else { |
|
@@ -1799,7 +1799,7 @@ discard block |
|
|
block discarded – undo |
1799
|
1799
|
} |
1800
|
1800
|
|
1801
|
1801
|
if (!is_object($hookmanager)) { |
1802
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/class/hookmanager.class.php'; |
|
1802
|
+ include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; |
1803
|
1803
|
$hookmanager = new HookManager($this->db); |
1804
|
1804
|
} |
1805
|
1805
|
|
|
@@ -1808,13 +1808,13 @@ discard block |
|
|
block discarded – undo |
1808
|
1808
|
if ($showsoc > 0 || getDolGlobalString('CONTACT_SHOW_EMAIL_PHONE_TOWN_SELECTLIST')) { |
1809
|
1809
|
$sql .= ", s.nom as company, s.town AS company_town"; |
1810
|
1810
|
} |
1811
|
|
- $sql .= " FROM " . $this->db->prefix() . "socpeople as sp"; |
|
1811
|
+ $sql .= " FROM ".$this->db->prefix()."socpeople as sp"; |
1812
|
1812
|
if ($showsoc > 0 || getDolGlobalString('CONTACT_SHOW_EMAIL_PHONE_TOWN_SELECTLIST')) { |
1813
|
|
- $sql .= " LEFT OUTER JOIN " . $this->db->prefix() . "societe as s ON s.rowid=sp.fk_soc"; |
|
1813
|
+ $sql .= " LEFT OUTER JOIN ".$this->db->prefix()."societe as s ON s.rowid=sp.fk_soc"; |
1814
|
1814
|
} |
1815
|
|
- $sql .= " WHERE sp.entity IN (" . getEntity('contact') . ")"; |
|
1815
|
+ $sql .= " WHERE sp.entity IN (".getEntity('contact').")"; |
1816
|
1816
|
if ($socid > 0 || $socid == -1) { |
1817
|
|
- $sql .= " AND sp.fk_soc = " . ((int) $socid); |
|
1817
|
+ $sql .= " AND sp.fk_soc = ".((int) $socid); |
1818
|
1818
|
} |
1819
|
1819
|
if (getDolGlobalString('CONTACT_HIDE_INACTIVE_IN_COMBOBOX')) { |
1820
|
1820
|
$sql .= " AND sp.statut <> 0"; |
|
@@ -1822,7 +1822,7 @@ discard block |
|
|
block discarded – undo |
1822
|
1822
|
if ($filter) { |
1823
|
1823
|
// $filter is safe because, if it contains '(' or ')', it has been sanitized by testSqlAndScriptInject() and forgeSQLFromUniversalSearchCriteria() |
1824
|
1824
|
// if not, by testSqlAndScriptInject() only. |
1825
|
|
- $sql .= " AND (" . $filter . ")"; |
|
1825
|
+ $sql .= " AND (".$filter.")"; |
1826
|
1826
|
} |
1827
|
1827
|
// Add where from hooks |
1828
|
1828
|
$parameters = array(); |
|
@@ -1830,30 +1830,30 @@ discard block |
|
|
block discarded – undo |
1830
|
1830
|
$sql .= $hookmanager->resPrint; |
1831
|
1831
|
$sql .= " ORDER BY sp.lastname ASC"; |
1832
|
1832
|
|
1833
|
|
- dol_syslog(get_class($this) . "::selectcontacts", LOG_DEBUG); |
|
1833
|
+ dol_syslog(get_class($this)."::selectcontacts", LOG_DEBUG); |
1834
|
1834
|
$resql = $this->db->query($sql); |
1835
|
1835
|
if ($resql) { |
1836
|
1836
|
$num = $this->db->num_rows($resql); |
1837
|
1837
|
|
1838
|
1838
|
if ($htmlname != 'none' && !$options_only) { |
1839
|
|
- $out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" id="' . $htmlid . '" name="' . $htmlname . ($multiple ? '[]' : '') . '" ' . (($num || empty($disableifempty)) ? '' : ' disabled') . ($multiple ? 'multiple' : '') . ' ' . (!empty($moreparam) ? $moreparam : '') . '>'; |
|
1839
|
+ $out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" id="'.$htmlid.'" name="'.$htmlname.($multiple ? '[]' : '').'" '.(($num || empty($disableifempty)) ? '' : ' disabled').($multiple ? 'multiple' : '').' '.(!empty($moreparam) ? $moreparam : '').'>'; |
1840
|
1840
|
} |
1841
|
1841
|
|
1842
|
1842
|
if ($showempty && !is_numeric($showempty)) { |
1843
|
1843
|
$textforempty = $showempty; |
1844
|
|
- $out .= '<option class="optiongrey" value="-1"' . (in_array(-1, $selected) ? ' selected' : '') . '>' . $textforempty . '</option>'; |
|
1844
|
+ $out .= '<option class="optiongrey" value="-1"'.(in_array(-1, $selected) ? ' selected' : '').'>'.$textforempty.'</option>'; |
1845
|
1845
|
} else { |
1846
|
1846
|
if (($showempty == 1 || ($showempty == 3 && $num > 1)) && !$multiple) { |
1847
|
|
- $out .= '<option value="0"' . (in_array(0, $selected) ? ' selected' : '') . '> </option>'; |
|
1847
|
+ $out .= '<option value="0"'.(in_array(0, $selected) ? ' selected' : '').'> </option>'; |
1848
|
1848
|
} |
1849
|
1849
|
if ($showempty == 2) { |
1850
|
|
- $out .= '<option value="0"' . (in_array(0, $selected) ? ' selected' : '') . '>-- ' . $langs->trans("Internal") . ' --</option>'; |
|
1850
|
+ $out .= '<option value="0"'.(in_array(0, $selected) ? ' selected' : '').'>-- '.$langs->trans("Internal").' --</option>'; |
1851
|
1851
|
} |
1852
|
1852
|
} |
1853
|
1853
|
|
1854
|
1854
|
$i = 0; |
1855
|
1855
|
if ($num) { |
1856
|
|
- include_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php'; |
|
1856
|
+ include_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; |
1857
|
1857
|
$contactstatic = new Contact($this->db); |
1858
|
1858
|
|
1859
|
1859
|
while ($i < $num) { |
|
@@ -1889,7 +1889,7 @@ discard block |
|
|
block discarded – undo |
1889
|
1889
|
} |
1890
|
1890
|
$extendedInfos = implode(' - ', $extendedInfos); |
1891
|
1891
|
if (!empty($extendedInfos)) { |
1892
|
|
- $extendedInfos = ' - ' . $extendedInfos; |
|
1892
|
+ $extendedInfos = ' - '.$extendedInfos; |
1893
|
1893
|
} |
1894
|
1894
|
} |
1895
|
1895
|
|
|
@@ -1907,35 +1907,35 @@ discard block |
|
|
block discarded – undo |
1907
|
1907
|
$disabled = 1; |
1908
|
1908
|
} |
1909
|
1909
|
if (!empty($selected) && in_array($obj->rowid, $selected)) { |
1910
|
|
- $out .= '<option value="' . $obj->rowid . '"'; |
|
1910
|
+ $out .= '<option value="'.$obj->rowid.'"'; |
1911
|
1911
|
if ($disabled) { |
1912
|
1912
|
$out .= ' disabled'; |
1913
|
1913
|
} |
1914
|
1914
|
$out .= ' selected>'; |
1915
|
1915
|
|
1916
|
|
- $tmplabel = $contactstatic->getFullName($langs) . $extendedInfos; |
|
1916
|
+ $tmplabel = $contactstatic->getFullName($langs).$extendedInfos; |
1917
|
1917
|
if ($showfunction && $obj->poste) { |
1918
|
|
- $tmplabel .= ' (' . $obj->poste . ')'; |
|
1918
|
+ $tmplabel .= ' ('.$obj->poste.')'; |
1919
|
1919
|
} |
1920
|
1920
|
if (($showsoc > 0) && $obj->company) { |
1921
|
|
- $tmplabel .= ' - (' . $obj->company . ')'; |
|
1921
|
+ $tmplabel .= ' - ('.$obj->company.')'; |
1922
|
1922
|
} |
1923
|
1923
|
|
1924
|
1924
|
$out .= $tmplabel; |
1925
|
1925
|
$out .= '</option>'; |
1926
|
1926
|
} else { |
1927
|
|
- $out .= '<option value="' . $obj->rowid . '"'; |
|
1927
|
+ $out .= '<option value="'.$obj->rowid.'"'; |
1928
|
1928
|
if ($disabled) { |
1929
|
1929
|
$out .= ' disabled'; |
1930
|
1930
|
} |
1931
|
1931
|
$out .= '>'; |
1932
|
1932
|
|
1933
|
|
- $tmplabel = $contactstatic->getFullName($langs) . $extendedInfos; |
|
1933
|
+ $tmplabel = $contactstatic->getFullName($langs).$extendedInfos; |
1934
|
1934
|
if ($showfunction && $obj->poste) { |
1935
|
|
- $tmplabel .= ' (' . $obj->poste . ')'; |
|
1935
|
+ $tmplabel .= ' ('.$obj->poste.')'; |
1936
|
1936
|
} |
1937
|
1937
|
if (($showsoc > 0) && $obj->company) { |
1938
|
|
- $tmplabel .= ' - (' . $obj->company . ')'; |
|
1938
|
+ $tmplabel .= ' - ('.$obj->company.')'; |
1939
|
1939
|
} |
1940
|
1940
|
|
1941
|
1941
|
$out .= $tmplabel; |
|
@@ -1943,12 +1943,12 @@ discard block |
|
|
block discarded – undo |
1943
|
1943
|
} |
1944
|
1944
|
} else { |
1945
|
1945
|
if (in_array($obj->rowid, $selected)) { |
1946
|
|
- $tmplabel = $contactstatic->getFullName($langs) . $extendedInfos; |
|
1946
|
+ $tmplabel = $contactstatic->getFullName($langs).$extendedInfos; |
1947
|
1947
|
if ($showfunction && $obj->poste) { |
1948
|
|
- $tmplabel .= ' (' . $obj->poste . ')'; |
|
1948
|
+ $tmplabel .= ' ('.$obj->poste.')'; |
1949
|
1949
|
} |
1950
|
1950
|
if (($showsoc > 0) && $obj->company) { |
1951
|
|
- $tmplabel .= ' - (' . $obj->company . ')'; |
|
1951
|
+ $tmplabel .= ' - ('.$obj->company.')'; |
1952
|
1952
|
} |
1953
|
1953
|
|
1954
|
1954
|
$out .= $tmplabel; |
|
@@ -1963,7 +1963,7 @@ discard block |
|
|
block discarded – undo |
1963
|
1963
|
} |
1964
|
1964
|
} else { |
1965
|
1965
|
$labeltoshow = ($socid != -1) ? ($langs->trans($socid ? "NoContactDefinedForThirdParty" : "NoContactDefined")) : $langs->trans('SelectAThirdPartyFirst'); |
1966
|
|
- $out .= '<option class="disabled" value="-1"' . (($showempty == 2 || $multiple) ? '' : ' selected') . ' disabled="disabled">'; |
|
1966
|
+ $out .= '<option class="disabled" value="-1"'.(($showempty == 2 || $multiple) ? '' : ' selected').' disabled="disabled">'; |
1967
|
1967
|
$out .= $labeltoshow; |
1968
|
1968
|
$out .= '</option>'; |
1969
|
1969
|
} |
|
@@ -1984,7 +1984,7 @@ discard block |
|
|
block discarded – undo |
1984
|
1984
|
} |
1985
|
1985
|
|
1986
|
1986
|
if ($conf->use_javascript_ajax && !$forcecombo && !$options_only) { |
1987
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
1987
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
1988
|
1988
|
$out .= ajax_combobox($htmlid, $events, getDolGlobalInt("CONTACT_USE_SEARCH_TO_SELECT")); |
1989
|
1989
|
} |
1990
|
1990
|
|
|
@@ -2023,18 +2023,18 @@ discard block |
|
|
block discarded – undo |
2023
|
2023
|
// On recherche les remises |
2024
|
2024
|
$sql = "SELECT re.rowid, re.amount_ht, re.amount_tva, re.amount_ttc,"; |
2025
|
2025
|
$sql .= " re.description, re.fk_facture_source"; |
2026
|
|
- $sql .= " FROM " . $this->db->prefix() . "societe_remise_except as re"; |
2027
|
|
- $sql .= " WHERE re.fk_soc = " . (int) $socid; |
2028
|
|
- $sql .= " AND re.entity = " . $conf->entity; |
|
2026
|
+ $sql .= " FROM ".$this->db->prefix()."societe_remise_except as re"; |
|
2027
|
+ $sql .= " WHERE re.fk_soc = ".(int) $socid; |
|
2028
|
+ $sql .= " AND re.entity = ".$conf->entity; |
2029
|
2029
|
if ($filter) { |
2030
|
|
- $sql .= " AND " . $filter; |
|
2030
|
+ $sql .= " AND ".$filter; |
2031
|
2031
|
} |
2032
|
2032
|
$sql .= " ORDER BY re.description ASC"; |
2033
|
2033
|
|
2034
|
|
- dol_syslog(get_class($this) . "::select_remises", LOG_DEBUG); |
|
2034
|
+ dol_syslog(get_class($this)."::select_remises", LOG_DEBUG); |
2035
|
2035
|
$resql = $this->db->query($sql); |
2036
|
2036
|
if ($resql) { |
2037
|
|
- print '<select id="select_' . $htmlname . '" class="flat maxwidthonsmartphone" name="' . $htmlname . '">'; |
|
2037
|
+ print '<select id="select_'.$htmlname.'" class="flat maxwidthonsmartphone" name="'.$htmlname.'">'; |
2038
|
2038
|
$num = $this->db->num_rows($resql); |
2039
|
2039
|
|
2040
|
2040
|
$qualifiedlines = $num; |
|
@@ -2072,16 +2072,16 @@ discard block |
|
|
block discarded – undo |
2072
|
2072
|
if (getDolGlobalString('MAIN_SHOW_FACNUMBER_IN_DISCOUNT_LIST') && !empty($obj->fk_facture_source)) { |
2073
|
2073
|
$tmpfac = new Facture($this->db); |
2074
|
2074
|
if ($tmpfac->fetch($obj->fk_facture_source) > 0) { |
2075
|
|
- $desc = $desc . ' - ' . $tmpfac->ref; |
|
2075
|
+ $desc = $desc.' - '.$tmpfac->ref; |
2076
|
2076
|
} |
2077
|
2077
|
} |
2078
|
2078
|
|
2079
|
|
- print '<option value="' . $obj->rowid . '"' . $selectstring . $disabled . '>' . $desc . ' (' . price($obj->amount_ht) . ' ' . $langs->trans("HT") . ' - ' . price($obj->amount_ttc) . ' ' . $langs->trans("TTC") . ')</option>'; |
|
2079
|
+ print '<option value="'.$obj->rowid.'"'.$selectstring.$disabled.'>'.$desc.' ('.price($obj->amount_ht).' '.$langs->trans("HT").' - '.price($obj->amount_ttc).' '.$langs->trans("TTC").')</option>'; |
2080
|
2080
|
$i++; |
2081
|
2081
|
} |
2082
|
2082
|
} |
2083
|
2083
|
print '</select>'; |
2084
|
|
- print ajax_combobox('select_' . $htmlname); |
|
2084
|
+ print ajax_combobox('select_'.$htmlname); |
2085
|
2085
|
|
2086
|
2086
|
return $qualifiedlines; |
2087
|
2087
|
} else { |
|
@@ -2190,14 +2190,14 @@ discard block |
|
|
block discarded – undo |
2190
|
2190
|
if ($showlabelofentity) { |
2191
|
2191
|
$sql .= ", e.label"; |
2192
|
2192
|
} |
2193
|
|
- $sql .= " FROM " . $this->db->prefix() . "user as u"; |
|
2193
|
+ $sql .= " FROM ".$this->db->prefix()."user as u"; |
2194
|
2194
|
if ($showlabelofentity) { |
2195
|
|
- $sql .= " LEFT JOIN " . $this->db->prefix() . "entity as e ON e.rowid = u.entity"; |
|
2195
|
+ $sql .= " LEFT JOIN ".$this->db->prefix()."entity as e ON e.rowid = u.entity"; |
2196
|
2196
|
} |
2197
|
2197
|
// Condition here should be the same than into societe->getSalesRepresentatives(). |
2198
|
2198
|
if ($userissuperadminentityone && $force_entity != 'default') { |
2199
|
2199
|
if (!empty($force_entity)) { |
2200
|
|
- $sql .= " WHERE u.entity IN (0, " . $this->db->sanitize($force_entity) . ")"; |
|
2200
|
+ $sql .= " WHERE u.entity IN (0, ".$this->db->sanitize($force_entity).")"; |
2201
|
2201
|
} else { |
2202
|
2202
|
$sql .= " WHERE u.entity IS NOT NULL"; |
2203
|
2203
|
} |
|
@@ -2205,18 +2205,18 @@ discard block |
|
|
block discarded – undo |
2205
|
2205
|
if (isModEnabled('multicompany') && getDolGlobalInt('MULTICOMPANY_TRANSVERSE_MODE')) { |
2206
|
2206
|
$sql .= " WHERE u.rowid IN (SELECT ug.fk_user FROM ".$this->db->prefix()."usergroup_user as ug WHERE ug.entity IN (".getEntity('usergroup')."))"; |
2207
|
2207
|
} else { |
2208
|
|
- $sql .= " WHERE u.entity IN (" . getEntity('user') . ")"; |
|
2208
|
+ $sql .= " WHERE u.entity IN (".getEntity('user').")"; |
2209
|
2209
|
} |
2210
|
2210
|
} |
2211
|
2211
|
|
2212
|
2212
|
if (!empty($user->socid)) { |
2213
|
|
- $sql .= " AND u.fk_soc = " . ((int) $user->socid); |
|
2213
|
+ $sql .= " AND u.fk_soc = ".((int) $user->socid); |
2214
|
2214
|
} |
2215
|
2215
|
if (is_array($exclude) && $excludeUsers) { |
2216
|
|
- $sql .= " AND u.rowid NOT IN (" . $this->db->sanitize($excludeUsers) . ")"; |
|
2216
|
+ $sql .= " AND u.rowid NOT IN (".$this->db->sanitize($excludeUsers).")"; |
2217
|
2217
|
} |
2218
|
2218
|
if ($includeUsers) { |
2219
|
|
- $sql .= " AND u.rowid IN (" . $this->db->sanitize($includeUsers) . ")"; |
|
2219
|
+ $sql .= " AND u.rowid IN (".$this->db->sanitize($includeUsers).")"; |
2220
|
2220
|
} |
2221
|
2221
|
if (getDolGlobalString('USER_HIDE_INACTIVE_IN_COMBOBOX') || $notdisabled) { |
2222
|
2222
|
$sql .= " AND u.statut <> 0"; |
|
@@ -2228,7 +2228,7 @@ discard block |
|
|
block discarded – undo |
2228
|
2228
|
$sql .= " AND u.fk_soc IS NULL"; |
2229
|
2229
|
} |
2230
|
2230
|
if (!empty($morefilter)) { |
2231
|
|
- $sql .= " " . $morefilter; |
|
2231
|
+ $sql .= " ".$morefilter; |
2232
|
2232
|
} |
2233
|
2233
|
|
2234
|
2234
|
//Add hook to filter on user (for example on usergroup define in custom modules) |
|
@@ -2243,7 +2243,7 @@ discard block |
|
|
block discarded – undo |
2243
|
2243
|
$sql .= " ORDER BY u.statut DESC, u.lastname ASC, u.firstname ASC"; |
2244
|
2244
|
} |
2245
|
2245
|
|
2246
|
|
- dol_syslog(get_class($this) . "::select_dolusers", LOG_DEBUG); |
|
2246
|
+ dol_syslog(get_class($this)."::select_dolusers", LOG_DEBUG); |
2247
|
2247
|
|
2248
|
2248
|
$resql = $this->db->query($sql); |
2249
|
2249
|
if ($resql) { |
|
@@ -2251,7 +2251,7 @@ discard block |
|
|
block discarded – undo |
2251
|
2251
|
$i = 0; |
2252
|
2252
|
if ($num) { |
2253
|
2253
|
// do not use maxwidthonsmartphone by default. Set it by caller so auto size to 100% will work when not defined |
2254
|
|
- $out .= '<select class="flat' . ($morecss ? ' ' . $morecss : ' minwidth200') . '" id="' . $htmlname . '" name="' . $htmlname . ($multiple ? '[]' : '') . '" ' . ($multiple ? 'multiple' : '') . ' ' . ($disabled ? ' disabled' : '') . '>'; |
|
2254
|
+ $out .= '<select class="flat'.($morecss ? ' '.$morecss : ' minwidth200').'" id="'.$htmlname.'" name="'.$htmlname.($multiple ? '[]' : '').'" '.($multiple ? 'multiple' : '').' '.($disabled ? ' disabled' : '').'>'; |
2255
|
2255
|
if ($show_empty && !$multiple) { |
2256
|
2256
|
$textforempty = ' '; |
2257
|
2257
|
if (!empty($conf->use_javascript_ajax)) { |
|
@@ -2260,10 +2260,10 @@ discard block |
|
|
block discarded – undo |
2260
|
2260
|
if (!is_numeric($show_empty)) { |
2261
|
2261
|
$textforempty = $show_empty; |
2262
|
2262
|
} |
2263
|
|
- $out .= '<option class="optiongrey" value="' . ($show_empty < 0 ? $show_empty : -1) . '"' . ((empty($selected) || in_array(-1, $selected)) ? ' selected' : '') . '>' . $textforempty . '</option>' . "\n"; |
|
2263
|
+ $out .= '<option class="optiongrey" value="'.($show_empty < 0 ? $show_empty : -1).'"'.((empty($selected) || in_array(-1, $selected)) ? ' selected' : '').'>'.$textforempty.'</option>'."\n"; |
2264
|
2264
|
} |
2265
|
2265
|
if ($show_every) { |
2266
|
|
- $out .= '<option value="-2"' . ((in_array(-2, $selected)) ? ' selected' : '') . '>-- ' . $langs->trans("Everybody") . ' --</option>' . "\n"; |
|
2266
|
+ $out .= '<option value="-2"'.((in_array(-2, $selected)) ? ' selected' : '').'>-- '.$langs->trans("Everybody").' --</option>'."\n"; |
2267
|
2267
|
} |
2268
|
2268
|
|
2269
|
2269
|
$userstatic = new User($this->db); |
|
@@ -2311,21 +2311,21 @@ discard block |
|
|
block discarded – undo |
2311
|
2311
|
} |
2312
|
2312
|
if ($showstatus >= 0) { |
2313
|
2313
|
if ($obj->status == 1 && $showstatus == 1) { |
2314
|
|
- $moreinfo .= ($moreinfo ? ' - ' : ' (') . $langs->trans('Enabled'); |
2315
|
|
- $moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(') . $langs->trans('Enabled'); |
|
2314
|
+ $moreinfo .= ($moreinfo ? ' - ' : ' (').$langs->trans('Enabled'); |
|
2315
|
+ $moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(').$langs->trans('Enabled'); |
2316
|
2316
|
} |
2317
|
2317
|
if ($obj->status == 0 && $showstatus == 1) { |
2318
|
|
- $moreinfo .= ($moreinfo ? ' - ' : ' (') . $langs->trans('Disabled'); |
2319
|
|
- $moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(') . $langs->trans('Disabled'); |
|
2318
|
+ $moreinfo .= ($moreinfo ? ' - ' : ' (').$langs->trans('Disabled'); |
|
2319
|
+ $moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(').$langs->trans('Disabled'); |
2320
|
2320
|
} |
2321
|
2321
|
} |
2322
|
2322
|
if ($showlabelofentity) { |
2323
|
2323
|
if (empty($obj->entity)) { |
2324
|
|
- $moreinfo .= ($moreinfo ? ' - ' : ' (') . $langs->trans("AllEntities"); |
2325
|
|
- $moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(') . $langs->trans("AllEntities"); |
|
2324
|
+ $moreinfo .= ($moreinfo ? ' - ' : ' (').$langs->trans("AllEntities"); |
|
2325
|
+ $moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(').$langs->trans("AllEntities"); |
2326
|
2326
|
} else { |
2327
|
2327
|
if ($obj->entity != $conf->entity) { |
2328
|
|
- $moreinfo .= ($moreinfo ? ' - ' : ' (') . ($obj->label ? $obj->label : $langs->trans("EntityNameNotDefined")); |
|
2328
|
+ $moreinfo .= ($moreinfo ? ' - ' : ' (').($obj->label ? $obj->label : $langs->trans("EntityNameNotDefined")); |
2329
|
2329
|
$moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(').($obj->label ? $obj->label : $langs->trans("EntityNameNotDefined")); |
2330
|
2330
|
} |
2331
|
2331
|
} |
|
@@ -2334,13 +2334,13 @@ discard block |
|
|
block discarded – undo |
2334
|
2334
|
$moreinfohtml .= (!empty($moreinfohtml) ? ')</span>' : ''); |
2335
|
2335
|
if (!empty($disableline) && $disableline != '1') { |
2336
|
2336
|
// Add text from $enableonlytext parameter |
2337
|
|
- $moreinfo .= ' - ' . $disableline; |
2338
|
|
- $moreinfohtml .= ' - ' . $disableline; |
|
2337
|
+ $moreinfo .= ' - '.$disableline; |
|
2338
|
+ $moreinfohtml .= ' - '.$disableline; |
2339
|
2339
|
} |
2340
|
2340
|
$labeltoshow .= $moreinfo; |
2341
|
2341
|
$labeltoshowhtml .= $moreinfohtml; |
2342
|
2342
|
|
2343
|
|
- $out .= '<option value="' . $obj->rowid . '"'; |
|
2343
|
+ $out .= '<option value="'.$obj->rowid.'"'; |
2344
|
2344
|
if (!empty($disableline)) { |
2345
|
2345
|
$out .= ' disabled'; |
2346
|
2346
|
} |
|
@@ -2349,7 +2349,7 @@ discard block |
|
|
block discarded – undo |
2349
|
2349
|
} |
2350
|
2350
|
$out .= ' data-html="'; |
2351
|
2351
|
|
2352
|
|
- $outhtml = $userstatic->getNomUrl(-3, '', 0, 1, 24, 1, 'login', '', 1) . ' '; |
|
2352
|
+ $outhtml = $userstatic->getNomUrl(-3, '', 0, 1, 24, 1, 'login', '', 1).' '; |
2353
|
2353
|
if ($showstatus >= 0 && $obj->status == 0) { |
2354
|
2354
|
$outhtml .= '<strike class="opacitymediumxxx">'; |
2355
|
2355
|
} |
|
@@ -2364,7 +2364,7 @@ discard block |
|
|
block discarded – undo |
2364
|
2364
|
$out .= $labeltoshow; |
2365
|
2365
|
$out .= '</option>'; |
2366
|
2366
|
|
2367
|
|
- $outarray[$userstatic->id] = $userstatic->getFullName($langs, $fullNameMode, -1, $maxlength) . $moreinfo; |
|
2367
|
+ $outarray[$userstatic->id] = $userstatic->getFullName($langs, $fullNameMode, -1, $maxlength).$moreinfo; |
2368
|
2368
|
$outarray2[$userstatic->id] = array( |
2369
|
2369
|
'id' => $userstatic->id, |
2370
|
2370
|
'label' => $labeltoshow, |
|
@@ -2376,14 +2376,14 @@ discard block |
|
|
block discarded – undo |
2376
|
2376
|
$i++; |
2377
|
2377
|
} |
2378
|
2378
|
} else { |
2379
|
|
- $out .= '<select class="flat" id="' . $htmlname . '" name="' . $htmlname . '" disabled>'; |
2380
|
|
- $out .= '<option value="">' . $langs->trans("None") . '</option>'; |
|
2379
|
+ $out .= '<select class="flat" id="'.$htmlname.'" name="'.$htmlname.'" disabled>'; |
|
2380
|
+ $out .= '<option value="">'.$langs->trans("None").'</option>'; |
2381
|
2381
|
} |
2382
|
2382
|
$out .= '</select>'; |
2383
|
2383
|
|
2384
|
2384
|
if ($num && !$forcecombo) { |
2385
|
2385
|
// Enhance with select2 |
2386
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
2386
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
2387
|
2387
|
$out .= ajax_combobox($htmlname); |
2388
|
2388
|
} |
2389
|
2389
|
} else { |
|
@@ -2459,16 +2459,16 @@ discard block |
|
|
block discarded – undo |
2459
|
2459
|
$out .= $userstatic->getNomUrl(-1); |
2460
|
2460
|
if ($i == 0) { |
2461
|
2461
|
$ownerid = $value['id']; |
2462
|
|
- $out .= ' (' . $langs->trans("Owner") . ')'; |
|
2462
|
+ $out .= ' ('.$langs->trans("Owner").')'; |
2463
|
2463
|
} |
2464
|
2464
|
if ($nbassignetouser > 1 && $action != 'view') { |
2465
|
|
- $out .= ' <input type="image" style="border: 0px;" src="' . img_picto($langs->trans("Remove"), 'delete', '', 0, 1) . '" value="' . $userstatic->id . '" class="removedassigned reposition" id="removedassigned_' . $userstatic->id . '" name="removedassigned_' . $userstatic->id . '">'; |
|
2465
|
+ $out .= ' <input type="image" style="border: 0px;" src="'.img_picto($langs->trans("Remove"), 'delete', '', 0, 1).'" value="'.$userstatic->id.'" class="removedassigned reposition" id="removedassigned_'.$userstatic->id.'" name="removedassigned_'.$userstatic->id.'">'; |
2466
|
2466
|
} |
2467
|
2467
|
// Show my availability |
2468
|
2468
|
if ($showproperties) { |
2469
|
2469
|
if ($ownerid == $value['id'] && is_array($listofuserid) && count($listofuserid) && in_array($ownerid, array_keys($listofuserid))) { |
2470
|
2470
|
$out .= '<div class="myavailability inline-block">'; |
2471
|
|
- $out .= '<span class="hideonsmartphone"> - <span class="opacitymedium">' . $langs->trans("Availability") . ':</span> </span><input id="transparency" class="paddingrightonly" ' . ($action == 'view' ? 'disabled' : '') . ' type="checkbox" name="transparency"' . ($listofuserid[$ownerid]['transparency'] ? ' checked' : '') . '><label for="transparency">' . $langs->trans("Busy") . '</label>'; |
|
2471
|
+ $out .= '<span class="hideonsmartphone"> - <span class="opacitymedium">'.$langs->trans("Availability").':</span> </span><input id="transparency" class="paddingrightonly" '.($action == 'view' ? 'disabled' : '').' type="checkbox" name="transparency"'.($listofuserid[$ownerid]['transparency'] ? ' checked' : '').'><label for="transparency">'.$langs->trans("Busy").'</label>'; |
2472
|
2472
|
$out .= '</div>'; |
2473
|
2473
|
} |
2474
|
2474
|
} |
|
@@ -2485,15 +2485,15 @@ discard block |
|
|
block discarded – undo |
2485
|
2485
|
// Method with no ajax |
2486
|
2486
|
if ($action != 'view') { |
2487
|
2487
|
$out .= '<input type="hidden" class="removedassignedhidden" name="removedassigned" value="">'; |
2488
|
|
- $out .= '<script nonce="' . getNonce() . '" type="text/javascript">jQuery(document).ready(function () {'; |
|
2488
|
+ $out .= '<script nonce="'.getNonce().'" type="text/javascript">jQuery(document).ready(function () {'; |
2489
|
2489
|
$out .= 'jQuery(".removedassigned").click(function() { jQuery(".removedassignedhidden").val(jQuery(this).val()); });'; |
2490
|
2490
|
$out .= 'jQuery(".assignedtouser").change(function() { console.log(jQuery(".assignedtouser option:selected").val());'; |
2491
|
|
- $out .= ' if (jQuery(".assignedtouser option:selected").val() > 0) { jQuery("#' . $action . 'assignedtouser").attr("disabled", false); }'; |
2492
|
|
- $out .= ' else { jQuery("#' . $action . 'assignedtouser").attr("disabled", true); }'; |
|
2491
|
+ $out .= ' if (jQuery(".assignedtouser option:selected").val() > 0) { jQuery("#'.$action.'assignedtouser").attr("disabled", false); }'; |
|
2492
|
+ $out .= ' else { jQuery("#'.$action.'assignedtouser").attr("disabled", true); }'; |
2493
|
2493
|
$out .= '});'; |
2494
|
2494
|
$out .= '})</script>'; |
2495
|
2495
|
$out .= $this->select_dolusers('', $htmlname, $show_empty, $exclude, $disabled, $include, $enableonly, $force_entity, $maxlength, $showstatus, $morefilter); |
2496
|
|
- $out .= ' <input type="submit" disabled class="button valignmiddle smallpaddingimp reposition" id="' . $action . 'assignedtouser" name="' . $action . 'assignedtouser" value="' . dol_escape_htmltag($langs->trans("Add")) . '">'; |
|
2496
|
+ $out .= ' <input type="submit" disabled class="button valignmiddle smallpaddingimp reposition" id="'.$action.'assignedtouser" name="'.$action.'assignedtouser" value="'.dol_escape_htmltag($langs->trans("Add")).'">'; |
2497
|
2497
|
$out .= '<br>'; |
2498
|
2498
|
} |
2499
|
2499
|
|
|
@@ -2552,13 +2552,13 @@ discard block |
|
|
block discarded – undo |
2552
|
2552
|
$resourcestatic->fetch($value['id']); |
2553
|
2553
|
$out .= $resourcestatic->getNomUrl(-1); |
2554
|
2554
|
if ($nbassignetoresource > 1 && $action != 'view') { |
2555
|
|
- $out .= ' <input type="image" style="border: 0px;" src="' . img_picto($langs->trans("Remove"), 'delete', '', 0, 1) . '" value="' . $resourcestatic->id . '" class="removedassigned reposition" id="removedassignedresource_' . $resourcestatic->id . '" name="removedassignedresource_' . $resourcestatic->id . '">'; |
|
2555
|
+ $out .= ' <input type="image" style="border: 0px;" src="'.img_picto($langs->trans("Remove"), 'delete', '', 0, 1).'" value="'.$resourcestatic->id.'" class="removedassigned reposition" id="removedassignedresource_'.$resourcestatic->id.'" name="removedassignedresource_'.$resourcestatic->id.'">'; |
2556
|
2556
|
} |
2557
|
2557
|
// Show my availability |
2558
|
2558
|
if ($showproperties) { |
2559
|
2559
|
if (is_array($listofresourceid) && count($listofresourceid)) { |
2560
|
2560
|
$out .= '<div class="myavailability inline-block">'; |
2561
|
|
- $out .= '<span class="hideonsmartphone"> - <span class="opacitymedium">' . $langs->trans("Availability") . ':</span> </span><input id="transparencyresource" class="paddingrightonly" ' . ($action == 'view' ? 'disabled' : '') . ' type="checkbox" name="transparency"' . ($listofresourceid[$value['id']]['transparency'] ? ' checked' : '') . '><label for="transparency">' . $langs->trans("Busy") . '</label>'; |
|
2561
|
+ $out .= '<span class="hideonsmartphone"> - <span class="opacitymedium">'.$langs->trans("Availability").':</span> </span><input id="transparencyresource" class="paddingrightonly" '.($action == 'view' ? 'disabled' : '').' type="checkbox" name="transparency"'.($listofresourceid[$value['id']]['transparency'] ? ' checked' : '').'><label for="transparency">'.$langs->trans("Busy").'</label>'; |
2562
|
2562
|
$out .= '</div>'; |
2563
|
2563
|
} |
2564
|
2564
|
} |
|
@@ -2575,11 +2575,11 @@ discard block |
|
|
block discarded – undo |
2575
|
2575
|
// Method with no ajax |
2576
|
2576
|
if ($action != 'view') { |
2577
|
2577
|
$out .= '<input type="hidden" class="removedassignedhidden" name="removedassignedresource" value="">'; |
2578
|
|
- $out .= '<script nonce="' . getNonce() . '" type="text/javascript">jQuery(document).ready(function () {'; |
|
2578
|
+ $out .= '<script nonce="'.getNonce().'" type="text/javascript">jQuery(document).ready(function () {'; |
2579
|
2579
|
$out .= 'jQuery(".removedassignedresource").click(function() { jQuery(".removedassignedresourcehidden").val(jQuery(this).val()); });'; |
2580
|
2580
|
$out .= 'jQuery(".assignedtoresource").change(function() { console.log(jQuery(".assignedtoresource option:selected").val());'; |
2581
|
|
- $out .= ' if (jQuery(".assignedtoresource option:selected").val() > 0) { jQuery("#' . $action . 'assignedtoresource").attr("disabled", false); }'; |
2582
|
|
- $out .= ' else { jQuery("#' . $action . 'assignedtoresource").attr("disabled", true); }'; |
|
2581
|
+ $out .= ' if (jQuery(".assignedtoresource option:selected").val() > 0) { jQuery("#'.$action.'assignedtoresource").attr("disabled", false); }'; |
|
2582
|
+ $out .= ' else { jQuery("#'.$action.'assignedtoresource").attr("disabled", true); }'; |
2583
|
2583
|
$out .= '});'; |
2584
|
2584
|
$out .= '})</script>'; |
2585
|
2585
|
|
|
@@ -2587,7 +2587,7 @@ discard block |
|
|
block discarded – undo |
2587
|
2587
|
$out .= img_picto('', 'resource', 'class="pictofixedwidth"'); |
2588
|
2588
|
$out .= $formresources->select_resource_list(0, $htmlname, [], 1, 1, 0, $events, array(), 2, 0); |
2589
|
2589
|
//$out .= $this->select_dolusers('', $htmlname, $show_empty, $exclude, $disabled, $include, $enableonly, $force_entity, $maxlength, $showstatus, $morefilter); |
2590
|
|
- $out .= ' <input type="submit" disabled class="button valignmiddle smallpaddingimp reposition" id="' . $action . 'assignedtoresource" name="' . $action . 'assignedtoresource" value="' . dol_escape_htmltag($langs->trans("Add")) . '">'; |
|
2590
|
+ $out .= ' <input type="submit" disabled class="button valignmiddle smallpaddingimp reposition" id="'.$action.'assignedtoresource" name="'.$action.'assignedtoresource" value="'.dol_escape_htmltag($langs->trans("Add")).'">'; |
2591
|
2591
|
$out .= '<br>'; |
2592
|
2592
|
} |
2593
|
2593
|
|
|
@@ -2651,7 +2651,7 @@ discard block |
|
|
block discarded – undo |
2651
|
2651
|
$placeholder = ''; |
2652
|
2652
|
|
2653
|
2653
|
if ($selected && empty($selected_input_value)) { |
2654
|
|
- require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; |
|
2654
|
+ require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; |
2655
|
2655
|
$producttmpselect = new Product($this->db); |
2656
|
2656
|
$producttmpselect->fetch($selected); |
2657
|
2657
|
$selected_input_value = $producttmpselect->ref; |
|
@@ -2666,20 +2666,20 @@ discard block |
|
|
block discarded – undo |
2666
|
2666
|
} |
2667
|
2667
|
} |
2668
|
2668
|
// mode=1 means customers products |
2669
|
|
- $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; |
2670
|
|
- if ((int) $warehouseId>0) { |
2671
|
|
- $urloption .= '&warehouseid=' . (int) $warehouseId; |
|
2669
|
+ $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; |
|
2670
|
+ if ((int) $warehouseId > 0) { |
|
2671
|
+ $urloption .= '&warehouseid='.(int) $warehouseId; |
2672
|
2672
|
} |
2673
|
|
- $out .= ajax_autocompleter((string) $selected, $htmlname, DOL_URL_ROOT . '/product/ajax/products.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions); |
|
2673
|
+ $out .= ajax_autocompleter((string) $selected, $htmlname, DOL_URL_ROOT.'/product/ajax/products.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions); |
2674
|
2674
|
|
2675
|
2675
|
if (isModEnabled('variants') && is_array($selected_combinations)) { |
2676
|
2676
|
// Code to automatically insert with javascript the select of attributes under the select of product |
2677
|
2677
|
// when a parent of variant has been selected. |
2678
|
2678
|
$out .= ' |
2679
|
2679
|
<!-- script to auto show attributes select tags if a variant was selected --> |
2680
|
|
- <script nonce="' . getNonce() . '"> |
|
2680
|
+ <script nonce="' . getNonce().'"> |
2681
|
2681
|
// auto show attributes fields |
2682
|
|
- selected = ' . json_encode($selected_combinations) . '; |
|
2682
|
+ selected = ' . json_encode($selected_combinations).'; |
2683
|
2683
|
combvalues = {}; |
2684
|
2684
|
|
2685
|
2685
|
jQuery(document).ready(function () { |
|
@@ -2690,7 +2690,7 @@ discard block |
|
|
block discarded – undo |
2690
|
2690
|
} |
2691
|
2691
|
}); |
2692
|
2692
|
|
2693
|
|
- jQuery("input#' . $htmlname . '").change(function () { |
|
2693
|
+ jQuery("input#' . $htmlname.'").change(function () { |
2694
|
2694
|
|
2695
|
2695
|
if (!jQuery(this).val()) { |
2696
|
2696
|
jQuery(\'div#attributes_box\').empty(); |
|
@@ -2699,7 +2699,7 @@ discard block |
|
|
block discarded – undo |
2699
|
2699
|
|
2700
|
2700
|
console.log("A change has started. We get variants fields to inject html select"); |
2701
|
2701
|
|
2702
|
|
- jQuery.getJSON("' . DOL_URL_ROOT . '/variants/ajax/getCombinations.php", { |
|
2702
|
+ jQuery.getJSON("' . DOL_URL_ROOT.'/variants/ajax/getCombinations.php", { |
2703
|
2703
|
id: jQuery(this).val() |
2704
|
2704
|
}, function (data) { |
2705
|
2705
|
jQuery(\'div#attributes_box\').empty(); |
|
@@ -2742,21 +2742,21 @@ discard block |
|
|
block discarded – undo |
2742
|
2742
|
}) |
2743
|
2743
|
}); |
2744
|
2744
|
|
2745
|
|
- ' . ($selected ? 'jQuery("input#' . $htmlname . '").change();' : '') . ' |
|
2745
|
+ ' . ($selected ? 'jQuery("input#'.$htmlname.'").change();' : '').' |
2746
|
2746
|
}); |
2747
|
2747
|
</script> |
2748
|
2748
|
'; |
2749
|
2749
|
} |
2750
|
2750
|
|
2751
|
2751
|
if (empty($hidelabel)) { |
2752
|
|
- $out .= $langs->trans("RefOrLabel") . ' : '; |
|
2752
|
+ $out .= $langs->trans("RefOrLabel").' : '; |
2753
|
2753
|
} elseif ($hidelabel > 1) { |
2754
|
|
- $placeholder = ' placeholder="' . $langs->trans("RefOrLabel") . '"'; |
|
2754
|
+ $placeholder = ' placeholder="'.$langs->trans("RefOrLabel").'"'; |
2755
|
2755
|
if ($hidelabel == 2) { |
2756
|
2756
|
$out .= img_picto($langs->trans("Search"), 'search'); |
2757
|
2757
|
} |
2758
|
2758
|
} |
2759
|
|
- $out .= '<input type="text" class="minwidth100' . ($morecss ? ' ' . $morecss : '') . '" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . $placeholder . ' ' . (getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '') . ' />'; |
|
2759
|
+ $out .= '<input type="text" class="minwidth100'.($morecss ? ' '.$morecss : '').'" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' '.(getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '').' />'; |
2760
|
2760
|
if ($hidelabel == 3) { |
2761
|
2761
|
$out .= img_picto($langs->trans("Search"), 'search'); |
2762
|
2762
|
} |
|
@@ -2793,33 +2793,33 @@ discard block |
|
|
block discarded – undo |
2793
|
2793
|
// phpcs:enable |
2794
|
2794
|
global $db; |
2795
|
2795
|
|
2796
|
|
- require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; |
|
2796
|
+ require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; |
2797
|
2797
|
|
2798
|
2798
|
$error = 0; |
2799
|
2799
|
$out = ''; |
2800
|
2800
|
|
2801
|
2801
|
if (!$forcecombo) { |
2802
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
2802
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
2803
|
2803
|
$events = array(); |
2804
|
2804
|
$out .= ajax_combobox($htmlname, $events, getDolGlobalInt("PRODUIT_USE_SEARCH_TO_SELECT")); |
2805
|
2805
|
} |
2806
|
2806
|
|
2807
|
|
- $out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">'; |
|
2807
|
+ $out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">'; |
2808
|
2808
|
|
2809
|
2809
|
$sql = 'SELECT b.rowid, b.ref, b.label, b.fk_product'; |
2810
|
|
- $sql .= ' FROM ' . MAIN_DB_PREFIX . 'bom_bom as b'; |
2811
|
|
- $sql .= ' WHERE b.entity IN (' . getEntity('bom') . ')'; |
|
2810
|
+ $sql .= ' FROM '.MAIN_DB_PREFIX.'bom_bom as b'; |
|
2811
|
+ $sql .= ' WHERE b.entity IN ('.getEntity('bom').')'; |
2812
|
2812
|
if (!empty($status)) { |
2813
|
|
- $sql .= ' AND status = ' . (int) $status; |
|
2813
|
+ $sql .= ' AND status = '.(int) $status; |
2814
|
2814
|
} |
2815
|
2815
|
if (!empty($type)) { |
2816
|
|
- $sql .= ' AND bomtype = ' . (int) $type; |
|
2816
|
+ $sql .= ' AND bomtype = '.(int) $type; |
2817
|
2817
|
} |
2818
|
2818
|
if (!empty($TProducts)) { |
2819
|
|
- $sql .= ' AND fk_product IN (' . $this->db->sanitize(implode(',', $TProducts)) . ')'; |
|
2819
|
+ $sql .= ' AND fk_product IN ('.$this->db->sanitize(implode(',', $TProducts)).')'; |
2820
|
2820
|
} |
2821
|
2821
|
if (!empty($limit)) { |
2822
|
|
- $sql .= ' LIMIT ' . (int) $limit; |
|
2822
|
+ $sql .= ' LIMIT '.(int) $limit; |
2823
|
2823
|
} |
2824
|
2824
|
$resql = $db->query($sql); |
2825
|
2825
|
if ($resql) { |
|
@@ -2833,11 +2833,11 @@ discard block |
|
|
block discarded – undo |
2833
|
2833
|
while ($obj = $db->fetch_object($resql)) { |
2834
|
2834
|
$product = new Product($db); |
2835
|
2835
|
$res = $product->fetch($obj->fk_product); |
2836
|
|
- $out .= '<option value="' . $obj->rowid . '"'; |
|
2836
|
+ $out .= '<option value="'.$obj->rowid.'"'; |
2837
|
2837
|
if ($obj->rowid == $selected) { |
2838
|
2838
|
$out .= 'selected'; |
2839
|
2839
|
} |
2840
|
|
- $out .= '>' . $obj->ref . ' - ' . $product->label . ' - ' . $obj->label . '</option>'; |
|
2840
|
+ $out .= '>'.$obj->ref.' - '.$product->label.' - '.$obj->label.'</option>'; |
2841
|
2841
|
} |
2842
|
2842
|
} else { |
2843
|
2843
|
$error++; |
|
@@ -2895,7 +2895,7 @@ discard block |
|
|
block discarded – undo |
2895
|
2895
|
|
2896
|
2896
|
$warehouseStatusArray = array(); |
2897
|
2897
|
if (!empty($warehouseStatus)) { |
2898
|
|
- require_once DOL_DOCUMENT_ROOT . '/product/stock/class/entrepot.class.php'; |
|
2898
|
+ require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php'; |
2899
|
2899
|
if (preg_match('/warehouseclosed/', $warehouseStatus)) { |
2900
|
2900
|
$warehouseStatusArray[] = Entrepot::STATUS_CLOSED; |
2901
|
2901
|
} |
|
@@ -2909,9 +2909,9 @@ discard block |
|
|
block discarded – undo |
2909
|
2909
|
|
2910
|
2910
|
$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"; |
2911
|
2911
|
if (count($warehouseStatusArray)) { |
2912
|
|
- $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 |
|
2912
|
+ $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 |
2913
|
2913
|
} else { |
2914
|
|
- $selectFieldsGrouped = ", " . $this->db->ifsql("p.stock IS NULL", 0, "p.stock") . " AS stock"; |
|
2914
|
+ $selectFieldsGrouped = ", ".$this->db->ifsql("p.stock IS NULL", 0, "p.stock")." AS stock"; |
2915
|
2915
|
} |
2916
|
2916
|
|
2917
|
2917
|
$sql = "SELECT "; |
|
@@ -2927,9 +2927,9 @@ discard block |
|
|
block discarded – undo |
2927
|
2927
|
|
2928
|
2928
|
if (getDolGlobalString('PRODUCT_SORT_BY_CATEGORY')) { |
2929
|
2929
|
//Product category |
2930
|
|
- $sql .= ", (SELECT " . $this->db->prefix() . "categorie_product.fk_categorie |
2931
|
|
- FROM " . $this->db->prefix() . "categorie_product |
2932
|
|
- WHERE " . $this->db->prefix() . "categorie_product.fk_product=p.rowid |
|
2930
|
+ $sql .= ", (SELECT ".$this->db->prefix()."categorie_product.fk_categorie |
|
2931
|
+ FROM " . $this->db->prefix()."categorie_product |
|
2932
|
+ WHERE " . $this->db->prefix()."categorie_product.fk_product=p.rowid |
2933
|
2933
|
LIMIT 1 |
2934
|
2934
|
) AS categorie_product_id "; |
2935
|
2935
|
} |
|
@@ -2955,15 +2955,15 @@ discard block |
|
|
block discarded – undo |
2955
|
2955
|
} |
2956
|
2956
|
// Price by quantity |
2957
|
2957
|
if (getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES')) { |
2958
|
|
- $sql .= ", (SELECT pp.rowid FROM " . $this->db->prefix() . "product_price as pp WHERE pp.fk_product = p.rowid"; |
|
2958
|
+ $sql .= ", (SELECT pp.rowid FROM ".$this->db->prefix()."product_price as pp WHERE pp.fk_product = p.rowid"; |
2959
|
2959
|
if ($price_level >= 1 && getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES')) { |
2960
|
|
- $sql .= " AND price_level = " . ((int) $price_level); |
|
2960
|
+ $sql .= " AND price_level = ".((int) $price_level); |
2961
|
2961
|
} |
2962
|
2962
|
$sql .= " ORDER BY date_price"; |
2963
|
2963
|
$sql .= " DESC LIMIT 1) as price_rowid"; |
2964
|
|
- $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 |
|
2964
|
+ $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 |
2965
|
2965
|
if ($price_level >= 1 && getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES')) { |
2966
|
|
- $sql .= " AND price_level = " . ((int) $price_level); |
|
2966
|
+ $sql .= " AND price_level = ".((int) $price_level); |
2967
|
2967
|
} |
2968
|
2968
|
$sql .= " ORDER BY date_price"; |
2969
|
2969
|
$sql .= " DESC LIMIT 1) as price_by_qty"; |
|
@@ -2973,7 +2973,7 @@ discard block |
|
|
block discarded – undo |
2973
|
2973
|
$sql .= " FROM ".$this->db->prefix()."product as p"; |
2974
|
2974
|
|
2975
|
2975
|
if (getDolGlobalString('MAIN_SEARCH_PRODUCT_FORCE_INDEX')) { |
2976
|
|
- $sql .= " USE INDEX (" . $this->db->sanitize(getDolGlobalString('MAIN_PRODUCT_FORCE_INDEX')) . ")"; |
|
2976
|
+ $sql .= " USE INDEX (".$this->db->sanitize(getDolGlobalString('MAIN_PRODUCT_FORCE_INDEX')).")"; |
2977
|
2977
|
} |
2978
|
2978
|
|
2979
|
2979
|
// Add from (left join) from hooks |
|
@@ -2982,53 +2982,53 @@ discard block |
|
|
block discarded – undo |
2982
|
2982
|
$sql .= $hookmanager->resPrint; |
2983
|
2983
|
|
2984
|
2984
|
if (count($warehouseStatusArray)) { |
2985
|
|
- $sql .= " LEFT JOIN " . $this->db->prefix() . "product_stock as ps on ps.fk_product = p.rowid"; |
2986
|
|
- $sql .= " LEFT JOIN " . $this->db->prefix() . "entrepot as e on ps.fk_entrepot = e.rowid AND e.entity IN (" . getEntity('stock') . ")"; |
2987
|
|
- $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. |
|
2985
|
+ $sql .= " LEFT JOIN ".$this->db->prefix()."product_stock as ps on ps.fk_product = p.rowid"; |
|
2986
|
+ $sql .= " LEFT JOIN ".$this->db->prefix()."entrepot as e on ps.fk_entrepot = e.rowid AND e.entity IN (".getEntity('stock').")"; |
|
2987
|
+ $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. |
2988
|
2988
|
} |
2989
|
2989
|
|
2990
|
2990
|
// include search in supplier ref |
2991
|
2991
|
if (getDolGlobalString('MAIN_SEARCH_PRODUCT_BY_FOURN_REF')) { |
2992
|
|
- $sql .= " LEFT JOIN " . $this->db->prefix() . "product_fournisseur_price as pfp ON p.rowid = pfp.fk_product"; |
|
2992
|
+ $sql .= " LEFT JOIN ".$this->db->prefix()."product_fournisseur_price as pfp ON p.rowid = pfp.fk_product"; |
2993
|
2993
|
} |
2994
|
2994
|
|
2995
|
2995
|
//Price by customer |
2996
|
2996
|
if (getDolGlobalString('PRODUIT_CUSTOMER_PRICES') && !empty($socid)) { |
2997
|
|
- $sql .= " LEFT JOIN " . $this->db->prefix() . "product_customer_price as pcp ON pcp.fk_soc=" . ((int) $socid) . " AND pcp.fk_product=p.rowid"; |
|
2997
|
+ $sql .= " LEFT JOIN ".$this->db->prefix()."product_customer_price as pcp ON pcp.fk_soc=".((int) $socid)." AND pcp.fk_product=p.rowid"; |
2998
|
2998
|
} |
2999
|
2999
|
// Units |
3000
|
3000
|
if (getDolGlobalInt('PRODUCT_USE_UNITS')) { |
3001
|
|
- $sql .= " LEFT JOIN " . $this->db->prefix() . "c_units u ON u.rowid = p.fk_unit"; |
|
3001
|
+ $sql .= " LEFT JOIN ".$this->db->prefix()."c_units u ON u.rowid = p.fk_unit"; |
3002
|
3002
|
} |
3003
|
3003
|
// Multilang : we add translation |
3004
|
3004
|
if (getDolGlobalInt('MAIN_MULTILANGS')) { |
3005
|
|
- $sql .= " LEFT JOIN " . $this->db->prefix() . "product_lang as pl ON pl.fk_product = p.rowid "; |
|
3005
|
+ $sql .= " LEFT JOIN ".$this->db->prefix()."product_lang as pl ON pl.fk_product = p.rowid "; |
3006
|
3006
|
if (getDolGlobalString('PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE') && !empty($socid)) { |
3007
|
|
- require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; |
|
3007
|
+ require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; |
3008
|
3008
|
$soc = new Societe($this->db); |
3009
|
3009
|
$result = $soc->fetch($socid); |
3010
|
3010
|
if ($result > 0 && !empty($soc->default_lang)) { |
3011
|
|
- $sql .= " AND pl.lang = '" . $this->db->escape($soc->default_lang) . "'"; |
|
3011
|
+ $sql .= " AND pl.lang = '".$this->db->escape($soc->default_lang)."'"; |
3012
|
3012
|
} else { |
3013
|
|
- $sql .= " AND pl.lang = '" . $this->db->escape($langs->getDefaultLang()) . "'"; |
|
3013
|
+ $sql .= " AND pl.lang = '".$this->db->escape($langs->getDefaultLang())."'"; |
3014
|
3014
|
} |
3015
|
3015
|
} else { |
3016
|
|
- $sql .= " AND pl.lang = '" . $this->db->escape($langs->getDefaultLang()) . "'"; |
|
3016
|
+ $sql .= " AND pl.lang = '".$this->db->escape($langs->getDefaultLang())."'"; |
3017
|
3017
|
} |
3018
|
3018
|
} |
3019
|
3019
|
|
3020
|
3020
|
if (getDolGlobalString('PRODUIT_ATTRIBUTES_HIDECHILD')) { |
3021
|
|
- $sql .= " LEFT JOIN " . $this->db->prefix() . "product_attribute_combination pac ON pac.fk_product_child = p.rowid"; |
|
3021
|
+ $sql .= " LEFT JOIN ".$this->db->prefix()."product_attribute_combination pac ON pac.fk_product_child = p.rowid"; |
3022
|
3022
|
} |
3023
|
3023
|
|
3024
|
|
- $sql .= ' WHERE p.entity IN (' . getEntity('product') . ')'; |
|
3024
|
+ $sql .= ' WHERE p.entity IN ('.getEntity('product').')'; |
3025
|
3025
|
|
3026
|
3026
|
if (getDolGlobalString('PRODUIT_ATTRIBUTES_HIDECHILD')) { |
3027
|
3027
|
$sql .= " AND pac.rowid IS NULL"; |
3028
|
3028
|
} |
3029
|
3029
|
|
3030
|
3030
|
if ($finished == 0) { |
3031
|
|
- $sql .= " AND p.finished = " . ((int) $finished); |
|
3031
|
+ $sql .= " AND p.finished = ".((int) $finished); |
3032
|
3032
|
} elseif ($finished == 1) { |
3033
|
3033
|
$sql .= " AND p.finished = ".((int) $finished); |
3034
|
3034
|
} |
|
@@ -3036,11 +3036,11 @@ discard block |
|
|
block discarded – undo |
3036
|
3036
|
$sql .= " AND p.tosell = ".((int) $status); |
3037
|
3037
|
} |
3038
|
3038
|
if ($status_purchase >= 0) { |
3039
|
|
- $sql .= " AND p.tobuy = " . ((int) $status_purchase); |
|
3039
|
+ $sql .= " AND p.tobuy = ".((int) $status_purchase); |
3040
|
3040
|
} |
3041
|
3041
|
// Filter by product type |
3042
|
3042
|
if (strval($filtertype) != '') { |
3043
|
|
- $sql .= " AND p.fk_product_type = " . ((int) $filtertype); |
|
3043
|
+ $sql .= " AND p.fk_product_type = ".((int) $filtertype); |
3044
|
3044
|
} elseif (!isModEnabled('product')) { // when product module is disabled, show services only |
3045
|
3045
|
$sql .= " AND p.fk_product_type = 1"; |
3046
|
3046
|
} elseif (!isModEnabled('service')) { // when service module is disabled, show products only |
|
@@ -3048,7 +3048,7 @@ discard block |
|
|
block discarded – undo |
3048
|
3048
|
} |
3049
|
3049
|
|
3050
|
3050
|
if ((int) $warehouseId > 0) { |
3051
|
|
- $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)"; |
|
3051
|
+ $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)"; |
3052
|
3052
|
} |
3053
|
3053
|
|
3054
|
3054
|
// Add where from hooks |
|
@@ -3069,21 +3069,21 @@ discard block |
|
|
block discarded – undo |
3069
|
3069
|
if ($i > 0) { |
3070
|
3070
|
$sql .= " AND "; |
3071
|
3071
|
} |
3072
|
|
- $sql .= "(p.ref LIKE '" . $this->db->escape($prefix . $crit) . "%' OR p.label LIKE '" . $this->db->escape($prefix . $crit) . "%'"; |
|
3072
|
+ $sql .= "(p.ref LIKE '".$this->db->escape($prefix.$crit)."%' OR p.label LIKE '".$this->db->escape($prefix.$crit)."%'"; |
3073
|
3073
|
if (getDolGlobalInt('MAIN_MULTILANGS')) { |
3074
|
|
- $sql .= " OR pl.label LIKE '" . $this->db->escape($prefix . $crit) . "%'"; |
|
3074
|
+ $sql .= " OR pl.label LIKE '".$this->db->escape($prefix.$crit)."%'"; |
3075
|
3075
|
} |
3076
|
3076
|
if (getDolGlobalString('PRODUIT_CUSTOMER_PRICES') && !empty($socid)) { |
3077
|
|
- $sql .= " OR pcp.ref_customer LIKE '" . $this->db->escape($prefix . $crit) . "%'"; |
|
3077
|
+ $sql .= " OR pcp.ref_customer LIKE '".$this->db->escape($prefix.$crit)."%'"; |
3078
|
3078
|
} |
3079
|
3079
|
if (getDolGlobalString('PRODUCT_AJAX_SEARCH_ON_DESCRIPTION')) { |
3080
|
|
- $sql .= " OR p.description LIKE '" . $this->db->escape($prefix . $crit) . "%'"; |
|
3080
|
+ $sql .= " OR p.description LIKE '".$this->db->escape($prefix.$crit)."%'"; |
3081
|
3081
|
if (getDolGlobalInt('MAIN_MULTILANGS')) { |
3082
|
|
- $sql .= " OR pl.description LIKE '" . $this->db->escape($prefix . $crit) . "%'"; |
|
3082
|
+ $sql .= " OR pl.description LIKE '".$this->db->escape($prefix.$crit)."%'"; |
3083
|
3083
|
} |
3084
|
3084
|
} |
3085
|
3085
|
if (getDolGlobalString('MAIN_SEARCH_PRODUCT_BY_FOURN_REF')) { |
3086
|
|
- $sql .= " OR pfp.ref_fourn LIKE '" . $this->db->escape($prefix . $crit) . "%'"; |
|
3086
|
+ $sql .= " OR pfp.ref_fourn LIKE '".$this->db->escape($prefix.$crit)."%'"; |
3087
|
3087
|
} |
3088
|
3088
|
$sql .= ")"; |
3089
|
3089
|
$i++; |
|
@@ -3092,12 +3092,12 @@ discard block |
|
|
block discarded – undo |
3092
|
3092
|
$sql .= ")"; |
3093
|
3093
|
} |
3094
|
3094
|
if (isModEnabled('barcode')) { |
3095
|
|
- $sql .= " OR p.barcode LIKE '" . $this->db->escape($prefix . $filterkey) . "%'"; |
|
3095
|
+ $sql .= " OR p.barcode LIKE '".$this->db->escape($prefix.$filterkey)."%'"; |
3096
|
3096
|
} |
3097
|
3097
|
$sql .= ')'; |
3098
|
3098
|
} |
3099
|
3099
|
if (count($warehouseStatusArray)) { |
3100
|
|
- $sql .= " GROUP BY " . $selectFields; |
|
3100
|
+ $sql .= " GROUP BY ".$selectFields; |
3101
|
3101
|
} |
3102
|
3102
|
|
3103
|
3103
|
//Sort by category |
|
@@ -3112,23 +3112,23 @@ discard block |
|
|
block discarded – undo |
3112
|
3112
|
$sql .= $this->db->plimit($limit, 0); |
3113
|
3113
|
|
3114
|
3114
|
// Build output string |
3115
|
|
- dol_syslog(get_class($this) . "::select_produits_list search products", LOG_DEBUG); |
|
3115
|
+ dol_syslog(get_class($this)."::select_produits_list search products", LOG_DEBUG); |
3116
|
3116
|
$result = $this->db->query($sql); |
3117
|
3117
|
if ($result) { |
3118
|
|
- require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; |
3119
|
|
- require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php'; |
3120
|
|
- require_once DOL_DOCUMENT_ROOT . '/core/lib/product.lib.php'; |
|
3118
|
+ require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; |
|
3119
|
+ require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php'; |
|
3120
|
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php'; |
3121
|
3121
|
|
3122
|
3122
|
$num = $this->db->num_rows($result); |
3123
|
3123
|
|
3124
|
3124
|
$events = array(); |
3125
|
3125
|
|
3126
|
3126
|
if (!$forcecombo) { |
3127
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
3127
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
3128
|
3128
|
$out .= ajax_combobox($htmlname, $events, getDolGlobalInt("PRODUIT_USE_SEARCH_TO_SELECT")); |
3129
|
3129
|
} |
3130
|
3130
|
|
3131
|
|
- $out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">'; |
|
3131
|
+ $out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">'; |
3132
|
3132
|
|
3133
|
3133
|
$textifempty = ''; |
3134
|
3134
|
// Do not use textifempty = ' ' or ' ' here, or search on key will search on ' key'. |
|
@@ -3145,7 +3145,7 @@ discard block |
|
|
block discarded – undo |
3145
|
3145
|
} |
3146
|
3146
|
} |
3147
|
3147
|
if ($showempty) { |
3148
|
|
- $out .= '<option value="-1" selected>' . ($textifempty ? $textifempty : ' ') . '</option>'; |
|
3148
|
+ $out .= '<option value="-1" selected>'.($textifempty ? $textifempty : ' ').'</option>'; |
3149
|
3149
|
} |
3150
|
3150
|
|
3151
|
3151
|
$i = 0; |
|
@@ -3156,11 +3156,11 @@ discard block |
|
|
block discarded – undo |
3156
|
3156
|
|
3157
|
3157
|
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 |
3158
|
3158
|
$sql = "SELECT rowid, quantity, price, unitprice, remise_percent, remise, price_base_type"; |
3159
|
|
- $sql .= " FROM " . $this->db->prefix() . "product_price_by_qty"; |
3160
|
|
- $sql .= " WHERE fk_product_price = " . ((int) $objp->price_rowid); |
|
3159
|
+ $sql .= " FROM ".$this->db->prefix()."product_price_by_qty"; |
|
3160
|
+ $sql .= " WHERE fk_product_price = ".((int) $objp->price_rowid); |
3161
|
3161
|
$sql .= " ORDER BY quantity ASC"; |
3162
|
3162
|
|
3163
|
|
- dol_syslog(get_class($this) . "::select_produits_list search prices by qty", LOG_DEBUG); |
|
3163
|
+ dol_syslog(get_class($this)."::select_produits_list search prices by qty", LOG_DEBUG); |
3164
|
3164
|
$result2 = $this->db->query($sql); |
3165
|
3165
|
if ($result2) { |
3166
|
3166
|
$nb_prices = $this->db->num_rows($result2); |
|
@@ -3198,7 +3198,7 @@ discard block |
|
|
block discarded – undo |
3198
|
3198
|
$price_product = new Product($this->db); |
3199
|
3199
|
$price_product->fetch($objp->rowid, '', '', 1); |
3200
|
3200
|
|
3201
|
|
- require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php'; |
|
3201
|
+ require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php'; |
3202
|
3202
|
$priceparser = new PriceParser($this->db); |
3203
|
3203
|
$price_result = $priceparser->parseProduct($price_product); |
3204
|
3204
|
if ($price_result >= 0) { |
|
@@ -3282,7 +3282,7 @@ discard block |
|
|
block discarded – undo |
3282
|
3282
|
$label = $objp->label_translated; |
3283
|
3283
|
} |
3284
|
3284
|
if (!empty($filterkey) && $filterkey != '') { |
3285
|
|
- $label = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $label, 1); |
|
3285
|
+ $label = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $label, 1); |
3286
|
3286
|
} |
3287
|
3287
|
|
3288
|
3288
|
$outkey = $objp->rowid; |
|
@@ -3303,32 +3303,32 @@ discard block |
|
|
block discarded – undo |
3303
|
3303
|
$outdurationunit = $outtype == Product::TYPE_SERVICE ? substr($objp->duration, -1) : ''; |
3304
|
3304
|
|
3305
|
3305
|
if ($outorigin && getDolGlobalString('PRODUCT_SHOW_ORIGIN_IN_COMBO')) { |
3306
|
|
- require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php'; |
|
3306
|
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; |
3307
|
3307
|
} |
3308
|
3308
|
|
3309
|
3309
|
// Units |
3310
|
3310
|
$outvalUnits = ''; |
3311
|
3311
|
if (getDolGlobalInt('PRODUCT_USE_UNITS')) { |
3312
|
3312
|
if (!empty($objp->unit_short)) { |
3313
|
|
- $outvalUnits .= ' - ' . $objp->unit_short; |
|
3313
|
+ $outvalUnits .= ' - '.$objp->unit_short; |
3314
|
3314
|
} |
3315
|
3315
|
} |
3316
|
3316
|
if (getDolGlobalString('PRODUCT_SHOW_DIMENSIONS_IN_COMBO')) { |
3317
|
3317
|
if (!empty($objp->weight) && $objp->weight_units !== null) { |
3318
|
3318
|
$unitToShow = showDimensionInBestUnit($objp->weight, $objp->weight_units, 'weight', $langs); |
3319
|
|
- $outvalUnits .= ' - ' . $unitToShow; |
|
3319
|
+ $outvalUnits .= ' - '.$unitToShow; |
3320
|
3320
|
} |
3321
|
3321
|
if ((!empty($objp->length) || !empty($objp->width) || !empty($objp->height)) && $objp->length_units !== null) { |
3322
|
|
- $unitToShow = $objp->length . ' x ' . $objp->width . ' x ' . $objp->height . ' ' . measuringUnitString(0, 'size', $objp->length_units); |
3323
|
|
- $outvalUnits .= ' - ' . $unitToShow; |
|
3322
|
+ $unitToShow = $objp->length.' x '.$objp->width.' x '.$objp->height.' '.measuringUnitString(0, 'size', $objp->length_units); |
|
3323
|
+ $outvalUnits .= ' - '.$unitToShow; |
3324
|
3324
|
} |
3325
|
3325
|
if (!empty($objp->surface) && $objp->surface_units !== null) { |
3326
|
3326
|
$unitToShow = showDimensionInBestUnit($objp->surface, $objp->surface_units, 'surface', $langs); |
3327
|
|
- $outvalUnits .= ' - ' . $unitToShow; |
|
3327
|
+ $outvalUnits .= ' - '.$unitToShow; |
3328
|
3328
|
} |
3329
|
3329
|
if (!empty($objp->volume) && $objp->volume_units !== null) { |
3330
|
3330
|
$unitToShow = showDimensionInBestUnit($objp->volume, $objp->volume_units, 'volume', $langs); |
3331
|
|
- $outvalUnits .= ' - ' . $unitToShow; |
|
3331
|
+ $outvalUnits .= ' - '.$unitToShow; |
3332
|
3332
|
} |
3333
|
3333
|
} |
3334
|
3334
|
if ($outdurationvalue && $outdurationunit) { |
|
@@ -3340,7 +3340,7 @@ discard block |
|
|
block discarded – undo |
3340
|
3340
|
'y' => $langs->trans('Year') |
3341
|
3341
|
); |
3342
|
3342
|
if (isset($da[$outdurationunit])) { |
3343
|
|
- $outvalUnits .= ' - ' . $outdurationvalue . ' ' . $langs->transnoentities($da[$outdurationunit] . ($outdurationvalue > 1 ? 's' : '')); |
|
3343
|
+ $outvalUnits .= ' - '.$outdurationvalue.' '.$langs->transnoentities($da[$outdurationunit].($outdurationvalue > 1 ? 's' : '')); |
3344
|
3344
|
} |
3345
|
3345
|
} |
3346
|
3346
|
|
|
@@ -3360,31 +3360,31 @@ discard block |
|
|
block discarded – undo |
3360
|
3360
|
$labeltoshow = ''; |
3361
|
3361
|
$labeltoshow .= $objp->ref; |
3362
|
3362
|
if (!empty($objp->custref)) { |
3363
|
|
- $labeltoshow .= ' (' . $objp->custref . ')'; |
|
3363
|
+ $labeltoshow .= ' ('.$objp->custref.')'; |
3364
|
3364
|
} |
3365
|
3365
|
if ($outbarcode) { |
3366
|
|
- $labeltoshow .= ' (' . $outbarcode . ')'; |
|
3366
|
+ $labeltoshow .= ' ('.$outbarcode.')'; |
3367
|
3367
|
} |
3368
|
|
- $labeltoshow .= ' - ' . dol_trunc($label, $maxlengtharticle); |
|
3368
|
+ $labeltoshow .= ' - '.dol_trunc($label, $maxlengtharticle); |
3369
|
3369
|
if ($outorigin && getDolGlobalString('PRODUCT_SHOW_ORIGIN_IN_COMBO')) { |
3370
|
|
- $labeltoshow .= ' (' . getCountry($outorigin, '1') . ')'; |
|
3370
|
+ $labeltoshow .= ' ('.getCountry($outorigin, '1').')'; |
3371
|
3371
|
} |
3372
|
3372
|
|
3373
|
3373
|
// Set $labltoshowhtml |
3374
|
3374
|
$labeltoshowhtml = ''; |
3375
|
3375
|
$labeltoshowhtml .= $objp->ref; |
3376
|
3376
|
if (!empty($objp->custref)) { |
3377
|
|
- $labeltoshowhtml .= ' (' . $objp->custref . ')'; |
|
3377
|
+ $labeltoshowhtml .= ' ('.$objp->custref.')'; |
3378
|
3378
|
} |
3379
|
3379
|
if (!empty($filterkey) && $filterkey != '') { |
3380
|
|
- $labeltoshowhtml = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $labeltoshowhtml, 1); |
|
3380
|
+ $labeltoshowhtml = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $labeltoshowhtml, 1); |
3381
|
3381
|
} |
3382
|
3382
|
if ($outbarcode) { |
3383
|
|
- $labeltoshowhtml .= ' (' . $outbarcode . ')'; |
|
3383
|
+ $labeltoshowhtml .= ' ('.$outbarcode.')'; |
3384
|
3384
|
} |
3385
|
|
- $labeltoshowhtml .= ' - ' . dol_trunc($label, $maxlengtharticle); |
|
3385
|
+ $labeltoshowhtml .= ' - '.dol_trunc($label, $maxlengtharticle); |
3386
|
3386
|
if ($outorigin && getDolGlobalString('PRODUCT_SHOW_ORIGIN_IN_COMBO')) { |
3387
|
|
- $labeltoshowhtml .= ' (' . getCountry($outorigin, '1') . ')'; |
|
3387
|
+ $labeltoshowhtml .= ' ('.getCountry($outorigin, '1').')'; |
3388
|
3388
|
} |
3389
|
3389
|
|
3390
|
3390
|
// Stock |
|
@@ -3392,14 +3392,14 @@ discard block |
|
|
block discarded – undo |
3392
|
3392
|
$labeltoshowhtmlstock = ''; |
3393
|
3393
|
if (isModEnabled('stock') && isset($objp->stock) && ($objp->fk_product_type == Product::TYPE_PRODUCT || getDolGlobalString('STOCK_SUPPORTS_SERVICES'))) { |
3394
|
3394
|
if ($user->hasRight('stock', 'lire')) { |
3395
|
|
- $labeltoshowstock .= ' - ' . $langs->trans("Stock") . ': ' . price(price2num($objp->stock, 'MS')); |
|
3395
|
+ $labeltoshowstock .= ' - '.$langs->trans("Stock").': '.price(price2num($objp->stock, 'MS')); |
3396
|
3396
|
|
3397
|
3397
|
if ($objp->stock > 0) { |
3398
|
3398
|
$labeltoshowhtmlstock .= ' - <span class="product_line_stock_ok">'; |
3399
|
3399
|
} elseif ($objp->stock <= 0) { |
3400
|
3400
|
$labeltoshowhtmlstock .= ' - <span class="product_line_stock_too_low">'; |
3401
|
3401
|
} |
3402
|
|
- $labeltoshowhtmlstock .= $langs->transnoentities("Stock") . ': ' . price(price2num($objp->stock, 'MS')); |
|
3402
|
+ $labeltoshowhtmlstock .= $langs->transnoentities("Stock").': '.price(price2num($objp->stock, 'MS')); |
3403
|
3403
|
$labeltoshowhtmlstock .= '</span>'; |
3404
|
3404
|
|
3405
|
3405
|
if (empty($novirtualstock) && getDolGlobalString('STOCK_SHOW_VIRTUAL_STOCK_IN_PRODUCTS_COMBO')) { // Warning, this option may slow down combo list generation |
|
@@ -3410,9 +3410,9 @@ discard block |
|
|
block discarded – undo |
3410
|
3410
|
$tmpproduct->load_virtual_stock(); |
3411
|
3411
|
$virtualstock = $tmpproduct->stock_theorique; |
3412
|
3412
|
|
3413
|
|
- $labeltoshowstock .= ' - ' . $langs->trans("VirtualStock") . ':' . $virtualstock; |
|
3413
|
+ $labeltoshowstock .= ' - '.$langs->trans("VirtualStock").':'.$virtualstock; |
3414
|
3414
|
|
3415
|
|
- $labeltoshowhtmlstock .= ' - ' . $langs->transnoentities("VirtualStock") . ':'; |
|
3415
|
+ $labeltoshowhtmlstock .= ' - '.$langs->transnoentities("VirtualStock").':'; |
3416
|
3416
|
if ($virtualstock > 0) { |
3417
|
3417
|
$labeltoshowhtmlstock .= '<span class="product_line_stock_ok">'; |
3418
|
3418
|
} elseif ($virtualstock <= 0) { |
|
@@ -3433,35 +3433,35 @@ discard block |
|
|
block discarded – undo |
3433
|
3433
|
// If we need a particular price level (from 1 to n) |
3434
|
3434
|
if (empty($hidepriceinlabel) && $price_level >= 1 && (getDolGlobalString('PRODUIT_MULTIPRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES'))) { |
3435
|
3435
|
$sql = "SELECT price, price_ttc, price_base_type, tva_tx, default_vat_code"; |
3436
|
|
- $sql .= " FROM " . $this->db->prefix() . "product_price"; |
3437
|
|
- $sql .= " WHERE fk_product = " . ((int) $objp->rowid); |
3438
|
|
- $sql .= " AND entity IN (" . getEntity('productprice') . ")"; |
3439
|
|
- $sql .= " AND price_level = " . ((int) $price_level); |
|
3436
|
+ $sql .= " FROM ".$this->db->prefix()."product_price"; |
|
3437
|
+ $sql .= " WHERE fk_product = ".((int) $objp->rowid); |
|
3438
|
+ $sql .= " AND entity IN (".getEntity('productprice').")"; |
|
3439
|
+ $sql .= " AND price_level = ".((int) $price_level); |
3440
|
3440
|
$sql .= " ORDER BY date_price DESC, rowid DESC"; // Warning DESC must be both on date_price and rowid. |
3441
|
3441
|
$sql .= " LIMIT 1"; |
3442
|
3442
|
|
3443
|
|
- dol_syslog(get_class($this) . '::constructProductListOption search price for product ' . $objp->rowid . ' AND level ' . $price_level, LOG_DEBUG); |
|
3443
|
+ dol_syslog(get_class($this).'::constructProductListOption search price for product '.$objp->rowid.' AND level '.$price_level, LOG_DEBUG); |
3444
|
3444
|
$result2 = $this->db->query($sql); |
3445
|
3445
|
if ($result2) { |
3446
|
3446
|
$objp2 = $this->db->fetch_object($result2); |
3447
|
3447
|
if ($objp2) { |
3448
|
3448
|
$found = 1; |
3449
|
3449
|
if ($objp2->price_base_type == 'HT') { |
3450
|
|
- $labeltoshowprice .= ' - ' . price($objp2->price, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("HT"); |
3451
|
|
- $labeltoshowhtmlprice .= ' - ' . price($objp2->price, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("HT"); |
|
3450
|
+ $labeltoshowprice .= ' - '.price($objp2->price, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("HT"); |
|
3451
|
+ $labeltoshowhtmlprice .= ' - '.price($objp2->price, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("HT"); |
3452
|
3452
|
} else { |
3453
|
|
- $labeltoshowprice .= ' - ' . price($objp2->price_ttc, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("TTC"); |
3454
|
|
- $labeltoshowhtmlprice .= ' - ' . price($objp2->price_ttc, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("TTC"); |
|
3453
|
+ $labeltoshowprice .= ' - '.price($objp2->price_ttc, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("TTC"); |
|
3454
|
+ $labeltoshowhtmlprice .= ' - '.price($objp2->price_ttc, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("TTC"); |
3455
|
3455
|
} |
3456
|
3456
|
$outprice_ht = price($objp2->price); |
3457
|
3457
|
$outprice_ttc = price($objp2->price_ttc); |
3458
|
3458
|
$outpricebasetype = $objp2->price_base_type; |
3459
|
3459
|
if (getDolGlobalString('PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL')) { // using this option is a bug. kept for backward compatibility |
3460
|
|
- $outtva_tx = $objp2->tva_tx; // We use the vat rate on line of multiprice |
3461
|
|
- $outdefault_vat_code = $objp2->default_vat_code; // We use the vat code on line of multiprice |
|
3460
|
+ $outtva_tx = $objp2->tva_tx; // We use the vat rate on line of multiprice |
|
3461
|
+ $outdefault_vat_code = $objp2->default_vat_code; // We use the vat code on line of multiprice |
3462
|
3462
|
} else { |
3463
|
|
- $outtva_tx = $objp->tva_tx; // We use the vat rate of product, not the one on line of multiprice |
3464
|
|
- $outdefault_vat_code = $objp->default_vat_code; // We use the vat code or product, not the one on line of multiprice |
|
3463
|
+ $outtva_tx = $objp->tva_tx; // We use the vat rate of product, not the one on line of multiprice |
|
3464
|
+ $outdefault_vat_code = $objp->default_vat_code; // We use the vat code or product, not the one on line of multiprice |
3465
|
3465
|
} |
3466
|
3466
|
} |
3467
|
3467
|
} else { |
|
@@ -3475,13 +3475,13 @@ discard block |
|
|
block discarded – undo |
3475
|
3475
|
$outqty = $objp->quantity; |
3476
|
3476
|
$outdiscount = $objp->remise_percent; |
3477
|
3477
|
if ($objp->quantity == 1) { |
3478
|
|
- $labeltoshowprice .= ' - ' . price($objp->unitprice, 1, $langs, 0, 0, -1, $conf->currency) . "/"; |
3479
|
|
- $labeltoshowhtmlprice .= ' - ' . price($objp->unitprice, 0, $langs, 0, 0, -1, $conf->currency) . "/"; |
|
3478
|
+ $labeltoshowprice .= ' - '.price($objp->unitprice, 1, $langs, 0, 0, -1, $conf->currency)."/"; |
|
3479
|
+ $labeltoshowhtmlprice .= ' - '.price($objp->unitprice, 0, $langs, 0, 0, -1, $conf->currency)."/"; |
3480
|
3480
|
$labeltoshowprice .= $langs->trans("Unit"); // Do not use strtolower because it breaks utf8 encoding |
3481
|
3481
|
$labeltoshowhtmlprice .= $langs->transnoentities("Unit"); |
3482
|
3482
|
} else { |
3483
|
|
- $labeltoshowprice .= ' - ' . price($objp->price, 1, $langs, 0, 0, -1, $conf->currency) . "/" . $objp->quantity; |
3484
|
|
- $labeltoshowhtmlprice .= ' - ' . price($objp->price, 0, $langs, 0, 0, -1, $conf->currency) . "/" . $objp->quantity; |
|
3483
|
+ $labeltoshowprice .= ' - '.price($objp->price, 1, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity; |
|
3484
|
+ $labeltoshowhtmlprice .= ' - '.price($objp->price, 0, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity; |
3485
|
3485
|
$labeltoshowprice .= $langs->trans("Units"); // Do not use strtolower because it breaks utf8 encoding |
3486
|
3486
|
$labeltoshowhtmlprice .= $langs->transnoentities("Units"); |
3487
|
3487
|
} |
|
@@ -3489,16 +3489,16 @@ discard block |
|
|
block discarded – undo |
3489
|
3489
|
$outprice_ht = price($objp->unitprice); |
3490
|
3490
|
$outprice_ttc = price($objp->unitprice * (1 + ($objp->tva_tx / 100))); |
3491
|
3491
|
$outpricebasetype = $objp->price_base_type; |
3492
|
|
- $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 |
3493
|
|
- $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 |
|
3492
|
+ $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 |
|
3493
|
+ $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 |
3494
|
3494
|
} |
3495
|
3495
|
if (empty($hidepriceinlabel) && !empty($objp->quantity) && $objp->quantity >= 1) { |
3496
|
|
- $labeltoshowprice .= " (" . price($objp->unitprice, 1, $langs, 0, 0, -1, $conf->currency) . "/" . $langs->trans("Unit") . ")"; // Do not use strtolower because it breaks utf8 encoding |
3497
|
|
- $labeltoshowhtmlprice .= " (" . price($objp->unitprice, 0, $langs, 0, 0, -1, $conf->currency) . "/" . $langs->transnoentities("Unit") . ")"; // Do not use strtolower because it breaks utf8 encoding |
|
3496
|
+ $labeltoshowprice .= " (".price($objp->unitprice, 1, $langs, 0, 0, -1, $conf->currency)."/".$langs->trans("Unit").")"; // Do not use strtolower because it breaks utf8 encoding |
|
3497
|
+ $labeltoshowhtmlprice .= " (".price($objp->unitprice, 0, $langs, 0, 0, -1, $conf->currency)."/".$langs->transnoentities("Unit").")"; // Do not use strtolower because it breaks utf8 encoding |
3498
|
3498
|
} |
3499
|
3499
|
if (empty($hidepriceinlabel) && !empty($objp->remise_percent) && $objp->remise_percent >= 1) { |
3500
|
|
- $labeltoshowprice .= " - " . $langs->trans("Discount") . " : " . vatrate($objp->remise_percent) . ' %'; |
3501
|
|
- $labeltoshowhtmlprice .= " - " . $langs->transnoentities("Discount") . " : " . vatrate($objp->remise_percent) . ' %'; |
|
3500
|
+ $labeltoshowprice .= " - ".$langs->trans("Discount")." : ".vatrate($objp->remise_percent).' %'; |
|
3501
|
+ $labeltoshowhtmlprice .= " - ".$langs->transnoentities("Discount")." : ".vatrate($objp->remise_percent).' %'; |
3502
|
3502
|
} |
3503
|
3503
|
|
3504
|
3504
|
// Price by customer |
|
@@ -3507,11 +3507,11 @@ discard block |
|
|
block discarded – undo |
3507
|
3507
|
$found = 1; |
3508
|
3508
|
|
3509
|
3509
|
if ($objp->custprice_base_type == 'HT') { |
3510
|
|
- $labeltoshowprice .= ' - ' . price($objp->custprice, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("HT"); |
3511
|
|
- $labeltoshowhtmlprice .= ' - ' . price($objp->custprice, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("HT"); |
|
3510
|
+ $labeltoshowprice .= ' - '.price($objp->custprice, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("HT"); |
|
3511
|
+ $labeltoshowhtmlprice .= ' - '.price($objp->custprice, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("HT"); |
3512
|
3512
|
} else { |
3513
|
|
- $labeltoshowprice .= ' - ' . price($objp->custprice_ttc, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("TTC"); |
3514
|
|
- $labeltoshowhtmlprice .= ' - ' . price($objp->custprice_ttc, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("TTC"); |
|
3513
|
+ $labeltoshowprice .= ' - '.price($objp->custprice_ttc, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("TTC"); |
|
3514
|
+ $labeltoshowhtmlprice .= ' - '.price($objp->custprice_ttc, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("TTC"); |
3515
|
3515
|
} |
3516
|
3516
|
|
3517
|
3517
|
$outprice_ht = price($objp->custprice); |
|
@@ -3525,11 +3525,11 @@ discard block |
|
|
block discarded – undo |
3525
|
3525
|
// If level no defined or multiprice not found, we used the default price |
3526
|
3526
|
if (empty($hidepriceinlabel) && !$found) { |
3527
|
3527
|
if ($objp->price_base_type == 'HT') { |
3528
|
|
- $labeltoshowprice .= ' - ' . price($objp->price, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("HT"); |
3529
|
|
- $labeltoshowhtmlprice .= ' - ' . price($objp->price, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("HT"); |
|
3528
|
+ $labeltoshowprice .= ' - '.price($objp->price, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("HT"); |
|
3529
|
+ $labeltoshowhtmlprice .= ' - '.price($objp->price, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("HT"); |
3530
|
3530
|
} else { |
3531
|
|
- $labeltoshowprice .= ' - ' . price($objp->price_ttc, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("TTC"); |
3532
|
|
- $labeltoshowhtmlprice .= ' - ' . price($objp->price_ttc, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("TTC"); |
|
3531
|
+ $labeltoshowprice .= ' - '.price($objp->price_ttc, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("TTC"); |
|
3532
|
+ $labeltoshowhtmlprice .= ' - '.price($objp->price_ttc, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("TTC"); |
3533
|
3533
|
} |
3534
|
3534
|
$outprice_ht = price($objp->price); |
3535
|
3535
|
$outprice_ttc = price($objp->price_ttc); |
|
@@ -3540,14 +3540,14 @@ discard block |
|
|
block discarded – undo |
3540
|
3540
|
|
3541
|
3541
|
|
3542
|
3542
|
// Build options |
3543
|
|
- $opt = '<option value="' . $objp->rowid . '"'; |
|
3543
|
+ $opt = '<option value="'.$objp->rowid.'"'; |
3544
|
3544
|
$opt .= ($objp->rowid == $selected) ? ' selected' : ''; |
3545
|
3545
|
if (!empty($objp->price_by_qty_rowid) && $objp->price_by_qty_rowid > 0) { |
3546
|
|
- $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 . '"'; |
|
3546
|
+ $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.'"'; |
3547
|
3547
|
} |
3548
|
3548
|
if (getDolGlobalString('PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE')) { |
3549
|
|
- $opt .= ' data-labeltrans="' . $outlabel_translated . '"'; |
3550
|
|
- $opt .= ' data-desctrans="' . dol_escape_htmltag($outdesc_translated) . '"'; |
|
3549
|
+ $opt .= ' data-labeltrans="'.$outlabel_translated.'"'; |
|
3550
|
+ $opt .= ' data-desctrans="'.dol_escape_htmltag($outdesc_translated).'"'; |
3551
|
3551
|
} |
3552
|
3552
|
|
3553
|
3553
|
if ($stocktag == 1) { |
|
@@ -3642,7 +3642,7 @@ discard block |
|
|
block discarded – undo |
3642
|
3642
|
$selected_input_value = ''; |
3643
|
3643
|
if (!empty($conf->use_javascript_ajax) && getDolGlobalString('PRODUIT_USE_SEARCH_TO_SELECT')) { |
3644
|
3644
|
if ($selected > 0) { |
3645
|
|
- require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; |
|
3645
|
+ require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; |
3646
|
3646
|
$producttmpselect = new Product($this->db); |
3647
|
3647
|
$producttmpselect->fetch($selected); |
3648
|
3648
|
$selected_input_value = $producttmpselect->ref; |
|
@@ -3650,10 +3650,10 @@ discard block |
|
|
block discarded – undo |
3650
|
3650
|
} |
3651
|
3651
|
|
3652
|
3652
|
// mode=2 means suppliers products |
3653
|
|
- $urloption = ($socid > 0 ? 'socid=' . $socid . '&' : '') . 'htmlname=' . $htmlname . '&outjson=1&price_level=' . $price_level . '&type=' . $filtertype . '&mode=2&status=' . $status . '&finished=' . $finished . '&alsoproductwithnosupplierprice=' . $alsoproductwithnosupplierprice; |
3654
|
|
- print ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/product/ajax/products.php', $urloption, getDolGlobalInt('PRODUIT_USE_SEARCH_TO_SELECT'), 0, $ajaxoptions); |
|
3653
|
+ $urloption = ($socid > 0 ? 'socid='.$socid.'&' : '').'htmlname='.$htmlname.'&outjson=1&price_level='.$price_level.'&type='.$filtertype.'&mode=2&status='.$status.'&finished='.$finished.'&alsoproductwithnosupplierprice='.$alsoproductwithnosupplierprice; |
|
3654
|
+ print ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/product/ajax/products.php', $urloption, getDolGlobalInt('PRODUIT_USE_SEARCH_TO_SELECT'), 0, $ajaxoptions); |
3655
|
3655
|
|
3656
|
|
- print($hidelabel ? '' : $langs->trans("RefOrLabel") . ' : ') . '<input type="text" class="'.$morecss.'" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . ($placeholder ? ' placeholder="' . $placeholder . '"' : '') . '>'; |
|
3656
|
+ print($hidelabel ? '' : $langs->trans("RefOrLabel").' : ').'<input type="text" class="'.$morecss.'" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.($placeholder ? ' placeholder="'.$placeholder.'"' : '').'>'; |
3657
|
3657
|
} else { |
3658
|
3658
|
print $this->select_produits_fournisseurs_list($socid, $selected, $htmlname, $filtertype, $filtre, '', $status, 0, 0, $alsoproductwithnosupplierprice, $morecss, 0, $placeholder); |
3659
|
3659
|
} |
|
@@ -3713,25 +3713,25 @@ discard block |
|
|
block discarded – undo |
3713
|
3713
|
if (getDolGlobalInt('PRODUCT_USE_UNITS')) { |
3714
|
3714
|
$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"; |
3715
|
3715
|
} |
3716
|
|
- $sql .= " FROM " . $this->db->prefix() . "product as p"; |
3717
|
|
- $sql .= " LEFT JOIN " . $this->db->prefix() . "product_fournisseur_price as pfp ON ( p.rowid = pfp.fk_product AND pfp.entity IN (" . getEntity('product') . ") )"; |
|
3716
|
+ $sql .= " FROM ".$this->db->prefix()."product as p"; |
|
3717
|
+ $sql .= " LEFT JOIN ".$this->db->prefix()."product_fournisseur_price as pfp ON ( p.rowid = pfp.fk_product AND pfp.entity IN (".getEntity('product').") )"; |
3718
|
3718
|
if ($socid > 0) { |
3719
|
|
- $sql .= " AND pfp.fk_soc = " . ((int) $socid); |
|
3719
|
+ $sql .= " AND pfp.fk_soc = ".((int) $socid); |
3720
|
3720
|
} |
3721
|
|
- $sql .= " LEFT JOIN " . $this->db->prefix() . "societe as s ON pfp.fk_soc = s.rowid"; |
|
3721
|
+ $sql .= " LEFT JOIN ".$this->db->prefix()."societe as s ON pfp.fk_soc = s.rowid"; |
3722
|
3722
|
// Units |
3723
|
3723
|
if (getDolGlobalInt('PRODUCT_USE_UNITS')) { |
3724
|
|
- $sql .= " LEFT JOIN " . $this->db->prefix() . "c_units u ON u.rowid = p.fk_unit"; |
|
3724
|
+ $sql .= " LEFT JOIN ".$this->db->prefix()."c_units u ON u.rowid = p.fk_unit"; |
3725
|
3725
|
} |
3726
|
|
- $sql .= " WHERE p.entity IN (" . getEntity('product') . ")"; |
|
3726
|
+ $sql .= " WHERE p.entity IN (".getEntity('product').")"; |
3727
|
3727
|
if ($statut != -1) { |
3728
|
|
- $sql .= " AND p.tobuy = " . ((int) $statut); |
|
3728
|
+ $sql .= " AND p.tobuy = ".((int) $statut); |
3729
|
3729
|
} |
3730
|
3730
|
if (strval($filtertype) != '') { |
3731
|
|
- $sql .= " AND p.fk_product_type = " . ((int) $filtertype); |
|
3731
|
+ $sql .= " AND p.fk_product_type = ".((int) $filtertype); |
3732
|
3732
|
} |
3733
|
3733
|
if (!empty($filtre)) { |
3734
|
|
- $sql .= " " . $filtre; |
|
3734
|
+ $sql .= " ".$filtre; |
3735
|
3735
|
} |
3736
|
3736
|
// Add where from hooks |
3737
|
3737
|
$parameters = array(); |
|
@@ -3751,9 +3751,9 @@ discard block |
|
|
block discarded – undo |
3751
|
3751
|
if ($i > 0) { |
3752
|
3752
|
$sql .= " AND "; |
3753
|
3753
|
} |
3754
|
|
- $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) . "%'"; |
|
3754
|
+ $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)."%'"; |
3755
|
3755
|
if (getDolGlobalString('PRODUIT_FOURN_TEXTS')) { |
3756
|
|
- $sql .= " OR pfp.desc_fourn LIKE '" . $this->db->escape($prefix . $crit) . "%'"; |
|
3756
|
+ $sql .= " OR pfp.desc_fourn LIKE '".$this->db->escape($prefix.$crit)."%'"; |
3757
|
3757
|
} |
3758
|
3758
|
$sql .= ")"; |
3759
|
3759
|
$i++; |
|
@@ -3762,8 +3762,8 @@ discard block |
|
|
block discarded – undo |
3762
|
3762
|
$sql .= ")"; |
3763
|
3763
|
} |
3764
|
3764
|
if (isModEnabled('barcode')) { |
3765
|
|
- $sql .= " OR p.barcode LIKE '" . $this->db->escape($prefix . $filterkey) . "%'"; |
3766
|
|
- $sql .= " OR pfp.barcode LIKE '" . $this->db->escape($prefix . $filterkey) . "%'"; |
|
3765
|
+ $sql .= " OR p.barcode LIKE '".$this->db->escape($prefix.$filterkey)."%'"; |
|
3766
|
+ $sql .= " OR pfp.barcode LIKE '".$this->db->escape($prefix.$filterkey)."%'"; |
3767
|
3767
|
} |
3768
|
3768
|
$sql .= ')'; |
3769
|
3769
|
} |
|
@@ -3772,20 +3772,20 @@ discard block |
|
|
block discarded – undo |
3772
|
3772
|
|
3773
|
3773
|
// Build output string |
3774
|
3774
|
|
3775
|
|
- dol_syslog(get_class($this) . "::select_produits_fournisseurs_list", LOG_DEBUG); |
|
3775
|
+ dol_syslog(get_class($this)."::select_produits_fournisseurs_list", LOG_DEBUG); |
3776
|
3776
|
$result = $this->db->query($sql); |
3777
|
3777
|
if ($result) { |
3778
|
|
- require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php'; |
3779
|
|
- require_once DOL_DOCUMENT_ROOT . '/core/lib/product.lib.php'; |
|
3778
|
+ require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php'; |
|
3779
|
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php'; |
3780
|
3780
|
|
3781
|
3781
|
$num = $this->db->num_rows($result); |
3782
|
3782
|
|
3783
|
3783
|
//$out.='<select class="flat" id="select'.$htmlname.'" name="'.$htmlname.'">'; // remove select to have id same with combo and ajax |
3784
|
|
- $out .= '<select class="flat ' . ($morecss ? ' ' . $morecss : '') . '" id="' . $htmlname . '" name="' . $htmlname . '">'; |
|
3784
|
+ $out .= '<select class="flat '.($morecss ? ' '.$morecss : '').'" id="'.$htmlname.'" name="'.$htmlname.'">'; |
3785
|
3785
|
if (!$selected) { |
3786
|
|
- $out .= '<option value="-1" selected>' . ($placeholder ? $placeholder : ' ') . '</option>'; |
|
3786
|
+ $out .= '<option value="-1" selected>'.($placeholder ? $placeholder : ' ').'</option>'; |
3787
|
3787
|
} else { |
3788
|
|
- $out .= '<option value="-1">' . ($placeholder ? $placeholder : ' ') . '</option>'; |
|
3788
|
+ $out .= '<option value="-1">'.($placeholder ? $placeholder : ' ').'</option>'; |
3789
|
3789
|
} |
3790
|
3790
|
|
3791
|
3791
|
$i = 0; |
|
@@ -3800,7 +3800,7 @@ discard block |
|
|
block discarded – undo |
3800
|
3800
|
|
3801
|
3801
|
$outkey = $objp->idprodfournprice; // id in table of price |
3802
|
3802
|
if (!$outkey && $alsoproductwithnosupplierprice) { |
3803
|
|
- $outkey = 'idprod_' . $objp->rowid; // id of product |
|
3803
|
+ $outkey = 'idprod_'.$objp->rowid; // id of product |
3804
|
3804
|
} |
3805
|
3805
|
|
3806
|
3806
|
$outref = $objp->ref; |
|
@@ -3815,23 +3815,23 @@ discard block |
|
|
block discarded – undo |
3815
|
3815
|
$outvalUnits = ''; |
3816
|
3816
|
if (getDolGlobalInt('PRODUCT_USE_UNITS')) { |
3817
|
3817
|
if (!empty($objp->unit_short)) { |
3818
|
|
- $outvalUnits .= ' - ' . $objp->unit_short; |
|
3818
|
+ $outvalUnits .= ' - '.$objp->unit_short; |
3819
|
3819
|
} |
3820
|
3820
|
if (!empty($objp->weight) && $objp->weight_units !== null) { |
3821
|
3821
|
$unitToShow = showDimensionInBestUnit($objp->weight, $objp->weight_units, 'weight', $langs); |
3822
|
|
- $outvalUnits .= ' - ' . $unitToShow; |
|
3822
|
+ $outvalUnits .= ' - '.$unitToShow; |
3823
|
3823
|
} |
3824
|
3824
|
if ((!empty($objp->length) || !empty($objp->width) || !empty($objp->height)) && $objp->length_units !== null) { |
3825
|
|
- $unitToShow = $objp->length . ' x ' . $objp->width . ' x ' . $objp->height . ' ' . measuringUnitString(0, 'size', $objp->length_units); |
3826
|
|
- $outvalUnits .= ' - ' . $unitToShow; |
|
3825
|
+ $unitToShow = $objp->length.' x '.$objp->width.' x '.$objp->height.' '.measuringUnitString(0, 'size', $objp->length_units); |
|
3826
|
+ $outvalUnits .= ' - '.$unitToShow; |
3827
|
3827
|
} |
3828
|
3828
|
if (!empty($objp->surface) && $objp->surface_units !== null) { |
3829
|
3829
|
$unitToShow = showDimensionInBestUnit($objp->surface, $objp->surface_units, 'surface', $langs); |
3830
|
|
- $outvalUnits .= ' - ' . $unitToShow; |
|
3830
|
+ $outvalUnits .= ' - '.$unitToShow; |
3831
|
3831
|
} |
3832
|
3832
|
if (!empty($objp->volume) && $objp->volume_units !== null) { |
3833
|
3833
|
$unitToShow = showDimensionInBestUnit($objp->volume, $objp->volume_units, 'volume', $langs); |
3834
|
|
- $outvalUnits .= ' - ' . $unitToShow; |
|
3834
|
+ $outvalUnits .= ' - '.$unitToShow; |
3835
|
3835
|
} |
3836
|
3836
|
if ($outdurationvalue && $outdurationunit) { |
3837
|
3837
|
$da = array( |
|
@@ -3842,22 +3842,22 @@ discard block |
|
|
block discarded – undo |
3842
|
3842
|
'y' => $langs->trans('Year') |
3843
|
3843
|
); |
3844
|
3844
|
if (isset($da[$outdurationunit])) { |
3845
|
|
- $outvalUnits .= ' - ' . $outdurationvalue . ' ' . $langs->transnoentities($da[$outdurationunit] . ($outdurationvalue > 1 ? 's' : '')); |
|
3845
|
+ $outvalUnits .= ' - '.$outdurationvalue.' '.$langs->transnoentities($da[$outdurationunit].($outdurationvalue > 1 ? 's' : '')); |
3846
|
3846
|
} |
3847
|
3847
|
} |
3848
|
3848
|
} |
3849
|
3849
|
|
3850
|
3850
|
$objRef = $objp->ref; |
3851
|
3851
|
if ($filterkey && $filterkey != '') { |
3852
|
|
- $objRef = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $objRef, 1); |
|
3852
|
+ $objRef = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $objRef, 1); |
3853
|
3853
|
} |
3854
|
3854
|
$objRefFourn = $objp->ref_fourn; |
3855
|
3855
|
if ($filterkey && $filterkey != '') { |
3856
|
|
- $objRefFourn = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $objRefFourn, 1); |
|
3856
|
+ $objRefFourn = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $objRefFourn, 1); |
3857
|
3857
|
} |
3858
|
3858
|
$label = $objp->label; |
3859
|
3859
|
if ($filterkey && $filterkey != '') { |
3860
|
|
- $label = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $label, 1); |
|
3860
|
+ $label = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $label, 1); |
3861
|
3861
|
} |
3862
|
3862
|
|
3863
|
3863
|
switch ($objp->fk_product_type) { |
|
@@ -3880,21 +3880,21 @@ discard block |
|
|
block discarded – undo |
3880
|
3880
|
|
3881
|
3881
|
$optlabel .= $objp->ref; |
3882
|
3882
|
if (!empty($objp->idprodfournprice) && ($objp->ref != $objp->ref_fourn)) { |
3883
|
|
- $optlabel .= ' <span class="opacitymedium">(' . $objp->ref_fourn . ')</span>'; |
|
3883
|
+ $optlabel .= ' <span class="opacitymedium">('.$objp->ref_fourn.')</span>'; |
3884
|
3884
|
} |
3885
|
3885
|
if (isModEnabled('barcode') && !empty($objp->barcode)) { |
3886
|
|
- $optlabel .= ' (' . $outbarcode . ')'; |
|
3886
|
+ $optlabel .= ' ('.$outbarcode.')'; |
3887
|
3887
|
} |
3888
|
|
- $optlabel .= ' - ' . dol_trunc($label, $maxlengtharticle); |
|
3888
|
+ $optlabel .= ' - '.dol_trunc($label, $maxlengtharticle); |
3889
|
3889
|
|
3890
|
3890
|
$outvallabel = $objRef; |
3891
|
3891
|
if (!empty($objp->idprodfournprice) && ($objp->ref != $objp->ref_fourn)) { |
3892
|
|
- $outvallabel .= ' (' . $objRefFourn . ')'; |
|
3892
|
+ $outvallabel .= ' ('.$objRefFourn.')'; |
3893
|
3893
|
} |
3894
|
3894
|
if (isModEnabled('barcode') && !empty($objp->barcode)) { |
3895
|
|
- $outvallabel .= ' (' . $outbarcode . ')'; |
|
3895
|
+ $outvallabel .= ' ('.$outbarcode.')'; |
3896
|
3896
|
} |
3897
|
|
- $outvallabel .= ' - ' . dol_trunc($label, $maxlengtharticle); |
|
3897
|
+ $outvallabel .= ' - '.dol_trunc($label, $maxlengtharticle); |
3898
|
3898
|
|
3899
|
3899
|
// Units |
3900
|
3900
|
$optlabel .= $outvalUnits; |
|
@@ -3911,7 +3911,7 @@ discard block |
|
|
block discarded – undo |
3911
|
3911
|
$prod_supplier->fourn_tva_tx = $objp->tva_tx; |
3912
|
3912
|
$prod_supplier->fk_supplier_price_expression = $objp->fk_supplier_price_expression; |
3913
|
3913
|
|
3914
|
|
- require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php'; |
|
3914
|
+ require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php'; |
3915
|
3915
|
$priceparser = new PriceParser($this->db); |
3916
|
3916
|
$price_result = $priceparser->parseProductSupplier($prod_supplier); |
3917
|
3917
|
if ($price_result >= 0) { |
|
@@ -3922,57 +3922,57 @@ discard block |
|
|
block discarded – undo |
3922
|
3922
|
} |
3923
|
3923
|
} |
3924
|
3924
|
if ($objp->quantity == 1) { |
3925
|
|
- $optlabel .= ' - ' . price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency) . "/"; |
3926
|
|
- $outvallabel .= ' - ' . price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 0, $langs, 0, 0, -1, $conf->currency) . "/"; |
|
3925
|
+ $optlabel .= ' - '.price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency)."/"; |
|
3926
|
+ $outvallabel .= ' - '.price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 0, $langs, 0, 0, -1, $conf->currency)."/"; |
3927
|
3927
|
$optlabel .= $langs->trans("Unit"); // Do not use strtolower because it breaks utf8 encoding |
3928
|
3928
|
$outvallabel .= $langs->transnoentities("Unit"); |
3929
|
3929
|
} else { |
3930
|
|
- $optlabel .= ' - ' . price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency) . "/" . $objp->quantity; |
3931
|
|
- $outvallabel .= ' - ' . price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 0, $langs, 0, 0, -1, $conf->currency) . "/" . $objp->quantity; |
3932
|
|
- $optlabel .= ' ' . $langs->trans("Units"); // Do not use strtolower because it breaks utf8 encoding |
3933
|
|
- $outvallabel .= ' ' . $langs->transnoentities("Units"); |
|
3930
|
+ $optlabel .= ' - '.price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity; |
|
3931
|
+ $outvallabel .= ' - '.price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 0, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity; |
|
3932
|
+ $optlabel .= ' '.$langs->trans("Units"); // Do not use strtolower because it breaks utf8 encoding |
|
3933
|
+ $outvallabel .= ' '.$langs->transnoentities("Units"); |
3934
|
3934
|
} |
3935
|
3935
|
|
3936
|
3936
|
if ($objp->quantity > 1) { |
3937
|
|
- $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 |
3938
|
|
- $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 |
|
3937
|
+ $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 |
|
3938
|
+ $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 |
3939
|
3939
|
} |
3940
|
3940
|
if ($objp->remise_percent >= 1) { |
3941
|
|
- $optlabel .= " - " . $langs->trans("Discount") . " : " . vatrate($objp->remise_percent) . ' %'; |
3942
|
|
- $outvallabel .= " - " . $langs->transnoentities("Discount") . " : " . vatrate($objp->remise_percent) . ' %'; |
|
3941
|
+ $optlabel .= " - ".$langs->trans("Discount")." : ".vatrate($objp->remise_percent).' %'; |
|
3942
|
+ $outvallabel .= " - ".$langs->transnoentities("Discount")." : ".vatrate($objp->remise_percent).' %'; |
3943
|
3943
|
} |
3944
|
3944
|
if ($objp->duration) { |
3945
|
|
- $optlabel .= " - " . $objp->duration; |
3946
|
|
- $outvallabel .= " - " . $objp->duration; |
|
3945
|
+ $optlabel .= " - ".$objp->duration; |
|
3946
|
+ $outvallabel .= " - ".$objp->duration; |
3947
|
3947
|
} |
3948
|
3948
|
if (!$socid) { |
3949
|
|
- $optlabel .= " - " . dol_trunc($objp->name, 8); |
3950
|
|
- $outvallabel .= " - " . dol_trunc($objp->name, 8); |
|
3949
|
+ $optlabel .= " - ".dol_trunc($objp->name, 8); |
|
3950
|
+ $outvallabel .= " - ".dol_trunc($objp->name, 8); |
3951
|
3951
|
} |
3952
|
3952
|
if ($objp->supplier_reputation) { |
3953
|
3953
|
//TODO dictionary |
3954
|
3954
|
$reputations = array('' => $langs->trans('Standard'), 'FAVORITE' => $langs->trans('Favorite'), 'NOTTHGOOD' => $langs->trans('NotTheGoodQualitySupplier'), 'DONOTORDER' => $langs->trans('DoNotOrderThisProductToThisSupplier')); |
3955
|
3955
|
|
3956
|
|
- $optlabel .= " - " . $reputations[$objp->supplier_reputation]; |
3957
|
|
- $outvallabel .= " - " . $reputations[$objp->supplier_reputation]; |
|
3956
|
+ $optlabel .= " - ".$reputations[$objp->supplier_reputation]; |
|
3957
|
+ $outvallabel .= " - ".$reputations[$objp->supplier_reputation]; |
3958
|
3958
|
} |
3959
|
3959
|
} else { |
3960
|
|
- $optlabel .= " - <span class='opacitymedium'>" . $langs->trans("NoPriceDefinedForThisSupplier") . '</span>'; |
3961
|
|
- $outvallabel .= ' - ' . $langs->transnoentities("NoPriceDefinedForThisSupplier"); |
|
3960
|
+ $optlabel .= " - <span class='opacitymedium'>".$langs->trans("NoPriceDefinedForThisSupplier").'</span>'; |
|
3961
|
+ $outvallabel .= ' - '.$langs->transnoentities("NoPriceDefinedForThisSupplier"); |
3962
|
3962
|
} |
3963
|
3963
|
|
3964
|
3964
|
if (isModEnabled('stock') && $showstockinlist && isset($objp->stock) && ($objp->fk_product_type == Product::TYPE_PRODUCT || getDolGlobalString('STOCK_SUPPORTS_SERVICES'))) { |
3965
|
3965
|
$novirtualstock = ($showstockinlist == 2); |
3966
|
3966
|
|
3967
|
3967
|
if ($user->hasRight('stock', 'lire')) { |
3968
|
|
- $outvallabel .= ' - ' . $langs->trans("Stock") . ': ' . price(price2num($objp->stock, 'MS')); |
|
3968
|
+ $outvallabel .= ' - '.$langs->trans("Stock").': '.price(price2num($objp->stock, 'MS')); |
3969
|
3969
|
|
3970
|
3970
|
if ($objp->stock > 0) { |
3971
|
3971
|
$optlabel .= ' - <span class="product_line_stock_ok">'; |
3972
|
3972
|
} elseif ($objp->stock <= 0) { |
3973
|
3973
|
$optlabel .= ' - <span class="product_line_stock_too_low">'; |
3974
|
3974
|
} |
3975
|
|
- $optlabel .= $langs->transnoentities("Stock") . ':' . price(price2num($objp->stock, 'MS')); |
|
3975
|
+ $optlabel .= $langs->transnoentities("Stock").':'.price(price2num($objp->stock, 'MS')); |
3976
|
3976
|
$optlabel .= '</span>'; |
3977
|
3977
|
if (empty($novirtualstock) && getDolGlobalString('STOCK_SHOW_VIRTUAL_STOCK_IN_PRODUCTS_COMBO')) { // Warning, this option may slow down combo list generation |
3978
|
3978
|
$langs->load("stocks"); |
|
@@ -3982,9 +3982,9 @@ discard block |
|
|
block discarded – undo |
3982
|
3982
|
$tmpproduct->load_virtual_stock(); |
3983
|
3983
|
$virtualstock = $tmpproduct->stock_theorique; |
3984
|
3984
|
|
3985
|
|
- $outvallabel .= ' - ' . $langs->trans("VirtualStock") . ':' . $virtualstock; |
|
3985
|
+ $outvallabel .= ' - '.$langs->trans("VirtualStock").':'.$virtualstock; |
3986
|
3986
|
|
3987
|
|
- $optlabel .= ' - ' . $langs->transnoentities("VirtualStock") . ':'; |
|
3987
|
+ $optlabel .= ' - '.$langs->transnoentities("VirtualStock").':'; |
3988
|
3988
|
if ($virtualstock > 0) { |
3989
|
3989
|
$optlabel .= '<span class="product_line_stock_ok">'; |
3990
|
3990
|
} elseif ($virtualstock <= 0) { |
|
@@ -3998,7 +3998,7 @@ discard block |
|
|
block discarded – undo |
3998
|
3998
|
} |
3999
|
3999
|
} |
4000
|
4000
|
|
4001
|
|
- $optstart = '<option value="' . $outkey . '"'; |
|
4001
|
+ $optstart = '<option value="'.$outkey.'"'; |
4002
|
4002
|
if ($selected && $selected == $objp->idprodfournprice) { |
4003
|
4003
|
$optstart .= ' selected'; |
4004
|
4004
|
} |
|
@@ -4007,31 +4007,31 @@ discard block |
|
|
block discarded – undo |
4007
|
4007
|
} |
4008
|
4008
|
|
4009
|
4009
|
if (!empty($objp->idprodfournprice) && $objp->idprodfournprice > 0) { |
4010
|
|
- $optstart .= ' data-product-id="' . dol_escape_htmltag($objp->rowid) . '"'; |
4011
|
|
- $optstart .= ' data-price-id="' . dol_escape_htmltag($objp->idprodfournprice) . '"'; |
4012
|
|
- $optstart .= ' data-qty="' . dol_escape_htmltag($objp->quantity) . '"'; |
4013
|
|
- $optstart .= ' data-up="' . dol_escape_htmltag(price2num($objp->unitprice)) . '"'; |
4014
|
|
- $optstart .= ' data-up-locale="' . dol_escape_htmltag(price($objp->unitprice)) . '"'; |
4015
|
|
- $optstart .= ' data-discount="' . dol_escape_htmltag($outdiscount) . '"'; |
4016
|
|
- $optstart .= ' data-tvatx="' . dol_escape_htmltag(price2num($objp->tva_tx)) . '"'; |
4017
|
|
- $optstart .= ' data-tvatx-formated="' . dol_escape_htmltag(price($objp->tva_tx, 0, $langs, 1, -1, 2)) . '"'; |
4018
|
|
- $optstart .= ' data-default-vat-code="' . dol_escape_htmltag($objp->default_vat_code) . '"'; |
4019
|
|
- $optstart .= ' data-supplier-ref="' . dol_escape_htmltag($objp->ref_fourn) . '"'; |
|
4010
|
+ $optstart .= ' data-product-id="'.dol_escape_htmltag($objp->rowid).'"'; |
|
4011
|
+ $optstart .= ' data-price-id="'.dol_escape_htmltag($objp->idprodfournprice).'"'; |
|
4012
|
+ $optstart .= ' data-qty="'.dol_escape_htmltag($objp->quantity).'"'; |
|
4013
|
+ $optstart .= ' data-up="'.dol_escape_htmltag(price2num($objp->unitprice)).'"'; |
|
4014
|
+ $optstart .= ' data-up-locale="'.dol_escape_htmltag(price($objp->unitprice)).'"'; |
|
4015
|
+ $optstart .= ' data-discount="'.dol_escape_htmltag($outdiscount).'"'; |
|
4016
|
+ $optstart .= ' data-tvatx="'.dol_escape_htmltag(price2num($objp->tva_tx)).'"'; |
|
4017
|
+ $optstart .= ' data-tvatx-formated="'.dol_escape_htmltag(price($objp->tva_tx, 0, $langs, 1, -1, 2)).'"'; |
|
4018
|
+ $optstart .= ' data-default-vat-code="'.dol_escape_htmltag($objp->default_vat_code).'"'; |
|
4019
|
+ $optstart .= ' data-supplier-ref="'.dol_escape_htmltag($objp->ref_fourn).'"'; |
4020
|
4020
|
if (isModEnabled('multicurrency')) { |
4021
|
|
- $optstart .= ' data-multicurrency-code="' . dol_escape_htmltag($objp->multicurrency_code) . '"'; |
4022
|
|
- $optstart .= ' data-multicurrency-up="' . dol_escape_htmltag($objp->multicurrency_unitprice) . '"'; |
|
4021
|
+ $optstart .= ' data-multicurrency-code="'.dol_escape_htmltag($objp->multicurrency_code).'"'; |
|
4022
|
+ $optstart .= ' data-multicurrency-up="'.dol_escape_htmltag($objp->multicurrency_unitprice).'"'; |
4023
|
4023
|
} |
4024
|
4024
|
} |
4025
|
|
- $optstart .= ' data-description="' . dol_escape_htmltag($objp->description, 0, 1) . '"'; |
|
4025
|
+ $optstart .= ' data-description="'.dol_escape_htmltag($objp->description, 0, 1).'"'; |
4026
|
4026
|
|
4027
|
4027
|
$outarrayentry = array( |
4028
|
4028
|
'key' => $outkey, |
4029
|
4029
|
'value' => $outref, |
4030
|
4030
|
'label' => $outvallabel, |
4031
|
4031
|
'qty' => $outqty, |
4032
|
|
- 'price_qty_ht' => price2num($objp->fprice, 'MU'), // Keep higher resolution for price for the min qty |
4033
|
|
- 'price_unit_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price |
4034
|
|
- 'price_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price (for compatibility) |
|
4032
|
+ 'price_qty_ht' => price2num($objp->fprice, 'MU'), // Keep higher resolution for price for the min qty |
|
4033
|
+ 'price_unit_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price |
|
4034
|
+ 'price_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price (for compatibility) |
4035
|
4035
|
'tva_tx_formated' => price($objp->tva_tx, 0, $langs, 1, -1, 2), |
4036
|
4036
|
'tva_tx' => price2num($objp->tva_tx), |
4037
|
4037
|
'default_vat_code' => $objp->default_vat_code, |
|
@@ -4061,17 +4061,17 @@ discard block |
|
|
block discarded – undo |
4061
|
4061
|
// Add new entry |
4062
|
4062
|
// "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 |
4063
|
4063
|
// "label" value of json key array is used by jQuery automatically as text for combo box |
4064
|
|
- $out .= $optstart . ' data-html="' . dol_escape_htmltag($optlabel) . '">' . $optlabel . "</option>\n"; |
|
4064
|
+ $out .= $optstart.' data-html="'.dol_escape_htmltag($optlabel).'">'.$optlabel."</option>\n"; |
4065
|
4065
|
$outarraypush = array( |
4066
|
4066
|
'key' => $outkey, |
4067
|
4067
|
'value' => $outref, |
4068
|
4068
|
'label' => $outvallabel, |
4069
|
4069
|
'qty' => $outqty, |
4070
|
|
- 'price_qty_ht' => price2num($objp->fprice, 'MU'), // Keep higher resolution for price for the min qty |
|
4070
|
+ 'price_qty_ht' => price2num($objp->fprice, 'MU'), // Keep higher resolution for price for the min qty |
4071
|
4071
|
'price_qty_ht_locale' => price($objp->fprice), |
4072
|
|
- 'price_unit_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price |
|
4072
|
+ 'price_unit_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price |
4073
|
4073
|
'price_unit_ht_locale' => price($objp->unitprice), |
4074
|
|
- 'price_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price (for compatibility) |
|
4074
|
+ 'price_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price (for compatibility) |
4075
|
4075
|
'tva_tx_formated' => price($objp->tva_tx), |
4076
|
4076
|
'tva_tx' => price2num($objp->tva_tx), |
4077
|
4077
|
'default_vat_code' => $objp->default_vat_code, |
|
@@ -4104,7 +4104,7 @@ discard block |
|
|
block discarded – undo |
4104
|
4104
|
|
4105
|
4105
|
$this->db->free($result); |
4106
|
4106
|
|
4107
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
4107
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
4108
|
4108
|
$out .= ajax_combobox($htmlname); |
4109
|
4109
|
} else { |
4110
|
4110
|
dol_print_error($this->db); |
|
@@ -4136,43 +4136,43 @@ discard block |
|
|
block discarded – undo |
4136
|
4136
|
$sql = "SELECT p.rowid, p.ref, p.label, p.price, p.duration, pfp.fk_soc,"; |
4137
|
4137
|
$sql .= " pfp.ref_fourn, pfp.rowid as idprodfournprice, pfp.price as fprice, pfp.remise_percent, pfp.quantity, pfp.unitprice,"; |
4138
|
4138
|
$sql .= " pfp.fk_supplier_price_expression, pfp.fk_product, pfp.tva_tx, s.nom as name"; |
4139
|
|
- $sql .= " FROM " . $this->db->prefix() . "product as p"; |
4140
|
|
- $sql .= " LEFT JOIN " . $this->db->prefix() . "product_fournisseur_price as pfp ON p.rowid = pfp.fk_product"; |
4141
|
|
- $sql .= " LEFT JOIN " . $this->db->prefix() . "societe as s ON pfp.fk_soc = s.rowid"; |
4142
|
|
- $sql .= " WHERE pfp.entity IN (" . getEntity('productsupplierprice') . ")"; |
|
4139
|
+ $sql .= " FROM ".$this->db->prefix()."product as p"; |
|
4140
|
+ $sql .= " LEFT JOIN ".$this->db->prefix()."product_fournisseur_price as pfp ON p.rowid = pfp.fk_product"; |
|
4141
|
+ $sql .= " LEFT JOIN ".$this->db->prefix()."societe as s ON pfp.fk_soc = s.rowid"; |
|
4142
|
+ $sql .= " WHERE pfp.entity IN (".getEntity('productsupplierprice').")"; |
4143
|
4143
|
$sql .= " AND p.tobuy = 1"; |
4144
|
4144
|
$sql .= " AND s.fournisseur = 1"; |
4145
|
|
- $sql .= " AND p.rowid = " . ((int) $productid); |
|
4145
|
+ $sql .= " AND p.rowid = ".((int) $productid); |
4146
|
4146
|
if (!getDolGlobalString('PRODUCT_BEST_SUPPLIER_PRICE_PRESELECTED')) { |
4147
|
4147
|
$sql .= " ORDER BY s.nom, pfp.ref_fourn DESC"; |
4148
|
4148
|
} else { |
4149
|
4149
|
$sql .= " ORDER BY pfp.unitprice ASC"; |
4150
|
4150
|
} |
4151
|
4151
|
|
4152
|
|
- dol_syslog(get_class($this) . "::select_product_fourn_price", LOG_DEBUG); |
|
4152
|
+ dol_syslog(get_class($this)."::select_product_fourn_price", LOG_DEBUG); |
4153
|
4153
|
$result = $this->db->query($sql); |
4154
|
4154
|
|
4155
|
4155
|
if ($result) { |
4156
|
4156
|
$num = $this->db->num_rows($result); |
4157
|
4157
|
|
4158
|
|
- $form = '<select class="flat" id="select_' . $htmlname . '" name="' . $htmlname . '">'; |
|
4158
|
+ $form = '<select class="flat" id="select_'.$htmlname.'" name="'.$htmlname.'">'; |
4159
|
4159
|
|
4160
|
4160
|
if (!$num) { |
4161
|
|
- $form .= '<option value="0">-- ' . $langs->trans("NoSupplierPriceDefinedForThisProduct") . ' --</option>'; |
|
4161
|
+ $form .= '<option value="0">-- '.$langs->trans("NoSupplierPriceDefinedForThisProduct").' --</option>'; |
4162
|
4162
|
} else { |
4163
|
|
- require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php'; |
|
4163
|
+ require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php'; |
4164
|
4164
|
$form .= '<option value="0"> </option>'; |
4165
|
4165
|
|
4166
|
4166
|
$i = 0; |
4167
|
4167
|
while ($i < $num) { |
4168
|
4168
|
$objp = $this->db->fetch_object($result); |
4169
|
4169
|
|
4170
|
|
- $opt = '<option value="' . $objp->idprodfournprice . '"'; |
|
4170
|
+ $opt = '<option value="'.$objp->idprodfournprice.'"'; |
4171
|
4171
|
//if there is only one supplier, preselect it |
4172
|
4172
|
if ($num == 1 || ($selected_supplier > 0 && $objp->fk_soc == $selected_supplier) || ($i == 0 && getDolGlobalString('PRODUCT_BEST_SUPPLIER_PRICE_PRESELECTED'))) { |
4173
|
4173
|
$opt .= ' selected'; |
4174
|
4174
|
} |
4175
|
|
- $opt .= '>' . $objp->name . ' - ' . $objp->ref_fourn . ' - '; |
|
4175
|
+ $opt .= '>'.$objp->name.' - '.$objp->ref_fourn.' - '; |
4176
|
4176
|
|
4177
|
4177
|
if (isModEnabled('dynamicprices') && !empty($objp->fk_supplier_price_expression)) { |
4178
|
4178
|
$prod_supplier = new ProductFournisseur($this->db); |
|
@@ -4182,7 +4182,7 @@ discard block |
|
|
block discarded – undo |
4182
|
4182
|
$prod_supplier->fourn_tva_tx = $objp->tva_tx; |
4183
|
4183
|
$prod_supplier->fk_supplier_price_expression = $objp->fk_supplier_price_expression; |
4184
|
4184
|
|
4185
|
|
- require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php'; |
|
4185
|
+ require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php'; |
4186
|
4186
|
$priceparser = new PriceParser($this->db); |
4187
|
4187
|
$price_result = $priceparser->parseProductSupplier($prod_supplier); |
4188
|
4188
|
if ($price_result >= 0) { |
|
@@ -4193,10 +4193,10 @@ discard block |
|
|
block discarded – undo |
4193
|
4193
|
} |
4194
|
4194
|
} |
4195
|
4195
|
if ($objp->quantity == 1) { |
4196
|
|
- $opt .= price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency) . "/"; |
|
4196
|
+ $opt .= price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency)."/"; |
4197
|
4197
|
} |
4198
|
4198
|
|
4199
|
|
- $opt .= $objp->quantity . ' '; |
|
4199
|
+ $opt .= $objp->quantity.' '; |
4200
|
4200
|
|
4201
|
4201
|
if ($objp->quantity == 1) { |
4202
|
4202
|
$opt .= $langs->trans("Unit"); |
|
@@ -4205,10 +4205,10 @@ discard block |
|
|
block discarded – undo |
4205
|
4205
|
} |
4206
|
4206
|
if ($objp->quantity > 1) { |
4207
|
4207
|
$opt .= " - "; |
4208
|
|
- $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"); |
|
4208
|
+ $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"); |
4209
|
4209
|
} |
4210
|
4210
|
if ($objp->duration) { |
4211
|
|
- $opt .= " - " . $objp->duration; |
|
4211
|
+ $opt .= " - ".$objp->duration; |
4212
|
4212
|
} |
4213
|
4213
|
$opt .= "</option>\n"; |
4214
|
4214
|
|
|
@@ -4246,8 +4246,8 @@ discard block |
|
|
block discarded – undo |
4246
|
4246
|
dol_syslog(__METHOD__, LOG_DEBUG); |
4247
|
4247
|
|
4248
|
4248
|
$sql = "SELECT rowid, code, libelle as label, deposit_percent"; |
4249
|
|
- $sql .= " FROM " . $this->db->prefix() . 'c_payment_term'; |
4250
|
|
- $sql .= " WHERE entity IN (" . getEntity('c_payment_term') . ")"; |
|
4249
|
+ $sql .= " FROM ".$this->db->prefix().'c_payment_term'; |
|
4250
|
+ $sql .= " WHERE entity IN (".getEntity('c_payment_term').")"; |
4251
|
4251
|
$sql .= " AND active > 0"; |
4252
|
4252
|
$sql .= " ORDER BY sortorder"; |
4253
|
4253
|
|
|
@@ -4259,7 +4259,7 @@ discard block |
|
|
block discarded – undo |
4259
|
4259
|
$obj = $this->db->fetch_object($resql); |
4260
|
4260
|
|
4261
|
4261
|
// Si traduction existe, on l'utilise, sinon on prend le libelle par default |
4262
|
|
- $label = ($langs->trans("PaymentConditionShort" . $obj->code) != "PaymentConditionShort" . $obj->code ? $langs->trans("PaymentConditionShort" . $obj->code) : ($obj->label != '-' ? $obj->label : '')); |
|
4262
|
+ $label = ($langs->trans("PaymentConditionShort".$obj->code) != "PaymentConditionShort".$obj->code ? $langs->trans("PaymentConditionShort".$obj->code) : ($obj->label != '-' ? $obj->label : '')); |
4263
|
4263
|
$this->cache_conditions_paiements[$obj->rowid]['code'] = $obj->code; |
4264
|
4264
|
$this->cache_conditions_paiements[$obj->rowid]['label'] = $label; |
4265
|
4265
|
$this->cache_conditions_paiements[$obj->rowid]['deposit_percent'] = $obj->deposit_percent; |
|
@@ -4287,7 +4287,7 @@ discard block |
|
|
block discarded – undo |
4287
|
4287
|
// phpcs:enable |
4288
|
4288
|
global $langs; |
4289
|
4289
|
|
4290
|
|
- $num = count($this->cache_availability); // TODO Use $conf->cache['availability'] instead of $this->cache_availability |
|
4290
|
+ $num = count($this->cache_availability); // TODO Use $conf->cache['availability'] instead of $this->cache_availability |
4291
|
4291
|
if ($num > 0) { |
4292
|
4292
|
return 0; // Cache already loaded |
4293
|
4293
|
} |
|
@@ -4297,7 +4297,7 @@ discard block |
|
|
block discarded – undo |
4297
|
4297
|
$langs->load('propal'); |
4298
|
4298
|
|
4299
|
4299
|
$sql = "SELECT rowid, code, label, position"; |
4300
|
|
- $sql .= " FROM " . $this->db->prefix() . 'c_availability'; |
|
4300
|
+ $sql .= " FROM ".$this->db->prefix().'c_availability'; |
4301
|
4301
|
$sql .= " WHERE active > 0"; |
4302
|
4302
|
|
4303
|
4303
|
$resql = $this->db->query($sql); |
|
@@ -4308,7 +4308,7 @@ discard block |
|
|
block discarded – undo |
4308
|
4308
|
$obj = $this->db->fetch_object($resql); |
4309
|
4309
|
|
4310
|
4310
|
// Si traduction existe, on l'utilise, sinon on prend le libelle par default |
4311
|
|
- $label = ($langs->trans("AvailabilityType" . $obj->code) != "AvailabilityType" . $obj->code ? $langs->trans("AvailabilityType" . $obj->code) : ($obj->label != '-' ? $obj->label : '')); |
|
4311
|
+ $label = ($langs->trans("AvailabilityType".$obj->code) != "AvailabilityType".$obj->code ? $langs->trans("AvailabilityType".$obj->code) : ($obj->label != '-' ? $obj->label : '')); |
4312
|
4312
|
$this->cache_availability[$obj->rowid]['code'] = $obj->code; |
4313
|
4313
|
$this->cache_availability[$obj->rowid]['label'] = $label; |
4314
|
4314
|
$this->cache_availability[$obj->rowid]['position'] = $obj->position; |
|
@@ -4340,17 +4340,17 @@ discard block |
|
|
block discarded – undo |
4340
|
4340
|
|
4341
|
4341
|
$this->load_cache_availability(); |
4342
|
4342
|
|
4343
|
|
- dol_syslog(__METHOD__ . " selected=" . $selected . ", htmlname=" . $htmlname, LOG_DEBUG); |
|
4343
|
+ dol_syslog(__METHOD__." selected=".$selected.", htmlname=".$htmlname, LOG_DEBUG); |
4344
|
4344
|
|
4345
|
|
- print '<select id="' . $htmlname . '" class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">'; |
|
4345
|
+ print '<select id="'.$htmlname.'" class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">'; |
4346
|
4346
|
if ($addempty) { |
4347
|
4347
|
print '<option value="0"> </option>'; |
4348
|
4348
|
} |
4349
|
4349
|
foreach ($this->cache_availability as $id => $arrayavailability) { |
4350
|
4350
|
if ($selected == $id) { |
4351
|
|
- print '<option value="' . $id . '" selected>'; |
|
4351
|
+ print '<option value="'.$id.'" selected>'; |
4352
|
4352
|
} else { |
4353
|
|
- print '<option value="' . $id . '">'; |
|
4353
|
+ print '<option value="'.$id.'">'; |
4354
|
4354
|
} |
4355
|
4355
|
print dol_escape_htmltag($arrayavailability['label']); |
4356
|
4356
|
print '</option>'; |
|
@@ -4371,13 +4371,13 @@ discard block |
|
|
block discarded – undo |
4371
|
4371
|
{ |
4372
|
4372
|
global $langs; |
4373
|
4373
|
|
4374
|
|
- $num = count($this->cache_demand_reason); // TODO Use $conf->cache['input_reason'] instead of $this->cache_demand_reason |
|
4374
|
+ $num = count($this->cache_demand_reason); // TODO Use $conf->cache['input_reason'] instead of $this->cache_demand_reason |
4375
|
4375
|
if ($num > 0) { |
4376
|
4376
|
return 0; // Cache already loaded |
4377
|
4377
|
} |
4378
|
4378
|
|
4379
|
4379
|
$sql = "SELECT rowid, code, label"; |
4380
|
|
- $sql .= " FROM " . $this->db->prefix() . 'c_input_reason'; |
|
4380
|
+ $sql .= " FROM ".$this->db->prefix().'c_input_reason'; |
4381
|
4381
|
$sql .= " WHERE active > 0"; |
4382
|
4382
|
|
4383
|
4383
|
$resql = $this->db->query($sql); |
|
@@ -4390,8 +4390,8 @@ discard block |
|
|
block discarded – undo |
4390
|
4390
|
|
4391
|
4391
|
// Si traduction existe, on l'utilise, sinon on prend le libelle par default |
4392
|
4392
|
$label = ($obj->label != '-' ? $obj->label : ''); |
4393
|
|
- if ($langs->trans("DemandReasonType" . $obj->code) != "DemandReasonType" . $obj->code) { |
4394
|
|
- $label = $langs->trans("DemandReasonType" . $obj->code); // So translation key DemandReasonTypeSRC_XXX will work |
|
4393
|
+ if ($langs->trans("DemandReasonType".$obj->code) != "DemandReasonType".$obj->code) { |
|
4394
|
+ $label = $langs->trans("DemandReasonType".$obj->code); // So translation key DemandReasonTypeSRC_XXX will work |
4395
|
4395
|
} |
4396
|
4396
|
if ($langs->trans($obj->code) != $obj->code) { |
4397
|
4397
|
$label = $langs->trans($obj->code); // So translation key SRC_XXX will work |
|
@@ -4431,9 +4431,9 @@ discard block |
|
|
block discarded – undo |
4431
|
4431
|
|
4432
|
4432
|
$this->loadCacheInputReason(); |
4433
|
4433
|
|
4434
|
|
- print '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" id="select_' . $htmlname . '" name="' . $htmlname . '">'; |
|
4434
|
+ print '<select class="flat'.($morecss ? ' '.$morecss : '').'" id="select_'.$htmlname.'" name="'.$htmlname.'">'; |
4435
|
4435
|
if ($addempty) { |
4436
|
|
- print '<option value="0"' . (empty($selected) ? ' selected' : '') . '> </option>'; |
|
4436
|
+ print '<option value="0"'.(empty($selected) ? ' selected' : '').'> </option>'; |
4437
|
4437
|
} |
4438
|
4438
|
foreach ($this->cache_demand_reason as $id => $arraydemandreason) { |
4439
|
4439
|
if ($arraydemandreason['code'] == $exclude) { |
|
@@ -4441,9 +4441,9 @@ discard block |
|
|
block discarded – undo |
4441
|
4441
|
} |
4442
|
4442
|
|
4443
|
4443
|
if ($selected && ($selected == $arraydemandreason['id'] || $selected == $arraydemandreason['code'])) { |
4444
|
|
- print '<option value="' . $arraydemandreason['id'] . '" selected>'; |
|
4444
|
+ print '<option value="'.$arraydemandreason['id'].'" selected>'; |
4445
|
4445
|
} else { |
4446
|
|
- print '<option value="' . $arraydemandreason['id'] . '">'; |
|
4446
|
+ print '<option value="'.$arraydemandreason['id'].'">'; |
4447
|
4447
|
} |
4448
|
4448
|
$label = $arraydemandreason['label']; // Translation of label was already done into the ->loadCacheInputReason |
4449
|
4449
|
print $langs->trans($label); |
|
@@ -4453,7 +4453,7 @@ discard block |
|
|
block discarded – undo |
4453
|
4453
|
if ($user->admin && empty($notooltip)) { |
4454
|
4454
|
print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); |
4455
|
4455
|
} |
4456
|
|
- print ajax_combobox('select_' . $htmlname); |
|
4456
|
+ print ajax_combobox('select_'.$htmlname); |
4457
|
4457
|
} |
4458
|
4458
|
|
4459
|
4459
|
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
@@ -4468,7 +4468,7 @@ discard block |
|
|
block discarded – undo |
4468
|
4468
|
// phpcs:enable |
4469
|
4469
|
global $langs; |
4470
|
4470
|
|
4471
|
|
- $num = count($this->cache_types_paiements); // TODO Use $conf->cache['payment_mode'] instead of $this->cache_types_paiements |
|
4471
|
+ $num = count($this->cache_types_paiements); // TODO Use $conf->cache['payment_mode'] instead of $this->cache_types_paiements |
4472
|
4472
|
if ($num > 0) { |
4473
|
4473
|
return $num; // Cache already loaded |
4474
|
4474
|
} |
|
@@ -4478,8 +4478,8 @@ discard block |
|
|
block discarded – undo |
4478
|
4478
|
$this->cache_types_paiements = array(); |
4479
|
4479
|
|
4480
|
4480
|
$sql = "SELECT id, code, libelle as label, type, active"; |
4481
|
|
- $sql .= " FROM " . $this->db->prefix() . "c_paiement"; |
4482
|
|
- $sql .= " WHERE entity IN (" . getEntity('c_paiement') . ")"; |
|
4481
|
+ $sql .= " FROM ".$this->db->prefix()."c_paiement"; |
|
4482
|
+ $sql .= " WHERE entity IN (".getEntity('c_paiement').")"; |
4483
|
4483
|
|
4484
|
4484
|
$resql = $this->db->query($sql); |
4485
|
4485
|
if ($resql) { |
|
@@ -4489,7 +4489,7 @@ discard block |
|
|
block discarded – undo |
4489
|
4489
|
$obj = $this->db->fetch_object($resql); |
4490
|
4490
|
|
4491
|
4491
|
// Si traduction existe, on l'utilise, sinon on prend le libelle par default |
4492
|
|
- $label = ($langs->transnoentitiesnoconv("PaymentTypeShort" . $obj->code) != "PaymentTypeShort" . $obj->code ? $langs->transnoentitiesnoconv("PaymentTypeShort" . $obj->code) : ($obj->label != '-' ? $obj->label : '')); |
|
4492
|
+ $label = ($langs->transnoentitiesnoconv("PaymentTypeShort".$obj->code) != "PaymentTypeShort".$obj->code ? $langs->transnoentitiesnoconv("PaymentTypeShort".$obj->code) : ($obj->label != '-' ? $obj->label : '')); |
4493
|
4493
|
$this->cache_types_paiements[$obj->id]['id'] = $obj->id; |
4494
|
4494
|
$this->cache_types_paiements[$obj->id]['code'] = $obj->code; |
4495
|
4495
|
$this->cache_types_paiements[$obj->id]['label'] = $label; |
|
@@ -4561,17 +4561,17 @@ discard block |
|
|
block discarded – undo |
4561
|
4561
|
global $langs, $user, $conf; |
4562
|
4562
|
|
4563
|
4563
|
$out = ''; |
4564
|
|
- dol_syslog(__METHOD__ . " selected=" . $selected . ", htmlname=" . $htmlname, LOG_DEBUG); |
|
4564
|
+ dol_syslog(__METHOD__." selected=".$selected.", htmlname=".$htmlname, LOG_DEBUG); |
4565
|
4565
|
|
4566
|
4566
|
$this->load_cache_conditions_paiements(); |
4567
|
4567
|
|
4568
|
4568
|
// Set default value if not already set by caller |
4569
|
4569
|
if (empty($selected) && getDolGlobalString('MAIN_DEFAULT_PAYMENT_TERM_ID')) { |
4570
|
|
- dol_syslog(__METHOD__ . "Using deprecated option MAIN_DEFAULT_PAYMENT_TERM_ID", LOG_NOTICE); |
|
4570
|
+ dol_syslog(__METHOD__."Using deprecated option MAIN_DEFAULT_PAYMENT_TERM_ID", LOG_NOTICE); |
4571
|
4571
|
$selected = getDolGlobalString('MAIN_DEFAULT_PAYMENT_TERM_ID'); |
4572
|
4572
|
} |
4573
|
4573
|
|
4574
|
|
- $out .= '<select id="' . $htmlname . '" class="flat selectpaymentterms' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">'; |
|
4574
|
+ $out .= '<select id="'.$htmlname.'" class="flat selectpaymentterms'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">'; |
4575
|
4575
|
if ($addempty) { |
4576
|
4576
|
$out .= '<option value="0"> </option>'; |
4577
|
4577
|
} |
|
@@ -4585,9 +4585,9 @@ discard block |
|
|
block discarded – undo |
4585
|
4585
|
|
4586
|
4586
|
if ($selected == $id) { |
4587
|
4587
|
$selectedDepositPercent = $deposit_percent > 0 ? $deposit_percent : $arrayconditions['deposit_percent']; |
4588
|
|
- $out .= '<option value="' . $id . '" data-deposit_percent="' . $arrayconditions['deposit_percent'] . '" selected>'; |
|
4588
|
+ $out .= '<option value="'.$id.'" data-deposit_percent="'.$arrayconditions['deposit_percent'].'" selected>'; |
4589
|
4589
|
} else { |
4590
|
|
- $out .= '<option value="' . $id . '" data-deposit_percent="' . $arrayconditions['deposit_percent'] . '">'; |
|
4590
|
+ $out .= '<option value="'.$id.'" data-deposit_percent="'.$arrayconditions['deposit_percent'].'">'; |
4591
|
4591
|
} |
4592
|
4592
|
$label = $arrayconditions['label']; |
4593
|
4593
|
|
|
@@ -4605,21 +4605,21 @@ discard block |
|
|
block discarded – undo |
4605
|
4605
|
$out .= ajax_combobox($htmlname); |
4606
|
4606
|
|
4607
|
4607
|
if ($deposit_percent >= 0) { |
4608
|
|
- $out .= ' <span id="' . $htmlname . '_deposit_percent_container"' . (empty($selectedDepositPercent) ? ' style="display: none"' : '') . '>'; |
4609
|
|
- $out .= $langs->trans('DepositPercent') . ' : '; |
4610
|
|
- $out .= '<input id="' . $htmlname . '_deposit_percent" name="' . $htmlname . '_deposit_percent" class="maxwidth50" value="' . $deposit_percent . '" />'; |
|
4608
|
+ $out .= ' <span id="'.$htmlname.'_deposit_percent_container"'.(empty($selectedDepositPercent) ? ' style="display: none"' : '').'>'; |
|
4609
|
+ $out .= $langs->trans('DepositPercent').' : '; |
|
4610
|
+ $out .= '<input id="'.$htmlname.'_deposit_percent" name="'.$htmlname.'_deposit_percent" class="maxwidth50" value="'.$deposit_percent.'" />'; |
4611
|
4611
|
$out .= '</span>'; |
4612
|
4612
|
$out .= ' |
4613
|
|
- <script nonce="' . getNonce() . '"> |
|
4613
|
+ <script nonce="' . getNonce().'"> |
4614
|
4614
|
$(document).ready(function () { |
4615
|
|
- $("#' . $htmlname . '").change(function () { |
|
4615
|
+ $("#' . $htmlname.'").change(function () { |
4616
|
4616
|
let $selected = $(this).find("option:selected"); |
4617
|
4617
|
let depositPercent = $selected.attr("data-deposit_percent"); |
4618
|
4618
|
|
4619
|
4619
|
if (depositPercent.length > 0) { |
4620
|
|
- $("#' . $htmlname . '_deposit_percent_container").show().find("#' . $htmlname . '_deposit_percent").val(depositPercent); |
|
4620
|
+ $("#' . $htmlname.'_deposit_percent_container").show().find("#'.$htmlname.'_deposit_percent").val(depositPercent); |
4621
|
4621
|
} else { |
4622
|
|
- $("#' . $htmlname . '_deposit_percent_container").hide(); |
|
4622
|
+ $("#' . $htmlname.'_deposit_percent_container").hide(); |
4623
|
4623
|
} |
4624
|
4624
|
|
4625
|
4625
|
return true; |
|
@@ -4657,7 +4657,7 @@ discard block |
|
|
block discarded – undo |
4657
|
4657
|
|
4658
|
4658
|
$out = ''; |
4659
|
4659
|
|
4660
|
|
- dol_syslog(__METHOD__ . " " . $selected . ", " . $htmlname . ", " . $filtertype . ", " . $format, LOG_DEBUG); |
|
4660
|
+ dol_syslog(__METHOD__." ".$selected.", ".$htmlname.", ".$filtertype.", ".$format, LOG_DEBUG); |
4661
|
4661
|
|
4662
|
4662
|
$filterarray = array(); |
4663
|
4663
|
if ($filtertype == 'CRDT') { |
|
@@ -4672,11 +4672,11 @@ discard block |
|
|
block discarded – undo |
4672
|
4672
|
|
4673
|
4673
|
// Set default value if not already set by caller |
4674
|
4674
|
if (empty($selected) && getDolGlobalString('MAIN_DEFAULT_PAYMENT_TYPE_ID')) { |
4675
|
|
- dol_syslog(__METHOD__ . "Using deprecated option MAIN_DEFAULT_PAYMENT_TYPE_ID", LOG_NOTICE); |
|
4675
|
+ dol_syslog(__METHOD__."Using deprecated option MAIN_DEFAULT_PAYMENT_TYPE_ID", LOG_NOTICE); |
4676
|
4676
|
$selected = getDolGlobalString('MAIN_DEFAULT_PAYMENT_TYPE_ID'); |
4677
|
4677
|
} |
4678
|
4678
|
|
4679
|
|
- $out .= '<select id="select' . $htmlname . '" class="flat selectpaymenttypes' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">'; |
|
4679
|
+ $out .= '<select id="select'.$htmlname.'" class="flat selectpaymenttypes'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">'; |
4680
|
4680
|
if ($empty) { |
4681
|
4681
|
$out .= '<option value=""> </option>'; |
4682
|
4682
|
} |
|
@@ -4697,13 +4697,13 @@ discard block |
|
|
block discarded – undo |
4697
|
4697
|
} |
4698
|
4698
|
|
4699
|
4699
|
if ($format == 0) { |
4700
|
|
- $out .= '<option value="' . $id . '"'; |
|
4700
|
+ $out .= '<option value="'.$id.'"'; |
4701
|
4701
|
} elseif ($format == 1) { |
4702
|
|
- $out .= '<option value="' . $arraytypes['code'] . '"'; |
|
4702
|
+ $out .= '<option value="'.$arraytypes['code'].'"'; |
4703
|
4703
|
} elseif ($format == 2) { |
4704
|
|
- $out .= '<option value="' . $arraytypes['code'] . '"'; |
|
4704
|
+ $out .= '<option value="'.$arraytypes['code'].'"'; |
4705
|
4705
|
} elseif ($format == 3) { |
4706
|
|
- $out .= '<option value="' . $id . '"'; |
|
4706
|
+ $out .= '<option value="'.$id.'"'; |
4707
|
4707
|
} |
4708
|
4708
|
// Print attribute selected or not |
4709
|
4709
|
if ($format == 1 || $format == 2) { |
|
@@ -4733,7 +4733,7 @@ discard block |
|
|
block discarded – undo |
4733
|
4733
|
if ($user->admin && !$noadmininfo) { |
4734
|
4734
|
$out .= info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); |
4735
|
4735
|
} |
4736
|
|
- $out .= ajax_combobox('select' . $htmlname); |
|
4736
|
+ $out .= ajax_combobox('select'.$htmlname); |
4737
|
4737
|
|
4738
|
4738
|
if (empty($nooutput)) { |
4739
|
4739
|
print $out; |
|
@@ -4755,22 +4755,22 @@ discard block |
|
|
block discarded – undo |
4755
|
4755
|
{ |
4756
|
4756
|
global $langs; |
4757
|
4757
|
|
4758
|
|
- $return = '<select class="flat maxwidth100" id="select_' . $htmlname . '" name="' . $htmlname . '">'; |
|
4758
|
+ $return = '<select class="flat maxwidth100" id="select_'.$htmlname.'" name="'.$htmlname.'">'; |
4759
|
4759
|
$options = array( |
4760
|
4760
|
'HT' => $langs->trans("HT"), |
4761
|
4761
|
'TTC' => $langs->trans("TTC") |
4762
|
4762
|
); |
4763
|
4763
|
foreach ($options as $id => $value) { |
4764
|
4764
|
if ($selected == $id) { |
4765
|
|
- $return .= '<option value="' . $id . '" selected>' . $value; |
|
4765
|
+ $return .= '<option value="'.$id.'" selected>'.$value; |
4766
|
4766
|
} else { |
4767
|
|
- $return .= '<option value="' . $id . '">' . $value; |
|
4767
|
+ $return .= '<option value="'.$id.'">'.$value; |
4768
|
4768
|
} |
4769
|
4769
|
$return .= '</option>'; |
4770
|
4770
|
} |
4771
|
4771
|
$return .= '</select>'; |
4772
|
4772
|
if ($addjscombo) { |
4773
|
|
- $return .= ajax_combobox('select_' . $htmlname); |
|
4773
|
+ $return .= ajax_combobox('select_'.$htmlname); |
4774
|
4774
|
} |
4775
|
4775
|
|
4776
|
4776
|
return $return; |
|
@@ -4788,7 +4788,7 @@ discard block |
|
|
block discarded – undo |
4788
|
4788
|
// phpcs:enable |
4789
|
4789
|
global $langs; |
4790
|
4790
|
|
4791
|
|
- $num = count($this->cache_transport_mode); // TODO Use $conf->cache['payment_mode'] instead of $this->cache_transport_mode |
|
4791
|
+ $num = count($this->cache_transport_mode); // TODO Use $conf->cache['payment_mode'] instead of $this->cache_transport_mode |
4792
|
4792
|
if ($num > 0) { |
4793
|
4793
|
return $num; // Cache already loaded |
4794
|
4794
|
} |
|
@@ -4798,8 +4798,8 @@ discard block |
|
|
block discarded – undo |
4798
|
4798
|
$this->cache_transport_mode = array(); |
4799
|
4799
|
|
4800
|
4800
|
$sql = "SELECT rowid, code, label, active"; |
4801
|
|
- $sql .= " FROM " . $this->db->prefix() . "c_transport_mode"; |
4802
|
|
- $sql .= " WHERE entity IN (" . getEntity('c_transport_mode') . ")"; |
|
4801
|
+ $sql .= " FROM ".$this->db->prefix()."c_transport_mode"; |
|
4802
|
+ $sql .= " WHERE entity IN (".getEntity('c_transport_mode').")"; |
4803
|
4803
|
|
4804
|
4804
|
$resql = $this->db->query($sql); |
4805
|
4805
|
if ($resql) { |
|
@@ -4809,7 +4809,7 @@ discard block |
|
|
block discarded – undo |
4809
|
4809
|
$obj = $this->db->fetch_object($resql); |
4810
|
4810
|
|
4811
|
4811
|
// If traduction exist, we use it else we take the default label |
4812
|
|
- $label = ($langs->transnoentitiesnoconv("PaymentTypeShort" . $obj->code) != "PaymentTypeShort" . $obj->code ? $langs->transnoentitiesnoconv("PaymentTypeShort" . $obj->code) : ($obj->label != '-' ? $obj->label : '')); |
|
4812
|
+ $label = ($langs->transnoentitiesnoconv("PaymentTypeShort".$obj->code) != "PaymentTypeShort".$obj->code ? $langs->transnoentitiesnoconv("PaymentTypeShort".$obj->code) : ($obj->label != '-' ? $obj->label : '')); |
4813
|
4813
|
$this->cache_transport_mode[$obj->rowid]['rowid'] = $obj->rowid; |
4814
|
4814
|
$this->cache_transport_mode[$obj->rowid]['code'] = $obj->code; |
4815
|
4815
|
$this->cache_transport_mode[$obj->rowid]['label'] = $label; |
|
@@ -4843,11 +4843,11 @@ discard block |
|
|
block discarded – undo |
4843
|
4843
|
{ |
4844
|
4844
|
global $langs, $user; |
4845
|
4845
|
|
4846
|
|
- dol_syslog(__METHOD__ . " " . $selected . ", " . $htmlname . ", " . $format, LOG_DEBUG); |
|
4846
|
+ dol_syslog(__METHOD__." ".$selected.", ".$htmlname.", ".$format, LOG_DEBUG); |
4847
|
4847
|
|
4848
|
4848
|
$this->load_cache_transport_mode(); |
4849
|
4849
|
|
4850
|
|
- print '<select id="select' . $htmlname . '" class="flat selectmodetransport' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">'; |
|
4850
|
+ print '<select id="select'.$htmlname.'" class="flat selectmodetransport'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">'; |
4851
|
4851
|
if ($empty) { |
4852
|
4852
|
print '<option value=""> </option>'; |
4853
|
4853
|
} |
|
@@ -4863,13 +4863,13 @@ discard block |
|
|
block discarded – undo |
4863
|
4863
|
} |
4864
|
4864
|
|
4865
|
4865
|
if ($format == 0) { |
4866
|
|
- print '<option value="' . $id . '"'; |
|
4866
|
+ print '<option value="'.$id.'"'; |
4867
|
4867
|
} elseif ($format == 1) { |
4868
|
|
- print '<option value="' . $arraytypes['code'] . '"'; |
|
4868
|
+ print '<option value="'.$arraytypes['code'].'"'; |
4869
|
4869
|
} elseif ($format == 2) { |
4870
|
|
- print '<option value="' . $arraytypes['code'] . '"'; |
|
4870
|
+ print '<option value="'.$arraytypes['code'].'"'; |
4871
|
4871
|
} elseif ($format == 3) { |
4872
|
|
- print '<option value="' . $id . '"'; |
|
4872
|
+ print '<option value="'.$id.'"'; |
4873
|
4873
|
} |
4874
|
4874
|
// If text is selected, we compare with code, else with id |
4875
|
4875
|
if (preg_match('/[a-z]/i', $selected) && $selected == $arraytypes['code']) { |
|
@@ -4917,31 +4917,31 @@ discard block |
|
|
block discarded – undo |
4917
|
4917
|
$langs->load("deliveries"); |
4918
|
4918
|
|
4919
|
4919
|
$sql = "SELECT rowid, code, libelle as label"; |
4920
|
|
- $sql .= " FROM " . $this->db->prefix() . "c_shipment_mode"; |
|
4920
|
+ $sql .= " FROM ".$this->db->prefix()."c_shipment_mode"; |
4921
|
4921
|
$sql .= " WHERE active > 0"; |
4922
|
4922
|
if ($filtre) { |
4923
|
|
- $sql .= " AND " . $filtre; |
|
4923
|
+ $sql .= " AND ".$filtre; |
4924
|
4924
|
} |
4925
|
4925
|
$sql .= " ORDER BY libelle ASC"; |
4926
|
4926
|
|
4927
|
|
- dol_syslog(get_class($this) . "::selectShippingMode", LOG_DEBUG); |
|
4927
|
+ dol_syslog(get_class($this)."::selectShippingMode", LOG_DEBUG); |
4928
|
4928
|
$result = $this->db->query($sql); |
4929
|
4929
|
if ($result) { |
4930
|
4930
|
$num = $this->db->num_rows($result); |
4931
|
4931
|
$i = 0; |
4932
|
4932
|
if ($num) { |
4933
|
|
- print '<select id="select' . $htmlname . '" class="flat selectshippingmethod' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '"' . ($moreattrib ? ' ' . $moreattrib : '') . '>'; |
|
4933
|
+ print '<select id="select'.$htmlname.'" class="flat selectshippingmethod'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'"'.($moreattrib ? ' '.$moreattrib : '').'>'; |
4934
|
4934
|
if ($useempty == 1 || ($useempty == 2 && $num > 1)) { |
4935
|
4935
|
print '<option value="-1"> </option>'; |
4936
|
4936
|
} |
4937
|
4937
|
while ($i < $num) { |
4938
|
4938
|
$obj = $this->db->fetch_object($result); |
4939
|
4939
|
if ($selected == $obj->rowid) { |
4940
|
|
- print '<option value="' . $obj->rowid . '" selected>'; |
|
4940
|
+ print '<option value="'.$obj->rowid.'" selected>'; |
4941
|
4941
|
} else { |
4942
|
|
- print '<option value="' . $obj->rowid . '">'; |
|
4942
|
+ print '<option value="'.$obj->rowid.'">'; |
4943
|
4943
|
} |
4944
|
|
- print ($langs->trans("SendingMethod" . strtoupper($obj->code)) != "SendingMethod" . strtoupper($obj->code)) ? $langs->trans("SendingMethod" . strtoupper($obj->code)) : $obj->label; |
|
4944
|
+ print ($langs->trans("SendingMethod".strtoupper($obj->code)) != "SendingMethod".strtoupper($obj->code)) ? $langs->trans("SendingMethod".strtoupper($obj->code)) : $obj->label; |
4945
|
4945
|
print '</option>'; |
4946
|
4946
|
$i++; |
4947
|
4947
|
} |
|
@@ -4950,7 +4950,7 @@ discard block |
|
|
block discarded – undo |
4950
|
4950
|
print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); |
4951
|
4951
|
} |
4952
|
4952
|
|
4953
|
|
- print ajax_combobox('select' . $htmlname); |
|
4953
|
+ print ajax_combobox('select'.$htmlname); |
4954
|
4954
|
} else { |
4955
|
4955
|
print $langs->trans("NoShippingMethodDefined"); |
4956
|
4956
|
} |
|
@@ -4975,16 +4975,16 @@ discard block |
|
|
block discarded – undo |
4975
|
4975
|
$langs->load("deliveries"); |
4976
|
4976
|
|
4977
|
4977
|
if ($htmlname != "none") { |
4978
|
|
- print '<form method="POST" action="' . $page . '">'; |
|
4978
|
+ print '<form method="POST" action="'.$page.'">'; |
4979
|
4979
|
print '<input type="hidden" name="action" value="setshippingmethod">'; |
4980
|
|
- print '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
4980
|
+ print '<input type="hidden" name="token" value="'.newToken().'">'; |
4981
|
4981
|
$this->selectShippingMethod($selected, $htmlname, '', $addempty); |
4982
|
|
- print '<input type="submit" class="button valignmiddle" value="' . $langs->trans("Modify") . '">'; |
|
4982
|
+ print '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">'; |
4983
|
4983
|
print '</form>'; |
4984
|
4984
|
} else { |
4985
|
4985
|
if ($selected) { |
4986
|
4986
|
$code = $langs->getLabelFromKey($this->db, $selected, 'c_shipment_mode', 'rowid', 'code'); |
4987
|
|
- print $langs->trans("SendingMethod" . strtoupper($code)); |
|
4987
|
+ print $langs->trans("SendingMethod".strtoupper($code)); |
4988
|
4988
|
} else { |
4989
|
4989
|
print " "; |
4990
|
4990
|
} |
|
@@ -5007,10 +5007,10 @@ discard block |
|
|
block discarded – undo |
5007
|
5007
|
|
5008
|
5008
|
$opt = '<option value="" selected></option>'; |
5009
|
5009
|
$sql = "SELECT rowid, ref, situation_cycle_ref, situation_counter, situation_final, fk_soc"; |
5010
|
|
- $sql .= ' FROM ' . $this->db->prefix() . 'facture'; |
5011
|
|
- $sql .= ' WHERE entity IN (' . getEntity('invoice') . ')'; |
|
5010
|
+ $sql .= ' FROM '.$this->db->prefix().'facture'; |
|
5011
|
+ $sql .= ' WHERE entity IN ('.getEntity('invoice').')'; |
5012
|
5012
|
$sql .= ' AND situation_counter >= 1'; |
5013
|
|
- $sql .= ' AND fk_soc = ' . (int) $socid; |
|
5013
|
+ $sql .= ' AND fk_soc = '.(int) $socid; |
5014
|
5014
|
$sql .= ' AND type <> 2'; |
5015
|
5015
|
$sql .= ' ORDER by situation_cycle_ref, situation_counter desc'; |
5016
|
5016
|
$resql = $this->db->query($sql); |
|
@@ -5028,19 +5028,19 @@ discard block |
|
|
block discarded – undo |
5028
|
5028
|
//Not prov? |
5029
|
5029
|
if (substr($obj->ref, 1, 4) != 'PROV') { |
5030
|
5030
|
if ($selected == $obj->rowid) { |
5031
|
|
- $opt .= '<option value="' . $obj->rowid . '" selected>' . $obj->ref . '</option>'; |
|
5031
|
+ $opt .= '<option value="'.$obj->rowid.'" selected>'.$obj->ref.'</option>'; |
5032
|
5032
|
} else { |
5033
|
|
- $opt .= '<option value="' . $obj->rowid . '">' . $obj->ref . '</option>'; |
|
5033
|
+ $opt .= '<option value="'.$obj->rowid.'">'.$obj->ref.'</option>'; |
5034
|
5034
|
} |
5035
|
5035
|
} |
5036
|
5036
|
} |
5037
|
5037
|
} |
5038
|
5038
|
} |
5039
|
5039
|
} else { |
5040
|
|
- dol_syslog("Error sql=" . $sql . ", error=" . $this->error, LOG_ERR); |
|
5040
|
+ dol_syslog("Error sql=".$sql.", error=".$this->error, LOG_ERR); |
5041
|
5041
|
} |
5042
|
5042
|
if ($opt == '<option value ="" selected></option>') { |
5043
|
|
- $opt = '<option value ="0" selected>' . $langs->trans('NoSituations') . '</option>'; |
|
5043
|
+ $opt = '<option value ="0" selected>'.$langs->trans('NoSituations').'</option>'; |
5044
|
5044
|
} |
5045
|
5045
|
return $opt; |
5046
|
5046
|
} |
|
@@ -5060,12 +5060,12 @@ discard block |
|
|
block discarded – undo |
5060
|
5060
|
|
5061
|
5061
|
$langs->load('products'); |
5062
|
5062
|
|
5063
|
|
- $return = '<select class="flat" id="' . $htmlname . '" name="' . $htmlname . '">'; |
|
5063
|
+ $return = '<select class="flat" id="'.$htmlname.'" name="'.$htmlname.'">'; |
5064
|
5064
|
|
5065
|
|
- $sql = "SELECT rowid, label, code FROM " . $this->db->prefix() . "c_units"; |
|
5065
|
+ $sql = "SELECT rowid, label, code FROM ".$this->db->prefix()."c_units"; |
5066
|
5066
|
$sql .= ' WHERE active > 0'; |
5067
|
5067
|
if (!empty($unit_type)) { |
5068
|
|
- $sql .= " AND unit_type = '" . $this->db->escape($unit_type) . "'"; |
|
5068
|
+ $sql .= " AND unit_type = '".$this->db->escape($unit_type)."'"; |
5069
|
5069
|
} |
5070
|
5070
|
$sql .= " ORDER BY sortorder"; |
5071
|
5071
|
|
|
@@ -5077,14 +5077,14 @@ discard block |
|
|
block discarded – undo |
5077
|
5077
|
|
5078
|
5078
|
while ($res = $this->db->fetch_object($resql)) { |
5079
|
5079
|
$unitLabel = $res->label; |
5080
|
|
- if (!empty($langs->tab_translate['unit' . $res->code])) { // check if Translation is available before |
5081
|
|
- $unitLabel = $langs->trans('unit' . $res->code) != $res->label ? $langs->trans('unit' . $res->code) : $res->label; |
|
5080
|
+ if (!empty($langs->tab_translate['unit'.$res->code])) { // check if Translation is available before |
|
5081
|
+ $unitLabel = $langs->trans('unit'.$res->code) != $res->label ? $langs->trans('unit'.$res->code) : $res->label; |
5082
|
5082
|
} |
5083
|
5083
|
|
5084
|
5084
|
if ($selected == $res->rowid) { |
5085
|
|
- $return .= '<option value="' . $res->rowid . '" selected>' . $unitLabel . '</option>'; |
|
5085
|
+ $return .= '<option value="'.$res->rowid.'" selected>'.$unitLabel.'</option>'; |
5086
|
5086
|
} else { |
5087
|
|
- $return .= '<option value="' . $res->rowid . '">' . $unitLabel . '</option>'; |
|
5087
|
+ $return .= '<option value="'.$res->rowid.'">'.$unitLabel.'</option>'; |
5088
|
5088
|
} |
5089
|
5089
|
} |
5090
|
5090
|
$return .= '</select>'; |
|
@@ -5119,23 +5119,23 @@ discard block |
|
|
block discarded – undo |
5119
|
5119
|
$num = 0; |
5120
|
5120
|
|
5121
|
5121
|
$sql = "SELECT rowid, label, bank, clos as status, currency_code"; |
5122
|
|
- $sql .= " FROM " . $this->db->prefix() . "bank_account"; |
5123
|
|
- $sql .= " WHERE entity IN (" . getEntity('bank_account') . ")"; |
|
5122
|
+ $sql .= " FROM ".$this->db->prefix()."bank_account"; |
|
5123
|
+ $sql .= " WHERE entity IN (".getEntity('bank_account').")"; |
5124
|
5124
|
if ($status != 2) { |
5125
|
|
- $sql .= " AND clos = " . (int) $status; |
|
5125
|
+ $sql .= " AND clos = ".(int) $status; |
5126
|
5126
|
} |
5127
|
5127
|
if ($filtre) { // TODO Support USF |
5128
|
|
- $sql .= " AND " . $filtre; |
|
5128
|
+ $sql .= " AND ".$filtre; |
5129
|
5129
|
} |
5130
|
5130
|
$sql .= " ORDER BY label"; |
5131
|
5131
|
|
5132
|
|
- dol_syslog(get_class($this) . "::select_comptes", LOG_DEBUG); |
|
5132
|
+ dol_syslog(get_class($this)."::select_comptes", LOG_DEBUG); |
5133
|
5133
|
$result = $this->db->query($sql); |
5134
|
5134
|
if ($result) { |
5135
|
5135
|
$num = $this->db->num_rows($result); |
5136
|
5136
|
$i = 0; |
5137
|
5137
|
if ($num) { |
5138
|
|
- $out .= '<select id="select' . $htmlname . '" class="flat selectbankaccount' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '"' . ($moreattrib ? ' ' . $moreattrib : '') . '>'; |
|
5138
|
+ $out .= '<select id="select'.$htmlname.'" class="flat selectbankaccount'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'"'.($moreattrib ? ' '.$moreattrib : '').'>'; |
5139
|
5139
|
|
5140
|
5140
|
if (!empty($useempty) && !is_numeric($useempty)) { |
5141
|
5141
|
$out .= '<option value="-1">'.$langs->trans($useempty).'</option>'; |
|
@@ -5146,27 +5146,27 @@ discard block |
|
|
block discarded – undo |
5146
|
5146
|
while ($i < $num) { |
5147
|
5147
|
$obj = $this->db->fetch_object($result); |
5148
|
5148
|
if ($selected == $obj->rowid || ($useempty == 2 && $num == 1 && empty($selected))) { |
5149
|
|
- $out .= '<option value="' . $obj->rowid . '" data-currency-code="' . $obj->currency_code . '" selected>'; |
|
5149
|
+ $out .= '<option value="'.$obj->rowid.'" data-currency-code="'.$obj->currency_code.'" selected>'; |
5150
|
5150
|
} else { |
5151
|
|
- $out .= '<option value="' . $obj->rowid . '" data-currency-code="' . $obj->currency_code . '">'; |
|
5151
|
+ $out .= '<option value="'.$obj->rowid.'" data-currency-code="'.$obj->currency_code.'">'; |
5152
|
5152
|
} |
5153
|
5153
|
$out .= trim($obj->label); |
5154
|
5154
|
if ($showcurrency) { |
5155
|
|
- $out .= ' (' . $obj->currency_code . ')'; |
|
5155
|
+ $out .= ' ('.$obj->currency_code.')'; |
5156
|
5156
|
} |
5157
|
5157
|
if ($status == 2 && $obj->status == 1) { |
5158
|
|
- $out .= ' (' . $langs->trans("Closed") . ')'; |
|
5158
|
+ $out .= ' ('.$langs->trans("Closed").')'; |
5159
|
5159
|
} |
5160
|
5160
|
$out .= '</option>'; |
5161
|
5161
|
$i++; |
5162
|
5162
|
} |
5163
|
5163
|
$out .= "</select>"; |
5164
|
|
- $out .= ajax_combobox('select' . $htmlname); |
|
5164
|
+ $out .= ajax_combobox('select'.$htmlname); |
5165
|
5165
|
} else { |
5166
|
5166
|
if ($status == 0) { |
5167
|
|
- $out .= '<span class="opacitymedium">' . $langs->trans("NoActiveBankAccountDefined") . '</span>'; |
|
5167
|
+ $out .= '<span class="opacitymedium">'.$langs->trans("NoActiveBankAccountDefined").'</span>'; |
5168
|
5168
|
} else { |
5169
|
|
- $out .= '<span class="opacitymedium">' . $langs->trans("NoBankAccountFound") . '</span>'; |
|
5169
|
+ $out .= '<span class="opacitymedium">'.$langs->trans("NoBankAccountFound").'</span>'; |
5170
|
5170
|
} |
5171
|
5171
|
} |
5172
|
5172
|
} else { |
|
@@ -5202,23 +5202,23 @@ discard block |
|
|
block discarded – undo |
5202
|
5202
|
$num = 0; |
5203
|
5203
|
|
5204
|
5204
|
$sql = "SELECT rowid, name, fk_country, status, entity"; |
5205
|
|
- $sql .= " FROM " . $this->db->prefix() . "establishment"; |
|
5205
|
+ $sql .= " FROM ".$this->db->prefix()."establishment"; |
5206
|
5206
|
$sql .= " WHERE 1=1"; |
5207
|
5207
|
if ($status != 2) { |
5208
|
|
- $sql .= " AND status = " . (int) $status; |
|
5208
|
+ $sql .= " AND status = ".(int) $status; |
5209
|
5209
|
} |
5210
|
5210
|
if ($filtre) { // TODO Support USF |
5211
|
|
- $sql .= " AND " . $filtre; |
|
5211
|
+ $sql .= " AND ".$filtre; |
5212
|
5212
|
} |
5213
|
5213
|
$sql .= " ORDER BY name"; |
5214
|
5214
|
|
5215
|
|
- dol_syslog(get_class($this) . "::select_establishment", LOG_DEBUG); |
|
5215
|
+ dol_syslog(get_class($this)."::select_establishment", LOG_DEBUG); |
5216
|
5216
|
$result = $this->db->query($sql); |
5217
|
5217
|
if ($result) { |
5218
|
5218
|
$num = $this->db->num_rows($result); |
5219
|
5219
|
$i = 0; |
5220
|
5220
|
if ($num) { |
5221
|
|
- print '<select id="select' . $htmlname . '" class="flat selectestablishment" name="' . $htmlname . '"' . ($moreattrib ? ' ' . $moreattrib : '') . '>'; |
|
5221
|
+ print '<select id="select'.$htmlname.'" class="flat selectestablishment" name="'.$htmlname.'"'.($moreattrib ? ' '.$moreattrib : '').'>'; |
5222
|
5222
|
if ($useempty == 1 || ($useempty == 2 && $num > 1)) { |
5223
|
5223
|
print '<option value="-1"> </option>'; |
5224
|
5224
|
} |
|
@@ -5226,13 +5226,13 @@ discard block |
|
|
block discarded – undo |
5226
|
5226
|
while ($i < $num) { |
5227
|
5227
|
$obj = $this->db->fetch_object($result); |
5228
|
5228
|
if ($selected == $obj->rowid) { |
5229
|
|
- print '<option value="' . $obj->rowid . '" selected>'; |
|
5229
|
+ print '<option value="'.$obj->rowid.'" selected>'; |
5230
|
5230
|
} else { |
5231
|
|
- print '<option value="' . $obj->rowid . '">'; |
|
5231
|
+ print '<option value="'.$obj->rowid.'">'; |
5232
|
5232
|
} |
5233
|
5233
|
print trim($obj->name); |
5234
|
5234
|
if ($status == 2 && $obj->status == 1) { |
5235
|
|
- print ' (' . $langs->trans("Closed") . ')'; |
|
5235
|
+ print ' ('.$langs->trans("Closed").')'; |
5236
|
5236
|
} |
5237
|
5237
|
print '</option>'; |
5238
|
5238
|
$i++; |
|
@@ -5240,9 +5240,9 @@ discard block |
|
|
block discarded – undo |
5240
|
5240
|
print "</select>"; |
5241
|
5241
|
} else { |
5242
|
5242
|
if ($status == 0) { |
5243
|
|
- print '<span class="opacitymedium">' . $langs->trans("NoActiveEstablishmentDefined") . '</span>'; |
|
5243
|
+ print '<span class="opacitymedium">'.$langs->trans("NoActiveEstablishmentDefined").'</span>'; |
5244
|
5244
|
} else { |
5245
|
|
- print '<span class="opacitymedium">' . $langs->trans("NoEstablishmentFound") . '</span>'; |
|
5245
|
+ print '<span class="opacitymedium">'.$langs->trans("NoEstablishmentFound").'</span>'; |
5246
|
5246
|
} |
5247
|
5247
|
} |
5248
|
5248
|
|
|
@@ -5266,20 +5266,20 @@ discard block |
|
|
block discarded – undo |
5266
|
5266
|
{ |
5267
|
5267
|
global $langs; |
5268
|
5268
|
if ($htmlname != "none") { |
5269
|
|
- print '<form method="POST" action="' . $page . '">'; |
|
5269
|
+ print '<form method="POST" action="'.$page.'">'; |
5270
|
5270
|
print '<input type="hidden" name="action" value="setbankaccount">'; |
5271
|
|
- print '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
5271
|
+ print '<input type="hidden" name="token" value="'.newToken().'">'; |
5272
|
5272
|
print img_picto('', 'bank_account', 'class="pictofixedwidth"'); |
5273
|
5273
|
$nbaccountfound = $this->select_comptes($selected, $htmlname, 0, '', $addempty); |
5274
|
5274
|
if ($nbaccountfound > 0) { |
5275
|
|
- print '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">'; |
|
5275
|
+ print '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">'; |
5276
|
5276
|
} |
5277
|
5277
|
print '</form>'; |
5278
|
5278
|
} else { |
5279
|
5279
|
$langs->load('banks'); |
5280
|
5280
|
|
5281
|
5281
|
if ($selected) { |
5282
|
|
- require_once DOL_DOCUMENT_ROOT . '/compta/bank/class/account.class.php'; |
|
5282
|
+ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; |
5283
|
5283
|
$bankstatic = new Account($this->db); |
5284
|
5284
|
$result = $bankstatic->fetch($selected); |
5285
|
5285
|
if ($result) { |
|
@@ -5318,19 +5318,19 @@ discard block |
|
|
block discarded – undo |
5318
|
5318
|
global $conf, $langs; |
5319
|
5319
|
$langs->load("categories"); |
5320
|
5320
|
|
5321
|
|
- include_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; |
|
5321
|
+ include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; |
5322
|
5322
|
|
5323
|
5323
|
// For backward compatibility |
5324
|
5324
|
if (is_numeric($type)) { |
5325
|
|
- dol_syslog(__METHOD__ . ': using numeric value for parameter type is deprecated. Use string code instead.', LOG_WARNING); |
|
5325
|
+ dol_syslog(__METHOD__.': using numeric value for parameter type is deprecated. Use string code instead.', LOG_WARNING); |
5326
|
5326
|
} |
5327
|
5327
|
|
5328
|
5328
|
if ($type === Categorie::TYPE_BANK_LINE) { |
5329
|
5329
|
// TODO Move this into common category feature |
5330
|
5330
|
$cate_arbo = array(); |
5331
|
5331
|
$sql = "SELECT c.label, c.rowid"; |
5332
|
|
- $sql .= " FROM " . $this->db->prefix() . "category_bank as c"; |
5333
|
|
- $sql .= " WHERE entity = " . $conf->entity; |
|
5332
|
+ $sql .= " FROM ".$this->db->prefix()."category_bank as c"; |
|
5333
|
+ $sql .= " WHERE entity = ".$conf->entity; |
5334
|
5334
|
$sql .= " ORDER BY c.label"; |
5335
|
5335
|
$result = $this->db->query($sql); |
5336
|
5336
|
if ($result) { |
|
@@ -5356,12 +5356,12 @@ discard block |
|
|
block discarded – undo |
5356
|
5356
|
$outarrayrichhtml = array(); |
5357
|
5357
|
|
5358
|
5358
|
|
5359
|
|
- $output = '<select class="flat minwidth100' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">'; |
|
5359
|
+ $output = '<select class="flat minwidth100'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">'; |
5360
|
5360
|
if (is_array($cate_arbo)) { |
5361
|
5361
|
$num = count($cate_arbo); |
5362
|
5362
|
|
5363
|
5363
|
if (!$num) { |
5364
|
|
- $output .= '<option value="-1" disabled>' . $langs->trans("NoCategoriesDefined") . '</option>'; |
|
5364
|
+ $output .= '<option value="-1" disabled>'.$langs->trans("NoCategoriesDefined").'</option>'; |
5365
|
5365
|
} else { |
5366
|
5366
|
if ($useempty == 1 || ($useempty == 2 && $num > 1)) { |
5367
|
5367
|
$output .= '<option value="-1"> </option>'; |
|
@@ -5373,15 +5373,15 @@ discard block |
|
|
block discarded – undo |
5373
|
5373
|
$add = ''; |
5374
|
5374
|
} |
5375
|
5375
|
|
5376
|
|
- $labeltoshow = img_picto('', 'category', 'class="pictofixedwidth" style="color: #' . $cate_arbo[$key]['color'] . '"'); |
|
5376
|
+ $labeltoshow = img_picto('', 'category', 'class="pictofixedwidth" style="color: #'.$cate_arbo[$key]['color'].'"'); |
5377
|
5377
|
$labeltoshow .= dol_trunc($cate_arbo[$key]['fulllabel'], $maxlength, 'middle'); |
5378
|
5378
|
|
5379
|
5379
|
$outarray[$cate_arbo[$key]['id']] = $cate_arbo[$key]['fulllabel']; |
5380
|
5380
|
|
5381
|
5381
|
$outarrayrichhtml[$cate_arbo[$key]['id']] = $labeltoshow; |
5382
|
5382
|
|
5383
|
|
- $output .= '<option ' . $add . 'value="' . $cate_arbo[$key]['id'] . '"'; |
5384
|
|
- $output .= ' data-html="' . dol_escape_htmltag($labeltoshow) . '"'; |
|
5383
|
+ $output .= '<option '.$add.'value="'.$cate_arbo[$key]['id'].'"'; |
|
5384
|
+ $output .= ' data-html="'.dol_escape_htmltag($labeltoshow).'"'; |
5385
|
5385
|
$output .= '>'; |
5386
|
5386
|
$output .= dol_trunc($cate_arbo[$key]['fulllabel'], $maxlength, 'middle'); |
5387
|
5387
|
$output .= '</option>'; |
|
@@ -5425,7 +5425,7 @@ discard block |
|
|
block discarded – undo |
5425
|
5425
|
public function form_confirm($page, $title, $question, $action, $formquestion = array(), $selectedchoice = "", $useajax = 0, $height = 170, $width = 500) |
5426
|
5426
|
{ |
5427
|
5427
|
// phpcs:enable |
5428
|
|
- dol_syslog(__METHOD__ . ': using form_confirm is deprecated. Use formconfim instead.', LOG_WARNING); |
|
5428
|
+ dol_syslog(__METHOD__.': using form_confirm is deprecated. Use formconfim instead.', LOG_WARNING); |
5429
|
5429
|
print $this->formconfirm($page, $title, $question, $action, $formquestion, $selectedchoice, $useajax, $height, $width); |
5430
|
5430
|
} |
5431
|
5431
|
|
|
@@ -5460,7 +5460,7 @@ discard block |
|
|
block discarded – undo |
5460
|
5460
|
{ |
5461
|
5461
|
global $langs, $conf; |
5462
|
5462
|
|
5463
|
|
- $more = '<!-- formconfirm - before call, page=' . dol_escape_htmltag($page) . ' -->'; |
|
5463
|
+ $more = '<!-- formconfirm - before call, page='.dol_escape_htmltag($page).' -->'; |
5464
|
5464
|
$formconfirm = ''; |
5465
|
5465
|
$inputok = array(); |
5466
|
5466
|
$inputko = array(); |
|
@@ -5484,27 +5484,27 @@ discard block |
|
|
block discarded – undo |
5484
|
5484
|
foreach ($formquestion as $key => $input) { |
5485
|
5485
|
if (is_array($input) && !empty($input)) { |
5486
|
5486
|
if ($input['type'] == 'hidden') { |
5487
|
|
- $moreattr = (!empty($input['moreattr']) ? ' ' . $input['moreattr'] : ''); |
5488
|
|
- $morecss = (!empty($input['morecss']) ? ' ' . $input['morecss'] : ''); |
|
5487
|
+ $moreattr = (!empty($input['moreattr']) ? ' '.$input['moreattr'] : ''); |
|
5488
|
+ $morecss = (!empty($input['morecss']) ? ' '.$input['morecss'] : ''); |
5489
|
5489
|
|
5490
|
|
- $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"; |
|
5490
|
+ $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"; |
5491
|
5491
|
} |
5492
|
5492
|
} |
5493
|
5493
|
} |
5494
|
5494
|
|
5495
|
5495
|
// Now add questions |
5496
|
5496
|
$moreonecolumn = ''; |
5497
|
|
- $more .= '<div class="tagtable paddingtopbottomonly centpercent noborderspacing">' . "\n"; |
|
5497
|
+ $more .= '<div class="tagtable paddingtopbottomonly centpercent noborderspacing">'."\n"; |
5498
|
5498
|
foreach ($formquestion as $key => $input) { |
5499
|
5499
|
if (is_array($input) && !empty($input)) { |
5500
|
|
- $size = (!empty($input['size']) ? ' size="' . $input['size'] . '"' : ''); // deprecated. Use morecss instead. |
5501
|
|
- $moreattr = (!empty($input['moreattr']) ? ' ' . $input['moreattr'] : ''); |
5502
|
|
- $morecss = (!empty($input['morecss']) ? ' ' . $input['morecss'] : ''); |
|
5500
|
+ $size = (!empty($input['size']) ? ' size="'.$input['size'].'"' : ''); // deprecated. Use morecss instead. |
|
5501
|
+ $moreattr = (!empty($input['moreattr']) ? ' '.$input['moreattr'] : ''); |
|
5502
|
+ $morecss = (!empty($input['morecss']) ? ' '.$input['morecss'] : ''); |
5503
|
5503
|
|
5504
|
5504
|
if ($input['type'] == 'text') { |
5505
|
|
- $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"; |
|
5505
|
+ $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"; |
5506
|
5506
|
} elseif ($input['type'] == 'password') { |
5507
|
|
- $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"; |
|
5507
|
+ $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"; |
5508
|
5508
|
} elseif ($input['type'] == 'textarea') { |
5509
|
5509
|
/*$more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">'.$input['label'].'</div><div class="tagtd">'; |
5510
|
5510
|
$more .= '<textarea name="'.$input['name'].'" class="'.$morecss.'"'.$moreattr.'>'; |
|
@@ -5512,8 +5512,8 @@ discard block |
|
|
block discarded – undo |
5512
|
5512
|
$more .= '</textarea>'; |
5513
|
5513
|
$more .= '</div></div>'."\n";*/ |
5514
|
5514
|
$moreonecolumn .= '<div class="margintoponly">'; |
5515
|
|
- $moreonecolumn .= $input['label'] . '<br>'; |
5516
|
|
- $moreonecolumn .= '<textarea name="' . dol_escape_htmltag($input['name']) . '" id="' . dol_escape_htmltag($input['name']) . '" class="' . $morecss . '"' . $moreattr . '>'; |
|
5515
|
+ $moreonecolumn .= $input['label'].'<br>'; |
|
5516
|
+ $moreonecolumn .= '<textarea name="'.dol_escape_htmltag($input['name']).'" id="'.dol_escape_htmltag($input['name']).'" class="'.$morecss.'"'.$moreattr.'>'; |
5517
|
5517
|
$moreonecolumn .= $input['value']; |
5518
|
5518
|
$moreonecolumn .= '</textarea>'; |
5519
|
5519
|
$moreonecolumn .= '</div>'; |
|
@@ -5530,20 +5530,20 @@ discard block |
|
|
block discarded – undo |
5530
|
5530
|
$disabled = isset($input['select_disabled']) ? $input['select_disabled'] : 0; |
5531
|
5531
|
$sort = isset($input['select_sort']) ? $input['select_sort'] : ''; |
5532
|
5532
|
|
5533
|
|
- $more .= '<div class="tagtr"><div class="tagtd' . (empty($input['tdclass']) ? '' : (' ' . $input['tdclass'])) . '">'; |
|
5533
|
+ $more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">'; |
5534
|
5534
|
if (!empty($input['label'])) { |
5535
|
|
- $more .= $input['label'] . '</div><div class="tagtd left">'; |
|
5535
|
+ $more .= $input['label'].'</div><div class="tagtd left">'; |
5536
|
5536
|
} |
5537
|
5537
|
if ($input['type'] == 'select') { |
5538
|
5538
|
$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); |
5539
|
5539
|
} else { |
5540
|
5540
|
$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); |
5541
|
5541
|
} |
5542
|
|
- $more .= '</div></div>' . "\n"; |
|
5542
|
+ $more .= '</div></div>'."\n"; |
5543
|
5543
|
} elseif ($input['type'] == 'checkbox') { |
5544
|
5544
|
$more .= '<div class="tagtr">'; |
5545
|
|
- $more .= '<div class="tagtd' . (empty($input['tdclass']) ? '' : (' ' . $input['tdclass'])) . '"><label for="' . dol_escape_htmltag($input['name']) . '">' . $input['label'] . '</label></div><div class="tagtd">'; |
5546
|
|
- $more .= '<input type="checkbox" class="flat' . ($morecss ? ' ' . $morecss : '') . '" id="' . dol_escape_htmltag($input['name']) . '" name="' . dol_escape_htmltag($input['name']) . '"' . $moreattr; |
|
5545
|
+ $more .= '<div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'"><label for="'.dol_escape_htmltag($input['name']).'">'.$input['label'].'</label></div><div class="tagtd">'; |
|
5546
|
+ $more .= '<input type="checkbox" class="flat'.($morecss ? ' '.$morecss : '').'" id="'.dol_escape_htmltag($input['name']).'" name="'.dol_escape_htmltag($input['name']).'"'.$moreattr; |
5547
|
5547
|
if (!is_bool($input['value']) && $input['value'] != 'false' && $input['value'] != '0' && $input['value'] != '') { |
5548
|
5548
|
$more .= ' checked'; |
5549
|
5549
|
} |
|
@@ -5554,19 +5554,19 @@ discard block |
|
|
block discarded – undo |
5554
|
5554
|
$more .= ' disabled'; |
5555
|
5555
|
} |
5556
|
5556
|
$more .= ' /></div>'; |
5557
|
|
- $more .= '</div>' . "\n"; |
|
5557
|
+ $more .= '</div>'."\n"; |
5558
|
5558
|
} elseif ($input['type'] == 'radio') { |
5559
|
5559
|
$i = 0; |
5560
|
5560
|
foreach ($input['values'] as $selkey => $selval) { |
5561
|
5561
|
$more .= '<div class="tagtr">'; |
5562
|
5562
|
if (isset($input['label'])) { |
5563
|
5563
|
if ($i == 0) { |
5564
|
|
- $more .= '<div class="tagtd' . (empty($input['tdclass']) ? ' tdtop' : (' tdtop ' . $input['tdclass'])) . '">' . $input['label'] . '</div>'; |
|
5564
|
+ $more .= '<div class="tagtd'.(empty($input['tdclass']) ? ' tdtop' : (' tdtop '.$input['tdclass'])).'">'.$input['label'].'</div>'; |
5565
|
5565
|
} else { |
5566
|
|
- $more .= '<div class="tagtd' . (empty($input['tdclass']) ? '' : (' "' . $input['tdclass'])) . '"> </div>'; |
|
5566
|
+ $more .= '<div class="tagtd'.(empty($input['tdclass']) ? '' : (' "'.$input['tdclass'])).'"> </div>'; |
5567
|
5567
|
} |
5568
|
5568
|
} |
5569
|
|
- $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; |
|
5569
|
+ $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; |
5570
|
5570
|
if (!empty($input['disabled'])) { |
5571
|
5571
|
$more .= ' disabled'; |
5572
|
5572
|
} |
|
@@ -5574,12 +5574,12 @@ discard block |
|
|
block discarded – undo |
5574
|
5574
|
$more .= ' checked="checked"'; |
5575
|
5575
|
} |
5576
|
5576
|
$more .= ' /> '; |
5577
|
|
- $more .= '<label for="' . dol_escape_htmltag($input['name'] . $selkey) . '" class="valignmiddle">' . $selval . '</label>'; |
5578
|
|
- $more .= '</div></div>' . "\n"; |
|
5577
|
+ $more .= '<label for="'.dol_escape_htmltag($input['name'].$selkey).'" class="valignmiddle">'.$selval.'</label>'; |
|
5578
|
+ $more .= '</div></div>'."\n"; |
5579
|
5579
|
$i++; |
5580
|
5580
|
} |
5581
|
5581
|
} elseif ($input['type'] == 'date' || $input['type'] == 'datetime') { |
5582
|
|
- $more .= '<div class="tagtr"><div class="tagtd' . (empty($input['tdclass']) ? '' : (' ' . $input['tdclass'])) . '">' . $input['label'] . '</div>'; |
|
5582
|
+ $more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">'.$input['label'].'</div>'; |
5583
|
5583
|
$more .= '<div class="tagtd">'; |
5584
|
5584
|
$addnowlink = (empty($input['datenow']) ? 0 : 1); |
5585
|
5585
|
$h = $m = 0; |
|
@@ -5597,24 +5597,24 @@ discard block |
|
|
block discarded – undo |
5597
|
5597
|
} elseif ($input['type'] == 'other') { // can be 1 column or 2 depending if label is set or not |
5598
|
5598
|
$more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">'; |
5599
|
5599
|
if (!empty($input['label'])) { |
5600
|
|
- $more .= $input['label'] . '</div><div class="tagtd">'; |
|
5600
|
+ $more .= $input['label'].'</div><div class="tagtd">'; |
5601
|
5601
|
} |
5602
|
5602
|
$more .= $input['value']; |
5603
|
|
- $more .= '</div></div>' . "\n"; |
|
5603
|
+ $more .= '</div></div>'."\n"; |
5604
|
5604
|
} elseif ($input['type'] == 'onecolumn') { |
5605
|
5605
|
$moreonecolumn .= '<div class="margintoponly">'; |
5606
|
5606
|
$moreonecolumn .= $input['value']; |
5607
|
|
- $moreonecolumn .= '</div>' . "\n"; |
|
5607
|
+ $moreonecolumn .= '</div>'."\n"; |
5608
|
5608
|
} elseif ($input['type'] == 'hidden') { |
5609
|
5609
|
// Do nothing more, already added by a previous loop |
5610
|
5610
|
} elseif ($input['type'] == 'separator') { |
5611
|
5611
|
$more .= '<br>'; |
5612
|
5612
|
} else { |
5613
|
|
- $more .= 'Error type ' . $input['type'] . ' for the confirm box is not a supported type'; |
|
5613
|
+ $more .= 'Error type '.$input['type'].' for the confirm box is not a supported type'; |
5614
|
5614
|
} |
5615
|
5615
|
} |
5616
|
5616
|
} |
5617
|
|
- $more .= '</div>' . "\n"; |
|
5617
|
+ $more .= '</div>'."\n"; |
5618
|
5618
|
$more .= $moreonecolumn; |
5619
|
5619
|
} |
5620
|
5620
|
|
|
@@ -5636,10 +5636,10 @@ discard block |
|
|
block discarded – undo |
5636
|
5636
|
$button = $useajax; |
5637
|
5637
|
$useajax = 1; |
5638
|
5638
|
$autoOpen = false; |
5639
|
|
- $dialogconfirm .= '-' . $button; |
|
5639
|
+ $dialogconfirm .= '-'.$button; |
5640
|
5640
|
} |
5641
|
|
- $pageyes = $page . (preg_match('/\?/', $page) ? '&' : '?') . 'action=' . urlencode($action) . '&confirm=yes'; |
5642
|
|
- $pageno = ($useajax == 2 ? $page . (preg_match('/\?/', $page) ? '&' : '?') . 'action=' . urlencode($action) . '&confirm=no' : ''); |
|
5641
|
+ $pageyes = $page.(preg_match('/\?/', $page) ? '&' : '?').'action='.urlencode($action).'&confirm=yes'; |
|
5642
|
+ $pageno = ($useajax == 2 ? $page.(preg_match('/\?/', $page) ? '&' : '?').'action='.urlencode($action).'&confirm=no' : ''); |
5643
|
5643
|
|
5644
|
5644
|
// Add input fields into list of fields to read during submit (inputok and inputko) |
5645
|
5645
|
if (is_array($formquestion)) { |
|
@@ -5662,24 +5662,24 @@ discard block |
|
|
block discarded – undo |
5662
|
5662
|
} |
5663
|
5663
|
|
5664
|
5664
|
// Show JQuery confirm box. |
5665
|
|
- $formconfirm .= '<div id="' . $dialogconfirm . '" title="' . dol_escape_htmltag($title) . '" style="display: none;">'; |
|
5665
|
+ $formconfirm .= '<div id="'.$dialogconfirm.'" title="'.dol_escape_htmltag($title).'" style="display: none;">'; |
5666
|
5666
|
if (is_array($formquestion) && array_key_exists('text', $formquestion) && !empty($formquestion['text'])) { |
5667
|
|
- $formconfirm .= '<div class="confirmtext">' . $formquestion['text'] . '</div>' . "\n"; |
|
5667
|
+ $formconfirm .= '<div class="confirmtext">'.$formquestion['text'].'</div>'."\n"; |
5668
|
5668
|
} |
5669
|
5669
|
if (!empty($more)) { |
5670
|
|
- $formconfirm .= '<div class="confirmquestions">' . $more . '</div>' . "\n"; |
|
5670
|
+ $formconfirm .= '<div class="confirmquestions">'.$more.'</div>'."\n"; |
5671
|
5671
|
} |
5672
|
|
- $formconfirm .= ($question ? '<div class="confirmmessage">' . img_help(0, '') . ' ' . $question . '</div>' : ''); |
5673
|
|
- $formconfirm .= '</div>' . "\n"; |
|
5672
|
+ $formconfirm .= ($question ? '<div class="confirmmessage">'.img_help(0, '').' '.$question.'</div>' : ''); |
|
5673
|
+ $formconfirm .= '</div>'."\n"; |
5674
|
5674
|
|
5675
|
|
- $formconfirm .= "\n<!-- begin code of popup for formconfirm page=" . $page . " -->\n"; |
5676
|
|
- $formconfirm .= '<script nonce="' . getNonce() . '" type="text/javascript">' . "\n"; |
|
5675
|
+ $formconfirm .= "\n<!-- begin code of popup for formconfirm page=".$page." -->\n"; |
|
5676
|
+ $formconfirm .= '<script nonce="'.getNonce().'" type="text/javascript">'."\n"; |
5677
|
5677
|
$formconfirm .= "/* Code for the jQuery('#dialogforpopup').dialog() */\n"; |
5678
|
5678
|
$formconfirm .= 'jQuery(document).ready(function() { |
5679
|
5679
|
$(function() { |
5680
|
|
- $( "#' . $dialogconfirm . '" ).dialog( |
|
5680
|
+ $( "#' . $dialogconfirm.'" ).dialog( |
5681
|
5681
|
{ |
5682
|
|
- autoOpen: ' . ($autoOpen ? "true" : "false") . ','; |
|
5682
|
+ autoOpen: ' . ($autoOpen ? "true" : "false").','; |
5683
|
5683
|
if ($newselectedchoice == 'no') { |
5684
|
5684
|
$formconfirm .= ' |
5685
|
5685
|
open: function() { |
|
@@ -5689,24 +5689,24 @@ discard block |
|
|
block discarded – undo |
5689
|
5689
|
|
5690
|
5690
|
$jsforcursor = ''; |
5691
|
5691
|
if ($useajax == 1) { |
5692
|
|
- $jsforcursor = '// The call to urljump can be slow, so we set the wait cursor' . "\n"; |
5693
|
|
- $jsforcursor .= 'jQuery("html,body,#id-container").addClass("cursorwait");' . "\n"; |
|
5692
|
+ $jsforcursor = '// The call to urljump can be slow, so we set the wait cursor'."\n"; |
|
5693
|
+ $jsforcursor .= 'jQuery("html,body,#id-container").addClass("cursorwait");'."\n"; |
5694
|
5694
|
} |
5695
|
5695
|
|
5696
|
5696
|
$postconfirmas = 'GET'; |
5697
|
5697
|
|
5698
|
5698
|
$formconfirm .= ' |
5699
|
5699
|
resizable: false, |
5700
|
|
- height: "' . $height . '", |
5701
|
|
- width: "' . $width . '", |
|
5700
|
+ height: "' . $height.'", |
|
5701
|
+ width: "' . $width.'", |
5702
|
5702
|
modal: true, |
5703
|
5703
|
closeOnEscape: false, |
5704
|
5704
|
buttons: { |
5705
|
|
- "' . dol_escape_js($langs->transnoentities($labelbuttonyes)) . '": function() { |
5706
|
|
- var options = "token=' . urlencode(newToken()) . '"; |
5707
|
|
- var inputok = ' . json_encode($inputok) . '; /* List of fields into form */ |
5708
|
|
- var page = "' . dol_escape_js(!empty($page) ? $page : '') . '"; |
5709
|
|
- var pageyes = "' . dol_escape_js(!empty($pageyes) ? $pageyes : '') . '"; |
|
5705
|
+ "' . dol_escape_js($langs->transnoentities($labelbuttonyes)).'": function() { |
|
5706
|
+ var options = "token=' . urlencode(newToken()).'"; |
|
5707
|
+ var inputok = ' . json_encode($inputok).'; /* List of fields into form */ |
|
5708
|
+ var page = "' . dol_escape_js(!empty($page) ? $page : '').'"; |
|
5709
|
+ var pageyes = "' . dol_escape_js(!empty($pageyes) ? $pageyes : '').'"; |
5710
|
5710
|
|
5711
|
5711
|
if (inputok.length > 0) { |
5712
|
5712
|
$.each(inputok, function(i, inputname) { |
|
@@ -5740,11 +5740,11 @@ discard block |
|
|
block discarded – undo |
5740
|
5740
|
} |
5741
|
5741
|
$(this).dialog("close"); |
5742
|
5742
|
}, |
5743
|
|
- "' . dol_escape_js($langs->transnoentities($labelbuttonno)) . '": function() { |
5744
|
|
- var options = "token=' . urlencode(newToken()) . '"; |
5745
|
|
- var inputko = ' . json_encode($inputko) . '; /* List of fields into form */ |
5746
|
|
- var page = "' . dol_escape_js(!empty($page) ? $page : '') . '"; |
5747
|
|
- var pageno="' . dol_escape_js(!empty($pageno) ? $pageno : '') . '"; |
|
5743
|
+ "' . dol_escape_js($langs->transnoentities($labelbuttonno)).'": function() { |
|
5744
|
+ var options = "token=' . urlencode(newToken()).'"; |
|
5745
|
+ var inputko = ' . json_encode($inputko).'; /* List of fields into form */ |
|
5746
|
+ var page = "' . dol_escape_js(!empty($page) ? $page : '').'"; |
|
5747
|
+ var pageno="' . dol_escape_js(!empty($pageno) ? $pageno : '').'"; |
5748
|
5748
|
if (inputko.length > 0) { |
5749
|
5749
|
$.each(inputko, function(i, inputname) { |
5750
|
5750
|
var more = ""; |
|
@@ -5776,10 +5776,10 @@ discard block |
|
|
block discarded – undo |
5776
|
5776
|
} |
5777
|
5777
|
); |
5778
|
5778
|
|
5779
|
|
- var button = "' . $button . '"; |
|
5779
|
+ var button = "' . $button.'"; |
5780
|
5780
|
if (button.length > 0) { |
5781
|
5781
|
$( "#" + button ).click(function() { |
5782
|
|
- $("#' . $dialogconfirm . '").dialog("open"); |
|
5782
|
+ $("#' . $dialogconfirm.'").dialog("open"); |
5783
|
5783
|
}); |
5784
|
5784
|
} |
5785
|
5785
|
}); |
|
@@ -5787,44 +5787,44 @@ discard block |
|
|
block discarded – undo |
5787
|
5787
|
</script>'; |
5788
|
5788
|
$formconfirm .= "<!-- end ajax formconfirm -->\n"; |
5789
|
5789
|
} else { |
5790
|
|
- $formconfirm .= "\n<!-- begin formconfirm page=" . dol_escape_htmltag($page) . " -->\n"; |
|
5790
|
+ $formconfirm .= "\n<!-- begin formconfirm page=".dol_escape_htmltag($page)." -->\n"; |
5791
|
5791
|
|
5792
|
5792
|
if (empty($disableformtag)) { |
5793
|
|
- $formconfirm .= '<form method="POST" action="' . $page . '" class="notoptoleftroright">' . "\n"; |
|
5793
|
+ $formconfirm .= '<form method="POST" action="'.$page.'" class="notoptoleftroright">'."\n"; |
5794
|
5794
|
} |
5795
|
5795
|
|
5796
|
|
- $formconfirm .= '<input type="hidden" name="action" value="' . $action . '">' . "\n"; |
5797
|
|
- $formconfirm .= '<input type="hidden" name="token" value="' . newToken() . '">' . "\n"; |
|
5796
|
+ $formconfirm .= '<input type="hidden" name="action" value="'.$action.'">'."\n"; |
|
5797
|
+ $formconfirm .= '<input type="hidden" name="token" value="'.newToken().'">'."\n"; |
5798
|
5798
|
|
5799
|
|
- $formconfirm .= '<table class="valid centpercent">' . "\n"; |
|
5799
|
+ $formconfirm .= '<table class="valid centpercent">'."\n"; |
5800
|
5800
|
|
5801
|
5801
|
// Line title |
5802
|
5802
|
$formconfirm .= '<tr class="validtitre"><td class="validtitre" colspan="2">'; |
5803
|
|
- $formconfirm .= img_picto('', 'pictoconfirm') . ' ' . $title; |
5804
|
|
- $formconfirm .= '</td></tr>' . "\n"; |
|
5803
|
+ $formconfirm .= img_picto('', 'pictoconfirm').' '.$title; |
|
5804
|
+ $formconfirm .= '</td></tr>'."\n"; |
5805
|
5805
|
|
5806
|
5806
|
// Line text |
5807
|
5807
|
if (is_array($formquestion) && array_key_exists('text', $formquestion) && !empty($formquestion['text'])) { |
5808
|
|
- $formconfirm .= '<tr class="valid"><td class="valid" colspan="2">' . $formquestion['text'] . '</td></tr>' . "\n"; |
|
5808
|
+ $formconfirm .= '<tr class="valid"><td class="valid" colspan="2">'.$formquestion['text'].'</td></tr>'."\n"; |
5809
|
5809
|
} |
5810
|
5810
|
|
5811
|
5811
|
// Line form fields |
5812
|
5812
|
if ($more) { |
5813
|
|
- $formconfirm .= '<tr class="valid"><td class="valid" colspan="2">' . "\n"; |
|
5813
|
+ $formconfirm .= '<tr class="valid"><td class="valid" colspan="2">'."\n"; |
5814
|
5814
|
$formconfirm .= $more; |
5815
|
|
- $formconfirm .= '</td></tr>' . "\n"; |
|
5815
|
+ $formconfirm .= '</td></tr>'."\n"; |
5816
|
5816
|
} |
5817
|
5817
|
|
5818
|
5818
|
// Line with question |
5819
|
5819
|
$formconfirm .= '<tr class="valid">'; |
5820
|
|
- $formconfirm .= '<td class="valid">' . $question . '</td>'; |
|
5820
|
+ $formconfirm .= '<td class="valid">'.$question.'</td>'; |
5821
|
5821
|
$formconfirm .= '<td class="valid center">'; |
5822
|
5822
|
$formconfirm .= $this->selectyesno("confirm", $newselectedchoice, 0, false, 0, 0, 'marginleftonly marginrightonly', $labelbuttonyes, $labelbuttonno); |
5823
|
|
- $formconfirm .= '<input class="button valignmiddle confirmvalidatebutton small" type="submit" value="' . $langs->trans("Validate") . '">'; |
|
5823
|
+ $formconfirm .= '<input class="button valignmiddle confirmvalidatebutton small" type="submit" value="'.$langs->trans("Validate").'">'; |
5824
|
5824
|
$formconfirm .= '</td>'; |
5825
|
|
- $formconfirm .= '</tr>' . "\n"; |
|
5825
|
+ $formconfirm .= '</tr>'."\n"; |
5826
|
5826
|
|
5827
|
|
- $formconfirm .= '</table>' . "\n"; |
|
5827
|
+ $formconfirm .= '</table>'."\n"; |
5828
|
5828
|
|
5829
|
5829
|
if (empty($disableformtag)) { |
5830
|
5830
|
$formconfirm .= "</form>\n"; |
|
@@ -5833,7 +5833,7 @@ discard block |
|
|
block discarded – undo |
5833
|
5833
|
|
5834
|
5834
|
if (!empty($conf->use_javascript_ajax)) { |
5835
|
5835
|
$formconfirm .= '<!-- code to disable button to avoid double clic -->'; |
5836
|
|
- $formconfirm .= '<script nonce="' . getNonce() . '" type="text/javascript">' . "\n"; |
|
5836
|
+ $formconfirm .= '<script nonce="'.getNonce().'" type="text/javascript">'."\n"; |
5837
|
5837
|
$formconfirm .= ' |
5838
|
5838
|
$(document).ready(function () { |
5839
|
5839
|
$(".confirmvalidatebutton").on("click", function() { |
|
@@ -5845,7 +5845,7 @@ discard block |
|
|
block discarded – undo |
5845
|
5845
|
}); |
5846
|
5846
|
}); |
5847
|
5847
|
'; |
5848
|
|
- $formconfirm .= '</script>' . "\n"; |
|
5848
|
+ $formconfirm .= '</script>'."\n"; |
5849
|
5849
|
} |
5850
|
5850
|
|
5851
|
5851
|
$formconfirm .= "<!-- end formconfirm -->\n"; |
|
@@ -5877,8 +5877,8 @@ discard block |
|
|
block discarded – undo |
5877
|
5877
|
// phpcs:enable |
5878
|
5878
|
global $langs; |
5879
|
5879
|
|
5880
|
|
- require_once DOL_DOCUMENT_ROOT . '/core/lib/project.lib.php'; |
5881
|
|
- require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php'; |
|
5880
|
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php'; |
|
5881
|
+ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; |
5882
|
5882
|
|
5883
|
5883
|
$out = ''; |
5884
|
5884
|
|
|
@@ -5886,11 +5886,11 @@ discard block |
|
|
block discarded – undo |
5886
|
5886
|
|
5887
|
5887
|
$langs->load("project"); |
5888
|
5888
|
if ($htmlname != "none") { |
5889
|
|
- $out .= '<form method="post" action="' . $page . '">'; |
|
5889
|
+ $out .= '<form method="post" action="'.$page.'">'; |
5890
|
5890
|
$out .= '<input type="hidden" name="action" value="classin">'; |
5891
|
|
- $out .= '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
5891
|
+ $out .= '<input type="hidden" name="token" value="'.newToken().'">'; |
5892
|
5892
|
$out .= $formproject->select_projects($socid, $selected, $htmlname, $maxlength, 0, 1, $discard_closed, $forcefocus, 0, 0, '', 1, 0, $morecss); |
5893
|
|
- $out .= '<input type="submit" class="button smallpaddingimp" value="' . $langs->trans("Modify") . '">'; |
|
5893
|
+ $out .= '<input type="submit" class="button smallpaddingimp" value="'.$langs->trans("Modify").'">'; |
5894
|
5894
|
$out .= '</form>'; |
5895
|
5895
|
} else { |
5896
|
5896
|
$out .= '<span class="project_head_block">'; |
|
@@ -5899,7 +5899,7 @@ discard block |
|
|
block discarded – undo |
5899
|
5899
|
$projet->fetch($selected); |
5900
|
5900
|
$out .= $projet->getNomUrl(0, '', 1); |
5901
|
5901
|
} else { |
5902
|
|
- $out .= '<span class="opacitymedium">' . $textifnoproject . '</span>'; |
|
5902
|
+ $out .= '<span class="opacitymedium">'.$textifnoproject.'</span>'; |
5903
|
5903
|
} |
5904
|
5904
|
$out .= '</span>'; |
5905
|
5905
|
} |
|
@@ -5936,14 +5936,14 @@ discard block |
|
|
block discarded – undo |
5936
|
5936
|
$out = ''; |
5937
|
5937
|
|
5938
|
5938
|
if ($htmlname != "none") { |
5939
|
|
- $out .= '<form method="POST" action="' . $page . '">'; |
|
5939
|
+ $out .= '<form method="POST" action="'.$page.'">'; |
5940
|
5940
|
$out .= '<input type="hidden" name="action" value="setconditions">'; |
5941
|
|
- $out .= '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
5941
|
+ $out .= '<input type="hidden" name="token" value="'.newToken().'">'; |
5942
|
5942
|
if ($type) { |
5943
|
|
- $out .= '<input type="hidden" name="type" value="' . dol_escape_htmltag($type) . '">'; |
|
5943
|
+ $out .= '<input type="hidden" name="type" value="'.dol_escape_htmltag($type).'">'; |
5944
|
5944
|
} |
5945
|
5945
|
$out .= $this->getSelectConditionsPaiements($selected, $htmlname, $filtertype, $addempty, 0, '', $deposit_percent); |
5946
|
|
- $out .= '<input type="submit" class="button valignmiddle smallpaddingimp" value="' . $langs->trans("Modify") . '">'; |
|
5946
|
+ $out .= '<input type="submit" class="button valignmiddle smallpaddingimp" value="'.$langs->trans("Modify").'">'; |
5947
|
5947
|
$out .= '</form>'; |
5948
|
5948
|
} else { |
5949
|
5949
|
if ($selected) { |
|
@@ -5988,12 +5988,12 @@ discard block |
|
|
block discarded – undo |
5988
|
5988
|
// phpcs:enable |
5989
|
5989
|
global $langs; |
5990
|
5990
|
if ($htmlname != "none") { |
5991
|
|
- print '<form method="post" action="' . $page . '">'; |
|
5991
|
+ print '<form method="post" action="'.$page.'">'; |
5992
|
5992
|
print '<input type="hidden" name="action" value="setavailability">'; |
5993
|
|
- print '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
5993
|
+ print '<input type="hidden" name="token" value="'.newToken().'">'; |
5994
|
5994
|
$this->selectAvailabilityDelay($selected, $htmlname, '', $addempty); |
5995
|
|
- print '<input type="submit" name="modify" class="button smallpaddingimp" value="' . $langs->trans("Modify") . '">'; |
5996
|
|
- print '<input type="submit" name="cancel" class="button smallpaddingimp" value="' . $langs->trans("Cancel") . '">'; |
|
5995
|
+ print '<input type="submit" name="modify" class="button smallpaddingimp" value="'.$langs->trans("Modify").'">'; |
|
5996
|
+ print '<input type="submit" name="cancel" class="button smallpaddingimp" value="'.$langs->trans("Cancel").'">'; |
5997
|
5997
|
print '</form>'; |
5998
|
5998
|
} else { |
5999
|
5999
|
if ($selected) { |
|
@@ -6019,11 +6019,11 @@ discard block |
|
|
block discarded – undo |
6019
|
6019
|
{ |
6020
|
6020
|
global $langs; |
6021
|
6021
|
if ($htmlname != "none") { |
6022
|
|
- print '<form method="post" action="' . $page . '">'; |
|
6022
|
+ print '<form method="post" action="'.$page.'">'; |
6023
|
6023
|
print '<input type="hidden" name="action" value="setdemandreason">'; |
6024
|
|
- print '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
6024
|
+ print '<input type="hidden" name="token" value="'.newToken().'">'; |
6025
|
6025
|
$this->selectInputReason($selected, $htmlname, '-1', $addempty); |
6026
|
|
- print '<input type="submit" class="button smallpaddingimp" value="' . $langs->trans("Modify") . '">'; |
|
6026
|
+ print '<input type="submit" class="button smallpaddingimp" value="'.$langs->trans("Modify").'">'; |
6027
|
6027
|
print '</form>'; |
6028
|
6028
|
} else { |
6029
|
6029
|
if ($selected) { |
|
@@ -6063,17 +6063,17 @@ discard block |
|
|
block discarded – undo |
6063
|
6063
|
$ret = ''; |
6064
|
6064
|
|
6065
|
6065
|
if ($htmlname != "none") { |
6066
|
|
- $ret .= '<form method="POST" action="' . $page . '" name="form' . $htmlname . '">'; |
6067
|
|
- $ret .= '<input type="hidden" name="action" value="set' . $htmlname . '">'; |
6068
|
|
- $ret .= '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
6066
|
+ $ret .= '<form method="POST" action="'.$page.'" name="form'.$htmlname.'">'; |
|
6067
|
+ $ret .= '<input type="hidden" name="action" value="set'.$htmlname.'">'; |
|
6068
|
+ $ret .= '<input type="hidden" name="token" value="'.newToken().'">'; |
6069
|
6069
|
if ($type) { |
6070
|
|
- $ret .= '<input type="hidden" name="type" value="' . dol_escape_htmltag($type) . '">'; |
|
6070
|
+ $ret .= '<input type="hidden" name="type" value="'.dol_escape_htmltag($type).'">'; |
6071
|
6071
|
} |
6072
|
6072
|
$ret .= '<table class="nobordernopadding">'; |
6073
|
6073
|
$ret .= '<tr><td>'; |
6074
|
|
- $ret .= $this->selectDate($selected, $htmlname, $displayhour, $displaymin, 1, 'form' . $htmlname, 1, 0); |
|
6074
|
+ $ret .= $this->selectDate($selected, $htmlname, $displayhour, $displaymin, 1, 'form'.$htmlname, 1, 0); |
6075
|
6075
|
$ret .= '</td>'; |
6076
|
|
- $ret .= '<td class="left"><input type="submit" class="button smallpaddingimp" value="' . $langs->trans("Modify") . '"></td>'; |
|
6076
|
+ $ret .= '<td class="left"><input type="submit" class="button smallpaddingimp" value="'.$langs->trans("Modify").'"></td>'; |
6077
|
6077
|
$ret .= '</tr></table></form>'; |
6078
|
6078
|
} else { |
6079
|
6079
|
if ($displayhour) { |
|
@@ -6108,15 +6108,15 @@ discard block |
|
|
block discarded – undo |
6108
|
6108
|
global $langs; |
6109
|
6109
|
|
6110
|
6110
|
if ($htmlname != "none") { |
6111
|
|
- print '<form method="POST" action="' . $page . '" name="form' . $htmlname . '">'; |
6112
|
|
- print '<input type="hidden" name="action" value="set' . $htmlname . '">'; |
6113
|
|
- print '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
6111
|
+ print '<form method="POST" action="'.$page.'" name="form'.$htmlname.'">'; |
|
6112
|
+ print '<input type="hidden" name="action" value="set'.$htmlname.'">'; |
|
6113
|
+ print '<input type="hidden" name="token" value="'.newToken().'">'; |
6114
|
6114
|
print $this->select_dolusers($selected, $htmlname, 1, $exclude, 0, $include); |
6115
|
|
- print '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">'; |
|
6115
|
+ print '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">'; |
6116
|
6116
|
print '</form>'; |
6117
|
6117
|
} else { |
6118
|
6118
|
if ($selected) { |
6119
|
|
- require_once DOL_DOCUMENT_ROOT . '/user/class/user.class.php'; |
|
6119
|
+ require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; |
6120
|
6120
|
$theuser = new User($this->db); |
6121
|
6121
|
$theuser->fetch($selected); |
6122
|
6122
|
print $theuser->getNomUrl(1); |
|
@@ -6149,14 +6149,14 @@ discard block |
|
|
block discarded – undo |
6149
|
6149
|
|
6150
|
6150
|
$out = ''; |
6151
|
6151
|
if ($htmlname != "none") { |
6152
|
|
- $out .= '<form method="POST" action="' . $page . '">'; |
|
6152
|
+ $out .= '<form method="POST" action="'.$page.'">'; |
6153
|
6153
|
$out .= '<input type="hidden" name="action" value="setmode">'; |
6154
|
|
- $out .= '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
6154
|
+ $out .= '<input type="hidden" name="token" value="'.newToken().'">'; |
6155
|
6155
|
if ($type) { |
6156
|
|
- $out .= '<input type="hidden" name="type" value="' . dol_escape_htmltag($type) . '">'; |
|
6156
|
+ $out .= '<input type="hidden" name="type" value="'.dol_escape_htmltag($type).'">'; |
6157
|
6157
|
} |
6158
|
6158
|
$out .= $this->select_types_paiements($selected, $htmlname, $filtertype, 0, $addempty, 0, 0, $active, '', 1); |
6159
|
|
- $out .= '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">'; |
|
6159
|
+ $out .= '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">'; |
6160
|
6160
|
$out .= '</form>'; |
6161
|
6161
|
} else { |
6162
|
6162
|
if ($selected) { |
|
@@ -6189,11 +6189,11 @@ discard block |
|
|
block discarded – undo |
6189
|
6189
|
{ |
6190
|
6190
|
global $langs; |
6191
|
6191
|
if ($htmlname != "none") { |
6192
|
|
- print '<form method="POST" action="' . $page . '">'; |
|
6192
|
+ print '<form method="POST" action="'.$page.'">'; |
6193
|
6193
|
print '<input type="hidden" name="action" value="settransportmode">'; |
6194
|
|
- print '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
6194
|
+ print '<input type="hidden" name="token" value="'.newToken().'">'; |
6195
|
6195
|
$this->selectTransportMode($selected, $htmlname, 0, $addempty, 0, 0, $active); |
6196
|
|
- print '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">'; |
|
6196
|
+ print '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">'; |
6197
|
6197
|
print '</form>'; |
6198
|
6198
|
} else { |
6199
|
6199
|
if ($selected) { |
|
@@ -6220,14 +6220,14 @@ discard block |
|
|
block discarded – undo |
6220
|
6220
|
// phpcs:enable |
6221
|
6221
|
global $langs; |
6222
|
6222
|
if ($htmlname != "none") { |
6223
|
|
- print '<form method="POST" action="' . $page . '">'; |
|
6223
|
+ print '<form method="POST" action="'.$page.'">'; |
6224
|
6224
|
print '<input type="hidden" name="action" value="setmulticurrencycode">'; |
6225
|
|
- print '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
6225
|
+ print '<input type="hidden" name="token" value="'.newToken().'">'; |
6226
|
6226
|
print $this->selectMultiCurrency($selected, $htmlname, 0); |
6227
|
|
- print '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">'; |
|
6227
|
+ print '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">'; |
6228
|
6228
|
print '</form>'; |
6229
|
6229
|
} else { |
6230
|
|
- require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php'; |
|
6230
|
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; |
6231
|
6231
|
print !empty($selected) ? currency_name($selected, 1) : ' '; |
6232
|
6232
|
} |
6233
|
6233
|
} |
|
@@ -6249,21 +6249,21 @@ discard block |
|
|
block discarded – undo |
6249
|
6249
|
global $langs, $mysoc, $conf; |
6250
|
6250
|
|
6251
|
6251
|
if ($htmlname != "none") { |
6252
|
|
- print '<form method="POST" action="' . $page . '">'; |
|
6252
|
+ print '<form method="POST" action="'.$page.'">'; |
6253
|
6253
|
print '<input type="hidden" name="action" value="setmulticurrencyrate">'; |
6254
|
|
- print '<input type="hidden" name="token" value="' . newToken() . '">'; |
6255
|
|
- print '<input type="text" class="maxwidth100" name="' . $htmlname . '" value="' . (!empty($rate) ? price(price2num($rate, 'CU')) : 1) . '" /> '; |
|
6254
|
+ print '<input type="hidden" name="token" value="'.newToken().'">'; |
|
6255
|
+ print '<input type="text" class="maxwidth100" name="'.$htmlname.'" value="'.(!empty($rate) ? price(price2num($rate, 'CU')) : 1).'" /> '; |
6256
|
6256
|
print '<select name="calculation_mode">'; |
6257
|
|
- print '<option value="1">Change ' . $langs->trans("PriceUHT") . ' of lines</option>'; |
6258
|
|
- print '<option value="2">Change ' . $langs->trans("PriceUHTCurrency") . ' of lines</option>'; |
|
6257
|
+ print '<option value="1">Change '.$langs->trans("PriceUHT").' of lines</option>'; |
|
6258
|
+ print '<option value="2">Change '.$langs->trans("PriceUHTCurrency").' of lines</option>'; |
6259
|
6259
|
print '</select> '; |
6260
|
|
- print '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">'; |
|
6260
|
+ print '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">'; |
6261
|
6261
|
print '</form>'; |
6262
|
6262
|
} else { |
6263
|
6263
|
if (!empty($rate)) { |
6264
|
6264
|
print price($rate, 1, $langs, 0, 0); |
6265
|
6265
|
if ($currency && $rate != 1) { |
6266
|
|
- print ' (' . price($rate, 1, $langs, 0, 0) . ' ' . $currency . ' = 1 ' . $conf->currency . ')'; |
|
6266
|
+ print ' ('.price($rate, 1, $langs, 0, 0).' '.$currency.' = 1 '.$conf->currency.')'; |
6267
|
6267
|
} |
6268
|
6268
|
} else { |
6269
|
6269
|
print 1; |
|
@@ -6294,9 +6294,9 @@ discard block |
|
|
block discarded – undo |
6294
|
6294
|
// phpcs:enable |
6295
|
6295
|
global $conf, $langs; |
6296
|
6296
|
if ($htmlname != "none") { |
6297
|
|
- print '<form method="post" action="' . $page . '">'; |
|
6297
|
+ print '<form method="post" action="'.$page.'">'; |
6298
|
6298
|
print '<input type="hidden" name="action" value="setabsolutediscount">'; |
6299
|
|
- print '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
6299
|
+ print '<input type="hidden" name="token" value="'.newToken().'">'; |
6300
|
6300
|
print '<div class="inline-block">'; |
6301
|
6301
|
if (!empty($discount_type)) { |
6302
|
6302
|
if (getDolGlobalString('FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS')) { |
|
@@ -6334,24 +6334,24 @@ discard block |
|
|
block discarded – undo |
6334
|
6334
|
print '</div>'; |
6335
|
6335
|
if (empty($hidelist)) { |
6336
|
6336
|
print '<div class="inline-block" style="padding-right: 10px">'; |
6337
|
|
- $newfilter = 'discount_type=' . intval($discount_type); |
|
6337
|
+ $newfilter = 'discount_type='.intval($discount_type); |
6338
|
6338
|
if (!empty($discount_type)) { |
6339
|
6339
|
$newfilter .= ' AND fk_invoice_supplier IS NULL AND fk_invoice_supplier_line IS NULL'; // Supplier discounts available |
6340
|
6340
|
} else { |
6341
|
6341
|
$newfilter .= ' AND fk_facture IS NULL AND fk_facture_line IS NULL'; // Customer discounts available |
6342
|
6342
|
} |
6343
|
6343
|
if ($filter) { |
6344
|
|
- $newfilter .= ' AND (' . $filter . ')'; |
|
6344
|
+ $newfilter .= ' AND ('.$filter.')'; |
6345
|
6345
|
} |
6346
|
6346
|
// output the combo of discounts |
6347
|
6347
|
$nbqualifiedlines = $this->select_remises((string) $selected, $htmlname, $newfilter, $socid, $maxvalue); |
6348
|
6348
|
if ($nbqualifiedlines > 0) { |
6349
|
|
- print ' <input type="submit" class="button smallpaddingimp" value="' . dol_escape_htmltag($langs->trans("UseLine")) . '"'; |
|
6349
|
+ print ' <input type="submit" class="button smallpaddingimp" value="'.dol_escape_htmltag($langs->trans("UseLine")).'"'; |
6350
|
6350
|
if (!empty($discount_type) && $filter && $filter != "fk_invoice_supplier_source IS NULL OR (description LIKE '(DEPOSIT)%' AND description NOT LIKE '(EXCESS PAID)%')") { |
6351
|
|
- print ' title="' . $langs->trans("UseCreditNoteInInvoicePayment") . '"'; |
|
6351
|
+ print ' title="'.$langs->trans("UseCreditNoteInInvoicePayment").'"'; |
6352
|
6352
|
} |
6353
|
6353
|
if (empty($discount_type) && $filter && $filter != "fk_facture_source IS NULL OR (description LIKE '(DEPOSIT)%' AND description NOT LIKE '(EXCESS RECEIVED)%')") { |
6354
|
|
- print ' title="' . $langs->trans("UseCreditNoteInInvoicePayment") . '"'; |
|
6354
|
+ print ' title="'.$langs->trans("UseCreditNoteInInvoicePayment").'"'; |
6355
|
6355
|
} |
6356
|
6356
|
|
6357
|
6357
|
print '>'; |
|
@@ -6391,23 +6391,23 @@ discard block |
|
|
block discarded – undo |
6391
|
6391
|
global $langs; |
6392
|
6392
|
|
6393
|
6393
|
if ($htmlname != "none") { |
6394
|
|
- print '<form method="post" action="' . $page . '">'; |
|
6394
|
+ print '<form method="post" action="'.$page.'">'; |
6395
|
6395
|
print '<input type="hidden" name="action" value="set_contact">'; |
6396
|
|
- print '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
6396
|
+ print '<input type="hidden" name="token" value="'.newToken().'">'; |
6397
|
6397
|
print '<table class="nobordernopadding">'; |
6398
|
6398
|
print '<tr><td>'; |
6399
|
6399
|
print $this->selectcontacts($societe->id, $selected, $htmlname); |
6400
|
6400
|
$num = $this->num; |
6401
|
6401
|
if ($num == 0) { |
6402
|
6402
|
$addcontact = (getDolGlobalString('SOCIETE_ADDRESSES_MANAGEMENT') ? $langs->trans("AddContact") : $langs->trans("AddContactAddress")); |
6403
|
|
- print '<a href="' . DOL_URL_ROOT . '/contact/card.php?socid=' . $societe->id . '&action=create&backtoreferer=1">' . $addcontact . '</a>'; |
|
6403
|
+ print '<a href="'.DOL_URL_ROOT.'/contact/card.php?socid='.$societe->id.'&action=create&backtoreferer=1">'.$addcontact.'</a>'; |
6404
|
6404
|
} |
6405
|
6405
|
print '</td>'; |
6406
|
|
- print '<td class="left"><input type="submit" class="button smallpaddingimp" value="' . $langs->trans("Modify") . '"></td>'; |
|
6406
|
+ print '<td class="left"><input type="submit" class="button smallpaddingimp" value="'.$langs->trans("Modify").'"></td>'; |
6407
|
6407
|
print '</tr></table></form>'; |
6408
|
6408
|
} else { |
6409
|
6409
|
if ($selected) { |
6410
|
|
- require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php'; |
|
6410
|
+ require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; |
6411
|
6411
|
$contact = new Contact($this->db); |
6412
|
6412
|
$contact->fetch($selected); |
6413
|
6413
|
print $contact->getFullName($langs); |
|
@@ -6442,20 +6442,20 @@ discard block |
|
|
block discarded – undo |
6442
|
6442
|
|
6443
|
6443
|
$out = ''; |
6444
|
6444
|
if ($htmlname != "none") { |
6445
|
|
- $out .= '<form method="post" action="' . $page . '">'; |
|
6445
|
+ $out .= '<form method="post" action="'.$page.'">'; |
6446
|
6446
|
$out .= '<input type="hidden" name="action" value="set_thirdparty">'; |
6447
|
|
- $out .= '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
6447
|
+ $out .= '<input type="hidden" name="token" value="'.newToken().'">'; |
6448
|
6448
|
$out .= $this->select_company($selected, $htmlname, $filter, $showempty, $showtype, $forcecombo, $events, 0, 'minwidth100', '', '', 1, array(), false, $excludeids); |
6449
|
|
- $out .= '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">'; |
|
6449
|
+ $out .= '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">'; |
6450
|
6450
|
$out .= '</form>'; |
6451
|
6451
|
} else { |
6452
|
6452
|
if ($selected) { |
6453
|
|
- require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; |
|
6453
|
+ require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; |
6454
|
6454
|
$soc = new Societe($this->db); |
6455
|
6455
|
$soc->fetch($selected); |
6456
|
6456
|
$out .= $soc->getNomUrl(0, ''); |
6457
|
6457
|
} else { |
6458
|
|
- $out .= '<span class="opacitymedium">' . $textifnothirdparty . '</span>'; |
|
6458
|
+ $out .= '<span class="opacitymedium">'.$textifnothirdparty.'</span>'; |
6459
|
6459
|
} |
6460
|
6460
|
} |
6461
|
6461
|
|
|
@@ -6505,22 +6505,22 @@ discard block |
|
|
block discarded – undo |
6505
|
6505
|
$selected = 'EUR'; // Pour compatibilite |
6506
|
6506
|
} |
6507
|
6507
|
|
6508
|
|
- $out .= '<select class="flat maxwidth200onsmartphone minwidth300" name="' . $htmlname . '" id="' . $htmlname . '">'; |
|
6508
|
+ $out .= '<select class="flat maxwidth200onsmartphone minwidth300" name="'.$htmlname.'" id="'.$htmlname.'">'; |
6509
|
6509
|
if ($useempty) { |
6510
|
6510
|
$out .= '<option value="-1" selected></option>'; |
6511
|
6511
|
} |
6512
|
6512
|
foreach ($langs->cache_currencies as $code_iso => $currency) { |
6513
|
6513
|
$labeltoshow = $currency['label']; |
6514
|
6514
|
if ($mode == 1) { |
6515
|
|
- $labeltoshow .= ' <span class="opacitymedium">(' . $code_iso . ')</span>'; |
|
6515
|
+ $labeltoshow .= ' <span class="opacitymedium">('.$code_iso.')</span>'; |
6516
|
6516
|
} else { |
6517
|
|
- $labeltoshow .= ' <span class="opacitymedium">(' . $langs->getCurrencySymbol($code_iso) . ')</span>'; |
|
6517
|
+ $labeltoshow .= ' <span class="opacitymedium">('.$langs->getCurrencySymbol($code_iso).')</span>'; |
6518
|
6518
|
} |
6519
|
6519
|
|
6520
|
6520
|
if ($selected && $selected == $code_iso) { |
6521
|
|
- $out .= '<option value="' . $code_iso . '" selected data-html="' . dol_escape_htmltag($labeltoshow) . '">'; |
|
6521
|
+ $out .= '<option value="'.$code_iso.'" selected data-html="'.dol_escape_htmltag($labeltoshow).'">'; |
6522
|
6522
|
} else { |
6523
|
|
- $out .= '<option value="' . $code_iso . '" data-html="' . dol_escape_htmltag($labeltoshow) . '">'; |
|
6523
|
+ $out .= '<option value="'.$code_iso.'" data-html="'.dol_escape_htmltag($labeltoshow).'">'; |
6524
|
6524
|
} |
6525
|
6525
|
$out .= $labeltoshow; |
6526
|
6526
|
$out .= '</option>'; |
|
@@ -6531,7 +6531,7 @@ discard block |
|
|
block discarded – undo |
6531
|
6531
|
} |
6532
|
6532
|
|
6533
|
6533
|
// Make select dynamic |
6534
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
6534
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
6535
|
6535
|
$out .= ajax_combobox($htmlname); |
6536
|
6536
|
|
6537
|
6537
|
return $out; |
|
@@ -6557,10 +6557,10 @@ discard block |
|
|
block discarded – undo |
6557
|
6557
|
|
6558
|
6558
|
$TCurrency = array(); |
6559
|
6559
|
|
6560
|
|
- $sql = "SELECT code FROM " . $this->db->prefix() . "multicurrency"; |
6561
|
|
- $sql .= " WHERE entity IN ('" . getEntity('mutlicurrency') . "')"; |
|
6560
|
+ $sql = "SELECT code FROM ".$this->db->prefix()."multicurrency"; |
|
6561
|
+ $sql .= " WHERE entity IN ('".getEntity('mutlicurrency')."')"; |
6562
|
6562
|
if ($filter) { |
6563
|
|
- $sql .= " AND " . $filter; |
|
6563
|
+ $sql .= " AND ".$filter; |
6564
|
6564
|
} |
6565
|
6565
|
$resql = $this->db->query($sql); |
6566
|
6566
|
if ($resql) { |
|
@@ -6570,7 +6570,7 @@ discard block |
|
|
block discarded – undo |
6570
|
6570
|
} |
6571
|
6571
|
|
6572
|
6572
|
$out = ''; |
6573
|
|
- $out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">'; |
|
6573
|
+ $out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">'; |
6574
|
6574
|
if ($useempty) { |
6575
|
6575
|
$out .= '<option value=""> </option>'; |
6576
|
6576
|
} |
|
@@ -6582,13 +6582,13 @@ discard block |
|
|
block discarded – undo |
6582
|
6582
|
foreach ($langs->cache_currencies as $code_iso => $currency) { |
6583
|
6583
|
if (isset($TCurrency[$code_iso])) { |
6584
|
6584
|
if (!empty($selected) && $selected == $code_iso) { |
6585
|
|
- $out .= '<option value="' . $code_iso . '" selected="selected">'; |
|
6585
|
+ $out .= '<option value="'.$code_iso.'" selected="selected">'; |
6586
|
6586
|
} else { |
6587
|
|
- $out .= '<option value="' . $code_iso . '">'; |
|
6587
|
+ $out .= '<option value="'.$code_iso.'">'; |
6588
|
6588
|
} |
6589
|
6589
|
|
6590
|
6590
|
$out .= $currency['label']; |
6591
|
|
- $out .= ' (' . $langs->getCurrencySymbol($code_iso) . ')'; |
|
6591
|
+ $out .= ' ('.$langs->getCurrencySymbol($code_iso).')'; |
6592
|
6592
|
$out .= '</option>'; |
6593
|
6593
|
} |
6594
|
6594
|
} |
|
@@ -6597,7 +6597,7 @@ discard block |
|
|
block discarded – undo |
6597
|
6597
|
$out .= '</select>'; |
6598
|
6598
|
|
6599
|
6599
|
// Make select dynamic |
6600
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
6600
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
6601
|
6601
|
$out .= ajax_combobox($htmlname); |
6602
|
6602
|
|
6603
|
6603
|
return $out; |
|
@@ -6628,7 +6628,7 @@ discard block |
|
|
block discarded – undo |
6628
|
6628
|
$sql .= " WHERE t.fk_pays = c.rowid"; |
6629
|
6629
|
$sql .= " AND t.active > 0"; |
6630
|
6630
|
$sql .= " AND t.entity IN (".getEntity('c_tva').")"; |
6631
|
|
- $sql .= " AND c.code IN (" . $this->db->sanitize($country_code, 1) . ")"; |
|
6631
|
+ $sql .= " AND c.code IN (".$this->db->sanitize($country_code, 1).")"; |
6632
|
6632
|
$sql .= " ORDER BY t.code ASC, t.taux ASC, t.recuperableonly ASC"; |
6633
|
6633
|
|
6634
|
6634
|
$resql = $this->db->query($sql); |
|
@@ -6640,30 +6640,30 @@ discard block |
|
|
block discarded – undo |
6640
|
6640
|
|
6641
|
6641
|
$tmparray = array(); |
6642
|
6642
|
$tmparray['rowid'] = $obj->rowid; |
6643
|
|
- $tmparray['type_vat'] = $obj->type_vat; |
6644
|
|
- $tmparray['code'] = $obj->code; |
|
6643
|
+ $tmparray['type_vat'] = $obj->type_vat; |
|
6644
|
+ $tmparray['code'] = $obj->code; |
6645
|
6645
|
$tmparray['txtva'] = $obj->taux; |
6646
|
|
- $tmparray['nprtva'] = $obj->recuperableonly; |
|
6646
|
+ $tmparray['nprtva'] = $obj->recuperableonly; |
6647
|
6647
|
$tmparray['localtax1'] = $obj->localtax1; |
6648
|
6648
|
$tmparray['localtax1_type'] = $obj->localtax1_type; |
6649
|
6649
|
$tmparray['localtax2'] = $obj->localtax2; |
6650
|
6650
|
$tmparray['localtax2_type'] = $obj->localtax1_type; |
6651
|
|
- $tmparray['label'] = $obj->taux . '%' . ($obj->code ? ' (' . $obj->code . ')' : ''); // Label must contains only 0-9 , . % or * |
6652
|
|
- $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 |
|
6651
|
+ $tmparray['label'] = $obj->taux.'%'.($obj->code ? ' ('.$obj->code.')' : ''); // Label must contains only 0-9 , . % or * |
|
6652
|
+ $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 |
6653
|
6653
|
$positiverates = ''; |
6654
|
6654
|
if ($obj->taux) { |
6655
|
|
- $positiverates .= ($positiverates ? '/' : '') . $obj->taux; |
|
6655
|
+ $positiverates .= ($positiverates ? '/' : '').$obj->taux; |
6656
|
6656
|
} |
6657
|
6657
|
if ($obj->localtax1) { |
6658
|
|
- $positiverates .= ($positiverates ? '/' : '') . $obj->localtax1; |
|
6658
|
+ $positiverates .= ($positiverates ? '/' : '').$obj->localtax1; |
6659
|
6659
|
} |
6660
|
6660
|
if ($obj->localtax2) { |
6661
|
|
- $positiverates .= ($positiverates ? '/' : '') . $obj->localtax2; |
|
6661
|
+ $positiverates .= ($positiverates ? '/' : '').$obj->localtax2; |
6662
|
6662
|
} |
6663
|
6663
|
if (empty($positiverates)) { |
6664
|
6664
|
$positiverates = '0'; |
6665
|
6665
|
} |
6666
|
|
- $tmparray['labelpositiverates'] = $positiverates . ($obj->code ? ' (' . $obj->code . ')' : ''); // Must never be used as key, only label |
|
6666
|
+ $tmparray['labelpositiverates'] = $positiverates.($obj->code ? ' ('.$obj->code.')' : ''); // Must never be used as key, only label |
6667
|
6667
|
|
6668
|
6668
|
$this->cache_vatrates[$obj->rowid] = $tmparray; |
6669
|
6669
|
} |
|
@@ -6683,7 +6683,7 @@ discard block |
|
|
block discarded – undo |
6683
|
6683
|
return -1; |
6684
|
6684
|
} |
6685
|
6685
|
} else { |
6686
|
|
- $this->error = '<span class="error">' . $this->db->error() . '</span>'; |
|
6686
|
+ $this->error = '<span class="error">'.$this->db->error().'</span>'; |
6687
|
6687
|
return -2; |
6688
|
6688
|
} |
6689
|
6689
|
} |
|
@@ -6736,9 +6736,9 @@ discard block |
|
|
block discarded – undo |
6736
|
6736
|
// Check parameters |
6737
|
6737
|
if (is_object($societe_vendeuse) && !$societe_vendeuse->country_code) { |
6738
|
6738
|
if ($societe_vendeuse->id == $mysoc->id) { |
6739
|
|
- $return .= '<span class="error">' . $langs->trans("ErrorYourCountryIsNotDefined") . '</span>'; |
|
6739
|
+ $return .= '<span class="error">'.$langs->trans("ErrorYourCountryIsNotDefined").'</span>'; |
6740
|
6740
|
} else { |
6741
|
|
- $return .= '<span class="error">' . $langs->trans("ErrorSupplierCountryIsNotDefined") . '</span>'; |
|
6741
|
+ $return .= '<span class="error">'.$langs->trans("ErrorSupplierCountryIsNotDefined").'</span>'; |
6742
|
6742
|
} |
6743
|
6743
|
return $return; |
6744
|
6744
|
} |
|
@@ -6750,12 +6750,12 @@ discard block |
|
|
block discarded – undo |
6750
|
6750
|
// Define list of countries to use to search VAT rates to show |
6751
|
6751
|
// First we defined code_country to use to find list |
6752
|
6752
|
if (is_object($societe_vendeuse)) { |
6753
|
|
- $code_country = "'" . $societe_vendeuse->country_code . "'"; |
|
6753
|
+ $code_country = "'".$societe_vendeuse->country_code."'"; |
6754
|
6754
|
} else { |
6755
|
|
- $code_country = "'" . $mysoc->country_code . "'"; // Pour compatibilite ascendente |
|
6755
|
+ $code_country = "'".$mysoc->country_code."'"; // Pour compatibilite ascendente |
6756
|
6756
|
} |
6757
|
6757
|
if (getDolGlobalString('SERVICE_ARE_ECOMMERCE_200238EC')) { // If option to have vat for end customer for services is on |
6758
|
|
- require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php'; |
|
6758
|
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; |
6759
|
6759
|
// If SERVICE_ARE_ECOMMERCE_200238EC=1 combo list vat rate of purchaser and seller countries |
6760
|
6760
|
// If SERVICE_ARE_ECOMMERCE_200238EC=2 combo list only the vat rate of the purchaser country |
6761
|
6761
|
$selectVatComboMode = getDolGlobalString('SERVICE_ARE_ECOMMERCE_200238EC'); |
|
@@ -6765,27 +6765,27 @@ discard block |
|
|
block discarded – undo |
6765
|
6765
|
if ($type == 1) { // We know product is a service |
6766
|
6766
|
switch ($selectVatComboMode) { |
6767
|
6767
|
case '1': |
6768
|
|
- $code_country .= ",'" . $societe_acheteuse->country_code . "'"; |
|
6768
|
+ $code_country .= ",'".$societe_acheteuse->country_code."'"; |
6769
|
6769
|
break; |
6770
|
6770
|
case '2': |
6771
|
|
- $code_country = "'" . $societe_acheteuse->country_code . "'"; |
|
6771
|
+ $code_country = "'".$societe_acheteuse->country_code."'"; |
6772
|
6772
|
break; |
6773
|
6773
|
} |
6774
|
6774
|
} |
6775
|
6775
|
} elseif (!$idprod) { // We don't know type of product |
6776
|
6776
|
switch ($selectVatComboMode) { |
6777
|
6777
|
case '1': |
6778
|
|
- $code_country .= ",'" . $societe_acheteuse->country_code . "'"; |
|
6778
|
+ $code_country .= ",'".$societe_acheteuse->country_code."'"; |
6779
|
6779
|
break; |
6780
|
6780
|
case '2': |
6781
|
|
- $code_country = "'" . $societe_acheteuse->country_code . "'"; |
|
6781
|
+ $code_country = "'".$societe_acheteuse->country_code."'"; |
6782
|
6782
|
break; |
6783
|
6783
|
} |
6784
|
6784
|
} else { |
6785
|
6785
|
$prodstatic = new Product($this->db); |
6786
|
6786
|
$prodstatic->fetch($idprod); |
6787
|
6787
|
if ($prodstatic->type == Product::TYPE_SERVICE) { // We know product is a service |
6788
|
|
- $code_country .= ",'" . $societe_acheteuse->country_code . "'"; |
|
6788
|
+ $code_country .= ",'".$societe_acheteuse->country_code."'"; |
6789
|
6789
|
} |
6790
|
6790
|
} |
6791
|
6791
|
} |
|
@@ -6847,13 +6847,13 @@ discard block |
|
|
block discarded – undo |
6847
|
6847
|
// Override/enable VAT for expense report regardless of global setting - needed if expense report used for business expenses instead |
6848
|
6848
|
// of using supplier invoices (this is a very bad idea !) |
6849
|
6849
|
if (!getDolGlobalString('EXPENSEREPORT_OVERRIDE_VAT')) { |
6850
|
|
- $title = ' title="' . dol_escape_htmltag($langs->trans('VATIsNotUsed')) . '"'; |
|
6850
|
+ $title = ' title="'.dol_escape_htmltag($langs->trans('VATIsNotUsed')).'"'; |
6851
|
6851
|
$disabled = true; |
6852
|
6852
|
} |
6853
|
6853
|
} |
6854
|
6854
|
|
6855
|
6855
|
if (!$options_only) { |
6856
|
|
- $return .= '<select class="flat minwidth75imp maxwidth100 right" id="' . $htmlname . '" name="' . $htmlname . '"' . ($disabled ? ' disabled' : '') . $title . '>'; |
|
6856
|
+ $return .= '<select class="flat minwidth75imp maxwidth100 right" id="'.$htmlname.'" name="'.$htmlname.'"'.($disabled ? ' disabled' : '').$title.'>'; |
6857
|
6857
|
} |
6858
|
6858
|
|
6859
|
6859
|
$selectedfound = false; |
|
@@ -6867,13 +6867,13 @@ discard block |
|
|
block discarded – undo |
6867
|
6867
|
$key = $rate['txtva']; |
6868
|
6868
|
$key .= $rate['nprtva'] ? '*' : ''; |
6869
|
6869
|
if ($mode > 0 && $rate['code']) { |
6870
|
|
- $key .= ' (' . $rate['code'] . ')'; |
|
6870
|
+ $key .= ' ('.$rate['code'].')'; |
6871
|
6871
|
} |
6872
|
6872
|
if ($mode < 0) { |
6873
|
6873
|
$key = $rate['rowid']; |
6874
|
6874
|
} |
6875
|
6875
|
|
6876
|
|
- $return .= '<option value="' . $key . '"'; |
|
6876
|
+ $return .= '<option value="'.$key.'"'; |
6877
|
6877
|
if (!$selectedfound) { |
6878
|
6878
|
if ($defaultcode) { // If defaultcode is defined, we used it in priority to select combo option instead of using rate+npr flag |
6879
|
6879
|
if ($defaultcode == $rate['code']) { |
|
@@ -6944,7 +6944,7 @@ discard block |
|
|
block discarded – undo |
6944
|
6944
|
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 = '') |
6945
|
6945
|
{ |
6946
|
6946
|
// phpcs:enable |
6947
|
|
- dol_syslog(__METHOD__ . ': using select_date is deprecated. Use selectDate instead.', LOG_WARNING); |
|
6947
|
+ dol_syslog(__METHOD__.': using select_date is deprecated. Use selectDate instead.', LOG_WARNING); |
6948
|
6948
|
$retstring = $this->selectDate($set_time, $prefix, $h, $m, $empty, $form_name, $d, $addnowlink, $disabled, $fullday, $addplusone, $adddateof); |
6949
|
6949
|
if (!empty($nooutput)) { |
6950
|
6950
|
return $retstring; |
|
@@ -6973,11 +6973,11 @@ discard block |
|
|
block discarded – undo |
6973
|
6973
|
{ |
6974
|
6974
|
global $langs; |
6975
|
6975
|
|
6976
|
|
- $ret = $this->selectDate($set_time, $prefix . '_start', 0, 0, $empty, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("from"), 'tzuserrel'); |
|
6976
|
+ $ret = $this->selectDate($set_time, $prefix.'_start', 0, 0, $empty, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("from"), 'tzuserrel'); |
6977
|
6977
|
if ($forcenewline) { |
6978
|
6978
|
$ret .= '<br>'; |
6979
|
6979
|
} |
6980
|
|
- $ret .= $this->selectDate($set_time_end, $prefix . '_end', 0, 0, $empty, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"), 'tzuserrel'); |
|
6980
|
+ $ret .= $this->selectDate($set_time_end, $prefix.'_end', 0, 0, $empty, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"), 'tzuserrel'); |
6981
|
6981
|
return $ret; |
6982
|
6982
|
} |
6983
|
6983
|
|
|
@@ -7043,7 +7043,7 @@ discard block |
|
|
block discarded – undo |
7043
|
7043
|
$orig_set_time = $set_time; |
7044
|
7044
|
|
7045
|
7045
|
if ($set_time === '' && $emptydate == 0) { |
7046
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php'; |
|
7046
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; |
7047
|
7047
|
if ($gm == 'tzuser' || $gm == 'tzuserrel') { |
7048
|
7048
|
$set_time = dol_now($gm); |
7049
|
7049
|
} else { |
|
@@ -7115,38 +7115,38 @@ discard block |
|
|
block discarded – undo |
7115
|
7115
|
// Calendrier popup version eldy |
7116
|
7116
|
if ($usecalendar == "eldy") { |
7117
|
7117
|
// Input area to enter date manually |
7118
|
|
- $retstring .= '<input id="' . $prefix . '" name="' . $prefix . '" type="text" class="maxwidthdate center" maxlength="11" value="' . $formated_date . '"'; |
|
7118
|
+ $retstring .= '<input id="'.$prefix.'" name="'.$prefix.'" type="text" class="maxwidthdate center" maxlength="11" value="'.$formated_date.'"'; |
7119
|
7119
|
$retstring .= ($disabled ? ' disabled' : ''); |
7120
|
|
- $retstring .= ' onChange="dpChangeDay(\'' . $prefix . '\',\'' . $langs->trans("FormatDateShortJavaInput") . '\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript |
|
7120
|
+ $retstring .= ' onChange="dpChangeDay(\''.$prefix.'\',\''.$langs->trans("FormatDateShortJavaInput").'\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript |
7121
|
7121
|
$retstring .= ' autocomplete="off">'; |
7122
|
7122
|
|
7123
|
7123
|
// Icon calendar |
7124
|
7124
|
$retstringbuttom = ''; |
7125
|
7125
|
if (!$disabled) { |
7126
|
|
- $retstringbuttom = '<button id="' . $prefix . 'Button" type="button" class="dpInvisibleButtons"'; |
7127
|
|
- $base = DOL_URL_ROOT . '/core/'; |
7128
|
|
- $retstringbuttom .= ' onClick="showDP(\'' . $base . '\',\'' . $prefix . '\',\'' . $langs->trans("FormatDateShortJavaInput") . '\',\'' . $langs->defaultlang . '\');"'; |
7129
|
|
- $retstringbuttom .= '>' . img_object($langs->trans("SelectDate"), 'calendarday', 'class="datecallink"') . '</button>'; |
|
7126
|
+ $retstringbuttom = '<button id="'.$prefix.'Button" type="button" class="dpInvisibleButtons"'; |
|
7127
|
+ $base = DOL_URL_ROOT.'/core/'; |
|
7128
|
+ $retstringbuttom .= ' onClick="showDP(\''.$base.'\',\''.$prefix.'\',\''.$langs->trans("FormatDateShortJavaInput").'\',\''.$langs->defaultlang.'\');"'; |
|
7129
|
+ $retstringbuttom .= '>'.img_object($langs->trans("SelectDate"), 'calendarday', 'class="datecallink"').'</button>'; |
7130
|
7130
|
} else { |
7131
|
|
- $retstringbuttom = '<button id="' . $prefix . 'Button" type="button" class="dpInvisibleButtons">' . img_object($langs->trans("Disabled"), 'calendarday', 'class="datecallink"') . '</button>'; |
|
7131
|
+ $retstringbuttom = '<button id="'.$prefix.'Button" type="button" class="dpInvisibleButtons">'.img_object($langs->trans("Disabled"), 'calendarday', 'class="datecallink"').'</button>'; |
7132
|
7132
|
} |
7133
|
|
- $retstring = $retstringbuttom . $retstring; |
|
7133
|
+ $retstring = $retstringbuttom.$retstring; |
7134
|
7134
|
|
7135
|
|
- $retstring .= '<input type="hidden" id="' . $prefix . 'day" name="' . $prefix . 'day" value="' . $sday . '">' . "\n"; |
7136
|
|
- $retstring .= '<input type="hidden" id="' . $prefix . 'month" name="' . $prefix . 'month" value="' . $smonth . '">' . "\n"; |
7137
|
|
- $retstring .= '<input type="hidden" id="' . $prefix . 'year" name="' . $prefix . 'year" value="' . $syear . '">' . "\n"; |
|
7135
|
+ $retstring .= '<input type="hidden" id="'.$prefix.'day" name="'.$prefix.'day" value="'.$sday.'">'."\n"; |
|
7136
|
+ $retstring .= '<input type="hidden" id="'.$prefix.'month" name="'.$prefix.'month" value="'.$smonth.'">'."\n"; |
|
7137
|
+ $retstring .= '<input type="hidden" id="'.$prefix.'year" name="'.$prefix.'year" value="'.$syear.'">'."\n"; |
7138
|
7138
|
} elseif ($usecalendar == 'jquery' || $usecalendar == 'html') { |
7139
|
7139
|
if (!$disabled && $usecalendar != 'html') { |
7140
|
7140
|
// Output javascript for datepicker |
7141
|
7141
|
$minYear = getDolGlobalInt('MIN_YEAR_SELECT_DATE', (idate('Y') - 100)); |
7142
|
7142
|
$maxYear = getDolGlobalInt('MAX_YEAR_SELECT_DATE', (idate('Y') + 100)); |
7143
|
7143
|
|
7144
|
|
- $retstring .= '<script nonce="' . getNonce() . '" type="text/javascript">'; |
7145
|
|
- $retstring .= "$(function(){ $('#" . $prefix . "').datepicker({ |
7146
|
|
- dateFormat: '" . $langs->trans("FormatDateShortJQueryInput") . "', |
|
7144
|
+ $retstring .= '<script nonce="'.getNonce().'" type="text/javascript">'; |
|
7145
|
+ $retstring .= "$(function(){ $('#".$prefix."').datepicker({ |
|
7146
|
+ dateFormat: '" . $langs->trans("FormatDateShortJQueryInput")."', |
7147
|
7147
|
autoclose: true, |
7148
|
7148
|
todayHighlight: true, |
7149
|
|
- yearRange: '" . $minYear . ":" . $maxYear . "',"; |
|
7149
|
+ yearRange: '" . $minYear.":".$maxYear."',"; |
7150
|
7150
|
if (!empty($conf->dol_use_jmobile)) { |
7151
|
7151
|
$retstring .= " |
7152
|
7152
|
beforeShow: function (input, datePicker) { |
|
@@ -7161,7 +7161,7 @@ discard block |
|
|
block discarded – undo |
7161
|
7161
|
if (!getDolGlobalString('MAIN_POPUP_CALENDAR_ON_FOCUS')) { |
7162
|
7162
|
$retstring .= " |
7163
|
7163
|
showOn: 'button', /* both has problem with autocompletion */ |
7164
|
|
- buttonImage: '" . DOL_URL_ROOT . "/theme/" . dol_escape_js($conf->theme) . "/img/object_calendarday.png', |
|
7164
|
+ buttonImage: '" . DOL_URL_ROOT."/theme/".dol_escape_js($conf->theme)."/img/object_calendarday.png', |
7165
|
7165
|
buttonImageOnly: true"; |
7166
|
7166
|
} |
7167
|
7167
|
$retstring .= " |
|
@@ -7173,46 +7173,46 @@ discard block |
|
|
block discarded – undo |
7173
|
7173
|
$retstring .= '<div class="nowraponall inline-block divfordateinput">'; |
7174
|
7174
|
$retstring .= '<input id="'.$prefix.'" name="'.$prefix.'" type="text" class="maxwidthdate center" maxlength="11" value="'.$formated_date.'"'; |
7175
|
7175
|
$retstring .= ($disabled ? ' disabled' : ''); |
7176
|
|
- $retstring .= ($placeholder ? ' placeholder="' . dol_escape_htmltag($placeholder) . '"' : ''); |
7177
|
|
- $retstring .= ' onChange="dpChangeDay(\'' . dol_escape_js($prefix) . '\',\'' . dol_escape_js($langs->trans("FormatDateShortJavaInput")) . '\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript |
|
7176
|
+ $retstring .= ($placeholder ? ' placeholder="'.dol_escape_htmltag($placeholder).'"' : ''); |
|
7177
|
+ $retstring .= ' onChange="dpChangeDay(\''.dol_escape_js($prefix).'\',\''.dol_escape_js($langs->trans("FormatDateShortJavaInput")).'\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript |
7178
|
7178
|
$retstring .= ' autocomplete="off">'; |
7179
|
7179
|
|
7180
|
7180
|
// Icone calendrier |
7181
|
7181
|
if ($disabled) { |
7182
|
|
- $retstringbutton = '<button id="' . $prefix . 'Button" type="button" class="dpInvisibleButtons">' . img_object($langs->trans("Disabled"), 'calendarday', 'class="datecallink"') . '</button>'; |
7183
|
|
- $retstring = $retstringbutton . $retstring; |
|
7182
|
+ $retstringbutton = '<button id="'.$prefix.'Button" type="button" class="dpInvisibleButtons">'.img_object($langs->trans("Disabled"), 'calendarday', 'class="datecallink"').'</button>'; |
|
7183
|
+ $retstring = $retstringbutton.$retstring; |
7184
|
7184
|
} |
7185
|
7185
|
|
7186
|
7186
|
$retstring .= '</div>'; |
7187
|
|
- $retstring .= '<input type="hidden" id="' . $prefix . 'day" name="' . $prefix . 'day" value="' . $sday . '">' . "\n"; |
7188
|
|
- $retstring .= '<input type="hidden" id="' . $prefix . 'month" name="' . $prefix . 'month" value="' . $smonth . '">' . "\n"; |
7189
|
|
- $retstring .= '<input type="hidden" id="' . $prefix . 'year" name="' . $prefix . 'year" value="' . $syear . '">' . "\n"; |
|
7187
|
+ $retstring .= '<input type="hidden" id="'.$prefix.'day" name="'.$prefix.'day" value="'.$sday.'">'."\n"; |
|
7188
|
+ $retstring .= '<input type="hidden" id="'.$prefix.'month" name="'.$prefix.'month" value="'.$smonth.'">'."\n"; |
|
7189
|
+ $retstring .= '<input type="hidden" id="'.$prefix.'year" name="'.$prefix.'year" value="'.$syear.'">'."\n"; |
7190
|
7190
|
} else { |
7191
|
7191
|
$retstring .= "Bad value of MAIN_POPUP_CALENDAR"; |
7192
|
7192
|
} |
7193
|
7193
|
} else { |
7194
|
7194
|
// Show date with combo selects |
7195
|
7195
|
// Day |
7196
|
|
- $retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth50imp" id="' . $prefix . 'day" name="' . $prefix . 'day">'; |
|
7196
|
+ $retstring .= '<select'.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth50imp" id="'.$prefix.'day" name="'.$prefix.'day">'; |
7197
|
7197
|
|
7198
|
7198
|
if ($emptydate || $set_time == -1) { |
7199
|
7199
|
$retstring .= '<option value="0" selected> </option>'; |
7200
|
7200
|
} |
7201
|
7201
|
|
7202
|
7202
|
for ($day = 1; $day <= 31; $day++) { |
7203
|
|
- $retstring .= '<option value="' . $day . '"' . ($day == $sday ? ' selected' : '') . '>' . $day . '</option>'; |
|
7203
|
+ $retstring .= '<option value="'.$day.'"'.($day == $sday ? ' selected' : '').'>'.$day.'</option>'; |
7204
|
7204
|
} |
7205
|
7205
|
|
7206
|
7206
|
$retstring .= "</select>"; |
7207
|
7207
|
|
7208
|
|
- $retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth75imp" id="' . $prefix . 'month" name="' . $prefix . 'month">'; |
|
7208
|
+ $retstring .= '<select'.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth75imp" id="'.$prefix.'month" name="'.$prefix.'month">'; |
7209
|
7209
|
if ($emptydate || $set_time == -1) { |
7210
|
7210
|
$retstring .= '<option value="0" selected> </option>'; |
7211
|
7211
|
} |
7212
|
7212
|
|
7213
|
7213
|
// Month |
7214
|
7214
|
for ($month = 1; $month <= 12; $month++) { |
7215
|
|
- $retstring .= '<option value="' . $month . '"' . ($month == $smonth ? ' selected' : '') . '>'; |
|
7215
|
+ $retstring .= '<option value="'.$month.'"'.($month == $smonth ? ' selected' : '').'>'; |
7216
|
7216
|
$retstring .= dol_print_date(mktime(12, 0, 0, $month, 1, 2000), "%b"); |
7217
|
7217
|
$retstring .= "</option>"; |
7218
|
7218
|
} |
|
@@ -7220,13 +7220,13 @@ discard block |
|
|
block discarded – undo |
7220
|
7220
|
|
7221
|
7221
|
// Year |
7222
|
7222
|
if ($emptydate || $set_time == -1) { |
7223
|
|
- $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 . '">'; |
|
7223
|
+ $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.'">'; |
7224
|
7224
|
} else { |
7225
|
|
- $retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth75imp" id="' . $prefix . 'year" name="' . $prefix . 'year">'; |
|
7225
|
+ $retstring .= '<select'.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth75imp" id="'.$prefix.'year" name="'.$prefix.'year">'; |
7226
|
7226
|
|
7227
|
7227
|
$syear = (int) $syear; |
7228
|
7228
|
for ($year = $syear - 10; $year < (int) $syear + 10; $year++) { |
7229
|
|
- $retstring .= '<option value="' . $year . '"' . ($year == $syear ? ' selected' : '') . '>' . $year . '</option>'; |
|
7229
|
+ $retstring .= '<option value="'.$year.'"'.($year == $syear ? ' selected' : '').'>'.$year.'</option>'; |
7230
|
7230
|
} |
7231
|
7231
|
$retstring .= "</select>\n"; |
7232
|
7232
|
} |
|
@@ -7250,15 +7250,15 @@ discard block |
|
|
block discarded – undo |
7250
|
7250
|
} |
7251
|
7251
|
} |
7252
|
7252
|
// Show hour |
7253
|
|
- $retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth50 ' . ($fullday ? $fullday . 'hour' : '') . '" id="' . $prefix . 'hour" name="' . $prefix . 'hour">'; |
|
7253
|
+ $retstring .= '<select'.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth50 '.($fullday ? $fullday.'hour' : '').'" id="'.$prefix.'hour" name="'.$prefix.'hour">'; |
7254
|
7254
|
if ($emptyhours) { |
7255
|
7255
|
$retstring .= '<option value="-1"> </option>'; |
7256
|
7256
|
} |
7257
|
7257
|
for ($hour = $hourstart; $hour < $hourend; $hour++) { |
7258
|
7258
|
if (strlen($hour) < 2) { |
7259
|
|
- $hour = "0" . $hour; |
|
7259
|
+ $hour = "0".$hour; |
7260
|
7260
|
} |
7261
|
|
- $retstring .= '<option value="' . $hour . '"' . (($hour == $shour) ? ' selected' : '') . '>' . $hour; |
|
7261
|
+ $retstring .= '<option value="'.$hour.'"'.(($hour == $shour) ? ' selected' : '').'>'.$hour; |
7262
|
7262
|
//$retstring .= (empty($conf->dol_optimize_smallscreen) ? '' : 'H'); |
7263
|
7263
|
$retstring .= '</option>'; |
7264
|
7264
|
} |
|
@@ -7271,17 +7271,17 @@ discard block |
|
|
block discarded – undo |
7271
|
7271
|
|
7272
|
7272
|
if ($m) { |
7273
|
7273
|
// Show minutes |
7274
|
|
- $retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth50 ' . ($fullday ? $fullday . 'min' : '') . '" id="' . $prefix . 'min" name="' . $prefix . 'min">'; |
|
7274
|
+ $retstring .= '<select'.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth50 '.($fullday ? $fullday.'min' : '').'" id="'.$prefix.'min" name="'.$prefix.'min">'; |
7275
|
7275
|
if ($emptyhours) { |
7276
|
7276
|
$retstring .= '<option value="-1"> </option>'; |
7277
|
7277
|
} |
7278
|
7278
|
for ($min = 0; $min < 60; $min += $stepminutes) { |
7279
|
7279
|
$min_str = sprintf("%02d", $min); |
7280
|
|
- $retstring .= '<option value="' . $min_str . '"' . (($min_str == $smin) ? ' selected' : '') . '>' . $min_str . '</option>'; |
|
7280
|
+ $retstring .= '<option value="'.$min_str.'"'.(($min_str == $smin) ? ' selected' : '').'>'.$min_str.'</option>'; |
7281
|
7281
|
} |
7282
|
7282
|
$retstring .= '</select>'; |
7283
|
7283
|
|
7284
|
|
- $retstring .= '<input type="hidden" name="' . $prefix . 'sec" value="' . $ssec . '">'; |
|
7284
|
+ $retstring .= '<input type="hidden" name="'.$prefix.'sec" value="'.$ssec.'">'; |
7285
|
7285
|
} |
7286
|
7286
|
|
7287
|
7287
|
if ($d && $h) { |
|
@@ -7304,10 +7304,10 @@ discard block |
|
|
block discarded – undo |
7304
|
7304
|
|
7305
|
7305
|
// Generate the date part, depending on the use or not of the javascript calendar |
7306
|
7306
|
if ($addnowlink == 1) { // server time expressed in user time setup |
7307
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . '\').val(\'' . dol_print_date($nowgmt, 'day', 'tzuserrel') . '\');'; |
7308
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'day\').val(\'' . dol_print_date($nowgmt, '%d', 'tzuserrel') . '\');'; |
7309
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'month\').val(\'' . dol_print_date($nowgmt, '%m', 'tzuserrel') . '\');'; |
7310
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'year\').val(\'' . dol_print_date($nowgmt, '%Y', 'tzuserrel') . '\');'; |
|
7307
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'\').val(\''.dol_print_date($nowgmt, 'day', 'tzuserrel').'\');'; |
|
7308
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'day\').val(\''.dol_print_date($nowgmt, '%d', 'tzuserrel').'\');'; |
|
7309
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(\''.dol_print_date($nowgmt, '%m', 'tzuserrel').'\');'; |
|
7310
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(\''.dol_print_date($nowgmt, '%Y', 'tzuserrel').'\');'; |
7311
|
7311
|
} elseif ($addnowlink == 2) { |
7312
|
7312
|
/* Disabled because the output does not use the string format defined by FormatDateShort key to forge the value into #prefix. |
7313
|
7313
|
* This break application for foreign languages. |
|
@@ -7316,10 +7316,10 @@ discard block |
|
|
block discarded – undo |
7316
|
7316
|
$reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(parseInt(d.getMonth().pad()) + 1);'; |
7317
|
7317
|
$reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(d.getFullYear());'; |
7318
|
7318
|
*/ |
7319
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . '\').val(\'' . dol_print_date($nowgmt, 'day', 'tzuserrel') . '\');'; |
7320
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'day\').val(\'' . dol_print_date($nowgmt, '%d', 'tzuserrel') . '\');'; |
7321
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'month\').val(\'' . dol_print_date($nowgmt, '%m', 'tzuserrel') . '\');'; |
7322
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'year\').val(\'' . dol_print_date($nowgmt, '%Y', 'tzuserrel') . '\');'; |
|
7319
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'\').val(\''.dol_print_date($nowgmt, 'day', 'tzuserrel').'\');'; |
|
7320
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'day\').val(\''.dol_print_date($nowgmt, '%d', 'tzuserrel').'\');'; |
|
7321
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(\''.dol_print_date($nowgmt, '%m', 'tzuserrel').'\');'; |
|
7322
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(\''.dol_print_date($nowgmt, '%Y', 'tzuserrel').'\');'; |
7323
|
7323
|
} |
7324
|
7324
|
/*if ($usecalendar == "eldy") |
7325
|
7325
|
{ |
|
@@ -7339,11 +7339,11 @@ discard block |
|
|
block discarded – undo |
7339
|
7339
|
} |
7340
|
7340
|
//$reset_scripts .= 'this.form.elements[\''.$prefix.'hour\'].value=formatDate(new Date(), \'HH\'); '; |
7341
|
7341
|
if ($addnowlink == 1) { |
7342
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'hour\').val(\'' . dol_print_date($nowgmt, '%H', 'tzuserrel') . '\');'; |
7343
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'hour\').change();'; |
|
7342
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').val(\''.dol_print_date($nowgmt, '%H', 'tzuserrel').'\');'; |
|
7343
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').change();'; |
7344
|
7344
|
} elseif ($addnowlink == 2) { |
7345
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'hour\').val(d.getHours().pad());'; |
7346
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'hour\').change();'; |
|
7345
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').val(d.getHours().pad());'; |
|
7346
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').change();'; |
7347
|
7347
|
} |
7348
|
7348
|
|
7349
|
7349
|
if ($fullday) { |
|
@@ -7357,11 +7357,11 @@ discard block |
|
|
block discarded – undo |
7357
|
7357
|
} |
7358
|
7358
|
//$reset_scripts .= 'this.form.elements[\''.$prefix.'min\'].value=formatDate(new Date(), \'mm\'); '; |
7359
|
7359
|
if ($addnowlink == 1) { |
7360
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'min\').val(\'' . dol_print_date($nowgmt, '%M', 'tzuserrel') . '\');'; |
7361
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'min\').change();'; |
|
7360
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'min\').val(\''.dol_print_date($nowgmt, '%M', 'tzuserrel').'\');'; |
|
7361
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'min\').change();'; |
7362
|
7362
|
} elseif ($addnowlink == 2) { |
7363
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'min\').val(d.getMinutes().pad());'; |
7364
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'min\').change();'; |
|
7363
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'min\').val(d.getMinutes().pad());'; |
|
7364
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'min\').change();'; |
7365
|
7365
|
} |
7366
|
7366
|
if ($fullday) { |
7367
|
7367
|
$reset_scripts .= ' } '; |
|
@@ -7369,7 +7369,7 @@ discard block |
|
|
block discarded – undo |
7369
|
7369
|
} |
7370
|
7370
|
// If reset_scripts is not empty, print the link with the reset_scripts in the onClick |
7371
|
7371
|
if ($reset_scripts && !getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) { |
7372
|
|
- $retstring .= ' <button class="dpInvisibleButtons datenowlink" id="' . $prefix . 'ButtonNow" type="button" name="_useless" value="now" onClick="' . $reset_scripts . '">'; |
|
7372
|
+ $retstring .= ' <button class="dpInvisibleButtons datenowlink" id="'.$prefix.'ButtonNow" type="button" name="_useless" value="now" onClick="'.$reset_scripts.'">'; |
7373
|
7373
|
$retstring .= $langs->trans("Now"); |
7374
|
7374
|
$retstring .= '</button> '; |
7375
|
7375
|
} |
|
@@ -7381,16 +7381,16 @@ discard block |
|
|
block discarded – undo |
7381
|
7381
|
$reset_scripts = ""; |
7382
|
7382
|
|
7383
|
7383
|
// Generate the date part, depending on the use or not of the javascript calendar |
7384
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . '\').val(\'' . dol_print_date($nowgmt, 'dayinputnoreduce', 'tzuserrel') . '\');'; |
7385
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'day\').val(\'' . dol_print_date($nowgmt, '%d', 'tzuserrel') . '\');'; |
7386
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'month\').val(\'' . dol_print_date($nowgmt, '%m', 'tzuserrel') . '\');'; |
7387
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'year\').val(\'' . dol_print_date($nowgmt, '%Y', 'tzuserrel') . '\');'; |
|
7384
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'\').val(\''.dol_print_date($nowgmt, 'dayinputnoreduce', 'tzuserrel').'\');'; |
|
7385
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'day\').val(\''.dol_print_date($nowgmt, '%d', 'tzuserrel').'\');'; |
|
7386
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(\''.dol_print_date($nowgmt, '%m', 'tzuserrel').'\');'; |
|
7387
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(\''.dol_print_date($nowgmt, '%Y', 'tzuserrel').'\');'; |
7388
|
7388
|
// Update the hour part |
7389
|
7389
|
if ($h) { |
7390
|
7390
|
if ($fullday) { |
7391
|
7391
|
$reset_scripts .= " if (jQuery('#fullday:checked').val() == null) {"; |
7392
|
7392
|
} |
7393
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'hour\').val(\'' . dol_print_date($nowgmt, '%H', 'tzuserrel') . '\');'; |
|
7393
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').val(\''.dol_print_date($nowgmt, '%H', 'tzuserrel').'\');'; |
7394
|
7394
|
if ($fullday) { |
7395
|
7395
|
$reset_scripts .= ' } '; |
7396
|
7396
|
} |
|
@@ -7400,14 +7400,14 @@ discard block |
|
|
block discarded – undo |
7400
|
7400
|
if ($fullday) { |
7401
|
7401
|
$reset_scripts .= " if (jQuery('#fullday:checked').val() == null) {"; |
7402
|
7402
|
} |
7403
|
|
- $reset_scripts .= 'jQuery(\'#' . $prefix . 'min\').val(\'' . dol_print_date($nowgmt, '%M', 'tzuserrel') . '\');'; |
|
7403
|
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'min\').val(\''.dol_print_date($nowgmt, '%M', 'tzuserrel').'\');'; |
7404
|
7404
|
if ($fullday) { |
7405
|
7405
|
$reset_scripts .= ' } '; |
7406
|
7406
|
} |
7407
|
7407
|
} |
7408
|
7408
|
// If reset_scripts is not empty, print the link with the reset_scripts in the onClick |
7409
|
7409
|
if ($reset_scripts && empty($conf->dol_optimize_smallscreen)) { |
7410
|
|
- $retstring .= ' <button class="dpInvisibleButtons datenowlink" id="' . $prefix . 'ButtonPlusOne" type="button" name="_useless2" value="plusone" onClick="' . $reset_scripts . '">'; |
|
7410
|
+ $retstring .= ' <button class="dpInvisibleButtons datenowlink" id="'.$prefix.'ButtonPlusOne" type="button" name="_useless2" value="plusone" onClick="'.$reset_scripts.'">'; |
7411
|
7411
|
$retstring .= $langs->trans("DateStartPlusOne"); |
7412
|
7412
|
$retstring .= '</button> '; |
7413
|
7413
|
} |
|
@@ -7465,17 +7465,17 @@ discard block |
|
|
block discarded – undo |
7465
|
7465
|
unset($TDurationTypes[$value]); |
7466
|
7466
|
} |
7467
|
7467
|
|
7468
|
|
- $retstring = '<select class="flat minwidth75 maxwidth100" id="select_' . $prefix . 'type_duration" name="' . $prefix . 'type_duration">'; |
|
7468
|
+ $retstring = '<select class="flat minwidth75 maxwidth100" id="select_'.$prefix.'type_duration" name="'.$prefix.'type_duration">'; |
7469
|
7469
|
foreach ($TDurationTypes as $key => $typeduration) { |
7470
|
|
- $retstring .= '<option value="' . $key . '"'; |
|
7470
|
+ $retstring .= '<option value="'.$key.'"'; |
7471
|
7471
|
if ($key == $selected) { |
7472
|
7472
|
$retstring .= " selected"; |
7473
|
7473
|
} |
7474
|
|
- $retstring .= ">" . $typeduration . "</option>"; |
|
7474
|
+ $retstring .= ">".$typeduration."</option>"; |
7475
|
7475
|
} |
7476
|
7476
|
$retstring .= "</select>"; |
7477
|
7477
|
|
7478
|
|
- $retstring .= ajax_combobox('select_' . $prefix . 'type_duration'); |
|
7478
|
+ $retstring .= ajax_combobox('select_'.$prefix.'type_duration'); |
7479
|
7479
|
|
7480
|
7480
|
return $retstring; |
7481
|
7481
|
} |
|
@@ -7507,30 +7507,30 @@ discard block |
|
|
block discarded – undo |
7507
|
7507
|
|
7508
|
7508
|
// Hours |
7509
|
7509
|
if ($iSecond != '') { |
7510
|
|
- require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php'; |
|
7510
|
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; |
7511
|
7511
|
|
7512
|
7512
|
$hourSelected = convertSecondToTime($iSecond, 'allhour'); |
7513
|
7513
|
$minSelected = convertSecondToTime($iSecond, 'min'); |
7514
|
7514
|
} |
7515
|
7515
|
|
7516
|
7516
|
if ($typehour == 'select') { |
7517
|
|
- $retstring .= '<select class="flat" id="select_' . $prefix . 'hour" name="' . $prefix . 'hour"' . ($disabled ? ' disabled' : '') . '>'; |
|
7517
|
+ $retstring .= '<select class="flat" id="select_'.$prefix.'hour" name="'.$prefix.'hour"'.($disabled ? ' disabled' : '').'>'; |
7518
|
7518
|
for ($hour = 0; $hour < 25; $hour++) { // For a duration, we allow 24 hours |
7519
|
|
- $retstring .= '<option value="' . $hour . '"'; |
|
7519
|
+ $retstring .= '<option value="'.$hour.'"'; |
7520
|
7520
|
if (is_numeric($hourSelected) && $hourSelected == $hour) { |
7521
|
7521
|
$retstring .= " selected"; |
7522
|
7522
|
} |
7523
|
|
- $retstring .= ">" . $hour . "</option>"; |
|
7523
|
+ $retstring .= ">".$hour."</option>"; |
7524
|
7524
|
} |
7525
|
7525
|
$retstring .= "</select>"; |
7526
|
7526
|
} elseif ($typehour == 'text' || $typehour == 'textselect') { |
7527
|
|
- $retstring .= '<input placeholder="' . $langs->trans('HourShort') . '" type="number" min="0" name="' . $prefix . 'hour"' . ($disabled ? ' disabled' : '') . ' class="flat maxwidth50 inputhour right" value="' . (($hourSelected != '') ? ((int) $hourSelected) : '') . '">'; |
|
7527
|
+ $retstring .= '<input placeholder="'.$langs->trans('HourShort').'" type="number" min="0" name="'.$prefix.'hour"'.($disabled ? ' disabled' : '').' class="flat maxwidth50 inputhour right" value="'.(($hourSelected != '') ? ((int) $hourSelected) : '').'">'; |
7528
|
7528
|
} else { |
7529
|
7529
|
return 'BadValueForParameterTypeHour'; |
7530
|
7530
|
} |
7531
|
7531
|
|
7532
|
7532
|
if ($typehour != 'text') { |
7533
|
|
- $retstring .= ' ' . $langs->trans('HourShort'); |
|
7533
|
+ $retstring .= ' '.$langs->trans('HourShort'); |
7534
|
7534
|
} else { |
7535
|
7535
|
$retstring .= '<span class="">:</span>'; |
7536
|
7536
|
} |
|
@@ -7545,21 +7545,21 @@ discard block |
|
|
block discarded – undo |
7545
|
7545
|
} |
7546
|
7546
|
|
7547
|
7547
|
if ($typehour == 'select' || $typehour == 'textselect') { |
7548
|
|
- $retstring .= '<select class="flat" id="select_' . $prefix . 'min" name="' . $prefix . 'min"' . ($disabled ? ' disabled' : '') . '>'; |
|
7548
|
+ $retstring .= '<select class="flat" id="select_'.$prefix.'min" name="'.$prefix.'min"'.($disabled ? ' disabled' : '').'>'; |
7549
|
7549
|
for ($min = 0; $min <= 55; $min += 5) { |
7550
|
|
- $retstring .= '<option value="' . $min . '"'; |
|
7550
|
+ $retstring .= '<option value="'.$min.'"'; |
7551
|
7551
|
if (is_numeric($minSelected) && $minSelected == $min) { |
7552
|
7552
|
$retstring .= ' selected'; |
7553
|
7553
|
} |
7554
|
|
- $retstring .= '>' . $min . '</option>'; |
|
7554
|
+ $retstring .= '>'.$min.'</option>'; |
7555
|
7555
|
} |
7556
|
7556
|
$retstring .= "</select>"; |
7557
|
7557
|
} elseif ($typehour == 'text') { |
7558
|
|
- $retstring .= '<input placeholder="' . $langs->trans('MinuteShort') . '" type="number" min="0" name="' . $prefix . 'min"' . ($disabled ? ' disabled' : '') . ' class="flat maxwidth50 inputminute right" value="' . (($minSelected != '') ? ((int) $minSelected) : '') . '">'; |
|
7558
|
+ $retstring .= '<input placeholder="'.$langs->trans('MinuteShort').'" type="number" min="0" name="'.$prefix.'min"'.($disabled ? ' disabled' : '').' class="flat maxwidth50 inputminute right" value="'.(($minSelected != '') ? ((int) $minSelected) : '').'">'; |
7559
|
7559
|
} |
7560
|
7560
|
|
7561
|
7561
|
if ($typehour != 'text') { |
7562
|
|
- $retstring .= ' ' . $langs->trans('MinuteShort'); |
|
7562
|
+ $retstring .= ' '.$langs->trans('MinuteShort'); |
7563
|
7563
|
} |
7564
|
7564
|
|
7565
|
7565
|
$retstring .= "</span>"; |
|
@@ -7607,7 +7607,7 @@ discard block |
|
|
block discarded – undo |
7607
|
7607
|
$placeholder = ''; |
7608
|
7608
|
|
7609
|
7609
|
if ($selected && empty($selected_input_value)) { |
7610
|
|
- require_once DOL_DOCUMENT_ROOT . '/ticket/class/ticket.class.php'; |
|
7610
|
+ require_once DOL_DOCUMENT_ROOT.'/ticket/class/ticket.class.php'; |
7611
|
7611
|
$tickettmpselect = new Ticket($this->db); |
7612
|
7612
|
$tickettmpselect->fetch($selected); |
7613
|
7613
|
$selected_input_value = $tickettmpselect->ref; |
|
@@ -7615,17 +7615,17 @@ discard block |
|
|
block discarded – undo |
7615
|
7615
|
} |
7616
|
7616
|
|
7617
|
7617
|
$urloption = ''; |
7618
|
|
- $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/ticket/ajax/tickets.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions); |
|
7618
|
+ $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/ticket/ajax/tickets.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions); |
7619
|
7619
|
|
7620
|
7620
|
if (empty($hidelabel)) { |
7621
|
|
- $out .= $langs->trans("RefOrLabel") . ' : '; |
|
7621
|
+ $out .= $langs->trans("RefOrLabel").' : '; |
7622
|
7622
|
} elseif ($hidelabel > 1) { |
7623
|
|
- $placeholder = ' placeholder="' . $langs->trans("RefOrLabel") . '"'; |
|
7623
|
+ $placeholder = ' placeholder="'.$langs->trans("RefOrLabel").'"'; |
7624
|
7624
|
if ($hidelabel == 2) { |
7625
|
7625
|
$out .= img_picto($langs->trans("Search"), 'search'); |
7626
|
7626
|
} |
7627
|
7627
|
} |
7628
|
|
- $out .= '<input type="text" class="minwidth100" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . $placeholder . ' ' . (getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '') . ' />'; |
|
7628
|
+ $out .= '<input type="text" class="minwidth100" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' '.(getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '').' />'; |
7629
|
7629
|
if ($hidelabel == 3) { |
7630
|
7630
|
$out .= img_picto($langs->trans("Search"), 'search'); |
7631
|
7631
|
} |
|
@@ -7669,8 +7669,8 @@ discard block |
|
|
block discarded – undo |
7669
|
7669
|
|
7670
|
7670
|
$sql = "SELECT "; |
7671
|
7671
|
$sql .= $selectFields; |
7672
|
|
- $sql .= " FROM " . $this->db->prefix() . "ticket as p"; |
7673
|
|
- $sql .= ' WHERE p.entity IN (' . getEntity('ticket') . ')'; |
|
7672
|
+ $sql .= " FROM ".$this->db->prefix()."ticket as p"; |
|
7673
|
+ $sql .= ' WHERE p.entity IN ('.getEntity('ticket').')'; |
7674
|
7674
|
|
7675
|
7675
|
// Add criteria on ref/label |
7676
|
7676
|
if ($filterkey != '') { |
|
@@ -7686,7 +7686,7 @@ discard block |
|
|
block discarded – undo |
7686
|
7686
|
if ($i > 0) { |
7687
|
7687
|
$sql .= " AND "; |
7688
|
7688
|
} |
7689
|
|
- $sql .= "(p.ref LIKE '" . $this->db->escape($prefix . $crit) . "%' OR p.subject LIKE '" . $this->db->escape($prefix . $crit) . "%'"; |
|
7689
|
+ $sql .= "(p.ref LIKE '".$this->db->escape($prefix.$crit)."%' OR p.subject LIKE '".$this->db->escape($prefix.$crit)."%'"; |
7690
|
7690
|
$sql .= ")"; |
7691
|
7691
|
$i++; |
7692
|
7692
|
} |
|
@@ -7699,22 +7699,22 @@ discard block |
|
|
block discarded – undo |
7699
|
7699
|
$sql .= $this->db->plimit($limit, 0); |
7700
|
7700
|
|
7701
|
7701
|
// Build output string |
7702
|
|
- dol_syslog(get_class($this) . "::selectTicketsList search tickets", LOG_DEBUG); |
|
7702
|
+ dol_syslog(get_class($this)."::selectTicketsList search tickets", LOG_DEBUG); |
7703
|
7703
|
$result = $this->db->query($sql); |
7704
|
7704
|
if ($result) { |
7705
|
|
- require_once DOL_DOCUMENT_ROOT . '/ticket/class/ticket.class.php'; |
7706
|
|
- require_once DOL_DOCUMENT_ROOT . '/core/lib/ticket.lib.php'; |
|
7705
|
+ require_once DOL_DOCUMENT_ROOT.'/ticket/class/ticket.class.php'; |
|
7706
|
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/ticket.lib.php'; |
7707
|
7707
|
|
7708
|
7708
|
$num = $this->db->num_rows($result); |
7709
|
7709
|
|
7710
|
7710
|
$events = array(); |
7711
|
7711
|
|
7712
|
7712
|
if (!$forcecombo) { |
7713
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
7713
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
7714
|
7714
|
$out .= ajax_combobox($htmlname, $events, getDolGlobalInt('TICKET_USE_SEARCH_TO_SELECT')); |
7715
|
7715
|
} |
7716
|
7716
|
|
7717
|
|
- $out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">'; |
|
7717
|
+ $out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">'; |
7718
|
7718
|
|
7719
|
7719
|
$textifempty = ''; |
7720
|
7720
|
// Do not use textifempty = ' ' or ' ' here, or search on key will search on ' key'. |
|
@@ -7731,7 +7731,7 @@ discard block |
|
|
block discarded – undo |
7731
|
7731
|
} |
7732
|
7732
|
} |
7733
|
7733
|
if ($showempty) { |
7734
|
|
- $out .= '<option value="0" selected>' . $textifempty . '</option>'; |
|
7734
|
+ $out .= '<option value="0" selected>'.$textifempty.'</option>'; |
7735
|
7735
|
} |
7736
|
7736
|
|
7737
|
7737
|
$i = 0; |
|
@@ -7785,13 +7785,13 @@ discard block |
|
|
block discarded – undo |
7785
|
7785
|
$outkey = $objp->rowid; |
7786
|
7786
|
$outref = $objp->ref; |
7787
|
7787
|
|
7788
|
|
- $opt = '<option value="' . $objp->rowid . '"'; |
|
7788
|
+ $opt = '<option value="'.$objp->rowid.'"'; |
7789
|
7789
|
$opt .= ($objp->rowid == $selected) ? ' selected' : ''; |
7790
|
7790
|
$opt .= '>'; |
7791
|
7791
|
$opt .= $objp->ref; |
7792
|
7792
|
$objRef = $objp->ref; |
7793
|
7793
|
if (!empty($filterkey) && $filterkey != '') { |
7794
|
|
- $objRef = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $objRef, 1); |
|
7794
|
+ $objRef = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $objRef, 1); |
7795
|
7795
|
} |
7796
|
7796
|
|
7797
|
7797
|
$opt .= "</option>\n"; |
|
@@ -7832,7 +7832,7 @@ discard block |
|
|
block discarded – undo |
7832
|
7832
|
$placeholder = ''; |
7833
|
7833
|
|
7834
|
7834
|
if ($selected && empty($selected_input_value)) { |
7835
|
|
- require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; |
|
7835
|
+ require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; |
7836
|
7836
|
$projecttmpselect = new Project($this->db); |
7837
|
7837
|
$projecttmpselect->fetch($selected); |
7838
|
7838
|
$selected_input_value = $projecttmpselect->ref; |
|
@@ -7840,17 +7840,17 @@ discard block |
|
|
block discarded – undo |
7840
|
7840
|
} |
7841
|
7841
|
|
7842
|
7842
|
$urloption = ''; |
7843
|
|
- $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/projet/ajax/projects.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions); |
|
7843
|
+ $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/projet/ajax/projects.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions); |
7844
|
7844
|
|
7845
|
7845
|
if (empty($hidelabel)) { |
7846
|
|
- $out .= $langs->trans("RefOrLabel") . ' : '; |
|
7846
|
+ $out .= $langs->trans("RefOrLabel").' : '; |
7847
|
7847
|
} elseif ($hidelabel > 1) { |
7848
|
|
- $placeholder = ' placeholder="' . $langs->trans("RefOrLabel") . '"'; |
|
7848
|
+ $placeholder = ' placeholder="'.$langs->trans("RefOrLabel").'"'; |
7849
|
7849
|
if ($hidelabel == 2) { |
7850
|
7850
|
$out .= img_picto($langs->trans("Search"), 'search'); |
7851
|
7851
|
} |
7852
|
7852
|
} |
7853
|
|
- $out .= '<input type="text" class="minwidth100" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . $placeholder . ' ' . (getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '') . ' />'; |
|
7853
|
+ $out .= '<input type="text" class="minwidth100" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' '.(getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '').' />'; |
7854
|
7854
|
if ($hidelabel == 3) { |
7855
|
7855
|
$out .= img_picto($langs->trans("Search"), 'search'); |
7856
|
7856
|
} |
|
@@ -7893,8 +7893,8 @@ discard block |
|
|
block discarded – undo |
7893
|
7893
|
|
7894
|
7894
|
$sql = "SELECT "; |
7895
|
7895
|
$sql .= $selectFields; |
7896
|
|
- $sql .= " FROM " . $this->db->prefix() . "projet as p"; |
7897
|
|
- $sql .= ' WHERE p.entity IN (' . getEntity('project') . ')'; |
|
7896
|
+ $sql .= " FROM ".$this->db->prefix()."projet as p"; |
|
7897
|
+ $sql .= ' WHERE p.entity IN ('.getEntity('project').')'; |
7898
|
7898
|
|
7899
|
7899
|
// Add criteria on ref/label |
7900
|
7900
|
if ($filterkey != '') { |
|
@@ -7910,7 +7910,7 @@ discard block |
|
|
block discarded – undo |
7910
|
7910
|
if ($i > 0) { |
7911
|
7911
|
$sql .= " AND "; |
7912
|
7912
|
} |
7913
|
|
- $sql .= "p.ref LIKE '" . $this->db->escape($prefix . $crit) . "%'"; |
|
7913
|
+ $sql .= "p.ref LIKE '".$this->db->escape($prefix.$crit)."%'"; |
7914
|
7914
|
$sql .= ""; |
7915
|
7915
|
$i++; |
7916
|
7916
|
} |
|
@@ -7923,22 +7923,22 @@ discard block |
|
|
block discarded – undo |
7923
|
7923
|
$sql .= $this->db->plimit($limit, 0); |
7924
|
7924
|
|
7925
|
7925
|
// Build output string |
7926
|
|
- dol_syslog(get_class($this) . "::selectProjectsList search projects", LOG_DEBUG); |
|
7926
|
+ dol_syslog(get_class($this)."::selectProjectsList search projects", LOG_DEBUG); |
7927
|
7927
|
$result = $this->db->query($sql); |
7928
|
7928
|
if ($result) { |
7929
|
|
- require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; |
7930
|
|
- require_once DOL_DOCUMENT_ROOT . '/core/lib/project.lib.php'; |
|
7929
|
+ require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; |
|
7930
|
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php'; |
7931
|
7931
|
|
7932
|
7932
|
$num = $this->db->num_rows($result); |
7933
|
7933
|
|
7934
|
7934
|
$events = array(); |
7935
|
7935
|
|
7936
|
7936
|
if (!$forcecombo) { |
7937
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
7937
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
7938
|
7938
|
$out .= ajax_combobox($htmlname, $events, getDolGlobalInt('PROJECT_USE_SEARCH_TO_SELECT')); |
7939
|
7939
|
} |
7940
|
7940
|
|
7941
|
|
- $out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">'; |
|
7941
|
+ $out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">'; |
7942
|
7942
|
|
7943
|
7943
|
$textifempty = ''; |
7944
|
7944
|
// Do not use textifempty = ' ' or ' ' here, or search on key will search on ' key'. |
|
@@ -7955,7 +7955,7 @@ discard block |
|
|
block discarded – undo |
7955
|
7955
|
} |
7956
|
7956
|
} |
7957
|
7957
|
if ($showempty) { |
7958
|
|
- $out .= '<option value="0" selected>' . $textifempty . '</option>'; |
|
7958
|
+ $out .= '<option value="0" selected>'.$textifempty.'</option>'; |
7959
|
7959
|
} |
7960
|
7960
|
|
7961
|
7961
|
$i = 0; |
|
@@ -8013,13 +8013,13 @@ discard block |
|
|
block discarded – undo |
8013
|
8013
|
$outlabel = $objp->label; |
8014
|
8014
|
$outtype = $objp->fk_product_type; |
8015
|
8015
|
|
8016
|
|
- $opt = '<option value="' . $objp->rowid . '"'; |
|
8016
|
+ $opt = '<option value="'.$objp->rowid.'"'; |
8017
|
8017
|
$opt .= ($objp->rowid == $selected) ? ' selected' : ''; |
8018
|
8018
|
$opt .= '>'; |
8019
|
8019
|
$opt .= $objp->ref; |
8020
|
8020
|
$objRef = $objp->ref; |
8021
|
8021
|
if (!empty($filterkey) && $filterkey != '') { |
8022
|
|
- $objRef = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $objRef, 1); |
|
8022
|
+ $objRef = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $objRef, 1); |
8023
|
8023
|
} |
8024
|
8024
|
|
8025
|
8025
|
$opt .= "</option>\n"; |
|
@@ -8061,7 +8061,7 @@ discard block |
|
|
block discarded – undo |
8061
|
8061
|
$placeholder = ''; |
8062
|
8062
|
|
8063
|
8063
|
if ($selected && empty($selected_input_value)) { |
8064
|
|
- require_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php'; |
|
8064
|
+ require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; |
8065
|
8065
|
$adherenttmpselect = new Adherent($this->db); |
8066
|
8066
|
$adherenttmpselect->fetch($selected); |
8067
|
8067
|
$selected_input_value = $adherenttmpselect->ref; |
|
@@ -8070,17 +8070,17 @@ discard block |
|
|
block discarded – undo |
8070
|
8070
|
|
8071
|
8071
|
$urloption = ''; |
8072
|
8072
|
|
8073
|
|
- $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/adherents/ajax/adherents.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions); |
|
8073
|
+ $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/adherents/ajax/adherents.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions); |
8074
|
8074
|
|
8075
|
8075
|
if (empty($hidelabel)) { |
8076
|
|
- $out .= $langs->trans("RefOrLabel") . ' : '; |
|
8076
|
+ $out .= $langs->trans("RefOrLabel").' : '; |
8077
|
8077
|
} elseif ($hidelabel > 1) { |
8078
|
|
- $placeholder = ' placeholder="' . $langs->trans("RefOrLabel") . '"'; |
|
8078
|
+ $placeholder = ' placeholder="'.$langs->trans("RefOrLabel").'"'; |
8079
|
8079
|
if ($hidelabel == 2) { |
8080
|
8080
|
$out .= img_picto($langs->trans("Search"), 'search'); |
8081
|
8081
|
} |
8082
|
8082
|
} |
8083
|
|
- $out .= '<input type="text" class="minwidth100" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . $placeholder . ' ' . (getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '') . ' />'; |
|
8083
|
+ $out .= '<input type="text" class="minwidth100" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' '.(getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '').' />'; |
8084
|
8084
|
if ($hidelabel == 3) { |
8085
|
8085
|
$out .= img_picto($langs->trans("Search"), 'search'); |
8086
|
8086
|
} |
|
@@ -8125,8 +8125,8 @@ discard block |
|
|
block discarded – undo |
8125
|
8125
|
|
8126
|
8126
|
$sql = "SELECT "; |
8127
|
8127
|
$sql .= $selectFields; |
8128
|
|
- $sql .= " FROM " . $this->db->prefix() . "adherent as p"; |
8129
|
|
- $sql .= ' WHERE p.entity IN (' . getEntity('adherent') . ')'; |
|
8128
|
+ $sql .= " FROM ".$this->db->prefix()."adherent as p"; |
|
8129
|
+ $sql .= ' WHERE p.entity IN ('.getEntity('adherent').')'; |
8130
|
8130
|
|
8131
|
8131
|
// Add criteria on ref/label |
8132
|
8132
|
if ($filterkey != '') { |
|
@@ -8142,8 +8142,8 @@ discard block |
|
|
block discarded – undo |
8142
|
8142
|
if ($i > 0) { |
8143
|
8143
|
$sql .= " AND "; |
8144
|
8144
|
} |
8145
|
|
- $sql .= "(p.firstname LIKE '" . $this->db->escape($prefix . $crit) . "%'"; |
8146
|
|
- $sql .= " OR p.lastname LIKE '" . $this->db->escape($prefix . $crit) . "%')"; |
|
8145
|
+ $sql .= "(p.firstname LIKE '".$this->db->escape($prefix.$crit)."%'"; |
|
8146
|
+ $sql .= " OR p.lastname LIKE '".$this->db->escape($prefix.$crit)."%')"; |
8147
|
8147
|
$i++; |
8148
|
8148
|
} |
8149
|
8149
|
if (count($search_crit) > 1) { |
|
@@ -8152,27 +8152,27 @@ discard block |
|
|
block discarded – undo |
8152
|
8152
|
$sql .= ')'; |
8153
|
8153
|
} |
8154
|
8154
|
if ($status != -1) { |
8155
|
|
- $sql .= ' AND statut = ' . ((int) $status); |
|
8155
|
+ $sql .= ' AND statut = '.((int) $status); |
8156
|
8156
|
} |
8157
|
8157
|
$sql .= $this->db->plimit($limit, 0); |
8158
|
8158
|
|
8159
|
8159
|
// Build output string |
8160
|
|
- dol_syslog(get_class($this) . "::selectMembersList search adherents", LOG_DEBUG); |
|
8160
|
+ dol_syslog(get_class($this)."::selectMembersList search adherents", LOG_DEBUG); |
8161
|
8161
|
$result = $this->db->query($sql); |
8162
|
8162
|
if ($result) { |
8163
|
|
- require_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php'; |
8164
|
|
- require_once DOL_DOCUMENT_ROOT . '/core/lib/member.lib.php'; |
|
8163
|
+ require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; |
|
8164
|
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php'; |
8165
|
8165
|
|
8166
|
8166
|
$num = $this->db->num_rows($result); |
8167
|
8167
|
|
8168
|
8168
|
$events = array(); |
8169
|
8169
|
|
8170
|
8170
|
if (!$forcecombo) { |
8171
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
8171
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
8172
|
8172
|
$out .= ajax_combobox($htmlname, $events, getDolGlobalString('PROJECT_USE_SEARCH_TO_SELECT') ? $conf->global->PROJECT_USE_SEARCH_TO_SELECT : ''); |
8173
|
8173
|
} |
8174
|
8174
|
|
8175
|
|
- $out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">'; |
|
8175
|
+ $out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">'; |
8176
|
8176
|
|
8177
|
8177
|
$textifempty = ''; |
8178
|
8178
|
// Do not use textifempty = ' ' or ' ' here, or search on key will search on ' key'. |
|
@@ -8189,7 +8189,7 @@ discard block |
|
|
block discarded – undo |
8189
|
8189
|
} |
8190
|
8190
|
} |
8191
|
8191
|
if ($showempty) { |
8192
|
|
- $out .= '<option value="-1" selected>' . $textifempty . '</option>'; |
|
8192
|
+ $out .= '<option value="-1" selected>'.$textifempty.'</option>'; |
8193
|
8193
|
} |
8194
|
8194
|
|
8195
|
8195
|
$i = 0; |
|
@@ -8245,11 +8245,11 @@ discard block |
|
|
block discarded – undo |
8245
|
8245
|
$outlabel = dolGetFirstLastname($objp->firstname, $objp->lastname); |
8246
|
8246
|
$outtype = $objp->fk_adherent_type; |
8247
|
8247
|
|
8248
|
|
- $opt = '<option value="' . $objp->rowid . '"'; |
|
8248
|
+ $opt = '<option value="'.$objp->rowid.'"'; |
8249
|
8249
|
$opt .= ($objp->rowid == $selected) ? ' selected' : ''; |
8250
|
8250
|
$opt .= '>'; |
8251
|
8251
|
if (!empty($filterkey) && $filterkey != '') { |
8252
|
|
- $outlabel = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $outlabel, 1); |
|
8252
|
+ $outlabel = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $outlabel, 1); |
8253
|
8253
|
} |
8254
|
8254
|
$opt .= $outlabel; |
8255
|
8255
|
$opt .= "</option>\n"; |
|
@@ -8304,8 +8304,8 @@ discard block |
|
|
block discarded – undo |
8304
|
8304
|
$objecttmp = null; |
8305
|
8305
|
$InfoFieldList = array(); |
8306
|
8306
|
$classname = ''; |
8307
|
|
- $filter = ''; // Ensure filter has value (for static analysis) |
8308
|
|
- $sortfield = ''; // Ensure filter has value (for static analysis) |
|
8307
|
+ $filter = ''; // Ensure filter has value (for static analysis) |
|
8308
|
+ $sortfield = ''; // Ensure filter has value (for static analysis) |
8309
|
8309
|
|
8310
|
8310
|
if ($objectfield) { // We must retrieve the objectdesc from the field or extrafield |
8311
|
8311
|
// Example: $objectfield = 'product:options_package' or 'myobject@mymodule:options_myfield' |
|
@@ -8349,9 +8349,9 @@ discard block |
|
|
block discarded – undo |
8349
|
8349
|
$vartmp = (empty($InfoFieldList[3]) ? '' : $InfoFieldList[3]); |
8350
|
8350
|
$reg = array(); |
8351
|
8351
|
if (preg_match('/^.*:(\w*)$/', $vartmp, $reg)) { |
8352
|
|
- $InfoFieldList[4] = $reg[1]; // take the sort field |
|
8352
|
+ $InfoFieldList[4] = $reg[1]; // take the sort field |
8353
|
8353
|
} |
8354
|
|
- $InfoFieldList[3] = preg_replace('/:\w*$/', '', $vartmp); // take the filter field |
|
8354
|
+ $InfoFieldList[3] = preg_replace('/:\w*$/', '', $vartmp); // take the filter field |
8355
|
8355
|
|
8356
|
8356
|
$classname = $InfoFieldList[0]; |
8357
|
8357
|
$classpath = empty($InfoFieldList[1]) ? '' : $InfoFieldList[1]; |
|
@@ -8382,8 +8382,8 @@ discard block |
|
|
block discarded – undo |
8382
|
8382
|
); |
8383
|
8383
|
|
8384
|
8384
|
if (!is_object($objecttmp)) { |
8385
|
|
- dol_syslog('selectForForms: Error bad setup of field objectdescorig=' . $objectdescorig.', objectfield='.$objectfield.', objectdesc='.$objectdesc, LOG_WARNING); |
8386
|
|
- return 'selectForForms: Error bad setup of field objectdescorig=' . $objectdescorig.', objectfield='.$objectfield.', objectdesc='.$objectdesc; |
|
8385
|
+ dol_syslog('selectForForms: Error bad setup of field objectdescorig='.$objectdescorig.', objectfield='.$objectfield.', objectdesc='.$objectdesc, LOG_WARNING); |
|
8386
|
+ return 'selectForForms: Error bad setup of field objectdescorig='.$objectdescorig.', objectfield='.$objectfield.', objectdesc='.$objectdesc; |
8387
|
8387
|
} |
8388
|
8388
|
'@phan-var-force CommonObject $objecttmp'; |
8389
|
8389
|
|
|
@@ -8395,9 +8395,9 @@ discard block |
|
|
block discarded – undo |
8395
|
8395
|
if ($prefixforautocompletemode == 'product') { |
8396
|
8396
|
$prefixforautocompletemode = 'produit'; |
8397
|
8397
|
} |
8398
|
|
- $confkeyforautocompletemode = strtoupper($prefixforautocompletemode) . '_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT |
|
8398
|
+ $confkeyforautocompletemode = strtoupper($prefixforautocompletemode).'_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT |
8399
|
8399
|
|
8400
|
|
- dol_syslog(get_class($this) . "::selectForForms filter=" . $filter, LOG_DEBUG); |
|
8400
|
+ dol_syslog(get_class($this)."::selectForForms filter=".$filter, LOG_DEBUG); |
8401
|
8401
|
|
8402
|
8402
|
// Generate the combo HTML component |
8403
|
8403
|
$out = ''; |
|
@@ -8426,13 +8426,13 @@ discard block |
|
|
block discarded – undo |
8426
|
8426
|
} |
8427
|
8427
|
|
8428
|
8428
|
// Set url and param to call to get json of the search results |
8429
|
|
- $urlforajaxcall = DOL_URL_ROOT . '/core/ajax/selectobject.php'; |
8430
|
|
- $urloption = 'htmlname=' . urlencode($htmlname) . '&outjson=1&objectdesc=' . urlencode($objectdescorig) . '&objectfield='.urlencode($objectfield) . ($sortfield ? '&sortfield=' . urlencode($sortfield) : ''); |
|
8429
|
+ $urlforajaxcall = DOL_URL_ROOT.'/core/ajax/selectobject.php'; |
|
8430
|
+ $urloption = 'htmlname='.urlencode($htmlname).'&outjson=1&objectdesc='.urlencode($objectdescorig).'&objectfield='.urlencode($objectfield).($sortfield ? '&sortfield='.urlencode($sortfield) : ''); |
8431
|
8431
|
|
8432
|
8432
|
// Activate the auto complete using ajax call. |
8433
|
8433
|
$out .= ajax_autocompleter((string) $preSelectedValue, $htmlname, $urlforajaxcall, $urloption, getDolGlobalInt($confkeyforautocompletemode), 0); |
8434
|
8434
|
$out .= '<!-- force css to be higher than dialog popup --><style type="text/css">.ui-autocomplete { z-index: 1010; }</style>'; |
8435
|
|
- $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) . '"' : '') . ' />'; |
|
8435
|
+ $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).'"' : '').' />'; |
8436
|
8436
|
} else { |
8437
|
8437
|
// Immediate load of table record. |
8438
|
8438
|
$out .= $this->selectForFormsList($objecttmp, $htmlname, $preSelectedValue, $showempty, $searchkey, $placeholder, $morecss, $moreparams, $forcecombo, 0, $disabled, $sortfield, $filter); |
|
@@ -8472,16 +8472,16 @@ discard block |
|
|
block discarded – undo |
8472
|
8472
|
if ($prefixforautocompletemode == 'societe') { |
8473
|
8473
|
$prefixforautocompletemode = 'company'; |
8474
|
8474
|
} |
8475
|
|
- $confkeyforautocompletemode = strtoupper($prefixforautocompletemode) . '_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT |
|
8475
|
+ $confkeyforautocompletemode = strtoupper($prefixforautocompletemode).'_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT |
8476
|
8476
|
|
8477
|
8477
|
if (!empty($objecttmp->fields)) { // For object that declare it, it is better to use declared fields (like societe, contact, ...) |
8478
|
8478
|
$tmpfieldstoshow = ''; |
8479
|
8479
|
foreach ($objecttmp->fields as $key => $val) { |
8480
|
|
- if (! (int) dol_eval($val['enabled'], 1, 1, '1')) { |
|
8480
|
+ if (!(int) dol_eval($val['enabled'], 1, 1, '1')) { |
8481
|
8481
|
continue; |
8482
|
8482
|
} |
8483
|
8483
|
if (!empty($val['showoncombobox'])) { |
8484
|
|
- $tmpfieldstoshow .= ($tmpfieldstoshow ? ',' : '') . 't.' . $key; |
|
8484
|
+ $tmpfieldstoshow .= ($tmpfieldstoshow ? ',' : '').'t.'.$key; |
8485
|
8485
|
} |
8486
|
8486
|
} |
8487
|
8487
|
if ($tmpfieldstoshow) { |
|
@@ -8509,18 +8509,18 @@ discard block |
|
|
block discarded – undo |
8509
|
8509
|
$num = 0; |
8510
|
8510
|
|
8511
|
8511
|
// Search data |
8512
|
|
- $sql = "SELECT t.rowid, " . $fieldstoshow . " FROM " . $this->db->prefix() . $objecttmp->table_element . " as t"; |
|
8512
|
+ $sql = "SELECT t.rowid, ".$fieldstoshow." FROM ".$this->db->prefix().$objecttmp->table_element." as t"; |
8513
|
8513
|
if (!empty($objecttmp->isextrafieldmanaged)) { |
8514
|
|
- $sql .= " LEFT JOIN " . $this->db->prefix() . $objecttmp->table_element . "_extrafields as e ON t.rowid=e.fk_object"; |
|
8514
|
+ $sql .= " LEFT JOIN ".$this->db->prefix().$objecttmp->table_element."_extrafields as e ON t.rowid=e.fk_object"; |
8515
|
8515
|
} |
8516
|
8516
|
if (isset($objecttmp->ismultientitymanaged)) { |
8517
|
8517
|
if (!is_numeric($objecttmp->ismultientitymanaged)) { |
8518
|
8518
|
$tmparray = explode('@', $objecttmp->ismultientitymanaged); |
8519
|
|
- $sql .= " INNER JOIN " . $this->db->prefix() . $tmparray[1] . " as parenttable ON parenttable.rowid = t." . $tmparray[0]; |
|
8519
|
+ $sql .= " INNER JOIN ".$this->db->prefix().$tmparray[1]." as parenttable ON parenttable.rowid = t.".$tmparray[0]; |
8520
|
8520
|
} |
8521
|
8521
|
if ($objecttmp->ismultientitymanaged === 'fk_soc@societe') { |
8522
|
8522
|
if (!$user->hasRight('societe', 'client', 'voir')) { |
8523
|
|
- $sql .= ", " . $this->db->prefix() . "societe_commerciaux as sc"; |
|
8523
|
+ $sql .= ", ".$this->db->prefix()."societe_commerciaux as sc"; |
8524
|
8524
|
} |
8525
|
8525
|
} |
8526
|
8526
|
} |
|
@@ -8540,21 +8540,21 @@ discard block |
|
|
block discarded – undo |
8540
|
8540
|
$sql .= " WHERE 1=1"; |
8541
|
8541
|
if (isset($objecttmp->ismultientitymanaged)) { |
8542
|
8542
|
if ($objecttmp->ismultientitymanaged == 1) { |
8543
|
|
- $sql .= " AND t.entity IN (" . getEntity($objecttmp->table_element) . ")"; |
|
8543
|
+ $sql .= " AND t.entity IN (".getEntity($objecttmp->table_element).")"; |
8544
|
8544
|
} |
8545
|
8545
|
if (!is_numeric($objecttmp->ismultientitymanaged)) { |
8546
|
|
- $sql .= " AND parenttable.entity = t." . $tmparray[0]; |
|
8546
|
+ $sql .= " AND parenttable.entity = t.".$tmparray[0]; |
8547
|
8547
|
} |
8548
|
8548
|
if ($objecttmp->ismultientitymanaged == 1 && !empty($user->socid)) { |
8549
|
8549
|
if ($objecttmp->element == 'societe') { |
8550
|
|
- $sql .= " AND t.rowid = " . ((int) $user->socid); |
|
8550
|
+ $sql .= " AND t.rowid = ".((int) $user->socid); |
8551
|
8551
|
} else { |
8552
|
|
- $sql .= " AND t.fk_soc = " . ((int) $user->socid); |
|
8552
|
+ $sql .= " AND t.fk_soc = ".((int) $user->socid); |
8553
|
8553
|
} |
8554
|
8554
|
} |
8555
|
8555
|
if ($objecttmp->ismultientitymanaged === 'fk_soc@societe') { |
8556
|
8556
|
if (!$user->hasRight('societe', 'client', 'voir')) { |
8557
|
|
- $sql .= " AND t.rowid = sc.fk_soc AND sc.fk_user = " . ((int) $user->id); |
|
8557
|
+ $sql .= " AND t.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id); |
8558
|
8558
|
} |
8559
|
8559
|
} |
8560
|
8560
|
} |
|
@@ -8566,7 +8566,7 @@ discard block |
|
|
block discarded – undo |
8566
|
8566
|
$errormessage = ''; |
8567
|
8567
|
$sql .= forgeSQLFromUniversalSearchCriteria($filter, $errormessage); |
8568
|
8568
|
if ($errormessage) { |
8569
|
|
- return 'Error forging a SQL request from an universal criteria: ' . $errormessage; |
|
8569
|
+ return 'Error forging a SQL request from an universal criteria: '.$errormessage; |
8570
|
8570
|
} |
8571
|
8571
|
} |
8572
|
8572
|
} |
|
@@ -8578,7 +8578,7 @@ discard block |
|
|
block discarded – undo |
8578
|
8578
|
$resql = $this->db->query($sql); |
8579
|
8579
|
if ($resql) { |
8580
|
8580
|
// Construct $out and $outarray |
8581
|
|
- $out .= '<select id="' . $htmlname . '" class="flat minwidth100' . ($morecss ? ' ' . $morecss : '') . '"' . ($disabled ? ' disabled="disabled"' : '') . ($moreparams ? ' ' . $moreparams : '') . ' name="' . $htmlname . '">' . "\n"; |
|
8581
|
+ $out .= '<select id="'.$htmlname.'" class="flat minwidth100'.($morecss ? ' '.$morecss : '').'"'.($disabled ? ' disabled="disabled"' : '').($moreparams ? ' '.$moreparams : '').' name="'.$htmlname.'">'."\n"; |
8582
|
8582
|
|
8583
|
8583
|
// Warning: Do not use textifempty = ' ' or ' ' here, or search on key will search on ' key'. Seems it is no more true with selec2 v4 |
8584
|
8584
|
$textifempty = ' '; |
|
@@ -8592,7 +8592,7 @@ discard block |
|
|
block discarded – undo |
8592
|
8592
|
} |
8593
|
8593
|
} |
8594
|
8594
|
if ($showempty) { |
8595
|
|
- $out .= '<option value="-1">' . $textifempty . '</option>' . "\n"; |
|
8595
|
+ $out .= '<option value="-1">'.$textifempty.'</option>'."\n"; |
8596
|
8596
|
} |
8597
|
8597
|
|
8598
|
8598
|
$num = $this->db->num_rows($resql); |
|
@@ -8615,9 +8615,9 @@ discard block |
|
|
block discarded – undo |
8615
|
8615
|
} |
8616
|
8616
|
if (empty($outputmode)) { |
8617
|
8617
|
if ($preselectedvalue > 0 && $preselectedvalue == $obj->rowid) { |
8618
|
|
- $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>'; |
|
8618
|
+ $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>'; |
8619
|
8619
|
} else { |
8620
|
|
- $out .= '<option value="' . $obj->rowid . '" data-html="' . dol_escape_htmltag($labelhtml, 0, 0, '', 0, 1) . '">' . dol_escape_htmltag($label, 0, 0, '', 0, 1) . '</option>'; |
|
8620
|
+ $out .= '<option value="'.$obj->rowid.'" data-html="'.dol_escape_htmltag($labelhtml, 0, 0, '', 0, 1).'">'.dol_escape_htmltag($label, 0, 0, '', 0, 1).'</option>'; |
8621
|
8621
|
} |
8622
|
8622
|
} else { |
8623
|
8623
|
array_push($outarray, array('key' => $obj->rowid, 'value' => $label, 'label' => $label)); |
|
@@ -8630,10 +8630,10 @@ discard block |
|
|
block discarded – undo |
8630
|
8630
|
} |
8631
|
8631
|
} |
8632
|
8632
|
|
8633
|
|
- $out .= '</select>' . "\n"; |
|
8633
|
+ $out .= '</select>'."\n"; |
8634
|
8634
|
|
8635
|
8635
|
if (!$forcecombo) { |
8636
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
8636
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
8637
|
8637
|
$out .= ajax_combobox($htmlname, array(), getDolGlobalInt($confkeyforautocompletemode, 0)); |
8638
|
8638
|
} |
8639
|
8639
|
} else { |
|
@@ -8697,8 +8697,8 @@ discard block |
|
|
block discarded – undo |
8697
|
8697
|
} |
8698
|
8698
|
} |
8699
|
8699
|
$idname = str_replace(array('[', ']'), array('', ''), $htmlname); |
8700
|
|
- $out .= '<select id="' . preg_replace('/^\./', '', $idname) . '" ' . ($disabled ? 'disabled="disabled" ' : '') . 'class="flat ' . (preg_replace('/^\./', '', $htmlname)) . ($morecss ? ' ' . $morecss : '') . ' selectformat"'; |
8701
|
|
- $out .= ' name="' . preg_replace('/^\./', '', $htmlname) . '" ' . ($moreparam ? $moreparam : ''); |
|
8700
|
+ $out .= '<select id="'.preg_replace('/^\./', '', $idname).'" '.($disabled ? 'disabled="disabled" ' : '').'class="flat '.(preg_replace('/^\./', '', $htmlname)).($morecss ? ' '.$morecss : '').' selectformat"'; |
|
8701
|
+ $out .= ' name="'.preg_replace('/^\./', '', $htmlname).'" '.($moreparam ? $moreparam : ''); |
8702
|
8702
|
$out .= '>'."\n"; |
8703
|
8703
|
|
8704
|
8704
|
if ($show_empty) { |
|
@@ -8709,7 +8709,7 @@ discard block |
|
|
block discarded – undo |
8709
|
8709
|
if (!is_numeric($show_empty)) { |
8710
|
8710
|
$textforempty = $show_empty; |
8711
|
8711
|
} |
8712
|
|
- $out .= '<option class="optiongrey" ' . ($moreparamonempty ? $moreparamonempty . ' ' : '') . 'value="' . (((int) $show_empty) < 0 ? $show_empty : -1) . '"' . ($id == $show_empty ? ' selected' : '') . '>' . $textforempty . '</option>' . "\n"; |
|
8712
|
+ $out .= '<option class="optiongrey" '.($moreparamonempty ? $moreparamonempty.' ' : '').'value="'.(((int) $show_empty) < 0 ? $show_empty : -1).'"'.($id == $show_empty ? ' selected' : '').'>'.$textforempty.'</option>'."\n"; |
8713
|
8713
|
} |
8714
|
8714
|
if (is_array($array)) { |
8715
|
8715
|
// Translate |
|
@@ -8734,7 +8734,7 @@ discard block |
|
|
block discarded – undo |
8734
|
8734
|
$value = $tmpvalue['label']; |
8735
|
8735
|
//$valuehtml = empty($tmpvalue['data-html']) ? $value : $tmpvalue['data-html']; |
8736
|
8736
|
$disabled = empty($tmpvalue['disabled']) ? '' : ' disabled'; |
8737
|
|
- $style = empty($tmpvalue['css']) ? '' : ' class="' . $tmpvalue['css'] . '"'; |
|
8737
|
+ $style = empty($tmpvalue['css']) ? '' : ' class="'.$tmpvalue['css'].'"'; |
8738
|
8738
|
} else { |
8739
|
8739
|
$value = $tmpvalue; |
8740
|
8740
|
//$valuehtml = $tmpvalue; |
|
@@ -8750,9 +8750,9 @@ discard block |
|
|
block discarded – undo |
8750
|
8750
|
} |
8751
|
8751
|
if ($key_in_label) { |
8752
|
8752
|
if (empty($nohtmlescape)) { |
8753
|
|
- $selectOptionValue = dol_escape_htmltag($key . ' - ' . ($maxlen ? dol_trunc($value, $maxlen) : $value)); |
|
8753
|
+ $selectOptionValue = dol_escape_htmltag($key.' - '.($maxlen ? dol_trunc($value, $maxlen) : $value)); |
8754
|
8754
|
} else { |
8755
|
|
- $selectOptionValue = $key . ' - ' . ($maxlen ? dol_trunc($value, $maxlen) : $value); |
|
8755
|
+ $selectOptionValue = $key.' - '.($maxlen ? dol_trunc($value, $maxlen) : $value); |
8756
|
8756
|
} |
8757
|
8757
|
} else { |
8758
|
8758
|
if (empty($nohtmlescape)) { |
|
@@ -8764,8 +8764,8 @@ discard block |
|
|
block discarded – undo |
8764
|
8764
|
$selectOptionValue = ' '; |
8765
|
8765
|
} |
8766
|
8766
|
} |
8767
|
|
- $out .= '<option value="' . $key . '"'; |
8768
|
|
- $out .= $style . $disabled; |
|
8767
|
+ $out .= '<option value="'.$key.'"'; |
|
8768
|
+ $out .= $style.$disabled; |
8769
|
8769
|
if (is_array($id)) { |
8770
|
8770
|
if (in_array($key, $id) && !$disabled) { |
8771
|
8771
|
$out .= ' selected'; // To preselect a value |
|
@@ -8777,7 +8777,7 @@ discard block |
|
|
block discarded – undo |
8777
|
8777
|
} |
8778
|
8778
|
} |
8779
|
8779
|
if (!empty($nohtmlescape)) { // deprecated. Use instead the key 'data-html' into input $array, managed at next step to use HTML content. |
8780
|
|
- $out .= ' data-html="' . dol_escape_htmltag($selectOptionValue) . '"'; |
|
8780
|
+ $out .= ' data-html="'.dol_escape_htmltag($selectOptionValue).'"'; |
8781
|
8781
|
} |
8782
|
8782
|
|
8783
|
8783
|
if (is_array($tmpvalue)) { |
|
@@ -8800,7 +8800,7 @@ discard block |
|
|
block discarded – undo |
8800
|
8800
|
// Add code for jquery to use multiselect |
8801
|
8801
|
if ($addjscombo && $jsbeautify) { |
8802
|
8802
|
// Enhance with select2 |
8803
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
8803
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
8804
|
8804
|
$out .= ajax_combobox($idname, array(), 0, 0, 'resolve', (((int) $show_empty) < 0 ? (string) $show_empty : '-1'), $morecss); |
8805
|
8805
|
} |
8806
|
8806
|
|
|
@@ -8828,28 +8828,28 @@ discard block |
|
|
block discarded – undo |
8828
|
8828
|
public static function selectArrayAjax($htmlname, $url, $id = '', $moreparam = '', $moreparamtourl = '', $disabled = 0, $minimumInputLength = 1, $morecss = '', $callurlonselect = 0, $placeholder = '', $acceptdelayedhtml = 0) |
8829
|
8829
|
{ |
8830
|
8830
|
global $conf, $langs; |
8831
|
|
- global $delayedhtmlcontent; // Will be used later outside of this function |
|
8831
|
+ global $delayedhtmlcontent; // Will be used later outside of this function |
8832
|
8832
|
|
8833
|
8833
|
// TODO Use an internal dolibarr component instead of select2 |
8834
|
8834
|
if (!getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') && !defined('REQUIRE_JQUERY_MULTISELECT')) { |
8835
|
8835
|
return ''; |
8836
|
8836
|
} |
8837
|
8837
|
|
8838
|
|
- $out = '<select type="text" class="' . $htmlname . ($morecss ? ' ' . $morecss : '') . '" ' . ($moreparam ? $moreparam . ' ' : '') . 'name="' . $htmlname . '"></select>'; |
|
8838
|
+ $out = '<select type="text" class="'.$htmlname.($morecss ? ' '.$morecss : '').'" '.($moreparam ? $moreparam.' ' : '').'name="'.$htmlname.'"></select>'; |
8839
|
8839
|
|
8840
|
8840
|
$outdelayed = ''; |
8841
|
8841
|
if (!empty($conf->use_javascript_ajax)) { |
8842
|
8842
|
$tmpplugin = 'select2'; |
8843
|
|
- $outdelayed = "\n" . '<!-- JS CODE TO ENABLE ' . $tmpplugin . ' for id ' . $htmlname . ' --> |
8844
|
|
- <script nonce="' . getNonce() . '"> |
|
8843
|
+ $outdelayed = "\n".'<!-- JS CODE TO ENABLE '.$tmpplugin.' for id '.$htmlname.' --> |
|
8844
|
+ <script nonce="' . getNonce().'"> |
8845
|
8845
|
$(document).ready(function () { |
8846
|
8846
|
|
8847
|
|
- ' . ($callurlonselect ? 'var saveRemoteData = [];' : '') . ' |
|
8847
|
+ ' . ($callurlonselect ? 'var saveRemoteData = [];' : '').' |
8848
|
8848
|
|
8849
|
|
- $(".' . $htmlname . '").select2({ |
|
8849
|
+ $(".' . $htmlname.'").select2({ |
8850
|
8850
|
ajax: { |
8851
|
8851
|
dir: "ltr", |
8852
|
|
- url: "' . $url . '", |
|
8852
|
+ url: "' . $url.'", |
8853
|
8853
|
dataType: \'json\', |
8854
|
8854
|
delay: 250, |
8855
|
8855
|
data: function (params) { |
|
@@ -8876,9 +8876,9 @@ discard block |
|
|
block discarded – undo |
8876
|
8876
|
}, |
8877
|
8877
|
language: select2arrayoflanguage, |
8878
|
8878
|
containerCssClass: \':all:\', /* Line to add class of origin SELECT propagated to the new <span class="select2-selection...> tag */ |
8879
|
|
- placeholder: "' . dol_escape_js($placeholder) . '", |
|
8879
|
+ placeholder: "' . dol_escape_js($placeholder).'", |
8880
|
8880
|
escapeMarkup: function (markup) { return markup; }, // let our custom formatter work |
8881
|
|
- minimumInputLength: ' . ((int) $minimumInputLength) . ', |
|
8881
|
+ minimumInputLength: ' . ((int) $minimumInputLength).', |
8882
|
8882
|
formatResult: function (result, container, query, escapeMarkup) { |
8883
|
8883
|
return escapeMarkup(result.text); |
8884
|
8884
|
}, |
|
@@ -8886,10 +8886,10 @@ discard block |
|
|
block discarded – undo |
8886
|
8886
|
|
8887
|
8887
|
' . ($callurlonselect ? ' |
8888
|
8888
|
/* Code to execute a GET when we select a value */ |
8889
|
|
- $(".' . $htmlname . '").change(function() { |
8890
|
|
- var selected = $(".' . $htmlname . '").val(); |
|
8889
|
+ $(".' . $htmlname.'").change(function() { |
|
8890
|
+ var selected = $(".' . $htmlname.'").val(); |
8891
|
8891
|
console.log("We select in selectArrayAjax the entry "+selected) |
8892
|
|
- $(".' . $htmlname . '").val(""); /* reset visible combo value */ |
|
8892
|
+ $(".' . $htmlname.'").val(""); /* reset visible combo value */ |
8893
|
8893
|
$.each( saveRemoteData, function( key, value ) { |
8894
|
8894
|
if (key == selected) |
8895
|
8895
|
{ |
|
@@ -8897,7 +8897,7 @@ discard block |
|
|
block discarded – undo |
8897
|
8897
|
location.assign(value.url); |
8898
|
8898
|
} |
8899
|
8899
|
}); |
8900
|
|
- });' : '') . ' |
|
8900
|
+ });' : '').' |
8901
|
8901
|
|
8902
|
8902
|
}); |
8903
|
8903
|
</script>'; |
|
@@ -8933,14 +8933,14 @@ discard block |
|
|
block discarded – undo |
8933
|
8933
|
public static function selectArrayFilter($htmlname, $array, $id = '', $moreparam = '', $disableFiltering = 0, $disabled = 0, $minimumInputLength = 1, $morecss = '', $callurlonselect = 0, $placeholder = '', $acceptdelayedhtml = 0, $textfortitle = '') |
8934
|
8934
|
{ |
8935
|
8935
|
global $conf, $langs; |
8936
|
|
- global $delayedhtmlcontent; // Will be used later outside of this function |
|
8936
|
+ global $delayedhtmlcontent; // Will be used later outside of this function |
8937
|
8937
|
|
8938
|
8938
|
// TODO Use an internal dolibarr component instead of select2 |
8939
|
8939
|
if (!getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') && !defined('REQUIRE_JQUERY_MULTISELECT')) { |
8940
|
8940
|
return ''; |
8941
|
8941
|
} |
8942
|
8942
|
|
8943
|
|
- $out = '<select type="text"'.($textfortitle ? ' title="'.dol_escape_htmltag($textfortitle).'"' : '').' id="'.$htmlname.'" class="'.$htmlname.($morecss ? ' ' . $morecss : '').'"'.($moreparam ? ' '.$moreparam : '').' name="'.$htmlname.'"><option></option></select>'; |
|
8943
|
+ $out = '<select type="text"'.($textfortitle ? ' title="'.dol_escape_htmltag($textfortitle).'"' : '').' id="'.$htmlname.'" class="'.$htmlname.($morecss ? ' '.$morecss : '').'"'.($moreparam ? ' '.$moreparam : '').' name="'.$htmlname.'"><option></option></select>'; |
8944
|
8944
|
|
8945
|
8945
|
$formattedarrayresult = array(); |
8946
|
8946
|
|
|
@@ -8955,20 +8955,20 @@ discard block |
|
|
block discarded – undo |
8955
|
8955
|
$outdelayed = ''; |
8956
|
8956
|
if (!empty($conf->use_javascript_ajax)) { |
8957
|
8957
|
$tmpplugin = 'select2'; |
8958
|
|
- $outdelayed = "\n" . '<!-- JS CODE TO ENABLE ' . $tmpplugin . ' for id ' . $htmlname . ' --> |
8959
|
|
- <script nonce="' . getNonce() . '"> |
|
8958
|
+ $outdelayed = "\n".'<!-- JS CODE TO ENABLE '.$tmpplugin.' for id '.$htmlname.' --> |
|
8959
|
+ <script nonce="' . getNonce().'"> |
8960
|
8960
|
$(document).ready(function () { |
8961
|
|
- var data = ' . json_encode($formattedarrayresult) . '; |
|
8961
|
+ var data = ' . json_encode($formattedarrayresult).'; |
8962
|
8962
|
|
8963
|
|
- ' . ($callurlonselect ? 'var saveRemoteData = ' . json_encode($array) . ';' : '') . ' |
|
8963
|
+ ' . ($callurlonselect ? 'var saveRemoteData = '.json_encode($array).';' : '').' |
8964
|
8964
|
|
8965
|
|
- $(".' . $htmlname . '").select2({ |
|
8965
|
+ $(".' . $htmlname.'").select2({ |
8966
|
8966
|
data: data, |
8967
|
8967
|
language: select2arrayoflanguage, |
8968
|
8968
|
containerCssClass: \':all:\', /* Line to add class of origin SELECT propagated to the new <span class="select2-selection...> tag */ |
8969
|
|
- placeholder: "' . dol_escape_js($placeholder) . '", |
|
8969
|
+ placeholder: "' . dol_escape_js($placeholder).'", |
8970
|
8970
|
escapeMarkup: function (markup) { return markup; }, // let our custom formatter work |
8971
|
|
- minimumInputLength: ' . $minimumInputLength . ', |
|
8971
|
+ minimumInputLength: ' . $minimumInputLength.', |
8972
|
8972
|
formatResult: function (result, container, query, escapeMarkup) { |
8973
|
8973
|
return escapeMarkup(result.text); |
8974
|
8974
|
}, |
|
@@ -9007,11 +9007,11 @@ discard block |
|
|
block discarded – undo |
9007
|
9007
|
|
9008
|
9008
|
' . ($callurlonselect ? ' |
9009
|
9009
|
/* Code to execute a GET when we select a value */ |
9010
|
|
- $(".' . $htmlname . '").change(function() { |
9011
|
|
- var selected = $(".' . $htmlname . '").val(); |
|
9010
|
+ $(".' . $htmlname.'").change(function() { |
|
9011
|
+ var selected = $(".' . $htmlname.'").val(); |
9012
|
9012
|
console.log("We select "+selected) |
9013
|
9013
|
|
9014
|
|
- $(".' . $htmlname . '").val(""); /* reset visible combo value */ |
|
9014
|
+ $(".' . $htmlname.'").val(""); /* reset visible combo value */ |
9015
|
9015
|
$.each( saveRemoteData, function( key, value ) { |
9016
|
9016
|
if (key == selected) |
9017
|
9017
|
{ |
|
@@ -9019,7 +9019,7 @@ discard block |
|
|
block discarded – undo |
9019
|
9019
|
location.assign(value.url); |
9020
|
9020
|
} |
9021
|
9021
|
}); |
9022
|
|
- });' : '') . ' |
|
9022
|
+ });' : '').' |
9023
|
9023
|
|
9024
|
9024
|
}); |
9025
|
9025
|
</script>'; |
|
@@ -9068,7 +9068,7 @@ discard block |
|
|
block discarded – undo |
9068
|
9068
|
$useenhancedmultiselect = 0; |
9069
|
9069
|
if (!empty($conf->use_javascript_ajax) && !defined('MAIN_DO_NOT_USE_JQUERY_MULTISELECT') && (getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') || defined('REQUIRE_JQUERY_MULTISELECT'))) { |
9070
|
9070
|
if ($addjscombo) { |
9071
|
|
- $useenhancedmultiselect = 1; // Use the js multiselect in one line. Possible only if $addjscombo not 0. |
|
9071
|
+ $useenhancedmultiselect = 1; // Use the js multiselect in one line. Possible only if $addjscombo not 0. |
9072
|
9072
|
} |
9073
|
9073
|
} |
9074
|
9074
|
|
|
@@ -9077,7 +9077,7 @@ discard block |
|
|
block discarded – undo |
9077
|
9077
|
// submitted to nothing. |
9078
|
9078
|
$out .= '<input type="hidden" name="'.$htmlname.'_multiselect" value="1">'; |
9079
|
9079
|
// Output select component |
9080
|
|
- $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"; |
|
9080
|
+ $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"; |
9081
|
9081
|
if (is_array($array) && !empty($array)) { |
9082
|
9082
|
if ($value_as_key) { |
9083
|
9083
|
$array = array_combine($array, $array); |
|
@@ -9098,33 +9098,33 @@ discard block |
|
|
block discarded – undo |
9098
|
9098
|
$tmplabelhtml = empty($value['labelhtml']) ? (empty($value['data-html']) ? '' : $value['data-html']) : $value['labelhtml']; |
9099
|
9099
|
} |
9100
|
9100
|
$newval = ($translate ? $langs->trans($tmpvalue) : $tmpvalue); |
9101
|
|
- $newval = ($key_in_label ? $tmpkey . ' - ' . $newval : $newval); |
|
9101
|
+ $newval = ($key_in_label ? $tmpkey.' - '.$newval : $newval); |
9102
|
9102
|
|
9103
|
|
- $out .= '<option value="' . $tmpkey . '"'; |
|
9103
|
+ $out .= '<option value="'.$tmpkey.'"'; |
9104
|
9104
|
if (is_array($selected) && !empty($selected) && in_array((string) $tmpkey, $selected) && ((string) $tmpkey != '')) { |
9105
|
9105
|
$out .= ' selected'; |
9106
|
9106
|
} |
9107
|
9107
|
if (!empty($tmplabelhtml)) { |
9108
|
|
- $out .= ' data-html="' . dol_escape_htmltag($tmplabelhtml, 0, 0, '', 0, 1) . '"'; |
|
9108
|
+ $out .= ' data-html="'.dol_escape_htmltag($tmplabelhtml, 0, 0, '', 0, 1).'"'; |
9109
|
9109
|
} else { |
9110
|
|
- $tmplabelhtml = ($tmppicto ? img_picto('', $tmppicto, 'class="pictofixedwidth" style="color: #' . $tmpcolor . '"') : '') . $newval; |
9111
|
|
- $out .= ' data-html="' . dol_escape_htmltag($tmplabelhtml, 0, 0, '', 0, 1) . '"'; |
|
9110
|
+ $tmplabelhtml = ($tmppicto ? img_picto('', $tmppicto, 'class="pictofixedwidth" style="color: #'.$tmpcolor.'"') : '').$newval; |
|
9111
|
+ $out .= ' data-html="'.dol_escape_htmltag($tmplabelhtml, 0, 0, '', 0, 1).'"'; |
9112
|
9112
|
} |
9113
|
9113
|
$out .= '>'; |
9114
|
9114
|
$out .= dol_htmlentitiesbr($newval); |
9115
|
|
- $out .= '</option>' . "\n"; |
|
9115
|
+ $out .= '</option>'."\n"; |
9116
|
9116
|
} |
9117
|
9117
|
} |
9118
|
9118
|
} |
9119
|
|
- $out .= '</select>' . "\n"; |
|
9119
|
+ $out .= '</select>'."\n"; |
9120
|
9120
|
|
9121
|
9121
|
// Add code for jquery to use multiselect |
9122
|
9122
|
if (!empty($conf->use_javascript_ajax) && getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') || defined('REQUIRE_JQUERY_MULTISELECT')) { |
9123
|
|
- $out .= "\n" . '<!-- JS CODE TO ENABLE select for id ' . $htmlname . ', addjscombo=' . $addjscombo . ' -->'; |
9124
|
|
- $out .= "\n" . '<script nonce="' . getNonce() . '">' . "\n"; |
|
9123
|
+ $out .= "\n".'<!-- JS CODE TO ENABLE select for id '.$htmlname.', addjscombo='.$addjscombo.' -->'; |
|
9124
|
+ $out .= "\n".'<script nonce="'.getNonce().'">'."\n"; |
9125
|
9125
|
if ($addjscombo == 1) { |
9126
|
9126
|
$tmpplugin = !getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') ? constant('REQUIRE_JQUERY_MULTISELECT') : $conf->global->MAIN_USE_JQUERY_MULTISELECT; |
9127
|
|
- $out .= 'function formatResult(record, container) {' . "\n"; |
|
9127
|
+ $out .= 'function formatResult(record, container) {'."\n"; |
9128
|
9128
|
// If property data-html set, we decode html entities and use this. |
9129
|
9129
|
// Note that HTML content must have been sanitized from js with dol_escape_htmltag(xxx, 0, 0, '', 0, 1) when building the select option. |
9130
|
9130
|
$out .= ' if ($(record.element).attr("data-html") != undefined && typeof htmlEntityDecodeJs === "function") {'; |
|
@@ -9132,26 +9132,26 @@ discard block |
|
|
block discarded – undo |
9132
|
9132
|
$out .= ' return htmlEntityDecodeJs($(record.element).attr("data-html"));'; |
9133
|
9133
|
$out .= ' }'."\n"; |
9134
|
9134
|
$out .= ' return record.text;'; |
9135
|
|
- $out .= '}' . "\n"; |
9136
|
|
- $out .= 'function formatSelection(record) {' . "\n"; |
|
9135
|
+ $out .= '}'."\n"; |
|
9136
|
+ $out .= 'function formatSelection(record) {'."\n"; |
9137
|
9137
|
if ($elemtype == 'category') { |
9138
|
|
- $out .= 'return \'<span><img src="' . DOL_URL_ROOT . '/theme/eldy/img/object_category.png"> \'+record.text+\'</span>\';'; |
|
9138
|
+ $out .= 'return \'<span><img src="'.DOL_URL_ROOT.'/theme/eldy/img/object_category.png"> \'+record.text+\'</span>\';'; |
9139
|
9139
|
} else { |
9140
|
9140
|
$out .= 'return record.text;'; |
9141
|
9141
|
} |
9142
|
|
- $out .= '}' . "\n"; |
|
9142
|
+ $out .= '}'."\n"; |
9143
|
9143
|
$out .= '$(document).ready(function () { |
9144
|
|
- $(\'#' . $htmlname . '\').' . $tmpplugin . '({'; |
|
9144
|
+ $(\'#' . $htmlname.'\').'.$tmpplugin.'({'; |
9145
|
9145
|
if ($placeholder) { |
9146
|
9146
|
$out .= ' |
9147
|
9147
|
placeholder: { |
9148
|
9148
|
id: \'-1\', |
9149
|
|
- text: \'' . dol_escape_js($placeholder) . '\' |
|
9149
|
+ text: \'' . dol_escape_js($placeholder).'\' |
9150
|
9150
|
},'; |
9151
|
9151
|
} |
9152
|
9152
|
$out .= ' dir: \'ltr\', |
9153
|
9153
|
containerCssClass: \':all:\', /* Line to add class of origin SELECT propagated to the new <span class="select2-selection...> tag (ko with multiselect) */ |
9154
|
|
- dropdownCssClass: \'' . $morecss . '\', /* Line to add class on the new <span class="select2-selection...> tag (ok with multiselect). Need full version of select2. */ |
|
9154
|
+ dropdownCssClass: \'' . $morecss.'\', /* Line to add class on the new <span class="select2-selection...> tag (ok with multiselect). Need full version of select2. */ |
9155
|
9155
|
// Specify format function for dropdown item |
9156
|
9156
|
formatResult: formatResult, |
9157
|
9157
|
templateResult: formatResult, /* For 4.0 */ |
|
@@ -9163,21 +9163,21 @@ discard block |
|
|
block discarded – undo |
9163
|
9163
|
|
9164
|
9164
|
/* Add also morecss to the css .select2 that is after the #htmlname, for component that are show dynamically after load, because select2 set |
9165
|
9165
|
the size only if component is not hidden by default on load */ |
9166
|
|
- $(\'#' . $htmlname . ' + .select2\').addClass(\'' . $morecss . '\'); |
|
9166
|
+ $(\'#' . $htmlname.' + .select2\').addClass(\''.$morecss.'\'); |
9167
|
9167
|
});' . "\n"; |
9168
|
9168
|
} elseif ($addjscombo == 2 && !defined('DISABLE_MULTISELECT')) { |
9169
|
9169
|
// Add other js lib |
9170
|
9170
|
// TODO external lib multiselect/jquery.multi-select.js must have been loaded to use this multiselect plugin |
9171
|
9171
|
// ... |
9172
|
|
- $out .= 'console.log(\'addjscombo=2 for htmlname=' . $htmlname . '\');'; |
|
9172
|
+ $out .= 'console.log(\'addjscombo=2 for htmlname='.$htmlname.'\');'; |
9173
|
9173
|
$out .= '$(document).ready(function () { |
9174
|
|
- $(\'#' . $htmlname . '\').multiSelect({ |
|
9174
|
+ $(\'#' . $htmlname.'\').multiSelect({ |
9175
|
9175
|
containerHTML: \'<div class="multi-select-container">\', |
9176
|
9176
|
menuHTML: \'<div class="multi-select-menu">\', |
9177
|
|
- buttonHTML: \'<span class="multi-select-button ' . $morecss . '">\', |
|
9177
|
+ buttonHTML: \'<span class="multi-select-button ' . $morecss.'">\', |
9178
|
9178
|
menuItemHTML: \'<label class="multi-select-menuitem">\', |
9179
|
9179
|
activeClass: \'multi-select-container--open\', |
9180
|
|
- noneText: \'' . $placeholder . '\' |
|
9180
|
+ noneText: \'' . $placeholder.'\' |
9181
|
9181
|
}); |
9182
|
9182
|
})'; |
9183
|
9183
|
} |
|
@@ -9210,7 +9210,7 @@ discard block |
|
|
block discarded – undo |
9210
|
9210
|
return ''; |
9211
|
9211
|
} |
9212
|
9212
|
|
9213
|
|
- $tmpvar = "MAIN_SELECTEDFIELDS_" . $varpage; // To get list of saved selected fields to show |
|
9213
|
+ $tmpvar = "MAIN_SELECTEDFIELDS_".$varpage; // To get list of saved selected fields to show |
9214
|
9214
|
|
9215
|
9215
|
if (!empty($user->conf->$tmpvar)) { // A list of fields was already customized for user |
9216
|
9216
|
$tmparray = explode(',', $user->conf->$tmpvar); |
|
@@ -9253,19 +9253,19 @@ discard block |
|
|
block discarded – undo |
9253
|
9253
|
} |
9254
|
9254
|
|
9255
|
9255
|
// Note: $val['checked'] <> 0 means we must show the field into the combo list @phan-suppress-next-line PhanTypePossiblyInvalidDimOffset |
9256
|
|
- $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>'; |
9257
|
|
- $listcheckedstring .= (empty($val['checked']) ? '' : $key . ','); |
|
9256
|
+ $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>'; |
|
9257
|
+ $listcheckedstring .= (empty($val['checked']) ? '' : $key.','); |
9258
|
9258
|
} |
9259
|
9259
|
} |
9260
|
9260
|
|
9261
|
|
- $out = '<!-- Component multiSelectArrayWithCheckbox ' . $htmlname . ' --> |
|
9261
|
+ $out = '<!-- Component multiSelectArrayWithCheckbox '.$htmlname.' --> |
9262
|
9262
|
|
9263
|
9263
|
<dl class="dropdown"> |
9264
|
9264
|
<dt> |
9265
|
|
- <a href="#' . $htmlname . '"> |
9266
|
|
- ' . img_picto('', 'list') . ' |
|
9265
|
+ <a href="#' . $htmlname.'"> |
|
9266
|
+ ' . img_picto('', 'list').' |
9267
|
9267
|
</a> |
9268
|
|
- <input type="hidden" class="' . $htmlname . '" name="' . $htmlname . '" value="' . $listcheckedstring . '"> |
|
9268
|
+ <input type="hidden" class="' . $htmlname.'" name="'.$htmlname.'" value="'.$listcheckedstring.'"> |
9269
|
9269
|
</dt> |
9270
|
9270
|
<dd class="dropdowndd"> |
9271
|
9271
|
<div class="multiselectcheckbox'.$htmlname.'"> |
|
@@ -9277,19 +9277,19 @@ discard block |
|
|
block discarded – undo |
9277
|
9277
|
</dd> |
9278
|
9278
|
</dl> |
9279
|
9279
|
|
9280
|
|
- <script nonce="' . getNonce() . '" type="text/javascript"> |
|
9280
|
+ <script nonce="' . getNonce().'" type="text/javascript"> |
9281
|
9281
|
jQuery(document).ready(function () { |
9282
|
|
- $(\'.multiselectcheckbox' . $htmlname . ' input[type="checkbox"]\').on(\'click\', function () { |
|
9282
|
+ $(\'.multiselectcheckbox' . $htmlname.' input[type="checkbox"]\').on(\'click\', function () { |
9283
|
9283
|
console.log("A new field was added/removed, we edit field input[name=formfilteraction]"); |
9284
|
9284
|
|
9285
|
9285
|
$("input:hidden[name=formfilteraction]").val(\'listafterchangingselectedfields\'); // Update field so we know we changed something on selected fields after POST |
9286
|
9286
|
|
9287
|
9287
|
var title = $(this).val() + ","; |
9288
|
9288
|
if ($(this).is(\':checked\')) { |
9289
|
|
- $(\'.' . $htmlname . '\').val(title + $(\'.' . $htmlname . '\').val()); |
|
9289
|
+ $(\'.' . $htmlname.'\').val(title + $(\'.'.$htmlname.'\').val()); |
9290
|
9290
|
} |
9291
|
9291
|
else { |
9292
|
|
- $(\'.' . $htmlname . '\').val( $(\'.' . $htmlname . '\').val().replace(title, \'\') ) |
|
9292
|
+ $(\'.' . $htmlname.'\').val( $(\'.'.$htmlname.'\').val().replace(title, \'\') ) |
9293
|
9293
|
} |
9294
|
9294
|
// Now, we submit page |
9295
|
9295
|
//$(this).parents(\'form:first\').submit(); |
|
@@ -9320,7 +9320,7 @@ discard block |
|
|
block discarded – undo |
9320
|
9320
|
*/ |
9321
|
9321
|
public function showCategories($id, $type, $rendermode = 0, $nolink = 0) |
9322
|
9322
|
{ |
9323
|
|
- include_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; |
|
9323
|
+ include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; |
9324
|
9324
|
|
9325
|
9325
|
$cat = new Categorie($this->db); |
9326
|
9326
|
$categories = $cat->containing($id, $type); |
|
@@ -9330,13 +9330,13 @@ discard block |
|
|
block discarded – undo |
9330
|
9330
|
foreach ($categories as $c) { |
9331
|
9331
|
$ways = $c->print_all_ways(' >> ', ($nolink ? 'none' : ''), 0, 1); // $ways[0] = "ccc2 >> ccc2a >> ccc2a1" with html formatted text |
9332
|
9332
|
foreach ($ways as $way) { |
9333
|
|
- $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"' . ($c->color ? ' style="background: #' . $c->color . ';"' : ' style="background: #bbb"') . '>' . $way . '</li>'; |
|
9333
|
+ $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"'.($c->color ? ' style="background: #'.$c->color.';"' : ' style="background: #bbb"').'>'.$way.'</li>'; |
9334
|
9334
|
} |
9335
|
9335
|
} |
9336
|
9336
|
if (empty($toprint)) { |
9337
|
9337
|
return ''; |
9338
|
9338
|
} else { |
9339
|
|
- return '<div class="select2-container-multi-dolibarr"><ul class="select2-choices-dolibarr">' . implode(' ', $toprint) . '</ul></div>'; |
|
9339
|
+ return '<div class="select2-container-multi-dolibarr"><ul class="select2-choices-dolibarr">'.implode(' ', $toprint).'</ul></div>'; |
9340
|
9340
|
} |
9341
|
9341
|
} |
9342
|
9342
|
|
|
@@ -9385,15 +9385,15 @@ discard block |
|
|
block discarded – undo |
9385
|
9385
|
|
9386
|
9386
|
|
9387
|
9387
|
print '<div class="div-table-responsive-no-min">'; |
9388
|
|
- print '<table class="noborder allwidth" data-block="showLinkedObject" data-element="' . $object->element . '" data-elementid="' . $object->id . '" >'; |
|
9388
|
+ print '<table class="noborder allwidth" data-block="showLinkedObject" data-element="'.$object->element.'" data-elementid="'.$object->id.'" >'; |
9389
|
9389
|
|
9390
|
9390
|
print '<tr class="liste_titre">'; |
9391
|
|
- print '<td>' . $langs->trans("Type") . '</td>'; |
9392
|
|
- print '<td>' . $langs->trans("Ref") . '</td>'; |
|
9391
|
+ print '<td>'.$langs->trans("Type").'</td>'; |
|
9392
|
+ print '<td>'.$langs->trans("Ref").'</td>'; |
9393
|
9393
|
print '<td class="center"></td>'; |
9394
|
|
- print '<td class="center">' . $langs->trans("Date") . '</td>'; |
9395
|
|
- print '<td class="right">' . $langs->trans("AmountHTShort") . '</td>'; |
9396
|
|
- print '<td class="right">' . $langs->trans("Status") . '</td>'; |
|
9394
|
+ print '<td class="center">'.$langs->trans("Date").'</td>'; |
|
9395
|
+ print '<td class="right">'.$langs->trans("AmountHTShort").'</td>'; |
|
9396
|
+ print '<td class="right">'.$langs->trans("Status").'</td>'; |
9397
|
9397
|
print '<td></td>'; |
9398
|
9398
|
print '</tr>'; |
9399
|
9399
|
|
|
@@ -9412,13 +9412,13 @@ discard block |
|
|
block discarded – undo |
9412
|
9412
|
if ($objecttype != 'supplier_proposal' && preg_match('/^([^_]+)_([^_]+)/i', $objecttype, $regs)) { |
9413
|
9413
|
$element = $regs[1]; |
9414
|
9414
|
$subelement = $regs[2]; |
9415
|
|
- $tplpath = $element . '/' . $subelement; |
|
9415
|
+ $tplpath = $element.'/'.$subelement; |
9416
|
9416
|
} |
9417
|
9417
|
$tplname = 'linkedobjectblock'; |
9418
|
9418
|
|
9419
|
9419
|
// To work with non standard path |
9420
|
9420
|
if ($objecttype == 'facture') { |
9421
|
|
- $tplpath = 'compta/' . $element; |
|
9421
|
+ $tplpath = 'compta/'.$element; |
9422
|
9422
|
if (!isModEnabled('invoice')) { |
9423
|
9423
|
continue; // Do not show if module disabled |
9424
|
9424
|
} |
|
@@ -9429,7 +9429,7 @@ discard block |
|
|
block discarded – undo |
9429
|
9429
|
continue; // Do not show if module disabled |
9430
|
9430
|
} |
9431
|
9431
|
} elseif ($objecttype == 'propal') { |
9432
|
|
- $tplpath = 'comm/' . $element; |
|
9432
|
+ $tplpath = 'comm/'.$element; |
9433
|
9433
|
if (!isModEnabled('propal')) { |
9434
|
9434
|
continue; // Do not show if module disabled |
9435
|
9435
|
} |
|
@@ -9482,7 +9482,7 @@ discard block |
|
|
block discarded – undo |
9482
|
9482
|
$linkedObjectBlock = $objects; |
9483
|
9483
|
|
9484
|
9484
|
// Output template part (modules that overwrite templates must declare this into descriptor) |
9485
|
|
- $dirtpls = array_merge($conf->modules_parts['tpl'], array('/' . $tplpath . '/tpl')); |
|
9485
|
+ $dirtpls = array_merge($conf->modules_parts['tpl'], array('/'.$tplpath.'/tpl')); |
9486
|
9486
|
foreach ($dirtpls as $reldir) { |
9487
|
9487
|
$reldir = rtrim($reldir, '/'); |
9488
|
9488
|
if ($nboftypesoutput == ($nbofdifferenttypes - 1)) { // No more type to show after |
|
@@ -9490,7 +9490,7 @@ discard block |
|
|
block discarded – undo |
9490
|
9490
|
$noMoreLinkedObjectBlockAfter = 1; |
9491
|
9491
|
} |
9492
|
9492
|
|
9493
|
|
- $res = @include dol_buildpath($reldir . '/' . $tplname . '.tpl.php'); |
|
9493
|
+ $res = @include dol_buildpath($reldir.'/'.$tplname.'.tpl.php'); |
9494
|
9494
|
if ($res) { |
9495
|
9495
|
$nboftypesoutput++; |
9496
|
9496
|
break; |
|
@@ -9499,7 +9499,7 @@ discard block |
|
|
block discarded – undo |
9499
|
9499
|
} |
9500
|
9500
|
|
9501
|
9501
|
if (!$nboftypesoutput) { |
9502
|
|
- print '<tr><td colspan="7"><span class="opacitymedium">' . $langs->trans("None") . '</span></td></tr>'; |
|
9502
|
+ print '<tr><td colspan="7"><span class="opacitymedium">'.$langs->trans("None").'</span></td></tr>'; |
9503
|
9503
|
} |
9504
|
9504
|
|
9505
|
9505
|
print '</table>'; |
|
@@ -9539,14 +9539,14 @@ discard block |
|
|
block discarded – undo |
9539
|
9539
|
if (is_object($object->thirdparty) && !empty($object->thirdparty->id) && $object->thirdparty->id > 0) { |
9540
|
9540
|
$listofidcompanytoscan = $object->thirdparty->id; |
9541
|
9541
|
if (($object->thirdparty->parent > 0) && getDolGlobalString('THIRDPARTY_INCLUDE_PARENT_IN_LINKTO')) { |
9542
|
|
- $listofidcompanytoscan .= ',' . $object->thirdparty->parent; |
|
9542
|
+ $listofidcompanytoscan .= ','.$object->thirdparty->parent; |
9543
|
9543
|
} |
9544
|
9544
|
if (($object->fk_project > 0) && getDolGlobalString('THIRDPARTY_INCLUDE_PROJECT_THIRDPARY_IN_LINKTO')) { |
9545
|
|
- include_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; |
|
9545
|
+ include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; |
9546
|
9546
|
$tmpproject = new Project($this->db); |
9547
|
9547
|
$tmpproject->fetch($object->fk_project); |
9548
|
9548
|
if ($tmpproject->socid > 0 && ($tmpproject->socid != $object->thirdparty->id)) { |
9549
|
|
- $listofidcompanytoscan .= ',' . $tmpproject->socid; |
|
9549
|
+ $listofidcompanytoscan .= ','.$tmpproject->socid; |
9550
|
9550
|
} |
9551
|
9551
|
unset($tmpproject); |
9552
|
9552
|
} |
|
@@ -9556,63 +9556,63 @@ discard block |
|
|
block discarded – undo |
9556
|
9556
|
'enabled' => isModEnabled('propal'), |
9557
|
9557
|
'perms' => 1, |
9558
|
9558
|
'label' => 'LinkToProposal', |
9559
|
|
- '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') . ')'), |
|
9559
|
+ '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').')'), |
9560
|
9560
|
'shipping' => array( |
9561
|
9561
|
'enabled' => isModEnabled('shipping'), |
9562
|
9562
|
'perms' => 1, |
9563
|
9563
|
'label' => 'LinkToExpedition', |
9564
|
|
- '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') . ')'), |
|
9564
|
+ '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').')'), |
9565
|
9565
|
'order' => array( |
9566
|
9566
|
'enabled' => isModEnabled('order'), |
9567
|
9567
|
'perms' => 1, |
9568
|
9568
|
'label' => 'LinkToOrder', |
9569
|
|
- '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') . ')'), |
|
9569
|
+ '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').')'), |
9570
|
9570
|
'invoice' => array( |
9571
|
9571
|
'enabled' => isModEnabled('invoice'), |
9572
|
9572
|
'perms' => 1, |
9573
|
9573
|
'label' => 'LinkToInvoice', |
9574
|
|
- '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') . ')'), |
|
9574
|
+ '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').')'), |
9575
|
9575
|
'invoice_template' => array( |
9576
|
9576
|
'enabled' => isModEnabled('invoice'), |
9577
|
9577
|
'perms' => 1, |
9578
|
9578
|
'label' => 'LinkToTemplateInvoice', |
9579
|
|
- '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') . ')'), |
|
9579
|
+ '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').')'), |
9580
|
9580
|
'contrat' => array( |
9581
|
9581
|
'enabled' => isModEnabled('contract'), |
9582
|
9582
|
'perms' => 1, |
9583
|
9583
|
'label' => 'LinkToContract', |
9584
|
9584
|
'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 |
9585
|
|
- 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' |
|
9585
|
+ 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' |
9586
|
9586
|
), |
9587
|
9587
|
'fichinter' => array( |
9588
|
9588
|
'enabled' => isModEnabled('intervention'), |
9589
|
9589
|
'perms' => 1, |
9590
|
9590
|
'label' => 'LinkToIntervention', |
9591
|
|
- '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') . ')'), |
|
9591
|
+ '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').')'), |
9592
|
9592
|
'supplier_proposal' => array( |
9593
|
9593
|
'enabled' => isModEnabled('supplier_proposal'), |
9594
|
9594
|
'perms' => 1, |
9595
|
9595
|
'label' => 'LinkToSupplierProposal', |
9596
|
|
- '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') . ')'), |
|
9596
|
+ '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').')'), |
9597
|
9597
|
'order_supplier' => array( |
9598
|
9598
|
'enabled' => isModEnabled("supplier_order"), |
9599
|
9599
|
'perms' => 1, |
9600
|
9600
|
'label' => 'LinkToSupplierOrder', |
9601
|
|
- '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') . ')'), |
|
9601
|
+ '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').')'), |
9602
|
9602
|
'invoice_supplier' => array( |
9603
|
9603
|
'enabled' => isModEnabled("supplier_invoice"), |
9604
|
9604
|
'perms' => 1, 'label' => 'LinkToSupplierInvoice', |
9605
|
|
- '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') . ')'), |
|
9605
|
+ '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').')'), |
9606
|
9606
|
'ticket' => array( |
9607
|
9607
|
'enabled' => isModEnabled('ticket'), |
9608
|
9608
|
'perms' => 1, |
9609
|
9609
|
'label' => 'LinkToTicket', |
9610
|
|
- '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') . ')'), |
|
9610
|
+ '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').')'), |
9611
|
9611
|
'mo' => array( |
9612
|
9612
|
'enabled' => isModEnabled('mrp'), |
9613
|
9613
|
'perms' => 1, |
9614
|
9614
|
'label' => 'LinkToMo', |
9615
|
|
- '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') . ')') |
|
9615
|
+ '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').')') |
9616
|
9616
|
); |
9617
|
9617
|
} |
9618
|
9618
|
|
|
@@ -9648,22 +9648,22 @@ discard block |
|
|
block discarded – undo |
9648
|
9648
|
} |
9649
|
9649
|
|
9650
|
9650
|
if (!empty($possiblelink['perms']) && (empty($restrictlinksto) || in_array($key, $restrictlinksto)) && (empty($excludelinksto) || !in_array($key, $excludelinksto))) { |
9651
|
|
- print '<div id="' . $key . 'list"' . (empty($conf->use_javascript_ajax) ? '' : ' style="display:none"') . '>'; |
|
9651
|
+ print '<div id="'.$key.'list"'.(empty($conf->use_javascript_ajax) ? '' : ' style="display:none"').'>'; |
9652
|
9652
|
|
9653
|
9653
|
if (getDolGlobalString('MAIN_LINK_BY_REF_IN_LINKTO')) { |
9654
|
9654
|
print '<br>'."\n"; |
9655
|
9655
|
print '<!-- form to add a link from anywhere -->'."\n"; |
9656
|
|
- print '<form action="' . $_SERVER["PHP_SELF"] . '" method="POST" name="formlinkedbyref' . $key . '">'; |
9657
|
|
- print '<input type="hidden" name="id" value="' . $object->id . '">'; |
|
9656
|
+ print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" name="formlinkedbyref'.$key.'">'; |
|
9657
|
+ print '<input type="hidden" name="id" value="'.$object->id.'">'; |
9658
|
9658
|
print '<input type="hidden" name="action" value="addlinkbyref">'; |
9659
|
|
- print '<input type="hidden" name="token" value="' . newToken() . '">'; |
9660
|
|
- print '<input type="hidden" name="addlink" value="' . $key . '">'; |
|
9659
|
+ print '<input type="hidden" name="token" value="'.newToken().'">'; |
|
9660
|
+ print '<input type="hidden" name="addlink" value="'.$key.'">'; |
9661
|
9661
|
print '<table class="noborder">'; |
9662
|
9662
|
print '<tr>'; |
9663
|
9663
|
//print '<td>' . $langs->trans("Ref") . '</td>'; |
9664
|
|
- print '<td class="center"><input type="text" placeholder="'.dol_escape_htmltag($langs->trans("Ref")).'" name="reftolinkto" value="' . dol_escape_htmltag(GETPOST('reftolinkto', 'alpha')) . '"> '; |
9665
|
|
- print '<input type="submit" class="button small valignmiddle" value="' . $langs->trans('ToLink') . '"> '; |
9666
|
|
- print '<input type="submit" class="button small" name="cancel" value="' . $langs->trans('Cancel') . '"></td>'; |
|
9664
|
+ print '<td class="center"><input type="text" placeholder="'.dol_escape_htmltag($langs->trans("Ref")).'" name="reftolinkto" value="'.dol_escape_htmltag(GETPOST('reftolinkto', 'alpha')).'"> '; |
|
9665
|
+ print '<input type="submit" class="button small valignmiddle" value="'.$langs->trans('ToLink').'"> '; |
|
9666
|
+ print '<input type="submit" class="button small" name="cancel" value="'.$langs->trans('Cancel').'"></td>'; |
9667
|
9667
|
print '</tr>'; |
9668
|
9668
|
print '</table>'; |
9669
|
9669
|
print '</form>'; |
|
@@ -9678,48 +9678,48 @@ discard block |
|
|
block discarded – undo |
9678
|
9678
|
|
9679
|
9679
|
print '<br>'; |
9680
|
9680
|
print '<!-- form to add a link from object to same thirdparty -->'."\n"; |
9681
|
|
- print '<form action="' . $_SERVER["PHP_SELF"] . '" method="POST" name="formlinked' . $key . '">'; |
|
9681
|
+ print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" name="formlinked'.$key.'">'; |
9682
|
9682
|
print '<input type="hidden" name="action" value="addlink">'; |
9683
|
|
- print '<input type="hidden" name="token" value="' . newToken() . '">'; |
9684
|
|
- print '<input type="hidden" name="id" value="' . $object->id . '">'; |
9685
|
|
- print '<input type="hidden" name="addlink" value="' . $key . '">'; |
|
9683
|
+ print '<input type="hidden" name="token" value="'.newToken().'">'; |
|
9684
|
+ print '<input type="hidden" name="id" value="'.$object->id.'">'; |
|
9685
|
+ print '<input type="hidden" name="addlink" value="'.$key.'">'; |
9686
|
9686
|
print '<table class="noborder">'; |
9687
|
9687
|
print '<tr class="liste_titre">'; |
9688
|
9688
|
print '<td class="nowrap"></td>'; |
9689
|
|
- print '<td class="center">' . $langs->trans("Ref") . '</td>'; |
9690
|
|
- print '<td class="left">' . $langs->trans("RefCustomer") . '</td>'; |
9691
|
|
- print '<td class="right">' . $langs->trans("AmountHTShort") . '</td>'; |
9692
|
|
- print '<td class="left">' . $langs->trans("Company") . '</td>'; |
|
9689
|
+ print '<td class="center">'.$langs->trans("Ref").'</td>'; |
|
9690
|
+ print '<td class="left">'.$langs->trans("RefCustomer").'</td>'; |
|
9691
|
+ print '<td class="right">'.$langs->trans("AmountHTShort").'</td>'; |
|
9692
|
+ print '<td class="left">'.$langs->trans("Company").'</td>'; |
9693
|
9693
|
print '</tr>'; |
9694
|
9694
|
while ($i < $num) { |
9695
|
9695
|
$objp = $this->db->fetch_object($resqllist); |
9696
|
9696
|
|
9697
|
9697
|
print '<tr class="oddeven">'; |
9698
|
9698
|
print '<td class="left">'; |
9699
|
|
- print '<input type="radio" name="idtolinkto" id="' . $key . '_' . $objp->rowid . '" value="' . $objp->rowid . '">'; |
|
9699
|
+ print '<input type="radio" name="idtolinkto" id="'.$key.'_'.$objp->rowid.'" value="'.$objp->rowid.'">'; |
9700
|
9700
|
print '</td>'; |
9701
|
|
- print '<td class="center"><label for="' . $key . '_' . $objp->rowid . '">' . $objp->ref . '</label></td>'; |
9702
|
|
- print '<td>' . (!empty($objp->ref_client) ? $objp->ref_client : (!empty($objp->ref_supplier) ? $objp->ref_supplier : '')) . '</td>'; |
|
9701
|
+ print '<td class="center"><label for="'.$key.'_'.$objp->rowid.'">'.$objp->ref.'</label></td>'; |
|
9702
|
+ print '<td>'.(!empty($objp->ref_client) ? $objp->ref_client : (!empty($objp->ref_supplier) ? $objp->ref_supplier : '')).'</td>'; |
9703
|
9703
|
print '<td class="right">'; |
9704
|
9704
|
if ($possiblelink['label'] == 'LinkToContract') { |
9705
|
9705
|
$form = new Form($this->db); |
9706
|
|
- print $form->textwithpicto('', $langs->trans("InformationOnLinkToContract")) . ' '; |
|
9706
|
+ print $form->textwithpicto('', $langs->trans("InformationOnLinkToContract")).' '; |
9707
|
9707
|
} |
9708
|
|
- print '<span class="amount">' . (isset($objp->total_ht) ? price($objp->total_ht) : '') . '</span>'; |
|
9708
|
+ print '<span class="amount">'.(isset($objp->total_ht) ? price($objp->total_ht) : '').'</span>'; |
9709
|
9709
|
print '</td>'; |
9710
|
|
- print '<td>' . $objp->name . '</td>'; |
|
9710
|
+ print '<td>'.$objp->name.'</td>'; |
9711
|
9711
|
print '</tr>'; |
9712
|
9712
|
$i++; |
9713
|
9713
|
} |
9714
|
9714
|
print '</table>'; |
9715
|
9715
|
print '<div class="center">'; |
9716
|
9716
|
if ($num) { |
9717
|
|
- print '<input type="submit" class="button valignmiddle marginleftonly marginrightonly small" value="' . $langs->trans('ToLink') . '">'; |
|
9717
|
+ print '<input type="submit" class="button valignmiddle marginleftonly marginrightonly small" value="'.$langs->trans('ToLink').'">'; |
9718
|
9718
|
} |
9719
|
9719
|
if (empty($conf->use_javascript_ajax)) { |
9720
|
|
- print '<input type="submit" class="button button-cancel marginleftonly marginrightonly small" name="cancel" value="' . $langs->trans("Cancel") . '"></div>'; |
|
9720
|
+ print '<input type="submit" class="button button-cancel marginleftonly marginrightonly small" name="cancel" value="'.$langs->trans("Cancel").'"></div>'; |
9721
|
9721
|
} else { |
9722
|
|
- print '<input type="submit" onclick="jQuery(\'#' . $key . 'list\').toggle(); return false;" class="button button-cancel marginleftonly marginrightonly small" name="cancel" value="' . $langs->trans("Cancel") . '"></div>'; |
|
9722
|
+ print '<input type="submit" onclick="jQuery(\'#'.$key.'list\').toggle(); return false;" class="button button-cancel marginleftonly marginrightonly small" name="cancel" value="'.$langs->trans("Cancel").'"></div>'; |
9723
|
9723
|
} |
9724
|
9724
|
print '</form>'; |
9725
|
9725
|
$this->db->free($resqllist); |
|
@@ -9730,10 +9730,10 @@ discard block |
|
|
block discarded – undo |
9730
|
9730
|
|
9731
|
9731
|
//$linktoelem.=($linktoelem?' ':''); |
9732
|
9732
|
if ($num > 0 || getDolGlobalString('MAIN_LINK_BY_REF_IN_LINKTO')) { |
9733
|
|
- $linktoelemlist .= '<li><a href="#linkto' . $key . '" class="linkto dropdowncloseonclick" rel="' . $key . '">' . $langs->trans($possiblelink['label']) . ' (' . $num . ')</a></li>'; |
|
9733
|
+ $linktoelemlist .= '<li><a href="#linkto'.$key.'" class="linkto dropdowncloseonclick" rel="'.$key.'">'.$langs->trans($possiblelink['label']).' ('.$num.')</a></li>'; |
9734
|
9734
|
// } else $linktoelem.=$langs->trans($possiblelink['label']); |
9735
|
9735
|
} else { |
9736
|
|
- $linktoelemlist .= '<li><span class="linktodisabled">' . $langs->trans($possiblelink['label']) . ' (0)</span></li>'; |
|
9736
|
+ $linktoelemlist .= '<li><span class="linktodisabled">'.$langs->trans($possiblelink['label']).' (0)</span></li>'; |
9737
|
9737
|
} |
9738
|
9738
|
} |
9739
|
9739
|
} |
|
@@ -9743,11 +9743,11 @@ discard block |
|
|
block discarded – undo |
9743
|
9743
|
<dl class="dropdown" id="linktoobjectname"> |
9744
|
9744
|
'; |
9745
|
9745
|
if (!empty($conf->use_javascript_ajax)) { |
9746
|
|
- $linktoelem .= '<dt><a href="#linktoobjectname"><span class="fas fa-link paddingrightonly"></span>' . $langs->trans("LinkTo") . '...</a></dt>'; |
|
9746
|
+ $linktoelem .= '<dt><a href="#linktoobjectname"><span class="fas fa-link paddingrightonly"></span>'.$langs->trans("LinkTo").'...</a></dt>'; |
9747
|
9747
|
} |
9748
|
9748
|
$linktoelem .= '<dd> |
9749
|
9749
|
<div class="multiselectlinkto"> |
9750
|
|
- <ul class="ulselectedfields">' . $linktoelemlist . ' |
|
9750
|
+ <ul class="ulselectedfields">' . $linktoelemlist.' |
9751
|
9751
|
</ul> |
9752
|
9752
|
</div> |
9753
|
9753
|
</dd> |
|
@@ -9758,7 +9758,7 @@ discard block |
|
|
block discarded – undo |
9758
|
9758
|
|
9759
|
9759
|
if (!empty($conf->use_javascript_ajax)) { |
9760
|
9760
|
print '<!-- Add js to show linkto box --> |
9761
|
|
- <script nonce="' . getNonce() . '"> |
|
9761
|
+ <script nonce="' . getNonce().'"> |
9762
|
9762
|
jQuery(document).ready(function() { |
9763
|
9763
|
jQuery(".linkto").click(function() { |
9764
|
9764
|
console.log("We choose to show/hide links for rel="+jQuery(this).attr(\'rel\')+" so #"+jQuery(this).attr(\'rel\')+"list"); |
|
@@ -9799,19 +9799,19 @@ discard block |
|
|
block discarded – undo |
9799
|
9799
|
|
9800
|
9800
|
$disabled = ($disabled ? ' disabled' : ''); |
9801
|
9801
|
|
9802
|
|
- $resultyesno = '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" id="' . $htmlname . '" name="' . $htmlname . '"' . $disabled . '>' . "\n"; |
|
9802
|
+ $resultyesno = '<select class="flat'.($morecss ? ' '.$morecss : '').'" id="'.$htmlname.'" name="'.$htmlname.'"'.$disabled.'>'."\n"; |
9803
|
9803
|
if ($useempty) { |
9804
|
|
- $resultyesno .= '<option value="-1"' . (($value < 0) ? ' selected' : '') . '> </option>' . "\n"; |
|
9804
|
+ $resultyesno .= '<option value="-1"'.(($value < 0) ? ' selected' : '').'> </option>'."\n"; |
9805
|
9805
|
} |
9806
|
9806
|
if (("$value" == 'yes') || ($value == 1)) { |
9807
|
|
- $resultyesno .= '<option value="' . $yes . '" selected>' . $langs->trans($labelyes) . '</option>' . "\n"; |
9808
|
|
- $resultyesno .= '<option value="' . $no . '">' . $langs->trans($labelno) . '</option>' . "\n"; |
|
9807
|
+ $resultyesno .= '<option value="'.$yes.'" selected>'.$langs->trans($labelyes).'</option>'."\n"; |
|
9808
|
+ $resultyesno .= '<option value="'.$no.'">'.$langs->trans($labelno).'</option>'."\n"; |
9809
|
9809
|
} else { |
9810
|
9810
|
$selected = (($useempty && $value != '0' && $value != 'no') ? '' : ' selected'); |
9811
|
|
- $resultyesno .= '<option value="' . $yes . '">' . $langs->trans($labelyes) . '</option>' . "\n"; |
9812
|
|
- $resultyesno .= '<option value="' . $no . '"' . $selected . '>' . $langs->trans($labelno) . '</option>' . "\n"; |
|
9811
|
+ $resultyesno .= '<option value="'.$yes.'">'.$langs->trans($labelyes).'</option>'."\n"; |
|
9812
|
+ $resultyesno .= '<option value="'.$no.'"'.$selected.'>'.$langs->trans($labelno).'</option>'."\n"; |
9813
|
9813
|
} |
9814
|
|
- $resultyesno .= '</select>' . "\n"; |
|
9814
|
+ $resultyesno .= '</select>'."\n"; |
9815
|
9815
|
|
9816
|
9816
|
if ($addjscombo) { |
9817
|
9817
|
$resultyesno .= ajax_combobox($htmlname, array(), 0, 0, 'resolve', ($useempty < 0 ? (string) $useempty : '-1'), $morecss); |
|
@@ -9835,12 +9835,12 @@ discard block |
|
|
block discarded – undo |
9835
|
9835
|
{ |
9836
|
9836
|
// phpcs:enable |
9837
|
9837
|
$sql = "SELECT rowid, label"; |
9838
|
|
- $sql .= " FROM " . $this->db->prefix() . "export_model"; |
9839
|
|
- $sql .= " WHERE type = '" . $this->db->escape($type) . "'"; |
|
9838
|
+ $sql .= " FROM ".$this->db->prefix()."export_model"; |
|
9839
|
+ $sql .= " WHERE type = '".$this->db->escape($type)."'"; |
9840
|
9840
|
$sql .= " ORDER BY rowid"; |
9841
|
9841
|
$result = $this->db->query($sql); |
9842
|
9842
|
if ($result) { |
9843
|
|
- print '<select class="flat" id="select_' . $htmlname . '" name="' . $htmlname . '">'; |
|
9843
|
+ print '<select class="flat" id="select_'.$htmlname.'" name="'.$htmlname.'">'; |
9844
|
9844
|
if ($useempty) { |
9845
|
9845
|
print '<option value="-1"> </option>'; |
9846
|
9846
|
} |
|
@@ -9850,9 +9850,9 @@ discard block |
|
|
block discarded – undo |
9850
|
9850
|
while ($i < $num) { |
9851
|
9851
|
$obj = $this->db->fetch_object($result); |
9852
|
9852
|
if ($selected == $obj->rowid) { |
9853
|
|
- print '<option value="' . $obj->rowid . '" selected>'; |
|
9853
|
+ print '<option value="'.$obj->rowid.'" selected>'; |
9854
|
9854
|
} else { |
9855
|
|
- print '<option value="' . $obj->rowid . '">'; |
|
9855
|
+ print '<option value="'.$obj->rowid.'">'; |
9856
|
9856
|
} |
9857
|
9857
|
print $obj->label; |
9858
|
9858
|
print '</option>'; |
|
@@ -9943,8 +9943,8 @@ discard block |
|
|
block discarded – undo |
9943
|
9943
|
$stringforfirstkey .= ' CTL +'; |
9944
|
9944
|
} |
9945
|
9945
|
|
9946
|
|
- $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>'; |
9947
|
|
- $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>'; |
|
9946
|
+ $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>'; |
|
9947
|
+ $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>'; |
9948
|
9948
|
} |
9949
|
9949
|
|
9950
|
9950
|
//print "xx".$previous_ref."x".$next_ref; |
|
@@ -9952,18 +9952,18 @@ discard block |
|
|
block discarded – undo |
9952
|
9952
|
|
9953
|
9953
|
// Right part of banner |
9954
|
9954
|
if ($morehtmlright) { |
9955
|
|
- $ret .= '<div class="inline-block floatleft">' . $morehtmlright . '</div>'; |
|
9955
|
+ $ret .= '<div class="inline-block floatleft">'.$morehtmlright.'</div>'; |
9956
|
9956
|
} |
9957
|
9957
|
|
9958
|
9958
|
if ($previous_ref || $next_ref || $morehtml) { |
9959
|
9959
|
$ret .= '<div class="pagination paginationref"><ul class="right">'; |
9960
|
9960
|
} |
9961
|
9961
|
if ($morehtml && getDolGlobalInt('MAIN_OPTIMIZEFORTEXTBROWSER') < 2) { |
9962
|
|
- $ret .= '<!-- morehtml --><li class="noborder litext' . (($shownav && $previous_ref && $next_ref) ? ' clearbothonsmartphone' : '') . '">' . $morehtml . '</li>'; |
|
9962
|
+ $ret .= '<!-- morehtml --><li class="noborder litext'.(($shownav && $previous_ref && $next_ref) ? ' clearbothonsmartphone' : '').'">'.$morehtml.'</li>'; |
9963
|
9963
|
} |
9964
|
9964
|
if ($shownav && ($previous_ref || $next_ref)) { |
9965
|
|
- $ret .= '<li class="pagination">' . $previous_ref . '</li>'; |
9966
|
|
- $ret .= '<li class="pagination">' . $next_ref . '</li>'; |
|
9965
|
+ $ret .= '<li class="pagination">'.$previous_ref.'</li>'; |
|
9966
|
+ $ret .= '<li class="pagination">'.$next_ref.'</li>'; |
9967
|
9967
|
} |
9968
|
9968
|
if ($previous_ref || $next_ref || $morehtml) { |
9969
|
9969
|
$ret .= '</ul></div>'; |
|
@@ -9978,7 +9978,7 @@ discard block |
|
|
block discarded – undo |
9978
|
9978
|
$morehtmlstatus = $hookmanager->resPrint; |
9979
|
9979
|
} |
9980
|
9980
|
if ($morehtmlstatus) { |
9981
|
|
- $ret .= '<div class="statusref">' . $morehtmlstatus . '</div>'; |
|
9981
|
+ $ret .= '<div class="statusref">'.$morehtmlstatus.'</div>'; |
9982
|
9982
|
} |
9983
|
9983
|
|
9984
|
9984
|
$parameters = array(); |
|
@@ -9992,14 +9992,14 @@ discard block |
|
|
block discarded – undo |
9992
|
9992
|
// Left part of banner |
9993
|
9993
|
if ($morehtmlleft) { |
9994
|
9994
|
if ($conf->browser->layout == 'phone') { |
9995
|
|
- $ret .= '<!-- morehtmlleft --><div class="floatleft">' . $morehtmlleft . '</div>'; |
|
9995
|
+ $ret .= '<!-- morehtmlleft --><div class="floatleft">'.$morehtmlleft.'</div>'; |
9996
|
9996
|
} else { |
9997
|
|
- $ret .= '<!-- morehtmlleft --><div class="inline-block floatleft">' . $morehtmlleft . '</div>'; |
|
9997
|
+ $ret .= '<!-- morehtmlleft --><div class="inline-block floatleft">'.$morehtmlleft.'</div>'; |
9998
|
9998
|
} |
9999
|
9999
|
} |
10000
|
10000
|
|
10001
|
10001
|
//if ($conf->browser->layout == 'phone') $ret.='<div class="clearboth"></div>'; |
10002
|
|
- $ret .= '<div class="inline-block floatleft valignmiddle maxwidth750 marginbottomonly refid' . (($shownav && ($previous_ref || $next_ref)) ? ' refidpadding' : '') . '">'; |
|
10002
|
+ $ret .= '<div class="inline-block floatleft valignmiddle maxwidth750 marginbottomonly refid'.(($shownav && ($previous_ref || $next_ref)) ? ' refidpadding' : '').'">'; |
10003
|
10003
|
|
10004
|
10004
|
// For thirdparty, contact, user, member, the ref is the id, so we show something else |
10005
|
10005
|
if ($object->element == 'societe') { |
|
@@ -10013,7 +10013,7 @@ discard block |
|
|
block discarded – undo |
10013
|
10013
|
|
10014
|
10014
|
if (is_array($arrayoflangcode) && count($arrayoflangcode)) { |
10015
|
10015
|
if (!is_object($extralanguages)) { |
10016
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/class/extralanguages.class.php'; |
|
10016
|
+ include_once DOL_DOCUMENT_ROOT.'/core/class/extralanguages.class.php'; |
10017
|
10017
|
$extralanguages = new ExtraLanguages($this->db); |
10018
|
10018
|
} |
10019
|
10019
|
$extralanguages->fetch_name_extralanguages('societe'); |
|
@@ -10028,29 +10028,29 @@ discard block |
|
|
block discarded – undo |
10028
|
10028
|
if ($object->array_languages['name'][$extralangcode]) { |
10029
|
10029
|
$htmltext .= $object->array_languages['name'][$extralangcode]; |
10030
|
10030
|
} else { |
10031
|
|
- $htmltext .= '<span class="opacitymedium">' . $langs->trans("SwitchInEditModeToAddTranslation") . '</span>'; |
|
10031
|
+ $htmltext .= '<span class="opacitymedium">'.$langs->trans("SwitchInEditModeToAddTranslation").'</span>'; |
10032
|
10032
|
} |
10033
|
10033
|
} |
10034
|
|
- $ret .= '<!-- Show translations of name -->' . "\n"; |
|
10034
|
+ $ret .= '<!-- Show translations of name -->'."\n"; |
10035
|
10035
|
$ret .= $this->textwithpicto('', $htmltext, -1, 'language', 'opacitymedium paddingleft'); |
10036
|
10036
|
} |
10037
|
10037
|
} |
10038
|
10038
|
} elseif ($object->element == 'member') { |
10039
|
10039
|
'@phan-var-force Adherent $object'; |
10040
|
|
- $ret .= $object->ref . '<br>'; |
|
10040
|
+ $ret .= $object->ref.'<br>'; |
10041
|
10041
|
$fullname = $object->getFullName($langs); |
10042
|
10042
|
if ($object->morphy == 'mor' && $object->societe) { |
10043
|
|
- $ret .= dol_htmlentities($object->societe) . ((!empty($fullname) && $object->societe != $fullname) ? ' (' . dol_htmlentities($fullname) . $addgendertxt . ')' : ''); |
|
10043
|
+ $ret .= dol_htmlentities($object->societe).((!empty($fullname) && $object->societe != $fullname) ? ' ('.dol_htmlentities($fullname).$addgendertxt.')' : ''); |
10044
|
10044
|
} else { |
10045
|
|
- $ret .= dol_htmlentities($fullname) . $addgendertxt . ((!empty($object->societe) && $object->societe != $fullname) ? ' (' . dol_htmlentities($object->societe) . ')' : ''); |
|
10045
|
+ $ret .= dol_htmlentities($fullname).$addgendertxt.((!empty($object->societe) && $object->societe != $fullname) ? ' ('.dol_htmlentities($object->societe).')' : ''); |
10046
|
10046
|
} |
10047
|
10047
|
} elseif (in_array($object->element, array('contact', 'user'))) { |
10048
|
|
- $ret .= dol_htmlentities($object->getFullName($langs)) . $addgendertxt; |
|
10048
|
+ $ret .= dol_htmlentities($object->getFullName($langs)).$addgendertxt; |
10049
|
10049
|
} elseif ($object->element == 'usergroup') { |
10050
|
10050
|
$ret .= dol_htmlentities($object->name); |
10051
|
10051
|
} elseif (in_array($object->element, array('action', 'agenda'))) { |
10052
|
10052
|
'@phan-var-force ActionComm $object'; |
10053
|
|
- $ret .= $object->ref . '<br>' . $object->label; |
|
10053
|
+ $ret .= $object->ref.'<br>'.$object->label; |
10054
|
10054
|
} elseif (in_array($object->element, array('adherent_type'))) { |
10055
|
10055
|
$ret .= $object->label; |
10056
|
10056
|
} elseif ($object->element == 'ecm_directories') { |
|
@@ -10103,9 +10103,9 @@ discard block |
|
|
block discarded – undo |
10103
|
10103
|
} |
10104
|
10104
|
|
10105
|
10105
|
// Barcode image @phan-suppress-next-line PhanUndeclaredProperty |
10106
|
|
- $url = DOL_URL_ROOT . '/viewimage.php?modulepart=barcode&generator=' . urlencode($object->barcode_type_coder) . '&code=' . urlencode($object->barcode) . '&encoding=' . urlencode($object->barcode_type_code); |
10107
|
|
- $out = '<!-- url barcode = ' . $url . ' -->'; |
10108
|
|
- $out .= '<img src="' . $url . '"' . ($morecss ? ' class="' . $morecss . '"' : '') . '>'; |
|
10106
|
+ $url = DOL_URL_ROOT.'/viewimage.php?modulepart=barcode&generator='.urlencode($object->barcode_type_coder).'&code='.urlencode($object->barcode).'&encoding='.urlencode($object->barcode_type_code); |
|
10107
|
+ $out = '<!-- url barcode = '.$url.' -->'; |
|
10108
|
+ $out .= '<img src="'.$url.'"'.($morecss ? ' class="'.$morecss.'"' : '').'>'; |
10109
|
10109
|
|
10110
|
10110
|
return $out; |
10111
|
10111
|
} |
|
@@ -10132,7 +10132,7 @@ discard block |
|
|
block discarded – undo |
10132
|
10132
|
global $conf, $langs; |
10133
|
10133
|
|
10134
|
10134
|
$entity = (empty($object->entity) ? $conf->entity : $object->entity); |
10135
|
|
- $id = (empty($object->id) ? $object->rowid : $object->id); // @phan-suppress-current-line PhanUndeclaredProperty (->rowid) |
|
10135
|
+ $id = (empty($object->id) ? $object->rowid : $object->id); // @phan-suppress-current-line PhanUndeclaredProperty (->rowid) |
10136
|
10136
|
|
10137
|
10137
|
$dir = ''; |
10138
|
10138
|
$file = ''; |
|
@@ -10145,28 +10145,28 @@ discard block |
|
|
block discarded – undo |
10145
|
10145
|
if (!empty($object->logo)) { |
10146
|
10146
|
if (dolIsAllowedForPreview($object->logo)) { |
10147
|
10147
|
if ((string) $imagesize == 'mini') { |
10148
|
|
- $file = get_exdir(0, 0, 0, 0, $object, 'thirdparty') . 'logos/' . getImageFileNameForSize($object->logo, '_mini'); // getImageFileNameForSize include the thumbs |
|
10148
|
+ $file = get_exdir(0, 0, 0, 0, $object, 'thirdparty').'logos/'.getImageFileNameForSize($object->logo, '_mini'); // getImageFileNameForSize include the thumbs |
10149
|
10149
|
} elseif ((string) $imagesize == 'small') { |
10150
|
|
- $file = get_exdir(0, 0, 0, 0, $object, 'thirdparty') . 'logos/' . getImageFileNameForSize($object->logo, '_small'); |
|
10150
|
+ $file = get_exdir(0, 0, 0, 0, $object, 'thirdparty').'logos/'.getImageFileNameForSize($object->logo, '_small'); |
10151
|
10151
|
} else { |
10152
|
|
- $file = get_exdir(0, 0, 0, 0, $object, 'thirdparty') . 'logos/' . $object->logo; |
|
10152
|
+ $file = get_exdir(0, 0, 0, 0, $object, 'thirdparty').'logos/'.$object->logo; |
10153
|
10153
|
} |
10154
|
|
- $originalfile = get_exdir(0, 0, 0, 0, $object, 'thirdparty') . 'logos/' . $object->logo; |
|
10154
|
+ $originalfile = get_exdir(0, 0, 0, 0, $object, 'thirdparty').'logos/'.$object->logo; |
10155
|
10155
|
} |
10156
|
10156
|
} |
10157
|
10157
|
$email = $object->email; |
10158
|
10158
|
} elseif ($modulepart == 'contact') { |
10159
|
|
- $dir = $conf->societe->multidir_output[$entity] . '/contact'; |
|
10159
|
+ $dir = $conf->societe->multidir_output[$entity].'/contact'; |
10160
|
10160
|
if (!empty($object->photo)) { |
10161
|
10161
|
if (dolIsAllowedForPreview($object->photo)) { |
10162
|
10162
|
if ((string) $imagesize == 'mini') { |
10163
|
|
- $file = get_exdir(0, 0, 0, 0, $object, 'contact') . 'photos/' . getImageFileNameForSize($object->photo, '_mini'); |
|
10163
|
+ $file = get_exdir(0, 0, 0, 0, $object, 'contact').'photos/'.getImageFileNameForSize($object->photo, '_mini'); |
10164
|
10164
|
} elseif ((string) $imagesize == 'small') { |
10165
|
|
- $file = get_exdir(0, 0, 0, 0, $object, 'contact') . 'photos/' . getImageFileNameForSize($object->photo, '_small'); |
|
10165
|
+ $file = get_exdir(0, 0, 0, 0, $object, 'contact').'photos/'.getImageFileNameForSize($object->photo, '_small'); |
10166
|
10166
|
} else { |
10167
|
|
- $file = get_exdir(0, 0, 0, 0, $object, 'contact') . 'photos/' . $object->photo; |
|
10167
|
+ $file = get_exdir(0, 0, 0, 0, $object, 'contact').'photos/'.$object->photo; |
10168
|
10168
|
} |
10169
|
|
- $originalfile = get_exdir(0, 0, 0, 0, $object, 'contact') . 'photos/' . $object->photo; |
|
10169
|
+ $originalfile = get_exdir(0, 0, 0, 0, $object, 'contact').'photos/'.$object->photo; |
10170
|
10170
|
} |
10171
|
10171
|
} |
10172
|
10172
|
$email = $object->email; |
|
@@ -10176,17 +10176,17 @@ discard block |
|
|
block discarded – undo |
10176
|
10176
|
if (!empty($object->photo)) { |
10177
|
10177
|
if (dolIsAllowedForPreview($object->photo)) { |
10178
|
10178
|
if ((string) $imagesize == 'mini') { |
10179
|
|
- $file = get_exdir(0, 0, 0, 0, $object, 'user') . 'photos/' . getImageFileNameForSize($object->photo, '_mini'); |
|
10179
|
+ $file = get_exdir(0, 0, 0, 0, $object, 'user').'photos/'.getImageFileNameForSize($object->photo, '_mini'); |
10180
|
10180
|
} elseif ((string) $imagesize == 'small') { |
10181
|
|
- $file = get_exdir(0, 0, 0, 0, $object, 'user') . 'photos/' . getImageFileNameForSize($object->photo, '_small'); |
|
10181
|
+ $file = get_exdir(0, 0, 0, 0, $object, 'user').'photos/'.getImageFileNameForSize($object->photo, '_small'); |
10182
|
10182
|
} else { |
10183
|
|
- $file = get_exdir(0, 0, 0, 0, $object, 'user') . 'photos/' . $object->photo; |
|
10183
|
+ $file = get_exdir(0, 0, 0, 0, $object, 'user').'photos/'.$object->photo; |
10184
|
10184
|
} |
10185
|
|
- $originalfile = get_exdir(0, 0, 0, 0, $object, 'user') . 'photos/' . $object->photo; |
|
10185
|
+ $originalfile = get_exdir(0, 0, 0, 0, $object, 'user').'photos/'.$object->photo; |
10186
|
10186
|
} |
10187
|
10187
|
} |
10188
|
10188
|
if (getDolGlobalString('MAIN_OLD_IMAGE_LINKS')) { |
10189
|
|
- $altfile = $object->id . ".jpg"; // For backward compatibility |
|
10189
|
+ $altfile = $object->id.".jpg"; // For backward compatibility |
10190
|
10190
|
} |
10191
|
10191
|
$email = $object->email; |
10192
|
10192
|
$capture = 'user'; |
|
@@ -10195,17 +10195,17 @@ discard block |
|
|
block discarded – undo |
10195
|
10195
|
if (!empty($object->photo)) { |
10196
|
10196
|
if (dolIsAllowedForPreview($object->photo)) { |
10197
|
10197
|
if ((string) $imagesize == 'mini') { |
10198
|
|
- $file = get_exdir(0, 0, 0, 0, $object, 'member') . 'photos/' . getImageFileNameForSize($object->photo, '_mini'); |
|
10198
|
+ $file = get_exdir(0, 0, 0, 0, $object, 'member').'photos/'.getImageFileNameForSize($object->photo, '_mini'); |
10199
|
10199
|
} elseif ((string) $imagesize == 'small') { |
10200
|
|
- $file = get_exdir(0, 0, 0, 0, $object, 'member') . 'photos/' . getImageFileNameForSize($object->photo, '_small'); |
|
10200
|
+ $file = get_exdir(0, 0, 0, 0, $object, 'member').'photos/'.getImageFileNameForSize($object->photo, '_small'); |
10201
|
10201
|
} else { |
10202
|
|
- $file = get_exdir(0, 0, 0, 0, $object, 'member') . 'photos/' . $object->photo; |
|
10202
|
+ $file = get_exdir(0, 0, 0, 0, $object, 'member').'photos/'.$object->photo; |
10203
|
10203
|
} |
10204
|
|
- $originalfile = get_exdir(0, 0, 0, 0, $object, 'member') . 'photos/' . $object->photo; |
|
10204
|
+ $originalfile = get_exdir(0, 0, 0, 0, $object, 'member').'photos/'.$object->photo; |
10205
|
10205
|
} |
10206
|
10206
|
} |
10207
|
10207
|
if (getDolGlobalString('MAIN_OLD_IMAGE_LINKS')) { |
10208
|
|
- $altfile = $object->id . ".jpg"; // For backward compatibility |
|
10208
|
+ $altfile = $object->id.".jpg"; // For backward compatibility |
10209
|
10209
|
} |
10210
|
10210
|
$email = $object->email; |
10211
|
10211
|
$capture = 'user'; |
|
@@ -10231,35 +10231,35 @@ discard block |
|
|
block discarded – undo |
10231
|
10231
|
$ret = ''; |
10232
|
10232
|
|
10233
|
10233
|
if ($dir) { |
10234
|
|
- if ($file && file_exists($dir . "/" . $file)) { |
|
10234
|
+ if ($file && file_exists($dir."/".$file)) { |
10235
|
10235
|
if ($addlinktofullsize) { |
10236
|
|
- $urladvanced = getAdvancedPreviewUrl($modulepart, $originalfile, 0, '&entity=' . $entity); |
|
10236
|
+ $urladvanced = getAdvancedPreviewUrl($modulepart, $originalfile, 0, '&entity='.$entity); |
10237
|
10237
|
if ($urladvanced) { |
10238
|
|
- $ret .= '<a href="' . $urladvanced . '">'; |
|
10238
|
+ $ret .= '<a href="'.$urladvanced.'">'; |
10239
|
10239
|
} else { |
10240
|
|
- $ret .= '<a href="' . DOL_URL_ROOT . '/viewimage.php?modulepart=' . $modulepart . '&entity=' . $entity . '&file=' . urlencode($originalfile) . '&cache=' . $cache . '">'; |
|
10240
|
+ $ret .= '<a href="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$entity.'&file='.urlencode($originalfile).'&cache='.$cache.'">'; |
10241
|
10241
|
} |
10242
|
10242
|
} |
10243
|
|
- $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 . '">'; |
|
10243
|
+ $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.'">'; |
10244
|
10244
|
if ($addlinktofullsize) { |
10245
|
10245
|
$ret .= '</a>'; |
10246
|
10246
|
} |
10247
|
|
- } elseif ($altfile && file_exists($dir . "/" . $altfile)) { |
|
10247
|
+ } elseif ($altfile && file_exists($dir."/".$altfile)) { |
10248
|
10248
|
if ($addlinktofullsize) { |
10249
|
|
- $urladvanced = getAdvancedPreviewUrl($modulepart, $originalfile, 0, '&entity=' . $entity); |
|
10249
|
+ $urladvanced = getAdvancedPreviewUrl($modulepart, $originalfile, 0, '&entity='.$entity); |
10250
|
10250
|
if ($urladvanced) { |
10251
|
|
- $ret .= '<a href="' . $urladvanced . '">'; |
|
10251
|
+ $ret .= '<a href="'.$urladvanced.'">'; |
10252
|
10252
|
} else { |
10253
|
|
- $ret .= '<a href="' . DOL_URL_ROOT . '/viewimage.php?modulepart=' . $modulepart . '&entity=' . $entity . '&file=' . urlencode($originalfile) . '&cache=' . $cache . '">'; |
|
10253
|
+ $ret .= '<a href="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$entity.'&file='.urlencode($originalfile).'&cache='.$cache.'">'; |
10254
|
10254
|
} |
10255
|
10255
|
} |
10256
|
|
- $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 . '">'; |
|
10256
|
+ $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.'">'; |
10257
|
10257
|
if ($addlinktofullsize) { |
10258
|
10258
|
$ret .= '</a>'; |
10259
|
10259
|
} |
10260
|
10260
|
} else { |
10261
|
10261
|
$nophoto = '/public/theme/common/nophoto.png'; |
10262
|
|
- $defaultimg = 'identicon'; // For gravatar |
|
10262
|
+ $defaultimg = 'identicon'; // For gravatar |
10263
|
10263
|
if (in_array($modulepart, array('societe', 'userphoto', 'contact', 'memberphoto'))) { // For modules that need a special image when photo not found |
10264
|
10264
|
if ($modulepart == 'societe' || ($modulepart == 'memberphoto' && !empty($object->morphy) && strpos($object->morphy, 'mor') !== false)) { |
10265
|
10265
|
$nophoto = 'company'; |
|
@@ -10277,13 +10277,13 @@ discard block |
|
|
block discarded – undo |
10277
|
10277
|
if (isModEnabled('gravatar') && $email && empty($noexternsourceoverwrite)) { |
10278
|
10278
|
// see https://gravatar.com/site/implement/images/php/ |
10279
|
10279
|
$ret .= '<!-- Put link to gravatar -->'; |
10280
|
|
- $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 |
|
10280
|
+ $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 |
10281
|
10281
|
} else { |
10282
|
10282
|
if ($nophoto == 'company') { |
10283
|
|
- $ret .= '<div class="divforspanimg valignmiddle center photo' . $modulepart . ($cssclass ? ' ' . $cssclass : '') . '" alt="" ' . ($width ? ' width="' . $width . '"' : '') . ($height ? ' height="' . $height . '"' : '') . '>' . img_picto('', 'company') . '</div>'; |
|
10283
|
+ $ret .= '<div class="divforspanimg valignmiddle center photo'.$modulepart.($cssclass ? ' '.$cssclass : '').'" alt="" '.($width ? ' width="'.$width.'"' : '').($height ? ' height="'.$height.'"' : '').'>'.img_picto('', 'company').'</div>'; |
10284
|
10284
|
//$ret .= '<div class="difforspanimgright"></div>'; |
10285
|
10285
|
} else { |
10286
|
|
- $ret .= '<img class="photo' . $modulepart . ($cssclass ? ' ' . $cssclass : '') . '" alt="" ' . ($width ? ' width="' . $width . '"' : '') . ($height ? ' height="' . $height . '"' : '') . ' src="' . DOL_URL_ROOT . $nophoto . '">'; |
|
10286
|
+ $ret .= '<img class="photo'.$modulepart.($cssclass ? ' '.$cssclass : '').'" alt="" '.($width ? ' width="'.$width.'"' : '').($height ? ' height="'.$height.'"' : '').' src="'.DOL_URL_ROOT.$nophoto.'">'; |
10287
|
10287
|
} |
10288
|
10288
|
} |
10289
|
10289
|
} |
|
@@ -10294,15 +10294,15 @@ discard block |
|
|
block discarded – undo |
10294
|
10294
|
} |
10295
|
10295
|
$ret .= '<table class="nobordernopadding centpercent">'; |
10296
|
10296
|
if ($object->photo) { |
10297
|
|
- $ret .= '<tr><td><input type="checkbox" class="flat photodelete" name="deletephoto" id="photodelete"> <label for="photodelete">' . $langs->trans("Delete") . '</label><br><br></td></tr>'; |
|
10297
|
+ $ret .= '<tr><td><input type="checkbox" class="flat photodelete" name="deletephoto" id="photodelete"> <label for="photodelete">'.$langs->trans("Delete").'</label><br><br></td></tr>'; |
10298
|
10298
|
} |
10299
|
10299
|
$ret .= '<tr><td class="tdoverflow">'; |
10300
|
10300
|
$maxfilesizearray = getMaxFileSizeArray(); |
10301
|
10301
|
$maxmin = $maxfilesizearray['maxmin']; |
10302
|
10302
|
if ($maxmin > 0) { |
10303
|
|
- $ret .= '<input type="hidden" name="MAX_FILE_SIZE" value="' . ($maxmin * 1024) . '">'; // MAX_FILE_SIZE must precede the field type=file |
|
10303
|
+ $ret .= '<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).'">'; // MAX_FILE_SIZE must precede the field type=file |
10304
|
10304
|
} |
10305
|
|
- $ret .= '<input type="file" class="flat maxwidth200onsmartphone" name="photo" id="photoinput" accept="image/*"' . ($capture ? ' capture="' . $capture . '"' : '') . '>'; |
|
10305
|
+ $ret .= '<input type="file" class="flat maxwidth200onsmartphone" name="photo" id="photoinput" accept="image/*"'.($capture ? ' capture="'.$capture.'"' : '').'>'; |
10306
|
10306
|
$ret .= '</td></tr>'; |
10307
|
10307
|
$ret .= '</table>'; |
10308
|
10308
|
} |
|
@@ -10356,38 +10356,38 @@ discard block |
|
|
block discarded – undo |
10356
|
10356
|
if (isModEnabled('multicompany') && $conf->entity == 1 && $user->admin && !$user->entity) { |
10357
|
10357
|
$sql .= ", e.label"; |
10358
|
10358
|
} |
10359
|
|
- $sql .= " FROM " . $this->db->prefix() . "usergroup as ug "; |
|
10359
|
+ $sql .= " FROM ".$this->db->prefix()."usergroup as ug "; |
10360
|
10360
|
if (isModEnabled('multicompany') && $conf->entity == 1 && $user->admin && !$user->entity) { |
10361
|
|
- $sql .= " LEFT JOIN " . $this->db->prefix() . "entity as e ON e.rowid=ug.entity"; |
|
10361
|
+ $sql .= " LEFT JOIN ".$this->db->prefix()."entity as e ON e.rowid=ug.entity"; |
10362
|
10362
|
if ($force_entity) { |
10363
|
|
- $sql .= " WHERE ug.entity IN (0, " . $force_entity . ")"; |
|
10363
|
+ $sql .= " WHERE ug.entity IN (0, ".$force_entity.")"; |
10364
|
10364
|
} else { |
10365
|
10365
|
$sql .= " WHERE ug.entity IS NOT NULL"; |
10366
|
10366
|
} |
10367
|
10367
|
} else { |
10368
|
|
- $sql .= " WHERE ug.entity IN (0, " . $conf->entity . ")"; |
|
10368
|
+ $sql .= " WHERE ug.entity IN (0, ".$conf->entity.")"; |
10369
|
10369
|
} |
10370
|
10370
|
if (is_array($exclude) && $excludeGroups) { |
10371
|
|
- $sql .= " AND ug.rowid NOT IN (" . $this->db->sanitize($excludeGroups) . ")"; |
|
10371
|
+ $sql .= " AND ug.rowid NOT IN (".$this->db->sanitize($excludeGroups).")"; |
10372
|
10372
|
} |
10373
|
10373
|
if (is_array($include) && $includeGroups) { |
10374
|
|
- $sql .= " AND ug.rowid IN (" . $this->db->sanitize($includeGroups) . ")"; |
|
10374
|
+ $sql .= " AND ug.rowid IN (".$this->db->sanitize($includeGroups).")"; |
10375
|
10375
|
} |
10376
|
10376
|
$sql .= " ORDER BY ug.nom ASC"; |
10377
|
10377
|
|
10378
|
|
- dol_syslog(get_class($this) . "::select_dolgroups", LOG_DEBUG); |
|
10378
|
+ dol_syslog(get_class($this)."::select_dolgroups", LOG_DEBUG); |
10379
|
10379
|
$resql = $this->db->query($sql); |
10380
|
10380
|
if ($resql) { |
10381
|
10381
|
// Enhance with select2 |
10382
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
10382
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
10383
|
10383
|
|
10384
|
|
- $out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" id="' . $htmlname . '" name="' . $htmlname . ($multiple ? '[]' : '') . '" ' . ($multiple ? 'multiple' : '') . ' ' . ($disabled ? ' disabled' : '') . '>'; |
|
10384
|
+ $out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" id="'.$htmlname.'" name="'.$htmlname.($multiple ? '[]' : '').'" '.($multiple ? 'multiple' : '').' '.($disabled ? ' disabled' : '').'>'; |
10385
|
10385
|
|
10386
|
10386
|
$num = $this->db->num_rows($resql); |
10387
|
10387
|
$i = 0; |
10388
|
10388
|
if ($num) { |
10389
|
10389
|
if ($show_empty && !$multiple) { |
10390
|
|
- $out .= '<option value="-1"' . (in_array(-1, $selected) ? ' selected' : '') . '> </option>' . "\n"; |
|
10390
|
+ $out .= '<option value="-1"'.(in_array(-1, $selected) ? ' selected' : '').'> </option>'."\n"; |
10391
|
10391
|
} |
10392
|
10392
|
|
10393
|
10393
|
while ($i < $num) { |
|
@@ -10400,11 +10400,11 @@ discard block |
|
|
block discarded – undo |
10400
|
10400
|
$label = $obj->name; |
10401
|
10401
|
$labelhtml = $obj->name; |
10402
|
10402
|
if (isModEnabled('multicompany') && !getDolGlobalInt('MULTICOMPANY_TRANSVERSE_MODE') && $conf->entity == 1) { |
10403
|
|
- $label .= " (" . $obj->label . ")"; |
10404
|
|
- $labelhtml .= ' <span class="opacitymedium">(' . $obj->label . ')</span>'; |
|
10403
|
+ $label .= " (".$obj->label.")"; |
|
10404
|
+ $labelhtml .= ' <span class="opacitymedium">('.$obj->label.')</span>'; |
10405
|
10405
|
} |
10406
|
10406
|
|
10407
|
|
- $out .= '<option value="' . $obj->rowid . '"'; |
|
10407
|
+ $out .= '<option value="'.$obj->rowid.'"'; |
10408
|
10408
|
if ($disableline) { |
10409
|
10409
|
$out .= ' disabled'; |
10410
|
10410
|
} |
|
@@ -10420,9 +10420,9 @@ discard block |
|
|
block discarded – undo |
10420
|
10420
|
} |
10421
|
10421
|
} else { |
10422
|
10422
|
if ($show_empty) { |
10423
|
|
- $out .= '<option value="-1"' . (in_array(-1, $selected) ? ' selected' : '') . '></option>' . "\n"; |
|
10423
|
+ $out .= '<option value="-1"'.(in_array(-1, $selected) ? ' selected' : '').'></option>'."\n"; |
10424
|
10424
|
} |
10425
|
|
- $out .= '<option value="" disabled>' . $langs->trans("NoUserGroupDefined") . '</option>'; |
|
10425
|
+ $out .= '<option value="" disabled>'.$langs->trans("NoUserGroupDefined").'</option>'; |
10426
|
10426
|
} |
10427
|
10427
|
$out .= '</select>'; |
10428
|
10428
|
|
|
@@ -10466,25 +10466,25 @@ discard block |
|
|
block discarded – undo |
10466
|
10466
|
$out = ''; |
10467
|
10467
|
|
10468
|
10468
|
if (!empty($conf->use_javascript_ajax)) { |
10469
|
|
- $out .= '<div class="inline-block checkallactions"><input type="checkbox" id="' . $cssclass . 's" name="' . $cssclass . 's" class="checkallactions"></div>'; |
|
10469
|
+ $out .= '<div class="inline-block checkallactions"><input type="checkbox" id="'.$cssclass.'s" name="'.$cssclass.'s" class="checkallactions"></div>'; |
10470
|
10470
|
} |
10471
|
|
- $out .= '<script nonce="' . getNonce() . '"> |
|
10471
|
+ $out .= '<script nonce="'.getNonce().'"> |
10472
|
10472
|
$(document).ready(function() { |
10473
|
|
- $("#' . $cssclass . 's").click(function() { |
|
10473
|
+ $("#' . $cssclass.'s").click(function() { |
10474
|
10474
|
if($(this).is(\':checked\')){ |
10475
|
|
- console.log("We check all ' . $cssclass . ' and trigger the change method"); |
10476
|
|
- $(".' . $cssclass . '").prop(\'checked\', true).trigger(\'change\'); |
|
10475
|
+ console.log("We check all ' . $cssclass.' and trigger the change method"); |
|
10476
|
+ $(".' . $cssclass.'").prop(\'checked\', true).trigger(\'change\'); |
10477
|
10477
|
} |
10478
|
10478
|
else |
10479
|
10479
|
{ |
10480
|
10480
|
console.log("We uncheck all"); |
10481
|
|
- $(".' . $cssclass . '").prop(\'checked\', false).trigger(\'change\'); |
|
10481
|
+ $(".' . $cssclass.'").prop(\'checked\', false).trigger(\'change\'); |
10482
|
10482
|
}' . "\n"; |
10483
|
10483
|
if ($calljsfunction) { |
10484
|
|
- $out .= 'if (typeof initCheckForSelect == \'function\') { initCheckForSelect(0, "' . $massactionname . '", "' . $cssclass . '"); } else { console.log("No function initCheckForSelect found. Call won\'t be done."); }'; |
|
10484
|
+ $out .= 'if (typeof initCheckForSelect == \'function\') { initCheckForSelect(0, "'.$massactionname.'", "'.$cssclass.'"); } else { console.log("No function initCheckForSelect found. Call won\'t be done."); }'; |
10485
|
10485
|
} |
10486
|
10486
|
$out .= ' }); |
10487
|
|
- $(".' . $cssclass . '").change(function() { |
|
10487
|
+ $(".' . $cssclass.'").change(function() { |
10488
|
10488
|
$(this).closest("tr").toggleClass("highlight", this.checked); |
10489
|
10489
|
}); |
10490
|
10490
|
}); |
|
@@ -10529,67 +10529,67 @@ discard block |
|
|
block discarded – undo |
10529
|
10529
|
global $langs, $user; |
10530
|
10530
|
|
10531
|
10531
|
$out = ''; |
10532
|
|
- $sql = "SELECT rowid, label FROM " . $this->db->prefix() . "c_exp_tax_cat WHERE active = 1"; |
10533
|
|
- $sql .= " AND entity IN (0," . getEntity('exp_tax_cat') . ")"; |
|
10532
|
+ $sql = "SELECT rowid, label FROM ".$this->db->prefix()."c_exp_tax_cat WHERE active = 1"; |
|
10533
|
+ $sql .= " AND entity IN (0,".getEntity('exp_tax_cat').")"; |
10534
|
10534
|
if (!empty($excludeid)) { |
10535
|
|
- $sql .= " AND rowid NOT IN (" . $this->db->sanitize(implode(',', $excludeid)) . ")"; |
|
10535
|
+ $sql .= " AND rowid NOT IN (".$this->db->sanitize(implode(',', $excludeid)).")"; |
10536
|
10536
|
} |
10537
|
10537
|
$sql .= " ORDER BY label"; |
10538
|
10538
|
|
10539
|
10539
|
$resql = $this->db->query($sql); |
10540
|
10540
|
if ($resql) { |
10541
|
|
- $out = '<select id="select_' . $htmlname . '" name="' . $htmlname . '" class="' . $htmlname . ' flat minwidth75imp maxwidth200">'; |
|
10541
|
+ $out = '<select id="select_'.$htmlname.'" name="'.$htmlname.'" class="'.$htmlname.' flat minwidth75imp maxwidth200">'; |
10542
|
10542
|
if ($useempty) { |
10543
|
10543
|
$out .= '<option value="0"> </option>'; |
10544
|
10544
|
} |
10545
|
10545
|
|
10546
|
10546
|
while ($obj = $this->db->fetch_object($resql)) { |
10547
|
|
- $out .= '<option ' . ($selected == $obj->rowid ? 'selected="selected"' : '') . ' value="' . $obj->rowid . '">' . $langs->trans($obj->label) . '</option>'; |
|
10547
|
+ $out .= '<option '.($selected == $obj->rowid ? 'selected="selected"' : '').' value="'.$obj->rowid.'">'.$langs->trans($obj->label).'</option>'; |
10548
|
10548
|
} |
10549
|
10549
|
$out .= '</select>'; |
10550
|
|
- $out .= ajax_combobox('select_' . $htmlname); |
|
10550
|
+ $out .= ajax_combobox('select_'.$htmlname); |
10551
|
10551
|
|
10552
|
10552
|
if (!empty($htmlname) && $user->admin && $info_admin) { |
10553
|
|
- $out .= ' ' . info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); |
|
10553
|
+ $out .= ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); |
10554
|
10554
|
} |
10555
|
10555
|
|
10556
|
10556
|
if (!empty($target)) { |
10557
|
|
- $sql = "SELECT c.id FROM " . $this->db->prefix() . "c_type_fees as c WHERE c.code = 'EX_KME' AND c.active = 1"; |
|
10557
|
+ $sql = "SELECT c.id FROM ".$this->db->prefix()."c_type_fees as c WHERE c.code = 'EX_KME' AND c.active = 1"; |
10558
|
10558
|
$resql = $this->db->query($sql); |
10559
|
10559
|
if ($resql) { |
10560
|
10560
|
if ($this->db->num_rows($resql) > 0) { |
10561
|
10561
|
$obj = $this->db->fetch_object($resql); |
10562
|
|
- $out .= '<script nonce="' . getNonce() . '"> |
|
10562
|
+ $out .= '<script nonce="'.getNonce().'"> |
10563
|
10563
|
$(function() { |
10564
|
|
- $("select[name=' . $target . ']").on("change", function() { |
|
10564
|
+ $("select[name=' . $target.']").on("change", function() { |
10565
|
10565
|
var current_val = $(this).val(); |
10566
|
|
- if (current_val == ' . $obj->id . ') {'; |
|
10566
|
+ if (current_val == ' . $obj->id.') {'; |
10567
|
10567
|
if (!empty($default_selected) || !empty($selected)) { |
10568
|
|
- $out .= '$("select[name=' . $htmlname . ']").val("' . ($default_selected > 0 ? $default_selected : $selected) . '");'; |
|
10568
|
+ $out .= '$("select[name='.$htmlname.']").val("'.($default_selected > 0 ? $default_selected : $selected).'");'; |
10569
|
10569
|
} |
10570
|
10570
|
|
10571
|
10571
|
$out .= ' |
10572
|
|
- $("select[name=' . $htmlname . ']").change(); |
|
10572
|
+ $("select[name=' . $htmlname.']").change(); |
10573
|
10573
|
} |
10574
|
10574
|
}); |
10575
|
10575
|
|
10576
|
|
- $("select[name=' . $htmlname . ']").change(function() { |
|
10576
|
+ $("select[name=' . $htmlname.']").change(function() { |
10577
|
10577
|
|
10578
|
|
- if ($("select[name=' . $target . ']").val() == ' . $obj->id . ') { |
|
10578
|
+ if ($("select[name=' . $target.']").val() == '.$obj->id.') { |
10579
|
10579
|
// get price of kilometer to fill the unit price |
10580
|
10580
|
$.ajax({ |
10581
|
10581
|
method: "POST", |
10582
|
10582
|
dataType: "json", |
10583
|
|
- data: { fk_c_exp_tax_cat: $(this).val(), token: \'' . currentToken() . '\' }, |
10584
|
|
- url: "' . (DOL_URL_ROOT . '/expensereport/ajax/ajaxik.php?' . implode('&', $params)) . '", |
|
10583
|
+ data: { fk_c_exp_tax_cat: $(this).val(), token: \'' . currentToken().'\' }, |
|
10584
|
+ url: "' . (DOL_URL_ROOT.'/expensereport/ajax/ajaxik.php?'.implode('&', $params)).'", |
10585
|
10585
|
}).done(function( data, textStatus, jqXHR ) { |
10586
|
10586
|
console.log(data); |
10587
|
10587
|
if (typeof data.up != "undefined") { |
10588
|
10588
|
$("input[name=value_unit]").val(data.up); |
10589
|
|
- $("select[name=' . $htmlname . ']").attr("title", data.title); |
|
10589
|
+ $("select[name=' . $htmlname.']").attr("title", data.title); |
10590
|
10590
|
} else { |
10591
|
10591
|
$("input[name=value_unit]").val(""); |
10592
|
|
- $("select[name=' . $htmlname . ']").attr("title", ""); |
|
10592
|
+ $("select[name=' . $htmlname.']").attr("title", ""); |
10593
|
10593
|
} |
10594
|
10594
|
}); |
10595
|
10595
|
} |
|
@@ -10619,18 +10619,18 @@ discard block |
|
|
block discarded – undo |
10619
|
10619
|
global $conf, $langs; |
10620
|
10620
|
|
10621
|
10621
|
$out = ''; |
10622
|
|
- $sql = "SELECT rowid, range_ik FROM " . $this->db->prefix() . "c_exp_tax_range"; |
10623
|
|
- $sql .= " WHERE entity = " . $conf->entity . " AND active = 1"; |
|
10622
|
+ $sql = "SELECT rowid, range_ik FROM ".$this->db->prefix()."c_exp_tax_range"; |
|
10623
|
+ $sql .= " WHERE entity = ".$conf->entity." AND active = 1"; |
10624
|
10624
|
|
10625
|
10625
|
$resql = $this->db->query($sql); |
10626
|
10626
|
if ($resql) { |
10627
|
|
- $out = '<select id="select_' . $htmlname . '" name="' . $htmlname . '" class="' . $htmlname . ' flat minwidth75imp">'; |
|
10627
|
+ $out = '<select id="select_'.$htmlname.'" name="'.$htmlname.'" class="'.$htmlname.' flat minwidth75imp">'; |
10628
|
10628
|
if ($useempty) { |
10629
|
10629
|
$out .= '<option value="0"></option>'; |
10630
|
10630
|
} |
10631
|
10631
|
|
10632
|
10632
|
while ($obj = $this->db->fetch_object($resql)) { |
10633
|
|
- $out .= '<option ' . ($selected == $obj->rowid ? 'selected="selected"' : '') . ' value="' . $obj->rowid . '">' . price($obj->range_ik, 0, $langs, 1, 0) . '</option>'; |
|
10633
|
+ $out .= '<option '.($selected == $obj->rowid ? 'selected="selected"' : '').' value="'.$obj->rowid.'">'.price($obj->range_ik, 0, $langs, 1, 0).'</option>'; |
10634
|
10634
|
} |
10635
|
10635
|
$out .= '</select>'; |
10636
|
10636
|
} else { |
|
@@ -10661,12 +10661,12 @@ discard block |
|
|
block discarded – undo |
10661
|
10661
|
|
10662
|
10662
|
$resql = $this->db->query($sql); |
10663
|
10663
|
if ($resql) { |
10664
|
|
- $out = '<select id="select_' . $htmlname . '" name="' . $htmlname . '" class="' . $htmlname . ' flat minwidth75imp">'; |
|
10664
|
+ $out = '<select id="select_'.$htmlname.'" name="'.$htmlname.'" class="'.$htmlname.' flat minwidth75imp">'; |
10665
|
10665
|
if ($useempty) { |
10666
|
10666
|
$out .= '<option value="0"></option>'; |
10667
|
10667
|
} |
10668
|
10668
|
if ($allchoice) { |
10669
|
|
- $out .= '<option value="-1">' . $langs->trans('AllExpenseReport') . '</option>'; |
|
10669
|
+ $out .= '<option value="-1">'.$langs->trans('AllExpenseReport').'</option>'; |
10670
|
10670
|
} |
10671
|
10671
|
|
10672
|
10672
|
$field = 'code'; |
|
@@ -10676,7 +10676,7 @@ discard block |
|
|
block discarded – undo |
10676
|
10676
|
|
10677
|
10677
|
while ($obj = $this->db->fetch_object($resql)) { |
10678
|
10678
|
$key = $langs->trans($obj->code); |
10679
|
|
- $out .= '<option ' . ($selected == $obj->{$field} ? 'selected="selected"' : '') . ' value="' . $obj->{$field} . '">' . ($key != $obj->code ? $key : $obj->label) . '</option>'; |
|
10679
|
+ $out .= '<option '.($selected == $obj->{$field} ? 'selected="selected"' : '').' value="'.$obj->{$field}.'">'.($key != $obj->code ? $key : $obj->label).'</option>'; |
10680
|
10680
|
} |
10681
|
10681
|
$out .= '</select>'; |
10682
|
10682
|
|
|
@@ -10710,7 +10710,7 @@ discard block |
|
|
block discarded – undo |
10710
|
10710
|
{ |
10711
|
10711
|
global $user, $conf, $langs; |
10712
|
10712
|
|
10713
|
|
- require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; |
|
10713
|
+ require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; |
10714
|
10714
|
|
10715
|
10715
|
if (is_null($usertofilter)) { |
10716
|
10716
|
$usertofilter = $user; |
|
@@ -10734,10 +10734,10 @@ discard block |
|
|
block discarded – undo |
10734
|
10734
|
$sql = "SELECT f.rowid, f.ref as fref, 'nolabel' as flabel, p.rowid as pid, f.ref, |
10735
|
10735
|
p.title, p.fk_soc, p.fk_statut, p.public,"; |
10736
|
10736
|
$sql .= ' s.nom as name'; |
10737
|
|
- $sql .= ' FROM ' . $this->db->prefix() . 'projet as p'; |
10738
|
|
- $sql .= ' LEFT JOIN ' . $this->db->prefix() . 'societe as s ON s.rowid = p.fk_soc,'; |
10739
|
|
- $sql .= ' ' . $this->db->prefix() . 'facture as f'; |
10740
|
|
- $sql .= " WHERE p.entity IN (" . getEntity('project') . ")"; |
|
10737
|
+ $sql .= ' FROM '.$this->db->prefix().'projet as p'; |
|
10738
|
+ $sql .= ' LEFT JOIN '.$this->db->prefix().'societe as s ON s.rowid = p.fk_soc,'; |
|
10739
|
+ $sql .= ' '.$this->db->prefix().'facture as f'; |
|
10740
|
+ $sql .= " WHERE p.entity IN (".getEntity('project').")"; |
10741
|
10741
|
$sql .= " AND f.fk_projet = p.rowid AND f.fk_statut=0"; //Brouillons seulement |
10742
|
10742
|
//if ($projectsListId) $sql.= " AND p.rowid IN (".$this->db->sanitize($projectsListId).")"; |
10743
|
10743
|
//if ($socid == 0) $sql.= " AND (p.fk_soc=0 OR p.fk_soc IS NULL)"; |
|
@@ -10748,14 +10748,14 @@ discard block |
|
|
block discarded – undo |
10748
|
10748
|
if ($resql) { |
10749
|
10749
|
// Use select2 selector |
10750
|
10750
|
if (!empty($conf->use_javascript_ajax)) { |
10751
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
10751
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
10752
|
10752
|
$comboenhancement = ajax_combobox($htmlname, array(), 0, $forcefocus); |
10753
|
10753
|
$out .= $comboenhancement; |
10754
|
10754
|
$morecss = 'minwidth200imp maxwidth500'; |
10755
|
10755
|
} |
10756
|
10756
|
|
10757
|
10757
|
if (empty($option_only)) { |
10758
|
|
- $out .= '<select class="valignmiddle flat' . ($morecss ? ' ' . $morecss : '') . '"' . ($disabled ? ' disabled="disabled"' : '') . ' id="' . $htmlname . '" name="' . $htmlname . '">'; |
|
10758
|
+ $out .= '<select class="valignmiddle flat'.($morecss ? ' '.$morecss : '').'"'.($disabled ? ' disabled="disabled"' : '').' id="'.$htmlname.'" name="'.$htmlname.'">'; |
10759
|
10759
|
} |
10760
|
10760
|
if (!empty($show_empty)) { |
10761
|
10761
|
$out .= '<option value="0" class="optiongrey">'; |
|
@@ -10785,33 +10785,33 @@ discard block |
|
|
block discarded – undo |
10785
|
10785
|
if ($showproject == 'all') { |
10786
|
10786
|
$labeltoshow .= dol_trunc($obj->ref, 18); // Invoice ref |
10787
|
10787
|
if ($obj->name) { |
10788
|
|
- $labeltoshow .= ' - ' . $obj->name; // Soc name |
|
10788
|
+ $labeltoshow .= ' - '.$obj->name; // Soc name |
10789
|
10789
|
} |
10790
|
10790
|
|
10791
|
10791
|
$disabled = 0; |
10792
|
10792
|
if ($obj->fk_statut == Project::STATUS_DRAFT) { |
10793
|
10793
|
$disabled = 1; |
10794
|
|
- $labeltoshow .= ' - ' . $langs->trans("Draft"); |
|
10794
|
+ $labeltoshow .= ' - '.$langs->trans("Draft"); |
10795
|
10795
|
} elseif ($obj->fk_statut == Project::STATUS_CLOSED) { |
10796
|
10796
|
if ($discard_closed == 2) { |
10797
|
10797
|
$disabled = 1; |
10798
|
10798
|
} |
10799
|
|
- $labeltoshow .= ' - ' . $langs->trans("Closed"); |
|
10799
|
+ $labeltoshow .= ' - '.$langs->trans("Closed"); |
10800
|
10800
|
} elseif ($socid > 0 && (!empty($obj->fk_soc) && $obj->fk_soc != $socid)) { |
10801
|
10801
|
$disabled = 1; |
10802
|
|
- $labeltoshow .= ' - ' . $langs->trans("LinkedToAnotherCompany"); |
|
10802
|
+ $labeltoshow .= ' - '.$langs->trans("LinkedToAnotherCompany"); |
10803
|
10803
|
} |
10804
|
10804
|
} |
10805
|
10805
|
|
10806
|
10806
|
if (!empty($selected) && $selected == $obj->rowid) { |
10807
|
|
- $out .= '<option value="' . $obj->rowid . '" selected'; |
|
10807
|
+ $out .= '<option value="'.$obj->rowid.'" selected'; |
10808
|
10808
|
//if ($disabled) $out.=' disabled'; // with select2, field can't be preselected if disabled |
10809
|
|
- $out .= '>' . $labeltoshow . '</option>'; |
|
10809
|
+ $out .= '>'.$labeltoshow.'</option>'; |
10810
|
10810
|
} else { |
10811
|
10811
|
if ($hideunselectables && $disabled && ($selected != $obj->rowid)) { |
10812
|
10812
|
$resultat = ''; |
10813
|
10813
|
} else { |
10814
|
|
- $resultat = '<option value="' . $obj->rowid . '"'; |
|
10814
|
+ $resultat = '<option value="'.$obj->rowid.'"'; |
10815
|
10815
|
if ($disabled) { |
10816
|
10816
|
$resultat .= ' disabled'; |
10817
|
10817
|
} |
|
@@ -10863,22 +10863,22 @@ discard block |
|
|
block discarded – undo |
10863
|
10863
|
|
10864
|
10864
|
$sql = 'SELECT f.rowid, f.entity, f.titre as title, f.suspended, f.fk_soc'; |
10865
|
10865
|
//$sql.= ', el.fk_source'; |
10866
|
|
- $sql .= ' FROM ' . MAIN_DB_PREFIX . 'facture_rec as f'; |
10867
|
|
- $sql .= " WHERE f.entity IN (" . getEntity('invoice') . ")"; |
|
10866
|
+ $sql .= ' FROM '.MAIN_DB_PREFIX.'facture_rec as f'; |
|
10867
|
+ $sql .= " WHERE f.entity IN (".getEntity('invoice').")"; |
10868
|
10868
|
$sql .= " ORDER BY f.titre ASC"; |
10869
|
10869
|
|
10870
|
10870
|
$resql = $this->db->query($sql); |
10871
|
10871
|
if ($resql) { |
10872
|
10872
|
// Use select2 selector |
10873
|
10873
|
if (!empty($conf->use_javascript_ajax)) { |
10874
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
10874
|
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
10875
|
10875
|
$comboenhancement = ajax_combobox($htmlname, array(), 0, $forcefocus); |
10876
|
10876
|
$out .= $comboenhancement; |
10877
|
10877
|
$morecss = 'minwidth200imp maxwidth500'; |
10878
|
10878
|
} |
10879
|
10879
|
|
10880
|
10880
|
if (empty($option_only)) { |
10881
|
|
- $out .= '<select class="valignmiddle flat' . ($morecss ? ' ' . $morecss : '') . '"' . ($disabled ? ' disabled="disabled"' : '') . ' id="' . $htmlname . '" name="' . $htmlname . '">'; |
|
10881
|
+ $out .= '<select class="valignmiddle flat'.($morecss ? ' '.$morecss : '').'"'.($disabled ? ' disabled="disabled"' : '').' id="'.$htmlname.'" name="'.$htmlname.'">'; |
10882
|
10882
|
} |
10883
|
10883
|
if (!empty($show_empty)) { |
10884
|
10884
|
$out .= '<option value="0" class="optiongrey">'; |
|
@@ -10897,19 +10897,19 @@ discard block |
|
|
block discarded – undo |
10897
|
10897
|
$disabled = 0; |
10898
|
10898
|
if (!empty($obj->suspended)) { |
10899
|
10899
|
$disabled = 1; |
10900
|
|
- $labeltoshow .= ' - ' . $langs->trans("Closed"); |
|
10900
|
+ $labeltoshow .= ' - '.$langs->trans("Closed"); |
10901
|
10901
|
} |
10902
|
10902
|
|
10903
|
10903
|
|
10904
|
10904
|
if (!empty($selected) && $selected == $obj->rowid) { |
10905
|
|
- $out .= '<option value="' . $obj->rowid . '" selected'; |
|
10905
|
+ $out .= '<option value="'.$obj->rowid.'" selected'; |
10906
|
10906
|
//if ($disabled) $out.=' disabled'; // with select2, field can't be preselected if disabled |
10907
|
|
- $out .= '>' . $labeltoshow . '</option>'; |
|
10907
|
+ $out .= '>'.$labeltoshow.'</option>'; |
10908
|
10908
|
} else { |
10909
|
10909
|
if ($disabled && ($selected != $obj->rowid)) { |
10910
|
10910
|
$resultat = ''; |
10911
|
10911
|
} else { |
10912
|
|
- $resultat = '<option value="' . $obj->rowid . '"'; |
|
10912
|
+ $resultat = '<option value="'.$obj->rowid.'"'; |
10913
|
10913
|
if ($disabled) { |
10914
|
10914
|
$resultat .= ' disabled'; |
10915
|
10915
|
} |
|
@@ -10949,14 +10949,14 @@ discard block |
|
|
block discarded – undo |
10949
|
10949
|
global $langs; |
10950
|
10950
|
|
10951
|
10951
|
if ($search_component_params_hidden != '' && !preg_match('/^\(.*\)$/', $search_component_params_hidden)) { // If $search_component_params_hidden does not start and end with () |
10952
|
|
- $search_component_params_hidden = '(' . $search_component_params_hidden . ')'; |
|
10952
|
+ $search_component_params_hidden = '('.$search_component_params_hidden.')'; |
10953
|
10953
|
} |
10954
|
10954
|
|
10955
|
10955
|
$ret = ''; |
10956
|
10956
|
|
10957
|
10957
|
$ret .= '<div class="divadvancedsearchfieldcomp centpercent inline-block">'; |
10958
|
10958
|
$ret .= '<a href="#" class="dropdownsearch-toggle unsetcolor">'; |
10959
|
|
- $ret .= '<span class="fas fa-filter linkobject boxfilter paddingright pictofixedwidth" title="' . dol_escape_htmltag($langs->trans("Filters")) . '" id="idsubimgproductdistribution"></span>'; |
|
10959
|
+ $ret .= '<span class="fas fa-filter linkobject boxfilter paddingright pictofixedwidth" title="'.dol_escape_htmltag($langs->trans("Filters")).'" id="idsubimgproductdistribution"></span>'; |
10960
|
10960
|
$ret .= '</a>'; |
10961
|
10961
|
|
10962
|
10962
|
$ret .= '<div class="divadvancedsearchfieldcompinput inline-block minwidth500 maxwidth300onsmartphone">'; |
|
@@ -11000,29 +11000,29 @@ discard block |
|
|
block discarded – undo |
11000
|
11000
|
$ret .= '<input type="hidden" name="show_search_component_params_hidden" value="1">'; |
11001
|
11001
|
} |
11002
|
11002
|
$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%')) -->"; |
11003
|
|
- $ret .= '<input type="hidden" id="search_component_params_hidden" name="search_component_params_hidden" value="' . dol_escape_htmltag($search_component_params_hidden) . '">'; |
|
11003
|
+ $ret .= '<input type="hidden" id="search_component_params_hidden" name="search_component_params_hidden" value="'.dol_escape_htmltag($search_component_params_hidden).'">'; |
11004
|
11004
|
// $ret .= "<!-- sql= ".forgeSQLFromUniversalSearchCriteria($search_component_params_hidden, $errormessage)." -->"; |
11005
|
11005
|
|
11006
|
11006
|
// For compatibility with forms that show themself the search criteria in addition of this component, we output these fields |
11007
|
11007
|
foreach ($arrayofcriterias as $criteria) { |
11008
|
11008
|
foreach ($criteria as $criteriafamilykey => $criteriafamilyval) { |
11009
|
|
- if (in_array('search_' . $criteriafamilykey, $arrayofinputfieldsalreadyoutput)) { |
|
11009
|
+ if (in_array('search_'.$criteriafamilykey, $arrayofinputfieldsalreadyoutput)) { |
11010
|
11010
|
continue; |
11011
|
11011
|
} |
11012
|
11012
|
if (in_array($criteriafamilykey, array('rowid', 'ref_ext', 'entity', 'extraparams'))) { |
11013
|
11013
|
continue; |
11014
|
11014
|
} |
11015
|
11015
|
if (in_array($criteriafamilyval['type'], array('date', 'datetime', 'timestamp'))) { |
11016
|
|
- $ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_start">'; |
11017
|
|
- $ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_startyear">'; |
11018
|
|
- $ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_startmonth">'; |
11019
|
|
- $ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_startday">'; |
11020
|
|
- $ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_end">'; |
11021
|
|
- $ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_endyear">'; |
11022
|
|
- $ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_endmonth">'; |
11023
|
|
- $ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_endday">'; |
|
11016
|
+ $ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_start">'; |
|
11017
|
+ $ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_startyear">'; |
|
11018
|
+ $ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_startmonth">'; |
|
11019
|
+ $ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_startday">'; |
|
11020
|
+ $ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_end">'; |
|
11021
|
+ $ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_endyear">'; |
|
11022
|
+ $ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_endmonth">'; |
|
11023
|
+ $ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_endday">'; |
11024
|
11024
|
} else { |
11025
|
|
- $ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '">'; |
|
11025
|
+ $ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'">'; |
11026
|
11026
|
} |
11027
|
11027
|
} |
11028
|
11028
|
} |
|
@@ -11030,7 +11030,7 @@ discard block |
|
|
block discarded – undo |
11030
|
11030
|
$ret .= '</div>'; |
11031
|
11031
|
|
11032
|
11032
|
$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"; |
11033
|
|
- $ret .= '<input type="text" placeholder="' . $langs->trans("Filters") . '" id="search_component_params_input" name="search_component_params_input" class="noborderbottom search_component_input" value="">'; |
|
11033
|
+ $ret .= '<input type="text" placeholder="'.$langs->trans("Filters").'" id="search_component_params_input" name="search_component_params_input" class="noborderbottom search_component_input" value="">'; |
11034
|
11034
|
|
11035
|
11035
|
$ret .= '</div>'; |
11036
|
11036
|
$ret .= '</div>'; |
|
@@ -11104,7 +11104,7 @@ discard block |
|
|
block discarded – undo |
11104
|
11104
|
|
11105
|
11105
|
$TModels = array(); |
11106
|
11106
|
|
11107
|
|
- include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php'; |
|
11107
|
+ include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; |
11108
|
11108
|
$formmail = new FormMail($this->db); |
11109
|
11109
|
$result = $formmail->fetchAllEMailTemplate($modelType, $user, $langs); |
11110
|
11110
|
|
|
@@ -11117,17 +11117,17 @@ discard block |
|
|
block discarded – undo |
11117
|
11117
|
} |
11118
|
11118
|
} |
11119
|
11119
|
|
11120
|
|
- $retstring .= '<select class="flat" id="select_' . $prefix . 'model_mail" name="' . $prefix . 'model_mail">'; |
|
11120
|
+ $retstring .= '<select class="flat" id="select_'.$prefix.'model_mail" name="'.$prefix.'model_mail">'; |
11121
|
11121
|
|
11122
|
11122
|
foreach ($TModels as $id_model => $label_model) { |
11123
|
|
- $retstring .= '<option value="' . $id_model . '"'; |
11124
|
|
- $retstring .= ">" . $label_model . "</option>"; |
|
11123
|
+ $retstring .= '<option value="'.$id_model.'"'; |
|
11124
|
+ $retstring .= ">".$label_model."</option>"; |
11125
|
11125
|
} |
11126
|
11126
|
|
11127
|
11127
|
$retstring .= "</select>"; |
11128
|
11128
|
|
11129
|
11129
|
if ($addjscombo) { |
11130
|
|
- $retstring .= ajax_combobox('select_' . $prefix . 'model_mail'); |
|
11130
|
+ $retstring .= ajax_combobox('select_'.$prefix.'model_mail'); |
11131
|
11131
|
} |
11132
|
11132
|
|
11133
|
11133
|
return $retstring; |
|
@@ -11178,16 +11178,16 @@ discard block |
|
|
block discarded – undo |
11178
|
11178
|
|
11179
|
11179
|
foreach ($buttons as $button) { |
11180
|
11180
|
$addclass = empty($button['addclass']) ? '' : $button['addclass']; |
11181
|
|
- $retstring .= '<input type="submit" class="button button-' . $button['name'] . ($morecss ? ' ' . $morecss : '') . ' ' . $addclass . '" name="' . $button['name'] . '" value="' . dol_escape_htmltag($langs->trans($button['label_key'])) . '">'; |
|
11181
|
+ $retstring .= '<input type="submit" class="button button-'.$button['name'].($morecss ? ' '.$morecss : '').' '.$addclass.'" name="'.$button['name'].'" value="'.dol_escape_htmltag($langs->trans($button['label_key'])).'">'; |
11182
|
11182
|
} |
11183
|
11183
|
$retstring .= $withoutdiv ? '' : '</div>'; |
11184
|
11184
|
|
11185
|
11185
|
if ($dol_openinpopup) { |
11186
|
|
- $retstring .= '<!-- buttons are shown into a $dol_openinpopup=' . dol_escape_htmltag($dol_openinpopup) . ' context, so we enable the close of dialog on cancel -->' . "\n"; |
11187
|
|
- $retstring .= '<script nonce="' . getNonce() . '">'; |
|
11186
|
+ $retstring .= '<!-- buttons are shown into a $dol_openinpopup='.dol_escape_htmltag($dol_openinpopup).' context, so we enable the close of dialog on cancel -->'."\n"; |
|
11187
|
+ $retstring .= '<script nonce="'.getNonce().'">'; |
11188
|
11188
|
$retstring .= 'jQuery(".button-cancel").click(function(e) { |
11189
|
|
- e.preventDefault(); console.log(\'We click on cancel in iframe popup ' . dol_escape_js($dol_openinpopup) . '\'); |
11190
|
|
- window.parent.jQuery(\'#idfordialog' . dol_escape_js($dol_openinpopup) . '\').dialog(\'close\'); |
|
11189
|
+ e.preventDefault(); console.log(\'We click on cancel in iframe popup ' . dol_escape_js($dol_openinpopup).'\'); |
|
11190
|
+ window.parent.jQuery(\'#idfordialog' . dol_escape_js($dol_openinpopup).'\').dialog(\'close\'); |
11191
|
11191
|
});'; |
11192
|
11192
|
$retstring .= '</script>'; |
11193
|
11193
|
} |
|
@@ -11216,7 +11216,7 @@ discard block |
|
|
block discarded – undo |
11216
|
11216
|
dol_syslog(__METHOD__, LOG_DEBUG); |
11217
|
11217
|
|
11218
|
11218
|
$sql = "SELECT rowid, code, label as label"; |
11219
|
|
- $sql .= " FROM " . MAIN_DB_PREFIX . 'c_invoice_subtype'; |
|
11219
|
+ $sql .= " FROM ".MAIN_DB_PREFIX.'c_invoice_subtype'; |
11220
|
11220
|
$sql .= " WHERE active = 1"; |
11221
|
11221
|
|
11222
|
11222
|
$resql = $this->db->query($sql); |
|
@@ -11227,7 +11227,7 @@ discard block |
|
|
block discarded – undo |
11227
|
11227
|
$obj = $this->db->fetch_object($resql); |
11228
|
11228
|
|
11229
|
11229
|
// If translation exists, we use it, otherwise we take the default wording |
11230
|
|
- $label = ($langs->trans("InvoiceSubtype" . $obj->rowid) != "InvoiceSubtype" . $obj->rowid) ? $langs->trans("InvoiceSubtype" . $obj->rowid) : (($obj->label != '-') ? $obj->label : ''); |
|
11230
|
+ $label = ($langs->trans("InvoiceSubtype".$obj->rowid) != "InvoiceSubtype".$obj->rowid) ? $langs->trans("InvoiceSubtype".$obj->rowid) : (($obj->label != '-') ? $obj->label : ''); |
11231
|
11231
|
$this->cache_invoice_subtype[$obj->rowid]['rowid'] = $obj->rowid; |
11232
|
11232
|
$this->cache_invoice_subtype[$obj->rowid]['code'] = $obj->code; |
11233
|
11233
|
$this->cache_invoice_subtype[$obj->rowid]['label'] = $label; |
|
@@ -11259,18 +11259,18 @@ discard block |
|
|
block discarded – undo |
11259
|
11259
|
global $langs, $user; |
11260
|
11260
|
|
11261
|
11261
|
$out = ''; |
11262
|
|
- dol_syslog(__METHOD__ . " selected=" . $selected . ", htmlname=" . $htmlname, LOG_DEBUG); |
|
11262
|
+ dol_syslog(__METHOD__." selected=".$selected.", htmlname=".$htmlname, LOG_DEBUG); |
11263
|
11263
|
|
11264
|
11264
|
$this->load_cache_invoice_subtype(); |
11265
|
11265
|
|
11266
|
|
- $out .= '<select id="' . $htmlname . '" class="flat selectsubtype' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">'; |
|
11266
|
+ $out .= '<select id="'.$htmlname.'" class="flat selectsubtype'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">'; |
11267
|
11267
|
if ($addempty) { |
11268
|
11268
|
$out .= '<option value="0"> </option>'; |
11269
|
11269
|
} |
11270
|
11270
|
|
11271
|
11271
|
foreach ($this->cache_invoice_subtype as $rowid => $subtype) { |
11272
|
11272
|
$label = $subtype['label']; |
11273
|
|
- $out .= '<option value="' . $subtype['rowid'] . '"'; |
|
11273
|
+ $out .= '<option value="'.$subtype['rowid'].'"'; |
11274
|
11274
|
if ($selected == $subtype['rowid']) { |
11275
|
11275
|
$out .= ' selected="selected"'; |
11276
|
11276
|
} |