diff --git a/.gitignore b/.gitignore index 24709e9d32..72bed4fc8a 100644 --- a/.gitignore +++ b/.gitignore @@ -35,4 +35,5 @@ nbproject public/test.pdf public/storage/test.pdf /Modules -_ide_helper_models.php \ No newline at end of file +_ide_helper_models.php +_ide_helper.php \ No newline at end of file diff --git a/_ide_helper.php b/_ide_helper.php index a14275a20c..26c323563f 100644 --- a/_ide_helper.php +++ b/_ide_helper.php @@ -4,7 +4,7 @@ /** * A helper file for Laravel, to provide autocomplete information to your IDE - * Generated for Laravel 9.52.4. + * Generated for Laravel 9.52.0. * * This file should not be included in your code, only analyzed by your IDE! * @@ -4193,7 +4193,7 @@ */ public static function lock($name, $seconds = 0, $owner = null) { - /** @var \Illuminate\Cache\RedisStore $instance */ + /** @var \Illuminate\Cache\FileStore $instance */ return $instance->lock($name, $seconds, $owner); } /** @@ -4206,7 +4206,7 @@ */ public static function restoreLock($name, $owner) { - /** @var \Illuminate\Cache\RedisStore $instance */ + /** @var \Illuminate\Cache\FileStore $instance */ return $instance->restoreLock($name, $owner); } /** @@ -4217,65 +4217,30 @@ */ public static function flush() { - /** @var \Illuminate\Cache\RedisStore $instance */ + /** @var \Illuminate\Cache\FileStore $instance */ return $instance->flush(); } /** - * Get the Redis connection instance. + * Get the Filesystem instance. * - * @return \Illuminate\Redis\Connections\Connection + * @return \Illuminate\Filesystem\Filesystem * @static */ - public static function connection() + public static function getFilesystem() { - /** @var \Illuminate\Cache\RedisStore $instance */ - return $instance->connection(); + /** @var \Illuminate\Cache\FileStore $instance */ + return $instance->getFilesystem(); } /** - * Get the Redis connection instance that should be used to manage locks. + * Get the working directory of the cache. * - * @return \Illuminate\Redis\Connections\Connection + * @return string * @static */ - public static function lockConnection() + public static function getDirectory() { - /** @var \Illuminate\Cache\RedisStore $instance */ - return $instance->lockConnection(); - } - /** - * Specify the name of the connection that should be used to store data. - * - * @param string $connection - * @return void - * @static - */ - public static function setConnection($connection) - { - /** @var \Illuminate\Cache\RedisStore $instance */ - $instance->setConnection($connection); - } - /** - * Specify the name of the connection that should be used to manage locks. - * - * @param string $connection - * @return \Illuminate\Cache\RedisStore - * @static - */ - public static function setLockConnection($connection) - { - /** @var \Illuminate\Cache\RedisStore $instance */ - return $instance->setLockConnection($connection); - } - /** - * Get the Redis database instance. - * - * @return \Illuminate\Contracts\Redis\Factory - * @static - */ - public static function getRedis() - { - /** @var \Illuminate\Cache\RedisStore $instance */ - return $instance->getRedis(); + /** @var \Illuminate\Cache\FileStore $instance */ + return $instance->getDirectory(); } /** * Get the cache key prefix. @@ -4285,20 +4250,8 @@ */ public static function getPrefix() { - /** @var \Illuminate\Cache\RedisStore $instance */ + /** @var \Illuminate\Cache\FileStore $instance */ return $instance->getPrefix(); - } - /** - * Set the cache key prefix. - * - * @param string $prefix - * @return void - * @static - */ - public static function setPrefix($prefix) - { - /** @var \Illuminate\Cache\RedisStore $instance */ - $instance->setPrefix($prefix); } } @@ -9901,44 +9854,45 @@ return $instance->setConnectionName($name); } /** - * Migrate the delayed jobs that are ready to the regular queue. + * Release a reserved job back onto the queue after (n) seconds. * - * @param string $from - * @param string $to - * @param int $limit - * @return array + * @param string $queue + * @param \Illuminate\Queue\Jobs\DatabaseJobRecord $job + * @param int $delay + * @return mixed * @static */ - public static function migrateExpiredJobs($from, $to) + public static function release($queue, $job, $delay) { - /** @var \Illuminate\Queue\RedisQueue $instance */ - return $instance->migrateExpiredJobs($from, $to); + /** @var \Illuminate\Queue\DatabaseQueue $instance */ + return $instance->release($queue, $job, $delay); } /** * Delete a reserved job from the queue. * * @param string $queue - * @param \Illuminate\Queue\Jobs\RedisJob $job + * @param string $id * @return void + * @throws \Throwable * @static */ - public static function deleteReserved($queue, $job) + public static function deleteReserved($queue, $id) { - /** @var \Illuminate\Queue\RedisQueue $instance */ - $instance->deleteReserved($queue, $job); + /** @var \Illuminate\Queue\DatabaseQueue $instance */ + $instance->deleteReserved($queue, $id); } /** * Delete a reserved job from the reserved queue and release it. * * @param string $queue - * @param \Illuminate\Queue\Jobs\RedisJob $job + * @param \Illuminate\Queue\Jobs\DatabaseJob $job * @param int $delay * @return void * @static */ public static function deleteAndRelease($queue, $job, $delay) { - /** @var \Illuminate\Queue\RedisQueue $instance */ + /** @var \Illuminate\Queue\DatabaseQueue $instance */ $instance->deleteAndRelease($queue, $job, $delay); } /** @@ -9950,7 +9904,7 @@ */ public static function clear($queue) { - /** @var \Illuminate\Queue\RedisQueue $instance */ + /** @var \Illuminate\Queue\DatabaseQueue $instance */ return $instance->clear($queue); } /** @@ -9962,30 +9916,19 @@ */ public static function getQueue($queue) { - /** @var \Illuminate\Queue\RedisQueue $instance */ + /** @var \Illuminate\Queue\DatabaseQueue $instance */ return $instance->getQueue($queue); } /** - * Get the connection for the queue. + * Get the underlying database instance. * - * @return \Illuminate\Redis\Connections\Connection + * @return \Illuminate\Database\Connection * @static */ - public static function getConnection() + public static function getDatabase() { - /** @var \Illuminate\Queue\RedisQueue $instance */ - return $instance->getConnection(); - } - /** - * Get the underlying Redis instance. - * - * @return \Illuminate\Contracts\Redis\Factory - * @static - */ - public static function getRedis() - { - /** @var \Illuminate\Queue\RedisQueue $instance */ - return $instance->getRedis(); + /** @var \Illuminate\Queue\DatabaseQueue $instance */ + return $instance->getDatabase(); } /** * Get the backoff for an object-based queue handler. @@ -9996,7 +9939,7 @@ */ public static function getJobBackoff($job) { //Method inherited from \Illuminate\Queue\Queue - /** @var \Illuminate\Queue\RedisQueue $instance */ + /** @var \Illuminate\Queue\DatabaseQueue $instance */ return $instance->getJobBackoff($job); } /** @@ -10008,7 +9951,7 @@ */ public static function getJobExpiration($job) { //Method inherited from \Illuminate\Queue\Queue - /** @var \Illuminate\Queue\RedisQueue $instance */ + /** @var \Illuminate\Queue\DatabaseQueue $instance */ return $instance->getJobExpiration($job); } /** @@ -10020,7 +9963,7 @@ */ public static function createPayloadUsing($callback) { //Method inherited from \Illuminate\Queue\Queue - \Illuminate\Queue\RedisQueue::createPayloadUsing($callback); + \Illuminate\Queue\DatabaseQueue::createPayloadUsing($callback); } /** * Get the container instance being used by the connection. @@ -10030,7 +9973,7 @@ */ public static function getContainer() { //Method inherited from \Illuminate\Queue\Queue - /** @var \Illuminate\Queue\RedisQueue $instance */ + /** @var \Illuminate\Queue\DatabaseQueue $instance */ return $instance->getContainer(); } /** @@ -10042,7 +9985,7 @@ */ public static function setContainer($container) { //Method inherited from \Illuminate\Queue\Queue - /** @var \Illuminate\Queue\RedisQueue $instance */ + /** @var \Illuminate\Queue\DatabaseQueue $instance */ $instance->setContainer($container); } @@ -10860,12 +10803,12 @@ * Clones a request and overrides some of its parameters. * * @return static - * @param array|null $query The GET parameters - * @param array|null $request The POST parameters - * @param array|null $attributes The request attributes (parameters parsed from the PATH_INFO, ...) - * @param array|null $cookies The COOKIE parameters - * @param array|null $files The FILES parameters - * @param array|null $server The SERVER parameters + * @param array $query The GET parameters + * @param array $request The POST parameters + * @param array $attributes The request attributes (parameters parsed from the PATH_INFO, ...) + * @param array $cookies The COOKIE parameters + * @param array $files The FILES parameters + * @param array $server The SERVER parameters * @static */ public static function duplicate($query = null, $request = null, $attributes = null, $cookies = null, $files = null, $server = null) @@ -17854,6 +17797,25 @@ /** * * + * @method static void createSubscription(array|string $channels, \Closure $callback, string $method = 'subscribe') + * @method static \Illuminate\Redis\Limiters\ConcurrencyLimiterBuilder funnel(string $name) + * @method static \Illuminate\Redis\Limiters\DurationLimiterBuilder throttle(string $name) + * @method static mixed client() + * @method static void subscribe(array|string $channels, \Closure $callback) + * @method static void psubscribe(array|string $channels, \Closure $callback) + * @method static mixed command(string $method, array $parameters = []) + * @method static void listen(\Closure $callback) + * @method static string|null getName() + * @method static \Illuminate\Redis\Connections\Connection setName(string $name) + * @method static \Illuminate\Contracts\Events\Dispatcher getEventDispatcher() + * @method static void setEventDispatcher(\Illuminate\Contracts\Events\Dispatcher $events) + * @method static void unsetEventDispatcher() + * @method static void macro(string $name, object|callable $macro) + * @method static void mixin(object $mixin, bool $replace = true) + * @method static bool hasMacro(string $name) + * @method static void flushMacros() + * @method static mixed macroCall(string $method, array $parameters) + * @see \Illuminate\Redis\RedisManager */ class Redis { /** diff --git a/app/Import/Providers/BaseImport.php b/app/Import/Providers/BaseImport.php index 758c12a8ef..78e3a6ad2c 100644 --- a/app/Import/Providers/BaseImport.php +++ b/app/Import/Providers/BaseImport.php @@ -93,7 +93,10 @@ class BaseImport $csv = base64_decode($base64_encoded_csv); $csv = Reader::createFromString($csv); + $csvdelimiter = self::detectDelimiter($csv); + nlog("delmiter = {$csvdelimiter}"); + $csv->setDelimiter($csvdelimiter); $stmt = new Statement(); $data = iterator_to_array($stmt->process($csv)); @@ -118,6 +121,20 @@ class BaseImport return $data; } + public function detectDelimiter($csvfile) + { + $delimiters = [',', '.', ';']; + $bestDelimiter = ' '; + $count = 0; + foreach ($delimiters as $delimiter) { + if (substr_count($csvfile, $delimiter) > $count) { + $count = substr_count($csvfile, $delimiter); + $bestDelimiter = $delimiter; + } + } + return $bestDelimiter; + } + public function mapCSVHeaderToKeys($csvData) { $keys = array_shift($csvData); @@ -619,9 +636,8 @@ class BaseImport public function preTransform(array $data, $entity_type) { - //sort the array by key - // $keys = $this->column_map[$entity_type]; + $keys = array_shift($data); ksort($keys); @@ -643,9 +659,10 @@ class BaseImport //sort the array by key $keys = $this->column_map[$entity_type]; ksort($keys); +nlog($keys); $data = array_map(function ($row) use ($keys) { - +nlog($row); $row_count = count($row); $key_count = count($keys);