Bug correction in User::isUnique method + Start of caching system
This commit is contained in:
parent
63f0d881a8
commit
e4fd74e6ee
2
TODO
2
TODO
@ -1,10 +1,8 @@
|
|||||||
* i18n
|
* i18n
|
||||||
* handle negative amounts
|
|
||||||
|
|
||||||
inc/Invoices.class.php :
|
inc/Invoices.class.php :
|
||||||
========================
|
========================
|
||||||
* Modify store() method to handle storage
|
* Modify store() method to handle storage
|
||||||
* Modify load() method to handle JOIN
|
|
||||||
* Modify load() method to handle complex queries (such as WHERE date < DATE_1 AND date > DATE_2)
|
* Modify load() method to handle complex queries (such as WHERE date < DATE_1 AND date > DATE_2)
|
||||||
* Cache
|
* Cache
|
||||||
|
|
||||||
|
@ -100,10 +100,10 @@ class User extends Storage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check wether a user already exists or not
|
// Check wether a user already exists or not
|
||||||
// (a user = aunique login and display_name)
|
// (a user = a unique login and display_name)
|
||||||
// =========================================
|
// =========================================
|
||||||
public function isUnique() {
|
public function isUnique() {
|
||||||
if(count($this->load(array('login'=>$this->login))) == 0 && count($this->load(array('display_name'=>$this->display_name)))) {
|
if($this->load(array('login'=>$this->login)) === false && $this->load(array('display_name'=>$this->display_name)) === false) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -365,6 +365,11 @@
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
// Display cached page in priority
|
||||||
|
if($cache = $tpl->cache('index', $expire_time = 600, $cache_id = NULL)) {
|
||||||
|
echo $cache;
|
||||||
|
}
|
||||||
|
else {
|
||||||
$users_list = new User();
|
$users_list = new User();
|
||||||
$users_list = $users_list->load();
|
$users_list = $users_list->load();
|
||||||
|
|
||||||
@ -374,6 +379,10 @@
|
|||||||
$tpl->assign('users', secureDisplay($users_list));
|
$tpl->assign('users', secureDisplay($users_list));
|
||||||
$tpl->assign('invoices', secureDisplay($invoices_list));
|
$tpl->assign('invoices', secureDisplay($invoices_list));
|
||||||
|
|
||||||
|
// Cache the page (1 month to make it almost permanent and only regenerate it upon new invoice)
|
||||||
|
$tpl->cache('index', 108000, NULL);
|
||||||
|
|
||||||
$tpl->draw('index');
|
$tpl->draw('index');
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
@ -95,6 +95,10 @@ input[type=submit] {
|
|||||||
padding: 0.1em;
|
padding: 0.1em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#detailed_summary {
|
||||||
|
margin-top: 2.5em;
|
||||||
|
}
|
||||||
|
|
||||||
#connexion_form {
|
#connexion_form {
|
||||||
margin: auto;
|
margin: auto;
|
||||||
width: 67%;
|
width: 67%;
|
||||||
@ -122,16 +126,8 @@ textarea#what {
|
|||||||
width: 75%;
|
width: 75%;
|
||||||
}
|
}
|
||||||
|
|
||||||
#list_expenses tr:hover {
|
#list_expenses tr:hover, #balance_table tr:not(:first-child):hover *, .highlight_td {
|
||||||
background-color: #00bd00;
|
background-color: green;
|
||||||
}
|
|
||||||
|
|
||||||
#balance_table tr:not(:first-child):hover * {
|
|
||||||
background-color: #00bd00;
|
|
||||||
}
|
|
||||||
|
|
||||||
.highlight_td {
|
|
||||||
background-color: #00bd00;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#user_connected {
|
#user_connected {
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
<div id="detailed_summary">
|
<div id="detailed_summary">
|
||||||
<h2>Detailed list of bills for last month</h2>
|
<h2>Detailed list of bills for last month</h2>
|
||||||
|
|
||||||
|
{if condition="count($invoices)>1"}
|
||||||
<table id="list_expenses">
|
<table id="list_expenses">
|
||||||
<tr>
|
<tr>
|
||||||
<th>Date</th>
|
<th>Date</th>
|
||||||
@ -49,5 +50,8 @@
|
|||||||
</tr>
|
</tr>
|
||||||
{/loop}
|
{/loop}
|
||||||
</table>
|
</table>
|
||||||
|
{else}
|
||||||
|
<p class="center">No bills added.</p>
|
||||||
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
{include="footer"}
|
{include="footer"}
|
||||||
|
Loading…
Reference in New Issue
Block a user