@@ -239,9 +230,11 @@ function changeVisibility(evt, idcheck = 'f_set_return_date_1', fields = ['div_r
toggleVisibility(idcheck, fields);
}
-function changeReturnDate(evt, id_date = 'f_date', id_return_date = 'f_return_date', id_loan_duration='loan_duration')
-{
- setReturnDate(id_date, id_return_date, id_loan_duration);
+function changeReturnDate(evt, id_date = 'f_date', id_return_date = 'f_return_date', id_loan_duration='loan_duration') {
+ const loan_duration = document.getElementById(id_loan_duration).value;
+ let nbsec = getDate(id_date) + loan_duration*24*60*60;
+ const date_retour = new Date(nbsec * 1000);
+ document.getElementById(id_return_date).value = date_retour.toLocaleDateString();
}
(function () {
diff --git a/movements/output_return.html b/movements/output_return.html
index 162fc37..7f5b0af 100644
--- a/movements/output_return.html
+++ b/movements/output_return.html
@@ -1,7 +1,5 @@
{{* -*- brindille -*- *}}
-{{#restrict block=true section="accounting" level="write"}}{{/restrict}}
-
{{*
Enregistrer un retour de sortie temporaire
paramètres :
@@ -34,15 +32,14 @@
{{#select
json_extract(mvt.document, '$.amount') - IFNULL(SUM(json_extract(mvt2.document, '$.amount')), 0) AS exterieur
- FROM !table AS mvt
- LEFT JOIN !table AS link ON mvt.key = json_extract(link.document, '$.temp_key')
- LEFT JOIN !table AS mvt2 ON mvt2.key = json_extract(link.document, '$.return')
+ FROM {!$module.table} AS mvt
+ LEFT JOIN {!$module.table} AS link ON mvt.key = json_extract(link.document, '$.temp_key')
+ LEFT JOIN {!$module.table} AS mvt2 ON mvt2.key = json_extract(link.document, '$.return')
WHERE
json_extract(mvt.document, '$.operation') IN !op
AND mvt.key = :mvt_key
GROUP by mvt.key
;
- !table=$module.table
!op = $operations
:mvt_key = $_GET.key
}}
@@ -214,7 +211,7 @@