diff options
author | Hakim Cassimally <hakim@mysociety.org> | 2015-01-23 12:35:05 +0000 |
---|---|---|
committer | Dave Arter <davea@mysociety.org> | 2015-10-06 09:09:22 +0100 |
commit | 66e1e8922259cc0841550f39242a801ef72b0c69 (patch) | |
tree | 334f9bb7c381647ea6d6ed7e4ea096bcfbf708fd /perllib/FixMyStreet/Cobrand | |
parent | ae49214c011fa1d8794ebce589d319494cb65407 (diff) |
[Zurich] Provide a setup-contacts command.
for Zurich (and generic data), progressing
mysociety/FixMyStreet-Commercial/issues/663, to provide a way
for body/contact config to be consistent across dev/staging/live.
Run like so:
bin/setup-contacts zurich
e.g. with the lower-case sigil describing the cobrand to run
setup-contacts for.
Diffstat (limited to 'perllib/FixMyStreet/Cobrand')
-rw-r--r-- | perllib/FixMyStreet/Cobrand/Default.pm | 44 | ||||
-rw-r--r-- | perllib/FixMyStreet/Cobrand/Zurich.pm | 95 |
2 files changed, 139 insertions, 0 deletions
diff --git a/perllib/FixMyStreet/Cobrand/Default.pm b/perllib/FixMyStreet/Cobrand/Default.pm index c347d5750..9541f2601 100644 --- a/perllib/FixMyStreet/Cobrand/Default.pm +++ b/perllib/FixMyStreet/Cobrand/Default.pm @@ -913,4 +913,48 @@ sub jurisdiction_id_example { return $self->moniker; } +=head2 body_details_data + +Returns a list of bodies to create with ensure_body. These +are mostly just passed to ->find_or_create, but there is some +pre-processing so that you can enter: + + area_id => 123, + parent => 'Big Town', + +instead of + + body_areas => [ { area_id => 123 } ], + parent => { name => 'Big Town' }, + +For example: + + return ( + { + name => 'Big Town', + }, + { + name => 'Small town', + parent => 'Big Town', + area_id => 1234, + }, + + +=cut + +sub body_details_data { + return (); +} + +=head2 contact_details_data + +Returns a list of contact_data to create with setup_contacts. +See Zurich for an example. + +=cut + +sub contact_details_data { + return () +} + 1; diff --git a/perllib/FixMyStreet/Cobrand/Zurich.pm b/perllib/FixMyStreet/Cobrand/Zurich.pm index 5c6566b62..dc93467a6 100644 --- a/perllib/FixMyStreet/Cobrand/Zurich.pm +++ b/perllib/FixMyStreet/Cobrand/Zurich.pm @@ -8,6 +8,7 @@ use Scalar::Util 'blessed'; use strict; use warnings; +use feature 'say'; =head1 NAME @@ -860,4 +861,98 @@ sub problem_confirm_email_extras { $self->{c}->stash->{email_confirmed} = $confirmed_reports; } +sub body_details_data { + return ( + { + name => 'Stadt Zurich' + }, + { + name => 'Elektrizitäwerk Stadt Zürich', + parent => 'Stadt Zurich', + area_id => 423017, + }, + { + name => 'ERZ Entsorgung + Recycling Zürich', + parent => 'Stadt Zurich', + area_id => 423017, + }, + { + name => 'Fachstelle Graffiti', + parent => 'Stadt Zurich', + area_id => 423017, + }, + { + name => 'Grün Stadt Zürich', + parent => 'Stadt Zurich', + area_id => 423017, + }, + { + name => 'Tiefbauamt Stadt Zürich', + parent => 'Stadt Zurich', + area_id => 423017, + }, + { + name => 'Dienstabteilung Verkehr', + parent => 'Stadt Zurich', + area_id => 423017, + }, + ); +} + +sub contact_details_data { + return ( + { + category => 'Beleuchtung/Uhren', + body_name => 'Elektrizitätswerk Stadt Zürich', + fields => [ + { + code => 'strasse', + description => 'Strasse', + datatype => 'string', + required => 'yes', + }, + { + code => 'haus_nr', + description => 'Haus-Nr.', + datatype => 'string', + }, + { + code => 'mast_nr', + description => 'Mast-Nr.', + datatype => 'string', + } + ], + }, + { + category => 'Brunnen/Hydranten', + # body_name ??? + fields => [ + { + code => 'hydranten_nr', + description => 'Hydranten-Nr.', + datatype => 'string', + }, + ], + }, + { + category => "Grünflächen/Spielplätze", + body_name => 'Grün Stadt Zürich', + rename_from => "Tiere/Grünflächen", + }, + { + category => 'Spielplatz/Sitzbank', + body_name => 'Grün Stadt Zürich', + delete => 1, + }, + ); +} + +sub contact_details_data_body_default { + my ($self) = @_; + # temporary measure to assign un-bodied contacts to parent + # (this isn't at all how things will be setup in live, but is + # handy during dev.) + return $self->{c}->model('DB::Body')->find({ name => 'Stadt Zurich' }); +} + 1; |