diff --git a/TODO b/TODO index 99affff..b79437c 100755 --- a/TODO +++ b/TODO @@ -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 diff --git a/index.php b/index.php index 41a03ad..e7ec1a7 100644 --- a/index.php +++ b/index.php @@ -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())); diff --git a/install.php b/install.php index 365a71d..351b9d9 100644 --- a/install.php +++ b/install.php @@ -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'); diff --git a/tpl/default_en/css/style.css b/tpl/default_en/css/style.css index a6d6d2d..5cfcb69 100644 --- a/tpl/default_en/css/style.css +++ b/tpl/default_en/css/style.css @@ -116,6 +116,7 @@ input[type=submit] { display: inline-block; margin-left: 1em; margin-right: 1em; + margin-bottom: 0.5em; } #notice { diff --git a/tpl/default_fr/css/style.css b/tpl/default_fr/css/style.css index a6d6d2d..5cfcb69 100644 --- a/tpl/default_fr/css/style.css +++ b/tpl/default_fr/css/style.css @@ -116,6 +116,7 @@ input[type=submit] { display: inline-block; margin-left: 1em; margin-right: 1em; + margin-bottom: 0.5em; } #notice {