problem synchro git<->cvs !!!

This commit is contained in:
Regis Houssin 2011-09-22 12:52:30 +02:00
parent 472291e05f
commit 068c5a98d2
11 changed files with 111 additions and 40 deletions

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2011 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2005-2011 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org> * Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be> * Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>

View File

@ -2,6 +2,7 @@
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2010 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2005-2010 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2011 Herve Prot <herve.prot@symeos.com>
* *
* 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
@ -141,7 +142,7 @@ $db->commit();
$sql = "SELECT r.id, r.libelle, r.module, r.perms, r.subperms, r.bydefault"; $sql = "SELECT r.id, r.libelle, r.module, r.perms, r.subperms, r.bydefault";
$sql.= " FROM ".MAIN_DB_PREFIX."rights_def as r"; $sql.= " FROM ".MAIN_DB_PREFIX."rights_def as r";
$sql.= " WHERE r.libelle NOT LIKE 'tou%'"; // On ignore droits "tous" $sql.= " WHERE r.libelle NOT LIKE 'tou%'"; // On ignore droits "tous"
$sql.= " AND entity = ".$conf->entity; $sql.= " AND entity in (".(!empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)?"1,":"").$conf->entity.")";
if (empty($conf->global->MAIN_USE_ADVANCED_PERMS)) $sql.= " AND r.perms NOT LIKE '%_advance'"; // Hide advanced perms if option is disable if (empty($conf->global->MAIN_USE_ADVANCED_PERMS)) $sql.= " AND r.perms NOT LIKE '%_advance'"; // Hide advanced perms if option is disable
$sql.= " ORDER BY r.module, r.id"; $sql.= " ORDER BY r.module, r.id";

View File

@ -104,7 +104,7 @@ class Conf
$sql = "SELECT ".$db->decrypt('name')." as name,"; $sql = "SELECT ".$db->decrypt('name')." as name,";
$sql.= " ".$db->decrypt('value')." as value, entity"; $sql.= " ".$db->decrypt('value')." as value, entity";
$sql.= " FROM ".MAIN_DB_PREFIX."const"; $sql.= " FROM ".MAIN_DB_PREFIX."const";
$sql.= " WHERE entity IN (0,".$this->entity.")"; $sql.= " WHERE entity IN (0,1,".$this->entity.")"; // 1 to herite configuration
$sql.= " ORDER BY entity"; // This is to have entity 0 first, then entity 1 that overwrite. $sql.= " ORDER BY entity"; // This is to have entity 0 first, then entity 1 that overwrite.
$result = $db->query($sql); $result = $db->query($sql);

View File

@ -88,6 +88,10 @@ body {
a:link, a:visited, a:active { font-family: <?php print $fontlist ?>; font-weight: bold; color: blue; text-decoration: none; } a:link, a:visited, a:active { font-family: <?php print $fontlist ?>; font-weight: bold; color: blue; text-decoration: none; }
a:hover { font-family: <?php print $fontlist ?>; font-weight: bold; color: #A51B00; text-decoration: none; } a:hover { font-family: <?php print $fontlist ?>; font-weight: bold; color: #A51B00; text-decoration: none; }
input:focus, textarea:focus, button:focus, select:focus {
box-shadow: 0 0 4px #8091BF;
}
input { input {
font-size: <?php print $fontsize ?>px; font-size: <?php print $fontsize ?>px;
font-family: <?php print $fontlist ?>; font-family: <?php print $fontlist ?>;
@ -1354,8 +1358,8 @@ tr.liste_titre {
th.liste_titre, td.liste_titre th.liste_titre, td.liste_titre
{ {
padding-left: 6px; padding-left: 6px;
padding-right: 6px; padding-right: 6px;
/*vertical-align: text-top;*/ /*vertical-align: text-top;*/
} }
th.liste_titre_sel, td.liste_titre_sel th.liste_titre_sel, td.liste_titre_sel
{ {
@ -2143,4 +2147,4 @@ a.cke_dialog_ui_button
<?php <?php
if (is_object($db)) $db->close(); if (is_object($db)) $db->close();
?> ?>

View File

@ -504,7 +504,7 @@ class User extends CommonObject
$sql.= " FROM ".MAIN_DB_PREFIX."user_rights as ur"; $sql.= " FROM ".MAIN_DB_PREFIX."user_rights as ur";
$sql.= ", ".MAIN_DB_PREFIX."rights_def as r"; $sql.= ", ".MAIN_DB_PREFIX."rights_def as r";
$sql.= " WHERE r.id = ur.fk_id"; $sql.= " WHERE r.id = ur.fk_id";
$sql.= " AND r.entity = ".$conf->entity; $sql.= " AND r.entity in (0,".(!empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)?"1,":"").$conf->entity.")";
$sql.= " AND ur.fk_user= ".$this->id; $sql.= " AND ur.fk_user= ".$this->id;
$sql.= " AND r.perms IS NOT NULL"; $sql.= " AND r.perms IS NOT NULL";
if ($moduletag) $sql.= " AND r.module = '".$this->db->escape($moduletag)."'"; if ($moduletag) $sql.= " AND r.module = '".$this->db->escape($moduletag)."'";
@ -1992,7 +1992,7 @@ class User extends CommonObject
* @param string $limitTo Limit to 'active' or 'superadmin' users * @param string $limitTo Limit to 'active' or 'superadmin' users
* @return int Number of users * @return int Number of users
*/ */
function getNbOfUsers($limitTo='') function getNbOfUsers($limitTo='',$all=0)
{ {
global $conf; global $conf;
@ -2004,8 +2004,9 @@ class User extends CommonObject
} }
else else
{ {
$sql.= " WHERE entity = ".$conf->entity; if ($all) $sql.= " WHERE entity = is not null";
if ($limitTo == 'active') $sql.= " AND statut = 1"; else $sql.= " WHERE entity = ".$conf->entity;
if ($limitTo == 'active') $sql.= " AND statut = 1";
} }
$resql=$this->db->query($sql); $resql=$this->db->query($sql);

View File

@ -124,7 +124,7 @@ if ($action == 'confirm_enable' && $confirm == "yes" && $candisableuser)
if (!empty($conf->file->main_limit_users)) if (!empty($conf->file->main_limit_users))
{ {
$nb = $edituser->getNbOfUsers("active"); $nb = $edituser->getNbOfUsers("active",1);
if ($nb >= $conf->file->main_limit_users) if ($nb >= $conf->file->main_limit_users)
{ {
$message='<div class="error">'.$langs->trans("YourQuotaOfUsersIsReached").'</div>'; $message='<div class="error">'.$langs->trans("YourQuotaOfUsersIsReached").'</div>';
@ -177,7 +177,7 @@ if ($_POST["action"] == 'add' && $canadduser)
if (!empty($conf->file->main_limit_users)) // If option to limit users is set if (!empty($conf->file->main_limit_users)) // If option to limit users is set
{ {
$nb = $edituser->getNbOfUsers("active"); $nb = $edituser->getNbOfUsers("active",1);
if ($nb >= $conf->file->main_limit_users) if ($nb >= $conf->file->main_limit_users)
{ {
$message='<div class="error">'.$langs->trans("YourQuotaOfUsersIsReached").'</div>'; $message='<div class="error">'.$langs->trans("YourQuotaOfUsersIsReached").'</div>';
@ -202,7 +202,15 @@ if ($_POST["action"] == 'add' && $canadduser)
$edituser->note = $_POST["note"]; $edituser->note = $_POST["note"];
$edituser->ldap_sid = $_POST["ldap_sid"]; $edituser->ldap_sid = $_POST["ldap_sid"];
// If multicompany is off, admin users must all be on entity 0. // If multicompany is off, admin users must all be on entity 0.
$edituser->entity = (! empty($_POST["admin"]) && (! empty($_POST["superadmin"]) || empty($_POST["entity"]) || empty($conf->multicompany->enabled)) ? 0 : $_POST["entity"]); if($conf->multicompany->enabled)
if($conf->global->MULTICOMPANY_TRANSVERSE_MODE || ! empty($_POST["superadmin"]))
$edituser->entity=0;
else
$edituser->entity = (empty($_POST["entity"]) ? 0 : $_POST["entity"]);
else if(! empty($_POST["admin"]))
$edituser->entity=0;
else
$edituser->entity = (empty($_POST["entity"]) ? 0 : $_POST["entity"]);
$db->begin(); $db->begin();
@ -298,7 +306,16 @@ if ($action == 'update' && ! $_POST["cancel"])
$edituser->webcal_login = $_POST["webcal_login"]; $edituser->webcal_login = $_POST["webcal_login"];
$edituser->phenix_login = $_POST["phenix_login"]; $edituser->phenix_login = $_POST["phenix_login"];
$edituser->phenix_pass = $_POST["phenix_pass"]; $edituser->phenix_pass = $_POST["phenix_pass"];
$edituser->entity = ((! empty($_POST["superadmin"]) && ! empty($_POST["admin"]) || empty($_POST["entity"])) ? 0 : $_POST["entity"]); if($conf->multicompany->enabled)
if($conf->global->MULTICOMPANY_TRANSVERSE_MODE || ! empty($_POST["superadmin"]))
$edituser->entity=0;
else
$edituser->entity = (empty($_POST["entity"]) ? 0 : $_POST["entity"]);
else if(! empty($_POST["admin"]))
$edituser->entity=0;
else
$edituser->entity = (empty($_POST["entity"]) ? 0 : $_POST["entity"]);
if (GETPOST('deletephoto')) $edituser->photo=''; if (GETPOST('deletephoto')) $edituser->photo='';
if (! empty($_FILES['photo']['name'])) $edituser->photo = dol_sanitizeFileName($_FILES['photo']['name']); if (! empty($_FILES['photo']['name'])) $edituser->photo = dol_sanitizeFileName($_FILES['photo']['name']);
@ -1324,7 +1341,7 @@ else
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td class="liste_titre" width="25%">'.$langs->trans("Groups").'</td>'; print '<td class="liste_titre" width="25%">'.$langs->trans("Groups").'</td>';
if(! empty($conf->multicompany->enabled) && empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1 && $user->admin && ! $user->entity) if(! empty($conf->multicompany->enabled) && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1 && $user->admin && ! $user->entity)
{ {
print '<td class="liste_titre" width="25%">'.$langs->trans("Entity").'</td>'; print '<td class="liste_titre" width="25%">'.$langs->trans("Entity").'</td>';
} }
@ -1349,7 +1366,7 @@ else
print img_object($langs->trans("ShowGroup"),"group").' '.$group->nom; print img_object($langs->trans("ShowGroup"),"group").' '.$group->nom;
} }
print '</td>'; print '</td>';
if(! empty($conf->multicompany->enabled) && empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1 && $user->admin && ! $user->entity) if(! empty($conf->multicompany->enabled) && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1 && $user->admin && ! $user->entity)
{ {
$mc = new ActionsMulticompany($db); $mc = new ActionsMulticompany($db);
$mc->getInfo($group->usergroup_entity); $mc->getInfo($group->usergroup_entity);

View File

@ -94,7 +94,10 @@ if ($action == 'add')
if (! $message) if (! $message)
{ {
$object->nom = trim($_POST["nom"]); $object->nom = trim($_POST["nom"]);
$object->entity = $_POST["entity"]; if($conf->multicompany->enabled && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE))
$object->entity = 0;
else
$object->entity = $_POST["entity"];
$object->note = trim($_POST["note"]); $object->note = trim($_POST["note"]);
$db->begin(); $db->begin();
@ -170,7 +173,10 @@ if ($action == 'update')
$object->oldcopy=dol_clone($object); $object->oldcopy=dol_clone($object);
$object->nom = trim($_POST["group"]); $object->nom = trim($_POST["group"]);
$object->entity = $_POST["entity"]; if($conf->multicompany->enabled && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE))
$object->entity = 0;
else
$object->entity = $_POST["entity"];
$object->note = dol_htmlcleanlastbr($_POST["note"]); $object->note = dol_htmlcleanlastbr($_POST["note"]);
$ret=$object->update(); $ret=$object->update();
@ -301,7 +307,7 @@ else
print '<td width="75%" class="valeur">'.$object->nom; print '<td width="75%" class="valeur">'.$object->nom;
if (empty($object->entity)) if (empty($object->entity))
{ {
print img_redstar($langs->trans("GlobalGroup")); print img_picto($langs->trans("GlobalGroup"),'redstar');
} }
print "</td></tr>\n"; print "</td></tr>\n";

View File

@ -169,7 +169,16 @@ if ($id)
$sql.= " FROM ".MAIN_DB_PREFIX."rights_def as r"; $sql.= " FROM ".MAIN_DB_PREFIX."rights_def as r";
$sql.= ", ".MAIN_DB_PREFIX."usergroup_rights as ugr"; $sql.= ", ".MAIN_DB_PREFIX."usergroup_rights as ugr";
$sql.= " WHERE ugr.fk_id = r.id"; $sql.= " WHERE ugr.fk_id = r.id";
$sql.= " AND r.entity = ".(empty($conf->multicompany->enabled) ? $conf->entity : $fgroup->entity); if(!empty($conf->multicompany->enabled))
{
if(empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE))
$sql.= " AND r.entity = ".$conf->entity;
else
$sql.= " AND r.entity in (0,1)";
}
else
$sql.= " AND r.entity = ".$fgroup->entity;
$sql.= " AND ugr.fk_usergroup = ".$fgroup->id; $sql.= " AND ugr.fk_usergroup = ".$fgroup->id;
$result=$db->query($sql); $result=$db->query($sql);
@ -234,7 +243,17 @@ if ($id)
$sql = "SELECT r.id, r.libelle, r.module"; $sql = "SELECT r.id, r.libelle, r.module";
$sql.= " FROM ".MAIN_DB_PREFIX."rights_def as r"; $sql.= " FROM ".MAIN_DB_PREFIX."rights_def as r";
$sql.= " WHERE r.libelle NOT LIKE 'tou%'"; // On ignore droits "tous" $sql.= " WHERE r.libelle NOT LIKE 'tou%'"; // On ignore droits "tous"
$sql.= " AND r.entity = ".(empty($conf->multicompany->enabled) ? $conf->entity : $fgroup->entity); //$sql.= " AND r.entity = ".(empty($conf->multicompany->enabled) ? $conf->entity : $fgroup->entity);
if(!empty($conf->multicompany->enabled))
{
if(empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE))
$sql.= " AND r.entity = ".$conf->entity;
else
$sql.= " AND r.entity in (0,1)";
}
else
$sql.= " AND r.entity = ".$fgroup->entity;
if (empty($conf->global->MAIN_USE_ADVANCED_PERMS)) $sql.= " AND r.perms NOT LIKE '%_advance'"; // Hide advanced perms if option is disable if (empty($conf->global->MAIN_USE_ADVANCED_PERMS)) $sql.= " AND r.perms NOT LIKE '%_advance'"; // Hide advanced perms if option is disable
$sql.= " ORDER BY r.module, r.id"; $sql.= " ORDER BY r.module, r.id";

View File

@ -130,7 +130,7 @@ if ($result)
} }
else if (! empty($conf->multicompany->enabled)) else if (! empty($conf->multicompany->enabled))
{ {
if ($obj->admin && ! $obj->entity) if (! $obj->entity)
{ {
print $langs->trans("AllEntities"); print $langs->trans("AllEntities");
} }

View File

@ -2,7 +2,7 @@
<?php <?php
/* /*
* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org> * Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2005-2010 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2005-2011 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
@ -151,9 +151,20 @@ if ($resql)
$substitutionisok=true; $substitutionisok=true;
// Fabrication du mail // Fabrication du mail
$mail = new CMailFile($newsubject, $sendto, $from, $newmessage, $mail = new CMailFile(
array(), array(), array(), $newsubject,
'', '', 0, $msgishtml, $errorsto); $sendto,
$from,
$newmessage,
array(),
array(),
array(),
'',
'',
0,
$msgishtml,
$errorsto
);
if ($mail->error) if ($mail->error)
{ {

View File

@ -109,7 +109,14 @@ else
dol_syslog("email_unpaid_invoices_to_representatives.php: Error"); dol_syslog("email_unpaid_invoices_to_representatives.php: Error");
} }
/**
* Send email
*
* @param string $oldemail Old email
* @param string $message Message to send
* @param string $total Total amount of unpayed invoices
* @return int <0 if KO, >0 if OK
*/
function envoi_mail($oldemail,$message,$total) function envoi_mail($oldemail,$message,$total)
{ {
global $conf,$langs; global $conf,$langs;
@ -129,26 +136,31 @@ function envoi_mail($oldemail,$message,$total)
$allmessage .= "\n"; $allmessage .= "\n";
$allmessage .= $langs->trans("Total")." = ".price($total)."\n"; $allmessage .= $langs->trans("Total")." = ".price($total)."\n";
$mail = new CMailFile($subject, $mail = new CMailFile(
$sendto, $subject,
$from, $sendto,
$allmessage, $from,
array(), $allmessage,
array(), array(),
array(), array(),
'', array(),
'', '',
0, '',
$msgishtml); 0,
$msgishtml
);
$mail->errors_to = $errorsto; $mail->errors_to = $errorsto;
$result=$mail->sendfile(); $result=$mail->sendfile();
if ($result) if ($result)
{ {
return 1;
}
else
{
return -1;
} }
} }