2009-02-11 21:44:00 +01:00
< ? php
/* Copyright ( C ) 2001 - 2002 Rodolphe Quiedeville < rodolphe @ quiedeville . org >
2012-03-10 01:07:35 +01:00
* Copyright ( C ) 2006 - 2012 Laurent Destailleur < eldy @ users . sourceforge . net >
2012-12-30 15:13:49 +01:00
* Copyright ( C ) 2009 Regis Houssin < regis . houssin @ capnetworks . com >
2009-02-11 21:44:00 +01:00
*
* 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
2013-01-16 15:36:08 +01:00
* the Free Software Foundation ; either version 3 of the License , or
2009-02-11 21:44:00 +01:00
* ( at your option ) any later version .
*
* This program is distributed in the hope that it will be useful ,
* but WITHOUT ANY WARRANTY ; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
* GNU General Public License for more details .
*
* You should have received a copy of the GNU General Public License
2011-08-01 01:19:04 +02:00
* along with this program . If not , see < http :// www . gnu . org / licenses />.
2009-02-11 21:44:00 +01:00
*/
/**
2009-07-15 15:32:01 +02:00
* \file htdocs / public / paybox / newpayment . php
* \ingroup paybox
2009-02-11 21:44:00 +01:00
* \brief File to offer a way to make a payment for a particular Dolibarr entity
* \author Laurent Destailleur
*/
2010-01-16 12:40:23 +01:00
define ( " NOLOGIN " , 1 ); // This means this output page does not require to be logged.
define ( " NOCSRFCHECK " , 1 ); // We accept to go on this page from external web site.
2010-01-12 11:26:05 +01:00
2014-01-07 16:29:25 +01:00
// For MultiCompany module.
// Do not use GETPOST here, function is not defined and define must be done before including main.inc.php
// TODO This should be useless. Because entity must be retreive from object ref and not from url.
$entity = ( ! empty ( $_GET [ 'entity' ]) ? ( int ) $_GET [ 'entity' ] : ( ! empty ( $_POST [ 'entity' ]) ? ( int ) $_POST [ 'entity' ] : 1 ));
if ( is_int ( $entity )) define ( " DOLENTITY " , $entity );
2012-08-22 23:24:21 +02:00
require '../../main.inc.php' ;
2012-08-22 23:11:24 +02:00
require_once DOL_DOCUMENT_ROOT . '/paybox/lib/paybox.lib.php' ;
require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php' ;
require_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php' ;
require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php' ;
2010-01-12 11:26:05 +01:00
// Security check
if ( empty ( $conf -> paybox -> enabled )) accessforbidden ( '' , 1 , 1 , 1 );
2009-05-22 00:28:05 +02:00
2009-02-11 21:44:00 +01:00
$langs -> load ( " main " );
$langs -> load ( " other " );
$langs -> load ( " dict " );
$langs -> load ( " bills " );
$langs -> load ( " companies " );
2010-01-08 18:33:30 +01:00
$langs -> load ( " errors " );
2010-10-10 21:14:08 +02:00
$langs -> load ( " paybox " );
2009-02-11 21:44:00 +01:00
// Input are:
// type ('invoice','order','contractline'),
// id (object id),
// amount (required if id is empty),
// tag (a free text, required if type is empty)
// currency (iso code)
2010-11-21 14:55:18 +01:00
$suffix = GETPOST ( " suffix " , 'alpha' );
2010-11-21 15:35:39 +01:00
$amount = price2num ( GETPOST ( " amount " ));
2012-03-08 14:17:08 +01:00
if ( ! GETPOST ( " currency " , 'alpha' )) $currency = $conf -> currency ;
2010-11-21 14:55:18 +01:00
else $currency = GETPOST ( " currency " , 'alpha' );
2010-10-10 21:14:08 +02:00
if ( ! GETPOST ( " action " ))
2009-02-18 21:48:49 +01:00
{
2010-10-31 19:57:11 +01:00
if ( ! GETPOST ( " amount " ) && ! GETPOST ( " source " ))
2010-10-10 21:14:08 +02:00
{
dol_print_error ( '' , $langs -> trans ( 'ErrorBadParameters' ) . " - amount or source " );
exit ;
}
2010-11-21 15:35:39 +01:00
if ( is_numeric ( $amount ) && ! GETPOST ( " tag " ) && ! GETPOST ( " source " ))
2010-10-10 21:14:08 +02:00
{
dol_print_error ( '' , $langs -> trans ( 'ErrorBadParameters' ) . " - tag or source " );
exit ;
}
2010-11-21 15:35:39 +01:00
if ( GETPOST ( " source " ) && ! GETPOST ( " ref " ))
2010-10-10 21:14:08 +02:00
{
dol_print_error ( '' , $langs -> trans ( 'ErrorBadParameters' ) . " - ref " );
exit ;
}
2009-02-18 21:48:49 +01:00
}
2009-02-11 21:44:00 +01:00
2012-12-12 14:46:13 +01:00
// Define $urlwithroot
2012-03-07 14:21:49 +01:00
$urlwithouturlroot = preg_replace ( '/' . preg_quote ( DOL_URL_ROOT , '/' ) . '$/i' , '' , trim ( $dolibarr_main_url_root ));
2012-12-12 14:46:13 +01:00
$urlwithroot = $urlwithouturlroot . DOL_URL_ROOT ; // This is to use external domain name found into config file
//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
$urlok = $urlwithroot . '/public/paybox/paymentok.php?' ;
$urlko = $urlwithroot . '/public/paybox/paymentko.php?' ;
2010-10-31 19:57:11 +01:00
2010-11-21 15:35:39 +01:00
// Complete urls
2012-04-02 12:32:55 +02:00
$SOURCE = GETPOST ( " source " , 'alpha' );
$ref = $REF = GETPOST ( 'ref' , 'alpha' );
2010-11-21 14:55:18 +01:00
$TAG = GETPOST ( " tag " , 'alpha' );
$FULLTAG = GETPOST ( " fulltag " , 'alpha' ); // fulltag is tag with more informations
2012-04-02 12:32:55 +02:00
$SECUREKEY = GETPOST ( " securekey " ); // Secure key
2010-10-31 19:57:11 +01:00
2012-04-02 12:32:55 +02:00
if ( ! empty ( $SOURCE ))
{
$urlok .= 'source=' . urlencode ( $SOURCE ) . '&' ;
$urlko .= 'source=' . urlencode ( $SOURCE ) . '&' ;
}
if ( ! empty ( $REF ))
{
$urlok .= 'ref=' . urlencode ( $REF ) . '&' ;
$urlko .= 'ref=' . urlencode ( $REF ) . '&' ;
}
2010-10-31 19:57:11 +01:00
if ( ! empty ( $TAG ))
{
2010-11-21 14:55:18 +01:00
$urlok .= 'tag=' . urlencode ( $TAG ) . '&' ;
$urlko .= 'tag=' . urlencode ( $TAG ) . '&' ;
2010-10-31 19:57:11 +01:00
}
if ( ! empty ( $FULLTAG ))
{
2010-11-21 14:55:18 +01:00
$urlok .= 'fulltag=' . urlencode ( $FULLTAG ) . '&' ;
$urlko .= 'fulltag=' . urlencode ( $FULLTAG ) . '&' ;
2010-10-31 19:57:11 +01:00
}
2010-11-21 15:35:39 +01:00
$urlok = preg_replace ( '/&$/' , '' , $urlok ); // Remove last &
$urlko = preg_replace ( '/&$/' , '' , $urlko ); // Remove last &
2009-02-11 21:44:00 +01:00
2012-04-02 12:32:55 +02:00
// Check security token
$valid = true ;
2009-02-11 21:44:00 +01:00
/*
* Actions
*/
2010-11-21 15:35:39 +01:00
if ( GETPOST ( " action " ) == 'dopayment' )
2009-02-11 21:44:00 +01:00
{
2010-11-01 13:41:32 +01:00
$PRICE = price2num ( GETPOST ( " newamount " ), 'MT' );
2011-07-05 10:29:53 +02:00
$email = GETPOST ( " email " );
2009-02-11 21:44:00 +01:00
$mesg = '' ;
2010-11-01 13:41:32 +01:00
if ( empty ( $PRICE ) || ! is_numeric ( $PRICE )) $mesg = $langs -> trans ( " ErrorFieldRequired " , $langs -> transnoentitiesnoconv ( " Amount " ));
2011-07-05 10:29:53 +02:00
elseif ( empty ( $email )) $mesg = $langs -> trans ( " ErrorFieldRequired " , $langs -> transnoentitiesnoconv ( " YourEMail " ));
elseif ( ! isValidEMail ( $email )) $mesg = $langs -> trans ( " ErrorBadEMail " , $email );
2010-10-31 19:57:11 +01:00
elseif ( empty ( $FULLTAG )) $mesg = $langs -> trans ( " ErrorFieldRequired " , $langs -> transnoentitiesnoconv ( " PaymentCode " ));
2012-04-02 13:28:22 +02:00
elseif ( dol_strlen ( $urlok ) > 150 ) $mesg = 'Error urlok too long ' . $urlok ;
elseif ( dol_strlen ( $urlko ) > 150 ) $mesg = 'Error urlko too long ' . $urlko ;
2009-02-11 21:44:00 +01:00
if ( empty ( $mesg ))
{
2010-10-31 19:57:11 +01:00
dol_syslog ( " newpayment.php call paybox api and do redirect " , LOG_DEBUG );
2011-11-23 14:55:36 +01:00
print_paybox_redirect ( $PRICE , $conf -> currency , $email , $urlok , $urlko , $FULLTAG );
2010-10-31 19:57:11 +01:00
2009-05-19 22:59:20 +02:00
session_destroy ();
2009-02-11 21:44:00 +01:00
exit ;
}
}
/*
* View
*/
llxHeaderPayBox ( $langs -> trans ( " PaymentForm " ));
2009-02-19 12:19:53 +01:00
// Common variables
2011-02-20 12:52:23 +01:00
$creditor = $mysoc -> name ;
2009-03-02 17:00:58 +01:00
$paramcreditor = 'PAYBOX_CREDITOR_' . $suffix ;
if ( ! empty ( $conf -> global -> $paramcreditor )) $creditor = $conf -> global -> $paramcreditor ;
else if ( ! empty ( $conf -> global -> PAYBOX_CREDITOR )) $creditor = $conf -> global -> PAYBOX_CREDITOR ;
2009-02-19 12:19:53 +01:00
2010-10-31 19:57:11 +01:00
print '<span id="dolpaymentspan"></span>' . " \n " ;
2009-02-11 21:44:00 +01:00
print '<center>' ;
2010-10-31 19:57:11 +01:00
print '<form id="dolpaymentform" name="paymentform" action="' . $_SERVER [ " PHP_SELF " ] . '" method="POST">' ;
2009-05-17 10:01:54 +02:00
print '<input type="hidden" name="token" value="' . $_SESSION [ 'newtoken' ] . '">' ;
2009-02-11 21:44:00 +01:00
print '<input type="hidden" name="action" value="dopayment">' ;
2010-11-21 14:55:18 +01:00
print '<input type="hidden" name="tag" value="' . GETPOST ( " tag " , 'alpha' ) . '">' ;
print '<input type="hidden" name="suffix" value="' . GETPOST ( " suffix " , 'alpha' ) . '">' ;
2009-02-11 21:44:00 +01:00
print " \n " ;
2010-10-31 19:57:11 +01:00
print '<!-- Form to send a Paybox payment -->' . " \n " ;
print '<!-- PAYBOX_CREDITOR = ' . $conf -> global -> PAYPAL_CREDITOR . ' -->' . " \n " ;
2012-04-02 12:32:55 +02:00
print '<!-- creditor = ' . $creditor . ' -->' . " \n " ;
2010-10-31 19:57:11 +01:00
print '<!-- urlok = ' . $urlok . ' -->' . " \n " ;
print '<!-- urlko = ' . $urlko . ' -->' . " \n " ;
print " \n " ;
2009-02-11 21:44:00 +01:00
2012-03-10 01:07:35 +01:00
print '<table id="dolpaymenttable" summary="Payment form">' . " \n " ;
2009-02-11 21:44:00 +01:00
2009-03-02 17:00:58 +01:00
// Show logo (search order: logo defined by PAYBOX_LOGO_suffix, then PAYBOX_LOGO, then small company logo, large company logo, theme logo, common logo)
2009-02-11 21:44:00 +01:00
$width = 0 ;
2009-03-02 17:00:58 +01:00
// Define logo and logosmall
2009-10-10 16:58:24 +02:00
$logosmall = $mysoc -> logo_small ;
$logo = $mysoc -> logo ;
2009-03-02 17:00:58 +01:00
$paramlogo = 'PAYBOX_LOGO_' . $suffix ;
if ( ! empty ( $conf -> global -> $paramlogo )) $logosmall = $conf -> global -> $paramlogo ;
else if ( ! empty ( $conf -> global -> PAYBOX_LOGO )) $logosmall = $conf -> global -> PAYBOX_LOGO ;
2009-10-10 16:58:53 +02:00
//print '<!-- Show logo (logosmall='.$logosmall.' logo='.$logo.') -->'."\n";
2009-03-02 17:00:58 +01:00
// Define urllogo
2009-02-11 21:44:00 +01:00
$urllogo = '' ;
2009-07-02 02:16:50 +02:00
if ( ! empty ( $logosmall ) && is_readable ( $conf -> mycompany -> dir_output . '/logos/thumbs/' . $logosmall ))
2009-02-11 21:44:00 +01:00
{
2009-03-02 17:00:58 +01:00
$urllogo = DOL_URL_ROOT . '/viewimage.php?modulepart=companylogo&file=' . urlencode ( 'thumbs/' . $logosmall );
2009-02-11 21:44:00 +01:00
}
2009-07-02 02:16:50 +02:00
elseif ( ! empty ( $logo ) && is_readable ( $conf -> mycompany -> dir_output . '/logos/' . $logo ))
2009-02-11 21:44:00 +01:00
{
2009-03-02 17:00:58 +01:00
$urllogo = DOL_URL_ROOT . '/viewimage.php?modulepart=companylogo&file=' . urlencode ( $logo );
2009-02-11 21:44:00 +01:00
$width = 96 ;
}
2009-03-02 17:00:58 +01:00
// Output html code for logo
2009-02-11 21:44:00 +01:00
if ( $urllogo )
{
print '<tr>' ;
2010-10-31 19:57:11 +01:00
print '<td align="center"><img id="dolpaymentlogo" title="' . $title . '" src="' . $urllogo . '"' ;
2009-02-11 21:44:00 +01:00
if ( $width ) print ' width="' . $width . '"' ;
print '></td>' ;
print '</tr>' . " \n " ;
}
2011-07-13 13:14:43 +02:00
// Output introduction text
$text = '' ;
2011-07-13 13:56:36 +02:00
if ( ! empty ( $conf -> global -> PAYBOX_NEWFORM_TEXT ))
2011-07-13 13:42:39 +02:00
{
$langs -> load ( " members " );
2011-07-13 13:56:36 +02:00
if ( preg_match ( '/^\((.*)\)$/' , $conf -> global -> PAYBOX_NEWFORM_TEXT , $reg )) $text .= $langs -> trans ( $reg [ 1 ]) . " <br> \n " ;
else $text .= $conf -> global -> PAYBOX_NEWFORM_TEXT . " <br> \n " ;
2011-07-13 14:03:30 +02:00
$text = '<tr><td align="center"><br>' . $text . '<br></td></tr>' . " \n " ;
2011-07-13 13:42:39 +02:00
}
2011-07-13 13:14:43 +02:00
if ( empty ( $text ))
{
2012-03-10 01:07:35 +01:00
$text .= '<tr><td class="textpublicpayment"><br><strong>' . $langs -> trans ( " WelcomeOnPaymentPage " ) . '</strong><br></td></tr>' . " \n " ;
$text .= '<tr><td class="textpublicpayment"><br>' . $langs -> trans ( " ThisScreenAllowsYouToPay " , $creditor ) . '<br><br></td></tr>' . " \n " ;
2011-07-13 13:14:43 +02:00
}
print $text ;
2009-02-11 21:44:00 +01:00
2011-07-13 13:14:43 +02:00
// Output payment summary form
2009-02-11 21:44:00 +01:00
print '<tr><td align="center">' ;
2012-03-10 01:07:35 +01:00
print '<table with="100%" id="tablepublicpayment">' ;
2009-02-11 21:44:00 +01:00
print '<tr class="liste_total"><td align="left" colspan="2">' . $langs -> trans ( " ThisIsInformationOnPayment " ) . ' :</td></tr>' . " \n " ;
$found = false ;
2009-10-10 17:32:28 +02:00
$error = 0 ;
2009-02-11 21:44:00 +01:00
$var = false ;
2009-02-15 16:04:02 +01:00
2009-02-19 12:19:53 +01:00
2009-02-26 01:42:22 +01:00
// Free payment
2012-04-02 12:32:55 +02:00
if ( ! GETPOST ( " source " ) && $valid )
2009-02-26 01:42:22 +01:00
{
$found = true ;
2010-11-21 15:35:39 +01:00
$tag = GETPOST ( " tag " );
$fulltag = $tag ;
2009-02-26 01:42:22 +01:00
// Creditor
$var =! $var ;
2012-03-10 01:07:35 +01:00
print '<tr class="CTableRow' . ( $var ? '1' : '2' ) . '"><td class="CTableRow' . ( $var ? '1' : '2' ) . '">' . $langs -> trans ( " Creditor " );
2010-11-01 13:41:32 +01:00
print '</td><td class="CTableRow' . ( $var ? '1' : '2' ) . '"><b>' . $creditor . '</b>' ;
print '<input type="hidden" name="creditor" value="' . $creditor . '">' ;
print '</td></tr>' . " \n " ;
2009-02-26 01:42:22 +01:00
// Amount
$var =! $var ;
2012-03-10 01:07:35 +01:00
print '<tr class="CTableRow' . ( $var ? '1' : '2' ) . '"><td class="CTableRow' . ( $var ? '1' : '2' ) . '">' . $langs -> trans ( " Amount " );
2009-02-26 01:42:22 +01:00
if ( empty ( $amount )) print ' (' . $langs -> trans ( " ToComplete " ) . ')' ;
print '</td><td class="CTableRow' . ( $var ? '1' : '2' ) . '">' ;
2012-04-02 13:10:22 +02:00
if ( empty ( $amount ) || ! is_numeric ( $amount ))
{
print '<input type="hidden" name="amount" value="' . GETPOST ( " amount " , 'int' ) . '">' ;
print '<input class="flat" size=8 type="text" name="newamount" value="' . GETPOST ( " newamount " , " int " ) . '">' ;
}
2009-02-26 01:42:22 +01:00
else {
print '<b>' . price ( $amount ) . '</b>' ;
2010-10-31 19:57:11 +01:00
print '<input type="hidden" name="amount" value="' . $amount . '">' ;
2009-02-26 01:42:22 +01:00
print '<input type="hidden" name="newamount" value="' . $amount . '">' ;
}
2010-12-01 22:38:00 +01:00
2010-10-04 01:20:49 +02:00
// Currency
print ' <b>' . $langs -> trans ( " Currency " . $currency ) . '</b>' ;
print '<input type="hidden" name="currency" value="' . $currency . '">' ;
2009-02-26 01:42:22 +01:00
print '</td></tr>' . " \n " ;
// Tag
$var =! $var ;
2012-03-10 01:07:35 +01:00
print '<tr class="CTableRow' . ( $var ? '1' : '2' ) . '"><td class="CTableRow' . ( $var ? '1' : '2' ) . '">' . $langs -> trans ( " PaymentCode " );
2010-10-31 19:57:11 +01:00
print '</td><td class="CTableRow' . ( $var ? '1' : '2' ) . '"><b>' . $fulltag . '</b>' ;
2009-02-26 01:42:22 +01:00
print '<input type="hidden" name="tag" value="' . $tag . '">' ;
2010-10-31 19:57:11 +01:00
print '<input type="hidden" name="fulltag" value="' . $fulltag . '">' ;
2009-02-26 01:42:22 +01:00
print '</td></tr>' . " \n " ;
// EMail
$var =! $var ;
2012-03-10 01:07:35 +01:00
print '<tr class="CTableRow' . ( $var ? '1' : '2' ) . '"><td class="CTableRow' . ( $var ? '1' : '2' ) . '">' . $langs -> trans ( " YourEMail " );
2009-02-26 01:42:22 +01:00
print ' (' . $langs -> trans ( " ToComplete " ) . ')' ;
2011-07-05 10:29:53 +02:00
print '</td><td class="CTableRow' . ( $var ? '1' : '2' ) . '"><input class="flat" type="text" name="email" size="48" value="' . GETPOST ( " email " ) . '"></td></tr>' . " \n " ;
2009-02-26 01:42:22 +01:00
}
2009-02-16 02:34:14 +01:00
// Payment on customer order
2012-04-02 12:32:55 +02:00
if ( GETPOST ( " source " ) == 'order' && $valid )
2009-02-16 02:34:14 +01:00
{
$found = true ;
$langs -> load ( " orders " );
2012-08-22 23:11:24 +02:00
require_once DOL_DOCUMENT_ROOT . '/commande/class/commande.class.php' ;
2009-02-16 02:34:14 +01:00
$order = new Commande ( $db );
2012-04-02 12:32:55 +02:00
$result = $order -> fetch ( '' , $ref );
2009-02-16 02:34:14 +01:00
if ( $result < 0 )
{
$mesg = $order -> error ;
2009-10-10 17:32:28 +02:00
$error ++ ;
2009-02-16 02:34:14 +01:00
}
else
{
2010-08-06 15:56:25 +02:00
$result = $order -> fetch_thirdparty ( $order -> socid );
2009-02-16 02:34:14 +01:00
}
$amount = $order -> total_ttc ;
2010-11-21 15:35:39 +01:00
if ( GETPOST ( " amount " , 'int' )) $amount = GETPOST ( " amount " , 'int' );
$amount = price2num ( $amount );
2009-02-16 02:34:14 +01:00
2012-04-02 13:28:22 +02:00
$fulltag = 'IR=' . $order -> ref . '.TPID=' . $order -> thirdparty -> id ;
//$fulltag.='.TP='.strtr($order->thirdparty->name,"-"," "); We disable this because url that will contains FULLTAG must be lower than 150
2012-04-02 12:32:55 +02:00
if ( ! empty ( $TAG )) { $tag = $TAG ; $fulltag .= '.TAG=' . $TAG ; }
2010-10-31 19:57:11 +01:00
$fulltag = dol_string_unaccent ( $fulltag );
2009-02-16 02:34:14 +01:00
// Creditor
$var =! $var ;
2012-03-10 01:07:35 +01:00
print '<tr class="CTableRow' . ( $var ? '1' : '2' ) . '"><td class="CTableRow' . ( $var ? '1' : '2' ) . '">' . $langs -> trans ( " Creditor " );
2010-11-01 13:41:32 +01:00
print '</td><td class="CTableRow' . ( $var ? '1' : '2' ) . '"><b>' . $creditor . '</b>' ;
print '<input type="hidden" name="creditor" value="' . $creditor . '">' ;
print '</td></tr>' . " \n " ;
2009-02-16 02:34:14 +01:00
// Debitor
$var =! $var ;
2012-03-10 01:07:35 +01:00
print '<tr class="CTableRow' . ( $var ? '1' : '2' ) . '"><td class="CTableRow' . ( $var ? '1' : '2' ) . '">' . $langs -> trans ( " ThirdParty " );
2012-01-19 22:20:28 +01:00
print '</td><td class="CTableRow' . ( $var ? '1' : '2' ) . '"><b>' . $order -> thirdparty -> name . '</b>' ;
2009-02-16 02:34:14 +01:00
// Object
$var =! $var ;
$text = '<b>' . $langs -> trans ( " PaymentOrderRef " , $order -> ref ) . '</b>' ;
2012-03-10 01:07:35 +01:00
print '<tr class="CTableRow' . ( $var ? '1' : '2' ) . '"><td class="CTableRow' . ( $var ? '1' : '2' ) . '">' . $langs -> trans ( " Designation " );
2009-02-16 02:34:14 +01:00
print '</td><td class="CTableRow' . ( $var ? '1' : '2' ) . '">' . $text ;
2010-11-21 15:35:39 +01:00
print '<input type="hidden" name="source" value="' . GETPOST ( " source " , 'alpha' ) . '">' ;
2009-02-16 02:34:14 +01:00
print '<input type="hidden" name="ref" value="' . $order -> ref . '">' ;
print '</td></tr>' . " \n " ;
// Amount
$var =! $var ;
2012-03-10 01:07:35 +01:00
print '<tr class="CTableRow' . ( $var ? '1' : '2' ) . '"><td class="CTableRow' . ( $var ? '1' : '2' ) . '">' . $langs -> trans ( " Amount " );
2009-02-16 02:34:14 +01:00
if ( empty ( $amount )) print ' (' . $langs -> trans ( " ToComplete " ) . ')' ;
print '</td><td class="CTableRow' . ( $var ? '1' : '2' ) . '">' ;
2012-04-02 13:10:22 +02:00
if ( empty ( $amount ) || ! is_numeric ( $amount ))
{
print '<input type="hidden" name="amount" value="' . GETPOST ( " amount " , 'int' ) . '">' ;
print '<input class="flat" size=8 type="text" name="newamount" value="' . GETPOST ( " newamount " , " int " ) . '">' ;
}
2009-02-16 02:34:14 +01:00
else {
print '<b>' . price ( $amount ) . '</b>' ;
2010-10-31 19:57:11 +01:00
print '<input type="hidden" name="amount" value="' . $amount . '">' ;
2009-02-16 02:34:14 +01:00
print '<input type="hidden" name="newamount" value="' . $amount . '">' ;
}
2010-10-04 01:20:49 +02:00
// Currency
print ' <b>' . $langs -> trans ( " Currency " . $currency ) . '</b>' ;
print '<input type="hidden" name="currency" value="' . $currency . '">' ;
2009-02-16 02:34:14 +01:00
print '</td></tr>' . " \n " ;
// Tag
$var =! $var ;
2012-03-10 01:07:35 +01:00
print '<tr class="CTableRow' . ( $var ? '1' : '2' ) . '"><td class="CTableRow' . ( $var ? '1' : '2' ) . '">' . $langs -> trans ( " PaymentCode " );
2010-10-31 19:57:11 +01:00
print '</td><td class="CTableRow' . ( $var ? '1' : '2' ) . '"><b>' . $fulltag . '</b>' ;
2009-02-16 02:34:14 +01:00
print '<input type="hidden" name="tag" value="' . $tag . '">' ;
2010-10-31 19:57:11 +01:00
print '<input type="hidden" name="fulltag" value="' . $fulltag . '">' ;
2009-02-16 02:34:14 +01:00
print '</td></tr>' . " \n " ;
// EMail
$var =! $var ;
2012-03-10 01:07:35 +01:00
print '<tr class="CTableRow' . ( $var ? '1' : '2' ) . '"><td class="CTableRow' . ( $var ? '1' : '2' ) . '">' . $langs -> trans ( " YourEMail " );
2009-02-16 02:34:14 +01:00
print ' (' . $langs -> trans ( " ToComplete " ) . ')' ;
2012-01-19 22:20:28 +01:00
$email = $order -> thirdparty -> email ;
2011-07-05 10:29:53 +02:00
$email = ( GETPOST ( " email " ) ? GETPOST ( " email " ) : ( isValidEmail ( $email ) ? $email : '' ));
print '</td><td class="CTableRow' . ( $var ? '1' : '2' ) . '"><input class="flat" type="text" name="email" size="48" value="' . $email . '"></td></tr>' . " \n " ;
2009-02-16 02:34:14 +01:00
}
// Payment on customer invoice
2012-04-02 12:32:55 +02:00
if ( GETPOST ( " source " ) == 'invoice' && $valid )
2009-02-16 02:34:14 +01:00
{
$found = true ;
$langs -> load ( " bills " );
2012-08-22 23:11:24 +02:00
require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php' ;
2009-02-16 02:34:14 +01:00
$invoice = new Facture ( $db );
2012-04-02 12:32:55 +02:00
$result = $invoice -> fetch ( '' , $ref );
2009-02-16 02:34:14 +01:00
if ( $result < 0 )
{
$mesg = $invoice -> error ;
2009-10-10 17:32:28 +02:00
$error ++ ;
2009-02-16 02:34:14 +01:00
}
else
{
2010-08-06 15:56:25 +02:00
$result = $invoice -> fetch_thirdparty ( $invoice -> socid );
2009-02-16 02:34:14 +01:00
}
2012-04-02 12:32:55 +02:00
$amount = price2num ( $invoice -> total_ttc - $invoice -> getSommePaiement ());
2010-11-21 15:35:39 +01:00
if ( GETPOST ( " amount " , 'int' )) $amount = GETPOST ( " amount " , 'int' );
$amount = price2num ( $amount );
2009-02-16 02:34:14 +01:00
2012-04-02 13:28:22 +02:00
$fulltag = 'IR=' . $invoice -> ref . '.TPID=' . $invoice -> thirdparty -> id ;
//$fulltag.='.TP='.strtr($invoice->thirdparty->name,"-"," "); We disable this because url that will contains FULLTAG must be lower than 150
2012-04-02 12:32:55 +02:00
if ( ! empty ( $TAG )) { $tag = $TAG ; $fulltag .= '.TAG=' . $TAG ; }
2010-10-31 19:57:11 +01:00
$fulltag = dol_string_unaccent ( $fulltag );
2009-02-16 02:34:14 +01:00
// Creditor
$var =! $var ;
2012-03-10 01:07:35 +01:00
print '<tr class="CTableRow' . ( $var ? '1' : '2' ) . '"><td class="CTableRow' . ( $var ? '1' : '2' ) . '">' . $langs -> trans ( " Creditor " );
2010-11-01 13:41:32 +01:00
print '</td><td class="CTableRow' . ( $var ? '1' : '2' ) . '"><b>' . $creditor . '</b>' ;
print '<input type="hidden" name="creditor" value="' . $creditor . '">' ;
print '</td></tr>' . " \n " ;
2009-02-16 02:34:14 +01:00
// Debitor
$var =! $var ;
2012-03-10 01:07:35 +01:00
print '<tr class="CTableRow' . ( $var ? '1' : '2' ) . '"><td class="CTableRow' . ( $var ? '1' : '2' ) . '">' . $langs -> trans ( " ThirdParty " );
2012-01-19 22:20:28 +01:00
print '</td><td class="CTableRow' . ( $var ? '1' : '2' ) . '"><b>' . $invoice -> thirdparty -> name . '</b>' ;
2009-02-16 02:34:14 +01:00
// Object
$var =! $var ;
$text = '<b>' . $langs -> trans ( " PaymentInvoiceRef " , $invoice -> ref ) . '</b>' ;
2012-03-10 01:07:35 +01:00
print '<tr class="CTableRow' . ( $var ? '1' : '2' ) . '"><td class="CTableRow' . ( $var ? '1' : '2' ) . '">' . $langs -> trans ( " Designation " );
2009-02-16 02:34:14 +01:00
print '</td><td class="CTableRow' . ( $var ? '1' : '2' ) . '">' . $text ;
2010-11-21 15:35:39 +01:00
print '<input type="hidden" name="source" value="' . GETPOST ( " source " , 'alpha' ) . '">' ;
2009-02-16 02:34:14 +01:00
print '<input type="hidden" name="ref" value="' . $invoice -> ref . '">' ;
print '</td></tr>' . " \n " ;
// Amount
$var =! $var ;
2012-03-10 01:07:35 +01:00
print '<tr class="CTableRow' . ( $var ? '1' : '2' ) . '"><td class="CTableRow' . ( $var ? '1' : '2' ) . '">' . $langs -> trans ( " Amount " );
2009-02-16 02:34:14 +01:00
if ( empty ( $amount )) print ' (' . $langs -> trans ( " ToComplete " ) . ')' ;
print '</td><td class="CTableRow' . ( $var ? '1' : '2' ) . '">' ;
2012-04-02 13:10:22 +02:00
if ( empty ( $amount ) || ! is_numeric ( $amount ))
{
print '<input type="hidden" name="amount" value="' . GETPOST ( " amount " , 'int' ) . '">' ;
print '<input class="flat" size=8 type="text" name="newamount" value="' . GETPOST ( " newamount " , " int " ) . '">' ;
}
2009-02-16 02:34:14 +01:00
else {
print '<b>' . price ( $amount ) . '</b>' ;
2010-10-31 19:57:11 +01:00
print '<input type="hidden" name="amount" value="' . $amount . '">' ;
2009-02-16 02:34:14 +01:00
print '<input type="hidden" name="newamount" value="' . $amount . '">' ;
}
2010-10-04 01:20:49 +02:00
// Currency
print ' <b>' . $langs -> trans ( " Currency " . $currency ) . '</b>' ;
print '<input type="hidden" name="currency" value="' . $currency . '">' ;
2009-02-16 02:34:14 +01:00
print '</td></tr>' . " \n " ;
// Tag
$var =! $var ;
2012-03-10 01:07:35 +01:00
print '<tr class="CTableRow' . ( $var ? '1' : '2' ) . '"><td class="CTableRow' . ( $var ? '1' : '2' ) . '">' . $langs -> trans ( " PaymentCode " );
2010-10-31 19:57:11 +01:00
print '</td><td class="CTableRow' . ( $var ? '1' : '2' ) . '"><b>' . $fulltag . '</b>' ;
2009-02-16 02:34:14 +01:00
print '<input type="hidden" name="tag" value="' . $tag . '">' ;
2010-10-31 19:57:11 +01:00
print '<input type="hidden" name="fulltag" value="' . $fulltag . '">' ;
2009-02-16 02:34:14 +01:00
print '</td></tr>' . " \n " ;
// EMail
$var =! $var ;
2012-03-10 01:07:35 +01:00
print '<tr class="CTableRow' . ( $var ? '1' : '2' ) . '"><td class="CTableRow' . ( $var ? '1' : '2' ) . '">' . $langs -> trans ( " YourEMail " );
2009-02-16 02:34:14 +01:00
print ' (' . $langs -> trans ( " ToComplete " ) . ')' ;
2012-01-19 22:20:28 +01:00
$email = $invoice -> thirdparty -> email ;
2011-07-05 10:29:53 +02:00
$email = ( GETPOST ( " email " ) ? GETPOST ( " email " ) : ( isValidEmail ( $email ) ? $email : '' ));
print '</td><td class="CTableRow' . ( $var ? '1' : '2' ) . '"><input class="flat" type="text" name="email" size="48" value="' . $email . '"></td></tr>' . " \n " ;
2009-02-16 02:34:14 +01:00
}
// Payment on contract line
2012-04-02 12:32:55 +02:00
if ( GETPOST ( " source " ) == 'contractline' && $valid )
2009-02-15 16:04:02 +01:00
{
$found = true ;
2009-02-15 18:33:02 +01:00
$langs -> load ( " contracts " );
2009-02-15 16:04:02 +01:00
2012-08-22 23:11:24 +02:00
require_once DOL_DOCUMENT_ROOT . '/contrat/class/contrat.class.php' ;
2009-02-15 16:04:02 +01:00
$contractline = new ContratLigne ( $db );
2012-04-02 12:32:55 +02:00
$result = $contractline -> fetch ( '' , $ref );
2009-02-15 16:04:02 +01:00
if ( $result < 0 )
{
$mesg = $contractline -> error ;
2009-10-10 17:32:28 +02:00
$error ++ ;
2009-02-15 16:04:02 +01:00
}
else
{
if ( $contractline -> fk_contrat > 0 )
{
$contract = new Contrat ( $db );
$result = $contract -> fetch ( $contractline -> fk_contrat );
2009-02-15 18:33:02 +01:00
if ( $result > 0 )
{
2010-08-06 15:56:25 +02:00
$result = $contract -> fetch_thirdparty ( $contract -> socid );
2009-02-15 18:33:02 +01:00
}
else
2009-02-15 16:04:02 +01:00
{
$mesg = $contract -> error ;
2009-10-10 17:32:28 +02:00
$error ++ ;
2009-02-15 16:04:02 +01:00
}
}
else
{
$mesg = 'ErrorRecordNotFound' ;
2009-10-10 17:32:28 +02:00
$error ++ ;
2009-02-15 16:04:02 +01:00
}
}
2009-02-15 18:33:02 +01:00
2009-02-15 16:04:02 +01:00
$amount = $contractline -> total_ttc ;
2009-02-15 18:33:02 +01:00
if ( $contractline -> fk_product )
{
$product = new Product ( $db );
$result = $product -> fetch ( $contractline -> fk_product );
// We define price for product (TODO Put this in a method in product class)
2012-09-15 10:01:35 +02:00
if ( ! empty ( $conf -> global -> PRODUIT_MULTIPRICES ))
2009-02-15 18:33:02 +01:00
{
2012-01-19 22:20:28 +01:00
$pu_ht = $product -> multiprices [ $contract -> thirdparty -> price_level ];
$pu_ttc = $product -> multiprices_ttc [ $contract -> thirdparty -> price_level ];
$price_base_type = $product -> multiprices_base_type [ $contract -> thirdparty -> price_level ];
2009-02-15 18:33:02 +01:00
}
else
{
$pu_ht = $product -> price ;
$pu_ttc = $product -> price_ttc ;
$price_base_type = $product -> price_base_type ;
}
$amount = $pu_ttc ;
if ( empty ( $amount ))
{
2009-02-20 23:53:15 +01:00
dol_print_error ( '' , 'ErrorNoPriceDefinedForThisProduct' );
2009-02-15 18:33:02 +01:00
exit ;
}
}
2010-11-21 15:35:39 +01:00
if ( GETPOST ( " amount " , 'int' )) $amount = GETPOST ( " amount " , 'int' );
$amount = price2num ( $amount );
2009-02-15 18:33:02 +01:00
2012-04-02 13:28:22 +02:00
$fulltag = 'CLR=' . $contractline -> ref . '.CR=' . $contract -> ref . '.TPID=' . $contract -> thirdparty -> id ;
//$fulltag.='.TP='.strtr($contract->thirdparty->name,"-"," "); We disable this because url that will contains FULLTAG must be lower than 150
2012-04-02 12:32:55 +02:00
if ( ! empty ( $TAG )) { $tag = $TAG ; $fulltag .= '.TAG=' . $TAG ; }
2010-10-31 19:57:11 +01:00
$fulltag = dol_string_unaccent ( $fulltag );
2009-02-15 18:33:02 +01:00
2009-02-15 16:04:02 +01:00
$qty = 1 ;
2012-04-02 12:32:55 +02:00
if ( GETPOST ( 'qty' )) $qty = GETPOST ( 'qty' );
2009-02-15 18:33:02 +01:00
// Creditor
$var =! $var ;
2012-03-10 01:07:35 +01:00
print '<tr class="CTableRow' . ( $var ? '1' : '2' ) . '"><td class="CTableRow' . ( $var ? '1' : '2' ) . '">' . $langs -> trans ( " Creditor " );
2010-11-01 13:41:32 +01:00
print '</td><td class="CTableRow' . ( $var ? '1' : '2' ) . '"><b>' . $creditor . '</b>' ;
print '<input type="hidden" name="creditor" value="' . $creditor . '">' ;
print '</td></tr>' . " \n " ;
2009-02-15 18:33:02 +01:00
// Debitor
$var =! $var ;
2012-03-10 01:07:35 +01:00
print '<tr class="CTableRow' . ( $var ? '1' : '2' ) . '"><td class="CTableRow' . ( $var ? '1' : '2' ) . '">' . $langs -> trans ( " ThirdParty " );
2012-01-19 22:20:28 +01:00
print '</td><td class="CTableRow' . ( $var ? '1' : '2' ) . '"><b>' . $contract -> thirdparty -> name . '</b>' ;
2009-02-15 18:33:02 +01:00
2009-02-15 16:04:02 +01:00
// Object
$var =! $var ;
2009-02-15 18:33:02 +01:00
$text = '<b>' . $langs -> trans ( " PaymentRenewContractId " , $contract -> ref , $contractline -> ref ) . '</b>' ;
if ( $contractline -> fk_product )
{
$text .= '<br>' . $product -> ref . ( $product -> libelle ? ' - ' . $product -> libelle : '' );
}
2009-02-15 16:04:02 +01:00
if ( $contractline -> description ) $text .= '<br>' . dol_htmlentitiesbr ( $contractline -> description );
2009-02-15 18:33:02 +01:00
//if ($contractline->date_fin_validite) {
// $text.='<br>'.$langs->trans("DateEndPlanned").': ';
2009-02-20 23:53:15 +01:00
// $text.=dol_print_date($contractline->date_fin_validite);
2009-02-15 18:33:02 +01:00
//}
2009-02-16 21:02:03 +01:00
if ( $contractline -> date_fin_validite )
{
2009-02-20 23:53:15 +01:00
$text .= '<br>' . $langs -> trans ( " ExpiredSince " ) . ': ' . dol_print_date ( $contractline -> date_fin_validite );
2009-02-16 21:02:03 +01:00
}
2012-03-10 01:07:35 +01:00
print '<tr class="CTableRow' . ( $var ? '1' : '2' ) . '"><td class="CTableRow' . ( $var ? '1' : '2' ) . '">' . $langs -> trans ( " Designation " );
2009-02-15 18:33:02 +01:00
print '</td><td class="CTableRow' . ( $var ? '1' : '2' ) . '">' . $text ;
2010-11-21 15:35:39 +01:00
print '<input type="hidden" name="source" value="' . GETPOST ( " source " , 'alpha' ) . '">' ;
2009-02-15 18:33:02 +01:00
print '<input type="hidden" name="ref" value="' . $contractline -> ref . '">' ;
print '</td></tr>' . " \n " ;
2009-02-15 16:04:02 +01:00
// Quantity
$var =! $var ;
2009-02-16 21:02:03 +01:00
$label = $langs -> trans ( " Quantity " );
$qty = 1 ;
$duration = '' ;
2009-02-15 18:33:02 +01:00
if ( $contractline -> fk_product )
{
2009-02-16 21:02:03 +01:00
if ( $product -> isservice () && $product -> duration_value > 0 )
2009-02-15 18:33:02 +01:00
{
2009-02-16 21:02:03 +01:00
$label = $langs -> trans ( " Duration " );
2009-02-15 18:33:02 +01:00
// TODO Put this in a global method
if ( $product -> duration_value > 1 )
{
$dur = array ( " h " => $langs -> trans ( " Hours " ), " d " => $langs -> trans ( " DurationDays " ), " w " => $langs -> trans ( " DurationWeeks " ), " m " => $langs -> trans ( " DurationMonths " ), " y " => $langs -> trans ( " DurationYears " ));
}
else
{
$dur = array ( " h " => $langs -> trans ( " Hour " ), " d " => $langs -> trans ( " DurationDay " ), " w " => $langs -> trans ( " DurationWeek " ), " m " => $langs -> trans ( " DurationMonth " ), " y " => $langs -> trans ( " DurationYear " ));
}
2009-02-16 21:02:03 +01:00
$duration = $product -> duration_value . ' ' . $dur [ $product -> duration_unit ];
2009-02-15 18:33:02 +01:00
}
}
2012-03-10 01:07:35 +01:00
print '<tr class="CTableRow' . ( $var ? '1' : '2' ) . '"><td class="CTableRow' . ( $var ? '1' : '2' ) . '">' . $label . '</td>' ;
2009-02-16 21:02:03 +01:00
print '<td class="CTableRow' . ( $var ? '1' : '2' ) . '"><b>' . ( $duration ? $duration : $qty ) . '</b>' ;
2010-11-21 15:35:39 +01:00
print '<input type="hidden" name="newqty" value="' . dol_escape_htmltag ( $qty ) . '">' ;
2009-02-15 16:04:02 +01:00
print '</b></td></tr>' . " \n " ;
2009-02-15 18:33:02 +01:00
// Amount
$var =! $var ;
2012-03-10 01:07:35 +01:00
print '<tr class="CTableRow' . ( $var ? '1' : '2' ) . '"><td class="CTableRow' . ( $var ? '1' : '2' ) . '">' . $langs -> trans ( " Amount " );
2009-02-15 18:33:02 +01:00
if ( empty ( $amount )) print ' (' . $langs -> trans ( " ToComplete " ) . ')' ;
print '</td><td class="CTableRow' . ( $var ? '1' : '2' ) . '">' ;
2012-04-02 13:10:22 +02:00
if ( empty ( $amount ) || ! is_numeric ( $amount ))
{
print '<input type="hidden" name="amount" value="' . GETPOST ( " amount " , 'int' ) . '">' ;
print '<input class="flat" size=8 type="text" name="newamount" value="' . GETPOST ( " newamount " , " int " ) . '">' ;
}
2009-02-15 18:33:02 +01:00
else {
print '<b>' . price ( $amount ) . '</b>' ;
2010-10-31 19:57:11 +01:00
print '<input type="hidden" name="amount" value="' . $amount . '">' ;
2009-02-15 18:33:02 +01:00
print '<input type="hidden" name="newamount" value="' . $amount . '">' ;
}
2010-10-04 01:20:49 +02:00
// Currency
print ' <b>' . $langs -> trans ( " Currency " . $currency ) . '</b>' ;
print '<input type="hidden" name="currency" value="' . $currency . '">' ;
2009-02-15 18:33:02 +01:00
print '</td></tr>' . " \n " ;
// Tag
$var =! $var ;
2012-03-10 01:07:35 +01:00
print '<tr class="CTableRow' . ( $var ? '1' : '2' ) . '"><td class="CTableRow' . ( $var ? '1' : '2' ) . '">' . $langs -> trans ( " PaymentCode " );
2010-10-31 19:57:11 +01:00
print '</td><td class="CTableRow' . ( $var ? '1' : '2' ) . '"><b>' . $fulltag . '</b>' ;
2009-02-15 18:33:02 +01:00
print '<input type="hidden" name="tag" value="' . $tag . '">' ;
2010-10-31 19:57:11 +01:00
print '<input type="hidden" name="fulltag" value="' . $fulltag . '">' ;
2009-02-15 18:33:02 +01:00
print '</td></tr>' . " \n " ;
// EMail
$var =! $var ;
2012-03-10 01:07:35 +01:00
print '<tr class="CTableRow' . ( $var ? '1' : '2' ) . '"><td class="CTableRow' . ( $var ? '1' : '2' ) . '">' . $langs -> trans ( " YourEMail " );
2009-02-15 18:33:02 +01:00
print ' (' . $langs -> trans ( " ToComplete " ) . ')' ;
2012-01-19 22:20:28 +01:00
$email = $contract -> thirdparty -> email ;
2011-07-05 10:29:53 +02:00
$email = ( GETPOST ( " email " ) ? GETPOST ( " email " ) : ( isValidEmail ( $email ) ? $email : '' ));
print '</td><td class="CTableRow' . ( $var ? '1' : '2' ) . '"><input class="flat" type="text" name="email" size="48" value="' . $email . '"></td></tr>' . " \n " ;
2009-02-15 18:33:02 +01:00
}
2009-02-26 01:42:22 +01:00
// Payment on member subscription
2012-04-02 12:32:55 +02:00
if ( GETPOST ( " source " ) == 'membersubscription' && $valid )
2009-02-15 18:33:02 +01:00
{
$found = true ;
2009-02-26 01:42:22 +01:00
$langs -> load ( " members " );
2012-08-22 23:11:24 +02:00
require_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php' ;
require_once DOL_DOCUMENT_ROOT . '/adherents/class/cotisation.class.php' ;
2009-02-26 01:42:22 +01:00
$member = new Adherent ( $db );
2012-04-02 12:32:55 +02:00
$result = $member -> fetch ( '' , $ref );
2009-02-26 01:42:22 +01:00
if ( $result < 0 )
{
$mesg = $member -> error ;
2009-10-10 17:32:28 +02:00
$error ++ ;
2009-02-26 01:42:22 +01:00
}
else
{
$subscription = new Cotisation ( $db );
}
$amount = $subscription -> total_ttc ;
2010-11-21 15:35:39 +01:00
if ( GETPOST ( " amount " , 'int' )) $amount = GETPOST ( " amount " , 'int' );
$amount = price2num ( $amount );
2009-02-26 01:42:22 +01:00
2012-04-02 13:28:22 +02:00
$fulltag = 'MID=' . $member -> id ;
//$fulltag.='.M='.dol_trunc(strtr($member->getFullName($langs),"-"," "),12); We disable this because url that will contains FULLTAG must be lower than 150
2012-04-02 12:32:55 +02:00
if ( ! empty ( $TAG )) { $tag = $TAG ; $fulltag .= '.TAG=' . $TAG ; }
2010-10-31 19:57:11 +01:00
$fulltag = dol_string_unaccent ( $fulltag );
2009-02-15 18:33:02 +01:00
2009-02-15 16:04:02 +01:00
// Creditor
$var =! $var ;
2012-03-10 01:07:35 +01:00
print '<tr class="CTableRow' . ( $var ? '1' : '2' ) . '"><td class="CTableRow' . ( $var ? '1' : '2' ) . '">' . $langs -> trans ( " Creditor " );
2010-11-01 13:41:32 +01:00
print '</td><td class="CTableRow' . ( $var ? '1' : '2' ) . '"><b>' . $creditor . '</b>' ;
print '<input type="hidden" name="creditor" value="' . $creditor . '">' ;
print '</td></tr>' . " \n " ;
2009-02-15 18:33:02 +01:00
2009-02-26 01:42:22 +01:00
// Debitor
$var =! $var ;
2012-03-10 01:07:35 +01:00
print '<tr class="CTableRow' . ( $var ? '1' : '2' ) . '"><td class="CTableRow' . ( $var ? '1' : '2' ) . '">' . $langs -> trans ( " Member " );
2012-05-28 22:09:36 +02:00
print '</td><td class="CTableRow' . ( $var ? '1' : '2' ) . '"><b>' ;
if ( $member -> morphy == 'mor' && ! empty ( $member -> societe )) print $member -> societe ;
else print $member -> getFullName ( $langs );
print '</b>' ;
2009-02-26 01:42:22 +01:00
// Object
$var =! $var ;
$text = '<b>' . $langs -> trans ( " PaymentSubscription " ) . '</b>' ;
2012-04-02 12:32:55 +02:00
print '<tr class="CTableRow' . ( $var ? '1' : '2' ) . '"><td class="CTableRow' . ( $var ? '1' : '2' ) . '">' . $langs -> trans ( " Designation " );
2009-02-26 01:42:22 +01:00
print '</td><td class="CTableRow' . ( $var ? '1' : '2' ) . '">' . $text ;
2010-11-21 15:35:39 +01:00
print '<input type="hidden" name="source" value="' . GETPOST ( " source " , 'alpha' ) . '">' ;
2009-02-26 01:42:22 +01:00
print '<input type="hidden" name="ref" value="' . $member -> ref . '">' ;
print '</td></tr>' . " \n " ;
2010-12-01 22:38:00 +01:00
if ( $member -> last_subscription_date || $member -> last_subscription_amount )
{
// Last subscription date
$var =! $var ;
2012-03-10 01:07:35 +01:00
print '<tr class="CTableRow' . ( $var ? '1' : '2' ) . '"><td class="CTableRow' . ( $var ? '1' : '2' ) . '">' . $langs -> trans ( " LastSubscriptionDate " );
2010-12-01 22:38:00 +01:00
print '</td><td class="CTableRow' . ( $var ? '1' : '2' ) . '">' . dol_print_date ( $member -> last_subscription_date , 'day' );
print '</td></tr>' . " \n " ;
// Last subscription amount
$var =! $var ;
2012-03-10 01:07:35 +01:00
print '<tr class="CTableRow' . ( $var ? '1' : '2' ) . '"><td class="CTableRow' . ( $var ? '1' : '2' ) . '">' . $langs -> trans ( " LastSubscriptionAmount " );
2010-12-01 22:38:00 +01:00
print '</td><td class="CTableRow' . ( $var ? '1' : '2' ) . '">' . price ( $member -> last_subscription_amount );
print '</td></tr>' . " \n " ;
if ( empty ( $amount ) && ! GETPOST ( 'newamount' )) $_GET [ 'newamount' ] = $member -> last_subscription_amount ;
}
2009-02-11 21:44:00 +01:00
// Amount
$var =! $var ;
2012-03-10 01:07:35 +01:00
print '<tr class="CTableRow' . ( $var ? '1' : '2' ) . '"><td class="CTableRow' . ( $var ? '1' : '2' ) . '">' . $langs -> trans ( " Amount " );
2009-02-11 21:44:00 +01:00
if ( empty ( $amount )) print ' (' . $langs -> trans ( " ToComplete " ) . ')' ;
print '</td><td class="CTableRow' . ( $var ? '1' : '2' ) . '">' ;
2012-04-02 12:32:55 +02:00
if ( empty ( $amount ) || ! is_numeric ( $amount ))
{
$valtoshow = GETPOST ( " newamount " , 'int' );
if ( ! empty ( $conf -> global -> MEMBER_MIN_AMOUNT ) && $valtoshow ) $valtoshow = max ( $conf -> global -> MEMBER_MIN_AMOUNT , $valtoshow );
2012-04-02 13:10:22 +02:00
print '<input type="hidden" name="amount" value="' . GETPOST ( " amount " , 'int' ) . '">' ;
2012-04-02 12:32:55 +02:00
print '<input class="flat" size="8" type="text" name="newamount" value="' . $valtoshow . '">' ;
}
2009-02-11 21:44:00 +01:00
else {
2012-04-02 12:32:55 +02:00
$valtoshow = $amount ;
if ( ! empty ( $conf -> global -> MEMBER_MIN_AMOUNT ) && $valtoshow ) $valtoshow = max ( $conf -> global -> MEMBER_MIN_AMOUNT , $valtoshow );
print '<b>' . price ( $valtoshow ) . '</b>' ;
print '<input type="hidden" name="amount" value="' . $valtoshow . '">' ;
print '<input type="hidden" name="newamount" value="' . $valtoshow . '">' ;
2009-02-11 21:44:00 +01:00
}
2010-10-04 01:20:49 +02:00
// Currency
print ' <b>' . $langs -> trans ( " Currency " . $currency ) . '</b>' ;
print '<input type="hidden" name="currency" value="' . $currency . '">' ;
2009-02-11 21:44:00 +01:00
print '</td></tr>' . " \n " ;
2009-02-15 18:33:02 +01:00
2009-02-11 21:44:00 +01:00
// Tag
$var =! $var ;
2012-03-10 01:07:35 +01:00
print '<tr class="CTableRow' . ( $var ? '1' : '2' ) . '"><td class="CTableRow' . ( $var ? '1' : '2' ) . '">' . $langs -> trans ( " PaymentCode " );
2010-10-31 19:57:11 +01:00
print '</td><td class="CTableRow' . ( $var ? '1' : '2' ) . '"><b>' . $fulltag . '</b>' ;
2009-02-15 18:33:02 +01:00
print '<input type="hidden" name="tag" value="' . $tag . '">' ;
2010-10-31 19:57:11 +01:00
print '<input type="hidden" name="fulltag" value="' . $fulltag . '">' ;
2009-02-15 18:33:02 +01:00
print '</td></tr>' . " \n " ;
2009-02-11 21:44:00 +01:00
// EMail
$var =! $var ;
2012-03-10 01:07:35 +01:00
print '<tr class="CTableRow' . ( $var ? '1' : '2' ) . '"><td class="CTableRow' . ( $var ? '1' : '2' ) . '">' . $langs -> trans ( " YourEMail " );
2012-01-19 22:20:28 +01:00
$email = $member -> email ;
2011-07-05 10:29:53 +02:00
$email = ( GETPOST ( " email " ) ? GETPOST ( " email " ) : ( isValidEmail ( $email ) ? $email : '' ));
2011-07-13 13:14:43 +02:00
if ( empty ( $email )) print ' (' . $langs -> trans ( " ToComplete " ) . ')' ;
2011-07-05 10:29:53 +02:00
print '</td><td class="CTableRow' . ( $var ? '1' : '2' ) . '"><input class="flat" type="text" name="email" size="48" value="' . $email . '"></td></tr>' . " \n " ;
2009-02-11 21:44:00 +01:00
}
2009-02-26 01:42:22 +01:00
2009-02-15 16:04:02 +01:00
if ( ! $found && ! $mesg ) $mesg = $langs -> trans ( " ErrorBadParameters " );
2009-02-11 21:44:00 +01:00
2010-10-31 19:57:11 +01:00
if ( $mesg ) print '<tr><td align="center" colspan="2"><br><div class="warning">' . $mesg . '</div></td></tr>' . " \n " ;
2009-02-11 21:44:00 +01:00
2010-10-31 19:57:11 +01:00
print '</table>' . " \n " ;
print " \n " ;
2009-10-10 17:32:28 +02:00
if ( $found && ! $error ) // We are in a management option and no error
2009-02-15 18:33:02 +01:00
{
2009-10-10 17:32:28 +02:00
print '<br><input class="button" type="submit" name="dopayment" value="' . $langs -> trans ( " PayBoxDoPayment " ) . '">' ;
2009-02-15 18:33:02 +01:00
//print '<tr><td align="center" colspan="2">'.$langs->trans("YouWillBeRedirectedOnPayBox").'...</td></tr>';
}
2009-10-10 17:32:28 +02:00
else
{
2012-11-20 11:23:34 +01:00
dol_print_error_email ( 'ERRORNEWPAYMENTPAYBOX' );
2009-10-10 17:32:28 +02:00
}
2009-02-11 21:44:00 +01:00
2010-10-31 19:57:11 +01:00
print '</td></tr>' . " \n " ;
2009-02-11 21:44:00 +01:00
2010-10-31 19:57:11 +01:00
print '</table>' . " \n " ;
print '</form>' . " \n " ;
print '</center>' . " \n " ;
2009-02-11 21:44:00 +01:00
print '<br>' ;
2010-10-03 20:16:14 +02:00
html_print_paybox_footer ( $mysoc , $langs );
2009-02-11 21:44:00 +01:00
2011-08-27 21:15:14 +02:00
llxFooterPayBox ();
2012-03-10 01:07:35 +01:00
$db -> close ();
2009-02-11 21:44:00 +01:00
?>