Merge branch '10.0' of git@github.com:Dolibarr/dolibarr.git into develop

Conflicts:
	htdocs/core/class/html.formother.class.php
	htdocs/core/lib/functions.lib.php
	htdocs/core/modules/commande/doc/pdf_einstein.modules.php
	htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php
	htdocs/core/modules/facture/doc/pdf_crabe.modules.php
	htdocs/core/modules/facture/doc/pdf_sponge.modules.php
	htdocs/core/modules/propale/doc/pdf_azur.modules.php
	htdocs/core/modules/propale/doc/pdf_cyan.modules.php
	htdocs/fourn/class/fournisseur.product.class.php
	htdocs/product/fournisseurs.php
	htdocs/user/card.php
This commit is contained in:
Laurent Destailleur 2019-11-14 21:30:16 +01:00
commit 1f5bea01f5
12 changed files with 77 additions and 38 deletions

View File

@ -174,7 +174,7 @@ class DolEditor
//$out.= '<textarea id="'.$this->htmlname.'" name="'.$this->htmlname.'" '.($this->readonly?' disabled':'').' rows="'.$this->rows.'"'.(preg_match('/%/',$this->cols)?' style="margin-top: 5px; width: '.$this->cols.'"':' cols="'.$this->cols.'"').' class="flat">';
// TODO We do not put the disabled tag because on a read form, it change style with grey.
$out.= '<textarea id="'.$this->htmlname.'" name="'.$this->htmlname.'" rows="'.$this->rows.'"'.(preg_match('/%/', $this->cols)?' style="margin-top: 5px; width: '.$this->cols.'"':' cols="'.$this->cols.'"').' class="flat">';
$out.= $this->content;
$out.= htmlspecialchars($this->content);
$out.= '</textarea>';
if ($this->tool == 'ckeditor' && ! empty($conf->use_javascript_ajax) && ! empty($conf->fckeditor->enabled))

View File

@ -754,7 +754,7 @@ class FormOther
} ); });
</script>';
}
$out .= '<input id="colorpicker'.$prefix.'" name="'.$prefix.'" size="6" maxlength="7" class="flat'.($morecss ? ' '.$morecss : '').'" type="text" value="'.$set_color.'" />';
$out .= '<input id="colorpicker'.$prefix.'" name="'.$prefix.'" size="6" maxlength="7" class="flat'.($morecss ? ' '.$morecss : '').'" type="text" value="'.dol_escape_htmltag($set_color).'" />';
}
else // In most cases, this is not used. We used instead function with no specific list of colors
{

View File

@ -5212,16 +5212,18 @@ function get_default_npr(Societe $thirdparty_seller, Societe $thirdparty_buyer,
if ($idprodfournprice > 0)
{
if (!class_exists('ProductFournisseur'))
if (!class_exists('ProductFournisseur')) {
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';
}
$prodprice = new ProductFournisseur($db);
$prodprice->fetch_product_fournisseur_price($idprodfournprice);
return $prodprice->fourn_tva_npr;
}
elseif ($idprod > 0)
{
if (!class_exists('Product'))
if (!class_exists('Product')) {
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
}
$prod = new Product($db);
$prod->fetch($idprod);
return $prod->tva_npr;

View File

@ -1258,9 +1258,15 @@ class pdf_einstein extends ModelePDFCommandes
// Logo
if (empty($conf->global->PDF_DISABLE_MYCOMPANY_LOGO))
{
$logo=$conf->mycompany->multidir_output[$object->entity].'/logos/'.$this->emetteur->logo;
if ($this->emetteur->logo)
{
if (empty($conf->global->MAIN_PDF_USE_LARGE_LOGO))
{
$logo=$conf->mycompany->multidir_output[$object->entity].'/logos/thumbs/'.$this->emetteur->logo_small;
}
else {
$logo=$conf->mycompany->multidir_output[$object->entity].'/logos/'.$this->emetteur->logo;
}
if (is_readable($logo))
{
$height=pdf_getHeightForLogo($logo);

View File

@ -1391,9 +1391,15 @@ class pdf_eratosthene extends ModelePDFCommandes
// Logo
if (empty($conf->global->PDF_DISABLE_MYCOMPANY_LOGO))
{
$logo=$conf->mycompany->multidir_output[$object->entity].'/logos/'.$this->emetteur->logo;
if ($this->emetteur->logo)
{
if (empty($conf->global->MAIN_PDF_USE_LARGE_LOGO))
{
$logo=$conf->mycompany->multidir_output[$object->entity].'/logos/thumbs/'.$this->emetteur->logo_small;
}
else {
$logo=$conf->mycompany->multidir_output[$object->entity].'/logos/'.$this->emetteur->logo;
}
if (is_readable($logo))
{
$height=pdf_getHeightForLogo($logo);

View File

@ -1616,9 +1616,15 @@ class pdf_crabe extends ModelePDFFactures
// Logo
if (empty($conf->global->PDF_DISABLE_MYCOMPANY_LOGO))
{
$logo = $conf->mycompany->multidir_output[$object->entity].'/logos/'.$this->emetteur->logo;
if ($this->emetteur->logo)
{
if (empty($conf->global->MAIN_PDF_USE_LARGE_LOGO))
{
$logo=$conf->mycompany->multidir_output[$object->entity].'/logos/thumbs/'.$this->emetteur->logo_small;
}
else {
$logo=$conf->mycompany->multidir_output[$object->entity].'/logos/'.$this->emetteur->logo;
}
if (is_readable($logo))
{
$height = pdf_getHeightForLogo($logo);

View File

@ -1832,9 +1832,15 @@ class pdf_sponge extends ModelePDFFactures
// Logo
if (empty($conf->global->PDF_DISABLE_MYCOMPANY_LOGO))
{
$logo=$conf->mycompany->multidir_output[$object->entity].'/logos/'.$this->emetteur->logo;
if ($this->emetteur->logo)
{
if (empty($conf->global->MAIN_PDF_USE_LARGE_LOGO))
{
$logo=$conf->mycompany->multidir_output[$object->entity].'/logos/thumbs/'.$this->emetteur->logo_small;
}
else {
$logo=$conf->mycompany->multidir_output[$object->entity].'/logos/'.$this->emetteur->logo;
}
if (is_readable($logo))
{
$height=pdf_getHeightForLogo($logo);

View File

@ -1460,9 +1460,15 @@ class pdf_azur extends ModelePDFPropales
// Logo
if (empty($conf->global->PDF_DISABLE_MYCOMPANY_LOGO))
{
$logo = $conf->mycompany->multidir_output[$object->entity].'/logos/'.$this->emetteur->logo;
if ($this->emetteur->logo)
{
if (empty($conf->global->MAIN_PDF_USE_LARGE_LOGO))
{
$logo=$conf->mycompany->multidir_output[$object->entity].'/logos/thumbs/'.$this->emetteur->logo_small;
}
else {
$logo=$conf->mycompany->multidir_output[$object->entity].'/logos/'.$this->emetteur->logo;
}
if (is_readable($logo))
{
$height = pdf_getHeightForLogo($logo);

View File

@ -1501,9 +1501,15 @@ class pdf_cyan extends ModelePDFPropales
// Logo
if (empty($conf->global->PDF_DISABLE_MYCOMPANY_LOGO))
{
$logo=$conf->mycompany->multidir_output[$object->entity].'/logos/'.$this->emetteur->logo;
if ($this->emetteur->logo)
{
if (empty($conf->global->MAIN_PDF_USE_LARGE_LOGO))
{
$logo=$conf->mycompany->multidir_output[$object->entity].'/logos/thumbs/'.$this->emetteur->logo_small;
}
else {
$logo=$conf->mycompany->multidir_output[$object->entity].'/logos/'.$this->emetteur->logo;
}
if (is_readable($logo))
{
$height=pdf_getHeightForLogo($logo);

View File

@ -503,7 +503,7 @@ class ProductFournisseur extends Product
$sql .= " pfp.multicurrency_price, pfp.multicurrency_unitprice, pfp.multicurrency_tx, pfp.fk_multicurrency, pfp.multicurrency_code,";
$sql .= " pfp.barcode, pfp.fk_barcode_type";
$sql .= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price as pfp";
$sql .= " WHERE pfp.rowid = ".$rowid;
$sql .= " WHERE pfp.rowid = ".(int) $rowid;
dol_syslog(get_class($this)."::fetch_product_fournisseur_price", LOG_DEBUG);
$resql = $this->db->query($sql);

View File

@ -259,8 +259,9 @@ if (empty($reshook))
{
$supplier = new Fournisseur($db);
$result = $supplier->fetch($id_fourn);
if (isset($_POST['ref_fourn_price_id']))
$object->fetch_product_fournisseur_price($_POST['ref_fourn_price_id']);
if (GETPOSTISSET('ref_fourn_price_id')) {
$object->fetch_product_fournisseur_price(GETPOST('ref_fourn_price_id', 'int'));
}
$extralabels = $extrafields->fetch_name_optionals_label("product_fournisseur_price");
$extrafield_values = $extrafields->getOptionalsFromPost("product_fournisseur_price");

View File

@ -803,12 +803,12 @@ if ($action == 'create' || $action == 'adduserldap')
print '<td>';
if (!empty($ldap_lastname))
{
print '<input type="hidden" id="lastname" name="lastname" value="'.$ldap_lastname.'">';
print '<input type="hidden" id="lastname" name="lastname" value="'.dol_escape_htmltag($ldap_lastname).'">';
print $ldap_lastname;
}
else
{
print '<input class="minwidth100" type="text" id="lastname" name="lastname" value="'.GETPOST('lastname').'">';
print '<input class="minwidth100" type="text" id="lastname" name="lastname" value="'.dol_escape_htmltag(GETPOST('lastname', 'alphanohtml')).'">';
}
print '</td></tr>';
@ -817,12 +817,12 @@ if ($action == 'create' || $action == 'adduserldap')
print '<td>';
if (!empty($ldap_firstname))
{
print '<input type="hidden" name="firstname" value="'.$ldap_firstname.'">';
print '<input type="hidden" name="firstname" value="'.dol_escape_htmltag($ldap_firstname).'">';
print $ldap_firstname;
}
else
{
print '<input class="minwidth100" type="text" name="firstname" value="'.GETPOST('firstname').'">';
print '<input class="minwidth100" type="text" name="firstname" value="'.dol_escape_htmltag(GETPOST('firstname', 'alphanohtml')).'">';
}
print '</td></tr>';
@ -831,17 +831,17 @@ if ($action == 'create' || $action == 'adduserldap')
print '<td>';
if (!empty($ldap_login))
{
print '<input type="hidden" name="login" value="'.$ldap_login.'">';
print '<input type="hidden" name="login" value="'.dol_escape_htmltag($ldap_login).'">';
print $ldap_login;
}
elseif (!empty($ldap_loginsmb))
{
print '<input type="hidden" name="login" value="'.$ldap_loginsmb.'">';
print '<input type="hidden" name="login" value="'.dol_escape_htmltag($ldap_loginsmb).'">';
print $ldap_loginsmb;
}
else
{
print '<input class="maxwidth200" maxsize="24" type="text" name="login" value="'.dol_escape_htmltag(GETPOST('login', 'alpha')).'">';
print '<input class="maxwidth200" maxsize="24" type="text" name="login" value="'.dol_escape_htmltag(GETPOST('login', 'alphanohtml')).'">';
}
print '</td></tr>';
@ -851,7 +851,7 @@ if ($action == 'create' || $action == 'adduserldap')
require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
$generated_password = getRandomPassword(false);
}
$password = $generated_password;
$password=(GETPOSTISSET('password')?GETPOST('password'):$generated_password);
// Password
print '<tr><td class="fieldrequired">'.$langs->trans("Password").'</td>';
@ -1045,12 +1045,12 @@ if ($action == 'create' || $action == 'adduserldap')
print '<td>';
if (!empty($ldap_phone))
{
print '<input type="hidden" name="office_phone" value="'.$ldap_phone.'">';
print '<input type="hidden" name="office_phone" value="'.dol_escape_htmltag($ldap_phone).'">';
print $ldap_phone;
}
else
{
print '<input size="20" type="text" name="office_phone" value="'.GETPOST('office_phone').'">';
print '<input size="20" type="text" name="office_phone" value="'.dol_escape_htmltag(GETPOST('office_phone', 'alphanohtml')).'">';
}
print '</td></tr>';
@ -1059,12 +1059,12 @@ if ($action == 'create' || $action == 'adduserldap')
print '<td>';
if (!empty($ldap_mobile))
{
print '<input type="hidden" name="user_mobile" value="'.$ldap_mobile.'">';
print '<input type="hidden" name="user_mobile" value="'.dol_escape_htmltag($ldap_mobile).'">';
print $ldap_mobile;
}
else
{
print '<input size="20" type="text" name="user_mobile" value="'.GETPOST('user_mobile').'">';
print '<input size="20" type="text" name="user_mobile" value="'.dol_escape_htmltag(GETPOST('user_mobile', 'alphanohtml')).'">';
}
print '</td></tr>';
@ -1073,12 +1073,12 @@ if ($action == 'create' || $action == 'adduserldap')
print '<td>';
if (!empty($ldap_fax))
{
print '<input type="hidden" name="office_fax" value="'.$ldap_fax.'">';
print '<input type="hidden" name="office_fax" value="'.dol_escape_htmltag($ldap_fax).'">';
print $ldap_fax;
}
else
{
print '<input size="20" type="text" name="office_fax" value="'.GETPOST('office_fax').'">';
print '<input size="20" type="text" name="office_fax" value="'.dol_escape_htmltag(GETPOST('office_fax', 'alphanohtml')).'">';
}
print '</td></tr>';
@ -1087,12 +1087,12 @@ if ($action == 'create' || $action == 'adduserldap')
print '<td>';
if (!empty($ldap_mail))
{
print '<input type="hidden" name="email" value="'.$ldap_mail.'">';
print '<input type="hidden" name="email" value="'.dol_escape_htmltag($ldap_mail).'">';
print $ldap_mail;
}
else
{
print '<input size="40" type="text" name="email" value="'.GETPOST('email').'">';
print '<input size="40" type="text" name="email" value="'.dol_escape_htmltag(GETPOST('email', 'alphanohtml')).'">';
}
print '</td></tr>';
@ -1191,7 +1191,7 @@ if ($action == 'create' || $action == 'adduserldap')
{
print '<tr><td>'.$langs->trans("AccountancyCode").'</td>';
print '<td>';
print '<input size="30" type="text" name="accountancy_code" value="'.GETPOST('accountancy_code').'">';
print '<input size="30" type="text" name="accountancy_code" value="'.dol_escape_htmltag(GETPOST('accountancy_code', 'alphanohtml')).'">';
print '</td></tr>';
}
@ -1200,7 +1200,7 @@ if ($action == 'create' || $action == 'adduserldap')
{
print '<tr><td>'.$langs->trans("ColorUser").'</td>';
print '<td>';
print $formother->selectColor(GETPOST('color') ?GETPOST('color') : $object->color, 'color', null, 1, '', 'hideifnotset');
print $formother->selectColor(GETPOSTISSET('color')?GETPOST('color', 'alphanohtml'):$object->color, 'color', null, 1, '', 'hideifnotset');
print '</td></tr>';
}
@ -1246,7 +1246,7 @@ if ($action == 'create' || $action == 'adduserldap')
print $langs->trans("Note");
print '</td><td>';
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor = new DolEditor('note', '', '', 120, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_SOCIETE, ROWS_3, '90%');
$doleditor = new DolEditor('note', GETPOSTISSET('note')?GETPOST('note', 'none'):'', '', 120, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_SOCIETE, ROWS_3, '90%');
$doleditor->Create();
print "</td></tr>\n";
@ -1275,7 +1275,7 @@ if ($action == 'create' || $action == 'adduserldap')
// Position/Job
print '<tr><td class="titlefieldcreate">'.$langs->trans("PostOrFunction").'</td>';
print '<td>';
print '<input class="maxwidth200" type="text" name="job" value="'.GETPOST('job', 'nohtml').'">';
print '<input class="maxwidth200" type="text" name="job" value="'.dol_escape_htmltag(GETPOST('job', 'nohtml')).'">';
print '</td></tr>';
if ((!empty($conf->salaries->enabled) && !empty($user->rights->salaries->read))
@ -1289,7 +1289,7 @@ if ($action == 'create' || $action == 'adduserldap')
print $form->textwithpicto($text, $langs->trans("THMDescription"), 1, 'help', 'classthm');
print '</td>';
print '<td>';
print '<input size="8" type="text" name="thm" value="'.GETPOST('thm').'">';
print '<input size="8" type="text" name="thm" value="'.dol_escape_htmltag(GETPOST('thm')).'">';
print '</td>';
print "</tr>\n";
@ -1299,14 +1299,14 @@ if ($action == 'create' || $action == 'adduserldap')
print $form->textwithpicto($text, $langs->trans("TJMDescription"), 1, 'help', 'classtjm');
print '</td>';
print '<td>';
print '<input size="8" type="text" name="tjm" value="'.GETPOST('tjm').'">';
print '<input size="8" type="text" name="tjm" value="'.dol_escape_htmltag(GETPOST('tjm')).'">';
print '</td>';
print "</tr>\n";
// Salary
print '<tr><td>'.$langs->trans("Salary").'</td>';
print '<td>';
print '<input size="8" type="text" name="salary" value="'.GETPOST('salary').'">';
print '<input size="8" type="text" name="salary" value="'.dol_escape_htmltag(GETPOST('salary')).'">';
print '</td>';
print "</tr>\n";
}
@ -1314,7 +1314,7 @@ if ($action == 'create' || $action == 'adduserldap')
// Weeklyhours
print '<tr><td>'.$langs->trans("WeeklyHours").'</td>';
print '<td>';
print '<input size="8" type="text" name="weeklyhours" value="'.GETPOST('weeklyhours').'">';
print '<input size="8" type="text" name="weeklyhours" value="'.dol_escape_htmltag(GETPOST('weeklyhours')).'">';
print '</td>';
print "</tr>\n";
@ -2596,7 +2596,7 @@ else
print '<td>';
if ($caneditfield)
{
print $formother->selectColor(GETPOST('color') ?GETPOST('color') : $object->color, 'color', null, 1, '', 'hideifnotset');
print $formother->selectColor(GETPOSTISSET('color')?GETPOST('color', 'alphanohtml'):$object->color, 'color', null, 1, '', 'hideifnotset');
} else {
print $formother->showColor($object->color, '');
}