[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb:[4658] addons/1.3/b_units/trunk/patches/b_units. patch
- Subject: SF.net SVN: ledger-smb:[4658] addons/1.3/b_units/trunk/patches/b_units. patch
- From: ..hidden..
- Date: Fri, 20 Apr 2012 08:00:39 +0000
Revision: 4658
http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=4658&view=rev
Author: einhverfr
Date: 2012-04-20 08:00:39 +0000 (Fri, 20 Apr 2012)
Log Message:
-----------
corrections for business units backport
Modified Paths:
--------------
addons/1.3/b_units/trunk/patches/b_units.patch
Modified: addons/1.3/b_units/trunk/patches/b_units.patch
===================================================================
--- addons/1.3/b_units/trunk/patches/b_units.patch 2012-04-20 07:58:51 UTC (rev 4657)
+++ addons/1.3/b_units/trunk/patches/b_units.patch 2012-04-20 08:00:39 UTC (rev 4658)
@@ -1,8 +1,49 @@
+Index: UI/journal/journal_entry.html
+===================================================================
+--- UI/journal/journal_entry.html (revision 4653)
++++ UI/journal/journal_entry.html (working copy)
+@@ -133,6 +133,11 @@
+ <?lsmb IF form.projectset == 1 ?>
+ <th class="listheading"><?lsmb text('Project') ?></th>
+ <?lsmb END ?>
++ <?lsmb FOREACH cls IN form.bu_class ?>
++ <?lsmb IF form.b_units.${cls.id} ?>
++ <th><?lsmb text(cls.label) ?></th>
++ <?lsmb END ?>
++ <?lsmb END ?>
+ </tr>
+ <?lsmb FOREACH displayrow IN displayrows ?>
+ <tr>
+@@ -255,6 +260,24 @@
+ <?lsmb END ?>
+
+ </td>
++ <?lsmb END ?>
++ <?lsmb FOREACH cls IN form.bu_class ?>
++ <?lsmb IF form.b_units.${cls.id} ?>
++ <td>
++
++ <?lsmb clsid = cls.id;
++ bucid = "b_unit_$clsid";
++ burow = "${bucid}_$INDEX";
++ form.b_units.${clsid}.unshift({});
++ INCLUDE select element_data = {
++ text_attr = "control_code"
++ value_attr = "id"
++ default_values = [displayrow.${bucid}]
++ name = "$burow"
++ options = form.b_units.${clsid}
++ } ?>
++ </td>
++ <?lsmb END ?>
+ <?lsmb END ?>
+
+ </tr>
Index: LedgerSMB/GL.pm
===================================================================
---- LedgerSMB/GL.pm (revision 4473)
+--- LedgerSMB/GL.pm (revision 4653)
+++ LedgerSMB/GL.pm (working copy)
-@@ -89,6 +89,7 @@
+@@ -97,6 +97,7 @@
sub post_transaction {
my ( $self, $myconfig, $form, $locale) = @_;
@@ -10,7 +51,7 @@
$form->{reference} = $form->update_defaults( $myconfig, 'glnumber', $dbh )
unless $form->{reference};
my $null;
-@@ -187,6 +188,10 @@
+@@ -195,6 +196,10 @@
my $debit;
my $credit;
@@ -21,7 +62,7 @@
# insert acc_trans transactions
for $i ( 0 .. $form->{rowcount} ) {
-@@ -236,6 +241,12 @@
+@@ -244,6 +249,12 @@
($form->{"cleared_$i"} || 0)
) || $form->dberror($query);
@@ -34,7 +75,7 @@
$posted = 1;
}
}
-@@ -646,8 +657,18 @@
+@@ -654,8 +665,18 @@
$sth = $dbh->prepare($query);
$sth->execute( $form->{id} ) || $form->dberror($query);
@@ -55,7 +96,7 @@
}
Index: LedgerSMB/Form.pm
===================================================================
---- LedgerSMB/Form.pm (revision 4473)
+--- LedgerSMB/Form.pm (revision 4653)
+++ LedgerSMB/Form.pm (working copy)
@@ -1903,6 +1903,45 @@
return $i;
@@ -120,9 +161,9 @@
ORDER BY transdate|;
Index: LedgerSMB/IR.pm
===================================================================
---- LedgerSMB/IR.pm (revision 4473)
+--- LedgerSMB/IR.pm (revision 4653)
+++ LedgerSMB/IR.pm (working copy)
-@@ -63,6 +63,7 @@
+@@ -69,6 +69,7 @@
sub post_invoice {
my ( $self, $myconfig, $form ) = @_;
@@ -130,7 +171,7 @@
if ($form->{id}){
delete_invoice($self, $myconfig, $form);
}
-@@ -199,6 +200,15 @@
+@@ -205,6 +206,15 @@
my $taxformfound=IR->taxform_exist($form,$form->{"vendor_id"});#tshvr this always returns true!!
@@ -146,7 +187,7 @@
for my $i ( 1 .. $form->{rowcount} ) {
$form->{"qty_$i"} = $form->parse_amount( $myconfig, $form->{"qty_$i"} );
-@@ -331,6 +341,12 @@
+@@ -337,6 +347,12 @@
$invoice_id
) || $form->dberror($query);
@@ -159,7 +200,7 @@
if($taxformfound)
{
my $report=$form->{"taxformcheck_$i"}?"true":"false";
-@@ -477,6 +493,11 @@
+@@ -483,6 +499,11 @@
$ref->{transdate}, $ref->{transdate},
) || $form->dberror($query);
@@ -171,7 +212,7 @@
# add expense
$query = qq|
INSERT INTO acc_trans
-@@ -501,6 +522,12 @@
+@@ -507,6 +528,12 @@
) || $form->dberror($query);
}
@@ -184,7 +225,7 @@
# update allocated for sold item
$form->update_balance( $dbh, "invoice", "allocated",
qq|id = $ref->{id}|,
-@@ -1269,7 +1296,13 @@
+@@ -1275,7 +1302,13 @@
$sth->execute( $form->{language_code}, $form->{id} )
|| $form->dberror($query);
@@ -198,7 +239,7 @@
&exchangerate_defaults( $dbh, $form );
# price matrix and vendor partnumber
-@@ -1294,6 +1327,11 @@
+@@ -1300,6 +1333,11 @@
$dec = length $dec;
my $decimalplaces = ( $dec > 2 ) ? $dec : 2;
@@ -212,7 +253,7 @@
my $taxrate = 0;
Index: LedgerSMB/AA.pm
===================================================================
---- LedgerSMB/AA.pm (revision 4473)
+--- LedgerSMB/AA.pm (revision 4653)
+++ LedgerSMB/AA.pm (working copy)
@@ -60,6 +60,7 @@
use strict;
@@ -222,7 +263,20 @@
my $exchangerate;
my $batch_class;
-@@ -461,6 +462,14 @@
+@@ -440,6 +441,12 @@
+
+ my $taxformfound=AA->taxform_exist($form,$form->{"$form->{vc}_id"});
+
++ my $b_unit_sth = $dbh->prepare(
++ "INSERT INTO business_unit_ac (entry_id, class_id, bu_id)
++ VALUES (currval('acc_trans_entry_id_seq'), ?, ?)"
++ );
++
++
+ foreach $ref ( @{ $form->{acc_trans}{lineitems} } ) {
+ # insert detail records in acc_trans
+ if ( $ref->{amount} ) {
+@@ -461,6 +468,14 @@
$dbh->prepare($query)->execute(@queryargs)
|| $form->dberror($query);
@@ -239,9 +293,9 @@
$query="select max(entry_id) from acc_trans;";
Index: LedgerSMB/OE.pm
===================================================================
---- LedgerSMB/OE.pm (revision 4473)
+--- LedgerSMB/OE.pm (revision 4653)
+++ LedgerSMB/OE.pm (working copy)
-@@ -301,6 +301,7 @@
+@@ -307,6 +307,7 @@
sub save {
my ( $self, $myconfig, $form ) = @_;
@@ -249,7 +303,7 @@
$form->db_prepare_vars(
"quonumber", "transdate", "vendor_id", "entity_id",
"reqdate", "taxincluded", "shippingpoint", "shipvia",
-@@ -309,6 +310,10 @@
+@@ -315,6 +316,10 @@
);
# connect to database, turn off autocommit
my $dbh = $form->{dbh};
@@ -260,7 +314,7 @@
my @queryargs;
my $quotation;
my $ordnumber;
-@@ -564,6 +569,11 @@
+@@ -570,6 +575,11 @@
$sth->execute(@queryargs) || $form->dberror($query);
$dbh->commit;
$form->{"sellprice_$i"} = $fxsellprice;
@@ -272,7 +326,7 @@
}
$form->{"discount_$i"} *= 100;
-@@ -808,6 +818,11 @@
+@@ -814,6 +824,11 @@
# connect to database
my $dbh = $form->{dbh};
@@ -284,7 +338,7 @@
my $query;
my $sth;
my $var;
-@@ -922,6 +937,11 @@
+@@ -928,6 +943,11 @@
while ( $ref = $sth->fetchrow_hashref('NAME_lc') ) {
$form->db_parse_numeric(sth=>$sth, hashref=>$ref);
@@ -298,9 +352,9 @@
$decimalplaces = ( $decimalplaces > 2 ) ? $decimalplaces : 2;
Index: LedgerSMB/IS.pm
===================================================================
---- LedgerSMB/IS.pm (revision 4473)
+--- LedgerSMB/IS.pm (revision 4653)
+++ LedgerSMB/IS.pm (working copy)
-@@ -903,6 +903,7 @@
+@@ -908,6 +908,7 @@
sub post_invoice {
my ( $self, $myconfig, $form ) = @_;
@@ -308,7 +362,7 @@
$form->{invnumber} = $form->update_defaults( $myconfig, "sinumber", $dbh )
unless $form->{invnumber};
-@@ -1029,6 +1030,10 @@
+@@ -1034,6 +1035,10 @@
my $taxformfound=IS->taxform_exist($form,$form->{"customer_id"});
@@ -319,7 +373,7 @@
foreach $i ( 1 .. $form->{rowcount} ) {
my $allocated = 0;
-@@ -1241,6 +1246,11 @@
+@@ -1246,6 +1251,11 @@
$invoice_id
) || $form->dberror($query);
@@ -331,38 +385,11 @@
my $report=($taxformfound and $form->{"taxformcheck_$i"})?"true":"false";
IS->update_invoice_tax_form($form,$dbh,$invoice_id,$report);
-@@ -1291,6 +1301,56 @@
+@@ -1296,6 +1306,29 @@
$invnetamount = $amount;
$amount = 0;
-+ my $report=($taxformfound and $form->{"taxformcheck_$i"})?"true":"false";
+
-+ IS->update_invoice_tax_form($form,$dbh,$invoice_id,$report);
-+
-+
-+ if (defined $form->{approved}) {
-+
-+ $query = qq| UPDATE ar SET approved = ? WHERE id = ?|;
-+ $dbh->prepare($query)->execute($form->{approved}, $form->{id})
-+ || $form->dberror($query);
-+ if (!$form->{approved}){
-+ if (not defined $form->{batch_id}){
-+ $form->error($locale->text('Batch ID Missing'));
-+ }
-+ $query = qq|
-+ INSERT INTO voucher (batch_id, trans_id) VALUES (?, ?)|;
-+ $sth = $dbh->prepare($query);
-+ $sth->execute($form->{batch_id}, $form->{id}) ||
-+ $form->dberror($query);
-+ }
-+ }
-+
-+ # add invoice_id
-+ $form->{acc_trans}{lineitems}[$ndx]->{invoice_id} = $invoice_id;
-+
-+ }
-+ }
-+
+ $form->{paid} = 0;
+ for $i ( 1 .. $form->{paidaccounts} ) {
+ $form->{"paid_$i"} =
@@ -388,7 +415,7 @@
for ( split / /, $form->{taxaccounts} ) {
$amount += $form->{acc_trans}{ $form->{id} }{$_}{amount} =
$form->round_amount( $form->{acc_trans}{ $form->{id} }{$_}{amount},
-@@ -1300,6 +1360,11 @@
+@@ -1305,6 +1338,11 @@
$diff = 0;
@@ -400,7 +427,7 @@
if ( $form->{taxincluded} ) {
$diff = $form->round_amount( $grossamount - $invamount, 2 );
$invamount += $diff;
-@@ -1332,6 +1397,11 @@
+@@ -1337,6 +1375,11 @@
|| $form->dberror($query);
$diff = 0;
$fxdiff = 0;
@@ -412,7 +439,7 @@
}
$form->{receivables} = $invamount * -1;
-@@ -2154,6 +2224,12 @@
+@@ -2159,6 +2202,12 @@
|| $form->dberror($query);
@@ -425,7 +452,7 @@
# foreign currency
&exchangerate_defaults( $dbh, $form );
-@@ -2180,6 +2256,11 @@
+@@ -2185,6 +2234,11 @@
$dec = length $dec;
my $decimalplaces = ( $dec > 2 ) ? $dec : 2;
@@ -437,49 +464,54 @@
$tth->execute( $ref->{id} );
$ref->{taxaccounts} = "";
-Index: UI/journal/journal_entry.html
+Index: bin/gl.pl
===================================================================
---- UI/journal/journal_entry.html (revision 4473)
-+++ UI/journal/journal_entry.html (working copy)
-@@ -133,6 +133,11 @@
- <?lsmb IF form.projectset == 1 ?>
- <th class="listheading"><?lsmb text('Project') ?></th>
- <?lsmb END ?>
-+ <?lsmb FOREACH cls IN form.bu_class ?>
-+ <?lsmb IF form.b_units.${cls.id} ?>
-+ <th><?lsmb text(cls.label) ?></th>
-+ <?lsmb END ?>
-+ <?lsmb END ?>
- </tr>
- <?lsmb FOREACH displayrow IN displayrows ?>
- <tr>
-@@ -255,6 +260,23 @@
- <?lsmb END ?>
+--- bin/gl.pl (revision 4653)
++++ bin/gl.pl (working copy)
+@@ -177,6 +177,7 @@
+ sub display_form
+ {
+ #Add General Ledger Transaction
++ $form->all_business_units($form->{transdate}, undef, 'GL');
+ $form->close_form;
+ $form->open_form;
+ $form->{dbh}->commit;
+@@ -404,7 +405,12 @@
+ $temphash1->{debit}=$form->{"debit_$i"};
+ $temphash1->{credit}=$form->{"credit_$i"};
- </td>
-+ <?lsmb FOREACH cls IN form.bu_class ?>
-+ <?lsmb IF form.b_units.${cls.id} ?>
-+ <td>
-+
-+ <?lsmb clsid = cls.id;
-+ bucid = "b_unit_$clsid";
-+ burow = "${bucid}_$INDEX";
-+ form.b_units.${clsid}.unshift({});
-+ INCLUDE select element_data = {
-+ text_attr = "control_code"
-+ value_attr = "id"
-+ default_values = [displayrow.${bucid}]
-+ name = "$burow"
-+ options = form.b_units.${clsid}
-+ } ?>
-+ </td>
-+ <?lsmb END ?>
- <?lsmb END ?>
++ for my $cls(@{$form->{bu_class}}){
++ $temphash1->{"b_unit_$cls->{id}"} =
++ $form->{"b_unit_$cls->{id}_$i"};
++ }
- </tr>
++
+ if ( $i < $form->{rowcount} )
+ {
+ $temphash1->{accno}=$form->{"accno_$i"};
+@@ -925,6 +931,8 @@
+
+ &create_links;
+
++ $form->all_business_units($form->{transdate}, undef, 'GL');
++
+ $form->{locked} =
+ ( $form->{revtrans} )
+ ? '1'
+@@ -954,6 +962,10 @@
+ $form->{"credit_$i"} = $ref->{amount};
+ }
+
++ for my $cls (@{$form->{bu_class}}){
++ $form->{"b_unit_$cls->{id}_$i"} = $ref->{"b_unit_$cls->{id}"};
++ }
++
+ $i++;
+ }
+ if ($form->{id}){
Index: bin/io.pl
===================================================================
---- bin/io.pl (revision 4473)
+--- bin/io.pl (revision 4653)
+++ bin/io.pl (working copy)
@@ -124,6 +124,15 @@
@@ -541,7 +573,7 @@
qq|<td><input name="runningnumber_$i" size=3 value=$i></td>|;
Index: bin/aa.pl
===================================================================
---- bin/aa.pl (revision 4545)
+--- bin/aa.pl (revision 4653)
+++ bin/aa.pl (working copy)
@@ -435,6 +435,10 @@
@@ -608,48 +640,3 @@
# departments
if ( @{ $form->{all_department} } ) {
$form->{selectdepartment} = "<option>\n";
-Index: bin/gl.pl
-===================================================================
---- bin/gl.pl (revision 4473)
-+++ bin/gl.pl (working copy)
-@@ -177,6 +177,7 @@
- sub display_form
- {
- #Add General Ledger Transaction
-+ $form->all_business_units($form->{transdate}, undef, 'GL');
- $form->close_form;
- $form->open_form;
- $form->{dbh}->commit;
-@@ -404,7 +405,12 @@
- $temphash1->{debit}=$form->{"debit_$i"};
- $temphash1->{credit}=$form->{"credit_$i"};
-
-+ for my $cls(@{$form->{bu_class}}){
-+ $temphash1->{"b_unit_$cls->{id}"} =
-+ $form->{"b_unit_$cls->{id}_$i"};
-+ }
-
-+
- if ( $i < $form->{rowcount} )
- {
- $temphash1->{accno}=$form->{"accno_$i"};
-@@ -925,6 +931,8 @@
-
- &create_links;
-
-+ $form->all_business_units($form->{transdate}, undef, 'GL');
-+
- $form->{locked} =
- ( $form->{revtrans} )
- ? '1'
-@@ -954,6 +962,10 @@
- $form->{"credit_$i"} = $ref->{amount};
- }
-
-+ for my $cls (@{$form->{bu_class}}){
-+ $form->{"b_unit_$cls->{id}_$i"} = $ref->{"b_unit_$cls->{id}"};
-+ }
-+
- $i++;
- }
- if ($form->{id}){
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.