diff --git a/htdocs/core/ajax/ajaxinvoiceline.php b/htdocs/core/ajax/ajaxinvoiceline.php
new file mode 100644
index 00000000000..432ad15b151
--- /dev/null
+++ b/htdocs/core/ajax/ajaxinvoiceline.php
@@ -0,0 +1,69 @@
+
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+/**
+ * \file htdocs/core/ajax/ajaxinvoiceline.php
+ * \brief File to load contacts combobox
+ */
+
+if (!defined('NOTOKENRENEWAL')) {
+ define('NOTOKENRENEWAL', '1'); // Disables token renewal
+}
+if (!defined('NOREQUIREMENU')) {
+ define('NOREQUIREMENU', '1');
+}
+if (!defined('NOREQUIREAJAX')) {
+ define('NOREQUIREAJAX', '1');
+}
+
+// Load Dolibarr environment
+require '../../main.inc.php';
+require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
+
+$invoice_id = GETPOST('id', 'int'); // id of thirdparty
+$action = GETPOST('action', 'aZ09');
+$htmlname = GETPOST('htmlname', 'alpha');
+
+
+
+// Security check
+restrictedArea($user, 'facture', $invoice_id, '', '', 'fk_soc', 'rowid');
+
+
+/*
+ * View
+ */
+
+top_httphead();
+
+//print ''."\n";
+
+// Load original field value
+if (!empty($invoice_id) && !empty($action) && !empty($htmlname)) {
+ $formProject = new FormProjets($db);
+
+ $return = array();
+ if (empty($showempty)) {
+ $showempty = 0;
+ }
+
+ $return['value'] = $formProject->selectInvoiceAndLine($invoice_id, 0, 'invoiceid', 'invoicelineid', 'maxwidth500', array(), 1);
+ //$return['num'] = $form->num;
+ //$return['error'] = $form->error;
+
+ echo json_encode($return);
+}
diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index 21d245aec2a..e666980833b 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -37,15 +37,15 @@
*/
/**
- * \file htdocs/core/class/html.form.class.php
+ * \file htdocs/core/class/html.form.class.php
* \ingroup core
- * \brief File of class with all html predefined components
+ * \brief File of class with all html predefined components
*/
/**
- * Class to manage generation of HTML components
- * Only common components must be here.
+ * Class to manage generation of HTML components
+ * Only common components must be here.
*
* TODO Merge all function load_cache_* and loadCache* (except load_cache_vatrates) into one generic function loadCacheTable
*/
@@ -81,7 +81,7 @@ class Form
/**
* Constructor
*
- * @param DoliDB $db Database handler
+ * @param DoliDB $db Database handler
*/
public function __construct($db)
{
@@ -91,18 +91,18 @@ class Form
/**
* Output key field for an editable field
*
- * @param string $text Text of label or key to translate
- * @param string $htmlname Name of select field ('edit' prefix will be added)
- * @param string $preselected Value to show/edit (not used in this function)
- * @param object $object Object (on the page we show)
- * @param boolean $perm Permission to allow button to edit parameter. Set it to 0 to have a not edited field.
- * @param string $typeofdata Type of data ('string' by default, 'email', 'amount:99', 'numeric:99', 'text' or 'textarea:rows:cols', 'datepicker' ('day' do not work, don't know why), 'dayhour' or 'datehourpicker' 'checkbox:ckeditor:dolibarr_zzz:width:height:savemethod:1:rows:cols', 'select;xxx[:class]'...)
- * @param string $moreparam More param to add on a href URL.
- * @param int $fieldrequired 1 if we want to show field as mandatory using the "fieldrequired" CSS.
- * @param int $notabletag 1=Do not output table tags but output a ':', 2=Do not output table tags and no ':', 3=Do not output table tags but output a ' '
- * @param string $paramid Key of parameter for id ('id', 'socid')
- * @param string $help Tooltip help
- * @return string HTML edit field
+ * @param string $text Text of label or key to translate
+ * @param string $htmlname Name of select field ('edit' prefix will be added)
+ * @param string $preselected Value to show/edit (not used in this function)
+ * @param object $object Object (on the page we show)
+ * @param boolean $perm Permission to allow button to edit parameter. Set it to 0 to have a not edited field.
+ * @param string $typeofdata Type of data ('string' by default, 'email', 'amount:99', 'numeric:99', 'text' or 'textarea:rows:cols', 'datepicker' ('day' do not work, don't know why), 'dayhour' or 'datehourpicker' 'checkbox:ckeditor:dolibarr_zzz:width:height:savemethod:1:rows:cols', 'select;xxx[:class]'...)
+ * @param string $moreparam More param to add on a href URL.
+ * @param int $fieldrequired 1 if we want to show field as mandatory using the "fieldrequired" CSS.
+ * @param int $notabletag 1=Do not output table tags but output a ':', 2=Do not output table tags and no ':', 3=Do not output table tags but output a ' '
+ * @param string $paramid Key of parameter for id ('id', 'socid')
+ * @param string $help Tooltip help
+ * @return string HTML edit field
*/
public function editfieldkey($text, $htmlname, $preselected, $object, $perm, $typeofdata = 'string', $moreparam = '', $fieldrequired = 0, $notabletag = 0, $paramid = 'id', $help = '')
{
@@ -114,7 +114,7 @@ class Form
if (!empty($conf->global->MAIN_USE_JQUERY_JEDITABLE) && !preg_match('/^select;/', $typeofdata)) {
if (!empty($perm)) {
$tmp = explode(':', $typeofdata);
- $ret .= '
';
+ $ret .= '
';
if ($fieldrequired) {
$ret .= '';
}
@@ -126,7 +126,7 @@ class Form
if ($fieldrequired) {
$ret .= '';
}
- $ret .= '
'."\n";
+ $ret .= '
' . "\n";
} else {
if ($fieldrequired) {
$ret .= '';
@@ -164,8 +164,8 @@ class Form
if (empty($notabletag) && $perm) {
$ret .= '
';
}
- if ($htmlname && GETPOST('action', 'aZ09') != 'edit'.$htmlname && $perm) {
- $ret .= 'id.$moreparam.'">'.img_edit($langs->trans('Edit'), ($notabletag ? 0 : 1)).'';
+ if ($htmlname && GETPOST('action', 'aZ09') != 'edit' . $htmlname && $perm) {
+ $ret .= 'id . $moreparam . '">' . img_edit($langs->trans('Edit'), ($notabletag ? 0 : 1)) . '';
}
if (!empty($notabletag) && $notabletag == 1) {
if ($text) {
@@ -191,23 +191,23 @@ class Form
/**
* Output value of a field for an editable field
*
- * @param string $text Text of label (not used in this function)
- * @param string $htmlname Name of select field
- * @param string $value Value to show/edit
- * @param object $object Object (that we want to show)
- * @param boolean $perm Permission to allow button to edit parameter
- * @param string $typeofdata Type of data ('string' by default, 'email', 'amount:99', 'numeric:99', 'text' or 'textarea:rows:cols%', 'datepicker' ('day' do not work, don't know why), 'dayhour' or 'datehourpicker', 'ckeditor:dolibarr_zzz:width:height:savemethod:toolbarstartexpanded:rows:cols', 'select;xkey:xval,ykey:yval,...')
- * @param string $editvalue When in edit mode, use this value as $value instead of value (for example, you can provide here a formated price instead of numeric value). Use '' to use same than $value
- * @param object $extObject External object ???
- * @param mixed $custommsg String or Array of custom messages : eg array('success' => 'MyMessage', 'error' => 'MyMessage')
- * @param string $moreparam More param to add on the form on action href URL parameter
- * @param int $notabletag Do no output table tags
- * @param string $formatfunc Call a specific function to output field in view mode (For example: 'dol_print_email')
- * @param string $paramid Key of parameter for id ('id', 'socid')
- * @param string $gm 'auto' or 'tzuser' or 'tzuserrel' or 'tzserver' (when $typeofdata is a date)
- * @param array $moreoptions Array with more options. For example array('addnowlink'=>1), array('valuealreadyhtmlescaped'=>1)
- * @param string $editaction [=''] use GETPOST default action or set action to edit mode
- * @return string HTML edit field
+ * @param string $text Text of label (not used in this function)
+ * @param string $htmlname Name of select field
+ * @param string $value Value to show/edit
+ * @param object $object Object (that we want to show)
+ * @param boolean $perm Permission to allow button to edit parameter
+ * @param string $typeofdata Type of data ('string' by default, 'email', 'amount:99', 'numeric:99', 'text' or 'textarea:rows:cols%', 'datepicker' ('day' do not work, don't know why), 'dayhour' or 'datehourpicker', 'ckeditor:dolibarr_zzz:width:height:savemethod:toolbarstartexpanded:rows:cols', 'select;xkey:xval,ykey:yval,...')
+ * @param string $editvalue When in edit mode, use this value as $value instead of value (for example, you can provide here a formated price instead of numeric value). Use '' to use same than $value
+ * @param object $extObject External object ???
+ * @param mixed $custommsg String or Array of custom messages : eg array('success' => 'MyMessage', 'error' => 'MyMessage')
+ * @param string $moreparam More param to add on the form on action href URL parameter
+ * @param int $notabletag Do no output table tags
+ * @param string $formatfunc Call a specific function to output field in view mode (For example: 'dol_print_email')
+ * @param string $paramid Key of parameter for id ('id', 'socid')
+ * @param string $gm 'auto' or 'tzuser' or 'tzuserrel' or 'tzserver' (when $typeofdata is a date)
+ * @param array $moreoptions Array with more options. For example array('addnowlink'=>1), array('valuealreadyhtmlescaped'=>1)
+ * @param string $editaction [=''] use GETPOST default action or set action to edit mode
+ * @return string HTML edit field
*/
public function editfieldval($text, $htmlname, $value, $object, $perm, $typeofdata = 'string', $editvalue = '', $extObject = null, $custommsg = null, $moreparam = '', $notabletag = 1, $formatfunc = '', $paramid = 'id', $gm = 'auto', $moreoptions = array(), $editaction = '')
{
@@ -230,7 +230,7 @@ class Form
} elseif ($reg[1] == 'int') {
$typeofdata = 'numeric';
} else {
- return 'ErrorBadParameter '.$typeofdata;
+ return 'ErrorBadParameter ' . $typeofdata;
}
}
@@ -241,13 +241,13 @@ class Form
if ($editaction == '') {
$editaction = GETPOST('action', 'aZ09');
}
- $editmode = ($editaction == 'edit'.$htmlname);
+ $editmode = ($editaction == 'edit' . $htmlname);
if ($editmode) {
$ret .= "\n";
- $ret .= ''."\n";
+ $ret .= '' . "\n";
} else {
if (preg_match('/^(email)/', $typeofdata)) {
$ret .= dol_print_email($value, 0, 0, 0, 0, 1);
@@ -348,9 +348,9 @@ class Form
} elseif (preg_match('/^restricthtml/', $typeofdata)) {
$ret .= dol_string_onlythesehtmltags($value);
} elseif ($typeofdata == 'day' || $typeofdata == 'datepicker') {
- $ret .= ''.dol_print_date($value, 'day', $gm).'';
+ $ret .= '' . dol_print_date($value, 'day', $gm) . '';
} elseif ($typeofdata == 'dayhour' || $typeofdata == 'datehourpicker') {
- $ret .= ''.dol_print_date($value, 'dayhour', $gm).'';
+ $ret .= '' . dol_print_date($value, 'dayhour', $gm) . '';
} elseif (preg_match('/^select;/', $typeofdata)) {
$arraydata = explode(',', preg_replace('/^select;/', '', $typeofdata));
$arraylist = array();
@@ -361,9 +361,9 @@ class Form
$ret .= $arraylist[$value];
if ($htmlname == 'fk_product_type') {
if ($value == 0) {
- $ret = img_picto($langs->trans("Product"), 'product', 'class="paddingleftonly paddingrightonly colorgrey"').$ret;
+ $ret = img_picto($langs->trans("Product"), 'product', 'class="paddingleftonly paddingrightonly colorgrey"') . $ret;
} else {
- $ret = img_picto($langs->trans("Service"), 'service', 'class="paddingleftonly paddingrightonly colorgrey"').$ret;
+ $ret = img_picto($langs->trans("Service"), 'service', 'class="paddingleftonly paddingrightonly colorgrey"') . $ret;
}
}
} elseif (preg_match('/^ckeditor/', $typeofdata)) {
@@ -371,7 +371,7 @@ class Form
if (!empty($conf->global->MAIN_DISABLE_NOTES_TAB)) {
$firstline = preg_replace('/ .*/', '', $tmpcontent);
$firstline = preg_replace('/[\n\r].*/', '', $firstline);
- $tmpcontent = $firstline.((strlen($firstline) != strlen($tmpcontent)) ? '...' : '');
+ $tmpcontent = $firstline . ((strlen($firstline) != strlen($tmpcontent)) ? '...' : '');
}
// We dont use dol_escape_htmltag to get the html formating active, but this need we must also
// clean data from some dangerous html
@@ -380,7 +380,7 @@ class Form
if (empty($moreoptions['valuealreadyhtmlescaped'])) {
$ret .= dol_escape_htmltag($value);
} else {
- $ret .= $value; // $value must be already html escaped.
+ $ret .= $value; // $value must be already html escaped.
}
}
@@ -395,13 +395,13 @@ class Form
/**
* Output edit in place form
*
- * @param string $fieldname Name of the field
- * @param object $object Object
- * @param boolean $perm Permission to allow button to edit parameter. Set it to 0 to have a not edited field.
- * @param string $typeofdata Type of data ('string' by default, 'email', 'amount:99', 'numeric:99', 'text' or 'textarea:rows:cols', 'datepicker' ('day' do not work, don't know why), 'ckeditor:dolibarr_zzz:width:height:savemethod:1:rows:cols', 'select;xxx[:class]'...)
- * @param string $check Same coe than $check parameter of GETPOST()
- * @param string $morecss More CSS
- * @return string HTML code for the edit of alternative language
+ * @param string $fieldname Name of the field
+ * @param object $object Object
+ * @param boolean $perm Permission to allow button to edit parameter. Set it to 0 to have a not edited field.
+ * @param string $typeofdata Type of data ('string' by default, 'email', 'amount:99', 'numeric:99', 'text' or 'textarea:rows:cols', 'datepicker' ('day' do not work, don't know why), 'ckeditor:dolibarr_zzz:width:height:savemethod:1:rows:cols', 'select;xxx[:class]'...)
+ * @param string $check Same coe than $check parameter of GETPOST()
+ * @param string $morecss More CSS
+ * @return string HTML code for the edit of alternative language
*/
public function widgetForTranslation($fieldname, $object, $perm, $typeofdata = 'string', $check = '', $morecss = '')
{
@@ -417,7 +417,7 @@ class Form
if (is_array($arrayoflangcode) && count($arrayoflangcode)) {
if (!is_object($extralanguages)) {
- include_once DOL_DOCUMENT_ROOT.'/core/class/extralanguages.class.php';
+ include_once DOL_DOCUMENT_ROOT . '/core/class/extralanguages.class.php';
$extralanguages = new ExtraLanguages($this->db);
}
$extralanguages->fetch_name_extralanguages('societe');
@@ -426,17 +426,17 @@ class Form
return ''; // No extralang field to show
}
- $result .= ''."\n";
- $result .= '
';
$resultforextrlang = '';
foreach ($arrayoflangcode as $langcode) {
- $valuetoshow = GETPOSTISSET('field-'.$object->element."-".$fieldname."-".$langcode) ? GETPOST('field-'.$object->element.'-'.$fieldname."-".$langcode, $check) : '';
+ $valuetoshow = GETPOSTISSET('field-' . $object->element . "-" . $fieldname . "-" . $langcode) ? GETPOST('field-' . $object->element . '-' . $fieldname . "-" . $langcode, $check) : '';
if (empty($valuetoshow)) {
$object->fetchValuesForExtraLanguages();
//var_dump($object->array_languages);
@@ -448,17 +448,17 @@ class Form
// TODO Use the showInputField() method of ExtraLanguages object
if ($typeofdata == 'textarea') {
- $resultforextrlang .= '
';
- $result .= '';
+ $result .= '';
}
return $result;
@@ -467,15 +467,15 @@ class Form
/**
* Output edit in place form
*
- * @param object $object Object
- * @param string $value Value to show/edit
- * @param string $htmlname DIV ID (field name)
- * @param int $condition Condition to edit
- * @param string $inputType Type of input ('string', 'numeric', 'datepicker' ('day' do not work, don't know why), 'textarea:rows:cols', 'ckeditor:dolibarr_zzz:width:height:?:1:rows:cols', 'select:loadmethod:savemethod:buttononly')
- * @param string $editvalue When in edit mode, use this value as $value instead of value
- * @param object $extObject External object
- * @param mixed $custommsg String or Array of custom messages : eg array('success' => 'MyMessage', 'error' => 'MyMessage')
- * @return string HTML edit in place
+ * @param object $object Object
+ * @param string $value Value to show/edit
+ * @param string $htmlname DIV ID (field name)
+ * @param int $condition Condition to edit
+ * @param string $inputType Type of input ('string', 'numeric', 'datepicker' ('day' do not work, don't know why), 'textarea:rows:cols', 'ckeditor:dolibarr_zzz:width:height:?:1:rows:cols', 'select:loadmethod:savemethod:buttononly')
+ * @param string $editvalue When in edit mode, use this value as $value instead of value
+ * @param object $extObject External object
+ * @param mixed $custommsg String or Array of custom messages : eg array('success' => 'MyMessage', 'error' => 'MyMessage')
+ * @return string HTML edit in place
*/
protected function editInPlace($object, $value, $htmlname, $condition, $inputType = 'textarea', $editvalue = null, $extObject = null, $custommsg = null)
{
@@ -495,11 +495,11 @@ class Form
if ($condition) {
$element = false;
$table_element = false;
- $fk_element = false;
- $loadmethod = false;
- $savemethod = false;
- $ext_element = false;
- $button_only = false;
+ $fk_element = false;
+ $loadmethod = false;
+ $savemethod = false;
+ $ext_element = false;
+ $button_only = false;
$inputOption = '';
$rows = '';
$cols = '';
@@ -523,7 +523,7 @@ class Form
if (!empty($tmp[2])) {
$savemethod = $tmp[2];
}
- $out .= ''."\n";
+ $out .= '' . "\n";
} elseif ((preg_match('/^day$/', $inputType)) || (preg_match('/^datepicker/', $inputType)) || (preg_match('/^datehourpicker/', $inputType))) {
$tmp = explode(':', $inputType);
$inputType = $tmp[0];
@@ -534,7 +534,7 @@ class Form
$savemethod = $tmp[2];
}
- $out .= ''."\n"; // Use for timestamp format
+ $out .= '' . "\n"; // Use for timestamp format
} elseif (preg_match('/^(select|autocomplete)/', $inputType)) {
$tmp = explode(':', $inputType);
$inputType = $tmp[0];
@@ -565,40 +565,40 @@ class Form
}
if (isModEnabled('fckeditor')) {
- $out .= ''."\n";
+ $out .= '' . "\n";
} else {
$inputType = 'textarea';
}
}
- $out .= ''."\n";
- $out .= ''."\n";
- $out .= ''."\n";
- $out .= ''."\n";
+ $out .= '' . "\n";
+ $out .= '' . "\n";
+ $out .= '' . "\n";
+ $out .= '' . "\n";
if (!empty($savemethod)) {
- $out .= ''."\n";
+ $out .= '' . "\n";
}
if (!empty($ext_element)) {
- $out .= ''."\n";
+ $out .= '' . "\n";
}
if (!empty($custommsg)) {
if (is_array($custommsg)) {
if (!empty($custommsg['success'])) {
- $out .= ''."\n";
+ $out .= '' . "\n";
}
if (!empty($custommsg['error'])) {
- $out .= ''."\n";
+ $out .= '' . "\n";
}
} else {
- $out .= ''."\n";
+ $out .= '' . "\n";
}
}
if ($inputType == 'textarea') {
- $out .= ''."\n";
- $out .= ''."\n";
+ $out .= '' . "\n";
+ $out .= '' . "\n";
}
- $out .= ''.$value.''."\n";
- $out .= ''.(!empty($editvalue) ? $editvalue : $value).''."\n";
+ $out .= '' . $value . '' . "\n";
+ $out .= '' . (!empty($editvalue) ? $editvalue : $value) . '' . "\n";
} else {
$out = $value;
}
@@ -607,32 +607,32 @@ class Form
}
/**
- * Show a text and picto with tooltip on text or picto.
+ * Show a text and picto with tooltip on text or picto.
* Can be called by an instancied $form->textwithtooltip or by a static call Form::textwithtooltip
*
- * @param string $text Text to show
- * @param string $htmltext HTML content of tooltip. Must be HTML/UTF8 encoded.
- * @param int $tooltipon 1=tooltip on text, 2=tooltip on image, 3=tooltip sur les 2
- * @param int $direction -1=image is before, 0=no image, 1=image is after
- * @param string $img Html code for image (use img_xxx() function to get it)
- * @param string $extracss Add a CSS style to td tags
- * @param int $notabs 0=Include table and tr tags, 1=Do not include table and tr tags, 2=use div, 3=use span
- * @param string $incbefore Include code before the text
- * @param int $noencodehtmltext Do not encode into html entity the htmltext
- * @param string $tooltiptrigger ''=Tooltip on hover, 'abc'=Tooltip on click (abc is a unique key)
- * @param int $forcenowrap Force no wrap between text and picto (works with notabs=2 only)
- * @return string Code html du tooltip (texte+picto)
- * @see textwithpicto() Use thisfunction if you can.
+ * @param string $text Text to show
+ * @param string $htmltext HTML content of tooltip. Must be HTML/UTF8 encoded.
+ * @param int $tooltipon 1=tooltip on text, 2=tooltip on image, 3=tooltip sur les 2
+ * @param int $direction -1=image is before, 0=no image, 1=image is after
+ * @param string $img Html code for image (use img_xxx() function to get it)
+ * @param string $extracss Add a CSS style to td tags
+ * @param int $notabs 0=Include table and tr tags, 1=Do not include table and tr tags, 2=use div, 3=use span
+ * @param string $incbefore Include code before the text
+ * @param int $noencodehtmltext Do not encode into html entity the htmltext
+ * @param string $tooltiptrigger ''=Tooltip on hover, 'abc'=Tooltip on click (abc is a unique key)
+ * @param int $forcenowrap Force no wrap between text and picto (works with notabs=2 only)
+ * @return string Code html du tooltip (texte+picto)
+ * @see textwithpicto() Use thisfunction if you can.
*/
public function textwithtooltip($text, $htmltext, $tooltipon = 1, $direction = 0, $img = '', $extracss = '', $notabs = 3, $incbefore = '', $noencodehtmltext = 0, $tooltiptrigger = '', $forcenowrap = 0)
{
if ($incbefore) {
- $text = $incbefore.$text;
+ $text = $incbefore . $text;
}
if (!$htmltext) {
return $text;
}
- $direction = (int) $direction; // For backward compatibility when $direction was set to '' instead of 0
+ $direction = (int) $direction; // For backward compatibility when $direction was set to '' instead of 0
$tag = 'td';
if ($notabs == 2) {
@@ -646,11 +646,11 @@ class Form
$extrastyle = '';
if ($direction < 0) {
- $extracss = ($extracss ? $extracss.' ' : '').($notabs != 3 ? 'inline-block' : '');
+ $extracss = ($extracss ? $extracss . ' ' : '') . ($notabs != 3 ? 'inline-block' : '');
$extrastyle = 'padding: 0px; padding-left: 3px;';
}
if ($direction > 0) {
- $extracss = ($extracss ? $extracss.' ' : '').($notabs != 3 ? 'inline-block' : '');
+ $extracss = ($extracss ? $extracss . ' ' : '') . ($notabs != 3 ? 'inline-block' : '');
$extrastyle = 'padding: 0px; padding-right: 3px;';
}
@@ -663,53 +663,53 @@ class Form
$htmltext = str_replace('"', '"', $htmltext);
} else {
$classfortooltip = 'classfortooltiponclick';
- $textfordialog .= '
'.$htmltext.'
';
+ $textfordialog .= '
' . $htmltext . '
';
}
if ($tooltipon == 2 || $tooltipon == 3) {
- $paramfortooltipimg = ' class="'.$classfortooltip.($notabs != 3 ? ' inline-block' : '').($extracss ? ' '.$extracss : '').'" style="padding: 0px;'.($extrastyle ? ' '.$extrastyle : '').'"';
+ $paramfortooltipimg = ' class="' . $classfortooltip . ($notabs != 3 ? ' inline-block' : '') . ($extracss ? ' ' . $extracss : '') . '" style="padding: 0px;' . ($extrastyle ? ' ' . $extrastyle : '') . '"';
if ($tooltiptrigger == '') {
- $paramfortooltipimg .= ' title="'.($noencodehtmltext ? $htmltext : dol_escape_htmltag($htmltext, 1)).'"'; // Attribut to put on img tag to store tooltip
+ $paramfortooltipimg .= ' title="' . ($noencodehtmltext ? $htmltext : dol_escape_htmltag($htmltext, 1)) . '"'; // Attribut to put on img tag to store tooltip
} else {
- $paramfortooltipimg .= ' dolid="'.$tooltiptrigger.'"';
+ $paramfortooltipimg .= ' dolid="' . $tooltiptrigger . '"';
}
} else {
- $paramfortooltipimg = ($extracss ? ' class="'.$extracss.'"' : '').($extrastyle ? ' style="'.$extrastyle.'"' : ''); // Attribut to put on td text tag
+ $paramfortooltipimg = ($extracss ? ' class="' . $extracss . '"' : '') . ($extrastyle ? ' style="' . $extrastyle . '"' : ''); // Attribut to put on td text tag
}
if ($tooltipon == 1 || $tooltipon == 3) {
- $paramfortooltiptd = ' class="'.($tooltipon == 3 ? 'cursorpointer ' : '').$classfortooltip.' inline-block'.($extracss ? ' '.$extracss : '').'" style="padding: 0px;'.($extrastyle ? ' '.$extrastyle : '').'" ';
+ $paramfortooltiptd = ' class="' . ($tooltipon == 3 ? 'cursorpointer ' : '') . $classfortooltip . ' inline-block' . ($extracss ? ' ' . $extracss : '') . '" style="padding: 0px;' . ($extrastyle ? ' ' . $extrastyle : '') . '" ';
if ($tooltiptrigger == '') {
- $paramfortooltiptd .= ' title="'.($noencodehtmltext ? $htmltext : dol_escape_htmltag($htmltext, 1)).'"'; // Attribut to put on td tag to store tooltip
+ $paramfortooltiptd .= ' title="' . ($noencodehtmltext ? $htmltext : dol_escape_htmltag($htmltext, 1)) . '"'; // Attribut to put on td tag to store tooltip
} else {
- $paramfortooltiptd .= ' dolid="'.$tooltiptrigger.'"';
+ $paramfortooltiptd .= ' dolid="' . $tooltiptrigger . '"';
}
} else {
- $paramfortooltiptd = ($extracss ? ' class="'.$extracss.'"' : '').($extrastyle ? ' style="'.$extrastyle.'"' : ''); // Attribut to put on td text tag
+ $paramfortooltiptd = ($extracss ? ' class="' . $extracss . '"' : '') . ($extrastyle ? ' style="' . $extrastyle . '"' : ''); // Attribut to put on td text tag
}
if (empty($notabs)) {
$s .= '
';
} elseif ($notabs == 2) {
- $s .= '
';
+ $s .= '
';
}
// Define value if value is before
if ($direction < 0) {
- $s .= '<'.$tag.$paramfortooltipimg;
+ $s .= '<' . $tag . $paramfortooltipimg;
if ($tag == 'td') {
$s .= ' class="valigntop" width="14"';
}
- $s .= '>'.$textfordialog.$img.''.$tag.'>';
+ $s .= '>' . $textfordialog . $img . '' . $tag . '>';
}
// Use another method to help avoid having a space in value in order to use this value with jquery
// Define label
if ((string) $text != '') {
- $s .= '<'.$tag.$paramfortooltiptd.'>'.$text.''.$tag.'>';
+ $s .= '<' . $tag . $paramfortooltiptd . '>' . $text . '' . $tag . '>';
}
// Define value if value is after
if ($direction > 0) {
- $s .= '<'.$tag.$paramfortooltipimg;
+ $s .= '<' . $tag . $paramfortooltipimg;
if ($tag == 'td') {
$s .= ' class="valignmiddle" width="14"';
}
- $s .= '>'.$textfordialog.$img.''.$tag.'>';
+ $s .= '>' . $textfordialog . $img . '' . $tag . '>';
}
if (empty($notabs)) {
$s .= '
';
@@ -721,18 +721,18 @@ class Form
}
/**
- * Show a text with a picto and a tooltip on picto
+ * Show a text with a picto and a tooltip on picto
*
- * @param string $text Text to show
- * @param string $htmltext Content of tooltip
- * @param int $direction 1=Icon is after text, -1=Icon is before text, 0=no icon
- * @param string $type Type of picto ('info', 'infoclickable', 'help', 'helpclickable', 'warning', 'superadmin', 'mypicto@mymodule', ...) or image filepath or 'none'
- * @param string $extracss Add a CSS style to td, div or span tag
- * @param int $noencodehtmltext Do not encode into html entity the htmltext
- * @param int $notabs 0=Include table and tr tags, 1=Do not include table and tr tags, 2=use div, 3=use span
- * @param string $tooltiptrigger ''=Tooltip on hover and hidden on smartphone, 'abconsmartphone'=Tooltip on hover and on click on smartphone, 'abc'=Tooltip on click (abc is a unique key, clickable link is on image or on link if param $type='none' or on both if $type='xxxclickable')
- * @param int $forcenowrap Force no wrap between text and picto (works with notabs=2 only)
- * @return string HTML code of text, picto, tooltip
+ * @param string $text Text to show
+ * @param string $htmltext Content of tooltip
+ * @param int $direction 1=Icon is after text, -1=Icon is before text, 0=no icon
+ * @param string $type Type of picto ('info', 'infoclickable', 'help', 'helpclickable', 'warning', 'superadmin', 'mypicto@mymodule', ...) or image filepath or 'none'
+ * @param string $extracss Add a CSS style to td, div or span tag
+ * @param int $noencodehtmltext Do not encode into html entity the htmltext
+ * @param int $notabs 0=Include table and tr tags, 1=Do not include table and tr tags, 2=use div, 3=use span
+ * @param string $tooltiptrigger ''=Tooltip on hover and hidden on smartphone, 'abconsmartphone'=Tooltip on hover and on click on smartphone, 'abc'=Tooltip on click (abc is a unique key, clickable link is on image or on link if param $type='none' or on both if $type='xxxclickable')
+ * @param int $forcenowrap Force no wrap between text and picto (works with notabs=2 only)
+ * @return string HTML code of text, picto, tooltip
*/
public function textwithpicto($text, $htmltext, $direction = 1, $type = 'help', $extracss = '', $noencodehtmltext = 0, $notabs = 3, $tooltiptrigger = '', $forcenowrap = 0)
{
@@ -799,12 +799,12 @@ class Form
/**
* Generate select HTML to choose massaction
*
- * @param string $selected Value auto selected when at least one record is selected. Not a preselected value. Use '0' by default.
- * @param array $arrayofaction array('code'=>'label', ...). The code is the key stored into the GETPOST('massaction') when submitting action.
- * @param int $alwaysvisible 1=select button always visible
- * @param string $name Name for massaction
- * @param string $cssclass CSS class used to check for select
- * @return string|void Select list
+ * @param string $selected Value auto selected when at least one record is selected. Not a preselected value. Use '0' by default.
+ * @param array $arrayofaction array('code'=>'label', ...). The code is the key stored into the GETPOST('massaction') when submitting action.
+ * @param int $alwaysvisible 1=select button always visible
+ * @param string $name Name for massaction
+ * @param string $cssclass CSS class used to check for select
+ * @return string|void Select list
*/
public function selectMassAction($selected, $arrayofaction, $alwaysvisible = 0, $name = 'massaction', $cssclass = 'checkforselect')
{
@@ -813,7 +813,7 @@ class Form
$disabled = 0;
$ret = '
';
- $ret .= '
';
if (!empty($conf->use_javascript_ajax)) {
$ret .= '
- ';
$out .= $this->select_dolusers('', $htmlname, $show_empty, $exclude, $disabled, $include, $enableonly, $force_entity, $maxlength, $showstatus, $morefilter);
- $out .= ' ';
+ $out .= ' ';
$out .= ' ';
}
@@ -2288,32 +2302,33 @@ class Form
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
+
/**
* Return list of products for customer in Ajax if Ajax activated or go to select_produits_list
*
- * @param int $selected Preselected products
- * @param string $htmlname Name of HTML select field (must be unique in page).
- * @param int|string $filtertype Filter on product type (''=nofilter, 0=product, 1=service)
- * @param int $limit Limit on number of returned lines
- * @param int $price_level Level of price to show
- * @param int $status Sell status -1=Return all products, 0=Products not on sell, 1=Products on sell
- * @param int $finished 2=all, 1=finished, 0=raw material
- * @param string $selected_input_value Value of preselected input text (for use with ajax)
- * @param int $hidelabel Hide label (0=no, 1=yes, 2=show search icon (before) and placeholder, 3 search icon after)
- * @param array $ajaxoptions Options for ajax_autocompleter
- * @param int $socid Thirdparty Id (to get also price dedicated to this customer)
- * @param string $showempty '' to not show empty line. Translation key to show an empty line. '1' show empty line with no text.
- * @param int $forcecombo Force to use combo box
- * @param string $morecss Add more css on select
- * @param int $hidepriceinlabel 1=Hide prices in label
- * @param string $warehouseStatus Warehouse status filter to count the quantity in stock. Following comma separated filter options can be used
- * 'warehouseopen' = count products from open warehouses,
- * 'warehouseclosed' = count products from closed warehouses,
- * 'warehouseinternal' = count products from warehouses for internal correct/transfer only
- * @param array $selected_combinations Selected combinations. Format: array([attrid] => attrval, [...])
- * @param string $nooutput No print, return the output into a string
- * @param int $status_purchase Purchase status -1=Return all products, 0=Products not on purchase, 1=Products on purchase
- * @return void|string
+ * @param int $selected Preselected products
+ * @param string $htmlname Name of HTML select field (must be unique in page).
+ * @param int|string $filtertype Filter on product type (''=nofilter, 0=product, 1=service)
+ * @param int $limit Limit on number of returned lines
+ * @param int $price_level Level of price to show
+ * @param int $status Sell status -1=Return all products, 0=Products not on sell, 1=Products on sell
+ * @param int $finished 2=all, 1=finished, 0=raw material
+ * @param string $selected_input_value Value of preselected input text (for use with ajax)
+ * @param int $hidelabel Hide label (0=no, 1=yes, 2=show search icon (before) and placeholder, 3 search icon after)
+ * @param array $ajaxoptions Options for ajax_autocompleter
+ * @param int $socid Thirdparty Id (to get also price dedicated to this customer)
+ * @param string $showempty '' to not show empty line. Translation key to show an empty line. '1' show empty line with no text.
+ * @param int $forcecombo Force to use combo box
+ * @param string $morecss Add more css on select
+ * @param int $hidepriceinlabel 1=Hide prices in label
+ * @param string $warehouseStatus Warehouse status filter to count the quantity in stock. Following comma separated filter options can be used
+ * 'warehouseopen' = count products from open warehouses,
+ * 'warehouseclosed' = count products from closed warehouses,
+ * 'warehouseinternal' = count products from warehouses for internal correct/transfer only
+ * @param array $selected_combinations Selected combinations. Format: array([attrid] => attrval, [...])
+ * @param string $nooutput No print, return the output into a string
+ * @param int $status_purchase Purchase status -1=Return all products, 0=Products not on purchase, 1=Products on purchase
+ * @return void|string
*/
public function select_produits($selected = '', $htmlname = 'productid', $filtertype = '', $limit = 0, $price_level = 0, $status = 1, $finished = 2, $selected_input_value = '', $hidelabel = 0, $ajaxoptions = array(), $socid = 0, $showempty = '1', $forcecombo = 0, $morecss = '', $hidepriceinlabel = 0, $warehouseStatus = '', $selected_combinations = null, $nooutput = 0, $status_purchase = -1)
{
@@ -2340,7 +2355,7 @@ class Form
$placeholder = '';
if ($selected && empty($selected_input_value)) {
- require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
+ require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
$producttmpselect = new Product($this->db);
$producttmpselect->fetch($selected);
$selected_input_value = $producttmpselect->ref;
@@ -2355,17 +2370,17 @@ class Form
}
}
// mode=1 means customers products
- $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;
- $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/product/ajax/products.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions);
+ $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;
+ $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/product/ajax/products.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions);
if (isModEnabled('variants') && is_array($selected_combinations)) {
// Code to automatically insert with javascript the select of attributes under the select of product
// when a parent of variant has been selected.
$out .= '
-
';
}
if (empty($hidelabel)) {
- $out .= $langs->trans("RefOrLabel").' : ';
+ $out .= $langs->trans("RefOrLabel") . ' : ';
} elseif ($hidelabel > 1) {
- $placeholder = ' placeholder="'.$langs->trans("RefOrLabel").'"';
+ $placeholder = ' placeholder="' . $langs->trans("RefOrLabel") . '"';
if ($hidelabel == 2) {
$out .= img_picto($langs->trans("Search"), 'search');
}
}
- $out .= 'global->PRODUCT_SEARCH_AUTOFOCUS) ? 'autofocus' : '').' />';
+ $out .= 'global->PRODUCT_SEARCH_AUTOFOCUS) ? 'autofocus' : '') . ' />';
if ($hidelabel == 3) {
$out .= img_picto($langs->trans("Search"), 'search');
}
@@ -2471,7 +2486,7 @@ class Form
* @param string $morecss Add more css on select
* @param string $nooutput No print, return the output into a string
* @param int $forcecombo Force to use combo box
- * @param array $TProducts Add filter on a defined product
+ * @param array $TProducts Add filter on a defined product
* @return void|string
*/
public function select_bom($selected = '', $htmlname = 'bom_id', $limit = 0, $status = 1, $type = 0, $showempty = '1', $morecss = '', $nooutput = '', $forcecombo = 0, $TProducts = [])
@@ -2479,29 +2494,29 @@ class Form
// phpcs:enable
global $conf, $user, $langs, $db;
- require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
+ require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
$error = 0;
$out = '';
if (!$forcecombo) {
- include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
+ include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
$events = array();
$out .= ajax_combobox($htmlname, $events, getDolGlobalInt("PRODUIT_USE_SEARCH_TO_SELECT"));
}
- $out .= '';
+ $out .= '';
$sql = 'SELECT b.rowid, b.ref, b.label, b.fk_product';
- $sql.= ' FROM '.MAIN_DB_PREFIX.'bom_bom as b';
- $sql.= ' WHERE b.entity IN ('.getEntity('bom').')';
- if (!empty($status)) $sql.= ' AND status = '. (int) $status;
- if (!empty($type)) $sql.= ' AND bomtype = '. (int) $type;
- if (!empty($TProducts)) $sql .= ' AND fk_product IN ('.$this->db->sanitize(implode(',', $TProducts)).')';
- if (!empty($limit)) $sql.= ' LIMIT '. (int) $limit;
+ $sql .= ' FROM ' . MAIN_DB_PREFIX . 'bom_bom as b';
+ $sql .= ' WHERE b.entity IN (' . getEntity('bom') . ')';
+ if (!empty($status)) $sql .= ' AND status = ' . (int) $status;
+ if (!empty($type)) $sql .= ' AND bomtype = ' . (int) $type;
+ if (!empty($TProducts)) $sql .= ' AND fk_product IN (' . $this->db->sanitize(implode(',', $TProducts)) . ')';
+ if (!empty($limit)) $sql .= ' LIMIT ' . (int) $limit;
$resql = $db->query($sql);
if ($resql) {
- if ($showempty) {
+ if ($showempty) {
$out .= '';
+ $out .= '>' . $obj->ref . ' - ' . $product->label . ' - ' . $obj->label . '';
}
} else {
$error++;
@@ -2525,30 +2540,31 @@ class Form
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
+
/**
- * Return list of products for a customer.
+ * Return list of products for a customer.
* Called by select_produits.
*
- * @param int $selected Preselected product
- * @param string $htmlname Name of select html
- * @param string $filtertype Filter on product type (''=nofilter, 0=product, 1=service)
- * @param int $limit Limit on number of returned lines
- * @param int $price_level Level of price to show
- * @param string $filterkey Filter on product
- * @param int $status -1=Return all products, 0=Products not on sell, 1=Products on sell
- * @param int $finished Filter on finished field: 2=No filter
- * @param int $outputmode 0=HTML select string, 1=Array
- * @param int $socid Thirdparty Id (to get also price dedicated to this customer)
- * @param string $showempty '' to not show empty line. Translation key to show an empty line. '1' show empty line with no text.
- * @param int $forcecombo Force to use combo box
- * @param string $morecss Add more css on select
- * @param int $hidepriceinlabel 1=Hide prices in label
- * @param string $warehouseStatus Warehouse status filter to group/count stock. Following comma separated filter options can be used.
- * 'warehouseopen' = count products from open warehouses,
- * 'warehouseclosed' = count products from closed warehouses,
- * 'warehouseinternal' = count products from warehouses for internal correct/transfer only
- * @param int $status_purchase Purchase status -1=Return all products, 0=Products not on purchase, 1=Products on purchase
- * @return array|string Array of keys for json
+ * @param int $selected Preselected product
+ * @param string $htmlname Name of select html
+ * @param string $filtertype Filter on product type (''=nofilter, 0=product, 1=service)
+ * @param int $limit Limit on number of returned lines
+ * @param int $price_level Level of price to show
+ * @param string $filterkey Filter on product
+ * @param int $status -1=Return all products, 0=Products not on sell, 1=Products on sell
+ * @param int $finished Filter on finished field: 2=No filter
+ * @param int $outputmode 0=HTML select string, 1=Array
+ * @param int $socid Thirdparty Id (to get also price dedicated to this customer)
+ * @param string $showempty '' to not show empty line. Translation key to show an empty line. '1' show empty line with no text.
+ * @param int $forcecombo Force to use combo box
+ * @param string $morecss Add more css on select
+ * @param int $hidepriceinlabel 1=Hide prices in label
+ * @param string $warehouseStatus Warehouse status filter to group/count stock. Following comma separated filter options can be used.
+ * 'warehouseopen' = count products from open warehouses,
+ * 'warehouseclosed' = count products from closed warehouses,
+ * 'warehouseinternal' = count products from warehouses for internal correct/transfer only
+ * @param int $status_purchase Purchase status -1=Return all products, 0=Products not on purchase, 1=Products on purchase
+ * @return array|string Array of keys for json
*/
public function select_produits_list($selected = '', $htmlname = 'productid', $filtertype = '', $limit = 20, $price_level = 0, $filterkey = '', $status = 1, $finished = 2, $outputmode = 0, $socid = 0, $showempty = '1', $forcecombo = 0, $morecss = '', $hidepriceinlabel = 0, $warehouseStatus = '', $status_purchase = -1)
{
@@ -2566,7 +2582,7 @@ class Form
$warehouseStatusArray = array();
if (!empty($warehouseStatus)) {
- require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php';
+ require_once DOL_DOCUMENT_ROOT . '/product/stock/class/entrepot.class.php';
if (preg_match('/warehouseclosed/', $warehouseStatus)) {
$warehouseStatusArray[] = Entrepot::STATUS_CLOSED;
}
@@ -2580,19 +2596,19 @@ class Form
$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";
if (count($warehouseStatusArray)) {
- $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
+ $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
} else {
- $selectFieldsGrouped = ", ".$this->db->ifsql("p.stock IS NULL", 0, "p.stock")." AS stock";
+ $selectFieldsGrouped = ", " . $this->db->ifsql("p.stock IS NULL", 0, "p.stock") . " AS stock";
}
$sql = "SELECT ";
- $sql .= $selectFields.$selectFieldsGrouped;
+ $sql .= $selectFields . $selectFieldsGrouped;
if (!empty($conf->global->PRODUCT_SORT_BY_CATEGORY)) {
//Product category
- $sql .= ", (SELECT ".$this->db->prefix()."categorie_product.fk_categorie
- FROM ".$this->db->prefix()."categorie_product
- WHERE ".$this->db->prefix()."categorie_product.fk_product=p.rowid
+ $sql .= ", (SELECT " . $this->db->prefix() . "categorie_product.fk_categorie
+ FROM " . $this->db->prefix() . "categorie_product
+ WHERE " . $this->db->prefix() . "categorie_product.fk_product=p.rowid
LIMIT 1
) AS categorie_product_id ";
}
@@ -2618,83 +2634,83 @@ class Form
}
// Price by quantity
if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY) || !empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) {
- $sql .= ", (SELECT pp.rowid FROM ".$this->db->prefix()."product_price as pp WHERE pp.fk_product = p.rowid";
+ $sql .= ", (SELECT pp.rowid FROM " . $this->db->prefix() . "product_price as pp WHERE pp.fk_product = p.rowid";
if ($price_level >= 1 && !empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) {
- $sql .= " AND price_level = ".((int) $price_level);
+ $sql .= " AND price_level = " . ((int) $price_level);
}
$sql .= " ORDER BY date_price";
$sql .= " DESC LIMIT 1) as price_rowid";
- $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
+ $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
if ($price_level >= 1 && !empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) {
- $sql .= " AND price_level = ".((int) $price_level);
+ $sql .= " AND price_level = " . ((int) $price_level);
}
$sql .= " ORDER BY date_price";
$sql .= " DESC LIMIT 1) as price_by_qty";
$selectFields .= ", price_rowid, price_by_qty";
}
- $sql .= " FROM ".$this->db->prefix()."product as p";
+ $sql .= " FROM " . $this->db->prefix() . "product as p";
if (count($warehouseStatusArray)) {
- $sql .= " LEFT JOIN ".$this->db->prefix()."product_stock as ps on ps.fk_product = p.rowid";
- $sql .= " LEFT JOIN ".$this->db->prefix()."entrepot as e on ps.fk_entrepot = e.rowid AND e.entity IN (".getEntity('stock').")";
- $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.
+ $sql .= " LEFT JOIN " . $this->db->prefix() . "product_stock as ps on ps.fk_product = p.rowid";
+ $sql .= " LEFT JOIN " . $this->db->prefix() . "entrepot as e on ps.fk_entrepot = e.rowid AND e.entity IN (" . getEntity('stock') . ")";
+ $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.
}
// include search in supplier ref
if (!empty($conf->global->MAIN_SEARCH_PRODUCT_BY_FOURN_REF)) {
- $sql .= " LEFT JOIN ".$this->db->prefix()."product_fournisseur_price as pfp ON p.rowid = pfp.fk_product";
+ $sql .= " LEFT JOIN " . $this->db->prefix() . "product_fournisseur_price as pfp ON p.rowid = pfp.fk_product";
}
//Price by customer
if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES) && !empty($socid)) {
- $sql .= " LEFT JOIN ".$this->db->prefix()."product_customer_price as pcp ON pcp.fk_soc=".((int) $socid)." AND pcp.fk_product=p.rowid";
+ $sql .= " LEFT JOIN " . $this->db->prefix() . "product_customer_price as pcp ON pcp.fk_soc=" . ((int) $socid) . " AND pcp.fk_product=p.rowid";
}
// Units
if (getDolGlobalInt('PRODUCT_USE_UNITS')) {
- $sql .= " LEFT JOIN ".$this->db->prefix()."c_units u ON u.rowid = p.fk_unit";
+ $sql .= " LEFT JOIN " . $this->db->prefix() . "c_units u ON u.rowid = p.fk_unit";
}
// Multilang : we add translation
if (getDolGlobalInt('MAIN_MULTILANGS')) {
- $sql .= " LEFT JOIN ".$this->db->prefix()."product_lang as pl ON pl.fk_product = p.rowid ";
+ $sql .= " LEFT JOIN " . $this->db->prefix() . "product_lang as pl ON pl.fk_product = p.rowid ";
if (!empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE) && !empty($socid)) {
- require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
+ require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
$soc = new Societe($this->db);
$result = $soc->fetch($socid);
if ($result > 0 && !empty($soc->default_lang)) {
- $sql .= " AND pl.lang = '".$this->db->escape($soc->default_lang)."'";
+ $sql .= " AND pl.lang = '" . $this->db->escape($soc->default_lang) . "'";
} else {
- $sql .= " AND pl.lang = '".$this->db->escape($langs->getDefaultLang())."'";
+ $sql .= " AND pl.lang = '" . $this->db->escape($langs->getDefaultLang()) . "'";
}
} else {
- $sql .= " AND pl.lang = '".$this->db->escape($langs->getDefaultLang())."'";
+ $sql .= " AND pl.lang = '" . $this->db->escape($langs->getDefaultLang()) . "'";
}
}
if (!empty($conf->global->PRODUIT_ATTRIBUTES_HIDECHILD)) {
- $sql .= " LEFT JOIN ".$this->db->prefix()."product_attribute_combination pac ON pac.fk_product_child = p.rowid";
+ $sql .= " LEFT JOIN " . $this->db->prefix() . "product_attribute_combination pac ON pac.fk_product_child = p.rowid";
}
- $sql .= ' WHERE p.entity IN ('.getEntity('product').')';
+ $sql .= ' WHERE p.entity IN (' . getEntity('product') . ')';
if (!empty($conf->global->PRODUIT_ATTRIBUTES_HIDECHILD)) {
$sql .= " AND pac.rowid IS NULL";
}
if ($finished == 0) {
- $sql .= " AND p.finished = ".((int) $finished);
+ $sql .= " AND p.finished = " . ((int) $finished);
} elseif ($finished == 1) {
- $sql .= " AND p.finished = ".((int) $finished);
+ $sql .= " AND p.finished = " . ((int) $finished);
if ($status >= 0) {
- $sql .= " AND p.tosell = ".((int) $status);
+ $sql .= " AND p.tosell = " . ((int) $status);
}
} elseif ($status >= 0) {
- $sql .= " AND p.tosell = ".((int) $status);
+ $sql .= " AND p.tosell = " . ((int) $status);
}
if ($status_purchase >= 0) {
- $sql .= " AND p.tobuy = ".((int) $status_purchase);
+ $sql .= " AND p.tobuy = " . ((int) $status_purchase);
}
// Filter by product type
if (strval($filtertype) != '') {
- $sql .= " AND p.fk_product_type = ".((int) $filtertype);
+ $sql .= " AND p.fk_product_type = " . ((int) $filtertype);
} elseif (!isModEnabled('product')) { // when product module is disabled, show services only
$sql .= " AND p.fk_product_type = 1";
} elseif (!isModEnabled('service')) { // when service module is disabled, show products only
@@ -2718,21 +2734,21 @@ class Form
if ($i > 0) {
$sql .= " AND ";
}
- $sql .= "(p.ref LIKE '".$this->db->escape($prefix.$crit)."%' OR p.label LIKE '".$this->db->escape($prefix.$crit)."%'";
+ $sql .= "(p.ref LIKE '" . $this->db->escape($prefix . $crit) . "%' OR p.label LIKE '" . $this->db->escape($prefix . $crit) . "%'";
if (getDolGlobalInt('MAIN_MULTILANGS')) {
- $sql .= " OR pl.label LIKE '".$this->db->escape($prefix.$crit)."%'";
+ $sql .= " OR pl.label LIKE '" . $this->db->escape($prefix . $crit) . "%'";
}
if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES) && !empty($socid)) {
- $sql .= " OR pcp.ref_customer LIKE '".$this->db->escape($prefix.$crit)."%'";
+ $sql .= " OR pcp.ref_customer LIKE '" . $this->db->escape($prefix . $crit) . "%'";
}
if (!empty($conf->global->PRODUCT_AJAX_SEARCH_ON_DESCRIPTION)) {
- $sql .= " OR p.description LIKE '".$this->db->escape($prefix.$crit)."%'";
+ $sql .= " OR p.description LIKE '" . $this->db->escape($prefix . $crit) . "%'";
if (getDolGlobalInt('MAIN_MULTILANGS')) {
- $sql .= " OR pl.description LIKE '".$this->db->escape($prefix.$crit)."%'";
+ $sql .= " OR pl.description LIKE '" . $this->db->escape($prefix . $crit) . "%'";
}
}
if (!empty($conf->global->MAIN_SEARCH_PRODUCT_BY_FOURN_REF)) {
- $sql .= " OR pfp.ref_fourn LIKE '".$this->db->escape($prefix.$crit)."%'";
+ $sql .= " OR pfp.ref_fourn LIKE '" . $this->db->escape($prefix . $crit) . "%'";
}
$sql .= ")";
$i++;
@@ -2741,12 +2757,12 @@ class Form
$sql .= ")";
}
if (isModEnabled('barcode')) {
- $sql .= " OR p.barcode LIKE '".$this->db->escape($prefix.$filterkey)."%'";
+ $sql .= " OR p.barcode LIKE '" . $this->db->escape($prefix . $filterkey) . "%'";
}
$sql .= ')';
}
if (count($warehouseStatusArray)) {
- $sql .= " GROUP BY ".$selectFields;
+ $sql .= " GROUP BY " . $selectFields;
}
//Sort by category
@@ -2761,23 +2777,23 @@ class Form
$sql .= $this->db->plimit($limit, 0);
// Build output string
- dol_syslog(get_class($this)."::select_produits_list search products", LOG_DEBUG);
+ dol_syslog(get_class($this) . "::select_produits_list search products", LOG_DEBUG);
$result = $this->db->query($sql);
if ($result) {
- require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
- require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php';
- require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php';
+ require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
+ require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php';
+ require_once DOL_DOCUMENT_ROOT . '/core/lib/product.lib.php';
$num = $this->db->num_rows($result);
$events = null;
if (!$forcecombo) {
- include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
+ include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
$out .= ajax_combobox($htmlname, $events, getDolGlobalInt("PRODUIT_USE_SEARCH_TO_SELECT"));
}
- $out .= '';
+ $out .= '';
$textifempty = '';
// Do not use textifempty = ' ' or ' ' here, or search on key will search on ' key'.
@@ -2794,7 +2810,7 @@ class Form
}
}
if ($showempty) {
- $out .= '';
+ $out .= '';
}
$i = 0;
@@ -2805,11 +2821,11 @@ class Form
if ((!empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY) || !empty($conf->global->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
$sql = "SELECT rowid, quantity, price, unitprice, remise_percent, remise, price_base_type";
- $sql .= " FROM ".$this->db->prefix()."product_price_by_qty";
- $sql .= " WHERE fk_product_price = ".((int) $objp->price_rowid);
+ $sql .= " FROM " . $this->db->prefix() . "product_price_by_qty";
+ $sql .= " WHERE fk_product_price = " . ((int) $objp->price_rowid);
$sql .= " ORDER BY quantity ASC";
- dol_syslog(get_class($this)."::select_produits_list search prices by qty", LOG_DEBUG);
+ dol_syslog(get_class($this) . "::select_produits_list search prices by qty", LOG_DEBUG);
$result2 = $this->db->query($sql);
if ($result2) {
$nb_prices = $this->db->num_rows($result2);
@@ -2847,7 +2863,7 @@ class Form
$price_product = new Product($this->db);
$price_product->fetch($objp->rowid, '', '', 1);
- require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php';
+ require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php';
$priceparser = new PriceParser($this->db);
$price_result = $priceparser->parseProduct($price_product);
if ($price_result >= 0) {
@@ -2891,15 +2907,15 @@ class Form
* This define value for &$opt and &$optJson.
* This function is called by select_produits_list().
*
- * @param object $objp Resultset of fetch
- * @param string $opt Option (var used for returned value in string option format)
- * @param string $optJson Option (var used for returned value in json format)
- * @param int $price_level Price level
- * @param string $selected Preselected value
- * @param int $hidepriceinlabel Hide price in label
- * @param string $filterkey Filter key to highlight
- * @param int $novirtualstock Do not load virtual stock, even if slow option STOCK_SHOW_VIRTUAL_STOCK_IN_PRODUCTS_COMBO is on.
- * @return void
+ * @param object $objp Resultset of fetch
+ * @param string $opt Option (var used for returned value in string option format)
+ * @param string $optJson Option (var used for returned value in json format)
+ * @param int $price_level Price level
+ * @param string $selected Preselected value
+ * @param int $hidepriceinlabel Hide price in label
+ * @param string $filterkey Filter key to highlight
+ * @param int $novirtualstock Do not load virtual stock, even if slow option STOCK_SHOW_VIRTUAL_STOCK_IN_PRODUCTS_COMBO is on.
+ * @return void
*/
protected function constructProductListOption(&$objp, &$opt, &$optJson, $price_level, $selected, $hidepriceinlabel = 0, $filterkey = '', $novirtualstock = 0)
{
@@ -2930,7 +2946,7 @@ class Form
$label = $objp->label_translated;
}
if (!empty($filterkey) && $filterkey != '') {
- $label = preg_replace('/('.preg_quote($filterkey, '/').')/i', '$1', $label, 1);
+ $label = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '$1', $label, 1);
}
$outkey = $objp->rowid;
@@ -2947,36 +2963,36 @@ class Form
$outpbq = empty($objp->price_by_qty_rowid) ? '' : $objp->price_by_qty_rowid;
$outtype = $objp->fk_product_type;
- $outdurationvalue = $outtype == Product::TYPE_SERVICE ?substr($objp->duration, 0, dol_strlen($objp->duration) - 1) : '';
- $outdurationunit = $outtype == Product::TYPE_SERVICE ?substr($objp->duration, -1) : '';
+ $outdurationvalue = $outtype == Product::TYPE_SERVICE ? substr($objp->duration, 0, dol_strlen($objp->duration) - 1) : '';
+ $outdurationunit = $outtype == Product::TYPE_SERVICE ? substr($objp->duration, -1) : '';
if ($outorigin && !empty($conf->global->PRODUCT_SHOW_ORIGIN_IN_COMBO)) {
- require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
+ require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';
}
// Units
$outvalUnits = '';
if (getDolGlobalInt('PRODUCT_USE_UNITS')) {
if (!empty($objp->unit_short)) {
- $outvalUnits .= ' - '.$objp->unit_short;
+ $outvalUnits .= ' - ' . $objp->unit_short;
}
}
if (!empty($conf->global->PRODUCT_SHOW_DIMENSIONS_IN_COMBO)) {
if (!empty($objp->weight) && $objp->weight_units !== null) {
$unitToShow = showDimensionInBestUnit($objp->weight, $objp->weight_units, 'weight', $langs);
- $outvalUnits .= ' - '.$unitToShow;
+ $outvalUnits .= ' - ' . $unitToShow;
}
if ((!empty($objp->length) || !empty($objp->width) || !empty($objp->height)) && $objp->length_units !== null) {
- $unitToShow = $objp->length.' x '.$objp->width.' x '.$objp->height.' '.measuringUnitString(0, 'size', $objp->length_units);
- $outvalUnits .= ' - '.$unitToShow;
+ $unitToShow = $objp->length . ' x ' . $objp->width . ' x ' . $objp->height . ' ' . measuringUnitString(0, 'size', $objp->length_units);
+ $outvalUnits .= ' - ' . $unitToShow;
}
if (!empty($objp->surface) && $objp->surface_units !== null) {
$unitToShow = showDimensionInBestUnit($objp->surface, $objp->surface_units, 'surface', $langs);
- $outvalUnits .= ' - '.$unitToShow;
+ $outvalUnits .= ' - ' . $unitToShow;
}
if (!empty($objp->volume) && $objp->volume_units !== null) {
$unitToShow = showDimensionInBestUnit($objp->volume, $objp->volume_units, 'volume', $langs);
- $outvalUnits .= ' - '.$unitToShow;
+ $outvalUnits .= ' - ' . $unitToShow;
}
}
if ($outdurationvalue && $outdurationunit) {
@@ -2988,14 +3004,14 @@ class Form
'y' => $langs->trans('Year')
);
if (isset($da[$outdurationunit])) {
- $outvalUnits .= ' - '.$outdurationvalue.' '.$langs->transnoentities($da[$outdurationunit].($outdurationvalue > 1 ? 's' : ''));
+ $outvalUnits .= ' - ' . $outdurationvalue . ' ' . $langs->transnoentities($da[$outdurationunit] . ($outdurationvalue > 1 ? 's' : ''));
}
}
- $opt = '\n";
$optJson = array(
- 'key'=>$outkey,
- 'value'=>$outref,
- 'label'=>$outval,
- 'label2'=>$outlabel,
- 'desc'=>$outdesc,
- 'type'=>$outtype,
- 'price_ht'=>price2num($outprice_ht),
- 'price_ttc'=>price2num($outprice_ttc),
- 'price_ht_locale'=>price(price2num($outprice_ht)),
- 'price_ttc_locale'=>price(price2num($outprice_ttc)),
- 'pricebasetype'=>$outpricebasetype,
- 'tva_tx'=>$outtva_tx,
- 'default_vat_code'=>$outdefault_vat_code,
- 'qty'=>$outqty,
- 'discount'=>$outdiscount,
- 'duration_value'=>$outdurationvalue,
- 'duration_unit'=>$outdurationunit,
- 'pbq'=>$outpbq,
- 'labeltrans'=>$outlabel_translated,
- 'desctrans'=>$outdesc_translated,
- 'ref_customer'=>$outrefcust
+ 'key' => $outkey,
+ 'value' => $outref,
+ 'label' => $outval,
+ 'label2' => $outlabel,
+ 'desc' => $outdesc,
+ 'type' => $outtype,
+ 'price_ht' => price2num($outprice_ht),
+ 'price_ttc' => price2num($outprice_ttc),
+ 'price_ht_locale' => price(price2num($outprice_ht)),
+ 'price_ttc_locale' => price(price2num($outprice_ttc)),
+ 'pricebasetype' => $outpricebasetype,
+ 'tva_tx' => $outtva_tx,
+ 'default_vat_code' => $outdefault_vat_code,
+ 'qty' => $outqty,
+ 'discount' => $outdiscount,
+ 'duration_value' => $outdurationvalue,
+ 'duration_unit' => $outdurationunit,
+ 'pbq' => $outpbq,
+ 'labeltrans' => $outlabel_translated,
+ 'desctrans' => $outdesc_translated,
+ 'ref_customer' => $outrefcust
);
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
+
/**
- * Return list of products for customer (in Ajax if Ajax activated or go to select_produits_fournisseurs_list)
+ * Return list of products for customer (in Ajax if Ajax activated or go to select_produits_fournisseurs_list)
*
- * @param int $socid Id third party
- * @param string $selected Preselected product
- * @param string $htmlname Name of HTML Select
- * @param string $filtertype Filter on product type (''=nofilter, 0=product, 1=service)
- * @param string $filtre For a SQL filter
- * @param array $ajaxoptions Options for ajax_autocompleter
- * @param int $hidelabel Hide label (0=no, 1=yes)
- * @param int $alsoproductwithnosupplierprice 1=Add also product without supplier prices
- * @param string $morecss More CSS
- * @param string $placeholder Placeholder
- * @return void
+ * @param int $socid Id third party
+ * @param string $selected Preselected product
+ * @param string $htmlname Name of HTML Select
+ * @param string $filtertype Filter on product type (''=nofilter, 0=product, 1=service)
+ * @param string $filtre For a SQL filter
+ * @param array $ajaxoptions Options for ajax_autocompleter
+ * @param int $hidelabel Hide label (0=no, 1=yes)
+ * @param int $alsoproductwithnosupplierprice 1=Add also product without supplier prices
+ * @param string $morecss More CSS
+ * @param string $placeholder Placeholder
+ * @return void
*/
public function select_produits_fournisseurs($socid, $selected = '', $htmlname = 'productid', $filtertype = '', $filtre = '', $ajaxoptions = array(), $hidelabel = 0, $alsoproductwithnosupplierprice = 0, $morecss = '', $placeholder = '')
{
@@ -3244,7 +3261,7 @@ class Form
$selected_input_value = '';
if (!empty($conf->use_javascript_ajax) && !empty($conf->global->PRODUIT_USE_SEARCH_TO_SELECT)) {
if ($selected > 0) {
- require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
+ require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
$producttmpselect = new Product($this->db);
$producttmpselect->fetch($selected);
$selected_input_value = $producttmpselect->ref;
@@ -3252,33 +3269,34 @@ class Form
}
// mode=2 means suppliers products
- $urloption = ($socid > 0 ? 'socid='.$socid.'&' : '').'htmlname='.$htmlname.'&outjson=1&price_level='.$price_level.'&type='.$filtertype.'&mode=2&status='.$status.'&finished='.$finished.'&alsoproductwithnosupplierprice='.$alsoproductwithnosupplierprice;
- print ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/product/ajax/products.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 0, $ajaxoptions);
+ $urloption = ($socid > 0 ? 'socid=' . $socid . '&' : '') . 'htmlname=' . $htmlname . '&outjson=1&price_level=' . $price_level . '&type=' . $filtertype . '&mode=2&status=' . $status . '&finished=' . $finished . '&alsoproductwithnosupplierprice=' . $alsoproductwithnosupplierprice;
+ print ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/product/ajax/products.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 0, $ajaxoptions);
- print ($hidelabel ? '' : $langs->trans("RefOrLabel").' : ').'';
+ print ($hidelabel ? '' : $langs->trans("RefOrLabel") . ' : ') . '';
} else {
print $this->select_produits_fournisseurs_list($socid, $selected, $htmlname, $filtertype, $filtre, '', $status, 0, 0, $alsoproductwithnosupplierprice, $morecss, 0, $placeholder);
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
+
/**
- * Return list of suppliers products
+ * Return list of suppliers products
*
- * @param int $socid Id of supplier thirdparty (0 = no filter)
- * @param int $selected Product price pre-selected (must be 'id' in product_fournisseur_price or 'idprod_IDPROD')
- * @param string $htmlname Name of HTML select
- * @param string $filtertype Filter on product type (''=nofilter, 0=product, 1=service)
- * @param string $filtre Generic filter. Data must not come from user input.
- * @param string $filterkey Filter of produdts
- * @param int $statut -1=Return all products, 0=Products not on buy, 1=Products on buy
- * @param int $outputmode 0=HTML select string, 1=Array
- * @param int $limit Limit of line number
- * @param int $alsoproductwithnosupplierprice 1=Add also product without supplier prices
- * @param string $morecss Add more CSS
- * @param int $showstockinlist Show stock information (slower).
- * @param string $placeholder Placeholder
- * @return array|string Array of keys for json or HTML component
+ * @param int $socid Id of supplier thirdparty (0 = no filter)
+ * @param int $selected Product price pre-selected (must be 'id' in product_fournisseur_price or 'idprod_IDPROD')
+ * @param string $htmlname Name of HTML select
+ * @param string $filtertype Filter on product type (''=nofilter, 0=product, 1=service)
+ * @param string $filtre Generic filter. Data must not come from user input.
+ * @param string $filterkey Filter of produdts
+ * @param int $statut -1=Return all products, 0=Products not on buy, 1=Products on buy
+ * @param int $outputmode 0=HTML select string, 1=Array
+ * @param int $limit Limit of line number
+ * @param int $alsoproductwithnosupplierprice 1=Add also product without supplier prices
+ * @param string $morecss Add more CSS
+ * @param int $showstockinlist Show stock information (slower).
+ * @param string $placeholder Placeholder
+ * @return array|string Array of keys for json or HTML component
*/
public function select_produits_fournisseurs_list($socid, $selected = '', $htmlname = 'productid', $filtertype = '', $filtre = '', $filterkey = '', $statut = -1, $outputmode = 0, $limit = 100, $alsoproductwithnosupplierprice = 0, $morecss = '', $showstockinlist = 0, $placeholder = '')
{
@@ -3314,25 +3332,25 @@ class Form
if (isModEnabled('barcode')) {
$sql .= ", pfp.barcode";
}
- $sql .= " FROM ".$this->db->prefix()."product as p";
- $sql .= " LEFT JOIN ".$this->db->prefix()."product_fournisseur_price as pfp ON ( p.rowid = pfp.fk_product AND pfp.entity IN (".getEntity('product').") )";
+ $sql .= " FROM " . $this->db->prefix() . "product as p";
+ $sql .= " LEFT JOIN " . $this->db->prefix() . "product_fournisseur_price as pfp ON ( p.rowid = pfp.fk_product AND pfp.entity IN (" . getEntity('product') . ") )";
if ($socid > 0) {
- $sql .= " AND pfp.fk_soc = ".((int) $socid);
+ $sql .= " AND pfp.fk_soc = " . ((int) $socid);
}
- $sql .= " LEFT JOIN ".$this->db->prefix()."societe as s ON pfp.fk_soc = s.rowid";
+ $sql .= " LEFT JOIN " . $this->db->prefix() . "societe as s ON pfp.fk_soc = s.rowid";
// Units
if (getDolGlobalInt('PRODUCT_USE_UNITS')) {
- $sql .= " LEFT JOIN ".$this->db->prefix()."c_units u ON u.rowid = p.fk_unit";
+ $sql .= " LEFT JOIN " . $this->db->prefix() . "c_units u ON u.rowid = p.fk_unit";
}
- $sql .= " WHERE p.entity IN (".getEntity('product').")";
+ $sql .= " WHERE p.entity IN (" . getEntity('product') . ")";
if ($statut != -1) {
- $sql .= " AND p.tobuy = ".((int) $statut);
+ $sql .= " AND p.tobuy = " . ((int) $statut);
}
if (strval($filtertype) != '') {
- $sql .= " AND p.fk_product_type = ".((int) $filtertype);
+ $sql .= " AND p.fk_product_type = " . ((int) $filtertype);
}
if (!empty($filtre)) {
- $sql .= " ".$filtre;
+ $sql .= " " . $filtre;
}
// Add where from hooks
$parameters = array();
@@ -3352,9 +3370,9 @@ class Form
if ($i > 0) {
$sql .= " AND ";
}
- $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)."%'";
+ $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) . "%'";
if (!empty($conf->global->PRODUIT_FOURN_TEXTS)) {
- $sql .= " OR pfp.desc_fourn LIKE '".$this->db->escape($prefix.$crit)."%'";
+ $sql .= " OR pfp.desc_fourn LIKE '" . $this->db->escape($prefix . $crit) . "%'";
}
$sql .= ")";
$i++;
@@ -3363,8 +3381,8 @@ class Form
$sql .= ")";
}
if (isModEnabled('barcode')) {
- $sql .= " OR p.barcode LIKE '".$this->db->escape($prefix.$filterkey)."%'";
- $sql .= " OR pfp.barcode LIKE '".$this->db->escape($prefix.$filterkey)."%'";
+ $sql .= " OR p.barcode LIKE '" . $this->db->escape($prefix . $filterkey) . "%'";
+ $sql .= " OR pfp.barcode LIKE '" . $this->db->escape($prefix . $filterkey) . "%'";
}
$sql .= ')';
}
@@ -3373,20 +3391,20 @@ class Form
// Build output string
- dol_syslog(get_class($this)."::select_produits_fournisseurs_list", LOG_DEBUG);
+ dol_syslog(get_class($this) . "::select_produits_fournisseurs_list", LOG_DEBUG);
$result = $this->db->query($sql);
if ($result) {
- require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php';
- require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php';
+ require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php';
+ require_once DOL_DOCUMENT_ROOT . '/core/lib/product.lib.php';
$num = $this->db->num_rows($result);
//$out.=''; // remove select to have id same with combo and ajax
- $out .= '';
+ $out .= '';
if (!$selected) {
- $out .= '';
+ $out .= '';
} else {
- $out .= '';
+ $out .= '';
}
$i = 0;
@@ -3401,7 +3419,7 @@ class Form
$outkey = $objp->idprodfournprice; // id in table of price
if (!$outkey && $alsoproductwithnosupplierprice) {
- $outkey = 'idprod_'.$objp->rowid; // id of product
+ $outkey = 'idprod_' . $objp->rowid; // id of product
}
$outref = $objp->ref;
@@ -3409,30 +3427,30 @@ class Form
$outqty = 1;
$outdiscount = 0;
$outtype = $objp->fk_product_type;
- $outdurationvalue = $outtype == Product::TYPE_SERVICE ?substr($objp->duration, 0, dol_strlen($objp->duration) - 1) : '';
- $outdurationunit = $outtype == Product::TYPE_SERVICE ?substr($objp->duration, -1) : '';
+ $outdurationvalue = $outtype == Product::TYPE_SERVICE ? substr($objp->duration, 0, dol_strlen($objp->duration) - 1) : '';
+ $outdurationunit = $outtype == Product::TYPE_SERVICE ? substr($objp->duration, -1) : '';
// Units
$outvalUnits = '';
if (getDolGlobalInt('PRODUCT_USE_UNITS')) {
if (!empty($objp->unit_short)) {
- $outvalUnits .= ' - '.$objp->unit_short;
+ $outvalUnits .= ' - ' . $objp->unit_short;
}
if (!empty($objp->weight) && $objp->weight_units !== null) {
$unitToShow = showDimensionInBestUnit($objp->weight, $objp->weight_units, 'weight', $langs);
- $outvalUnits .= ' - '.$unitToShow;
+ $outvalUnits .= ' - ' . $unitToShow;
}
if ((!empty($objp->length) || !empty($objp->width) || !empty($objp->height)) && $objp->length_units !== null) {
- $unitToShow = $objp->length.' x '.$objp->width.' x '.$objp->height.' '.measuringUnitString(0, 'size', $objp->length_units);
- $outvalUnits .= ' - '.$unitToShow;
+ $unitToShow = $objp->length . ' x ' . $objp->width . ' x ' . $objp->height . ' ' . measuringUnitString(0, 'size', $objp->length_units);
+ $outvalUnits .= ' - ' . $unitToShow;
}
if (!empty($objp->surface) && $objp->surface_units !== null) {
$unitToShow = showDimensionInBestUnit($objp->surface, $objp->surface_units, 'surface', $langs);
- $outvalUnits .= ' - '.$unitToShow;
+ $outvalUnits .= ' - ' . $unitToShow;
}
if (!empty($objp->volume) && $objp->volume_units !== null) {
$unitToShow = showDimensionInBestUnit($objp->volume, $objp->volume_units, 'volume', $langs);
- $outvalUnits .= ' - '.$unitToShow;
+ $outvalUnits .= ' - ' . $unitToShow;
}
if ($outdurationvalue && $outdurationunit) {
$da = array(
@@ -3443,41 +3461,41 @@ class Form
'y' => $langs->trans('Year')
);
if (isset($da[$outdurationunit])) {
- $outvalUnits .= ' - '.$outdurationvalue.' '.$langs->transnoentities($da[$outdurationunit].($outdurationvalue > 1 ? 's' : ''));
+ $outvalUnits .= ' - ' . $outdurationvalue . ' ' . $langs->transnoentities($da[$outdurationunit] . ($outdurationvalue > 1 ? 's' : ''));
}
}
}
$objRef = $objp->ref;
if ($filterkey && $filterkey != '') {
- $objRef = preg_replace('/('.preg_quote($filterkey, '/').')/i', '$1', $objRef, 1);
+ $objRef = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '$1', $objRef, 1);
}
$objRefFourn = $objp->ref_fourn;
if ($filterkey && $filterkey != '') {
- $objRefFourn = preg_replace('/('.preg_quote($filterkey, '/').')/i', '$1', $objRefFourn, 1);
+ $objRefFourn = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '$1', $objRefFourn, 1);
}
$label = $objp->label;
if ($filterkey && $filterkey != '') {
- $label = preg_replace('/('.preg_quote($filterkey, '/').')/i', '$1', $label, 1);
+ $label = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '$1', $label, 1);
}
$optlabel = $objp->ref;
if (!empty($objp->idprodfournprice) && ($objp->ref != $objp->ref_fourn)) {
- $optlabel .= ' ('.$objp->ref_fourn.')';
+ $optlabel .= ' (' . $objp->ref_fourn . ')';
}
if (isModEnabled('barcode') && !empty($objp->barcode)) {
- $optlabel .= ' ('.$outbarcode.')';
+ $optlabel .= ' (' . $outbarcode . ')';
}
- $optlabel .= ' - '.dol_trunc($label, $maxlengtharticle);
+ $optlabel .= ' - ' . dol_trunc($label, $maxlengtharticle);
$outvallabel = $objRef;
if (!empty($objp->idprodfournprice) && ($objp->ref != $objp->ref_fourn)) {
- $outvallabel .= ' ('.$objRefFourn.')';
+ $outvallabel .= ' (' . $objRefFourn . ')';
}
if (isModEnabled('barcode') && !empty($objp->barcode)) {
- $outvallabel .= ' ('.$outbarcode.')';
+ $outvallabel .= ' (' . $outbarcode . ')';
}
- $outvallabel .= ' - '.dol_trunc($label, $maxlengtharticle);
+ $outvallabel .= ' - ' . dol_trunc($label, $maxlengtharticle);
// Units
$optlabel .= $outvalUnits;
@@ -3494,7 +3512,7 @@ class Form
$prod_supplier->fourn_tva_tx = $objp->tva_tx;
$prod_supplier->fk_supplier_price_expression = $objp->fk_supplier_price_expression;
- require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php';
+ require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php';
$priceparser = new PriceParser($this->db);
$price_result = $priceparser->parseProductSupplier($prod_supplier);
if ($price_result >= 0) {
@@ -3505,48 +3523,48 @@ class Form
}
}
if ($objp->quantity == 1) {
- $optlabel .= ' - '.price($objp->fprice * (!empty($conf->global->DISPLAY_DISCOUNTED_SUPPLIER_PRICE) ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency)."/";
- $outvallabel .= ' - '.price($objp->fprice * (!empty($conf->global->DISPLAY_DISCOUNTED_SUPPLIER_PRICE) ? (1 - $objp->remise_percent / 100) : 1), 0, $langs, 0, 0, -1, $conf->currency)."/";
+ $optlabel .= ' - ' . price($objp->fprice * (!empty($conf->global->DISPLAY_DISCOUNTED_SUPPLIER_PRICE) ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency) . "/";
+ $outvallabel .= ' - ' . price($objp->fprice * (!empty($conf->global->DISPLAY_DISCOUNTED_SUPPLIER_PRICE) ? (1 - $objp->remise_percent / 100) : 1), 0, $langs, 0, 0, -1, $conf->currency) . "/";
$optlabel .= $langs->trans("Unit"); // Do not use strtolower because it breaks utf8 encoding
$outvallabel .= $langs->transnoentities("Unit");
} else {
- $optlabel .= ' - '.price($objp->fprice * (!empty($conf->global->DISPLAY_DISCOUNTED_SUPPLIER_PRICE) ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity;
- $outvallabel .= ' - '.price($objp->fprice * (!empty($conf->global->DISPLAY_DISCOUNTED_SUPPLIER_PRICE) ? (1 - $objp->remise_percent / 100) : 1), 0, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity;
- $optlabel .= ' '.$langs->trans("Units"); // Do not use strtolower because it breaks utf8 encoding
- $outvallabel .= ' '.$langs->transnoentities("Units");
+ $optlabel .= ' - ' . price($objp->fprice * (!empty($conf->global->DISPLAY_DISCOUNTED_SUPPLIER_PRICE) ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency) . "/" . $objp->quantity;
+ $outvallabel .= ' - ' . price($objp->fprice * (!empty($conf->global->DISPLAY_DISCOUNTED_SUPPLIER_PRICE) ? (1 - $objp->remise_percent / 100) : 1), 0, $langs, 0, 0, -1, $conf->currency) . "/" . $objp->quantity;
+ $optlabel .= ' ' . $langs->trans("Units"); // Do not use strtolower because it breaks utf8 encoding
+ $outvallabel .= ' ' . $langs->transnoentities("Units");
}
if ($objp->quantity > 1) {
- $optlabel .= " (".price($objp->unitprice * (!empty($conf->global->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
- $outvallabel .= " (".price($objp->unitprice * (!empty($conf->global->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
+ $optlabel .= " (" . price($objp->unitprice * (!empty($conf->global->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
+ $outvallabel .= " (" . price($objp->unitprice * (!empty($conf->global->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
}
if ($objp->remise_percent >= 1) {
- $optlabel .= " - ".$langs->trans("Discount")." : ".vatrate($objp->remise_percent).' %';
- $outvallabel .= " - ".$langs->transnoentities("Discount")." : ".vatrate($objp->remise_percent).' %';
+ $optlabel .= " - " . $langs->trans("Discount") . " : " . vatrate($objp->remise_percent) . ' %';
+ $outvallabel .= " - " . $langs->transnoentities("Discount") . " : " . vatrate($objp->remise_percent) . ' %';
}
if ($objp->duration) {
- $optlabel .= " - ".$objp->duration;
- $outvallabel .= " - ".$objp->duration;
+ $optlabel .= " - " . $objp->duration;
+ $outvallabel .= " - " . $objp->duration;
}
if (!$socid) {
- $optlabel .= " - ".dol_trunc($objp->name, 8);
- $outvallabel .= " - ".dol_trunc($objp->name, 8);
+ $optlabel .= " - " . dol_trunc($objp->name, 8);
+ $outvallabel .= " - " . dol_trunc($objp->name, 8);
}
if ($objp->supplier_reputation) {
//TODO dictionary
- $reputations = array(''=>$langs->trans('Standard'), 'FAVORITE'=>$langs->trans('Favorite'), 'NOTTHGOOD'=>$langs->trans('NotTheGoodQualitySupplier'), 'DONOTORDER'=>$langs->trans('DoNotOrderThisProductToThisSupplier'));
+ $reputations = array('' => $langs->trans('Standard'), 'FAVORITE' => $langs->trans('Favorite'), 'NOTTHGOOD' => $langs->trans('NotTheGoodQualitySupplier'), 'DONOTORDER' => $langs->trans('DoNotOrderThisProductToThisSupplier'));
- $optlabel .= " - ".$reputations[$objp->supplier_reputation];
- $outvallabel .= " - ".$reputations[$objp->supplier_reputation];
+ $optlabel .= " - " . $reputations[$objp->supplier_reputation];
+ $outvallabel .= " - " . $reputations[$objp->supplier_reputation];
}
} else {
if (empty($alsoproductwithnosupplierprice)) { // No supplier price defined for couple product/supplier
- $optlabel .= " - ".$langs->trans("NoPriceDefinedForThisSupplier").'';
- $outvallabel .= ' - '.$langs->transnoentities("NoPriceDefinedForThisSupplier");
+ $optlabel .= " - " . $langs->trans("NoPriceDefinedForThisSupplier") . '';
+ $outvallabel .= ' - ' . $langs->transnoentities("NoPriceDefinedForThisSupplier");
} else // No supplier price defined for product, even on other suppliers
{
- $optlabel .= " - ".$langs->trans("NoPriceDefinedForThisSupplier").'';
- $outvallabel .= ' - '.$langs->transnoentities("NoPriceDefinedForThisSupplier");
+ $optlabel .= " - " . $langs->trans("NoPriceDefinedForThisSupplier") . '';
+ $outvallabel .= ' - ' . $langs->transnoentities("NoPriceDefinedForThisSupplier");
}
}
@@ -3554,14 +3572,14 @@ class Form
$novirtualstock = ($showstockinlist == 2);
if (!empty($user->rights->stock->lire)) {
- $outvallabel .= ' - '.$langs->trans("Stock").': '.price(price2num($objp->stock, 'MS'));
+ $outvallabel .= ' - ' . $langs->trans("Stock") . ': ' . price(price2num($objp->stock, 'MS'));
if ($objp->stock > 0) {
$optlabel .= ' - ';
} elseif ($objp->stock <= 0) {
$optlabel .= ' - ';
}
- $optlabel .= $langs->transnoentities("Stock").':'.price(price2num($objp->stock, 'MS'));
+ $optlabel .= $langs->transnoentities("Stock") . ':' . price(price2num($objp->stock, 'MS'));
$optlabel .= '';
if (empty($novirtualstock) && !empty($conf->global->STOCK_SHOW_VIRTUAL_STOCK_IN_PRODUCTS_COMBO)) { // Warning, this option may slow down combo list generation
$langs->load("stocks");
@@ -3571,9 +3589,9 @@ class Form
$tmpproduct->load_virtual_stock();
$virtualstock = $tmpproduct->stock_theorique;
- $outvallabel .= ' - '.$langs->trans("VirtualStock").':'.$virtualstock;
+ $outvallabel .= ' - ' . $langs->trans("VirtualStock") . ':' . $virtualstock;
- $optlabel .= ' - '.$langs->transnoentities("VirtualStock").':';
+ $optlabel .= ' - ' . $langs->transnoentities("VirtualStock") . ':';
if ($virtualstock > 0) {
$optlabel .= '';
} elseif ($virtualstock <= 0) {
@@ -3587,7 +3605,7 @@ class Form
}
}
- $optstart = '\n";
+ $out .= $optstart . ' data-html="' . dol_escape_htmltag($optlabel) . '">' . $optlabel . "\n";
array_push(
$outarray,
- array('key'=>$outkey,
- 'value'=>$outref,
- 'label'=>$outvallabel,
- 'qty'=>$outqty,
- 'price_qty_ht'=>price2num($objp->fprice, 'MU'), // Keep higher resolution for price for the min qty
- 'price_qty_ht_locale'=>price($objp->fprice),
- 'price_unit_ht'=>price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price
- 'price_unit_ht_locale'=>price($objp->unitprice),
- 'price_ht'=>price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price (for compatibility)
+ array('key' => $outkey,
+ 'value' => $outref,
+ 'label' => $outvallabel,
+ 'qty' => $outqty,
+ 'price_qty_ht' => price2num($objp->fprice, 'MU'), // Keep higher resolution for price for the min qty
+ 'price_qty_ht_locale' => price($objp->fprice),
+ 'price_unit_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price
+ 'price_unit_ht_locale' => price($objp->unitprice),
+ 'price_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price (for compatibility)
'tva_tx_formated' => price($objp->tva_tx),
- 'tva_tx'=>price2num($objp->tva_tx),
- 'default_vat_code'=>$objp->default_vat_code,
- 'discount'=>$outdiscount,
- 'type'=>$outtype,
- 'duration_value'=>$outdurationvalue,
- 'duration_unit'=>$outdurationunit,
- 'disabled'=>(empty($objp->idprodfournprice) ? true : false),
- 'description'=>$objp->description
+ 'tva_tx' => price2num($objp->tva_tx),
+ 'default_vat_code' => $objp->default_vat_code,
+ 'discount' => $outdiscount,
+ 'type' => $outtype,
+ 'duration_value' => $outdurationvalue,
+ 'duration_unit' => $outdurationunit,
+ 'disabled' => (empty($objp->idprodfournprice) ? true : false),
+ 'description' => $objp->description
)
);
// Exemple of var_dump $outarray
@@ -3678,7 +3696,7 @@ class Form
$this->db->free($result);
- include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
+ include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
$out .= ajax_combobox($htmlname);
} else {
dol_print_error($this->db);
@@ -3691,13 +3709,14 @@ class Form
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
+
/**
- * Return list of suppliers prices for a product
+ * Return list of suppliers prices for a product
*
- * @param int $productid Id of product
- * @param string $htmlname Name of HTML field
- * @param int $selected_supplier Pre-selected supplier if more than 1 result
- * @return string
+ * @param int $productid Id of product
+ * @param string $htmlname Name of HTML field
+ * @param int $selected_supplier Pre-selected supplier if more than 1 result
+ * @return string
*/
public function select_product_fourn_price($productid, $htmlname = 'productfournpriceid', $selected_supplier = '')
{
@@ -3709,43 +3728,43 @@ class Form
$sql = "SELECT p.rowid, p.ref, p.label, p.price, p.duration, pfp.fk_soc,";
$sql .= " pfp.ref_fourn, pfp.rowid as idprodfournprice, pfp.price as fprice, pfp.remise_percent, pfp.quantity, pfp.unitprice,";
$sql .= " pfp.fk_supplier_price_expression, pfp.fk_product, pfp.tva_tx, s.nom as name";
- $sql .= " FROM ".$this->db->prefix()."product as p";
- $sql .= " LEFT JOIN ".$this->db->prefix()."product_fournisseur_price as pfp ON p.rowid = pfp.fk_product";
- $sql .= " LEFT JOIN ".$this->db->prefix()."societe as s ON pfp.fk_soc = s.rowid";
- $sql .= " WHERE pfp.entity IN (".getEntity('productsupplierprice').")";
+ $sql .= " FROM " . $this->db->prefix() . "product as p";
+ $sql .= " LEFT JOIN " . $this->db->prefix() . "product_fournisseur_price as pfp ON p.rowid = pfp.fk_product";
+ $sql .= " LEFT JOIN " . $this->db->prefix() . "societe as s ON pfp.fk_soc = s.rowid";
+ $sql .= " WHERE pfp.entity IN (" . getEntity('productsupplierprice') . ")";
$sql .= " AND p.tobuy = 1";
$sql .= " AND s.fournisseur = 1";
- $sql .= " AND p.rowid = ".((int) $productid);
+ $sql .= " AND p.rowid = " . ((int) $productid);
if (empty($conf->global->PRODUCT_BEST_SUPPLIER_PRICE_PRESELECTED)) {
$sql .= " ORDER BY s.nom, pfp.ref_fourn DESC";
} else {
$sql .= " ORDER BY pfp.unitprice ASC";
}
- dol_syslog(get_class($this)."::select_product_fourn_price", LOG_DEBUG);
+ dol_syslog(get_class($this) . "::select_product_fourn_price", LOG_DEBUG);
$result = $this->db->query($sql);
if ($result) {
$num = $this->db->num_rows($result);
- $form = '';
+ $form = '';
if (!$num) {
- $form .= '';
+ $form .= '';
} else {
- require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php';
+ require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php';
$form .= '';
$i = 0;
while ($i < $num) {
$objp = $this->db->fetch_object($result);
- $opt = '\n";
@@ -3800,28 +3819,29 @@ class Form
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
+
/**
* Return list of delivery address
*
- * @param string $selected Id contact pre-selectionn
- * @param int $socid Id of company
- * @param string $htmlname Name of HTML field
- * @param int $showempty Add an empty field
- * @return integer
+ * @param string $selected Id contact pre-selectionn
+ * @param int $socid Id of company
+ * @param string $htmlname Name of HTML field
+ * @param int $showempty Add an empty field
+ * @return integer
*/
public function select_address($selected, $socid, $htmlname = 'address_id', $showempty = 0)
{
// phpcs:enable
// looking for users
$sql = "SELECT a.rowid, a.label";
- $sql .= " FROM ".$this->db->prefix()."societe_address as a";
- $sql .= " WHERE a.fk_soc = ".((int) $socid);
+ $sql .= " FROM " . $this->db->prefix() . "societe_address as a";
+ $sql .= " WHERE a.fk_soc = " . ((int) $socid);
$sql .= " ORDER BY a.label ASC";
- dol_syslog(get_class($this)."::select_address", LOG_DEBUG);
+ dol_syslog(get_class($this) . "::select_address", LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql) {
- print '';
+ print '';
if ($showempty) {
print '';
}
@@ -3832,9 +3852,9 @@ class Form
$obj = $this->db->fetch_object($resql);
if ($selected && $selected == $obj->rowid) {
- print '';
+ print '';
} else {
- print '';
+ print '';
}
$i++;
}
@@ -3848,10 +3868,11 @@ class Form
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
+
/**
* Load into cache list of payment terms
*
- * @return int Nb of lines loaded, <0 if KO
+ * @return int Nb of lines loaded, <0 if KO
*/
public function load_cache_conditions_paiements()
{
@@ -3866,8 +3887,8 @@ class Form
dol_syslog(__METHOD__, LOG_DEBUG);
$sql = "SELECT rowid, code, libelle as label, deposit_percent";
- $sql .= " FROM ".$this->db->prefix().'c_payment_term';
- $sql .= " WHERE entity IN (".getEntity('c_payment_term').")";
+ $sql .= " FROM " . $this->db->prefix() . 'c_payment_term';
+ $sql .= " WHERE entity IN (" . getEntity('c_payment_term') . ")";
$sql .= " AND active > 0";
$sql .= " ORDER BY sortorder";
@@ -3879,7 +3900,7 @@ class Form
$obj = $this->db->fetch_object($resql);
// Si traduction existe, on l'utilise, sinon on prend le libelle par defaut
- $label = ($langs->trans("PaymentConditionShort".$obj->code) != ("PaymentConditionShort".$obj->code) ? $langs->trans("PaymentConditionShort".$obj->code) : ($obj->label != '-' ? $obj->label : ''));
+ $label = ($langs->trans("PaymentConditionShort" . $obj->code) != ("PaymentConditionShort" . $obj->code) ? $langs->trans("PaymentConditionShort" . $obj->code) : ($obj->label != '-' ? $obj->label : ''));
$this->cache_conditions_paiements[$obj->rowid]['code'] = $obj->code;
$this->cache_conditions_paiements[$obj->rowid]['label'] = $label;
$this->cache_conditions_paiements[$obj->rowid]['deposit_percent'] = $obj->deposit_percent;
@@ -3896,17 +3917,18 @@ class Form
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
+
/**
* Load int a cache property th elist of possible delivery delays.
*
- * @return int Nb of lines loaded, <0 if KO
+ * @return int Nb of lines loaded, <0 if KO
*/
public function load_cache_availability()
{
// phpcs:enable
global $langs;
- $num = count($this->cache_availability); // TODO Use $conf->cache['availability'] instead of $this->cache_availability
+ $num = count($this->cache_availability); // TODO Use $conf->cache['availability'] instead of $this->cache_availability
if ($num > 0) {
return 0; // Cache already loaded
}
@@ -3916,7 +3938,7 @@ class Form
$langs->load('propal');
$sql = "SELECT rowid, code, label, position";
- $sql .= " FROM ".$this->db->prefix().'c_availability';
+ $sql .= " FROM " . $this->db->prefix() . 'c_availability';
$sql .= " WHERE active > 0";
$resql = $this->db->query($sql);
@@ -3927,7 +3949,7 @@ class Form
$obj = $this->db->fetch_object($resql);
// Si traduction existe, on l'utilise, sinon on prend le libelle par defaut
- $label = ($langs->trans("AvailabilityType".$obj->code) != ("AvailabilityType".$obj->code) ? $langs->trans("AvailabilityType".$obj->code) : ($obj->label != '-' ? $obj->label : ''));
+ $label = ($langs->trans("AvailabilityType" . $obj->code) != ("AvailabilityType" . $obj->code) ? $langs->trans("AvailabilityType" . $obj->code) : ($obj->label != '-' ? $obj->label : ''));
$this->cache_availability[$obj->rowid]['code'] = $obj->code;
$this->cache_availability[$obj->rowid]['label'] = $label;
$this->cache_availability[$obj->rowid]['position'] = $obj->position;
@@ -3946,12 +3968,12 @@ class Form
/**
* Retourne la liste des types de delais de livraison possibles
*
- * @param int $selected Id du type de delais pre-selectionne
- * @param string $htmlname Nom de la zone select
- * @param string $filtertype To add a filter
- * @param int $addempty Add empty entry
- * @param string $morecss More CSS
- * @return void
+ * @param int $selected Id du type de delais pre-selectionne
+ * @param string $htmlname Nom de la zone select
+ * @param string $filtertype To add a filter
+ * @param int $addempty Add empty entry
+ * @param string $morecss More CSS
+ * @return void
*/
public function selectAvailabilityDelay($selected = '', $htmlname = 'availid', $filtertype = '', $addempty = 0, $morecss = '')
{
@@ -3959,17 +3981,17 @@ class Form
$this->load_cache_availability();
- dol_syslog(__METHOD__." selected=".$selected.", htmlname=".$htmlname, LOG_DEBUG);
+ dol_syslog(__METHOD__ . " selected=" . $selected . ", htmlname=" . $htmlname, LOG_DEBUG);
- print '';
+ print '';
if ($addempty) {
print '';
}
foreach ($this->cache_availability as $id => $arrayavailability) {
if ($selected == $id) {
- print '';
@@ -3984,19 +4006,19 @@ class Form
/**
* Load into cache cache_demand_reason, array of input reasons
*
- * @return int Nb of lines loaded, <0 if KO
+ * @return int Nb of lines loaded, <0 if KO
*/
public function loadCacheInputReason()
{
global $langs;
- $num = count($this->cache_demand_reason); // TODO Use $conf->cache['input_reason'] instead of $this->cache_demand_reason
+ $num = count($this->cache_demand_reason); // TODO Use $conf->cache['input_reason'] instead of $this->cache_demand_reason
if ($num > 0) {
return 0; // Cache already loaded
}
$sql = "SELECT rowid, code, label";
- $sql .= " FROM ".$this->db->prefix().'c_input_reason';
+ $sql .= " FROM " . $this->db->prefix() . 'c_input_reason';
$sql .= " WHERE active > 0";
$resql = $this->db->query($sql);
@@ -4009,14 +4031,14 @@ class Form
// Si traduction existe, on l'utilise, sinon on prend le libelle par defaut
$label = ($obj->label != '-' ? $obj->label : '');
- if ($langs->trans("DemandReasonType".$obj->code) != ("DemandReasonType".$obj->code)) {
- $label = $langs->trans("DemandReasonType".$obj->code); // So translation key DemandReasonTypeSRC_XXX will work
+ if ($langs->trans("DemandReasonType" . $obj->code) != ("DemandReasonType" . $obj->code)) {
+ $label = $langs->trans("DemandReasonType" . $obj->code); // So translation key DemandReasonTypeSRC_XXX will work
}
if ($langs->trans($obj->code) != $obj->code) {
$label = $langs->trans($obj->code); // So translation key SRC_XXX will work
}
- $tmparray[$obj->rowid]['id'] = $obj->rowid;
+ $tmparray[$obj->rowid]['id'] = $obj->rowid;
$tmparray[$obj->rowid]['code'] = $obj->code;
$tmparray[$obj->rowid]['label'] = $label;
$i++;
@@ -4033,16 +4055,16 @@ class Form
}
/**
- * Return list of input reason (events that triggered an object creation, like after sending an emailing, making an advert, ...)
+ * Return list of input reason (events that triggered an object creation, like after sending an emailing, making an advert, ...)
* List found into table c_input_reason loaded by loadCacheInputReason
*
- * @param int $selected Id or code of type origin to select by default
- * @param string $htmlname Nom de la zone select
- * @param string $exclude To exclude a code value (Example: SRC_PROP)
- * @param int $addempty Add an empty entry
- * @param string $morecss Add more css to the HTML select component
- * @param int $notooltip Do not show the tooltip for admin
- * @return void
+ * @param int $selected Id or code of type origin to select by default
+ * @param string $htmlname Nom de la zone select
+ * @param string $exclude To exclude a code value (Example: SRC_PROP)
+ * @param int $addempty Add an empty entry
+ * @param string $morecss Add more css to the HTML select component
+ * @param int $notooltip Do not show the tooltip for admin
+ * @return void
*/
public function selectInputReason($selected = '', $htmlname = 'demandreasonid', $exclude = '', $addempty = 0, $morecss = '', $notooltip = 0)
{
@@ -4050,9 +4072,9 @@ class Form
$this->loadCacheInputReason();
- print '';
+ print '';
if ($addempty) {
- print '';
+ print '';
}
foreach ($this->cache_demand_reason as $id => $arraydemandreason) {
if ($arraydemandreason['code'] == $exclude) {
@@ -4060,9 +4082,9 @@ class Form
}
if ($selected && ($selected == $arraydemandreason['id'] || $selected == $arraydemandreason['code'])) {
- print '';
}
- $out.= '';
+ $out .= '';
if ($user->admin && empty($noinfoadmin)) {
- $out.= info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
+ $out .= info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
}
- $out.= ajax_combobox($htmlname);
+ $out .= ajax_combobox($htmlname);
if ($deposit_percent >= 0) {
- $out .= ' ';
+ $out .= ' ';
$out .= $langs->trans('DepositPercent') . ' : ';
- $out .= '';
+ $out .= '';
$out .= '';
$out .= '
- '."\n";
*
- * @param string $page Url of page to call if confirmation is OK. Can contains parameters (param 'action' and 'confirm' will be reformated)
- * @param string $title Title
- * @param string $question Question
- * @param string $action Action
- * @param array|string $formquestion An array with complementary inputs to add into forms: array(array('label'=> ,'type'=> , 'size'=>, 'morecss'=>, 'moreattr'=>'autofocus' or 'style=...'))
- * 'type' can be 'text', 'password', 'checkbox', 'radio', 'date', 'datetime', 'select', 'multiselect', 'morecss',
- * 'other', 'onecolumn' or 'hidden'...
- * @param int|string $selectedchoice '' or 'no', or 'yes' or '1', 1, '0' or 0
- * @param int|string $useajax 0=No, 1=Yes use Ajax to show the popup, 2=Yes and also submit page with &confirm=no if choice is No, 'xxx'=Yes and preoutput confirm box with div id=dialog-confirm-xxx
- * @param int|string $height Force height of box (0 = auto)
- * @param int $width Force width of box ('999' or '90%'). Ignored and forced to 90% on smartphones.
- * @param int $disableformtag 1=Disable form tag. Can be used if we are already inside a
' . "\n";
- $formconfirm .= "\n\n";
- $formconfirm .= '';
$formconfirm .= "\n";
} else {
- $formconfirm .= "\n\n";
+ $formconfirm .= "\n\n";
if (empty($disableformtag)) {
- $formconfirm .= '\n";
@@ -5408,7 +5437,7 @@ class Form
if (!empty($conf->use_javascript_ajax)) {
$formconfirm .= '';
- $formconfirm .= ''."\n";
+ $formconfirm .= '' . "\n";
}
$formconfirm .= "\n";
@@ -5431,28 +5460,29 @@ class Form
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
+
/**
* Show a form to select a project
*
- * @param int $page Page
- * @param int $socid Id third party (-1=all, 0=only projects not linked to a third party, id=projects not linked or linked to third party id)
- * @param int $selected Id pre-selected project
- * @param string $htmlname Name of select field
- * @param int $discard_closed Discard closed projects (0=Keep,1=hide completely except $selected,2=Disable)
- * @param int $maxlength Max length
- * @param int $forcefocus Force focus on field (works with javascript only)
- * @param int $nooutput No print is done. String is returned.
- * @param string $textifnoproject Text to show if no project
- * @param string $morecss More CSS
- * @return string Return html content
+ * @param int $page Page
+ * @param int $socid Id third party (-1=all, 0=only projects not linked to a third party, id=projects not linked or linked to third party id)
+ * @param int $selected Id pre-selected project
+ * @param string $htmlname Name of select field
+ * @param int $discard_closed Discard closed projects (0=Keep,1=hide completely except $selected,2=Disable)
+ * @param int $maxlength Max length
+ * @param int $forcefocus Force focus on field (works with javascript only)
+ * @param int $nooutput No print is done. String is returned.
+ * @param string $textifnoproject Text to show if no project
+ * @param string $morecss More CSS
+ * @return string Return html content
*/
public function form_project($page, $socid, $selected = '', $htmlname = 'projectid', $discard_closed = 0, $maxlength = 20, $forcefocus = 0, $nooutput = 0, $textifnoproject = '', $morecss = '')
{
// phpcs:enable
global $langs;
- require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php';
- require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
+ require_once DOL_DOCUMENT_ROOT . '/core/lib/project.lib.php';
+ require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php';
$out = '';
@@ -5460,11 +5490,11 @@ class Form
$langs->load("project");
if ($htmlname != "none") {
- $out .= '';
} else {
$out .= '';
@@ -5473,7 +5503,7 @@ class Form
$projet->fetch($selected);
$out .= $projet->getNomUrl(0, '', 1);
} else {
- $out .= ''.$textifnoproject.'';
+ $out .= '' . $textifnoproject . '';
}
$out .= '';
}
@@ -5486,20 +5516,21 @@ class Form
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
+
/**
- * Show a form to select payment conditions
+ * Show a form to select payment conditions
*
- * @param int $page Page
- * @param string $selected Id condition pre-selectionne
- * @param string $htmlname Name of select html field
- * @param int $addempty Add empty entry
- * @param string $type Type ('direct-debit' or 'bank-transfer')
- * @param int $filtertype If > 0, include payment terms with deposit percentage (for objects other than invoices and invoice templates)
- * @param string $deposit_percent < 0 : deposit_percent input makes no sense (for example, in list filters)
- * 0 : use default deposit percentage from entry
- * > 0 : force deposit percentage (for example, from company object)
- * @param int $nooutput No print is done. String is returned.
- * @return string HTML output or ''
+ * @param int $page Page
+ * @param string $selected Id condition pre-selectionne
+ * @param string $htmlname Name of select html field
+ * @param int $addempty Add empty entry
+ * @param string $type Type ('direct-debit' or 'bank-transfer')
+ * @param int $filtertype If > 0, include payment terms with deposit percentage (for objects other than invoices and invoice templates)
+ * @param string $deposit_percent < 0 : deposit_percent input makes no sense (for example, in list filters)
+ * 0 : use default deposit percentage from entry
+ * > 0 : force deposit percentage (for example, from company object)
+ * @param int $nooutput No print is done. String is returned.
+ * @return string HTML output or ''
*/
public function form_conditions_reglement($page, $selected = '', $htmlname = 'cond_reglement_id', $addempty = 0, $type = '', $filtertype = -1, $deposit_percent = -1, $nooutput = 0)
{
@@ -5509,14 +5540,14 @@ class Form
$out = '';
if ($htmlname != "none") {
- $out .= '';
} else {
if ($selected) {
@@ -5546,26 +5577,27 @@ class Form
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
+
/**
* Show a form to select a delivery delay
*
- * @param int $page Page
- * @param string $selected Id condition pre-selectionne
- * @param string $htmlname Name of select html field
- * @param int $addempty Ajoute entree vide
- * @return void
+ * @param int $page Page
+ * @param string $selected Id condition pre-selectionne
+ * @param string $htmlname Name of select html field
+ * @param int $addempty Ajoute entree vide
+ * @return void
*/
public function form_availability($page, $selected = '', $htmlname = 'availability', $addempty = 0)
{
// phpcs:enable
global $langs;
if ($htmlname != "none") {
- print '';
} else {
if ($selected) {
@@ -5581,21 +5613,21 @@ class Form
* Output HTML form to select list of input reason (events that triggered an object creation, like after sending an emailing, making an advert, ...)
* List found into table c_input_reason loaded by loadCacheInputReason
*
- * @param string $page Page
- * @param string $selected Id condition pre-selectionne
- * @param string $htmlname Name of select html field
- * @param int $addempty Add empty entry
- * @return void
+ * @param string $page Page
+ * @param string $selected Id condition pre-selectionne
+ * @param string $htmlname Name of select html field
+ * @param int $addempty Add empty entry
+ * @return void
*/
public function formInputReason($page, $selected = '', $htmlname = 'demandreason', $addempty = 0)
{
global $langs;
if ($htmlname != "none") {
- print '';
} else {
if ($selected) {
@@ -5613,18 +5645,19 @@ class Form
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
+
/**
* Show a form + html select a date
*
- * @param string $page Page
- * @param string $selected Date preselected
- * @param string $htmlname Html name of date input fields or 'none'
- * @param int $displayhour Display hour selector
- * @param int $displaymin Display minutes selector
- * @param int $nooutput 1=No print output, return string
- * @param string $type 'direct-debit' or 'bank-transfer'
- * @return string
- * @see selectDate()
+ * @param string $page Page
+ * @param string $selected Date preselected
+ * @param string $htmlname Html name of date input fields or 'none'
+ * @param int $displayhour Display hour selector
+ * @param int $displaymin Display minutes selector
+ * @param int $nooutput 1=No print output, return string
+ * @param string $type 'direct-debit' or 'bank-transfer'
+ * @return string
+ * @see selectDate()
*/
public function form_date($page, $selected, $htmlname, $displayhour = 0, $displaymin = 0, $nooutput = 0, $type = '')
{
@@ -5634,17 +5667,17 @@ class Form
$ret = '';
if ($htmlname != "none") {
- $ret .= '';
} else {
if ($displayhour) {
@@ -5662,15 +5695,16 @@ class Form
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
+
/**
* Show a select form to choose a user
*
- * @param string $page Page
- * @param string $selected Id of user preselected
- * @param string $htmlname Name of input html field. If 'none', we just output the user link.
- * @param array $exclude List of users id to exclude
- * @param array $include List of users id to include
- * @return void
+ * @param string $page Page
+ * @param string $selected Id of user preselected
+ * @param string $htmlname Name of input html field. If 'none', we just output the user link.
+ * @param array $exclude List of users id to exclude
+ * @param array $include List of users id to include
+ * @return void
*/
public function form_users($page, $selected = '', $htmlname = 'userid', $exclude = '', $include = '')
{
@@ -5678,15 +5712,15 @@ class Form
global $langs;
if ($htmlname != "none") {
- print '';
} else {
if ($selected) {
- require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
+ require_once DOL_DOCUMENT_ROOT . '/user/class/user.class.php';
$theuser = new User($this->db);
$theuser->fetch($selected);
print $theuser->getNomUrl(1);
@@ -5698,18 +5732,19 @@ class Form
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
+
/**
* Show form with payment mode
*
- * @param string $page Page
- * @param int $selected Id mode pre-selectionne
- * @param string $htmlname Name of select html field
- * @param string $filtertype To filter on field type in llx_c_paiement ('CRDT' or 'DBIT' or array('code'=>xx,'label'=>zz))
- * @param int $active Active or not, -1 = all
- * @param int $addempty 1=Add empty entry
- * @param string $type Type ('direct-debit' or 'bank-transfer')
- * @param int $nooutput 1=Return string, no output
- * @return string HTML output or ''
+ * @param string $page Page
+ * @param int $selected Id mode pre-selectionne
+ * @param string $htmlname Name of select html field
+ * @param string $filtertype To filter on field type in llx_c_paiement ('CRDT' or 'DBIT' or array('code'=>xx,'label'=>zz))
+ * @param int $active Active or not, -1 = all
+ * @param int $addempty 1=Add empty entry
+ * @param string $type Type ('direct-debit' or 'bank-transfer')
+ * @param int $nooutput 1=Return string, no output
+ * @return string HTML output or ''
*/
public function form_modes_reglement($page, $selected = '', $htmlname = 'mode_reglement_id', $filtertype = '', $active = 1, $addempty = 0, $type = '', $nooutput = 0)
{
@@ -5718,14 +5753,14 @@ class Form
$out = '';
if ($htmlname != "none") {
- $out .= '';
} else {
if ($selected) {
@@ -5747,22 +5782,22 @@ class Form
/**
* Show form with transport mode
*
- * @param string $page Page
- * @param int $selected Id mode pre-select
- * @param string $htmlname Name of select html field
- * @param int $active Active or not, -1 = all
- * @param int $addempty 1=Add empty entry
- * @return void
+ * @param string $page Page
+ * @param int $selected Id mode pre-select
+ * @param string $htmlname Name of select html field
+ * @param int $active Active or not, -1 = all
+ * @param int $addempty 1=Add empty entry
+ * @return void
*/
public function formSelectTransportMode($page, $selected = '', $htmlname = 'transport_mode_id', $active = 1, $addempty = 0)
{
global $langs;
if ($htmlname != "none") {
- print '';
} else {
if ($selected) {
@@ -5775,24 +5810,25 @@ class Form
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
+
/**
* Show form with multicurrency code
*
- * @param string $page Page
- * @param string $selected code pre-selectionne
- * @param string $htmlname Name of select html field
- * @return void
+ * @param string $page Page
+ * @param string $selected code pre-selectionne
+ * @param string $htmlname Name of select html field
+ * @return void
*/
public function form_multicurrency_code($page, $selected = '', $htmlname = 'multicurrency_code')
{
// phpcs:enable
global $langs;
if ($htmlname != "none") {
- print '';
} else {
dol_include_once('/core/lib/company.lib.php');
@@ -5801,14 +5837,15 @@ class Form
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
+
/**
* Show form with multicurrency rate
*
- * @param string $page Page
- * @param double $rate Current rate
- * @param string $htmlname Name of select html field
- * @param string $currency Currency code to explain the rate
- * @return void
+ * @param string $page Page
+ * @param double $rate Current rate
+ * @param string $htmlname Name of select html field
+ * @param string $currency Currency code to explain the rate
+ * @return void
*/
public function form_multicurrency_rate($page, $rate = '', $htmlname = 'multicurrency_tx', $currency = '')
{
@@ -5816,21 +5853,21 @@ class Form
global $langs, $mysoc, $conf;
if ($htmlname != "none") {
- print '';
} else {
if (!empty($rate)) {
print price($rate, 1, $langs, 1, 0);
if ($currency && $rate != 1) {
- print ' ('.price($rate, 1, $langs, 1, 0).' '.$currency.' = 1 '.$conf->currency.')';
+ print ' (' . price($rate, 1, $langs, 1, 0) . ' ' . $currency . ' = 1 ' . $conf->currency . ')';
}
} else {
print 1;
@@ -5840,29 +5877,30 @@ class Form
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
+
/**
- * Show a select box with available absolute discounts
+ * Show a select box with available absolute discounts
*
- * @param string $page Page URL where form is shown
- * @param int $selected Value pre-selected
- * @param string $htmlname Name of SELECT component. If 'none', not changeable. Example 'remise_id'.
- * @param int $socid Third party id
- * @param float $amount Total amount available
- * @param string $filter SQL filter on discounts
- * @param int $maxvalue Max value for lines that can be selected
- * @param string $more More string to add
- * @param int $hidelist 1=Hide list
- * @param int $discount_type 0 => customer discount, 1 => supplier discount
- * @return void
+ * @param string $page Page URL where form is shown
+ * @param int $selected Value pre-selected
+ * @param string $htmlname Name of SELECT component. If 'none', not changeable. Example 'remise_id'.
+ * @param int $socid Third party id
+ * @param float $amount Total amount available
+ * @param string $filter SQL filter on discounts
+ * @param int $maxvalue Max value for lines that can be selected
+ * @param string $more More string to add
+ * @param int $hidelist 1=Hide list
+ * @param int $discount_type 0 => customer discount, 1 => supplier discount
+ * @return void
*/
public function form_remise_dispo($page, $selected, $htmlname, $socid, $amount, $filter = '', $maxvalue = 0, $more = '', $hidelist = 0, $discount_type = 0)
{
// phpcs:enable
global $conf, $langs;
if ($htmlname != "none") {
- print '