Changed pop_id in workflow for new PopNetwork table

This commit is contained in:
Frank Schubert
2024-01-09 17:17:22 +01:00
parent fba7c7f57b
commit 724ffcff84
2 changed files with 18 additions and 5 deletions

View File

@@ -144,8 +144,6 @@ class PopController extends mfBaseController
$oldPopnetworks = json_encode(PopNetworkModel::getbyPopid($new_id));
$result = array_diff($r->network_id, $oldPopnetworks);
if ($oldPopnetworks != json_encode($r->network_id)) {
PopNetworkModel::deletebyPopid($new_id);
unset($data);

View File

@@ -116,7 +116,14 @@ class PopModel
$db = FronkDB::singleton();
$where = self::getSqlFilter($filter);
$res = $db->select("Pop", "*", "$where ORDER BY name, network_id");
//$res = $db->select("Pop", "*", "$where ORDER BY name, network_id");
$sql = "SELECT Pop.* FROM Pop
LEFT JOIN PopNetwork ON (PopNetwork.pop_id = Pop.id)
WHERE $where
ORDER BY name, PopNetwork.network_id LIMIT 1
";
$res = $db->query($sql);
if ($db->num_rows($res)) {
$data = $db->fetch_object($res);
$item = new Pop($data);
@@ -135,7 +142,15 @@ class PopModel
$db = FronkDB::singleton();
$where = self::getSqlFilter($filter);
$res = $db->select("Pop", "*", "$where ORDER BY name, network_id");
$sql = "SELECT Pop.* FROM Pop
LEFT JOIN PopNetwork ON (PopNetwork.pop_id = Pop.id)
WHERE $where
ORDER BY name, PopNetwork.network_id";
$res = $db->query($sql);
//$res = $db->select("Pop", "*", "$where ORDER BY name, network_id");
if ($db->num_rows($res)) {
while ($data = $db->fetch_object($res)) {
$items[] = new Pop($data);
@@ -152,7 +167,7 @@ class PopModel
if (array_key_exists("network_id", $filter)) {
$networkid = $filter['network_id'];
if (is_numeric($networkid)) {
$where .= " AND network_id=$networkid";
$where .= " AND PopNetwork.network_id=$networkid";
}
}