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

This commit is contained in:
Laurent Destailleur 2019-01-16 16:45:38 +01:00
commit 688311c761
4 changed files with 9 additions and 7 deletions

View File

@ -1695,7 +1695,7 @@ if (empty($reshook))
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Type')), null, 'errors'); setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Type')), null, 'errors');
$error++; $error++;
} }
if ($prod_entry_mode == 'free' && empty($idprod) && (($price_ht < 0 && empty($conf->global->FACTURE_ENABLE_NEGATIVE_LINES)) || $price_ht == '') && $price_ht_devise == '') // Unit price can be 0 but not '' if (($prod_entry_mode == 'free' && empty($idprod) && (($price_ht < 0 && empty($conf->global->FACTURE_ENABLE_NEGATIVE_LINES)) || $price_ht == '') && $price_ht_devise == '') && $object->type != Facture::TYPE_CREDIT_NOTE) // Unit price can be 0 but not ''
{ {
if ($price_ht < 0 && empty($conf->global->FACTURE_ENABLE_NEGATIVE_LINES)) if ($price_ht < 0 && empty($conf->global->FACTURE_ENABLE_NEGATIVE_LINES))
{ {
@ -2155,7 +2155,7 @@ if (empty($reshook))
setEventMessages($langs->trans('ErrorQtyForCustomerInvoiceCantBeNegative'), null, 'errors'); setEventMessages($langs->trans('ErrorQtyForCustomerInvoiceCantBeNegative'), null, 'errors');
$error++; $error++;
} }
if (empty($productid) && (($pu_ht < 0 && empty($conf->global->FACTURE_ENABLE_NEGATIVE_LINES)) || $pu_ht == '') && $pu_ht_devise == '') // Unit price can be 0 but not '' if ((empty($productid) && (($pu_ht < 0 && empty($conf->global->FACTURE_ENABLE_NEGATIVE_LINES)) || $pu_ht == '') && $pu_ht_devise == '') && $object->type != Facture::TYPE_CREDIT_NOTE) // Unit price can be 0 but not ''
{ {
if ($pu_ht < 0 && empty($conf->global->FACTURE_ENABLE_NEGATIVE_LINES)) if ($pu_ht < 0 && empty($conf->global->FACTURE_ENABLE_NEGATIVE_LINES))
{ {

View File

@ -484,9 +484,9 @@ function checkUserAccessToObject($user, $featuresarray, $objectid=0, $tableandsh
{ {
$sql.= ",".MAIN_DB_PREFIX."usergroup_user as ug"; $sql.= ",".MAIN_DB_PREFIX."usergroup_user as ug";
$sql.= " WHERE dbt.".$dbt_select." IN (".$objectid.")"; $sql.= " WHERE dbt.".$dbt_select." IN (".$objectid.")";
$sql.= " AND (ug.fk_user = dbt.rowid"; $sql.= " AND ((ug.fk_user = dbt.rowid";
$sql.= " AND ug.entity IN (".getEntity('user')."))"; $sql.= " AND ug.entity IN (".getEntity('usergroup')."))";
$sql.= " OR dbt.entity = 0"; // Show always superadmin $sql.= " OR dbt.entity = 0)"; // Show always superadmin
} }
} }
else { else {

View File

@ -196,7 +196,7 @@ if (constant('DOL_DATA_ROOT') === null) {
} }
if (@file_exists($lockfile)) if (@file_exists($lockfile))
{ {
if (! is_object($langs)) if (! isset($langs) || ! is_object($langs))
{ {
$langs = new Translate('..', $conf); $langs = new Translate('..', $conf);
$langs->setDefaultLang('auto'); $langs->setDefaultLang('auto');

View File

@ -84,9 +84,11 @@ $socid=0;
if ($user->societe_id > 0) $socid = $user->societe_id; if ($user->societe_id > 0) $socid = $user->societe_id;
$feature2='user'; $feature2='user';
if ($user->id == $id) { $feature2=''; $canreaduser=1; } // A user can always read its own card if ($user->id == $id) { $feature2=''; $canreaduser=1; } // A user can always read its own card
if (!$canreaduser) {
if (! $canreaduser) {
$result = restrictedArea($user, 'user', $id, 'user&user', $feature2); $result = restrictedArea($user, 'user', $id, 'user&user', $feature2);
} }
if ($user->id <> $id && ! $canreaduser) accessforbidden(); if ($user->id <> $id && ! $canreaduser) accessforbidden();
// Load translation files required by page // Load translation files required by page