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

This commit is contained in:
Francis Appels 2021-01-19 20:49:47 +01:00
commit f91ac52ea8
13 changed files with 34 additions and 27 deletions

1
.gitignore vendored
View File

@ -16,6 +16,7 @@ default.properties
.DS_Store
.idea
*.iml
*.orig
Thumbs.db
/dolibarr_genesis.mp4
# Log files

View File

@ -223,7 +223,7 @@ if ($action == 'create')
print '<tr><td class="fieldrequired">'.$langs->trans("Date").'</td><td>';
$datepaye = dol_mktime(12, 0, 0, GETPOST("remonth", 'int'), GETPOST("reday", 'int'), GETPOST("reyear", 'int'));
$datepayment = empty($conf->global->MAIN_AUTOFILL_DATE) ? (GETPOSTISSET("remonth") ? $datepaye : -1) : 0;
$datepayment = empty($conf->global->MAIN_AUTOFILL_DATE) ? (GETPOSTISSET("remonth") ? $datepaye : -1) : '';
print $form->selectDate($datepayment, '', '', '', 0, "add_payment", 1, 1, 0, '', '', $charge->date_ech, '', 1, $langs->trans("DateOfSocialContribution"));
print "</td>";
print '</tr>';
@ -236,7 +236,7 @@ if ($action == 'create')
print '<tr>';
print '<td class="fieldrequired">'.$langs->trans('AccountToDebit').'</td>';
print '<td>';
$form->select_comptes(GETPOSTISSET("accountid") ? GETPOST("accountid") : $charge->accountid, "accountid", 0, '', 2); // Show opend bank account list
$form->select_comptes(GETPOSTISSET("accountid") ? GETPOST("accountid", 'int') : $charge->accountid, "accountid", 0, '', 2); // Show opend bank account list
print '</td></tr>';
// Number

View File

@ -5874,8 +5874,14 @@ abstract class CommonObject
} elseif (preg_match('/^(integer|link):(.*):(.*)/i', $val['type'], $reg)) {
$param['options'] = array($reg[2].':'.$reg[3] => 'N');
$type = 'link';
} elseif (preg_match('/^sellist:(.*):(.*):(.*):(.*)/i', $val['type'], $reg)) {
$param['options'] = array($reg[1].':'.$reg[2].':'.$reg[3].':'.$reg[4] => 'N');
} elseif (preg_match('/^(sellist):(.*):(.*):(.*):(.*)/i', $val['type'], $reg)) {
$param['options'] = array($reg[2].':'.$reg[3].':'.$reg[4].':'.$reg[5] => 'N');
$type = 'sellist';
} elseif (preg_match('/^(sellist):(.*):(.*):(.*)/i', $val['type'], $reg)) {
$param['options'] = array($reg[2].':'.$reg[3].':'.$reg[4] => 'N');
$type = 'sellist';
} elseif (preg_match('/^(sellist):(.*):(.*)/i', $val['type'], $reg)) {
$param['options'] = array($reg[2].':'.$reg[3] => 'N');
$type = 'sellist';
} elseif (preg_match('/varchar\((\d+)\)/', $val['type'], $reg)) {
$param['options'] = array();
@ -6042,24 +6048,20 @@ abstract class CommonObject
$keyList = (empty($InfoFieldList[2]) ? 'rowid' : $InfoFieldList[2].' as rowid');
if (count($InfoFieldList) > 4 && !empty($InfoFieldList[4]))
{
if (strpos($InfoFieldList[4], 'extra.') !== false)
{
if (count($InfoFieldList) > 4 && !empty($InfoFieldList[4])) {
if (strpos($InfoFieldList[4], 'extra.') !== false) {
$keyList = 'main.'.$InfoFieldList[2].' as rowid';
} else {
$keyList = $InfoFieldList[2].' as rowid';
}
}
if (count($InfoFieldList) > 3 && !empty($InfoFieldList[3]))
{
if (count($InfoFieldList) > 3 && !empty($InfoFieldList[3])) {
list($parentName, $parentField) = explode('|', $InfoFieldList[3]);
$keyList .= ', '.$parentField;
}
$fields_label = explode('|', $InfoFieldList[1]);
if (is_array($fields_label))
{
if (is_array($fields_label)) {
$keyList .= ', ';
$keyList .= implode(', ', $fields_label);
}
@ -6454,13 +6456,18 @@ abstract class CommonObject
$param['options'] = array();
if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) $param['options'] = $val['arrayofkeyval'];
if (preg_match('/^integer:(.*):(.*)/i', $val['type'], $reg))
{
if (preg_match('/^integer:(.*):(.*)/i', $val['type'], $reg)) {
$type = 'link';
$param['options'] = array($reg[1].':'.$reg[2]=>$reg[1].':'.$reg[2]);
} elseif (preg_match('/^sellist:(.*):(.*):(.*):(.*)/i', $val['type'], $reg)) {
$param['options'] = array($reg[1].':'.$reg[2].':'.$reg[3].':'.$reg[4] => 'N');
$type = 'sellist';
} elseif (preg_match('/^sellist:(.*):(.*):(.*)/i', $val['type'], $reg)) {
$param['options'] = array($reg[1].':'.$reg[2].':'.$reg[3] => 'N');
$type = 'sellist';
} elseif (preg_match('/^sellist:(.*):(.*)/i', $val['type'], $reg)) {
$param['options'] = array($reg[1].':'.$reg[2] => 'N');
$type = 'sellist';
}
$langfile = $val['langfile'];
@ -6551,8 +6558,7 @@ abstract class CommonObject
$selectkey = "rowid";
$keyList = 'rowid';
if (count($InfoFieldList) >= 3)
{
if (count($InfoFieldList) > 4 && !empty($InfoFieldList[4])) {
$selectkey = $InfoFieldList[2];
$keyList = $InfoFieldList[2].' as rowid';
}

View File

@ -290,7 +290,7 @@ class Utils
if (!empty($dolibarr_main_db_pass))
{
$paramcrypted .= ' -p"'.preg_replace('/./i', '*', $dolibarr_main_db_pass).'"';
$paramclear .= ' -p"'.str_replace(array('"', '`'), array('\"', '\`'), $dolibarr_main_db_pass).'"';
$paramclear .= ' -p"'.str_replace(array('"', '`', '$'), array('\"', '\`', '\$'), $dolibarr_main_db_pass).'"';
}
$handle = '';

View File

@ -36,6 +36,7 @@ if (!empty($extrafieldsobjectkey) && !empty($search_array_options) && is_array($
$mode_search = 0;
if (in_array($typ, array('int', 'double', 'real', 'price'))) $mode_search = 1; // Search on a numeric
if (in_array($typ, array('sellist', 'link')) && $crit != '0' && $crit != '-1') $mode_search = 2; // Search on a foreign key int
if (in_array($typ, array('sellist')) && !is_numeric($crit)) $mode_search = 0;// Search on a foreign key string
if (in_array($typ, array('chkbxlst', 'checkbox'))) $mode_search = 4; // Search on a multiselect field with sql type = text
if (is_array($crit)) $crit = implode(' ', $crit); // natural_search() expects a string
elseif ($typ === 'select' and is_string($crit) and strpos($crit, ' ') === false) {

View File

@ -280,13 +280,10 @@ class ProductFournisseur extends Product
}
// Multicurrency
$multicurrency_buyprice = null;
$multicurrency_unitBuyPrice = null;
$fk_multicurrency = null;
if (!empty($conf->multicurrency->enabled)) {
if (empty($multicurrency_tx)) $multicurrency_tx = 1;
if (empty($multicurrency_buyprice)) $multicurrency_buyprice = 0;
if (empty($multicurrency_buyprice)) $multicurrency_buyprice = 0;
if ($multicurrency_price_base_type == 'TTC')
{

View File

@ -343,6 +343,7 @@ ALTER TABLE llx_commande_fournisseurdet ADD INDEX idx_commande_fournisseurdet_fk
-- VMYSQL4.3 ALTER TABLE llx_c_shipment_mode MODIFY COLUMN tracking varchar(255) NULL;
-- VPGSQL8.2 ALTER TABLE llx_c_shipment_mode ALTER COLUMN tracking DROP NOT NULL;
INSERT INTO llx_c_shipment_mode (rowid,code,libelle,description,tracking,active) VALUES (9,'INPERSON', 'In person at your site', NULL, NULL, 0);
INSERT INTO llx_c_shipment_mode (rowid,code,libelle,description,tracking,active) VALUES (10,'FEDEX', 'Fedex', NULL, 'https://www.fedex.com/apps/fedextrack/index.html?tracknumbers={TRACKID}', 0);

View File

@ -70,7 +70,7 @@ class MyObject extends CommonObject
/**
* 'type' if the field format ('integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter]]', 'varchar(x)', 'double(24,8)', 'real', 'price', 'text', 'text:none', 'html', 'date', 'datetime', 'timestamp', 'duration', 'mail', 'phone', 'url', 'password')
* 'type' field format ('integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter]]', 'sellist:TableName:LabelFieldName[:KeyFieldName[:KeyFieldParent[:Filter]]]', 'varchar(x)', 'double(24,8)', 'real', 'price', 'text', 'text:none', 'html', 'date', 'datetime', 'timestamp', 'duration', 'mail', 'phone', 'url', 'password')
* Note: Filter can be a string like "(t.ref:like:'SO-%') or (t.date_creation:<:'20160101') or (t.nature:is:NULL)"
* 'label' the translation key.
* 'picto' is code of a picto to show before value in forms

View File

@ -174,7 +174,8 @@ if (empty($reshook))
if (!$error && $result > 0)
{
// Add myself as project leader
$result = $object->add_contact($user->id, 'PROJECTLEADER', 'internal');
$typeofcontact = 'PROJECTLEADER'; // TODO If use rename this code in dictionary, the add_contact will generate an error.
$result = $object->add_contact($user->id, $typeofcontact, 'internal');
if ($result < 0)
{
$langs->load("errors");

View File

@ -816,7 +816,7 @@ if (!empty($arrayfields['country.code_iso']['checked']))
if (!empty($arrayfields['typent.code']['checked']))
{
print '<td class="liste_titre maxwidthonsmartphone center">';
print $form->selectarray("search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 0, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT), 'maxwidth75', 1);
print $form->selectarray("search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 1, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT), 'maxwidth75', 1);
print '</td>';
}
// Staff

View File

@ -1452,11 +1452,11 @@ class User extends CommonObject
if ($result > 0) {
$sql = "UPDATE ".MAIN_DB_PREFIX."user";
$sql .= " SET fk_socpeople=".$contact->id;
$sql .= ", civility=".$contact->civility_code;
if ($contact->socid) {
$sql .= ", civility='".$this->db->escape($contact->civility_code)."'";
if ($contact->socid > 0) {
$sql .= ", fk_soc=".$contact->socid;
}
$sql .= " WHERE rowid=".$this->id;
$sql .= " WHERE rowid=".((int) $this->id);
$resql = $this->db->query($sql);
dol_syslog(get_class($this)."::create_from_contact", LOG_DEBUG);

View File

@ -62,7 +62,7 @@ $user = new User($db);
@set_time_limit(0);
print "***** ".$script_file." (".$version.") pid=".dol_getmypid()." *****\n";
if (!in_array($type, array('thirdparties', 'contacts', 'users', 'members'))) {
if (!in_array($type, array('all', 'thirdparties', 'contacts', 'users', 'members'))) {
print "Bad value for parameter type.\n";
exit(-1);
}