\n";
diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php
index d136855f37f..93cd6cfaab9 100644
--- a/htdocs/comm/propal/card.php
+++ b/htdocs/comm/propal/card.php
@@ -702,6 +702,7 @@ if (empty($reshook)) {
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CloseAs")), null, 'errors');
$action = 'closeas';
} elseif (GETPOST('statut', 'int') == $object::STATUS_SIGNED || GETPOST('statut', 'int') == $object::STATUS_NOTSIGNED) {
+ $locationTarget = '';
// prevent browser refresh from closing proposal several times
if ($object->statut == $object::STATUS_VALIDATED || ( ! empty($conf->global->PROPAL_SKIP_ACCEPT_REFUSE) && $object->statut == $object::STATUS_DRAFT)) {
$db->begin();
@@ -710,10 +711,12 @@ if (empty($reshook)) {
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
$error++;
+ } else {
+ // Needed if object linked modified by trigger (because linked objects can't be fetched two times : linkedObjectsFullLoaded)
+ $locationTarget = DOL_URL_ROOT . '/comm/propal/card.php?id=' . $object->id;
}
$deposit = null;
- $locationTarget = '';
$deposit_percent_from_payment_terms = getDictionaryValue('c_payment_term', 'deposit_percent', $object->cond_reglement_id);
diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php
index 7337e4a07da..9ae56a25e0d 100644
--- a/htdocs/comm/propal/list.php
+++ b/htdocs/comm/propal/list.php
@@ -1144,7 +1144,7 @@ if ($resql) {
$moreforfilter .= '';
}
// If the user can view products
- if (isModEnabled('categorie') && $user->hasRight('categorie', 'read') && ($user->hasRight('produit', 'lire') || $user->hasRight('service', 'lire'))) {
+ if (isModEnabled('categorie') && $user->hasRight('categorie', 'read') && ($user->hasRight('product', 'read') || $user->hasRight('service', 'read'))) {
$searchCategoryProductOperator = -1;
include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$tmptitle = $langs->trans('IncludingProductWithTag');
diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php
index 78ddfce7cf1..0cbfcefb562 100644
--- a/htdocs/commande/card.php
+++ b/htdocs/commande/card.php
@@ -695,20 +695,6 @@ if (empty($reshook)) {
$tva_tx = GETPOST('tva_tx', 'alpha');
- // Prepare a price equivalent for minimum price check
- $pu_equivalent = $pu_ht;
- $pu_equivalent_ttc = $pu_ttc;
- $currency_tx = $object->multicurrency_tx;
-
- // Check if we have a foreing currency
- // If so, we update the pu_equiv as the equivalent price in base currency
- if ($pu_ht == '' && $pu_ht_devise != '' && $currency_tx != '') {
- $pu_equivalent = $pu_ht_devise * $currency_tx;
- }
- if ($pu_ttc == '' && $pu_ttc_devise != '' && $currency_tx != '') {
- $pu_equivalent_ttc = $pu_ttc_devise * $currency_tx;
- }
-
$qty = price2num(GETPOST('qty'.$predef, 'alpha'), 'MS', 2);
$remise_percent = (GETPOSTISSET('remise_percent'.$predef) ? price2num(GETPOST('remise_percent'.$predef, 'alpha'), '', 2) : 0);
@@ -1000,6 +986,20 @@ if (empty($reshook)) {
$fournprice = price2num(GETPOST('fournprice'.$predef) ? GETPOST('fournprice'.$predef) : '');
$buyingprice = price2num(GETPOST('buying_price'.$predef) != '' ? GETPOST('buying_price'.$predef) : ''); // If buying_price is '0', we muste keep this value
+ // Prepare a price equivalent for minimum price check
+ $pu_equivalent = $pu_ht;
+ $pu_equivalent_ttc = $pu_ttc;
+ $currency_tx = $object->multicurrency_tx;
+
+ // Check if we have a foreing currency
+ // If so, we update the pu_equiv as the equivalent price in base currency
+ if ($pu_ht == '' && $pu_ht_devise != '' && $currency_tx != '') {
+ $pu_equivalent = $pu_ht_devise * $currency_tx;
+ }
+ if ($pu_ttc == '' && $pu_ttc_devise != '' && $currency_tx != '') {
+ $pu_equivalent_ttc = $pu_ttc_devise * $currency_tx;
+ }
+
// Local Taxes
$localtax1_tx = get_localtax($tva_tx, 1, $object->thirdparty);
$localtax2_tx = get_localtax($tva_tx, 2, $object->thirdparty);
diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index f42aa953ff5..9ea509677f1 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -7008,7 +7008,7 @@ abstract class CommonObject
$value = price($value);
}
$out = ' ';
- } elseif ($type == 'select') {
+ } elseif ($type == 'select') { // combo list
$out = '';
if (!empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_EXTRAFIELDS_DISABLE_SELECT2)) {
include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
@@ -7382,8 +7382,9 @@ abstract class CommonObject
$out = $form->selectForForms($param_list[0], $keyprefix.$key.$keysuffix, $value, $showempty, '', '', $morecss, $moreparam, 0, empty($val['disabled']) ? 0 : 1);
- if (!empty($param_list_array[2])) { // If the entry into $fields is set to add a create button
- if (!GETPOSTISSET('backtopage') && empty($val['disabled']) && empty($nonewbutton)) { // To avoid to open several times the 'Create Object' button and to avoid to have button if field is protected by a "disabled".
+ if (!empty($param_list_array[2])) { // If the entry into $fields is set, we must add a create button
+ if ((!GETPOSTISSET('backtopage') || strpos(GETPOST('backtopage'), $_SERVER['PHP_SELF']) === 0) // // To avoid to open several times the 'Plus' button (we accept only one level)
+ && empty($val['disabled']) && empty($nonewbutton)) { // and to avoid to show the button if the field is protected by a "disabled".
list($class, $classfile) = explode(':', $param_list[0]);
if (file_exists(dol_buildpath(dirname(dirname($classfile)).'/card.php'))) {
$url_path = dol_buildpath(dirname(dirname($classfile)).'/card.php', 1);
diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php
index 58451817686..364deb55dae 100644
--- a/htdocs/core/class/extrafields.class.php
+++ b/htdocs/core/class/extrafields.class.php
@@ -1734,11 +1734,12 @@ class ExtraFields
$translabel = '';
if (!empty($obj->$field_toshow)) {
$translabel = $langs->trans($obj->$field_toshow);
- }
- if ($translabel != $obj->$field_toshow) {
- $value .= dol_trunc($translabel, 24).' ';
- } else {
- $value .= $obj->$field_toshow.' ';
+
+ if ($translabel != $obj->$field_toshow) {
+ $value .= dol_trunc($translabel, 24).' ';
+ } else {
+ $value .= $obj->$field_toshow.' ';
+ }
}
}
} else {
diff --git a/htdocs/cron/list.php b/htdocs/cron/list.php
index 8e43526513b..cb4bd240ea4 100644
--- a/htdocs/cron/list.php
+++ b/htdocs/cron/list.php
@@ -647,7 +647,7 @@ if ($num > 0) {
print '';
// Duration
- print '
';
+ print '
';
if (!empty($datelastresult) && ($datelastresult >= $datelastrun)) {
$nbseconds = max($datelastresult - $datelastrun, 1);
print $nbseconds.' '.($nbseconds > 1 ? $langs->trans("SecondShort") : $langs->trans("SecondShort"));
diff --git a/htdocs/holiday/card.php b/htdocs/holiday/card.php
index 9d4e8a5c2d1..371f045668b 100644
--- a/htdocs/holiday/card.php
+++ b/htdocs/holiday/card.php
@@ -822,15 +822,15 @@ if (empty($reshook)) {
// If status pending validation and validator = validator or user, or rights to do for others
if (($object->statut == Holiday::STATUS_VALIDATED || $object->statut == Holiday::STATUS_APPROVED) &&
(!empty($user->admin) || $user->id == $object->fk_validator || $cancreate || $cancreateall)) {
- $db->begin();
+ $db->begin();
- $oldstatus = $object->statut;
- $object->date_cancel = dol_now();
- $object->fk_user_cancel = $user->id;
- $object->statut = Holiday::STATUS_CANCELED;
- $object->status = Holiday::STATUS_CANCELED;
+ $oldstatus = $object->statut;
+ $object->date_cancel = dol_now();
+ $object->fk_user_cancel = $user->id;
+ $object->statut = Holiday::STATUS_CANCELED;
+ $object->status = Holiday::STATUS_CANCELED;
- $result = $object->update($user);
+ $result = $object->update($user);
if ($result >= 0 && $oldstatus == Holiday::STATUS_APPROVED) { // holiday was already validated, status 3, so we must increase back the balance
// Call trigger
@@ -863,7 +863,7 @@ if (empty($reshook)) {
$db->rollback();
}
- // If no SQL error, we redirect to the request form
+ // If no SQL error, we redirect to the request form
if (!$error && $result > 0) {
// To
$destinataire = new User($db);
@@ -920,20 +920,20 @@ if (empty($reshook)) {
}
/*
- // Actions when printing a doc from card
- include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
+ // Actions when printing a doc from card
+ include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
- // Actions to send emails
- $triggersendname = 'HOLIDAY_SENTBYMAIL';
- $autocopy='MAIN_MAIL_AUTOCOPY_HOLIDAY_TO';
- $trackid='leav'.$object->id;
- include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
+ // Actions to send emails
+ $triggersendname = 'HOLIDAY_SENTBYMAIL';
+ $autocopy='MAIN_MAIL_AUTOCOPY_HOLIDAY_TO';
+ $trackid='leav'.$object->id;
+ include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
- // Actions to build doc
- $upload_dir = $conf->holiday->dir_output;
- $permissiontoadd = $user->rights->holiday->creer;
- include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
- */
+ // Actions to build doc
+ $upload_dir = $conf->holiday->dir_output;
+ $permissiontoadd = $user->rights->holiday->creer;
+ include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
+ */
}
diff --git a/htdocs/imports/import.php b/htdocs/imports/import.php
index e02c5e4ac25..5c0647c1575 100644
--- a/htdocs/imports/import.php
+++ b/htdocs/imports/import.php
@@ -1152,7 +1152,7 @@ if ($step == 4 && $datatoimport) {
$entity = (!empty($objimport->array_import_entities[0][$code]) ? $objimport->array_import_entities[0][$code] : $objimport->array_import_icon[0]);
$entityicon = !empty($entitytoicon[$entity]) ? $entitytoicon[$entity] : $entity; // $entityicon must string name of picto of the field like 'project', 'company', 'contact', 'modulename', ...
- $entitylang = $entitytolang[$entity] ? $entitytolang[$entity] : $objimport->array_import_label[0]; // $entitylang must be a translation key to describe object the field is related to, like 'Company', 'Contact', 'MyModyle', ...
+ $entitylang = !empty($entitytolang[$entity]) ? $entitytolang[$entity] : $objimport->array_import_label[0]; // $entitylang must be a translation key to describe object the field is related to, like 'Company', 'Contact', 'MyModyle', ...
print '
=>
';
print '
';
diff --git a/htdocs/install/step1.php b/htdocs/install/step1.php
index 61139927e17..043ffa30c7a 100644
--- a/htdocs/install/step1.php
+++ b/htdocs/install/step1.php
@@ -84,22 +84,34 @@ if (@file_exists($forcedfile)) {
// If forced install is enabled, replace the post values. These are empty because form fields are disabled.
if ($force_install_noedit) {
$main_dir = detect_dolibarr_main_document_root();
- if (!empty($argv[1])) {
- $main_dir = $argv[1]; // override when executing the script in command line
+ if (!empty($argv[3])) {
+ $main_dir = $argv[3]; // override when executing the script in command line
}
if (!empty($force_install_main_data_root)) {
$main_data_dir = $force_install_main_data_root;
} else {
$main_data_dir = detect_dolibarr_main_data_root($main_dir);
}
+ if (!empty($argv[4])) {
+ $main_data_dir = $argv[4]; // override when executing the script in command line
+ }
$main_url = detect_dolibarr_main_url_root();
+ if (!empty($argv[5])) {
+ $main_url = $argv[5]; // override when executing the script in command line
+ }
if (!empty($force_install_databaserootlogin)) {
$userroot = parse_database_login($force_install_databaserootlogin);
}
+ if (!empty($argv[6])) {
+ $userroot = $argv[6]; // override when executing the script in command line
+ }
if (!empty($force_install_databaserootpass)) {
$passroot = parse_database_pass($force_install_databaserootpass);
}
+ if (!empty($argv[7])) {
+ $passroot = $argv[7]; // override when executing the script in command line
+ }
}
if ($force_install_noedit == 2) {
if (!empty($force_install_type)) {
diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang
index e207fdfd8a6..586868e7eef 100644
--- a/htdocs/langs/fr_FR/admin.lang
+++ b/htdocs/langs/fr_FR/admin.lang
@@ -904,9 +904,9 @@ Permission609=Supprimer les étiquettes
Permission611=Lire les attributs des variantes produits
Permission612=Créer/mettre à jour les attributs des variantes produits
Permission613=Supprimer les attributs des variantes produits
-Permission650=Lire les Nomenclatures (BOM)
-Permission651=Créer/modifier les Nomenclatures (BOM)
-Permission652=Supprimer les Nomenclatures (BOM)
+Permission651=Lire les Nomenclatures (BOM)
+Permission652=Créer/modifier les Nomenclatures (BOM)
+Permission653=Supprimer les Nomenclatures (BOM)
Permission660=Lire les ordres de fabrication (OF)
Permission661=Créer/mettre à jour les ordres de fabrication (OF)
Permission662=Supprimer les ordres de fabrication (OF)
diff --git a/htdocs/product/card.php b/htdocs/product/card.php
index c8ad5047fe7..5e6eefc37be 100644
--- a/htdocs/product/card.php
+++ b/htdocs/product/card.php
@@ -693,10 +693,12 @@ if (empty($reshook)) {
$object->setCategories($categories);
if (!empty($backtopage)) {
- $backtopage = preg_replace('/__ID__/', $object->id, $backtopage); // New method to autoselect project after a New on another form object creation
+ $backtopage = preg_replace('/__ID__/', $object->id, $backtopage); // New method to autoselect parent project after a New on another form object creation
+ $backtopage = preg_replace('/--IDFORBACKTOPAGE--/', $object->id, $backtopage); // New method to autoselect parent after a New on another form object creation
if (preg_match('/\?/', $backtopage)) {
$backtopage .= '&productid='.$object->id; // Old method
}
+
header("Location: ".$backtopage);
exit;
} else {
diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php
index 2e6f9bc07c5..4cb05a812c6 100644
--- a/htdocs/product/class/product.class.php
+++ b/htdocs/product/class/product.class.php
@@ -2721,18 +2721,18 @@ class Product extends CommonObject
if ($resql) {
$result = $this->db->fetch_array($resql);
- $this->multiprices[$i] = $result["price"];
- $this->multiprices_ttc[$i] = $result["price_ttc"];
- $this->multiprices_min[$i] = $result["price_min"];
- $this->multiprices_min_ttc[$i] = $result["price_min_ttc"];
- $this->multiprices_base_type[$i] = $result["price_base_type"];
+ $this->multiprices[$i] = (!empty($result["price"]) ? $result["price"] : 0);
+ $this->multiprices_ttc[$i] = (!empty($result["price_ttc"]) ? $result["price_ttc"] : 0);
+ $this->multiprices_min[$i] = (!empty($result["price_min"]) ? $result["price_min"] : 0);
+ $this->multiprices_min_ttc[$i] = (!empty($result["price_min_ttc"]) ? $result["price_min_ttc"] : 0);
+ $this->multiprices_base_type[$i] = (!empty($result["price_base_type"]) ? $result["price_base_type"] : '');
// Next two fields are used only if PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL is on
- $this->multiprices_tva_tx[$i] = $result["tva_tx"]; // TODO Add ' ('.$result['default_vat_code'].')'
- $this->multiprices_recuperableonly[$i] = $result["recuperableonly"];
+ $this->multiprices_tva_tx[$i] = (!empty($result["tva_tx"]) ? $result["tva_tx"] : 0); // TODO Add ' ('.$result['default_vat_code'].')'
+ $this->multiprices_recuperableonly[$i] = (!empty($result["recuperableonly"]) ? $result["recuperableonly"] : 0);
// Price by quantity
- $this->prices_by_qty[$i] = $result["price_by_qty"];
- $this->prices_by_qty_id[$i] = $result["rowid"];
+ $this->prices_by_qty[$i] = (!empty($result["price_by_qty"]) ? $result["price_by_qty"] : 0);
+ $this->prices_by_qty_id[$i] = (!empty($result["rowid"]) ? $result["rowid"] : 0);
// Récuperation de la liste des prix selon qty si flag positionné
if ($this->prices_by_qty[$i] == 1) {
$sql = "SELECT rowid, price, unitprice, quantity, remise_percent, remise, price_base_type";