Merge pull request #2304 from frederic34/tooltip

Tooltip
This commit is contained in:
Laurent Destailleur 2015-02-03 12:32:40 +01:00
commit d626d073dc
14 changed files with 255 additions and 244 deletions

View File

@ -1565,6 +1565,8 @@ class Adherent extends CommonObject
$result=''; $result='';
$label = '<u>' . $langs->trans("ShowMember") . '</u>'; $label = '<u>' . $langs->trans("ShowMember") . '</u>';
$label.= '<br><b>' . $langs->trans('Ref') . ':</b> ' . $this->ref; $label.= '<br><b>' . $langs->trans('Ref') . ':</b> ' . $this->ref;
if (! empty($this->firstname) || ! empty($this->lastname))
$label.= '<br><b>' . $langs->trans('Name') . ':</b> ' . $this->getFullName($langs);
$linkclose = '" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">'; $linkclose = '" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
if ($option == 'card') if ($option == 'card')

View File

@ -90,8 +90,8 @@ class box_actions extends ModeleBoxes
$delay_warning = $conf->global->MAIN_DELAY_ACTIONS_TODO*24*60*60; $delay_warning = $conf->global->MAIN_DELAY_ACTIONS_TODO*24*60*60;
$num = $db->num_rows($result); $num = $db->num_rows($result);
$i = 0; $line = 0;
while ($i < $num) { while ($line < $num) {
$late = ''; $late = '';
$objp = $db->fetch_object($result); $objp = $db->fetch_object($result);
$datelimite = $db->jdate($objp->dp); $datelimite = $db->jdate($objp->dp);
@ -109,39 +109,39 @@ class box_actions extends ModeleBoxes
$label = empty($objp->label)?$objp->type_label:$objp->label; $label = empty($objp->label)?$objp->type_label:$objp->label;
$tooltip = $langs->trans('Action'.$objp->code).': '.$label; $tooltip = $langs->trans('Action'.$objp->code).': '.$label;
$this->info_box_contents[$i][] = array( $this->info_box_contents[$line][] = array(
'td' => 'align="left"', 'td' => 'align="left"',
'text' => $actionstatic->getNomUrl(1), 'text' => $actionstatic->getNomUrl(1),
'text2'=> $late, 'text2'=> $late,
'asis' => 1, 'asis' => 1,
); );
$this->info_box_contents[$i][] = array( $this->info_box_contents[$line][] = array(
'td' => 'align="left"', 'td' => 'align="left"',
'text' => $societestatic->getNomUrl(1), 'text' => $societestatic->getNomUrl(1),
'asis' => 1, 'asis' => 1,
); );
$this->info_box_contents[$i][] = array( $this->info_box_contents[$line][] = array(
'td' => 'align="left" class="nowrap"', 'td' => 'align="left" class="nowrap"',
'text' => dol_print_date($datelimite, "dayhour"), 'text' => dol_print_date($datelimite, "dayhour"),
); );
$this->info_box_contents[$i][] = array( $this->info_box_contents[$line][] = array(
'td' => 'align="right"', 'td' => 'align="right"',
'text' => ($objp->percentage>= 0?$objp->percentage.'%':''), 'text' => ($objp->percentage>= 0?$objp->percentage.'%':''),
); );
$this->info_box_contents[$i][] = array( $this->info_box_contents[$line][] = array(
'td' => 'align="right" width="18"', 'td' => 'align="right" width="18"',
'text' => $actionstatic->LibStatut($objp->percentage,3), 'text' => $actionstatic->LibStatut($objp->percentage,3),
); );
$i++; $line++;
} }
if ($num==0) if ($num==0)
$this->info_box_contents[$i][0] = array( $this->info_box_contents[$line][0] = array(
'td' => 'align="center"', 'td' => 'align="center"',
'text'=>$langs->trans("NoActionsToDo"), 'text'=>$langs->trans("NoActionsToDo"),
); );
@ -184,23 +184,23 @@ class box_actions extends ModeleBoxes
{ {
print '<div id="dialog" title="'.$nblines." ".$langs->trans("ActionsToDo").'">'; print '<div id="dialog" title="'.$nblines." ".$langs->trans("ActionsToDo").'">';
print '<table width=100%>'; print '<table width=100%>';
for ($i=0, $n=$nblines; $i < $n; $i++) for ($line=0, $n=$nblines; $line < $n; $line++)
{ {
if (isset($contents[$i])) if (isset($contents[$line]))
{ {
// on affiche que les évènement du jours ou passé // on affiche que les évènement du jours ou passé
// qui ne sont pas à 100% // qui ne sont pas à 100%
$actioncejour=true; $actioncejour=true;
$var=!$var; $var=!$var;
// TR // TR
$logo=$contents[$i][0]['logo']; $logo=$contents[$line][0]['logo'];
$label=$contents[$i][1]['text']; $label=$contents[$line][1]['text'];
$urlevent=$contents[$i][1]['url']; $urlevent=$contents[$line][1]['url'];
$logosoc=$contents[$i][2]['logo']; $logosoc=$contents[$line][2]['logo'];
$nomsoc=$contents[$i][3]['text']; $nomsoc=$contents[$line][3]['text'];
$urlsoc=$contents[$i][3]['url']; $urlsoc=$contents[$line][3]['url'];
$dateligne=$contents[$i][4]['text']; $dateligne=$contents[$line][4]['text'];
$percentage=$contents[$i][5]['text']; $percentage=$contents[$line][5]['text'];
print '<tr '.$bcx[$var].'>'; print '<tr '.$bcx[$var].'>';
print '<td align=center>'; print '<td align=center>';
print img_object("",$logo); print img_object("",$logo);

View File

@ -73,7 +73,7 @@ class box_activity extends ModeleBoxes
$totalMnt = 0; $totalMnt = 0;
$totalnb = 0; $totalnb = 0;
$i = 0; $line = 0;
$cachetime = 3600; $cachetime = 3600;
$fileid = '-e'.$conf->entity.'-u'.$user->id.'-s'.$user->societe_id.'-r'.($user->rights->societe->client->voir?'1':'0').'.cache'; $fileid = '-e'.$conf->entity.'-u'.$user->id.'-s'.$user->societe_id.'-r'.($user->rights->societe->client->voir?'1':'0').'.cache';
$now = dol_now(); $now = dol_now();
@ -132,28 +132,28 @@ class box_activity extends ModeleBoxes
} }
if (! empty($data)) { if (! empty($data)) {
$j=0; $j=0;
while ($i < count($data)) { while ($line < count($data)) {
$billurl="viewstatut=2&amp;paye=1&amp;year=".$data[$j]->annee; $billurl="viewstatut=2&amp;paye=1&amp;year=".$data[$j]->annee;
$this->info_box_contents[$i][0] = array( $this->info_box_contents[$line][0] = array(
'td' => 'align="left" width="16"', 'td' => 'align="left" width="16"',
'tooltip' => $langs->trans('Bills').'&nbsp;'.$facturestatic->LibStatut(1,$data[$j]->fk_statut,0), 'tooltip' => $langs->trans('Bills').'&nbsp;'.$facturestatic->LibStatut(1,$data[$j]->fk_statut,0),
'url' => DOL_URL_ROOT."/compta/facture/list.php?".$billurl."&amp;mainmenu=accountancy&amp;leftmenu=customers_bills", 'url' => DOL_URL_ROOT."/compta/facture/list.php?".$billurl."&amp;mainmenu=accountancy&amp;leftmenu=customers_bills",
'logo' => 'bill', 'logo' => 'bill',
); );
$this->info_box_contents[$i][1] = array( $this->info_box_contents[$line][1] = array(
'td' => 'align="left"', 'td' => 'align="left"',
'text' => $langs->trans("Bills")."&nbsp;".$facturestatic->LibStatut(1,$data[$j]->fk_statut,0)." ".$data[$j]->annee, 'text' => $langs->trans("Bills")."&nbsp;".$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"', 'td' => 'align="right"',
'tooltip' => $langs->trans('Bills').'&nbsp;'.$facturestatic->LibStatut(1,$data[$j]->fk_statut,0), 'tooltip' => $langs->trans('Bills').'&nbsp;'.$facturestatic->LibStatut(1,$data[$j]->fk_statut,0),
'text' => $data[$j]->nb, 'text' => $data[$j]->nb,
'url' => DOL_URL_ROOT."/compta/facture/list.php?".$billurl."&amp;mainmenu=accountancy&amp;leftmenu=customers_bills", 'url' => DOL_URL_ROOT."/compta/facture/list.php?".$billurl."&amp;mainmenu=accountancy&amp;leftmenu=customers_bills",
); );
$this->info_box_contents[$i][3] = array( $this->info_box_contents[$line][3] = array(
'td' => 'align="right"', 'td' => 'align="right"',
'text' => price($data[$j]->Mnttot,1,$langs,0,0,-1,$conf->currency) '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; $totalnb += $data[$j]->nb;
$totalMnt += $data[$j]->Mnttot; $totalMnt += $data[$j]->Mnttot;
} }
$this->info_box_contents[$i][4] = array( $this->info_box_contents[$line][4] = array(
'td' => 'align="right" width="18"', 'td' => 'align="right" width="18"',
'text' => $facturestatic->LibStatut(1,$data[$j]->fk_statut,3), 'text' => $facturestatic->LibStatut(1,$data[$j]->fk_statut,3),
); );
$i++; $line++;
$j++; $j++;
} }
if (count($data)==0) if (count($data)==0)
$this->info_box_contents[$i][0] = array( $this->info_box_contents[$line][0] = array(
'td' => 'align="center"', 'td' => 'align="center"',
'text'=>$langs->trans("NoRecordedInvoices"), 'text'=>$langs->trans("NoRecordedInvoices"),
); );
@ -193,7 +193,7 @@ class box_activity extends ModeleBoxes
$result = $db->query($sql); $result = $db->query($sql);
if ($result) { if ($result) {
$num = $db->num_rows($result) + $i; $num = $db->num_rows($result) + $line;
$j=0; $j=0;
while ($j < $num) { while ($j < $num) {
$data[$j]=$db->fetch_object($result); $data[$j]=$db->fetch_object($result);
@ -212,41 +212,41 @@ class box_activity extends ModeleBoxes
if (! empty($data)) { if (! empty($data)) {
$j=0; $j=0;
while ($i < count($data)) { while ($line < count($data)) {
$billurl="viewstatut=".$data[$j]->fk_statut."&amp;paye=0"; $billurl="viewstatut=".$data[$j]->fk_statut."&amp;paye=0";
$this->info_box_contents[$i][0] = array( $this->info_box_contents[$line][0] = array(
'td' => 'align="left" width="16"', 'td' => 'align="left" width="16"',
'tooltip' => $langs->trans('Bills').'&nbsp;'.$facturestatic->LibStatut(0,$data[$j]->fk_statut,0), 'tooltip' => $langs->trans('Bills').'&nbsp;'.$facturestatic->LibStatut(0,$data[$j]->fk_statut,0),
'url' => DOL_URL_ROOT."/compta/facture/list.php?".$billurl."&amp;mainmenu=accountancy&amp;leftmenu=customers_bills", 'url' => DOL_URL_ROOT."/compta/facture/list.php?".$billurl."&amp;mainmenu=accountancy&amp;leftmenu=customers_bills",
'logo' => 'bill', 'logo' => 'bill',
); );
$this->info_box_contents[$i][1] = array( $this->info_box_contents[$line][1] = array(
'td' => 'align="left"', 'td' => 'align="left"',
'text' => $langs->trans("Bills")."&nbsp;".$facturestatic->LibStatut(0,$data[$j]->fk_statut,0), 'text' => $langs->trans("Bills")."&nbsp;".$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"', 'td' => 'align="right"',
'text' => $data[$j]->nb, 'text' => $data[$j]->nb,
'tooltip' => $langs->trans('Bills').'&nbsp;'.$facturestatic->LibStatut(0,$data[$j]->fk_statut,0), 'tooltip' => $langs->trans('Bills').'&nbsp;'.$facturestatic->LibStatut(0,$data[$j]->fk_statut,0),
'url' => DOL_URL_ROOT."/compta/facture/list.php?".$billurl."&amp;mainmenu=accountancy&amp;leftmenu=customers_bills", 'url' => DOL_URL_ROOT."/compta/facture/list.php?".$billurl."&amp;mainmenu=accountancy&amp;leftmenu=customers_bills",
); );
$totalnb += $data[$j]->nb; $totalnb += $data[$j]->nb;
$this->info_box_contents[$i][3] = array( $this->info_box_contents[$line][3] = array(
'td' => 'align="right"', 'td' => 'align="right"',
'text' => price($data[$j]->Mnttot,1,$langs,0,0,-1,$conf->currency), 'text' => price($data[$j]->Mnttot,1,$langs,0,0,-1,$conf->currency),
); );
$totalMnt += $objp->Mnttot; $totalMnt += $objp->Mnttot;
$this->info_box_contents[$i][4] = array( $this->info_box_contents[$line][4] = array(
'td' => 'align="right" width="18"', 'td' => 'align="right" width="18"',
'text' => $facturestatic->LibStatut(0,$data[$j]->fk_statut,3), 'text' => $facturestatic->LibStatut(0,$data[$j]->fk_statut,3),
); );
$i++; $line++;
$j++; $j++;
} }
if ($num==0) if ($num==0)
$this->info_box_contents[$i][0] = array( $this->info_box_contents[$line][0] = array(
'td' => 'align="center"', 'td' => 'align="center"',
'text'=>$langs->trans("NoRecordedInvoices"), 'text'=>$langs->trans("NoRecordedInvoices"),
); );
@ -286,7 +286,7 @@ class box_activity extends ModeleBoxes
$result = $db->query($sql); $result = $db->query($sql);
if ($result) { if ($result) {
$num = $db->num_rows($result) + $i; $num = $db->num_rows($result) + $line;
$j=0; $j=0;
while ($j < $num) { while ($j < $num) {
$data[$j]=$db->fetch_object($result); $data[$j]=$db->fetch_object($result);
@ -304,20 +304,20 @@ class box_activity extends ModeleBoxes
} }
if (! empty($data)) { if (! empty($data)) {
$j=0; $j=0;
while ($i < count($data)) { while ($line < count($data)) {
$this->info_box_contents[$i][0] = array( $this->info_box_contents[$line][0] = array(
'td' => 'align="left" width="16"', 'td' => 'align="left" width="16"',
'url' => DOL_URL_ROOT."/commande/list.php?mainmenu=commercial&amp;leftmenu=orders&amp;viewstatut=".$data[$j]->fk_statut, 'url' => DOL_URL_ROOT."/commande/list.php?mainmenu=commercial&amp;leftmenu=orders&amp;viewstatut=".$data[$j]->fk_statut,
'tooltip' => $langs->trans("Orders")."&nbsp;".$commandestatic->LibStatut($data[$j]->fk_statut,0,0), 'tooltip' => $langs->trans("Orders")."&nbsp;".$commandestatic->LibStatut($data[$j]->fk_statut,0,0),
'logo' => 'object_order', 'logo' => 'object_order',
); );
$this->info_box_contents[$i][1] = array( $this->info_box_contents[$line][1] = array(
'td' => 'align="left"', 'td' => 'align="left"',
'text' =>$langs->trans("Orders")."&nbsp;".$commandestatic->LibStatut($data[$j]->fk_statut,0,0), 'text' =>$langs->trans("Orders")."&nbsp;".$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"', 'td' => 'align="right"',
'text' => $data[$j]->nb, 'text' => $data[$j]->nb,
'tooltip' => $langs->trans("Orders")."&nbsp;".$commandestatic->LibStatut($data[$j]->fk_statut,0,0), 'tooltip' => $langs->trans("Orders")."&nbsp;".$commandestatic->LibStatut($data[$j]->fk_statut,0,0),
@ -325,17 +325,17 @@ class box_activity extends ModeleBoxes
); );
$totalnb += $data[$j]->nb; $totalnb += $data[$j]->nb;
$this->info_box_contents[$i][3] = array( $this->info_box_contents[$line][3] = array(
'td' => 'align="right"', 'td' => 'align="right"',
'text' => price($data[$j]->Mnttot,1,$langs,0,0,-1,$conf->currency), 'text' => price($data[$j]->Mnttot,1,$langs,0,0,-1,$conf->currency),
); );
$totalMnt += $data[$j]->Mnttot; $totalMnt += $data[$j]->Mnttot;
$this->info_box_contents[$i][4] = array( $this->info_box_contents[$line][4] = array(
'td' => 'align="right" width="18"', 'td' => 'align="right" width="18"',
'text' => $commandestatic->LibStatut($data[$j]->fk_statut,0,3), 'text' => $commandestatic->LibStatut($data[$j]->fk_statut,0,3),
); );
$i++; $line++;
$j++; $j++;
} }
} }
@ -367,7 +367,7 @@ class box_activity extends ModeleBoxes
$result = $db->query($sql); $result = $db->query($sql);
if ($result) { if ($result) {
$num = $db->num_rows($result) + $i; $num = $db->num_rows($result) + $line;
$j=0; $j=0;
while ($j < $num) { while ($j < $num) {
$data[$j]=$db->fetch_object($result); $data[$j]=$db->fetch_object($result);
@ -385,8 +385,8 @@ class box_activity extends ModeleBoxes
} }
if (! empty($data)) { if (! empty($data)) {
$j=0; $j=0;
while ($i < count($data)) { while ($line < count($data)) {
$this->info_box_contents[$i][] = array( $this->info_box_contents[$line][] = array(
'td' => 'align="left" width="16"', 'td' => 'align="left" width="16"',
'url' => DOL_URL_ROOT."/comm/propal/list.php?mainmenu=commercial&amp;leftmenu=propals&amp;viewstatut=".$data[$j]->fk_statut, 'url' => DOL_URL_ROOT."/comm/propal/list.php?mainmenu=commercial&amp;leftmenu=propals&amp;viewstatut=".$data[$j]->fk_statut,
'tooltip' => $langs->trans("Proposals")."&nbsp;".$propalstatic->LibStatut($data[$j]->fk_statut,0), 'tooltip' => $langs->trans("Proposals")."&nbsp;".$propalstatic->LibStatut($data[$j]->fk_statut,0),
@ -394,12 +394,12 @@ class box_activity extends ModeleBoxes
); );
$objp = $db->fetch_object($result); $objp = $db->fetch_object($result);
$this->info_box_contents[$i][] = array( $this->info_box_contents[$line][] = array(
'td' => 'align="left"', 'td' => 'align="left"',
'text' => $langs->trans("Proposals")."&nbsp;".$propalstatic->LibStatut($data[$j]->fk_statut,0), 'text' => $langs->trans("Proposals")."&nbsp;".$propalstatic->LibStatut($data[$j]->fk_statut,0),
); );
$this->info_box_contents[$i][] = array( $this->info_box_contents[$line][] = array(
'td' => 'align="right"', 'td' => 'align="right"',
'text' => $data[$j]->nb, 'text' => $data[$j]->nb,
'tooltip' => $langs->trans("Proposals")."&nbsp;".$propalstatic->LibStatut($data[$j]->fk_statut,0), 'tooltip' => $langs->trans("Proposals")."&nbsp;".$propalstatic->LibStatut($data[$j]->fk_statut,0),
@ -407,40 +407,40 @@ class box_activity extends ModeleBoxes
); );
$totalnb += $data[$j]->nb; $totalnb += $data[$j]->nb;
$this->info_box_contents[$i][] = array( $this->info_box_contents[$line][] = array(
'td' => 'align="right"', 'td' => 'align="right"',
'text' => price($data[$j]->Mnttot,1,$langs,0,0,-1,$conf->currency), 'text' => price($data[$j]->Mnttot,1,$langs,0,0,-1,$conf->currency),
); );
$totalMnt += $data[$j]->Mnttot; $totalMnt += $data[$j]->Mnttot;
$this->info_box_contents[$i][] = array( $this->info_box_contents[$line][] = array(
'td' => 'align="right" width="18"', 'td' => 'align="right" width="18"',
'text' => $propalstatic->LibStatut($data[$j]->fk_statut,3), 'text' => $propalstatic->LibStatut($data[$j]->fk_statut,3),
); );
$i++; $line++;
$j++; $j++;
} }
} }
} }
// Add the sum in the bottom of the boxes // 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" ', 'td' => 'align="left" ',
'text' => $langs->trans("Total")."&nbsp;".$textHead, 'text' => $langs->trans("Total")."&nbsp;".$textHead,
); );
$this->info_box_contents[$i][2] = array( $this->info_box_contents[$line][2] = array(
'td' => 'align="right" ', 'td' => 'align="right" ',
'text' => $totalnb, 'text' => $totalnb,
); );
$this->info_box_contents[$i][3] = array( $this->info_box_contents[$line][3] = array(
'td' => 'align="right" ', 'td' => 'align="right" ',
'text' => price($totalMnt,1,$langs,0,0,-1,$conf->currency) '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" ', 'td' => 'align="right" ',
'text' => "", 'text' => "",
); );
$this->info_box_contents[$i][5] = array( $this->info_box_contents[$line][5] = array(
'td' => 'align="right"', 'td' => 'align="right"',
'text' => "", 'text' => "",
); );

View File

@ -81,19 +81,19 @@ class box_bookmarks extends ModeleBoxes
{ {
$num = $db->num_rows($result); $num = $db->num_rows($result);
$i = 0; $line = 0;
while ($i < $num) { while ($line < $num) {
$objp = $db->fetch_object($result); $objp = $db->fetch_object($result);
$this->info_box_contents[$i][0] = array( $this->info_box_contents[$line][0] = array(
'td' => 'align="left" width="16"', 'td' => 'align="left" width="16"',
'logo' => $this->boximg, 'logo' => $this->boximg,
'url' => $objp->url, 'url' => $objp->url,
'tooltip' => $objp->title, 'tooltip' => $objp->title,
'target' => $objp->target?'newtab':'', 'target' => $objp->target?'newtab':'',
); );
$this->info_box_contents[$i][1] = array( $this->info_box_contents[$line][1] = array(
'td' => 'align="left"', 'td' => 'align="left"',
'text' => $objp->title, 'text' => $objp->title,
'url' => $objp->url, 'url' => $objp->url,
@ -101,13 +101,13 @@ class box_bookmarks extends ModeleBoxes
'target' => $objp->target?'newtab':'', 'target' => $objp->target?'newtab':'',
); );
$i++; $line++;
} }
if ($num==0) { if ($num==0) {
$mytxt=$langs->trans("NoRecordedBookmarks"); $mytxt=$langs->trans("NoRecordedBookmarks");
if ($user->rights->bookmark->creer) $mytxt.=' '.$langs->trans("ClickToAdd"); 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"', 'td' => 'align="center" colspan="2"',
'tooltip' => $mytxt, 'tooltip' => $mytxt,
'url'=> DOL_URL_ROOT.'/bookmarks/list.php', 'text'=>$mytxt, 'url'=> DOL_URL_ROOT.'/bookmarks/list.php', 'text'=>$mytxt,

View File

@ -104,8 +104,8 @@ class box_clients extends ModeleBoxes
if (empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) $url= DOL_URL_ROOT."/comm/card.php?socid="; if (empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) $url= DOL_URL_ROOT."/comm/card.php?socid=";
else $url= DOL_URL_ROOT."/societe/soc.php?socid="; else $url= DOL_URL_ROOT."/societe/soc.php?socid=";
$i = 0; $line = 0;
while ($i < $num) while ($line < $num)
{ {
$objp = $db->fetch_object($result); $objp = $db->fetch_object($result);
$datec=$db->jdate($objp->datec); $datec=$db->jdate($objp->datec);
@ -118,26 +118,26 @@ class box_clients extends ModeleBoxes
$thirdpartystatic->fournisseur = $objp->fournisseur; $thirdpartystatic->fournisseur = $objp->fournisseur;
$thirdpartystatic->logo = $objp->logo; $thirdpartystatic->logo = $objp->logo;
$this->info_box_contents[$i][] = array( $this->info_box_contents[$line][] = array(
'td' => 'align="left"', 'td' => 'align="left"',
'text' => $thirdpartystatic->getNomUrl(1), 'text' => $thirdpartystatic->getNomUrl(1),
'asis' => 1, 'asis' => 1,
); );
$this->info_box_contents[$i][] = array( $this->info_box_contents[$line][] = array(
'td' => 'align="right"', 'td' => 'align="right"',
'text' => dol_print_date($datem, "day") 'text' => dol_print_date($datem, "day")
); );
$this->info_box_contents[$i][] = array( $this->info_box_contents[$line][] = array(
'td' => 'align="right" width="18"', 'td' => 'align="right" width="18"',
'text' => $thirdpartystatic->LibStatut($objp->status,3) '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); $db->free($result);
} }

View File

@ -97,9 +97,9 @@ class box_commandes extends ModeleBoxes
if ($result) { if ($result) {
$num = $db->num_rows($result); $num = $db->num_rows($result);
$i = 0; $line = 0;
while ($i < $num) { while ($line < $num) {
$objp = $db->fetch_object($result); $objp = $db->fetch_object($result);
$date=$db->jdate($objp->date_commande); $date=$db->jdate($objp->date_commande);
$datem=$db->jdate($objp->tms); $datem=$db->jdate($objp->tms);
@ -114,46 +114,46 @@ class box_commandes extends ModeleBoxes
$societestatic->code_client = $objp->code_client; $societestatic->code_client = $objp->code_client;
$societestatic->logo = $objp->logo; $societestatic->logo = $objp->logo;
$this->info_box_contents[$i][] = array( $this->info_box_contents[$line][] = array(
'td' => 'align="left"', 'td' => 'align="left"',
'text' => $commandestatic->getNomUrl(1), 'text' => $commandestatic->getNomUrl(1),
'asis' => 1, 'asis' => 1,
); );
$this->info_box_contents[$i][] = array( $this->info_box_contents[$line][] = array(
'td' => 'align="left"', 'td' => 'align="left"',
'text' => $societestatic->getNomUrl(1), 'text' => $societestatic->getNomUrl(1),
'asis' => 1, 'asis' => 1,
); );
$this->info_box_contents[$i][] = array( $this->info_box_contents[$line][] = array(
'td' => 'align="right"', 'td' => 'align="right"',
'text' => price($objp->total_ht), 'text' => price($objp->total_ht),
); );
if (! empty($conf->global->ORDER_BOX_LAST_ORDERS_SHOW_VALIDATE_USER)) { if (! empty($conf->global->ORDER_BOX_LAST_ORDERS_SHOW_VALIDATE_USER)) {
if ($objp->fk_user_valid > 0) $userstatic->fetch($objp->fk_user_valid); 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"', 'td' => 'align="right"',
'text' => (($objp->fk_user_valid > 0)?$userstatic->getNomUrl(1):''), 'text' => (($objp->fk_user_valid > 0)?$userstatic->getNomUrl(1):''),
'asis' => 1, 'asis' => 1,
); );
} }
$this->info_box_contents[$i][] = array( $this->info_box_contents[$line][] = array(
'td' => 'align="right"', 'td' => 'align="right"',
'text' => dol_print_date($date,'day'), 'text' => dol_print_date($date,'day'),
); );
$this->info_box_contents[$i][] = array( $this->info_box_contents[$line][] = array(
'td' => 'align="right" width="18"', 'td' => 'align="right" width="18"',
'text' => $commandestatic->LibStatut($objp->fk_statut,$objp->facture,3), '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); $db->free($result);
} else { } else {

View File

@ -95,11 +95,11 @@ class box_comptes extends ModeleBoxes
if ($result) { if ($result) {
$num = $db->num_rows($result); $num = $db->num_rows($result);
$i = 0; $line = 0;
$solde_total = array(); $solde_total = array();
$account_static = new Account($db); $account_static = new Account($db);
while ($i < $num) { while ($line < $num) {
$objp = $db->fetch_object($result); $objp = $db->fetch_object($result);
$account_static->id = $objp->rowid; $account_static->id = $objp->rowid;
@ -109,42 +109,42 @@ class box_comptes extends ModeleBoxes
$solde_total[$objp->currency_code] += $solde; $solde_total[$objp->currency_code] += $solde;
$this->info_box_contents[$i][] = array( $this->info_box_contents[$line][] = array(
'td' => 'align="left"', 'td' => 'align="left"',
'text' => $account_static->getNomUrl(1), 'text' => $account_static->getNomUrl(1),
'asis' => 1, 'asis' => 1,
); );
$this->info_box_contents[$i][] = array( $this->info_box_contents[$line][] = array(
'td' => 'align="left"', 'td' => 'align="left"',
'text' => $objp->number, 'text' => $objp->number,
); );
$this->info_box_contents[$i][] = array( $this->info_box_contents[$line][] = array(
'td' => 'align="right"', 'td' => 'align="right"',
'text' => price($solde, 0, $langs, 0, -1, -1, $objp->currency_code) 'text' => price($solde, 0, $langs, 0, -1, -1, $objp->currency_code)
); );
$i++; $line++;
} }
// Total // Total
foreach ($solde_total as $key=>$solde) { foreach ($solde_total as $key=>$solde) {
$this->info_box_contents[$i][] = array( $this->info_box_contents[$line][] = array(
'tr' => 'class="liste_total"', 'tr' => 'class="liste_total"',
'td' => 'align="left" class="liste_total"', 'td' => 'align="left" class="liste_total"',
'text' => $langs->trans('Total').' '.$key, 'text' => $langs->trans('Total').' '.$key,
); );
$this->info_box_contents[$i][] = array( $this->info_box_contents[$line][] = array(
'td' => 'align="right" class="liste_total"', 'td' => 'align="right" class="liste_total"',
'text' => '&nbsp;' 'text' => '&nbsp;'
); );
$this->info_box_contents[$i][] = array( $this->info_box_contents[$line][] = array(
'td' => 'align="right" class="liste_total"', 'td' => 'align="right" class="liste_total"',
'text' => price($solde, 0, $langs, 0, -1, -1, $key) 'text' => price($solde, 0, $langs, 0, -1, -1, $key)
); );
$i++; $line++;
} }
$db->free($result); $db->free($result);

View File

@ -62,14 +62,15 @@ class box_contacts extends ModeleBoxes
if ($user->rights->societe->lire) 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 = "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.nom as socname";
$sql.= ", s.code_client";
$sql.= " FROM ".MAIN_DB_PREFIX."socpeople as sp"; $sql.= " FROM ".MAIN_DB_PREFIX."socpeople as sp";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON sp.fk_soc = s.rowid"; $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"; 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).")"; $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->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.= " ORDER BY sp.tms DESC";
$sql.= $db->plimit($max, 0); $sql.= $db->plimit($max, 0);
@ -80,8 +81,8 @@ class box_contacts extends ModeleBoxes
$contactstatic=new Contact($db); $contactstatic=new Contact($db);
$societestatic=new Societe($db); $societestatic=new Societe($db);
$i = 0; $line = 0;
while ($i < $num) { while ($line < $num) {
$objp = $db->fetch_object($result); $objp = $db->fetch_object($result);
$datec=$db->jdate($objp->datec); $datec=$db->jdate($objp->datec);
$datem=$db->jdate($objp->tms); $datem=$db->jdate($objp->tms);
@ -90,31 +91,32 @@ class box_contacts extends ModeleBoxes
$contactstatic->firstname=$objp->firstname; $contactstatic->firstname=$objp->firstname;
$contactstatic->civility_id=$objp->civility_id; $contactstatic->civility_id=$objp->civility_id;
$societestatic->id=$objp->fk_soc; $societestatic->id = $objp->fk_soc;
$societestatic->name=$objp->socname; $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"', 'td' => 'align="left"',
'text' => $contactstatic->getNomUrl(1), 'text' => $contactstatic->getNomUrl(1),
'asis' => 1, 'asis' => 1,
); );
$this->info_box_contents[$i][] = array( $this->info_box_contents[$line][] = array(
'td' => 'align="left"', 'td' => 'align="left"',
'text' => $societestatic->getNomUrl(1), 'text' => $societestatic->getNomUrl(1),
'asis' => 1, 'asis' => 1,
); );
$this->info_box_contents[$i][] = array( $this->info_box_contents[$line][] = array(
'td' => 'align="right"', 'td' => 'align="right"',
'text' => dol_print_date($datem, "day"), 'text' => dol_print_date($datem, "day"),
); );
$i++; $line++;
} }
if ($num==0) if ($num==0)
$this->info_box_contents[$i][0] = array( $this->info_box_contents[$line][0] = array(
'td' => 'align="center"', 'td' => 'align="center"',
'text'=>$langs->trans("NoRecordedContacts"), 'text'=>$langs->trans("NoRecordedContacts"),
); );

View File

@ -78,9 +78,9 @@ class box_contracts extends ModeleBoxes
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
$now=dol_now(); $now=dol_now();
$i = 0; $line = 0;
while ($i < $num) { while ($line < $num) {
$objp = $db->fetch_object($resql); $objp = $db->fetch_object($resql);
$datec=$db->jdate($objp->datec); $datec=$db->jdate($objp->datec);
$dateterm=$db->jdate($objp->fin_validite); $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 // 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")); } // 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"', 'td' => 'align="left" width="16"',
'logo' => $this->boximg, 'logo' => $this->boximg,
'tooltip' => $langs->trans('Contract').': '.($objp->ref?$objp->ref:$objp->rowid), 'tooltip' => $langs->trans('Contract').': '.($objp->ref?$objp->ref:$objp->rowid),
'url' => DOL_URL_ROOT."/contrat/card.php?id=".$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"', 'td' => 'align="left"',
'text' => ($objp->ref?$objp->ref:$objp->rowid), // Some contracts have no ref 'text' => ($objp->ref?$objp->ref:$objp->rowid), // Some contracts have no ref
'tooltip' => $langs->trans('Contract').': '.($objp->ref?$objp->ref:$objp->rowid), '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, '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"', 'td' => 'align="left" width="16"',
'logo' => 'company', 'logo' => 'company',
'tooltip' => $langs->trans('Customer').': '.$objp->name, 'tooltip' => $langs->trans('Customer').': '.$objp->name,
'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid, '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"', 'td' => 'align="left"',
'text' => dol_trunc($objp->name,40), 'text' => dol_trunc($objp->name,40),
'tooltip' => $langs->trans('Customer').': '.$objp->name, 'tooltip' => $langs->trans('Customer').': '.$objp->name,
'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid, '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"', 'td' => 'align="right"',
'text' => dol_print_date($datec,'day'), 'text' => dol_print_date($datec,'day'),
); );
$this->info_box_contents[$i][5] = array( $this->info_box_contents[$line][] = array(
'td' => 'align="right" class="nowrap"', 'td' => 'align="right" class="nowrap"',
'text' => $contractstatic->getLibStatut(6), 'text' => $contractstatic->getLibStatut(6),
'asis'=>1, 'asis'=>1,
); );
$i++; $line++;
} }
if ($num==0) if ($num==0)
$this->info_box_contents[$i][0] = array( $this->info_box_contents[$line][0] = array(
'td' => 'align="center"', 'td' => 'align="center"',
'text'=>$langs->trans("NoRecordedContracts"), 'text'=>$langs->trans("NoRecordedContracts"),
); );

View File

@ -109,10 +109,11 @@ class box_external_rss extends ModeleBoxes
// INFO on items // INFO on items
$items=$rssparser->getItems(); $items=$rssparser->getItems();
//print '<pre>'.print_r($items,true).'</pre>';
$nbitems=count($items); $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 // Feed common fields
$href = $item['link']; $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); 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); 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 $title=preg_replace("/^\s+/","",$title); // Supprime espaces de debut
$this->info_box_contents["$href"]="$title"; $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.= '<br>'.$description;
$this->info_box_contents[$line][0] = array(
'td' => 'align="left" width="16"', 'td' => 'align="left" width="16"',
'logo' => $this->boximg, 'logo' => $this->boximg,
'url' => $href, 'url' => $href,
'tooltip' => $title, 'tooltip' => $tooltip,
'target' => 'newrss', 'target' => 'newrss',
); );
$this->info_box_contents[$i][1] = array( $this->info_box_contents[$line][1] = array(
'td' => 'align="left"', 'td' => 'align="left"',
'text' => $title, 'text' => $title,
'url' => $href, 'url' => $href,
'tooltip' => $title, 'tooltip' => $tooltip,
'maxlength' => 64, 'maxlength' => 64,
'target' => 'newrss', 'target' => 'newrss',
); );
$this->info_box_contents[$i][2] = array( $this->info_box_contents[$line][2] = array(
'td' => 'align="right" nowrap="1"', 'td' => 'align="right" nowrap="1"',
'text' => $date, 'text' => $date,
); );

View File

@ -96,8 +96,8 @@ class box_members extends ModeleBoxes
{ {
$num = $db->num_rows($result); $num = $db->num_rows($result);
$i = 0; $line = 0;
while ($i < $num) while ($line < $num)
{ {
$objp = $db->fetch_object($result); $objp = $db->fetch_object($result);
$datec=$db->jdate($objp->datec); $datec=$db->jdate($objp->datec);
@ -105,6 +105,7 @@ class box_members extends ModeleBoxes
$memberstatic->lastname=$objp->lastname; $memberstatic->lastname=$objp->lastname;
$memberstatic->firstname=$objp->firstname; $memberstatic->firstname=$objp->firstname;
$memberstatic->ref = $objp->rowid;
if (! empty($objp->fk_soc)) { if (! empty($objp->fk_soc)) {
$memberstatic->socid = $objp->fk_soc; $memberstatic->socid = $objp->fk_soc;
@ -114,35 +115,33 @@ class box_members extends ModeleBoxes
$memberstatic->name=$objp->company; $memberstatic->name=$objp->company;
} }
$this->info_box_contents[$i][0] = array( $this->info_box_contents[$line][] = array(
'td' => 'align="left" width="16"', 'td' => 'align="left"',
'logo' => $this->boximg, 'text' => $memberstatic->getNomUrl(1),
'tooltip' => $memberstatic->getFullName($langs), 'asis' => 1,
'url' => DOL_URL_ROOT."/adherents/card.php?rowid=".$objp->rowid,
); );
$this->info_box_contents[$i][1] = array( $this->info_box_contents[$line][] = array(
'td' => 'align="left"', 'td' => 'align="left"',
'text' => $memberstatic->getFullName($langs), 'text' => $memberstatic->getFullName($langs),
'tooltip' => $memberstatic->getFullName($langs),
'url' => DOL_URL_ROOT."/adherents/card.php?rowid=".$objp->rowid, '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"', 'td' => 'align="right"',
'text' => dol_print_date($datem, "day"), 'text' => dol_print_date($datem, "day"),
); );
$this->info_box_contents[$i][3] = array( $this->info_box_contents[$line][] = array(
'td' => 'align="right" width="18"', 'td' => 'align="right" width="18"',
'text' => $memberstatic->LibStatut($objp->status,$objp->cotisation,$db->jdate($objp->date_end_subscription),3), 'text' => $memberstatic->LibStatut($objp->status,$objp->cotisation,$db->jdate($objp->date_end_subscription),3),
); );
$i++; $line++;
} }
if ($num==0) if ($num==0)
$this->info_box_contents[$i][0] = array( $this->info_box_contents[$line][0] = array(
'td' => 'align="center"', 'td' => 'align="center"',
'text'=>$langs->trans("NoRecordedCustomers"), 'text'=>$langs->trans("NoRecordedCustomers"),
); );

View File

@ -64,7 +64,7 @@ class box_produits extends ModeleBoxes
if ($user->rights->produit->lire || $user->rights->service->lire) 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.= " FROM ".MAIN_DB_PREFIX."product as p";
$sql.= ' WHERE p.entity IN ('.getEntity($productstatic->element, 1).')'; $sql.= ' WHERE p.entity IN ('.getEntity($productstatic->element, 1).')';
if (empty($user->rights->produit->lire)) $sql.=' AND p.fk_product_type != 0'; if (empty($user->rights->produit->lire)) $sql.=' AND p.fk_product_type != 0';
@ -76,8 +76,8 @@ class box_produits extends ModeleBoxes
if ($result) if ($result)
{ {
$num = $db->num_rows($result); $num = $db->num_rows($result);
$i = 0; $line = 0;
while ($i < $num) while ($line < $num)
{ {
$objp = $db->fetch_object($result); $objp = $db->fetch_object($result);
$datem=$db->jdate($objp->tms); $datem=$db->jdate($objp->tms);
@ -99,35 +99,31 @@ class box_produits extends ModeleBoxes
$objp->label = $objtp->label; $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( $this->info_box_contents[$line][] = array(
'td' => 'align="left" width="16"', 'td' => 'align="left"',
'logo' => ($objp->fk_product_type==1?'object_service':'object_product'), 'text' => $productstatic->getNomUrl(1),
'tooltip' => $objp->label, 'asis' => 1,
'url' => DOL_URL_ROOT."/product/card.php?id=".$objp->rowid,
); );
$this->info_box_contents[$i][1] = array('td' => 'align="left"', $this->info_box_contents[$line][] = array(
'text' => $objp->label, 'td' => 'align="left"',
'url' => DOL_URL_ROOT."/product/card.php?id=".$objp->rowid); 'text' => $objp->label,
if (empty($objp->fk_price_expression)) { );
if ($objp->price_base_type == 'HT')
{ if (empty($objp->fk_price_expression)) {
$price=price($objp->price); $price_base_type=$langs->trans($objp->price_base_type);
$price_base_type=$langs->trans("HT"); $price=($objp->price_base_type == 'HT')?price($objp->price):$price=price($objp->price_ttc);
}
else
{
$price=price($objp->price_ttc);
$price_base_type=$langs->trans("TTC");
}
} }
else //Parse the dinamic price else //Parse the dinamic price
{ {
$product = new Product($this->db); $productstatic->fetch($objp->rowid, '', '', 1);
$product->fetch($objp->rowid, '', '', 1);
$priceparser = new PriceParser($this->db); $priceparser = new PriceParser($this->db);
$price_result = $priceparser->parseProduct($product); $price_result = $priceparser->parseProduct($productstatic);
if ($price_result >= 0) { if ($price_result >= 0) {
if ($objp->price_base_type == 'HT') if ($objp->price_base_type == 'HT')
{ {
@ -135,31 +131,41 @@ class box_produits extends ModeleBoxes
} }
else 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_base_type=$langs->trans("TTC");
} }
$price=price($price_result); $price=price($price_result);
} }
} }
$this->info_box_contents[$i][2] = array('td' => 'align="right"', $this->info_box_contents[$line][] = array(
'text' => $price); 'td' => 'align="right"',
'text' => $price,
);
$this->info_box_contents[$i][3] = array('td' => 'align="left" class="nowrap"', $this->info_box_contents[$line][] = array(
'text' => $price_base_type); 'td' => 'align="left" class="nowrap"',
'text' => $price_base_type,
);
$this->info_box_contents[$i][4] = array('td' => 'align="right"', $this->info_box_contents[$line][] = array(
'text' => dol_print_date($datem,'day')); 'td' => 'align="right"',
'text' => dol_print_date($datem,'day'),
);
$this->info_box_contents[$i][5] = array('td' => 'align="right" width="18"', $this->info_box_contents[$line][] = array(
'text' => $productstatic->LibStatut($objp->tosell,3,0)); '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(
'text' => $productstatic->LibStatut($objp->tobuy,3,1)); 'td' => 'align="right" width="18"',
'text' => $productstatic->LibStatut($objp->tobuy,3,1),
);
$i++; $line++;
} }
if ($num==0) if ($num==0)
$this->info_box_contents[$i][0] = array( $this->info_box_contents[$line][0] = array(
'td' => 'align="center"', 'td' => 'align="center"',
'text'=>$langs->trans("NoRecordedProducts"), 'text'=>$langs->trans("NoRecordedProducts"),
); );

View File

@ -65,7 +65,7 @@ class box_produits_alerte_stock extends ModeleBoxes
if ($user->rights->produit->lire || $user->rights->service->lire) 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.= " SUM(".$db->ifsql("s.reel IS NULL","0","s.reel").") as total_stock";
$sql.= " FROM ".MAIN_DB_PREFIX."product as p"; $sql.= " FROM ".MAIN_DB_PREFIX."product as p";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as s on p.rowid = s.fk_product"; $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"); $langs->load("stocks");
$num = $db->num_rows($result); $num = $db->num_rows($result);
$i = 0; $line = 0;
while ($i < $num) { while ($line < $num) {
$objp = $db->fetch_object($result); $objp = $db->fetch_object($result);
$datem=$db->jdate($objp->tms); $datem=$db->jdate($objp->tms);
@ -105,41 +105,32 @@ class box_produits_alerte_stock extends ModeleBoxes
$objp->label = $objtp->label; $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[$line][] = array(
$this->info_box_contents[$i][0] = array( 'td' => 'align="left"',
'td' => 'align="left" width="16"', 'text' => $productstatic->getNomUrl(1),
'logo' => ($objp->fk_product_type==1?'object_service':'object_product'), 'asis' => 1,
'tooltip' => $tooltip,
'url' => DOL_URL_ROOT."/product/card.php?id=".$objp->rowid,
); );
$this->info_box_contents[$i][1] = array( $this->info_box_contents[$line][] = array(
'td' => 'align="left"', 'td' => 'align="left"',
'text' => $objp->label, 'text' => $objp->label,
'tooltip' => $tooltip,
'url' => DOL_URL_ROOT."/product/card.php?id=".$objp->rowid,
); );
if (empty($objp->fk_price_expression)) if (empty($objp->fk_price_expression))
{ {
if ($objp->price_base_type == 'HT') $price_base_type=$langs->trans($objp->price_base_type);
{ $price=($objp->price_base_type == 'HT')?price($objp->price):$price=price($objp->price_ttc);
$price=price($objp->price);
$price_base_type=$langs->trans("HT");
}
else
{
$price=price($objp->price_ttc);
$price_base_type=$langs->trans("TTC");
}
} }
else //Parse the dinamic price else //Parse the dinamic price
{ {
$product = new Product($this->db); $productstatic->fetch($objp->rowid, '', '', 1);
$product->fetch($objp->rowid, '', '', 1);
$priceparser = new PriceParser($this->db); $priceparser = new PriceParser($this->db);
$price_result = $priceparser->parseProduct($product); $price_result = $priceparser->parseProduct($productstatic);
if ($price_result >= 0) { if ($price_result >= 0) {
if ($objp->price_base_type == 'HT') if ($objp->price_base_type == 'HT')
{ {
@ -147,32 +138,37 @@ class box_produits_alerte_stock extends ModeleBoxes
} }
else 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_base_type=$langs->trans("TTC");
} }
$price=price($price_result); $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"', $this->info_box_contents[$line][] = array(
'text' => $price_base_type); '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, 'text' => $objp->total_stock . ' / '.$objp->seuil_stock_alerte,
'text2'=>img_warning($langs->transnoentitiesnoconv("StockLowerThanLimit"))); '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)); '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)); 'text' => $productstatic->LibStatut($objp->tobuy,3,1));
$i++; $line++;
} }
if ($num==0) if ($num==0)
$this->info_box_contents[$i][0] = array( $this->info_box_contents[$line][0] = array(
'td' => 'align="center"', 'td' => 'align="center"',
'text'=>$langs->trans("NoTooLowStockProducts"), 'text'=>$langs->trans("NoTooLowStockProducts"),
); );
@ -189,8 +185,10 @@ class box_produits_alerte_stock extends ModeleBoxes
} }
} }
else { else {
$this->info_box_contents[0][0] = array('td' => 'align="left"', $this->info_box_contents[0][0] = array(
'text' => $langs->trans("ReadPermissionNotAllowed")); 'td' => 'align="left"',
'text' => $langs->trans("ReadPermissionNotAllowed"),
);
} }
} }

View File

@ -57,14 +57,16 @@ class box_propales extends ModeleBoxes
$this->max=$max; $this->max=$max;
include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; 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); $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)); $this->info_box_head = array('text' => $langs->trans("BoxTitleLast".($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE?"":"Modified")."Propals",$max));
if ($user->rights->propale->lire) if ($user->rights->propale->lire)
{ {
$sql = "SELECT s.nom as name, s.rowid as socid,"; $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.tms"; $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.= " FROM ".MAIN_DB_PREFIX."societe as s";
$sql.= ", ".MAIN_DB_PREFIX."propal as p"; $sql.= ", ".MAIN_DB_PREFIX."propal as p";
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; 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); $num = $db->num_rows($result);
$now=dol_now(); $now=dol_now();
$i = 0; $line = 0;
while ($i < $num) { while ($line < $num) {
$objp = $db->fetch_object($result); $objp = $db->fetch_object($result);
$date=$db->jdate($objp->dp); $date=$db->jdate($objp->dp);
$datec=$db->jdate($objp->datec); $datec=$db->jdate($objp->datec);
$datem=$db->jdate($objp->tms); $datem=$db->jdate($objp->tms);
$dateterm=$db->jdate($objp->fin_validite); $dateterm=$db->jdate($objp->fin_validite);
$dateclose=$db->jdate($objp->date_cloture); $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 = ''; $late = '';
if ($objp->fk_statut == 1 && $dateterm < ($now - $conf->propal->cloture->warning_delay)) { if ($objp->fk_statut == 1 && $dateterm < ($now - $conf->propal->cloture->warning_delay)) {
$late = img_warning($langs->trans("Late")); $late = img_warning($langs->trans("Late"));
} }
$tooltip = $langs->trans('Proposal') . ': ' . $objp->ref; $this->info_box_contents[$line][] = array(
$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(
'td' => 'align="left"', 'td' => 'align="left"',
'text' => $objp->ref, 'text' => $propalstatic->getNomUrl(1),
'text2'=> $late, 'text2'=> $late,
'tooltip' => $tooltip, 'asis' => 1,
'url' => DOL_URL_ROOT."/comm/propal.php?id=".$objp->rowid,
); );
$tooltip = $langs->trans('Customer') . ': ' . $objp->name; $this->info_box_contents[$line][] = array(
$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(
'td' => 'align="left"', 'td' => 'align="left"',
'text' => dol_trunc($objp->name,40), 'text' => $societestatic->getNomUrl(1,'',40),
'tooltip' => $tooltip, 'asis' => 1,
'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"', 'td' => 'align="right"',
'text' => price($objp->total_ht), 'text' => price($objp->total_ht),
); );
$this->info_box_contents[$i][5] = array( $this->info_box_contents[$line][] = array(
'td' => 'align="right"', 'td' => 'align="right"',
'text' => dol_print_date($date,'day'), 'text' => dol_print_date($date,'day'),
); );
$this->info_box_contents[$i][6] = array( $this->info_box_contents[$line][] = array(
'td' => 'align="right" width="18"', 'td' => 'align="right" width="18"',
'text' => $propalstatic->LibStatut($objp->fk_statut,3), 'text' => $propalstatic->LibStatut($objp->fk_statut,3),
); );
$i++; $line++;
} }
if ($num==0) if ($num==0)
$this->info_box_contents[$i][0] = array( $this->info_box_contents[$line][0] = array(
'td' => 'align="center"', 'td' => 'align="center"',
'text'=>$langs->trans("NoRecordedProposals"), 'text'=>$langs->trans("NoRecordedProposals"),
); );