Merge pull request #23 from Dolibarr/develop

Update fork
This commit is contained in:
Damien BENOIT 2021-05-17 16:55:04 +02:00 committed by GitHub
commit 47c24d61fc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 44 additions and 33 deletions

View File

@ -48,7 +48,7 @@ $substitutionarrayfortest = array(
'__DOL_MAIN_URL_ROOT__'=>DOL_MAIN_URL_ROOT, '__DOL_MAIN_URL_ROOT__'=>DOL_MAIN_URL_ROOT,
'__ID__' => 'RecipientIdRecord', '__ID__' => 'RecipientIdRecord',
//'__EMAIL__' => 'RecipientEMail', // Done into actions_sendmails //'__EMAIL__' => 'RecipientEMail', // Done into actions_sendmails
'__CHECK_READ__' => (is_object($object) && !empty($object->thirdparty) && is_object($object->thirdparty)) ? '<img src="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-read.php?tag='.$object->thirdparty->tag.'&securitykey='.urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY).'" width="1" height="1" style="width:1px;height:1px" border="0"/>' : '', '__CHECK_READ__' => (!empty($object) && is_object($object) && is_object($object->thirdparty)) ? '<img src="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-read.php?tag='.$object->thirdparty->tag.'&securitykey='.urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY).'" width="1" height="1" style="width:1px;height:1px" border="0"/>' : '',
'__USER_SIGNATURE__' => (($user->signature && empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN)) ? $usersignature : ''), // Done into actions_sendmails '__USER_SIGNATURE__' => (($user->signature && empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN)) ? $usersignature : ''), // Done into actions_sendmails
'__LOGIN__' => 'RecipientLogin', '__LOGIN__' => 'RecipientLogin',
'__LASTNAME__' => 'RecipientLastname', '__LASTNAME__' => 'RecipientLastname',
@ -737,14 +737,14 @@ if ($action == 'edit') {
print '<tr class="oddeven"><td>'.$langs->trans('MAIN_MAIL_DEFAULT_FROMTYPE').'</td>'; print '<tr class="oddeven"><td>'.$langs->trans('MAIN_MAIL_DEFAULT_FROMTYPE').'</td>';
print '<td>'; print '<td>';
if (!empty($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE) && $conf->global->MAIN_MAIL_DEFAULT_FROMTYPE === 'robot') { if (getDolGlobalString('MAIN_MAIL_DEFAULT_FROMTYPE') === 'robot') {
print $langs->trans('RobotEmail'); print $langs->trans('RobotEmail');
} elseif (!empty($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE) && $conf->global->MAIN_MAIL_DEFAULT_FROMTYPE === 'user') { } elseif (getDolGlobalString('MAIN_MAIL_DEFAULT_FROMTYPE') === 'user') {
print $langs->trans('UserEmail'); print $langs->trans('UserEmail');
} elseif (!empty($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE) && $conf->global->MAIN_MAIL_DEFAULT_FROMTYPE === 'company') { } elseif (getDolGlobalString('MAIN_MAIL_DEFAULT_FROMTYPE') === 'company') {
print $langs->trans('CompanyEmail').' '.dol_escape_htmltag('<'.$mysoc->email.'>'); print $langs->trans('CompanyEmail').' '.dol_escape_htmltag('<'.$mysoc->email.'>');
} else { } else {
$id = preg_replace('/senderprofile_/', '', !empty($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE) ? $conf->global->MAIN_MAIL_DEFAULT_FROMTYPE : ''); $id = preg_replace('/senderprofile_/', '', getDolGlobalString('MAIN_MAIL_DEFAULT_FROMTYPE'));
if ($id > 0) { if ($id > 0) {
include_once DOL_DOCUMENT_ROOT.'/core/class/emailsenderprofile.class.php'; include_once DOL_DOCUMENT_ROOT.'/core/class/emailsenderprofile.class.php';
$emailsenderprofile = new EmailSenderProfile($db); $emailsenderprofile = new EmailSenderProfile($db);
@ -756,7 +756,7 @@ if ($action == 'edit') {
// Errors To // Errors To
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_ERRORS_TO").'</td>'; print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_ERRORS_TO").'</td>';
print '<td>'.(!empty($conf->global->MAIN_MAIL_ERRORS_TO) ? $conf->global->MAIN_MAIL_ERRORS_TO : ''); print '<td>'.(getDolGlobalString('MAIN_MAIL_ERRORS_TO'));
if (!empty($conf->global->MAIN_MAIL_ERRORS_TO) && !isValidEmail($conf->global->MAIN_MAIL_ERRORS_TO)) { if (!empty($conf->global->MAIN_MAIL_ERRORS_TO) && !isValidEmail($conf->global->MAIN_MAIL_ERRORS_TO)) {
print img_warning($langs->trans("ErrorBadEMail")); print img_warning($langs->trans("ErrorBadEMail"));
} }

View File

@ -53,8 +53,8 @@ print '<span class="opacitymedium">'.$langs->trans("FileCheckDesc").'</span><br>
print '<div class="div-table-responsive-no-min">'; print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td>'.$langs->trans("Version").'</td><td>'.$langs->trans("Value").'</td></tr>'."\n"; print '<tr class="liste_titre"><td>'.$langs->trans("Version").'</td><td>'.$langs->trans("Value").'</td></tr>'."\n";
print '<tr class="oddeven"><td width="300">'.$langs->trans("VersionLastInstall").'</td><td>'.$conf->global->MAIN_VERSION_LAST_INSTALL.'</td></tr>'."\n"; print '<tr class="oddeven"><td width="300">'.$langs->trans("VersionLastInstall").'</td><td>'.getDolGlobalString('MAIN_VERSION_LAST_INSTALL').'</td></tr>'."\n";
print '<tr class="oddeven"><td width="300">'.$langs->trans("VersionLastUpgrade").'</td><td>'.$conf->global->MAIN_VERSION_LAST_UPGRADE.'</td></tr>'."\n"; print '<tr class="oddeven"><td width="300">'.$langs->trans("VersionLastUpgrade").'</td><td>'.getDolGlobalString('MAIN_VERSION_LAST_UPGRADE').'</td></tr>'."\n";
print '<tr class="oddeven"><td width="300">'.$langs->trans("VersionProgram").'</td><td>'.DOL_VERSION; print '<tr class="oddeven"><td width="300">'.$langs->trans("VersionProgram").'</td><td>'.DOL_VERSION;
// If current version differs from last upgrade // If current version differs from last upgrade
if (empty($conf->global->MAIN_VERSION_LAST_UPGRADE)) { if (empty($conf->global->MAIN_VERSION_LAST_UPGRADE)) {
@ -171,7 +171,7 @@ if (GETPOST('target') == 'remote') {
} }
if (!$error && $xml) { if (empty($error) && !empty($xml)) {
$checksumconcat = array(); $checksumconcat = array();
$file_list = array(); $file_list = array();
$out = ''; $out = '';

View File

@ -157,7 +157,7 @@ $title = $langs->trans("BackupDumpWizard");
print load_fiche_titre($title); print load_fiche_titre($title);
print '<table width="100%" class="'.($useinecm ? 'nobordernopadding' : 'liste').' nohover">'; print '<table width="100%" class="'.(!empty($useinecm) ? 'nobordernopadding' : 'liste').' nohover">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print $langs->trans("DatabaseName").' : <b>'.$dolibarr_main_db_name.'</b><br>'; print $langs->trans("DatabaseName").' : <b>'.$dolibarr_main_db_name.'</b><br>';

View File

@ -42,7 +42,7 @@ if ($user->socid > 0) {
} }
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array("companies", "admin", "users", "other")); $langs->loadLangs(array("companies", "admin", "users", "other","withdrawals"));
// Load variable for pagination // Load variable for pagination
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
@ -285,7 +285,7 @@ if ($result) {
$param .= "&date_endyear=".urlencode($date_endyear); $param .= "&date_endyear=".urlencode($date_endyear);
} }
$langs->load('withdrawals'); $center = '';
if ($num) { if ($num) {
$center = '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?action=purge">'.$langs->trans("Purge").'</a>'; $center = '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?action=purge">'.$langs->trans("Purge").'</a>';
} }

View File

@ -906,7 +906,7 @@ function listOfSessions()
if (preg_match('/dol_login/i', $sessValues) && // limit to dolibarr session if (preg_match('/dol_login/i', $sessValues) && // limit to dolibarr session
(preg_match('/dol_entity\|i:'.$conf->entity.';/i', $sessValues) || preg_match('/dol_entity\|s:([0-9]+):"'.$conf->entity.'"/i', $sessValues)) && // limit to current entity (preg_match('/dol_entity\|i:'.$conf->entity.';/i', $sessValues) || preg_match('/dol_entity\|s:([0-9]+):"'.$conf->entity.'"/i', $sessValues)) && // limit to current entity
preg_match('/dol_company\|s:([0-9]+):"('.$conf->global->MAIN_INFO_SOCIETE_NOM.')"/i', $sessValues)) { // limit to company name preg_match('/dol_company\|s:([0-9]+):"('.getDolGlobalString('MAIN_INFO_SOCIETE_NOM').')"/i', $sessValues)) { // limit to company name
$tmp = explode('_', $file); $tmp = explode('_', $file);
$idsess = $tmp[1]; $idsess = $tmp[1];
$regs = array(); $regs = array();

View File

@ -1284,6 +1284,7 @@ if ($resql) {
$objectstatic->id = $obj->rowid; $objectstatic->id = $obj->rowid;
$objectstatic->ref = $obj->ref; $objectstatic->ref = $obj->ref;
$objectstatic->ref_supplier = $obj->ref_supplier; $objectstatic->ref_supplier = $obj->ref_supplier;
$objectstatic->socid = $obj->socid;
$objectstatic->total_ht = $obj->total_ht; $objectstatic->total_ht = $obj->total_ht;
$objectstatic->total_tva = $obj->total_tva; $objectstatic->total_tva = $obj->total_tva;
$objectstatic->total_ttc = $obj->total_ttc; $objectstatic->total_ttc = $obj->total_ttc;

View File

@ -62,7 +62,7 @@ class Users extends DolibarrApi
* @param int $limit Limit for list * @param int $limit Limit for list
* @param int $page Page number * @param int $page Page number
* @param string $user_ids User ids filter field. Example: '1' or '1,2,3' {@pattern /^[0-9,]*$/i} * @param string $user_ids User ids filter field. Example: '1' or '1,2,3' {@pattern /^[0-9,]*$/i}
* @param int $category Use this param to filter list by category * @param int $category Use this param to filter list by category
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')" * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')"
* @return array Array of User objects * @return array Array of User objects
*/ */
@ -70,7 +70,7 @@ class Users extends DolibarrApi
{ {
global $db, $conf; global $db, $conf;
if (!DolibarrApiAccess::$user->rights->user->user->lire) { if (!DolibarrApiAccess::$user->rights->user->user->lire && empty(DolibarrApiAccess::$user->admin)) {
throw new RestException(401, "You are not allowed to read list of users"); throw new RestException(401, "You are not allowed to read list of users");
} }
@ -149,7 +149,7 @@ class Users extends DolibarrApi
*/ */
public function get($id, $includepermissions = 0) public function get($id, $includepermissions = 0)
{ {
if (empty(DolibarrApiAccess::$user->rights->user->user->lire)) { if (empty(DolibarrApiAccess::$user->rights->user->user->lire) && empty(DolibarrApiAccess::$user->admin)) {
throw new RestException(401, 'Not allowed'); throw new RestException(401, 'Not allowed');
} }
@ -187,7 +187,7 @@ class Users extends DolibarrApi
*/ */
public function getByLogin($login, $includepermissions = 0) public function getByLogin($login, $includepermissions = 0)
{ {
if (empty(DolibarrApiAccess::$user->rights->user->user->lire)) { if (empty(DolibarrApiAccess::$user->rights->user->user->lire) && empty(DolibarrApiAccess::$user->admin)) {
throw new RestException(401, 'Not allowed'); throw new RestException(401, 'Not allowed');
} }
@ -221,7 +221,7 @@ class Users extends DolibarrApi
*/ */
public function getByEmail($email, $includepermissions = 0) public function getByEmail($email, $includepermissions = 0)
{ {
if (empty(DolibarrApiAccess::$user->rights->user->user->lire)) { if (empty(DolibarrApiAccess::$user->rights->user->user->lire) && empty(DolibarrApiAccess::$user->admin)) {
throw new RestException(401, 'Not allowed'); throw new RestException(401, 'Not allowed');
} }
@ -254,7 +254,7 @@ class Users extends DolibarrApi
*/ */
public function getInfo($includepermissions = 0) public function getInfo($includepermissions = 0)
{ {
if (empty(DolibarrApiAccess::$user->rights->user->user->lire)) { if (empty(DolibarrApiAccess::$user->rights->user->user->lire) && empty(DolibarrApiAccess::$user->admin)) {
throw new RestException(401, 'Not allowed'); throw new RestException(401, 'Not allowed');
} }
@ -295,7 +295,7 @@ class Users extends DolibarrApi
public function post($request_data = null) public function post($request_data = null)
{ {
// Check user authorization // Check user authorization
if (empty(DolibarrApiAccess::$user->rights->user->user->creer)) { if (empty(DolibarrApiAccess::$user->rights->user->creer) && empty(DolibarrApiAccess::$user->admin)) {
throw new RestException(401, "User creation not allowed for login ".DolibarrApiAccess::$user->login); throw new RestException(401, "User creation not allowed for login ".DolibarrApiAccess::$user->login);
} }
@ -345,7 +345,7 @@ class Users extends DolibarrApi
public function put($id, $request_data = null) public function put($id, $request_data = null)
{ {
// Check user authorization // Check user authorization
if (empty(DolibarrApiAccess::$user->rights->user->creer)) { if (empty(DolibarrApiAccess::$user->rights->user->user->creer) && empty(DolibarrApiAccess::$user->admin)) {
throw new RestException(401, "User update not allowed"); throw new RestException(401, "User update not allowed");
} }
@ -423,12 +423,12 @@ class Users extends DolibarrApi
*/ */
public function getGroups($id) public function getGroups($id)
{ {
if (!DolibarrApiAccess::$user->rights->user->user->lire) { $obj_ret = array();
if (empty(DolibarrApiAccess::$user->rights->user->user->lire) && empty(DolibarrApiAccess::$user->admin)) {
throw new RestException(403); throw new RestException(403);
} }
$obj_ret = array();
$user = new User($this->db); $user = new User($this->db);
$result = $user->fetch($id); $result = $user->fetch($id);
if (!$result) { if (!$result) {
@ -463,7 +463,7 @@ class Users extends DolibarrApi
{ {
global $conf; global $conf;
if (empty(DolibarrApiAccess::$user->rights->user->user->creer)) { if (empty(DolibarrApiAccess::$user->rights->user->user->creer) && empty(DolibarrApiAccess::$user->admin)) {
throw new RestException(401); throw new RestException(401);
} }
@ -516,9 +516,9 @@ class Users extends DolibarrApi
$obj_ret = array(); $obj_ret = array();
if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty(DolibarrApiAccess::$user->rights->user->user->lire)) || if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty(DolibarrApiAccess::$user->rights->user->user->lire) && empty(DolibarrApiAccess::$user->admin)) ||
!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty(DolibarrApiAccess::$user->rights->user->group_advance->read)) { !empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty(DolibarrApiAccess::$user->rights->user->group_advance->read) && empty(DolibarrApiAccess::$user->admin)) {
throw new RestException(401, "You are not allowed to read groups"); throw new RestException(401, "You are not allowed to read groups");
} }
// case of external user, $societe param is ignored and replaced by user's socid // case of external user, $societe param is ignored and replaced by user's socid
@ -590,8 +590,8 @@ class Users extends DolibarrApi
{ {
global $db, $conf; global $db, $conf;
if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty(DolibarrApiAccess::$user->rights->user->user->lire)) || if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty(DolibarrApiAccess::$user->rights->user->user->lire) && empty(DolibarrApiAccess::$user->admin)) ||
!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty(DolibarrApiAccess::$user->rights->user->group_advance->read)) { !empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty(DolibarrApiAccess::$user->rights->user->group_advance->read) && empty(DolibarrApiAccess::$user->admin)) {
throw new RestException(401, "You are not allowed to read groups"); throw new RestException(401, "You are not allowed to read groups");
} }
@ -616,7 +616,7 @@ class Users extends DolibarrApi
*/ */
public function delete($id) public function delete($id)
{ {
if (empty(DolibarrApiAccess::$user->rights->user->user->supprimer)) { if (empty(DolibarrApiAccess::$user->rights->user->user->supprimer) && empty(DolibarrApiAccess::$user->admin)) {
throw new RestException(401, 'Not allowed'); throw new RestException(401, 'Not allowed');
} }
$result = $this->useraccount->fetch($id); $result = $this->useraccount->fetch($id);

View File

@ -2411,8 +2411,18 @@ class User extends CommonObject
$label .= '<br><b>'.$langs->trans("Job").':</b> '.dol_string_nohtmltag($this->job); $label .= '<br><b>'.$langs->trans("Job").':</b> '.dol_string_nohtmltag($this->job);
} }
$label .= '<br><b>'.$langs->trans("Email").':</b> '.dol_string_nohtmltag($this->email); $label .= '<br><b>'.$langs->trans("Email").':</b> '.dol_string_nohtmltag($this->email);
if (!empty($this->phone)) { if (!empty($this->office_phone) || !empty($this->office_fax) || !empty($this->fax)) {
$label .= '<br><b>'.$langs->trans("Phone").':</b> '.dol_string_nohtmltag($this->phone); $phonelist = array();
if ($this->office_phone) {
$phonelist[] = dol_print_phone($this->office_phone, $this->country_code, $this->id, 0, '', '&nbsp', 'phone');
}
if ($this->office_fax) {
$phonelist[] = dol_print_phone($this->office_fax, $this->country_code, $this->id, 0, '', '&nbsp', 'fax');
}
if ($this->user_mobile) {
$phonelist[] = dol_print_phone($this->user_mobile, $this->country_code, $this->id, 0, '', '&nbsp', 'mobile');
}
$label .= '<br><b>'.$langs->trans('Phone').':</b> '.implode('&nbsp;', $phonelist);
} }
if (!empty($this->admin)) { if (!empty($this->admin)) {
$label .= '<br><b>'.$langs->trans("Administrator").'</b>: '.yn($this->admin); $label .= '<br><b>'.$langs->trans("Administrator").'</b>: '.yn($this->admin);