diff --git a/htdocs/admin/mails.php b/htdocs/admin/mails.php index a227408fea9..a6b4eb4cfa2 100644 --- a/htdocs/admin/mails.php +++ b/htdocs/admin/mails.php @@ -81,7 +81,7 @@ if ($_POST['addfile'] || $_POST['addfilehtml']) { $mesg = '
'.$langs->trans("FileTransferComplete").'
'; - include_once(DOL_DOCUMENT_ROOT.'/html.formmail.class.php'); + include_once(DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'); $formmail = new FormMail($db); $formmail->add_attached_files($upload_dir . "/" . $_FILES['addedfile']['name'],$_FILES['addedfile']['name'],$_FILES['addedfile']['type']); } @@ -141,7 +141,7 @@ if (! empty($_POST['removedfile']) || ! empty($_POST['removedfilehtml'])) $message = '
'.$langs->trans("FileWasRemoved",$filetodelete).'
'; //print_r($_FILES); - include_once(DOL_DOCUMENT_ROOT.'/html.formmail.class.php'); + include_once(DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'); $formmail = new FormMail($db); $formmail->remove_attached_files($keytodelete); } @@ -171,7 +171,7 @@ if (($_POST['action'] == 'send' || $_POST['action'] == 'sendhtml') $deliveryreceipt= $_POST["deliveryreceipt"]; // Create form object - include_once('../html.formmail.class.php'); + include_once('../core/class/html.formmail.class.php'); $formmail = new FormMail($db); $attachedfiles=$formmail->get_attached_files(); @@ -555,7 +555,7 @@ else print_titre($langs->trans("DoTestSend")); // Cree l'objet formulaire mail - include_once(DOL_DOCUMENT_ROOT."/html.formmail.class.php"); + include_once(DOL_DOCUMENT_ROOT."/core/class/html.formmail.class.php"); $formmail = new FormMail($db); $formmail->fromname = (isset($_POST['fromname'])?$_POST['fromname']:$conf->global->MAIN_MAIL_EMAIL_FROM); $formmail->frommail = (isset($_POST['frommail'])?$_POST['frommail']:$conf->global->MAIN_MAIL_EMAIL_FROM); @@ -600,7 +600,7 @@ else print_titre($langs->trans("DoTestSendHTML")); // Cree l'objet formulaire mail - include_once(DOL_DOCUMENT_ROOT."/html.formmail.class.php"); + include_once(DOL_DOCUMENT_ROOT."/core/class/html.formmail.class.php"); $formmail = new FormMail($db); $formmail->fromname = (isset($_POST['fromname'])?$_POST['fromname']:$conf->global->MAIN_MAIL_EMAIL_FROM); $formmail->frommail = (isset($_POST['frommail'])?$_POST['frommail']:$conf->global->MAIN_MAIL_EMAIL_FROM); diff --git a/htdocs/admin/security_other.php b/htdocs/admin/security_other.php index 46c2c3bcc8f..6697e433ce1 100644 --- a/htdocs/admin/security_other.php +++ b/htdocs/admin/security_other.php @@ -53,7 +53,7 @@ if ($_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC)) { $mesg = '
'.$langs->trans("FileTransferComplete").'
'; - include_once(DOL_DOCUMENT_ROOT.'/html.formmail.class.php'); + include_once(DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'); $formmail = new FormMail($db); $formmail->add_attached_files($upload_dir . "/" . $_FILES['addedfile']['name'],$_FILES['addedfile']['name'],$_FILES['addedfile']['type']); } diff --git a/htdocs/admin/tools/dolibarr_export.php b/htdocs/admin/tools/dolibarr_export.php index 280aa0dcc65..c0e1408c594 100644 --- a/htdocs/admin/tools/dolibarr_export.php +++ b/htdocs/admin/tools/dolibarr_export.php @@ -24,7 +24,7 @@ */ require("../../main.inc.php"); -require_once(DOL_DOCUMENT_ROOT."/html.formfile.class.php"); +require_once(DOL_DOCUMENT_ROOT."/core/class/html.formfile.class.php"); include_once $dolibarr_main_document_root."/lib/databases/".$conf->db->type.".lib.php"; $langs->load("admin"); diff --git a/htdocs/admin/tools/export.php b/htdocs/admin/tools/export.php index 5b2276342ee..0d8dc245e4d 100644 --- a/htdocs/admin/tools/export.php +++ b/htdocs/admin/tools/export.php @@ -24,7 +24,7 @@ require("../../main.inc.php"); require_once(DOL_DOCUMENT_ROOT."/lib/admin.lib.php"); -require_once(DOL_DOCUMENT_ROOT."/html.formfile.class.php"); +require_once(DOL_DOCUMENT_ROOT."/core/class/html.formfile.class.php"); include_once $dolibarr_main_document_root."/lib/databases/".$conf->db->type.".lib.php"; $what=$_REQUEST["what"]; diff --git a/htdocs/categories/photos.php b/htdocs/categories/photos.php index 780104a50cd..1aff74342a2 100644 --- a/htdocs/categories/photos.php +++ b/htdocs/categories/photos.php @@ -28,7 +28,7 @@ require("../main.inc.php"); require_once(DOL_DOCUMENT_ROOT."/categories/class/categorie.class.php"); -require_once(DOL_DOCUMENT_ROOT."/html.formfile.class.php"); +require_once(DOL_DOCUMENT_ROOT."/core/class/html.formfile.class.php"); $langs->load("category"); $langs->load("bills"); diff --git a/htdocs/comm/action/document.php b/htdocs/comm/action/document.php index 740a529b0b5..1f84efa4249 100755 --- a/htdocs/comm/action/document.php +++ b/htdocs/comm/action/document.php @@ -33,7 +33,7 @@ require_once(DOL_DOCUMENT_ROOT."/contact/class/contact.class.php"); require_once(DOL_DOCUMENT_ROOT."/comm/action/cactioncomm.class.php"); require_once(DOL_DOCUMENT_ROOT."/comm/action/actioncomm.class.php"); require_once(DOL_DOCUMENT_ROOT."/lib/files.lib.php"); -require_once(DOL_DOCUMENT_ROOT."/html.formfile.class.php"); +require_once(DOL_DOCUMENT_ROOT."/core/class/html.formfile.class.php"); $langs->load("companies"); $langs->load("commercial"); diff --git a/htdocs/comm/clients.php b/htdocs/comm/clients.php index 3a84a233a19..afa25680a96 100644 --- a/htdocs/comm/clients.php +++ b/htdocs/comm/clients.php @@ -26,7 +26,7 @@ */ require("../main.inc.php"); -require_once(DOL_DOCUMENT_ROOT."/html.formother.class.php"); +require_once(DOL_DOCUMENT_ROOT."/core/class/html.formother.class.php"); // Security check $socid = isset($_GET["socid"])?$_GET["socid"]:''; diff --git a/htdocs/comm/index.php b/htdocs/comm/index.php index 4c9931ecd43..7022e42aea4 100644 --- a/htdocs/comm/index.php +++ b/htdocs/comm/index.php @@ -26,7 +26,7 @@ */ require("../main.inc.php"); -require_once(DOL_DOCUMENT_ROOT."/html.formfile.class.php"); +require_once(DOL_DOCUMENT_ROOT."/core/class/html.formfile.class.php"); require_once(DOL_DOCUMENT_ROOT."/societe/class/client.class.php"); require_once(DOL_DOCUMENT_ROOT."/comm/action/actioncomm.class.php"); require_once(DOL_DOCUMENT_ROOT."/lib/agenda.lib.php"); diff --git a/htdocs/comm/mailing/fiche.php b/htdocs/comm/mailing/fiche.php index cd328fcb27f..2f700d09466 100644 --- a/htdocs/comm/mailing/fiche.php +++ b/htdocs/comm/mailing/fiche.php @@ -30,7 +30,7 @@ require_once(DOL_DOCUMENT_ROOT.'/lib/files.lib.php'); require_once(DOL_DOCUMENT_ROOT."/lib/CMailFile.class.php"); require_once(DOL_DOCUMENT_ROOT."/lib/functions2.lib.php"); require_once(DOL_DOCUMENT_ROOT."/comm/mailing/mailing.class.php"); -require_once(DOL_DOCUMENT_ROOT."/html.formother.class.php"); +require_once(DOL_DOCUMENT_ROOT."/core/class/html.formother.class.php"); $langs->load("mails"); diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index d0528c88a97..962533f2399 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -396,7 +396,7 @@ if ($_POST['addfile']) { $mesg = '
'.$langs->trans("FileTransferComplete").'
'; - include_once(DOL_DOCUMENT_ROOT.'/html.formmail.class.php'); + include_once(DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'); $formmail = new FormMail($db); // Add file in list of files in session $formmail->add_attached_files($upload_dir . "/" . $_FILES['addedfile']['name'],$_FILES['addedfile']['name'],$_FILES['addedfile']['type']); @@ -451,7 +451,7 @@ if (! empty($_POST['removedfile'])) $message = '
'.$langs->trans("FileWasRemoved",$filetodelete).'
'; //print_r($_FILES); - include_once(DOL_DOCUMENT_ROOT.'/html.formmail.class.php'); + include_once(DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'); $formmail = new FormMail($db); $formmail->remove_attached_files($keytodelete); } @@ -523,7 +523,7 @@ if ($_POST['action'] == 'send' && ! $_POST['addfile'] && ! $_POST['removedfile'] } // Create form object - include_once('../html.formmail.class.php'); + include_once('../core/class/html.formmail.class.php'); $formmail = new FormMail($db); $attachedfiles=$formmail->get_attached_files(); @@ -2024,7 +2024,7 @@ if ($id > 0 || ! empty($ref)) print_titre($langs->trans('SendPropalByMail')); // Create form object - include_once('../html.formmail.class.php'); + include_once('../core/class/html.formmail.class.php'); $formmail = new FormMail($db); $formmail->fromtype = 'user'; $formmail->fromid = $user->id; diff --git a/htdocs/comm/propal/document.php b/htdocs/comm/propal/document.php index 222ecca56cf..afc0e64ba90 100644 --- a/htdocs/comm/propal/document.php +++ b/htdocs/comm/propal/document.php @@ -30,7 +30,7 @@ require("../../main.inc.php"); require_once(DOL_DOCUMENT_ROOT."/comm/propal/class/propal.class.php"); require_once(DOL_DOCUMENT_ROOT."/lib/propal.lib.php"); require_once(DOL_DOCUMENT_ROOT."/lib/files.lib.php"); -require_once(DOL_DOCUMENT_ROOT."/html.formfile.class.php"); +require_once(DOL_DOCUMENT_ROOT."/core/class/html.formfile.class.php"); $langs->load('compta'); $langs->load('other'); diff --git a/htdocs/comm/prospect/prospects.php b/htdocs/comm/prospect/prospects.php index 32715965d33..c6192a26410 100644 --- a/htdocs/comm/prospect/prospects.php +++ b/htdocs/comm/prospect/prospects.php @@ -27,7 +27,7 @@ require("../../main.inc.php"); require_once(DOL_DOCUMENT_ROOT."/comm/prospect/prospect.class.php"); -require_once(DOL_DOCUMENT_ROOT."/html.formother.class.php"); +require_once(DOL_DOCUMENT_ROOT."/core/class/html.formother.class.php"); $langs->load("propal"); $langs->load("companies"); diff --git a/htdocs/commande/document.php b/htdocs/commande/document.php index 8b461b7086a..26ee9202c61 100644 --- a/htdocs/commande/document.php +++ b/htdocs/commande/document.php @@ -29,7 +29,7 @@ require("../main.inc.php"); require_once(DOL_DOCUMENT_ROOT.'/lib/order.lib.php'); require_once(DOL_DOCUMENT_ROOT."/lib/files.lib.php"); -require_once(DOL_DOCUMENT_ROOT."/html.formfile.class.php"); +require_once(DOL_DOCUMENT_ROOT."/core/class/html.formfile.class.php"); require_once(DOL_DOCUMENT_ROOT ."/commande/class/commande.class.php"); if (!$user->rights->commande->lire) accessforbidden(); diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php index a4fcbd85f08..1f7784e905b 100644 --- a/htdocs/commande/fiche.php +++ b/htdocs/commande/fiche.php @@ -30,7 +30,7 @@ require("../main.inc.php"); require_once(DOL_DOCUMENT_ROOT."/core/class/html.formfile.class.php"); -require_once(DOL_DOCUMENT_ROOT."/html.formorder.class.php"); +require_once(DOL_DOCUMENT_ROOT."/core/class/html.formorder.class.php"); require_once(DOL_DOCUMENT_ROOT."/includes/modules/commande/modules_commande.php"); require_once(DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'); require_once(DOL_DOCUMENT_ROOT.'/comm/action/actioncomm.class.php'); diff --git a/htdocs/html.formfile.class.php b/htdocs/html.formfile.class.php deleted file mode 100644 index a60e28876ca..00000000000 --- a/htdocs/html.formfile.class.php +++ /dev/null @@ -1,530 +0,0 @@ - - * - * 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 - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -/** - * \file htdocs/html.formfile.class.php - * \brief Fichier de la classe des fonctions predefinie de composants html fichiers - * \version $Id$ - */ - - -/** - * \class FormFile - * \brief Classe permettant la generation de composants html fichiers - */ -class FormFile -{ - var $db; - var $error; - - - /** - * \brief Constructeur - * \param DB handler d'acces base de donnee - */ - function FormFile($DB) - { - $this->db = $DB; - - return 1; - } - - - /** - * \brief Show file add form - * \param url Url - * \param title Title zone - * \param addcancel 1=Add 'Cancel' button - * \param sectionid If upload must be done inside a particular ECM section - * \param perm Value of permission to allow upload - * \return int <0 si ko, >0 si ok - */ - function form_attach_new_file($url,$title='',$addcancel=0, $sectionid=0, $perm=1) - { - global $conf,$langs; - - print "\n\n\n"; - - if (! $title) $title=$langs->trans("AttachANewFile"); - print_titre($title); - - print '
'; - print ''; - print ''; - - print ''; - print '"; - print "
'; - - $max=$conf->global->MAIN_UPLOAD_DOC; // En Kb - $maxphp=@ini_get('upload_max_filesize'); // En inconnu - if (preg_match('/m$/i',$maxphp)) $maxphp=$maxphp*1024; - if (preg_match('/k$/i',$maxphp)) $maxphp=$maxphp; - // Now $max and $maxphp are in Kb - if ($maxphp > 0) $max=min($max,$maxphp); - - if ($max > 0) - { - print ''; - } - print 'global->MAIN_UPLOAD_DOC) || empty($perm)?' disabled="true"':''); - print '>'; - print '   '; - print 'global->MAIN_UPLOAD_DOC) || empty($perm)?' disabled="true"':''); - print '>'; - - if ($addcancel) - { - print '   '; - print ''; - } - - if (! empty($conf->global->MAIN_UPLOAD_DOC)) - { - if ($perm) - { - print ' ('.$langs->trans("MaxSize").': '.$max.' '.$langs->trans("Kb"); - print ' '.info_admin($langs->trans("ThisLimitIsDefinedInSetup",$max,$maxphp),1); - print ')'; - } - } - else - { - print ' ('.$langs->trans("UploadDisabled").')'; - } - print "
"; - - print '
'; - if (empty($sectionid)) print '
'; - - print "\n\n\n"; - - return 1; - } - - - /** - * \brief Show the box with list of available documents for object - * \param modulepart propal=propal, facture=facture, ... - * \param filename Sub dir to scan (Example: '9/9', 'FA9999'). Use '' if filedir already complete) - * \param filedir Dir to scan - * \param urlsource Url of origin page (for return) - * \param genallowed Generation is allowed (1/0 or array of formats) - * \param delallowed Remove is allowed (1/0) - * \param modelselected Model to preselect by default - * \param allowgenifempty Show warning if no model activated - * \param forcenomultilang Do not show language option (even if MAIN_MULTILANGS defined) - * \param iconPDF Show only PDF icon with link (1/0) - * \param maxfilenamelength Max length for filename shown - * \param noform Do not output html form tags - * \param param More param on http links - * \param title Title to show on top of form - * \param buttonlabel Label on submit button - * \param codelang Default language code to use on lang combo box if multilang is enabled - * \return int <0 if KO, number of shown files if OK - */ - function show_documents($modulepart,$filename,$filedir,$urlsource,$genallowed,$delallowed=0,$modelselected='',$allowgenifempty=1,$forcenomultilang=0,$iconPDF=0,$maxfilenamelength=28,$noform=0,$param='',$title='',$buttonlabel='',$codelang='') - { - // filedir = conf->...dir_ouput."/".get_exdir(id) - include_once(DOL_DOCUMENT_ROOT.'/lib/files.lib.php'); - - global $langs,$bc,$conf; - $var=true; - - if ($iconPDF == 1) - { - $genallowed = ''; - $delallowed = 0; - $modelselected = ''; - $forcenomultilang=0; - } - - $filename = dol_sanitizeFileName($filename); - $headershown=0; - $showempty=0; - $i=0; - - print "\n".''."\n"; - //print 'filedir='.$filedir; - - // Affiche en-tete tableau - if ($genallowed) - { - $modellist=array(); - if ($modulepart == 'company') - { - $showempty=1; - if (is_array($genallowed)) $modellist=$genallowed; - else - { - include_once(DOL_DOCUMENT_ROOT.'/includes/modules/societe/modules_societe.class.php'); - $model=new ModeleThirdPartyDoc(); - $modellist=$model->liste_modeles($this->db); - } - } - else 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.'/includes/modules/expedition/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.'/includes/modules/livraison/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 == 'project') - { - if (is_array($genallowed)) $modellist=$genallowed; - else - { - include_once(DOL_DOCUMENT_ROOT.'/includes/modules/project/modules_project.php'); - $model=new ModelePDFProjects(); - $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.'/includes/modules/supplier_order/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 - { - // ?? - } - } - elseif ($modulepart == 'donation') - { - if (is_array($genallowed)) $modellist=$genallowed; - else - { - include_once(DOL_DOCUMENT_ROOT.'/includes/modules/dons/modules_don.php'); - $model=new ModeleDon(); - $modellist=$model->liste_modeles($this->db); - } - } - else if ($modulepart == 'unpaid') - { - $modellist=''; - } - else - { - dol_print_error($this->db,'Bad value for modulepart'); - return -1; - } - - $headershown=1; - - $html = new Form($db); - $buttonlabeltoshow=$buttonlabel; - if (empty($buttonlabel)) $buttonlabel=$langs->trans('Generate'); - - if (empty($noform)) print '
'; - print ''; - print ''; - - print_titre($langs->trans("Documents")); - print ''; - - print ''; - - // Model - if (! empty($modellist)) - { - print ''; - } - else - { - print ''; - } - - // Language code (if multilang) - print ''; - - // Button - print ''; - - print ''; - } - - // Get list of files - $png = ''; - $filter = ''; - if ($iconPDF==1) - { - $png = '\.png$'; - $filter = $filename.'.pdf'; - } - $file_list=dol_dir_list($filedir,'files',0,$filter,'\.meta$'.($png?'|'.$png:''),'date',SORT_DESC); - - // Affiche en-tete tableau si non deja affiche - if (sizeof($file_list) && ! $headershown && !$iconPDF) - { - $headershown=1; - $titletoshow=$langs->trans("Documents"); - if (! empty($title)) $titletoshow=$title; - print_titre($titletoshow); - print '
'; - print $langs->trans('Model').' '; - print $html->selectarray('model',$modellist,$modelselected,$showempty,0,0); - print ''; - print $langs->trans("Files"); - print ''; - if (($allowgenifempty || (is_array($modellist) && sizeof($modellist) > 0)) && $conf->global->MAIN_MULTILANGS && ! $forcenomultilang) - { - include_once(DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php'); - $formadmin=new FormAdmin($this->db); - $defaultlang=$codelang?$codelang:$langs->getDefaultLang(); - $formadmin->select_lang($defaultlang); - } - else - { - print ' '; - } - print ''; - print ''; - if ($allowgenifempty && ! is_array($modellist) && empty($modellist)) - { - $langs->load("errors"); - print ' '.img_warning($langs->trans("WarningNoDocumentModelActivated")); - } - print '
'; - } - - // Loop on each file found - foreach($file_list as $i => $file) - { - $var=!$var; - - // Define relative path for download link (depends on module) - $relativepath=$file["name"]; // Cas general - if ($filename) $relativepath=$filename."/".$file["name"]; // Cas propal, facture... - // Autre cas - if ($modulepart == 'donation') { $relativepath = get_exdir($filename,2).$file["name"]; } - if ($modulepart == 'export') { $relativepath = $file["name"]; } - - if (!$iconPDF) print ""; - - // Show file name with link to 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 "
'; - print ''; - if (!$iconPDF) - { - print img_mime($file["name"],$langs->trans("File").': '.$file["name"]).' '.dol_trunc($file["name"],$maxfilenamelength); - } - else - { - print img_pdf($file["name"],2); - } - print ''; - if (!$iconPDF) print ''.dol_print_size(dol_filesize($filedir."/".$file["name"])).''.dol_print_date(dol_filemtime($filedir."/".$file["name"]),'dayhour').''.img_delete().'
\n"; - if ($genallowed) - { - if (empty($noform)) print '
'."\n"; - } - } - print ''."\n"; - return ($i?$i:$headershown); - } - - - /** - * \brief Show list of documents in a directory - * \param filearray Array of files loaded by dol_dir_list function - * \param object Object on which document is linked to - * \param modulepart Value for modulepart used by download wrapper - * \param param Parameters on sort links - * \param forcedownload Force to open dialog box "Save As" when clicking on file - * \param relativepath Relative path of docs (autodefined if not provided) - * \param permtodelete Permission to delete - * \param useinecm Change output for use in ecm module - * \param textifempty Text to show if filearray is empty - * \return int <0 if KO, nb of files shown if OK - */ - function list_of_documents($filearray,$object,$modulepart,$param,$forcedownload=0,$relativepath='',$permtodelete=1,$useinecm=0,$textifempty='',$maxlength=0) - { - global $user, $conf, $langs; - global $bc; - global $sortfield, $sortorder; - - // Affiche liste des documents existant - if (empty($useinecm)) print_titre($langs->trans("AttachedFiles")); - else { $bc[true]=''; $bc[false]=''; }; - $url=$_SERVER["PHP_SELF"]; - print ''; - print ''; - print_liste_field_titre($langs->trans("Documents2"),$_SERVER["PHP_SELF"],"name","",$param,'align="left"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Size"),$_SERVER["PHP_SELF"],"size","",$param,'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"date","",$param,'align="center"',$sortfield,$sortorder); - print_liste_field_titre('','',''); - print ''; - - $var=true; - foreach($filearray as $key => $file) - { - if (!is_dir($dir.$file['name']) - && $file['name'] != '.' - && $file['name'] != '..' - && $file['name'] != 'CVS' - && ! preg_match('/\.meta$/i',$file['name'])) - { - // Define relative path used to store the file - if (! $relativepath) $relativepath=dol_sanitizeFileName($object->ref).'/'; - - $var=!$var; - print "\n"; - print ''; - print ''; - print '\n"; - } - } - if (sizeof($filearray) == 0) - { - print ''; - } - print "
"; - //print "XX".$file['name']; //$file['name'] must be utf8 - print ''; - print img_mime($file['name'],$file['name'].' ('.dol_print_size($file['size'],0,0).')').' '; - print dol_trunc($file['name'],$maxlength,'middle'); - print ''; - print "'.dol_print_size($file['size'],1,1).''.dol_print_date($file['date'],"dayhour").''; - //print ' '; - if ($permtodelete) - print ''.img_delete().''; - else - print ' '; - print "
'; - if (empty($textifempty)) print $langs->trans("NoFileFound"); - else print $textifempty; - print '
"; - // Fin de zone - - } - -} - -?> diff --git a/htdocs/html.formmail.class.php b/htdocs/html.formmail.class.php deleted file mode 100644 index 14ade64a27a..00000000000 --- a/htdocs/html.formmail.class.php +++ /dev/null @@ -1,577 +0,0 @@ - - * - * 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 - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -/** - * \file htdocs/html.formmail.class.php - * \brief Fichier de la classe permettant la generation du formulaire html d'envoi de mail unitaire - * \version $Id$ - */ - -require_once(DOL_DOCUMENT_ROOT ."/core/class/html.form.class.php"); - - -/** \class FormMail - * \brief Classe permettant la generation du formulaire html d'envoi de mail unitaire - * \remarks Utilisation: $formail = new FormMail($db) - * \remarks $formmail->proprietes=1 ou chaine ou tableau de valeurs - * \remarks $formmail->show_form() affiche le formulaire - */ -class FormMail -{ - var $db; - - var $fromname; - var $frommail; - var $replytoname; - var $replytomail; - var $toname; - var $tomail; - - var $withsubstit; // Show substitution array - var $withfrom; - var $withto; - var $withtocc; - var $withtopic; - var $withfile; // 0=No attaches files, 1=Show attached files, 2=Can add new attached files - var $withbody; - - var $withfromreadonly; - var $withreplytoreadonly; - var $withtoreadonly; - var $withtoccreadonly; - var $withtopicreadonly; - var $withdeliveryreceipt; - var $withcancel; - - var $substit=array(); - var $param=array(); - - var $error; - - - /** - * \brief Constructeur - * \param DB handler d'acces base de donnee - */ - function FormMail($DB) - { - $this->db = $DB; - - $this->withfrom=1; - $this->withto=1; - $this->withtocc=1; - $this->withtoccc=0; - $this->witherrorsto=0; - $this->withtopic=1; - $this->withfile=0; - $this->withbody=1; - - $this->withfromreadonly=1; - $this->withreplytoreadonly=1; - $this->withtoreadonly=0; - $this->withtoccreadonly=0; - $this->witherrorstoreadonly=0; - $this->withtopicreadonly=0; - $this->withbodyreadonly=0; - $this->withdeliveryreceiptreadonly=0; - - return 1; - } - - /** - * Clear list of attached files in send mail form (stored in session) - */ - function clear_attached_files() - { - global $conf,$user; - - // Set tmp user directory - $vardir=$conf->user->dir_output."/".$user->id; - $upload_dir = $vardir.'/temp/'; - if (is_dir($upload_dir)) dol_delete_dir_recursive($upload_dir); - - unset($_SESSION["listofpaths"]); - unset($_SESSION["listofnames"]); - unset($_SESSION["listofmimes"]); - } - - /** - * Add a file into the list of attached files (stored in SECTION array) - * - * @param unknown_type $path - * @param unknown_type $file - * @param unknown_type $type - */ - function add_attached_files($path,$file,$type) - { - $listofpaths=array(); - $listofnames=array(); - $listofmimes=array(); - if (! empty($_SESSION["listofpaths"])) $listofpaths=explode(';',$_SESSION["listofpaths"]); - if (! empty($_SESSION["listofnames"])) $listofnames=explode(';',$_SESSION["listofnames"]); - if (! empty($_SESSION["listofmimes"])) $listofmimes=explode(';',$_SESSION["listofmimes"]); - if (! in_array($file,$listofnames)) - { - $listofpaths[]=$path; - $listofnames[]=$file; - $listofmimes[]=$type; - $_SESSION["listofpaths"]=join(';',$listofpaths); - $_SESSION["listofnames"]=join(';',$listofnames); - $_SESSION["listofmimes"]=join(';',$listofmimes); - } - } - - /** - * Remove a file from the list of attached files (stored in SECTION array) - * - * @param unknown_type $file - */ - function remove_attached_files($keytodelete) - { - $listofpaths=array(); - $listofnames=array(); - $listofmimes=array(); - if (! empty($_SESSION["listofpaths"])) $listofpaths=explode(';',$_SESSION["listofpaths"]); - if (! empty($_SESSION["listofnames"])) $listofnames=explode(';',$_SESSION["listofnames"]); - if (! empty($_SESSION["listofmimes"])) $listofmimes=explode(';',$_SESSION["listofmimes"]); - if ($keytodelete >= 0) - { - unset ($listofpaths[$keytodelete]); - unset ($listofnames[$keytodelete]); - unset ($listofmimes[$keytodelete]); - $_SESSION["listofpaths"]=join(';',$listofpaths); - $_SESSION["listofnames"]=join(';',$listofnames); - $_SESSION["listofmimes"]=join(';',$listofmimes); - //var_dump($_SESSION['listofpaths']); - } - } - - /** - * Return list of attached files (stored in SECTION array) - * - * @return unknown_type $type - */ - function get_attached_files() - { - $listofpaths=array(); - $listofnames=array(); - $listofmimes=array(); - if (! empty($_SESSION["listofpaths"])) $listofpaths=explode(';',$_SESSION["listofpaths"]); - if (! empty($_SESSION["listofnames"])) $listofnames=explode(';',$_SESSION["listofnames"]); - if (! empty($_SESSION["listofmimes"])) $listofmimes=explode(';',$_SESSION["listofmimes"]); - return array('paths'=>$listofpaths, 'names'=>$listofnames, 'mimes'=>$listofmimes); - } - - /** - * \brief Show the form to input an email - * \param addfileaction Name of action when posting file attachments - * \param removefileaction Name of action when removing file attachments - * \remarks this->withfile: 0=No attaches files, 1=Show attached files, 2=Can add new attached files - */ - function show_form($addfileaction='addfile',$removefileaction='removefile') - { - global $conf, $langs, $user; - - $langs->load("other"); - $langs->load("mails"); - - // Define list of attached files - $listofpaths=array(); - $listofnames=array(); - $listofmimes=array(); - if (! empty($_SESSION["listofpaths"])) $listofpaths=explode(';',$_SESSION["listofpaths"]); - if (! empty($_SESSION["listofnames"])) $listofnames=explode(';',$_SESSION["listofnames"]); - if (! empty($_SESSION["listofmimes"])) $listofmimes=explode(';',$_SESSION["listofmimes"]); - - - $form=new Form($DB); - - print "\n\n"; - print "
param["returnurl"]."\">\n"; - print ''; - foreach ($this->param as $key=>$value) - { - print "\n"; - } - print "\n"; - - // Substitution array - if ($this->withsubstit) - { - print "\n"; - } - - // From - if ($this->withfrom) - { - if ($this->withfromreadonly) - { - print ''; - print ''; - print "\n"; - print "\n"; - } - else - { - print "\n"; - } - } - - // Replyto - if ($this->withreplyto) - { - if ($this->withreplytoreadonly) - { - print ''; - print ''; - print "\n"; - } - } - - // Errorsto - if ($this->witherrorsto) - { - //if (! $this->errorstomail) $this->errorstomail=$this->frommail; - if ($this->witherrorstoreadonly) - { - print ''; - print "\n"; - } - else - { - print "\n"; - } - } - - // To - if ($this->withto || is_array($this->withto)) - { - print '\n"; - } - - // CC - if ($this->withtocc || is_array($this->withtocc)) - { - print '\n"; - } - - // CCC - if ($this->withtoccc || is_array($this->withtoccc)) - { - print '\n"; - } - - // Ask delivery receipt - if ($this->withdeliveryreceipt) - { - print '\n"; - } - - // Topic - if ($this->withtopic) - { - $this->withtopic=make_substitutions($this->withtopic,$this->substit,$langs); - - print ""; - print ""; - print "\n"; - } - - // Attached files - if ($this->withfile) - { - print ""; - print '"; - print "\n"; - } - - // Message - if ($this->withbody) - { - $defaultmessage=""; - - // TODO A partir du type, proposer liste de messages dans table llx_models - if ($this->param["models"]=='body') { $defaultmessage=$this->withbody; } - if ($this->param["models"]=='facture_send') { $defaultmessage=$langs->transnoentities("PredefinedMailContentSendInvoice"); } - if ($this->param["models"]=='facture_relance') { $defaultmessage=$langs->transnoentities("PredefinedMailContentSendInvoiceReminder"); } - if ($this->param["models"]=='propal_send') { $defaultmessage=$langs->transnoentities("PredefinedMailContentSendProposal"); } - if ($this->param["models"]=='order_send') { $defaultmessage=$langs->transnoentities("PredefinedMailContentSendOrder"); } - - $defaultmessage=make_substitutions($defaultmessage,$this->substit,$langs); - if (isset($_POST["message"])) $defaultmessage=$_POST["message"]; - $defaultmessage=str_replace('\n',"\n",$defaultmessage); - - print ""; - print ""; - print "\n"; - } - - print "\n"; - print "
"; - $help=""; - foreach($this->substit as $key => $val) - { - $help.=$key.' -> '.$langs->trans($val).'
'; - } - print $form->textwithpicto($langs->trans("EMailTestSubstitutionReplacedByGenericValues"),$help); - print "
".$langs->trans("MailFrom").""; - if ($this->fromtype == 'user') - { - $langs->load("users"); - $fuser=new User($this->db); - $fuser->fetch($this->fromid); - print $fuser->getNomUrl(1); - } - else - { - print $this->fromname; - } - if ($this->frommail) - { - print " <".$this->frommail.">"; - } - else - { - if ($this->fromtype) - { - $langs->load("errors"); - print ' <'.$langs->trans("ErrorNoMailDefinedForThisUser").'> '; - } - } - print "
".$langs->trans("MailFrom").""; - print $langs->trans("Name").':'; - print '    '; - print $langs->trans("EMail").':<>'; - print "
".$langs->trans("MailReply")."".$this->replytoname.($this->replytomail?(" <".$this->replytomail.">"):""); - print "
".$langs->trans("MailErrorsTo").""; - print $this->errorstomail; - print "
".$langs->trans("MailErrorsTo").""; - print "errorstomail."\">"; - print "
'; - print $form->textwithpicto($langs->trans("MailTo"),$langs->trans("YouCanUseCommaSeparatorForSeveralRecipients")); - print ''; - if ($this->withtoreadonly) - { - print (! is_array($this->withto) && ! is_numeric($this->withto))?$this->withto:""; - } - else - { - print "withto)?"30":"60")."\" name=\"sendto\" value=\"".(! is_array($this->withto) && ! is_numeric($this->withto)? (isset($_REQUEST["sendto"])?$_REQUEST["sendto"]:$this->withto) :"")."\">"; - if ($this->withtosocid > 0) - { - $liste=array(); - $liste[0]=' '; - $soc=new Societe($this->db); - $soc->fetch($this->withtosocid); - foreach ($soc->thirdparty_and_contact_email_array() as $key=>$value) - { - $liste[$key]=$value; - } - print " ".$langs->trans("or")." "; - //var_dump($_REQUEST);exit; - print $form->selectarray("receiver", $liste, isset($_REQUEST["receiver"])?$_REQUEST["receiver"]:0); - } - } - print "
'; - print $form->textwithpicto($langs->trans("MailCC"),$langs->trans("YouCanUseCommaSeparatorForSeveralRecipients")); - print ''; - if ($this->withtoccreadonly) - { - print (! is_array($this->withtocc) && ! is_numeric($this->withtocc))?$this->withtocc:""; - } - else - { - print "withtocc)?"30":"60")."\" name=\"sendtocc\" value=\"".((! is_array($this->withtocc) && ! is_numeric($this->withtocc))? (isset($_POST["sendtocc"])?$_POST["sendtocc"]:$this->withtocc) : (isset($_POST["sendtocc"])?$_POST["sendtocc"]:"") )."\">"; - if ($this->withtoccsocid > 0) - { - $liste=array(); - $liste[0]=' '; - $soc=new Societe($this->db); - $soc->fetch($this->withtoccsocid); - foreach ($soc->thirdparty_and_contact_email_array() as $key=>$value) - { - $liste[$key]=$value; - } - print " ".$langs->trans("or")." "; - $form->select_array("receivercc", $liste, isset($_REQUEST["receivercc"])?$_REQUEST["receivercc"]:0); - } - } - print "
'; - print $form->textwithpicto($langs->trans("MailCCC"),$langs->trans("YouCanUseCommaSeparatorForSeveralRecipients")); - print ''; - if ($this->withtocccreadonly) - { - print (! is_array($this->withtoccc) && ! is_numeric($this->withtoccc))?$this->withtoccc:""; - } - else - { - print "withtoccc)?"30":"60")."\" name=\"sendtoccc\" value=\"".((! is_array($this->withtoccc) && ! is_numeric($this->withtoccc))? (isset($_POST["sendtoccc"])?$_POST["sendtoccc"]:$this->withtoccc) : (isset($_POST["sendtoccc"])?$_POST["sendtoccc"]:"") )."\">"; - if ($this->withtocccsocid > 0) - { - $liste=array(); - $liste[0]=' '; - $soc=new Societe($this->db); - $soc->fetch($this->withtosocid); - foreach ($soc->thirdparty_and_contact_email_array() as $key=>$value) - { - $liste[$key]=$value; - } - print " ".$langs->trans("or")." "; - $form->select_array("receiverccc", $liste, isset($_REQUEST["receiverccc"])?$_REQUEST["receiverccc"]:0); - } - } - print "
'.$langs->trans("DeliveryReceipt").''; - - if ($this->withdeliveryreceiptreadonly) - { - print yn($this->withdeliveryreceipt); - } - else - { - print $form->selectyesno('deliveryreceipt', (isset($_POST["deliveryreceipt"])?$_POST["deliveryreceipt"]:0) ,1); - } - - print "
".$langs->trans("MailTopic").""; - if ($this->withtopicreadonly) - { - print $this->withtopic; - print "withtopic."\">"; - } - else - { - print "withtopic) ."\">"; - } - print "
'.$langs->trans("MailFile").""; - //print '
'; - if (sizeof($listofpaths)) - { - foreach($listofpaths as $key => $val) - { - print img_mime($listofnames[$key]).' '.$listofnames[$key]; - print ' '; - print '
'; - } - } - else - { - print $langs->trans("NoAttachedFiles").'
'; - } - if ($this->withfile == 2) // Can add other files - { - //print '
'; - print ''; - print ' '; - print ''; - //print '
'; - } - print "
".$langs->trans("MailText").""; - if ($this->withbodyreadonly) - { - print nl2br($defaultmessage); - print ''; - } - else - { - if ($this->withfckeditor) - { - // Editeur wysiwyg - require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php"); - $doleditor=new DolEditor('message',$defaultmessage,280,'dolibarr_notes','In',true); - $doleditor->Create(); - } - else - { - print ''; - } - - } - print "
"; - print "trans("SendMail")."\""; - // Add a javascript test to avoid to forget to submit file before sending email - if ($this->withfile == 2 && $conf->use_javascript_ajax) - { - print ' onClick="if (document.mailform.addedfile.value != \'\') { alert(\''.dol_escape_js($langs->trans("FileWasNotUploaded")).'\'); return false; } else { return true; }"'; - } - print ">"; - if ($this->withcancel) - { - print "     "; - print "trans("Cancel")."\">"; - } - print "
\n"; - - print "
\n"; - print "\n"; - } - - - /** - * \brief Affiche la partie de formulaire pour saisie d'un mail - * \param withtopic 1 pour proposer a la saisie le sujet - * \param withbody 1 pour proposer a la saisie le corps du message - * \param withfile 1 pour proposer a la saisie l'ajout d'un fichier joint - * \todo Fonction a virer quand fichier /comm/mailing.php vire (= quand ecran dans /comm/mailing prets) - */ - function mail_topicmessagefile($withtopic=1,$withbody=1,$withfile=1,$defaultbody) - { - global $langs; - - $langs->load("other"); - - print ""; - - // Topic - if ($withtopic) - { - print ""; - print ""; - print ""; - } - - // Message - if ($withbody) - { - print ""; - print ""; - print ""; - } - - // Si fichier joint - if ($withfile) - { - print ""; - print ""; - print ""; - } - - print "
".$langs->trans("MailTopic").""; - print ""; - print "
".$langs->trans("MailText").""; - print ""; - print "
".$langs->trans("MailFile").""; - print "trans("Upload")."\"/>"; - print "
"; - } - -} - -?> diff --git a/htdocs/html.formorder.class.php b/htdocs/html.formorder.class.php deleted file mode 100644 index 5c1fb4c0469..00000000000 --- a/htdocs/html.formorder.class.php +++ /dev/null @@ -1,117 +0,0 @@ - - * - * 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 - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -/** - * \file htdocs/html.formorder.class.php - * \brief File of predefined functions for HTML forms for order module - * \version $Id$ - */ - - -/** - * \class FormOrder - * \brief Classe permettant la generation de composants html - * \remarks Only common components must be here. - */ -class FormOrder -{ - var $db; - var $error; - - - - /** - * \brief Constructeur - * \param DB handler d'acces base de donnee - */ - function FormOrder($DB) - { - $this->db = $DB; - - return 1; - } - - - /** - * \brief Renvoie la liste des sources de commandes - * \param selected Id de la source pre-selectionnee - * \param htmlname Nom de la liste deroulante - * \param addempty 0=liste sans valeur nulle, 1=ajoute valeur inconnue - * \return array Tableau des sources de commandes - */ - function selectSourcesCommande($selected='',$htmlname='source_id',$addempty=0) - { - global $conf,$langs; - print ''; - } - - - /** - * - * - */ - function select_methodes_commande($selected='',$htmlname='source_id',$addempty=0) - { - global $conf,$langs; - $listemethodes=array(); - - require_once(DOL_DOCUMENT_ROOT."/core/class/html.form.class.php"); - $form=new Form($this->db); - - $sql = "SELECT rowid, libelle "; - $sql.= " FROM ".MAIN_DB_PREFIX."c_methode_commande_fournisseur"; - $sql.= " WHERE active = 1"; - - dol_syslog("Form::select_methodes_commande sql=".$sql); - $resql=$this->db->query($sql); - if ($resql) - { - $i = 0; - $num = $this->db->num_rows($resql); - while ($i < $num) - { - $obj = $this->db->fetch_object($resql); - $listemethodes[$obj->rowid] = $obj->libelle; - $i++; - } - } - else - { - dol_print_error($this->db); - return -1; - } - - print $form->select_array($htmlname,$listemethodes,$selected,$addempty); - return 1; - } - -} - -?> diff --git a/htdocs/html.formother.class.php b/htdocs/html.formother.class.php deleted file mode 100644 index 1b5837e5e6e..00000000000 --- a/htdocs/html.formother.class.php +++ /dev/null @@ -1,493 +0,0 @@ - - * Copyright (C) 2004-2009 Laurent Destailleur - * Copyright (C) 2004 Benoit Mortier - * Copyright (C) 2004 Sebastien Di Cintio - * Copyright (C) 2004 Eric Seigne - * Copyright (C) 2005-2010 Regis Houssin - * Copyright (C) 2006 Andre Cianfarani - * Copyright (C) 2006 Marc Barilley/Ocebo - * Copyright (C) 2007 Franky Van Liedekerke - * Copyright (C) 2007 Patrick Raguin - * - * 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 - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -/** - * \file htdocs/html.formother.class.php - * \brief Fichier de la classe des fonctions predefinie de composants html autre - * \version $Id$ - */ - - -/** - * \class FormOther - * \brief Classe permettant la generation de composants html autre - * \remarks Only common components must be here. - */ -class FormOther -{ - var $db; - var $error; - - - /** - * \brief Constructeur - * \param DB handler d'acces base de donnee - */ - function FormOther($DB) - { - $this->db = $DB; - - return 1; - } - - - /** - * \brief Retourne la liste des modeles d'export - * \param selected Id modele pre-selectionne - * \param htmlname Nom de la zone select - * \param type Type des modeles recherches - * \param useempty Affiche valeur vide dans liste - */ - function select_export_model($selected='',$htmlname='exportmodelid',$type='',$useempty=0) - { - $sql = "SELECT rowid, label"; - $sql.= " FROM ".MAIN_DB_PREFIX."export_model"; - $sql.= " WHERE type = '".$type."'"; - $sql.= " ORDER BY rowid"; - $result = $this->db->query($sql); - if ($result) - { - print '"; - } - else { - dol_print_error($this->db); - } - } - - - /** - * \brief Retourne la liste des modeles d'import - * \param selected Id modele pre-selectionne - * \param htmlname Nom de la zone select - * \param type Type des modeles recherches - * \param useempty Affiche valeur vide dans liste - */ - function select_import_model($selected='',$htmlname='importmodelid',$type='',$useempty=0) - { - $sql = "SELECT rowid, label"; - $sql.= " FROM ".MAIN_DB_PREFIX."import_model"; - $sql.= " WHERE type = '".$type."'"; - $sql.= " ORDER BY rowid"; - $result = $this->db->query($sql); - if ($result) - { - print '"; - } - else { - dol_print_error($this->db); - } - } - - - /** - * \brief Retourne la liste des ecotaxes avec tooltip sur le libelle - * \param selected code ecotaxes pre-selectionne - * \param htmlname nom de la liste deroulante - */ - function select_ecotaxes($selected='',$htmlname='ecotaxe_id') - { - global $langs; - - $sql = "SELECT e.rowid, e.code, e.libelle, e.price, e.organization,"; - $sql.= " p.libelle as pays"; - $sql.= " FROM ".MAIN_DB_PREFIX."c_ecotaxe as e,".MAIN_DB_PREFIX."c_pays as p"; - $sql.= " WHERE e.active = 1 AND e.fk_pays = p.rowid"; - $sql.= " ORDER BY pays, e.organization ASC, e.code ASC"; - - if ($this->db->query($sql)) - { - print ''; - return 0; - } - else - { - dol_print_error($this->db); - return 1; - } - } - - /** - * \brief Retourne une liste de pourcentage - * \param selected pourcentage pre-selectionne - * \param htmlname nom de la liste deroulante - * \param increment increment value - * \param start start value - * \param end end value - * \return return combo - */ - function select_percent($selected=0,$htmlname='percent',$disabled=0,$increment=5,$start=0,$end=100) - { - $return = ''; - - return $return; - } - - /** - * \brief Return select list for categories (to use in form search selectors) - * \param type Type of categories (0=product, 1=suppliers, 2=customers, 3=members) - * \param selected Preselected value - * \param htmlname Name of combo list - * \return return Html combo list code - */ - function select_categories($type,$selected=0,$htmlname='search_categ') - { - global $langs; - require_once(DOL_DOCUMENT_ROOT."/categories/class/categorie.class.php"); - - // Load list of "categories" - $static_categs = new Categorie($this->db); - $tab_categs = $static_categs->get_full_arbo($type); - - // Print a select with each of them - $moreforfilter =''; - - return $moreforfilter; - } - - - /** - * \brief Return select list for categories (to use in form search selectors) - * \param selected Preselected value - * \param htmlname Name of combo list - * \return return Html combo list code - */ - function select_salesrepresentatives($selected=0,$htmlname='search_sale') - { - global $conf; - - // Select each sales and print them in a select input - $moreforfilter =''; - - return $moreforfilter; - } - - /** - * \brief Retourn list of project and tasks - * \param selected Pre-selected value - * \param projectid Project id - * \param htmlname Name of html select - * \param modeproject 1 to restrict on projects owned by user - * \param modetask 1 to restrict on tasks associated to user - * \param mode 0=Return list of tasks and their projects, 1=Return projects and tasks if exists - */ - function selectProjectTasks($selected='', $projectid=0, $htmlname='task_parent', $modeproject=0, $modetask=0, $mode=0, $useempty=0) - { - global $user, $langs; - - require_once(DOL_DOCUMENT_ROOT."/projet/class/task.class.php"); - - //print $modeproject.'-'.$modetask; - $task=new Task($this->db); - $tasksarray=$task->getTasksArray($modetask?$user:0, $modeproject?$user:0, $projectid, 0, $mode); - if ($tasksarray) - { - print ''; - } - else - { - print '
'.$langs->trans("NoProject").'
'; - } - } - - - /** - * Affiche zone de selection de couleur - * @param set_color Couleur de pre-selection - * @param prefix Prefix pour nom champ - * @param form_name Nom du formulaire de provenance. - */ - function select_color($set_color='', $prefix='f_color', $form_name='objForm') - { - print "\n".'
'; - print ''."\n"; - print ''."\n"; - print ''."\n"; - print ''; - print ''."\n"; - print '
'; - } - - /** - * Creation d'un icone de couleur - * @param color Couleur de l'image - * @param module Nom du module - * @param name Nom de l'image - * @param x Largeur de l'image en pixels - * @param y Hauteur de l'image en pixels - */ - function CreateColorIcon($color,$module,$name,$x='12',$y='12') - { - global $conf; - - $file = $conf->$module->dir_temp.'/'.$name.'.png'; - - // On cree le repertoire contenant les icones - if (! file_exists($conf->$module->dir_temp)) - { - create_exdir($conf->$module->dir_temp); - } - - // On cree l'image en vraies couleurs - $image = imagecreatetruecolor($x,$y); - - $color = substr($color,1,6); - - $rouge = hexdec(substr($color,0,2)); //conversion du canal rouge - $vert = hexdec(substr($color,2,2)); //conversion du canal vert - $bleu = hexdec(substr($color,4,2)); //conversion du canal bleu - - $couleur = imagecolorallocate($image,$rouge,$vert,$bleu); - //print $rouge.$vert.$bleu; - imagefill($image,0,0,$couleur); //on remplit l'image - // On cree la couleur et on l'attribue a une variable pour ne pas la perdre - ImagePng($image,$file); //renvoie une image sous format png - ImageDestroy($image); - } - -} - - -/** - * Write all lines of a project (if parent = 0) - * - * @param unknown_type $inc - * @param unknown_type $parent - * @param unknown_type $lines - * @param unknown_type $level - */ -function PLineSelect(&$inc, $parent, $lines, $level=0, $selected=0) -{ - global $langs, $user, $conf; - - $lastprojectid=0; - - for ($i = 0 ; $i < sizeof($lines) ; $i++) - { - if ($lines[$i]->fk_parent == $parent) - { - $var = !$var; - - // Break on a new project - if ($parent == 0) - { - if ($lines[$i]->fk_project != $lastprojectid) - { - if ($i > 0 && $conf->browser->firefox) print ''; - print '\n"; - - $lastprojectid=$lines[$i]->fk_project; - $inc++; - } - } - - // Print task - if ($lines[$i]->id > 0) - { - print '\n"; - $inc++; - } - - $level++; - if ($lines[$i]->id) PLineSelect($inc, $lines[$i]->id, $lines, $level, $selected); - $level--; - } - } -} - -?> diff --git a/htdocs/soc.php b/htdocs/soc.php index 90e26ce2370..4d3282a72c7 100644 --- a/htdocs/soc.php +++ b/htdocs/soc.php @@ -32,8 +32,8 @@ require("./main.inc.php"); require_once(DOL_DOCUMENT_ROOT."/lib/company.lib.php"); require_once(DOL_DOCUMENT_ROOT."/core/class/html.formadmin.class.php"); -require_once(DOL_DOCUMENT_ROOT."/html.formcompany.class.php"); -require_once(DOL_DOCUMENT_ROOT."/html.formfile.class.php"); +require_once(DOL_DOCUMENT_ROOT."/core/class/html.formcompany.class.php"); +require_once(DOL_DOCUMENT_ROOT."/core/class/html.formfile.class.php"); require_once(DOL_DOCUMENT_ROOT."/contact/class/contact.class.php"); if ($conf->adherent->enabled) require_once(DOL_DOCUMENT_ROOT."/adherents/class/adherent.class.php");