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
8f8c63e9
Commit
8f8c63e9
authored
9 years ago
by
Laurent Destailleur
Browse files
Options
Downloads
Patches
Plain Diff
FIX Delete triggers must be before delete (reverse order compared to
create)
parent
2e1011ca
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/compta/paiement/class/paiement.class.php
+31
-33
31 additions, 33 deletions
htdocs/compta/paiement/class/paiement.class.php
with
31 additions
and
33 deletions
htdocs/compta/paiement/class/paiement.class.php
+
31
−
33
View file @
8f8c63e9
...
...
@@ -291,12 +291,12 @@ class Paiement extends CommonObject
/**
*
Supprime un
pa
ie
ment a
insi que les lignes qu'il a genere dans comptes
*
Si le paiement porte sur un ecriture compte qui est rapprochee, on refuse
*
Si le paiement porte sur au moins une facture a "payee", on refuse
*
Delete a
pa
y
ment a
nd generated links into account
*
-
Si le paiement porte sur un ecriture compte qui est rapprochee, on refuse
*
-
Si le paiement porte sur au moins une facture a "payee", on refuse
*
*
@param int $notrigger No trigger
*
@return int <0 si ko, >0 si ok
* @param int $notrigger No trigger
* @return int <0 si ko, >0 si ok
*/
function
delete
(
$notrigger
=
0
)
{
...
...
@@ -326,21 +326,43 @@ class Paiement extends CommonObject
return
-
2
;
}
$accline
=
new
AccountLine
(
$this
->
db
);
// Delete bank urls. If payment is on a conciliated line, return error.
if
(
$bank_line_id
)
if
(
$bank_line_id
>
0
)
{
$accline
=
new
AccountLine
(
$this
->
db
);
$result
=
$accline
->
fetch
(
$bank_line_id
);
if
(
$result
==
0
)
$accline
->
rowid
=
$bank_line_id
;
// If not found, we set artificially rowid to allow delete of llx_bank_url
$result
=
$accline
->
delete_urls
(
$user
);
// Delete bank account url lines linked to payment
$result
=
$accline
->
delete_urls
(
$user
);
if
(
$result
<
0
)
{
$this
->
error
=
$accline
->
error
;
$this
->
db
->
rollback
();
return
-
3
;
}
// Delete bank account lines linked to payment
$result
=
$accline
->
delete
(
$user
);
if
(
$result
<
0
)
{
$this
->
error
=
$accline
->
error
;
$this
->
db
->
rollback
();
return
-
4
;
}
}
if
(
!
$notrigger
)
{
// Call triggers
$result
=
$this
->
call_trigger
(
'PAYMENT_CUSTOMER_DELETE'
,
$user
);
if
(
$result
<
0
)
{
$this
->
db
->
rollback
();
return
-
1
;
}
// End call triggers
}
// Delete payment (into paiement_facture and paiement)
...
...
@@ -361,30 +383,6 @@ class Paiement extends CommonObject
return
-
3
;
}
// Supprimer l'ecriture bancaire si paiement lie a ecriture
if
(
$bank_line_id
)
{
$result
=
$accline
->
delete
(
$user
);
if
(
$result
<
0
)
{
$this
->
error
=
$accline
->
error
;
$this
->
db
->
rollback
();
return
-
4
;
}
}
if
(
!
$notrigger
)
{
// Appel des triggers
$result
=
$this
->
call_trigger
(
'PAYMENT_CUSTOMER_DELETE'
,
$user
);
if
(
$result
<
0
)
{
$this
->
db
->
rollback
();
return
-
1
;
}
// Fin appel triggers
}
$this
->
db
->
commit
();
return
1
;
}
...
...
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