From 63ae96c4217d48fdbb8d9bc82bb489dc8de5ef65 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 26 Jun 2011 19:29:39 +0000 Subject: [PATCH 1/6] New: Enhance form to post a new member --- htdocs/public/members/new.php | 93 ++++++++++++++++++++++++++--------- 1 file changed, 70 insertions(+), 23 deletions(-) diff --git a/htdocs/public/members/new.php b/htdocs/public/members/new.php index 6c647d51961..d16aeaf2ddb 100644 --- a/htdocs/public/members/new.php +++ b/htdocs/public/members/new.php @@ -22,7 +22,17 @@ * \file htdocs/public/members/new.php * \ingroup member * \brief Example of form to add a new member - * \version $Id: new.php,v 1.26 2011/06/26 18:53:17 eldy Exp $ + * \version $Id: new.php,v 1.28 2011/06/26 19:29:39 eldy Exp $ + * + * Note that you can add following constant to change behaviour of page + * MEMBER_NEWFORM_EDITAMOUNT + * MEMBER_NEWFORM_PAYONLINE + * MEMBER_NEWFORM_DOLIBARRTURNOVER + * MEMBER_URL_REDIRECT_SUBSCRIPTION + * MEMBER_NEWFORM_FORCETYPE + * MEMBER_NEWFORM_FORCEMORPHY + * MEMBER_NEWFORM_FORCECOUNTRYCODE + * */ define("NOLOGIN",1); // This means this output page does not require to be logged. @@ -134,6 +144,16 @@ if ($action == 'add') $errmsg .= $langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("EMail"))."
\n"; } } + if (GETPOST('type') <= 0) + { + $error+=1; + $errmsg .= $langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Type"))."
\n"; + } + if (! in_array(GETPOST('morphy'),array('mor','phy'))) + { + $error+=1; + $errmsg .= $langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("MorPhy"))."
\n"; + } if (!isset($_POST["nom"]) || !isset($_POST["prenom"]) || $_POST["prenom"]=='' || $_POST["nom"]=='') { $error+=1; @@ -243,7 +263,7 @@ if ($action == 'added') print $langs->trans("NewMemberbyWeb"); print ''; - llxFooterVierge('$Date: 2011/06/26 18:53:17 $ - $Revision: 1.26 $'); + llxFooterVierge('$Date: 2011/06/26 19:29:39 $ - $Revision: 1.28 $'); exit; } @@ -275,19 +295,24 @@ print $langs->trans("FieldsWithIsForPublic",'**').'
'; print ''; @@ -390,7 +415,7 @@ print ''."\n"; // Zip / Town print ''.$langs->trans('Zip').' / '.$langs->trans('Town').''; -print $formcompany->select_ziptown(GETPOST('zipcode'),'zipcode',array('town','selectpays_id','departement_id'),6); +print $formcompany->select_ziptown(GETPOST('zipcode'), 'zipcode', array('town','selectpays_id','departement_id'), 6, 1); print ' / '; -print $formcompany->select_ziptown(GETPOST('town'),'town',array('zipcode','selectpays_id','departement_id')); +print $formcompany->select_ziptown(GETPOST('town'), 'town', array('zipcode','selectpays_id','departement_id'), 0, 1); print ''; // Country print ''.$langs->trans('Country').''; @@ -449,14 +449,14 @@ if (! empty($conf->global->MEMBER_NEWFORM_DOLIBARRTURNOVER)) '; print ''."\n"; } -if (! empty($conf->global->MEMBER_NEWFORM_EDITAMOUNT) +if (! empty($conf->global->MEMBER_NEWFORM_AMOUNT) || ! empty($conf->global->MEMBER_NEWFORM_PAYONLINE)) { // $conf->global->MEMBER_NEWFORM_SHOWAMOUNT is an amount $amount=0; if (! empty($conf->global->MEMBER_NEWFORM_PAYONLINE)) { - $amount=GETPOST('amount')?GETPOST('amount'):$conf->global->MEMBER_NEWFORM_EDITAMOUNT; + $amount=GETPOST('amount')?GETPOST('amount'):$conf->global->MEMBER_NEWFORM_AMOUNT; } // $conf->global->MEMBER_NEWFORM_PAYONLINE is 'paypal' or 'paybox' if (! empty($conf->global->MEMBER_NEWFORM_EDITAMOUNT)) @@ -490,5 +490,5 @@ print "
\n"; $db->close(); -llxFooterVierge('$Date: 2011/06/26 19:29:39 $ - $Revision: 1.28 $'); +llxFooterVierge('$Date: 2011/06/26 21:51:34 $ - $Revision: 1.29 $'); ?> From 17129bd0030d0bd0ffb373f4ade8a344d5ddfacb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 26 Jun 2011 21:51:56 +0000 Subject: [PATCH 4/6] Add param to disable autocomplete on zip/town --- htdocs/core/class/html.formcompany.class.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/html.formcompany.class.php b/htdocs/core/class/html.formcompany.class.php index a8c1fadfcd4..e21904e4242 100644 --- a/htdocs/core/class/html.formcompany.class.php +++ b/htdocs/core/class/html.formcompany.class.php @@ -20,7 +20,7 @@ * \file htdocs/core/class/html.formcompany.class.php * \ingroup core * \brief File of class to build HTML component for third parties management - * \version $Id$ + * \version $Id: html.formcompany.class.php,v 1.33 2011/06/26 21:51:56 eldy Exp $ */ @@ -627,8 +627,9 @@ class FormCompany * @param htmlname * @param fields * @param fieldsize + * @param disableautocomplete 1 To disable autocomplete features */ - function select_ziptown($selected='',$htmlname='zipcode',$fields='',$fieldsize=0) + function select_ziptown($selected='', $htmlname='zipcode', $fields='', $fieldsize=0, $disableautocomplete=0) { global $conf; @@ -637,7 +638,7 @@ class FormCompany $size=''; if (!empty($fieldsize)) $size='size="'.$fieldsize.'"'; - if ($conf->use_javascript_ajax) $out.= ajax_multiautocompleter($htmlname,$fields,DOL_URL_ROOT.'/core/ajaxziptown.php')."\n"; + if ($conf->use_javascript_ajax && empty($disableautocomplete)) $out.= ajax_multiautocompleter($htmlname,$fields,DOL_URL_ROOT.'/core/ajaxziptown.php')."\n"; $out.= ''."\n"; return $out; From 6d136ee49bd2346d5236e7e4c5d925d6415176e4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 26 Jun 2011 22:13:38 +0000 Subject: [PATCH 5/6] Fix: Typo --- htdocs/langs/en_US/main.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index b5cc6dd2839..173895a6d46 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -576,7 +576,7 @@ CoreErrorTitle=System error CoreErrorMessage=Sorry, an error occurred. Check the logs or contact your system administrator. CreditCard=Credit card FieldsWithAreMandatory=Fields with %s are mandatory -FieldsWithIsForPublic=Fields with %s are shown on public list of members. If you don't want this, check the "public" box. +FieldsWithIsForPublic=Fields with %s are shown on public list of members. If you don't want this, check off the "public" box. AccordingToGeoIPDatabase=(according to GeoIP convertion) Line=Line NotSupported=Not supported From 2d14879e851bb33cd0ae77d1f484997c3d97bf38 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 27 Jun 2011 10:41:31 +0000 Subject: [PATCH 6/6] Fix: use $this->db instead $db --- htdocs/core/class/interfaces.class.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/core/class/interfaces.class.php b/htdocs/core/class/interfaces.class.php index 313a9104a9f..64690d276f6 100644 --- a/htdocs/core/class/interfaces.class.php +++ b/htdocs/core/class/interfaces.class.php @@ -22,7 +22,7 @@ * \file htdocs/core/class/interfaces.class.php * \ingroup core * \brief Fichier de la classe de gestion des triggers - * \version $Id$ + * \version $Id: interfaces.class.php,v 1.7 2011/06/27 10:41:31 hregis Exp $ */ @@ -184,7 +184,7 @@ class Interfaces { global $conf, $langs; - $html = new Form($db); + $html = new Form($this->db); $files = array(); $modules = array(); @@ -212,7 +212,7 @@ class Interfaces { $langs->load("errors"); print '
'.$langs->trans("Error").' : '.$langs->trans("ErrorDuplicateTrigger",$modName,"/htdocs/includes/triggers/").'
'; - $objMod = new $modName($db); + $objMod = new $modName($this->db); $modules[$i] = $modName; $files[$i] = $file; @@ -222,7 +222,7 @@ class Interfaces else { include_once($dir.'/'.$file); - $objMod = new $modName($db); + $objMod = new $modName($this->db); $modules[$i] = $modName; $files[$i] = $file; @@ -246,7 +246,7 @@ class Interfaces $modName = $modules[$key]; if ($modName) { - $objMod = new $modName($db); + $objMod = new $modName($this->db); // Bypass if workflow module is enabled and if the trigger is compatible if ($workflow && ! empty($objMod->disabled_if_workflow)) continue; }