Fix: Si rep export compta existe pas on le crée

This commit is contained in:
Laurent Destailleur 2006-10-07 11:46:19 +00:00
parent d040a3f7f8
commit 4ed0ff200d
2 changed files with 53 additions and 45 deletions

View File

@ -33,6 +33,8 @@ require_once("./ComptaJournalVente.class.php");
$langs->load("compta"); $langs->load("compta");
$dir = $conf->compta->dir_output."/export/";
/* /*
* Actions * Actions
@ -44,6 +46,8 @@ if ($_GET["action"] == 'export')
include_once DOL_DOCUMENT_ROOT.'/compta/export/modules/compta.export.class.php'; include_once DOL_DOCUMENT_ROOT.'/compta/export/modules/compta.export.class.php';
create_exdir($dir);
$exc = new ComptaExport($db, $user, $modulename); $exc = new ComptaExport($db, $user, $modulename);
if($_GET["id"] > 0) if($_GET["id"] > 0)
@ -117,7 +121,6 @@ print "</table>\n";
print '</td><td valign="top" width="70%">'; print '</td><td valign="top" width="70%">';
$dir = DOL_DATA_ROOT."/compta/export/";
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
@ -125,8 +128,9 @@ print '<td>'.$langs->trans("File").'</td>';
print '<td>&nbsp;</td>'; print '<td>&nbsp;</td>';
print "</tr>\n"; print "</tr>\n";
$handle=opendir($dir); $handle=@opendir($dir);
if ($handle)
{
while (($file = readdir($handle))!==false) while (($file = readdir($handle))!==false)
{ {
if (is_readable($dir.$file) && is_file($dir.$file)) if (is_readable($dir.$file) && is_file($dir.$file))
@ -136,6 +140,7 @@ while (($file = readdir($handle))!==false)
print '</tr>'; print '</tr>';
} }
} }
}
print "</table>"; print "</table>";

View File

@ -19,10 +19,19 @@
* $Source$ * $Source$
*/ */
/**
\file htdocs/compta/export/liste.php
\ingroup compta
\brief Page export ventilations
\version $Revision$
*/
require("./pre.inc.php"); require("./pre.inc.php");
$langs->load("compta"); $langs->load("compta");
$dir = $conf->compta->dir_output."/export/";
// Sécurité accés client // Sécurité accés client
if ($user->societe_id > 0) if ($user->societe_id > 0)
@ -31,14 +40,6 @@ if ($user->societe_id > 0)
$socid = $user->societe_id; $socid = $user->societe_id;
} }
llxHeader('','Compta - Export');
/*
*
*
*/
$page = $_GET["page"]; $page = $_GET["page"];
$sortorder = $_GET["sortorder"]; $sortorder = $_GET["sortorder"];
$sortfield = $_GET["sortfield"]; $sortfield = $_GET["sortfield"];
@ -47,11 +48,15 @@ $offset = $conf->liste_limit * $page ;
if ($sortorder == "") $sortorder="DESC"; if ($sortorder == "") $sortorder="DESC";
if ($sortfield == "") $sortfield="ec.date_export"; if ($sortfield == "") $sortfield="ec.date_export";
/* /*
* Mode Liste * Mode Liste
* *
*/ */
llxHeader('','Compta - Export');
$sql = "SELECT ec.rowid,".$db->pdate("ec.date_export")." as date_export, ec.ref"; $sql = "SELECT ec.rowid,".$db->pdate("ec.date_export")." as date_export, ec.ref";
$sql .= " FROM ".MAIN_DB_PREFIX."export_compta as ec"; $sql .= " FROM ".MAIN_DB_PREFIX."export_compta as ec";
@ -76,8 +81,6 @@ if ($result)
$var=True; $var=True;
$dir = DOL_DATA_ROOT."/compta/export/";
while ($i < min($num,$conf->liste_limit)) while ($i < min($num,$conf->liste_limit))
{ {
$obj = $db->fetch_object($result); $obj = $db->fetch_object($result);
@ -86,8 +89,8 @@ if ($result)
print "<tr $bc[$var]>"; print "<tr $bc[$var]>";
print '<td>'.$obj->ref.'</td>'; print '<td>'.$obj->ref.'</td>';
print '<td>'.strftime("%a %e %b %Y %H:%M:%S",$obj->date_export).'</td>'; print '<td>'.dolibarr_print_date($obj->date_export,"%a %e %b %Y %H:%M:%S").'</td>';
print '<td><a href="index.php?action=export&amp;id='.$obj->rowid.'">Regénérer</a></td>'; print '<td><a href="index.php?action=export&amp;id='.$obj->rowid.'">'.$langs->trans("ReBuild").'</a></td>';
print "</tr>\n"; print "</tr>\n";
$i++; $i++;
} }