diff --git a/htdocs/admin/tools/dolibarr_export.php b/htdocs/admin/tools/dolibarr_export.php index 8cec13a8311..4a51d7d5792 100644 --- a/htdocs/admin/tools/dolibarr_export.php +++ b/htdocs/admin/tools/dolibarr_export.php @@ -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]) { 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 '

'; diff --git a/htdocs/admin/tools/export.php b/htdocs/admin/tools/export.php index afe87a7d687..fd29d6de87a 100644 --- a/htdocs/admin/tools/export.php +++ b/htdocs/admin/tools/export.php @@ -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 '
'; @@ -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) { diff --git a/htdocs/comm/index.php b/htdocs/comm/index.php index 0b8753b8142..46b9db1f812 100644 --- a/htdocs/comm/index.php +++ b/htdocs/comm/index.php @@ -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 ''; print ""; @@ -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 ''; print ''; diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index 99d47d704fc..4dd71731678 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -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 ''; diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php index 58156370e5f..7907f4f6833 100644 --- a/htdocs/commande/fiche.php +++ b/htdocs/commande/fiche.php @@ -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 diff --git a/htdocs/commande/index.php b/htdocs/commande/index.php index 9ea29fa8d8f..a2fea6c4509 100644 --- a/htdocs/commande/index.php +++ b/htdocs/commande/index.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2006 Laurent Destailleur + * Copyright (C) 2004-2008 Laurent Destailleur * * 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 ''; print ''; @@ -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 ''; print ''; @@ -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 ''; print ''; diff --git a/htdocs/commande/liste.php b/htdocs/commande/liste.php index 47528933ed5..a89541d2ec7 100644 --- a/htdocs/commande/liste.php +++ b/htdocs/commande/liste.php @@ -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 ''; print ''; diff --git a/htdocs/compta/commande/fiche.php b/htdocs/compta/commande/fiche.php index 8f92e3076eb..c69df007552 100644 --- a/htdocs/compta/commande/fiche.php +++ b/htdocs/compta/commande/fiche.php @@ -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 diff --git a/htdocs/compta/commande/liste.php b/htdocs/compta/commande/liste.php index 494ca27c0d3..bbc52d78c78 100644 --- a/htdocs/compta/commande/liste.php +++ b/htdocs/compta/commande/liste.php @@ -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 ''; print ''; diff --git a/htdocs/compta/dons/fiche.php b/htdocs/compta/dons/fiche.php index d0827097338..0f6fdcee5ac 100644 --- a/htdocs/compta/dons/fiche.php +++ b/htdocs/compta/dons/fiche.php @@ -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 ""; print "".$langs->trans("PaymentMode")."\n"; - $form = new Form($db); - $form->select_types_paiements('', 'modepaiement', 'CRDT', 0); + $html->select_types_paiements('', 'modepaiement', 'CRDT', 0); print "\n"; if ($conf->projet->enabled) @@ -212,7 +213,6 @@ if ($_GET["action"] == 'create') } print "".$langs->trans("PublicDonation").""; - $html=new Form($db); print $html->selectyesno("public",1,1); print "\n"; @@ -292,7 +292,6 @@ if ($_GET["rowid"] && $_GET["action"] == 'edit') } print "".$langs->trans("PublicDonation").""; - $html=new Form($db); print $html->selectyesno("public",1,1); print ""; print "\n"; @@ -309,8 +308,7 @@ if ($_GET["rowid"] && $_GET["action"] == 'edit') print "".''.$langs->trans("Amount").' '.$langs->trans("Currency".$conf->monnaie).''; print "".$langs->trans("PaymentMode")."\n"; - $form = new Form($db); - $form->select_types_paiements('', 'modepaiement', 'CRDT', 0); + $html->select_types_paiements('', 'modepaiement', 'CRDT', 0); print "\n"; print "".''.$langs->trans("Status").''.$don->getLibStatut(4).''; @@ -434,7 +432,7 @@ if ($_GET["rowid"] && $_GET["action"] != 'edit') $var=true; print '
'; - $html->show_documents('don',$filename,$filedir,$urlsource,$genallowed,$delallowed); + $formfile->show_documents('don',$filename,$filedir,$urlsource,$genallowed,$delallowed); print ' '; diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 7dada17a1ef..9489e4c1357 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -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 '
'; - $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 ''; print ''; diff --git a/htdocs/compta/facture/impayees.php b/htdocs/compta/facture/impayees.php index 1eb7bbee51d..c8d2b8471db 100644 --- a/htdocs/compta/facture/impayees.php +++ b/htdocs/compta/facture/impayees.php @@ -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 ''; diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php index 842fc21aa19..0a33a8d0ab8 100644 --- a/htdocs/compta/index.php +++ b/htdocs/compta/index.php @@ -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 ''; print ''; @@ -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 ''; print ''; diff --git a/htdocs/compta/paiement/cheque/fiche.php b/htdocs/compta/paiement/cheque/fiche.php index 365ce7f47a6..65d44454695 100644 --- a/htdocs/compta/paiement/cheque/fiche.php +++ b/htdocs/compta/paiement/cheque/fiche.php @@ -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); } } diff --git a/htdocs/compta/propal.php b/htdocs/compta/propal.php index 4d04caee3d0..0722012fcd6 100644 --- a/htdocs/compta/propal.php +++ b/htdocs/compta/propal.php @@ -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 ''; diff --git a/htdocs/expedition/commande.php b/htdocs/expedition/commande.php index 7730a039ddb..49bb837cc51 100644 --- a/htdocs/expedition/commande.php +++ b/htdocs/expedition/commande.php @@ -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 ''; diff --git a/htdocs/expedition/fiche.php b/htdocs/expedition/fiche.php index c4c3550c444..86315b370fd 100644 --- a/htdocs/expedition/fiche.php +++ b/htdocs/expedition/fiche.php @@ -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; /* diff --git a/htdocs/exports/export.php b/htdocs/exports/export.php index 6af65be1137..4a7a192ebd5 100644 --- a/htdocs/exports/export.php +++ b/htdocs/exports/export.php @@ -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 ''; print '
'; 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 ' 
'; diff --git a/htdocs/fichinter/fiche.php b/htdocs/fichinter/fiche.php index c8256334294..abca9ea10b4 100644 --- a/htdocs/fichinter/fiche.php +++ b/htdocs/fichinter/fiche.php @@ -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 "
\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 ""; print " "; diff --git a/htdocs/fourn/commande/fiche.php b/htdocs/fourn/commande/fiche.php index 6f0d97c1bf3..c0ced8ff431 100644 --- a/htdocs/fourn/commande/fiche.php +++ b/htdocs/fourn/commande/fiche.php @@ -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 ''; @@ -968,14 +970,12 @@ else /** * Commander */ - $form = new Form($db); - print '
'; print '
'; print ''; print ''; print ''; print '
'.$langs->trans("ToOrder").'
'.$langs->trans("OrderDate").''; - print $form->select_date('','','','','',"commande"); + print $html->select_date('','','','','',"commande"); print '
'.$langs->trans("OrderMode").''; @@ -997,15 +997,13 @@ else /** * Receptionner */ - $form = new Form($db); - print '
'; print ''; print ''; print ''; print ''; print '\n"; print "'; diff --git a/htdocs/html.form.class.php b/htdocs/html.form.class.php index 1bada626895..72c139fdd1f 100644 --- a/htdocs/html.form.class.php +++ b/htdocs/html.form.class.php @@ -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 ''; - print ''; - - print_titre($langs->trans("Documents")); - print '
'.$langs->trans("Receive").'
'.$langs->trans("DeliveryDate").''; - print $form->select_date('','','','','',"commande"); + print $html->select_date('','','','','',"commande"); print "
".$langs->trans("Delivery")."\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 '
'; - - print ''; - print ''; - print ''; - print ''; - print ''; - } - - // 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 '
'.$langs->trans('Model').''; - $this->select_array('model',$modellist,$modelselected,0,0,1); - $texte=$langs->trans('Generate'); - print ''; - if($conf->global->MAIN_MULTILANGS && ! $forcenomultilang) - { - $this->select_lang($langs->getDefaultLang()); - } - else - { - print ' '; - } - print ''; - print ''; - print '
'; - } - - // 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 ""; - - // Affiche colonne type MIME - if (!$iconPDF) print ''; - // Affiche nom fichier avec lien download - if (!$iconPDF) print ''; - // Affiche taille fichier - if (!$iconPDF) print ''; - // Affiche date fichier - if (!$iconPDF) print ''; - - if ($delallowed) - { - print ''; - } - - if (!$iconPDF) print ''; - - $i++; - } - - - if ($headershown) - { - // Affiche pied du tableau - print "
'.$mimetype.''; - print ''; - if (!$iconPDF) - { - print $file["name"]; - } - else - { - print img_pdf($file["name"],2); - } - print ''; - if (!$iconPDF) print ''.filesize($filedir."/".$file["name"]). ' bytes'.dolibarr_print_date(filemtime($filedir."/".$file["name"]),'dayhour').''.img_delete().'
\n"; - if ($genallowed) - { - print ''; - } - } - - return ($i?$i:$headershown); - } /** diff --git a/htdocs/html.formfile.class.php b/htdocs/html.formfile.class.php index 86232a8de0b..ff05920ac36 100644 --- a/htdocs/html.formfile.class.php +++ b/htdocs/html.formfile.class.php @@ -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 '
'; + print ''; + + print_titre($langs->trans("Documents")); + print ''; + + print ''; + print ''; + print ''; + print ''; + print ''; + } + + // 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 '
'.$langs->trans('Model').''; + $this->select_array('model',$modellist,$modelselected,0,0,1); + $texte=$langs->trans('Generate'); + print ''; + if($conf->global->MAIN_MULTILANGS && ! $forcenomultilang) + { + $this->select_lang($langs->getDefaultLang()); + } + else + { + print ' '; + } + print ''; + print ''; + print '
'; + } + + // 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 ""; + + // Affiche colonne type MIME + if (!$iconPDF) print ''; + // Affiche nom fichier avec lien download + if (!$iconPDF) print ''; + // Affiche taille fichier + if (!$iconPDF) print ''; + // Affiche date fichier + if (!$iconPDF) print ''; + + if ($delallowed) + { + print ''; + } + + if (!$iconPDF) print ''; + + $i++; + } + + + if ($headershown) + { + // Affiche pied du tableau + print "
'.$mimetype.''; + print ''; + if (!$iconPDF) + { + print $file["name"]; + } + else + { + print img_pdf($file["name"],2); + } + print ''; + if (!$iconPDF) print ''.filesize($filedir."/".$file["name"]). ' bytes'.dolibarr_print_date(filemtime($filedir."/".$file["name"]),'dayhour').''.img_delete().'
\n"; + if ($genallowed) + { + print '
'; + } + } + + return ($i?$i:$headershown); + } + } ?> diff --git a/htdocs/livraison/fiche.php b/htdocs/livraison/fiche.php index f27e4890ca8..b955f76e336 100644 --- a/htdocs/livraison/fiche.php +++ b/htdocs/livraison/fiche.php @@ -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