Damn, a checkbox returns 'on' for true
[misc/kostenrechnung] / masks / arbeitsberichte.php
index 93732ae..cfd7656 100644 (file)
@@ -228,7 +228,7 @@ $formular = <<<EOC
 <tr>
  <td width="30%"><select id="edit_geraet" name="geraet" onchange="select_geraet(this)"><option value="">Bitte w√§hlen Sie</option></select></td>
  <td width="30%"><select id="edit_anbaugeraet" name="anbaugeraet"></select></td>
- <td width="30%"><input id="edit_geraetstunden" name="stunden" size="5" type="text"></td>
+ <td width="30%"><input id="edit_geraetstunden" name="geraetstunden" size="5" type="text"></td>
  <td width="10%" align="right"valign="bottom"><button onclick="return replicate_geraete()" style="color: red; font-weight: bold;">+&nbsp;</button></td>
 </tr>
 </table>
@@ -264,7 +264,7 @@ function einsatz_insert($mask)
                 $_POST['gebiet'],
                 $_POST['kostenstelle'],
                 $_POST['arbeitsart'],
-                $_POST['akkord'],
+                $_POST['akkord']==='on'?1:0,
                 empty($_POST['bemerkung']) ? 'NULL' : "'" . pg_escape_string($_POST['bemerkung']) . "'",
                 pg_escape_string($_SESSION['sys']['login']));
 
@@ -294,6 +294,7 @@ function einsatz_insert($mask)
       $app = ':'.$num;
       if (empty($_POST['personal'.$app])) break;
     }
+    $_POST['stunden'.$app] = str_replace(',','.',$_POST['stunden'.$app]);
     $sql = sprintf("INSERT INTO einsatzpersonal (einsatz,personal,stunden,sys_user,sys_edit) " .
                   "VALUES (%d,%d,%.2f,'%s',now())",
                   $einsatz,
@@ -316,12 +317,13 @@ function einsatz_insert($mask)
   while (true) {
     if ($num) $app = ':'.$num;
     if (empty($_POST['geraet'.$app])) break;
+    $_POST['geraetstunden'.$app] = str_replace(',','.',$_POST['geraetstunden'.$app]);
     $sql = sprintf("INSERT INTO einsatzgeraete (einsatz,geraet,anbaugeraet,stunden,sys_user,sys_edit) " .
                   "VALUES (%d,%d,%s,%.2f,'%s',now())",
                   $einsatz,
                   $_POST['geraet'.$app],
                   empty($_POST['anbaugeraet'.$app]) ? 'NULL' : intval($_POST['anbaugeraet'.$app]),
-                  $_POST['stunden'.$app],
+                  $_POST['geraetstunden'.$app],
                   pg_escape_string($_SESSION['sys']['login']));
 
     $sth = pg_query($sql);