Comparaison de deux dates puis validation.

More
11 years 6 months ago #36351 by seabird
Mince je viens de remarquer un problème que je n'avais pas vu ce matin.
Si date_debut < date_fin j'ai bien redirection vers le formulaire apres le message d'alerte.
Code:
if( $date_debut > $date_fin ) { echo "<script>alert ('Please enter correct dates , bla bla bla ...');"; echo "window.history.back();"; echo "</script>"; jexit(); }

Tout se passe bien du coté backend par contre du coté frontend avant la redirection j'ai une erreur qui s'affiche:
Warning: Invalid argument supplied for foreach() in C:\wamp\www\loisirs-joomla-test\libraries\joomla\form\form.php on line 1178

Eric

Please Log in or Create an account to join the conversation.

More
11 years 6 months ago #36352 by ggppdk
Hello the code that i gave you is not related to this error,

please check what code you are calling in your plugin


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...

Please Log in or Create an account to join the conversation.

More
11 years 6 months ago #36353 by seabird
Voilà le code
Code:
public function onBeforeSaveItem( & $item, $isnew ) { $post = JRequest::get('post'); // echo "<pre>"; print_r($post);; echo "</pre>"; exit; $erreur_ordre_date=0; // VERIFICATION FORMAT DATE // découpage date début $jour1 = substr($post['custom']['date_debut'][0], 0, 2); $mois1 = substr($post['custom']['date_debut'][0], 3, 2); $annee1 = substr($post['custom']['date_debut'][0], 6, 4); $date_debut=$annee1.'-'.$mois1.'-'.$jour1; // découpage date fin $jour2 = substr($post['custom']['date_fin'][0], 0, 2); $mois2 = substr($post['custom']['date_fin'][0], 3, 2); $annee2 = substr($post['custom']['date_fin'][0], 6, 4); $date_fin=$annee2.'-'.$mois2.'-'.$jour2; //echo $date_debut;echo"<br>"; //echo $date_fin;echo"<br>"; // vérification si date_debut < date_fin if ((mktime(0 , 0 , 0 , $mois2 , $jour2 , $annee2) - mktime(0 , 0 , 0 , $mois1 , $jour1 , $annee1)) < 0) {$erreur_ordre_date=1; } if ( $erreur_ordre_date==0) { return true; } else { echo "<script>alert ('Erreur la date de début est supérieur à la date de fin, veuillez corriger');"; echo "window.history.back();"; echo "</script>"; jexit(); } }

Je ne vois pas trop ce qui gène

Eric

Please Log in or Create an account to join the conversation.

More
11 years 6 months ago #36356 by ggppdk
Temporarily edit:
C:\wamp\www\loisirs-joomla-test\libraries\joomla\form\form.php

and add before the error-giving line:
Code:
if ( !is_array($ids) ) { debug_print_backtrace (DEBUG_BACKTRACE_IGNORE_ARGS); exit; }

This should tell you which function tree called it


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...

Please Log in or Create an account to join the conversation.

More
11 years 6 months ago #36358 by seabird
voila ce que j'obtiens:
Code:
#0 JForm->filterField() called at [C:\wamp\www\loisirs-joomla-test\libraries\joomla\form\form.php:241] #1 JForm->filter() called at [C:\wamp\www\loisirs-joomla-test\libraries\joomla\application\component\modelform.php:261] #2 JModelForm->validate() called at [C:\wamp\www\loisirs-joomla-test\components\com_flexicontent\controller.php:121] #3 FlexicontentController->save() called at [C:\wamp\www\loisirs-joomla-test\libraries\joomla\application\component\controller.php:761] #4 JController->execute() called at [C:\wamp\www\loisirs-joomla-test\components\com_flexicontent\flexicontent.php:119] #5 require_once(C:\wamp\www\loisirs-joomla-test\components\com_flexicontent\flexicontent.php) called at [C:\wamp\www\loisirs-joomla-test\libraries\joomla\application\component\helper.php:383] #6 JComponentHelper::executeComponent() called at [C:\wamp\www\loisirs-joomla-test\libraries\joomla\application\component\helper.php:351] #7 JComponentHelper::renderComponent() called at [C:\wamp\www\loisirs-joomla-test\includes\application.php:197] #8 JSite->dispatch() called at [C:\wamp\www\loisirs-joomla-test\index.php:42]

eric

Please Log in or Create an account to join the conversation.

More
11 years 6 months ago #36359 by seabird
Bon j'ai vidé complètement le plugin:
Code:
defined('_JEXEC') or die; class plgContentdateevenement extends JPlugin { public function onBeforeSaveItem( & $item, $isnew ) { exit; } }

Et j'ai toujours l'erreur:


J'ai visiblement un problème ???
je ne vois pas ou est l'erreur, j'ai donc rajouté
Code:
ini_set('display_errors','off');
dans le plugin pour supprimer ce warning :?

Eric

Please Log in or Create an account to join the conversation.

Moderators: vistamediajoomlacornerggppdk
Time to create page: 1.608 seconds
Save
Cookies user preferences
We use cookies to ensure you to get the best experience on our website. If you decline the use of cookies, this website may not function as expected.
Accept all
Decline all
Essential
These cookies are needed to make the website work correctly. You can not disable them.
Display
Accept
Analytics
Tools used to analyze the data to measure the effectiveness of a website and to understand how it works.
Google Analytics
Accept
Decline