forked from Wavyzz/dolibarr
Add: dbut ajout autocompletion ajax sur la liste des socits
This commit is contained in:
@@ -64,26 +64,6 @@ if ($_POST["action"] == 'multiprix')
|
||||
dolibarr_print_error($db);
|
||||
exit;
|
||||
}
|
||||
// on cr<63>e la table societe_prices
|
||||
else
|
||||
{
|
||||
/*
|
||||
* La table est desormais cree par un fichier SQL comme les autres tables
|
||||
*
|
||||
* $table = MAIN_DB_PREFIX."societe_prices";
|
||||
* $fields['rowid'] = array('type'=>'int','value'=>'11','null'=>'not null','extra'=> 'auto_increment');
|
||||
* $fields['fk_soc'] = array('type'=>'int','value'=>'11','null'=>'not null','default'=> '0');
|
||||
* $fields['tms'] = array('type'=>'timestamp','value'=>'14','null'=>'not null');
|
||||
* $fields['datec'] = array('type'=>'datetime','default'=> 'null');
|
||||
* $fields['fk_user_author'] = array('type'=>'int','value'=>'11','default'=> 'null');
|
||||
* $fields['price_level'] = array('type'=>'tinyint','value'=>'4','default'=> '1');
|
||||
* if ($db->DDLCreateTable($table,$fields,"rowid","InnoDB") < 0)
|
||||
* {
|
||||
* dolibarr_print_error($db);
|
||||
* exit;
|
||||
* }
|
||||
*/
|
||||
}
|
||||
}
|
||||
dolibarr_set_const($db, "PRODUIT_MULTIPRICES", $_POST["activate_multiprix"]);
|
||||
dolibarr_set_const($db, "PRODUIT_MULTIPRICES_LIMIT", "6");
|
||||
|
||||
@@ -65,6 +65,19 @@ if ($_GET["action"] == 'setcodecompta')
|
||||
}
|
||||
}
|
||||
|
||||
if ($_POST["action"] == 'usesearchtoselectcompany')
|
||||
{
|
||||
if (dolibarr_set_const($db, "COMPANY_USE_SEARCH_TO_SELECT", $_POST["activate_usesearchtoselectcompany"]))
|
||||
{
|
||||
Header("Location: ".$_SERVER["PHP_SELF"]);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Affichage page configuration module societe
|
||||
@@ -201,40 +214,38 @@ print '<br>';
|
||||
|
||||
|
||||
// Autres options
|
||||
/*
|
||||
print_titre($langs->trans("OtherOptions"));
|
||||
|
||||
$html=new Form($db);
|
||||
$var=true;
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Parameter").'</td>';
|
||||
print '<td>'.$langs->trans("Value").'</td>';
|
||||
print '<td>'.$langs->trans("Description").'</td>';
|
||||
print '<td> </td>';
|
||||
print "</tr>\n";
|
||||
|
||||
print '<form action="'.$_SERVER["societe.php"].'" method="POST">';
|
||||
print '<input type="hidden" name="action" value="setxxx">';
|
||||
print '<input type="hidden" name="constname" value="XXX">';
|
||||
print " <td>".$langs->trans("Parameters")."</td>\n";
|
||||
print " <td align=\"right\" width=\"60\">".$langs->trans("Value")."</td>\n";
|
||||
print " <td width=\"80\"> </td></tr>\n";
|
||||
|
||||
// utilisation formulaire Ajax sur choix soci<63>t<EFBFBD>
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].' class="value">';
|
||||
print '<td nowrap="nowrap">'.$langs->trans("UseXXX")."</td>\n";
|
||||
print '<td>';
|
||||
print $form->selectyesno('constvalue',! $conf->global->XXX,1);
|
||||
print '</td>';
|
||||
print '<td>'.$langs->trans("XXXDesc").'</td>';
|
||||
print '<td align="right">';
|
||||
print '<input class="button" type="submit" value="'.$langs->trans('Modify').'" name="button"> ';
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
print "<form method=\"post\" action=\"societe.php\">";
|
||||
print "<input type=\"hidden\" name=\"action\" value=\"usesearchtoselectcompany\">";
|
||||
print "<tr ".$bc[$var].">";
|
||||
print '<td width="80%">'.$langs->trans("UseSearchToSelectCompany").'</td>';
|
||||
if (! $conf->use_ajax)
|
||||
{
|
||||
print '<td nowrap="nowrap" align="right" colspan="2">';
|
||||
print $langs->trans("NotAvailableWhenAjaxDisabled");
|
||||
print "</td>";
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td width="60" align="right">';
|
||||
print $html->selectyesno("activate_usesearchtoselectcompany",$conf->global->COMPANY_USE_SEARCH_TO_SELECT,1);
|
||||
print '</td><td align="right">';
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
||||
print "</td>";
|
||||
}
|
||||
print '</tr>';
|
||||
print '</form>';
|
||||
|
||||
print "</table>\n";
|
||||
*/
|
||||
|
||||
print '</table>';
|
||||
|
||||
$db->close();
|
||||
|
||||
|
||||
@@ -387,7 +387,7 @@ class CommonObject
|
||||
// On recherche les societes
|
||||
$sql = "SELECT s.rowid, s.nom FROM";
|
||||
$sql .= " ".MAIN_DB_PREFIX."societe as s";
|
||||
if ($conf->use_ajax && $conf->global->CODE_DE_TEST == 1)
|
||||
if ($conf->use_ajax && $conf->global->COMPANY_USE_SEARCH_TO_SELECT)
|
||||
{
|
||||
$sql.= " WHERE rowid = ".$selected;
|
||||
}
|
||||
@@ -396,7 +396,7 @@ class CommonObject
|
||||
$resql = $object->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
if ($conf->use_ajax && $conf->global->CODE_DE_TEST == 1)
|
||||
if ($conf->use_ajax && $conf->global->COMPANY_USE_SEARCH_TO_SELECT)
|
||||
{
|
||||
$langs->load("companies");
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
@@ -406,6 +406,8 @@ class CommonObject
|
||||
// On applique un delai d'execution pour le bon fonctionnement
|
||||
$htmloption = 'onChange="ac_delay(\''.$javaScript.'\',\'500\')"';
|
||||
|
||||
print '<table class="nobordernopadding"><tr class="nocellnopadd">';
|
||||
print '<td class="nobordernopadding">';
|
||||
print '<div>';
|
||||
if ($obj->rowid == 0)
|
||||
{
|
||||
@@ -415,8 +417,12 @@ class CommonObject
|
||||
{
|
||||
print '<input type="text" size="30" id="newcompany" name="newcompany" value="'.$obj->nom.'" '.$htmloption.' />';
|
||||
}
|
||||
|
||||
print ajax_autocompleter($socid,'newcompany','/societe/ajaxcompanies.php','working');
|
||||
print ajax_autocompleter($socid,'newcompany','/societe/ajaxcompanies.php','');
|
||||
print '</td>';
|
||||
print '<td class="nobordernopadding" align="left" width="16">';
|
||||
print ajax_indicator($htmlname,'working');
|
||||
print '</td></tr>';
|
||||
print '</table>';
|
||||
return $socid;
|
||||
}
|
||||
else
|
||||
|
||||
@@ -409,7 +409,6 @@ class Form
|
||||
}
|
||||
|
||||
print ajax_autocompleter($pays_id,'pays','/societe/ajaxcountries.php','working');
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -893,7 +892,7 @@ class Form
|
||||
print '<td class="nobordernopadding" width="80" nowrap="nowrap">';
|
||||
print $langs->trans("RefOrLabel").':</td>';
|
||||
print '<td class="nobordernopadding" align="left" width="16">';
|
||||
print ajax_updater_indicator($htmlname,'working');
|
||||
print ajax_indicator($htmlname,'working');
|
||||
print '</td>';
|
||||
print '<td align="left"><input type="text" size="16" name="keysearch'.$htmlname.'" id="keysearch'.$htmlname.'"> ';
|
||||
print '</td>';
|
||||
|
||||
@@ -21,6 +21,7 @@ DictionnarySetup=Dictionnary setup
|
||||
DisableJavascript=Disable JavaScript functions
|
||||
DisableAjax=Disable AJAX functions
|
||||
UseSearchToSelectProduct=Use a search form to choose a product (intead of using a list box)
|
||||
UseSearchToSelectProduct=Use a search form to choose a company (intead of using a list box)
|
||||
NotAvailableWhenAjaxDisabled=Not available when Ajax disabled
|
||||
JavascriptDisabled=JavaScript disabled
|
||||
UsePopupCalendar=Use popup for dates input
|
||||
|
||||
@@ -21,6 +21,7 @@ DictionnarySetup=Dictionnaires
|
||||
DisableJavascript=D<>sactiver les fonctions javascript
|
||||
DisableAjax=D<>sactiver les fonctions ajax
|
||||
UseSearchToSelectProduct=Utiliser un formulaire de recherche pour choix d'un produit (plut<75>t que liste d<>roulante)
|
||||
UseSearchToSelectCompany=Utiliser un formulaire de recherche pour choix d'un tiers (plut<75>t que liste d<>roulante)
|
||||
NotAvailableWhenAjaxDisabled=Non disponible quand Ajax d<>sactiv<69>
|
||||
JavascriptDisabled=Javascript d<>sactiv<69>
|
||||
UsePopupCalendar=Utiliser les popups pour la saisie des dates
|
||||
|
||||
@@ -2733,7 +2733,7 @@ function num_lines($texte)
|
||||
return $nblines;
|
||||
}
|
||||
|
||||
function ajax_updater_indicator($htmlname,$indicator='working')
|
||||
function ajax_indicator($htmlname,$indicator='working')
|
||||
{
|
||||
$script.='<span id="indicator'.$htmlname.'" style="display: none">'.img_picto('Working...',$indicator.'.gif').'</span>';
|
||||
return $script;
|
||||
@@ -2751,7 +2751,7 @@ function ajax_updater_indicator($htmlname,$indicator='working')
|
||||
function ajax_updater($htmlname,$keysearch,$url,$option='',$indicator='working')
|
||||
{
|
||||
$script = '<input type="hidden" name="'.$htmlname.'" id="'.$htmlname.'" value="">';
|
||||
if ($indicator) $script.=ajax_updater_indicator($htmlname,$indicator);
|
||||
if ($indicator) $script.=ajax_indicator($htmlname,$indicator);
|
||||
$script.='<script type="text/javascript">';
|
||||
$script.='var myIndicator'.$htmlname.' = {
|
||||
onCreate: function(){
|
||||
@@ -2791,7 +2791,7 @@ function ajax_updater($htmlname,$keysearch,$url,$option='',$indicator='working')
|
||||
*/
|
||||
function ajax_autocompleter($selected='',$htmlname,$url,$indicator='working')
|
||||
{
|
||||
$script.= '<span id="indicator'.$htmlname.'" style="display: none">'.img_picto('Working...',$indicator.'.gif').'</span>';
|
||||
if ($indicator) $script.= ajax_indicator($htmlname,$indicator);
|
||||
$script.= '<input type="hidden" name="'.$htmlname.'_id" id="'.$htmlname.'_id" value="'.$selected.'" />';
|
||||
$script.= '</div>';
|
||||
$script.= '<div id="result'.$htmlname.'" class="autocomplete"></div>';
|
||||
|
||||
Reference in New Issue
Block a user