From c9053e1d8df458c6318a5bac313e6a77727082d7 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Thu, 22 Sep 2011 10:55:37 +0000 Subject: [PATCH] problem synchro git<->cvs !!! --- htdocs/admin/fournisseur.php | 2 +- htdocs/admin/perms.php | 3 +- htdocs/core/class/conf.class.php | 2 +- htdocs/theme/cameleo/style.css.php | 10 +++-- htdocs/user/class/user.class.php | 9 +++-- htdocs/user/fiche.php | 29 +++++++++++--- htdocs/user/group/fiche.php | 12 ++++-- htdocs/user/group/perms.php | 23 ++++++++++- htdocs/user/index.php | 2 +- scripts/emailings/mailing-send.php | 19 +++++++-- ...ail_unpaid_invoices_to_representatives.php | 40 ++++++++++++------- 11 files changed, 111 insertions(+), 40 deletions(-) diff --git a/htdocs/admin/fournisseur.php b/htdocs/admin/fournisseur.php index 1a858ba6947..9d3da300fa9 100644 --- a/htdocs/admin/fournisseur.php +++ b/htdocs/admin/fournisseur.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2008 Laurent Destailleur + * Copyright (C) 2004-2011 Laurent Destailleur * Copyright (C) 2005-2011 Regis Houssin * Copyright (C) 2004 Sebastien Di Cintio * Copyright (C) 2004 Benoit Mortier diff --git a/htdocs/admin/perms.php b/htdocs/admin/perms.php index 91a8f7e44cc..d0a354cdb40 100644 --- a/htdocs/admin/perms.php +++ b/htdocs/admin/perms.php @@ -2,6 +2,7 @@ /* Copyright (C) 2003 Rodolphe Quiedeville * Copyright (C) 2004-2009 Laurent Destailleur * Copyright (C) 2005-2010 Regis Houssin + * Copyright (C) 2011 Herve Prot * * 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 @@ -141,7 +142,7 @@ $db->commit(); $sql = "SELECT r.id, r.libelle, r.module, r.perms, r.subperms, r.bydefault"; $sql.= " FROM ".MAIN_DB_PREFIX."rights_def as r"; $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 $sql.= " ORDER BY r.module, r.id"; diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index 648666917b5..4a9da4970a8 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -104,7 +104,7 @@ class Conf $sql = "SELECT ".$db->decrypt('name')." as name,"; $sql.= " ".$db->decrypt('value')." as value, entity"; $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. $result = $db->query($sql); diff --git a/htdocs/theme/cameleo/style.css.php b/htdocs/theme/cameleo/style.css.php index 2905a700cb0..4e623ca7e3a 100644 --- a/htdocs/theme/cameleo/style.css.php +++ b/htdocs/theme/cameleo/style.css.php @@ -88,6 +88,10 @@ body { a:link, a:visited, a:active { font-family: ; font-weight: bold; color: blue; text-decoration: none; } a:hover { font-family: ; font-weight: bold; color: #A51B00; text-decoration: none; } +input:focus, textarea:focus, button:focus, select:focus { + box-shadow: 0 0 4px #8091BF; +} + input { font-size: px; font-family: ; @@ -1354,8 +1358,8 @@ tr.liste_titre { th.liste_titre, td.liste_titre { padding-left: 6px; - padding-right: 6px; - /*vertical-align: text-top;*/ + padding-right: 6px; + /*vertical-align: text-top;*/ } th.liste_titre_sel, td.liste_titre_sel { @@ -2143,4 +2147,4 @@ a.cke_dialog_ui_button close(); -?> \ No newline at end of file +?> diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index e4aa3962323..5ebcef96a15 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -504,7 +504,7 @@ class User extends CommonObject $sql.= " FROM ".MAIN_DB_PREFIX."user_rights as ur"; $sql.= ", ".MAIN_DB_PREFIX."rights_def as r"; $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 r.perms IS NOT NULL"; 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 * @return int Number of users */ - function getNbOfUsers($limitTo='') + function getNbOfUsers($limitTo='',$all=0) { global $conf; @@ -2004,8 +2004,9 @@ class User extends CommonObject } else { - $sql.= " WHERE entity = ".$conf->entity; - if ($limitTo == 'active') $sql.= " AND statut = 1"; + if ($all) $sql.= " WHERE entity = is not null"; + else $sql.= " WHERE entity = ".$conf->entity; + if ($limitTo == 'active') $sql.= " AND statut = 1"; } $resql=$this->db->query($sql); diff --git a/htdocs/user/fiche.php b/htdocs/user/fiche.php index 06fc2ff0d98..622b411a840 100644 --- a/htdocs/user/fiche.php +++ b/htdocs/user/fiche.php @@ -124,7 +124,7 @@ if ($action == 'confirm_enable' && $confirm == "yes" && $candisableuser) if (!empty($conf->file->main_limit_users)) { - $nb = $edituser->getNbOfUsers("active"); + $nb = $edituser->getNbOfUsers("active",1); if ($nb >= $conf->file->main_limit_users) { $message='
'.$langs->trans("YourQuotaOfUsersIsReached").'
'; @@ -177,7 +177,7 @@ if ($_POST["action"] == 'add' && $canadduser) 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) { $message='
'.$langs->trans("YourQuotaOfUsersIsReached").'
'; @@ -202,7 +202,15 @@ if ($_POST["action"] == 'add' && $canadduser) $edituser->note = $_POST["note"]; $edituser->ldap_sid = $_POST["ldap_sid"]; // 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(); @@ -298,7 +306,16 @@ if ($action == 'update' && ! $_POST["cancel"]) $edituser->webcal_login = $_POST["webcal_login"]; $edituser->phenix_login = $_POST["phenix_login"]; $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 (! empty($_FILES['photo']['name'])) $edituser->photo = dol_sanitizeFileName($_FILES['photo']['name']); @@ -1324,7 +1341,7 @@ else print ''; print ''; print ''; - 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 ''; } @@ -1349,7 +1366,7 @@ else print img_object($langs->trans("ShowGroup"),"group").' '.$group->nom; } print ''; - 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->getInfo($group->usergroup_entity); diff --git a/htdocs/user/group/fiche.php b/htdocs/user/group/fiche.php index 25bbdb2b788..67b36fd54df 100644 --- a/htdocs/user/group/fiche.php +++ b/htdocs/user/group/fiche.php @@ -94,7 +94,10 @@ if ($action == 'add') if (! $message) { $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"]); $db->begin(); @@ -170,7 +173,10 @@ if ($action == 'update') $object->oldcopy=dol_clone($object); $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"]); $ret=$object->update(); @@ -301,7 +307,7 @@ else print '\n"; diff --git a/htdocs/user/group/perms.php b/htdocs/user/group/perms.php index f1034254783..8281285b452 100644 --- a/htdocs/user/group/perms.php +++ b/htdocs/user/group/perms.php @@ -169,7 +169,16 @@ if ($id) $sql.= " FROM ".MAIN_DB_PREFIX."rights_def as r"; $sql.= ", ".MAIN_DB_PREFIX."usergroup_rights as ugr"; $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; $result=$db->query($sql); @@ -234,7 +243,17 @@ if ($id) $sql = "SELECT r.id, r.libelle, r.module"; $sql.= " FROM ".MAIN_DB_PREFIX."rights_def as r"; $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 $sql.= " ORDER BY r.module, r.id"; diff --git a/htdocs/user/index.php b/htdocs/user/index.php index 7b985d2252e..13637d30ba7 100644 --- a/htdocs/user/index.php +++ b/htdocs/user/index.php @@ -130,7 +130,7 @@ if ($result) } else if (! empty($conf->multicompany->enabled)) { - if ($obj->admin && ! $obj->entity) + if (! $obj->entity) { print $langs->trans("AllEntities"); } diff --git a/scripts/emailings/mailing-send.php b/scripts/emailings/mailing-send.php index e675c743c3f..1d9276d17b0 100644 --- a/scripts/emailings/mailing-send.php +++ b/scripts/emailings/mailing-send.php @@ -2,7 +2,7 @@ - * Copyright (C) 2005-2010 Laurent Destailleur + * Copyright (C) 2005-2011 Laurent Destailleur * * 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 @@ -151,9 +151,20 @@ if ($resql) $substitutionisok=true; // Fabrication du mail - $mail = new CMailFile($newsubject, $sendto, $from, $newmessage, - array(), array(), array(), - '', '', 0, $msgishtml, $errorsto); + $mail = new CMailFile( + $newsubject, + $sendto, + $from, + $newmessage, + array(), + array(), + array(), + '', + '', + 0, + $msgishtml, + $errorsto + ); if ($mail->error) { diff --git a/scripts/invoices/email_unpaid_invoices_to_representatives.php b/scripts/invoices/email_unpaid_invoices_to_representatives.php index abe50d71cb2..261296aa806 100644 --- a/scripts/invoices/email_unpaid_invoices_to_representatives.php +++ b/scripts/invoices/email_unpaid_invoices_to_representatives.php @@ -109,7 +109,14 @@ else 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) { global $conf,$langs; @@ -129,26 +136,31 @@ function envoi_mail($oldemail,$message,$total) $allmessage .= "\n"; $allmessage .= $langs->trans("Total")." = ".price($total)."\n"; - $mail = new CMailFile($subject, - $sendto, - $from, - $allmessage, - array(), - array(), - array(), - '', - '', - 0, - $msgishtml); + $mail = new CMailFile( + $subject, + $sendto, + $from, + $allmessage, + array(), + array(), + array(), + '', + '', + 0, + $msgishtml + ); $mail->errors_to = $errorsto; $result=$mail->sendfile(); if ($result) { - + return 1; + } + else + { + return -1; } - }
'.$langs->trans("Groups").''.$langs->trans("Entity").''.$object->nom; if (empty($object->entity)) { - print img_redstar($langs->trans("GlobalGroup")); + print img_picto($langs->trans("GlobalGroup"),'redstar'); } print "