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

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



Revision: 5942
          http://sourceforge.net/p/ledger-smb/code/5942
Author:   ehuelsmann
Date:     2013-08-08 20:36:35 +0000 (Thu, 08 Aug 2013)
Log Message:
-----------
Fix deletion of price matrix entries in the ECA screen.

Modified Paths:
--------------
    trunk/LedgerSMB/DBObject/Pricelist.pm
    trunk/LedgerSMB/Scripts/contact.pm
    trunk/UI/Contact/pricelist.html
    trunk/sql/modules/Company.sql
    trunk/sql/modules/Fixes.sql

Modified: trunk/LedgerSMB/DBObject/Pricelist.pm
===================================================================
--- trunk/LedgerSMB/DBObject/Pricelist.pm	2013-08-08 11:57:33 UTC (rev 5941)
+++ trunk/LedgerSMB/DBObject/Pricelist.pm	2013-08-08 20:36:35 UTC (rev 5942)
@@ -58,6 +58,28 @@
 
 =back
 
+=over
+
+=item delete(entry_id);
+
+Deletes the referred pricelist entry.
+
+=cut
+
+sub delete {
+    my ($self, $entry_id) = @_;
+
+    my $line = __PACKAGE__->new({base => $self,
+                                 merge => ['credit_id', 'entry_id'] }
+        );
+    $line->exec_method({funcname => 'pricelist__delete'});
+}
+
+
+
+=back
+
+
 =head1 COPYRIGHT
 
 Copyright (C) 2012 The LedgerSMB Core Team.  This file may be re-used under the

Modified: trunk/LedgerSMB/Scripts/contact.pm
===================================================================
--- trunk/LedgerSMB/Scripts/contact.pm	2013-08-08 11:57:33 UTC (rev 5941)
+++ trunk/LedgerSMB/Scripts/contact.pm	2013-08-08 20:36:35 UTC (rev 5942)
@@ -785,7 +785,23 @@
 
 
 =back
+=item delete_pricelist
 
+=cut
+
+sub delete_pricelist {
+    my ($request) = @_;
+
+    use LedgerSMB::DBObject::Pricelist;
+    my $pricelist = LedgerSMB::DBObject::Pricelist->new({base => $request});
+
+    $pricelist->delete;
+
+    # Return to UI
+    get_pricelist($request);
+}
+
+
 =head1 COPYRIGHT
 
 Copyright (c) 2012, the LedgerSMB Core Team.  This is licensed under the GNU 

Modified: trunk/UI/Contact/pricelist.html
===================================================================
--- trunk/UI/Contact/pricelist.html	2013-08-08 11:57:33 UTC (rev 5941)
+++ trunk/UI/Contact/pricelist.html	2013-08-08 20:36:35 UTC (rev 5942)
@@ -58,7 +58,7 @@
                   {col_id = 'delete',
                      name = ' ',
                      type = 'href',
-                href_base = script _ '?action=delete_pricematrix&credit_id=' 
+                href_base = script _ '?action=delete_pricelist&credit_id=' 
                             _ id _ '&entry_id=' }
      );
      FOREACH pm IN pricematrix;

Modified: trunk/sql/modules/Company.sql
===================================================================
--- trunk/sql/modules/Company.sql	2013-08-08 11:57:33 UTC (rev 5941)
+++ trunk/sql/modules/Company.sql	2013-08-08 20:36:35 UTC (rev 5942)
@@ -1687,7 +1687,7 @@
 END;
 $$ LANGUAGE PLPGSQL;
 
-CREATE OR REPLACE FUNCTION pricelist__delete(entry_id int, credit_id int)
+CREATE OR REPLACE FUNCTION pricelist__delete(in_entry_id int, in_credit_id int)
 returns bool as
 $$
 delete from partscustomer where entry_id = $1 and credit_id = $2;

Modified: trunk/sql/modules/Fixes.sql
===================================================================
--- trunk/sql/modules/Fixes.sql	2013-08-08 11:57:33 UTC (rev 5941)
+++ trunk/sql/modules/Fixes.sql	2013-08-08 20:36:35 UTC (rev 5942)
@@ -190,3 +190,6 @@
 add foreign key (entry_id) references orderitems(id) on delete cascade;
 
 COMMIT;
+
+-- Required for parameter rename
+DROP FUNCTION pricelist__delete(int,int);

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