Bug corrections in index and install

This commit is contained in:
Phyks 2013-09-29 19:38:39 +02:00
parent 5dbc0606ca
commit 95d84c1a55
5 changed files with 7 additions and 6 deletions

1
TODO
View File

@ -1,4 +1,3 @@
* Check database creation in install.php
* Don't display the whole balance table if not admin
* Notifications by e-mail for users

View File

@ -11,7 +11,7 @@
'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.'),
'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.'),
'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.'),
'email_invalid'=>array('fr'=>'L\'adresse e-mail est invalide.', 'en'=>'Incorrect e-mail address.')
);
@ -540,9 +540,9 @@
$tpl->assign('what_post', (!empty($what) ? htmlspecialchars($what) : ''));
$tpl->assign('users', secureDisplay($users_list));
if(empty($_POST['what']))
if(isset($_POST['what']) && empty($_POST['what']))
$tpl->assign('error', $errors['what_unknown'][LANG]);
if((float) $_POST['amount'] == 0)
if(!empty($_POST['amount']) && (float) $_POST['amount'] == 0)
$tpl->assign('error', $errors['incorrect_amount'][LANG]);
$tpl->assign('users_in', (!empty($users_in) ? $users_in : array()));

View File

@ -29,7 +29,7 @@
$db = new PDO('mysql:host='.$mysql_host.';dbname='.$mysql_db, $mysql_login, $mysql_password);
//Create table "Users"
$db->query('CREATE TABLE IF NOT EXISTS '.$mysql_prefix.'Users (id INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, login VARCHAR(255), display_name VARCHAR(255), password VARCHAR(130), admin TINYINT(1), json_token VARCHAR(32)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci');
$db->query('CREATE TABLE IF NOT EXISTS '.$mysql_prefix.'Users (id INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, login VARCHAR(255), email VARCHAR(255), display_name VARCHAR(255), password VARCHAR(130), admin TINYINT(1), json_token VARCHAR(32), notifications TINYINT(1)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci');
//Create table "Invoices"
$db->query('CREATE TABLE IF NOT EXISTS '.$mysql_prefix.'Invoices (id INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, date DATETIME, buyer INT(11), amount INT(11), what TEXT) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci');
@ -41,7 +41,7 @@
$db->query('CREATE TABLE IF NOT EXISTS '.$mysql_prefix.'Paybacks (id INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, date DATETIME, invoice_id INT(11), KEY invoice_id (invoice_id), amount INT(11), from_user INT(11), to_user INT(11)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci');
// Create table "GlobalPaybacks"
$db->query('CREATE TABLE IF NOT EXISTS '.$mysql_prefix.'GlobalPaybacks (id INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, date DATETIME) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci');
$db->query('CREATE TABLE IF NOT EXISTS '.$mysql_prefix.'GlobalPaybacks (id INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, date DATETIME, closed TINYINT(1)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci');
// Create table "Users_in_GlobalPaybacks"
$db->query('CREATE TABLE IF NOT EXISTS '.$mysql_prefix.'Users_in_GlobalPaybacks (global_payback_id INT(11) NOT NULL, KEY global_payback_id (global_payback_id), user1_id INT(11), user2_id INT(11), amount INT(11)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci');

View File

@ -116,6 +116,7 @@ input[type=submit] {
display: inline-block;
margin-left: 1em;
margin-right: 1em;
margin-bottom: 0.5em;
}
#notice {

View File

@ -116,6 +116,7 @@ input[type=submit] {
display: inline-block;
margin-left: 1em;
margin-right: 1em;
margin-bottom: 0.5em;
}
#notice {