Skip to content

Instantly share code, notes, and snippets.

View patpawlowski's full-sized avatar

Pat Pawlowski patpawlowski

  • W-Systems
  • United States
View GitHub Profile
@patpawlowski
patpawlowski / getdbbackup.php
Last active November 10, 2017 17:33
PHP Script to read a Sugar CRM configuration file, backup the database, and then gzip the backup
#! /usr/bin/env php
<?php
if(!isset($argv[1])){
die("Usage: php getdbbackup.php <path to config.php file>\nExample: php getdbbackup.php ../config.php");
}
require $argv[1];
print_r($sugar_config['dbconfig']);
$db_host_name = $sugar_config['dbconfig']['db_host_name'];
$db_user_name = $sugar_config['dbconfig']['db_user_name'];
@patpawlowski
patpawlowski / SugarPackager.php
Last active August 17, 2017 12:51
PHP Script convert a list of files into an installable sugar package
<?php
/**
* Created by NetBeans.
* User: patpawlowski
* Date: Dec 30, 2016 at 4:19:08 PM
* File: SugarPackager.php
* find custom/ -type f
* Curl: curl https://gitlab.w-systems.com/snippets/11/raw > SugarPackager.php
*
@patpawlowski
patpawlowski / sugar_create_field_list.php
Last active July 14, 2017 14:36
PHP Script to create a csv of Sugar module names, fields, and labels
<?php
/**
* Created by NetBeans.
* User: patpawlowski
* Date: Jul 14, 2017 at 10:09:28 AM
* File: sugar_create_field_list.php
* Directions: just execute the file in the root of a Sugar CRM instance.
* Tested on Sugar 7.8; I doubt it will work on 6.x.
* Execute: php sugar_create_field_list.php
@patpawlowski
patpawlowski / sugarbackupdownload.php
Last active June 30, 2017 03:54
PHP Script to download Sugar backups from the pbs_Backups module
<?php
/**
* Created by NetBeans.
* User: patpawlowski
* Date: Mar 3, 2017 at 3:25:54 PM <- My 51st birthday ;) -pat
* File: sugarbackupdownload.php
* Create: curl https://gist.github.com/patpawlowski/486ea6d6b84bb6b7e90c5474ae5f001c/raw/ce08c191c8b3656d8749ef15c446b706a786b02b/sugarbackupdownload.php > sugarbackupdownload
* Make Executable: chmod +xxx sugarbackupdownload
* Run: php sugarbackupdownload
@patpawlowski
patpawlowski / SugarAPI.class.php
Created January 7, 2017 00:16
Yet another Sugar REST API v10 Wrapper
<?php
/**
* Created by NetBeans.
* User: patpawlowski
* Date: Dec 20, 2014 at 9:44:51 AM
* File: SugarAPI
*/
class SugarAPI{
private $oauthtoken = FALSE;
/*
Written by: Patrick Pawlowski
Company: Ticomix
Created On: 2016.06.10
Requires: https://gist.github.com/patpawlowski/eac1482fb346175c726fc41821cd9e1e#file-goldmine-contacts-view-sql
*/
Select ac.CONTACT, ea.CONTSUPREF + isnull(ea.ADDRESS1, '') EmailAddress
from CONTSUPP ac
left join CONTSUPP ea on ac.recid = ea.LINKACCT and ea.RECTYPE = 'P' and ea.CONTACT = 'E-mail Address'
@patpawlowski
patpawlowski / GoldMine Contacts View.sql
Last active June 11, 2016 13:46
GoldMine Contacts SQL View to combine Contact1, Contact2, and prmary email address from ContSupp
/*
Written by: Patrick Pawlowski
Company: Ticomix
Created On: 2012.04.20
*/
IF EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[Contacts]'))
DROP VIEW [dbo].[Contacts]
GO
@patpawlowski
patpawlowski / RTF2TXTfn.sql
Last active February 14, 2024 16:00
VERY simple SQL RTF to TXT converter primarily to convert Act notes to plain text
/*
Written by: patpawlowski
Created On: Oct 26, 2015 at 4:51:52 PM
Description: This is a rough attempt to create a funciton to strip the markup from
the Act TBL_NOTE.NOTETEXT field. It appears to work for what I need
but could probably use some work with the escaped characters.
It's not particularly fast but it is faster than other solutions I've come
across. It takes about 4 seconds to parse 2700 records.
<?php
/*
* Be sure to set the timezone in the calling script
* date_default_timezone_set('America/Chicago');
*
* require_once('ProgressTracker.class.php');
*
*
*/
class progressTracker{
@patpawlowski
patpawlowski / GoldMine CONTACT2 Data Integrity Checks.sql
Last active August 29, 2015 14:06
GoldMine CONTACT2 Data Integrity Checks 2014
-- ((( CONTACT2 Data Integrity Checks )))
/* --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
CONTACT2 Integrity Check
ALL of the following queries should return NO results. If ANY results are returned, then something is wrong.
If the first query returns results, here are your options: