It would be helpful if the program checks to see if a user has already
clocked in so that they can only clock in once before clocking out. This
would keep users from clocking in twice when they meant to clock out.
It could be implimented as an option that is set in the sys config. Ken
here is an explanation you had sent me:
you'll need to edit the code in order to do this correctly. and you'd
need to do it somewhere in leftmain.php.
i'd look at running a mysql query that looks for the last punch for the
user
chosen in the dropdown (look in the info table for this). then you'll
need to
compare the status of this punch with the items in the punchlist table
to see
whether this status is considered an "in" or an "out".
for example, if the last punch for user1 was at 5pm and the status was
"out",
the punchlist table will show you that the in_or_out field is 0, meaning
that
it's "out". if the in_or_out field is 1, then the status would be
considered
to be "in".
after getting the needed results from the query above, in leftmain.php
you'll
need to run an "if" statment comparing the status in the dropdown to
the last
status in the info table for the user in the dropdown. if both statuses
are
considered to be "in" (1), or if both are considered to be "out" (0), you
spit
out some error message. if the statuses do not match, you allow the
user to
punch-in or out as they usually would.
if you're experienced with mysql and php, this probably won't be too
hard to
tackle. but if you're not all that experienced with mysql and php, it
might
be a bit difficult to muddle through.
please post this in the "feature requests" section here on sourceforge
and i'll
see to it that it is added as an option in a future release.
Logged In: YES
user_id=1491421
There is only one problem I see with this request. What if
you clock out and then get sucked back into somthing and
forget to clock back in. Once you try and clock back out so
that you could get paid for your time you would not be able
to because you would just get an error stating that you are
already clocked out.
Logged In: YES
user_id=1292300
It needs to be where if you clocked in last you can only
clock out. Query last action to see if it was an out or an
in and give an error if it was the wrong selection.
Functions should be defined as either in or out functions
because a user can only be in or out so they would have to
clock in before they could clock out. Restrictions could be
set for number of allowed hours between events depending on
the environment. Users could use the comment field to
explain not clocking out.
Logged In: YES
user_id=2013123
Originator: NO
I added this to leftmain.php to implement this feature and it seems to work okay in limited testing, but someone with more mysql & PHP experience could/should clean this up before it gets checked in anywhere:
// begin post validation //
if ($use_passwd == "yes") {
$employee_passwd = crypt($_POST['employee_passwd'], 'xy');
}
$query = "select punchitems from ".$db_prefix."punchlist";
$punchlist_result = mysql_query($query);
while ($row = mysql_fetch_array($punchlist_result)) {
$tmp_inout = "".$row['punchitems']."";
}
if (!isset($tmp_inout)) {echo "In/Out Status is not in the database.\n"; exit;}
//Addition to check if user is already signed in or already signed out
$query = "select `inout` from ".$db_prefix."info";
$inout_result = mysql_query($query);
while ($row = mysql_fetch_array($inout_result)) {
$tmp_inout2 = "".$row['inout']."";
}
if ($tmp_inout2 == $inout) {
echo " <td align=left class=right_main scope=col>\n";
echo " <table width=100% height=100% border=0 cellpadding=10 cellspacing=1>\n";
echo " <tr class=right_main_text>\n";
echo " <td valign=top>\n";
echo "<br />\n";
echo "Error: Incorrect status!\n";
echo "<br />\n";
echo "<br />\n";
echo "You tried to sign $inout when you were already $inout. Please try again.\n";
include 'footer.php';
exit;
}
// end post validation //