Skip to content

Instantly share code, notes, and snippets.

@zsan
Created January 5, 2015 07:54
Show Gist options
  • Save zsan/b336be2f785311fd5ab2 to your computer and use it in GitHub Desktop.
Save zsan/b336be2f785311fd5ab2 to your computer and use it in GitHub Desktop.
for my $key(@$buss_names) {
my $org_name = $key->{organisationName}[0];
my $eff_date = $key->{effectiveFrom}[0];
# if matched
if ($eff_date eq $today or $eff_date eq $yesterday) {
# where should i put effective_date ($eff_date) ?
my $rs_final = $final_table->search(
{ abn => $abn, business_name => $org_name },
{ rows => 1 })->single;
$hash{abn} = $abn;
$hash{business_name} = $org_name;
$hash{record_last_updated_date} = $res_hash->{recordLastUpdatedDate}[0];
$hash{is_current_indicator} = $res_hash->{ABN}[0]{isCurrentIndicator}[0];
$hash{entity_status_code} = $res_hash->{entityStatus}[0]{entityStatusCode}[0];
$hash{status_effective_from} = $res_hash->{entityStatus}[0]{effectiveFrom}[0];
$hash{entity_type_code} = $res_hash->{entityType}[0]{entityTypeCode}[0];
$hash{entity_description} = $res_hash->{entityType}[0]{entityDescription}[0];
$hash{organisation_name} = $res_hash->{mainName}[0]{organisationName}[0];
$hash{mtn_effective_from} = $res_hash->{mainTradingName}[0]{effectiveFrom}[0];
$hash{postcode} = $res_hash->{mainBusinessPhysicalAddress}[0]{postcode}[0];
$hash{gas_tax_effective_from} = $res_hash->{goodsAndServicesTax}[0]{effectiveFrom}[0];
$hash{given_name} = $res_hash->{legalName}[0]{givenName}[0];
$hash{family_name} = $res_hash->{legalName}[0]{familyName}[0];
if ($rs_final) {
$rs_final->update(\%hash);
$updated_counter++;
} else {
$final_table->create(\%hash);
$row->new_business('true');
$created_counter++;
}
last;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment