Subversion Repositories ALCASAR

Rev

Rev 2044 | Rev 2343 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 2044 Rev 2047
Line 85... Line 85...
85
					#we keep the fourth bit of Filter-Id to warn user about administrator who read imputability logs.
85
					#we keep the fourth bit of Filter-Id to warn user about administrator who read imputability logs.
86
                                        $val[3]=$old_val[3];
86
                                        $val[3]=$old_val[3];
87
					$res = da_sql_query($link,$config,
87
					$res = da_sql_query($link,$config,
88
					"UPDATE $table SET value = '$val' WHERE $query_key = '$login' AND
88
					"UPDATE $table SET value = '$val' WHERE $query_key = '$login' AND
89
					attribute = '$sql_attr' AND value = '$old_val';");
89
					attribute = '$sql_attr' AND value = '$old_val';");
90
					
-
 
91
					#if filter-id does not exit, we create it (ALCASAR 2.9.2 DDB)
90
				// if filter-id does not exit, we create it (ALCASAR 2.9.2 DDB)
92
					if (!$res || !da_sql_affected_rows($link,$res,$config))
91
					if (!$res || !da_sql_affected_rows($link,$res,$config))
93
						$res = da_sql_query($link,$config,"INSERT INTO $table ($query_key,attribute,value $text2) VALUES ('$login','$sql_attr','00000000', ':=');");
92
						$res = da_sql_query($link,$config,"INSERT INTO $table ($query_key,attribute,value $text2) VALUES ('$login','$sql_attr','00000000', ':=');");
94
					
-
 
95
					if (!$res || !da_sql_affected_rows($link,$res,$config))
93
					if (!$res || !da_sql_affected_rows($link,$res,$config))
96
						echo "<b>Change failed for attribute $key: " . da_sql_error($link,$config) . "</b><br>\n";
94
						echo "<b>Change failed for attribute $key: " . da_sql_error($link,$config) . "</b><br>\n";
97
				}
95
				}
98
				else{
96
				else{
99
					if($val != ''){
97
					if($val != ''){
100
					$old_val = $item_vals["$key"][$j];
98
						$old_val = $item_vals["$key"][$j];
101
                                        $old_val = da_sql_escape_string($link, $old_val);
99
						$old_val = da_sql_escape_string($link, $old_val);
102
 
-
 
103
                                        $res = da_sql_query($link,$config,
100
						$res = da_sql_query($link,$config,
104
                                        "UPDATE $table SET value = '$val' WHERE $query_key = '$login' AND
101
						"UPDATE $table SET value = '$val' WHERE $query_key = '$login' AND
105
                                        attribute = '$sql_attr' AND value = '$old_val';");
102
						attribute = '$sql_attr' AND value = '$old_val';");
106
                                        
-
 
107
                                        #if attribute does not exist, we create it.     
103
					//	if attribute does not exist, we create it.     
108
                                        if (!$res || !da_sql_affected_rows($link,$res,$config))
104
						if (!$res || !da_sql_affected_rows($link,$res,$config))
109
                                        {
-
 
110
                                                $res = da_sql_query($link,$config,"INSERT INTO $table ($query_key,attribute,value $text2) VALUES ('$login','$sql_attr','$val' $op_val2);");
105
							$res = da_sql_query($link,$config,"INSERT INTO $table ($query_key,attribute,value $text2) VALUES ('$login','$sql_attr','$val' $op_val2);");
111
                                        }
-
 
112
 
-
 
113
					if (!$res || !da_sql_affected_rows($link,$res,$config))
106
						if (!$res || !da_sql_affected_rows($link,$res,$config))
114
						echo "<b>Change failed for attribute $key: " . da_sql_error($link,$config) . "</b><br>\n";
107
							echo "<b>Change failed for attribute $key: " . da_sql_error($link,$config) . "</b><br>\n";
115
					}
108
					}
116
					else
109
					else{
117
                                        {
-
 
118
                                                #if value is empty, we delete this attribute
110
					//	if value is empty, we delete this attribute
119
                                                $old_val = $item_vals["$key"][$j];
111
						$old_val = $item_vals["$key"][$j];
120
                                                $old_val = da_sql_escape_string($link, $old_val);
112
						$old_val = da_sql_escape_string($link, $old_val);
121
                                                if(isset($old_val) && $old_val != '')
113
						if(isset($old_val) && $old_val != '')
122
                                                {
-
 
123
                                                        $res = da_sql_query($link,$config,"DELETE FROM $table WHERE $query_key = '$login' AND attribute = '$sql_attr' AND value = '$old_val';");
114
                                                        $res = da_sql_query($link,$config,"DELETE FROM $table WHERE $query_key = '$login' AND attribute = '$sql_attr' AND value = '$old_val';");
124
                                                }
-
 
125
                                        }
115
                                        }
126
				}
116
				}
127
			}
117
			}
128
		}
118
		}
129
	}
119
	}