mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-06 01:28:19 +01:00
Fix: search company with jQuery - ok
This commit is contained in:
@@ -40,13 +40,6 @@ $langs->load("members");
|
||||
$langs->load("users");
|
||||
$langs->load("mails");
|
||||
|
||||
// If socid provided by ajax company selector
|
||||
if (! empty($_REQUEST['socid_id']))
|
||||
{
|
||||
$_GET['socid'] = $_GET['socid_id'];
|
||||
$_POST['socid'] = $_POST['socid_id'];
|
||||
$_REQUEST['socid'] = $_REQUEST['socid_id'];
|
||||
}
|
||||
|
||||
// Security check
|
||||
if (! $user->rights->adherent->cotisation->lire) accessforbidden();
|
||||
|
||||
@@ -42,14 +42,6 @@ $langs->load("bills");
|
||||
$langs->load("members");
|
||||
$langs->load("users");
|
||||
|
||||
// If socid provided by ajax company selector
|
||||
if (! empty($_REQUEST['socid_id']))
|
||||
{
|
||||
$_GET['socid'] = $_GET['socid_id'];
|
||||
$_POST['socid'] = $_POST['socid_id'];
|
||||
$_REQUEST['socid'] = $_REQUEST['socid_id'];
|
||||
}
|
||||
|
||||
// Security check
|
||||
if (! $user->rights->adherent->lire) accessforbidden();
|
||||
|
||||
|
||||
@@ -29,13 +29,6 @@
|
||||
require("../main.inc.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/categories/class/categorie.class.php");
|
||||
|
||||
// If socid provided by ajax company selector
|
||||
if (! empty($_REQUEST['socid_id']))
|
||||
{
|
||||
$_GET['socid'] = $_GET['socid_id'];
|
||||
$_POST['socid'] = $_POST['socid_id'];
|
||||
$_REQUEST['socid'] = $_REQUEST['socid_id'];
|
||||
}
|
||||
|
||||
// Security check
|
||||
if (!$user->rights->categorie->lire)
|
||||
|
||||
@@ -31,13 +31,6 @@ require_once(DOL_DOCUMENT_ROOT."/categories/class/categorie.class.php");
|
||||
|
||||
$langs->load("categories");
|
||||
|
||||
// If socid provided by ajax company selector
|
||||
if (! empty($_REQUEST['socid_id']))
|
||||
{
|
||||
$_GET['socid'] = $_GET['socid_id'];
|
||||
$_POST['socid'] = $_POST['socid_id'];
|
||||
$_REQUEST['socid'] = $_REQUEST['socid_id'];
|
||||
}
|
||||
|
||||
// Security check
|
||||
$socid=isset($_GET['socid'])?$_GET['socid']:$_POST['socid'];
|
||||
|
||||
@@ -35,13 +35,6 @@ if ($conf->projet->enabled)
|
||||
|
||||
$langs->load("trips");
|
||||
|
||||
// If socid provided by ajax company selector
|
||||
if (! empty($_REQUEST['socid_id']))
|
||||
{
|
||||
$_GET['socid'] = $_GET['socid_id'];
|
||||
$_POST['socid'] = $_POST['socid_id'];
|
||||
$_REQUEST['socid'] = $_REQUEST['socid_id'];
|
||||
}
|
||||
|
||||
// Security check
|
||||
$id=isset($_GET["id"])?$_GET["id"]:$_POST["id"];
|
||||
|
||||
@@ -40,14 +40,6 @@ $langs->load("users");
|
||||
$errors = array();
|
||||
$socid=$_GET["socid"]?$_GET["socid"]:$_POST["socid"];
|
||||
|
||||
// If socid provided by ajax company selector
|
||||
if (! empty($_REQUEST['socid_id']))
|
||||
{
|
||||
$socid = $_GET['socid'] = $_GET['socid_id'];
|
||||
$socid = $_POST['socid'] = $_POST['socid_id'];
|
||||
$socid = $_REQUEST['socid'] = $_REQUEST['socid_id'];
|
||||
}
|
||||
|
||||
// Security check
|
||||
$contactid = isset($_GET["id"])?$_GET["id"]:'';
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
|
||||
@@ -37,13 +37,6 @@ require_once(DOL_DOCUMENT_ROOT.'/lib/fourn.lib.php');
|
||||
require_once(DOL_DOCUMENT_ROOT.'/product/class/product.class.php');
|
||||
if ($conf->projet->enabled) require_once(DOL_DOCUMENT_ROOT.'/projet/class/project.class.php');
|
||||
|
||||
// If socid provided by ajax company selector
|
||||
if (! empty($_REQUEST['socid_id']))
|
||||
{
|
||||
$_GET['socid'] = $_GET['socid_id'];
|
||||
$_POST['socid'] = $_POST['socid_id'];
|
||||
$_REQUEST['socid'] = $_REQUEST['socid_id'];
|
||||
}
|
||||
|
||||
$langs->load('bills');
|
||||
$langs->load('suppliers');
|
||||
|
||||
@@ -86,7 +86,6 @@ function ajax_autocompleter($selected='',$htmlname,$valname,$url)
|
||||
|
||||
$script.= '<input type="hidden" name="'.$htmlname.'" id="'.$htmlname.'" value="'.$selected.'" />';
|
||||
|
||||
//$script.= '<div id="'.$htmlname.'" class="ui-widget"></div>';
|
||||
$script.= '<script type="text/javascript">';
|
||||
$script.= 'jQuery(document).ready(function() {
|
||||
jQuery("input#search_'.$htmlname.'").autocomplete({
|
||||
@@ -104,48 +103,6 @@ function ajax_autocompleter($selected='',$htmlname,$valname,$url)
|
||||
}
|
||||
});
|
||||
});';
|
||||
/*
|
||||
$script.= 'new Ajax.Autocompleter(\''.$htmlname.'\',\'result'.$htmlname.'\',\''.$url.'\',{
|
||||
method: \'post\',
|
||||
paramName: \'socid\',
|
||||
minChars: \'1\',
|
||||
indicator: \'indicator'.$htmlname.'\',
|
||||
afterUpdateElement: ac_return
|
||||
});'; // paramName must be 'socid', as it is the name of POST parameter to send value in htmlname field.
|
||||
// and it is name of parameter read by ajaxcompanies.php
|
||||
// Note: The ac_return will fill value inside field htmlname (param of Autocompleter constructor)
|
||||
// and will also fill value inside field htmlname_id (using function ac_return)*/
|
||||
$script.= '</script>';
|
||||
|
||||
return $script;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Get value of field, do Ajax process and return result. Use jQuery.
|
||||
* \param selected Preselected value
|
||||
* \param htmlname Name of html field
|
||||
* \param url Path of source file to get values: /path/ajaxpage.php
|
||||
* \param option Not used
|
||||
* \return string script complet
|
||||
*/
|
||||
function ajax_autocompleter2($selected='', $htmlname, $url, $option='')
|
||||
{
|
||||
$script = '<input type="hidden" name="'.$htmlname.'" id="'.$htmlname.'" value="'.$selected.'" />';
|
||||
|
||||
$script.= '<script type="text/javascript">';
|
||||
$script.= 'jQuery(function() {
|
||||
jQuery("input#'.$htmlname.'free").autocomplete({
|
||||
source: "'.$url.($option?'?'.$option:'').'",
|
||||
delay: 300,
|
||||
minLength: 1,
|
||||
select: function(event, ui) {
|
||||
/* jQuery("#'.$htmlname.'free") is automatically affected with ui.item.key */
|
||||
/* jQuery("#'.$htmlname.'free").val(ui.item.fulltext); */
|
||||
jQuery("#'.$htmlname.'").val(ui.item.key);
|
||||
/* alert(ui.item.key); */
|
||||
}
|
||||
});
|
||||
});';
|
||||
$script.= '</script>';
|
||||
|
||||
return $script;
|
||||
|
||||
@@ -37,14 +37,6 @@ $langs->load('companies');
|
||||
$projectid = (isset($_GET["id"])?$_GET["id"]:(isset($_POST["id"])?$_POST["id"]:''));
|
||||
$projectref = (isset($_GET["ref"])?$_GET["ref"]:'');
|
||||
|
||||
// If socid provided by ajax company selector
|
||||
if (! empty($_REQUEST['socid_id']))
|
||||
{
|
||||
$_GET['socid'] = $_GET['socid_id'];
|
||||
$_POST['socid'] = $_POST['socid_id'];
|
||||
$_REQUEST['socid'] = $_REQUEST['socid_id'];
|
||||
}
|
||||
|
||||
if ($projectid == '' && $projectref == '' && ($_GET['action'] != "create" && $_POST['action'] != "add" && $_POST["action"] != "update" && !$_POST["cancel"])) accessforbidden();
|
||||
|
||||
$mine = $_REQUEST['mode']=='mine' ? 1 : 0;
|
||||
|
||||
@@ -52,14 +52,14 @@ dol_syslog(join(',',$_GET));
|
||||
|
||||
|
||||
// Generation liste des societes
|
||||
if (! empty($_POST['newcompany']) || ! empty($_GET['socid']) || ! empty($_POST['id_fourn']))
|
||||
if (! empty($_GET['newcompany']) || ! empty($_GET['socid']) || ! empty($_GET['id_fourn']))
|
||||
{
|
||||
$return_arr = array();
|
||||
|
||||
// Define filter on text typed
|
||||
$socid = $_POST['newcompany']?$_POST['newcompany']:'';
|
||||
$socid = $_GET['newcompany']?$_GET['newcompany']:'';
|
||||
if (! $socid) $socid = $_GET['socid']?$_GET['socid']:'';
|
||||
if (! $socid) $socid = $_POST['id_fourn']?$_POST['id_fourn']:'';
|
||||
if (! $socid) $socid = $_GET['id_fourn']?$_GET['id_fourn']:'';
|
||||
|
||||
$sql = "SELECT rowid, nom";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
|
||||
Reference in New Issue
Block a user