<?php
// This script and data application were generated by AppGini 5.81
// Download AppGini for free from https://bigprof.com/appgini/download/

/*
	ajax-callable script that returns code for either a combo drop-down or an auto-complete
	drop-down, based on number of items.

	REQUEST parameters:
	===============
	t: table name
	f: lookup field name
	id: selected id
	p: page number (default = 1)
	s: search term
	o: 0 (default) for text-only or 1 for full options list
	text: selected text
	filterer_[filterer]: name of filterer field to be used to filter the drop-down contents
				must be one of the filteres defined for the concerned field
*/

	$start_ts = microtime(true);

	// how many results to return per call, in case of json output
	$results_per_page = 50;

	$curr_dir = dirname(__FILE__);
	include("$curr_dir/defaultLang.php");
	include("$curr_dir/language.php");
	include("$curr_dir/lib.php");

	handle_maintenance();

	// drop-downs config
	$lookups = array(
		'entete' => array(
		),
		'personnels' => array(
			'nationalite' => array(
				'parent_table' => 'pays',
				'parent_pk_field' => 'idpays',
				'parent_caption' => '`pays`.`pays`',
				'parent_from' => '`pays` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'agence' => array(
				'parent_table' => 'agences',
				'parent_pk_field' => 'idagence',
				'parent_caption' => '`agences`.`agence`',
				'parent_from' => '`agences` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'fonction' => array(
				'parent_table' => 'fonctions',
				'parent_pk_field' => 'idfonction',
				'parent_caption' => '`fonctions`.`fonction`',
				'parent_from' => '`fonctions` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'service' => array(
				'parent_table' => 'produits_services',
				'parent_pk_field' => 'idps',
				'parent_caption' => '`produits_services`.`produit_service`',
				'parent_from' => '`produits_services` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'poste' => array(
				'parent_table' => 'postes',
				'parent_pk_field' => 'idposte',
				'parent_caption' => '`postes`.`poste`',
				'parent_from' => '`postes` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
		),
		'clients' => array(
			'type_client' => array(
				'parent_table' => 'type_client',
				'parent_pk_field' => 'idtype_client',
				'parent_caption' => '`type_client`.`type_client`',
				'parent_from' => '`type_client` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => true
			),
			'agence' => array(
				'parent_table' => 'agences',
				'parent_pk_field' => 'idagence',
				'parent_caption' => '`agences`.`agence`',
				'parent_from' => '`agences` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'nationalite' => array(
				'parent_table' => 'pays',
				'parent_pk_field' => 'idpays',
				'parent_caption' => '`pays`.`pays`',
				'parent_from' => '`pays` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'categorie' => array(
				'parent_table' => 'produits_services',
				'parent_pk_field' => 'idps',
				'parent_caption' => '`produits_services`.`produit_service`',
				'parent_from' => '`produits_services` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'fonction' => array(
				'parent_table' => 'fonctions',
				'parent_pk_field' => 'idfonction',
				'parent_caption' => '`fonctions`.`fonction`',
				'parent_from' => '`fonctions` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'activite' => array(
				'parent_table' => 'activites',
				'parent_pk_field' => 'idactivite',
				'parent_caption' => '`activites`.`activite`',
				'parent_from' => '`activites` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'lieu' => array(
				'parent_table' => 'pays',
				'parent_pk_field' => 'idpays',
				'parent_caption' => '`pays`.`pays`',
				'parent_from' => '`pays` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => true
			),
			'banque' => array(
				'parent_table' => 'banques',
				'parent_pk_field' => 'idbanque',
				'parent_caption' => '`banques`.`banque`',
				'parent_from' => '`banques` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'carte_fidelite' => array(
				'parent_table' => 'fidelite',
				'parent_pk_field' => 'idfidelite',
				'parent_caption' => '`fidelite`.`carte_fidelite`',
				'parent_from' => '`fidelite` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
		),
		'suivi_client' => array(
			'nom' => array(
				'parent_table' => 'clients',
				'parent_pk_field' => 'idclient',
				'parent_caption' => '`clients`.`nom`',
				'parent_from' => '`clients` LEFT JOIN `type_client` as type_client1 ON `type_client1`.`idtype_client`=`clients`.`type_client` LEFT JOIN `agences` as agences1 ON `agences1`.`idagence`=`clients`.`agence` LEFT JOIN `pays` as pays1 ON `pays1`.`idpays`=`clients`.`nationalite` LEFT JOIN `produits_services` as produits_services1 ON `produits_services1`.`idps`=`clients`.`categorie` LEFT JOIN `fonctions` as fonctions1 ON `fonctions1`.`idfonction`=`clients`.`fonction` LEFT JOIN `activites` as activites1 ON `activites1`.`idactivite`=`clients`.`activite` LEFT JOIN `pays` as pays2 ON `pays2`.`idpays`=`clients`.`lieu` LEFT JOIN `banques` as banques1 ON `banques1`.`idbanque`=`clients`.`banque` LEFT JOIN `fidelite` as fidelite1 ON `fidelite1`.`idfidelite`=`clients`.`carte_fidelite` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => true
			),
			'prenom' => array(
				'parent_table' => 'clients',
				'parent_pk_field' => 'idclient',
				'parent_caption' => '`clients`.`prenom`',
				'parent_from' => '`clients` LEFT JOIN `type_client` as type_client1 ON `type_client1`.`idtype_client`=`clients`.`type_client` LEFT JOIN `agences` as agences1 ON `agences1`.`idagence`=`clients`.`agence` LEFT JOIN `pays` as pays1 ON `pays1`.`idpays`=`clients`.`nationalite` LEFT JOIN `produits_services` as produits_services1 ON `produits_services1`.`idps`=`clients`.`categorie` LEFT JOIN `fonctions` as fonctions1 ON `fonctions1`.`idfonction`=`clients`.`fonction` LEFT JOIN `activites` as activites1 ON `activites1`.`idactivite`=`clients`.`activite` LEFT JOIN `pays` as pays2 ON `pays2`.`idpays`=`clients`.`lieu` LEFT JOIN `banques` as banques1 ON `banques1`.`idbanque`=`clients`.`banque` LEFT JOIN `fidelite` as fidelite1 ON `fidelite1`.`idfidelite`=`clients`.`carte_fidelite` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'raison_sociale' => array(
				'parent_table' => 'clients',
				'parent_pk_field' => 'idclient',
				'parent_caption' => '`clients`.`raison_sociale`',
				'parent_from' => '`clients` LEFT JOIN `type_client` as type_client1 ON `type_client1`.`idtype_client`=`clients`.`type_client` LEFT JOIN `agences` as agences1 ON `agences1`.`idagence`=`clients`.`agence` LEFT JOIN `pays` as pays1 ON `pays1`.`idpays`=`clients`.`nationalite` LEFT JOIN `produits_services` as produits_services1 ON `produits_services1`.`idps`=`clients`.`categorie` LEFT JOIN `fonctions` as fonctions1 ON `fonctions1`.`idfonction`=`clients`.`fonction` LEFT JOIN `activites` as activites1 ON `activites1`.`idactivite`=`clients`.`activite` LEFT JOIN `pays` as pays2 ON `pays2`.`idpays`=`clients`.`lieu` LEFT JOIN `banques` as banques1 ON `banques1`.`idbanque`=`clients`.`banque` LEFT JOIN `fidelite` as fidelite1 ON `fidelite1`.`idfidelite`=`clients`.`carte_fidelite` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'telephone' => array(
				'parent_table' => 'clients',
				'parent_pk_field' => 'idclient',
				'parent_caption' => '`clients`.`telephone`',
				'parent_from' => '`clients` LEFT JOIN `type_client` as type_client1 ON `type_client1`.`idtype_client`=`clients`.`type_client` LEFT JOIN `agences` as agences1 ON `agences1`.`idagence`=`clients`.`agence` LEFT JOIN `pays` as pays1 ON `pays1`.`idpays`=`clients`.`nationalite` LEFT JOIN `produits_services` as produits_services1 ON `produits_services1`.`idps`=`clients`.`categorie` LEFT JOIN `fonctions` as fonctions1 ON `fonctions1`.`idfonction`=`clients`.`fonction` LEFT JOIN `activites` as activites1 ON `activites1`.`idactivite`=`clients`.`activite` LEFT JOIN `pays` as pays2 ON `pays2`.`idpays`=`clients`.`lieu` LEFT JOIN `banques` as banques1 ON `banques1`.`idbanque`=`clients`.`banque` LEFT JOIN `fidelite` as fidelite1 ON `fidelite1`.`idfidelite`=`clients`.`carte_fidelite` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'email' => array(
				'parent_table' => 'clients',
				'parent_pk_field' => 'idclient',
				'parent_caption' => '`clients`.`email`',
				'parent_from' => '`clients` LEFT JOIN `type_client` as type_client1 ON `type_client1`.`idtype_client`=`clients`.`type_client` LEFT JOIN `agences` as agences1 ON `agences1`.`idagence`=`clients`.`agence` LEFT JOIN `pays` as pays1 ON `pays1`.`idpays`=`clients`.`nationalite` LEFT JOIN `produits_services` as produits_services1 ON `produits_services1`.`idps`=`clients`.`categorie` LEFT JOIN `fonctions` as fonctions1 ON `fonctions1`.`idfonction`=`clients`.`fonction` LEFT JOIN `activites` as activites1 ON `activites1`.`idactivite`=`clients`.`activite` LEFT JOIN `pays` as pays2 ON `pays2`.`idpays`=`clients`.`lieu` LEFT JOIN `banques` as banques1 ON `banques1`.`idbanque`=`clients`.`banque` LEFT JOIN `fidelite` as fidelite1 ON `fidelite1`.`idfidelite`=`clients`.`carte_fidelite` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'whatsapp' => array(
				'parent_table' => 'clients',
				'parent_pk_field' => 'idclient',
				'parent_caption' => '`clients`.`whatsapp`',
				'parent_from' => '`clients` LEFT JOIN `type_client` as type_client1 ON `type_client1`.`idtype_client`=`clients`.`type_client` LEFT JOIN `agences` as agences1 ON `agences1`.`idagence`=`clients`.`agence` LEFT JOIN `pays` as pays1 ON `pays1`.`idpays`=`clients`.`nationalite` LEFT JOIN `produits_services` as produits_services1 ON `produits_services1`.`idps`=`clients`.`categorie` LEFT JOIN `fonctions` as fonctions1 ON `fonctions1`.`idfonction`=`clients`.`fonction` LEFT JOIN `activites` as activites1 ON `activites1`.`idactivite`=`clients`.`activite` LEFT JOIN `pays` as pays2 ON `pays2`.`idpays`=`clients`.`lieu` LEFT JOIN `banques` as banques1 ON `banques1`.`idbanque`=`clients`.`banque` LEFT JOIN `fidelite` as fidelite1 ON `fidelite1`.`idfidelite`=`clients`.`carte_fidelite` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'service_demande' => array(
				'parent_table' => 'produits_services',
				'parent_pk_field' => 'idps',
				'parent_caption' => '`produits_services`.`produit_service`',
				'parent_from' => '`produits_services` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => true
			),
			'type_de_visa' => array(
				'parent_table' => 'type_visa',
				'parent_pk_field' => 'idtype_visa',
				'parent_caption' => '`type_visa`.`type_visa`',
				'parent_from' => '`type_visa` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
		),
		'rendez_vous' => array(
			'annee' => array(
				'parent_table' => 'annees',
				'parent_pk_field' => 'idannee',
				'parent_caption' => '`annees`.`annee`',
				'parent_from' => '`annees` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
		),
		'partenaires' => array(
			'nom_prenom' => array(
				'parent_table' => 'clients',
				'parent_pk_field' => 'idclient',
				'parent_caption' => 'IF(CHAR_LENGTH(`clients`.`prenom`) || CHAR_LENGTH(`clients`.`nom`), CONCAT_WS(\'\', `clients`.`prenom`, \'   \', `clients`.`nom`), \'\')',
				'parent_from' => '`clients` LEFT JOIN `type_client` as type_client1 ON `type_client1`.`idtype_client`=`clients`.`type_client` LEFT JOIN `agences` as agences1 ON `agences1`.`idagence`=`clients`.`agence` LEFT JOIN `pays` as pays1 ON `pays1`.`idpays`=`clients`.`nationalite` LEFT JOIN `produits_services` as produits_services1 ON `produits_services1`.`idps`=`clients`.`categorie` LEFT JOIN `fonctions` as fonctions1 ON `fonctions1`.`idfonction`=`clients`.`fonction` LEFT JOIN `activites` as activites1 ON `activites1`.`idactivite`=`clients`.`activite` LEFT JOIN `pays` as pays2 ON `pays2`.`idpays`=`clients`.`lieu` LEFT JOIN `banques` as banques1 ON `banques1`.`idbanque`=`clients`.`banque` LEFT JOIN `fidelite` as fidelite1 ON `fidelite1`.`idfidelite`=`clients`.`carte_fidelite` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'fonction' => array(
				'parent_table' => 'clients',
				'parent_pk_field' => 'idclient',
				'parent_caption' => 'IF(    CHAR_LENGTH(`fonctions1`.`fonction`), CONCAT_WS(\'\',   `fonctions1`.`fonction`), \'\')',
				'parent_from' => '`clients` LEFT JOIN `type_client` as type_client1 ON `type_client1`.`idtype_client`=`clients`.`type_client` LEFT JOIN `agences` as agences1 ON `agences1`.`idagence`=`clients`.`agence` LEFT JOIN `pays` as pays1 ON `pays1`.`idpays`=`clients`.`nationalite` LEFT JOIN `produits_services` as produits_services1 ON `produits_services1`.`idps`=`clients`.`categorie` LEFT JOIN `fonctions` as fonctions1 ON `fonctions1`.`idfonction`=`clients`.`fonction` LEFT JOIN `activites` as activites1 ON `activites1`.`idactivite`=`clients`.`activite` LEFT JOIN `pays` as pays2 ON `pays2`.`idpays`=`clients`.`lieu` LEFT JOIN `banques` as banques1 ON `banques1`.`idbanque`=`clients`.`banque` LEFT JOIN `fidelite` as fidelite1 ON `fidelite1`.`idfidelite`=`clients`.`carte_fidelite` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'adresse' => array(
				'parent_table' => 'clients',
				'parent_pk_field' => 'idclient',
				'parent_caption' => '`clients`.`adresse`',
				'parent_from' => '`clients` LEFT JOIN `type_client` as type_client1 ON `type_client1`.`idtype_client`=`clients`.`type_client` LEFT JOIN `agences` as agences1 ON `agences1`.`idagence`=`clients`.`agence` LEFT JOIN `pays` as pays1 ON `pays1`.`idpays`=`clients`.`nationalite` LEFT JOIN `produits_services` as produits_services1 ON `produits_services1`.`idps`=`clients`.`categorie` LEFT JOIN `fonctions` as fonctions1 ON `fonctions1`.`idfonction`=`clients`.`fonction` LEFT JOIN `activites` as activites1 ON `activites1`.`idactivite`=`clients`.`activite` LEFT JOIN `pays` as pays2 ON `pays2`.`idpays`=`clients`.`lieu` LEFT JOIN `banques` as banques1 ON `banques1`.`idbanque`=`clients`.`banque` LEFT JOIN `fidelite` as fidelite1 ON `fidelite1`.`idfidelite`=`clients`.`carte_fidelite` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'telephone' => array(
				'parent_table' => 'clients',
				'parent_pk_field' => 'idclient',
				'parent_caption' => '`clients`.`telephone`',
				'parent_from' => '`clients` LEFT JOIN `type_client` as type_client1 ON `type_client1`.`idtype_client`=`clients`.`type_client` LEFT JOIN `agences` as agences1 ON `agences1`.`idagence`=`clients`.`agence` LEFT JOIN `pays` as pays1 ON `pays1`.`idpays`=`clients`.`nationalite` LEFT JOIN `produits_services` as produits_services1 ON `produits_services1`.`idps`=`clients`.`categorie` LEFT JOIN `fonctions` as fonctions1 ON `fonctions1`.`idfonction`=`clients`.`fonction` LEFT JOIN `activites` as activites1 ON `activites1`.`idactivite`=`clients`.`activite` LEFT JOIN `pays` as pays2 ON `pays2`.`idpays`=`clients`.`lieu` LEFT JOIN `banques` as banques1 ON `banques1`.`idbanque`=`clients`.`banque` LEFT JOIN `fidelite` as fidelite1 ON `fidelite1`.`idfidelite`=`clients`.`carte_fidelite` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'email' => array(
				'parent_table' => 'clients',
				'parent_pk_field' => 'idclient',
				'parent_caption' => '`clients`.`email`',
				'parent_from' => '`clients` LEFT JOIN `type_client` as type_client1 ON `type_client1`.`idtype_client`=`clients`.`type_client` LEFT JOIN `agences` as agences1 ON `agences1`.`idagence`=`clients`.`agence` LEFT JOIN `pays` as pays1 ON `pays1`.`idpays`=`clients`.`nationalite` LEFT JOIN `produits_services` as produits_services1 ON `produits_services1`.`idps`=`clients`.`categorie` LEFT JOIN `fonctions` as fonctions1 ON `fonctions1`.`idfonction`=`clients`.`fonction` LEFT JOIN `activites` as activites1 ON `activites1`.`idactivite`=`clients`.`activite` LEFT JOIN `pays` as pays2 ON `pays2`.`idpays`=`clients`.`lieu` LEFT JOIN `banques` as banques1 ON `banques1`.`idbanque`=`clients`.`banque` LEFT JOIN `fidelite` as fidelite1 ON `fidelite1`.`idfidelite`=`clients`.`carte_fidelite` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
		),
		'packages' => array(
		),
		'oumrah' => array(
			'Pelerinage' => array(
				'parent_table' => 'annees',
				'parent_pk_field' => 'idannee',
				'parent_caption' => '`annees`.`annee`',
				'parent_from' => '`annees` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
		),
		'hajj_oumrah' => array(
		),
		'souscriptions' => array(
			'pelerin' => array(
				'parent_table' => 'hajj_oumrah',
				'parent_pk_field' => 'idhajjoumrah',
				'parent_caption' => 'IF(CHAR_LENGTH(`hajj_oumrah`.`Prenom`) || CHAR_LENGTH(`hajj_oumrah`.`Nom`), CONCAT_WS(\'\', `hajj_oumrah`.`Prenom`, \'   \', `hajj_oumrah`.`Nom`), \'\')',
				'parent_from' => '`hajj_oumrah` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'oumrah' => array(
				'parent_table' => 'oumrah',
				'parent_pk_field' => 'idoumrah',
				'parent_caption' => 'IF(CHAR_LENGTH(`oumrah`.`Prenom`) || CHAR_LENGTH(`oumrah`.`Nom`), CONCAT_WS(\'\', `oumrah`.`Prenom`, \'   \', `oumrah`.`Nom`), \'\')',
				'parent_from' => '`oumrah` LEFT JOIN `annees` as annees1 ON `annees1`.`idannee`=`oumrah`.`Pelerinage` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'package' => array(
				'parent_table' => 'packages',
				'parent_pk_field' => 'idpackage',
				'parent_caption' => '`packages`.`nom`',
				'parent_from' => '`packages` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
		),
		'entrees' => array(
			'client' => array(
				'parent_table' => 'hajj_oumrah',
				'parent_pk_field' => 'idhajjoumrah',
				'parent_caption' => 'IF(CHAR_LENGTH(`hajj_oumrah`.`Prenom`) || CHAR_LENGTH(`hajj_oumrah`.`Nom`), CONCAT_WS(\'\', `hajj_oumrah`.`Prenom`, \'   \', `hajj_oumrah`.`Nom`), \'\')',
				'parent_from' => '`hajj_oumrah` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'oumrah' => array(
				'parent_table' => 'oumrah',
				'parent_pk_field' => 'idoumrah',
				'parent_caption' => 'IF(CHAR_LENGTH(`oumrah`.`Prenom`) || CHAR_LENGTH(`oumrah`.`Nom`), CONCAT_WS(\'\', `oumrah`.`Prenom`, \'   \', `oumrah`.`Nom`), \'\')',
				'parent_from' => '`oumrah` LEFT JOIN `annees` as annees1 ON `annees1`.`idannee`=`oumrah`.`Pelerinage` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'description' => array(
				'parent_table' => 'packages',
				'parent_pk_field' => 'idpackage',
				'parent_caption' => '`packages`.`nom`',
				'parent_from' => '`packages` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
		),
		'sorties' => array(
			'client' => array(
				'parent_table' => 'hajj_oumrah',
				'parent_pk_field' => 'idhajjoumrah',
				'parent_caption' => 'IF(CHAR_LENGTH(`hajj_oumrah`.`Prenom`) || CHAR_LENGTH(`hajj_oumrah`.`Nom`), CONCAT_WS(\'\', `hajj_oumrah`.`Prenom`, \'   \', `hajj_oumrah`.`Nom`), \'\')',
				'parent_from' => '`hajj_oumrah` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'oumrah' => array(
				'parent_table' => 'oumrah',
				'parent_pk_field' => 'idoumrah',
				'parent_caption' => 'IF(CHAR_LENGTH(`oumrah`.`Prenom`) || CHAR_LENGTH(`oumrah`.`Nom`), CONCAT_WS(\'\', `oumrah`.`Prenom`, \'   \', `oumrah`.`Nom`), \'\')',
				'parent_from' => '`oumrah` LEFT JOIN `annees` as annees1 ON `annees1`.`idannee`=`oumrah`.`Pelerinage` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
		),
		'agences' => array(
		),
		'gestion_transactions' => array(
			'matricule' => array(
				'parent_table' => 'clients',
				'parent_pk_field' => 'idclient',
				'parent_caption' => '`clients`.`matricule`',
				'parent_from' => '`clients` LEFT JOIN `type_client` as type_client1 ON `type_client1`.`idtype_client`=`clients`.`type_client` LEFT JOIN `agences` as agences1 ON `agences1`.`idagence`=`clients`.`agence` LEFT JOIN `pays` as pays1 ON `pays1`.`idpays`=`clients`.`nationalite` LEFT JOIN `produits_services` as produits_services1 ON `produits_services1`.`idps`=`clients`.`categorie` LEFT JOIN `fonctions` as fonctions1 ON `fonctions1`.`idfonction`=`clients`.`fonction` LEFT JOIN `activites` as activites1 ON `activites1`.`idactivite`=`clients`.`activite` LEFT JOIN `pays` as pays2 ON `pays2`.`idpays`=`clients`.`lieu` LEFT JOIN `banques` as banques1 ON `banques1`.`idbanque`=`clients`.`banque` LEFT JOIN `fidelite` as fidelite1 ON `fidelite1`.`idfidelite`=`clients`.`carte_fidelite` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'avec_entete' => array(
				'parent_table' => 'entete',
				'parent_pk_field' => 'identete',
				'parent_caption' => '`entete`.`nom`',
				'parent_from' => '`entete` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => true
			),
			'rs' => array(
				'parent_table' => 'entete',
				'parent_pk_field' => 'identete',
				'parent_caption' => '`entete`.`raison_sociale`',
				'parent_from' => '`entete` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'nom_prenom' => array(
				'parent_table' => 'clients',
				'parent_pk_field' => 'idclient',
				'parent_caption' => 'IF(CHAR_LENGTH(`clients`.`prenom`) || CHAR_LENGTH(`clients`.`nom`), CONCAT_WS(\'\', `clients`.`prenom`, \'   \', `clients`.`nom`), \'\')',
				'parent_from' => '`clients` LEFT JOIN `type_client` as type_client1 ON `type_client1`.`idtype_client`=`clients`.`type_client` LEFT JOIN `agences` as agences1 ON `agences1`.`idagence`=`clients`.`agence` LEFT JOIN `pays` as pays1 ON `pays1`.`idpays`=`clients`.`nationalite` LEFT JOIN `produits_services` as produits_services1 ON `produits_services1`.`idps`=`clients`.`categorie` LEFT JOIN `fonctions` as fonctions1 ON `fonctions1`.`idfonction`=`clients`.`fonction` LEFT JOIN `activites` as activites1 ON `activites1`.`idactivite`=`clients`.`activite` LEFT JOIN `pays` as pays2 ON `pays2`.`idpays`=`clients`.`lieu` LEFT JOIN `banques` as banques1 ON `banques1`.`idbanque`=`clients`.`banque` LEFT JOIN `fidelite` as fidelite1 ON `fidelite1`.`idfidelite`=`clients`.`carte_fidelite` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => true
			),
			'adclient' => array(
				'parent_table' => 'clients',
				'parent_pk_field' => 'idclient',
				'parent_caption' => '`clients`.`adresse`',
				'parent_from' => '`clients` LEFT JOIN `type_client` as type_client1 ON `type_client1`.`idtype_client`=`clients`.`type_client` LEFT JOIN `agences` as agences1 ON `agences1`.`idagence`=`clients`.`agence` LEFT JOIN `pays` as pays1 ON `pays1`.`idpays`=`clients`.`nationalite` LEFT JOIN `produits_services` as produits_services1 ON `produits_services1`.`idps`=`clients`.`categorie` LEFT JOIN `fonctions` as fonctions1 ON `fonctions1`.`idfonction`=`clients`.`fonction` LEFT JOIN `activites` as activites1 ON `activites1`.`idactivite`=`clients`.`activite` LEFT JOIN `pays` as pays2 ON `pays2`.`idpays`=`clients`.`lieu` LEFT JOIN `banques` as banques1 ON `banques1`.`idbanque`=`clients`.`banque` LEFT JOIN `fidelite` as fidelite1 ON `fidelite1`.`idfidelite`=`clients`.`carte_fidelite` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'telclient' => array(
				'parent_table' => 'clients',
				'parent_pk_field' => 'idclient',
				'parent_caption' => '`clients`.`telephone`',
				'parent_from' => '`clients` LEFT JOIN `type_client` as type_client1 ON `type_client1`.`idtype_client`=`clients`.`type_client` LEFT JOIN `agences` as agences1 ON `agences1`.`idagence`=`clients`.`agence` LEFT JOIN `pays` as pays1 ON `pays1`.`idpays`=`clients`.`nationalite` LEFT JOIN `produits_services` as produits_services1 ON `produits_services1`.`idps`=`clients`.`categorie` LEFT JOIN `fonctions` as fonctions1 ON `fonctions1`.`idfonction`=`clients`.`fonction` LEFT JOIN `activites` as activites1 ON `activites1`.`idactivite`=`clients`.`activite` LEFT JOIN `pays` as pays2 ON `pays2`.`idpays`=`clients`.`lieu` LEFT JOIN `banques` as banques1 ON `banques1`.`idbanque`=`clients`.`banque` LEFT JOIN `fidelite` as fidelite1 ON `fidelite1`.`idfidelite`=`clients`.`carte_fidelite` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'emclient' => array(
				'parent_table' => 'clients',
				'parent_pk_field' => 'idclient',
				'parent_caption' => '`clients`.`email`',
				'parent_from' => '`clients` LEFT JOIN `type_client` as type_client1 ON `type_client1`.`idtype_client`=`clients`.`type_client` LEFT JOIN `agences` as agences1 ON `agences1`.`idagence`=`clients`.`agence` LEFT JOIN `pays` as pays1 ON `pays1`.`idpays`=`clients`.`nationalite` LEFT JOIN `produits_services` as produits_services1 ON `produits_services1`.`idps`=`clients`.`categorie` LEFT JOIN `fonctions` as fonctions1 ON `fonctions1`.`idfonction`=`clients`.`fonction` LEFT JOIN `activites` as activites1 ON `activites1`.`idactivite`=`clients`.`activite` LEFT JOIN `pays` as pays2 ON `pays2`.`idpays`=`clients`.`lieu` LEFT JOIN `banques` as banques1 ON `banques1`.`idbanque`=`clients`.`banque` LEFT JOIN `fidelite` as fidelite1 ON `fidelite1`.`idfidelite`=`clients`.`carte_fidelite` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'raison_sociale' => array(
				'parent_table' => 'clients',
				'parent_pk_field' => 'idclient',
				'parent_caption' => '`clients`.`raison_sociale`',
				'parent_from' => '`clients` LEFT JOIN `type_client` as type_client1 ON `type_client1`.`idtype_client`=`clients`.`type_client` LEFT JOIN `agences` as agences1 ON `agences1`.`idagence`=`clients`.`agence` LEFT JOIN `pays` as pays1 ON `pays1`.`idpays`=`clients`.`nationalite` LEFT JOIN `produits_services` as produits_services1 ON `produits_services1`.`idps`=`clients`.`categorie` LEFT JOIN `fonctions` as fonctions1 ON `fonctions1`.`idfonction`=`clients`.`fonction` LEFT JOIN `activites` as activites1 ON `activites1`.`idactivite`=`clients`.`activite` LEFT JOIN `pays` as pays2 ON `pays2`.`idpays`=`clients`.`lieu` LEFT JOIN `banques` as banques1 ON `banques1`.`idbanque`=`clients`.`banque` LEFT JOIN `fidelite` as fidelite1 ON `fidelite1`.`idfidelite`=`clients`.`carte_fidelite` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'devise' => array(
				'parent_table' => 'entete',
				'parent_pk_field' => 'identete',
				'parent_caption' => '`entete`.`devise`',
				'parent_from' => '`entete` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'logo' => array(
				'parent_table' => 'entete',
				'parent_pk_field' => 'identete',
				'parent_caption' => '`entete`.`logo`',
				'parent_from' => '`entete` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'description' => array(
				'parent_table' => 'entete',
				'parent_pk_field' => 'identete',
				'parent_caption' => '`entete`.`description`',
				'parent_from' => '`entete` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'adresse' => array(
				'parent_table' => 'entete',
				'parent_pk_field' => 'identete',
				'parent_caption' => '`entete`.`adresse`',
				'parent_from' => '`entete` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'telephone' => array(
				'parent_table' => 'entete',
				'parent_pk_field' => 'identete',
				'parent_caption' => '`entete`.`telephone`',
				'parent_from' => '`entete` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'whatsapp' => array(
				'parent_table' => 'entete',
				'parent_pk_field' => 'identete',
				'parent_caption' => '`entete`.`whatsapp`',
				'parent_from' => '`entete` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'email' => array(
				'parent_table' => 'entete',
				'parent_pk_field' => 'identete',
				'parent_caption' => '`entete`.`email`',
				'parent_from' => '`entete` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'site_web' => array(
				'parent_table' => 'entete',
				'parent_pk_field' => 'identete',
				'parent_caption' => '`entete`.`site_web`',
				'parent_from' => '`entete` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'bp' => array(
				'parent_table' => 'entete',
				'parent_pk_field' => 'identete',
				'parent_caption' => '`entete`.`bp`',
				'parent_from' => '`entete` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'footer_3' => array(
				'parent_table' => 'entete',
				'parent_pk_field' => 'identete',
				'parent_caption' => '`entete`.`footer_3`',
				'parent_from' => '`entete` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'notice' => array(
				'parent_table' => 'entete',
				'parent_pk_field' => 'identete',
				'parent_caption' => '`entete`.`notice`',
				'parent_from' => '`entete` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'signataire' => array(
				'parent_table' => 'entete',
				'parent_pk_field' => 'identete',
				'parent_caption' => '`entete`.`signataire`',
				'parent_from' => '`entete` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
		),
		'billeteries' => array(
			'link_out' => array(
				'parent_table' => 'gestion_transactions',
				'parent_pk_field' => 'idgtransaction',
				'parent_caption' => '`gestion_transactions`.`link_in`',
				'parent_from' => '`gestion_transactions` LEFT JOIN `entete` as entete1 ON `entete1`.`identete`=`gestion_transactions`.`avec_entete` LEFT JOIN `clients` as clients1 ON `clients1`.`idclient`=`gestion_transactions`.`nom_prenom` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'service' => array(
				'parent_table' => 'produits_services',
				'parent_pk_field' => 'idps',
				'parent_caption' => '`produits_services`.`produit_service`',
				'parent_from' => '`produits_services` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => true
			),
			'passager' => array(
				'parent_table' => 'clients',
				'parent_pk_field' => 'idclient',
				'parent_caption' => 'IF(CHAR_LENGTH(`clients`.`prenom`) || CHAR_LENGTH(`clients`.`nom`), CONCAT_WS(\'\', `clients`.`prenom`, \'   \', `clients`.`nom`), \'\')',
				'parent_from' => '`clients` LEFT JOIN `type_client` as type_client1 ON `type_client1`.`idtype_client`=`clients`.`type_client` LEFT JOIN `agences` as agences1 ON `agences1`.`idagence`=`clients`.`agence` LEFT JOIN `pays` as pays1 ON `pays1`.`idpays`=`clients`.`nationalite` LEFT JOIN `produits_services` as produits_services1 ON `produits_services1`.`idps`=`clients`.`categorie` LEFT JOIN `fonctions` as fonctions1 ON `fonctions1`.`idfonction`=`clients`.`fonction` LEFT JOIN `activites` as activites1 ON `activites1`.`idactivite`=`clients`.`activite` LEFT JOIN `pays` as pays2 ON `pays2`.`idpays`=`clients`.`lieu` LEFT JOIN `banques` as banques1 ON `banques1`.`idbanque`=`clients`.`banque` LEFT JOIN `fidelite` as fidelite1 ON `fidelite1`.`idfidelite`=`clients`.`carte_fidelite` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => true
			),
			'gds' => array(
				'parent_table' => 'gds',
				'parent_pk_field' => 'idgds',
				'parent_caption' => '`gds`.`gds`',
				'parent_from' => '`gds` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => true
			),
			'compagnie' => array(
				'parent_table' => 'compagnies',
				'parent_pk_field' => 'idcompagnie',
				'parent_caption' => 'IF(CHAR_LENGTH(`compagnies`.`nom_compagnie`) || CHAR_LENGTH(`compagnies`.`type`), CONCAT_WS(\'\', `compagnies`.`nom_compagnie`, \'   |   \', IF(    CHAR_LENGTH(`type_compagnie1`.`type_compangie`), CONCAT_WS(\'\',   `type_compagnie1`.`type_compangie`), \'\')), \'\')',
				'parent_from' => '`compagnies` LEFT JOIN `type_compagnie` as type_compagnie1 ON `type_compagnie1`.`idtypecompagnie`=`compagnies`.`type` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => true
			),
			'parcours' => array(
				'parent_table' => 'items',
				'parent_pk_field' => 'iditem',
				'parent_caption' => '`items`.`item`',
				'parent_from' => '`items` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => true
			),
			'nature_transaction' => array(
				'parent_table' => 'produits_services',
				'parent_pk_field' => 'idps',
				'parent_caption' => '`produits_services`.`produit_service`',
				'parent_from' => '`produits_services` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
		),
		'gestion_changes' => array(
			'matricule' => array(
				'parent_table' => 'clients',
				'parent_pk_field' => 'idclient',
				'parent_caption' => '`clients`.`matricule`',
				'parent_from' => '`clients` LEFT JOIN `type_client` as type_client1 ON `type_client1`.`idtype_client`=`clients`.`type_client` LEFT JOIN `agences` as agences1 ON `agences1`.`idagence`=`clients`.`agence` LEFT JOIN `pays` as pays1 ON `pays1`.`idpays`=`clients`.`nationalite` LEFT JOIN `produits_services` as produits_services1 ON `produits_services1`.`idps`=`clients`.`categorie` LEFT JOIN `fonctions` as fonctions1 ON `fonctions1`.`idfonction`=`clients`.`fonction` LEFT JOIN `activites` as activites1 ON `activites1`.`idactivite`=`clients`.`activite` LEFT JOIN `pays` as pays2 ON `pays2`.`idpays`=`clients`.`lieu` LEFT JOIN `banques` as banques1 ON `banques1`.`idbanque`=`clients`.`banque` LEFT JOIN `fidelite` as fidelite1 ON `fidelite1`.`idfidelite`=`clients`.`carte_fidelite` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'avec_entete' => array(
				'parent_table' => 'entete',
				'parent_pk_field' => 'identete',
				'parent_caption' => '`entete`.`nom`',
				'parent_from' => '`entete` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => true
			),
			'rs' => array(
				'parent_table' => 'entete',
				'parent_pk_field' => 'identete',
				'parent_caption' => '`entete`.`raison_sociale`',
				'parent_from' => '`entete` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'nom_prenom' => array(
				'parent_table' => 'clients',
				'parent_pk_field' => 'idclient',
				'parent_caption' => 'IF(CHAR_LENGTH(`clients`.`prenom`) || CHAR_LENGTH(`clients`.`nom`), CONCAT_WS(\'\', `clients`.`prenom`, \'   \', `clients`.`nom`), \'\')',
				'parent_from' => '`clients` LEFT JOIN `type_client` as type_client1 ON `type_client1`.`idtype_client`=`clients`.`type_client` LEFT JOIN `agences` as agences1 ON `agences1`.`idagence`=`clients`.`agence` LEFT JOIN `pays` as pays1 ON `pays1`.`idpays`=`clients`.`nationalite` LEFT JOIN `produits_services` as produits_services1 ON `produits_services1`.`idps`=`clients`.`categorie` LEFT JOIN `fonctions` as fonctions1 ON `fonctions1`.`idfonction`=`clients`.`fonction` LEFT JOIN `activites` as activites1 ON `activites1`.`idactivite`=`clients`.`activite` LEFT JOIN `pays` as pays2 ON `pays2`.`idpays`=`clients`.`lieu` LEFT JOIN `banques` as banques1 ON `banques1`.`idbanque`=`clients`.`banque` LEFT JOIN `fidelite` as fidelite1 ON `fidelite1`.`idfidelite`=`clients`.`carte_fidelite` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => true
			),
			'nationalite' => array(
				'parent_table' => 'clients',
				'parent_pk_field' => 'idclient',
				'parent_caption' => 'IF(    CHAR_LENGTH(`pays1`.`pays`), CONCAT_WS(\'\',   `pays1`.`pays`), \'\')',
				'parent_from' => '`clients` LEFT JOIN `type_client` as type_client1 ON `type_client1`.`idtype_client`=`clients`.`type_client` LEFT JOIN `agences` as agences1 ON `agences1`.`idagence`=`clients`.`agence` LEFT JOIN `pays` as pays1 ON `pays1`.`idpays`=`clients`.`nationalite` LEFT JOIN `produits_services` as produits_services1 ON `produits_services1`.`idps`=`clients`.`categorie` LEFT JOIN `fonctions` as fonctions1 ON `fonctions1`.`idfonction`=`clients`.`fonction` LEFT JOIN `activites` as activites1 ON `activites1`.`idactivite`=`clients`.`activite` LEFT JOIN `pays` as pays2 ON `pays2`.`idpays`=`clients`.`lieu` LEFT JOIN `banques` as banques1 ON `banques1`.`idbanque`=`clients`.`banque` LEFT JOIN `fidelite` as fidelite1 ON `fidelite1`.`idfidelite`=`clients`.`carte_fidelite` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'profession' => array(
				'parent_table' => 'clients',
				'parent_pk_field' => 'idclient',
				'parent_caption' => 'IF(    CHAR_LENGTH(`fonctions1`.`fonction`), CONCAT_WS(\'\',   `fonctions1`.`fonction`), \'\')',
				'parent_from' => '`clients` LEFT JOIN `type_client` as type_client1 ON `type_client1`.`idtype_client`=`clients`.`type_client` LEFT JOIN `agences` as agences1 ON `agences1`.`idagence`=`clients`.`agence` LEFT JOIN `pays` as pays1 ON `pays1`.`idpays`=`clients`.`nationalite` LEFT JOIN `produits_services` as produits_services1 ON `produits_services1`.`idps`=`clients`.`categorie` LEFT JOIN `fonctions` as fonctions1 ON `fonctions1`.`idfonction`=`clients`.`fonction` LEFT JOIN `activites` as activites1 ON `activites1`.`idactivite`=`clients`.`activite` LEFT JOIN `pays` as pays2 ON `pays2`.`idpays`=`clients`.`lieu` LEFT JOIN `banques` as banques1 ON `banques1`.`idbanque`=`clients`.`banque` LEFT JOIN `fidelite` as fidelite1 ON `fidelite1`.`idfidelite`=`clients`.`carte_fidelite` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'adclient' => array(
				'parent_table' => 'clients',
				'parent_pk_field' => 'idclient',
				'parent_caption' => '`clients`.`adresse`',
				'parent_from' => '`clients` LEFT JOIN `type_client` as type_client1 ON `type_client1`.`idtype_client`=`clients`.`type_client` LEFT JOIN `agences` as agences1 ON `agences1`.`idagence`=`clients`.`agence` LEFT JOIN `pays` as pays1 ON `pays1`.`idpays`=`clients`.`nationalite` LEFT JOIN `produits_services` as produits_services1 ON `produits_services1`.`idps`=`clients`.`categorie` LEFT JOIN `fonctions` as fonctions1 ON `fonctions1`.`idfonction`=`clients`.`fonction` LEFT JOIN `activites` as activites1 ON `activites1`.`idactivite`=`clients`.`activite` LEFT JOIN `pays` as pays2 ON `pays2`.`idpays`=`clients`.`lieu` LEFT JOIN `banques` as banques1 ON `banques1`.`idbanque`=`clients`.`banque` LEFT JOIN `fidelite` as fidelite1 ON `fidelite1`.`idfidelite`=`clients`.`carte_fidelite` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'telclient' => array(
				'parent_table' => 'clients',
				'parent_pk_field' => 'idclient',
				'parent_caption' => '`clients`.`telephone`',
				'parent_from' => '`clients` LEFT JOIN `type_client` as type_client1 ON `type_client1`.`idtype_client`=`clients`.`type_client` LEFT JOIN `agences` as agences1 ON `agences1`.`idagence`=`clients`.`agence` LEFT JOIN `pays` as pays1 ON `pays1`.`idpays`=`clients`.`nationalite` LEFT JOIN `produits_services` as produits_services1 ON `produits_services1`.`idps`=`clients`.`categorie` LEFT JOIN `fonctions` as fonctions1 ON `fonctions1`.`idfonction`=`clients`.`fonction` LEFT JOIN `activites` as activites1 ON `activites1`.`idactivite`=`clients`.`activite` LEFT JOIN `pays` as pays2 ON `pays2`.`idpays`=`clients`.`lieu` LEFT JOIN `banques` as banques1 ON `banques1`.`idbanque`=`clients`.`banque` LEFT JOIN `fidelite` as fidelite1 ON `fidelite1`.`idfidelite`=`clients`.`carte_fidelite` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'emclient' => array(
				'parent_table' => 'clients',
				'parent_pk_field' => 'idclient',
				'parent_caption' => '`clients`.`email`',
				'parent_from' => '`clients` LEFT JOIN `type_client` as type_client1 ON `type_client1`.`idtype_client`=`clients`.`type_client` LEFT JOIN `agences` as agences1 ON `agences1`.`idagence`=`clients`.`agence` LEFT JOIN `pays` as pays1 ON `pays1`.`idpays`=`clients`.`nationalite` LEFT JOIN `produits_services` as produits_services1 ON `produits_services1`.`idps`=`clients`.`categorie` LEFT JOIN `fonctions` as fonctions1 ON `fonctions1`.`idfonction`=`clients`.`fonction` LEFT JOIN `activites` as activites1 ON `activites1`.`idactivite`=`clients`.`activite` LEFT JOIN `pays` as pays2 ON `pays2`.`idpays`=`clients`.`lieu` LEFT JOIN `banques` as banques1 ON `banques1`.`idbanque`=`clients`.`banque` LEFT JOIN `fidelite` as fidelite1 ON `fidelite1`.`idfidelite`=`clients`.`carte_fidelite` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'raison_sociale' => array(
				'parent_table' => 'clients',
				'parent_pk_field' => 'idclient',
				'parent_caption' => '`clients`.`raison_sociale`',
				'parent_from' => '`clients` LEFT JOIN `type_client` as type_client1 ON `type_client1`.`idtype_client`=`clients`.`type_client` LEFT JOIN `agences` as agences1 ON `agences1`.`idagence`=`clients`.`agence` LEFT JOIN `pays` as pays1 ON `pays1`.`idpays`=`clients`.`nationalite` LEFT JOIN `produits_services` as produits_services1 ON `produits_services1`.`idps`=`clients`.`categorie` LEFT JOIN `fonctions` as fonctions1 ON `fonctions1`.`idfonction`=`clients`.`fonction` LEFT JOIN `activites` as activites1 ON `activites1`.`idactivite`=`clients`.`activite` LEFT JOIN `pays` as pays2 ON `pays2`.`idpays`=`clients`.`lieu` LEFT JOIN `banques` as banques1 ON `banques1`.`idbanque`=`clients`.`banque` LEFT JOIN `fidelite` as fidelite1 ON `fidelite1`.`idfidelite`=`clients`.`carte_fidelite` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'devise' => array(
				'parent_table' => 'entete',
				'parent_pk_field' => 'identete',
				'parent_caption' => '`entete`.`devise`',
				'parent_from' => '`entete` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'logo' => array(
				'parent_table' => 'entete',
				'parent_pk_field' => 'identete',
				'parent_caption' => '`entete`.`logo`',
				'parent_from' => '`entete` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'description' => array(
				'parent_table' => 'entete',
				'parent_pk_field' => 'identete',
				'parent_caption' => '`entete`.`description`',
				'parent_from' => '`entete` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'adresse' => array(
				'parent_table' => 'entete',
				'parent_pk_field' => 'identete',
				'parent_caption' => '`entete`.`adresse`',
				'parent_from' => '`entete` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'telephone' => array(
				'parent_table' => 'entete',
				'parent_pk_field' => 'identete',
				'parent_caption' => '`entete`.`telephone`',
				'parent_from' => '`entete` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'whatsapp' => array(
				'parent_table' => 'entete',
				'parent_pk_field' => 'identete',
				'parent_caption' => '`entete`.`whatsapp`',
				'parent_from' => '`entete` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'email' => array(
				'parent_table' => 'entete',
				'parent_pk_field' => 'identete',
				'parent_caption' => '`entete`.`email`',
				'parent_from' => '`entete` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'site_web' => array(
				'parent_table' => 'entete',
				'parent_pk_field' => 'identete',
				'parent_caption' => '`entete`.`site_web`',
				'parent_from' => '`entete` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'bp' => array(
				'parent_table' => 'entete',
				'parent_pk_field' => 'identete',
				'parent_caption' => '`entete`.`bp`',
				'parent_from' => '`entete` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'footer_3' => array(
				'parent_table' => 'entete',
				'parent_pk_field' => 'identete',
				'parent_caption' => '`entete`.`footer_3`',
				'parent_from' => '`entete` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'notice' => array(
				'parent_table' => 'entete',
				'parent_pk_field' => 'identete',
				'parent_caption' => '`entete`.`notice`',
				'parent_from' => '`entete` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'signataire' => array(
				'parent_table' => 'entete',
				'parent_pk_field' => 'identete',
				'parent_caption' => '`entete`.`signataire`',
				'parent_from' => '`entete` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
		),
		'changes' => array(
			'link_out' => array(
				'parent_table' => 'gestion_changes',
				'parent_pk_field' => 'idgchange',
				'parent_caption' => '`gestion_changes`.`link_in`',
				'parent_from' => '`gestion_changes` LEFT JOIN `entete` as entete1 ON `entete1`.`identete`=`gestion_changes`.`avec_entete` LEFT JOIN `clients` as clients1 ON `clients1`.`idclient`=`gestion_changes`.`nom_prenom` LEFT JOIN `pays` as pays1 ON `pays1`.`idpays`=`clients1`.`nationalite` LEFT JOIN `fonctions` as fonctions1 ON `fonctions1`.`idfonction`=`clients1`.`fonction` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
		),
		'partages' => array(
			'statut' => array(
				'parent_table' => 'statut_partage',
				'parent_pk_field' => 'idstatutpartage',
				'parent_caption' => '`statut_partage`.`statut`',
				'parent_from' => '`statut_partage` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'client' => array(
				'parent_table' => 'clients',
				'parent_pk_field' => 'idclient',
				'parent_caption' => 'IF(CHAR_LENGTH(`clients`.`prenom`) || CHAR_LENGTH(`clients`.`nom`), CONCAT_WS(\'\', `clients`.`prenom`, \'   \', `clients`.`nom`), \'\')',
				'parent_from' => '`clients` LEFT JOIN `type_client` as type_client1 ON `type_client1`.`idtype_client`=`clients`.`type_client` LEFT JOIN `agences` as agences1 ON `agences1`.`idagence`=`clients`.`agence` LEFT JOIN `pays` as pays1 ON `pays1`.`idpays`=`clients`.`nationalite` LEFT JOIN `produits_services` as produits_services1 ON `produits_services1`.`idps`=`clients`.`categorie` LEFT JOIN `fonctions` as fonctions1 ON `fonctions1`.`idfonction`=`clients`.`fonction` LEFT JOIN `activites` as activites1 ON `activites1`.`idactivite`=`clients`.`activite` LEFT JOIN `pays` as pays2 ON `pays2`.`idpays`=`clients`.`lieu` LEFT JOIN `banques` as banques1 ON `banques1`.`idbanque`=`clients`.`banque` LEFT JOIN `fidelite` as fidelite1 ON `fidelite1`.`idfidelite`=`clients`.`carte_fidelite` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
		),
		'type_compagnie' => array(
		),
		'compagnies' => array(
			'type' => array(
				'parent_table' => 'type_compagnie',
				'parent_pk_field' => 'idtypecompagnie',
				'parent_caption' => '`type_compagnie`.`type_compangie`',
				'parent_from' => '`type_compagnie` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
		),
		'produits_services' => array(
		),
		'banques' => array(
		),
		'pays' => array(
		),
		'villes' => array(
		),
		'items' => array(
		),
		'type_client' => array(
		),
		'fonctions' => array(
		),
		'activites' => array(
		),
		'postes' => array(
		),
		'annees' => array(
		),
		'gds' => array(
		),
		'objets' => array(
		),
		'type_rapport' => array(
		),
		'fidelite' => array(
		),
		'pointages' => array(
			'nom_prenom' => array(
				'parent_table' => 'personnels',
				'parent_pk_field' => 'idpersonnel',
				'parent_caption' => 'IF(CHAR_LENGTH(`personnels`.`nom`) || CHAR_LENGTH(`personnels`.`prenom`), CONCAT_WS(\'\', `personnels`.`nom`, \'   \', `personnels`.`prenom`), \'\')',
				'parent_from' => '`personnels` LEFT JOIN `pays` as pays1 ON `pays1`.`idpays`=`personnels`.`nationalite` LEFT JOIN `agences` as agences1 ON `agences1`.`idagence`=`personnels`.`agence` LEFT JOIN `fonctions` as fonctions1 ON `fonctions1`.`idfonction`=`personnels`.`fonction` LEFT JOIN `produits_services` as produits_services1 ON `produits_services1`.`idps`=`personnels`.`service` LEFT JOIN `postes` as postes1 ON `postes1`.`idposte`=`personnels`.`poste` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'agence' => array(
				'parent_table' => 'personnels',
				'parent_pk_field' => 'idpersonnel',
				'parent_caption' => 'IF(    CHAR_LENGTH(`agences1`.`agence`), CONCAT_WS(\'\',   `agences1`.`agence`), \'\')',
				'parent_from' => '`personnels` LEFT JOIN `pays` as pays1 ON `pays1`.`idpays`=`personnels`.`nationalite` LEFT JOIN `agences` as agences1 ON `agences1`.`idagence`=`personnels`.`agence` LEFT JOIN `fonctions` as fonctions1 ON `fonctions1`.`idfonction`=`personnels`.`fonction` LEFT JOIN `produits_services` as produits_services1 ON `produits_services1`.`idps`=`personnels`.`service` LEFT JOIN `postes` as postes1 ON `postes1`.`idposte`=`personnels`.`poste` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'fonction' => array(
				'parent_table' => 'personnels',
				'parent_pk_field' => 'idpersonnel',
				'parent_caption' => 'IF(    CHAR_LENGTH(`fonctions1`.`fonction`), CONCAT_WS(\'\',   `fonctions1`.`fonction`), \'\')',
				'parent_from' => '`personnels` LEFT JOIN `pays` as pays1 ON `pays1`.`idpays`=`personnels`.`nationalite` LEFT JOIN `agences` as agences1 ON `agences1`.`idagence`=`personnels`.`agence` LEFT JOIN `fonctions` as fonctions1 ON `fonctions1`.`idfonction`=`personnels`.`fonction` LEFT JOIN `produits_services` as produits_services1 ON `produits_services1`.`idps`=`personnels`.`service` LEFT JOIN `postes` as postes1 ON `postes1`.`idposte`=`personnels`.`poste` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
		),
		'note_de_service' => array(
		),
		'redactions' => array(
			'objet' => array(
				'parent_table' => 'objets',
				'parent_pk_field' => 'idobjet',
				'parent_caption' => '`objets`.`objet`',
				'parent_from' => '`objets` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
		),
		'rapports_activite' => array(
			'objet' => array(
				'parent_table' => 'objets',
				'parent_pk_field' => 'idobjet',
				'parent_caption' => '`objets`.`objet`',
				'parent_from' => '`objets` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'type_rapport' => array(
				'parent_table' => 'type_rapport',
				'parent_pk_field' => 'idtrpt',
				'parent_caption' => '`type_rapport`.`type_rapport`',
				'parent_from' => '`type_rapport` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
		),
		'gestion_comptes' => array(
			'banque' => array(
				'parent_table' => 'banques',
				'parent_pk_field' => 'idbanque',
				'parent_caption' => '`banques`.`banque`',
				'parent_from' => '`banques` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'type_compte' => array(
				'parent_table' => 'type_comptes',
				'parent_pk_field' => 'idtypecompte',
				'parent_caption' => '`type_comptes`.`type_compte`',
				'parent_from' => '`type_comptes` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
		),
		'gestion_comptes_1' => array(
			'banque' => array(
				'parent_table' => 'banques',
				'parent_pk_field' => 'idbanque',
				'parent_caption' => '`banques`.`banque`',
				'parent_from' => '`banques` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'type_compte' => array(
				'parent_table' => 'type_comptes',
				'parent_pk_field' => 'idtypecompte',
				'parent_caption' => '`type_comptes`.`type_compte`',
				'parent_from' => '`type_comptes` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
		),
		'type_comptes' => array(
		),
		'journal' => array(
			'compte_debit' => array(
				'parent_table' => 'gestion_comptes',
				'parent_pk_field' => 'idgestioncompte',
				'parent_caption' => 'IF(CHAR_LENGTH(`gestion_comptes`.`num_compte`) || CHAR_LENGTH(`gestion_comptes`.`nom_compte`), CONCAT_WS(\'\', `gestion_comptes`.`num_compte`, \' - \', `gestion_comptes`.`nom_compte`), \'\')',
				'parent_from' => '`gestion_comptes` LEFT JOIN `banques` as banques1 ON `banques1`.`idbanque`=`gestion_comptes`.`banque` LEFT JOIN `type_comptes` as type_comptes1 ON `type_comptes1`.`idtypecompte`=`gestion_comptes`.`type_compte` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'compte_credit' => array(
				'parent_table' => 'gestion_comptes',
				'parent_pk_field' => 'idgestioncompte',
				'parent_caption' => 'IF(CHAR_LENGTH(`gestion_comptes`.`num_compte`) || CHAR_LENGTH(`gestion_comptes`.`nom_compte`), CONCAT_WS(\'\', `gestion_comptes`.`num_compte`, \' - \', `gestion_comptes`.`nom_compte`), \'\')',
				'parent_from' => '`gestion_comptes` LEFT JOIN `banques` as banques1 ON `banques1`.`idbanque`=`gestion_comptes`.`banque` LEFT JOIN `type_comptes` as type_comptes1 ON `type_comptes1`.`idtypecompte`=`gestion_comptes`.`type_compte` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
		),
		'liens' => array(
		),
		'courrier_entrant' => array(
		),
		'courrier_sortant' => array(
		),
		'vitae' => array(
		),
		'reunions' => array(
			'avec_entete' => array(
				'parent_table' => 'entete',
				'parent_pk_field' => 'identete',
				'parent_caption' => '`entete`.`nom`',
				'parent_from' => '`entete` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => true
			),
			'rs' => array(
				'parent_table' => 'entete',
				'parent_pk_field' => 'identete',
				'parent_caption' => '`entete`.`raison_sociale`',
				'parent_from' => '`entete` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'devise' => array(
				'parent_table' => 'entete',
				'parent_pk_field' => 'identete',
				'parent_caption' => '`entete`.`devise`',
				'parent_from' => '`entete` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'logo' => array(
				'parent_table' => 'entete',
				'parent_pk_field' => 'identete',
				'parent_caption' => '`entete`.`logo`',
				'parent_from' => '`entete` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'description' => array(
				'parent_table' => 'entete',
				'parent_pk_field' => 'identete',
				'parent_caption' => '`entete`.`description`',
				'parent_from' => '`entete` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'adresse' => array(
				'parent_table' => 'entete',
				'parent_pk_field' => 'identete',
				'parent_caption' => '`entete`.`adresse`',
				'parent_from' => '`entete` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'telephone' => array(
				'parent_table' => 'entete',
				'parent_pk_field' => 'identete',
				'parent_caption' => '`entete`.`telephone`',
				'parent_from' => '`entete` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'whatsapp' => array(
				'parent_table' => 'entete',
				'parent_pk_field' => 'identete',
				'parent_caption' => '`entete`.`whatsapp`',
				'parent_from' => '`entete` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'email' => array(
				'parent_table' => 'entete',
				'parent_pk_field' => 'identete',
				'parent_caption' => '`entete`.`email`',
				'parent_from' => '`entete` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'site_web' => array(
				'parent_table' => 'entete',
				'parent_pk_field' => 'identete',
				'parent_caption' => '`entete`.`site_web`',
				'parent_from' => '`entete` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'bp' => array(
				'parent_table' => 'entete',
				'parent_pk_field' => 'identete',
				'parent_caption' => '`entete`.`bp`',
				'parent_from' => '`entete` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'footer_3' => array(
				'parent_table' => 'entete',
				'parent_pk_field' => 'identete',
				'parent_caption' => '`entete`.`footer_3`',
				'parent_from' => '`entete` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'notice' => array(
				'parent_table' => 'entete',
				'parent_pk_field' => 'identete',
				'parent_caption' => '`entete`.`notice`',
				'parent_from' => '`entete` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'signataire' => array(
				'parent_table' => 'entete',
				'parent_pk_field' => 'identete',
				'parent_caption' => '`entete`.`signataire`',
				'parent_from' => '`entete` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
		),
		'item_reunions' => array(
			'link_out' => array(
				'parent_table' => 'reunions',
				'parent_pk_field' => 'idreunion',
				'parent_caption' => '`reunions`.`link_in`',
				'parent_from' => '`reunions` LEFT JOIN `entete` as entete1 ON `entete1`.`identete`=`reunions`.`avec_entete` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
		),
		'statut_partage' => array(
		),
		'chequiers' => array(
			'compte' => array(
				'parent_table' => 'gestion_comptes',
				'parent_pk_field' => 'idgestioncompte',
				'parent_caption' => '`gestion_comptes`.`num_compte`',
				'parent_from' => '`gestion_comptes` LEFT JOIN `banques` as banques1 ON `banques1`.`idbanque`=`gestion_comptes`.`banque` LEFT JOIN `type_comptes` as type_comptes1 ON `type_comptes1`.`idtypecompte`=`gestion_comptes`.`type_compte` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'banque' => array(
				'parent_table' => 'gestion_comptes',
				'parent_pk_field' => 'idgestioncompte',
				'parent_caption' => 'IF(    CHAR_LENGTH(`banques1`.`banque`), CONCAT_WS(\'\',   `banques1`.`banque`), \'\')',
				'parent_from' => '`gestion_comptes` LEFT JOIN `banques` as banques1 ON `banques1`.`idbanque`=`gestion_comptes`.`banque` LEFT JOIN `type_comptes` as type_comptes1 ON `type_comptes1`.`idtypecompte`=`gestion_comptes`.`type_compte` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
		),
		'cheques' => array(
			'chequier' => array(
				'parent_table' => 'chequiers',
				'parent_pk_field' => 'idchequier',
				'parent_caption' => '`chequiers`.`idchequier`',
				'parent_from' => '`chequiers` LEFT JOIN `gestion_comptes` as gestion_comptes1 ON `gestion_comptes1`.`idgestioncompte`=`chequiers`.`compte` LEFT JOIN `banques` as banques1 ON `banques1`.`idbanque`=`gestion_comptes1`.`banque` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
		),
		'gestion_banques' => array(
			'compte_emetteur' => array(
				'parent_table' => 'gestion_comptes_1',
				'parent_pk_field' => 'idgestioncompte',
				'parent_caption' => '`gestion_comptes_1`.`nom_compte`',
				'parent_from' => '`gestion_comptes_1` LEFT JOIN `banques` as banques1 ON `banques1`.`idbanque`=`gestion_comptes_1`.`banque` LEFT JOIN `type_comptes` as type_comptes1 ON `type_comptes1`.`idtypecompte`=`gestion_comptes_1`.`type_compte` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'numero' => array(
				'parent_table' => 'gestion_comptes_1',
				'parent_pk_field' => 'idgestioncompte',
				'parent_caption' => '`gestion_comptes_1`.`num_compte`',
				'parent_from' => '`gestion_comptes_1` LEFT JOIN `banques` as banques1 ON `banques1`.`idbanque`=`gestion_comptes_1`.`banque` LEFT JOIN `type_comptes` as type_comptes1 ON `type_comptes1`.`idtypecompte`=`gestion_comptes_1`.`type_compte` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'banque' => array(
				'parent_table' => 'gestion_comptes_1',
				'parent_pk_field' => 'idgestioncompte',
				'parent_caption' => 'IF(    CHAR_LENGTH(`banques1`.`banque`), CONCAT_WS(\'\',   `banques1`.`banque`), \'\')',
				'parent_from' => '`gestion_comptes_1` LEFT JOIN `banques` as banques1 ON `banques1`.`idbanque`=`gestion_comptes_1`.`banque` LEFT JOIN `type_comptes` as type_comptes1 ON `type_comptes1`.`idtypecompte`=`gestion_comptes_1`.`type_compte` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'compte_beneficiaire' => array(
				'parent_table' => 'gestion_comptes',
				'parent_pk_field' => 'idgestioncompte',
				'parent_caption' => '`gestion_comptes`.`nom_compte`',
				'parent_from' => '`gestion_comptes` LEFT JOIN `banques` as banques1 ON `banques1`.`idbanque`=`gestion_comptes`.`banque` LEFT JOIN `type_comptes` as type_comptes1 ON `type_comptes1`.`idtypecompte`=`gestion_comptes`.`type_compte` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'numero_cb' => array(
				'parent_table' => 'gestion_comptes',
				'parent_pk_field' => 'idgestioncompte',
				'parent_caption' => '`gestion_comptes`.`num_compte`',
				'parent_from' => '`gestion_comptes` LEFT JOIN `banques` as banques1 ON `banques1`.`idbanque`=`gestion_comptes`.`banque` LEFT JOIN `type_comptes` as type_comptes1 ON `type_comptes1`.`idtypecompte`=`gestion_comptes`.`type_compte` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'banque_cb' => array(
				'parent_table' => 'gestion_comptes',
				'parent_pk_field' => 'idgestioncompte',
				'parent_caption' => 'IF(    CHAR_LENGTH(`banques1`.`banque`), CONCAT_WS(\'\',   `banques1`.`banque`), \'\')',
				'parent_from' => '`gestion_comptes` LEFT JOIN `banques` as banques1 ON `banques1`.`idbanque`=`gestion_comptes`.`banque` LEFT JOIN `type_comptes` as type_comptes1 ON `type_comptes1`.`idtypecompte`=`gestion_comptes`.`type_compte` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'cheque_mv' => array(
				'parent_table' => 'cheques',
				'parent_pk_field' => 'idcheque',
				'parent_caption' => '`cheques`.`num`',
				'parent_from' => '`cheques` LEFT JOIN `chequiers` as chequiers1 ON `chequiers1`.`idchequier`=`cheques`.`chequier` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
		),
		'suivi_banques' => array(
			'description' => array(
				'parent_table' => 'desc_suivi_banque',
				'parent_pk_field' => 'iddsb',
				'parent_caption' => '`desc_suivi_banque`.`description`',
				'parent_from' => '`desc_suivi_banque` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
		),
		'charges_fixe' => array(
			'libelle' => array(
				'parent_table' => 'libelle_charges_fixe',
				'parent_pk_field' => 'idlcf',
				'parent_caption' => '`libelle_charges_fixe`.`libelle`',
				'parent_from' => '`libelle_charges_fixe` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
		),
		'caisse' => array(
		),
		'type_visa' => array(
		),
		'libelle_charges_fixe' => array(
		),
		'desc_suivi_banque' => array(
		),
	);

	// XSS prevention
	$xss = new CI_Input();
	$xss->charset = datalist_db_encoding;

	// receive and verify user input
	$table_name = $_REQUEST['t'];
	$field_name = $_REQUEST['f'];
	$search_id = makeSafe(from_utf8($_REQUEST['id']));
	$selected_text = from_utf8($_REQUEST['text']);
	$returnOptions = ($_REQUEST['o'] == 1 ? true : false);
	$page = intval($_REQUEST['p']);
	if($page < 1)  $page = 1;
	$skip = $results_per_page * ($page - 1);
	$search_term = makeSafe(from_utf8($_REQUEST['s']));

	if(!isset($lookups[$table_name][$field_name])) die('{ "error": "Invalid table or field." }');

	// can user access the requested table?
	$perm = getTablePermissions($table_name);
	if(!$perm[0] && !$search_id) die('{ "error": "' . addslashes($Translation['tableAccessDenied']) . '" }');

	$field = $lookups[$table_name][$field_name];

	$wheres = array();

	// search term provided?
	if($search_term) {
		$wheres[] = "{$field['parent_caption']} like '%{$search_term}%'";
	}

	// any filterers specified?
	if(is_array($field['filterers'])) {
		foreach($field['filterers'] as $filterer => $filterer_parent) {
			$get = (isset($_REQUEST["filterer_{$filterer}"]) ? $_REQUEST["filterer_{$filterer}"] : false);
			if($get) {
				$wheres[] = "`{$field['parent_table']}`.`$filterer_parent`='" . makeSafe($get) . "'";
			}
		}
	}

	// inherit permissions?
	if($field['inherit_permissions']) {
		$inherit = permissions_sql($field['parent_table']);
		if($inherit === false && !$search_id) die($Translation['tableAccessDenied']);

		if($inherit['where']) $wheres[] = $inherit['where'];
		if($inherit['from']) $field['parent_from'] .= ", {$inherit['from']}";
	}

	// single value?
	if($field['list_type'] != 2 && $search_id) {
		$wheres[] = "`{$field['parent_table']}`.`{$field['parent_pk_field']}`='{$search_id}'";
	}

	if(count($wheres)) {
		$where = 'WHERE ' . implode(' AND ', $wheres);
	}

	// define the combo and return the code
	$combo = new DataCombo;
	if($field['custom_query']) {
		$qm = array(); $custom_where = ''; $custom_order_by = '2';
		$combo->Query = $field['custom_query'];

		if(preg_match('/ order by (.*)$/i', $combo->Query, $qm)) {
			$custom_order_by = $qm[1];
			$combo->Query = preg_replace('/ order by .*$/i', '', $combo->Query);
		}

		if(preg_match('/ where (.*)$/i', $combo->Query, $qm)) {
			$custom_where = $qm[1];
			$combo->Query = preg_replace('/ where .*$/i', '', $combo->Query);
		}

		if($where && $custom_where) {
			$combo->Query .=  " {$where} AND ({$custom_where}) ORDER BY {$custom_order_by}";
		}elseif($custom_where) {
			$combo->Query .=  " WHERE {$custom_where} ORDER BY {$custom_order_by}";
		}else{
			$combo->Query .=  " {$where} ORDER BY {$custom_order_by}";
		}

		$query_match = array();
		preg_match('/select (.*) from (.*)$/i', $combo->Query, $query_match);

		if(isset($query_match[2])) {
			$count_query = "SELECT count(1) FROM {$query_match[2]}";
		}else{
			$count_query = '';
		}
	}else{
		$combo->Query = "SELECT " . ($field['inherit_permissions'] ? 'DISTINCT ' : '') . "`{$field['parent_table']}`.`{$field['parent_pk_field']}`, {$field['parent_caption']} FROM {$field['parent_from']} {$where} ORDER BY 2";
		$count_query = "SELECT count(1) FROM {$field['parent_from']} {$where}";
	}
	$combo->table = $table_name;
	$combo->parent_table = $field['parent_table'];
	$combo->SelectName = $field_name;
	$combo->ListType = $field['list_type'];
	if($search_id) {
		$combo->SelectedData = $search_id;
	}elseif($selected_text) {
		$combo->SelectedData = getValueGivenCaption($combo->Query, $selected_text);
	}

	if($field['list_type'] == 2) {
		$combo->Render();
		$combo->HTML = str_replace('<select ', '<select onchange="' . $field_name . '_changed();" ', $combo->HTML);

		// return response
		if($returnOptions) {
			?><span id="<?php echo $field_name; ?>-combo-list"><?php echo $combo->HTML; ?></span><?php
		}else{
			?>
				<span id="<?php echo $field_name; ?>-match-text"><?php echo $combo->MatchText; ?></span>
				<input type="hidden" id="<?php echo $field_name; ?>" value="<?php echo html_attr($combo->SelectedData); ?>" />
			<?php
		}
	}else{
		/* return json */
		header('Content-type: application/json');

		if(!preg_match('/ limit .+/i', $combo->Query)) {
			if(!$search_id) $combo->Query .= " LIMIT {$skip}, {$results_per_page}";
			if($search_id) $combo->Query .= " LIMIT 1";
		}

		$prepared_data = array();

		// specific caption provided and list_type is not radio?
		if(!$search_id && $selected_text) {
			$search_id = getValueGivenCaption($combo->Query, $selected_text);
			if($search_id) $prepared_data[] = array('id' => to_utf8($search_id), 'text' => to_utf8($xss->xss_clean($selected_text)));
		}else{
			/*
			 * in case we have a search term, show matches starting with it first,
			 * followed by those containing it.
			 * build a UNION query for that purpose
			 */
			if($search_term) {
				$query2 = $combo->Query;
				$query1 = str_replace(" like '%{$search_term}%'", " like '{$search_term}%'", $query2);
				$combo->Query = "({$query1}) UNION ({$query2})";
			}

			$eo = array('silentErrors' => true);

			$res = sql($combo->Query, $eo);
			while($row = db_fetch_row($res)) {
				if(empty($prepared_data) && $page == 1 && !$search_id && !$field['not_null']) {
					$prepared_data[] = array('id' => empty_lookup_value, 'text' => to_utf8("<{$Translation['none']}>"));
				}

				$prepared_data[] = array('id' => to_utf8($row[0]), 'text' => to_utf8($xss->xss_clean($row[1])));
			}
		}

		if(empty($prepared_data)) { $prepared_data[] = array('id' => '', 'text' => to_utf8($Translation['No matches found!'])); }

		echo json_encode(array(
			'results' => $prepared_data,
			'more' => (@db_num_rows($res) >= $results_per_page),
			'elapsed' => round(microtime(true) - $start_ts, 3)
		));
	}

