diff --git a/TODO b/TODO index d1bd88d..239e9b5 100755 --- a/TODO +++ b/TODO @@ -1,3 +1,7 @@ +* Check database creation in install.php +* Don't display the whole balance table if not admin + + Improvements : ============== * User groups diff --git a/index.php b/index.php index 6e30e8c..90ce2c0 100644 --- a/index.php +++ b/index.php @@ -10,11 +10,9 @@ 'negative_amount'=>array('fr'=>'Montant négatif non autorisé.', 'en'=>'Negative amount not allowed.'), 'template_error'=>array('fr'=>'Template non disponible.', 'en'=>'Template not available.'), 'unauthorized'=>array('fr'=>'Vous n\'avez pas le droit de faire cette action.', 'en'=>'You are not authorized to do that.'), - 'no_users'=>array('fr'=>'Vous devez ajouter au moins un autre utilisateur.', 'en'=>'You must add at least one more user beside you.') - ); - - $localized = array( - 'guest'=>array('fr'=>'invité', 'en'=>'guest') + 'no_users'=>array('fr'=>'Vous devez ajouter au moins un autre utilisateur.', 'en'=>'You must add at least one more user beside you.'), + 'what_unknown,'=>array('fr'=>'Vous devez renseigner un objet pour la dépense.', 'en'=>'You must add something to describe this invoice in "what" field.'), + 'incorrect_amount'=>array('fr'=>'Montant incorrect ou nul.', 'en'=>'Incorrect amount or amount is zero.') ); // Include necessary files @@ -150,6 +148,8 @@ } $tpl->assign('connection', true); $tpl->assign('user_post', (!empty($_POST['login'])) ? htmlspecialchars($_POST['login']) : ''); + if(!empty($error)) + $tpl->assign('error', $error); $tpl->assign('token', generate_token('connection')); $tpl->draw('connection'); break; @@ -517,6 +517,12 @@ $tpl->assign('amount_post', (!empty($amount) ? (float) $amount : 0)); $tpl->assign('what_post', (!empty($what) ? htmlspecialchars($what) : '')); $tpl->assign('users', secureDisplay($users_list)); + + if(empty($_POST['what'])) + $tpl->assign('error', $errors['what_unknown'][LANG]); + if((float) $_POST['amount'] == 0) + $tpl->assign('error', $errors['incorrect_amount'][LANG]); + $tpl->assign('users_in', (!empty($users_in) ? $users_in : array())); $tpl->assign('id', (!empty($_GET['id']) ? (int) $_GET['id'] : 0)); $tpl->assign('token', generate_token('new_invoice')); diff --git a/tpl/default_en/css/style.css b/tpl/default_en/css/style.css index 1329c95..a6d6d2d 100644 --- a/tpl/default_en/css/style.css +++ b/tpl/default_en/css/style.css @@ -39,7 +39,7 @@ table { } table td, table th { - padding: 0.5em; + padding: 0.75em; border: 1px solid black; } @@ -135,6 +135,10 @@ input[type=submit] { text-align: center } +#connexion_form .label-block { + width: 150px; +} + #edit_password_form, #edit_user_form, #invoice_form, #notice_form, #global_payback_form { width: 67%; margin: auto; diff --git a/tpl/default_en/js/main.js b/tpl/default_en/js/main.js index cc4fb3c..1cbe41d 100644 --- a/tpl/default_en/js/main.js +++ b/tpl/default_en/js/main.js @@ -44,6 +44,26 @@ function toggle_password(id) { document.getElementById(id).type = 'password'; } +function payback_nobody() { + var users = document.getElementById('global_payback_form').getElementsByClassName("users_in"); + + for(var index = 0; index < users.length; index ++) { + users[index].checked = false; + } + + return false; +} + +function payback_everybody() { + var users = document.getElementById('global_payback_form').getElementsByClassName("users_in"); + + for(var index = 0; index < users.length; index ++) { + users[index].checked = true; + } + + return false; +} + $(document).ready(function() { $('#balance_table td, #global_paybacks_table td').hover(function() { $(this).closest('tr').find('td,th').addClass('highlight_td'); diff --git a/tpl/default_en/manage_paybacks.html b/tpl/default_en/manage_paybacks.html index f16ed44..d4be02b 100644 --- a/tpl/default_en/manage_paybacks.html +++ b/tpl/default_en/manage_paybacks.html @@ -31,9 +31,10 @@
Users to include {loop="$users"} - +
- {/loop} + {/loop}
+ Select : Nobody / Everybody

diff --git a/tpl/default_fr/css/style.css b/tpl/default_fr/css/style.css index 1329c95..a6d6d2d 100644 --- a/tpl/default_fr/css/style.css +++ b/tpl/default_fr/css/style.css @@ -39,7 +39,7 @@ table { } table td, table th { - padding: 0.5em; + padding: 0.75em; border: 1px solid black; } @@ -135,6 +135,10 @@ input[type=submit] { text-align: center } +#connexion_form .label-block { + width: 150px; +} + #edit_password_form, #edit_user_form, #invoice_form, #notice_form, #global_payback_form { width: 67%; margin: auto; diff --git a/tpl/default_fr/edit_users.html b/tpl/default_fr/edit_users.html index 908de54..39d5ed1 100644 --- a/tpl/default_fr/edit_users.html +++ b/tpl/default_fr/edit_users.html @@ -17,7 +17,7 @@ {$value->getId()} {$value->getLogin()} {$value->getDisplayName()} - {$value->getAdmin() ? "Yes" : "No"} + {$value->getAdmin() ? "Oui" : "Non"} Modifier {if condition="$value->getId() != $current_user->getId()"}Supprimer{/if} @@ -60,7 +60,7 @@

Afficher / Masquer

Afficher / Masquer

-

+

Votre jeton de connexion à l'API

diff --git a/tpl/default_fr/index.html b/tpl/default_fr/index.html index c82bb84..cce237f 100755 --- a/tpl/default_fr/index.html +++ b/tpl/default_fr/index.html @@ -58,9 +58,9 @@ {loop="$value->getUsersIn()->get()"} {$users[$key2]->getDisplayName()} {if condition="$value2 > 1"} - ({$value2} guests) + ({$value2} invités) {elseif condition="$value2 == 1"} - ({$value2} guest) + ({$value2} invité) {/if} {if condition="$value1->getBuyer() != $key2"} - diff --git a/tpl/default_fr/js/main.js b/tpl/default_fr/js/main.js index 1ae056d..dd84517 100644 --- a/tpl/default_fr/js/main.js +++ b/tpl/default_fr/js/main.js @@ -44,6 +44,26 @@ function toggle_password(id) { document.getElementById(id).type = 'password'; } +function payback_nobody() { + var users = document.getElementById('global_payback_form').getElementsByClassName("users_in"); + + for(var index = 0; index < users.length; index ++) { + users[index].checked = false; + } + + return false; +} + +function payback_everybody() { + var users = document.getElementById('global_payback_form').getElementsByClassName("users_in"); + + for(var index = 0; index < users.length; index ++) { + users[index].checked = true; + } + + return false; +} + $(document).ready(function() { $('#balance_table td, #global_paybacks_table td').hover(function() { $(this).closest('tr').find('td,th').addClass('highlight_td'); diff --git a/tpl/default_fr/manage_paybacks.html b/tpl/default_fr/manage_paybacks.html index 082cbb3..0200baa 100644 --- a/tpl/default_fr/manage_paybacks.html +++ b/tpl/default_fr/manage_paybacks.html @@ -31,9 +31,10 @@
Utilisateurs à inclure {loop="$users"} - +
- {/loop} + {/loop}
+ Sélectionner : Personne / Tout le monde