Jump to content
X2Community Forums

Recommended Posts

If this already exists then ignore this :)

 

I tried this in the Demo site and had similar issues.

 

Our sales guys are required to upload pdf copies of various documents to opportunities and accounts. But it doesn't seem to give a list anywhere on those files. 

 

What happens:

While viewing an opportunity I click on the Upload file link on the left and upload a file via the form that appears under the Relationships box. 

Then the only way I can get back to it is if I go to media and look that way or by seeing the list of global file uploads on the right hand activity feed, media section.

 

There is not an entry into the activitity feed for this Opportunity even after refreshing the page.

 

What I was expecting:

 

Complete the upload steps.

Either have a list of files uploaded to this opportunity in a separate box above or below the relationships appear with those files.

Or have that file and others show up in the activity feed for this Opportunity.

 

I think I would prefer a special box for files attached to the Opportunity just for the sake of finding them easily.

 

Thoughts?  

 

I attached a screenshot from the demo sit, you can see the file I uploaded in the global activity feed bar on the right side in the media section, but there is nothing showing in the activity feed for this Opportunity.

 

post-8596-0-58163300-1368637466_thumb.png

Link to post
Share on other sites

Thanks for reporting this, this is actually just a small typo in one of the files. The action is present in the database, but not being properly loaded into the history. I've put a fix into base code, but to deal with it now open protected/modules/opportunities/views/opportunities/view.php and change where it says: 

$this->widget('History',array('associationType'=>'opportunity','associationId'=>$model->id));

 

to

$this->widget('History',array('associationType'=>'opportunities','associationId'=>$model->id));

 

This code should be near the bottom of the file.

 

Jake

Link to post
Share on other sites

Hey Jake,

 

I just discovered that this fix does allow for attachments to be shown, but it breaks the rest of the activity feed for the Opportunity module, so workflow, comments, actions no longer display with this fix. Demo site confirms this.

 

It seems like this is caused by the workflow, comments, actions, items end up getting an associationType of 'opportunity' while file uploads gets one as 'opportunities' when it is saved in the database.  So the code change above tells the widget to load one or the other. 

 

I can run a database query to update all those activities to be opportunities for the associationType, but I can't seem to find where to change the History widget form to show 'opportunities' instead of 'opportunity' in the hidden field on the forms.

Link to post
Share on other sites

Took a break and that seemed to help... Let me know if I missed anything other changes but these seem to fix it.

 

In protected/modules/opportunities/views/opportunities/view.php

 

Around line 87 I changed 'opprtunity' to 'opportunities'

 

 

$this->widget('X2WidgetList', array('block'=>'center', 'model'=>$model, 'modelType'=>'opportunity'));
 

 

To

 

$this->widget('X2WidgetList', array('block'=>'center', 'model'=>$model, 'modelType'=>'opportunities'));
 

 

 

 

 

 

And around line 127 I changed the associationType to opportunities. 

 

 

$this->widget('Publisher',
    array(
        'associationType'=>'opportunity',
        'associationId'=>$model->id,
        'assignedTo'=>Yii::app()->user->getName(),
        'halfWidth'=>true
    )
);
 

To

 

$this->widget('Publisher',
    array(
        'associationType'=>'opportunities',
        'associationId'=>$model->id,
        'assignedTo'=>Yii::app()->user->getName(),
        'halfWidth'=>true
    )
);

 

 

 

Then ran this update statement

 

update x2_actions set associationType = 'opportunities' where associationType='opportunity';
 

 

 

This produced an error on the what's new page when pulling the events cause it was looking for a class 'Opportunities'.  so I slightly modified my X2Model.php getModelName method to use strtolower():

 

 

 

public static function getModelName($type){
        if(array_key_exists($type,X2Model::$associationModels)){
            return X2Model::$associationModels[$type];
        }else{
            if(class_exists(ucfirst($type))){
                return ucfirst($type);
            }elseif(class_exists($type)){
                return $type;
            }else{
                return false;
            }
        }
    }
 

 

 
TO

 

public static function getModelName($type){
        if(array_key_exists(strtolower($type),X2Model::$associationModels)){
            return X2Model::$associationModels[strtolower($type)];
        }else{
            if(class_exists(ucfirst($type))){
                return ucfirst($type);
            }elseif(class_exists($type)){
                return $type;
            }else{
                return false;
            }
        }
    }

 

 

 

This appears to fix the issue, new notes, actions, and workflow stuff

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...