From 1200fb630c1dfc020db25e6583a56dd213719e8c Mon Sep 17 00:00:00 2001 From: damiankloip <damiankloip@1037976.no-reply.drupal.org> Date: Sun, 22 Jul 2012 22:45:19 +0200 Subject: [PATCH] Issue #1527778 by damiankloip: View::save needs to check for machine name before saving. Not reliant on vid only. --- lib/Drupal/views/View.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/Drupal/views/View.php b/lib/Drupal/views/View.php index 6a00fe99aae3..fbc653e33240 100644 --- a/lib/Drupal/views/View.php +++ b/lib/Drupal/views/View.php @@ -1828,6 +1828,11 @@ function save() { if ($this->vid == 'new') { $this->vid = NULL; } + // If there is no vid, check if a view with this machine name already exists. + elseif (empty($this->vid)) { + $vid = db_query("SELECT vid from {views_view} WHERE name = :name", array(':name' => $this->name))->fetchField(); + $this->vid = $vid ? $vid : NULL; + } $transaction = db_transaction(); -- GitLab