public $components = array('RequestHandler');
public function index() {
- //$this->set('historiques', $this->Historique->find('all'));
$historiques = $this->Historique->find('all');
$this->set(array(
'historiques' => $historiques,
throw new NotFoundException(__('Historique introuvable'));
}
+ // GETTING THE CHANGELOG OF THE APPLIANCE
$this->Historique->id = $id;
$historique = $this->Historique->findById($id);
if (!$historique) {
}
$this->set('historique', $historique);
- // Récupération des alertes de l'historique
+ // GETTING ALL WARNINGS FROM THE CHANGELOG
if($this->Historique->value('alertes')) {
$alertes_id = explode('|', $this->Historique->value('alertes'));
App::import('Controller', 'Alertes');
foreach ($alertes_id as $alerte_id) {
$alertes[] = $alertesController->Alerte->findById($alerte_id);
}
- //$this->set('alertes', $alertes);
+
+ // SENDING DATA TO VIEW
$this->set(array(
'alertes' => $alertes,
'_serialize' => array('alertes')
}
}
- public function actionAlerte($id = null, $alerte_id = null) {
- // Récupération de l'historique
+ public function actionAlerte($id = null, $alerte_id = null, $valider = false, $ref_install = null) {
+
+ // GETTING CHANGELOG
$this->Historique->id = $id;
$historique = $this->Historique->findById($id);
if (!$historique) {
throw new NotFoundException(__('Historique introuvable'));
}
- // Récupération de l'alerte
+ // GETTING WARNINGS OF CHANGELOG
App::import('Controller', 'Alertes');
$alertesController = new AlertesController;
$alerte = $alertesController->Alerte->findById($alerte_id);
throw new NotFoundException(__('Alerte introuvable'));
}
- // Ajout de la version à l'historique
+ // ADDING VERSION AND DATE OF WARNING TO CHANGELOG
$version = $alerte['Alerte']['version'];
+ $date = $alerte['Alerte']['creation'];
switch($alerte['Alerte']['nature']) {
case 'version':
if($this->Historique->value('versions')) {
} else {
$versions = array();
}
- $versions[] = $version;
+ $versions[] = $version.";".$date;
$this->Historique->value('versions', implode('|', $versions));
break;
case 'creation':
$creation = $alerte['Alerte']['creation'];
- // To-do : Modification état produit
+ // TO-DO : CHANGE APPLIANCE STATE ?
break;
default:
}
- // Suppression de l'alerte
+ // IN CASE OF VALIDATION => OPPORTUNITY CREATION IN SUGAR THROUGH ALLO SERVEUR CONNECTOR
+ if($valider) {
+ $reference = str_replace("SLASH", "\\/", $ref_install);
+ $url = 'http://allo_serveur/?action=create_fiche_installation&nom='.$reference;
+ $options = array("http" => array("method" => "GET"));
+ $context = stream_context_create($options);
+ $reponse = file_get_contents($url, false, $context);
+ if(isset($reponse)) {
+ // USE THE ID SENT ?
+ }
+ }
+
+ // DELETING WARNING
$alertesController->Alerte->delete($alerte_id);
$alertes_id = explode('|', $this->Historique->value('alertes'));
if(($key = array_search($alerte_id, $alertes_id)) !== false) {
}
$this->Historique->value('alertes', implode('|', $alertes_id));
- // Redirection
+ // REDIRECTION TO APPLIANCES PAGE
return $this->redirect(array('controller' => 'instances', 'action' => 'index'));
}
}