Skip to content

Commit 7629364

Browse files
authored
Merge pull request #3019 from Mips2648/fix-eqlogic-delete-confirmation
Fix eqlogic delete confirmation
2 parents adfd7d7 + cd4b305 commit 7629364

File tree

3 files changed

+22
-13
lines changed

3 files changed

+22
-13
lines changed

core/ajax/eqLogic.ajax.php

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525
}
2626

2727
ajax::init(array('uploadImage'));
28-
29-
if (init('action') == 'uploadImage') {
28+
29+
if (init('action') == 'uploadImage') {
3030
if (!isConnect('admin')) {
3131
throw new Exception(__('401 - Accès non autorisé', __FILE__));
3232
}
@@ -408,12 +408,15 @@
408408
if (isset($used['eqLogic' . $eqLogic->getId()])) {
409409
unset($used['eqLogic' . $eqLogic->getId()]);
410410
}
411+
if (isset($used['object' . $eqLogic->getObject_id()])) {
412+
unset($used['object' . $eqLogic->getObject_id()]);
413+
}
411414
foreach (($eqLogic->getCmd()) as $cmd) {
412415
if (isset($used['cmd' . $cmd->getId()])) {
413416
unset($used['cmd' . $cmd->getId()]);
414417
}
415418
$cmdData = array('node' => array(), 'link' => array());
416-
$cmdData = $cmd->getLinkData($cmdData, 0, 2);
419+
$cmdData = $cmd->getLinkData($cmdData, 0, 2, null, false);
417420
if (isset($cmdData['node']['eqLogic' . $eqLogic->getId()])) {
418421
unset($cmdData['node']['eqLogic' . $eqLogic->getId()]);
419422
}
@@ -422,6 +425,10 @@
422425
}
423426
if (count($cmdData['node']) > 0) {
424427
foreach ($cmdData['node'] as $name => $data) {
428+
if (cmd::byId(str_replace('cmd', '', $data['id']))->getEqLogic_id() == $eqLogic->getId()) {
429+
continue;
430+
}
431+
425432
$data['sourceName'] = $cmd->getName();
426433
$used[$name . $cmd->getName()] = $data;
427434
}

core/class/cmd.class.php

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -992,10 +992,10 @@ public function formatValue($_value, $_quote = false) {
992992
$_value = 0;
993993
}
994994
if (trim($_value) == '' && $_value !== false && $_value !== 0) {
995-
if($this->getSubType() == 'numeric'){
995+
if ($this->getSubType() == 'numeric') {
996996
return 0;
997997
}
998-
if($this->getSubType() == 'binary'){
998+
if ($this->getSubType() == 'binary') {
999999
return 0;
10001000
}
10011001
return '';
@@ -2812,7 +2812,7 @@ public function exportApi() {
28122812
return $return;
28132813
}
28142814

2815-
public function getLinkData(&$_data = array('node' => array(), 'link' => array()), $_level = 0, $_drill = null) {
2815+
public function getLinkData(&$_data = array('node' => array(), 'link' => array()), $_level = 0, $_drill = null, $_include_use = true) {
28162816
if ($_drill === null) {
28172817
$_drill = config::byKey('graphlink::cmd::drill');
28182818
}
@@ -2838,7 +2838,6 @@ public function getLinkData(&$_data = array('node' => array(), 'link' => array()
28382838
'url' => $this->getEqLogic()->getLinkToConfiguration(),
28392839
);
28402840
$usedBy = $this->getUsedBy();
2841-
$use = $this->getUse();
28422841
addGraphLink($this, 'cmd', $usedBy['scenario'], 'scenario', $_data, $_level, $_drill);
28432842
foreach ($usedBy['plugin'] as $key => $value) {
28442843
addGraphLink($this, 'cmd', $value, $key, $_data, $_level, $_drill);
@@ -2849,18 +2848,21 @@ public function getLinkData(&$_data = array('node' => array(), 'link' => array()
28492848
addGraphLink($this, 'cmd', $usedBy['plan'], 'plan', $_data, $_level, $_drill, array('dashvalue' => '2,6', 'lengthfactor' => 0.6));
28502849
addGraphLink($this, 'cmd', $usedBy['plan3d'], 'plan3d', $_data, $_level, $_drill, array('dashvalue' => '2,6', 'lengthfactor' => 0.6));
28512850
addGraphLink($this, 'cmd', $usedBy['view'], 'view', $_data, $_level, $_drill, array('dashvalue' => '2,6', 'lengthfactor' => 0.6));
2852-
addGraphLink($this, 'cmd', $use['scenario'], 'scenario', $_data, $_level, $_drill);
2853-
addGraphLink($this, 'cmd', $use['eqLogic'], 'eqLogic', $_data, $_level, $_drill);
2854-
addGraphLink($this, 'cmd', $use['cmd'], 'cmd', $_data, $_level, $_drill);
2855-
addGraphLink($this, 'cmd', $use['dataStore'], 'dataStore', $_data, $_level, $_drill);
2851+
if ($_include_use) {
2852+
$use = $this->getUse();
2853+
addGraphLink($this, 'cmd', $use['scenario'], 'scenario', $_data, $_level, $_drill);
2854+
addGraphLink($this, 'cmd', $use['eqLogic'], 'eqLogic', $_data, $_level, $_drill);
2855+
addGraphLink($this, 'cmd', $use['cmd'], 'cmd', $_data, $_level, $_drill);
2856+
addGraphLink($this, 'cmd', $use['dataStore'], 'dataStore', $_data, $_level, $_drill);
2857+
}
28562858
addGraphLink($this, 'cmd', $this->getEqLogic(), 'eqLogic', $_data, $_level, $_drill, array('dashvalue' => '1,0', 'lengthfactor' => 0.6));
28572859
return $_data;
28582860
}
28592861

28602862
public function getUsedBy($_array = false) {
28612863
$return = array('cmd' => array(), 'eqLogic' => array(), 'scenario' => array(), 'plan' => array(), 'view' => array());
28622864
$cmds = array_merge(self::searchConfiguration('#' . $this->getId() . '#'), cmd::byValue($this->getId()));
2863-
if(is_array($cmds) && count($cmds) > 0){
2865+
if (is_array($cmds) && count($cmds) > 0) {
28642866
foreach ($cmds as $cmd) {
28652867
$return['cmd'][$cmd->getId()] = $cmd;
28662868
}

core/js/plugin.template.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,7 @@ if (!jeeFrontEnd.pluginTemplate) {
411411
success: function(data) {
412412
var text = '{{Êtes-vous sûr de vouloir supprimer l\'équipement}} ' + textEqtype + ' <b>' + document.querySelector('.eqLogicAttr[data-l1key="name"]').jeeValue() + '</b> ?'
413413
if (Object.keys(data).length > 0) {
414-
text += ' </br> {{Il est utilisé par ou utilise :}}</br>'
414+
text += ' </br> {{Il est utilisé par:}}</br>'
415415
var complement = null
416416
for (var i in data) {
417417
complement = ''

0 commit comments

Comments
 (0)