use status for delivered
This commit is contained in:
parent
5f3e228eca
commit
7de5410d0e
|
@ -143,6 +143,18 @@ namespace controllers\internals;
|
|||
return $this->model_sended->decrement_before_delivered($id_sended);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update status
|
||||
*
|
||||
* @param int $id_sended : id of the sended to mark as delivered
|
||||
* @param string $status : new status
|
||||
* @return int
|
||||
*/
|
||||
public function update_status($id_sended, $status)
|
||||
{
|
||||
return $this->model_sended->update($id_sended, ['status' => $status]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update sended to delivered.
|
||||
*
|
||||
|
@ -152,6 +164,6 @@ namespace controllers\internals;
|
|||
*/
|
||||
public function set_delivered($id_sended)
|
||||
{
|
||||
return $this->model_sended->update($id_sended, ['before_delivered' => 0, 'delivered' => true]);
|
||||
return $this->model_sended->update($id_sended, ['status' => 'delivered']);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,6 +45,7 @@ CREATE TABLE IF NOT EXISTS sended
|
|||
origin VARCHAR(20) NOT NULL,
|
||||
destination VARCHAR(20),
|
||||
flash BOOLEAN NOT NULL DEFAULT 0,
|
||||
status ENUM('unknown', 'delivered', 'failed') NOT NULL DEFAULT 'unknown',
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
|
||||
|
|
|
@ -56,10 +56,18 @@
|
|||
<?php foreach ($sendeds as $sended) { ?>
|
||||
<tr>
|
||||
<td><?php $this->s($sended['id']); ?></td>
|
||||
<td><?php $this->s($sended['target']); ?></td>
|
||||
<td><?php $this->s($sended['content']); ?></td>
|
||||
<td><?php $this->s($sended['destination']); ?></td>
|
||||
<td><?php $this->s($sended['text']); ?></td>
|
||||
<td><?php $this->s($sended['at']); ?></td>
|
||||
<td><?php $this->s($sended['delivered'] ? 'Délivré' : ($sended['failed'] ? 'Échoué' : 'Inconnu')); ?></td>
|
||||
|
||||
<?php if ($sended['status'] == 'unknown') { ?>
|
||||
<td>Inconnu</td>
|
||||
<?php } elseif ($sended['status'] == 'delivered') { ?>
|
||||
<td>Délivré</td>
|
||||
<?php } elseif ($sended['status'] == 'failed') { ?>
|
||||
<td>Échoué</td>
|
||||
<?php } ?>
|
||||
|
||||
<?php if ($_SESSION['user']['admin']) { ?>
|
||||
<td><input name="ids[]" type="checkbox" value="<?php $this->s($sended['id']); ?>"></td>
|
||||
<?php } ?>
|
||||
|
|
Loading…
Reference in New Issue