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().
This commit is contained in:
Laurent Destailleur 2014-04-02 14:53:42 +02:00
parent 3a2caa6e64
commit 9a8a306d78
9 changed files with 64 additions and 62 deletions

View File

@ -75,7 +75,9 @@ Dolibarr better:
- The deprecated way (with 4 parameters) to declare a new tab into a module descriptor file has been - 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. 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. - 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().

View File

@ -305,7 +305,7 @@ if ($action == 'edit' || $action == 'updateedit')
$var=!$var; $var=!$var;
print '<tr '.$bc[$var].'><td>'.$langs->trans("CompanyCurrency").'</td><td>'; print '<tr '.$bc[$var].'><td>'.$langs->trans("CompanyCurrency").'</td><td>';
$form->select_currency($conf->currency,"currency"); print $form->selectCurrency($conf->currency,"currency");
print '</td></tr>'."\n"; print '</td></tr>'."\n";
$var=!$var; $var=!$var;

View File

@ -1187,12 +1187,12 @@ if ($action == 'create') {
// What trigger creation // What trigger creation
print '<tr><td>' . $langs->trans('Source') . '</td><td>'; print '<tr><td>' . $langs->trans('Source') . '</td><td>';
$form->select_demand_reason('', 'demand_reason_id', "SRC_PROP", 1); $form->selectInputReason('', 'demand_reason_id', "SRC_PROP", 1);
print '</td></tr>'; print '</td></tr>';
// Delivery delay // Delivery delay
print '<tr><td>' . $langs->trans('AvailabilityPeriod') . '</td><td colspan="2">'; print '<tr><td>' . $langs->trans('AvailabilityPeriod') . '</td><td colspan="2">';
$form->select_availability('', 'availability_id', '', 1); $form->selectAvailabilityDelay('', 'availability_id', '', 1);
print '</td></tr>'; print '</td></tr>';
// Delivery date (or manufacturing) // Delivery date (or manufacturing)
@ -1604,13 +1604,11 @@ if ($action == 'create') {
print '<td align="right"><a href="' . $_SERVER ["PHP_SELF"] . '?action=editdemandreason&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetDemandReason'), 1) . '</a></td>'; print '<td align="right"><a href="' . $_SERVER ["PHP_SELF"] . '?action=editdemandreason&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetDemandReason'), 1) . '</a></td>';
print '</tr></table>'; print '</tr></table>';
print '</td><td colspan="3">'; print '</td><td colspan="3">';
// print $object->demand_reason_id;
if ($action == 'editdemandreason') { 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 { } 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 '</td>'; print '</td>';
print '</tr>'; print '</tr>';

View File

@ -1446,12 +1446,12 @@ if ($action == 'create' && $user->rights->commande->creer) {
// Delivery delay // Delivery delay
print '<tr><td>' . $langs->trans('AvailabilityPeriod') . '</td><td colspan="2">'; print '<tr><td>' . $langs->trans('AvailabilityPeriod') . '</td><td colspan="2">';
$form->select_availability($availability_id, 'availability_id', '', 1); $form->selectAvailabilityDelay($availability_id, 'availability_id', '', 1);
print '</td></tr>'; print '</td></tr>';
// What trigger creation // What trigger creation
print '<tr><td>' . $langs->trans('Source') . '</td><td colspan="2">'; print '<tr><td>' . $langs->trans('Source') . '</td><td colspan="2">';
$form->select_demand_reason($demand_reason_id, 'demand_reason_id', '', 1); $form->selectInputReason($demand_reason_id, 'demand_reason_id', '', 1);
print '</td></tr>'; print '</td></tr>';
// Project // Project
@ -1929,9 +1929,9 @@ if ($action == 'create' && $user->rights->commande->creer) {
print '</tr></table>'; print '</tr></table>';
print '</td><td colspan="3">'; print '</td><td colspan="3">';
if ($action == 'editdemandreason') { 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 { } 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. // 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. // This is to avoid too heavy screens and have an uniform look and feel for all screens.

View File

@ -256,7 +256,7 @@ if ($action == 'create')
print '<td colspan="3">'; print '<td colspan="3">';
$selectedcode=$account->account_currency_code; $selectedcode=$account->account_currency_code;
if (! $selectedcode) $selectedcode=$conf->currency; 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 $langs->trans("Currency".$conf->currency);
//print '<input type="hidden" name="account_currency_code" value="'.$conf->currency.'">'; //print '<input type="hidden" name="account_currency_code" value="'.$conf->currency.'">';
print '</td></tr>'; print '</td></tr>';
@ -531,7 +531,7 @@ else
print '<td colspan="3">'; print '<td colspan="3">';
$selectedcode=$account->account_currency_code; $selectedcode=$account->account_currency_code;
if (! $selectedcode) $selectedcode=$conf->currency; 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 $langs->trans("Currency".$conf->currency);
//print '<input type="hidden" name="account_currency_code" value="'.$conf->currency.'">'; //print '<input type="hidden" name="account_currency_code" value="'.$conf->currency.'">';
print '</td></tr>'; print '</td></tr>';

View File

@ -2124,7 +2124,7 @@ class Form
* @param int $addempty Add empty entry * @param int $addempty Add empty entry
* @return void * @return void
*/ */
function select_availability($selected='',$htmlname='availid',$filtertype='',$addempty=0) function selectAvailabilityDelay($selected='',$htmlname='availid',$filtertype='',$addempty=0)
{ {
global $langs,$user; global $langs,$user;
@ -2154,7 +2154,7 @@ class Form
* *
* @return int Nb of lines loaded, 0 if already loaded, <0 if ko * @return int Nb of lines loaded, 0 if already loaded, <0 if ko
*/ */
function load_cache_demand_reason() function loadCacheInputReason()
{ {
global $langs; global $langs;
@ -2164,7 +2164,7 @@ class Form
$sql.= " FROM ".MAIN_DB_PREFIX.'c_input_reason'; $sql.= " FROM ".MAIN_DB_PREFIX.'c_input_reason';
$sql.= " WHERE active=1"; $sql.= " WHERE active=1";
$sql.= " ORDER BY rowid"; $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); $resql = $this->db->query($sql);
if ($resql) if ($resql)
{ {
@ -2194,7 +2194,8 @@ 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 int $selected Id or code of type origin to select by default
* @param string $htmlname Nom de la zone select * @param string $htmlname Nom de la zone select
@ -2202,11 +2203,11 @@ class Form
* @param int $addempty Add an empty entry * @param int $addempty Add an empty entry
* @return void * @return void
*/ */
function select_demand_reason($selected='',$htmlname='demandreasonid',$exclude='',$addempty=0) function selectInputReason($selected='',$htmlname='demandreasonid',$exclude='',$addempty=0)
{ {
global $langs,$user; global $langs,$user;
$this->load_cache_demand_reason(); $this->loadCacheInputReason();
print '<select class="flat" name="'.$htmlname.'">'; print '<select class="flat" name="'.$htmlname.'">';
if ($addempty) print '<option value="0"'.(empty($selected)?' selected="selected"':'').'>&nbsp;</option>'; if ($addempty) print '<option value="0"'.(empty($selected)?' selected="selected"':'').'>&nbsp;</option>';
@ -2904,7 +2905,7 @@ class Form
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<table class="nobordernopadding" cellpadding="0" cellspacing="0">'; print '<table class="nobordernopadding" cellpadding="0" cellspacing="0">';
print '<tr><td>'; print '<tr><td>';
$this->select_availability($selected,$htmlname,-1,$addempty); $this->selectAvailabilityDelay($selected,$htmlname,-1,$addempty);
print '</td>'; print '</td>';
print '<td align="left"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td>'; print '<td align="left"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td>';
print '</tr></table></form>'; print '</tr></table></form>';
@ -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 $page Page
* @param string $selected Id condition pre-selectionne * @param string $selected Id condition pre-selectionne
@ -2930,7 +2932,7 @@ class Form
* @param int $addempty Add empty entry * @param int $addempty Add empty entry
* @return void * @return void
*/ */
function form_demand_reason($page, $selected='', $htmlname='demandreason', $addempty=0) function formInputReason($page, $selected='', $htmlname='demandreason', $addempty=0)
{ {
global $langs; global $langs;
if ($htmlname != "none") if ($htmlname != "none")
@ -2940,7 +2942,7 @@ class Form
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<table class="nobordernopadding" cellpadding="0" cellspacing="0">'; print '<table class="nobordernopadding" cellpadding="0" cellspacing="0">';
print '<tr><td>'; print '<tr><td>';
$this->select_demand_reason($selected,$htmlname,-1,$addempty); $this->selectInputReason($selected,$htmlname,-1,$addempty);
print '</td>'; print '</td>';
print '<td align="left"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td>'; print '<td align="left"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td>';
print '</tr></table></form>'; print '</tr></table></form>';
@ -2949,7 +2951,7 @@ class Form
{ {
if ($selected) if ($selected)
{ {
$this->load_cache_demand_reason(); $this->loadCacheInputReason();
foreach ($this->cache_demand_reason as $key => $val) foreach ($this->cache_demand_reason as $key => $val)
{ {
if ($val['id'] == $selected) if ($val['id'] == $selected)
@ -3256,7 +3258,7 @@ class Form
* @param string $htmlname name of HTML select list * @param string $htmlname name of HTML select list
* @return void * @return void
*/ */
function selectcurrency($selected='',$htmlname='currency_id') function selectCurrency($selected='',$htmlname='currency_id')
{ {
global $conf,$langs,$user; global $conf,$langs,$user;

View File

@ -23,8 +23,8 @@
/** /**
* Classe permettant la generation de composants html * Class to manage HTML output components for orders
* Only common components are here. * Before adding component here, check they are not into common part Form.class.php
*/ */
class FormOrder class FormOrder
{ {
@ -45,7 +45,6 @@ class FormOrder
} }
/** /**
* Return combo list of differents status of a orders * Return combo list of differents status of a orders
* *
@ -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 $selected Id of preselected input method
* @param string $htmlname Name of HTML select list * @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 * @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; global $conf,$langs;
$listemethodes=array(); $listofmethods=array();
require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
$form=new Form($this->db); $form=new Form($this->db);
@ -115,7 +115,7 @@ class FormOrder
$sql.= " FROM ".MAIN_DB_PREFIX."c_input_method"; $sql.= " FROM ".MAIN_DB_PREFIX."c_input_method";
$sql.= " WHERE active = 1"; $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); $resql=$this->db->query($sql);
if ($resql) if ($resql)
{ {
@ -124,7 +124,7 @@ class FormOrder
while ($i < $num) while ($i < $num)
{ {
$obj = $this->db->fetch_object($resql); $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++; $i++;
} }
} }
@ -134,7 +134,7 @@ class FormOrder
return -1; return -1;
} }
print $form->selectarray($htmlname,$listemethodes,$selected,$addempty); print $form->selectarray($htmlname,$listofmethods,$selected,$addempty);
return 1; return 1;
} }

View File

@ -1987,7 +1987,7 @@ elseif (! empty($object->id))
print '</td></tr>'; print '</td></tr>';
print '<tr><td>'.$langs->trans("OrderMode").'</td><td>'; print '<tr><td>'.$langs->trans("OrderMode").'</td><td>';
$formorder->select_methodes_commande(GETPOST('methodecommande'), "methodecommande", 1); $formorder->selectInputMethod(GETPOST('methodecommande'), "methodecommande", 1);
print '</td></tr>'; print '</td></tr>';
print '<tr><td>'.$langs->trans("Comment").'</td><td><input size="40" type="text" name="comment" value="'.GETPOST('comment').'"></td></tr>'; print '<tr><td>'.$langs->trans("Comment").'</td><td><input size="40" type="text" name="comment" value="'.GETPOST('comment').'"></td></tr>';

View File

@ -330,7 +330,7 @@ if ($id || $ref)
{ {
$langs->load("propal"); $langs->load("propal");
print '<tr><td>'.$langs->trans("Availability").'</td><td>'; print '<tr><td>'.$langs->trans("Availability").'</td><td>';
$form->select_availability($product->fk_availability,"oselDispo",1); $form->selectAvailabilityDelay($product->fk_availability,"oselDispo",1);
print '</td></tr>'."\n"; print '</td></tr>'."\n";
} }