Radicore Forum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » RADICORE development » Bug Reports » v1.34 issue with audit_logging and getFieldspec_original
v1.34 issue with audit_logging and getFieldspec_original [message #1304] Thu, 03 April 2008 19:09 Go to next message
cpscdave is currently offline  cpscdave
Messages: 20
Registered: June 2006
Junior Member
Hi Tony,
I have not verified if this is also in 1.35.

We are running Apache 2.2.4 and PHP 5.2.0

What appears to be happening is when I set $table->audit_logging = false; or
$table->audit_logging = 0;

All is fine until
_dml_insertRecord
...
$DML->fieldspec = $this->getFieldSpec_original();

In here
if (!empty($this->audit_logging)) {
$save_audit_logging = $this->audit_logging;
} // if

Is not saving the audit_logging, and then it gets turned back on.

I did some tests:
if( $this->tablename   == 'history')
      {
	print "\nIN HISTORY al\n";
	print "\nal: {$this->audit_logging}al\n";
	//exit;
	
	if(!empty($this->audit_logging))
	{
	  print "is not empty would save \n";
	}
	else
	{
	  print "is empty will NOT save\n";
	}
	if(isset($this->audit_logging))
	{
	  print "is set\n";
	}
	else
	{
	  print "is not set\n";
	}
	if($this->audit_logging===false)
	{
	  print "is false\n";
	}
	else
	{
	  print "is not false\n";
	}
	exit;
      }

outputs when I do $table->audit_logging = false;
is empty will NOT save
is set
is false

outputs when I do $table->audit_logging = 0;
is empty will NOT save
is set
is not false

outputs when I do $table->audit_logging = true;
is not empty would save
is set
is not false

Prehaps the code should be changed to:

  if ($this->audit_logging===false) {
        	$save_audit_logging = $this->audit_logging;
        } // if


Is there a standard for setting variables within Radicore?
Should we be using true/false, 1/0, unset()?

Thanks,
SoftElephant
Re: v1.34 issue with audit_logging and getFieldspec_original [message #1307 is a reply to message #1304] Fri, 04 April 2008 06:07 Go to previous message
AJM is currently offline  AJM
Messages: 2368
Registered: April 2006
Location: Surrey, UK
Senior Member
Yes, this is in fact a bug. After doing my own testing my own solution is as follows:

In the getFieldSpec_original() method change both occurrences of
if (!empty($this->audit_logging)) {
to
if (is_bool($this->audit_logging)) {

I shall include this fix in the next release.

The only 'standard' for setting variables in Radicore is to use the correct data type otherwise the results may be unpredictable.

In the case of some of the options which go into the $fieldspec array, they are switched on with:
$this->fieldspec['column']['keyword'] = 'y';

and switched off with
unset($this->fieldspec['column']['keyword']);

In these cases using
$this->fieldspec['column']['keyword'] = 'n';

will not have any effect as it is the existence of the keyword, not its value, that is checked.


Previous Topic: Problem in Delete Operation
Next Topic: v 1.35 - Inconsistent SQL files
Goto Forum:
  


Current Time: Sun Nov 24 07:26:06 EST 2024

Total time taken to generate the page: 0.01251 seconds