Merge remote-tracking branch 'framagit/master'

This commit is contained in:
2016-03-13 15:02:32 +01:00
10 changed files with 399 additions and 2 deletions

View File

@@ -72,4 +72,9 @@ Chill\PersonBundle\Entity\Person:
inverseJoinColumns:
language_id:
referencedColumnName: id
addresses:
targetEntity: Chill\MainBundle\Entity\Address
joinTable:
name: chill_person_persons_to_addresses
cascade: [persist, remove, merge, detach]
lifecycleCallbacks: { }

View File

@@ -69,6 +69,14 @@ chill_person_accompanying_period_close:
chill_person_accompanying_period_open:
path: /{_locale}/person/{person_id}/accompanying-period/open
defaults: { _controller: ChillPersonBundle:AccompanyingPeriod:open }
chill_person_address_edit:
path: /{_locale}/person/{person_id}/address/{address_id}/edit
defaults: { _controller: ChillPersonBundle:PersonAddress:edit }
chill_person_address_update:
path: /{_locale}/person/{person_id}/address/{address_id}/update
defaults: { _controller: ChillPersonBundle:PersonAddress:update }
chill_person_export:
path: /{_locale}/person/export/

View File

@@ -0,0 +1,49 @@
<?php
namespace Application\Migrations;
use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;
/**
* Add a many-to-many relationship between person and addresses
*/
class Version20160310161006 extends AbstractMigration
{
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
// this up() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() != 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');
$this->addSql('CREATE TABLE chill_person_persons_to_addresses ('
. 'person_id INT NOT NULL, '
. 'address_id INT NOT NULL, '
. 'PRIMARY KEY(person_id, address_id))');
$this->addSql('CREATE INDEX IDX_4655A196217BBB47 '
. 'ON chill_person_persons_to_addresses (person_id)');
$this->addSql('CREATE INDEX IDX_4655A196F5B7AF75 '
. 'ON chill_person_persons_to_addresses (address_id)');
$this->addSql('ALTER TABLE chill_person_persons_to_addresses '
. 'ADD CONSTRAINT FK_4655A196217BBB47 '
. 'FOREIGN KEY (person_id) '
. 'REFERENCES Person (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE chill_person_persons_to_addresses '
. 'ADD CONSTRAINT FK_4655A196F5B7AF75 '
. 'FOREIGN KEY (address_id) '
. 'REFERENCES chill_main_address (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
$this->abortIf($this->connection->getDatabasePlatform()->getName() != 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');
$this->addSql('DROP TABLE chill_person_persons_to_addresses');
}
}

View File

@@ -71,6 +71,12 @@ Reset: 'Remise à zéro'
'Update details for %name%': 'Modifier détails de %name%'
Accompanying period list: Périodes d'accompagnement
#address
Since %date%: Depuis le %date%
No address given: Pas d'adresse renseignée
The address has been successfully updated: L'adresse a été mise à jour avec succès
Update address for %name%: Mettre à jour une adresse pour %name%
#timeline
'An accompanying period is opened for %person% on %date%': Une période d'accompagnement a été ouverte le %date% pour %person%
'An accompanying period is closed for %person% on %date%': Une période d'accompagnement a été fermée le %date% pour %person%

View File

@@ -0,0 +1,36 @@
{#
* Copyright (C) 2014, Champs Libres Cooperative SCRLFS, <http://www.champs-libres.coop>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
#}
{% extends "ChillPersonBundle::layout.html.twig" %}
{% set activeRouteKey = '' %}
{% block title %}{{ 'Update address for %name%'|trans({ '%name%': person.firstName|capitalize ~ ' ' ~ person.lastName } )|capitalize }}{% endblock %}
{% block personcontent %}
{{ form_start(form) }}
{{ form_row(form.streetAddress1) }}
{{ form_row(form.streetAddress2) }}
{{ form_row(form.postCode) }}
{{ form_row(form.validFrom) }}
{{ form_row(form.submit, { 'attr' : { 'class': 'sc-button bt-edit' } } ) }}
{{ form_end(form) }}
{% endblock personcontent %}

View File

@@ -16,6 +16,8 @@
#}
{% extends "ChillPersonBundle::layout.html.twig" %}
{% import 'ChillMainBundle:Address:macro.html.twig' as address %}
{% set activeRouteKey = 'chill_person_view' %}
{#
@@ -165,6 +167,22 @@ This view should receive those arguments:
<figure class="person-details">
<h2 class="chill-blue"><i class="fa fa-envelope-o"></i>&nbsp;{{ 'Contact information'|trans|upper }}</h2>
{%- if chill_person.fields.address == 'visible' -%}
<dl>
<dt>{{ 'Address'|trans }}</dt>
<dd>
{%- if person.lastAddress is not empty -%}
{{ address._render(person.lastAddress) }}
<a href="{{ path('chill_person_address_edit', { 'person_id': person.id, 'address_id' : person.lastAddress.id } ) }}">
{{ 'Edit'|trans }}
</a>
{%- else -%}
<span class="chill-no-data-statement">{{ 'No address given'|trans }}</span>
{%- endif -%}
</dd>
</dl>
{%- endif -%}
{%- if chill_person.fields.email == 'visible' -%}
<dl>
<dt>{{ 'Email'|trans }}&nbsp;:</dt>