Merge branch '3.9' of git@github.com:Dolibarr/dolibarr.git into 3.9
This commit is contained in:
commit
7262dd5934
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||||
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
* 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-2015 Ari Elbaz (elarifr) <github@accedinfo.com>
|
||||||
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
|
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
|
||||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||||
@ -202,10 +202,9 @@ print "<td>" . $langs->trans("Selectchartofaccounts") . "</td>";
|
|||||||
print "<td>";
|
print "<td>";
|
||||||
print '<select class="flat" name="chartofaccounts" id="chartofaccounts">';
|
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 .= " FROM " . MAIN_DB_PREFIX . "accounting_system";
|
||||||
$sql .= " WHERE active = 1";
|
$sql .= " WHERE active = 1";
|
||||||
$sql .= " AND fk_pays = " . $mysoc->country_id;
|
|
||||||
|
|
||||||
dol_syslog('accountancy/admin/index.php:: $sql=' . $sql);
|
dol_syslog('accountancy/admin/index.php:: $sql=' . $sql);
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
@ -221,7 +220,7 @@ if ($resql) {
|
|||||||
|
|
||||||
print '<option value="' . $row[0] . '"';
|
print '<option value="' . $row[0] . '"';
|
||||||
print $conf->global->CHARTOFACCOUNTS == $row[0] ? ' selected' : '';
|
print $conf->global->CHARTOFACCOUNTS == $row[0] ? ' selected' : '';
|
||||||
print '>' . $row[1] . ' - ' . $row[3] . '</option>';
|
print '>' . $row[1] . ' - ' . $row[2] . '</option>';
|
||||||
|
|
||||||
$i ++;
|
$i ++;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -223,7 +223,7 @@ asort($orders);
|
|||||||
//var_dump($modules);
|
//var_dump($modules);
|
||||||
|
|
||||||
$nbofactivatedmodules=count($conf->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"));
|
if ($nbofactivatedmodules <= 1) $moreinfo .= ' '.img_warning($langs->trans("YouMustEnableOneModule"));
|
||||||
print load_fiche_titre($langs->trans("ModulesSetup"),$moreinfo,'title_setup');
|
print load_fiche_titre($langs->trans("ModulesSetup"),$moreinfo,'title_setup');
|
||||||
|
|
||||||
|
|||||||
@ -130,6 +130,7 @@ AssociatedProductsAbility=Activate the package feature
|
|||||||
AssociatedProducts=Package product
|
AssociatedProducts=Package product
|
||||||
AssociatedProductsNumber=Number of products composing this package product
|
AssociatedProductsNumber=Number of products composing this package product
|
||||||
ParentProductsNumber=Number of parent packaging product
|
ParentProductsNumber=Number of parent packaging product
|
||||||
|
ParentProducts=Parent products
|
||||||
IfZeroItIsNotAVirtualProduct=If 0, this product is not a package product
|
IfZeroItIsNotAVirtualProduct=If 0, this product is not a package product
|
||||||
IfZeroItIsNotUsedByVirtualProduct=If 0, this product is not used by any package product
|
IfZeroItIsNotUsedByVirtualProduct=If 0, this product is not used by any package product
|
||||||
EditAssociate=Associate
|
EditAssociate=Associate
|
||||||
|
|||||||
@ -2950,7 +2950,7 @@ class Product extends CommonObject
|
|||||||
* Return all direct parent products fo current product
|
* Return all direct parent products fo current product
|
||||||
*
|
*
|
||||||
* @return array prod
|
* @return array prod
|
||||||
* @see getFather
|
* @deprecated See getFather
|
||||||
*/
|
*/
|
||||||
function getParent()
|
function getParent()
|
||||||
{
|
{
|
||||||
@ -2982,9 +2982,10 @@ class Product extends CommonObject
|
|||||||
*
|
*
|
||||||
* @param int $id Id of product to search childs of
|
* @param int $id Id of product to search childs of
|
||||||
* @param int $firstlevelonly Return only direct child
|
* @param int $firstlevelonly Return only direct child
|
||||||
|
* @param int $level Level of recursing call (start to 1)
|
||||||
* @return array Prod
|
* @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 = "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";
|
$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_pere = ".$id;
|
||||||
$sql.= " AND pa.fk_product_fils != ".$id; // This should not happens, it is to avoid infinite loop if it happens
|
$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);
|
$res = $this->db->query($sql);
|
||||||
if ($res)
|
if ($res)
|
||||||
{
|
{
|
||||||
$prods = array();
|
$prods = array();
|
||||||
while ($rec = $this->db->fetch_array($res))
|
while ($rec = $this->db->fetch_array($res))
|
||||||
{
|
{
|
||||||
|
// TODO Add check to not add ne record if already added
|
||||||
$prods[$rec['rowid']]= array(
|
$prods[$rec['rowid']]= array(
|
||||||
0=>$rec['id'],
|
0=>$rec['id'],
|
||||||
1=>$rec['qty'],
|
1=>$rec['qty'],
|
||||||
@ -3011,7 +3017,7 @@ class Product extends CommonObject
|
|||||||
//$prods[$this->db->escape($rec['label'])]= array(0=>$rec['id'],1=>$rec['qty']);
|
//$prods[$this->db->escape($rec['label'])]= array(0=>$rec['id'],1=>$rec['qty']);
|
||||||
if (empty($firstlevelonly))
|
if (empty($firstlevelonly))
|
||||||
{
|
{
|
||||||
$listofchilds=$this->getChildsArbo($rec['id']);
|
$listofchilds=$this->getChildsArbo($rec['id'], 0, $level + 1);
|
||||||
foreach($listofchilds as $keyChild => $valueChild)
|
foreach($listofchilds as $keyChild => $valueChild)
|
||||||
{
|
{
|
||||||
$prods[$rec['rowid']]['childs'][$keyChild] = $valueChild;
|
$prods[$rec['rowid']]['childs'][$keyChild] = $valueChild;
|
||||||
@ -3036,10 +3042,12 @@ class Product extends CommonObject
|
|||||||
*/
|
*/
|
||||||
function get_sousproduits_arbo()
|
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($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;
|
$parent[$key][$keyChild] = $valueChild;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -265,7 +265,7 @@ if ($id > 0 || ! empty($ref))
|
|||||||
print load_fiche_titre($langs->trans("ProductParentList"),'','').'<br>';
|
print load_fiche_titre($langs->trans("ProductParentList"),'','').'<br>';
|
||||||
print '<table class="centpercent noborder">';
|
print '<table class="centpercent noborder">';
|
||||||
print '<tr class="liste_titre">';
|
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('Label').'</td>';
|
||||||
print '<td>'.$langs->trans('Qty').'</td>';
|
print '<td>'.$langs->trans('Qty').'</td>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user