Skip to content
This repository has been archived by the owner on Aug 13, 2022. It is now read-only.

Commit

Permalink
fixed #83
Browse files Browse the repository at this point in the history
  • Loading branch information
Guite committed Oct 4, 2018
1 parent 202a3a4 commit 8bc1744
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 9 deletions.
39 changes: 39 additions & 0 deletions Entity/SubmissionEntity.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,14 @@ class SubmissionEntity extends EntityAccess
*/
private $phoneNumber;

/**
* The company
*
* @ORM\Column(type="string", length=255)
* @var string $company
*/
private $company;

/**
* The url
*
Expand Down Expand Up @@ -145,6 +153,7 @@ public function __construct()
$this->name = '';
$this->email = '';
$this->phoneNumber = '';
$this->company = '';
$this->url = '';
$this->location = '';
$this->comment = '';
Expand Down Expand Up @@ -311,6 +320,36 @@ public function setPhoneNumber($phoneNumber)
$this->phoneNumber = $phoneNumber;
}

/**
* Alias for easier form handling.
*
* @param string $phoneNumber the submission's phone number
*/
public function setPhone($phoneNumber)
{
return $this->setPhoneNumber($phoneNumber);
}

/**
* Gets the company of the submission.
*
* @return string the submission's company
*/
public function getCompany()
{
return $this->company;
}

/**
* Sets the company for the submission.
*
* @param string $company the submission's company
*/
public function setCompany($company)
{
$this->company = $company;
}

/**
* Gets the url of the submission.
*
Expand Down
13 changes: 12 additions & 1 deletion FormiculaModuleInstaller.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class FormiculaModuleInstaller extends AbstractExtensionInstaller
*/
private $entities = [
'Zikula\FormiculaModule\Entity\ContactEntity',
'Zikula\FormiculaModule\Entity\SubmissionEntity',
'Zikula\FormiculaModule\Entity\SubmissionEntity'
];

/**
Expand Down Expand Up @@ -194,6 +194,17 @@ public function upgrade($oldVersion)
$stmt = $connection->prepare($sql);
$stmt->execute();
case '5.0.0':
// added forgotten company field
try {
$this->schemaTool->update([
'Zikula\FormiculaModule\Entity\SubmissionEntity'
]);
} catch (\Exception $exception) {
$this->addFlash('error', $this->__('Doctrine Exception') . ': ' . $exception->getMessage());

return false;
}
case '5.0.1':
// future upgrades
}

Expand Down
2 changes: 1 addition & 1 deletion Resources/views/Submission/delete.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
<div class="form-group">
<label class="col-sm-3 control-label">{{ __('Name') }}</label>
<div class="col-sm-9">
<p class="form-control-static"><a href="#" class="tooltips" title="{{ __f('Email: %1$s - UID: %2$s', { '%1$s': submission.email, '%2$s': submission.createdUserId }) }}">{{ submission.name }}</a></p>
<p class="form-control-static"><a href="#" class="tooltips" title="{{ __f('Email: %1$s - UID: %2$s', {'%1$s': submission.email, '%2$s': submission.createdBy.uid}) }}">{{ submission.name }}</a></p>
</div>
</div>
</fieldset>
Expand Down
8 changes: 4 additions & 4 deletions Resources/views/Submission/display.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<tbody>
<tr>
<td headers="hDate">{{ submission.createdDate|localizeddate('short', 'short') }}</td>
<td headers="hName"><a href="#" class="tooltips" title="{{ __f('Email: %1$s - UID: %2$s', { '%1$s': submission.email, '%2$s': submission.createdUserId }) }}">{{ submission.name }}</a></td>
<td headers="hName"><a href="#" class="tooltips" title="{{ __f('Email: %1$s - UID: %2$s', {'%1$s': submission.email, '%2$s': submission.createdBy.uid}) }}">{{ submission.name }}</a></td>
<td headers="hIpAddress">{{ submission.ipAddress }}</td>
<td headers="hHostName">{{ submission.hostName }}</td>
<td headers="hContactId">{{ submission.cid }}</td>
Expand All @@ -49,9 +49,9 @@
<tbody>
<tr>
<td headers="hUrl">{% if submission.url != '' %}<a href="{{ submission.url }}" title="{{ __('Visit website') }}" target="_blank">{{ submission.url }}</a>{% else %}{{ __('None') }}{% endif %}</td>
<td headers="hCompany">{% if submission.company != '' %}{{ submission.company }}{% else %}{{ __('None') }}{% endif %}</td>
<td headers="hPhoneNumber">{% if submission.phoneNumber != '' %}{{ submission.phoneNumber }}{% else %}{{ __('None') }}{% endif %}</td>
<td headers="hLocation">{% if submission.location != '' %}{{ submission.location }}{% else %}{{ __('None') }}{% endif %}</td>
<td headers="hCompany">{{ submission.company|default(__('None')) }}</td>
<td headers="hPhoneNumber">{{ submission.phoneNumber|default(__('None')) }}</td>
<td headers="hLocation">{{ submission.location|default(__('None')) }}</td>
</tr>
</tbody>
</table>
Expand Down
6 changes: 3 additions & 3 deletions Resources/views/Submission/view.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@
<td headers="hForm">{{ submission.form }}</td>
<td headers="hContactId">{{ submission.cid }}</td>
<td headers="hDate">{{ submission.createdDate|localizeddate('short', 'short') }}</td>
<td headers="hName"><a href="#" class="tooltips" title="{{ __f('Email: %1$s - UID: %2$s', { '%1$s': submission.email, '%2$s': submission.createdUserId }) }}">{{ submission.name }}</a></td>
<td headers="hName"><a href="#" class="tooltips" title="{{ __f('Email: %1$s - UID: %2$s', {'%1$s': submission.email, '%2$s': submission.createdBy.uid}) }}">{{ submission.name }}</a></td>
<td headers="hActions" class="text-right nowrap">
<a href="{{ path('zikulaformiculamodule_submission_display', { sid: submission.sid }) }}" class="fa fa-eye fa-lg tooltips" title="{{ __('View form submission') }}"></a>
<a href="{{ path('zikulaformiculamodule_submission_delete', { sid: submission.sid }) }}" class="fa fa-trash fa-lg tooltips" title="{{ __('Delete form submission') }}"></a>
<a href="{{ path('zikulaformiculamodule_submission_display', {sid: submission.sid}) }}" class="fa fa-eye fa-lg tooltips" title="{{ __('View form submission') }}"></a>
<a href="{{ path('zikulaformiculamodule_submission_delete', {sid: submission.sid}) }}" class="fa fa-trash fa-lg tooltips" title="{{ __('Delete form submission') }}"></a>
</td>
</tr>
{% else %}
Expand Down

0 comments on commit 8bc1744

Please sign in to comment.