Compare commits
2 Commits
f2a9cb6af6
...
72cd82d254
Author | SHA1 | Date | |
---|---|---|---|
72cd82d254 | |||
42d85fb528 |
@ -1,7 +1,13 @@
|
||||
{{* -*- brindille -*- *}}
|
||||
|
||||
<nav class="tabs">
|
||||
{{if $current == 'inventaire'}}
|
||||
<aside>
|
||||
{{:linkbutton label="Ajouter un nouveau matériel" shape="plus" href="mouvements/ajouter_entree.html" target="_dialog"}}
|
||||
{{if $cat == null || $cat == 0}}
|
||||
{{:linkbutton label="Ajouter une catégorie" shape="plus" href="categories/add_category.html" target="_dialog"}}
|
||||
{{else}}
|
||||
{{:linkbutton label="Ajouter un nouveau matériel" shape="plus" href="mouvements/ajouter_entree.html" target="_dialog"}}
|
||||
{{/if}}
|
||||
</aside>
|
||||
{{/if}}
|
||||
|
||||
|
@ -9,11 +9,8 @@
|
||||
{{#form on="save"}}
|
||||
|
||||
{{* Vérifier s'il existe déjà une catégorie avec le même nom *}}
|
||||
{{#load type="category"}}
|
||||
{{if $name|tolower == $_POST.name|trim|tolower}}
|
||||
{{:error message="Impossible d'ajouter la catégorie « %s » car elle existe déjà !"|args:$name|trim}}
|
||||
{{:break}}
|
||||
{{/if}}
|
||||
{{#load type="category" where="$$.name = :name COLLATE U_NOCASE" :name=$_POST.name|trim limit=1}}
|
||||
{{:error message="Impossible d'ajouter la catégorie « %s » car elle existe déjà !"|args:$name|trim}}
|
||||
{{/load}}
|
||||
|
||||
{{:assign key=""|uuid}}
|
||||
|
@ -8,11 +8,8 @@
|
||||
{{* Traiter l'envoi du formulaire *}}
|
||||
{{#form on="save"}}
|
||||
{{* Vérifier s'il existe déjà une catégorie avec le même nom *}}
|
||||
{{#load type="category"}}
|
||||
{{if $name|tolower == $_POST.name|trim|tolower && $key != $_GET.key}}
|
||||
{{:error message="Modification impossible car ce nom de catégorie (« %s ») existe déjà !"|args:$name|trim}}
|
||||
{{:break}}
|
||||
{{/if}}
|
||||
{{#load type="category" where="$$.name = :name" :name=$_POST.name|trim|tolower|ucfirst limit=1}}
|
||||
{{:error message="Modification impossible car ce nom de catégorie (« %s ») existe déjà !"|args:$name|trim}}
|
||||
{{/load}}
|
||||
|
||||
{{:save
|
||||
|
@ -8,7 +8,9 @@
|
||||
{{else}}
|
||||
{{:assign proprio="nonproprio"}}
|
||||
{{/if}}
|
||||
{{:include file="_nav.html" current="inventaire" subcurrent="%s"|args:$proprio}}
|
||||
|
||||
{{#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" }}
|
||||
@ -22,8 +24,6 @@
|
||||
<p class="block error">Modification refusée</p>
|
||||
{{/if}}
|
||||
|
||||
{{#load type="category" count=true assign="result"}}{{/load}}
|
||||
|
||||
{{if $result.count == 0}}
|
||||
<p class="block alert">Il n'y a aucune catégorie : vous devez en ajouter.</p>
|
||||
{{else}}
|
||||
|
@ -28,7 +28,7 @@
|
||||
{{#load key=$equipment_key}}
|
||||
{{if $designation|trim|tolower != $_POST.designation|trim|tolower}}
|
||||
{{* le nom change => vérifier l'existence d'un matériel du même nom *}}
|
||||
{{#load type="equipment" where="lower($$.designation) = :name" :name=$_POST.designation|trim|tolower}}
|
||||
{{#load type="equipment" where="$$.designation = :name" :name=$_POST.designation|trim|tolower|ucfirst limit=1}}
|
||||
{{:assign chgt_ok=false}}
|
||||
{{/load}}
|
||||
{{else}}
|
||||
@ -37,8 +37,8 @@
|
||||
{{/load}}
|
||||
|
||||
{{else}}
|
||||
{{* catégorie ne change pas => vérifier le nom*}}
|
||||
{{#load type="equipment" where="lower($$.designation) = :name" :name=$_POST.designation|trim|tolower}}
|
||||
{{* catégorie ne change pas => vérifier le nom *}}
|
||||
{{#load type="equipment" where="$$.designation = :name" :name=$_POST.designation|trim|tolower|ucfirst limit=1}}
|
||||
{{:assign chgt_ok=false}}
|
||||
{{/load}}
|
||||
{{/if}}
|
||||
@ -51,7 +51,7 @@
|
||||
{{:save
|
||||
key=$equipment_key
|
||||
category=$category.key
|
||||
designation=$_POST.designation|trim
|
||||
designation=$_POST.designation|trim|tolower|ucfirst
|
||||
}}
|
||||
{{:redirect force="index.html?ok=1&msg=modification&prop=%s"|args:$_GET.prop}}
|
||||
{{/form}}
|
||||
|
@ -32,13 +32,10 @@
|
||||
{{:assign post_mat=$_POST.designation|trim|tolower|ucfirst}}
|
||||
|
||||
{{* vérifier l'existence d'un matériel de même nom *}}
|
||||
{{#load type="equipment"}}
|
||||
{{if $_POST.designation|trim|tolower == $designation|tolower}}
|
||||
{{:assign equipment_key=$key}}
|
||||
{{:assign var=nom_cat from="categories.%s"|args:$category}}
|
||||
{{:assign present=true}}
|
||||
{{:break}}
|
||||
{{/if}}
|
||||
{{#load type="equipment" where="$$.designation = :name COLLATE U_NOCASE" :name=$_POST.designation|trim limit=1}}}}
|
||||
{{:assign equipment_key=$key}}
|
||||
{{:assign var=nom_cat from="categories.%s"|args:$category}}
|
||||
{{:assign present=true}}
|
||||
{{/load}}
|
||||
{{:assign var=post_cat from="categories.%s"|args:$_POST.category}}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user