IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

MkFramework Discussion :

Problème après un retraitement sur des enregistrements


Sujet :

MkFramework

  1. #1
    Nouveau membre du Club
    Homme Profil pro
    Formateur en informatique
    Inscrit en
    Février 2015
    Messages
    70
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Belgique

    Informations professionnelles :
    Activité : Formateur en informatique
    Secteur : Associations - ONG

    Informations forums :
    Inscription : Février 2015
    Messages : 70
    Points : 29
    Points
    29
    Par défaut Problème après un retraitement sur des enregistrements
    Bonjour,

    Il y a quelques mois, j'ai commencé à développer un outil pour le boulot, mais je n'ai pas eu le temps d'avancer dessus. Outre la difficulté de reprendre le projet, je dois me familiariser avec le MkFramework, car je n'ai plus travaillé avec entre temps.
    Je vais essayé d'être le plus clair possible dans ma demande !

    Contexte :
    Je travaille actuellement sur une application qui va me permettre de gérer des inscriptions à des petites formations.
    Pour cela j'ai créer un crud pour afficher les données des formations, puis j'ai ajouter un crud intégrable dans le show pour pouvoir interagir sur les participants à ces formations. J'ai donc fait le nécessaire pour que lorsqu'on clic sur une formation, on arrive sur la page show de celle-ci et la on a le crud intégrable qui permet de faire le nécessaire pour ajouter, supprimer, modifier ou voir les participants.

    Dans la gestion des participants, je suis amener à travailler avec des dates, et donc des datepicker, ce qui m'a poussé à suivre le point suivant de la FAQ "Automatiser un retraitement sur des enregistrements". J'ai d'ailleurs eu besoin d'aide à l'époque, et je vous remercie encore de ma l'avoir fournie (Sujet de l'époque) !

    Mon souci actuel est la suivant :
    Lorsque j'essaye de modifier un commentaire pour un de mes participants, il m'affiche le message d'erreur suivant, mais je ne comprend pas pourquoi :
    Undefined index: date_rdv_test_participant_pmtic
    #0 C:\wamp\www\mkframework_v4_117_0_r286\data\genere\newerpif3\model\model_t_participants_pmtic.php(51): exception_error_handler(8, 'Undefined index...', 'C:\wamp\www\mkf...', 51, Array)
    #1 C:\wamp\www\mkframework_v4_117_0_r286\data\genere\newerpif3\module\participantspmticaccueil\main.php(171): row_t_participants_pmtic->__construct(Array)
    #2 C:\wamp\www\mkframework_v4_117_0_r286\data\genere\newerpif3\module\participantspmticaccueil\main.php(85): module_participantspmticaccueil->processSave()
    #3 C:\wamp\www\mkframework_v4_117_0_r286\data\genere\newerpif3\module\participantspmticaccueil\main.php(46): module_participantspmticaccueil->_edit()
    #4 C:\wamp\www\mkframework_v4_117_0_r286\data\genere\newerpif3\module\pmticaccueil\main.php(50): module_participantspmticaccueil->_index()
    #5 C:\wamp\www\mkframework_v4_117_0_r286\lib\framework\class_root.php(263): module_pmticaccueil->_show()
    #6 C:\wamp\www\mkframework_v4_117_0_r286\data\genere\newerpif3\public\index.php(47): _root->run()
    #7 {main}

    Detail:
    #0 C:\wamp\www\mkframework_v4_117_0_r286\data\genere\newerpif3\model\model_t_participants_pmtic.php (51)
    exception_error_handler( , 'Undefined index: date_rdv_test_participant_pmtic' , 'C:\wamp\www\mkframework_v4_117_0_r286\data\genere\newerpif3\model\model_t_participants_pmtic.php' , , Array ( [tRow] => Array ( ) ) )
    #1 C:\wamp\www\mkframework_v4_117_0_r286\data\genere\newerpif3\module\participantspmticaccueil\main.php (171)
    row_t_participants_pmtic -> __construct( Array ( ) )
    #2 C:\wamp\www\mkframework_v4_117_0_r286\data\genere\newerpif3\module\participantspmticaccueil\main.php (85)
    module_participantspmticaccueil -> processSave( )
    #3 C:\wamp\www\mkframework_v4_117_0_r286\data\genere\newerpif3\module\participantspmticaccueil\main.php (46)
    module_participantspmticaccueil -> _edit( )
    #4 C:\wamp\www\mkframework_v4_117_0_r286\data\genere\newerpif3\module\pmticaccueil\main.php (50)
    module_participantspmticaccueil -> _index( )
    #5 C:\wamp\www\mkframework_v4_117_0_r286\lib\framework\class_root.php (263)
    module_pmticaccueil -> _show( )
    #6 C:\wamp\www\mkframework_v4_117_0_r286\data\genere\newerpif3\public\index.php (47)
    _root -> run( )
    #7 {main}

    Fichier : C:\wamp\www\mkframework_v4_117_0_r286\data\genere\newerpif3\model\model_t_participants_pmtic.php ligne 51

    Message : Undefined index: date_rdv_test_participant_pmtic
    Je ne comprend pas d'où cela peut venir, car date_rdv_test_participant existe bel et bien.

    $_POST
    Array
    (
    [formmodule] => participantspmticaccueil
    [id_participant] => 2
    [date_rdv_test_participant_pmtic] => 02/11/2015
    [commentaire_participant_pmtic] => javier
    [token] => 1446471085####72dfee237c24030d3a60656ff74c37ba8c084555
    )
    Auriez-vous une idée ?

  2. #2
    Rédacteur
    Avatar de imikado
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Décembre 2006
    Messages
    5 239
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 42
    Localisation : France, Val de Marne (Île de France)

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : Finance

    Informations forums :
    Inscription : Décembre 2006
    Messages : 5 239
    Points : 19 100
    Points
    19 100
    Billets dans le blog
    17
    Par défaut
    QU'y a t il sur cette ligne ?

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    \model\model_t_participants_pmtic.php(51):
    Framework php sécurisé et simple à prendre en main avec générateur web http://mkframework.com/ (hebergé sur developpez.com)
    Mes cours/tutoriaux

  3. #3
    Nouveau membre du Club
    Homme Profil pro
    Formateur en informatique
    Inscrit en
    Février 2015
    Messages
    70
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Belgique

    Informations professionnelles :
    Activité : Formateur en informatique
    Secteur : Associations - ONG

    Informations forums :
    Inscription : Février 2015
    Messages : 70
    Points : 29
    Points
    29
    Par défaut
    Voici le code de cette ligne :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    $oDate = new plugin_date($tRow['date_rdv_test_participant_pmtic'],'Y-m-d');

  4. #4
    Rédacteur
    Avatar de imikado
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Décembre 2006
    Messages
    5 239
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 42
    Localisation : France, Val de Marne (Île de France)

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : Finance

    Informations forums :
    Inscription : Décembre 2006
    Messages : 5 239
    Points : 19 100
    Points
    19 100
    Billets dans le blog
    17
    Par défaut
    Ok, donc ce champ n'existe pas dans le tableau tRow

    Pouvez-vous afficher le code complet de la méthode incluant ce code ?
    Framework php sécurisé et simple à prendre en main avec générateur web http://mkframework.com/ (hebergé sur developpez.com)
    Mes cours/tutoriaux

  5. #5
    Nouveau membre du Club
    Homme Profil pro
    Formateur en informatique
    Inscrit en
    Février 2015
    Messages
    70
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Belgique

    Informations professionnelles :
    Activité : Formateur en informatique
    Secteur : Associations - ONG

    Informations forums :
    Inscription : Février 2015
    Messages : 70
    Points : 29
    Points
    29
    Par défaut
    Dans le main.php
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
     
    	private function processSave(){
    		if(!_root::getRequest()->isPost() or _root::getParam('formmodule')!=self::$sModuleName ){ //si ce n'est pas une requete POST on ne soumet pas
    			return null;
    		}
     
    		$oPluginXsrf=new plugin_xsrf();
    		if(!$oPluginXsrf->checkToken( _root::getParam('token') ) ){ //on verifie que le token est valide
    			return array('token'=>$oPluginXsrf->getMessage() );
    		}
     
    		$iId=module_participantspmticaccueil::getParam('id',null);
    		if($iId==null){
    			$oT_participants_pmtic=new row_t_participants_pmtic(array());	
    		}else{
    			$oT_participants_pmtic=model_t_participants_pmtic::getInstance()->findById( module_participantspmticaccueil::getParam('id',null) );
    		}
     
            if(isset($_GET['participantspmticaccueilAction'])){
                if($_GET['participantspmticaccueilAction'] == 'edit'){ 
     
                        if(isset($_GET['idrappel'])){
                            $tColumn=array('id_participant','date_rdv_test_participant_pmtic','date_rappel_participant_pmtic','formateur_rappel_participant_pmtic','commentaire_participant_pmtic');
                        }
                        elseif(isset($_GET['idvalidtest'])){
                            $tColumn=array('id_participant','date_rdv_test_participant_pmtic','validation_date_test_participant_pmtic','formateur_validation_participant_pmtic','commentaire_participant_pmtic');
                        }
                        else{
                            $tColumn=array('id_participant','date_rdv_test_participant_pmtic','commentaire_participant_pmtic');
                        }
     
                        foreach($tColumn as $sColumn){
                			$oT_participants_pmtic->$sColumn=_root::getParam($sColumn,null) ;
                		}
     
                        // ligne ajoutée pour inclusion module
                		$oT_participants_pmtic->id_pmtic=$_GET['id'];
     
                		if($oT_participants_pmtic->save()){
                			//une fois enregistre on redirige (vers la page liste)
                			$this->redirect('list');
                		}else{
                			return $oT_participants_pmtic->getListError();
                		}               
                }
                else{ 
                    $tColumn=array('id_participant','date_rdv_test_participant_pmtic','formateur_inscription_participant_pmtic','commentaire_participant_pmtic');
     
                    //Essai pour enregistrement d'un utilisateur dans plusieurs modules PMTIC
                    $iPmtic_id=_root::getParam('tPmtic_id',null); // récupération du tableau des id envoyé en POST
     
                    if(count($iPmtic_id) > 0){ // on compte s'il existe des formations liées au module en cours
     
                        foreach($tColumn as $sColumn){
            			 $oT_participants_pmtic->$sColumn=_root::getParam($sColumn,null) ;
                        }
     
                        // ligne ajoutée pour inclusion module
    		            $oT_participants_pmtic->id_pmtic=$_GET['id'];
     
                        $compteurId=0;
     
                        if($oT_participants_pmtic->save()){
                            $compteurId++;
                        }
     
                        foreach($iPmtic_id as $checkbox){
     
                            $oT_participants_pmtic2=new row_t_participants_pmtic(array());
     
                            foreach($tColumn as $sColumn){
                			 $oT_participants_pmtic2->$sColumn=_root::getParam($sColumn,null) ;
                            }
     
                            $oT_participants_pmtic2->id_pmtic=$checkbox;
     
                            if($oT_participants_pmtic2->save()){
                            $compteurId++;
                            }
     
                        }
     
                        if($compteurId == (count($iPmtic_id)+1)){
                			//une fois enregistre on redirige (vers la page liste)
                			$this->redirect('list');
                		}
                        else{
                			return $oT_participants_pmtic->getListError();
                		}
     
                    }
                    else{ // Si il n'y a aucune formation liée au module en cours
     
                        foreach($tColumn as $sColumn){
                			$oT_participants_pmtic->$sColumn=_root::getParam($sColumn,null) ;
                		}
     
                        // ligne ajoutée pour inclusion module
                		$oT_participants_pmtic->id_pmtic=$_GET['id'];
     
                		if($oT_participants_pmtic->save()){
                			//une fois enregistre on redirige (vers la page liste)
                			$this->redirect('list');
                		}else{
                			return $oT_participants_pmtic->getListError();
                		}                
     
     
     
                    }
                }
            }
    	}
    Dans le model
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
        //on surcharge le constructeur
        public function __construct($tRow){
     
            // On test si la page est celle d'ajout de participants pmtic
            if(isset($_GET['participantspmticaccueilAction'])){
                if($_GET['participantspmticaccueilAction'] == 'edit'){
                    if(isset($_GET['idrappel'])){
                        $oDate2 = new plugin_date($tRow['date_rappel_participant_pmtic'],'Y-m-d');
                        $tRow['date_rappel_participant_pmtic'] = $oDate2->toString('d/m/Y');
                    }
                    elseif(isset($_GET['idvalidtest'])){
                        $oDate1 = new plugin_date($tRow['validation_date_test_participant_pmtic'],'Y-m-d');
                        $tRow['validation_date_test_participant_pmtic'] = $oDate1->toString('d/m/Y');
                    }
                    else{
                        $oDate = new plugin_date($tRow['date_rdv_test_participant_pmtic'],'Y-m-d');
                        $tRow['date_rdv_test_participant_pmtic'] = $oDate->toString('d/m/Y');
                        if($tRow['validation_date_test_participant_pmtic'] != null){
                            $oDate1 = new plugin_date($tRow['validation_date_test_participant_pmtic'],'Y-m-d');
                            $tRow['validation_date_test_participant_pmtic'] = $oDate1->toString('d/m/Y');
                        }
                        if($tRow['date_rappel_participant_pmtic'] != null){
                            $oDate2 = new plugin_date($tRow['date_rappel_participant_pmtic'],'Y-m-d');
                            $tRow['date_rappel_participant_pmtic'] = $oDate2->toString('d/m/Y');
                        }
                    }
                }
                elseif($_GET['participantspmticaccueilAction'] == 'list'){
                    $oDate = new plugin_date($tRow['date_rdv_test_participant_pmtic'],'Y-m-d');
                    $tRow['date_rdv_test_participant_pmtic'] = $oDate->toString('d/m/Y');
                    if(!empty($tRow['validation_date_test_participant_pmtic'])){
                        $oDate1 = new plugin_date($tRow['validation_date_test_participant_pmtic'],'Y-m-d');
                        $tRow['validation_date_test_participant_pmtic'] = $oDate1->toString('d/m/Y');
                    }
                    if(!empty($tRow['date_rappel_participant_pmtic'])){
                        $oDate2 = new plugin_date($tRow['date_rappel_participant_pmtic'],'Y-m-d');
                        $tRow['date_rappel_participant_pmtic'] = $oDate2->toString('d/m/Y');
                    }
                }
            }
            else{
                $oDate = new plugin_date($tRow['date_rdv_test_participant_pmtic'],'Y-m-d');
                $tRow['date_rdv_test_participant_pmtic'] = $oDate->toString('d/m/Y');
                if(!empty($tRow['validation_date_test_participant_pmtic'])){
                    $oDate1 = new plugin_date($tRow['validation_date_test_participant_pmtic'],'Y-m-d');
                    $tRow['validation_date_test_participant_pmtic'] = $oDate1->toString('d/m/Y');
                }
                if(!empty($tRow['date_rappel_participant_pmtic'])){
                    $oDate2 = new plugin_date($tRow['date_rappel_participant_pmtic'],'Y-m-d');
                    $tRow['date_rappel_participant_pmtic'] = $oDate2->toString('d/m/Y');
                }
            } 
     
            //on appel le constructeur normal de la row
            parent::__construct($tRow);  
        }

  6. #6
    Rédacteur
    Avatar de imikado
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Décembre 2006
    Messages
    5 239
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 42
    Localisation : France, Val de Marne (Île de France)

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : Finance

    Informations forums :
    Inscription : Décembre 2006
    Messages : 5 239
    Points : 19 100
    Points
    19 100
    Billets dans le blog
    17
    Par défaut
    Ca c'est le code du module, il faut plutot celui du model:

    \model\model_t_participants_pmtic.php(51):
    Framework php sécurisé et simple à prendre en main avec générateur web http://mkframework.com/ (hebergé sur developpez.com)
    Mes cours/tutoriaux

  7. #7
    Nouveau membre du Club
    Homme Profil pro
    Formateur en informatique
    Inscrit en
    Février 2015
    Messages
    70
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Belgique

    Informations professionnelles :
    Activité : Formateur en informatique
    Secteur : Associations - ONG

    Informations forums :
    Inscription : Février 2015
    Messages : 70
    Points : 29
    Points
    29
    Par défaut
    Oui, désolé, je viens d'actualiser le message pendant ce temps là

  8. #8
    Rédacteur
    Avatar de imikado
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Décembre 2006
    Messages
    5 239
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 42
    Localisation : France, Val de Marne (Île de France)

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : Finance

    Informations forums :
    Inscription : Décembre 2006
    Messages : 5 239
    Points : 19 100
    Points
    19 100
    Billets dans le blog
    17
    Par défaut
    Je comprends mieux l'erreur:
    Code php : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
     
        public function __construct($tRow){
     
            // On test si la page est celle d'ajout de participants pmtic
            if(isset($_GET['participantspmticaccueilAction'])){
                if($_GET['participantspmticaccueilAction'] == 'edit'){
                    if(isset($_GET['idrappel'])){
                        $oDate2 = new plugin_date($tRow['date_rappel_participant_pmtic'],'Y-m-d');
                        $tRow['date_rappel_participant_pmtic'] = $oDate2->toString('d/m/Y');
                    }
                    elseif(isset($_GET['idvalidtest'])){
                        $oDate1 = new plugin_date($tRow['validation_date_test_participant_pmtic'],'Y-m-d');
                        $tRow['validation_date_test_participant_pmtic'] = $oDate1->toString('d/m/Y');
                    }
                    else{
                        $oDate = new plugin_date($tRow['date_rdv_test_participant_pmtic'],'Y-m-d');

    Ceci ne peut pas fonctionner dans le cas d'un nouvel enregistrement: $tRow étant vide, ou un array() vide (vu que c'est un enregistrement vide)

    Il faudrait donc gerer un if (isset($tRow['date_rdv_test_participant_pmtic'])
    Framework php sécurisé et simple à prendre en main avec générateur web http://mkframework.com/ (hebergé sur developpez.com)
    Mes cours/tutoriaux

  9. #9
    Nouveau membre du Club
    Homme Profil pro
    Formateur en informatique
    Inscrit en
    Février 2015
    Messages
    70
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Belgique

    Informations professionnelles :
    Activité : Formateur en informatique
    Secteur : Associations - ONG

    Informations forums :
    Inscription : Février 2015
    Messages : 70
    Points : 29
    Points
    29
    Par défaut
    Le souci, c'est que lors d'un nouvel enregistrement, tout fonctionne correctement.
    C'est uniquement quand je veux éditer un participant que cela ne fonctionne pas.

  10. #10
    Rédacteur
    Avatar de imikado
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Décembre 2006
    Messages
    5 239
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 42
    Localisation : France, Val de Marne (Île de France)

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : Finance

    Informations forums :
    Inscription : Décembre 2006
    Messages : 5 239
    Points : 19 100
    Points
    19 100
    Billets dans le blog
    17
    Par défaut
    D'accord, dans ce cas la, le champ n'est pas retourné par la requete SQL je suppose

    si vous ajoutez un print_r($tRow ?
    Framework php sécurisé et simple à prendre en main avec générateur web http://mkframework.com/ (hebergé sur developpez.com)
    Mes cours/tutoriaux

  11. #11
    Nouveau membre du Club
    Homme Profil pro
    Formateur en informatique
    Inscrit en
    Février 2015
    Messages
    70
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Belgique

    Informations professionnelles :
    Activité : Formateur en informatique
    Secteur : Associations - ONG

    Informations forums :
    Inscription : Février 2015
    Messages : 70
    Points : 29
    Points
    29
    Par défaut
    Voici le print_r($tRow) :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    Array
    (
        [id_participant_pmtic] => 155
        [id_participant] => 2
        [id_pmtic] => 4
        [date_rdv_test_participant_pmtic] => 2015-11-02
        [formateur_inscription_participant_pmtic] => test
        [validation_date_test_participant_pmtic] => 
        [formateur_validation_participant_pmtic] => 
        [date_rappel_participant_pmtic] => 
        [formateur_rappel_participant_pmtic] => 
        [commentaire_participant_pmtic] => 
    )

  12. #12
    Rédacteur
    Avatar de imikado
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Décembre 2006
    Messages
    5 239
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 42
    Localisation : France, Val de Marne (Île de France)

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : Finance

    Informations forums :
    Inscription : Décembre 2006
    Messages : 5 239
    Points : 19 100
    Points
    19 100
    Billets dans le blog
    17
    Par défaut
    Le problème c'est que je n'ai pas le fichier: je ne sais pas a quoi correspond la ligne 51 de votre fichier:
    ce code apparait a 3 endroits

    Code php : Sélectionner tout - Visualiser dans une fenêtre à part
    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
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
     
     
     
     
     
     
        //on surcharge le constructeur
        public function __construct($tRow){
     
            // On test si la page est celle d'ajout de participants pmtic
            if(isset($_GET['participantspmticaccueilAction'])){
                if($_GET['participantspmticaccueilAction'] == 'edit'){
                    if(isset($_GET['idrappel'])){
                        $oDate2 = new plugin_date($tRow['date_rappel_participant_pmtic'],'Y-m-d');
                        $tRow['date_rappel_participant_pmtic'] = $oDate2->toString('d/m/Y');
                    }
                    elseif(isset($_GET['idvalidtest'])){
                        $oDate1 = new plugin_date($tRow['validation_date_test_participant_pmtic'],'Y-m-d');
                        $tRow['validation_date_test_participant_pmtic'] = $oDate1->toString('d/m/Y');
                    }
                    else{
    					//CAS 1
     
                        $oDate = new plugin_date($tRow['date_rdv_test_participant_pmtic'],'Y-m-d');
                        $tRow['date_rdv_test_participant_pmtic'] = $oDate->toString('d/m/Y');
                        if($tRow['validation_date_test_participant_pmtic'] != null){
                            $oDate1 = new plugin_date($tRow['validation_date_test_participant_pmtic'],'Y-m-d');
                            $tRow['validation_date_test_participant_pmtic'] = $oDate1->toString('d/m/Y');
                        }
                        if($tRow['date_rappel_participant_pmtic'] != null){
                            $oDate2 = new plugin_date($tRow['date_rappel_participant_pmtic'],'Y-m-d');
                            $tRow['date_rappel_participant_pmtic'] = $oDate2->toString('d/m/Y');
                        }
                    }
                }
                elseif($_GET['participantspmticaccueilAction'] == 'list'){
    				//CAS 2
     
                    $oDate = new plugin_date($tRow['date_rdv_test_participant_pmtic'],'Y-m-d');
                    $tRow['date_rdv_test_participant_pmtic'] = $oDate->toString('d/m/Y');
                    if(!empty($tRow['validation_date_test_participant_pmtic'])){
                        $oDate1 = new plugin_date($tRow['validation_date_test_participant_pmtic'],'Y-m-d');
                        $tRow['validation_date_test_participant_pmtic'] = $oDate1->toString('d/m/Y');
                    }
                    if(!empty($tRow['date_rappel_participant_pmtic'])){
                        $oDate2 = new plugin_date($tRow['date_rappel_participant_pmtic'],'Y-m-d');
                        $tRow['date_rappel_participant_pmtic'] = $oDate2->toString('d/m/Y');
                    }
                }
            }
            else{
    			//CAS 3
     
                $oDate = new plugin_date($tRow['date_rdv_test_participant_pmtic'],'Y-m-d');
                $tRow['date_rdv_test_participant_pmtic'] = $oDate->toString('d/m/Y');
                if(!empty($tRow['validation_date_test_participant_pmtic'])){
                    $oDate1 = new plugin_date($tRow['validation_date_test_participant_pmtic'],'Y-m-d');
                    $tRow['validation_date_test_participant_pmtic'] = $oDate1->toString('d/m/Y');
                }
                if(!empty($tRow['date_rappel_participant_pmtic'])){
                    $oDate2 = new plugin_date($tRow['date_rappel_participant_pmtic'],'Y-m-d');
                    $tRow['date_rappel_participant_pmtic'] = $oDate2->toString('d/m/Y');
                }
            } 
     
            //on appel le constructeur normal de la row
            parent::__construct($tRow);  
        }

    a quel endroit avez-vous le problème ? pouvez-vous ajouter le print_r dans le cas qui pose soucis ?
    Framework php sécurisé et simple à prendre en main avec générateur web http://mkframework.com/ (hebergé sur developpez.com)
    Mes cours/tutoriaux

  13. #13
    Nouveau membre du Club
    Homme Profil pro
    Formateur en informatique
    Inscrit en
    Février 2015
    Messages
    70
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Belgique

    Informations professionnelles :
    Activité : Formateur en informatique
    Secteur : Associations - ONG

    Informations forums :
    Inscription : Février 2015
    Messages : 70
    Points : 29
    Points
    29
    Par défaut
    Le souci est présent dans le cas d'une édition de participant à la formation.
    Le print_r que je vous ai montré, est bien celui pris lors d'une édition. La ligne 51 qui apparemment pose souci est bien aussi liée à l'édition d'un participant. Ce que je ne comprend pas, c'est que lorsque je valide l'édition, j'ai le message d'erreur cité plus haut alors que dans le print_r, on a bien le champ qui est correctement retourné.

    Le "cas 1" est celui qui gère la page d'édition, le "cas 2" est celui pour la page list et le "cas 3" est lié à l'affichage quand il n'y a pas d'action, puisque ce module est intégré.

    Mon souci est bien axé sur le "cas 1".

    Pour le print_r :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    Array
    (
        [id_participant_pmtic] => 155
        [id_participant] => 2
        [id_pmtic] => 4
        [date_rdv_test_participant_pmtic] => 2015-11-02
        [formateur_inscription_participant_pmtic] => test
        [validation_date_test_participant_pmtic] => 
        [formateur_validation_participant_pmtic] => 
        [date_rappel_participant_pmtic] => 
        [formateur_rappel_participant_pmtic] => 
        [commentaire_participant_pmtic] => 
    )

  14. #14
    Rédacteur
    Avatar de imikado
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Décembre 2006
    Messages
    5 239
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 42
    Localisation : France, Val de Marne (Île de France)

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : Finance

    Informations forums :
    Inscription : Décembre 2006
    Messages : 5 239
    Points : 19 100
    Points
    19 100
    Billets dans le blog
    17
    Par défaut
    Le print_r doit etre trop loin

    l'erreur php est clairement une absence de clé sur un tableau php
    Code php : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    Undefined index: date_rdv_test_participant_pmtic
    #0 C:\wamp\www\mkframework_v4_117_0_r286\data\genere\newerpif3\model\model_t_participants_pmtic.php(51): exception_error_handler(8, 'Undefined index...', 'C:\wamp\www\mkf...', 51, Array)
    #1 C:\wamp\www\mkframework_v4_117_0_r286\data\genere\newerpif3\module\participantspmticaccueil\main.php(171): row_t_participants_pmtic->__construct(Array)

    Dans la stacktrace on voit que le tableau fourni au constucteur est vide:
    Code php : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    Detail:
    #0 C:\wamp\www\mkframework_v4_117_0_r286\data\genere\newerpif3\model\model_t_participants_pmtic.php (51)
    exception_error_handler( , 'Undefined index: date_rdv_test_participant_pmtic' , 'C:\wamp\www\mkframework_v4_117_0_r286\data\genere\newerpif3\model\model_t_participants_pmtic.php' , , Array ( [tRow] => Array ( ) ) )
    #1 C:\wamp\www\mkframework_v4_117_0_r286\data\genere\newerpif3\module\participantspmticaccueil\main.php (171)
    row_t_participants_pmtic -> __construct( Array ( ) )
    Framework php sécurisé et simple à prendre en main avec générateur web http://mkframework.com/ (hebergé sur developpez.com)
    Mes cours/tutoriaux

  15. #15
    Nouveau membre du Club
    Homme Profil pro
    Formateur en informatique
    Inscrit en
    Février 2015
    Messages
    70
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Belgique

    Informations professionnelles :
    Activité : Formateur en informatique
    Secteur : Associations - ONG

    Informations forums :
    Inscription : Février 2015
    Messages : 70
    Points : 29
    Points
    29
    Par défaut
    J'ai placé le print_r en ligne 51, donc juste avant la ligne qui apparemment pose problème. C'est justement pour cela que je ne comprend pas cette erreur.

  16. #16
    Rédacteur
    Avatar de imikado
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Décembre 2006
    Messages
    5 239
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 42
    Localisation : France, Val de Marne (Île de France)

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : Finance

    Informations forums :
    Inscription : Décembre 2006
    Messages : 5 239
    Points : 19 100
    Points
    19 100
    Billets dans le blog
    17
    Par défaut
    on peut dans ce cas faire un print_r conditionnel pour mieux comprendre:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
     
    if(!isset($tRow['date_rdv_test_participant_pmtic']) ){
     print_r($tRow);exit;
    }
    Framework php sécurisé et simple à prendre en main avec générateur web http://mkframework.com/ (hebergé sur developpez.com)
    Mes cours/tutoriaux

  17. #17
    Rédacteur
    Avatar de imikado
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Décembre 2006
    Messages
    5 239
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 42
    Localisation : France, Val de Marne (Île de France)

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : Finance

    Informations forums :
    Inscription : Décembre 2006
    Messages : 5 239
    Points : 19 100
    Points
    19 100
    Billets dans le blog
    17
    Par défaut
    En relisant le controlleru c'est peut etre la qu'il part en cacahuète (en rouge, faut scroller un peu):

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
     else{ 
                    $tColumn=array('id_participant','date_rdv_test_participant_pmtic','formateur_inscription_participant_pmtic','commentaire_participant_pmtic');
                    
                    //Essai pour enregistrement d'un utilisateur dans plusieurs modules PMTIC
                    $iPmtic_id=_root::getParam('tPmtic_id',null); // récupération du tableau des id envoyé en POST
                    
                    if(count($iPmtic_id) > 0){ // on compte s'il existe des formations liées au module en cours
                        
                        foreach($tColumn as $sColumn){
            			 $oT_participants_pmtic->$sColumn=_root::getParam($sColumn,null) ;
                        }
                        
                        // ligne ajoutée pour inclusion module
    		            $oT_participants_pmtic->id_pmtic=$_GET['id'];
                        
                        $compteurId=0;
                        
                        if($oT_participants_pmtic->save()){
                            $compteurId++;
                        }
                        
                        foreach($iPmtic_id as $checkbox){
                            
                            $oT_participants_pmtic2=new row_t_participants_pmtic(array());
    Framework php sécurisé et simple à prendre en main avec générateur web http://mkframework.com/ (hebergé sur developpez.com)
    Mes cours/tutoriaux

  18. #18
    Nouveau membre du Club
    Homme Profil pro
    Formateur en informatique
    Inscrit en
    Février 2015
    Messages
    70
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Belgique

    Informations professionnelles :
    Activité : Formateur en informatique
    Secteur : Associations - ONG

    Informations forums :
    Inscription : Février 2015
    Messages : 70
    Points : 29
    Points
    29
    Par défaut
    Oui en effet, je pense qu'il y a eu quelque chose de ce côté là.
    J'ai repris une copie de mon fichier dans son état d'origine, et là tout fonctionne.
    Donc je dois avoir fauté quelque part

    En fait j'ai des formations liées, et je et lorsque je crée un participant l'enregistrement se crée automatiquement pour la formation principale et les formations liées.
    Je désire pouvoir modifier les enregistrements des ces formations en même temps.

    Donc en gros :
    Je crée 3 formations A,B et C
    B et C sont liée à la formation A qui est la formation maîtresse.
    Dans une table j'ai une liste d'utilisateurs.

    Quand je veux inscrire quelqu'un à une des trois formations, j'utilise une autre table qui reprend certaines données particulières et bien sur l'id de l'utilisateur et de la ou les formations à laquelle le user est inscrit.

    Je voudrais, lorsque je modifie l'utilisateur sur la formation B (par exemple) que les autres enregistrements soient modifiés également.
    Je pense que c'est là que j'ai eu quelques soucis, j'ai retiré le tout et maintenant l'édition classique fonctionne.

    Avez vous un conseil pour faire ce que je recherche ? Encore merci pour tout

  19. #19
    Rédacteur
    Avatar de imikado
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Décembre 2006
    Messages
    5 239
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 42
    Localisation : France, Val de Marne (Île de France)

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : Finance

    Informations forums :
    Inscription : Décembre 2006
    Messages : 5 239
    Points : 19 100
    Points
    19 100
    Billets dans le blog
    17
    Par défaut
    En fait, en y reflechissant, il faudrait gerer des "trigger", je sais pas si vous connaissez de nom

    l'idée c'est de dire: on modifie la formation A, et dans sa méthode save, on verifie si elle a un/n fils
    si c'est le cas on appelle la modif du fils

    idem pour le fils

    vous voyez l'idée ?
    Framework php sécurisé et simple à prendre en main avec générateur web http://mkframework.com/ (hebergé sur developpez.com)
    Mes cours/tutoriaux

  20. #20
    Nouveau membre du Club
    Homme Profil pro
    Formateur en informatique
    Inscrit en
    Février 2015
    Messages
    70
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Belgique

    Informations professionnelles :
    Activité : Formateur en informatique
    Secteur : Associations - ONG

    Informations forums :
    Inscription : Février 2015
    Messages : 70
    Points : 29
    Points
    29
    Par défaut
    Je connais les "trigger" de nom et un tout petit peu leur principe, mais je n'ai jamais utilisé cela.
    Je vais jetter un oeil la dessus pour voir ce que je peux trouver.

    Merci du conseil.

    P.S. : Avez vous quelques pistes pour ces "trigger" ?

+ Répondre à la discussion
Cette discussion est résolue.
Page 1 sur 2 12 DernièreDernière

Discussions similaires

  1. ORM : Automatiser un retraitement sur des enregistrements
    Par llaffont dans le forum MkFramework
    Réponses: 13
    Dernier message: 10/09/2015, 12h46
  2. Réponses: 11
    Dernier message: 06/03/2015, 15h55
  3. Calcul de données present sur des enregistrements different
    Par logistik dans le forum Langage SQL
    Réponses: 6
    Dernier message: 04/05/2005, 16h33
  4. Réponses: 8
    Dernier message: 24/08/2004, 22h25
  5. Réponses: 9
    Dernier message: 17/01/2004, 10h51

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo