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_id=1;
$soc->country_code='FR'; $soc->country_code='FR';
// Un client sur 3 a une remise de 5% // Un client sur 3 a une remise de 5%
$user_remise=rand(1,3); if ($user_remise==3) $soc->remise_client=5; $user_remise=rand(1,3); if ($user_remise==3) $soc->remise_percent=5;
print "> client=".$soc->client.", fournisseur=".$soc->fournisseur.", remise=".$soc->remise_client."\n"; print "> client=".$soc->client.", fournisseur=".$soc->fournisseur.", remise=".$soc->remise_percent."\n";
$soc->note='Company created by the script generate-societe.php'; $soc->note='Company created by the script generate-societe.php';
$socid = $soc->create(); $socid = $soc->create();

View File

@ -1101,12 +1101,10 @@ class Adherent extends CommonObject
// Retreive all extrafield for thirdparty // Retreive all extrafield for thirdparty
// fetch optionals attributes and labels // 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); $extrafields=new ExtraFields($this->db);
$extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true); $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 // Load other properties
$result=$this->fetch_subscriptions(); $result=$this->fetch_subscriptions();
@ -1662,6 +1660,7 @@ class Adherent extends CommonObject
{ {
$this->nb["members"]=$obj->nb; $this->nb["members"]=$obj->nb;
} }
$this->db->free($resql);
return 1; return 1;
} }
else else

View File

@ -309,11 +309,11 @@ if ($id > 0)
print '</td><td colspan="3">'; print '</td><td colspan="3">';
if ($action == 'editconditions') 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 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 "</td>";
print '</tr>'; print '</tr>';
@ -328,11 +328,11 @@ if ($id > 0)
print '</td><td colspan="3">'; print '</td><td colspan="3">';
if ($action == 'editmode') 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 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 "</td>";
print '</tr>'; 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 '<a href="'.DOL_URL_ROOT.'/comm/remise.php?id='.$object->id.'">'.img_edit($langs->trans("Modify")).'</a>';
} }
print '</td></tr></table>'; 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>'; print '</tr>';
// Absolute discounts (Discounts-Drawbacks-Rebates) // Absolute discounts (Discounts-Drawbacks-Rebates)

View File

@ -1302,7 +1302,7 @@ if ($action == 'create')
// Ligne info remises tiers // Ligne info remises tiers
print '<tr><td>'.$langs->trans('Discounts').'</td><td colspan="2">'; 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"); else print $langs->trans("CompanyHasNoRelativeDiscount");
$absolute_discount=$soc->getAvailableDiscounts(); $absolute_discount=$soc->getAvailableDiscounts();
print '. '; print '. ';
@ -1322,12 +1322,12 @@ if ($action == 'create')
// Terms of payment // Terms of payment
print '<tr><td class="nowrap fieldrequired">'.$langs->trans('PaymentConditionsShort').'</td><td colspan="2">'; 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>'; print '</td></tr>';
// Mode of payment // Mode of payment
print '<tr><td>'.$langs->trans('PaymentMode').'</td><td colspan="2">'; 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>'; print '</td></tr>';
// What trigger creation // What trigger creation
@ -1476,7 +1476,7 @@ if ($action == 'create')
$form->select_produits('',"idprod".$i,'',$conf->product->limit_size); $form->select_produits('',"idprod".$i,'',$conf->product->limit_size);
print '</td>'; print '</td>';
print '<td><input type="text" size="2" name="qty'.$i.'" value="1"></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>'; print '</tr>';
} }
@ -1624,7 +1624,7 @@ else
// Ligne info remises tiers // Ligne info remises tiers
print '<tr><td>'.$langs->trans('Discounts').'</td><td colspan="5">'; 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"); else print $langs->trans("CompanyHasNoRelativeDiscount");
print '. '; print '. ';
$absolute_discount=$soc->getAvailableDiscounts('','fk_facture_source IS NULL'); $absolute_discount=$soc->getAvailableDiscounts('','fk_facture_source IS NULL');

View File

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

View File

@ -1109,13 +1109,10 @@ class Propal extends CommonObject
// Retreive all extrafield for invoice // Retreive all extrafield for invoice
// fetch optionals attributes and labels // 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); $extrafields=new ExtraFields($this->db);
$extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true); $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); $this->db->free($resql);
@ -1202,13 +1199,11 @@ class Propal extends CommonObject
// Retreive all extrafield for propal // Retreive all extrafield for propal
// fetch optionals attributes and labels // 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); $extrafields=new ExtraFields($this->db);
$extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true); $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; return 1;
} }
@ -2449,6 +2444,7 @@ class Propal extends CommonObject
{ {
$this->nb["proposals"]=$obj->nb; $this->nb["proposals"]=$obj->nb;
} }
$this->db->free($resql);
return 1; return 1;
} }
else else

View File

@ -113,7 +113,7 @@ if ($id > 0 || ! empty($ref))
// Ligne info remises tiers // Ligne info remises tiers
print '<tr><td>'.$langs->trans('Discounts').'</td><td colspan="3">'; 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"); else print $langs->trans("CompanyHasNoRelativeDiscount");
$absolute_discount=$societe->getAvailableDiscounts(); $absolute_discount=$societe->getAvailableDiscounts();
print '. '; 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 == 1 || $obj->client == 3) $this->nb["customers"]+=$obj->nb;
if ($obj->client == 2 || $obj->client == 3) $this->nb["prospects"]+=$obj->nb; if ($obj->client == 2 || $obj->client == 3) $this->nb["prospects"]+=$obj->nb;
} }
$this->db->free($resql);
return 1; return 1;
} }
else else

View File

@ -114,7 +114,7 @@ if ($socid > 0)
// Remise // Remise
print '<tr><td colspan="2" width="25%">'; 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 '</table>';
print '<br>'; print '<br>';
@ -130,7 +130,7 @@ if ($socid > 0)
// Nouvelle valeur // Nouvelle valeur
print '<tr><td colspan="2">'; 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 // Motif/Note
print '<tr><td colspan="2" width="25%">'; print '<tr><td colspan="2" width="25%">';
@ -184,7 +184,7 @@ if ($socid > 0)
$tag = !$tag; $tag = !$tag;
print '<tr '.$bc[$tag].'>'; print '<tr '.$bc[$tag].'>';
print '<td>'.dol_print_date($db->jdate($obj->dc),"dayhour").'</td>'; 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="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 '<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>'; print '</tr>';

View File

@ -1347,13 +1347,10 @@ class Commande extends CommonOrder
// Retreive all extrafield for invoice // Retreive all extrafield for invoice
// fetch optionals attributes and labels // 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); $extrafields=new ExtraFields($this->db);
$extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true); $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(); $this->db->free();
@ -2833,6 +2830,7 @@ class Commande extends CommonOrder
{ {
$this->nb["orders"]=$obj->nb; $this->nb["orders"]=$obj->nb;
} }
$this->db->free($resql);
return 1; return 1;
} }
else else

View File

@ -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="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="add">'; print '<input type="hidden" name="action" value="add">';
print '<input type="hidden" name="socid" value="'.$soc->id.'">' ."\n"; 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="origin" value="'.$origin.'">';
print '<input type="hidden" name="originid" value="'.$originid.'">'; print '<input type="hidden" name="originid" value="'.$originid.'">';
@ -1579,7 +1579,7 @@ if ($action == 'create' && $user->rights->commande->creer)
// Ligne info remises tiers // Ligne info remises tiers
print '<tr><td>'.$langs->trans('Discounts').'</td><td colspan="2">'; 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"); else print $langs->trans("CompanyHasNoRelativeDiscount");
print '. '; print '. ';
$absolute_discount=$soc->getAvailableDiscounts(); $absolute_discount=$soc->getAvailableDiscounts();
@ -1739,7 +1739,7 @@ if ($action == 'create' && $user->rights->commande->creer)
print $form->select_produits('','idprod'.$i,'',$conf->product->limit_size); print $form->select_produits('','idprod'.$i,'',$conf->product->limit_size);
print '</td>'; print '</td>';
print '<td><input type="text" size="3" name="qty'.$i.'" value="1"></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>'; 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>'; $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">'; 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"); else print $langs->trans("CompanyHasNoRelativeDiscount");
print '. '; print '. ';
$absolute_discount=$soc->getAvailableDiscounts('','fk_facture_source IS NULL'); $absolute_discount=$soc->getAvailableDiscounts('','fk_facture_source IS NULL');

View File

@ -2238,7 +2238,7 @@ if ($action == 'create')
{ {
// Discounts for third party // Discounts for third party
print '<tr><td>'.$langs->trans('Discounts').'</td><td colspan="2">'; 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"); 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 ' <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 '. '; print '. ';
@ -2390,7 +2390,7 @@ if ($action == 'create')
$form->select_produits('','idprod'.$i,'',$conf->product->limit_size); $form->select_produits('','idprod'.$i,'',$conf->product->limit_size);
print '</td>'; print '</td>';
print '<td><input type="text" size="2" name="qty'.$i.'" value="1"></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>'; print '<td>&nbsp;</td>';
// Si le module service est actif, on propose des dates de debut et fin a la ligne // Si le module service est actif, on propose des dates de debut et fin a la ligne
if (! empty($conf->service->enabled)) if (! empty($conf->service->enabled))
@ -2855,7 +2855,7 @@ else if ($id > 0 || ! empty($ref))
print '<tr><td>'.$langs->trans('Discounts'); print '<tr><td>'.$langs->trans('Discounts');
print '</td><td colspan="5">'; 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"); else print $langs->trans("CompanyHasNoRelativeDiscount");
//print ' ('.$addrelativediscount.')'; //print ' ('.$addrelativediscount.')';

View File

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

View File

@ -181,9 +181,7 @@ class Facture extends CommonInvoice
$result=$_facrec->fetch($this->fac_rec); $result=$_facrec->fetch($this->fac_rec);
$this->fk_project = $_facrec->fk_project; $this->fk_project = $_facrec->fk_project;
$this->cond_reglement = $_facrec->cond_reglement_id;
$this->cond_reglement_id = $_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->mode_reglement_id = $_facrec->mode_reglement_id;
$this->remise_absolue = $_facrec->remise_absolue; $this->remise_absolue = $_facrec->remise_absolue;
$this->remise_percent = $_facrec->remise_percent; $this->remise_percent = $_facrec->remise_percent;
@ -877,13 +875,10 @@ class Facture extends CommonInvoice
// Retreive all extrafield for invoice // Retreive all extrafield for invoice
// fetch optionals attributes and labels // 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); $extrafields=new ExtraFields($this->db);
$extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true); $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 * Lines
@ -2859,17 +2854,18 @@ class Facture extends CommonInvoice
{ {
dol_syslog(get_class($this)."::demande_prelevement", LOG_DEBUG); 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) if ($this->statut > 0 && $this->paye == 0)
{ {
require_once DOL_DOCUMENT_ROOT . '/societe/class/companybankaccount.class.php';
$bac = new CompanyBankAccount($this->db);
$bac->fetch(0,$this->socid);
$sql = 'SELECT count(*)'; $sql = 'SELECT count(*)';
$sql.= ' FROM '.MAIN_DB_PREFIX.'prelevement_facture_demande'; $sql.= ' FROM '.MAIN_DB_PREFIX.'prelevement_facture_demande';
$sql.= ' WHERE fk_facture = '.$this->id; $sql.= ' WHERE fk_facture = '.$this->id;
$sql.= ' AND traite = 0'; $sql.= ' AND traite = 0';
dol_syslot(get_clas($this)."::demande_prelevement sql=".$sql);
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if ($resql) 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 .= ' (fk_facture, amount, date_demande, fk_user_demande, code_banque, code_guichet, number, cle_rib)';
$sql .= ' VALUES ('.$this->id; $sql .= ' VALUES ('.$this->id;
$sql .= ",'".price2num($resteapayer)."'"; $sql .= ",'".price2num($resteapayer)."'";
$sql .= ",".$this->db->idate($now).",".$user->id; $sql .= ",'".$this->db->idate($now)."',";
$sql .= ",'".$soc->bank_account->code_banque."'"; $sql .= ",".$user->id;
$sql .= ",'".$soc->bank_account->code_guichet."'"; $sql .= ",'".$bac->code_banque."'";
$sql .= ",'".$soc->bank_account->number."'"; $sql .= ",'".$bac->code_guichet."'";
$sql .= ",'".$soc->bank_account->cle_rib."')"; $sql .= ",'".$bac->number."'";
$sql .= ",'".$bac->cle_rib."')";
if ( $this->db->query($sql)) if ( $this->db->query($sql))
{ {
return 1; return 1;
@ -3185,6 +3182,7 @@ class Facture extends CommonInvoice
{ {
$this->nb["invoices"]=$obj->nb; $this->nb["invoices"]=$obj->nb;
} }
$this->db->free($resql);
return 1; return 1;
} }
else else

View File

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

View File

@ -793,6 +793,10 @@ class BonPrelevement extends CommonObject
if (! $error) if (! $error)
{ {
require_once DOL_DOCUMENT_ROOT . '/societe/class/companybankaccount.class.php';
$soc = new Societe($this->db);
$bac = new CompanyBankAccount($this->db);
// Check RIB // Check RIB
$i = 0; $i = 0;
dol_syslog("Start RIB check"); dol_syslog("Start RIB check");
@ -802,13 +806,12 @@ class BonPrelevement extends CommonObject
foreach ($factures as $fac) foreach ($factures as $fac)
{ {
$fact = new Facture($this->db); $fact = new Facture($this->db);
if ($fact->fetch($fac[0]) >= 0) if ($fact->fetch($fac[0]) >= 0)
{ {
$soc = new Societe($this->db);
if ($soc->fetch($fact->socid) >= 0) if ($soc->fetch($fact->socid) >= 0)
{ {
if ($soc->verif_rib() == 1) $bac->fetch(0,$soc->id);
if ($bac->verif() >= 1)
{ {
$factures_prev[$i] = $fac; $factures_prev[$i] = $fac;
/* second tableau necessaire pour BonPrelevement */ /* second tableau necessaire pour BonPrelevement */
@ -817,8 +820,8 @@ class BonPrelevement extends CommonObject
} }
else else
{ {
dol_syslog("Error on third party bank number RIB/IBAN $fact->socid $soc->nom", LOG_ERR); 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"; $facture_errors[$fac[0]]="Error on third party bank number RIB/IBAN ".$fact->socid." ".$soc->nom;
} }
} }
else else

View File

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

View File

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

View File

@ -838,7 +838,7 @@ if ($action == 'create')
{ {
// Ligne info remises tiers // Ligne info remises tiers
print '<tr><td>'.$langs->trans('Discounts').'</td><td colspan="2">'; 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"); else print $langs->trans("CompanyHasNoRelativeDiscount");
print '. '; print '. ';
$absolute_discount=$soc->getAvailableDiscounts(); $absolute_discount=$soc->getAvailableDiscounts();
@ -1012,7 +1012,7 @@ else
// Ligne info remises tiers // Ligne info remises tiers
print '<tr><td>'.$langs->trans('Discount').'</td><td colspan="3">'; 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"); else print $langs->trans("CompanyHasNoRelativeDiscount");
$absolute_discount=$object->thirdparty->getAvailableDiscounts(); $absolute_discount=$object->thirdparty->getAvailableDiscounts();
print '. '; print '. ';

View File

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

View File

@ -176,7 +176,6 @@ abstract class CommonDocGenerator
// Retrieve extrafields // Retrieve extrafields
if(is_array($object->array_options) && count($object->array_options)) 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); $extrafields = new ExtraFields($this->db);
$extralabels = $extrafields->fetch_name_optionals_label('societe',true); $extralabels = $extrafields->fetch_name_optionals_label('societe',true);
@ -267,7 +266,6 @@ abstract class CommonDocGenerator
// Retrieve extrafields // Retrieve extrafields
if(is_array($object->array_options) && count($object->array_options)) 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); $extrafields = new ExtraFields($this->db);
$extralabels = $extrafields->fetch_name_optionals_label('propal',true); $extralabels = $extrafields->fetch_name_optionals_label('propal',true);

View File

@ -909,7 +909,6 @@ abstract class CommonObject
if ($this->db->query($sql)) if ($this->db->query($sql))
{ {
$this->mode_reglement_id = $id; $this->mode_reglement_id = $id;
$this->mode_reglement = $id; // for compatibility
return 1; return 1;
} }
else else

View File

@ -145,7 +145,6 @@ class doc_generic_invoice_odt extends ModelePDFFactures
// Retrieve extrafields // Retrieve extrafields
if(is_array($object->array_options) && count($object->array_options)) 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); $extrafields = new ExtraFields($this->db);
$extralabels = $extrafields->fetch_name_optionals_label('facture',true); $extralabels = $extrafields->fetch_name_optionals_label('facture',true);

View File

@ -550,7 +550,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
$pdf->SetFont('','', $default_font_size - 2); $pdf->SetFont('','', $default_font_size - 2);
$pdf->SetXY($posxval, $posy); $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); $lib_condition_paiement=str_replace('\n',"\n",$lib_condition_paiement);
$pdf->MultiCell(80, 4, $lib_condition_paiement,0,'L'); $pdf->MultiCell(80, 4, $lib_condition_paiement,0,'L');

View File

@ -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 align="right"><input type="text" size="5" name="price_ht" class="flat" value="<?php echo (isset($_POST["price_ht"])?$_POST["price_ht"]:''); ?>">
</td> </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"><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 <?php
$colspan = 4; $colspan = 4;
if (! empty($usemargins)) if (! empty($usemargins))

View File

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

View File

@ -114,7 +114,7 @@ else {
?> ?>
</td> </td>
<td align="right"><input type="text" size="2" name="qty" class="flat" value="1"></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 <?php
$colspan = 4; $colspan = 4;
if (! empty($usemargins)) if (! empty($usemargins))

View File

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

View File

@ -317,9 +317,7 @@ class Fichinter extends CommonObject
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); $extrafields=new ExtraFields($this->db);
$extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true); $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 * Lines

View File

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

View File

@ -1606,7 +1606,7 @@ elseif (! empty($object->id))
print '</td>'; 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="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"><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 '<td align="center" colspan="4"><input type="submit" class="button" value="'.$langs->trans('Add').'"></td>';
print '</tr>'; print '</tr>';
@ -1663,7 +1663,7 @@ elseif (! empty($object->id))
print '</td>'; 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"><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 '<td align="center" colspan="4"><input type="submit" id="addPredefinedProductButton" class="button" value="'.$langs->trans('Add').'"></td>';
print '</tr>'; print '</tr>';

View File

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

View File

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

View File

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

View File

@ -25,8 +25,7 @@ include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
/** /**
* \class Client * Class to manage customers
* \brief Class to manage customers
*/ */
class Client extends Societe 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 == 1 || $obj->client == 3) $this->nb["customers"]+=$obj->nb;
if ($obj->client == 2 || $obj->client == 3) $this->nb["prospects"]+=$obj->nb; if ($obj->client == 2 || $obj->client == 3) $this->nb["prospects"]+=$obj->nb;
} }
$this->db->free($resql);
return 1; return 1;
} }
else 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 $remise_percent;
var $mode_reglement_id; var $mode_reglement_id;
var $cond_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 $client; // 0=no customer, 1=customer, 2=prospect, 3=customer and prospect
var $prospect; // 0=no prospect, 1=prospect var $prospect; // 0=no prospect, 1=prospect
@ -829,14 +826,11 @@ class Societe extends CommonObject
$this->remise_percent = $obj->remise_client; $this->remise_percent = $obj->remise_client;
$this->mode_reglement_id = $obj->mode_reglement; $this->mode_reglement_id = $obj->mode_reglement;
$this->cond_reglement_id = $obj->cond_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->client = $obj->client;
$this->fournisseur = $obj->fournisseur; $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_private = $obj->note_private;
$this->note_public = $obj->note_public; $this->note_public = $obj->note_public;
$this->default_lang = $obj->default_lang; $this->default_lang = $obj->default_lang;
@ -854,10 +848,8 @@ class Societe extends CommonObject
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); $extrafields=new ExtraFields($this->db);
$extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true); $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 else
{ {
$this->error='Fetch no third party found for id='.$rowid; $this->error='Fetch no third party found for id='.$rowid;
@ -1689,50 +1681,10 @@ class Societe extends CommonObject
*/ */
function display_rib() function display_rib()
{ {
global $langs;
require_once DOL_DOCUMENT_ROOT . '/societe/class/companybankaccount.class.php'; require_once DOL_DOCUMENT_ROOT . '/societe/class/companybankaccount.class.php';
$bac = new CompanyBankAccount($this->db); $bac = new CompanyBankAccount($this->db);
$bac->fetch(0,$this->id); $bac->fetch(0,$this->id);
return $bac->getRibLabel();
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();
} }
/** /**

View File

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

View File

@ -225,9 +225,7 @@ class User extends CommonObject
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); $extrafields=new ExtraFields($this->db);
$extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true); $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); $this->db->free($result);
} }