Skip to content

Commit 0a28a5f

Browse files
committed
Bugfix in tform
1 parent bd8f4f9 commit 0a28a5f

File tree

4 files changed

+143
-4
lines changed

4 files changed

+143
-4
lines changed

interface/lib/classes/tform.inc.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,7 @@ function getHTML($record, $tab, $action = 'NEW') {
435435
break;
436436

437437
default:
438-
$new_record[$key] = htmlspecialchars($field['value']);
438+
$new_record[$key] = htmlspecialchars($field['default']);
439439
}
440440
}
441441

@@ -600,6 +600,9 @@ function getSQL($record, $tab, $action = 'INSERT', $primary_id = 0, $sql_ext_whe
600600

601601
global $app;
602602

603+
// If there are no data records on the tab, return empty sql string
604+
if(count($this->formDef['tabs'][$tab]['fields']) == 0) return '';
605+
603606
// checking permissions
604607
if($this->formDef['auth'] == 'yes') {
605608
if($action == "INSERT") {
@@ -653,6 +656,7 @@ function getSQL($record, $tab, $action = 'INSERT', $primary_id = 0, $sql_ext_whe
653656
}
654657
}
655658

659+
656660
// Füge Backticks nur bei unvollständigen Tabellennamen ein
657661
if(stristr($this->formDef['db_table'],'.')) {
658662
$escape = '';

interface/lib/classes/tform_actions.inc.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,11 @@ function onUpdate() {
103103
$ext_where = '';
104104
$sql = $app->tform->getSQL($this->dataRecord,$app->tform->getCurrentTab(),'UPDATE',$this->id,$ext_where);
105105
if($app->tform->errorMessage == '') {
106-
$app->db->query($sql);
107-
if($app->db->errorMessage != '') die($app->db->errorMessage);
106+
107+
if(!empty($sql)) {
108+
$app->db->query($sql);
109+
if($app->db->errorMessage != '') die($app->db->errorMessage);
110+
}
108111

109112
// Call plugin
110113
foreach($this->plugins as $plugin) {

interface/web/resellers/form/reseller.tform.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
$form["auth"] = 'yes';
4646

4747
$form["auth_preset"]["userid"] = 0; // 0 = id of the user, > 0 id must match with id of current user
48-
$form["auth_preset"]["groupid"] = 1; // 0 = default groupid of the user, > 0 id must match with groupid of current user
48+
$form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user
4949
$form["auth_preset"]["perm_user"] = 'riud'; //r = read, i = insert, u = update, d = delete
5050
$form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update, d = delete
5151
$form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
<?php
2+
3+
/*
4+
Form Definition
5+
6+
Tabledefinition
7+
8+
Datatypes:
9+
- INTEGER (Forces the input to Int)
10+
- DOUBLE
11+
- CURRENCY (Formats the values to currency notation)
12+
- VARCHAR (no format check, maxlength: 255)
13+
- TEXT (no format check)
14+
- DATE (Dateformat, automatic conversion to timestamps)
15+
16+
Formtype:
17+
- TEXT (Textfield)
18+
- TEXTAREA (Textarea)
19+
- PASSWORD (Password textfield, input is not shown when edited)
20+
- SELECT (Select option field)
21+
- RADIO
22+
- CHECKBOX
23+
- CHECKBOXARRAY
24+
- FILE
25+
26+
VALUE:
27+
- Wert oder Array
28+
29+
Hint:
30+
The ID field of the database table is not part of the datafield definition.
31+
The ID field must be always auto incement (int or bigint).
32+
33+
34+
*/
35+
36+
$form["title"] = "Email Alias";
37+
$form["description"] = "";
38+
$form["name"] = "mail_alias";
39+
$form["action"] = "mail_alias_edit.php";
40+
$form["db_table"] = "mail_redirect";
41+
$form["db_table_idx"] = "redirect_id";
42+
$form["db_history"] = "yes";
43+
$form["tab_default"] = "mailbox";
44+
$form["list_default"] = "mail_box_list.php";
45+
$form["auth"] = 'yes'; // yes / no
46+
47+
$form["auth_preset"]["userid"] = 0; // 0 = id of the user, > 0 id must match with id of current user
48+
$form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user
49+
$form["auth_preset"]["perm_user"] = 'riud'; //r = read, i = insert, u = update, d = delete
50+
$form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update, d = delete
51+
$form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
52+
53+
$form["tabs"]['mailbox'] = array (
54+
'title' => "Mailbox",
55+
'width' => 100,
56+
'template' => "templates/mail_box_mailbox_edit.htm",
57+
'fields' => array (
58+
##################################
59+
# Begin Datatable fields
60+
##################################
61+
'server_id' => array (
62+
'datatype' => 'INTEGER',
63+
'formtype' => 'TEXT',
64+
'default' => '',
65+
'value' => '',
66+
'width' => '30',
67+
'maxlength' => '255'
68+
),
69+
'email' => array (
70+
'datatype' => 'VARCHAR',
71+
'formtype' => 'TEXT',
72+
'validators' => array ( 0 => array ( 'type' => 'ISEMAIL',
73+
'errmsg'=> 'email_error_isemail'),
74+
1 => array ( 'type' => 'UNIQUE',
75+
'errmsg'=> 'email_error_unique'),
76+
),
77+
'default' => '',
78+
'value' => '',
79+
'width' => '30',
80+
'maxlength' => '255'
81+
),
82+
'cryptpwd' => array (
83+
'datatype' => 'VARCHAR',
84+
'formtype' => 'PASSWORD',
85+
'encryption'=> 'CRYPT',
86+
'default' => '',
87+
'value' => '',
88+
'width' => '30',
89+
'maxlength' => '255'
90+
),
91+
'active' => array (
92+
'datatype' => 'INTEGER',
93+
'formtype' => 'CHECKBOX',
94+
'default' => '1',
95+
'value' => '1'
96+
),
97+
##################################
98+
# ENDE Datatable fields
99+
##################################
100+
)
101+
);
102+
103+
$form["tabs"]['autoresponder'] = array (
104+
'title' => "Autoresponder",
105+
'width' => 100,
106+
'template' => "templates/mail_box_autoresponder_edit.htm",
107+
'fields' => array (
108+
##################################
109+
# Begin Datatable fields
110+
##################################
111+
'autoresponder_text' => array (
112+
'datatype' => 'TEXT',
113+
'formtype' => 'TEXTAREA',
114+
'default' => '',
115+
'value' => '',
116+
'cols' => '30',
117+
'rows' => '15'
118+
),
119+
'autoresponder' => array (
120+
'datatype' => 'INTEGER',
121+
'formtype' => 'CHECKBOX',
122+
'default' => '1',
123+
'value' => '1'
124+
),
125+
##################################
126+
# ENDE Datatable fields
127+
##################################
128+
)
129+
);
130+
131+
132+
?>

0 commit comments

Comments
 (0)