Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur 2018-05-02 19:05:18 +02:00
commit 3aeb2d2ad1
11 changed files with 64 additions and 22 deletions

View File

@ -360,9 +360,11 @@ class AccountancyCategory // extends CommonObject
* @return int <0 if KO, 0 if not found, >0 if OK
*/
public function display($id) {
global $conf;
$sql = "SELECT t.rowid, t.account_number, t.label";
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as t";
$sql .= " WHERE t.fk_accounting_category = " . $id;
$sql .= " AND t.entity = " . $conf->entity;
$this->lines_display = array();
@ -400,13 +402,14 @@ class AccountancyCategory // extends CommonObject
$sql .= " WHERE t.numero_compte NOT IN (";
$sql .= " SELECT t.account_number";
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as t";
$sql .= " WHERE t.fk_accounting_category = " . $id . ")";
$sql .= " WHERE t.fk_accounting_category = " . $id . " AND t.entity = " . $conf->entity.")";
$sql .= " AND t.numero_compte IN (";
$sql .= " SELECT DISTINCT aa.account_number";
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as aa";
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version";
$sql .= " AND asy.rowid = " . $conf->global->CHARTOFACCOUNTS;
$sql .= " AND aa.active = 1)";
$sql .= " AND aa.active = 1";
$sql .= " AND aa.entity = = " . $conf->entity . ")";
$sql .= " GROUP BY t.numero_compte, t.label_operation, t.doc_ref";
$sql .= " ORDER BY t.numero_compte";
@ -448,6 +451,7 @@ class AccountancyCategory // extends CommonObject
$sql .= " WHERE (aa.fk_accounting_category != ".$id." OR aa.fk_accounting_category IS NULL)";
$sql .= " AND asy.rowid = " . $conf->global->CHARTOFACCOUNTS;
$sql .= " AND aa.active = 1";
$sql .= " AND aa.entity = " . $conf->entity;
$sql .= " GROUP BY aa.account_number, aa.label";
$sql .= " ORDER BY aa.account_number, aa.label";
@ -492,6 +496,7 @@ class AccountancyCategory // extends CommonObject
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version";
$sql .= " AND asy.rowid = " . $conf->global->CHARTOFACCOUNTS;
$sql .= " AND aa.active = 1";
$sql .= " AND aa.entity = " . $conf->entity;
$this->db->begin();
@ -581,7 +586,7 @@ class AccountancyCategory // extends CommonObject
*/
public function getCatsCpts()
{
global $mysoc;
global $mysoc,$conf;
$sql = "";
@ -595,8 +600,10 @@ class AccountancyCategory // extends CommonObject
$sql .= " WHERE t.fk_accounting_category IN ( SELECT c.rowid ";
$sql .= " FROM " . MAIN_DB_PREFIX . "c_accounting_category as c";
$sql .= " WHERE c.active = 1";
$sql .= " AND c.entity = " . $conf->entity;
$sql .= " AND (c.fk_country = ".$mysoc->country_id." OR c.fk_country = 0)";
$sql .= " AND cat.rowid = t.fk_accounting_category";
$sql .= " AND t.entity = " . $conf->entity;
$sql .= " ORDER BY cat.position ASC";
$resql = $this->db->query($sql);
@ -685,7 +692,7 @@ class AccountancyCategory // extends CommonObject
*/
public function getCats($categorytype=-1)
{
global $db, $langs, $user, $mysoc;
global $db, $langs, $user, $mysoc, $conf;
if (empty($mysoc->country_id)) {
dol_print_error('', 'Call to select_accounting_account with mysoc country not yet defined');
@ -695,6 +702,7 @@ class AccountancyCategory // extends CommonObject
$sql = "SELECT c.rowid, c.code, c.label, c.formula, c.position, c.category_type";
$sql .= " FROM " . MAIN_DB_PREFIX . "c_accounting_category as c";
$sql .= " WHERE c.active = 1 ";
$sql .= " AND c.entity = " . $conf->entity;
if ($categorytype >= 0) $sql.=" AND c.category_type = 1";
$sql .= " AND (c.fk_country = ".$mysoc->country_id." OR c.fk_country = 0)";
$sql .= " ORDER BY c.position ASC";

View File

@ -349,7 +349,12 @@ if (! empty($conf->commande->enabled) && $user->rights->commande->lire)
$companystatic->canvas=$obj->canvas;
print $companystatic->getNomUrl(1,'customer',16);
print '</td>';
print '<td align="right" class="nowrap">'.price($obj->total_ttc).'</td></tr>';
if(! empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT)) {
print '<td align="right" class="nowrap">'.price($obj->total_ht).'</td></tr>';
}
else {
print '<td align="right" class="nowrap">'.price($obj->total_ttc).'</td></tr>';
}
$i++;
$total += $obj->total_ttc;
}
@ -432,7 +437,12 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->commande
$companystatic->canvas=$obj->canvas;
print $companystatic->getNomUrl(1,'supplier',16);
print '</td>';
print '<td align="right" class="nowrap">'.price($obj->total_ttc).'</td></tr>';
if(! empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT)) {
print '<td align="right" class="nowrap">'.price($obj->total_ht).'</td></tr>';
}
else {
print '<td align="right" class="nowrap">'.price($obj->total_ttc).'</td></tr>';
}
$i++;
$total += $obj->total_ttc;
}
@ -744,7 +754,12 @@ if (! empty($conf->propal->enabled) && $user->rights->propal->lire)
print '</td>';
print '<td align="right">';
print dol_print_date($db->jdate($obj->dp),'day').'</td>'."\n";
print '<td align="right">'.price($obj->total_ttc).'</td>';
if(! empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT)) {
print '<td align="right">'.price($obj->total_ht).'</td>';
}
else {
print '<td align="right">'.price($obj->total_ttc).'</td>';
}
print '<td align="center" width="14">'.$propalstatic->LibStatut($obj->fk_statut,3).'</td>'."\n";
print '</tr>'."\n";
$i++;
@ -843,7 +858,12 @@ if (! empty($conf->commande->enabled) && $user->rights->commande->lire)
print '</td>';
print '<td align="right">';
print dol_print_date($db->jdate($obj->dp),'day').'</td>'."\n";
print '<td align="right">'.price($obj->total_ttc).'</td>';
if(! empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT)) {
print '<td align="right">'.price($obj->total_ht).'</td>';
}
else {
print '<td align="right">'.price($obj->total_ttc).'</td>';
}
print '<td align="center" width="14">'.$orderstatic->LibStatut($obj->fk_statut,$obj->billed,3).'</td>'."\n";
print '</tr>'."\n";
$i++;

View File

@ -3677,7 +3677,7 @@ abstract class CommonObject
print '<td class="linecoluht" align="right" width="80">'.$langs->trans('PriceUHT').'</td>';
// Multicurrency
if (!empty($conf->multicurrency->enabled)) print '<td class="linecoluht_currency" align="right" width="80">'.$langs->trans('PriceUHTCurrency', $this->multicurrency_code).'</td>';
if (!empty($conf->multicurrency->enabled) && $this->multicurrency_code != $conf->currency) print '<td class="linecoluht_currency" align="right" width="80">'.$langs->trans('PriceUHTCurrency', $this->multicurrency_code).'</td>';
if ($inputalsopricewithtax) print '<td align="right" width="80">'.$langs->trans('PriceUTTC').'</td>';
@ -3716,7 +3716,7 @@ abstract class CommonObject
print '<td class="linecolht" align="right">'.$langs->trans('TotalHTShort').'</td>';
// Multicurrency
if (!empty($conf->multicurrency->enabled)) print '<td class="linecoltotalht_currency" align="right">'.$langs->trans('TotalHTShortCurrency', $this->multicurrency_code).'</td>';
if (!empty($conf->multicurrency->enabled) && $this->multicurrency_code != $conf->currency) print '<td class="linecoltotalht_currency" align="right">'.$langs->trans('TotalHTShortCurrency', $this->multicurrency_code).'</td>';
if ($outputalsopricetotalwithtax) print '<td align="right" width="80">'.$langs->trans('TotalTTCShort').'</td>';

View File

@ -111,7 +111,7 @@ if ($nolinesbefore) {
<?php } ?>
<td class="linecolvat" align="right"><span id="title_vat"><?php echo $langs->trans('VAT'); ?></span></td>
<td class="linecoluht" align="right"><span id="title_up_ht"><?php echo $langs->trans('PriceUHT'); ?></span></td>
<?php if (!empty($conf->multicurrency->enabled)) { $colspan++;?>
<?php if (!empty($conf->multicurrency->enabled) && $this->multicurrency_code != $conf->currency) { $colspan++;?>
<td class="linecoluht_currency" align="right"><span id="title_up_ht_currency"><?php echo $langs->trans('PriceUHTCurrency'); ?></span></td>
<?php } ?>
<?php if (! empty($inputalsopricewithtax)) { ?>
@ -345,7 +345,7 @@ else {
<input type="text" size="5" name="price_ht" id="price_ht" class="flat right" value="<?php echo (isset($_POST["price_ht"])?GETPOST("price_ht",'alpha',2):''); ?>">
</td>
<?php if (!empty($conf->multicurrency->enabled)) { $colspan++;?>
<?php if (!empty($conf->multicurrency->enabled) && $this->multicurrency_code != $conf->currency) { $colspan++;?>
<td class="nobottom linecoluht_currency" align="right">
<input type="text" size="5" name="multicurrency_price_ht" id="multicurrency_price_ht" class="flat right" value="<?php echo (isset($_POST["multicurrency_price_ht"])?GETPOST("multicurrency_price_ht",'alpha',2):''); ?>">
</td>
@ -462,7 +462,7 @@ if ((! empty($conf->service->enabled) || ($object->element == 'contrat')) && $da
}
}
if (!empty($conf->multicurrency->enabled)) $colspan+=2;
if (!empty($conf->multicurrency->enabled) && $this->multicurrency_code != $conf->currency) $colspan+=2;
if (! empty($usemargins))
{

View File

@ -53,7 +53,7 @@ $colspan = 3; // Col total ht + col edit + col delete
if (! empty($inputalsopricewithtax)) $colspan++; // We add 1 if col total ttc
if (in_array($object->element,array('propal','supplier_proposal','facture','invoice','commande','order','order_supplier','invoice_supplier'))) $colspan++; // With this, there is a column move button
if (empty($user->rights->margins->creer)) $colspan++;
if (!empty($conf->multicurrency->enabled)) $colspan+=2;
if (!empty($conf->multicurrency->enabled) && $this->multicurrency_code != $conf->currency) $colspan+=2;
?>
<!-- BEGIN PHP TEMPLATE objectline_edit.tpl.php -->
@ -148,7 +148,7 @@ $coldisplay=-1; // We remove first td
if ($this->situation_counter > 1) print ' readonly';
print '></td>';
if (!empty($conf->multicurrency->enabled)) {
if (!empty($conf->multicurrency->enabled) && $this->multicurrency_code != $conf->currency) {
print '<td align="right"><input rel="'.$object->multicurrency_tx.'" type="text" class="flat right" size="5" id="multicurrency_subprice" name="multicurrency_subprice" value="'.price($line->multicurrency_subprice).'" /></td>';
}

View File

@ -195,7 +195,7 @@ $domData .= ' data-product_type="'.$line->product_type.'"';
<td align="right" class="linecoluht nowrap"><?php $coldisplay++; ?><?php echo price($line->subprice); ?></td>
<?php if (!empty($conf->multicurrency->enabled)) { ?>
<?php if (!empty($conf->multicurrency->enabled) && $this->multicurrency_code != $conf->currency) { ?>
<td align="right" class="linecoluht_currency nowrap"><?php $coldisplay++; ?><?php echo price($line->multicurrency_subprice); ?></td>
<?php } ?>
@ -261,7 +261,7 @@ $domData .= ' data-product_type="'.$line->product_type.'"';
<td align="right" class="linecoloption nowrap"><?php $coldisplay++; ?><?php echo $langs->trans('Option'); ?></td>
<?php } else { ?>
<td align="right" class="liencolht nowrap"><?php $coldisplay++; ?><?php echo price($line->total_ht); ?></td>
<?php if (!empty($conf->multicurrency->enabled)) { ?>
<?php if (!empty($conf->multicurrency->enabled) && $this->multicurrency_code != $conf->currency) { ?>
<td align="right" class="linecolutotalht_currency nowrap"><?php $coldisplay++; ?><?php echo price($line->multicurrency_total_ht); ?></td>
<?php } ?>
<?php } ?>

View File

@ -9,8 +9,8 @@
-- To drop a column: ALTER TABLE llx_table DROP COLUMN oldname;
-- To change type of field: ALTER TABLE llx_table MODIFY COLUMN name varchar(60);
-- To drop a foreign key: ALTER TABLE llx_table DROP FOREIGN KEY fk_name;
-- To drop an index: -- VMYSQL4.0 DROP INDEX nomindex on llx_table
-- To drop an index: -- VPGSQL8.0 DROP INDEX nomindex
-- To drop an index: -- VMYSQL4.1 DROP INDEX nomindex on llx_table
-- To drop an index: -- VPGSQL8.2 DROP INDEX nomindex
-- To restrict request to Mysql version x.y minimum use -- VMYSQLx.y
-- To restrict request to Pgsql version x.y minimum use -- VPGSQLx.y
-- To make pk to be auto increment (mysql): -- VMYSQL4.3 ALTER TABLE llx_table CHANGE COLUMN rowid rowid INTEGER NOT NULL AUTO_INCREMENT;
@ -441,4 +441,13 @@ ALTER TABLE llx_extrafields MODIFY COLUMN list VARCHAR(128);
UPDATE llx_rights_def set module = 'asset' where module = 'assets';
update llx_c_email_templates set lang = '' where lang IS NULL;
ALTER TABLE llx_c_accounting_category ADD COLUMN entity integer NOT NULL DEFAULT 1 AFTER rowid;
-- VMYSQL4.1 DROP INDEX uk_c_accounting_category on llx_c_accounting_category
-- VPGSQL8.2 DROP INDEX uk_c_accounting_category
ALTER TABLE llx_c_accounting_category ADD UNIQUE INDEX uk_c_accounting_category(code,entity);
-- VMYSQL4.1 DROP INDEX uk_accounting_journal_code on llx_accounting_journal
-- VPGSQL8.2 DROP INDEX uk_accounting_journal_code
ALTER TABLE llx_accounting_journal ADD UNIQUE INDEX uk_accounting_journal_code (code,entity);
UPDATE llx_c_email_templates SET lang = '' WHERE lang IS NULL;

View File

@ -17,4 +17,4 @@
-- ===========================================================================
ALTER TABLE llx_accounting_journal ADD UNIQUE INDEX uk_accounting_journal_code (code);
ALTER TABLE llx_accounting_journal ADD UNIQUE INDEX uk_accounting_journal_code (code,entity);

View File

@ -17,5 +17,5 @@
-- Table with category for accounting account
-- ===================================================================
ALTER TABLE llx_c_accounting_category ADD UNIQUE INDEX uk_c_accounting_category(code);
ALTER TABLE llx_c_accounting_category ADD UNIQUE INDEX uk_c_accounting_category(code,entity);

View File

@ -22,6 +22,7 @@
CREATE TABLE llx_c_accounting_category (
rowid integer NOT NULL AUTO_INCREMENT PRIMARY KEY,
entity integer NOT NULL DEFAULT 1,
code varchar(16) NOT NULL,
label varchar(255) NOT NULL,
range_account varchar(255) NOT NULL, -- Comment

View File

@ -1581,6 +1581,10 @@ function top_menu($head, $title='', $target='', $disablejs=0, $disablehead=0, $a
if ($helpbaseurl && $helppage)
{
$text='';
if(!empty($conf->global->MAIN_SHOWDATABASENAMEINHELPPAGESLINK)) {
$langs->load('admin');
$appli .= '<br>' . $langs->trans("Database") . ': ' . $db->database_name;
}
$title=$appli.'<br>';
$title.=$langs->trans($mode == 'wiki' ? 'GoToWikiHelpPage': 'GoToHelpPage');
if ($mode == 'wiki') $title.=' - '.$langs->trans("PageWiki").' &quot;'.dol_escape_htmltag(strtr($helppage,'_',' ')).'&quot;';