es wird jetzt die PSID (penterbarf SID) an statt FormPentabarf

git-svn-id: svn://svn.cccv.de/engel-system@57 29ba0400-6e00-0410-a75a-ca02368028f8
This commit is contained in:
cookie 2005-11-15 23:13:35 +00:00
parent a864215f5c
commit d49556b05b
3 changed files with 26 additions and 27 deletions

View File

@ -158,8 +158,8 @@ CREATE TABLE IF NOT EXISTS `Shifts` (
`Len` float NOT NULL default '0', `Len` float NOT NULL default '0',
`RID` int(11) NOT NULL default '0', `RID` int(11) NOT NULL default '0',
`Man` text, `Man` text,
`FromPentabarf` char(1) NOT NULL default 'N',
`URL` text, `URL` text,
`PSID` text,
PRIMARY KEY (`SID`) PRIMARY KEY (`SID`)
) TYPE=MyISAM AUTO_INCREMENT=1 ; ) TYPE=MyISAM AUTO_INCREMENT=1 ;

View File

@ -115,9 +115,6 @@ case 'change':
echo " <tr><td>Beschreibung</td>". echo " <tr><td>Beschreibung</td>".
"<td><input value=\"". mysql_result($Erg, 0, "Man"). "<td><input value=\"". mysql_result($Erg, 0, "Man").
"\" type=\"text\" size=\"40\" name=\"eName\"></td></tr>\n"; "\" type=\"text\" size=\"40\" name=\"eName\"></td></tr>\n";
echo " <tr><td>FromPentabarf</td>".
"<td><input value=\"". mysql_result($Erg, 0, "FromPentabarf").
"\" type=\"text\" size=\"40\" name=\"eFromPentabarf\"></td></tr>\n";
echo " <tr><td>URL</td>". echo " <tr><td>URL</td>".
"<td><input value=\"". mysql_result($Erg, 0, "URL"). "<td><input value=\"". mysql_result($Erg, 0, "URL").
"\" type=\"text\" size=\"40\" name=\"eURL\"></td></tr>\n"; "\" type=\"text\" size=\"40\" name=\"eURL\"></td></tr>\n";
@ -282,7 +279,6 @@ case 'changesave':
"`RID`='". $_GET["eRID"]. "', ". "`RID`='". $_GET["eRID"]. "', ".
"`Len`='". $_GET["eDauer"]. "', ". "`Len`='". $_GET["eDauer"]. "', ".
"`Man`='". $_GET["eName"]. "', ". "`Man`='". $_GET["eName"]. "', ".
"`FromPentabarf`='". $_GET["eFromPentabarf"]. "', ".
"`URL`='". $_GET["eURL"]. "' ". "`URL`='". $_GET["eURL"]. "' ".
"WHERE `SID`=". $_GET["SID"]; "WHERE `SID`=". $_GET["SID"];
SetHeaderGo2Back(); SetHeaderGo2Back();

View File

@ -11,7 +11,7 @@ function SaveSchedule()
global $RoomID, $RoomName; global $RoomID, $RoomName;
include ("./inc/db.php"); include ("./inc/db.php");
if( isset($_GET["SIDXML"]) && if( isset($_GET["PSIDXML"]) &&
isset($_GET["DateXML"]) && isset($_GET["DateXML"]) &&
isset($_GET["RIDXML"]) && isset($_GET["RIDXML"]) &&
isset($_GET["LenXML"]) && isset($_GET["LenXML"]) &&
@ -37,18 +37,17 @@ function SaveSchedule()
$_GET["RIDXML"] = $RoomName[$_GET["RIDXML"]]; $_GET["RIDXML"] = $RoomName[$_GET["RIDXML"]];
//Update OR insert ? //Update OR insert ?
$SQL1 = "Select `SID` FROM `Shifts` WHERE `SID`='". $_GET["SIDXML"]. "';"; $SQL1 = "Select `SID` FROM `Shifts` WHERE `PSID`='". $_GET["PSIDXML"]. "';";
$Erg1 = mysql_query($SQL1, $con); $Erg1 = mysql_query($SQL1, $con);
if( mysql_num_rows($Erg1)==0) if( mysql_num_rows($Erg1)==0)
$SQL= "INSERT INTO `Shifts` (`SID`, `DateS`, `DateE`, `Len`, `RID`, `Man`, `FromPentabarf`, `URL`) ". $SQL= "INSERT INTO `Shifts` (`PSID`, `DateS`, `DateE`, `Len`, `RID`, `Man`, `URL`) ".
"VALUES ('". $_GET["SIDXML"]. "', ". "VALUES ('". $_GET["PSIDXML"]. "', ".
"'". $_GET["DateXML"]. "', ". "'". $_GET["DateXML"]. "', ".
"'". $DateEnd. "', ". "'". $DateEnd. "', ".
"'". $_GET["LenXML"]. "', ". "'". $_GET["LenXML"]. "', ".
"'". $_GET["RIDXML"]. "', ". "'". $_GET["RIDXML"]. "', ".
"'". mysql_escape_string($_GET["ManXML"]). "', ". "'". mysql_escape_string($_GET["ManXML"]). "', ".
"'Y', ".
"'". $_GET["URLXML"]. "'". "'". $_GET["URLXML"]. "'".
");"; ");";
else else
@ -58,16 +57,19 @@ function SaveSchedule()
"`Len` = '". $_GET["LenXML"]. "', ". "`Len` = '". $_GET["LenXML"]. "', ".
"`RID` = '". $_GET["RIDXML"]. "', ". "`RID` = '". $_GET["RIDXML"]. "', ".
"`Man` = '". mysql_escape_string($_GET["ManXML"]). "', ". "`Man` = '". mysql_escape_string($_GET["ManXML"]). "', ".
"`FromPentabarf`= 'Y', ".
"`URL`= '". $_GET["URLXML"]. "' ". "`URL`= '". $_GET["URLXML"]. "' ".
"WHERE `SID` = '". $_GET["SIDXML"]. "' LIMIT 1;"; "WHERE `PSID` = '". $_GET["PSIDXML"]. "' LIMIT 1;";
$Erg = mysql_query($SQL, $con); $Erg = mysql_query($SQL, $con);
if( $Erg ) if( $Erg )
{ {
echo "Aenderung, am Schedule '". $_GET["SIDXML"]. "', war erfogreich<br>\n"; echo "Aenderung, am Schedule '". $_GET["PSIDXML"]. "', war erfogreich<br>\n";
if( mysql_num_rows($Erg1)==0) if( mysql_num_rows($Erg1)==0)
{ {
echo "-->Create Shifts:<br>\n"; echo "-->Create Shifts:<br>\n";
//SID auslesen
$SQL1 = "Select `SID` FROM `Shifts` WHERE `PSID`='". $_GET["PSIDXML"]. "';";
$Erg1 = mysql_query($SQL1, $con);
// erstellt ein Array der Reume // erstellt ein Array der Reume
$sql2 = "SELECT * FROM `Room` ". $sql2 = "SELECT * FROM `Room` ".
@ -83,7 +85,7 @@ function SaveSchedule()
for( $i=0; $i < mysql_result($Erg2, 0, $j); $i++ ) for( $i=0; $i < mysql_result($Erg2, 0, $j); $i++ )
{ {
$SQL3 = "INSERT INTO `ShiftEntry` (`SID`, `TID`) VALUES (". $SQL3 = "INSERT INTO `ShiftEntry` (`SID`, `TID`) VALUES (".
"'". $_GET["SIDXML"]. "', ". "'". mysql_result($Erg1, 0, 0). "', ".
"'". substr( mysql_field_name($Erg2, $j), 12). "');"; "'". substr( mysql_field_name($Erg2, $j), 12). "');";
$Erg3 = mysql_query($SQL3, $con); $Erg3 = mysql_query($SQL3, $con);
@ -100,7 +102,7 @@ function SaveSchedule()
} }
} }
else else
echo "Aenderung, am Schedule '". $_GET["SIDXML"]. "', war <u>nicht</u> erfogreich.(". echo "Aenderung, am Schedule '". $_GET["PSIDXML"]. "', war <u>nicht</u> erfogreich.(".
mysql_error($con). ")<br>[$SQL]<br>\n"; mysql_error($con). ")<br>[$SQL]<br>\n";
} }
else else
@ -117,7 +119,7 @@ $Where = "";
//ausgabe //ausgabe
echo "<table border=\"0\">\n"; echo "<table border=\"0\">\n";
echo "<tr><th>SID</th><th>Date</th>". echo "<tr><th>PSID</th><th>Date</th>".
"<th>Room</th><th>Len</th><th>Name</th><th>state</th></tr>\n"; "<th>Room</th><th>Len</th><th>Name</th><th>state</th></tr>\n";
echo "<tr align=\"center\"><td>XML - DB</td><td>XML - DB</td>". echo "<tr align=\"center\"><td>XML - DB</td><td>XML - DB</td>".
"<td>XML - DB</td><td>XML - DB</td><td>XML - DB</td><td></td></tr>\n"; "<td>XML - DB</td><td>XML - DB</td><td>XML - DB</td><td></td></tr>\n";
@ -130,7 +132,7 @@ foreach($XMLmain->sub as $EventKey => $Event)
echo "<form action=\"dbUpdateFromXLS.php\">\n"; echo "<form action=\"dbUpdateFromXLS.php\">\n";
echo "\t<tr>\n"; echo "\t<tr>\n";
$SIDXML = substr( getXMLsubData( $Event, "UID"), 0, strpos( getXMLsubData( $Event, "UID"), "@" )); $PSIDXML = getXMLsubData( $Event, "UID");
$DateXML = $DateXML =
substr( getXMLsubData( $Event, "DTSTART"), 0, 4). "-". substr( getXMLsubData( $Event, "DTSTART"), 0, 4). "-".
substr( getXMLsubData( $Event, "DTSTART"), 4, 2). "-". substr( getXMLsubData( $Event, "DTSTART"), 4, 2). "-".
@ -144,7 +146,7 @@ foreach($XMLmain->sub as $EventKey => $Event)
if( isset($_GET["UpdateALL"])) if( isset($_GET["UpdateALL"]))
{ {
$_GET["SIDXML"] = $SIDXML; $_GET["PSIDXML"] = $PSIDXML;
$_GET["DateXML"] = $DateXML; $_GET["DateXML"] = $DateXML;
$_GET["LenXML"] = $LenXML; $_GET["LenXML"] = $LenXML;
$_GET["RIDXML"] = $RIDXML; $_GET["RIDXML"] = $RIDXML;
@ -153,11 +155,12 @@ foreach($XMLmain->sub as $EventKey => $Event)
SaveSchedule(); SaveSchedule();
} }
$SQL = "SELECT * FROM `Shifts` WHERE SID=$SIDXML"; $SQL = "SELECT * FROM `Shifts` WHERE PSID='$PSIDXML'";
$Erg = mysql_query($SQL, $con); $Erg = mysql_query($SQL, $con);
if(mysql_num_rows($Erg)>0) if(mysql_num_rows($Erg)>0)
{ {
$SIDDB = mysql_result($Erg, 0, "SID"); $SIDDB = mysql_result($Erg, 0, "SID");
$PSIDDB = mysql_result($Erg, 0, "PSID");
$TimeDB = mysql_result($Erg, 0, "DateS"); $TimeDB = mysql_result($Erg, 0, "DateS");
$LenDB = mysql_result($Erg, 0, "Len"); $LenDB = mysql_result($Erg, 0, "Len");
if( isset($RoomID[mysql_result($Erg, 0, "RID")])) if( isset($RoomID[mysql_result($Erg, 0, "RID")]))
@ -169,9 +172,9 @@ foreach($XMLmain->sub as $EventKey => $Event)
$URLDB = mysql_result($Erg, 0, "URL"); $URLDB = mysql_result($Erg, 0, "URL");
} }
else else
$SIDDB = $TimeDB = $LenDB = $RIDDB = $ManDB = $URLDB = ""; $SIDDB = $PSIDDB = $TimeDB = $LenDB = $RIDDB = $ManDB = $URLDB = "";
echo "\t<td><input name=\"SIDXML\" type=\"text\" value=\"$SIDXML\" size=\"2\" eadonly></td>\n"; echo "\t<td><input name=\"PSIDXML\" type=\"text\" value=\"$PSIDXML\" size=\"2\" eadonly></td>\n";
echo "\t<td><input name=\"DateXML\" type=\"text\" value=\"$DateXML\" size=\"17\" readonly>\n\t\t". echo "\t<td><input name=\"DateXML\" type=\"text\" value=\"$DateXML\" size=\"17\" readonly>\n\t\t".
"<input name=\"DateDB\" type=\"text\" value=\"$TimeDB\" size=\"17\" readonly></td>\n"; "<input name=\"DateDB\" type=\"text\" value=\"$TimeDB\" size=\"17\" readonly></td>\n";
echo "\t<td><input name=\"RIDXML\" type=\"text\" value=\"$RIDXML\" size=\"15\" readonly>\n\t\t". echo "\t<td><input name=\"RIDXML\" type=\"text\" value=\"$RIDXML\" size=\"15\" readonly>\n\t\t".
@ -180,10 +183,9 @@ foreach($XMLmain->sub as $EventKey => $Event)
"<input name=\"LenDB\" type=\"text\" value=\"$LenDB\" size=\"1\"readonly></td>\n"; "<input name=\"LenDB\" type=\"text\" value=\"$LenDB\" size=\"1\"readonly></td>\n";
echo "\t<td><input name=\"ManXML\" type=\"text\" value=\"$ManXML\" size=\"40\"readonly>\n\t\t". echo "\t<td><input name=\"ManXML\" type=\"text\" value=\"$ManXML\" size=\"40\"readonly>\n\t\t".
"<input name=\"ManDB\" type=\"text\" value=\"$ManDB\" size=\"40\"readonly></td>\n"; "<input name=\"ManDB\" type=\"text\" value=\"$ManDB\" size=\"40\"readonly></td>\n";
echo "\t<td><input name=\"URLXML\" type=\"hidden\" value=\"$URLXML\"></td>\n"; echo "\t<td><input name=\"URLXML\" type=\"hidden\" value=\"$URLXML\"></td>\n";
echo "\t<td><input name=\"URLDB\" type=\"hidden\" value=\"$URLDB\"></td>\n"; echo "\t<td><input name=\"URLDB\" type=\"hidden\" value=\"$URLDB\"></td>\n";
if( !( $SIDXML==$SIDDB && if( !( $PSIDXML==$PSIDDB &&
$DateXML==$TimeDB && $DateXML==$TimeDB &&
$RIDXML==$RIDDB && $RIDXML==$RIDDB &&
$LenXML==$LenDB && $LenXML==$LenDB &&
@ -195,12 +197,12 @@ foreach($XMLmain->sub as $EventKey => $Event)
} }
else else
{ {
echo "\t<td><a href=\"./schichtplan.php?action=change&SID=$SIDXML\">edit</a></td>\n"; echo "\t<td><a href=\"./schichtplan.php?action=change&SID=$SIDDB\">edit</a></td>\n";
$DS_OK++; $DS_OK++;
} }
echo "\t</tr>\n"; echo "\t</tr>\n";
echo "</form>\n"; echo "</form>\n";
$Where.= " OR SID=$SIDXML"; $Where.= " OR `PSID`='$PSIDXML'";
} }
} }
echo "<tr><td colspan=\"6\">status: $DS_KO/$DS_OK nicht Aktuel.</td></tr>\n"; echo "<tr><td colspan=\"6\">status: $DS_KO/$DS_OK nicht Aktuel.</td></tr>\n";
@ -208,11 +210,12 @@ echo "<tr><td colspan=\"6\">status: $DS_KO/$DS_OK nicht Aktuel.</td></tr>\n";
//Anzeige von nicht im XML File vorkommende entraege //Anzeige von nicht im XML File vorkommende entraege
if( $Where =="") if( $Where =="")
$SQL2 = "SELECT * FROM `Shifts` WHERE FromPentabarf = 'Y';"; $SQL2 = "SELECT * FROM `Shifts` WHERE NOT PSID = '';";
else else
$SQL2 = "SELECT * FROM `Shifts` WHERE NOT (".substr( $Where, 4). ") AND FromPentabarf = 'Y';"; $SQL2 = "SELECT * FROM `Shifts` WHERE NOT (".substr( $Where, 4). ") AND NOT PSID = '';";
$Erg2 = mysql_query($SQL2, $con); $Erg2 = mysql_query($SQL2, $con);
echo mysql_error($con);
if(mysql_num_rows($Erg2)>0 && $EnableSchudleDB ) if(mysql_num_rows($Erg2)>0 && $EnableSchudleDB )
for( $i=0; $i<mysql_num_rows( $Erg2); $i++) for( $i=0; $i<mysql_num_rows( $Erg2); $i++)
{ {