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

SF.net SVN: ledger-smb:[6498] trunk/LedgerSMB



Revision: 6498
          http://sourceforge.net/p/ledger-smb/code/6498
Author:   einhverfr
Date:     2014-01-17 07:58:33 +0000 (Fri, 17 Jan 2014)
Log Message:
-----------
Fixing bug 921, can't delete address

Modified Paths:
--------------
    trunk/LedgerSMB/Entity/Location.pm
    trunk/LedgerSMB/Scripts/contact.pm

Modified: trunk/LedgerSMB/Entity/Location.pm
===================================================================
--- trunk/LedgerSMB/Entity/Location.pm	2014-01-17 07:46:16 UTC (rev 6497)
+++ trunk/LedgerSMB/Entity/Location.pm	2014-01-17 07:58:33 UTC (rev 6498)
@@ -257,14 +257,21 @@
 =cut
 
 sub delete{
-    my ($self) = @_;
+    my ($ref) = @_;
     my $procname;
-    if ($self->credit_id){
+    my $args;
+    if ($ref->{credit_id}){
         $procname = 'eca__delete_location';
+        $args = [
+           $ref->{credit_id}, $ref->{location_id}, $ref->{location_class}
+        ];
     } else {
         $procname = 'entity__delete_location';
+        $args = [
+           $ref->{entity_id}, $ref->{location_id}, $ref->{location_class}
+        ];
     }
-    $self->exec_method({funcname => $procname});
+    __PACKAGE__->call_procedure(procname => $procname, args => $args );
 }
 
 =back

Modified: trunk/LedgerSMB/Scripts/contact.pm
===================================================================
--- trunk/LedgerSMB/Scripts/contact.pm	2014-01-17 07:46:16 UTC (rev 6497)
+++ trunk/LedgerSMB/Scripts/contact.pm	2014-01-17 07:58:33 UTC (rev 6498)
@@ -600,12 +600,7 @@
 
 sub delete_location {
     my ($request) = @_;
-    my $location = LedgerSMB::Entity::Location->new(%$request);
-    $location->id($request->{location_id});
-    if (!$request->{is_for_credit}){
-       $location->credit_id(undef);
-    }
-    $location->delete;
+    LedgerSMB::Entity::Location::delete($request);
     $request->{target_div} = 'address_div';
     get($request);
 }

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


------------------------------------------------------------------------------
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today. 
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
_______________________________________________
Ledger-smb-commits mailing list
..hidden..
https://lists.sourceforge.net/lists/listinfo/ledger-smb-commits