Renaming genre into gender & dateOfBirth into birthdate

This commit is contained in:
Marc Ducobu
2015-08-11 17:47:11 +02:00
parent 02193505be
commit 31e734f2c7
24 changed files with 189 additions and 111 deletions

View File

@@ -17,16 +17,15 @@ Chill\PersonBundle\Entity\Person:
lastName:
type: string
length: 255
dateOfBirth:
birthdate:
type: date
column: date_of_birth
nullable: true
placeOfBirth:
type: string
length: 255
column: place_of_birth
default: ''
genre:
gender:
type: string
length: 9
memo:

View File

@@ -18,11 +18,11 @@ Chill\PersonBundle\Entity\Person:
minMessage: 'This name is too short. It must containt {{ limit }} chars'
maxMessage: 'This name is too long. It must containt {{ limit }} chars'
groups: [general, creation]
dateOfBirth:
birthdate:
- Date:
message: 'Birthdate not valid'
groups: [general, creation]
genre:
gender:
- NotNull:
groups: [general, creation]
accompanyingPeriods:

View File

@@ -0,0 +1,66 @@
<?php
/*
* Chill is a software for social workers
*
* Copyright (C) 2014-2015, Champs Libres Cooperative SCRLFS,
* <http://www.champs-libres.coop>, <info@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/>.
*/
namespace Application\Migrations;
use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;
/**
* Migration for adapting the Person Bundle to the 'cahier de charge' :
* - RENAMING :
* - - date_of_birth TO birthdate
* - - genre to gender
*
*/
class Version20150811152608 extends AbstractMigration
{
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
$this->abortIf(
$this->connection->getDatabasePlatform()->getName() != 'postgresql',
'Migration can only be executed safely on \'postgresql\'.');
$this->addSql('ALTER TABLE person RENAME COLUMN date_of_birth TO birthdate');
$this->addSql('ALTER TABLE person RENAME COLUMN genre TO gender');
}
/**
* @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('ALTER TABLE person RENAME COLUMN birthdate TO date_of_birth');
$this->addSql('ALTER TABLE person RENAME COLUMN gender TO genre');
}
}

View File

@@ -29,9 +29,9 @@
{{ form_row(form.lastName, { 'label' : 'Last name'|trans }) }}
{{ form_row(form.dateOfBirth, { 'label' : 'Date of birth'|trans }) }}
{{ form_row(form.birthdate, { 'label' : 'Date of birth'|trans }) }}
{{ form_row(form.genre, { 'label' : 'Gender'|trans }) }}
{{ form_row(form.gender, { 'label' : 'Gender'|trans }) }}
{{ form_row(form.creation_date, { 'label' : 'Creation date'|trans }) }}

View File

@@ -38,7 +38,7 @@
{% endspaceless %}
</a>
</td>
<td>{{ person.dateOfBirth|localizeddate('long', 'none', app.request.locale) }}</td>
<td>{{ person.birthdate|localizeddate('long', 'none', app.request.locale) }}</td>
<td>{% if person.nationality is not null %}{{ person.nationality.name|localize_translatable_string }}{% else %}{{ 'Without nationality'|trans }}{% endif %}
</tr>
@@ -61,10 +61,10 @@
<dd>{{ lastName }}</dd>
<dt>{{ 'Date of birth'|trans }}</dt>
<dd>{{ dateOfBirth|localizeddate('long', 'none', app.request.locale)|default( 'Unknown date of birth'|trans ) }}</dd>
<dd>{{ birthdate|localizeddate('long', 'none', app.request.locale)|default( 'Unknown date of birth'|trans ) }}</dd>
<dt>{{ 'Gender'|trans }}</dt>
<dd>{{ genre|trans }}</dd>
<dd>{{ gender|trans }}</dd>
<dt>{{ 'Creation date'|trans }}</dt>
<dd>{{ creation_date|localizeddate('long', 'none', app.request.locale) }}</dd>

View File

@@ -30,12 +30,12 @@
<legend><h2>{{ 'General information'|trans }}</h2></legend>
{{ form_row(form.firstName, {'label' : 'First name'}) }}
{{ form_row(form.lastName, {'label' : 'Last name'}) }}
{{ form_row(form.genre, {'label' : 'Gender'}) }}
{{ form_row(form.gender, {'label' : 'Gender'}) }}
</fieldset>
<fieldset>
<legend><h2>{{ 'Birth information'|trans }}</h2></legend>
{{ form_row(form.dateOfBirth, {'label': 'Date of birth'} ) }}
{{ form_row(form.birthdate, {'label': 'Date of birth'} ) }}
{{ form_row(form.placeOfBirth, { 'label' : 'Place of birth'} ) }}
{{ form_row(form.countryOfBirth, { 'label' : 'Country of birth' } ) }}
</fieldset>

View File

@@ -19,8 +19,8 @@
#}{{ person.id }},{#
#}"{{ person.firstName|csv_cell }}",{#
#}"{{ person.lastName|csv_cell }}",{#
#}"{{ person.genre|csv_cell }}",{#
#}"{{ person.dateOfBirth|localizeddate('short', 'none') }}",{#
#}"{{ person.gender|csv_cell }}",{#
#}"{{ person.birthdate|localizeddate('short', 'none') }}",{#
#}"{# countryOfBirth
#}{% if person.countryOfBirth is not null %}{#
#}{{ person.countryOfBirth.name|localize_translatable_string }}{#

View File

@@ -42,11 +42,11 @@
</a>
</td>
<td>
<span class="personDateOfBirth">{% if person.dateOfBirth is not null %}{{person.dateOfBirth|localizeddate('long', 'none', app.request.locale) }}{% else %}{{ 'Unknown date of birth'|trans }}{% endif %}</span>
{% if person.birthdate is not null %}{{person.birthdate|localizeddate('long', 'none', app.request.locale) }}{% else %}{{ 'Unknown date of birth'|trans }}{% endif %}
</td>
<td>
{% if person.nationality is not null %}
<span class="personNationality">{{person.nationality.name | localize_translatable_string }}</span>
{{person.nationality.name | localize_translatable_string }}
{% else %}
{{ 'Without nationality'|trans }}
{% endif %}

View File

@@ -50,7 +50,7 @@ This view should receive those arguments:
<dd>{{ person.lastName }}</dd>
<dt class="inline">{{ 'Gender'|trans }}</dt>
<dd>{{ ( person.genre|default('Not given'))|trans }}</dd>
<dd>{{ ( person.gender|default('Not given'))|trans }}</dd>
</dl>
</figure>
@@ -60,8 +60,8 @@ This view should receive those arguments:
<dl>
<dt class="inline">{{ 'Date of birth'|trans }}</dt>
<dd>
{%- if person.dateOfBirth is not null -%}
{{ person.dateOfBirth|localizeddate('long', 'none') }}
{%- if person.birthdate is not null -%}
{{ person.birthdate|localizeddate('long', 'none') }}
{%- else -%}
{{ 'Unknown date of birth'|trans }}
{%- endif -%}

View File

@@ -36,11 +36,11 @@
<div class="grid-10 push-1 parent">
<div class="grid-4">
{{ 'Birthdate :'|trans|upper }}
{% if person.dateOfBirth == null %}
{% if person.birthdate == null %}
{{ 'Unknown date of birth'|trans }}, {{ ('person.gender.' ~
person.genre)|trans }}
person.gender)|trans }}
{% else %}
{{ person.dateOfBirth|localizeddate('long', 'none') }}
{{ person.birthdate|localizeddate('long', 'none') }}
{% endif %}
</div>
<div class="grid-4">
@@ -53,7 +53,7 @@
</div>
<div class="grid-4">
{{ 'Gender:'|trans|upper}}
{{ person.genre }}
{{ person.gender }}
</div>
<!--
<div class="grid-4">