| @@ 215-228 (lines=14) @@ | ||
| 212 | * @throws InvalidInterfaceException | |
| 213 | * @throws ReflectionException | |
| 214 | */ | |
| 215 | public static function increment_quantity(EE_Line_Item $line_item, $qty = 1) | |
| 216 |     { | |
| 217 |         if (! $line_item->is_percent()) { | |
| 218 | $qty += $line_item->quantity(); | |
| 219 | $line_item->set_quantity($qty); | |
| 220 | $line_item->set_total($line_item->unit_price() * $qty); | |
| 221 | $line_item->save(); | |
| 222 | } | |
| 223 |         foreach ($line_item->children() as $child) { | |
| 224 |             if ($child->is_sub_line_item()) { | |
| 225 | EEH_Line_Item::update_quantity($child, $qty); | |
| 226 | } | |
| 227 | } | |
| 228 | } | |
| 229 | ||
| 230 | ||
| 231 | /** | |
| @@ 273-285 (lines=13) @@ | ||
| 270 | * @throws InvalidInterfaceException | |
| 271 | * @throws ReflectionException | |
| 272 | */ | |
| 273 | public static function update_quantity(EE_Line_Item $line_item, $new_quantity) | |
| 274 |     { | |
| 275 |         if (! $line_item->is_percent()) { | |
| 276 | $line_item->set_quantity($new_quantity); | |
| 277 | $line_item->set_total($line_item->unit_price() * $new_quantity); | |
| 278 | $line_item->save(); | |
| 279 | } | |
| 280 |         foreach ($line_item->children() as $child) { | |
| 281 |             if ($child->is_sub_line_item()) { | |
| 282 | EEH_Line_Item::update_quantity($child, $new_quantity); | |
| 283 | } | |
| 284 | } | |
| 285 | } | |
| 286 | ||
| 287 | ||
| 288 | /** | |