Browse Source

[ofd] skip empty strings

Innocenty Enikeew 6 năm trước cách đây
mục cha
commit
ff12e29dd6
1 tập tin đã thay đổi với 7 bổ sung3 xóa
  1. 7 3
      plugins/ofd.lisp

+ 7 - 3
plugins/ofd.lisp

@@ -87,14 +87,18 @@
   (declare (ignorable user address))
   *default-asset-account*)
 
+(defun not-empty (str)
+  (unless (string= str "")
+    str))
+
 (defun cheque->entry (c)
   (let ((total-sum (agets c "totalSum"))
         (date (local-time:timestamp-to-universal
                (local-time:parse-timestring (agets c "dateTime") )))
-        (user (or (agets c "retailPlace")
-                  (agets c "user")
+        (user (or (not-empty (agets c "retailPlace"))
+                  (not-empty (agets c "user"))
                   (format nil "ИНН ~A" (agets c "userInn"))))
-        (address (agets c "retailPlaceAddress"))
+        (address (not-empty (agets c "retailPlaceAddress")))
         (items (agets c "items")))
     (pta-ledger:make-entry
      :date date