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

This commit is contained in:
Laurent Destailleur 2017-02-03 15:34:59 +01:00
commit bda915c63a
5 changed files with 12 additions and 7 deletions

View File

@ -170,7 +170,7 @@ class DolibarrApi
* @throws RestException * @throws RestException
*/ */
static function _checkAccessToResource($resource, $resource_id=0, $dbtablename='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid') { static function _checkAccessToResource($resource, $resource_id=0, $dbtablename='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid') {
// Features/modules to check // Features/modules to check
$featuresarray = array($resource); $featuresarray = array($resource);
if (preg_match('/&/', $resource)) { if (preg_match('/&/', $resource)) {
@ -185,7 +185,7 @@ class DolibarrApi
$feature2 = explode("|", $feature2); $feature2 = explode("|", $feature2);
} }
return checkUserAccessToObject(DolibarrApiAccess::$user, $featuresarray,$resource_id,$dbtablename,$feature2,$dbt_keyfield,$dbt_select); return checkUserAccessToObject(DolibarrApiAccess::$user, $featuresarray, $resource_id, $dbtablename, $feature2, $dbt_keyfield, $dbt_select);
} }
/** /**

View File

@ -2764,6 +2764,8 @@ class Propal extends CommonObject
*/ */
function availability($availability_id, $notrigger=0) function availability($availability_id, $notrigger=0)
{ {
global $user;
if ($this->statut >= self::STATUS_DRAFT) if ($this->statut >= self::STATUS_DRAFT)
{ {
$error=0; $error=0;

View File

@ -343,7 +343,7 @@ function restrictedArea($user, $features, $objectid=0, $tableandshare='', $featu
* This function is also called by restrictedArea * This function is also called by restrictedArea
* *
* @param User $user User to check * @param User $user User to check
* @param array $featuresarray Features/modules to check * @param array $featuresarray Features/modules to check. Example: ('user','service')
* @param int $objectid Object ID if we want to check a particular record (optional) is linked to a owned thirdparty (optional). * @param int $objectid Object ID if we want to check a particular record (optional) is linked to a owned thirdparty (optional).
* @param string $tableandshare 'TableName&SharedElement' with Tablename is table where object is stored. SharedElement is an optional key to define where to check entity. Not used if objectid is null (optional) * @param string $tableandshare 'TableName&SharedElement' with Tablename is table where object is stored. SharedElement is an optional key to define where to check entity. Not used if objectid is null (optional)
* @param string $feature2 Feature to check, second level of permission (optional). Can be or check with 'level1|level2'. * @param string $feature2 Feature to check, second level of permission (optional). Can be or check with 'level1|level2'.
@ -365,6 +365,9 @@ function checkUserAccessToObject($user, $featuresarray, $objectid=0, $tableandsh
{ {
$sql=''; $sql='';
// For backward compatibility
if ($feature == 'member') $feature='adherent';
$check = array('adherent','banque','user','usergroup','produit','service','produit|service','categorie'); // Test on entity only (Objects with no link to company) $check = array('adherent','banque','user','usergroup','produit','service','produit|service','categorie'); // Test on entity only (Objects with no link to company)
$checksoc = array('societe'); // Test for societe object $checksoc = array('societe'); // Test for societe object
$checkother = array('contact'); // Test on entity and link to societe. Allowed if link is empty (Ex: contacts...). $checkother = array('contact'); // Test on entity and link to societe. Allowed if link is empty (Ex: contacts...).

View File

@ -2,6 +2,7 @@
/* Copyright (C) 2010-2011 Regis Houssin <regis.houssin@capnetworks.com> /* Copyright (C) 2010-2011 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2015 Charlie Benke <charlie@patas-monkey.com> * Copyright (C) 2015 Charlie Benke <charlie@patas-monkey.com>
* Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -15,7 +16,6 @@
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/ */
?> ?>
@ -48,7 +48,7 @@ foreach($linkedObjectBlock as $key => $objectlink)
<td align="right"><?php <td align="right"><?php
if ($user->rights->fournisseur->facture->lire) { if ($user->rights->fournisseur->facture->lire) {
$sign = 1; $sign = 1;
if ($object->type == Facture::TYPE_CREDIT_NOTE) $sign = -1; if ($object->type == FactureFournisseur::TYPE_CREDIT_NOTE) $sign = -1;
if ($objectlink->statut != 3) // If not abandonned if ($objectlink->statut != 3) // If not abandonned
{ {
$total = $total + $sign * $objectlink->total_ht; $total = $total + $sign * $objectlink->total_ht;

View File

@ -832,8 +832,8 @@ foreach ($listofreferent as $key => $value)
} }
else if ($element_doc === 'invoice_supplier') { else if ($element_doc === 'invoice_supplier') {
$element_doc='facture_fournisseur'; $element_doc='facture_fournisseur';
$filename = get_exdir($element->id,2,0,0,$this,'product').dol_sanitizeFileName($element->ref); $filename = get_exdir($element->id,2,0,0,$element,'product').dol_sanitizeFileName($element->ref);
$filedir = $conf->fournisseur->facture->dir_output.'/'.get_exdir($element->id,2,0,0,null,'invoice_supplier').dol_sanitizeFileName($element->ref); $filedir = $conf->fournisseur->facture->dir_output.'/'.get_exdir($element->id,2,0,0,$element,'invoice_supplier').dol_sanitizeFileName($element->ref);
} }
print '<div class="inline-block valignmiddle">'.$formfile->getDocumentsLink($element_doc, $filename, $filedir).'</div>'; print '<div class="inline-block valignmiddle">'.$formfile->getDocumentsLink($element_doc, $filename, $filedir).'</div>';