From 68cfc6851537980fbc3812717370e6d1dce54082 Mon Sep 17 00:00:00 2001 From: Alex Worrad-Andrews Date: Wed, 19 Apr 2023 15:26:53 +0100 Subject: [PATCH 01/12] Make ProductSupply into an array --- src/Product/Product.php | 36 +++++++++++++++++++++++++++++------- 1 file changed, 29 insertions(+), 7 deletions(-) diff --git a/src/Product/Product.php b/src/Product/Product.php index 4a61cce..3031236 100644 --- a/src/Product/Product.php +++ b/src/Product/Product.php @@ -81,9 +81,9 @@ class Product /** * ProductSupply * - * @var ProductSupply + * @var array|ProductSupply */ - protected $ProductSupply; + protected $ProductSupply = []; /** * Set the Products record reference @@ -206,15 +206,37 @@ public function setRelatedMaterial(RelatedMaterial $RelatedMaterial) $this->RelatedMaterial = $RelatedMaterial; } + // /** + // * Set ProductSupply + // * + // * @param ProductSupply $ProductSupply + // * @return void + // */ + // public function setProductSupply(ProductSupply $ProductSupply) + // { + // $this->ProductSupply = $ProductSupply; + // } + + /** + * Add a new Product Supply + * + * @param ProductSupply $productSupply + * @return void + */ + public function addProductSupply(ProductSupply $productSupply) + { + $this->ProductSupply[] = $productSupply; + } + /** - * Set ProductSupply + * Remove Product Supply * - * @param ProductSupply $ProductSupply + * @param ProductSupply $productSupply * @return void */ - public function setProductSupply(ProductSupply $ProductSupply) + public function removeProductSupply(ProductSupply $productSupply) { - $this->ProductSupply = $ProductSupply; + $this->ProductSupply[] = $productSupply; } /** @@ -317,4 +339,4 @@ public function getRecordSourceName() return $this->RecordSourceName; } -} \ No newline at end of file +} From 2fb32d9c93e09c721a906f2aa639fbcaa7b8686d Mon Sep 17 00:00:00 2001 From: Alex Worrad-Andrews Date: Wed, 19 Apr 2023 15:28:19 +0100 Subject: [PATCH 02/12] Removed commented out code --- src/Product/Product.php | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/src/Product/Product.php b/src/Product/Product.php index 3031236..a69219a 100644 --- a/src/Product/Product.php +++ b/src/Product/Product.php @@ -206,17 +206,6 @@ public function setRelatedMaterial(RelatedMaterial $RelatedMaterial) $this->RelatedMaterial = $RelatedMaterial; } - // /** - // * Set ProductSupply - // * - // * @param ProductSupply $ProductSupply - // * @return void - // */ - // public function setProductSupply(ProductSupply $ProductSupply) - // { - // $this->ProductSupply = $ProductSupply; - // } - /** * Add a new Product Supply * From 23f016ac2caf9fe70fee7e3d69392c994c1a496a Mon Sep 17 00:00:00 2001 From: Alex Worrad-Andrews Date: Fri, 21 Apr 2023 16:15:12 +0100 Subject: [PATCH 03/12] Allow ContributorStatements to be an array --- src/Product/DescriptiveDetail.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Product/DescriptiveDetail.php b/src/Product/DescriptiveDetail.php index 8d3880d..333e0ae 100644 --- a/src/Product/DescriptiveDetail.php +++ b/src/Product/DescriptiveDetail.php @@ -75,11 +75,11 @@ class DescriptiveDetail protected $Contributor = []; /** - * ContributorStatement + * Array of ContributorStatements * * @var string */ - protected $ContributorStatement; + protected $ContributorStatement = []; /** * EditionNumber @@ -272,14 +272,14 @@ public function removeContributor(Contributor $Contributor) } /** - * Set ContributorStatement + * Add ContributorStatement * * @param string $ContributorStatement * @return void */ - public function setContributorStatement(string $ContributorStatement) + public function addContributorStatement(string $ContributorStatement) { - $this->ContributorStatement = $ContributorStatement; + $this->ContributorStatement[] = $ContributorStatement; } /** From 50e4b9fa6aafbb1be0f7c1d10b95763175ad61d8 Mon Sep 17 00:00:00 2001 From: Alex Worrad-Andrews Date: Fri, 21 Apr 2023 18:26:05 +0100 Subject: [PATCH 04/12] Allow code list 220 to be parsed out --- src/Product/ProductFormFeature.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Product/ProductFormFeature.php b/src/Product/ProductFormFeature.php index 5ca8efb..d638f37 100644 --- a/src/Product/ProductFormFeature.php +++ b/src/Product/ProductFormFeature.php @@ -4,6 +4,7 @@ use Ribal\Onix\CodeList\CodeList79; use Ribal\Onix\CodeList\CodeList98; +use Ribal\Onix\CodeList\CodeList220; class ProductFormFeature { @@ -43,10 +44,10 @@ public function setProductFormFeatureType(CodeList79 $ProductFormFeatureType) /** * Set ProductFormFeatureValue * - * @param CodeList98 $ProductFormFeatureValue + * @param CodeList220 | CodeList98 $ProductFormFeatureValue * @return void */ - public function setProductFormFeatureValue(CodeList98 $ProductFormFeatureValue) + public function setProductFormFeatureValue(CodeList220 | CodeList98 $ProductFormFeatureValue) { $this->ProductFormFeatureValue = $ProductFormFeatureValue; } @@ -91,4 +92,4 @@ public function getProductFormFeatureDescription() { return $this->ProductFormFeatureDescription; } -} \ No newline at end of file +} From 598b45fe7582a0ac42d1d888480b240300e5e9c7 Mon Sep 17 00:00:00 2001 From: Alex Worrad-Andrews Date: Sun, 30 Apr 2023 12:31:11 +0100 Subject: [PATCH 05/12] Add fork details to Composer Forked library has details in Composer --- composer.json | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index ed19e7b..b4b9466 100644 --- a/composer.json +++ b/composer.json @@ -1,5 +1,5 @@ { - "name": "ribal/onix", + "name": "commonknowledge/onix", "description": "An ONIX 3.0 Parser", "type": "library", "license": "MIT", @@ -7,6 +7,10 @@ { "name": "Chris Ribal", "email": "c.ribal@ribal-webentwicklung.de" + }, + { + "name": "Common Knowledge", + "email": "hello@commonknowledge.coop" } ], "require": { @@ -19,4 +23,4 @@ "Ribal\\Onix\\": "src/" } } -} \ No newline at end of file +} From 3f23dc8095fe97ef0b8a7d2a38110532e543f4e8 Mon Sep 17 00:00:00 2001 From: Alex Worrad-Andrews Date: Mon, 1 May 2023 16:49:00 +0100 Subject: [PATCH 06/12] Create Stock.php Add Stock class for displaying stock --- src/Product/Stock.php | 62 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 src/Product/Stock.php diff --git a/src/Product/Stock.php b/src/Product/Stock.php new file mode 100644 index 0000000..edfbf99 --- /dev/null +++ b/src/Product/Stock.php @@ -0,0 +1,62 @@ +LocationName = $LocationName; + } + + /** + * Get PublisherName + * + * @return string + */ + public function getLocationName() + { + return $this->LocationName; + } + + /** + * Set OnHand + * + * @param string $OnHand + * @return void + */ + public function setOnHand(int $OnHand) + { + $this->OnHand = $OnHand; + } + + /** + * Get OnHand + * + * @return string + */ + public function getOnHand() + { + return $this->OnHand; + } +} From a439ddcaed19504ec863e9e16e7cf66e459ab0e4 Mon Sep 17 00:00:00 2001 From: Alex Worrad-Andrews Date: Mon, 1 May 2023 16:50:01 +0100 Subject: [PATCH 07/12] Add Stock to supply detail to allow supply to be read --- src/Product/SupplyDetail.php | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/Product/SupplyDetail.php b/src/Product/SupplyDetail.php index 136a847..f663073 100644 --- a/src/Product/SupplyDetail.php +++ b/src/Product/SupplyDetail.php @@ -28,6 +28,13 @@ class SupplyDetail */ protected $ProductAvailability; + /** + * Stock + * + * @var Stock + */ + protected $Stock; + /** * PackQuantity * @@ -144,6 +151,27 @@ public function getProductAvailability() return $this->ProductAvailability; } + /** + * Get Stock + * + * @return Stock + */ + public function getStock() + { + return $this->Stock; + } + + /** + * Set Stock + * + * @param Stock $Stock + * @return void + */ + public function setStock(Stock $Stock) + { + $this->Stock = $Stock; + } + /** * Get PackQuantity * From 23edbc935f3c6a40b60fa5530676c4013a288a26 Mon Sep 17 00:00:00 2001 From: Alex Worrad-Andrews Date: Tue, 2 May 2023 22:57:26 +0100 Subject: [PATCH 08/12] Add support for author of content --- src/Product/TextContent.php | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/src/Product/TextContent.php b/src/Product/TextContent.php index 9b86bed..dc3d378 100644 --- a/src/Product/TextContent.php +++ b/src/Product/TextContent.php @@ -10,7 +10,7 @@ class TextContent { - private const CODE_MAINDESCRIPTION = '03'; + private const CODE_MAINDESCRIPTION = '03'; /** * Type of the Text @@ -33,6 +33,13 @@ class TextContent */ protected $SourceTitle; + /** + * TextAuthor + * + * @var string + */ + protected $TextAuthor; + /** * Text * @@ -73,6 +80,27 @@ public function setSourceTitle(string $SourceTitle) $this->SourceTitle = $SourceTitle; } + /** + * Set TextAuthor + * + * @param string $TextAuthor + * @return void + */ + public function setTextAuthor(string $TextAuthor) + { + $this->TextAuthor = $TextAuthor; + } + + /** + * Get TextAuthor + * + * @return string $TextAuthor + */ + public function getTextAuthor() + { + return $this->TextAuthor; + } + /** * Set Text * From ad0599109fa54510c50df98c848ca134460398bb Mon Sep 17 00:00:00 2001 From: Alex Worrad-Andrews Date: Thu, 4 May 2023 20:13:47 +0100 Subject: [PATCH 09/12] Fix NameIdentifier - allow multiple name identifiers correctly --- src/Product/Contributor.php | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/src/Product/Contributor.php b/src/Product/Contributor.php index ec0bbd9..57d3b8c 100644 --- a/src/Product/Contributor.php +++ b/src/Product/Contributor.php @@ -29,7 +29,7 @@ class Contributor * * @var array|NameIdentifier */ - protected $NameIdentifiers = []; + protected $NameIdentifier = []; /** * NamesBeforeKey @@ -80,9 +80,21 @@ public function setContributorRole(CodeList17 $ContributorRole) * @param NameIdentifier $NameIdentifier * @return void */ - public function setNameIdentifier(NameIdentifier $NameIdentifier) + public function addNameIdentifier(NameIdentifier $NameIdentifier) { - $this->NameIdentifiers[] = $NameIdentifier; + echo "Hitting addNameIdentifier\n"; + $this->NameIdentifier[] = $NameIdentifier; + } + + /** + * Remove NameIdentifier + * + * @param NameIdentifier $NameIdentifier + * @return void + */ + public function removeNameIdentifier(NameIdentifier $NameIdentifier) + { + $this->NameIdentifier[] = $NameIdentifier; } /** @@ -138,6 +150,16 @@ public function getContributorRole() return $this->ContributorRole; } + /** + * Get NameIdentifiers + * + * @return array + */ + public function getNameIdentifier() + { + return $this->NameIdentifier; + } + /** * Get NameIdentifiers * @@ -145,7 +167,7 @@ public function getContributorRole() */ public function getNameIdentifiers() { - return $this->NameIdentifiers; + return $this->NameIdentifier; } /** From 5cefaf7bc007a19fc80311048347d843e4385766 Mon Sep 17 00:00:00 2001 From: Alex Worrad-Andrews Date: Thu, 4 May 2023 21:24:37 +0100 Subject: [PATCH 10/12] Remove debugging code --- src/Product/Contributor.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Product/Contributor.php b/src/Product/Contributor.php index 57d3b8c..cd1574a 100644 --- a/src/Product/Contributor.php +++ b/src/Product/Contributor.php @@ -82,7 +82,6 @@ public function setContributorRole(CodeList17 $ContributorRole) */ public function addNameIdentifier(NameIdentifier $NameIdentifier) { - echo "Hitting addNameIdentifier\n"; $this->NameIdentifier[] = $NameIdentifier; } From 0ce12624e95609c1d291e47b20e47a216821e809 Mon Sep 17 00:00:00 2001 From: Steve Date: Mon, 15 May 2023 11:56:53 +0100 Subject: [PATCH 11/12] allow multiple workIdentifiers --- src/Product/RelatedWork.php | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/src/Product/RelatedWork.php b/src/Product/RelatedWork.php index da44813..0e4d7f6 100644 --- a/src/Product/RelatedWork.php +++ b/src/Product/RelatedWork.php @@ -15,11 +15,11 @@ class RelatedWork protected $WorkRelationCode; /** - * WorkIdentifier + * Array of WorkIdentifiers * - * @var WorkIdentifier + * @var arrayWorkIdentifier */ - protected $WorkIdentifier; + protected $WorkIdentifier = []; /** * Set WorkRelationCode @@ -33,14 +33,14 @@ public function setWorkRelationCode(CodeList164 $WorkRelationCode) } /** - * Set WorkIdentifier + * Add a new WorkIdentifier * * @param WorkIdentifier $WorkIdentifier * @return void */ - public function setWorkIdentifier(WorkIdentifier $WorkIdentifier) + public function addWorkIdentifier(WorkIdentifier $WorkIdentifier) { - $this->WorkIdentifier = $WorkIdentifier; + $this->WorkIdentifier[] = $WorkIdentifier; } /** @@ -56,11 +56,21 @@ public function getWorkRelationCode() /** * WorkIdentifier * - * @return WorkIdentifier + * @return array */ public function getWorkIdentifier() { return $this->WorkIdentifier; } + /** + * Remove WorkIdentifier + * + * @param WorkIdentifier $WorkIdentifier + * @return void + */ + public function removeWorkIdentifier(WorkIdentifier $WorkIdentifier) + { + } + } \ No newline at end of file From 4be4ebea0da84e78c8dafc497d6774027e353f52 Mon Sep 17 00:00:00 2001 From: Steve Date: Tue, 25 Jul 2023 15:28:53 +0100 Subject: [PATCH 12/12] add website to contributor --- src/Product/Contributor.php | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/Product/Contributor.php b/src/Product/Contributor.php index cd1574a..b70e33d 100644 --- a/src/Product/Contributor.php +++ b/src/Product/Contributor.php @@ -52,6 +52,12 @@ class Contributor */ protected $KeyNames; + /** + * Website + * + * @var Website + */ + protected $Website; /** * Set SequenceNumber * @@ -229,4 +235,25 @@ public function isAuthor() return $this->ContributorRole->getCode() === self::CODE_AUTHOR; } + /** + * Set Website + * + * @param Website $Website + * @return void + */ + public function setWebsite(Website $Website) + { + $this->Website = $Website; + } + + /** + * Get Website + * + * @return Website + */ + public function getWebsite() + { + return $this->Website; + } + }