diff --git a/archives.html b/archives.html index 261673c..087ac1c 100644 --- a/archives.html +++ b/archives.html @@ -1,7 +1,5 @@ {{* -*- brindille -*- *}} -{{#restrict block=true section="accounting" level="write"}}{{/restrict}} - {{:admin_header title="Matériels archivés" current="module_equipment"}} {{:include file="_nav.html" current="archives"}} @@ -29,10 +27,6 @@ }} -
-

Matériels qui ne sont plus dans l'association

-
- {{* filtrer selon la catégorie *}} {{if $_GET.cat_key == null}} {{:assign condition="1"}} diff --git a/categories/add_category.html b/categories/add_category.html index 0fe45c8..20691ae 100644 --- a/categories/add_category.html +++ b/categories/add_category.html @@ -1,6 +1,9 @@ {{* -*- brindille -*- *}} -{{#restrict block=true section="accounting" level="write"}}{{/restrict}} +{{* barre de navigation *}} +{{if ! $dialog}} + {{:include file="../_nav.html" current="config" subcurrent="categories"}} +{{/if}} {{* Traiter l'envoi du formulaire *}} {{#form on="save"}} @@ -22,11 +25,6 @@ {{/form}} {{:admin_header title="Gestion des matériels" current="module_equipment"}} -{{* barre de navigation *}} -{{if ! $dialog}} - {{:include file="../_nav.html" current="config" subcurrent="categories"}} -{{/if}} - {{:form_errors}} {{* formulaire d'ajout de catégorie *}} diff --git a/categories/delete_category.html b/categories/delete_category.html index 7838f41..7430344 100644 --- a/categories/delete_category.html +++ b/categories/delete_category.html @@ -1,7 +1,5 @@ {{* -*- brindille -*- *}} -{{#restrict block=true section="accounting" level="write"}}{{/restrict}} - {{#load key=$_GET.key assign="category"}} {{else}} {{:error message="Catégorie introuvable"}} diff --git a/categories/index.html b/categories/index.html index d021953..0eb43d0 100644 --- a/categories/index.html +++ b/categories/index.html @@ -1,7 +1,5 @@ {{* -*- brindille -*- *}} -{{#restrict block=true section="accounting" level="write"}}{{/restrict}} - {{:admin_header title="Configuration" current="module_equipment"}} {{* barre de navigation *}} diff --git a/categories/modify_category.html b/categories/modify_category.html index 0819a78..9d2d315 100644 --- a/categories/modify_category.html +++ b/categories/modify_category.html @@ -1,7 +1,5 @@ {{* -*- brindille -*- *}} -{{#restrict block=true section="accounting" level="write"}}{{/restrict}} - {{#load key=$_GET.key assign="category"}} {{else}} {{:error message="Catégorie introuvable"}} diff --git a/config.html b/config.html index 9927c5e..d7661ab 100644 --- a/config.html +++ b/config.html @@ -1,7 +1,5 @@ {{* -*- brindille -*- *}} -{{#restrict block=true section="accounting" level="write"}}{{/restrict}} - {{:admin_header title="Configuration" current="module_equipment"}} {{* barre de navigation *}} diff --git a/config/add_movement_type.html b/config/add_movement_type.html index 06881dc..226311f 100644 --- a/config/add_movement_type.html +++ b/config/add_movement_type.html @@ -1,12 +1,15 @@ {{* -*- brindille -*- *}} -{{#restrict block=true section="accounting" level="write"}}{{/restrict}} - {{* paramètres : - dir : input ou output *}} +{{* barre de navigation *}} +{{if ! $dialog}} + {{:include file="../_nav.html" current="config" subcurrent="typesES"}} +{{/if}} + {{* Traiter l'envoi du formulaire *}} {{* lecture config *}} @@ -48,11 +51,6 @@ {{/form}} {{:admin_header title="Gestion des matériels" current="module_equipment"}} -{{* barre de navigation *}} -{{if ! $dialog}} - {{:include file="../_nav.html" current="config" subcurrent="typesES"}} -{{/if}} - {{:form_errors}} {{if $_GET.dir == 'input'}} diff --git a/config/delete_movement_type.html b/config/delete_movement_type.html index 4f0ddaa..9e889ab 100644 --- a/config/delete_movement_type.html +++ b/config/delete_movement_type.html @@ -1,13 +1,15 @@ {{* -*- brindille -*- *}} -{{#restrict block=true section="accounting" level="write"}}{{/restrict}} - {{* paramètres : - dir : input ou output - op_key : clé du type de mouvement à supprimer *}} +{{* barre de navigation *}} +{{if ! $dialog}} + {{:include file="../_nav.html" current="config" subcurrent="typesES"}} +{{/if}} {{* lecture config (défaut ou enregistrée) *}} {{:include file="../_get_config.html" keep="config, directions"}} @@ -35,10 +37,6 @@ {{/form}} {{:admin_header title="Gestion des matériels" current="module_equipment"}} -{{* barre de navigation *}} -{{if ! $dialog}} - {{:include file="../_nav.html" current="config" subcurrent="typesES"}} -{{/if}} {{:form_errors}} {{:assign var="mvt_label" from="config.%s_nature.%s.label"|args:$_GET.dir:$_GET.op_key}} diff --git a/config/misc.html b/config/misc.html deleted file mode 100644 index d49ef65..0000000 --- a/config/misc.html +++ /dev/null @@ -1,36 +0,0 @@ -{{* -*- brindille -*- *}} - -{{#restrict block=true section="accounting" level="write"}}{{/restrict}} - -{{:admin_header title="Configuration" current="module_equipment"}} - -{{#form on="save"}} - {{:save - key="config" - loan_duration=$_POST.loan_duration - }} -{{/form}} - -{{* barre de navigation *}} -{{:include file="../_nav.html" current="config" subcurrent="divers"}} - -{{if $_GET.ok}} -

Configuration enregistrée.

-{{/if}} - -{{* lecture config (défaut ou enregistrée) *}} -{{:include file="../_get_config.html" keep="loan_duration"}} - -
-
- Autres paramètres -
- {{:input type="number" name="loan_duration" label="Durée de prêt par défaut" min=1 required=true default=$loan_duration help="Durée en nombre de jours"}} - -
-
-

- {{:button type="submit" name="save" label="Enregistrer" shape="right" class="main"}} -

-
-{{:admin_footer}} diff --git a/config/modify_movement_type.html b/config/modify_movement_type.html index 89d9970..b5210c3 100644 --- a/config/modify_movement_type.html +++ b/config/modify_movement_type.html @@ -1,13 +1,16 @@ {{* -*- brindille -*- *}} -{{#restrict block=true section="accounting" level="write"}}{{/restrict}} - {{* paramètres : - dir : input ou output - op_key : clé du type de mouvement dont on veut modifier le libellé *}} +{{* barre de navigation *}} +{{if ! $dialog}} + {{:include file="../_nav.html" current="config" subcurrent="typesES"}} +{{/if}} + {{* lecture config (défaut ou enregistrée) *}} {{:include file="../_get_config.html" keep="config, directions"}} @@ -40,12 +43,7 @@ {{/form}} {{:admin_header title="Gestion des matériels" current="module_equipment"}} -{{* barre de navigation *}} -{{if ! $dialog}} - {{:include file="../_nav.html" current="config" subcurrent="typesES"}} -{{/if}} {{:form_errors}} - {{:assign var="default_label" from="config.%s_nature.%s.label"|args:$_GET.dir:$_GET.op_key}}
diff --git a/equipment_history.html b/equipment_history.html index 786adbe..9bb584d 100644 --- a/equipment_history.html +++ b/equipment_history.html @@ -1,7 +1,5 @@ {{* -*- brindille -*- *}} -{{#restrict block=true section="accounting" level="write"}}{{/restrict}} - {{* Afficher l'historique des mouvements d'un matériel paramètres @@ -226,7 +224,7 @@ {{/if}} {{:linkbutton label="Détails" - href="movements/movement_details.html?key=%s&prop=%s&from=eh"|args:$key:$_GET.prop + href="movements/movement_details.html?key=%s&prop=%s"|args:$key:$_GET.prop shape="eye" }} {{/if}} @@ -316,7 +314,7 @@ {{/if}} {{:linkbutton label="Détails" - href="movements/movement_details.html?key=%s&prop=%s&from=eh"|args:$key:$_GET.prop + href="movements/movement_details.html?key=%s&prop=%s"|args:$key:$_GET.prop shape="eye" }} diff --git a/global_history.html b/global_history.html index 81e576b..5eb69c1 100644 --- a/global_history.html +++ b/global_history.html @@ -1,7 +1,5 @@ {{* -*- brindille -*- *}} -{{#restrict block=true section="accounting" level="write"}}{{/restrict}} - {{* Afficher l'historique de tous les mouvements *}} @@ -34,10 +32,6 @@ }}
-
-

Historique de tous les mouvements de matériel

-
- {{* condition de filtrage *}} {{if $_GET.cat_key != null}} {{:assign condition="(SELECT key diff --git a/index.html b/index.html index dce00cb..92538c8 100644 --- a/index.html +++ b/index.html @@ -1,51 +1,39 @@ {{* -*- brindille -*- *}} -{{#restrict section="accounting" level="write"}} - {{:assign is_admin=true}} -{{else}} - {{:assign is_admin=false}} -{{/restrict}} - {{:admin_header title="Gestion des matériels" custom_css="./style.css" current="module_equipment"}} -{{if ! $is_admin}} - {{:assign var="user.id" value=$logged_user.id}} - {{:include file="snippets/my_details.html"}} +{{* barre de navigation *}} +{{if $_GET.prop == null || $_GET.prop}} + {{:assign proprio="proprio"}} {{else}} - {{#restrict block=true section="accounting" level="write"}}{{/restrict}} - - {{if $_GET.prop == null || $_GET.prop}} - {{:assign proprio="proprio"}} - {{else}} - {{:assign proprio="nonproprio"}} - {{/if}} - - {{#load type="category" count=true assign="result"}}{{/load}} - {{:include file="_nav.html" current="inventaire" cat="%d"|args:$result.count subcurrent="%s"|args:$proprio}} - - {{if $_GET.ok}} - {{if $_GET.msg == "ajout" }} -

Ajout effectué

- {{elseif $_GET.msg == "modification" }} -

Modification effectuée

- {{elseif $_GET.msg == "suppression" }} -

Suppression effectuée

- {{elseif $_GET.msg == "supprmvtmat" }} -

Mouvement supprimé - Matériel supprimé

- {{/if}} - {{elseif $_GET.err}} -

Modification refusée

- {{/if}} - - {{if $result.count == 0}} -

Il n'y a aucune catégorie : vous devez en ajouter.

- {{else}} - {{if $_GET.prop == null || $_GET.prop == "1"}} - {{:include file="./_inventory.html"}} - {{else}} - {{:include file="./_temp_inventory.html"}} - {{/if}} - {{/if}} - - {{:admin_footer}} + {{:assign proprio="nonproprio"}} {{/if}} + +{{#load type="category" count=true assign="result"}}{{/load}} +{{:include file="_nav.html" current="inventaire" cat="%d"|args:$result.count subcurrent="%s"|args:$proprio}} + +{{if $_GET.ok}} + {{if $_GET.msg == "ajout" }} +

Ajout effectué

+ {{elseif $_GET.msg == "modification" }} +

Modification effectuée

+ {{elseif $_GET.msg == "suppression" }} +

Suppression effectuée

+ {{elseif $_GET.msg == "supprmvtmat" }} +

Mouvement supprimé - Matériel supprimé

+ {{/if}} +{{elseif $_GET.err}} +

Modification refusée

+{{/if}} + +{{if $result.count == 0}} +

Il n'y a aucune catégorie : vous devez en ajouter.

+{{else}} + {{if $_GET.prop == null || $_GET.prop == "1"}} + {{:include file="./_inventory.html"}} + {{else}} + {{:include file="./_temp_inventory.html"}} + {{/if}} +{{/if}} + +{{:admin_footer}} diff --git a/loan_history.html b/loan_history.html index 997ffa4..28a246c 100644 --- a/loan_history.html +++ b/loan_history.html @@ -1,40 +1,8 @@ {{* -*- brindille -*- *}} -{{#restrict block=true section="accounting" level="write"}}{{/restrict}} - {{:admin_header title="Matériels hors de l'asso" custom_css="../style.css" current="module_equipment"}} {{:include file="./_nav.html" current="historique" subcurrent="prêts"}} -{{* - vérifier l'existence de la table du module - eh oui, il se peut qu'elle ne soit pas encore créée si aucune donnée n'a été ajoutée dedans -*}} - -{{#load limit="1"}} - {{:assign table_presente=true}} -{{else}} - {{:assign table_presente=false}} -{{/load}} - -{{if $table_presente}} -{{if $_GET.ok}} - {{if $_GET.msg == "modification"}} -

Modification enregistrée

- {{elseif $_GET.msg == "copie"}} -

Mouvement copié

- {{elseif $_GET.msg == "suppression"}} -

Mouvement supprimé

- {{/if}} -{{elseif $_GET.err}} - {{if $_GET.msg == "suppression"}} -

Ce mouvement ne peut être supprimé

- {{/if}} -{{/if}} - -
-

Historique des prêts de matériel

-
- {{* lecture config (défaut ou enregistrée) *}} {{:include file="./_get_config.html" keep="config"}} @@ -56,11 +24,11 @@ json_extract(mvt.document, '$.amount') AS out_amount, json_extract(mvt.document, '$.return_date') AS return_date, json_extract(mvt.document, '$.amount') - IFNULL(SUM(json_extract(retour.document, '$.amount')), 0) AS remain - FROM {!$module.table} AS mvt - LEFT JOIN users ON json_extract(mvt.document, '$.user') = users.id - LEFT JOIN {!$module.table} AS links ON mvt.key = json_extract(links.document, '$.temp_key') - LEFT JOIN {!$module.table} AS retour ON retour.key = json_extract(links.document, '$.return') - INNER JOIN {!$module.table} AS mat ON mat.key = json_extract(mvt.document, '$.equipment') + FROM module_data_equipment AS mvt + INNER JOIN users ON json_extract(mvt.document, '$.user') = users.id + LEFT JOIN module_data_equipment AS links ON mvt.key = json_extract(links.document, '$.temp_key') + LEFT JOIN module_data_equipment AS retour ON retour.key = json_extract(links.document, '$.return') + INNER JOIN module_data_equipment AS mat ON mat.key = json_extract(mvt.document, '$.equipment') WHERE json_extract(mvt.document, '$.type') = 'movement' AND @@ -76,7 +44,7 @@ Matériel - Date prêt + Date sortie Quantité Membre Date retour @@ -102,30 +70,22 @@ {{$remain}} {{if $return_date != null}} - {{:assign jour="jour}} - {{if $nb_jours > 0}} - {{if $nb_jours > 1}}{{:assign jour="jours"}}{{/if}} - {{:tag color="darkred" label="Retard %s %s"|args:$nb_jours:$jour}} - {{elseif $nb_jours < 0}} - {{:assign delai="abs(%d)"|math:$nb_jours}} - {{if $nb_jours < -1}}{{:assign jour="jours"}}{{/if}} - {{"Reste %s %s"|args:$delai:$jour}} - {{else}} - {{:tag color="darkgreen" label="À rendre aujourd'hui"}} - {{/if}} + {{if $nb_jours > 0}} + {{:tag color="darkred" label="Retard %s jours"|args:$nb_jours}} + {{elseif $nb_jours < 0}} + {{:assign delai="abs(%d)"|math:$nb_jours}} + {{"Reste %s jours"|args:$delai}} + {{else}} + {{:tag color="darkgreen" label="À rendre aujourdh'ui"}} + {{/if}} {{/if}} - + {{:linkbutton label="Retour" href="movements/output_return.html?key=%s&prop=1"|args:$mvt_key shape="reset" target="_dialog"}} - {{:linkbutton - label="Détails" - href="movements/movement_details.html?key=%s&prop=1&from=lh"|args:$mvt_key - shape="eye" - }} {{else}} @@ -133,8 +93,5 @@ {{/select}} -{{else}} -

Aucun mouvement.

-{{/if}} {{:admin_footer}} diff --git a/member_history.html b/member_history.html deleted file mode 100644 index bf44103..0000000 --- a/member_history.html +++ /dev/null @@ -1,126 +0,0 @@ -{{* -*- brindille -*- *}} - -{{* - Afficher l'historique des mouvements d'un matériel pour un membre - paramètres - - key : clé du matériel - - id : id du membre -*}} - -{{#restrict}}{{/restrict}} - -{{:admin_header title="Historique membre" custom_css="./style.css" current="module_equipment"}} - -{{* lecture config (défaut ou enregistrée) *}} -{{:include file="./_get_config.html" keep="config, directions"}} - -{{#foreach from=$directions key="direction"}} - {{:assign var="nature" from="config.%s_nature"|args:$direction}} - {{#foreach from=$nature key=key}} - {{:assign var="types.%s.%s."|args:$direction:$type value=$key|quote_sql}} - {{/foreach}} - {{:assign var="io_types" from="types.%s"|args:$direction}} - {{#foreach from=$io_types key=key}} - {{:assign var=elem from="io_types.%s"|args:$key}} - {{:assign elem=$elem|implode:","}} - {{:assign elem="("|cat:$elem|cat:")"}} - {{:assign var="%s_types.%s"|args:$direction:$key value=$elem}} - {{/foreach}} -{{/foreach}} - -{{#users id=$_GET.id}} - {{:assign user_name=$nom}} -{{else}} - {{:error message="Il n'existe aucun membre avec l'identifiant %s !"|args:$_GET.id}} -{{/users}} - -{{#load key=$_GET.key|trim}} - {{:assign eqpmt_name=$name}} -{{else}} - {{:error message="Il n'existe aucun matériel avec la clé %s !"|args:$_GET.key|trim}} -{{/load}} - -

Historique des mouvements de « {{$eqpmt_name}} » du membre « {{$user_name}} »

- -{{:assign otk=null}} -{{#select - mvt.key AS mvt_key, - json_extract(mvt.document, '$.direction') as direction, - json_extract(mvt.document, '$.operation') as operation, - json_extract(mvt.document, '$.date') as date, - json_extract(mvt.document, '$.amount') as amount, - COALESCE((SELECT - json_extract(links.document, '$.temp_key') - FROM {!$module.table} AS links - WHERE json_extract(links.document, '$.temp_key') = mvt.key - OR json_extract(links.document, '$.return') = mvt.key), mvt.key) - AS out_temp_key - FROM {!$module.table} AS mvt - INNER JOIN users ON json_extract(mvt.document, '$.user') = users.id - INNER JOIN {!$module.table} AS eqpmt - ON json_extract(mvt.document, '$.equipment') = eqpmt.key - WHERE users.id = :user - AND eqpmt.key = :eqpmt_key - AND (json_extract(mvt.document, '$.operation') IN !output_types - OR json_extract(mvt.document, '$.operation') IN !input_types) - ORDER BY out_temp_key, date - ; - :user = $_GET.id - :eqpmt_key = $_GET.key|trim - !output_types=$output_types.temporaire - !input_types=$input_types.retour -}} - - {{:assign var="type_mvt" from="config.%s_nature.%s.type"|args:$direction:$operation}} - {{:assign var="op_label" from="config.%s_nature.%s.label"|args:$direction:$operation}} - {{:assign var="total" from="reste.%s"|args:$out_temp_key}} - {{if $total == null}} - {{:assign total=0}} - {{/if}} - - {{if $otk != null && $otk != $out_temp_key}} - - - {{/if}} - {{if $otk == null || $otk != $out_temp_key}} - - - - - - - - - - - - {{:assign otk=$out_temp_key}} - {{/if}} - - {{if $direction == 'input' && $type_mvt == 'retour'}} - {{:assign var="reste.%s"|args:$out_temp_key value="%d-%d"|math:$total:$amount}} - {{elseif $direction == 'output' && $type_mvt == 'temporaire'}} - {{:assign var="reste.%s"|args:$out_temp_key value="%d+%d"|math:$total:$amount}} - {{/if}} - {{:assign var="total" from="reste.%s"|args:$out_temp_key}} - - - - - - - - -{{/select}} - -
DateOpérationQuantitéTotal
{{$date|date_short}}{{$op_label}}{{$amount}}{{$total}} - {{#restrict section="accounting" level="write"}} - {{if $direction == "output" && $type_mvt == "temporaire"}} - {{:linkbutton - label="Retour" - href="%smovements/output_return.html?key=%s&prop=0&user=%s"|args:$module.url:$mvt_key:$_GET.id - shape="history" - target="_dialog"}} - {{/if}} - {{/restrict}} -
diff --git a/modify_equipment.html b/modify_equipment.html index 6236ef7..d36c78b 100644 --- a/modify_equipment.html +++ b/modify_equipment.html @@ -1,7 +1,5 @@ {{* -*- brindille -*- *}} -{{#restrict block=true section="accounting" level="write"}}{{/restrict}} - {{* Paramètres : - key : clé du matériel à modifier diff --git a/module.ini b/module.ini index 51afae3..28ffd9e 100644 --- a/module.ini +++ b/module.ini @@ -4,5 +4,5 @@ author="Jean-Christophe Engel" author_url="https://gitea.zaclys.com/lesanges" home_button=true menu=true -restrict_details="Les membres connectés peuvent consulter l'historique de leurs prêts ; les membres ayant accès en lecture aux membres peuvent consulter l'historique des prêts des autres membres ; seuls les membres ayant accès en écriture à la comptabilité peuvent utiliser l'ensemble des fonctionnalités du module." -allow_user_restrict=false +restrict_section="accounting" +restrict_level="write" diff --git a/movements/add_new_equipment.html b/movements/add_new_equipment.html index 74a5f67..af91337 100644 --- a/movements/add_new_equipment.html +++ b/movements/add_new_equipment.html @@ -1,6 +1,9 @@ {{* -*- brindille -*- *}} -{{#restrict block=true section="accounting" level="write"}}{{/restrict}} +{{* barre de navigation *}} +{{if ! $dialog}} + {{:include file="../_nav.html" current="entrees"}} +{{/if}} {{* récupérer la config des entrées/sorties *}} {{:include file="../_get_config.html" keep="config"}} @@ -117,10 +120,6 @@ {{/form}} {{:admin_header title="Entrée de matériel" current="module_equipment"}} -{{* barre de navigation *}} -{{if ! $dialog}} - {{:include file="../_nav.html" current="entrees"}} -{{/if}} {{:form_errors}} {{if $categories != null}} diff --git a/movements/copy_movement.html b/movements/copy_movement.html index 84c0e2e..29539ea 100644 --- a/movements/copy_movement.html +++ b/movements/copy_movement.html @@ -1,7 +1,5 @@ {{* -*- brindille -*- *}} -{{#restrict block=true section="accounting" level="write"}}{{/restrict}} - {{* Dupliquer un mouvement paramètres : @@ -207,12 +205,7 @@ transactions=$transactions return_date=$return_date|parse_date }} - {{if $_GET.from == "lh"}} - {{:assign from="../loan_history.html"}} - {{else}} - {{:assign from="../equipment_history.html"}} - {{/if}} - {{:redirect force="%s?ok=1&key=%s&prop=%s&msg=copie"|args:$from:$eqpmt_key:$prop}} + {{:redirect force="../equipment_history.html?ok=1&key=%s&prop=%s&msg=copie"|args:$eqpmt_key:$prop}} {{/form}} {{if $mvt_new.direction == "input"}} @@ -280,9 +273,9 @@ {{/if}} {{if $mvt_new.direction == "input"}} {{:input type="select" name="storage" default=$mvt_new.storage label="Lieu de stockage" default_empty="— Aucun —" options=$storage required=false}} - {{/if}} - {{if $type_mvt != "retour"}} - {{:input type="list" name="transactions" label="Écritures liées" target="!acc/transactions/selector.php" multiple=true help="par exemple écriture avec facture"}} + {{if $type_mvt != "retour"}} + {{:input type="list" name="transactions" label="Écritures liées" target="!acc/transactions/selector.php" multiple=true help="par exemple écriture avec facture"}} + {{/if}} {{/if}} {{:input type="textarea" name="comment" label="Remarques" cols="40", rows="3" required=false default=$mvt_new.comment}} {{if $mvt_new.direction == "output" && $type_mvt == "temporaire"}} @@ -299,7 +292,6 @@ {{:input id="set_return_date" type="checkbox" value=1 name="set_return_date" label="Fixer une date de retour" help="Cocher pour fixer une date de retour" checked="%s"|args:$checked}}
{{:input type="date" name="return_date" label="Date de retour" default=$return_date}} -
{{/if}} @@ -319,13 +311,7 @@ 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 () { document.getElementById('f_set_return_date_1').onclick = changeVisibility; - document.getElementById('f_date').onchange = changeReturnDate; })(); diff --git a/movements/delete_movement.html b/movements/delete_movement.html index 506ebe4..aea6243 100644 --- a/movements/delete_movement.html +++ b/movements/delete_movement.html @@ -1,6 +1,4 @@ -{{* -*- brindille -*- *}} - -{{#restrict block=true section="accounting" level="write"}}{{/restrict}} +{{* -*- brindille -*-}} {{* paramètres GET : @@ -23,11 +21,6 @@ {{:include file="../_get_config.html" keep="config"}} {{#form on="delete"}} - {{if $_GET.from == "lh"}} - {{:assign from="../loan_history.html"}} - {{else}} - {{:assign from="../equipment_history.html"}} - {{/if}} {{* vérifier s'il est possible de supprimer le mouvement *}} {{if $mvt_suppr.direction == 'input'}} {{:assign var="type_operation" from="config.input_nature.%s.type"|args:$mvt_suppr.operation}} @@ -36,7 +29,7 @@ {{:assign link_key=$key}} {{/load}} {{if $link_key != null}} - {{:redirect force="%s?key=%s&prop=%s&err=1&msg=suppression"|args:$from:$mvt_suppr.equipment:$_GET.prop}} + {{:redirect force="../equipment_history.html?key=%s&prop=%s&err=1&msg=suppression"|args:$mvt_suppr.equipment:$_GET.prop}} {{/if}} {{else}} {{:assign dispo=0}} @@ -69,7 +62,7 @@ {{* problème ? *}} {{if $dispo < 0 || $nonprop < 0}} - {{:redirect force="%s?key=%s&prop=%s&err=1&msg=suppression"|args:$from:$mvt_suppr.equipment:$_GET.prop}} + {{:redirect force="../equipment_history.html?key=%s&prop=%s&err=1&msg=suppression"|args:$mvt_suppr.equipment:$_GET.prop}} {{/if}} {{/if}} {{/load}} @@ -90,7 +83,7 @@ {{:assign link_key=$key}} {{/load}} {{if $link_key != null}} - {{:redirect force="%s?key=%s&prop=%s&err=1&msg=suppression"|args:$from:$mvt_suppr.equipment:$_GET.prop}} + {{:redirect force="../equipment_history.html?key=%s&prop=%s&err=1&msg=suppression"|args:$mvt_suppr.equipment:$_GET.prop}} {{/if}} {{elseif $type_operation == 'retour'}} {{#load type="link" where="$$.return = :key" :key=$_GET.key}} @@ -155,7 +148,7 @@ out=$curr_eqpmt.out notowned=$curr_eqpmt.notowned }} - {{:redirect force="%s?ok=1&key=%s&prop=%s&msg=suppression"|args:$from:$mvt_suppr.equipment:$_GET.prop}} + {{:redirect force="../equipment_history.html?ok=1&key=%s&prop=%s&msg=suppression"|args:$mvt_suppr.equipment:$_GET.prop}} {{else}} {{* supprimer le matériel *}} {{:delete key=$curr_eqpmt.key}} diff --git a/movements/input_equipment.html b/movements/input_equipment.html index 1f687bf..deff4cc 100644 --- a/movements/input_equipment.html +++ b/movements/input_equipment.html @@ -1,7 +1,5 @@ {{* -*- brindille -*- *}} -{{#restrict block=true section="accounting" level="write"}}{{/restrict}} - {{* Enregistrer une entrée de matériel paramètres : @@ -44,7 +42,7 @@ {{:assign var="equipment.notowned" value="%d+%d"|math:$equipment.notowned:$_POST.amount|intval}} {{/if}} - {{* écritures liées *}} + {{* documents liés *}} {{#foreach from=$_POST.transactions item="value"}} {{:assign var="transactions." value=$value|intval}} {{/foreach}} @@ -107,9 +105,9 @@ Informations obligatoires
{{if $input_labels|count == 1}} - {{:input type="select" name="operation" label="Type d'entrée" required=true options=$input_labels}} + {{:input type="select" name="operation" label="Type" required=true options=$input_labels}} {{else}} - {{:input type="select" name="operation" label="Type d'entrée" required=true default_empty="— Aucun —" options=$input_labels|sort}} + {{:input type="select" name="operation" label="Type" required=true default_empty="— Aucun —" options=$input_labels|sort}} {{/if}} {{:input type="date" name="date" label="Date" required=true default=$now|date_short}} {{:input type="number" name="amount" label="Quantité" required=true min=1 default=1}} diff --git a/movements/input_return.html b/movements/input_return.html index c4601b3..4683205 100644 --- a/movements/input_return.html +++ b/movements/input_return.html @@ -1,7 +1,5 @@ {{* -*- brindille -*- *}} -{{#restrict block=true section="accounting" level="write"}}{{/restrict}} - {{* Enregistrer un retour d'entrée temporaire paramètres : @@ -203,7 +201,7 @@
Retour de matériel
- {{:input type="select" name="operation" label="Type de mouvement" required=true options=$return_label}} + {{:input type="select" name="operation" label="Type" required=true options=$return_label}} {{:input type="date" name="date" label="Date" required=true default=$now|date_short}} {{:input type="number" name="amount" label="Quantité" min=1 max=$present required=true default=1}} {{:input type="textarea" name="comment" label="Remarques" cols="40", rows="3" required=false}} diff --git a/movements/modify_movement.html b/movements/modify_movement.html index 542267f..2139e4d 100644 --- a/movements/modify_movement.html +++ b/movements/modify_movement.html @@ -1,7 +1,5 @@ {{* -*- brindille -*- *}} -{{#restrict block=true section="accounting" level="write"}}{{/restrict}} - {{* Modifier un mouvement paramètres : @@ -204,7 +202,7 @@ {{* enregistrer le mouvement modifié *}} {{if $user == null}} - {{:assign user_id=null}} + {{:assign user_id=$mvt_new.user}} {{else}} {{:assign user_id=$user.id}} {{/if}} @@ -224,12 +222,7 @@ transactions=$transactions return_date=$return_date|parse_date }} - {{if $_GET.from == "lh"}} - {{:assign from="../loan_history.html"}} - {{else}} - {{:assign from="../equipment_history.html"}} - {{/if}} - {{:redirect force="%s?ok=1&key=%s&prop=%s&msg=modification"|args:$from:$eqpmt_key:$prop}} + {{:redirect force="../equipment_history.html?ok=1&key=%s&prop=%s&msg=modification"|args:$eqpmt_key:$prop}} {{/form}} {{if $mvt_new.direction == "input"}} @@ -238,8 +231,8 @@ {{:assign mvt_label="sortie"}} {{/if}} {{:admin_header title="Modifier une %s"|args:$mvt_label custom_css="./../style.css" current="module_equipment"}} - {{:form_errors}} + {{* -------------------- Préparer la saisie -------------------- *}} @@ -306,9 +299,9 @@ {{if $storage != null}} {{:input type="select" name="storage" label="Lieu de stockage" default=$mvt_new.storage default_empty="— Aucun —" options=$storage required=false}} {{/if}} - {{/if}} - {{if $type_mvt != "retour"}} - {{:input type="list" name="transactions" default=$mvt_new.transactions label="Écritures liées" target="!acc/transactions/selector.php" multiple=true help="par exemple écriture avec facture"}} + {{if $type_mvt != "retour"}} + {{:input type="list" name="transactions" default=$mvt_new.transactions label="Écritures liées" target="!acc/transactions/selector.php" multiple=true help="par exemple écriture avec facture"}} + {{/if}} {{/if}} {{:input type="textarea" name="comment" label="Remarques" cols="40", rows="3" required=false default=$mvt_new.comment}} {{if $mvt_new.direction == "output" && $type_mvt == "temporaire"}} @@ -345,9 +338,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/movement_details.html b/movements/movement_details.html index ac2bb5a..f25fca7 100644 --- a/movements/movement_details.html +++ b/movements/movement_details.html @@ -1,7 +1,5 @@ {{* -*- brindille -*- *}} -{{#restrict block=true section="accounting" level="write"}}{{/restrict}} - {{* Afficher les détails d'un mouvement et donner la possibilité : - d'associer des fichiers @@ -44,18 +42,18 @@
diff --git a/movements/output_equipment.html b/movements/output_equipment.html index 95ac3cd..d211cb3 100644 --- a/movements/output_equipment.html +++ b/movements/output_equipment.html @@ -1,7 +1,5 @@ {{* -*- brindille -*- *}} -{{#restrict block=true section="accounting" level="write"}}{{/restrict}} - {{* paramètres : - key : clé du matériel à sortir @@ -128,11 +126,6 @@ {{:assign var="equipment.out" value="%d+%d"|math:$equipment.out:$_POST.amount|intval}} {{/if}} - {{* écritures liées *}} - {{#foreach from=$_POST.transactions item="value"}} - {{:assign var="transactions." value=$value|intval}} - {{/foreach}} - {{:save key=$equipment.key validate_schema="../equipment.schema.json" @@ -159,7 +152,6 @@ comment=$_POST.remarques|trim user=$user.id return_date=$return_date|parse_date - transactions=$transactions }} {{:redirect force="../equipment_history.html?ok=1&key=%s&prop=1&msg=sortie"|args:$_GET.key}} {{/form}} @@ -194,9 +186,9 @@ Informations obligatoires
{{if $output_labels|count == 1}} - {{:input type="select" name="operation" label="Type de sortie" required=true options=$output_labels}} + {{:input type="select" name="operation" label="Type" required=true options=$output_labels}} {{else}} - {{:input type="select" name="operation" label="Type de sortie" required=true default_empty="— Aucun —" options=$output_labels|sort}} + {{:input type="select" name="operation" label="Type" required=true default_empty="— Aucun —" options=$output_labels|sort}} {{/if}} {{:input type="date" name="date" label="Date de sortie" required=true default=$now|date_short}} {{:input type="number" name="amount" label="Quantité" required=true default=1 min=1 max=$dispo}} @@ -213,7 +205,6 @@ multiple=true max=1 }} - {{:input type="list" name="transactions" label="Écritures liées" target="!acc/transactions/selector.php" multiple=true help="par exemple écriture avec facture"}} {{:input type="textarea" name="remarques" label="Remarques" cols="40" rows="3" required=false}} {{:input id="set_return_date" type="checkbox" value=1 name="set_return_date" label="Fixer une date de retour" help="Cocher pour fixer une date de retour"}}