Explorar o código

clear deleted device models from device list

rajven %!s(int64=3) %!d(string=hai) anos
pai
achega
363772741f
Modificáronse 1 ficheiros con 4 adicións e 1 borrados
  1. 4 1
      html/admin/devices/devmodels.php

+ 4 - 1
html/admin/devices/devmodels.php

@@ -69,7 +69,10 @@ if (isset($_POST['remove'])) {
             $len_all = is_array($_POST['r_id']) ? count($_POST['r_id']) : 0;
             for ($j = 0; $j < $len_all; $j ++) {
                 if (intval($_POST['r_id'][$j]) != $save_id) { continue; }
-                if ($save_id>=10000) { delete_record($db_link, "device_models", "id='{$save_id}'", $new); }
+                if ($save_id>=10000) { 
+                    delete_record($db_link, "device_models", "id='{$save_id}'");
+                    run_sql($db_link,"UPDATE devices set device_model_id=NULL WHERE device_model_id=".$save_id);
+                    }
                 }
             }
         header("Location: " . $_SERVER["REQUEST_URI"]);