2
0
forked from Wavyzz/dolibarr

Works on paypal module

This commit is contained in:
Regis Houssin
2011-05-17 18:28:54 +00:00
parent e570201c85
commit 1dca5104e2
3 changed files with 122 additions and 6 deletions

View File

@@ -547,6 +547,55 @@ class CommonObject
$this->$object->fetch($this->origin_id);
}
/**
* Load object from import key
* @param table Table element or element line
* @param key Import key
* @return int <0 if KO, >0 if OK
*/
function fetchObjectFromImportKey($table,$key)
{
global $conf;
$result=false;
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX.$table;
$sql.= " WHERE import_key = '".$key."'";
$sql.= " AND entity = ".$conf->entity;
$resql = $this->db->query($sql);
if ($resql)
{
$row = $this->db->fetch_row($resql);
$result = $this->fetch($row[0]);
}
return $result;
}
/**
* Load object from external reference
* @param table Table element or element line
* @param ref External reference
* @return int <0 if KO, >0 if OK
*/
function fetchObjectFromRefExt($table,$ref)
{
global $conf;
$result=false;
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX.$table;
$sql.= " WHERE ref_ext = '".$ref."'";
$sql.= " AND entity = ".$conf->entity;
$resql = $this->db->query($sql);
if ($resql)
{
$row = $this->db->fetch_row($resql);
$result = $this->fetch($row[0]);
}
return $result;
}
/**
* \brief Load properties id_previous and id_next