Commit a57bd0d8 by Julien Jorry

Fix comptoir export : add dates, groupe local and contacts

parent 76759821
...@@ -272,4 +272,26 @@ class ComptoirAdmin extends AbstractAdmin ...@@ -272,4 +272,26 @@ class ComptoirAdmin extends AbstractAdmin
$em->persist($comptoir); $em->persist($comptoir);
$em->flush(); $em->flush();
} }
public function getDataSourceIterator()
{
$iterator = parent::getDataSourceIterator();
$iterator->setDateTimeFormat('d/m/Y H:i:s'); //change this to suit your needs
return $iterator;
}
public function getExportFields()
{
return [
'Id' => 'id',
'Activé ?' => 'enabled',
'Nom' => 'name',
'Groupe local' => 'groupe.name',
'Adresse' => 'fullAddresse',
'Contacts' => 'contactsString',
'Crée le' => 'createdAt',
'Mise à jour le' => 'updatedAt',
];
}
} }
...@@ -281,6 +281,16 @@ class Comptoir extends AccountableObject implements AccountableInterface ...@@ -281,6 +281,16 @@ class Comptoir extends AccountableObject implements AccountableInterface
return $this; return $this;
} }
public function getContactsString()
{
return join(' - ', array_map(function ($contact) {
$return = ucwords($contact->getName()) . ($contact->getEmail() == $contact->getName()?'':(':' . $contact->getEmail()));
$return .= $contact->getTel() ? ','.$contact->getTel() : '';
return $return;
}, $this->contacts->getValues()));
}
public function __toString(): string public function __toString(): string
{ {
return !empty($this->name) ? $this->name : 'Comptoir'; return !empty($this->name) ? $this->name : 'Comptoir';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment