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
6aeb18ed
Commit
6aeb18ed
authored
9 years ago
by
Regis Houssin
Browse files
Options
Downloads
Patches
Plain Diff
Revert "Fix: for avoid division by 0"
This reverts commit
c71d5789
.
parent
905f9d78
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
htdocs/core/tpl/objectline_create.tpl.php
+9
-10
9 additions, 10 deletions
htdocs/core/tpl/objectline_create.tpl.php
htdocs/core/tpl/objectline_edit.tpl.php
+7
-10
7 additions, 10 deletions
htdocs/core/tpl/objectline_edit.tpl.php
with
16 additions
and
20 deletions
htdocs/core/tpl/objectline_create.tpl.php
+
9
−
10
View file @
6aeb18ed
<?php
/* Copyright (C) 2010-201
5
Regis Houssin <regis.houssin@capnetworks.com>
/* Copyright (C) 2010-201
2
Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2010-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012-2013 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
...
...
@@ -352,36 +352,35 @@ if (! empty($usemargins) && $user->rights->margins->creer)
if
(
!
$
.
isNumeric
(
rate
.
val
().
replace
(
'
,
'
,
'
.
'
)))
{
alert
(
'
<?php
echo
dol_escape_js
(
$langs
->
trans
noentities
(
"rateMustBeNumeric"
));
?>
'
);
alert
(
'
<?php
echo
dol_escape_js
(
$langs
->
trans
(
"rateMustBeNumeric"
));
?>
'
);
e
.
stopPropagation
();
setTimeout
(
function
()
{
rate
.
focus
()
},
50
);
return
false
;
}
if
(
npRate
==
"
np_markRate
"
&&
rate
.
val
()
>=
100
)
{
alert
(
'
<?php
echo
dol_escape_js
(
$langs
->
trans
noentities
(
"markRateShouldBeLesserThan100"
));
?>
'
);
alert
(
'
<?php
echo
dol_escape_js
(
$langs
->
trans
(
"markRateShouldBeLesserThan100"
));
?>
'
);
e
.
stopPropagation
();
setTimeout
(
function
()
{
rate
.
focus
()
},
50
);
return
false
;
}
var
price
=
0
;
remisejs
=
price2numjs
(
remise
.
val
());
if
(
remisejs
==
''
)
remisejs
=
0
;
bpjs
=
price2numjs
(
buying_price
.
val
());
if
(
bpjs
>
0
&&
remisejs
!=
100
)
// If buying_price and a discount not 100 or no discount
if
(
remisejs
!=
100
)
// If a discount not 100 or no discount
{
var
price
=
0
;
if
(
remisejs
==
''
)
remisejs
=
0
;
bpjs
=
price2numjs
(
buying_price
.
val
());
ratejs
=
price2numjs
(
rate
.
val
());
if
(
npRate
==
"
np_marginRate
"
)
price
=
((
bpjs
*
(
1
+
ratejs
/
100
))
/
(
1
-
remisejs
/
100
));
else
if
(
npRate
==
"
np_markRate
"
)
price
=
((
bpjs
/
(
1
-
ratejs
/
100
))
/
(
1
-
remisejs
/
100
));
$
(
"
input[name='price_ht']:first
"
).
val
(
price
);
// TODO Must use a function like php price to have here a formated value
}
$
(
"
input[name='price_ht']:first
"
).
val
(
price
);
// TODO Must use a function like php price to have here a formated value
return
true
;
}
...
...
This diff is collapsed.
Click to expand it.
htdocs/core/tpl/objectline_edit.tpl.php
+
7
−
10
View file @
6aeb18ed
<?php
/* Copyright (C) 2010-201
5
Regis Houssin <regis.houssin@capnetworks.com>
/* Copyright (C) 2010-201
2
Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2010-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
...
...
@@ -282,27 +282,25 @@ if (! empty($conf->margin->enabled))
if
(
!
$
.
isNumeric
(
rate
.
val
().
replace
(
'
,
'
,
'
.
'
)))
{
alert
(
'
<?php
echo
$langs
->
trans
noentities
(
"rateMustBeNumeric"
);
?>
'
);
alert
(
'
<?php
echo
$langs
->
trans
(
"rateMustBeNumeric"
);
?>
'
);
e
.
stopPropagation
();
setTimeout
(
function
()
{
rate
.
focus
()
},
50
);
return
false
;
}
if
(
npRate
==
"
np_markRate
"
&&
rate
.
val
()
>=
100
)
{
alert
(
'
<?php
echo
$langs
->
trans
noentities
(
"markRateShouldBeLesserThan100"
);
?>
'
);
alert
(
'
<?php
echo
$langs
->
trans
(
"markRateShouldBeLesserThan100"
);
?>
'
);
e
.
stopPropagation
();
setTimeout
(
function
()
{
rate
.
focus
()
},
50
);
return
false
;
}
var
price
=
0
;
remisejs
=
price2numjs
(
remise
.
val
());
if
(
remisejs
==
''
)
remisejs
=
0
;
bpjs
=
price2numjs
(
buying_price
.
val
());
if
(
bpjs
>
0
&&
remisejs
!=
100
)
// If buying_price and a discount not 100 or no discount
if
(
remisejs
!=
100
)
{
var
price
=
0
;
bpjs
=
price2numjs
(
buying_price
.
val
())
;
ratejs
=
price2numjs
(
rate
.
val
());
/* console.log(npRate+" - "+bpjs+" - "+ratejs); */
...
...
@@ -311,9 +309,8 @@ if (! empty($conf->margin->enabled))
price
=
((
bpjs
*
(
1
+
ratejs
/
100
))
/
(
1
-
remisejs
/
100
));
else
if
(
npRate
==
"
np_markRate
"
)
price
=
((
bpjs
/
(
1
-
ratejs
/
100
))
/
(
1
-
remisejs
/
100
));
$
(
"
input[name='price_ht']:first
"
).
val
(
price
);
// TODO Must use a function like php price to have here a formated value
}
$
(
"
input[name='price_ht']:first
"
).
val
(
price
);
// TODO Must use a function like php price to have here a formated value
return
true
;
}
...
...
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