Doxygen
This commit is contained in:
parent
5738d6de98
commit
0ccd29c6cd
@ -25,8 +25,9 @@
|
||||
|
||||
|
||||
/**
|
||||
* Get value of an HTML field, do Ajax process and show result.
|
||||
* Generic function that return javascript to add to a page to transform a common input field into an autocomplete field by calling an Ajax page (ex: /societe/ajaxcompanies.php).
|
||||
* The HTML field must be an input text with id=search_$htmlname.
|
||||
* This use the jQuery "autocomplete" function.
|
||||
*
|
||||
* @param string $selected Preselecte value
|
||||
* @param string $htmlname HTML name of input field
|
||||
@ -34,7 +35,7 @@
|
||||
* @param string $urloption More parameters on URL request
|
||||
* @param int $minLength Minimum number of chars to trigger that Ajax search
|
||||
* @param int $autoselect Automatic selection if just one value
|
||||
* @param array $ajaxoptions Multiple options array (Ex: array('update'=>array('field1','field2'...)) will reset field1 and field2 once select done
|
||||
* @param array $ajaxoptions Multiple options array (Ex: array('update'=>array('field1','field2'...)) will reset field1 and field2 once select done)
|
||||
* @return string Script
|
||||
*/
|
||||
function ajax_autocompleter($selected, $htmlname, $url, $urloption='', $minLength=2, $autoselect=0, $ajaxoptions=array())
|
||||
@ -182,25 +183,28 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption='', $minLengt
|
||||
}
|
||||
|
||||
/**
|
||||
* Get value of field, do Ajax process and return result
|
||||
* Generic function that return javascript to add to a page to transform a common input field into an autocomplete field by calling an Ajax page (ex: core/ajax/ziptown.php).
|
||||
* The Ajax page can also returns several values (json format) to fill several input fields.
|
||||
* The HTML field must be an input text with id=$htmlname.
|
||||
* This use the jQuery "autocomplete" function.
|
||||
*
|
||||
* @param string $htmlname Name of field
|
||||
* @param string $fields other fields to autocomplete
|
||||
* @param string $url Chemin du fichier de reponse : /chemin/fichier.php
|
||||
* @param string $htmlname HTML name of input field
|
||||
* @param string $fields Other fields to autocomplete
|
||||
* @param string $url URL for ajax request : /chemin/fichier.php
|
||||
* @param string $option More parameters on URL request
|
||||
* @param int $minLength Minimum number of chars to trigger that Ajax search
|
||||
* @param int $autoselect Automatic selection if just one value
|
||||
* @return string Script
|
||||
*/
|
||||
function ajax_multiautocompleter($htmlname,$fields,$url,$option='',$minLength=2,$autoselect=0)
|
||||
function ajax_multiautocompleter($htmlname, $fields, $url, $option='', $minLength=2, $autoselect=0)
|
||||
{
|
||||
$script = '<!-- Autocomplete -->'."\n";
|
||||
$script.= '<script type="text/javascript">';
|
||||
$script.= 'jQuery(document).ready(function() {
|
||||
var fields = '.json_encode($fields).';
|
||||
var length = fields.length;
|
||||
var nboffields = fields.length;
|
||||
var autoselect = '.$autoselect.';
|
||||
//alert(fields + " " + length);
|
||||
//alert(fields + " " + nboffields);
|
||||
|
||||
jQuery("input#'.$htmlname.'").autocomplete({
|
||||
dataType: "json",
|
||||
@ -214,7 +218,7 @@ function ajax_multiautocompleter($htmlname,$fields,$url,$option='',$minLength=2,
|
||||
if (item.states) {
|
||||
jQuery("#state_id").html(item.states);
|
||||
}
|
||||
for (i=0;i<length;i++) {
|
||||
for (i=0;i<nboffields;i++) {
|
||||
if (item[fields[i]]) { // If defined
|
||||
//alert(item[fields[i]]);
|
||||
jQuery("#" + fields[i]).val(item[fields[i]]);
|
||||
@ -226,8 +230,7 @@ function ajax_multiautocompleter($htmlname,$fields,$url,$option='',$minLength=2,
|
||||
});
|
||||
},
|
||||
select: function( event, ui ) {
|
||||
|
||||
for (i=0;i<length;i++) {
|
||||
for (i=0;i<nboffields;i++) {
|
||||
//alert(fields[i] + " = " + ui.item[fields[i]]);
|
||||
if (fields[i]=="selectcountry_id")
|
||||
{
|
||||
|
||||
@ -21,7 +21,7 @@
|
||||
|
||||
/**
|
||||
* \file htdocs/fichinter/fiche.php
|
||||
* \brief Fichier fiche intervention
|
||||
* \brief Page of intervention
|
||||
* \ingroup ficheinter
|
||||
*/
|
||||
|
||||
@ -200,7 +200,7 @@ else if ($action == 'add' && $user->rights->ficheinter->creer)
|
||||
$extrafields = new ExtraFields($db);
|
||||
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
|
||||
$array_option = $extrafields->getOptionalsFromPost($extralabels);
|
||||
|
||||
|
||||
$object->array_options = $array_option;
|
||||
|
||||
$id = $object->create($user);
|
||||
@ -278,7 +278,7 @@ else if ($action == 'add' && $user->rights->ficheinter->creer)
|
||||
$extrafieldsline = new ExtraFields($db);
|
||||
$extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line);
|
||||
$array_option = $extrafieldsline->getOptionalsFromPost($extralabelsline, $predef);
|
||||
|
||||
|
||||
|
||||
$result = $object->addline(
|
||||
$user,
|
||||
@ -317,9 +317,9 @@ else if ($action == 'add' && $user->rights->ficheinter->creer)
|
||||
$extrafields = new ExtraFields($db);
|
||||
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
|
||||
$array_option = $extrafields->getOptionalsFromPost($extralabels);
|
||||
|
||||
|
||||
$object->array_options = $array_option;
|
||||
|
||||
|
||||
$result = $object->create($user);
|
||||
if ($result > 0)
|
||||
{
|
||||
@ -455,7 +455,7 @@ else if ($action == "addline" && $user->rights->ficheinter->creer)
|
||||
$date_intervention = dol_mktime(GETPOST('dihour','int'), GETPOST('dimin','int'), 0, GETPOST('dimonth','int'), GETPOST('diday','int'), GETPOST('diyear','int'));
|
||||
$duration = convertTime2Seconds(GETPOST('durationhour','int'), GETPOST('durationmin','int'));
|
||||
|
||||
|
||||
|
||||
// Extrafields
|
||||
$extrafieldsline = new ExtraFields($db);
|
||||
$extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line);
|
||||
@ -553,7 +553,7 @@ else if ($action == 'updateline' && $user->rights->ficheinter->creer && GETPOST(
|
||||
$objectline->datei = $date_inter;
|
||||
$objectline->desc = $desc;
|
||||
$objectline->duration = $duration;
|
||||
|
||||
|
||||
// Extrafields
|
||||
$extrafieldsline = new ExtraFields($db);
|
||||
$extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line);
|
||||
@ -1469,18 +1469,18 @@ else if ($id > 0 || ! empty($ref))
|
||||
}
|
||||
|
||||
print '</tr>';
|
||||
|
||||
|
||||
$line = new FichinterLigne($db);
|
||||
$line->fetch($objp->rowid);
|
||||
|
||||
|
||||
$extrafieldsline = new ExtraFields($db);
|
||||
$extralabelslines=$extrafieldsline->fetch_name_optionals_label($line->table_element);
|
||||
|
||||
|
||||
$line->fetch_optionals($line->rowid, $extralabelslines);
|
||||
|
||||
|
||||
print $line->showOptionals($extrafieldsline, 'view', array('style'=>$bc[$var], 'colspan'=>5));
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
// Line in update mode
|
||||
@ -1509,17 +1509,17 @@ else if ($id > 0 || ! empty($ref))
|
||||
print '<td align="center" colspan="5" valign="center"><input type="submit" class="button" name="save" value="'.$langs->trans("Save").'">';
|
||||
print '<br><input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'"></td>';
|
||||
print '</tr>' . "\n";
|
||||
|
||||
|
||||
$line = new FichinterLigne($db);
|
||||
$line->fetch($objp->rowid);
|
||||
|
||||
|
||||
$extrafieldsline = new ExtraFields($db);
|
||||
$extralabelslines=$extrafieldsline->fetch_name_optionals_label($line->table_element);
|
||||
$line->fetch_optionals($line->rowid, $extralabelslines);
|
||||
|
||||
|
||||
print $line->showOptionals($extrafieldsline, 'edit', array('style'=>$bc[$var], 'colspan'=>5));
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
$i++;
|
||||
@ -1570,16 +1570,16 @@ else if ($id > 0 || ! empty($ref))
|
||||
|
||||
print '<td align="center" valign="middle" colspan="4"><input type="submit" class="button" value="'.$langs->trans('Add').'" name="addline"></td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
//Line extrafield
|
||||
|
||||
|
||||
$lineadd = new FichinterLigne($db);
|
||||
|
||||
|
||||
$extrafieldsline = new ExtraFields($db);
|
||||
$extralabelslines=$extrafieldsline->fetch_name_optionals_label($lineadd->table_element);
|
||||
|
||||
|
||||
print $lineadd->showOptionals($extrafieldsline, 'edit', array('style'=>$bc[$var], 'colspan'=>5));
|
||||
|
||||
|
||||
if (! $num) print '</table>';
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user