*
liefert die erste Ausstrahlung des Typs ohne Berücksichtigung der CatchupRights
482405
private static String getBroadcastDateIgnoringCatchupRights(JsonArray broadcastArray, String broadcastType) {
        String broadcastDate = "";
        
        for(int i = 0; i < broadcastArray.size(); i++) {
            JsonObject broadcastObject = broadcastArray.get(i).getAsJsonObject();
            
            if(broadcastObject.has(JSON_ELEMENT_BROADCASTTYPE) && 
                broadcastObject.has(JSON_ELEMENT_BROADCAST)) {
                String type = broadcastObject.get(JSON_ELEMENT_BROADCASTTYPE).getAsString();
                
                if(type.equals(broadcastType)) {
                    if (!broadcastObject.get(JSON_ELEMENT_BROADCAST).isJsonNull()) {
                        broadcastDate = (broadcastObject.get(JSON_ELEMENT_BROADCAST).getAsString());
                    }
                }
            }
        }
        
        return broadcastDate;
    }
137324
protected function compile()
    {
        \System::loadLanguageFile('tl_backupdb');

        switch( \Input::get('act') ) {
            case 'backup':          BackupDbRun::run( );
                                    die( );               // Beenden, da Download rausgegangen ist

            case 'webtemplate':     $objTemplate = new \BackendTemplate('be_backupdb_wstpl');
                                    $this->Template = $objTemplate;
                                    $this->Template->arrResults = BackupWsTemplate::run( );
                                    $this->Template->back = 'contao/main.php?do=BackupDB&ref' . TL_REFERER_ID;
                                    $this->Template->backupdb_version = 'BackupDB Version ' . BACKUPDB_VERSION . '.' . BACKUPDB_BUILD;
                                    return;
        }

        //--- Zielverzeichnis für Website-Templates ---
        $zielVerz = 'templates';
        if( isset( $GLOBALS['BACKUPDB']['WsTemplatePath'] ) && is_dir(TL_ROOT.'/'.trim($GLOBALS['BACKUPDB']['WsTemplatePath'], '/')) ) {
            $zielVerz = trim($GLOBALS['BACKUPDB']['WsTemplatePath'], '/');
        }
        if( isset( $GLOBALS['TL_CONFIG']['WsTemplatePath'] ) && is_dir(TL_ROOT.'/'.trim($GLOBALS['TL_CONFIG']['WsTemplatePath'], '/')) && (trim($GLOBALS['TL_CONFIG']['WsTemplatePath']) != '') ) {
            $zielVerz = trim($GLOBALS['TL_CONFIG']['WsTemplatePath'], '/');
        }

        $filename = \Environment::get('host');                                                                  // Dateiname = Domainname
        if( isset($GLOBALS['TL_CONFIG']['websiteTitle']) ) $filename = $GLOBALS['TL_CONFIG']['websiteTitle'];   // IF( Exiat WbsiteTitle ) Dateiname für Template-Dateien
        $filename = \StringUtil::generateAlias( $filename );                                                    // Dateiname = Alias für Template-Dateien

        $this->Template->ws_template_sqlfile = $zielVerz.'/' . $filename . '.sql';
        $this->Template->ws_template_txtfile = $zielVerz.'/' . $filename . '.txt';
        $this->Template->ws_template_strfile = $zielVerz.'/' . $filename . '.structure';


        $this->Template->settingslink    = $settingslink = 'contao/main.php?do=settings&amp;ref=' . TL_REFERER_ID;
        $this->Template->cronlink        = $cronlink     = 'contao/main.php?do=cron&amp;ref=' . TL_REFERER_ID;
        $this->Template->backuplink      = 'contao/main.php?do=BackupDB&amp;act=backup&amp;rt=' . REQUEST_TOKEN . '&amp;ref=' . TL_REFERER_ID;
        $this->Template->webtemplatelink = 'contao/main.php?do=BackupDB&amp;act=webtemplate&amp;rt=' . REQUEST_TOKEN . '&amp;ref=' . TL_REFERER_ID;

        $this->Template->database = $GLOBALS['TL_CONFIG']['dbDatabase'];
        $this->Template->texte    = array(
                                        'download'      => $GLOBALS['TL_LANG']['tl_backupdb']['download'],
                                        'startdownload' => $GLOBALS['TL_LANG']['tl_backupdb']['startdownload'],
                                        'database'      => $GLOBALS['TL_LANG']['tl_backupdb']['database'] . ': ',

                                        'backupdesc'    => $GLOBALS['TL_LANG']['tl_backupdb']['backupdesc'],
                                        'backupsetup'   => sprintf( $GLOBALS['TL_LANG']['tl_backupdb']['backupsetup'], $settingslink ),
                                        'backuplast'    => $GLOBALS['TL_LANG']['tl_backupdb']['backuplast'] . ': ',

                                        'croninfo'      => $GLOBALS['TL_LANG']['tl_backupdb']['croninfo'],
                                        'cronsetup'     => sprintf( $GLOBALS['TL_LANG']['tl_backupdb']['cronsetup'], $cronlink ),
                                        'cronlast'      => $GLOBALS['TL_LANG']['tl_backupdb']['cronlast'] . ': ',

                                        'maketpl'       => $GLOBALS['TL_LANG']['tl_backupdb']['maketpl'],
                                        'tpldesc'       => $GLOBALS['TL_LANG']['tl_backupdb']['tpldesc'],
                                        'tplfiles'      => $GLOBALS['TL_LANG']['tl_backupdb']['tplfiles'] . ':',
                                        'tplnobackup'   => $GLOBALS['TL_LANG']['tl_backupdb']['tplnobackup'],
                                        'tplwarning'    => $GLOBALS['TL_LANG']['tl_backupdb']['tplwarning']
                                    );

        //--- CRON Erweiterung einbeziehen, wenn vorhanden ---
        $this->Template->ws_cron = $this->checkCronExt();               // übergibt 0 (kein Cron), 1 (Cron ohne Job), 2 (Cron, Job inaktiv) oder 3 (Cron, Job aktiv)
        if( ($this->Input->get('op') == 'cron') && ($this->checkCron() == 1) ) {
            $sql = "INSERT INTO `tl_cron` "
                  ."(`id`, `tstamp`, `lastrun`, `nextrun`, `scheduled`, `title`, `job`, `t_minute`, `t_hour`, `t_dom`, `t_month`, `t_dow`, `runonce`, `enabled`, `logging`) "
                  ."VALUES ( 0, " . time() . ", 0, 0, 0, 'AutoBackupDB', 'system/modules/BackupDB/AutoBackupDB.php', '0', '2', '*', '*', '*', '', '', '1')";
            $this->Database->execute( $sql );                           // inaktiven Cronjob eintragen
            $this->reload();
        }

        //--- Letzte Backups ---
        $pfad = TL_ROOT . '/' . $GLOBALS['TL_CONFIG']['uploadPath'] . '/AutoBackupDB/';
        $this->Template->lastrun = file_exists($pfad . BACKUPDB_RUN_LAST) ? file_get_contents($pfad . BACKUPDB_RUN_LAST) : '--.--.---- --:--';
        $this->Template->lastcron = file_exists($pfad . BACKUPDB_CRON_LAST) ? file_get_contents($pfad . BACKUPDB_CRON_LAST) : '--.--.---- --:--';

        //--- Footer ---
        $this->Template->backupdb_icons = 'Icons from <a href="https://icons8.com" target="_blank">Icons8</a> (<a href="https://creativecommons.org/licenses/by-nd/3.0/" target="_blank">CC BY-ND 3.0</a>)';
        $this->Template->backupdb_version = '<a href="https://github.com/do-while/contao-BackupDB" target="_blank">BackupDB Version ' . BACKUPDB_VERSION . '.' . BACKUPDB_BUILD . '</a>';
    }
988836
public function getPage()
    {
        $page = $this;
        if ($this->isPage) return $this;
        if (isset($this->_lazyParent)) {
            //optimierung: hier koennen eventuell ein paar nicht-pages uebersprungen werden
            $id = $this->_lazyParent;
            if (is_numeric($id) || strpos($id, '-') === false) {
                //ist eine page
            } else {
                if (strpos($id, '_') === false) {
                    $id = substr($id, 0, strpos($id, '-'));
                    if (!is_numeric($id)) {
                        return null;
                    }
                } else {
                    $underScorePos = strrpos($id, '_');
                    $hyphenPos = strpos($id, '-', $underScorePos);
                    if ($hyphenPos > $underScorePos) {
                        $id = substr($id, 0, $hyphenPos);
                    }
                }
            }
            return Kwf_Component_Data_Root::getInstance()->getComponentById($id, array('ignoreVisible'=>true));
        }
        while ($page && !$page->isPage) {
            $page = $page->parent;
        }
        return $page;
    }
997611
@Override
    public ListT<W,T> scanRight(final Monoid<T> monoid) {

        return (ListT<W,T>) FoldableTransformerSeq.super.scanRight(monoid);
    }
31090
public function outInvoicesMatchingByBank()
    {
        $this->getInvoicer();
        foreach ($this->getPaymentsToProcess($this->daysBack, 'in') as $paymentData) {

            $this->addStatusMessage(sprintf('Processing Payment %s %s %s vs: %s ss: %s %s',
                    $paymentData['kod'], $paymentData['sumCelkem'],
                    \FlexiPeeHP\FlexiBeeRO::uncode($paymentData['mena']),
                    $paymentData['varSym'], $paymentData['specSym'],
                    $this->banker->url.'/c/'.$this->banker->company.'/'.$this->banker->getEvidence().'/'.$paymentData['id']),
                'info');


            $invoices = $this->findInvoices($paymentData);
//  kdyz se vrati jedna faktura:
//     kdyz  je prijata castka mensi nebo rovno tak zlikviduji celou
//     kdyz sedi castka, nebo castecne
//  kdyz se vrati vic faktur  tak kdyz sedi castka uhrazuje se ta nejstarsi
//  jinak se uhrazuje castecne

            if (count($invoices) && count(current($invoices))) {
                $prijatoCelkem = floatval($paymentData['sumCelkem']);
                $payment       = new \FlexiPeeHP\Banka($paymentData,
                    $this->config);

                foreach ($invoices as $invoiceID => $invoiceData) {

                    $typDokl                = $invoiceData['typDokl'][0];
                    $docType                = $typDokl['typDoklK'];
                    $invoiceData['typDokl'] = \FlexiPeeHP\FlexiBeeRO::code($typDokl['kod']);

                    $invoice = new \FlexiPeeHP\FakturaVydana($invoiceData,
                        $this->config);

                    /*
                     *    Standardní faktura (typDokladu.faktura)
                     *    Dobropis/opravný daň. d. (typDokladu.dobropis)
                     *    Zálohová faktura (typDokladu.zalohFaktura)
                     *    Zálohový daňový doklad (typDokladu.zdd)
                     *    Dodací list (typDokladu.dodList)
                     *    Proforma (neúčetní) (typDokladu.proforma)
                     *    Pohyb Kč / Zůstatek Kč (typBanUctu.kc)
                     *    Pohyb měna / Zůstatek měna (typBanUctu.mena)
                     */
                    $matched = false;
                    switch ($docType) {
                        case 'typDokladu.zalohFaktura':
                        case 'typDokladu.faktura':
                            $matched = $this->settleInvoice($invoice, $payment);
                            break;
                        case 'typDokladu.proforma':
                            $matched = $this->settleProforma($invoice,
                                $paymentData);
                            break;
                        case 'typDokladu.dobropis':
                            $matched = $this->settleCreditNote($invoice,
                                $paymentData);
                            break;

                        default:
                            $this->addStatusMessage(
                                sprintf(_('Unsupported document type: %s %s'),
                                    $typDokl['typDoklK@showAs'].' ('.$docType.'): '.$invoiceData['typDokl'],
                                    $invoice->getApiURL()
                                ), 'warning');
                            break;
                    }

                    if ($matched && $this->savePayerAccount($invoice->getDataValue('firma'),
                            $payment)) {
                        $this->addStatusMessage(sprintf(_('new Bank account %s assigned to Address %s'),
                                $payment->getDataValue('buc').'/'.\FlexiPeeHP\FlexiBeeRO::uncode($payment->getDataValue('smerKod')),
                                $invoice->getDataValue('firma@showAs')));
                    }

                    $this->banker->loadFromFlexiBee($paymentData['id']);
                    if ($this->banker->getDataValue('sparovano') == true) {
                        break;
                    }
                }
            } else {

                if (!empty($paymentData['varSym'])) {
                    if (!empty($paymentData['varSym'])) {
                        $vInvoices = $this->searchInvoices(['varSym' => $paymentData['varSym']]);
                    }
                }
                if (!empty($paymentData['specSym'])) {
                    if (!empty($paymentData['specSym'])) {
                        $sInvoices = $this->searchInvoices(['specSym' => $paymentData['specSym']]);
                    }
                }

//                if ($vInvoices || $sInvoices) {
////                    $zdd = $this->paymentToZDD($payment);
////                    if ($zdd) {
////                        $this->addStatusMessage(sprinf(_('advance tax document created'),
////                                \FlexiPeeHP\FlexiBeeRO::uncode($zdd)));
////                    }
//
//                    $this->addStatusMessage(_('Invoice found: - overdue?'),
//                        'warning');
//                }
            }
        }
    }
650528
public function handleRequest()
    {
        //obsługa eksportera
        $this->_handleCsvExporter(FrontController::getInstance()->getRequest());
        //obsługa danych z POST
        $post = FrontController::getInstance()->getRequest()->getPost();
        //brak posta
        if ($post->isEmpty()) {
            return;
        }
        //jeśli przebudowano filtry lub sortowania render grida
        if ($this->_rebuildFilter($post) || $this->_rebuildOrder($post)) {
            $this->_render();
        }
    }
433989
function () {
        if (this.done) {
            return this.EOF;
        }
        if (!this._input) {
            this.done = true;
        }

        var token,
            match,
            tempMatch,
            index;
        if (!this._more) {
            this.yytext = '';
            this.match = '';
        }
        var rules = this._currentRules();
        for (var i = 0; i < rules.length; i++) {
            tempMatch = this._input.match(this.rules[rules[i]]);
            if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
                match = tempMatch;
                index = i;
                if (this.options.backtrack_lexer) {
                    token = this.test_match(tempMatch, rules[i]);
                    if (token !== false) {
                        return token;
                    } else if (this._backtrack) {
                        match = false;
                        continue; // rule action called reject() implying a rule MISmatch.
                    } else {
                        // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
                        return false;
                    }
                } else if (!this.options.flex) {
                    break;
                }
            }
        }
        if (match) {
            token = this.test_match(match, rules[index]);
            if (token !== false) {
                return token;
            }
            // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
            return false;
        }
        if (this._input === "") {
            return this.EOF;
        } else {
            return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), {
                text: "",
                token: null,
                line: this.yylineno
            });
        }
    }
783108
@Override
  @SuppressWarnings("unchecked")
  protected T getNext() {
    // if (lexer == null) {
    //   return null;
    // }
    try {
      return (T) lexer.next();
    } catch (IOException e) {
      throw new RuntimeIOException(e);
    }
    // cdm 2007: this shouldn't be necessary: PTBLexer decides for itself whether to return CRs based on the same flag!
    // get rid of CRs if necessary
    // while (!tokenizeNLs && PTBLexer.cr.equals(((HasWord) token).word())) {
    //   token = (T)lexer.next();
    // }

    // horatio: we used to catch exceptions here, which led to broken
    // behavior and made it very difficult to debug whatever the
    // problem was.
  }
254187
public function afterSave()
    {
        //brak obiektu
        if (!$this->_saveToObject) {
            return parent::afterSave();
        }
        //czyszczenie relacji
        (new AttributeValueRelationModel($this->_saveToObject, $this->getRecord()->id))->deleteAttributeValueRelations();
        //iteracja po elementach
        foreach ($this->_cmsAttributeElements as $attributeId => $element) {
            //zapis relacji
            $this->_createValueRelationByElement($attributeId, $element);
        }
        //iteracja po atrybutach
        foreach ($this->_cmsAttributes as $attribute) {
            //nie jest zmaterializowany, odziedziczony
            if (!$attribute->getJoined('cms_attribute_relation')->isMaterializedInherited()) {
                continue;
            }
            //brak obiektu do dziedziczenia
            if (null === $element = $this->getElement($attribute->key)) {
                throw new \Exception('No inherited attribute: ' . $attribute->key);
            }
            //zapis relacji z odziedziczonego elementu formularza (występującego w oryginalnym formularzu)
            $this->_createValueRelationByElement($attribute->id, $element);
        }
        //zapis udany
        return parent::afterSave();
    }
1049183
private ReportEntry9 createLine(UmsLine line) throws Exception {
        ReportEntry9 entry = new ReportEntry9();

        EntryDetails8 detail = new EntryDetails8();
        entry.getNtryDtls().add(detail);

        EntryTransaction9 tx = new EntryTransaction9();
        detail.getTxDtls().add(tx);

        // Checken, ob es Soll- oder Habenbuchung ist
        boolean haben = line.value != null && line.value.getBigDecimalValue().compareTo(BigDecimal.ZERO) > 0;

        entry.setCdtDbtInd(haben ? CreditDebitCode.CRDT : CreditDebitCode.DBIT);

        ////////////////////////////////////////////////////////////////////////
        // Buchungs-ID
        {
            TransactionReferences3 ref = new TransactionReferences3();
            tx.setRefs(ref);

            ProprietaryReference1 prt = new ProprietaryReference1();
            prt.setRef(line.id);
            ref.getPrtry().add(prt);
        }
        //
        ////////////////////////////////////////////////////////////////////////

        ////////////////////////////////////////////////////////////////////////
        // Gegenkonto: IBAN + Name
        if (line.other != null) {
            TransactionParties4 other = new TransactionParties4();
            tx.setRltdPties(other);

            CashAccount24 acc = new CashAccount24();
            if (haben)
                other.setDbtrAcct(acc);
            else
                other.setCdtrAcct(acc);

            AccountIdentification4Choice id = new AccountIdentification4Choice();
            acc.setId(id);
            id.setIBAN(line.other.iban);

            Party35Choice party = new Party35Choice();
            PartyIdentification125 pi = new PartyIdentification125();
            pi.setNm(line.other.name);
            party.setPty(pi);

            if (haben)
                other.setDbtr(party);
            else
                other.setCdtr(party);
        }
        //
        ////////////////////////////////////////////////////////////////////////

        ////////////////////////////////////////////////////////////////////////
        // Gegenkonto: BIC
        if (line.other != null) {
            TransactionAgents4 banks = new TransactionAgents4();
            tx.setRltdAgts(banks);

            BranchAndFinancialInstitutionIdentification5 bank = new BranchAndFinancialInstitutionIdentification5();
            if (haben)
                banks.setDbtrAgt(bank);
            else
                banks.setCdtrAgt(bank);

            FinancialInstitutionIdentification8 bic = new FinancialInstitutionIdentification8();
            bank.setFinInstnId(bic);
            bic.setBICFI(line.other.bic);
        }
        //
        ////////////////////////////////////////////////////////////////////////

        ////////////////////////////////////////////////////////////////////////
        // Verwendungszweck
        if (line.usage != null && line.usage.size() > 0) {
            RemittanceInformation15 usages = new RemittanceInformation15();
            usages.getUstrd().addAll(line.usage);
            tx.setRmtInf(usages);
        }
        //
        ////////////////////////////////////////////////////////////////////////

        ////////////////////////////////////////////////////////////////////////
        // Betrag
        if (line.value != null) {
            ActiveOrHistoricCurrencyAndAmount amt = new ActiveOrHistoricCurrencyAndAmount();
            entry.setAmt(amt);

            BigDecimal val = line.value.getBigDecimalValue();
            amt.setValue(val.abs()); // Hier gibt es keine negativen Werte. Wir haben stattdessen DEB/CRED-Merkmale
            amt.setCcy(line.value.getCurr());
        }
        //
        ////////////////////////////////////////////////////////////////////////

        ////////////////////////////////////////////////////////////////////////
        // Storno-Kennzeichen
        if (line.isStorno)
            entry.setRvslInd(Boolean.TRUE);
        //
        ////////////////////////////////////////////////////////////////////////

        ////////////////////////////////////////////////////////////////////////
        // Buchungs- und Valuta-Datum
        Date bdate = line.bdate;
        Date valuta = line.valuta;

        if (bdate == null) bdate = valuta;
        if (valuta == null) valuta = bdate;

        if (bdate != null) {
            DateAndDateTime2Choice d = new DateAndDateTime2Choice();
            d.setDt(this.createCalendar(bdate.getTime()));
            entry.setBookgDt(d);
        }

        if (valuta != null) {
            DateAndDateTime2Choice d = new DateAndDateTime2Choice();
            d.setDt(this.createCalendar(valuta.getTime()));
            entry.setValDt(d);
        }
        //
        ////////////////////////////////////////////////////////////////////////

        ////////////////////////////////////////////////////////////////////////
        // Art und Kundenreferenz
        entry.setAddtlNtryInf(line.text);
        entry.setAcctSvcrRef(line.customerref);
        //
        ////////////////////////////////////////////////////////////////////////

        ////////////////////////////////////////////////////////////////////////
        // Primanota, GV-Code und GV-Code-Ergaenzung
        StringBuilder sb = new StringBuilder();
        if (line.gvcode != null && line.gvcode.length() > 0) {
            sb.append(line.gvcode);
            sb.append("+");
        }
        if (line.primanota != null && line.primanota.length() > 0) {
            sb.append(line.primanota);
            sb.append("+");
        }
        if (line.addkey != null && line.addkey.length() > 0) {
            sb.append(line.addkey);
        }

        String s = sb.toString();
        if (s.length() > 0) {
            BankTransactionCodeStructure4 b = new BankTransactionCodeStructure4();
            tx.setBkTxCd(b);

            ProprietaryBankTransactionCodeStructure1 pb = new ProprietaryBankTransactionCodeStructure1();
            pb.setCd(s);
            b.setPrtry(pb);
        }
        //
        ////////////////////////////////////////////////////////////////////////

        ////////////////////////////////////////////////////////////////////////
        // Purpose-Code
        if (line.purposecode != null) {
            Purpose2Choice c = new Purpose2Choice();
            c.setCd(line.purposecode);
            tx.setPurp(c);
        }
        //
        ////////////////////////////////////////////////////////////////////////

        return entry;
    }
1206938
function getReturn(spec_c, details, method, parent) {
  var retType = getType(getText(spec_c, 'type'), parent);
  var retDescription = (details ? getText(details, 'description') : '');
  return ((retType == 'void') ? {} : {
    type: retType,
    description: retDescription
  });
}
318873
public function byIdentifierList($list, $sep = ',', $idname = 'id', $checkCardinality = TRUE, &$parsed = NULL, &$found = NULL) {
    if ($list == NULL) {
      return array();
    }
    
    if (is_array($list)) {
      $identifiers = $list;
    } else {
      $identifiers = explode($sep, trim($list));
    }
    $identifiers = array_map('trim',$identifiers);
    $identifiers = array_filter($identifiers, function ($identifier) {
      return !empty($identifier); // schließt auch 0 aus
    });
    
    $parsed = count($identifiers);
    if (count($identifiers) == 0) return array();
    $result = $this->getRepository()->findAllByIds($identifiers, $idname);
    
    $found = count($result);
    
    if ($checkCardinality && ($parsed != $found)) {
      throw new \Psc\Exception('Es konnten nicht alle identifier aus der Liste hydriert werden! Gefunden aus '.$list.': '.Code::varInfo($identifiers).' in der DB gefunden #'.count($result));
    }
    
    return $result;
  }
1019054
private UmsLine createLine(ReportEntry3 entry, BigDecimal currSaldo) {
        UmsLine line = new UmsLine();
        line.isSepa = true;
        line.isCamt = true;
        line.other = new Konto();

        List<EntryDetails2> details = entry.getNtryDtls();
        if (details.size() == 0)
            return null;

        // Das Schema sieht zwar mehrere Detail-Elemente vor, ich wuesste
        // aber ohnehin nicht, wie man das sinnvoll mappen koennte
        EntryDetails2 detail = details.get(0);

        List<EntryTransaction3> txList = detail.getTxDtls();
        if (txList.size() == 0)
            return null;

        // Checken, ob es Soll- oder Habenbuchung ist
        boolean haben = entry.getCdtDbtInd() != null && entry.getCdtDbtInd() == CreditDebitCode.CRDT;

        // ditto
        EntryTransaction3 tx = txList.get(0);

        ////////////////////////////////////////////////////////////////////////
        // Buchungs-ID
        TransactionReferences3 ref = tx.getRefs();
        if (ref != null) {
            line.id = trim(ref.getPrtry() != null && ref.getPrtry().size() > 0 ? ref.getPrtry().get(0).getRef() : null);
            line.endToEndId = trim(ref.getEndToEndId());
            line.mandateId = trim(ref.getMndtId());
        }
        ////////////////////////////////////////////////////////////////////////

        ////////////////////////////////////////////////////////////////////////
        // Gegenkonto: IBAN + Name
        TransactionParties3 other = tx.getRltdPties();
        if (other != null) {
            CashAccount24 acc = haben ? other.getDbtrAcct() : other.getCdtrAcct();
            AccountIdentification4Choice id = acc != null ? acc.getId() : null;
            line.other.iban = trim(id != null ? id.getIBAN() : null);

            PartyIdentification43 name = haben ? other.getDbtr() : other.getCdtr();
            line.other.name = trim(name != null ? name.getNm() : null);

            // Abweichender Name, falls vorhanden
            name = haben ? other.getUltmtDbtr() : other.getUltmtCdtr();
            line.other.name2 = trim(name != null ? name.getNm() : null);
        }
        //
        ////////////////////////////////////////////////////////////////////////

        ////////////////////////////////////////////////////////////////////////
        // Gegenkonto: BIC
        TransactionAgents3 banks = tx.getRltdAgts();
        if (banks != null) {
            BranchAndFinancialInstitutionIdentification5 bank = haben ? banks.getDbtrAgt() : banks.getCdtrAgt();
            FinancialInstitutionIdentification8 bic = bank != null ? bank.getFinInstnId() : null;
            line.other.bic = trim(bank != null ? bic.getBICFI() : null);
        }
        //
        ////////////////////////////////////////////////////////////////////////

        ////////////////////////////////////////////////////////////////////////
        // Verwendungszweck
        List<String> usages = tx.getRmtInf() != null ? tx.getRmtInf().getUstrd() : null;
        if (usages != null && usages.size() > 0)
            line.usage.addAll(trim(usages));
        //
        ////////////////////////////////////////////////////////////////////////

        ////////////////////////////////////////////////////////////////////////
        // Betrag
        ActiveOrHistoricCurrencyAndAmount amt = entry.getAmt();
        BigDecimal bd = amt.getValue() != null ? amt.getValue() : BigDecimal.ZERO;
        line.value = new Value(this.checkDebit(bd, entry.getCdtDbtInd()));
        line.value.setCurr(amt.getCcy());
        //
        ////////////////////////////////////////////////////////////////////////

        ////////////////////////////////////////////////////////////////////////
        // Storno-Kennzeichen
        // Laut Spezifikation kehrt sich bei Stornobuchungen im Gegensatz zu MT940
        // nicht das Vorzeichen um. Der Betrag bleibt also gleich
        line.isStorno = entry.isRvslInd() != null && entry.isRvslInd().booleanValue();
        //
        ////////////////////////////////////////////////////////////////////////

        ////////////////////////////////////////////////////////////////////////
        // Buchungs- und Valuta-Datum
        DateAndDateTimeChoice bdate = entry.getBookgDt();
        line.bdate = bdate != null ? SepaUtil.toDate(bdate.getDt()) : null;

        DateAndDateTimeChoice vdate = entry.getValDt();
        line.valuta = vdate != null ? SepaUtil.toDate(vdate.getDt()) : null;

        // Wenn einer von beiden Werten fehlt, uebernehmen wir dort den jeweils anderen
        if (line.bdate == null) line.bdate = line.valuta;
        if (line.valuta == null) line.valuta = line.bdate;
        //
        ////////////////////////////////////////////////////////////////////////

        ////////////////////////////////////////////////////////////////////////
        // Saldo
        line.saldo = new Saldo();
        line.saldo.value = new Value(currSaldo.add(line.value.getBigDecimalValue()));
        line.saldo.value.setCurr(line.value.getCurr());
        line.saldo.timestamp = line.bdate;
        //
        ////////////////////////////////////////////////////////////////////////

        ////////////////////////////////////////////////////////////////////////
        // Art und Kundenreferenz
        line.text = trim(entry.getAddtlNtryInf());
        line.customerref = trim(entry.getAcctSvcrRef());
        //
        ////////////////////////////////////////////////////////////////////////

        ////////////////////////////////////////////////////////////////////////
        // Primanota, GV-Code und GV-Code-Ergaenzung
        // Ich weiss nicht, ob das bei allen Banken so codiert ist.
        // Bei der Sparkasse ist es jedenfalls so.
        BankTransactionCodeStructure4 b = tx.getBkTxCd();
        String code = (b != null && b.getPrtry() != null) ? b.getPrtry().getCd() : null;
        if (code != null && code.contains("+")) {
            String[] parts = code.split("\\+");
            if (parts.length == 4) {
                line.gvcode = parts[1];
                line.primanota = parts[2];
                line.addkey = parts[3];
            }
        }
        //
        ////////////////////////////////////////////////////////////////////////

        ////////////////////////////////////////////////////////////////////////
        // Purpose-Code
        Purpose2Choice purp = tx.getPurp();
        line.purposecode = trim(purp != null ? purp.getCd() : null);
        //
        ////////////////////////////////////////////////////////////////////////

        return line;
    }
999291
private static byte[] persist(Item... items) {
		ByteArrayOutputStream arrayOutputStream = new ByteArrayOutputStream();
		DataOutputStream dataOutputStream = new DataOutputStream(arrayOutputStream);

		// Items sortieren, damit sich die Id nicht unnötig ändert.
		Arrays.sort(items);

		try {
			// Anzahl der Items schreiben, um sie später einfacher wieder lesen
			// zu können.
			dataOutputStream.writeInt(items.length);

			// Die einzelnen Items schreiben
			for (Item item : items) {
				dataOutputStream.writeUTF(item.type());
				item.writeToStream(dataOutputStream);
			}

		} catch (IOException e) {
			throw new RuntimeException(e);
		}

		return arrayOutputStream.toByteArray();
	}
807940
def CrearAjusteCredito(self, 
               datos_adicionales=None,              # unificado, contrato, papel
               concepto_importe_iva_0=None,         # unificado, contrato, papel
               importe_ajustar_iva_0=None,          # unificado, contrato, papel
               concepto_importe_iva_105=None,       # unificado, contrato, papel
               importe_ajustar_iva_105=None,        # unificado, contrato, papel
               concepto_importe_iva_21=None,        # unificado, contrato, papel
               importe_ajustar_iva_21=None,         # unificado, contrato, papel
               diferencia_peso_neto=None,           # unificado
               diferencia_precio_operacion=None,    # unificado
               cod_grado=None,                      # unificado
               val_grado=None,                      # unificado  
               factor=None,                         # unificado
               diferencia_precio_flete_tn=None,     # unificado
               **kwargs
               ):
        ""

        self.ajuste['ajusteCredito'] = {
            'diferenciaPesoNeto': diferencia_peso_neto,
            'diferenciaPrecioOperacion': diferencia_precio_operacion,
            'codGrado': cod_grado,
            'valGrado': val_grado,
            'factor': factor,
            'diferenciaPrecioFleteTn': diferencia_precio_flete_tn,
            'datosAdicionales': datos_adicionales,
            'opcionales': None,
            'conceptoImporteIva0': concepto_importe_iva_0,
            'importeAjustarIva0': importe_ajustar_iva_0,
            'conceptoImporteIva105': concepto_importe_iva_105,
            'importeAjustarIva105': importe_ajustar_iva_105,
            'conceptoImporteIva21': concepto_importe_iva_21,
            'importeAjustarIva21': importe_ajustar_iva_21,
            'deducciones': [],
            'retenciones': [],
            'percepciones': [],
            'certificados': [],
            }
        # vinculación con AgregarOpcional:
        self.opcionales = self.ajuste['ajusteCredito']['opcionales']
        # vinculación con AgregarRetencion y AgregarDeduccion
        self.deducciones = self.ajuste['ajusteCredito']['deducciones']
        self.retenciones = self.ajuste['ajusteCredito']['retenciones']
        # para LSG:
        self.percepciones = self.ajuste['ajusteCredito']['percepciones']
        # para compatibilidad con AgregarCertificado (WSLPGv1.17)
        self.liquidacion = self.ajuste['ajusteCredito']
        return True
932027
public function showVersionStatus()
        {
                $update_needed = false;

        $output = "<table class='tableBorder'>";
                $output .= "<tr><td class='tableHead' colspan='2'>IDS Version</td></tr>";

                $output .= "<tr><td class='tableCell' valign='top'>Filter:</td>\n<td class='tableCell'>";
                if ($this->isRulesUpdated()) {
                        $output .=  "<span style='color: green;'>aktuell.</span>";
                } else {
                        $output .=  "<span style='color: red;'>nicht aktuell.</span>";
                        $update_needed = true;
                }
                $output .= "<br />Letzte lokale &Auml;nderung: <strong>".$this->getLastRulesUpdate()."</strong><br />";
                $output .= "Letzte &Auml;nderung auf php-ids.org: <strong>".$this->getLastFileUpdate(self::FILENAME_RULES)."</strong><br />";
                $output .= "SHA-1 Hash: <br /> <code>".$this->getLocalFileHash(self::FILENAME_RULES)."</code>";
                if (!$this->isRulesUpdated()) {
                        $output .= "(local)<br /> <code>".$this->getCurrentFileHash(self::FILENAME_RULES)."</code>(remote)";
                }
                $output .= "</td></tr>";

                $output .= "<tr><td class='tableCell' valign='top'>Converter:</td>\n<td class='tableCell'>";
                if ($this->isConverterUpdated()) {
                        $output .=  "<span style='color: green;'>aktuell.</span>";
                } else {
                        $output .=  "<span style='color: red;'>nicht aktuell.</span>";
                        $update_needed = true;
                }
                $output .= "<br />Letzte lokale &Auml;nderung: <strong>".$this->getLastConverterUpdate()."</strong><br />";
                $output .= "Letzte &Auml;nderung auf php-ids.org: <strong>".$this->getLastFileUpdate(self::FILENAME_CONVERTER)."</strong><br />";
                $output .= "SHA-1 Hash: <br /> <code>".$this->getLocalFileHash(self::FILENAME_CONVERTER)."</code>";
                if (!$this->isConverterUpdated()) {
                        $output .= "(local)<br /> <code>".$this->getCurrentFileHash(self::FILENAME_CONVERTER)."</code>(remote)";
                }
                $output .= "</td></tr>";

                // is update possible?
                if (!$this->isRulesUpdated() || !$this->isConverterUpdated()) {
                        $output .= "<tr><td class='tableCell'> </td>\n<td class='tableCell'>";
                        if ($this->isWritable() && function_exists("curl_init")) {
                                $output .= "<form method='POST'>";
                                $output .= "<input type='submit' name='update_phpids' value='Automatisch Aktualisieren' />";
                                $output .= "</form>";
                        } else {
                                $output .= "Kein automatisches Update verf&uuml;gbar. (Dateien beschreibbar/ Curl-Extension verf&uuml;gbar?)";
                        }
                        $output .= "</td></tr>";
                }

                $output .= "</table>";

                return $output;
        }
770630
public function registerNotificationTyps()
    {
        if (isset($GLOBALS['con4gis']['queue']['notificationtypes']) &&
            is_array($GLOBALS['con4gis']['queue']['notificationtypes']) &&
            count($GLOBALS['con4gis']['queue']['notificationtypes'])
        ){
            foreach ($GLOBALS['con4gis']['queue']['notificationtypes'] as $nt => $kinds) {
                foreach ($kinds as $key => $kind) {
                    if (is_array($kind)) {
                        // Key ist der Name der Art ($kind) und $kind enthält zusätzliche Tags.
                        $tags = array_merge($this->tags, $kind);
                        $kind = $key;
                    } else {
                        $tags = $this->tags;
                    }

                    $this->setField($nt, $kind, $tags);
                }
            }
        }
    }