diff --git a/app/Console/Commands/ImportMRES.php b/app/Console/Commands/ImportMRES.php
new file mode 100644
index 000000000..193ca3c28
--- /dev/null
+++ b/app/Console/Commands/ImportMRES.php
@@ -0,0 +1,78 @@
+argument('input');
+
+ $inputFile = fopen($input, 'r');
+
+ // First three lines are headers.
+ fgetcsv($inputFile);
+ fgetcsv($inputFile);
+ fgetcsv($inputFile);
+
+ while (!feof($inputFile))
+ {
+ $fields = fgetcsv($inputFile);
+
+ if ($fields) {
+ $fields = array_map("utf8_encode", $fields);
+ $groupname = trim($fields[0]);
+ $email = trim($fields[1]);
+
+ if ($email) {
+ // Find group with name
+ $group = \App\Group::where('name', 'like', $groupname)->first();
+
+ if ($group) {
+ $this->info("Set email for $groupname to $email");
+ $group->email = $email;
+ $group->save();
+ } else {
+ $this->error("No group found for $groupname");
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/app/Group.php b/app/Group.php
index 1cb8c8d8f..1c1d1ef3c 100644
--- a/app/Group.php
+++ b/app/Group.php
@@ -46,6 +46,7 @@ class Group extends Model implements Auditable
'timezone',
'phone',
'network_data',
+ 'email',
];
protected $appends = ['ShareableLink', 'auto_approve'];
diff --git a/app/Http/Controllers/API/GroupController.php b/app/Http/Controllers/API/GroupController.php
index f7bc88f70..86a3f665d 100644
--- a/app/Http/Controllers/API/GroupController.php
+++ b/app/Http/Controllers/API/GroupController.php
@@ -555,6 +555,10 @@ public function moderateGroupsv2(Request $request) {
* ref="#/components/schemas/Group/properties/website"
* ),
* @OA\Property(
+ * property="email",
+ * ref="#/components/schemas/Group/properties/email"
+ * ),
+ * @OA\Property(
* property="description",
* ref="#/components/schemas/Group/properties/description",
* ),
@@ -592,7 +596,7 @@ public function createGroupv2(Request $request) {
$user = $this->getUser();
$user->convertToHost();
- list($name, $area, $postcode, $location, $phone, $website, $description, $timezone, $latitude, $longitude, $country, $network_data) = $this->validateGroupParams(
+ list($name, $area, $postcode, $location, $phone, $website, $description, $timezone, $latitude, $longitude, $country, $network_data, $email) = $this->validateGroupParams(
$request,
true
);
@@ -611,6 +615,7 @@ public function createGroupv2(Request $request) {
'timezone' => $timezone,
'phone' => $phone,
'network_data' => $network_data,
+ 'email' => $email,
];
$group = Group::create($data);
@@ -692,6 +697,10 @@ public function createGroupv2(Request $request) {
* ref="#/components/schemas/Group/properties/website"
* ),
* @OA\Property(
+ * property="email",
+ * ref="#/components/schemas/Group/properties/email"
+ * ),
+ * @OA\Property(
* property="description",
* ref="#/components/schemas/Group/properties/description",
* ),
@@ -728,7 +737,7 @@ public function createGroupv2(Request $request) {
public function updateGroupv2(Request $request, $idGroup) {
$user = $this->getUser();
- list($name, $area, $postcode, $location, $phone, $website, $description, $timezone, $latitude, $longitude, $country, $network_data) = $this->validateGroupParams(
+ list($name, $area, $postcode, $location, $phone, $website, $description, $timezone, $latitude, $longitude, $country, $network_data, $email) = $this->validateGroupParams(
$request,
false
);
@@ -754,6 +763,7 @@ public function updateGroupv2(Request $request, $idGroup) {
'timezone' => $timezone,
'phone' => $phone,
'network_data' => $network_data,
+ 'email' => $email,
];
if ($user->hasRole('Administrator') || $user->hasRole('NetworkCoordinator')) {
@@ -871,6 +881,7 @@ private function validateGroupParams(Request $request, $create): array {
$description = $request->input('description');
$timezone = $request->input('timezone');
$network_data = $request->input('network_data');
+ $email = $request->input('email');
$latitude = null;
$longitude = null;
@@ -910,6 +921,7 @@ private function validateGroupParams(Request $request, $create): array {
$longitude,
$country_code,
$network_data,
+ $email,
);
}
}
diff --git a/app/Http/Resources/Group.php b/app/Http/Resources/Group.php
index 09a44a8f7..93619503a 100644
--- a/app/Http/Resources/Group.php
+++ b/app/Http/Resources/Group.php
@@ -54,6 +54,13 @@
* example="https://therestartproject.org"
* ),
* @OA\Property(
+ * property="email",
+ * title="email",
+ * description="Any email contact address for the group.",
+ * format="string",
+ * example="info@therestartproject.org"
+ * ),
+ * @OA\Property(
* property="description",
* title="description",
* description="HTML description of the group.",
@@ -280,7 +287,8 @@ public function toArray($request)
'timezone' => $this->timezone,
'approved' => $this->approved ? true : false,
'network_data' => gettype($this->network_data) == 'string' ? json_decode($this->network_data, true) : $this->network_data,
- 'full' => true
+ 'full' => true,
+ 'email' => $this->email,
];
$ret['hosts'] = $this->resource->all_confirmed_hosts_count;
diff --git a/database/migrations/2023_08_14_112539_group_email.php b/database/migrations/2023_08_14_112539_group_email.php
new file mode 100644
index 000000000..8fed6d948
--- /dev/null
+++ b/database/migrations/2023_08_14_112539_group_email.php
@@ -0,0 +1,32 @@
+string('email', 255)->nullable();
+ });
+ }
+
+ /**
+ * Reverse the migrations.
+ *
+ * @return void
+ */
+ public function down()
+ {
+ Schema::table('groups', function (Blueprint $table) {
+ $table->dropColumn('email');
+ });
+ }
+};
diff --git a/lang/en/groups.php b/lang/en/groups.php
index 6ea751255..d2978e47e 100644
--- a/lang/en/groups.php
+++ b/lang/en/groups.php
@@ -20,7 +20,9 @@
'groups_about_group' => 'Tell us about your group',
'groups_website' => 'Your website',
'groups_website_small' => 'Don\'t have a website? Feel free to add a Facebook group or similar',
- 'groups_group_small' => 'A couple of examples include \'Restarters Torino\' or \'Nottingham Fixers\'',
+ 'groups_email' => 'Email address',
+ 'groups_email_small' => 'A public contact email address for your group (optional)',
+ 'groups_group_small' => 'e.g. \'Restarters Torino\' or \'Nottingham Fixers\'',
'groups_location' => 'Location',
'location' => 'Group location',
'area' => 'Area',
diff --git a/lang/fr-BE/groups.php b/lang/fr-BE/groups.php
index 6120fa2a7..ddc0b126b 100644
--- a/lang/fr-BE/groups.php
+++ b/lang/fr-BE/groups.php
@@ -16,7 +16,9 @@
'groups_about_group' => 'Parlez-nous de votre Repair Café',
'groups_website' => 'Votre site web',
'groups_website_small' => 'Vous n\'avez pas de site web? Vous pouvez aussi ajouter une page Facebook ou autre',
- 'groups_group_small' => 'Quelques exemples tels que \'Restarters Torino\' ou \'Réparateurs de Paris\'',
+ 'groups_email' => 'Adresse électronique',
+ 'groups_email_small' => 'Une adresse électronique de contact public pour votre Repair Café (facultatif)',
+ 'groups_group_small' => 'Par exemple \'Restarters Torino\' ou \'Réparateurs de Paris\'',
'groups_location' => 'Lieu',
'location' => 'Localisation du Repair Café',
'groups_approval_text' => 'L\'ajout de repair cafés doit être approuvé par un administrateur',
diff --git a/lang/fr/groups.php b/lang/fr/groups.php
index 37c4bbf3e..9fc5deaab 100644
--- a/lang/fr/groups.php
+++ b/lang/fr/groups.php
@@ -16,7 +16,9 @@
'groups_about_group' => 'Parlez-nous de votre Repair Café',
'groups_website' => 'Votre site web',
'groups_website_small' => 'Vous n\'avez pas de site web? Vous pouvez aussi ajouter une page Facebook ou autre',
- 'groups_group_small' => 'Quelques exemples tels que \'Restarters Torino\' ou \'Réparateurs de Paris\'',
+ 'groups_email' => 'Adresse électronique',
+ 'groups_email_small' => 'Une adresse électronique de contact public pour votre Repair Café (facultatif)',
+ 'groups_group_small' => 'Par exemple \'Restarters Torino\' ou \'Réparateurs de Paris\'',
'groups_location' => 'Lieu',
'location' => 'Localisation du Repair Café',
'groups_approval_text' => 'L\'ajout de repair cafés doit être approuvé par un administrateur',
diff --git a/resources/js/components/GroupAddEdit.vue b/resources/js/components/GroupAddEdit.vue
index 53de255c5..7245cb040 100644
--- a/resources/js/components/GroupAddEdit.vue
+++ b/resources/js/components/GroupAddEdit.vue
@@ -25,6 +25,11 @@
:website.sync="website"
:has-error="$v.website.$error"
ref="website"/>
+