X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;ds=sidebyside;f=CRM%2FCore%2FBAO%2FWebsite.php;h=af12e416a6b156b1727b1dbeec466f01cbe6622e;hb=beccc0d657ee873b40b54af732aed9f5a368a36f;hp=aa6819640945e6250d9401521534ecdaa9799ff4;hpb=9dc26c0d802b1334431676647ddf88a90856a1f4;p=civicrm-core.git diff --git a/CRM/Core/BAO/Website.php b/CRM/Core/BAO/Website.php index aa68196409..af12e416a6 100644 --- a/CRM/Core/BAO/Website.php +++ b/CRM/Core/BAO/Website.php @@ -1,7 +1,7 @@ $values) { - $websiteId = CRM_Utils_Array::value('id', $values); - if ($websiteId) { - if (array_key_exists($websiteId, $ids)) { - unset($ids[$websiteId]); - } - else { - unset($values['id']); - } - } - - if (empty($values['id']) && - is_array($ids) && !empty($ids) - ) { + if (empty($values['id']) && is_array($ids) && !empty($ids)) { foreach ($ids as $id => $value) { - if (($value['website_type_id'] == $values['website_type_id']) && !empty($values['url'])) { + if (($value['website_type_id'] == $values['website_type_id'])) { $values['id'] = $id; - unset($ids[$id]); - break; } } } - $values['contact_id'] = $contactID; if (!empty($values['url'])) { + $values['contact_id'] = $contactID; self::add($values); } - } - - if ($skipDelete && !empty($ids)) { - self::del(array_keys($ids)); + elseif ($skipDelete && !empty($values['id'])) { + self::del(array($values['id'])); + } } } @@ -115,7 +98,7 @@ class CRM_Core_BAO_Website extends CRM_Core_DAO_Website { * @param array $ids * Website ids. * - * @return void + * @return bool */ public static function del($ids) { $query = 'DELETE FROM civicrm_website WHERE id IN ( ' . implode(',', $ids) . ')';