From c768fb1bf5dc4790615e6ddb99b47f9479d6f4cb Mon Sep 17 00:00:00 2001 From: Josh North Date: Tue, 24 Feb 2015 11:37:40 -0500 Subject: [PATCH] Added feature to let admins edit all punches --- includes/functions.inc.php | 21 ++++++++++++++++++++ manualpunch.php | 40 ++++++++++++++++++++++++++++++++++---- 2 files changed, 57 insertions(+), 4 deletions(-) diff --git a/includes/functions.inc.php b/includes/functions.inc.php index 7b6f2b1..9d1647a 100755 --- a/includes/functions.inc.php +++ b/includes/functions.inc.php @@ -33,6 +33,27 @@ function killSession() +// Edit Punch +function editPunch($yaptc_db, $punchid, $intime, $outtime, $notes) +{ +$stmt = $yaptc_db->prepare("UPDATE punches SET punches.intime = :intime, punches.outtime = :outtime, punches.notes = :notes WHERE punches.id = :punchid;"); +$stmt->execute(array( + ':punchid' => $punchid, + ':intime' => $intime, + ':outtime' => $outtime, + ':notes' => $notes + )); +} +// Delete Punch +function deletePunch($yaptc_db, $punchid) +{ +$stmt = $yaptc_db->prepare("DELETE FROM punches WHERE punches.id = :punchid;"); +$stmt->execute(array( + ':punchid' => $punchid + )); +} + + // Punch Out function punchOut($yaptc_db, $punchid, $notes, $outtime, $modified=NULL) { diff --git a/manualpunch.php b/manualpunch.php index c2aa48c..053c53f 100755 --- a/manualpunch.php +++ b/manualpunch.php @@ -13,7 +13,7 @@ else: ?> " . $status . " since " . $statustime . ""; ?> +echo ""; +if ($statustime == "No Punches"): echo $statustime; else: echo $status . " since " . $statustime; endif; +echo ""; ?> +
@@ -78,14 +81,43 @@ echo "" . $status . " since " . $statustime . ""; ?>
- - + + + + +

Edit Punches

+

Edit existing punches for users if needed.

+ + + + + + + + + + +
In/OutNameHoursFlagNotesAction
+ + + + + +

NOT AUTHORIZED!