<?php
/**
- +--------------------------------------------------------------------+
- | CiviCRM version 4.7 |
- +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2015 |
- +--------------------------------------------------------------------+
- | This file is a part of CiviCRM. |
- | |
- | CiviCRM is free software; you can copy, modify, and distribute it |
- | under the terms of the GNU Affero General Public License |
- | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
- | |
- | CiviCRM is distributed in the hope that it will be useful, but |
- | WITHOUT ANY WARRANTY; without even the implied warranty of |
- | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
- | See the GNU Affero General Public License for more details. |
- | |
- | You should have received a copy of the GNU Affero General Public |
- | License and the CiviCRM Licensing Exception along |
- | with this program; if not, contact CiviCRM LLC |
- | at info[AT]civicrm[DOT]org. If you have questions about the |
- | GNU Affero General Public License or the licensing of CiviCRM, |
- | see the CiviCRM license FAQ at http://civicrm.org/licensing |
- +--------------------------------------------------------------------+
-*/
+ * +--------------------------------------------------------------------+
+ * | CiviCRM version 4.7 |
+ * +--------------------------------------------------------------------+
+ * | Copyright CiviCRM LLC (c) 2004-2015 |
+ * +--------------------------------------------------------------------+
+ * | This file is a part of CiviCRM. |
+ * | |
+ * | CiviCRM is free software; you can copy, modify, and distribute it |
+ * | under the terms of the GNU Affero General Public License |
+ * | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
+ * | |
+ * | CiviCRM is distributed in the hope that it will be useful, but |
+ * | WITHOUT ANY WARRANTY; without even the implied warranty of |
+ * | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
+ * | See the GNU Affero General Public License for more details. |
+ * | |
+ * | You should have received a copy of the GNU Affero General Public |
+ * | License and the CiviCRM Licensing Exception along |
+ * | with this program; if not, contact CiviCRM LLC |
+ * | at info[AT]civicrm[DOT]org. If you have questions about the |
+ * | GNU Affero General Public License or the licensing of CiviCRM, |
+ * | see the CiviCRM license FAQ at http://civicrm.org/licensing |
+ * +--------------------------------------------------------------------+
+ */
/**
*
/**
* Class constructor
*/
- function __construct() {
+ public function __construct() {
// initialize all the vars
$this->numIndividual = self::INDIVIDUAL_PERCENT * self::NUM_CONTACT / 100;
$this->numHousehold = self::HOUSEHOLD_PERCENT * self::NUM_CONTACT / 100;
1 => array(
1 => 'Mrs.',
2 => 'Ms.',
- 4 => 'Dr.'
+ 4 => 'Dr.',
),
// Male
2 => array(
3 => 'Mr.',
4 => 'Dr.',
- )
+ ),
);
private $suffix = array(1 => 'Jr.', 2 => 'Sr.', 3 => 'II', 4 => 'III');
private $gender = array(1 => 'female', 2 => 'male');
* @return string
*/
- // get a randomly generated string
+ /**
+ * get a randomly generated string
+ */
private function randomString($size = 32) {
$string = "";
}
if (!$items) {
echo "Error: no items found for '$key'\n";
- return;
+ return FALSE;
}
return $items[mt_rand(0, count($items) - 1)];
}
/**
* Fetch contact type based on stored mapping
* @param $id
- * @return
+ * @return string $type
*/
private function getContactType($id) {
foreach (array('Individual', 'Household', 'Organization') as $type) {
$params['street_address'] = $params['street_number'] . $params['street_number_suffix'] . " " . $params['street_name'] . " " . $params['street_type'] . " " . $params['street_number_postdirectional'];
-
if ($params['location_type_id'] == self::MAIN) {
$params['supplemental_address_1'] = $this->randomItem('supplemental_addresses_1');
}
* @return array
*/
private function _addWebsite($cid, $name) {
- $part = array_pad(split(' ', strtolower($name)), 3, '');
+ $part = array_pad(explode(' ', strtolower($name)), 3, '');
if (count($part) > 3) {
// Abbreviate the place name if it's two words
$domain = $part[0][0] . $part[1][0] . $part[2] . $part[3];
case 1:
$domain = $part[0] . $part[1] . $part[2];
break;
+
case 2:
$domain = $part[0] . $part[1];
break;
+
case 3:
$domain = $part[0] . $part[2];
break;
case 1:
$email = $first . $last;
break;
+
case 2:
$email = "$last.$first";
break;
+
case 3:
$email = $last . $f;
break;
+
case 4:
$email = $first . $l;
break;
+
case 5:
$email = "$last.$m$first";
break;
+
case 6:
$email = "$f$m$last";
break;
// always add members
$groupContact->status = 'Added';
-
$subscriptionHistory = new CRM_Contact_DAO_SubscriptionHistory();
$subscriptionHistory->contact_id = $groupContact->contact_id;
/**
* @return array
*/
- function getZipCodeInfo() {
+ public function getZipCodeInfo() {
if (!$this->stateMap) {
$query = 'SELECT id, name, abbreviation from civicrm_state_province where country_id = 1228';
*
* @return array
*/
- static function getLatLong($zipCode) {
+ public static function getLatLong($zipCode) {
$query = "http://maps.google.com/maps?q=$zipCode&output=js";
$userAgent = "Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0";
*
* @return string
*/
- static function repairDate($date) {
+ public static function repairDate($date) {
$dropArray = array('-' => '', ':' => '', ' ' => '');
return strtr($date, $dropArray);
}
'contribution_id' => $result->contribution_id,
'to_financial_account_id' => empty($financialAccountId[$result->payment_instrument_id]) ? $defaultFinancialAccount : $financialAccountId[$result->payment_instrument_id],
'payment_instrument_id' => $result->payment_instrument_id,
- 'check_number' => $result->check_number
+ 'check_number' => $result->check_number,
);
$trxn = CRM_Core_BAO_FinancialTrxn::create($trxnParams);
$financialItem = array(
'contact_id' => $result->contact_id,
'entity_table' => 'civicrm_line_item',
'description' => $result->label,
- 'financial_account_id' => $result->financial_account_id
+ 'financial_account_id' => $result->financial_account_id,
);
$trxnId['id'] = $trxn->id;
CRM_Financial_BAO_FinancialItem::create($financialItem, NULL, $trxnId);
";
$this->_query($sql);
}
+
}
/**