diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php
index 6ecb4045386..98d971acbd0 100644
--- a/htdocs/adherents/class/adherent.class.php
+++ b/htdocs/adherents/class/adherent.class.php
@@ -1565,6 +1565,8 @@ class Adherent extends CommonObject
$result='';
$label = '' . $langs->trans("ShowMember") . '';
$label.= '
' . $langs->trans('Ref') . ': ' . $this->ref;
+ if (! empty($this->firstname) || ! empty($this->lastname))
+ $label.= '
' . $langs->trans('Name') . ': ' . $this->getFullName($langs);
$linkclose = '" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
if ($option == 'card')
diff --git a/htdocs/core/boxes/box_actions.php b/htdocs/core/boxes/box_actions.php
index 8ccf34b0f6b..2b251a6599f 100644
--- a/htdocs/core/boxes/box_actions.php
+++ b/htdocs/core/boxes/box_actions.php
@@ -90,8 +90,8 @@ class box_actions extends ModeleBoxes
$delay_warning = $conf->global->MAIN_DELAY_ACTIONS_TODO*24*60*60;
$num = $db->num_rows($result);
- $i = 0;
- while ($i < $num) {
+ $line = 0;
+ while ($line < $num) {
$late = '';
$objp = $db->fetch_object($result);
$datelimite = $db->jdate($objp->dp);
@@ -109,39 +109,39 @@ class box_actions extends ModeleBoxes
$label = empty($objp->label)?$objp->type_label:$objp->label;
$tooltip = $langs->trans('Action'.$objp->code).': '.$label;
- $this->info_box_contents[$i][] = array(
+ $this->info_box_contents[$line][] = array(
'td' => 'align="left"',
'text' => $actionstatic->getNomUrl(1),
'text2'=> $late,
'asis' => 1,
);
- $this->info_box_contents[$i][] = array(
+ $this->info_box_contents[$line][] = array(
'td' => 'align="left"',
'text' => $societestatic->getNomUrl(1),
'asis' => 1,
);
- $this->info_box_contents[$i][] = array(
+ $this->info_box_contents[$line][] = array(
'td' => 'align="left" class="nowrap"',
'text' => dol_print_date($datelimite, "dayhour"),
);
- $this->info_box_contents[$i][] = array(
+ $this->info_box_contents[$line][] = array(
'td' => 'align="right"',
'text' => ($objp->percentage>= 0?$objp->percentage.'%':''),
);
- $this->info_box_contents[$i][] = array(
+ $this->info_box_contents[$line][] = array(
'td' => 'align="right" width="18"',
'text' => $actionstatic->LibStatut($objp->percentage,3),
);
- $i++;
+ $line++;
}
if ($num==0)
- $this->info_box_contents[$i][0] = array(
+ $this->info_box_contents[$line][0] = array(
'td' => 'align="center"',
'text'=>$langs->trans("NoActionsToDo"),
);
@@ -184,23 +184,23 @@ class box_actions extends ModeleBoxes
{
print '
';
print img_object("",$logo);
diff --git a/htdocs/core/boxes/box_activity.php b/htdocs/core/boxes/box_activity.php
index 882ac65ef11..66753f10f04 100644
--- a/htdocs/core/boxes/box_activity.php
+++ b/htdocs/core/boxes/box_activity.php
@@ -73,7 +73,7 @@ class box_activity extends ModeleBoxes
$totalMnt = 0;
$totalnb = 0;
- $i = 0;
+ $line = 0;
$cachetime = 3600;
$fileid = '-e'.$conf->entity.'-u'.$user->id.'-s'.$user->societe_id.'-r'.($user->rights->societe->client->voir?'1':'0').'.cache';
$now = dol_now();
@@ -132,28 +132,28 @@ class box_activity extends ModeleBoxes
}
if (! empty($data)) {
$j=0;
- while ($i < count($data)) {
+ while ($line < count($data)) {
$billurl="viewstatut=2&paye=1&year=".$data[$j]->annee;
- $this->info_box_contents[$i][0] = array(
+ $this->info_box_contents[$line][0] = array(
'td' => 'align="left" width="16"',
'tooltip' => $langs->trans('Bills').' '.$facturestatic->LibStatut(1,$data[$j]->fk_statut,0),
'url' => DOL_URL_ROOT."/compta/facture/list.php?".$billurl."&mainmenu=accountancy&leftmenu=customers_bills",
'logo' => 'bill',
);
- $this->info_box_contents[$i][1] = array(
+ $this->info_box_contents[$line][1] = array(
'td' => 'align="left"',
'text' => $langs->trans("Bills")." ".$facturestatic->LibStatut(1,$data[$j]->fk_statut,0)." ".$data[$j]->annee,
);
- $this->info_box_contents[$i][2] = array(
+ $this->info_box_contents[$line][2] = array(
'td' => 'align="right"',
'tooltip' => $langs->trans('Bills').' '.$facturestatic->LibStatut(1,$data[$j]->fk_statut,0),
'text' => $data[$j]->nb,
'url' => DOL_URL_ROOT."/compta/facture/list.php?".$billurl."&mainmenu=accountancy&leftmenu=customers_bills",
);
- $this->info_box_contents[$i][3] = array(
+ $this->info_box_contents[$line][3] = array(
'td' => 'align="right"',
'text' => price($data[$j]->Mnttot,1,$langs,0,0,-1,$conf->currency)
);
@@ -163,15 +163,15 @@ class box_activity extends ModeleBoxes
$totalnb += $data[$j]->nb;
$totalMnt += $data[$j]->Mnttot;
}
- $this->info_box_contents[$i][4] = array(
+ $this->info_box_contents[$line][4] = array(
'td' => 'align="right" width="18"',
'text' => $facturestatic->LibStatut(1,$data[$j]->fk_statut,3),
);
- $i++;
+ $line++;
$j++;
}
if (count($data)==0)
- $this->info_box_contents[$i][0] = array(
+ $this->info_box_contents[$line][0] = array(
'td' => 'align="center"',
'text'=>$langs->trans("NoRecordedInvoices"),
);
@@ -193,7 +193,7 @@ class box_activity extends ModeleBoxes
$result = $db->query($sql);
if ($result) {
- $num = $db->num_rows($result) + $i;
+ $num = $db->num_rows($result) + $line;
$j=0;
while ($j < $num) {
$data[$j]=$db->fetch_object($result);
@@ -212,41 +212,41 @@ class box_activity extends ModeleBoxes
if (! empty($data)) {
$j=0;
- while ($i < count($data)) {
+ while ($line < count($data)) {
$billurl="viewstatut=".$data[$j]->fk_statut."&paye=0";
- $this->info_box_contents[$i][0] = array(
+ $this->info_box_contents[$line][0] = array(
'td' => 'align="left" width="16"',
'tooltip' => $langs->trans('Bills').' '.$facturestatic->LibStatut(0,$data[$j]->fk_statut,0),
'url' => DOL_URL_ROOT."/compta/facture/list.php?".$billurl."&mainmenu=accountancy&leftmenu=customers_bills",
'logo' => 'bill',
);
- $this->info_box_contents[$i][1] = array(
+ $this->info_box_contents[$line][1] = array(
'td' => 'align="left"',
'text' => $langs->trans("Bills")." ".$facturestatic->LibStatut(0,$data[$j]->fk_statut,0),
);
- $this->info_box_contents[$i][2] = array(
+ $this->info_box_contents[$line][2] = array(
'td' => 'align="right"',
'text' => $data[$j]->nb,
'tooltip' => $langs->trans('Bills').' '.$facturestatic->LibStatut(0,$data[$j]->fk_statut,0),
'url' => DOL_URL_ROOT."/compta/facture/list.php?".$billurl."&mainmenu=accountancy&leftmenu=customers_bills",
);
$totalnb += $data[$j]->nb;
- $this->info_box_contents[$i][3] = array(
+ $this->info_box_contents[$line][3] = array(
'td' => 'align="right"',
'text' => price($data[$j]->Mnttot,1,$langs,0,0,-1,$conf->currency),
);
$totalMnt += $objp->Mnttot;
- $this->info_box_contents[$i][4] = array(
+ $this->info_box_contents[$line][4] = array(
'td' => 'align="right" width="18"',
'text' => $facturestatic->LibStatut(0,$data[$j]->fk_statut,3),
);
- $i++;
+ $line++;
$j++;
}
if ($num==0)
- $this->info_box_contents[$i][0] = array(
+ $this->info_box_contents[$line][0] = array(
'td' => 'align="center"',
'text'=>$langs->trans("NoRecordedInvoices"),
);
@@ -286,7 +286,7 @@ class box_activity extends ModeleBoxes
$result = $db->query($sql);
if ($result) {
- $num = $db->num_rows($result) + $i;
+ $num = $db->num_rows($result) + $line;
$j=0;
while ($j < $num) {
$data[$j]=$db->fetch_object($result);
@@ -304,20 +304,20 @@ class box_activity extends ModeleBoxes
}
if (! empty($data)) {
$j=0;
- while ($i < count($data)) {
- $this->info_box_contents[$i][0] = array(
+ while ($line < count($data)) {
+ $this->info_box_contents[$line][0] = array(
'td' => 'align="left" width="16"',
'url' => DOL_URL_ROOT."/commande/list.php?mainmenu=commercial&leftmenu=orders&viewstatut=".$data[$j]->fk_statut,
'tooltip' => $langs->trans("Orders")." ".$commandestatic->LibStatut($data[$j]->fk_statut,0,0),
'logo' => 'object_order',
);
- $this->info_box_contents[$i][1] = array(
+ $this->info_box_contents[$line][1] = array(
'td' => 'align="left"',
'text' =>$langs->trans("Orders")." ".$commandestatic->LibStatut($data[$j]->fk_statut,0,0),
);
- $this->info_box_contents[$i][2] = array(
+ $this->info_box_contents[$line][2] = array(
'td' => 'align="right"',
'text' => $data[$j]->nb,
'tooltip' => $langs->trans("Orders")." ".$commandestatic->LibStatut($data[$j]->fk_statut,0,0),
@@ -325,17 +325,17 @@ class box_activity extends ModeleBoxes
);
$totalnb += $data[$j]->nb;
- $this->info_box_contents[$i][3] = array(
+ $this->info_box_contents[$line][3] = array(
'td' => 'align="right"',
'text' => price($data[$j]->Mnttot,1,$langs,0,0,-1,$conf->currency),
);
$totalMnt += $data[$j]->Mnttot;
- $this->info_box_contents[$i][4] = array(
+ $this->info_box_contents[$line][4] = array(
'td' => 'align="right" width="18"',
'text' => $commandestatic->LibStatut($data[$j]->fk_statut,0,3),
);
- $i++;
+ $line++;
$j++;
}
}
@@ -367,7 +367,7 @@ class box_activity extends ModeleBoxes
$result = $db->query($sql);
if ($result) {
- $num = $db->num_rows($result) + $i;
+ $num = $db->num_rows($result) + $line;
$j=0;
while ($j < $num) {
$data[$j]=$db->fetch_object($result);
@@ -385,8 +385,8 @@ class box_activity extends ModeleBoxes
}
if (! empty($data)) {
$j=0;
- while ($i < count($data)) {
- $this->info_box_contents[$i][] = array(
+ while ($line < count($data)) {
+ $this->info_box_contents[$line][] = array(
'td' => 'align="left" width="16"',
'url' => DOL_URL_ROOT."/comm/propal/list.php?mainmenu=commercial&leftmenu=propals&viewstatut=".$data[$j]->fk_statut,
'tooltip' => $langs->trans("Proposals")." ".$propalstatic->LibStatut($data[$j]->fk_statut,0),
@@ -394,12 +394,12 @@ class box_activity extends ModeleBoxes
);
$objp = $db->fetch_object($result);
- $this->info_box_contents[$i][] = array(
+ $this->info_box_contents[$line][] = array(
'td' => 'align="left"',
'text' => $langs->trans("Proposals")." ".$propalstatic->LibStatut($data[$j]->fk_statut,0),
);
- $this->info_box_contents[$i][] = array(
+ $this->info_box_contents[$line][] = array(
'td' => 'align="right"',
'text' => $data[$j]->nb,
'tooltip' => $langs->trans("Proposals")." ".$propalstatic->LibStatut($data[$j]->fk_statut,0),
@@ -407,40 +407,40 @@ class box_activity extends ModeleBoxes
);
$totalnb += $data[$j]->nb;
- $this->info_box_contents[$i][] = array(
+ $this->info_box_contents[$line][] = array(
'td' => 'align="right"',
'text' => price($data[$j]->Mnttot,1,$langs,0,0,-1,$conf->currency),
);
$totalMnt += $data[$j]->Mnttot;
- $this->info_box_contents[$i][] = array(
+ $this->info_box_contents[$line][] = array(
'td' => 'align="right" width="18"',
'text' => $propalstatic->LibStatut($data[$j]->fk_statut,3),
);
- $i++;
+ $line++;
$j++;
}
}
}
// Add the sum in the bottom of the boxes
- $this->info_box_contents[$i][1] = array(
+ $this->info_box_contents[$line][1] = array(
'td' => 'align="left" ',
'text' => $langs->trans("Total")." ".$textHead,
);
- $this->info_box_contents[$i][2] = array(
+ $this->info_box_contents[$line][2] = array(
'td' => 'align="right" ',
'text' => $totalnb,
);
- $this->info_box_contents[$i][3] = array(
+ $this->info_box_contents[$line][3] = array(
'td' => 'align="right" ',
'text' => price($totalMnt,1,$langs,0,0,-1,$conf->currency)
);
- $this->info_box_contents[$i][4] = array(
+ $this->info_box_contents[$line][4] = array(
'td' => 'align="right" ',
'text' => "",
);
- $this->info_box_contents[$i][5] = array(
+ $this->info_box_contents[$line][5] = array(
'td' => 'align="right"',
'text' => "",
);
diff --git a/htdocs/core/boxes/box_bookmarks.php b/htdocs/core/boxes/box_bookmarks.php
index cc65536ce3f..88adb744ceb 100644
--- a/htdocs/core/boxes/box_bookmarks.php
+++ b/htdocs/core/boxes/box_bookmarks.php
@@ -81,19 +81,19 @@ class box_bookmarks extends ModeleBoxes
{
$num = $db->num_rows($result);
- $i = 0;
+ $line = 0;
- while ($i < $num) {
+ while ($line < $num) {
$objp = $db->fetch_object($result);
- $this->info_box_contents[$i][0] = array(
+ $this->info_box_contents[$line][0] = array(
'td' => 'align="left" width="16"',
'logo' => $this->boximg,
'url' => $objp->url,
'tooltip' => $objp->title,
'target' => $objp->target?'newtab':'',
);
- $this->info_box_contents[$i][1] = array(
+ $this->info_box_contents[$line][1] = array(
'td' => 'align="left"',
'text' => $objp->title,
'url' => $objp->url,
@@ -101,13 +101,13 @@ class box_bookmarks extends ModeleBoxes
'target' => $objp->target?'newtab':'',
);
- $i++;
+ $line++;
}
if ($num==0) {
$mytxt=$langs->trans("NoRecordedBookmarks");
if ($user->rights->bookmark->creer) $mytxt.=' '.$langs->trans("ClickToAdd");
- $this->info_box_contents[$i][0] = array(
+ $this->info_box_contents[$line][0] = array(
'td' => 'align="center" colspan="2"',
'tooltip' => $mytxt,
'url'=> DOL_URL_ROOT.'/bookmarks/list.php', 'text'=>$mytxt,
diff --git a/htdocs/core/boxes/box_clients.php b/htdocs/core/boxes/box_clients.php
index bd331faadae..2cd5922d784 100644
--- a/htdocs/core/boxes/box_clients.php
+++ b/htdocs/core/boxes/box_clients.php
@@ -104,8 +104,8 @@ class box_clients extends ModeleBoxes
if (empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) $url= DOL_URL_ROOT."/comm/card.php?socid=";
else $url= DOL_URL_ROOT."/societe/soc.php?socid=";
- $i = 0;
- while ($i < $num)
+ $line = 0;
+ while ($line < $num)
{
$objp = $db->fetch_object($result);
$datec=$db->jdate($objp->datec);
@@ -118,26 +118,26 @@ class box_clients extends ModeleBoxes
$thirdpartystatic->fournisseur = $objp->fournisseur;
$thirdpartystatic->logo = $objp->logo;
- $this->info_box_contents[$i][] = array(
+ $this->info_box_contents[$line][] = array(
'td' => 'align="left"',
'text' => $thirdpartystatic->getNomUrl(1),
'asis' => 1,
);
- $this->info_box_contents[$i][] = array(
+ $this->info_box_contents[$line][] = array(
'td' => 'align="right"',
'text' => dol_print_date($datem, "day")
);
- $this->info_box_contents[$i][] = array(
+ $this->info_box_contents[$line][] = array(
'td' => 'align="right" width="18"',
'text' => $thirdpartystatic->LibStatut($objp->status,3)
);
- $i++;
+ $line++;
}
- if ($num==0) $this->info_box_contents[$i][0] = array('td' => 'align="center"','text'=>$langs->trans("NoRecordedCustomers"));
+ if ($num==0) $this->info_box_contents[$line][0] = array('td' => 'align="center"','text'=>$langs->trans("NoRecordedCustomers"));
$db->free($result);
}
diff --git a/htdocs/core/boxes/box_commandes.php b/htdocs/core/boxes/box_commandes.php
index 796cdc53f15..53e3aaf2861 100644
--- a/htdocs/core/boxes/box_commandes.php
+++ b/htdocs/core/boxes/box_commandes.php
@@ -97,9 +97,9 @@ class box_commandes extends ModeleBoxes
if ($result) {
$num = $db->num_rows($result);
- $i = 0;
+ $line = 0;
- while ($i < $num) {
+ while ($line < $num) {
$objp = $db->fetch_object($result);
$date=$db->jdate($objp->date_commande);
$datem=$db->jdate($objp->tms);
@@ -114,46 +114,46 @@ class box_commandes extends ModeleBoxes
$societestatic->code_client = $objp->code_client;
$societestatic->logo = $objp->logo;
- $this->info_box_contents[$i][] = array(
+ $this->info_box_contents[$line][] = array(
'td' => 'align="left"',
'text' => $commandestatic->getNomUrl(1),
'asis' => 1,
);
- $this->info_box_contents[$i][] = array(
+ $this->info_box_contents[$line][] = array(
'td' => 'align="left"',
'text' => $societestatic->getNomUrl(1),
'asis' => 1,
);
- $this->info_box_contents[$i][] = array(
+ $this->info_box_contents[$line][] = array(
'td' => 'align="right"',
'text' => price($objp->total_ht),
);
if (! empty($conf->global->ORDER_BOX_LAST_ORDERS_SHOW_VALIDATE_USER)) {
if ($objp->fk_user_valid > 0) $userstatic->fetch($objp->fk_user_valid);
- $this->info_box_contents[$i][] = array(
+ $this->info_box_contents[$line][] = array(
'td' => 'align="right"',
'text' => (($objp->fk_user_valid > 0)?$userstatic->getNomUrl(1):''),
'asis' => 1,
);
}
- $this->info_box_contents[$i][] = array(
+ $this->info_box_contents[$line][] = array(
'td' => 'align="right"',
'text' => dol_print_date($date,'day'),
);
- $this->info_box_contents[$i][] = array(
+ $this->info_box_contents[$line][] = array(
'td' => 'align="right" width="18"',
'text' => $commandestatic->LibStatut($objp->fk_statut,$objp->facture,3),
);
- $i++;
+ $line++;
}
- if ($num==0) $this->info_box_contents[$i][0] = array('td' => 'align="center"','text'=>$langs->trans("NoRecordedOrders"));
+ if ($num==0) $this->info_box_contents[$line][0] = array('td' => 'align="center"','text'=>$langs->trans("NoRecordedOrders"));
$db->free($result);
} else {
diff --git a/htdocs/core/boxes/box_comptes.php b/htdocs/core/boxes/box_comptes.php
index 752ddfafe1f..178851466be 100644
--- a/htdocs/core/boxes/box_comptes.php
+++ b/htdocs/core/boxes/box_comptes.php
@@ -95,11 +95,11 @@ class box_comptes extends ModeleBoxes
if ($result) {
$num = $db->num_rows($result);
- $i = 0;
+ $line = 0;
$solde_total = array();
$account_static = new Account($db);
- while ($i < $num) {
+ while ($line < $num) {
$objp = $db->fetch_object($result);
$account_static->id = $objp->rowid;
@@ -109,42 +109,42 @@ class box_comptes extends ModeleBoxes
$solde_total[$objp->currency_code] += $solde;
- $this->info_box_contents[$i][] = array(
+ $this->info_box_contents[$line][] = array(
'td' => 'align="left"',
'text' => $account_static->getNomUrl(1),
'asis' => 1,
);
- $this->info_box_contents[$i][] = array(
+ $this->info_box_contents[$line][] = array(
'td' => 'align="left"',
'text' => $objp->number,
);
- $this->info_box_contents[$i][] = array(
+ $this->info_box_contents[$line][] = array(
'td' => 'align="right"',
'text' => price($solde, 0, $langs, 0, -1, -1, $objp->currency_code)
);
- $i++;
+ $line++;
}
// Total
foreach ($solde_total as $key=>$solde) {
- $this->info_box_contents[$i][] = array(
+ $this->info_box_contents[$line][] = array(
'tr' => 'class="liste_total"',
'td' => 'align="left" class="liste_total"',
'text' => $langs->trans('Total').' '.$key,
);
- $this->info_box_contents[$i][] = array(
+ $this->info_box_contents[$line][] = array(
'td' => 'align="right" class="liste_total"',
'text' => ' '
);
- $this->info_box_contents[$i][] = array(
+ $this->info_box_contents[$line][] = array(
'td' => 'align="right" class="liste_total"',
'text' => price($solde, 0, $langs, 0, -1, -1, $key)
);
- $i++;
+ $line++;
}
$db->free($result);
diff --git a/htdocs/core/boxes/box_contacts.php b/htdocs/core/boxes/box_contacts.php
index a7abde7494b..fdd5f725883 100644
--- a/htdocs/core/boxes/box_contacts.php
+++ b/htdocs/core/boxes/box_contacts.php
@@ -62,14 +62,15 @@ class box_contacts extends ModeleBoxes
if ($user->rights->societe->lire)
{
- $sql = "SELECT sp.rowid, sp.lastname, sp.firstname, sp.civility as civility_id, sp.datec, sp.tms, sp.fk_soc,";
- $sql.= " s.nom as socname";
+ $sql = "SELECT sp.rowid, sp.lastname, sp.firstname, sp.civility as civility_id, sp.datec, sp.tms, sp.fk_soc";
+ $sql.= ", s.nom as socname";
+ $sql.= ", s.code_client";
$sql.= " FROM ".MAIN_DB_PREFIX."socpeople as sp";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON sp.fk_soc = s.rowid";
if (! $user->rights->societe->client->voir && ! $user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE sp.entity IN (".getEntity('societe', 1).")";
if (! $user->rights->societe->client->voir && ! $user->societe_id) $sql.= " AND sp.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
- if ($user->societe_id) $sql.= " AND sp.fk_soc = $user->societe_id";
+ if ($user->societe_id) $sql.= " AND sp.fk_soc = ".$user->societe_id;
$sql.= " ORDER BY sp.tms DESC";
$sql.= $db->plimit($max, 0);
@@ -80,8 +81,8 @@ class box_contacts extends ModeleBoxes
$contactstatic=new Contact($db);
$societestatic=new Societe($db);
- $i = 0;
- while ($i < $num) {
+ $line = 0;
+ while ($line < $num) {
$objp = $db->fetch_object($result);
$datec=$db->jdate($objp->datec);
$datem=$db->jdate($objp->tms);
@@ -90,31 +91,32 @@ class box_contacts extends ModeleBoxes
$contactstatic->firstname=$objp->firstname;
$contactstatic->civility_id=$objp->civility_id;
- $societestatic->id=$objp->fk_soc;
- $societestatic->name=$objp->socname;
+ $societestatic->id = $objp->fk_soc;
+ $societestatic->code_client = $objp->code_client;
+ $societestatic->name = $objp->socname;
- $this->info_box_contents[$i][] = array(
+ $this->info_box_contents[$line][] = array(
'td' => 'align="left"',
'text' => $contactstatic->getNomUrl(1),
'asis' => 1,
);
- $this->info_box_contents[$i][] = array(
+ $this->info_box_contents[$line][] = array(
'td' => 'align="left"',
'text' => $societestatic->getNomUrl(1),
'asis' => 1,
);
- $this->info_box_contents[$i][] = array(
+ $this->info_box_contents[$line][] = array(
'td' => 'align="right"',
'text' => dol_print_date($datem, "day"),
);
- $i++;
+ $line++;
}
if ($num==0)
- $this->info_box_contents[$i][0] = array(
+ $this->info_box_contents[$line][0] = array(
'td' => 'align="center"',
'text'=>$langs->trans("NoRecordedContacts"),
);
diff --git a/htdocs/core/boxes/box_contracts.php b/htdocs/core/boxes/box_contracts.php
index c72916e9f51..58b5dc7f1fa 100644
--- a/htdocs/core/boxes/box_contracts.php
+++ b/htdocs/core/boxes/box_contracts.php
@@ -78,9 +78,9 @@ class box_contracts extends ModeleBoxes
$num = $db->num_rows($resql);
$now=dol_now();
- $i = 0;
+ $line = 0;
- while ($i < $num) {
+ while ($line < $num) {
$objp = $db->fetch_object($resql);
$datec=$db->jdate($objp->datec);
$dateterm=$db->jdate($objp->fin_validite);
@@ -94,14 +94,14 @@ class box_contracts extends ModeleBoxes
// fin_validite is no more on contract but on services
// if ($objp->fk_statut == 1 && $dateterm < ($now - $conf->contrat->cloture->warning_delay)) { $late = img_warning($langs->trans("Late")); }
- $this->info_box_contents[$i][0] = array(
+ $this->info_box_contents[$line][] = array(
'td' => 'align="left" width="16"',
'logo' => $this->boximg,
'tooltip' => $langs->trans('Contract').': '.($objp->ref?$objp->ref:$objp->rowid),
'url' => DOL_URL_ROOT."/contrat/card.php?id=".$objp->rowid,
);
- $this->info_box_contents[$i][1] = array(
+ $this->info_box_contents[$line][] = array(
'td' => 'align="left"',
'text' => ($objp->ref?$objp->ref:$objp->rowid), // Some contracts have no ref
'tooltip' => $langs->trans('Contract').': '.($objp->ref?$objp->ref:$objp->rowid),
@@ -109,36 +109,36 @@ class box_contracts extends ModeleBoxes
'url' => DOL_URL_ROOT."/contrat/card.php?id=".$objp->rowid,
);
- $this->info_box_contents[$i][2] = array(
+ $this->info_box_contents[$line][] = array(
'td' => 'align="left" width="16"',
'logo' => 'company',
'tooltip' => $langs->trans('Customer').': '.$objp->name,
'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid,
);
- $this->info_box_contents[$i][3] = array(
+ $this->info_box_contents[$line][] = array(
'td' => 'align="left"',
'text' => dol_trunc($objp->name,40),
'tooltip' => $langs->trans('Customer').': '.$objp->name,
'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid,
);
- $this->info_box_contents[$i][4] = array(
+ $this->info_box_contents[$line][] = array(
'td' => 'align="right"',
'text' => dol_print_date($datec,'day'),
);
- $this->info_box_contents[$i][5] = array(
+ $this->info_box_contents[$line][] = array(
'td' => 'align="right" class="nowrap"',
'text' => $contractstatic->getLibStatut(6),
'asis'=>1,
);
- $i++;
+ $line++;
}
if ($num==0)
- $this->info_box_contents[$i][0] = array(
+ $this->info_box_contents[$line][0] = array(
'td' => 'align="center"',
'text'=>$langs->trans("NoRecordedContracts"),
);
diff --git a/htdocs/core/boxes/box_external_rss.php b/htdocs/core/boxes/box_external_rss.php
index 773f98fff70..f1db35e1614 100644
--- a/htdocs/core/boxes/box_external_rss.php
+++ b/htdocs/core/boxes/box_external_rss.php
@@ -109,10 +109,11 @@ class box_external_rss extends ModeleBoxes
// INFO on items
$items=$rssparser->getItems();
+ //print ''.print_r($items,true).''; $nbitems=count($items); - for($i = 0; $i < $max && $i < $nbitems; $i++) + for($line = 0; $line < $max && $line < $nbitems; $line++) { - $item = $items[$i]; + $item = $items[$line]; // Feed common fields $href = $item['link']; @@ -139,28 +140,38 @@ class box_external_rss extends ModeleBoxes if (! $isutf8 && $conf->file->character_set_client == 'UTF-8') $title=utf8_encode($title); elseif ($isutf8 && $conf->file->character_set_client == 'ISO-8859-1') $title=utf8_decode($title); - $title=preg_replace("/([[:alnum:]])\?([[:alnum:]])/","\\1'\\2",$title); // Gere probleme des apostrophes mal codee/decodee par utf8 + $title=preg_replace("/([[:alnum:]])\?([[:alnum:]])/","\\1'\\2",$title); // Gere probleme des apostrophes mal codee/decodee par utf8 $title=preg_replace("/^\s+/","",$title); // Supprime espaces de debut $this->info_box_contents["$href"]="$title"; - $this->info_box_contents[$i][0] = array( + $tooltip = $title; + $description = ! empty($item['description'])?$item['description']:''; + $isutf8 = utf8_check($description); + if (! $isutf8 && $conf->file->character_set_client == 'UTF-8') $description=utf8_encode($description); + elseif ($isutf8 && $conf->file->character_set_client == 'ISO-8859-1') $description=utf8_decode($description); + $description=preg_replace("/([[:alnum:]])\?([[:alnum:]])/","\\1'\\2",$description); + $description=preg_replace("/^\s+/","",$description); + $description=str_replace("\r\n","",$description); + $tooltip.= ' '.$description; + + $this->info_box_contents[$line][0] = array( 'td' => 'align="left" width="16"', 'logo' => $this->boximg, 'url' => $href, - 'tooltip' => $title, + 'tooltip' => $tooltip, 'target' => 'newrss', ); - $this->info_box_contents[$i][1] = array( + $this->info_box_contents[$line][1] = array( 'td' => 'align="left"', 'text' => $title, 'url' => $href, - 'tooltip' => $title, + 'tooltip' => $tooltip, 'maxlength' => 64, 'target' => 'newrss', ); - $this->info_box_contents[$i][2] = array( + $this->info_box_contents[$line][2] = array( 'td' => 'align="right" nowrap="1"', 'text' => $date, ); diff --git a/htdocs/core/boxes/box_members.php b/htdocs/core/boxes/box_members.php index 46de6175354..f871226b4e9 100644 --- a/htdocs/core/boxes/box_members.php +++ b/htdocs/core/boxes/box_members.php @@ -96,8 +96,8 @@ class box_members extends ModeleBoxes { $num = $db->num_rows($result); - $i = 0; - while ($i < $num) + $line = 0; + while ($line < $num) { $objp = $db->fetch_object($result); $datec=$db->jdate($objp->datec); @@ -105,6 +105,7 @@ class box_members extends ModeleBoxes $memberstatic->lastname=$objp->lastname; $memberstatic->firstname=$objp->firstname; + $memberstatic->ref = $objp->rowid; if (! empty($objp->fk_soc)) { $memberstatic->socid = $objp->fk_soc; @@ -114,35 +115,33 @@ class box_members extends ModeleBoxes $memberstatic->name=$objp->company; } - $this->info_box_contents[$i][0] = array( - 'td' => 'align="left" width="16"', - 'logo' => $this->boximg, - 'tooltip' => $memberstatic->getFullName($langs), - 'url' => DOL_URL_ROOT."/adherents/card.php?rowid=".$objp->rowid, + $this->info_box_contents[$line][] = array( + 'td' => 'align="left"', + 'text' => $memberstatic->getNomUrl(1), + 'asis' => 1, ); - $this->info_box_contents[$i][1] = array( + $this->info_box_contents[$line][] = array( 'td' => 'align="left"', 'text' => $memberstatic->getFullName($langs), - 'tooltip' => $memberstatic->getFullName($langs), 'url' => DOL_URL_ROOT."/adherents/card.php?rowid=".$objp->rowid, ); - $this->info_box_contents[$i][2] = array( + $this->info_box_contents[$line][] = array( 'td' => 'align="right"', 'text' => dol_print_date($datem, "day"), ); - $this->info_box_contents[$i][3] = array( + $this->info_box_contents[$line][] = array( 'td' => 'align="right" width="18"', 'text' => $memberstatic->LibStatut($objp->status,$objp->cotisation,$db->jdate($objp->date_end_subscription),3), ); - $i++; + $line++; } if ($num==0) - $this->info_box_contents[$i][0] = array( + $this->info_box_contents[$line][0] = array( 'td' => 'align="center"', 'text'=>$langs->trans("NoRecordedCustomers"), ); diff --git a/htdocs/core/boxes/box_produits.php b/htdocs/core/boxes/box_produits.php index 59d20b35b91..509502183af 100644 --- a/htdocs/core/boxes/box_produits.php +++ b/htdocs/core/boxes/box_produits.php @@ -64,7 +64,7 @@ class box_produits extends ModeleBoxes if ($user->rights->produit->lire || $user->rights->service->lire) { - $sql = "SELECT p.rowid, p.label, p.price, p.price_base_type, p.price_ttc, p.fk_product_type, p.tms, p.tosell, p.tobuy, p.fk_price_expression"; + $sql = "SELECT p.rowid, p.label, p.ref, p.price, p.price_base_type, p.price_ttc, p.fk_product_type, p.tms, p.tosell, p.tobuy, p.fk_price_expression"; $sql.= " FROM ".MAIN_DB_PREFIX."product as p"; $sql.= ' WHERE p.entity IN ('.getEntity($productstatic->element, 1).')'; if (empty($user->rights->produit->lire)) $sql.=' AND p.fk_product_type != 0'; @@ -76,8 +76,8 @@ class box_produits extends ModeleBoxes if ($result) { $num = $db->num_rows($result); - $i = 0; - while ($i < $num) + $line = 0; + while ($line < $num) { $objp = $db->fetch_object($result); $datem=$db->jdate($objp->tms); @@ -99,35 +99,31 @@ class box_produits extends ModeleBoxes $objp->label = $objtp->label; } } + $productstatic->id = $objp->rowid; + $productstatic->ref = $objp->ref; + $productstatic->type = $objp->fk_product_type; + $productstatic->label = $objp->label; - $this->info_box_contents[$i][0] = array( - 'td' => 'align="left" width="16"', - 'logo' => ($objp->fk_product_type==1?'object_service':'object_product'), - 'tooltip' => $objp->label, - 'url' => DOL_URL_ROOT."/product/card.php?id=".$objp->rowid, + $this->info_box_contents[$line][] = array( + 'td' => 'align="left"', + 'text' => $productstatic->getNomUrl(1), + 'asis' => 1, ); - $this->info_box_contents[$i][1] = array('td' => 'align="left"', - 'text' => $objp->label, - 'url' => DOL_URL_ROOT."/product/card.php?id=".$objp->rowid); - if (empty($objp->fk_price_expression)) { - if ($objp->price_base_type == 'HT') - { - $price=price($objp->price); - $price_base_type=$langs->trans("HT"); - } - else - { - $price=price($objp->price_ttc); - $price_base_type=$langs->trans("TTC"); - } + $this->info_box_contents[$line][] = array( + 'td' => 'align="left"', + 'text' => $objp->label, + ); + + if (empty($objp->fk_price_expression)) { + $price_base_type=$langs->trans($objp->price_base_type); + $price=($objp->price_base_type == 'HT')?price($objp->price):$price=price($objp->price_ttc); } else //Parse the dinamic price { - $product = new Product($this->db); - $product->fetch($objp->rowid, '', '', 1); + $productstatic->fetch($objp->rowid, '', '', 1); $priceparser = new PriceParser($this->db); - $price_result = $priceparser->parseProduct($product); + $price_result = $priceparser->parseProduct($productstatic); if ($price_result >= 0) { if ($objp->price_base_type == 'HT') { @@ -135,31 +131,41 @@ class box_produits extends ModeleBoxes } else { - $price_result = $price_result * (1 + ($product->tva_tx / 100)); + $price_result = $price_result * (1 + ($productstatic->tva_tx / 100)); $price_base_type=$langs->trans("TTC"); } $price=price($price_result); } } - $this->info_box_contents[$i][2] = array('td' => 'align="right"', - 'text' => $price); + $this->info_box_contents[$line][] = array( + 'td' => 'align="right"', + 'text' => $price, + ); - $this->info_box_contents[$i][3] = array('td' => 'align="left" class="nowrap"', - 'text' => $price_base_type); + $this->info_box_contents[$line][] = array( + 'td' => 'align="left" class="nowrap"', + 'text' => $price_base_type, + ); - $this->info_box_contents[$i][4] = array('td' => 'align="right"', - 'text' => dol_print_date($datem,'day')); + $this->info_box_contents[$line][] = array( + 'td' => 'align="right"', + 'text' => dol_print_date($datem,'day'), + ); - $this->info_box_contents[$i][5] = array('td' => 'align="right" width="18"', - 'text' => $productstatic->LibStatut($objp->tosell,3,0)); + $this->info_box_contents[$line][] = array( + 'td' => 'align="right" width="18"', + 'text' => $productstatic->LibStatut($objp->tosell,3,0), + ); - $this->info_box_contents[$i][6] = array('td' => 'align="right" width="18"', - 'text' => $productstatic->LibStatut($objp->tobuy,3,1)); + $this->info_box_contents[$line][] = array( + 'td' => 'align="right" width="18"', + 'text' => $productstatic->LibStatut($objp->tobuy,3,1), + ); - $i++; + $line++; } if ($num==0) - $this->info_box_contents[$i][0] = array( + $this->info_box_contents[$line][0] = array( 'td' => 'align="center"', 'text'=>$langs->trans("NoRecordedProducts"), ); diff --git a/htdocs/core/boxes/box_produits_alerte_stock.php b/htdocs/core/boxes/box_produits_alerte_stock.php index 5d75c924ff2..8096dfdec10 100644 --- a/htdocs/core/boxes/box_produits_alerte_stock.php +++ b/htdocs/core/boxes/box_produits_alerte_stock.php @@ -65,7 +65,7 @@ class box_produits_alerte_stock extends ModeleBoxes if ($user->rights->produit->lire || $user->rights->service->lire) { - $sql = "SELECT p.rowid, p.label, p.price, p.price_base_type, p.price_ttc, p.fk_product_type, p.tms, p.tosell, p.tobuy, p.seuil_stock_alerte,"; + $sql = "SELECT p.rowid, p.label, p.price, p.ref, p.price_base_type, p.price_ttc, p.fk_product_type, p.tms, p.tosell, p.tobuy, p.seuil_stock_alerte,"; $sql.= " SUM(".$db->ifsql("s.reel IS NULL","0","s.reel").") as total_stock"; $sql.= " FROM ".MAIN_DB_PREFIX."product as p"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as s on p.rowid = s.fk_product"; @@ -83,8 +83,8 @@ class box_produits_alerte_stock extends ModeleBoxes { $langs->load("stocks"); $num = $db->num_rows($result); - $i = 0; - while ($i < $num) { + $line = 0; + while ($line < $num) { $objp = $db->fetch_object($result); $datem=$db->jdate($objp->tms); @@ -105,41 +105,32 @@ class box_produits_alerte_stock extends ModeleBoxes $objp->label = $objtp->label; } } + $productstatic->id = $objp->rowid; + $productstatic->ref = $objp->ref; + $productstatic->type = $objp->fk_product_type; + $productstatic->label = $objp->label; - $tooltip = $langs->trans('Product') . ': ' . $objp->label; - $this->info_box_contents[$i][0] = array( - 'td' => 'align="left" width="16"', - 'logo' => ($objp->fk_product_type==1?'object_service':'object_product'), - 'tooltip' => $tooltip, - 'url' => DOL_URL_ROOT."/product/card.php?id=".$objp->rowid, + $this->info_box_contents[$line][] = array( + 'td' => 'align="left"', + 'text' => $productstatic->getNomUrl(1), + 'asis' => 1, ); - $this->info_box_contents[$i][1] = array( + $this->info_box_contents[$line][] = array( 'td' => 'align="left"', 'text' => $objp->label, - 'tooltip' => $tooltip, - 'url' => DOL_URL_ROOT."/product/card.php?id=".$objp->rowid, ); - if (empty($objp->fk_price_expression)) - { - if ($objp->price_base_type == 'HT') - { - $price=price($objp->price); - $price_base_type=$langs->trans("HT"); - } - else - { - $price=price($objp->price_ttc); - $price_base_type=$langs->trans("TTC"); - } + if (empty($objp->fk_price_expression)) + { + $price_base_type=$langs->trans($objp->price_base_type); + $price=($objp->price_base_type == 'HT')?price($objp->price):$price=price($objp->price_ttc); } else //Parse the dinamic price { - $product = new Product($this->db); - $product->fetch($objp->rowid, '', '', 1); + $productstatic->fetch($objp->rowid, '', '', 1); $priceparser = new PriceParser($this->db); - $price_result = $priceparser->parseProduct($product); + $price_result = $priceparser->parseProduct($productstatic); if ($price_result >= 0) { if ($objp->price_base_type == 'HT') { @@ -147,32 +138,37 @@ class box_produits_alerte_stock extends ModeleBoxes } else { - $price_result = $price_result * (1 + ($product->tva_tx / 100)); + $price_result = $price_result * (1 + ($productstatic->tva_tx / 100)); $price_base_type=$langs->trans("TTC"); } $price=price($price_result); } } - $this->info_box_contents[$i][2] = array('td' => 'align="right"', - 'text' => $price); - $this->info_box_contents[$i][3] = array('td' => 'align="left" class="nowrap"', - 'text' => $price_base_type); + $this->info_box_contents[$line][] = array( + 'td' => 'align="right"', + 'text' => $price, + ); - $this->info_box_contents[$i][4] = array('td' => 'align="center"', + $this->info_box_contents[$line][] = array( + 'td' => 'align="left" class="nowrap"', + 'text' => $price_base_type, + ); + + $this->info_box_contents[$line][] = array('td' => 'align="center"', 'text' => $objp->total_stock . ' / '.$objp->seuil_stock_alerte, 'text2'=>img_warning($langs->transnoentitiesnoconv("StockLowerThanLimit"))); - $this->info_box_contents[$i][5] = array('td' => 'align="right" width="18"', + $this->info_box_contents[$line][] = array('td' => 'align="right" width="18"', 'text' => $productstatic->LibStatut($objp->tosell,3,0)); - $this->info_box_contents[$i][6] = array('td' => 'align="right" width="18"', + $this->info_box_contents[$line][] = array('td' => 'align="right" width="18"', 'text' => $productstatic->LibStatut($objp->tobuy,3,1)); - $i++; + $line++; } if ($num==0) - $this->info_box_contents[$i][0] = array( + $this->info_box_contents[$line][0] = array( 'td' => 'align="center"', 'text'=>$langs->trans("NoTooLowStockProducts"), ); @@ -189,8 +185,10 @@ class box_produits_alerte_stock extends ModeleBoxes } } else { - $this->info_box_contents[0][0] = array('td' => 'align="left"', - 'text' => $langs->trans("ReadPermissionNotAllowed")); + $this->info_box_contents[0][0] = array( + 'td' => 'align="left"', + 'text' => $langs->trans("ReadPermissionNotAllowed"), + ); } } diff --git a/htdocs/core/boxes/box_propales.php b/htdocs/core/boxes/box_propales.php index 7bec6849ac7..4e8b47aa0d4 100644 --- a/htdocs/core/boxes/box_propales.php +++ b/htdocs/core/boxes/box_propales.php @@ -57,14 +57,16 @@ class box_propales extends ModeleBoxes $this->max=$max; include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; + include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; $propalstatic=new Propal($db); + $societestatic = new Societe($db); $this->info_box_head = array('text' => $langs->trans("BoxTitleLast".($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE?"":"Modified")."Propals",$max)); if ($user->rights->propale->lire) { - $sql = "SELECT s.nom as name, s.rowid as socid,"; - $sql.= " p.rowid, p.ref, p.fk_statut, p.datep as dp, p.datec, p.fin_validite, p.date_cloture, p.total_ht, p.tms"; + $sql = "SELECT s.nom as name, s.rowid as socid, s.code_client, s.logo,"; + $sql.= " p.rowid, p.ref, p.fk_statut, p.datep as dp, p.datec, p.fin_validite, p.date_cloture, p.total_ht, p.tva as total_tva, p.total as total_ttc, p.tms"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql.= ", ".MAIN_DB_PREFIX."propal as p"; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; @@ -82,72 +84,63 @@ class box_propales extends ModeleBoxes $num = $db->num_rows($result); $now=dol_now(); - $i = 0; + $line = 0; - while ($i < $num) { + while ($line < $num) { $objp = $db->fetch_object($result); $date=$db->jdate($objp->dp); $datec=$db->jdate($objp->datec); $datem=$db->jdate($objp->tms); $dateterm=$db->jdate($objp->fin_validite); $dateclose=$db->jdate($objp->date_cloture); + $propalstatic->id = $objp->rowid; + $propalstatic->ref = $objp->ref; + $propalstatic->total_ht = $objp->total_ht; + $propalstatic->total_tva = $objp->total_tva; + $propalstatic->total_ttc = $objp->total_ttc; + $societestatic->id = $objp->socid; + $societestatic->name = $objp->name; + $societestatic->code_client = $objp->code_client; + $societestatic->logo = $objp->logo; $late = ''; if ($objp->fk_statut == 1 && $dateterm < ($now - $conf->propal->cloture->warning_delay)) { $late = img_warning($langs->trans("Late")); } - $tooltip = $langs->trans('Proposal') . ': ' . $objp->ref; - $this->info_box_contents[$i][0] = array( - 'td' => 'align="left" width="16"', - 'logo' => $this->boximg, - 'tooltip' => $tooltip, - 'url' => DOL_URL_ROOT."/comm/propal.php?id=".$objp->rowid, - ); - - $this->info_box_contents[$i][1] = array( + $this->info_box_contents[$line][] = array( 'td' => 'align="left"', - 'text' => $objp->ref, + 'text' => $propalstatic->getNomUrl(1), 'text2'=> $late, - 'tooltip' => $tooltip, - 'url' => DOL_URL_ROOT."/comm/propal.php?id=".$objp->rowid, + 'asis' => 1, ); - $tooltip = $langs->trans('Customer') . ': ' . $objp->name; - $this->info_box_contents[$i][2] = array( - 'td' => 'align="left" width="16"', - 'logo' => 'company', - 'tooltip' => $tooltip, - 'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid, - ); - - $this->info_box_contents[$i][3] = array( + $this->info_box_contents[$line][] = array( 'td' => 'align="left"', - 'text' => dol_trunc($objp->name,40), - 'tooltip' => $tooltip, - 'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid, + 'text' => $societestatic->getNomUrl(1,'',40), + 'asis' => 1, ); - $this->info_box_contents[$i][4] = array( + $this->info_box_contents[$line][] = array( 'td' => 'align="right"', 'text' => price($objp->total_ht), ); - $this->info_box_contents[$i][5] = array( + $this->info_box_contents[$line][] = array( 'td' => 'align="right"', 'text' => dol_print_date($date,'day'), ); - $this->info_box_contents[$i][6] = array( + $this->info_box_contents[$line][] = array( 'td' => 'align="right" width="18"', 'text' => $propalstatic->LibStatut($objp->fk_statut,3), ); - $i++; + $line++; } if ($num==0) - $this->info_box_contents[$i][0] = array( + $this->info_box_contents[$line][0] = array( 'td' => 'align="center"', 'text'=>$langs->trans("NoRecordedProposals"), ); |