Vérification existence table module
This commit is contained in:
parent
6ac081a7fd
commit
aae9580ee0
2 changed files with 31 additions and 9 deletions
|
|
@ -29,6 +29,14 @@
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
|
||||||
|
{{* vérifier l'existence de la table du module *}}
|
||||||
|
{{#load limit="1"}}
|
||||||
|
{{:assign table_presente=true}}
|
||||||
|
{{else}}
|
||||||
|
{{:assign table_presente=false}}
|
||||||
|
{{/load}}
|
||||||
|
|
||||||
|
{{if $table_presente}}
|
||||||
{{* lister les immobilisations *}}
|
{{* lister les immobilisations *}}
|
||||||
{{:assign account_condition="("}}
|
{{:assign account_condition="("}}
|
||||||
{{#foreach from=$module.config.prefixes item="code"}}
|
{{#foreach from=$module.config.prefixes item="code"}}
|
||||||
|
|
@ -199,8 +207,8 @@
|
||||||
label="Paramètres"
|
label="Paramètres"
|
||||||
href="add_infos.html?immo_line_id=%s&type_immo=%s"|args:$immo_line_id:$type_immo
|
href="add_infos.html?immo_line_id=%s&type_immo=%s"|args:$immo_line_id:$type_immo
|
||||||
shape="settings"
|
shape="settings"
|
||||||
target="_dialog"
|
|
||||||
}}
|
}}
|
||||||
|
{{* target="_dialog"*}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{:linkbutton
|
{{:linkbutton
|
||||||
label="Amortissements"
|
label="Amortissements"
|
||||||
|
|
@ -242,8 +250,9 @@
|
||||||
</tr>
|
</tr>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</tfoot>
|
</tfoot>
|
||||||
|
{{/if}}
|
||||||
</table>
|
</table>
|
||||||
{{if $nb_immo == 0}}
|
{{if $nb_immo == 0 || ! $table_presente}}
|
||||||
<p class="block alert">Aucune immobilisation</p>
|
<p class="block alert">Aucune immobilisation</p>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</section>
|
</section>
|
||||||
|
|
|
||||||
|
|
@ -48,6 +48,19 @@
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
|
||||||
|
{{* vérifier l'existence de la table du module *}}
|
||||||
|
{{#load limit="1"}}
|
||||||
|
{{:assign columns="$$.duration as duration, $$.status as status,"}}
|
||||||
|
{{:assign table_join="LEFT JOIN !table AS info ON $$.line = line.id"}}
|
||||||
|
{{:assign doc_condition1="($$.status == 'ignored')"}}
|
||||||
|
{{:assign doc_condition2="$$.status IS NULL"}}
|
||||||
|
{{else}}
|
||||||
|
{{:assign columns=""}}
|
||||||
|
{{:assign table_join=""}}
|
||||||
|
{{:assign doc_condition1="0"}}
|
||||||
|
{{:assign doc_condition2="1"}}
|
||||||
|
{{/load}}
|
||||||
|
|
||||||
{{* lister les immobilisations *}}
|
{{* lister les immobilisations *}}
|
||||||
{{:assign account_condition="("}}
|
{{:assign account_condition="("}}
|
||||||
{{#foreach from=$module.config.prefixes item="code"}}
|
{{#foreach from=$module.config.prefixes item="code"}}
|
||||||
|
|
@ -55,7 +68,6 @@
|
||||||
{{:assign account_condition=$account_condition|cat:" account.code LIKE "|cat:$code|cat:" OR "}}
|
{{:assign account_condition=$account_condition|cat:" account.code LIKE "|cat:$code|cat:" OR "}}
|
||||||
{{/foreach}}
|
{{/foreach}}
|
||||||
{{:assign account_condition=$account_condition|cat:"0)"}}
|
{{:assign account_condition=$account_condition|cat:"0)"}}
|
||||||
{{:assign doc_condition="($$.status == 'ignored')" }}
|
|
||||||
|
|
||||||
{{if $unhide == null}}
|
{{if $unhide == null}}
|
||||||
{{:assign filter_condition="NOT ("}}
|
{{:assign filter_condition="NOT ("}}
|
||||||
|
|
@ -67,9 +79,9 @@
|
||||||
{{else}}
|
{{else}}
|
||||||
{{:assign filter_condition="1"}}
|
{{:assign filter_condition="1"}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{:assign filter_condition="($$.status IS NULL AND NOT (trans.status & 16) AND "|cat:$filter_condition|cat:")"}}
|
{{:assign filter_condition="("|cat:$doc_condition2|cat:" AND NOT (trans.status & 16) AND "|cat:$filter_condition|cat:")"}}
|
||||||
|
|
||||||
{{:assign condition=$account_condition|cat:" AND debit > 0 AND ("|cat:$filter_condition|cat:" OR "|cat:$doc_condition|cat:")"}}
|
{{:assign condition=$account_condition|cat:" AND debit > 0 AND ("|cat:$filter_condition|cat:" OR "|cat:$doc_condition1|cat:")"}}
|
||||||
|
|
||||||
{{:assign nb_immo=0}}
|
{{:assign nb_immo=0}}
|
||||||
{{#select
|
{{#select
|
||||||
|
|
@ -82,16 +94,17 @@
|
||||||
account.id as account_id,
|
account.id as account_id,
|
||||||
account.code as account_code,
|
account.code as account_code,
|
||||||
account.label as account_label,
|
account.label as account_label,
|
||||||
trans.id_year as trans_id_year,
|
!columns
|
||||||
$$.duration as duration,
|
trans.id_year as trans_id_year
|
||||||
$$.status as status
|
|
||||||
FROM acc_transactions AS trans
|
FROM acc_transactions AS trans
|
||||||
INNER JOIN acc_transactions_lines AS line ON line.id_transaction = trans.id
|
INNER JOIN acc_transactions_lines AS line ON line.id_transaction = trans.id
|
||||||
INNER JOIN acc_accounts AS account ON line.id_account = account.id
|
INNER JOIN acc_accounts AS account ON line.id_account = account.id
|
||||||
INNER JOIN acc_years AS years ON trans.id_year = years.id
|
INNER JOIN acc_years AS years ON trans.id_year = years.id
|
||||||
LEFT JOIN !table AS info ON $$.line = line.id
|
!table_join
|
||||||
WHERE !condition
|
WHERE !condition
|
||||||
ORDER BY trans.date DESC;
|
ORDER BY trans.date DESC;
|
||||||
|
!columns=$columns
|
||||||
|
!table_join=$table_join
|
||||||
!table=$module.table
|
!table=$module.table
|
||||||
!condition=$condition
|
!condition=$condition
|
||||||
}}
|
}}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue