Termine: mehrtaegige Termine behalten beim Aendern ihre id

Bisher wurde eine mehrtaegige Terminreihe beim Speichern komplett geloescht
und neu angelegt, der Termin bekam also jedes Mal eine neue id. Jetzt bleibt
der Hauptsatz stehen und wird aktualisiert; nur die Folgetage werden neu
angelegt. Damit bleiben Verweise auf die id gueltig (Drucken, Links,
Aenderungsprotokoll), und Anlegen und Aendern laufen ueber denselben Weg.

terminHauptsatz() loest jede Zeilen-id auf ihre Reihe auf, so dass auch der
Einstieg ueber eine Nebenzeile oder ueber Altdaten ohne main_id funktioniert;
loescheTerminreihe() und setzeTerminErledigt() nutzen das ebenfalls.

templates/calendar_month.tpl entfernt: kein Code band die Monatsansicht ein,
und unter PHP 8 lief sie in einen Fehler.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-09-22 08:05:27 +02:00
co-authored by Claude Opus 5
parent 490c4f12a4
commit 2779f505df
3 changed files with 77 additions and 335 deletions
-276
View File
@@ -1,276 +0,0 @@
<p>
</p>
<p>
&nbsp;
</p>
<p>
&nbsp;
</p>
<p>
&nbsp;
</p>
<p>
&nbsp;
</p>
<br />
<div id='monthview'>
<a href='?action=termin&show=list'><span class='cal-list' title="Terminliste anzeigen" style='position: absolute; left: 50%;top: -11em;'></span></a><br />
<a href='?action=termin&show=month&page={$page-1}'><span class='left' title="6 Monate zurück" style='position: absolute; left: 0;top: -8em;'></span></a>
<a href='?action=termin&show=month&page=0'><span class='now' title="heute" style='position: absolute; left: 50%;top: -8em;'></span></a>
<a href='?action=termin&show=month&page={$page+1}'><span class='right' title="6 Monate Tage vor" style='position: absolute; right: 0;top: -8em;'></span></a>
{if $page == 0}
{*<a href='?action=terminadd&date=0' title='Neuer Termin'>*}<div class='nowweekdaybg'></div>{*</a>*}
{else}
<div class='weekdaybg' style='left: 14em;'>
</div>
{/if}
{foreach $weekdays as $weekday}
{$lastarbtermend = 0}
{if $i == 1 && $page == 0}
<div class='nowweekdayhead' style='left: {10*$i+3.5}em;'>{$weekday.weekday}
<a href='?action=terminshow&id=1&date={$weekday.date}&type=singlepages'><span class='print' title="Alle Termine von heute drucken" style='position:absolute;top: 0em;right:0em;'></span></a>
</div>
{else if {$weekday.weekday|substr:0:7} != "Samstag" && {$weekday.weekday|substr:0:7} != "Sonntag"}
<div class='weekdayhead' style='left: {10*$i+3.5}em;'>{$weekday.weekday}<br />
<a href='?action=terminshow&id=1&date={$weekday.date}&type=singlepages'><span class='print' title="Alle Termine an diesem Tag drucken" style='position:absolute;top: 0em;right:0em;'></span></a>
</div>
{*<a href='?action=terminadd&date={$i-1}' title='Neuer Termin'>*}<div class='weekdaybg' style='left: {10*$i+4}em;'></div>{*</a>*}
{else}
<div class='weekdayhead' style='left: {10*$i+3.5}em;background-color: #FFDDDD;'>{$weekday.weekday}<br />
<a href='?action=terminshow&id=1&date={$weekday.date}&type=singlepages'><span class='print' title="Alle Termine an diesem Tag drucken" style='position:absolute;top: 0em;right:0em;'></span></a>
</div>
{*<a href='?action=terminadd&date={$i-1}' title='Neuer Termin'>*}<div class='weekdaybg' style='left: {10*$i+4}em;background-color: #FFFFFF;'></div>{*</a>*}
{/if}
<div class='weekday_line' style='left: {10*$i+3.5}em;'></div>
{$shift = 0}
{$prevtermin= ""}
{$absmaxshift.{$weekday.weekday} = 1}
{$absmaxshiftone.{$weekday.weekday} = 0}
{$shiftone = 0}
{foreach $weekday.termine as $key=>$termin}
{if {$termin.termdauer} == "24:00:00"}
{$termin.termdauer = "23:59:59"}
{/if}
{if {$prevtermin.termtime|date_format:"%H%M"} <= {$termin.termtime|date_format:"%H%M"} && {{$prevtermin.termtime|date_format:"%H%M"}+{$prevtermin.termdauer|date_format:"%H%M"}} > {$termin.termtime|date_format:"%H%M"}} {*starttime of next term is within the prev term*}
{if {$prevtermin.termdauer} == "23:59:59"}
{$shiftone = $shiftone+1}
{else}
{$shift = $shift+1}
{/if}
{/if}
{if $termin.termdauer == "23:59:59"}
{if $termin.user2 > 0}
{$shiftone = $shiftone+1}
{/if}
{if $termin.user3 > 0}
{$shiftone = $shiftone+1}
{/if}
{if $termin.user4 > 0}
{$shiftone = $shiftone+1}
{/if}
{else}
{if $termin.user2 > 0}
{$shift = $shift+1}
{/if}
{if $termin.user3 > 0}
{$shift = $shift+1}
{/if}
{if $termin.user4 > 0}
{$shift = $shift+1}
{/if}
{/if}
{$weekday.termine.{$key}.shift = $shift}
{$weekday.termine.{$key}.shiftone = $shiftone}
{if $shift+1 > $absmaxshift.{$weekday.weekday}}
{$absmaxshift.{$weekday.weekday} = $shift+1}
{/if}
{if $shiftone > $absmaxshiftone.{$weekday.weekday}}
{$absmaxshiftone.{$weekday.weekday} = $shiftone}
{/if}
{$prevtermin = $termin}
{/foreach}
{$width = ((18 / $absmaxshift.{$weekday.weekday})-$absmaxshiftone.{$weekday.weekday})}
{foreach $weekday.termine as $key=>$termin}
{$shift = 10*$i + 3.9 + ($width/2)*$termin.shift + $termin.shiftone}
{if {$termin.termdauer} == '24:00:00'}
{$terminlength = 960}
{$terminstart = 390}
{$height = ($terminlength/15)}
{$start = 4 + ($terminstart - 420)/15}
<a href='?action=terminshow&id={$termin.main_id}'>
<div class='{if $termin.done == 1}doneterminbox{else}terminbox{/if}'
style='width: 1em;height: {$height}em;top: {$start}em;left: {$shift}em;background-color: {$users.{$termin.user}.color|escape}'
title='{$termin.typ|escape}<br />{$termin.head|escape} - <b>{$termin.uservname|escape} {$termin.usernname|escape}</b><br /> Ganztags<br />{if {$termin.ort}}<b>In {$termin.ort|escape}{if $termin.ortsteil}-{$termin.ortsteil|escape}{/if}</b><br />{/if}{if {$termin.vname} || {$termin.nname} || {$termin.firma}}Bei {$termin.vname|escape} {$termin.nname|escape} {$termin.firma|escape}{/if}'>
<span class='rotate'>{$termin.typ|substr:0:3|escape}.</span>
</div>
{else}
{$terminlength = ({$termin.termdauer|date_format:"%H"}*60 + {$termin.termdauer|date_format:"%M"})}
{$terminstart = ({$termin.termtime|date_format:"%H"}*60 + {$termin.termtime|date_format:"%M"})}
{if {$terminstart} == 0}
<a href='?action=projectadd&id={$termin.projectid}'>
{$terminlength = {$termin.termdauer}*60}
{$terminstart = 450+$lastarbtermend}
{$lastarbtermend = $terminstart-450 + $termin.termdauer * 60}
{$termin.typ = 'Arbeitsleistung'}
{else}
<a href='?action=terminshow&id={$termin.main_id}'>
{/if}
{$height = ($terminlength/15)}
{$start = 4 + ($terminstart - 420)/15}
{if {$termin.typ} != 'Arbeitsleistung'}
<div class='{if $termin.done == 1}doneterminbox{else}terminbox{/if}'
style='width: {$width}em;height: {$height}em;top: {$start}em;left: {$shift}em;background-color: {$users.{$termin.user}.color|escape}'
title='
{$termin.typ|escape}<br />{$termin.head|escape} - <b>{$termin.uservname|escape} {$termin.usernname|escape}</b><br />
Um {$termin.termtime|date_format:'%k:%M'}Uhr<br />Dauer {if {$termin.termdauer|date_format:'%k'} > 0} {$termin.termdauer|date_format:'%k'}h{/if}
{if {$termin.termdauer|date_format:'%M'} > 0}{$termin.termdauer|date_format:'%M'}min{/if}<br />
<b>In {$termin.ort|escape}{if $termin.ortsteil}-{$termin.ortsteil|escape}{/if}</b><br />
Bei {$termin.vname|escape} {$termin.nname|escape} {$termin.firma|escape}'>
{else}
<div class='{if $termin.done == 1}doneterminbox{else}terminbox{/if}'
style='width: {$width/3}em;height: {$height}em;top: {$start}em;left: {$shift}em;background-color: {if $termin.done}#CFC{else}{$users.{$termin.user}.color|escape}{/if}'
title='
{$termin.typ|escape} -
{$termin.firma|escape} {$termin.vname|escape} {$termin.nname|escape}<br />
<b>{$termin.projectname|escape}</b> <br />
{$termin.head|escape}<br />
<b>Dauer: </b>{if {$termin.termdauer} > 1} {$termin.termdauer|string_format:"%.1f"}h{/if}<br />
{/if}
<span class='rotate'>{$termin.typ|substr:0:3|escape}.</span>
</div>
{/if}
</a>
{if $termin.user2}
{$shift = 10*$i + 3.9 + ($width)*($termin.shift-1) + $termin.shiftone}
<a href='?action=terminshow&id={$termin.main_id}'>
{if {$termin.termdauer} == '24:00:00'}
{$terminlength = 960}
{$terminstart = 390}
{$height = ($terminlength/15)}
{$start = 4 + ($terminstart - 420)/15}
<div class='{if $termin.done == 1}doneterminbox{else}terminbox{/if}'
style='width: 1em;height: {$height}em;top: {$start}em;left: {$shift}em;background-color: {$users.{$termin.user2}.color|escape}'
title='{$termin.typ|escape}<br />{$termin.head|escape} - <b>{$termin.uservname2|escape} {$termin.usernname2|escape}</b><br /> Ganztags<br />{if {$termin.ort}}<b>In {$termin.ort|escape}{if $termin.ortsteil}-{$termin.ortsteil|escape}{/if}</b><br />{/if}{if {$termin.vname} || {$termin.nname} || {$termin.firma}}Bei {$termin.vname|escape} {$termin.nname|escape} {$termin.firma|escape}{/if}'>
<span class='rotate'>{$termin.typ|substr:0:3|escape}.</span>
</div>
{else}
{$terminlength = ({$termin.termdauer|date_format:"%H"}*60 + {$termin.termdauer|date_format:"%M"})}
{$terminstart = ({$termin.termtime|date_format:"%H"}*60 + {$termin.termtime|date_format:"%M"})}
{$height = ($terminlength/15)}
{$start = 4 + ($terminstart - 420)/15}
<div class='{if $termin.done == 1}doneterminbox{else}terminbox{/if}'
style='width: {$width}em;height: {$height}em;top: {$start}em;left: {$shift}em;background-color: {$users.{$termin.user2}.color|escape}'
title='{$termin.typ|escape}<br />{$termin.head|escape} - <b>{$termin.uservname2|escape} {$termin.usernname2|escape}</b><br /> Um {$termin.termtime|date_format:'%k:%M'}Uhr<br />Dauer {if {$termin.termdauer|date_format:'%k'} > 0} {$termin.termdauer|date_format:'%k'}h{/if} {if {$termin.termdauer|date_format:'%M'} > 0}{$termin.termdauer|date_format:'%M'}min{/if}<br /> <b>In {$termin.ort|escape}{if $termin.ortsteil}-{$termin.ortsteil|escape}{/if}</b><br />Bei {$termin.vname|escape} {$termin.nname|escape} {$termin.firma|escape}'>
<span class='rotate'>{$termin.typ|substr:0:3|escape}.</span>
</div>
{/if}
</a>
{/if}
{if $termin.user3}
{$shift = 10*$i + 3.9 + ($width)*($termin.shift-2) + $termin.shiftone}
<a href='?action=terminshow&id={$termin.main_id}'>
{if {$termin.termdauer} == '24:00:00'}
{$terminlength = 960}
{$terminstart = 390}
{$height = ($terminlength/15)}
{$start = 4 + ($terminstart - 420)/15}
<div class='{if $termin.done == 1}doneterminbox{else}terminbox{/if}'
style='width: 1em;height: {$height}em;top: {$start}em;left: {$shift}em;background-color: {$users.{$termin.user3}.color|escape}'
title='{$termin.typ|escape}<br />{$termin.head|escape} - <b>{$termin.uservname3|escape} {$termin.usernname3|escape}</b><br /> Ganztags<br />{if {$termin.ort}}<b>In {$termin.ort|escape}{if $termin.ortsteil}-{$termin.ortsteil|escape}{/if}</b><br />{/if}{if {$termin.vname} || {$termin.nname} || {$termin.firma}}Bei {$termin.vname|escape} {$termin.nname|escape} {$termin.firma|escape}{/if}'>
<span class='rotate'>{$termin.typ|substr:0:3|escape}.</span>
</div>
{else}
{$terminlength = ({$termin.termdauer|date_format:"%H"}*60 + {$termin.termdauer|date_format:"%M"})}
{$terminstart = ({$termin.termtime|date_format:"%H"}*60 + {$termin.termtime|date_format:"%M"})}
{$height = ($terminlength/15)}
{$start = 4 + ($terminstart - 420)/15}
<div class='{if $termin.done == 1}doneterminbox{else}terminbox{/if}'
style='width: {$width}em;height: {$height}em;top: {$start}em;left: {$shift}em;background-color: {$users.{$termin.user3}.color|escape}'
title='{$termin.typ|escape}<br />{$termin.head|escape} - <b>{$termin.uservname3|escape} {$termin.usernname3|escape}</b><br /> Um {$termin.termtime|date_format:'%k:%M'}Uhr<br />Dauer {if {$termin.termdauer|date_format:'%k'} > 0} {$termin.termdauer|date_format:'%k'}h{/if} {if {$termin.termdauer|date_format:'%M'} > 0}{$termin.termdauer|date_format:'%M'}min{/if}<br /> <b>In {$termin.ort|escape}{if $termin.ortsteil}-{$termin.ortsteil|escape}{/if}</b><br />Bei {$termin.vname|escape} {$termin.nname|escape} {$termin.firma|escape}'>
<span class='rotate'>{$termin.typ|substr:0:3|escape}.</span>
</div>
{/if}
</a>
{/if}
{if $termin.user4}
{$shift = 10*$i + 3.9 + ($width)*($termin.shift-3) + $termin.shiftone}
<a href='?action=terminshow&id={$termin.main_id}'>
{if {$termin.termdauer} == '24:00:00'}
{$terminlength = 960}
{$terminstart = 390}
{$height = ($terminlength/15)}
{$start = 4 + ($terminstart - 420)/15}
<div class='{if $termin.done == 1}doneterminbox{else}terminbox{/if}'
style='width: 1em;height: {$height}em;top: {$start}em;left: {$shift}em;background-color: {$users.{$termin.user4}.color|escape}'
title='{$termin.typ|escape}<br />{$termin.head|escape} - <b>{$termin.uservname4|escape} {$termin.usernname4|escape}</b><br /> Ganztags<br />{if {$termin.ort}}<b>In {$termin.ort|escape}{if $termin.ortsteil}-{$termin.ortsteil|escape}{/if}</b><br />{/if}{if {$termin.vname} || {$termin.nname} || {$termin.firma}}Bei {$termin.vname|escape} {$termin.nname|escape} {$termin.firma|escape}{/if}'>
<span class='rotate'>{$termin.typ|substr:0:3|escape}.</span>
</div>
{else}
{$terminlength = ({$termin.termdauer|date_format:"%H"}*60 + {$termin.termdauer|date_format:"%M"})}
{$terminstart = ({$termin.termtime|date_format:"%H"}*60 + {$termin.termtime|date_format:"%M"})}
{$height = ($terminlength/15)}
{$start = 4 + ($terminstart - 420)/15}
<div class='{if $termin.done == 1}doneterminbox{else}terminbox{/if}'
style='width: {$width}em;height: {$height}em;top: {$start}em;left: {$shift}em;background-color: {$users.{$termin.user4}.color|escape}'
title='{$termin.typ|escape}<br />{$termin.head|escape} - <b>{$termin.uservname4|escape} {$termin.usernname4|escape}</b><br /> Um {$termin.termtime|date_format:'%k:%M'}Uhr<br />Dauer {if {$termin.termdauer|date_format:'%k'} > 0} {$termin.termdauer|date_format:'%k'}h{/if} {if {$termin.termdauer|date_format:'%M'} > 0}{$termin.termdauer|date_format:'%M'}min{/if}<br /> <b>In {$termin.ort|escape}{if $termin.ortsteil}-{$termin.ortsteil|escape}{/if}</b><br />Bei {$termin.vname|escape} {$termin.nname|escape} {$termin.firma|escape}'>
<span class='rotate'>{$termin.typ|substr:0:3|escape}.</span>
</div>
{/if}
</a>
{/if}
{/foreach}
{$i=$i+1}
{/foreach}
{$i = 0}
{while $i < 16}
{$i = $i+1}
<div class='hourline_desc' style='top: {$i*4-0.5}em'>{{$i+6}|str_pad:2:'0':0}:00</div>
<div class='hourline' style='top: {$i*4}em'></div>
{/while}
{$time = {$smarty.now|date_format:"%H"}*60 + {$smarty.now|date_format:"%M"}}
<div id='timeline' style='top: {4 + ($time - 420)/15}em'></div>
{if $page == 0}
{for $i = 1 to 7}
<div class='weatherinfo' style="left: {3+10*$i}em;background-image: url('{$weather.{$i}.icon}');">
{$weather.{$i}.low}°C - {$weather.{$i}.high}°C
</div>
{/for}
{/if}
</div>
<br />
{foreach $users as $user}
<a href='?action=terminadd&user={$user.id}' style="color: #000;" title='Urlaub eintragen'><span class='legendcolbox' style='background-color: {$user.color|escape}'>{$user.vname|escape} {$user.nname|escape}</span></a>
{/foreach}
<br />
<script type="text/javascript">
$(".terminbox").tooltip({
track: true,
delay: 0,
showURL: false,
showBody: " - ",
});
$(".doneterminbox").tooltip({
track: true,
delay: 0,
showURL: false,
showBody: " - ",
});
</script>