diff --git a/inc/links/model/_linkowner.class.php b/inc/links/model/_linkowner.class.php index fca0954b55a..f08cb769a53 100644 --- a/inc/links/model/_linkowner.class.php +++ b/inc/links/model/_linkowner.class.php @@ -99,7 +99,14 @@ function __construct( $link_Object, $type, $ID_field_name, $tmp_ID = NULL ) { $this->ID_field_name = $ID_field_name; $this->type = $type; - $this->set_object( $link_Object, $tmp_ID ); + if( $type == 'message' ) + { // Allow to link files only for new creating message: + $this->set_object( $link_Object, $tmp_ID ); + } + else + { // Others allow to link files only for existing object: + $this->link_Object = $link_Object; + } } diff --git a/skins_fallback_v5/_edit.disp.php b/skins_fallback_v5/_edit.disp.php index cd17b4e4d35..6240edd577f 100644 --- a/skins_fallback_v5/_edit.disp.php +++ b/skins_fallback_v5/_edit.disp.php @@ -360,7 +360,7 @@ } } -if( $edited_Item->get_type_setting( 'allow_attachments' ) ) +if( $edited_Item->get_type_setting( 'allow_attachments' ) && $edited_Item->ID > 0 ) { // ####################### ATTACHMENTS FIELDSETS ######################### $LinkOwner = new LinkItem( $edited_Item ); if( $LinkOwner->count_links() ) diff --git a/skins_fallback_v6/_edit.disp.php b/skins_fallback_v6/_edit.disp.php index b443105ed5f..da3f321d081 100644 --- a/skins_fallback_v6/_edit.disp.php +++ b/skins_fallback_v6/_edit.disp.php @@ -399,7 +399,7 @@ } echo ''; } - if( $perm_view_files ) + if( $perm_view_files && $edited_Item->ID > 0 ) { // If current user has a permission to view files $LinkOwner = new LinkItem( $edited_Item ); if( $LinkOwner->count_links() )