Change for paybox module
This commit is contained in:
parent
9836b56194
commit
ba55fd2695
@ -132,7 +132,7 @@ $regex=DOL_URL_ROOT.'$';
|
||||
$firstpart=eregi_replace($regex,'',$firstpart);
|
||||
//print $firstpart.DOL_URL_ROOT.'/public/paybox/newpayment.php?amount=order&ref=<i>orderref</i>&tag=<i>ATAGOFYOURCHOICE</i>'."<br>\n";
|
||||
//print $firstpart.DOL_URL_ROOT.'/public/paybox/newpayment.php?amount=invoice&ref=<i>invoiceref</i>&tag=<i>ATAGOFYOURCHOICE</i>'."<br>\n";
|
||||
//print $firstpart.DOL_URL_ROOT.'/public/paybox/newpayment.php?amount=contractline&ref=<i>contractlineref</i>&tag=<i>ATAGOFYOURCHOICE</i>'."<br>\n";
|
||||
print $firstpart.DOL_URL_ROOT.'/public/paybox/newpayment.php?amount=contractline&ref=<i>contractlineref</i>&tag=<i>ATAGOFYOURCHOICE</i>'."<br>\n";
|
||||
print $firstpart.DOL_URL_ROOT.'/public/paybox/newpayment.php?amount=<i>9.99</i>&tag=<i>ATAGOFYOURCHOICE</i>'."<br>\n";
|
||||
|
||||
|
||||
|
||||
@ -19,10 +19,10 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/contrat/contrat.class.php
|
||||
\ingroup contrat
|
||||
\brief Fichier de la classe des contrats
|
||||
\version $Id$
|
||||
* \file htdocs/contrat/contrat.class.php
|
||||
* \ingroup contrat
|
||||
* \brief Fichier de la classe des contrats
|
||||
* \version $Id$
|
||||
*/
|
||||
|
||||
require_once(DOL_DOCUMENT_ROOT."/commonobject.class.php");
|
||||
@ -31,8 +31,8 @@ require_once(DOL_DOCUMENT_ROOT."/lib/price.lib.php");
|
||||
|
||||
|
||||
/**
|
||||
\class Contrat
|
||||
\brief Classe permettant la gestion des contrats
|
||||
* \class Contrat
|
||||
* \brief Classe permettant la gestion des contrats
|
||||
*/
|
||||
class Contrat extends CommonObject
|
||||
{
|
||||
@ -72,7 +72,7 @@ class Contrat extends CommonObject
|
||||
|
||||
/**
|
||||
* \brief Constructeur de la classe
|
||||
* \param DB handler acc<EFBFBD>s base de donn<EFBFBD>es
|
||||
* \param DB Databse handler
|
||||
*/
|
||||
function Contrat($DB)
|
||||
{
|
||||
@ -353,6 +353,7 @@ class Contrat extends CommonObject
|
||||
|
||||
$ligne = new ContratLigne($this->db);
|
||||
$ligne->id = $objp->rowid;
|
||||
$ligne->ref = $objp->rowid;
|
||||
$ligne->fk_contrat = $objp->fk_contrat;
|
||||
$ligne->desc = $objp->description; // Description ligne
|
||||
$ligne->qty = $objp->qty;
|
||||
@ -1333,10 +1334,9 @@ class Contrat extends CommonObject
|
||||
|
||||
|
||||
/**
|
||||
\class ContratLigne
|
||||
\brief Classe permettant la gestion des lignes de contrats
|
||||
* \class ContratLigne
|
||||
* \brief Classe permettant la gestion des lignes de contrats
|
||||
*/
|
||||
|
||||
class ContratLigne
|
||||
{
|
||||
var $db; //!< To store db handler
|
||||
@ -1346,7 +1346,7 @@ class ContratLigne
|
||||
//var $table_element='contratdet'; //!< Name of table without prefix where object is stored
|
||||
|
||||
var $id;
|
||||
|
||||
var $ref;
|
||||
var $tms;
|
||||
var $fk_contrat;
|
||||
var $fk_product;
|
||||
@ -1477,15 +1477,16 @@ class ContratLigne
|
||||
return $result;
|
||||
}
|
||||
|
||||
/*
|
||||
* \brief Load object in memory from database
|
||||
* \param id id object
|
||||
* \param user User that load
|
||||
* \return int <0 if KO, >0 if OK
|
||||
/**
|
||||
* \brief Load object in memory from database
|
||||
* \param id id object
|
||||
* \param ref Ref of contract
|
||||
* \return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function fetch($id, $user=0)
|
||||
function fetch($id, $ref='')
|
||||
{
|
||||
global $langs;
|
||||
global $langs,$user;
|
||||
|
||||
$sql = "SELECT";
|
||||
$sql.= " t.rowid,";
|
||||
|
||||
@ -1515,9 +1516,9 @@ class ContratLigne
|
||||
$sql.= " t.fk_user_ouverture,";
|
||||
$sql.= " t.fk_user_cloture,";
|
||||
$sql.= " t.commentaire";
|
||||
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."contratdet as t";
|
||||
$sql.= " WHERE t.rowid = ".$id;
|
||||
if ($id) $sql.= " WHERE t.rowid = ".$id;
|
||||
if ($ref) $sql.= " WHERE t.rowid = '".$ref."'";
|
||||
|
||||
dolibarr_syslog("Contratdet::fetch sql=".$sql, LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
@ -1528,7 +1529,8 @@ class ContratLigne
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
$this->id = $obj->rowid;
|
||||
|
||||
$this->ref = $obj->rowid;
|
||||
|
||||
$this->tms = $obj->tms;
|
||||
$this->fk_contrat = $obj->fk_contrat;
|
||||
$this->fk_product = $obj->fk_product;
|
||||
@ -1556,7 +1558,6 @@ class ContratLigne
|
||||
$this->fk_user_cloture = $obj->fk_user_cloture;
|
||||
$this->commentaire = $obj->commentaire;
|
||||
|
||||
|
||||
}
|
||||
$this->db->free($resql);
|
||||
|
||||
|
||||
@ -25,7 +25,6 @@
|
||||
*/
|
||||
|
||||
|
||||
|
||||
function llxHeaderPaybox($title, $head = "")
|
||||
{
|
||||
global $user, $conf, $langs;
|
||||
@ -120,7 +119,7 @@ function print_paybox_redirect($PRICE,$EMAIL,$urlok,$urlko,$DOLSTRING,$ID=0)
|
||||
$IBS_MODE=1; # Mode formulaire
|
||||
|
||||
$IBS_PORTEUR=$EMAIL;
|
||||
$IBS_RETOUR="montant:M;ref:R;auto:A;trans:T"; # Format des paramètres du get de validation en reponse (url a definir sous paybox)
|
||||
$IBS_RETOUR="montant:M;ref:R;auto:A;trans:T"; # Format des param<EFBFBD>tres du get de validation en reponse (url a definir sous paybox)
|
||||
$IBS_TXT="<center><b>".$langs->trans("YouWillBeRedirectedOnPayBox")."</b><br><i>".$langs->trans("PleaseBePatient")."...</i><br></center>";
|
||||
$IBS_EFFECTUE=$urlok;
|
||||
$IBS_ANNULE=$urlko;
|
||||
|
||||
@ -139,8 +139,9 @@ $var=false;
|
||||
if (is_numeric($_REQUEST["amount"]))
|
||||
{
|
||||
$found=true;
|
||||
|
||||
// Currency
|
||||
$tag=$_REQUEST["tag"];
|
||||
|
||||
// Creditor
|
||||
$var=!$var;
|
||||
print '<tr><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("Creditor");
|
||||
print '</td><td class="CTableRow'.($var?'1':'2').'"><b>'.$mysoc->nom.'</b></td></tr>'."\n";
|
||||
@ -162,7 +163,86 @@ if (is_numeric($_REQUEST["amount"]))
|
||||
// Tag
|
||||
$var=!$var;
|
||||
print '<tr><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("PaymentCode");
|
||||
print '</td><td class="CTableRow'.($var?'1':'2').'"><b>'.$_REQUEST["tag"].'</b></td></tr>'."\n";
|
||||
print '</td><td class="CTableRow'.($var?'1':'2').'"><b>'.$tag.'</b></td></tr>'."\n";
|
||||
// EMail
|
||||
$var=!$var;
|
||||
print '<tr><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("YourEMail");
|
||||
print ' ('.$langs->trans("ToComplete").')';
|
||||
print '</td><td class="CTableRow'.($var?'1':'2').'"><input class="flat" type="text" name="EMAIL" size="48" value="'.$_REQUEST["EMAIL"].'"></td></tr>'."\n";
|
||||
}
|
||||
|
||||
if ($_REQUEST["amount"] == 'contractline')
|
||||
{
|
||||
$found=true;
|
||||
|
||||
require_once(DOL_DOCUMENT_ROOT."/contrat/contrat.class.php");
|
||||
|
||||
$contractline=new ContratLigne($db);
|
||||
$result=$contractline->fetch('',$_GET["ref"]);
|
||||
if ($result < 0)
|
||||
{
|
||||
$mesg=$contractline->error;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($contractline->fk_contrat > 0)
|
||||
{
|
||||
$contract=new Contrat($db);
|
||||
$result=$contract->fetch($contractline->fk_contrat);
|
||||
if ($result < 0)
|
||||
{
|
||||
$mesg=$contract->error;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg='ErrorRecordNotFound';
|
||||
}
|
||||
}
|
||||
$amount=$contractline->total_ttc;
|
||||
$tag='';
|
||||
if (! empty($_REQUEST["tag"])) $tag=$_REQUEST["tag"].'-';
|
||||
$tag.='thirdparty='.$contract->socid.'-contractref='.$contract->ref.'-contractlineref='.$contractline->ref;
|
||||
$qty=1;
|
||||
if (isset($_REQUEST["qty"])) $qty=$_REQUEST["qty"];
|
||||
|
||||
// Object
|
||||
$var=!$var;
|
||||
$text=$langs->trans("PaymentRenewContractId",$contractline->ref,$contract->id);
|
||||
if ($contractline->description) $text.='<br>'.dol_htmlentitiesbr($contractline->description);
|
||||
print '<tr><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("Designation");
|
||||
print '</td><td class="CTableRow'.($var?'1':'2').'"><b>'.$text.'</b></td></tr>'."\n";
|
||||
// Quantity
|
||||
$var=!$var;
|
||||
print '<tr><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("Quantity");
|
||||
print '</td><td class="CTableRow'.($var?'1':'2').'"><b>';
|
||||
print $qty;
|
||||
print '<input type="hidden" name="newqty" value="'.$qty.'">';
|
||||
print '</b></td></tr>'."\n";
|
||||
|
||||
// Creditor
|
||||
$var=!$var;
|
||||
print '<tr><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("Creditor");
|
||||
print '</td><td class="CTableRow'.($var?'1':'2').'"><b>'.$mysoc->nom.'</b></td></tr>'."\n";
|
||||
// Amount
|
||||
$var=!$var;
|
||||
print '<tr><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("Amount");
|
||||
if (empty($amount)) print ' ('.$langs->trans("ToComplete").')';
|
||||
print '</td><td class="CTableRow'.($var?'1':'2').'">';
|
||||
if (empty($amount) || ! is_numeric($amount)) print '<input class="flat" size=8 type="text" name="newamount" value="'.$_REQUEST["newamount"].'">';
|
||||
else {
|
||||
print '<b>'.price($amount).'</b>';
|
||||
print '<input type="hidden" name="newamount" value="'.$amount.'">';
|
||||
}
|
||||
print '</td></tr>'."\n";
|
||||
// Currency
|
||||
$var=!$var;
|
||||
print '<tr><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("Currency");
|
||||
print '</td><td class="CTableRow'.($var?'1':'2').'"><b>EUR</b></td></tr>'."\n";
|
||||
// Tag
|
||||
$var=!$var;
|
||||
print '<tr><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("PaymentCode");
|
||||
print '</td><td class="CTableRow'.($var?'1':'2').'"><b>'.$tag.'</b></td></tr>'."\n";
|
||||
// EMail
|
||||
$var=!$var;
|
||||
print '<tr><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("YourEMail");
|
||||
@ -172,8 +252,7 @@ if (is_numeric($_REQUEST["amount"]))
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (! $found) $mesg=$langs->trans("ErrorBadParameters");
|
||||
if (! $found && ! $mesg) $mesg=$langs->trans("ErrorBadParameters");
|
||||
|
||||
if ($mesg) print '<tr><td align="center" colspan="2"><br><div class="warning">'.$mesg.'</div></td></tr>';
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user