Raw integration of accompanying person (with respect of 'cahier de cahrge)

This commit is contained in:
Marc Ducobu
2015-08-24 14:41:24 +02:00
parent 9decbf119a
commit f967285e34
15 changed files with 148 additions and 101 deletions

View File

@@ -7,13 +7,13 @@ Chill\PersonBundle\Entity\AccompanyingPeriod:
id: true
generator: { strategy: AUTO }
fields:
date_opening:
openingDate:
type: date
date_closing:
closingDate:
type: date
default: null
nullable: true
memo:
remark:
type: text
manyToOne:
person:

View File

@@ -48,11 +48,11 @@ chill_person_search:
chill_person_accompanying_period_list:
path: /{_locale}/person/{person_id}/accompanying-period
defaults: { _controller: ChillPersonBundle:AccompanyingPeriod:list }
# options:
# menus:
# person:
# order: 100
# label: menu.person.history
options:
menus:
person:
order: 100
label: Accompanying period list
chill_person_accompanying_period_create:
path: /{_locale}/person/{person_id}/accompanying-period/create

View File

@@ -35,12 +35,12 @@ Chill\PersonBundle\Entity\Person:
Chill\PersonBundle\Entity\AccompanyingPeriod:
properties:
date_opening:
openingDate:
- Date:
message: 'Opening date is not valid'
- NotNull:
message: 'Opening date can not be null'
date_closing:
closingDate:
- Date:
message: 'Closing date is not valid'
- NotNull:

View File

@@ -0,0 +1,61 @@
<?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' :
* - update of accompanyingPerid
*/
class Version20150820113409 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 accompanying_period RENAME COLUMN date_opening TO openingdate;');
$this->addSql('ALTER TABLE accompanying_period RENAME COLUMN date_closing TO closingdate;');
$this->addSql('ALTER TABLE accompanying_period RENAME COLUMN memo TO remark;');
}
/**
* @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 accompanying_period RENAME COLUMN openingdate TO date_opening;');
$this->addSql('ALTER TABLE accompanying_period RENAME COLUMN closingdate TO date_closing;');
$this->addSql('ALTER TABLE accompanying_perod RENAME COLUMN remark TO memo;');
}
}

View File

@@ -10,17 +10,17 @@
{{ form_start(form) }}
{{ 'Last opening since %last_opening%'|trans(
{ '%last_opening%' : accompanying_period.dateOpening|localizeddate('long', 'none', app.request.locale) }) }}
{ '%last_opening%' : accompanying_period.openingDate|localizeddate('long', 'none', app.request.locale) }) }}
{% if form.dateClosing is defined %}
{{ form_row(form.dateClosing, {'label' : 'Closing date'} ) }}
{% if form.closingDate is defined %}
{{ form_row(form.closingDate, {'label' : 'Closing date'} ) }}
{% endif %}
{% if form.closingMotive is defined %}
{{ form_row(form.closingMotive, {'label' : 'Closing motive'} ) }}
{% endif %}
{{ form_row(form.memo, {'label' : 'Memo' } ) }}
{{ form_row(form.remark, {'label' : 'Remark' } ) }}
{{ form_rest(form) }}

View File

@@ -18,13 +18,13 @@
{% set i = 0 %}
{% for accompanying_period in accompanying_periods %}
<tr class="{% if i is not even %}striped{% endif %}">
<td>{{ accompanying_period.dateOpening|localizeddate('long', 'none', app.request.locale) }}</td>
<td>{{ accompanying_period.openingDate|localizeddate('long', 'none', app.request.locale) }}</td>
<td>{% spaceless %}
{% if accompanying_period.isOpen %}
{{ 'Still open'|trans }}
{% else %}
{{ accompanying_period.dateClosing|localizeddate('long', 'none', app.request.locale) }}
{{ accompanying_period.closingDate|localizeddate('long', 'none', app.request.locale) }}
{% endif %}
{% endspaceless %}</td>
@@ -34,10 +34,10 @@
</div>
</td>
</tr>
{% if accompanying_period.memo is not empty %}
{% if accompanying_period.remark is not empty %}
<tr class="{% if i is not even %}striped{% endif %}">
<td colspan="3">
<pre>{{ accompanying_period.memo }}</pre>
<pre>{{ accompanying_period.remark }}</pre>
</td>
</tr>
{% endif %}