Supprimer les documents sans écriture associée
This commit is contained in:
parent
6495737428
commit
65112720ba
2 changed files with 31 additions and 16 deletions
28
_remove_orphan_docs.tpl
Normal file
28
_remove_orphan_docs.tpl
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
{{* -*- brindille -*- *}}
|
||||
|
||||
{{* supprimer les documents sans écriture associée *}}
|
||||
{{:assign var="docs." type="amort_link" field="amort_line_id"}}
|
||||
{{:assign var="docs." type="credit_link" field="credit_line_id"}}
|
||||
{{:assign var="docs." type="cession_link" field="cession_line_id"}}
|
||||
{{:assign var="docs." type="exit_link" field="exit_line_id"}}
|
||||
{{:assign var="docs." type="immo" field="line"}}
|
||||
|
||||
{{#foreach from=$docs}}
|
||||
|
||||
{{:assign join_field="$$."|cat:$field}}
|
||||
{{:assign type_name=$type|quote_sql}}
|
||||
{{:assign type_cond="$$.type"|cat:" = "|cat:$type_name}}
|
||||
|
||||
{{#select
|
||||
info.id
|
||||
FROM !table AS info
|
||||
LEFT JOIN acc_transactions_lines as line ON !join_field = line.id
|
||||
WHERE !type_cond AND line.id IS NULL
|
||||
;
|
||||
!table=$module.table
|
||||
!type_cond = $type_cond
|
||||
!join_field = $join_field
|
||||
}}
|
||||
{{:delete id=$id}}
|
||||
{{/select}}
|
||||
{{/foreach}}
|
||||
Loading…
Add table
Add a link
Reference in a new issue