Subversion Repositories ALCASAR

Rev

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

Rev 1805 Rev 1838
Line 66... Line 66...
66
			$chkdef = (isset($default_vals["$key"])) ? check_defaults($val,$op_val,$default_vals["$key"]) : 0;
66
			$chkdef = (isset($default_vals["$key"])) ? check_defaults($val,$op_val,$default_vals["$key"]) : 0;
67
	// 	if value is the same as that in the sql database do nothing
67
	// 	if value is the same as that in the sql database do nothing
68
			if (isset($item_vals["$key"]) && $val == $item_vals["$key"][$j])
68
			if (isset($item_vals["$key"]) && $val == $item_vals["$key"][$j])
69
				continue;
69
				continue;
70
	//	if value is null or equals the default value and corresponding value exists then delete
70
	//	if value is null or equals the default value and corresponding value exists then delete
71
			else if (($chkdef || $val == '' || ($sql_attr == "Filter-Id" && $val == "None")) && isset($item_vals["$key"][$j])){
71
			else if ( isset($member_groups) && ($chkdef || $val == '' || ($sql_attr == "Filter-Id" && $val == "None")) && isset($item_vals["$key"][$j])){
72
				$res = da_sql_query($link,$config,
72
				$res = da_sql_query($link,$config,
73
				"DELETE FROM $table WHERE $query_key = '$login' AND attribute = '$sql_attr';");
73
				"DELETE FROM $table WHERE $query_key = '$login' AND attribute = '$sql_attr';");
74
				if (!$res || !da_sql_affected_rows($link,$res,$config))
74
				if (!$res || !da_sql_affected_rows($link,$res,$config))
75
					echo "<b>Delete failed for attribute $key: " . da_sql_error($link,$config) . "</b><br>\n";
75
					echo "<b>Delete failed for attribute $key: " . da_sql_error($link,$config) . "</b><br>\n";
76
			}
76
			}
77
	//	if value is null or equals the default value then don't add it
77
	//	if value is null or equals the default value then don't add it
78
			else if ($val == '' || check_defaults($val,$op_val,$default_vals["$key"]))
78
			else if (isset($default_vals["$key"]) && ($val == '' || check_defaults($val,$op_val,$default_vals["$key"])))
79
				continue;
79
				continue;
80
	//	if value differs from the sql value then update
80
	//	if value differs from the sql value then update
81
			else{
81
			else{
82
				if (isset($item_vals["$key"][$j])){
82
				if (isset($item_vals["$key"][$j])){
83
					$old_val = $item_vals["$key"][$j];
83
					$old_val = $item_vals["$key"][$j];