diff --git a/.gitignore b/.gitignore index ee66014..3558738 100644 --- a/.gitignore +++ b/.gitignore @@ -8,4 +8,5 @@ /debian/php-flexibee-matcher.debhelper.log /debian/php-flexibee-matcher.postrm.debhelper /debian/php-flexibee-matcher.substvars -/.vagrant/ \ No newline at end of file +/.vagrant/ +/nbproject/private/ \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 6d4ea35..22a3922 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ -FROM php:7.2.7-cli-stretch -MAINTAINER Vítězslav Dvořák +FROM php:7.2.7-cli-buster +LABEL maintainer="Vítězslav Dvořák " RUN apt update && apt-get install -my wget gnupg @@ -13,3 +13,26 @@ RUN echo "deb [trusted=yes] file:///repo/ ./" > /etc/apt/sources.list.d/local.li RUN apt update ; RUN DEBIAN_FRONTEND=noninteractive apt-get -y install flexibee-matcher + + +FROM debian:latest +LABEL maintainer="info@vitexsoftware.cz" +ENV TERM xterm +ENV DEBIAN_FRONTEND noninteractive + +RUN apt update ; apt -y install lsb-release wget dialog apt-utils cron msmtp +RUN echo "deb http://repo.vitexsoftware.cz $(lsb_release -sc) main paid" | tee /etc/apt/sources.list.d/vitexsoftware.list +RUN wget -O /etc/apt/trusted.gpg.d/vitexsoftware.gpg http://repo.vitexsoftware.cz/keyring.gpg + +COPY flexibee-dev.spoje.conf /etc/flexibee/client.conf + +RUN apt update ; apt -y install flexibee-reminder-sms + +COPY msmtprc /etc/msmtprc +COPY mail.ini /etc/php/7.3/mods-available +RUN phpenmod mail + +#EXPOSE 80 + +CMD ["cron", "-f"] + diff --git a/bin/flexibee-matcher b/bin/flexibee-matcher index 9017e66..ddb44f0 100755 --- a/bin/flexibee-matcher +++ b/bin/flexibee-matcher @@ -1,3 +1,3 @@ #!/bin/bash -php -f /usr/lib/php-flexibee-matcher/ParujPrijateFaktury.php -php -f /usr/lib/php-flexibee-matcher/ParujVydaneFaktury.php +php -f /usr/lib/flexibee-matcher/ParujPrijateFaktury.php +php -f /usr/lib/flexibee-matcher/ParujVydaneFaktury.php diff --git a/bin/flexibee-matcher-in b/bin/flexibee-matcher-in index 69cb5b4..0377ec1 100644 --- a/bin/flexibee-matcher-in +++ b/bin/flexibee-matcher-in @@ -1,2 +1,2 @@ #!/bin/bash -php -f /usr/lib/php-flexibee-matcher/ParujPrijateFaktury.php +php -f /usr/lib/flexibee-matcher/ParujPrijateFaktury.php diff --git a/bin/flexibee-matcher-new2old b/bin/flexibee-matcher-new2old index 7dcfddb..2c3f058 100755 --- a/bin/flexibee-matcher-new2old +++ b/bin/flexibee-matcher-new2old @@ -1,3 +1,3 @@ #!/bin/bash -php -f /usr/lib/php-flexibee-matcher/ParujFakturyNew2Old.php +php -f /usr/lib/flexibee-matcher/ParujFakturyNew2Old.php diff --git a/bin/flexibee-matcher-out b/bin/flexibee-matcher-out index e616551..f93a064 100644 --- a/bin/flexibee-matcher-out +++ b/bin/flexibee-matcher-out @@ -1,3 +1,3 @@ #!/bin/bash -php -f /usr/lib/php-flexibee-matcher/ParujVydaneFaktury.php +php -f /usr/lib/flexibee-matcher/ParujVydaneFaktury.php diff --git a/bin/flexibee-pull-bank b/bin/flexibee-pull-bank index 0565d7a..b95f471 100644 --- a/bin/flexibee-pull-bank +++ b/bin/flexibee-pull-bank @@ -1,2 +1,2 @@ #!/bin/bash -php -f /usr/lib/php-flexibee-matcher/StahniBanku.php +php -f /usr/lib/flexibee-matcher/StahniBanku.php diff --git a/composer.json b/composer.json index 05d7c08..be0cc67 100644 --- a/composer.json +++ b/composer.json @@ -14,7 +14,8 @@ "minimum-stability": "dev", "autoload": { "psr-4": { - "FlexiPeeHP\\Matcher\\": "src/FlexiPeeHP/Matcher/" + "FlexiPeeHP\\Matcher\\": "src/FlexiPeeHP/Matcher/", + "FlexiPeeHP\\Matcher\\Ui\\": "src/FlexiPeeHP/Matcher/Ui/" } } } diff --git a/debian/changelog b/debian/changelog index a6ddb3c..c70d8d1 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,12 +1,10 @@ -flexibee-matcher (0.7.10) UNRELEASED; urgency=medium +flexibee-matcher (0.8) UNRELEASED; urgency=medium [ vitex ] * Rename Composer Package in Debian to be Composer 2.0 valid + * Configuration is get from Enviroment if /etc/flexibee/cliet.json does not exist. - [ Vítězslav Dvořák ] - * - - -- vitex Wed, 13 Mar 2019 11:25:46 +0100 + -- CyberVitexus Wed, 29 Apr 2020 00:10:31 +0200 flexibee-matcher (0.7.6) experimental; urgency=medium diff --git a/debian/conf/composer.json b/debian/conf/composer.json index 7e5d5e9..544fe34 100644 --- a/debian/conf/composer.json +++ b/debian/conf/composer.json @@ -15,27 +15,32 @@ "require": { "deb/flexibee-bricks": "*" }, + "autoload": { + "psr-4": { + "FlexiPeeHP\\Matcher\\": "FlexiPeeHP/Matcher/", + "FlexiPeeHP\\Matcher\\Ui\\": "FlexiPeeHP/Matcher/Ui/" + } + }, "repositories": [ { "type": "path", - "url": "/usr/share/php/Ease", - "options": { - "symlink": true - } + "url": "/usr/share/php/Ease" + }, + { + "type": "path", + "url": "/usr/share/php/EaseHtml" + }, + { + "type": "path", + "url": "/usr/share/php/FlexiPeeHP" }, { "type": "path", - "url": "/usr/share/php/FlexiPeeHP", - "options": { - "symlink": true - } + "url": "/usr/share/php/EaseBricks" }, { "type": "path", - "url": "/usr/share/php/FlexiPeeHPBricks", - "options": { - "symlink": true - } + "url": "/usr/share/php/FlexiPeeHPBricks" } ] -} +} \ No newline at end of file diff --git a/debian/control b/debian/control index fd53343..adfe241 100644 --- a/debian/control +++ b/debian/control @@ -7,8 +7,8 @@ Priority: optional Homepage: https://github.com/VitexSoftware/php-flexibee-matcher Package: flexibee-matcher -Depends: ${misc:Depends}, php-flexibee-config, php-flexibee-bricks, php-cli -Suggests: flexibee-server +Depends: ${misc:Depends}, php-flexibee-bricks, php-cli +Suggests: flexibee-server, php-flexibee-config Architecture: all Section: web Priority: optional diff --git a/debian/postinst b/debian/postinst index ae8be75..806f057 100644 --- a/debian/postinst +++ b/debian/postinst @@ -1,6 +1,6 @@ #!/bin/sh # postinst script for flexibee-matcher -WEBUSER="root" + set -e if [ "$1" = "configure" ]; then @@ -9,6 +9,8 @@ set -e fi +db_get composer/WEB_USER +WEBUSER=$RET mkdir -p /var/lib/composer chown $WEBUSER:$WEBUSER /var/lib/composer diff --git a/debian/preinst b/debian/preinst index f15c3d6..11eeb79 100755 --- a/debian/preinst +++ b/debian/preinst @@ -7,8 +7,6 @@ set -e . /usr/share/debconf/confmodule - php-flexibee-checker - fi diff --git a/debian/prerm b/debian/prerm index b5333b7..bfda82e 100755 --- a/debian/prerm +++ b/debian/prerm @@ -1,7 +1,7 @@ #!/bin/bash -# rm script for php-flexibee-reminder +# rm script for flexibee-reminder -rm -f /usr/share/php-flexibee-reminder/composer.lock +rm -f /usr/share/flexibee-reminder/composer.lock #DEBHELPER# diff --git a/nbproject/project.xml b/nbproject/project.xml index 15fdad9..68c0737 100644 --- a/nbproject/project.xml +++ b/nbproject/project.xml @@ -3,7 +3,7 @@ org.netbeans.modules.php.project - php-flexibee-matcher + flexibee-matcher diff --git a/src/Init.php b/src/Init.php index b0fc764..be78b1b 100644 --- a/src/Init.php +++ b/src/Init.php @@ -1,49 +1,51 @@ loadConfig('../client.json',true); -$shared->loadConfig('../matcher.json',true); +$shared = new Ease\Shared(); +if (file_exists('../client.json')) { + $shared->loadConfig('../client.json', true); +} +$shared->loadConfig('../matcher.json', true); $labeler = new FlexiPeeHP\Stitek(); -$labeler->logBanner('EasePHP Bricks v? '.constant('EASE_APPNAME')); +$labeler->logBanner('EasePHP Bricks v? ' . constant('EASE_APPNAME')); $labeler->addStatusMessage(_('checking labels'), 'debug'); $updateCfg = false; foreach (['PREPLATEK', 'CHYBIFAKTURA', 'NEIDENTIFIKOVANO'] as $label) { - if (is_null($shared->getConfigValue('LABEL_'.$label))) { - $shared->setConfigValue('LABEL_'.$label, $label); + if (is_null($shared->getConfigValue('LABEL_' . $label))) { + $shared->setConfigValue('LABEL_' . $label, $label); $labeler->addStatusMessage(sprintf(_('Cannot find LABEL_%s in config file matcher.json. Using default value: %s'), - $label, $label), 'warning'); + $label, $label), 'warning'); $updateCfg = true; } - if ($labeler->recordExists(['kod' => $shared->getConfigValue('LABEL_'.$label)]) - === false) { - $labeler->createNew($shared->getConfigValue('LABEL_'.$label), ['banka']); + if ($labeler->recordExists(['kod' => $shared->getConfigValue('LABEL_' . $label)]) === false) { + $labeler->createNew($shared->getConfigValue('LABEL_' . $label), ['banka']); $labeler->addStatusMessage(sprintf(_('LABEL_%s: %s was created in FlexiBee'), - $label, $shared->getConfigValue('LABEL_'.$label)), 'success'); + $label, $shared->getConfigValue('LABEL_' . $label)), 'success'); } else { $labeler->addStatusMessage(sprintf(_('LABEL_%s: %s exists in FlexiBee'), - $label, $shared->getConfigValue('LABEL_'.$label))); + $label, $shared->getConfigValue('LABEL_' . $label))); } } if ($updateCfg === true) { foreach ([ - "EASE_APPNAME", "EASE_MAILTO", "EASE_LOGGER", "LOCALIZE", "PULL_BANK", - "DAYS_BACK", "LABEL_PREPLATEK", "LABEL_CHYBIFAKTURA", "LABEL_NEIDENTIFIKOVANO"] as $cfg) { +"EASE_APPNAME", "EASE_MAILTO", "EASE_LOGGER", "LOCALIZE", "PULL_BANK", + "DAYS_BACK", "LABEL_PREPLATEK", "LABEL_CHYBIFAKTURA", "LABEL_NEIDENTIFIKOVANO"] as $cfg) { $cfg2save[$cfg] = $shared->getConfigValue($cfg); } if (file_put_contents('../matcher.json', - json_encode($cfg2save, JSON_PRETTY_PRINT))) { + json_encode($cfg2save, JSON_PRETTY_PRINT))) { $labeler->addStatusMessage(_('../matcher.json was updated'), 'success'); } else { $labeler->addStatusMessage(_('../matcher.json was not updated', 'error'), - 'success'); + 'success'); } } $labeler->addStatusMessage(_('labels check done'), 'debug'); diff --git a/src/ParujFakturyNew2Old.php b/src/ParujFakturyNew2Old.php index 48b3592..cb8e344 100644 --- a/src/ParujFakturyNew2Old.php +++ b/src/ParujFakturyNew2Old.php @@ -1,16 +1,19 @@ - * @copyright (c) 2018, Vítězslav Dvořák + * @copyright (c) 2018-2020, Vítězslav Dvořák */ define('EASE_APPNAME', 'ParujFakturyNewToOld'); require_once '../vendor/autoload.php'; $shared = new Ease\Shared(); -$shared->loadConfig('../client.json', true); +if (file_exists('../client.json')) { + $shared->loadConfig('../client.json', true); +} $shared->loadConfig('../matcher.json', true); //new \Ease\Locale($shared->getConfigValue('LOCALIZE'), '../i18n', // 'flexibee-matcher'); @@ -18,12 +21,12 @@ $odden = 0; $date1 = new \DateTime(); $date2 = new \DateTime(); -$date2->modify('-'.$shared->getConfigValue('DAYS_BACK').' days'); +$date2->modify('-' . $shared->getConfigValue('DAYS_BACK') . ' days'); $doden = $date2->diff($date1)->format("%a"); $invoiceSteamer = new FlexiPeeHP\Matcher\OutcomingInvoice($shared->configuration); -$invoiceSteamer->banker->logBanner(constant('EASE_APPNAME') ); +$invoiceSteamer->banker->logBanner(constant('EASE_APPNAME')); if ($shared->getConfigValue('PULL_BANK') === true) { $invoiceSteamer->addStatusMessage(_('pull account statements')); @@ -32,7 +35,7 @@ } } -$invoiceSteamer->addStatusMessage(_('Matching program started'),'debug'); +$invoiceSteamer->addStatusMessage(_('Matching program started'), 'debug'); while ($odden < $doden) { $invoiceSteamer->setStartDay($odden++); $invoiceSteamer->outInvoicesMatchingByBank(); diff --git a/src/ParujPrijateFaktury.php b/src/ParujPrijateFaktury.php index 6db8d7e..7770fd5 100644 --- a/src/ParujPrijateFaktury.php +++ b/src/ParujPrijateFaktury.php @@ -1,13 +1,16 @@ loadConfig('../client.json', true); +if (file_exists('../client.json')) { + $shared->loadConfig('../client.json', true); +} $shared->loadConfig('../matcher.json', true); //new \Ease\Locale($shared->getConfigValue('LOCALIZE'), '../i18n','flexibee-matcher'); @@ -16,19 +19,19 @@ $invoiceSteamer->banker->logBanner(constant('EASE_APPNAME')); if ($shared->getConfigValue('PULL_BANK') === true) { - $invoiceSteamer->addStatusMessage(_('pull account statements'),'debug'); + $invoiceSteamer->addStatusMessage(_('pull account statements'), 'debug'); if (!$invoiceSteamer->banker->stahnoutVypisyOnline()) { $invoiceSteamer->addStatusMessage('Banka Offline!', 'error'); } } -$begin = new \DateTime(); -$daterange = new \DatePeriod($begin->modify('-'.$shared->getConfigValue('DAYS_BACK').' days'), - new DateInterval('P1D'), new \DateTime()); +$begin = new \DateTime(); +$daterange = new \DatePeriod($begin->modify('-' . $shared->getConfigValue('DAYS_BACK') . ' days'), + new DateInterval('P1D'), new \DateTime()); -$invoiceSteamer->addStatusMessage(_('Incoming Invoice matching begin'),'debug'); -if(!empty($shared->getConfigValue('DAYS_BACK'))){ +$invoiceSteamer->addStatusMessage(_('Incoming Invoice matching begin'), 'debug'); +if (!empty($shared->getConfigValue('DAYS_BACK'))) { $invoiceSteamer->setStartDay($shared->getConfigValue('DAYS_BACK')); } $invoiceSteamer->inInvoicesMatchingByBank($daterange); -$invoiceSteamer->addStatusMessage(_('Incoming Invoice matching done'),'debug'); +$invoiceSteamer->addStatusMessage(_('Incoming Invoice matching done'), 'debug'); diff --git a/src/ParujVydaneFaktury.php b/src/ParujVydaneFaktury.php index c39fb27..e60803d 100644 --- a/src/ParujVydaneFaktury.php +++ b/src/ParujVydaneFaktury.php @@ -1,8 +1,9 @@ banker->logBanner(constant('EASE_APPNAME')); if ($shared->getConfigValue('PULL_BANK') === true) { - $invoiceSteamer->addStatusMessage(_('pull account statements'),'debug'); + $invoiceSteamer->addStatusMessage(_('pull account statements'), 'debug'); if (!$invoiceSteamer->banker->stahnoutVypisyOnline()) { $invoiceSteamer->addStatusMessage('Banka Offline!', 'error'); } } -$invoiceSteamer->addStatusMessage(_('Outgoing Invoice matching begin'),'debug'); +$invoiceSteamer->addStatusMessage(_('Outgoing Invoice matching begin'), 'debug'); $invoiceSteamer->outInvoicesMatchingByBank(); -$invoiceSteamer->addStatusMessage(_('Outgoing Invoice matching done'),'debug'); +$invoiceSteamer->addStatusMessage(_('Outgoing Invoice matching done'), 'debug'); diff --git a/src/StahniBanku.php b/src/StahniBanku.php index c892e5d..555eaf9 100644 --- a/src/StahniBanku.php +++ b/src/StahniBanku.php @@ -1,17 +1,21 @@ loadConfig('../client.json', true); +if (file_exists('../client.json')) { + $shared->loadConfig('../client.json', true); +} $banker = new \FlexiPeeHP\Banka(); $banker->logBanner(constant('EASE_APPNAME')); -$banker->addStatusMessage(_('Download online bank statements'),'debug'); +$banker->addStatusMessage(_('Download online bank statements'), 'debug'); if (!$banker->stahnoutVypisyOnline()) { $banker->addStatusMessage('Bank Offline!', 'error'); } + \ No newline at end of file