updated getMachineWorkingInformation according to previous database changes

This commit is contained in:
xdrm-brackets 2017-09-24 19:48:31 +02:00
parent 9a9a030ef6
commit 261398d4a8
1 changed files with 7 additions and 9 deletions

View File

@ -481,7 +481,7 @@
$sorted_actions[$action['timeout']][] = [ $sorted_actions[$action['timeout']][] = [
'id_action' => intval($action['id_action']), 'id_action' => intval($action['id_action']),
'name' => strtolower($action['name']), 'name' => strtolower($action['name']),
'previous' => $action['previous'], 'required' => $action['required'],
'action' => $action['action'] 'action' => $action['action']
]; ];
} }
@ -495,20 +495,17 @@
/* [4] On récupère la liste des MODULES (puces) /* [4] On récupère la liste des MODULES (puces)
=========================================================*/ =========================================================*/
$chipsReq = new Repo('chip/getAll', [$_SESSION['WAREHOUSE']['id']]); $chipsReq = new Repo('chip/getForMachine', [$_SESSION['WAREHOUSE']['id'], $id_machine]);
$chips = ($chipsReq->error->get()==Err::Success) ? $chipsReq->answer() : []; $chips = ($chipsReq->error->get()==Err::Success) ? $chipsReq->answer() : [];
foreach($chips as $c=>$chip){ foreach($chips as $c=>$chip){
/* [5] On récupére la liste des PINS de chaque PUCE /* [5] On récupére la liste des PINS de chaque PUCE
=========================================================*/ =========================================================*/
$pinsReq = new Repo('pin_merge/getByIdChip', [$chip['id_chip']]); $chips[$c]['pins'] = explode(',', $chip['pins']);
$pins = ($pinsReq->error->get()==Err::Success) ? $pinsReq->answer() : [];
$chips[$c]['pins'] = [];
foreach($pins as $p=>$pin)
$chips[$c]['pins'][$p] = intval($pin['pin']);
if( !is_array($chip['pins']) )
$chips[$c]['pins'] = [];
/* [6] On récupère valeurs pour chaque état de chaque PUCE /* [6] On récupère valeurs pour chaque état de chaque PUCE
=========================================================*/ =========================================================*/
@ -520,7 +517,7 @@
// On met en forme les données : "val1,val2,val3" -> [val1, val2, val3] // On met en forme les données : "val1,val2,val3" -> [val1, val2, val3]
foreach($states as $s=>$state){ foreach($states as $s=>$state){
$chips[$c]['states'][$state['state']] = explode(',', $state['pin_values']); $chips[$c]['states'][$state['state']] = explode(',', $state['values']);
foreach($chips[$c]['states'][$state['state']] as $s2=>$state2) foreach($chips[$c]['states'][$state['state']] as $s2=>$state2)
$chips[$c]['states'][$state['state']][$s2] = intval($state2); $chips[$c]['states'][$state['state']][$s2] = intval($state2);
} }
@ -543,6 +540,7 @@
foreach($permissions as $p=>$permission){ foreach($permissions as $p=>$permission){
$actionList = explode(',', $permission['id_action']); $actionList = explode(',', $permission['id_action']);
foreach($actionList as $a=>$action) foreach($actionList as $a=>$action)
$actionList[$a] = intval($action); $actionList[$a] = intval($action);