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
@ -745,7 +746,7 @@ class Contact extends CommonObject
$this->error=$this->db->error().' sql='.$sql; $this->error=$this->db->error().' sql='.$sql;
} }
} }
// Removed extrafields // Removed extrafields
if ((! $error) && (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))) { // For avoid conflicts if trigger used if ((! $error) && (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))) { // For avoid conflicts if trigger used
$result=$this->deleteExtraFields($this); $result=$this->deleteExtraFields($this);

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

@ -38,7 +38,7 @@ class Holiday extends CommonObject
var $errors=array(); var $errors=array();
var $rowid; var $rowid;
var $ref; var $ref;
var $fk_user; var $fk_user;
var $date_create=''; var $date_create='';
@ -82,12 +82,12 @@ class Holiday extends CommonObject
*/ */
function updateSold() function updateSold()
{ {
// Mets à jour les congés payés en début de mois // Mets à jour les congés payés en début de mois
$this->updateSoldeCP(); $this->updateSoldeCP();
// Vérifie le nombre d'utilisateur et mets à jour si besoin // Vérifie le nombre d'utilisateur et mets à jour si besoin
$this->verifNbUsers($this->countActiveUsers(),$this->getConfCP('nbUser')); $this->verifNbUsers($this->countActiveUsers(),$this->getConfCP('nbUser'));
return 1; return 1;
} }
/** /**
@ -364,11 +364,11 @@ class Holiday extends CommonObject
$sql.= " cp.fk_user_cancel,"; $sql.= " cp.fk_user_cancel,";
$sql.= " cp.detail_refuse,"; $sql.= " cp.detail_refuse,";
$sql.= " uu.name as user_lastname,"; $sql.= " uu.name as user_lastname,";
$sql.= " uu.firstname as user_firstname,"; $sql.= " uu.firstname as user_firstname,";
$sql.= " ua.name as validator_lastname,"; $sql.= " ua.name as validator_lastname,";
$sql.= " ua.firstname as validator_firstname"; $sql.= " ua.firstname as validator_firstname";
$sql.= " FROM ".MAIN_DB_PREFIX."holiday as cp, ".MAIN_DB_PREFIX."user as uu, ".MAIN_DB_PREFIX."user as ua"; $sql.= " FROM ".MAIN_DB_PREFIX."holiday as cp, ".MAIN_DB_PREFIX."user as uu, ".MAIN_DB_PREFIX."user as ua";
$sql.= " WHERE cp.fk_user = uu.rowid AND cp.fk_validator = ua.rowid "; // Hack pour la recherche sur le tableau $sql.= " WHERE cp.fk_user = uu.rowid AND cp.fk_validator = ua.rowid "; // Hack pour la recherche sur le tableau
@ -469,7 +469,7 @@ class Holiday extends CommonObject
} else { } else {
$error++; $error++;
} }
$sql.= " halfday = ".$this->halfday.","; $sql.= " halfday = ".$this->halfday.",";
if(!empty($this->statut) && is_numeric($this->statut)) { if(!empty($this->statut) && is_numeric($this->statut)) {
$sql.= " statut = '".$this->statut."',"; $sql.= " statut = '".$this->statut."',";
} else { } else {
@ -611,8 +611,8 @@ class Holiday extends CommonObject
foreach($this->holiday as $infos_CP) foreach($this->holiday as $infos_CP)
{ {
if ($infos_CP['statut'] == 4) continue; // ignore not validated holidays if ($infos_CP['statut'] == 4) continue; // ignore not validated holidays
if ($infos_CP['statut'] == 5) continue; // ignore not validated holidays if ($infos_CP['statut'] == 5) continue; // ignore not validated holidays
// TODO Also use halfday for the check // TODO Also use halfday for the check
if ($dateDebut >= $infos_CP['date_debut'] && $dateDebut <= $infos_CP['date_fin'] || $dateFin <= $infos_CP['date_fin'] && $dateFin >= $infos_CP['date_debut']) if ($dateDebut >= $infos_CP['date_debut'] && $dateDebut <= $infos_CP['date_fin'] || $dateFin <= $infos_CP['date_fin'] && $dateFin >= $infos_CP['date_debut'])
@ -626,42 +626,42 @@ class Holiday extends CommonObject
} }
/** /**
* Return clicable name (with picto eventually) * Return clicable name (with picto eventually)
* *
* @param int $withpicto 0=_No picto, 1=Includes the picto in the linkn, 2=Picto only * @param int $withpicto 0=_No picto, 1=Includes the picto in the linkn, 2=Picto only
* @return string String with URL * @return string String with URL
*/ */
function getNomUrl($withpicto=0) function getNomUrl($withpicto=0)
{ {
global $langs; global $langs;
$result=''; $result='';
$lien = '<a href="'.DOL_URL_ROOT.'/holiday/fiche.php?id='.$this->id.'">'; $lien = '<a href="'.DOL_URL_ROOT.'/holiday/fiche.php?id='.$this->id.'">';
$lienfin='</a>'; $lienfin='</a>';
$picto='holiday'; $picto='holiday';
$label=$langs->trans("Show").': '.$this->ref; $label=$langs->trans("Show").': '.$this->ref;
if ($withpicto) $result.=($lien.img_object($label,$picto).$lienfin); if ($withpicto) $result.=($lien.img_object($label,$picto).$lienfin);
if ($withpicto && $withpicto != 2) $result.=' '; if ($withpicto && $withpicto != 2) $result.=' ';
if ($withpicto != 2) $result.=$lien.$this->ref.$lienfin; if ($withpicto != 2) $result.=$lien.$this->ref.$lienfin;
return $result; return $result;
} }
/** /**
* Returns the label status * Returns the label status
* *
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto
* @return string Label * @return string Label
*/ */
function getLibStatut($mode=0) function getLibStatut($mode=0)
{ {
return $this->LibStatut($this->statut, $mode, $this->date_debut); return $this->LibStatut($this->statut, $mode, $this->date_debut);
} }
/** /**
* Returns the label of a statut * Returns the label of a statut
@ -683,26 +683,26 @@ class Holiday extends CommonObject
if ($statut == 4) return $langs->trans('CancelCP'); if ($statut == 4) return $langs->trans('CancelCP');
if ($statut == 5) return $langs->trans('RefuseCP'); if ($statut == 5) return $langs->trans('RefuseCP');
} }
if ($mode == 2) if ($mode == 2)
{ {
$pictoapproved='statut6'; $pictoapproved='statut6';
if (! empty($startdate) && $startdate > dol_now()) $pictoapproved='statut4'; if (! empty($startdate) && $startdate > dol_now()) $pictoapproved='statut4';
if ($statut == 1) return img_picto($langs->trans('DraftCP'),'statut0').' '.$langs->trans('DraftCP'); // Draft if ($statut == 1) return img_picto($langs->trans('DraftCP'),'statut0').' '.$langs->trans('DraftCP'); // Draft
if ($statut == 2) return img_picto($langs->trans('ToValidateCP'),'statut1').' '.$langs->trans('ToValidateCP'); // Waiting approval if ($statut == 2) return img_picto($langs->trans('ToValidateCP'),'statut1').' '.$langs->trans('ToValidateCP'); // Waiting approval
if ($statut == 3) return img_picto($langs->trans('ValidateCP'),$pictoapproved).' '.$langs->trans('ValidateCP'); if ($statut == 3) return img_picto($langs->trans('ValidateCP'),$pictoapproved).' '.$langs->trans('ValidateCP');
if ($statut == 4) return img_picto($langs->trans('CancelCP'),'statut5').' '.$langs->trans('CancelCP'); if ($statut == 4) return img_picto($langs->trans('CancelCP'),'statut5').' '.$langs->trans('CancelCP');
if ($statut == 5) return img_picto($langs->trans('RefuseCP'),'statut5').' '.$langs->trans('RefuseCP'); if ($statut == 5) return img_picto($langs->trans('RefuseCP'),'statut5').' '.$langs->trans('RefuseCP');
} }
if ($mode == 5) if ($mode == 5)
{ {
$pictoapproved='statut6'; $pictoapproved='statut6';
if (! empty($startdate) && $startdate > dol_now()) $pictoapproved='statut4'; if (! empty($startdate) && $startdate > dol_now()) $pictoapproved='statut4';
if ($statut == 1) return $langs->trans('DraftCP').' '.img_picto($langs->trans('DraftCP'),'statut0'); // Draft if ($statut == 1) return $langs->trans('DraftCP').' '.img_picto($langs->trans('DraftCP'),'statut0'); // Draft
if ($statut == 2) return $langs->trans('ToValidateCP').' '.img_picto($langs->trans('ToValidateCP'),'statut1'); // Waiting approval if ($statut == 2) return $langs->trans('ToValidateCP').' '.img_picto($langs->trans('ToValidateCP'),'statut1'); // Waiting approval
if ($statut == 3) return $langs->trans('ValidateCP').' '.img_picto($langs->trans('ValidateCP'),$pictoapproved); if ($statut == 3) return $langs->trans('ValidateCP').' '.img_picto($langs->trans('ValidateCP'),$pictoapproved);
if ($statut == 4) return $langs->trans('CancelCP').' '.img_picto($langs->trans('CancelCP'),'statut5'); if ($statut == 4) return $langs->trans('CancelCP').' '.img_picto($langs->trans('CancelCP'),'statut5');
if ($statut == 5) return $langs->trans('RefuseCP').' '.img_picto($langs->trans('RefuseCP'),'statut5'); if ($statut == 5) return $langs->trans('RefuseCP').' '.img_picto($langs->trans('RefuseCP'),'statut5');
} }
return $statut; return $statut;
} }
@ -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;