Mask invoices when user is not concerned

(except if admin user)

Only the invoices that concern the current user (as buyer or user in) are displayed now.
This commit is contained in:
Phyks 2013-11-12 20:11:24 +01:00
parent 06abe6bbc6
commit af2363c7cd
2 changed files with 11 additions and 1 deletions

1
TODO
View File

@ -1,5 +1,4 @@
* Notifications by e-mail for users * Notifications by e-mail for users
* Mask invoices when user is not concerned in "show all invoices"
Improvements : Improvements :
============== ==============

View File

@ -1055,6 +1055,17 @@
$tpl->assign('all', 1); $tpl->assign('all', 1);
} }
// Only keep the invoices which concern the user (as buyer or user in) (only if user != admin)
// TODO : Optimize ?
if(!$current_user->getAdmin()) {
foreach($invoices_list as $key=>$invoice) {
if($invoice->getBuyer() != $current_user->getId() && !$invoice->getUsersIn()->inUsersIn($current_user->getId())) {
unset($invoices_list[$key]);
}
}
}
if($invoices_list === false) $invoices_list = array(); if($invoices_list === false) $invoices_list = array();
else { else {
$sort_keys = array(); $sort_keys = array();