Merge branch 'master' into export

This commit is contained in:
2016-04-15 23:23:50 +02:00
30 changed files with 1833 additions and 62 deletions

View File

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

View File

@@ -69,6 +69,27 @@ 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_list:
path: /{_locale}/person/{person_id}/address/list
defaults: { _controller: ChillPersonBundle:PersonAddress:list }
chill_person_address_create:
path: /{_locale}/person/{person_id}/address/create
defaults: { _controller: ChillPersonBundle:PersonAddress:create }
methods: [POST]
chill_person_address_new:
path: /{_locale}/person/{person_id}/address/new
defaults: { _controller: ChillPersonBundle:PersonAddress:new }
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

@@ -1,7 +1,14 @@
parameters:
# cl_chill_person.example.class: Chill\PersonBundle\Example
services:
services:
chill.person.form.person_creation:
class: Chill\PersonBundle\Form\PersonType
arguments:
- %chill_person.person_fields%
tags:
- { name: form.type }
chill.person.accompanying_period_closing_motive:
class: Chill\PersonBundle\Form\Type\ClosingMotiveType
scope: request
@@ -93,4 +100,19 @@ services:
arguments:
- "@translator"
tags:
- { name: chill.export_aggregator, alias: person_gender_aggregator }
- { name: chill.export_aggregator, alias: person_gender_aggregator }
chill.person.form.type.pick_person:
class: Chill\PersonBundle\Form\Type\PickPersonType
arguments:
- "@chill.person.repository.person"
- "@security.token_storage"
- "@chill.main.security.authorization.helper"
tags:
- { name: form.type }
chill.person.repository.person:
class: Chill\PersonBundle\Entity\PersonRepository
factory: ['@doctrine.orm.entity_manager', getRepository]
arguments:
- 'Chill\PersonBundle\Entity\Person'

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

@@ -68,8 +68,24 @@ Reset: 'Remise à zéro'
'Create accompanying period': 'Nouvelle ouverture-fermeture à une autre date'
'Closing motive': 'Motif de clôture'
'Person details': 'Détails de la personne'
'Update details for %name%': 'Modifier détails de %name%'
Accompanying period list: Périodes d'accompagnement
# pickAPersonType
Pick a person: Choisir une personne
#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%
Addresses'history for %name%: Historique des adresses de %name%
Addresses'history: Historique des adresses
New address for %name% : Nouvelle adresse pour %name%
The new address was created successfully: La nouvelle adresse a été créée
Add an address: Ajouter une adresse
Back to the person details: Retour aux détails de la personne
#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,47 @@
{#
* 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 ~ ' ' ~ person.lastName } ) %}
{% block personcontent %}
<h1>{{ 'Update address for %name%'|trans({ '%name%': person.firstName ~ ' ' ~ person.lastName } ) }}</h1>
{{ form_start(form) }}
{{ form_row(form.streetAddress1) }}
{{ form_row(form.streetAddress2) }}
{{ form_row(form.postCode) }}
{{ form_row(form.validFrom) }}
<ul class="record_actions">
<li>
<a href="{{ path('chill_person_address_list', { 'person_id' : person.id } ) }}" class="sc-button btn-cancel">
{{ 'Back to the list'|trans }}
</a>
</li>
<li>
{{ form_row(form.submit, { 'attr' : { 'class': 'sc-button bt-edit' } } ) }}
</li>
</ul>
{{ form_end(form) }}
{% endblock personcontent %}

View File

@@ -0,0 +1,84 @@
{#
* 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" %}
{% import 'ChillMainBundle:Address:macro.html.twig' as address_macros %}
{% set activeRouteKey = '' %}
{% block title %}{{ 'Addresses\'history for %name%'|trans({ '%name%': person.firstName ~ ' ' ~ person.lastName } ) }}{% endblock %}
{% block personcontent %}
<h1>{{ 'Addresses\'history for %name%'|trans({ '%name%': person.firstName ~ ' ' ~ person.lastName } ) }}</h1>
<table class="records_list">
<thead>
<tr>
<th>{{ 'Valid from'|trans }}</th>
<th>{{ 'Address'|trans }}</th>
<th>&nbsp;</th>
</tr>
</thead>
<tbody>
{% if person.addresses|length == 0 %}
<tr>
<td colspan="3">
<span class="chill-no-data-statement">{{ 'No address given'|trans }}</span>
<a href="{{ path('chill_person_address_new', { 'person_id' : person.id } ) }}">
{{ 'Add an address'|trans }}
</a>
</td>
</tr>
{% else %}
{% for address in person.addresses %}
<tr>
<td><strong>{{ 'Since %date%'|trans( { '%date%' : address.validFrom|localizeddate('long', 'none') } ) }}</strong></td>
<td>
{{ address_macros._render(address, { 'with_valid_from' : false } ) }}
</td>
<td>
<ul class="record_actions">
<li>
<a href="{{ path('chill_person_address_edit', { 'person_id': person.id, 'address_id' : address.id } ) }}" class="sc-button bt-edit">
{{ 'Edit'|trans }}
</a>
</li>
</ul>
</td>
</tr>
{% endfor %}
{% endif %}
</tbody>
</table>
<ul class="record_actions">
<li>
<a href="{{ path('chill_person_view', { 'person_id' : person.id } ) }}" class="sc-button btn-cancel">
{{ 'Back to the person details'|trans }}
</a>
</li>
<li>
<a href="{{ path('chill_person_address_new', { 'person_id' : person.id } ) }}" class="sc-button btn-create">
{{ 'Add an address'|trans }}
</a>
</li>
</ul>
{% endblock personcontent %}

View File

@@ -0,0 +1,47 @@
{#
* 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 %}{{ 'New address for %name%'|trans({ '%name%': person.firstName|capitalize ~ ' ' ~ person.lastName } )|capitalize }}{% endblock %}
{% block personcontent %}
<h1>{{ 'New address for %name%'|trans({ '%name%': person.firstName ~ ' ' ~ person.lastName } ) }}</h1>
{{ form_start(form) }}
{{ form_row(form.streetAddress1) }}
{{ form_row(form.streetAddress2) }}
{{ form_row(form.postCode) }}
{{ form_row(form.validFrom) }}
<ul class="record_actions">
<li>
<a href="{{ path('chill_person_address_list', { 'person_id' : person.id } ) }}" class="sc-button btn-cancel">
{{ 'Back to the list'|trans }}
</a>
</li>
<li>
{{ form_row(form.submit, { 'attr' : { 'class': 'sc-button bt-create' } } ) }}
</li>
</ul>
{{ form_end(form) }}
{% endblock personcontent %}

View File

@@ -18,14 +18,21 @@
{% set activeRouteKey = '' %}
{% block title %}ChillPersonBundle:Person:see{% endblock %}
{% block title %}{{ 'Update details for %name%'|trans({ '%name%': person.firstName|capitalize ~ ' ' ~ person.lastName } )|capitalize }}{% endblock %}
{% block personcontent %}
<h1>{{ 'Update details for %name%'|trans({ '%name%': person.firstName|capitalize ~ ' ' ~ person.lastName|capitalize } ) }}</h1>
{% form_theme form 'ChillMainBundle:Form:fields.html.twig' %}
{{ form_start(form) }}
<fieldset>
<legend><h2>{{ 'Memo'|trans }}</h2></legend>
{{ form_row(form.memo, {'label' : 'Memo'} ) }}
</fieldset>
<fieldset>
<legend><h2>{{ 'General information'|trans }}</h2></legend>
{{ form_row(form.firstName, {'label' : 'First name'}) }}
@@ -36,25 +43,41 @@
<fieldset>
<legend><h2>{{ 'Birth information'|trans }}</h2></legend>
{{ form_row(form.birthdate, {'label': 'Date of birth'} ) }}
{%- if form.placeOfBirth is defined -%}
{{ form_row(form.placeOfBirth, { 'label' : 'Place of birth'} ) }}
{%- endif -%}
{%- if form.countryOfBirth is defined -%}
{{ form_row(form.countryOfBirth, { 'label' : 'Country of birth' } ) }}
{%- endif -%}
</fieldset>
{%- if form.nationality is defined or form.spokenLanguages is defined or form.maritalStatus is defined -%}
<fieldset>
<legend><h2>{{ 'Administrative information'|trans }}</h2></legend>
{%- if form.nationality is defined -%}
{{ form_row(form.nationality, { 'label' : 'Nationality'|trans} ) }}
{%- endif -%}
{%- if form.spokenLanguages is defined -%}
{{ form_row(form.spokenLanguages, {'label' : 'Spoken languages'}) }}
{%- endif -%}
{%- if form.maritalStatus is defined -%}
{{ form_row(form.maritalStatus, { 'label' : 'Marital status'} ) }}
{%- endif -%}
</fieldset>
{%- endif -%}
{%- if form.email is defined or form.phonenumber is defined -%}
<fieldset>
<legend><h2>{{ 'Contact information'|trans }}</h2></legend>
{%- if form.email is defined -%}
{{ form_row(form.email, {'label': 'Email'}) }}
{%- endif -%}
{%- if form.phonenumber is defined -%}
{{ form_row(form.phonenumber, {'label': 'Phonenumber'}) }}
{%- endif -%}
</fieldset>
{%- endif -%}
{{ form_row(form.memo, {'label' : 'Memo'} ) }}
{{ form_rest(form) }}

View File

@@ -0,0 +1 @@
{% macro render(p, withLink=false) %}<span class="entity entity-person person-person"><a href="{{ path('chill_person_view', { 'person_id' : p.id } ) }}">{{ p.firstName }}&nbsp;{{ p.lastName }}</a></span>{% endmacro %}

View File

@@ -16,6 +16,8 @@
#}
{% extends "ChillPersonBundle::layout.html.twig" %}
{% import 'ChillMainBundle:Address:macro.html.twig' as address %}
{% set activeRouteKey = 'chill_person_view' %}
{#
@@ -23,7 +25,8 @@ This view should receive those arguments:
- person
#}
{% block title %}ChillPersonBundle:Person:see{% endblock %}
{% block title %}{{ 'Person details'|trans|capitalize ~ ' ' ~ person.firstName|capitalize ~
' ' ~ person.lastName }}{% endblock %}
{#
we define variables to include an edit form repeated multiple time across
the page
@@ -34,8 +37,21 @@ This view should receive those arguments:
{% block personcontent %}
<div class="grid-10 push-1 grid-mobile-12 grid-tablet-12 push-mobile-0 push-tablet-0 parent">
{% if person.memo is not empty %}
<div class="grid-12">
<figure class="person-details">
<h2 class="chill-red">{{ 'Memo'|trans|upper }}</h2>
<p>
<blockquote>{{ person.memo|nl2br }}</blockquote>
</p>
</figure>
</div>
{% endif %}
<div class="grid-6">
<figure class="person-details">
<h2 class="chill-red">{{ 'General information'|trans|upper }}</h2>
@@ -72,8 +88,12 @@ This view should receive those arguments:
{%- endif -%}
</dd>
{%- if chill_person.fields.place_of_birth == 'visible' -%}
<dt>{{ 'Place of birth'|trans }}&nbsp;:</dt>
<dd>{{ person.placeOfBirth }}</dd>
{%- endif -%}
{%- if chill_person.fields.country_of_birth == 'visible' -%}
<dt>{{ 'Country of birth'|trans }}&nbsp;:</dt>
<dd>{% spaceless %}
{% if person.countryOfBirth is not null %}
{{ person.countryOfBirth.name|localize_translatable_string }}
@@ -81,6 +101,7 @@ This view should receive those arguments:
{{ 'Unknown country of birth'|trans }}
{% endif %}
{% endspaceless %}</dd>
{%- endif -%}
</dl>
{% if is_granted('CHILL_PERSON_UPDATE', person) %}
@@ -91,10 +112,12 @@ This view should receive those arguments:
</div>
<div class="grid-10 push-1 grid-mobile-12 grid-tablet-12 push-mobile-0 push-tablet-0 parent">
{%- if chill_person.fields.nationality == 'visible' or chill_person.fields.spoken_languages == 'visible'-%}
<div class="grid-6">
<figure class="person-details">
<h2 class="chill-orange">{{ 'Administrative information'|trans|upper }}</h2>
{%- if chill_person.fields.nationality == 'visible' -%}
<dl>
<dt>{{ 'Nationality'|trans }}&nbsp;:</dt>
<dd>
@@ -105,6 +128,8 @@ This view should receive those arguments:
{% endif %}
</dd>
</dl>
{%- endif -%}
{%- if chill_person.fields.spoken_languages == 'visible' -%}
<dl>
<dt>{{'Spoken languages'|trans}}&nbsp;:</dt>
<dd>
@@ -117,6 +142,8 @@ This view should receive those arguments:
{% endif %}
</dd>
</dl>
{%- endif -%}
{%- if chill_person.fields.marital_status == 'visible' -%}
<dl>
<dt>{{'Marital status'|trans}}&nbsp;:</dt>
<dd>
@@ -127,24 +154,53 @@ This view should receive those arguments:
{% endif %}
</dd>
</dl>
{%- endif -%}
{% if is_granted('CHILL_PERSON_UPDATE', person) %}
{{ include(edit_tmp_name, edit_tmp_args) }}
{% endif %}
</figure>
</div>
{%- endif -%}
{%- if chill_person.fields.email == 'visible' or chill_person.fields.phonenumber == 'visible' -%}
<div class="grid-6">
<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><br/>
<a href="{{ path('chill_person_address_list', { 'person_id': person.id } ) }}">
{{ 'Addresses\'history'|trans }}
</a>
{%- else -%}
<span class="chill-no-data-statement">{{ 'No address given'|trans }}</span>
<a href="{{ path('chill_person_address_new', { 'person_id' : person.id } ) }}" class="">
{{ 'Add an address'|trans }}
</a>
{%- endif -%}
</dd>
</dl>
{%- endif -%}
{%- if chill_person.fields.email == 'visible' -%}
<dl>
<dt>{{ 'Email'|trans }}&nbsp;:</dt>
<dd><pre>{{ person.email}}&nbsp;</pre></dd>
</dl>
{%- endif -%}
{%- if chill_person.fields.phonenumber == 'visible' -%}
<dl>
<dt>{{ 'Phonenumber'|trans }}&nbsp;:</dt>
<dd><pre>{{ person.phonenumber}}&nbsp;</pre></dd>
</dl>
{% endif %}
{% if is_granted('CHILL_PERSON_UPDATE', person) %}
@@ -152,6 +208,7 @@ This view should receive those arguments:
{% endif %}
</figure>
</div>
{%- endif -%}
</div>
{% if cFGroup and (cFGroup.getActiveCustomFields|length > 0) %}

View File

@@ -70,6 +70,7 @@
{{ person.birthdate|localizeddate('long', 'none') }}
{% endif %}
</div>
{%- if chill_person.fields.nationality == 'visible' -%}
<div class="grid-3">
<span class="open_sansbold">{{ 'Nationality'|trans|upper}}&nbsp;:</span>
{% if person.nationality is not null %}
@@ -78,6 +79,8 @@
{% trans %}Without nationality{% endtrans %}
{% endif %}
</div>
{%- endif -%}
{%- if chill_person.fields.spoken_languages == 'visible' -%}
<div class="grid-3">
<span class="open_sansbold">{{ 'Spoken languages'|trans|upper}}&nbsp;:</span>
{% if person.spokenLanguages|length == 0 %}
@@ -87,7 +90,8 @@
{{ lang.name|localize_translatable_string }}{% if not loop.last %},{% endif %}
{% endfor %}
{% endif %}
</div>
</div>
{%- endif -%}
</div>
</div>
{% endblock %}
@@ -104,4 +108,8 @@
'args' : {'person_id': person.id },
'activeRouteKey': activeRouteKey
}) }}
<div class="block-post-menu">
{{ chill_delegated_block('person_post_vertical_menu', { 'person': person } ) }}
</div>
{% endblock %}