]> _ Git - cubeextranet.git/commitdiff
wait #6266 @0.5
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Mon, 11 Sep 2023 14:54:45 +0000 (14:54 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Mon, 11 Sep 2023 14:54:45 +0000 (14:54 +0000)
inc/commons/class.common.ajax.php
inc/commons/class.common.core.php
inc/commons/class.common.tools.php

index a531fdf7a605e1666a6d8a785b0bad0a8c3c511b..7f3a525966b7fe8fc8e2d7557ed0b8b6d445b9f8 100644 (file)
@@ -494,102 +494,5 @@ class commonAjax
         $x->addContent('result', mb_strtoupper(md5($_POST['recipient'] . '+' . $_POST['form_id'] . '+n0_$PAM_please!')));
     }
 
-    /**
-     * @param $args
-     * @param cubeAjax $x
-     * @throws PHPExcel_Exception
-     * @throws PHPExcel_Reader_Exception
-     */
-    public static function importWSReferences($args, &$x)
-    {
-        global $core;
-
-        new PHPExcel();
-
-        $e = explode('.', $_FILES['file']['name']);
-        $ext = mb_strtolower(array_pop($e));
-
-//             $x->enableXML=false;
-//             print_r($_FILES);
-//             exit;
-
-        if ($ext == 'xlsx') {
-            $reader = new PHPExcel_Reader_Excel2007();
-        } else if ($ext == 'csv') {
-            $reader = new PHPExcel_Reader_CSV();
-            $reader->setDelimiter(";");
-        }
-
-
-        $phpexcel = $reader->load($_FILES['file']['tmp_name']);
-        $sheet = $phpexcel->getSheet(0);
-        $maxRow = $sheet->getHighestRow(0);
-
-        $updated = 0;
-
-        $add = [];
-
-        for ($i = 1; $i <= $maxRow; $i++) {
-            $ref = trim($sheet->getCellByColumnAndRow(0, $i));
-            $url = trim($sheet->getCellByColumnAndRow(1, $i)->getOldCalculatedValue());
-
-            if ($ref == '') {
-                $ref = trim($sheet->getCellByColumnAndRow(0, $i)->getFormattedValue());
-            }
-            if ($url == '') {
-                $url = trim($sheet->getCellByColumnAndRow(1, $i)->getFormattedValue());
-            }
-
-
-            if ($url == '' || $ref == '') {
-                continue;
-            }
-
-            $fref = self::_formatWsReferenceRef($ref, $_POST['type']);
-            $furl = self::_formatWsReferenceUrl($url, $_POST['type']);
 
-            $add[$fref] = $furl;
-        }
-
-        try {
-            $refs = [];
-            foreach ($add as $fref => $furl) {
-                $refs[] = "'" . $core->con->escape($fref) . "'";
-            }
-
-            $delete = "DELETE FROM wsref WHERE ref IN(" . implode(',', $refs) . ") AND type='" . $core->con->escape($_POST['type']) . "'";
-            $core->con->execute($delete);
-        } catch (Exception $e) {
-        }
-
-        foreach ($add as $fref => $furl) {
-            try {
-                $c = $core->con->openCursor('wsref');
-                $c->type = $_POST['type'];
-                $c->ref = $fref;
-                $c->url = $furl;
-                $c->insert();
-                $updated++;
-            } catch (Exception $e) {
-
-            }
-        }
-
-        $x->addAlert(sprintf(__('%d liens insérés ou mis à jour'), $updated));
-    }
-
-    public static function _formatWsReferenceRef($ref, $type)
-    {
-        if ($type === '10doigts') {
-            if (stripos($ref, 'ic') === 0) {
-                return 'C' . substr($ref, 2);
-            }
-        }
-        return $ref;
-    }
-
-    public static function _formatWsReferenceUrl($url, $type)
-    {
-        return $url;
-    }
 }
index c7bf8936be30abd588d9795ff57ef419c8446fbe..459e3f6759ac1d81fec0d0b84f734a70f7fd11da 100644 (file)
@@ -501,13 +501,6 @@ class commonCore extends cubeCore
         $db->bulle->nom('varchar', 128, false);\r
         $db->bulle->catalogue('varchar', 128, false);\r
 \r
-        // WS Ref\r
-\r
-        $db->wsref->type('varchar', 32, false);\r
-        $db->wsref->ref('varchar', 32, false);\r
-        $db->wsref->url('varchar', 512, false);\r
-        $db->wsref->primary('pk_wsref', 'type', 'ref');\r
-\r
         // Table google search api\r
         $db->google_search_api->request('varchar', 256, false);\r
         $db->google_search_api->response('text', 0, false);\r
@@ -684,6 +677,7 @@ LEFT JOIN e2_u a ON ri.administrateur_id=a.utilisateur_id');
             . 'WHERE p.client_id=e.utilisateur_id '\r
             . 'GROUP BY e.type, p.annee_fin');\r
         $this->views->createView('signatures', 'SELECT * FROM fluidbook_toolbox.signature');\r
+        $this->views->createView('wsref', 'SELECT * FROM fluidbook_toolbox.fluidbook_reference_url');\r
         touch($cache);\r
     }\r
 \r
index 39b326f09022c0ea5935897d1cbb01bd77ddce4a..6ff2c7e54e50b3cec26ec14659c19a2263280966 100644 (file)
@@ -1164,33 +1164,34 @@ class commonTools
 
     public static function importWSReferences()
     {
-        $options = ['10doigts' => '10 doigts',
-            'ascocelda' => 'Asco & Celda',
-            'wesco' => 'Wesco',
-            'mopec' => 'Mopec',
-            'intex' => 'Intex',
-            'grosfillex' => 'Grosfillex'];
-
-        $options = array_flip($options);
-        ksort($options);
-
-        commonDroits::min(5);
-        global $core;
-        $res = commonPage::barre();
-        $res .= commonPage::tMain();
-        $res .= commonPage::bh();
-        $res .= '<form action="importWSReferences" method="post" enctype="multipart/form-data">';
-        $res .= '<table class="liste">';
-        $res .= '<tr><th colspan="2"><strong>' . __('Importer un fichier de références') . '</strong></th></tr>';
-        $res .= '<tr><td>' . __("Fichier XLSX") . '<br>(colonne A : référence, colonne B : URL)</td><td><input type="file" name="file" accept=".xlsx,.csv" /></td></tr>';
-        $res .= '<tr><td>' . __("Type") . '</td><td>' . form::combo('type', $options) . '</td></tr>';
-        $res .= '<tr><td class="right" colspan="2"><a href="#" class="submit">' . $core->typo->BoutonOK(__('Importer les références')) . '</a></td></td>';
-        $res .= '</table>';
-        $res .= '</form>';
-        $res .= commonPage::bf();
-
-        $res .= commonPage::bMain();
-        return $res;
+//        $options = ['10doigts' => '10 doigts',
+//            'ascocelda' => 'Asco & Celda',
+//            'wesco' => 'Wesco',
+//            'mopec' => 'Mopec',
+//            'intex' => 'Intex',
+//            'grosfillex' => 'Grosfillex'];
+//
+//        $options = array_flip($options);
+//        ksort($options);
+//
+//        commonDroits::min(5);
+//        global $core;
+//        $res = commonPage::barre();
+//        $res .= commonPage::tMain();
+//        $res .= commonPage::bh();
+//        $res .= '<form action="importWSReferences" method="post" enctype="multipart/form-data">';
+//        $res .= '<table class="liste">';
+//        $res .= '<tr><th colspan="2"><strong>' . __('Importer un fichier de références') . '</strong></th></tr>';
+//        $res .= '<tr><td>' . __("Fichier XLSX") . '<br>(colonne A : référence, colonne B : URL)</td><td><input type="file" name="file" accept=".xlsx,.csv" /></td></tr>';
+//        $res .= '<tr><td>' . __("Type") . '</td><td>' . form::combo('type', $options) . '</td></tr>';
+//        $res .= '<tr><td class="right" colspan="2"><a href="#" class="submit">' . $core->typo->BoutonOK(__('Importer les références')) . '</a></td></td>';
+//        $res .= '</table>';
+//        $res .= '</form>';
+//        $res .= commonPage::bf();
+//
+//        $res .= commonPage::bMain();
+//        return $res;
+        http::redirect('https://toolbox.fluidbook.com/tools/fluidbookrefurl');
     }