diff --git a/dev/initdata/generate-societe.php b/dev/initdata/generate-societe.php
index 9072709c738..2642750eb8a 100644
--- a/dev/initdata/generate-societe.php
+++ b/dev/initdata/generate-societe.php
@@ -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();
diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php
index 733e8cfdf74..f46a0fffb9f 100644
--- a/htdocs/adherents/class/adherent.class.php
+++ b/htdocs/adherents/class/adherent.class.php
@@ -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
diff --git a/htdocs/comm/fiche.php b/htdocs/comm/fiche.php
index 5a1a1e4bd66..c785704d456 100644
--- a/htdocs/comm/fiche.php
+++ b/htdocs/comm/fiche.php
@@ -309,11 +309,11 @@ if ($id > 0)
print '
';
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 " ";
print '';
@@ -328,11 +328,11 @@ if ($id > 0)
print '';
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 " ";
print '';
@@ -347,7 +347,7 @@ if ($id > 0)
print ''.img_edit($langs->trans("Modify")).' ';
}
print '';
- print ''.($object->remise_client?''.$object->remise_client.'% ':$langs->trans("DiscountNone")).' ';
+ print ''.($object->remise_percent?''.$object->remise_percent.'% ':$langs->trans("DiscountNone")).' ';
print '';
// Absolute discounts (Discounts-Drawbacks-Rebates)
diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php
index c93e7d6d966..eb81c4a46ae 100644
--- a/htdocs/comm/propal.php
+++ b/htdocs/comm/propal.php
@@ -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 ''.$langs->trans('Discounts').' ';
- 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 ' '.$langs->trans('PaymentConditionsShort').' ';
- $form->select_conditions_paiements($soc->cond_reglement,'cond_reglement_id');
+ $form->select_conditions_paiements($soc->cond_reglement_id,'cond_reglement_id');
print ' ';
// Mode of payment
print ''.$langs->trans('PaymentMode').' ';
- $form->select_types_paiements($soc->mode_reglement,'mode_reglement_id');
+ $form->select_types_paiements($soc->mode_reglement_id,'mode_reglement_id');
print ' ';
// 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 '';
print ' ';
- print ' % ';
+ print ' % ';
print '';
}
@@ -1624,7 +1624,7 @@ else
// Ligne info remises tiers
print ''.$langs->trans('Discounts').' ';
- 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');
diff --git a/htdocs/comm/propal/apercu.php b/htdocs/comm/propal/apercu.php
index 8972baaac88..78f57e15f14 100644
--- a/htdocs/comm/propal/apercu.php
+++ b/htdocs/comm/propal/apercu.php
@@ -97,7 +97,7 @@ if ($id > 0 || ! empty($ref))
// Ligne info remises tiers
print ' '.$langs->trans('Discounts').' ';
- 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 '. ';
diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php
index 3d325e4c540..a6f3647b45e 100644
--- a/htdocs/comm/propal/class/propal.class.php
+++ b/htdocs/comm/propal/class/propal.class.php
@@ -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
diff --git a/htdocs/comm/propal/note.php b/htdocs/comm/propal/note.php
index 09670340b89..633c0dd4cf4 100644
--- a/htdocs/comm/propal/note.php
+++ b/htdocs/comm/propal/note.php
@@ -113,7 +113,7 @@ if ($id > 0 || ! empty($ref))
// Ligne info remises tiers
print ' '.$langs->trans('Discounts').' ';
- 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 '. ';
diff --git a/htdocs/comm/prospect/class/prospect.class.php b/htdocs/comm/prospect/class/prospect.class.php
index ec0454c4847..c322d6af6d6 100644
--- a/htdocs/comm/prospect/class/prospect.class.php
+++ b/htdocs/comm/prospect/class/prospect.class.php
@@ -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
diff --git a/htdocs/comm/remise.php b/htdocs/comm/remise.php
index 306be40a5db..81bc362695e 100644
--- a/htdocs/comm/remise.php
+++ b/htdocs/comm/remise.php
@@ -114,7 +114,7 @@ if ($socid > 0)
// Remise
print ' ';
- print $langs->trans("CustomerRelativeDiscount").' '.price2num($objsoc->remise_client)."% ";
+ print $langs->trans("CustomerRelativeDiscount").''.price2num($objsoc->remise_percent)."% ";
print '';
print ' ';
@@ -130,7 +130,7 @@ if ($socid > 0)
// Nouvelle valeur
print '';
- print $langs->trans("NewValue").' remise_client).'">% ';
+ print $langs->trans("NewValue").' remise_percent).'">% ';
// Motif/Note
print '';
@@ -184,7 +184,7 @@ if ($socid > 0)
$tag = !$tag;
print ' ';
print ''.dol_print_date($db->jdate($obj->dc),"dayhour").' ';
- print ''.price2num($obj->remise_client).'% ';
+ print ''.price2num($obj->remise_percent).'% ';
print ''.$obj->note.' ';
print ''.img_object($langs->trans("ShowUser"),'user').' '.$obj->login.' ';
print ' ';
diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php
index d630a993331..8a2307aca81 100644
--- a/htdocs/commande/class/commande.class.php
+++ b/htdocs/commande/class/commande.class.php
@@ -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
diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php
index 686d148d953..2c60093ab06 100644
--- a/htdocs/commande/fiche.php
+++ b/htdocs/commande/fiche.php
@@ -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 ' ';
print ' ';
print ' ' ."\n";
- print ' ';
+ print ' ';
print ' ';
print ' ';
@@ -1579,7 +1579,7 @@ if ($action == 'create' && $user->rights->commande->creer)
// Ligne info remises tiers
print ''.$langs->trans('Discounts').' ';
- 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 ' '.$langs->trans('Project').' ';
$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 ' ';
print ' ';
- print ' % ';
+ print ' % ';
}
print '';
@@ -1993,7 +1993,7 @@ else
$addcreditnote='id.'">'.$langs->trans("AddCreditNote").' ';
print ''.$langs->trans('Discounts').' ';
- 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');
diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php
index 4e7ede6b50c..c22a0becde1 100644
--- a/htdocs/compta/facture.php
+++ b/htdocs/compta/facture.php
@@ -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 ' '.$langs->trans('Discounts').' ';
- if ($soc->remise_client) print $langs->trans("CompanyHasRelativeDiscount",'id.'&action='.$action.'&origin='.GETPOST('origin').'&originid='.GETPOST('originid')).'">'.$soc->remise_client.' ');
+ if ($soc->remise_percent) print $langs->trans("CompanyHasRelativeDiscount",'id.'&action='.$action.'&origin='.GETPOST('origin').'&originid='.GETPOST('originid')).'">'.$soc->remise_percent.' ');
else print $langs->trans("CompanyHasNoRelativeDiscount");
print ' id.'&action='.$action.'&origin='.GETPOST('origin').'&originid='.GETPOST('originid')).'">('.$langs->trans("EditRelativeDiscount").') ';
print '. ';
@@ -2269,7 +2269,7 @@ if ($action == 'create')
if (! empty($conf->projet->enabled) && $socid>0)
{
$formproject=new FormProjets($db);
-
+
$langs->load('projects');
print ' '.$langs->trans('Project').' ';
$formproject->select_projects($soc->id, $projectid, 'projectid');
@@ -2390,7 +2390,7 @@ if ($action == 'create')
$form->select_produits('','idprod'.$i,'',$conf->product->limit_size);
print ' ';
print ' ';
- print ' % ';
+ print ' % ';
print ' ';
// 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 ''.$langs->trans('Discounts');
print ' ';
- 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.')';
diff --git a/htdocs/compta/facture/apercu.php b/htdocs/compta/facture/apercu.php
index f31f0a50f0f..2adb3941595 100644
--- a/htdocs/compta/facture/apercu.php
+++ b/htdocs/compta/facture/apercu.php
@@ -149,7 +149,7 @@ if ($id > 0 || ! empty($ref))
print ' '.$langs->trans('Discounts');
print ' ';
- 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)
diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php
index ddb1f85b9fd..1e71d781e7f 100644
--- a/htdocs/compta/facture/class/facture.class.php
+++ b/htdocs/compta/facture/class/facture.class.php
@@ -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
diff --git a/htdocs/compta/facture/prelevement.php b/htdocs/compta/facture/prelevement.php
index 03af99cc6fd..51432a3e4d2 100644
--- a/htdocs/compta/facture/prelevement.php
+++ b/htdocs/compta/facture/prelevement.php
@@ -224,7 +224,7 @@ if ($object->id > 0)
// Discounts
print ' '.$langs->trans('Discounts').' ';
- 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)
diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php
index 7b2db3003dd..a1ac8052222 100644
--- a/htdocs/compta/prelevement/class/bonprelevement.class.php
+++ b/htdocs/compta/prelevement/class/bonprelevement.class.php
@@ -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);
diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php
index d0599d75ef9..58670f48676 100644
--- a/htdocs/contrat/class/contrat.class.php
+++ b/htdocs/contrat/class/contrat.class.php
@@ -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);
diff --git a/htdocs/contrat/contact.php b/htdocs/contrat/contact.php
index a05ffb6f90d..d01f01e16cc 100644
--- a/htdocs/contrat/contact.php
+++ b/htdocs/contrat/contact.php
@@ -157,7 +157,7 @@ if ($id > 0 || ! empty($ref))
// Ligne info remises tiers
print ' '.$langs->trans('Discount').' ';
- 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 "";
print '';
-
+
print ' ';
-
+
// Contacts lines
include DOL_DOCUMENT_ROOT.'/core/tpl/contacts.tpl.php';
diff --git a/htdocs/contrat/fiche.php b/htdocs/contrat/fiche.php
index 7b3432aa07e..060d9c546b0 100644
--- a/htdocs/contrat/fiche.php
+++ b/htdocs/contrat/fiche.php
@@ -838,7 +838,7 @@ if ($action == 'create')
{
// Ligne info remises tiers
print ' '.$langs->trans('Discounts').' ';
- 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 ' '.$langs->trans("Project").' ';
$formproject->select_projects($soc->id,$projectid,"projectid");
print " ";
@@ -1012,7 +1012,7 @@ else
// Ligne info remises tiers
print ''.$langs->trans('Discount').' ';
- 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 '. ';
diff --git a/htdocs/contrat/note.php b/htdocs/contrat/note.php
index c8edf493f63..e2bac1c6016 100644
--- a/htdocs/contrat/note.php
+++ b/htdocs/contrat/note.php
@@ -96,7 +96,7 @@ if ($id > 0 || ! empty($ref))
// Ligne info remises tiers
print ' '.$langs->trans('Discount').' ';
- 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 '. ';
diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php
index f00aa7be96f..1cf128cc150 100755
--- a/htdocs/core/class/commondocgenerator.class.php
+++ b/htdocs/core/class/commondocgenerator.class.php
@@ -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);
diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index 8d0e20d42d9..b8c2ab9ea35 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -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
diff --git a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php
index 4b5f472f58e..d3611f2bea8 100644
--- a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php
+++ b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php
@@ -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);
diff --git a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php
index 30f34efd219..f2292249f1e 100644
--- a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php
+++ b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php
@@ -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');
diff --git a/htdocs/core/tpl/freeproductline_create.tpl.php b/htdocs/core/tpl/freeproductline_create.tpl.php
index e0dec028baa..2c5a90f6d4e 100644
--- a/htdocs/core/tpl/freeproductline_create.tpl.php
+++ b/htdocs/core/tpl/freeproductline_create.tpl.php
@@ -69,13 +69,13 @@ if (! empty($conf->margin->enabled) && ! empty($object->element) && in_array($ob
>
- global->MAIN_VIEW_LINE_NUMBER)) {
$coldisplay=2; }
else {
$coldisplay=0; }
?>
-
+
global->MAIN_VIEW_LINE_NUMBER) ? ' colspan="2"' : ''); ?>>
margin->enabled) && ! empty($object->element) && in_array($ob
">
">
- %
+ %
margin->enabled)) {
- %
-
+ %
+
>
-global->MAIN_VIEW_LINE_NUMBER)) {
$coldisplay=4; }
else {
@@ -114,7 +114,7 @@ else {
?>
- %
+ %
0 || ! empty($ref))
// Discounts for third party
print ' '.$langs->trans('Discounts').' ';
- 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');
diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php
index 5133061a811..8da9b42b587 100644
--- a/htdocs/fichinter/class/fichinter.class.php
+++ b/htdocs/fichinter/class/fichinter.class.php
@@ -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
diff --git a/htdocs/fourn/class/fournisseur.class.php b/htdocs/fourn/class/fournisseur.class.php
index e06d1d86080..708f75a9b2a 100644
--- a/htdocs/fourn/class/fournisseur.class.php
+++ b/htdocs/fourn/class/fournisseur.class.php
@@ -133,6 +133,7 @@ class Fournisseur extends Societe
{
$this->nb["suppliers"]=$obj->nb;
}
+ $this->db->free($resql);
return 1;
}
else
diff --git a/htdocs/fourn/commande/fiche.php b/htdocs/fourn/commande/fiche.php
index 8bdd44adcf3..516a975e5ab 100644
--- a/htdocs/fourn/commande/fiche.php
+++ b/htdocs/fourn/commande/fiche.php
@@ -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 ' ';
print ' ';
print ' ';
- print '% ';
+ print '% ';
print ' ';
print ' ';
@@ -1663,7 +1663,7 @@ elseif (! empty($object->id))
print '';
print ' ';
- print '% ';
+ print '% ';
print ' ';
print '';
diff --git a/htdocs/index.php b/htdocs/index.php
index d5d0a21d9b2..5d423b18921 100644
--- a/htdocs/index.php
+++ b/htdocs/index.php
@@ -98,6 +98,7 @@ $langs->load("commercial");
$langs->load("bills");
$langs->load("orders");
+//print memory_get_usage();
if ($user->societe_id == 0)
{
print ' ';
@@ -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 '';
}
-
print '';
diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php
index 26e30b75431..0cad8a59ede 100644
--- a/htdocs/product/class/product.class.php
+++ b/htdocs/product/class/product.class.php
@@ -2983,6 +2983,7 @@ class Product extends CommonObject
{
$this->nb["products"]=$obj->nb;
}
+ $this->db->free($resql);
return 1;
}
else
diff --git a/htdocs/product/class/service.class.php b/htdocs/product/class/service.class.php
index 6ea03ad25f6..b3f96434a73 100644
--- a/htdocs/product/class/service.class.php
+++ b/htdocs/product/class/service.class.php
@@ -76,6 +76,7 @@ class Service extends CommonObject
{
$this->nb["services"]=$obj->nb;
}
+ $this->db->free($resql);
return 1;
}
else
diff --git a/htdocs/societe/class/client.class.php b/htdocs/societe/class/client.class.php
index 790584e720b..7c11b074e3b 100644
--- a/htdocs/societe/class/client.class.php
+++ b/htdocs/societe/class/client.class.php
@@ -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
diff --git a/htdocs/societe/class/companybankaccount.class.php b/htdocs/societe/class/companybankaccount.class.php
index 29e227f1cfa..add9a5f1b5c 100644
--- a/htdocs/societe/class/companybankaccount.class.php
+++ b/htdocs/societe/class/companybankaccount.class.php
@@ -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;
+ }
}
?>
diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php
index b6bee432087..6278b7bd8ab 100644
--- a/htdocs/societe/class/societe.class.php
+++ b/htdocs/societe/class/societe.class.php
@@ -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();
}
/**
diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php
index 19da5101422..87c31baeecd 100644
--- a/htdocs/societe/soc.php
+++ b/htdocs/societe/soc.php
@@ -1707,10 +1707,8 @@ else
print '
';
print $langs->trans('RIB');
print ' ';
- if ($user->rights->societe->creer)
- print ''.img_edit().' ';
- else
- print ' ';
+ if ($user->rights->societe->creer) print ''.img_edit().' ';
+ else print ' ';
print '
';
print '';
print '
';
diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php
index aa6fb883a1d..a98e5c5dbd8 100644
--- a/htdocs/user/class/user.class.php
+++ b/htdocs/user/class/user.class.php
@@ -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';