+++ /dev/null
-<?php
-/*
- +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC. All rights reserved. |
- | |
- | This code is published under the GNU AGPLv3 license with some |
- | permitted exceptions and without any warranty. For full license |
- | and copyright information, see https://civicrm.org/licensing |
- +--------------------------------------------------------------------+
-*/
-
-/**
- * A PHP cron script to format all the addresses in the database. Currently
- * it only does geocoding if the geocode values are not set. At a later
- * stage we will also handle USPS address cleanup and other formatting
- * issues
- *
- */
-if (!(php_sapi_name() == 'cli' || (is_numeric($_SERVER['argc']) && $_SERVER['argc'] > 0))) {
- header("HTTP/1.0 404 Not Found");
- return;
-}
-define('THROTTLE_REQUESTS', 0);
-function run() {
- session_start();
-
- require_once '../civicrm.config.php';
- require_once 'CRM/Core/Config.php';
-
- $config = CRM_Core_Config::singleton();
-
- require_once 'Console/Getopt.php';
- $shortOptions = "n:p:k:pre";
- $longOptions = ['name=', 'pass=', 'key=', 'prefix='];
-
- $getopt = new Console_Getopt();
- $args = $getopt->readPHPArgv();
-
- array_shift($args);
- list($valid, $dontCare) = $getopt->getopt2($args, $shortOptions, $longOptions);
-
- $vars = [
- 'name' => 'n',
- 'pass' => 'p',
- 'key' => 'k',
- 'prefix' => 'pre',
- ];
-
- foreach ($vars as $var => $short) {
- $$var = NULL;
- foreach ($valid as $v) {
- if ($v[0] == $short || $v[0] == "--$var") {
- $$var = $v[1];
- break;
- }
- }
- if (!$$var) {
- $$var = $_REQUEST[$var] ?? NULL;
- }
- $_REQUEST[$var] = $$var;
- }
-
- // this does not return on failure
- // require_once 'CRM/Utils/System.php';
- CRM_Utils_System::authenticateScript(TRUE, $name, $pass);
-
- //log the execution of script
- CRM_Core_Error::debug_log_message('NormalizePhone.php');
-
- // process all phones
- processPhones($config, $prefix);
-}
-
-/**
- * @param $config
- * @param null $prefix
- */
-function processPhones(&$config, $prefix = NULL) {
- // ignore null phones and phones that already match what we are doing
- $query = "
-SELECT id, phone
-FROM civicrm_phone
-WHERE phone IS NOT NULL
-AND phone NOT REGEXP '^[[:digit:]]{3}-[[:digit:]]{3}-[[:digit:]]{4}$'
-";
-
- $dao = &CRM_Core_DAO::executeQuery($query);
-
- $updateQuery = "UPDATE civicrm_phone SET phone = %1 where id = %2";
- $params = [
- 1 => ['', 'String'],
- 2 => [0, 'Integer'],
- ];
- $totalPhone = $validPhone = $nonPrefixedPhone = 0;
- while ($dao->fetch()) {
- $newPhone = processPhone($dao->phone, $prefix);
- echo "$newPhone, {$dao->phone}\n";
- if ($newPhone !== FALSE) {
- $params[1][0] = $newPhone;
- $params[2][0] = $dao->id;
- CRM_Core_DAO::executeQuery($updateQuery, $params);
- echo "{$dao->phone}, $newPhone\n";
- }
- $totalPhone++;
- }
-}
-
-/**
- * @param $phone
- * @param null $prefix
- *
- * @return bool|string
- */
-function processPhone($phone, $prefix = NULL) {
- // eliminate all white space and non numeric charaters
- $cleanPhone = preg_replace('/[^\d]+/s', '', $phone);
-
- $len = strlen($cleanPhone);
- if ($prefix &&
- $len == 7
- ) {
- $cleanPhone = $prefix . $cleanPhone;
- }
- elseif ($len != 10) {
- return FALSE;
- }
-
- // now we have a 10 character string, lets return it as
- // ABC-DEF-GHIJ
- $cleanPhone = substr($cleanPhone, 0, 3) . "-" . substr($cleanPhone, 3, 3) . "-" . substr($cleanPhone, 6, 4);
-
- return ($cleanPhone == $phone) ? FALSE : $cleanPhone;
-}
-
-run();
-
+++ /dev/null
-<?php
-if (!(php_sapi_name() == 'cli' || (is_numeric($_SERVER['argc']) && $_SERVER['argc'] > 0))) {
- header("HTTP/1.0 404 Not Found");
- return;
-}
-require_once '../civicrm.config.php';
-require_once 'CRM/Core/Config.php';
-require_once 'CRM/Core/Error.php';
-$config = CRM_Core_Config::singleton();
-
-require_once 'CRM/Case/XMLProcessor/Report.php';
-$xmlProcessor = new CRM_Case_XMLProcessor_Report();
-$report = $xmlProcessor->getActivityInfo(102, 552);
-CRM_Core_Error::debug($report);
-exit();
-
-$xmlProcessor->run(104, 1, 'Substance Abuse', '15 Day Review');
-$params = [
- 'clientID' => 104,
- 'creatorID' => 108,
- 'standardTimeline' => 1,
- // activityTypeName means name here not label, and that is correct here (dev/core#1116-ok-name)
- 'activityTypeName' => 'Open Case',
- 'dueDateTime' => time(),
- 'caseID' => 1,
-];
-require_once 'CRM/Case/XMLProcessor/Process.php';
-$xmlProcessor = new CRM_Case_XMLProcessor_Process();
-
-$result = $xmlProcessor->get('Substance Abuse', 'CaseRoles');
-CRM_Core_Error::debug('Case Roles', $result);
-$result = $xmlProcessor->get('Substance Abuse', 'ActivityTypes');
-CRM_Core_Error::debug('Activity Types', $result);
-$result = $xmlProcessor->get('Substance Abuse', 'ActivitySets');
-CRM_Core_Error::debug('Activity Sets', $result);
-
-$xmlProcessor->run('Substance Abuse',
- $params
-);
-
-
-exit();
-
+++ /dev/null
-#!/usr/bin/env bash -v
-
-./setup.sh
-
-cd ../test/maxq
-
-# This script is used to run maxq generated test scripts.
-# Before running these scripts please see Common.py
-# In Common.py comment and uncomment the constants as per the need
-# Below commands use someof the modes of maxq. The modes used are :
-# The -r mode is for running maxq generated test scripts.
-# The -q mode is for quite mode while testing.
-# Instead of -q (quite mode), -d(debug mode) can be used.
-# For all other options, fire $ maxq --help
-
-
-############################
-# Test for Adding Contacts #
-############################
-
-maxq -q -r testAddContactIndividual.py
-maxq -q -r testAddContactHousehold.py
-maxq -q -r testAddContactOrganization.py
-
-#############################
-# Test for Editing Contacts #
-#############################
-
-maxq -q -r testEditContactIndividual.py
-maxq -q -r testEditContactHousehold.py
-maxq -q -r testEditContactOrganization.py
-
-#############################
-# Test for Viewing Contacts #
-#############################
-
-maxq -q -r testViewContactIndividual.py
-maxq -q -r testViewContactHousehold.py
-maxq -q -r testViewContactOrganization.py
-
-#############################################
-# Test for Relationship By Relationship Tab #
-#############################################
-
-maxq -q -r testAddRelByRelTab.py
-maxq -q -r testEditRelByRelTab.py
-maxq -q -r testViewRelByRelTab.py
-maxq -q -r testDisableEnableRelByRelTab.py
-maxq -q -r testDeleteRelByRelTab.py
-
-########################################
-# Test for Relationship By Contact Tab #
-#########################################
-
-maxq -q -r testAddRelByContactTab.py
-maxq -q -r testEditRelByContactTab.py
-
-###############################
-# Test for Group By Group Tab #
-###############################
-
-maxq -q -r testGroupAllByGroupTab.py
-maxq -q -r testGroupAllByContactTab.py
-
-#############################
-# Test for Tags By Tags Tab #
-#############################
-
-maxq -q -r testTagsAllByTagsTab.py
-
-##############################
-# Test for Notes By Note Tab #
-##############################
-
-maxq -q -r testAddNoteByNoteTab.py
-maxq -q -r testEditNoteByNoteTab.py
-maxq -q -r testViewNoteByNoteTab.py
-maxq -q -r testDeleteNoteByNoteTab.py
-
-#################################
-# Test for Notes By Contact Tab #
-#################################
-
-maxq -q -r testAddNoteByContactTab.py
-maxq -q -r testEditNoteByContactTab.py
-maxq -q -r testDeleteNoteByNoteTab.py
-
-#######################
-# Test for Admin Tags #
-#######################
-
-maxq -q -r testAdminAddTags.py
-maxq -q -r testAdminEditTags.py
-maxq -q -r testAdminDeleteTag.py
-
-################################
-# Test for Admin Location Type #
-################################
-
-maxq -q -r testAdminAddLocationType.py
-maxq -q -r testAdminEditLocationType.py
-maxq -q -r testAdminEnableDisableLocationType.py
-maxq -q -r testAdminDeleteLocationType.py
-
-##################################
-# Test for Admin Mobile Provider #
-##################################
-
-maxq -q -r testAdminAddMobileProvider.py
-maxq -q -r testAdminEditMobileProvider.py
-maxq -q -r testAdminEnableDisableMobileProvider.py
-maxq -q -r testAdminDeleteMobileProvider.py
-
-##############################
-# Test for Admin IM Provider #
-##############################
-
-maxq -q -r testAdminAddIMProvider.py
-maxq -q -r testAdminEditIMProvider.py
-maxq -q -r testAdminEnableDisableIMProvider.py
-maxq -q -r testAdminDeleteIMProvider.py
-
-#####################################
-# Test for Admin Relationship Types #
-#####################################
-
-maxq -q -r testAdminAddRel.py
-maxq -q -r testAdminEditRel.py
-maxq -q -r testAdminViewRel.py
-maxq -q -r testAdminEnableDisableRel.py
-maxq -q -r testAdminDeleteRel.py
-
-####################################
-# Test for Admin Custom Data Group #
-####################################
-
-maxq -q -r testAdminAddCustomDataGroup.py
-maxq -q -r testAdminEditCustomDataGroup.py
-maxq -q -r testAdminEnableDisableCustomDataGroup.py
-maxq -q -r testAdminPreviewCustomDataGroup.py
-
-####################################
-# Test for Admin Custom Data Field #
-####################################
-
-maxq -q -r testAdminAddCustomDataField.py
-maxq -q -r testAdminEditCustomDataField.py
-maxq -q -r testAdminEnableDisableCustomDataField.py
-maxq -q -r testAdminPreviewCustomDataField.py
-
-########################
-# Test for Custom Data #
-########################
-
-maxq -r -q testEditCustomDataInline.py
-
-#maxq -q -r adminDeleteCustomDataField.py
-#maxq -q -r adminDeleteCustomDataGroup.py
-
-##############################
-# Test for Admin CiviDonate #
-##############################
-
-###################
-# Contribute Mode #
-###################
-
-maxq -r testAdminAddCiviDonateContributeMode.py
-maxq -r testAdminEditCiviDonateContributeMode.py
-maxq -r testAdminDisableEnableCiviDonateContributeMode.py
-maxq -r testAdminDeleteCiviDonateContributeMode.py
-
-###################
-# Contribute Type #
-###################
-
-maxq -r testAdminAddCiviDonateContributeType.py
-maxq -r testAdminEditCiviDonateContributeType.py
-maxq -r testAdminDisableEnableCiviDonateContributeType.py
-maxq -r testAdminDeleteCiviDonateContributeType.py
-
-######################
-# Payment Instrument #
-######################
-
-maxq -r testAdminAddCiviDonatePaymentInstrument.py
-maxq -r testAdminEditCiviDonatePaymentInstrument.py
-maxq -r testAdminDisableEnableCiviDonatePaymentInstrument.py
-maxq -r testAdminDeleteCiviDonatePaymentInstrument.py
-
-##########################
-# Test for Basic Search #
-##########################
-
-maxq -q -r testSearchByLNameIndividual.py
-maxq -q -r testSearchByHNameHousehold.py
-maxq -q -r testSearchByONameOraganization.py
-maxq -q -r testSearchByNoCriteria.py
-maxq -q -r testSearchByGroup.py
-maxq -q -r testSearchByContactTagGroupName.py
-
-#############################
-# Test for Advanced Search #
-#############################
-
-maxq -q -r testAdvSearchByAllCriteria.py
-maxq -q -r testAdvSearchByContactName.py
-maxq -q -r testAdvSearchByContactGroupCategory.py