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

This commit is contained in:
florian HENRY 2016-06-22 08:41:35 +02:00
commit e897700bb2
13 changed files with 875 additions and 292 deletions

View File

@ -1717,6 +1717,6 @@ class Categorie extends CommonObject
'categorie_societe'
);
return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables);
return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables, 1);
}
}

View File

@ -263,7 +263,7 @@ class Facture extends CommonInvoice
$result=$soc->fetch($this->socid);
if ($result < 0)
{
$this->error="Failed to fetch company";
$this->error="Failed to fetch company: ".$soc->error;
dol_syslog(get_class($this)."::create ".$this->error, LOG_ERR);
return -2;
}

View File

@ -29,7 +29,7 @@
/**
* \file htdocs/compta/facture/list.php
* \ingroup facture
* \brief Page to create/see an invoice
* \brief List of customer invoices
*/
require '../../main.inc.php';
@ -37,6 +37,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/modules/facture/modules_facture.php';
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
@ -50,7 +51,6 @@ if (! empty($conf->projet->enabled)) require_once DOL_DOCUMENT_ROOT.'/projet/c
$langs->load('bills');
$langs->load('companies');
$langs->load('products');
$langs->load('main');
$sall=trim(GETPOST('sall'));
$projectid=(GETPOST('projectid')?GETPOST('projectid','int'):0);
@ -78,8 +78,19 @@ $search_zip=GETPOST('search_zip','alpha');
$search_state=trim(GETPOST("search_state"));
$search_country=GETPOST("search_country",'int');
$search_type_thirdparty=GETPOST("search_type_thirdparty",'int');
$search_user = GETPOST('search_user','int');
$search_sale = GETPOST('search_sale','int');
$day = GETPOST('day','int');
$month = GETPOST('month','int');
$year = GETPOST('year','int');
$day_lim = GETPOST('day_lim','int');
$month_lim = GETPOST('month_lim','int');
$year_lim = GETPOST('year_lim','int');
$toselect = GETPOST('toselect', 'array');
$option = GETPOST('option');
if ($option == 'late') $filter = 'paye:0';
$filtre = GETPOST('filtre');
$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit;
$sortfield = GETPOST("sortfield",'alpha');
@ -96,17 +107,6 @@ $pagenext = $page + 1;
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
$contextpage='invoicelist';
$search_user = GETPOST('search_user','int');
$search_sale = GETPOST('search_sale','int');
$day = GETPOST('day','int');
$month = GETPOST('month','int');
$year = GETPOST('year','int');
$day_lim = GETPOST('day_lim','int');
$month_lim = GETPOST('month_lim','int');
$year_lim = GETPOST('year_lim','int');
$filtre = GETPOST('filtre');
$toselect = GETPOST('toselect', 'array');
// Security check
$fieldid = (! empty($ref)?'facnumber':'rowid');
if (! empty($user->societe_id)) $socid=$user->societe_id;
@ -140,14 +140,14 @@ $checkedtypetiers=0;
$arrayfields=array(
'f.facnumber'=>array('label'=>$langs->trans("Ref"), 'checked'=>1),
'f.ref_client'=>array('label'=>$langs->trans("RefCustomer"), 'checked'=>1),
'f.date'=>array('label'=>$langs->trans("DateInvoice"), 'checked'=>1),
'f.date_lim_reglement'=>array('label'=>$langs->trans("DateDue"), 'checked'=>1),
's.nom'=>array('label'=>$langs->trans("ThirdParty"), 'checked'=>1),
's.town'=>array('label'=>$langs->trans("Town"), 'checked'=>1),
's.zip'=>array('label'=>$langs->trans("Zip"), 'checked'=>1),
'state.nom'=>array('label'=>$langs->trans("StateShort"), 'checked'=>0),
'country.code_iso'=>array('label'=>$langs->trans("Country"), 'checked'=>0),
'typent.code'=>array('label'=>$langs->trans("ThirdPartyType"), 'checked'=>$checkedtypetiers),
'f.date'=>array('label'=>$langs->trans("DateInvoice"), 'checked'=>1),
'f.date_lim_reglement'=>array('label'=>$langs->trans("DateDue"), 'checked'=>1),
'f.fk_mode_reglement'=>array('label'=>$langs->trans("PaymentMode"), 'checked'=>1),
'f.total_ht'=>array('label'=>$langs->trans("AmountHT"), 'checked'=>1),
'f.total_vat'=>array('label'=>$langs->trans("AmountVAT"), 'checked'=>0),
@ -189,6 +189,7 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter") || GETPOS
$search_product_category='';
$search_ref='';
$search_refcustomer='';
$search_project='';
$search_societe='';
$search_montant_ht='';
$search_montant_vat='';
@ -624,8 +625,6 @@ if (empty($reshook))
* View
*/
llxHeader('',$langs->trans('Bill'),'EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes');
$form = new Form($db);
$formother = new FormOther($db);
$formfile = new FormFile($db);
@ -633,6 +632,8 @@ $bankaccountstatic=new Account($db);
$facturestatic=new Facture($db);
$formcompany=new FormCompany($db);
llxHeader('',$langs->trans('CustomersInvoices'),'EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes');
$sql = 'SELECT';
if ($sall || $search_product_category > 0) $sql = 'SELECT DISTINCT';
$sql.= ' f.rowid as facid, f.facnumber, f.ref_client, f.type, f.note_private, f.note_public, f.increment, f.fk_mode_reglement, f.total as total_ht, f.tva as total_vat, f.total_ttc,';
@ -687,6 +688,7 @@ if ($filtre)
}
if ($search_ref) $sql .= natural_search('f.facnumber', $search_ref);
if ($search_refcustomer) $sql .= natural_search('f.ref_client', $search_refcustomer);
if ($search_project) $sql .= natural_search('p.ref', $search_project);
if ($search_societe) $sql .= natural_search('s.nom', $search_societe);
if ($search_town) $sql.= natural_search('s.town', $search_town);
if ($search_zip) $sql.= natural_search("s.zip",$search_zip);
@ -795,23 +797,23 @@ if ($resql)
$param='&socid='.$socid;
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
if ($day) $param.='&day='.$day;
if ($month) $param.='&month='.$month;
if ($year) $param.='&year=' .$year;
if ($day_lim) $param.='&day_lim='.$day_lim;
if ($month_lim) $param.='&month_lim='.$month_lim;
if ($year_lim) $param.='&year_lim=' .$year_lim;
if ($search_ref) $param.='&search_ref=' .$search_ref;
if ($search_refcustomer) $param.='&search_refcustomer=' .$search_refcustomer;
if ($search_societe) $param.='&search_societe=' .$search_societe;
if ($search_sale > 0) $param.='&search_sale=' .$search_sale;
if ($search_user > 0) $param.='&search_user=' .$search_user;
if ($search_product_category > 0) $param.='$search_product_category=' .$search_product_category;
if ($search_montant_ht != '') $param.='&search_montant_ht='.$search_montant_ht;
if ($search_montant_vat != '') $param.='&search_montant_vat='.$search_montant_vat;
if ($search_montant_ttc != '') $param.='&search_montant_ttc='.$search_montant_ttc;
if ($search_status != '') $param.='&search_status='.$search_status;
if ($search_paymentmode > 0) $param.='search_paymentmode='.$search_paymentmode;
if ($day) $param.='&day='.urlencode($day);
if ($month) $param.='&month='.urlencode($month);
if ($year) $param.='&year=' .urlencode($year);
if ($day_lim) $param.='&day_lim='.urlencode($day_lim);
if ($month_lim) $param.='&month_lim='.urlencode($month_lim);
if ($year_lim) $param.='&year_lim=' .urlencode($year_lim);
if ($search_ref) $param.='&search_ref=' .urlencode($search_ref);
if ($search_refcustomer) $param.='&search_refcustomer=' .urlencode($search_refcustomer);
if ($search_societe) $param.='&search_societe=' .urlencode($search_societe);
if ($search_sale > 0) $param.='&search_sale=' .urlencode($search_sale);
if ($search_user > 0) $param.='&search_user=' .urlencode($search_user);
if ($search_product_category > 0) $param.='$search_product_category=' .urlencode($search_product_category);
if ($search_montant_ht != '') $param.='&search_montant_ht='.urlencode($search_montant_ht);
if ($search_montant_vat != '') $param.='&search_montant_vat='.urlencode($search_montant_vat);
if ($search_montant_ttc != '') $param.='&search_montant_ttc='.urlencode($search_montant_ttc);
if ($search_status != '') $param.='&search_status='.urlencode($search_status);
if ($search_paymentmode > 0) $param.='search_paymentmode='.urlencode($search_paymentmode);
if ($show_files) $param.='&show_files=' .$show_files;
if ($option) $param.="&option=".$option;
if ($optioncss != '') $param.='&optioncss='.$optioncss;
@ -1061,12 +1063,12 @@ if ($resql)
// Thirpdarty
if (! empty($arrayfields['s.nom']['checked']))
{
print '<td class="liste_titre" align="left"><input class="flat" type="text" size="8" name="search_societe" value="'.$search_societe.'"></td>';
print '<td class="liste_titre" align="left"><input class="flat" type="text" size="6" name="search_societe" value="'.$search_societe.'"></td>';
}
// Town
if (! empty($arrayfields['s.town']['checked'])) print '<td class="liste_titre"><input class="flat" type="text" size="6" name="search_town" value="'.$search_town.'"></td>';
// Zip
if (! empty($arrayfields['s.zip']['checked'])) print '<td class="liste_titre"><input class="flat" type="text" size="6" name="search_zip" value="'.$search_zip.'"></td>';
if (! empty($arrayfields['s.zip']['checked'])) print '<td class="liste_titre"><input class="flat" type="text" size="4" name="search_zip" value="'.$search_zip.'"></td>';
// State
if (! empty($arrayfields['state.nom']['checked']))
{
@ -1191,17 +1193,17 @@ if ($resql)
$var=!$var;
$datelimit=$db->jdate($obj->datelimite);
$facturestatic->id=$obj->facid;
$facturestatic->ref=$obj->facnumber;
$facturestatic->type=$obj->type;
$facturestatic->statut=$obj->fk_statut;
$facturestatic->date_lim_reglement=$db->jdate($obj->datelimite);
print '<tr '.$bc[$var].'>';
if (! empty($arrayfields['f.facnumber']['checked']))
{
print '<td class="nowrap">';
$facturestatic->id=$obj->facid;
$facturestatic->ref=$obj->facnumber;
$facturestatic->type=$obj->type;
$facturestatic->statut=$obj->fk_statut;
$facturestatic->date_lim_reglement=$db->jdate($obj->datelimite);
$notetoshow=dol_string_nohtmltag(($user->societe_id>0?$obj->note_public:$obj->note_private),1);
$paiement = $facturestatic->getSommePaiement();
$remaintopay = $obj->total_ttc - $paiement;

View File

@ -440,7 +440,7 @@ if ($action == 'new')
if ($i == 0)
{
print '<b>'.$langs->trans("NoWaitingChecks").'</b><br>';
print '<div class="opacitymedium">'.$langs->trans("NoWaitingChecks").'</div><br>';
}
}

View File

@ -4474,20 +4474,24 @@ abstract class CommonObject
* This function is meant to be called from replaceThirdparty with the appropiate tables
* Column name fk_soc MUST be used to identify thirdparties
*
* @param DoliDB $db Database handler
* @param int $origin_id Old thirdparty id (the thirdparty to delete)
* @param int $dest_id New thirdparty id (the thirdparty that will received element of the other)
* @param string[] $tables Tables that need to be changed
* @param DoliDB $db Database handler
* @param int $origin_id Old thirdparty id (the thirdparty to delete)
* @param int $dest_id New thirdparty id (the thirdparty that will received element of the other)
* @param string[] $tables Tables that need to be changed
* @param int $ignoreerrors Ignore errors. Return true even if errors. We need this when replacement can fails like for categories (categorie of old thirdparty may already exists on new one)
* @return bool
*/
public static function commonReplaceThirdparty(DoliDB $db, $origin_id, $dest_id, array $tables)
public static function commonReplaceThirdparty(DoliDB $db, $origin_id, $dest_id, array $tables, $ignoreerrors=0)
{
foreach ($tables as $table)
{
$sql = 'UPDATE '.MAIN_DB_PREFIX.$table.' SET fk_soc = '.$dest_id.' WHERE fk_soc = '.$origin_id;
if (!$db->query($sql)) {
return false;
if (! $db->query($sql))
{
if ($ignoreerrors) return true;
//$this->errors = $db->lasterror();
return false;
}
}

View File

@ -5922,7 +5922,7 @@ class Form
/**
* Return HTML to show the search and clear seach button
*
* @param int $addcheckuncheckall Add the check all uncheck al button
* @param int $addcheckuncheckall Add the check all uncheck all button
* @param string $cssclass CSS class
* @param int $calljsfunction 0=default. 1=call function initCheckForSelect() after changing status of checkboxes
* @return string

View File

@ -1093,8 +1093,8 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
if (empty($conf->global->BANK_DISABLE_CHECK_DEPOSIT) && ! empty($conf->banque->enabled) && (! empty($conf->facture->enabled) || ! empty($conf->global->MAIN_MENU_CHEQUE_DEPOSIT_ON)))
{
$newmenu->add("/compta/paiement/cheque/index.php?leftmenu=checks&amp;mainmenu=bank",$langs->trans("MenuChequeDeposits"),0,$user->rights->banque->cheque, '', $mainmenu, 'checks');
$newmenu->add("/compta/paiement/cheque/card.php?leftmenu=checks&amp;action=new&amp;mainmenu=bank",$langs->trans("NewChequeDeposit"),1,$user->rights->banque->cheque);
$newmenu->add("/compta/paiement/cheque/list.php?leftmenu=checks&amp;mainmenu=bank",$langs->trans("List"),1,$user->rights->banque->cheque);
if (preg_match('/checks/',$leftmenu)) $newmenu->add("/compta/paiement/cheque/card.php?leftmenu=checks_bis&amp;action=new&amp;mainmenu=bank",$langs->trans("NewChequeDeposit"),1,$user->rights->banque->cheque);
if (preg_match('/checks/',$leftmenu)) $newmenu->add("/compta/paiement/cheque/list.php?leftmenu=checks_bis&amp;mainmenu=bank",$langs->trans("List"),1,$user->rights->banque->cheque);
}
}

View File

@ -232,6 +232,7 @@ if ($object->id > 0)
// Categories
if (! empty($conf->categorie->enabled))
{
$langs->load("categories");
print '<tr><td>' . $langs->trans("SuppliersCategoriesShort") . '</td>';
print '<td colspan="3">';
print $form->showCategories($object->id, 'supplier', 1);

File diff suppressed because it is too large Load Diff

View File

@ -169,6 +169,7 @@ ErrorSavingChanges=An error has ocurred when saving the changes
ErrorWarehouseRequiredIntoShipmentLine=Warehouse is required on the line to ship
ErrorFileMustHaveFormat=File must have format %s
ErrorSupplierCountryIsNotDefined=Country for this supplier is not defined. Correct this first.
ErrorsThirdpartyMerge=Failed to merge the two records. Request canceled.
# Warnings
WarningPasswordSetWithNoAccount=A password was set for this member. However, no user account was created. So this password is stored but can't be used to login to Dolibarr. It may be used by an external module/interface but if you don't need to define any login nor password for a member, you can disable option "Manage a login for each member" from Member module setup. If you need to manage a login but don't need any password, you can keep this field empty to avoid this warning. Note: Email can also be used as a login if the member is linked to a user.

View File

@ -43,7 +43,7 @@ class Societe extends CommonObject
public $element='societe';
public $table_element = 'societe';
public $fk_element='fk_soc';
protected $childtables=array("supplier_proposal","propal","commande","facture","contrat","facture_fourn","commande_fournisseur","projet"); // To test if we can delete object
protected $childtables=array("supplier_proposal","propal","commande","facture","contrat","facture_fourn","commande_fournisseur","projet","expedition"); // To test if we can delete object
/**
* 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
@ -1002,14 +1002,16 @@ class Societe extends CommonObject
* @param string $idprof2 Prof id 2 of third party (Warning, this can return several records)
* @param string $idprof3 Prof id 3 of third party (Warning, this can return several records)
* @param string $idprof4 Prof id 4 of third party (Warning, this can return several records)
* @param string $idprof5 Prof id 5 of third party (Warning, this can return several records)
* @param string $idprof6 Prof id 6 of third party (Warning, this can return several records)
* @return int >0 if OK, <0 if KO or if two records found for same ref or idprof, 0 if not found.
*/
function fetch($rowid, $ref='', $ref_ext='', $ref_int='', $idprof1='',$idprof2='',$idprof3='',$idprof4='')
function fetch($rowid, $ref='', $ref_ext='', $ref_int='', $idprof1='',$idprof2='',$idprof3='',$idprof4='',$idprof5='',$idprof6='')
{
global $langs;
global $conf;
if (empty($rowid) && empty($ref) && empty($ref_ext) && empty($ref_int) && empty($idprof1) && empty($idprof2) && empty($idprof3) && empty($idprof4)) return -1;
if (empty($rowid) && empty($ref) && empty($ref_ext) && empty($ref_int) && empty($idprof1) && empty($idprof2) && empty($idprof3) && empty($idprof4) && empty($idprof5) && empty($idprof6)) return -1;
$sql = 'SELECT s.rowid, s.nom as name, s.name_alias, s.entity, s.ref_ext, s.ref_int, s.address, s.datec as date_creation, s.prefix_comm';
$sql .= ', s.status';
@ -1049,9 +1051,11 @@ class Societe extends CommonObject
else if ($ref_int) $sql .= " WHERE s.ref_int = '".$this->db->escape($ref_int)."' AND s.entity IN (".getEntity($this->element, 1).")";
else if ($idprof1) $sql .= " WHERE s.siren = '".$this->db->escape($idprof1)."' AND s.entity IN (".getEntity($this->element, 1).")";
else if ($idprof2) $sql .= " WHERE s.siret = '".$this->db->escape($idprof2)."' AND s.entity IN (".getEntity($this->element, 1).")";
else if ($idprof3) $sql .= " WHERE s.ape = '".$this->db->escape($idprof3)."' AND s.entity IN (".getEntity($this->element, 1).")"; // TODO This request is used ? Multiple database recording provided !!
else if ($idprof3) $sql .= " WHERE s.ape = '".$this->db->escape($idprof3)."' AND s.entity IN (".getEntity($this->element, 1).")";
else if ($idprof4) $sql .= " WHERE s.idprof4 = '".$this->db->escape($idprof4)."' AND s.entity IN (".getEntity($this->element, 1).")";
else if ($idprof5) $sql .= " WHERE s.idprof5 = '".$this->db->escape($idprof5)."' AND s.entity IN (".getEntity($this->element, 1).")";
else if ($idprof6) $sql .= " WHERE s.idprof6 = '".$this->db->escape($idprof6)."' AND s.entity IN (".getEntity($this->element, 1).")";
$resql=$this->db->query($sql);
dol_syslog(get_class($this)."::fetch ".$sql);
if ($resql)
@ -1059,11 +1063,11 @@ class Societe extends CommonObject
$num=$this->db->num_rows($resql);
if ($num > 1)
{
$this->error='Fetch several records found request';
$this->error='Fetch found several records. Rename one of tirdparties to avoid duplicate.';
dol_syslog($this->error, LOG_ERR);
$result = -2;
}
if ($num)
elseif ($num) // $num = 1
{
$obj = $this->db->fetch_object($resql);

View File

@ -168,6 +168,7 @@ if (empty($reshook))
if (!$errors && !$object_name::replaceThirdparty($db, $soc_origin->id, $object->id))
{
$errors++;
setEventMessages($db->lasterror(), null, 'errors');
}
}
@ -202,6 +203,7 @@ if (empty($reshook))
}
else
{
$langs->load("errors");
setEventMessages($langs->trans('ErrorsThirdpartyMerge'), null, 'errors');
$db->rollback();
}

View File

@ -84,11 +84,11 @@ class WebservicesInvoicesTest extends PHPUnit_Framework_TestCase
$this->soapclient->decodeUTF8(false);
}
// create a third_party, needed to create an invoice
// create third_parties, needed to test an invoice
$societe=new Societe($db);
$societe->ref='';
$societe->name='name';
$societe->ref_ext='209';
$societe->ref_ext='ref-phpunit';
$societe->status=1;
$societe->client=1;
$societe->fournisseur=0;
@ -167,16 +167,16 @@ class WebservicesInvoicesTest extends PHPUnit_Framework_TestCase
$WS_METHOD = 'createInvoice';
// load societe first
$societe=new Societe($db);
$societe->fetch('', '', '209');
/*$societe=new Societe($db);
$societe->fetch('', '', 'ref-phpunit');
print __METHOD__." societe loaded id=".$societe->id."\n";
*/
$body = array (
"id" => NULL,
"ref" => NULL,
"ref_ext" => "165",
"thirdparty_id" => $societe->id,
"ref_ext" => "ref-phpunit-2",
"thirdparty_id" => $this->socid,
"fk_user_author" => NULL,
"fk_user_valid" => NULL,
"date" => "2015-04-19 20:16:53",
@ -247,7 +247,7 @@ class WebservicesInvoicesTest extends PHPUnit_Framework_TestCase
print __METHOD__." result=".$result['result']['result_code']."\n";
$this->assertEquals('OK',$result['result']['result_code']);
$this->assertEquals('165', $result['ref_ext']);
$this->assertEquals('ref-phpunit-2', $result['ref_ext']);
return $result;
@ -282,7 +282,7 @@ class WebservicesInvoicesTest extends PHPUnit_Framework_TestCase
// Test URL
$result='';
$parameters = array('authentication'=>$authentication,'id'=>NULL,'ref'=>NULL,'ref_ext'=>165);
$parameters = array('authentication'=>$authentication,'id'=>NULL,'ref'=>NULL,'ref_ext'=>'ref-phpunit-2');
print __METHOD__." call method ".$WS_METHOD."\n";
try {
$result = $this->soapclient->call($WS_METHOD,$parameters,$this->ns,'');
@ -303,7 +303,7 @@ class WebservicesInvoicesTest extends PHPUnit_Framework_TestCase
}
print __METHOD__." result=".$result['result']['result_code']."\n";
$this->assertEquals('OK',$result['result']['result_code']);
$this->assertEquals('165', $result['invoice']['ref_ext']);
$this->assertEquals('ref-phpunit-2', $result['invoice']['ref_ext']);
return $result;
@ -332,8 +332,8 @@ class WebservicesInvoicesTest extends PHPUnit_Framework_TestCase
$body = array (
"id" => NULL,
"ref" => NULL,
"ref_ext" => "165",
"thirdparty_id" => "209",
"ref_ext" => "ref-phpunit-2",
"thirdparty_id" => $this->socid,
"fk_user_author" => NULL,
"fk_user_valid" => NULL,
"date" => "2015-04-19 20:16:53",
@ -404,7 +404,7 @@ class WebservicesInvoicesTest extends PHPUnit_Framework_TestCase
print __METHOD__." result=".$result['result']['result_code'].$result['result']['result_label']."\n";
$this->assertEquals('OK',$result['result']['result_code']);
$this->assertEquals('165', $result['ref_ext']);
$this->assertEquals('ref-phpunit-2', $result['ref_ext']);
return $result;