';
}
diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php
index 63bba22796c..dcead2541bd 100644
--- a/htdocs/core/lib/security.lib.php
+++ b/htdocs/core/lib/security.lib.php
@@ -179,6 +179,9 @@ function dolDecrypt($chain, $key = '')
if (preg_match('/^dolcrypt:([^:]+):(.+)$/', $chain, $reg)) {
$ciphering = $reg[1];
if (function_exists('openssl_decrypt')) {
+ if (empty($key)) {
+ return 'Error dolDecrypt decrypt key is empty';
+ }
$tmpexplode = explode(':', $reg[2]);
if (!empty($tmpexplode[1]) && is_string($tmpexplode[0])) {
$newchain = openssl_decrypt($tmpexplode[1], $ciphering, $key, 0, $tmpexplode[0]);
@@ -186,7 +189,7 @@ function dolDecrypt($chain, $key = '')
$newchain = openssl_decrypt($tmpexplode[0], $ciphering, $key, 0, null);
}
} else {
- $newchain = 'Error function openssl_decrypt() not available';
+ $newchain = 'Error dolDecrypt function openssl_decrypt() not available';
}
return $newchain;
} else {
diff --git a/htdocs/install/repair.php b/htdocs/install/repair.php
index 0d37f4d2dd7..c40f4a69e89 100644
--- a/htdocs/install/repair.php
+++ b/htdocs/install/repair.php
@@ -903,9 +903,8 @@ if ($ok && GETPOST('clean_product_stock_batch', 'alpha')) {
$sql = "SELECT p.rowid, p.ref, p.tobatch, ps.rowid as psrowid, ps.fk_entrepot, ps.reel, SUM(pb.qty) as reelbatch";
$sql .= " FROM ".MAIN_DB_PREFIX."product as p, ".MAIN_DB_PREFIX."product_stock as ps LEFT JOIN ".MAIN_DB_PREFIX."product_batch as pb ON ps.rowid = pb.fk_product_stock";
$sql .= " WHERE p.rowid = ps.fk_product";
- $sql .= " AND p.tobatch > 0";
$sql .= " GROUP BY p.rowid, p.ref, p.tobatch, ps.rowid, ps.fk_entrepot, ps.reel";
- $sql .= " HAVING reel != SUM(pb.qty) or SUM(pb.qty) IS NULL";
+ $sql .= " HAVING (SUM(pb.qty) IS NOT NULL AND reel != SUM(pb.qty)) OR (SUM(pb.qty) IS NULL AND p.tobatch > 0)";
print $sql;
$resql = $db->query($sql);
if ($resql) {
@@ -915,53 +914,73 @@ if ($ok && GETPOST('clean_product_stock_batch', 'alpha')) {
$i = 0;
while ($i < $num) {
$obj = $db->fetch_object($resql);
- print '
Product '.$obj->rowid.'-'.$obj->ref.' in warehouse id='.$obj->fk_entrepot.' (product_stock.id='.$obj->psrowid.'): '.$obj->reel.' (Stock product_stock.reel) != '.($obj->reelbatch ? $obj->reelbatch : '0').' (Stock batch sum product_batch)';
- // Fix
+ // Fix is required
if ($obj->reel != $obj->reelbatch) {
- if ($methodtofix == 'updatebatch') {
- // Method 1
- print ' -> Insert qty '.($obj->reel - $obj->reelbatch).' with lot 000000 linked to fk_product_stock='.$obj->psrowid;
+ if (empty($obj->tobatch)) {
+ // If product is not a product that support batches, we can clean stock by deleting the product batch lines
+ print ' -> Delete qty '.$obj->reelbatch.' for any lot linked to fk_product_stock='.$obj->psrowid;
+ $sql2 = "DELETE FROM ".MAIN_DB_PREFIX."product_batch";
+ $sql2 .= " WHERE fk_product_stock = ".((int) $obj->psrowid);
+ print ' '.$sql2;
+
if (GETPOST('clean_product_stock_batch') == 'confirmed') {
- $sql2 = "INSERT INTO ".MAIN_DB_PREFIX."product_batch(fk_product_stock, batch, qty)";
- $sql2 .= "VALUES(".$obj->psrowid.", '000000', ".($obj->reel - $obj->reelbatch).")";
$resql2 = $db->query($sql2);
if (!$resql2) {
- // TODO If it fails, we must make update
- //$sql2 ="UPDATE ".MAIN_DB_PREFIX."product_batch";
- //$sql2.=" SET ".$obj->psrowid.", '000000', ".($obj->reel - $obj->reelbatch).")";
- //$sql2.=" WHERE fk_product_stock = ".((int) $obj->psrowid)
- }
- }
- }
- if ($methodtofix == 'updatestock') {
- // Method 2
- print ' -> Update qty of product_stock with qty = '.($obj->reelbatch ? ((float) $obj->reelbatch) : '0').' for ps.rowid = '.((int) $obj->psrowid);
- if (GETPOST('clean_product_stock_batch') == 'confirmed') {
- $error = 0;
-
- $db->begin();
-
- $sql2 = "UPDATE ".MAIN_DB_PREFIX."product_stock";
- $sql2 .= " SET reel = ".($obj->reelbatch ? ((float) $obj->reelbatch) : '0')." WHERE rowid = ".((int) $obj->psrowid);
- $resql2 = $db->query($sql2);
- if ($resql2) {
- // We update product_stock, so we must fill p.stock into product too.
- $sql3 = 'UPDATE '.MAIN_DB_PREFIX.'product p SET p.stock= (SELECT SUM(ps.reel) FROM '.MAIN_DB_PREFIX.'product_stock ps WHERE ps.fk_product = p.rowid)';
- $resql3 = $db->query($sql3);
- if (!$resql3) {
- $error++;
- dol_print_error($db);
- }
- } else {
$error++;
dol_print_error($db);
}
+ }
+ } else {
+ if ($methodtofix == 'updatebatch') {
+ // Method 1
+ print ' -> Insert qty '.($obj->reel - $obj->reelbatch).' with lot 000000 linked to fk_product_stock='.$obj->psrowid;
+ $sql2 = "INSERT INTO ".MAIN_DB_PREFIX."product_batch(fk_product_stock, batch, qty)";
+ $sql2 .= "VALUES(".((int) $obj->psrowid).", '000000', ".((float) ($obj->reel - $obj->reelbatch)).")";
+ print ' '.$sql2;
- if (!$error) {
- $db->commit();
- } else {
- $db->rollback();
+ if (GETPOST('clean_product_stock_batch') == 'confirmed') {
+ $resql2 = $db->query($sql2);
+ if (!$resql2) {
+ // TODO If it fails, we must make update
+ //$sql2 ="UPDATE ".MAIN_DB_PREFIX."product_batch";
+ //$sql2.=" SET ".$obj->psrowid.", '000000', ".($obj->reel - $obj->reelbatch).")";
+ //$sql2.=" WHERE fk_product_stock = ".((int) $obj->psrowid)
+ }
+ }
+ }
+ if ($methodtofix == 'updatestock') {
+ // Method 2
+ print ' -> Update qty of product_stock with qty = '.($obj->reelbatch ? ((float) $obj->reelbatch) : '0').' for ps.rowid = '.((int) $obj->psrowid);
+ $sql2 = "UPDATE ".MAIN_DB_PREFIX."product_stock";
+ $sql2 .= " SET reel = ".($obj->reelbatch ? ((float) $obj->reelbatch) : '0')." WHERE rowid = ".((int) $obj->psrowid);
+ print ' '.$sql2;
+
+ if (GETPOST('clean_product_stock_batch') == 'confirmed') {
+ $error = 0;
+
+ $db->begin();
+
+ $resql2 = $db->query($sql2);
+ if ($resql2) {
+ // We update product_stock, so we must fill p.stock into product too.
+ $sql3 = 'UPDATE '.MAIN_DB_PREFIX.'product p SET p.stock= (SELECT SUM(ps.reel) FROM '.MAIN_DB_PREFIX.'product_stock ps WHERE ps.fk_product = p.rowid)';
+ $resql3 = $db->query($sql3);
+ if (!$resql3) {
+ $error++;
+ dol_print_error($db);
+ }
+ } else {
+ $error++;
+ dol_print_error($db);
+ }
+
+ if (!$error) {
+ $db->commit();
+ } else {
+ $db->rollback();
+ }
}
}
}
diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang
index 5d262f54200..164bfc3911c 100644
--- a/htdocs/langs/en_US/errors.lang
+++ b/htdocs/langs/en_US/errors.lang
@@ -308,7 +308,7 @@ ErrorExistingPermission = Permission %s for object %s already exis
ErrorFieldExist=The value for %s already exist
ErrorEqualModule=Module invalid in %s
ErrorFieldValue=Value for %s is incorrect
-ErrorCoherenceMenu=%s is required when % equal LEFT
+ErrorCoherenceMenu=%s is required when %s is 'left'
# Warnings
WarningParamUploadMaxFileSizeHigherThanPostMaxSize=Your PHP parameter upload_max_filesize (%s) is higher than PHP parameter post_max_size (%s). This is not a consistent setup.
diff --git a/htdocs/langs/en_US/interventions.lang b/htdocs/langs/en_US/interventions.lang
index 4119973d6dd..b92474e7f91 100644
--- a/htdocs/langs/en_US/interventions.lang
+++ b/htdocs/langs/en_US/interventions.lang
@@ -50,7 +50,7 @@ UseDateWithoutHourOnFichinter=Hides hours and minutes off the date field for int
InterventionStatistics=Statistics of interventions
NbOfinterventions=No. of intervention cards
NumberOfInterventionsByMonth=No. of intervention cards by month (date of validation)
-AmountOfInteventionNotIncludedByDefault=Amount of intervention is not included by default into profit (in most cases, timesheets are used to count time spent). Add option PROJECT_INCLUDE_INTERVENTION_AMOUNT_IN_PROFIT to 1 into home-setup-other to include them.
+AmountOfInteventionNotIncludedByDefault=Amount of intervention is not included by default into profit (in most cases, timesheets are used to count time spent). You can use PROJECT_ELEMENTS_FOR_ADD_MARGIN and PROJECT_ELEMENTS_FOR_MINUS_MARGIN option into home-setup-other to complete list of element included into profit.
InterId=Intervention id
InterRef=Intervention ref.
InterDateCreation=Date creation intervention
diff --git a/htdocs/partnership/class/partnership.class.php b/htdocs/partnership/class/partnership.class.php
index a202bdbd284..840569082b2 100644
--- a/htdocs/partnership/class/partnership.class.php
+++ b/htdocs/partnership/class/partnership.class.php
@@ -116,7 +116,7 @@ class Partnership extends CommonObject
'model_pdf' => array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>'1', 'position'=>1010, 'notnull'=>-1, 'visible'=>0,),
'date_partnership_start' => array('type'=>'date', 'label'=>'DatePartnershipStart', 'enabled'=>'1', 'position'=>52, 'notnull'=>1, 'visible'=>1,),
'date_partnership_end' => array('type'=>'date', 'label'=>'DatePartnershipEnd', 'enabled'=>'1', 'position'=>53, 'notnull'=>0, 'visible'=>1,),
- 'status' => array('type'=>'smallint', 'label'=>'Status', 'enabled'=>'1', 'position'=>54, 'notnull'=>0, 'visible'=>2, 'default'=>'0', 'index'=>1, 'arrayofkeyval'=>array('-1'=>'', '0'=>'Draft', '1'=>'Accepted', '2'=>'Refused', '8'=>'Suspended', '9'=>'Terminated'),),
+ 'status' => array('type'=>'smallint', 'label'=>'Status', 'enabled'=>'1', 'position'=>54, 'notnull'=>1, 'visible'=>2, 'default'=>'0', 'index'=>1, 'arrayofkeyval'=>array('0'=>'Draft', '1'=>'Accepted', '2'=>'Refused', '8'=>'Suspended', '9'=>'Terminated'),),
'url_to_check' => array('type'=>'varchar(255)', 'label'=>'UrlToCheck', 'enabled'=>'1', 'position'=>70, 'notnull'=>0, 'visible'=>-1,),
'count_last_url_check_error' => array('type'=>'integer', 'label'=>'CountLastUrlCheckError', 'enabled'=>'1', 'position'=>71, 'notnull'=>0, 'visible'=>-2, 'default'=>'0',),
'last_check_backlink' => array('type'=>'datetime', 'label'=>'LastCheckBacklink', 'enabled'=>'1', 'position'=>72, 'notnull'=>0, 'visible'=>-2,),
diff --git a/htdocs/product/list.php b/htdocs/product/list.php
index 3b911a4c2c7..9bd1a202245 100644
--- a/htdocs/product/list.php
+++ b/htdocs/product/list.php
@@ -1277,7 +1277,7 @@ if (!empty($arrayfields['p.stock']['checked'])) {
print_liste_field_titre($arrayfields['p.stock']['label'], $_SERVER["PHP_SELF"], "p.stock", "", $param, '', $sortfield, $sortorder, 'right ');
}
if (!empty($arrayfields['stock_virtual']['checked'])) {
- print_liste_field_titre($arrayfields['stock_virtual']['label'], $_SERVER["PHP_SELF"], "", "", $param, '', $sortfield, $sortorder, 'right ');
+ print_liste_field_titre($arrayfields['stock_virtual']['label'], $_SERVER["PHP_SELF"], "", "", $param, '', $sortfield, $sortorder, 'right ', 'VirtualStockDesc');
}
if (!empty($arrayfields['p.tobatch']['checked'])) {
print_liste_field_titre($arrayfields['p.tobatch']['label'], $_SERVER["PHP_SELF"], "p.tobatch", "", $param, '', $sortfield, $sortorder, 'center ');
@@ -1854,7 +1854,7 @@ while ($i < $imaxinloop) {
}
if ($usercancreadprice) {
if ($product_static->stock_reel < 0) { print ''; }
- print price(price2num($product_static->stock_reel, 'MS'));
+ print price(price2num($product_static->stock_reel, 'MS'), 0, $langs, 1, 0);
if ($product_static->stock_reel < 0) { print ''; }
}
}
@@ -1872,7 +1872,7 @@ while ($i < $imaxinloop) {
}
if ($usercancreadprice) {
if ($product_static->stock_theorique < 0) { print ''; }
- print price(price2num($product_static->stock_theorique, 'MS'));
+ print price(price2num($product_static->stock_theorique, 'MS'), 0, $langs, 1, 0);
if ($product_static->stock_theorique < 0) { print ''; }
}
}
diff --git a/htdocs/product/reassort.php b/htdocs/product/reassort.php
index 9946e7a9077..22c475ab337 100644
--- a/htdocs/product/reassort.php
+++ b/htdocs/product/reassort.php
@@ -493,7 +493,7 @@ if ($resql) {
print img_warning($langs->trans("StockLowerThanLimit", $objp->seuil_stock_alerte)).' ';
}
if ($objp->stock_physique < 0) { print ''; }
- print price2num($objp->stock_physique, 'MS');
+ print price(price2num($objp->stock_physique, 'MS'), 0, $langs, 1, 0);
if ($objp->stock_physique < 0) { print ''; }
print ' | ';
@@ -502,7 +502,7 @@ if ($resql) {
if ($nb_warehouse > 1) {
foreach ($warehouses_list as &$wh) {
print '';
- print empty($product->stock_warehouse[$wh['id']]->real) ? '0' : $product->stock_warehouse[$wh['id']]->real;
+ print price(empty($product->stock_warehouse[$wh['id']]->real) ? 0 : $product->stock_warehouse[$wh['id']]->real, 0, $langs, 1, 0);
print ' | ';
}
}
@@ -511,11 +511,11 @@ if ($resql) {
// Virtual stock
if ($virtualdiffersfromphysical) {
print '';
- if ($objp->seuil_stock_alerte != '' && ($product->stock_theorique < $objp->seuil_stock_alerte)) {
+ if ($objp->seuil_stock_alerte != '' && ($product->stock_theorique < (float) $objp->seuil_stock_alerte)) {
print img_warning($langs->trans("StockLowerThanLimit", $objp->seuil_stock_alerte)).' ';
}
if ($objp->stock_physique < 0) { print ''; }
- print price2num($product->stock_theorique, 'MS');
+ print price2num($product->stock_theorique, 'MS', 0, $langs, 1, 0);
if ($objp->stock_physique < 0) { print ''; }
print ' | ';
}
diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php
index 8f548685631..935275bfe54 100644
--- a/htdocs/projet/element.php
+++ b/htdocs/projet/element.php
@@ -475,7 +475,7 @@ $listofreferent = array(
'table'=>'fichinter',
'datefieldname'=>'date_valid',
'disableamount'=>0,
- 'margin'=>'minus',
+ 'margin'=>'',
'urlnew'=>DOL_URL_ROOT.'/fichinter/card.php?action=create&origin=project&originid='.$id.'&socid='.$socid.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.$id),
'lang'=>'interventions',
'buttonnew'=>'AddIntervention',
@@ -585,9 +585,9 @@ $listofreferent = array(
'name'=>"MouvementStockAssociated",
'title'=>"ListMouvementStockProject",
'class'=>'MouvementStock',
- 'margin'=>'minus',
'table'=>'stock_mouvement',
'datefieldname'=>'datem',
+ 'margin'=>'minus',
'disableamount'=>0,
'test'=>!empty($conf->stock->enabled) && $user->hasRight('stock', 'mouvement', 'lire') && !empty($conf->global->STOCK_MOVEMENT_INTO_PROJECT_OVERVIEW)),
'salaries'=>array(
@@ -752,6 +752,7 @@ $total_revenue_ht = 0;
$balance_ht = 0;
$balance_ttc = 0;
+// Loop on each element type (proposal, sale order, invoices, ...)
foreach ($listofreferent as $key => $value) {
$parameters = array(
'total_revenue_ht' =>& $total_revenue_ht,
@@ -787,6 +788,7 @@ foreach ($listofreferent as $key => $value) {
$total_ht = 0;
$total_ttc = 0;
+ // Loop on each object for the current element type
$num = count($elementarray);
for ($i = 0; $i < $num; $i++) {
$tmp = explode('_', $elementarray[$i]);
@@ -871,7 +873,7 @@ foreach ($listofreferent as $key => $value) {
$defaultvat = get_default_tva($mysoc, $mysoc);
$total_ttc_by_line = price2num($total_ht_by_line * (1 + ($defaultvat / 100)), 'MT');
} elseif ($key == 'loan') {
- $total_ttc_by_line = $total_ht_by_line; // For loan there is actually no taxe managed in Dolibarr
+ $total_ttc_by_line = $total_ht_by_line; // For loan there is actually no taxe managed in Dolibarr
} else {
$total_ttc_by_line = $element->total_ttc;
}
@@ -892,19 +894,14 @@ foreach ($listofreferent as $key => $value) {
}
// Each element with at least one line is output
- $qualifiedforfinalprofit = true;
- if ($key == 'intervention' && empty($conf->global->PROJECT_INCLUDE_INTERVENTION_AMOUNT_IN_PROFIT)) {
- $qualifiedforfinalprofit = false;
- }
- //var_dump($key.' '.$qualifiedforfinalprofit);
// Calculate margin
- if ($qualifiedforfinalprofit) {
- if ($margin == 'add') {
+ if ($margin) {
+ if ($margin === 'add') {
$total_revenue_ht += $total_ht;
}
- if ($margin != "add") { // Revert sign
+ if ($margin === "minus") { // Revert sign
$total_ht = -$total_ht;
$total_ttc = -$total_ttc;
}
@@ -920,24 +917,24 @@ foreach ($listofreferent as $key => $value) {
print ''.$i.' | ';
// Amount HT
print '';
- if ($key == 'intervention' && !$qualifiedforfinalprofit) {
+ if ($key == 'intervention' && !$margin) {
print ''.$form->textwithpicto($langs->trans("NA"), $langs->trans("AmountOfInteventionNotIncludedByDefault")).'';
} else {
- print price($total_ht);
if ($key == 'propal') {
print ''.$form->textwithpicto('', $langs->trans("SignedOnly")).'';
}
+ print price($total_ht);
}
print ' | ';
// Amount TTC
print '';
- if ($key == 'intervention' && !$qualifiedforfinalprofit) {
+ if ($key == 'intervention' && !$margin) {
print ''.$form->textwithpicto($langs->trans("NA"), $langs->trans("AmountOfInteventionNotIncludedByDefault")).'';
} else {
- print price($total_ttc);
if ($key == 'propal') {
print ''.$form->textwithpicto('', $langs->trans("SignedOnly")).'';
}
+ print price($total_ttc);
}
print ' | ';
print '
';
diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php
index fd89ec31367..dc80cb31e88 100644
--- a/htdocs/theme/eldy/global.inc.php
+++ b/htdocs/theme/eldy/global.inc.php
@@ -3983,6 +3983,10 @@ div.refidno {
font-size: ;
line-height: 1.4em;
}
+div.refaddress div.address {
+ line-height: 1.2em;
+ font-size: 0.95em;
+}
div.refidno form {
display: inline-block;
}
diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php
index 29b11c8a37b..bd0cc016db7 100644
--- a/htdocs/theme/md/style.css.php
+++ b/htdocs/theme/md/style.css.php
@@ -4062,7 +4062,7 @@ div.refidpadding {
div.refid {
font-weight: bold;
color: var(--colortexttitlenotab);
- font-size: 160%;
+ font-size: 120%;
}
a.refid {
color: var(--colortexttitlenotab) !important;
@@ -4072,11 +4072,15 @@ div.refidno {
font-weight: normal;
color: var(--refidnocolor);
font-size: ;
- line-height: 21px;
+ line-height: 1.3em;
}
div.refidno form {
display: inline-block;
}
+div.refaddress div.address {
+ line-height: 1.2em;
+ font-size: 0.9em;
+}
div.pagination {
float: right;