No self bills
This commit is contained in:
parent
1a9acc5ece
commit
da0a51f997
1
TODO
1
TODO
@ -1,7 +1,6 @@
|
|||||||
* Don't cache the username
|
* Don't cache the username
|
||||||
* JSON output => do index view
|
* JSON output => do index view
|
||||||
* API
|
* API
|
||||||
* Reattribute all invoices / paybacks to unknown user when deleting a user ?
|
|
||||||
* cf TODO in files
|
* cf TODO in files
|
||||||
* French template
|
* French template
|
||||||
* Favicon
|
* Favicon
|
||||||
|
12
index.php
12
index.php
@ -9,7 +9,8 @@
|
|||||||
'unable_write_config'=>array('fr'=>'Impossible d\'écrire le fichier data/config.php. Vérifiez les permissions.', 'en'=>'Unable to write data/config.php file. Check permissions.'),
|
'unable_write_config'=>array('fr'=>'Impossible d\'écrire le fichier data/config.php. Vérifiez les permissions.', 'en'=>'Unable to write data/config.php file. Check permissions.'),
|
||||||
'negative_amount'=>array('fr'=>'Montant négatif non autorisé.', 'en'=>'Negative amount not allowed.'),
|
'negative_amount'=>array('fr'=>'Montant négatif non autorisé.', 'en'=>'Negative amount not allowed.'),
|
||||||
'template_error'=>array('fr'=>'Template non disponible.', 'en'=>'Template not available.'),
|
'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.')
|
'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.')
|
||||||
);
|
);
|
||||||
|
|
||||||
$localized = array(
|
$localized = array(
|
||||||
@ -284,7 +285,7 @@
|
|||||||
$users_in = $invoice->getUsersIn()->get();
|
$users_in = $invoice->getUsersIn()->get();
|
||||||
unset($users_in[$_GET['user_id']]);
|
unset($users_in[$_GET['user_id']]);
|
||||||
|
|
||||||
if(empty($users_in))
|
if(empty($users_in) || array_keys($users_in) == array($invoice->getBuyer()))
|
||||||
$invoice->delete();
|
$invoice->delete();
|
||||||
else {
|
else {
|
||||||
$invoice->setUsersIn($users_in);
|
$invoice->setUsersIn($users_in);
|
||||||
@ -437,6 +438,10 @@
|
|||||||
if($_POST['amount'] <= 0) {
|
if($_POST['amount'] <= 0) {
|
||||||
$tpl->assign('error', $errors['negative_amount'][LANG]);
|
$tpl->assign('error', $errors['negative_amount'][LANG]);
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
if(array_keys($users_in) == array($current_user->getId())) {
|
||||||
|
$tpl->assign('error', $errors['no_users'][LANG]);
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
$invoice = new Invoice();
|
$invoice = new Invoice();
|
||||||
|
|
||||||
@ -463,6 +468,7 @@
|
|||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
$tpl->assign('error', $errors['token_error'][LANG]);
|
$tpl->assign('error', $errors['token_error'][LANG]);
|
||||||
}
|
}
|
||||||
@ -524,7 +530,7 @@
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'confirm_payback':
|
case 'confirm_payback':
|
||||||
if(!empty($_GET['from']) && !empty($_GET['to']) && !empty($_GET['invoice_id'])) {
|
if(!empty($_GET['from']) && !empty($_GET['to']) && !empty($_GET['invoice_id']) && $_GET['from'] != $_GET['to']) {
|
||||||
if($_GET['to'] == $current_user->getId() || $current_user->getAdmin()) {
|
if($_GET['to'] == $current_user->getId() || $current_user->getAdmin()) {
|
||||||
$invoice = new Invoice();
|
$invoice = new Invoice();
|
||||||
$invoice = $invoice->load(array('id'=>(int) $_GET['invoice_id']), true);
|
$invoice = $invoice->load(array('id'=>(int) $_GET['invoice_id']), true);
|
||||||
|
@ -60,6 +60,7 @@
|
|||||||
{elseif condition="$value2 == 1"}
|
{elseif condition="$value2 == 1"}
|
||||||
({$value2} guest)
|
({$value2} guest)
|
||||||
{/if}
|
{/if}
|
||||||
|
{if condition="$value1->getBuyer() != $key2"}
|
||||||
-
|
-
|
||||||
{if condition="$paybacks[$value1->getId()] === false || !in_array($key2, array_keys($paybacks[$value1->getId()]))"}
|
{if condition="$paybacks[$value1->getId()] === false || !in_array($key2, array_keys($paybacks[$value1->getId()]))"}
|
||||||
{if condition="$current_user->getId() == $value1->getBuyer() || $current_user->getAdmin()"}
|
{if condition="$current_user->getId() == $value1->getBuyer() || $current_user->getAdmin()"}
|
||||||
@ -88,6 +89,7 @@
|
|||||||
{/if}
|
{/if}
|
||||||
{/if}
|
{/if}
|
||||||
{/if}
|
{/if}
|
||||||
|
{/if}
|
||||||
<br/>
|
<br/>
|
||||||
{/loop}
|
{/loop}
|
||||||
</td>
|
</td>
|
||||||
|
Loading…
Reference in New Issue
Block a user