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

SF.net SVN: ledger-smb:[6273] addons/1.3/wxPOS/WXPOS



Revision: 6273
          http://sourceforge.net/p/ledger-smb/code/6273
Author:   einhverfr
Date:     2013-11-09 08:58:09 +0000 (Sat, 09 Nov 2013)
Log Message:
-----------
Closer yet to posting

Modified Paths:
--------------
    addons/1.3/wxPOS/WXPOS/Invoice.pm
    addons/1.3/wxPOS/WXPOS/UI/AR/Pay.pm

Modified: addons/1.3/wxPOS/WXPOS/Invoice.pm
===================================================================
--- addons/1.3/wxPOS/WXPOS/Invoice.pm	2013-11-09 08:39:01 UTC (rev 6272)
+++ addons/1.3/wxPOS/WXPOS/Invoice.pm	2013-11-09 08:58:09 UTC (rev 6273)
@@ -122,7 +122,7 @@
 sub _isa_payments {
     my ($payments) = @_;
     foreach my $pmt (@$payments){
-        for my $key (qw(amount source memo)){
+        for my $key (qw(amount memo)){
             croak "payment missing key $key" unless $pmt->{$key};
         }
     }
@@ -229,7 +229,7 @@
     } 
 
     $dbh->begin_work;
-    my ($ref) = $self->call_dbmethod(funcname => "begin_$sfx");
+    my ($ref) = $self->call_dbmethod(funcname => "start_$sfx");
     my ($id) = values (%$ref);
     $self->id($id);
     foreach my $line (@{$self->invoice_lines}){

Modified: addons/1.3/wxPOS/WXPOS/UI/AR/Pay.pm
===================================================================
--- addons/1.3/wxPOS/WXPOS/UI/AR/Pay.pm	2013-11-09 08:39:01 UTC (rev 6272)
+++ addons/1.3/wxPOS/WXPOS/UI/AR/Pay.pm	2013-11-09 08:58:09 UTC (rev 6273)
@@ -1,12 +1,14 @@
 
 package WXPOS::UI::AR::Pay;
-use Wx qw(wxDefaultPosition wxDefaultSize wxOK wxCENTRE wxTE_PASSWORD 
+use Wx qw(wxDefaultPosition wxDefaultSize wxOK wxCENTRE wxICON_ERROR wxTE_PASSWORD 
           wxCLOSE_BOX wxBITMAP_TYPE_PNG wxCB_READONLY wxLC_REPORT
           wxALIGN_RIGHT :sizer);
 use base qw(Wx::Dialog);
 use Wx::Event qw(EVT_BUTTON EVT_LIST_ITEM_SELECTED EVT_LIST_ITEM_DESELECTED);
 use WXPOS::Sysconfig;
 use WXPOS::Invoice;
+use Try::Tiny;
+use Carp;
 use strict;
 use warnings;
 
@@ -134,7 +136,15 @@
 sub _Post {
     my ($self) = @_;
     my $invoice = WXPOS::Invoice->from_UI($self, 2);
-    $invoice->post;
+    try {
+      $invoice->post;
+    } catch {
+      Wx::MessageBox("Something went wrong.  Please try again",
+                   "More information has been logged on this error",
+                    wxOK|wxCENTRE|wxICON_ERROR, $self->{tab});
+      Carp::cluck();
+      return undef;
+    }
     $invoice->print(); # TODO
 }
 
@@ -155,16 +165,17 @@
 sub get_lines {
     my ($self) = @_;
     my $lines = [];
-    my $list = $self->{parent_window}->list;
+    my $list = $self->{parent_window}->{list};
     my $item = -1;
 
-    while ($item = $list->GetNextItem($item)){
+    while (($item = $list->GetNextItem($item)) > -1){
         my $line = {};
-        $line->{partnumber} = $list->GetItemData($item, 0)->GetText(); 
-        $line->{sellprice} = $list->GetItemData($item, 2)->GetText();
-        $line->{qty} =  $list->GetItemData($item, 6)->GetText();
+        $line->{partnumber} = $list->GetItem($item, 0)->GetText(); 
+        $line->{sellprice} = $list->GetItem($item, 2)->GetText();
+        $line->{qty} =  $list->GetItem($item, 6)->GetText();
         push @$lines, $line;
     }
+    
     return $lines; 
 }
 

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


------------------------------------------------------------------------------
November Webinars for C, C++, Fortran Developers
Accelerate application performance with scalable programming models. Explore
techniques for threading, error checking, porting, and tuning. Get the most 
from the latest Intel processors and coprocessors. See abstracts and register
http://pubads.g.doubleclick.net/gampad/clk?id=60136231&iu=/4140/ostg.clktrk
_______________________________________________
Ledger-smb-commits mailing list
..hidden..
https://lists.sourceforge.net/lists/listinfo/ledger-smb-commits