From bcda409a92da11a8db044dc247982fd92bd7ff8d Mon Sep 17 00:00:00 2001 From: Michael RICOIS Date: Fri, 25 Sep 2015 12:38:03 +0000 Subject: [PATCH] Composer, Nettoyage --- TODELETE | 31 -- bin/classmap_generator.php | 248 --------- bin/zf.bat | 44 -- bin/zf.php | 624 ----------------------- bin/zf.sh | 45 -- composer.json | 25 + composer.lock | 66 +++ docs/CRONTAB | 11 + public/index.php | 53 +- scripts/build/classmap.php | 33 -- scripts/build/configure.php | 35 +- scripts/build/getCatalog.php | 41 +- scripts/cron.php | 16 - scripts/jobs/bilaninput.php | 41 +- scripts/jobs/filesGreffes.php | 227 --------- scripts/jobs/getActes.php | 378 -------------- scripts/jobs/getAltiScore.php | 41 +- scripts/jobs/greffeCmdCourrier.php | 179 ------- scripts/jobs/greffeCmdMois.php | 153 ------ scripts/jobs/greffeCmdTelechargement.php | 200 -------- scripts/jobs/removeTempFile.php | 41 +- 21 files changed, 144 insertions(+), 2388 deletions(-) delete mode 100644 bin/classmap_generator.php delete mode 100644 bin/zf.bat delete mode 100644 bin/zf.php delete mode 100644 bin/zf.sh create mode 100644 composer.json create mode 100644 composer.lock create mode 100644 docs/CRONTAB delete mode 100644 scripts/build/classmap.php delete mode 100644 scripts/cron.php delete mode 100644 scripts/jobs/filesGreffes.php delete mode 100644 scripts/jobs/getActes.php delete mode 100644 scripts/jobs/greffeCmdCourrier.php delete mode 100644 scripts/jobs/greffeCmdMois.php delete mode 100644 scripts/jobs/greffeCmdTelechargement.php diff --git a/TODELETE b/TODELETE index 152c9f2d4..95cf671e3 100644 --- a/TODELETE +++ b/TODELETE @@ -7,34 +7,3 @@ table commandes_kbis table commandes_pieces table commandes_statut table commandes_tarifs => Needed dans GenCourrier - - - -filesGreffes.php -getActes.php -greffeCmdMois.php -greffeCmdTelechargement - - -Controller/Dashboard - -Dashboard -Client => Gestion client, forcer l'ADV a utiliser le nouveau backoffice - -Actes et Bilans - -Kbis -GenCourrier => dans backoffice - - - -table aide - - - - -Cron OK -============= -sendBilanClient -getAltiScore - diff --git a/bin/classmap_generator.php b/bin/classmap_generator.php deleted file mode 100644 index 4dd5c6d46..000000000 --- a/bin/classmap_generator.php +++ /dev/null @@ -1,248 +0,0 @@ - ] Library to parse; if none provided, assumes - * current directory - * --output|-o [ ] Where to write autoload file; if not provided, - * assumes "autoload_classmap.php" in library directory - * --append|-a Append to autoload file if it exists - * --overwrite|-w Whether or not to overwrite existing autoload - * file - * --ignore|-i [ ] Comma-separated namespaces to ignore - */ - -$libPath = dirname(__FILE__) . '/../library'; -if (!is_dir($libPath)) { - // Try to load StandardAutoloader from include_path - if (false === include('Zend/Loader/StandardAutoloader.php')) { - echo "Unable to locate autoloader via include_path; aborting" . PHP_EOL; - exit(2); - } -} else { - // Try to load StandardAutoloader from library - if (false === include(dirname(__FILE__) . '/../library/Zend/Loader/StandardAutoloader.php')) { - echo "Unable to locate autoloader via library; aborting" . PHP_EOL; - exit(2); - } -} - -// Ensure library/ is on include_path -set_include_path(implode(PATH_SEPARATOR, array( - realpath($libPath), - get_include_path(), -))); - -$libraryPath = getcwd(); - -// Setup autoloading -$loader = new Zend_Loader_StandardAutoloader(array('autoregister_zf' => true)); -$loader->setFallbackAutoloader(true); -$loader->register(); - -$rules = array( - 'help|h' => 'Get usage message', - 'library|l-s' => 'Library to parse; if none provided, assumes current directory', - 'output|o-s' => 'Where to write autoload file; if not provided, assumes "autoload_classmap.php" in library directory', - 'append|a' => 'Append to autoload file if it exists', - 'overwrite|w' => 'Whether or not to overwrite existing autoload file', - 'ignore|i-s' => 'Comma-separated namespaces to ignore', -); - -try { - $opts = new Zend_Console_Getopt($rules); - $opts->parse(); -} catch (Zend_Console_Getopt_Exception $e) { - echo $e->getUsageMessage(); - exit(2); -} - -if ($opts->getOption('h')) { - echo $opts->getUsageMessage(); - exit(0); -} - -$ignoreNamespaces = array(); -if (isset($opts->i)) { - $ignoreNamespaces = explode(',', $opts->i); -} - -$relativePathForClassmap = ''; -if (isset($opts->l)) { - if (!is_dir($opts->l)) { - echo 'Invalid library directory provided' . PHP_EOL - . PHP_EOL; - echo $opts->getUsageMessage(); - exit(2); - } - $libraryPath = $opts->l; -} -$libraryPath = str_replace(DIRECTORY_SEPARATOR, '/', realpath($libraryPath)); - -$usingStdout = false; -$appending = $opts->getOption('a'); -$output = $libraryPath . '/autoload_classmap.php'; -if (isset($opts->o)) { - $output = $opts->o; - if ('-' == $output) { - $output = STDOUT; - $usingStdout = true; - } elseif (is_dir($output)) { - echo 'Invalid output file provided' . PHP_EOL - . PHP_EOL; - echo $opts->getUsageMessage(); - exit(2); - } elseif (!is_writeable(dirname($output))) { - echo "Cannot write to '$output'; aborting." . PHP_EOL - . PHP_EOL - . $opts->getUsageMessage(); - exit(2); - } elseif (file_exists($output) && !$opts->getOption('w') && !$appending) { - echo "Autoload file already exists at '$output'," . PHP_EOL - . "but 'overwrite' or 'appending' flag was not specified; aborting." . PHP_EOL - . PHP_EOL - . $opts->getUsageMessage(); - exit(2); - } else { - // We need to add the $libraryPath into the relative path that is created in the classmap file. - $classmapPath = str_replace(DIRECTORY_SEPARATOR, '/', realpath(dirname($output))); - - // Simple case: $libraryPathCompare is in $classmapPathCompare - if (strpos($libraryPath, $classmapPath) === 0) { - $relativePathForClassmap = substr($libraryPath, strlen($classmapPath) + 1) . '/'; - } else { - $libraryPathParts = explode('/', $libraryPath); - $classmapPathParts = explode('/', $classmapPath); - - // Find the common part - $count = count($classmapPathParts); - for ($i = 0; $i < $count; $i++) { - if (!isset($libraryPathParts[$i]) || $libraryPathParts[$i] != $classmapPathParts[$i]) { - // Common part end - break; - } - } - - // Add parent dirs for the subdirs of classmap - $relativePathForClassmap = str_repeat('../', $count - $i); - - // Add library subdirs - $count = count($libraryPathParts); - for (; $i < $count; $i++) { - $relativePathForClassmap .= $libraryPathParts[$i] . '/'; - } - } - } -} - -if (!$usingStdout) { - if ($appending) { - echo "Appending to class file map '$output' for library in '$libraryPath'..." . PHP_EOL; - } else { - echo "Creating class file map for library in '$libraryPath'..." . PHP_EOL; - } -} - -// Get the ClassFileLocator, and pass it the library path -$l = new Zend_File_ClassFileLocator($libraryPath); - -// Iterate over each element in the path, and create a map of -// classname => filename, where the filename is relative to the library path -$map = new stdClass; -foreach ($l as $file) { - $filename = str_replace($libraryPath . '/', '', str_replace(DIRECTORY_SEPARATOR, '/', $file->getPath()) . '/' . $file->getFilename()); - - // Add in relative path to library - $filename = $relativePathForClassmap . $filename; - - foreach ($file->getClasses() as $class) { - foreach ($ignoreNamespaces as $ignoreNs) { - if ($ignoreNs == substr($class, 0, strlen($ignoreNs))) { - continue 2; - } - } - - $map->{$class} = $filename; - } -} - -if ($appending) { - $content = var_export((array) $map, true) . ';'; - - // Prefix with dirname(__FILE__); modify the generated content - $content = preg_replace("#(=> ')#", "=> dirname(__FILE__) . '/", $content); - - // Fix \' strings from injected DIRECTORY_SEPARATOR usage in iterator_apply op - $content = str_replace("\\'", "'", $content); - - // Convert to an array and remove the first "array(" - $content = explode("\n", $content); - array_shift($content); - - // Load existing class map file and remove the closing "bracket ");" from it - $existing = file($output, FILE_IGNORE_NEW_LINES); - array_pop($existing); - - // Merge - $content = implode("\n", array_merge($existing, $content)); -} else { - // Create a file with the class/file map. - // Stupid syntax highlighters make separating < from PHP declaration necessary - $content = '<' . "?php\n" - . "// Generated by ZF's ./bin/classmap_generator.php\n" - . 'return ' . var_export((array) $map, true) . ';'; - - // Prefix with dirname(__FILE__); modify the generated content - $content = preg_replace("#(=> ')#", "=> dirname(__FILE__) . '/", $content); - - // Fix \' strings from injected DIRECTORY_SEPARATOR usage in iterator_apply op - $content = str_replace("\\'", "'", $content); -} - -// Remove unnecessary double-backslashes -$content = str_replace('\\\\', '\\', $content); - -// Exchange "array (" width "array(" -$content = str_replace('array (', 'array(', $content); - -// Align "=>" operators to match coding standard -preg_match_all('(\n\s+([^=]+)=>)', $content, $matches, PREG_SET_ORDER); -$maxWidth = 0; - -foreach ($matches as $match) { - $maxWidth = max($maxWidth, strlen($match[1])); -} - -$content = preg_replace('(\n\s+([^=]+)=>)e', "'\n \\1' . str_repeat(' ', " . $maxWidth . " - strlen('\\1')) . '=>'", $content); - -// Make the file end by EOL -$content = rtrim($content, "\n") . "\n"; - -// Write the contents to disk -file_put_contents($output, $content); - -if (!$usingStdout) { - echo "Wrote classmap file to '" . realpath($output) . "'" . PHP_EOL; -} diff --git a/bin/zf.bat b/bin/zf.bat deleted file mode 100644 index 2a08bc62d..000000000 --- a/bin/zf.bat +++ /dev/null @@ -1,44 +0,0 @@ -@ECHO off -REM Zend Framework -REM -REM LICENSE -REM -REM This source file is subject to the new BSD license that is bundled -REM with this package in the file LICENSE.txt. -REM It is also available through the world-wide-web at this URL: -REM http://framework.zend.com/license/new-bsd -REM If you did not receive a copy of the license and are unable to -REM obtain it through the world-wide-web, please send an email -REM to license@zend.com so we can send you a copy immediately. -REM -REM Zend -REM Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) -REM http://framework.zend.com/license/new-bsd New BSD License - - -REM Test to see if this was installed via pear -SET ZTMPZTMPZTMPZ=@ph -SET TMPZTMPZTMP=%ZTMPZTMPZTMPZ%p_bin@ -REM below @php_bin@ -FOR %%x IN ("@php_bin@") DO (if %%x=="%TMPZTMPZTMP%" GOTO :NON_PEAR_INSTALLED) - -GOTO PEAR_INSTALLED - -:NON_PEAR_INSTALLED -REM Assume php.exe is executable, and that zf.php will reside in the -REM same file as this one -SET PHP_BIN=php.exe -SET PHP_DIR=%~dp0 -GOTO RUN - -:PEAR_INSTALLED -REM Assume this was installed via PEAR and use replacements php_bin & php_dir -SET PHP_BIN=@php_bin@ -SET PHP_DIR=@php_dir@ -GOTO RUN - -:RUN -SET ZF_SCRIPT=%PHP_DIR%\zf.php -"%PHP_BIN%" -d safe_mode=Off -f "%ZF_SCRIPT%" -- %* - - diff --git a/bin/zf.php b/bin/zf.php deleted file mode 100644 index 0d8d43f77..000000000 --- a/bin/zf.php +++ /dev/null @@ -1,624 +0,0 @@ -bootstrap(); - $zf->run(); - } - - /** - * bootstrap() - * - * @return ZF - */ - public function bootstrap() - { - // detect settings - $this->_mode = $this->_detectMode(); - $this->_homeDirectory = $this->_detectHomeDirectory(); - $this->_storageDirectory = $this->_detectStorageDirectory(); - $this->_configFile = $this->_detectConfigFile(); - - // setup - $this->_setupPHPRuntime(); - $this->_setupToolRuntime(); - } - - /** - * run() - * - * @return ZF - */ - public function run() - { - switch ($this->_mode) { - case 'runError': - $this->_runError(); - $this->_runInfo(); - break; - case 'runSetup': - if ($this->_runSetup() === false) { - $this->_runInfo(); - } - break; - case 'runInfo': - $this->_runInfo(); - break; - case 'runTool': - default: - $this->_runTool(); - break; - } - - return $this; - } - - /** - * _detectMode() - * - * @return ZF - */ - protected function _detectMode() - { - $arguments = $_SERVER['argv']; - - $mode = 'runTool'; - - if (!isset($arguments[0])) { - return $mode; - } - - if ($arguments[0] == $_SERVER['PHP_SELF']) { - $this->_executable = array_shift($arguments); - } - - if (!isset($arguments[0])) { - return $mode; - } - - if ($arguments[0] == '--setup') { - $mode = 'runSetup'; - } elseif ($arguments[0] == '--info') { - $mode = 'runInfo'; - } - - return $mode; - } - - - /** - * _detectHomeDirectory() - detect the home directory in a variety of different places - * - * @param bool $mustExist Should the returned value already exist in the file system - * @param bool $returnMessages Should it log messages for output later - * @return string - */ - protected function _detectHomeDirectory($mustExist = true, $returnMessages = true) - { - $homeDirectory = null; - - $homeDirectory = getenv('ZF_HOME'); // check env var ZF_HOME - if ($homeDirectory) { - $this->_logMessage('Home directory found in environment variable ZF_HOME with value ' . $homeDirectory, $returnMessages); - if (!$mustExist || ($mustExist && file_exists($homeDirectory))) { - return $homeDirectory; - } else { - $this->_logMessage('Home directory does not exist at ' . $homeDirectory, $returnMessages); - } - } - - $homeDirectory = getenv('HOME'); // HOME environment variable - - if ($homeDirectory) { - $this->_logMessage('Home directory found in environment variable HOME with value ' . $homeDirectory, $returnMessages); - if (!$mustExist || ($mustExist && file_exists($homeDirectory))) { - return $homeDirectory; - } else { - $this->_logMessage('Home directory does not exist at ' . $homeDirectory, $returnMessages); - } - - } - - $homeDirectory = getenv('HOMEPATH'); - - if ($homeDirectory) { - $this->_logMessage('Home directory found in environment variable HOMEPATH with value ' . $homeDirectory, $returnMessages); - if (!$mustExist || ($mustExist && file_exists($homeDirectory))) { - return $homeDirectory; - } else { - $this->_logMessage('Home directory does not exist at ' . $homeDirectory, $returnMessages); - } - } - - $homeDirectory = getenv('USERPROFILE'); - - if ($homeDirectory) { - $this->_logMessage('Home directory found in environment variable USERPROFILE with value ' . $homeDirectory, $returnMessages); - if (!$mustExist || ($mustExist && file_exists($homeDirectory))) { - return $homeDirectory; - } else { - $this->_logMessage('Home directory does not exist at ' . $homeDirectory, $returnMessages); - } - } - - return false; - } - - /** - * _detectStorageDirectory() - Detect where the storage directory is from a variaty of possiblities - * - * @param bool $mustExist Should the returned value already exist in the file system - * @param bool $returnMessages Should it log messages for output later - * @return string - */ - protected function _detectStorageDirectory($mustExist = true, $returnMessages = true) - { - $storageDirectory = false; - - $storageDirectory = getenv('ZF_STORAGE_DIR'); - if ($storageDirectory) { - $this->_logMessage('Storage directory path found in environment variable ZF_STORAGE_DIR with value ' . $storageDirectory, $returnMessages); - if (!$mustExist || ($mustExist && file_exists($storageDirectory))) { - return $storageDirectory; - } else { - $this->_logMessage('Storage directory does not exist at ' . $storageDirectory, $returnMessages); - } - } - - $homeDirectory = ($this->_homeDirectory) ? $this->_homeDirectory : $this->_detectHomeDirectory(true, false); - - if ($homeDirectory) { - $storageDirectory = $homeDirectory . '/.zf/'; - $this->_logMessage('Storage directory assumed in home directory at location ' . $storageDirectory, $returnMessages); - if (!$mustExist || ($mustExist && file_exists($storageDirectory))) { - return $storageDirectory; - } else { - $this->_logMessage('Storage directory does not exist at ' . $storageDirectory, $returnMessages); - } - } - - return false; - } - - /** - * _detectConfigFile() - Detect config file location from a variety of possibilities - * - * @param bool $mustExist Should the returned value already exist in the file system - * @param bool $returnMessages Should it log messages for output later - * @return string - */ - protected function _detectConfigFile($mustExist = true, $returnMessages = true) - { - $configFile = null; - - $configFile = getenv('ZF_CONFIG_FILE'); - if ($configFile) { - $this->_logMessage('Config file found environment variable ZF_CONFIG_FILE at ' . $configFile, $returnMessages); - if (!$mustExist || ($mustExist && file_exists($configFile))) { - return $configFile; - } else { - $this->_logMessage('Config file does not exist at ' . $configFile, $returnMessages); - } - } - - $homeDirectory = ($this->_homeDirectory) ? $this->_homeDirectory : $this->_detectHomeDirectory(true, false); - if ($homeDirectory) { - $configFile = $homeDirectory . '/.zf.ini'; - $this->_logMessage('Config file assumed in home directory at location ' . $configFile, $returnMessages); - if (!$mustExist || ($mustExist && file_exists($configFile))) { - return $configFile; - } else { - $this->_logMessage('Config file does not exist at ' . $configFile, $returnMessages); - } - } - - $storageDirectory = ($this->_storageDirectory) ? $this->_storageDirectory : $this->_detectStorageDirectory(true, false); - if ($storageDirectory) { - $configFile = $storageDirectory . '/zf.ini'; - $this->_logMessage('Config file assumed in storage directory at location ' . $configFile, $returnMessages); - if (!$mustExist || ($mustExist && file_exists($configFile))) { - return $configFile; - } else { - $this->_logMessage('Config file does not exist at ' . $configFile, $returnMessages); - } - } - - return false; - } - - - /** - * _setupPHPRuntime() - parse the config file if it exists for php ini values to set - * - * @return void - */ - protected function _setupPHPRuntime() - { - // set php runtime settings - ini_set('display_errors', true); - - // support the changing of the current working directory, necessary for some providers - $cwd = getenv('ZEND_TOOL_CURRENT_WORKING_DIRECTORY'); - if ($cwd != '' && realpath($cwd)) { - chdir($cwd); - } - - if (!$this->_configFile) { - return; - } - $zfINISettings = parse_ini_file($this->_configFile); - $phpINISettings = ini_get_all(); - foreach ($zfINISettings as $zfINIKey => $zfINIValue) { - if (substr($zfINIKey, 0, 4) === 'php.') { - $phpINIKey = substr($zfINIKey, 4); - if (array_key_exists($phpINIKey, $phpINISettings)) { - ini_set($phpINIKey, $zfINIValue); - } - } - } - } - - /** - * _setupToolRuntime() - setup the tools include_path and load the proper framwork parts that - * enable Zend_Tool to work. - * - * @return void - */ - protected function _setupToolRuntime() - { - - $includePathPrepend = getenv('ZEND_TOOL_INCLUDE_PATH_PREPEND'); - $includePathFull = getenv('ZEND_TOOL_INCLUDE_PATH'); - - // check if the user has not provided anything - if (!($includePathPrepend || $includePathFull)) { - if ($this->_tryClientLoad()) { - return; - } - } - - // if ZF is not in the include_path, but relative to this file, put it in the include_path - if ($includePathPrepend || $includePathFull) { - if (isset($includePathPrepend) && ($includePathPrepend !== false)) { - set_include_path($includePathPrepend . PATH_SEPARATOR . get_include_path()); - } elseif (isset($includePathFull) && ($includePathFull !== false)) { - set_include_path($includePathFull); - } - } - - if ($this->_tryClientLoad()) { - return; - } - - $zfIncludePath['relativePath'] = dirname(__FILE__) . '/../library/'; - if (file_exists($zfIncludePath['relativePath'] . 'Zend/Tool/Framework/Client/Console.php')) { - set_include_path(realpath($zfIncludePath['relativePath']) . PATH_SEPARATOR . get_include_path()); - } - - if (!$this->_tryClientLoad()) { - $this->_mode = 'runError'; - return; - } - } - - /** - * _tryClientLoad() - Attempt to load the Zend_Tool_Framework_Client_Console to enable the tool to run. - * - * This method will return false if its not loaded to allow the consumer to alter the environment in such - * a way that it can be called again to try loading the proper file/class. - * - * @return bool if the client is actuall loaded or not - */ - protected function _tryClientLoad() - { - $this->_clientLoaded = false; - $fh = @fopen('Zend/Tool/Framework/Client/Console.php', 'r', true); - if (!$fh) { - return $this->_clientLoaded; // false - } else { - fclose($fh); - unset($fh); - include 'Zend/Tool/Framework/Client/Console.php'; - $this->_clientLoaded = class_exists('Zend_Tool_Framework_Client_Console'); - } - - return $this->_clientLoaded; - } - - /** - * _runError() - Output the error screen that tells the user that the tool was not setup - * in a sane way - * - * @return void - */ - protected function _runError() - { - - echo <<_messages) . PHP_EOL; - - echo PHP_EOL; - - echo 'To change the setup of this tool, run: "zf --setup"'; - - echo PHP_EOL; - - } - - /** - * _runSetup() - parse the request to see which setup command to run - * - * @return void - */ - protected function _runSetup() - { - $setupCommand = (isset($_SERVER['argv'][2])) ? $_SERVER['argv'][2] : null; - - switch ($setupCommand) { - case 'storage-directory': - $this->_runSetupStorageDirectory(); - break; - case 'config-file': - $this->_runSetupConfigFile(); - break; - default: - $this->_runSetupMoreInfo(); - break; - } - } - - /** - * _runSetupStorageDirectory() - if the storage directory does not exist, create it - * - * @return void - */ - protected function _runSetupStorageDirectory() - { - $storageDirectory = $this->_detectStorageDirectory(false, false); - - if (file_exists($storageDirectory)) { - echo 'Directory already exists at ' . $storageDirectory . PHP_EOL - . 'Cannot create storage directory.'; - return; - } - - mkdir($storageDirectory); - - echo 'Storage directory created at ' . $storageDirectory . PHP_EOL; - } - - /** - * _runSetupConfigFile() - * - * @return void - */ - protected function _runSetupConfigFile() - { - $configFile = $this->_detectConfigFile(false, false); - - if (file_exists($configFile)) { - echo 'File already exists at ' . $configFile . PHP_EOL - . 'Cannot write new config file.'; - return; - } - - $includePath = get_include_path(); - - $contents = 'php.include_path = "' . $includePath . '"'; - - file_put_contents($configFile, $contents); - - $iniValues = ini_get_all(); - if ($iniValues['include_path']['global_value'] != $iniValues['include_path']['local_value']) { - echo 'NOTE: the php include_path to be used with the tool has been written' . PHP_EOL - . 'to the config file, using ZEND_TOOL_INCLUDE_PATH (or other include_path setters)' . PHP_EOL - . 'is no longer necessary.' . PHP_EOL . PHP_EOL; - } - - echo 'Config file written to ' . $configFile . PHP_EOL; - } - - /** - * _runSetupMoreInfo() - return more information about what can be setup, and what is setup - * - * @return void - */ - protected function _runSetupMoreInfo() - { - $homeDirectory = $this->_detectHomeDirectory(false, false); - $storageDirectory = $this->_detectStorageDirectory(false, false); - $configFile = $this->_detectConfigFile(false, false); - - echo <<_configFile) && $this->_configFile) { - $configOptions['configOptions']['configFilepath'] = $this->_configFile; - } - if (isset($this->_storageDirectory) && $this->_storageDirectory) { - $configOptions['storageOptions']['directory'] = $this->_storageDirectory; - } - - // ensure that zf.php loads the Zend_Tool_Project features - $configOptions['classesToLoad'] = 'Zend_Tool_Project_Provider_Manifest'; - - $console = new Zend_Tool_Framework_Client_Console($configOptions); - $console->dispatch(); - } - - /** - * _logMessage() - Internal method used to log setup and information messages. - * - * @param string $message - * @param bool $storeMessage - * @return void - */ - protected function _logMessage($message, $storeMessage = true) - { - if (!$storeMessage) { - return; - } - - $this->_messages[] = $message; - } - - -} - -if (!getenv('ZF_NO_MAIN')) { - ZF::main(); -} diff --git a/bin/zf.sh b/bin/zf.sh deleted file mode 100644 index 28a42ec51..000000000 --- a/bin/zf.sh +++ /dev/null @@ -1,45 +0,0 @@ -#!/bin/sh - -############################################################################# -# Zend Framework -# -# LICENSE -# -# This source file is subject to the new BSD license that is bundled -# with this package in the file LICENSE.txt. -# It is also available through the world-wide-web at this URL: -# http://framework.zend.com/license/new-bsd -# If you did not receive a copy of the license and are unable to -# obtain it through the world-wide-web, please send an email -# to license@zend.com so we can send you a copy immediately. -# -# Zend -# Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) -# http://framework.zend.com/license/new-bsd New BSD License -############################################################################# - - -# find php: pear first, command -v second, straight up php lastly -if test "@php_bin@" != '@'php_bin'@'; then - PHP_BIN="@php_bin@" -elif command -v php 1>/dev/null 2>/dev/null; then - PHP_BIN=`command -v php` -else - PHP_BIN=php -fi - -# find zf.php: pear first, same directory 2nd, -if test "@php_dir@" != '@'php_dir'@'; then - PHP_DIR="@php_dir@" -else - SELF_LINK="$0" - SELF_LINK_TMP="$(readlink "$SELF_LINK")" - while test -n "$SELF_LINK_TMP"; do - SELF_LINK="$SELF_LINK_TMP" - SELF_LINK_TMP="$(readlink "$SELF_LINK")" - done - PHP_DIR="$(dirname "$SELF_LINK")" -fi - -"$PHP_BIN" -d safe_mode=Off -f "$PHP_DIR/zf.php" -- "$@" - diff --git a/composer.json b/composer.json new file mode 100644 index 000000000..f2ea3afe9 --- /dev/null +++ b/composer.json @@ -0,0 +1,25 @@ +{ + "name": "scores/extranet", + "description": "Extranet", + "require": { + "zendframework/zendframework1": "^1.12" + }, + "include-path": ["library/"], + "autoload": { + "classmap": [ + "application/", + "library/Application/", + "library/GenCourrier/", + "library/Giant/", + "library/Infogreffe/", + "library/Scores/", + "library/Worldcheck/" + ] + }, + "authors": [ + { + "name": "Scores et Decisions", + "email": "supportdev@scores-decisions.com" + } + ] +} diff --git a/composer.lock b/composer.lock new file mode 100644 index 000000000..3c395f3c7 --- /dev/null +++ b/composer.lock @@ -0,0 +1,66 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", + "This file is @generated automatically" + ], + "hash": "6ba703814e1db37f95ec75fce40a2bf0", + "content-hash": "934d96cbc45481a0d243a4d3af6161ab", + "packages": [ + { + "name": "zendframework/zendframework1", + "version": "1.12.16", + "source": { + "type": "git", + "url": "https://github.com/zendframework/zf1.git", + "reference": "8a3c471ef0a337d303cd5ae578e64c2ba1d2c025" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/zendframework/zf1/zipball/8a3c471ef0a337d303cd5ae578e64c2ba1d2c025", + "reference": "8a3c471ef0a337d303cd5ae578e64c2ba1d2c025", + "shasum": "" + }, + "require": { + "php": ">=5.2.11" + }, + "require-dev": { + "phpunit/dbunit": "1.3.*", + "phpunit/phpunit": "3.7.*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.12.x-dev" + } + }, + "autoload": { + "psr-0": { + "Zend_": "library/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "include-path": [ + "library/" + ], + "license": [ + "BSD-3-Clause" + ], + "description": "Zend Framework 1", + "homepage": "http://framework.zend.com/", + "keywords": [ + "ZF1", + "framework" + ], + "time": "2015-09-15 15:49:51" + } + ], + "packages-dev": [], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": [], + "platform-dev": [] +} diff --git a/docs/CRONTAB b/docs/CRONTAB new file mode 100644 index 000000000..47840f5fc --- /dev/null +++ b/docs/CRONTAB @@ -0,0 +1,11 @@ +# AltiScore +00 4 * * 1-5 www-data php /home/vhosts/extranet/current/scripts/jobs/getAltiScore.php --cron >> /home/vhosts/data/log/altiscore.log + +# Envoi commande bilan +0 * * * * root php /home/vhosts/extranet/current/scripts/jobs/bilaninput.php --send >> /home/vhosts/data/log/bilaninput.log 2>&1 + +# Suppression fichier +#0 10 01 * * root php /home/vhosts/extranet/current/scripts/jobs/bilaninput.php --delete >> /home/vhosts/data/log/bilaninput.log 2>&1 + +# Suppression fichier temporaire +01 15 06 * * root php /home/vhosts/extranet/current/scripts/jobs/removeTempFile.php --options all \ No newline at end of file diff --git a/public/index.php b/public/index.php index 0901a5022..1d97b85e8 100644 --- a/public/index.php +++ b/public/index.php @@ -1,54 +1,15 @@ array( - __DIR__ . '/../library/autoload_classmap.php', - ), - 'Zend_Loader_StandardAutoloader' => array( - 'prefixes' => array( - 'Zend' => __DIR__ . '/../library/Zend', - 'Application' => __DIR__ . '/../library/Application', - 'Scores' => __DIR__ . '/../library/Scores', - ), - 'fallback_autoloader' => true - ) -)); - -// Zend_Application - Use it if you don't have autoloaders -//require_once 'Zend/Application.php'; - -// Create application, bootstrap, and run -$application = new Zend_Application( - APPLICATION_ENV, - APPLICATION_PATH . '/configs/application.ini' -); +// --- Composer autoload +require_once realpath(__DIR__ . '/../vendor/autoload.php'); +// --- Create application, bootstrap, and run +$application = new Zend_Application(APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini'); $application->bootstrap()->run(); \ No newline at end of file diff --git a/scripts/build/classmap.php b/scripts/build/classmap.php deleted file mode 100644 index bcba6fd46..000000000 --- a/scripts/build/classmap.php +++ /dev/null @@ -1,33 +0,0 @@ - array( - __DIR__ . '/../../library/autoload_classmap.php', - ), - 'Zend_Loader_StandardAutoloader' => array( - 'prefixes' => array( - 'Zend' => __DIR__ . '/../../library/Zend', - 'Application' => __DIR__ . '/../../library/Application', - 'Scores' => __DIR__ . '/../../library/Scores', - 'SdMetier' => __DIR__ . '/../../library/SdMetier', - 'Metier' => __DIR__ . '/../../library/Metier', - ), - 'fallback_autoloader' => true - ), -)); +// --- Create application, bootstrap, and run +$application = new Zend_Application(APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini'); try { $opts = new Zend_Console_Getopt( diff --git a/scripts/build/getCatalog.php b/scripts/build/getCatalog.php index 31a4ea4af..7bc33d68f 100644 --- a/scripts/build/getCatalog.php +++ b/scripts/build/getCatalog.php @@ -1,44 +1,17 @@ array( - __DIR__ . '/../../library/autoload_classmap.php', - ), - 'Zend_Loader_StandardAutoloader' => array( - 'prefixes' => array( - 'Zend' => __DIR__ . '/../../library/Zend', - 'Application' => __DIR__ . '/../../library/Application', - 'Scores' => __DIR__ . '/../../library/Scores', - 'Metier' => __DIR__ . '/../../library/Metier', - ), - 'fallback_autoloader' => true - ) -)); - -// Zend_Application - Use it if you don't have autoloaders -//require_once 'Zend/Application.php'; - -// Create application, bootstrap, and run -$application = new Zend_Application( - APPLICATION_ENV, - APPLICATION_PATH . '/configs/application.ini' -); +// --- Create application, bootstrap, and run +$application = new Zend_Application(APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini'); $catalogs = array( 'evenements' => array( diff --git a/scripts/cron.php b/scripts/cron.php deleted file mode 100644 index 3d747a02c..000000000 --- a/scripts/cron.php +++ /dev/null @@ -1,16 +0,0 @@ -> /var/www/data/log/getActes.log - -00 12 * * * root php /var/www/extranetrec/batch/sendBilanClient.php --send >> /var/www/data/log/sendBilanClient.log -00 19 * * * root php /var/www/extranetrec/batch/sendBilanClient.php --send >> /var/www/data/log/sendBilanClient.log - -# Reprise des actes en erreur infogreffe -00 6,13 * * * root php /var/www/extranet/batch/greffeCmdTelechargement.php --reprise >> /var/www/data/log/greffeCmdTelechargement.log -00 9 * * * root php /var/www/extranet/batch/greffeCmdTelechargement.php --rapport >> /var/www/data/log/greffeCmdTelechargement.log -00 13 1 * * root php /var/www/extranet/batch/greffeCmdMois.php $(date +\%Y\%m -d "-2 month") - -30 14 * * 6 root php /var/www/extranet/batch/removeTempFile.php --all - - */ \ No newline at end of file diff --git a/scripts/jobs/bilaninput.php b/scripts/jobs/bilaninput.php index b1897d680..28f24556c 100644 --- a/scripts/jobs/bilaninput.php +++ b/scripts/jobs/bilaninput.php @@ -5,46 +5,19 @@ * pour envoyer sur le ftp */ -// Define path to application directory +// --- Define path to application directory defined('APPLICATION_PATH') - || define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../../application')); + || define('APPLICATION_PATH', realpath(__DIR__ . '/../../application')); -// Define application environment +// --- Define application environment defined('APPLICATION_ENV') || define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production')); -// Ensure library/ is on include_path -set_include_path(implode(PATH_SEPARATOR, array( - realpath(APPLICATION_PATH . '/../library'), - get_include_path(), -))); +// --- Composer autoload +require_once realpath(__DIR__ . '/../../vendor/autoload.php'); -//Use classmap autoloader - useful with opcode and realpath cache -require_once 'Zend/Loader/AutoloaderFactory.php'; -require_once 'Zend/Loader/ClassMapAutoloader.php'; -Zend_Loader_AutoloaderFactory::factory(array( - 'Zend_Loader_ClassMapAutoloader' => array( - __DIR__ . '/../../library/autoload_classmap.php', - ), - 'Zend_Loader_StandardAutoloader' => array( - 'prefixes' => array( - 'Zend' => __DIR__ . '/../../library/Zend', - 'Application' => __DIR__ . '/../../library/Application', - 'Scores' => __DIR__ . '/../../library/Scores', - 'Metier' => __DIR__ . '/../../library/Metier', - ), - 'fallback_autoloader' => true - ) -)); - -// Zend_Application - Use it if you don't have autoloaders -//require_once 'Zend/Application.php'; - -// Create application, bootstrap, and run -$application = new Zend_Application( - APPLICATION_ENV, - APPLICATION_PATH . '/configs/application.ini' -); +// --- Create application, bootstrap, and run +$application = new Zend_Application(APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini'); try { $opts = new Zend_Console_Getopt( diff --git a/scripts/jobs/filesGreffes.php b/scripts/jobs/filesGreffes.php deleted file mode 100644 index a86770d8a..000000000 --- a/scripts/jobs/filesGreffes.php +++ /dev/null @@ -1,227 +0,0 @@ - array( - __DIR__ . '/../../library/autoload_classmap.php', - ), - 'Zend_Loader_StandardAutoloader' => array( - 'prefixes' => array( - 'Zend' => __DIR__ . '/../../library/Zend', - 'Application' => __DIR__ . '/../../library/Application', - 'Scores' => __DIR__ . '/../../library/Scores', - 'Metier' => __DIR__ . '/../../library/Metier', - ), - 'fallback_autoloader' => true - ) -)); - -// Zend_Application - Use it if you don't have autoloaders -//require_once 'Zend/Application.php'; - -// Create application, bootstrap, and run -$application = new Zend_Application( - APPLICATION_ENV, - APPLICATION_PATH . '/configs/application.ini' -); - -try { - $opts = new Zend_Console_Getopt( - //Options - array( - 'help|?' => "Affiche l'aide.", - 'acte' => "Intégration des actes ", - 'bilan' => "Intégration des bilans", - 'echo' => "Affiche les informations lors du traitement", - ) - ); - $opts->parse(); -} catch (Zend_Console_Getopt_Exception $e) { - echo $e->getUsageMessage(); - exit; -} - -//Usage -if(count($opts->getOptions())==0 || isset($opts->help)) -{ - echo "Vérifie les actes numérisés reçus en provenance des Greffes."; - echo "\n\n"; - echo $opts->getUsageMessage(); - echo "\n"; - exit; -} - -$c = new Zend_Config($application->getOptions()); -Zend_Registry::set('config', $c); - -/** - * Connexion à la base de données - */ -$db = Zend_Db::factory($c->profil->db->sdv1); -Zend_Db_Table_Abstract::setDefaultAdapter($db); - -function fichierBilan($fichier) -{ - global $dirStockage, $dirPDF; - if (preg_match('/^(bilan|acte)-([0-9]{9})-([0-9]{4})_([a-z]{0,})-([0-9]{8})/', $fichier, $matches)) - { - $siren = $matches[2]; - $annee = $matches[3]; - $type = $matches[4]; - if ($type == '') $type = 'sociaux'; - $dateCloture = $matches[5]; - - //Création arborescence repertoire - $dirNew = $dirStockage.'/bilans/'.$type.'/'.$annee; - if (!is_dir($dirNew)) { mkdir($dirNew, 0777, true); } - - //Copie du fichier - $fichierDest = 'bilan-'.$siren.'-'.$type.'-'.$dateCloture.'.pdf'; - if (file_exists($dirNew.'/'.$fichierDest)) - { - echo "BILAN - Le fichier $fichier a déjà été copié.\n"; - } - else - { - if ( copy($dirPDF.'/'.$fichier, $dirNew.'/'.$fichierDest) ) - { - echo "BILAN - Copie du fichier $dirPDF/$fichier vers $dirNew/$fichierDest\n"; - } - else - { - echo "BILAN - ERREUR - Copie du fichier $fichier impossible!\n"; - } - } - } - else - { - echo "BILAN - ERREUR - Fichier $fichier ne correspond pas au schéma.\n"; - } -} - -function fichierActe($fichier) -{ - global $dirStockage, $dirPDF; - if (preg_match('/^acte-([0-9]{9})-(ST)-([0-9]{8})-.*\.pdf/', $fichier, $matches)) { - - $siren = $matches[1]; - $type_acte = $matches[2]; - $date_acte = $matches[3]; - $annee = substr($date_acte,0,4); - $mois = substr($date_acte,4,2); - - //Création arborescence repertoire - $dirNew = $dirStockage.'/actes/'.$annee.'/'.$mois; - if (!is_dir($dirNew)) { mkdir($dirNew, 0, true); } - - //Copie du fichier - if (file_exists($dirNew.'/'.$fichier)) { - //echo "ACTE - Le fichier $fichier a déjà été copié.\n"; - } else { - if ( copy($dirPDF.'/'.$fichier, $dirNew.'/'.$fichier) ) { - echo "ACTE - Copie du fichier $dirPDF/$fichier vers $dirNew/$fichier\n"; - } else { - echo "ACTE - ERREUR - Copie du fichier $fichier impossible!\n"; - } - } - } elseif (preg_match('/^acte-([0-9]{9})-([0-9a-zA-Z]{1,})-([0-9]{8})-.*-([0-9]{2})\.pdf/', $fichier, $matches)) { - $siren = $matches[1]; - $type_acte = $matches[2]; - $date_acte = $matches[3]; - $annee = substr($date_acte,0,4); - $mois = substr($date_acte,4,2); - $num_acte = $matches[4]; - - $actesM = new Application_Model_ActesFiles(); - $sql = $actesM->select() - ->where('siren=?', $siren) - ->where('type=?', $type_acte) - ->where('date=?', $date_acte) - ->where('num=?', $num_acte); - - $result = $actesM->fetchRow($sql); - - //Création arborescence repertoire - $dirNew = $dirStockage.'/actes/'.$annee.'/'.$mois; - if (!is_dir($dirNew)) { mkdir($dirNew, 0777, true); } - - //Copie du fichier - if (file_exists($dirNew.'/'.$fichier)) { - //echo "ACTE - Le fichier $fichier a déjà été copié.\n"; - } else { - if ( copy($dirPDF.'/'.$fichier, $dirNew.'/'.$fichier) ) { - if ( null === $result ) { - $actesM->insert(array( - 'siren' => $siren, - 'type' => $type_acte, - 'date' => $date_acte, - 'num' => $num_acte, - 'file' => $fichier, - )); - } - echo "ACTE - Copie du fichier $dirPDF/$fichier vers $dirNew/$fichier\n"; - } else { - echo "ACTE - ERREUR - Copie du fichier $fichier impossible!\n"; - } - } - } - else - { - echo "ACTE - ERREUR - Fichier $fichier ne correspond pas au schéma.\n"; - } -} - -//=> Start -$dirPDF = '/var/www/data/pdf'; -$dirStockage = '/var/www/data/greffes'; - -if (!is_dir($dirStockage)) { - echo "Le nouveau répertoire $dirStockage n'a pas été trouvé.\n"; - exit; -} -if (!is_dir($dirStockage.'/bilans')) { - mkdir($dirStockage.'/bilans'); -} -if (!is_dir($dirStockage.'/actes')) { - mkdir($dirStockage.'/actes'); -} - -$i = 0; -if ($handle = opendir($dirPDF)) { - while ( false !== ($file = readdir($handle)) ) { - $i++; - if ( $file != '..' && $file != '.' ) { - if ($opts->echo) echo "Analyse du fichier $file ($i)\n"; - - // Traitement acte - if ($opts->acte) { - if ( preg_match('/^acte-([0-9]{9})-([0-9a-zA-Z]{1,})-/', $file) ) { - fichierActe($file); - } - } - - // Traitement bilan - if ($opts->bilan) { - if ( preg_match('/^(bilan|acte)-([0-9]{9})-([0-9]{4})_/', $file) ) { - fichierBilan($file); - } - } - - } - } -} \ No newline at end of file diff --git a/scripts/jobs/getActes.php b/scripts/jobs/getActes.php deleted file mode 100644 index 90a92b5f8..000000000 --- a/scripts/jobs/getActes.php +++ /dev/null @@ -1,378 +0,0 @@ -#!/usr/bin/php -q - array( - __DIR__ . '/../../library/autoload_classmap.php', - ), - 'Zend_Loader_StandardAutoloader' => array( - 'prefixes' => array( - 'Zend' => __DIR__ . '/../../library/Zend', - 'Application' => __DIR__ . '/../../library/Application', - 'Scores' => __DIR__ . '/../../library/Scores', - 'Metier' => __DIR__ . '/../../library/Metier', - ), - 'fallback_autoloader' => true - ) -)); - -// Zend_Application - Use it if you don't have autoloaders -//require_once 'Zend/Application.php'; - -// Create application, bootstrap, and run -$application = new Zend_Application( - APPLICATION_ENV, - APPLICATION_PATH . '/configs/application.ini' -); - -try { - $opts = new Zend_Console_Getopt( - //Options - array( - 'help|?' => "Affiche l'aide.", - 'list' => "Liste les actes en attente disponible sur le FTP et affiche les informations", - 'get-s' => "Recupère seulement les actes du FTP (un seul document si la référence est spécifier G )", - 'send-s' => "Récupère les actes et envoi un mail à chaque client (un seul acte si la référence est spécifier G)", - 'control' => "Control", - ) - ); - $opts->parse(); -} catch (Zend_Console_Getopt_Exception $e) { - echo $e->getUsageMessage(); - exit; -} - -//Usage -if(count($opts->getOptions())==0 || isset($opts->help)) -{ - echo "Vérifie les actes numérisés reçus en provenance des Greffes."; - echo "\n\n"; - echo $opts->getUsageMessage(); - echo "\n"; - exit; -} - -$c = new Zend_Config($application->getOptions()); -Zend_Registry::set('config', $c); - -$test = false; -if (isset($opts->list)){ - $test = true; -} - -//Configuration FTP -define ('ACTES_IGNUM_FTP_URL', 'ftp2.scores-decisions.com'); -define ('ACTES_IGNUM_FTP_USER', 'mpc2500'); -define ('ACTES_IGNUM_FTP_PASS', 'passmpc78'); - -define ('PATH_DATA', $c->profil->path->data); -define ('ACTES_IGNUM_LOCAL_DIR', PATH_DATA.'/pdf/scan/'); -define ('ACTES_IG_LOCAL_DIR', PATH_DATA.'/pdf/'); - -$report_email = $c->profil->mail->email->support; -$report_subject = 'Traitement des actes '.date('Y-m-d H:i:s'); -$report_txt = ''; - -function sendMail($commande, $nomCible){ - $subject = "Actes ou Statuts disponible pour ".$commande['siren']; - $message = "Le document commandé pour le siren ".$commande['siren']." est disponible en téléchargement sur le site de Scores & Décisions à l'adresse suivante :\r\n\r\n"; - $message.= "http://extranet.scores-decisions.com/fichier/pdf/$nomCible\r\n"; - $headers = 'From: infoslegales@scores-decisions.com' . "\r\n" . - 'Reply-To: infoslegales@scores-decisions.com'; - if ( mail($commande['emailCommande'], $subject, utf8_decode($message), $headers) ){ - echo date ('Y/m/d - H:i:s').' - Un email a été envoyé à '.$commande['emailCommande']." pour la commande $nomCible.\n"; - return true; - } else { - echo date ('Y/m/d - H:i:s').' - ERREUR : Impossible d\'envoyer l\'email à '.$commande['emailCommande']." pour la commande $nomCible.\n"; - return false; - } -} - -set_time_limit(0); - -/** - * Connexion à la base de données - */ -$db = Zend_Db::factory($c->profil->db->sdv1); -Zend_Db_Table_Abstract::setDefaultAdapter($db); - -/** - * List actes files and check if an entry exist in the database - * greffes/actes/AAAA/MM - * preg_match('/^acte-([0-9]{9})-(ST)-([0-9]{8})-.*\.pdf/', $fichier, $matches) - * preg_match('/^acte-([0-9]{9})-([0-9a-zA-Z]{1,})-([0-9]{8})-.*-([0-9]{2})\.pdf/', $fichier, $matches) - */ -if ($opts->control) { - - $dir = PATH_DATA.'/greffes/actes'; - if (is_dir($dir)) { - if ($dh = opendir($dir)) { - //Annee - while (($anneeDir = readdir($dh)) !== false) { - if ($anneeDir != '.' || $anneeDir != '..') { - echo "Dir ".$dir . DIRECTORY_SEPARATOR . $anneeDir."\n"; - if ($dhAnneeDir = opendir($dir . DIRECTORY_SEPARATOR . $anneeDir)) { - //Mois - while (($moisDir = readdir($dhAnneeDir)) !== false) { - echo "Dir ".$dir . DIRECTORY_SEPARATOR . $anneeDir . DIRECTORY_SEPARATOR . $moisDir."\n"; - if ($moisDir != '.' || $moisDir != '..') { - //Fichier - if ($dhFile = opendir($dir . DIRECTORY_SEPARATOR . $anneeDir . DIRECTORY_SEPARATOR . $moisDir)) { - while (($file = readdir($dhFile)) !== false) { - if ($file != '.' || $file != '..') { - - if (preg_match('/^acte-([0-9]{9})-([0-9a-zA-Z]{1,})-([0-9]{8})-.*-([0-9]{2})\.pdf/', $file, $matches)) { - $siren = $matches[1]; - $type = $matches[2]; - $date = $matches[3]; - $num = $matches[4]; - $actesM = new Application_Model_ActesFiles(); - $sql = $actesM->select() - ->where('siren=?', $siren) - ->where('type=?', $type) - ->where('date=?', $date) - ->where('num=?', $num); - $result = $actesM->fetchRow($sql); - if ( null === $result ) { - echo "Insert $file\n"; - $actesM->insert(array( - 'siren' => $siren, - 'type' => $type, - 'date' => $date, - 'num' => $num, - 'file' => $file, - )); - } - } - - } - } - closedir($dhFile); - } - } - } - closedir($dhAnneeDir); - } - } - } - closedir($dh); - } - } -exit; -} - -/** - * Liste des commandes non traités depuis la base de données - */ -$sql = "SELECT idCommande, idUser, login, emailCommande, siren, refDocument, typeCommande, dateCommande FROM commandes WHERE dateReception=0"; -$tabCommandes = $db->fetchAssoc($sql); - -$nbCommandes = count($tabCommandes); -$tabTmp = array(); -foreach ($tabCommandes as $commande) { - if ($commande['typeCommande']=='C'){ - $tabTmp['c'.$commande['idCommande']] = $commande; - } elseif ($commande['typeCommande']=='G' || $commande['typeCommande']==''){ - $tabTmp['g'.$commande['idCommande']] = $commande; - } -} -$tabCommandes = $tabTmp; -unset($tabTmp); -echo date('Y/m/d - H:i:s') ." - Il y a $nbCommandes commandes en attente de réception courrier ou numérisation !\n"; - -/** - * Connexion au site FTP pour la récupération de la liste des fichiers au format pdf - */ -$conn_id = ftp_connect(ACTES_IGNUM_FTP_URL); -if (!$conn_id) { - echo date ('Y/m/d - H:i:s')." - ERREUR : Impossible de se connecter au serveur FTP (".ACTES_IGNUM_FTP_URL.") !\n"; - exit; -} -$login_result = ftp_login($conn_id, ACTES_IGNUM_FTP_USER, ACTES_IGNUM_FTP_PASS); -if (!$login_result) { - echo date ('Y/m/d - H:i:s')." - ERREUR : Impossible de s'authentifier sur le serveur FTP (".ACTES_IGNUM_FTP_URL.")!\n"; - exit; -} -$contents = ftp_nlist($conn_id, "*.pdf"); - -/** - * Liste de tout les fichiers disponible dans le repertoire - * et associe une clé pour faciliter le tri - */ -$tabFichiersFtp = array(); -foreach ($contents as $filename){ - $indice = 0; - if (preg_match('/[g|c][0-9]+\.pdf/', $filename) - || preg_match('/[g|c][0-9]+-[0-9]{1,2}\.pdf/', $filename)){ - - list($ref, $indice) = explode('-', str_replace(array('.pdf', 'g', 'c'), array('','',''), $filename)); - if(empty($indice)) $indice = 0; - $tabFichiersFtp[$ref.'-'.$indice] = strtolower($filename); - // Fichiers en anomalies - } else { - if ($test){ - echo "Erreur : Anomalie fichier numérisé $filename\n"; - } else { - $subject = "Erreur : Anomalie fichier numérisé"; - $message = "Le fichier $filename a été trouvé et ne correspond pas au format attendu"; - $headers = 'From: supportdev@scores-decisions.com' . "\r\n" . - 'Reply-To: supportdev@scores-decisions.com'; - mail('supportdev@scores-decisions.com', $subject, $message, $headers); - } - } -} - -/** - * Tri des fichiers par ordre décroissant - * Les noms des fichiers sont incrémenté par 1 - */ -krsort($tabFichiersFtp); - -/** - * Dans le cas ou il y a eu une erreur de scan, la production passe a nouveau le - * document dans le scanner et le fichier est envoyé sur le ftp - * Le document est nommé G[ref],G[ref]-1,G[ref]-2,.....pdf. - * On garde donc le dernier document scanné. - */ -$lastRef = ''; -$tabFichiersTemp = array(); -foreach($tabFichiersFtp as $k => $val) -{ - list($ref, $indice) = explode('-',$k); - if( $lastRef != $ref ) { - $tabFichiersTemp[$ref] = $val; - } - $lastRef = $ref; -} -$tabFichiers = $tabFichiersTemp; -unset($tabFichiersTemp); - -/** - * Pour chaque commande, test de la présence d'un fichier associé - * Si le fichier correspond téléchargement du fichier - */ -foreach ($tabCommandes as $ref => $commande){ - foreach ($tabFichiers as $refAssocie => $fichier){ - if (substr($ref,1) == $refAssocie){ - echo date ('Y/m/d - H:i:s')." - Traitement de la commande $ref\n"; - if ($test){ - echo date ('Y/m/d - H:i:s')." - Fichier $fichier \n"; - } else { - - //Récupération du fichier depuis le FTP (s'il n'existe pas déjà) - if (!file_exists(ACTES_IGNUM_LOCAL_DIR.$fichier)){ - if (ftp_get($conn_id, ACTES_IGNUM_LOCAL_DIR.$fichier, $fichier, FTP_BINARY, 0)) { - echo date ('Y/m/d - H:i:s')." - Fichier $fichier téléchargé depuis le serveur FTP.\n"; - } else { - echo date ('Y/m/d - H:i:s')." - ERREUR : Impossible de télécharger le fichier $fichier !\n"; - } - } - - //Copie et renommage du fichier suivant la ref infogreffe (s'il n'existe pas déjà) - $sirenC = $commande['siren']; - $refC = $commande['refDocument']; - - require_once 'Infogreffe/Infogreffe.php'; - $infogreffe = new Infogreffe(); - if (preg_match('/^([0-9]{4}_).*?$/', $refC, $matches)){ - $path = $infogreffe->bilanPath($refC); - $nomCible = $infogreffe->bilanFilename($sirenC, $refC); - $type = 'bilan'; - } else { - $path = $infogreffe->actePath($refC); - $nomCible = $infogreffe->acteFilename($sirenC, $refC); - $type = 'acte'; - } - - if (file_exists(ACTES_IGNUM_LOCAL_DIR.$fichier) - && !file_exists(PATH_DATA.$path.$nomCible)) { - if (rename(ACTES_IGNUM_LOCAL_DIR.$fichier, PATH_DATA.$path.$nomCible)){ - if ( $type == 'acte' ){ - preg_match('/^acte-([0-9]{9})-([0-9a-zA-Z]{1,})-([0-9]{8})-(.*)-(.*)-(.*)-(.*)-(.*)-([0-9]{1,})\.pdf$/', $nomCible, $matches); - $siren = $matches[1]; - $type_acte = $matches[2]; - $date_acte = $matches[3]; - $num_acte = $matches[9]; - $actesM = new Application_Model_ActesFiles(); - $sql = $actesM->select()->where('file=?',$nomCible); - $result = $actesM->fetchRow($sql); - if ( null === $result ) { - $actesM->insert(array( - 'siren' => $siren, - 'type' => $type_acte, - 'date' => $date_acte, - 'num' => $num_acte, - 'file' => $nomCible, - )); - } - } - echo date ('Y/m/d - H:i:s')." - Fichier ".ACTES_IGNUM_LOCAL_DIR.$fichier." déplacé en ".PATH_DATA.$path.$nomCible.".\n"; - } else { - echo date ('Y/m/d - H:i:s')." ERREUR - Impossible de déplacer ".ACTES_IGNUM_LOCAL_DIR.$fichier." en ".PATH_DATA.$path.$nomCible." !\n"; - } - } - - //Envoi du mail et Mise à jour de la commande - $testMail = false; - if (file_exists(PATH_DATA.$path.$nomCible)){ - if ($testMail){ - echo "Envoi fichier $nomCible ($ref) à ".$commande['emailCommande']; - } else { - $report_txt.= "$ref intégré à l'extranet"; - $isMailSent = false; - if (trim($commande['emailCommande'])!=''){ - $isMailSent = sendMail($commande, $nomCible); - } else { - $isMailSent = true; - } - if ($isMailSent){ - echo date ('Y/m/d - H:i:s')." - Commande $ref mise à jour\n"; - $commandesM = new Application_Model_Commandes(); - $data = array( 'dateReception' => date('YmdHis')); - $commandesM->update($data, 'idCommande='.$commande['idCommande']); - $report_txt.= ' - Email envoyé à '.$commande['emailCommande']; - } else { - $report_txt.= ' - Email non envoyé !'; - echo date ('Y/m/d - H:i:s')." ERREUR - Email non envoyé et commande $ref non mise à jour\n"; - } - $report_txt.= "\n"; - } - } - - } - break; - } - } -} -ftp_close($conn_id); - -if (empty($report_txt)) { - $report_txt = "Aucun envoi."; -} - -//Envoi du mail de rapport -if (!$test && !$testMail){ - if (mail($report_email, $report_subject, utf8_decode($report_txt))){ - echo date ('Y/m/d - H:i:s')." - Rapport envoyé.\n"; - } else { - echo date ('Y/m/d - H:i:s')." - Erreur lors de l'envoir du rapport !\n"; - } -} - -?> \ No newline at end of file diff --git a/scripts/jobs/getAltiScore.php b/scripts/jobs/getAltiScore.php index 0e9e77d4b..aa07f9058 100644 --- a/scripts/jobs/getAltiScore.php +++ b/scripts/jobs/getAltiScore.php @@ -1,44 +1,17 @@ array( - __DIR__ . '/../../library/autoload_classmap.php', - ), - 'Zend_Loader_StandardAutoloader' => array( - 'prefixes' => array( - 'Zend' => __DIR__ . '/../../library/Zend', - 'Application' => __DIR__ . '/../../library/Application', - 'Scores' => __DIR__ . '/../../library/Scores', - 'Metier' => __DIR__ . '/../../library/Metier', - ), - 'fallback_autoloader' => true - ) -)); - -// Zend_Application - Use it if you don't have autoloaders -//require_once 'Zend/Application.php'; - -// Create application, bootstrap, and run -$application = new Zend_Application( - APPLICATION_ENV, - APPLICATION_PATH . '/configs/application.ini' -); +// --- Create application, bootstrap, and run +$application = new Zend_Application(APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini'); try { $opts = new Zend_Console_Getopt( diff --git a/scripts/jobs/greffeCmdCourrier.php b/scripts/jobs/greffeCmdCourrier.php deleted file mode 100644 index beb0bc196..000000000 --- a/scripts/jobs/greffeCmdCourrier.php +++ /dev/null @@ -1,179 +0,0 @@ -#!/usr/bin/php -q - array( - __DIR__ . '/../../library/autoload_classmap.php', - ), - 'Zend_Loader_StandardAutoloader' => array( - 'prefixes' => array( - 'Zend' => __DIR__ . '/../../library/Zend', - 'Application' => __DIR__ . '/../../library/Application', - 'Scores' => __DIR__ . '/../../library/Scores', - 'Metier' => __DIR__ . '/../../library/Metier', - ), - 'fallback_autoloader' => true - ) -)); - -// Zend_Application - Use it if you don't have autoloaders -//require_once 'Zend/Application.php'; - -// Create application, bootstrap, and run -$application = new Zend_Application( - APPLICATION_ENV, - APPLICATION_PATH . '/configs/application.ini' -); - -try { - $opts = new Zend_Console_Getopt( - //Options - array( - 'help|?' => "Affiche l'aide.", - )); - $opts->parse(); -} catch (Zend_Console_Getopt_Exception $e) { - echo $e->getUsageMessage(); - exit; -} - -//Usage -if(isset($opts->help)) -{ - echo "Liste les commandes courrier traités"; - echo "\n\n"; - echo $opts->getUsageMessage(); - echo "\n"; - exit; -} - -$c = new Zend_Config($application->getOptions()); -Zend_Registry::set('config', $c); - -require_once 'Scores/WsScores.php'; - -define('LOGIN', 'mricois'); -define('PASSWORD', ''); - -function listeCmd($statut) -{ - $commandes = new Application_Model_Commandes(); - $sql = $commandes->select() - ->where('typeCommande = ?', 'C') - ->where('statutCommande = ?', $statut); - $listeCmd = $commandes->fetchAll($sql); - - if(count($listeCmd)>0){ - $output = ""; - $output.= ""; - $output.= ""; - $output.= ""; - $output.= ""; - $output.= ""; - $output.= ""; - $output.= ""; - $output.= ""; - $output.= ""; - foreach($listeCmd as $cmd){ - $output.= ""; - $output.= ""; - $output.= ""; - $output.= ""; - $output.= ""; - $output.= ""; - - if( preg_match('/^([0-9]{4}_).*?$/', $cmd->refDocument, $matches) ){ - $type = 'bilans'; - }else{ - $type = 'actes'; - } - - $tribunalCode = codeTribunal($cmd->siren); - $infoPaiement = infoPaiement($tribunalCode, $type); - $txtInfo = "Pas d'information de paiement enregistré dans la base."; - if($infoPaiement!==false){ - $txtInfo = - "Chéque de ".$infoPaiement['prix']." ". - "à l'ordre de ".$infoPaiement['ordre']; - - if($infoPaiement['enveloppe']) - $txtInfo.= ", fournir une enveloppe timbré"; - } - $output.= ""; - $output.= ""; - $output.= ""; - $output.= ""; - } - $output.= ""; - $output.= "
Ref.SirenRef. DocumentDate de commande
C".$cmd->idCommande."". - "siren."&type=tri\" >". - $cmd->siren. - "".$cmd->refDocument."".$cmd->dateCommande."
 ".$txtInfo."
"; - }else{ - $output.= "Aucune commande
"; - } - return $output; -} - -function codeTribunal($siren) -{ - $ws = new WsScores(LOGIN, PASSWORD); - $identite = $ws->getIdentite($siren, 0); - return $identite->TribunalCode; -} - -function infoPaiement($codeTribunal, $type) -{ - $tarifs = new Application_Model_CommandesTarifs(); - $sql = $tarifs->select() - ->where('annee = ?', date('Y')) - ->where('type = ?', $type) - ->where('codeTribunal = ?', $codeTribunal); - $rows = $tarifs->fetchAll($sql); - if(count($rows)>0) { - return array( - 'prix'=> $rows[0]->prix, - 'enveloppe' => $rows[0]->enveloppe, - 'ordre' => $rows[0]->ordre - ); - } else { - return false; - } -} - -$emailTxt = ""; -//Liste commandes non-traites -$emailTxt.= "Liste des commandes courrier non-traités"; -$emailTxt.= "
"; -$emailTxt.= listeCmd(0); -$emailTxt.= "
"; -//Liste des commandes en attente de cheques -$emailTxt.= "Liste des commandes courrier en attente de chèque"; -$emailTxt.= "
"; -$emailTxt.= listeCmd(1); - -//Envoi mail -$mail = new Scores_Mail_Method(); -$mail->setFromKey('production'); -$mail->addTo('support@scores-decisions.com', 'Pieces'); -$mail->setSubject("[COMMANDES PIECES COURRIER] - ".date('d')."/".date('m')."/".date('Y')); -$mail->setBodyHtml($emailTxt); -$mail->execute(); \ No newline at end of file diff --git a/scripts/jobs/greffeCmdMois.php b/scripts/jobs/greffeCmdMois.php deleted file mode 100644 index 909853376..000000000 --- a/scripts/jobs/greffeCmdMois.php +++ /dev/null @@ -1,153 +0,0 @@ -#!/usr/bin/php -q - array( - __DIR__ . '/../../library/autoload_classmap.php', - ), - 'Zend_Loader_StandardAutoloader' => array( - 'prefixes' => array( - 'Zend' => __DIR__ . '/../../library/Zend', - 'Application' => __DIR__ . '/../../library/Application', - 'Scores' => __DIR__ . '/../../library/Scores', - 'Metier' => __DIR__ . '/../../library/Metier', - ), - 'fallback_autoloader' => true - ) -)); - -// Zend_Application - Use it if you don't have autoloaders -//require_once 'Zend/Application.php'; - -// Create application, bootstrap, and run -$application = new Zend_Application( - APPLICATION_ENV, - APPLICATION_PATH . '/configs/application.ini' -); - -/** Zend_Application */ -require_once 'Zend/Application.php'; - -// Create application, bootstrap, and run -$application = new Zend_Application( - APPLICATION_ENV, - APPLICATION_PATH . '/configs/application.ini' -); - -try { - $opts = new Zend_Console_Getopt( - //Options - array( - 'help|?' => "Affiche l'aide.", - )); - $opts->parse(); -} catch (Zend_Console_Getopt_Exception $e) { - echo $e->getUsageMessage(); - exit; -} - -//Usage -if(isset($opts->help)) -{ - echo "Liste les commandes non envoyées du mois dernier"; - echo "\n\n"; - echo $opts->getUsageMessage(); - echo "\n"; - echo $argv[0] . ' [AAAAMM] >> /vers/fichier.log'; - echo "\n"; - exit; -} -$args = $opts->getRemainingArgs(); - -$c = new Zend_Config($application->getOptions()); -Zend_Registry::set('config', $c); - -/** -* Connexion à la base de données -*/ -$db = Zend_Db::factory($c->profil->db->sdv1); -Zend_Db_Table_Abstract::setDefaultAdapter($db); - -function listCmdMois($statut, $date) -{ - $commandes = new Application_Model_Commandes(); - $sql = $commandes->select() - ->where('typeCommande = ?', 'G') - ->where('statutCommande = ?', $statut) - ->where('dateCommande LIKE ?', $date.'%') - ->where('dateReception = ?', '0000-00-00 00:00:00'); - return $commandes->fetchAll($sql); -} - -//=> Debut -if (count($args)>1){ - echo "Erreur\n"; - exit; -} elseif (count($args)==0){ - $timeMoisPrecedent = mktime(0, 0, 0, date('m')-1, 1, date('Y')); - $moisPrecedent = date('Y-m', $timeMoisPrecedent); -} else { - $moisPrecedent = substr($args[0],0,4).'-'.substr($args[0],4,2); -} - -$listeCmd = listCmdMois(0, $moisPrecedent); - -$emailTxt = ''; -//Liste commandes non-traites -$emailTxt.= 'Commandes greffe non receptionné'; -$emailTxt.= '
'; -if(count($listeCmd)>0){ - $emailTxt.= ''; - $emailTxt.= ''; - $emailTxt.= ''; - $emailTxt.= ''; - $emailTxt.= ''; - $emailTxt.= ''; - $emailTxt.= ''; - $emailTxt.= ''; - $emailTxt.= ''; - $emailTxt.= ''; - foreach($listeCmd as $cmd){ - $emailTxt.= ''; - $emailTxt.= ''; - $emailTxt.= ''; - if( preg_match('/^([0-9]{4}_).*?$/', $cmd->refDocument, $matches) ){ - $type = 'bilans'; - }else{ - $type = 'actes'; - } - $emailTxt.= ''; - $emailTxt.= ''; - $emailTxt.= ''; - } - $emailTxt.= ''; - $emailTxt.= '
Ref.SirenRef. DocumentDate de commande
G'.$cmd->idCommande.''.$cmd->siren.''.$cmd->refDocument.''.$cmd->dateCommande.'
'; -}else{ - $emailTxt.= "Aucune commande
"; -} -$emailTxt.= '
'; - -//Envoi mail -$mail = new Scores_Mail_Method(); -$mail->setSubject("[Commandes greffe non receptionné] - ".date('d')."/".date('m')."/".date('Y')); -$mail->setFromKey('production'); -$mail->addTo('support@scores-decisions.com', 'Support'); -$mail->addTo('supportdev@scores-decisions.com', 'SupportDev'); -$mail->setBodyHtml($emailTxt); -$mail->execute(); \ No newline at end of file diff --git a/scripts/jobs/greffeCmdTelechargement.php b/scripts/jobs/greffeCmdTelechargement.php deleted file mode 100644 index 61ca717bc..000000000 --- a/scripts/jobs/greffeCmdTelechargement.php +++ /dev/null @@ -1,200 +0,0 @@ -#!/usr/bin/php -q - array( - __DIR__ . '/../../library/autoload_classmap.php', - ), - 'Zend_Loader_StandardAutoloader' => array( - 'prefixes' => array( - 'Zend' => __DIR__ . '/../../library/Zend', - 'Application' => __DIR__ . '/../../library/Application', - 'Scores' => __DIR__ . '/../../library/Scores', - 'Metier' => __DIR__ . '/../../library/Metier', - ), - 'fallback_autoloader' => true - ) -)); - -// Zend_Application - Use it if you don't have autoloaders -//require_once 'Zend/Application.php'; - -// Create application, bootstrap, and run -$application = new Zend_Application( - APPLICATION_ENV, - APPLICATION_PATH . '/configs/application.ini' -); - -try { - $opts = new Zend_Console_Getopt( - //Options - array( - 'help|?' => "Affiche l'aide.", - 'reprise' => "Reprise des actes en erreur de moins de 120 heures", - 'rapport' => "Envoi d'un email listant les commandes en erreur à J-1", - 'rapportcomplet' => "Envoi d'un email listant toutes les commandes en erreur", - )); - $opts->parse(); -} catch (Zend_Console_Getopt_Exception $e) { - echo $e->getUsageMessage(); - exit; -} - -/** - * Usage - */ -if(count($opts->getOptions())==0 || isset($opts->help)) -{ - echo "Reprise de commande InfoGreffe par le WebService."; - echo "\n\n"; - echo $opts->getUsageMessage(); - echo "\n"; - exit; -} - -$c = new Zend_Config($application->getOptions()); -Zend_Registry::set('config', $c); - -define ('PATH_DATA', $c->profil->path->data); - -/** - * Connexion à la base de données - */ -$db = Zend_Db::factory($c->profil->db->sdv1); -Zend_Db_Table_Abstract::setDefaultAdapter($db); -$db->setFetchMode(Zend_Db::FETCH_OBJ); - -if ( isset($opts->reprise) ) -{ - $timestamp = mktime(0, 0, 0, date("m"), date("d")-5, date("Y")); - $daybefore = date('Y-m-d', $timestamp); - $commandesM = new Application_Model_CommandesErreur(); - $sql = $commandesM->select()->where("dateReception='0000-00-00 00:00:00' AND dateCommande > '".$daybefore." 00:00:00'"); - $repErreur = $commandesM->fetchAll($sql); - - if (count($repErreur)==0) exit; - - foreach($repErreur as $cmd) - { - require_once 'Infogreffe/Infogreffe.php'; - $infogreffe = new Infogreffe(); - switch($cmd->type){ - case 'acte': - $path = $infogreffe->actePath($cmd->ref); - $fichier = $infogreffe->acteFilename($cmd->siren, $cmd->ref); - break; - case 'bilan': - $path = $infogreffe->bilanPath('0000_'.$cmd->ref); - $fichier = $infogreffe->bilanFilename($cmd->siren, '0000_'.$cmd->ref); - break; - } - echo date('Y-m-d\TH:i:s').' - '.$path.$fichier." = "; - $dl = $infogreffe->dl($path.$fichier, $cmd->url, false); - echo $dl."\n"; - if( $dl ) { - $data = array('erreur' => '', 'dateReception' => date('Y-m-d H:i:s')); - $where = "siren='".$cmd->siren."' AND type='".$cmd->type."' AND ref='".$cmd->ref."' AND dateCommande='".$cmd->dateCommande."'"; - $commandesM->update($data, $where); - } - } - -} - -if ( isset($opts->rapport) || isset($opts->rapportcomplet) ) -{ - $commandesM = new Application_Model_CommandesErreur(); - if (isset($opts->rapportcomplet)) { - $sql = $commandesM->select()->where("erreur!='' AND dateReception='0000-00-00 00:00:00'") - ->order("dateCommande ASC"); - $sujet = "[Commandes Greffe - Erreur WebService] - Rapport Complet"; - } else { - $timestamp = mktime(0, 0, 0, date("m"), date("d")-1, date("Y")); - $hier = date('Y-m-d', $timestamp); - $sujet = "[Commandes Greffe - Erreur WebService] - ".$hier; - $sql = $commandesM->select()->where("(dateCommande BETWEEN '".$hier." 00:00:00' AND '".$hier." 23:59:59') AND erreur!='' AND dateReception='0000-00-00 00:00:00'") - ->order("dateCommande ASC");; - } - $repErreur = $commandesM->fetchAll($sql); - - $emailTxt = 'Commandes Greffe - Erreur WebService'; - $emailTxt.= '
'; - if (count($repErreur)==0) { - - $emailtTxt.= "Aucune commande en erreur !"; - - } else { - $emailTxt.= ''; - $emailTxt.= ''; - $emailTxt.= ''; - $emailTxt.= ''; - $emailTxt.= ''; - $emailTxt.= ''; - $emailTxt.= ''; - $emailTxt.= ''; - $emailTxt.= ''; - $emailTxt.= ''; - $emailTxt.= ''; - $emailTxt.= ''; - foreach($repErreur as $cmd) - { - require_once 'Infogreffe/Infogreffe.php'; - $infogreffe = new Infogreffe(); - switch($cmd->type){ - case 'acte': - $path = $infogreffe->actePath($cmd->ref); - $fichier = $infogreffe->acteFilename($cmd->siren, $cmd->ref); - break; - case 'bilan': - - $path = $infogreffe->bilanPath($cmd->ref); - - $fichier = $infogreffe->bilanFilename($cmd->siren, $cmd->ref); - break; - } - //Le fichier existe, alors on a résolu le problème (mauellement ?) - if( file_exists(PATH_DATA . $path . $fichier) ) { - $data = array('erreur' => '', 'dateReception' => date('Y-m-d H:i:s')); - $where = "siren='".$cmd->siren."' AND type='".$cmd->type."' AND ref='".$cmd->ref."' AND dateCommande='".$cmd->dateCommande."'"; - $commandesM->update($data, $where); - } else { - //Lister les fichier en erreur - $emailTxt.= ''; - $emailTxt.= ''; - $emailTxt.= ''; - $emailTxt.= ''; - $emailTxt.= ''; - $emailTxt.= ''; - $emailTxt.= ''; - $emailTxt.= ''; - } - } - $emailTxt.= ''; - $emailTxt.= '
SirenTypeRefDate de commandeURLErreur
'.$cmd->siren.''.$cmd->type.''.$cmd->ref.''.$cmd->dateCommande.''.$cmd->url.''.$cmd->erreur.'
'; - $emailTxt.= '
'; - $emailTxt = utf8_encode($emailTxt); - } - //Envoi mail - $mail = new Scores_Mail_Method(); - $mail->setFromKey('production'); - $mail->addTo('support@scores-decisions.com', 'Support'); - $mail->addTo('supportdev@scores-decisions.com', 'Support Dev'); - $mail->setSubject($sujet); - $mail->setBodyText($emailTxt); - $mail->execute(); -} \ No newline at end of file diff --git a/scripts/jobs/removeTempFile.php b/scripts/jobs/removeTempFile.php index e26b6135a..7e31f9b48 100644 --- a/scripts/jobs/removeTempFile.php +++ b/scripts/jobs/removeTempFile.php @@ -1,44 +1,17 @@ array( - __DIR__ . '/../../library/autoload_classmap.php', - ), - 'Zend_Loader_StandardAutoloader' => array( - 'prefixes' => array( - 'Zend' => __DIR__ . '/../../library/Zend', - 'Application' => __DIR__ . '/../../library/Application', - 'Scores' => __DIR__ . '/../../library/Scores', - 'Metier' => __DIR__ . '/../../library/Metier', - ), - 'fallback_autoloader' => true - ) -)); - -// Zend_Application - Use it if you don't have autoloaders -//require_once 'Zend/Application.php'; - -// Create application, bootstrap, and run -$application = new Zend_Application( - APPLICATION_ENV, - APPLICATION_PATH . '/configs/application.ini' -); +// --- Create application, bootstrap, and run +$application = new Zend_Application(APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini'); try { $opts = new Zend_Console_Getopt(