From 97ec51a1631975b06cdef6f1cca2fc091fcdc0e1 Mon Sep 17 00:00:00 2001 From: Dominik Beyer <dominik.beyer@sgalinski.de> Date: Thu, 27 May 2021 13:22:26 +0200 Subject: [PATCH] [TASK] Add location field --- Classes/Domain/Model/Job.php | 19 +++++++++++++++++++ .../TCA/tx_sgjobs_domain_model_job.php | 17 +++++++++++++---- ...tx_sgjobs_domain_model_job_application.php | 2 +- Resources/Private/Language/de.locallang.xlf | 10 +++++++--- Resources/Private/Language/locallang.xlf | 7 +++++-- Resources/Private/Language/zh.locallang.xlf | 8 ++++---- Resources/Private/Partials/Job.html | 14 +++++++++++++- .../Private/Templates/Joblist/ApplyForm.html | 16 +++++++++++++++- ext_tables.sql | 1 + 9 files changed, 78 insertions(+), 16 deletions(-) diff --git a/Classes/Domain/Model/Job.php b/Classes/Domain/Model/Job.php index 181b61a9..a55fb9dc 100644 --- a/Classes/Domain/Model/Job.php +++ b/Classes/Domain/Model/Job.php @@ -102,6 +102,11 @@ class Job extends AbstractEntity { */ protected $startDate = 0; + /** + * @var string $location + */ + protected $location = ''; + /** * @var int $sorting */ @@ -339,6 +344,20 @@ class Job extends AbstractEntity { $this->alternativeStartDate = $alternativeStartDate; } + /** + * @return string + */ + public function getLocation() { + return $this->location; + } + + /** + * @param string $location + */ + public function setLocation(string $location) { + $this->location = $location; + } + /** * @return bool */ diff --git a/Configuration/TCA/tx_sgjobs_domain_model_job.php b/Configuration/TCA/tx_sgjobs_domain_model_job.php index 0c1b7f24..6d1933b3 100644 --- a/Configuration/TCA/tx_sgjobs_domain_model_job.php +++ b/Configuration/TCA/tx_sgjobs_domain_model_job.php @@ -36,7 +36,7 @@ $columns = [ 'crdate' => 'crdate', 'cruser_id' => 'cruser_id', 'dividers2tabs' => TRUE, - 'searchFields' => 'title, job_id, path_segment, start_date, alternative_start_date, company, contact, department, experience_level', + 'searchFields' => 'title, job_id, path_segment, start_date, alternative_start_date, location, company, contact, department, experience_level', 'versioningWS' => 2, 'versioning_followPages' => TRUE, 'origUid' => 't3_origuid', @@ -56,7 +56,7 @@ $columns = [ 'types' => [ '1' => [ 'showitem' => '--palette--;;sysLanguageAndHidden, --palette--;;palette_title, - --palette--;;palette_title_start, + --palette--;;palette_title_start_location, --palette--;;palette_apply_function, department, experience_level, @@ -80,7 +80,7 @@ $columns = [ 'canNotCollapse' => 1, ], 'palette_title' => ['showitem' => 'title, path_segment, job_id', 'canNotCollapse' => 1], - 'palette_title_start' => ['showitem' => 'start_date, alternative_start_date', 'canNotCollapse' => 1], + 'palette_title_start_location' => ['showitem' => 'start_date, alternative_start_date, location', 'canNotCollapse' => 1], 'palette_apply_function' => ['showitem' => 'hide_apply_by_email, hide_apply_by_postal, featured_offer', 'canNotCollapse' => 1], 'palette_location_specifications' => ['showitem' => 'telecommute_possible, office_work_possible'], 'palette_seo_dates' => ['showitem' => 'date_posted, valid_through'], @@ -324,6 +324,15 @@ $columns = [ 'eval' => 'trim' ], ], + 'location' => [ + 'exclude' => TRUE, + 'label' => 'LLL:EXT:sg_jobs/Resources/Private/Language/locallang_db.xlf:tx_sgjobs_domain_model_job.location', + 'config' => [ + 'type' => 'input', + 'size' => 30, + 'eval' => 'trim' + ], + ], 'task' => [ 'exclude' => TRUE, 'label' => 'LLL:EXT:sg_jobs/Resources/Private/Language/locallang_db.xlf:tx_sgjobs_domain_model_job.task', @@ -505,7 +514,7 @@ $columns = [ ], ]; if (version_compare(\TYPO3\CMS\Core\Utility\VersionNumberUtility::getCurrentTypo3Version(), '10.3.0', '<')) { - $columns['interface']['showRecordFieldList'] = 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, pid, title, path_segment, job_id, department, experience_level, hide_apply_by_email, hide_apply_by_postal, featured_offer, start_date, alternative_start_date,company, task, qualification, description, contact, telecommute, employment_types, date_posted, valid_through, salary_currency, base_salary, max_salary, salary_unit'; + $columns['interface']['showRecordFieldList'] = 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, pid, title, path_segment, job_id, department, experience_level, hide_apply_by_email, hide_apply_by_postal, featured_offer, start_date, alternative_start_date, location, company, task, qualification, description, contact, telecommute, employment_types, date_posted, valid_through, salary_currency, base_salary, max_salary, salary_unit'; } return $columns; diff --git a/Configuration/TCA/tx_sgjobs_domain_model_job_application.php b/Configuration/TCA/tx_sgjobs_domain_model_job_application.php index 6d0b2945..40f8d7b4 100644 --- a/Configuration/TCA/tx_sgjobs_domain_model_job_application.php +++ b/Configuration/TCA/tx_sgjobs_domain_model_job_application.php @@ -378,7 +378,7 @@ $columns = [ ], ]; if (version_compare(\TYPO3\CMS\Core\Utility\VersionNumberUtility::getCurrentTypo3Version(), '10.3.0', '<')) { - $columns['interface']['showRecordFieldList'] = 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, pid, job, job_id, job_title, company, department, experience_level, start_date, alternative_start_date,company, task, qualification, description, contact, privacy_policy'; + $columns['interface']['showRecordFieldList'] = 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, pid, job, job_id, job_title, company, department, experience_level, start_date, alternative_start_date, location, company, task, qualification, description, contact, privacy_policy'; } return $columns; diff --git a/Resources/Private/Language/de.locallang.xlf b/Resources/Private/Language/de.locallang.xlf index 41029ee5..7907ff26 100644 --- a/Resources/Private/Language/de.locallang.xlf +++ b/Resources/Private/Language/de.locallang.xlf @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8" standalone="yes" ?> <xliff version="1.0"> - <file source-language="en" target-language="de" datatype="plaintext" original="messages" date="2019-08-06T13:15:41Z"> + <file source-language="en" target-language="de" datatype="plaintext" original="messages" date="2021-05-27T11:07:16Z"> <header> <type>module</type> <description>General language labels used in frontend and backend.</description> @@ -101,7 +101,7 @@ <source><![CDATA[Locations]]></source> <target><![CDATA[Arbeitsorte]]></target> </trans-unit> - <trans-unit id="backend.filters.locations.description" approved="yes"> + <trans-unit id="backend.filters.locations.description" approved="yes" xml:space="preserve"> <source><![CDATA[(Use the ctrl or cmd keys to deselect an option or to select multiple options) ]]></source> <target><![CDATA[Benutze die STRG oder CMD-Tasten, um eine Option abzuwählen oder mehrere anzuwählen ]]></target> @@ -390,6 +390,10 @@ <source><![CDATA[Location]]></source> <target><![CDATA[Standort]]></target> </trans-unit> + <trans-unit id="frontend.locationLabel" approved="yes"> + <source><![CDATA[<b>Location:</b>]]></source> + <target><![CDATA[<b>Standort:</b>]]></target> + </trans-unit> <trans-unit id="frontend.organisation" approved="yes"> <source><![CDATA[Organisation]]></source> <target><![CDATA[Organisation]]></target> @@ -412,4 +416,4 @@ </trans-unit> </body> </file> -</xliff> +</xliff> \ No newline at end of file diff --git a/Resources/Private/Language/locallang.xlf b/Resources/Private/Language/locallang.xlf index 8fb1f562..fafe2573 100644 --- a/Resources/Private/Language/locallang.xlf +++ b/Resources/Private/Language/locallang.xlf @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8" standalone="yes" ?> <xliff version="1.0"> - <file source-language="en" datatype="plaintext" original="messages" date="2019-08-06T13:15:41Z"> + <file source-language="en" datatype="plaintext" original="messages" date="2021-05-27T11:07:16Z"> <header> <type>module</type> <description>General language labels used in frontend and backend.</description> @@ -294,6 +294,9 @@ <trans-unit id="frontend.location"> <source><![CDATA[Location]]></source> </trans-unit> + <trans-unit id="frontend.locationLabel"> + <source><![CDATA[<b>Location:</b>]]></source> + </trans-unit> <trans-unit id="frontend.organisation"> <source><![CDATA[Organisation]]></source> </trans-unit> @@ -311,4 +314,4 @@ </trans-unit> </body> </file> -</xliff> +</xliff> \ No newline at end of file diff --git a/Resources/Private/Language/zh.locallang.xlf b/Resources/Private/Language/zh.locallang.xlf index a25adf0e..bd20bd02 100644 --- a/Resources/Private/Language/zh.locallang.xlf +++ b/Resources/Private/Language/zh.locallang.xlf @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8" standalone="yes" ?> <xliff version="1.0"> - <file source-language="en" target-language="zh" datatype="plaintext" original="messages" date="2019-08-06T13:15:41Z"> + <file source-language="en" target-language="zh" datatype="plaintext" original="messages" date="2021-05-27T11:07:16Z"> <header> <type>module</type> <description>General language labels used in frontend and backend.</description> @@ -215,11 +215,11 @@ </trans-unit> <trans-unit id="frontend.filter.remote" approved="yes"> <source><![CDATA[Show only jobs that can be executed remotely.]]></source> - <target><![CDATA[]]></target> + <target><![CDATA[Show only jobs that can be executed remotely.]]></target> </trans-unit> <trans-unit id="frontend.filter.selections.all" approved="yes"> <source><![CDATA[All]]></source> - <target><![CDATA[]]></target> + <target><![CDATA[All]]></target> </trans-unit> <trans-unit id="frontend.location" approved="yes"> <source><![CDATA[Location]]></source> @@ -239,4 +239,4 @@ </trans-unit> </body> </file> -</xliff> +</xliff> \ No newline at end of file diff --git a/Resources/Private/Partials/Job.html b/Resources/Private/Partials/Job.html index 9f8803b8..5051dd07 100644 --- a/Resources/Private/Partials/Job.html +++ b/Resources/Private/Partials/Job.html @@ -28,7 +28,19 @@ </f:if> </li> <li> - <f:format.raw><f:translate key="frontend.jobLocation" extensionName="project_theme" /></f:format.raw> + <f:if condition="{job.location}"> + <f:then> + <f:format.raw> + <f:translate key="frontend.locationLabel" extensionName="sg_jobs"/> + </f:format.raw> + {job.location} + </f:then> + <f:else> + <f:format.raw> + <f:translate key="frontend.jobLocation" extensionName="project_theme"/> + </f:format.raw> + </f:else> + </f:if> </li> </ul> diff --git a/Resources/Private/Templates/Joblist/ApplyForm.html b/Resources/Private/Templates/Joblist/ApplyForm.html index 19d7d688..5227d6c5 100644 --- a/Resources/Private/Templates/Joblist/ApplyForm.html +++ b/Resources/Private/Templates/Joblist/ApplyForm.html @@ -44,7 +44,21 @@ </f:else> </f:if> </li> - <li><f:format.raw><f:translate key="frontend.jobLocation" extensionName="project_theme" /></f:format.raw></li> + <li> + <f:if condition="{job.location}"> + <f:then> + <f:format.raw> + <f:translate key="frontend.locationLabel" extensionName="sg_jobs"/> + </f:format.raw> + {job.location} + </f:then> + <f:else> + <f:format.raw> + <f:translate key="frontend.jobLocation" extensionName="project_theme"/> + </f:format.raw> + </f:else> + </f:if> + </li> </ul> <hr> <h3><f:format.raw><f:translate key="frontend.jobApplyNow" extensionName="project_theme" /></f:format.raw></h3> diff --git a/ext_tables.sql b/ext_tables.sql index 3ab4477c..4b693a76 100644 --- a/ext_tables.sql +++ b/ext_tables.sql @@ -7,6 +7,7 @@ CREATE TABLE tx_sgjobs_domain_model_job ( qualification text DEFAULT '' NOT NULL, alternative_start_date text DEFAULT '' NOT NULL, start_date int(11) unsigned DEFAULT '0' NOT NULL, + location text DEFAULT '' NOT NULL, company text DEFAULT '' NOT NULL, telecommute_possible tinyint(4) unsigned DEFAULT '0' NOT NULL, office_work_possible tinyint(4) unsigned DEFAULT '1' NOT NULL, -- GitLab