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

This commit is contained in:
Laurent Destailleur 2013-04-27 12:25:22 +02:00
commit 24309a7f17
19 changed files with 132 additions and 102 deletions

View File

@ -35,7 +35,7 @@ class ActionComm extends CommonObject
public $element='action'; public $element='action';
public $table_element = 'actioncomm'; public $table_element = 'actioncomm';
public $table_rowid = 'id'; public $table_rowid = 'id';
protected $ismultientitymanaged = 2; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
var $id; var $id;
var $type_id; var $type_id;

View File

@ -51,6 +51,8 @@ if ($user->societe_id > 0)
$socid = $user->societe_id; $socid = $user->societe_id;
} }
$result = restrictedArea($user, 'agenda', $objectid, 'actioncomm&societe', 'myactions&allactions', '', 'id');
$act = new ActionComm($db); $act = new ActionComm($db);
if ($objectid > 0) if ($objectid > 0)

View File

@ -53,7 +53,7 @@ $contactid=GETPOST('contactid','int');
$socid = GETPOST('socid','int'); $socid = GETPOST('socid','int');
$id = GETPOST('id','int'); $id = GETPOST('id','int');
if ($user->societe_id) $socid=$user->societe_id; if ($user->societe_id) $socid=$user->societe_id;
//$result = restrictedArea($user, 'agenda', $id, 'actioncomm', 'actions', '', 'id'); $result = restrictedArea($user, 'agenda', $id, 'actioncomm&societe', 'myactions&allactions', '', 'id');
$error=GETPOST("error"); $error=GETPOST("error");
$mesg=''; $mesg='';

View File

@ -31,6 +31,8 @@ require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
$langs->load("commercial"); $langs->load("commercial");
$id = GETPOST('id','int');
// Security check // Security check
if ($user->societe_id > 0) if ($user->societe_id > 0)
{ {
@ -38,6 +40,7 @@ if ($user->societe_id > 0)
$socid = $user->societe_id; $socid = $user->societe_id;
} }
$result = restrictedArea($user, 'agenda', $id, 'actioncomm&societe', 'myactions&allactions', '', 'id');
/* /*
@ -48,8 +51,8 @@ $help_url='EN:Module_Agenda_En|FR:Module_Agenda|ES:M&omodulodulo_Agenda';
llxHeader('',$langs->trans("Agenda"),$help_url); llxHeader('',$langs->trans("Agenda"),$help_url);
$act = new ActionComm($db); $act = new ActionComm($db);
$act->fetch($_GET["id"]); $act->fetch($id);
$act->info($_GET["id"]); $act->info($act->id);
$head=actions_prepare_head($act); $head=actions_prepare_head($act);
dol_fiche_head($head, 'info', $langs->trans("Action"),0,'action'); dol_fiche_head($head, 'info', $langs->trans("Action"),0,'action');

View File

@ -227,7 +227,7 @@ if ($search_societe) $sql .= " AND s.nom LIKE '%".$search_societe."%'";
if ($search_montant_ht) $sql .= " AND f.total = '".$search_montant_ht."'"; if ($search_montant_ht) $sql .= " AND f.total = '".$search_montant_ht."'";
if ($search_montant_ttc) $sql .= " AND f.total_ttc = '".$search_montant_ttc."'"; if ($search_montant_ttc) $sql .= " AND f.total_ttc = '".$search_montant_ttc."'";
if (GETPOST('sf_ref')) $sql .= " AND f.facnumber LIKE '%".GETPOST('sf_ref') . "%'"; if (GETPOST('sf_ref')) $sql .= " AND f.facnumber LIKE '%".GETPOST('sf_ref') . "%'";
$sql.= " GROUP BY f.facnumber,f.increment,f.total,f.total_ttc,f.datef, f.date_lim_reglement,f.paye, f.rowid, f.fk_statut, f.type,s.nom, s.rowid"; $sql.= " GROUP BY s.nom, s.rowid, f.facnumber, f.increment, f.total, f.tva, f.total_ttc, f.datef, f.date_lim_reglement, f.paye, f.rowid, f.fk_statut, f.type ";
if (! $user->rights->societe->client->voir && ! $socid) $sql .= ", sc.fk_soc, sc.fk_user "; if (! $user->rights->societe->client->voir && ! $socid) $sql .= ", sc.fk_soc, sc.fk_user ";
$sql.= " ORDER BY "; $sql.= " ORDER BY ";
$listfield=explode(',',$sortfield); $listfield=explode(',',$sortfield);

View File

@ -941,7 +941,8 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture-
$sql.= " AND ff.fk_statut = 1"; $sql.= " AND ff.fk_statut = 1";
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
if ($socid) $sql.= " AND ff.fk_soc = ".$socid; if ($socid) $sql.= " AND ff.fk_soc = ".$socid;
$sql.= " GROUP BY ff.rowid, ff.facnumber, ff.fk_statut, ff.libelle, ff.total_ht, ff.total_ttc, s.nom, s.rowid"; $sql.= " GROUP BY ff.rowid, ff.facnumber, ff.fk_statut, ff.libelle, ff.total_ht, ff.total_ttc, ff.paye,";
$sql.= " s.nom, s.rowid";
$resql=$db->query($sql); $resql=$db->query($sql);
if ($resql) if ($resql)

View File

@ -35,6 +35,7 @@ class Contact extends CommonObject
{ {
public $element='contact'; public $element='contact';
public $table_element='socpeople'; public $table_element='socpeople';
protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
var $id; var $id;
var $civilite_id; // In fact we stor civility_code var $civilite_id; // In fact we stor civility_code

View File

@ -29,26 +29,28 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/contact.lib.php';
$langs->load("companies"); $langs->load("companies");
// Security check // Security check
$contactid = isset($_GET["id"])?$_GET["id"]:''; $id = GETPOST('id', 'int');
if ($user->societe_id) $socid=$user->societe_id; if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'contact', $contactid, 'socpeople&societe'); $result = restrictedArea($user, 'contact', $id, 'socpeople&societe');
/* /*
* View * View
*/ */
llxHeader('',$langs->trans("ContactsAddresses"),'EN:Module_Third_Parties|FR:Module_Tiers|ES:Módulo_Empresas'); $title = (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("Contacts") : $langs->trans("ContactsAddresses"));
llxHeader('',$title,'EN:Module_Third_Parties|FR:Module_Tiers|ES:Módulo_Empresas');
$form = new Form($db); $form = new Form($db);
$contact = new Contact($db); $contact = new Contact($db);
$contact->fetch($_GET["id"], $user); $contact->fetch($id, $user);
$head = contact_prepare_head($contact); $head = contact_prepare_head($contact);
dol_fiche_head($head, 'exportimport', $langs->trans("ContactsAddresses"), 0, 'contact'); dol_fiche_head($head, 'exportimport', $title, 0, 'contact');
/* /*
@ -97,7 +99,7 @@ print '</div>';
print '<br>'; print '<br>';
print $langs->trans("ExportCardToFormat").': '; print $langs->trans("ExportCardToFormat").': ';
print '<a href="'.DOL_URL_ROOT.'/contact/vcard.php?id='.$_GET["id"].'">'; print '<a href="'.DOL_URL_ROOT.'/contact/vcard.php?id='.$contact->id.'">';
print img_picto($langs->trans("VCard"),'vcard.png').' '; print img_picto($langs->trans("VCard"),'vcard.png').' ';
print $langs->trans("VCard"); print $langs->trans("VCard");
print '</a>'; print '</a>';

View File

@ -62,7 +62,7 @@ if (! empty($canvas))
} }
// Security check // Security check
$result = restrictedArea($user, 'contact', $id, 'socpeople&societe', '', '', '', $objcanvas); // If we create a contact with no company (shared contacts), no check on write permission $result = restrictedArea($user, 'contact', $id, 'socpeople&societe', '', '', 'rowid', $objcanvas); // If we create a contact with no company (shared contacts), no check on write permission
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';

View File

@ -35,12 +35,12 @@ $langs->load("admin");
$action=GETPOST('action'); $action=GETPOST('action');
// Security check // Security check
$contactid = isset($_GET["id"])?$_GET["id"]:''; $id = GETPOST('id', 'int');
if ($user->societe_id) $socid=$user->societe_id; if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'contact', $contactid, 'socpeople&societe'); $result = restrictedArea($user, 'contact', $id, 'socpeople&societe');
$contact = new Contact($db); $contact = new Contact($db);
$contact->fetch($_GET["id"], $user); $contact->fetch($id, $user);
/* /*
@ -79,13 +79,15 @@ if ($action == 'dolibarr2ldap')
* View * View
*/ */
llxHeader('',$langs->trans("ContactsAddresses"),'EN:Module_Third_Parties|FR:Module_Tiers|ES:M&oacute;dulo_Empresas'); $title = (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("Contacts") : $langs->trans("ContactsAddresses"));
llxHeader('',$title,'EN:Module_Third_Parties|FR:Module_Tiers|ES:M&oacute;dulo_Empresas');
$form = new Form($db); $form = new Form($db);
$head = contact_prepare_head($contact); $head = contact_prepare_head($contact);
dol_fiche_head($head, 'ldap', $langs->trans("ContactsAddresses"), 0, 'contact'); dol_fiche_head($head, 'ldap', $title, 0, 'contact');
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';

View File

@ -69,7 +69,9 @@ if ($action == 'update' && ! $_POST["cancel"] && $user->rights->societe->contact
$now=dol_now(); $now=dol_now();
llxHeader('',$langs->trans("ContactsAddresses"),'EN:Module_Third_Parties|FR:Module_Tiers|ES:M&oacute;dulo_Empresas'); $title = (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("Contacts") : $langs->trans("ContactsAddresses"));
llxHeader('',$title,'EN:Module_Third_Parties|FR:Module_Tiers|ES:M&oacute;dulo_Empresas');
$form = new Form($db); $form = new Form($db);
@ -77,7 +79,7 @@ $object->fetch($id, $user);
$head = contact_prepare_head($object); $head = contact_prepare_head($object);
dol_fiche_head($head, 'perso', $langs->trans("ContactsAddresses"), 0, 'contact'); dol_fiche_head($head, 'perso', $title, 0, 'contact');
if ($action == 'edit') if ($action == 'edit')
{ {

View File

@ -29,8 +29,13 @@ require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/vcard.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/vcard.class.php';
$id = GETPOST('id', 'int');
// Security check
$result = restrictedArea($user, 'contact', $id, 'socpeople&societe');
$contact = new Contact($db); $contact = new Contact($db);
$result=$contact->fetch($_GET["id"]); $result=$contact->fetch($id);
$physicalperson=1; $physicalperson=1;

View File

@ -112,11 +112,15 @@ function restrictedArea($user, $features, $objectid=0, $dbtablename='', $feature
if (method_exists($objcanvas->control,'restrictedArea')) return $objcanvas->control->restrictedArea($user,$features,$objectid,$dbtablename,$feature2,$dbt_keyfield,$dbt_select); if (method_exists($objcanvas->control,'restrictedArea')) return $objcanvas->control->restrictedArea($user,$features,$objectid,$dbtablename,$feature2,$dbt_keyfield,$dbt_select);
} }
if ($dbt_select != 'rowid') $objectid = "'".$objectid."'"; if ($dbt_select != 'rowid' && $dbt_select != 'id') $objectid = "'".$objectid."'";
// More features to check // More features to check
$features = explode("&", $features); $features = explode("&", $features);
// More subfeatures to check
if (!empty($feature2))
$feature2 = explode("&", $feature2);
// More parameters // More parameters
$params = explode('&', $dbtablename); $params = explode('&', $dbtablename);
$dbtablename=(! empty($params[0]) ? $params[0] : ''); $dbtablename=(! empty($params[0]) ? $params[0] : '');
@ -164,8 +168,11 @@ function restrictedArea($user, $features, $objectid=0, $dbtablename='', $feature
} }
else if (! empty($feature2)) // This should be used for future changes else if (! empty($feature2)) // This should be used for future changes
{ {
if (empty($user->rights->$feature->$feature2->lire) foreach($feature2 as $subfeature)
&& empty($user->rights->$feature->$feature2->read)) $readok=0; {
if (empty($user->rights->$feature->$subfeature->lire) && empty($user->rights->$feature->$subfeature->read)) $readok=0;
else { $readok=1; break; } // For bypass the second test if the first is ok
}
} }
else if (! empty($feature) && ($feature!='user' && $feature!='usergroup')) // This is for old permissions else if (! empty($feature) && ($feature!='user' && $feature!='usergroup')) // This is for old permissions
{ {
@ -210,8 +217,11 @@ function restrictedArea($user, $features, $objectid=0, $dbtablename='', $feature
} }
else if (! empty($feature2)) // This should be used for future changes else if (! empty($feature2)) // This should be used for future changes
{ {
if (empty($user->rights->$feature->$feature2->creer) foreach($feature2 as $subfeature)
&& empty($user->rights->$feature->$feature2->write)) $createok=0; {
if (empty($user->rights->$feature->$subfeature->creer) && empty($user->rights->$feature->$subfeature->write)) $createok=0;
else { $createok=1; break; } // For bypass the second test if the first is ok
}
} }
else if (! empty($feature)) // This is for old permissions else if (! empty($feature)) // This is for old permissions
{ {
@ -271,8 +281,11 @@ function restrictedArea($user, $features, $objectid=0, $dbtablename='', $feature
} }
else if (! empty($feature2)) // This should be used for future changes else if (! empty($feature2)) // This should be used for future changes
{ {
if (empty($user->rights->$feature->$feature2->supprimer) foreach($feature2 as $subfeature)
&& empty($user->rights->$feature->$feature2->delete)) $deleteok=0; {
if (empty($user->rights->$feature->$subfeature->supprimer) && empty($user->rights->$feature->$subfeature->delete)) $deleteok=0;
else { $deleteok=1; break; } // For bypass the second test if the first is ok
}
} }
else if (! empty($feature)) // This is for old permissions else if (! empty($feature)) // This is for old permissions
{ {

View File

@ -96,12 +96,7 @@ class mod_syslog_file extends LogHandler implements LogHandlerInterface
/** /**
* Return the parsed logfile path * Return the parsed logfile path
* *
<<<<<<< OURS
* @return string * @return string
=======
* @param string $suffixinfilename When output is a file, append this suffix into default log filename.
* @return string
>>>>>>> THEIRS
*/ */
private function getFilename() private function getFilename()
{ {

View File

@ -143,8 +143,8 @@ if ($user->rights->fournisseur->facture->lire)
{ {
$sql .= " AND f.facnumber LIKE '%".GETPOST('sf_re')."%'"; $sql .= " AND f.facnumber LIKE '%".GETPOST('sf_re')."%'";
} }
$sql.= " GROUP BY f.facnumber, f.rowid, f.total_ht, f.total_ttc, f.datef, f.date_lim_reglement, f.paye, f.fk_statut, s.rowid, s.nom"; $sql.= " GROUP BY s.rowid, s.nom, f.rowid, f.facnumber, f.total_ht, f.total_ttc, f.datef, f.date_lim_reglement,f.paye, f.rowid, f.fk_statut";
if (! $user->rights->societe->client->voir && ! $socid) $sql .= ", sc.fk_soc, sc.fk_user ";
$sql.= " ORDER BY "; $sql.= " ORDER BY ";
$listfield=explode(',',$sortfield); $listfield=explode(',',$sortfield);
foreach ($listfield as $key => $value) $sql.=$listfield[$key]." ".$sortorder.","; foreach ($listfield as $key => $value) $sql.=$listfield[$key]." ".$sortorder.",";

View File

@ -897,7 +897,7 @@ class Holiday extends CommonObject
$new_solde = $now_holiday + $this->getConfCP('nbHolidayEveryMonth'); $new_solde = $now_holiday + $this->getConfCP('nbHolidayEveryMonth');
// On ajoute la modification dans le LOG // On ajoute la modification dans le LOG
$this->addLogCP($user->id,$users[$i]['rowid'], $langs->trans('Event').': '.$langs->trans('HolidaysMonthlyAssignment'),$new_solde); $this->addLogCP($user->id,$users[$i]['rowid'], $langs->trans('Event').': '.$langs->trans('HolidaysMonthlyUpdate'),$new_solde);
$i++; $i++;
} }

View File

@ -2217,7 +2217,7 @@ class soap_transport_http extends nusoap_base {
} }
$this->use_curl = $use_curl; $this->use_curl = $use_curl;
preg_match('/\$Revisio' . 'n: ([^ ]+)/', $this->revision, $rev); preg_match('/\$Revisio' . 'n: ([^ ]+)/', $this->revision, $rev);
$this->setHeader('User-Agent', $this->title.'/'.$this->version.' ('.$rev[1].')'); if (isset($rev[1])) $this->setHeader('User-Agent', $this->title.'/'.$this->version.' ('.$rev[1].')');
} }
/** /**

View File

@ -374,7 +374,7 @@ if (! defined('NOLOGIN'))
$usertotest = (! empty($_COOKIE['login_dolibarr']) ? $_COOKIE['login_dolibarr'] : GETPOST("username","alpha",2)); $usertotest = (! empty($_COOKIE['login_dolibarr']) ? $_COOKIE['login_dolibarr'] : GETPOST("username","alpha",2));
$passwordtotest = (! empty($_COOKIE['password_dolibarr']) ? $_COOKIE['password_dolibarr'] : GETPOST('password')); $passwordtotest = (! empty($_COOKIE['password_dolibarr']) ? $_COOKIE['password_dolibarr'] : GETPOST('password'));
$entitytotest = (GETPOST('entity','int') ? GETPOST('entity','int') : 1); $entitytotest = (GETPOST('entity','int') ? GETPOST('entity','int') : (!empty($conf->entity) ? $conf->entity : 1));
// Validation of login/pass/entity // Validation of login/pass/entity
// If ok, the variable login will be returned // If ok, the variable login will be returned

View File

@ -141,6 +141,10 @@ if (! defined('NOREQUIREDB'))
{ {
$conf->entity = DOLENTITY; $conf->entity = DOLENTITY;
} }
else if (!empty($_COOKIE['DOLENTITY'])) // For other application with MultiCompany module
{
$conf->entity = $_COOKIE['DOLENTITY'];
}
else if (! empty($conf->multicompany->force_entity) && is_int($conf->multicompany->force_entity)) // To force entity in login page else if (! empty($conf->multicompany->force_entity) && is_int($conf->multicompany->force_entity)) // To force entity in login page
{ {
$conf->entity = $conf->multicompany->force_entity; $conf->entity = $conf->multicompany->force_entity;