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
a39c95e3
Commit
a39c95e3
authored
14 years ago
by
Regis Houssin
Browse files
Options
Downloads
Patches
Plain Diff
Fix: error sql
Fix: don't delete order if shipping exist Fix: uniformize code
parent
cdf52caf
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
htdocs/commande/class/commande.class.php
+5
-3
5 additions, 3 deletions
htdocs/commande/class/commande.class.php
htdocs/commande/fiche.php
+18
-33
18 additions, 33 deletions
htdocs/commande/fiche.php
with
23 additions
and
36 deletions
htdocs/commande/class/commande.class.php
+
5
−
3
View file @
a39c95e3
...
...
@@ -1461,9 +1461,11 @@ class Commande extends CommonObject
function
nb_expedition
()
{
$sql
=
'SELECT count(*)'
;
$sql
.
=
' FROM '
.
MAIN_DB_PREFIX
.
'expedition as e,'
;
$sql
.
=
' '
.
MAIN_DB_PREFIX
.
"element_element as el ON el.fk_target = e.rowid AND el.targettype = 'shipping'"
;
$sql
.
=
" WHERE el.fk_source = "
.
$this
->
id
;
$sql
.
=
' FROM '
.
MAIN_DB_PREFIX
.
'expedition as e'
;
$sql
.
=
', '
.
MAIN_DB_PREFIX
.
'element_element as el'
;
$sql
.
=
' WHERE el.fk_source = '
.
$this
->
id
;
$sql
.
=
" AND el.fk_target = e.rowid"
;
$sql
.
=
" AND el.targettype = 'shipping'"
;
$resql
=
$this
->
db
->
query
(
$sql
);
if
(
$resql
)
...
...
This diff is collapsed.
Click to expand it.
htdocs/commande/fiche.php
+
18
−
33
View file @
a39c95e3
...
...
@@ -1865,18 +1865,14 @@ else
// Valid
if
(
$object
->
statut
==
0
&&
$object
->
total_ttc
>=
0
&&
$numlines
>
0
&&
$user
->
rights
->
commande
->
valider
)
{
print
'<a class="butAction" href="'
.
$_SERVER
[
"PHP_SELF"
]
.
'?id='
.
$object
->
id
.
'&action=validate"'
;
print
'>'
.
$langs
->
trans
(
'Validate'
)
.
'</a>'
;
print
'<a class="butAction" href="'
.
$_SERVER
[
"PHP_SELF"
]
.
'?id='
.
$object
->
id
.
'&action=validate">'
.
$langs
->
trans
(
'Validate'
)
.
'</a>'
;
}
// Edit
if
(
$object
->
statut
==
1
)
{
if
(
$user
->
rights
->
commande
->
creer
)
if
(
$object
->
statut
==
1
&&
$user
->
rights
->
commande
->
creer
)
{
print
'<a class="butAction" href="fiche.php?id='
.
$object
->
id
.
'&action=modif">'
.
$langs
->
trans
(
'Modify'
)
.
'</a>'
;
}
}
// Send
if
(
$object
->
statut
>
0
)
...
...
@@ -1893,24 +1889,16 @@ else
}
// Ship
$numshipping
=
0
;
if
(
$conf
->
expedition
->
enabled
)
{
$numshipping
=
$object
->
nb_expedition
();
if
(
$object
->
statut
>
0
&&
$object
->
statut
<
3
&&
$object
->
getNbOfProductsLines
()
>
0
)
{
if
(
$user
->
rights
->
expedition
->
creer
)
{
// Chargement des permissions
/*$error = $user->load_entrepots(); deprecated
if (sizeof($user->entrepots) === 1)
{
print '<a class="butAction" href="'.DOL_URL_ROOT.'/expedition/fiche.php?id='.$id.'&action=create&commande_id='.$id.'&entrepot_id='.$user->entrepots[0]['id'].'">';
print $langs->trans('ShipProduct').'</a>';
}
else
{*/
print
'<a class="butAction" href="'
.
DOL_URL_ROOT
.
'/expedition/shipment.php?id='
.
$object
->
id
.
'">'
.
$langs
->
trans
(
'ShipProduct'
)
.
'</a>'
;
//}
}
else
{
...
...
@@ -1940,13 +1928,9 @@ else
}
// Close
if
(
$object
->
statut
==
1
||
$object
->
statut
==
2
)
{
if
(
$user
->
rights
->
commande
->
cloturer
)
if
((
$object
->
statut
==
1
||
$object
->
statut
==
2
)
&&
$user
->
rights
->
commande
->
cloturer
)
{
print
'<a class="butAction" href="'
.
$_SERVER
[
"PHP_SELF"
]
.
'?id='
.
$object
->
id
.
'&action=close"'
;
print
'>'
.
$langs
->
trans
(
'Close'
)
.
'</a>'
;
}
print
'<a class="butAction" href="'
.
$_SERVER
[
"PHP_SELF"
]
.
'?id='
.
$object
->
id
.
'&action=close">'
.
$langs
->
trans
(
'Close'
)
.
'</a>'
;
}
// Clone
...
...
@@ -1956,21 +1940,22 @@ else
}
// Cancel order
if
(
$object
->
statut
==
1
)
{
$nb_expedition
=
$object
->
nb_expedition
();
if
(
$user
->
rights
->
commande
->
annuler
&&
$nb_expedition
==
0
)
if
(
$object
->
statut
==
1
&&
$user
->
rights
->
commande
->
annuler
)
{
print
'<a class="butActionDelete" href="'
.
$_SERVER
[
"PHP_SELF"
]
.
'?id='
.
$object
->
id
.
'&action=cancel"'
;
print
'>'
.
$langs
->
trans
(
'Cancel'
)
.
'</a>'
;
}
print
'<a class="butActionDelete" href="'
.
$_SERVER
[
"PHP_SELF"
]
.
'?id='
.
$object
->
id
.
'&action=cancel">'
.
$langs
->
trans
(
'Cancel'
)
.
'</a>'
;
}
// Delete order
if
(
$user
->
rights
->
commande
->
supprimer
)
{
print
'<a class="butActionDelete" href="'
.
$_SERVER
[
"PHP_SELF"
]
.
'?id='
.
$object
->
id
.
'&action=delete"'
;
print
'>'
.
$langs
->
trans
(
'Delete'
)
.
'</a>'
;
if
(
$numshipping
==
0
)
{
print
'<a class="butActionDelete" href="'
.
$_SERVER
[
"PHP_SELF"
]
.
'?id='
.
$object
->
id
.
'&action=delete">'
.
$langs
->
trans
(
'Delete'
)
.
'</a>'
;
}
else
{
print
'<a class="butActionRefused" href="#" title="'
.
$langs
->
trans
(
"ShippingExist"
)
.
'">'
.
$langs
->
trans
(
"Delete"
)
.
'</a>'
;
}
}
print
'</div>'
;
...
...
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