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

This commit is contained in:
Laurent Destailleur 2016-05-08 10:49:09 +02:00
commit 7262dd5934
5 changed files with 21 additions and 13 deletions

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013-2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
* Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
* Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com>
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
@ -202,10 +202,9 @@ print "<td>" . $langs->trans("Selectchartofaccounts") . "</td>";
print "<td>";
print '<select class="flat" name="chartofaccounts" id="chartofaccounts">';
$sql = "SELECT rowid, pcg_version, fk_pays, label, active";
$sql = "SELECT rowid, pcg_version, label, active";
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_system";
$sql .= " WHERE active = 1";
$sql .= " AND fk_pays = " . $mysoc->country_id;
dol_syslog('accountancy/admin/index.php:: $sql=' . $sql);
$resql = $db->query($sql);
@ -221,7 +220,7 @@ if ($resql) {
print '<option value="' . $row[0] . '"';
print $conf->global->CHARTOFACCOUNTS == $row[0] ? ' selected' : '';
print '>' . $row[1] . ' - ' . $row[3] . '</option>';
print '>' . $row[1] . ' - ' . $row[2] . '</option>';
$i ++;
}

View File

@ -223,7 +223,7 @@ asort($orders);
//var_dump($modules);
$nbofactivatedmodules=count($conf->modules);
$moreinfo=$langs->trans("TotalNumberOfActivatedModules",($nbofactivatedmodules-1));
$moreinfo=$langs->trans("TotalNumberOfActivatedModules",($nbofactivatedmodules-1), count($modules));
if ($nbofactivatedmodules <= 1) $moreinfo .= ' '.img_warning($langs->trans("YouMustEnableOneModule"));
print load_fiche_titre($langs->trans("ModulesSetup"),$moreinfo,'title_setup');

View File

@ -130,6 +130,7 @@ AssociatedProductsAbility=Activate the package feature
AssociatedProducts=Package product
AssociatedProductsNumber=Number of products composing this package product
ParentProductsNumber=Number of parent packaging product
ParentProducts=Parent products
IfZeroItIsNotAVirtualProduct=If 0, this product is not a package product
IfZeroItIsNotUsedByVirtualProduct=If 0, this product is not used by any package product
EditAssociate=Associate

View File

@ -2948,9 +2948,9 @@ class Product extends CommonObject
/**
* Return all direct parent products fo current product
*
*
* @return array prod
* @see getFather
* @deprecated See getFather
*/
function getParent()
{
@ -2982,9 +2982,10 @@ class Product extends CommonObject
*
* @param int $id Id of product to search childs of
* @param int $firstlevelonly Return only direct child
* @param int $level Level of recursing call (start to 1)
* @return array Prod
*/
function getChildsArbo($id, $firstlevelonly=0)
function getChildsArbo($id, $firstlevelonly=0, $level=1)
{
$sql = "SELECT p.rowid, p.label as label, pa.qty as qty, pa.fk_product_fils as id, p.fk_product_type, pa.incdec";
$sql.= " FROM ".MAIN_DB_PREFIX."product as p";
@ -2993,13 +2994,18 @@ class Product extends CommonObject
$sql.= " AND pa.fk_product_pere = ".$id;
$sql.= " AND pa.fk_product_fils != ".$id; // This should not happens, it is to avoid infinite loop if it happens
dol_syslog(get_class($this).'::getChildsArbo', LOG_DEBUG);
dol_syslog(get_class($this).'::getChildsArbo id='.$id.' level='.$level, LOG_DEBUG);
// Protection against infinite loop
if ($level > 30) return array();
$res = $this->db->query($sql);
if ($res)
{
$prods = array();
while ($rec = $this->db->fetch_array($res))
{
// TODO Add check to not add ne record if already added
$prods[$rec['rowid']]= array(
0=>$rec['id'],
1=>$rec['qty'],
@ -3011,7 +3017,7 @@ class Product extends CommonObject
//$prods[$this->db->escape($rec['label'])]= array(0=>$rec['id'],1=>$rec['qty']);
if (empty($firstlevelonly))
{
$listofchilds=$this->getChildsArbo($rec['id']);
$listofchilds=$this->getChildsArbo($rec['id'], 0, $level + 1);
foreach($listofchilds as $keyChild => $valueChild)
{
$prods[$rec['rowid']]['childs'][$keyChild] = $valueChild;
@ -3036,10 +3042,12 @@ class Product extends CommonObject
*/
function get_sousproduits_arbo()
{
$parent = $this->getParent();
//$parent = $this->getParent();
$parent[$this->label]=array(0 => $this->id);
foreach($parent as $key => $value) // key=label, value[0]=id
{
foreach($this->getChildsArbo($value[0]) as $keyChild => $valueChild)
foreach($this->getChildsArbo($value[0]) as $keyChild => $valueChild) // Warning. getChildsArbo can gell getChildsArbo recursively.
{
$parent[$key][$keyChild] = $valueChild;
}

View File

@ -265,7 +265,7 @@ if ($id > 0 || ! empty($ref))
print load_fiche_titre($langs->trans("ProductParentList"),'','').'<br>';
print '<table class="centpercent noborder">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans('ParentProduct').'</td>';
print '<td>'.$langs->trans('ParentProducts').'</td>';
print '<td>'.$langs->trans('Label').'</td>';
print '<td>'.$langs->trans('Qty').'</td>';
print '</td>';