+--------------------------------------------------------------------+
| CiviCRM version 5 |
+--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2019 |
+ | Copyright CiviCRM LLC (c) 2004-2020 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
/**
*
* @package CRM
- * @copyright CiviCRM LLC (c) 2004-2019
+ * @copyright CiviCRM LLC (c) 2004-2020
*/
/**
$ids = self::allWebsites($contactID);
foreach ($params as $key => $values) {
+ $id = CRM_Utils_Array::value('id', $values);
+ if (array_key_exists($id, $ids)) {
+ unset($ids[$id]);
+ }
if (empty($values['id']) && is_array($ids) && !empty($ids)) {
foreach ($ids as $id => $value) {
if (($value['website_type_id'] == $values['website_type_id'])) {
$values['id'] = $id;
+ unset($ids[$id]);
}
}
}
return FALSE;
}
CRM_Utils_Hook::post('delete', 'Website', $id, $obj);
- $obj->free();
return TRUE;
}
*
* @return bool
*/
- public static function &getValues(&$params, &$values) {
- $websites = array();
+ public static function &getValues(&$params = [], &$values = []) {
+ $websites = [];
$website = new CRM_Core_DAO_Website();
$website->contact_id = $params['contact_id'];
$website->find();
$count = 1;
while ($website->fetch()) {
- $values['website'][$count] = array();
+ $values['website'][$count] = [];
CRM_Core_DAO::storeValues($website, $values['website'][$count]);
$websites[$count] = $values['website'][$count];
SELECT id, website_type_id
FROM civicrm_website
WHERE civicrm_website.contact_id = %1';
- $params = array(1 => array($id, 'Integer'));
+ $params = [1 => [$id, 'Integer']];
- $websites = $values = array();
+ $websites = $values = [];
$dao = CRM_Core_DAO::executeQuery($query, $params);
$count = 1;
while ($dao->fetch()) {
- $values = array(
+ $values = [
'id' => $dao->id,
'website_type_id' => $dao->website_type_id,
- );
+ ];
if ($updateBlankLocInfo) {
$websites[$count++] = $values;