Merge remote-tracking branch 'Dolibarr/13.0' into 13

This commit is contained in:
Francis Appels 2021-05-06 20:00:56 +02:00
commit 99a4af1f81
11 changed files with 36 additions and 13 deletions

View File

@ -542,7 +542,7 @@ $cfg['ThemePerServer'] = FALSE; // allow diferent theme for each co
* %f will be replaced by a list of field names. * %f will be replaced by a list of field names.
* (%t and %f only applies to DefaultQueryTable) * (%t and %f only applies to DefaultQueryTable)
*/ */
$cfg['DefaultQueryTable'] = 'SELECT * FROM %t WHERE 1'; $cfg['DefaultQueryTable'] = 'SELECT * FROM %t WHERE 1 = 1';
$cfg['DefaultQueryDatabase'] = ''; $cfg['DefaultQueryDatabase'] = '';
/** /**

View File

@ -289,14 +289,13 @@ if (empty($reshook)) {
} }
} }
// Si verif ok et action add, on ajoute la ligne // If previous test is ok action is add, we add the line
if ($ok && GETPOST('actionadd')) if ($ok && GETPOST('actionadd')) {
{
// Add new entry // Add new entry
$sql = "INSERT INTO ".$tabname[$id]." ("; $sql = "INSERT INTO ".$tabname[$id]." (";
// List of fields // List of fields
$sql .= $tabfieldinsert[$id]; $sql .= $tabfieldinsert[$id];
$sql .= ",active)"; $sql .= ", active, enabled)";
$sql .= " VALUES("; $sql .= " VALUES(";
// List of values // List of values
@ -332,7 +331,7 @@ if (empty($reshook)) {
} }
$i++; $i++;
} }
$sql .= ", 1)"; $sql .= ", 1, 1)";
dol_syslog("actionadd", LOG_DEBUG); dol_syslog("actionadd", LOG_DEBUG);
$result = $db->query($sql); $result = $db->query($sql);

View File

@ -1676,6 +1676,28 @@ class Account extends CommonObject
$this->owner_address = 'Owner address'; $this->owner_address = 'Owner address';
$this->country_id = 1; $this->country_id = 1;
} }
/**
* Function used to replace a thirdparty id with another one.
*
* @param DoliDB $db Database handler
* @param int $origin_id Old thirdparty id
* @param int $dest_id New thirdparty id
* @return bool
*/
public static function replaceThirdparty($db, $origin_id, $dest_id)
{
$sql = "UPDATE ".MAIN_DB_PREFIX."bank_url SET url_id = ".((int) $dest_id)." WHERE url_id = ".((int) $origin_id)." AND type='company'";
if (!$db->query($sql))
{
//if ($ignoreerrors) return true; // TODO Not enough. If there is A-B on kept thirdarty and B-C on old one, we must get A-B-C after merge. Not A-B.
//$this->errors = $db->lasterror();
return false;
} else {
return true;
}
}
} }

View File

@ -68,7 +68,7 @@ if (GETPOST('sendit', 'alpha') && !empty($conf->global->MAIN_UPLOAD_DOC))
$link = GETPOST('link', 'alpha'); $link = GETPOST('link', 'alpha');
if ($link) if ($link)
{ {
if (substr($link, 0, 7) != 'http://' && substr($link, 0, 8) != 'https://' && substr($link, 0, 7) != 'file://') { if (substr($link, 0, 7) != 'http://' && substr($link, 0, 8) != 'https://' && substr($link, 0, 7) != 'file://' && substr($link, 0, 7) != 'davs://') {
$link = 'http://'.$link; $link = 'http://'.$link;
} }
dol_add_file_process($upload_dir, 0, 1, 'userfile', null, $link, '', 0); dol_add_file_process($upload_dir, 0, 1, 'userfile', null, $link, '', 0);

View File

@ -1870,7 +1870,7 @@ class FormFile
print '<td class="center">'.dol_print_date($link->datea, "dayhour", "tzuser").'</td>'; print '<td class="center">'.dol_print_date($link->datea, "dayhour", "tzuser").'</td>';
print '<td class="center"></td>'; print '<td class="center"></td>';
print '<td class="right">'; print '<td class="right">';
print '<a href="'.$_SERVER['PHP_SELF'].'?action=update&linkid='.$link->id.$param.'" class="editfilelink editfielda reposition" >'.img_edit().'</a>'; // id= is included into $param print '<a href="'.$_SERVER['PHP_SELF'].'?action=update&linkid='.$link->id.$param.'&token='.newToken().'" class="editfilelink editfielda reposition" >'.img_edit().'</a>'; // id= is included into $param
if ($permissiontodelete) { if ($permissiontodelete) {
print ' &nbsp; <a class="deletefilelink" href="'.$_SERVER['PHP_SELF'].'?action=delete&token='.newToken().'&linkid='.$link->id.$param.'">'.img_delete().'</a>'; // id= is included into $param print ' &nbsp; <a class="deletefilelink" href="'.$_SERVER['PHP_SELF'].'?action=delete&token='.newToken().'&linkid='.$link->id.$param.'">'.img_delete().'</a>'; // id= is included into $param
} else { } else {

View File

@ -8457,7 +8457,7 @@ function getDictvalue($tablename, $field, $id, $checkentity = false, $rowidfield
if (!isset($dictvalues[$tablename])) if (!isset($dictvalues[$tablename]))
{ {
$dictvalues[$tablename] = array(); $dictvalues[$tablename] = array();
$sql = 'SELECT * FROM '.$tablename.' WHERE 1'; // Here select * is allowed as it is generic code and we don't have list of fields $sql = 'SELECT * FROM '.$tablename.' WHERE 1 = 1'; // Here select * is allowed as it is generic code and we don't have list of fields
if ($checkentity) $sql .= ' AND entity IN (0,'.getEntity($tablename).')'; if ($checkentity) $sql .= ' AND entity IN (0,'.getEntity($tablename).')';
$resql = $db->query($sql); $resql = $db->query($sql);

View File

@ -583,4 +583,5 @@ insert into llx_c_actioncomm (id, code, type, libelle, module, active, position)
-- VMYSQL4.3 ALTER TABLE llx_accounting_bookkeeping MODIFY COLUMN montant double(24,8) NULL; -- VMYSQL4.3 ALTER TABLE llx_accounting_bookkeeping MODIFY COLUMN montant double(24,8) NULL;
-- VPGSQL8.2 ALTER TABLE llx_accounting_bookkeeping ALTER COLUMN montant DROP NOT NULL; -- VPGSQL8.2 ALTER TABLE llx_accounting_bookkeeping ALTER COLUMN montant DROP NOT NULL;
ALTER TABLE llx_export_model MODIFY COLUMN type varchar(64);

View File

@ -24,7 +24,7 @@ create table llx_export_model
rowid integer AUTO_INCREMENT PRIMARY KEY, rowid integer AUTO_INCREMENT PRIMARY KEY,
fk_user integer DEFAULT 0 NOT NULL, fk_user integer DEFAULT 0 NOT NULL,
label varchar(50) NOT NULL, label varchar(50) NOT NULL,
type varchar(20) NOT NULL, type varchar(64) NOT NULL,
field text NOT NULL, field text NOT NULL,
filter text filter text

View File

@ -254,7 +254,8 @@ if (empty($reshook))
'Product' => '/product/class/product.class.php', 'Product' => '/product/class/product.class.php',
'Project' => '/projet/class/project.class.php', 'Project' => '/projet/class/project.class.php',
'Ticket' => '/ticket/class/ticket.class.php', 'Ticket' => '/ticket/class/ticket.class.php',
'User' => '/user/class/user.class.php' 'User' => '/user/class/user.class.php',
'Account' => '/compta/bank/class/account.class.php',
); );
//First, all core objects must update their tables //First, all core objects must update their tables

View File

@ -318,7 +318,7 @@ if (!empty($sql_select))
if ($sref) $sql .= " AND ".$doc_number." LIKE '%".$db->escape($sref)."%'"; if ($sref) $sql .= " AND ".$doc_number." LIKE '%".$db->escape($sref)."%'";
if ($sprod_fulldescr) if ($sprod_fulldescr)
{ {
$sql .= " AND (d.description LIKE '%".$db->escape($sprod_fulldescr)."%'"; $sql .= " AND (d.description LIKE '%".$db->escape($sprod_fulldescr)."%' OR d.description LIKE '%".$db->escape(dol_htmlentities($sprod_fulldescr))."%'";
if (GETPOST('type_element') != 'fichinter') $sql .= " OR p.ref LIKE '%".$db->escape($sprod_fulldescr)."%'"; if (GETPOST('type_element') != 'fichinter') $sql .= " OR p.ref LIKE '%".$db->escape($sprod_fulldescr)."%'";
if (GETPOST('type_element') != 'fichinter') $sql .= " OR p.label LIKE '%".$db->escape($sprod_fulldescr)."%'"; if (GETPOST('type_element') != 'fichinter') $sql .= " OR p.label LIKE '%".$db->escape($sprod_fulldescr)."%'";
$sql .= ")"; $sql .= ")";

View File

@ -3425,7 +3425,7 @@ class User extends CommonObject
$sql .= " WHERE t.entity IN (".getEntity('user').")"; $sql .= " WHERE t.entity IN (".getEntity('user').")";
} }
} else { } else {
$sql .= " WHERE 1"; $sql .= " WHERE 1 = 1";
} }
// Manage filter // Manage filter