Can't preview file datatype before...

Author Message

Issam MOUZOUN

Monday 21 December 2009 8:07:40 am

Hello,

 

I develop a subscription module, any people can subscribe and must attach file (ezbinaryfile) and wait my approbation,.

 

My problem is i can't preview the attached document during before approving

I developp with ez 4.1.3

Thanks

Jérôme Vieilledent

Tuesday 22 December 2009 12:30:30 am

Hi Issam

Maybe you should give a try to eZ Approve 2. It's much more advanced thant standard eZ Approve workflow.

Anyway, I'm surprised that you can't preview the binary file. I just tested on my 4.2 instance and it smells like a bug in content/download module...

Jérôme Vieilledent

Tuesday 22 December 2009 1:15:03 am

OK, I found out where the problem is, and this is a registered bug.
When running content/download, eZ Publish will check the node assignments of the attribute parent object. But in that case, the object has no node assignment because it's not published yet !
Problem occurs in kernel/content/download.php, lines 52 to 79

// Get locations.
$nodeAssignments = $contentObject->attribute( 'assigned_nodes' );
if ( count( $nodeAssignments ) === 0 )
{
    // oops, no locations. probably it's related object. Let's check his owners
    $ownerList = eZContentObject::fetch( $contentObjectID )->reverseRelatedObjectList( false, false, false, false );
    foreach ( $ownerList as $owner )
    {
        if ( is_object( $owner ) )
        {
            $ownerNodeAssignments = $owner->attribute( 'assigned_nodes' );
            $nodeAssignments = array_merge( $nodeAssignments, $ownerNodeAssignments );
        }
    }
}

// If exists location that current user has access to and location is visible.
$canAccess = false;
foreach ( $nodeAssignments as $nodeAssignment )
{
    if ( ( eZContentObjectTreeNode::showInvisibleNodes() || !$nodeAssignment->attribute( 'is_invisible' ) ) and $nodeAssignment->canRead() )
    {
        $canAccess = true;
        break;
    }
}
if ( !$canAccess )
    return $Module->handleError( eZError::KERNEL_NOT_AVAILABLE, 'kernel' );

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.