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

This commit is contained in:
Laurent Destailleur 2021-05-20 15:05:55 +02:00
commit 5191a419d3
7 changed files with 24 additions and 20 deletions

View File

@ -7312,7 +7312,7 @@ abstract class CommonObject
$parameters = array();
$reshook = $hookmanager->executeHooks('showOptionals', $parameters, $this, $action); // Note that $action and $object may have been modified by hook
if (empty($reshook)) {
if (is_array($extrafields->attributes[$this->table_element]['label']) && count($extrafields->attributes[$this->table_element]['label']) > 0) {
if (key_exists('label', $extrafields->attributes[$this->table_element]) && is_array($extrafields->attributes[$this->table_element]['label']) && count($extrafields->attributes[$this->table_element]['label']) > 0) {
$out .= "\n";
$out .= '<!-- showOptionals --> ';
$out .= "\n";

View File

@ -47,7 +47,7 @@ if (empty($reshook)) {
if (isset($tpl_context)) {
$params['tpl_context'] = $tpl_context;
}
$params['cols'] = $parameters['colspanvalue'];
$params['cols'] = key_exists('colspanvalue', $parameters) ? $parameters['colspanvalue'] : '';
print $object->showOptionals($extrafields, 'create', $params);
}

View File

@ -12,7 +12,7 @@ if (empty($extrafieldsobjectkey) && is_object($object)) {
// Loop to show all columns of extrafields from $obj, $extrafields and $db
if (!empty($extrafieldsobjectkey)) { // $extrafieldsobject is the $object->table_element like 'societe', 'socpeople', ...
if (is_array($extrafields->attributes[$extrafieldsobjectkey]['label']) && count($extrafields->attributes[$extrafieldsobjectkey]['label'])) {
if (key_exists('label', $extrafields->attributes[$extrafieldsobjectkey]) && is_array($extrafields->attributes[$extrafieldsobjectkey]['label']) && count($extrafields->attributes[$extrafieldsobjectkey]['label'])) {
if (empty($extrafieldsobjectprefix)) {
$extrafieldsobjectprefix = 'ef.';
}

View File

@ -1955,7 +1955,7 @@ class FactureFournisseur extends CommonInvoice
$this->line->remise_percent = $remise_percent;
$this->line->date_start = $date_start;
$this->line->date_end = $date_end;
$this->line->ventil = $ventil;
$this->line->fk_code_ventilation = $ventil;
$this->line->rang = $rang;
$this->line->info_bits = $info_bits;
$this->line->fk_remise_except = $fk_remise_except;

View File

@ -48,13 +48,13 @@ require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
if (!empty($conf->adherent->enabled)) {
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
}
if (! empty($conf->accounting->enabled)) {
if (!empty($conf->accounting->enabled)) {
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
}
if (! empty($conf->accounting->enabled)) {
if (!empty($conf->accounting->enabled)) {
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
}
if (! empty($conf->accounting->enabled)) {
if (!empty($conf->accounting->enabled)) {
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
}
@ -610,7 +610,7 @@ if (empty($reshook)) {
}
// Logo/Photo save
$dir = $conf->societe->multidir_output[$conf->entity]."/".$object->id."/logos/";
$dir = $conf->societe->multidir_output[$conf->entity]."/".$object->id."/logos/";
$file_OK = is_uploaded_file($_FILES['photo']['tmp_name']);
if ($file_OK) {
if (image_format_supported($_FILES['photo']['name'])) {
@ -892,7 +892,7 @@ $form = new Form($db);
$formfile = new FormFile($db);
$formadmin = new FormAdmin($db);
$formcompany = new FormCompany($db);
if (! empty($conf->accounting->enabled)) {
if (!empty($conf->accounting->enabled)) {
$formaccounting = new FormAccounting($db);
}

View File

@ -1110,7 +1110,7 @@ if ($action == 'create' || $action == 'adduserldap') {
}
// Accountancy code
if ($conf->accounting->enabled) {
if (!empty($conf->accounting->enabled)) {
print '<tr><td>'.$langs->trans("AccountancyCode").'</td>';
print '<td>';
print '<input type="text" name="accountancy_code" value="'.dol_escape_htmltag(GETPOST('accountancy_code', 'alphanohtml')).'">';
@ -1163,7 +1163,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', GETPOSTISSET('note') ? GETPOST('note', 'restricthtml') : '', '', 120, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_SOCIETE, ROWS_3, '90%');
$doleditor = new DolEditor('note', GETPOSTISSET('note') ? GETPOST('note', 'restricthtml') : '', '', 120, 'dolibarr_notes', '', false, true, getDolGlobalString('FCKEDITOR_ENABLE_SOCIETE'), ROWS_3, '90%');
$doleditor->Create();
print "</td></tr>\n";

View File

@ -68,7 +68,7 @@ $pagenext = $page + 1;
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$object = new User($db);
$extrafields = new ExtraFields($db);
$diroutputmassaction = $conf->mymodule->dir_output.'/temp/massgeneration/'.$user->id;
$diroutputmassaction = $conf->user->dir_output.'/temp/massgeneration/'.$user->id;
$hookmanager->initHooks(array('userlist'));
// Fetch optionals attributes and labels
@ -124,9 +124,9 @@ $arrayfields = array(
'u.office_phone'=>array('label'=>"PhonePro", 'checked'=>1, 'position'=>31),
'u.user_mobile'=>array('label'=>"PhoneMobile", 'checked'=>1, 'position'=>32),
'u.email'=>array('label'=>"EMail", 'checked'=>1, 'position'=>35),
'u.api_key'=>array('label'=>"ApiKey", 'checked'=>0, 'position'=>40, "enabled"=>($conf->api->enabled && $user->admin)),
'u.api_key'=>array('label'=>"ApiKey", 'checked'=>0, 'position'=>40, "enabled"=>(!empty($conf->api->enabled) && $user->admin)),
'u.fk_soc'=>array('label'=>"Company", 'checked'=>($contextpage == 'employeelist' ? 0 : 1), 'position'=>45),
'u.salary'=>array('label'=>"Salary", 'checked'=>1, 'position'=>80, 'enabled'=>($conf->salaries->enabled && !empty($user->rights->salaries->readall))),
'u.salary'=>array('label'=>"Salary", 'checked'=>1, 'position'=>80, 'enabled'=>(!empty($conf->salaries->enabled) && !empty($user->rights->salaries->readall))),
'u.datelastlogin'=>array('label'=>"LastConnexion", 'checked'=>1, 'position'=>100),
'u.datepreviouslogin'=>array('label'=>"PreviousConnexion", 'checked'=>0, 'position'=>110),
'u.datec'=>array('label'=>"DateCreation", 'checked'=>0, 'position'=>500),
@ -345,7 +345,7 @@ $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // N
$sql .= preg_replace('/^,/', '', $hookmanager->resPrint);
$sql = preg_replace('/,\s*$/', '', $sql);
$sql .= " FROM ".MAIN_DB_PREFIX."user as u";
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
if (key_exists('label', $extrafields->attributes[$object->table_element]) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (u.rowid = ef.fk_object)";
}
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON u.fk_soc = s.rowid";
@ -571,13 +571,13 @@ print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
$url = DOL_URL_ROOT.'/user/card.php?action=create'.($mode == 'employee' ? '&employee=1' : '').'&leftmenu=';
if (!empty($socid)) {
$url .= '&socid='.$socid;
$url .= '&socid='.urlencode($socid);
}
$newcardbutton = dolGetButtonTitle($langs->trans('NewUser'), '', 'fa fa-plus-circle', $url, '', $permissiontoadd);
$moreparam = array('morecss'=>'btnTitleSelected');
$morehtmlright .= dolGetButtonTitle($langs->trans("List"), '', 'fa fa-list paddingleft imgforviewmode', DOL_URL_ROOT.'/user/list.php'.(($search_statut != '' && $search_statut >= 0) ? '?search_statut='.$search_statut : ''), '', 1, $moreparam);
$morehtmlright = dolGetButtonTitle($langs->trans("List"), '', 'fa fa-list paddingleft imgforviewmode', DOL_URL_ROOT.'/user/list.php'.(($search_statut != '' && $search_statut >= 0) ? '?search_statut='.$search_statut : ''), '', 1, $moreparam);
$moreparam = array('morecss'=>'marginleftonly');
$morehtmlright .= dolGetButtonTitle($langs->trans("HierarchicView"), '', 'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT.'/user/hierarchy.php'.(($search_statut != '' && $search_statut >= 0) ? '?search_statut='.$search_statut : ''), '', 1, $moreparam);
@ -808,7 +808,7 @@ print '</tr>'."\n";
// Detect if we need a fetch on each output line
$needToFetchEachLine = 0;
if (is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) {
if (key_exists('computed', $extrafields->attributes[$object->table_element]) && is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) {
foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) {
if (preg_match('/\$object/', $val)) {
$needToFetchEachLine++; // There is at least one compute field that use $object
@ -821,6 +821,7 @@ if (is_array($extrafields->attributes[$object->table_element]['computed']) && co
// --------------------------------------------------------------------
$i = 0;
$totalarray = array();
$totalarray['nbfield'] = 0;
$arrayofselected = is_array($toselect) ? $toselect : array();
while ($i < ($limit ? min($num, $limit) : $num)) {
$obj = $db->fetch_object($resql);
@ -828,12 +829,14 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
break; // Should not happen
}
if (empty($obj->country_code)) $obj->country_code = ''; // TODO Add join in select with country table to get country_code
// Store properties in $object
$object->setVarsFromFetchObj($obj);
$userstatic->id = $obj->rowid;
$userstatic->admin = $obj->admin;
$userstatic->ref = $obj->label;
$userstatic->ref = $obj->rowid;
$userstatic->login = $obj->login;
$userstatic->statut = $obj->statut;
$userstatic->office_phone = $obj->office_phone;
@ -928,6 +931,7 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
$totalarray['nbfield']++;
}
}
if (!empty($arrayfields['u.office_phone']['checked'])) {
print "<td>".dol_print_phone($obj->office_phone, $obj->country_code, 0, $obj->rowid, 'AC_TEL', ' ', 'phone')."</td>\n";
if (!$i) {
@ -941,7 +945,7 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
}
}
if (!empty($arrayfields['u.email']['checked'])) {
print '<td class="tdoverflowmax150">'.dol_print_email($obj->email, $obj->rowid, $obj->socid, 'AC_EMAIL', 0, 0, 1)."</td>\n";
print '<td class="tdoverflowmax150">'.dol_print_email($obj->email, $obj->rowid, $obj->fk_soc, 'AC_EMAIL', 0, 0, 1)."</td>\n";
if (!$i) {
$totalarray['nbfield']++;
}