Update api scheduled to use current datetime by default

This commit is contained in:
Your Name 2020-04-19 18:09:59 +02:00
parent 379eaa2786
commit 6c6082ca90
2 changed files with 9 additions and 2 deletions

View File

@ -182,7 +182,7 @@ namespace controllers\publics;
* *
* @return : Id of scheduled created * @return : Id of scheduled created
*/ */
public function post_scheduled() public function post_scheduled ()
{ {
$at = $_POST['at'] ?? false; $at = $_POST['at'] ?? false;
$text = $_POST['text'] ?? false; $text = $_POST['text'] ?? false;
@ -193,6 +193,11 @@ namespace controllers\publics;
$groups = $_POST['groups'] ?? []; $groups = $_POST['groups'] ?? [];
$conditional_groups = $_POST['conditional_groups'] ?? []; $conditional_groups = $_POST['conditional_groups'] ?? [];
if (!$at)
{
$at = (new \DateTime())->format('Y-m-d H:i:s');
}
if (!$at || !$text) if (!$at || !$text)
{ {
$return = self::DEFAULT_RETURN; $return = self::DEFAULT_RETURN;

View File

@ -42,6 +42,7 @@
<table class="table table-bordered table-hover table-striped datatable" id="table-phones"> <table class="table table-bordered table-hover table-striped datatable" id="table-phones">
<thead> <thead>
<tr> <tr>
<th>ID</th>
<th>Nom</th> <th>Nom</th>
<th>Adaptateur</th> <th>Adaptateur</th>
<th>Callbacks</th> <th>Callbacks</th>
@ -51,7 +52,8 @@
<tbody> <tbody>
<?php foreach ($phones as $phone) { ?> <?php foreach ($phones as $phone) { ?>
<tr> <tr>
<td><?php $this->s(\controllers\internals\Tool::phone_format($phone['name'])); ?></td> <td><?php $this->s($phone['id']); ?></td>
<td><?php $this->s($phone['name']); ?></td>
<td><?php $this->s($phone['adapter']); ?></td> <td><?php $this->s($phone['adapter']); ?></td>
<td> <td>
<div class="bold">Reception d'un SMS : </div> <div class="bold">Reception d'un SMS : </div>