Remove useless files in JSON tpl + start notifications
This commit is contained in:
parent
09bbb789c6
commit
7456210772
32
index.php
32
index.php
@ -471,6 +471,9 @@
|
|||||||
|
|
||||||
case 'new_invoice':
|
case 'new_invoice':
|
||||||
case 'edit_invoice':
|
case 'edit_invoice':
|
||||||
|
$users_list = new User();
|
||||||
|
$users_list = $users_list->load();
|
||||||
|
|
||||||
if(!empty($_GET['id'])) {
|
if(!empty($_GET['id'])) {
|
||||||
$invoice = new Invoice();
|
$invoice = new Invoice();
|
||||||
$invoice = $invoice->load(array('id'=>(int) $_GET['id']), true);
|
$invoice = $invoice->load(array('id'=>(int) $_GET['id']), true);
|
||||||
@ -508,14 +511,16 @@
|
|||||||
else {
|
else {
|
||||||
$invoice = new Invoice();
|
$invoice = new Invoice();
|
||||||
|
|
||||||
if(!empty($_POST['id']))
|
if(!empty($_POST['id'])) {
|
||||||
$invoice->setId($_POST['id']);
|
$invoice->setId($_POST['id']);
|
||||||
|
}
|
||||||
|
|
||||||
$invoice->setWhat($_POST['what']);
|
$invoice->setWhat($_POST['what']);
|
||||||
$invoice->setAmount($_POST['amount']);
|
$invoice->setAmount($_POST['amount']);
|
||||||
|
|
||||||
if(empty($_POST['id']))
|
if(empty($_POST['id'])) {
|
||||||
$invoice->setBuyer($current_user->getId());
|
$invoice->setBuyer($current_user->getId());
|
||||||
|
}
|
||||||
|
|
||||||
$invoice->setDate(0, int2ampm($_POST['date_hour']), $_POST['date_day'], $_POST['date_month'], $_POST['date_year']);
|
$invoice->setDate(0, int2ampm($_POST['date_hour']), $_POST['date_day'], $_POST['date_month'], $_POST['date_year']);
|
||||||
|
|
||||||
@ -524,6 +529,26 @@
|
|||||||
|
|
||||||
$invoice->save();
|
$invoice->save();
|
||||||
|
|
||||||
|
// Send notifications
|
||||||
|
if (!empty($_POST['id'])) {
|
||||||
|
$invoice = new Invoice();
|
||||||
|
$invoice = $invoice->load(array('id'=>$_POST['id']), true);
|
||||||
|
$buyer = $invoice->getBuyer();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$buyer = $current_user->getId();
|
||||||
|
}
|
||||||
|
foreach ($users_in as $user_in=>$guest) {
|
||||||
|
if (empty($_POST['id']) && $user_in == $buyer) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$user_in_details = new User();
|
||||||
|
$user_in_details = $user_in_details->load(array('id'=>$user_in), true);
|
||||||
|
if (!empty($user_in_details->getEmail()) && $user_in_details->getNotifications() === 3) {
|
||||||
|
sendmail($user_in_details, $subject, $msg, $from); // TODO notifs
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Clear the cache
|
// Clear the cache
|
||||||
($cached_files = glob(raintpl::$cache_dir."*.rtpl.php")) or ($cached_files = array());
|
($cached_files = glob(raintpl::$cache_dir."*.rtpl.php")) or ($cached_files = array());
|
||||||
array_map("unlink", $cached_files);
|
array_map("unlink", $cached_files);
|
||||||
@ -538,9 +563,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$users_list = new User();
|
|
||||||
$users_list = $users_list->load();
|
|
||||||
|
|
||||||
$tpl->assign('days', range(1,31));
|
$tpl->assign('days', range(1,31));
|
||||||
$tpl->assign('months', range(1, 12));
|
$tpl->assign('months', range(1, 12));
|
||||||
$tpl->assign('years', range(date('Y') - 1, date('Y') + 1));
|
$tpl->assign('years', range(date('Y') - 1, date('Y') + 1));
|
||||||
|
@ -1,5 +0,0 @@
|
|||||||
{if condition="LANG=='fr'"}
|
|
||||||
Vous devez utiliser votre token unique d'identification pour l'utilisation de l'API JSON. Vous pouvez le trouver dans le menu "Modifier votre mot de passe".
|
|
||||||
{else}
|
|
||||||
You must use your unique id token to use JSON API. You can find it under the "Edit password" menu.
|
|
||||||
{/if}
|
|
@ -1,9 +0,0 @@
|
|||||||
{if condition="$error != ''"}
|
|
||||||
<p class="error">{$error}</p>
|
|
||||||
{/if}
|
|
||||||
|
|
||||||
{if condition="$view == 'list_users'"}
|
|
||||||
{function="json_encode(array_map(function($obj) { return $obj->sessionStore(false);}, $users))"}
|
|
||||||
{else}
|
|
||||||
{if condition="LANG == 'en'"}Nothing to show.{else}Il n'y a rien à afficher.{/if}
|
|
||||||
{/if}
|
|
@ -6,7 +6,7 @@ TODO ***
|
|||||||
<div id="quick_summary">
|
<div id="quick_summary">
|
||||||
<h2>Balance</h2>
|
<h2>Balance</h2>
|
||||||
<p class="center">Read <em>line</em> owes <em>case</em> {$currency} to <em>column</em>. You can click on links to confirm the payback.
|
<p class="center">Read <em>line</em> owes <em>case</em> {$currency} to <em>column</em>. You can click on links to confirm the payback.
|
||||||
<table id="balance_table">
|
<table id="balance_table">
|
||||||
<tr>
|
<tr>
|
||||||
<th>Owes\To</th>
|
<th>Owes\To</th>
|
||||||
{loop="users"}
|
{loop="users"}
|
||||||
|
@ -1 +0,0 @@
|
|||||||
{if condition="LANG == 'en'}Nothing to show.{else}Il n'y a rien à afficher.{/if}
|
|
@ -1,6 +0,0 @@
|
|||||||
{if condition="!$show_settings"}
|
|
||||||
{"notice":{function="json_encode($notice)"}}
|
|
||||||
|
|
||||||
{else}
|
|
||||||
{"mysql_host":{function="json_encode($mysql_host)"}, "mysql_login":{function="json_encode($mysql_login)"}, "mysql_db":{function="json_encode($mysql_db)"}, "mysql_prefix":{function="json_encode($mysql_prefix)"}, "instance_title":{function="json_encode($instance_title)"}, "base_url":{function="json_encode($base_url)"}, "currency":{function="json_encode($currency)"}, "timezone":{function="json_encode($timezone)"}, "templates":{function="json_encode(TwoDArrayToOneD($templates, 'value'))"}, "current_template":{function="json_encode($current_template)"}", "email_webmaster":{function="json_encode($email_webmaster)"}}
|
|
||||||
{/if}
|
|
Loading…
Reference in New Issue
Block a user