|
/SW/graphics:
Fixing Simple Photo Issues at the Command Line
(Without having to startup a huge program like gimp or photoshop.)
These utilities are also drawn from the ImageMagick[1] graphics suite. Imagemagick is available for all of Linux, Windows, and the Mac environment[2]. Some examples:
convert -rotate 90 image1.jpg image2.jpg
for i in *.jpg ; do convert $i -resize 800x800 ../convert-folder/$i ; done
This may take a while if you have a lot of photos. In this example, photos will be resized such that they have a maximum width or heighth of 800 pixels, with no change in aspect ratio.
mogrify -resize 600x500 -quality 70 Gabe.jpg
Note that the key difference between mogrify and convert are that morgify over-writes the original file, and convert writes to a different file.
convert input.jpg output.png
# convert -font helvetica -fill white -pointsize 36 \
-draw 'text 10,50 "This is the annotation text"' \
floriade.jpg comment.jpg
for img in *.jpg ; do convert -sample 25%x25% $img thumb-$img ; done
nice ionice -c3 find . -type f -name "*.jpg" -exec mogrify -resize 200x200 -quality 70 {} \;(Note that "nice" and "ionice" lower the priority of the operations' claim on CPU and disk resources, respectively. Especially useful for a production server.)
I have not yet found an Imagemagick manual that has the gift of making difficult tasks seem easy. Here[3][4][5] are some suggestions for manuals.
[1] http://www.imagemagick.org/script/index.php
[2] http://www.imagemagick.org/script/binary-releases.php
[3] http://www.imagemagick.org/script/command-line-tools.php
[4] http://linux.about.com/library/cmd/blcmdl1_ImageMagick.htm
[5] http://www.imagemagick.org/Usage/
posted at: 09:22 | path: /SW/graphics | permanent link to this entry
/SW/business/Drupal:
Drupal Migrate Module Basics
The Drupal migrate module[1] is an impressive tool for migrating databases from other web applications (or anywhere, really) into the Drupal database. It even has fairly impressive documentation[2], but not unlike a lot of other big chunks of documentation, it can be hard to extract from the documentation where to start in creating a simple functional example of the migrate module at work. Hopefully this example will help to fill that gap a little.
First install and enable the migrate family of modules in a sandbox Drupal site:
drush dl migrate migrate_example migrate_extras migrate_ui
drush en migrate migrate_example migrate_extras migrate_ui
If you then point your browser at:
drupal/?q=admin/content/migrate
you will see the migrate module's UI, which shows a couple of example migrations ("beer" and "wine") already coded and setup for you by the migrate_example sub-module. You can play with importing and rolling back data with the UI, or with drush:
drush help --filter="migrate"
To create your own migration, you need to create a custom module containing the migrate code. Using a MySQL database from another application, and based upon the beer.inc example from migrate_example, I was able to get a working migrate setup with three fairly small files in a new sub-module called "migrate_test" in sites/all/modules/migrate/migrate_test/ :
sites/all/modules/migrate/migrate_test/migrate_test.module:
2, ); return $api; }
sites/all/modules/migrate/migrate_test/migrate_test.info:
name = "Migrate Test" description = "My migration data." package = "Development" core = 6.x php = 5.2 dependencies[] = taxonomy dependencies[] = imagefield dependencies[] = comment dependencies[] = migrate dependencies[] = content dependencies[] = date dependencies[] = migrate_extras files[] = migrate_test.module files[] = langex.inc ; Information added by drupal.org packaging script on 2011-09-18 version = "6.x-2.2" core = "6.x" project = "migrate" datestamp = "1316388105"
sites/all/modules/migrate/migrate_test/langex.inc:
'mysql', 'database' => 'langex', 'username' => 'langex', 'password' => 'anypass', 'host' => 'localhost', 'prefix' => '', )); /** * To define a migration process from a set of source data to a particular * kind of Drupal object (for example, a specific node type), you define * a class derived from Migration. You must define a constructor to initialize * your migration object. By default, your class name will be the "machine name" * of the migration, by which you refer to it. Note that the machine name is * case-sensitive. * * In any serious migration project, you will find there are some options * which are common to the individual migrations you're implementing. You can * define an abstract intermediate class derived from Migration, then derive your * individual migrations from that, to share settings, utility functions, etc. */ abstract class LangexMigration extends Migration { public function __construct() { // Always call the parent constructor first for basic setup parent::__construct(); // With migrate_ui enabled, migration pages will indicate people involved in // the particular migration, with their role and contact info. We default the // list in the shared class; it can be overridden for specific migrations. $this->team = array( new MigrateTeamMember('John Doe', 'john.doe@gmail.com', t('contractor')), new MigrateTeamMember('Larry Brewer', 'lbrewer@example.com', t('Implementor')), ); } } /** * There are four essential components to set up in your constructor: * $this->source - An instance of a class derived from MigrateSource, this * will feed data to the migration. * $this->destination - An instance of a class derived from MigrateDestination, * this will receive data that originated from the source and has been mapped * by the Migration class, and create Drupal objects. * $this->map - An instance of a class derived from MigrateMap, this will keep * track of which source items have been imported and what destination objects * they map to. * Mappings - Use $this->addFieldMapping to tell the Migration class what source * fields correspond to what destination fields, and additional information * associated with the mappings. */ class LangexUserMigration extends LangexMigration { public function __construct() { // The basic setup is similar to BeerTermMigraiton parent::__construct(); $this->description = t('Language Exchange Network users'); $this->map = new MigrateSQLMap($this->machineName, array('userid' => array( 'type' => 'int', 'not null' => TRUE, 'description' => 'Account ID.' ) ), MigrateDestinationUser::getKeySchema() ); $query = Database::getConnection('default', 'for_migration') ->select('users', 'u') ->fields('u', array('userid', 'name', 'username', 'password', 'email_address', 'sex', 'signup_date')); // $this->source = new MigrateSourceSQL($query); $this->source = new MigrateSourceSQL($query, array(), NULL, array('map_joinable' => FALSE)); $this->destination = new MigrateDestinationUser(); // One good way to organize your mappings is in three groups - mapped fields, // unmapped source fields, and unmapped destination fields // Mapped fields // The migrate module automatically converts date/time strings to UNIX timestamps. $this->addFieldMapping('created', 'signup_date'); $this->addFieldMapping('pass', 'password'); $this->addFieldMapping('mail', 'email_address'); $this->addFieldMapping('name', 'username'); // Unmapped source fields $this->addFieldMapping(NULL, 'name') ->issueGroup(t('DNM')); $this->addFieldMapping(NULL, 'sex') ->issueGroup(t('DNM')); // Unmapped destination fields // This is a shortcut you can use to mark several destination fields as DNM // at once $this->addUnmigratedDestinations(array('theme', 'signature', 'access', 'login', 'timezone', 'language', 'picture')); } }
Note that this is a "cross-database migration"[3]. The source data and the destination data are located on the same MySQL server, but in different databases.
[1] https://drupal.org/project/migrate
[2] https://drupal.org/node/415260
[3] https://drupal.org/node/1014558
posted at: 09:13 | path: /SW/business/Drupal | permanent link to this entry
/SW/business/Drupal:
Youku & Tudou Videos in Drupal
For websites targeting users in mainland China, one of the issues is that many common services like Youtube and Google Video are blocked / censored from within China. For this specific case of video, there are a number of similar local Chinese video services that can be used instead.
Most ex-China video services seem to make it easy to embed their videos in other sites by prominently displaying a button which will generate the javascript code necessary for embedding a video in another site. For whatever reason, the Chinese sites do not seem to be so helpful.
First of all, in Drupal, turn on the PHP module. Then select "Create Content" and some content type to get to the content creation page. Select "PHP code" in the "Input Format" sub-section. And finally, for a youku[1] video, paste the following code into the content area:
This is the video generated by the above:
Youku video links are of the form http://v.youku.com/v_show/id_XMTkwNDgzMjE2.html
Note the part between the "id_" and the ".html", ie. XMTkwNDgzMjE2. This is the part of the link that must be swapped into the above code for XNDg5MTMwMDQ in order to make it work for a different video.
Similarly, for tudou[2] videos, use this code:
which produces this video:
Tudou video links are of the form http://www.tudou.com/programs/view/eD1xQ0WTlI8/
Swap "eD1xQ0WTlI8" in the latter link for "rsOg3YPXjDg" in the code above to make the code work for a different video.
[1] http://www.youku.com/
[2] http://www.tudou.com/
posted at: 07:02 | path: /SW/business/Drupal | permanent link to this entry
/SW/business/Redmine:
Installing Redmine on Debian Linux
I have found Redmine to be extremely sensitive to the Ruby environment, often requiring that librairies be of exactly a certain version (not older, not newer). Configuration documentation is not sufficiently detailed. And error and diagnostic information is extremely difficult to obtain in a typical hosting account.
So if you are trying to install Redmine in a hosting account that supports Ruby on Rails, you would be well-advised to get the application running first in a controlled environment where you have root. In my case, that was my Debian Linux desktop. After flailing around for hours in the hosting account, everything simply fell into place when I went back to basics and installed the Redmine application locally.
These[1][2] were the main references for getting this working on Debian.
apt-get install ruby rake rubygems libmysql-rubyCheckout a fresh copy of the latest Redmine stable, currently:
gem install rails -v=2.3.5 (takes quite a while!)
gem install rake -v=0.8.3
gem install hoe -v=1.3.0
svn co svn://rubyforge.org/var/svn/redmine/branches/0.9-stable redmine-0.9Start the native Ruby web server and see what happens:
cd [...]/redmine-0.9At this point I got a complaint about a missing database.yml. In my case, I was actually migrating Redmine from one hosting account where it suddenly broke, to another hosting account. So I installed the MySQL database from the old account to a database called mentage_redmine, then created a config/database.yml as follows:
ruby script/server production
Restart the server: this time an "Internal Server Error" that gave very specific instructions about adding a line pertaining to cookies to the config/environment.rb file. After adding this line, it basically worked.production: adapter: mysql database: mentage_redmine host: localhost username: mentage_redmine password: *********** encoding: utf8 development: adapter: mysql database: mentage_redmine host: localhost username: mentage_redmine password: *********** encoding: utf8
In my particular case, again because I was migrating an existing application, in the new site I replaced the public/images, javascripts, stylesheets, and themes directories with those from the old site's public directory. After that, everything looked right as well.
[1] http://www.redmine.org/wiki/1/RedmineInstall
[2] http://www.redmine.org/wiki/1/HowTo_Install_Redmine_in_a_home_directory_on_Debian
posted at: 11:30 | path: /SW/business/Redmine | permanent link to this entry
/SW/business/Redmine:
Installing Redmine in a Hostgator Hosting Account
To their credit, Hostgator[1] actually provides some documentation[2] about getting Ruby applications working in their hosting account. I, however, found them to be inadequate, and debugging information availability was little to none, so for me the magic key was getting Redmine working first on my desktop, then migrating to the Hostgator hosting account.
One of the first things one notices when looking at the rather sparse Redmine installation manual[3] is the need for specific versions of a number of Ruby librairies. This is what I found:
| My Debian Desktop | Hostgator Account |
| rails (2.3.5) | rails (2.3.8) |
| rack (1.0.1) | rack (1.1.0) |
| rake (0.8.3) | rake (0.8.7) |
| hoe (1.3.0) | hoe (2.6.0) |
In the Hostgator account, I got the above librairy versions using "gem list --local". I then installed in the account the correct versions as follows:
gem install rails -v=2.3.5
gem install hoe -v=1.3.0
Now transfer Redmine from desktop to Hostgator, placing it in /home/mentage/redmine-0.9.
In /home/mentage/public_html, create the following symlink: redmine -> /home/mentage/redmine-0.9/public/
Hostgator is using Apache to server up Ruby applications. Create a public/.htaccess[2] file with the following contents:
AddHandler fcgid-script .fcgi
AddHandler cgi-script .cgi
Options +FollowSymLinks +ExecCGI
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/notrails.*
RewriteRule .* - [L]
RewriteRule ^$ index.html [QSA]
RewriteRule ^([^.]+)$ $1.html [QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]
After that, it worked for me by pointing a browser at the redmine directory.
[1] http://www.hostgator.com/
[2] http://forums.hostgator.com/ruby-rails-support-t13038p8.html
[3] http://www.redmine.org/wiki/1/RedmineInstall
posted at: 13:08 | path: /SW/business/Redmine | permanent link to this entry
/SW/business/Drupal:
My Favorite Drupal Modules
(As of Drupal version 6.x....)
Drupal is a very mature piece of software, with a vast number of modules to choose from, often with multiple modules vying to provide the same piece of functionality. After some trial and error, here are my candidates for "best of", modules someone new to Drupal should look into early:
First some easily overlooked core modules:
Third-Party modules:
Here is someone else's list of favorites[6].
[1] http://drupal.org/project/cck
[2] http://drupal.org/project/views
[3] http://drupal.org/project/image
[4] http://drupal.org/project/image_fupload
[5] http://drupal.org/project/lightbox2
[6] http://www.nicklewis.org/40-essential-drupal-6-modules
[7] http://drupal.org/project/boost
posted at: 03:40 | path: /SW/business/Drupal | permanent link to this entry
/SW/business/Drupal:
Comparisons of Drupal and Joomla
Back some time ago when I was trying to figure out which Content Management System to use for a couple of website development clients, I do not remember seeing any definitive reviews. In the end, I think I made the correct choice (Drupal) for the situation despite the limited amount of information, but I see now that there might be some situations (event calendaring? desire for a simpler admin interface?) where Joomla might be the right choice.
Here are some references I would like to preserve for posterity:
http://www.alledia.com/blog/general-cms-issues/joomla-and-drupal-version-2/
http://www.topnotchthemes.com/blog/090224/drupal-vs-joomla-frank-comparison-ibm-consultant
http://www.communicopia.com/blog/joomla-versus-drupal
http://www.goodwebpractices.com/other/wordpress-vs-joomla-vs-drupal.html
posted at: 13:16 | path: /SW/business/Drupal | permanent link to this entry
/SW/business/Drupal:
Drupal User Manual: How to Edit Content
This post aims to provide the basic knowledge required to begin editing Drupal content.
First and most basically, you require an account on the Drupal website you wish to edit. After login, if you click on any menu item to navigate to that page, if you have the privileges to edit that page, you will see an edit (编辑) button or link (this depends on the theme being used) at the top of the page. Click on edit / 编辑, then edit and save the page.
After you have logged in, if you have been given some admin privileges on the site, you will see an Admin (管理) link in your personal menu under "My account" (我的帐户). Another way to see and edit the pages on the site is to click on "My account" / 我的帐户, and then click on "Content management/Content" (内容管理/内容). You will then be presented with a list of all the content items on the site, which you may then choose to edit individually, or perform various bulk operations on (deleted large quantities of spam posts, for instance).
To create new content, click on "Create content" (创建内容) and select a content type. For ordinary website page content, you probably want to choose "Page" content. After you click on "Page" and write your content, do not forget to expand the "Menu settings" (菜单设置) and enter a "Menu link title" (菜单链接名称) and select the menu position from the "Parent item" (上级菜单项) dropdown list. (You probably want to select "Primary Links" or one of the items under "Primary Links".)
Finally, you will probably want to re-arrange the order of the "Primary Links" in the navigation menu at the top of the site. To do this, click on "Admin" --> "Site building/Menus" --> "Primary links" (管理 --> 站点构建/菜单 --> "Primary links"). To change the order or position of menu items, just grab the "+" with your mouse pointer and drag'n'drop. For dropdown menus it is also good practice to click the "Expanded" (展开) checkbox to enable submenus. And finally, click "Save Configuration".
posted at: 04:17 | path: /SW/business/Drupal | permanent link to this entry
/SW/business/SugarCRM:
SugarCRM Built-in Data Tranfer Tool is Highly Developed
SugarCRM is fundamentally a big, complicated address book, and any migration to SugarCRM can often reasonably include a wish to import a bunch of contact data from another application. In my case, I have a MySQL database.
To get this database into SugarCRM is basically a two-step process:
posted at: 05:31 | path: /SW/business/SugarCRM | permanent link to this entry
/SW/business/SugarCRM:
SugarCRM Upgrades
With "normal" PHP web applications, upgrading is a matter of downloading a tarball containing the new version of the application, unpacking it in the web root, and then running an upgrade.php script inside the new version to update the table structure of the back-end database to the new layout.
Not so with SugarCRM, and it is slightly non-obvious what the upgrade procedure might be. The first thing you notice when you download a tarball is that there is no upgrade (or update) script. Some poking around in the admin portion of the user interface leads to the discovery of an "Upgrade Wizard", so one's first instinct is to feed the afore-mentioned tarball (actually, in this case, a zip archive) into the Wizard. This does not work, and in fact complains about a "missing manifest.php script" in the archive.
In fact, what this wizard is looking for is a specific kind of file: an "upgrade" or a "patch" zip from sugarforge. And this somewhat buried page is where you need to go looking for these things:
http://www.sugarforge.org/frs/?group_id=6
posted at: 02:18 | path: /SW/business/SugarCRM | permanent link to this entry
/SW/research:
Do-It-Yourself RSS
Ever cursed a site you want to check periodically for not having an RSS feed? cron / msmtp / web2mail.com offers a slightly crude solution -- crude because you get the whole page every time, not just new content.
web2mail.com provides a means of receiving website content via e-mail. I use msmtp to send the request to web2mail.com via one of my e-mail accounts, and cron to specify the frequency and issue the e-mail.
(I first tried to send the e-mail directly from my laptop mail server to web2mail.com, and web2mail.com did not like my e-mail and bounced it. Thus the msmtp strategy.)
I setup one of my e-mail accounts in ~/.msmtprc as follows:
# 163.com account 163 host smtp.163.com auth plain from user@163.com user user password password
Then in a terminal issue "crontab -e" and add the following entry:
25 14 * * 1,4 echo -e "Subject: http://www.website-you-want-sent.com/ \n\n This is message body" | msmtp -a 163 -v www@web2mail.com
which grabs the web page on the first and fourth days of the week at 14:25.
posted at: 02:44 | path: /SW/research | permanent link to this entry
/SW/browser/Chrome:
Chrome vs. Firefox
I will probably not part ways soon with Firefox because of its vast library of very useful plugins. But Google's Chrome is quickly becoming my essential second browser. There is of course the much publicized feature that every tab in Chrome runs in its own thread, therefore the contents of one tab locking-up do not effect the other tabs.
But Chrome also generally seems to be faster, and I have found at least one huge (for those of us living in bandwidth-starved regions of Asia) Chrome advantage in the https domain: when bandwidth is truly awful and Firefox sits quietly going nowhere for half an hour, Chrome succeeds in bringing down the page, sometimes in just a couple of minutes. The difference between a couple of minutes and a half hour to never is truly vast. No contest. Note that I have not yet tested this for http.
[1] http://code.google.com/intl/en/chromium/
posted at: 13:10 | path: /SW/browser/Chrome | permanent link to this entry
/SW/business/KnowledgeTree:
Installing a New KnowledgeTree instance
If this is a first install on a new server, this guide[1] is a must read. Some of the highlights:
apt-get install apache2 php5 php5-curl php5-mysql mysql-server mysql-client xpdf zip unzip catdoc pstotext
apt-get install python-reportlab python-imaging python-uno antiword sun-java5-jre sun-java5-bin lynx openoffice.org-java
And do not forget to bump memory_limit up to at least 64 in /etc/php5/apache2/php.ini.
Get the latest source tarball from here[2][3].
In your desired web root, make a copy of knowledgetree for this instance, then sim link a simpler name, ie.
tar -xvf ktdms-src-oss-3.5.4a.tgz mv kt-dms-oss/ kt-dms-oss-3.5.4a ln -s kt-dms-oss-3.5.4a/ knowledgetree
Give ownership to the web server process:
chown -R www-data:www-data kt-dms-oss-3.5.4aCreate a new MySQL database for the new instance:
# mysql -u root -p Enter password: mr4gvc7s mysql> create database apps_kt; mysql> grant all on apps_kt.* to 'apps_kt'@'%' identified by 'password'; flush privileges;
Edit config/config.ini to agree:
Now import the database from sql/mysql/install:dbName = apps_kt dbUser = apps_kt dbPass = password dbAdminUser = apps_kt dbAdminPass = password
Separate out the configuration and the data:mysql -u root -p apps_kt < structure.sql mysql -u root -p apps_kt < data.sql
mv knowledgetree/var/ kt-var mv knowledgetree/config/config.ini kt-config.ini cd knowledgetree ln -s ../kt-var/ var cd config/ ln -s ../../kt-config.ini config.ini
Now login to the new KnowledgeTree instance with the default:
user: admin password: admin
and change the admin password.
Anticipated path for upgrading to a new version of Knowledgetree:
[1] http://wiki.knowledgetree.com/Debian_4_Installation_Instructions#Grab_a_few_more_packages
[2] http://www.knowledgetree.com/try-now/knowledgetree_open_source_download
[3] http://www.knowledgetree.com/products/opensource/downloadopensource
posted at: 12:46 | path: /SW/business/KnowledgeTree | permanent link to this entry
/SW/fileSharing/mldonkey:
mldonkey P2P File Sharing
mldonkey[1] is kind of a special beast among P2P file sharing software in that it is basically a headless server, with GUIs being more or less an after-thought that in my experience do not really work. I started using mldonkey because I was specifically looking for headless software to run on the Donkey[2] and Kademlia[3] networks, and have found it quite simple to operate from a telnet command line.
Defaults are all quite sane except that Kad is turned off by default, ie. this setting must be changed in downloads.ini:
enable_kademlia = true
Connect to and control mldonkey thusly:
ssh user@server.com
mlnet&
telnet localhost 4000
auth admin ""
where "mlnet" starts the mldonkey server, and the "auth" line logs in to the server. At the admin prompt, here are a subset of commands[4] that I personally find useful:
start download: dllink view download status: vd list connected servers: vm list server id assignment: id kad_boot 121.7.215.212 4166 kad_dump_known_peers kad_stats kad_load : load the peers from a contact.dat file search: s view all queries: vs view results: vr download search result: dd exit: q stop server: kill
[1] http://mldonkey.sourceforge.net/
[2] http://mldonkey.sourceforge.net/EDonkey2000
[3] http://en.wikipedia.org/wiki/Kad_Network
{4] http://mldonkey.sourceforge.net/MLdonkeyCommandsExplained
posted at: 06:26 | path: /SW/fileSharing/mldonkey | permanent link to this entry
/SW/business/SugarCRM:
A Simple SugarCRM API Class
This should give anyone needing to use the SugarCRM API a quickstart:
* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301, USA. */ ?> 'https://url.of.your.sugarcrm.installation.com/sugarcrm/soap.php', "uri" => 'http://www.sugarcrm.com/sugarcrm', "trace" => 1 ); //user authentication array (version is SOAP version) private $user_auth = array(); function __construct() { // must use constructor b/c of MD5 function call $this->user_auth = array( "user_name" => 'sugaruserid', "password" => MD5('yourpasswd'), "version" => '.01' ); } // arrays for input into sugarCRM modules var $contact = array(); var $account = array(); function login() { $this->client = new SoapClient(NULL, $this->options); $response = $this->client->login($this->user_auth); // var_dump($response); // just in case you need it $this->session_id = $response->id; printf("session id = ". $this->session_id); $this->user_id = $this->client->get_user_id($this->session_id); printf(" " . $this->user_auth['user_name'] . ' has a GUID of ' . $this->user_id . "
"); } function getModules() { $response = $this->client->get_available_modules($this->session_id); foreach ($response->modules as $i => $value) { printf($response->modules[$i] . "
"); } } function getModuleFields($module) { $response = $this->client->get_module_fields($this->session_id, $module); printf("Module " . $response->module_name .' has the following fields:' . "
"); printf("
'); } function setContactField($fieldname, $fieldvalue) { $this->contact[] = array("name" => $fieldname,"value" => $fieldvalue); } function storeContact() { // into sugar's Contacts database $response = $this->client->set_entry($this->session_id, 'Contacts', $this->contact); var_dump($response); } } ?>
" . " "); foreach ($response->module_fields as $i => $value) { printf('Name Type Label " . "Required Options " . "'); } printf(' ' . $response->module_fields[$i]->name . ' ' . '' . $response->module_fields[$i]->type . ' ' . '' . $response->module_fields[$i]->label . ' ' . '' . $response->module_fields[$i]->required . ' ' . '' . $response->module_fields[$i]->options . '
And the following is a simple example of how to use the above class to create a simple contact record with a name and an e-mail address, and store it in Sugar's Contacts database.
login(); // populate the contact array $sugar->setContactField('last_name', 'Bloke2'); $sugar->setContactField('email1', 'xyz@wxy.net'); // var_dump($sugar->contact); $sugar->storeContact(); // to Contacts database ?>
To find out all the possible fields in the Contacts database, use this script:
login(); // look what modules sugar exposes $sugar->getModules(); // look in more detail at the fields in a module $sugar->getModuleFields('Accounts'); ?>
Many thanks to this post[1] for getting me on my way.
[1] http://systemsconsciousness.com/2009/04/10/sugarcrm-soap-examples/
posted at: 08:14 | path: /SW/business/SugarCRM | permanent link to this entry