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
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().

View File

@ -305,7 +305,7 @@ if ($action == 'edit' || $action == 'updateedit')
$var=!$var;
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";
$var=!$var;
@ -381,7 +381,7 @@ if ($action == 'edit' || $action == 'updateedit')
$var=!$var;
print '<tr '.$bc[$var].'><td width="35%">'.$langs->trans("ManagingDirectors").'</td><td>';
print '<input name="MAIN_INFO_SOCIETE_MANAGERS" size="80" value="' . $conf->global->MAIN_INFO_SOCIETE_MANAGERS . '"></td></tr>';
// Capital
$var=!$var;
print '<tr '.$bc[$var].'><td width="35%">'.$langs->trans("Capital").'</td><td>';
@ -746,7 +746,7 @@ else
$var=!$var;
print '<tr '.$bc[$var].'><td width="35%">'.$langs->trans("ManagingDirectors").'</td><td>';
print $conf->global->MAIN_INFO_SOCIETE_MANAGERS . '</td></tr>';
// Capital
$var=!$var;
print '<tr '.$bc[$var].'><td width="35%">'.$langs->trans("Capital").'</td><td>';

View File

@ -1187,12 +1187,12 @@ if ($action == 'create') {
// What trigger creation
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>';
// Delivery delay
print '<tr><td>' . $langs->trans('AvailabilityPeriod') . '</td><td colspan="2">';
$form->select_availability('', 'availability_id', '', 1);
$form->selectAvailabilityDelay('', 'availability_id', '', 1);
print '</td></tr>';
// 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 '</tr></table>';
print '</td><td colspan="3">';
// 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 '</td>';
print '</tr>';

View File

@ -1446,12 +1446,12 @@ if ($action == 'create' && $user->rights->commande->creer) {
// Delivery delay
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>';
// What trigger creation
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>';
// Project
@ -1929,9 +1929,9 @@ if ($action == 'create' && $user->rights->commande->creer) {
print '</tr></table>';
print '</td><td colspan="3">';
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.

View File

@ -256,7 +256,7 @@ if ($action == 'create')
print '<td colspan="3">';
$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 '<input type="hidden" name="account_currency_code" value="'.$conf->currency.'">';
print '</td></tr>';
@ -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 '<table class="border" width="100%">';
@ -531,7 +531,7 @@ else
print '<td colspan="3">';
$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 '<input type="hidden" name="account_currency_code" value="'.$conf->currency.'">';
print '</td></tr>';

View File

@ -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 '<select class="flat" name="'.$htmlname.'">';
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 '<table class="nobordernopadding" cellpadding="0" cellspacing="0">';
print '<tr><td>';
$this->select_availability($selected,$htmlname,-1,$addempty);
$this->selectAvailabilityDelay($selected,$htmlname,-1,$addempty);
print '</td>';
print '<td align="left"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td>';
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 $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 '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<table class="nobordernopadding" cellpadding="0" cellspacing="0">';
print '<tr><td>';
$this->select_demand_reason($selected,$htmlname,-1,$addempty);
$this->selectInputReason($selected,$htmlname,-1,$addempty);
print '</td>';
print '<td align="left"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td>';
print '</tr></table></form>';
@ -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

View File

@ -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 '<select class="flat" name="'.$hmlname.'">';
print '<option value="-1">&nbsp;</option>';
$statustohow=array(0,1,2,3,4,5,6,9); // 7 is same label than 6. 8 does not exist.
foreach($statustohow as $key)
{
print '<option value="'.$key.'"'.($selected == $key?' selected="selected"':'').'>';
@ -67,10 +66,10 @@ class FormOrder
}
print '</select>';
}
/**
* 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;
}
}
?>
?>

View File

@ -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 '</td></tr>';
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 '<tr><td>'.$langs->trans("Comment").'</td><td><input size="40" type="text" name="comment" value="'.GETPOST('comment').'"></td></tr>';

View File

@ -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 '<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";
}
@ -394,7 +394,7 @@ if ($id || $ref)
print '</td>';
print '</tr>';
}
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):"&nbsp;");
print '</td>';
}
if (is_object($hookmanager))
{
$parameters=array('id_pfp'=>$productfourn->product_fourn_price_id,'id_fourn'=>$id_fourn,'prod_id'=>$product->id);