Skip to content

Commit

Permalink
Release 3.3.1e (#1015)
Browse files Browse the repository at this point in the history
** Bugfix 
* Bugfix : no filter on delete document
* Bugfix : change order to validate values
* Bugfix : DocIdRef was not returned
* Bugfix : add missing setter method for manual parameter
* Bugfix : change value formula to manage parentheses
* Bugfix : We don't send output for the API and Myddleware UI
* Bugfix : change the way to get the environment
* Bugfix : enhance function changeValue and changeMultiValue
* Bugfix : dateref value
* Bugfix : Manage space into formula changeValue and changeMultiValue
* Bugfix : Rename function checkParentDocument to checkParentDocuments for rule and job classes
* Bugfix : Add http-client library
* Bugfix : Myddleware 3.3 : Change dockerfile
* Bugfix : clearSendData (manage fields 'source_date_modified', 'id_doc_myddleware', 'Myddleware_element_id' )
* Bugfix : output management
* Bugfix : manage return null value for check methods
* Bugfix : change the type attribute from private to protected
* Bugfix : init $emailAddresses attribute

** Connector
* SugarCRM : deletion management
* SugarCRM : a duplicate field on email address module
* Moodle : imporve error management
* Moodle : manage create only fields
* Moodle : fix issue on new custom field function
* Salesforce : add rule mode Update only (U)
* Airtable : fix bug on reference date
* Airtable : fix ref date field name
  • Loading branch information
Myddleware authored May 12, 2023
1 parent 771d278 commit f1294a1
Show file tree
Hide file tree
Showing 18 changed files with 314 additions and 141 deletions.
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
MYDDLEWARE_VERSION=3.3.1d
MYDDLEWARE_VERSION=3.3.2a

APP_SECRET=Thissecretisnotsosecretchangeit
APP_ENV=prod
Expand Down
85 changes: 16 additions & 69 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,95 +1,42 @@
FROM --platform=linux/amd64 php:7.4.26-apache
LABEL maintainer="Francesco Bianco <[email protected]>"
FROM --platform=linux/amd64 php:8.1.17-apache

## Configure PHP
RUN apt-get update && apt-get upgrade -y && \
apt-get -y install -qq --force-yes rsync mariadb-client libzip-dev libicu-dev git zlib1g-dev libc-client-dev libkrb5-dev cron rsyslog unzip libssh2-1-dev gnupg2 alien libaio1 nano vim net-tools iputils-ping telnet && \
apt-get -y install -qq --force-yes mariadb-client libzip-dev libicu-dev zlib1g-dev libc-client-dev libkrb5-dev gnupg2 libaio1 && \
docker-php-ext-configure intl && docker-php-ext-configure imap --with-kerberos --with-imap-ssl && \
docker-php-ext-install imap exif mysqli pdo pdo_mysql zip intl && \
echo "short_open_tag=off" >> /usr/local/etc/php/conf.d/syntax.ini && \
echo "memory_limit=-1" >> /usr/local/etc/php/conf.d/memory_limit.ini && \
echo "display_errors=0" >> /usr/local/etc/php/conf.d/errors.ini && \
sed -e 's!DocumentRoot /var/www/html!DocumentRoot /var/www/html/public!' -ri /etc/apache2/sites-available/000-default.conf && \
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/bin/ --filename=composer && \
apt-get clean && rm -rf /tmp/* /var/tmp/* /var/lib/apt/lists/*

RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/bin/ --filename=composer
#RUN pecl install -f ssh2-1.1.2 && docker-php-ext-enable ssh2

## Install PHP Accelerators
RUN pecl install apcu \
&& pecl install apcu_bc-1.0.3 \
&& docker-php-ext-enable apcu --ini-name 10-docker-php-ext-apcu.ini \
&& docker-php-ext-enable apc --ini-name 20-docker-php-ext-apc.ini
COPY composer.json ./composer.json
COPY composer.lock ./composer.lock
RUN composer install

## Intall NodeJS
RUN curl -fsSL https://deb.nodesource.com/setup_lts.x | bash - && \
apt-get update && apt-get install -y nodejs build-essential && npm install -g npm yarn && \
apt-get clean && rm -rf /tmp/* /var/tmp/* /var/lib/apt/lists/*

## Install Xdebug
RUN pecl install -f xdebug && \
docker-php-ext-enable xdebug && \
echo "xdebug.remote_enable = 1" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini && \
echo "xdebug.remote_host=host.docker.internal" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini && \
echo "xdebug.remote_autostart = 0" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini && \
echo "xdebug.remote_connect_back = 0" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini && \
echo "xdebug.remote_port = 9000" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini && \
echo "xdebug.remote_handler = 'dbgp'" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini && \
echo "xdebug.remote_mode = req" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini

## Install MS Database
#RUN curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - && \
# curl https://packages.microsoft.com/config/debian/10/prod.list > /etc/apt/sources.list.d/mssql-release.list && \
# apt-get update && \
# apt-get install --no-install-recommends -y msodbcsql17 unixodbc-dev && \
# pecl install -f sqlsrv pdo_sqlsrv && \
# docker-php-ext-enable sqlsrv pdo_sqlsrv && \
# sed -i 's,^\(MinProtocol[ ]*=\).*,\1'TLSv1.0',g' /etc/ssl/openssl.cnf && \
# sed -i 's,^\(CipherString[ ]*=\).*,\1'DEFAULT@SECLEVEL=1',g' /etc/ssl/openssl.cnf

## Install Oracle Database
RUN curl "https://download.oracle.com/otn_software/linux/instantclient/195000/oracle-instantclient19.5-sqlplus-19.5.0.0.0-1.x86_64.rpm" -o "/mnt/oracle-instant-sqlplus.rpm" && \
curl "https://download.oracle.com/otn_software/linux/instantclient/195000/oracle-instantclient19.5-basic-19.5.0.0.0-1.x86_64.rpm" -o "/mnt/oracle-instant-basic.rpm" && \
curl "https://download.oracle.com/otn_software/linux/instantclient/195000/oracle-instantclient19.5-devel-19.5.0.0.0-1.x86_64.rpm" -o "/mnt/oracle-instant-devel.rpm" && \
curl "https://download.oracle.com/otn_software/linux/instantclient/195000/oracle-instantclient19.5-odbc-19.5.0.0.0-1.x86_64.rpm" -o "/mnt/oracle-instant-odbc.rpm" && \
curl "https://download.oracle.com/otn_software/linux/instantclient/195000/oracle-instantclient19.5-tools-19.5.0.0.0-1.x86_64.rpm" -o "/mnt/oracle-instant-tools.rpm" && \
alien -i /mnt/oracle-instant-sqlplus.rpm && \
alien -i /mnt/oracle-instant-basic.rpm && \
alien -i /mnt/oracle-instant-devel.rpm && \
alien -i /mnt/oracle-instant-odbc.rpm && \
alien -i /mnt/oracle-instant-tools.rpm && \
ln -s /usr/lib/oracle/19.5/client64/lib/libsqora.so.19.1 /usr/lib/libsqora.so && \
rm /mnt/* && \
export LD_LIBRARY_PATH=/usr/lib/oracle/19.5/client64/lib && \
export ORACLE_HOME=/usr/lib/oracle/19.5/client64 && \
export C_INCLUDE_PATH=/usr/include/oracle/19.5/client64 && \
docker-php-ext-install oci8 pdo_oci
COPY --chown=www-data:www-data . .

## Install Platform tool
RUN curl -sS https://platform.sh/cli/installer | php && \
ln -s /root/.platformsh/bin/platform /usr/local/bin/platform
# Build packages with yarn
RUN yarn install
RUN yarn run build

## Setup Cronjob
RUN echo "cron.* /var/log/cron.log" >> /etc/rsyslog.conf && rm -fr /etc/cron.* && mkdir /etc/cron.d
COPY docker/etc/crontab /etc/
RUN chmod 600 /etc/crontab

## Install DBLIB
#RUN apt-get update && \
# apt-get install -y freetds-bin freetds-dev freetds-common libct4 libsybdb5 tdsodbc libfreetype6-dev libjpeg62-turbo-dev libmcrypt-dev zlib1g-dev libicu-dev g++ libc-client-dev && \
# docker-php-ext-configure pdo_dblib --with-libdir=/lib/x86_64-linux-gnu && \
# docker-php-ext-configure intl && \
# docker-php-ext-install pdo_dblib && \
# docker-php-ext-install intl && \
# docker-php-ext-install mbstring && \
# docker-php-ext-enable intl mbstring pdo_dblib

## Sysadmin tools
RUN apt-get update && apt-get upgrade -y && \
apt-get -y install -qq --force-yes nano vim net-tools iputils-ping telnet
# RUN echo "cron.* /var/log/cron.log" >> /etc/rsyslog.conf && rm -fr /etc/cron.* && mkdir /etc/cron.d
# COPY docker/etc/crontab /etc/
# RUN chmod 600 /etc/crontab

## Entrypoint and scripts
COPY ./docker/script/myddleware-cron.sh /usr/local/bin/myddleware-cron.sh
COPY ./docker/script/myddleware-foreground.sh /usr/local/bin/myddleware-foreground.sh
COPY ./docker/script/myddleware-monitor.sh /usr/local/bin/myddleware-monitor.sh
COPY ./docker/script/myddleware-cron.sh /usr/local/bin/myddleware-cron.sh

RUN chmod +x /usr/local/bin/myddleware-*.sh
CMD ["myddleware-foreground.sh"]
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
"symfony/flex": "^1.3.1",
"symfony/form": "5.4.*",
"symfony/framework-bundle": "5.4.*",
"symfony/http-client": "5.4.*",
"symfony/http-foundation": "5.4.*",
"symfony/mailer": "5.4.*",
"symfony/monolog-bundle": "3.8.*",
Expand Down
169 changes: 167 additions & 2 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/Command/SynchroCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$this->jobManager->checkPredecessorDocuments();

// Permet de valider qu'au moins un document parent(relation père) est existant
$this->jobManager->checkParentDocument();
$this->jobManager->checkParentDocuments();

// Permet de transformer les docuement avant d'être envoyés à la cible
$this->jobManager->transformDocuments();
Expand Down
25 changes: 20 additions & 5 deletions src/Manager/DocumentManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ class documentcore
protected $jobId;
protected $key;
protected $docIdRefError;
protected $env;
protected bool $transformError = false;
protected ?ToolsManager $tools;
protected $api; // Specify if the class is called by the API
Expand Down Expand Up @@ -122,6 +123,7 @@ public function __construct(
$this->tools = $tools;
$this->formulaManager = $formulaManager;
$this->solutionManager = $solutionManager;
$this->env = $_SERVER['APP_ENV'];
}

public static function lstGblStatus(): array
Expand Down Expand Up @@ -361,8 +363,12 @@ public function filterDocument($ruleFilters)
}
try {
$filterOK = true;
// Si des filtres sont présents
if (!empty($ruleFilters)) {
// Only if there is a least one filter
// No filter on delete document as they will be filter after is Myddleware never sent the data
if (
!empty($ruleFilters)
AND $this->documentType != 'D'
) {
// Boucle sur les filtres
foreach ($ruleFilters as $ruleFilter) {
if (!$this->checkFilter($this->sourceData[$ruleFilter['target']], $ruleFilter['type'], $ruleFilter['value'])) {
Expand Down Expand Up @@ -689,7 +695,7 @@ public function checkPredecessorDocument(): bool
return true;
} catch (\Exception $e) {
// Reference document id is used to show which document is blocking the current document in Myddleware
$this->docIdRefError = (is_array($result) and !empty($result['id']) ? $result['id'] : '');
$this->docIdRefError = ((is_array($result) and !empty($result['id'])) ? $result['id'] : '');
$this->message .= 'Failed to check document predecessor : '.$e->getMessage().' '.$e->getFile().' Line : ( '.$e->getLine().' )';
$this->typeError = 'E';
$this->updateStatus('Predecessor_KO');
Expand Down Expand Up @@ -1922,7 +1928,11 @@ public function updateStatus($new_status)
WHERE
id = :id
';
if (!$this->api) {
// We don't send output for the API and Myddleware UI
if (
!$this->api
AND $this->env == 'background'
) {
echo 'status '.$new_status.' id = '.$this->id.' '.$now.chr(10);
}
// Suppression de la dernière virgule
Expand Down Expand Up @@ -1962,7 +1972,11 @@ public function updateDeleteFlag($deleted)
WHERE
id = :id
';
if (!$this->api) {
// We don't send output for the API and Myddleware UI
if (
!$this->api
AND $this->env != 'prod'
) {
echo(!empty($deleted) ? 'Remove' : 'Restore').' document id = '.$this->id.' '.$now.chr(10);
}
$stmt = $this->connection->prepare($query);
Expand Down Expand Up @@ -2180,6 +2194,7 @@ protected function getTargetId($ruleRelationship, $record_id)
{
try {
$direction = $this->getRelationshipDirection($ruleRelationship);

// En fonction du sens de la relation, la recherche du parent id peut-être inversée (recherchée en source ou en cible)
// Search all documents with target ID not empty in status close or no_send (document canceled but it is a real document)
if ('-1' == $direction) {
Expand Down
Loading

0 comments on commit f1294a1

Please sign in to comment.