Skip to content

Commit

Permalink
Merge pull request #1127 from cultuurnet/PPF-468-nullable-website
Browse files Browse the repository at this point in the history
PPF-468 Support nullable website
  • Loading branch information
LucWollants authored May 22, 2024
2 parents 46caa3b + 4ceb51f commit 05ead5f
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 11 deletions.
4 changes: 2 additions & 2 deletions app/Insightly/Serializers/CustomFields/WebsiteSerializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ final class WebsiteSerializer
{
public const CUSTOM_FIELD_WEBSITE = 'URL_agenda__c';

public function toInsightlyArray(Website $website): array
public function toInsightlyArray(?Website $website): array
{
return [
'FIELD_NAME' => self::CUSTOM_FIELD_WEBSITE,
'CUSTOM_FIELD_ID' => self::CUSTOM_FIELD_WEBSITE,
'FIELD_VALUE' => $website->value,
'FIELD_VALUE' => $website ? $website->value : '-',
];
}
}
5 changes: 1 addition & 4 deletions app/Insightly/Serializers/OpportunitySerializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,10 @@ public function toInsightlyArray(Integration $integration): array
'STAGE_ID' => $this->pipelines->getOpportunityStageId(OpportunityStage::TEST),
'CUSTOMFIELDS' => [
(new IntegrationTypeSerializer())->toInsightlyArray($integration->type),
(new WebsiteSerializer())->toInsightlyArray($integration->website()),
],
];

if ($integration->website()) {
$insightlyArray['CUSTOMFIELDS'][] = (new WebsiteSerializer())->toInsightlyArray($integration->website());
}

return $insightlyArray;
}

Expand Down
5 changes: 1 addition & 4 deletions app/Insightly/Serializers/ProjectSerializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,10 @@ public function toInsightlyArray(Integration $integration): array
'STAGE_ID' => $this->pipelines->getProjectStageId(ProjectStage::TEST),
'CUSTOMFIELDS' => [
(new IntegrationTypeSerializer())->toInsightlyArray($integration->type),
(new WebsiteSerializer())->toInsightlyArray($integration->website()),
],
];

if ($integration->website()) {
$insightlyArray['CUSTOMFIELDS'][] = (new WebsiteSerializer())->toInsightlyArray($integration->website());
}

return $insightlyArray;
}

Expand Down
2 changes: 1 addition & 1 deletion app/Nova/Resources/Integration.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ public function fields(NovaRequest $request): array
URL::make('Website')
->displayUsing(fn () => $this->website)
->showOnIndex(false)
->rules('url:http,https', 'max:255'),
->rules('nullable', 'url:http,https', 'max:255'),

BelongsTo::make('Organization')
->withoutTrashed()
Expand Down

0 comments on commit 05ead5f

Please sign in to comment.