From 2eb5ff506d54c4d235fea443d9c20ddc0ad51042 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 2 May 2007 09:49:57 +0000 Subject: [PATCH] Qual: Uniformisation du code par suppression de la fonction selectyesnonum en doublon avec selectyesno. --- htdocs/adherents/type.php | 8 ++++---- htdocs/admin/adherent.php | 6 +++--- htdocs/admin/compta.php | 2 +- htdocs/admin/comptaexpert.php | 2 +- htdocs/admin/const.php | 2 +- htdocs/admin/ihm.php | 14 +++++++------- htdocs/admin/societe.php | 2 +- htdocs/categories/edit.php | 2 +- htdocs/categories/fiche.php | 2 +- htdocs/html.form.class.php | 11 ----------- .../modules/facture/pluton/pluton.modules.php | 4 ++-- htdocs/soc.php | 4 ++-- htdocs/user/fiche.php | 4 ++-- 13 files changed, 26 insertions(+), 37 deletions(-) diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index 24422a7dd51..4dd447e64bc 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -209,11 +209,11 @@ if ($_GET["action"] == 'create') print ''.$langs->trans("Label").''; print ''.$langs->trans("SubscriptionRequired").''; - print $htmls->selectyesnonum("cotisation",1); + print $htmls->selectyesno("cotisation",1,1); print ''; print ''.$langs->trans("VoteAllowed").''; - print $htmls->selectyesnonum("vote",0); + print $htmls->selectyesno("vote",0,1); print ''; print ''.$langs->trans("Comments").''; @@ -340,11 +340,11 @@ if ($rowid > 0) print ''.$langs->trans("Label").''; print ''.$langs->trans("SubscriptionRequired").''; - print $htmls->selectyesnonum("cotisation",$adht->cotisation); + print $htmls->selectyesno("cotisation",$adht->cotisation,1); print ''; print ''.$langs->trans("VoteAllowed").''; - print $htmls->selectyesnonum("vote",$adht->vote); + print $htmls->selectyesno("vote",$adht->vote,1); print ''; print ''.$langs->trans("Comments").''; diff --git a/htdocs/admin/adherent.php b/htdocs/admin/adherent.php index a7b10590091..c7dead7200f 100644 --- a/htdocs/admin/adherent.php +++ b/htdocs/admin/adherent.php @@ -129,7 +129,7 @@ print ''; print ''; print ''; print "".$langs->trans("AdherentMailRequired").''; -print $form->selectyesnonum('constvalue',$conf->global->ADHERENT_MAIL_REQUIRED); +print $form->selectyesno('constvalue',$conf->global->ADHERENT_MAIL_REQUIRED,1); print ''; print ''; print "\n"; @@ -144,7 +144,7 @@ if ($conf->banque->enabled) print ''; print ''; print "".$langs->trans("AddSubscriptionIntoAccount").''; - print $form->selectyesnonum('constvalue',$conf->global->ADHERENT_BANK_USE); + print $form->selectyesno('constvalue',$conf->global->ADHERENT_BANK_USE,1); print ''; print ''; print "\n"; @@ -297,7 +297,7 @@ function form_constantes($tableau){ print ''; if ($obj->type == 'yesno') { - print $form->selectyesnonum('constvalue',$obj->value); + print $form->selectyesno('constvalue',$obj->value,1); print ''; $form->select_array('consttype',array('yesno','texte','chaine'),0); } diff --git a/htdocs/admin/compta.php b/htdocs/admin/compta.php index 68bc1cf146b..9108a1d8c7b 100644 --- a/htdocs/admin/compta.php +++ b/htdocs/admin/compta.php @@ -133,7 +133,7 @@ if ($result) print ''; if ($obj->type == 'yesno') { - print $form->selectyesnonum('constvalue',$obj->value); + print $form->selectyesno('constvalue',$obj->value,1); } elseif ($obj->type == 'texte') { diff --git a/htdocs/admin/comptaexpert.php b/htdocs/admin/comptaexpert.php index 9e8e74b015f..8e9e7abd6f2 100644 --- a/htdocs/admin/comptaexpert.php +++ b/htdocs/admin/comptaexpert.php @@ -134,7 +134,7 @@ if ($result) print ''; if ($obj->type == 'yesno') { - print $form->selectyesnonum('constvalue',$obj->value); + print $form->selectyesno('constvalue',$obj->value,1); } elseif ($obj->type == 'texte') { diff --git a/htdocs/admin/const.php b/htdocs/admin/const.php index fc69f0e882b..7392d0368d2 100644 --- a/htdocs/admin/const.php +++ b/htdocs/admin/const.php @@ -125,7 +125,7 @@ if ($result) print ''; if ($obj->type == 'yesno') { - print $form->selectyesnonum('constvalue',$obj->value); + print $form->selectyesno('constvalue',$obj->value,1); print ''; $form->select_array('consttype',array('yesno','texte','chaine'),0); } diff --git a/htdocs/admin/ihm.php b/htdocs/admin/ihm.php index 145e1570c42..ada919d2b54 100644 --- a/htdocs/admin/ihm.php +++ b/htdocs/admin/ihm.php @@ -108,29 +108,29 @@ if (isset($_GET["action"]) && $_GET["action"] == 'edit') $var=!$var; print ''.$langs->trans("EnableMultilangInterface").''; - print $html->selectyesnonum('main_multilangs',$conf->global->MAIN_MULTILANGS); + print $html->selectyesno('main_multilangs',$conf->global->MAIN_MULTILANGS,1); print ''; $var=!$var; print ''.$langs->trans("ShowBugTrackLink").''; - print $html->selectyesnonum('main_show_bugtrack_link',$conf->global->MAIN_SHOW_BUGTRACK_LINK); + print $html->selectyesno('main_show_bugtrack_link',$conf->global->MAIN_SHOW_BUGTRACK_LINK,1); print ''; $var=!$var; print ''.$langs->trans("ShowWorkBoard").''; - print $html->selectyesnonum('main_show_workboard',$conf->global->MAIN_SHOW_WORKBOARD); + print $html->selectyesno('main_show_workboard',$conf->global->MAIN_SHOW_WORKBOARD,1); print ''; // Désactiver javascript $var=!$var; print ''.$langs->trans("DisableJavascript").''; - print $html->selectyesnonum('main_disable_javascript',isset($conf->global->MAIN_DISABLE_JAVASCRIPT)?$conf->global->MAIN_DISABLE_JAVASCRIPT:0); + print $html->selectyesno('main_disable_javascript',isset($conf->global->MAIN_DISABLE_JAVASCRIPT)?$conf->global->MAIN_DISABLE_JAVASCRIPT:0,1); print ''; // Désactiver ajax $var=!$var; print ''.$langs->trans("DisableAjax").''; - print $html->selectyesnonum('main_disable_ajax',isset($conf->global->MAIN_DISABLE_AJAX)?$conf->global->MAIN_DISABLE_AJAX:1); + print $html->selectyesno('main_disable_ajax',isset($conf->global->MAIN_DISABLE_AJAX)?$conf->global->MAIN_DISABLE_AJAX:1,1); print ''; // Désactiver le calendrier popup @@ -147,7 +147,7 @@ if (isset($_GET["action"]) && $_GET["action"] == 'edit') // Activer onglet preview $var=!$var; print ''.$langs->trans("UsePreviewTabs").''; - print $html->selectyesnonum('main_use_preview_tabs',isset($conf->global->MAIN_USE_PREVIEW_TABS)?$conf->global->MAIN_USE_PREVIEW_TABS:1); + print $html->selectyesno('main_use_preview_tabs',isset($conf->global->MAIN_USE_PREVIEW_TABS)?$conf->global->MAIN_USE_PREVIEW_TABS:1,1); print ''; print '
'; @@ -166,7 +166,7 @@ if (isset($_GET["action"]) && $_GET["action"] == 'edit') { $var=!$var; print ''.$searchformtitle[$key].''; - print $html->selectyesnonum($searchform[$key],$searchformconst[$key]); + print $html->selectyesno($searchform[$key],$searchformconst[$key],1); print ''; } print ''; diff --git a/htdocs/admin/societe.php b/htdocs/admin/societe.php index fb4355e7a14..922deb42af9 100644 --- a/htdocs/admin/societe.php +++ b/htdocs/admin/societe.php @@ -222,7 +222,7 @@ $var=!$var; print ''; print ''.$langs->trans("UseXXX")."\n"; print ''; -print $form->selectyesnonum('constvalue',! $conf->global->XXX); +print $form->selectyesno('constvalue',! $conf->global->XXX,1); print ''; print ''.$langs->trans("XXXDesc").''; print ''; diff --git a/htdocs/categories/edit.php b/htdocs/categories/edit.php index 5baaa07e65e..5cb16fbc7aa 100644 --- a/htdocs/categories/edit.php +++ b/htdocs/categories/edit.php @@ -122,7 +122,7 @@ print $html->select_all_categories($categorie->type,$categorie->id_mere); print ''; print ''.$langs->trans("ContentsVisibleByAll").''; -print $html->selectyesnonum("visible",$categorie->visible); +print $html->selectyesno("visible",$categorie->visible,1); print ''; print ''; diff --git a/htdocs/categories/fiche.php b/htdocs/categories/fiche.php index e59ccfbde03..48ff5d98b2e 100644 --- a/htdocs/categories/fiche.php +++ b/htdocs/categories/fiche.php @@ -166,7 +166,7 @@ if ($user->rights->categorie->creer) print $html->select_all_categories($_GET['type']); print ''; print ''.$langs->trans ("ContentsVisibleByAll").''; - print $html->selectyesnonum("visible", 1); + print $html->selectyesno("visible", 1,1); print ''; print ''; print ''; diff --git a/htdocs/html.form.class.php b/htdocs/html.form.class.php index 6c6a931cc87..c9f6ceadc6e 100644 --- a/htdocs/html.form.class.php +++ b/htdocs/html.form.class.php @@ -2643,17 +2643,6 @@ class Form return $resultyesno; } - /** - * \brief Selection de oui/non en chiffre (renvoie 1/0) - * \param name Nom du select - * \param value Valeur présélectionnée - */ - function selectyesnonum($name,$value='') - { - $resultyesno = $this->selectyesno($name,$value,1); - return $resultyesno; - } - /** * \brief Checkbox * diff --git a/htdocs/includes/modules/facture/pluton/pluton.modules.php b/htdocs/includes/modules/facture/pluton/pluton.modules.php index 40235360f78..b62bb76d5c3 100644 --- a/htdocs/includes/modules/facture/pluton/pluton.modules.php +++ b/htdocs/includes/modules/facture/pluton/pluton.modules.php @@ -103,7 +103,7 @@ function info() $texte.= '
'; $texte.= ''; $texte.= ''; - $texte.= $form->selectyesnonum('numrestart',$conf->global->FACTURE_NUM_RESTART_BEGIN_YEAR); + $texte.= $form->selectyesno('numrestart',$conf->global->FACTURE_NUM_RESTART_BEGIN_YEAR,1); $texte.= ''; $texte.= '
'; @@ -112,7 +112,7 @@ function info() $texte.= '
'; $texte.= ''; $texte.= ''; - $texte.= $form->selectyesnonum('numwithinvoice',$conf->global->AVOIR_NUM_WITH_INVOICE); + $texte.= $form->selectyesno('numwithinvoice',$conf->global->AVOIR_NUM_WITH_INVOICE,1); $texte.= ''; $texte.= '
'; diff --git a/htdocs/soc.php b/htdocs/soc.php index 948fbb1e51d..47704b55c7c 100644 --- a/htdocs/soc.php +++ b/htdocs/soc.php @@ -382,7 +382,7 @@ if ($_POST["getcustomercode"] || $_POST["getsuppliercode"] || // Fournisseur print ''; print ''.$langs->trans('Supplier').''; - print $form->selectyesnonum("fournisseur",$soc->fournisseur); + print $form->selectyesno("fournisseur",$soc->fournisseur,1); print ''; print ''.$langs->trans('SupplierCode').''; @@ -710,7 +710,7 @@ elseif ($_GET["action"] == 'edit' || $_POST["action"] == 'edit') // Fournisseur print ''; print ''.$langs->trans('Supplier').''; - print $form->selectyesnonum("fournisseur",$soc->fournisseur); + print $form->selectyesnonum("fournisseur",$soc->fournisseur,1); print ''; print ''.$langs->trans('SupplierCode').''; diff --git a/htdocs/user/fiche.php b/htdocs/user/fiche.php index 2c92db1d601..c8108f03b09 100644 --- a/htdocs/user/fiche.php +++ b/htdocs/user/fiche.php @@ -572,7 +572,7 @@ if (($action == 'create') || ($action == 'adduserldap')) { print ''.$langs->trans("Administrator").''; print ''; - print $form->selectyesnonum('admin',0); + print $form->selectyesno('admin',0,1); print "\n"; } @@ -1193,7 +1193,7 @@ else print ''; if ($user->admin) { - print $form->selectyesnonum('admin',$fuser->admin); + print $form->selectyesno('admin',$fuser->admin,1); } else {