From: vincent@cubedesigners.com Date: Mon, 11 Sep 2023 14:54:45 +0000 (+0000) Subject: wait #6266 @0.5 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=0edf95cfb23b0ad7855ed689e0b6864a7f45679f;p=cubeextranet.git wait #6266 @0.5 --- diff --git a/inc/commons/class.common.ajax.php b/inc/commons/class.common.ajax.php index a531fdf7a..7f3a52596 100644 --- a/inc/commons/class.common.ajax.php +++ b/inc/commons/class.common.ajax.php @@ -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; - } } diff --git a/inc/commons/class.common.core.php b/inc/commons/class.common.core.php index c7bf8936b..459e3f675 100644 --- a/inc/commons/class.common.core.php +++ b/inc/commons/class.common.core.php @@ -501,13 +501,6 @@ class commonCore extends cubeCore $db->bulle->nom('varchar', 128, false); $db->bulle->catalogue('varchar', 128, false); - // WS Ref - - $db->wsref->type('varchar', 32, false); - $db->wsref->ref('varchar', 32, false); - $db->wsref->url('varchar', 512, false); - $db->wsref->primary('pk_wsref', 'type', 'ref'); - // Table google search api $db->google_search_api->request('varchar', 256, false); $db->google_search_api->response('text', 0, false); @@ -684,6 +677,7 @@ LEFT JOIN e2_u a ON ri.administrateur_id=a.utilisateur_id'); . 'WHERE p.client_id=e.utilisateur_id ' . 'GROUP BY e.type, p.annee_fin'); $this->views->createView('signatures', 'SELECT * FROM fluidbook_toolbox.signature'); + $this->views->createView('wsref', 'SELECT * FROM fluidbook_toolbox.fluidbook_reference_url'); touch($cache); } diff --git a/inc/commons/class.common.tools.php b/inc/commons/class.common.tools.php index 39b326f09..6ff2c7e54 100644 --- a/inc/commons/class.common.tools.php +++ b/inc/commons/class.common.tools.php @@ -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 .= '
'; - $res .= ''; - $res .= ''; - $res .= ''; - $res .= ''; - $res .= ''; - $res .= '
' . __('Importer un fichier de références') . '
' . __("Fichier XLSX") . '
(colonne A : référence, colonne B : URL)
' . __("Type") . '' . form::combo('type', $options) . '
' . $core->typo->BoutonOK(__('Importer les références')) . '
'; - $res .= '
'; - $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 .= '
'; +// $res .= ''; +// $res .= ''; +// $res .= ''; +// $res .= ''; +// $res .= ''; +// $res .= '
' . __('Importer un fichier de références') . '
' . __("Fichier XLSX") . '
(colonne A : référence, colonne B : URL)
' . __("Type") . '' . form::combo('type', $options) . '
' . $core->typo->BoutonOK(__('Importer les références')) . '
'; +// $res .= '
'; +// $res .= commonPage::bf(); +// +// $res .= commonPage::bMain(); +// return $res; + http::redirect('https://toolbox.fluidbook.com/tools/fluidbookrefurl'); }