Merge remote-tracking branch 'Dolibarr/12.0' into 12
This commit is contained in:
commit
fe0c37f43d
@ -265,7 +265,7 @@ if ($action == 'writebookkeeping') {
|
||||
$bookkeeping->montant = $mt;
|
||||
$bookkeeping->sens = ($mt < 0) ? 'C' : 'D';
|
||||
$bookkeeping->debit = ($mt > 0) ? $mt : 0;
|
||||
$bookkeeping->credit = ($mt <= 0) ? $mt : 0;
|
||||
$bookkeeping->credit = ($mt <= 0) ? -$mt : 0;
|
||||
$bookkeeping->code_journal = $journal;
|
||||
$bookkeeping->journal_label = $journal_label;
|
||||
$bookkeeping->fk_user_author = $user->id;
|
||||
@ -325,7 +325,7 @@ if ($action == 'writebookkeeping') {
|
||||
$bookkeeping->montant = $mt;
|
||||
$bookkeeping->sens = ($mt < 0) ? 'C' : 'D';
|
||||
$bookkeeping->debit = ($mt > 0) ? $mt : 0;
|
||||
$bookkeeping->credit = ($mt <= 0) ? $mt : 0;
|
||||
$bookkeeping->credit = ($mt <= 0) ? -$mt : 0;
|
||||
$bookkeeping->code_journal = $journal;
|
||||
$bookkeeping->journal_label = $journal_label;
|
||||
$bookkeeping->fk_user_author = $user->id;
|
||||
@ -625,7 +625,7 @@ if (empty($action) || $action == 'view') {
|
||||
else print $accountoshow;
|
||||
print '</td>';
|
||||
print "<td>".$userstatic->getNomUrl(0, 'user', 16).' - '.$langs->trans("SubledgerAccount")."</td>";
|
||||
print '<td class="right nowraponall">'.($mt < 0 ? -price(-$mt) : '')."</td>";
|
||||
print '<td class="right nowraponall">'.($mt < 0 ? price(-$mt) : '')."</td>";
|
||||
print '<td class="right nowraponall">'.($mt >= 0 ? price($mt) : '')."</td>";
|
||||
print "</tr>";
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/* Copyright (C) 2007-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
/* Copyright (C) 2007-2020 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2009-2018 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
|
||||
*
|
||||
@ -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))
|
||||
@ -162,9 +171,7 @@ if ($action == 'edit')
|
||||
|
||||
print '</form>';
|
||||
print '<br>';
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
|
||||
|
||||
@ -203,9 +210,7 @@ if (empty($mysoc->country_code))
|
||||
$langs->load("errors");
|
||||
$warnpicto = img_warning($langs->trans("WarningMandatorySetupNotComplete"));
|
||||
print '<br><a href="'.DOL_URL_ROOT.'/admin/company.php?mainmenu=home">'.$warnpicto.' '.$langs->trans("WarningMandatorySetupNotComplete").'</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
// Show examples
|
||||
print load_fiche_titre($langs->trans("ExamplesWithCurrentSetup"), '', '');
|
||||
|
||||
@ -236,9 +241,9 @@ else
|
||||
// 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)
|
||||
@ -249,96 +254,54 @@ else
|
||||
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);
|
||||
} 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 '<span class="opacitymedium">'.$langs->trans("UnitPriceOfProduct").":</span> ".price2num($s, 'MU');
|
||||
print " x ".$langs->trans("Quantity").": ".$qty;
|
||||
print " - ".$langs->trans("VAT").": ".$vat.'%';
|
||||
print ' -> <span class="opacitymedium">'.$langs->trans("TotalPriceAfterRounding").":</span> ".$tmparray[0].' / '.$tmparray[1].' / '.$tmparray[2]."<br>\n";
|
||||
print ($vatarray['code'] ? ' ('.$vatarray['code'].')' : '');
|
||||
print ' -> <span class="opacitymedium">'.$langs->trans("TotalPriceAfterRounding").":</span> ";
|
||||
print $tmparray[0].' / '.$tmparray[1].($tmparray[9] ? '+'.$tmparray[9] : '').($tmparray[10] ? '+'.$tmparray[10] : '').' / '.$tmparray[2];
|
||||
print "<br>\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
// More examples if not specific vat rate found
|
||||
// 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 '<span class="opacitymedium">'.$langs->trans("UnitPriceOfProduct").":</span> ".price2num($s, 'MU');
|
||||
print " x ".$langs->trans("Quantity").": ".$qty;
|
||||
print " - ".$langs->trans("VAT").": ".$vat.'%';
|
||||
print ' -> <span class="opacitymedium">'.$langs->trans("TotalPriceAfterRounding").": ".$tmparray[0].' / '.$tmparray[1].' / '.$tmparray[2]."<br>\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 '<span class="opacitymedium">'.$langs->trans("UnitPriceOfProduct").":</span> ".price2num($s, 'MU');
|
||||
print " x ".$langs->trans("Quantity").": ".$qty;
|
||||
print " - ".$langs->trans("VAT").": ".$vat.'%';
|
||||
print ' -> <span class="opacitymedium">'.$langs->trans("TotalPriceAfterRounding").":</span> ".$tmparray[0].' / '.$tmparray[1].' / '.$tmparray[2]."<br>\n";
|
||||
}
|
||||
|
||||
// Important: can debug rounding, to simulate the rounded total
|
||||
/*
|
||||
print '<br><b>'.$langs->trans("VATRoundedByLine").' ('.$langs->trans("DolibarrDefault").')</b><br>';
|
||||
|
||||
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."<br>\n";
|
||||
}
|
||||
}
|
||||
|
||||
print '<br><b>'.$langs->trans("VATRoundedOnTotal").'</b><br>';
|
||||
|
||||
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."<br>\n";
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
// End of page
|
||||
|
||||
@ -822,7 +822,7 @@ if (empty($reshook))
|
||||
elseif ($action == 'addline' && $usercancreate) {
|
||||
// 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');
|
||||
|
||||
@ -1637,7 +1637,7 @@ if ($action == 'create' && $usercancreate)
|
||||
print '</td>';
|
||||
} else {
|
||||
print '<td>';
|
||||
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))
|
||||
{
|
||||
@ -2067,7 +2067,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);
|
||||
}
|
||||
|
||||
@ -1296,7 +1296,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
|
||||
|
||||
@ -448,8 +448,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])) {
|
||||
|
||||
@ -273,9 +273,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);
|
||||
|
||||
@ -351,17 +351,17 @@ 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');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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';
|
||||
|
||||
@ -808,7 +808,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++;
|
||||
@ -833,7 +834,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
|
||||
*
|
||||
@ -863,11 +864,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);
|
||||
}
|
||||
|
||||
|
||||
@ -272,6 +272,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))
|
||||
{
|
||||
@ -294,6 +295,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);
|
||||
@ -301,9 +303,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
|
||||
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user