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

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



Revision: 4329
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=4329&view=rev
Author:   einhverfr
Date:     2012-02-18 06:17:00 +0000 (Sat, 18 Feb 2012)
Log Message:
-----------
Initial beginnings on workflow scripts for business reporting units (replaces projects and departments)
Merging changes in from branches/1.3 regarding ajaxselect elements

Modified Paths:
--------------
    trunk/Changelog
    trunk/LedgerSMB/Scripts/journal.pm
    trunk/LedgerSMB/User.pm
    trunk/UI/ajax/helpers.js
    trunk/UI/lib/elements.html
    trunk/bin/gl.pl

Added Paths:
-----------
    trunk/LedgerSMB/Scripts/business_unit.pm

Property Changed:
----------------
    trunk/
    trunk/LedgerSMB/Scripts/admin.pm
    trunk/LedgerSMB/Scripts/customer.pm
    trunk/LedgerSMB/Scripts/employee.pm
    trunk/LedgerSMB/Scripts/file.pm
    trunk/LedgerSMB/Scripts/journal.pm
    trunk/LedgerSMB/Scripts/login.pm
    trunk/LedgerSMB/Scripts/menu.pm
    trunk/LedgerSMB/Scripts/payment.pm
    trunk/LedgerSMB/Scripts/recon.pm
    trunk/LedgerSMB/Scripts/setup.pm
    trunk/LedgerSMB/Scripts/taxform.pm
    trunk/LedgerSMB/Scripts/vendor.pm
    trunk/sql/upgrade/1.2-1.3-manual.sql


Property changes on: trunk
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/1.3:3711-4325
   + /branches/1.3:3711-4328

Modified: trunk/Changelog
===================================================================
--- trunk/Changelog	2012-02-17 12:38:12 UTC (rev 4328)
+++ trunk/Changelog	2012-02-18 06:17:00 UTC (rev 4329)
@@ -16,6 +16,9 @@
 Changelog for 1.3.12
 * Corrected processing of <?lsmb tags in order/invoice numbers (Chris T)
 * Corrected handling of accounts in dropdowns where () are present (Chris T)
+* Corrected erroneous log messages from debugging 1.3.11 (Chris T)
+* Autocomplete ajaxselect now work (degraded) without Javascript (Chris T)
+* Autocomplete ajaxselect now accept full entry without waiting (Chris T)
 
 Changelog for 1.3.11
 * Fixed outstanding report for payment reversal and partial payments (Chris T)


Property changes on: trunk/LedgerSMB/Scripts/admin.pm
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/1.3/LedgerSMB/Scripts/admin.pm:3901-4325
/branches/1.3/scripts/admin.pl:3711-3903,4273-4287
   + /branches/1.3/LedgerSMB/Scripts/admin.pm:3901-4328
/branches/1.3/scripts/admin.pl:3711-3903,4273-4287

Added: trunk/LedgerSMB/Scripts/business_unit.pm
===================================================================
--- trunk/LedgerSMB/Scripts/business_unit.pm	                        (rev 0)
+++ trunk/LedgerSMB/Scripts/business_unit.pm	2012-02-18 06:17:00 UTC (rev 4329)
@@ -0,0 +1,146 @@
+=head1 NAME 
+
+LedgerSMB::Scripts::business_unit
+
+=cut
+
+package LedgerSMB::Scripts::business_unit;
+use LedgerSMB::DBObject::Business_Unit_Class;
+use LedgerSMB::DBObject::Business_Unit;
+
+=head1 SYNOPSIS
+
+Workflow routines for LedgerSMB business reporting units
+
+=head1 FUNCTIONS
+
+All functions take a single $request object as their sole argument
+
+=over
+
+=item list_classes
+
+=cut
+
+sub list_classes {
+    my ($request) = @_;
+}
+
+=item add
+
+Adds a new business unit.  $request->{class_id} must be set.
+
+=cut
+
+sub add {
+    my ($request) = @_;
+}
+
+=item edit
+
+Edits an existing business unit.  $request->{id} must be set.
+
+=cut
+
+sub edit {
+    my ($request) = @_;
+}
+
+=item list
+
+Lists business units.  The following properties of $request may be set:
+
+=over
+
+=item class_id (required)
+
+Lists units for appropriate class.
+
+=item active_on
+
+If set filters for units active on the date in question, inclusive of start/end
+dates
+
+=item credit_id
+
+If set, filters excludes those which are for customers/vendors other than than 
+identified by this value.
+
+=item strict_credit_id 
+
+If set, excludes those which are not associated with customers/vendors.
+
+=back
+
+=cut
+
+sub list {
+    my ($request) = @_;
+}
+
+=item delete
+
+Deletes an existing business unit.  Only vaid for ones with no transactions or 
+sub-units.
+
+$request->{id} must be set.
+
+=cut
+
+sub delete {
+    my ($request) = @_;
+    my $unit = LedgerSMB::DBObject::Business_Unit->new($request);
+    $unit->delete;
+    list($request);
+}
+
+=item delete_class
+
+Deletes an existing business unit class.  Only valid of no units are of class.
+
+$request->{id} must be set.
+
+=cut
+
+sub delete_class {
+    my ($request) = @_;
+    my $bu_class = LedgerSMB::DBObject::Business_Unit_Class->new($request);
+    $bu_class->delete;
+    list_classes($request);
+}
+
+=item save
+
+Saves the existing unit.  Standard properties of 
+LedgerSMB::DBObject::Business_Unit must be set for $request.
+
+=cut
+
+sub save {
+    my ($request) = @_;
+    my $unit = LedgerSMB::DBObject::Business_Unit->new($request);
+    $unit->save;
+    edit($request);
+}
+
+=item save_class
+
+Saves the existing unit class.  Standard properties for 
+LedgerSMB::DBObject::Business_Unit_Class must be set for $request.
+
+=cut
+
+sub save_class {
+    my ($request) = @_;
+    my $bu_class = LedgerSMB::DBObject::Business_Unit_Class->new($request);
+    $bu_class->save;
+    list_classes($request);
+}
+
+=back
+
+=head COPYRIGHT
+
+Copyright (C) 2012 LedgerSMB core team.  Redistribution and use of work is 
+governed under the GNU General Public License, version 2 or at your option any
+later version.


Property changes on: trunk/LedgerSMB/Scripts/customer.pm
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/1.3/LedgerSMB/Scripts/customer.pm:4288-4325
/branches/1.3/scripts/customer.pl:4273-4287
   + /branches/1.3/LedgerSMB/Scripts/customer.pm:4288-4328
/branches/1.3/scripts/customer.pl:4273-4287


Property changes on: trunk/LedgerSMB/Scripts/employee.pm
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/1.3/LedgerSMB/Scripts/employee.pm:3712-4325
/branches/1.3/scripts/employee.pl:3842-3843,4273-4287,4289-4310
   + /branches/1.3/LedgerSMB/Scripts/employee.pm:3712-4328
/branches/1.3/scripts/employee.pl:3842-3843,4273-4287,4289-4310


Property changes on: trunk/LedgerSMB/Scripts/file.pm
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/1.3/LedgerSMB/Scripts/file.pm:3711-4325
/branches/1.3/scripts/file.pl:3711-4138
   + /branches/1.3/LedgerSMB/Scripts/file.pm:3711-4328
/branches/1.3/scripts/file.pl:3711-4138

Modified: trunk/LedgerSMB/Scripts/journal.pm
===================================================================
--- trunk/LedgerSMB/Scripts/journal.pm	2012-02-17 12:38:12 UTC (rev 4328)
+++ trunk/LedgerSMB/Scripts/journal.pm	2012-02-18 06:17:00 UTC (rev 4329)
@@ -47,15 +47,11 @@
     
     my $funcname = 'chart_list_search';
     my %results_hash;
-    foreach my $r (keys %{$request})
-    {
-       
-      if ($r =~ m/-ac-search$/)
-      {
-        my @call_args = ($request->{$r}, $request->{link_desc});
-        my @results = $request->call_procedure( procname => $funcname, args => ..hidden.., order_by => 'accno' );
-        foreach (@results) { $results_hash{$_->{'accno'}.'--'.$_->{'description'}} = $_->{'accno'}.'--'.$_->{'description'}; }
-      }
+    my $search_field = $request->{search_field};
+    $search_field =~ s/-/_/g;
+    my @call_args = ($request->{$search_field}, $request->{link_desc});
+    my @results = $request->call_procedure( procname => $funcname, args => ..hidden.., order_by => 'accno' );
+    foreach (@results) { $results_hash{$_->{'accno'}.'--'.$_->{'description'}} = $_->{'accno'}.'--'.$_->{'description'}; 
     }
     
     $request->{results} = \%results_hash;


Property changes on: trunk/LedgerSMB/Scripts/journal.pm
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/1.3/LedgerSMB/Scripts/journal.pm:4288-4325
/branches/1.3/scripts/journal.pl:4273-4287
   + /branches/1.3/LedgerSMB/Scripts/journal.pm:4288-4328
/branches/1.3/scripts/journal.pl:3711-4328


Property changes on: trunk/LedgerSMB/Scripts/login.pm
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/1.3/LedgerSMB/Scripts/login.pm:4193-4325
/branches/1.3/scripts/login.pl:3711-4192
   + /branches/1.3/LedgerSMB/Scripts/login.pm:4193-4328
/branches/1.3/scripts/login.pl:3711-4192


Property changes on: trunk/LedgerSMB/Scripts/menu.pm
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/1.3/LedgerSMB/Scripts/menu.pm:4155-4325
/branches/1.3/scripts/menu.pl:3711-4192,4273-4287
   + /branches/1.3/LedgerSMB/Scripts/menu.pm:4155-4328
/branches/1.3/scripts/menu.pl:3711-4192,4273-4287


Property changes on: trunk/LedgerSMB/Scripts/payment.pm
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/1.3/LedgerSMB/Scripts/payment.pm:4010-4325
/branches/1.3/scripts/payment.pl:3711-4310
   + /branches/1.3/LedgerSMB/Scripts/payment.pm:4010-4328
/branches/1.3/scripts/payment.pl:3711-4310


Property changes on: trunk/LedgerSMB/Scripts/recon.pm
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/1.3/LedgerSMB/Scripts/recon.pm:3711-4325
/branches/1.3/scripts/recon.pl:4194-4271,4273-4287
   + /branches/1.3/LedgerSMB/Scripts/recon.pm:3711-4328
/branches/1.3/scripts/recon.pl:4194-4271,4273-4287


Property changes on: trunk/LedgerSMB/Scripts/setup.pm
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/1.3/LedgerSMB/Scripts/setup.pm:3937-4325
/branches/1.3/scripts/setup.pl:3711-4216,4273-4287
   + /branches/1.3/LedgerSMB/Scripts/setup.pm:3937-4328
/branches/1.3/scripts/setup.pl:3711-4216,4273-4287


Property changes on: trunk/LedgerSMB/Scripts/taxform.pm
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/1.3/LedgerSMB/Scripts/taxform.pm:4193-4325
/branches/1.3/scripts/taxform.pl:3711-4192,4273-4287
   + /branches/1.3/LedgerSMB/Scripts/taxform.pm:4193-4328
/branches/1.3/scripts/taxform.pl:3711-4192,4273-4287


Property changes on: trunk/LedgerSMB/Scripts/vendor.pm
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/1.3/LedgerSMB/Scripts/vendor.pm:4288-4325
/branches/1.3/scripts/vendor.pl:4273-4287
   + /branches/1.3/LedgerSMB/Scripts/vendor.pm:4288-4328
/branches/1.3/scripts/vendor.pl:4273-4287

Modified: trunk/LedgerSMB/User.pm
===================================================================
--- trunk/LedgerSMB/User.pm	2012-02-17 12:38:12 UTC (rev 4328)
+++ trunk/LedgerSMB/User.pm	2012-02-18 06:17:00 UTC (rev 4329)
@@ -190,7 +190,6 @@
     $sth->execute();
     ($templates) = $sth->fetchrow_array() || 'demo';
     $myconfig->{templates} = "$LedgerSMB::Sysconfig::templates/$templates";
-    print STDERR "$myconfig->{templates}\n";
     return $myconfig;
 }
 

Modified: trunk/UI/ajax/helpers.js
===================================================================
--- trunk/UI/ajax/helpers.js	2012-02-17 12:38:12 UTC (rev 4328)
+++ trunk/UI/ajax/helpers.js	2012-02-18 06:17:00 UTC (rev 4329)
@@ -1,6 +1,6 @@
 function post_ajax_setter(text,li)
 {
-	hidden_field_to_update = text.id.substring(0,text.id.length-10);
+	hidden_field_to_update = text.id;
 	$(hidden_field_to_update).value = li.id;
 	text.blur();
 }

Modified: trunk/UI/lib/elements.html
===================================================================
--- trunk/UI/lib/elements.html	2012-02-17 12:38:12 UTC (rev 4328)
+++ trunk/UI/lib/elements.html	2012-02-18 06:17:00 UTC (rev 4329)
@@ -123,37 +123,34 @@
 	    custom_attribute_data=element_data.attributes 
 	  ?>
 	  <?lsmb PROCESS auto_label  # Process element label. ?>
-	  <input type="text" class="autocomplete" size="60" value="<?lsmb element_data.initial_value ?>" id="<?lsmb attribute_data.id ?>-ac-search" name="<?lsmb attribute_data.id ?>-ac-search" onclick="this.value='';" onblur="this.value = $('<?lsmb attribute_data.id ?>').value" />
-	  <input type="hidden" id="<?lsmb attribute_data.id ?>" name="<?lsmb element_data.name ?>"  value="<?lsmb element_data.initial_value?>" />
+	  <input type="text" 
+                class="autocomplete ajaxselect" 
+                 size="60" 
+                value="<?lsmb element_data.initial_value ?>" 
+                   id="<?lsmb attribute_data.id ?>" 
+                 name="<?lsmb element_data.name ?>" 
+              onclick="this.value='';" 
+          />
+	  <input type="hidden" 
+                   id="<?lsmb attribute_data.id ?>" 
+                 name="<?lsmb element_data.name ?>-old"  
+                value="<?lsmb element_data.initial_value?>" 
+          />
 	  <span class="indicator" id="<?lsmb attribute_data.id ?>-ac-indicator" style="display: none">Working...</span>
 	  <div id="<?lsmb attribute_data.id ?>-ac-choices" class="autocomplete"></div>
 	  <script language="javascript" type="text/javascript"><!--
-	    function post_ajax_setter(text,li)
-	    {
-	      hidden_field_to_update = text.id.substring(0,text.id.length-10);
-	      $(hidden_field_to_update).value = li.id;
-	      text.blur();
-	    }
-	    new Ajax.Autocompleter('<?lsmb attribute_data.id ?>-ac-search', 
+	    new Ajax.Autocompleter('<?lsmb attribute_data.id ?>', 
                                    '<?lsmb attribute_data.id ?>-ac-choices', 
                                    '<?lsmb element_data.ajax_target ?>', 
                                    {"afterUpdateElement":post_ajax_setter,
-                                   <?lsmb IF attribute_data.params ?>
-                                   'parameters' : <?lsmb SET params=""; FOR k
+                                   'parameters' : 
+                                                <?lsmb SET params="search_field=" _ attribute_data.id; 
+                                               FOR k
                                                IN attribute_data.params.keys();
-                                                IF params == "";
-                                                    params = "$k=" _ attribute_data.params.$k;
-                                                ELSE;
-                                                    params = params _ "&$k=" _ attribute_data.params.$k;
-                                                END;
-                                                
+                                                  params = params _ "&$k=" _ attribute_data.params.$k;
                                                END;
-                                               #"<?lsmb k >" : <?lsmb
-                                               #   attribute_data.params.$k
-                                               #->
                                                ?>
                                                <?lsmb '"' _ params _ '"'?>
-                                               <?lsmb END -?>
                                                
                                    })
 	  //--></script>

Modified: trunk/bin/gl.pl
===================================================================
--- trunk/bin/gl.pl	2012-02-17 12:38:12 UTC (rev 4328)
+++ trunk/bin/gl.pl	2012-02-18 06:17:00 UTC (rev 4329)
@@ -1053,6 +1053,7 @@
          $form->{oldtransdate} = $form->{transdate};
      }
 
+    GL->get_all_acc_dep_pro( \%myconfig, \%$form );
     @a     = ();
     $count = 0;
     @flds  = qw(accno debit credit projectnumber fx_transaction source memo);
@@ -1061,6 +1062,19 @@
         unless ( ( $form->{"debit_$i"} eq "" )
             && ( $form->{"credit_$i"} eq "" ) )
         {
+            my $found_acc = 0;
+            for my $acc(@{ $form->{all_accno} }){
+                if ($form->{"accno_$i"} eq $acc->{accstyle}){
+                    $found_acc = 1;
+                } elsif ($form->{"accno_$i"} eq $acc->{accno}){
+                    $form->{"accno_$i"} = $acc->{accstyle};
+                    $found_acc = 1;
+                }
+
+           }
+           if (not $found_acc){
+               $form->error($locale->text('Account [_1] not found.', $form->{"accno_$i"}));
+           }
             for (qw(debit credit)) {
                 $form->{"${_}_$i"} =
                   $form->parse_amount( \%myconfig, $form->{"${_}_$i"} );
@@ -1085,7 +1099,6 @@
 
     $form->{rowcount} = $count;
  
-    GL->get_all_acc_dep_pro( \%myconfig, \%$form );
     
     
     &display_form;


Property changes on: trunk/sql/upgrade/1.2-1.3-manual.sql
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/1.3/sql/upgrade/1.2-1.3-manual.sql:3712-4325
/branches/1.3/sql/upgrade/1.2-1.3.sql:3711-3851
/trunk/sql/upgrade/1.2-1.3.sql:858-3710
   + /branches/1.3/sql/upgrade/1.2-1.3-manual.sql:3712-4328
/branches/1.3/sql/upgrade/1.2-1.3.sql:3711-3851
/trunk/sql/upgrade/1.2-1.3.sql:858-3710

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