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

SF.net SVN: ledger-smb:[3802] trunk



Revision: 3802
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=3802&view=rev
Author:   einhverfr
Date:     2011-10-06 23:13:14 +0000 (Thu, 06 Oct 2011)
Log Message:
-----------
Merging from branches/1.3

Modified Paths:
--------------
    trunk/CONTRIBUTORS
    trunk/LedgerSMB/Template/CSV.pm
    trunk/LedgerSMB/Template/HTML.pm
    trunk/LedgerSMB.pm
    trunk/UI/Contact/contact.html
    trunk/lsmb-request.pl
    trunk/old-handler.pl
    trunk/sql/modules/Reconciliation.sql

Property Changed:
----------------
    trunk/


Property changes on: trunk
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/1.3:3711-3794
   + /branches/1.3:3711-3801

Modified: trunk/CONTRIBUTORS
===================================================================
--- trunk/CONTRIBUTORS	2011-10-06 22:39:23 UTC (rev 3801)
+++ trunk/CONTRIBUTORS	2011-10-06 23:13:14 UTC (rev 3802)
@@ -86,6 +86,9 @@
 
 Ian Goodacre [email omitted] has provided numerous bugfixes.
 
+Herman Vierendeels <herman.vierendeels @ gmail.com> Contributed a number of 
+bugfixes.
+
 Original Authors of SQL-Ledger:
 ===================================
 Dieter Simader <dsimader @ sql-ledger.com>

Modified: trunk/LedgerSMB/Template/CSV.pm
===================================================================
--- trunk/LedgerSMB/Template/CSV.pm	2011-10-06 22:39:23 UTC (rev 3801)
+++ trunk/LedgerSMB/Template/CSV.pm	2011-10-06 23:13:14 UTC (rev 3802)
@@ -45,6 +45,9 @@
 use Template;
 use LedgerSMB::Template::TTI18N;
 
+binmode STDOUT, ':utf8';
+binmode STDERR, ':utf8';
+
 sub get_template {
 	my $name = shift;
 	return "${name}.csv";

Modified: trunk/LedgerSMB/Template/HTML.pm
===================================================================
--- trunk/LedgerSMB/Template/HTML.pm	2011-10-06 22:39:23 UTC (rev 3801)
+++ trunk/LedgerSMB/Template/HTML.pm	2011-10-06 23:13:14 UTC (rev 3802)
@@ -51,6 +51,9 @@
 use Template;
 use LedgerSMB::Template::TTI18N;
 
+binmode STDOUT, ':utf8';
+binmode STDERR, ':utf8';
+
 sub get_template {
     my $name = shift;
     return "${name}.html";

Modified: trunk/LedgerSMB.pm
===================================================================
--- trunk/LedgerSMB.pm	2011-10-06 22:39:23 UTC (rev 3801)
+++ trunk/LedgerSMB.pm	2011-10-06 23:13:14 UTC (rev 3802)
@@ -318,7 +318,7 @@
     if (!$self->{company} && $self->is_run_mode('cgi', 'mod_perl')){
          my $ccookie = $cookie{${LedgerSMB::Sysconfig::cookie_name}};
          $ccookie =~ s/.*:([^:]*)$/$1/;
-         $self->{company} = $ccookie;
+         if($ccookie ne 'Login') { $self->{company} = $ccookie; } 
     }
     $logger->debug("LedgerSMB.pm: \$self->{company} = $self->{company}");
 

Modified: trunk/UI/Contact/contact.html
===================================================================
--- trunk/UI/Contact/contact.html	2011-10-06 22:39:23 UTC (rev 3801)
+++ trunk/UI/Contact/contact.html	2011-10-06 23:13:14 UTC (rev 3802)
@@ -37,10 +37,10 @@
 <?lsmb END ?>
 <body onload="init('<?lsmb target_div ?>')">
     <?lsmb IF name ?> 
-<div class="pageheading"><?lsmb text('Company:') ?> <?lsmb name ?></div>
+<div class="pageheading"><?lsmb text('Company') ?>: <?lsmb name ?></div>
     <?lsmb END ?>
     <?lsmb IF meta_number ?> 
-<div class="pageheading"><?lsmb text('Account:') ?> <?lsmb meta_number ?></div>
+<div class="pageheading"><?lsmb text('Account') ?>: <?lsmb meta_number ?></div>
     <?lsmb END ?>
     <?lsmb IF notice ?>
     <div class="notice"><?lsmb notice ?></div>
@@ -125,7 +125,7 @@
 problems with multi-word single-quoted constructs in PI tags. -CT  -->
 <div class="input_group">
 <?lsmb PROCESS input element_data = {
-	label = text('Job Title:')
+	label = text('Job Title')
 	name = "role"
 	value = role
 	type = "text"
@@ -134,7 +134,7 @@
 </div>
 <div class="input_group">
 <?lsmb PROCESS input element_data = {
-	label = text('Sales:')
+	label = text('Sales')
 	value = 1
 	type = "checkbox"
 	checked = sales
@@ -150,7 +150,7 @@
 			default_values = [country_id_t]
 			options = country_list
 			name = "country_id"
-			label = text('Country:') 
+			label = text('Country') 
 	} ?> 
 </div>
 </div>
@@ -165,7 +165,7 @@
 } # ' ?>
 </div>
 <div class="input_group">
-<label for="manager_select"><?lsmb text('Manager:') ?></label>
+<label for="manager_select"><?lsmb text('Manager') ?></label>
 <select id="manager_select" name="manager_id">
 <?lsmb FOREACH e = employee ?>
 <option value = e.entity_id <?lsmb (manager_id == e.entity_id) ? "SELECTED" : ""?><?lsmb e.name ?></option>
@@ -176,7 +176,7 @@
 <div id="hr_dates_div">
 <div class="input_group">
 <?lsmb PROCESS input element_data = {
-	label = text('DOB:')
+	label = text('DOB')
 	name = "dob"
 	value = dob
 	type = "text"
@@ -186,7 +186,7 @@
 </div>
 <div class="input_group">
 <?lsmb PROCESS input element_data = {
-	label = text('Start Date:')
+	label = text('Start Date')
 	name = "start_date"
 	value = start_date
 	type = "text"
@@ -196,7 +196,7 @@
 </div>
 <div class="input_group">
 <?lsmb PROCESS input element_data = {
-	label = text('End Date:')
+	label = text('End Date')
 	name = "end_date"
 	value = end_date
 	class = "text"
@@ -266,7 +266,7 @@
 <div class="input_line">
 <div class="input_group1">
 	<?lsmb PROCESS input element_data = {
-		label = text('Control Code:') #'
+		label = text('Control Code') #'
 		type= "text"
 		name = "control_code"
 		value = control_code
@@ -283,7 +283,7 @@
 		default_values = [created_as_class]
 		text_attr = 'class'
 		value_attr = 'id'
-		label = text('Class:')
+		label = text('Class')
 	} ?>
 	<?lsmb PROCESS button element_data = {
 		text = text('Generate Control Code') #'
@@ -304,7 +304,7 @@
 <div class="input_line">
 <div class="input_group1">
 	<?lsmb PROCESS input element_data = {
-		label = text('Name:')
+		label = text('Name')
 		type= "text"
 		name = "name"
 		value = name
@@ -320,14 +320,14 @@
 			default_values = [country_id_t]
 			options = country_list
 			name = "country_id_t"
-			label = text('Country:') 
+			label = text('Country') 
 	} ?> 
 </div>
 </div>
 <div class="input_line">
 <div class="input_group1">
 		<?lsmb INCLUDE input element_data = {
-			label = text('Tax Number/SSN:'),
+			label = text('Tax Number/SSN'),
 			name = "tax_id",
 			value = tax_id,
 			type = "text",
@@ -336,7 +336,7 @@
 </div>
 <div class="input_group2">
 		<?lsmb INCLUDE input element_data = {
-			label = text('SIC:'),
+			label = text('SIC'),
 			name = "sic_code",
 			value = sic_code,
 			type = "text",
@@ -419,14 +419,14 @@
 	<tr class="eca_row">
 	<td>
  	<?lsmb PROCESS input element_data = {
-		label = text("$entity_classname Number:"),
+		label = text("$entity_classname Number"),
 		type= "text",
 		name = "meta_number",
 		value = meta_number,
 		size = "20"
 	}  # " ?></td>
 	<td><?lsmb PROCESS input element_data = {
-		label = text("Description:"),
+		label = text("Description"),
 		type= "text",
 		name = "description",
 		value = description,
@@ -448,7 +448,7 @@
         <tr id="date-row">
             <td>
 		<?lsmb PROCESS input element_data = {
-			label = text('Starting Date:'),
+			label = text('Starting Date'),
 			name = "startdate",
 			class = "date",
 			value = startdate,
@@ -459,7 +459,7 @@
             </td>
             <td>
 		<?lsmb PROCESS input element_data = {
-			label = text('End Date:'),
+			label = text('End Date'),
 			name = "enddate",
 			class = "date",
 			value = enddate,
@@ -472,7 +472,7 @@
         <tr id="credit-row">
             <td>
 		<?lsmb INCLUDE input element_data = {
-			label = text('Credit Limit:'),
+			label = text('Credit Limit'),
 			name = "creditlimit",
 			value = creditlimit,
 			type = "text",
@@ -481,7 +481,7 @@
             </td>
             <td><span id="terms-span">
 		<?lsmb INCLUDE input element_data = {
-			label = text('Terms:'),
+			label = text('Terms'),
 			name = "terms",
 			value = terms,
 			type = "text",
@@ -492,7 +492,7 @@
 	<tr id="discount-gifi-row">
             <td>
 		<?lsmb INCLUDE input element_data = {
-			label = text('Discount:'),
+			label = text('Discount'),
 			name = "discount",
 			value = discount,
 			type = "text",
@@ -509,7 +509,7 @@
             </td>
             <td>
 		<?lsmb INCLUDE input element_data = {
-			label = text('Subcontract GIFI:'),
+			label = text('Subcontract GIFI'),
 			name = "gifi_accno",
 			value = gifi_accno,
 			type = "text",
@@ -554,7 +554,7 @@
 			default_values = [business_id]
 			text_attr = "description"
 			value_attr = "id"
-			label = text('Business Type:') #'
+			label = text('Business Type') #'
 			} ?> 
 	  </td>
           <td> <?lsmb INCLUDE input element_data = {
@@ -576,7 +576,7 @@
 			default_values = [taxform_id]
 			text_attr = "form_name"
 			value_attr = "id"
-			label = text('Taxforms:') 
+			label = text('Taxforms') 
 			} ?> 
 	  </td>
 
@@ -750,20 +750,20 @@
     </tr>
 	<?lsmb END ?>
     </table>
-	<div> <!-- TODO:  Move to elements.html -CT -->
+	<div> 
                 <?lsmb INCLUDE select element_data = {
                        name           = "location_class"
                        default_values = [location_class]
                        options        = location_class_list
                        text_attr      = "class"
                        value_attr     = "id"
-                       label          = text('Type:')
+                       label          = text('Type')
                 } ?>
 		</select>
 	</div>
 	<div> 
 		<?lsmb PROCESS input element_data = {
-			label = text('Address:'),
+			label = text('Address'),
 			name = "line_one",
 			value = line_one,
 			type = "text",
@@ -792,7 +792,7 @@
 	</div>
 	<div> 
 		<?lsmb PROCESS input element_data = {
-			label = text('City:'),
+			label = text('City'),
 			name = "city",
 			value = city,
 			type = "text",
@@ -801,7 +801,7 @@
 	</div>
 	<div> 
 		<?lsmb PROCESS input element_data = {
-			label = text('State/Province:'),
+			label = text('State/Province'),
 			name = "state",
 			value = state,
 			type = "text",
@@ -810,7 +810,7 @@
 	</div>
 	<div> 
 		<?lsmb PROCESS input element_data = {
-			label = text('Zip/Post Code:'),
+			label = text('Zip/Post Code'),
 			name = "mail_code",
 			value = mail_code,
 			type = "text",
@@ -825,7 +825,7 @@
 			default_values = [country_code]
 			options = country_list
 			name = "country_code"
-			label = text('Country:') 
+			label = text('Country') 
 		} ?>
 	</div>
 	<div>
@@ -850,10 +850,10 @@
 	<div class="listtop"><?lsmb text('Contact Information') ?></div>
 	<table width="100%">
 	<tr class="listheading">
-		<th class="contact_class"><?lsmb text('Type:') ?></th>
-		<th class="description"><?lsmb text('Description:') ?></th>
-		<th class="contact"><?lsmb text('Contact Info:') ?></th>
-		<th class="contact_actions"><?lsmb text('Actions:') ?></th>
+		<th class="contact_class"><?lsmb text('Type') ?></th>
+		<th class="description"><?lsmb text('Description') ?></th>
+		<th class="contact"><?lsmb text('Contact Info') ?></th>
+		<th class="contact_actions"><?lsmb text('Actions') ?></th>
 	</tr>
 	<?lsmb FOREACH ct = contacts ?>
 	<tr>
@@ -933,7 +933,7 @@
 	</div>
 	<div>
 		<?lsmb PROCESS input element_data = {
-			label = text('Description:'),
+			label = text('Description'),
 			name = "description"
 			value = description
 			type = "text"
@@ -942,7 +942,7 @@
 	</div>
 	<div>
 		<?lsmb PROCESS input element_data = {
-			label = text('Contact Info:'),
+			label = text('Contact Info'),
 			name = "contact"
 			value = contact
 			type = "text"
@@ -1025,7 +1025,7 @@
 	<div>
 	<?lsmb INCLUDE input element_data = {
 		type="text" 
-		label = text('BIC/SWIFT Code:')
+		label = text('BIC/SWIFT Code')
 		name="bic" 
 		value=bic
 		size=20
@@ -1034,7 +1034,7 @@
 	<div>
 	<?lsmb PROCESS input element_data = {
 		type="text" 
-		label = text('Bank Account:')
+		label = text('Bank Account')
 		name="iban" 
 		value=iban
 		size=20
@@ -1075,7 +1075,7 @@
 <?lsmb IF credit_id -?>
 <div class="input">
    <?lsmb PROCESS input element_data = {
-      label = text('Subject:'),
+      label = text('Subject'),
       name = "subject"
       value = subject
       type = "text"
@@ -1093,7 +1093,7 @@
 </div>
 <?lsmb END # IF credit_id -?>
 <div class="input"><?lsmb PROCESS textarea element_data = {
-	label = text('Notes:')
+	label = text('Notes')
 	name = 'note'
 } ?></div>
 <div class="input">

Modified: trunk/lsmb-request.pl
===================================================================
--- trunk/lsmb-request.pl	2011-10-06 22:39:23 UTC (rev 3801)
+++ trunk/lsmb-request.pl	2011-10-06 23:13:14 UTC (rev 3802)
@@ -51,9 +51,16 @@
 
 $ENV{SCRIPT_NAME} =~ m/([^\/\\]*.pl)\?*.*$/;
 my $script = $1;
-my $locale = LedgerSMB::Locale->get_handle( ${LedgerSMB::Sysconfig::language} )
-  or $request->error( __FILE__ . ':' . __LINE__ . ": Locale not loaded: $!\n" );
 
+my $locale;
+
+if ($request->{_user}){
+    $locale =  LedgerSMB::Locale->get_handle($request->{_user}->{language});
+} else {
+    $locale = LedgerSMB::Locale->get_handle( ${LedgerSMB::Sysconfig::language} )
+       or $request->error( __FILE__ . ':' . __LINE__ . ": Locale not loaded: $!\n" );
+}
+
 if (!$script){
 	$request->error($locale->text('No workflow script specified'));
 }

Modified: trunk/old-handler.pl
===================================================================
--- trunk/old-handler.pl	2011-10-06 22:39:23 UTC (rev 3801)
+++ trunk/old-handler.pl	2011-10-06 23:13:14 UTC (rev 3802)
@@ -124,8 +124,10 @@
 map { $form->{$_} = $myconfig{$_} } qw(stylesheet timeout)
   unless ( $form->{type} eq 'preferences' );
 
-$locale   = LedgerSMB::Locale->get_handle( $myconfig{countrycode} )
-  or $form->error( __FILE__ . ':' . __LINE__ . ": Locale not loaded: $!\n" );
+if ($myconfig{language}){
+    $locale   = LedgerSMB::Locale->get_handle( $myconfig{language} )
+      or $form->error( __FILE__ . ':' . __LINE__ . ": Locale not loaded: $!\n" );
+}
 # pull in the main code
 
 try {

Modified: trunk/sql/modules/Reconciliation.sql
===================================================================
--- trunk/sql/modules/Reconciliation.sql	2011-10-06 22:39:23 UTC (rev 3801)
+++ trunk/sql/modules/Reconciliation.sql	2011-10-06 23:13:14 UTC (rev 3802)
@@ -229,7 +229,13 @@
 	t_scn TEXT;
 	t_uid int;
 	t_prefix text;
+        t_amount numeric;
     BEGIN
+        SELECT CASE WHEN a.category in ('A', 'E') THEN in_amount * -1
+                    ELSE in_amount
+               END into t_amount
+          FROM cr_report r JOIN account a ON r.chart_id = a.id
+         WHERE r.id = in_report_id; 
 
 	SELECT value into t_prefix FROM defaults WHERE setting_key = 'check_prefix';
 
@@ -240,6 +246,7 @@
 		t_scn := t_prefix || in_scn;
 	END IF;
 	IF t_scn IS NOT NULL THEN
+                -- could this be changed to update, if not found insert?
 		SELECT count(*) INTO in_count FROM cr_report_line
 		WHERE scn ilike t_scn AND report_id = in_report_id 
 			AND their_balance = 0;
@@ -249,18 +256,18 @@
 			(report_id, scn, their_balance, our_balance, clear_time,
 				"user", trans_type)
 			VALUES 
-			(in_report_id, t_scn, in_amount, 0, in_date, t_uid,
+			(in_report_id, t_scn, t_amount, 0, in_date, t_uid,
 				in_type);
 		ELSIF in_count = 1 THEN
 			UPDATE cr_report_line
-			SET their_balance = in_amount, clear_time = in_date,
+			SET their_balance = t_amount, clear_time = in_date,
 				cleared = true
 			WHERE t_scn = scn AND report_id = in_report_id
 				AND their_balance = 0;
 		ELSE 
 			SELECT count(*) INTO in_count FROM cr_report_line
 			WHERE t_scn ilike scn AND report_id = in_report_id
-				AND our_value = in_amount and their_balance = 0;
+				AND our_value = t_amount and their_balance = 0;
 
 			IF in_count = 0 THEN -- no match among many of values
 				SELECT id INTO lid FROM cr_report_line
@@ -268,7 +275,7 @@
 				ORDER BY our_balance ASC limit 1;
 
 				UPDATE cr_report_line
-                                SET their_balance = in_amount, 
+                                SET their_balance = t_amount, 
 					clear_time = in_date,
 					trans_type = in_type,
 					cleared = true
@@ -276,21 +283,21 @@
 
 			ELSIF in_count = 1 THEN -- EXECT MATCH
 				UPDATE cr_report_line
-				SET their_balance = in_amount, 
+				SET their_balance = t_amount, 
 					trans_type = in_type,
 					clear_time = in_date,
 					cleared = true
 				WHERE t_scn = scn AND report_id = in_report_id
-                                	AND our_value = in_amount 
+                                	AND our_value = t_amount 
 					AND their_balance = 0;
 			ELSE -- More than one match
 				SELECT id INTO lid FROM cr_report_line
                         	WHERE t_scn ilike scn AND report_id = in_report_id
-                                	AND our_value = in_amount
+                                	AND our_value = t_amount
 				ORDER BY id ASC limit 1;
 
 				UPDATE cr_report_line
-                                SET their_balance = in_amount,
+                                SET their_balance = t_amount,
 					trans_type = in_type,
 					cleared = true,
 					clear_time = in_date
@@ -300,7 +307,7 @@
 		END IF;
 	ELSE -- scn IS NULL, check on amount instead
 		SELECT count(*) INTO in_count FROM cr_report_line
-		WHERE report_id = in_report_id AND our_balance = in_amount
+		WHERE report_id = in_report_id AND our_balance = t_amount
 			AND their_balance = 0 and post_date = in_date
 			and scn NOT LIKE t_prefix || '%';
 
@@ -309,24 +316,24 @@
 			(report_id, scn, their_balance, our_balance, clear_time,
 			"user", trans_type)
 			VALUES 
-			(in_report_id, t_scn, in_amount, 0, in_date, t_uid,
+			(in_report_id, t_scn, t_amount, 0, in_date, t_uid,
 			in_type);
 		ELSIF in_count = 1 THEN -- perfect match
-			UPDATE cr_report_line SET their_balance = in_amount,
+			UPDATE cr_report_line SET their_balance = t_amount,
 					trans_type = in_type,
 					clear_time = in_date,
 					cleared = true
-			WHERE report_id = in_report_id AND our_balance = in_amount
+			WHERE report_id = in_report_id AND our_balance = t_amount
                         	AND their_balance = 0 and
 				in_scn NOT LIKE t_prefix || '%';
 		ELSE -- more than one match
 			SELECT min(id) INTO lid FROM cr_report_line
-			WHERE report_id = in_report_id AND our_balance = in_amount
+			WHERE report_id = in_report_id AND our_balance = t_amount
                         	AND their_balance = 0 and post_date = in_date
 				AND scn NOT LIKE t_prefix || '%'
 			LIMIT 1;
 
-			UPDATE cr_report_line SET their_balance = in_amount,
+			UPDATE cr_report_line SET their_balance = t_amount,
 					trans_type = in_type,
 					clear_time = in_date,
 					cleared = true

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