<?php
/**
 *
 *
 * @package opencimetiere
 * @version SVN : $Id$
 */

//
include "../gen/sql/pgsql/reprise_abandon.inc.php";
require_once "../obj/reprise_abandon.class.php";
$reprise_abandon = new reprise_abandon(0);
$ent = " -> ".__("reprise sur abandon");

$statut_trad = $reprise_abandon->compose_statut_reprise_trad();
$etat_trad = $reprise_abandon->compose_etat_reprise_trad();
$field_emplacement = '(emplacement.nature||\' - n°\'||emplacement.emplacement||\' - Famille : \'||emplacement.famille) as "'.__("emplacement").'"';


$champAffiche = array(
    'reprise_abandon.reprise_abandon as "'.__("id").'"',
    $field_emplacement,
    $statut_trad.' as "'.__("statut").'"',
    $etat_trad.' as "'.__("etat").'"',
    'to_char(reprise_abandon.datecreation ,\'DD/MM/YYYY\') as "'.__("datecreation").'"',
    'to_char(reprise_abandon.dateconvocationvisite1 ,\'DD/MM/YYYY\') as "'.__("1er envoi/affichage convocation").'"',
    'to_char(reprise_abandon.datenotificationpv1 ,\'DD/MM/YYYY\') as "'.__("date de notification pv1").'"',
    'to_char(reprise_abandon.dateconvocationvisite2 ,\'DD/MM/YYYY\') as "'.__("2eme envoi/affichage convocation").'"',
    'to_char(reprise_abandon.datenotificationpv2 ,\'DD/MM/YYYY\') as "'.__("date de notification pv2").'"',
);

$fields_to_hide = array();
if (in_array($retourformulaire, $foreign_keys_extended["emplacement"])) {
    $fields_to_hide[] = $field_emplacement;
    $fields_to_hide[] = 'to_char(reprise_abandon.datecreation ,\'DD/MM/YYYY\') as "'.__("datecreation").'"';
    $fields_to_hide[] = 'to_char(reprise_abandon.dateconvocationvisite1 ,\'DD/MM/YYYY\') as "'.__("1er envoi/affichage convocation").'"';
    $fields_to_hide[] = 'to_char(reprise_abandon.datenotificationpv1 ,\'DD/MM/YYYY\') as "'.__("date de notification pv1").'"';
    $fields_to_hide[] = 'to_char(reprise_abandon.dateconvocationvisite2 ,\'DD/MM/YYYY\') as "'.__("2eme envoi/affichage convocation").'"';
    $fields_to_hide[] = 'to_char(reprise_abandon.datenotificationpv2 ,\'DD/MM/YYYY\') as "'.__("date de notification pv2").'"';
}
$champAffiche = array_diff($champAffiche, $fields_to_hide);

if (isset($_GET['module']) && $_GET['module'] === 'tab') {
    unset($tab_actions['corner']['ajouter']);
    $tab_actions["left"]["consulter"]["lien"] = str_replace(
        "action=3",
        "action=701",
        $tab_actions["left"]["consulter"]["lien"]
    );
    $tab_actions["content"]["lien"] = $tab_actions["left"]["consulter"]["lien"];
}

/**
 * Options du LISTING
 */
$options = array();
// ADVS
$champs = array();
$champs['id'] = array(
    'colonne' => 'reprise_abandon',
    'table' => 'reprise_abandon',
    'type' => 'text',
    'libelle' => __('id'),
    'taille' => 8,
    'max' => '',
);
$champs['emplacement'] = array(
    'colonne' => array('nature', 'emplacement','famille'),
    'table' => 'emplacement',
    'type' => 'text',
    'libelle' => __('emplacement'),
    'help' => __("identifiant de l'emplacement (ex : 12) ou famille (ex : DUPONT) ou nature de l'emplacement (ex : concession)"),
    'taille' => 8,
    'max' => '',
);
$champs['datecreation'] = array(
    'colonne' => 'datecreation',
    'table' => 'reprise_abandon',
    'type' => 'date',
    'libelle' => __('datecreation'),
    'taille' => 8,
    'max' => '',
    'lib1'=> __("début"),
    'lib2' => __("fin"),
    'where' => 'intervaldate'
);
$champs['dateconvocationvisite1'] = array(
    'colonne' => 'dateconvocationvisite1',
    'table' => 'reprise_abandon',
    'type' => 'date',
    'libelle' => __('1er envoi/affichage convocation'),
    'taille' => 8,
    'max' => '',
    'lib1'=> __("début"),
    'lib2' => __("fin"),
    'where' => 'intervaldate'
);
$champs['datenotificationpv1'] = array(
    'colonne' => 'datenotificationpv1',
    'table' => 'reprise_abandon',
    'type' => 'date',
    'libelle' => __('date de notification pv1'),
    'taille' => 8,
    'max' => '',
    'lib1'=> __("début"),
    'lib2' => __("fin"),
    'where' => 'intervaldate'
);
$champs['statut'] = array(
    'colonne' => 'statut',
    'table' => 'reprise_abandon',
    'type' => 'select',
    'libelle' => __('statut'),
    'taille' => 8,
);
$champs['etat'] = array(
    'colonne' => 'etat',
    'table' => 'reprise_abandon',
    'type' => 'select',
    'libelle' => __('etat'),
    'taille' => 8,
);
$champs['datenotificationpv2'] = array(
    'colonne' => 'datenotificationpv2',
    'table' => 'reprise_abandon',
    'type' => 'date',
    'libelle' => __('2eme envoi/affichage convocation'),
    'taille' => 8,
    'max' => '',
    'lib1'=> __("début"),
    'lib2' => __("fin"),
    'where' => 'intervaldate'
);
$champs['dateconvocationvisite2'] = array(
    'colonne' => 'dateconvocationvisite2',
    'table' => 'reprise_abandon',
    'type' => 'date',
    'libelle' => __('date de notification pv2'),
    'taille' => 8,
    'max' => '',
    'lib1'=> __("début"),
    'lib2' => __("fin"),
    'where' => 'intervaldate'
);
$options[] =  array(
    'type' => 'search',
    'display' => true,
    'advanced' => $champs,
    'export' => array('csv',),
    'default_form' => 'advanced',
    'absolute_object' => 'reprise_abandon'
);