/**
  * Delete a field in DB
  * @param table the table
  * @param field the field to delete
  * @return nothing
  */
 static function deleteField($table, $field)
 {
     global $DB;
     //Remove field from displaypreferences
     self::deleteDisplayPreferences($table, $field);
     //If field exists, drop it !
     if (FieldExists($table, $field)) {
         $DB->query("ALTER TABLE `{$table}` DROP `{$field}`");
     }
     $table = getTableNameForForeignKeyField($field);
     //If dropdown is managed by the plugin
     if ($table != '' && preg_match('/plugin_genericobject_(.*)/', $table, $results)) {
         //Delete dropdown table
         $query = "DROP TABLE `{$table}`";
         $DB->query($query);
         //Delete dropdown files & class
         $name = getSingular($results[1]);
         PluginGenericobjectType::deleteClassFile($name);
         PluginGenericobjectType::deleteFormFile($name);
         PluginGenericobjectType::deletesearchFile($name);
     }
 }
Exemplo n.º 2
0
   /**
    * Delete a field in DB
    * @param table the table
    * @param field the field to delete
    * @return nothing
    */
   static function deleteField($table, $field) {
      global $DB;
      //If field exists, drop it !
      if (FieldExists($table, $field)) {
         _log("delete", $field, "from", $table);
         $DB->query("ALTER TABLE `$table` DROP `$field`");
      }

      $table = getTableNameForForeignKeyField($field);
      //If dropdown is managed by the plugin
      if ($table != '' && preg_match('/plugin_genericobject_(.*)/', $table, $results)) {
         //Delete dropdown table
         $query = "DROP TABLE `$table`";
         $DB->query($query);
         //Delete dropdown files & class
         $name = getSingular($results[1]);
         PluginGenericobjectType::deleteClassFile($name);
         PluginGenericobjectType::deleteFormFile($name);
         PluginGenericobjectType::deletesearchFile($name);
      }
   }