cd /docker/dtlc-dev
docker network create dtlc-dev
+chown 0:0 ./config/sudoers
chown 0:0 ./config/cron/crontab
chown -R 999:999 ./database/data
ENV LANGUAGE fr_FR:$localshort
ENV LC_ALL fr_FR.UTF-8
+RUN apt -y --no-install-recommends install fontconfig libfontconfig bzip2
+RUN cd /root;wget https://github.com/Medium/phantomjs/releases/download/v2.1.1/phantomjs-2.1.1-linux-x86_64.tar.bz2;tar xvjf phantomjs-2.1.1-linux-x86_64.tar.bz2;mv phantomjs-2.1.1-linux-x86_64 /usr/local/share;ln -sf /usr/local/share/phantomjs-2.1.1-linux-x86_64/bin/phantomjs /usr/local/bin
+
COPY --from=composer:2 /usr/bin/composer /usr/bin/composer
# IF you need some npm globally installed packages
umask 0000
chmod -R 777 /tmp
-chown -R root:root /etc/sudoers.d
chown -R dtlc:www-data /application
+chown -R root:root /etc/sudoers.d
# Rsyslog
start-stop-daemon --start -b -x /usr/sbin/rsyslogd -- -n
cd /docker/dtlc
docker network create dtlc
+chown 0:0 ./config/sudoers
chown 0:0 ./config/cron/crontab
chown -R 999:999 ./database/data
window.setTimeout(function () {
page.render(output);
phantom.exit();
- }, 200);
+ }, 1000);
}
});
}
\ No newline at end of file
[testing : production]
seo.robots = false
-dev = true
+dev = false
firephp = false
httpauth.username = dtlc
httpauth.password = dtlc17
httpauth.ip_whitelist[] = 176.134.43.17
-httpauth.excludepath = /payment/auto
-httpauth.excludepath = /sogecommerce/auto
+httpauth.excludepath[] = /devis
+httpauth.excludepath[] = /payment/auto
+httpauth.excludepath[] = /sogecommerce/auto
+httpauth.excludepath[] = /images
database.params.host = dtlc-dev-mariadb
sogenactif.url = https://payment-webinit.simu.sips-atos.com/paymentInit
$this->view->print = isset($_GET['print']);
- if($amounts['ttc']>0) {
+ if ($amounts['ttc'] > 0) {
$currency = 978;
if ($this->view->devis->magasin == 'paris11') {
$this->view->magasin = 11;
$this->disableLayout(true);
$p = $this->_parseParams();
+ $file = CubeIT_Files::tempnam();
+ $f = $file . '.pdf';
+
+ $url = SITE_URL . '/devis/index/' . $p[0] . '/' . $p[1] . "?print=1&j=" . time();
+
+ CubeIT_CommandLine_Phantomjs::html2pdf($url, $f, '210mm*297mm*0*0*0*0');
+
$response = $this->getResponse();
$response->setHeader('Content-type', CubeIT_Files::getMimeType('file.pdf'))
- ->setBody(file_get_contents('https://extranet.cubedesigners.com/tools/phantomjs?url=' . urlencode(SITE_URL . '/devis/index/' . $p[0] . '/' . $p[1] . "?print=1&j=" . time()) . '&pageformat=210mm*297mm*0*0*0*0'));
+ ->setBody(file_get_contents($f));
$response->sendResponse();
}
$this->setArg('local-storage-path', $cache . 'cache');
$this->setArg('cookies-file', $cache . 'cookies.txt');
$this->setArg('output-encoding', 'utf8');
+ $this->setArg('load-images', 'true');
$this->setArg(null, $script);
}
- public static function html2pdf($url, $dest, $format = '210mm*297mm', $script = null, $exe = '/usr/local/bin/phantomjs')
- {
- $dir = dirname($dest);
- if (!file_exists($dir)) {
- mkdir($dir, 0777, true);
- }
-
- if (null === $script) {
- $script = PUBLIC_PATH . '/CubeIT/js/phantomjs/rasterize.js';
- }
-
- $cl = new CubeIT_CommandLine_Phantomjs($script, null, true, $exe);
- $cl->setArg(null, '"' . $url . '"');
- $cl->setArg(null, '"' . $dest . '"');
- $cl->setArg(null, '"' . $format . '"');
- $cl->execute();
- $cl->debug();
-
- return $cl;
- }
+ public static function html2pdf($url, $dest, $format = '210mm*297mm', $script = null, $exe = 'phantomjs')
+ {
+ $dir = dirname($dest);
+ if (!file_exists($dir)) {
+ mkdir($dir, 0777, true);
+ }
+
+ if (null === $script) {
+ $script = PUBLIC_PATH . '/CubeIT/js/phantomjs/rasterize.js';
+ }
+
+ $cl = new CubeIT_CommandLine_Phantomjs($script, null, true, $exe);
+ $cl->setEnv('OPENSSL_CONF','/dev/null');
+ $cl->setArg(null, '"' . $url . '"');
+ $cl->setArg(null, '"' . $dest . '"');
+ $cl->setArg(null, '"' . $format . '"');
+ $cl->execute();
+
+ return $cl;
+ }
}
$bootstrap = Bootstrap::getInstance();
$http = $bootstrap->getOption('httpauth');
+
$skip = false;
if (isset($http['excludepath'])) {
$url = ltrim($_SERVER["REQUEST_URI"], '/');
$http['excludepath'] = array(ltrim($http['excludepath'], '/'));
}
foreach ($http['excludepath'] as $e) {
+ $e=ltrim($e, '/');
if (strpos($url, $e) === 0) {
$skip = true;
break;
* {
background-repeat: repeat;
vertical-align: top;
+ -webkit-print-color-adjust: exact !important; /* Chrome, Safari 6 – 15.3, Edge */
+ color-adjust: exact !important; /* Firefox 48 – 96 */
+ print-color-adjust: exact !important; /* Firefox 97+, Safari 15.4+ */
}
body {