This commit is contained in:
eldy 2011-10-03 18:10:50 +02:00
parent 190adf2d49
commit c05ad3b4da
3 changed files with 259 additions and 208 deletions

View File

@ -604,18 +604,19 @@ function dolibarr_print_date($time,$format='',$to_gmt=false,$outputlangs='',$enc
* Output date in a string format according to outputlangs (or langs if not defined). * Output date in a string format according to outputlangs (or langs if not defined).
* Return charset is always UTF-8, except if encodetoouput is defined. In this cas charset is output charset * Return charset is always UTF-8, except if encodetoouput is defined. In this cas charset is output charset
* *
* @param time GM Timestamps date (or deprecated strings 'YYYY-MM-DD' or 'YYYY-MM-DD HH:MM:SS') * @param timestamp $time GM Timestamps date (or deprecated strings 'YYYY-MM-DD' or 'YYYY-MM-DD HH:MM:SS')
* @param format Output date format * @param string $format Output date format
* "%d %b %Y", * "%d %b %Y",
* "%d/%m/%Y %H:%M", * "%d/%m/%Y %H:%M",
* "%d/%m/%Y %H:%M:%S", * "%d/%m/%Y %H:%M:%S",
* "day", "daytext", "dayhour", "dayhourldap", "dayhourtext" * "day", "daytext", "dayhour", "dayhourldap", "dayhourtext"
* @param tzoutput true=output or 'gmt' => string is for Greenwich location * @param string $tzoutput true=output or 'gmt' => string is for Greenwich location
* false or 'tzserver' => output string is for local PHP server TZ usage * false or 'tzserver' => output string is for local PHP server TZ usage
* 'tzuser' => output string is for local browser TZ usage * 'tzuser' => output string is for local browser TZ usage
* @param outputlangs Object lang that contains language for text translation. * @param Tranlsate $outputlangs Object lang that contains language for text translation.
* @param encodetooutput false=no convert into output pagecode * @param boolean $encodetooutput false=no convert into output pagecode
* @return string Formated date or '' if time is null * @return string Formated date or '' if time is null
*
* @see dol_mktime, dol_stringtotime, dol_getdate * @see dol_mktime, dol_stringtotime, dol_getdate
*/ */
function dol_print_date($time,$format='',$tzoutput='tzserver',$outputlangs='',$encodetooutput=false) function dol_print_date($time,$format='',$tzoutput='tzserver',$outputlangs='',$encodetooutput=false)
@ -751,15 +752,16 @@ function dol_print_date($time,$format='',$tzoutput='tzserver',$outputlangs='',$e
/** /**
* Convert a string date into a GM Timestamps date * Convert a string date into a GM Timestamps date
* *
* @param string Date in a string * @param string $string Date in a string
* YYYYMMDD * YYYYMMDD
* YYYYMMDDHHMMSS * YYYYMMDDHHMMSS
* YYYY-MM-DDTHH:MM:SSZ (RFC3339) * YYYY-MM-DDTHH:MM:SSZ (RFC3339)
* DD/MM/YY or DD/MM/YYYY (this format should not be used anymore) * DD/MM/YY or DD/MM/YYYY (this format should not be used anymore)
* DD/MM/YY HH:MM:SS or DD/MM/YYYY HH:MM:SS (this format should not be used anymore) * DD/MM/YY HH:MM:SS or DD/MM/YYYY HH:MM:SS (this format should not be used anymore)
* 19700101020000 -> 7200 * 19700101020000 -> 7200
* @param gm 1=Input date is GM date, 0=Input date is local date * @param int $gm 1=Input date is GM date, 0=Input date is local date
* @return date Date * @return date Date
*
* @see dol_print_date, dol_mktime, dol_getdate * @see dol_print_date, dol_mktime, dol_getdate
*/ */
function dol_stringtotime($string, $gm=1) function dol_stringtotime($string, $gm=1)
@ -803,8 +805,8 @@ function dol_stringtotime($string, $gm=1)
* Return an array with date info * Return an array with date info
* PHP getdate is restricted to the years 1901-2038 on Unix and 1970-2038 on Windows * PHP getdate is restricted to the years 1901-2038 on Unix and 1970-2038 on Windows
* *
* @param timestamp Timestamp * @param timestamp $timestamp Timestamp
* @param fast Fast mode * @param boolean $fast Fast mode
* @return array Array of informations * @return array Array of informations
* If no fast mode: * If no fast mode:
* 'seconds' => $secs, * 'seconds' => $secs,
@ -1064,12 +1066,12 @@ function dolibarr_print_phone($phone,$country="FR",$cid=0,$socid=0,$addlink=0,$s
/** /**
* Format phone numbers according to country * Format phone numbers according to country
* *
* @param phone Phone number to format * @param string $phone Phone number to format
* @param country Country to use for formatting * @param string $country Country code to use for formatting
* @param cid Id of contact if known * @param int $cid Id of contact if known
* @param socid Id of third party if known * @param int $socid Id of third party if known
* @param addlink 0=no link to create action * @param int $addlink 0=no link to create action
* @param separ separation between numbers for a better visibility example : xx.xx.xx.xx.xx * @param string $separ separation between numbers for a better visibility example : xx.xx.xx.xx.xx
* @return string Formated phone number * @return string Formated phone number
*/ */
function dol_print_phone($phone,$country="FR",$cid=0,$socid=0,$addlink=0,$separ=" ") function dol_print_phone($phone,$country="FR",$cid=0,$socid=0,$addlink=0,$separ=" ")
@ -1143,8 +1145,8 @@ function dol_print_phone($phone,$country="FR",$cid=0,$socid=0,$addlink=0,$separ=
/** /**
* Return an IP formated to be shown on screen * Return an IP formated to be shown on screen
* *
* @param ip IP * @param string $ip IP
* @param mode 1=return only country/flag,2=return only IP * @param int $mode 1=return only country/flag,2=return only IP
* @return string Formated IP, with country if GeoIP module is enabled * @return string Formated IP, with country if GeoIP module is enabled
*/ */
function dol_print_ip($ip,$mode=0) function dol_print_ip($ip,$mode=0)
@ -1183,7 +1185,7 @@ function dol_print_ip($ip,$mode=0)
* Return country code for current user. * Return country code for current user.
* If software is used inside a local network, detection may fails (we need a public ip) * If software is used inside a local network, detection may fails (we need a public ip)
* *
* @return string country code (fr, es, it, us, ...) * @return string Country code (fr, es, it, us, ...)
*/ */
function dol_user_country() function dol_user_country()
{ {
@ -1208,11 +1210,11 @@ function dol_user_country()
/** /**
* Format address string * Format address string
* *
* @param address Address * @param string $address Address
* @param htmlid Html ID * @param int $htmlid Html ID
* @param mode thirdparty|contact|member|other * @param int $mode thirdparty|contact|member|other
* @param id Id of object * @param int $id Id of object
* @param address Address string * @return void
*/ */
function dol_print_address($address, $htmlid='gmap', $mode, $id) function dol_print_address($address, $htmlid='gmap', $mode, $id)
{ {
@ -1303,13 +1305,13 @@ function dol_strlen($string,$stringencoding='UTF-8')
} }
/** /**
* Make a substring. Works even in mbstring module not enabled * Make a substring. Works even in mbstring module is not enabled.
* *
* @param $string * @param string $string String to scan
* @param $start * @param string $start Start position
* @param $length * @param int $length Length
* @param $stringencoding * @param string $stringencoding Page code used for input string encoding
* @return string * @return string substring
*/ */
function dol_substr($string,$start,$length,$stringencoding='') function dol_substr($string,$start,$length,$stringencoding='')
{ {
@ -2742,6 +2744,7 @@ function load_fiche_titre($titre, $mesg='', $picto='title.png', $pictoisfullpath
* @param totalnboflines Total number of records/lines for all pages (if known) * @param totalnboflines Total number of records/lines for all pages (if known)
* @param picto Icon to use before title (should be a 32x32 transparent png file) * @param picto Icon to use before title (should be a 32x32 transparent png file)
* @param pictoisfullpath 1=Icon name is a full absolute url of image * @param pictoisfullpath 1=Icon name is a full absolute url of image
* @return void
*/ */
function print_barre_liste($titre, $page, $file, $options='', $sortfield='', $sortorder='', $center='', $num=-1, $totalnboflines=0, $picto='title.png', $pictoisfullpath=0) function print_barre_liste($titre, $page, $file, $options='', $sortfield='', $sortorder='', $center='', $num=-1, $totalnboflines=0, $picto='title.png', $pictoisfullpath=0)
{ {
@ -2841,11 +2844,12 @@ function print_barre_liste($titre, $page, $file, $options='', $sortfield='', $so
/** /**
* Fonction servant a afficher les fleches de navigation dans les pages de listes * Fonction servant a afficher les fleches de navigation dans les pages de listes
* *
* @param page Numero of page * @param int $page Numero of page
* @param file Lien * @param string $file Lien
* @param options Autres parametres d'url a propager dans les liens ("" par defaut) * @param string $options Autres parametres d'url a propager dans les liens ("" par defaut)
* @param nextpage Faut-il une page suivante * @param int $nextpage Faut-il une page suivante
* @param betweenarrows HTML Content to show between arrows * @param string $betweenarrows HTML Content to show between arrows
* @return void
*/ */
function print_fleche_navigation($page,$file,$options='',$nextpage,$betweenarrows='') function print_fleche_navigation($page,$file,$options='',$nextpage,$betweenarrows='')
{ {
@ -2866,9 +2870,9 @@ function print_fleche_navigation($page,$file,$options='',$nextpage,$betweenarrow
* Fonction qui retourne un taux de tva formate pour visualisation * Fonction qui retourne un taux de tva formate pour visualisation
* Utilisee dans les pdf et les pages html * Utilisee dans les pdf et les pages html
* *
* @param rate Rate value to format (19.6 19,6 19.6% 19,6%,...) * @param float $rate Rate value to format (19.6 19,6 19.6% 19,6%,...)
* @param addpercent Add a percent % sign in output * @param boolean $addpercent Add a percent % sign in output
* @param info_bits Miscellanous information on vat * @param int $info_bits Miscellanous information on vat
* @return string Chaine avec montant formate (19,6 ou 19,6% ou 8.5% *) * @return string Chaine avec montant formate (19,6 ou 19,6% ou 8.5% *)
*/ */
function vatrate($rate,$addpercent=false,$info_bits=0) function vatrate($rate,$addpercent=false,$info_bits=0)
@ -2895,13 +2899,14 @@ function vatrate($rate,$addpercent=false,$info_bits=0)
* Fonction qui formate un montant pour visualisation * Fonction qui formate un montant pour visualisation
* Fonction utilisee dans les pdf et les pages html * Fonction utilisee dans les pdf et les pages html
* *
* @param amount Montant a formater * @param float $amount Montant a formater
* @param html Type de formatage, html ou pas (par defaut) * @param string $html Type de formatage, html ou pas (par defaut)
* @param outlangs Objet langs pour formatage text * @param Translate $outlangs Objet langs pour formatage text
* @param trunc 1=Tronque affichage si trop de decimales,0=Force le non troncage * @param int $trunc 1=Tronque affichage si trop de decimales,0=Force le non troncage
* @param rounding Minimum number of decimal. If not defined we use min($conf->global->MAIN_MAX_DECIMALS_UNIT,$conf->global->MAIN_MAX_DECIMALS_TOTAL) * @param int $rounding Minimum number of decimal. If not defined we use min($conf->global->MAIN_MAX_DECIMALS_UNIT,$conf->global->MAIN_MAX_DECIMALS_TOTAL)
* @param forcerounding Force the number of decimal * @param int $forcerounding Force the number of decimal
* @return string Chaine avec montant formate * @return string Chaine avec montant formate
*
* @see price2num Revert function of price * @see price2num Revert function of price
*/ */
function price($amount, $html=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1) function price($amount, $html=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1)
@ -2969,13 +2974,14 @@ function price($amount, $html=0, $outlangs='', $trunc=1, $rounding=-1, $forcerou
* an amount typed by a user. * an amount typed by a user.
* Function to use on each input amount before any numeric test or database insert * Function to use on each input amount before any numeric test or database insert
* *
* @param amount Amount to convert/clean * @param float $amount Amount to convert/clean
* @param rounding ''=No rounding * @param string $rounding ''=No rounding
* 'MU'=Round to Max unit price (MAIN_MAX_DECIMALS_UNIT) * 'MU'=Round to Max unit price (MAIN_MAX_DECIMALS_UNIT)
* 'MT'=Round to Max for totals with Tax (MAIN_MAX_DECIMALS_TOT) * 'MT'=Round to Max for totals with Tax (MAIN_MAX_DECIMALS_TOT)
* 'MS'=Round to Max Shown (MAIN_MAX_DECIMALS_SHOWN) * 'MS'=Round to Max Shown (MAIN_MAX_DECIMALS_SHOWN)
* @param alreadysqlnb Put 1 if you know that content is already universal format number * @param int $alreadysqlnb Put 1 if you know that content is already universal format number
* @return string Amount with universal numeric format (Example: '99.99999') * @return string Amount with universal numeric format (Example: '99.99999')
*
* @see price Opposite function of price2num * @see price Opposite function of price2num
*/ */
function price2num($amount,$rounding='',$alreadysqlnb=0) function price2num($amount,$rounding='',$alreadysqlnb=0)
@ -3054,9 +3060,9 @@ function price2num($amount,$rounding='',$alreadysqlnb=0)
/** /**
* Return localtaxe rate for a particular tva * Return localtaxe rate for a particular tva
* *
* @param tva Vat taxe * @param float $tva Vat taxe
* @param local Local taxe to search and return * @param int $local Local taxe to search and return
* @param societe_acheteuse Object of buying third party * @param Societe $societe_acheteuse Object of buying third party
* @return int 0 if not found, localtax if found * @return int 0 if not found, localtax if found
*/ */
function get_localtax($tva, $local, $societe_acheteuse="") function get_localtax($tva, $local, $societe_acheteuse="")
@ -3094,8 +3100,8 @@ function get_localtax($tva, $local, $societe_acheteuse="")
* Return vat rate of a product in a particular selling country or default country * Return vat rate of a product in a particular selling country or default country
* vat if product is unknown * vat if product is unknown
* *
* @param idprod Id of product or 0 if not a predefined product * @param int $idprod Id of product or 0 if not a predefined product
* @param countrycode Country code (FR, US, IT, ...) * @param string $countrycode Country code (FR, US, IT, ...)
* @return int <0 if KO, Vat rate if OK * @return int <0 if KO, Vat rate if OK
* TODO May be this should be better as a method of product class * TODO May be this should be better as a method of product class
*/ */
@ -3684,8 +3690,8 @@ function dol_microtime_float()
/** /**
* Return if a text is a html content * Return if a text is a html content
* *
* @param msg Content to check * @param string $msg Content to check
* @param option 0=Full detection, 1=Fast check * @param int $option 0=Full detection, 1=Fast check
* @return boolean true/false * @return boolean true/false
*/ */
function dol_textishtml($msg,$option=0) function dol_textishtml($msg,$option=0)
@ -3721,8 +3727,9 @@ function dol_textishtml($msg,$option=0)
* There is two type of substitions: * There is two type of substitions:
* - From $substitutionarray (oldval=>newval) * - From $substitutionarray (oldval=>newval)
* - From special constants (__XXX__=>f(objet->xxx)) by substitutions modules * - From special constants (__XXX__=>f(objet->xxx)) by substitutions modules
* @param chaine Source string in which we must do substitution *
* @param substitutionarray Array with key->val to substitute * @param string $chaine Source string in which we must do substitution
* @param array $substitutionarray Array with key->val to substitute
* @return string Output string after subsitutions * @return string Output string after subsitutions
*/ */
function make_substitutions($chaine,$substitutionarray) function make_substitutions($chaine,$substitutionarray)
@ -3740,9 +3747,10 @@ function make_substitutions($chaine,$substitutionarray)
/** /**
* Complete the $substitutionarray with more entries * Complete the $substitutionarray with more entries
* *
* @param substitutionarray Array substitution old value => new value value * @param array $substitutionarray Array substitution old value => new value value
* @param outputlangs If we want substitution from special constants, we provide a language * @param Translate $outputlangs If we want substitution from special constants, we provide a language
* @param object If we want substitution from special constants, we provide data in a source object * @param Object $object If we want substitution from special constants, we provide data in a source object
* @return void
*/ */
function complete_substitutions_array(&$substitutionarray,$outputlangs,$object='') function complete_substitutions_array(&$substitutionarray,$outputlangs,$object='')
{ {
@ -3780,6 +3788,7 @@ function complete_substitutions_array(&$substitutionarray,$outputlangs,$object='
* @param date_end End date * @param date_end End date
* @param format Output format * @param format Output format
* @param outputlangs Output language * @param outputlangs Output language
* @return void
*/ */
function print_date_range($date_start,$date_end,$format = '',$outputlangs='') function print_date_range($date_start,$date_end,$format = '',$outputlangs='')
{ {
@ -3793,6 +3802,7 @@ function print_date_range($date_start,$date_end,$format = '',$outputlangs='')
* @param date_end End date * @param date_end End date
* @param format Output format * @param format Output format
* @param outputlangs Output language * @param outputlangs Output language
* @return string String
*/ */
function get_date_range($date_start,$date_end,$format = '',$outputlangs='') function get_date_range($date_start,$date_end,$format = '',$outputlangs='')
{ {
@ -3822,11 +3832,12 @@ function get_date_range($date_start,$date_end,$format = '',$outputlangs='')
/** /**
* Get formated messages to output (Used to show messages on html output). * Get formated messages to output (Used to show messages on html output).
* *
* @param mesgstring Message string * @param string $mesgstring Message string
* @param mesgarray Messages array * @param array $mesgarray Messages array
* @param style Style of message output ('ok' or 'error') * @param string $style Style of message output ('ok' or 'error')
* @param keepembedded Set to 1 in error message must be kept embedded into its html place (this disable jnotify) * @param int $keepembedded Set to 1 in error message must be kept embedded into its html place (this disable jnotify)
* @return string Return html output * @return string Return html output
*
* @see dol_print_error * @see dol_print_error
* @see dol_htmloutput_errors * @see dol_htmloutput_errors
*/ */
@ -3919,10 +3930,11 @@ function get_htmloutput_mesg($mesgstring='',$mesgarray='', $style='ok', $keepemb
/** /**
* Get formated error messages to output (Used to show messages on html output). * Get formated error messages to output (Used to show messages on html output).
* *
* @param mesgstring Error message * @param string $mesgstring Error message
* @param mesgarray Error messages array * @param array $mesgarray Error messages array
* @param keepembedded Set to 1 in error message must be kept embedded into its html place (this disable jnotify) * @param int $keepembedded Set to 1 in error message must be kept embedded into its html place (this disable jnotify)
* @return html Return html output * @return string Return html output
*
* @see dol_print_error * @see dol_print_error
* @see dol_htmloutput_mesg * @see dol_htmloutput_mesg
*/ */
@ -3934,10 +3946,12 @@ function get_htmloutput_errors($mesgstring='', $mesgarray='', $keepembedded=0)
/** /**
* Print formated messages to output (Used to show messages on html output). * Print formated messages to output (Used to show messages on html output).
* *
* @param mesgstring Message * @param string $mesgstring Message
* @param mesgarray Messages array * @param array $mesgarray Messages array
* @param style Which style to use ('ok', 'error') * @param string $style Which style to use ('ok', 'error')
* @param keepembedded Set to 1 if message must be kept embedded into its html place (this disable jnotify) * @param int $keepembedded Set to 1 if message must be kept embedded into its html place (this disable jnotify)
* @return void
*
* @see dol_print_error * @see dol_print_error
* @see dol_htmloutput_errors * @see dol_htmloutput_errors
*/ */
@ -3983,9 +3997,11 @@ function dol_htmloutput_mesg($mesgstring='',$mesgarray='', $style='ok', $keepemb
/** /**
* Print formated error messages to output (Used to show messages on html output). * Print formated error messages to output (Used to show messages on html output).
* *
* @param mesgstring Error message * @param string $mesgstring Error message
* @param mesgarray Error messages array * @param array $mesgarray Error messages array
* @param keepembedded Set to 1 in error message must be kept embedded into its html place (this disable jnotify) * @param int $keepembedded Set to 1 in error message must be kept embedded into its html place (this disable jnotify)
* @return void
*
* @see dol_print_error * @see dol_print_error
* @see dol_htmloutput_mesg * @see dol_htmloutput_mesg
*/ */
@ -4031,7 +4047,7 @@ function dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensiti
/** /**
* Check if a string is in UTF8 * Check if a string is in UTF8
* *
* @param $str String to check * @param string $str String to check
* @return boolean True if string is UTF8 or ISO compatible with UTF8, False if not (ISO with special char or Binary) * @return boolean True if string is UTF8 or ISO compatible with UTF8, False if not (ISO with special char or Binary)
*/ */
function utf8_check($str) function utf8_check($str)
@ -4079,11 +4095,11 @@ function dol_osencode($str)
/** /**
* Return an id or code from a code or id. Store Code-Id in a cache. * Return an id or code from a code or id. Store Code-Id in a cache.
* *
* @param db Database handler * @param DoliDB $db Database handler
* @param key Code to get Id * @param string $key Code to get Id
* @param tablename Table name without prefix * @param string $tablename Table name without prefix
* @param fieldkey Field for code * @param string $fieldkey Field for code
* @param fieldid Field for id * @param string $fieldid Field for id
* @return int Id of code * @return int Id of code
*/ */
function dol_getIdFromCode($db,$key,$tablename,$fieldkey='code',$fieldid='id') function dol_getIdFromCode($db,$key,$tablename,$fieldkey='code',$fieldid='id')
@ -4122,7 +4138,7 @@ function dol_getIdFromCode($db,$key,$tablename,$fieldkey='code',$fieldid='id')
/** /**
* Verify if condition in string is ok or not * Verify if condition in string is ok or not
* *
* @param string $strRights * @param string $strRights String with condition to check
* @return boolean true or false * @return boolean true or false
*/ */
function verifCond($strRights) function verifCond($strRights)
@ -4151,6 +4167,7 @@ function verifCond($strRights)
* This function is called by verifCond() * This function is called by verifCond()
* *
* @param string $s * @param string $s
* @return void
*/ */
function dol_eval($s) function dol_eval($s)
{ {
@ -4167,7 +4184,7 @@ function dol_eval($s)
/** /**
* Return img flag of country for a language code or country code * Return img flag of country for a language code or country code
* *
* @param codelang Language code (en_IN, fr_CA...) or Country code (IN, FR) * @param string $codelang Language code (en_IN, fr_CA...) or Country code (IN, FR)
* @return string HTML img string with flag. * @return string HTML img string with flag.
*/ */
function picto_from_langcode($codelang) function picto_from_langcode($codelang)

View File

@ -21,6 +21,16 @@
* \ingroup paybox * \ingroup paybox
* \brief Library for common paybox functions * \brief Library for common paybox functions
*/ */
/**
* Show header
*
* @param string $title Title of page
* @param string $head Head string to add int head section
* @return void
*/
function llxHeaderPaybox($title, $head = "") function llxHeaderPaybox($title, $head = "")
{ {
global $user, $conf, $langs; global $user, $conf, $langs;
@ -50,6 +60,11 @@ function llxHeaderPaybox($title, $head = "")
print '<body style="margin: 20px;">'."\n"; print '<body style="margin: 20px;">'."\n";
} }
/**
* Show footer
*
* @return void
*/
function llxFooterPayBox() function llxFooterPayBox()
{ {
print "</body>\n"; print "</body>\n";
@ -60,12 +75,12 @@ function llxFooterPayBox()
/** /**
* Create a redirect form to paybox form * Create a redirect form to paybox form
* *
* @param $PRICE * @param int $PRICE Price
* @param $CURRENCY * @param string $CURRENCY Currency
* @param $EMAIL * @param string $EMAIL EMail
* @param $urlok * @param string $urlok Url to go back if payment is OK
* @param $urlko * @param string $urlko Url to go back if payment is KO
* @param $TAG * @param string $TAG Tag
* @return int 1 if OK, -1 if ERROR * @return int 1 if OK, -1 if ERROR
*/ */
function print_paybox_redirect($PRICE,$CURRENCY,$EMAIL,$urlok,$urlko,$TAG) function print_paybox_redirect($PRICE,$CURRENCY,$EMAIL,$urlok,$urlko,$TAG)
@ -231,8 +246,9 @@ function print_paybox_redirect($PRICE,$CURRENCY,$EMAIL,$urlok,$urlko,$TAG)
/** /**
* Show footer of company in HTML pages * Show footer of company in HTML pages
* *
* @param $fromcompany * @param Societe $fromcompany Third party
* @param $langs * @param Translate $langs Output language
* @return void
*/ */
function html_print_paybox_footer($fromcompany,$langs) function html_print_paybox_footer($fromcompany,$langs)
{ {

View File

@ -23,7 +23,13 @@
*/ */
/**
* Show header
*
* @param string $title
* @param string $head
* @return void
*/
function llxHeaderPaypal($title, $head = "") function llxHeaderPaypal($title, $head = "")
{ {
global $user, $conf, $langs; global $user, $conf, $langs;
@ -53,6 +59,11 @@ function llxHeaderPaypal($title, $head = "")
print '<body style="margin: 20px;">'."\n"; print '<body style="margin: 20px;">'."\n";
} }
/**
* Show footer
*
* @return void
*/
function llxFooterPaypal() function llxFooterPaypal()
{ {
print "</body>\n"; print "</body>\n";
@ -63,8 +74,9 @@ function llxFooterPaypal()
/** /**
* Show footer of company in HTML pages * Show footer of company in HTML pages
* *
* @param $fromcompany * @param Societe $fromcompany Third party
* @param $langs * @param Translate $langs Output language
* @return void
*/ */
function html_print_paypal_footer($fromcompany,$langs) function html_print_paypal_footer($fromcompany,$langs)
{ {
@ -128,6 +140,7 @@ function html_print_paypal_footer($fromcompany,$langs)
/** /**
* Define head array for tabs of paypal tools setup pages * Define head array for tabs of paypal tools setup pages
*
* @return Array of head * @return Array of head
*/ */
function paypaladmin_prepare_head() function paypaladmin_prepare_head()
@ -250,12 +263,13 @@ function getPaypalPaymentUrl($mode,$type,$ref='',$amount='9.99',$freetag='your_f
/** /**
* Send redirect to paypal to browser * Send redirect to paypal to browser
* *
* @param $paymentAmount * @param float $paymentAmount Amount
* @param $currencyCodeType * @param string $currencyCodeType Currency code
* @param $paymentType * @param string $paymentType Payment type
* @param $returnURL * @param string $returnURL Url to use if payment is OK
* @param $cancelURL * @param string $cancelURL Url to use if payment is KO
* @param $tag * @param string $tag Tag
* @return void
*/ */
function print_paypal_redirect($paymentAmount,$currencyCodeType,$paymentType,$returnURL,$cancelURL,$tag) function print_paypal_redirect($paymentAmount,$currencyCodeType,$paymentType,$returnURL,$cancelURL,$tag)
{ {
@ -295,8 +309,24 @@ function print_paypal_redirect($paymentAmount,$currencyCodeType,$paymentType,$re
} }
dol_syslog("expresscheckout redirect with CallSetExpressCheckout $paymentAmount, $currencyCodeType, $paymentType, $returnURL, $cancelURL, $tag, $landingPage, $solutionType, $shipToName, $shipToStreet, $shipToCity, $shipToState, $shipToCountryCode, $shipToZip, $shipToStreet2, $phoneNum"); dol_syslog("expresscheckout redirect with CallSetExpressCheckout $paymentAmount, $currencyCodeType, $paymentType, $returnURL, $cancelURL, $tag, $landingPage, $solutionType, $shipToName, $shipToStreet, $shipToCity, $shipToState, $shipToCountryCode, $shipToZip, $shipToStreet2, $phoneNum");
$resArray = CallSetExpressCheckout ($paymentAmount, $currencyCodeType, $paymentType, $returnURL, $cancelURL, $tag, $solutionType, $landingPage, $resArray = CallSetExpressCheckout(
$shipToName, $shipToStreet, $shipToCity, $shipToState, $shipToCountryCode, $shipToZip, $shipToStreet2, $phoneNum); $paymentAmount,
$currencyCodeType,
$paymentType,
$returnURL,
$cancelURL,
$tag,
$solutionType,
$landingPage,
$shipToName,
$shipToStreet,
$shipToCity,
$shipToState,
$shipToCountryCode,
$shipToZip,
$shipToStreet2,
$phoneNum
);
/* For direct payment with credit card /* For direct payment with credit card
{ {
//$resArray = DirectPayment (...); //$resArray = DirectPayment (...);
@ -349,8 +379,7 @@ function print_paypal_redirect($paymentAmount,$currencyCodeType,$paymentType,$re
' phoneNum: the phoneNum entered on the merchant's site ' phoneNum: the phoneNum entered on the merchant's site
'-------------------------------------------------------------------------------------------------------------------------------------------- '--------------------------------------------------------------------------------------------------------------------------------------------
*/ */
function CallSetExpressCheckout( $paymentAmount, $currencyCodeType, $paymentType, $returnURL, $cancelURL, $tag, $solutionType, $landingPage, function CallSetExpressCheckout($paymentAmount, $currencyCodeType, $paymentType, $returnURL, $cancelURL, $tag, $solutionType, $landingPage, $shipToName, $shipToStreet, $shipToCity, $shipToState, $shipToCountryCode, $shipToZip, $shipToStreet2, $phoneNum)
$shipToName, $shipToStreet, $shipToCity, $shipToState, $shipToCountryCode, $shipToZip, $shipToStreet2, $phoneNum)
{ {
//------------------------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------------------------
// Construct the parameter string that describes the SetExpressCheckout API call in the shortcut implementation // Construct the parameter string that describes the SetExpressCheckout API call in the shortcut implementation
@ -402,15 +431,10 @@ $shipToName, $shipToStreet, $shipToCity, $shipToState, $shipToCountryCode, $ship
return $resArray; return $resArray;
} }
/* /**
'------------------------------------------------------------------------------------------- * Prepares the parameters for the GetExpressCheckoutDetails API Call.
' Purpose: Prepares the parameters for the GetExpressCheckoutDetails API Call. *
' * @return array The NVP Collection object of the GetExpressCheckoutDetails Call Response.
' Inputs:
' None
' Returns:
' The NVP Collection object of the GetExpressCheckoutDetails Call Response.
'-------------------------------------------------------------------------------------------
*/ */
function GetDetails($token) function GetDetails($token)
{ {
@ -450,10 +474,10 @@ function GetDetails( $token )
} }
/* /**
'------------------------------------------------------------------------------------------------------------------------------------------- * Validate payment
' Purpose: Validate payment *
'-------------------------------------------------------------------------------------------------------------------------------------------- * @return void
*/ */
function ConfirmPayment($token, $paymentType, $currencyCodeType, $payerID, $ipaddress, $FinalPaymentAmt, $tag) function ConfirmPayment($token, $paymentType, $currencyCodeType, $payerID, $ipaddress, $FinalPaymentAmt, $tag)
{ {
@ -486,36 +510,26 @@ function ConfirmPayment( $token, $paymentType, $currencyCodeType, $payerID, $ipa
return $resArray; return $resArray;
} }
/* /**
'------------------------------------------------------------------------------------------------------------------------------------------- * This function makes a DoDirectPayment API call
' Purpose: This function makes a DoDirectPayment API call *
' * paymentType: paymentType has to be one of the following values: Sale or Order or Authorization
' Inputs: * paymentAmount: total value of the shopping cart
' paymentType: paymentType has to be one of the following values: Sale or Order or Authorization * currencyCode: currency code value the PayPal API
' paymentAmount: total value of the shopping cart * firstName: first name as it appears on credit card
' currencyCode: currency code value the PayPal API * lastName: last name as it appears on credit card
' firstName: first name as it appears on credit card * street: buyer's street address line as it appears on credit card
' lastName: last name as it appears on credit card * city: buyer's city
' street: buyer's street address line as it appears on credit card * state: buyer's state
' city: buyer's city * countryCode: buyer's country code
' state: buyer's state * zip: buyer's zip
' countryCode: buyer's country code * creditCardType: buyer's credit card type (i.e. Visa, MasterCard ... )
' zip: buyer's zip * creditCardNumber: buyers credit card number without any spaces, dashes or any other characters
' creditCardType: buyer's credit card type (i.e. Visa, MasterCard ... ) * expDate: credit card expiration date
' creditCardNumber: buyers credit card number without any spaces, dashes or any other characters * cvv2: Card Verification Value
' expDate: credit card expiration date * @return array The NVP Collection object of the DoDirectPayment Call Response.
' cvv2: Card Verification Value
'
'-------------------------------------------------------------------------------------------
'
' Returns:
' The NVP Collection object of the DoDirectPayment Call Response.
'--------------------------------------------------------------------------------------------------------------------------------------------
*/ */
function DirectPayment($paymentType, $paymentAmount, $creditCardType, $creditCardNumber, $expDate, $cvv2, $firstName, $lastName, $street, $city, $state, $zip, $countryCode, $currencyCode, $tag)
function DirectPayment( $paymentType, $paymentAmount, $creditCardType, $creditCardNumber,
$expDate, $cvv2, $firstName, $lastName, $street, $city, $state, $zip,
$countryCode, $currencyCode, $tag )
{ {
//declaring of global variables //declaring of global variables
global $conf, $langs; global $conf, $langs;
@ -547,8 +561,9 @@ $countryCode, $currencyCode, $tag )
/** /**
* hash_call: Function to perform the API call to PayPal using API signature * hash_call: Function to perform the API call to PayPal using API signature
* @param methodName is name of API method. *
* @param nvpStr is nvp string. * @param string $methodName is name of API method.
* @param string $nvpStr is nvp string.
* @return array returns an associtive array containing the response from the server. * @return array returns an associtive array containing the response from the server.
*/ */
function hash_call($methodName,$nvpStr) function hash_call($methodName,$nvpStr)
@ -651,6 +666,8 @@ function hash_call($methodName,$nvpStr)
/** /**
* Get API errors * Get API errors
*
* @return array Array of errors
*/ */
function GetApiError() function GetApiError()
{ {
@ -672,12 +689,13 @@ function GetApiError()
} }
/*'---------------------------------------------------------------------------------- /**
* This function will take NVPString and convert it to an Associative Array and it will decode the response. * This function will take NVPString and convert it to an Associative Array and it will decode the response.
* It is usefull to search for a particular key and displaying arrays. * It is usefull to search for a particular key and displaying arrays.
* @nvpstr is NVPString. *
* @nvpArray is Associative Array. * @param string $nvpstr NVPString
---------------------------------------------------------------------------------- * @return array nvpArray = Associative Array
* ----------------------------------------------------------------------------------
*/ */
function deformatNVP($nvpstr) function deformatNVP($nvpstr)
{ {