Add criteria to warranty raffle filter. #720
This commit is contained in:
parent
907bee0d70
commit
bec964ffa4
2 changed files with 26 additions and 2 deletions
|
|
@ -1260,7 +1260,8 @@ class ReportController extends Controller
|
|||
foreach ($wr_data as $wr_entry)
|
||||
{
|
||||
$valid = $wr_filter->isValidRaffleEntry($wr_entry);
|
||||
$filtered_data[] = $wr_entry;
|
||||
if ($valid)
|
||||
$filtered_data[] = $wr_entry;
|
||||
}
|
||||
|
||||
$resp = new StreamedResponse();
|
||||
|
|
|
|||
|
|
@ -2,12 +2,35 @@
|
|||
|
||||
namespace App\Service;
|
||||
|
||||
use App\Ramcar\WarrantyClass;
|
||||
|
||||
class WarrantyRaffleFilter
|
||||
{
|
||||
public function isValidRaffleEntry($entry)
|
||||
{
|
||||
// entry is an associative array
|
||||
// error_log('entry ' . $entry['first_name']);
|
||||
// Serial Number of Battery (NOT blank)
|
||||
if (empty($entry['serial']))
|
||||
return false;
|
||||
|
||||
// Plate Number (NOT blank)
|
||||
if (empty($entry['plate_number']))
|
||||
return false;
|
||||
|
||||
// Warranty Class (ONLY private)
|
||||
if ($entry['warranty_class'] != WarrantyClass::WTY_PRIVATE)
|
||||
return false;
|
||||
|
||||
// either contact number of mobile number is present
|
||||
if ((empty($entry['contact_number'])) &&
|
||||
(empty($entry['mobile_number'])))
|
||||
return false;
|
||||
|
||||
// First Name & Last Name have to be present
|
||||
if ((empty($entry['first_name'])) ||
|
||||
(empty($entry['last_name'])))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue