本文整理匯總了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;
}