2
0
forked from Wavyzz/dolibarr

Qual: Removed useless methods

Qual: Removed deprecated vars
Qual: Free memory
This commit is contained in:
Laurent Destailleur
2013-06-16 21:31:21 +02:00
parent c83bce262e
commit c748f3d834
39 changed files with 157 additions and 197 deletions

View File

@@ -99,8 +99,8 @@ for ($s = 0 ; $s < GEN_NUMBER_SOCIETE ; $s++)
$soc->country_id=1;
$soc->country_code='FR';
// Un client sur 3 a une remise de 5%
$user_remise=rand(1,3); if ($user_remise==3) $soc->remise_client=5;
print "> client=".$soc->client.", fournisseur=".$soc->fournisseur.", remise=".$soc->remise_client."\n";
$user_remise=rand(1,3); if ($user_remise==3) $soc->remise_percent=5;
print "> client=".$soc->client.", fournisseur=".$soc->fournisseur.", remise=".$soc->remise_percent."\n";
$soc->note='Company created by the script generate-societe.php';
$socid = $soc->create();

View File

@@ -1101,12 +1101,10 @@ class Adherent extends CommonObject
// Retreive all extrafield for thirdparty
// fetch optionals attributes and labels
require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php');
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
$extrafields=new ExtraFields($this->db);
$extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
if (count($extralabels)>0) {
$this->fetch_optionals($this->id,$extralabels);
}
$this->fetch_optionals($this->id,$extralabels);
// Load other properties
$result=$this->fetch_subscriptions();
@@ -1662,6 +1660,7 @@ class Adherent extends CommonObject
{
$this->nb["members"]=$obj->nb;
}
$this->db->free($resql);
return 1;
}
else

View File

@@ -309,11 +309,11 @@ if ($id > 0)
print '</td><td colspan="3">';
if ($action == 'editconditions')
{
$form->form_conditions_reglement($_SERVER['PHP_SELF'].'?socid='.$object->id,$object->cond_reglement,'cond_reglement_id',-1,1);
$form->form_conditions_reglement($_SERVER['PHP_SELF'].'?socid='.$object->id,$object->cond_reglement_id,'cond_reglement_id',-1,1);
}
else
{
$form->form_conditions_reglement($_SERVER['PHP_SELF'].'?socid='.$object->id,$object->cond_reglement,'none');
$form->form_conditions_reglement($_SERVER['PHP_SELF'].'?socid='.$object->id,$object->cond_reglement_id,'none');
}
print "</td>";
print '</tr>';
@@ -328,11 +328,11 @@ if ($id > 0)
print '</td><td colspan="3">';
if ($action == 'editmode')
{
$form->form_modes_reglement($_SERVER['PHP_SELF'].'?socid='.$object->id,$object->mode_reglement,'mode_reglement_id');
$form->form_modes_reglement($_SERVER['PHP_SELF'].'?socid='.$object->id,$object->mode_reglement_id,'mode_reglement_id');
}
else
{
$form->form_modes_reglement($_SERVER['PHP_SELF'].'?socid='.$object->id,$object->mode_reglement,'none');
$form->form_modes_reglement($_SERVER['PHP_SELF'].'?socid='.$object->id,$object->mode_reglement_id,'none');
}
print "</td>";
print '</tr>';
@@ -347,7 +347,7 @@ if ($id > 0)
print '<a href="'.DOL_URL_ROOT.'/comm/remise.php?id='.$object->id.'">'.img_edit($langs->trans("Modify")).'</a>';
}
print '</td></tr></table>';
print '</td><td colspan="3">'.($object->remise_client?'<a href="'.DOL_URL_ROOT.'/comm/remise.php?id='.$object->id.'">'.$object->remise_client.'%</a>':$langs->trans("DiscountNone")).'</td>';
print '</td><td colspan="3">'.($object->remise_percent?'<a href="'.DOL_URL_ROOT.'/comm/remise.php?id='.$object->id.'">'.$object->remise_percent.'%</a>':$langs->trans("DiscountNone")).'</td>';
print '</tr>';
// Absolute discounts (Discounts-Drawbacks-Rebates)

View File

@@ -905,7 +905,7 @@ else if ($action == 'updateligne' && $user->rights->propal->creer && GETPOST('sa
unset($_POST["options_".$key]);
}
}
// Define special_code for special lines
$special_code=0;
if (! GETPOST('qty')) $special_code=3;
@@ -1302,7 +1302,7 @@ if ($action == 'create')
// Ligne info remises tiers
print '<tr><td>'.$langs->trans('Discounts').'</td><td colspan="2">';
if ($soc->remise_client) print $langs->trans("CompanyHasRelativeDiscount",$soc->remise_client);
if ($soc->remise_percent) print $langs->trans("CompanyHasRelativeDiscount",$soc->remise_percent);
else print $langs->trans("CompanyHasNoRelativeDiscount");
$absolute_discount=$soc->getAvailableDiscounts();
print '. ';
@@ -1322,12 +1322,12 @@ if ($action == 'create')
// Terms of payment
print '<tr><td class="nowrap fieldrequired">'.$langs->trans('PaymentConditionsShort').'</td><td colspan="2">';
$form->select_conditions_paiements($soc->cond_reglement,'cond_reglement_id');
$form->select_conditions_paiements($soc->cond_reglement_id,'cond_reglement_id');
print '</td></tr>';
// Mode of payment
print '<tr><td>'.$langs->trans('PaymentMode').'</td><td colspan="2">';
$form->select_types_paiements($soc->mode_reglement,'mode_reglement_id');
$form->select_types_paiements($soc->mode_reglement_id,'mode_reglement_id');
print '</td></tr>';
// What trigger creation
@@ -1369,9 +1369,9 @@ if ($action == 'create')
// Project
if (! empty($conf->projet->enabled) && $socid>0)
{
$formproject=new FormProjets($db);
$projectid = 0;
if ($origin == 'project') $projectid = ($originid?$originid:0);
@@ -1476,7 +1476,7 @@ if ($action == 'create')
$form->select_produits('',"idprod".$i,'',$conf->product->limit_size);
print '</td>';
print '<td><input type="text" size="2" name="qty'.$i.'" value="1"></td>';
print '<td><input type="text" size="2" name="remise'.$i.'" value="'.$soc->remise_client.'">%</td>';
print '<td><input type="text" size="2" name="remise'.$i.'" value="'.$soc->remise_percent.'">%</td>';
print '</tr>';
}
@@ -1624,7 +1624,7 @@ else
// Ligne info remises tiers
print '<tr><td>'.$langs->trans('Discounts').'</td><td colspan="5">';
if ($soc->remise_client) print $langs->trans("CompanyHasRelativeDiscount",$soc->remise_client);
if ($soc->remise_percent) print $langs->trans("CompanyHasRelativeDiscount",$soc->remise_percent);
else print $langs->trans("CompanyHasNoRelativeDiscount");
print '. ';
$absolute_discount=$soc->getAvailableDiscounts('','fk_facture_source IS NULL');

View File

@@ -97,7 +97,7 @@ if ($id > 0 || ! empty($ref))
// Ligne info remises tiers
print '<tr><td>'.$langs->trans('Discounts').'</td><td colspan="5">';
if ($soc->remise_client) print $langs->trans("CompanyHasRelativeDiscount",$soc->remise_client);
if ($soc->remise_percent) print $langs->trans("CompanyHasRelativeDiscount",$soc->remise_percent);
else print $langs->trans("CompanyHasNoRelativeDiscount");
$absolute_discount=$soc->getAvailableDiscounts();
print '. ';

View File

@@ -408,7 +408,7 @@ class Propal extends CommonObject
$this->line->date_start=$date_start;
$this->line->date_end=$date_end;
// infos marge
$this->line->fk_fournprice = $fk_fournprice;
$this->line->pa_ht = $pa_ht;
@@ -1109,13 +1109,10 @@ class Propal extends CommonObject
// Retreive all extrafield for invoice
// fetch optionals attributes and labels
if(!class_exists('Extrafields'))
require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php');
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
$extrafields=new ExtraFields($this->db);
$extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
if (count($extralabels)>0) {
$this->fetch_optionals($this->id,$extralabels);
}
$this->fetch_optionals($this->id,$extralabels);
$this->db->free($resql);
@@ -1202,13 +1199,11 @@ class Propal extends CommonObject
// Retreive all extrafield for propal
// fetch optionals attributes and labels
if(!class_exists('Extrafields'))
require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php');
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
$extrafields=new ExtraFields($this->db);
$extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
if (count($extralabels)>0) {
$this->fetch_optionals($this->id,$extralabels);
}
$this->fetch_optionals($this->id,$extralabels);
return 1;
}
@@ -2449,6 +2444,7 @@ class Propal extends CommonObject
{
$this->nb["proposals"]=$obj->nb;
}
$this->db->free($resql);
return 1;
}
else
@@ -2850,7 +2846,7 @@ class PropaleLigne extends CommonObject
if ($resql)
{
$this->rowid=$this->db->last_insert_id(MAIN_DB_PREFIX.'propaldet');
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
{
$this->id=$this->rowid;
@@ -2860,7 +2856,7 @@ class PropaleLigne extends CommonObject
$error++;
}
}
if (! $notrigger)
{
// Appel des triggers
@@ -2901,7 +2897,7 @@ class PropaleLigne extends CommonObject
dol_syslog("PropaleLigne::delete sql=".$sql, LOG_DEBUG);
if ($this->db->query($sql) )
{
// Remove extrafields
if ((! $error) && (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))) // For avoid conflicts if trigger used
{
@@ -2913,7 +2909,7 @@ class PropaleLigne extends CommonObject
dol_syslog(get_class($this)."::delete error -4 ".$this->error, LOG_ERR);
}
}
// Appel des triggers
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
$interface=new Interfaces($this->db);
@@ -3016,7 +3012,7 @@ class PropaleLigne extends CommonObject
$error++;
}
}
if (! $notrigger)
{
// Appel des triggers

View File

@@ -113,7 +113,7 @@ if ($id > 0 || ! empty($ref))
// Ligne info remises tiers
print '<tr><td>'.$langs->trans('Discounts').'</td><td colspan="3">';
if ($societe->remise_client) print $langs->trans("CompanyHasRelativeDiscount",$societe->remise_client);
if ($societe->remise_percent) print $langs->trans("CompanyHasRelativeDiscount",$societe->remise_percent);
else print $langs->trans("CompanyHasNoRelativeDiscount");
$absolute_discount=$societe->getAvailableDiscounts();
print '. ';

View File

@@ -81,6 +81,7 @@ class Prospect extends Societe
if ($obj->client == 1 || $obj->client == 3) $this->nb["customers"]+=$obj->nb;
if ($obj->client == 2 || $obj->client == 3) $this->nb["prospects"]+=$obj->nb;
}
$this->db->free($resql);
return 1;
}
else

View File

@@ -114,7 +114,7 @@ if ($socid > 0)
// Remise
print '<tr><td colspan="2" width="25%">';
print $langs->trans("CustomerRelativeDiscount").'</td><td colspan="2">'.price2num($objsoc->remise_client)."%</td></tr>";
print $langs->trans("CustomerRelativeDiscount").'</td><td colspan="2">'.price2num($objsoc->remise_percent)."%</td></tr>";
print '</table>';
print '<br>';
@@ -130,7 +130,7 @@ if ($socid > 0)
// Nouvelle valeur
print '<tr><td colspan="2">';
print $langs->trans("NewValue").'</td><td colspan="2"><input type="text" size="5" name="remise" value="'.($_POST["remise"]?$_POST["remise"]:$objsoc->remise_client).'">%</td></tr>';
print $langs->trans("NewValue").'</td><td colspan="2"><input type="text" size="5" name="remise" value="'.($_POST["remise"]?$_POST["remise"]:$objsoc->remise_percent).'">%</td></tr>';
// Motif/Note
print '<tr><td colspan="2" width="25%">';
@@ -184,7 +184,7 @@ if ($socid > 0)
$tag = !$tag;
print '<tr '.$bc[$tag].'>';
print '<td>'.dol_print_date($db->jdate($obj->dc),"dayhour").'</td>';
print '<td align="center">'.price2num($obj->remise_client).'%</td>';
print '<td align="center">'.price2num($obj->remise_percent).'%</td>';
print '<td align="left">'.$obj->note.'</td>';
print '<td align="center"><a href="'.DOL_URL_ROOT.'/user/fiche.php?id='.$obj->user_id.'">'.img_object($langs->trans("ShowUser"),'user').' '.$obj->login.'</a></td>';
print '</tr>';

View File

@@ -1344,16 +1344,13 @@ class Commande extends CommonOrder
$this->lines = array();
if ($this->statut == 0) $this->brouillon = 1;
// Retreive all extrafield for invoice
// fetch optionals attributes and labels
if(!class_exists('Extrafields'))
require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php');
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
$extrafields=new ExtraFields($this->db);
$extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
if (count($extralabels)>0) {
$this->fetch_optionals($this->id,$extralabels);
}
$this->fetch_optionals($this->id,$extralabels);
$this->db->free();
@@ -2430,7 +2427,7 @@ class Commande extends CommonOrder
// Delete linked contacts
$res = $this->delete_linked_contact();
if ($res < 0) $error++;
// Remove extrafields
if ((! $error) && (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))) // For avoid conflicts if trigger used
{
@@ -2468,8 +2465,8 @@ class Commande extends CommonOrder
}
}
}
}
if (! $error)
@@ -2833,6 +2830,7 @@ class Commande extends CommonOrder
{
$this->nb["orders"]=$obj->nb;
}
$this->db->free($resql);
return 1;
}
else
@@ -3127,7 +3125,7 @@ class OrderLine extends CommonOrderLine
dol_syslog(get_class($this)."::delete error -4 ".$this->error, LOG_ERR);
}
}
// Appel des triggers
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
$interface=new Interfaces($this->db);
@@ -3235,7 +3233,7 @@ class OrderLine extends CommonOrderLine
$error++;
}
}
if (! $notrigger)
{
// Appel des triggers
@@ -3339,7 +3337,7 @@ class OrderLine extends CommonOrderLine
$error++;
}
}
if (! $notrigger)
{
// Appel des triggers

View File

@@ -320,7 +320,7 @@ else if ($action == 'add' && $user->rights->commande->creer)
$lines[$i]->fetch_optionals($lines[$i]->rowid);
$array_option=$lines[$i]->array_options;
}
$result = $object->addline(
$object_id,
$desc,
@@ -1535,7 +1535,7 @@ if ($action == 'create' && $user->rights->commande->creer)
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="add">';
print '<input type="hidden" name="socid" value="'.$soc->id.'">' ."\n";
print '<input type="hidden" name="remise_percent" value="'.$soc->remise_client.'">';
print '<input type="hidden" name="remise_percent" value="'.$soc->remise_percent.'">';
print '<input type="hidden" name="origin" value="'.$origin.'">';
print '<input type="hidden" name="originid" value="'.$originid.'">';
@@ -1579,7 +1579,7 @@ if ($action == 'create' && $user->rights->commande->creer)
// Ligne info remises tiers
print '<tr><td>'.$langs->trans('Discounts').'</td><td colspan="2">';
if ($soc->remise_client) print $langs->trans("CompanyHasRelativeDiscount",$soc->remise_client);
if ($soc->remise_percent) print $langs->trans("CompanyHasRelativeDiscount",$soc->remise_percent);
else print $langs->trans("CompanyHasNoRelativeDiscount");
print '. ';
$absolute_discount=$soc->getAvailableDiscounts();
@@ -1627,7 +1627,7 @@ if ($action == 'create' && $user->rights->commande->creer)
if (! empty($conf->projet->enabled) && $socid>0)
{
$formproject=new FormProjets($db);
print '<tr><td>'.$langs->trans('Project').'</td><td colspan="2">';
$numprojet=$formproject->select_projects($soc->id,$projectid);
if ($numprojet==0)
@@ -1739,7 +1739,7 @@ if ($action == 'create' && $user->rights->commande->creer)
print $form->select_produits('','idprod'.$i,'',$conf->product->limit_size);
print '</td>';
print '<td><input type="text" size="3" name="qty'.$i.'" value="1"></td>';
print '<td><input type="text" size="3" name="remise_percent'.$i.'" value="'.$soc->remise_client.'">%</td></tr>';
print '<td><input type="text" size="3" name="remise_percent'.$i.'" value="'.$soc->remise_percent.'">%</td></tr>';
}
print '</table>';
@@ -1993,7 +1993,7 @@ else
$addcreditnote='<a href="'.DOL_URL_ROOT.'/compta/facture.php?action=create&socid='.$soc->id.'&type=2&backtopage='.urlencode($_SERVER["PHP_SELF"]).'?facid='.$object->id.'">'.$langs->trans("AddCreditNote").'</a>';
print '<tr><td>'.$langs->trans('Discounts').'</td><td colspan="3">';
if ($soc->remise_client) print $langs->trans("CompanyHasRelativeDiscount",$soc->remise_client);
if ($soc->remise_percent) print $langs->trans("CompanyHasRelativeDiscount",$soc->remise_percent);
else print $langs->trans("CompanyHasNoRelativeDiscount");
print '. ';
$absolute_discount=$soc->getAvailableDiscounts('','fk_facture_source IS NULL');

View File

@@ -1127,7 +1127,7 @@ else if (($action == 'addline' || $action == 'addline_predef') && $user->rights-
$product_desc = (GETPOST('product_desc')?GETPOST('product_desc'):(GETPOST('np_desc')?GETPOST('np_desc'):(GETPOST('dp_desc')?GETPOST('dp_desc'):'')));
$price_ht = GETPOST('price_ht');
$tva_tx=(GETPOST('tva_tx')?GETPOST('tva_tx'):0);
//Extrafields
$extrafieldsline = new ExtraFields($db);
$extralabelsline =$extrafieldsline->fetch_name_optionals_label($object->table_element_line);
@@ -1424,7 +1424,7 @@ else if ($action == 'updateligne' && $user->rights->facture->creer && $_POST['sa
unset($_POST["options_".$key]);
}
}
// Check minimum price
$productid = GETPOST('productid', 'int');
@@ -2238,7 +2238,7 @@ if ($action == 'create')
{
// Discounts for third party
print '<tr><td>'.$langs->trans('Discounts').'</td><td colspan="2">';
if ($soc->remise_client) print $langs->trans("CompanyHasRelativeDiscount",'<a href="'.DOL_URL_ROOT.'/comm/remise.php?id='.$soc->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?socid='.$soc->id.'&action='.$action.'&origin='.GETPOST('origin').'&originid='.GETPOST('originid')).'">'.$soc->remise_client.'</a>');
if ($soc->remise_percent) print $langs->trans("CompanyHasRelativeDiscount",'<a href="'.DOL_URL_ROOT.'/comm/remise.php?id='.$soc->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?socid='.$soc->id.'&action='.$action.'&origin='.GETPOST('origin').'&originid='.GETPOST('originid')).'">'.$soc->remise_percent.'</a>');
else print $langs->trans("CompanyHasNoRelativeDiscount");
print ' <a href="'.DOL_URL_ROOT.'/comm/remise.php?id='.$soc->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?socid='.$soc->id.'&action='.$action.'&origin='.GETPOST('origin').'&originid='.GETPOST('originid')).'">('.$langs->trans("EditRelativeDiscount").')</a>';
print '. ';
@@ -2269,7 +2269,7 @@ if ($action == 'create')
if (! empty($conf->projet->enabled) && $socid>0)
{
$formproject=new FormProjets($db);
$langs->load('projects');
print '<tr><td>'.$langs->trans('Project').'</td><td colspan="2">';
$formproject->select_projects($soc->id, $projectid, 'projectid');
@@ -2390,7 +2390,7 @@ if ($action == 'create')
$form->select_produits('','idprod'.$i,'',$conf->product->limit_size);
print '</td>';
print '<td><input type="text" size="2" name="qty'.$i.'" value="1"></td>';
print '<td class="nowrap"><input type="text" size="1" name="remise_percent'.$i.'" value="'.$soc->remise_client.'">%</td>';
print '<td class="nowrap"><input type="text" size="1" name="remise_percent'.$i.'" value="'.$soc->remise_percent.'">%</td>';
print '<td>&nbsp;</td>';
// Si le module service est actif, on propose des dates de debut et fin a la ligne
if (! empty($conf->service->enabled))
@@ -2855,7 +2855,7 @@ else if ($id > 0 || ! empty($ref))
print '<tr><td>'.$langs->trans('Discounts');
print '</td><td colspan="5">';
if ($soc->remise_client) print $langs->trans("CompanyHasRelativeDiscount",$soc->remise_client);
if ($soc->remise_percent) print $langs->trans("CompanyHasRelativeDiscount",$soc->remise_percent);
else print $langs->trans("CompanyHasNoRelativeDiscount");
//print ' ('.$addrelativediscount.')';

View File

@@ -149,7 +149,7 @@ if ($id > 0 || ! empty($ref))
print '<tr><td>'.$langs->trans('Discounts');
print '</td><td colspan="5">';
if ($soc->remise_client) print $langs->trans("CompanyHasRelativeDiscount",$soc->remise_client);
if ($soc->remise_percent) print $langs->trans("CompanyHasRelativeDiscount",$soc->remise_percent);
else print $langs->trans("CompanyHasNoRelativeDiscount");
if ($absolute_discount > 0)

View File

@@ -181,9 +181,7 @@ class Facture extends CommonInvoice
$result=$_facrec->fetch($this->fac_rec);
$this->fk_project = $_facrec->fk_project;
$this->cond_reglement = $_facrec->cond_reglement_id;
$this->cond_reglement_id = $_facrec->cond_reglement_id;
$this->mode_reglement = $_facrec->mode_reglement_id;
$this->mode_reglement_id = $_facrec->mode_reglement_id;
$this->remise_absolue = $_facrec->remise_absolue;
$this->remise_percent = $_facrec->remise_percent;
@@ -437,7 +435,7 @@ class Facture extends CommonInvoice
if (! $error)
{
$result=$this->update_price(1);
if ($result > 0)
{
@@ -877,13 +875,10 @@ class Facture extends CommonInvoice
// Retreive all extrafield for invoice
// fetch optionals attributes and labels
if(!class_exists('Extrafields'))
require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php');
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
$extrafields=new ExtraFields($this->db);
$extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
if (count($extralabels)>0) {
$this->fetch_optionals($this->id,$extralabels);
}
$this->fetch_optionals($this->id,$extralabels);
/*
* Lines
@@ -2859,17 +2854,18 @@ class Facture extends CommonInvoice
{
dol_syslog(get_class($this)."::demande_prelevement", LOG_DEBUG);
$soc = new Societe($this->db);
$soc->id = $this->socid;
$soc->load_ban();
if ($this->statut > 0 && $this->paye == 0)
{
$sql = 'SELECT count(*)';
require_once DOL_DOCUMENT_ROOT . '/societe/class/companybankaccount.class.php';
$bac = new CompanyBankAccount($this->db);
$bac->fetch(0,$this->socid);
$sql = 'SELECT count(*)';
$sql.= ' FROM '.MAIN_DB_PREFIX.'prelevement_facture_demande';
$sql.= ' WHERE fk_facture = '.$this->id;
$sql.= ' AND traite = 0';
dol_syslot(get_clas($this)."::demande_prelevement sql=".$sql);
$resql=$this->db->query($sql);
if ($resql)
{
@@ -2893,11 +2889,12 @@ class Facture extends CommonInvoice
$sql .= ' (fk_facture, amount, date_demande, fk_user_demande, code_banque, code_guichet, number, cle_rib)';
$sql .= ' VALUES ('.$this->id;
$sql .= ",'".price2num($resteapayer)."'";
$sql .= ",".$this->db->idate($now).",".$user->id;
$sql .= ",'".$soc->bank_account->code_banque."'";
$sql .= ",'".$soc->bank_account->code_guichet."'";
$sql .= ",'".$soc->bank_account->number."'";
$sql .= ",'".$soc->bank_account->cle_rib."')";
$sql .= ",'".$this->db->idate($now)."',";
$sql .= ",".$user->id;
$sql .= ",'".$bac->code_banque."'";
$sql .= ",'".$bac->code_guichet."'";
$sql .= ",'".$bac->number."'";
$sql .= ",'".$bac->cle_rib."')";
if ( $this->db->query($sql))
{
return 1;
@@ -3185,6 +3182,7 @@ class Facture extends CommonInvoice
{
$this->nb["invoices"]=$obj->nb;
}
$this->db->free($resql);
return 1;
}
else
@@ -3522,7 +3520,7 @@ class FactureLigne extends CommonInvoiceLine
$error++;
}
}
// Si fk_remise_except defini, on lie la remise a la facture
// ce qui la flague comme "consommee".
if ($this->fk_remise_except)
@@ -3679,7 +3677,7 @@ class FactureLigne extends CommonInvoiceLine
$error++;
}
}
if (! $notrigger)
{
// Appel des triggers

View File

@@ -224,7 +224,7 @@ if ($object->id > 0)
// Discounts
print '<tr><td>'.$langs->trans('Discounts').'</td><td colspan="5">';
if ($object->thirdparty->remise_client) print $langs->trans("CompanyHasRelativeDiscount",$object->thirdparty->remise_client);
if ($object->thirdparty->remise_percent) print $langs->trans("CompanyHasRelativeDiscount",$object->thirdparty->remise_percent);
else print $langs->trans("CompanyHasNoRelativeDiscount");
print '. ';
if ($absolute_discount > 0)

View File

@@ -793,7 +793,11 @@ class BonPrelevement extends CommonObject
if (! $error)
{
// Check RIB
require_once DOL_DOCUMENT_ROOT . '/societe/class/companybankaccount.class.php';
$soc = new Societe($this->db);
$bac = new CompanyBankAccount($this->db);
// Check RIB
$i = 0;
dol_syslog("Start RIB check");
@@ -802,13 +806,12 @@ class BonPrelevement extends CommonObject
foreach ($factures as $fac)
{
$fact = new Facture($this->db);
if ($fact->fetch($fac[0]) >= 0)
{
$soc = new Societe($this->db);
if ($soc->fetch($fact->socid) >= 0)
{
if ($soc->verif_rib() == 1)
$bac->fetch(0,$soc->id);
if ($bac->verif() >= 1)
{
$factures_prev[$i] = $fac;
/* second tableau necessaire pour BonPrelevement */
@@ -816,24 +819,24 @@ class BonPrelevement extends CommonObject
$i++;
}
else
{
dol_syslog("Error on third party bank number RIB/IBAN $fact->socid $soc->nom", LOG_ERR);
$facture_errors[$fac[0]]="Error on third party bank number RIB/IBAN $fact->socid $soc->nom";
{
dol_syslog("Error on third party bank number RIB/IBAN ".$fact->socid." ".$soc->nom, LOG_ERR);
$facture_errors[$fac[0]]="Error on third party bank number RIB/IBAN ".$fact->socid." ".$soc->nom;
}
}
else
{
{
dol_syslog("Failed to read company", LOG_ERR);
}
}
else
{
{
dol_syslog("Failed to read invoice", LOG_ERR);
}
}
}
else
{
{
dol_syslog("No invoice to process");
}
}
@@ -1252,7 +1255,7 @@ class BonPrelevement extends CommonObject
$num = $this->db->num_rows($resql);
$client = new Societe($this->db);
while ($i < $num)
{
$obj = $this->db->fetch_object($resql);

View File

@@ -1531,6 +1531,7 @@ class Contrat extends CommonObject
{
$this->nb["Contracts"]=$obj->nb;
}
$this->db->free($resql);
return 1;
}
else
@@ -2071,7 +2072,7 @@ class ContratLigne
return -2;
}
}
/**
* Load elements linked to contract (only intervention for the moment)
*
@@ -2081,12 +2082,12 @@ class ContratLigne
function get_element_list($type)
{
$elements = array();
$sql = '';
if ($type == 'intervention')
$sql = "SELECT rowid FROM " . MAIN_DB_PREFIX . "fichinter WHERE fk_contrat=" . $this->id;
if (! $sql) return -1;
//print $sql;
dol_syslog(get_class($this)."::get_element_list sql=" . $sql);
$result = $this->db->query($sql);

View File

@@ -157,7 +157,7 @@ if ($id > 0 || ! empty($ref))
// Ligne info remises tiers
print '<tr><td>'.$langs->trans('Discount').'</td><td>';
if ($object->thirdparty->remise_client) print $langs->trans("CompanyHasRelativeDiscount",$object->thirdparty->remise_client);
if ($object->thirdparty->remise_percent) print $langs->trans("CompanyHasRelativeDiscount",$object->thirdparty->remise_percent);
else print $langs->trans("CompanyHasNoRelativeDiscount");
$absolute_discount=$object->thirdparty->getAvailableDiscounts();
print '. ';
@@ -169,9 +169,9 @@ if ($id > 0 || ! empty($ref))
print "</table>";
print '</div>';
print '<br>';
// Contacts lines
include DOL_DOCUMENT_ROOT.'/core/tpl/contacts.tpl.php';

View File

@@ -838,7 +838,7 @@ if ($action == 'create')
{
// Ligne info remises tiers
print '<tr><td>'.$langs->trans('Discounts').'</td><td colspan="2">';
if ($soc->remise_client) print $langs->trans("CompanyHasRelativeDiscount",$soc->remise_client);
if ($soc->remise_percent) print $langs->trans("CompanyHasRelativeDiscount",$soc->remise_percent);
else print $langs->trans("CompanyHasNoRelativeDiscount");
print '. ';
$absolute_discount=$soc->getAvailableDiscounts();
@@ -865,7 +865,7 @@ if ($action == 'create')
if (! empty($conf->projet->enabled))
{
$formproject=new FormProjets($db);
print '<tr><td>'.$langs->trans("Project").'</td><td>';
$formproject->select_projects($soc->id,$projectid,"projectid");
print "</td></tr>";
@@ -1012,7 +1012,7 @@ else
// Ligne info remises tiers
print '<tr><td>'.$langs->trans('Discount').'</td><td colspan="3">';
if ($object->thirdparty->remise_client) print $langs->trans("CompanyHasRelativeDiscount",$object->thirdparty->remise_client);
if ($object->thirdparty->remise_percent) print $langs->trans("CompanyHasRelativeDiscount",$object->thirdparty->remise_percent);
else print $langs->trans("CompanyHasNoRelativeDiscount");
$absolute_discount=$object->thirdparty->getAvailableDiscounts();
print '. ';

View File

@@ -96,7 +96,7 @@ if ($id > 0 || ! empty($ref))
// Ligne info remises tiers
print '<tr><td>'.$langs->trans('Discount').'</td><td>';
if ($object->thirdparty->remise_client) print $langs->trans("CompanyHasRelativeDiscount",$object->thirdparty->remise_client);
if ($object->thirdparty->remise_percent) print $langs->trans("CompanyHasRelativeDiscount",$object->thirdparty->remise_percent);
else print $langs->trans("CompanyHasNoRelativeDiscount");
$absolute_discount=$object->thirdparty->getAvailableDiscounts();
print '. ';

View File

@@ -176,8 +176,7 @@ abstract class CommonDocGenerator
// Retrieve extrafields
if(is_array($object->array_options) && count($object->array_options))
{
if(!class_exists('Extrafields'))
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
$extrafields = new ExtraFields($this->db);
$extralabels = $extrafields->fetch_name_optionals_label('societe',true);
$object->fetch_optionals($object->id,$extralabels);
@@ -267,8 +266,7 @@ abstract class CommonDocGenerator
// Retrieve extrafields
if(is_array($object->array_options) && count($object->array_options))
{
if(!class_exists('Extrafields'))
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
$extrafields = new ExtraFields($this->db);
$extralabels = $extrafields->fetch_name_optionals_label('propal',true);
$object->fetch_optionals($object->id,$extralabels);

View File

@@ -909,7 +909,6 @@ abstract class CommonObject
if ($this->db->query($sql))
{
$this->mode_reglement_id = $id;
$this->mode_reglement = $id; // for compatibility
return 1;
}
else
@@ -2664,7 +2663,7 @@ abstract class CommonObject
//Line extrafield
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
$extrafieldsline = new ExtraFields($this->db);
$extralabelslines=$extrafieldsline->fetch_name_optionals_label($this->table_element_line);
$extralabelslines=$extrafieldsline->fetch_name_optionals_label($this->table_element_line);
// Use global variables + $dateSelector + $seller and $buyer
include(DOL_DOCUMENT_ROOT.'/core/tpl/freeproductline_create.tpl.php');
@@ -2781,7 +2780,7 @@ abstract class CommonObject
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
$extrafieldsline = new ExtraFields($this->db);
$extralabelslines=$extrafieldsline->fetch_name_optionals_label($this->table_element_line);
foreach ($this->lines as $line)
{
//Line extrafield

View File

@@ -145,8 +145,7 @@ class doc_generic_invoice_odt extends ModelePDFFactures
// Retrieve extrafields
if(is_array($object->array_options) && count($object->array_options))
{
if(!class_exists('Extrafields'))
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
$extrafields = new ExtraFields($this->db);
$extralabels = $extrafields->fetch_name_optionals_label('facture',true);
$object->fetch_optionals($object->id,$extralabels);

View File

@@ -550,7 +550,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
$pdf->SetFont('','', $default_font_size - 2);
$pdf->SetXY($posxval, $posy);
$lib_condition_paiement=$outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code)!=('PaymentCondition'.$object->cond_reglement_code)?$outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code):$outputlangs->convToOutputCharset($object->cond_reglement_doc);
$lib_condition_paiement=$outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code)!=('PaymentCondition'.$object->cond_reglement_code)?$outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code):$outputlangs->convToOutputCharset($object->cond_reglement);
$lib_condition_paiement=str_replace('\n',"\n",$lib_condition_paiement);
$pdf->MultiCell(80, 4, $lib_condition_paiement,0,'L');

View File

@@ -69,13 +69,13 @@ if (! empty($conf->margin->enabled) && ! empty($object->element) && in_array($ob
</tr>
<tr <?php echo $bcnd[$var]; ?>>
<?php
<?php
if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
$coldisplay=2; }
else {
$coldisplay=0; }
?>
<td<?php echo (! empty($conf->global->MAIN_VIEW_LINE_NUMBER) ? ' colspan="2"' : ''); ?>>
<?php
@@ -109,7 +109,7 @@ if (! empty($conf->margin->enabled) && ! empty($object->element) && in_array($ob
<td align="right"><input type="text" size="5" name="price_ht" class="flat" value="<?php echo (isset($_POST["price_ht"])?$_POST["price_ht"]:''); ?>">
</td>
<td align="right"><input type="text" size="2" name="qty" class="flat" value="<?php echo (isset($_POST["qty"])?$_POST["qty"]:1); ?>"></td>
<td align="right" class="nowrap"><input type="text" size="1" class="flat" value="<?php echo $buyer->remise_client; ?>" name="remise_percent"><span class="hideonsmartphone">%</span></td>
<td align="right" class="nowrap"><input type="text" size="1" class="flat" value="<?php echo $buyer->remise_percent; ?>" name="remise_percent"><span class="hideonsmartphone">%</span></td>
<?php
$colspan = 4;
if (! empty($usemargins))

View File

@@ -161,8 +161,8 @@ if (! empty($conf->margin->enabled)) {
</td>
<td align="right"><input type="text" size="3" id="qty" name="qty" value="<?php echo (GETPOST('qty')?GETPOST('qty'):1); ?>"></td>
<td align="right" class="nowrap">
<input type="text" size="1" value="<?php echo $buyer->remise_client; ?>" id="remise_percent" name="remise_percent">%
<input type="hidden" id="origin_remise_percent" name="origin_remise_percent" value="<?php echo $buyer->remise_client; ?>" />
<input type="text" size="1" value="<?php echo $buyer->remise_percent; ?>" id="remise_percent" name="remise_percent">%
<input type="hidden" id="origin_remise_percent" name="origin_remise_percent" value="<?php echo $buyer->remise_percent; ?>" />
</td>
<?php
$colspan = 4;

View File

@@ -81,7 +81,7 @@ if (! empty($usemargins))
</tr>
<tr <?php echo $bcnd[$var]; ?>>
<?php
<?php
if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
$coldisplay=4; }
else {
@@ -114,7 +114,7 @@ else {
?>
</td>
<td align="right"><input type="text" size="2" name="qty" class="flat" value="1"></td>
<td align="right" nowrap><input type="text" size="1" class="flat" name="remise_percent" value="<?php echo $buyer->remise_client; ?>"><span class="hideonsmartphone">%</span></td>
<td align="right" nowrap><input type="text" size="1" class="flat" name="remise_percent" value="<?php echo $buyer->remise_percent; ?>"><span class="hideonsmartphone">%</span></td>
<?php
$colspan = 4;
if (! empty($usemargins))

View File

@@ -214,7 +214,7 @@ if ($id > 0 || ! empty($ref))
// Discounts for third party
print '<tr><td>'.$langs->trans('Discounts').'</td><td colspan="3">';
if ($soc->remise_client) print $langs->trans("CompanyHasRelativeDiscount",$soc->remise_client);
if ($soc->remise_percent) print $langs->trans("CompanyHasRelativeDiscount",$soc->remise_percent);
else print $langs->trans("CompanyHasNoRelativeDiscount");
print '. ';
$absolute_discount=$soc->getAvailableDiscounts('','fk_facture_source IS NULL');

View File

@@ -257,7 +257,7 @@ class Fichinter extends CommonObject
}
// Fin appel triggers
}
$this->db->commit();
return 1;
}
@@ -317,9 +317,7 @@ class Fichinter extends CommonObject
require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php');
$extrafields=new ExtraFields($this->db);
$extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
if (count($extralabels)>0) {
$this->fetch_optionals($this->id,$extralabels);
}
$this->fetch_optionals($this->id,$extralabels);
/*
* Lines

View File

@@ -133,6 +133,7 @@ class Fournisseur extends Societe
{
$this->nb["suppliers"]=$obj->nb;
}
$this->db->free($resql);
return 1;
}
else

View File

@@ -339,7 +339,7 @@ else if ($action == 'updateligne' && $user->rights->fournisseur->commande->creer
if ($_POST["elrowid"])
{
$line = new CommandeFournisseurLigne($db);
$res = $line->fetch($_POST["elrowid"]);
$res = $line->fetch($_POST["elrowid"]);
if (!$res) dol_print_error($db);
}
@@ -1606,7 +1606,7 @@ elseif (! empty($object->id))
print '</td>';
print '<td align="right"><input type="text" name="pu" size="5" value="'.GETPOST('pu').'"></td>';
print '<td align="right"><input type="text" name="qty" value="'.(GETPOST('qty')?GETPOST('qty'):'1').'" size="2"></td>';
print '<td align="right" class="nowrap"><input type="text" name="remise_percent" size="1" value="'.(GETPOST('remise_percent')?GETPOST('remise_percent'):$object->thirdparty->remise_client).'"><span class="hideonsmartphone">%</span></td>';
print '<td align="right" class="nowrap"><input type="text" name="remise_percent" size="1" value="'.(GETPOST('remise_percent')?GETPOST('remise_percent'):$object->thirdparty->remise_percent).'"><span class="hideonsmartphone">%</span></td>';
print '<td align="center" colspan="4"><input type="submit" class="button" value="'.$langs->trans('Add').'"></td>';
print '</tr>';
@@ -1663,7 +1663,7 @@ elseif (! empty($object->id))
print '</td>';
print '<td align="right"><input type="text" size="2" id="pqty" name="pqty" value="'.(GETPOST('pqty')?GETPOST('pqty'):'1').'"></td>';
print '<td align="right" class="nowrap"><input type="text" size="1" id="p_remise_percent" name="p_remise_percent" value="'.(GETPOST('p_remise_percent')?GETPOST('p_remise_percent'):$object->thirdparty->remise_client).'"><span class="hideonsmartphone">%</span></td>';
print '<td align="right" class="nowrap"><input type="text" size="1" id="p_remise_percent" name="p_remise_percent" value="'.(GETPOST('p_remise_percent')?GETPOST('p_remise_percent'):$object->thirdparty->remise_percent).'"><span class="hideonsmartphone">%</span></td>';
print '<td align="center" colspan="4"><input type="submit" id="addPredefinedProductButton" class="button" value="'.$langs->trans('Add').'"></td>';
print '</tr>';

View File

@@ -98,6 +98,7 @@ $langs->load("commercial");
$langs->load("bills");
$langs->load("orders");
//print memory_get_usage();
if ($user->societe_id == 0)
{
print '<br>';
@@ -209,7 +210,7 @@ if ($user->societe_id == 0)
// Search in cache if load_state_board is already realized
if (! isset($boardloaded[$classe]) || ! is_object($boardloaded[$classe]))
{
include_once $includes[$key];
include_once $includes[$key]; // Loading a class cost around 1Mb
$board=new $classe($db);
$board->load_state_board($user);
@@ -235,7 +236,6 @@ if ($user->societe_id == 0)
print '</table>';
}
print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';

View File

@@ -2983,6 +2983,7 @@ class Product extends CommonObject
{
$this->nb["products"]=$obj->nb;
}
$this->db->free($resql);
return 1;
}
else

View File

@@ -76,6 +76,7 @@ class Service extends CommonObject
{
$this->nb["services"]=$obj->nb;
}
$this->db->free($resql);
return 1;
}
else

View File

@@ -25,8 +25,7 @@ include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
/**
* \class Client
* \brief Class to manage customers
* Class to manage customers
*/
class Client extends Societe
{
@@ -74,6 +73,7 @@ class Client extends Societe
if ($obj->client == 1 || $obj->client == 3) $this->nb["customers"]+=$obj->nb;
if ($obj->client == 2 || $obj->client == 3) $this->nb["prospects"]+=$obj->nb;
}
$this->db->free($resql);
return 1;
}
else

View File

@@ -187,6 +187,25 @@ class CompanyBankAccount extends Account
}
}
/**
* Return RIB
*
* @return string RIB
*/
function getRibLabel()
{
if ($this->code_banque || $this->code_guichet || $this->number || $this->cle_rib)
{
$rib = $this->code_banque." ".$this->code_guichet." ".$this->number;
$rib.=($this->cle_rib?" (".$this->cle_rib.")":"");
}
else
{
$rib=$langs->trans("NoRIB");
}
return $rib;
}
}
?>

View File

@@ -106,9 +106,6 @@ class Societe extends CommonObject
var $remise_percent;
var $mode_reglement_id;
var $cond_reglement_id;
var $remise_client; // TODO obsolete
var $mode_reglement; // TODO obsolete
var $cond_reglement; // TODO obsolete
var $client; // 0=no customer, 1=customer, 2=prospect, 3=customer and prospect
var $prospect; // 0=no prospect, 1=prospect
@@ -829,14 +826,11 @@ class Societe extends CommonObject
$this->remise_percent = $obj->remise_client;
$this->mode_reglement_id = $obj->mode_reglement;
$this->cond_reglement_id = $obj->cond_reglement;
$this->remise_client = $obj->remise_client; // TODO obsolete
$this->mode_reglement = $obj->mode_reglement; // TODO obsolete
$this->cond_reglement = $obj->cond_reglement; // TODO obsolete
$this->client = $obj->client;
$this->fournisseur = $obj->fournisseur;
$this->note = $obj->note_private; //TODO Deprecatedfor backward comtability
$this->note = $obj->note_private; // TODO Deprecated for backward comtability
$this->note_private = $obj->note_private;
$this->note_public = $obj->note_public;
$this->default_lang = $obj->default_lang;
@@ -854,9 +848,7 @@ class Societe extends CommonObject
require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php');
$extrafields=new ExtraFields($this->db);
$extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
if (count($extralabels)>0) {
$this->fetch_optionals($this->id,$extralabels);
}
$this->fetch_optionals($this->id,$extralabels);
}
else
{
@@ -1689,50 +1681,10 @@ class Societe extends CommonObject
*/
function display_rib()
{
global $langs;
require_once DOL_DOCUMENT_ROOT . '/societe/class/companybankaccount.class.php';
$bac = new CompanyBankAccount($this->db);
$bac->fetch(0,$this->id);
if ($bac->code_banque || $bac->code_guichet || $bac->number || $bac->cle_rib)
{
$rib = $bac->code_banque." ".$bac->code_guichet." ".$bac->number;
$rib.=($bac->cle_rib?" (".$bac->cle_rib.")":"");
}
else
{
$rib=$langs->trans("NoRIB");
}
return $rib;
}
/**
* Load this->bank_account attribut
*
* @return int 1
*/
function load_ban()
{
require_once DOL_DOCUMENT_ROOT . '/societe/class/companybankaccount.class.php';
$bac = new CompanyBankAccount($this->db);
$bac->fetch(0,$this->id);
$this->bank_account = $bac;
return 1;
}
/**
* Check bank numbers
*
* @return int <0 if KO, >0 if OK
*/
function verif_rib()
{
$this->load_ban();
return $this->bank_account->verif();
return $bac->getRibLabel();
}
/**

View File

@@ -1707,10 +1707,8 @@ else
print '<table width="100%" class="nobordernopadding"><tr><td>';
print $langs->trans('RIB');
print '<td><td align="right">';
if ($user->rights->societe->creer)
print '<a href="'.DOL_URL_ROOT.'/societe/rib.php?socid='.$object->id.'">'.img_edit().'</a>';
else
print '&nbsp;';
if ($user->rights->societe->creer) print '<a href="'.DOL_URL_ROOT.'/societe/rib.php?socid='.$object->id.'">'.img_edit().'</a>';
else print '&nbsp;';
print '</td></tr></table>';
print '</td>';
print '<td colspan="3">';

View File

@@ -219,15 +219,13 @@ class User extends CommonObject
$this->contact_id = $obj->fk_socpeople;
$this->fk_member = $obj->fk_member;
$this->fk_user = $obj->fk_user;
// Retreive all extrafield for thirdparty
// fetch optionals attributes and labels
require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php');
$extrafields=new ExtraFields($this->db);
$extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
if (count($extralabels)>0) {
$this->fetch_optionals($this->id,$extralabels);
}
$this->fetch_optionals($this->id,$extralabels);
$this->db->free($result);
}
@@ -1116,7 +1114,7 @@ class User extends CommonObject
$this->address = empty($this->address)?'':$this->address;
$this->zip = empty($this->zip)?'':$this->zip;
$this->town = empty($this->town)?'':$this->town;
// Check parameters
if (! empty($conf->global->USER_MAIL_REQUIRED) && ! isValidEMail($this->email))
{
@@ -1947,7 +1945,7 @@ class User extends CommonObject
global $user,$langs;
$now=dol_now();
// Initialise parametres
$this->id=0;
$this->ref = 'SPECIMEN';