Qual: Clean code

This commit is contained in:
Laurent Destailleur 2011-08-20 15:11:31 +00:00
parent 6916fdda32
commit 9f663d5677
17 changed files with 287 additions and 347 deletions

View File

@ -24,7 +24,7 @@
* \file htdocs/adherents/class/adherent.class.php * \file htdocs/adherents/class/adherent.class.php
* \ingroup member * \ingroup member
* \brief File of class to manage members of a foundation * \brief File of class to manage members of a foundation
* \version $Id: adherent.class.php,v 1.49 2011/08/10 22:47:33 eldy Exp $ * \version $Id: adherent.class.php,v 1.50 2011/08/20 15:11:31 eldy Exp $
*/ */
require_once(DOL_DOCUMENT_ROOT."/core/class/commonobject.class.php"); require_once(DOL_DOCUMENT_ROOT."/core/class/commonobject.class.php");
@ -57,9 +57,15 @@ class Adherent extends CommonObject
var $pass; var $pass;
var $societe; var $societe;
var $adresse; var $adresse;
var $address;
var $cp; var $cp;
var $zip;
var $ville; var $ville;
var $town;
var $state_id;
var $state_code;
var $state;
var $fk_departement; // Id of department var $fk_departement; // Id of department
var $departement_code; // Code of department var $departement_code; // Code of department
var $departement; // Label of department var $departement; // Label of department
@ -950,12 +956,17 @@ class Adherent extends CommonObject
$this->ville = $obj->town; // TODO deprecated $this->ville = $obj->town; // TODO deprecated
$this->town = $obj->town; $this->town = $obj->town;
$this->fk_departement = $obj->fk_departement; $this->state_id = $obj->fk_departement;
$this->departement_code = $obj->fk_departement?$obj->departement_code:''; $this->state_id = $obj->fk_departement?$obj->departement_code:'';
$this->departement = $obj->fk_departement?$obj->departement:''; $this->state_id = $obj->fk_departement?$obj->departement:'';
$this->fk_departement = $obj->fk_departement; // TODO deprecated
$this->departement_code = $obj->fk_departement?$obj->departement_code:''; // TODO deprecated
$this->departement = $obj->fk_departement?$obj->departement:''; // TODO deprecated
$this->pays_id = $obj->pays_id; $this->country_id = $obj->pays_id;
$this->pays_code = $obj->pays_code; $this->country_code = $obj->pays_code;
$this->pays_id = $obj->pays_id; // TODO deprecated
$this->pays_code = $obj->pays_code; // TODO deprecated
if ($langs->trans("Country".$obj->pays_code) != "Country".$obj->pays_code) $this->pays = $langs->trans("Country".$obj->pays_code); if ($langs->trans("Country".$obj->pays_code) != "Country".$obj->pays_code) $this->pays = $langs->trans("Country".$obj->pays_code);
elseif ($obj->pays_lib) $this->pays=$obj->pays_lib; elseif ($obj->pays_lib) $this->pays=$obj->pays_lib;
else $this->pays=$obj->pays; else $this->pays=$obj->pays;

View File

@ -22,7 +22,7 @@
* \file htdocs/adherents/fiche.php * \file htdocs/adherents/fiche.php
* \ingroup member * \ingroup member
* \brief Page of member * \brief Page of member
* \version $Id: fiche.php,v 1.241 2011/08/10 22:47:35 eldy Exp $ * \version $Id: fiche.php,v 1.242 2011/08/20 15:11:33 eldy Exp $
*/ */
require("../main.inc.php"); require("../main.inc.php");
@ -236,9 +236,10 @@ if ($_REQUEST["action"] == 'update' && ! $_POST["cancel"] && $user->rights->adhe
$object->zip = trim($_POST["zipcode"]); $object->zip = trim($_POST["zipcode"]);
$object->ville = trim($_POST["town"]); // deprecated $object->ville = trim($_POST["town"]); // deprecated
$object->town = trim($_POST["town"]); $object->town = trim($_POST["town"]);
$object->state_id = $_POST["departement_id"];
$object->fk_departement = $_POST["departement_id"]; $object->country_id = $_POST["pays_id"];
$object->pays_id = $_POST["pays_id"]; $object->fk_departement = $_POST["departement_id"]; // deprecated
$object->pays_id = $_POST["pays_id"]; // deprecated
$object->phone = trim($_POST["phone"]); $object->phone = trim($_POST["phone"]);
$object->phone_perso = trim($_POST["phone_perso"]); $object->phone_perso = trim($_POST["phone_perso"]);
@ -1526,5 +1527,5 @@ if ($rowid && $action != 'edit')
$db->close(); $db->close();
llxFooter('$Date: 2011/08/10 22:47:35 $ - $Revision: 1.241 $'); llxFooter('$Date: 2011/08/20 15:11:33 $ - $Revision: 1.242 $');
?> ?>

View File

@ -18,7 +18,7 @@
/** /**
* \file htdocs/asterisk/wrapper.php * \file htdocs/asterisk/wrapper.php
* \brief File that is entry point to call an Asterisk server * \brief File that is entry point to call an Asterisk server
* \version $Id: wrapper.php,v 1.9 2011/08/03 00:45:45 eldy Exp $ * \version $Id: wrapper.php,v 1.10 2011/08/20 15:11:32 eldy Exp $
* \remarks To be used, an Asterisk user must be created by adding this * \remarks To be used, an Asterisk user must be created by adding this
* in /etc/asterisk/manager.conf * in /etc/asterisk/manager.conf
* [dolibarr] * [dolibarr]
@ -76,7 +76,7 @@ $password = $_GET['password'];
$caller = $_GET['caller']; $caller = $_GET['caller'];
$called = $_GET['called']; $called = $_GET['called'];
# Adresse IP du serveur Asterisk # IP address of Asterisk server
$strHost = $conf->global->ASTERISK_HOST; $strHost = $conf->global->ASTERISK_HOST;
#Spécifiez le type d'extension par laquelle vous poste est connecte. #Spécifiez le type d'extension par laquelle vous poste est connecte.
#ex: SIP/, IAX2/, ZAP/, etc #ex: SIP/, IAX2/, ZAP/, etc

View File

@ -16,14 +16,14 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
* $Id: fiche.php,v 1.24 2011/08/03 00:45:44 eldy Exp $ * $Id: fiche.php,v 1.25 2011/08/20 15:11:33 eldy Exp $
*/ */
/** /**
\file htdocs/boutique/commande/fiche.php \file htdocs/boutique/commande/fiche.php
\ingroup boutique \ingroup boutique
\brief Page fiche commande OSCommerce \brief Page fiche commande OSCommerce
\version $Revision: 1.24 $ \version $Revision: 1.25 $
*/ */
require("../../main.inc.php"); require("../../main.inc.php");
@ -55,7 +55,7 @@ if ($_GET['id'])
print '<td width="20%">Paiement</td><td width="80%" colspan="2">'.$commande->payment_method.'</td></tr>'; print '<td width="20%">Paiement</td><td width="80%" colspan="2">'.$commande->payment_method.'</td></tr>';
print "<tr><td>Adresses</td><td>Livraison</td><td>Facturation</td></tr>"; print "<tr><td>".$langs->trans("Address")."</td><td>".$langs->trans("Delivery")."</td><td>".$langs->trans("Invoice")."</td></tr>";
print "<td>&nbsp;</td><td>".$commande->delivery_adr->name."<br>".$commande->delivery_adr->street."<br>".$commande->delivery_adr->cp."<br>".$commande->delivery_adr->city."<br>".$commande->delivery_adr->country."</td>"; print "<td>&nbsp;</td><td>".$commande->delivery_adr->name."<br>".$commande->delivery_adr->street."<br>".$commande->delivery_adr->cp."<br>".$commande->delivery_adr->city."<br>".$commande->delivery_adr->country."</td>";
print "<td>".$commande->billing_adr->name."<br>".$commande->billing_adr->street."<br>".$commande->billing_adr->cp."<br>".$commande->billing_adr->city."<br>".$commande->billing_adr->country."</td>"; print "<td>".$commande->billing_adr->name."<br>".$commande->billing_adr->street."<br>".$commande->billing_adr->cp."<br>".$commande->billing_adr->city."<br>".$commande->billing_adr->country."</td>";
@ -154,5 +154,5 @@ print '</table><br>';
$dbosc->close(); $dbosc->close();
llxFooter("<em>Derni&egrave;re modification $Date: 2011/08/03 00:45:44 $ r&eacute;vision $Revision: 1.24 $</em>"); llxFooter("<em>Derni&egrave;re modification $Date: 2011/08/20 15:11:33 $ r&eacute;vision $Revision: 1.25 $</em>");
?> ?>

View File

@ -1,100 +0,0 @@
<?php
/* Copyright (C) 2007-2008 Jeremie Ollivier <jeremie.o@laposte.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* 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, see <http://www.gnu.org/licenses/>.
*/
// Cr<43>ation al<61>atoire de chaines de caract<63>res de longueur $taille pass<73>e en argument
function rand_chaine ($taille) {
$tableau = '9632587410wqaxszcdevfrbgtnhyjukilompMPLOKIJUNHYBGTVFRCDEXSZWQA';
$chaine = '';
for ( $i = 0; $i < $taille; $i++ ) {
$indice = rand (0, 61);
$chaine .= $tableau[$indice];
}
return ($chaine);
}
// V<>rification du format d'une adresse email pass<73>e en argument
// Retour : 0 = pas d'erreur, 1 = format invalide
function verif_email ($email) {
$test_email1 = explode ('@',$email);
$test_email2 = explode ('.',$test_email1[1]);
if ( !$test_email1[0] | !$test_email2[0] | !$test_email2[1] ) {
return (1);
} else {
return (0);
}
}
// V<>rification du format d'une url (avec http://) email pass<73>e en argument
// 0 = pas d'erreur, 1 = format invalide
function verif_url ($url) {
$test_url1 = explode ('//',$url);
$test_url2 = explode ('.',$test_url1[1]);
if ( $test_url1[0] != 'http:' | !$test_url2[0] | !$test_url2[1] | !$test_url2[2] ) {
return (1);
} else {
return (0);
}
}
// V<>rifie que la chaine pass<73>e en argument ne comporte que des chiffres
// 0 = pas d'erreur, 1 = format invalide
function verif_num ($num) {
$err = 0;
$masque = '^[0-9]+$';
if ( ereg ($masque,$num) ) {
return (0);
} else {
return (1);
}
}
// Supprime tous les accents de la cha<68>ne pass<73>e en argument
function suppr_accents ($chaine) {
return( strtr( $chaine,
"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>",
"AAAAAAaaaaaaOOOOOOooooooEEEEeeeeCcIIIIiiiiUUUUuuuuyNn"
) );
}
?>

View File

@ -32,7 +32,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
/* position: relative; */ /* position: relative; */
} }
.adresse { .address {
/* float: left; */ /* float: left; */
font-size: 12px; font-size: 12px;
} }
@ -96,7 +96,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<?php print '<img src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=companylogo&amp;file='.urlencode('/thumbs/'.$mysoc->logo_small).'">'; ?> <?php print '<img src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=companylogo&amp;file='.urlencode('/thumbs/'.$mysoc->logo_small).'">'; ?>
</div> </div>
<div class="infos"> <div class="infos">
<p class="adresse"><?php echo $mysoc->name; ?><br> <p class="address"><?php echo $mysoc->name; ?><br>
<?php echo $mysoc->address; ?><br> <?php echo $mysoc->address; ?><br>
<?php echo $mysoc->zip.' '.$mysoc->town; ?></p> <?php echo $mysoc->zip.' '.$mysoc->town; ?></p>

View File

@ -20,8 +20,8 @@
/** /**
* \file htdocs/comm/address.php * \file htdocs/comm/address.php
* \ingroup societe * \ingroup societe
* \brief Onglet adresses d'un client * \brief Tab address of customer
* \version $Id: address.php,v 1.9 2011/08/03 00:46:27 eldy Exp $ * \version $Id: address.php,v 1.10 2011/08/20 15:11:32 eldy Exp $
*/ */
require("../main.inc.php"); require("../main.inc.php");
@ -169,7 +169,7 @@ if ($_GET["action"] == 'create' || $_POST["action"] == 'create')
if ($user->rights->societe->creer) if ($user->rights->societe->creer)
{ {
/* /*
* Fiche adresse en mode creation * Creation
*/ */
$address = new Address($db); $address = new Address($db);
@ -425,7 +425,7 @@ else
dol_fiche_head($head, 'customer', $societe->nom); dol_fiche_head($head, 'customer', $societe->nom);
// Confirmation de la suppression de l'adresse // Confirmation delete
if ($_GET["action"] == 'delete') if ($_GET["action"] == 'delete')
{ {
$html = new Form($db); $html = new Form($db);
@ -516,5 +516,5 @@ else
$db->close(); $db->close();
llxFooter('$Date: 2011/08/03 00:46:27 $ - $Revision: 1.9 $'); llxFooter('$Date: 2011/08/20 15:11:32 $ - $Revision: 1.10 $');
?> ?>

View File

@ -20,7 +20,7 @@
* \file htdocs/comm/mailing/fiche.php * \file htdocs/comm/mailing/fiche.php
* \ingroup mailing * \ingroup mailing
* \brief Fiche mailing, onglet general * \brief Fiche mailing, onglet general
* \version $Id: fiche.php,v 1.123 2011/08/03 00:46:33 eldy Exp $ * \version $Id: fiche.php,v 1.124 2011/08/20 15:11:32 eldy Exp $
*/ */
require("../../main.inc.php"); require("../../main.inc.php");
@ -157,7 +157,7 @@ if ($_REQUEST["action"] == 'sendallconfirmed' && $_REQUEST['confirm'] == 'yes')
dol_print_error($db); dol_print_error($db);
} }
// Boucle sur chaque adresse et envoie le mail // Loop on each email and send it
$i = 0; $i = 0;
while ($i < $num && $i < $conf->global->MAILING_LIMIT_SENDBYWEB) while ($i < $num && $i < $conf->global->MAILING_LIMIT_SENDBYWEB)
@ -1072,5 +1072,5 @@ else
$db->close(); $db->close();
llxFooter('$Date: 2011/08/03 00:46:33 $ - $Revision: 1.123 $'); llxFooter('$Date: 2011/08/20 15:11:32 $ - $Revision: 1.124 $');
?> ?>

View File

@ -29,7 +29,7 @@
* \author Rodolphe Qiedeville * \author Rodolphe Qiedeville
* \author Eric Seigne * \author Eric Seigne
* \author Laurent Destailleur * \author Laurent Destailleur
* \version $Id: propal.class.php,v 1.113 2011/08/10 22:47:35 eldy Exp $ * \version $Id: propal.class.php,v 1.114 2011/08/20 15:11:34 eldy Exp $
*/ */
require_once(DOL_DOCUMENT_ROOT ."/core/class/commonobject.class.php"); require_once(DOL_DOCUMENT_ROOT ."/core/class/commonobject.class.php");
@ -745,7 +745,7 @@ class Propal extends CommonObject
$result=$this->db->query($sql); $result=$this->db->query($sql);
} }
// Affectation de l'adresse de livraison // Set delivery address
if (! $error && $this->fk_delivery_address) if (! $error && $this->fk_delivery_address)
{ {
$sql = "UPDATE ".MAIN_DB_PREFIX."propal"; $sql = "UPDATE ".MAIN_DB_PREFIX."propal";
@ -1260,9 +1260,9 @@ class Propal extends CommonObject
} }
/** /**
* \brief Definit une adresse de livraison * \brief Define delivery address
* \param user Objet utilisateur qui modifie * \param user Objet utilisateur qui modifie
* \param adresse_livraison Adresse de livraison * \param fk_address Delivery address id
* \return int <0 si ko, >0 si ok * \return int <0 si ko, >0 si ok
*/ */
function set_adresse_livraison($user, $fk_address) function set_adresse_livraison($user, $fk_address)

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -20,7 +20,7 @@
* \file htdocs/contact/perso.php * \file htdocs/contact/perso.php
* \ingroup societe * \ingroup societe
* \brief Onglet informations personnelles d'un contact * \brief Onglet informations personnelles d'un contact
* \version $Id: perso.php,v 1.65 2011/07/31 23:54:12 eldy Exp $ * \version $Id: perso.php,v 1.66 2011/08/20 15:11:32 eldy Exp $
*/ */
require("../main.inc.php"); require("../main.inc.php");
@ -70,6 +70,8 @@ if ($user->rights->societe->contact->creer)
* View * View
*/ */
$now=dol_now();
llxHeader('',$langs->trans("ContactsAddresses"),'EN:Module_Third_Parties|FR:Module_Tiers|ES:M&oacute;dulo_Empresas'); llxHeader('',$langs->trans("ContactsAddresses"),'EN:Module_Third_Parties|FR:Module_Tiers|ES:M&oacute;dulo_Empresas');
$form = new Form($db); $form = new Form($db);
@ -198,11 +200,24 @@ else
// Date To Birth // Date To Birth
if ($contact->birthday != '') if ($contact->birthday != '')
{ {
include_once(DOL_DOCUMENT_ROOT.'/lib/date.lib.php');
print '<tr><td>'.$langs->trans("DateToBirth").'</td><td colspan="3">'.dol_print_date($contact->birthday,"day"); print '<tr><td>'.$langs->trans("DateToBirth").'</td><td colspan="3">'.dol_print_date($contact->birthday,"day");
print ' (';
print ' &nbsp; ';
//var_dump($birthdatearray);
//print ($now-$birthdate).' - '.ConvertSecondToTime($now-$birthdate,'year').'<br>';
$ageyear=ConvertSecondToTime($now-$contact->birthday,'year')-1970;
$agemonth=ConvertSecondToTime($now-$contact->birthday,'month')-1;
if ($ageyear >= 2) print '('.$ageyear.' '.$langs->trans("DurationYears").')';
else if ($agemonth >= 2) print '('.$agemonth.' '.$langs->trans("DurationMonths").')';
else print '('.$agemonth.' '.$langs->trans("DurationMonth").')';
print ' &nbsp; - &nbsp; ';
if ($contact->birthday_alert) print $langs->trans("BirthdayAlertOn"); if ($contact->birthday_alert) print $langs->trans("BirthdayAlertOn");
else print $langs->trans("BirthdayAlertOff"); else print $langs->trans("BirthdayAlertOff");
print ')</td>'; print '</td>';
} }
else else
{ {
@ -232,5 +247,5 @@ else
$db->close(); $db->close();
llxFooter('$Date: 2011/07/31 23:54:12 $ - $Revision: 1.65 $'); llxFooter('$Date: 2011/08/20 15:11:32 $ - $Revision: 1.66 $');
?> ?>

View File

@ -21,7 +21,7 @@
* \file htdocs/core/class/commonobject.class.php * \file htdocs/core/class/commonobject.class.php
* \ingroup core * \ingroup core
* \brief File of parent class of all other business classes (invoices, contracts, proposals, orders, ...) * \brief File of parent class of all other business classes (invoices, contracts, proposals, orders, ...)
* \version $Id: commonobject.class.php,v 1.156 2011/08/14 03:13:50 eldy Exp $ * \version $Id: commonobject.class.php,v 1.157 2011/08/20 15:11:31 eldy Exp $
*/ */
@ -529,8 +529,8 @@ class CommonObject
} }
/** /**
* Charge l'adresse d'id $this->fk_address dans this->address * Load delivery adresse id into $this->fk_address
* @param fk_address Id de l'adresse * @param fk_address Id of address
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function fetch_address($fk_address) function fetch_address($fk_address)

View File

@ -31,7 +31,7 @@
* \file htdocs/core/class/html.form.class.php * \file htdocs/core/class/html.form.class.php
* \ingroup core * \ingroup core
* \brief File of class with all html predefined components * \brief File of class with all html predefined components
* \version $Id: html.form.class.php,v 1.201 2011/08/20 13:18:54 eldy Exp $ * \version $Id: html.form.class.php,v 1.202 2011/08/20 15:11:32 eldy Exp $
*/ */
@ -1395,7 +1395,7 @@ class Form
} }
/** /**
* Retourne la liste deroulante des adresses * Return list of delivery address
* @param selected Id contact pre-selectionn * @param selected Id contact pre-selectionn
* @param socid * @param socid
* @param htmlname Name of HTML field * @param htmlname Name of HTML field

View File

@ -21,7 +21,7 @@
/** /**
* \file htdocs/lib/date.lib.php * \file htdocs/lib/date.lib.php
* \brief Set of function to manipulate dates * \brief Set of function to manipulate dates
* \version $Id: date.lib.php,v 1.34 2011/08/17 16:08:49 eldy Exp $ * \version $Id: date.lib.php,v 1.35 2011/08/20 15:11:31 eldy Exp $
*/ */
@ -95,7 +95,7 @@ function ConvertTime2Seconds($iHours=0,$iMinutes=0,$iSeconds=0)
/** Return, in clear text, value of a number of seconds in days, hours and minutes /** Return, in clear text, value of a number of seconds in days, hours and minutes
* @param iSecond Number of seconds * @param iSecond Number of seconds
* @param format Output format (all: complete display, hour: displays only hours, min: displays only minutes, sec: displays only seconds) * @param format Output format (all: complete display, hour: displays only hours, min: displays only minutes, sec: displays only seconds, month: display month only, year: displays only year);
* @param lengthOfDay Length of day (default 86400 seconds for 1 day, 28800 for 8 hour) * @param lengthOfDay Length of day (default 86400 seconds for 1 day, 28800 for 8 hour)
* @param lengthOfWeek Length of week (default 7) * @param lengthOfWeek Length of week (default 7)
* @return sTime Formated text of duration * @return sTime Formated text of duration
@ -166,6 +166,14 @@ function ConvertSecondToTime($iSecond,$format='all',$lengthOfDay=86400,$lengthOf
{ {
$sTime=dol_print_date($iSecond,'%S',true); $sTime=dol_print_date($iSecond,'%S',true);
} }
else if ($format == 'month')
{
$sTime=dol_print_date($iSecond,'%m',true);
}
else if ($format == 'year')
{
$sTime=dol_print_date($iSecond,'%Y',true);
}
return trim($sTime); return trim($sTime);
} }

View File

@ -28,7 +28,7 @@
* \file htdocs/lib/functions.lib.php * \file htdocs/lib/functions.lib.php
* \brief A set of functions for Dolibarr * \brief A set of functions for Dolibarr
* This file contains all frequently used functions. * This file contains all frequently used functions.
* \version $Id: functions.lib.php,v 1.560 2011/08/20 09:03:38 hregis Exp $ * \version $Id: functions.lib.php,v 1.561 2011/08/20 15:11:31 eldy Exp $
*/ */
// For compatibility during upgrade // For compatibility during upgrade
@ -828,8 +828,8 @@ function dolibarr_mktime($hour,$minute,$second,$month,$day,$year,$gm=false,$chec
* @param hour Hour (can be -1 for undefined) * @param hour Hour (can be -1 for undefined)
* @param minute Minute (can be -1 for undefined) * @param minute Minute (can be -1 for undefined)
* @param second Second (can be -1 for undefined) * @param second Second (can be -1 for undefined)
* @param month Month * @param month Month (1 to 12)
* @param day Day * @param day Day (1 to 31)
* @param year Year * @param year Year
* @param gm 1=Input informations are GMT values, otherwise local to server TZ * @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 check 0=No check on parameters (Can use day 32, etc...)

View File

@ -21,7 +21,7 @@
* \file htdocs/public/members/new.php * \file htdocs/public/members/new.php
* \ingroup member * \ingroup member
* \brief Example of form to add a new member * \brief Example of form to add a new member
* \version $Id: new.php,v 1.43 2011/07/31 23:23:21 eldy Exp $ * \version $Id: new.php,v 1.44 2011/08/20 15:11:33 eldy Exp $
* *
* Note that you can add following constant to change behaviour of page * Note that you can add following constant to change behaviour of page
* MEMBER_NEWFORM_AMOUNT Default amount for autosubscribe form * MEMBER_NEWFORM_AMOUNT Default amount for autosubscribe form
@ -203,9 +203,12 @@ if ($action == 'add')
$adh->nom = $_POST["nom"]; $adh->nom = $_POST["nom"];
$adh->civilite_id = $_POST["civilite_id"]; $adh->civilite_id = $_POST["civilite_id"];
$adh->societe = $_POST["societe"]; $adh->societe = $_POST["societe"];
$adh->adresse = $_POST["address"]; $adh->address = $_POST["address"];
$adh->cp = $_POST["zipcode"]; $adh->zip = $_POST["zipcode"];
$adh->ville = $_POST["town"]; $adh->town = $_POST["town"];
$adh->adresse = $_POST["address"]; // TODO deprecated
$adh->cp = $_POST["zipcode"]; // TODO deprecated
$adh->ville = $_POST["town"]; // TODO deprecated
$adh->email = $_POST["email"]; $adh->email = $_POST["email"];
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED))
{ {
@ -214,7 +217,9 @@ if ($action == 'add')
} }
$adh->photo = $_POST["photo"]; $adh->photo = $_POST["photo"];
$adh->note = $_POST["note"]; $adh->note = $_POST["note"];
$adh->pays_id = $_POST["pays_id"]; $adh->country_id = $_POST["pays_id"];
$adh->pays_id = $_POST["pays_id"]; // TODO deprecated
$adh->state_id = $_POST["state_id"];
$adh->typeid = $_POST["type"]; $adh->typeid = $_POST["type"];
$adh->note = $_POST["comment"]; $adh->note = $_POST["comment"];
$adh->morphy = $_POST["morphy"]; $adh->morphy = $_POST["morphy"];
@ -288,7 +293,7 @@ if ($action == 'added')
print $langs->trans("NewMemberbyWeb"); print $langs->trans("NewMemberbyWeb");
print '</center>'; print '</center>';
llxFooterVierge('$Date: 2011/07/31 23:23:21 $ - $Revision: 1.43 $'); llxFooterVierge('$Date: 2011/08/20 15:11:33 $ - $Revision: 1.44 $');
exit; exit;
} }
@ -536,5 +541,5 @@ print "<br></form>\n";
$db->close(); $db->close();
llxFooterVierge('$Date: 2011/07/31 23:23:21 $ - $Revision: 1.43 $'); llxFooterVierge('$Date: 2011/08/20 15:11:33 $ - $Revision: 1.44 $');
?> ?>

View File

@ -22,7 +22,7 @@
* \ingroup paypal * \ingroup paypal
* \brief File to offer a way to make a payment for a particular Dolibarr entity * \brief File to offer a way to make a payment for a particular Dolibarr entity
* \author Laurent Destailleur * \author Laurent Destailleur
* \version $Id: newpayment.php,v 1.26 2011/07/31 23:23:20 eldy Exp $ * \version $Id: newpayment.php,v 1.27 2011/08/20 15:11:33 eldy Exp $
*/ */
define("NOLOGIN",1); // This means this output page does not require to be logged. define("NOLOGIN",1); // This means this output page does not require to be logged.
@ -882,7 +882,7 @@ if (GETPOST("source") == 'membersubscription' && $valid)
// Shipping address // Shipping address
$shipToName=$member->getFullName($langs); $shipToName=$member->getFullName($langs);
$shipToStreet=$member->adresse; $shipToStreet=$member->address;
$shipToCity=$member->ville; $shipToCity=$member->ville;
$shipToState=$member->departement_code; $shipToState=$member->departement_code;
$shipToCountryCode=$member->pays_code; $shipToCountryCode=$member->pays_code;
@ -946,5 +946,5 @@ html_print_paypal_footer($mysoc,$langs);
$db->close(); $db->close();
llxFooterPaypal('$Date: 2011/07/31 23:23:20 $ - $Revision: 1.26 $'); llxFooterPaypal('$Date: 2011/08/20 15:11:33 $ - $Revision: 1.27 $');
?> ?>

View File

@ -23,7 +23,7 @@
* \file scripts/emailings/mailing-send.php * \file scripts/emailings/mailing-send.php
* \ingroup mailing * \ingroup mailing
* \brief Script d'envoi d'un mailing prepare et valide * \brief Script d'envoi d'un mailing prepare et valide
* \version $Id: mailing-send.php,v 1.20 2011/07/31 22:22:12 eldy Exp $ * \version $Id: mailing-send.php,v 1.21 2011/08/20 15:11:32 eldy Exp $
*/ */
$sapi_type = php_sapi_name(); $sapi_type = php_sapi_name();
@ -115,7 +115,7 @@ if ($resql)
dol_print_error($db); dol_print_error($db);
} }
// Boucle sur chaque adresse et envoie le mail // Look on each email and sent message
$i = 0; $i = 0;
while ($i < $num) while ($i < $num)
{ {