Replace deprecated code with new one
This commit is contained in:
parent
cc5dad977c
commit
f54d4e3fc2
@ -168,18 +168,20 @@ $arrayfields=array(
|
|||||||
'sale_representative'=>array('label'=>"SaleRepresentativesOfThirdParty", 'checked'=>1),
|
'sale_representative'=>array('label'=>"SaleRepresentativesOfThirdParty", 'checked'=>1),
|
||||||
'p.datec'=>array('label'=>"DateCreation", 'checked'=>0, 'position'=>500),
|
'p.datec'=>array('label'=>"DateCreation", 'checked'=>0, 'position'=>500),
|
||||||
'p.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>500),
|
'p.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>500),
|
||||||
'p.date_cloture'=>array('label'=>"DateClosing", 'checked'=>0, 'position'=>500),
|
'p.date_cloture'=>array('label'=>"DateClosing", 'checked'=>0, 'position'=>500),
|
||||||
'p.fk_statut'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000),
|
'p.fk_statut'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000),
|
||||||
);
|
);
|
||||||
// Extra fields
|
// Extra fields
|
||||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0)
|
||||||
{
|
{
|
||||||
foreach($extrafields->attribute_label as $key => $val)
|
foreach($extrafields->attributes[$object->table_element]['label'] as $key => $val)
|
||||||
{
|
{
|
||||||
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key]));
|
if (! empty($extrafields->attributes[$object->table_element]['list'][$key]))
|
||||||
|
$arrayfields["ef.".$key]=array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key]<0)?0:1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key])!=3 && $extrafields->attributes[$object->table_element]['perms'][$key]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
@ -276,19 +278,20 @@ $sql.= ' u.login';
|
|||||||
if (! $user->rights->societe->client->voir && ! $socid) $sql .= ", sc.fk_soc, sc.fk_user";
|
if (! $user->rights->societe->client->voir && ! $socid) $sql .= ", sc.fk_soc, sc.fk_user";
|
||||||
if ($search_categ_cus) $sql .= ", cc.fk_categorie, cc.fk_soc";
|
if ($search_categ_cus) $sql .= ", cc.fk_categorie, cc.fk_soc";
|
||||||
// Add fields from extrafields
|
// Add fields from extrafields
|
||||||
foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ", ef.".$key.' as options_'.$key : '');
|
if (! empty($extrafields->attributes[$object->table_element]['label']))
|
||||||
|
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : '');
|
||||||
// Add fields from hooks
|
// Add fields from hooks
|
||||||
$parameters=array();
|
$parameters=array();
|
||||||
$reshook=$hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
|
$reshook=$hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
|
||||||
$sql.=$hookmanager->resPrint;
|
$sql.=$hookmanager->resPrint;
|
||||||
|
$sql=preg_replace('/, $/', '', $sql);
|
||||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'societe as s';
|
$sql.= ' FROM '.MAIN_DB_PREFIX.'societe as s';
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s.fk_pays)";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s.fk_pays)";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_typent as typent on (typent.id = s.fk_typent)";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_typent as typent on (typent.id = s.fk_typent)";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = s.fk_departement)";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = s.fk_departement)";
|
||||||
if (! empty($search_categ_cus)) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_societe as cc ON s.rowid = cc.fk_soc"; // We'll need this table joined to the select in order to filter by categ
|
if (! empty($search_categ_cus)) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_societe as cc ON s.rowid = cc.fk_soc"; // We'll need this table joined to the select in order to filter by categ
|
||||||
|
|
||||||
$sql.= ', '.MAIN_DB_PREFIX.'propal as p';
|
$sql.= ', '.MAIN_DB_PREFIX.'propal as p';
|
||||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."propal_extrafields as ef on (p.rowid = ef.fk_object)";
|
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (p.rowid = ef.fk_object)";
|
||||||
if ($sall || $search_product_category > 0) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'propaldet as pd ON p.rowid=pd.fk_propal';
|
if ($sall || $search_product_category > 0) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'propaldet as pd ON p.rowid=pd.fk_propal';
|
||||||
if ($search_product_category > 0) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_product as cp ON cp.fk_product=pd.fk_product';
|
if ($search_product_category > 0) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_product as cp ON cp.fk_product=pd.fk_product';
|
||||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'user as u ON p.fk_user_author = u.rowid';
|
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'user as u ON p.fk_user_author = u.rowid';
|
||||||
@ -750,6 +753,8 @@ if ($resql)
|
|||||||
$now = dol_now();
|
$now = dol_now();
|
||||||
$i=0;
|
$i=0;
|
||||||
$totalarray=array();
|
$totalarray=array();
|
||||||
|
$typenArray=null;
|
||||||
|
|
||||||
while ($i < min($num, $limit))
|
while ($i < min($num, $limit))
|
||||||
{
|
{
|
||||||
$obj = $db->fetch_object($resql);
|
$obj = $db->fetch_object($resql);
|
||||||
@ -880,8 +885,9 @@ if ($resql)
|
|||||||
// Type ent
|
// Type ent
|
||||||
if (! empty($arrayfields['typent.code']['checked']))
|
if (! empty($arrayfields['typent.code']['checked']))
|
||||||
{
|
{
|
||||||
|
if (! is_array($typenArray) || empty($typenArray)) $typenArray = $formcompany->typent_array(1);
|
||||||
|
|
||||||
print '<td align="center">';
|
print '<td align="center">';
|
||||||
if (count($typenArray)==0) $typenArray = $formcompany->typent_array(1);
|
|
||||||
print $typenArray[$obj->typent_code];
|
print $typenArray[$obj->typent_code];
|
||||||
print '</td>';
|
print '</td>';
|
||||||
if (! $i) $totalarray['nbfield']++;
|
if (! $i) $totalarray['nbfield']++;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user