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
88fcfa95
Commit
88fcfa95
authored
12 years ago
by
Regis Houssin
Browse files
Options
Downloads
Patches
Plain Diff
Fix: uniformize code
parent
e62b3ace
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
htdocs/fourn/commande/fiche.php
+26
-26
26 additions, 26 deletions
htdocs/fourn/commande/fiche.php
with
26 additions
and
26 deletions
htdocs/fourn/commande/fiche.php
+
26
−
26
View file @
88fcfa95
...
...
@@ -174,36 +174,36 @@ else if ($action == 'reopen' && $user->rights->fournisseur->commande->approuver)
else
if
(
$action
==
'addline'
&&
$user
->
rights
->
fournisseur
->
commande
->
creer
)
{
$langs
->
load
(
'errors'
);
$error
=
false
;
$error
=
0
;
if
(
$_
POST
[
'pu'
]
<
0
&&
$_
POST
[
'qty'
]
<
0
)
if
(
GET
POST
(
'pu'
)
<
0
&&
GET
POST
(
'qty'
)
<
0
)
{
setEventMessage
(
$langs
->
trans
(
'ErrorBothFieldCantBeNegative'
,
$langs
->
transnoentitiesnoconv
(
'UnitPrice'
),
$langs
->
transnoentitiesnoconv
(
'Qty'
)),
'errors'
);
$error
=
true
;
$error
++
;
}
if
(
empty
(
$_
POST
[
'idprodfournprice'
]
)
&&
$_
POST
[
'type'
]
<
0
)
if
(
!
GET
POST
(
'idprodfournprice'
)
&&
GET
POST
(
'type'
)
<
0
)
{
setEventMessage
(
$langs
->
trans
(
'ErrorFieldRequired'
,
$langs
->
transnoentitiesnoconv
(
'Type'
)),
'errors'
);
$error
=
true
;
$error
++
;
}
if
(
empty
(
$_
POST
[
'idprodfournprice'
]
)
&&
(
!
isset
(
$_
POST
[
'pu'
]
)
||
$_
POST
[
'pu'
]
==
''
))
// Unit price can be 0 but not ''
if
(
!
GET
POST
(
'idprodfournprice'
)
&&
(
!
GET
POST
(
'pu'
)
||
GET
POST
(
'pu'
)
==
''
))
// Unit price can be 0 but not ''
{
setEventMessage
(
$langs
->
trans
(
$langs
->
trans
(
'ErrorFieldRequired'
,
$langs
->
transnoentitiesnoconv
(
'UnitPrice'
))),
'errors'
);
$error
=
true
;
$error
++
;
}
if
(
empty
(
$_
POST
[
'idprodfournprice'
]
)
&&
empty
(
$_
POST
[
'np_desc'
]
)
&&
empty
(
$_
POST
[
'dp_desc'
]
))
if
(
!
GET
POST
(
'idprodfournprice'
)
&&
!
GET
POST
(
'np_desc'
)
&&
!
GET
POST
(
'dp_desc'
))
{
setEventMessage
(
$langs
->
trans
(
'ErrorFieldRequired'
,
$langs
->
transnoentitiesnoconv
(
'Description'
)),
'errors'
);
$error
=
true
;
$error
++
;
}
if
(
empty
(
$_
POST
[
'idprodfournprice'
]
)
&&
(
!
isset
(
$_
POST
[
'qty'
]
)
||
$_
POST
[
'qty'
]
==
''
)
||
!
empty
(
$_
POST
[
'idprodfournprice'
]
)
&&
(
!
isset
(
$_
POST
[
'pqty'
]
)
||
$_
POST
[
'pqty'
]
==
''
))
if
(
!
GET
POST
(
'idprodfournprice'
)
&&
(
!
GET
POST
(
'qty'
)
||
GET
POST
(
'qty'
)
==
''
)
||
GET
POST
(
'idprodfournprice'
)
&&
(
!
GET
POST
(
'pqty'
)
||
GET
POST
(
'pqty'
)
==
''
))
{
setEventMessage
(
$langs
->
trans
(
'ErrorFieldRequired'
,
$langs
->
transnoentitiesnoconv
(
'Qty'
)),
'errors'
);
$error
=
true
;
$error
++
;
}
if
(
!
$error
&&
((
$_
POST
[
'qty'
]
||
$_
POST
[
'pqty'
]
)
&&
((
$_
POST
[
'pu'
]
&&
(
$_
POST
[
'np_desc'
]
||
$_
POST
[
'dp_desc'
]
))
||
$_
POST
[
'idprodfournprice'
]
)))
if
(
!
$error
&&
((
GET
POST
(
'qty'
)
||
GET
POST
(
'pqty'
)
)
&&
((
GET
POST
(
'pu'
)
&&
(
GET
POST
(
'np_desc'
)
||
GET
POST
(
'dp_desc'
)
))
||
GET
POST
(
'idprodfournprice'
)
)))
{
if
(
$object
->
fetch
(
$id
)
<
0
)
dol_print_error
(
$db
,
$object
->
error
);
if
(
$object
->
fetch_thirdparty
()
<
0
)
dol_print_error
(
$db
,
$object
->
error
);
...
...
@@ -211,9 +211,9 @@ else if ($action == 'addline' && $user->rights->fournisseur->commande->creer)
// Ecrase $pu par celui du produit
// Ecrase $desc par celui du produit
// Ecrase $txtva par celui du produit
if
(
$_
POST
[
"
idprodfournprice
"
]
)
// >0 or -1
if
(
GET
POST
(
'
idprodfournprice
'
)
)
// >0 or -1
{
$qty
=
$_
POST
[
'qty'
]
?
$_
POST
[
'qty'
]
:
$_
POST
[
'pqty'
]
;
$qty
=
GET
POST
(
'qty'
)
?
GET
POST
(
'qty'
)
:
GET
POST
(
'pqty'
)
;
$productsupplier
=
new
ProductFournisseur
(
$db
);
$idprod
=
$productsupplier
->
get_buyprice
(
$_POST
[
'idprodfournprice'
],
$qty
);
// Just to see if a price exists for the quantity. Not used to found vat
...
...
@@ -230,9 +230,9 @@ else if ($action == 'addline' && $user->rights->fournisseur->commande->creer)
$desc
.
=
$productsupplier
->
description
&&
$_POST
[
'np_desc'
]
?
"
\n
"
:
""
;
$desc
.
=
$_POST
[
'np_desc'
];
$remise_percent
=
$_
POST
[
"
remise_percent
"
]
?
$_
POST
[
"
remise_percent
"
]
:
$_
POST
[
"
p_remise_percent
"
]
;
$remise_percent
=
GET
POST
(
'
remise_percent
'
)
?
GET
POST
(
'
remise_percent
'
)
:
GET
POST
(
'
p_remise_percent
'
)
;
$tva_tx
=
get_default_tva
(
$object
->
thirdparty
,
$mysoc
,
$productsupplier
->
id
,
$_
POST
[
'idprodfournprice'
]
);
$tva_tx
=
get_default_tva
(
$object
->
thirdparty
,
$mysoc
,
$productsupplier
->
id
,
GET
POST
(
'idprodfournprice'
)
);
$type
=
$productsupplier
->
type
;
// Local Taxes
...
...
@@ -241,13 +241,13 @@ else if ($action == 'addline' && $user->rights->fournisseur->commande->creer)
$result
=
$object
->
addline
(
$desc
,
$pu
,
$pu
,
// FIXME $pu is not defined
$qty
,
$tva_tx
,
$localtax1_tx
,
$localtax2_tx
,
$productsupplier
->
id
,
$_
POST
[
'idprodfournprice'
]
,
GET
POST
(
'idprodfournprice'
)
,
$productsupplier
->
fourn_ref
,
$remise_percent
,
'HT'
,
...
...
@@ -257,7 +257,7 @@ else if ($action == 'addline' && $user->rights->fournisseur->commande->creer)
if
(
$idprod
==
-
1
)
{
// Quantity too low
$mesg
=
'<div class="error">'
.
$langs
->
trans
(
"ErrorQtyTooLowForThisSupplier"
)
.
'</div>'
;
setEventMessage
(
$langs
->
trans
(
"ErrorQtyTooLowForThisSupplier"
)
,
'errors'
)
;
}
}
else
...
...
@@ -272,7 +272,7 @@ else if ($action == 'addline' && $user->rights->fournisseur->commande->creer)
if
(
!
$_POST
[
'dp_desc'
])
{
$mesg
=
'<div class="error">'
.
$langs
->
trans
(
"ErrorFieldRequired"
,
$langs
->
transnoentities
(
"Label"
))
.
'</div>'
;
setEventMessage
(
$langs
->
trans
(
"ErrorFieldRequired"
,
$langs
->
transnoentities
(
"Label"
))
,
'errors'
)
;
}
else
{
...
...
@@ -1000,7 +1000,7 @@ if ($id > 0 || ! empty($ref))
$ret
=
$form
->
form_confirm
(
$_SERVER
[
"PHP_SELF"
]
.
'?id='
.
$id
,
$langs
->
trans
(
'DeleteOrder'
),
$langs
->
trans
(
'ConfirmDeleteOrder'
),
'confirm_delete'
,
''
,
0
,
2
);
if
(
$ret
==
'html'
)
print
'<br>'
;
}
// Clone confirmation
if
(
$action
==
'clone'
)
{
...
...
@@ -1065,7 +1065,7 @@ if ($id > 0 || ! empty($ref))
$ret
=
$form
->
form_confirm
(
"fiche.php?id=
$object->id
"
,
$langs
->
trans
(
"DenyingThisOrder"
),
$langs
->
trans
(
"ConfirmDenyingThisOrder"
,
$object
->
ref
),
"confirm_refuse"
,
''
,
0
,
1
);
if
(
$ret
==
'html'
)
print
'<br>'
;
}
/*
* Confirmation de l'annulation
*/
...
...
@@ -1491,7 +1491,7 @@ if ($id > 0 || ! empty($ref))
print
'</tr>'
;
// TODO Use the predefinedproductline_create.tpl.php file
// Add free products/services form
print
'<form action="'
.
$_SERVER
[
"PHP_SELF"
]
.
'?id='
.
$object
->
id
.
'#add" method="post">'
;
print
'<input type="hidden" name="token" value="'
.
$_SESSION
[
'newtoken'
]
.
'">'
;
...
...
@@ -1505,7 +1505,7 @@ if ($id > 0 || ! empty($ref))
});
});
</script>'
;
$var
=
true
;
print
'<tr '
.
$bc
[
$var
]
.
'>'
;
print
'<td>'
;
...
...
@@ -1684,7 +1684,7 @@ if ($id > 0 || ! empty($ref))
print
'<a class="butActionDelete" href="'
.
$_SERVER
[
"PHP_SELF"
]
.
'?id='
.
$object
->
id
.
'&action=cancel">'
.
$langs
->
trans
(
"CancelOrder"
)
.
'</a>'
;
}
}
// Clone
if
(
$user
->
rights
->
fournisseur
->
commande
->
creer
)
{
...
...
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