"javascript:completeTime(this) geht nicht mit dem Jahr 2010

MR_SCHORLE

Mitglied
Guten Morgen,

ich habe ein kleines Problem, und zwar habe ich bei einer Anwendung vor einigen Jahren ein "javascript:completeTime(this) Script eingebaut! Leider wenn man nun in der Anwendung ein Daten mit dem Jahr 2010 eingibt wird das Feld als Pflichtfeld makiert! Hat einer von euch eine Idee ? Anbei der CODE

HTML:
<?php
ob_start();

session_start();
require("dbconnection.php");
require("functions.php");

// SET WHICH MENU POINT
$menuid = 1;
require("vorgangsblatt_beschaffung_variables.php");


// ********************************************************************************************************	
// check on entering if new contract or existing contract

if (isset($HTTP_GET_VARS["admin"])) {
	$admin = $HTTP_GET_VARS["admin"];
} else {	
	$admin = "new";
}

if (!isset($HTTP_GET_VARS["formsent"])) { 

	if ($admin == "amend") {		
		
		$bearbeiter = $maincontract_array["s_id"];
		$cdate = convertDate2read($maincontract_array["cdate"]);
		
		$customer_date1 = checkEmptyDate($maincontract_array["customer_date1"]);
		$customer_date2 = checkEmptyDate($maincontract_array["customer_date2"]);
		$transport_date1 = checkEmptyDate($maincontract_array["transport_date1"]);
		$transport_date2 = checkEmptyDate($maincontract_array["transport_date2"]);
		$customer_time1 = checkEmptyTime($maincontract_array["customer_time1"]);
		$customer_time2 = checkEmptyTime($maincontract_array["customer_time2"]);
		$transport_time1 = checkEmptyTime($maincontract_array["transport_time1"]);
		$transport_time2 = checkEmptyTime($maincontract_array["transport_time2"]);
		$disponent_lieferadresse = $maincontract_array["disponent_lieferadresse"];
		$disponent_abholadresse = $maincontract_array["disponent_abholadresse"];
		$vg_type = $maincontract_array["vg_type"];
		$customer = $maincontract_array["customer"];
		$versicherung_kunde = $maincontract_array["versicherung_kunde"];
		$sb_kunde = $maincontract_array["sb_kunde"];
		$place = $maincontract_array["place"];
		$place2 = "";
		$anliefer_abhol = $maincontract_array["anliefer_abhol"];
		if ($maincontract_array["pn"] != "") {
			$pn = $maincontract_array["pn"];
		} else {
			$pn = "";
		}
		$origin = $maincontract_array["origin"];
		$kilometer_pauschal = $maincontract_array["kilometer_pauschal"];
		$errorform = "";
		
	} else { 
		
		// declare necessary variables for form fields if new contract
		
		$cdate = date("d.m.Y");
		$bearbeiter = $s_id;
		$customer_date1 = "";
		$customer_time1 = "";
		$customer_date2 = "";
		$customer_time2 = "";
		$transport_date1 = "";
		$transport_time1 = "";
		$transport_date2 = "";
		$transport_time2 = "";
		$customer = "";
		$place = "";
		$place2 = "";
		$anliefer_abhol = 0;
		$pn = "";
		$sb_kunde = "";
		$kilometer_pauschal = "";
		$vg_type = "a";
				
	} // if $admin
	
// if form sent		
} else {

	if (isset($HTTP_GET_VARS["id"])) {
		$id = $HTTP_GET_VARS["id"];
	}
	$admin = $HTTP_GET_VARS["admin"];
	$cdate = $HTTP_GET_VARS["cdate"];
	$origin = $HTTP_GET_VARS["origin"];
	$bearbeiter = $HTTP_GET_VARS["bearbeiter"];
	$pn = $HTTP_GET_VARS["pn"];
	$versicherung_kunde = $HTTP_GET_VARS["versicherung_kunde"];
	$sb_kunde = $HTTP_GET_VARS["sb_kunde"];
	$customer = $HTTP_GET_VARS["customer"];
	$place = $HTTP_GET_VARS["place"];
	$place2 = str_replace("\"", "'", $HTTP_GET_VARS["place2"]);
	if (isset($HTTP_GET_VARS["anliefer_abhol"])) {
		$anliefer_abhol = 1;
	} else {
		$anliefer_abhol = 0;
	}
	$customer_date1 = trim($HTTP_GET_VARS["customer_date1"]);
	$customer_time1 = trim($HTTP_GET_VARS["customer_time1"]);
	$customer_date2 = trim($HTTP_GET_VARS["customer_date2"]);
	$customer_time2 = trim($HTTP_GET_VARS["customer_time2"]);
	$transport_date1 = trim($HTTP_GET_VARS["transport_date1"]);
	$transport_time1 = trim($HTTP_GET_VARS["transport_time1"]);
	$transport_date2 = trim($HTTP_GET_VARS["transport_date2"]);
	$transport_time2 = trim($HTTP_GET_VARS["transport_time2"]);
	$disponent_lieferadresse = $HTTP_GET_VARS["disponent_lieferadresse"];
	$disponent_abholadresse = $HTTP_GET_VARS["disponent_abholadresse"];
	$kilometer_pauschal = $HTTP_GET_VARS["kilometer_pauschal"];
	$vg_type = $HTTP_GET_VARS["vg_type"];
		
	if ($disponent_abholadresse != "" || $disponent_lieferadresse != "") {
		$anliefer_abhol = 1;
	}	

	// check if new veranstaltungsort and add to DB

	if ($place2 != "") {
		addVeranstaltungsort2DB($place2, $customer);
		$place = $place2;
	} // if place2	
	
	// check for form errors
	
	$pattern_date = "^[0-3][0-9]\.[0-1][0-9]\.20[0-9][3-9]$";
	$pattern_time = "^[0-2]+[0-9]+:+[0-5]+[0-9]$";
	

	// if Kauf Vorgang then no other data is required for form.

	
	if ($vg_type != "k") {	
	
		if ($place == "") {
			$errorform = "place";
		}
		if ($pn == "" && checkPN($customer) == true) {
			$errorform = "pn";
		}
		
	// check for date and time errors
	
		if (!ereg($pattern_date, $customer_date1)) { $errorform = "customer_date"; }
		if (!ereg($pattern_date, $customer_date2)) { $errorform = "customer_date"; }
		if (!ereg($pattern_date, $transport_date1)) { $errorform = "transport_date"; }
		if (!ereg($pattern_date, $transport_date2)) { $errorform = "transport_date"; }
		
		if (!ereg($pattern_time, $customer_time1)) { $errorform = "customer_date"; }
		if (!ereg($pattern_time, $customer_time2)) { $errorform = "customer_date"; }
		if (!ereg($pattern_time, $transport_time1)) { $errorform = "transport_date"; }
		if (!ereg($pattern_time, $transport_time2)) { $errorform = "transport_date"; }
		
		// if no errors
		
		if ($errorform == "") {
		
		// write date and time to correct database format
		
			$newcustomer_date1 = makeDate($customer_date1);
			if ($newcustomer_date1 == "error") {
				$errorform = "customer_date";
			}
			$newcustomer_date2 = makeDate($customer_date2);
			if ($newcustomer_date2 == "error") {
				$errorform = "customer_date";
			}
			$newtransport_date1 = makeDate($transport_date1);
			if ($newtransport_date1 == "error") {
				$errorform = "transport_date";
			}
			$newtransport_date2 = makeDate($transport_date2);
			if ($newtransport_date2 == "error") {
				$errorform = "transport_date";
			}
			
			$newcustomer_time1 = makeTime($customer_time1);
			$newcustomer_time2 = makeTime($customer_time2);
			$newtransport_time1 = makeTime($transport_time1);
			$newtransport_time2 = makeTime($transport_time2);
		
		}
	} else { 
	
	$newcustomer_date1 = makeDate($customer_date1);
	$newcustomer_date2 = makeDate($customer_date2);
	$newtransport_date1 = makeDate($transport_date1);
	$newtransport_date2 = makeDate($transport_date2);
	$newcustomer_time1 = makeTime($customer_time1);
	$newcustomer_time2 = makeTime($customer_time2);
	$newtransport_time1 = makeTime($transport_time1);
	$newtransport_time2 = makeTime($transport_time2);
		
	
	} // if vg_type	
	
	// write decimal from german format to DB format
	$sb_kunde = deNumber2en($sb_kunde);
	$kilometer_pauschal = deNumber2en($kilometer_pauschal);
	
	// *********************************************************************************************************************************************
	
	// update procedure for database
	
	// *********************************************************************************************************************************************
	
	// update main database if no errors
		
	if ($errorform == "") {
	
	// evaluate which submit button was pushed and update accordingly
		
		if ($admin == "new") { 
			$vertrag = getNewContract($vg_type);
			$sql_start = "insert into main_contracts set s_id='$bearbeiter', cdate=now(), vertrag='$vertrag', ";
			$sql_end = "";
		} else {
			$sql_start = "update main_contracts set ";
			// check if changing from Angebote to Vorgang and change contract number respectively.
			// set flag to update individual contracts to new vertrag number
			if ($vg_type == "v") {
				if (ereg("^A", $maincontract_array["vertrag"])) {
					$vertrag = getNewContract("v");
					$update_fzg = true;
					$update_fzg_old = $maincontract_array["vertrag"];
					$update_fzg_new = $vertrag;
					$sql_start .= "vertrag = '$vertrag', ";
				}
			}			
			
			
			$sql_end = " where id='$vg_id'";
		}	
		
		$mysql_insert = $sql_start . "origin = '$origin', customer = '$customer', pn = '$pn', versicherung_kunde = '$versicherung_kunde', sb_kunde = '$sb_kunde', customer_date1 = '$newcustomer_date1', customer_time1 = '$newcustomer_time1', customer_date2 = '$newcustomer_date2', customer_time2 = '$newcustomer_time2', transport_date1 = '$newtransport_date1', transport_time1 = '$newtransport_time1', transport_date2 = '$newtransport_date2', transport_time2 = '$newtransport_time2', place = '$place', anliefer_abhol = '$anliefer_abhol', disponent_lieferadresse = '$disponent_lieferadresse', disponent_abholadresse = '$disponent_abholadresse',kilometer_pauschal = '$kilometer_pauschal', vg_type='$vg_type', mdate = now()" . $sql_end;
		
		mysql_query($mysql_insert) or die (mysql_error());
		
		if ($admin == "new") {
			$vg_id = getMainContractID($vertrag);		
		}
		
		// if status has changed from Angebote to Vorgang then update respective fzg.
		if ($update_fzg = true) {
		mysql_query("update individual_contracts set vertrag='$update_fzg_new' where vertrag='$update_fzg_old'");
		mysql_query("update comments set vertrag='$update_fzg_new' where vertrag='$update_fzg_old'");
		}
		
		
		header("location: $PHP_SELF?vg_id=$vg_id&admin=amend&updated=true");
		exit;
		
	} // if !errorform
} // if formsent

// ********************************************************************************************************	

?>

<?php require("vorgangsblatt_beschaffung_bodystart.php"); ?>


<!-- Vorgang menu table -->
<?php require("vorgangsblatt_beschaffung_menu.php"); ?>

<!-- main information table -->

<table cellpadding=0 cellspacing=0 border=0 width=750 align="center" bgcolor="<?php echo $background; ?>" class="textnorm">

<tr>
<td bgcolor="#000000" rowspan=1000><img src="grafix/trans.gif" width=1 height=1></td>
<td rowspan=1000><img src="grafix/trans.gif" width=10 height=1></td>
<td colspan=3><img src="grafix/trans.gif" width=1 height=1></td>
<td rowspan=1000><img src="grafix/trans.gif" width=10 height=1></td>
<td bgcolor="#000000" rowspan=1000><img src="grafix/trans.gif" width=1 height=1></td>
</tr>

<tr>
<td colspan=3><img src="grafix/trans.gif" width=1 height=20></td>
</tr>

<tr>
<td class="textnorm">Standort</td>
<td class="textnorm" colspan=2 align="right"><?php
$type[1] = "Köln";
$type[2] = "H-U";
$type[3] = "Kauf";
?>
<select name="origin">
<?php
for ($i=1; $i<=2; $i++) { ?>
<option value="<?php echo $type[$i]; ?>"<?php if (isset($origin) and $origin == $type[$i]) { ?>selected<?php } ?>><?php echo $type[$i]; ?>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</option>
<?php } ?>
</select></td>
</tr>

<?php echo $tablespacer; ?>

<tr>
<td class="textnorm">Vorgangstyp</td>
<td class="textnorm" colspan=2 align="right">
<select name="vg_type">
<option value="a" <?php if ($vg_type == "a") { ?>selected<?php } ?>>Angebote&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</option>
<option value="v" <?php if ($vg_type == "v") { ?>selected<?php } ?>>Vorgang&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</option>
<option value="k" <?php if ($vg_type == "k") { ?>selected<?php } ?>>Kauf&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</option>
</select></td>
</tr>

<?php echo $tablespacer; ?>



<tr>
<td class="textnorm" colspan=3>Kunde <div align="right"><select name="customer"<?php if (isset($maincontract_array)) { ?> onchange="javascript:changeCustomer();"<?php } else { ?> onchange="javascript:submit();"<?php } ?>>
<option value="">-- Bitte auswählen --&nbsp;&nbsp;&nbsp;</option>
<?php
// get customer list from DB

	$select = "SELECT id, name from kunde where online = '1' order by priority, name asc";
	$result = mysql_query($select)  // execute query
      		  or die ("Invalid select query."); 
  
	//-- make select box from matches
	
	$kunde_index = "";
	while (($row = mysql_fetch_array($result)) != null) {
		
	if ($row["name"] != $kunde_index) { ?>
	
	<?php $kunde_index = $row["name"]; ?>
	
<option value="<?php echo $row["id"]; ?>" <?php if ($customer == $row["id"]) { ?>selected<?php } ?>><?php echo $row["name"]; ?>&nbsp;&nbsp;&nbsp;</option>

<?php } // if kunde_index?>



<?php } // while ?>
</select></div></td>
</tr>

<?php echo $tablespacer; ?>

<?php
// check if customer is ford and show PN if necessary
?>

<tr>
<td <?php if ($errorform == "pn") { ?> class="textred"<?php } ?> colspan=3>PN Nr.&nbsp;&nbsp;<?php if (checkPN($customer) == true) { ?><select name="pn" onchange="javascript:submit();">
<option value="">-- Bitte auswählen --&nbsp;&nbsp;&nbsp;</option>
<?php
// get place from DB according to customer

	$select_pn = "SELECT pn from pn_list";
	$result_pn  = mysql_query($select_pn )  // execute query
      		  or die ("Invalid select query."); 
  
	//-- make select box from matches
	
	while (($row_pn  = mysql_fetch_array($result_pn )) != null) {
?>	
<option value="<?php echo $row_pn["pn"]; ?>" <?php if ($pn == $row_pn["pn"]) { ?>selected<?php } ?>><?php echo $row_pn["pn"]; ?>&nbsp;&nbsp;&nbsp;</option>
<?php } // while ?>

</select>&nbsp;&nbsp;<button onclick="javascript:showPN('<?php echo $pn; ?>');">PN bearbeiten</button>&nbsp;&nbsp;&nbsp;
<?php
if ($pn != "") {
	if (checkPNBudget($pn) == true ) { echo "<span class=\"textred\">Budget zu 80% überschritten</span>"; }
}
?>

<?php } else { ?><b>nur bei Ford Werke AG</b><input type="hidden" name="pn" value=""><?php } ?></td>
</tr>

<?php echo $tablespacer; ?>

<tr>
<td colspan=3>Versicherung für Kunde 

<select name="versicherung_kunde">
<?php
for ($i=1; $i<=3; $i++) { ?>
<option value="<?php echo $vktype[$i]; ?>"<?php if (isset($versicherung_kunde) and $versicherung_kunde == $vktype[$i]) { ?>selected<?php } ?>><?php echo $vktype[$i]; ?>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</option>
<?php } ?>
</select>&nbsp;&nbsp;&nbsp;mit Selbstbeteiligung i.H. von € <input type="text" class="right" name="sb_kunde" size="10" value="<?php echo deNumber($sb_kunde); ?>" onblur="validateNumberFormat(this)"></td>
</tr>

<?php echo $tablespacer; ?>

<tr>
<td colspan=3 align="right"><strong>Datumeingabe - TT.MM.JJJJ&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Uhrzeiteingabe - HH:MM</strong></td>
</tr>

<tr>
<td colspan=3><img src="grafix/trans.gif" width=1 height=5></td>
</tr>

<tr>
<td <?php if ($errorform == "customer_date") { ?> class="textred"<?php } ?>>Mietzeitraum</td>
<td align="right" colspan=2 class="textnorm">von <input type="text" size="10" maxlength="10" name="customer_date1" value="<?php echo $customer_date1; ?>" onkeyup="javascript:completeDate(this)">&nbsp;<input type="text" size="5" maxlength="5" name="customer_time1" value="<?php echo $customer_time1; ?>" onkeyup="javascript:completeTime(this)"> bis <input type="text" size="10" maxlength="10" name="customer_date2" value="<?php echo $customer_date2; ?>" onkeyup="javascript:completeDate(this)">&nbsp;<input type="text" size="5" maxlength="5" name="customer_time2" value="<?php echo $customer_time2; ?>" onkeyup="javascript:completeTime(this)"></td>
</tr>

<?php echo $tablespacer; ?>

<tr>
<td <?php if ($errorform == "transport_date") { ?> class="textred"<?php } ?>>Mietzeitraum mit Transport</td>
<td align="right" colspan=2 class="textnorm">von <input type="text" size="10" maxlength="10" name="transport_date1" value="<?php echo $transport_date1; ?>" onkeyup="javascript:completeDate(this)">&nbsp;<input type="text" size="5" maxlength="5" name="transport_time1" value="<?php echo $transport_time1; ?>" onkeyup="javascript:completeTime(this)"> bis <input type="text" size="10" maxlength="10" name="transport_date2" value="<?php echo $transport_date2; ?>" onkeyup="javascript:completeDate(this)">&nbsp;<input type="text" size="5" maxlength="5" name="transport_time2" value="<?php echo $transport_time2; ?>" onkeyup="javascript:completeTime(this)"></td>
</tr>

<?php echo $tablespacer; ?>

<tr>
<td>Pauschal Kilometerleistung Kunde</td>
<td colspan=2 align="right"><input type="text" class="right" name="kilometer_pauschal" size=6 value="<?php echo deInteger($kilometer_pauschal); ?>" onblur="validateIntegerFormat(this)"> KM</td>
</tr>

<?php echo $tablespacer; ?>

<?php if ($customer != "") { ?>

<tr>
<td <?php if ($errorform == "place") { ?> class="textred"<?php } ?> colspan=3>Veranstaltungsort
<div align="right"><select name="place">
<option value="">-- Bitte auswählen --&nbsp;&nbsp;&nbsp;</option>
<?php
// get place from DB according to customer

	$select_place = "SELECT place from veranstaltungsort where customer = '$customer' order by place";
	$result_place  = mysql_query($select_place )  // execute query
      		  or die ("Invalid select query."); 
  
	//-- make select box from matches
	
	while (($row_place  = mysql_fetch_array($result_place )) != null) {
?>	
<option value="<?php echo $row_place["place"]; ?>" <?php if (strtolower($place) == strtolower($row_place["place"])) { ?>selected<?php } ?>><?php echo substr($row_place["place"], 0, 100); ?>&nbsp;&nbsp;&nbsp;</option>
<?php } // while ?>

</select></div></td>
</tr>

<tr>
<td colspan=3><img src="grafix/trans.gif" width=1 height=5></td>
</tr>

<tr>
<td colspan=3 align="right">oder andere&nbsp;&nbsp;<input type="text" name="place2" size=40></td>
</tr>

<tr>
<td colspan=3><b>Falls vom Veranstaltungsort abweichend</b></td>
</tr>

<tr>
<td colspan=3>unterschiedliche Anliefer-/Abholort (für Disponent Wochenplan)&nbsp;<input type="checkbox" name="anliefer_abhol" <?php if ($anliefer_abhol == 1) { ?>checked<?php } ?>></td>
</tr>

<tr>
<td>A-Tour : Lieferadresse für Disponent</td>
<td colspan=2 align="right"><input type="text" name="disponent_lieferadresse" size=40 value="<?php echo $disponent_lieferadresse; ?>"></td>
</tr>

<tr>
<td>B-Tour : Abholadresse für Disponent</td>
<td colspan=2 align="right"><input type="text" name="disponent_abholadresse" size=40 value="<?php echo $disponent_abholadresse; ?>"></td>
</tr>

<?php echo $tablespacer; ?>

<tr>
<td colspan=3 align="right"><input class="button" type="submit" name="save_changes" value="speichern"></td>
</tr>

<tr>
<td colspan=3><img src="grafix/trans.gif" width=1 height=10></td>
</tr>

<?php } else { ?>

<tr>
<td>Veranstaltungsort / Anlieferadresse</td>
<td colspan=2 align="right">Bitte wählen Sie erst einen Kunde aus.<input type="hidden" name="place" value=""><input type="hidden" name="place2" value=""><input type="hidden" name="disponent_lieferadresse" value=""><input type="hidden" name="disponent_abholadresse" value=""></td>
</tr>

<tr>
<td colspan=3><img src="grafix/trans.gif" width=1 height=10></td>
</tr>

<?php } // if $customer ?>


<?php
if (isset($maincontract_array)) {
	$commenttext = "";
	$select = "select * from comments where vertrag = '".$maincontract_array["vertrag"]."' order by cdate desc";
	$result = mysql_query($select);  // execute query
	while (($row = mysql_fetch_array($result)) != null) {
	
		$commenttext.= convertDate2Read($row["cdate"]) . " - " . $row["comment"] . "<br>";
	}	
	if ($commenttext != "") { ?>

<tr>
<td colspan=3><span class="textheader">Notizen zum Vorgang</span><br><?php echo $commenttext; ?><br><br></td>
</tr>

<?php } } ?>




</table>

<?php require("vorgangsblatt_beschaffung_bodyend.php");
 
PHP:
$pattern_date = "^[0-3][0-9]\.[0-1][0-9]\.20[0-9][3-9]$";
Änder diesen Pattern mal wie folgt:
PHP:
$pattern_date = "^[0-3][0-9]\.[0-1][0-9]\.20[0-9][0-9]$";

*edit*
Das alles hat btw. nichts mit JavaScript zu tun. ;)
 
Zuletzt bearbeitet:
Gern geschehen. :)
Dann kannst du den Thread ja nun als erledigt markieren - falls ich nicht irgendeine andere Frage übersehen habe. ;)
 
Zurück