Fix another method
This commit is contained in:
parent
155cace466
commit
7cb963b8cf
|
@ -63,7 +63,10 @@ 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";
|
||||
|
||||
$this->model_database->update_progress_scheduleds_in($ids_scheduleds, true);
|
||||
foreach ($ids_scheduleds as $ids_scheduled)
|
||||
{
|
||||
$this->internal_scheduled->update_progress($id_scheduled, true);
|
||||
}
|
||||
|
||||
//Pour chaque Sms à envoyer
|
||||
foreach ($scheduleds as $scheduled)
|
||||
|
|
|
@ -207,4 +207,14 @@ namespace controllers\internals;
|
|||
//Recupération des scheduledes
|
||||
return $this->model_scheduled->get_group($id_scheduled);
|
||||
}
|
||||
|
||||
/**
|
||||
* This function update progress status of a scheduled sms
|
||||
* @param bool $progress : Progress status
|
||||
* @return int : Number of update
|
||||
*/
|
||||
public function update_progress ($id_scheduled, $progress)
|
||||
{
|
||||
return $this->model_scheduled->update($id_scheduled, ['progress' => $progress]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,61 +15,6 @@ namespace models;
|
|||
class DataBase extends \descartes\Model
|
||||
{
|
||||
|
||||
|
||||
//
|
||||
// PARTIE DES REQUETES SCHEDULEDS
|
||||
//
|
||||
|
||||
/**
|
||||
* Supprime tous les sms programmés dont l'id fait partie du tableau fourni.
|
||||
*
|
||||
* @param $contacts_ids : Tableau des id des sms à supprimer
|
||||
* @param mixed $scheduleds_ids
|
||||
*
|
||||
* @return int : Nombre de lignes supprimées
|
||||
*/
|
||||
public function delete_scheduleds_in($scheduleds_ids)
|
||||
{
|
||||
$query = '
|
||||
DELETE FROM scheduled
|
||||
WHERE id ';
|
||||
|
||||
//On génère la clause IN et les paramètres adaptés depuis le tableau des id
|
||||
$generted_in = $this->_generate_in_from_array($scheduleds_ids);
|
||||
$query .= $generted_in['QUERY'];
|
||||
$params = $generted_in['PARAMS'];
|
||||
|
||||
return $this->_run_query($query, $params, self::ROWCOUNT);
|
||||
}
|
||||
|
||||
//
|
||||
// PARTIE DES REQUETES SCHEDULEDS_CONTACTS
|
||||
//
|
||||
|
||||
/**
|
||||
* Change le statut des scheduleds dont l'id est fourni dans $scheduleds_id.
|
||||
*
|
||||
* @param array $scheduleds_ids = Tableau des id des sms voulus
|
||||
* @param mixed $progress
|
||||
*
|
||||
* @return int : Retourne le nombre de lignes mises à jour
|
||||
*/
|
||||
public function update_progress_scheduleds_in($scheduleds_ids, $progress)
|
||||
{
|
||||
$query = '
|
||||
UPDATE scheduled
|
||||
SET progress = :progress
|
||||
WHERE id ';
|
||||
|
||||
//On génère la clause IN et les paramètres adaptés depuis le tableau des id
|
||||
$generted_in = $this->_generate_in_from_array($scheduleds_ids);
|
||||
$query .= $generted_in['QUERY'];
|
||||
$params = $generted_in['PARAMS'];
|
||||
$params['progress'] = (bool) $progress;
|
||||
|
||||
return $this->_run_query($query, $params, self::ROWCOUNT);
|
||||
}
|
||||
|
||||
//
|
||||
// PARTIE DES REQUETES SCHEDULEDS_NUMBERS
|
||||
//
|
||||
|
|
Loading…
Reference in New Issue