ParameterList CliPlugin::parameterList() const { static ParameterList p; if (p.isEmpty()) { p[CaptureProgress] = true; p[ListProgram] = p[ExtractProgram] = p[DeleteProgram] = p[AddProgram] = QLatin1String("rar"); p[ListArgs] = QStringList() << QLatin1String("v") << QLatin1String("-c-") << QLatin1String("$Archive"); p[ExtractArgs] = QStringList() << QLatin1String("-p-") << QLatin1String("$PreservePathSwitch") << QLatin1String("$PasswordSwitch") << QLatin1String("$RootNodeSwitch") << QLatin1String("$Archive") << QLatin1String("$Files"); p[PreservePathSwitch] = QStringList() << QLatin1String("x") << QLatin1String("e"); p[RootNodeSwitch] = QStringList() << QLatin1String("-ap$Path"); p[PasswordSwitch] = QStringList() << QLatin1String("-p$Password"); p[DeleteArgs] = QStringList() << QLatin1String("d") << QLatin1String("$Archive") << QLatin1String("$Files"); p[FileExistsExpression] = QLatin1String("^(.+) already exists. Overwrite it"); p[FileExistsInput] = QStringList() << QLatin1String("Y") //overwrite << QLatin1String("N") //skip << QLatin1String("A") //overwrite all << QLatin1String("E") //autoskip << QLatin1String("Q") //cancel ; p[AddArgs] = QStringList() << QLatin1String("a") << QLatin1String("$Archive") << QLatin1String("$Files"); p[WrongPasswordPatterns] = QStringList() << QLatin1String("password incorrect"); p[ExtractionFailedPatterns] = QStringList() << QLatin1String("CRC failed"); } return p; }
ParameterList CliPlugin::parameterList() const { static ParameterList p; if (p.isEmpty()) { //p[CaptureProgress] = true; p[ListProgram] = p[ExtractProgram] = p[DeleteProgram] = p[AddProgram] = p[TestProgram] = QStringList() << QStringLiteral("7z"); p[ListArgs] = QStringList() << QStringLiteral("l") << QStringLiteral("-slt") << QStringLiteral("$PasswordSwitch") << QStringLiteral("$Archive"); p[ExtractArgs] = QStringList() << QStringLiteral("$PreservePathSwitch") << QStringLiteral("$PasswordSwitch") << QStringLiteral("$Archive") << QStringLiteral("$Files"); p[PreservePathSwitch] = QStringList() << QStringLiteral("x") << QStringLiteral("e"); p[PasswordSwitch] = QStringList() << QStringLiteral("-p$Password"); p[PasswordHeaderSwitch] = QStringList { QStringLiteral("-p$Password"), QStringLiteral("-mhe=on") }; p[WrongPasswordPatterns] = QStringList() << QStringLiteral("Wrong password"); p[CompressionLevelSwitch] = QStringLiteral("-mx=$CompressionLevel"); p[AddArgs] = QStringList() << QStringLiteral("a") << QStringLiteral("$Archive") << QStringLiteral("$PasswordSwitch") << QStringLiteral("$CompressionLevelSwitch") << QStringLiteral("$Files"); p[DeleteArgs] = QStringList() << QStringLiteral("d") << QStringLiteral("$PasswordSwitch") << QStringLiteral("$Archive") << QStringLiteral("$Files"); p[TestArgs] = QStringList() << QStringLiteral("t") << QStringLiteral("$Archive"); p[TestPassedPattern] = QStringLiteral("^Everything is Ok$"); p[FileExistsExpression] = QStringList() << QStringLiteral("^\\(Y\\)es / \\(N\\)o / \\(A\\)lways / \\(S\\)kip all / A\\(u\\)to rename all / \\(Q\\)uit\\? $") << QStringLiteral("^\\? \\(Y\\)es / \\(N\\)o / \\(A\\)lways / \\(S\\)kip all / A\\(u\\)to rename all / \\(Q\\)uit\\? $"); p[FileExistsFileName] = QStringList() << QStringLiteral("^file \\./(.*)$") << QStringLiteral("^ Path: \\./(.*)$"); p[FileExistsInput] = QStringList() << QStringLiteral("Y") //overwrite << QStringLiteral("N") //skip << QStringLiteral("A") //overwrite all << QStringLiteral("S") //autoskip << QStringLiteral("Q"); //cancel p[PasswordPromptPattern] = QStringLiteral("Enter password \\(will not be echoed\\)"); p[ExtractionFailedPatterns] = QStringList() << QStringLiteral("ERROR: E_FAIL"); p[CorruptArchivePatterns] = QStringList() << QStringLiteral("Unexpected end of archive") << QStringLiteral("Headers Error"); p[DiskFullPatterns] = QStringList() << QStringLiteral("No space left on device"); } return p; }
/*! * \fn EReporte::hacer( ParameterList parametros, bool previsualizar ) * Realiza el reporte configurado. * Si no se definieron parametros, se tomarán los parametros definidos en el objeto. * Se solicitará al plugin de el cliente que coloque los parametros que considere necesarios. * Luego se enviará a imprimir el reporte. * Si es un presupuesto o un recibo, se lo intentará guardar en el deposito de documentos. * \param parametros Objeto del tipo "ParameterList" con los parametros para el reporte. * \param previsualizar Fuerza el mostrado de la ventana de previsualizaciòn antes de imprimir. * \returns Verdadero si se pudo imprimir. Falso si hubo un error de configuración o al imprimir. */ bool EReporte::hacer( ParameterList parametros, bool previsualizar ) { if( _rep == 0 || ( !_rep->isValid() ) || _tipo == Invalido || _nombre.isNull() ) { qDebug( "Error - Reporte no inicializado o erroneo" ); return false; } // Busco las modificaciónes que se le quieran hacer a los reportes if( !parametros.isEmpty() ) { _parametros = parametros; } #ifdef Q_OS_LINUX ERegistroPlugins::getInstancia()->pluginInfo()->reporteParametros( _tipo, _nombre, _parametros ); #endif // Seteo si esta con el original o el duplicado o triplicado, etc... /*ParameterList _original = _parametros; _original.append( Parameter( "copia", "Original" ) ); // Imprimo el reporte _rep->setParamList( _original ); /// @todo Ver si poner impresora para cada tipo if( !( _rep->print( 0, true, previsualizar ) ) ) { qDebug( "Error al intentar imprimir el reporte o se cancelo" ); _rep->reportError( 0 ); return false; } ParameterList _duplicado = _parametros; _duplicado.append( Parameter( "copia", "Duplicado" ) ); _rep->setParamList( _duplicado );*/ _rep->setParamList( _parametros ); /*for( int i = 0; i<_parametros.count(); i++ ) { qDebug( QString( "%1: %2:%3" ).arg( i ).arg( _parametros.name( i ) ).arg( _parametros.value( i ).toString() ).toLocal8Bit() ); }*/ /// @todo Ver si poner impresora para cada tipo if( !( _rep->print( 0, true, previsualizar ) ) ) { qDebug( "Error al intentar imprimir el reporte o se cancelo" ); _rep->reportError( 0 ); return false; } /*if( _tipo == EReporte::Presupuesto || _tipo == EReporte::Recibo ) { // Guardo el documento en la carpeta si corresponde QDir dir = QApplication::applicationDirPath(); dir.cd( "reportes" ); if( !dir.exists( "deposito" ) ) { if( !dir.mkdir( "deposito" ) ) { qDebug( "Error al intentar crear el directorio de deposito" ); } } dir.cd( "deposito" ); if( ! _rep->exportToPDF( dir.absoluteFilePath( _rep-> ) ) { qDebug( "Error al guardar el reporte en el directorio." ); } }*/ return true; }
int AuthorizeDotNetProcessor::doCredit(const int pccardid, const QString &pcvv, const double pamount, const double ptax, const bool ptaxexempt, const double pfreight, const double pduty, const int pcurrid, QString &pneworder, QString &preforder, int &pccpayid, ParameterList &pparams) { Q_UNUSED(pcvv); if (DEBUG) qDebug("AN:doCredit(%d, pcvv, %f, %f, %d, %f, %f, %d, %s, %s, %d)", pccardid, pamount, ptax, ptaxexempt, pfreight, pduty, pcurrid, pneworder.toLatin1().data(), preforder.toLatin1().data(), pccpayid); int returnValue = 0; double amount = pamount; int currid = pcurrid; bool tryVoid = false; QString approvalCode; QString request; returnValue = buildFollowup(pccpayid, preforder, amount, currid, request, "CREDIT"); if (returnValue != 0) return returnValue; XSqlQuery anq; anq.prepare("SELECT ccpay_card_pan_trunc," " (ccpay_transaction_datetime > CURRENT_DATE" " AND ccpay_amount = :amount) AS tryVoid," " ccpay_r_code," " formatbytea(decrypt(setbytea(ccard_number)," " setbytea(:key),'bf')) AS ccard_number" " FROM ccpay LEFT OUTER JOIN ccard ON (ccpay_ccard_id=ccard_id)" " WHERE (ccpay_id=:ccpayid);"); anq.bindValue(":ccpayid", pccpayid); anq.bindValue(":key", omfgThis->_key); anq.bindValue(":now", QDateTime::currentDateTime()); anq.bindValue(":amount", amount); anq.exec(); if (anq.first()) { QString cardnum = anq.value("ccpay_card_pan_trunc").toString(); if (cardnum.isEmpty()) cardnum = anq.value("ccard_number").toString(); APPENDFIELD(request, "x_card_num", cardnum.right(4)); tryVoid = anq.value("tryVoid").toBool(); approvalCode = anq.value("ccpay_r_code").toString(); } else if (anq.lastError().type() != QSqlError::NoError) { _errorMsg = anq.lastError().databaseText(); return -1; } QString response; returnValue = sendViaHTTP(request, response); if (returnValue < 0) return returnValue; returnValue = handleResponse(response, pccardid, "R", amount, currid, pneworder, preforder, pccpayid, pparams); // TODO: make more precise - look for return code 54 if (returnValue < 0 && tryVoid) { int voidResult = 0; QString tmpErrorMsg = _errorMsg; ParameterList voidParams; _errorMsg.clear(); voidResult = doVoidPrevious(pccardid, pcvv, amount, currid, pneworder, preforder, approvalCode, pccpayid, voidParams); if (voidResult >= 0) { returnValue = voidResult; pparams.clear(); while (! voidParams.isEmpty()) pparams.append(voidParams.takeFirst()); } else _errorMsg = tmpErrorMsg; } return returnValue; }