Archive for March, 2007

VTiger – sort by custom columns

March 19th, 2007

Today I added a custom column to our vtiger install we use at Direct Finance – a custom data field: Loan Purpose. I added this custom field to Accounts, Leads and Contacts and Potentials – then mapped them to eachother (so data was kept as lead was converted).

Now in looking at leads, accounts, or contacts, I want to sort by that new field – but it’s not sortable by default – neither are the created and modified times – would be useful to sort by date modified or created…

1. Using phpmyadmin ( or something like it ) find the field name in the table of interest – for vtiger_accounts it was a new custom field called cf_461 – make sure to use the database field name, not the field label.

2. Edit Accounts.php, Contacts.php, and Leads.php (note the file name is the module name ending in “s” ) this is the line to modify:
var $sortby_fields = Array('accountname','city','website','phone','smownerid');
to something like:
var $sortby_fields = Array('cf_461','createdtime','accountname','city','website','phone','smownerid');

Now you can sort by your new custom field – or any field in that module when a custom view is created.

Installing vtiger on Dreamhost and Ace-host.net

March 17th, 2007

Dreamhost: Had to try a couple times – here is what worked:

  1. my .htaccess file:

    # use custom php.ini, but not fcgi
    Options +ExecCGI
    AddHandler php5-cgi .php
    Action php5-cgi /cgi-bin/php5.cgi
    
  2. If the install failed with “table creation failed”, then wipe out all tables in db, remove vtiger dir and start over with fresh copy of vtiger dir code. I have a codebase directory where I keep copies of code for deployment.

Ace-host.net: Ace-host.net is running PHP 5.2.x – starting with PHP 5.2, an object cannot be converted to a string anymore – the result though is many scripts that used to work are now broken.

  1. Import the database from a fresh install that was mysqldump’d – import and then config the config.inc.php file

  2. Follow the advice here at the vtiger forum – here are the contents of the entry:

    To fix the DateTime I did this which worked:

    1. In /modules/Calendar/Date.php

      • change class DateTime to class com_vtiger_DateTime

      • Then search and replace new DateTime with new com_vtiger_DateTime, about a dozen places in Date.php
    2. In /modules/Calendar/Appointment.php –same search and replace, two occurrences.
    3. In /include/utils/RecurringType.php — search and replace several times
  3. set up .htaccess to your liking

Useful software

March 15th, 2007

http://www.squidguard.org/index.html – linux firewall
http://www.ipcop.org/index.php – traffic firewall

Vtiger – add invoice ID to custom view field list

March 15th, 2007

Needed to create custom views that included the Invoice ID – seems to make sense.

The user “rexkenley” fixed it and posted here (Thanks!!!)

Just ensure that the field label is blank when inserting this into the vtiger_field table

INSERT INTO `vtiger_field` ( `tabid` , `fieldid` , `columnname` , `tablename` , `generatedtype` , `uitype` ,
`fieldname` , `fieldlabel` , `readonly` , `presence` , `selected` , `maximumlength` , `sequence` , `block` ,
 `displaytype` , `typeofdata` , `quickcreate` , `quickcreatesequence` , `info_type` )
VALUES ('23', NULL , 'invoiceid', 'vtiger_invoice', '1', '80', '', 'Invoice ID', '1', '0', '0', '100', '1', '69', '1', 'I~O',
 '1', NULL , 'BAS' 

Run shell_exec in WordPress and Drupal

March 5th, 2007

I found this out on accident – use nested includes to use shell_exec in WordPress and Drupal posts without any issues – I am using the Exec-PHP plugin.

* Tested with WordPress 2.1.2
* WordPress: Only works in Blog posts – not in a “page” – the PHP will not work.
* WordPress: Must use file path, not HTTP URL – see example below. URL’s will not work for the post.
* Drupal, tested as pages – works fine.

WordPress / Drupal Post text – use includes only:

<?php
include "/home/user/domain.com/ScriptDir/index.php";
?>

Contents of /home/user/domain.com/ScriptDir/index.php

<?php
include "/home/user/domain.com/ScriptDir/foo.php";
?>

Finally, the contents of /home/user/domain.com/ScriptDir/foo.php

<?php
shell_exec ( unix commands );
.. more verboten commands
?>

Mochabomb is Digg proof thanks to caching by WP Super Cache