New: Add a first version of a Paybox module
This commit is contained in:
parent
9fe83ec7e6
commit
3b06c7834c
@ -26,7 +26,7 @@
|
||||
require("./pre.inc.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/lib/admin.lib.php");
|
||||
|
||||
$service='PayBox';
|
||||
$servicename='PayBox';
|
||||
|
||||
$langs->load("admin");
|
||||
$langs->load("paybox");
|
||||
@ -37,8 +37,9 @@ if (!$user->admin)
|
||||
|
||||
if ($_POST["action"] == 'setvalue' && $user->admin)
|
||||
{
|
||||
$result=dolibarr_set_const($db, "PAYBOX_IBS_DEVISE",$_POST["PAYBOX_IBS_DEVISE"]);
|
||||
$result=dolibarr_set_const($db, "PAYBOX_CGI_URL",$_POST["PAYBOX_CGI_URL"]);
|
||||
//$result=dolibarr_set_const($db, "PAYBOX_IBS_DEVISE",$_POST["PAYBOX_IBS_DEVISE"]);
|
||||
$result=dolibarr_set_const($db, "PAYBOX_CGI_URL_V1",$_POST["PAYBOX_CGI_URL_V1"]);
|
||||
$result=dolibarr_set_const($db, "PAYBOX_CGI_URL_V2",$_POST["PAYBOX_CGI_URL_V2"]);
|
||||
$result=dolibarr_set_const($db, "PAYBOX_CSS_URL",$_POST["PAYBOX_CSS_URL"]);
|
||||
$result=dolibarr_set_const($db, "PAYBOX_IBS_SITE",$_POST["PAYBOX_IBS_SITE"]);
|
||||
$result=dolibarr_set_const($db, "PAYBOX_IBS_RANG",$_POST["PAYBOX_IBS_RANG"]);
|
||||
@ -87,19 +88,14 @@ print '<td>'.$langs->trans("Parameter").'</td>';
|
||||
print '<td>'.$langs->trans("Value").'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
/*
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>';
|
||||
print $langs->trans("PAYBOX_IBS_DEVISE").'</td><td>';
|
||||
print '<input size="32" type="text" name="PAYBOX_IBS_DEVISE" value="'.$conf->global->PAYBOX_IBS_DEVISE.'">';
|
||||
print '<br>'.$langs->trans("Example").': 978 (EUR)';
|
||||
print '</td></tr>';
|
||||
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>';
|
||||
print $langs->trans("PAYBOX_CGI_URL").'</td><td>';
|
||||
print '<input size="64" type="text" name="PAYBOX_CGI_URL" value="'.$conf->global->PAYBOX_CGI_URL.'">';
|
||||
print '<br>'.$langs->trans("Example").': http://mysite/cgi-bin/module_linux.cgi';
|
||||
print '</td></tr>';
|
||||
*/
|
||||
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>';
|
||||
@ -108,6 +104,20 @@ print '<input size="64" type="text" name="PAYBOX_CSS_URL" value="'.$conf->global
|
||||
print '<br>'.$langs->trans("Example").': http://mysite/mycss.css';
|
||||
print '</td></tr>';
|
||||
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>';
|
||||
print $langs->trans("PAYBOX_CGI_URL_V1").'</td><td>';
|
||||
print '<input size="64" type="text" name="PAYBOX_CGI_URL_V1" value="'.$conf->global->PAYBOX_CGI_URL_V1.'">';
|
||||
print '<br>'.$langs->trans("Example").': http://mysite/cgi-bin/module_linux.cgi';
|
||||
print '</td></tr>';
|
||||
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>';
|
||||
print $langs->trans("PAYBOX_CGI_URL_V2").'</td><td>';
|
||||
print '<input size="64" type="text" name="PAYBOX_CGI_URL_V2" value="'.$conf->global->PAYBOX_CGI_URL_V2.'">';
|
||||
print '<br>'.$langs->trans("Example").': http://mysite/cgi-bin/modulev2_redhat72.cgi';
|
||||
print '</td></tr>';
|
||||
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>';
|
||||
print $langs->trans("PAYBOX_IBS_SITE").'</td><td>';
|
||||
@ -132,14 +142,19 @@ print '<u>'.$langs->trans("FollowingUrlAreAvailableToMakePayments").':</u><br>';
|
||||
$firstpart=$dolibarr_main_url_root;
|
||||
$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 '<br>';
|
||||
print $langs->trans("ToOfferALinkForOnlinePaymentOnContractLine",$service).':<br>';
|
||||
print $firstpart.DOL_URL_ROOT.'/public/paybox/newpayment.php?amount=contractline&ref=<i>contractlineref</i>'."<br>\n";
|
||||
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 $langs->trans("ToOfferALinkForOnlinePaymentOnFreeAmount",$service).':<br>';
|
||||
print $firstpart.DOL_URL_ROOT.'/public/paybox/newpayment.php?amount=<i>9.99</i>&tag=<i>yourfreetag</i>'."<br>\n";
|
||||
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 '<br>';
|
||||
print $langs->trans("YouCanAddTagOnUrl");
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -56,7 +56,7 @@ class modPayBox extends DolibarrModules
|
||||
// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
|
||||
$this->name = eregi_replace('^mod','',get_class($this));
|
||||
// Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module)
|
||||
$this->description = "Paybox module";
|
||||
$this->description = "Module to offer an online payment page by credit card with PayBox";
|
||||
// Possible values for version are: 'development', 'experimental', 'dolibarr' or version
|
||||
$this->version = 'dolibarr';
|
||||
// Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase)
|
||||
|
||||
@ -318,7 +318,7 @@ ChequeDeposits=Cheques deposits
|
||||
Cheques=Cheques
|
||||
CreditNoteConvertedIntoDiscount=This credit note has been converted into %s
|
||||
UsBillingContactAsIncoiveRecipientIfExist=Use customer billing contact address instead of third party address as recipient for invoices
|
||||
|
||||
PaymentInvoiceRef=Payment invoice %s
|
||||
# oursin PDF model
|
||||
Of=du
|
||||
|
||||
|
||||
@ -99,6 +99,7 @@ AuthorRequest=Request author
|
||||
UseCustomerContactAsOrderRecipientIfExist=Use customer contact address if defined instead of third party address as order recipient address
|
||||
RunningOrders=Orders on process
|
||||
UserWithApproveOrderGrant=Useres granted with "approve orders" permission.
|
||||
PaymentOrderRef=Payment of order %s
|
||||
|
||||
Error_COMMANDE_SUPPLIER_ADDON_NotDefined=Constant COMMANDE_SUPPLIER_ADDON not defined
|
||||
Error_COMMANDE_ADDON_NotDefined=Constant COMMANDE_ADDON not defined
|
||||
|
||||
@ -14,6 +14,9 @@ PayBoxDoPayment=Go on payment
|
||||
YouWillBeRedirectedOnPayBox=You will be redirected on secured Paybox page to input you credit card informations
|
||||
PleaseBePatient=Please, be patient
|
||||
Continue=Next
|
||||
ToOfferALinkForOnlinePaymentOnContractLine=URL to offer an %s online payment user interface for a contract line
|
||||
ToOfferALinkForOnlinePaymentOnFreeAmount=URL to offer an %s online payment user interface for a free amount
|
||||
YouCanAddTagOnUrl=You can also add url parameter <b>&tag=<i>value</i></b> to any of those URL to add your own tag to the payment comment code.
|
||||
ToOfferALinkForOnlinePaymentOnOrder=URL to offer a %s online payment user interface for an order
|
||||
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
|
||||
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.
|
||||
@ -321,6 +321,8 @@ CreditNoteConvertedIntoDiscount=Cet avoir a été converti en %s
|
||||
UsBillingContactAsIncoiveRecipientIfExist=Utiliser l'adresse du contact facturation client de la facture plutot que l'adresse du tiers comme destinataire des factures
|
||||
ShowUnpayedAll=Afficher tous les impayés
|
||||
ShowUnpayedLateOnly=Afficher impayés en retard uniquement
|
||||
PaymentInvoiceRef=Paiement facture %s
|
||||
|
||||
# oursin PDF model
|
||||
Of=du
|
||||
|
||||
|
||||
@ -99,6 +99,7 @@ AuthorRequest=Auteur/Demandeur
|
||||
UseCustomerContactAsOrderRecipientIfExist=Utiliser adresse contact suivi client si défini plutot que adresse tiers comme destinataire des commandes
|
||||
RunningOrders=Commandes en cours
|
||||
UserWithApproveOrderGrant=Utilisateurs habilités à approuver les commandes
|
||||
PaymentOrderRef=Paiement commande %s
|
||||
|
||||
Error_COMMANDE_SUPPLIER_ADDON_NotDefined=Constante COMMANDE_SUPPLIER_ADDON non définie
|
||||
Error_COMMANDE_ADDON_NotDefined=Constante COMMANDE_ADDON non définie
|
||||
|
||||
@ -14,7 +14,10 @@ PayBoxDoPayment=Poursuivre le paiement par carte
|
||||
YouWillBeRedirectedOnPayBox=Vous serez redirigé vers la page sécurisée Paybox de saisie de votre carte bancaire
|
||||
PleaseBePatient=Merci de patientez quelques secondes
|
||||
Continue=Continuer
|
||||
ToOfferALinkForOnlinePaymentOnOrder=URL offrant une interface de paiement en ligne %s sur la base du montant d'une commande client
|
||||
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
|
||||
YouCanAddTagOnUrl=Vous pouvez de plus ajouter le paramètre url <b>&tag=<i>value</i></b> à n'importe quelle de ces URL pour voir votre propre tag au code commentaire de paiement.
|
||||
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 voir votre propre "code commentaire" du paiement.
|
||||
SetupPayBoxToHavePaymentCreatedAutomatically=Configurez votre url PayBox à <b>%s</b> pour avoir le paiement créé automatiquement si validé.
|
||||
|
||||
@ -68,7 +68,7 @@ function llxFooterPayBox()
|
||||
* \brief Create a redirect form to paybox form
|
||||
* \return int 1 if OK, -1 if ERROR
|
||||
*/
|
||||
function print_paybox_redirect($PRICE,$EMAIL,$urlok,$urlko,$TAG,$ID=0)
|
||||
function print_paybox_redirect($PRICE,$CURRENCY,$EMAIL,$urlok,$urlko,$TAG)
|
||||
{
|
||||
global $conf, $langs, $db;
|
||||
|
||||
@ -79,14 +79,13 @@ function print_paybox_redirect($PRICE,$EMAIL,$urlok,$urlko,$TAG,$ID=0)
|
||||
if ($conf->global->PAYBOX_IBS_SITE) $IBS_SITE=$conf->global->PAYBOX_IBS_SITE;
|
||||
$IBS_RANG="99"; # Rang test
|
||||
if ($conf->global->PAYBOX_IBS_RANG) $IBS_RANG=$conf->global->PAYBOX_IBS_RANG;
|
||||
$IBS_DEVISE="978"; # Euro
|
||||
if ($conf->global->PAYBOX_IBS_DEVISE) $IBS_DEVISE=$conf->global->PAYBOX_IBS_DEVISE;
|
||||
$IBS_DEVISE=""; # Currency
|
||||
if ($CURRENCY == 'EUR') $IBS_DEVISE="978";
|
||||
|
||||
|
||||
$ModulePaybox="module_linux.cgi";
|
||||
if ($_SERVER["WINDIR"] && eregi("windows",$_SERVER["WINDIR"])) { $ModulePaybox="module_NT_2000.cgi"; }
|
||||
$URLPAYBOX=URL_ROOT.'/cgi-bin/'.$ModulePaybox;
|
||||
if ($conf->global->PAYBOX_CGI_URL) $URLPAYBOX=$conf->global->PAYBOX_CGI_URL;
|
||||
$URLPAYBOX="";
|
||||
if ($conf->global->PAYBOX_CGI_URL_V1) $URLPAYBOX=$conf->global->PAYBOX_CGI_URL_V1;
|
||||
//if ($conf->global->PAYBOX_CGI_URL_V2) $URLPAYBOX=$conf->global->PAYBOX_CGI_URL_V2;
|
||||
|
||||
if (empty($IBS_DEVISE))
|
||||
{
|
||||
@ -95,7 +94,7 @@ function print_paybox_redirect($PRICE,$EMAIL,$urlok,$urlko,$TAG,$ID=0)
|
||||
}
|
||||
if (empty($URLPAYBOX))
|
||||
{
|
||||
dol_print_error('',"Paybox setup param PAYBOX_CGI_URL not defined");
|
||||
dol_print_error('',"Paybox setup param PAYBOX_CGI_URL_V1 and PAYBOX_CGI_URL_V2 undefined");
|
||||
return -1;
|
||||
}
|
||||
if (empty($IBS_SITE))
|
||||
@ -109,27 +108,27 @@ function print_paybox_redirect($PRICE,$EMAIL,$urlok,$urlko,$TAG,$ID=0)
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
dol_syslog("Paypal.lib::print_paybox_redirect PRICE: ".$PRICE, LOG_DEBUG);
|
||||
|
||||
$langsiso=new Translate('',$conf);
|
||||
$langsiso=$langs;
|
||||
$langsiso->charset_output='ISO-8859-1';
|
||||
|
||||
// Definition des parametres vente produit pour paybox
|
||||
$IBS_CMD=$TAG;
|
||||
$IBS_TOTAL=$PRICE*100; # En centimes
|
||||
$IBS_MODE=1; # Mode formulaire
|
||||
$IBS_PORTEUR=$EMAIL;
|
||||
$IBS_RETOUR="montant:M;ref:R;auto:A;trans:T"; # Format des parametres du get de validation en reponse (url a definir sous paybox)
|
||||
$IBS_TXT="<center><b>".$langsiso->trans("YouWillBeRedirectedOnPayBox")."</b><br><i>".$langsiso->trans("PleaseBePatient")."...</i><br></center>";
|
||||
//$IBS_TXT="<center><b>".$langsiso->trans("YouWillBeRedirectedOnPayBox")."</b><br><i>".$langsiso->trans("PleaseBePatient")."...</i><br></center>";
|
||||
$IBS_TXT=' '; // Use a space
|
||||
$IBS_BOUTPI=$langs->trans("Wait");
|
||||
//$IBS_BOUTPI='';
|
||||
$IBS_EFFECTUE=$urlok;
|
||||
$IBS_ANNULE=$urlko;
|
||||
$IBS_REFUSE=$urlko;
|
||||
$IBS_BOUTPI=$langsiso->trans("Continue");
|
||||
$IBS_BKGD="#FFFFFF";
|
||||
$IBS_WAIT="4000";
|
||||
$IBS_LANG="ENG"; if (eregi('^FR',$langs->defaultlang)) $IBS_LANG="FRA";
|
||||
$IBS_WAIT="2000";
|
||||
$IBS_LANG="GBR"; // FRA, GBR, ESP, ITA et DEU
|
||||
if (eregi('^FR',$langs->defaultlang)) $IBS_LANG="FRA";
|
||||
if (eregi('^ES',$langs->defaultlang)) $IBS_LANG="ESP";
|
||||
if (eregi('^IT',$langs->defaultlang)) $IBS_LANG="ITA";
|
||||
if (eregi('^DE',$langs->defaultlang)) $IBS_LANG="DEU";
|
||||
$IBS_OUTPUT='E';
|
||||
|
||||
dol_syslog("Soumission Paybox", LOG_DEBUG);
|
||||
dol_syslog("IBS_MODE: $IBS_MODE", LOG_DEBUG);
|
||||
@ -146,6 +145,7 @@ function print_paybox_redirect($PRICE,$EMAIL,$urlok,$urlko,$TAG,$ID=0)
|
||||
dol_syslog("IBS_BKGD: $IBS_BKGD", LOG_DEBUG);
|
||||
dol_syslog("IBS_WAIT: $IBS_WAIT", LOG_DEBUG);
|
||||
dol_syslog("IBS_LANG: $IBS_LANG", LOG_DEBUG);
|
||||
dol_syslog("IBS_OUTPUT: $IBS_OUTPUT", LOG_DEBUG);
|
||||
|
||||
header("Content-type: text/html; charset=".$conf->character_set_client);
|
||||
|
||||
@ -180,7 +180,7 @@ function print_paybox_redirect($PRICE,$EMAIL,$urlok,$urlko,$TAG,$ID=0)
|
||||
|
||||
print "\n";
|
||||
print '<script type="text/javascript" language="javascript">'."\n";
|
||||
// print ' document.Submit.submit();'."\n";
|
||||
print ' document.Submit.submit();'."\n";
|
||||
print '</script>'."\n";
|
||||
print "\n";
|
||||
print '</body></html>'."\n";
|
||||
|
||||
@ -83,7 +83,7 @@ if ($_REQUEST["action"] == 'dopayment')
|
||||
|
||||
if (empty($mesg))
|
||||
{
|
||||
print_paybox_redirect($PRICE, $EMAIL, $urlok, $urlko, $DOLSTRING, $ID);
|
||||
print_paybox_redirect($PRICE, $conf->monnaie, $EMAIL, $urlok, $urlko, $DOLSTRING, $ID);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
@ -138,6 +138,152 @@ print '<tr class="liste_total"><td align="left" colspan="2">'.$langs->trans("Thi
|
||||
$found=false;
|
||||
$var=false;
|
||||
|
||||
// Payment on customer order
|
||||
if ($_REQUEST["amount"] == 'order')
|
||||
{
|
||||
$found=true;
|
||||
$langs->load("orders");
|
||||
|
||||
require_once(DOL_DOCUMENT_ROOT."/commande/commande.class.php");
|
||||
|
||||
$order=new Commande($db);
|
||||
$result=$order->fetch('',$_REQUEST["ref"]);
|
||||
if ($result < 0)
|
||||
{
|
||||
$mesg=$order->error;
|
||||
}
|
||||
else
|
||||
{
|
||||
$result=$order->fetch_client($order->socid);
|
||||
}
|
||||
|
||||
$amount=$order->total_ttc;
|
||||
|
||||
$newtag='IR='.$order->ref.'.TPID='.$order->client->id.'.TP='.strtr($order->client->nom,"-"," ");
|
||||
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>'.$mysoc->nom.'</b></td></tr>'."\n";
|
||||
|
||||
// Debitor
|
||||
$var=!$var;
|
||||
print '<tr><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("ThirdParty");
|
||||
print '</td><td class="CTableRow'.($var?'1':'2').'"><b>'.$order->client->nom.'</b>';
|
||||
|
||||
// Object
|
||||
$var=!$var;
|
||||
$text='<b>'.$langs->trans("PaymentOrderRef",$order->ref).'</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="'.$order->ref.'">';
|
||||
print '</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 invoice
|
||||
if ($_REQUEST["amount"] == 'invoice')
|
||||
{
|
||||
$found=true;
|
||||
$langs->load("bills");
|
||||
|
||||
require_once(DOL_DOCUMENT_ROOT."/facture.class.php");
|
||||
|
||||
$invoice=new Facture($db);
|
||||
$result=$invoice->fetch('',$_REQUEST["ref"]);
|
||||
if ($result < 0)
|
||||
{
|
||||
$mesg=$invoice->error;
|
||||
}
|
||||
else
|
||||
{
|
||||
$result=$invoice->fetch_client($invoice->socid);
|
||||
}
|
||||
|
||||
$amount=$invoice->total_ttc - $invoice->getSommePaiement();
|
||||
|
||||
$newtag='IR='.$invoice->ref.'.TPID='.$invoice->client->id.'.TP='.strtr($invoice->client->nom,"-"," ");
|
||||
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>'.$mysoc->nom.'</b></td></tr>'."\n";
|
||||
|
||||
// Debitor
|
||||
$var=!$var;
|
||||
print '<tr><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("ThirdParty");
|
||||
print '</td><td class="CTableRow'.($var?'1':'2').'"><b>'.$invoice->client->nom.'</b>';
|
||||
|
||||
// Object
|
||||
$var=!$var;
|
||||
$text='<b>'.$langs->trans("PaymentInvoiceRef",$invoice->ref).'</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="'.$invoice->ref.'">';
|
||||
print '</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 contract line
|
||||
if ($_REQUEST["amount"] == 'contractline')
|
||||
{
|
||||
$found=true;
|
||||
@ -200,10 +346,9 @@ if ($_REQUEST["amount"] == 'contractline')
|
||||
}
|
||||
}
|
||||
|
||||
$tag='';
|
||||
$tag='CLR='.$contractline->ref.'.CR='.$contract->ref.'.TPID='.$contract->client->id.'.TP='.strtr($contract->client->nom,"-"," ");
|
||||
if (! empty($_REQUEST["tag"])) $tag.='.TAG='.$_REQUEST["tag"];
|
||||
$tag=dol_string_unaccent($tag);
|
||||
$newtag='CLR='.$contractline->ref.'.CR='.$contract->ref.'.TPID='.$contract->client->id.'.TP='.strtr($contract->client->nom,"-"," ");
|
||||
if (! empty($_REQUEST["tag"])) { $tag=$_REQUEST["tag"]; $newtag.='.TAG='.$_REQUEST["tag"]; }
|
||||
$newtag=dol_string_unaccent($newtag);
|
||||
|
||||
$qty=1;
|
||||
if (isset($_REQUEST["qty"])) $qty=$_REQUEST["qty"];
|
||||
@ -275,18 +420,16 @@ if ($_REQUEST["amount"] == 'contractline')
|
||||
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";
|
||||
|
||||
// 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>';
|
||||
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
|
||||
@ -297,10 +440,12 @@ if ($_REQUEST["amount"] == 'contractline')
|
||||
|
||||
}
|
||||
|
||||
// Free payment
|
||||
if (is_numeric($_REQUEST["amount"]))
|
||||
{
|
||||
$found=true;
|
||||
$tag=$_REQUEST["tag"];
|
||||
$newtag=$tag;
|
||||
|
||||
// Creditor
|
||||
$var=!$var;
|
||||
@ -317,18 +462,16 @@ if (is_numeric($_REQUEST["amount"]))
|
||||
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";
|
||||
|
||||
// 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>';
|
||||
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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user