-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdo_updatetasklog.php
78 lines (68 loc) · 2.45 KB
/
do_updatetasklog.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<?php /* TASKS $Id: do_updatetasklog.php,v 1.3 2004/06/04 20:24:17 bloaterpaste Exp $ */
//There is an issue with international UTF characters, when stored in the database an accented letter
//actually takes up two letters per say in the field length, this is a problem with costcodes since
//they are limited in size so saving a costcode as REDACIÓN would actually save REDACIÓ since the accent takes
//two characters, so lets unaccent them, other languages should add to the replacements array too...
function cleanText($text){
/*
//This text file is not utf, its iso so we have to decode/encode
$text = utf8_decode($text);
$trade = array('?E=>'a','?E=>'a','?E=>'a',
'?E=>'a','?E=>'a',
'Á'=>'A','À'=>'A','Ã'=>'A',
'Ä'=>'A','Â'=>'A',
'?E=>'e','?E=>'e',
'?E=>'e','?E=>'e',
'É'=>'E','È'=>'E',
'Ë'=>'E','Ê'=>'E',
'?E=>'i','?E=>'i',
'?E=>'i','?E=>'i',
'Í'=>'I','Ì'=>'I',
'Ï'=>'I','Î'=>'I',
'?E=>'o','?E=>'o','?E=>'o',
'?E=>'o','?E=>'o',
'Ó'=>'O','Ò'=>'O','Õ'=>'O',
'Ö'=>'O','Ô'=>'O',
'?E=>'u','?E=>'u',
'?E=>'u','?E=>'u',
'Ú'=>'U','Ù'=>'U',
'Ü'=>'U','Û'=>'U',
'Ñ'=>'N','?E=>'n');
$text = strtr($text,$trade);
$text = utf8_encode($text);
*/
return $text;
}
require_once( $AppUI->getModuleClass( 'tasks' ) );
$del = dPgetParam( $_POST, 'del', 0 );
$obj = new CTaskLog();
if (!$obj->bind( $_POST )) {
$AppUI->setMsg( $obj->getError(), UI_MSG_ERROR );
$AppUI->redirect();
}
if ($obj->task_log_date) {
$date = new CDate( $obj->task_log_date );
$obj->task_log_date = $date->format( FMT_DATETIME_MYSQL );
}
// prepare (and translate) the module name ready for the suffix
$AppUI->setMsg( 'Task Log' );
if ($del) {
if (($msg = $obj->delete())) {
$AppUI->setMsg( $msg, UI_MSG_ERROR );
} else {
$AppUI->setMsg( "deleted", UI_MSG_ALERT );
}
$AppUI->redirect("m=timecard&tab=0");
} else {
$obj->task_log_costcode = cleanText($obj->task_log_costcode);
if (($msg = $obj->store())) {
$AppUI->setMsg( $msg, UI_MSG_ERROR );
$AppUI->redirect();
} else {
$AppUI->setMsg( @$_POST['task_log_id'] ? 'updated' : 'inserted', UI_MSG_OK, true );
$AppUI->redirect("m=timecard&tab=0");
}
}
//echo '<pre>';print_r($obj);echo '</pre>';
$AppUI->redirect();
?>