| @@ -161,9 +161,9 @@ | ||
| 161 | 161 | $items = $this->findByInvoice($invoice_id); |
| 162 | 162 | $total = 0; |
| 163 | 163 | |
| 164 | 164 | foreach ($items as $item) { |
| 165 | - $quantity = isset($item['quantity']) ? floatval($item['quantity']) : 1; | |
| 165 | + $quantity = isset($item['quantity']) ? floatval($item['quantity']) : 0; | |
| 166 | 166 | $price = isset($item['price']) ? floatval($item['price']) : 0; |
| 167 | 167 | $total += $quantity * $price; |
| 168 | 168 | } |
| 169 | 169 | |
| @@ -191,9 +191,9 @@ | ||
| 191 | 191 | protected function sanitizeItemData($data) { |
| 192 | 192 | return [ |
| 193 | 193 | 'name' => isset($data['name']) ? sanitize_text_field($data['name']) : '', |
| 194 | 194 | 'description' => isset($data['description']) ? sanitize_textarea_field($data['description']) : '', |
| 195 | - 'quantity' => isset($data['quantity']) ? floatval($data['quantity']) : 1, | |
| 195 | + 'quantity' => isset($data['quantity']) ? floatval($data['quantity']) : 0, | |
| 196 | 196 | 'price' => isset($data['price']) ? floatval($data['price']) : 0, |
| 197 | 197 | 'tax_rate' => isset($data['tax_rate']) ? floatval($data['tax_rate']) : 0, |
| 198 | 198 | 'taxable' => isset($data['taxable']) ? (string) $data['taxable'] : '0', |
| 199 | 199 | 'discount' => isset($data['discount']) ? floatval($data['discount']) : 0, |