FIX regression + add $forceentity parameter
This commit is contained in:
parent
ade854a469
commit
7db5f7eb1c
@ -1445,15 +1445,14 @@ class Propal extends CommonObject
|
|||||||
/**
|
/**
|
||||||
* Load a proposal from database. Get also lines.
|
* Load a proposal from database. Get also lines.
|
||||||
*
|
*
|
||||||
* @param int $rowid id of object to load
|
* @param int $rowid id of object to load
|
||||||
* @param string $ref Ref of proposal
|
* @param string $ref Ref of proposal
|
||||||
* @param string $ref_ext Ref ext of proposal
|
* @param string $ref_ext Ref ext of proposal
|
||||||
* @return int >0 if OK, <0 if KO
|
* @param int $forceentity Entity id to force
|
||||||
|
* @return int >0 if OK, <0 if KO
|
||||||
*/
|
*/
|
||||||
public function fetch($rowid, $ref = '', $ref_ext = '')
|
public function fetch($rowid, $ref = '', $ref_ext = '', $forceentity = 0)
|
||||||
{
|
{
|
||||||
global $conf;
|
|
||||||
|
|
||||||
$sql = "SELECT p.rowid, p.ref, p.entity, p.remise, p.remise_percent, p.remise_absolue, p.fk_soc";
|
$sql = "SELECT p.rowid, p.ref, p.entity, p.remise, p.remise_percent, p.remise_absolue, p.fk_soc";
|
||||||
$sql .= ", p.total_ttc, p.total_tva, p.localtax1, p.localtax2, p.total_ht";
|
$sql .= ", p.total_ttc, p.total_tva, p.localtax1, p.localtax2, p.total_ht";
|
||||||
$sql .= ", p.datec";
|
$sql .= ", p.datec";
|
||||||
@ -1491,8 +1490,12 @@ class Propal extends CommonObject
|
|||||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_input_reason as dr ON p.fk_input_reason = dr.rowid';
|
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_input_reason as dr ON p.fk_input_reason = dr.rowid';
|
||||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_incoterms as i ON p.fk_incoterms = i.rowid';
|
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_incoterms as i ON p.fk_incoterms = i.rowid';
|
||||||
|
|
||||||
if ($ref) {
|
if (!empty($ref)) {
|
||||||
$sql .= " WHERE p.entity = ".(int) $conf->entity; // Check only the current entity because we may have the same reference in several entities
|
if (!empty($forceentity)) {
|
||||||
|
$sql .= " WHERE p.entity = ".(int) $forceentity; // Check only the current entity because we may have the same reference in several entities
|
||||||
|
} else {
|
||||||
|
$sql .= " WHERE p.entity IN (".getEntity('propal').")";
|
||||||
|
}
|
||||||
$sql .= " AND p.ref='".$this->db->escape($ref)."'";
|
$sql .= " AND p.ref='".$this->db->escape($ref)."'";
|
||||||
} else {
|
} else {
|
||||||
// Dont't use entity if you use rowid
|
// Dont't use entity if you use rowid
|
||||||
|
|||||||
@ -26,7 +26,7 @@
|
|||||||
*/
|
*/
|
||||||
function showOnlineSignatureUrl($type, $ref)
|
function showOnlineSignatureUrl($type, $ref)
|
||||||
{
|
{
|
||||||
global $conf, $langs;
|
global $langs;
|
||||||
|
|
||||||
// Load translation files required by the page
|
// Load translation files required by the page
|
||||||
$langs->loadLangs(array("payment", "paybox"));
|
$langs->loadLangs(array("payment", "paybox"));
|
||||||
|
|||||||
@ -126,7 +126,7 @@ $creditor = $mysoc->name;
|
|||||||
$type = $source;
|
$type = $source;
|
||||||
if ($source == 'proposal') {
|
if ($source == 'proposal') {
|
||||||
$object = new Propal($db);
|
$object = new Propal($db);
|
||||||
$object->fetch(0, $ref);
|
$object->fetch(0, $ref, '', $entity);
|
||||||
} else {
|
} else {
|
||||||
accessforbidden('Bad value for source');
|
accessforbidden('Bad value for source');
|
||||||
exit;
|
exit;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user