<?php

namespace TablesRouter;

class Fop_fints_buchung {
  
  

  
  

    // --- Statische Methoden ---
  
  public static function deleteConfirmURL($id = null , $params = [] ) { 
    
    
    // --- BLOCK: main ---
    
		$params['id'] = $id;
		return self::deleteConfirmURL2($params);
	
    
  }

  public static function viewURL($id = null , $params = [] ) { 
    
    
    // --- BLOCK: main ---
    
		$params['id'] = $id;
		return self::viewURL2($params);
	
    
  }

  public static function ignoreForderungURL($ids, $params = [] ) { 
    
    
    // --- BLOCK: main ---
    
		$params['ids'] = $ids;
		return self::ignoreForderungURL2($params);
	
    
  }

  public static function indexURL($params = [] ) { 
    
    
    // --- BLOCK: main ---
    
		
		return self::indexURL2($params);
	
    
  }

  public static function createURL($params = [] , $column_konto = null ) { 
    
    
    // --- BLOCK: main ---
    
		$params['column_konto'] = $column_konto;
		return self::createURL2($params);
	
    
  }

  public static function editURL($id = null , $params = [] ) { 
    
    
    // --- BLOCK: main ---
    
		$params['id'] = $id;
		return self::editURL2($params);
	
    
  }

  public static function deleteURL($id, $params = [] ) { 
    
    
    // --- BLOCK: main ---
    
		$params['id'] = $id;
		return self::deleteURL2($params);
	
    
  }

  public static function hashkontoUniqueURL($context, $value, $id, $params = [] ) { 
    
    
    // --- BLOCK: main ---
    
		$params['context'] = $context;$params['value'] = $value;$params['id'] = $id;
		return self::hashkontoUniqueURL2($params);
	
    
  }

  public static function deleteConfirmURL2($params) { 
    
    
    // --- BLOCK: main ---
    
		// Default-URL - kann durch rewrite-Regeln abgeändert werden
		
		if (!isset($url)) {
			$url = 'Tables/Fop_fints_buchung/deleteConfirm';
			$isFirst = true;
		}
		foreach ($params AS $k => $v) {
			if (!is_null($v)) {
				$url .= ($isFirst ? '?' : '&') . urlencode($k) . '=' . \FOP\Util::urlencode($v);
				$isFirst = false;
			}
		}
		if (\FOP\Configuration::getFOPUtilEnableRewrite() == 'true' || \FOP\Configuration::getFOPUtilEnableRewrite() == 1) {
			return \FOP\Util::getCurrentBaseurl() . $url;
		} else {
			return \FOP\Util::getCurrentBaseurl() . 'fop-router.php?q=' . urlencode($url);
		}
	
    
  }

  public static function viewURL2($params) { 
    
    
    // --- BLOCK: main ---
    
		// Default-URL - kann durch rewrite-Regeln abgeändert werden
		
		if (!isset($url)) {
			$url = 'Tables/Fop_fints_buchung/view';
			$isFirst = true;
		}
		foreach ($params AS $k => $v) {
			if (!is_null($v)) {
				$url .= ($isFirst ? '?' : '&') . urlencode($k) . '=' . \FOP\Util::urlencode($v);
				$isFirst = false;
			}
		}
		if (\FOP\Configuration::getFOPUtilEnableRewrite() == 'true' || \FOP\Configuration::getFOPUtilEnableRewrite() == 1) {
			return \FOP\Util::getCurrentBaseurl() . $url;
		} else {
			return \FOP\Util::getCurrentBaseurl() . 'fop-router.php?q=' . urlencode($url);
		}
	
    
  }

  public static function ignoreForderungURL2($params) { 
    
    
    // --- BLOCK: main ---
    
		// Default-URL - kann durch rewrite-Regeln abgeändert werden
		
		if (!isset($url)) {
			$url = 'Tables/Fop_fints_buchung/ignoreForderung';
			$isFirst = true;
		}
		foreach ($params AS $k => $v) {
			if (!is_null($v)) {
				$url .= ($isFirst ? '?' : '&') . urlencode($k) . '=' . \FOP\Util::urlencode($v);
				$isFirst = false;
			}
		}
		if (\FOP\Configuration::getFOPUtilEnableRewrite() == 'true' || \FOP\Configuration::getFOPUtilEnableRewrite() == 1) {
			return \FOP\Util::getCurrentBaseurl() . $url;
		} else {
			return \FOP\Util::getCurrentBaseurl() . 'fop-router.php?q=' . urlencode($url);
		}
	
    
  }

  public static function indexURL2($params) { 
    
    
    // --- BLOCK: main ---
    
		// Default-URL - kann durch rewrite-Regeln abgeändert werden
		
		if (!isset($url)) {
			$url = 'Tables/Fop_fints_buchung/index';
			$isFirst = true;
		}
		foreach ($params AS $k => $v) {
			if (!is_null($v)) {
				$url .= ($isFirst ? '?' : '&') . urlencode($k) . '=' . \FOP\Util::urlencode($v);
				$isFirst = false;
			}
		}
		if (\FOP\Configuration::getFOPUtilEnableRewrite() == 'true' || \FOP\Configuration::getFOPUtilEnableRewrite() == 1) {
			return \FOP\Util::getCurrentBaseurl() . $url;
		} else {
			return \FOP\Util::getCurrentBaseurl() . 'fop-router.php?q=' . urlencode($url);
		}
	
    
  }

  public static function route($q) { 
    
    
    // --- BLOCK: main ---
    
	if (($q == 'deleteConfirm') ) {
		try {
			$result = \Tables\Fop_fints_buchung::deleteConfirmAction(isset($_GET['id']) ? $_GET['id'] : null);
		} catch(\FOP\AccessDeniedException $e){
			\EasyEditor\Errors::render($e->getMessage() ?: 'accessdenied');
			die();
		}
		if (isset($result)) {
			header('Content-Type: application/json'); 
			die(json_encode($result));
		} else {
			die('');
		}
	}if (($q == 'view') ) {
		try {
			$result = \Tables\Fop_fints_buchung::viewAction(isset($_GET['id']) ? $_GET['id'] : null);
		} catch(\FOP\AccessDeniedException $e){
			\EasyEditor\Errors::render($e->getMessage() ?: 'accessdenied');
			die();
		}
		if (isset($result)) {
			header('Content-Type: application/json'); 
			die(json_encode($result));
		} else {
			die('');
		}
	}if (($q == 'create') ) {
		try {
			$result = \Tables\Fop_fints_buchung::createAction(isset($_GET['column_konto']) ? $_GET['column_konto'] : null);
		} catch(\FOP\AccessDeniedException $e){
			\EasyEditor\Errors::render($e->getMessage() ?: 'accessdenied');
			die();
		}
		if (isset($result)) {
			header('Content-Type: application/json'); 
			die(json_encode($result));
		} else {
			die('');
		}
	}if (($q == 'edit') ) {
		try {
			$result = \Tables\Fop_fints_buchung::editAction(isset($_GET['id']) ? $_GET['id'] : null);
		} catch(\FOP\AccessDeniedException $e){
			\EasyEditor\Errors::render($e->getMessage() ?: 'accessdenied');
			die();
		}
		if (isset($result)) {
			header('Content-Type: application/json'); 
			die(json_encode($result));
		} else {
			die('');
		}
	}if (($q == 'ignoreForderung') && isset($_GET['ids'])  ) {
		try {
			$result = \Tables\Fop_fints_buchung::ignoreForderungAction($_GET['ids']);
		} catch(\FOP\AccessDeniedException $e){
			\EasyEditor\Errors::render($e->getMessage() ?: 'accessdenied');
			die();
		}
		if (isset($result)) {
			header('Content-Type: application/json'); 
			die(json_encode($result));
		} else {
			die('');
		}
	}if (($q == 'hashkontoUnique') && isset($_GET['context'])   && isset($_GET['value'])   && isset($_GET['id'])  ) {
		try {
			$result = \Tables\Fop_fints_buchung::hashkontoUniqueAction($_GET['context'], $_GET['value'], $_GET['id']);
		} catch(\FOP\AccessDeniedException $e){
			\EasyEditor\Errors::render($e->getMessage() ?: 'accessdenied');
			die();
		}
		if (isset($result)) {
			header('Content-Type: application/json'); 
			die(json_encode($result));
		} else {
			die('');
		}
	}if (($q == 'delete') && isset($_GET['id'])  ) {
		try {
			$result = \Tables\Fop_fints_buchung::deleteAction($_GET['id']);
		} catch(\FOP\AccessDeniedException $e){
			\EasyEditor\Errors::render($e->getMessage() ?: 'accessdenied');
			die();
		}
		if (isset($result)) {
			header('Content-Type: application/json'); 
			die(json_encode($result));
		} else {
			die('');
		}
	}if (($q == 'index' || $q == '')) {
		try {
			$result = \Tables\Fop_fints_buchung::indexAction();
		} catch(\FOP\AccessDeniedException $e){
			\EasyEditor\Errors::render($e->getMessage() ?: 'accessdenied');
			die();
		}
		if (isset($result)) {
			header('Content-Type: application/json'); 
			die(json_encode($result));
		} else {
			die('');
		}
	}

	header('HTTP/1.0 404 Not found');
	\EasyEditor\Errors::render('Die angeforderte Funktion wurde nicht gefunden.');
	die();
    
  }

  public static function createURL2($params) { 
    
    
    // --- BLOCK: main ---
    
		// Default-URL - kann durch rewrite-Regeln abgeändert werden
		
		if (!isset($url)) {
			$url = 'Tables/Fop_fints_buchung/create';
			$isFirst = true;
		}
		foreach ($params AS $k => $v) {
			if (!is_null($v)) {
				$url .= ($isFirst ? '?' : '&') . urlencode($k) . '=' . \FOP\Util::urlencode($v);
				$isFirst = false;
			}
		}
		if (\FOP\Configuration::getFOPUtilEnableRewrite() == 'true' || \FOP\Configuration::getFOPUtilEnableRewrite() == 1) {
			return \FOP\Util::getCurrentBaseurl() . $url;
		} else {
			return \FOP\Util::getCurrentBaseurl() . 'fop-router.php?q=' . urlencode($url);
		}
	
    
  }

  public static function editURL2($params) { 
    
    
    // --- BLOCK: main ---
    
		// Default-URL - kann durch rewrite-Regeln abgeändert werden
		
		if (!isset($url)) {
			$url = 'Tables/Fop_fints_buchung/edit';
			$isFirst = true;
		}
		foreach ($params AS $k => $v) {
			if (!is_null($v)) {
				$url .= ($isFirst ? '?' : '&') . urlencode($k) . '=' . \FOP\Util::urlencode($v);
				$isFirst = false;
			}
		}
		if (\FOP\Configuration::getFOPUtilEnableRewrite() == 'true' || \FOP\Configuration::getFOPUtilEnableRewrite() == 1) {
			return \FOP\Util::getCurrentBaseurl() . $url;
		} else {
			return \FOP\Util::getCurrentBaseurl() . 'fop-router.php?q=' . urlencode($url);
		}
	
    
  }

  public static function deleteURL2($params) { 
    
    
    // --- BLOCK: main ---
    
		// Default-URL - kann durch rewrite-Regeln abgeändert werden
		
		if (!isset($url)) {
			$url = 'Tables/Fop_fints_buchung/delete';
			$isFirst = true;
		}
		foreach ($params AS $k => $v) {
			if (!is_null($v)) {
				$url .= ($isFirst ? '?' : '&') . urlencode($k) . '=' . \FOP\Util::urlencode($v);
				$isFirst = false;
			}
		}
		if (\FOP\Configuration::getFOPUtilEnableRewrite() == 'true' || \FOP\Configuration::getFOPUtilEnableRewrite() == 1) {
			return \FOP\Util::getCurrentBaseurl() . $url;
		} else {
			return \FOP\Util::getCurrentBaseurl() . 'fop-router.php?q=' . urlencode($url);
		}
	
    
  }

  public static function hashkontoUniqueURL2($params) { 
    
    
    // --- BLOCK: main ---
    
		// Default-URL - kann durch rewrite-Regeln abgeändert werden
		
		if (!isset($url)) {
			$url = 'Tables/Fop_fints_buchung/hashkontoUnique';
			$isFirst = true;
		}
		foreach ($params AS $k => $v) {
			if (!is_null($v)) {
				$url .= ($isFirst ? '?' : '&') . urlencode($k) . '=' . \FOP\Util::urlencode($v);
				$isFirst = false;
			}
		}
		if (\FOP\Configuration::getFOPUtilEnableRewrite() == 'true' || \FOP\Configuration::getFOPUtilEnableRewrite() == 1) {
			return \FOP\Util::getCurrentBaseurl() . $url;
		} else {
			return \FOP\Util::getCurrentBaseurl() . 'fop-router.php?q=' . urlencode($url);
		}
	
    
  }

  public static function ignoreForderungAccess($ids) { 
    
    
    // --- BLOCK: access ---
    if(!(((\FOP\User::getBuchhaltung()) && (\FOP\User::getBuchhaltung())))) return false;
    // --- BLOCK: access-itemlist-fop_fints_buchung-view ---
    
		if (\FOP\Database::query('SELECT SUM(CASE WHEN COALESCE(('.\FOP\Database::quote(\FOP\User::getBuchhaltung()).') AND (COALESCE((SELECT ('.\FOP\Database::quote(\FOP\User::getBuchhaltung()).') FROM '.qi('fop_fints_konto').' '.qi('ztZvmiXX').' WHERE '.qi('ztZvmiXX').'.'.qi('ID').' = '.qi('fop_fints_buchung').'.'.qi('konto').' LIMIT 1), FALSE)) AND ('.\FOP\Database::quote(\FOP\User::getBuchhaltung()).'), false) THEN 0 ELSE 1 END) FROM '.qi('fop_fints_buchung').' WHERE ' . (new \FOP\IDList($ids))->toSQL(''.qi('ID').''))->fetchColumn() > 0) {
			return false;
		}
	
    // --- BLOCK: main ---
    return true;
    
  }

  public static function indexAccess() { 
    
    
    // --- BLOCK: access ---
    if(!(((\FOP\User::getBuchhaltung()) && (\FOP\User::getBuchhaltung())) && (!\FOP\User::getIsGuest()))) return false;
    // --- BLOCK: main ---
    return true;
    
  }

  public static function deleteConfirmAccess($id = null ) { 
    
    
    // --- BLOCK: access ---
    if(!(((false) && (\FOP\User::getBuchhaltung()) && (\FOP\User::getBuchhaltung())))) return false;
    // --- BLOCK: access-itemlist-fop_fints_buchung-delete ---
    
		if ($id !== null && \FOP\Database::query('SELECT SUM(CASE WHEN COALESCE((FALSE) AND ('.\FOP\Database::quote(\FOP\User::getBuchhaltung()).') AND (COALESCE((SELECT ('.\FOP\Database::quote(\FOP\User::getBuchhaltung()).') FROM '.qi('fop_fints_konto').' '.qi('vBKfwiB4').' WHERE '.qi('vBKfwiB4').'.'.qi('ID').' = '.qi('fop_fints_buchung').'.'.qi('konto').' LIMIT 1), FALSE)) AND ('.\FOP\Database::quote(\FOP\User::getBuchhaltung()).'), false) THEN 0 ELSE 1 END) FROM '.qi('fop_fints_buchung').' WHERE ' . (new \FOP\IDList($id))->toSQL(''.qi('ID').''))->fetchColumn() > 0) {
			return false;
		}
	
    // --- BLOCK: main ---
    return false;
    
  }

  public static function viewAccess($id = null ) { 
    
    
    // --- BLOCK: access ---
    if(!(!\FOP\User::getIsGuest())) return false;
    // --- BLOCK: main ---
    return true;
    
  }

  public static function deleteAccess($id) { 
    
    
    // --- BLOCK: access ---
    if(!(((false) && (\FOP\User::getBuchhaltung()) && (\FOP\User::getBuchhaltung())))) return false;
    // --- BLOCK: access-itemlist-fop_fints_buchung-delete ---
    
		if (\FOP\Database::query('SELECT SUM(CASE WHEN COALESCE((FALSE) AND ('.\FOP\Database::quote(\FOP\User::getBuchhaltung()).') AND (COALESCE((SELECT ('.\FOP\Database::quote(\FOP\User::getBuchhaltung()).') FROM '.qi('fop_fints_konto').' '.qi('vBKfwiB4').' WHERE '.qi('vBKfwiB4').'.'.qi('ID').' = '.qi('fop_fints_buchung').'.'.qi('konto').' LIMIT 1), FALSE)) AND ('.\FOP\Database::quote(\FOP\User::getBuchhaltung()).'), false) THEN 0 ELSE 1 END) FROM '.qi('fop_fints_buchung').' WHERE ' . (new \FOP\IDList($id))->toSQL(''.qi('ID').''))->fetchColumn() > 0) {
			return false;
		}
	
    // --- BLOCK: main ---
    return false;
    
  }

  public static function createAccess($column_konto = null ) { 
    
    
    // --- BLOCK: access ---
    if(!((!\FOP\User::getIsGuest()) && ((false) && (\FOP\User::getBuchhaltung()) && (\FOP\User::getBuchhaltung())))) return false;
    // --- BLOCK: access-item-fop_fints_konto-RcATHOIs-column_konto ---
    
		if ($column_konto !== null && \FOP\Database::query('SELECT ('.\FOP\Database::quote(\FOP\User::getBuchhaltung()).') FROM '.qi('fop_fints_konto').' WHERE '.qi('ID').' = ' . \FOP\Database::quote($column_konto))->fetchColumn() != 1) {
			return false;
		}
	
    // --- BLOCK: main ---
    return false;
    
  }

  public static function editAccess($id = null ) { 
    
    
    // --- BLOCK: access ---
    if(!(((\FOP\User::getBuchhaltung()) && (\FOP\User::getBuchhaltung())))) return false;
    // --- BLOCK: access-item-fop_fints_buchung-edit-id ---
    
		if ($id !== null && \FOP\Database::query('SELECT ('.\FOP\Database::quote(\FOP\User::getBuchhaltung()).') AND (COALESCE((SELECT ('.\FOP\Database::quote(\FOP\User::getBuchhaltung()).') FROM '.qi('fop_fints_konto').' '.qi('56VmsVdP').' WHERE '.qi('56VmsVdP').'.'.qi('ID').' = '.qi('fop_fints_buchung').'.'.qi('konto').' LIMIT 1), FALSE)) AND ('.\FOP\Database::quote(\FOP\User::getBuchhaltung()).') FROM '.qi('fop_fints_buchung').' WHERE '.qi('ID').' = ' . \FOP\Database::quote($id))->fetchColumn() != 1) {
			return false;
		}
	
    // --- BLOCK: main ---
    return true;
    
  }

  public static function hashkontoUniqueAccess($context, $value, $id) { 
    
    
    // --- BLOCK: access ---
    if(!(((false) && (\FOP\User::getBuchhaltung()) && (\FOP\User::getBuchhaltung())) && (!\FOP\User::getIsGuest()))) return false;
    // --- BLOCK: main ---
    return false;
    
  }


  
  

  
  
}



