Detect SuiteCRM only with global variable ['sugarcrm']
This commit is contained in:
parent
052824e4b7
commit
3249260653
6 changed files with 153 additions and 147 deletions
|
@ -393,9 +393,7 @@ function stormorganization_form(&$node) {
|
|||
* Implements hook_form_FORM_ID_alter().
|
||||
*/
|
||||
function stormorganization_form_stormorganization_node_form_alter(&$form, &$form_state) {
|
||||
global $conf;
|
||||
|
||||
if ($conf['storm_suitecrm']) {
|
||||
if (storm_suitecrm_is_defined()) {
|
||||
$form['group3']['#access'] = FALSE;
|
||||
$form['group4']['#access'] = FALSE;
|
||||
$form['group5']['taxid']['#access'] = FALSE;
|
||||
|
@ -448,7 +446,7 @@ function stormorganization_update($node) {
|
|||
}
|
||||
|
||||
function stormorganization_nodeapi(&$node, $op, $teaser, $page) {
|
||||
global $base_url, $conf;
|
||||
global $base_url;
|
||||
|
||||
if ($node->type != 'stormorganization') {
|
||||
return;
|
||||
|
@ -474,7 +472,7 @@ function stormorganization_nodeapi(&$node, $op, $teaser, $page) {
|
|||
case 'validate':
|
||||
$nid = $node->nid;
|
||||
$organization_name = $node->title;
|
||||
if (!$conf['storm_suitecrm'] || empty($organization_name)) {
|
||||
if (!storm_suitecrm_is_defined() || empty($organization_name)) {
|
||||
return;
|
||||
}
|
||||
// Checking if exists the organization in SuiteCRM:
|
||||
|
@ -501,12 +499,12 @@ function stormorganization_nodeapi(&$node, $op, $teaser, $page) {
|
|||
array('!organization' => l(t('organization'), drupal_get_path_alias('node/' . $organization_nid)))
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 'presave':
|
||||
if ($conf['storm_suitecrm']) {
|
||||
if (storm_suitecrm_is_defined()) {
|
||||
$sugarid = $node->field_stormorganization_sugarid[0]['value'];
|
||||
|
||||
db_set_active('sugarcrm');
|
||||
|
@ -528,7 +526,7 @@ function stormorganization_nodeapi(&$node, $op, $teaser, $page) {
|
|||
|
||||
case 'insert':
|
||||
case 'update':
|
||||
if ($conf['storm_suitecrm']) {
|
||||
if (storm_suitecrm_is_defined()) {
|
||||
$sugarid = $node->field_stormorganization_sugarid[0]['value'];
|
||||
if (!empty($sugarid)) {
|
||||
db_set_active('sugarcrm');
|
||||
|
@ -539,7 +537,7 @@ function stormorganization_nodeapi(&$node, $op, $teaser, $page) {
|
|||
break;
|
||||
|
||||
case 'delete':
|
||||
if ($conf['storm_suitecrm']) {
|
||||
if (storm_suitecrm_is_defined()) {
|
||||
$sugarid = $node->field_stormorganization_sugarid[0]['value'];
|
||||
if (!empty($sugarid)) {
|
||||
db_set_active('sugarcrm');
|
||||
|
@ -555,7 +553,7 @@ function stormorganization_nodeapi(&$node, $op, $teaser, $page) {
|
|||
break;
|
||||
|
||||
case 'view':
|
||||
if ($conf['storm_suitecrm'] && !storm_cron_is_running()) {
|
||||
if (storm_suitecrm_is_defined() && !storm_cron_is_running()) {
|
||||
$sugarid = $node->field_stormorganization_sugarid[0]['value'];
|
||||
if (!empty($sugarid)) {
|
||||
db_set_active('sugarcrm');
|
||||
|
@ -591,7 +589,7 @@ function stormorganization_nodeapi(&$node, $op, $teaser, $page) {
|
|||
function _stormorganization_validate_predelete($node) {
|
||||
$nid = $node->nid;
|
||||
$items = array();
|
||||
|
||||
|
||||
if (_storm_validate_predelete('stormperson', "s.organization_nid = $nid")) {
|
||||
$items[] = '<a href="/people">' . t('people') . '</a>';
|
||||
}
|
||||
|
|
Reference in a new issue