summaryrefslogtreecommitdiff
path: root/src/sections/1_customer.php
blob: db5c4482d42e7688fe45f8a743cb69d08fbf43c4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<?php
// src/sections/1_customer.php
//
// -- SECTION 1: Fichier clients et propects --

use Doctrine\ORM\EntityManager;

function newCustomer(): array
{
    // fenêtres
    //$TypeDeClient = new ZenityList(ZenitySetup::$type_client['text'], ZenitySetup::$type_client['entrees']);
    $NouveauClient = new ZenityForms(ZenitySetup::$nouveau_client['text'], ZenitySetup::$nouveau_client['entrees']);
    $FinSection1 = new ZenityList(ZenitySetup::$fin_section_1['text'], ZenitySetup::$fin_section_1['entrees']);

    $Customer = new Client;
     
    // -- partie 1: client ou prospect? --
    //~ $choix_niv2 = exec($TypeDeClient->get());
    //~ if($choix_niv2 === ZenitySetup::$type_client['entrees'][0])
    //~ {
        //~ echo "choix: " . $choix_niv2 . "\n";
        //~ $Customer->setType('client');
    //~ }
    //~ elseif($choix_niv2 === ZenitySetup::$type_client['entrees'][1])
    //~ {
        //~ echo "choix: " . $choix_niv2 . "\n";
        //~ $Customer->setType('prospect');
    //~ }
    //~ else
    //~ {
        //~ return [0, null]; // menu principal
    //~ }
    
    // -- partie 2: saisie des infos --
    if($Customer->enterCustomer($NouveauClient))
    {
        // -- partie 3: on fait quoi maintenant --
        $choix_niv3 = exec($FinSection1->get());
        if($choix_niv3 === ZenitySetup::$fin_section_1['entrees'][0])
        {
            return [2, $Customer]; // section 2: newService()
        }
        elseif($choix_niv3 === ZenitySetup::$fin_section_1['entrees'][1])
        {
            return [3, $Customer]; // section 3: modifyData()
        }
        elseif($choix_niv3 === ZenitySetup::$fin_section_1['entrees'][2])
        {
            return [1, null]; // relancer section 1: newCustomer()
        }
        else
        {
            return [0, null]; // menu principal
        }
    }
    
    return [0, null]; // menu principal
}