| @@ 1294-1312 (lines=19) @@ | ||
| 1291 | * @throws InvalidDataTypeException | |
| 1292 | * @throws EE_Error | |
| 1293 | */ | |
| 1294 | public function update_sold() | |
| 1295 |     { | |
| 1296 | $count_regs_for_this_datetime = EEM_Registration::instance()->count( | |
| 1297 | array( | |
| 1298 | array( | |
| 1299 | 'STS_ID' => EEM_Registration::status_id_approved, | |
| 1300 | 'REG_deleted' => 0, | |
| 1301 | 'Ticket.Datetime.DTT_ID' => $this->ID(), | |
| 1302 | ), | |
| 1303 | ) | |
| 1304 | ); | |
| 1305 | $sold = $this->sold(); | |
| 1306 |         if ($count_regs_for_this_datetime > $sold) { | |
| 1307 | $this->increaseSold($count_regs_for_this_datetime - $sold); | |
| 1308 |         } elseif ($count_regs_for_this_datetime < $sold) { | |
| 1309 | $this->decreaseSold($count_regs_for_this_datetime - $sold); | |
| 1310 | } | |
| 1311 | return $count_regs_for_this_datetime; | |
| 1312 | } | |
| 1313 | ||
| 1314 | ||
| 1315 | /******************************************************************* | |
| @@ 1424-1441 (lines=18) @@ | ||
| 1421 | * @return int | |
| 1422 | * @throws EE_Error | |
| 1423 | */ | |
| 1424 | public function update_tickets_sold() | |
| 1425 |     { | |
| 1426 | $count_regs_for_this_ticket = $this->count_registrations( | |
| 1427 | array( | |
| 1428 | array( | |
| 1429 | 'STS_ID' => EEM_Registration::status_id_approved, | |
| 1430 | 'REG_deleted' => 0, | |
| 1431 | ), | |
| 1432 | ) | |
| 1433 | ); | |
| 1434 | $sold = $this->sold(); | |
| 1435 |         if ($count_regs_for_this_ticket > $sold) { | |
| 1436 | $this->increaseSold($count_regs_for_this_ticket - $sold); | |
| 1437 |         } elseif ($count_regs_for_this_ticket < $sold) { | |
| 1438 | $this->decreaseSold($count_regs_for_this_ticket - $sold); | |
| 1439 | } | |
| 1440 | return $count_regs_for_this_ticket; | |
| 1441 | } | |
| 1442 | ||
| 1443 | ||
| 1444 | /** | |