From: vincent@cubedesigners.com Date: Fri, 11 Jan 2013 15:34:35 +0000 (+0000) Subject: (no commit message) X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=1905b7864156b50c09d303da649713730c69af96;p=cubeextranet.git --- diff --git a/inc/commons/class.common.tools.php b/inc/commons/class.common.tools.php index 7ba49c280..73aad5499 100644 --- a/inc/commons/class.common.tools.php +++ b/inc/commons/class.common.tools.php @@ -177,6 +177,54 @@ class commonTools { return $res; } + public static function exportClients($args) { + global $core; + + $types = array('Cubedesigners' => 'cube', 'Tous les contacts (Clients de revendeurs inclus)' => 'all'); + $typeexp = array('Entreprises' => 'entreprises', 'Utilisateurs' => 'users'); + + $res = commonPage::barre(); + $res .= commonPage::tMain(); + $res .= commonPage::bh(); + $res.='
'; + $res.=''; + $res.=''; + $res.=''; + $res.=''; + $res.=''; + $res.='
' . __('Exporter la base clients') . '
' . __('Type de client') . '' . form::combo('type', $types) . '
' . __('Type d\'export') . '' . form::combo('typeexp', $typeexp) . '
' . $core->typo->BoutonOK(__('Exporter')) . '
'; + $res.='
'; + $res .= ''; + $res .= commonPage::bf(); + $res .= commonPage::bMain(); + return $res; + } + + public static function exportClientsXLS($args) { + global $core; + + $sql = 'SELECT * FROM entreprises_ws'; + if ($_POST['type'] == 'cube') { + $sql.=" WHERE revendeur = 'Cubedesigners'"; + } + + $r = $core->con->select($sql); + $entreprises = array(); + $rows = $r->rows(); + foreach ($rows as $r) { + + $entreprises[$r['entreprise_id']] = $r; + $entreprises[$r['entreprise_id']]['utilisateurs'] = array(); + } + + $r = $core->con->select('SELECT * FROM utilisateurs_entreprise WHERE entreprise IN(' . implode(',', array_keys($entreprises)) . ')'); + $rows = $r->rows(); + foreach ($rows as $r) { + $entreprises[$r['entreprise']]['utilisateurs'][$r['utilisateur_id']] = $r; + } + fb($entreprises); + } + public static function favicon($args) { global $core; $res = commonPage::barre(); @@ -740,5 +788,4 @@ class commonTools { } } - ?> diff --git a/inc/ws/Controlleur/class.ws.services.php b/inc/ws/Controlleur/class.ws.services.php index ffc3b7a4e..45894e8e0 100644 --- a/inc/ws/Controlleur/class.ws.services.php +++ b/inc/ws/Controlleur/class.ws.services.php @@ -254,12 +254,14 @@ class wsServices extends cubeFlashGateway { $daoBook = new wsDAOBook($core->con); $book = $daoBook->selectById($book_id); + if (is_null($book)) { return; } // Normalize range $range = cubeArray::parseRange($range); + if ($k = array_search(0, $range)) { $range[$k] = 1; } @@ -271,7 +273,7 @@ class wsServices extends cubeFlashGateway { return; } // Paths init - $baseDocument = WS_BOOKS . '/final/' . $book->book_id . '/data/document.pdf'; + $baseDocument = WS_BOOKS . '/final/' . $book->book_id . '/data/' . $book->parametres->pdfName; if (!file_exists($baseDocument)) { return; } diff --git a/inc/ws/DAO/class.ws.dao.book.php b/inc/ws/DAO/class.ws.dao.book.php index 4dba61203..1b12c79a9 100644 --- a/inc/ws/DAO/class.ws.dao.book.php +++ b/inc/ws/DAO/class.ws.dao.book.php @@ -1366,6 +1366,7 @@ class wsDAOBook extends commonDAO { } } } else { + if (file_exists($normalPDF)) { $fmtime = filemtime($normalPDF); if ($fmtime >= $book->composition_update) { @@ -1376,6 +1377,8 @@ class wsDAOBook extends commonDAO { $invalid = true; } } + } else { + $invalid = true; } } else { $invalid = true;