diff --git a/htdocs/admin/order_extrafields.php b/htdocs/admin/order_extrafields.php
index f81b3cc1e69..eba9fd76ff6 100644
--- a/htdocs/admin/order_extrafields.php
+++ b/htdocs/admin/order_extrafields.php
@@ -70,7 +70,6 @@ llxHeader('', $langs->trans("OrdersSetup"));
$linkback=''.$langs->trans("BackToModuleList").'';
print load_fiche_titre($langs->trans("OrdersSetup"), $linkback, 'title_setup');
-print "
\n";
$head = order_admin_prepare_head();
diff --git a/htdocs/admin/orderdet_extrafields.php b/htdocs/admin/orderdet_extrafields.php
index 2b239de0932..9204bbc251c 100644
--- a/htdocs/admin/orderdet_extrafields.php
+++ b/htdocs/admin/orderdet_extrafields.php
@@ -71,7 +71,6 @@ llxHeader('', $langs->trans("OrdersSetup"));
$linkback=''.$langs->trans("BackToModuleList").'';
print load_fiche_titre($langs->trans("OrdersSetup"), $linkback, 'title_setup');
-print "
\n";
$head = order_admin_prepare_head();
diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php
index 791c4872794..778f00fbf31 100644
--- a/htdocs/comm/propal/class/propal.class.php
+++ b/htdocs/comm/propal/class/propal.class.php
@@ -722,6 +722,7 @@ class Propal extends CommonObject
$localtaxes_type = getLocalTaxesFromRate($txtva, 0, $this->thirdparty, $mysoc);
// Clean vat code
+ $reg = array();
$vat_src_code = '';
if (preg_match('/\((.*)\)/', $txtva, $reg))
{
@@ -757,7 +758,7 @@ class Propal extends CommonObject
//Fetch current line from the database and then clone the object and set it in $oldline property
$line = new PropaleLigne($this->db);
$line->fetch($rowid);
- $line->fetch_optionals(); // Fetch extrafields for oldcopy
+ $line->fetch_optionals();
$staticline = clone $line;
@@ -808,7 +809,10 @@ class Propal extends CommonObject
$this->line->remise = $remise;
if (is_array($array_options) && count($array_options) > 0) {
- $this->line->array_options = $array_options;
+ // We replace values in this->line->array_options only for entries defined into $array_options
+ foreach($array_options as $key => $value) {
+ $this->line->array_options[$key] = $array_options[$key];
+ }
}
// Multicurrency
diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php
index 337a6696b3c..1d8c5bb0f30 100644
--- a/htdocs/commande/class/commande.class.php
+++ b/htdocs/commande/class/commande.class.php
@@ -3074,6 +3074,7 @@ class Commande extends CommonOrder
//Fetch current line from the database and then clone the object and set it in $oldline property
$line = new OrderLine($this->db);
$line->fetch($rowid);
+ $line->fetch_optionals();
if (!empty($line->fk_product))
{
@@ -3146,7 +3147,10 @@ class Commande extends CommonOrder
$this->line->remise = $remise;
if (is_array($array_options) && count($array_options) > 0) {
- $this->line->array_options = $array_options;
+ // We replace values in this->line->array_options only for entries defined into $array_options
+ foreach($array_options as $key => $value) {
+ $this->line->array_options[$key] = $array_options[$key];
+ }
}
$result = $this->line->update($user, $notrigger);
diff --git a/htdocs/compta/cashcontrol/cashcontrol_card.php b/htdocs/compta/cashcontrol/cashcontrol_card.php
index 7958d107ec8..4c60434619a 100644
--- a/htdocs/compta/cashcontrol/cashcontrol_card.php
+++ b/htdocs/compta/cashcontrol/cashcontrol_card.php
@@ -56,7 +56,7 @@ if (!$sortfield) $sortfield = 'rowid';
if (!$sortorder) $sortorder = 'ASC';
// Security check
-if (!$user->rights->cashdesk->use && !$user->rights->takepos->use)
+if (!$user->rights->cashdesk->run && !$user->rights->takepos->run)
{
accessforbidden();
}
@@ -82,8 +82,8 @@ $hookmanager->initHooks(array('cashcontrolcard', 'globalcard'));
* Actions
*/
-$permissiontoadd = ($user->rights->cashdesk->use || $user->rights->takepos->use);
-$permissiontodelete = ($user->rights->cashdesk->use || $user->rights->takepos->use) || ($permissiontoadd && $object->status == 0);
+$permissiontoadd = ($user->rights->cashdesk->run || $user->rights->takepos->run);
+$permissiontodelete = ($user->rights->cashdesk->run || $user->rights->takepos->run) || ($permissiontoadd && $object->status == 0);
if (empty($backtopage)) $backtopage = dol_buildpath('/compta/cashcontrol/cashcontrol_card.php', 1).'?id='.($id > 0 ? $id : '__ID__');
$backurlforlist = dol_buildpath('/compta/cashcontrol/cashcontrol_list.php', 1);
$triggermodname = 'CACHCONTROL_MODIFY'; // Name of trigger action code to execute when we modify record
diff --git a/htdocs/compta/cashcontrol/cashcontrol_list.php b/htdocs/compta/cashcontrol/cashcontrol_list.php
index 5bf48189c4a..6c59276d600 100644
--- a/htdocs/compta/cashcontrol/cashcontrol_list.php
+++ b/htdocs/compta/cashcontrol/cashcontrol_list.php
@@ -168,8 +168,8 @@ if (empty($reshook))
// Mass actions
$objectclass = 'CashControl';
$objectlabel = 'CashControl';
- $permissiontoread = ($user->rights->cashdesk->use || $user->rights->takepos->use);
- $permissiontodelete = ($user->rights->cashdesk->use || $user->rights->takepos->use);
+ $permissiontoread = ($user->rights->cashdesk->run || $user->rights->takepos->run);
+ $permissiontodelete = ($user->rights->cashdesk->run || $user->rights->takepos->run);
//$uploaddir = '';
//include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php
index 83f9706bcee..4cea8dcad9d 100644
--- a/htdocs/compta/facture/class/facture.class.php
+++ b/htdocs/compta/facture/class/facture.class.php
@@ -3105,6 +3105,7 @@ class Facture extends CommonInvoice
//Fetch current line from the database and then clone the object and set it in $oldline property
$line = new FactureLigne($this->db);
$line->fetch($rowid);
+ $line->fetch_optionals();
if (!empty($line->fk_product))
{
@@ -3173,7 +3174,10 @@ class Facture extends CommonInvoice
$this->line->multicurrency_total_ttc = $multicurrency_total_ttc;
if (is_array($array_options) && count($array_options) > 0) {
- $this->line->array_options = $array_options;
+ // We replace values in this->line->array_options only for entries defined into $array_options
+ foreach($array_options as $key => $value) {
+ $this->line->array_options[$key] = $array_options[$key];
+ }
}
$result = $this->line->update($user, $notrigger);
diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php
index bc7e7dc87a9..fccae47fd89 100644
--- a/htdocs/contrat/card.php
+++ b/htdocs/contrat/card.php
@@ -155,23 +155,7 @@ if (empty($reshook))
}
}
- // Si ajout champ produit libre
- if (GETPOST('mode') == 'libre')
- {
- $date_start_sl = '';
- $date_end_sl = '';
- if (GETPOST('date_start_slmonth') && GETPOST('date_start_slday') && GETPOST('date_start_slyear'))
- {
- $date_start_sl = dol_mktime(GETPOST('date_start_slhour'), GETPOST('date_start_slmin'), 0, GETPOST('date_start_slmonth'), GETPOST('date_start_slday'), GETPOST('date_start_slyear'));
- }
- if (GETPOST('date_end_slmonth') && GETPOST('date_end_slday') && GETPOST('date_end_slyear'))
- {
- $date_end_sl = dol_mktime(GETPOST('date_end_slhour'), GETPOST('date_end_slmin'), 0, GETPOST('date_end_slmonth'), GETPOST('date_end_slday'), GETPOST('date_end_slyear'));
- }
- }
-
// Param dates
- $date_contrat = '';
$date_start_update = '';
$date_end_update = '';
$date_start_real_update = '';
@@ -665,11 +649,12 @@ if (empty($reshook))
if (!$error)
{
$objectline = new ContratLigne($db);
- if ($objectline->fetch(GETPOST('elrowid')) < 0)
+ if ($objectline->fetch(GETPOST('elrowid', 'int')) < 0)
{
setEventMessages($objectline->error, $objectline->errors, 'errors');
$error++;
}
+ $objectline->fetch_optionals();
}
$db->begin();
@@ -693,6 +678,7 @@ if (empty($reshook))
$txtva = $vat_rate;
// Clean vat code
+ $reg = array();
$vat_src_code = '';
if (preg_match('/\((.*)\)/', $txtva, $reg))
{
@@ -735,7 +721,13 @@ if (empty($reshook))
// Extrafields
$extralabelsline = $extrafields->fetch_name_optionals_label($objectline->table_element);
$array_options = $extrafields->getOptionalsFromPost($object->table_element_line, $predef);
- $objectline->array_options = $array_options;
+
+ if (is_array($array_options) && count($array_options) > 0) {
+ // We replace values in this->line->array_options only for entries defined into $array_options
+ foreach($array_options as $key => $value) {
+ $objectline->array_options[$key] = $array_options[$key];
+ }
+ }
// TODO verifier price_min si fk_product et multiprix
diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php
index 086327db50a..eecd1ef67da 100644
--- a/htdocs/contrat/class/contrat.class.php
+++ b/htdocs/contrat/class/contrat.class.php
@@ -1739,8 +1739,14 @@ class Contrat extends CommonObject
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($array_options) && count($array_options) > 0) // For avoid conflicts if trigger used
{
$contractline = new ContratLigne($this->db);
- $contractline->array_options = $array_options;
- $contractline->id = $rowid;
+ $contractline->fetch($rowid);
+ $contractline->fetch_optionals();
+
+ // We replace values in $contractline->array_options only for entries defined into $array_options
+ foreach($array_options as $key => $value) {
+ $contractline->array_options[$key] = $array_options[$key];
+ }
+
$result = $contractline->insertExtraFields();
if ($result < 0)
{
diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index 3a8d2de15ca..76dd30f40fe 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -5187,7 +5187,6 @@ abstract class CommonObject
$attributeRequired = $extrafields->attributes[$this->table_element]['required'][$attributeKey];
$attrfieldcomputed = $extrafields->attributes[$this->table_element]['computed'][$attributeKey];
-
if ($attributeRequired)
{
$mandatorypb = false;
@@ -5218,7 +5217,6 @@ abstract class CommonObject
}
}
-
switch ($attributeType)
{
case 'int':
diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php
index 8479db591d9..ef5f5d4e74c 100644
--- a/htdocs/core/class/extrafields.class.php
+++ b/htdocs/core/class/extrafields.class.php
@@ -2147,23 +2147,27 @@ class ExtraFields
if (in_array($key_type, array('date', 'datetime')))
{
+ if (! GETPOSTISSET($keysuffix."options_".$key.$keyprefix)."year") continue; // Value was not provided, we should not set it.
// Clean parameters
- $value_key = dol_mktime($_POST[$keysuffix."options_".$key.$keyprefix."hour"], $_POST[$keysuffix."options_".$key.$keyprefix."min"], 0, $_POST[$keysuffix."options_".$key.$keyprefix."month"], $_POST[$keysuffix."options_".$key.$keyprefix."day"], $_POST[$keysuffix."options_".$key.$keyprefix."year"]);
+ $value_key = dol_mktime(GETPOST($keysuffix."options_".$key.$keyprefix."hour", 'int'), GETPOST($keysuffix."options_".$key.$keyprefix."min", 'int'), 0, GETPOST($keysuffix."options_".$key.$keyprefix."month", 'int'), GETPOST($keysuffix."options_".$key.$keyprefix."day", 'int'), GETPOST($keysuffix."options_".$key.$keyprefix."year", 'int'));
}
elseif (in_array($key_type, array('checkbox', 'chkbxlst')))
{
+ if (! GETPOSTISSET($keysuffix."options_".$key.$keyprefix)) continue; // Value was not provided, we should not set it.
$value_arr = GETPOST($keysuffix."options_".$key.$keyprefix);
// Make sure we get an array even if there's only one checkbox
$value_arr = (array) $value_arr;
$value_key = implode(',', $value_arr);
}
- elseif (in_array($key_type, array('price', 'double')))
+ elseif (in_array($key_type, array('price', 'double', 'int')))
{
+ if (! GETPOSTISSET($keysuffix."options_".$key.$keyprefix)) continue; // Value was not provided, we should not set it.
$value_arr = GETPOST($keysuffix."options_".$key.$keyprefix);
$value_key = price2num($value_arr);
}
else
{
+ if (! GETPOSTISSET($keysuffix."options_".$key.$keyprefix)) continue; // Value was not provided, we should not set it.
$value_key = GETPOST($keysuffix."options_".$key.$keyprefix);
}
diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php
index 253b745e25f..5a5a2c5628d 100644
--- a/htdocs/core/menus/standard/eldy.lib.php
+++ b/htdocs/core/menus/standard/eldy.lib.php
@@ -1474,7 +1474,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
// Cash Control
if (!empty($conf->takepos->enabled) || !empty($conf->cashdesk->enabled))
{
- $permtomakecashfence = ($user->rights->cashdesk->use || $user->rights->takepos->use);
+ $permtomakecashfence = ($user->rights->cashdesk->run || $user->rights->takepos->run);
$newmenu->add("/compta/cashcontrol/cashcontrol_list.php?action=list", $langs->trans("POS"), 0, $permtomakecashfence, '', $mainmenu, 'cashcontrol');
$newmenu->add("/compta/cashcontrol/cashcontrol_card.php?action=create", $langs->trans("NewCashFence"), 1, $permtomakecashfence);
$newmenu->add("/compta/cashcontrol/cashcontrol_list.php?action=list", $langs->trans("List"), 1, $permtomakecashfence);
diff --git a/htdocs/core/modules/modCashDesk.class.php b/htdocs/core/modules/modCashDesk.class.php
index 83495ca1af6..afb5185fb51 100644
--- a/htdocs/core/modules/modCashDesk.class.php
+++ b/htdocs/core/modules/modCashDesk.class.php
@@ -85,10 +85,10 @@ class modCashDesk extends DolibarrModules
$r++;
$this->rights[$r][0] = 50101;
- $this->rights[$r][1] = 'Use point of sale';
+ $this->rights[$r][1] = 'Use Point of sale';
$this->rights[$r][2] = 'a';
$this->rights[$r][3] = 0;
- $this->rights[$r][4] = 'use';
+ $this->rights[$r][4] = 'run';
// Main menu entries
$this->menus = array(); // List of menus to add
@@ -103,7 +103,7 @@ class modCashDesk extends DolibarrModules
'langs'=>'cashdesk', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
'position'=>900,
'enabled'=>'$conf->cashdesk->enabled',
- 'perms'=>'$user->rights->cashdesk->use', // Use 'perms'=>'1' if you want your menu with no permission rules
+ 'perms'=>'$user->rights->cashdesk->run', // Use 'perms'=>'1' if you want your menu with no permission rules
'target'=>'pointofsale',
'user'=>0); // 0=Menu for internal users, 1=external users, 2=both
diff --git a/htdocs/core/modules/modTakePos.class.php b/htdocs/core/modules/modTakePos.class.php
index b5f79f79d8d..515f18cf690 100644
--- a/htdocs/core/modules/modTakePos.class.php
+++ b/htdocs/core/modules/modTakePos.class.php
@@ -199,10 +199,10 @@ class modTakePos extends DolibarrModules
$r++;
$this->rights[$r][0] = 50151;
- $this->rights[$r][1] = 'Use point of sale';
+ $this->rights[$r][1] = 'Use Point Of Sale';
$this->rights[$r][2] = 'a';
$this->rights[$r][3] = 0;
- $this->rights[$r][4] = 'use';
+ $this->rights[$r][4] = 'run';
// Main menu entries
@@ -221,7 +221,7 @@ class modTakePos extends DolibarrModules
'langs'=>'cashdesk', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
'position'=>1000+$r,
'enabled'=>'$conf->takepos->enabled', // Define condition to show or hide menu entry. Use '$conf->takepos->enabled' if entry must be visible if module is enabled.
- 'perms'=>'1', // Use 'perms'=>'$user->rights->takepos->level1->level2' if you want your menu with a permission rules
+ 'perms'=>'$user->rights->takepos->run', // Use 'perms'=>'$user->rights->takepos->level1->level2' if you want your menu with a permission rules
'target'=>'takepos',
'user'=>2); // 0=Menu for internal users, 1=external users, 2=both
diff --git a/htdocs/core/tpl/objectline_edit.tpl.php b/htdocs/core/tpl/objectline_edit.tpl.php
index 095ddebdad6..7c76a5c0e07 100644
--- a/htdocs/core/tpl/objectline_edit.tpl.php
+++ b/htdocs/core/tpl/objectline_edit.tpl.php
@@ -105,7 +105,7 @@ $coldisplay++;
// Do not allow editing during a situation cycle
if ($line->fk_prev_id == null)
{
- // editeur wysiwyg
+ // editor wysiwyg
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$nbrows = ROWS_2;
if (!empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) $nbrows = $conf->global->MAIN_INPUT_DESC_HEIGHT;
diff --git a/htdocs/cron/class/cronjob.class.php b/htdocs/cron/class/cronjob.class.php
index b70707f1464..5cde792bbb5 100644
--- a/htdocs/cron/class/cronjob.class.php
+++ b/htdocs/cron/class/cronjob.class.php
@@ -1287,12 +1287,12 @@ class Cronjob extends CommonObject
/**
* Return label of status of user (active, inactive)
*
- * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
+ * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label of status
*/
public function getLibStatut($mode = 0)
{
- return $this->LibStatut($this->status, $mode, $this->processing);
+ return $this->LibStatut($this->status, $mode, $this->processing, $this->lastresult);
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
@@ -1300,13 +1300,17 @@ class Cronjob extends CommonObject
* Renvoi le libelle d'un statut donne
*
* @param int $status Id statut
- * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
+ * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @param int $processing 0=Not running, 1=Running
+ * @param int $lastresult Value of last result (0=no error, error otherwise)
* @return string Label of status
*/
- public function LibStatut($status, $mode = 0, $processing = 0)
+ public function LibStatut($status, $mode = 0, $processing = 0, $lastresult = 0)
{
// phpcs:enable
+ $this->labelStatus = array(); // Force reset o array because label depends on other fields
+ $this->labelStatusShort = array();
+
if (empty($this->labelStatus) || empty($this->labelStatusShort))
{
global $langs;
@@ -1314,6 +1318,7 @@ class Cronjob extends CommonObject
$moretext = '';
if ($processing) $moretext = ' ('.$langs->trans("Running").')';
+ elseif ($lastresult) $moretext .= ' ('.$langs->trans("Error").')';
$this->labelStatus[self::STATUS_DISABLED] = $langs->trans('Draft').$moretext;
$this->labelStatus[self::STATUS_ENABLED] = $langs->trans('Enabled').$moretext;
@@ -1324,6 +1329,7 @@ class Cronjob extends CommonObject
$statusType = 'status4';
if ($status == 1 && $processing) $statusType = 'status1';
if ($status == 0) $statusType = 'status5';
+ if ($this->lastresult) $statusType = 'status8';
return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode);
}
diff --git a/htdocs/cron/list.php b/htdocs/cron/list.php
index dd70d6d6913..ac9f178b163 100644
--- a/htdocs/cron/list.php
+++ b/htdocs/cron/list.php
@@ -425,6 +425,7 @@ if ($num > 0)
$object->status = $obj->status;
$object->priority = $obj->priority;
$object->processing = $obj->processing;
+ $object->lastresult = $obj->lastresult;
$datelastrun = $db->jdate($obj->datelastrun);
$datelastresult = $db->jdate($obj->datelastresult);
@@ -541,7 +542,7 @@ if ($num > 0)
// Status
print '