Merge remote-tracking branch 'origin/3.5' into develop
Conflicts: htdocs/core/class/extrafields.class.php
This commit is contained in:
commit
860ca15cfc
@ -74,6 +74,10 @@ Fix: Page load not ending when large number of thirdparies. We
|
|||||||
combo feature that is root cause of problem.
|
combo feature that is root cause of problem.
|
||||||
Fix: [ bug #1231 ] PDF always generated in interventions
|
Fix: [ bug #1231 ] PDF always generated in interventions
|
||||||
Fix: Be sure there is no duplicate default rib.
|
Fix: Be sure there is no duplicate default rib.
|
||||||
|
Fix: Enable extrafields for customer order, proposal and invoice lines. This feature
|
||||||
|
was developed for 3.5 but was disabled (hidden) because of a bug not possible to
|
||||||
|
fix enough quickly for 3.5.0 release.
|
||||||
|
Fix: user right on Holiday for month report nor working.
|
||||||
|
|
||||||
***** ChangeLog for 3.5 compared to 3.4.* *****
|
***** ChangeLog for 3.5 compared to 3.4.* *****
|
||||||
For users:
|
For users:
|
||||||
|
|||||||
@ -65,6 +65,21 @@ if (! empty($conf->stock->enabled) && $conf->global->STOCK_CALCULATE_ON_BILL &&
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If stock decrease on bill validation, check user has stock edit permissions
|
||||||
|
if (! empty($conf->stock->enabled) && $conf->global->STOCK_CALCULATE_ON_BILL && ! empty($username))
|
||||||
|
{
|
||||||
|
$testuser=new User($db);
|
||||||
|
$testuser->fetch(0,$username);
|
||||||
|
$testuser->getrights('stock');
|
||||||
|
if (empty($testuser->rights->stock->creer))
|
||||||
|
{
|
||||||
|
$retour=$langs->trans("UserNeedPermissionToEditStockToUsePos");
|
||||||
|
header('Location: '.DOL_URL_ROOT.'/cashdesk/index.php?err='.urlencode($retour).'&user='.$username.'&socid='.$thirdpartyid.'&warehouseid='.$warehouseid.'&bankid_cash='.$bankid_cash.'&bankid_cheque='.$bankid_cheque.'&bankid_cb='.$bankid_cb);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
if (! empty($_POST['txtUsername']) && ! empty($conf->banque->enabled) && (empty($conf_fkaccount_cash) && empty($conf_fkaccount_cheque) && empty($conf_fkaccount_cb)))
|
if (! empty($_POST['txtUsername']) && ! empty($conf->banque->enabled) && (empty($conf_fkaccount_cash) && empty($conf_fkaccount_cheque) && empty($conf_fkaccount_cb)))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -657,7 +657,7 @@ else if (($action == 'addline' || $action == 'addline_predef') && $user->rights-
|
|||||||
//Extrafields
|
//Extrafields
|
||||||
$extrafieldsline = new ExtraFields($db);
|
$extrafieldsline = new ExtraFields($db);
|
||||||
$extralabelsline =$extrafieldsline->fetch_name_optionals_label($object->table_element_line);
|
$extralabelsline =$extrafieldsline->fetch_name_optionals_label($object->table_element_line);
|
||||||
$array_option = $extrafieldsline->getOptionalsFromPost($extralabelsline);
|
$array_option = $extrafieldsline->getOptionalsFromPost($extralabelsline,$predef);
|
||||||
//Unset extrafield
|
//Unset extrafield
|
||||||
if (is_array($extralabelsline))
|
if (is_array($extralabelsline))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -591,7 +591,7 @@ else if ($action == 'addline' && $user->rights->commande->creer)
|
|||||||
//Extrafields
|
//Extrafields
|
||||||
$extrafieldsline = new ExtraFields($db);
|
$extrafieldsline = new ExtraFields($db);
|
||||||
$extralabelsline =$extrafieldsline->fetch_name_optionals_label($object->table_element_line);
|
$extralabelsline =$extrafieldsline->fetch_name_optionals_label($object->table_element_line);
|
||||||
$array_option = $extrafieldsline->getOptionalsFromPost($extralabelsline);
|
$array_option = $extrafieldsline->getOptionalsFromPost($extralabelsline,$predef);
|
||||||
//Unset extrafield
|
//Unset extrafield
|
||||||
if (is_array($extralabelsline))
|
if (is_array($extralabelsline))
|
||||||
{
|
{
|
||||||
@ -605,12 +605,12 @@ else if ($action == 'addline' && $user->rights->commande->creer)
|
|||||||
if ((empty($idprod) || GETPOST('usenewaddlineform')) && ($price_ht < 0) && ($qty < 0))
|
if ((empty($idprod) || GETPOST('usenewaddlineform')) && ($price_ht < 0) && ($qty < 0))
|
||||||
{
|
{
|
||||||
setEventMessage($langs->trans('ErrorBothFieldCantBeNegative', $langs->transnoentitiesnoconv('UnitPriceHT'), $langs->transnoentitiesnoconv('Qty')), 'errors');
|
setEventMessage($langs->trans('ErrorBothFieldCantBeNegative', $langs->transnoentitiesnoconv('UnitPriceHT'), $langs->transnoentitiesnoconv('Qty')), 'errors');
|
||||||
$error = true;
|
$error++;
|
||||||
}
|
}
|
||||||
if (empty($idprod) && GETPOST('type') < 0)
|
if (empty($idprod) && GETPOST('type') < 0)
|
||||||
{
|
{
|
||||||
setEventMessage($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Type')), 'errors');
|
setEventMessage($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Type')), 'errors');
|
||||||
$error = true;
|
$error++;
|
||||||
}
|
}
|
||||||
if ((empty($idprod) || GETPOST('usenewaddlineform')) && (!($price_ht >= 0) || $price_ht == '')) // Unit price can be 0 but not ''
|
if ((empty($idprod) || GETPOST('usenewaddlineform')) && (!($price_ht >= 0) || $price_ht == '')) // Unit price can be 0 but not ''
|
||||||
{
|
{
|
||||||
@ -620,12 +620,12 @@ else if ($action == 'addline' && $user->rights->commande->creer)
|
|||||||
if ($qty == '')
|
if ($qty == '')
|
||||||
{
|
{
|
||||||
setEventMessage($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Qty')), 'errors');
|
setEventMessage($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Qty')), 'errors');
|
||||||
$error = true;
|
$error++;
|
||||||
}
|
}
|
||||||
if (empty($idprod) && empty($product_desc))
|
if (empty($idprod) && empty($product_desc))
|
||||||
{
|
{
|
||||||
setEventMessage($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Description')), 'errors');
|
setEventMessage($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Description')), 'errors');
|
||||||
$error = true;
|
$error++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error && ($qty >= 0) && (! empty($product_desc) || ! empty($idprod)))
|
if (! $error && ($qty >= 0) && (! empty($product_desc) || ! empty($idprod)))
|
||||||
|
|||||||
@ -1147,13 +1147,13 @@ else if (($action == 'addline' || $action == 'addline_predef') && $user->rights-
|
|||||||
//Extrafields
|
//Extrafields
|
||||||
$extrafieldsline = new ExtraFields($db);
|
$extrafieldsline = new ExtraFields($db);
|
||||||
$extralabelsline =$extrafieldsline->fetch_name_optionals_label($object->table_element_line);
|
$extralabelsline =$extrafieldsline->fetch_name_optionals_label($object->table_element_line);
|
||||||
$array_option = $extrafieldsline->getOptionalsFromPost($extralabelsline);
|
$array_option = $extrafieldsline->getOptionalsFromPost($extralabelsline,$predef);
|
||||||
//Unset extrafield
|
//Unset extrafield
|
||||||
if (is_array($extralabelsline))
|
if (is_array($extralabelsline))
|
||||||
{
|
{
|
||||||
// Get extra fields
|
// Get extra fields
|
||||||
foreach ($extralabelsline as $key => $value) {
|
foreach ($extralabelsline as $key => $value) {
|
||||||
unset($_POST["options_".$key]);
|
unset($_POST["options_".$key.$predef]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -2268,13 +2268,14 @@ abstract class CommonObject
|
|||||||
/**
|
/**
|
||||||
* Function to show lines of extrafields with output datas
|
* Function to show lines of extrafields with output datas
|
||||||
*
|
*
|
||||||
* @param object $extrafields extrafield Object
|
* @param object $extrafields Extrafield Object
|
||||||
* @param string $mode Show output (view) or input (edit) for extrafield
|
* @param string $mode Show output (view) or input (edit) for extrafield
|
||||||
* @param array $params optionnal parameters
|
* @param array $params Optionnal parameters
|
||||||
|
* @param string $keyprefix Prefix string to add into name and id of field (can be used to avoid duplicate names)
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function showOptionals($extrafields,$mode='view',$params=0)
|
function showOptionals($extrafields, $mode='view', $params=0, $keyprefix='')
|
||||||
{
|
{
|
||||||
global $_POST;
|
global $_POST;
|
||||||
|
|
||||||
@ -2342,7 +2343,7 @@ abstract class CommonObject
|
|||||||
$out .= $extrafields->showOutputField($key,$value);
|
$out .= $extrafields->showOutputField($key,$value);
|
||||||
break;
|
break;
|
||||||
case "edit":
|
case "edit":
|
||||||
$out .= $extrafields->showInputField($key,$value);
|
$out .= $extrafields->showInputField($key,$value,'',$keyprefix);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -576,9 +576,10 @@ class ExtraFields
|
|||||||
* @param string $key Key of attribute
|
* @param string $key Key of attribute
|
||||||
* @param string $value Value to show (for date type it must be in timestamp format)
|
* @param string $value Value to show (for date type it must be in timestamp format)
|
||||||
* @param string $moreparam To add more parametes on html input tag
|
* @param string $moreparam To add more parametes on html input tag
|
||||||
|
* @param string $keyprefix Prefix string to add into name and id of field (can be used to avoid duplicate names)
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function showInputField($key,$value,$moreparam='')
|
function showInputField($key,$value,$moreparam='',$keyprefix='')
|
||||||
{
|
{
|
||||||
global $conf,$langs;
|
global $conf,$langs;
|
||||||
|
|
||||||
@ -620,23 +621,23 @@ class ExtraFields
|
|||||||
if(!$required && $value == '')
|
if(!$required && $value == '')
|
||||||
$value = '-1';
|
$value = '-1';
|
||||||
|
|
||||||
$out = $formstat->select_date($value, 'options_'.$key, $showtime, $showtime, $required, '', 1, 1, 1, 0, 1);
|
$out = $formstat->select_date($value, 'options_'.$key.$keyprefix, $showtime, $showtime, $required, '', 1, 1, 1, 0, 1);
|
||||||
//$out='<input type="text" name="options_'.$key.'" size="'.$showsize.'" maxlength="'.$newsize.'" value="'.$value.'"'.($moreparam?$moreparam:'').'>';
|
// TODO Missing to add $moreparam
|
||||||
}
|
}
|
||||||
elseif (in_array($type,array('int')))
|
elseif (in_array($type,array('int')))
|
||||||
{
|
{
|
||||||
$tmp=explode(',',$size);
|
$tmp=explode(',',$size);
|
||||||
$newsize=$tmp[0];
|
$newsize=$tmp[0];
|
||||||
$out='<input type="text" class="flat" name="options_'.$key.'" size="'.$showsize.'" maxlength="'.$newsize.'" value="'.$value.'"'.($moreparam?$moreparam:'').'>';
|
$out='<input type="text" class="flat" name="options_'.$key.$keyprefix.'" size="'.$showsize.'" maxlength="'.$newsize.'" value="'.$value.'"'.($moreparam?$moreparam:'').'>';
|
||||||
}
|
}
|
||||||
elseif ($type == 'varchar')
|
elseif ($type == 'varchar')
|
||||||
{
|
{
|
||||||
$out='<input type="text" class="flat" name="options_'.$key.'" size="'.$showsize.'" maxlength="'.$size.'" value="'.$value.'"'.($moreparam?$moreparam:'').'>';
|
$out='<input type="text" class="flat" name="options_'.$key.$keyprefix.'" size="'.$showsize.'" maxlength="'.$size.'" value="'.$value.'"'.($moreparam?$moreparam:'').'>';
|
||||||
}
|
}
|
||||||
elseif ($type == 'text')
|
elseif ($type == 'text')
|
||||||
{
|
{
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||||
$doleditor=new DolEditor('options_'.$key,$value,'',200,'dolibarr_notes','In',false,false,! empty($conf->fckeditor->enabled) && $conf->global->FCKEDITOR_ENABLE_SOCIETE,5,100);
|
$doleditor=new DolEditor('options_'.$key.$keyprefix,$value,'',200,'dolibarr_notes','In',false,false,! empty($conf->fckeditor->enabled) && $conf->global->FCKEDITOR_ENABLE_SOCIETE,5,100);
|
||||||
$out=$doleditor->Create(1);
|
$out=$doleditor->Create(1);
|
||||||
}
|
}
|
||||||
elseif ($type == 'boolean')
|
elseif ($type == 'boolean')
|
||||||
@ -647,36 +648,36 @@ class ExtraFields
|
|||||||
} else {
|
} else {
|
||||||
$checked=' value="1" ';
|
$checked=' value="1" ';
|
||||||
}
|
}
|
||||||
$out='<input type="checkbox" class="flat" name="options_'.$key.'" '.$checked.' '.($moreparam?$moreparam:'').'>';
|
$out='<input type="checkbox" class="flat" name="options_'.$key.$keyprefix.'" '.$checked.' '.($moreparam?$moreparam:'').'>';
|
||||||
}
|
}
|
||||||
elseif ($type == 'mail')
|
elseif ($type == 'mail')
|
||||||
{
|
{
|
||||||
$out='<input type="text" class="flat" name="options_'.$key.'" size="32" value="'.$value.'">';
|
$out='<input type="text" class="flat" name="options_'.$key.$keyprefix.'" size="32" value="'.$value.'" '.($moreparam?$moreparam:'').'>';
|
||||||
}
|
}
|
||||||
elseif ($type == 'phone')
|
elseif ($type == 'phone')
|
||||||
{
|
{
|
||||||
$out='<input type="text" class="flat" name="options_'.$key.'" size="20" value="'.$value.'">';
|
$out='<input type="text" class="flat" name="options_'.$key.$keyprefix.'" size="20" value="'.$value.'" '.($moreparam?$moreparam:'').'>';
|
||||||
}
|
}
|
||||||
elseif ($type == 'price')
|
elseif ($type == 'price')
|
||||||
{
|
{
|
||||||
$out='<input type="text" class="flat" name="options_'.$key.'" size="6" value="'.price($value).'"> '.$langs->getCurrencySymbol($conf->currency);
|
$out='<input type="text" class="flat" name="options_'.$key.$keyprefix.'" size="6" value="'.price($value).'" '.($moreparam?$moreparam:'').'> '.$langs->getCurrencySymbol($conf->currency);
|
||||||
}
|
}
|
||||||
elseif ($type == 'double')
|
elseif ($type == 'double')
|
||||||
{
|
{
|
||||||
if (!empty($value)) {
|
if (!empty($value)) {
|
||||||
$value=price($value);
|
$value=price($value);
|
||||||
}
|
}
|
||||||
$out='<input type="text" class="flat" name="options_'.$key.'" size="6" value="'.$value.'"> ';
|
$out='<input type="text" class="flat" name="options_'.$key.$keyprefix.'" size="6" value="'.$value.'" '.($moreparam?$moreparam:'').'> ';
|
||||||
}
|
}
|
||||||
elseif ($type == 'select')
|
elseif ($type == 'select')
|
||||||
{
|
{
|
||||||
$out = '';
|
$out = '';
|
||||||
if ($conf->use_javascript_ajax && $conf->global->COMPANY_USE_SEARCH_TO_SELECT && ! $forcecombo)
|
if ($conf->use_javascript_ajax && $conf->global->COMPANY_USE_SEARCH_TO_SELECT && ! $forcecombo)
|
||||||
{
|
{
|
||||||
$out.= ajax_combobox('options_'.$key, $event, $conf->global->COMPANY_USE_SEARCH_TO_SELECT);
|
$out.= ajax_combobox('options_'.$key.$keyprefix, $event, $conf->global->COMPANY_USE_SEARCH_TO_SELECT);
|
||||||
}
|
}
|
||||||
|
|
||||||
$out.='<select class="flat" name="options_'.$key.'" id="options_'.$key.'">';
|
$out.='<select class="flat" name="options_'.$key.$keyprefix.'" id="options_'.$key.$keyprefix.'" '.($moreparam?$moreparam:'').'>';
|
||||||
foreach ($param['options'] as $key=>$val )
|
foreach ($param['options'] as $key=>$val )
|
||||||
{
|
{
|
||||||
list($val, $parent) = explode('|', $val);
|
list($val, $parent) = explode('|', $val);
|
||||||
@ -692,10 +693,10 @@ class ExtraFields
|
|||||||
$out = '';
|
$out = '';
|
||||||
if ($conf->use_javascript_ajax && $conf->global->COMPANY_USE_SEARCH_TO_SELECT && ! $forcecombo)
|
if ($conf->use_javascript_ajax && $conf->global->COMPANY_USE_SEARCH_TO_SELECT && ! $forcecombo)
|
||||||
{
|
{
|
||||||
$out.= ajax_combobox('options_'.$key, $event, $conf->global->COMPANY_USE_SEARCH_TO_SELECT);
|
$out.= ajax_combobox('options_'.$key.$keyprefix, $event, $conf->global->COMPANY_USE_SEARCH_TO_SELECT);
|
||||||
}
|
}
|
||||||
|
|
||||||
$out.='<select class="flat" name="options_'.$key.'" id="options_'.$key.'">';
|
$out.='<select class="flat" name="options_'.$key.$keyprefix.'" id="options_'.$key.$keyprefix.'" '.($moreparam?$moreparam:'').'>';
|
||||||
if (is_array($param['options']))
|
if (is_array($param['options']))
|
||||||
{
|
{
|
||||||
$param_list=array_keys($param['options']);
|
$param_list=array_keys($param['options']);
|
||||||
@ -836,7 +837,7 @@ class ExtraFields
|
|||||||
foreach ($param['options'] as $keyopt=>$val )
|
foreach ($param['options'] as $keyopt=>$val )
|
||||||
{
|
{
|
||||||
|
|
||||||
$out.='<input class="flat" type="checkbox" name="options_'.$key.'[]"';
|
$out.='<input class="flat" type="checkbox" name="options_'.$key.$keyprefix.'[]" '.($moreparam?$moreparam:'');
|
||||||
$out.=' value="'.$keyopt.'"';
|
$out.=' value="'.$keyopt.'"';
|
||||||
|
|
||||||
if ((is_array($value_arr)) && in_array($keyopt,$value_arr)) {
|
if ((is_array($value_arr)) && in_array($keyopt,$value_arr)) {
|
||||||
@ -853,7 +854,7 @@ class ExtraFields
|
|||||||
$out='';
|
$out='';
|
||||||
foreach ($param['options'] as $keyopt=>$val )
|
foreach ($param['options'] as $keyopt=>$val )
|
||||||
{
|
{
|
||||||
$out.='<input class="flat" type="radio" name="options_'.$key.'"';
|
$out.='<input class="flat" type="radio" name="options_'.$key.$keyprefix.'" '.($moreparam?$moreparam:'');
|
||||||
$out.=' value="'.$keyopt.'"';
|
$out.=' value="'.$keyopt.'"';
|
||||||
$out.= ($value==$keyopt?'checked="checked"':'');
|
$out.= ($value==$keyopt?'checked="checked"':'');
|
||||||
$out.='/>'.$val.'<br>';
|
$out.='/>'.$val.'<br>';
|
||||||
@ -1101,9 +1102,10 @@ class ExtraFields
|
|||||||
* return array_options array for object by extrafields value (using for data send by forms)
|
* return array_options array for object by extrafields value (using for data send by forms)
|
||||||
*
|
*
|
||||||
* @param array $extralabels $array of extrafields
|
* @param array $extralabels $array of extrafields
|
||||||
|
* @param string $keyprefix Prefix string to add into name and id of field (can be used to avoid duplicate names)
|
||||||
* @return int 1 if array_options set / 0 if no value
|
* @return int 1 if array_options set / 0 if no value
|
||||||
*/
|
*/
|
||||||
function getOptionalsFromPost($extralabels)
|
function getOptionalsFromPost($extralabels,$keyprefix='')
|
||||||
{
|
{
|
||||||
global $_POST;
|
global $_POST;
|
||||||
|
|
||||||
@ -1118,23 +1120,24 @@ class ExtraFields
|
|||||||
if (in_array($key_type,array('date','datetime')))
|
if (in_array($key_type,array('date','datetime')))
|
||||||
{
|
{
|
||||||
// Clean parameters
|
// Clean parameters
|
||||||
$value_key=dol_mktime($_POST["options_".$key."hour"], $_POST["options_".$key."min"], 0, $_POST["options_".$key."month"], $_POST["options_".$key."day"], $_POST["options_".$key."year"]);
|
$value_key=dol_mktime($_POST["options_".$key.$keyprefix."hour"], $_POST["options_".$key.$keyprefix."min"], 0, $_POST["options_".$key.$keyprefix."month"], $_POST["options_".$key.$keyprefix."day"], $_POST["options_".$key.$keyprefix."year"]);
|
||||||
}
|
}
|
||||||
else if (in_array($key_type,array('checkbox')))
|
else if (in_array($key_type,array('checkbox')))
|
||||||
{
|
{
|
||||||
$value_arr=GETPOST("options_".$key);
|
$value_arr=GETPOST("options_".$key.$keyprefix);
|
||||||
$value_key=implode($value_arr,',');
|
$value_key=implode($value_arr,',');
|
||||||
}
|
}
|
||||||
else if (in_array($key_type,array('price','double')))
|
else if (in_array($key_type,array('price','double')))
|
||||||
{
|
{
|
||||||
$value_arr=GETPOST("options_".$key);
|
$value_arr=GETPOST("options_".$key.$keyprefix);
|
||||||
$value_key=price2num($value_arr);
|
$value_key=price2num($value_arr);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$value_key=GETPOST("options_".$key);
|
$value_key=GETPOST("options_".$key.$keyprefix);
|
||||||
}
|
}
|
||||||
$array_options["options_".$key]=$value_key;
|
|
||||||
|
$array_options["options_".$key]=$value_key; // No keyprefix here. keyprefix is used only for read.
|
||||||
}
|
}
|
||||||
|
|
||||||
return $array_options;
|
return $array_options;
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
/* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005-2011 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2005-2011 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
|
* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
|
||||||
*
|
*
|
||||||
@ -324,7 +324,7 @@ class FormAdmin
|
|||||||
*
|
*
|
||||||
* @param string $selected Paper format pre-selected
|
* @param string $selected Paper format pre-selected
|
||||||
* @param string $htmlname Name of HTML select field
|
* @param string $htmlname Name of HTML select field
|
||||||
* @param string $filter Key to filter
|
* @param string $filter Value to filter on code
|
||||||
* @param int $showempty Add empty value
|
* @param int $showempty Add empty value
|
||||||
* @return string Return HTML output
|
* @return string Return HTML output
|
||||||
*/
|
*/
|
||||||
@ -332,8 +332,12 @@ class FormAdmin
|
|||||||
{
|
{
|
||||||
global $langs;
|
global $langs;
|
||||||
|
|
||||||
$sql="SELECT code, label, width, height, unit FROM ".MAIN_DB_PREFIX."c_paper_format where active=1";
|
$langs->load("dict");
|
||||||
if ($filter) $sql.=" WHERE code LIKE '%".$filter."%'";
|
|
||||||
|
$sql = "SELECT code, label, width, height, unit";
|
||||||
|
$sql.= " FROM ".MAIN_DB_PREFIX."c_paper_format";
|
||||||
|
$sql.= " WHERE active=1";
|
||||||
|
if ($filter) $sql.=" AND code LIKE '%".$this->db->escape($filter)."%'";
|
||||||
|
|
||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
@ -350,7 +354,11 @@ class FormAdmin
|
|||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else dol_print_error($this->db);
|
else
|
||||||
|
{
|
||||||
|
dol_print_error($this->db);
|
||||||
|
return '';
|
||||||
|
}
|
||||||
$out='';
|
$out='';
|
||||||
|
|
||||||
$out.= '<select class="flat" id="'.$htmlname.'" name="'.$htmlname.'">';
|
$out.= '<select class="flat" id="'.$htmlname.'" name="'.$htmlname.'">';
|
||||||
|
|||||||
@ -132,13 +132,10 @@ function invoice_admin_prepare_head($object)
|
|||||||
$head[$h][2] = 'attributes';
|
$head[$h][2] = 'attributes';
|
||||||
$h++;
|
$h++;
|
||||||
|
|
||||||
if ($conf->global->MAIN_FEATURES_LEVEL >= 2) // FIXME This feature will works when form for predefined and free product will be merged, otherwise there is duplicate fields with same name
|
|
||||||
{
|
|
||||||
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/admin/facturedet_cust_extrafields.php';
|
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/admin/facturedet_cust_extrafields.php';
|
||||||
$head[$h][1] = $langs->trans("ExtraFieldsLines");
|
$head[$h][1] = $langs->trans("ExtraFieldsLines");
|
||||||
$head[$h][2] = 'attributeslines';
|
$head[$h][2] = 'attributeslines';
|
||||||
$h++;
|
$h++;
|
||||||
}
|
|
||||||
|
|
||||||
complete_head_from_modules($conf,$langs,$object,$head,$h,'invoice_admin','remove');
|
complete_head_from_modules($conf,$langs,$object,$head,$h,'invoice_admin','remove');
|
||||||
|
|
||||||
|
|||||||
@ -138,13 +138,10 @@ function order_admin_prepare_head($object)
|
|||||||
$head[$h][2] = 'attributes';
|
$head[$h][2] = 'attributes';
|
||||||
$h++;
|
$h++;
|
||||||
|
|
||||||
if ($conf->global->MAIN_FEATURES_LEVEL >= 2) // FIXME This feature will works when form for predefined and free product will be merged, otherwise there is duplicate fields with same name
|
|
||||||
{
|
|
||||||
$head[$h][0] = DOL_URL_ROOT.'/admin/orderdet_extrafields.php';
|
$head[$h][0] = DOL_URL_ROOT.'/admin/orderdet_extrafields.php';
|
||||||
$head[$h][1] = $langs->trans("ExtraFieldsLines");
|
$head[$h][1] = $langs->trans("ExtraFieldsLines");
|
||||||
$head[$h][2] = 'attributeslines';
|
$head[$h][2] = 'attributeslines';
|
||||||
$h++;
|
$h++;
|
||||||
}
|
|
||||||
|
|
||||||
complete_head_from_modules($conf,$langs,$object,$head,$h,'order_admin','remove');
|
complete_head_from_modules($conf,$langs,$object,$head,$h,'order_admin','remove');
|
||||||
|
|
||||||
|
|||||||
@ -136,13 +136,10 @@ function propal_admin_prepare_head($object)
|
|||||||
$head[$h][2] = 'attributes';
|
$head[$h][2] = 'attributes';
|
||||||
$h++;
|
$h++;
|
||||||
|
|
||||||
if ($conf->global->MAIN_FEATURES_LEVEL >= 2) // FIXME This feature will works when form for predefined and free product will be merged, otherwise there is duplicate fields with same name
|
|
||||||
{
|
|
||||||
$head[$h][0] = DOL_URL_ROOT.'/comm/admin/propaldet_extrafields.php';
|
$head[$h][0] = DOL_URL_ROOT.'/comm/admin/propaldet_extrafields.php';
|
||||||
$head[$h][1] = $langs->trans("ExtraFieldsLines");
|
$head[$h][1] = $langs->trans("ExtraFieldsLines");
|
||||||
$head[$h][2] = 'attributeslines';
|
$head[$h][2] = 'attributeslines';
|
||||||
$h++;
|
$h++;
|
||||||
}
|
|
||||||
|
|
||||||
complete_head_from_modules($conf,$langs,$object,$head,$h,'propal_admin','remove');
|
complete_head_from_modules($conf,$langs,$object,$head,$h,'propal_admin','remove');
|
||||||
|
|
||||||
|
|||||||
@ -281,5 +281,5 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left
|
|||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->holiday->enabled', __HANDLER__, 'left', 5001__+MAX_llx_menu__, 'hrm', '', 5000__+MAX_llx_menu__, '/holiday/fiche.php?&action=request', 'MenuAddCP', 1, 'holiday', '$user->rights->holiday->write', '', 0, 1, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->holiday->enabled', __HANDLER__, 'left', 5001__+MAX_llx_menu__, 'hrm', '', 5000__+MAX_llx_menu__, '/holiday/fiche.php?&action=request', 'MenuAddCP', 1, 'holiday', '$user->rights->holiday->write', '', 0, 1, __ENTITY__);
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->holiday->enabled', __HANDLER__, 'left', 5002__+MAX_llx_menu__, 'hrm', '', 5000__+MAX_llx_menu__, '/holiday/define_holiday.php?&action=request', 'MenuConfCP', 1, 'holiday', '$user->rights->holiday->define_holiday', '', 0, 2, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->holiday->enabled', __HANDLER__, 'left', 5002__+MAX_llx_menu__, 'hrm', '', 5000__+MAX_llx_menu__, '/holiday/define_holiday.php?&action=request', 'MenuConfCP', 1, 'holiday', '$user->rights->holiday->define_holiday', '', 0, 2, __ENTITY__);
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->holiday->enabled', __HANDLER__, 'left', 5003__+MAX_llx_menu__, 'hrm', '', 5000__+MAX_llx_menu__, '/holiday/view_log.php?&action=request', 'MenuLogCP', 1, 'holiday', '$user->rights->holiday->view_log', '', 0, 3, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->holiday->enabled', __HANDLER__, 'left', 5003__+MAX_llx_menu__, 'hrm', '', 5000__+MAX_llx_menu__, '/holiday/view_log.php?&action=request', 'MenuLogCP', 1, 'holiday', '$user->rights->holiday->view_log', '', 0, 3, __ENTITY__);
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->holiday->enabled', __HANDLER__, 'left', 5004__+MAX_llx_menu__, 'hrm', '', 5000__+MAX_llx_menu__, '/holiday/month_report.php?&action=request', 'MenuReportMonth', 1, 'holiday', '$user->rights->holiday->view_log', '', 0, 4, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->holiday->enabled', __HANDLER__, 'left', 5004__+MAX_llx_menu__, 'hrm', '', 5000__+MAX_llx_menu__, '/holiday/month_report.php?&action=request', 'MenuReportMonth', 1, 'holiday', '$user->rights->holiday->month_report', '', 0, 4, __ENTITY__);
|
||||||
|
|
||||||
|
|||||||
@ -1090,7 +1090,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
|
|||||||
$newmenu->add("/holiday/fiche.php?&action=request", $langs->trans("MenuAddCP"), 1,$user->rights->holiday->write);
|
$newmenu->add("/holiday/fiche.php?&action=request", $langs->trans("MenuAddCP"), 1,$user->rights->holiday->write);
|
||||||
$newmenu->add("/holiday/define_holiday.php?&action=request", $langs->trans("MenuConfCP"), 1, $user->rights->holiday->define_holiday);
|
$newmenu->add("/holiday/define_holiday.php?&action=request", $langs->trans("MenuConfCP"), 1, $user->rights->holiday->define_holiday);
|
||||||
$newmenu->add("/holiday/view_log.php?&action=request", $langs->trans("MenuLogCP"), 1, $user->rights->holiday->view_log);
|
$newmenu->add("/holiday/view_log.php?&action=request", $langs->trans("MenuLogCP"), 1, $user->rights->holiday->view_log);
|
||||||
$newmenu->add("/holiday/month_report.php?&action=request", $langs->trans("MenuReportMonth"), 1, $user->rights->holiday->view_log);
|
$newmenu->add("/holiday/month_report.php?&action=request", $langs->trans("MenuReportMonth"), 1, $user->rights->holiday->month_report);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -126,13 +126,20 @@ else {
|
|||||||
<input type="text" size="5" name="buying_price" class="flat" value="<?php echo (isset($_POST["buying_price"])?$_POST["buying_price"]:''); ?>">
|
<input type="text" size="5" name="buying_price" class="flat" value="<?php echo (isset($_POST["buying_price"])?$_POST["buying_price"]:''); ?>">
|
||||||
</td>
|
</td>
|
||||||
<?php
|
<?php
|
||||||
|
$colspan++;
|
||||||
|
$coldisplay++;
|
||||||
|
|
||||||
if ($user->rights->margins->creer)
|
if ($user->rights->margins->creer)
|
||||||
{
|
{
|
||||||
if (! empty($conf->global->DISPLAY_MARGIN_RATES)) {
|
if (! empty($conf->global->DISPLAY_MARGIN_RATES)) {
|
||||||
echo '<td align="right" class="nowrap"><input type="text" size="2" name="np_marginRate" value="'.(isset($_POST["np_marginRate"])?$_POST["np_marginRate"]:'').'"><span class="hideonsmartphone">%</span></td>';
|
echo '<td align="right" class="nowrap"><input type="text" size="2" name="np_marginRate" value="'.(isset($_POST["np_marginRate"])?$_POST["np_marginRate"]:'').'"><span class="hideonsmartphone">%</span></td>';
|
||||||
|
$colspan++;
|
||||||
|
$coldisplay++;
|
||||||
}
|
}
|
||||||
if (! empty($conf->global->DISPLAY_MARK_RATES)) {
|
if (! empty($conf->global->DISPLAY_MARK_RATES)) {
|
||||||
echo '<td align="right" class="nowrap"><input type="text" size="2" name="np_markRate" value="'.(isset($_POST["np_markRate"])?$_POST["np_markRate"]:'').'"><span class="hideonsmartphone">%</span></td>';
|
echo '<td align="right" class="nowrap"><input type="text" size="2" name="np_markRate" value="'.(isset($_POST["np_markRate"])?$_POST["np_markRate"]:'').'"><span class="hideonsmartphone">%</span></td>';
|
||||||
|
$colspan++;
|
||||||
|
$coldisplay++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@ -190,10 +190,10 @@ if (! empty($conf->margin->enabled)) {
|
|||||||
if ($user->rights->margins->creer)
|
if ($user->rights->margins->creer)
|
||||||
{
|
{
|
||||||
if (! empty($conf->global->DISPLAY_MARGIN_RATES)) {
|
if (! empty($conf->global->DISPLAY_MARGIN_RATES)) {
|
||||||
echo '<td align="right"><input type="text" size="2" name="np_marginRate" value="'.(isset($_POST["np_marginRate"])?$_POST["np_marginRate"]:'').'">%</td>';
|
echo '<td align="right" class="nowrap"><input type="text" size="2" name="np_marginRate" value="'.(isset($_POST["np_marginRate"])?$_POST["np_marginRate"]:'').'">%</td>';
|
||||||
}
|
}
|
||||||
elseif (! empty($conf->global->DISPLAY_MARK_RATES)) {
|
elseif (! empty($conf->global->DISPLAY_MARK_RATES)) {
|
||||||
echo '<td align="right"><input type="text" size="2" name="np_markRate" value="'.(isset($_POST["np_markRate"])?$_POST["np_markRate"]:'').'">%</td>';
|
echo '<td align="right" class="nowrap"><input type="text" size="2" name="np_markRate" value="'.(isset($_POST["np_markRate"])?$_POST["np_markRate"]:'').'">%</td>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@ -134,13 +134,20 @@ else {
|
|||||||
<input type="text" size="5" id="buying_price_predef" name="buying_price_predef" class="flat" value="<?php echo (isset($_POST["buying_price_predef"])?$_POST["buying_price_predef"]:''); ?>">
|
<input type="text" size="5" id="buying_price_predef" name="buying_price_predef" class="flat" value="<?php echo (isset($_POST["buying_price_predef"])?$_POST["buying_price_predef"]:''); ?>">
|
||||||
</td>
|
</td>
|
||||||
<?php
|
<?php
|
||||||
|
$colspan++;
|
||||||
|
$coldisplay++;
|
||||||
|
|
||||||
if ($user->rights->margins->creer)
|
if ($user->rights->margins->creer)
|
||||||
{
|
{
|
||||||
if (! empty($conf->global->DISPLAY_MARGIN_RATES)) {
|
if (! empty($conf->global->DISPLAY_MARGIN_RATES)) {
|
||||||
echo '<td align="right"><input type="text" size="2" name="np_marginRate_predef" value="'.(isset($_POST["np_marginRate_predef"])?$_POST["np_marginRate_predef"]:'').'">%</td>';
|
echo '<td align="right"><input type="text" size="2" name="np_marginRate_predef" value="'.(isset($_POST["np_marginRate_predef"])?$_POST["np_marginRate_predef"]:'').'">%</td>';
|
||||||
|
$colspan++;
|
||||||
|
$coldisplay++;
|
||||||
}
|
}
|
||||||
if (! empty($conf->global->DISPLAY_MARK_RATES)) {
|
if (! empty($conf->global->DISPLAY_MARK_RATES)) {
|
||||||
echo '<td align="right"><input type="text" size="2" name="np_markRate_predef" value="'.(isset($_POST["np_markRate_predef"])?$_POST["np_markRate_predef"]:'').'">%</td>';
|
echo '<td align="right"><input type="text" size="2" name="np_markRate_predef" value="'.(isset($_POST["np_markRate_predef"])?$_POST["np_markRate_predef"]:'').'">%</td>';
|
||||||
|
$colspan++;
|
||||||
|
$coldisplay++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -172,7 +179,7 @@ else {
|
|||||||
$newline = new FactureLigne($this->db);
|
$newline = new FactureLigne($this->db);
|
||||||
}
|
}
|
||||||
if (is_object($newline)) {
|
if (is_object($newline)) {
|
||||||
print $newline->showOptionals($extrafieldsline,'edit',array('style'=>$bcnd[$var],'colspan'=>$coldisplay+5));
|
print $newline->showOptionals($extrafieldsline, 'edit', array('style'=>$bcnd[$var],'colspan'=>$coldisplay+5), '_predef');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|||||||
@ -37,3 +37,4 @@ ShowCompany=Show company
|
|||||||
ShowStock=Show warehouse
|
ShowStock=Show warehouse
|
||||||
DeleteArticle=Click to remove this article
|
DeleteArticle=Click to remove this article
|
||||||
FilterRefOrLabelOrBC=Search (Ref/Label)
|
FilterRefOrLabelOrBC=Search (Ref/Label)
|
||||||
|
UserNeedPermissionToEditStockToUsePos=You ask to decrease stock on invoice creation, so user that use POS need to have permission to edit stock.
|
||||||
@ -37,3 +37,4 @@ ShowCompany=Voir société
|
|||||||
ShowStock=Voir entrepôt
|
ShowStock=Voir entrepôt
|
||||||
DeleteArticle=Cliquez pour enlever cet article
|
DeleteArticle=Cliquez pour enlever cet article
|
||||||
FilterRefOrLabelOrBC=Recherche (Ref/Lib.)
|
FilterRefOrLabelOrBC=Recherche (Ref/Lib.)
|
||||||
|
UserNeedPermissionToEditStockToUsePos=La configuration du module stock demande une réduction du stock sur facturation, aussi l'utilisateur du Point De Vente doit avoir les droits de modifier les stocks
|
||||||
@ -488,6 +488,7 @@ class User extends CommonObject
|
|||||||
* Clear all permissions array of user
|
* Clear all permissions array of user
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
|
* @see getrights
|
||||||
*/
|
*/
|
||||||
function clearrights()
|
function clearrights()
|
||||||
{
|
{
|
||||||
@ -503,6 +504,7 @@ class User extends CommonObject
|
|||||||
*
|
*
|
||||||
* @param string $moduletag Limit permission for a particular module ('' by default means load all permissions)
|
* @param string $moduletag Limit permission for a particular module ('' by default means load all permissions)
|
||||||
* @return void
|
* @return void
|
||||||
|
* @see clearrights
|
||||||
*/
|
*/
|
||||||
function getrights($moduletag='')
|
function getrights($moduletag='')
|
||||||
{
|
{
|
||||||
|
|||||||
139
test/phpunit/FormAdminTest.php
Normal file
139
test/phpunit/FormAdminTest.php
Normal file
@ -0,0 +1,139 @@
|
|||||||
|
<?php
|
||||||
|
/* Copyright (C) 2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* or see http://www.gnu.org/
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \file test/phpunit/FormAdminTest.php
|
||||||
|
* \ingroup test
|
||||||
|
* \brief PHPUnit test
|
||||||
|
* \remarks To run this script as CLI: phpunit filename.php
|
||||||
|
*/
|
||||||
|
|
||||||
|
global $conf,$user,$langs,$db;
|
||||||
|
//define('TEST_DB_FORCE_TYPE','mysql'); // This is to force using mysql driver
|
||||||
|
require_once 'PHPUnit/Autoload.php';
|
||||||
|
require_once dirname(__FILE__).'/../../htdocs/master.inc.php';
|
||||||
|
require_once dirname(__FILE__).'/../../htdocs/core/class/html.formadmin.class.php';
|
||||||
|
|
||||||
|
if (empty($user->id))
|
||||||
|
{
|
||||||
|
print "Load permissions for admin user nb 1\n";
|
||||||
|
$user->fetch(1);
|
||||||
|
$user->getrights();
|
||||||
|
}
|
||||||
|
$conf->global->MAIN_DISABLE_ALL_MAILS=1;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class for PHPUnit tests
|
||||||
|
*
|
||||||
|
* @backupGlobals disabled
|
||||||
|
* @backupStaticAttributes enabled
|
||||||
|
* @remarks backupGlobals must be disabled to have db,conf,user and lang not erased.
|
||||||
|
*/
|
||||||
|
class FormAdminTest extends PHPUnit_Framework_TestCase
|
||||||
|
{
|
||||||
|
protected $savconf;
|
||||||
|
protected $savuser;
|
||||||
|
protected $savlangs;
|
||||||
|
protected $savdb;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
* We save global variables into local variables
|
||||||
|
*
|
||||||
|
* @return FactureTest
|
||||||
|
*/
|
||||||
|
function __construct()
|
||||||
|
{
|
||||||
|
//$this->sharedFixture
|
||||||
|
global $conf,$user,$langs,$db;
|
||||||
|
$this->savconf=$conf;
|
||||||
|
$this->savuser=$user;
|
||||||
|
$this->savlangs=$langs;
|
||||||
|
$this->savdb=$db;
|
||||||
|
|
||||||
|
print __METHOD__." db->type=".$db->type." user->id=".$user->id;
|
||||||
|
//print " - db ".$db->db;
|
||||||
|
print "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
// Static methods
|
||||||
|
public static function setUpBeforeClass()
|
||||||
|
{
|
||||||
|
global $conf,$user,$langs,$db;
|
||||||
|
$db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
|
||||||
|
|
||||||
|
print __METHOD__."\n";
|
||||||
|
}
|
||||||
|
public static function tearDownAfterClass()
|
||||||
|
{
|
||||||
|
global $conf,$user,$langs,$db;
|
||||||
|
$db->rollback();
|
||||||
|
|
||||||
|
print __METHOD__."\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Init phpunit tests
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
protected function setUp()
|
||||||
|
{
|
||||||
|
global $conf,$user,$langs,$db;
|
||||||
|
$conf=$this->savconf;
|
||||||
|
$user=$this->savuser;
|
||||||
|
$langs=$this->savlangs;
|
||||||
|
$db=$this->savdb;
|
||||||
|
|
||||||
|
print __METHOD__."\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* End phpunit tests
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
protected function tearDown()
|
||||||
|
{
|
||||||
|
print __METHOD__."\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* testFactureCreate
|
||||||
|
*
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public function testSelectPaperFormat()
|
||||||
|
{
|
||||||
|
global $conf,$user,$langs,$db;
|
||||||
|
$conf=$this->savconf;
|
||||||
|
$user=$this->savuser;
|
||||||
|
$langs=$this->savlangs;
|
||||||
|
$db=$this->savdb;
|
||||||
|
|
||||||
|
$localobject=new FormAdmin($this->savdb);
|
||||||
|
$result=$localobject->select_paper_format('','paperformat_id','A4');
|
||||||
|
|
||||||
|
$this->assertEquals($result, '<select class="flat" id="paperformat_id" name="paperformat_id"><option value="EUA4">Format A4 - 210x297 mm</option></select>');
|
||||||
|
print __METHOD__." result=".$result."\n";
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
?>
|
||||||
Loading…
Reference in New Issue
Block a user