From cd6a0bacddf496c8bd62f849f5484278be8963cc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 22 Mar 2019 14:32:15 +0100 Subject: [PATCH] Look and feel v10 --- htdocs/core/lib/functions2.lib.php | 16 +++--- htdocs/langs/en_US/projects.lang | 2 +- htdocs/projet/contact.php | 4 +- htdocs/projet/element.php | 4 +- htdocs/projet/tasks.php | 4 +- htdocs/projet/tasks/contact.php | 4 +- htdocs/projet/tasks/time.php | 86 +++++++++++++++++------------- htdocs/ticket/list.php | 2 +- 8 files changed, 68 insertions(+), 54 deletions(-) diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index 2c756d36a2f..118fab5ebe6 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -207,7 +207,7 @@ function dol_print_object_info($object, $usetable = 0) $deltadateforuser=round($deltadateforclient-$deltadateforserver); //print "x".$deltadateforserver." - ".$deltadateforclient." - ".$deltadateforuser; - if ($usetable) print ''; + if ($usetable) print '
'; // Import key if (! empty($object->import_key)) @@ -2207,9 +2207,9 @@ function colorStringToArray($stringcolor, $colorifnotfound = array(88,88,88)) */ function colorValidateHex($color, $allow_white = true) { - + if(!$allow_white && ($color === '#fff' || $color === '#ffffff') ) return false; - + if(preg_match('/^#[a-f0-9]{6}$/i', $color)) //hex color is valid { return true; @@ -2227,23 +2227,23 @@ function colorAdjustBrightness($hex, $steps) { // Steps should be between -255 and 255. Negative = darker, positive = lighter $steps = max(-255, min(255, $steps)); - + // Normalize into a six character long hex string $hex = str_replace('#', '', $hex); if (strlen($hex) == 3) { $hex = str_repeat(substr($hex, 0, 1), 2).str_repeat(substr($hex, 1, 1), 2).str_repeat(substr($hex, 2, 1), 2); } - + // Split into three parts: R, G and B $color_parts = str_split($hex, 2); $return = '#'; - + foreach ($color_parts as $color) { $color = hexdec($color); // Convert to decimal $color = max(0, min(255, $color + $steps)); // Adjust color $return .= str_pad(dechex($color), 2, '0', STR_PAD_LEFT); // Make two char hex code } - + return $return; } @@ -2292,7 +2292,7 @@ function colorHexToRgb($hex, $alpha = false, $returnArray = false) else{ $string = 'rgb('.implode(',', $rgb).')'; } - + if($returnArray){ return $rgb; } diff --git a/htdocs/langs/en_US/projects.lang b/htdocs/langs/en_US/projects.lang index 4f395925cdd..a8dd8d61e07 100644 --- a/htdocs/langs/en_US/projects.lang +++ b/htdocs/langs/en_US/projects.lang @@ -241,4 +241,4 @@ GenerateInvoice=Generate invoice OneLinePerUser=One line per user ServiceToUseOnLines=Service to use on lines InvoiceGeneratedFromTimeSpent=Invoice %s has been generated from time spent on project -ProjectBillTimeDescription=Check if you enter timesheet on tasks of project and plan to generate invoice(s) from the timesheet to invoice the customer of project. \ No newline at end of file +ProjectBillTimeDescription=Check if you enter timesheet on tasks of project AND you plan to generate invoice(s) from the timesheet to bill the customer of the project (do not check if you plan to create invoice that is not based on entered timesheets). \ No newline at end of file diff --git a/htdocs/projet/contact.php b/htdocs/projet/contact.php index 95d5e3dd229..8bed0a87adc 100644 --- a/htdocs/projet/contact.php +++ b/htdocs/projet/contact.php @@ -180,7 +180,7 @@ if ($id > 0 || ! empty($ref)) print '
'; print '
'; - print '
'; + print '
'; // Visibility print '
'.$langs->trans("Visibility").''; @@ -233,7 +233,7 @@ if ($id > 0 || ! empty($ref)) print '
'; print '
'; - print ''; + print '
'; // Description print '
'.$langs->trans("Description").''; diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index dc737e8968c..62680a973bd 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -157,7 +157,7 @@ print '
'; print '
'; print '
'; -print ''; +print '
'; // Visibility print '
'.$langs->trans("Visibility").''; @@ -210,7 +210,7 @@ print '
'; print '
'; print '
'; -print ''; +print '
'; // Description print '
'.$langs->trans("Description").''; diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index 068a26b5fe2..166d224d1be 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -356,7 +356,7 @@ if ($id > 0 || ! empty($ref)) print '
'; print '
'; - print ''; + print '
'; // Visibility print '
'.$langs->trans("Visibility").''; @@ -409,7 +409,7 @@ if ($id > 0 || ! empty($ref)) print '
'; print '
'; - print ''; + print '
'; // Description print '
'.$langs->trans("Description").''; diff --git a/htdocs/projet/tasks/contact.php b/htdocs/projet/tasks/contact.php index af8dc9d39cf..3fe8abfa73b 100644 --- a/htdocs/projet/tasks/contact.php +++ b/htdocs/projet/tasks/contact.php @@ -220,7 +220,7 @@ if ($id > 0 || ! empty($ref)) print '
'; print '
'; - print ''; + print '
'; // Visibility print '
'.$langs->trans("Visibility").''; @@ -254,7 +254,7 @@ if ($id > 0 || ! empty($ref)) print '
'; print '
'; - print ''; + print '
'; // Description print '
'.$langs->trans("Description").''; diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 37934aa0957..639960b172d 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -149,47 +149,61 @@ if ($action == 'addtimespent' && $user->rights->projet->lire) if (! $error) { - if ($id || $ref) + if ($id || $ref) { $object->fetch($id, $ref); } else { - $object->fetch(GETPOST('taskid', 'int')); + if (! GETPOST('taskid', 'int') || GETPOST('taskid', 'int') < 0) + { + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Task")), null, 'errors'); + $action='createtime'; + $error++; + } + else + { + $object->fetch(GETPOST('taskid', 'int')); + } } - $object->fetch_projet(); - if (empty($object->project->statut)) + if (! $error) { - setEventMessages($langs->trans("ProjectMustBeValidatedFirst"), null, 'errors'); - $error++; - } - else - { - $object->timespent_note = $_POST["timespent_note"]; - if (GETPOST('progress', 'int') > 0) $object->progress = GETPOST('progress', 'int'); // If progress is -1 (not defined), we do not change value - $object->timespent_duration = $_POST["timespent_durationhour"]*60*60; // We store duration in seconds - $object->timespent_duration+= ($_POST["timespent_durationmin"]?$_POST["timespent_durationmin"]:0)*60; // We store duration in seconds - if (GETPOST("timehour") != '' && GETPOST("timehour") >= 0) // If hour was entered - { - $object->timespent_date = dol_mktime(GETPOST("timehour"), GETPOST("timemin"), 0, GETPOST("timemonth"), GETPOST("timeday"), GETPOST("timeyear")); - $object->timespent_withhour = 1; - } - else - { - $object->timespent_date = dol_mktime(12, 0, 0, GETPOST("timemonth"), GETPOST("timeday"), GETPOST("timeyear")); - } - $object->timespent_fk_user = $_POST["userid"]; - $result=$object->addTimeSpent($user); - if ($result >= 0) - { - setEventMessages($langs->trans("RecordSaved"), null, 'mesgs'); - } - else - { - setEventMessages($langs->trans($object->error), null, 'errors'); - $error++; - } + $object->fetch_projet(); + + if (empty($object->project->statut)) + { + setEventMessages($langs->trans("ProjectMustBeValidatedFirst"), null, 'errors'); + $action='createtime'; + $error++; + } + else + { + $object->timespent_note = $_POST["timespent_note"]; + if (GETPOST('progress', 'int') > 0) $object->progress = GETPOST('progress', 'int'); // If progress is -1 (not defined), we do not change value + $object->timespent_duration = $_POST["timespent_durationhour"]*60*60; // We store duration in seconds + $object->timespent_duration+= ($_POST["timespent_durationmin"]?$_POST["timespent_durationmin"]:0)*60; // We store duration in seconds + if (GETPOST("timehour") != '' && GETPOST("timehour") >= 0) // If hour was entered + { + $object->timespent_date = dol_mktime(GETPOST("timehour"), GETPOST("timemin"), 0, GETPOST("timemonth"), GETPOST("timeday"), GETPOST("timeyear")); + $object->timespent_withhour = 1; + } + else + { + $object->timespent_date = dol_mktime(12, 0, 0, GETPOST("timemonth"), GETPOST("timeday"), GETPOST("timeyear")); + } + $object->timespent_fk_user = $_POST["userid"]; + $result=$object->addTimeSpent($user); + if ($result >= 0) + { + setEventMessages($langs->trans("RecordSaved"), null, 'mesgs'); + } + else + { + setEventMessages($langs->trans($object->error), null, 'errors'); + $error++; + } + } } } else @@ -488,7 +502,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) print '
'; print '
'; - print ''; + print '
'; // Visibility print '
'.$langs->trans("Visibility").''; @@ -522,7 +536,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) print '
'; print '
'; - print ''; + print '
'; // Description print '
'.$langs->trans("Description").''; @@ -1109,7 +1123,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) $selectedfields.=(count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : ''); print '
'; - print ''."\n"; + print '
'."\n"; // Fields title search print ''; diff --git a/htdocs/ticket/list.php b/htdocs/ticket/list.php index 02e441adba0..e13f29b4b05 100644 --- a/htdocs/ticket/list.php +++ b/htdocs/ticket/list.php @@ -399,7 +399,7 @@ if ($projectid > 0) { print '
'; print '
'; - print '
'; + print '
'; // Visibility print '
' . $langs->trans("Visibility") . '';