diff --git a/README.md b/README.md
index 578af08..e771e69 100644
--- a/README.md
+++ b/README.md
@@ -4,14 +4,15 @@ Ce module permet de gérer les écritures d'amortissements pour les immobilisati
- lister les immobilisations
- ajouter une nouvelle immobilisation
-- lister les amortissements d'une immobilisation
+- lister les amortissements d'une immobilisation :
+ - amortissements déjà enregistrés
+ - amortissements à venir
+- associer une écriture d'amortissement à une immobilisation
- enregistrer un nouvel amortissement
-- incorporer d'anciennes immobilisations et leurs amortisements
## Installation
- télécharger [l'archive zip](https://link.infini.fr/amortissement)
- cliquer « Configuration » puis « Extensions »
- en bas de la page, cliquer « Importer un module »
- sélectionner l'archive téléchargée ci-dessus
-- activer le module
-
+- activer le module qui est maintenant présent dans la liste des extensions inactives
diff --git a/_archives.html b/_archives.html
index a4356d6..ce92aff 100644
--- a/_archives.html
+++ b/_archives.html
@@ -153,7 +153,7 @@
{{$account_code}}
{{$account_label}}
- {{:linkbutton label="Modifier" href="exit_step1.html?immo_doc_id=%s"|args:$info_immo.id shape="edit"}}
+ {{:linkbutton label="Modifier" href="exit_step4.html?immo_doc_id=%s"|args:$info_immo.id shape="edit"}}
{{/select}}
diff --git a/_common_detach.html b/_common_detach.html
index 8c84736..b4e80d0 100644
--- a/_common_detach.html
+++ b/_common_detach.html
@@ -1,13 +1,12 @@
{{* -*- brindille -*- *}}
{{*
- Supprimer l'association entre une ligne d'immo et une autre ligne (amort, credit, cession, sortie)
+ Supprimer l'association entre deux lignes
@param immo_doc_id : id du doc associé à la ligne d'immobilisation
@param line_id : id de la ligne à détacher
*}}
-
{{* données de l'immobilisation *}}
-{{:include file="_get_immo_data.html" immo_doc_id=$immo_doc_id|intval keep="info_immo, ligne_immo, message"}}
+{{:include file="_get_immo_data.html" immo_doc_id=$immo_doc_id|intval keep="ligne_immo, message"}}
{{if $message != null}}
{{:error message=$message}}
{{/if}}
diff --git a/_immobilisations_autres.html b/_immobilisations_autres.html
index 7a4b04c..0401feb 100644
--- a/_immobilisations_autres.html
+++ b/_immobilisations_autres.html
@@ -86,7 +86,7 @@
!table_join
WHERE !condition
GROUP BY immo_line_id
- ORDER BY trans.date;
+ ORDER BY trans.date DESC;
!columns=$columns
!table_join=$table_join
!table=$module.table
diff --git a/_nav.html b/_nav.html
index c81e1f3..fac14e4 100644
--- a/_nav.html
+++ b/_nav.html
@@ -1,31 +1,55 @@
{{* -*- brindille -*- *}}
- {{if $subcurrent == null}}
- {{if $current == "managed" || $current == "amortized" || $current == "archived"}}
-
- {{:linkbutton label="Ajouter une immobilisation" shape="plus" href="add_asset.html"}}
+ {{if $current == "index" && $subcurrent != "unfinished" && $subsubcurrent == null}}
+
+ {{:linkbutton label="Ajouter une immobilisation" shape="plus" href="add_asset.html"}}
+
+ {{elseif $current == "index" && $subcurrent == "details"}}
+
+ {{if $subsubcurrent|match:"credit"}}
+ {{:linkbutton label="Rattacher une écriture d'immobilisation" href="link_immo.html?immo_doc_id=%s"|args:$_GET.immo_doc_id shape="link" target="_dialog"}}
+ {{/if}}
+ {{if $subsubcurrent|match:"modif"}}
+ {{:linkbutton label="Modifier" href="modify_infos.html?immo_doc_id=%s"|args:$_GET.immo_doc_id shape="edit" target="_dialog"}}
+ {{/if}}
+
+ {{elseif $subsubcurrent == "amortization" && $type_immo == null || $type_immo == "managed" || $type_immo == "other"}}
+
+ {{if $autres_amort}}
+ {{:linkbutton
+ label="Rattacher un amortissement"
+ title="Rattacher un amortissement existant"
+ href="other_amortizations.html?immo_doc_id=%s"|args:$_GET.immo_doc_id
+ shape="link"
+ target="_dialog"}}
+ {{/if}}
+ {{:linkbutton
+ label="Enregistrer un amortissement"
+ title="Enregistrer un nouvel amortissement"
+ href="save_amort.html?immo_doc_id=%s"|args:$_GET.immo_doc_id target="_dialog"
+ shape="plus"
+ }}
- {{/if}}
{{/if}}
- {{if $subcurrent != null}}
+ {{if $subsubcurrent != null}}
- {{if $subcurrent == "transfer"}}
- Transfert d'immobilisations
- {{elseif $subcurrent == "balance_exit"}}
+ {{if $subsubcurrent == "amortization"}}
+ Amortissements
+ {{elseif $subsubcurrent == "balance_exit"}}
Sortie de bilan
- {{elseif $subcurrent == "details"}}
- Détails
+ {{elseif $subsubcurrent == "transfer"}}
+ Transfert d'immobilisations
{{/if}}
{{/if}}
diff --git a/add_asset.html b/add_asset.html
index 6c21221..8e18363 100644
--- a/add_asset.html
+++ b/add_asset.html
@@ -161,7 +161,7 @@
{{:admin_header title="Ajout immobilisation" current="module_amortization"}}
{{* barre de navigation *}}
{{if ! $dialog}}
- {{:include file="_nav.html" current="managed" subcurrent="add_asset"}}
+ {{:include file="_nav.html" current="index" subcurrent="managed"}}
{{/if}}
{{:form_errors}}
diff --git a/add_infos.html b/add_infos.html
index 6e5fe46..699888f 100644
--- a/add_infos.html
+++ b/add_infos.html
@@ -9,8 +9,14 @@
{{:assign montant_affecte=0}}
{{#load type="immo" where="$$.line = :line_id" :line_id=$_GET.immo_line_id|intval assign="info_immo"}}
{{:assign montant_affecte="%d+%d"|math:$montant_affecte:$amount}}
- {{:assign choix_defaut=$info_immo.status}}
{{/load}}
+{{if $info_immo != null}}
+ {{:assign date_defaut=$info_immo.date}}
+ {{:assign duree_defaut=$info_immo.duration}}
+ {{:assign choix_defaut=$info_immo.status}}
+{{else}}
+ {{:assign duree_defaut=null}}
+{{/if}}
{{#select
trans.id as immo_trans_id,
@@ -31,12 +37,7 @@
{{:error message="Immobilisation non trouvée"}}
{{/select}}
{{:assign reste="%d-%d"|math:$ligne_immo.montant:$montant_affecte}}
-{{:assign date_achat_defaut=$info_immo.date_achat|or:$ligne_immo.date_achat}}
-{{:assign date_mes_defaut=$info_immo.date_mes|or:$info_immo.date_achat|or:$ligne_immo.date_achat}}
-{{:assign immo_label=$ligne_immo.trans_label}}
-{{if $ligne_immo.line_label != null && $ligne_immo.line_label != $ligne_immo.trans_label}}
- {{:assign immo_label=$immo_label|cat:" — "|cat:$ligne_immo.line_label}}
-{{/if}}
+
{{#form on="save"}}
{{if $_POST.classify == null}}
@@ -52,25 +53,17 @@
{{:assign date_mes=null}}
{{:assign status="ignored"}}
{{elseif $_POST.classify == "archived"}}
- {{* voir s'il y a déjà un doc associé à cette immo *}}
- {{#load type="immo" where="$$.line = :immo_line_id" :immo_line_id=$_GET.immo_line_id|intval}}
- {{:assign uuid=$key}}
- {{:assign immo_doc_id=$id}}
- {{else}}
- {{:assign uuid=""|uuid}}
- {{/load}}
-
{{* immobilisation sortie du bilan *}}
{{:save
- key=$uuid
+ key=""|uuid
validate_schema="asset.schema.json"
type="immo"
line=$_GET.immo_line_id|intval
duration=0
- status=null
+ status="managed"
assign_new_id="immo_doc_id"
}}
- {{:redirect force="exit_step1.html?immo_doc_id=%s&from=exit"|args:$immo_doc_id}}
+ {{:redirect force="exit_step1.html?immo_doc_id=%s"|args:$immo_doc_id}}
{{else}}
{{* immobilisation amortissable *}}
{{if $_POST.date_achat|parse_date > $ligne_immo.date_achat}}
@@ -158,15 +151,10 @@
{{:admin_header title="Classer l'immobilisation" custom_css="./style.css" current="module_amortization"}}
{{* barre de navigation *}}
{{if ! $dialog}}
- {{:include file="_nav.html" current="other" subcurrent="parameter"}}
+ {{:include file="_nav.html" current="index" subcurrent="other" subsubcurrent="parameter"}}
{{/if}}
{{:form_errors}}
-{{* date de début du 1er exercice dans paheko *}}
-{{#years order="start_date" limit=1}}
- {{:assign first_date=$start_date}}
-{{/years}}
-
{{*
- classer l'immobilisation
- renseigner ou modifier la date de mise en service, les écritures associées ou la durée d'amortissement
@@ -177,9 +165,7 @@
-{{if $valeur_residuelle > 0 || $linked_immos != null}}
- Avoirs
-
- {{if $total_amort == 0 || ! $created_amort}}
- {{:linkbutton label="Attacher une écriture d'avoir" href="link_immo.html?immo_doc_id=%s&filter=true"|args:$_GET.immo_doc_id shape="link" target="_dialog"}}
- {{/if}}
-
-{{/if}}
+Avoirs
+
+ {{if $total_amort == 0}}
+ {{:linkbutton label="Attacher une écriture d'avoir" href="link_immo.html?immo_doc_id=%s"|args:$_GET.immo_doc_id shape="link" target="_dialog"}}
+ {{/if}}
+
{{if $linked_immos != null}}
@@ -195,14 +194,12 @@
shape="link"
target="_dialog"}}
{{/if}}
- {{if $valeur_residuelle > 0}}
- {{:linkbutton
- label="Enregistrer un amortissement"
- title="Enregistrer un nouvel amortissement"
- href="save_amort.html?immo_doc_id=%s"|args:$_GET.immo_doc_id target="_dialog"
- shape="plus"
+ {{:linkbutton
+ label="Enregistrer un amortissement"
+ title="Enregistrer un nouvel amortissement"
+ href="save_amort.html?immo_doc_id=%s"|args:$_GET.immo_doc_id target="_dialog"
+ shape="plus"
}}
- {{/if}}
{{if $linked_amort != null}}
diff --git a/attach_amort.html b/attach_amort.html
index a6d05bb..5c2951c 100644
--- a/attach_amort.html
+++ b/attach_amort.html
@@ -93,12 +93,6 @@
{{:error message="Le montant de l'amortissement (%s) dépasse la valeur résiduelle de l'immobilisation (%s)"|args:$ma:$vnc}}
{{/if}}
- {{*
- supprimer les documents qui pointent sur une ligne d'amortissement absente
- cas de la suppression manuelle d'un amortissement
- *}}
- {{:include file="_remove_orphan_docs.tpl"}}
-
{{* Lier l'écriture d'amortissement à l'écriture d'immobilisation *}}
{{:include file="_common_attach.html" immo_doc_id=$_GET.immo_doc_id trans_id=$amort_line.trans_id}}
@@ -120,8 +114,8 @@
}}
{{/load}}
- {{* immo soldée ? *}}
- {{if $total_amort == $montant_immo && $_GET.from != "exit"}}
+ {{* À VÉRIFIER immo soldée ? *}}
+ {{if $total_amort == $montant_immo}}
{{:assign status="amortized"}}
{{:save
key=$info_immo.key
@@ -140,7 +134,7 @@
{{* barre de navigation *}}
{{if ! $dialog}}
- {{:include file="_nav.html" current="managed" subcurrent="attach_amort"}}
+ {{:include file="_nav.html" current="config" subcurrent="init" subsubcurrent="parameter"}}
{{/if}}
{{:form_errors}}
diff --git a/attach_credit.html b/attach_credit.html
index 276dc76..6e8d22a 100644
--- a/attach_credit.html
+++ b/attach_credit.html
@@ -115,8 +115,9 @@
{{if ! $dialog}}
{{:include
file="_nav.html"
- current="managed"
- subcurrent="attach_credit"
+ current="config"
+ subcurrent="other"
+ subsubcurrent="immo"
type_immo="other"
}}
{{/if}}
diff --git a/balance_sheet_exit.html b/balance_sheet_exit.html
index a561c80..2b4cf6b 100644
--- a/balance_sheet_exit.html
+++ b/balance_sheet_exit.html
@@ -10,12 +10,6 @@
{{if $message != null}}
{{:error message=$message}}
{{/if}}
-{{* TODO VÉRIFIER SI UTILE *}}
-{{*
-{{if $info_immo.duration == null || $info_immo.duration == 0}}
- {{:error message="Vous devez renseigner la durée d'amortissement au préalable"}}
-{{/if}}
-*}}
{{:assign label_immo=$info_immo.label|or:$ligne_immo.trans_label}}
{{if $ligne_immo.line_label != null && $ligne_immo.line_label != $label_immo}}
@@ -77,7 +71,7 @@
{{:assign var="open_years.%d"|args:$id value=$label|cat:" (du "|cat:$debut|cat:" au "|cat:$fin|cat:")"}}
{{else}}
{{:assign debut=$date_debut|date_short}}
- {{:error message="Aucun exercice ouvert pour enregistrer la sortie de bilan à partir du %s"|args:$debut}}
+ {{:error message="Aucun exercice ouvert pour enregistrer un amortissement à partir du %s"|args:$debut}}
{{/years}}
{{if $years|count == 1}}
{{:assign default_year=$years.0.id}}
@@ -141,7 +135,7 @@
{{:admin_header title="Sortie de bilan" custom_css="./style.css" current="module_amortization"}}
{{if ! $dialog}}
- {{:include file="_nav.html" current="%s"|args:$_GET.type_immo subcurrent="balance_exit"}}
+ {{:include file="_nav.html" current="index" subcurrent="%s"|args:$_GET.type_immo subsubcurrent="balance_exit"}}
{{/if}}
{{:form_errors}}
diff --git a/compute_exit_data.html b/compute_exit_data.html
index c824af5..7caf90b 100644
--- a/compute_exit_data.html
+++ b/compute_exit_data.html
@@ -9,9 +9,7 @@
@param date_debut : date de début de la période d'amortissement complémentaire
@param exit_date : date de sortie de l'immobilisation
*}}
-
-{{* TODO boutons de navigation avant-arrière*}}
-
+{{* TODO *}}
{{* données de l'immobilisation *}}
{{:include file="_get_immo_data.html" immo_doc_id=$_GET.immo_doc_id|intval keep="info_immo, ligne_immo, message"}}
{{if $message != null}}
@@ -60,12 +58,7 @@
{{* barre de navigation *}}
{{if ! $dialog}}
- {{if $valeur_nette > 0}}
- {{:assign type_immo="managed"}}
- {{else}}
- {{:assign type_immo="amortized"}}
- {{/if}}
- {{:include file="_nav.html" current="%s"|args:$type_immo subcurrent="balance_exit"}}
+ {{:include file="_nav.html" current="index" subcurrent="balance_exit"}}
{{/if}}
{{:form_errors}}
diff --git a/config.html b/config.html
index eec7baf..50f295b 100644
--- a/config.html
+++ b/config.html
@@ -46,7 +46,6 @@
{{/form}}
{{:admin_header title="Configuration" custom_css="./style.css" current="module_amortization"}}
-
{{:include file="_nav.html" current="config"}}
{{if $_GET.ok == 1}}
Configuration enregistrée.
@@ -155,14 +154,13 @@
}}
- {{if ! $code|in:$config_defaut.prefixes}}
- {{:button
- label="Enlever"
- shape="minus"
- min="1"
- name="remove_line"
- }}
- {{/if}}
+ {{:button
+ label="Enlever"
+ title="Enlever une ligne"
+ shape="minus"
+ min="1"
+ name="remove_line"
+ }}
{{/foreach}}
@@ -189,7 +187,6 @@
- {{:assign unfinished_lines=$config_defaut.unfinished|map:implode:"-"|implode:","}}
{{#foreach from=$unfinished_accounts key=code item=elem}}
@@ -203,15 +200,13 @@
}}
- {{if $unfinished_lines|strpos:$code === false}}
- {{:button
- label="Enlever"
- title="Enlever une ligne"
- shape="minus"
- min="1"
- name="remove_line"
- }}
- {{/if}}
+ {{:button
+ label="Enlever"
+ title="Enlever une ligne"
+ shape="minus"
+ min="1"
+ name="remove_line"
+ }}
{{/foreach}}
diff --git a/detach_amort.html b/detach_amort.html
index b058716..eba97ee 100644
--- a/detach_amort.html
+++ b/detach_amort.html
@@ -7,7 +7,8 @@
@param amort_line_id : id de la ligne d'amortissement
*}}
-{{:include file="_common_detach.html" immo_doc_id=$_GET.immo_doc_id line_id=$_GET.amort_line_id keep="info_immo"}}
+{{:include file="_common_detach.html" immo_doc_id=$_GET.immo_doc_id line_id=$_GET.amort_line_id}}
+
{{* supprimer le doc de liaison entre les lignes *}}
{{#load type="amort_link"
where="$$.immo_doc_id = :immo_doc_id AND $$.amort_line_id = :amort_line_id"
@@ -18,12 +19,11 @@
{{/load}}
{{* marquer immo non soldée *}}
-{{if $info_immo.status == "amortized"}}
- {{:save
- key=$info_immo.key
- status="managed"
- }}
-{{/if}}
+{{* TODO : À VÉRIFIER *}}
+{{:save
+ key=$info_immo.key
+ status="managed"
+}}
{{if $_GET.from == "exit"}}
{{:redirect force="exit_step2.html?immo_doc_id=%s&ok=1&msg=detach_amort"|args:$_GET.immo_doc_id}}
diff --git a/exit_step1.html b/exit_step1.html
index 1154fcb..0fc2fb1 100644
--- a/exit_step1.html
+++ b/exit_step1.html
@@ -32,7 +32,6 @@
- line.credit < ligne_immo.amount => peut-être un avoir
- line.credit = ligne_immo.amount - avoirs => écriture de sortie du bilan
*}}
-{{:assign account_code=$ligne_immo.account_code|cat:"%"}}
{{#select
trans.id as trans_id,
trans.label as trans_label,
@@ -41,15 +40,15 @@
line.id as credit_line_id,
line.label as line_label,
line.credit as amount,
- account.id as account_id,
- account.code as account_code,
- account.label as account_label
+ acc.id as account_id,
+ acc.code as account_code,
+ acc.label as account_label
FROM acc_transactions AS trans
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 acc ON line.id_account = acc.id
LEFT JOIN module_data_amortization AS mda ON json_extract(mda.document, '$.amort_line_id') = line.id
WHERE
- account.code LIKE :account_code
+ acc.code = :acc_code
AND line.credit > 0
AND credit_line_id NOT IN (
SELECT json_extract(credit_link.document, '$.credit_line_id') AS line_id FROM !table as credit_link
@@ -59,7 +58,7 @@
WHERE json_extract(exit_link.document, '$.type') == "exit_link"
)
;
- :account_code=$account_code
+ :acc_code=$ligne_immo.account_code
!table =$module.table
assign="credit_line"
}}
@@ -76,6 +75,7 @@
}}
{{* chercher des écritures d'amortissement correspondant au compte d'une immo sans doc associé *}}
+{{* TODO écritures d'amort pas entièrement affectées *}}
{{#select
line.id as amort_line_id,
line.credit as amort_amount,
@@ -105,7 +105,7 @@
{{:assign keep_amort=true}}
{{#load type="amort_link"
where="$$.amort_line_id = :amort_line_id"
- :amort_line_id=$amort_line.amort_line_id
+ :amort_line_id=$amort_line.amort_line_id|intval
assign="amort_link"
}}
{{if $amort_link.amount == null || $amort_link.amount == 0}}
@@ -123,12 +123,6 @@
{{/select}}
{{:admin_header title="Immobilisation sortie du bilan" custom_css="./style.css" current="module_amortization"}}
-{{if $_GET.from == "exit"}}
- {{:assign current="other"}}
-{{else}}
- {{:assign current="archived"}}
-{{/if}}
-{{:include file="_nav.html" current=$current subcurrent="exit"}}
{{if $_GET.ok}}
{{if $_GET.msg|match:"attach_avoir"}}
@@ -238,7 +232,7 @@
{{/if}}
-
-{{:assign trans_url="%s/acc/transactions/details.php?id=%s"|args:$admin_url:$ligne_immo.trans_id}}
-
-
-
- {{if $free_amort_lines != null}}
+{{if $free_amort_lines != null}}
+
+ Immobilisation « {{$label_immo}} »
@@ -94,6 +78,11 @@
{{#foreach from=$free_amort_lines item="line"}}
+{{*
+ {{if $_GET.filter && $line.account_code != $code_amort}}
+ {{:continue}}
+ {{/if}}
+*}}
{{:assign trans_url="%s/acc/transactions/details.php?id=%s"|args:$admin_url:$line.trans_id}}
{{:assign compte_url="%s/acc/accounts/journal.php?id=%s&year=%s"|args:$admin_url:$line.account_id:$line.year}}
@@ -118,12 +107,11 @@
{{/foreach}}
- Sélectionner une écriture d'amortissement pour l'associer à l'immobilisation
- {{else}}
- Aucun amortissement pour le compte {{$code_amort}}
- {{/if}}
-
+
+{{else}}
+ Aucun amortissement pour le compte {{$code_amort}}
+{{/if}}
{{:form_errors}}
diff --git a/save_amort.html b/save_amort.html
index 2504ff8..1705579 100644
--- a/save_amort.html
+++ b/save_amort.html
@@ -65,7 +65,7 @@
*}}
{{:assign msg_years=""}}
{{#years closed=false order="start_date" where="start_date <= :debut AND :debut <= end_date"
- :debut=$date_debut assign="years."}}
+ :debut=$date_debut assign=years.}}
{{if $total_amort == 0}}
{{:assign ts_debut=$date_debut|strtotime}}
{{else}}
@@ -148,12 +148,6 @@
{{:error message="Le montant indiqué « %s » dépasse le solde à amortir « %s »"|args:$montant:$solde}}
{{/if}}
- {{*
- supprimer les documents qui pointent sur une ligne d'amortissement absente
- cas de la suppression manuelle d'un amortissement
- *}}
- {{:include file="_remove_orphan_docs.tpl"}}
-
{{* enregistrer l'écriture *}}
{{:assign
var="lines."
@@ -167,6 +161,7 @@
account=$credit_account|keys|value:0
id_project=$ligne_immo.id_project
}}
+
{{:api
method="POST"
path="accounting/transaction"
@@ -196,30 +191,26 @@
{{* immo soldée ? *}}
{{if $_POST.montant|trim|money_int == $solde}}
- {{:assign status="amortized"}}
+ {{:assign var="info_immo.status" value="amortized"}}
{{:save
key=$info_immo.key
- status=$status
+ status=$info_immo.status
}}
{{/if}}
- {{:redirect force="amortization.html?immo_doc_id=%s&type_immo=%s&ok=1&msg=amortissement"|args:$_GET.immo_doc_id:$status}}
+ {{:redirect force="amortization.html?immo_doc_id=%s&type_immo=%s&ok=1&msg=amortissement"|args:$_GET.immo_doc_id:$info_immo.status}}
{{/form}}
-{{:assign label_immo=$info_immo.label|or:$ligne_immo.trans_label}}
-
-{{:admin_header title="Amortissement pour « %s »"|args:$label_immo custom_css="./style.css" current="module_amortization"}}
+{{:admin_header title="Ajout amortissement" custom_css="./style.css" current="module_amortization"}}
{{* barre de navigation *}}
{{if ! $dialog}}
- {{:include file="_nav.html" current="managed" subcurrent="amortization"}}
+ {{:include file="_nav.html" current="index" subcurrent="managed" subsubcurrent="amortization"}}
{{/if}}
{{:form_errors}}
-{{if $years|count == 1}}
- {{:assign var=selected_year value=$years.0.id}}
-{{/if}}
+{{:assign var=selected_year value=$years.0.id}}
{{:assign var=date_amort value=$years.0.end_date}}
{{:include file="_calcul_dates.html" date_debut=$date_debut date_fin=$date_amort keep="nbjours"}}
diff --git a/scripts.js b/scripts.js
index 3def0ba..c59df55 100644
--- a/scripts.js
+++ b/scripts.js
@@ -12,10 +12,9 @@ function toggleInputs(idcb, idfields) {
}
}
-function toggleVisibility(id_check, fields) {
- const elem = document.getElementById(id_check);
- fields.forEach(function (id_field) {
- const field = document.getElementById(id_field);
+function toggleVisibility(idcheck, fields) {
+ const elem = document.getElementById(idcheck);
+ fields.forEach(function (field) {
if (elem.checked) {
field.classList.remove('hidden');
} else {
@@ -145,21 +144,19 @@ function setSelectorYear(button_names, f_years_selector)
// Associer au bouton « Enlever » de chaque ligne l'action de suppression de la ligne
function initLine(row) {
- let removeBtn = row.querySelector('button[name="remove_line"]');
- if (removeBtn != null) {
- removeBtn.onclick = () => {
- let count = removeBtn.closest("table").querySelectorAll('tbody tr').length;
- var min = removeBtn.getAttribute('min');
+ var removeBtn = row.querySelector('button[name="remove_line"]');
+ removeBtn.onclick = () => {
+ let count = removeBtn.closest("table").querySelectorAll('tbody tr').length;
+ var min = removeBtn.getAttribute('min');
- if (count <= min) {
- alert("Il n'est pas possible d'avoir moins de " + min + " ligne(s).");
- return false;
- }
+ if (count <= min) {
+ alert("Il n'est pas possible d'avoir moins de " + min + " ligne(s).");
+ return false;
+ }
- row.parentNode.removeChild(row);
- return true;
- };
- }
+ row.parentNode.removeChild(row);
+ return true;
+ };
}
// Associer au bouton « Ajouter » de chaque table l'action d'ajouter une ligne
@@ -187,28 +184,6 @@ function addLine(button, codes) {
let lib = newNode.querySelector('.input-list span.label');
lib.innerText = '';
- // si besoin, ajouter le bouton de suppression
- let action_cell = newNode.querySelector('td.actions');
- let removeBtn = newNode.querySelector('button[name="remove_line"]');
- if (removeBtn == null) {
- const attributs = {
- "title" : "Enlever une ligne",
- "min": "1",
- "name": "remove_line",
- "data-icon": "➖",
- "type": "button",
- "class": "icn-btn",
- "value": "1",
- "aria-label": "Enlever une ligne"
- };
- let new_button = document.createElement("button");
- new_button.appendChild(document.createTextNode("Enlever"));
- for (let attr in attributs) {
- new_button.setAttribute(attr, attributs[attr]);
- }
- action_cell.appendChild(new_button);
- }
-
// ajouter la nouvelle ligne
line.parentNode.appendChild(newNode);
initLine(newNode);
diff --git a/transfer.html b/transfer.html
index 6a491b1..a9c9f50 100644
--- a/transfer.html
+++ b/transfer.html
@@ -181,7 +181,6 @@
duration=$duration
date_mes=null
status=$status
- created=true
}}
{{if $_POST.amortir}}
{{:assign type_immo="managed"}}
@@ -193,7 +192,7 @@
{{:admin_header title="Transfert d'immobilisation en cours" custom_css="./style.css" current="module_amortization"}}
{{if ! $dialog}}
- {{:include file="_nav.html" current="unfinished" subcurrent="transfer"}}
+ {{:include file="_nav.html" current="index" subcurrent="unfinished" subsubcurrent="transfer"}}
{{/if}}
{{:form_errors}}
diff --git a/write_exit.html b/write_exit.html
index cfd4a3a..0a17d3b 100644
--- a/write_exit.html
+++ b/write_exit.html
@@ -142,7 +142,6 @@
type="amort_link"
immo_doc_id=$info_immo.id
amort_line_id=$line.id
- created=true
}}
{{/if}}
{{/foreach}}
@@ -208,7 +207,6 @@
type="exit_link"
immo_doc_id=$info_immo.id
exit_line_id=$line.id
- created=true
}}
{{:break}}
{{/if}}
@@ -254,7 +252,6 @@
type="cession_link"
immo_doc_id=$info_immo.id
cession_line_id=$line.id
- created=true
}}
{{:break}}
{{/if}}
@@ -270,12 +267,7 @@
{{:admin_header title="Sortie du bilan" custom_css="./style.css" current="module_amortization"}}
{{if ! $dialog}}
- {{if $valeur_nette > 0}}
- {{:assign type_immo="managed"}}
- {{else}}
- {{:assign type_immo="amortized"}}
- {{/if}}
- {{:include file="_nav.html" current="%s"|args:$type_immo subcurrent="balance_exit"}}
+ {{:include file="_nav.html" current="index" subcurrent="balance_exit"}}
{{/if}}
{{*