*
@@ -34,11 +34,21 @@ if (!$user->admin) accessforbidden();
$action = GETPOST('action', 'alpha');
$currencycode = GETPOST('currencycode', 'alpha');
+if (!empty($conf->multicurrency->enabled) && !empty($conf->global->MULTICURRENCY_USE_LIMIT_BY_CURRENCY)) {
+ // When MULTICURRENCY_USE_LIMIT_BY_CURRENCY is on, we use always a defined currency code instead of '' even for default.
+ $currencycode = (!empty($currencycode) ? $currencycode : $conf->currency);
+}
+
$mainmaxdecimalsunit = 'MAIN_MAX_DECIMALS_UNIT'.(!empty($currencycode) ? '_'.$currencycode : '');
$mainmaxdecimalstot = 'MAIN_MAX_DECIMALS_TOT'.(!empty($currencycode) ? '_'.$currencycode : '');
$mainmaxdecimalsshown = 'MAIN_MAX_DECIMALS_SHOWN'.(!empty($currencycode) ? '_'.$currencycode : '');
$mainroundingruletot = 'MAIN_ROUNDING_RULE_TOT'.(!empty($currencycode) ? '_'.$currencycode : '');
+$valmainmaxdecimalsunit = GETPOST($mainmaxdecimalsunit, 'int');
+$valmainmaxdecimalstot = GETPOST($mainmaxdecimalstot, 'int');
+$valmainmaxdecimalsshown = GETPOST($mainmaxdecimalsshown, 'int');
+$valmainroundingruletot = price2num(GETPOST($mainroundingruletot, 'alpha'));
+
if ($action == 'update')
{
$error = 0;
@@ -60,9 +70,9 @@ if ($action == 'update')
setEventMessages($langs->trans("ErrorNegativeValueNotAllowed"), null, 'errors');
}
- if ($_POST[$mainroundingruletot])
+ if ($valmainroundingruletot)
{
- if ($_POST[$mainroundingruletot] * pow(10, $_POST[$mainmaxdecimalstot]) < 1)
+ if ($valmainroundingruletot * pow(10, $valmainmaxdecimalstot) < 1)
{
$langs->load("errors");
$error++;
@@ -72,11 +82,11 @@ if ($action == 'update')
if (!$error)
{
- dolibarr_set_const($db, $mainmaxdecimalsunit, $_POST[$mainmaxdecimalsunit], 'chaine', 0, '', $conf->entity);
- dolibarr_set_const($db, $mainmaxdecimalstot, $_POST[$mainmaxdecimalstot], 'chaine', 0, '', $conf->entity);
- dolibarr_set_const($db, $mainmaxdecimalsshown, $_POST[$mainmaxdecimalsshown], 'chaine', 0, '', $conf->entity);
+ dolibarr_set_const($db, $mainmaxdecimalsunit, $valmainmaxdecimalsunit, 'chaine', 0, '', $conf->entity);
+ dolibarr_set_const($db, $mainmaxdecimalstot, $valmainmaxdecimalstot, 'chaine', 0, '', $conf->entity);
+ dolibarr_set_const($db, $mainmaxdecimalsshown, $valmainmaxdecimalsshown, 'chaine', 0, '', $conf->entity);
- dolibarr_set_const($db, $mainroundingruletot, $_POST[$mainroundingruletot], 'chaine', 0, '', $conf->entity);
+ dolibarr_set_const($db, $mainroundingruletot, $valmainroundingruletot, 'chaine', 0, '', $conf->entity);
header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup".(!empty($currencycode) ? '¤cycode='.$currencycode : ''));
exit;
@@ -94,7 +104,6 @@ llxHeader();
print load_fiche_titre($langs->trans("LimitsSetup"), '', 'title_setup');
-$currencycode = (!empty($currencycode) ? $currencycode : $conf->currency);
$aCurrencies = array($conf->currency); // Default currency always first position
if (!empty($conf->multicurrency->enabled) && !empty($conf->global->MULTICURRENCY_USE_LIMIT_BY_CURRENCY))
@@ -232,9 +241,9 @@ if (empty($mysoc->country_code))
// Add vat rates examples specific to country
$vat_rates = array();
- $sql = "SELECT taux as vat_rate";
+ $sql = "SELECT taux as vat_rate, t.code as vat_code, t.localtax1 as localtax_rate1, t.localtax2 as localtax_rate2";
$sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_country as c";
- $sql .= " WHERE t.active=1 AND t.fk_pays = c.rowid AND c.code='".$mysoc->country_code."' AND t.taux <> 0";
+ $sql .= " WHERE t.active=1 AND t.fk_pays = c.rowid AND c.code='".$mysoc->country_code."' AND (t.taux <> 0 OR t.localtax1 <>0 OR t.localtax2 <>0)";
$sql .= " ORDER BY t.taux ASC";
$resql = $db->query($sql);
if ($resql)
@@ -245,23 +254,31 @@ if (empty($mysoc->country_code))
for ($i = 0; $i < $num; $i++)
{
$obj = $db->fetch_object($resql);
- $vat_rates[$i] = $obj->vat_rate;
+ $vat_rates[] = array('vat_rate'=>$obj->vat_rate, 'code'=>$obj->vat_code, 'localtax_rate1'=>$obj->localtax_rate1, 'locltax_rate2'=>$obj->localtax_rate2);
}
}
} else dol_print_error($db);
if (count($vat_rates))
{
- foreach ($vat_rates as $vat)
+ foreach ($vat_rates as $vatarray)
{
+ $vat = $vatarray['vat_rate'];
for ($qty = 1; $qty <= 2; $qty++)
{
+ $vattxt = $vat.($vatarray['code'] ? ' ('.$vatarray['code'].')' : '');
+
+ $localtax_array = getLocalTaxesFromRate($vattxt, 0, $mysoc, $mysoc);
+
$s = 10 / 3;
- $tmparray = calcul_price_total(1, $qty * price2num($s, 'MU'), 0, $vat, 0, 0, 0, 'HT', 0, 0, $mysoc);
+ $tmparray = calcul_price_total($qty, price2num($s, 'MU'), 0, $vat, -1, -1, 0, 'HT', 0, 0, $mysoc, $localtax_array);
print ''.$langs->trans("UnitPriceOfProduct").": ".price2num($s, 'MU');
print " x ".$langs->trans("Quantity").": ".$qty;
print " - ".$langs->trans("VAT").": ".$vat.'%';
- print ' -> '.$langs->trans("TotalPriceAfterRounding").": ".$tmparray[0].' / '.$tmparray[1].' / '.$tmparray[2]."
\n";
+ print ($vatarray['code'] ? ' ('.$vatarray['code'].')' : '');
+ print ' -> '.$langs->trans("TotalPriceAfterRounding").": ";
+ print $tmparray[0].' / '.$tmparray[1].($tmparray[9] ? '+'.$tmparray[9] : '').($tmparray[10] ? '+'.$tmparray[10] : '').' / '.$tmparray[2];
+ print "
\n";
}
}
} else {
@@ -269,69 +286,22 @@ if (empty($mysoc->country_code))
// This example must be kept for test purpose with current value because value used (2/7, 10/3, and vat 0, 10)
// were calculated to show all possible cases of rounding. If we change this, examples becomes useless or show the same rounding rule.
+ $localtax_array = array();
+
$s = 10 / 3; $qty = 1; $vat = 10;
- $tmparray = calcul_price_total(1, $qty * price2num($s, 'MU'), 0, $vat, 0, 0, 0, 'HT', 0, 0, $mysoc);
+ $tmparray = calcul_price_total($qty, price2num($s, 'MU'), 0, $vat, -1, -1, 0, 'HT', 0, 0, $mysoc, $localtax_array);
print ''.$langs->trans("UnitPriceOfProduct").": ".price2num($s, 'MU');
print " x ".$langs->trans("Quantity").": ".$qty;
print " - ".$langs->trans("VAT").": ".$vat.'%';
print ' -> '.$langs->trans("TotalPriceAfterRounding").": ".$tmparray[0].' / '.$tmparray[1].' / '.$tmparray[2]."
\n";
$s = 10 / 3; $qty = 2; $vat = 10;
- $tmparray = calcul_price_total(1, $qty * price2num($s, 'MU'), 0, $vat, 0, 0, 0, 'HT', 0, 0, $mysoc);
+ $tmparray = calcul_price_total($qty, price2num($s, 'MU'), 0, $vat, -1, -1, 0, 'HT', 0, 0, $mysoc, $localtax_array);
print ''.$langs->trans("UnitPriceOfProduct").": ".price2num($s, 'MU');
print " x ".$langs->trans("Quantity").": ".$qty;
print " - ".$langs->trans("VAT").": ".$vat.'%';
print ' -> '.$langs->trans("TotalPriceAfterRounding").": ".$tmparray[0].' / '.$tmparray[1].' / '.$tmparray[2]."
\n";
}
-
- // Important: can debug rounding, to simulate the rounded total
- /*
- print '
'.$langs->trans("VATRoundedByLine").' ('.$langs->trans("DolibarrDefault").')
';
-
- foreach($vat_rates as $vat)
- {
- for ($qty=1; $qty<=2; $qty++)
- {
- $s1=10/3;
- $s2=2/7;
-
- // Round by line
- $tmparray1=calcul_price_total(1,$qty*price2num($s1,'MU'),0,$vat,0,0,0,'HT',0, 0,$mysoc);
- $tmparray2=calcul_price_total(1,$qty*price2num($s2,'MU'),0,$vat,0,0,0,'HT',0, 0,$mysoc);
- $total_ht = $tmparray1[0] + $tmparray2[0];
- $total_tva = $tmparray1[1] + $tmparray2[1];
- $total_ttc = $tmparray1[2] + $tmparray2[2];
-
- print $langs->trans("UnitPriceOfProduct").": ".(price2num($s1,'MU') + price2num($s2,'MU'));
- print " x ".$langs->trans("Quantity").": ".$qty;
- print " - ".$langs->trans("VAT").": ".$vat.'%';
- print " -> ".$langs->trans("TotalPriceAfterRounding").": ".$total_ht.' / '.$total_tva.' / '.$total_ttc."
\n";
- }
- }
-
- print '
'.$langs->trans("VATRoundedOnTotal").'
';
-
- foreach($vat_rates as $vat)
- {
- for ($qty=1; $qty<=2; $qty++)
- {
- $s1=10/3;
- $s2=2/7;
-
- // Global round
- $subtotal_ht = (($qty*price2num($s1,'MU')) + ($qty*price2num($s2,'MU')));
- $tmparray3=calcul_price_total(1,$subtotal_ht,0,$vat,0,0,0,'HT',0, 0,$mysoc);
- $total_ht = $tmparray3[0];
- $total_tva = $tmparray3[1];
- $total_ttc = $tmparray3[2];
-
- print $langs->trans("UnitPriceOfProduct").": ".price2num($s1+$s2,'MU');
- print " x ".$langs->trans("Quantity").": ".$qty;
- print " - ".$langs->trans("VAT").": ".$vat.'%';
- print " -> ".$langs->trans("TotalPriceAfterRounding").": ".$total_ht.' / '.$total_tva.' / '.$total_ttc."
\n";
- }
- }
- */
}
// End of page
diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php
index a2259b10a37..72c7826e61b 100644
--- a/htdocs/comm/propal/card.php
+++ b/htdocs/comm/propal/card.php
@@ -790,7 +790,7 @@ if (empty($reshook))
} elseif ($action == 'addline' && $usercancreate) { // Add line
// Set if we used free entry or predefined product
$predef = '';
- $product_desc = (GETPOST('dp_desc') ?GETPOST('dp_desc') : '');
+ $product_desc = (GETPOST('dp_desc', 'none') ?GETPOST('dp_desc', 'none') : '');
$price_ht = GETPOST('price_ht');
$price_ht_devise = GETPOST('multicurrency_price_ht');
$prod_entry_mode = GETPOST('prod_entry_mode');
diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php
index ab3aa443642..8cc3fd48aca 100644
--- a/htdocs/commande/card.php
+++ b/htdocs/commande/card.php
@@ -1580,7 +1580,7 @@ if ($action == 'create' && $usercancreate)
print '';
} else {
print '';
- print $form->select_company('', 'socid', '(s.client = 1 OR s.client = 3)', 'SelectThirdParty', 0, 0, null, 0, 'minwidth300');
+ print $form->select_company('', 'socid', '(s.client = 1 OR s.client = 2 OR s.client = 3)', 'SelectThirdParty', 0, 0, null, 0, 'minwidth300');
// reload page to retrieve customer informations
if (!empty($conf->global->RELOAD_PAGE_ON_CUSTOMER_CHANGE))
{
@@ -2003,7 +2003,7 @@ if ($action == 'create' && $usercancreate)
if ($action == 'clone') {
// Create an array for form
$formquestion = array(
- array('type' => 'other', 'name' => 'socid', 'label' => $langs->trans("SelectThirdParty"), 'value' => $form->select_company(GETPOST('socid', 'int'), 'socid', '(s.client=1 OR s.client=3)'))
+ array('type' => 'other', 'name' => 'socid', 'label' => $langs->trans("SelectThirdParty"), 'value' => $form->select_company(GETPOST('socid', 'int'), 'socid', '(s.client=1 OR s.client = 2 OR s.client=3)'))
);
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneOrder', $object->ref), 'confirm_clone', $formquestion, 'yes', 1);
}
diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php
index 0ba99700f1b..0b8b99bd395 100644
--- a/htdocs/core/class/commondocgenerator.class.php
+++ b/htdocs/core/class/commondocgenerator.class.php
@@ -1286,7 +1286,7 @@ abstract class CommonDocGenerator
{
// Sort extrafields by rank
uasort($fields, function ($a, $b) {
- return ($a->rank > $b->rank) ? -1 : 1;
+ return ($a->rank > $b->rank) ? 1 : -1;
});
// define some HTML content with style
diff --git a/htdocs/core/db/mysqli.class.php b/htdocs/core/db/mysqli.class.php
index 4f634835461..ed7b2e5947d 100644
--- a/htdocs/core/db/mysqli.class.php
+++ b/htdocs/core/db/mysqli.class.php
@@ -440,8 +440,9 @@ class DoliDBMysqli extends DoliDB
1215 => 'DB_ERROR_CANNOT_ADD_FOREIGN_KEY_CONSTRAINT',
1216 => 'DB_ERROR_NO_PARENT',
1217 => 'DB_ERROR_CHILD_EXISTS',
- 1396 => 'DB_ERROR_USER_ALREADY_EXISTS', // When creating user already existing
- 1451 => 'DB_ERROR_CHILD_EXISTS'
+ 1396 => 'DB_ERROR_USER_ALREADY_EXISTS', // When creating a user that already existing
+ 1451 => 'DB_ERROR_CHILD_EXISTS',
+ 1826 => 'DB_ERROR_KEY_NAME_ALREADY_EXISTS'
);
if (isset($errorcode_map[$this->db->errno])) {
diff --git a/htdocs/core/lib/admin.lib.php b/htdocs/core/lib/admin.lib.php
index ef250d36795..cb5fd58874b 100644
--- a/htdocs/core/lib/admin.lib.php
+++ b/htdocs/core/lib/admin.lib.php
@@ -268,9 +268,10 @@ function run_sql($sqlfile, $silent = 1, $entity = '', $usesavepoint = 1, $handle
if ($offsetforchartofaccount > 0)
{
// Replace lines
- // 'INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1401, 'PCG99-ABREGE','CAPIT', 'XXXXXX', '1', '0', '...', 1);'
+ // 'INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1401, 'PCG99-ABREGE', 'CAPIT', '1234', 1400, '...', 1);'
// with
- // 'INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1401 + 200100000, 'PCG99-ABREGE','CAPIT', 'XXXXXX', '1', '0', '...', 1);'
+ // 'INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1401 + 200100000, 'PCG99-ABREGE','CAPIT', '1234', 1400 + 200100000, '...', 1);'
+ // Note: string with 1234 instead of '1234' is also supported
$newsql = preg_replace('/VALUES\s*\(__ENTITY__, \s*(\d+)\s*,(\s*\'[^\',]*\'\s*,\s*\'[^\',]*\'\s*,\s*\'?[^\',]*\'?\s*),\s*\'?([^\',]*)\'?/ims', 'VALUES (__ENTITY__, \1 + '.$offsetforchartofaccount.', \2, \3 + '.$offsetforchartofaccount, $newsql);
$newsql = preg_replace('/([,\s])0 \+ '.$offsetforchartofaccount.'/ims', '\1 0', $newsql);
//var_dump($newsql);
diff --git a/htdocs/core/lib/price.lib.php b/htdocs/core/lib/price.lib.php
index f453f543305..7def1ec85fa 100644
--- a/htdocs/core/lib/price.lib.php
+++ b/htdocs/core/lib/price.lib.php
@@ -343,15 +343,15 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocalt
{
$result[0] = round($result[0] / $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT;
$result[1] = round($result[1] / $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT;
- $result[2] = price2num($result[0] + $result[1], 'MT');
$result[9] = round($result[9] / $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT;
$result[10] = round($result[10] / $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT;
+ $result[2] = price2num($result[0] + $result[1] + $result[9] + $result[10], 'MT');
} else {
$result[1] = round($result[1] / $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT;
$result[2] = round($result[2] / $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT;
- $result[0] = price2num($result[2] - $result[1], 'MT');
$result[9] = round($result[9] / $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT;
$result[10] = round($result[10] / $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT;
+ $result[0] = price2num($result[2] - $result[1] - $result[9] - $result[10], 'MT');
}
}
diff --git a/htdocs/install/mysql/data/llx_20_c_departements.sql b/htdocs/install/mysql/data/llx_20_c_departements.sql
index 46d9b4d712e..54ab237c9b8 100644
--- a/htdocs/install/mysql/data/llx_20_c_departements.sql
+++ b/htdocs/install/mysql/data/llx_20_c_departements.sql
@@ -1102,6 +1102,7 @@ INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, nc
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('PY', 11701, NULL, 0, 'PY', 'Puducherry', 1);
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('RJ', 11701, NULL, 0, 'RJ', 'Rajasthan', 1);
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('SK', 11701, NULL, 0, 'SK', 'Sikkim', 1);
+INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('TE', 11701, NULL, 0, 'TE', 'Telangana', 1);
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('TN', 11701, NULL, 0, 'TN', 'Tamil Nadu', 1);
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('TR', 11701, NULL, 0, 'TR', 'Tripura', 1);
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('UL', 11701, NULL, 0, 'UL', 'Uttarakhand', 1);
@@ -1145,7 +1146,7 @@ INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, nc
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('SU', 11801, NULL, 0, 'SU', 'Sumatera Utara ', 1);
-- Provinces Mexique (id country=154)
-INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('DIF', 15401, '', 0, 'DIF', 'Distrito Federal', 1);
+INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('CMX', 15401, '', 0, 'CMX', 'Ciudad de México', 1);
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('AGS', 15401, '', 0, 'AGS', 'Aguascalientes', 1);
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('BCN', 15401, '', 0, 'BCN', 'Baja California Norte', 1);
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('BCS', 15401, '', 0, 'BCS', 'Baja California Sur', 1);
diff --git a/htdocs/install/mysql/migration/11.0.0-12.0.0.sql b/htdocs/install/mysql/migration/11.0.0-12.0.0.sql
index 4958d4019f4..4222ea54ee5 100644
--- a/htdocs/install/mysql/migration/11.0.0-12.0.0.sql
+++ b/htdocs/install/mysql/migration/11.0.0-12.0.0.sql
@@ -250,7 +250,10 @@ INSERT INTO llx_c_ticket_resolution (code, pos, label, active, use_default, desc
DELETE FROM llx_const WHERE name = __ENCRYPT('DONATION_ART885')__;
-ALTER TABLE llx_extrafields MODIFY COLUMN printable integer DEFAULT 0;
+-- VMYSQL4.1 ALTER TABLE llx_extrafields MODIFY COLUMN printable integer DEFAULT 0;
+-- VPGSQL8.2 ALTER TABLE llx_extrafields ALTER COLUMN printable DROP DEFAULT;
+-- VPGSQL8.2 ALTER TABLE llx_extrafields MODIFY COLUMN printable integer USING printable::integer;
+-- VPGSQL8.2 ALTER TABLE llx_extrafields ALTER COLUMN printable SET DEFAULT 0;
ALTER TABLE llx_extrafields ADD COLUMN printable integer DEFAULT 0;
UPDATE llx_const SET name = 'INVOICE_USE_RETAINED_WARRANTY' WHERE name = 'INVOICE_USE_SITUATION_RETAINED_WARRANTY';
diff --git a/htdocs/product/class/api_products.class.php b/htdocs/product/class/api_products.class.php
index e7fce1b480f..9b714ec647b 100644
--- a/htdocs/product/class/api_products.class.php
+++ b/htdocs/product/class/api_products.class.php
@@ -804,7 +804,8 @@ class Products extends DolibarrApi
foreach ($product_fourn_list as $tmpobj) {
$this->_cleanObjectDatas($tmpobj);
}
- //var_dump($product_fourn_list->db);exit;
+
+ //var_dump($product_fourn_list->db);exit;
$obj_ret[$obj->rowid] = $product_fourn_list;
$i++;
@@ -828,7 +829,7 @@ class Products extends DolibarrApi
* @param string $ref Ref of element
* @param string $ref_ext Ref ext of element
* @param string $barcode Barcode of element
- * @return array|mixed Data without useless information
+ * @return array|mixed Data without useless information
*
* @url GET {id}/purchase_prices
*
@@ -858,11 +859,17 @@ class Products extends DolibarrApi
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
+ $product_fourn_list = array();
+
if ($result) {
$product_fourn = new ProductFournisseur($this->db);
$product_fourn_list = $product_fourn->list_product_fournisseur_price($this->product->id, '', '', 0, 0);
}
+ foreach($product_fourn_list as $tmpobj) {
+ $this->_cleanObjectDatas($tmpobj);
+ }
+
return $this->_cleanObjectDatas($product_fourn_list);
}
diff --git a/htdocs/projet/activity/perday.php b/htdocs/projet/activity/perday.php
index 41def74cf1d..adf35d8bc3b 100644
--- a/htdocs/projet/activity/perday.php
+++ b/htdocs/projet/activity/perday.php
@@ -263,6 +263,7 @@ if ($action == 'addtime' && $user->rights->projet->lire && GETPOST('formfilterac
{
if (intval($time) > 0)
{
+ $matches = array();
// Hours or minutes of duration
if (preg_match("/([0-9]+)duration(hour|min)/", $key, $matches))
{
@@ -285,6 +286,7 @@ if ($action == 'addtime' && $user->rights->projet->lire && GETPOST('formfilterac
foreach ($timespent_duration as $key => $val)
{
$object->fetch($key);
+ $taskid = $object->id;
if (GETPOSTISSET($taskid.'progress')) $object->progress = GETPOST($taskid.'progress', 'int');
else unset($object->progress);
@@ -292,9 +294,9 @@ if ($action == 'addtime' && $user->rights->projet->lire && GETPOST('formfilterac
$object->timespent_duration = $val;
$object->timespent_fk_user = $usertoprocess->id;
$object->timespent_note = GETPOST($key.'note');
- if (GETPOST($key."hour") != '' && GETPOST($key."hour") >= 0) // If hour was entered
+ if (GETPOST($key."hour", 'int') != '' && GETPOST($key."hour", 'int') >= 0) // If hour was entered
{
- $object->timespent_datehour = dol_mktime(GETPOST($key."hour"), GETPOST($key."min"), 0, $monthofday, $dayofday, $yearofday);
+ $object->timespent_datehour = dol_mktime(GETPOST($key."hour", 'int'), GETPOST($key."min", 'int'), 0, $monthofday, $dayofday, $yearofday);
$object->timespent_withhour = 1;
} else {
$object->timespent_datehour = dol_mktime(12, 0, 0, $monthofday, $dayofday, $yearofday);
diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php
index 9f87b8d295a..c3600ce75e0 100644
--- a/htdocs/societe/class/societe.class.php
+++ b/htdocs/societe/class/societe.class.php
@@ -725,6 +725,8 @@ class Societe extends CommonObject
*/
public function __construct($db)
{
+ global $conf;
+
$this->db = $db;
$this->client = 0;
@@ -735,6 +737,13 @@ class Societe extends CommonObject
$this->forme_juridique_code = 0;
$this->tva_assuj = 1;
$this->status = 1;
+
+ if ($conf->global->COMPANY_SHOW_ADDRESS_SELECTLIST) {
+ $this->fields['address']['showoncombobox'] = $conf->global->COMPANY_SHOW_ADDRESS_SELECTLIST;
+ $this->fields['zip']['showoncombobox'] = $conf->global->COMPANY_SHOW_ADDRESS_SELECTLIST;
+ $this->fields['town']['showoncombobox'] = $conf->global->COMPANY_SHOW_ADDRESS_SELECTLIST;
+ //$this->fields['fk_pays']['showoncombobox'] = $conf->global->COMPANY_SHOW_ADDRESS_SELECTLIST;
+ }
}
|