From 2f4822e73b834fd026c7627ff61adee6a6c456a6 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Wed, 15 Oct 2014 20:43:32 +0200 Subject: [PATCH 1/3] Merge --- htdocs/projet/tasks/time.php | 50 ++++++++++++++++++------------------ 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 13b1e48f477..676b17a5951 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -292,37 +292,37 @@ if ($id > 0 || ! empty($ref)) // Label print ''.$langs->trans("Label").''.$object->label.''; - // Date start - print ''.$langs->trans("DateStart").''; - print dol_print_date($object->date_start,'dayhour'); - print ''; - - // Date end - print ''.$langs->trans("DateEnd").''; - print dol_print_date($object->date_end,'dayhour'); - print ''; - - // Planned workload - print ''.$langs->trans("PlannedWorkload").''; - print convertSecondToTime($object->planned_workload,'allhourmin'); - print ''; - - // Progress declared - print ''.$langs->trans("ProgressDeclared").''; - print $object->progress.' %'; - print ''; - - // Progress calculated + // Date start + print ''.$langs->trans("DateStart").''; + print dol_print_date($object->date_start,'dayhour'); + print ''; + + // Date end + print ''.$langs->trans("DateEnd").''; + print dol_print_date($object->date_end,'dayhour'); + print ''; + + // Planned workload + print ''.$langs->trans("PlannedWorkload").''; + print convertSecondToTime($object->planned_workload,'allhourmin'); + print ''; + + // Progress declared + print ''.$langs->trans("ProgressDeclared").''; + print $object->progress.' %'; + print ''; + + // Progress calculated print ''.$langs->trans("ProgressCalculated").''; if ($object->planned_workload) { - $tmparray=$object->getSummaryOfTimeSpent(); + $tmparray=$object->getSummaryOfTimeSpent(); if ($tmparray['total_duration'] > 0) print round($tmparray['total_duration']/$object->planned_workload*100, 2).' %'; else print '0 %'; } - else print ''; - print ''; - + else print ''; + print ''; + // Project if (empty($withproject)) { From c1d016a5312ed9ef945ba41a2d9424fd96cf6389 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Thu, 16 Oct 2014 06:20:54 +0200 Subject: [PATCH 2/3] Add field to select color of the user in user's card --- htdocs/comm/action/index.php | 4 +- htdocs/langs/en_US/users.lang | 3 +- htdocs/user/agenda_extsites.php | 2 +- htdocs/user/card.php | 138 ++++++++++++++++++++----------- htdocs/user/class/user.class.php | 40 +++++---- 5 files changed, 120 insertions(+), 67 deletions(-) diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index 2db6936e1d3..00d73256f26 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -1146,11 +1146,11 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa if (in_array($user->id, $keysofuserassigned)) { $nummytasks++; $cssclass='family_mytasks'; - // TODO Set a color using user color + // Must defined rule to choose color of who to use. // event->ownerid will still contains user id of owner // event->userassigned will be an array in future. - // $color=$user->color; + $color=$user->color; } else if ($event->type_code == 'ICALEVENT') { diff --git a/htdocs/langs/en_US/users.lang b/htdocs/langs/en_US/users.lang index 495cb3981c6..c13e3e767bb 100644 --- a/htdocs/langs/en_US/users.lang +++ b/htdocs/langs/en_US/users.lang @@ -119,4 +119,5 @@ HierarchicView=Hierarchical view UseTypeFieldToChange=Use field Type to change OpenIDURL=OpenID URL LoginUsingOpenID=Use OpenID to login -WeeklyHours=Weekly hours \ No newline at end of file +WeeklyHours=Weekly hours +ColorUser=Color of the user \ No newline at end of file diff --git a/htdocs/user/agenda_extsites.php b/htdocs/user/agenda_extsites.php index 4109e7ab9a4..1993f12bd5c 100644 --- a/htdocs/user/agenda_extsites.php +++ b/htdocs/user/agenda_extsites.php @@ -46,7 +46,7 @@ $actionsave=GETPOST('save','alpha'); if (empty($conf->global->AGENDA_EXT_NB)) $conf->global->AGENDA_EXT_NB=5; $MAXAGENDA=empty($conf->global->AGENDA_EXT_NB)?5:$conf->global->AGENDA_EXT_NB; -// List of aviable colors +// List of available colors $colorlist=array('BECEDD','DDBECE','BFDDBE','F598B4','F68654','CBF654','A4A4A5'); // Security check diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 01b6ec32f52..4e17875f1ed 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -36,6 +36,7 @@ require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; +if (! empty($conf->agenda->enabled))require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; if (! empty($conf->ldap->enabled)) require_once DOL_DOCUMENT_ROOT.'/core/class/ldap.class.php'; if (! empty($conf->adherent->enabled)) require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; if (! empty($conf->multicompany->enabled)) dol_include_once('/multicompany/class/actions_multicompany.class.php'); @@ -154,7 +155,7 @@ if ($action == 'confirm_delete' && $confirm == "yes" && $candisableuser) } } -// Action ajout user +// Action Add user if ($action == 'add' && $canadduser) { $error = 0; @@ -205,6 +206,8 @@ if ($action == 'add' && $canadduser) $object->salary = GETPOST("salary")!=''?GETPOST("salary"):''; $object->salaryextra = GETPOST("salaryextra")!=''?GETPOST("salaryextra"):''; $object->weeklyhours = GETPOST("weeklyhours")!=''?GETPOST("weeklyhours"):''; + + $object->color = GETPOST("color")!=''?GETPOST("color"):''; // Fill array 'array_options' with data from add form $ret = $extrafields->setOptionalsFromPost($extralabels,$object); @@ -258,7 +261,7 @@ if ($action == 'add' && $canadduser) } } -// Action ajout groupe utilisateur +// Action add usergroup if (($action == 'addgroup' || $action == 'removegroup') && $caneditfield) { if ($group) @@ -350,6 +353,8 @@ if ($action == 'update' && ! $_POST["cancel"]) $object->salary = GETPOST("salary")!=''?GETPOST("salary"):''; $object->salaryextra = GETPOST("salaryextra")!=''?GETPOST("salaryextra"):''; $object->weeklyhours = GETPOST("weeklyhours")!=''?GETPOST("weeklyhours"):''; + + $object->color = GETPOST("color")!=''?GETPOST("color"):''; // Fill array 'array_options' with data from add form $ret = $extrafields->setOptionalsFromPost($extralabels,$object); @@ -589,6 +594,7 @@ if ($action == 'adduserldap') */ $form = new Form($db); +$formother=new FormOther($db); llxHeader('',$langs->trans("UserCard")); @@ -670,7 +676,7 @@ if (($action == 'create') || ($action == 'adduserldap')) setEventMessage($ldap->error, 'errors'); } - // Si la liste des users est rempli, on affiche la liste deroulante + // If user list is full, we show drop-down list print "\n\n\n"; print '
'; @@ -767,7 +773,7 @@ if (($action == 'create') || ($action == 'adduserldap')) } $password=$generated_password; - // Mot de passe + // Password print ''.$langs->trans("Password").''; print ''; if (! empty($ldap_sid)) @@ -789,7 +795,7 @@ if (($action == 'create') || ($action == 'adduserldap')) } print ''; - // Administrateur + // Administrator if (! empty($user->admin)) { print ''.$langs->trans("Administrator").''; @@ -974,6 +980,15 @@ if (($action == 'create') || ($action == 'adduserldap')) print ''; print ''; print "\n"; + + // User color + if (! empty($conf->agenda->enabled)) + { + print ''.$langs->trans("ColorUser").''; + print ''; + print $formother->selectColor(GETPOST('color')?GETPOST('color'):$object->color, 'color', 'usercolorconfig', 1, '', 'hideifnotset'); + print ''; + } // Note print ''; @@ -1002,7 +1017,7 @@ else { /* ************************************************************************** */ /* */ - /* Visu et edition */ + /* View and edition */ /* */ /* ************************************************************************** */ @@ -1032,7 +1047,7 @@ else $userDisabled = 0; $statutUACF = ''; - //On verifie les options du compte + // Check options of user account if (count($ldap->uacf) > 0) { foreach ($ldap->uacf as $key => $statut) @@ -1080,7 +1095,7 @@ else } /* - * Confirmation desactivation + * Confirm deactivation */ if ($action == 'disable') { @@ -1088,7 +1103,7 @@ else } /* - * Confirmation activation + * Confirm activation */ if ($action == 'enable') { @@ -1108,13 +1123,13 @@ else */ if ($action != 'edit') { - $rowspan=16; - + $rowspan=17; + print ''; // Ref print ''; - print ''; print ''."\n"; @@ -1123,10 +1138,12 @@ else if (! empty($conf->societe->enabled)) $rowspan++; if (! empty($conf->adherent->enabled)) $rowspan++; if (! empty($conf->skype->enabled)) $rowspan++; + if (! empty($conf->salaries->enabled) && ! empty($user->rights->salaries->read)) $rowspan = $rowspan+3; + if (! empty($conf->agenda->enabled)) $rowspan++; // Lastname print ''; - print ''; + print ''; // Photo print ''; - print ''; + print ''; print ''."\n"; // Position/Job print ''; - print ''; + print ''; print ''."\n"; // Login print ''; if (! empty($object->ldap_sid) && $object->statut==0) { - print ''; + print ''; } else { - print ''; + print ''; } print ''."\n"; @@ -1163,24 +1180,24 @@ else { if ($passDoNotExpire) { - print ''; + print ''; } else if($userChangePassNextLogon) { - print ''; + print ''; } else if($userDisabled) { - print ''; + print ''; } else { - print ''; + print ''; } } else { - print ''."\n"; // Administrator - print ''."\n"; // Type - print ''."\n"; } // Tel pro print ''; - print ''; + print ''; print ''."\n"; // Tel mobile print ''; - print ''; + print ''; print ''."\n"; // Fax print ''; - print ''; + print ''; print ''."\n"; // Skype if (! empty($conf->skype->enabled)) { - print ''; - print ''; + print ''; + print ''; print "\n"; } // EMail print ''; - print ''; + print ''; print "\n"; // Signature - print '\n"; // Hierarchy print ''; - print ''; print "\n"; - if ($conf->salaries->enabled && ! empty($user->rights->salaries->read)) + if (! empty($conf->salaries->enabled) && ! empty($user->rights->salaries->read)) { $langs->load("salaries"); // THM print ''; - print ''; print "\n"; // TJM print ''; - print ''; print "\n"; // Salary print ''; - print ''; print "\n"; @@ -1296,7 +1313,7 @@ else // Weeklyhours print ''; - print ''; print "\n"; @@ -1306,28 +1323,39 @@ else { $rowspan++; print ''; - print ''; + print ''; + } + + // Color user + if (! empty($conf->agenda->enabled)) + { + print ''; + print ''; + print ''; + print "\n"; } // Status print ''; - print ''; print ''."\n"; print ''; - print ''; + print ''; print "\n"; print ''; - print ''; + print ''; print "\n"; if (isset($conf->file->main_authentication) && preg_match('/openid/',$conf->file->main_authentication) && ! empty($conf->global->MAIN_OPENIDURL_PERUSER)) { print ''; - print ''; + print ''; print "\n"; } @@ -1335,7 +1363,7 @@ else if (! empty($conf->societe->enabled)) { print ''; - print ''; - print ''; @@ -1957,7 +1988,7 @@ else print ''; print "\n"; - if ($conf->salaries->enabled && ! empty($user->rights->salaries->read)) + if (! empty($conf->salaries->enabled) && ! empty($user->rights->salaries->read)) { $langs->load("salaries"); @@ -2008,6 +2039,15 @@ else print ''; print ""; } + + // User color + if (! empty($conf->agenda->enabled)) + { + print ''; + print ''; + } // Status print ''; diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 4afd650f4ae..8b06d3b9bdf 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -51,7 +51,7 @@ class User extends CommonObject var $firstname; var $note; var $email; - var $skype; + var $skype; var $job; var $signature; var $office_phone; @@ -101,13 +101,14 @@ class User extends CommonObject var $users; // To store all tree of users hierarchy var $parentof; // To store an array of all parents for all ids. - var $accountancy_code; // Accountancy code in prevision of the complete accountancy module - var $thm; // Average cost of employee - var $tjm; // Average cost of employee - var $salary; // Monthly salary - var $salaryextra; // Monthly salary extra - var $weeklyhours; // Weekly hours + var $accountancy_code; // Accountancy code in prevision of the complete accountancy module + var $thm; // Average cost of employee + var $tjm; // Average cost of employee + var $salary; // Monthly salary + var $salaryextra; // Monthly salary extra + var $weeklyhours; // Weekly hours + var $color; // Define background color for user in agenda /** * Constructor de la classe @@ -166,6 +167,7 @@ class User extends CommonObject $sql.= " u.salary,"; $sql.= " u.salaryextra,"; $sql.= " u.weeklyhours,"; + $sql.= " u.color,"; $sql.= " u.ref_int, u.ref_ext"; $sql.= " FROM ".MAIN_DB_PREFIX."user as u"; @@ -233,6 +235,7 @@ class User extends CommonObject $this->salary = $obj->salary; $this->salaryextra = $obj->salaryextra; $this->weeklyhours = $obj->weeklyhours; + $this->color = $obj->color; $this->datec = $this->db->jdate($obj->datec); $this->datem = $this->db->jdate($obj->datem); @@ -270,7 +273,7 @@ class User extends CommonObject return -1; } - // Recupere parametrage global propre a l'utilisateur + // To get back the global configuration unique to the user if ($loadpersonalconf) { $sql = "SELECT param, value FROM ".MAIN_DB_PREFIX."user_param"; @@ -302,7 +305,7 @@ class User extends CommonObject } /** - * Ajoute un droit a l'utilisateur + * Add a right to the user * * @param int $rid id du droit a ajouter * @param string $allmodule Ajouter tous les droits du module allmodule @@ -404,7 +407,7 @@ class User extends CommonObject /** - * Retire un droit a l'utilisateur + * Remove a right to the user * * @param int $rid Id du droit a retirer * @param string $allmodule Retirer tous les droits du module allmodule @@ -672,7 +675,7 @@ class User extends CommonObject $this->db->begin(); - // Desactive utilisateur + // Deactivate user $sql = "UPDATE ".MAIN_DB_PREFIX."user"; $sql.= " SET statut = ".$this->statut; $sql.= " WHERE rowid = ".$this->id; @@ -717,7 +720,7 @@ class User extends CommonObject dol_syslog(get_class($this)."::delete", LOG_DEBUG); - // Supprime droits + // Remove rights $sql = "DELETE FROM ".MAIN_DB_PREFIX."user_rights WHERE fk_user = ".$this->id; if (! $error && ! $this->db->query($sql)) @@ -734,7 +737,7 @@ class User extends CommonObject $this->error = $this->db->lasterror(); } - // Si contact, supprime lien + // If contact, remove link if ($this->contact_id) { $sql = "UPDATE ".MAIN_DB_PREFIX."socpeople SET fk_user_creat = null WHERE rowid = ".$this->contact_id; @@ -1063,7 +1066,7 @@ class User extends CommonObject } /** - * Affectation des permissions par defaut + * Assign rights by default * * @return Si erreur <0, si ok renvoi le nbre de droits par defaut positionnes */ @@ -1142,6 +1145,7 @@ class User extends CommonObject $this->zip = empty($this->zip)?'':$this->zip; $this->town = empty($this->town)?'':$this->town; $this->accountancy_code = trim($this->accountancy_code); + $this->color = empty($this->color)?'':$this->color; // Check parameters if (! empty($conf->global->USER_MAIL_REQUIRED) && ! isValidEMail($this->email)) @@ -1150,6 +1154,13 @@ class User extends CommonObject $this->error = $langs->trans("ErrorBadEMail",$this->email); return -1; } + + if (empty($this->color)) + { + $langs->load("errors"); + $this->error = $langs->trans("ErrorColor",$this->color); + return -1; + } $this->db->begin(); @@ -1172,6 +1183,7 @@ class User extends CommonObject $sql.= ", job = '".$this->db->escape($this->job)."'"; $sql.= ", signature = '".$this->db->escape($this->signature)."'"; $sql.= ", accountancy_code = '".$this->db->escape($this->accountancy_code)."'"; + $sql.= ", color = '".$this->db->escape($this->color)."'"; $sql.= ", note = '".$this->db->escape($this->note)."'"; $sql.= ", photo = ".($this->photo?"'".$this->db->escape($this->photo)."'":"null"); $sql.= ", openid = ".($this->openid?"'".$this->db->escape($this->openid)."'":"null"); From b4a9e6a119d3712f106bda6d9c893b52579cee90 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Thu, 16 Oct 2014 21:14:57 +0200 Subject: [PATCH 3/3] Fix :: Administrator not created on new install --- htdocs/user/class/user.class.php | 7 ------- 1 file changed, 7 deletions(-) diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 8b06d3b9bdf..91f85d4cb0b 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -1155,13 +1155,6 @@ class User extends CommonObject return -1; } - if (empty($this->color)) - { - $langs->load("errors"); - $this->error = $langs->trans("ErrorColor",$this->color); - return -1; - } - $this->db->begin(); // Mise a jour autres infos
'.$langs->trans("Ref").''; + print ''; print $form->showrefnav($object,'id','',$user->rights->user->user->lire || $user->admin); print '
'.$langs->trans("Lastname").''.$object->lastname.''.$object->lastname.''; @@ -1137,23 +1154,23 @@ else // Firstname print '
'.$langs->trans("Firstname").''.$object->firstname.''.$object->firstname.'
'.$langs->trans("PostOrFunction").''.$object->job.''.$object->job.'
'.$langs->trans("Login").''.$langs->trans("LoginAccountDisableInDolibarr").''.$langs->trans("LoginAccountDisableInDolibarr").''.$object->login.''.$object->login.'
'.$langs->trans("LdapUacf_".$statutUACF).''.$langs->trans("LdapUacf_".$statutUACF).''.$langs->trans("UserMustChangePassNextLogon",$ldap->domainFQDN).''.$langs->trans("UserMustChangePassNextLogon",$ldap->domainFQDN).''.$langs->trans("LdapUacf_".$statutUACF,$ldap->domainFQDN).''.$langs->trans("LdapUacf_".$statutUACF,$ldap->domainFQDN).''.$langs->trans("DomainPassword").''.$langs->trans("DomainPassword").''; + print ''; if ($object->pass) print preg_replace('/./i','*',$object->pass); else { @@ -1192,7 +1209,7 @@ else print '
'.$langs->trans("Administrator").''; + print '
'.$langs->trans("Administrator").''; if (! empty($conf->multicompany->enabled) && $object->admin && ! $object->entity) { print $form->textwithpicto(yn($object->admin),$langs->trans("SuperAdministratorDesc"),1,"superadmin"); @@ -1208,7 +1225,7 @@ else print '
'.$langs->trans("Type").''; + print '
'.$langs->trans("Type").''; $type=$langs->trans("Internal"); if ($object->societe_id) $type=$langs->trans("External"); print $form->textwithpicto($type,$langs->trans("InternalExternalDesc")); @@ -1218,47 +1235,47 @@ else // Ldap sid if ($object->ldap_sid) { - print '
'.$langs->trans("Type").''; + print '
'.$langs->trans("Type").''; print $langs->trans("DomainUser",$ldap->domainFQDN); print '
'.$langs->trans("PhonePro").''.dol_print_phone($object->office_phone,'',0,0,1).''.dol_print_phone($object->office_phone,'',0,0,1).'
'.$langs->trans("PhoneMobile").''.dol_print_phone($object->user_mobile,'',0,0,1).''.dol_print_phone($object->user_mobile,'',0,0,1).'
'.$langs->trans("Fax").''.dol_print_phone($object->office_fax,'',0,0,1).''.dol_print_phone($object->office_fax,'',0,0,1).'
'.$langs->trans("Skype").''.dol_print_skype($object->skype,0,0,1).'
'.$langs->trans("Skype").''.dol_print_skype($object->skype,0,0,1).'
'.$langs->trans("EMail").''.dol_print_email($object->email,0,0,1).''.dol_print_email($object->email,0,0,1).'
'.$langs->trans('Signature').''; + print '
'.$langs->trans('Signature').''; print dol_htmlentitiesbr($object->signature); print "
'.$langs->trans("HierarchicalResponsible").''; + print ''; if (empty($object->fk_user)) print $langs->trans("None"); else { $huser=new User($db); @@ -1268,27 +1285,27 @@ else print '
'.$langs->trans("THM").''; + print ''; print ($object->thm!=''?price($object->thm,'',$langs,1,-1,-1,$conf->currency):''); print '
'.$langs->trans("TJM").''; + print ''; print ($object->tjm!=''?price($object->tjm,'',$langs,1,-1,-1,$conf->currency):''); print '
'.$langs->trans("Salary").''; + print ''; print ($object->salary!=''?price($object->salary,'',$langs,1,-1,-1,$conf->currency):''); print '
'.$langs->trans("WeeklyHours").''; + print ''; print price2num($object->weeklyhours); print '
'.$langs->trans("AccountancyCode").''.$object->accountancy_code.''.$object->accountancy_code.'
'.$langs->trans("ColorUser").''; + print $object->color; + print ' 
'.$langs->trans("Status").''; + print ''; print $object->getLibStatut(4); print '
'.$langs->trans("LastConnexion").''.dol_print_date($object->datelastlogin,"dayhour").''.dol_print_date($object->datelastlogin,"dayhour").'
'.$langs->trans("PreviousConnexion").''.dol_print_date($object->datepreviouslogin,"dayhour").''.dol_print_date($object->datepreviouslogin,"dayhour").'
'.$langs->trans("OpenIDURL").''.$object->openid.''.$object->openid.'
'.$langs->trans("LinkToCompanyContact").''; + print ''; if (isset($object->societe_id) && $object->societe_id > 0) { $societe = new Societe($db); @@ -1363,7 +1391,7 @@ else { $langs->load("members"); print '
'.$langs->trans("LinkedToDolibarrMember").''; + print ''; if ($object->fk_member) { $adh=new Adherent($db); @@ -1631,7 +1659,10 @@ else if (isset($conf->file->main_authentication) && preg_match('/openid/',$conf->file->main_authentication) && ! empty($conf->global->MAIN_OPENIDURL_PERUSER)) $rowspan++; if (! empty($conf->societe->enabled)) $rowspan++; if (! empty($conf->adherent->enabled)) $rowspan++; - + if (! empty($conf->skype->enabled)) $rowspan++; + if (! empty($conf->salaries->enabled) && ! empty($user->rights->salaries->read)) $rowspan = $rowspan+3; + if (! empty($conf->agenda->enabled)) $rowspan++; + print ''; print ''; print ''; @@ -1696,7 +1727,7 @@ else print ''; } else - { + { print ''; print $object->job; } @@ -1918,7 +1949,7 @@ else print $doleditor->Create(1); } else - { + { print dol_htmlentitiesbr($object->signature); } print '
'.$langs->trans("ColorUser").''; + print $formother->selectColor(GETPOST('color')?GETPOST('color'):$object->color, 'color', 'usercolorconfig', 1, '', 'hideifnotset'); + print '
'.$langs->trans("Status").'