本文整理汇总了PHP中ajax_combobox函数的典型用法代码示例。如果您正苦于以下问题:PHP ajax_combobox函数的具体用法?PHP ajax_combobox怎么用?PHP ajax_combobox使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ajax_combobox函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: select_resource_list
/**
* Output html form to select a resource
*
* @param string $selected Preselected type
* @param string $htmlname Name of field in form
* @param string $filter Optionnal filters criteras (example: 's.rowid <> x')
* @param int $showempty Add an empty field
* @param int $showtype Show third party type in combolist (customer, prospect or supplier)
* @param int $forcecombo Force to use combo box
* @param array $event Event options. Example: array(array('method'=>'getContacts', 'url'=>dol_buildpath('/core/ajax/contacts.php',1), 'htmlname'=>'contactid', 'params'=>array('add-customer-contact'=>'disabled')))
* @param string $filterkey Filter on key value
* @param int $outputmode 0=HTML select string, 1=Array, 2=without form tag
* @param int $limit Limit number of answers
* @return string HTML string with
*/
function select_resource_list($selected = '', $htmlname = 'fk_resource', $filter = '', $showempty = 0, $showtype = 0, $forcecombo = 0, $event = array(), $filterkey = '', $outputmode = 0, $limit = 20)
{
global $conf, $user, $langs;
$out = '';
$outarray = array();
$resourcestat = new Resource($this->db);
$resources_used = $resourcestat->fetch_all('ASC', 't.rowid', $limit, $offset, $filter = '');
if ($outputmode != 2) {
$out = '<form action="' . $_SERVER["PHP_SELF"] . '" method="POST">';
$out .= '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
}
//$out.= '<input type="hidden" name="action" value="search">';
//$out.= '<input type="hidden" name="id" value="'.$theme->id.'">';
if ($resourcestat) {
if ($conf->use_javascript_ajax && $conf->global->COMPANY_USE_SEARCH_TO_SELECT && !$forcecombo) {
//$minLength = (is_numeric($conf->global->COMPANY_USE_SEARCH_TO_SELECT)?$conf->global->COMPANY_USE_SEARCH_TO_SELECT:2);
$out .= ajax_combobox($htmlname, $event, $conf->global->COMPANY_USE_SEARCH_TO_SELECT);
}
// Construct $out and $outarray
$out .= '<select id="' . $htmlname . '" class="flat" name="' . $htmlname . '">' . "\n";
if ($showempty) {
$out .= '<option value="-1"></option>' . "\n";
}
$num = count($resourcestat->lines);
//var_dump($resourcestat->lines);
$i = 0;
if ($num) {
while ($i < $num) {
$label = $langs->trans(ucfirst($resourcestat->lines[$i]->element)) . ' : ';
$label .= $resourcestat->lines[$i]->ref ? $resourcestat->lines[$i]->ref : '' . $resourcestat->lines[$i]->label;
if ($selected > 0 && $selected == $resourcestat->lines[$i]->id) {
$out .= '<option value="' . $resourcestat->lines[$i]->id . '" selected="selected">' . $label . '</option>';
} else {
$out .= '<option value="' . $resourcestat->lines[$i]->id . '">' . $label . '</option>';
}
array_push($outarray, array('key' => $resourcestat->lines[$i]->id, 'value' => $resourcestat->lines[$i]->label, 'label' => $resourcestat->lines[$i]->label));
$i++;
if ($i % 10 == 0) {
$out .= "\n";
}
}
}
$out .= '</select>' . "\n";
if ($outputmode != 2) {
$out .= '<input type="submit" class="button" value="' . $langs->trans("Search") . '"> ';
$out .= '</form>';
}
} else {
dol_print_error($this->db);
}
if ($outputmode && $outputmode != 2) {
return $outarray;
}
return $out;
}
示例2: empty
$dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE) ? -1 : '';
// Dot not set 0 here (0 for a date is 1970)
} else {
$cond_reglement_id = $soc->cond_reglement_id;
$mode_reglement_id = $soc->mode_reglement_id;
$fk_account = $soc->fk_account;
$remise_percent = $soc->remise_percent;
$remise_absolue = 0;
$dateinvoice = empty($dateinvoice) ? empty($conf->global->MAIN_AUTOFILL_DATE) ? -1 : '' : $dateinvoice;
// Do not set 0 here (0 for a date is 1970)
}
$absolute_discount = $soc->getAvailableDiscounts();
if (!empty($conf->use_javascript_ajax)) {
require_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
print ajax_combobox('fac_replacement');
print ajax_combobox('fac_avoir');
}
print '<form name="add" action="' . $_SERVER["PHP_SELF"] . '" method="POST">';
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
print '<input type="hidden" name="action" value="add">';
if ($soc->id > 0) {
print '<input type="hidden" name="socid" value="' . $soc->id . '">' . "\n";
}
print '<input name="facnumber" type="hidden" value="provisoire">';
print '<input name="ref_client" type="hidden" value="' . $ref_client . '">';
print '<input name="ref_int" type="hidden" value="' . $ref_int . '">';
print '<input type="hidden" name="origin" value="' . $origin . '">';
print '<input type="hidden" name="originid" value="' . $originid . '">';
print '<table class="border" width="100%">';
// Ref
print '<tr><td class="fieldrequired">' . $langs->trans('Ref') . '</td><td colspan="2">' . $langs->trans('Draft') . '</td></tr>';
示例3: selectTasks
/**
* Output a combo list with projects qualified for a third party
*
* @param int $socid Id third party (-1=all, 0=only projects not linked to a third party, id=projects not linked or linked to third party id)
* @param int $selected Id task preselected
* @param string $htmlname Name of HTML select
* @param int $maxlength Maximum length of label
* @param int $option_only Return only html options lines without the select tag
* @param int $show_empty Add an empty line
* @param int $discard_closed Discard closed projects (0=Keep,1=hide completely,2=Disable)
* @param int $forcefocus Force focus on field (works with javascript only)
* @param int $disabled Disabled
* @return int Nbr of project if OK, <0 if KO
*/
function selectTasks($socid = -1, $selected = '', $htmlname = 'taskid', $maxlength = 24, $option_only = 0, $show_empty = 1, $discard_closed = 0, $forcefocus = 0, $disabled = 0)
{
global $user, $conf, $langs;
require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
$out = '';
$hideunselectables = false;
if (!empty($conf->global->PROJECT_HIDE_UNSELECTABLES)) {
$hideunselectables = true;
}
$projectsListId = false;
if (empty($user->rights->projet->all->lire)) {
$projectstatic = new Project($this->db);
$projectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 1);
}
// Search all projects
$sql = 'SELECT t.rowid, t.ref as tref, t.label as tlabel, p.ref, p.title, p.fk_soc, p.fk_statut, p.public,';
$sql .= ' s.nom as name';
$sql .= ' FROM ' . MAIN_DB_PREFIX . 'projet as p';
$sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'societe as s ON s.rowid = p.fk_soc';
$sql .= ', ' . MAIN_DB_PREFIX . 'projet_task as t';
$sql .= " WHERE p.entity = " . $conf->entity;
$sql .= " AND t.fk_projet = p.rowid";
if ($projectsListId !== false) {
$sql .= " AND p.rowid IN (" . $projectsListId . ")";
}
if ($socid == 0) {
$sql .= " AND (p.fk_soc=0 OR p.fk_soc IS NULL)";
}
if ($socid > 0) {
$sql .= " AND (p.fk_soc=" . $socid . " OR p.fk_soc IS NULL)";
}
$sql .= " ORDER BY p.ref, t.ref ASC";
dol_syslog(__METHOD__, LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql) {
$minmax = '';
// Use select2 selector
$nodatarole = '';
if (!empty($conf->use_javascript_ajax)) {
include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
$comboenhancement = ajax_combobox($htmlname, '', 0, $forcefocus);
$out .= $comboenhancement;
$nodatarole = $comboenhancement ? ' data-role="none"' : '';
$minmax = 'minwidth200';
}
if (empty($option_only)) {
$out .= '<select class="flat' . ($minmax ? ' ' . $minmax : '') . '"' . ($disabled ? ' disabled="disabled"' : '') . ' id="' . $htmlname . '" name="' . $htmlname . '"' . $nodatarole . '>';
}
if (!empty($show_empty)) {
$out .= '<option value="0"> </option>';
}
$num = $this->db->num_rows($resql);
$i = 0;
if ($num) {
while ($i < $num) {
$obj = $this->db->fetch_object($resql);
// If we ask to filter on a company and user has no permission to see all companies and project is linked to another company, we hide project.
if ($socid > 0 && (empty($obj->fk_soc) || $obj->fk_soc == $socid) && !$user->rights->societe->lire) {
// Do nothing
} else {
if ($discard_closed == 1 && $obj->fk_statut == 2) {
$i++;
continue;
}
$labeltoshow = dol_trunc($obj->ref, 18);
//if ($obj->public) $labeltoshow.=' ('.$langs->trans("SharedProject").')';
//else $labeltoshow.=' ('.$langs->trans("Private").')';
$labeltoshow .= ' ' . dol_trunc($obj->title, $maxlength);
if ($obj->name) {
$labeltoshow .= ' (' . $obj->name . ')';
}
$disabled = 0;
if ($obj->fk_statut == 0) {
$disabled = 1;
$labeltoshow .= ' - ' . $langs->trans("Draft");
} else {
if ($obj->fk_statut == 2) {
if ($discard_closed == 2) {
$disabled = 1;
}
$labeltoshow .= ' - ' . $langs->trans("Closed");
} else {
if ($socid > 0 && (!empty($obj->fk_soc) && $obj->fk_soc != $socid)) {
$disabled = 1;
$labeltoshow .= ' - ' . $langs->trans("LinkedToAnotherCompany");
}
//.........这里部分代码省略.........
示例4: select_pcgsubtype
/**
* Return list of accounts with label by sub_class of accounts
*
* @param string $selectid Preselected pcg_type
* @param string $htmlname Name of field in html form
* @param int $showempty Add an empty field
* @param array $event Event options
*
* @return string String with HTML select
*/
function select_pcgsubtype($selectid, $htmlname = 'pcg_subtype', $showempty = 0, $event = array())
{
global $conf;
$out = '';
$sql = "SELECT DISTINCT pcg_subtype ";
$sql .= " FROM " . MAIN_DB_PREFIX . "accountingaccount as aa";
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version";
$sql .= " AND asy.rowid = " . $conf->global->CHARTOFACCOUNTS;
$sql .= " ORDER BY pcg_subtype";
dol_syslog(get_class($this) . "::select_pcgsubtype sql=" . $sql, LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql) {
$out .= ajax_combobox($htmlname, $event);
$out .= '<select id="' . $htmlname . '" class="flat" name="' . $htmlname . '">';
if ($showempty) {
$out .= '<option value="-1"></option>';
}
$num = $this->db->num_rows($resql);
$i = 0;
if ($num) {
while ($i < $num) {
$obj = $this->db->fetch_object($resql);
$label = $obj->pcg_subtype;
if ($selectid != '' && $selectid == $obj->pcg_subtype) {
$out .= '<option value="' . $obj->pcg_subtype . '" selected>' . $label . '</option>';
} else {
$out .= '<option value="' . $obj->pcg_subtype . '">' . $label . '</option>';
}
$i++;
}
}
$out .= '</select>';
} else {
$this->error = "Error " . $this->db->lasterror();
dol_syslog(get_class($this) . "::select_pcgsubtype " . $this->error, LOG_ERR);
return -1;
}
$this->db->free($resql);
return $out;
}
示例5: select_salesrepresentatives
/**
* Return select list for categories (to use in form search selectors)
*
* @param string $selected Preselected value
* @param string $htmlname Name of combo list (example: 'search_sale')
* @param User $user Object user
* @param int $showstatus 0=show user status only if status is disabled, 1=always show user status into label, -1=never show user status
* @param int $showempty 1=show also an empty value
* @param string $morecss More CSS
* @return string Html combo list code
*/
function select_salesrepresentatives($selected, $htmlname, $user, $showstatus = 0, $showempty = 1, $morecss = '')
{
global $conf, $langs;
$langs->load('users');
$out = '';
$nodatarole = '';
// Enhance with select2
if ($conf->use_javascript_ajax) {
include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
$comboenhancement = ajax_combobox($htmlname);
if ($comboenhancement) {
$out .= $comboenhancement;
$nodatarole = $comboenhancement ? ' data-role="none"' : '';
}
}
// Select each sales and print them in a select input
$out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" id="' . $htmlname . '" name="' . $htmlname . '"' . $nodatarole . '>';
if ($showempty) {
$out .= '<option value="0"> </option>';
}
// Get list of users allowed to be viewed
$sql_usr = "SELECT u.rowid, u.lastname, u.firstname, u.statut, u.login";
$sql_usr .= " FROM " . MAIN_DB_PREFIX . "user as u";
$sql_usr .= " WHERE u.entity IN (0," . $conf->entity . ")";
if (empty($user->rights->user->user->lire)) {
$sql_usr .= " AND u.rowid = " . $user->id;
}
if (!empty($user->societe_id)) {
$sql_usr .= " AND u.fk_soc = " . $user->societe_id;
}
// Add existing sales representatives of thirdparty of external user
if (empty($user->rights->user->user->lire) && $user->societe_id) {
$sql_usr .= " UNION ";
$sql_usr .= "SELECT u2.rowid, u2.lastname, u2.firstname, u2.statut, u2.login";
$sql_usr .= " FROM " . MAIN_DB_PREFIX . "user as u2, " . MAIN_DB_PREFIX . "societe_commerciaux as sc";
$sql_usr .= " WHERE u2.entity IN (0," . $conf->entity . ")";
$sql_usr .= " AND u2.rowid = sc.fk_user AND sc.fk_soc=" . $user->societe_id;
}
$sql_usr .= " ORDER BY lastname ASC";
//print $sql_usr;exit;
$resql_usr = $this->db->query($sql_usr);
if ($resql_usr) {
while ($obj_usr = $this->db->fetch_object($resql_usr)) {
$out .= '<option value="' . $obj_usr->rowid . '"';
if ($obj_usr->rowid == $selected) {
$out .= ' selected';
}
$out .= '>';
$out .= dolGetFirstLastname($obj_usr->firstname, $obj_usr->lastname);
// Complete name with more info
$moreinfo = 0;
if (!empty($conf->global->MAIN_SHOW_LOGIN)) {
$out .= ($moreinfo ? ' - ' : ' (') . $obj_usr->login;
$moreinfo++;
}
if ($showstatus >= 0) {
if ($obj_usr->statut == 1 && $showstatus == 1) {
$out .= ($moreinfo ? ' - ' : ' (') . $langs->trans('Enabled');
$moreinfo++;
}
if ($obj_usr->statut == 0) {
$out .= ($moreinfo ? ' - ' : ' (') . $langs->trans('Disabled');
$moreinfo++;
}
}
$out .= $moreinfo ? ')' : '';
$out .= '</option>';
}
$this->db->free($resql_usr);
} else {
dol_print_error($this->db);
}
$out .= '</select>';
return $out;
}
示例6: select_company
/**
* Output html form to select a third party
* @param selected Preselected type
* @param htmlname Name of field in form
* @param filter Optionnal filters criteras
* @param showempty Add an empty field
* @param showtype Show third party type in combolist (customer, prospect or supplier)
* @param forcecombo Force to use combo box
*/
function select_company($selected = '', $htmlname = 'socid', $filter = '', $showempty = 0, $showtype = 0, $forcecombo = 0)
{
global $conf, $user, $langs;
$out = '';
// On recherche les societes
$sql = "SELECT s.rowid, s.nom, s.client, s.fournisseur, s.code_client, s.code_fournisseur";
$sql .= " FROM " . MAIN_DB_PREFIX . "societe as s";
if (!$user->rights->societe->client->voir && !$user->societe_id) {
$sql .= ", " . MAIN_DB_PREFIX . "societe_commerciaux as sc";
}
$sql .= " WHERE s.entity = " . $conf->entity;
if ($filter) {
$sql .= " AND " . $filter;
}
if (!$user->rights->societe->client->voir && !$user->societe_id) {
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " . $user->id;
}
$sql .= " ORDER BY nom ASC";
dol_syslog("Form::select_societes sql=" . $sql);
$resql = $this->db->query($sql);
if ($resql) {
if ($conf->use_javascript_ajax && $conf->global->COMPANY_USE_SEARCH_TO_SELECT && !$forcecombo) {
//$minLength = (is_numeric($conf->global->COMPANY_USE_SEARCH_TO_SELECT)?$conf->global->COMPANY_USE_SEARCH_TO_SELECT:2);
$out .= ajax_combobox($htmlname);
}
$out .= '<select id="' . $htmlname . '" class="flat" name="' . $htmlname . '">';
if ($showempty) {
$out .= '<option value="-1"> </option>';
}
$num = $this->db->num_rows($resql);
$i = 0;
if ($num) {
while ($i < $num) {
$obj = $this->db->fetch_object($resql);
$label = $obj->nom;
if ($showtype) {
if ($obj->client || $obj->fournisseur) {
$label .= ' (';
}
if ($obj->client == 1 || $obj->client == 3) {
$label .= $langs->trans("Customer");
}
if ($obj->client == 2 || $obj->client == 3) {
$label .= ($obj->client == 3 ? ', ' : '') . $langs->trans("Prospect");
}
if ($obj->fournisseur) {
$label .= ($obj->client ? ', ' : '') . $langs->trans("Supplier");
}
if ($obj->client || $obj->fournisseur) {
$label .= ')';
}
}
if ($selected > 0 && $selected == $obj->rowid) {
$out .= '<option value="' . $obj->rowid . '" selected="selected">' . $label . '</option>';
} else {
$out .= '<option value="' . $obj->rowid . '">' . $label . '</option>';
}
$i++;
}
}
$out .= '</select>';
} else {
dol_print_error($this->db);
}
return $out;
}
示例7: ajax_combobox
}
else // error
{
print $elementarray;
}
print "</table>";
print "<br>\n";
}
}
// Enhance with select2
$nodatarole='';
if ($conf->use_javascript_ajax)
{
include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
$comboenhancement = ajax_combobox('.elementselect');
$out.=$comboenhancement;
$nodatarole=($comboenhancement?' data-role="none"':'');
print $comboenhancement;
}
llxFooter();
$db->close();
/**
示例8: select_company
/**
* Output html form to select a third party
*
* @param string $selected Preselected type
* @param string $htmlname Name of field in form
* @param string $filter Optionnal filters criteras
* @param int $showempty Add an empty field
* @param int $showtype Show third party type in combolist (customer, prospect or supplier)
* @param int $forcecombo Force to use combo box
* @param array $event Event options
* @return string HTML string with
*/
function select_company($selected = '', $htmlname = 'socid', $filter = '', $showempty = 0, $showtype = 0, $forcecombo = 0, $event = array())
{
global $conf, $user, $langs;
$out = '';
$object = new Societe($this->db);
try {
$result = $object->getView("list");
} catch (Exception $e) {
$this->error = "Fetch : Something weird happened: " . $e->getMessage() . " (errcode=" . $e->getCode() . ")\n";
dol_print_error($this->db, $this->error);
return 0;
}
// On recherche les societes
$sql = "SELECT s.rowid, s.nom, s.client, s.fournisseur, s.code_client, s.code_fournisseur";
$sql .= " FROM " . MAIN_DB_PREFIX . "societe as s";
if (!$user->rights->societe->client->voir && !$user->societe_id) {
$sql .= ", " . MAIN_DB_PREFIX . "societe_commerciaux as sc";
}
$sql .= " WHERE s.entity IN (" . getEntity('societe', 1) . ")";
if (!empty($user->societe_id)) {
$sql .= " AND s.rowid = " . $user->societe_id;
}
if ($filter) {
$sql .= " AND " . $filter;
}
if (!$user->rights->societe->client->voir && !$user->societe_id) {
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " . $user->id;
}
$sql .= " ORDER BY nom ASC";
dol_syslog(get_class($this) . "::select_company sql=" . $sql);
if ($conf->use_javascript_ajax && $conf->global->COMPANY_USE_SEARCH_TO_SELECT && !$forcecombo) {
//$minLength = (is_numeric($conf->global->COMPANY_USE_SEARCH_TO_SELECT)?$conf->global->COMPANY_USE_SEARCH_TO_SELECT:2);
$out .= ajax_combobox($htmlname, $event);
}
$out .= '<select id="' . $htmlname . '" class="flat" name="' . $htmlname . '">';
if ($showempty) {
$out .= '<option value="0"></option>';
}
if (count($result->rows) > 0) {
foreach ($result->rows as $aRow) {
$obj = $aRow->value;
$label = $obj->ThirdPartyName;
if ($showtype) {
if ($obj->client || $obj->fournisseur) {
$label .= ' (';
}
if ($obj->client == 1 || $obj->client == 3) {
$label .= $langs->trans("Customer");
}
if ($obj->client == 2 || $obj->client == 3) {
$label .= ($obj->client == 3 ? ', ' : '') . $langs->trans("Prospect");
}
if ($obj->fournisseur) {
$label .= ($obj->client ? ', ' : '') . $langs->trans("Supplier");
}
if ($obj->client || $obj->fournisseur) {
$label .= ')';
}
}
if ($selected > 0 && $selected == $obj->_id) {
$out .= '<option value="' . $obj->_id . '" selected="selected">' . $label . '</option>';
} else {
$out .= '<option value="' . $obj->_id . '">' . $label . '</option>';
}
$i++;
}
}
$out .= '</select>';
return $out;
}
示例9: select_dolgroups
/**
* Return select list of groups
*
* @param string $selected Id group preselected
* @param string $htmlname Field name in form
* @param int $show_empty 0=liste sans valeur nulle, 1=ajoute valeur inconnue
* @param string $exclude Array list of groups id to exclude
* @param int $disabled If select list must be disabled
* @param string $include Array list of groups id to include
* @param int $enableonly Array list of groups id to be enabled. All other must be disabled
* @param int $force_entity 0 or Id of environment to force
* @return void
* @see select_dolusers
*/
function select_dolgroups($selected = '', $htmlname = 'groupid', $show_empty = 0, $exclude = '', $disabled = 0, $include = '', $enableonly = '', $force_entity = 0)
{
global $conf, $user, $langs;
// Permettre l'exclusion de groupes
if (is_array($exclude)) {
$excludeGroups = implode("','", $exclude);
}
// Permettre l'inclusion de groupes
if (is_array($include)) {
$includeGroups = implode("','", $include);
}
$out = '';
// On recherche les groupes
$sql = "SELECT ug.rowid, ug.nom as name";
if (!empty($conf->multicompany->enabled) && $conf->entity == 1 && $user->admin && !$user->entity) {
$sql .= ", e.label";
}
$sql .= " FROM " . MAIN_DB_PREFIX . "usergroup as ug ";
if (!empty($conf->multicompany->enabled) && $conf->entity == 1 && $user->admin && !$user->entity) {
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "entity as e ON e.rowid=ug.entity";
if ($force_entity) {
$sql .= " WHERE ug.entity IN (0," . $force_entity . ")";
} else {
$sql .= " WHERE ug.entity IS NOT NULL";
}
} else {
$sql .= " WHERE ug.entity IN (0," . $conf->entity . ")";
}
if (is_array($exclude) && $excludeGroups) {
$sql .= " AND ug.rowid NOT IN ('" . $excludeGroups . "')";
}
if (is_array($include) && $includeGroups) {
$sql .= " AND ug.rowid IN ('" . $includeGroups . "')";
}
$sql .= " ORDER BY ug.nom ASC";
dol_syslog(get_class($this) . "::select_dolgroups", LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql) {
$num = $this->db->num_rows($resql);
$i = 0;
if ($num) {
$out .= '<select class="flat" id="' . $htmlname . '" name="' . $htmlname . '"' . ($disabled ? ' disabled="disabled"' : '') . '>';
if ($show_empty) {
$out .= '<option value="-1"' . ($selected == -1 ? ' selected="selected"' : '') . '> </option>' . "\n";
}
while ($i < $num) {
$obj = $this->db->fetch_object($resql);
$disableline = 0;
if (is_array($enableonly) && count($enableonly) && !in_array($obj->rowid, $enableonly)) {
$disableline = 1;
}
$out .= '<option value="' . $obj->rowid . '"';
if ($disableline) {
$out .= ' disabled="disabled"';
}
if (is_object($selected) && $selected->id == $obj->rowid || !is_object($selected) && $selected == $obj->rowid) {
$out .= ' selected="selected"';
}
$out .= '>';
$out .= $obj->name;
if (!empty($conf->multicompany->enabled) && empty($conf->multicompany->transverse_mode) && $conf->entity == 1) {
$out .= " (" . $obj->label . ")";
}
$out .= '</option>';
$i++;
}
} else {
$out .= '<select class="flat" name="' . $htmlname . '"' . ($show_empty ? '' : ' disabled="disabled"') . '>';
if ($show_empty) {
$out .= '<option value="-1"' . ($selected == -1 ? ' selected="selected"' : '') . '></option>' . "\n";
}
$out .= '<option value="" disabled="disabled">' . $langs->trans("NoUserGroupDefined") . '</option>';
}
$out .= '</select>';
if (!empty($conf->use_javascript_ajax) && !$show_empty) {
include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
$out .= ajax_combobox($htmlname);
}
} else {
dol_print_error($this->db);
}
return $out;
}
示例10: select_auxaccount
/**
* Return list of auxilary thirdparty accounts
*
* @param string $selectid Preselected pcg_type
* @param string $htmlname Name of field in html form
* @param int $showempty Add an empty field
* @param array $event Event options
*
* @return string String with HTML select
*/
function select_auxaccount($selectid, $htmlname = 'account_num_aux', $showempty = 0, $event = array())
{
global $conf;
$out = '';
$aux_account = array();
// Auxiliary customer account
$sql = "SELECT DISTINCT code_compta, nom ";
$sql .= " FROM " . MAIN_DB_PREFIX . "societe";
$sql .= " ORDER BY code_compta";
dol_syslog(get_class($this) . "::select_auxaccount", LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql) {
while ($obj = $this->db->fetch_object($resql)) {
if (!empty($obj->code_compta)) {
$aux_account[$obj->code_compta] = $obj->code_compta . ' (' . $obj->nom . ')';
}
}
} else {
$this->error = "Error " . $this->db->lasterror();
dol_syslog(get_class($this) . "::select_pcgsubtype " . $this->error, LOG_ERR);
return -1;
}
$this->db->free($resql);
// Auxiliary supplier account
$sql = "SELECT DISTINCT code_compta_fournisseur, nom ";
$sql .= " FROM " . MAIN_DB_PREFIX . "societe";
$sql .= " ORDER BY code_compta";
dol_syslog(get_class($this) . "::select_auxaccount", LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql) {
while ($obj = $this->db->fetch_object($resql)) {
if (!empty($obj->code_compta_fournisseur)) {
$aux_account[$obj->code_compta_fournisseur] = $obj->code_compta_fournisseur . ' (' . $obj->nom . ')';
}
}
} else {
$this->error = "Error " . $this->db->lasterror();
dol_syslog(get_class($this) . "::select_pcgsubtype " . $this->error, LOG_ERR);
return -1;
}
$this->db->free($resql);
// Build select
if (count($aux_account) > 0) {
$out .= ajax_combobox($htmlname, $event);
$out .= '<select id="' . $htmlname . '" class="flat" name="' . $htmlname . '">';
if ($showempty) {
$out .= '<option value="-1"></option>';
}
foreach ($aux_account as $key => $val) {
if ($selectid != '' && $selectid == $key) {
$out .= '<option value="' . $key . '" selected>' . $val . '</option>';
} else {
$out .= '<option value="' . $key . '">' . $val . '</option>';
}
}
$out .= '</select>';
}
return $out;
}
示例11: select_juridicalstatus
/**
* Retourne la liste deroulante des formes juridiques tous pays confondus ou pour un pays donne.
* Dans le cas d'une liste tous pays confondu, on affiche une rupture sur le pays
*
* @param string $selected Preselected code of juridical type
* @param int $country_codeid 0=list for all countries, otherwise list only country requested
* @param string $filter Add a SQL filter on list
* @param string $htmlname HTML name of select
* @return string String with HTML select
*/
function select_juridicalstatus($selected = '', $country_codeid = 0, $filter = '', $htmlname = 'forme_juridique_code')
{
global $conf, $langs, $user;
$langs->load("dict");
$out = '';
// On recherche les formes juridiques actives des pays actifs
$sql = "SELECT f.rowid, f.code as code , f.libelle as label, f.active, c.label as country, c.code as country_code";
$sql .= " FROM " . MAIN_DB_PREFIX . "c_forme_juridique as f, " . MAIN_DB_PREFIX . "c_country as c";
$sql .= " WHERE f.fk_pays=c.rowid";
$sql .= " AND f.active = 1 AND c.active = 1";
if ($country_codeid) {
$sql .= " AND c.code = '" . $country_codeid . "'";
}
if ($filter) {
$sql .= " " . $filter;
}
$sql .= " ORDER BY c.code";
dol_syslog(get_class($this) . "::select_juridicalstatus", LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql) {
$out .= '<div id="particulier2" class="visible">';
$out .= '<select class="flat minwidth200" name="' . $htmlname . '" id="' . $htmlname . '">';
if ($country_codeid) {
$out .= '<option value="0"> </option>';
}
// When country_codeid is set, we force to add an empty line because it does not appears from select. When not set, we already get the empty line from select.
$num = $this->db->num_rows($resql);
if ($num) {
$i = 0;
$country = '';
$arraydata = array();
while ($i < $num) {
$obj = $this->db->fetch_object($resql);
if ($obj->code) {
$labelcountry = $langs->trans("Country" . $obj->country_code) != "Country" . $obj->country_code ? $langs->trans("Country" . $obj->country_code) : $obj->country;
$labeljs = $langs->trans("JuridicalStatus" . $obj->code) != "JuridicalStatus" . $obj->code ? $langs->trans("JuridicalStatus" . $obj->code) : ($obj->label != '-' ? $obj->label : '');
// $obj->label is already in output charset (converted by database driver)
$arraydata[$obj->code] = array('code' => $obj->code, 'label' => $labeljs, 'label_sort' => $labelcountry . '_' . $labeljs, 'country_code' => $obj->country_code, 'country' => $labelcountry);
}
$i++;
}
$arraydata = dol_sort_array($arraydata, 'label_sort', 'ASC');
if (empty($country_codeid)) {
$arraydata[0] = array('code' => 0, 'label' => '', 'label_sort' => '_', 'country_code' => '', 'country' => '');
}
foreach ($arraydata as $key => $val) {
if (!$country || $country != $val['country']) {
// Show break when we are in multi country mode
if (empty($country_codeid) && $val['country_code']) {
$out .= '<option value="0" disabled class="selectoptiondisabledwhite">----- ' . $val['country'] . " -----</option>\n";
$country = $val['country'];
}
}
if ($selected > 0 && $selected == $val['code']) {
$out .= '<option value="' . $val['code'] . '" selected>';
} else {
$out .= '<option value="' . $val['code'] . '">';
}
// If translation exists, we use it, otherwise we use default label in database
$out .= $val['label'];
$out .= '</option>';
}
}
$out .= '</select>';
if ($user->admin) {
$out .= ' ' . info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
}
// Make select dynamic
include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
$out .= ajax_combobox($htmlname);
$out .= '</div>';
} else {
dol_print_error($this->db);
}
return $out;
}
示例12: selectcontacts
/**
* Return list of all contacts (for a third party or all)
*
* @param int $socid Id ot third party or 0 for all
* @param string $selected Id contact pre-selectionne
* @param string $htmlname Name of HTML field ('none' for a not editable field)
* @param int $showempty 0=no empty value, 1=add an empty value, 2=add line 'Internal' (used by user edit)
* @param string $exclude List of contacts id to exclude
* @param string $limitto Disable answers that are not id in this array list
* @param string $showfunction Add function into label
* @param string $moreclass Add more class to class style
* @param bool $options_only Return options only (for ajax treatment)
* @param string $showsoc Add company into label
* @param int $forcecombo Force to use combo box
* @param array $events Event options. Example: array(array('method'=>'getContacts', 'url'=>dol_buildpath('/core/ajax/contacts.php',1), 'htmlname'=>'contactid', 'params'=>array('add-customer-contact'=>'disabled')))
* @return int <0 if KO, Nb of contact in list if OK
*/
function selectcontacts($socid, $selected = '', $htmlname = 'contactid', $showempty = 0, $exclude = '', $limitto = '', $showfunction = 0, $moreclass = '', $options_only = false, $showsoc = 0, $forcecombo = 0, $events = array())
{
global $conf, $langs;
$langs->load('companies');
$out = '';
// On recherche les societes
$sql = "SELECT sp.rowid, sp.lastname, sp.statut, sp.firstname, sp.poste";
if ($showsoc > 0) {
$sql .= " , s.nom as company";
}
$sql .= " FROM " . MAIN_DB_PREFIX . "socpeople as sp";
if ($showsoc > 0) {
$sql .= " LEFT OUTER JOIN " . MAIN_DB_PREFIX . "societe as s ON s.rowid=sp.fk_soc ";
}
$sql .= " WHERE sp.entity IN (" . getEntity('societe', 1) . ")";
if ($socid > 0) {
$sql .= " AND sp.fk_soc=" . $socid;
}
if (!empty($conf->global->CONTACT_HIDE_INACTIVE_IN_COMBOBOX)) {
$sql .= " AND sp.statut<>0 ";
}
$sql .= " ORDER BY sp.lastname ASC";
dol_syslog(get_class($this) . "::select_contacts sql=" . $sql);
$resql = $this->db->query($sql);
if ($resql) {
$num = $this->db->num_rows($resql);
if ($conf->use_javascript_ajax && $conf->global->CONTACT_USE_SEARCH_TO_SELECT && !$forcecombo && !$options_only) {
$out .= ajax_combobox($htmlname, $events, $conf->global->CONTACT_USE_SEARCH_TO_SELECT);
}
if ($htmlname != 'none' || $options_only) {
$out .= '<select class="flat' . ($moreclass ? ' ' . $moreclass : '') . '" id="' . $htmlname . '" name="' . $htmlname . '">';
}
if ($showempty == 1) {
$out .= '<option value="0"' . ($selected == '0' ? ' selected="selected"' : '') . '></option>';
}
if ($showempty == 2) {
$out .= '<option value="0"' . ($selected == '0' ? ' selected="selected"' : '') . '>' . $langs->trans("Internal") . '</option>';
}
$num = $this->db->num_rows($resql);
$i = 0;
if ($num) {
include_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php';
$contactstatic = new Contact($this->db);
while ($i < $num) {
$obj = $this->db->fetch_object($resql);
$contactstatic->id = $obj->rowid;
$contactstatic->lastname = $obj->lastname;
$contactstatic->firstname = $obj->firstname;
if ($obj->statut == 1) {
if ($htmlname != 'none') {
$disabled = 0;
if (is_array($exclude) && count($exclude) && in_array($obj->rowid, $exclude)) {
$disabled = 1;
}
if (is_array($limitto) && count($limitto) && !in_array($obj->rowid, $limitto)) {
$disabled = 1;
}
if ($selected && $selected == $obj->rowid) {
$out .= '<option value="' . $obj->rowid . '"';
if ($disabled) {
$out .= ' disabled="disabled"';
}
$out .= ' selected="selected">';
$out .= $contactstatic->getFullName($langs);
if ($showfunction && $obj->poste) {
$out .= ' (' . $obj->poste . ')';
}
if ($showsoc > 0 && $obj->company) {
$out .= ' - (' . $obj->company . ')';
}
$out .= '</option>';
} else {
$out .= '<option value="' . $obj->rowid . '"';
if ($disabled) {
$out .= ' disabled="disabled"';
}
$out .= '>';
$out .= $contactstatic->getFullName($langs);
if ($showfunction && $obj->poste) {
$out .= ' (' . $obj->poste . ')';
}
if ($showsoc > 0 && $obj->company) {
$out .= ' - (' . $obj->company . ')';
//.........这里部分代码省略.........
示例13: select_contacts_combobox
function select_contacts_combobox($socid, $selected = '', $htmlname = 'contactid', $showempty = 0, $exclude = '', $limitto = '', $showfunction = 0, $moreclass = '', $options_only = false, $forcecombo = 0, $event = array())
{
global $conf, $langs;
$langs->load('companies');
$out = '';
// On recherche les societes
$sql = "SELECT sp.rowid, sp.nom as name ";
$sql .= " FROM " . MAIN_DB_PREFIX . "societe as sp";
$sql .= " WHERE sp.entity IN (" . getEntity('societe', 1) . ")";
if ($socid > 0) {
$sql .= " AND sp.fk_soc=" . $socid;
}
$sql .= " ORDER BY sp.nom ASC";
dol_syslog(get_class($this) . "::select_contacts_combobox sql=" . $sql);
$resql = $this->db->query($sql);
if ($resql) {
$num = $this->db->num_rows($resql);
if ($conf->use_javascript_ajax && $conf->global->AGF_CONTACT_USE_SEARCH_TO_SELECT && !$forcecombo) {
$out .= ajax_combobox($htmlname, $event);
}
if ($htmlname != 'none' || $options_only) {
$out .= '<select class="flat' . ($moreclass ? ' ' . $moreclass : '') . '" id="' . $htmlname . '" name="' . $htmlname . '">';
}
if ($showempty) {
$out .= '<option value="0"></option>';
}
$num = $this->db->num_rows($resql);
$i = 0;
if ($num) {
include_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php';
$contactstatic = new Contact($this->db);
while ($i < $num) {
$obj = $this->db->fetch_object($resql);
$contactstatic->id = $obj->rowid;
$contactstatic->name = $obj->name;
$contactstatic->lastname = $obj->name;
if ($htmlname != 'none') {
$disabled = 0;
if (is_array($exclude) && count($exclude) && in_array($obj->rowid, $exclude)) {
$disabled = 1;
}
if (is_array($limitto) && count($limitto) && !in_array($obj->rowid, $limitto)) {
$disabled = 1;
}
if ($selected && $selected == $obj->rowid) {
$out .= '<option value="' . $obj->rowid . '"';
if ($disabled) {
$out .= ' disabled="disabled"';
}
$out .= ' selected="selected">';
$out .= $contactstatic->getFullName($langs);
if ($showfunction && $obj->poste) {
$out .= ' (' . $obj->poste . ')';
}
$out .= '</option>';
} elseif (!$disabled) {
$out .= '<option value="' . $obj->rowid . '"';
if ($disabled) {
$out .= ' disabled="disabled"';
}
$out .= '>';
$out .= $contactstatic->getFullName($langs);
if ($showfunction && $obj->poste) {
$out .= ' (' . $obj->poste . ')';
}
$out .= '</option>';
}
} else {
if ($selected == $obj->rowid) {
$out .= $contactstatic->getFullName($langs);
if ($showfunction && $obj->poste) {
$out .= ' (' . $obj->poste . ')';
}
}
}
$i++;
}
} else {
$out .= '<option value="-1" selected="selected" disabled="disabled">' . $langs->trans("NoContactDefined") . '</option>';
}
if ($htmlname != 'none' || $options_only) {
$out .= '</select>';
}
$this->num = $num;
return $out;
} else {
dol_print_error($this->db);
return -1;
}
}
示例14: select_mandat
function select_mandat($selectid, $htmlname = 'mandat', $filter = '', $showempty = 0, $forcecombo = 0, $event = array())
{
global $conf, $langs;
$sql = "SELECT t.rowid, t.ref_interne";
$sql .= " FROM " . MAIN_DB_PREFIX . "mandat as t";
if (!empty($filter)) {
$sql .= ' WHERE ' . $filter;
}
$sql .= " ORDER BY t.ref_interne";
dol_syslog(get_class($this) . "::select_mandat sql=" . $sql, LOG_DEBUG);
$result = $this->db->query($sql);
if ($result) {
if ($conf->use_javascript_ajax && !$forcecombo) {
$out .= ajax_combobox($htmlname, $event);
}
$out .= '<select id="' . $htmlname . '" class="flat" name="' . $htmlname . '">';
if ($showempty) {
$out .= '<option value="-1"></option>';
}
$num = $this->db->num_rows($result);
$i = 0;
if ($num) {
while ($i < $num) {
$obj = $this->db->fetch_object($result);
$label = stripslashes($obj->ref_interne);
if ($selectid > 0 && $selectid == $obj->rowid) {
$out .= '<option value="' . $obj->rowid . '" selected="selected">' . $label . '</option>';
} else {
$out .= '<option value="' . $obj->rowid . '">' . $label . '</option>';
}
$i++;
}
}
$out .= '</select>';
$this->db->free($result);
return $out;
} else {
$this->error = "Error " . $this->db->lasterror();
dol_syslog(get_class($this) . "::select_mandat " . $this->error, LOG_ERR);
return -1;
}
}
示例15: empty
}
} else {
$cond_reglement_id = $soc->cond_reglement_id;
$mode_reglement_id = $soc->mode_reglement_id;
$fk_account = $soc->fk_account;
$remise_percent = $soc->remise_percent;
$remise_absolue = 0;
$dateinvoice = empty($dateinvoice) ? empty($conf->global->MAIN_AUTOFILL_DATE) ? -1 : '' : $dateinvoice;
// Do not set 0 here (0 for a date is 1970)
}
$absolute_discount = $soc->getAvailableDiscounts();
if (!empty($conf->use_javascript_ajax)) {
require_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
print ajax_combobox('fac_replacement');
print ajax_combobox('fac_avoir');
print ajax_combobox('situations');
}
print '<form name="add" action="' . $_SERVER["PHP_SELF"] . '" method="POST">';
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
print '<input type="hidden" name="action" value="add">';
if ($soc->id > 0) {
print '<input type="hidden" name="socid" value="' . $soc->id . '">' . "\n";
}
print '<input name="facnumber" type="hidden" value="provisoire">';
print '<input name="ref_client" type="hidden" value="' . $ref_client . '">';
print '<input name="ref_int" type="hidden" value="' . $ref_int . '">';
print '<input type="hidden" name="origin" value="' . $origin . '">';
print '<input type="hidden" name="originid" value="' . $originid . '">';
dol_fiche_head('');
print '<table class="border" width="100%">';
// Ref