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

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



Revision: 6737
          http://sourceforge.net/p/ledger-smb/code/6737
Author:   einhverfr
Date:     2014-02-04 07:42:21 +0000 (Tue, 04 Feb 2014)
Log Message:
-----------
deleting from pricematrix now works, closing bug 893

Modified Paths:
--------------
    branches/1.3/LedgerSMB/DBObject/Company.pm
    branches/1.3/LedgerSMB/DBObject/Pricelist.pm
    branches/1.3/LedgerSMB/DBObject.pm
    branches/1.3/LedgerSMB/ScriptLib/Company.pm
    branches/1.3/UI/Contact/pricelist.html

Modified: branches/1.3/LedgerSMB/DBObject/Company.pm
===================================================================
--- branches/1.3/LedgerSMB/DBObject/Company.pm	2014-02-04 05:08:38 UTC (rev 6736)
+++ branches/1.3/LedgerSMB/DBObject/Company.pm	2014-02-04 07:42:21 UTC (rev 6737)
@@ -720,7 +720,7 @@
     @{$self->{pricematrix}} = $self->exec_method(
                funcname => 'eca__get_pricematrix'
     );
-    if ($self->{account_class} == 1){
+    if ($self->{account_class} == 2){
         @{$self->{pricematrix_pricegroup}}= $self->exec_method(
                funcname => 'eca__get_pricematrix_by_pricegroup'
         );

Modified: branches/1.3/LedgerSMB/DBObject/Pricelist.pm
===================================================================
--- branches/1.3/LedgerSMB/DBObject/Pricelist.pm	2014-02-04 05:08:38 UTC (rev 6736)
+++ branches/1.3/LedgerSMB/DBObject/Pricelist.pm	2014-02-04 07:42:21 UTC (rev 6737)
@@ -56,6 +56,17 @@
     $self->{dbh}->commit;
 }
 
+=item delete
+
+Deletes the pricelist entry. Requires credit_id and entry_id to be set.
+
+=cut
+
+sub delete {
+    my ($self) = @_;
+    $self->exec_method({funcname => 'pricelist__delete'});
+}
+
 =back
 
 =head1 COPYRIGHT

Modified: branches/1.3/LedgerSMB/DBObject.pm
===================================================================
--- branches/1.3/LedgerSMB/DBObject.pm	2014-02-04 05:08:38 UTC (rev 6736)
+++ branches/1.3/LedgerSMB/DBObject.pm	2014-02-04 07:42:21 UTC (rev 6737)
@@ -147,18 +147,17 @@
         if (@proc_args) {
             for my $arg (@proc_args) {
                 #print STDERR "User Provided Args: $arg\n";
-                if ( $arg =~ s/^in_// ) {
-                     if ( defined $self->{$arg} )
-                     {
-                        $logger->debug("exec_method pushing $arg = $self->{$arg}");
-                     }
-                     else
-                     {
-                        $logger->debug("exec_method pushing \$arg defined $arg | \$self->{\$arg} is undefined");
-                        #$self->{$arg} = undef; # Why was this being unset? --CT
-                     }
-                     push ( @call_args, $self->{$arg} );
-                }
+                $arg =~ s/^in_//;
+                 if ( defined $self->{$arg} )
+                 {
+                    $logger->debug("exec_method pushing $arg = $self->{$arg}");
+                 }
+                 else
+                 {
+                    $logger->debug("exec_method pushing \$arg defined $arg | \$self->{\$arg} is undefined");
+                    #$self->{$arg} = undef; # Why was this being unset? --CT
+                 }
+                 push ( @call_args, $self->{$arg} );
             }
         }
         for (@in_args) { push @call_args, $_ } ;

Modified: branches/1.3/LedgerSMB/ScriptLib/Company.pm
===================================================================
--- branches/1.3/LedgerSMB/ScriptLib/Company.pm	2014-02-04 05:08:38 UTC (rev 6736)
+++ branches/1.3/LedgerSMB/ScriptLib/Company.pm	2014-02-04 07:42:21 UTC (rev 6737)
@@ -1110,7 +1110,23 @@
     $psearch->render($request);
 }
 
+=item delete_pricematrix
 
+Delets an item from the pricelist, based on entry_id and credit_id, both of
+which must be provided
+
+=cut
+
+sub delete_pricematrix {
+    my ($request) = @_;
+    my $pricelist = LedgerSMB::DBObject::Pricelist->new({base => $request});
+    $pricelist->delete;
+    $request->{dbh}->commit;
+    $request->{search_redirect} = 'pricelist_search_handle';
+    pricelist($request);
+}
+
+
 =item pricelist_search_handle
 
 Handles the return from the parts search from the pricelist screen.

Modified: branches/1.3/UI/Contact/pricelist.html
===================================================================
--- branches/1.3/UI/Contact/pricelist.html	2014-02-04 05:08:38 UTC (rev 6736)
+++ branches/1.3/UI/Contact/pricelist.html	2014-02-04 07:42:21 UTC (rev 6737)
@@ -59,7 +59,8 @@
                      name = ' ',
                      type = 'href',
                 href_base = script _ '?action=delete_pricematrix&credit_id=' 
-                            _ id _ '&entry_id=' }
+                            _ credit_id _ '&entity_class=' _ entity_class 
+                            _ '&entity_id=' _ entity_id _ '&entry_id=' }
      );
      FOREACH pm IN pricematrix;
          pm.delete = '[' _ text('Delete') _ ']';

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


------------------------------------------------------------------------------
Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121051231&iu=/4140/ostg.clktrk
_______________________________________________
Ledger-smb-commits mailing list
..hidden..
https://lists.sourceforge.net/lists/listinfo/ledger-smb-commits