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

This commit is contained in:
Laurent Destailleur 2021-07-08 20:59:48 +02:00
commit 797797d38b
13 changed files with 46 additions and 40 deletions

View File

@ -919,7 +919,6 @@ if ($mode == 'common' || $mode == 'commonkanban') {
if ($objMod->needUpdate) {
$versionTitle = $langs->trans('ModuleUpdateAvailable').' : '.$objMod->lastVersion;
print '<span class="badge badge-warning classfortooltip" title="'.dol_escape_htmltag($versionTitle).'">'.$versiontrans.'</span>';
$foundoneexternalmodulewithupdate++;
} else {
print $versiontrans;
}
@ -937,6 +936,9 @@ if ($mode == 'common' || $mode == 'commonkanban') {
print "</tr>\n";
}
if ($objMod->needUpdate) {
$foundoneexternalmodulewithupdate++;
}
}
if ($action == 'checklastversion') {

View File

@ -7492,6 +7492,9 @@ abstract class CommonObject
if ($display_type == 'card') {
$out .= '<tr '.($html_id ? 'id="'.$html_id.'" ' : '').$csstyle.' class="valuefieldcreate '.$class.$this->element.'_extras_'.$key.' trextrafields_collapse'.$extrafields_collapse_num.(!empty($this->id)?'_'.$this->id:'').'" '.$domData.' >';
if ( ! empty($conf->global->MAIN_VIEW_LINE_NUMBER) ) {
$out .= '<td></td>';
}
$out .= '<td class="wordbreak';
} elseif ($display_type == 'line') {
$out .= '<div '.($html_id ? 'id="'.$html_id.'" ' : '').$csstyle.' class="valuefieldlinecreate '.$class.$this->element.'_extras_'.$key.' trextrafields_collapse'.$extrafields_collapse_num.(!empty($this->id)?'_'.$this->id:'').'" '.$domData.' >';

View File

@ -390,7 +390,7 @@ class dolReceiptPrinter extends Printer
$error = 0;
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'printer_receipt';
$sql .= ' (name, fk_type, fk_profile, parameter, entity)';
$sql .= ' VALUES ("'.$this->db->escape($name).'", '.$type.', '.$profile.', "'.$this->db->escape($parameter).'", '.$conf->entity.')';
$sql .= ' VALUES ("'.$this->db->escape($name).'", '.((int) $type).', '.((int) $profile).', "'.$this->db->escape($parameter).'", '.$conf->entity.')';
$resql = $this->db->query($sql);
if (!$resql) {
$error++;
@ -415,10 +415,10 @@ class dolReceiptPrinter extends Printer
$error = 0;
$sql = 'UPDATE '.MAIN_DB_PREFIX.'printer_receipt';
$sql .= ' SET name="'.$this->db->escape($name).'"';
$sql .= ', fk_type='.$type;
$sql .= ', fk_profile='.$profile;
$sql .= ', fk_type='.((int) $type);
$sql .= ', fk_profile='.((int) $profile);
$sql .= ', parameter="'.$this->db->escape($parameter).'"';
$sql .= ' WHERE rowid='.$printerid;
$sql .= ' WHERE rowid='.((int) $printerid);
$resql = $this->db->query($sql);
if (!$resql) {
$error++;
@ -438,7 +438,7 @@ class dolReceiptPrinter extends Printer
global $conf;
$error = 0;
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.'printer_receipt';
$sql .= ' WHERE rowid='.$printerid;
$sql .= ' WHERE rowid='.((int) $printerid);
$resql = $this->db->query($sql);
if (!$resql) {
$error++;
@ -480,7 +480,7 @@ class dolReceiptPrinter extends Printer
global $conf;
$error = 0;
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.'printer_receipt_template';
$sql .= " WHERE rowid = ".((int) $this->db->escape($templateid));
$sql .= " WHERE rowid = ".((int) $templateid);
$sql .= " AND entity = ".$conf->entity;
$resql = $this->db->query($sql);
if (!$resql) {
@ -505,7 +505,7 @@ class dolReceiptPrinter extends Printer
$sql = 'UPDATE '.MAIN_DB_PREFIX.'printer_receipt_template';
$sql .= ' SET name="'.$this->db->escape($name).'"';
$sql .= ', template="'.$this->db->escape($template).'"';
$sql .= ' WHERE rowid='.$templateid;
$sql .= ' WHERE rowid='.((int) $templateid);
$resql = $this->db->query($sql);
if (!$resql) {
$error++;
@ -524,6 +524,7 @@ class dolReceiptPrinter extends Printer
public function sendTestToPrinter($printerid)
{
global $conf;
$error = 0;
$img = EscposImage::load(DOL_DOCUMENT_ROOT.'/theme/dolibarr_logo_bw.png');
//$this->profile = CapabilityProfile::load("TM-T88IV");
@ -543,7 +544,7 @@ class dolReceiptPrinter extends Printer
// If is DummyPrintConnector send to log to debugging
if ($this->printer->connector instanceof DummyPrintConnector) {
$data = $this->printer->connector-> getData();
$data = $this->printer->connector->getData();
dol_syslog($data);
}
$this->printer->close();
@ -899,7 +900,7 @@ class dolReceiptPrinter extends Printer
public function initPrinter($printerid)
{
global $conf;
if ($conf->global->TAKEPOS_PRINT_METHOD == "takeposconnector") {
if (getDolGlobalString('TAKEPOS_PRINT_METHOD') == "takeposconnector") {
$this->connector = new DummyPrintConnector();
$this->printer = new Printer($this->connector, $this->profile);
return;
@ -934,8 +935,8 @@ class dolReceiptPrinter extends Printer
$parameters = explode(':', $parameter);
$this->connector = new NetworkPrintConnector($parameters[0], $parameters[1]);
break;
case 4:
$this->connector = new WindowsPrintConnector($parameter);
case 4: // LPT1, smb://...
$this->connector = new WindowsPrintConnector(dol_sanitizePathName($parameter));
break;
case 5:
$this->connector = new CupsPrintConnector($parameter);

View File

@ -1075,7 +1075,8 @@ function dol_sanitizeFileName($str, $newstr = '_', $unaccent = 1)
}
/**
* Clean a string to use it as a path name
* Clean a string to use it as a path name.
* Replace also '--' and ' -' strings, they are used for parameters separation.
*
* @param string $str String to clean
* @param string $newstr String to replace bad chars with
@ -1087,7 +1088,10 @@ function dol_sanitizeFileName($str, $newstr = '_', $unaccent = 1)
function dol_sanitizePathName($str, $newstr = '_', $unaccent = 1)
{
$filesystem_forbidden_chars = array('<', '>', '?', '*', '|', '"', '°');
return dol_string_nospecial($unaccent ? dol_string_unaccent($str) : $str, $newstr, $filesystem_forbidden_chars);
$tmp = dol_string_nospecial($unaccent ? dol_string_unaccent($str) : $str, $newstr, $filesystem_forbidden_chars);
$tmp = preg_replace('/\-\-+/', '_', $tmp);
$tmp = preg_replace('/\s+\-/', ' _', $tmp);
return $tmp;
}
/**

View File

@ -906,7 +906,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
}
// Use MAIN_OPTIMIZEFORTEXTBROWSER
if ($foruserprofile) {
if ($foruserprofile && !empty($fuser->conf->MAIN_OPTIMIZEFORTEXTBROWSER)) {
//$default=yn($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER);
$default = $langs->trans('No');
print '<tr class="oddeven">';
@ -953,7 +953,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
// Use MAIN_OPTIMIZEFORTEXTBROWSER
if ($foruserprofile) {
if ($foruserprofile && !empty($fuser->conf->MAIN_OPTIMIZEFORCOLORBLIND)) {
//$default=yn($conf->global->MAIN_OPTIMIZEFORCOLORBLIND);
$default = $langs->trans('No');
print '<tr class="oddeven">';

View File

@ -1707,9 +1707,9 @@ function top_htmlhead($head, $title = '', $disablejs = 0, $disablehead = 0, $arr
print '<!-- Includes JS added by page -->'."\n";
foreach ($arrayofjs as $jsfile) {
if (preg_match('/^(http|\/\/)/i', $jsfile)) {
print '<script src="'.$jsfile.'"></script>'."\n";
print '<script src="'.$jsfile.($ext ? ((strpos($jsfile, '?') === false) ? '?' : '&').$ext : '').'"></script>'."\n";
} else {
print '<script src="'.dol_buildpath($jsfile, 1).'"></script>'."\n";
print '<script src="'.dol_buildpath($jsfile, 1).($ext ? ((strpos($jsfile, '?') === false) ? '?' : '&').$ext : '').'"></script>'."\n";
}
}
}

View File

@ -5282,17 +5282,6 @@ class Product extends CommonObject
}
$stock_commande_fournisseur = $this->stats_commande_fournisseur['qty'];
}
if (((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) && empty($conf->reception->enabled)) {
$filterStatus = '4';
if (isset($includedraftpoforvirtual)) {
$filterStatus = '0,'.$filterStatus;
}
$result = $this->load_stats_reception(0, $filterStatus, 1);
if ($result < 0) {
dol_print_error($this->db, $this->error);
}
$stock_reception_fournisseur = $this->stats_reception['qty'];
}
if (((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) && empty($conf->reception->enabled)) {
$filterStatus = '4';
if (isset($includedraftpoforvirtual)) {

View File

@ -506,7 +506,6 @@ if ($action != 'edit' && $action != 'create') { // If not bank account yet, $ac
$exp->id = $objp->rowid;
$exp->ref = $objp->ref;
$exp->fk_type = $objp->fk_type;
$exp->status = $objp->status;
print '<tr class="oddeven">';
@ -557,7 +556,7 @@ if ($action != 'edit' && $action != 'create') { // If not bank account yet, $ac
print_liste_field_titre("RIB");
print_liste_field_titre("IBAN");
print_liste_field_titre("BIC");
print_liste_field_titre('', $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'maxwidthsearch ');
print_liste_field_titre('', $_SERVER["PHP_SELF"], "", '', '', '', '', '', 'maxwidthsearch ');
print "</tr>\n";
if ($account->id > 0) {

View File

@ -1451,8 +1451,12 @@ if ($action == 'create' || $action == 'adduserldap') {
print '<span class="opacitymedium">'.$langs->trans("None").'</span>';
} else {
$huser = new User($db);
$huser->fetch($object->fk_user);
print $huser->getNomUrl(1);
if ($object->fk_user > 0) {
$huser->fetch($object->fk_user);
print $huser->getNomUrl(1);
} else {
print '<span class="opacitymedium">'.$langs->trans("None").'</span>';
}
}
print '</td>';
print "</tr>\n";

View File

@ -150,7 +150,9 @@ if ($id > 0) {
if (!empty($user->admin)) {
print '<tr><td class="titlefield">ClickToDial URL</td>';
print '<td class="valeur">';
$url = $conf->global->CLICKTODIAL_URL;
if (!empty($conf->global->CLICKTODIAL_URL)) {
$url = $conf->global->CLICKTODIAL_URL;
}
if (!empty($object->clicktodial_url)) {
$url = $object->clicktodial_url;
}

View File

@ -437,7 +437,7 @@ if ($result > 0) {
}
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'" name="formfilter">';
if ($optioncss != '') {
if (isset($optioncss) && $optioncss != '') {
print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
}
print '<input type="hidden" name="token" value="'.newToken().'">';

View File

@ -370,10 +370,12 @@ if ($action == 'edit') {
print empty($dolibarr_main_demo) ? '' : ' disabled="disabled"'; // Disabled for demo
print '> '.$langs->trans("UsePersonalValue").'</td>';
print '<td>';
if (!empty($tmparray[$object->conf->MAIN_LANDING_PAGE])) {
print $langs->trans($tmparray[$object->conf->MAIN_LANDING_PAGE]);
} else {
print $object->conf->MAIN_LANDING_PAGE;
if (!empty($object->conf->MAIN_LANDING_PAGE)) {
if (!empty($tmparray[$object->conf->MAIN_LANDING_PAGE])) {
print $langs->trans($tmparray[$object->conf->MAIN_LANDING_PAGE]);
} else {
print $object->conf->MAIN_LANDING_PAGE;
}
}
//print $form->selectarray('MAIN_LANDING_PAGE', $tmparray, (! empty($object->conf->MAIN_LANDING_PAGE)?$object->conf->MAIN_LANDING_PAGE:''), 0, 0, 0, '', 1);
print '</td></tr>';

View File

@ -407,7 +407,7 @@ if ($result) {
print '<td class="center nowrap">';
print img_picto($langs->trans("Active"), 'tick');
print '</td>';
} elseif (is_array($permsgroupbyentity[$entity])) {
} elseif (isset($permsgroupbyentity[$entity]) && is_array($permsgroupbyentity[$entity])) {
if (in_array($obj->id, $permsgroupbyentity[$entity])) { // Permission granted by group
if ($caneditperms) {
print '<td class="center">';