Support paybox payment on members
This commit is contained in:
parent
6dbe70b2f5
commit
d82502beb4
@ -33,6 +33,7 @@ For users:
|
||||
contract status.
|
||||
- New: Add a first version of a module for Paybox.
|
||||
- New: Can add contact to suppliers orders.
|
||||
- New: Changements to support the external BitTorrent module.
|
||||
- Fix: Handle correctly the comment in status changing of supplier orders.
|
||||
- Fix: Author, title and topic are correctly encoded in PDF.
|
||||
- Fix: Now HTML output is always UTF8, this solve bad PDF encoding on old users.
|
||||
|
||||
@ -785,11 +785,12 @@ class Adherent extends CommonObject
|
||||
|
||||
|
||||
/**
|
||||
* \brief Fonction qui recupere l'adherent en donnant son rowid
|
||||
* \param rowid
|
||||
* \return int <0 si KO, >0 si OK
|
||||
* \brief Load member from database
|
||||
* \param rowid id of object to load
|
||||
* \param ref Ref of invoice
|
||||
* \return int >0 if OK, <0 if KO
|
||||
*/
|
||||
function fetch($rowid)
|
||||
function fetch($rowid,$ref='')
|
||||
{
|
||||
global $langs;
|
||||
|
||||
@ -809,7 +810,8 @@ class Adherent extends CommonObject
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_pays as p ON d.pays = p.rowid";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as u ON d.rowid = u.fk_member";
|
||||
$sql.= " WHERE d.fk_adherent_type = t.rowid";
|
||||
$sql.= " AND d.rowid = ".$rowid;
|
||||
if ($ref) $sql.= " AND d.rowid='".$ref."'";
|
||||
else $sql.= " AND d.rowid=".$rowid;
|
||||
dol_syslog("Adherent::fetch sql=".$sql);
|
||||
|
||||
$resql=$this->db->query($sql);
|
||||
|
||||
@ -162,19 +162,34 @@ $firstpart=$dolibarr_main_url_root;
|
||||
$regex=DOL_URL_ROOT.'$';
|
||||
$firstpart=eregi_replace($regex,'',$firstpart);
|
||||
print '<br>';
|
||||
print img_picto('','puce.png').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnOrder",$servicename).':<br>';
|
||||
print '<b>'.$firstpart.DOL_URL_ROOT.'/public/paybox/newpayment.php?amount=order&ref=<i>orderref</i></b>'."<br>\n";
|
||||
print '<br>';
|
||||
print img_picto('','puce.png').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnInvoice",$servicename).':<br>';
|
||||
print '<b>'.$firstpart.DOL_URL_ROOT.'/public/paybox/newpayment.php?amount=invoice&ref=<i>invoiceref</i></b>'."<br>\n";
|
||||
//print $langs->trans("SetupPayBoxToHavePaymentCreatedAutomatically",$langs->transnoentitiesnoconv("FeatureNotYetAvailable"))."<br>\n";
|
||||
print '<br>';
|
||||
print img_picto('','puce.png').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnContractLine",$servicename).':<br>';
|
||||
print '<b>'.$firstpart.DOL_URL_ROOT.'/public/paybox/newpayment.php?amount=contractline&ref=<i>contractlineref</i></b>'."<br>\n";
|
||||
print '<br>';
|
||||
print img_picto('','puce.png').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnFreeAmount",$servicename).':<br>';
|
||||
print '<b>'.$firstpart.DOL_URL_ROOT.'/public/paybox/newpayment.php?amount=<i>9.99</i>&tag=<i>yourfreetag</i></b>'."<br>\n";
|
||||
print '<b>'.$firstpart.DOL_URL_ROOT.'/public/paybox/newpayment.php?amount=<i>9.99</i>&tag=<i>your_free_tag</i></b>'."<br>\n";
|
||||
print '<br>';
|
||||
if ($conf->commande->enabled)
|
||||
{
|
||||
print img_picto('','puce.png').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnOrder",$servicename).':<br>';
|
||||
print '<b>'.$firstpart.DOL_URL_ROOT.'/public/paybox/newpayment.php?amount=order&ref=<i>order_ref</i></b>'."<br>\n";
|
||||
print '<br>';
|
||||
}
|
||||
if ($conf->facture->enabled)
|
||||
{
|
||||
print img_picto('','puce.png').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnInvoice",$servicename).':<br>';
|
||||
print '<b>'.$firstpart.DOL_URL_ROOT.'/public/paybox/newpayment.php?amount=invoice&ref=<i>invoice_ref</i></b>'."<br>\n";
|
||||
// print $langs->trans("SetupPayBoxToHavePaymentCreatedAutomatically",$langs->transnoentitiesnoconv("FeatureNotYetAvailable"))."<br>\n";
|
||||
print '<br>';
|
||||
}
|
||||
if ($conf->contract->enabled)
|
||||
{
|
||||
print img_picto('','puce.png').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnContractLine",$servicename).':<br>';
|
||||
print '<b>'.$firstpart.DOL_URL_ROOT.'/public/paybox/newpayment.php?amount=contractline&ref=<i>contractline_ref</i></b>'."<br>\n";
|
||||
print '<br>';
|
||||
}
|
||||
if ($conf->adherent->enabled)
|
||||
{
|
||||
print img_picto('','puce.png').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnMemberSubscription",$servicename).':<br>';
|
||||
print '<b>'.$firstpart.DOL_URL_ROOT.'/public/paybox/newpayment.php?amount=membersubscription&ref=<i>member_ref</i></b>'."<br>\n";
|
||||
print '<br>';
|
||||
}
|
||||
print $langs->trans("YouCanAddTagOnUrl");
|
||||
|
||||
$db->close();
|
||||
|
||||
@ -63,6 +63,7 @@ MembersStatusNotPayedShort=Out of date
|
||||
MembersStatusResiliated=Resiliated members
|
||||
MembersStatusResiliatedShort=Resiliated members
|
||||
NewCotisation=New contribution
|
||||
PaymentSubscription=New contribution payment
|
||||
EditMember=Edit member
|
||||
SubscriptionEndDate=Subscription's end date
|
||||
NewAttribute=New attribut
|
||||
|
||||
@ -18,5 +18,6 @@ ToOfferALinkForOnlinePaymentOnOrder=URL to offer a %s online payment user interf
|
||||
ToOfferALinkForOnlinePaymentOnInvoice=URL to offer a %s online payment user interface for an invoice
|
||||
ToOfferALinkForOnlinePaymentOnContractLine=URL to offer a %s online payment user interface for a contract line
|
||||
ToOfferALinkForOnlinePaymentOnFreeAmount=URL to offer a %s online payment user interface for a free amount
|
||||
ToOfferALinkForOnlinePaymentOnMemberSubscriptionURL to offer a %s online payment user interface for a member subscription
|
||||
YouCanAddTagOnUrl=You can also add url parameter <b>&tag=<i>value</i></b> to any of those URL (required only for free payment) to add your own payment comment tag.
|
||||
SetupPayBoxToHavePaymentCreatedAutomatically=Setup your PayBox with url <b>%s</b> to have payment created automatically when validated by paybox.
|
||||
@ -63,6 +63,7 @@ MembersStatusNotPayedShort=Non à jour
|
||||
MembersStatusResiliated=Adhérents résiliés
|
||||
MembersStatusResiliatedShort=Adhérents résiliés
|
||||
NewCotisation=Nouvelle adhésion
|
||||
PaymentSubscription=Paiement cotisation
|
||||
EditMember=Édition adhérent
|
||||
SubscriptionEndDate=Date de fin adhésion
|
||||
NewAttribute=Nouvel attribut
|
||||
|
||||
@ -18,6 +18,7 @@ ToOfferALinkForOnlinePaymentOnOrder=URL offrant une interface de paiement en lig
|
||||
ToOfferALinkForOnlinePaymentOnInvoice=URL offrant une interface de paiement en ligne %s sur la base du montant d'une facture
|
||||
ToOfferALinkForOnlinePaymentOnContractLine=URL offrant une interface de paiement en ligne %s sur la base du montant d'une ligne de contrat
|
||||
ToOfferALinkForOnlinePaymentOnFreeAmount=URL offrant une interface de paiement en ligne %s pour un montant libre
|
||||
ToOfferALinkForOnlinePaymentOnMemberSubscription=URL offrant une interface de paiement en ligne %s sur la base d'une cotisation d'adhérent
|
||||
YouCanAddTagOnUrl=Vous pouvez de plus ajouter le paramètre url <b>&tag=<i>value</i></b> à n'importe quelles de ces URL (obligatoire pour le paiement libre uniquement) pour ajouter votre propre "code commentaire" du paiement.
|
||||
SetupPayBoxToHavePaymentCreatedAutomatically=Configurez votre url PayBox à <b>%s</b> pour avoir le paiement créé automatiquement si validé.
|
||||
|
||||
@ -236,6 +236,8 @@ function print_paybox_redirect($PRICE,$CURRENCY,$EMAIL,$urlok,$urlko,$TAG)
|
||||
*/
|
||||
function html_print_footer($fromcompany,$langs)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
// Juridical status
|
||||
$ligne1="";
|
||||
if ($fromcompany->forme_juridique_code)
|
||||
|
||||
@ -150,6 +150,49 @@ $found=false;
|
||||
$var=false;
|
||||
|
||||
|
||||
|
||||
// Free payment
|
||||
if (is_numeric($_REQUEST["amount"]))
|
||||
{
|
||||
$found=true;
|
||||
$tag=$_REQUEST["tag"];
|
||||
$newtag=$tag;
|
||||
|
||||
// Creditor
|
||||
$var=!$var;
|
||||
print '<tr><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("Creditor");
|
||||
print '</td><td class="CTableRow'.($var?'1':'2').'"><b>'.$creditor.'</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 ' <b>'.$langs->trans("Currency".$conf->monnaie).'</b>';
|
||||
print '<input type="hidden" name="currency" value="'.$conf->monnaie.'">';
|
||||
print '</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>'.$newtag.'</b>';
|
||||
print '<input type="hidden" name="tag" value="'.$tag.'">';
|
||||
print '<input type="hidden" name="newtag" value="'.$newtag.'">';
|
||||
print '</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";
|
||||
}
|
||||
|
||||
|
||||
// Payment on customer order
|
||||
if ($_REQUEST["amount"] == 'order')
|
||||
{
|
||||
@ -457,18 +500,51 @@ if ($_REQUEST["amount"] == 'contractline')
|
||||
|
||||
}
|
||||
|
||||
// Free payment
|
||||
if (is_numeric($_REQUEST["amount"]))
|
||||
// Payment on member subscription
|
||||
if ($_REQUEST["amount"] == 'membersubscription')
|
||||
{
|
||||
$found=true;
|
||||
$tag=$_REQUEST["tag"];
|
||||
$newtag=$tag;
|
||||
$langs->load("members");
|
||||
|
||||
require_once(DOL_DOCUMENT_ROOT."/adherents/adherent.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/adherents/cotisation.class.php");
|
||||
|
||||
$member=new Adherent($db);
|
||||
$result=$member->fetch('',$_REQUEST["ref"]);
|
||||
if ($result < 0)
|
||||
{
|
||||
$mesg=$member->error;
|
||||
}
|
||||
else
|
||||
{
|
||||
$subscription=new Cotisation($db);
|
||||
//$result=$subscription->fetch();
|
||||
}
|
||||
|
||||
$amount=$subscription->total_ttc;
|
||||
|
||||
$newtag='MID='.$member->id.'.M='.strtr($member->fullname,"-"," ");
|
||||
if (! empty($_REQUEST["tag"])) { $tag=$_REQUEST["tag"]; $newtag.='.TAG='.$_REQUEST["tag"]; }
|
||||
$newtag=dol_string_unaccent($newtag);
|
||||
|
||||
// Creditor
|
||||
$var=!$var;
|
||||
print '<tr><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("Creditor");
|
||||
print '</td><td class="CTableRow'.($var?'1':'2').'"><b>'.$creditor.'</b></td></tr>'."\n";
|
||||
|
||||
// Debitor
|
||||
$var=!$var;
|
||||
print '<tr><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("Member");
|
||||
print '</td><td class="CTableRow'.($var?'1':'2').'"><b>'.$member->fullname.'</b>';
|
||||
|
||||
// Object
|
||||
$var=!$var;
|
||||
$text='<b>'.$langs->trans("PaymentSubscription").'</b>';
|
||||
print '<tr><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("Designation");
|
||||
print '</td><td class="CTableRow'.($var?'1':'2').'">'.$text;
|
||||
print '<input type="hidden" name="ref" value="'.$member->ref.'">';
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
// Amount
|
||||
$var=!$var;
|
||||
print '<tr><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("Amount");
|
||||
@ -499,13 +575,15 @@ if (is_numeric($_REQUEST["amount"]))
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if (! $found && ! $mesg) $mesg=$langs->trans("ErrorBadParameters");
|
||||
|
||||
if ($mesg) print '<tr><td align="center" colspan="2"><br><div class="warning">'.$mesg.'</div></td></tr>';
|
||||
|
||||
if ($found)
|
||||
{
|
||||
print '<tr><td align="center" colspan="2"><br><input class="none" type="submit" name="dopayment" value="'.$langs->trans("PayBoxDoPayment").'"></td></tr>';
|
||||
print '<tr><td align="center" colspan="2"><br><input class="button" type="submit" name="dopayment" value="'.$langs->trans("PayBoxDoPayment").'"></td></tr>';
|
||||
//print '<tr><td align="center" colspan="2">'.$langs->trans("YouWillBeRedirectedOnPayBox").'...</td></tr>';
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user