fhiiqm/info_ed3.php
changeset 29 72f79dab938e
parent 28 8d8bce56918f
child 30 d02d02efc55a
equal deleted inserted replaced
28:8d8bce56918f 29:72f79dab938e
    21     {
    21     {
    22         header("Location: start.php");
    22         header("Location: start.php");
    23         exit;
    23         exit;
    24     }    
    24     }    
    25 
    25 
    26     $ityp   = $_GET["t"];
    26     $ityp   = $_GET["t"]; // t=6 - Geschaeftsverteilungsplan
    27     
    27     
    28     $infid  = $_GET["i"];
    28     $infid  = $_GET["i"];
    29     $del    = $_POST["del"];
    29     $del    = $_POST["del"];
    30     $sub    = $_POST["eintragen"];
    30     $sub    = $_POST["eintragen"];
    31     $dup    = $_POST["dup"];
    31     $dup    = $_POST["dup"];
    89 
    89 
    90 <head>
    90 <head>
    91 	<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
    91 	<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
    92    	<link href="css/db.css" rel="STYLESHEET" type="TEXT/CSS" media="screen"/> 
    92    	<link href="css/db.css" rel="STYLESHEET" type="TEXT/CSS" media="screen"/> 
    93    	<link href="css/db_print.css" rel="STYLESHEET" type="TEXT/CSS" media="print"/>
    93    	<link href="css/db_print.css" rel="STYLESHEET" type="TEXT/CSS" media="print"/>
    94 <!--
       
    95     <link type="text/css" href="/fhiiqm/css/jquery/ui-lightness-1.8.21/jquery-ui-1.8.21.custom.css" rel="Stylesheet" />	
    94     <link type="text/css" href="/fhiiqm/css/jquery/ui-lightness-1.8.21/jquery-ui-1.8.21.custom.css" rel="Stylesheet" />	
    96     <script type="text/javascript" src="/fhiiqm/js/jquery/jquery-1.7.2.min.js"></script>
    95     <script type="text/javascript" src="/fhiiqm/js/jquery/jquery-1.7.2.min.js"></script>
    97     <script type="text/javascript" src="/fhiiqm/js/jquery/jquery-ui-1.8.21.custom.min.js"></script>
    96     <script type="text/javascript" src="/fhiiqm/js/jquery/jquery-ui-1.8.21.custom.min.js"></script>
    98 -->
    97 
    99     <link type="text/css" href="/fhiiqm/css/jquery/ui-lightness-1.8.21/jquery-ui-1.8.21.custom.css" rel="Stylesheet" />	
    98 	<title>Edit Gesch&auml;ftsverteilungsplan</title>
   100     <script type="text/javascript" src="/fhiiqm/js/jquery/jquery-1.7.2.min.js"></script>
       
   101     <script type="text/javascript" src="/fhiiqm/js/jquery/jquery-ui-1.8.21.custom.min.js"></script>
       
   102 
       
   103 	<title>Edit Informationen</title>
       
   104 </head>
    99 </head>
   105 
   100 
   106 <body>
   101 <body>
   107 
   102 
   108     <script>
   103     <script>
   214 
   209 
   215 
   210 
   216     echo "<div align='center'>";
   211     echo "<div align='center'>";
   217     if ($infid) $text = "editieren"; else $text = "erfassen";
   212     if ($infid) $text = "editieren"; else $text = "erfassen";
   218     if ($copy) $duptext = " (Kopie)";
   213     if ($copy) $duptext = " (Kopie)";
   219     echo "<h3>Information $text$duptext<h3>";
   214     echo "<h3>Gesch&auml;ftsverteilungsplan $text$duptext<h3>";
   220     
   215     
   221     echo "</div>\n";
   216     echo "</div>\n";
   222     
   217     
   223     if (!$ok || (!$sub && !$del && !$dup))
   218     if (!$ok || (!$sub && !$del && !$dup))
   224     {
   219     {
   225         if ($infid && (!$sub || !$del) && !isset($inf))
   220         if ($infid && (!$sub || !$del) && !isset($inf))
   226         { // update
   221         { // update
   227             $sql = "SELECT info_ID,info_name_s,info_name_l,info_date,info_valid_from,info_valid_to,infotyp_ID,
   222             $sql = "SELECT info_ID,info_name_s,info_name_l,info_date,info_valid_from,info_valid_to,infotyp_ID,
   228                                 i.persknr,lang,info_file,info_rel_ID,info_freigabe,info_sort, 
   223                                 i.persknr,lang,info_file,info_rel_ID,info_freigabe_ID,info_sort, 
   229                                 CONCAT(nachname,', ',vorname) AS aname 
   224                                 CONCAT(nachname,', ',vorname) AS aname 
   230                                 FROM fhiiqm.Info i LEFT OUTER JOIN fhiiqm.Mitarbeiter m 
   225                                 FROM fhiiqm.Info i LEFT OUTER JOIN fhiiqm.Mitarbeiter m 
   231                                 ON i.persknr=m.persknr 
   226                                 ON i.persknr=m.persknr 
   232                                 WHERE info_ID = $infid";
   227                                 WHERE info_ID = $infid";
   233             if ($result = $dbc -> queryObjectArray($sql))
   228             if ($result = $dbc -> queryObjectArray($sql))
   244                     $inf["persknr"] = $row->aname;
   239                     $inf["persknr"] = $row->aname;
   245                     $inf["pers"]    = $row->persknr;
   240                     $inf["pers"]    = $row->persknr;
   246                     $inf["infrel"]  = $row->info_rel_ID;
   241                     $inf["infrel"]  = $row->info_rel_ID;
   247                     $inf["ifname"]  = $row->info_file;
   242                     $inf["ifname"]  = $row->info_file;
   248                     $inf["lang"]    = $row->lang;     
   243                     $inf["lang"]    = $row->lang;     
       
   244                     $inf["fg"]      = $row->info_freigabe_ID;
   249                     $inf["sort"]    = $row->info_sort;     
   245                     $inf["sort"]    = $row->info_sort;     
   250                 }            
   246                 }            
   251             }
   247             }
   252             // Produkt
   248             // Produkt
   253             $sql = "SELECT produkt_ID FROM Info_Produkt WHERE info_ID = $infid";
   249             $sql = "SELECT produkt_ID FROM Info_Produkt WHERE info_ID = $infid";
   370             if ($inf["ifname"] < "!") $inf["ifname"] = null;
   366             if ($inf["ifname"] < "!") $inf["ifname"] = null;
   371             
   367             
   372             if ($inf["cdat"] == "") $inf["cdat"] = null; 
   368             if ($inf["cdat"] == "") $inf["cdat"] = null; 
   373             if ($inf["vdat"] == "") $inf["vdat"] = null; 
   369             if ($inf["vdat"] == "") $inf["vdat"] = null; 
   374             if ($inf["bdat"] == "") $inf["bdat"] = null; 
   370             if ($inf["bdat"] == "") $inf["bdat"] = null; 
       
   371             if ($inf["fg"] == -1) $inf["fg"] = null;
   375     
   372     
   376             if (!isset($dbc) || !$dbc) $dbc = new dbconnection();
   373             if (!isset($dbc) || !$dbc) $dbc = new dbconnection();
   377             
   374             
   378             $stmt = $dbc -> stmtinit();
   375             $stmt = $dbc -> stmtinit();
   379             if (is_object($stmt))
   376             if (is_object($stmt))
   387                     $stmt -> prepare("UPDATE fhiiqm.Info SET
   384                     $stmt -> prepare("UPDATE fhiiqm.Info SET
   388                                 info_name_s = ?, 
   385                                 info_name_s = ?, 
   389                                 info_name_l = ?, 
   386                                 info_name_l = ?, 
   390                                 info_date = ?, 
   387                                 info_date = ?, 
   391                                 info_valid_from = ?, 
   388                                 info_valid_from = ?, 
   392                                 info_valid_to = ?, 
   389                                 info_valid_to = ?,
   393                                 infotyp_ID = ?, 
   390                                 infotyp_ID = ?, 
   394                                 persknr = ?, 
   391                                 persknr = ?, 
   395                                 lang = ?,
   392                                 lang = ?,
       
   393                                 info_freigabe_ID = ?, 
   396                                 info_sort = ?, 
   394                                 info_sort = ?, 
   397                                 info_rel_ID = ? WHERE info_ID = $infid");
   395                                 info_rel_ID = ? WHERE info_ID = $infid");
   398                     $stmt -> bind_param('sssssiissi',$inf["iname"],$inf["ilong"],$inf["cdat"],$inf["vdat"],$inf["bdat"],$inf["ityp"],$inf["pers"],$inf["lang"],$inf["sort"],$inf["infrel"]);
   396                     $stmt -> bind_param('sssssiisisi',$inf["iname"],$inf["ilong"],$inf["cdat"],$inf["vdat"],$inf["bdat"],$inf["ityp"],$inf["pers"],$inf["lang"],$inf["fg"],$inf["sort"],$inf["infrel"]);
   399                     $result = $stmt -> execute();
   397                     $result = $stmt -> execute();
   400                     if ($stmt->error) echo "error UPDATE Info: " . $stmt->error . "<br><br>\n";
   398                     if ($stmt->error) echo "error UPDATE Info: " . $stmt->error . "<br><br>\n";
   401                 }
   399                 }
   402                 else
   400                 else
   403                 {   //INSERT
   401                 {   //INSERT
   404                     $stmt -> prepare ("INSERT INTO Info (info_name_s,info_name_l,info_date,info_valid_from,info_valid_to,
   402                     $stmt -> prepare ("INSERT INTO Info (info_name_s,info_name_l,info_date,info_valid_from,info_valid_to,
   405                                 infotyp_ID,persknr,lang,info_sort,info_rel_ID) VALUES (?,?,?,?,?,?,?,?,?,?)");
   403                                 infotyp_ID,persknr,lang,info_freigabe_ID,info_sort,info_rel_ID) VALUES (?,?,?,?,?,?,?,?,?,?,?)");
   406                     $stmt -> bind_param('sssssiissi', $inf["iname"],$inf["ilong"],$inf["cdat"],$inf["vdat"],$inf["bdat"],$inf["ityp"],$inf["pers"],$inf["lang"],$inf["sort"],$inf["infrel"]);
   404                     $stmt -> bind_param('sssssiisisi', $inf["iname"],$inf["ilong"],$inf["cdat"],$inf["vdat"],$inf["bdat"],$inf["ityp"],$inf["pers"],$inf["lang"],$inf["fg"],$inf["sort"],$inf["infrel"]);
   407                     $result = $stmt -> execute();      
   405                     $result = $stmt -> execute();      
   408                 
   406                 
   409                     if ($stmt->error) echo "error INSERT Info: " . $stmt->error . "<br><br>\n";
   407                     if ($stmt->error) echo "error INSERT Info: " . $stmt->error . "<br><br>\n";
   410                     if ($result)
   408                     if ($result)
   411                     { // INSERT o.k.
   409                     { // INSERT o.k.