diff --git a/ChangeLog b/ChangeLog
index 99c3e31221f..aaad1ca826b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -74,6 +74,10 @@ Fix: Page load not ending when large number of thirdparies. We
combo feature that is root cause of problem.
Fix: [ bug #1231 ] PDF always generated in interventions
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.* *****
For users:
diff --git a/htdocs/cashdesk/index_verif.php b/htdocs/cashdesk/index_verif.php
index 94ec87edea0..9f7e0332046 100644
--- a/htdocs/cashdesk/index_verif.php
+++ b/htdocs/cashdesk/index_verif.php
@@ -65,6 +65,21 @@ if (! empty($conf->stock->enabled) && $conf->global->STOCK_CALCULATE_ON_BILL &&
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)))
{
diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php
index e61750f7bfd..a8dd4ab2a9e 100644
--- a/htdocs/comm/propal.php
+++ b/htdocs/comm/propal.php
@@ -657,7 +657,7 @@ else if (($action == 'addline' || $action == 'addline_predef') && $user->rights-
//Extrafields
$extrafieldsline = new ExtraFields($db);
$extralabelsline =$extrafieldsline->fetch_name_optionals_label($object->table_element_line);
- $array_option = $extrafieldsline->getOptionalsFromPost($extralabelsline);
+ $array_option = $extrafieldsline->getOptionalsFromPost($extralabelsline,$predef);
//Unset extrafield
if (is_array($extralabelsline))
{
diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php
index 9b1093873ed..760324d23e8 100644
--- a/htdocs/commande/fiche.php
+++ b/htdocs/commande/fiche.php
@@ -591,7 +591,7 @@ else if ($action == 'addline' && $user->rights->commande->creer)
//Extrafields
$extrafieldsline = new ExtraFields($db);
$extralabelsline =$extrafieldsline->fetch_name_optionals_label($object->table_element_line);
- $array_option = $extrafieldsline->getOptionalsFromPost($extralabelsline);
+ $array_option = $extrafieldsline->getOptionalsFromPost($extralabelsline,$predef);
//Unset extrafield
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))
{
setEventMessage($langs->trans('ErrorBothFieldCantBeNegative', $langs->transnoentitiesnoconv('UnitPriceHT'), $langs->transnoentitiesnoconv('Qty')), 'errors');
- $error = true;
+ $error++;
}
if (empty($idprod) && GETPOST('type') < 0)
{
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 ''
{
@@ -620,12 +620,12 @@ else if ($action == 'addline' && $user->rights->commande->creer)
if ($qty == '')
{
setEventMessage($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Qty')), 'errors');
- $error = true;
+ $error++;
}
if (empty($idprod) && empty($product_desc))
{
setEventMessage($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Description')), 'errors');
- $error = true;
+ $error++;
}
if (! $error && ($qty >= 0) && (! empty($product_desc) || ! empty($idprod)))
diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php
index fcf48c5f2ab..c900b0d7ebb 100644
--- a/htdocs/compta/facture.php
+++ b/htdocs/compta/facture.php
@@ -1147,13 +1147,13 @@ else if (($action == 'addline' || $action == 'addline_predef') && $user->rights-
//Extrafields
$extrafieldsline = new ExtraFields($db);
$extralabelsline =$extrafieldsline->fetch_name_optionals_label($object->table_element_line);
- $array_option = $extrafieldsline->getOptionalsFromPost($extralabelsline);
+ $array_option = $extrafieldsline->getOptionalsFromPost($extralabelsline,$predef);
//Unset extrafield
if (is_array($extralabelsline))
{
// Get extra fields
foreach ($extralabelsline as $key => $value) {
- unset($_POST["options_".$key]);
+ unset($_POST["options_".$key.$predef]);
}
}
diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index 35f09944ef7..20299041dfe 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -2268,13 +2268,14 @@ abstract class CommonObject
/**
* 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 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
*/
- function showOptionals($extrafields,$mode='view',$params=0)
+ function showOptionals($extrafields, $mode='view', $params=0, $keyprefix='')
{
global $_POST;
@@ -2342,7 +2343,7 @@ abstract class CommonObject
$out .= $extrafields->showOutputField($key,$value);
break;
case "edit":
- $out .= $extrafields->showInputField($key,$value);
+ $out .= $extrafields->showInputField($key,$value,'',$keyprefix);
break;
}
diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php
index ae705ee7ab8..128dec24d8c 100644
--- a/htdocs/core/class/extrafields.class.php
+++ b/htdocs/core/class/extrafields.class.php
@@ -571,14 +571,15 @@ class ExtraFields
/**
- * Return HTML string to put an input field into a page
+ * Return HTML string to put an input field into a page
*
- * @param string $key Key of attribute
- * @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
- * @return void
+ * @param string $key Key of attribute
+ * @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 $keyprefix Prefix string to add into name and id of field (can be used to avoid duplicate names)
+ * @return void
*/
- function showInputField($key,$value,$moreparam='')
+ function showInputField($key,$value,$moreparam='',$keyprefix='')
{
global $conf,$langs;
@@ -620,23 +621,23 @@ class ExtraFields
if(!$required && $value == '')
$value = '-1';
- $out = $formstat->select_date($value, 'options_'.$key, $showtime, $showtime, $required, '', 1, 1, 1, 0, 1);
- //$out='';
+ $out = $formstat->select_date($value, 'options_'.$key.$keyprefix, $showtime, $showtime, $required, '', 1, 1, 1, 0, 1);
+ // TODO Missing to add $moreparam
}
elseif (in_array($type,array('int')))
{
$tmp=explode(',',$size);
$newsize=$tmp[0];
- $out='';
+ $out='';
}
elseif ($type == 'varchar')
{
- $out='';
+ $out='';
}
elseif ($type == 'text')
{
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);
}
elseif ($type == 'boolean')
@@ -647,36 +648,36 @@ class ExtraFields
} else {
$checked=' value="1" ';
}
- $out='';
+ $out='';
}
elseif ($type == 'mail')
{
- $out='';
+ $out='';
}
elseif ($type == 'phone')
{
- $out='';
+ $out='';
}
elseif ($type == 'price')
{
- $out=' '.$langs->getCurrencySymbol($conf->currency);
+ $out=' '.$langs->getCurrencySymbol($conf->currency);
}
elseif ($type == 'double')
{
if (!empty($value)) {
$value=price($value);
}
- $out=' ';
+ $out=' ';
}
elseif ($type == 'select')
{
$out = '';
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.='