--- a/fhiiqm/form/vertrag_form.inc.php Thu Sep 08 15:25:25 2011 +0200
+++ b/fhiiqm/form/vertrag_form.inc.php Mon Sep 12 10:34:07 2011 +0200
@@ -235,6 +235,10 @@
?>
</td>
</tr>
+ <tr>
+ <td>automatische Verlängerung</td>
+ <td><input name="vertrag[cautoend]" type="checkbox" value="1" <?php if ($vtr["cautoend"]) echo "checked";?>/></td>
+ </tr>
<tr>
<td>Kündigungsfrist<br />(Monate vor Ablauf)</td>
<td><input name="vertrag[cnot]" type="text" size="10" maxlength="3" value="<?php echo $vtr['cnot']; ?>"/></td>
@@ -272,6 +276,7 @@
<td>
<select name="vertrag[cpers][]" size="7" multiple="multiple">
<?php
+ $select = null;
if (is_array($vtr['cpers'])) $select = in_array( "-1", $vtr['cpers'] ) ? ' selected' : null;
echo "<option $select value=\"-1\"></option>\n";
$sql = "SELECT persknr, CONCAT (nachname, ', ',vorname) as pname FROM fhiiqm.Mitarbeiter ORDER BY 2";
@@ -294,12 +299,18 @@
<td>jährliche Kosten (€)</td><br />
<td>";
$j=0;
- if ($vtr['ejahr'])
+ if ($vtr['ejahr'])
+ $ejahr = $vtr['ejahr'];
+ elseif ($vtr["cautoend"] && !$vtr['ejahr']) // automatische Vertragsverlaengerung und kein Endjahr angegeben
+ $ejahr = date("Y");
+ else
+ $ejahr = null;
+ if ($ejahr)
{
- for ($i=(int)$vtr['bjahr']; $i<(int)$vtr['ejahr']+1; $i++ )
+ for ($i=(int)$vtr['bjahr']; $i<(int)$ejahr+1; $i++ )
{
echo "<input name=\"vertrag[kjahr][$j]\" type=\"text\" size=\"4\" value=\"$i\"/> ";
- echo "<input name=\"vertrag[kost][$j]\" type=\"text\" value=\"" . $vtr['kost'][$j] . "\"/><br />";
+ echo "<input name=\"vertrag[kost][$j]\" type=\"text\" value=\"" . $vtr['kost'][$j] . "\"/><br />\n";
$j++;
}
}