當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Gpf_Rpc_Form::setSuccessful方法代碼示例

本文整理匯總了PHP中Gpf_Rpc_Form::setSuccessful方法的典型用法代碼示例。如果您正苦於以下問題:PHP Gpf_Rpc_Form::setSuccessful方法的具體用法?PHP Gpf_Rpc_Form::setSuccessful怎麽用?PHP Gpf_Rpc_Form::setSuccessful使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Gpf_Rpc_Form的用法示例。


在下文中一共展示了Gpf_Rpc_Form::setSuccessful方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: importCSV

    /**
     * @throws Gpf_Tasks_LongTaskInterrupt
     */
    public function importCSV(){
        Gpf_Log::info('Importing file' . $this->form->getFieldValue(self::FILENAME));
        
        $transactionHeader = $this->getHeader();
        
        $rowsList = $this->getDataFromFile();
        
        $this->cache = new Pap_Merchants_Transaction_TransactionsImportCache();
        $i = 0;
        while($this->row = $rowsList->readArray()) {
            
            $this->interruptIfMemoryFull();
            if ($this->isPending($i, $this->_('Importing transactions'))) {
                if ($i == 0 && $this->form->getFieldValue(self::SKIP_FIRST_ROW) == Gpf::YES) {
                    Gpf_Log::info('Skipping first row');
                    $this->row[]='errorMessage';
                    $this->errorHeader = $this->row;
                    $i++;
                    continue;
                }
                if(count($this->row)<=1) {
                    Gpf_Log::info('Skipping empty row ' . $i);
                    $i++;
                    continue;
                }
                $transaction = $this->getTransactionObject();
                try {
                    $this->saveTransaction($transaction, $transactionHeader, $this->row);
                } catch (Gpf_DbEngine_DuplicateEntryException $e) {
                    $this->addError($this->_('Duplicate row'));
                } catch (Gpf_Exception $e){
                    $this->addError($this->_($e->getMessage()));
                }
                $this->setDone();
            }
            $i++;
        }

        Gpf_Log::info('Import complete');
        if ($this->errorFile !== null) {
            $this->errorFile->close();
            if($this->errorFile->isExists()) {
                Gpf_Log::warning('Error occured during import, please check ' . Gpf_Paths::getInstance()->getCacheAccountDirectory().self::ERROR_FILE);
                $this->form->setInfoMessage("Import was not successful<br /><a href='" .
                Gpf_Paths::getInstance()->getCacheAccountDirectory().self::ERROR_FILE.
	            "'>" . $this->_("Download unimported .csv") . "</a><br />
	            (error messages are at the end of each line)");
            } else{
                $this->form->setInfoMessage("Import was successful");
            }
        }
        else{
            $this->form->setInfoMessage("Import was successful");
        }

        $this->form->setErrorMessage($this->_('Import was not successful.'));

        $this->form->setSuccessful();
        $this->cache->clearCache();
        return $this->form;
    }
開發者ID:AmineCherrai,項目名稱:rostanvo,代碼行數:64,代碼來源:TransactionsImportTask.class.php


注:本文中的Gpf_Rpc_Form::setSuccessful方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。