From ddc07729dcc553459b64d41e235b121fbde7bea0 Mon Sep 17 00:00:00 2001
From: Torsten Oppermann <torsten@sgalinski.de>
Date: Tue, 24 Jul 2018 15:43:44 +0200
Subject: [PATCH] [TASK] Add zip field to company model and tca

---
 Classes/Domain/Model/Company.php              | 21 ++++++++++++++++++-
 .../TCA/tx_sgjobs_domain_model_company.php    | 17 +++++++++++----
 .../Private/Language/de.locallang_db.xlf      |  6 +++++-
 Resources/Private/Language/locallang_db.xlf   |  5 ++++-
 4 files changed, 42 insertions(+), 7 deletions(-)

diff --git a/Classes/Domain/Model/Company.php b/Classes/Domain/Model/Company.php
index e425e13d..9eebce28 100644
--- a/Classes/Domain/Model/Company.php
+++ b/Classes/Domain/Model/Company.php
@@ -32,6 +32,11 @@ use TYPO3\CMS\Extbase\DomainObject\AbstractEntity;
  * The Company model
  */
 class Company extends AbstractEntity {
+	/**
+	 * @var string $zip
+	 */
+	protected $zip = '';
+
 	/**
 	 * @var string $city
 	 */
@@ -66,7 +71,7 @@ class Company extends AbstractEntity {
 	 * @var \SGalinski\SgJobs\Domain\Model\Contact $contact
 	 */
 	protected $contact;
-	
+
 	/**
 	 * @return string
 	 */
@@ -164,4 +169,18 @@ class Company extends AbstractEntity {
 	public function setJobId(string $jobId) {
 		$this->jobId = $jobId;
 	}
+
+	/**
+	 * @return string
+	 */
+	public function getZip() {
+		return $this->zip;
+	}
+
+	/**
+	 * @param string $zip
+	 */
+	public function setZip($zip) {
+		$this->zip = $zip;
+	}
 }
diff --git a/Configuration/TCA/tx_sgjobs_domain_model_company.php b/Configuration/TCA/tx_sgjobs_domain_model_company.php
index e304cf33..af3b8603 100644
--- a/Configuration/TCA/tx_sgjobs_domain_model_company.php
+++ b/Configuration/TCA/tx_sgjobs_domain_model_company.php
@@ -8,7 +8,7 @@ return [
 		'crdate' => 'crdate',
 		'cruser_id' => 'cruser_id',
 		'dividers2tabs' => TRUE,
-		'searchFields' => 'job_id, city, country, description, name, street, contact',
+		'searchFields' => 'job_id, zip, city, country, description, name, street, contact',
 		'versioningWS' => 2,
 		'versioning_followPages' => TRUE,
 		'origUid' => 't3_origuid',
@@ -26,12 +26,12 @@ return [
 			'Resources/Public/Icons/tx_sgjobs_domain_model_company.svg'
 	],
 	'interface' => [
-		'showRecordFieldList' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, pid, job_id, city, street name, country, description, contact',
+		'showRecordFieldList' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, pid, job_id, zip, city, street name, country, description, contact',
 	],
 	'types' => [
 		'1' => [
 			'showitem' => '--palette--;;sysLanguageAndHidden,
-				job_id, city, street,name, country, description, contact;;;richtext[*]:rte_transform[mode=ts],
+				job_id, zip, city, street,name, country, description, contact;;;richtext[*]:rte_transform[mode=ts],
 				--div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.access, starttime, endtime',
 		],
 	],
@@ -122,6 +122,15 @@ return [
 				],
 			],
 		],
+		'zip' => [
+			'exclude' => 0,
+			'label' => 'LLL:EXT:sg_jobs/Resources/Private/Language/locallang_db.xlf:tx_sgjobs_domain_model_company.zip',
+			'config' => [
+				'type' => 'input',
+				'size' => 30,
+				'eval' => 'trim'
+			],
+		],
 		'city' => [
 			'exclude' => 0,
 			'label' => 'LLL:EXT:sg_jobs/Resources/Private/Language/locallang_db.xlf:tx_sgjobs_domain_model_company.city',
@@ -200,4 +209,4 @@ return [
 			]
 		]
 	],
-];
\ No newline at end of file
+];
diff --git a/Resources/Private/Language/de.locallang_db.xlf b/Resources/Private/Language/de.locallang_db.xlf
index e020b309..7bf3df8f 100644
--- a/Resources/Private/Language/de.locallang_db.xlf
+++ b/Resources/Private/Language/de.locallang_db.xlf
@@ -97,6 +97,10 @@
 			<source>City</source>
 			<target>Stadt</target>
 		</trans-unit>
+		<trans-unit id="tx_sgjobs_domain_model_contact.zip" approved="yes">
+			<source>Zip code</source>
+			<target>PLZ</target>
+		</trans-unit>
 		<trans-unit id="tx_sgjobs_domain_model_contact.company" approved="yes">
 			<source>Company</source>
 			<target>Firma</target>
@@ -327,4 +331,4 @@
 		</trans-unit>
 		</body>
 	</file>
-</xliff>
\ No newline at end of file
+</xliff>
diff --git a/Resources/Private/Language/locallang_db.xlf b/Resources/Private/Language/locallang_db.xlf
index b84927c0..2891b45d 100644
--- a/Resources/Private/Language/locallang_db.xlf
+++ b/Resources/Private/Language/locallang_db.xlf
@@ -54,6 +54,9 @@
 		<trans-unit id="tx_sgjobs_domain_model_company.city">
 			<source>City</source>
 		</trans-unit>
+		<trans-unit id="tx_sgjobs_domain_model_company.zip">
+			<source>Zip code</source>
+		</trans-unit>
 		<trans-unit id="tx_sgjobs_domain_model_company.country">
 			<source>Country</source>
 		</trans-unit>
@@ -248,4 +251,4 @@
 		</trans-unit>
 		</body>
 	</file>
-</xliff>
\ No newline at end of file
+</xliff>
-- 
GitLab