/**
 * Get infos about the attachments of a given object
 * 
 * @param tlObjectWithAttachments $object The object whose attachment should be fetched
 * @param int $fkid the id of the object (attachments.fk_id);
 * @param bool $storeListInSession if true, the attachment list will be stored within the session
 * @param int $counter if $counter > 0 the attachments are appended to existing attachments within the session
 *
 * @return array returns infos about the attachment on success, NULL else
 */
function getAttachmentInfosFrom(&$object, $fkid, $storeListInSession = true, $counter = 0)
{
    $attachmentInfos = $object->getAttachmentInfos($fkid);
    if ($storeListInSession) {
        storeAttachmentsInSession($attachmentInfos, $counter);
    }
    return $attachmentInfos;
}
 /**
  * Use specific object manager, to get infos about it's attachments.
  * 
  * @param tlObjectWithAttachments $object The object whose attachment should be fetched
  * @param int $itemID the id of the object that owns the attachment (attachments.fk_id);
  * @param bool $storeListInSession if true, the attachment list will be stored within the session
  * @param int $counter if $counter > 0 the attachments are appended to existing attachments within the session
  *
  * @return array returns infos about the attachment on success, NULL else
  */
 function getAttachMetaDataViaObject(&$object, $itemID, $storeListInSession = true, $counter = 0)
 {
     $attach = $object->getAttachmentInfos($itemID);
     if ($storeListInSession) {
         storeAttachmentsInSession($attach, $counter);
     }
     return $attach;
 }