attachFile

Posted by Alvin You
2013. 11. 13. 15:06 카테고리 없음

public static void attachFile(Common     _recordToAttachTo,
                              Str        _attachFile,
                              DocuTypeId _typeId)
{

    //rvbAttachDoc::attachFile(salesTable, fcFileName, 'File');

    DocuActionArchive   docuActionArchive   ;
    DocuActionFile      docuActionFile      ;
    DocuAction          docuAction          ;
    DocuRef             docuRef             ;
    DocuType            docuType            ;

    docuType = DocuType::find(_typeId) ;
    if(! docuType.RecId)
    {
        throw Error (strFmt(strFmt("Document Type %1 not setup in document handling.", _typeId)));
    }else
    {
        if (docuType.ActionClassId != ClassNum(DocuActionArchive) ||
            docuType.TypeGroup     != DocuTypeGroup::File)
        {
            throw Error(strFmt("Class Description should be 'Attach File' and Group should be 'File' for Document Type %1", _typeId));
        }
    }

    ttsBegin;
    docuRef.ActualCompanyId     =   curExt()                    ;
    docuRef.Name                =   'Automatically Attached'    ;
    docuRef.Notes               =   'Automatically Attached'    ;
    docuRef.RefCompanyId        =   curExt()                    ;
    docuRef.RefRecId            =   _recordToAttachTo.RecId     ;
    docuRef.RefTableId          =   _recordToAttachTo.TableId   ;
    docuRef.Restriction         =   DocuRestriction::Internal   ;
    docuRef.TypeId              =   'File'                      ;
    docuRef.insert()    ;

    docuActionArchive = new docuActionArchive() ;
    docuActionArchive.add(docuRef, _attachFile) ;

    ttsCommit;
}

AttachDocument

Posted by Alvin You
2013. 11. 13. 15:05 카테고리 없음

static void AttachDocument(Args _args)
{
    DocuRef    docuRef;
    DocuActionArchive attachDoco;
    LedgerJournalTable ledgJnlTable;
    SalesTable salesTable;
    boolean isValid;
    ;
//    ledgjnlTable = LedgerJournalTable::find("GJ00000059");
    salesTable = SalesTable::find("DAT-000010");

    ttsBegin;
    docuRef.TypeId = "Sharepoint";
    docuRef.RefTableId = tableNum(SalesTable);
    docuRef.RefRecId = salesTable.RecId;
    docuRef.RefCompanyId = curext();
    docuRef.ActualCompanyId = curext();
    docuRef.insert();

    attachDoco = DocuAction::newDocuRef(docuRef);
    attachDoco.add(docuRef, "D:\\DPA-ApplicationDeveloper.pdf");

    ttsCommit;
}

AttachURL

Posted by Alvin You
2013. 11. 13. 15:05 카테고리 없음

static void AttachURL(Args _args)
{
    DocuRef    docuRef;
    DocuActionArchive attachDoco;
    LedgerJournalTable ledgJnlTable;
    SalesTable salesTable;
    boolean isValid;
    ;
//    ledgjnlTable = LedgerJournalTable::find("GJ00000059");
    salesTable = SalesTable::find("DAT-000012");

    ttsbegin;
    docuRef.clear();
    docuRef.Name = "InvoiceUrl";
    docuRef.RefTableId = tableNum(SalesTable);
    docuRef.RefRecId = salesTable.RecId;
    docuRef.RefCompanyId = curext();
    docuRef.TypeId = "URL";
    docuRef.Restriction  = DocuRestriction::Internal;
    docuRef.Notes="http://alvin/sites/DMS/AXDocu/복사본 PMIX_Template_2013 11 07.xlsx";
    docuRef.insert();

    attachDoco = DocuAction::newDocuRef(docuRef);
    ttscommit;
}