[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SF.net SVN: ledger-smb:[3972] branches/1.3



Revision: 3972
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=3972&view=rev
Author:   einhverfr
Date:     2011-11-10 11:25:31 +0000 (Thu, 10 Nov 2011)
Log Message:
-----------
Correcting issues saving when audit trail is enabled by removing old audit trail function and replacing with a stub since audit trails are now handled by triggers

Modified Paths:
--------------
    branches/1.3/LedgerSMB/Form.pm
    branches/1.3/LedgerSMB/Template/HTML.pm
    branches/1.3/LedgerSMB/Template.pm
    branches/1.3/UI/Contact/contact.html
    branches/1.3/templates/demo/invoice.html

Modified: branches/1.3/LedgerSMB/Form.pm
===================================================================
--- branches/1.3/LedgerSMB/Form.pm	2011-11-10 06:42:26 UTC (rev 3971)
+++ branches/1.3/LedgerSMB/Form.pm	2011-11-10 11:25:31 UTC (rev 3972)
@@ -3662,147 +3662,12 @@
 
 =item $form->audittrail($dbh, $myconfig, $audittrail);
 
-$audittrail is a hashref.  If $audittrail->{id} is false, this function
-retrieves the current time from the database and return a string of the form 
-"tablename|reference|formname|action|timestamp|" where all the values save
-timestamp are taken directly from the $audittrail hashref.
+Audit trail has been replaced by triggers which work on a very similar manner.
 
-If $audittrail->{id} is true but the value of audittrail in the defaults table
-is '0', do nothing and return.
-
-If $form->{audittrail} is true and $myconfig is false, $form->{audittrail} is
-treated as a pipe seperated list (trailing pipe required) of the form:
-  table1|ref1|form1|action1|date1|...|tablen|refn|formn|actionn|daten|
-
-All the entries described by $form->{audittrail} are inserted into the audit
-table, taking on a transaction id of $audittrail->{id} and the employee id of
-the calling user.
-
-Irrespective of $form->{audittrail} and $myconfig status, this function will add
-a record to the audittrail using the values contained within $audittrail,
-substituting the current date if $audittrail->{transdate} is not set and the
-employee id of the calling user.
-
 =cut
 
 sub audittrail {
-
-    my ( $self, $dbh, $myconfig, $audittrail ) = @_;
-
-    # table, $reference, $formname, $action, $id, $transdate) = @_;
-
-    my $query;
-    my $rv;
-    my $disconnect;
-
-    if ( !$dbh ) {
-        $dbh = $self->{dbh};
-    }
-    my $sth;
-
-    # if we have an id add audittrail, otherwise get a new timestamp
-
-    my @queryargs;
-
-    if ( $audittrail->{id} ) {
-
-        $query = qq|
-			SELECT value FROM defaults 
-			 WHERE setting_key = 'audittrail'|;
-
-        if ( $dbh->selectrow_array($query) ) {
-
-            my ( $null, $employee_id ) = $self->get_employee($dbh);
-
-            if ( $self->{audittrail} && !$myconfig ) {
-
-                chop $self->{audittrail};
-
-                my @a = split /\|/, $self->{audittrail};
-                my %newtrail = ();
-                my $key;
-                my $i;
-                my @flds = qw(tablename reference formname action transdate);
-
-                # put into hash and remove dups
-                while (@a) {
-                    $key = "$a[2]$a[3]";
-                    $i   = 0;
-                    $newtrail{$key} = { map { $_ => $a[ $i++ ] } @flds };
-                    splice @a, 0, 5;
-                }
-
-                $query = qq|
-					INSERT INTO audittrail 
-						(trans_id, tablename, reference,
-						formname, action, transdate, 
-						employee_id)
-					VALUES (?, ?, ?, ?, ?, ?, ?)|;
-
-                my $sth = $dbh->prepare($query) || $self->dberror($query);
-
-                foreach $key (
-                    sort {
-                        $newtrail{$a}{transdate} cmp $newtrail{$b}{transdate}
-                    } keys %newtrail
-                  )
-                {
-
-                    $i = 2;
-                    $sth->bind_param( 1, $audittrail->{id} );
-
-                    for (@flds) {
-                        $sth->bind_param( $i++, $newtrail{$key}{$_} );
-                    }
-                    $sth->bind_param( $i++, $employee_id );
-                    $sth->execute() || $self->dberror($query);
-                    $sth->finish;
-                }
-            }
-
-            if ( $audittrail->{transdate} ) {
-
-                $query = qq|
-					INSERT INTO audittrail (
-						trans_id, tablename, reference,
-						formname, action, employee_id, 
-						transdate)
-					VALUES (?, ?, ?, ?, ?, ?, ?)|;
-                @queryargs = (
-                    $audittrail->{id},        $audittrail->{tablename},
-                    $audittrail->{reference}, $audittrail->{formname},
-                    $audittrail->{action},    $employee_id,
-                    $audittrail->{transdate}
-                );
-            }
-            else {
-                $query = qq|
-					INSERT INTO audittrail 
-						(trans_id, tablename, reference,
-						formname, action, employee_id)
-					VALUES (?, ?, ?, ?, ?, ?)|;
-                @queryargs = (
-                    $audittrail->{id},        $audittrail->{tablename},
-                    $audittrail->{reference}, $audittrail->{formname},
-                    $audittrail->{action},    $employee_id,
-                );
-            }
-
-            $sth = $dbh->prepare($query);
-            $sth->execute(@queryargs) || $self->dberror($query);
-        }
-
-    }
-    else {
-
-        $query = qq|SELECT current_timestamp|;
-        my ($timestamp) = $dbh->selectrow_array($query);
-
-        $rv =
-"$audittrail->{tablename}|$audittrail->{reference}|$audittrail->{formname}|$audittrail->{action}|$timestamp|";
-    }
-
-    $rv;
+    return;
 }
 
 

Modified: branches/1.3/LedgerSMB/Template/HTML.pm
===================================================================
--- branches/1.3/LedgerSMB/Template/HTML.pm	2011-11-10 06:42:26 UTC (rev 3971)
+++ branches/1.3/LedgerSMB/Template/HTML.pm	2011-11-10 11:25:31 UTC (rev 3972)
@@ -124,13 +124,13 @@
         }
 	$template = Template->new({
 		INCLUDE_PATH => [$parent->{include_path_lang}, $parent->{include_path}, 'UI/lib'],
+                ENCODING => 'utf8',
 		START_TAG => quotemeta('<?lsmb'),
 		END_TAG => quotemeta('?>'),
 		DELIMITER => ';',
 		TRIM => 1,
                 COMPILE_DIR=> $tempdir,
 		DEBUG => ($parent->{debug})? 'dirs': undef,
-                ENCODING => 'utf8',
 		DEBUG_FORMAT => '',
 		}) || throw Error::Simple Template->error(); 
 	if (not $template->process(

Modified: branches/1.3/LedgerSMB/Template.pm
===================================================================
--- branches/1.3/LedgerSMB/Template.pm	2011-11-10 06:42:26 UTC (rev 3971)
+++ branches/1.3/LedgerSMB/Template.pm	2011-11-10 11:25:31 UTC (rev 3972)
@@ -342,13 +342,11 @@
 	}
 	if ($self->{mimetype} =~ /^text/) {
 		print "Content-Type: $self->{mimetype}; charset=utf-8$disposition\n\n";
-		binmode STDOUT, ':utf8';
 	} else {
 		print "Content-Type: $self->{mimetype}$disposition\n\n";
-		binmode STDOUT, ':bytes';
 	}
-	print $data;
 	binmode STDOUT, ':utf8';
+	print $data;
 }
 
 sub _http_output_file {

Modified: branches/1.3/UI/Contact/contact.html
===================================================================
--- branches/1.3/UI/Contact/contact.html	2011-11-10 06:42:26 UTC (rev 3971)
+++ branches/1.3/UI/Contact/contact.html	2011-11-10 11:25:31 UTC (rev 3972)
@@ -9,6 +9,7 @@
 ?>
 <?lsmb PROCESS 'elements.html' ?>
 <?lsmb IF !country_id; country_id = default_country; END -?>
+<?lsmb IF !country_id_t; country_id_t = default_country; END -?>
 <?lsmb 
 # Adding the action requirement to the conditional because otherwise it still
 # breaks.  --CT
@@ -43,6 +44,7 @@
     <?lsmb IF meta_number ?> 
 <div class="pageheading"><?lsmb text('Account') ?>: <?lsmb meta_number ?></div>
     <?lsmb END ?>
+<?lsmb notice = line_one ?>
     <?lsmb IF notice ?>
     <div class="notice"><?lsmb notice ?></div>
     <?lsmb END ?>
@@ -96,7 +98,7 @@
                 name = "entity_id"
                value = entity_id
 } ?>	
-<div class="input" id="person_name_div"><?lsmb #text('Name')?>&nbsp;
+<div class="input" id="person_name_div"><?lsmb #text('Name:')?>&nbsp;
 <div class="input_group">
 <!-- TODO:  Add Saluatation -->
 <?lsmb PROCESS input element_data = {
@@ -323,7 +325,7 @@
 			value_attr = "id"
 			default_values = [country_id]
 			options = country_list
-			name = "country_id"
+			name = "country_id_t"
 			label = text('Country') 
 	} ?> 
 </div>
@@ -766,7 +768,7 @@
 		</select>
 	</div>
 	<div> 
-		<?lsmb PROCESS input element_data = {
+		<?lsmb INCLUDE input element_data = {
 			label = text('Address'),
 			name = "line_one",
 			value = line_one,

Modified: branches/1.3/templates/demo/invoice.html
===================================================================
--- branches/1.3/templates/demo/invoice.html	2011-11-10 06:42:26 UTC (rev 3971)
+++ branches/1.3/templates/demo/invoice.html	2011-11-10 11:25:31 UTC (rev 3972)
@@ -1,6 +1,5 @@
-
-<body bgcolor=ffffff>
-
+<html>
+<body>
 <table width="100%">
 
   <?lsmb INCLUDE "letterhead.html" ?>

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.