This commit is contained in:
Laurent Destailleur
2011-07-04 08:38:51 +00:00
parent 2660682956
commit 872c5a623c
7 changed files with 137 additions and 128 deletions

View File

@@ -27,17 +27,17 @@ include_once(DOL_DOCUMENT_ROOT.'/lib/price.lib.php');
class Facturation {
/**
* Attributs "volatiles" : reinitialises apres chaque traitement d'un article
* <p>Attributs "volatiles" : reinitialises apres chaque traitement d'un article</p>
* @var int $id => 'rowid' du produit dans llx_product
* @var string $ref => 'ref' du produit dans llx_product
* @var int $qte => Quantite pour le produit en cours de traitement
* @var int $stock => Stock theorique pour le produit en cours de traitement
* @var int $remise_percent => Remise en pourcent sur le produit en cours
* @var int $montant_remise => Remise en pourcent sur le produit en cours
* @var int $prix => Prix HT du produit en cours
* @var int $tva => 'rowid' du taux de tva dans llx_c_tva
*/
* Attributs "volatiles" : reinitialises apres chaque traitement d'un article
* <p>Attributs "volatiles" : reinitialises apres chaque traitement d'un article</p>
* int $id => 'rowid' du produit dans llx_product
* string $ref => 'ref' du produit dans llx_product
* int $qte => Quantite pour le produit en cours de traitement
* int $stock => Stock theorique pour le produit en cours de traitement
* int $remise_percent => Remise en pourcent sur le produit en cours
* int $montant_remise => Remise en pourcent sur le produit en cours
* int $prix => Prix HT du produit en cours
* int $tva => 'rowid' du taux de tva dans llx_c_tva
*/
var $id;
protected $ref;
protected $qte;
@@ -48,17 +48,17 @@ class Facturation {
protected $tva;
/**
* Attributs persistants : utilises pour toute la duree de la vente (jusqu'a validation ou annulation)
* @var string $num_facture => Numero de la facture (de la forme FAYYMM-XXXX)
* @var string $mode_reglement => Mode de reglement (ESP, CB ou CHQ)
* @var int $montant_encaisse => Montant encaisse en cas de reglement en especes
* @var int $montant_rendu => Monnaie rendue en cas de reglement en especes
* @var int $paiement_le => Date de paiement en cas de paiement differe
*
* @var int $prix_total_ht => Prix total hors taxes
* @var int $montant_tva => Montant total de la TVA, tous taux confondus
* @var int $prix_total_ttc => Prix total TTC
*/
* Attributs persistants : utilises pour toute la duree de la vente (jusqu'a validation ou annulation)
* string $num_facture => Numero de la facture (de la forme FAYYMM-XXXX)
* string $mode_reglement => Mode de reglement (ESP, CB ou CHQ)
* int $montant_encaisse => Montant encaisse en cas de reglement en especes
* int $montant_rendu => Monnaie rendue en cas de reglement en especes
* int $paiement_le => Date de paiement en cas de paiement differe
*
* int $prix_total_ht => Prix total hors taxes
* int $montant_tva => Montant total de la TVA, tous taux confondus
* int $prix_total_ttc => Prix total TTC
*/
protected $num_facture;
protected $mode_reglement;
protected $montant_encaisse;
@@ -82,9 +82,9 @@ class Facturation {
// Methodes de traitement des donnees
/**
* \brief Ajout d'un article au panier
*/
/**
* Ajout d'un article au panier
*/
public function ajoutArticle()
{
global $db;
@@ -96,7 +96,7 @@ class Facturation {
dol_syslog("ajoutArticle sql=".$sql);
$resql = $db->query($sql);
if ($resql)
if ($resql)
{
$obj = $db->fetch_object($resql);
$vat_rate=$obj->taux;
@@ -156,10 +156,10 @@ class Facturation {
}
/**
* Suppression du panier d'un article identifie par son id dans la table llx_pos_tmp
* @param aArticle
*/
/**
* Suppression du panier d'un article identifie par son id dans la table llx_pos_tmp
* @param aArticle
*/
public function supprArticle($aArticle)
{
global $db;
@@ -172,9 +172,9 @@ class Facturation {
}
/**
* \brief Calcul du total HT, total TTC et montants TVA
*/
/**
* \brief Calcul du total HT, total TTC et montants TVA
*/
public function calculTotaux()
{
global $db;
@@ -234,7 +234,7 @@ class Facturation {
}
/**
* Reinitialisation des attributs persistants
* Reinitialisation des attributs persistants
*/
public function raz_pers ()
{
@@ -300,10 +300,10 @@ class Facturation {
}
/**
* Getter for qte
* @param $aQte
* @return
*/
* Getter for qte
* @param $aQte
* @return
*/
public function qte ( $aQte=null ) {
if ( !$aQte ) {
@@ -322,11 +322,11 @@ class Facturation {
}
/**
* Getter for stock
* @param aStock
* @return
*/
/**
* Getter for stock
* @param aStock
* @return
*/
public function stock ( $aStock=null )
{
@@ -347,10 +347,10 @@ class Facturation {
}
/**
* Getter for remise_percent
* @param aRemisePercent
* @return
*/
* Getter for remise_percent
* @param aRemisePercent
* @return
*/
public function remise_percent ( $aRemisePercent=null )
{
@@ -371,10 +371,10 @@ class Facturation {
}
/**
* Getter for montant_remise
* @param aMontantRemise
* @return
*/
* Getter for montant_remise
* @param aMontantRemise
* @return
*/
public function montant_remise ( $aMontantRemise=null ) {
if ( !$aMontantRemise ) {
@@ -394,10 +394,10 @@ class Facturation {
}
/**
* Getter for prix
* @param aPrix
* @return
*/
* Getter for prix
* @param aPrix
* @return
*/
public function prix ( $aPrix=null )
{
@@ -417,11 +417,11 @@ class Facturation {
}
/**
* Getter for tva
* @param aTva
* @return
*/
/**
* Getter for tva
* @param aTva
* @return
*/
public function tva ( $aTva=null )
{

View File

@@ -17,10 +17,10 @@
*/
/**
* \file /paypal/inc/triggers/interface_modPaypal_PaypalWorkflow.class.php
* \file /htdocs/includes/triggers/interface_modPaypal_PaypalWorkflow.class.php
* \ingroup paypal
* \brief Trigger file for paypal workflow
* \version $Id$
* \version $Id: interface_modPaypal_PaypalWorkflow.class.php,v 1.6 2011/07/04 08:38:51 eldy Exp $
*/

View File

@@ -24,7 +24,7 @@
* \file htdocs/lib/company.lib.php
* \brief Ensemble de fonctions de base pour le module societe
* \ingroup societe
* \version $Id: company.lib.php,v 1.121 2011/07/04 08:00:52 eldy Exp $
* \version $Id: company.lib.php,v 1.122 2011/07/04 08:38:51 eldy Exp $
*/
/**
@@ -212,7 +212,7 @@ function societe_admin_prepare_head($object)
* @param id Id or code of country
* @param withcode 0=Return label, 1=Return code + label, 2=Return code from id, 3=Return id from code
* @param dbtouse Database handler (using in global way may fail because of conflicts with some autoload features)
* @param outputlangs Lang object for output translation
* @param outputlangs Langs object for output translation
* @param entconv 0=Return value without entities and not converted to output charset
* @return string String with country code or translated country name
*/
@@ -369,7 +369,7 @@ function getFormeJuridiqueLabel($code)
/**
* Show html area for list of projects
* @param conf Object conf
* @param lang Object lang
* @param langs Object langs
* @param db Database handler
* @param object Third party object
* @param backtopage Url to go once contact is created
@@ -466,7 +466,7 @@ function show_projects($conf,$langs,$db,$object,$backtopage='')
/**
* Show html area for list of contacts
* @param conf Object conf
* @param lang Object lang
* @param langs Object langs
* @param db Database handler
* @param object Third party object
* @param backtopage Url to go once contact is created
@@ -940,7 +940,7 @@ function show_actions_done($conf,$langs,$db,$object,$objcon='',$noprint=0)
/**
* Show html area for list of subsidiaries
* @param conf Object conf
* @param lang Object lang
* @param langs Object langs
* @param db Database handler
* @param object Third party object
*/

View File

@@ -22,7 +22,7 @@
/**
* \file htdocs/lib/date.lib.php
* \brief Set of function to manipulate dates
* \version $Id$
* \version $Id: date.lib.php,v 1.32 2011/07/04 08:38:51 eldy Exp $
*/
@@ -242,6 +242,7 @@ function dol_get_next_month($month, $year)
/** Return previous week
* @param day Day
* @param week Week
* @param month Month
* @param year Year
* @return array Previous year,month,day
*/
@@ -258,6 +259,7 @@ function dol_get_prev_week($day, $week, $month, $year)
/** Return next week
* @param day Day
* @param week Week
* @param month Month
* @param year Year
* @return array Next year,month,day
*/

View File

@@ -29,7 +29,7 @@
* \file htdocs/lib/functions.lib.php
* \brief A set of functions for Dolibarr
* This file contains all frequently used functions.
* \version $Id: functions.lib.php,v 1.535 2011/07/04 07:28:36 eldy Exp $
* \version $Id: functions.lib.php,v 1.536 2011/07/04 08:38:51 eldy Exp $
*/
// For compatibility during upgrade
@@ -321,7 +321,7 @@ function dol_escape_js($stringtoescape)
/**
* Returns text escaped for inclusion in HTML alt or title tags
* @param $stringtoescape String to escape
* @param $keepb Do not clean <b> tags
* @param $keepb Do not clean b tags
* @return string Escaped string
*/
function dol_escape_htmltag($stringtoescape,$keepb=0)
@@ -807,6 +807,7 @@ function dolibarr_mktime($hour,$minute,$second,$month,$day,$year,$gm=false,$chec
* @param year Year
* @param gm 1=Input informations are GMT values, otherwise local to server TZ
* @param check 0=No check on parameters (Can use day 32, etc...)
* @param isdst Dayling saving time
* @return timestamp Date as a timestamp, '' if error
* @see dol_print_date, dol_stringtotime
*/
@@ -921,11 +922,11 @@ function dol_print_size($size,$shortvalue=0,$shortunit=0)
}
/**
* \brief Show Url link
* \param url Url to show
* \param target Target for link
* \param max Max number of characters to show
* \return string HTML Link
* Show Url link
* @param url Url to show
* @param target Target for link
* @param max Max number of characters to show
* @return string HTML Link
*/
function dol_print_url($url,$target='_blank',$max=32)
{
@@ -942,14 +943,14 @@ function dol_print_url($url,$target='_blank',$max=32)
}
/**
* \brief Show EMail link
* \param email EMail to show (only email, without <Name of recipient>)
* \param cid Id of contact if known
* \param socid Id of third party if known
* \param addlink 0=no link to create action
* \param max Max number of characters to show
* \param showinvalid Show warning if syntax email is wrong
* \return string HTML Link
* Show EMail link
* @param email EMail to show (only email, without 'Name of recipient' before)
* @param cid Id of contact if known
* @param socid Id of third party if known
* @param addlink 0=no link to create action
* @param max Max number of characters to show
* @param showinvalid Show warning if syntax email is wrong
* @return string HTML Link
*/
function dol_print_email($email,$cid=0,$socid=0,$addlink=0,$max=64,$showinvalid=1)
{
@@ -1539,7 +1540,7 @@ function dol_trunc($string,$size=40,$trunc='right',$stringencoding='UTF-8')
/**
* Show a picto according to module/object (generic function)
* Show a picto according to module or object (generic function)
* @param alt Text of alt on image
* @param object Objet pour lequel il faut afficher le logo (example: user, group, action, bill, contract, propal, product, ...)
* Pour les modules externe utiliser nomimage@mymodule pour rechercher dans le repertoire "img" du module
@@ -1720,6 +1721,7 @@ function img_edit_remove($alt = "default")
* Affiche logo editer/modifier fiche
* @param alt Texte sur le alt de l'image
* @param float Si il faut y mettre le style "float: right"
* @param other Add more attributes on img
* @return string Retourne tag img
*/
function img_edit($alt = "default", $float=0, $other='')
@@ -1737,6 +1739,7 @@ function img_edit($alt = "default", $float=0, $other='')
* Affiche logo voir fiche
* @param alt Texte sur le alt de l'image
* @param float Si il faut y mettre le style "float: right"
* @param other Add more attributes on img
* @return string Retourne tag img
*/
function img_view($alt = "default", $float=0, $other='')
@@ -1957,6 +1960,7 @@ function img_tick($alt = "default")
/**
* Affiche le logo tick si allow
* @param allow Authorise ou non
* @param alt Alt text for img
* @return string Retourne tag img
*/
function img_allow($allow,$alt='default')
@@ -2000,20 +2004,20 @@ function img_mime($file,$alt='')
* @param infoonimgalt Info is shown only on alt of star picto, otherwise it is show on output after the star picto
* @return string String with info text
*/
function info_admin($texte,$infoonimgalt=0)
function info_admin($text,$infoonimgalt=0)
{
global $conf,$langs;
$s='';
if ($infoonimgalt)
{
$s.=img_picto($texte,'star');
$s.=img_picto($text,'star');
}
else
{
$s.='<div class="info">';
$s.=img_picto($langs->trans("InfoAdmin"),'star');
$s.=' ';
$s.=$texte;
$s.=$text;
$s.='</div>';
}
return $s;
@@ -2783,7 +2787,7 @@ function print_fleche_navigation($page,$file,$options='',$nextpage,$betweenarrow
* Fonction qui retourne un taux de tva formate pour visualisation
* Utilisee dans les pdf et les pages html
* @param rate Rate value to format (19.6 19,6 19.6% 19,6%,...)
* @param foundpercent Add a percent % sign in output
* @param addpercent Add a percent % sign in output
* @param info_bits Miscellanous information on vat
* @return string Chaine avec montant formate (19,6 ou 19,6% ou 8.5% *)
*/
@@ -3356,7 +3360,7 @@ function dol_string_nohtmltag($StringHtml,$removelinefeed=1)
/**
* Replace CRLF in string with a HTML BR tag.
* @param string2encode String to encode
* @param stringtoencode String to encode
* @param nl2brmode 0=Adding br before \n, 1=Replacing \n by br
* @param forxml false=Use <br>, true=Use <br />
* @return string String encoded
@@ -3416,6 +3420,7 @@ function dol_htmlentitiesbr($stringtoencode,$nl2brmode=0,$pagecodefrom='UTF-8')
/**
* This function is called to decode a HTML string (it decodes entities and br tags)
* @param stringtodecode String to decode
* @param pagecodeto Page code for result
*/
function dol_htmlentitiesbr_decode($stringtodecode,$pagecodeto='UTF-8')
{
@@ -3520,17 +3525,17 @@ function dol_nboflines($s,$maxchar=0)
* Return nb of lines of a formated text with \n and <br>
* @param texte Text
* @param maxlinesize Largeur de ligne en caracteres (ou 0 si pas de limite - defaut)
* @param charset Give the charset used to encode the $texte variable in memory.
* @param charset Give the charset used to encode the $text variable in memory.
* @return int Number of lines
*/
function dol_nboflines_bis($texte,$maxlinesize=0,$charset='UTF-8')
function dol_nboflines_bis($text,$maxlinesize=0,$charset='UTF-8')
{
//print $texte;
//print $text;
$repTable = array("\t" => " ", "\n" => "<br>", "\r" => " ", "\0" => " ", "\x0B" => " ");
$texte = strtr($texte, $repTable);
$text = strtr($text, $repTable);
if ($charset == 'UTF-8') { $pattern = '/(<[^>]+>)/Uu'; } // /U is to have UNGREEDY regex to limit to one html tag. /u is for UTF8 support
else $pattern = '/(<[^>]+>)/U'; // /U is to have UNGREEDY regex to limit to one html tag.
$a = preg_split($pattern, $texte, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
$a = preg_split($pattern, $text, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
$nblines = floor((count($a)+1)/2);
// count possible auto line breaks
if($maxlinesize)
@@ -3602,6 +3607,7 @@ function dol_textishtml($msg,$option=0)
* - From $substitutionarray (oldval=>newval)
* - 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
* @return string Output string after subsitutions
*/
function make_substitutions($chaine,$substitutionarray)
@@ -3656,6 +3662,7 @@ function complete_substitutions_array(&$substitutionarray,$outputlangs,$object='
* @param date_start Start date
* @param date_end End date
* @param format Output format
* @param outputlangs Output language
*/
function print_date_range($date_start,$date_end,$format = '',$outputlangs='')
{
@@ -3667,6 +3674,7 @@ function print_date_range($date_start,$date_end,$format = '',$outputlangs='')
* @param date_start Start date
* @param date_end End date
* @param format Output format
* @param outputlangs Output language
*/
function get_date_range($date_start,$date_end,$format = '',$outputlangs='')
{
@@ -3883,7 +3891,7 @@ function dol_htmloutput_mesg($mesgstring='',$mesgarray='', $style='ok', $keepemb
* Print formated error messages to output (Used to show messages on html output)
* @param mesgstring Error message
* @param mesgarray Error messages array
* @return keepembedded Set to 1 in error message must be kept embedded into its html place (this disable jnotify)
* @param keepembedded Set to 1 in error message must be kept embedded into its html place (this disable jnotify)
* @see dol_print_error
* @see dol_htmloutput_mesg
*/
@@ -3927,7 +3935,7 @@ function dol_sort_array(&$array, $index, $order='asc', $natsort, $case_sensitive
/**
* Check if a string is in UTF8
* @param $Str String to check
* @param $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)
*/
function utf8_check($str)

View File

@@ -22,7 +22,7 @@
* \file htdocs/lib/functions2.lib.php
* \brief A set of functions for Dolibarr
* This file contains all rare functions.
* \version $Id$
* \version $Id: functions2.lib.php,v 1.75 2011/07/04 08:38:51 eldy Exp $
*/
@@ -632,10 +632,8 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m
/**
* Check value
*
* @param $db Database handler
* @param $mask Mask to use
* @param $value
* @param $value Value
* @return int <0 if KO, 0 if OK
*/
function check_value($mask,$value)
@@ -723,11 +721,11 @@ function check_value($mask,$value)
/**
* \brief Convert a binary data to string that represent hexadecimal value
* \param bin Value to convert
* \param pad Add 0
* \param upper Convert to tupper
* \return string x
* Convert a binary data to string that represent hexadecimal value
* @param bin Value to convert
* @param pad Add 0
* @param upper Convert to tupper
* @return string x
*/
function binhex($bin, $pad=false, $upper=false)
{
@@ -741,9 +739,9 @@ function binhex($bin, $pad=false, $upper=false)
/**
* \brief Convertir de l'hexadecimal en binaire
* \param string hexa
* \return string bin
* Convert an hexadecimal string into a binary string
* @param hexa Hexadecimal string to convert (example: 'FF')
* @return string bin
*/
function hexbin($hexa)
{
@@ -757,9 +755,9 @@ function hexbin($hexa)
/**
* \brief Retourne le numero de la semaine par rapport a une date
* \param time Date au format 'timestamp'
* \return int Numero de semaine
* Retourne le numero de la semaine par rapport a une date
* @param time Date au format 'timestamp'
* @return int Numero de semaine
*/
function numero_semaine($time)
{
@@ -838,11 +836,11 @@ function numero_semaine($time)
/**
* \brief Convertit une masse d'une unite vers une autre unite
* \param weight float Masse a convertir
* \param from_unit int Unite originale en puissance de 10
* \param to_unit int Nouvelle unite en puissance de 10
* \return float Masse convertie
* Convertit une masse d'une unite vers une autre unite
* @param weight float Masse a convertir
* @param from_unit int Unite originale en puissance de 10
* @param to_unit int Nouvelle unite en puissance de 10
* @return float Masse convertie
*/
function weight_convert($weight,&$from_unit,$to_unit)
{
@@ -872,11 +870,12 @@ function weight_convert($weight,&$from_unit,$to_unit)
/**
* \brief Save personnal parameter
* \param db Handler database
* \param user Object user
* \param tab Tableau (cle=>valeur) des parametres a sauvegarder
* \return int <0 if KO, >0 if OK
* Save personnal parameter
* @param db Handler database
* @param conf Object conf
* @param user Object user
* @param tab Tableau (cle=>valeur) des parametres a sauvegarder
* @return int <0 if KO, >0 if OK
*/
function dol_set_user_param($db, $conf, &$user, $tab)
{
@@ -936,9 +935,10 @@ function dol_set_user_param($db, $conf, &$user, $tab)
/**
* \brief Returns formated reduction
* \param reduction Reduction percentage
* \return string Formated reduction
* Returns formated reduction
* @param reduction Reduction percentage
* @param langs Output language
* @return string Formated reduction
*/
function dol_print_reduction($reduction=0,$langs)
{

View File

@@ -21,17 +21,16 @@
* \file htdocs/lib/functions_ch.lib.php
* \brief A set of swiss functions for Dolibarr
* This file contains rare functions.
* \version $Id$
* \version $Id: functions_ch.lib.php,v 1.3 2011/07/04 08:38:51 eldy Exp $
*/
/**
* Return if a BVRB number is valid or not (For switzerland)
*
* @param string BVRB number
* @param bvrb BVRB number
* @return bool True if OK, false if KO
*/
function dol_ch_controle_bvrb ($bvrb)
function dol_ch_controle_bvrb($bvrb)
{
// Init array for control
$tableau[0][0]=0;