diff --git a/htdocs/ajaxbox.php b/htdocs/ajaxbox.php index 1a64570b8c2..72a01728500 100644 --- a/htdocs/ajaxbox.php +++ b/htdocs/ajaxbox.php @@ -19,7 +19,7 @@ /** * \file htdocs/ajaxbox.php - * \brief Fichier de reponse sur evenement Ajax deplacement boxes + * \brief File to return Ajax response on Box move * \version $Id$ */ diff --git a/htdocs/compta/facture/contact.php b/htdocs/compta/facture/contact.php index b3ab1770840..cd50321aa01 100644 --- a/htdocs/compta/facture/contact.php +++ b/htdocs/compta/facture/contact.php @@ -1,6 +1,6 @@ - * Copyright (C) 2005-2007 Destailleur Laurent + * Copyright (C) 2005-2009 Destailleur Laurent * * 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 @@ -18,11 +18,11 @@ */ /** - \file htdocs/compta/facture/contact.php - \ingroup facture - \brief Onglet de gestion des contacts des factures - \version $Id$ -*/ + * \file htdocs/compta/facture/contact.php + * \ingroup facture + * \brief Onglet de gestion des contacts des factures + * \version $Id$ + */ require ("./pre.inc.php"); require_once(DOL_DOCUMENT_ROOT."/facture.class.php"); @@ -142,6 +142,10 @@ if ($_GET["action"] == 'deleteline' && $user->rights->facture->creer) } +/* + * View + */ + llxHeader('', $langs->trans("Bill"), "Facture"); $html = new Form($db); @@ -192,7 +196,7 @@ if ($id > 0) /* * Ajouter une ligne de contact - * Non affich� en mode modification de ligne + * Non affiche en mode modification de ligne */ if ($_GET["action"] != 'editline' && $user->rights->facture->creer) { @@ -224,7 +228,7 @@ if ($id > 0) print ''; print ''; - // On r�cup�re les id des users d�j� s�lectionn�s + // Ge get ids of alreadey selected users //$userAlreadySelected = $facture->getListContactId('internal'); // On ne doit pas desactiver un contact deja selectionner car on doit pouvoir le seclectionner une deuxieme fois pour un autre type $html->select_users($user->id,'contactid',0,$userAlreadySelected); print ''; @@ -250,12 +254,12 @@ if ($id > 0) print img_object('','contact').' '.$langs->trans("ThirdPartyContacts"); print ''; - print ''; + print ''; $selectedCompany = isset($_GET["newcompany"])?$_GET["newcompany"]:$facture->client->id; $selectedCompany = $formcompany->selectCompaniesForNewContact($facture, 'facid', $selectedCompany, $htmlname = 'newcompany'); print ''; - print ''; + print ''; //$contactAlreadySelected = $facture->getListContactId('external'); // On ne doit pas desactiver un contact deja selectionne car on doit pouvoir le seclectionner une deuxieme fois pour un autre type $nbofcontacts=$html->select_contacts($selectedCompany, '', 'contactid', 0, $contactAlreadySelected); if ($nbofcontacts == 0) print $langs->trans("NoContactDefined"); @@ -263,7 +267,7 @@ if ($id > 0) print ''; $formcompany->selectTypeContact($facture, '', 'type','external'); print ''; - print ''; print ''; diff --git a/htdocs/html.form.class.php b/htdocs/html.form.class.php index ccbc801f4f9..bdacde356a3 100644 --- a/htdocs/html.form.class.php +++ b/htdocs/html.form.class.php @@ -226,11 +226,11 @@ class Form $mode_company = substr($htmloption,-10,7); if ($mode_create == 'create') { - $htmloption = 'onChange="ac_delay(\'autofilltownfromzip_save_refresh_create()\',\'500\')"'; + $htmloption = 'onChange="ac_delay(\'company_save_refresh_create()\',\'500\')"'; } else if ($mode_edit == 'edit') { - $htmloption = 'onChange="ac_delay(\'autofilltownfromzip_save_refresh_edit()\',\'500\')"'; + $htmloption = 'onChange="ac_delay(\'company_save_refresh_edit()\',\'500\')"'; } else if ($mode_company == 'refresh') { @@ -247,7 +247,8 @@ class Form print ''; } - print ajax_autocompleter($pays_id,'pays','/societe/ajaxcountries.php','working'); + print ajax_indicator($htmlname,'working'); + print ajax_autocompleter($pays_id,'pays','/societe/ajaxcountries.php',''); } else { @@ -488,16 +489,23 @@ class Form $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=\'...\'"; + //$htmloption = 'onChange="ac_delay(\''.$javaScript.'\',\'500\')"'; + $htmloption=''; + + print ''."\n"; print ''; print ''; @@ -767,14 +775,14 @@ class Form print ''; print ''; print ''; print ''; print ''; print ''; print '
'; - print '
'; if ($socid == 0) { - print ''; + $langs->load("companies"); + print ''; } else { - print ''; + print ''; } print ajax_autocompleter(($socid?$socid:-1),$htmlname,'/societe/ajaxcompanies.php?filter='.urlencode($filter), ''); print '
'; print $langs->trans("RefOrLabel").':'; - print ajax_indicator($htmlname,'working'); + print ajax_indicator($htmlname,'working'); // Indicator is et here print ' '; print '
'; - print ajax_updater($htmlname,'keysearch','/product/ajaxproducts.php','&price_level='.$price_level.'&type='.$filtertype.'&mode=1&status='.$status.'&finished='.$finished,''); + print ajax_updater($htmlname,'keysearch','/product/ajaxproducts.php','&price_level='.$price_level.'&type='.$filtertype.'&mode=1&status='.$status.'&finished='.$finished,''); // Indicator is '' to disable it as it is alreay output print '
'; } diff --git a/htdocs/html.formcompany.class.php b/htdocs/html.formcompany.class.php index bd5c52bac4c..bf2c852aee1 100644 --- a/htdocs/html.formcompany.class.php +++ b/htdocs/html.formcompany.class.php @@ -455,10 +455,7 @@ class FormCompany // On recherche les societes $sql = "SELECT s.rowid, s.nom FROM"; $sql .= " ".MAIN_DB_PREFIX."societe as s"; - if ($conf->use_javascript_ajax && $conf->global->COMPANY_USE_SEARCH_TO_SELECT) - { - $sql.= " WHERE rowid = ".$selected; - } + if ($selected && $conf->use_javascript_ajax && $conf->global->COMPANY_USE_SEARCH_TO_SELECT) $sql.= " WHERE rowid = ".$selected; $sql .= " ORDER BY nom ASC"; $resql = $object->db->query($sql); @@ -466,31 +463,36 @@ class FormCompany { if ($conf->use_javascript_ajax && $conf->global->COMPANY_USE_SEARCH_TO_SELECT) { - $langs->load("companies"); - $obj = $this->db->fetch_object($resql); - $socid = $obj->rowid?$obj->rowid:''; - $javaScript = "window.location=\'./contact.php?".$var_id."=".$object->id."&".$htmlname."=\' + document.getElementById(\'newcompany_id\').value;"; + $socid=0; + if ($selected) + { + $obj = $this->db->fetch_object($resql); + $socid = $obj->rowid?$obj->rowid:''; + } - // On applique un delai d'execution pour le bon fonctionnement + // We call a page after a small delay when a new input has been selected + $javaScript = "window.location=\'./contact.php?".$var_id."=".$object->id."&".$htmlname."=\' + document.getElementById(\'newcompany_id\').value;"; $htmloption = 'onChange="ac_delay(\''.$javaScript.'\',\'500\')"'; - print ''; + print ''."\n"; + print '
'; print ''; print ''; print '
'; - print '
'; if ($obj->rowid == 0) { - print ''; + $langs->load("companies"); + print ''; } else { - print ''; + print ''; } - print ajax_autocompleter($socid,'newcompany','/societe/ajaxcompanies.php',''); + print ajax_autocompleter(($socid?$socid:-1),$htmlname,'/societe/ajaxcompanies.php',''); print '
'; print ajax_indicator($htmlname,'working'); print '
'; + print "\n"; return $socid; } else diff --git a/htdocs/lib/ajax.lib.php b/htdocs/lib/ajax.lib.php index a14cd1a2275..a01c3ed8fb1 100644 --- a/htdocs/lib/ajax.lib.php +++ b/htdocs/lib/ajax.lib.php @@ -19,7 +19,7 @@ */ /** - * \file htdocs/lib/agenda.lib.php + * \file htdocs/lib/ajax.lib.php * \brief Page called by Ajax request for produts * \version $Id$ */ @@ -117,7 +117,7 @@ function ajax_updaterWithID($htmlname,$keysearch,$id,$url,$option='',$indicator= } /** - * \brief Get vlaue of field, do Ajax process and return result + * \brief Get value of field, do Ajax process and return result * \param htmlname nom et id du champ * \param url chemin du fichier de reponse : /chemin/fichier.php * \param indicator nom de l'image gif sans l'extension @@ -125,9 +125,10 @@ function ajax_updaterWithID($htmlname,$keysearch,$id,$url,$option='',$indicator= */ function ajax_autocompleter($selected='',$htmlname,$url,$indicator='working') { - if ($indicator) $script.= ajax_indicator($htmlname,$indicator); + $script=''; + $script.= ''; - $script.= ''; + $script.= '
'; $script.= ''."\n"; //print ''."\n"; - print ''."\n"; + $listofscripts='effects,dragdrop'; + if ($conf->global->COMPANY_USE_SEARCH_TO_SELECT) $listofscripts.=',controls'; // For Ajax.Autocompleter + print ''."\n"; } // Those ones are required only with option "confirm by ajax popup" diff --git a/htdocs/product/ajaxproducts.php b/htdocs/product/ajaxproducts.php index 54e2423f4da..cde7ee9592d 100644 --- a/htdocs/product/ajaxproducts.php +++ b/htdocs/product/ajaxproducts.php @@ -20,7 +20,7 @@ /** * \file htdocs/product/ajaxproducts.php - * \brief File to return Ajax question of product list + * \brief File to return Ajax response on product list request * \version $Id$ */ diff --git a/htdocs/soc.php b/htdocs/soc.php index 7c960062eec..5b469889bce 100644 --- a/htdocs/soc.php +++ b/htdocs/soc.php @@ -266,7 +266,8 @@ if ($_REQUEST["action"] == 'confirm_delete' && $_REQUEST["confirm"] == 'yes' && * View */ -llxHeader(); +$help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas'; +llxHeader('','',$help_url); $form = new Form($db); $formcompany = new FormCompany($db); diff --git a/htdocs/societe.php b/htdocs/societe.php index 7676fbc7ecb..53a469cbcf2 100644 --- a/htdocs/societe.php +++ b/htdocs/societe.php @@ -100,20 +100,23 @@ if ($mode == 'search') } $db->free($result); } - // S�curit� acc�s client - if ($user->societe_id > 0) - { - $action = ''; - $socid = $user->societe_id; - } } +// Security check +if ($user->societe_id > 0) +{ + $action = ''; + $socid = $user->societe_id; +} + + /* * View */ -llxHeader($langs->trans("ThirdParty"),'','EN:Third_Parties|FR:Tiers|ES:Empresas'); +$help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas'; +llxHeader($langs->trans("ThirdParty"),'',$help_url); $form=new Form($db); $companystatic=new Societe($db); diff --git a/htdocs/societe/ajaxcompanies.php b/htdocs/societe/ajaxcompanies.php index e240c7114b6..d6af52b568c 100644 --- a/htdocs/societe/ajaxcompanies.php +++ b/htdocs/societe/ajaxcompanies.php @@ -2,7 +2,7 @@ /* Copyright (C) 2006 Andre Cianfarani * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2007 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 * the Free Software Foundation; either version 2 of the License, or @@ -16,15 +16,13 @@ * 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. - * - * $Id$ */ /** - \file htdocs/societe/ajaxcompanies.php - \brief Fichier de reponse sur evenement Ajax - \version $Revision$ -*/ + * \file htdocs/societe/ajaxcompanies.php + * \brief File to return Ajax response on third parties request + * \version $Id$ + */ define('NOTOKENRENEWAL',1); // Disables token renewal @@ -47,7 +45,7 @@ if (! empty($_POST['newcompany']) || ! empty($_POST['socid']) || ! empty($_POST[ $sql.= " WHERE nom LIKE '%" . $socid . "%'"; if (! empty($_GET["filter"])) $sql.= " AND ".$_GET["filter"]; // Add other filters $sql.= " ORDER BY nom ASC"; - + //dol_syslog("ajaxcompanies sql=".$sql); $resql=$db->query($sql); if ($resql) @@ -62,8 +60,8 @@ if (! empty($_POST['newcompany']) || ! empty($_POST['socid']) || ! empty($_POST[ } print ''; } -} +} -print ""; -print ""; +print ""; +print ""; ?> diff --git a/htdocs/societe/ajaxcountries.php b/htdocs/societe/ajaxcountries.php index 286d77e85f2..dc9a2587fb7 100644 --- a/htdocs/societe/ajaxcountries.php +++ b/htdocs/societe/ajaxcountries.php @@ -15,16 +15,13 @@ * 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. - * - * $Id$ - * $Source$ */ /** - \file htdocs/societe/ajaxcountries.php - \brief Fichier de reponse sur evenement Ajax - \version $Revision$ -*/ + * \file htdocs/societe/ajaxcountries.php + * \brief File to return Ajax response on country request + * \version $Id$ + */ define('NOTOKENRENEWAL',1); // Disables token renewal @@ -39,12 +36,12 @@ if(isset($_POST['pays']) && !empty($_POST['pays'])) { global $langs; $langs->load("dict"); - + $sql = "SELECT rowid, code, libelle, active"; $sql.= " FROM ".MAIN_DB_PREFIX."c_pays"; $sql.= " WHERE active = 1 AND libelle LIKE '%" . utf8_decode($_POST['pays']) . "%'"; $sql.= " ORDER BY libelle ASC;"; - + $resql=$db->query($sql); if ($resql) @@ -60,8 +57,8 @@ if(isset($_POST['pays']) && !empty($_POST['pays'])) } print ''; } -} +} -print ""; -print ""; +print ""; +print ""; ?>