File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -110,11 +110,13 @@ public function send($invoice = NULL) {
110110
111111 $ body = [];
112112 if (!empty ($ this ->contact )) {
113- if (empty ($ this ->contact ->email ))
113+ if (empty ($ this ->contact ->email )) {
114114 throw new Exception ("Contact has no email address! " );
115+ }
115116
116- if (empty ($ this ->contact ->delivery_method ))
117+ if (empty ($ this ->contact ->delivery_method )) {
117118 throw new Exception ("Contact has no delivery method! " );
119+ }
118120
119121 $ body [ "email_address " ] = $ this ->contact ->email ;
120122 $ body [ "delivery_method " ] = $ this ->contact ->delivery_method ;
@@ -129,7 +131,14 @@ public function send($invoice = NULL) {
129131 $ body [ "email_message " ] = $ this ->emailMessage ;
130132 }
131133
132- return $ this ->restUpdate ($ this ->getResourcePath (), "send_invoice " , [ "sales_invoice_sending " => $ body ]);
134+ if (count ($ body ) > 0 ) {
135+ $ body = [ "sales_invoice_sending " => $ body ];
136+
137+ } else {
138+ $ body = NULL ;
139+ }
140+
141+ return $ this ->restUpdate ($ this ->getResourcePath (), "send_invoice " , $ body );
133142 }
134143
135144 /**
You can’t perform that action at this time.
0 commit comments