according to new tree directory

This commit is contained in:
Philippe Grand 2010-05-03 08:22:35 +00:00
parent 32025de202
commit 7f13eb0d4e
23 changed files with 21 additions and 4142 deletions

View File

@ -35,7 +35,7 @@ require_once(DOL_DOCUMENT_ROOT."/adherents/class/adherent_type.class.php");
require_once(DOL_DOCUMENT_ROOT."/adherents/class/adherent_options.class.php");
require_once(DOL_DOCUMENT_ROOT."/adherents/class/cotisation.class.php");
require_once(DOL_DOCUMENT_ROOT."/compta/bank/class/account.class.php");
require_once(DOL_DOCUMENT_ROOT."/html.formcompany.class.php");
require_once(DOL_DOCUMENT_ROOT."/core/class/html.formcompany.class.php");
$langs->load("companies");
$langs->load("bills");

View File

@ -30,7 +30,7 @@ require_once(DOL_DOCUMENT_ROOT."/lib/admin.lib.php");
require_once(DOL_DOCUMENT_ROOT."/lib/company.lib.php");
require_once(DOL_DOCUMENT_ROOT."/lib/images.lib.php");
require_once(DOL_DOCUMENT_ROOT."/lib/functions2.lib.php");
require_once(DOL_DOCUMENT_ROOT."/html.formcompany.class.php");
require_once(DOL_DOCUMENT_ROOT."/core/class/html.formcompany.class.php");
$langs->load("admin");
$langs->load("companies");

View File

@ -28,8 +28,8 @@
*/
require("../main.inc.php");
require_once(DOL_DOCUMENT_ROOT."/html.formadmin.class.php");
require_once(DOL_DOCUMENT_ROOT."/html.formcompany.class.php");
require_once(DOL_DOCUMENT_ROOT."/core/class/html.formadmin.class.php");
require_once(DOL_DOCUMENT_ROOT."/core/class/html.formcompany.class.php");
$langs->load("other");
$langs->load("admin");

View File

@ -28,7 +28,7 @@ require("../main.inc.php");
require_once(DOL_DOCUMENT_ROOT."/lib/usergroups.lib.php");
require_once(DOL_DOCUMENT_ROOT."/lib/admin.lib.php");
require_once(DOL_DOCUMENT_ROOT."/lib/functions2.lib.php");
require_once(DOL_DOCUMENT_ROOT."/html.formadmin.class.php");
require_once(DOL_DOCUMENT_ROOT."/core/class/html.formadmin.class.php");
$langs->load("admin");
$langs->load("languages");

View File

@ -27,7 +27,7 @@
require("../main.inc.php");
require_once(DOL_DOCUMENT_ROOT."/lib/admin.lib.php");
require_once(DOL_DOCUMENT_ROOT."/html.formadmin.class.php");
require_once(DOL_DOCUMENT_ROOT."/core/class/html.formadmin.class.php");
require_once(DOL_DOCUMENT_ROOT."/lib/admin.lib.php");

View File

@ -25,7 +25,7 @@
*/
require("../../main.inc.php");
require_once(DOL_DOCUMENT_ROOT."/html.formadmin.class.php");
require_once(DOL_DOCUMENT_ROOT."/core/class/html.formadmin.class.php");
require_once(DOL_DOCUMENT_ROOT."/core/class/menubase.class.php");

View File

@ -26,7 +26,7 @@
*/
require("../../main.inc.php");
require_once(DOL_DOCUMENT_ROOT."/html.formadmin.class.php");
require_once(DOL_DOCUMENT_ROOT."/core/class/html.formadmin.class.php");
require_once(DOL_DOCUMENT_ROOT."/lib/treeview.lib.php");
$langs->load("other");

View File

@ -27,7 +27,7 @@
require("../main.inc.php");
require_once(DOL_DOCUMENT_ROOT."/lib/admin.lib.php");
require_once(DOL_DOCUMENT_ROOT."/html.formadmin.class.php");
require_once(DOL_DOCUMENT_ROOT."/core/class/html.formadmin.class.php");
if (!$user->admin)
accessforbidden();

View File

@ -28,7 +28,7 @@ require("../../main.inc.php");
require_once(DOL_DOCUMENT_ROOT."/comm/propal/class/propal.class.php");
require_once(DOL_DOCUMENT_ROOT."/contact/class/contact.class.php");
require_once(DOL_DOCUMENT_ROOT."/lib/propal.lib.php");
require_once(DOL_DOCUMENT_ROOT.'/html.formcompany.class.php');
require_once(DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php');
$langs->load("facture");
$langs->load("orders");

View File

@ -28,7 +28,7 @@
require_once("../../main.inc.php");
require_once(DOL_DOCUMENT_ROOT."/lib/company.lib.php");
require_once(DOL_DOCUMENT_ROOT."/comm/prospect/prospect.class.php");
require_once(DOL_DOCUMENT_ROOT."/html.formcompany.class.php");
require_once(DOL_DOCUMENT_ROOT."/core/class/html.formcompany.class.php");
require_once(DOL_DOCUMENT_ROOT."/contact/class/contact.class.php");
require_once(DOL_DOCUMENT_ROOT."/comm/action/actioncomm.class.php");
if ($conf->propal->enabled) require_once(DOL_DOCUMENT_ROOT."/comm/propal/class/propal.class.php");

View File

@ -29,7 +29,7 @@ require("../main.inc.php");
require_once(DOL_DOCUMENT_ROOT."/commande/class/commande.class.php");
require_once(DOL_DOCUMENT_ROOT."/contact/class/contact.class.php");
require_once(DOL_DOCUMENT_ROOT."/lib/order.lib.php");
require_once(DOL_DOCUMENT_ROOT.'/html.formcompany.class.php');
require_once(DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php');
$langs->load("facture");
$langs->load("orders");

View File

@ -29,7 +29,7 @@ require_once(DOL_DOCUMENT_ROOT."/compta/facture/class/facture.class.php");
require_once(DOL_DOCUMENT_ROOT."/contact/class/contact.class.php");
require_once(DOL_DOCUMENT_ROOT.'/core/class/discount.class.php');
require_once(DOL_DOCUMENT_ROOT.'/lib/invoice.lib.php');
require_once(DOL_DOCUMENT_ROOT.'/html.formcompany.class.php');
require_once(DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php');
$langs->load("bills");
$langs->load("companies");

View File

@ -32,7 +32,7 @@ require_once(DOL_DOCUMENT_ROOT."/comm/action/actioncomm.class.php");
require_once(DOL_DOCUMENT_ROOT."/contact/class/contact.class.php");
require_once(DOL_DOCUMENT_ROOT."/lib/contact.lib.php");
require_once(DOL_DOCUMENT_ROOT."/lib/company.lib.php");
require_once(DOL_DOCUMENT_ROOT."/html.formcompany.class.php");
require_once(DOL_DOCUMENT_ROOT."/core/class/html.formcompany.class.php");
$langs->load("companies");
$langs->load("users");

View File

@ -28,7 +28,7 @@ require ("../main.inc.php");
require_once(DOL_DOCUMENT_ROOT.'/lib/contract.lib.php');
require_once(DOL_DOCUMENT_ROOT."/contrat/class/contrat.class.php");
require_once(DOL_DOCUMENT_ROOT."/contact/class/contact.class.php");
require_once(DOL_DOCUMENT_ROOT.'/html.formcompany.class.php');
require_once(DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php');
$langs->load("contracts");

File diff suppressed because it is too large Load Diff

View File

@ -1,177 +0,0 @@
<?php
/* Copyright (c) 2008 Laurent Destailleur <eldy@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* 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.formactions.class.php
\brief Fichier de la classe des fonctions predefinie de composants html actions
\version $Id$
*/
/**
\class FormActions
\brief Classe permettant la g<EFBFBD>n<EFBFBD>ration de composants html actions
*/
class FormActions
{
var $db;
var $error;
/**
* \brief Constructeur
* \param DB handler d'acc<EFBFBD>s base de donn<EFBFBD>e
*/
function FormActions($DB)
{
$this->db = $DB;
return 1;
}
/**
* \brief Show list of action status
* \param formname Name of form where select in included
* \param selected Preselected value
* \param canedit 1=can edit, 0=read only
*/
function form_select_status_action($formname,$selected,$canedit=1)
{
global $langs,$conf;
$listofstatus=array('0'=>$langs->trans("ActionRunningNotStarted"),'50'=>$langs->trans("ActionRunningShort"),'100'=>$langs->trans("ActionDoneShort"));
if ($conf->use_javascript_ajax)
{
print "\n";
print '<script type="text/javascript">'."\n";
print 'function select_status(mypercentage) {'."\n";
print 'document.'.$formname.'.percentageshown.value=mypercentage;'."\n";
print 'document.'.$formname.'.percentage.value=mypercentage;'."\n";
print 'if (mypercentage == 0) { document.'.$formname.'.percentageshown.disabled=true; }'."\n";
print 'else if (mypercentage == 100) { document.'.$formname.'.percentageshown.disabled=true; }'."\n";
print 'else { document.'.$formname.'.percentageshown.disabled=false; }'."\n";
print '}'."\n";
print '</script>'."\n";
print '<select '.($canedit?'':'disabled="true" ').'name="status" class="flat" onChange="select_status(document.'.$formname.'.status.value)">';
foreach($listofstatus as $key => $val)
{
print '<option value="'.$key.'"'.($selected == $key?' selected="true"':'').'>'.$val.'</option>';
}
print '</select>';
if ($selected == 0 || $selected == 100) $canedit=0;
print ' <input type="text" name="percentageshown" class="flat" value="'.$selected.'" size="2"'.($canedit?'':' disabled="true"').' onChange="select_status(document.'.$formname.'.percentageshown.value)">%';
print ' <input type="hidden" name="percentage" value="'.$selected.'">';
}
else
{
print ' <input type="text" name="percentage" class="flat" value="'.$selected.'" size="2"'.($canedit?'':' disabled="true"').'>%';
}
}
/**
* \brief Show list of actions for element
* \param object Object
* \param typeelement 'invoice','propal','order'
* \param socid socid of user
* \return int <0 if KO, >=0 if OK
*/
function showactions($object,$typeelement,$socid=0)
{
global $langs,$conf,$user;
global $bc;
$sql = 'SELECT a.id, a.datep as da, a.label, a.note,';
$sql.= ' u.login';
$sql.= ' FROM '.MAIN_DB_PREFIX.'actioncomm as a, '.MAIN_DB_PREFIX.'user as u';
$sql.= ' WHERE a.fk_user_author = u.rowid';
if ($socid) $sql .= ' AND a.fk_soc = '.$socid;
if ($typeelement == 'invoice') $sql.= ' AND a.fk_facture = '.$object->id;
if ($typeelement == 'propal') $sql.= ' AND a.propalrowid = '.$object->id;
if ($typeelement == 'order') $sql.= ' AND a.fk_commande = '.$object->id;
if ($typeelement == 'project') $sql.= ' AND a.fk_project = '.$object->id;
dol_syslog("FormActions::showactions sql=".$sql);
$resql = $this->db->query($sql);
if ($resql)
{
$num = $this->db->num_rows($resql);
if ($num)
{
if ($typeelement == 'invoice') $title=$langs->trans('ActionsOnBill');
if ($typeelement == 'propal') $title=$langs->trans('ActionsOnPropal');
if ($typeelement == 'order') $title=$langs->trans('ActionsOnOrder');
if ($typeelement == 'project') $title=$langs->trans('ActionsOnProject');
print_titre($title);
$i = 0; $total = 0; $var=true;
print '<table class="border" width="100%">';
print '<tr '.$bc[$var].'><td>'.$langs->trans('Ref').'</td><td>'.$langs->trans('Date').'</td><td>'.$langs->trans('Action').'</td><td>'.$langs->trans('By').'</td></tr>';
print "\n";
while ($i < $num)
{
$objp = $this->db->fetch_object($resql);
$var=!$var;
print '<tr '.$bc[$var].'>';
print '<td><a href="'.DOL_URL_ROOT.'/comm/action/fiche.php?id='.$objp->id.'">'.img_object($langs->trans('ShowTask'),'task').' '.$objp->id.'</a></td>';
print '<td>'.dol_print_date($this->db->jdate($objp->da),'day').'</td>';
print '<td title="'.dol_escape_htmltag($objp->label).'">'.dol_trunc($objp->label,32).'</td>';
print '<td>'.$objp->login.'</td>';
print '</tr>';
$i++;
}
print '</table>';
}
return $num;
}
else
{
dol_print_error($this->db);
return -1;
}
}
/**
* \brief Retourne la liste des types de comptes financiers
* \param selected Type pre-selectionne
* \param htmlname Nom champ formulaire
*/
function select_type_actions($selected='',$htmlname='actioncode')
{
global $langs,$user;
require_once(DOL_DOCUMENT_ROOT."/comm/action/cactioncomm.class.php");
require_once(DOL_DOCUMENT_ROOT."/core/class/html.form.class.php");
$caction=new CActionComm($this->db);
$form=new Form($this->db);
$arraylist=$caction->liste_array(1,'code');
$arraylist[0]='&nbsp;';
asort($arraylist);
$form->select_array($htmlname, $arraylist, $selected);
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1);
}
}

View File

@ -1,293 +0,0 @@
<?php
/* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
*
* 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.formadmin.class.php
* \brief File of class for html functions for admin pages
* \version $Id$
*/
/**
* \class FormAdmin
* \brief Class to generate html code for admin pages
*/
class FormAdmin
{
var $db;
var $error;
/**
* \brief Constructor
* \param DB handler d'acces base de donnee
*/
function FormAdmin($DB)
{
$this->db = $DB;
return 1;
}
/**
* \brief Retourne la liste deroulante des langues disponibles
* \param selected Langue pre-selectionnee
* \param htmlname Nom de la zone select
* \param showauto Affiche choix auto
* \param filter Array of keys to exclude in list
* \param showempty Add empty value
*/
function select_lang($selected='',$htmlname='lang_id',$showauto=0,$filter=0,$showempty=0)
{
global $langs;
$langs_available=$langs->get_available_languages(DOL_DOCUMENT_ROOT,12);
print '<select class="flat" name="'.$htmlname.'">';
if ($showempty)
{
print '<option value=""';
if ($selected == '') print ' selected="true"';
print '>&nbsp;</option>';
}
if ($showauto)
{
print '<option value="auto"';
if ($selected == 'auto') print ' selected="true"';
print '>'.$langs->trans("AutoDetectLang").'</option>';
}
asort($langs_available);
foreach ($langs_available as $key => $value)
{
if ($filter && is_array($filter))
{
if ( ! array_key_exists($key, $filter))
{
print '<option value="'.$key.'">'.$value.'</option>';
}
}
else if ($selected == $key)
{
print '<option value="'.$key.'" selected="true">'.$value.'</option>';
}
else
{
print '<option value="'.$key.'">'.$value.'</option>';
}
$i++;
}
print '</select>';
}
/**
* \brief Retourne la liste deroulante des menus disponibles (eldy_backoffice, ...)
* \param selected Menu pre-selectionnee
* \param htmlname Nom de la zone select
* \param dirmenu Repertoire a scanner
*/
function select_menu($selected='',$htmlname,$dirmenu)
{
global $langs,$conf;
if ($selected == 'eldy.php') $selected='eldy_backoffice.php'; // Pour compatibilite
$menuarray=array();
$handle=opendir($dirmenu);
while (($file = readdir($handle))!==false)
{
if (is_file($dirmenu."/".$file) && substr($file, 0, 1) <> '.' && substr($file, 0, 3) <> 'CVS')
{
if (preg_match('/lib\.php$/i',$file)) continue; // We exclude library files
$filelib=preg_replace('/\.php$/i','',$file);
$prefix='';
if (preg_match('/^eldy/i',$file)) $prefix='0'; // 0=Recommanded, 1=Experimental, 2=Other
else $prefix='2';
if ($file == $selected)
{
$menuarray[$prefix.'_'.$file]='<option value="'.$file.'" selected="true">'.$filelib.'</option>';
}
else
{
$menuarray[$prefix.'_'.$file]='<option value="'.$file.'">'.$filelib.'</option>';
}
}
}
ksort($menuarray);
// Affichage liste deroulante des menus
print '<select class="flat" name="'.$htmlname.'">';
$oldprefix='';
foreach ($menuarray as $key => $val)
{
$tab=explode('_',$key);
$newprefix=$tab[0];
if (! empty($conf->browser->firefox) && $newprefix != $oldprefix) // Add separators
{
// Affiche titre
print '<option value="-1" disabled="disabled">';
if ($newprefix=='0') print '-- '.$langs->trans("VersionRecommanded").' --';
if ($newprefix=='1') print '-- '.$langs->trans("VersionExperimental").' --';
if ($newprefix=='2') print '-- '.$langs->trans("Other").' --';
print '</option>';
$oldprefix=$newprefix;
}
print $val."\n"; // Show menu entry
}
print '</select>';
}
/**
* \brief Retourne la liste deroulante des menus disponibles
* \param selected Menu pre-selectionnee
* \param htmlname Nom de la zone select
* \param dirmenu Repertoire a scanner
*/
function select_menu_families($selected='',$htmlname,$dirmenu)
{
global $langs,$conf;
$menuarray=array();
$handle=opendir($dirmenu);
while (($file = readdir($handle))!==false)
{
if (is_file($dirmenu."/".$file) && substr($file, 0, 1) <> '.' && substr($file, 0, 3) <> 'CVS')
{
$filelib=preg_replace('/(_backoffice|_frontoffice)?\.php$/i','',$file);
if (preg_match('/^default/i',$filelib)) continue;
if (preg_match('/^empty/i',$filelib)) continue;
if (preg_match('/\.lib/i',$filelib)) continue;
$menuarray[$filelib]=1;
}
$menuarray['all']=1;
}
ksort($menuarray);
// Affichage liste deroulante des menus
print '<select class="flat" name="'.$htmlname.'">';
$oldprefix='';
foreach ($menuarray as $key => $val)
{
$tab=explode('_',$key);
$newprefix=$tab[0];
print '<option value="'.$key.'"';
if ($key == $selected)
{
print ' selected="true"';
}
//if ($key == 'rodolphe') print ' disabled="true"';
print '>';
if ($key == 'all') print $langs->trans("AllMenus");
else print $key;
//if ($key == 'rodolphe') print ' ('.$langs->trans("PersonalizedMenusNotSupported").')';
print '</option>'."\n";
}
print '</select>';
}
/**
* \brief Retourne la liste deroulante des menus disponibles (eldy)
* \param selected Menu pre-selectionnee
* \param htmlname Nom de la zone select
*/
function select_timezone($selected='',$htmlname)
{
global $langs,$conf;
print '<select class="flat" name="'.$htmlname.'">';
print '<option value="-1">&nbsp;</option>';
$arraytz=array(
"Pacific/Midway"=>"GMT-11:00",
"Pacific/Fakaofo"=>"GMT-10:00",
"America/Anchorage"=>"GMT-09:00",
"America/Los_Angeles"=>"GMT-08:00",
"America/Dawson_Creek"=>"GMT-07:00",
"America/Chicago"=>"GMT-06:00",
"America/Bogota"=>"GMT-05:00",
"America/Anguilla"=>"GMT-04:00",
"America/Araguaina"=>"GMT-03:00",
"America/Noronha"=>"GMT-02:00",
"Atlantic/Azores"=>"GMT-01:00",
"Africa/Abidjan"=>"GMT+00:00",
"Europe/Paris"=>"GMT+01:00",
"Europe/Helsinki"=>"GMT+02:00",
"Europe/Moscow"=>"GMT+03:00",
"Asia/Dubai"=>"GMT+04:00",
"Asia/Karachi"=>"GMT+05:00",
"Indian/Chagos"=>"GMT+06:00",
"Asia/Jakarta"=>"GMT+07:00",
"Asia/Hong_Kong"=>"GMT+08:00",
"Asia/Tokyo"=>"GMT+09:00",
"Australia/Sydney"=>"GMT+10:00",
"Pacific/Noumea"=>"GMT+11:00",
"Pacific/Auckland"=>"GMT+12:00",
"Pacific/Enderbury"=>"GMT+13:00"
);
foreach ($arraytz as $lib => $gmt)
{
print '<option value="'.$lib.'"';
if ($selected == $lib || $selected == $gmt) print ' selected="true"';
print '>'.$gmt.'</option>'."\n";
}
print '</select>';
}
/**
* \brief Return colors list selector
* \param selected Color pre-selected
* \param htmlname Name of html select zone
*/
function select_colors($selected='', $htmlname, $arrayofcolors='', $showcolorbox=1)
{
global $langs,$conf;
if (! is_array($arrayofcolors)) $arrayofcolors=array('29527A','5229A3','A32929','7A367A','B1365F','0D7813');
//$selected='';
if ($showcolorbox) print '<table class="nobordernopadding"><tr valign="middle" class="nobordernopadding"><td class="nobordernopadding">';
print '<select class="flat" name="'.$htmlname.'">';
print '<option value="-1">&nbsp;</option>';
foreach ($arrayofcolors as $val)
{
print '<option value="'.$val.'"';
if ($selected == $val) print ' selected="true"';
print '>'.$val.'</option>';
}
print '</select>';
if ($showcolorbox)
{
print '</td><td style="padding-left: 4px" nowrap="nowrap">';
print '<!-- Box color '.$selected.' -->';
print '<table style="border-collapse: collapse; margin:0px; padding: 0px; border: 1px solid #888888; background: #'.$selected.';" width="12" height="10">';
print '<tr class="nocellnopadd"><td></td></tr>';
print '</table>';
print '</td></tr></table>';
}
}
}
?>

View File

@ -1,570 +0,0 @@
<?php
/* Copyright (C) 2008-2009 Laurent Destailleur <eldy@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* 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.formcompany.class.php
* \brief File of class to build HTML component for third parties management
* \version $Id$
*/
/**
* \class FormCompany
* \brief Class to build HTML component for third parties management
* \remarks Only common components must be here.
*/
class FormCompany
{
var $db;
var $error;
/**
* \brief Constructeur
* \param DB handler d'acces base de donnee
*/
function FormCompany($DB)
{
$this->db = $DB;
return 1;
}
/**
* \brief Renvoie la liste des libelles traduits des types actifs de societes
* \param mode 0=renvoi id+libelle, 1=renvoi code+libelle
* \return array tableau des types
*/
function typent_array($mode=0)
{
global $langs;
$effs = array();
$sql = "SELECT id, code, libelle";
$sql.= " FROM ".MAIN_DB_PREFIX."c_typent";
$sql.= " WHERE active = 1";
$sql.= " ORDER by id";
dol_syslog('Form::typent_array sql='.$sql,LOG_DEBUG);
$resql=$this->db->query($sql);
if ($resql)
{
$num = $this->db->num_rows($resql);
$i = 0;
while ($i < $num)
{
$objp = $this->db->fetch_object($resql);
if (! $mode) $key=$objp->id;
else $key=$objp->code;
if ($langs->trans($objp->code) != $objp->code)
$effs[$key] = $langs->trans($objp->code);
else
$effs[$key] = $objp->libelle!='-'?$objp->libelle:'';
$i++;
}
$this->db->free($resql);
}
return $effs;
}
/**
* \brief Renvoie la liste des types d'effectifs possibles (pas de traduction car nombre)
* \param mode 0=renvoi id+libelle, 1=renvoi code+libelle
* \return array tableau des types d'effectifs
*/
function effectif_array($mode=0)
{
$effs = array();
$sql = "SELECT id, code, libelle";
$sql .= " FROM ".MAIN_DB_PREFIX."c_effectif";
$sql.= " WHERE active = 1";
$sql .= " ORDER BY id ASC";
dol_syslog('Form::effectif_array sql='.$sql,LOG_DEBUG);
$resql=$this->db->query($sql);
if ($resql)
{
$num = $this->db->num_rows($resql);
$i = 0;
while ($i < $num)
{
$objp = $this->db->fetch_object($resql);
if (! $mode) $key=$objp->id;
else $key=$objp->code;
$effs[$key] = $objp->libelle!='-'?$objp->libelle:'';
$i++;
}
$this->db->free($resql);
}
return $effs;
}
/**
* \brief Affiche formulaire de selection des modes de reglement
* \param page Page
* \param selected Id or code preselected
* \param htmlname Nom du formulaire select
* \param empty Add empty value in list
*/
function form_prospect_level($page, $selected='', $htmlname='prospect_level_id', $empty=0)
{
global $langs;
print '<form method="post" action="'.$page.'">';
print '<input type="hidden" name="action" value="setprospectlevel">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<table class="noborder" cellpadding="0" cellspacing="0">';
print '<tr><td>';
print '<select class="flat" name="'.$htmlname.'">';
if ($empty) print '<option value="">&nbsp;</option>';
dol_syslog('Form::form_prospect_level',LOG_DEBUG);
$sql = "SELECT code, label";
$sql.= " FROM ".MAIN_DB_PREFIX."c_prospectlevel";
$sql.= " WHERE active > 0";
$sql.= " ORDER BY sortorder";
$resql = $this->db->query($sql);
if ($resql)
{
$num = $this->db->num_rows($resql);
$i = 0;
while ($i < $num)
{
$obj = $this->db->fetch_object($resql);
print '<option value="'.$obj->code.'"';
if ($selected == $obj->code) print ' selected="true"';
print '>';
$level=$langs->trans($obj->code);
if ($level == $obj->code) $level=$langs->trans($obj->label);
print $level;
print '</option>';
$i++;
}
}
else dol_print_error($this->db);
print '</select>';
print '</td>';
print '<td align="left"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td>';
print '</tr></table></form>';
}
/**
* \brief Retourne la liste deroulante des departements/province/cantons tout pays confondu ou pour un pays donne.
* \remarks Dans le cas d'une liste tout pays confondus, l'affichage fait une rupture sur le pays.
* \remarks La cle de la liste est le code (il peut y avoir plusieurs entree pour
* un code donnee mais dans ce cas, le champ pays differe).
* Ainsi les liens avec les departements se font sur un departement independemment de son nom.
* \param selected code forme juridique a preselectionne
* \param pays_code 0=liste tous pays confondus, sinon code du pays a afficher
*/
function select_departement($selected='',$pays_code=0)
{
global $conf,$langs,$user;
dol_syslog("Form::select_departement selected=$selected, pays_code=$pays_code",LOG_DEBUG);
$langs->load("dict");
$htmlname='departement_id';
// On recherche les d<>partements/cantons/province active d'une region et pays actif
$sql = "SELECT d.rowid, d.code_departement as code , d.nom, d.active, p.libelle as libelle_pays, p.code as code_pays FROM";
$sql .= " ".MAIN_DB_PREFIX ."c_departements as d, ".MAIN_DB_PREFIX."c_regions as r,".MAIN_DB_PREFIX."c_pays as p";
$sql .= " WHERE d.fk_region=r.code_region and r.fk_pays=p.rowid";
$sql .= " AND d.active = 1 AND r.active = 1 AND p.active = 1";
if ($pays_code) $sql .= " AND p.code = '".$pays_code."'";
$sql .= " ORDER BY p.code, d.code_departement";
dol_syslog("Form::select_departement sql=".$sql);
$result=$this->db->query($sql);
if ($result)
{
print '<select class="flat" name="'.$htmlname.'">';
if ($pays_code) print '<option value="0">&nbsp;</option>';
$num = $this->db->num_rows($result);
$i = 0;
dol_syslog("Form::select_departement num=$num",LOG_DEBUG);
if ($num)
{
$pays='';
while ($i < $num)
{
$obj = $this->db->fetch_object($result);
if ($obj->code == '0') // Le code peut etre une chaine
{
print '<option value="0">&nbsp;</option>';
}
else {
if (! $pays || $pays != $obj->libelle_pays)
{
// Affiche la rupture si on est en mode liste multipays
if (! $pays_code && $obj->code_pays)
{
print '<option value="-1">----- '.$obj->libelle_pays." -----</option>\n";
$pays=$obj->libelle_pays;
}
}
if ($selected > 0 && $selected == $obj->rowid)
{
print '<option value="'.$obj->rowid.'" selected="true">';
}
else
{
print '<option value="'.$obj->rowid.'">';
}
// Si traduction existe, on l'utilise, sinon on prend le libell<6C> par d<>faut
print $obj->code . ' - ' . ($langs->trans($obj->code)!=$obj->code?$langs->trans($obj->code):($obj->nom!='-'?$obj->nom:''));
print '</option>';
}
$i++;
}
}
print '</select>';
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1);
}
else
{
dol_print_error($this->db);
}
}
/**
* \brief Retourne la liste deroulante des regions actives dont le pays est actif
* \remarks La cle de la liste est le code (il peut y avoir plusieurs entree pour
* un code donnee mais dans ce cas, le champ pays et lang differe).
* Ainsi les liens avec les regions se font sur une region independemment
* de son nom.
*/
function select_region($selected='',$htmlname='region_id')
{
global $conf,$langs;
$langs->load("dict");
$sql = "SELECT r.rowid, r.code_region as code, r.nom as libelle, r.active, p.code as pays_code, p.libelle as libelle_pays FROM ".MAIN_DB_PREFIX."c_regions as r, ".MAIN_DB_PREFIX."c_pays as p";
$sql .= " WHERE r.fk_pays=p.rowid AND r.active = 1 and p.active = 1 ORDER BY pays_code, libelle ASC";
dol_syslog("Form::select_region sql=".$sql);
$resql=$this->db->query($sql);
if ($resql)
{
print '<select class="flat" name="'.$htmlname.'">';
$num = $this->db->num_rows($resql);
$i = 0;
if ($num)
{
$pays='';
while ($i < $num)
{
$obj = $this->db->fetch_object($resql);
if ($obj->code == 0) {
print '<option value="0">&nbsp;</option>';
}
else {
if ($pays == '' || $pays != $obj->libelle_pays)
{
// Show break
$key=$langs->trans("Country".strtoupper($obj->pays_code));
$valuetoshow=($key != "Country".strtoupper($obj->pays_code))?$obj->pays_code." - ".$key:$obj->libelle_pays;
print '<option value="-1" disabled="disabled">----- '.$valuetoshow." -----</option>\n";
$pays=$obj->libelle_pays;
}
if ($selected > 0 && $selected == $obj->code)
{
print '<option value="'.$obj->code.'" selected="true">'.$obj->libelle.'</option>';
}
else
{
print '<option value="'.$obj->code.'">'.$obj->libelle.'</option>';
}
}
$i++;
}
}
print '</select>';
}
else
{
dol_print_error($this->db);
}
}
/**
* \brief Retourne la liste deroulante des civilite actives
* \param selected civilite pre-selectionnee
* \param htmlname Name of HTML select combo field
*/
function select_civilite($selected='',$htmlname='civilite_id')
{
global $conf,$langs,$user;
$langs->load("dict");
$sql = "SELECT rowid, code, civilite, active FROM ".MAIN_DB_PREFIX."c_civilite";
$sql.= " WHERE active = 1";
dol_syslog("Form::select_civilite sql=".$sql);
$resql=$this->db->query($sql);
if ($resql)
{
print '<select class="flat" name="'.$htmlname.'">';
print '<option value="">&nbsp;</option>';
$num = $this->db->num_rows($resql);
$i = 0;
if ($num)
{
while ($i < $num)
{
$obj = $this->db->fetch_object($resql);
if ($selected == $obj->code)
{
print '<option value="'.$obj->code.'" selected="true">';
}
else
{
print '<option value="'.$obj->code.'">';
}
// Si traduction existe, on l'utilise, sinon on prend le libelle par defaut
print ($langs->trans("Civility".$obj->code)!="Civility".$obj->code ? $langs->trans("Civility".$obj->code) : ($obj->civilite!='-'?$obj->civilite:''));
print '</option>';
$i++;
}
}
print '</select>';
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1);
}
else
{
dol_print_error($this->db);
}
}
/**
* \brief Retourne la liste deroulante des formes juridiques tous pays confondus ou pour un pays donne.
* \remarks Dans le cas d'une liste tous pays confondu, on affiche une rupture sur le pays
* \param selected Code forme juridique a pre-selectionne
* \param pays_code 0=liste tous pays confondus, sinon code du pays a afficher
*/
function select_forme_juridique($selected='',$pays_code=0)
{
global $conf,$langs,$user;
$langs->load("dict");
// On recherche les formes juridiques actives des pays actifs
$sql = "SELECT f.rowid, f.code as code , f.libelle as nom, f.active, p.libelle as libelle_pays, p.code as code_pays";
$sql .= " FROM llx_c_forme_juridique as f, llx_c_pays as p";
$sql .= " WHERE f.fk_pays=p.rowid";
$sql .= " AND f.active = 1 AND p.active = 1";
if ($pays_code) $sql .= " AND p.code = '".$pays_code."'";
$sql .= " ORDER BY p.code, f.code";
dol_syslog("Form::select_forme_juridique sql=".$sql);
$result=$this->db->query($sql);
if ($result)
{
print '<div id="particulier2" class="visible">';
print '<select class="flat" name="forme_juridique_code">';
if ($pays_code) print '<option value="0">&nbsp;</option>';
$num = $this->db->num_rows($result);
$i = 0;
if ($num)
{
$pays='';
while ($i < $num)
{
$obj = $this->db->fetch_object($result);
if ($obj->code == 0) {
print '<option value="0">&nbsp;</option>';
}
else {
if (! $pays || $pays != $obj->libelle_pays) {
// Affiche la rupture si on est en mode liste multipays
if (! $pays_code && $obj->code_pays) {
print '<option value="0">----- '.$obj->libelle_pays." -----</option>\n";
$pays=$obj->libelle_pays;
}
}
if ($selected > 0 && $selected == $obj->code)
{
print '<option value="'.$obj->code.'" selected="true">';
}
else
{
print '<option value="'.$obj->code.'">';
}
// Si translation exists, we use it, otherwise we use default label in database
print $obj->code . ' - ';
print ($langs->trans("JuridicalStatus".$obj->code)!="JuridicalStatus".$obj->code?$langs->trans("JuridicalStatus".$obj->code):($obj->nom!='-'?$obj->nom:'')); // $obj->nom is alreay in output charset (converted by database driver)
print '</option>';
}
$i++;
}
}
print '</select>';
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1);
print '</div>';
}
else
{
dol_print_error($this->db);
}
}
/**
* \brief Return list of third parties
* \param object Object we try to find contacts
* \param var_id Name of id field
* \param selected Pre-selected third party
* \param htmlname Name of HTML form
* \param limitto Disable answers that are not id in this array list
*/
function selectCompaniesForNewContact($object, $var_id, $selected='', $htmlname='newcompany', $limitto='')
{
global $conf, $langs;
// On recherche les societes
$sql = "SELECT s.rowid, s.nom FROM";
$sql.= " ".MAIN_DB_PREFIX."societe as s";
if ($selected && $conf->use_javascript_ajax && $conf->global->COMPANY_USE_SEARCH_TO_SELECT) $sql.= " WHERE rowid = ".$selected;
else
{
// For ajax search we limit here. For combo list, we limit later
if ($conf->use_javascript_ajax && $conf->global->COMPANY_USE_SEARCH_TO_SELECT
&& is_array($limitto) && sizeof($limitto))
{
$sql.= " WHERE rowid in (".join(',',$limitto).")";
}
}
$sql .= " ORDER BY nom ASC";
//print $sql;
$resql = $object->db->query($sql);
if ($resql)
{
if ($conf->use_javascript_ajax && $conf->global->COMPANY_USE_SEARCH_TO_SELECT)
{
$socid=0;
if ($selected)
{
$obj = $this->db->fetch_object($resql);
$socid = $obj->rowid?$obj->rowid:'';
}
// We call a page after a small delay when a new input has been selected
$javaScript = "window.location=\'./contact.php?".$var_id."=".$object->id."&amp;".$htmlname."=\' + document.getElementById(\'".$htmlname."_id\').value;";
$htmloption = 'onChange="ac_delay(\''.$javaScript.'\',\'500\')"';
print "\n".'<!-- Input text for third party with Ajax.Autocompleter (selectCompaniesForNewContact) -->'."\n";
print '<table class="nobordernopadding"><tr class="nobordernopadding">';
print '<td class="nobordernopadding">';
if ($obj->rowid == 0)
{
//$langs->load("companies");
//print '<input type="text" size="30" id="'.$htmlname.'_label" name="'.$htmlname.'" value="'.$langs->trans("SelectCompany").'" '.$htmloption.' />';
print '<input type="text" size="30" id="'.$htmlname.'" name="'.$htmlname.'" value="" '.$htmloption.' />';
}
else
{
print '<input type="text" size="30" id="'.$htmlname.'" name="'.$htmlname.'" value="'.$obj->nom.'" '.$htmloption.' />';
}
print ajax_autocompleter(($socid?$socid:-1),$htmlname,DOL_URL_ROOT.'/societe/ajaxcompanies.php','');
print '</td>';
print '<td class="nobordernopadding" align="left" width="16">';
print ajax_indicator($htmlname,'working');
print '</td></tr>';
print '</table>';
print "\n";
return $socid;
}
else
{
$javaScript = "window.location='./contact.php?".$var_id."=".$object->id."&amp;".$htmlname."=' + form.".$htmlname.".options[form.".$htmlname.".selectedIndex].value;";
print '<select class="flat" name="'.$htmlname.'" onChange="'.$javaScript.'">';
$num = $object->db->num_rows($resql);
$i = 0;
if ($num)
{
while ($i < $num)
{
$obj = $object->db->fetch_object($resql);
if ($i == 0) $firstCompany = $obj->rowid;
$disabled=0;
if (is_array($limitto) && sizeof($limitto) && ! in_array($obj->rowid,$limitto)) $disabled=1;
if ($selected > 0 && $selected == $obj->rowid)
{
print '<option value="'.$obj->rowid.'"';
if ($disabled) print ' disabled="true"';
print ' selected="true">'.dol_trunc($obj->nom,24).'</option>';
$firstCompany = $obj->rowid;
}
else
{
print '<option value="'.$obj->rowid.'"';
if ($disabled) print ' disabled="true"';
print '>'.dol_trunc($obj->nom,24).'</option>';
}
$i ++;
}
}
print "</select>\n";
return $firstCompany;
}
}
else
{
dol_print_error($object->db);
}
}
/**
*
*/
function selectTypeContact($object, $defValue, $htmlname = 'type', $source, $order='code')
{
$lesTypes = $object->liste_type_contact($source, $order);
print '<select class="flat" name="'.$htmlname.'">';
foreach($lesTypes as $key=>$value)
{
print '<option value="'.$key.'">'.$value.'</option>';
}
print "</select>\n";
}
}
?>

View File

@ -341,7 +341,7 @@ class FormFile
print '<td align="center">';
if (($allowgenifempty || (is_array($modellist) && sizeof($modellist) > 0)) && $conf->global->MAIN_MULTILANGS && ! $forcenomultilang)
{
include_once(DOL_DOCUMENT_ROOT.'/html.formadmin.class.php');
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);

View File

@ -22,7 +22,7 @@
* \version $Id$
*/
require_once(DOL_DOCUMENT_ROOT ."/html.form.class.php");
require_once(DOL_DOCUMENT_ROOT ."/core/class/html.form.class.php");
/** \class FormMail

View File

@ -82,7 +82,7 @@ class FormOrder
global $conf,$langs;
$listemethodes=array();
require_once(DOL_DOCUMENT_ROOT."/html.form.class.php");
require_once(DOL_DOCUMENT_ROOT."/core/class/html.form.class.php");
$form=new Form($this->db);
$sql = "SELECT rowid, libelle ";

View File

@ -183,7 +183,7 @@ if ($conf->file->main_force_https)
// Chargement des includes complementaires de presentation
if (! defined('NOREQUIREMENU')) require_once(DOL_DOCUMENT_ROOT ."/core/class/menu.class.php"); // Need 10ko memory (11ko in 2.2)
if (! defined('NOREQUIREHTML')) require_once(DOL_DOCUMENT_ROOT ."/html.form.class.php"); // Need 660ko memory (800ko in 2.2)
if (! defined('NOREQUIREHTML')) require_once(DOL_DOCUMENT_ROOT ."/core/class/html.form.class.php"); // Need 660ko memory (800ko in 2.2)
if (! defined('NOREQUIREAJAX') && $conf->use_javascript_ajax) require_once(DOL_DOCUMENT_ROOT.'/lib/ajax.lib.php'); // Need 22ko memory
//stopwithmem();

View File

@ -31,8 +31,8 @@
require("./main.inc.php");
require_once(DOL_DOCUMENT_ROOT."/lib/company.lib.php");
require_once(DOL_DOCUMENT_ROOT."/html.formadmin.class.php");
require_once(DOL_DOCUMENT_ROOT."/html.formcompany.class.php");
require_once(DOL_DOCUMENT_ROOT."/core/class/html.formadmin.class.php");
require_once(DOL_DOCUMENT_ROOT."/core/class/html.formcompany.class.php");
require_once(DOL_DOCUMENT_ROOT."/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");