Location: PHPKode > projects > tbvs > tbvs-1.1/InstanzEditCheck.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          : ./InstanzEditCheck.php ( 05/24/2010 )
//  Language      : php
//  Description   : Modul, um die im Formular 'InstanzEdit.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 ), 02/28/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['IstIntern']
//		_POST['Name']
//		_POST['Ort']
//		_POST['Telefax']
//		_POST['Telefon']
//		_POST['bk']
//		_POST['ins']
//		_POST['mandant']
//		_POST['prj']
//
//	[[End of requests]]
//
//
//
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
//  
//	[[Functions]]
//
//
//		function GoodParameters()
//		function SaveInstanz($mandant,$bk,$prj,$ins)
//
//	[[End of functions]]
//
//
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
//  
//	[[Classes]]
//
//
//	no classes were found
//
//	[[End of classes]]
//
//
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
//  
//	[[Versions of file ./InstanzEditCheck.php]]
//
//	28.02.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=00494}{OLLEN=00109}
?><?php

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

/*********************************************************************************
* InstanzCheck.php
*
* Funktion :
*	Daten einer Instanz 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

// Instanz
function SaveInstanz( $mandant, $bk, $prj, $ins ) {

//    $ins=NewInstanzID($mandant,$bk);
//    $prjnr = hent ( ID2PROJNRProjekt( $mandant, $bk, $prj ) );
    display_title( sprintf( id2msg( 9142 ), $ins, $bk, $mandant ) );
    
    /* Connect to a MySQL server */
    $mysqli = OpenTBVSDB();
    
    /* Send a query to the server
    * mysqli::query returns an object of class mysqli_result */
    

    $Name =$_POST['Name'];
    $IstIntern =$_POST['IstIntern'];
    $Telefon =$_POST['Telefon'];
    $Telefax =$_POST['Telefax'];
    $Ort =$_POST['Ort'];
    
    $usr = activeUserName( );
    
    $msgBuchungskreis = id2msg( 2540 );
    $msgRecord = id2msg( 2572 );
    
    $msgZuDenInstanzn = id2msg( 9116 );
    $msgZurProjektverwaltung = id2msg( 8358 );

    TransactionBegin( $mysqli );
    
    
    $query = "UPDATE INSTANZ
    SET 
    Name='$Name',
    IstIntern = '$IstIntern',
    Telefon = '$Telefon',
    Telefax = '$Telefax',
    Ort = '$Ort',
    REVDATE=NOW(), 
    REVNAME='$usr'
    WHERE ID_MANDANT=$mandant AND ID_BUCHKR=$bk AND ID_INSTANZ=$ins
    ;";
    
       //  echo "<br>$query<br>";
    
    $result = $mysqli->query( $query );
    
        if (!$result) {
            printf( id2msg( 4370 ) , "SaveInstanz() : ", $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=InstanzShow.php?mandant=$mandant&bk=$bk&ins=$ins&prj=$prj>$msgRecord </a>";
    echo "<a href=InstanzList.php?mandant=$mandant&bk=$bk&prj=$prj> $msgZuDenInstanzn </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 SaveInstanz

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


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


// ShowAllParameters();
DisplayHeader();
GoodParameters();

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

SaveInstanz( $mandant, $bk, $prj, $ins );

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