2
0
forked from Wavyzz/dolibarr

Look and feel v10

This commit is contained in:
Laurent Destailleur
2019-03-22 14:32:15 +01:00
parent d79d5d5a23
commit cd6a0bacdd
8 changed files with 68 additions and 54 deletions

View File

@@ -207,7 +207,7 @@ function dol_print_object_info($object, $usetable = 0)
$deltadateforuser=round($deltadateforclient-$deltadateforserver); $deltadateforuser=round($deltadateforclient-$deltadateforserver);
//print "x".$deltadateforserver." - ".$deltadateforclient." - ".$deltadateforuser; //print "x".$deltadateforserver." - ".$deltadateforclient." - ".$deltadateforuser;
if ($usetable) print '<table class="border centpercent">'; if ($usetable) print '<table class="border tableforfield centpercent">';
// Import key // Import key
if (! empty($object->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) function colorValidateHex($color, $allow_white = true)
{ {
if(!$allow_white && ($color === '#fff' || $color === '#ffffff') ) return false; if(!$allow_white && ($color === '#fff' || $color === '#ffffff') ) return false;
if(preg_match('/^#[a-f0-9]{6}$/i', $color)) //hex color is valid if(preg_match('/^#[a-f0-9]{6}$/i', $color)) //hex color is valid
{ {
return true; return true;
@@ -2227,23 +2227,23 @@ function colorAdjustBrightness($hex, $steps)
{ {
// Steps should be between -255 and 255. Negative = darker, positive = lighter // Steps should be between -255 and 255. Negative = darker, positive = lighter
$steps = max(-255, min(255, $steps)); $steps = max(-255, min(255, $steps));
// Normalize into a six character long hex string // Normalize into a six character long hex string
$hex = str_replace('#', '', $hex); $hex = str_replace('#', '', $hex);
if (strlen($hex) == 3) { 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); $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 // Split into three parts: R, G and B
$color_parts = str_split($hex, 2); $color_parts = str_split($hex, 2);
$return = '#'; $return = '#';
foreach ($color_parts as $color) { foreach ($color_parts as $color) {
$color = hexdec($color); // Convert to decimal $color = hexdec($color); // Convert to decimal
$color = max(0, min(255, $color + $steps)); // Adjust color $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 .= str_pad(dechex($color), 2, '0', STR_PAD_LEFT); // Make two char hex code
} }
return $return; return $return;
} }
@@ -2292,7 +2292,7 @@ function colorHexToRgb($hex, $alpha = false, $returnArray = false)
else{ else{
$string = 'rgb('.implode(',', $rgb).')'; $string = 'rgb('.implode(',', $rgb).')';
} }
if($returnArray){ if($returnArray){
return $rgb; return $rgb;
} }

View File

@@ -241,4 +241,4 @@ GenerateInvoice=Generate invoice
OneLinePerUser=One line per user OneLinePerUser=One line per user
ServiceToUseOnLines=Service to use on lines ServiceToUseOnLines=Service to use on lines
InvoiceGeneratedFromTimeSpent=Invoice %s has been generated from time spent on project 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. 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).

View File

@@ -180,7 +180,7 @@ if ($id > 0 || ! empty($ref))
print '<div class="fichehalfleft">'; print '<div class="fichehalfleft">';
print '<div class="underbanner clearboth"></div>'; print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">'; print '<table class="border tableforfield" width="100%">';
// Visibility // Visibility
print '<tr><td class="titlefield">'.$langs->trans("Visibility").'</td><td>'; print '<tr><td class="titlefield">'.$langs->trans("Visibility").'</td><td>';
@@ -233,7 +233,7 @@ if ($id > 0 || ! empty($ref))
print '<div class="ficheaddleft">'; print '<div class="ficheaddleft">';
print '<div class="underbanner clearboth"></div>'; print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">'; print '<table class="border tableforfield" width="100%">';
// Description // Description
print '<td class="titlefield tdtop">'.$langs->trans("Description").'</td><td>'; print '<td class="titlefield tdtop">'.$langs->trans("Description").'</td><td>';

View File

@@ -157,7 +157,7 @@ print '<div class="fichecenter">';
print '<div class="fichehalfleft">'; print '<div class="fichehalfleft">';
print '<div class="underbanner clearboth"></div>'; print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">'; print '<table class="border tableforfield" width="100%">';
// Visibility // Visibility
print '<tr><td class="titlefield">'.$langs->trans("Visibility").'</td><td>'; print '<tr><td class="titlefield">'.$langs->trans("Visibility").'</td><td>';
@@ -210,7 +210,7 @@ print '<div class="fichehalfright">';
print '<div class="ficheaddleft">'; print '<div class="ficheaddleft">';
print '<div class="underbanner clearboth"></div>'; print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">'; print '<table class="border tableforfield" width="100%">';
// Description // Description
print '<td class="titlefield tdtop">'.$langs->trans("Description").'</td><td>'; print '<td class="titlefield tdtop">'.$langs->trans("Description").'</td><td>';

View File

@@ -356,7 +356,7 @@ if ($id > 0 || ! empty($ref))
print '<div class="fichehalfleft">'; print '<div class="fichehalfleft">';
print '<div class="underbanner clearboth"></div>'; print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">'; print '<table class="border tableforfield" width="100%">';
// Visibility // Visibility
print '<tr><td class="titlefield">'.$langs->trans("Visibility").'</td><td>'; print '<tr><td class="titlefield">'.$langs->trans("Visibility").'</td><td>';
@@ -409,7 +409,7 @@ if ($id > 0 || ! empty($ref))
print '<div class="ficheaddleft">'; print '<div class="ficheaddleft">';
print '<div class="underbanner clearboth"></div>'; print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">'; print '<table class="border tableforfield" width="100%">';
// Description // Description
print '<td class="titlefield tdtop">'.$langs->trans("Description").'</td><td>'; print '<td class="titlefield tdtop">'.$langs->trans("Description").'</td><td>';

View File

@@ -220,7 +220,7 @@ if ($id > 0 || ! empty($ref))
print '<div class="fichehalfleft">'; print '<div class="fichehalfleft">';
print '<div class="underbanner clearboth"></div>'; print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">'; print '<table class="border tableforfield" width="100%">';
// Visibility // Visibility
print '<tr><td class="titlefield">'.$langs->trans("Visibility").'</td><td>'; print '<tr><td class="titlefield">'.$langs->trans("Visibility").'</td><td>';
@@ -254,7 +254,7 @@ if ($id > 0 || ! empty($ref))
print '<div class="ficheaddleft">'; print '<div class="ficheaddleft">';
print '<div class="underbanner clearboth"></div>'; print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">'; print '<table class="border tableforfield" width="100%">';
// Description // Description
print '<td class="titlefield tdtop">'.$langs->trans("Description").'</td><td>'; print '<td class="titlefield tdtop">'.$langs->trans("Description").'</td><td>';

View File

@@ -149,47 +149,61 @@ if ($action == 'addtimespent' && $user->rights->projet->lire)
if (! $error) if (! $error)
{ {
if ($id || $ref) if ($id || $ref)
{ {
$object->fetch($id, $ref); $object->fetch($id, $ref);
} }
else 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'); $object->fetch_projet();
$error++;
} if (empty($object->project->statut))
else {
{ setEventMessages($langs->trans("ProjectMustBeValidatedFirst"), null, 'errors');
$object->timespent_note = $_POST["timespent_note"]; $action='createtime';
if (GETPOST('progress', 'int') > 0) $object->progress = GETPOST('progress', 'int'); // If progress is -1 (not defined), we do not change value $error++;
$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 else
if (GETPOST("timehour") != '' && GETPOST("timehour") >= 0) // If hour was entered {
{ $object->timespent_note = $_POST["timespent_note"];
$object->timespent_date = dol_mktime(GETPOST("timehour"), GETPOST("timemin"), 0, GETPOST("timemonth"), GETPOST("timeday"), GETPOST("timeyear")); if (GETPOST('progress', 'int') > 0) $object->progress = GETPOST('progress', 'int'); // If progress is -1 (not defined), we do not change value
$object->timespent_withhour = 1; $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
else if (GETPOST("timehour") != '' && GETPOST("timehour") >= 0) // If hour was entered
{ {
$object->timespent_date = dol_mktime(12, 0, 0, GETPOST("timemonth"), GETPOST("timeday"), GETPOST("timeyear")); $object->timespent_date = dol_mktime(GETPOST("timehour"), GETPOST("timemin"), 0, GETPOST("timemonth"), GETPOST("timeday"), GETPOST("timeyear"));
} $object->timespent_withhour = 1;
$object->timespent_fk_user = $_POST["userid"]; }
$result=$object->addTimeSpent($user); else
if ($result >= 0) {
{ $object->timespent_date = dol_mktime(12, 0, 0, GETPOST("timemonth"), GETPOST("timeday"), GETPOST("timeyear"));
setEventMessages($langs->trans("RecordSaved"), null, 'mesgs'); }
} $object->timespent_fk_user = $_POST["userid"];
else $result=$object->addTimeSpent($user);
{ if ($result >= 0)
setEventMessages($langs->trans($object->error), null, 'errors'); {
$error++; setEventMessages($langs->trans("RecordSaved"), null, 'mesgs');
} }
else
{
setEventMessages($langs->trans($object->error), null, 'errors');
$error++;
}
}
} }
} }
else else
@@ -488,7 +502,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
print '<div class="fichehalfleft">'; print '<div class="fichehalfleft">';
print '<div class="underbanner clearboth"></div>'; print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">'; print '<table class="border tableforfield" width="100%">';
// Visibility // Visibility
print '<tr><td class="titlefield">'.$langs->trans("Visibility").'</td><td>'; print '<tr><td class="titlefield">'.$langs->trans("Visibility").'</td><td>';
@@ -522,7 +536,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
print '<div class="ficheaddleft">'; print '<div class="ficheaddleft">';
print '<div class="underbanner clearboth"></div>'; print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">'; print '<table class="border tableforfield" width="100%">';
// Description // Description
print '<td class="titlefield tdtop">'.$langs->trans("Description").'</td><td>'; print '<td class="titlefield tdtop">'.$langs->trans("Description").'</td><td>';
@@ -1109,7 +1123,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
$selectedfields.=(count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : ''); $selectedfields.=(count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
print '<div class="div-table-responsive">'; print '<div class="div-table-responsive">';
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n"; print '<table class="tagtable nobottomiftotal liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
// Fields title search // Fields title search
print '<tr class="liste_titre_filter">'; print '<tr class="liste_titre_filter">';

View File

@@ -399,7 +399,7 @@ if ($projectid > 0) {
print '<div class="fichecenter">'; print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>'; print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">'; print '<table class="border tableforfield" width="100%">';
// Visibility // Visibility
print '<tr><td class="titlefield">' . $langs->trans("Visibility") . '</td><td>'; print '<tr><td class="titlefield">' . $langs->trans("Visibility") . '</td><td>';