Another feature that would be great, is to provide for validated data in the "other fields", and not just free format text.
For example, if I want to track work by machine, I would like to enter a list of valid machine codes tied to a punch field for "Machine" - which would then populate a drop down list.
I don't think this would be too difficult - I might implement it myself and contribute it back.
BJ.
Custom/other fields - validated data
Other fields - with validated data
I took a day an implemented this on top of version 2.2.13.
Specifically I've added an "Other Field Values" menu option, where you can populate field values by "other_id", and modified all the punch screens with "other fields" to be drop-down lists, instead of plain text entry.
Its not fully integrated into the permission model, but it works.
I'd be happy to contribute this improvement back to the community, if anyone is interested.
-Bob
Specifically I've added an "Other Field Values" menu option, where you can populate field values by "other_id", and modified all the punch screens with "other fields" to be drop-down lists, instead of plain text entry.
Its not fully integrated into the permission model, but it works.
I'd be happy to contribute this improvement back to the community, if anyone is interested.
-Bob
OK - patch against 2.2.13 source + sql file (for one new table) can be found here:
http://www.box.net/shared/av9v9h52v7
The only thing I couldn't figure out was Caching.. I had to manually create /tmp/timetrex/custom directory.
NOTE: This patch only applies to other_id1 (first other field), but can easily be extended to more fields.
-Bob
http://www.box.net/shared/av9v9h52v7
The only thing I couldn't figure out was Caching.. I had to manually create /tmp/timetrex/custom directory.
NOTE: This patch only applies to other_id1 (first other field), but can easily be extended to more fields.
-Bob
Find below a patch (which works in conjunction with patch above) which will take an Employee Other ID1 field (as text entry), and use it as the default "other_id1" on IN punches at the time-clock.
We use punch level other_id1 as "Machine" - being a custom validated field, and employee level other_id1 as "Default Machine" - being text (ideally it would be a custom validated field too).
-Bob
We use punch level other_id1 as "Machine" - being a custom validated field, and employee level other_id1 as "Default Machine" - being text (ideally it would be a custom validated field too).
-Bob
Code: Select all
Index: classes/modules/time_clock/TimeClock.class.php
===================================================================
--- classes/modules/time_clock/TimeClock.class.php (revision 703)
+++ classes/modules/time_clock/TimeClock.class.php (working copy)
@@ -313,6 +313,17 @@
$pcf->setDepartment( $u_obj->getDefaultDepartment() );
}
+ //set custom punch field 1 to custom employee field 1
+ if ( $u_obj->getOtherID1() !== FALSE ) {
+ $clf = new CustomListFactory();
+ $cf_id = 0;
+ $clf->getByName( $u_obj->getOtherID1() );
+ if ( $clf->getRecordCount() == 1 ) {
+ $cf_id = $clf->getCurrent()->getID();
+ $pcf->setOtherID1( $cf_id );
+ }
+ }
+
if ( isset($job_id) AND $job_id > 0 ) {
$pcf->setJob( $job_id );
}
@@ -724,4 +735,4 @@
return FALSE;
}
}
-?>
\ No newline at end of file
+?>
Index: classes/modules/custom/CustomListFactory.class.php
===================================================================
--- classes/modules/custom/CustomListFactory.class.php (revision 693)
+++ classes/modules/custom/CustomListFactory.class.php (working copy)
@@ -53,6 +53,28 @@
return $this;
}
+ function getByName($name, $where = NULL, $order = NULL) {
+ if ( $name == '' ) {
+ return FALSE;
+ }
+
+ $ph = array(
+ 'name' => $name,
+ );
+
+ $query = '
+ select *
+ from '. $this->getTable() .'
+ where name = ?
+ AND deleted = 0';
+ $query .= $this->getWhereSQL( $where );
+ $query .= $this->getSortSQL( $order );
+
+ $this->rs = $this->db->Execute($query, $ph);
+
+ return $this;
+ }
+
function getByCompanyId($id, $limit = NULL, $page = NULL, $where = NULL, $order = NULL) {
if ( $id == '' ) {
return FALSE;