]> _ Git - dtlc.git/commitdiff
wip #7378 @3
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 26 Mar 2025 15:37:31 +0000 (16:37 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 26 Mar 2025 15:37:31 +0000 (16:37 +0100)
.docker/dev/update
.docker/images/php-fpm/Dockerfile
.docker/images/php-fpm/startup
.docker/production/update
CubeIT/js/phantomjs/rasterize.js
framework/application/configs/application.ini
framework/application/controllers/DevisController.php
framework/library/CubeIT/CommandLine/Phantomjs.php
framework/library/CubeIT/Controller/Plugin/HttpAuth.php
less/common.less

index acfc4cc458cdae856e213a4892062271ead5e336..3d551b06ad84e96302ebf1b89edd15232563869c 100644 (file)
@@ -2,6 +2,7 @@
 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
 
index e751b45d50e13630029e98ddb2ff243bbe6f9e1b..270f429d63cf8d32b27633f41c499445d7a56a0a 100644 (file)
@@ -62,6 +62,9 @@ ENV LANG fr_FR.UTF-8
 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
index fa84977434107e3e0a4a492f5822f790b487db1a..fe9ab6de8963c614f05ba6b948a60aa7efdb9de7 100644 (file)
@@ -4,8 +4,8 @@
 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
index 763a093052e4274293b60f2fdd5659ad7747e775..d7990bdaef359c89f81e6f3ef3a400dcc5ed5f02 100644 (file)
@@ -2,6 +2,7 @@
 cd /docker/dtlc
 docker network create dtlc
 
+chown 0:0 ./config/sudoers
 chown 0:0 ./config/cron/crontab
 chown -R 999:999 ./database/data
 
index 8de3192a169b34a9df4144f5b7cd05de24264fc5..7baba2c58eb43b3b747241f5b0bd7c3916f1ac33 100644 (file)
@@ -44,7 +44,7 @@ if (system.args.length < 3 || system.args.length > 5) {
             window.setTimeout(function () {
                 page.render(output);
                 phantom.exit();
-            }, 200);
+            }, 1000);
         }
     });
 }
\ No newline at end of file
index 2e3e6267ccfdb8cc9ece15ad4470bc4e1d066e1c..92819a6dae261b28ce1b8ca0ad4c810e31d028d4 100644 (file)
@@ -69,14 +69,16 @@ sogecommerce.key = gLAsQjFhDOBFPXBH
 [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
index 9efc77c87a7f1d39a7cee7efe9731bef5caa8f69..b73e152783e9f80950a279fc8b8f0f988c56a09f 100644 (file)
@@ -45,7 +45,7 @@ class DevisController extends CubeIT_Controller_PageController
         $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;
@@ -119,9 +119,16 @@ class DevisController extends CubeIT_Controller_PageController
         $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();
     }
index 62b4a0132476943f842c578b28bfeb6be1cef1fc..e3d7bd5ca2464b00fcf19114f875a7bbe6c1d765 100644 (file)
@@ -26,28 +26,29 @@ class CubeIT_CommandLine_Phantomjs extends CubeIT_CommandLine
                $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;
+    }
 
 }
index 633b0a370cc9b99b9e593db0bb63ee094210fb34..89147df9224ca77bb1988ad709935ab6ce139a55 100644 (file)
@@ -7,6 +7,7 @@ class CubeIT_Controller_Plugin_HttpAuth extends Zend_Controller_Plugin_Abstract
 
                $bootstrap = Bootstrap::getInstance();
                $http = $bootstrap->getOption('httpauth');
+
                $skip = false;
                if (isset($http['excludepath'])) {
                        $url = ltrim($_SERVER["REQUEST_URI"], '/');
@@ -14,6 +15,7 @@ class CubeIT_Controller_Plugin_HttpAuth extends Zend_Controller_Plugin_Abstract
                                $http['excludepath'] = array(ltrim($http['excludepath'], '/'));
                        }
                        foreach ($http['excludepath'] as $e) {
+                $e=ltrim($e, '/');
                                if (strpos($url, $e) === 0) {
                                        $skip = true;
                                        break;
index 3bdd04ed1ee99b9007ca5359c7417dd4e87a2658..f7be6f53de98dd5519fd16bfd261b2dbae6b0092 100644 (file)
@@ -1,6 +1,9 @@
 * {
        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 {