* Copyright (C) 2005-2007 Regis Houssin * * 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 * the Free Software Foundation; either version 2 of the License, or * (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 * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * or see http://www.gnu.org/ */ /** * \file htdocs/paybox/paybox.lib.php * \brief Library for common paybox functions * \version $Id$ */ function llxHeaderPaybox($title, $head = "") { global $user, $conf, $langs; // Si feuille de style en php existe if (file_exists(DOL_DOCUMENT_ROOT.'/'.$conf->css.".php")) $conf->css.=".php"; header("Content-type: text/html; charset=".$conf->file->character_set_client); print ''; //print ''; print "\n"; print "\n"; print "\n"; print ''."\n"; print ''."\n"; print ''."\n"; print "".$title."\n"; if ($head) print $head."\n"; if ($conf->global->PAYBOX_CSS_URL) print ''."\n"; else { print ''."\n"; print ''; } print "\n"; print ''."\n"; } function llxFooterPayBox() { print "\n"; print "\n"; } /** * \brief Create a redirect form to paybox form * \return int 1 if OK, -1 if ERROR */ function print_paybox_redirect($PRICE,$CURRENCY,$EMAIL,$urlok,$urlko,$TAG) { global $conf, $langs, $db; dol_syslog("Paypal.lib::print_paybox_redirect", LOG_DEBUG); // Clean parameters $PBX_IDENTIFIANT="2"; # Identifiant pour v2 test if ($conf->global->PAYBOX_PBX_IDENTIFIANT) $PBX_IDENTIFIANT=$conf->global->PAYBOX_PBX_IDENTIFIANT; $IBS_SITE="1999888"; # Site test 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="840"; # Currency (Dollar US by default) if ($CURRENCY == 'EUR') $IBS_DEVISE="978"; if ($CURRENCY == 'USD') $IBS_DEVISE="840"; $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)) { dol_print_error('',"Paybox setup param PAYBOX_IBS_DEVISE not defined"); return -1; } if (empty($URLPAYBOX)) { dol_print_error('',"Paybox setup param PAYBOX_CGI_URL_V1 and PAYBOX_CGI_URL_V2 undefined"); return -1; } if (empty($IBS_SITE)) { dol_print_error('',"Paybox setup param PAYBOX_IBS_SITE not defined"); return -1; } if (empty($IBS_RANG)) { dol_print_error('',"Paybox setup param PAYBOX_IBS_RANG not defined"); return -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="
".$langsiso->trans("YouWillBeRedirectedOnPayBox")."
".$langsiso->trans("PleaseBePatient")."...
"; $IBS_TXT=' '; // Use a space $IBS_BOUTPI=$langs->trans("Wait"); //$IBS_BOUTPI=''; $IBS_EFFECTUE=$urlok; $IBS_ANNULE=$urlko; $IBS_REFUSE=$urlko; $IBS_BKGD="#FFFFFF"; $IBS_WAIT="2000"; $IBS_LANG="GBR"; // By default GBR=english (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"; if (eregi('^NL',$langs->defaultlang)) $IBS_LANG="NLD"; if (eregi('^SE',$langs->defaultlang)) $IBS_LANG="SWE"; $IBS_OUTPUT='E'; $PBX_SOURCE='HTML'; $PBX_TYPEPAIEMENT='CARTE'; dol_syslog("Soumission Paybox", LOG_DEBUG); dol_syslog("IBS_MODE: $IBS_MODE", LOG_DEBUG); dol_syslog("IBS_SITE: $IBS_SITE", LOG_DEBUG); dol_syslog("IBS_RANG: $IBS_RANG", LOG_DEBUG); dol_syslog("IBS_TOTAL: $IBS_TOTAL", LOG_DEBUG); dol_syslog("IBS_DEVISE: $IBS_DEVISE", LOG_DEBUG); dol_syslog("IBS_CMD: $IBS_CMD", LOG_DEBUG); dol_syslog("IBS_PORTEUR: $IBS_PORTEUR", LOG_DEBUG); dol_syslog("IBS_RETOUR: $IBS_RETOUR", LOG_DEBUG); dol_syslog("IBS_EFFECTUE: $IBS_EFFECTUE", LOG_DEBUG); dol_syslog("IBS_ANNULE: $IBS_ANNULE", LOG_DEBUG); dol_syslog("IBS_REFUSE: $IBS_REFUSE", LOG_DEBUG); 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); dol_syslog("PBX_IDENTIFIANT: $PBX_IDENTITIANT", LOG_DEBUG); dol_syslog("PBX_SOURCE: $PBX_SOURCE", LOG_DEBUG); dol_syslog("PBX_TYPEPAIEMENT: $PBX_TYPEPAIEMENT", LOG_DEBUG); header("Content-type: text/html; charset=".$conf->file->character_set_client); print ''."\n"; print ''."\n"; print "\n"; print ''."\n"; print ''."\n"; print "\n"; // Formulaire pour module Paybox print '
'."\n"; // For Paybox V1 (IBS_xxx) /* print ''."\n"; print ''."\n"; print ''."\n"; print ''."\n"; print ''."\n"; print ''."\n"; print ''."\n"; print ''."\n"; print ''."\n"; print ''."\n"; print ''."\n"; print ''."\n"; print ''."\n"; print ''."\n"; print ''."\n"; print ''."\n"; print ''."\n"; */ // For Paybox V2 (PBX_xxx) print ''."\n"; print ''."\n"; print ''."\n"; print ''."\n"; print ''."\n"; print ''."\n"; print ''."\n"; print ''."\n"; print ''."\n"; print ''."\n"; print ''."\n"; print ''."\n"; print ''."\n"; print ''."\n"; print ''."\n"; print ''."\n"; print ''."\n"; print ''."\n"; print ''."\n"; print ''."\n"; print '
'."\n"; // Formulaire pour module Paybox v2 (PBX_xxx) print "\n"; print ''."\n"; print "\n"; print ''."\n"; print "\n"; return; } /** * Show footer of company in HTML pages * * @param unknown_type $fromcompany * @param unknown_type $langs */ function html_print_footer($fromcompany,$langs) { global $conf; // Juridical status $ligne1=""; if ($fromcompany->forme_juridique_code) { $ligne1.=($ligne1?" - ":"").$langs->convToOutputCharset(getFormeJuridiqueLabel($fromcompany->forme_juridique_code)); } // Capital if ($fromcompany->capital) { $ligne1.=($ligne1?" - ":"").$langs->transnoentities("CapitalOf",$fromcompany->capital)." ".$langs->transnoentities("Currency".$conf->monnaie); } // Prof Id 1 if ($fromcompany->profid1 && ($fromcompany->pays_code != 'FR' || ! $fromcompany->profid2)) { $field=$langs->transcountrynoentities("ProfId1",$fromcompany->pays_code); if (eregi('\((.*)\)',$field,$reg)) $field=$reg[1]; $ligne1.=($ligne1?" - ":"").$field.": ".$langs->convToOutputCharset($fromcompany->profid1); } // Prof Id 2 if ($fromcompany->profid2) { $field=$langs->transcountrynoentities("ProfId2",$fromcompany->pays_code); if (eregi('\((.*)\)',$field,$reg)) $field=$reg[1]; $ligne1.=($ligne1?" - ":"").$field.": ".$langs->convToOutputCharset($fromcompany->profid2); } // Second line of company infos $ligne2=""; // Prof Id 3 if ($fromcompany->profid3) { $field=$langs->transcountrynoentities("ProfId3",$fromcompany->pays_code); if (eregi('\((.*)\)',$field,$reg)) $field=$reg[1]; $ligne2.=($ligne2?" - ":"").$field.": ".$langs->convToOutputCharset($fromcompany->profid3); } // Prof Id 4 if ($fromcompany->profid4) { $field=$langs->transcountrynoentities("ProfId4",$fromcompany->pays_code); if (eregi('\((.*)\)',$field,$reg)) $field=$reg[1]; $ligne2.=($ligne2?" - ":"").$field.": ".$langs->convToOutputCharset($fromcompany->profid4); } // IntraCommunautary VAT if ($fromcompany->tva_intra != '') { $ligne2.=($ligne2?" - ":"").$langs->transnoentities("VATIntraShort").": ".$langs->convToOutputCharset($fromcompany->tva_intra); } print '


'."\n"; print '
'."\n"; print $fromcompany->nom.'
'; print $ligne1.'
'; print $ligne2; print '
'."\n"; } ?>