From 6d093b03f618fc9db51fc4cd97e08281e8bcd3ff Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 4 Dec 2018 18:07:02 +0100 Subject: [PATCH 1/7] Code comment --- htdocs/core/lib/security.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php index 83e90114bb6..508cd1c159e 100644 --- a/htdocs/core/lib/security.lib.php +++ b/htdocs/core/lib/security.lib.php @@ -142,7 +142,7 @@ function dol_hash($chain, $type='0') * If constant MAIN_SECURITY_HASH_ALGO is defined, we use this function as hashing function. * If constant MAIN_SECURITY_SALT is defined, we use it as a salt. * - * @param string $chain String to hash + * @param string $chain String to hash (not hashed string) * @param string $hash hash to compare * @param string $type Type of hash ('0':auto, '1':sha1, '2':sha1+md5, '3':md5, '4':md5 for OpenLdap, '5':sha256). Use '3' here, if hash is not needed for security purpose, for security need, prefer '0'. * @return bool True if the computed hash is the same as the given one From 30abedbcbdeefbefd5c599a967a53e1cb8893a3d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 6 Dec 2018 19:29:11 +0100 Subject: [PATCH 2/7] Minor fix --- htdocs/install/upgrade2.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/htdocs/install/upgrade2.php b/htdocs/install/upgrade2.php index 6ea7940d7a0..bbdc82b1b8b 100644 --- a/htdocs/install/upgrade2.php +++ b/htdocs/install/upgrade2.php @@ -4848,16 +4848,20 @@ function migrate_user_photospath() { while ($obj = $db->fetch_object($resql)) { + print '.'; + $fuser->fetch($obj->uid); //echo '
'.$fuser->id.' -> '.$fuser->entity; - $entity = (!empty($fuser->entity)) ? $fuser->entity : 1; + $entity = (empty($fuser->entity) ? 1 : $fuser->entity); if ($entity > 1) { $dir = DOL_DATA_ROOT . '/' . $entity . '/users'; } else { $dir = $conf->user->multidir_output[$entity]; // $conf->user->multidir_output[] for each entity is construct by the multicompany module } + if ($dir) + { $origin = $dir .'/'. get_exdir($fuser->id,2,0,0,$fuser,'user'); - $destin = $dir.'/'.$fuser->id; + $destin = $dir .'/'. $fuser->id; $error = 0; @@ -4895,6 +4899,7 @@ function migrate_user_photospath() } } } + } } } From 1647980ac6af61fc6ac80eb02cdc4ac0360f96e4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 6 Dec 2018 21:16:02 +0100 Subject: [PATCH 3/7] FIX status of user --- htdocs/projet/tasks/time.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 4ac6f8a4621..bf293db9387 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -400,7 +400,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) print ''; // Bill time - if (! empty($conf->global->PROJECT_BILL_TIME_SPENT)) + if (empty($conf->global->PROJECT_HIDE_TASKS) && ! empty($conf->global->PROJECT_BILL_TIME_SPENT)) { print ''.$langs->trans("BillTime").''; print yn($projectstatic->bill_time); @@ -661,7 +661,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) $arrayfields['t.note']=array('label'=>$langs->trans("Note"), 'checked'=>1); $arrayfields['t.task_duration']=array('label'=>$langs->trans("Duration"), 'checked'=>1); $arrayfields['value'] =array('label'=>$langs->trans("Value"), 'checked'=>1, 'enabled'=>(empty($conf->salaries->enabled)?0:1)); - $arrayfields['valuebilled'] =array('label'=>$langs->trans("AmountInvoiced"), 'checked'=>1, 'enabled'=>(empty($conf->global->PROJECT_BILL_TIME_SPENT)?0:1)); + $arrayfields['valuebilled'] =array('label'=>$langs->trans("AmountInvoiced"), 'checked'=>1, 'enabled'=>((! empty($conf->global->PROJECT_HIDE_TASKS) || empty($conf->global->PROJECT_BILL_TIME_SPENT))?0:1)); // Extra fields if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) { @@ -678,7 +678,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) $sql = "SELECT t.rowid, t.fk_task, t.task_date, t.task_datehour, t.task_date_withhour, t.task_duration, t.fk_user, t.note, t.thm,"; $sql .= " pt.ref, pt.label,"; - $sql .= " u.lastname, u.firstname, u.login, u.photo,"; + $sql .= " u.lastname, u.firstname, u.login, u.photo, u.statut as user_status,"; $sql .= " il.fk_facture as invoice_id, il.total_ht"; $sql .= " FROM ".MAIN_DB_PREFIX."projet_task_time as t"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."facturedet as il ON il.rowid = t.invoice_line_id"; @@ -1037,6 +1037,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) $userstatic->lastname = $task_time->lastname; $userstatic->firstname = $task_time->firstname; $userstatic->photo = $task_time->photo; + $userstatic->statut = $task_time->user_status; print $userstatic->getNomUrl(-1); } print ''; From 6d8a6bf0add17df2b8238e190947091b1dda6de0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 6 Dec 2018 21:25:04 +0100 Subject: [PATCH 4/7] FIX Show declared progress --- htdocs/projet/tasks/time.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index bf293db9387..48167edcc1d 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -515,7 +515,10 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) // Planned workload print ''.$langs->trans("PlannedWorkload").''; - print convertSecondToTime($object->planned_workload,'allhourmin'); + if ($object->planned_workload) + { + print convertSecondToTime($object->planned_workload,'allhourmin'); + } print ''; print ''; @@ -528,7 +531,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) // Progress declared print ''.$langs->trans("ProgressDeclared").''; - print $object->progress.' %'; + print $object->progress != '' ? $object->progress.' %' : ''; print ''; // Progress calculated @@ -960,7 +963,6 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) $totalarray=array(); foreach ($tasks as $task_time) { - print ''; $date1=$db->jdate($task_time->task_date); From a9a191819f23a589bb9382ec5b90b1d0ff7b1e81 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 6 Dec 2018 21:25:28 +0100 Subject: [PATCH 5/7] Work on billing time spent --- htdocs/langs/en_US/projects.lang | 1 + htdocs/projet/card.php | 8 ++++---- htdocs/projet/contact.php | 2 +- htdocs/projet/element.php | 2 +- htdocs/projet/list.php | 21 ++++++++++++++++++++- htdocs/projet/tasks.php | 2 +- 6 files changed, 28 insertions(+), 8 deletions(-) diff --git a/htdocs/langs/en_US/projects.lang b/htdocs/langs/en_US/projects.lang index 2655ebbdc05..12333c0de9d 100644 --- a/htdocs/langs/en_US/projects.lang +++ b/htdocs/langs/en_US/projects.lang @@ -56,6 +56,7 @@ WorkloadNotDefined=Workload not defined NewTimeSpent=Time spent MyTimeSpent=My time spent BillTime=Bill the time spent +BillTimeShort=Bill time Tasks=Tasks Task=Task TaskDateStart=Task start date diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index 8bf377a9844..6c9db443487 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -618,9 +618,9 @@ if ($action == 'create' && $user->rights->projet->creer) print ''; print ''; print ''; - +var_dump($conf->global->PROJECT_USE_TASKS); // Bill time - if (! empty($conf->global->PROJECT_BILL_TIME_SPENT)) + if (empty($conf->global->PROJECT_HIDE_TASKS) && ! empty($conf->global->PROJECT_BILL_TIME_SPENT)) { print ''.$langs->trans("BillTime").''; print ''; @@ -855,7 +855,7 @@ elseif ($object->id > 0) print ''; // Bill time - if (! empty($conf->global->PROJECT_BILL_TIME_SPENT)) + if (empty($conf->global->PROJECT_HIDE_TASKS) && ! empty($conf->global->PROJECT_BILL_TIME_SPENT)) { print ''.$langs->trans("BillTime").''; print 'bill_time) ? ' checked="checked"' : '').'">'; @@ -985,7 +985,7 @@ elseif ($object->id > 0) print ''; // Bill time - if (! empty($conf->global->PROJECT_BILL_TIME_SPENT)) + if (empty($conf->global->PROJECT_HIDE_TASKS) && ! empty($conf->global->PROJECT_BILL_TIME_SPENT)) { print ''.$langs->trans("BillTime").''; print ''.yn($object->bill_time).''; diff --git a/htdocs/projet/contact.php b/htdocs/projet/contact.php index cd2e722ecd3..3a68eb9b5d4 100644 --- a/htdocs/projet/contact.php +++ b/htdocs/projet/contact.php @@ -241,7 +241,7 @@ if ($id > 0 || ! empty($ref)) print ''; // Bill time - if (! empty($conf->global->PROJECT_BILL_TIME_SPENT)) + if (empty($conf->global->PROJECT_HIDE_TASKS) && ! empty($conf->global->PROJECT_BILL_TIME_SPENT)) { print ''.$langs->trans("BillTime").''; print yn($object->bill_time); diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index 5494c893b2a..59fda8f2123 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -218,7 +218,7 @@ print nl2br($object->description); print ''; // Bill time -if (! empty($conf->global->PROJECT_BILL_TIME_SPENT)) +if (empty($conf->global->PROJECT_HIDE_TASKS) && ! empty($conf->global->PROJECT_BILL_TIME_SPENT)) { print ''.$langs->trans("BillTime").''; print yn($object->bill_time); diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index dac11d34519..b220af0d96a 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -128,6 +128,7 @@ $arrayfields=array( 'p.fk_opp_status'=>array('label'=>$langs->trans("OpportunityStatusShort"), 'checked'=>1, 'enabled'=>($conf->global->PROJECT_USE_OPPORTUNITIES?1:0), 'position'=>104), 'p.opp_percent'=>array('label'=>$langs->trans("OpportunityProbabilityShort"), 'checked'=>1, 'enabled'=>($conf->global->PROJECT_USE_OPPORTUNITIES?1:0), 'position'=>105), 'p.budget_amount'=>array('label'=>$langs->trans("Budget"), 'checked'=>0, 'position'=>110), + 'p.bill_time'=>array('label'=>$langs->trans("BillTimeShort"), 'checked'=>0, 'position'=>115), 'p.datec'=>array('label'=>$langs->trans("DateCreationShort"), 'checked'=>0, 'position'=>500), 'p.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500), 'p.fk_statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000), @@ -279,7 +280,7 @@ if (count($listofprojectcontacttype) == 0) $listofprojectcontacttype[0]='0'; $distinct='DISTINCT'; // We add distinct until we are added a protection to be sure a contact of a project and task is only once. $sql = "SELECT ".$distinct." p.rowid as id, p.ref, p.title, p.fk_statut, p.fk_opp_status, p.public, p.fk_user_creat"; -$sql.= ", p.datec as date_creation, p.dateo as date_start, p.datee as date_end, p.opp_amount, p.opp_percent, p.tms as date_update, p.budget_amount"; +$sql.= ", p.datec as date_creation, p.dateo as date_start, p.datee as date_end, p.opp_amount, p.opp_percent, p.tms as date_update, p.budget_amount, p.bill_time"; $sql.= ", s.nom as name, s.rowid as socid"; $sql.= ", cls.code as opp_status_code"; // We'll need these fields in order to filter by categ @@ -620,6 +621,12 @@ if (! empty($arrayfields['p.budget_amount']['checked'])) print ''; print ''; } +if (! empty($arrayfields['p.bill_time']['checked'])) +{ + print ''; + print ''; + print ''; +} // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; @@ -669,6 +676,7 @@ if (! empty($arrayfields['p.fk_opp_status']['checked'])) print_liste_field_titre if (! empty($arrayfields['p.opp_amount']['checked'])) print_liste_field_titre($arrayfields['p.opp_amount']['label'],$_SERVER["PHP_SELF"],'p.opp_amount',"",$param,'align="right"',$sortfield,$sortorder); if (! empty($arrayfields['p.opp_percent']['checked'])) print_liste_field_titre($arrayfields['p.opp_percent']['label'],$_SERVER["PHP_SELF"],'p.opp_percent',"",$param,'align="right"',$sortfield,$sortorder); if (! empty($arrayfields['p.budget_amount']['checked'])) print_liste_field_titre($arrayfields['p.budget_amount']['label'],$_SERVER["PHP_SELF"],'p.budget_amount',"",$param,'align="right"',$sortfield,$sortorder); +if (! empty($arrayfields['p.bill_time']['checked'])) print_liste_field_titre($arrayfields['p.bill_time']['label'],$_SERVER["PHP_SELF"],'p.bill_time',"",$param,'align="right"',$sortfield,$sortorder); // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; // Hook fields @@ -847,6 +855,17 @@ while ($i < min($num,$limit)) if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['totalbudgetfield']=$totalarray['nbfield']; } + // Bill time + if (! empty($arrayfields['p.bill_time']['checked'])) + { + print ''; + if ($obj->bill_time) + { + print yn($obj->bill_time); + } + print ''; + if (! $i) $totalarray['nbfield']++; + } // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; // Fields from hook diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index 2f06f698b14..04605c33065 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -417,7 +417,7 @@ if ($id > 0 || ! empty($ref)) print ''; // Bill time - if (! empty($conf->global->PROJECT_BILL_TIME_SPENT)) + if (empty($conf->global->PROJECT_HIDE_TASKS) && ! empty($conf->global->PROJECT_BILL_TIME_SPENT)) { print ''.$langs->trans("BillTime").''; print yn($object->bill_time); From e7c87c31b6436afa872771b706c58624a2f49f34 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 6 Dec 2018 21:32:39 +0100 Subject: [PATCH 6/7] Code comment --- htdocs/install/mysql/migration/8.0.0-9.0.0.sql | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/install/mysql/migration/8.0.0-9.0.0.sql b/htdocs/install/mysql/migration/8.0.0-9.0.0.sql index 20b0a874879..040739e8ce7 100644 --- a/htdocs/install/mysql/migration/8.0.0-9.0.0.sql +++ b/htdocs/install/mysql/migration/8.0.0-9.0.0.sql @@ -150,6 +150,9 @@ UPDATE llx_c_payment_term SET decalage = nbjour, nbjour = 0 where decalage IS NU UPDATE llx_holiday SET ref = rowid WHERE ref IS NULL; +-- DROP TABLE llx_emailcollector_emailcollectorfilter; +-- DROP TABLE llx_emailcollector_emailcollectoraction; +-- DROP TABLE llx_emailcollector_emailcollector; CREATE TABLE llx_emailcollector_emailcollector( -- BEGIN MODULEBUILDER FIELDS From cf00519e90f94e1647541b071b6a8096d038ce4e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 6 Dec 2018 21:40:51 +0100 Subject: [PATCH 7/7] Test imap available --- htdocs/admin/emailcollector_card.php | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/htdocs/admin/emailcollector_card.php b/htdocs/admin/emailcollector_card.php index ff037f67aa1..2fb5013b4f9 100644 --- a/htdocs/admin/emailcollector_card.php +++ b/htdocs/admin/emailcollector_card.php @@ -380,11 +380,24 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $sourcedir = $object->source_directory; $targetdir = ($object->target_directory ? $object->target_directory : ''); // Can be '[Gmail]/Trash' or 'mytag' - $connectstringserver = $object->getConnectStringIMAP(); - $connectstringsource = $connectstringserver.imap_utf7_encode($sourcedir); - $connectstringtarget = $connectstringserver.imap_utf7_encode($targetdir); + $connection = null; + $connectstringserver = ''; + $connectstringsource = ''; + $connectstringtarget = ''; + + if (function_exists('imap_open')) + { + $connectstringserver = $object->getConnectStringIMAP(); + $connectstringsource = $connectstringserver.imap_utf7_encode($sourcedir); + $connectstringtarget = $connectstringserver.imap_utf7_encode($targetdir); - $connection = imap_open($connectstringsource, $object->user, $object->password); + $connection = imap_open($connectstringsource, $object->user, $object->password); + } + else + { + $morehtml .= 'IMAP functions not available on your PHP'; + } + if (! $connection) { $morehtml .= 'Failed to open IMAP connection '.$connectstringsource; @@ -395,8 +408,11 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $morehtml .= imap_num_msg($connection); } - imap_close($connection); - + if ($connection) + { + imap_close($connection); + } + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref.'
'.$morehtml.'
', '', 0, '', '', 0, ''); print '
';