diff --git a/migration/19.12/migrateCustomFields.php b/migration/19.12/migrateCustomFields.php new file mode 100644 index 0000000000000000000000000000000000000000..de57ab6cdc3ba18cd5c93c855eedf52cde0720d1 --- /dev/null +++ b/migration/19.12/migrateCustomFields.php @@ -0,0 +1,66 @@ +<?php + +require '../../vendor/autoload.php'; + +chdir('../..'); + +$migrated = 0; +$customs = scandir('custom'); + +foreach ($customs as $custom) { + if ($custom == 'custom.xml' || $custom == '.' || $custom == '..') { + continue; + } + + $natures = []; + $migrated = 0; + $path = "custom/{$custom}/apps/maarch_entreprise/xml/index_letterbox.xml"; + if (file_exists($path)) { + if (!is_readable($path) || !is_writable($path)) { + continue; + } + $loadedXml = simplexml_load_file($path); + + if ($loadedXml) { + $i = 0; + foreach ($loadedXml->INDEX as $value) { + $label = (string)$value->label; + $type = (string)$value->type; + + $values = []; + if (!empty($value->values_list)) { + foreach ($value->values_list->value as $valueList) { + $values[] = (string)$valueList->label; + } + } + if (!empty($value->table) && !empty($value->table->table_name) && !empty($value->table->foreign_label)) { + + $tableName = (string)$value->table->table_name; + $foreignLabel = (string)$value->table->foreign_label; + $whereClause = (string)$value->table->where_clause; + $order = (string)$value->table->order; + + $customValues = \SrcCore\models\DatabaseModel::select([ + 'select' => [$foreignLabel], + 'table' => [$tableName], + 'where' => empty($whereClause) ? [] : [$whereClause], + 'order_by' => [str_ireplace("order by", "", $order)] + ]); + + foreach ($customValues as $valueList) { + $values[] = $valueList[$foreignLabel]; + } + } + + \CustomField\models\CustomFieldModel::create([ + 'label' => $label, + 'type' => $type, + 'values' => empty($values) ? null : json_encode($values) + ]); + $migrated++; + } + } + } + + printf("Migration Champs Custom (CUSTOM {$custom}) : " . $migrated . " Champs custom trouvé(s) et migré(s).\n"); +} diff --git a/migration/19.12/migrateIndexing.php b/migration/19.12/migrateIndexing.php index a79645c6fa4a44356e52e0310359c4c25a39ad9e..8152eaa16974aee64ce6872bd8f8e729d6042562 100644 --- a/migration/19.12/migrateIndexing.php +++ b/migration/19.12/migrateIndexing.php @@ -4,7 +4,6 @@ require '../../vendor/autoload.php'; chdir('../..'); -$migrated = 0; $customs = scandir('custom'); foreach ($customs as $custom) { if ($custom == 'custom.xml' || $custom == '.' || $custom == '..') { @@ -16,6 +15,7 @@ foreach ($customs as $custom) { $groupBasket = \Basket\models\GroupBasketModel::get(['select' => ['group_id'], 'where' => ['basket_id = ?'], 'data' => ['IndexingBasket']]); + $migrated = 0; foreach ($groupBasket as $value) { $hasService = \SrcCore\models\DatabaseModel::select([ 'select' => [1], diff --git a/src/app/customField/models/CustomFieldModel.php b/src/app/customField/models/CustomFieldModel.php index d15dc103144d046301ae19d2c7e526e9cf5dab22..66b31c5ac2e8be86b2a6c9aba0599d4ff3a3c409 100644 --- a/src/app/customField/models/CustomFieldModel.php +++ b/src/app/customField/models/CustomFieldModel.php @@ -59,8 +59,7 @@ class CustomFieldModel public static function create(array $args) { ValidatorModel::notEmpty($args, ['label', 'type']); - ValidatorModel::stringType($args, ['label', 'type']); - ValidatorModel::arrayType($args, ['values']); + ValidatorModel::stringType($args, ['label', 'type', 'values']); $nextSequenceId = DatabaseModel::getNextSequenceValue(['sequenceId' => 'custom_fields_id_seq']); diff --git a/vendor/composer/ClassLoader.php b/vendor/composer/ClassLoader.php index dc02dfb114fb6af2eacf89407a529c37ab8e7eb8..fce8549f0781bafdc7da2301b84d048286757445 100755 --- a/vendor/composer/ClassLoader.php +++ b/vendor/composer/ClassLoader.php @@ -279,7 +279,7 @@ class ClassLoader */ public function setApcuPrefix($apcuPrefix) { - $this->apcuPrefix = function_exists('apcu_fetch') && ini_get('apc.enabled') ? $apcuPrefix : null; + $this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null; } /** @@ -377,7 +377,7 @@ class ClassLoader $subPath = $class; while (false !== $lastPos = strrpos($subPath, '\\')) { $subPath = substr($subPath, 0, $lastPos); - $search = $subPath.'\\'; + $search = $subPath . '\\'; if (isset($this->prefixDirsPsr4[$search])) { $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1); foreach ($this->prefixDirsPsr4[$search] as $dir) { diff --git a/vendor/composer/LICENSE b/vendor/composer/LICENSE index f0157a6ed025c0168a2f595d09a98b800c5ba431..f27399a042d95c4708af3a8c74d35d338763cf8f 100755 --- a/vendor/composer/LICENSE +++ b/vendor/composer/LICENSE @@ -1,56 +1,21 @@ -Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ -Upstream-Name: Composer -Upstream-Contact: Jordi Boggiano <j.boggiano@seld.be> -Source: https://github.com/composer/composer -Files: * -Copyright: 2016, Nils Adermann <naderman@naderman.de> - 2016, Jordi Boggiano <j.boggiano@seld.be> -License: Expat +Copyright (c) Nils Adermann, Jordi Boggiano -Files: src/Composer/Util/TlsHelper.php -Copyright: 2016, Nils Adermann <naderman@naderman.de> - 2016, Jordi Boggiano <j.boggiano@seld.be> - 2013, Evan Coury <me@evancoury.com> -License: Expat and BSD-2-Clause +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is furnished +to do so, subject to the following conditions: -License: BSD-2-Clause - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - . - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - . - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - . - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. -License: Expat - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is furnished - to do so, subject to the following conditions: - . - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - . - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - THE SOFTWARE. diff --git a/vendor/composer/autoload_psr4.php b/vendor/composer/autoload_psr4.php index 370f791934e1436aa719ce9ed1cc2622835f6088..08718f5140bfe6b7c50fcfe353c0832f607e5127 100755 --- a/vendor/composer/autoload_psr4.php +++ b/vendor/composer/autoload_psr4.php @@ -65,6 +65,7 @@ return array( 'Email\\' => array($baseDir . '/src/app/email'), 'Doctype\\' => array($baseDir . '/src/app/doctype'), 'Docserver\\' => array($baseDir . '/src/app/docserver'), + 'CustomField\\' => array($baseDir . '/src/app/customField'), 'Convert\\' => array($baseDir . '/src/app/convert'), 'ContentManagement\\' => array($baseDir . '/src/app/contentManagement'), 'Contact\\' => array($baseDir . '/src/app/contact'), diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php index 6947fbbfffa9fca6c2d51fc4ffbf2aec07d5c1db..9ab40884ebc33539d53535a10d92f8d2e8949230 100755 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -138,6 +138,7 @@ class ComposerStaticInitf21aebccfa6df888200dcb099aa69fbd ), 'C' => array ( + 'CustomField\\' => 12, 'Convert\\' => 8, 'ContentManagement\\' => 18, 'Contact\\' => 8, @@ -396,6 +397,10 @@ class ComposerStaticInitf21aebccfa6df888200dcb099aa69fbd array ( 0 => __DIR__ . '/../..' . '/src/app/docserver', ), + 'CustomField\\' => + array ( + 0 => __DIR__ . '/../..' . '/src/app/customField', + ), 'Convert\\' => array ( 0 => __DIR__ . '/../..' . '/src/app/convert',