<?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(
		'main' => array(
		),
		'clients' => array(
			'type' => array(
				'parent_table' => 'types_client',
				'parent_pk_field' => 'idtype_client',
				'parent_caption' => '`types_client`.`type_client`',
				'parent_from' => '`types_client` ',
				'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' => true
			),
			'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' => true
			),
			'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' => false
			),
			'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' => 'cartes_fidelite',
				'parent_pk_field' => 'idcartecf',
				'parent_caption' => '`cartes_fidelite`.`carte_fidelite`',
				'parent_from' => '`cartes_fidelite` ',
				'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` LEFT JOIN `villes` as villes1 ON `villes1`.`idville`=`agences`.`ville` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
		),
		'gestionnaires' => array(
			'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
			),
			'agence' => array(
				'parent_table' => 'agences',
				'parent_pk_field' => 'idagence',
				'parent_caption' => '`agences`.`agence`',
				'parent_from' => '`agences` LEFT JOIN `villes` as villes1 ON `villes1`.`idville`=`agences`.`ville` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
		),
		'partenaires' => array(
			'raison_sociale' => array(
				'parent_table' => 'clients',
				'parent_pk_field' => 'matricule_client',
				'parent_caption' => '`clients`.`nom_prenom`',
				'parent_from' => '`clients` LEFT JOIN `types_client` as types_client1 ON `types_client1`.`idtype_client`=`clients`.`type` LEFT JOIN `pays` as pays1 ON `pays1`.`idpays`=`clients`.`nationalite` LEFT JOIN `fonctions` as fonctions1 ON `fonctions1`.`idfonction`=`clients`.`fonction` LEFT JOIN `pays` as pays2 ON `pays2`.`idpays`=`clients`.`lieu` LEFT JOIN `banques` as banques1 ON `banques1`.`idbanque`=`clients`.`banque` LEFT JOIN `cartes_fidelite` as cartes_fidelite1 ON `cartes_fidelite1`.`idcartecf`=`clients`.`carte_fidelite` LEFT JOIN `agences` as agences1 ON `agences1`.`idagence`=`clients`.`agence` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'fonction' => array(
				'parent_table' => 'clients',
				'parent_pk_field' => 'matricule_client',
				'parent_caption' => 'IF(    CHAR_LENGTH(`fonctions1`.`fonction`), CONCAT_WS(\'\',   `fonctions1`.`fonction`), \'\')',
				'parent_from' => '`clients` LEFT JOIN `types_client` as types_client1 ON `types_client1`.`idtype_client`=`clients`.`type` LEFT JOIN `pays` as pays1 ON `pays1`.`idpays`=`clients`.`nationalite` LEFT JOIN `fonctions` as fonctions1 ON `fonctions1`.`idfonction`=`clients`.`fonction` LEFT JOIN `pays` as pays2 ON `pays2`.`idpays`=`clients`.`lieu` LEFT JOIN `banques` as banques1 ON `banques1`.`idbanque`=`clients`.`banque` LEFT JOIN `cartes_fidelite` as cartes_fidelite1 ON `cartes_fidelite1`.`idcartecf`=`clients`.`carte_fidelite` LEFT JOIN `agences` as agences1 ON `agences1`.`idagence`=`clients`.`agence` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'adresse' => array(
				'parent_table' => 'clients',
				'parent_pk_field' => 'matricule_client',
				'parent_caption' => '`clients`.`adresse`',
				'parent_from' => '`clients` LEFT JOIN `types_client` as types_client1 ON `types_client1`.`idtype_client`=`clients`.`type` LEFT JOIN `pays` as pays1 ON `pays1`.`idpays`=`clients`.`nationalite` LEFT JOIN `fonctions` as fonctions1 ON `fonctions1`.`idfonction`=`clients`.`fonction` LEFT JOIN `pays` as pays2 ON `pays2`.`idpays`=`clients`.`lieu` LEFT JOIN `banques` as banques1 ON `banques1`.`idbanque`=`clients`.`banque` LEFT JOIN `cartes_fidelite` as cartes_fidelite1 ON `cartes_fidelite1`.`idcartecf`=`clients`.`carte_fidelite` LEFT JOIN `agences` as agences1 ON `agences1`.`idagence`=`clients`.`agence` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'telephone' => array(
				'parent_table' => 'clients',
				'parent_pk_field' => 'matricule_client',
				'parent_caption' => '`clients`.`telephone`',
				'parent_from' => '`clients` LEFT JOIN `types_client` as types_client1 ON `types_client1`.`idtype_client`=`clients`.`type` LEFT JOIN `pays` as pays1 ON `pays1`.`idpays`=`clients`.`nationalite` LEFT JOIN `fonctions` as fonctions1 ON `fonctions1`.`idfonction`=`clients`.`fonction` LEFT JOIN `pays` as pays2 ON `pays2`.`idpays`=`clients`.`lieu` LEFT JOIN `banques` as banques1 ON `banques1`.`idbanque`=`clients`.`banque` LEFT JOIN `cartes_fidelite` as cartes_fidelite1 ON `cartes_fidelite1`.`idcartecf`=`clients`.`carte_fidelite` LEFT JOIN `agences` as agences1 ON `agences1`.`idagence`=`clients`.`agence` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'email' => array(
				'parent_table' => 'clients',
				'parent_pk_field' => 'matricule_client',
				'parent_caption' => '`clients`.`email`',
				'parent_from' => '`clients` LEFT JOIN `types_client` as types_client1 ON `types_client1`.`idtype_client`=`clients`.`type` LEFT JOIN `pays` as pays1 ON `pays1`.`idpays`=`clients`.`nationalite` LEFT JOIN `fonctions` as fonctions1 ON `fonctions1`.`idfonction`=`clients`.`fonction` LEFT JOIN `pays` as pays2 ON `pays2`.`idpays`=`clients`.`lieu` LEFT JOIN `banques` as banques1 ON `banques1`.`idbanque`=`clients`.`banque` LEFT JOIN `cartes_fidelite` as cartes_fidelite1 ON `cartes_fidelite1`.`idcartecf`=`clients`.`carte_fidelite` LEFT JOIN `agences` as agences1 ON `agences1`.`idagence`=`clients`.`agence` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'banque' => array(
				'parent_table' => 'clients',
				'parent_pk_field' => 'matricule_client',
				'parent_caption' => 'IF(    CHAR_LENGTH(`banques1`.`banque`), CONCAT_WS(\'\',   `banques1`.`banque`), \'\')',
				'parent_from' => '`clients` LEFT JOIN `types_client` as types_client1 ON `types_client1`.`idtype_client`=`clients`.`type` LEFT JOIN `pays` as pays1 ON `pays1`.`idpays`=`clients`.`nationalite` LEFT JOIN `fonctions` as fonctions1 ON `fonctions1`.`idfonction`=`clients`.`fonction` LEFT JOIN `pays` as pays2 ON `pays2`.`idpays`=`clients`.`lieu` LEFT JOIN `banques` as banques1 ON `banques1`.`idbanque`=`clients`.`banque` LEFT JOIN `cartes_fidelite` as cartes_fidelite1 ON `cartes_fidelite1`.`idcartecf`=`clients`.`carte_fidelite` LEFT JOIN `agences` as agences1 ON `agences1`.`idagence`=`clients`.`agence` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'compte' => array(
				'parent_table' => 'clients',
				'parent_pk_field' => 'matricule_client',
				'parent_caption' => '`clients`.`compte`',
				'parent_from' => '`clients` LEFT JOIN `types_client` as types_client1 ON `types_client1`.`idtype_client`=`clients`.`type` LEFT JOIN `pays` as pays1 ON `pays1`.`idpays`=`clients`.`nationalite` LEFT JOIN `fonctions` as fonctions1 ON `fonctions1`.`idfonction`=`clients`.`fonction` LEFT JOIN `pays` as pays2 ON `pays2`.`idpays`=`clients`.`lieu` LEFT JOIN `banques` as banques1 ON `banques1`.`idbanque`=`clients`.`banque` LEFT JOIN `cartes_fidelite` as cartes_fidelite1 ON `cartes_fidelite1`.`idcartecf`=`clients`.`carte_fidelite` LEFT JOIN `agences` as agences1 ON `agences1`.`idagence`=`clients`.`agence` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
		),
		'paiements' => array(
			'matricule' => array(
				'parent_table' => 'clients',
				'parent_pk_field' => 'matricule_client',
				'parent_caption' => '`clients`.`matricule_client`',
				'parent_from' => '`clients` LEFT JOIN `types_client` as types_client1 ON `types_client1`.`idtype_client`=`clients`.`type` LEFT JOIN `pays` as pays1 ON `pays1`.`idpays`=`clients`.`nationalite` LEFT JOIN `fonctions` as fonctions1 ON `fonctions1`.`idfonction`=`clients`.`fonction` LEFT JOIN `pays` as pays2 ON `pays2`.`idpays`=`clients`.`lieu` LEFT JOIN `banques` as banques1 ON `banques1`.`idbanque`=`clients`.`banque` LEFT JOIN `cartes_fidelite` as cartes_fidelite1 ON `cartes_fidelite1`.`idcartecf`=`clients`.`carte_fidelite` LEFT JOIN `agences` as agences1 ON `agences1`.`idagence`=`clients`.`agence` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'nom_prenom' => array(
				'parent_table' => 'clients',
				'parent_pk_field' => 'matricule_client',
				'parent_caption' => '`clients`.`nom_prenom`',
				'parent_from' => '`clients` LEFT JOIN `types_client` as types_client1 ON `types_client1`.`idtype_client`=`clients`.`type` LEFT JOIN `pays` as pays1 ON `pays1`.`idpays`=`clients`.`nationalite` LEFT JOIN `fonctions` as fonctions1 ON `fonctions1`.`idfonction`=`clients`.`fonction` LEFT JOIN `pays` as pays2 ON `pays2`.`idpays`=`clients`.`lieu` LEFT JOIN `banques` as banques1 ON `banques1`.`idbanque`=`clients`.`banque` LEFT JOIN `cartes_fidelite` as cartes_fidelite1 ON `cartes_fidelite1`.`idcartecf`=`clients`.`carte_fidelite` LEFT JOIN `agences` as agences1 ON `agences1`.`idagence`=`clients`.`agence` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'banque' => array(
				'parent_table' => 'clients',
				'parent_pk_field' => 'matricule_client',
				'parent_caption' => 'IF(    CHAR_LENGTH(`banques1`.`banque`), CONCAT_WS(\'\',   `banques1`.`banque`), \'\')',
				'parent_from' => '`clients` LEFT JOIN `types_client` as types_client1 ON `types_client1`.`idtype_client`=`clients`.`type` LEFT JOIN `pays` as pays1 ON `pays1`.`idpays`=`clients`.`nationalite` LEFT JOIN `fonctions` as fonctions1 ON `fonctions1`.`idfonction`=`clients`.`fonction` LEFT JOIN `pays` as pays2 ON `pays2`.`idpays`=`clients`.`lieu` LEFT JOIN `banques` as banques1 ON `banques1`.`idbanque`=`clients`.`banque` LEFT JOIN `cartes_fidelite` as cartes_fidelite1 ON `cartes_fidelite1`.`idcartecf`=`clients`.`carte_fidelite` LEFT JOIN `agences` as agences1 ON `agences1`.`idagence`=`clients`.`agence` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'compte' => array(
				'parent_table' => 'clients',
				'parent_pk_field' => 'matricule_client',
				'parent_caption' => '`clients`.`compte`',
				'parent_from' => '`clients` LEFT JOIN `types_client` as types_client1 ON `types_client1`.`idtype_client`=`clients`.`type` LEFT JOIN `pays` as pays1 ON `pays1`.`idpays`=`clients`.`nationalite` LEFT JOIN `fonctions` as fonctions1 ON `fonctions1`.`idfonction`=`clients`.`fonction` LEFT JOIN `pays` as pays2 ON `pays2`.`idpays`=`clients`.`lieu` LEFT JOIN `banques` as banques1 ON `banques1`.`idbanque`=`clients`.`banque` LEFT JOIN `cartes_fidelite` as cartes_fidelite1 ON `cartes_fidelite1`.`idcartecf`=`clients`.`carte_fidelite` LEFT JOIN `agences` as agences1 ON `agences1`.`idagence`=`clients`.`agence` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'type_paiement' => array(
				'parent_table' => 'type_paiements',
				'parent_pk_field' => 'idtype_payment',
				'parent_caption' => '`type_paiements`.`type_paiement`',
				'parent_from' => '`type_paiements` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'beneficiaire' => array(
				'parent_table' => 'partenaires',
				'parent_pk_field' => 'matricule_partenaire',
				'parent_caption' => '`partenaires`.`matricule_partenaire`',
				'parent_from' => '`partenaires` LEFT JOIN `clients` as clients1 ON `clients1`.`matricule_client`=`partenaires`.`raison_sociale` LEFT JOIN `fonctions` as fonctions1 ON `fonctions1`.`idfonction`=`clients1`.`fonction` LEFT JOIN `banques` as banques1 ON `banques1`.`idbanque`=`clients1`.`banque` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'rs' => array(
				'parent_table' => 'partenaires',
				'parent_pk_field' => 'matricule_partenaire',
				'parent_caption' => 'IF(    CHAR_LENGTH(`clients1`.`nom_prenom`), CONCAT_WS(\'\',   `clients1`.`nom_prenom`), \'\')',
				'parent_from' => '`partenaires` LEFT JOIN `clients` as clients1 ON `clients1`.`matricule_client`=`partenaires`.`raison_sociale` LEFT JOIN `fonctions` as fonctions1 ON `fonctions1`.`idfonction`=`clients1`.`fonction` LEFT JOIN `banques` as banques1 ON `banques1`.`idbanque`=`clients1`.`banque` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'banque_beneficiaire' => array(
				'parent_table' => 'partenaires',
				'parent_pk_field' => 'matricule_partenaire',
				'parent_caption' => 'IF(    CHAR_LENGTH(`banques1`.`banque`), CONCAT_WS(\'\',   `banques1`.`banque`), \'\')',
				'parent_from' => '`partenaires` LEFT JOIN `clients` as clients1 ON `clients1`.`matricule_client`=`partenaires`.`raison_sociale` LEFT JOIN `fonctions` as fonctions1 ON `fonctions1`.`idfonction`=`clients1`.`fonction` LEFT JOIN `banques` as banques1 ON `banques1`.`idbanque`=`clients1`.`banque` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'compte_beneficiaire' => array(
				'parent_table' => 'partenaires',
				'parent_pk_field' => 'matricule_partenaire',
				'parent_caption' => 'IF(    CHAR_LENGTH(`clients1`.`compte`), CONCAT_WS(\'\',   `clients1`.`compte`), \'\')',
				'parent_from' => '`partenaires` LEFT JOIN `clients` as clients1 ON `clients1`.`matricule_client`=`partenaires`.`raison_sociale` LEFT JOIN `fonctions` as fonctions1 ON `fonctions1`.`idfonction`=`clients1`.`fonction` LEFT JOIN `banques` as banques1 ON `banques1`.`idbanque`=`clients1`.`banque` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
		),
		'emetteurs' => array(
			'emetteur' => array(
				'parent_table' => 'clients',
				'parent_pk_field' => 'matricule_client',
				'parent_caption' => '`clients`.`nom_prenom`',
				'parent_from' => '`clients` LEFT JOIN `types_client` as types_client1 ON `types_client1`.`idtype_client`=`clients`.`type` LEFT JOIN `pays` as pays1 ON `pays1`.`idpays`=`clients`.`nationalite` LEFT JOIN `fonctions` as fonctions1 ON `fonctions1`.`idfonction`=`clients`.`fonction` LEFT JOIN `pays` as pays2 ON `pays2`.`idpays`=`clients`.`lieu` LEFT JOIN `banques` as banques1 ON `banques1`.`idbanque`=`clients`.`banque` LEFT JOIN `cartes_fidelite` as cartes_fidelite1 ON `cartes_fidelite1`.`idcartecf`=`clients`.`carte_fidelite` LEFT JOIN `agences` as agences1 ON `agences1`.`idagence`=`clients`.`agence` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'adresse' => array(
				'parent_table' => 'clients',
				'parent_pk_field' => 'matricule_client',
				'parent_caption' => '`clients`.`adresse`',
				'parent_from' => '`clients` LEFT JOIN `types_client` as types_client1 ON `types_client1`.`idtype_client`=`clients`.`type` LEFT JOIN `pays` as pays1 ON `pays1`.`idpays`=`clients`.`nationalite` LEFT JOIN `fonctions` as fonctions1 ON `fonctions1`.`idfonction`=`clients`.`fonction` LEFT JOIN `pays` as pays2 ON `pays2`.`idpays`=`clients`.`lieu` LEFT JOIN `banques` as banques1 ON `banques1`.`idbanque`=`clients`.`banque` LEFT JOIN `cartes_fidelite` as cartes_fidelite1 ON `cartes_fidelite1`.`idcartecf`=`clients`.`carte_fidelite` LEFT JOIN `agences` as agences1 ON `agences1`.`idagence`=`clients`.`agence` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'email' => array(
				'parent_table' => 'clients',
				'parent_pk_field' => 'matricule_client',
				'parent_caption' => '`clients`.`email`',
				'parent_from' => '`clients` LEFT JOIN `types_client` as types_client1 ON `types_client1`.`idtype_client`=`clients`.`type` LEFT JOIN `pays` as pays1 ON `pays1`.`idpays`=`clients`.`nationalite` LEFT JOIN `fonctions` as fonctions1 ON `fonctions1`.`idfonction`=`clients`.`fonction` LEFT JOIN `pays` as pays2 ON `pays2`.`idpays`=`clients`.`lieu` LEFT JOIN `banques` as banques1 ON `banques1`.`idbanque`=`clients`.`banque` LEFT JOIN `cartes_fidelite` as cartes_fidelite1 ON `cartes_fidelite1`.`idcartecf`=`clients`.`carte_fidelite` LEFT JOIN `agences` as agences1 ON `agences1`.`idagence`=`clients`.`agence` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'telephone' => array(
				'parent_table' => 'clients',
				'parent_pk_field' => 'matricule_client',
				'parent_caption' => '`clients`.`telephone`',
				'parent_from' => '`clients` LEFT JOIN `types_client` as types_client1 ON `types_client1`.`idtype_client`=`clients`.`type` LEFT JOIN `pays` as pays1 ON `pays1`.`idpays`=`clients`.`nationalite` LEFT JOIN `fonctions` as fonctions1 ON `fonctions1`.`idfonction`=`clients`.`fonction` LEFT JOIN `pays` as pays2 ON `pays2`.`idpays`=`clients`.`lieu` LEFT JOIN `banques` as banques1 ON `banques1`.`idbanque`=`clients`.`banque` LEFT JOIN `cartes_fidelite` as cartes_fidelite1 ON `cartes_fidelite1`.`idcartecf`=`clients`.`carte_fidelite` LEFT JOIN `agences` as agences1 ON `agences1`.`idagence`=`clients`.`agence` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
		),
		'bieleteries' => array(
			'client' => array(
				'parent_table' => 'clients',
				'parent_pk_field' => 'matricule_client',
				'parent_caption' => '`clients`.`nom_prenom`',
				'parent_from' => '`clients` LEFT JOIN `types_client` as types_client1 ON `types_client1`.`idtype_client`=`clients`.`type` LEFT JOIN `pays` as pays1 ON `pays1`.`idpays`=`clients`.`nationalite` LEFT JOIN `fonctions` as fonctions1 ON `fonctions1`.`idfonction`=`clients`.`fonction` LEFT JOIN `pays` as pays2 ON `pays2`.`idpays`=`clients`.`lieu` LEFT JOIN `banques` as banques1 ON `banques1`.`idbanque`=`clients`.`banque` LEFT JOIN `cartes_fidelite` as cartes_fidelite1 ON `cartes_fidelite1`.`idcartecf`=`clients`.`carte_fidelite` LEFT JOIN `agences` as agences1 ON `agences1`.`idagence`=`clients`.`agence` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
		),
		'tarifs' => array(
			'link_bieleterie' => array(
				'parent_table' => 'bieleteries',
				'parent_pk_field' => 'idbieleterie',
				'parent_caption' => '`bieleteries`.`link_tarif`',
				'parent_from' => '`bieleteries` LEFT JOIN `clients` as clients1 ON `clients1`.`matricule_client`=`bieleteries`.`client` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'passager' => array(
				'parent_table' => 'clients',
				'parent_pk_field' => 'matricule_client',
				'parent_caption' => '`clients`.`nom_prenom`',
				'parent_from' => '`clients` LEFT JOIN `types_client` as types_client1 ON `types_client1`.`idtype_client`=`clients`.`type` LEFT JOIN `pays` as pays1 ON `pays1`.`idpays`=`clients`.`nationalite` LEFT JOIN `fonctions` as fonctions1 ON `fonctions1`.`idfonction`=`clients`.`fonction` LEFT JOIN `pays` as pays2 ON `pays2`.`idpays`=`clients`.`lieu` LEFT JOIN `banques` as banques1 ON `banques1`.`idbanque`=`clients`.`banque` LEFT JOIN `cartes_fidelite` as cartes_fidelite1 ON `cartes_fidelite1`.`idcartecf`=`clients`.`carte_fidelite` LEFT JOIN `agences` as agences1 ON `agences1`.`idagence`=`clients`.`agence` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'parcours' => array(
				'parent_table' => 'parcours',
				'parent_pk_field' => 'idparcour',
				'parent_caption' => '`parcours`.`parcour`',
				'parent_from' => '`parcours` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'compagnie' => array(
				'parent_table' => 'compagnies',
				'parent_pk_field' => 'idcompagnie',
				'parent_caption' => '`compagnies`.`compagnie`',
				'parent_from' => '`compagnies` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'provenance' => array(
				'parent_table' => 'provenance',
				'parent_pk_field' => 'idprovenance',
				'parent_caption' => '`provenance`.`provenance`',
				'parent_from' => '`provenance` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'emetteur' => array(
				'parent_table' => 'emetteurs',
				'parent_pk_field' => 'idemetteur',
				'parent_caption' => 'IF(    CHAR_LENGTH(`clients1`.`nom_prenom`), CONCAT_WS(\'\',   `clients1`.`nom_prenom`), \'\')',
				'parent_from' => '`emetteurs` LEFT JOIN `clients` as clients1 ON `clients1`.`matricule_client`=`emetteurs`.`emetteur` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
		),
		'transferts_argent' => array(
			'emetteur' => array(
				'parent_table' => 'clients',
				'parent_pk_field' => 'matricule_client',
				'parent_caption' => '`clients`.`nom_prenom`',
				'parent_from' => '`clients` LEFT JOIN `types_client` as types_client1 ON `types_client1`.`idtype_client`=`clients`.`type` LEFT JOIN `pays` as pays1 ON `pays1`.`idpays`=`clients`.`nationalite` LEFT JOIN `fonctions` as fonctions1 ON `fonctions1`.`idfonction`=`clients`.`fonction` LEFT JOIN `pays` as pays2 ON `pays2`.`idpays`=`clients`.`lieu` LEFT JOIN `banques` as banques1 ON `banques1`.`idbanque`=`clients`.`banque` LEFT JOIN `cartes_fidelite` as cartes_fidelite1 ON `cartes_fidelite1`.`idcartecf`=`clients`.`carte_fidelite` LEFT JOIN `agences` as agences1 ON `agences1`.`idagence`=`clients`.`agence` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'nni_emetteur' => array(
				'parent_table' => 'clients',
				'parent_pk_field' => 'matricule_client',
				'parent_caption' => '`clients`.`nni`',
				'parent_from' => '`clients` LEFT JOIN `types_client` as types_client1 ON `types_client1`.`idtype_client`=`clients`.`type` LEFT JOIN `pays` as pays1 ON `pays1`.`idpays`=`clients`.`nationalite` LEFT JOIN `fonctions` as fonctions1 ON `fonctions1`.`idfonction`=`clients`.`fonction` LEFT JOIN `pays` as pays2 ON `pays2`.`idpays`=`clients`.`lieu` LEFT JOIN `banques` as banques1 ON `banques1`.`idbanque`=`clients`.`banque` LEFT JOIN `cartes_fidelite` as cartes_fidelite1 ON `cartes_fidelite1`.`idcartecf`=`clients`.`carte_fidelite` LEFT JOIN `agences` as agences1 ON `agences1`.`idagence`=`clients`.`agence` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'phone_emetteur' => array(
				'parent_table' => 'clients',
				'parent_pk_field' => 'matricule_client',
				'parent_caption' => '`clients`.`telephone`',
				'parent_from' => '`clients` LEFT JOIN `types_client` as types_client1 ON `types_client1`.`idtype_client`=`clients`.`type` LEFT JOIN `pays` as pays1 ON `pays1`.`idpays`=`clients`.`nationalite` LEFT JOIN `fonctions` as fonctions1 ON `fonctions1`.`idfonction`=`clients`.`fonction` LEFT JOIN `pays` as pays2 ON `pays2`.`idpays`=`clients`.`lieu` LEFT JOIN `banques` as banques1 ON `banques1`.`idbanque`=`clients`.`banque` LEFT JOIN `cartes_fidelite` as cartes_fidelite1 ON `cartes_fidelite1`.`idcartecf`=`clients`.`carte_fidelite` LEFT JOIN `agences` as agences1 ON `agences1`.`idagence`=`clients`.`agence` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'adresse_emetteur' => array(
				'parent_table' => 'clients',
				'parent_pk_field' => 'matricule_client',
				'parent_caption' => '`clients`.`adresse`',
				'parent_from' => '`clients` LEFT JOIN `types_client` as types_client1 ON `types_client1`.`idtype_client`=`clients`.`type` LEFT JOIN `pays` as pays1 ON `pays1`.`idpays`=`clients`.`nationalite` LEFT JOIN `fonctions` as fonctions1 ON `fonctions1`.`idfonction`=`clients`.`fonction` LEFT JOIN `pays` as pays2 ON `pays2`.`idpays`=`clients`.`lieu` LEFT JOIN `banques` as banques1 ON `banques1`.`idbanque`=`clients`.`banque` LEFT JOIN `cartes_fidelite` as cartes_fidelite1 ON `cartes_fidelite1`.`idcartecf`=`clients`.`carte_fidelite` LEFT JOIN `agences` as agences1 ON `agences1`.`idagence`=`clients`.`agence` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
		),
		'colis' => array(
			'emetteur' => array(
				'parent_table' => 'clients',
				'parent_pk_field' => 'matricule_client',
				'parent_caption' => '`clients`.`nom_prenom`',
				'parent_from' => '`clients` LEFT JOIN `types_client` as types_client1 ON `types_client1`.`idtype_client`=`clients`.`type` LEFT JOIN `pays` as pays1 ON `pays1`.`idpays`=`clients`.`nationalite` LEFT JOIN `fonctions` as fonctions1 ON `fonctions1`.`idfonction`=`clients`.`fonction` LEFT JOIN `pays` as pays2 ON `pays2`.`idpays`=`clients`.`lieu` LEFT JOIN `banques` as banques1 ON `banques1`.`idbanque`=`clients`.`banque` LEFT JOIN `cartes_fidelite` as cartes_fidelite1 ON `cartes_fidelite1`.`idcartecf`=`clients`.`carte_fidelite` LEFT JOIN `agences` as agences1 ON `agences1`.`idagence`=`clients`.`agence` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'phone_emetteur' => array(
				'parent_table' => 'clients',
				'parent_pk_field' => 'matricule_client',
				'parent_caption' => '`clients`.`telephone`',
				'parent_from' => '`clients` LEFT JOIN `types_client` as types_client1 ON `types_client1`.`idtype_client`=`clients`.`type` LEFT JOIN `pays` as pays1 ON `pays1`.`idpays`=`clients`.`nationalite` LEFT JOIN `fonctions` as fonctions1 ON `fonctions1`.`idfonction`=`clients`.`fonction` LEFT JOIN `pays` as pays2 ON `pays2`.`idpays`=`clients`.`lieu` LEFT JOIN `banques` as banques1 ON `banques1`.`idbanque`=`clients`.`banque` LEFT JOIN `cartes_fidelite` as cartes_fidelite1 ON `cartes_fidelite1`.`idcartecf`=`clients`.`carte_fidelite` LEFT JOIN `agences` as agences1 ON `agences1`.`idagence`=`clients`.`agence` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
		),
		'envois_colis' => array(
			'link_colis' => array(
				'parent_table' => 'colis',
				'parent_pk_field' => 'idcoli',
				'parent_caption' => '`colis`.`link_envoi_colis`',
				'parent_from' => '`colis` LEFT JOIN `clients` as clients1 ON `clients1`.`matricule_client`=`colis`.`emetteur` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'destination' => 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` LEFT JOIN `villes` as villes1 ON `villes1`.`idville`=`agences`.`ville` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'ville' => array(
				'parent_table' => 'villes',
				'parent_pk_field' => 'idville',
				'parent_caption' => '`villes`.`ville`',
				'parent_from' => '`villes` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'beneficiaire' => array(
				'parent_table' => 'clients',
				'parent_pk_field' => 'matricule_client',
				'parent_caption' => '`clients`.`nom_prenom`',
				'parent_from' => '`clients` LEFT JOIN `types_client` as types_client1 ON `types_client1`.`idtype_client`=`clients`.`type` LEFT JOIN `pays` as pays1 ON `pays1`.`idpays`=`clients`.`nationalite` LEFT JOIN `fonctions` as fonctions1 ON `fonctions1`.`idfonction`=`clients`.`fonction` LEFT JOIN `pays` as pays2 ON `pays2`.`idpays`=`clients`.`lieu` LEFT JOIN `banques` as banques1 ON `banques1`.`idbanque`=`clients`.`banque` LEFT JOIN `cartes_fidelite` as cartes_fidelite1 ON `cartes_fidelite1`.`idcartecf`=`clients`.`carte_fidelite` LEFT JOIN `agences` as agences1 ON `agences1`.`idagence`=`clients`.`agence` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'telephone_beneficiaire' => array(
				'parent_table' => 'clients',
				'parent_pk_field' => 'matricule_client',
				'parent_caption' => '`clients`.`telephone`',
				'parent_from' => '`clients` LEFT JOIN `types_client` as types_client1 ON `types_client1`.`idtype_client`=`clients`.`type` LEFT JOIN `pays` as pays1 ON `pays1`.`idpays`=`clients`.`nationalite` LEFT JOIN `fonctions` as fonctions1 ON `fonctions1`.`idfonction`=`clients`.`fonction` LEFT JOIN `pays` as pays2 ON `pays2`.`idpays`=`clients`.`lieu` LEFT JOIN `banques` as banques1 ON `banques1`.`idbanque`=`clients`.`banque` LEFT JOIN `cartes_fidelite` as cartes_fidelite1 ON `cartes_fidelite1`.`idcartecf`=`clients`.`carte_fidelite` LEFT JOIN `agences` as agences1 ON `agences1`.`idagence`=`clients`.`agence` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'nni_beneficiaire' => array(
				'parent_table' => 'clients',
				'parent_pk_field' => 'matricule_client',
				'parent_caption' => '`clients`.`nni`',
				'parent_from' => '`clients` LEFT JOIN `types_client` as types_client1 ON `types_client1`.`idtype_client`=`clients`.`type` LEFT JOIN `pays` as pays1 ON `pays1`.`idpays`=`clients`.`nationalite` LEFT JOIN `fonctions` as fonctions1 ON `fonctions1`.`idfonction`=`clients`.`fonction` LEFT JOIN `pays` as pays2 ON `pays2`.`idpays`=`clients`.`lieu` LEFT JOIN `banques` as banques1 ON `banques1`.`idbanque`=`clients`.`banque` LEFT JOIN `cartes_fidelite` as cartes_fidelite1 ON `cartes_fidelite1`.`idcartecf`=`clients`.`carte_fidelite` LEFT JOIN `agences` as agences1 ON `agences1`.`idagence`=`clients`.`agence` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
		),
		'parc_auto' => array(
			'marque' => array(
				'parent_table' => 'models',
				'parent_pk_field' => 'idmodel',
				'parent_caption' => '`models`.`marque`',
				'parent_from' => '`models` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'model' => array(
				'parent_table' => 'models',
				'parent_pk_field' => 'idmodel',
				'parent_caption' => '`models`.`model`',
				'parent_from' => '`models` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
		),
		'location_vh' => array(
			'client' => array(
				'parent_table' => 'clients',
				'parent_pk_field' => 'matricule_client',
				'parent_caption' => '`clients`.`nom_prenom`',
				'parent_from' => '`clients` LEFT JOIN `types_client` as types_client1 ON `types_client1`.`idtype_client`=`clients`.`type` LEFT JOIN `pays` as pays1 ON `pays1`.`idpays`=`clients`.`nationalite` LEFT JOIN `fonctions` as fonctions1 ON `fonctions1`.`idfonction`=`clients`.`fonction` LEFT JOIN `pays` as pays2 ON `pays2`.`idpays`=`clients`.`lieu` LEFT JOIN `banques` as banques1 ON `banques1`.`idbanque`=`clients`.`banque` LEFT JOIN `cartes_fidelite` as cartes_fidelite1 ON `cartes_fidelite1`.`idcartecf`=`clients`.`carte_fidelite` LEFT JOIN `agences` as agences1 ON `agences1`.`idagence`=`clients`.`agence` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
		),
		'liste_location' => array(
			'link_location' => array(
				'parent_table' => 'location_vh',
				'parent_pk_field' => 'idlocation',
				'parent_caption' => '`location_vh`.`link_liste`',
				'parent_from' => '`location_vh` LEFT JOIN `clients` as clients1 ON `clients1`.`matricule_client`=`location_vh`.`client` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'vehicule' => array(
				'parent_table' => 'parc_auto',
				'parent_pk_field' => 'idparc',
				'parent_caption' => 'IF(    CHAR_LENGTH(`models1`.`marque`), CONCAT_WS(\'\',   `models1`.`marque`), \'\')',
				'parent_from' => '`parc_auto` LEFT JOIN `models` as models1 ON `models1`.`idmodel`=`parc_auto`.`marque` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'model' => array(
				'parent_table' => 'models',
				'parent_pk_field' => 'idmodel',
				'parent_caption' => '`models`.`model`',
				'parent_from' => '`models` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
		),
		'fonctions' => array(
		),
		'agences' => array(
			'ville' => array(
				'parent_table' => 'villes',
				'parent_pk_field' => 'idville',
				'parent_caption' => '`villes`.`ville`',
				'parent_from' => '`villes` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
		),
		'villes' => array(
		),
		'banques' => array(
		),
		'type_paiements' => array(
		),
		'compagnies' => array(
		),
		'statuts' => array(
		),
		'visas' => array(
			'client' => array(
				'parent_table' => 'clients',
				'parent_pk_field' => 'matricule_client',
				'parent_caption' => '`clients`.`nom_prenom`',
				'parent_from' => '`clients` LEFT JOIN `types_client` as types_client1 ON `types_client1`.`idtype_client`=`clients`.`type` LEFT JOIN `pays` as pays1 ON `pays1`.`idpays`=`clients`.`nationalite` LEFT JOIN `fonctions` as fonctions1 ON `fonctions1`.`idfonction`=`clients`.`fonction` LEFT JOIN `pays` as pays2 ON `pays2`.`idpays`=`clients`.`lieu` LEFT JOIN `banques` as banques1 ON `banques1`.`idbanque`=`clients`.`banque` LEFT JOIN `cartes_fidelite` as cartes_fidelite1 ON `cartes_fidelite1`.`idcartecf`=`clients`.`carte_fidelite` LEFT JOIN `agences` as agences1 ON `agences1`.`idagence`=`clients`.`agence` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'num_passport' => array(
				'parent_table' => 'clients',
				'parent_pk_field' => 'matricule_client',
				'parent_caption' => '`clients`.`passport`',
				'parent_from' => '`clients` LEFT JOIN `types_client` as types_client1 ON `types_client1`.`idtype_client`=`clients`.`type` LEFT JOIN `pays` as pays1 ON `pays1`.`idpays`=`clients`.`nationalite` LEFT JOIN `fonctions` as fonctions1 ON `fonctions1`.`idfonction`=`clients`.`fonction` LEFT JOIN `pays` as pays2 ON `pays2`.`idpays`=`clients`.`lieu` LEFT JOIN `banques` as banques1 ON `banques1`.`idbanque`=`clients`.`banque` LEFT JOIN `cartes_fidelite` as cartes_fidelite1 ON `cartes_fidelite1`.`idcartecf`=`clients`.`carte_fidelite` LEFT JOIN `agences` as agences1 ON `agences1`.`idagence`=`clients`.`agence` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'type_visa' => array(
				'parent_table' => 'type_visas',
				'parent_pk_field' => 'idtype_visa',
				'parent_caption' => '`type_visas`.`type_visa`',
				'parent_from' => '`type_visas` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'emetteur' => array(
				'parent_table' => 'emetteurs',
				'parent_pk_field' => 'idemetteur',
				'parent_caption' => 'IF(    CHAR_LENGTH(`clients1`.`nom_prenom`), CONCAT_WS(\'\',   `clients1`.`nom_prenom`), \'\')',
				'parent_from' => '`emetteurs` LEFT JOIN `clients` as clients1 ON `clients1`.`matricule_client`=`emetteurs`.`emetteur` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
		),
		'oumras' => array(
			'client' => array(
				'parent_table' => 'clients',
				'parent_pk_field' => 'matricule_client',
				'parent_caption' => '`clients`.`nom_prenom`',
				'parent_from' => '`clients` LEFT JOIN `types_client` as types_client1 ON `types_client1`.`idtype_client`=`clients`.`type` LEFT JOIN `pays` as pays1 ON `pays1`.`idpays`=`clients`.`nationalite` LEFT JOIN `fonctions` as fonctions1 ON `fonctions1`.`idfonction`=`clients`.`fonction` LEFT JOIN `pays` as pays2 ON `pays2`.`idpays`=`clients`.`lieu` LEFT JOIN `banques` as banques1 ON `banques1`.`idbanque`=`clients`.`banque` LEFT JOIN `cartes_fidelite` as cartes_fidelite1 ON `cartes_fidelite1`.`idcartecf`=`clients`.`carte_fidelite` LEFT JOIN `agences` as agences1 ON `agences1`.`idagence`=`clients`.`agence` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'adresse' => array(
				'parent_table' => 'clients',
				'parent_pk_field' => 'matricule_client',
				'parent_caption' => '`clients`.`adresse`',
				'parent_from' => '`clients` LEFT JOIN `types_client` as types_client1 ON `types_client1`.`idtype_client`=`clients`.`type` LEFT JOIN `pays` as pays1 ON `pays1`.`idpays`=`clients`.`nationalite` LEFT JOIN `fonctions` as fonctions1 ON `fonctions1`.`idfonction`=`clients`.`fonction` LEFT JOIN `pays` as pays2 ON `pays2`.`idpays`=`clients`.`lieu` LEFT JOIN `banques` as banques1 ON `banques1`.`idbanque`=`clients`.`banque` LEFT JOIN `cartes_fidelite` as cartes_fidelite1 ON `cartes_fidelite1`.`idcartecf`=`clients`.`carte_fidelite` LEFT JOIN `agences` as agences1 ON `agences1`.`idagence`=`clients`.`agence` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'passeport' => array(
				'parent_table' => 'clients',
				'parent_pk_field' => 'matricule_client',
				'parent_caption' => '`clients`.`passport`',
				'parent_from' => '`clients` LEFT JOIN `types_client` as types_client1 ON `types_client1`.`idtype_client`=`clients`.`type` LEFT JOIN `pays` as pays1 ON `pays1`.`idpays`=`clients`.`nationalite` LEFT JOIN `fonctions` as fonctions1 ON `fonctions1`.`idfonction`=`clients`.`fonction` LEFT JOIN `pays` as pays2 ON `pays2`.`idpays`=`clients`.`lieu` LEFT JOIN `banques` as banques1 ON `banques1`.`idbanque`=`clients`.`banque` LEFT JOIN `cartes_fidelite` as cartes_fidelite1 ON `cartes_fidelite1`.`idcartecf`=`clients`.`carte_fidelite` LEFT JOIN `agences` as agences1 ON `agences1`.`idagence`=`clients`.`agence` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'compagnie' => array(
				'parent_table' => 'compagnies',
				'parent_pk_field' => 'idcompagnie',
				'parent_caption' => '`compagnies`.`compagnie`',
				'parent_from' => '`compagnies` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'programme' => array(
				'parent_table' => 'programmes',
				'parent_pk_field' => 'idprogramme',
				'parent_caption' => '`programmes`.`programme`',
				'parent_from' => '`programmes` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
		),
		'assurances' => array(
			'nom_prenom' => array(
				'parent_table' => 'clients',
				'parent_pk_field' => 'matricule_client',
				'parent_caption' => '`clients`.`nom_prenom`',
				'parent_from' => '`clients` LEFT JOIN `types_client` as types_client1 ON `types_client1`.`idtype_client`=`clients`.`type` LEFT JOIN `pays` as pays1 ON `pays1`.`idpays`=`clients`.`nationalite` LEFT JOIN `fonctions` as fonctions1 ON `fonctions1`.`idfonction`=`clients`.`fonction` LEFT JOIN `pays` as pays2 ON `pays2`.`idpays`=`clients`.`lieu` LEFT JOIN `banques` as banques1 ON `banques1`.`idbanque`=`clients`.`banque` LEFT JOIN `cartes_fidelite` as cartes_fidelite1 ON `cartes_fidelite1`.`idcartecf`=`clients`.`carte_fidelite` LEFT JOIN `agences` as agences1 ON `agences1`.`idagence`=`clients`.`agence` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'intermediare' => array(
				'parent_table' => 'intermediares',
				'parent_pk_field' => 'idintermediaire',
				'parent_caption' => '`intermediares`.`intermediare`',
				'parent_from' => '`intermediares` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'pays_residence' => 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
			),
			'adresse' => array(
				'parent_table' => 'clients',
				'parent_pk_field' => 'matricule_client',
				'parent_caption' => '`clients`.`adresse`',
				'parent_from' => '`clients` LEFT JOIN `types_client` as types_client1 ON `types_client1`.`idtype_client`=`clients`.`type` LEFT JOIN `pays` as pays1 ON `pays1`.`idpays`=`clients`.`nationalite` LEFT JOIN `fonctions` as fonctions1 ON `fonctions1`.`idfonction`=`clients`.`fonction` LEFT JOIN `pays` as pays2 ON `pays2`.`idpays`=`clients`.`lieu` LEFT JOIN `banques` as banques1 ON `banques1`.`idbanque`=`clients`.`banque` LEFT JOIN `cartes_fidelite` as cartes_fidelite1 ON `cartes_fidelite1`.`idcartecf`=`clients`.`carte_fidelite` LEFT JOIN `agences` as agences1 ON `agences1`.`idagence`=`clients`.`agence` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'telephone' => array(
				'parent_table' => 'clients',
				'parent_pk_field' => 'matricule_client',
				'parent_caption' => '`clients`.`telephone`',
				'parent_from' => '`clients` LEFT JOIN `types_client` as types_client1 ON `types_client1`.`idtype_client`=`clients`.`type` LEFT JOIN `pays` as pays1 ON `pays1`.`idpays`=`clients`.`nationalite` LEFT JOIN `fonctions` as fonctions1 ON `fonctions1`.`idfonction`=`clients`.`fonction` LEFT JOIN `pays` as pays2 ON `pays2`.`idpays`=`clients`.`lieu` LEFT JOIN `banques` as banques1 ON `banques1`.`idbanque`=`clients`.`banque` LEFT JOIN `cartes_fidelite` as cartes_fidelite1 ON `cartes_fidelite1`.`idcartecf`=`clients`.`carte_fidelite` LEFT JOIN `agences` as agences1 ON `agences1`.`idagence`=`clients`.`agence` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'email' => array(
				'parent_table' => 'clients',
				'parent_pk_field' => 'matricule_client',
				'parent_caption' => '`clients`.`email`',
				'parent_from' => '`clients` LEFT JOIN `types_client` as types_client1 ON `types_client1`.`idtype_client`=`clients`.`type` LEFT JOIN `pays` as pays1 ON `pays1`.`idpays`=`clients`.`nationalite` LEFT JOIN `fonctions` as fonctions1 ON `fonctions1`.`idfonction`=`clients`.`fonction` LEFT JOIN `pays` as pays2 ON `pays2`.`idpays`=`clients`.`lieu` LEFT JOIN `banques` as banques1 ON `banques1`.`idbanque`=`clients`.`banque` LEFT JOIN `cartes_fidelite` as cartes_fidelite1 ON `cartes_fidelite1`.`idcartecf`=`clients`.`carte_fidelite` LEFT JOIN `agences` as agences1 ON `agences1`.`idagence`=`clients`.`agence` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'destination' => 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
			),
			'formule' => array(
				'parent_table' => 'formule',
				'parent_pk_field' => 'idformule',
				'parent_caption' => '`formule`.`formule`',
				'parent_from' => '`formule` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'passport' => array(
				'parent_table' => 'clients',
				'parent_pk_field' => 'matricule_client',
				'parent_caption' => '`clients`.`passport`',
				'parent_from' => '`clients` LEFT JOIN `types_client` as types_client1 ON `types_client1`.`idtype_client`=`clients`.`type` LEFT JOIN `pays` as pays1 ON `pays1`.`idpays`=`clients`.`nationalite` LEFT JOIN `fonctions` as fonctions1 ON `fonctions1`.`idfonction`=`clients`.`fonction` LEFT JOIN `pays` as pays2 ON `pays2`.`idpays`=`clients`.`lieu` LEFT JOIN `banques` as banques1 ON `banques1`.`idbanque`=`clients`.`banque` LEFT JOIN `cartes_fidelite` as cartes_fidelite1 ON `cartes_fidelite1`.`idcartecf`=`clients`.`carte_fidelite` LEFT JOIN `agences` as agences1 ON `agences1`.`idagence`=`clients`.`agence` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'nom_prenomb' => array(
				'parent_table' => 'clients',
				'parent_pk_field' => 'matricule_client',
				'parent_caption' => '`clients`.`nom_prenom`',
				'parent_from' => '`clients` LEFT JOIN `types_client` as types_client1 ON `types_client1`.`idtype_client`=`clients`.`type` LEFT JOIN `pays` as pays1 ON `pays1`.`idpays`=`clients`.`nationalite` LEFT JOIN `fonctions` as fonctions1 ON `fonctions1`.`idfonction`=`clients`.`fonction` LEFT JOIN `pays` as pays2 ON `pays2`.`idpays`=`clients`.`lieu` LEFT JOIN `banques` as banques1 ON `banques1`.`idbanque`=`clients`.`banque` LEFT JOIN `cartes_fidelite` as cartes_fidelite1 ON `cartes_fidelite1`.`idcartecf`=`clients`.`carte_fidelite` LEFT JOIN `agences` as agences1 ON `agences1`.`idagence`=`clients`.`agence` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'date_de_naissance' => array(
				'parent_table' => 'clients',
				'parent_pk_field' => 'matricule_client',
				'parent_caption' => 'if(`clients`.`date_naissance`,date_format(`clients`.`date_naissance`,\'%d/%m/%Y\'),\'\')',
				'parent_from' => '`clients` LEFT JOIN `types_client` as types_client1 ON `types_client1`.`idtype_client`=`clients`.`type` LEFT JOIN `pays` as pays1 ON `pays1`.`idpays`=`clients`.`nationalite` LEFT JOIN `fonctions` as fonctions1 ON `fonctions1`.`idfonction`=`clients`.`fonction` LEFT JOIN `pays` as pays2 ON `pays2`.`idpays`=`clients`.`lieu` LEFT JOIN `banques` as banques1 ON `banques1`.`idbanque`=`clients`.`banque` LEFT JOIN `cartes_fidelite` as cartes_fidelite1 ON `cartes_fidelite1`.`idcartecf`=`clients`.`carte_fidelite` LEFT JOIN `agences` as agences1 ON `agences1`.`idagence`=`clients`.`agence` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
		),
		'type_visas' => array(
		),
		'facture' => array(
			'client' => array(
				'parent_table' => 'clients',
				'parent_pk_field' => 'matricule_client',
				'parent_caption' => '`clients`.`nom_prenom`',
				'parent_from' => '`clients` LEFT JOIN `types_client` as types_client1 ON `types_client1`.`idtype_client`=`clients`.`type` LEFT JOIN `pays` as pays1 ON `pays1`.`idpays`=`clients`.`nationalite` LEFT JOIN `fonctions` as fonctions1 ON `fonctions1`.`idfonction`=`clients`.`fonction` LEFT JOIN `pays` as pays2 ON `pays2`.`idpays`=`clients`.`lieu` LEFT JOIN `banques` as banques1 ON `banques1`.`idbanque`=`clients`.`banque` LEFT JOIN `cartes_fidelite` as cartes_fidelite1 ON `cartes_fidelite1`.`idcartecf`=`clients`.`carte_fidelite` LEFT JOIN `agences` as agences1 ON `agences1`.`idagence`=`clients`.`agence` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'societe' => array(
				'parent_table' => 'clients',
				'parent_pk_field' => 'matricule_client',
				'parent_caption' => '`clients`.`telephone`',
				'parent_from' => '`clients` LEFT JOIN `types_client` as types_client1 ON `types_client1`.`idtype_client`=`clients`.`type` LEFT JOIN `pays` as pays1 ON `pays1`.`idpays`=`clients`.`nationalite` LEFT JOIN `fonctions` as fonctions1 ON `fonctions1`.`idfonction`=`clients`.`fonction` LEFT JOIN `pays` as pays2 ON `pays2`.`idpays`=`clients`.`lieu` LEFT JOIN `banques` as banques1 ON `banques1`.`idbanque`=`clients`.`banque` LEFT JOIN `cartes_fidelite` as cartes_fidelite1 ON `cartes_fidelite1`.`idcartecf`=`clients`.`carte_fidelite` LEFT JOIN `agences` as agences1 ON `agences1`.`idagence`=`clients`.`agence` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'travaux' => array(
				'parent_table' => 'natures',
				'parent_pk_field' => 'idnature',
				'parent_caption' => '`natures`.`nature`',
				'parent_from' => '`natures` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
		),
		'detail_facture' => array(
			'factureid' => array(
				'parent_table' => 'facture',
				'parent_pk_field' => 'idfacture',
				'parent_caption' => '`facture`.`idfacture`',
				'parent_from' => '`facture` LEFT JOIN `clients` as clients1 ON `clients1`.`matricule_client`=`facture`.`client` LEFT JOIN `natures` as natures1 ON `natures1`.`idnature`=`facture`.`travaux` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'designation' => array(
				'parent_table' => 'designations',
				'parent_pk_field' => 'iddesignation',
				'parent_caption' => '`designations`.`designation`',
				'parent_from' => '`designations` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
		),
		'recettes' => array(
			'agence' => array(
				'parent_table' => 'agences',
				'parent_pk_field' => 'idagence',
				'parent_caption' => '`agences`.`agence`',
				'parent_from' => '`agences` LEFT JOIN `villes` as villes1 ON `villes1`.`idville`=`agences`.`ville` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'service' => array(
				'parent_table' => 'services',
				'parent_pk_field' => 'idservice',
				'parent_caption' => '`services`.`service`',
				'parent_from' => '`services` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'nature' => array(
				'parent_table' => 'natures',
				'parent_pk_field' => 'idnature',
				'parent_caption' => '`natures`.`nature`',
				'parent_from' => '`natures` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
		),
		'depenses' => array(
			'nature' => array(
				'parent_table' => 'natures',
				'parent_pk_field' => 'idnature',
				'parent_caption' => '`natures`.`nature`',
				'parent_from' => '`natures` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'justificatif' => array(
				'parent_table' => 'justificatifs',
				'parent_pk_field' => 'idjustificatif',
				'parent_caption' => '`justificatifs`.`justificatif`',
				'parent_from' => '`justificatifs` ',
				'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` LEFT JOIN `villes` as villes1 ON `villes1`.`idville`=`agences`.`ville` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'service' => array(
				'parent_table' => 'services',
				'parent_pk_field' => 'idservice',
				'parent_caption' => '`services`.`service`',
				'parent_from' => '`services` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'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
			),
		),
		'caisse' => array(
			'link_recettes' => array(
				'parent_table' => 'recettes',
				'parent_pk_field' => 'idrecette',
				'parent_caption' => '`recettes`.`idrecette`',
				'parent_from' => '`recettes` LEFT JOIN `agences` as agences1 ON `agences1`.`idagence`=`recettes`.`agence` LEFT JOIN `services` as services1 ON `services1`.`idservice`=`recettes`.`service` LEFT JOIN `natures` as natures1 ON `natures1`.`idnature`=`recettes`.`nature` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'link_depenses' => array(
				'parent_table' => 'depenses',
				'parent_pk_field' => 'iddepense',
				'parent_caption' => '`depenses`.`iddepense`',
				'parent_from' => '`depenses` LEFT JOIN `natures` as natures1 ON `natures1`.`idnature`=`depenses`.`nature` LEFT JOIN `justificatifs` as justificatifs1 ON `justificatifs1`.`idjustificatif`=`depenses`.`justificatif` LEFT JOIN `agences` as agences1 ON `agences1`.`idagence`=`depenses`.`agence` LEFT JOIN `services` as services1 ON `services1`.`idservice`=`depenses`.`service` LEFT JOIN `banques` as banques1 ON `banques1`.`idbanque`=`depenses`.`banque` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
		),
		'tresorerie_caisse' => array(
		),
		'tresorerie_items' => array(
			'link_out' => array(
				'parent_table' => 'tresorerie_caisse',
				'parent_pk_field' => 'idtresorerie_caisse',
				'parent_caption' => '`tresorerie_caisse`.`link_in`',
				'parent_from' => '`tresorerie_caisse` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
		),
		'piece_reglements' => array(
			'beneficiaire' => array(
				'parent_table' => 'clients',
				'parent_pk_field' => 'matricule_client',
				'parent_caption' => '`clients`.`nom_prenom`',
				'parent_from' => '`clients` LEFT JOIN `types_client` as types_client1 ON `types_client1`.`idtype_client`=`clients`.`type` LEFT JOIN `pays` as pays1 ON `pays1`.`idpays`=`clients`.`nationalite` LEFT JOIN `fonctions` as fonctions1 ON `fonctions1`.`idfonction`=`clients`.`fonction` LEFT JOIN `pays` as pays2 ON `pays2`.`idpays`=`clients`.`lieu` LEFT JOIN `banques` as banques1 ON `banques1`.`idbanque`=`clients`.`banque` LEFT JOIN `cartes_fidelite` as cartes_fidelite1 ON `cartes_fidelite1`.`idcartecf`=`clients`.`carte_fidelite` LEFT JOIN `agences` as agences1 ON `agences1`.`idagence`=`clients`.`agence` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'operation' => array(
				'parent_table' => 'operations',
				'parent_pk_field' => 'idoperation',
				'parent_caption' => '`operations`.`operation`',
				'parent_from' => '`operations` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'banque' => array(
				'parent_table' => 'clients',
				'parent_pk_field' => 'matricule_client',
				'parent_caption' => 'IF(    CHAR_LENGTH(`banques1`.`banque`), CONCAT_WS(\'\',   `banques1`.`banque`), \'\')',
				'parent_from' => '`clients` LEFT JOIN `types_client` as types_client1 ON `types_client1`.`idtype_client`=`clients`.`type` LEFT JOIN `pays` as pays1 ON `pays1`.`idpays`=`clients`.`nationalite` LEFT JOIN `fonctions` as fonctions1 ON `fonctions1`.`idfonction`=`clients`.`fonction` LEFT JOIN `pays` as pays2 ON `pays2`.`idpays`=`clients`.`lieu` LEFT JOIN `banques` as banques1 ON `banques1`.`idbanque`=`clients`.`banque` LEFT JOIN `cartes_fidelite` as cartes_fidelite1 ON `cartes_fidelite1`.`idcartecf`=`clients`.`carte_fidelite` LEFT JOIN `agences` as agences1 ON `agences1`.`idagence`=`clients`.`agence` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'compte' => array(
				'parent_table' => 'clients',
				'parent_pk_field' => 'matricule_client',
				'parent_caption' => '`clients`.`compte`',
				'parent_from' => '`clients` LEFT JOIN `types_client` as types_client1 ON `types_client1`.`idtype_client`=`clients`.`type` LEFT JOIN `pays` as pays1 ON `pays1`.`idpays`=`clients`.`nationalite` LEFT JOIN `fonctions` as fonctions1 ON `fonctions1`.`idfonction`=`clients`.`fonction` LEFT JOIN `pays` as pays2 ON `pays2`.`idpays`=`clients`.`lieu` LEFT JOIN `banques` as banques1 ON `banques1`.`idbanque`=`clients`.`banque` LEFT JOIN `cartes_fidelite` as cartes_fidelite1 ON `cartes_fidelite1`.`idcartecf`=`clients`.`carte_fidelite` LEFT JOIN `agences` as agences1 ON `agences1`.`idagence`=`clients`.`agence` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
		),
		'autorisation_change' => array(
			'nom_prenom' => array(
				'parent_table' => 'clients',
				'parent_pk_field' => 'matricule_client',
				'parent_caption' => '`clients`.`nom_prenom`',
				'parent_from' => '`clients` LEFT JOIN `types_client` as types_client1 ON `types_client1`.`idtype_client`=`clients`.`type` LEFT JOIN `pays` as pays1 ON `pays1`.`idpays`=`clients`.`nationalite` LEFT JOIN `fonctions` as fonctions1 ON `fonctions1`.`idfonction`=`clients`.`fonction` LEFT JOIN `pays` as pays2 ON `pays2`.`idpays`=`clients`.`lieu` LEFT JOIN `banques` as banques1 ON `banques1`.`idbanque`=`clients`.`banque` LEFT JOIN `cartes_fidelite` as cartes_fidelite1 ON `cartes_fidelite1`.`idcartecf`=`clients`.`carte_fidelite` LEFT JOIN `agences` as agences1 ON `agences1`.`idagence`=`clients`.`agence` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'nationalite' => array(
				'parent_table' => 'clients',
				'parent_pk_field' => 'matricule_client',
				'parent_caption' => 'IF(    CHAR_LENGTH(`pays1`.`pays`), CONCAT_WS(\'\',   `pays1`.`pays`), \'\')',
				'parent_from' => '`clients` LEFT JOIN `types_client` as types_client1 ON `types_client1`.`idtype_client`=`clients`.`type` LEFT JOIN `pays` as pays1 ON `pays1`.`idpays`=`clients`.`nationalite` LEFT JOIN `fonctions` as fonctions1 ON `fonctions1`.`idfonction`=`clients`.`fonction` LEFT JOIN `pays` as pays2 ON `pays2`.`idpays`=`clients`.`lieu` LEFT JOIN `banques` as banques1 ON `banques1`.`idbanque`=`clients`.`banque` LEFT JOIN `cartes_fidelite` as cartes_fidelite1 ON `cartes_fidelite1`.`idcartecf`=`clients`.`carte_fidelite` LEFT JOIN `agences` as agences1 ON `agences1`.`idagence`=`clients`.`agence` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'profession' => array(
				'parent_table' => 'clients',
				'parent_pk_field' => 'matricule_client',
				'parent_caption' => 'IF(    CHAR_LENGTH(`fonctions1`.`fonction`), CONCAT_WS(\'\',   `fonctions1`.`fonction`), \'\')',
				'parent_from' => '`clients` LEFT JOIN `types_client` as types_client1 ON `types_client1`.`idtype_client`=`clients`.`type` LEFT JOIN `pays` as pays1 ON `pays1`.`idpays`=`clients`.`nationalite` LEFT JOIN `fonctions` as fonctions1 ON `fonctions1`.`idfonction`=`clients`.`fonction` LEFT JOIN `pays` as pays2 ON `pays2`.`idpays`=`clients`.`lieu` LEFT JOIN `banques` as banques1 ON `banques1`.`idbanque`=`clients`.`banque` LEFT JOIN `cartes_fidelite` as cartes_fidelite1 ON `cartes_fidelite1`.`idcartecf`=`clients`.`carte_fidelite` LEFT JOIN `agences` as agences1 ON `agences1`.`idagence`=`clients`.`agence` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'adresse' => array(
				'parent_table' => 'clients',
				'parent_pk_field' => 'matricule_client',
				'parent_caption' => '`clients`.`adresse`',
				'parent_from' => '`clients` LEFT JOIN `types_client` as types_client1 ON `types_client1`.`idtype_client`=`clients`.`type` LEFT JOIN `pays` as pays1 ON `pays1`.`idpays`=`clients`.`nationalite` LEFT JOIN `fonctions` as fonctions1 ON `fonctions1`.`idfonction`=`clients`.`fonction` LEFT JOIN `pays` as pays2 ON `pays2`.`idpays`=`clients`.`lieu` LEFT JOIN `banques` as banques1 ON `banques1`.`idbanque`=`clients`.`banque` LEFT JOIN `cartes_fidelite` as cartes_fidelite1 ON `cartes_fidelite1`.`idcartecf`=`clients`.`carte_fidelite` LEFT JOIN `agences` as agences1 ON `agences1`.`idagence`=`clients`.`agence` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'num_compte' => array(
				'parent_table' => 'clients',
				'parent_pk_field' => 'matricule_client',
				'parent_caption' => '`clients`.`compte`',
				'parent_from' => '`clients` LEFT JOIN `types_client` as types_client1 ON `types_client1`.`idtype_client`=`clients`.`type` LEFT JOIN `pays` as pays1 ON `pays1`.`idpays`=`clients`.`nationalite` LEFT JOIN `fonctions` as fonctions1 ON `fonctions1`.`idfonction`=`clients`.`fonction` LEFT JOIN `pays` as pays2 ON `pays2`.`idpays`=`clients`.`lieu` LEFT JOIN `banques` as banques1 ON `banques1`.`idbanque`=`clients`.`banque` LEFT JOIN `cartes_fidelite` as cartes_fidelite1 ON `cartes_fidelite1`.`idcartecf`=`clients`.`carte_fidelite` LEFT JOIN `agences` as agences1 ON `agences1`.`idagence`=`clients`.`agence` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'nature_operation' => array(
				'parent_table' => 'natures',
				'parent_pk_field' => 'idnature',
				'parent_caption' => '`natures`.`nature`',
				'parent_from' => '`natures` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'nature_devises' => array(
				'parent_table' => 'devise',
				'parent_pk_field' => 'iddevise',
				'parent_caption' => '`devise`.`devise`',
				'parent_from' => '`devise` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
		),
		'bon_passage' => array(
		),
		'fiches_changes' => array(
		),
		'fiches_changes_items' => array(
			'link_out' => array(
				'parent_table' => 'fiches_changes',
				'parent_pk_field' => 'idfichechange',
				'parent_caption' => '`fiches_changes`.`link_in`',
				'parent_from' => '`fiches_changes` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'nom_prenom' => array(
				'parent_table' => 'clients',
				'parent_pk_field' => 'matricule_client',
				'parent_caption' => '`clients`.`nom_prenom`',
				'parent_from' => '`clients` LEFT JOIN `types_client` as types_client1 ON `types_client1`.`idtype_client`=`clients`.`type` LEFT JOIN `pays` as pays1 ON `pays1`.`idpays`=`clients`.`nationalite` LEFT JOIN `fonctions` as fonctions1 ON `fonctions1`.`idfonction`=`clients`.`fonction` LEFT JOIN `pays` as pays2 ON `pays2`.`idpays`=`clients`.`lieu` LEFT JOIN `banques` as banques1 ON `banques1`.`idbanque`=`clients`.`banque` LEFT JOIN `cartes_fidelite` as cartes_fidelite1 ON `cartes_fidelite1`.`idcartecf`=`clients`.`carte_fidelite` LEFT JOIN `agences` as agences1 ON `agences1`.`idagence`=`clients`.`agence` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => true
			),
			'num_identite' => array(
				'parent_table' => 'clients',
				'parent_pk_field' => 'matricule_client',
				'parent_caption' => '`clients`.`nni`',
				'parent_from' => '`clients` LEFT JOIN `types_client` as types_client1 ON `types_client1`.`idtype_client`=`clients`.`type` LEFT JOIN `pays` as pays1 ON `pays1`.`idpays`=`clients`.`nationalite` LEFT JOIN `fonctions` as fonctions1 ON `fonctions1`.`idfonction`=`clients`.`fonction` LEFT JOIN `pays` as pays2 ON `pays2`.`idpays`=`clients`.`lieu` LEFT JOIN `banques` as banques1 ON `banques1`.`idbanque`=`clients`.`banque` LEFT JOIN `cartes_fidelite` as cartes_fidelite1 ON `cartes_fidelite1`.`idcartecf`=`clients`.`carte_fidelite` LEFT JOIN `agences` as agences1 ON `agences1`.`idagence`=`clients`.`agence` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'devises' => array(
				'parent_table' => 'devise',
				'parent_pk_field' => 'iddevise',
				'parent_caption' => '`devise`.`devise`',
				'parent_from' => '`devise` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
		),
		'caisse_journaliere' => array(
		),
		'item_caisse_journaliere' => array(
			'link_out' => array(
				'parent_table' => 'caisse_journaliere',
				'parent_pk_field' => 'idcaisse_journaliere',
				'parent_caption' => '`caisse_journaliere`.`link_in`',
				'parent_from' => '`caisse_journaliere` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
		),
		'models' => array(
		),
		'natures' => array(
		),
		'services' => array(
		),
		'liens' => array(
		),
		'types_client' => array(
		),
		'cartes_fidelite' => array(
		),
		'designations' => array(
		),
		'parcours' => array(
		),
		'pays' => array(
		),
		'provenance' => array(
		),
		'programmes' => array(
		),
		'justificatifs' => array(
		),
		'devise' => array(
		),
		'intermediares' => array(
		),
		'formule' => array(
		),
		'operations' => array(
		),
		'pointages' => array(
			'nom_prenom' => array(
				'parent_table' => 'clients',
				'parent_pk_field' => 'matricule_client',
				'parent_caption' => '`clients`.`nom_prenom`',
				'parent_from' => '`clients` LEFT JOIN `types_client` as types_client1 ON `types_client1`.`idtype_client`=`clients`.`type` LEFT JOIN `pays` as pays1 ON `pays1`.`idpays`=`clients`.`nationalite` LEFT JOIN `fonctions` as fonctions1 ON `fonctions1`.`idfonction`=`clients`.`fonction` LEFT JOIN `pays` as pays2 ON `pays2`.`idpays`=`clients`.`lieu` LEFT JOIN `banques` as banques1 ON `banques1`.`idbanque`=`clients`.`banque` LEFT JOIN `cartes_fidelite` as cartes_fidelite1 ON `cartes_fidelite1`.`idcartecf`=`clients`.`carte_fidelite` LEFT JOIN `agences` as agences1 ON `agences1`.`idagence`=`clients`.`agence` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'agence' => array(
				'parent_table' => 'clients',
				'parent_pk_field' => 'matricule_client',
				'parent_caption' => 'IF(    CHAR_LENGTH(`agences1`.`agence`), CONCAT_WS(\'\',   `agences1`.`agence`), \'\')',
				'parent_from' => '`clients` LEFT JOIN `types_client` as types_client1 ON `types_client1`.`idtype_client`=`clients`.`type` LEFT JOIN `pays` as pays1 ON `pays1`.`idpays`=`clients`.`nationalite` LEFT JOIN `fonctions` as fonctions1 ON `fonctions1`.`idfonction`=`clients`.`fonction` LEFT JOIN `pays` as pays2 ON `pays2`.`idpays`=`clients`.`lieu` LEFT JOIN `banques` as banques1 ON `banques1`.`idbanque`=`clients`.`banque` LEFT JOIN `cartes_fidelite` as cartes_fidelite1 ON `cartes_fidelite1`.`idcartecf`=`clients`.`carte_fidelite` LEFT JOIN `agences` as agences1 ON `agences1`.`idagence`=`clients`.`agence` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'fonction' => array(
				'parent_table' => 'clients',
				'parent_pk_field' => 'matricule_client',
				'parent_caption' => 'IF(    CHAR_LENGTH(`fonctions1`.`fonction`), CONCAT_WS(\'\',   `fonctions1`.`fonction`), \'\')',
				'parent_from' => '`clients` LEFT JOIN `types_client` as types_client1 ON `types_client1`.`idtype_client`=`clients`.`type` LEFT JOIN `pays` as pays1 ON `pays1`.`idpays`=`clients`.`nationalite` LEFT JOIN `fonctions` as fonctions1 ON `fonctions1`.`idfonction`=`clients`.`fonction` LEFT JOIN `pays` as pays2 ON `pays2`.`idpays`=`clients`.`lieu` LEFT JOIN `banques` as banques1 ON `banques1`.`idbanque`=`clients`.`banque` LEFT JOIN `cartes_fidelite` as cartes_fidelite1 ON `cartes_fidelite1`.`idcartecf`=`clients`.`carte_fidelite` LEFT JOIN `agences` as agences1 ON `agences1`.`idagence`=`clients`.`agence` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
		),
		'fichiers_partages' => array(
			'agent' => array(
				'parent_table' => 'gestionnaires',
				'parent_pk_field' => 'matricule_gestionnaire',
				'parent_caption' => '`gestionnaires`.`nom_prenom`',
				'parent_from' => '`gestionnaires` LEFT JOIN `fonctions` as fonctions1 ON `fonctions1`.`idfonction`=`gestionnaires`.`fonction` LEFT JOIN `agences` as agences1 ON `agences1`.`idagence`=`gestionnaires`.`agence` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'agence' => array(
				'parent_table' => 'gestionnaires',
				'parent_pk_field' => 'matricule_gestionnaire',
				'parent_caption' => 'IF(    CHAR_LENGTH(`agences1`.`agence`), CONCAT_WS(\'\',   `agences1`.`agence`), \'\')',
				'parent_from' => '`gestionnaires` LEFT JOIN `fonctions` as fonctions1 ON `fonctions1`.`idfonction`=`gestionnaires`.`fonction` LEFT JOIN `agences` as agences1 ON `agences1`.`idagence`=`gestionnaires`.`agence` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'service' => array(
				'parent_table' => 'gestionnaires',
				'parent_pk_field' => 'matricule_gestionnaire',
				'parent_caption' => 'IF(    CHAR_LENGTH(`fonctions1`.`fonction`), CONCAT_WS(\'\',   `fonctions1`.`fonction`), \'\')',
				'parent_from' => '`gestionnaires` LEFT JOIN `fonctions` as fonctions1 ON `fonctions1`.`idfonction`=`gestionnaires`.`fonction` LEFT JOIN `agences` as agences1 ON `agences1`.`idagence`=`gestionnaires`.`agence` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
		),
		'note_de_service' => array(
			'agence' => array(
				'parent_table' => 'agences',
				'parent_pk_field' => 'idagence',
				'parent_caption' => '`agences`.`agence`',
				'parent_from' => '`agences` LEFT JOIN `villes` as villes1 ON `villes1`.`idville`=`agences`.`ville` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
			'service' => array(
				'parent_table' => 'services',
				'parent_pk_field' => 'idservice',
				'parent_caption' => '`services`.`service`',
				'parent_from' => '`services` ',
				'filterers' => array(),
				'custom_query' => '',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => false
			),
		),
	);

	// 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)
		));
	}

