mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-29 16:55:05 +02:00
Solved issues in ModuleTemplates class
This commit is contained in:
parent
a6ce19db66
commit
a93812d1a8
@ -337,8 +337,10 @@ class ModuleTemplates extends HTML
|
|||||||
$success = false;
|
$success = false;
|
||||||
} else {
|
} else {
|
||||||
db_process_sql_delete('tnetwork_profile_pen', ['id_np' => $this->id_np]);
|
db_process_sql_delete('tnetwork_profile_pen', ['id_np' => $this->id_np]);
|
||||||
$pensList = explode(',', $this->pen);
|
if (empty($this->pen)) {
|
||||||
if (count($pensList) > 0) {
|
$success = true;
|
||||||
|
} else {
|
||||||
|
$pensList = explode(',', $this->pen);
|
||||||
// Set again the new PENs associated.
|
// Set again the new PENs associated.
|
||||||
foreach ($pensList as $currentPen) {
|
foreach ($pensList as $currentPen) {
|
||||||
$dbResult_pen = db_process_sql_insert(
|
$dbResult_pen = db_process_sql_insert(
|
||||||
@ -355,8 +357,6 @@ class ModuleTemplates extends HTML
|
|||||||
|
|
||||||
$success = true;
|
$success = true;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
$success = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -379,22 +379,26 @@ class ModuleTemplates extends HTML
|
|||||||
if ($dbResult_tnp != false) {
|
if ($dbResult_tnp != false) {
|
||||||
// Set the new id_np.
|
// Set the new id_np.
|
||||||
$this->id_np = $dbResult_tnp;
|
$this->id_np = $dbResult_tnp;
|
||||||
$pensList = explode(',', $this->pen);
|
if (empty($this->pen)) {
|
||||||
// Insert all of new PENs associated with this id_np.
|
|
||||||
foreach ($pensList as $currentPen) {
|
|
||||||
$dbResult_pen = db_process_sql_insert(
|
|
||||||
'tnetwork_profile_pen',
|
|
||||||
[
|
|
||||||
'pen' => $currentPen,
|
|
||||||
'id_np' => $this->id_np,
|
|
||||||
]
|
|
||||||
);
|
|
||||||
// If something is wrong, is better stop.
|
|
||||||
if ($dbResult_pen === false) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
$success = true;
|
$success = true;
|
||||||
|
} else {
|
||||||
|
$pensList = explode(',', $this->pen);
|
||||||
|
// Insert all of new PENs associated with this id_np.
|
||||||
|
foreach ($pensList as $currentPen) {
|
||||||
|
$dbResult_pen = db_process_sql_insert(
|
||||||
|
'tnetwork_profile_pen',
|
||||||
|
[
|
||||||
|
'pen' => $currentPen,
|
||||||
|
'id_np' => $this->id_np,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
// If something is wrong, is better stop.
|
||||||
|
if ($dbResult_pen === false) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
$success = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -527,8 +531,7 @@ class ModuleTemplates extends HTML
|
|||||||
// 2 arrays. 1 with the groups, 1 with the groups by parent
|
// 2 arrays. 1 with the groups, 1 with the groups by parent
|
||||||
$groups = [];
|
$groups = [];
|
||||||
$groups_compound = [];
|
$groups_compound = [];
|
||||||
// Default group filter.
|
|
||||||
$groups_compound[0] = 'Group - All';
|
|
||||||
foreach ($result as $row) {
|
foreach ($result as $row) {
|
||||||
$groups[$row['id_sg']] = $row['name'];
|
$groups[$row['id_sg']] = $row['name'];
|
||||||
}
|
}
|
||||||
@ -612,7 +615,7 @@ class ModuleTemplates extends HTML
|
|||||||
'script' => 'filterGroupComponents(event);',
|
'script' => 'filterGroupComponents(event);',
|
||||||
'class' => 'float-right',
|
'class' => 'float-right',
|
||||||
'fields' => $groups_compound,
|
'fields' => $groups_compound,
|
||||||
'nothing' => $groups_compound[$this->ncGroup],
|
'nothing' => 'Group - All',
|
||||||
'return' => true,
|
'return' => true,
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user