Qual: Dplacement show_document dans html.formfile.class.php

This commit is contained in:
Laurent Destailleur 2008-01-20 13:53:02 +00:00
parent 9c0cb98be4
commit eeb8bfafcb
23 changed files with 343 additions and 310 deletions

View File

@ -16,7 +16,6 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
* $Source$
*/
/**
@ -26,6 +25,7 @@
*/
require("./pre.inc.php");
require_once(DOL_DOCUMENT_ROOT."/html.formfile.class.php");
include_once $dolibarr_main_document_root."/lib/databases/".$conf->db->type.".lib.php";
$langs->load("admin");
@ -33,8 +33,9 @@ $langs->load("admin");
if (! $user->admin)
accessforbidden();
$html=new Form($db);
$formfile = new FormFile($db);
/*
@ -578,7 +579,7 @@ if (window.parent.frames[1]) {
<?php
$result=$html->show_documents('systemtools','',DOL_DATA_ROOT.'/admin/temp',$_SERVER['PHP_SELF'],0,1);
$result=$formfile->show_documents('systemtools','',DOL_DATA_ROOT.'/admin/temp',$_SERVER['PHP_SELF'],0,1);
//if ($result) print '<br><br>';

View File

@ -16,7 +16,6 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
* $Source$
*/
/**
@ -26,6 +25,7 @@
*/
require("./pre.inc.php");
require_once(DOL_DOCUMENT_ROOT."/html.formfile.class.php");
include_once $dolibarr_main_document_root."/lib/databases/".$conf->db->type.".lib.php";
$what=$_REQUEST["what"];
@ -54,6 +54,7 @@ if ($file && ! $what)
llxHeader();
$html=new Form($db);
$formfile = new FormFile($db);
print_fiche_titre($langs->trans("Backup"),'','setup');
print '<br>';
@ -212,7 +213,7 @@ if ($what)
}
}
$result=$html->show_documents('systemtools','',DOL_DATA_ROOT.'/admin/temp',$_SERVER['PHP_SELF'],0,1);
$result=$formfile->show_documents('systemtools','',DOL_DATA_ROOT.'/admin/temp',$_SERVER['PHP_SELF'],0,1);
if ($result == 0)
{

View File

@ -28,6 +28,7 @@
*/
require("./pre.inc.php");
require_once(DOL_DOCUMENT_ROOT."/html.formfile.class.php");
require_once(DOL_DOCUMENT_ROOT."/client.class.php");
if ($conf->contrat->enabled) require_once(DOL_DOCUMENT_ROOT."/contrat/contrat.class.php");
if ($conf->propal->enabled) require_once(DOL_DOCUMENT_ROOT."/propal.class.php");
@ -85,6 +86,7 @@ if (isset($_GET["action"]) && $_GET["action"] == 'del_bookmark')
*/
$html = new Form($db);
$formfile = new FormFile($db);
llxHeader();
@ -591,7 +593,7 @@ if ($conf->propal->enabled && $user->rights->propale->lire)
$filename=sanitize_string($obj->ref);
$filedir=$conf->propal->dir_output . '/' . sanitize_string($obj->ref);
$urlsource=$_SERVER['PHP_SELF'].'?propalid='.$obj->propalid;
$html->show_documents('propal',$filename,$filedir,$urlsource,'','','','','',1);
$formfile->show_documents('propal',$filename,$filedir,$urlsource,'','','','','',1);
print '</td></tr></table>';
print "</td>";
@ -665,7 +667,7 @@ if ($conf->propal->enabled && $user->rights->propale->lire) {
$filename=sanitize_string($objp->ref);
$filedir=$conf->propal->dir_output . '/' . sanitize_string($objp->ref);
$urlsource=$_SERVER['PHP_SELF'].'?propalid='.$objp->propalid;
$html->show_documents('propal',$filename,$filedir,$urlsource,'','','','','',1);
$formfile->show_documents('propal',$filename,$filedir,$urlsource,'','','','','',1);
print '</td></tr></table>';
print '</td>';

View File

@ -30,6 +30,7 @@
*/
require("./pre.inc.php");
require_once(DOL_DOCUMENT_ROOT."/html.formfile.class.php");
require_once(DOL_DOCUMENT_ROOT."/includes/modules/propale/modules_propale.php");
require_once(DOL_DOCUMENT_ROOT."/lib/propal.lib.php");
@ -731,6 +732,7 @@ if ($_GET['action'] == 'down' && $user->rights->propale->creer)
llxHeader('',$langs->trans('Proposal'),'Proposition');
$html = new Form($db);
$formfile = new FormFile($db);
if ($_GET['propalid'] > 0)
{
@ -1660,7 +1662,7 @@ if ($_GET['propalid'] > 0)
$var=true;
$somethingshown=$html->show_documents('propal',$filename,$filedir,$urlsource,$genallowed,$delallowed,$propal->modelpdf);
$somethingshown=$formfile->show_documents('propal',$filename,$filedir,$urlsource,$genallowed,$delallowed,$propal->modelpdf);
/*
@ -1920,7 +1922,7 @@ else
$filename=sanitize_string($objp->ref);
$filedir=$conf->propal->dir_output . '/' . sanitize_string($objp->ref);
$urlsource=$_SERVER['PHP_SELF'].'?propalid='.$objp->propalid;
$html->show_documents('propal',$filename,$filedir,$urlsource,'','','','','',1);
$formfile->show_documents('propal',$filename,$filedir,$urlsource,'','','','','',1);
print '</td></tr></table>';

View File

@ -30,6 +30,7 @@
*/
require('./pre.inc.php');
require_once(DOL_DOCUMENT_ROOT."/html.formfile.class.php");
require_once(DOL_DOCUMENT_ROOT ."/includes/modules/commande/modules_commande.php");
require_once(DOL_DOCUMENT_ROOT.'/commande/commande.class.php');
require_once(DOL_DOCUMENT_ROOT.'/actioncomm.class.php');
@ -713,6 +714,7 @@ if ($_POST['action'] == 'send')
llxHeader('',$langs->trans('Order'),'Commande');
$html = new Form($db);
$formfile = new FormFile($db);
/*********************************************************************
*
@ -1797,7 +1799,7 @@ else
$genallowed=$user->rights->commande->creer;
$delallowed=$user->rights->commande->supprimer;
$somethingshown=$html->show_documents('commande',$comref,$filedir,$urlsource,$genallowed,$delallowed,$commande->modelpdf);
$somethingshown=$formfile->show_documents('commande',$comref,$filedir,$urlsource,$genallowed,$delallowed,$commande->modelpdf);
/*
* Liste des factures

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2003-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -17,7 +17,6 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
* $Source$
*/
/**
@ -28,6 +27,7 @@
*/
require("./pre.inc.php");
require_once(DOL_DOCUMENT_ROOT."/html.formfile.class.php");
require_once(DOL_DOCUMENT_ROOT ."/notify.class.php");
if (!$user->rights->commande->lire) accessforbidden();
@ -43,9 +43,10 @@ if ($user->societe_id > 0)
$socid = $user->societe_id;
}
$commandestatic=new Commande($db);
$html = new Form($db);
$formfile = new FormFile($db);
llxHeader("",$langs->trans("Orders"),"Commande");
@ -151,7 +152,7 @@ if ( $db->query($sql) )
$filename=sanitize_string($obj->ref);
$filedir=$conf->commande->dir_output . '/' . sanitize_string($obj->ref);
$urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid;
$html->show_documents('commande',$filename,$filedir,$urlsource,'','','','','',1);
$formfile->show_documents('commande',$filename,$filedir,$urlsource,'','','','','',1);
print '</td></tr></table>';
print '</td>';
@ -213,7 +214,7 @@ if ( $db->query($sql) )
$filename=sanitize_string($obj->ref);
$filedir=$conf->commande->dir_output . '/' . sanitize_string($obj->ref);
$urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid;
$html->show_documents('commande',$filename,$filedir,$urlsource,'','','','','',1);
$formfile->show_documents('commande',$filename,$filedir,$urlsource,'','','','','',1);
print '</td></tr></table>';
print '</td>';
@ -279,7 +280,7 @@ if ($resql)
$filename=sanitize_string($obj->ref);
$filedir=$conf->commande->dir_output . '/' . sanitize_string($obj->ref);
$urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid;
$html->show_documents('commande',$filename,$filedir,$urlsource,'','','','','',1);
$formfile->show_documents('commande',$filename,$filedir,$urlsource,'','','','','',1);
print '</td></tr></table>';
print '</td>';

View File

@ -30,6 +30,7 @@
require('./pre.inc.php');
require_once(DOL_DOCUMENT_ROOT."/html.formfile.class.php");
$langs->load('orders');
$langs->load('companies');
@ -58,6 +59,7 @@ if ($user->societe_id > 0)
*/
$html = new Form($db);
$formfile = new FormFile($db);
llxHeader();
@ -199,7 +201,7 @@ if ($resql)
$filename=sanitize_string($objp->ref);
$filedir=$conf->commande->dir_output . '/' . sanitize_string($objp->ref);
$urlsource=$_SERVER['PHP_SELF'].'?id='.$objp->rowid;
$html->show_documents('commande',$filename,$filedir,$urlsource,'','','','','',1);
$formfile->show_documents('commande',$filename,$filedir,$urlsource,'','','','','',1);
print '</td></tr></table>';
print '</td>';

View File

@ -28,6 +28,7 @@
*/
require("./pre.inc.php");
require_once(DOL_DOCUMENT_ROOT."/html.formfile.class.php");
require_once(DOL_DOCUMENT_ROOT."/lib/order.lib.php");
if ($conf->propal->enabled) require_once(DOL_DOCUMENT_ROOT."/propal.class.php");
if ($conf->projet->enabled) require_once(DOL_DOCUMENT_ROOT."/project.class.php");
@ -61,11 +62,12 @@ if ($_GET["action"] == 'facturee')
}
llxHeader('',$langs->trans("OrderCard"),"Commande");
$html = new Form($db);
$formfile = new FormFile($db);
/* *************************************************************************** */
/* */
@ -453,7 +455,7 @@ if ($_GET["id"] > 0)
$genallowed=0;
$delallowed=0;
$somethingshown=$html->show_documents('commande',$comref,$filedir,$urlsource,$genallowed,$delallowed,$commande->modelpdf);
$somethingshown=$formfile->show_documents('commande',$comref,$filedir,$urlsource,$genallowed,$delallowed,$commande->modelpdf);
/*
* Liste des factures

View File

@ -29,6 +29,7 @@
*/
require("./pre.inc.php");
require_once(DOL_DOCUMENT_ROOT."/html.formfile.class.php");
if (!$user->rights->commande->lire) accessforbidden();
@ -51,7 +52,9 @@ if ($user->societe_id > 0)
$langs->load('companies');
$html = new Form($db);
$formfile = new FormFile($db);
llxHeader();
@ -148,7 +151,7 @@ if ($resql)
$filename=sanitize_string($objp->ref);
$filedir=$conf->commande->dir_output . '/' . sanitize_string($objp->ref);
$urlsource=$_SERVER['PHP_SELF'].'?id='.$objp->rowid;
$html->show_documents('commande',$filename,$filedir,$urlsource,'','','','','',1);
$formfile->show_documents('commande',$filename,$filedir,$urlsource,'','','','','',1);
print '</td></tr></table>';
print '</td>';

View File

@ -27,6 +27,7 @@
*/
require_once("./pre.inc.php");
require_once(DOL_DOCUMENT_ROOT."/html.formfile.class.php");
require_once(DOL_DOCUMENT_ROOT."/don.class.php");
require_once(DOL_DOCUMENT_ROOT."/paiement.class.php");
if ($conf->projet->enabled) require_once(DOL_DOCUMENT_ROOT.'/lib/project.lib.php');
@ -171,6 +172,7 @@ if ($_GET['action'] == 'builddoc')
llxHeader();
$html=new Form($db);
$formfile = new FormFile($db);
/* ************************************************************************** */
@ -199,8 +201,7 @@ if ($_GET["action"] == 'create')
print "<textarea name=\"comment\" wrap=\"soft\" cols=\"40\" rows=\"15\"></textarea></td></tr>";
print "<tr><td>".$langs->trans("PaymentMode")."</td><td>\n";
$form = new Form($db);
$form->select_types_paiements('', 'modepaiement', 'CRDT', 0);
$html->select_types_paiements('', 'modepaiement', 'CRDT', 0);
print "</td></tr>\n";
if ($conf->projet->enabled)
@ -212,7 +213,6 @@ if ($_GET["action"] == 'create')
}
print "<tr><td>".$langs->trans("PublicDonation")."</td><td>";
$html=new Form($db);
print $html->selectyesno("public",1,1);
print "</td></tr>\n";
@ -292,7 +292,6 @@ if ($_GET["rowid"] && $_GET["action"] == 'edit')
}
print "<tr><td>".$langs->trans("PublicDonation")."</td><td>";
$html=new Form($db);
print $html->selectyesno("public",1,1);
print "</td>";
print "</tr>\n";
@ -309,8 +308,7 @@ if ($_GET["rowid"] && $_GET["action"] == 'edit')
print "<tr>".'<td>'.$langs->trans("Amount").'</td><td><input type="text" name="amount" size="10" value="'.$don->amount.'"> '.$langs->trans("Currency".$conf->monnaie).'</td></tr>';
print "<tr><td>".$langs->trans("PaymentMode")."</td><td>\n";
$form = new Form($db);
$form->select_types_paiements('', 'modepaiement', 'CRDT', 0);
$html->select_types_paiements('', 'modepaiement', 'CRDT', 0);
print "</td></tr>\n";
print "<tr>".'<td>'.$langs->trans("Status").'</td><td>'.$don->getLibStatut(4).'</td></tr>';
@ -434,7 +432,7 @@ if ($_GET["rowid"] && $_GET["action"] != 'edit')
$var=true;
print '<br>';
$html->show_documents('don',$filename,$filedir,$urlsource,$genallowed,$delallowed);
$formfile->show_documents('don',$filename,$filedir,$urlsource,$genallowed,$delallowed);
print '</td><td>&nbsp;</td>';

View File

@ -31,6 +31,7 @@
*/
require('./pre.inc.php');
require_once(DOL_DOCUMENT_ROOT."/html.formfile.class.php");
require_once(DOL_DOCUMENT_ROOT.'/includes/modules/facture/modules_facture.php');
require_once(DOL_DOCUMENT_ROOT.'/facture.class.php');
require_once(DOL_DOCUMENT_ROOT.'/discount.class.php');
@ -1155,6 +1156,7 @@ if ($_REQUEST['action'] == 'builddoc') // En get ou en post
llxHeader('',$langs->trans('Bill'),'HelpInvoice');
$html = new Form($db);
$formfile = new FormFile($db);
/*********************************************************************
@ -2835,7 +2837,7 @@ else
$var=true;
print '<br>';
$somethingshown=$html->show_documents('facture',$filename,$filedir,$urlsource,$genallowed,$delallowed,$fac->modelpdf);
$somethingshown=$formfile->show_documents('facture',$filename,$filedir,$urlsource,$genallowed,$delallowed,$fac->modelpdf);
/*
* Propales rattachées
@ -3283,7 +3285,7 @@ else
$filename=sanitize_string($objp->facnumber);
$filedir=$conf->facture->dir_output . '/' . sanitize_string($objp->facnumber);
$urlsource=$_SERVER['PHP_SELF'].'?facid='.$objp->facid;
$html->show_documents('facture',$filename,$filedir,$urlsource,'','','','','',1);
$formfile->show_documents('facture',$filename,$filedir,$urlsource,'','','','','',1);
print '</td>';
print '</tr></table>';

View File

@ -28,6 +28,7 @@
*/
require("./pre.inc.php");
require_once(DOL_DOCUMENT_ROOT."/html.formfile.class.php");
require_once(DOL_DOCUMENT_ROOT."/facture.class.php");
require_once(DOL_DOCUMENT_ROOT."/paiement.class.php");
@ -53,6 +54,9 @@ if ($user->societe_id > 0)
llxHeader('',$langs->trans("BillsCustomersUnpayed"));
$html = new Form($db);
$formfile = new FormFile($db);
/***************************************************************************
* *
@ -181,7 +185,6 @@ if ($user->rights->facture->lire)
if ($num > 0)
{
$html = new Form($db);
$var=True;
$total_ht=0;
$total_ttc=0;
@ -216,7 +219,7 @@ if ($user->rights->facture->lire)
$filename=sanitize_string($objp->facnumber);
$filedir=$conf->facture->dir_output . '/' . sanitize_string($objp->facnumber);
$urlsource=$_SERVER['PHP_SELF'].'?facid='.$objp->facid;
$html->show_documents('facture',$filename,$filedir,$urlsource,'','','','','',1);
$formfile->show_documents('facture',$filename,$filedir,$urlsource,'','','','','',1);
print '</td></tr></table>';

View File

@ -28,6 +28,7 @@
*/
require("./pre.inc.php");
require_once(DOL_DOCUMENT_ROOT."/html.formfile.class.php");
require_once(DOL_DOCUMENT_ROOT.'/facture.class.php');
require_once(DOL_DOCUMENT_ROOT.'/fourn/fournisseur.facture.class.php');
if ($conf->commande->enabled) require_once(DOL_DOCUMENT_ROOT.'/commande/commande.class.php');
@ -92,6 +93,7 @@ $facturestatic=new Facture($db);
$facturesupplierstatic=new FactureFournisseur($db);
$html = new Form($db);
$formfile = new FormFile($db);
llxHeader("",$langs->trans("AccountancyTreasuryArea"));
@ -563,7 +565,7 @@ if ($conf->facture->enabled && $conf->commande->enabled && $user->rights->comman
$filename=sanitize_string($obj->ref);
$filedir=$conf->commande->dir_output . '/' . sanitize_string($obj->ref);
$urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid;
$html->show_documents('commande',$filename,$filedir,$urlsource,'','','','','',1);
$formfile->show_documents('commande',$filename,$filedir,$urlsource,'','','','','',1);
print '</td></tr></table>';
print '</td>';
@ -658,7 +660,7 @@ if ($conf->facture->enabled && $user->rights->facture->lire)
$filename=sanitize_string($obj->facnumber);
$filedir=$conf->facture->dir_output . '/' . sanitize_string($obj->facnumber);
$urlsource=$_SERVER['PHP_SELF'].'?facid='.$obj->rowid;
$html->show_documents('facture',$filename,$filedir,$urlsource,'','','','','',1);
$formfile->show_documents('facture',$filename,$filedir,$urlsource,'','','','','',1);
print '</td></tr></table>';
print '</td>';

View File

@ -27,6 +27,7 @@
*/
require('./pre.inc.php');
require_once(DOL_DOCUMENT_ROOT."/html.formfile.class.php");
require_once(DOL_DOCUMENT_ROOT.'/paiement.class.php');
require_once(DOL_DOCUMENT_ROOT.'/compta/paiement/cheque/remisecheque.class.php');
require_once(DOL_DOCUMENT_ROOT.'/compta/bank/account.class.php');
@ -138,6 +139,7 @@ if ($_POST['action'] == 'builddoc' && $user->rights->banque)
llxHeader();
$html = new Form($db);
$formfile = new FormFile($db);
if ($_GET['action'] == 'new')
{
@ -392,10 +394,9 @@ if ($_GET['action'] != 'new')
{
if ($remisecheque->statut == 1)
{
//show_documents($modulepart,$filename,$filedir,$urlsource,$genallowed,$delallowed=0,$modelselected='',$modelliste=array(),$forcenomultilang=0);
$dir = DOL_DATA_ROOT.'/compta/bordereau/'.get_exdir($remisecheque->number);
$gen = array('Blochet');
$html->show_documents("remisecheque","",$dir,'',$gen,0);
$formfile->show_documents("remisecheque","",$dir,'',$gen,0);
}
}

View File

@ -28,6 +28,7 @@
*/
require("./pre.inc.php");
require_once(DOL_DOCUMENT_ROOT."/html.formfile.class.php");
require_once(DOL_DOCUMENT_ROOT."/propal.class.php");
require_once(DOL_DOCUMENT_ROOT."/lib/propal.lib.php");
if ($conf->projet->enabled) require_once(DOL_DOCUMENT_ROOT.'/project.class.php');
@ -114,6 +115,7 @@ if ( $action == 'delete' )
llxHeader();
$html = new Form($db);
$formfile = new FormFile($db);
$societestatic=new Societe($db);
$propalstatic=new Propal($db);
@ -496,7 +498,7 @@ if ($_GET["propalid"] > 0)
$var=true;
$somethingshown=$html->show_documents('propal',$filename,$filedir,$urlsource,$genallowed,$delallowed);
$somethingshown=$formfile->show_documents('propal',$filename,$filedir,$urlsource,$genallowed,$delallowed);
/*
@ -769,7 +771,7 @@ else
$filename=sanitize_string($objp->ref);
$filedir=$conf->propal->dir_output . '/' . sanitize_string($objp->ref);
$urlsource=$_SERVER['PHP_SELF'].'?propalid='.$objp->propalid;
$html->show_documents('propal',$filename,$filedir,$urlsource,'','','','','',1);
$formfile->show_documents('propal',$filename,$filedir,$urlsource,'','','','','',1);
print '</td></tr></table>';

View File

@ -31,6 +31,7 @@
*/
require("./pre.inc.php");
require_once(DOL_DOCUMENT_ROOT."/html.formfile.class.php");
require_once(DOL_DOCUMENT_ROOT."/product.class.php");
require_once(DOL_DOCUMENT_ROOT."/project.class.php");
require_once(DOL_DOCUMENT_ROOT."/propal.class.php");
@ -70,6 +71,8 @@ if ($_POST["action"] == 'confirm_cloture' && $_POST["confirm"] == 'yes')
}
$html = new Form($db);
$formfile = new FormFile($db);
/* *************************************************************************** */
/* */
@ -421,7 +424,7 @@ if ($_GET["id"] > 0)
$genallowed=0;
$delallowed=0;
$somethingshown=$html->show_documents('commande',$comref,$filedir,$urlsource,$genallowed,$delallowed,$commande->modelpdf);
$somethingshown=$formfile->show_documents('commande',$comref,$filedir,$urlsource,$genallowed,$delallowed,$commande->modelpdf);
print '</td><td valign="top" width="50%">';

View File

@ -31,7 +31,8 @@
*/
require("./pre.inc.php");
require_once(DOL_DOCUMENT_ROOT ."/expedition/mods/pdf/ModelePdfExpedition.class.php");
require_once(DOL_DOCUMENT_ROOT."/html.formfile.class.php");
require_once(DOL_DOCUMENT_ROOT."/expedition/mods/pdf/ModelePdfExpedition.class.php");
if ($conf->produit->enabled) require_once(DOL_DOCUMENT_ROOT."/product.class.php");
if ($conf->propal->enabled) require_once(DOL_DOCUMENT_ROOT."/propal.class.php");
if ($conf->commande->enabled) require_once(DOL_DOCUMENT_ROOT."/commande/commande.class.php");
@ -177,6 +178,7 @@ if ($_REQUEST['action'] == 'builddoc') // En get ou en post
llxHeader('',$langs->trans('Sending'),'Expedition');
$html = new Form($db);
$formfile = new FormFile($db);
/*********************************************************************
*
@ -673,7 +675,7 @@ else
//$genallowed=1;
//$delallowed=0;
$somethingshown=$html->show_documents('expedition',$expeditionref,$filedir,$urlsource,$genallowed,$delallowed,$expedition->modelpdf);
$somethingshown=$formfile->show_documents('expedition',$expeditionref,$filedir,$urlsource,$genallowed,$delallowed,$expedition->modelpdf);
if ($genallowed && ! $somethingshown) $somethingshown=1;
/*

View File

@ -27,6 +27,7 @@
*/
require_once("./pre.inc.php");
require_once(DOL_DOCUMENT_ROOT."/html.formfile.class.php");
require_once(DOL_DOCUMENT_ROOT."/exports/export.class.php");
require_once(DOL_DOCUMENT_ROOT.'/includes/modules/export/modules_export.php');
@ -69,6 +70,7 @@ $objexport->load_arrays($user,$datatoexport);
$objmodelexport=new ModeleExports();
$html = new Form($db);
$formfile = new FormFile($db);
/*
@ -606,14 +608,13 @@ if ($step == 4 && $datatoexport)
if ($mesg) print $mesg;
$htmlform=new Form($db);
print '<table width="100%"><tr><td width="50%">';
if (! is_dir($conf->export->dir_temp)) create_exdir($conf->export->dir_temp);
// Affiche liste des documents
// NB: La fonction show_documents rescanne les modules qd genallowed=1
$htmlform->show_documents('export','',$conf->export->dir_temp.'/'.$user->id,$_SERVER["PHP_SELF"].'?step=4&datatoexport='.$datatoexport,$liste,1,'csv','',1);
$formfile->show_documents('export','',$conf->export->dir_temp.'/'.$user->id,$_SERVER["PHP_SELF"].'?step=4&datatoexport='.$datatoexport,$liste,1,'csv','',1);
print '</td><td width="50%">&nbsp;</td></tr>';
print '</table>';

View File

@ -28,6 +28,7 @@
*/
require("./pre.inc.php");
require_once(DOL_DOCUMENT_ROOT."/html.formfile.class.php");
require_once(DOL_DOCUMENT_ROOT."/fichinter/fichinter.class.php");
require_once(DOL_DOCUMENT_ROOT."/includes/modules/fichinter/modules_fichinter.php");
require_once(DOL_DOCUMENT_ROOT."/lib/fichinter.lib.php");
@ -340,6 +341,7 @@ if ($_GET['action'] == 'down' && $user->rights->ficheinter->creer)
* Affichage page
*/
$html = new Form($db);
$formfile = new FormFile($db);
llxHeader();
@ -464,10 +466,8 @@ if ($_GET["action"] == 'create')
elseif ($_GET["id"] > 0)
{
/*
* Affichage en mode visu
*/
$html = new Form($db);
* Affichage en mode visu
*/
$fichinter = new Fichinter($db);
$result=$fichinter->fetch($_GET["id"]);
if (! $result > 0)
@ -907,7 +907,7 @@ elseif ($_GET["id"] > 0)
$var=true;
print "<br>\n";
$somethingshown=$html->show_documents('ficheinter',$filename,$filedir,$urlsource,$genallowed,$delallowed,$ficheinter->modelpdf);
$somethingshown=$formfile->show_documents('ficheinter',$filename,$filedir,$urlsource,$genallowed,$delallowed,$ficheinter->modelpdf);
print "</td><td>";
print "&nbsp;</td>";

View File

@ -29,6 +29,7 @@
*/
require('./pre.inc.php');
require_once(DOL_DOCUMENT_ROOT."/html.formfile.class.php");
require_once(DOL_DOCUMENT_ROOT.'/fourn/commande/modules/modules_commandefournisseur.php');
require_once DOL_DOCUMENT_ROOT."/fourn/fournisseur.product.class.php";
if ($conf->projet->enabled) require_once(DOL_DOCUMENT_ROOT.'/project.class.php');
@ -412,6 +413,7 @@ llxHeader('',$langs->trans("OrderCard"),"CommandeFournisseur");
$html = new Form($db);
$formfile = new FormFile($db);
/*********************************************************************
*
@ -936,7 +938,7 @@ else
$genallowed=($commande->statut == 0 ? $user->rights->fournisseur->commande->creer : 0);
$delallowed=$user->rights->fournisseur->commande->supprimer;
$somethingshown=$html->show_documents('commande_fournisseur',$comfournref,$filedir,$urlsource,$genallowed,$delallowed,$commande->modelpdf);
$somethingshown=$formfile->show_documents('commande_fournisseur',$comfournref,$filedir,$urlsource,$genallowed,$delallowed,$commande->modelpdf);
print '</td><td width="50%" valign="top">';
@ -968,14 +970,12 @@ else
/**
* Commander
*/
$form = new Form($db);
print '<br>';
print '<form name="commande" action="fiche.php?id='.$commande->id.'&amp;action=commande" method="post">';
print '<table class="border" width="100%">';
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("ToOrder").'</td></tr>';
print '<tr><td>'.$langs->trans("OrderDate").'</td><td>';
print $form->select_date('','','','','',"commande");
print $html->select_date('','','','','',"commande");
print '</td></tr>';
print '<tr><td>'.$langs->trans("OrderMode").'</td><td>';
@ -997,15 +997,13 @@ else
/**
* Receptionner
*/
$form = new Form($db);
print '<br>';
print '<form action="fiche.php?id='.$commande->id.'" method="post">';
print '<input type="hidden" name="action" value="livraison">';
print '<table class="border" width="100%">';
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("Receive").'</td></tr>';
print '<tr><td>'.$langs->trans("DeliveryDate").'</td><td>';
print $form->select_date('','','','','',"commande");
print $html->select_date('','','','','',"commande");
print "</td></tr>\n";
print "<tr><td>".$langs->trans("Delivery")."</td><td>\n";
@ -1013,7 +1011,7 @@ else
$liv['par'] = $langs->trans("PartialWoman");
$liv['tot'] = $langs->trans("TotalWoman");
print $form->select_array("type",$liv);
print $html->select_array("type",$liv);
print '</td></tr>';

View File

@ -2697,259 +2697,6 @@ class Form
return $resultyesno;
}
/**
* \brief Affiche la cartouche de la liste des documents d'une propale, facture...
* \param modulepart propal=propal, facture=facture, ...
* \param filename Sous rep à scanner (vide si filedir deja complet)
* \param filedir Repertoire à scanner
* \param urlsource Url page origine
* \param genallowed Génération autorisée (1/0 ou array des formats)
* \param delallowed Suppression autorisée (1/0)
* \param modelselected Modele à pré-sélectionner par défaut
* \param modelliste Tableau des modeles possibles
* \param forcenomultilang N'affiche pas option langue meme si MAIN_MULTILANGS défini
* \param iconPDF N'affiche que l'icone PDF avec le lien (1/0)
* \remarks Le fichier de facture détaillée est de la forme
* REFFACTURE-XXXXXX-detail.pdf ou XXXXX est une forme diverse
* \return int <0 si ko, nbre de fichiers affichés si ok
*/
function show_documents($modulepart,$filename,$filedir,$urlsource,$genallowed,$delallowed=0,$modelselected='',$modelliste=array(),$forcenomultilang=0,$iconPDF=0)
{
// filedir = conf->...dir_ouput."/".get_exdir(id)
global $langs,$bc,$conf;
$var=true;
if ($iconPDF == 1)
{
$genallowed = '';
$delallowed = 0;
$modelselected = '';
$modelliste = '';
$forcenomultilang=0;
}
$filename = sanitize_string($filename);
$headershown=0;
$i=0;
// Affiche en-tete tableau
if ($genallowed)
{
$modellist=array();
if ($modulepart == 'propal')
{
if (is_array($genallowed)) $modellist=$genallowed;
else
{
include_once(DOL_DOCUMENT_ROOT.'/includes/modules/propale/modules_propale.php');
$model=new ModelePDFPropales();
$modellist=$model->liste_modeles($this->db);
}
}
else if ($modulepart == 'commande')
{
if (is_array($genallowed)) $modellist=$genallowed;
else
{
include_once(DOL_DOCUMENT_ROOT.'/includes/modules/commande/modules_commande.php');
$model=new ModelePDFCommandes();
$modellist=$model->liste_modeles($this->db);
}
}
elseif ($modulepart == 'expedition')
{
if (is_array($genallowed)) $modellist=$genallowed;
else
{
include_once(DOL_DOCUMENT_ROOT.'/expedition/mods/pdf/ModelePdfExpedition.class.php');
$model=new ModelePDFExpedition();
$modellist=$model->liste_modeles($this->db);
}
}
elseif ($modulepart == 'livraison')
{
if (is_array($genallowed)) $modellist=$genallowed;
else
{
include_once(DOL_DOCUMENT_ROOT.'/livraison/mods/modules_livraison.php');
$model=new ModelePDFDeliveryOrder();
$modellist=$model->liste_modeles($this->db);
}
}
else if ($modulepart == 'ficheinter')
{
if (is_array($genallowed)) $modellist=$genallowed;
else
{
include_once(DOL_DOCUMENT_ROOT.'/includes/modules/fichinter/modules_fichinter.php');
$model=new ModelePDFFicheinter();
$modellist=$model->liste_modeles($this->db);
}
}
elseif ($modulepart == 'facture')
{
if (is_array($genallowed)) $modellist=$genallowed;
else
{
include_once(DOL_DOCUMENT_ROOT.'/includes/modules/facture/modules_facture.php');
$model=new ModelePDFFactures();
$modellist=$model->liste_modeles($this->db);
}
}
elseif ($modulepart == 'export')
{
if (is_array($genallowed)) $modellist=$genallowed;
else
{
include_once(DOL_DOCUMENT_ROOT.'/includes/modules/export/modules_export.php');
$model=new ModeleExports();
$modellist=$model->liste_modeles($this->db);
}
}
else if ($modulepart == 'commande_fournisseur')
{
if (is_array($genallowed)) $modellist=$genallowed;
else
{
include_once(DOL_DOCUMENT_ROOT.'/fourn/commande/modules/modules_commandefournisseur.php');
$model=new ModelePDFSuppliersOrders();
$modellist=$model->liste_modeles($this->db);
}
}
else if ($modulepart == 'facture_fournisseur')
{
if (is_array($genallowed)) $modellist=$genallowed;
else
{
include_once(DOL_DOCUMENT_ROOT.'/fourn/facture/modules/modules_facturefournisseur.php');
$model=new ModelePDFFacturesSuppliers();
$modellist=$model->liste_modeles($this->db);
}
}
else if ($modulepart == 'remisecheque')
{
if (is_array($genallowed)) $modellist=$genallowed;
else
{
// ??
}
}
else
{
dolibarr_print_error($this->db,'Bad value for modulepart');
return -1;
}
$headershown=1;
print '<form action="'.$urlsource.'#builddoc" method="post">';
print '<input type="hidden" name="action" value="builddoc">';
print_titre($langs->trans("Documents"));
print '<table class="border" width="100%">';
print '<tr '.$bc[$var].'>';
print '<td>'.$langs->trans('Model').'</td>';
print '<td align="center">';
$this->select_array('model',$modellist,$modelselected,0,0,1);
$texte=$langs->trans('Generate');
print '</td>';
print '<td align="center">';
if($conf->global->MAIN_MULTILANGS && ! $forcenomultilang)
{
$this->select_lang($langs->getDefaultLang());
}
else
{
print '&nbsp;';
}
print '</td>';
print '<td align="center" colspan="'.($delallowed?'2':'1').'">';
print '<input class="button" type="submit" value="'.$texte.'">';
print '</td></tr>';
}
// Recupe liste des fichiers
$png = '';
$filter = '';
if ($iconPDF==1)
{
$png = '|\.png$';
$filter = $filename.'.pdf';
}
$file_list=dolibarr_dir_list($filedir,'files',0,$filter,'\.meta$'.$png,'date',SORT_DESC);
// Affiche en-tete tableau si non deja affiché
if (sizeof($file_list) && ! $headershown && !$iconPDF)
{
$headershown=1;
print_titre($langs->trans("Documents"));
print '<table class="border" width="100%">';
}
// Boucle sur chaque ligne trouvée
foreach($file_list as $i => $file)
{
// Défini chemin relatif par rapport au module pour lien download
$relativepath=$file["name"]; // Cas general
if ($filename) $relativepath=$filename."/".$file["name"]; // Cas propal, facture...
// Autre cas
if ($modulepart == 'don') { $relativepath = get_exdir($filename,2).$file["name"]; }
if ($modulepart == 'export') { $relativepath = $file["name"]; }
// Défini le type MIME du document
if (eregi('\.([^\.]+)$',$file["name"],$reg)) $extension=$reg[1];
$mimetype=strtoupper($extension);
if ($extension == 'pdf') $mimetype='PDF';
if ($extension == 'html') $mimetype='HTML';
if (eregi('\-detail\.pdf',$file["name"])) $mimetype='PDF Détaillé';
if (!$iconPDF) print "<tr $bc[$var]>";
// Affiche colonne type MIME
if (!$iconPDF) print '<td nowrap>'.$mimetype.'</td>';
// Affiche nom fichier avec lien download
if (!$iconPDF) print '<td>';
print '<a href="'.DOL_URL_ROOT . '/document.php?modulepart='.$modulepart.'&amp;file='.urlencode($relativepath).'">';
if (!$iconPDF)
{
print $file["name"];
}
else
{
print img_pdf($file["name"],2);
}
print '</a>';
if (!$iconPDF) print '</td>';
// Affiche taille fichier
if (!$iconPDF) print '<td align="right">'.filesize($filedir."/".$file["name"]). ' bytes</td>';
// Affiche date fichier
if (!$iconPDF) print '<td align="right">'.dolibarr_print_date(filemtime($filedir."/".$file["name"]),'dayhour').'</td>';
if ($delallowed)
{
print '<td><a href="'.DOL_URL_ROOT.'/document.php?action=remove_file&amp;modulepart='.$modulepart.'&amp;file='.urlencode($relativepath).'&amp;urlsource='.urlencode($urlsource).'">'.img_delete().'</a></td>';
}
if (!$iconPDF) print '</tr>';
$i++;
}
if ($headershown)
{
// Affiche pied du tableau
print "</table>\n";
if ($genallowed)
{
print '</form>';
}
}
return ($i?$i:$headershown);
}
/**

View File

@ -102,7 +102,263 @@ class FormFile
}
return 1;
}
}
/**
* \brief Affiche la cartouche de la liste des documents d'une propale, facture...
* \param modulepart propal=propal, facture=facture, ...
* \param filename Sous rep à scanner (vide si filedir deja complet)
* \param filedir Repertoire à scanner
* \param urlsource Url page origine
* \param genallowed Génération autorisée (1/0 ou array des formats)
* \param delallowed Suppression autorisée (1/0)
* \param modelselected Modele à pré-sélectionner par défaut
* \param modelliste Tableau des modeles possibles
* \param forcenomultilang N'affiche pas option langue meme si MAIN_MULTILANGS défini
* \param iconPDF N'affiche que l'icone PDF avec le lien (1/0)
* \remarks Le fichier de facture détaillée est de la forme
* REFFACTURE-XXXXXX-detail.pdf ou XXXXX est une forme diverse
* \return int <0 si ko, nbre de fichiers affichés si ok
*/
function show_documents($modulepart,$filename,$filedir,$urlsource,$genallowed,$delallowed=0,$modelselected='',$modelliste=array(),$forcenomultilang=0,$iconPDF=0)
{
// filedir = conf->...dir_ouput."/".get_exdir(id)
global $langs,$bc,$conf;
$var=true;
if ($iconPDF == 1)
{
$genallowed = '';
$delallowed = 0;
$modelselected = '';
$modelliste = '';
$forcenomultilang=0;
}
$filename = sanitize_string($filename);
$headershown=0;
$i=0;
// Affiche en-tete tableau
if ($genallowed)
{
$modellist=array();
if ($modulepart == 'propal')
{
if (is_array($genallowed)) $modellist=$genallowed;
else
{
include_once(DOL_DOCUMENT_ROOT.'/includes/modules/propale/modules_propale.php');
$model=new ModelePDFPropales();
$modellist=$model->liste_modeles($this->db);
}
}
else if ($modulepart == 'commande')
{
if (is_array($genallowed)) $modellist=$genallowed;
else
{
include_once(DOL_DOCUMENT_ROOT.'/includes/modules/commande/modules_commande.php');
$model=new ModelePDFCommandes();
$modellist=$model->liste_modeles($this->db);
}
}
elseif ($modulepart == 'expedition')
{
if (is_array($genallowed)) $modellist=$genallowed;
else
{
include_once(DOL_DOCUMENT_ROOT.'/expedition/mods/pdf/ModelePdfExpedition.class.php');
$model=new ModelePDFExpedition();
$modellist=$model->liste_modeles($this->db);
}
}
elseif ($modulepart == 'livraison')
{
if (is_array($genallowed)) $modellist=$genallowed;
else
{
include_once(DOL_DOCUMENT_ROOT.'/livraison/mods/modules_livraison.php');
$model=new ModelePDFDeliveryOrder();
$modellist=$model->liste_modeles($this->db);
}
}
else if ($modulepart == 'ficheinter')
{
if (is_array($genallowed)) $modellist=$genallowed;
else
{
include_once(DOL_DOCUMENT_ROOT.'/includes/modules/fichinter/modules_fichinter.php');
$model=new ModelePDFFicheinter();
$modellist=$model->liste_modeles($this->db);
}
}
elseif ($modulepart == 'facture')
{
if (is_array($genallowed)) $modellist=$genallowed;
else
{
include_once(DOL_DOCUMENT_ROOT.'/includes/modules/facture/modules_facture.php');
$model=new ModelePDFFactures();
$modellist=$model->liste_modeles($this->db);
}
}
elseif ($modulepart == 'export')
{
if (is_array($genallowed)) $modellist=$genallowed;
else
{
include_once(DOL_DOCUMENT_ROOT.'/includes/modules/export/modules_export.php');
$model=new ModeleExports();
$modellist=$model->liste_modeles($this->db);
}
}
else if ($modulepart == 'commande_fournisseur')
{
if (is_array($genallowed)) $modellist=$genallowed;
else
{
include_once(DOL_DOCUMENT_ROOT.'/fourn/commande/modules/modules_commandefournisseur.php');
$model=new ModelePDFSuppliersOrders();
$modellist=$model->liste_modeles($this->db);
}
}
else if ($modulepart == 'facture_fournisseur')
{
if (is_array($genallowed)) $modellist=$genallowed;
else
{
include_once(DOL_DOCUMENT_ROOT.'/fourn/facture/modules/modules_facturefournisseur.php');
$model=new ModelePDFFacturesSuppliers();
$modellist=$model->liste_modeles($this->db);
}
}
else if ($modulepart == 'remisecheque')
{
if (is_array($genallowed)) $modellist=$genallowed;
else
{
// ??
}
}
else
{
dolibarr_print_error($this->db,'Bad value for modulepart');
return -1;
}
$headershown=1;
print '<form action="'.$urlsource.'#builddoc" method="post">';
print '<input type="hidden" name="action" value="builddoc">';
print_titre($langs->trans("Documents"));
print '<table class="border" width="100%">';
print '<tr '.$bc[$var].'>';
print '<td>'.$langs->trans('Model').'</td>';
print '<td align="center">';
$this->select_array('model',$modellist,$modelselected,0,0,1);
$texte=$langs->trans('Generate');
print '</td>';
print '<td align="center">';
if($conf->global->MAIN_MULTILANGS && ! $forcenomultilang)
{
$this->select_lang($langs->getDefaultLang());
}
else
{
print '&nbsp;';
}
print '</td>';
print '<td align="center" colspan="'.($delallowed?'2':'1').'">';
print '<input class="button" type="submit" value="'.$texte.'">';
print '</td></tr>';
}
// Recupe liste des fichiers
$png = '';
$filter = '';
if ($iconPDF==1)
{
$png = '|\.png$';
$filter = $filename.'.pdf';
}
$file_list=dolibarr_dir_list($filedir,'files',0,$filter,'\.meta$'.$png,'date',SORT_DESC);
// Affiche en-tete tableau si non deja affiché
if (sizeof($file_list) && ! $headershown && !$iconPDF)
{
$headershown=1;
print_titre($langs->trans("Documents"));
print '<table class="border" width="100%">';
}
// Boucle sur chaque ligne trouvée
foreach($file_list as $i => $file)
{
// Défini chemin relatif par rapport au module pour lien download
$relativepath=$file["name"]; // Cas general
if ($filename) $relativepath=$filename."/".$file["name"]; // Cas propal, facture...
// Autre cas
if ($modulepart == 'don') { $relativepath = get_exdir($filename,2).$file["name"]; }
if ($modulepart == 'export') { $relativepath = $file["name"]; }
// Défini le type MIME du document
if (eregi('\.([^\.]+)$',$file["name"],$reg)) $extension=$reg[1];
$mimetype=strtoupper($extension);
if ($extension == 'pdf') $mimetype='PDF';
if ($extension == 'html') $mimetype='HTML';
if (eregi('\-detail\.pdf',$file["name"])) $mimetype='PDF Détaillé';
if (!$iconPDF) print "<tr $bc[$var]>";
// Affiche colonne type MIME
if (!$iconPDF) print '<td nowrap>'.$mimetype.'</td>';
// Affiche nom fichier avec lien download
if (!$iconPDF) print '<td>';
print '<a href="'.DOL_URL_ROOT . '/document.php?modulepart='.$modulepart.'&amp;file='.urlencode($relativepath).'">';
if (!$iconPDF)
{
print $file["name"];
}
else
{
print img_pdf($file["name"],2);
}
print '</a>';
if (!$iconPDF) print '</td>';
// Affiche taille fichier
if (!$iconPDF) print '<td align="right">'.filesize($filedir."/".$file["name"]). ' bytes</td>';
// Affiche date fichier
if (!$iconPDF) print '<td align="right">'.dolibarr_print_date(filemtime($filedir."/".$file["name"]),'dayhour').'</td>';
if ($delallowed)
{
print '<td><a href="'.DOL_URL_ROOT.'/document.php?action=remove_file&amp;modulepart='.$modulepart.'&amp;file='.urlencode($relativepath).'&amp;urlsource='.urlencode($urlsource).'">'.img_delete().'</a></td>';
}
if (!$iconPDF) print '</tr>';
$i++;
}
if ($headershown)
{
// Affiche pied du tableau
print "</table>\n";
if ($genallowed)
{
print '</form>';
}
}
return ($i?$i:$headershown);
}
}
?>

View File

@ -31,6 +31,7 @@
require("./pre.inc.php");
require_once(DOL_DOCUMENT_ROOT."/livraison/mods/modules_livraison.php");
require_once(DOL_DOCUMENT_ROOT."/html.formfile.class.php");
if ($conf->produit->enabled) require_once(DOL_DOCUMENT_ROOT."/product.class.php");
if ($conf->expedition_bon->enabled) require_once(DOL_DOCUMENT_ROOT."/expedition/expedition.class.php");
if ($conf->stock->enabled) require_once(DOL_DOCUMENT_ROOT."/product/stock/entrepot.class.php");
@ -164,6 +165,7 @@ if ($_REQUEST['action'] == 'builddoc') // En get ou en post
llxHeader('',$langs->trans('Delivery'),'Livraison');
$html = new Form($db);
$formfile = new FormFile($db);
/*********************************************************************
*
@ -568,7 +570,7 @@ else
//$genallowed=1;
//$delallowed=0;
$somethingshown=$html->show_documents('livraison',$livraisonref,$filedir,$urlsource,$genallowed,$delallowed,$livraison->modelpdf);
$somethingshown=$formfile->show_documents('livraison',$livraisonref,$filedir,$urlsource,$genallowed,$delallowed,$livraison->modelpdf);
/*
* Déjà livre