Rev 2259 | Rev 2486 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
<?php
// declare(encoding='UTF-8');
/**
* Service rendant publique une observation.
*
* @internal Mininum PHP version : 5.2
* @category CEL
* @package Services
* @subpackage Observations
* @version 0.1
* @author Mathias CHOUET <mathias@tela-botanica.org>
* @author Jean-Pascal MILCENT <jpm@tela-botanica.org>
* @author Aurelien PERONNET <aurelien@tela-botanica.org>
* @license GPL v3 <http://www.gnu.org/licenses/gpl.txt>
* @license CECILL v2 <http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt>
* @copyright 1999-2014 Tela Botanica <accueil@tela-botanica.org>
*/
class InventoryTransmit extends Cel {
public function updateElement($uid, $pairs) {
// Controle detournement utilisateur
$this->controleUtilisateur($uid[0]);
if (!isset($uid[1])) {
return false;
}
$transmission = intval($pairs['transmission']);
if ($transmission != 0 && $transmission != 1) {
return false;
}
$ids = array_filter(array_map(create_function('$v','return intval($v);'), explode(',', $uid[1])), 'strlen');
$date = ($transmission == 1) ? 'now()' : 'NULL';
//TODO: modification pour passer ceci dans la classe gestion observation
$requete = 'UPDATE cel_obs '.
'SET transmission = '.$pairs['transmission'].', '.
'date_modification = now(), date_transmission = '.$date.' '.
'WHERE ce_utilisateur = '.Cel::db()->proteger($uid[0]).' '.
'AND ordre in ('.implode(',', $ids).') '.
' -- '.__FILE__.':'.__LINE__;
$resultat = Cel::db()->executer($requete);
return ($resultat != 0);
}
}