From 9a8a306d78f98549112d0256ba6c0ab635b7cd02 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 2 Apr 2014 14:53:42 +0200 Subject: [PATCH] Qual: Method form->select_currency() has been removed. Use instead print form->selectCurrency(). Qual: Method form->select_methodes_commande() has been renamed into english name selectInputMethod(). --- ChangeLog | 4 +- htdocs/admin/company.php | 6 +-- htdocs/comm/propal.php | 10 ++--- htdocs/commande/fiche.php | 8 ++-- htdocs/compta/bank/fiche.php | 6 +-- htdocs/core/class/html.form.class.php | 48 +++++++++++----------- htdocs/core/class/html.formorder.class.php | 30 +++++++------- htdocs/fourn/commande/fiche.php | 6 +-- htdocs/product/fournisseurs.php | 8 ++-- 9 files changed, 64 insertions(+), 62 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1061c220394..d23e281c009 100644 --- a/ChangeLog +++ b/ChangeLog @@ -75,7 +75,9 @@ Dolibarr better: - The deprecated way (with 4 parameters) to declare a new tab into a module descriptor file has been removed. You must now use the 6 parameters way. See file modMyModule.class.php for example. - Remove the javascript function ac_delay() that is not used anymore by core code. -- Properties "dictionaries" into module descriptor files has been renamed into "dictionaries". +- Properties "dictionnaries" into module descriptor files has been renamed into "dictionaries". +- Method form->select_currency() has been removed. Use instead print form->selectCurrency(). +- Method form->select_methodes_commande() has been renamed into english name selectInputMethod(). diff --git a/htdocs/admin/company.php b/htdocs/admin/company.php index f8a0c9ea5a1..63ca02f6a5c 100644 --- a/htdocs/admin/company.php +++ b/htdocs/admin/company.php @@ -305,7 +305,7 @@ if ($action == 'edit' || $action == 'updateedit') $var=!$var; print ''.$langs->trans("CompanyCurrency").''; - $form->select_currency($conf->currency,"currency"); + print $form->selectCurrency($conf->currency,"currency"); print ''."\n"; $var=!$var; @@ -381,7 +381,7 @@ if ($action == 'edit' || $action == 'updateedit') $var=!$var; print ''.$langs->trans("ManagingDirectors").''; print ''; - + // Capital $var=!$var; print ''.$langs->trans("Capital").''; @@ -746,7 +746,7 @@ else $var=!$var; print ''.$langs->trans("ManagingDirectors").''; print $conf->global->MAIN_INFO_SOCIETE_MANAGERS . ''; - + // Capital $var=!$var; print ''.$langs->trans("Capital").''; diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index 64421622f28..05a48555991 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -1187,12 +1187,12 @@ if ($action == 'create') { // What trigger creation print '' . $langs->trans('Source') . ''; - $form->select_demand_reason('', 'demand_reason_id', "SRC_PROP", 1); + $form->selectInputReason('', 'demand_reason_id', "SRC_PROP", 1); print ''; // Delivery delay print '' . $langs->trans('AvailabilityPeriod') . ''; - $form->select_availability('', 'availability_id', '', 1); + $form->selectAvailabilityDelay('', 'availability_id', '', 1); print ''; // Delivery date (or manufacturing) @@ -1604,13 +1604,11 @@ if ($action == 'create') { print 'id . '">' . img_edit($langs->transnoentitiesnoconv('SetDemandReason'), 1) . ''; print ''; print ''; - // print $object->demand_reason_id; if ($action == 'editdemandreason') { - $form->form_demand_reason($_SERVER ['PHP_SELF'] . '?id=' . $object->id, $object->demand_reason_id, 'demand_reason_id', 1); + $form->formInputReason($_SERVER ['PHP_SELF'] . '?id=' . $object->id, $object->demand_reason_id, 'demand_reason_id', 1); } else { - $form->form_demand_reason($_SERVER ['PHP_SELF'] . '?id=' . $object->id, $object->demand_reason_id, 'none'); + $form->formInputReason($_SERVER ['PHP_SELF'] . '?id=' . $object->id, $object->demand_reason_id, 'none'); } - print ''; print ''; diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php index 21f1b96b7dc..4426537493c 100644 --- a/htdocs/commande/fiche.php +++ b/htdocs/commande/fiche.php @@ -1446,12 +1446,12 @@ if ($action == 'create' && $user->rights->commande->creer) { // Delivery delay print '' . $langs->trans('AvailabilityPeriod') . ''; - $form->select_availability($availability_id, 'availability_id', '', 1); + $form->selectAvailabilityDelay($availability_id, 'availability_id', '', 1); print ''; // What trigger creation print '' . $langs->trans('Source') . ''; - $form->select_demand_reason($demand_reason_id, 'demand_reason_id', '', 1); + $form->selectInputReason($demand_reason_id, 'demand_reason_id', '', 1); print ''; // Project @@ -1929,9 +1929,9 @@ if ($action == 'create' && $user->rights->commande->creer) { print ''; print ''; if ($action == 'editdemandreason') { - $form->form_demand_reason($_SERVER ['PHP_SELF'] . '?id=' . $object->id, $object->demand_reason_id, 'demand_reason_id', 1); + $form->formInputReason($_SERVER ['PHP_SELF'] . '?id=' . $object->id, $object->demand_reason_id, 'demand_reason_id', 1); } else { - $form->form_demand_reason($_SERVER ['PHP_SELF'] . '?id=' . $object->id, $object->demand_reason_id, 'none'); + $form->formInputReason($_SERVER ['PHP_SELF'] . '?id=' . $object->id, $object->demand_reason_id, 'none'); } // Removed because using dictionary is an admin feature, not a user feature. Ther is already the "star" to show info to admin users. // This is to avoid too heavy screens and have an uniform look and feel for all screens. diff --git a/htdocs/compta/bank/fiche.php b/htdocs/compta/bank/fiche.php index 2a20706fd7c..8a97e75ddf1 100644 --- a/htdocs/compta/bank/fiche.php +++ b/htdocs/compta/bank/fiche.php @@ -256,7 +256,7 @@ if ($action == 'create') print ''; $selectedcode=$account->account_currency_code; if (! $selectedcode) $selectedcode=$conf->currency; - $form->select_currency((isset($_POST["account_currency_code"])?$_POST["account_currency_code"]:$selectedcode), 'account_currency_code'); + print $form->selectCurrency((isset($_POST["account_currency_code"])?$_POST["account_currency_code"]:$selectedcode), 'account_currency_code'); //print $langs->trans("Currency".$conf->currency); //print ''; print ''; @@ -374,7 +374,7 @@ else if ($action == 'delete') { print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$account->id,$langs->trans("DeleteAccount"),$langs->trans("ConfirmDeleteAccount"),"confirm_delete"); - + } print ''; @@ -531,7 +531,7 @@ else print ''; diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 6b73b7ba53a..86bc2768840 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -793,7 +793,7 @@ class Form } $sql.=$this->db->order("nom","ASC"); if ($limit > 0) $sql.=$this->db->plimit($limit); - + dol_syslog(get_class($this)."::select_thirdparty_list sql=".$sql); $resql=$this->db->query($sql); if ($resql) @@ -1341,7 +1341,7 @@ class Form $sql.=' ,pcp.rowid as idprodcustprice, pcp.price as custprice, pcp.price_ttc as custprice_ttc,'; $sql.=' pcp.price_base_type as custprice_base_type, pcp.tva_tx as custtva_tx'; } - + // Multilang : we add translation if (! empty($conf->global->MAIN_MULTILANGS)) { @@ -1617,12 +1617,12 @@ class Form $opt.=" - ".$langs->trans("Discount")." : ".vatrate($objp->remise_percent).' %'; $outval.=" - ".$langs->transnoentities("Discount")." : ".vatrate($objp->remise_percent).' %'; } - + //Price by customer if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { if (!empty($objp->idprodcustprice)) { $found = 1; - + if ($objp->custprice_base_type == 'HT') { $opt.= price($objp->custprice,1).' '.$currencytext.' '.$langs->trans("HT"); @@ -1633,7 +1633,7 @@ class Form $opt.= price($objp->custprice_ttc,1).' '.$currencytext.' '.$langs->trans("TTC"); $outval.= price($objp->custprice_ttc,1).' '.$currencytextnoent.' '.$langs->transnoentities("TTC"); } - + $outprice_ht=price($objp->custprice); $outprice_ttc=price($objp->custprice_ttc); $outpricebasetype=$objp->custprice_base_type; @@ -2124,7 +2124,7 @@ class Form * @param int $addempty Add empty entry * @return void */ - function select_availability($selected='',$htmlname='availid',$filtertype='',$addempty=0) + function selectAvailabilityDelay($selected='',$htmlname='availid',$filtertype='',$addempty=0) { global $langs,$user; @@ -2154,7 +2154,7 @@ class Form * * @return int Nb of lines loaded, 0 if already loaded, <0 if ko */ - function load_cache_demand_reason() + function loadCacheInputReason() { global $langs; @@ -2164,7 +2164,7 @@ class Form $sql.= " FROM ".MAIN_DB_PREFIX.'c_input_reason'; $sql.= " WHERE active=1"; $sql.= " ORDER BY rowid"; - dol_syslog(get_class($this)."::load_cache_demand_reason sql=".$sql,LOG_DEBUG); + dol_syslog(get_class($this)."::loadCacheInputReason sql=".$sql,LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -2194,19 +2194,20 @@ class Form } /** - * Return list of events that triggered an object creation + * Return list of input reason (events that triggered an object creation, like after sending an emailing, making an advert, ...) + * List found into table c_input_reason loaded by loadCacheInputReason * - * @param int $selected Id or code of type origin to select by default - * @param string $htmlname Nom de la zone select - * @param string $exclude To exclude a code value (Example: SRC_PROP) - * @param int $addempty Add an empty entry - * @return void + * @param int $selected Id or code of type origin to select by default + * @param string $htmlname Nom de la zone select + * @param string $exclude To exclude a code value (Example: SRC_PROP) + * @param int $addempty Add an empty entry + * @return void */ - function select_demand_reason($selected='',$htmlname='demandreasonid',$exclude='',$addempty=0) + function selectInputReason($selected='',$htmlname='demandreasonid',$exclude='',$addempty=0) { global $langs,$user; - $this->load_cache_demand_reason(); + $this->loadCacheInputReason(); print ''; print '
'; $selectedcode=$account->account_currency_code; if (! $selectedcode) $selectedcode=$conf->currency; - $form->select_currency((isset($_POST["account_currency_code"])?$_POST["account_currency_code"]:$selectedcode), 'account_currency_code'); + print $form->selectCurrency((isset($_POST["account_currency_code"])?$_POST["account_currency_code"]:$selectedcode), 'account_currency_code'); //print $langs->trans("Currency".$conf->currency); //print ''; print '
'; print ''; print ''; print '
'; - $this->select_availability($selected,$htmlname,-1,$addempty); + $this->selectAvailabilityDelay($selected,$htmlname,-1,$addempty); print '
'; @@ -2922,7 +2923,8 @@ class Form } /** - * Show a select form to select origin + * Output HTML form to select list of input reason (events that triggered an object creation, like after sending an emailing, making an advert, ...) + * List found into table c_input_reason loaded by loadCacheInputReason * * @param string $page Page * @param string $selected Id condition pre-selectionne @@ -2930,7 +2932,7 @@ class Form * @param int $addempty Add empty entry * @return void */ - function form_demand_reason($page, $selected='', $htmlname='demandreason', $addempty=0) + function formInputReason($page, $selected='', $htmlname='demandreason', $addempty=0) { global $langs; if ($htmlname != "none") @@ -2940,7 +2942,7 @@ class Form print ''; print ''; print ''; print ''; print '
'; - $this->select_demand_reason($selected,$htmlname,-1,$addempty); + $this->selectInputReason($selected,$htmlname,-1,$addempty); print '
'; @@ -2949,7 +2951,7 @@ class Form { if ($selected) { - $this->load_cache_demand_reason(); + $this->loadCacheInputReason(); foreach ($this->cache_demand_reason as $key => $val) { if ($val['id'] == $selected) @@ -3256,7 +3258,7 @@ class Form * @param string $htmlname name of HTML select list * @return void */ - function selectcurrency($selected='',$htmlname='currency_id') + function selectCurrency($selected='',$htmlname='currency_id') { global $conf,$langs,$user; @@ -3519,7 +3521,7 @@ class Form if($m == '') $m=0; if($empty == '') $empty=0; - if ($set_time === '' && $empty == 0) + if ($set_time === '' && $empty == 0) { include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; $set_time = dol_now('tzuser')-(getServerTimeZoneInt('now')*3600); // set_time must be relative to PHP server timezone diff --git a/htdocs/core/class/html.formorder.class.php b/htdocs/core/class/html.formorder.class.php index 8a85d0654e6..9dd31651d86 100644 --- a/htdocs/core/class/html.formorder.class.php +++ b/htdocs/core/class/html.formorder.class.php @@ -23,8 +23,8 @@ /** - * Classe permettant la generation de composants html - * Only common components are here. + * Class to manage HTML output components for orders + * Before adding component here, check they are not into common part Form.class.php */ class FormOrder { @@ -45,8 +45,7 @@ class FormOrder } - - /** + /** * Return combo list of differents status of a orders * * @param string $selected Preselected value @@ -58,7 +57,7 @@ class FormOrder print ''; } - + /** * Return list of way to order - * + * * @param string $selected Id of preselected order origin * @param string $htmlname Name of HTML select list * @param int $addempty 0=liste sans valeur nulle, 1=ajoute valeur inconnue @@ -96,17 +95,18 @@ class FormOrder /** - * Return list of way to order + * Return list of input method (mode used to receive order, like order received by email, fax, online) + * List found into table c_input_method * * @param string $selected Id of preselected input method * @param string $htmlname Name of HTML select list - * @param int $addempty 0=liste sans valeur nulle, 1=ajoute valeur inconnue + * @param int $addempty 0=list with no empty value, 1=list with empty value * @return array Tableau des sources de commandes */ - function select_methodes_commande($selected='',$htmlname='source_id',$addempty=0) + function selectInputMethod($selected='',$htmlname='source_id',$addempty=0) { global $conf,$langs; - $listemethodes=array(); + $listofmethods=array(); require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php'; $form=new Form($this->db); @@ -115,7 +115,7 @@ class FormOrder $sql.= " FROM ".MAIN_DB_PREFIX."c_input_method"; $sql.= " WHERE active = 1"; - dol_syslog(get_class($this)."::select_methodes_commande sql=".$sql); + dol_syslog(get_class($this)."::selectInputMethod sql=".$sql); $resql=$this->db->query($sql); if ($resql) { @@ -124,7 +124,7 @@ class FormOrder while ($i < $num) { $obj = $this->db->fetch_object($resql); - $listemethodes[$obj->rowid] = $langs->trans($obj->code)!=$obj->code?$langs->trans($obj->code):$obj->label; + $listofmethods[$obj->rowid] = $langs->trans($obj->code)!=$obj->code?$langs->trans($obj->code):$obj->label; $i++; } } @@ -134,10 +134,10 @@ class FormOrder return -1; } - print $form->selectarray($htmlname,$listemethodes,$selected,$addempty); + print $form->selectarray($htmlname,$listofmethods,$selected,$addempty); return 1; } } -?> +?> \ No newline at end of file diff --git a/htdocs/fourn/commande/fiche.php b/htdocs/fourn/commande/fiche.php index 66faa6bcab4..e0ecec84b2b 100644 --- a/htdocs/fourn/commande/fiche.php +++ b/htdocs/fourn/commande/fiche.php @@ -192,7 +192,7 @@ else if ($action == 'addline' && $user->rights->fournisseur->commande->creer) } if (GETPOST('addline_predefined') || (! GETPOST('dp_desc') && ! GETPOST('addline_predefined') && GETPOST('idprod', 'int')>0) // we push enter onto qty field - ) + ) { $predef= '_predef'; $idprod=GETPOST('idprod', 'int'); @@ -214,7 +214,7 @@ else if ($action == 'addline' && $user->rights->fournisseur->commande->creer) } if (! GETPOST('addline_predefined') && ( GETPOST('pu')==='')) // Unit price can be 0 but not '' { - + setEventMessage($langs->trans($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('UnitPrice'))), 'errors'); $error++; } @@ -1987,7 +1987,7 @@ elseif (! empty($object->id)) print ''; print ''.$langs->trans("OrderMode").''; - $formorder->select_methodes_commande(GETPOST('methodecommande'), "methodecommande", 1); + $formorder->selectInputMethod(GETPOST('methodecommande'), "methodecommande", 1); print ''; print ''.$langs->trans("Comment").''; diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php index a4d7ad03c06..f696326a6f3 100644 --- a/htdocs/product/fournisseurs.php +++ b/htdocs/product/fournisseurs.php @@ -77,7 +77,7 @@ if (! $sortorder) $sortorder="ASC"; /* * Actions */ - + $parameters=array('socid'=>$socid, 'id_prod'=>$id); $reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks $error=$hookmanager->error; $errors=array_merge($errors, (array) $hookmanager->errors); @@ -330,7 +330,7 @@ if ($id || $ref) { $langs->load("propal"); print ''.$langs->trans("Availability").''; - $form->select_availability($product->fk_availability,"oselDispo",1); + $form->selectAvailabilityDelay($product->fk_availability,"oselDispo",1); print ''."\n"; } @@ -394,7 +394,7 @@ if ($id || $ref) print ''; print ''; } - + if (is_object($hookmanager)) { $parameters=array('id_fourn'=>$id_fourn,'prod_id'=>$product->id); @@ -522,7 +522,7 @@ if ($id || $ref) print $productfourn->fourn_unitcharges?price($productfourn->fourn_unitcharges) : ($productfourn->fourn_qty?price($productfourn->fourn_charges/$productfourn->fourn_qty):" "); print ''; } - + if (is_object($hookmanager)) { $parameters=array('id_pfp'=>$productfourn->product_fourn_price_id,'id_fourn'=>$id_fourn,'prod_id'=>$product->id);