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
* \ingroup member
* \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");
@ -57,9 +57,15 @@ class Adherent extends CommonObject
var $pass;
var $societe;
var $adresse;
var $address;
var $cp;
var $zip;
var $ville;
var $town;
var $state_id;
var $state_code;
var $state;
var $fk_departement; // Id of department
var $departement_code; // Code of department
var $departement; // Label of department
@ -950,12 +956,17 @@ class Adherent extends CommonObject
$this->ville = $obj->town; // TODO deprecated
$this->town = $obj->town;
$this->fk_departement = $obj->fk_departement;
$this->departement_code = $obj->fk_departement?$obj->departement_code:'';
$this->departement = $obj->fk_departement?$obj->departement:'';
$this->state_id = $obj->fk_departement;
$this->state_id = $obj->fk_departement?$obj->departement_code:'';
$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->pays_code = $obj->pays_code;
$this->country_id = $obj->pays_id;
$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);
elseif ($obj->pays_lib) $this->pays=$obj->pays_lib;
else $this->pays=$obj->pays;

View File

@ -22,7 +22,7 @@
* \file htdocs/adherents/fiche.php
* \ingroup 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");
@ -236,9 +236,10 @@ if ($_REQUEST["action"] == 'update' && ! $_POST["cancel"] && $user->rights->adhe
$object->zip = trim($_POST["zipcode"]);
$object->ville = trim($_POST["town"]); // deprecated
$object->town = trim($_POST["town"]);
$object->fk_departement = $_POST["departement_id"];
$object->pays_id = $_POST["pays_id"];
$object->state_id = $_POST["departement_id"];
$object->country_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_perso = trim($_POST["phone_perso"]);
@ -1526,5 +1527,5 @@ if ($rowid && $action != 'edit')
$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
* \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
* in /etc/asterisk/manager.conf
* [dolibarr]
@ -76,7 +76,7 @@ $password = $_GET['password'];
$caller = $_GET['caller'];
$called = $_GET['called'];
# Adresse IP du serveur Asterisk
# IP address of Asterisk server
$strHost = $conf->global->ASTERISK_HOST;
#Spécifiez le type d'extension par laquelle vous poste est connecte.
#ex: SIP/, IAX2/, ZAP/, etc

View File

@ -16,14 +16,14 @@
* You should have received a copy of the GNU General Public License
* 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
\ingroup boutique
\brief Page fiche commande OSCommerce
\version $Revision: 1.24 $
\version $Revision: 1.25 $
*/
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 "<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>".$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();
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; */
}
.adresse {
.address {
/* float: left; */
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).'">'; ?>
</div>
<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->zip.' '.$mysoc->town; ?></p>

View File

@ -20,8 +20,8 @@
/**
* \file htdocs/comm/address.php
* \ingroup societe
* \brief Onglet adresses d'un client
* \version $Id: address.php,v 1.9 2011/08/03 00:46:27 eldy Exp $
* \brief Tab address of customer
* \version $Id: address.php,v 1.10 2011/08/20 15:11:32 eldy Exp $
*/
require("../main.inc.php");
@ -49,7 +49,7 @@ $result = restrictedArea($user, 'societe', $socid);
if ($_POST["action"] == 'add' || $_POST["action"] == 'update')
{
$address = new Address($db);
$address = new Address($db);
$address->socid = $_POST["socid"];
$address->label = ($_POST["label"]!=$langs->trans('RequiredField')?$_POST["label"]:'');
@ -71,21 +71,21 @@ if ($_POST["action"] == 'add' || $_POST["action"] == 'update')
if ($result >= 0)
{
if ($origin == commande)
{
Header("Location: ../commande/fiche.php?action=editdelivery_adress&socid=".$socid."&id=".$originid);
exit;
}
elseif ($origin == propal)
{
Header("Location: ../comm/propal.php?action=editdelivery_adress&socid=".$socid."&id=".$originid);
exit;
}
else
{
Header("Location: ".$_SERVER['PHP_SELF']."?socid=".$socid);
exit;
}
if ($origin == commande)
{
Header("Location: ../commande/fiche.php?action=editdelivery_adress&socid=".$socid."&id=".$originid);
exit;
}
elseif ($origin == propal)
{
Header("Location: ../comm/propal.php?action=editdelivery_adress&socid=".$socid."&id=".$originid);
exit;
}
else
{
Header("Location: ".$_SERVER['PHP_SELF']."?socid=".$socid);
exit;
}
}
else
{
@ -103,29 +103,29 @@ if ($_POST["action"] == 'add' || $_POST["action"] == 'update')
if ($result >= 0)
{
if ($origin == commande)
{
Header("Location: ../commande/fiche.php?id=".$originid);
exit;
}
elseif ($origin == propal)
{
Header("Location: ../comm/propal.php?id=".$originid);
exit;
}
elseif ($origin == shipment)
{
Header("Location: ../expedition/fiche.php?id=".$originid);
exit;
}
else
{
Header("Location: ".$_SERVER['PHP_SELF']."?socid=".$socid);
exit;
}
}
else
{
if ($origin == commande)
{
Header("Location: ../commande/fiche.php?id=".$originid);
exit;
}
elseif ($origin == propal)
{
Header("Location: ../comm/propal.php?id=".$originid);
exit;
}
elseif ($origin == shipment)
{
Header("Location: ../expedition/fiche.php?id=".$originid);
exit;
}
else
{
Header("Location: ".$_SERVER['PHP_SELF']."?socid=".$socid);
exit;
}
}
else
{
$reload = 0;
$mesg = $address->error;
$_GET["action"]= "edit";
@ -136,18 +136,18 @@ if ($_POST["action"] == 'add' || $_POST["action"] == 'update')
if ($_POST["action"] == 'confirm_delete' && $_POST["confirm"] == 'yes' && $user->rights->societe->supprimer)
{
$address = new Address($db);
$result = $address->delete($_GET["id"], $socid);
$address = new Address($db);
$result = $address->delete($_GET["id"], $socid);
if ($result == 0)
if ($result == 0)
{
Header("Location: ".$_SERVER['PHP_SELF']."?socid=".$socid);
exit ;
Header("Location: ".$_SERVER['PHP_SELF']."?socid=".$socid);
exit ;
}
else
{
$reload = 0;
$_GET["action"]='';
$reload = 0;
$_GET["action"]='';
}
}
@ -166,19 +166,19 @@ if (!empty($mesg)) print '<div class="error">'.$mesg.'</div>';
if ($_GET["action"] == 'create' || $_POST["action"] == 'create')
{
if ($user->rights->societe->creer)
{
/*
* Fiche adresse en mode creation
*/
if ($user->rights->societe->creer)
{
/*
* Creation
*/
$address = new Address($db);
$address = new Address($db);
$societe=new Societe($db);
$societe->fetch($socid);
$head = societe_prepare_head($societe);
$societe=new Societe($db);
$societe->fetch($socid);
$head = societe_prepare_head($societe);
dol_fiche_head($head, 'customer', $societe->nom);
dol_fiche_head($head, 'customer', $societe->nom);
if ($_POST["label"] && $_POST["name"])
{
@ -264,16 +264,16 @@ if ($_GET["action"] == 'create' || $_POST["action"] == 'create')
print '<tr><td valign="top">'.$langs->trans('Address').'</td><td colspan="3"><textarea name="address" cols="40" rows="3" wrap="soft">';
print $address->address;
print '</textarea></td></tr>';
// Zip
print '<tr><td>'.$langs->trans('Zip').'</td><td>';
print $formcompany->select_ziptown($address->cp,'zipcode',array('town','selectpays_id'),6);
print '</td></tr>';
// Town
print '<tr><td>'.$langs->trans('Town').'</td><td>';
print $formcompany->select_ziptown($address->ville,'town',array('zipcode','selectpays_id'));
print '</td></tr>';
print '<tr><td>'.$langs->trans('Zip').'</td><td>';
print $formcompany->select_ziptown($address->cp,'zipcode',array('town','selectpays_id'),6);
print '</td></tr>';
// Town
print '<tr><td>'.$langs->trans('Town').'</td><td>';
print $formcompany->select_ziptown($address->ville,'town',array('zipcode','selectpays_id'));
print '</td></tr>';
print '<tr><td width="25%">'.$langs->trans('Country').'</td><td colspan="3">';
$form->select_pays($address->pays_id,'pays_id');
@ -300,16 +300,16 @@ elseif ($_GET["action"] == 'edit' || $_POST["action"] == 'edit')
/*
* Fiche societe en mode edition
*/
$address = new Address($db);
$address = new Address($db);
$societe=new Societe($db);
$societe->fetch($_GET["socid"]);
$head = societe_prepare_head($societe);
$societe=new Societe($db);
$societe->fetch($_GET["socid"]);
$head = societe_prepare_head($societe);
dol_fiche_head($head, 'customer', $societe->nom);
dol_fiche_head($head, 'customer', $societe->nom);
print_titre($langs->trans("EditAddress"));
print "<br>\n";
print_titre($langs->trans("EditAddress"));
print "<br>\n";
if ($socid)
{
@ -378,14 +378,14 @@ elseif ($_GET["action"] == 'edit' || $_POST["action"] == 'edit')
print '</textarea></td></tr>';
// Zip
print '<tr><td>'.$langs->trans('Zip').'</td><td>';
print $formcompany->select_ziptown($address->cp,'zipcode',array('town','selectpays_id'),6);
print '</td></tr>';
// Town
print '<tr><td>'.$langs->trans('Town').'</td><td>';
print $formcompany->select_ziptown($address->ville,'town',array('zipcode','selectpays_id'));
print '</td></tr>';
print '<tr><td>'.$langs->trans('Zip').'</td><td>';
print $formcompany->select_ziptown($address->cp,'zipcode',array('town','selectpays_id'),6);
print '</td></tr>';
// Town
print '<tr><td>'.$langs->trans('Town').'</td><td>';
print $formcompany->select_ziptown($address->ville,'town',array('zipcode','selectpays_id'));
print '</td></tr>';
print '<tr><td>'.$langs->trans('Country').'</td><td colspan="3">';
$form->select_pays($address->pays_id,'pays_id');
@ -407,114 +407,114 @@ elseif ($_GET["action"] == 'edit' || $_POST["action"] == 'edit')
}
else
{
/*
* Fiche societe en mode visu
*/
$address = new Address($db);
$result=$address->fetch($socid);
if ($result < 0)
{
dol_print_error($db,$address->error);
exit;
}
/*
* Fiche societe en mode visu
*/
$address = new Address($db);
$result=$address->fetch($socid);
if ($result < 0)
{
dol_print_error($db,$address->error);
exit;
}
$societe=new Societe($db);
$societe->fetch($address->socid);
$head = societe_prepare_head($societe);
$societe=new Societe($db);
$societe->fetch($address->socid);
$head = societe_prepare_head($societe);
dol_fiche_head($head, 'customer', $societe->nom);
dol_fiche_head($head, 'customer', $societe->nom);
// Confirmation de la suppression de l'adresse
if ($_GET["action"] == 'delete')
{
$html = new Form($db);
$ret=$html->form_confirm($_SERVER['PHP_SELF']."?socid=".$address->socid."&amp;id=".$_GET["id"],$langs->trans("DeleteAddress"),$langs->trans("ConfirmDeleteAddress"),"confirm_delete");
if ($ret == 'html') print '<br>';
}
// Confirmation delete
if ($_GET["action"] == 'delete')
{
$html = new Form($db);
$ret=$html->form_confirm($_SERVER['PHP_SELF']."?socid=".$address->socid."&amp;id=".$_GET["id"],$langs->trans("DeleteAddress"),$langs->trans("ConfirmDeleteAddress"),"confirm_delete");
if ($ret == 'html') print '<br>';
}
if ($address->error)
{
print '<div class="error">';
print $address->error;
print '</div>';
}
if ($address->error)
{
print '<div class="error">';
print $address->error;
print '</div>';
}
$nblines = sizeof($address->lines);
if ($nblines)
{
for ($i = 0 ; $i < $nblines ; $i++)
{
$nblines = sizeof($address->lines);
if ($nblines)
{
for ($i = 0 ; $i < $nblines ; $i++)
{
print '<table class="border" width="100%">';
print '<table class="border" width="100%">';
print '<tr><td width="20%">'.$langs->trans('AddressLabel').'</td><td colspan="3">'.$address->lines[$i]->label.'</td>';
print '<td valign="top" colspan="2" width="50%" rowspan="6">'.$langs->trans('Note').' :<br>'.nl2br($address->lines[$i]->note).'</td></tr>';
print '<tr><td width="20%">'.$langs->trans('Name').'</td><td colspan="3">'.$address->lines[$i]->name.'</td></tr>';
print '<tr><td width="20%">'.$langs->trans('AddressLabel').'</td><td colspan="3">'.$address->lines[$i]->label.'</td>';
print '<td valign="top" colspan="2" width="50%" rowspan="6">'.$langs->trans('Note').' :<br>'.nl2br($address->lines[$i]->note).'</td></tr>';
print '<tr><td width="20%">'.$langs->trans('Name').'</td><td colspan="3">'.$address->lines[$i]->name.'</td></tr>';
print "<tr><td valign=\"top\">".$langs->trans('Address')."</td><td colspan=\"3\">".nl2br($address->lines[$i]->address)."</td></tr>";
print "<tr><td valign=\"top\">".$langs->trans('Address')."</td><td colspan=\"3\">".nl2br($address->lines[$i]->address)."</td></tr>";
print '<tr><td width="25%">'.$langs->trans('Zip').'</td><td width="25%">'.$address->lines[$i]->cp."</td></tr>";
print '<tr><td width="25%">'.$langs->trans('Town').'</td><td width="25%">'.$address->lines[$i]->ville."</td></tr>";
print '<tr><td width="25%">'.$langs->trans('Zip').'</td><td width="25%">'.$address->lines[$i]->cp."</td></tr>";
print '<tr><td width="25%">'.$langs->trans('Town').'</td><td width="25%">'.$address->lines[$i]->ville."</td></tr>";
print '<tr><td>'.$langs->trans('Country').'</td><td colspan="3">'.$address->lines[$i]->pays.'</td>';
print '<tr><td>'.$langs->trans('Country').'</td><td colspan="3">'.$address->lines[$i]->pays.'</td>';
print '<tr><td>'.$langs->trans('Phone').'</td><td>'.dol_print_phone($address->lines[$i]->tel,$address->lines[$i]->pays_code,0,$address->socid,'AC_TEL').'</td></tr>';
print '<tr><td>'.$langs->trans('Phone').'</td><td>'.dol_print_phone($address->lines[$i]->tel,$address->lines[$i]->pays_code,0,$address->socid,'AC_TEL').'</td></tr>';
print '<tr><td>'.$langs->trans('Fax').'</td><td>'.dol_print_phone($address->lines[$i]->fax,$address->lines[$i]->pays_code,0,$address->socid,'AC_FAX').'</td></tr>';
print '<tr><td>'.$langs->trans('Fax').'</td><td>'.dol_print_phone($address->lines[$i]->fax,$address->lines[$i]->pays_code,0,$address->socid,'AC_FAX').'</td></tr>';
print '</td></tr>';
print '</td></tr>';
print '</table>';
print '</table>';
/*
*
*/
/*
*
*/
print '<div class="tabsAction">';
print '<div class="tabsAction">';
if ($user->rights->societe->creer)
{
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?socid='.$address->socid.'&amp;id='.$address->lines[$i]->id.'&amp;action=edit">'.$langs->trans("Modify").'</a>';
}
if ($user->rights->societe->creer)
{
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?socid='.$address->socid.'&amp;id='.$address->lines[$i]->id.'&amp;action=edit">'.$langs->trans("Modify").'</a>';
}
if ($user->rights->societe->supprimer)
{
print '<a class="butActionDelete" href="'.$_SERVER['PHP_SELF'].'?socid='.$address->socid.'&amp;id='.$address->lines[$i]->id.'&amp;action=delete">'.$langs->trans("Delete").'</a>';
}
if ($user->rights->societe->supprimer)
{
print '<a class="butActionDelete" href="'.$_SERVER['PHP_SELF'].'?socid='.$address->socid.'&amp;id='.$address->lines[$i]->id.'&amp;action=delete">'.$langs->trans("Delete").'</a>';
}
print '</div>';
print '<br>';
}
}
else
{
print $langs->trans("None");
}
print '</div>';
print '</div>';
print '<br>';
}
}
else
{
print $langs->trans("None");
}
print '</div>';
/*
* Bouton actions
*/
/*
* Bouton actions
*/
if ($_GET["action"] == '')
{
print '<div class="tabsAction">';
if ($_GET["action"] == '')
{
print '<div class="tabsAction">';
if ($user->rights->societe->creer)
{
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?socid='.$address->socid.'&amp;action=create">'.$langs->trans("Add").'</a>';
}
print '</div>';
}
if ($user->rights->societe->creer)
{
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?socid='.$address->socid.'&amp;action=create">'.$langs->trans("Add").'</a>';
}
print '</div>';
}
}
$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
* \ingroup mailing
* \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");
@ -157,7 +157,7 @@ if ($_REQUEST["action"] == 'sendallconfirmed' && $_REQUEST['confirm'] == 'yes')
dol_print_error($db);
}
// Boucle sur chaque adresse et envoie le mail
// Loop on each email and send it
$i = 0;
while ($i < $num && $i < $conf->global->MAILING_LIMIT_SENDBYWEB)
@ -1072,5 +1072,5 @@ else
$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 Eric Seigne
* \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");
@ -745,7 +745,7 @@ class Propal extends CommonObject
$result=$this->db->query($sql);
}
// Affectation de l'adresse de livraison
// Set delivery address
if (! $error && $this->fk_delivery_address)
{
$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 adresse_livraison Adresse de livraison
* \param fk_address Delivery address id
* \return int <0 si ko, >0 si ok
*/
function set_adresse_livraison($user, $fk_address)

View File

@ -1,6 +1,6 @@
<?php
/* 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
* it under the terms of the GNU General Public License as published by
@ -20,7 +20,7 @@
* \file htdocs/contact/perso.php
* \ingroup societe
* \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");
@ -42,33 +42,35 @@ $result = restrictedArea($user, 'contact', $contactid, 'socpeople');
if ($user->rights->societe->contact->creer)
{
if ($_POST["action"] == 'update' && ! $_POST["cancel"])
{
$contact = new Contact($db);
$contact->fetch($_POST["contactid"]);
if ($_POST["action"] == 'update' && ! $_POST["cancel"])
{
$contact = new Contact($db);
$contact->fetch($_POST["contactid"]);
// Note: Correct date should be completed with location to have exact GM time of birth.
$contact->birthday = dol_mktime(0,0,0,$_POST["birthdaymonth"],$_POST["birthdayday"],$_POST["birthdayyear"]);
$contact->birthday_alert = $_POST["birthday_alert"];
// Note: Correct date should be completed with location to have exact GM time of birth.
$contact->birthday = dol_mktime(0,0,0,$_POST["birthdaymonth"],$_POST["birthdayday"],$_POST["birthdayyear"]);
$contact->birthday_alert = $_POST["birthday_alert"];
$result = $contact->update_perso($_POST["contactid"], $user);
$result = $contact->update_perso($_POST["contactid"], $user);
if ($result > 0)
{
$contact->old_name='';
$contact->old_firstname='';
}
else
{
$error = $contact->error;
}
}
if ($result > 0)
{
$contact->old_name='';
$contact->old_firstname='';
}
else
{
$error = $contact->error;
}
}
}
/*
* View
*/
* View
*/
$now=dol_now();
llxHeader('',$langs->trans("ContactsAddresses"),'EN:Module_Third_Parties|FR:Module_Tiers|ES:M&oacute;dulo_Empresas');
@ -96,12 +98,12 @@ if ($_GET["action"] == 'edit')
print '<input type="hidden" name="action" value="update">';
print '<input type="hidden" name="contactid" value="'.$contact->id.'">';
// Ref
// Ref
print '<tr><td width="20%">'.$langs->trans("Ref").'</td><td colspan="3">';
print $contact->id;
print '</td></tr>';
// Name
// Name
print '<tr><td width="20%">'.$langs->trans("Lastname").' / '.$langs->trans("Label").'</td><td width="30%">'.$contact->nom.'</td>';
print '<td width="20%">'.$langs->trans("Firstname").'</td><td width="30%">'.$contact->prenom.'</td>';
@ -123,12 +125,12 @@ if ($_GET["action"] == 'edit')
}
}
// Civility
// Civility
print '<tr><td>'.$langs->trans("UserTitle").'</td><td colspan="3">';
print $contact->getCivilityLabel();
print '</td></tr>';
// Date To Birth
// Date To Birth
print '<tr><td>'.$langs->trans("DateToBirth").'</td><td>';
$html=new Form($db);
print $html->select_date($contact->birthday,'birthday',0,0,1,"perso");
@ -162,12 +164,12 @@ else
*/
print '<table class="border" width="100%">';
// Ref
// Ref
print '<tr><td width="20%">'.$langs->trans("Ref").'</td><td colspan="3">';
print $form->showrefnav($contact,'id');
print $form->showrefnav($contact,'id');
print '</td></tr>';
// Name
// Name
print '<tr><td width="20%">'.$langs->trans("Lastname").' / '.$langs->trans("Label").'</td><td width="30%">'.$contact->name.'</td>';
print '<td width="20%">'.$langs->trans("Firstname").'</td><td width="30%">'.$contact->firstname.'</td></tr>';
@ -190,19 +192,32 @@ else
}
}
// Civility
// Civility
print '<tr><td>'.$langs->trans("UserTitle").'</td><td colspan="3">';
print $contact->getCivilityLabel();
print '</td></tr>';
// Date To Birth
// Date To Birth
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 ' (';
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");
else print $langs->trans("BirthdayAlertOff");
print ')</td>';
print '</td>';
}
else
{
@ -220,9 +235,9 @@ else
{
print '<div class="tabsAction">';
if ($user->rights->societe->contact->creer)
{
print '<a class="butAction" href="perso.php?id='.$_GET["id"].'&amp;action=edit">'.$langs->trans('Modify').'</a>';
if ($user->rights->societe->contact->creer)
{
print '<a class="butAction" href="perso.php?id='.$_GET["id"].'&amp;action=edit">'.$langs->trans('Modify').'</a>';
}
print "</div>";
@ -232,5 +247,5 @@ else
$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
* \ingroup core
* \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
* @param fk_address Id de l'adresse
* Load delivery adresse id into $this->fk_address
* @param fk_address Id of address
* @return int <0 if KO, >0 if OK
*/
function fetch_address($fk_address)

View File

@ -31,7 +31,7 @@
* \file htdocs/core/class/html.form.class.php
* \ingroup core
* \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 $
*/
@ -854,7 +854,7 @@ class Form
$out.= '>';
}
$out.= $userstatic->getFullName($langs);
if($conf->multicompany->enabled && empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1 && $user->admin && ! $user->entity)
{
if ($obj->admin && ! $obj->entity) $out.=" (".$langs->trans("AllEntities").")";
@ -1395,7 +1395,7 @@ class Form
}
/**
* Retourne la liste deroulante des adresses
* Return list of delivery address
* @param selected Id contact pre-selectionn
* @param socid
* @param htmlname Name of HTML field

View File

@ -21,7 +21,7 @@
/**
* \file htdocs/lib/date.lib.php
* \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
* @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 lengthOfWeek Length of week (default 7)
* @return sTime Formated text of duration
@ -166,7 +166,15 @@ function ConvertSecondToTime($iSecond,$format='all',$lengthOfDay=86400,$lengthOf
{
$sTime=dol_print_date($iSecond,'%S',true);
}
return trim($sTime);
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);
}

View File

@ -28,7 +28,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.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
@ -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 minute Minute (can be -1 for undefined)
* @param second Second (can be -1 for undefined)
* @param month Month
* @param day Day
* @param month Month (1 to 12)
* @param day Day (1 to 31)
* @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...)

View File

@ -21,7 +21,7 @@
* \file htdocs/public/members/new.php
* \ingroup 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
* MEMBER_NEWFORM_AMOUNT Default amount for autosubscribe form
@ -203,9 +203,12 @@ if ($action == 'add')
$adh->nom = $_POST["nom"];
$adh->civilite_id = $_POST["civilite_id"];
$adh->societe = $_POST["societe"];
$adh->adresse = $_POST["address"];
$adh->cp = $_POST["zipcode"];
$adh->ville = $_POST["town"];
$adh->address = $_POST["address"];
$adh->zip = $_POST["zipcode"];
$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"];
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED))
{
@ -214,7 +217,9 @@ if ($action == 'add')
}
$adh->photo = $_POST["photo"];
$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->note = $_POST["comment"];
$adh->morphy = $_POST["morphy"];
@ -288,7 +293,7 @@ if ($action == 'added')
print $langs->trans("NewMemberbyWeb");
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;
}
@ -536,5 +541,5 @@ print "<br></form>\n";
$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
* \brief File to offer a way to make a payment for a particular Dolibarr entity
* \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.
@ -882,7 +882,7 @@ if (GETPOST("source") == 'membersubscription' && $valid)
// Shipping address
$shipToName=$member->getFullName($langs);
$shipToStreet=$member->adresse;
$shipToStreet=$member->address;
$shipToCity=$member->ville;
$shipToState=$member->departement_code;
$shipToCountryCode=$member->pays_code;
@ -946,5 +946,5 @@ html_print_paypal_footer($mysoc,$langs);
$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
* \ingroup mailing
* \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();
@ -115,7 +115,7 @@ if ($resql)
dol_print_error($db);
}
// Boucle sur chaque adresse et envoie le mail
// Look on each email and sent message
$i = 0;
while ($i < $num)
{