X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FCore%2FBAO%2FMapping.php;h=7857c4bfd5c9f7cff9015ed7d5ae517e951120d4;hb=8d469992190aa62e0241bb124f8de3a65033f9aa;hp=cbca237afb691caf385d7040f31342e91056a140;hpb=e51b7372633401e369de7dca3807f1c29d00ad86;p=civicrm-core.git diff --git a/CRM/Core/BAO/Mapping.php b/CRM/Core/BAO/Mapping.php index cbca237afb..7857c4bfd5 100644 --- a/CRM/Core/BAO/Mapping.php +++ b/CRM/Core/BAO/Mapping.php @@ -23,7 +23,7 @@ | GNU Affero General Public License or the licensing of CiviCRM, | | see the CiviCRM license FAQ at http://civicrm.org/licensing | +--------------------------------------------------------------------+ -*/ + */ /** * @@ -35,14 +35,14 @@ class CRM_Core_BAO_Mapping extends CRM_Core_DAO_Mapping { /** - * Class constructor + * Class constructor. */ public function __construct() { parent::__construct(); } /** - * Fetch object based on array of properties + * Fetch object based on array of properties. * * @param array $params * (reference ) an assoc array of name/value pairs. @@ -51,7 +51,6 @@ class CRM_Core_BAO_Mapping extends CRM_Core_DAO_Mapping { * * @return object * CRM_Core_DAO_Mapping object on success, otherwise NULL - * @static */ public static function retrieve(&$params, &$defaults) { $mapping = new CRM_Core_DAO_Mapping(); @@ -64,13 +63,12 @@ class CRM_Core_BAO_Mapping extends CRM_Core_DAO_Mapping { } /** - * Delete the mapping + * Delete the mapping. * * @param int $id * Mapping id. * - * @return boolean - * @static + * @return bool */ public static function del($id) { // delete from mapping_field table @@ -91,7 +89,7 @@ class CRM_Core_BAO_Mapping extends CRM_Core_DAO_Mapping { } /** - * Takes an associative array and creates a contact object + * Takes an associative array and creates a contact object. * * The function extract all the params it needs to initialize the create a * contact object. the params array could contain additional unused name/value @@ -102,7 +100,6 @@ class CRM_Core_BAO_Mapping extends CRM_Core_DAO_Mapping { * * @return object * CRM_Core_DAO_Mapper object on success, otherwise NULL - * @static */ public static function add($params) { $mapping = new CRM_Core_DAO_Mapping(); @@ -113,14 +110,13 @@ class CRM_Core_BAO_Mapping extends CRM_Core_DAO_Mapping { } /** - * Get the list of mappings + * Get the list of mappings. * * @param string $mappingTypeId * Mapping type id. * * @return array * array of mapping name - * @static */ public static function getMappings($mappingTypeId) { $mapping = array(); @@ -136,14 +132,13 @@ class CRM_Core_BAO_Mapping extends CRM_Core_DAO_Mapping { } /** - * Get the mapping fields + * Get the mapping fields. * * @param int $mappingId * Mapping id. * * @return array * array of mapping fields - * @static */ public static function getMappingFields($mappingId) { //mapping is to be loaded from database @@ -202,14 +197,14 @@ class CRM_Core_BAO_Mapping extends CRM_Core_DAO_Mapping { } /** - * Check Duplicate Mapping Name + * Check Duplicate Mapping Name. * * @param string $nameField * mapping Name. * @param string $mapTypeId * mapping Type. * - * @return boolean + * @return bool */ public static function checkMapping($nameField, $mapTypeId) { $mapping = new CRM_Core_DAO_Mapping(); @@ -226,7 +221,6 @@ class CRM_Core_BAO_Mapping extends CRM_Core_DAO_Mapping { * * @return array * associated array of elements - * @static */ public static function getFormattedFields($smartGroupId) { $returnFields = array(); @@ -251,7 +245,7 @@ class CRM_Core_BAO_Mapping extends CRM_Core_DAO_Mapping { } /** - * Build the mapping form + * Build the mapping form. * * @param CRM_Core_Form $form * @param string $mappingType @@ -263,7 +257,6 @@ class CRM_Core_BAO_Mapping extends CRM_Core_DAO_Mapping { * @param NULL $exportMode * * @return void - * @static */ public static function buildMappingForm(&$form, $mappingType = 'Export', $mappingId = NULL, $columnNo, $blockCount = 3, $exportMode = NULL) { if ($mappingType == 'Export') { @@ -370,7 +363,7 @@ class CRM_Core_BAO_Mapping extends CRM_Core_DAO_Mapping { foreach (array( 'groups', 'tags', - 'notes' + 'notes', ) as $value) { unset($fields['Individual'][$value]); unset($fields['Household'][$value]); @@ -395,7 +388,7 @@ class CRM_Core_BAO_Mapping extends CRM_Core_DAO_Mapping { $fields['Contact']['note_body'] = array('title' => $noteTitle . ': ' . ts('Body Only'), 'name' => 'note_body'); $fields['Contact']['note_subject'] = array( 'title' => $noteTitle . ': ' . ts('Subject Only'), - 'name' => 'note_subject' + 'name' => 'note_subject', ); } } @@ -479,8 +472,8 @@ class CRM_Core_BAO_Mapping extends CRM_Core_DAO_Mapping { $csRelationships = array(); if ($mappingType == 'Export') { - $subTypeRelationshipTypes = - CRM_Contact_BAO_Relationship::getContactRelationshipType(NULL, NULL, NULL, $val['parent'], + $subTypeRelationshipTypes + = CRM_Contact_BAO_Relationship::getContactRelationshipType(NULL, NULL, NULL, $val['parent'], FALSE, 'label', TRUE, $subType); foreach ($subTypeRelationshipTypes as $key => $var) { @@ -959,13 +952,13 @@ class CRM_Core_BAO_Mapping extends CRM_Core_DAO_Mapping { /** - * Function returns all Custom group Names + * Function returns all Custom group Names. * * @param int $customfieldId * Related file id. * - * @return null|string $customGroupName all custom group names - * @static + * @return null|string + * $customGroupName all custom group names */ public static function getCustomGroupName($customfieldId) { if ($customFieldId = CRM_Core_BAO_CustomField::getKeyID($customfieldId)) { @@ -991,7 +984,6 @@ class CRM_Core_BAO_Mapping extends CRM_Core_DAO_Mapping { * * @return array * formatted associated array of elements - * @static */ public static function formattedFields(&$params, $row = FALSE) { $fields = array(); @@ -1039,7 +1031,7 @@ class CRM_Core_BAO_Mapping extends CRM_Core_DAO_Mapping { if ($v[0] == 'Contribution' && substr($fldName, 0, 7) != 'custom_' && substr($fldName, 0, 10) != 'financial_' - ) { + && substr($fldName, 0, 8) != 'payment_') { if (substr($fldName, 0, 13) != 'contribution_') { $fldName = 'contribution_' . $fldName; } @@ -1117,8 +1109,6 @@ class CRM_Core_BAO_Mapping extends CRM_Core_DAO_Mapping { 0, ); } - - return $fields; } @@ -1190,7 +1180,6 @@ class CRM_Core_BAO_Mapping extends CRM_Core_DAO_Mapping { * Mapping id. * * @return NULL - * @static */ public static function saveMappingFields(&$params, $mappingId) { //delete mapping fields records for exixting mapping @@ -1199,7 +1188,7 @@ class CRM_Core_BAO_Mapping extends CRM_Core_DAO_Mapping { $mappingFields->delete(); if (empty($params['mapper'])) { - return; + return NULL; } //save record in mapping field table @@ -1271,4 +1260,5 @@ class CRM_Core_BAO_Mapping extends CRM_Core_DAO_Mapping { } } } + }