Fix database model methods names
This commit is contained in:
parent
b88413b311
commit
f1170c82ea
|
@ -51,7 +51,7 @@ class Console extends \descartes\InternalController
|
||||||
|
|
||||||
echo "Début de l'envoi des Sms programmés\n";
|
echo "Début de l'envoi des Sms programmés\n";
|
||||||
|
|
||||||
$scheduleds = $this->model_database->getScheduledsNotInProgressBefore($now);
|
$scheduleds = $this->model_database->get_scheduleds_not_in_progress_before($now);
|
||||||
|
|
||||||
$ids_scheduleds = [];
|
$ids_scheduleds = [];
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ class Console extends \descartes\InternalController
|
||||||
|
|
||||||
echo \count($ids_scheduleds)." Sms à envoyer ont été trouvés et ajoutés à la liste des Sms en cours d'envoi.\n";
|
echo \count($ids_scheduleds)." Sms à envoyer ont été trouvés et ajoutés à la liste des Sms en cours d'envoi.\n";
|
||||||
|
|
||||||
$this->model_database->updateProgressScheduledsIn($ids_scheduleds, true);
|
$this->model_database->update_progress_scheduleds_in($ids_scheduleds, true);
|
||||||
|
|
||||||
//Pour chaque Sms à envoyer
|
//Pour chaque Sms à envoyer
|
||||||
foreach ($scheduleds as $scheduled)
|
foreach ($scheduleds as $scheduled)
|
||||||
|
@ -76,7 +76,7 @@ class Console extends \descartes\InternalController
|
||||||
$numbers = [];
|
$numbers = [];
|
||||||
|
|
||||||
//On récupère les numéros pour le Sms et on les ajoute
|
//On récupère les numéros pour le Sms et on les ajoute
|
||||||
$target_numbers = $this->model_database->getNumbersForScheduled($id_scheduled);
|
$target_numbers = $this->model_database->get_numbers_for_scheduled($id_scheduled);
|
||||||
foreach ($target_numbers as $target_number)
|
foreach ($target_numbers as $target_number)
|
||||||
{
|
{
|
||||||
$numbers[] = $target_number['number'];
|
$numbers[] = $target_number['number'];
|
||||||
|
@ -90,11 +90,11 @@ class Console extends \descartes\InternalController
|
||||||
}
|
}
|
||||||
|
|
||||||
//On récupère les groups
|
//On récupère les groups
|
||||||
$groups = $this->model_database->getGroupsForScheduled($id_scheduled);
|
$groups = $this->model_database->get_groups_for_scheduled($id_scheduled);
|
||||||
foreach ($groups as $group)
|
foreach ($groups as $group)
|
||||||
{
|
{
|
||||||
//On récupère les contacts du group et on les ajoute aux numéros
|
//On récupère les contacts du group et on les ajoute aux numéros
|
||||||
$contacts = $this->model_database->getContactsForGroup($group['id']);
|
$contacts = $this->model_database->get_contacts_for_group($group['id']);
|
||||||
foreach ($contacts as $contact)
|
foreach ($contacts as $contact)
|
||||||
{
|
{
|
||||||
$numbers[] = $contact['number'];
|
$numbers[] = $contact['number'];
|
||||||
|
@ -151,7 +151,7 @@ class Console extends \descartes\InternalController
|
||||||
|
|
||||||
echo "Tous les Sms sont en cours d'envoi.\n";
|
echo "Tous les Sms sont en cours d'envoi.\n";
|
||||||
//Tous les Sms ont été envoyés.
|
//Tous les Sms ont été envoyés.
|
||||||
$this->model_database->deleteScheduledsIn($ids_scheduleds);
|
$this->model_database->delete_scheduleds_in($ids_scheduleds);
|
||||||
|
|
||||||
//On dors 2 secondes
|
//On dors 2 secondes
|
||||||
sleep(2);
|
sleep(2);
|
||||||
|
@ -280,7 +280,7 @@ class Console extends \descartes\InternalController
|
||||||
if (\array_key_exists('LOGIN', $flags) && \array_key_exists('PASSWORD', $flags))
|
if (\array_key_exists('LOGIN', $flags) && \array_key_exists('PASSWORD', $flags))
|
||||||
{
|
{
|
||||||
//Si on a bien un utilisateur avec les identifiants reçus
|
//Si on a bien un utilisateur avec les identifiants reçus
|
||||||
$user = $this->model_database->getUserFromEmail($flags['LOGIN']);
|
$user = $this->model_database->get_user_from_email($flags['LOGIN']);
|
||||||
error_log('We found '.\count($user).' users');
|
error_log('We found '.\count($user).' users');
|
||||||
if ($user && $user['password'] === sha1($flags['PASSWORD']))
|
if ($user && $user['password'] === sha1($flags['PASSWORD']))
|
||||||
{
|
{
|
||||||
|
@ -363,9 +363,9 @@ class Console extends \descartes\InternalController
|
||||||
$ids_receiveds[] = $transfer['id_received'];
|
$ids_receiveds[] = $transfer['id_received'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->model_database->updateProgressTransfersIn($ids_transfers, true);
|
$this->model_database->update_progress_transfers_in($ids_transfers, true);
|
||||||
|
|
||||||
$receiveds = $this->model_database->getReceivedsIn($ids_receiveds);
|
$receiveds = $this->model_database->get_receiveds_in($ids_receiveds);
|
||||||
|
|
||||||
$users = $this->model_user->_select('users', ['transfer' => true]);
|
$users = $this->model_user->_select('users', ['transfer' => true]);
|
||||||
|
|
||||||
|
@ -384,6 +384,6 @@ class Console extends \descartes\InternalController
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->model_database->deleteTransfersIn($ids_transfers);
|
$this->model_database->delete_transfers_in($ids_transfers);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,7 @@ namespace models;
|
||||||
*
|
*
|
||||||
* @return array : Retourne un tableau avec les receiveds adaptés
|
* @return array : Retourne un tableau avec les receiveds adaptés
|
||||||
*/
|
*/
|
||||||
public function getReceivedsIn($receiveds_ids)
|
public function get_receiveds_in($receiveds_ids)
|
||||||
{
|
{
|
||||||
$query = '
|
$query = '
|
||||||
SELECT *
|
SELECT *
|
||||||
|
@ -54,7 +54,7 @@ namespace models;
|
||||||
*
|
*
|
||||||
* @return array : Tous les contacts compris dans le group
|
* @return array : Tous les contacts compris dans le group
|
||||||
*/
|
*/
|
||||||
public function getContactsForGroup($id_group)
|
public function get_contacts_for_group($id_group)
|
||||||
{
|
{
|
||||||
$query = '
|
$query = '
|
||||||
SELECT con.id as id, con.name as name, con.number as number
|
SELECT con.id as id, con.name as name, con.number as number
|
||||||
|
@ -82,7 +82,7 @@ namespace models;
|
||||||
*
|
*
|
||||||
* @return array : Tableau avec les sms programmés demandés
|
* @return array : Tableau avec les sms programmés demandés
|
||||||
*/
|
*/
|
||||||
public function getScheduledsNotInProgressBefore($date)
|
public function get_scheduleds_not_in_progress_before($date)
|
||||||
{
|
{
|
||||||
$query = '
|
$query = '
|
||||||
SELECT *
|
SELECT *
|
||||||
|
@ -106,7 +106,7 @@ namespace models;
|
||||||
*
|
*
|
||||||
* @return int : Nombre de lignes supprimées
|
* @return int : Nombre de lignes supprimées
|
||||||
*/
|
*/
|
||||||
public function deleteScheduledsIn($scheduleds_ids)
|
public function delete_scheduleds_in($scheduleds_ids)
|
||||||
{
|
{
|
||||||
$query = '
|
$query = '
|
||||||
DELETE FROM scheduled
|
DELETE FROM scheduled
|
||||||
|
@ -132,7 +132,7 @@ namespace models;
|
||||||
*
|
*
|
||||||
* @return int : Retourne le nombre de lignes mises à jour
|
* @return int : Retourne le nombre de lignes mises à jour
|
||||||
*/
|
*/
|
||||||
public function updateProgressScheduledsIn($scheduleds_ids, $progress)
|
public function update_progress_scheduleds_in($scheduleds_ids, $progress)
|
||||||
{
|
{
|
||||||
$query = '
|
$query = '
|
||||||
UPDATE scheduled
|
UPDATE scheduled
|
||||||
|
@ -159,7 +159,7 @@ namespace models;
|
||||||
*
|
*
|
||||||
* @return array : Tous les numéro compris dans le scheduled
|
* @return array : Tous les numéro compris dans le scheduled
|
||||||
*/
|
*/
|
||||||
public function getNumbersForScheduled($id_scheduled)
|
public function get_numbers_for_scheduled($id_scheduled)
|
||||||
{
|
{
|
||||||
$query = '
|
$query = '
|
||||||
SELECT *
|
SELECT *
|
||||||
|
@ -185,7 +185,7 @@ namespace models;
|
||||||
*
|
*
|
||||||
* @return array : Tous les groups compris dans le scheduled
|
* @return array : Tous les groups compris dans le scheduled
|
||||||
*/
|
*/
|
||||||
public function getGroupsForScheduled($id_scheduled)
|
public function get_groups_for_scheduled($id_scheduled)
|
||||||
{
|
{
|
||||||
$query = '
|
$query = '
|
||||||
SELECT gro.id as id, gro.name as name
|
SELECT gro.id as id, gro.name as name
|
||||||
|
@ -213,7 +213,7 @@ namespace models;
|
||||||
*
|
*
|
||||||
* @return array : Retourne l'utilisateur
|
* @return array : Retourne l'utilisateur
|
||||||
*/
|
*/
|
||||||
public function getUserFromEmail($email)
|
public function get_user_from_email($email)
|
||||||
{
|
{
|
||||||
$query = '
|
$query = '
|
||||||
SELECT *
|
SELECT *
|
||||||
|
@ -239,7 +239,7 @@ namespace models;
|
||||||
*
|
*
|
||||||
* @return int : Retourne le nombre de lignes mises à jour
|
* @return int : Retourne le nombre de lignes mises à jour
|
||||||
*/
|
*/
|
||||||
public function updateProgressTransfersIn($transfers_ids, $progress)
|
public function update_progress_transfers_in($transfers_ids, $progress)
|
||||||
{
|
{
|
||||||
$query = '
|
$query = '
|
||||||
UPDATE transfer
|
UPDATE transfer
|
||||||
|
@ -262,7 +262,7 @@ namespace models;
|
||||||
*
|
*
|
||||||
* @return int : Nombre de lignes supprimées
|
* @return int : Nombre de lignes supprimées
|
||||||
*/
|
*/
|
||||||
public function deleteTransfersIn($transfers_ids)
|
public function delete_transfers_in($transfers_ids)
|
||||||
{
|
{
|
||||||
$query = '
|
$query = '
|
||||||
DELETE FROM transfer
|
DELETE FROM transfer
|
||||||
|
@ -275,9 +275,4 @@ namespace models;
|
||||||
|
|
||||||
return $this->_run_query($query, $params, self::ROWCOUNT);
|
return $this->_run_query($query, $params, self::ROWCOUNT);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// PARTIE DES REQUETES EVENTS
|
|
||||||
//
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue