Delete invoice ability. Need to think about storage system to finish invoice system...

This commit is contained in:
Phyks 2013-08-17 19:28:42 +02:00
parent 52f6b7fc52
commit 90d533dd1c
6 changed files with 33 additions and 8 deletions

10
TODO
View File

@ -3,10 +3,11 @@
* tokens + ban system * tokens + ban system
* remember me * remember me
* htmlspecialchars => on users objects * htmlspecialchars => on users objects
* handle negative amounts
* Refactor load method to avoir load_* methods !
install.php : install.php :
============= =============
* Link beside password field to toggle visible / not visible
* TRUNCATE before CREATE TABLE in install.php * TRUNCATE before CREATE TABLE in install.php
inc/Invoices.class.php : inc/Invoices.class.php :
@ -20,10 +21,11 @@ index.php?do=new_invoice :
========================== ==========================
* Improve date handling for form display * Improve date handling for form display
* Onchange not working as wanted * Onchange not working as wanted
* Handle date/months
index.php?do=settings : index.php?do=settings :
======================= =======================
* Prefill the timezone field * Prefill the timezone field
* Fill the fields with POST
* Handle checkboxes in PHP ? Manage paybacks :
* JavaScript to handle singular / plural + months =================

View File

@ -268,6 +268,17 @@
$tpl->draw('new_invoice'); $tpl->draw('new_invoice');
break; break;
case 'delete_invoice':
if(!empty($_GET['id'])) {
$invoice = new Invoice();
$invoice->setId($_GET['id']);
$invoice->delete();
header('location: index.php');
exit();
}
break;
default: default:
$users_list = new User(); $users_list = new User();
$users_list = $users_list->load_users(); $users_list = $users_list->load_users();

View File

@ -83,6 +83,7 @@
<meta charset="utf-8"> <meta charset="utf-8">
<title>Bouffe@Ulm - Installation</title> <title>Bouffe@Ulm - Installation</title>
<link rel="stylesheet" media="screen" type="text/css" href="tpl/css/style.css" /> <link rel="stylesheet" media="screen" type="text/css" href="tpl/css/style.css" />
<script type="text/javascript" src="tpl/js/main.js"></script>
</head> </head>
<body id="install"> <body id="install">
<h1 class="center">Bouffe@Ulm - Installation</h1> <h1 class="center">Bouffe@Ulm - Installation</h1>
@ -101,7 +102,7 @@
<p><label for="mysql_host">MySQL host : </label><input type="text" name="mysql_host" id="mysql_host" value="<?php echo (!empty($_POST['mysql_host'])) ? htmlspecialchars($_POST['mysql_host']) : 'localhost';?>"/></p> <p><label for="mysql_host">MySQL host : </label><input type="text" name="mysql_host" id="mysql_host" value="<?php echo (!empty($_POST['mysql_host'])) ? htmlspecialchars($_POST['mysql_host']) : 'localhost';?>"/></p>
<p><label for="mysql_login">MySQL login : </label><input type="text" name="mysql_login" id="mysql_login" value="<?php echo (!empty($_POST['mysql_login'])) ? htmlspecialchars($_POST['mysql_login']) : '';?>"/></p> <p><label for="mysql_login">MySQL login : </label><input type="text" name="mysql_login" id="mysql_login" value="<?php echo (!empty($_POST['mysql_login'])) ? htmlspecialchars($_POST['mysql_login']) : '';?>"/></p>
<p><label for="mysql_password">MySQL password : </label><input type="password" name="mysql_password" id="mysql_password"/></p> <p><label for="mysql_password">MySQL password : </label><input type="password" name="mysql_password" id="mysql_password"/> <a href="" onclick="toggle_password('mysql_password'); return false;"><img src="img/toggle_password.jpg" alt="Toggle visible"/></a></p>
<p> <p>
<label for="mysql_db">Name of the MySQL database to use : </label><input type="text" name="mysql_db" id="mysql_db" value="<?php echo (!empty($_POST['mysql_db'])) ? htmlspecialchars($_POST['mysql_db']) : 'Bouffe@Ulm';?>"/><br/> <label for="mysql_db">Name of the MySQL database to use : </label><input type="text" name="mysql_db" id="mysql_db" value="<?php echo (!empty($_POST['mysql_db'])) ? htmlspecialchars($_POST['mysql_db']) : 'Bouffe@Ulm';?>"/><br/>
<em>Note :</em> You <em>must</em> create this database first. <em>Note :</em> You <em>must</em> create this database first.
@ -126,7 +127,7 @@
<legend>Administrator</legend> <legend>Administrator</legend>
<p><label for="admin_login">Username of the admin : </label><input type="text" name="admin_login" id="admin_login" <?php echo (!empty($_POST['admin_login'])) ? 'value="'.htmlspecialchars($_POST['admin_login']).'"' : '';?>/></p> <p><label for="admin_login">Username of the admin : </label><input type="text" name="admin_login" id="admin_login" <?php echo (!empty($_POST['admin_login'])) ? 'value="'.htmlspecialchars($_POST['admin_login']).'"' : '';?>/></p>
<p><label for="admin_display_name">Displayed name for admin user : </label><input type="text" name="admin_display_name" id="admin_display_name" <?php echo (!empty($_POST['admin_display_name']) ? 'value="'.htmlspecialchars($_POST['admin_display_name']).'"' : '');?>/></p> <p><label for="admin_display_name">Displayed name for admin user : </label><input type="text" name="admin_display_name" id="admin_display_name" <?php echo (!empty($_POST['admin_display_name']) ? 'value="'.htmlspecialchars($_POST['admin_display_name']).'"' : '');?>/></p>
<p><label for="admin_password">Password for the admin : </label><input type="password" name="admin_password" id="admin_password"/></p> <p><label for="admin_password">Password for the admin : </label><input type="password" name="admin_password" id="admin_password"/> <a href="" onclick="toggle_password('admin_password'); return false;"><img src="img/toggle_password.jpg" alt="Toggle visible"/></a></p>
</fieldset> </fieldset>
<p class="center"><input <?php echo (!empty($block_form)) ? 'disabled ' : '';?>type="submit" value="Install"></p> <p class="center"><input <?php echo (!empty($block_form)) ? 'disabled ' : '';?>type="submit" value="Install"></p>
</form> </form>

View File

@ -25,7 +25,7 @@
<p><label for="mysql_login">MySQL login : </label><input type="text" name="mysql_login" id="mysql_login" value="<?php echo $mysql_login;?>"/></p> <p><label for="mysql_login">MySQL login : </label><input type="text" name="mysql_login" id="mysql_login" value="<?php echo $mysql_login;?>"/></p>
<p> <p>
<label for="mysql_password">MySQL password : </label><input type="password" name="mysql_password" id="mysql_password"/><br/> <label for="mysql_password">MySQL password : </label><input type="password" name="mysql_password" id="mysql_password"/> <a href="" onclick="toggle_password('mysql_password'); return false;"><img src="tpl/tpl/img/toggle_password.jpg" alt="Toggle visible"/></a><br/>
<em>Note :</em> Leave the above field blank if you don't want to change your password. <em>Note :</em> Leave the above field blank if you don't want to change your password.
</p> </p>
<p> <p>
@ -44,6 +44,10 @@
<em>Note :</em> This is the base URL from which you access this page. You must keep the trailing "/" in the above address. <em>Note :</em> This is the base URL from which you access this page. You must keep the trailing "/" in the above address.
</p> </p>
<p><label for="currency">Currency : </label><input type="text" name="currency" id="currency" size="3" value="<?php echo $currency;?>"/></p> <p><label for="currency">Currency : </label><input type="text" name="currency" id="currency" size="3" value="<?php echo $currency;?>"/></p>
<p>
<label for="timezone">Timezone : </label><input type="text" name="timezone" id="timezone" value="<?php echo $timezone;?>"/><br/>
<em>For example :</em> Europe/Paris. See the doc for more info.
</p>
</fieldset> </fieldset>
<p class="center"><input type="submit" value="Update settings"></p> <p class="center"><input type="submit" value="Update settings"></p>
</form> </form>

View File

@ -8,3 +8,10 @@ function guest_user_label(id) {
else else
document.getElementById('guest_user_'+id+'_label').innerHTML = ' guest'; document.getElementById('guest_user_'+id+'_label').innerHTML = ' guest';
} }
function toggle_password(id) {
if(document.getElementById(id).type == 'password')
document.getElementById(id).type = 'text';
else
document.getElementById(id).type = 'password';
}

View File

@ -22,7 +22,7 @@
<p><label for="mysql_login">MySQL login : </label><input type="text" name="mysql_login" id="mysql_login" value="{$mysql_login}"/></p> <p><label for="mysql_login">MySQL login : </label><input type="text" name="mysql_login" id="mysql_login" value="{$mysql_login}"/></p>
<p> <p>
<label for="mysql_password">MySQL password : </label><input type="password" name="mysql_password" id="mysql_password"/><br/> <label for="mysql_password">MySQL password : </label><input type="password" name="mysql_password" id="mysql_password"/> <a href="" onclick="toggle_password('mysql_password'); return false;"><img src="img/toggle_password.jpg" alt="Toggle visible"/></a><br/>
<em>Note :</em> Leave the above field blank if you don't want to change your password. <em>Note :</em> Leave the above field blank if you don't want to change your password.
</p> </p>
<p> <p>