当前位置: 首页>>代码示例>>PHP>>正文


PHP Companies::fillWithSessionDataEntry方法代码示例

本文整理汇总了PHP中Companies::fillWithSessionDataEntry方法的典型用法代码示例。如果您正苦于以下问题:PHP Companies::fillWithSessionDataEntry方法的具体用法?PHP Companies::fillWithSessionDataEntry怎么用?PHP Companies::fillWithSessionDataEntry使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Companies的用法示例。


在下文中一共展示了Companies::fillWithSessionDataEntry方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: uploadDocuments


//.........这里部分代码省略.........
                    }

                    // delete file from temporary catalog and from cache table
                    //unlink($current_upload_file['filepath']);
                    FileCache::deleteBothFromCacheById($current_upload_file['file_id']);

                    if ($current_upload_file['doctype'] == self::W9) {
                        // if document is W9
                        // get additional fields
                        $fedId = trim($current_upload_file['fed_id']);
                        $newCompanyName = trim($current_upload_file['company_name']);

                        // get company info
                        $company = Companies::model()->with('client')->findByAttributes(array(
                            'Company_Fed_ID' => $fedId,
                        ));

                        // create w9
                        $W9 = new W9();
                        $W9->Document_ID = $document->Document_ID;
                        $W9->W9_Owner_ID = Yii::app()->user->clientID;
                        $W9->Creator_ID = Yii::app()->user->userID;
                        $W9->Business_Name = trim($current_upload_file['bus_name']);
                        $W9->Tax_Class =  trim($current_upload_file['tax_name']);

                        // get user info
                        $user = Users::model()->with('person')->findByPk(Yii::app()->user->userID);

                        if ($company) {
                            // if company exisits
                            $client = $company->client;

                            //fill created company with dataentry values from session
                            Companies::fillWithSessionDataEntry($company,$current_upload_file);

                            $existingW9 = W9::model()->findByAttributes(array(
                                'Client_ID' => $client->Client_ID,
                                'W9_Owner_ID' => Yii::app()->user->clientID,
                            ));

                            if ($existingW9) {
                                $W9->Revision_ID = -1;
                            } else {
                                $W9->Revision_ID = 0;
                            }

                            $vendor = Vendors::model()->findByAttributes(array(
                                'Client_Client_ID' => Yii::app()->user->clientID,
                                'Vendor_Client_ID' => $client->Client_ID,
                            ));

                            if (isset($vendor->Active_Relationship) && $vendor->Active_Relationship == Vendors::NOT_ACTIVE_RELATIONSHIP) {
                                $vendor->Active_Relationship = Vendors::ACTIVE_RELATIONSHIP;
                                $vendor->save();
                            } else if (!$vendor && Yii::app()->user->clientID != 0 && Yii::app()->user->clientID != $client->Client_ID) {
                                $vendor = new Vendors();
                                $vendor->Vendor_ID_Shortcut = '';
                                $vendor->Vendor_Client_ID = $client->Client_ID;
                                $vendor->Client_Client_ID = Yii::app()->user->clientID;
                                $vendor->Vendor_Name_Checkprint = '';
                                $vendor->Vendor_1099 = '';
                                $vendor->Vendor_Default_GL = '';
                                $vendor->Vendor_Default_GL_Note = '';
                                $vendor->Vendor_Note_General = '';

                                $vendor->Vendor_Contact = trim($current_upload_file['contact']);
开发者ID:ranvijayj,项目名称:htmlasa,代码行数:67,代码来源:Documents.php

示例2: createNewFromSessionData

    public static function createNewFromSessionData($current_upload_file,$client){

        if (file_exists($current_upload_file['filepath'])) {
            // create document

            $document = new Documents();
            $document->Document_Type = $current_upload_file['doctype'];
            $document->User_ID = Yii::app()->user->userID;
            $document->Client_ID = Yii::app()->user->clientID;
            $document->Project_ID = Yii::app()->user->projectID;
            $document->Created = date("Y-m-d H:i:s");
            $document->save();
            $new_doc_id=$document->Document_ID;

            Audits::LogAction($document->Document_ID ,Audits::ACTION_UPLOAD);

            // insert image
            $image = new Images();
            $imageData = addslashes(fread(fopen($current_upload_file['filepath'],"rb"),filesize($current_upload_file['filepath'])));
            //$imageData = FileModification::ImageToPdfByFilePath($current_upload_file['filepath']);
            $image->Document_ID = $document->Document_ID;
            $image->Img = $imageData;
            $image->File_Name = $current_upload_file['name'];
            $image->Mime_Type = $current_upload_file['mimetype'];
            $image->File_Hash = sha1_file($current_upload_file['filepath']);
            $image->File_Size = intval(filesize($current_upload_file['filepath']));
            $image->Pages_Count = FileModification::calculatePagesByPath($current_upload_file['filepath']);

            $image->save();

            $infile = @file_get_contents($current_upload_file['filepath'], FILE_BINARY);
            if (($current_upload_file['mimetype'] == 'application/pdf' && $image->findPdfText($infile) == '')
                || $current_upload_file['mimetype'] != 'application/pdf') {
                Documents::crateDocumentThumbnail($current_upload_file['filepath'], 'thumbs', $current_upload_file['mimetype'], $document->Document_ID, 80);
            }

            // delete file from temporary catalog
            unlink($current_upload_file['filepath']);
        }

        $fedId = trim($current_upload_file['fed_id']);
        $newCompanyName = trim($current_upload_file['company_name']);

        // get company info
        $company = Companies::model()->with('client')->findByAttributes(array(
            'Company_Fed_ID' => $fedId,
        ));

        // create w9
        $W9 = new W9();
        $W9->Document_ID = $document->Document_ID;
        $W9->W9_Owner_ID = Yii::app()->user->clientID;
        $W9->Creator_ID = Yii::app()->user->userID;
        $W9->Business_Name = trim($current_upload_file['bus_name']);
        $W9->Tax_Class =  trim($current_upload_file['tax_name']);

        // get user info
        $user = Users::model()->with('person')->findByPk(Yii::app()->user->userID);

        if ($company) {
            // if company exisits
            $client = $company->client;

            //fill created company with dataentry values from session
            Companies::fillWithSessionDataEntry($company,$current_upload_file);

            $existingW9 = W9::model()->findByAttributes(array(
                'Client_ID' => $client->Client_ID,
                'W9_Owner_ID' => Yii::app()->user->clientID,
            ));

            if ($existingW9) {
                $W9->Revision_ID = -1;
            } else {
                $W9->Revision_ID = 0;
            }

            $vendor = Vendors::model()->findByAttributes(array(
                'Client_Client_ID' => Yii::app()->user->clientID,
                'Vendor_Client_ID' => $client->Client_ID,
            ));

            if (isset($vendor->Active_Relationship) && $vendor->Active_Relationship == Vendors::NOT_ACTIVE_RELATIONSHIP) {
                $vendor->Active_Relationship = Vendors::ACTIVE_RELATIONSHIP;
                $vendor->save();
            } else if (!$vendor && Yii::app()->user->clientID != 0 && Yii::app()->user->clientID != $client->Client_ID) {
                $vendor = new Vendors();
                $vendor->Vendor_ID_Shortcut = '';
                $vendor->Vendor_Client_ID = $client->Client_ID;
                $vendor->Client_Client_ID = Yii::app()->user->clientID;
                $vendor->Vendor_Name_Checkprint = '';
                $vendor->Vendor_1099 = '';
                $vendor->Vendor_Default_GL = '';
                $vendor->Vendor_Default_GL_Note = '';
                $vendor->Vendor_Note_General = '';
                $vendor->save();
            }
        } else {
            //if company does not exists, create new company

//.........这里部分代码省略.........
开发者ID:ranvijayj,项目名称:htmlasa,代码行数:101,代码来源:W9.php


注:本文中的Companies::fillWithSessionDataEntry方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。