BAO - Deprecate setIsActive BAO functions
authorColeman Watts <coleman@civicrm.org>
Sun, 2 Apr 2023 00:38:51 +0000 (20:38 -0400)
committerColeman Watts <coleman@civicrm.org>
Sun, 2 Apr 2023 20:09:26 +0000 (16:09 -0400)
44 files changed:
CRM/ACL/BAO/ACL.php
CRM/ACL/BAO/ACLEntityRole.php
CRM/Badge/BAO/Layout.php
CRM/Campaign/BAO/Campaign.php
CRM/Campaign/BAO/Survey.php
CRM/Contact/BAO/ContactType.php
CRM/Contact/BAO/Group.php
CRM/Contact/BAO/RelationshipType.php
CRM/Contribute/BAO/ContributionPage.php
CRM/Contribute/BAO/Premium.php
CRM/Contribute/BAO/Product.php
CRM/Core/BAO/ActionSchedule.php
CRM/Core/BAO/CustomField.php
CRM/Core/BAO/CustomGroup.php
CRM/Core/BAO/Job.php
CRM/Core/BAO/LocationType.php
CRM/Core/BAO/MessageTemplate.php
CRM/Core/BAO/Navigation.php
CRM/Core/BAO/OptionGroup.php
CRM/Core/BAO/OptionValue.php
CRM/Core/BAO/UFField.php
CRM/Core/BAO/UFGroup.php
CRM/Event/BAO/Event.php
CRM/Event/BAO/ParticipantStatusType.php
CRM/Financial/BAO/FinancialAccount.php
CRM/Financial/BAO/FinancialType.php
CRM/Financial/BAO/PaymentProcessor.php
CRM/Financial/BAO/PaymentProcessorType.php
CRM/Mailing/BAO/MailingComponent.php
CRM/Member/BAO/MembershipStatus.php
CRM/Member/BAO/MembershipType.php
CRM/Price/BAO/PriceField.php
CRM/Price/BAO/PriceFieldValue.php
CRM/Price/BAO/PriceSet.php
CRM/SMS/BAO/Provider.php
tests/phpunit/CRM/Contribute/BAO/ContributionPageTest.php
tests/phpunit/CRM/Contribute/BAO/ContributionTypeTest.php
tests/phpunit/CRM/Contribute/BAO/ProductTest.php
tests/phpunit/CRM/Core/BAO/CustomGroupTest.php
tests/phpunit/CRM/Event/BAO/ParticipantStatusTest.php
tests/phpunit/CRM/Financial/BAO/FinancialAccountTest.php
tests/phpunit/CRM/Financial/BAO/FinancialTypeTest.php
tests/phpunit/CRM/Member/BAO/MembershipStatusTest.php
tests/phpunit/CRM/Member/BAO/MembershipTypeTest.php

index 89067de60a4c7a86268dfebe954fe87cf9da331c..ab3497f4a7ff77890b43d293974eb033f96b66fe 100644 (file)
@@ -175,21 +175,13 @@ SELECT acl.*
   }
 
   /**
-   * Update the is_active flag in the db.
-   *
+   * @deprecated - this bypasses hooks.
    * @param int $id
-   *   Id of the database record.
    * @param bool $is_active
-   *   Value we want to set the is_active field.
-   *
    * @return bool
-   *   true if we found and updated the object, else false
    */
   public static function setIsActive($id, $is_active) {
-    Civi::cache('fields')->flush();
-    // reset ACL and system caches.
-    CRM_Core_BAO_Cache::resetCaches();
-
+    CRM_Core_Error::deprecatedFunctionWarning('writeRecord');
     return CRM_Core_DAO::setFieldValue('CRM_ACL_DAO_ACL', $id, 'is_active', $is_active);
   }
 
index a892cf4ac70dac8d3cd1f8ad8dc021b1ea7755ac..26ae773ad1c28479570a474bd01bf1c299655c4f 100644 (file)
@@ -61,17 +61,13 @@ class CRM_ACL_BAO_ACLEntityRole extends CRM_ACL_DAO_ACLEntityRole {
   }
 
   /**
-   * Update the is_active flag in the db.
-   *
+   * @deprecated - this bypasses hooks.
    * @param int $id
-   *   Id of the database record.
    * @param bool $is_active
-   *   Value we want to set the is_active field.
-   *
    * @return bool
-   *   true if we found and updated the object, else false
    */
   public static function setIsActive($id, $is_active) {
+    CRM_Core_Error::deprecatedFunctionWarning('writeRecord');
     return CRM_Core_DAO::setFieldValue(__CLASS__, $id, 'is_active', $is_active);
   }
 
index dd34add77a4f53a18cc21196fc3ee618e751233b..c146c3a49c18a95def1ab0aefb261cfaaf559d9c 100644 (file)
@@ -30,17 +30,13 @@ class CRM_Badge_BAO_Layout extends CRM_Core_DAO_PrintLabel {
   }
 
   /**
-   * Update the is_active flag in the db.
-   *
+   * @deprecated - this bypasses hooks.
    * @param int $id
-   *   Id of the database record.
    * @param bool $is_active
-   *   Value we want to set the is_active field.
-   *
    * @return bool
-   *   true if we found and updated the object, else false
    */
   public static function setIsActive($id, $is_active) {
+    CRM_Core_Error::deprecatedFunctionWarning('writeRecord');
     return CRM_Core_DAO::setFieldValue('CRM_Core_DAO_PrintLabel', $id, 'is_active', $is_active);
   }
 
index 8229c944cf44c29e26cf202daf3410a7e93b7825..ee01e49e3efb276a287cf758b550ebbd4059ef6e 100644 (file)
@@ -481,17 +481,13 @@ INNER JOIN  civicrm_group grp ON ( grp.id = campgrp.entity_id )
   }
 
   /**
-   * Update the is_active flag in the db.
-   *
+   * @deprecated - this bypasses hooks.
    * @param int $id
-   *   Id of the database record.
    * @param bool $is_active
-   *   Value we want to set the is_active field.
-   *
    * @return bool
-   *   true if we found and updated the object, else false
    */
   public static function setIsActive($id, $is_active) {
+    CRM_Core_Error::deprecatedFunctionWarning('writeRecord');
     return CRM_Core_DAO::setFieldValue('CRM_Campaign_DAO_Campaign', $id, 'is_active', $is_active);
   }
 
index c6b0bd2aaa09fb8e2904b013a5899d89e52bdf4c..3f42995ee092e33eac2ec982848fec935a05cde4 100644 (file)
@@ -341,17 +341,13 @@ SELECT  survey.id    as id,
   }
 
   /**
-   * Update the is_active flag in the db.
-   *
+   * @deprecated - this bypasses hooks.
    * @param int $id
-   *   Id of the database record.
    * @param bool $is_active
-   *   Value we want to set the is_active field.
-   *
    * @return bool
-   *   true if we found and updated the object, else false
    */
   public static function setIsActive($id, $is_active) {
+    CRM_Core_Error::deprecatedFunctionWarning('writeRecord');
     return CRM_Core_DAO::setFieldValue('CRM_Campaign_DAO_Survey', $id, 'is_active', $is_active);
   }
 
index 05f9177e4c2ed60805099804c628c94710c66d9e..77eaa894070a747a216275b15459322b6839598a 100644 (file)
@@ -588,17 +588,13 @@ WHERE contact_sub_type LIKE '%{$subType}%'";
   }
 
   /**
-   * Update the is_active flag in the db.
-   *
+   * @deprecated - this bypasses hooks.
    * @param int $id
-   *   Id of the database record.
    * @param bool $is_active
-   *   Value we want to set the is_active field.
-   *
    * @return bool
-   *   true if we found and updated the object, else false
    */
   public static function setIsActive($id, $is_active) {
+    CRM_Core_Error::deprecatedFunctionWarning('writeRecord');
     $params = ['id' => $id];
     self::retrieve($params, $contactinfo);
     $params = ['name' => "New $contactinfo[name]"];
index 38131496c8824aca2128b52558a0b0bb34e01b57..27c5a65f2fd72ed7e4c1da90fbe63633db20aa63 100644 (file)
@@ -541,15 +541,10 @@ class CRM_Contact_BAO_Group extends CRM_Contact_DAO_Group {
   }
 
   /**
-   * Update the is_active flag in the db.
-   *
+   * @deprecated - this bypasses hooks.
    * @param int $id
-   *   Id of the database record.
    * @param bool $isActive
-   *   Value we want to set the is_active field.
-   *
    * @return bool
-   *   true if we found and updated the object, else false
    */
   public static function setIsActive($id, $isActive) {
     return CRM_Core_DAO::setFieldValue('CRM_Contact_DAO_Group', $id, 'is_active', $isActive);
index 3059ac9e49b53f34520b244dc74b190697bdb982..e74b475c3d112f70137aa7b78d7332dc7d8f33b8 100644 (file)
@@ -38,17 +38,13 @@ class CRM_Contact_BAO_RelationshipType extends CRM_Contact_DAO_RelationshipType
   }
 
   /**
-   * Update the is_active flag in the db.
-   *
+   * @deprecated - this bypasses hooks.
    * @param int $id
-   *   Id of the database record.
    * @param bool $is_active
-   *   Value we want to set the is_active field.
-   *
    * @return bool
-   *   true if we found and updated the object, else false
    */
   public static function setIsActive($id, $is_active) {
+    CRM_Core_Error::deprecatedFunctionWarning('writeRecord');
     return CRM_Core_DAO::setFieldValue('CRM_Contact_DAO_RelationshipType', $id, 'is_active', $is_active);
   }
 
index 9945d10286a0dee6d5f2bcb1668700aab2926609..43a401bdf0afa01126a42be158e4e631352f4fff 100644 (file)
@@ -53,19 +53,13 @@ class CRM_Contribute_BAO_ContributionPage extends CRM_Contribute_DAO_Contributio
   }
 
   /**
-   * Update the is_active flag in the db.
-   *
    * @deprecated - this bypasses hooks.
-   *
    * @param int $id
-   *   Id of the database record.
    * @param bool $is_active
-   *   Value we want to set the is_active field.
-   *
    * @return bool
-   *   true if we found and updated the object, else false
    */
   public static function setIsActive($id, $is_active) {
+    CRM_Core_Error::deprecatedFunctionWarning('writeRecord');
     return CRM_Core_DAO::setFieldValue('CRM_Contribute_DAO_ContributionPage', $id, 'is_active', $is_active);
   }
 
index 4b03e896a5fa80890515edb1f535c65ca65c3606..2f648474de4b119f8248242d5a89f454ff622aab 100644 (file)
@@ -37,17 +37,13 @@ class CRM_Contribute_BAO_Premium extends CRM_Contribute_DAO_Premium {
   }
 
   /**
-   * Update the is_active flag in the db.
-   *
+   * @deprecated - this bypasses hooks.
    * @param int $id
-   *   Id of the database record.
    * @param bool $is_active
-   *   Value we want to set the is_active field.
-   *
    * @return bool
-   *   true if we found and updated the object, else false
    */
   public static function setIsActive($id, $is_active) {
+    CRM_Core_Error::deprecatedFunctionWarning('writeRecord');
     return CRM_Core_DAO::setFieldValue('CRM_Contribute_DAO_Premium', $id, 'premiums_active ', $is_active);
   }
 
index 754106904e0dd4830d40dba798f6d97829e5a018..f4f6f5f4dcbc618c177e734dad9cb242ba139f10 100644 (file)
@@ -44,16 +44,13 @@ class CRM_Contribute_BAO_Product extends CRM_Contribute_DAO_Product {
   }
 
   /**
-   * Update the is_active flag in the db.
-   *
+   * @deprecated - this bypasses hooks.
    * @param int $id
-   *   Id of the database record.
    * @param bool $is_active
-   *   Value we want to set the is_active field.
-   *
    * @return bool
    */
   public static function setIsActive($id, $is_active) {
+    CRM_Core_Error::deprecatedFunctionWarning('writeRecord');
     if (!$is_active) {
       $dao = new CRM_Contribute_DAO_PremiumsProduct();
       $dao->product_id = $id;
index dbbeeac111889c39e925d1cc25226761e4e995e2..d22b86c2c2675e35937059bc34800e320254d4cf 100644 (file)
@@ -216,17 +216,13 @@ FROM civicrm_action_schedule cas
   }
 
   /**
-   * Update the is_active flag in the db.
-   *
+   * @deprecated - this bypasses hooks.
    * @param int $id
-   *   Id of the database record.
    * @param bool $is_active
-   *   Value we want to set the is_active field.
-   *
    * @return bool
-   *   true if we found and updated the object, else false
    */
   public static function setIsActive($id, $is_active) {
+    CRM_Core_Error::deprecatedFunctionWarning('writeRecord');
     return CRM_Core_DAO::setFieldValue('CRM_Core_DAO_ActionSchedule', $id, 'is_active', $is_active);
   }
 
index cf05c109b2e9c0700f6e1a073e8eabe792da7873..5da3581da90d8736618e9f3e298d72bc085c030d 100644 (file)
@@ -263,18 +263,13 @@ class CRM_Core_BAO_CustomField extends CRM_Core_DAO_CustomField {
   }
 
   /**
-   * Update the is_active flag in the db.
-   *
+   * @deprecated - this bypasses hooks.
    * @param int $id
-   *   Id of the database record.
    * @param bool $is_active
-   *   Value we want to set the is_active field.
-   *
    * @return bool
-   *   true if we found and updated the object, else false
    */
   public static function setIsActive($id, $is_active) {
-
+    CRM_Core_Error::deprecatedFunctionWarning('writeRecord');
     CRM_Utils_System::flushCache();
 
     //enable-disable CustomField
index 50aeb3dea2c54544ec3a79c0c4f09b328bbbad39..a4a33744a60c749ccb82fd8efb264ee62ad1da01 100644 (file)
@@ -251,17 +251,13 @@ class CRM_Core_BAO_CustomGroup extends CRM_Core_DAO_CustomGroup implements \Civi
   }
 
   /**
-   * Update the is_active flag in the db.
-   *
+   * @deprecated - this bypasses hooks.
    * @param int $id
-   *   Id of the database record.
    * @param bool $is_active
-   *   Value we want to set the is_active field.
-   *
    * @return bool
-   *   true if we found and updated the object, else false
    */
   public static function setIsActive($id, $is_active) {
+    CRM_Core_Error::deprecatedFunctionWarning('writeRecord');
     // reset the cache
     Civi::cache('fields')->flush();
     // reset ACL and system caches.
index c8c849d381c16bf4d101147f1c7bd823e86af252..1f8fd506fbaac79d509a66a0da3ce8f4c8f8d6bb 100644 (file)
@@ -52,17 +52,13 @@ class CRM_Core_BAO_Job extends CRM_Core_DAO_Job {
   }
 
   /**
-   * Update the is_active flag in the db.
-   *
+   * @deprecated - this bypasses hooks.
    * @param int $id
-   *   Id of the database record.
    * @param bool $is_active
-   *   Value we want to set the is_active field.
-   *
    * @return bool
-   *   true if we found and updated the object, else false
    */
   public static function setIsActive($id, $is_active) {
+    CRM_Core_Error::deprecatedFunctionWarning('writeRecord');
     return CRM_Core_DAO::setFieldValue('CRM_Core_DAO_Job', $id, 'is_active', $is_active);
   }
 
index 3200e149d1cea27cce26bda5bcba0a493c84598c..6493470d3db97857245aac9dcffd5716923de152 100644 (file)
@@ -44,17 +44,13 @@ class CRM_Core_BAO_LocationType extends CRM_Core_DAO_LocationType implements \Ci
   }
 
   /**
-   * Update the is_active flag in the db.
-   *
+   * @deprecated - this bypasses hooks.
    * @param int $id
-   *   Id of the database record.
    * @param bool $is_active
-   *   Value we want to set the is_active field.
-   *
    * @return bool
-   *   true if we found and updated the object, else false
    */
   public static function setIsActive($id, $is_active) {
+    CRM_Core_Error::deprecatedFunctionWarning('writeRecord');
     return CRM_Core_DAO::setFieldValue('CRM_Core_DAO_LocationType', $id, 'is_active', $is_active);
   }
 
index be77c649dd7426ed0cf4f771c5e2869f1ee9537f..9b70920b2d8a619e9ff2a032b2c5a3b424ffe42f 100644 (file)
@@ -43,17 +43,13 @@ class CRM_Core_BAO_MessageTemplate extends CRM_Core_DAO_MessageTemplate implemen
   }
 
   /**
-   * Update the is_active flag in the db.
-   *
+   * @deprecated - this bypasses hooks.
    * @param int $id
-   *   Id of the database record.
    * @param bool $is_active
-   *   Value we want to set the is_active field.
-   *
    * @return bool
-   *   true if we found and updated the object, else false
    */
   public static function setIsActive($id, $is_active) {
+    CRM_Core_Error::deprecatedFunctionWarning('writeRecord');
     return CRM_Core_DAO::setFieldValue('CRM_Core_DAO_MessageTemplate', $id, 'is_active', $is_active);
   }
 
index 1f4345fbeeb55795d8b35ef86cdbcaec6cb3b945..ae9a0e318067c2bc144cb697e76249283c9fbeb9 100644 (file)
@@ -56,17 +56,13 @@ class CRM_Core_BAO_Navigation extends CRM_Core_DAO_Navigation {
   }
 
   /**
-   * Update the is_active flag in the db.
-   *
+   * @deprecated - this bypasses hooks.
    * @param int $id
-   *   Id of the database record.
    * @param bool $is_active
-   *   Value we want to set the is_active field.
-   *
    * @return bool
-   *   true if we found and updated the object, else false
    */
   public static function setIsActive($id, $is_active) {
+    CRM_Core_Error::deprecatedFunctionWarning('writeRecord');
     return CRM_Core_DAO::setFieldValue('CRM_Core_DAO_Navigation', $id, 'is_active', $is_active);
   }
 
index ff28aacc77697defa6f3a3032f0f3048dc4f820d..bd3ffe9c3368b13c7965d07223158e6d6204e809 100644 (file)
@@ -34,17 +34,13 @@ class CRM_Core_BAO_OptionGroup extends CRM_Core_DAO_OptionGroup implements \Civi
   }
 
   /**
-   * Update the is_active flag in the db.
-   *
+   * @deprecated - this bypasses hooks.
    * @param int $id
-   *   Id of the database record.
    * @param bool $is_active
-   *   Value we want to set the is_active field.
-   *
    * @return bool
-   *   true if we found and updated the object, else false
    */
   public static function setIsActive($id, $is_active) {
+    CRM_Core_Error::deprecatedFunctionWarning('writeRecord');
     return CRM_Core_DAO::setFieldValue('CRM_Core_DAO_OptionGroup', $id, 'is_active', $is_active);
   }
 
index cd9c7e0fd92c5b5c01aa5157102627e9761340c5..622fca1c20de5709110ddb275cc98ea94adc6f47 100644 (file)
@@ -107,15 +107,10 @@ class CRM_Core_BAO_OptionValue extends CRM_Core_DAO_OptionValue implements \Civi
   }
 
   /**
-   * Update the is_active flag in the db.
-   *
+   * @deprecated - this bypasses hooks.
    * @param int $id
-   *   Id of the database record.
    * @param bool $is_active
-   *   Value we want to set the is_active field.
-   *
    * @return bool
-   *   true if we found and updated the object, else false
    */
   public static function setIsActive($id, $is_active) {
     return CRM_Core_DAO::setFieldValue('CRM_Core_DAO_OptionValue', $id, 'is_active', $is_active);
index 82cfeb08580e55950d00a90c4528b8d67b30ddc9..5ade83e12f2b2f945adf0cc5c91fabb60771af78 100644 (file)
@@ -131,15 +131,10 @@ class CRM_Core_BAO_UFField extends CRM_Core_DAO_UFField {
   }
 
   /**
-   * Update the is_active flag in the db.
-   *
+   * @deprecated - this bypasses hooks.
    * @param int $id
-   *   Id of the database record.
    * @param bool $is_active
-   *   Value we want to set the is_active field.
-   *
    * @return bool
-   *   true if we found and updated the object, else false
    */
   public static function setIsActive($id, $is_active) {
     //check if custom data profile field is disabled
index 0d121267dc666fa14e290d9450f6ba2ed59167ae..aa471362cea8bc558fc1150f14ca968d3d6bff6c 100644 (file)
@@ -94,15 +94,10 @@ class CRM_Core_BAO_UFGroup extends CRM_Core_DAO_UFGroup implements \Civi\Core\Ho
   }
 
   /**
-   * Update the is_active flag in the db.
-   *
+   * @deprecated - this bypasses hooks.
    * @param int $id
-   *   Id of the database record.
    * @param bool $is_active
-   *   Value we want to set the is_active field.
-   *
    * @return bool
-   *   true if we found and updated the object, else false
    */
   public static function setIsActive($id, $is_active) {
     return CRM_Core_DAO::setFieldValue('CRM_Core_DAO_UFGroup', $id, 'is_active', $is_active);
index 55503aad232d2bca1253b28b5d22addf2e1a2086..6b9154a1734577355a0d0090513ca4c4a61032b2 100644 (file)
@@ -34,17 +34,13 @@ class CRM_Event_BAO_Event extends CRM_Event_DAO_Event implements \Civi\Core\Hook
   }
 
   /**
-   * Update the is_active flag in the db.
-   *
+   * @deprecated - this bypasses hooks.
    * @param int $id
-   *   Id of the database record.
    * @param bool $is_active
-   *   Value we want to set the is_active field.
-   *
    * @return bool
-   *   true if we found and updated the object, else false
    */
   public static function setIsActive($id, $is_active) {
+    CRM_Core_Error::deprecatedFunctionWarning('writeRecord');
     return CRM_Core_DAO::setFieldValue('CRM_Event_DAO_Event', $id, 'is_active', $is_active);
   }
 
index bd773993e51f0778556eb7bd1440317a6038a34e..4c0941166fb70a7abfa5f107fab568ec241935eb 100644 (file)
@@ -88,12 +88,13 @@ class CRM_Event_BAO_ParticipantStatusType extends CRM_Event_DAO_ParticipantStatu
   }
 
   /**
+   * @deprecated - this bypasses hooks.
    * @param int $id
-   * @param $isActive
-   *
+   * @param bool $isActive
    * @return bool
    */
   public static function setIsActive($id, $isActive) {
+    CRM_Core_Error::deprecatedFunctionWarning('writeRecord');
     return CRM_Core_DAO::setFieldValue('CRM_Event_BAO_ParticipantStatusType', $id, 'is_active', $isActive);
   }
 
index 5e04cda5c29547d591bc14eaaa79670901d4cab9..88b9b879b98566f7af146ad9c6307c2562d37bc3 100644 (file)
@@ -34,17 +34,13 @@ class CRM_Financial_BAO_FinancialAccount extends CRM_Financial_DAO_FinancialAcco
   }
 
   /**
-   * Update the is_active flag in the db.
-   *
+   * @deprecated - this bypasses hooks.
    * @param int $id
-   *   Id of the database record.
    * @param bool $is_active
-   *   Value we want to set the is_active field.
-   *
    * @return bool
-   *   true if we found and updated the object, else false
    */
   public static function setIsActive($id, $is_active) {
+    CRM_Core_Error::deprecatedFunctionWarning('writeRecord');
     return CRM_Core_DAO::setFieldValue('CRM_Financial_DAO_FinancialAccount', $id, 'is_active', $is_active);
   }
 
index d02b7c8fe80665f976dab993902675ecb96f69fe..bb2cc98d7f0f041d110e330ec2a111f930161c82 100644 (file)
@@ -49,16 +49,13 @@ class CRM_Financial_BAO_FinancialType extends CRM_Financial_DAO_FinancialType im
   }
 
   /**
-   * Update the is_active flag in the db.
-   *
+   * @deprecated - this bypasses hooks.
    * @param int $id
-   *   Id of the database record.
    * @param bool $is_active
-   *   Value we want to set the is_active field.
-   *
    * @return bool
    */
   public static function setIsActive($id, $is_active) {
+    CRM_Core_Error::deprecatedFunctionWarning('writeRecord');
     return CRM_Core_DAO::setFieldValue('CRM_Financial_DAO_FinancialType', $id, 'is_active', $is_active);
   }
 
index 0f82508439bbf272d87b2832ff3d0964b129a96f..986adf5573222904bcfc80d4e94d779b6beaa070 100644 (file)
@@ -90,17 +90,13 @@ class CRM_Financial_BAO_PaymentProcessor extends CRM_Financial_DAO_PaymentProces
   }
 
   /**
-   * Update the is_active flag in the db.
-   *
+   * @deprecated - this bypasses hooks.
    * @param int $id
-   *   Id of the database record.
    * @param bool $is_active
-   *   Value we want to set the is_active field.
-   *
    * @return bool
-   *   true if we found and updated the object, else false
    */
   public static function setIsActive($id, $is_active) {
+    CRM_Core_Error::deprecatedFunctionWarning('writeRecord');
     return CRM_Core_DAO::setFieldValue('CRM_Financial_DAO_PaymentProcessor', $id, 'is_active', $is_active);
   }
 
index 83f0a4491f6ba8737b671569e8a16ff5f691a379..356dc2bb59ed8ccf9f3da972f641573fa93f30cc 100644 (file)
@@ -40,15 +40,10 @@ class CRM_Financial_BAO_PaymentProcessorType extends CRM_Financial_DAO_PaymentPr
   }
 
   /**
-   * Update the is_active flag in the db.
-   *
+   * @deprecated - this bypasses hooks.
    * @param int $id
-   *   Id of the database record.
    * @param bool $is_active
-   *   Value we want to set the is_active field.
-   *
    * @return bool
-   *   true if we found and updated the object, else false
    */
   public static function setIsActive($id, $is_active) {
     return CRM_Core_DAO::setFieldValue('CRM_Financial_DAO_PaymentProcessorType', $id, 'is_active', $is_active);
index 96d3c8e6240bb9eac41e0ce84e76546ac1601404..72c75cb63a0b0cbf90fac0070c9ce51c9a01fa3a 100644 (file)
@@ -34,17 +34,13 @@ class CRM_Mailing_BAO_MailingComponent extends CRM_Mailing_DAO_MailingComponent
   }
 
   /**
-   * Update the is_active flag in the db.
-   *
+   * @deprecated - this bypasses hooks.
    * @param int $id
-   *   Id of the database record.
    * @param bool $is_active
-   *   Value we want to set the is_active field.
-   *
    * @return bool
-   *   true if we found and updated the object, else false
    */
   public static function setIsActive($id, $is_active) {
+    CRM_Core_Error::deprecatedFunctionWarning('writeRecord');
     return CRM_Core_DAO::setFieldValue('CRM_Mailing_DAO_MailingComponent', $id, 'is_active', $is_active);
   }
 
index 7c791d5812fa630421cc314ddda8cf3dc8d13eaa..a2e889541258281398f02408549053fae31a7a83 100644 (file)
@@ -34,17 +34,13 @@ class CRM_Member_BAO_MembershipStatus extends CRM_Member_DAO_MembershipStatus im
   }
 
   /**
-   * Update the is_active flag in the db.
-   *
+   * @deprecated - this bypasses hooks.
    * @param int $id
-   *   Id of the database record.
    * @param bool $is_active
-   *   Value we want to set the is_active field.
-   *
    * @return bool
-   *   true if we found and updated the object, else false
    */
   public static function setIsActive($id, $is_active) {
+    CRM_Core_Error::deprecatedFunctionWarning('writeRecord');
     return CRM_Core_DAO::setFieldValue('CRM_Member_DAO_MembershipStatus', $id, 'is_active', $is_active);
   }
 
index 789eebe74dd1ecc83d50bc03abe32c962b6be380..d51f768d7ff558f86eb58a7d711a717dd1560a1e 100644 (file)
@@ -42,17 +42,13 @@ class CRM_Member_BAO_MembershipType extends CRM_Member_DAO_MembershipType implem
   }
 
   /**
-   * Update the is_active flag in the db.
-   *
+   * @deprecated - this bypasses hooks.
    * @param int $id
-   *   Id of the database record.
    * @param bool $is_active
-   *   Value we want to set the is_active field.
-   *
    * @return bool
-   *   true if we found and updated the object, else false
    */
   public static function setIsActive($id, $is_active) {
+    CRM_Core_Error::deprecatedFunctionWarning('writeRecord');
     return CRM_Core_DAO::setFieldValue('CRM_Member_DAO_MembershipType', $id, 'is_active', $is_active);
   }
 
index b76d95c3211afe7e538b0bc135210b3d680f4c1c..f0163d150fe6483c2bf7ce3332106e7564505823 100644 (file)
@@ -187,15 +187,10 @@ class CRM_Price_BAO_PriceField extends CRM_Price_DAO_PriceField {
   }
 
   /**
-   * Update the is_active flag in the db.
-   *
+   * @deprecated - this bypasses hooks.
    * @param int $id
-   *   Id of the database record.
    * @param bool $is_active
-   *   Value we want to set the is_active field.
-   *
    * @return bool
-   *   true if we found and updated the object, else false
    */
   public static function setIsActive($id, $is_active) {
     return CRM_Core_DAO::setFieldValue('CRM_Price_DAO_PriceField', $id, 'is_active', $is_active);
index dd614637cd20c23dda489061cb3e4800836d316b..70e150d5001fbae27f558842d2840ed41e299915 100644 (file)
@@ -182,15 +182,10 @@ class CRM_Price_BAO_PriceFieldValue extends CRM_Price_DAO_PriceFieldValue {
   }
 
   /**
-   * Update the is_active flag in the db.
-   *
+   * @deprecated - this bypasses hooks.
    * @param int $id
-   *   Id of the database record.
    * @param bool $is_active
-   *   Value we want to set the is_active field.
-   *
    * @return bool
-   *   true if we found and updated the object, else false
    */
   public static function setIsActive($id, $is_active) {
     return CRM_Core_DAO::setFieldValue('CRM_Price_DAO_PriceFieldValue', $id, 'is_active', $is_active);
index 982115ed82c6fa8aff25ad6e7559b3edd909c2c9..a5840caee43215d660565cf13d18294a4fa98714 100644 (file)
@@ -86,16 +86,13 @@ class CRM_Price_BAO_PriceSet extends CRM_Price_DAO_PriceSet {
   }
 
   /**
-   * Update the is_active flag in the db.
-   *
+   * @deprecated - this bypasses hooks.
    * @param int $id
-   *   Id of the database record.
-   * @param $isActive
-   *
+   * @param bool $isActive
    * @return bool
-   *   true if we found and updated the object, else false
    */
   public static function setIsActive($id, $isActive) {
+    CRM_Core_Error::deprecatedFunctionWarning('writeRecord');
     return CRM_Core_DAO::setFieldValue('CRM_Price_DAO_PriceSet', $id, 'is_active', $isActive);
   }
 
index f820b10430d62f52afc58118be5385dba59772b8..11b16e97fbfef4ce506ec7077050d2af73fde032 100644 (file)
@@ -103,12 +103,13 @@ class CRM_SMS_BAO_Provider extends CRM_SMS_DAO_Provider {
   }
 
   /**
+   * @deprecated - this bypasses hooks.
    * @param int $id
-   * @param $is_active
-   *
+   * @param bool $is_active
    * @return bool
    */
   public static function setIsActive($id, $is_active) {
+    CRM_Core_Error::deprecatedFunctionWarning('writeRecord');
     return CRM_Core_DAO::setFieldValue('CRM_SMS_DAO_Provider', $id, 'is_active', $is_active);
   }
 
index 6961b681c1c2cfc2fad548ba46630f49b784a096..da86515a93697de43d21a7e6acf9672bc9906431 100644 (file)
@@ -52,25 +52,6 @@ class CRM_Contribute_BAO_ContributionPageTest extends CiviUnitTestCase {
     $this->callAPISuccess('ContributionPage', 'delete', ['id' => $contributionpage->id]);
   }
 
-  /**
-   *  test setIsActive() method
-   */
-  public function testsetIsActive() {
-
-    $params = [
-      'title' => 'Test Contribution Page',
-      'financial_type_id' => self::FINANCIAL_TYPE_ID,
-      'is_active' => 1,
-    ];
-
-    $contributionpage = CRM_Contribute_BAO_ContributionPage::create($params);
-    $id = $contributionpage->id;
-    $is_active = 1;
-    $pageActive = CRM_Contribute_BAO_ContributionPage::setIsActive($id, $is_active);
-    $this->assertEquals($pageActive, TRUE, 'Verify financial types record deletion.');
-    $this->callAPISuccess('ContributionPage', 'delete', ['id' => $contributionpage->id]);
-  }
-
   /**
    * Test setValues() method
    */
index fe9bce3f1cb635826e3b03cef700c55fc0b97a92..a14714659d35aeb8d41f3acfb38e47c24376e07e 100644 (file)
@@ -44,24 +44,4 @@ class CRM_Contribute_BAO_ContributionTypeTest extends CiviUnitTestCase {
     $this->assertEquals($result, 'Donations', 'Verify financial type name.');
   }
 
-  /**
-   * Check method setIsActive()
-   */
-  public function testSetIsActive() {
-    $params = [
-      'name' => 'Donations',
-      'is_deductible' => 0,
-      'is_active' => 1,
-    ];
-    $contributionType = CRM_Financial_BAO_FinancialType::writeRecord($params);
-    $result = CRM_Financial_BAO_FinancialType::setIsActive($contributionType->id, 0);
-    $this->assertEquals($result, TRUE, 'Verify financial type record updation for is_active.');
-
-    $isActive = $this->assertDBNotNull('CRM_Financial_BAO_FinancialType', $contributionType->id,
-      'is_active', 'id',
-      'Database check on updated for financial type is_active.'
-    );
-    $this->assertEquals($isActive, 0, 'Verify financial types is_active.');
-  }
-
 }
index e630e357062261c485bbd8b36f367a5ef2dad487..b87dc2bffc975d45bb36d37e480eb7ff3f6ba116 100644 (file)
@@ -59,31 +59,6 @@ class CRM_Contribute_BAO_ProductTest extends CiviUnitTestCase {
     $this->assertEquals(empty($result), FALSE, 'Verify products record.');
   }
 
-  /**
-   * Check method setIsActive( )
-   */
-  public function testSetIsActive() {
-    $params = [
-      'name' => 'Test Product',
-      'sku' => 'TP-10',
-      'imageOption' => 'noImage',
-      'price' => 12,
-      'cost' => 5,
-      'min_contribution' => 5,
-      'is_active' => 1,
-    ];
-
-    $product = CRM_Contribute_BAO_Product::create($params);
-    CRM_Contribute_BAO_Product::setIsActive($product->id, 0);
-
-    $isActive = $this->assertDBNotNull('CRM_Contribute_BAO_Product', $product->id,
-      'is_active', 'id',
-      'Database check on updated for product records is_active.'
-    );
-
-    $this->assertEquals($isActive, 0, 'Verify product records is_active.');
-  }
-
   /**
    * Check method del( )
    */
index 7b28c94dbd2c9fa044d189a00a58c06424aa9665..f7abbdd37d11c1bdbb36eef63e5fb4a3a4da6960 100644 (file)
@@ -190,35 +190,6 @@ class CRM_Core_BAO_CustomGroupTest extends CiviUnitTestCase {
     $this->getAndCheck($groupParams, $customGroup['id'], 'CustomGroup');
   }
 
-  /**
-   * Test setIsActive()
-   */
-  public function testSetIsActive() {
-    $customGroupTitle = 'My Custom Group';
-    $groupParams = [
-      'title' => $customGroupTitle,
-      'name' => 'my_custom_group',
-      'style' => 'Tab',
-      'extends' => 'Individual',
-      'is_active' => 0,
-    ];
-
-    $customGroup = $this->customGroupCreate($groupParams);
-    $customGroupId = $customGroup['id'];
-
-    //update is_active
-    $result = CRM_Core_BAO_CustomGroup::setIsActive($customGroupId, TRUE);
-
-    //check for object update
-    $this->assertEquals(TRUE, $result);
-    //check for is_active
-    $this->assertDBCompareValue('CRM_Core_DAO_CustomGroup', $customGroupId, 'is_active', 'id', 1,
-      'Database check for custom group is_active field.'
-    );
-
-    $this->customGroupDelete($customGroup['id']);
-  }
-
   /**
    * Test getGroupDetail() with Empty Params
    */
index f70b6f95884d51e728864227886004bf7ccd3025..7ed735291c843f4351cf6e6f1fc8692039aa7a6c 100644 (file)
@@ -111,31 +111,4 @@ class CRM_Event_BAO_ParticipantStatusTest extends CiviUnitTestCase {
     }
   }
 
-  /**
-   * SetIsActive() method of participant status type
-   */
-  public function testSetIsActiveStatusType() {
-
-    $params = [
-      'name' => 'testStatus',
-      'label' => 'testParticipant',
-      'class' => 'Positive',
-      'is_active' => 0,
-      'is_counted' => 1,
-      'weight' => 15,
-      'visibility_id' => 1,
-    ];
-
-    $statusType = CRM_Event_BAO_ParticipantStatusType::create($params);
-    $isActive = 1;
-
-    // set participant status type active
-    CRM_Event_BAO_ParticipantStatusType::setIsActive($statusType->id, $isActive);
-
-    // compare expected value in db
-    $this->assertDBCompareValue('CRM_Event_DAO_ParticipantStatusType', $statusType->id, 'is_Active',
-      'id', $isActive, 'Check DB for is_Active value'
-    );
-  }
-
 }
index 9811c2af9d37c29a94421df92ce9399fe4f971f5..2b6100a29477ac8493255e0fb7eb226e86223d6f 100644 (file)
@@ -63,29 +63,6 @@ class CRM_Financial_BAO_FinancialAccountTest extends CiviUnitTestCase {
     $this->assertEquals($result->name, 'Donations', 'Verify financial account name.');
   }
 
-  /**
-   * Check method setIsActive()
-   */
-  public function testSetIsActive() {
-    $params = [
-      'name' => 'Donations',
-      'is_deductible' => 0,
-      'is_active' => 1,
-    ];
-    $financialAccount = CRM_Financial_BAO_FinancialAccount::writeRecord($params);
-    $result = CRM_Financial_BAO_FinancialAccount::setIsActive($financialAccount->id, 0);
-    $this->assertEquals($result, TRUE, 'Verify financial account record updation for is_active.');
-
-    $isActive = $this->assertDBNotNull(
-      'CRM_Financial_BAO_FinancialAccount',
-      $financialAccount->id,
-      'is_active',
-      'id',
-      'Database check on updated for financial account is_active.'
-    );
-    $this->assertEquals($isActive, 0, 'Verify financial account is_active.');
-  }
-
   /**
    * Check method del()
    *
index ceac27811b216c745bf9c55343192981efe21761..7496eddb6ef2a2c8214f0942fcb19088954e7ae7 100644 (file)
@@ -27,29 +27,6 @@ class CRM_Financial_BAO_FinancialTypeTest extends CiviUnitTestCase {
     parent::tearDown();
   }
 
-  /**
-   * Check method setIsActive().
-   *
-   * @throws \CRM_Core_Exception
-   */
-  public function testSetIsActive(): void {
-    $financialTypeID = FinancialType::create()->setValues([
-      'name' => 'Donations',
-      'is_deductible' => 0,
-      'is_active' => 1,
-    ])->execute()->first()['id'];
-    $result = CRM_Financial_BAO_FinancialType::setIsActive($financialTypeID, 0);
-    $this->assertEquals(TRUE, $result, 'Verify financial type record updated for is_active.');
-    $isActive = $this->assertDBNotNull(
-      'CRM_Financial_DAO_FinancialType',
-      $financialTypeID,
-      'is_active',
-      'id',
-      'Database check on updated for financial type is_active.'
-    );
-    $this->assertEquals(0, $isActive, 'Verify financial types is_active.');
-  }
-
   /**
    * Delete test for testGitLabIssue1108.
    *
index cf1dd5b1f4063dfe6ed459cbab727bd0a4a6e81a..f7eaabbdef1f2227967261d74c412d087a6a1de6 100644 (file)
@@ -72,24 +72,6 @@ class CRM_Member_BAO_MembershipStatusTest extends CiviUnitTestCase {
     $this->assertEquals($result, 'Changed Status', 'Verify updated membership status label From PseudoConstant.');
   }
 
-  public function testSetIsActive() {
-
-    $params = [
-      'name' => 'added',
-      'is_active' => 1,
-    ];
-
-    $this->ids['MembershipStatus'][0] = $this->callAPISuccess('MembershipStatus', 'create', $params)['id'];
-    $result = CRM_Member_BAO_MembershipStatus::setIsActive($this->ids['MembershipStatus'][0], 0);
-    $this->assertEquals($result, TRUE, 'Verify membership status record updated.');
-
-    $isActive = $this->assertDBNotNull('CRM_Member_BAO_MembershipStatus', $this->ids['MembershipStatus'][0],
-      'is_active', 'id',
-      'Database check on updated membership status record.'
-    );
-    $this->assertEquals($isActive, 0, 'Verify membership status is_active.');
-  }
-
   public function testGetMembershipStatus() {
     $params = [
       'name' => 'added',
index 4037b9f82e1a84ab475e50b7bf47f4345b53baa9..a9074985d6d069ca25c2afeb621d4a74dd7b4338 100644 (file)
@@ -107,37 +107,6 @@ class CRM_Member_BAO_MembershipTypeTest extends CiviUnitTestCase {
     $this->assertEquals('General', $result->name, 'Verify membership type name.');
   }
 
-  /**
-   * Test setIsActive.
-   *
-   * @throws \CRM_Core_Exception
-   */
-  public function testSetIsActive(): void {
-    $params = [
-      'name' => 'General',
-      'description' => NULL,
-      'domain_id' => 1,
-      'minimum_fee' => 100,
-      'duration_unit' => 'year',
-      'period_type' => 'fixed',
-      'duration_interval' => 1,
-      'member_of_contact_id' => $this->ids['Contact']['organization'],
-      'financial_type_id:name' => 'Donation',
-      'relationship_type_id' => $this->ids['RelationshipType'][0],
-      'visibility' => 'Public',
-      'is_active' => 1,
-    ];
-    $membershipID = MembershipType::create()->setValues($params)->execute()->first()['id'];
-
-    CRM_Member_BAO_MembershipType::setIsActive($membershipID, 0);
-
-    $isActive = $this->assertDBNotNull('CRM_Member_BAO_MembershipType', $membershipID,
-      'is_active', 'id',
-      'Database check on membership type status.'
-    );
-    $this->assertEquals(0, $isActive, 'Verify membership type status.');
-  }
-
   /**
    * Test delete.
    *