Works on paypal module

Fix: db begin problem
Fix: ref_ext record problem
This commit is contained in:
Regis Houssin 2011-05-22 19:42:55 +00:00
parent c1b1e88f17
commit 4ed929d218
3 changed files with 15 additions and 17 deletions

View File

@ -53,6 +53,7 @@ class Commande extends CommonObject
var $ref;
var $ref_client;
var $ref_ext;
var $contactid;
var $fk_project;
var $statut; // -1=Canceled, 0=Draft, 1=Validated, (2=Accepted/On process not managed for customer orders), 3=Closed (Sent/Received, billed or not)
@ -590,7 +591,7 @@ class Commande extends CommonObject
$this->db->begin();
$sql = "INSERT INTO ".MAIN_DB_PREFIX."commande (";
$sql.= " ref, fk_soc, date_creation, fk_user_author, fk_projet, date_commande, source, note, note_public, ref_client";
$sql.= " ref, fk_soc, date_creation, fk_user_author, fk_projet, date_commande, source, note, note_public, ref_client, ref_ext";
$sql.= ", model_pdf, fk_cond_reglement, fk_mode_reglement, fk_availability, fk_demand_reason, date_livraison, fk_adresse_livraison";
$sql.= ", remise_absolue, remise_percent";
$sql.= ", entity";
@ -600,7 +601,9 @@ class Commande extends CommonObject
$sql.= ", ".($this->source>=0 && $this->source != '' ?$this->source:'null');
$sql.= ", '".$this->db->escape($this->note)."'";
$sql.= ", '".$this->db->escape($this->note_public)."'";
$sql.= ", '".$this->db->escape($this->ref_client)."', '".$this->modelpdf."'";
$sql.= ", '".$this->db->escape($this->ref_client)."'";
$sql.= ", ".($this->ref_ext?"'".$this->db->escape($this->ref_ext)."'":"null");
$sql.= ", '".$this->modelpdf."'";
$sql.= ", ".($this->cond_reglement_id>0?"'".$this->cond_reglement_id."'":"null");
$sql.= ", ".($this->mode_reglement_id>0?"'".$this->mode_reglement_id."'":"null");
$sql.= ", ".($this->availability_id>0?"'".$this->availability_id."'":"null");
@ -1172,7 +1175,7 @@ class Commande extends CommonObject
$sql.= ', c.date_commande';
$sql.= ', c.date_livraison';
$sql.= ', c.fk_projet, c.remise_percent, c.remise, c.remise_absolue, c.source, c.facture as facturee';
$sql.= ', c.note, c.note_public, c.ref_client, c.model_pdf, c.fk_adresse_livraison';
$sql.= ', c.note, c.note_public, c.ref_client, c.ref_ext, c.model_pdf, c.fk_adresse_livraison';
$sql.= ', p.code as mode_reglement_code, p.libelle as mode_reglement_libelle';
$sql.= ', cr.code as cond_reglement_code, cr.libelle as cond_reglement_libelle, cr.libelle_facture as cond_reglement_libelle_doc';
$sql.= ', ca.code as availability_code';
@ -1198,6 +1201,7 @@ class Commande extends CommonObject
$this->id = $obj->rowid;
$this->ref = $obj->ref;
$this->ref_client = $obj->ref_client;
$this->ref_ext = $obj->ref_ext;
$this->socid = $obj->fk_soc;
$this->statut = $obj->fk_statut;
$this->user_author_id = $obj->fk_user_author;

View File

@ -66,6 +66,7 @@ class Facture extends CommonObject
var $datem;
var $ref;
var $ref_client;
var $ref_ext;
//! 0=Standard invoice, 1=Replacement invoice, 2=Credit note invoice, 3=Deposit invoice, 4=Proforma invoice
var $type;
var $amount;
@ -220,7 +221,7 @@ class Facture extends CommonObject
$sql.= ", datef";
$sql.= ", note";
$sql.= ", note_public";
$sql.= ", ref_client";
$sql.= ", ref_client, ref_ext";
$sql.= ", fk_facture_source, fk_user_author, fk_projet";
$sql.= ", fk_cond_reglement, fk_mode_reglement, date_lim_reglement, model_pdf";
$sql.= ")";
@ -237,6 +238,7 @@ class Facture extends CommonObject
$sql.= ",".($this->note?"'".$this->db->escape($this->note)."'":"null");
$sql.= ",".($this->note_public?"'".$this->db->escape($this->note_public)."'":"null");
$sql.= ",".($this->ref_client?"'".$this->db->escape($this->ref_client)."'":"null");
$sql.= ",".($this->ref_ext?"'".$this->db->escape($this->ref_ext)."'":"null");
$sql.= ",".($this->fk_facture_source?"'".$this->db->escape($this->fk_facture_source)."'":"null");
$sql.= ",".($user->id > 0 ? "'".$user->id."'":"null");
$sql.= ",".($this->fk_project?$this->fk_project:"null");
@ -682,6 +684,7 @@ class Facture extends CommonObject
$this->id = $obj->rowid;
$this->ref = $obj->facnumber;
$this->ref_client = $obj->ref_client;
$this->ref_ext = $obj->ref_ext;
$this->type = $obj->type;
$this->date = $this->db->jdate($obj->df);
$this->date_creation = $this->db->jdate($obj->datec);

View File

@ -97,6 +97,7 @@ if (isset($_GET['action']) && ! empty($_GET['action']) && isset($_GET['transacti
$soc->particulier = 1;
$db->begin();
$result = $soc->create($user);
if ($result >= 0)
{
@ -157,10 +158,8 @@ if (isset($_GET['action']) && ! empty($_GET['action']) && isset($_GET['transacti
$object->socid=$soc->id;
$object->fetch_thirdparty();
$db->begin();
$object->date = dol_now();
$object->ref_ext = $_SESSION[$_GET['transaction_id']]['SHIPTOCITY'];
$object->ref_ext = $_SESSION[$_GET['transaction_id']]['TRANSACTIONID'];
$object_id = $object->create($user);
if ($object_id > 0)
@ -208,7 +207,7 @@ if (isset($_GET['action']) && ! empty($_GET['action']) && isset($_GET['transacti
$error++;
}
if ($object_id > 0 && ! $error)
if (! $error)
{
$db->commit();
$return_arr['elementurl'] = $object->getNomUrl(0,'',0,1);
@ -220,13 +219,7 @@ if (isset($_GET['action']) && ! empty($_GET['action']) && isset($_GET['transacti
}
echo json_encode($return_arr);
/*
foreach ($_SESSION[$_GET['transaction_id']] as $key => $value)
{
echo $key.': '.$value.'<br />';
}
*/
}
else if ($_GET['action'] == 'showdetails')
{
@ -300,8 +293,6 @@ if (isset($_GET['action']) && ! empty($_GET['action']) && isset($_GET['transacti
/*
echo '<br />';
foreach ($_SESSION[$_GET['transaction_id']] as $key => $value)
{
echo $key.': '.$value.'<br />';