Location: PHPKode > projects > tbvs > tbvs-1.1/NetzartAddCheck.php
<? // this section is managed by php-mgr : you may change / enhance the part with the program versions
//
//  This php section is being managed by php-mgr ver 1, 
//  If you make changes in this section then your changes will be overwritten in later releases of this file !
//
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
//  File          : ./NetzartAddCheck.php ( 05/24/2010 )
//  Language      : php
//  Description   : Modul, um die im Modul 'NetzartAdd.php' ermittelten Daten nach Validierung in der Datenbank abzuspeichern
//  Project       : tbvs - Das Tiefbauverwaltungssystem
//  Project Site  : http://tbvs.sourceforge.net/
//  Project wiki  : http://scratchpad.wikia.com/wiki/Tbvs
//  Created by    : Rainer Stötter ( hide@address.com ), 03/02/2010
//  Copyright (c) : 2007 - 2010, Rainer Stötter, All rights reserved
//
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
//  License
//
//  This file has been released under GNU GENERAL PUBLIC LICENSE
//  (see http://www.gnu.org/licenses/gpl.html)
//
//
// * GNU General Public License (Version 3, June 2009 )
// *
// * This program is free software; you can redistribute
// * it and/or modify it under the terms of the GNU
// * General Public License as published by the Free
// * Software Foundation; either version 3 of the License,
// * or (at your option) any later version.
// * 
// * This program is distributed in the hope that it will
// * be useful, but WITHOUT ANY WARRANTY; without even the
// * implied warranty of MERCHANTABILITY or FITNESS FOR A
// * PARTICULAR PURPOSE. See the GNU General Public License
// * for more details. 
//   
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
//  
//	[[Requests]]
//
//
//		_POST['Netzart']
//		_POST['bk']
//		_POST['mandant']
//		_POST['prj']
//
//	[[End of requests]]
//
//
//
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
//  
//	[[Functions]]
//
//
//		function AddNewNetzart($mandant,$bk,$prj)
//		function GoodParameters()
//
//	[[End of functions]]
//
//
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
//  
//	[[Classes]]
//
//
//	no classes were found
//
//	[[End of classes]]
//
//
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
//  
//	[[Versions of file ./NetzartAddCheck.php]]
//
//	02.03.2010	Rainer Stötter (tbvs-1.08006)
//			Module created
//			a
//
//	[[End of versions]]
//
//
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
//  CVS
//
//  $Log:…$
//
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
// 
// here ends the section which is managed by php-mgr ver 1
//

//{TOOLVER=01,00000}{OLSTART=00493}{OLLEN=00105}
?><?php

# require_once("./functions/debug.inc.php");

/*********************************************************************************
* NetzartAddCheck.php
*
* Funktion :
*	Daten einer neuen Netzart pr&uuml;fen und abspeichern
* Parameter : POST
*	$mandant 	ID des akuellen Mandanten
*
**********************************************************************************/
require_once("./functions/checkuser.inc.php");	//	Login ist erforderlich
require_once("./functions/prolog.inc.php");	//	Datei mit vorgestellten Routinen
require_once("./functions/debug.inc.php");	//	Debugging-Funktionen
require_once("./functions/tbvs.inc.php");	//	systemweite Konstanten und Funktionen
require_once("./functions/tbvs-db.inc.php");	//	systemweite Datenbankfunktionen
require_once("./functions/tbvs-inout.inc.php");    //  systemweite Ein- Ausgaberoutinen ()


// Netzart
function AddNewNetzart( $mandant, $bk, $prj ) {

    $na = NewNetzartID( $mandant, $bk );
    
    display_title( sprintf( id2msg( 9345 ),  $na, $bk, $mandant ) );
    
    /* Connect to a MySQL server */
    $mysqli = OpenTBVSDB();
   
    $Netzart = $_POST['Netzart'];

    // $IstIntern = isset( $_POST['IstIntern'] ) ? 1 : 0;

    $usr = activeUserName( );
    
    $msgBuchungskreis = id2msg( 2540 );
    $msgNetzartn = id2msg( 9339 );
    $msgRecord = id2msg( 2572 );
    $msgZurProjektverwaltung = id2msg( 8358 );
    
    TransactionBegin( $mysqli );
    
    
    $query = "INSERT INTO NETZART (ID_MANDANT, ID_BUCHKR, ID_NETZART, 
    Netzart,
    REVDATE, REVNAME, REVFIRST)".
    " VALUES ('$mandant', '$bk', '$na',
    '$Netzart',
    NOW(),'$usr', NOW() );";
    
    //    echo "<br>$query<br>";
    
    $result = $mysqli->query( $query );
    
        if (!$result) {
            printf( id2msg( 4370 ) , "AddNewNetzart() : ", $mysqli->sqlstate, $mysqli->error);
            TransactionRollback( $mysqli );
        } else {
            echo id2msg( 2641 );
            TransactionCommit( $mysqli );
        }
    
    
    /* Close the connection and free the memory used*/
    $mysqli->close();
    
    echo "<p><a href=NetzartShow.php?mandant=$mandant&bk=$bk&pnr=$na>$msgRecord </a>";
    echo "<a href=NetzartList.php?mandant=$mandant&bk=$bk&prj=$prj>$msgNetzartn </a>";
    echo "<a href=BuchungskreisList.php?mandant=$mandant>$msgBuchungskreis </a>";
    if ($prj) echo " <a href=ProjektverwaltungStamm.php?mandant=$mandant&bk=$bk&prj=$prj> $msgZurProjektverwaltung </a>  ";

}       // function AddNewNetzart

function GoodParameters() {
  if ( (! isset($_POST['bk']))  )
	die (id2msg(2560));
  if ( (! isset($_POST['mandant']))  )
	die (id2msg(2561));
}


// ==================================================================================

DisplayHeader();
GoodParameters();

$mandant=$_POST['mandant'];
$bk=$_POST['bk'];
$prj=$_POST['prj'];

AddNewNetzart( $mandant, $bk, $prj );

require_once("./functions/epilog.inc.php");	//	Datei mit nachgestellten Routinen
/* ================================================================-------------------------------- */
?>
Return current item: tbvs