Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dolibarr
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Software_Artifact_Infrastructure_Repository
dolibarr
Commits
9d6663cf
Commit
9d6663cf
authored
15 years ago
by
Laurent Destailleur
Browse files
Options
Downloads
Patches
Plain Diff
Fix: Error in function ConvertSecondTotime
parent
ceb8d9a4
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
htdocs/fichinter/fiche.php
+8
-4
8 additions, 4 deletions
htdocs/fichinter/fiche.php
htdocs/lib/date.lib.php
+14
-10
14 additions, 10 deletions
htdocs/lib/date.lib.php
with
22 additions
and
14 deletions
htdocs/fichinter/fiche.php
+
8
−
4
View file @
9d6663cf
...
@@ -445,7 +445,7 @@ if ($_GET["action"] == 'create')
...
@@ -445,7 +445,7 @@ if ($_GET["action"] == 'create')
print
'<input type="hidden" name="action" value="add">'
;
print
'<input type="hidden" name="action" value="add">'
;
print
'<tr><td>'
.
$langs
->
trans
(
"Ref"
)
.
'</td>'
;
print
'<tr><td>'
.
$langs
->
trans
(
"Ref"
)
.
'</td>'
;
print
'<td><input name="ref" value="$numpr"></td></tr>'
.
"
\n
"
;
print
'<td><input name="ref" value="
'
.
$numpr
.
'
"></td></tr>'
.
"
\n
"
;
if
(
$conf
->
projet
->
enabled
)
if
(
$conf
->
projet
->
enabled
)
{
{
...
@@ -488,7 +488,7 @@ if ($_GET["action"] == 'create')
...
@@ -488,7 +488,7 @@ if ($_GET["action"] == 'create')
print
'<form name="fichinter" action="'
.
$_SERVER
[
'PHP_SELF'
]
.
'" method="GET">'
;
print
'<form name="fichinter" action="'
.
$_SERVER
[
'PHP_SELF'
]
.
'" method="GET">'
;
print
'<table class="border" width="100%">'
;
print
'<table class="border" width="100%">'
;
print
'<tr><td>'
.
$langs
->
trans
(
"Company"
)
.
'</td><td>'
;
print
'<tr><td>'
.
$langs
->
trans
(
"Company"
)
.
'</td><td>'
;
$html
->
select_societes
(
''
,
'socid'
,
'
s.client = 1
'
,
1
);
$html
->
select_societes
(
''
,
'socid'
,
''
,
1
);
print
'</td></tr>'
;
print
'</td></tr>'
;
print
'<tr><td colspan="2" align="center">'
;
print
'<tr><td colspan="2" align="center">'
;
print
'<input type="hidden" name="action" value="create">'
;
print
'<input type="hidden" name="action" value="create">'
;
...
@@ -550,7 +550,7 @@ elseif ($fichinterid)
...
@@ -550,7 +550,7 @@ elseif ($fichinterid)
print
$html
->
showrefnav
(
$fichinter
,
'ref'
,
''
,
1
,
'ref'
,
'ref'
);
print
$html
->
showrefnav
(
$fichinter
,
'ref'
,
''
,
1
,
'ref'
,
'ref'
);
print
'</td></tr>'
;
print
'</td></tr>'
;
//
Societe
//
Third party
print
"<tr><td>"
.
$langs
->
trans
(
"Company"
)
.
"</td><td>"
.
$fichinter
->
client
->
getNomUrl
(
1
)
.
"</td></tr>"
;
print
"<tr><td>"
.
$langs
->
trans
(
"Company"
)
.
"</td><td>"
.
$fichinter
->
client
->
getNomUrl
(
1
)
.
"</td></tr>"
;
// Project
// Project
...
@@ -584,7 +584,11 @@ elseif ($fichinterid)
...
@@ -584,7 +584,11 @@ elseif ($fichinterid)
}
}
// Duration
// Duration
print
'<tr><td>'
.
$langs
->
trans
(
"TotalDuration"
)
.
'</td><td>'
.
ConvertSecondToTime
(
$fichinter
->
duree
,
'all'
,
$conf
->
global
->
MAIN_DURATION_OF_WORKDAY
)
.
'</td></tr>'
;
print
'<tr><td>'
.
$langs
->
trans
(
"TotalDuration"
)
.
'</td>'
;
//print $fichinter->duree.'-'.$conf->global->MAIN_DURATION_OF_WORKDAY;
print
'<td>'
.
ConvertSecondToTime
(
$fichinter
->
duree
,
'all'
,
$conf
->
global
->
MAIN_DURATION_OF_WORKDAY
)
.
'</td>'
;
//print '<td>'.ConvertSecondToTime(90000,'all',$conf->global->MAIN_DURATION_OF_WORKDAY).'</td>';
print
'</tr>'
;
// Description (must be a textarea and not html must be allowed (used in list view)
// Description (must be a textarea and not html must be allowed (used in list view)
print
'<tr><td>'
;
print
'<tr><td>'
;
...
...
This diff is collapsed.
Click to expand it.
htdocs/lib/date.lib.php
+
14
−
10
View file @
9d6663cf
...
@@ -43,6 +43,8 @@ function ConvertTime2Seconds($iHours=0,$iMinutes=0,$iSeconds=0)
...
@@ -43,6 +43,8 @@ function ConvertTime2Seconds($iHours=0,$iMinutes=0,$iSeconds=0)
* \param format Output format (all: complete display, hour: displays only hours, min: displays only minutes)
* \param format Output format (all: complete display, hour: displays only hours, min: displays only minutes)
* \param lengthOfDay Length of day (default 86400 seconds)
* \param lengthOfDay Length of day (default 86400 seconds)
* \return sTime Formated text of duration
* \return sTime Formated text of duration
* \example 3600 return 1h00, 86400 return 1d, 90000 return 1day 1hour
*
*/
*/
function
ConvertSecondToTime
(
$iSecond
,
$format
=
'all'
,
$lengthOfDay
=
86400
)
function
ConvertSecondToTime
(
$iSecond
,
$format
=
'all'
,
$lengthOfDay
=
86400
)
{
{
...
@@ -55,25 +57,27 @@ function ConvertSecondToTime($iSecond,$format='all',$lengthOfDay=86400)
...
@@ -55,25 +57,27 @@ function ConvertSecondToTime($iSecond,$format='all',$lengthOfDay=86400)
if
(
$iSecond
>=
$lengthOfDay
)
if
(
$iSecond
>=
$lengthOfDay
)
{
{
$sDay
=
0
;
$sDay
=
0
;
for
(
$i
=
$iSecond
;
$i
>
$lengthOfDay
;
$i
-=
$lengthOfDay
)
for
(
$i
=
$iSecond
;
$i
>
=
$lengthOfDay
;
$i
-=
$lengthOfDay
)
{
{
$sDay
++
;
$sDay
++
;
$iSecond
-=
$lengthOfDay
;
}
}
$dayTranslate
=
$langs
->
trans
(
"Day"
);
$dayTranslate
=
$langs
->
trans
(
"Day"
);
if
(
$iSecond
>=
(
$lengthOfDay
*
2
))
$dayTranslate
=
$langs
->
trans
(
"Days"
);
if
(
$iSecond
>=
(
$lengthOfDay
*
2
))
$dayTranslate
=
$langs
->
trans
(
"Days"
);
}
}
$sTime
=
''
;
$sTime
=
''
;
if
(
$sDay
)
$sTime
.
=
$sDay
.
' '
.
$dayTranslate
.
' '
;
if
(
$sDay
)
$sTime
.
=
$sDay
.
' '
.
$dayTranslate
.
' '
;
$sHour
=
date
(
"H"
,
$iSecond
)
-
1
;
$sHour
=
date
(
"H"
,
$iSecond
);
$sMin
=
date
(
"i"
,
$iSecond
);
$sMin
=
date
(
"i"
,
$iSecond
);
if
(
!
empty
(
$sHour
)
&&
!
empty
(
$sMin
))
//print 'x'.$sHour.'-'.$sMin;
if
(
intval
(
$sHour
)
||
intval
(
$sMin
))
{
{
$sTime
.
=
$sHour
.
'h'
.
$sMin
;
$sTime
.
=
$sHour
.
$langs
->
trans
(
'h'
)
.
$sMin
;
}
}
}
}
else
if
(
$format
==
'hour'
)
else
if
(
$format
==
'hour'
)
{
{
$sTime
=
date
(
"H"
,
$iSecond
)
-
1
;
$sTime
=
date
(
"H"
,
$iSecond
);
}
}
else
if
(
$format
==
'min'
)
else
if
(
$format
==
'min'
)
{
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment