@@ 182-194 (lines=13) @@ | ||
179 | * @return void |
|
180 | * @throws \EE_Error |
|
181 | */ |
|
182 | public static function increment_quantity( EE_Line_Item $line_item, $qty = 1 ) { |
|
183 | if( ! $line_item->is_percent() ) { |
|
184 | $qty += $line_item->quantity(); |
|
185 | $line_item->set_quantity( $qty ); |
|
186 | $line_item->set_total( $line_item->unit_price() * $qty ); |
|
187 | $line_item->save(); |
|
188 | } |
|
189 | foreach( $line_item->children() as $child ) { |
|
190 | if( $child->is_sub_line_item() ) { |
|
191 | EEH_Line_Item::update_quantity( $child, $qty ); |
|
192 | } |
|
193 | } |
|
194 | } |
|
195 | ||
196 | ||
197 | ||
@@ 232-243 (lines=12) @@ | ||
229 | * @param int $new_quantity |
|
230 | * @throws \EE_Error |
|
231 | */ |
|
232 | public static function update_quantity( EE_Line_Item $line_item, $new_quantity ) { |
|
233 | if( ! $line_item->is_percent() ) { |
|
234 | $line_item->set_quantity( $new_quantity ); |
|
235 | $line_item->set_total( $line_item->unit_price() * $new_quantity ); |
|
236 | $line_item->save(); |
|
237 | } |
|
238 | foreach( $line_item->children() as $child ) { |
|
239 | if( $child->is_sub_line_item() ) { |
|
240 | EEH_Line_Item::update_quantity( $child, $new_quantity ); |
|
241 | } |
|
242 | } |
|
243 | } |
|
244 | ||
245 | ||
246 |