From 925aa2039bb8a7445e0573427a4ba31d34af6ebd Mon Sep 17 00:00:00 2001 From: frederic34 Date: Fri, 23 Jan 2015 00:55:24 +0100 Subject: [PATCH 1/4] Tooltip and cache for boxes --- htdocs/comm/card.php | 6 +- htdocs/core/boxes/box_activity.php | 8 +- htdocs/core/boxes/box_comptes.php | 6 +- htdocs/core/boxes/box_members.php | 68 ++++--- htdocs/core/boxes/box_produits.php | 85 +++++--- htdocs/core/boxes/modules_boxes.php | 257 +++++++++++++------------ htdocs/public/test/test_arrays.php | 2 +- htdocs/public/test/test_forms.php | 2 +- htdocs/societe/class/societe.class.php | 6 +- htdocs/societe/soc.php | 4 +- 10 files changed, 252 insertions(+), 192 deletions(-) diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index 8fdab8115a6..2ad30d3b4b9 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -500,7 +500,7 @@ if ($id > 0) { $propal_static = new Propal($db); - $sql = "SELECT s.nom, s.rowid, p.rowid as propalid, p.fk_statut, p.total_ht, p.ref, p.remise, "; + $sql = "SELECT s.nom, s.rowid, p.rowid as propalid, p.fk_statut, p.total_ht, p.ref, p.ref_client, p.remise, "; $sql.= " p.datep as dp, p.fin_validite as datelimite"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."propal as p, ".MAIN_DB_PREFIX."c_propalst as c"; $sql.= " WHERE p.fk_soc = s.rowid AND p.fk_statut = c.id"; @@ -534,6 +534,7 @@ if ($id > 0) print ''; $propal_static->id=$objp->propalid; $propal_static->ref=$objp->ref; + $propal_static->ref_client=$objp->ref_client; print $propal_static->getNomUrl(1); if ( ($db->jdate($objp->dp) < ($now - $conf->propal->cloture->warning_delay)) && $objp->fk_statut == 1 ) { print " ".img_warning(); @@ -561,7 +562,7 @@ if ($id > 0) $commande_static=new Commande($db); $sql = "SELECT s.nom, s.rowid,"; - $sql.= " c.rowid as cid, c.total_ht, c.ref, c.fk_statut, c.facture,"; + $sql.= " c.rowid as cid, c.total_ht, c.ref, c.ref_client, c.fk_statut, c.facture,"; $sql.= " c.date_commande as dc"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande as c"; $sql.= " WHERE c.fk_soc = s.rowid "; @@ -611,6 +612,7 @@ if ($id > 0) print ''; $commande_static->id=$objp->cid; $commande_static->ref=$objp->ref; + $commande_static->ref_client=$objp->ref_client; print $commande_static->getNomUrl(1); print ''.dol_print_date($db->jdate($objp->dc),'day')."\n"; print ''.price($objp->total_ht).''; diff --git a/htdocs/core/boxes/box_activity.php b/htdocs/core/boxes/box_activity.php index 9eaeb1d8cb4..e1f67ffc88e 100644 --- a/htdocs/core/boxes/box_activity.php +++ b/htdocs/core/boxes/box_activity.php @@ -94,7 +94,7 @@ class box_activity extends ModeleBoxes include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; $facturestatic=new Facture($db); - $cachefile = DOL_DATA_ROOT.'/facture/temp/boxactivity-invoice'.$fileid; + $cachefile = DOL_DATA_ROOT.'/cache/boxes/boxactivity-invoice'.$fileid; $refresh = !file_exists($cachefile) || ($now-$cachetime) > dol_filemtime($cachefile); $data = array(); if ($refresh) { @@ -173,7 +173,7 @@ class box_activity extends ModeleBoxes ); } - $cachefile = DOL_DATA_ROOT.'/facture/temp/boxactivity-invoice2'.$fileid; + $cachefile = DOL_DATA_ROOT.'/cache/boxes/boxactivity-invoice2'.$fileid; $refresh = !file_exists($cachefile) || ($now-$cachetime) > dol_filemtime($cachefile); if ($refresh) { @@ -255,7 +255,7 @@ class box_activity extends ModeleBoxes include_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; $commandestatic=new Commande($db); - $cachefile = DOL_DATA_ROOT.'/commande/temp/boxactivity-order'.$fileid; + $cachefile = DOL_DATA_ROOT.'/cache/boxes/boxactivity-order'.$fileid; $refresh = !file_exists($cachefile) || ($now-$cachetime) > dol_filemtime($cachefile); $data = array(); if ($refresh) { @@ -334,7 +334,7 @@ class box_activity extends ModeleBoxes include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; $propalstatic=new Propal($db); - $cachefile = DOL_DATA_ROOT.'/propale/temp/boxactivity-propal'.$fileid; + $cachefile = DOL_DATA_ROOT.'/cache/boxes/boxactivity-propal'.$fileid; $refresh = !file_exists($cachefile) || ($now-$cachetime) > dol_filemtime($cachefile); $data = array(); if ($refresh) { diff --git a/htdocs/core/boxes/box_comptes.php b/htdocs/core/boxes/box_comptes.php index 5340b06f0dd..6a6f12e502d 100644 --- a/htdocs/core/boxes/box_comptes.php +++ b/htdocs/core/boxes/box_comptes.php @@ -127,7 +127,7 @@ class box_comptes extends ModeleBoxes $this->info_box_contents[$i][3] = array( 'td' => 'align="right"', - 'text' => price($solde, 0, $langs, 0, 0, -1, $objp->currency_code) + 'text' => price($solde, 0, $langs, 0, -1, -1, $objp->currency_code) ); $i++; @@ -148,10 +148,10 @@ class box_comptes extends ModeleBoxes 'td' => 'align="right" class="liste_total"', 'text' => ' ' ); - $totalamount=price($solde,0,$langs,0,0,-1,$key); + $this->info_box_contents[$i][3] = array( 'td' => 'align="right" class="liste_total"', - 'text' => $totalamount + 'text' => price($solde, 0, $langs, 0, 0, -1, $key) ); $i++; } diff --git a/htdocs/core/boxes/box_members.php b/htdocs/core/boxes/box_members.php index 4760a3aaf89..1e87995203a 100644 --- a/htdocs/core/boxes/box_members.php +++ b/htdocs/core/boxes/box_members.php @@ -113,39 +113,55 @@ class box_members extends ModeleBoxes $memberstatic->name=$objp->company; } - $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"', - 'logo' => $this->boximg, - 'url' => DOL_URL_ROOT."/adherents/card.php?rowid=".$objp->rowid); + $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[$i][1] = array('td' => 'align="left"', - 'text' => $memberstatic->getFullName($langs), - 'url' => DOL_URL_ROOT."/adherents/card.php?rowid=".$objp->rowid); + $this->info_box_contents[$i][1] = 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('td' => 'align="right"', - 'text' => dol_print_date($datem, "day")); + $this->info_box_contents[$i][2] = array( + 'td' => 'align="right"', + 'text' => dol_print_date($datem, "day"), + ); - $this->info_box_contents[$i][3] = array('td' => 'align="right" width="18"', - 'text' => $memberstatic->LibStatut($objp->status,$objp->cotisation,$db->jdate($objp->date_end_subscription),3)); + $this->info_box_contents[$i][3] = array( + 'td' => 'align="right" width="18"', + 'text' => $memberstatic->LibStatut($objp->status,$objp->cotisation,$db->jdate($objp->date_end_subscription),3), + ); - $i++; - } + $i++; + } - if ($num==0) $this->info_box_contents[$i][0] = array('td' => 'align="center"','text'=>$langs->trans("NoRecordedCustomers")); + if ($num==0) + $this->info_box_contents[$i][0] = array( + 'td' => 'align="center"', + 'text'=>$langs->trans("NoRecordedCustomers"), + ); - $db->free($result); - } - else { - $this->info_box_contents[0][0] = array( 'td' => 'align="left"', - 'maxlength'=>500, - 'text' => ($db->error().' sql='.$sql)); - } - } - else { - $this->info_box_contents[0][0] = array('align' => 'left', - 'text' => $langs->trans("ReadPermissionNotAllowed")); - } + $db->free($result); + } else { + $this->info_box_contents[0][0] = array( + 'td' => 'align="left"', + 'maxlength'=>500, + 'text' => ($db->error().' sql='.$sql), + ); + } + } else { + $this->info_box_contents[0][0] = array( + 'align' => 'left', + 'text' => $langs->trans("ReadPermissionNotAllowed"), + ); + } - } + } /** * Method to show box diff --git a/htdocs/core/boxes/box_produits.php b/htdocs/core/boxes/box_produits.php index d3772ff65f1..ac1d3d9ec19 100644 --- a/htdocs/core/boxes/box_produits.php +++ b/htdocs/core/boxes/box_produits.php @@ -99,13 +99,19 @@ class box_produits extends ModeleBoxes } } - $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"', - 'logo' => ($objp->fk_product_type==1?'object_service':'object_product'), - 'url' => DOL_URL_ROOT."/product/card.php?id=".$objp->rowid); + $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[$i][1] = array('td' => 'align="left"', - 'text' => $objp->label, - 'url' => DOL_URL_ROOT."/product/card.php?id=".$objp->rowid); + $this->info_box_contents[$i][1] = array( + 'td' => 'align="left"', + 'text' => $objp->label, + 'tooltip' => $objp->label, + 'url' => DOL_URL_ROOT."/product/card.php?id=".$objp->rowid, + ); if ($objp->price_base_type == 'HT') { @@ -117,39 +123,54 @@ class box_produits extends ModeleBoxes $price=price($objp->price_ttc); $price_base_type=$langs->trans("TTC"); } - $this->info_box_contents[$i][2] = array('td' => 'align="right"', - 'text' => $price); + $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[$i][3] = 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[$i][4] = 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[$i][5] = 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[$i][6] = array( + 'td' => 'align="right" width="18"', + 'text' => $productstatic->LibStatut($objp->tobuy,3,1), + ); $i++; - } - if ($num==0) $this->info_box_contents[$i][0] = array('td' => 'align="center"','text'=>$langs->trans("NoRecordedProducts")); + } + if ($num==0) + $this->info_box_contents[$i][0] = array( + 'td' => 'align="center"', + 'text'=>$langs->trans("NoRecordedProducts"), + ); - $db->free($result); - } - else - { - $this->info_box_contents[0][0] = array( 'td' => 'align="left"', - 'maxlength'=>500, - 'text' => ($db->error().' sql='.$sql)); - } - } - else { - $this->info_box_contents[0][0] = array('td' => 'align="left"', - 'text' => $langs->trans("ReadPermissionNotAllowed")); - } - } + $db->free($result); + } else { + $this->info_box_contents[0][0] = array( + 'td' => 'align="left"', + 'maxlength'=>500, + 'text' => ($db->error().' sql='.$sql), + ); + } + } else { + $this->info_box_contents[0][0] = array( + 'td' => 'align="left"', + 'text' => $langs->trans("ReadPermissionNotAllowed"), + ); + } + } /** * Method to show box diff --git a/htdocs/core/boxes/modules_boxes.php b/htdocs/core/boxes/modules_boxes.php index aed954fea97..ec1565943c7 100644 --- a/htdocs/core/boxes/modules_boxes.php +++ b/htdocs/core/boxes/modules_boxes.php @@ -178,153 +178,172 @@ class ModeleBoxes // Can't be abtract as it is instantiated to build "empty" */ function showBox($head, $contents) { - global $langs,$conf; + global $langs, $user, $conf; + + require_once DOL_DOCUMENT_ROOT .'/core/lib/files.lib.php'; $MAXLENGTHBOX=60; // Mettre 0 pour pas de limite $bcx=array(); $bcx[0] = 'class="box_pair"'; $bcx[1] = 'class="box_impair"'; $var = false; + $now = dol_now(); + $cachetime = 900; // 900 : 15mn + $fileid = get_class($this).'id-'.$this->box_id.'-e'.$conf->entity.'-u'.$user->id.'-s'.$user->societe_id.'.cache'; + $cachedir = DOL_DATA_ROOT.'/cache/boxes'; + if (! dol_is_dir($cachedir)) dol_mkdir($cachedir); + $cachefile = $cachedir.'/box-'.$fileid; + $refresh = !file_exists($cachefile) || ($now-$cachetime) > dol_filemtime($cachefile); + $out = ''; - dol_syslog(get_class($this).'::showBox'); + if ($refresh) { + dol_syslog(get_class($this).'::showBox'); - // Define nbcol and nblines of the box to show - $nbcol=0; - if (isset($contents[0])) $nbcol=count($contents[0]); - $nblines=count($contents); + // Define nbcol and nblines of the box to show + $nbcol=0; + if (isset($contents[0])) $nbcol=count($contents[0]); + $nblines=count($contents); - print "\n\n\n"; - print '
'."\n"; + $out.= "\n\n"; + $out.= '
'."\n"; - if (! empty($head['text']) || ! empty($head['sublink']) || ! empty($head['subpicto']) || $nblines) - { - print ''."\n"; - } + if (! empty($head['text']) || ! empty($head['sublink']) || ! empty($head['subpicto']) || $nblines) + { + $out.= '
'."\n"; + } - // Show box title - if (! empty($head['text']) || ! empty($head['sublink']) || ! empty($head['subpicto'])) - { - //print '
'."\n"; - //print '
'."\n"; - print ''; - print ' 0) { print ' colspan="'.$nbcol.'"'; } - print '>'; - if ($conf->use_javascript_ajax) - { - print '
'; - } - if (! empty($head['text'])) - { - $s=dol_trunc($head['text'],isset($head['limit'])?$head['limit']:$MAXLENGTHBOX); - print $s; - } - print ' '; - if (! empty($head['sublink'])) print ''; - if (! empty($head['subpicto'])) print img_picto($head['subtext'], $head['subpicto'], 'class="'.(empty($head['subclass'])?'':$head['subclass']).'" id="idsubimg'.$this->boxcode.'"'); - if (! empty($head['sublink'])) ''; - if (! empty($conf->use_javascript_ajax)) - { - print ''; - // The image must have the class 'boxhandle' beause it's value used in DOM draggable objects to define the area used to catch the full object - print img_picto($langs->trans("MoveBox",$this->box_id),'grip_title','class="boxhandle hideonsmartphone" style="cursor:move;"'); - print img_picto($langs->trans("Close2",$this->box_id),'close_title','class="boxclose" rel="x:y" style="cursor:pointer;" id="imgclose'.$this->box_id.'"'); - $label=$head['text']; - if (! empty($head['graph'])) $label.=' ('.$langs->trans("Graph").')'; - print ''; - print '
'; - } - print ''; - print "\n"; - //print "\n"; - //print "
\n"; - } + // Show box title + if (! empty($head['text']) || ! empty($head['sublink']) || ! empty($head['subpicto'])) + { + //$out.= '
'."\n"; + //$out.= ''."\n"; + $out.= ''; + $out.= ' 0) { $out.= ' colspan="'.$nbcol.'"'; } + $out.= '>'; + if ($conf->use_javascript_ajax) + { + $out.= '
'; + } + if (! empty($head['text'])) + { + $s=dol_trunc($head['text'],isset($head['limit'])?$head['limit']:$MAXLENGTHBOX); + $out.= $s; + } + $out.= ' '; + if (! empty($head['sublink'])) $out.= ''; + if (! empty($head['subpicto'])) $out.= img_picto($head['subtext'], $head['subpicto'], 'class="'.(empty($head['subclass'])?'':$head['subclass']).'" id="idsubimg'.$this->boxcode.'"'); + if (! empty($head['sublink'])) ''; + if (! empty($conf->use_javascript_ajax)) + { + $out.= ''; + // The image must have the class 'boxhandle' beause it's value used in DOM draggable objects to define the area used to catch the full object + $out.= img_picto($langs->trans("MoveBox",$this->box_id),'grip_title','class="boxhandle hideonsmartphone" style="cursor:move;"'); + $out.= img_picto($langs->trans("Close2",$this->box_id),'close_title','class="boxclose" rel="x:y" style="cursor:pointer;" id="imgclose'.$this->box_id.'"'); + $label=$head['text']; + if (! empty($head['graph'])) $label.=' ('.$langs->trans("Graph").')'; + $out.= ''; + $out.= '
'; + } + $out.= ''; + $out.= "\n"; + //$out.= "\n"; + //$out.= "
\n"; + } - // Show box lines - if ($nblines) - { - //print ''."\n"; - // Loop on each record - for ($i=0, $n=$nblines; $i < $n; $i++) - { - if (isset($contents[$i])) - { - $var=!$var; + // Show box lines + if ($nblines) + { + //$out.= '
'."\n"; + // Loop on each record + for ($i=0, $n=$nblines; $i < $n; $i++) + { + if (isset($contents[$i])) + { + $var=!$var; - // TR - if (isset($contents[$i][0]['tr'])) print ''; - else print ''; + // TR + if (isset($contents[$i][0]['tr'])) $out.= ''; + else $out.= ''; - // Loop on each TD - $nbcolthisline=count($contents[$i]); - for ($j=0; $j < $nbcolthisline; $j++) { - // Define tdparam - $tdparam=''; - if (isset($contents[$i][$j]['td'])) $tdparam.=' '.$contents[$i][$j]['td']; + // Loop on each TD + $nbcolthisline=count($contents[$i]); + for ($j=0; $j < $nbcolthisline; $j++) { + // Define tdparam + $tdparam=''; + if (isset($contents[$i][$j]['td'])) $tdparam.=' '.$contents[$i][$j]['td']; - if (empty($contents[$i][$j]['text'])) $contents[$i][$j]['text']=""; - $text=isset($contents[$i][$j]['text'])?$contents[$i][$j]['text']:''; - $textwithnotags=preg_replace('/<([^>]+)>/i','',$text); - $text2=isset($contents[$i][$j]['text2'])?$contents[$i][$j]['text2']:''; - $text2withnotags=preg_replace('/<([^>]+)>/i','',$text2); - $textnoformat=isset($contents[$i][$j]['textnoformat'])?$contents[$i][$j]['textnoformat']:''; - //print "xxx $textwithnotags y"; - if (empty($contents[$i][$j]['tooltip'])) $contents[$i][$j]['tooltip']=""; - $tooltip=isset($contents[$i][$j]['tooltip'])?$contents[$i][$j]['tooltip']:''; + if (empty($contents[$i][$j]['text'])) $contents[$i][$j]['text']=""; + $text=isset($contents[$i][$j]['text'])?$contents[$i][$j]['text']:''; + $textwithnotags=preg_replace('/<([^>]+)>/i','',$text); + $text2=isset($contents[$i][$j]['text2'])?$contents[$i][$j]['text2']:''; + $text2withnotags=preg_replace('/<([^>]+)>/i','',$text2); + $textnoformat=isset($contents[$i][$j]['textnoformat'])?$contents[$i][$j]['textnoformat']:''; + //$out.= "xxx $textwithnotags y"; + if (empty($contents[$i][$j]['tooltip'])) $contents[$i][$j]['tooltip']=""; + $tooltip=isset($contents[$i][$j]['tooltip'])?$contents[$i][$j]['tooltip']:''; - print ''."\n"; + $out.= ''."\n"; - // Url - if (! empty($contents[$i][$j]['url']) && empty($contents[$i][$j]['logo'])) - { - print '" - print isset($contents[$i][$j]['target'])?' target="'.$contents[$i][$j]['target'].'"':''; - print '>'; - } + // Url + if (! empty($contents[$i][$j]['url']) && empty($contents[$i][$j]['logo'])) + { + $out.= '" + $out.= isset($contents[$i][$j]['target'])?' target="'.$contents[$i][$j]['target'].'"':''; + $out.= '>'; + } - // Logo - if (! empty($contents[$i][$j]['logo'])) - { - $logo=preg_replace("/^object_/i","",$contents[$i][$j]['logo']); - print ''; - print img_object($langs->trans("Show").' '.$tooltip, $logo, 'class="classfortooltip"'); - } + // Logo + if (! empty($contents[$i][$j]['logo'])) + { + $logo=preg_replace("/^object_/i","",$contents[$i][$j]['logo']); + $out.= ''; + $out.= img_object($langs->trans("Show").' '.$tooltip, $logo, 'class="classfortooltip"'); + } - $maxlength=$MAXLENGTHBOX; - if (! empty($contents[$i][$j]['maxlength'])) $maxlength=$contents[$i][$j]['maxlength']; + $maxlength=$MAXLENGTHBOX; + if (! empty($contents[$i][$j]['maxlength'])) $maxlength=$contents[$i][$j]['maxlength']; - if ($maxlength) $textwithnotags=dol_trunc($textwithnotags,$maxlength); - if (preg_match('/^'; + // End Url + if (! empty($contents[$i][$j]['url'])) $out.= ''; - if (preg_match('/^\n"; - } + $out.= "\n"; + } - print "\n"; - } - } - } + $out.= "\n"; + } + } + } - if (! empty($head['text']) || ! empty($head['sublink']) || ! empty($head['subpicto']) || $nblines) - { - print "
\n"; - } + if (! empty($head['text']) || ! empty($head['sublink']) || ! empty($head['subpicto']) || $nblines) + { + $out.= "\n"; + } - // If invisible box with no contents - if (empty($head['text']) && empty($head['sublink']) && empty($head['subpicto']) && ! $nblines) print "
\n"; + // If invisible box with no contents + if (empty($head['text']) && empty($head['sublink']) && empty($head['subpicto']) && ! $nblines) $out.= "
\n"; - print "
\n"; - print "\n\n"; - } + $out.= "\n"; + $out.= "\n\n"; + file_put_contents($cachefile,serialize($out),LOCK_EX); + } else { + dol_syslog(get_class($this).'::showBoxCached'); + $out = unserialize(file_get_contents($cachefile)); + print ""; + + } + print $out; + } } diff --git a/htdocs/public/test/test_arrays.php b/htdocs/public/test/test_arrays.php index 5ff161f0b1a..cae90530d36 100644 --- a/htdocs/public/test/test_arrays.php +++ b/htdocs/public/test/test_arrays.php @@ -7,7 +7,7 @@ require '../../main.inc.php'; if ($_SERVER['REMOTE_ADDR'] != '127.0.0.1') { - print "Page available only frome remote address 127.0.0.1"; + print "Page available only from remote address 127.0.0.1"; exit; } diff --git a/htdocs/public/test/test_forms.php b/htdocs/public/test/test_forms.php index ece0c218160..e8841eea580 100644 --- a/htdocs/public/test/test_forms.php +++ b/htdocs/public/test/test_forms.php @@ -8,7 +8,7 @@ include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; if ($_SERVER['REMOTE_ADDR'] != '127.0.0.1') { - print "Page available only frome remote address 127.0.0.1"; + print "Page available only from remote address 127.0.0.1"; exit; } diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 4ce603ee1ad..e1f2e424dee 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -1748,11 +1748,13 @@ class Societe extends CommonObject $lien = 'canvas)?'&canvas='.$this->canvas:'').'" title="'.dol_escape_htmltag($name, 1).'" class="classfortooltip">'; + $lien.=(!empty($this->canvas)?'&canvas='.$this->canvas:'').'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">'; $lienfin=''; - if ($withpicto) $result.=($lien.img_object($langs->trans("ShowCompany").': '.$name, 'company', 'class="classfortooltip"').$lienfin); + if ($withpicto) $result.=($lien.img_object($label, 'company', 'class="classfortooltip"').$lienfin); if ($withpicto && $withpicto != 2) $result.=' '; $result.=$lien.($maxlen?dol_trunc($name,$maxlen):$name).$lienfin; diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index 5cde8eb572a..d0d9c9cbb47 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -1181,8 +1181,8 @@ else $object->idprof2 = GETPOST('idprof2', 'alpha'); $object->idprof3 = GETPOST('idprof3', 'alpha'); $object->idprof4 = GETPOST('idprof4', 'alpha'); - $object->idprof5 = GETPOST('idprof5', 'alpha'); - $object->idprof6 = GETPOST('idprof6', 'alpha'); + $object->idprof5 = GETPOST('idprof5', 'alpha'); + $object->idprof6 = GETPOST('idprof6', 'alpha'); $object->typent_id = GETPOST('typent_id', 'int'); $object->effectif_id = GETPOST('effectif_id', 'int'); $object->barcode = GETPOST('barcode', 'alpha'); From e18577aa620ff6343c870f54818157c11335a15e Mon Sep 17 00:00:00 2001 From: frederic34 Date: Sat, 24 Jan 2015 15:36:47 +0100 Subject: [PATCH 2/4] Tooltip and lib for file cache --- htdocs/adherents/class/adherent.class.php | 3 +- htdocs/admin/ihm.php | 23 +++- .../comm/propal/tpl/linkedobjectblock.tpl.php | 4 +- htdocs/commande/class/commande.class.php | 14 ++- htdocs/commande/list.php | 6 +- htdocs/commande/tpl/linkedobjectblock.tpl.php | 8 +- htdocs/compta/facture/class/facture.class.php | 2 + .../facture/tpl/linkedobjectblock.tpl.php | 8 +- htdocs/contrat/tpl/linkedobjectblock.tpl.php | 4 +- htdocs/core/boxes/box_actions.php | 21 ++-- htdocs/core/boxes/box_activity.php | 44 ++++--- htdocs/core/boxes/box_comptes.php | 7 +- htdocs/core/boxes/box_factures_fourn_imp.php | 109 +++++++++++------- htdocs/core/boxes/box_fournisseurs.php | 58 ++++++---- .../core/boxes/box_produits_alerte_stock.php | 70 +++++++---- htdocs/core/boxes/box_project.php | 46 ++++++-- htdocs/core/boxes/box_propales.php | 102 +++++++++------- htdocs/core/boxes/box_prospect.php | 69 ++++++----- htdocs/core/boxes/box_supplier_orders.php | 85 +++++++++----- htdocs/core/boxes/modules_boxes.php | 15 +-- htdocs/core/lib/files.lib.php | 46 ++++++++ .../expedition/tpl/linkedobjectblock.tpl.php | 4 +- .../fichinter/tpl/linkedobjectblock.tpl.php | 4 +- .../class/fournisseur.commande.class.php | 12 +- htdocs/fourn/commande/list.php | 11 +- htdocs/langs/en_US/sendings.lang | 1 + htdocs/product/class/product.class.php | 8 +- htdocs/product/list.php | 1 + htdocs/product/stock/class/entrepot.class.php | 5 +- htdocs/product/stock/list.php | 7 +- 30 files changed, 540 insertions(+), 257 deletions(-) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index f4459adec9f..6ecb4045386 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -1563,7 +1563,8 @@ class Adherent extends CommonObject global $langs; $result=''; - $label=$langs->trans("ShowMember").': '.$this->ref; + $label = '' . $langs->trans("ShowMember") . ''; + $label.= '
' . $langs->trans('Ref') . ': ' . $this->ref; $linkclose = '" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">'; if ($option == 'card') diff --git a/htdocs/admin/ihm.php b/htdocs/admin/ihm.php index 6ebf107ffbe..fb685b3d74b 100644 --- a/htdocs/admin/ihm.php +++ b/htdocs/admin/ihm.php @@ -63,6 +63,7 @@ if ($action == 'update') dolibarr_set_const($db, "MAIN_DEFAULT_WORKING_HOURS", $_POST["MAIN_DEFAULT_WORKING_HOURS"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_SHOW_LOGO", $_POST["MAIN_SHOW_LOGO"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_ACTIVATE_HTML5", $_POST["MAIN_ACTIVATE_HTML5"],'chaine',0,'',$conf->entity); + dolibarr_set_const($db, "MAIN_ACTIVATE_FILECACHE", $_POST["MAIN_ACTIVATE_FILECACHE"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_FIRSTNAME_NAME_POSITION", $_POST["MAIN_FIRSTNAME_NAME_POSITION"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_THEME", $_POST["main_theme"],'chaine',0,'',$conf->entity); @@ -173,7 +174,7 @@ if ($action == 'edit') // Edit print ''; print ' '; print ''; - + // Activate Html5 - Developement - Only available on Eldy template if ($conf->global->MAIN_FEATURES_LEVEL == 2 || ! empty($conf->global->MAIN_ACTIVATE_HTML5)) { @@ -185,6 +186,16 @@ if ($action == 'edit') // Edit print ''; } + // Activate FileCache - Developement + if ($conf->global->MAIN_FEATURES_LEVEL == 2 || ! empty($conf->global->MAIN_ACTIVATE_FILECACHE)) { + $var=!$var; + print ''.$langs->trans("EnableFileCache").''; + print $form->selectyesno('MAIN_ACTIVATE_FILECACHE',$conf->global->MAIN_ACTIVATE_FILECACHE,1); + print ''; + print ' '; + print ''; + } + // Max size of lists $var=!$var; print ''.$langs->trans("DefaultMaxSizeList").''; @@ -363,7 +374,7 @@ else // Show print ''.$langs->trans("EnableShowLogo").'' . yn($conf->global->MAIN_SHOW_LOGO) . ''; print ' '; print ""; - + // Activate Html5 - Developement - Only available on Eldy template if ($conf->global->MAIN_FEATURES_LEVEL == 2 || ! empty($conf->global->MAIN_ACTIVATE_HTML5)) { @@ -373,6 +384,14 @@ else // Show print ""; } + // Activate FileCache - Developement + if ($conf->global->MAIN_FEATURES_LEVEL == 2 || ! empty($conf->global->MAIN_ACTIVATE_FILECACHE)) { + $var=!$var; + print ''.$langs->trans("EnableFileCache").'' . yn($conf->global->MAIN_ACTIVATE_FILECACHE) . ''; + print ' '; + print ""; + } + $var=!$var; print ''.$langs->trans("DefaultMaxSizeList").'' . $conf->global->MAIN_SIZE_LISTE_LIMIT . ''; print ' '; diff --git a/htdocs/comm/propal/tpl/linkedobjectblock.tpl.php b/htdocs/comm/propal/tpl/linkedobjectblock.tpl.php index cb920afd5fc..19763f8510c 100644 --- a/htdocs/comm/propal/tpl/linkedobjectblock.tpl.php +++ b/htdocs/comm/propal/tpl/linkedobjectblock.tpl.php @@ -51,8 +51,8 @@ foreach($linkedObjectBlock as $object) { $var=!$var; ?> - > - trans("ShowPropal"),"propal").' '.$object->ref; ?> + > + getNomUrl(1); ?> ref_client; ?> date,'day'); ?> trans("ShowOrder").': '.$this->ref; + $picto = 'order'; + $label = '' . $langs->trans("ShowOrder") . ''; + if (! empty($this->ref)) + $label .= '
' . $langs->trans('Ref') . ': ' . $this->ref; if (! empty($this->ref_client)) - $label.= '
'.$langs->trans('RefCustomer').': '.$this->ref_client; + $label.= '
' . $langs->trans('RefCustomer') . ': ' . $this->ref_client; + if (! empty($this->total_ht)) + $label.= '
' . $langs->trans('AmountHT') . ': ' . price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency); + if (! empty($this->total_tva)) + $label.= '
' . $langs->trans('TVA') . ': ' . price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency); + if (! empty($this->total_ttc)) + $label.= '
' . $langs->trans('AmountTTC') . ': ' . price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency); $linkstart = ''; $linkend=''; diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 2c30f4128c6..a0a38d50800 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -109,7 +109,7 @@ $companystatic = new Societe($db); $help_url="EN:Module_Customers_Orders|FR:Module_Commandes_Clients|ES:Módulo_Pedidos_de_clientes"; llxHeader('',$langs->trans("Orders"),$help_url); -$sql = 'SELECT s.nom as name, s.rowid as socid, s.client, c.rowid, c.ref, c.total_ht, c.ref_client,'; +$sql = 'SELECT s.nom as name, s.rowid as socid, s.client, c.rowid, c.ref, c.total_ht, c.tva as total_tva, c.total_ttc, c.ref_client,'; $sql.= ' c.date_valid, c.date_commande, c.note_private, c.date_livraison, c.fk_statut, c.facture as facturee'; $sql.= ' FROM '.MAIN_DB_PREFIX.'societe as s'; $sql.= ', '.MAIN_DB_PREFIX.'commande as c'; @@ -334,6 +334,10 @@ if ($resql) $generic_commande->id=$objp->rowid; $generic_commande->ref=$objp->ref; + $generic_commande->ref_client = $objp->ref_client; + $generic_commande->total_ht = $objp->total_ht; + $generic_commande->total_tva = $objp->total_tva; + $generic_commande->total_ttc = $objp->total_ttc; $generic_commande->lines=array(); $generic_commande->getLinesArray(); diff --git a/htdocs/commande/tpl/linkedobjectblock.tpl.php b/htdocs/commande/tpl/linkedobjectblock.tpl.php index c47aefe0958..cabb63aa2b1 100644 --- a/htdocs/commande/tpl/linkedobjectblock.tpl.php +++ b/htdocs/commande/tpl/linkedobjectblock.tpl.php @@ -36,6 +36,7 @@ print_titre($langs->trans('RelatedOrders')); + @@ -47,8 +48,9 @@ foreach($linkedObjectBlock as $object) { $var=!$var; ?> - > + > + + - + "; - print ''; print ''; print ''; From c1943f989bfbaf1132a1d79f76aed042521c7a83 Mon Sep 17 00:00:00 2001 From: frederic34 Date: Sat, 31 Jan 2015 10:58:03 +0100 Subject: [PATCH 4/4] Tooltip --- htdocs/commande/list.php | 4 +++- htdocs/user/class/user.class.php | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index a0a38d50800..5a4f3b5fa14 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -6,6 +6,7 @@ * Copyright (C) 2012 Juanjo Menent * Copyright (C) 2013 Christophe Battarel * Copyright (C) 2013 Cédric Salvador + * Copyright (C) 2015 Frederic France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -109,7 +110,7 @@ $companystatic = new Societe($db); $help_url="EN:Module_Customers_Orders|FR:Module_Commandes_Clients|ES:Módulo_Pedidos_de_clientes"; llxHeader('',$langs->trans("Orders"),$help_url); -$sql = 'SELECT s.nom as name, s.rowid as socid, s.client, c.rowid, c.ref, c.total_ht, c.tva as total_tva, c.total_ttc, c.ref_client,'; +$sql = 'SELECT s.nom as name, s.rowid as socid, s.client, s.code_client, c.rowid, c.ref, c.total_ht, c.tva as total_tva, c.total_ttc, c.ref_client,'; $sql.= ' c.date_valid, c.date_commande, c.note_private, c.date_livraison, c.fk_statut, c.facture as facturee'; $sql.= ' FROM '.MAIN_DB_PREFIX.'societe as s'; $sql.= ', '.MAIN_DB_PREFIX.'commande as c'; @@ -425,6 +426,7 @@ if ($resql) // Company $companystatic->id=$objp->socid; + $companystatic->code_client = $objp->code_client; $companystatic->name=$objp->name; $companystatic->client=$objp->client; print '
trans("Ref"); ?>trans("RefCustomer"); ?> trans("Date"); ?> trans("AmountHTShort"); ?> trans("Status"); ?>
- trans("ShowOrder"),"order").' '.$object->ref; ?>
getNomUrl(1); ?>ref_client; ?> date,'day'); ?> rights->commande->lire) { @@ -62,7 +64,7 @@ foreach($linkedObjectBlock as $object) ?>
trans('TotalHT'); ?>trans('TotalHT'); ?> rights->commande->lire) { echo price($total); diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 32d7fa13122..d30a19cd040 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -859,6 +859,8 @@ class Facture extends CommonInvoice if ($this->type == self::TYPE_DEPOSIT) $picto.='d'; // Deposit invoice $label=$langs->trans("ShowInvoice").': '.$this->ref; + if (! empty($this->ref_client)) + $label.= '
' . $langs->trans('RefCustomer') . $this->ref_client; if ($this->type == self::TYPE_REPLACEMENT) $label=$langs->transnoentitiesnoconv("ShowInvoiceReplace").': '.$this->ref; if ($this->type == self::TYPE_CREDIT_NOTE) $label=$langs->transnoentitiesnoconv("ShowInvoiceAvoir").': '.$this->ref; if ($this->type == self::TYPE_DEPOSIT) $label=$langs->transnoentitiesnoconv("ShowInvoiceDeposit").': '.$this->ref; diff --git a/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php b/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php index ae3038a6021..12f40f8ef97 100644 --- a/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php +++ b/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php @@ -36,6 +36,7 @@ else print_titre($langs->trans("RelatedBill")); + @@ -47,8 +48,9 @@ foreach($linkedObjectBlock as $object) { $var=!$var; ?> - > + > + + - + > + > + diff --git a/htdocs/core/boxes/box_actions.php b/htdocs/core/boxes/box_actions.php index ed5e731d896..06d70d65db0 100644 --- a/htdocs/core/boxes/box_actions.php +++ b/htdocs/core/boxes/box_actions.php @@ -95,10 +95,11 @@ class box_actions extends ModeleBoxes //($langs->transnoentities("Action".$objp->code)!=("Action".$objp->code) ? $langs->transnoentities("Action".$objp->code) : $objp->label) $label=empty($objp->label)?$objp->type_label:$objp->label; + $tooltip = $langs->trans('Action'.$objp->code).': '.$label; $this->info_box_contents[$i][0] = array( 'td' => 'align="left" width="16"', 'logo' => ("action"), - 'tooltip' => $langs->trans('Action'.$objp->code).': '.$label, + 'tooltip' => $tooltip, 'url' => DOL_URL_ROOT."/comm/action/card.php?id=".$objp->id, ); @@ -106,21 +107,22 @@ class box_actions extends ModeleBoxes 'td' => 'align="left"', 'text' => dol_trunc($label,32), 'text2'=> $late, - 'tooltip' => $langs->trans('Action'.$objp->code).': '.$label, + 'tooltip' => $tooltip, 'url' => DOL_URL_ROOT."/comm/action/card.php?id=".$objp->id, ); + $tooltip = $langs->trans('Customer').': '.$objp->name; $this->info_box_contents[$i][2] = array( 'td' => 'align="left" width="16"', 'logo' => ($objp->socid?'company':''), - 'tooltip' => $langs->trans('Customer').': '.$objp->name, + 'tooltip' => $tooltip, 'url' => ($objp->socid?DOL_URL_ROOT."/societe/soc.php?socid=".$objp->socid:''), ); $this->info_box_contents[$i][3] = array( 'td' => 'align="left"', 'text' => dol_trunc($objp->name,24), - 'tooltip' => $langs->trans('Customer').': '.$objp->name, + 'tooltip' => $tooltip, 'url' => DOL_URL_ROOT."/societe/soc.php?socid=".$objp->socid, ); @@ -142,9 +144,13 @@ class box_actions extends ModeleBoxes $i++; } - if ($num==0) $this->info_box_contents[$i][0] = array('td' => 'align="center"','text'=>$langs->trans("NoActionsToDo")); + if ($num==0) + $this->info_box_contents[$i][0] = array( + 'td' => 'align="center"', + 'text'=>$langs->trans("NoActionsToDo"), + ); - $db->free($result); + $db->free($result); } else { $this->info_box_contents[0][0] = array( 'td' => 'align="left"', @@ -171,8 +177,7 @@ class box_actions extends ModeleBoxes { global $langs, $conf; parent::showBox($this->info_box_head, $this->info_box_contents); - if ($conf->global->SHOW_DIALOG_HOMEPAGE) - { + if ($conf->global->SHOW_DIALOG_HOMEPAGE) { $actioncejour=false; $contents=$this->info_box_contents; $nblines=count($contents); diff --git a/htdocs/core/boxes/box_activity.php b/htdocs/core/boxes/box_activity.php index e1f67ffc88e..dcc2b99c887 100644 --- a/htdocs/core/boxes/box_activity.php +++ b/htdocs/core/boxes/box_activity.php @@ -75,6 +75,7 @@ class box_activity extends ModeleBoxes $totalnb = 0; $i = 0; $cachetime = 3600; + $cachedir = DOL_DATA_ROOT.'/cache/boxes'; $fileid = '-e'.$conf->entity.'-u'.$user->id.'-s'.$user->societe_id.'-r'.($user->rights->societe->client->voir?'1':'0').'.cache'; $now = dol_now(); $nbofyears=2; @@ -94,8 +95,9 @@ class box_activity extends ModeleBoxes include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; $facturestatic=new Facture($db); - $cachefile = DOL_DATA_ROOT.'/cache/boxes/boxactivity-invoice'.$fileid; - $refresh = !file_exists($cachefile) || ($now-$cachetime) > dol_filemtime($cachefile); + $filename = '/boxactivity-invoice'.$fileid; + + $refresh = dol_cache_refresh($cachedir, $filename, $cachetime); $data = array(); if ($refresh) { $sql = "SELECT f.fk_statut, SUM(f.total_ttc) as Mnttot, COUNT(*) as nb"; @@ -118,13 +120,15 @@ class box_activity extends ModeleBoxes $data[$j]=$db->fetch_object($result); $j++; } - file_put_contents($cachefile,serialize($data),LOCK_EX); + if (! empty($conf->global->MAIN_ACTIVATE_FILECACHE)) { + dol_filecache($cachedir, $filename, $data); + } $db->free($result); } else { dol_print_error($db); } } else { - $data = unserialize(file_get_contents($cachefile)); + $data = dol_readcachefile($cachedir, $filename); } if (! empty($data)) { $j=0; @@ -173,8 +177,9 @@ class box_activity extends ModeleBoxes ); } - $cachefile = DOL_DATA_ROOT.'/cache/boxes/boxactivity-invoice2'.$fileid; - $refresh = !file_exists($cachefile) || ($now-$cachetime) > dol_filemtime($cachefile); + $filename = '/boxactivity-invoice2'.$fileid; + + $refresh = dol_cache_refresh($cachedir, $filename, $cachetime); if ($refresh) { $sql = "SELECT f.fk_statut, SUM(f.total_ttc) as Mnttot, COUNT(*) as nb"; @@ -193,13 +198,15 @@ class box_activity extends ModeleBoxes $data[$j]=$db->fetch_object($result); $j++; } - file_put_contents($cachefile,serialize($data),LOCK_EX); + if (! empty($conf->global->MAIN_ACTIVATE_FILECACHE)) { + dol_filecache($cachedir, $filename, $data); + } $db->free($result); } else { dol_print_error($db); } } else { - $data = unserialize(file_get_contents($cachefile)); + $data = dol_readcachefile($cachedir, $filename); } if (! empty($data)) { $j=0; @@ -255,9 +262,10 @@ class box_activity extends ModeleBoxes include_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; $commandestatic=new Commande($db); - $cachefile = DOL_DATA_ROOT.'/cache/boxes/boxactivity-order'.$fileid; - $refresh = !file_exists($cachefile) || ($now-$cachetime) > dol_filemtime($cachefile); + $filename = '/boxactivity-order'.$fileid; + $refresh = dol_cache_refresh($cachedir, $filename, $cachetime); $data = array(); + if ($refresh) { $sql = "SELECT c.fk_statut, sum(c.total_ttc) as Mnttot, count(*) as nb"; @@ -282,13 +290,15 @@ class box_activity extends ModeleBoxes $data[$j]=$db->fetch_object($result); $j++; } - file_put_contents($cachefile,serialize($data),LOCK_EX); + if (! empty($conf->global->MAIN_ACTIVATE_FILECACHE)) { + dol_filecache($cachedir, $filename, $data); + } $db->free($result); } else { dol_print_error($db); } } else { - $data = unserialize(file_get_contents($cachefile)); + $data = dol_readcachefile($cachedir, $filename); } if (! empty($data)) { $j=0; @@ -334,8 +344,8 @@ class box_activity extends ModeleBoxes include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; $propalstatic=new Propal($db); - $cachefile = DOL_DATA_ROOT.'/cache/boxes/boxactivity-propal'.$fileid; - $refresh = !file_exists($cachefile) || ($now-$cachetime) > dol_filemtime($cachefile); + $filename = '/boxactivity-propal'.$fileid; + $refresh = dol_cache_refresh($cachedir, $filename, $cachetime); $data = array(); if ($refresh) { $sql = "SELECT p.fk_statut, SUM(p.total) as Mnttot, COUNT(*) as nb"; @@ -360,13 +370,15 @@ class box_activity extends ModeleBoxes $data[$j]=$db->fetch_object($result); $j++; } - file_put_contents($cachefile,serialize($data),LOCK_EX); + if (! empty($conf->global->MAIN_ACTIVATE_FILECACHE)) { + dol_filecache($cachedir, $filename, $data); + } $db->free($result); } else { dol_print_error($db); } } else { - $data = unserialize(file_get_contents($cachefile)); + $data = dol_readcachefile($cachedir, $filename); } if (! empty($data)) { $j=0; diff --git a/htdocs/core/boxes/box_comptes.php b/htdocs/core/boxes/box_comptes.php index 6a6f12e502d..da585f7ea71 100644 --- a/htdocs/core/boxes/box_comptes.php +++ b/htdocs/core/boxes/box_comptes.php @@ -106,17 +106,18 @@ class box_comptes extends ModeleBoxes $solde_total[$objp->currency_code] += $solde; + $tooltip = $langs->trans('Account').': '.$objp->label . '
' . $langs->trans('AccountNumber').': '.$objp->number; $this->info_box_contents[$i][0] = array( 'td' => 'align="left" width="16"', 'logo' => $this->boximg, - 'tooltip' => $langs->trans('Account').': '.$objp->label, + 'tooltip' => $tooltip, 'url' => DOL_URL_ROOT."/compta/bank/account.php?account=".$objp->rowid, ); $this->info_box_contents[$i][1] = array( 'td' => 'align="left"', 'text' => $objp->label, - 'tooltip' => $langs->trans('Account').': '.$objp->label, + 'tooltip' => $tooltip, 'url' => DOL_URL_ROOT."/compta/bank/account.php?account=".$objp->rowid, ); @@ -151,7 +152,7 @@ class box_comptes extends ModeleBoxes $this->info_box_contents[$i][3] = array( 'td' => 'align="right" class="liste_total"', - 'text' => price($solde, 0, $langs, 0, 0, -1, $key) + 'text' => price($solde, 0, $langs, 0, -1, -1, $key) ); $i++; } diff --git a/htdocs/core/boxes/box_factures_fourn_imp.php b/htdocs/core/boxes/box_factures_fourn_imp.php index aa217f1c436..37b42f70cfa 100644 --- a/htdocs/core/boxes/box_factures_fourn_imp.php +++ b/htdocs/core/boxes/box_factures_fourn_imp.php @@ -17,9 +17,9 @@ */ /** - * \file htdocs/core/boxes/box_factures_fourn_imp.php + * \file htdocs/core/boxes/box_factures_fourn_imp.php * \ingroup fournisseur - * \brief Fichier de gestion d'une box des factures fournisseurs impayees + * \brief Fichier de gestion d'une box des factures fournisseurs impayees */ include_once DOL_DOCUMENT_ROOT.'/core/boxes/modules_boxes.php'; @@ -29,9 +29,9 @@ include_once DOL_DOCUMENT_ROOT.'/core/boxes/modules_boxes.php'; */ class box_factures_fourn_imp extends ModeleBoxes { - var $boxcode="oldestunpaidsupplierbills"; - var $boximg="object_bill"; - var $boxlabel="BoxOldestUnpaidSupplierBills"; + var $boxcode = "oldestunpaidsupplierbills"; + var $boximg = "object_bill"; + var $boxlabel = "BoxOldestUnpaidSupplierBills"; var $depends = array("facture","fournisseur"); var $db; @@ -93,55 +93,82 @@ class box_factures_fourn_imp extends ModeleBoxes $late=''; if ($datelimite && $datelimite < ($now - $conf->facture->fournisseur->warning_delay)) $late=img_warning(sprintf($l_due_date,dol_print_date($datelimite,'day'))); - $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"', - 'logo' => $this->boximg, - 'url' => DOL_URL_ROOT."/fourn/facture/card.php?facid=".$objp->facid); + $tooltip = $langs->trans('SupplierInvoice') . ': ' . ($objp->ref?$objp->ref:$objp->facid) . '
' . $langs->trans('RefSupplier') . ': ' . $objp->ref_supplier; + $this->info_box_contents[$i][0] = array( + 'td' => 'align="left" width="16"', + 'logo' => $this->boximg, + 'tooltip' => $tooltip, + 'url' => DOL_URL_ROOT."/fourn/facture/card.php?facid=".$objp->facid, + ); - $this->info_box_contents[$i][1] = array('td' => 'align="left"', - 'text' => ($objp->ref?$objp->ref:$objp->facid), - 'text2'=> $late, - 'url' => DOL_URL_ROOT."/fourn/facture/card.php?facid=".$objp->facid); + $this->info_box_contents[$i][1] = array( + 'td' => 'align="left"', + 'text' => ($objp->ref?$objp->ref:$objp->facid), + 'text2'=> $late, + 'tooltip' => $tooltip, + 'url' => DOL_URL_ROOT."/fourn/facture/card.php?facid=".$objp->facid, + ); - $this->info_box_contents[$i][2] = array('td' => 'align="left"', - 'text' => $objp->ref_supplier, - 'url' => DOL_URL_ROOT."/fourn/facture/card.php?facid=".$objp->facid); + $this->info_box_contents[$i][2] = array( + 'td' => 'align="left"', + 'text' => $objp->ref_supplier, + 'tooltip' => $tooltip, + 'url' => DOL_URL_ROOT."/fourn/facture/card.php?facid=".$objp->facid, + ); - $this->info_box_contents[$i][3] = array('td' => 'align="left" width="16"', - 'logo' => 'company', - 'url' => DOL_URL_ROOT."/fourn/card.php?socid=".$objp->socid); + $tooltip = $langs->trans('Supplier') . ': '. $objp->name; + $this->info_box_contents[$i][3] = array( + 'td' => 'align="left" width="16"', + 'logo' => 'company', + 'tooltip' => $tooltip, + 'url' => DOL_URL_ROOT."/fourn/card.php?socid=".$objp->socid, + ); - $this->info_box_contents[$i][4] = array('td' => 'align="left"', - 'text' => $objp->name, - 'url' => DOL_URL_ROOT."/fourn/card.php?socid=".$objp->socid); + $this->info_box_contents[$i][4] = array( + 'td' => 'align="left"', + 'text' => $objp->name, + 'tooltip' => $tooltip, + 'url' => DOL_URL_ROOT."/fourn/card.php?socid=".$objp->socid, + ); - $this->info_box_contents[$i][5] = array('td' => 'align="right"', - 'text' => dol_print_date($datelimite,'day')); + $this->info_box_contents[$i][5] = array( + 'td' => 'align="right"', + 'text' => dol_print_date($datelimite,'day'), + ); $fac = new FactureFournisseur($db); $fac->fetch($objp->facid); $alreadypaid=$fac->getSommePaiement(); - $this->info_box_contents[$i][6] = array('td' => 'align="right" width="18"', - 'text' => $facturestatic->LibStatut($objp->paye,$objp->fk_statut,3,$alreadypaid,$objp->type)); + $this->info_box_contents[$i][6] = array( + 'td' => 'align="right" width="18"', + 'text' => $facturestatic->LibStatut($objp->paye,$objp->fk_statut,3,$alreadypaid,$objp->type), + ); - $i++; - } + $i++; + } - if ($num==0) $this->info_box_contents[$i][0] = array('td' => 'align="center"','text'=>$langs->trans("NoUnpaidSupplierBills")); + if ($num==0) + $this->info_box_contents[$i][0] = array( + 'td' => 'align="center"', + 'text'=>$langs->trans("NoUnpaidSupplierBills"), + ); - $db->free($result); - } - else { - $this->info_box_contents[0][0] = array( 'td' => 'align="left"', - 'maxlength'=>500, - 'text' => ($db->error().' sql='.$sql)); - } - } - else { - $this->info_box_contents[0][0] = array('td' => 'align="left"', - 'text' => $langs->trans("ReadPermissionNotAllowed")); - } + $db->free($result); + } else { + $this->info_box_contents[0][0] = array( + 'td' => 'align="left"', + 'maxlength'=>500, + 'text' => ($db->error().' sql='.$sql), + ); + } + } else { + $this->info_box_contents[0][0] = array( + 'td' => 'align="left"', + 'text' => $langs->trans("ReadPermissionNotAllowed"), + ); + } - } + } /** * Method to show box diff --git a/htdocs/core/boxes/box_fournisseurs.php b/htdocs/core/boxes/box_fournisseurs.php index f233221ccaa..19850598505 100644 --- a/htdocs/core/boxes/box_fournisseurs.php +++ b/htdocs/core/boxes/box_fournisseurs.php @@ -84,36 +84,52 @@ class box_fournisseurs extends ModeleBoxes $datec=$db->jdate($objp->datec); $datem=$db->jdate($objp->tms); - $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"', - 'logo' => $this->boximg, - 'url' => DOL_URL_ROOT."/fourn/card.php?socid=".$objp->socid); + $tooltip = $langs->trans('Supplier') . ': ' . $objp->name; + $this->info_box_contents[$i][0] = array( + 'td' => 'align="left" width="16"', + 'logo' => $this->boximg, + 'tooltip' => $tooltip, + 'url' => DOL_URL_ROOT."/fourn/card.php?socid=".$objp->socid, + ); - $this->info_box_contents[$i][1] = array('td' => 'align="left"', - 'text' => $objp->name, - 'url' => DOL_URL_ROOT."/fourn/card.php?socid=".$objp->socid); + $this->info_box_contents[$i][1] = array( + 'td' => 'align="left"', + 'text' => $objp->name, + 'tooltip' => $tooltip, + 'url' => DOL_URL_ROOT."/fourn/card.php?socid=".$objp->socid, + ); - $this->info_box_contents[$i][2] = array('td' => 'align="right"', - 'text' => dol_print_date($datem, "day")); + $this->info_box_contents[$i][2] = array( + 'td' => 'align="right"', + 'text' => dol_print_date($datem, "day"), + ); - $this->info_box_contents[$i][3] = array('td' => 'align="right" width="18"', - 'text' => $thirdpartystatic->LibStatut($objp->status,3)); + $this->info_box_contents[$i][3] = array( + 'td' => 'align="right" width="18"', + 'text' => $thirdpartystatic->LibStatut($objp->status,3), + ); $i++; } - if ($num==0) $this->info_box_contents[$i][0] = array('td' => 'align="center"','text'=>$langs->trans("NoRecordedSuppliers")); + if ($num==0) $this->info_box_contents[$i][0] = array( + 'td' => 'align="center"', + 'text'=>$langs->trans("NoRecordedSuppliers"), + ); - $db->free($result); + $db->free($result); + } else { + $this->info_box_contents[0][0] = array( + 'td' => 'align="left"', + 'maxlength'=>500, + 'text' => ($db->error().' sql='.$sql), + ); } - else { - $this->info_box_contents[0][0] = array( 'td' => 'align="left"', - 'maxlength'=>500, - 'text' => ($db->error().' sql='.$sql)); - } - } - else { - $this->info_box_contents[0][0] = array('td' => 'align="left"', - 'text' => $langs->trans("ReadPermissionNotAllowed")); + } else { + $this->info_box_contents[0][0] = array( + 'td' => 'align="left"', + 'text' => $langs->trans("ReadPermissionNotAllowed"), + ); } } diff --git a/htdocs/core/boxes/box_produits_alerte_stock.php b/htdocs/core/boxes/box_produits_alerte_stock.php index 1079f623492..5a1b898fc1f 100644 --- a/htdocs/core/boxes/box_produits_alerte_stock.php +++ b/htdocs/core/boxes/box_produits_alerte_stock.php @@ -83,8 +83,7 @@ class box_produits_alerte_stock extends ModeleBoxes $langs->load("stocks"); $num = $db->num_rows($result); $i = 0; - while ($i < $num) - { + while ($i < $num) { $objp = $db->fetch_object($result); $datem=$db->jdate($objp->tms); @@ -106,13 +105,20 @@ class box_produits_alerte_stock extends ModeleBoxes } } - $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"', - 'logo' => ($objp->fk_product_type==1?'object_service':'object_product'), - 'url' => DOL_URL_ROOT."/product/card.php?id=".$objp->rowid); + $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[$i][1] = array('td' => 'align="left"', - 'text' => $objp->label, - 'url' => DOL_URL_ROOT."/product/card.php?id=".$objp->rowid); + $this->info_box_contents[$i][1] = array( + 'td' => 'align="left"', + 'text' => $objp->label, + 'tooltip' => $tooltip, + 'url' => DOL_URL_ROOT."/product/card.php?id=".$objp->rowid, + ); if ($objp->price_base_type == 'HT') { @@ -124,33 +130,49 @@ class box_produits_alerte_stock extends ModeleBoxes $price=price($objp->price_ttc); $price_base_type=$langs->trans("TTC"); } - $this->info_box_contents[$i][2] = array('td' => 'align="right"', - 'text' => $price); + $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[$i][3] = array( + 'td' => 'align="left" class="nowrap"', + 'text' => $price_base_type, + ); - $this->info_box_contents[$i][4] = array('td' => 'align="center"', - 'text' => $objp->total_stock . ' / '.$objp->seuil_stock_alerte, - 'text2'=>img_warning($langs->transnoentitiesnoconv("StockLowerThanLimit"))); + $this->info_box_contents[$i][4] = 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"', - 'text' => $productstatic->LibStatut($objp->tosell,3,0)); + $this->info_box_contents[$i][5] = 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[$i][6] = array( + 'td' => 'align="right" width="18"', + 'text' => $productstatic->LibStatut($objp->tobuy,3,1), + ); $i++; - } - if ($num==0) $this->info_box_contents[$i][0] = array('td' => 'align="center"','text'=>$langs->trans("NoTooLowStockProducts")); + } + if ($num==0) + $this->info_box_contents[$i][0] = array( + 'td' => 'align="center"', + 'text'=>$langs->trans("NoTooLowStockProducts"), + ); $db->free($result); } else { - $this->info_box_contents[0][0] = array( 'td' => 'align="left"', - 'maxlength'=>500, - 'text' => ($db->error().' sql='.$sql)); + $this->info_box_contents[0][0] = array( + 'td' => 'align="left"', + 'maxlength'=>500, + 'text' => ($db->error().' sql='.$sql), + ); } } else { diff --git a/htdocs/core/boxes/box_project.php b/htdocs/core/boxes/box_project.php index ef38a2537e6..b765c99c836 100644 --- a/htdocs/core/boxes/box_project.php +++ b/htdocs/core/boxes/box_project.php @@ -90,21 +90,24 @@ class box_project extends ModeleBoxes while ($i < $num) { $objp = $db->fetch_object($result); + $tooltip = $langs->trans('Project') . ': ' . $objp->ref; $this->info_box_contents[$i][0] = array( 'td' => 'align="left" width="16"', 'logo' => 'object_project', - 'url' => DOL_URL_ROOT."/projet/card.php?id=".$objp->rowid + 'tooltip' => $tooltip, + 'url' => DOL_URL_ROOT."/projet/card.php?id=".$objp->rowid, ); $this->info_box_contents[$i][1] = array( 'td' => 'align="left"', 'text' => $objp->ref, - 'url' => DOL_URL_ROOT."/product/card.php?id=".$objp->rowid + 'tooltip' => $tooltip, + 'url' => DOL_URL_ROOT."/product/card.php?id=".$objp->rowid, ); $this->info_box_contents[$i][2] = array( 'td' => 'align="left"', - 'text' => $objp->title + 'text' => $objp->title, ); $sql ="SELECT count(*) as nb, sum(progress) as totprogress"; @@ -114,9 +117,15 @@ class box_project extends ModeleBoxes $resultTask = $db->query($sql); if ($resultTask) { $objTask = $db->fetch_object($resultTask); - $this->info_box_contents[$i][3] = array('td' => 'align="right"', 'text' => number_format($objTask->nb, 0, ',', ' ')." ".$langs->trans("Tasks")); + $this->info_box_contents[$i][3] = array( + 'td' => 'align="right"', + 'text' => number_format($objTask->nb, 0, ',', ' ')." ".$langs->trans("Tasks"), + ); if ($objTask->nb > 0 ) - $this->info_box_contents[$i][4] = array('td' => 'align="right"', 'text' => number_format(($objTask->totprogress/$objTask->nb), 0, ',', ' ')."%"); + $this->info_box_contents[$i][4] = array( + 'td' => 'align="right"', + 'text' => number_format(($objTask->totprogress/$objTask->nb), 0, ',', ' ')."%", + ); else $this->info_box_contents[$i][4] = array('td' => 'align="right"', 'text' => "N/A "); $totalnbTask += $objTask->nb; @@ -132,11 +141,28 @@ class box_project extends ModeleBoxes // Add the sum à the bottom of the boxes - $this->info_box_contents[$i][0] = array('tr' => 'class="liste_total"', 'td' => 'align="left" ', 'text' => $langs->trans("Total")." ".$textHead); - $this->info_box_contents[$i][1] = array('td' => '', 'text' => ""); - $this->info_box_contents[$i][2] = array('td' => 'align="right" ', 'text' => number_format($num, 0, ',', ' ')." ".$langs->trans("Projects")); - $this->info_box_contents[$i][3] = array('td' => 'align="right" ', 'text' => number_format($totalnbTask, 0, ',', ' ')." ".$langs->trans("Tasks")); - $this->info_box_contents[$i][4] = array('td' => '', 'text' => ""); + $this->info_box_contents[$i][0] = array( + 'tr' => 'class="liste_total"', + 'td' => 'align="left" ', + 'text' => " ", + ); + $this->info_box_contents[$i][1] = array( + 'td' => '', + 'text' => $langs->trans("Total")." ".$textHead, + 'text' => " ", + ); + $this->info_box_contents[$i][2] = array( + 'td' => 'align="right" ', + 'text' => number_format($num, 0, ',', ' ')." ".$langs->trans("Projects"), + ); + $this->info_box_contents[$i][3] = array( + 'td' => 'align="right" ', + 'text' => number_format($totalnbTask, 0, ',', ' ')." ".$langs->trans("Tasks"), + ); + $this->info_box_contents[$i][4] = array( + 'td' => '', + 'text' => " ", + ); } diff --git a/htdocs/core/boxes/box_propales.php b/htdocs/core/boxes/box_propales.php index e9bd47b2a9e..07bf074665f 100644 --- a/htdocs/core/boxes/box_propales.php +++ b/htdocs/core/boxes/box_propales.php @@ -58,7 +58,7 @@ class box_propales extends ModeleBoxes include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; $propalstatic=new Propal($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) { @@ -83,8 +83,7 @@ class box_propales extends ModeleBoxes $i = 0; - while ($i < $num) - { + while ($i < $num) { $objp = $db->fetch_object($result); $date=$db->jdate($objp->dp); $datec=$db->jdate($objp->datec); @@ -97,52 +96,75 @@ class box_propales extends ModeleBoxes $late = img_warning($langs->trans("Late")); } - $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"', - 'logo' => $this->boximg, - 'url' => DOL_URL_ROOT."/comm/propal.php?id=".$objp->rowid); + $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('td' => 'align="left"', - 'text' => $objp->ref, - 'text2'=> $late, - 'url' => DOL_URL_ROOT."/comm/propal.php?id=".$objp->rowid); + $this->info_box_contents[$i][1] = array( + 'td' => 'align="left"', + 'text' => $objp->ref, + 'text2'=> $late, + 'tooltip' => $tooltip, + 'url' => DOL_URL_ROOT."/comm/propal.php?id=".$objp->rowid, + ); - $this->info_box_contents[$i][2] = array('td' => 'align="left" width="16"', - 'logo' => 'company', - 'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid); + $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('td' => 'align="left"', - 'text' => dol_trunc($objp->name,40), - 'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid); + $this->info_box_contents[$i][3] = array( + 'td' => 'align="left"', + 'text' => dol_trunc($objp->name,40), + 'tooltip' => $tooltip, + 'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid, + ); - $this->info_box_contents[$i][4] = array('td' => 'align="right"', - 'text' => price($objp->total_ht), - ); + $this->info_box_contents[$i][4] = array( + 'td' => 'align="right"', + 'text' => price($objp->total_ht), + ); - $this->info_box_contents[$i][5] = array('td' => 'align="right"', - 'text' => dol_print_date($date,'day')); + $this->info_box_contents[$i][5] = array( + 'td' => 'align="right"', + 'text' => dol_print_date($date,'day'), + ); - $this->info_box_contents[$i][6] = array('td' => 'align="right" width="18"', - 'text' => $propalstatic->LibStatut($objp->fk_statut,3)); + $this->info_box_contents[$i][6] = array( + 'td' => 'align="right" width="18"', + 'text' => $propalstatic->LibStatut($objp->fk_statut,3), + ); - $i++; - } + $i++; + } - if ($num==0) $this->info_box_contents[$i][0] = array('td' => 'align="center"','text'=>$langs->trans("NoRecordedProposals")); + if ($num==0) + $this->info_box_contents[$i][0] = array( + 'td' => 'align="center"', + 'text'=>$langs->trans("NoRecordedProposals"), + ); - $db->free($result); - } - else - { - $this->info_box_contents[0][0] = array( 'td' => 'align="left"', - 'maxlength'=>500, - 'text' => ($db->error().' sql='.$sql)); - } - } - else - { - $this->info_box_contents[0][0] = array('td' => 'align="left"', - 'text' => $langs->trans("ReadPermissionNotAllowed")); - } + $db->free($result); + } else { + $this->info_box_contents[0][0] = array( + 'td' => 'align="left"', + 'maxlength'=>500, + 'text' => ($db->error().' sql='.$sql), + ); + } + } else { + $this->info_box_contents[0][0] = array( + 'td' => 'align="left"', + 'text' => $langs->trans("ReadPermissionNotAllowed"), + ); + } } /** diff --git a/htdocs/core/boxes/box_prospect.php b/htdocs/core/boxes/box_prospect.php index 3020f12f0c4..73d5cf0f70e 100644 --- a/htdocs/core/boxes/box_prospect.php +++ b/htdocs/core/boxes/box_prospect.php @@ -104,41 +104,58 @@ class box_prospect extends ModeleBoxes $datec=$db->jdate($objp->datec); $datem=$db->jdate($objp->tms); - $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"', - 'logo' => $this->boximg, - 'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid); + $this->info_box_contents[$i][0] = array( + 'td' => 'align="left" width="16"', + 'logo' => $this->boximg, + 'tooltip' => $objp->name, + 'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid, + ); - $this->info_box_contents[$i][1] = array('td' => 'align="left"', - 'text' => $objp->name, - 'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid); + $this->info_box_contents[$i][1] = array( + 'td' => 'align="left"', + 'text' => $objp->name, + 'tooltip' => $objp->name, + 'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid, + ); - $this->info_box_contents[$i][2] = array('td' => 'align="right"', - 'text' => dol_print_date($datem, "day")); + $this->info_box_contents[$i][2] = array( + 'td' => 'align="right"', + 'text' => dol_print_date($datem, "day"), + ); - $this->info_box_contents[$i][3] = array('td' => 'align="right" width="18"', - 'text' => str_replace('img ','img height="14" ',$prospectstatic->LibProspStatut($objp->fk_stcomm,3))); + $this->info_box_contents[$i][3] = array( + 'td' => 'align="right" width="18"', + 'text' => str_replace('img ','img height="14" ',$prospectstatic->LibProspStatut($objp->fk_stcomm,3)), + ); - $this->info_box_contents[$i][4] = array('td' => 'align="right" width="18"', - 'text' => $thirdpartystatic->LibStatut($objp->status,3)); + $this->info_box_contents[$i][4] = array( + 'td' => 'align="right" width="18"', + 'text' => $thirdpartystatic->LibStatut($objp->status,3), + ); $i++; - } + } - if ($num==0) $this->info_box_contents[$i][0] = array('td' => 'align="center"','text'=>$langs->trans("NoRecordedProspects")); + if ($num==0) + $this->info_box_contents[$i][0] = array( + 'td' => 'align="center"', + 'text'=>$langs->trans("NoRecordedProspects"), + ); - $db->free($resql); - } - else - { - $this->info_box_contents[0][0] = array( 'td' => 'align="left"', - 'maxlength'=>500, - 'text' => ($db->error().' sql='.$sql)); - } - } - else { + $db->free($resql); + } else { + $this->info_box_contents[0][0] = array( + 'td' => 'align="left"', + 'maxlength'=>500, + 'text' => ($db->error().' sql='.$sql), + ); + } + } else { dol_syslog("box_prospect::loadBox not allowed de read this box content",LOG_ERR); - $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_supplier_orders.php b/htdocs/core/boxes/box_supplier_orders.php index d14bf1a539f..7fb66608840 100644 --- a/htdocs/core/boxes/box_supplier_orders.php +++ b/htdocs/core/boxes/box_supplier_orders.php @@ -82,8 +82,7 @@ class box_supplier_orders extends ModeleBoxes $num = $db->num_rows($result); $i = 0; - while ($i < $num) - { + while ($i < $num) { $objp = $db->fetch_object($result); $date=$db->jdate($objp->date_commande); $datem=$db->jdate($objp->tms); @@ -91,48 +90,70 @@ class box_supplier_orders extends ModeleBoxes $urlo = DOL_URL_ROOT."/fourn/commande/card.php?id=".$objp->rowid; $urls = DOL_URL_ROOT."/fourn/card.php?socid=".$objp->socid; - $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"', - 'logo' => $this->boximg, - 'url' => $urlo); - - $this->info_box_contents[$i][1] = array('td' => 'align="left"', - 'text' => $objp->ref, - 'url' => $urlo); - - $this->info_box_contents[$i][2] = array('td' => 'align="left" width="16"', - 'logo' => 'company', - 'url' => $urls); - - $this->info_box_contents[$i][3] = array('td' => 'align="left"', - 'text' => $objp->name, - 'url' => $urls); - - $this->info_box_contents[$i][4] = array('td' => 'align="right"', - 'text' => dol_print_date($date,'day'), + $tooltip = $langs->trans('SupplierOrder') . ': ' . $objp->ref; + $this->info_box_contents[$i][0] = array( + 'td' => 'align="left" width="16"', + 'logo' => $this->boximg, + 'tooltip' => $tooltip, + 'url' => $urlo, ); - $this->info_box_contents[$i][5] = array('td' => 'align="right" width="18"', - 'text' => $supplierorderstatic->LibStatut($objp->fk_statut,3)); + $this->info_box_contents[$i][1] = array( + 'td' => 'align="left"', + 'text' => $objp->ref, + 'tooltip' => $tooltip, + 'url' => $urlo, + ); + + $tooltip = $langs->trans('Supplier') . ': ' . $objp->name; + $this->info_box_contents[$i][2] = array( + 'td' => 'align="left" width="16"', + 'logo' => 'company', + 'tooltip' => $tooltip, + 'url' => $urls, + ); + + $this->info_box_contents[$i][3] = array( + 'td' => 'align="left"', + 'text' => $objp->name, + 'tooltip' => $tooltip, + 'url' => $urls, + ); + + $this->info_box_contents[$i][4] = array( + 'td' => 'align="right"', + 'text' => dol_print_date($date,'day'), + ); + + $this->info_box_contents[$i][5] = array( + 'td' => 'align="right" width="18"', + 'text' => $supplierorderstatic->LibStatut($objp->fk_statut,3), + ); $i++; } if ($num == 0) - $this->info_box_contents[$i][0] = array('td' => 'align="center"', 'text' => $langs->trans("NoSupplierOrder")); + $this->info_box_contents[$i][0] = array( + 'td' => 'align="center"', + 'text' => $langs->trans("NoSupplierOrder"), + ); - $db->free($result); - } - else - { - $this->info_box_contents[0][0] = array( 'td' => 'align="left"', - 'maxlength'=>500, - 'text' => ($db->error().' sql='.$sql)); + $db->free($result); + } else { + $this->info_box_contents[0][0] = array( + 'td' => 'align="left"', + 'maxlength'=>500, + 'text' => ($db->error().' sql='.$sql), + ); } } 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/modules_boxes.php b/htdocs/core/boxes/modules_boxes.php index ec1565943c7..faaaaff2ec6 100644 --- a/htdocs/core/boxes/modules_boxes.php +++ b/htdocs/core/boxes/modules_boxes.php @@ -187,13 +187,12 @@ class ModeleBoxes // Can't be abtract as it is instantiated to build "empty" $bcx[0] = 'class="box_pair"'; $bcx[1] = 'class="box_impair"'; $var = false; - $now = dol_now(); + $cachetime = 900; // 900 : 15mn - $fileid = get_class($this).'id-'.$this->box_id.'-e'.$conf->entity.'-u'.$user->id.'-s'.$user->societe_id.'.cache'; $cachedir = DOL_DATA_ROOT.'/cache/boxes'; - if (! dol_is_dir($cachedir)) dol_mkdir($cachedir); - $cachefile = $cachedir.'/box-'.$fileid; - $refresh = !file_exists($cachefile) || ($now-$cachetime) > dol_filemtime($cachefile); + $fileid = get_class($this).'id-'.$this->box_id.'-e'.$conf->entity.'-u'.$user->id.'-s'.$user->societe_id.'.cache'; + $filename = '/box-'.$fileid; + $refresh = dol_cache_refresh($cachedir, $filename, $cachetime); $out = ''; if ($refresh) { @@ -335,10 +334,12 @@ class ModeleBoxes // Can't be abtract as it is instantiated to build "empty" $out.= "\n"; $out.= "\n\n"; - file_put_contents($cachefile,serialize($out),LOCK_EX); + if (! empty($conf->global->MAIN_ACTIVATE_FILECACHE)) { + dol_filecache($cachedir, $filename, $out); + } } else { dol_syslog(get_class($this).'::showBoxCached'); - $out = unserialize(file_get_contents($cachefile)); + $out = dol_readcachefile($cachedir, $filename); print ""; } diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 4b9e7eb520f..8cf4bb3473e 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -1876,3 +1876,49 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu return $ret; } + +/** + * Store object in file + * + * @param string $directory Directory of cache + * @param string $filename Name of filecache + * @param mixed $object Object to store in cachefile + * @return void + */ +function dol_filecache($directory, $filename, $object) +{ + if (! dol_is_dir($directory)) dol_mkdir($directory); + $cachefile = $directory . $filename; + file_put_contents($cachefile, serialize($object), LOCK_EX); + @chmod($cachefile, 0644); +} + +/** + * Test if Refresh needed + * + * @param string $directory Directory of cache + * @param string $filename Name of filecache + * @param int $cachetime Cachetime delay + * @return boolean 0 no refresh 1 if refresh needed + */ +function dol_cache_refresh($directory, $filename, $cachetime) +{ + $now = dol_now(); + $cachefile = $directory . $filename; + $refresh = !file_exists($cachefile) || ($now-$cachetime) > dol_filemtime($cachefile); + return $refresh; +} + +/** + * Read object from cachefile + * + * @param string $directory Directory of cache + * @param string $filename Name of filecache + * @return mixed Unserialise from file + */ +function dol_readcachefile($directory, $filename) +{ + $cachefile = $directory . $filename; + $object = unserialize(file_get_contents($cachefile)); + return $object; +} diff --git a/htdocs/expedition/tpl/linkedobjectblock.tpl.php b/htdocs/expedition/tpl/linkedobjectblock.tpl.php index 72206c13e2b..9c6d2c7679a 100644 --- a/htdocs/expedition/tpl/linkedobjectblock.tpl.php +++ b/htdocs/expedition/tpl/linkedobjectblock.tpl.php @@ -46,8 +46,8 @@ foreach($linkedObjectBlock as $object) { $var=!$var; ?> - > + > + > + > + diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index ef25be9469f..24aaa1952aa 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -531,7 +531,17 @@ class CommandeFournisseur extends CommonOrder global $langs; $result=''; - $label=$langs->trans("ShowOrder").': '.$this->ref; + $label = '' . $langs->trans("ShowOrder") . ''; + if (! empty($this->ref)) + $label .= '
' . $langs->trans('Ref') . ': ' . $this->ref; + if (! empty($this->ref_supplier)) + $label.= '
' . $langs->trans('RefSupplier') . ': ' . $this->ref_supplier; + if (! empty($this->total_ht)) + $label.= '
' . $langs->trans('AmountHT') . ': ' . price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency); + if (! empty($this->total_tva)) + $label.= '
' . $langs->trans('TVA') . ': ' . price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency); + if (! empty($this->total_ttc)) + $label.= '
' . $langs->trans('AmountTTC') . ': ' . price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency); $lien = ''; $lienfin=''; diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index 4f0974abd10..a64ee006fe6 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -99,7 +99,7 @@ $offset = $conf->liste_limit * $page ; */ $sql = "SELECT s.rowid as socid, s.nom as name, cf.date_commande as dc,"; -$sql.= " cf.rowid,cf.ref, cf.ref_supplier, cf.fk_statut, cf.total_ttc, cf.fk_user_author,cf.date_livraison,"; +$sql.= " cf.rowid,cf.ref, cf.ref_supplier, cf.fk_statut, cf.total_ht, cf.tva as total_tva, cf.total_ttc, cf.fk_user_author,cf.date_livraison,"; $sql.= " u.login"; $sql.= " FROM (".MAIN_DB_PREFIX."societe as s,"; $sql.= " ".MAIN_DB_PREFIX."commande_fournisseur as cf"; @@ -213,11 +213,18 @@ if ($resql) { $obj = $db->fetch_object($resql); $var=!$var; + $objectstatic->id=$obj->rowid; + $objectstatic->ref=$obj->ref; + $objectstatic->ref_supplier = $obj->ref_supplier; + $objectstatic->total_ht = $obj->total_ht; + $objectstatic->total_tva = $obj->total_tva; + $objectstatic->total_ttc = $obj->total_ttc; print ""; // Ref - print '\n"; diff --git a/htdocs/product/stock/class/entrepot.class.php b/htdocs/product/stock/class/entrepot.class.php index 3bfbbbffbcb..3c3d127223e 100644 --- a/htdocs/product/stock/class/entrepot.class.php +++ b/htdocs/product/stock/class/entrepot.class.php @@ -512,7 +512,10 @@ class Entrepot extends CommonObject global $langs; $result=''; - $label = $langs->trans("ShowStock").': '.$this->libelle; + $label = '' . $langs->trans("ShowWarehouse").''; + $label.= '
' . $langs->trans('Ref') . ': ' . $this->libelle; + if (! empty($this->lieu)) + $label.= '
' . $langs->trans('LocationSummary').': '.$this->lieu; $lien=''; $lienfin=''; diff --git a/htdocs/product/stock/list.php b/htdocs/product/stock/list.php index c85c501fa58..f6417b389e1 100644 --- a/htdocs/product/stock/list.php +++ b/htdocs/product/stock/list.php @@ -103,9 +103,12 @@ if ($result) while ($i < min($num,$limit)) { $objp = $db->fetch_object($result); + $entrepot->id = $objp->rowid; + $entrepot->libelle = $objp->ref; + $entrepot->lieu = $objp->lieu; print ""; - print ''; - // Location + print ''; + // Location print ''; // PMP value print '"; print '"; print '\n"; print ''; @@ -751,15 +763,18 @@ if ($id > 0) { $facturestatic = new Facture($db); - $sql = 'SELECT f.rowid as facid, f.facnumber, f.type, f.amount, f.total, f.total_ttc,'; - $sql.= ' f.datef as df, f.datec as dc, f.paye as paye, f.fk_statut as statut,'; - $sql.= ' s.nom, s.rowid as socid,'; - $sql.= ' SUM(pf.amount) as am'; + $sql = 'SELECT f.rowid as facid, f.facnumber, f.type, f.amount'; + $sql.= ', f.total'; + $sql.= ', f.tva as total_tva'; + $sql.= ', f.total_ttc'; + $sql.= ', f.datef as df, f.datec as dc, f.paye as paye, f.fk_statut as statut'; + $sql.= ', s.nom, s.rowid as socid'; + $sql.= ', SUM(pf.amount) as am'; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f"; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'paiement_facture as pf ON f.rowid=pf.fk_facture'; $sql.= " WHERE f.fk_soc = s.rowid AND s.rowid = ".$object->id; $sql.= " AND f.entity = ".$conf->entity; - $sql.= ' GROUP BY f.rowid, f.facnumber, f.type, f.amount, f.total, f.total_ttc,'; + $sql.= ' GROUP BY f.rowid, f.facnumber, f.type, f.amount, f.total, f.tva, f.total_ttc,'; $sql.= ' f.datef, f.datec, f.paye, f.fk_statut,'; $sql.= ' s.nom, s.rowid'; $sql.= " ORDER BY f.datef DESC, f.datec DESC"; @@ -788,9 +803,12 @@ if ($id > 0) $var=!$var; print ""; print ''; if ($objp->df > 0) diff --git a/htdocs/comm/index.php b/htdocs/comm/index.php index 5e2cc35e796..666ce7e355c 100644 --- a/htdocs/comm/index.php +++ b/htdocs/comm/index.php @@ -142,7 +142,7 @@ if (! empty($conf->ficheinter->enabled) && $user->rights->ficheinter->lire) */ if (! empty($conf->propal->enabled) && $user->rights->propal->lire) { - $sql = "SELECT p.rowid, p.ref, p.ref_client, p.total_ht, s.rowid as socid, s.nom as name, s.client, s.canvas"; + $sql = "SELECT p.rowid, p.ref, p.ref_client, p.total_ht, p.tva as total_tva, p.total as total_ttc, s.rowid as socid, s.nom as name, s.client, s.canvas"; $sql.= " FROM ".MAIN_DB_PREFIX."propal as p"; $sql.= ", ".MAIN_DB_PREFIX."societe as s"; if (! $user->rights->societe->client->voir && ! $socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; @@ -173,6 +173,9 @@ if (! empty($conf->propal->enabled) && $user->rights->propal->lire) $propalstatic->id=$obj->rowid; $propalstatic->ref=$obj->ref; $propalstatic->ref_client=$obj->ref_client; + $propalstatic->total_ht = $obj->total_ht; + $propalstatic->total_tva = $obj->total_tva; + $propalstatic->total_ttc = $obj->total_ttc; print $propalstatic->getNomUrl(1); print ''; print ''; print '\n"; + //print $thirdparty_static->getNomUrl(1); + //print "\n"; // Type - print '\n"; + // Type + print '\n"; + // Type + print '\n"; + // Type + print '\n"; + print ''; // Last modified date diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 11eaa8afb45..70349b1db83 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -1781,12 +1781,58 @@ class User extends CommonObject * @param string $option On what the link point to * @return string String with URL */ - function getNomUrl($withpicto=0,$option='') + function getNomUrl($withpicto=0, $option='', $infologin=0) { - global $langs; + global $langs, $conf, $db; + global $dolibarr_main_authentication, $dolibarr_main_demo; + + + $result = ''; + $companylink = ''; + + $label = '' . $langs->trans("User") . ''; + $label.= '
trans("Ref"); ?>trans("RefCustomer"); ?> trans("Date"); ?> trans("AmountHTShort"); ?> trans("Status"); ?>
- trans("ShowBill"),"bill").' '.$object->ref; ?>
getNomUrl(1); ?>ref_client; ?> date,'day'); ?> rights->facture->lire) { @@ -61,7 +63,7 @@ foreach($linkedObjectBlock as $object) } ?>
trans("TotalHT"); ?>trans("TotalHT"); ?> rights->facture->lire) { echo price($total); diff --git a/htdocs/contrat/tpl/linkedobjectblock.tpl.php b/htdocs/contrat/tpl/linkedobjectblock.tpl.php index d94d45489fd..f7f840dce13 100644 --- a/htdocs/contrat/tpl/linkedobjectblock.tpl.php +++ b/htdocs/contrat/tpl/linkedobjectblock.tpl.php @@ -42,8 +42,8 @@ foreach($linkedObjectBlock as $object) $object->fetch_lines(); $var=!$var; ?> -
- trans("ShowContract"),"contract").' '.$object->ref; ?>
getNomUrl(1); ?> date_contrat,'day'); ?>   getLibStatut(6); ?>
- trans("ShowShipping"),"sending").' '.$object->ref; ?>
getNomUrl(1); ?> date_creation,'day'); ?> date_delivery,'day'); ?> -
- trans("ShowIntervention"),"intervention").' '.$object->ref; ?>
getNomUrl(1); ?> datev,'day'); ?> getLibStatut(3); ?>
'.img_object($langs->trans("ShowOrder"),"order").' '.$obj->ref.''; + print ''; + print $objectstatic->getNomUrl(1); $filename=dol_sanitizeFileName($obj->ref); $filedir=$conf->fournisseur->dir_output.'/commande' . '/' . dol_sanitizeFileName($obj->ref); print $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir); diff --git a/htdocs/langs/en_US/sendings.lang b/htdocs/langs/en_US/sendings.lang index f6111bac684..f39fcc06574 100644 --- a/htdocs/langs/en_US/sendings.lang +++ b/htdocs/langs/en_US/sendings.lang @@ -4,6 +4,7 @@ Sending=Shipment Sendings=Shipments Shipment=Shipment Shipments=Shipments +ShowSending=Show Sending Receivings=Receivings SendingsArea=Shipments area ListOfSendings=List of shipments diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index a889136de01..434ff255de5 100755 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -2814,8 +2814,12 @@ class Product extends CommonObject $result=''; $newref=$this->ref; if ($maxlength) $newref=dol_trunc($newref,$maxlength,'middle'); - if ($this->type == 0) $label = $langs->trans("ShowProduct").': '.$this->ref.' '.$this->label; - if ($this->type == 1) $label = $langs->trans("ShowService").': '.$this->ref.' '.$this->label; + if ($this->type == 0) $label = '' . $langs->trans("ShowProduct") . ''; + if ($this->type == 1) $label = '' . $langs->trans("ShowService") . ''; + if (! empty($this->ref)) + $label .= '
' . $langs->trans('Ref') . ': ' . $this->ref; + if (! empty($this->label)) + $label .= '
' . $langs->trans('Label') . ': ' . $this->label; $linkclose = '" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">'; if ($option == 'supplier') { diff --git a/htdocs/product/list.php b/htdocs/product/list.php index a5cc97defa7..fb724c252ab 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -420,6 +420,7 @@ else print '
'; $product_static->id = $objp->rowid; $product_static->ref = $objp->ref; + $product_static->label = $objp->label; $product_static->type = $objp->fk_product_type; print $product_static->getNomUrl(1,'',24); print "
'.img_object($langs->trans("ShowWarehouse"),'stock').' '.$objp->ref.'' . $entrepot->getNomUrl(1) . ''.$objp->lieu.''; From 736bee565c92862ec35be000920f62356e411d0c Mon Sep 17 00:00:00 2001 From: frederic34 Date: Sun, 25 Jan 2015 01:20:58 +0100 Subject: [PATCH 3/4] Tooltip everywhere --- htdocs/comm/action/class/actioncomm.class.php | 8 +- htdocs/comm/card.php | 54 ++++++--- htdocs/comm/index.php | 15 ++- htdocs/comm/propal/class/propal.class.php | 18 ++- htdocs/commande/card.php | 2 +- htdocs/commande/class/commande.class.php | 4 +- htdocs/compta/bank/class/account.class.php | 9 +- htdocs/compta/bank/releve.php | 7 +- htdocs/compta/facture/class/facture.class.php | 16 ++- htdocs/compta/index.php | 107 +++++++++++++----- htdocs/contact/class/contact.class.php | 3 +- htdocs/core/boxes/box_actions.php | 66 +++++------ htdocs/core/boxes/box_activity.php | 17 +-- htdocs/core/boxes/box_bookmarks.php | 1 + htdocs/core/boxes/box_clients.php | 33 +++--- htdocs/core/boxes/box_commandes.php | 63 ++++++----- htdocs/core/boxes/box_comptes.php | 32 ++---- htdocs/core/boxes/box_contacts.php | 31 ++--- htdocs/core/boxes/box_contracts.php | 1 + htdocs/core/boxes/box_external_rss.php | 1 + htdocs/core/boxes/box_factures.php | 87 +++++++------- htdocs/core/boxes/box_factures_fourn.php | 55 ++++----- htdocs/core/boxes/box_factures_fourn_imp.php | 1 + htdocs/core/boxes/box_factures_imp.php | 77 ++++++++----- htdocs/core/boxes/box_ficheinter.php | 27 ++--- htdocs/core/boxes/box_fournisseurs.php | 1 + htdocs/core/boxes/box_members.php | 1 + htdocs/core/boxes/box_produits.php | 1 + .../core/boxes/box_produits_alerte_stock.php | 1 + htdocs/core/boxes/box_project.php | 2 + htdocs/core/boxes/box_propales.php | 1 + htdocs/core/boxes/box_prospect.php | 1 + htdocs/core/boxes/box_supplier_orders.php | 1 + htdocs/core/boxes/box_task.php | 5 +- htdocs/core/boxes/modules_boxes.php | 5 +- htdocs/core/class/commonobject.class.php | 2 + htdocs/core/lib/company.lib.php | 59 ++++++---- htdocs/expedition/class/expedition.class.php | 4 +- htdocs/expedition/list.php | 25 ++-- htdocs/expedition/shipment.php | 9 +- htdocs/fichinter/class/fichinter.class.php | 4 +- htdocs/fourn/card.php | 15 ++- .../fourn/class/fournisseur.facture.class.php | 13 ++- htdocs/fourn/commande/list.php | 23 ++-- htdocs/main.inc.php | 7 +- htdocs/product/class/product.class.php | 11 +- htdocs/product/index.php | 3 + htdocs/product/reassort.php | 1 + htdocs/product/stock/card.php | 3 +- htdocs/product/stock/mouvement.php | 4 +- htdocs/product/stock/product.php | 3 +- htdocs/projet/class/project.class.php | 6 +- htdocs/societe/class/societe.class.php | 23 +++- htdocs/societe/index.php | 46 ++++++-- htdocs/user/class/user.class.php | 56 ++++++++- htdocs/user/home.php | 28 ++++- 56 files changed, 709 insertions(+), 390 deletions(-) diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index d7f63d31872..8b93610e85e 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -897,9 +897,11 @@ class ActionComm extends CommonObject global $conf,$langs; $result=''; - $label=$this->label; + $tooltip = '' . $langs->trans('ShowAction'.$objp->code) . ''; + $tooltip .= '
' . $langs->trans('Ref') . ': ' . $this->label; + $label = $this->label; if (empty($label)) $label=$this->libelle; // For backward compatibility - $linkclose = '" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">'; + $linkclose = '" title="'.dol_escape_htmltag($tooltip, 1).'" class="classfortooltip">'; if ($option=='birthday') $lien = 'type_code) != "Action".$this->type_code)?$langs->transnoentities("Action".$this->type_code):$this->type_label; $libelleshort=dol_trunc($libelle,$maxlength); diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index 2ad30d3b4b9..d84e45692f5 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -500,8 +500,11 @@ if ($id > 0) { $propal_static = new Propal($db); - $sql = "SELECT s.nom, s.rowid, p.rowid as propalid, p.fk_statut, p.total_ht, p.ref, p.ref_client, p.remise, "; - $sql.= " p.datep as dp, p.fin_validite as datelimite"; + $sql = "SELECT s.nom, s.rowid, p.rowid as propalid, p.fk_statut, p.total_ht"; + $sql.= ", p.tva as total_tva"; + $sql.= ", p.total as total_ttc"; + $sql.= ", p.ref, p.ref_client, p.remise"; + $sql.= ", p.datep as dp, p.fin_validite as datelimite"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."propal as p, ".MAIN_DB_PREFIX."c_propalst as c"; $sql.= " WHERE p.fk_soc = s.rowid AND p.fk_statut = c.id"; $sql.= " AND s.rowid = ".$object->id; @@ -532,9 +535,12 @@ if ($id > 0) $var=!$var; print "
'; - $propal_static->id=$objp->propalid; - $propal_static->ref=$objp->ref; - $propal_static->ref_client=$objp->ref_client; + $propal_static->id = $objp->propalid; + $propal_static->ref = $objp->ref; + $propal_static->ref_client = $objp->ref_client; + $propal_static->total_ht = $objp->total_ht; + $propal_static->total_tva = $objp->total_tva; + $propal_static->total_ttc = $objp->total_ttc; print $propal_static->getNomUrl(1); if ( ($db->jdate($objp->dp) < ($now - $conf->propal->cloture->warning_delay)) && $objp->fk_statut == 1 ) { print " ".img_warning(); @@ -561,9 +567,12 @@ if ($id > 0) { $commande_static=new Commande($db); - $sql = "SELECT s.nom, s.rowid,"; - $sql.= " c.rowid as cid, c.total_ht, c.ref, c.ref_client, c.fk_statut, c.facture,"; - $sql.= " c.date_commande as dc"; + $sql = "SELECT s.nom, s.rowid"; + $sql.= ", c.rowid as cid, c.total_ht"; + $sql.= ", c.tva as total_tva"; + $sql.= ", c.total_ttc"; + $sql.= ", c.ref, c.ref_client, c.fk_statut, c.facture"; + $sql.= ", c.date_commande as dc"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande as c"; $sql.= " WHERE c.fk_soc = s.rowid "; $sql.= " AND s.rowid = ".$object->id; @@ -610,9 +619,12 @@ if ($id > 0) $var=!$var; print "
'; - $commande_static->id=$objp->cid; - $commande_static->ref=$objp->ref; + $commande_static->id = $objp->cid; + $commande_static->ref = $objp->ref; $commande_static->ref_client=$objp->ref_client; + $commande_static->total_ht = $objp->total_ht; + $commande_static->total_tva = $objp->total_tva; + $commande_static->total_ttc = $objp->total_ttc; print $commande_static->getNomUrl(1); print ''.dol_print_date($db->jdate($objp->dc),'day')."'.price($objp->total_ht).'
'; - $facturestatic->id=$objp->facid; - $facturestatic->ref=$objp->facnumber; - $facturestatic->type=$objp->type; + $facturestatic->id = $objp->facid; + $facturestatic->ref = $objp->facnumber; + $facturestatic->type = $objp->type; + $facturestatic->total_ht = $objp->total; + $facturestatic->total_tva = $objp->total_tva; + $facturestatic->total_ttc = $objp->total_ttc; print $facturestatic->getNomUrl(1); print ''; @@ -210,7 +213,7 @@ if (! empty($conf->commande->enabled) && $user->rights->commande->lire) { $langs->load("orders"); - $sql = "SELECT c.rowid, c.ref, c.ref_client, c.total_ttc, s.rowid as socid, s.nom as name, s.client, s.canvas"; + $sql = "SELECT c.rowid, c.ref, c.ref_client, c.total_ht, c.tva as total_tva, c.total_ttc, s.rowid as socid, s.nom as name, s.client, s.canvas"; $sql.= " FROM ".MAIN_DB_PREFIX."commande as c"; $sql.= ", ".MAIN_DB_PREFIX."societe as s"; if (! $user->rights->societe->client->voir && ! $socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; @@ -241,6 +244,9 @@ if (! empty($conf->commande->enabled) && $user->rights->commande->lire) $orderstatic->id=$obj->rowid; $orderstatic->ref=$obj->ref; $orderstatic->ref_client=$obj->ref_client; + $orderstatic->total_ht = $obj->total_ht; + $orderstatic->total_tva = $obj->total_tva; + $orderstatic->total_ttc = $obj->total_ttc; print $orderstatic->getNomUrl(1); print ''; @@ -469,7 +475,7 @@ if (! empty($conf->propal->enabled) && $user->rights->propal->lire) { $langs->load("propal"); - $sql = "SELECT s.nom as name, s.rowid, p.rowid as propalid, p.total as total_ttc, p.total_ht, p.ref, p.ref_client, p.fk_statut, p.datep as dp, p.fin_validite as dfv"; + $sql = "SELECT s.nom as name, s.rowid, p.rowid as propalid, p.total as total_ttc, p.total_ht, p.tva as total_tva, p.ref, p.ref_client, p.fk_statut, p.datep as dp, p.fin_validite as dfv"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql.= ", ".MAIN_DB_PREFIX."propal as p"; if (! $user->rights->societe->client->voir && ! $socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; @@ -506,6 +512,9 @@ if (! empty($conf->propal->enabled) && $user->rights->propal->lire) $propalstatic->id=$obj->propalid; $propalstatic->ref=$obj->ref; $propalstatic->ref_client=$obj->ref_client; + $propalstatic->total_ht = $obj->total_ht; + $propalstatic->total_tva = $obj->total_tva; + $propalstatic->total_ttc = $obj->total_ttc; print ''; print ''; print ''; print ''; @@ -218,8 +227,10 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire) */ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture->lire) { - $sql = "SELECT f.ref, f.rowid, f.total_ttc, f.type,"; - $sql.= " s.nom as name, s.rowid as socid"; + $sql = "SELECT f.ref, f.rowid, f.total_ht, f.tva as total_tva, f.total_ttc, f.type"; + $sql.= ", s.nom as name"; + $sql.= ", s.rowid as socid"; + $sql.= ", s.code_fournisseur"; $sql.= " FROM ".MAIN_DB_PREFIX."facture_fourn as f, ".MAIN_DB_PREFIX."societe as s"; if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE s.rowid = f.fk_soc AND f.fk_statut = 0"; @@ -249,14 +260,19 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture- print ''; print ''; print ''; print ''; @@ -292,10 +308,12 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire) $langs->load("boxes"); $facstatic=new Facture($db); - $sql = "SELECT f.rowid, f.facnumber, f.fk_statut, f.type, f.total, f.total_ttc, f.paye, f.tms,"; - $sql.= " f.date_lim_reglement as datelimite,"; - $sql.= " s.nom as name, s.rowid as socid,"; - $sql.= " sum(pf.amount) as am"; + $sql = "SELECT f.rowid, f.facnumber, f.fk_statut, f.type, f.total as total_ht, f.tva as total_tva, f.total_ttc, f.paye, f.tms"; + $sql.= ", f.date_lim_reglement as datelimite"; + $sql.= ", s.nom as name"; + $sql.= ", s.rowid as socid"; + $sql.= ", s.code_client"; + $sql.= ", sum(pf.amount) as am"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf on f.rowid=pf.fk_facture"; if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; @@ -335,6 +353,9 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire) print ''; @@ -353,9 +374,11 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire) $thirdpartystatic->id=$obj->socid; $thirdpartystatic->name=$obj->name; $thirdpartystatic->client=1; + $thirdpartystatic->code_client = $obj->code_client; + $thirdpartystatic->code_fournisseur = $obj->code_fournisseur; print $thirdpartystatic->getNomUrl(1,'customer',44); print ''; - if (! empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) print ''; + if (! empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) print ''; print ''; print ''; print ''; @@ -391,8 +414,10 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture- $langs->load("boxes"); $facstatic=new FactureFournisseur($db); - $sql = "SELECT ff.rowid, ff.ref, ff.fk_statut, ff.libelle, ff.total_ht, ff.total_ttc, ff.tms, ff.paye"; - $sql.= ", s.nom as name, s.rowid as socid"; + $sql = "SELECT ff.rowid, ff.ref, ff.fk_statut, ff.libelle, ff.total_ht, ff.total_tva, ff.total_ttc, ff.tms, ff.paye"; + $sql.= ", s.nom as name"; + $sql.= ", s.rowid as socid"; + $sql.= ", s.code_fournisseur"; $sql.= ", SUM(pf.amount) as am"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture_fourn as ff"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiementfourn_facturefourn as pf on ff.rowid=pf.fk_facturefourn"; @@ -401,7 +426,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture- $sql.= " AND ff.entity = ".$conf->entity; if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; if ($socid) $sql.= " AND ff.fk_soc = ".$socid; - $sql.= " GROUP BY ff.rowid, ff.ref, ff.fk_statut, ff.libelle, ff.total_ht, ff.total_ttc, ff.tms, ff.paye, s.nom, s.rowid"; + $sql.= " GROUP BY ff.rowid, ff.ref, ff.fk_statut, ff.libelle, ff.total_ht, ff.tva, ff.total_ttc, ff.tms, ff.paye, s.nom, s.rowid"; $sql.= " ORDER BY ff.tms DESC "; $sql.= $db->plimit($max, 0); @@ -427,13 +452,18 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture- $obj = $db->fetch_object($resql); print ''; print ''; if (! empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) print ''; @@ -612,9 +642,11 @@ if (! empty($conf->facture->enabled) && ! empty($conf->commande->enabled) && $us $commandestatic=new Commande($db); $langs->load("orders"); - $sql = "SELECT sum(f.total) as tot_fht, sum(f.total_ttc) as tot_fttc,"; - $sql.= " s.nom as name, s.rowid as socid,"; - $sql.= " c.rowid, c.ref, c.facture, c.fk_statut, c.total_ht, c.total_ttc"; + $sql = "SELECT sum(f.total) as tot_fht, sum(f.total_ttc) as tot_fttc"; + $sql.= ", s.nom as name"; + $sql.= ", s.rowid as socid"; + $sql.= ", s.code_client"; + $sql.= ", c.rowid, c.ref, c.facture, c.fk_statut, c.total_ht, c.tva as total_tva, c.total_ttc"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= ", ".MAIN_DB_PREFIX."commande as c"; @@ -677,6 +709,8 @@ if (! empty($conf->facture->enabled) && ! empty($conf->commande->enabled) && $us $societestatic->id=$obj->socid; $societestatic->name=$obj->name; $societestatic->client=1; + $societestatic->code_client = $obj->code_client; + $societestatic->code_fournisseur = $obj->code_fournisseur; print $societestatic->getNomUrl(1,'customer',44); print ''; if (! empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) print ''; @@ -715,10 +749,12 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire) { $facstatic=new Facture($db); - $sql = "SELECT f.rowid, f.facnumber, f.fk_statut, f.datef, f.type, f.total, f.total_ttc, f.paye, f.tms,"; - $sql.= " f.date_lim_reglement as datelimite,"; - $sql.= " s.nom as name, s.rowid as socid,"; - $sql.= " sum(pf.amount) as am"; + $sql = "SELECT f.rowid, f.facnumber, f.fk_statut, f.datef, f.type, f.total as total_ht, f.tva as total_tva, f.total_ttc, f.paye, f.tms"; + $sql.= ", f.date_lim_reglement as datelimite"; + $sql.= ", s.nom as name"; + $sql.= ", s.rowid as socid"; + $sql.= ", s.code_client"; + $sql.= ", sum(pf.amount) as am"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf on f.rowid=pf.fk_facture"; if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; @@ -758,6 +794,9 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire) print ''; @@ -776,9 +815,11 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire) $societestatic->id=$obj->socid; $societestatic->name=$obj->name; $societestatic->client=1; + $societestatic->code_client = $obj->code_client; + $societestatic->code_fournisseur = $obj->code_fournisseur; print $societestatic->getNomUrl(1,'customer',44); print ''; - if (! empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) print ''; + if (! empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) print ''; print ''; print ''; print ''; @@ -820,9 +861,12 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture- { $facstatic=new FactureFournisseur($db); - $sql = "SELECT ff.rowid, ff.ref, ff.fk_statut, ff.libelle, ff.total_ht, ff.total_ttc, ff.paye,"; - $sql.= " s.nom as name, s.rowid as socid,"; - $sql.= " sum(pf.amount) as am"; + $sql = "SELECT ff.rowid, ff.ref, ff.fk_statut, ff.libelle, ff.total_ht, ff.total_tva, ff.total_ttc, ff.paye"; + $sql.= ", s.nom as name"; + $sql.= ", s.rowid as socid"; + $sql.= ", s.code_client"; + $sql.= ", s.code_fournisseur"; + $sql.= ", sum(pf.amount) as am"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture_fourn as ff"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiementfourn_facturefourn as pf on ff.rowid=pf.fk_facturefourn"; if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; @@ -832,7 +876,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture- $sql.= " AND ff.fk_statut = 1"; if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; if ($socid) $sql.= " AND ff.fk_soc = ".$socid; - $sql.= " GROUP BY ff.rowid, ff.ref, ff.fk_statut, ff.libelle, ff.total_ht, ff.total_ttc, ff.paye,"; + $sql.= " GROUP BY ff.rowid, ff.ref, ff.fk_statut, ff.libelle, ff.total_ht, ff.tva, ff.total_ttc, ff.paye,"; $sql.= " s.nom, s.rowid"; $resql=$db->query($sql); @@ -859,12 +903,17 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture- print ''; $societestatic->id=$obj->socid; $societestatic->name=$obj->name; $societestatic->client=0; + $societestatic->code_client = $obj->code_client; + $societestatic->code_fournisseur = $obj->code_fournisseur; print ''; if (! empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) print ''; print ''; diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index f3cbeccd586..baa46bc0356 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -887,7 +887,8 @@ class Contact extends CommonObject global $langs; $result=''; - $label = $langs->trans("ShowContact").': '.$this->getFullName($langs); + $label = '' . $langs->trans("ShowContact") . ''; + $label.= '
' . $langs->trans("Name") . ': '.$this->getFullName($langs); $lien = ''; $lienfin=''; diff --git a/htdocs/core/boxes/box_actions.php b/htdocs/core/boxes/box_actions.php index 06d70d65db0..8ccf34b0f6b 100644 --- a/htdocs/core/boxes/box_actions.php +++ b/htdocs/core/boxes/box_actions.php @@ -3,6 +3,7 @@ * Copyright (C) 2004-2011 Laurent Destailleur * Copyright (C) 2005-2011 Regis Houssin * Copyright (C) 2014 Charles-Fr BENKE + * Copyright (C) 2015 Frederic France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -55,15 +56,20 @@ class box_actions extends ModeleBoxes $this->max=$max; - include_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; - $actionstatic=new ActionComm($db); + include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; + include_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; + $societestatic = new Societe($db); + $actionstatic = new ActionComm($db); $this->info_box_head = array('text' => $langs->trans("BoxTitleLastActionsToDo",$max)); if ($user->rights->agenda->myactions->read) { - $sql = "SELECT a.id, a.label, a.datep as dp, a.percent as percentage,"; - $sql.= " ta.code, ta.libelle as type_label,"; - $sql.= " s.nom as name, s.rowid as socid"; + $sql = "SELECT a.id, a.label, a.datep as dp, a.percent as percentage"; + $sql.= ", ta.code"; + $sql.= ", ta.libelle as type_label"; + $sql.= ", s.nom as name"; + $sql.= ", s.rowid as socid"; + $sql.= ", s.code_client"; $sql.= " FROM (".MAIN_DB_PREFIX."c_actioncomm AS ta, "; $sql.= MAIN_DB_PREFIX."actioncomm AS a)"; if (! $user->rights->societe->client->voir && ! $user->societe_id) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc"; @@ -81,62 +87,52 @@ class box_actions extends ModeleBoxes $result = $db->query($sql); if ($result) { $now=dol_now(); - $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); $i = 0; while ($i < $num) { $late = ''; $objp = $db->fetch_object($result); - $datelimite=$db->jdate($objp->dp); + $datelimite = $db->jdate($objp->dp); + $actionstatic->label = $objp->label; + $actionstatic->type_label = $objp->type_label; + $actionstatic->code = $objp->code; + $societestatic->id = $objp->socid; + $societestatic->name = $objp->name; + $societestatic->code_client = $objp->code_client; - if ($objp->percentage >= 0 && $objp->percentage < 100 && $datelimite < ($now - $delay_warning)) $late=img_warning($langs->trans("Late")); + if ($objp->percentage >= 0 && $objp->percentage < 100 && $datelimite < ($now - $delay_warning)) + $late=img_warning($langs->trans("Late")); //($langs->transnoentities("Action".$objp->code)!=("Action".$objp->code) ? $langs->transnoentities("Action".$objp->code) : $objp->label) - $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; - $this->info_box_contents[$i][0] = array( - 'td' => 'align="left" width="16"', - 'logo' => ("action"), - 'tooltip' => $tooltip, - 'url' => DOL_URL_ROOT."/comm/action/card.php?id=".$objp->id, - ); - - $this->info_box_contents[$i][1] = array( + $this->info_box_contents[$i][] = array( 'td' => 'align="left"', - 'text' => dol_trunc($label,32), + 'text' => $actionstatic->getNomUrl(1), 'text2'=> $late, - 'tooltip' => $tooltip, - 'url' => DOL_URL_ROOT."/comm/action/card.php?id=".$objp->id, + 'asis' => 1, ); - $tooltip = $langs->trans('Customer').': '.$objp->name; - $this->info_box_contents[$i][2] = array( - 'td' => 'align="left" width="16"', - 'logo' => ($objp->socid?'company':''), - 'tooltip' => $tooltip, - 'url' => ($objp->socid?DOL_URL_ROOT."/societe/soc.php?socid=".$objp->socid:''), - ); - - $this->info_box_contents[$i][3] = array( + $this->info_box_contents[$i][] = array( 'td' => 'align="left"', - 'text' => dol_trunc($objp->name,24), - 'tooltip' => $tooltip, - 'url' => DOL_URL_ROOT."/societe/soc.php?socid=".$objp->socid, + 'text' => $societestatic->getNomUrl(1), + 'asis' => 1, ); - $this->info_box_contents[$i][4] = array( + $this->info_box_contents[$i][] = array( 'td' => 'align="left" class="nowrap"', 'text' => dol_print_date($datelimite, "dayhour"), ); - $this->info_box_contents[$i][5] = array( + $this->info_box_contents[$i][] = array( 'td' => 'align="right"', 'text' => ($objp->percentage>= 0?$objp->percentage.'%':''), ); - $this->info_box_contents[$i][6] = array( + $this->info_box_contents[$i][] = array( 'td' => 'align="right" width="18"', 'text' => $actionstatic->LibStatut($objp->percentage,3), ); diff --git a/htdocs/core/boxes/box_activity.php b/htdocs/core/boxes/box_activity.php index dcc2b99c887..882ac65ef11 100644 --- a/htdocs/core/boxes/box_activity.php +++ b/htdocs/core/boxes/box_activity.php @@ -1,7 +1,7 @@ * Copyright (C) 2005-2013 Laurent Destailleur - * Copyright (C) 2014 Frederic France + * Copyright (C) 2014-2015 Frederic France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -75,7 +75,6 @@ class box_activity extends ModeleBoxes $totalnb = 0; $i = 0; $cachetime = 3600; - $cachedir = DOL_DATA_ROOT.'/cache/boxes'; $fileid = '-e'.$conf->entity.'-u'.$user->id.'-s'.$user->societe_id.'-r'.($user->rights->societe->client->voir?'1':'0').'.cache'; $now = dol_now(); $nbofyears=2; @@ -95,6 +94,7 @@ class box_activity extends ModeleBoxes include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; $facturestatic=new Facture($db); + $cachedir = DOL_DATA_ROOT.'/facture/temp'; $filename = '/boxactivity-invoice'.$fileid; $refresh = dol_cache_refresh($cachedir, $filename, $cachetime); @@ -177,6 +177,7 @@ class box_activity extends ModeleBoxes ); } + $cachedir = DOL_DATA_ROOT.'/facture/temp'; $filename = '/boxactivity-invoice2'.$fileid; $refresh = dol_cache_refresh($cachedir, $filename, $cachetime); @@ -262,6 +263,7 @@ class box_activity extends ModeleBoxes include_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; $commandestatic=new Commande($db); + $cachedir = DOL_DATA_ROOT.'/commande/temp'; $filename = '/boxactivity-order'.$fileid; $refresh = dol_cache_refresh($cachedir, $filename, $cachetime); $data = array(); @@ -344,6 +346,7 @@ class box_activity extends ModeleBoxes include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; $propalstatic=new Propal($db); + $cachedir = DOL_DATA_ROOT.'/propale/temp'; $filename = '/boxactivity-propal'.$fileid; $refresh = dol_cache_refresh($cachedir, $filename, $cachetime); $data = array(); @@ -383,7 +386,7 @@ class box_activity extends ModeleBoxes if (! empty($data)) { $j=0; while ($i < count($data)) { - $this->info_box_contents[$i][0] = array( + $this->info_box_contents[$i][] = 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), @@ -391,12 +394,12 @@ class box_activity extends ModeleBoxes ); $objp = $db->fetch_object($result); - $this->info_box_contents[$i][1] = array( + $this->info_box_contents[$i][] = array( 'td' => 'align="left"', 'text' => $langs->trans("Proposals")." ".$propalstatic->LibStatut($data[$j]->fk_statut,0), ); - $this->info_box_contents[$i][2] = array( + $this->info_box_contents[$i][] = array( 'td' => 'align="right"', 'text' => $data[$j]->nb, 'tooltip' => $langs->trans("Proposals")." ".$propalstatic->LibStatut($data[$j]->fk_statut,0), @@ -404,12 +407,12 @@ class box_activity extends ModeleBoxes ); $totalnb += $data[$j]->nb; - $this->info_box_contents[$i][3] = array( + $this->info_box_contents[$i][] = 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[$i][] = array( 'td' => 'align="right" width="18"', 'text' => $propalstatic->LibStatut($data[$j]->fk_statut,3), ); diff --git a/htdocs/core/boxes/box_bookmarks.php b/htdocs/core/boxes/box_bookmarks.php index 5250108f76c..cc65536ce3f 100644 --- a/htdocs/core/boxes/box_bookmarks.php +++ b/htdocs/core/boxes/box_bookmarks.php @@ -1,5 +1,6 @@ + * Copyright (C) 2015 Frederic France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/htdocs/core/boxes/box_clients.php b/htdocs/core/boxes/box_clients.php index 01e0dc92635..bd331faadae 100644 --- a/htdocs/core/boxes/box_clients.php +++ b/htdocs/core/boxes/box_clients.php @@ -2,6 +2,7 @@ /* Copyright (C) 2003-2007 Rodolphe Quiedeville * Copyright (C) 2004-2010 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin + * Copyright (C) 2015 Frederic France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -79,7 +80,13 @@ class box_clients extends ModeleBoxes if ($user->rights->societe->lire) { - $sql = "SELECT s.nom as name, s.rowid as socid, s.datec, s.tms, s.status"; + $sql = "SELECT s.nom as name, s.rowid as socid"; + $sql.= ", s.code_client"; + $sql.= ", s.client"; + $sql.= ", s.code_fournisseur"; + $sql.= ", s.fournisseur"; + $sql.= ", s.logo"; + $sql.= ", s.datec, s.tms, s.status"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE s.client IN (1, 3)"; @@ -103,26 +110,26 @@ class box_clients extends ModeleBoxes $objp = $db->fetch_object($result); $datec=$db->jdate($objp->datec); $datem=$db->jdate($objp->tms); + $thirdpartystatic->id = $objp->socid; + $thirdpartystatic->name = $objp->name; + $thirdpartystatic->code_client = $objp->code_client; + $thirdpartystatic->code_fournisseur = $objp->code_fournisseur; + $thirdpartystatic->client = $objp->client; + $thirdpartystatic->fournisseur = $objp->fournisseur; + $thirdpartystatic->logo = $objp->logo; - $this->info_box_contents[$i][0] = array( - 'td' => 'align="left" width="16"', - 'logo' => $this->boximg, - 'tooltip' => $langs->trans('Customer').': '.$objp->name, - 'url' => $url.$objp->socid - ); - $this->info_box_contents[$i][1] = array( + $this->info_box_contents[$i][] = array( 'td' => 'align="left"', - 'text' => $objp->name, - 'tooltip' => $langs->trans('Customer').': '.$objp->name, - 'url' => $url.$objp->socid + 'text' => $thirdpartystatic->getNomUrl(1), + 'asis' => 1, ); - $this->info_box_contents[$i][2] = array( + $this->info_box_contents[$i][] = array( 'td' => 'align="right"', 'text' => dol_print_date($datem, "day") ); - $this->info_box_contents[$i][3] = array( + $this->info_box_contents[$i][] = array( 'td' => 'align="right" width="18"', 'text' => $thirdpartystatic->LibStatut($objp->status,3) ); diff --git a/htdocs/core/boxes/box_commandes.php b/htdocs/core/boxes/box_commandes.php index 670a5358d20..796cdc53f15 100644 --- a/htdocs/core/boxes/box_commandes.php +++ b/htdocs/core/boxes/box_commandes.php @@ -2,6 +2,7 @@ /* Copyright (C) 2003-2007 Rodolphe Quiedeville * Copyright (C) 2004-2009 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin + * Copyright (C) 2015 Frederic France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -53,20 +54,33 @@ class box_commandes extends ModeleBoxes { global $user, $langs, $db, $conf; - $this->max=$max; + $this->max = $max; - include_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; - $commandestatic=new Commande($db); + include_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; + include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; + $commandestatic = new Commande($db); + $societestatic = new Societe($db); $userstatic = new User($db); $this->info_box_head = array('text' => $langs->trans("BoxTitleLast".($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE?"":"Modified")."CustomerOrders",$max)); if ($user->rights->commande->lire) { - $sql = "SELECT s.nom as name, s.rowid as socid,"; - $sql.= " c.ref, c.tms, c.rowid, c.date_commande,"; - $sql.= " c.fk_statut, c.fk_user_valid, c.facture, c.total_ht"; + $sql = "SELECT s.nom as name"; + $sql.= ", s.rowid as socid"; + $sql.= ", s.code_client"; + $sql.= ", s.logo"; + $sql.= ", c.ref, c.tms"; + $sql.= ", c.rowid"; + $sql.= ", c.date_commande"; + $sql.= ", c.ref_client"; + $sql.= ", c.fk_statut"; + $sql.= ", c.fk_user_valid"; + $sql.= ", c.facture"; + $sql.= ", c.total_ht"; + $sql.= ", c.tva as total_tva"; + $sql.= ", c.total_ttc"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql.= ", ".MAIN_DB_PREFIX."commande as c"; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; @@ -89,32 +103,27 @@ class box_commandes extends ModeleBoxes $objp = $db->fetch_object($result); $date=$db->jdate($objp->date_commande); $datem=$db->jdate($objp->tms); + $commandestatic->id = $objp->rowid; + $commandestatic->ref = $objp->ref; + $commandestatic->ref_client = $objp->ref_client; + $commandestatic->total_ht = $objp->total_ht; + $commandestatic->total_tva = $objp->total_tva; + $commandestatic->total_ttc = $objp->total_ttc; + $societestatic->id = $objp->socid; + $societestatic->name = $objp->name; + $societestatic->code_client = $objp->code_client; + $societestatic->logo = $objp->logo; $this->info_box_contents[$i][] = array( - 'td' => 'align="left" width="16"', - 'logo' => $this->boximg, - 'tooltip' => $langs->trans('Order').': '.$objp->ref, - 'url' => DOL_URL_ROOT."/commande/card.php?id=".$objp->rowid, + 'td' => 'align="left"', + 'text' => $commandestatic->getNomUrl(1), + 'asis' => 1, ); $this->info_box_contents[$i][] = array( 'td' => 'align="left"', - 'text' => $objp->ref, - 'tooltip' => $langs->trans('Order').': '.$objp->ref, - 'url' => DOL_URL_ROOT."/commande/card.php?id=".$objp->rowid, - ); - $this->info_box_contents[$i][] = 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][] = array( - 'td' => 'align="left"', - 'text' => $objp->name, - 'tooltip' => $langs->trans('Customer').': '.$objp->name, - 'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid, + 'text' => $societestatic->getNomUrl(1), + 'asis' => 1, ); $this->info_box_contents[$i][] = array( @@ -127,7 +136,7 @@ class box_commandes extends ModeleBoxes $this->info_box_contents[$i][] = array( 'td' => 'align="right"', 'text' => (($objp->fk_user_valid > 0)?$userstatic->getNomUrl(1):''), - 'url' => (($objp->fk_user_valid > 0)?DOL_URL_ROOT.'/user/card.php?id='.$objp->fk_user_valid:''), + 'asis' => 1, ); } diff --git a/htdocs/core/boxes/box_comptes.php b/htdocs/core/boxes/box_comptes.php index da585f7ea71..752ddfafe1f 100644 --- a/htdocs/core/boxes/box_comptes.php +++ b/htdocs/core/boxes/box_comptes.php @@ -3,6 +3,7 @@ * Copyright (C) 2005-2013 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2013 Juanjo Menent + * Copyright (C) 2015 Frederic France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -102,31 +103,24 @@ class box_comptes extends ModeleBoxes $objp = $db->fetch_object($result); $account_static->id = $objp->rowid; + $account_static->label = $objp->label; + $account_static->number = $objp->number; $solde=$account_static->solde(0); $solde_total[$objp->currency_code] += $solde; - $tooltip = $langs->trans('Account').': '.$objp->label . '
' . $langs->trans('AccountNumber').': '.$objp->number; - $this->info_box_contents[$i][0] = array( - 'td' => 'align="left" width="16"', - 'logo' => $this->boximg, - 'tooltip' => $tooltip, - 'url' => DOL_URL_ROOT."/compta/bank/account.php?account=".$objp->rowid, - ); - - $this->info_box_contents[$i][1] = array( + $this->info_box_contents[$i][] = array( 'td' => 'align="left"', - 'text' => $objp->label, - 'tooltip' => $tooltip, - 'url' => DOL_URL_ROOT."/compta/bank/account.php?account=".$objp->rowid, + 'text' => $account_static->getNomUrl(1), + 'asis' => 1, ); - $this->info_box_contents[$i][2] = array( + $this->info_box_contents[$i][] = array( 'td' => 'align="left"', 'text' => $objp->number, ); - $this->info_box_contents[$i][3] = array( + $this->info_box_contents[$i][] = array( 'td' => 'align="right"', 'text' => price($solde, 0, $langs, 0, -1, -1, $objp->currency_code) ); @@ -136,21 +130,17 @@ class box_comptes extends ModeleBoxes // Total foreach ($solde_total as $key=>$solde) { - $this->info_box_contents[$i][0] = array( + $this->info_box_contents[$i][] = array( 'tr' => 'class="liste_total"', - 'td' => 'align="right" class="liste_total"', - 'text' => ' ', - ); - $this->info_box_contents[$i][1] = array( 'td' => 'align="left" class="liste_total"', 'text' => $langs->trans('Total').' '.$key, ); - $this->info_box_contents[$i][2] = array( + $this->info_box_contents[$i][] = array( 'td' => 'align="right" class="liste_total"', 'text' => ' ' ); - $this->info_box_contents[$i][3] = array( + $this->info_box_contents[$i][] = array( 'td' => 'align="right" class="liste_total"', 'text' => price($solde, 0, $langs, 0, -1, -1, $key) ); diff --git a/htdocs/core/boxes/box_contacts.php b/htdocs/core/boxes/box_contacts.php index 8ec8bf77b9c..a7abde7494b 100644 --- a/htdocs/core/boxes/box_contacts.php +++ b/htdocs/core/boxes/box_contacts.php @@ -2,6 +2,7 @@ /* Copyright (C) 2003-2007 Rodolphe Quiedeville * Copyright (C) 2004-2010 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin + * Copyright (C) 2015 Frederic France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -92,35 +93,19 @@ class box_contacts extends ModeleBoxes $societestatic->id=$objp->fk_soc; $societestatic->name=$objp->socname; - $this->info_box_contents[$i][0] = array( - 'td' => 'align="left" width="16"', - 'logo' => $this->boximg, - 'tooltip' => $langs->trans('Contact').': '.$contactstatic->getFullName($langs,0), - 'url' => DOL_URL_ROOT."/contact/card.php?id=".$objp->rowid, - ); - - $this->info_box_contents[$i][1] = array( + $this->info_box_contents[$i][] = array( 'td' => 'align="left"', - 'text' => $contactstatic->getFullName($langs,0), - 'tooltip' => $langs->trans('Contact').': '.$contactstatic->getFullName($langs,0), - 'url' => DOL_URL_ROOT."/contact/card.php?id=".$objp->rowid, + 'text' => $contactstatic->getNomUrl(1), + 'asis' => 1, ); - $this->info_box_contents[$i][2] = array( - 'td' => 'align="left" width="16"', - 'logo' => ($objp->fk_soc > 0?'company':''), - 'tooltip' => $societestatic->name, - 'url' => ($objp->fk_soc > 0?DOL_URL_ROOT."/societe/soc.php?socid=".$objp->fk_soc:''), - ); - - $this->info_box_contents[$i][3] = array( + $this->info_box_contents[$i][] = array( 'td' => 'align="left"', - 'text' => $societestatic->name, - 'tooltip' => $societestatic->name, - 'url' => DOL_URL_ROOT."/societe/soc.php?socid=".$objp->fk_soc, + 'text' => $societestatic->getNomUrl(1), + 'asis' => 1, ); - $this->info_box_contents[$i][4] = array( + $this->info_box_contents[$i][] = array( 'td' => 'align="right"', 'text' => dol_print_date($datem, "day"), ); diff --git a/htdocs/core/boxes/box_contracts.php b/htdocs/core/boxes/box_contracts.php index c980be624da..c72916e9f51 100644 --- a/htdocs/core/boxes/box_contracts.php +++ b/htdocs/core/boxes/box_contracts.php @@ -1,5 +1,6 @@ + * Copyright (C) 2015 Frederic France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/htdocs/core/boxes/box_external_rss.php b/htdocs/core/boxes/box_external_rss.php index 689efc751c6..773f98fff70 100644 --- a/htdocs/core/boxes/box_external_rss.php +++ b/htdocs/core/boxes/box_external_rss.php @@ -3,6 +3,7 @@ * Copyright (C) 2003 Eric Seigne * Copyright (C) 2004-2008 Laurent Destailleur * Copyright (C) 2005-2011 Regis Houssin + * Copyright (C) 2015 Frederic France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/htdocs/core/boxes/box_factures.php b/htdocs/core/boxes/box_factures.php index 84f7e61b315..dd1059cf9d2 100644 --- a/htdocs/core/boxes/box_factures.php +++ b/htdocs/core/boxes/box_factures.php @@ -2,6 +2,7 @@ /* Copyright (C) 2003-2007 Rodolphe Quiedeville * Copyright (C) 2004-2009 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin + * Copyright (C) 2015 Frederic France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -53,8 +54,11 @@ class box_factures extends ModeleBoxes $this->max=$max; - include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; - $facturestatic=new Facture($db); + include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; + include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; + + $facturestatic=new Facture($db); + $societestatic = new Societe($db); $text = $langs->trans("BoxTitleLast".($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE?"":"Modified")."CustomerBills",$max); $this->info_box_head = array( @@ -62,11 +66,16 @@ class box_factures extends ModeleBoxes 'limit'=> dol_strlen($text) ); - if ($user->rights->facture->lire) - { - $sql = "SELECT f.rowid as facid, f.facnumber, f.type, f.total as total_ht, f.datef as df"; + if ($user->rights->facture->lire) { + $sql = "SELECT f.rowid as facid"; + $sql.= ", f.facnumber, f.type, f.total as total_ht"; + $sql.= ", f.tva as total_tva"; + $sql.= ", f.total_ttc"; + $sql.= ", f.datef as df"; $sql.= ", f.paye, f.fk_statut, f.datec, f.tms"; - $sql.= ", s.nom as name, s.rowid as socid"; + $sql.= ", s.nom as name"; + $sql.= ", s.rowid as socid"; + $sql.= ", s.code_client"; $sql.= ", f.date_lim_reglement as datelimite"; $sql.= " FROM (".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f"; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; @@ -88,60 +97,48 @@ class box_factures extends ModeleBoxes $i = 0; $l_due_date = $langs->trans('Late').' ('.strtolower($langs->trans('DateEcheance')).': %s)'; - while ($i < $num) - { - $objp = $db->fetch_object($result); - $datelimite=$db->jdate($objp->datelimite); - $date=$db->jdate($objp->df); - $datem=$db->jdate($objp->tms); + while ($i < $num) { + $objp = $db->fetch_object($result); + $datelimite = $db->jdate($objp->datelimite); + $date = $db->jdate($objp->df); + $datem = $db->jdate($objp->tms); + $facturestatic->id = $objp->facid; + $facturestatic->ref = $objp->facnumber; + $facturestatic->type = $objp->type; + $facturestatic->total_ht = $objp->total_ht; + $facturestatic->total_tva = $objp->total_tva; + $facturestatic->total_ttc = $objp->total_ttc; + $societestatic->id = $objp->socid; + $societestatic->name = $objp->name; + $societestatic->code_client = $objp->code_client; - $picto='bill'; - if ($objp->type == 1) $picto.='r'; - if ($objp->type == 2) $picto.='a'; $late = ''; if ($objp->paye == 0 && ($objp->fk_statut != 2 && $objp->fk_statut != 3) && $datelimite < ($now - $conf->facture->client->warning_delay)) { $late = img_warning(sprintf($l_due_date,dol_print_date($datelimite,'day')));} - $this->info_box_contents[$i][0] = array( - 'td' => 'align="left" width="16"', - 'logo' => $picto, - 'tooltip' => $langs->trans('CustomerInvoice').': '.$objp->facnumber, - 'url' => DOL_URL_ROOT."/compta/facture.php?facid=".$objp->facid, - ); - - $this->info_box_contents[$i][1] = array( + $this->info_box_contents[$i][] = array( 'td' => 'align="left"', - 'text' => $objp->facnumber, + 'text' => $facturestatic->getNomUrl(1), 'text2'=> $late, - 'tooltip' => $langs->trans('CustomerInvoice').': '.$objp->facnumber, - 'url' => DOL_URL_ROOT."/compta/facture.php?facid=".$objp->facid, + 'asis' => 1, ); - $this->info_box_contents[$i][2] = 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[$i][] = array( 'td' => 'align="left"', - 'text' => $objp->name, - 'maxlength'=>40, - 'tooltip' => $langs->trans('Customer').': '.$objp->name, - '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[$i][] = array( 'td' => 'align="right"', 'text' => price($objp->total_ht), ); - $this->info_box_contents[$i][5] = array( + $this->info_box_contents[$i][] = array( 'td' => 'align="right"', 'text' => dol_print_date($date,'day'), ); - $this->info_box_contents[$i][6] = array( + $this->info_box_contents[$i][] = array( 'td' => 'align="right" width="18"', 'text' => $facturestatic->LibStatut($objp->paye,$objp->fk_statut,3), ); @@ -173,11 +170,11 @@ class box_factures extends ModeleBoxes } /** - * Method to show box + * Method to show box * - * @param array $head Array with properties of box title - * @param array $contents Array with properties of box lines - * @return void + * @param array $head Array with properties of box title + * @param array $contents Array with properties of box lines + * @return void */ function showBox($head = null, $contents = null) { diff --git a/htdocs/core/boxes/box_factures_fourn.php b/htdocs/core/boxes/box_factures_fourn.php index 4e222369949..f48d2ab43d3 100644 --- a/htdocs/core/boxes/box_factures_fourn.php +++ b/htdocs/core/boxes/box_factures_fourn.php @@ -2,6 +2,7 @@ /* Copyright (C) 2003 Rodolphe Quiedeville * Copyright (C) 2004-2013 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin + * Copyright (C) 2015 Frederic France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -55,7 +56,10 @@ class box_factures_fourn extends ModeleBoxes $this->max=$max; include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; - $facturestatic=new FactureFournisseur($db); + include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; + + $facturestatic = new FactureFournisseur($db); + $societestatic = new Societe($db); $this->info_box_head = array( 'text' => $langs->trans("BoxTitleLast".($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE?"":"Modified")."SupplierBills",$max) @@ -64,7 +68,12 @@ class box_factures_fourn extends ModeleBoxes if ($user->rights->fournisseur->facture->lire) { $sql = "SELECT s.nom as name, s.rowid as socid,"; - $sql.= " f.rowid as facid, f.ref, f.ref_supplier, f.total_ht,"; + $sql.= " s.code_fournisseur,"; + $sql.= " s.logo,"; + $sql.= " f.rowid as facid, f.ref, f.ref_supplier,"; + $sql.= " f.total_ht,"; + $sql.= " f.total_tva,"; + $sql.= " f.total_ttc,"; $sql.= " f.paye, f.fk_statut,"; $sql.= ' f.datef as df,'; $sql.= ' f.datec as datec,'; @@ -94,47 +103,41 @@ class box_factures_fourn extends ModeleBoxes $datelimite=$db->jdate($objp->datelimite); $date=$db->jdate($objp->df); $datem=$db->jdate($objp->tms); + $facturestatic->id = $objp->facid; + $facturestatic->ref = $objp->ref; + $facturestatic->total_ht = $objp->total_ht; + $facturestatic->total_tva = $objp->total_tva; + $facturestatic->total_ttc = $objp->total_ttc; + $societestatic->id = $objp->socid; + $societestatic->name = $objp->name; + $societestatic->fournisseur = 1; + $societestatic->code_fournisseur = $objp->code_fournisseur; + $societestatic->logo = $objp->logo; $late = ''; if ($objp->paye == 0 && $datelimite && $datelimite < ($now - $conf->facture->fournisseur->warning_delay)) $late=img_warning(sprintf($l_due_date, dol_print_date($datelimite,'day'))); - $this->info_box_contents[$i][0] = array( - 'td' => 'align="left" width="16"', - 'logo' => $this->boximg, - 'tooltip' => $langs->trans('SupplierInvoice').': '.($objp->ref?$objp->ref:$objp->facid).'
'.$langs->trans('RefSupplier').': '.$objp->ref_supplier, - 'url' => DOL_URL_ROOT."/fourn/facture/card.php?facid=".$objp->facid, - ); - - $this->info_box_contents[$i][1] = array( + $this->info_box_contents[$i][] = array( 'td' => 'align="left"', - 'text' => ($objp->ref?$objp->ref:$objp->facid), + 'text' => $facturestatic->getNomUrl(1), 'text2'=> $late, - 'tooltip' => $langs->trans('SupplierInvoice').': '.($objp->ref?$objp->ref:$objp->facid).'
'.$langs->trans('RefSupplier').': '.$objp->ref_supplier, - 'url' => DOL_URL_ROOT."/fourn/facture/card.php?facid=".$objp->facid, + 'asis' => 1, ); - $this->info_box_contents[$i][2] = array( + $this->info_box_contents[$i][] = array( 'td' => 'align="left"', 'text' => $objp->ref_supplier, 'tooltip' => $langs->trans('SupplierInvoice').': '.($objp->ref?$objp->ref:$objp->facid).'
'.$langs->trans('RefSupplier').': '.$objp->ref_supplier, 'url' => DOL_URL_ROOT."/fourn/facture/card.php?facid=".$objp->facid, ); - $this->info_box_contents[$i][3] = array( - 'td' => 'align="left" width="16"', - 'logo' => 'company', - 'tooltip' => $langs->trans('Supplier').': '.$objp->name, - 'url' => DOL_URL_ROOT."/fourn/card.php?socid=".$objp->socid, - ); - - $this->info_box_contents[$i][4] = array( + $this->info_box_contents[$i][] = array( 'td' => 'align="left"', - 'text' => $objp->name, - 'tooltip' => $langs->trans('Supplier').': '.$objp->name, - 'url' => DOL_URL_ROOT."/fourn/card.php?socid=".$objp->socid, + 'text' => $societestatic->getNomUrl(1, 'supplier'), + 'asis' => 1, ); - $this->info_box_contents[$i][5] = array( + $this->info_box_contents[$i][] = array( 'td' => 'align="right"', 'text' => dol_print_date($date,'day'), ); diff --git a/htdocs/core/boxes/box_factures_fourn_imp.php b/htdocs/core/boxes/box_factures_fourn_imp.php index 37b42f70cfa..a82af75332a 100644 --- a/htdocs/core/boxes/box_factures_fourn_imp.php +++ b/htdocs/core/boxes/box_factures_fourn_imp.php @@ -1,6 +1,7 @@ * Copyright (C) 2005-2009 Regis Houssin + * Copyright (C) 2015 Frederic France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/htdocs/core/boxes/box_factures_imp.php b/htdocs/core/boxes/box_factures_imp.php index e6df1530f8d..d7817d134d3 100644 --- a/htdocs/core/boxes/box_factures_imp.php +++ b/htdocs/core/boxes/box_factures_imp.php @@ -2,6 +2,7 @@ /* Copyright (C) 2003-2007 Rodolphe Quiedeville * Copyright (C) 2004-2007 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin + * Copyright (C) 2015 Frederic France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -57,15 +58,24 @@ class box_factures_imp extends ModeleBoxes $this->max=$max; include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; - $facturestatic=new Facture($db); + include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; + + $facturestatic = new Facture($db); + $societestatic = new Societe($db); $this->info_box_head = array('text' => $langs->trans("BoxTitleOldestUnpaidCustomerBills",$max)); if ($user->rights->facture->lire) { $sql = "SELECT s.nom as name, s.rowid as socid,"; + $sql.= " s.code_client,"; + $sql.= " s.logo,"; $sql.= " f.facnumber, f.date_lim_reglement as datelimite,"; + $sql.= " f.type,"; $sql.= " f.amount, f.datef as df,"; + $sql.= " f.total as total_ht,"; + $sql.= " f.tva as total_tva,"; + $sql.= " f.total_ttc,"; $sql.= " f.paye, f.fk_statut, f.rowid as facid"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f"; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; @@ -92,34 +102,43 @@ class box_factures_imp extends ModeleBoxes { $objp = $db->fetch_object($result); $datelimite=$db->jdate($objp->datelimite); + $facturestatic->id = $objp->facid; + $facturestatic->ref = $objp->facnumber; + $facturestatic->type = $objp->type; + $facturestatic->total_ht = $objp->total_ht; + $facturestatic->total_tva = $objp->total_tva; + $facturestatic->total_ttc = $objp->total_ttc; + $societestatic->id = $objp->socid; + $societestatic->name = $objp->name; + $societestatic->client = 1; + $societestatic->code_client = $objp->code_client; + $societestatic->logo = $objp->logo; $late=''; if ($datelimite < ($now - $conf->facture->client->warning_delay)) $late = img_warning(sprintf($l_due_date,dol_print_date($datelimite,'day'))); - $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"', - 'logo' => $this->boximg, - 'url' => DOL_URL_ROOT."/compta/facture.php?facid=".$objp->facid); + $this->info_box_contents[$i][] = array( + 'td' => 'align="left"', + 'text' => $facturestatic->getNomUrl(1), + 'text2'=> $late, + 'asis' => 1, + ); - $this->info_box_contents[$i][1] = array('td' => 'align="left"', - 'text' => $objp->facnumber, - 'text2'=> $late, - 'url' => DOL_URL_ROOT."/compta/facture.php?facid=".$objp->facid); + $this->info_box_contents[$i][] = array( + 'td' => 'align="left"', + 'text' => $societestatic->getNomUrl(1, '', 44), + 'asis' => 1, + ); - $this->info_box_contents[$i][2] = array('td' => 'align="left" width="16"', - 'logo' => 'company', - 'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid); + $this->info_box_contents[$i][] = array( + 'td' => 'align="right"', + 'text' => dol_print_date($datelimite,'day'), + ); - $this->info_box_contents[$i][3] = array('td' => 'align="left"', - 'text' => $objp->name, - 'maxlength'=>44, - 'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid); - - $this->info_box_contents[$i][4] = array('td' => 'align="right"', - 'text' => dol_print_date($datelimite,'day'), - ); - - $this->info_box_contents[$i][5] = array('td' => 'align="right" width="18"', - 'text' => $facturestatic->LibStatut($objp->paye,$objp->fk_statut,3)); + $this->info_box_contents[$i][] = array( + 'td' => 'align="right" width="18"', + 'text' => $facturestatic->LibStatut($objp->paye,$objp->fk_statut,3), + ); $i++; } @@ -130,14 +149,18 @@ class box_factures_imp extends ModeleBoxes } else { - $this->info_box_contents[0][0] = array( 'td' => 'align="left"', - 'maxlength'=>500, - 'text' => ($db->error().' sql='.$sql)); + $this->info_box_contents[0][0] = array( + 'td' => 'align="left"', + 'maxlength'=>500, + 'text' => ($db->error().' sql='.$sql), + ); } } 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_ficheinter.php b/htdocs/core/boxes/box_ficheinter.php index 9cce737eb9a..decf5e564f0 100644 --- a/htdocs/core/boxes/box_ficheinter.php +++ b/htdocs/core/boxes/box_ficheinter.php @@ -1,20 +1,21 @@ * Copyright (C) 2013 Juanjo Menent + * Copyright (C) 2015 Frederic France * -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ /** * \file htdocs/core/boxes/box_ficheinter.php diff --git a/htdocs/core/boxes/box_fournisseurs.php b/htdocs/core/boxes/box_fournisseurs.php index 19850598505..e9c21da739f 100644 --- a/htdocs/core/boxes/box_fournisseurs.php +++ b/htdocs/core/boxes/box_fournisseurs.php @@ -1,6 +1,7 @@ * Copyright (C) 2005-2009 Regis Houssin + * Copyright (C) 2015 Frederic France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/htdocs/core/boxes/box_members.php b/htdocs/core/boxes/box_members.php index 1e87995203a..46de6175354 100644 --- a/htdocs/core/boxes/box_members.php +++ b/htdocs/core/boxes/box_members.php @@ -2,6 +2,7 @@ /* Copyright (C) 2003-2007 Rodolphe Quiedeville * Copyright (C) 2004-2013 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2015 Frederic France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/htdocs/core/boxes/box_produits.php b/htdocs/core/boxes/box_produits.php index ac1d3d9ec19..3c379687291 100644 --- a/htdocs/core/boxes/box_produits.php +++ b/htdocs/core/boxes/box_produits.php @@ -2,6 +2,7 @@ /* Copyright (C) 2003 Rodolphe Quiedeville * Copyright (C) 2004-2011 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2015 Frederic France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/htdocs/core/boxes/box_produits_alerte_stock.php b/htdocs/core/boxes/box_produits_alerte_stock.php index 5a1b898fc1f..843207f883a 100644 --- a/htdocs/core/boxes/box_produits_alerte_stock.php +++ b/htdocs/core/boxes/box_produits_alerte_stock.php @@ -3,6 +3,7 @@ * Copyright (C) 2004-2011 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2005-2012 Maxime Kohlhaas + * Copyright (C) 2015 Frederic France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/htdocs/core/boxes/box_project.php b/htdocs/core/boxes/box_project.php index b765c99c836..703d35b408b 100644 --- a/htdocs/core/boxes/box_project.php +++ b/htdocs/core/boxes/box_project.php @@ -1,6 +1,8 @@ * Copyright (C) 2014 Marcos García + * Copyright (C) 2015 Frederic France + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or diff --git a/htdocs/core/boxes/box_propales.php b/htdocs/core/boxes/box_propales.php index 07bf074665f..7bec6849ac7 100644 --- a/htdocs/core/boxes/box_propales.php +++ b/htdocs/core/boxes/box_propales.php @@ -2,6 +2,7 @@ /* Copyright (C) 2003-2007 Rodolphe Quiedeville * Copyright (C) 2004-2007 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin + * Copyright (C) 2015 Frederic France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/htdocs/core/boxes/box_prospect.php b/htdocs/core/boxes/box_prospect.php index 73d5cf0f70e..ef9585202b0 100644 --- a/htdocs/core/boxes/box_prospect.php +++ b/htdocs/core/boxes/box_prospect.php @@ -2,6 +2,7 @@ /* Copyright (C) 2003-2007 Rodolphe Quiedeville * Copyright (C) 2004-2011 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin + * Copyright (C) 2015 Frederic France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/htdocs/core/boxes/box_supplier_orders.php b/htdocs/core/boxes/box_supplier_orders.php index 7fb66608840..d435e5ca3dc 100644 --- a/htdocs/core/boxes/box_supplier_orders.php +++ b/htdocs/core/boxes/box_supplier_orders.php @@ -3,6 +3,7 @@ /* Copyright (C) 2004-2006 Destailleur Laurent * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2012 Raphaël Doursenaud + * Copyright (C) 2015 Frederic France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/htdocs/core/boxes/box_task.php b/htdocs/core/boxes/box_task.php index d20ee2017d6..eb9c26b416a 100644 --- a/htdocs/core/boxes/box_task.php +++ b/htdocs/core/boxes/box_task.php @@ -1,5 +1,6 @@ + * Copyright (C) 2015 Frederic France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -99,13 +100,13 @@ class box_task extends ModeleBoxes $objp = $db->fetch_object($result); $this->info_box_contents[$i][1] = array( 'td' => 'align="left"', - 'text' =>$langs->trans("Task")." ".$taskstatic->LibStatut($objp->fk_statut,0) + 'text' =>$langs->trans("Task")." ".$taskstatic->LibStatut($objp->fk_statut,0), ); $this->info_box_contents[$i][2] = array( 'td' => 'align="right"', 'text' => $objp->nb." ".$langs->trans("Tasks"), - 'url' => DOL_URL_ROOT."/projet/tasks/index.php?leftmenu=projects&viewstatut=".$objp->fk_statut + 'url' => DOL_URL_ROOT."/projet/tasks/index.php?leftmenu=projects&viewstatut=".$objp->fk_statut, ); $totalnb += $objp->nb; $this->info_box_contents[$i][3] = array('td' => 'align="right"', 'text' => ConvertSecondToTime($objp->plannedtot,'all',25200,5)); diff --git a/htdocs/core/boxes/modules_boxes.php b/htdocs/core/boxes/modules_boxes.php index faaaaff2ec6..dfe83012acf 100644 --- a/htdocs/core/boxes/modules_boxes.php +++ b/htdocs/core/boxes/modules_boxes.php @@ -2,6 +2,7 @@ /* Copyright (C) 2004-2013 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2014 Raphaël Doursenaud + * Copyright (C) 2015 Frederic France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -183,13 +184,13 @@ class ModeleBoxes // Can't be abtract as it is instantiated to build "empty" require_once DOL_DOCUMENT_ROOT .'/core/lib/files.lib.php'; $MAXLENGTHBOX=60; // Mettre 0 pour pas de limite - $bcx=array(); + $bcx = array(); $bcx[0] = 'class="box_pair"'; $bcx[1] = 'class="box_impair"'; $var = false; $cachetime = 900; // 900 : 15mn - $cachedir = DOL_DATA_ROOT.'/cache/boxes'; + $cachedir = DOL_DATA_ROOT.'/boxes/temp'; $fileid = get_class($this).'id-'.$this->box_id.'-e'.$conf->entity.'-u'.$user->id.'-s'.$user->societe_id.'.cache'; $filename = '/box-'.$fileid; $refresh = dol_cache_refresh($cachedir, $filename, $cachetime); diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index dc39692f08e..f3deab3eb04 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -2691,6 +2691,8 @@ abstract class CommonObject $product_static->type=$line->fk_product_type; $product_static->id=$line->fk_product; $product_static->ref=$line->ref; + if (! empty($line->entity)) + $product_static->entity=$line->entity; $text=$product_static->getNomUrl(1); // Define output language and label diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index e78ea2ae7cd..9d3a236fb11 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -2,11 +2,12 @@ /* Copyright (C) 2006-2011 Laurent Destailleur * Copyright (C) 2006 Rodolphe Quiedeville * Copyright (C) 2007 Patrick Raguin - * Copyright (C) 2010-2012 Regis Houssin + * Copyright (C) 2010-2012 Regis Houssin * Copyright (C) 2013-2014 Florian Henry * Copyright (C) 2013-2014 Juanjo Menent * Copyright (C) 2013 Christophe Battarel - * Copyright (C) 2013 Alexandre Spangaro + * Copyright (C) 2013 Alexandre Spangaro + * Copyright (C) 2015 Frederic France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -988,9 +989,11 @@ function show_actions_todo($conf,$langs,$db,$object,$objcon='',$noprint=0) } $out.='
'; // Statut @@ -1235,22 +1238,36 @@ function show_actions_done($conf,$langs,$db,$object,$objcon='',$noprint=0) { if ($histo[$key]['elementtype'] == 'propal' && ! empty($conf->propal->enabled)) { - $propalstatic->ref=$langs->trans("ProposalShort"); - $propalstatic->id=$histo[$key]['fk_element']; - $out.=$propalstatic->getNomUrl(1); - } + //$propalstatic->ref=$langs->trans("ProposalShort"); + //$propalstatic->id=$histo[$key]['fk_element']; + if ($propalstatic->fetch($histo[$key]['fk_element'])>0) { + $propalstatic->type=$histo[$key]['ftype']; + $out.=$propalstatic->getNomUrl(1); + } else { + $out.= $langs->trans("ProposalDeleted"); + } + } elseif (($histo[$key]['elementtype'] == 'order' || $histo[$key]['elementtype'] == 'commande') && ! empty($conf->commande->enabled)) { - $orderstatic->ref=$langs->trans("Order"); - $orderstatic->id=$histo[$key]['fk_element']; - $out.=$orderstatic->getNomUrl(1); - } + //$orderstatic->ref=$langs->trans("Order"); + //$orderstatic->id=$histo[$key]['fk_element']; + if ($orderstatic->fetch($histo[$key]['fk_element'])>0) { + $orderstatic->type=$histo[$key]['ftype']; + $out.=$orderstatic->getNomUrl(1); + } else { + $out.= $langs->trans("OrderDeleted"); + } + } elseif (($histo[$key]['elementtype'] == 'invoice' || $histo[$key]['elementtype'] == 'facture') && ! empty($conf->facture->enabled)) { - $facturestatic->ref=$langs->trans("Invoice"); - $facturestatic->id=$histo[$key]['fk_element']; - $facturestatic->type=$histo[$key]['ftype']; - $out.=$facturestatic->getNomUrl(1,'compta'); + //$facturestatic->ref=$langs->trans("Invoice"); + //$facturestatic->id=$histo[$key]['fk_element']; + if ($facturestatic->fetch($histo[$key]['fk_element'])>0) { + $facturestatic->type=$histo[$key]['ftype']; + $out.=$facturestatic->getNomUrl(1,'compta'); + } else { + $out.= $langs->trans("InvoiceDeleted"); + } } else $out.=' '; } @@ -1272,9 +1289,11 @@ function show_actions_done($conf,$langs,$db,$object,$objcon='',$noprint=0) // Auteur $out.=''; // Statut diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 00105cf967a..4dc14ea37b5 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -1217,7 +1217,9 @@ class Expedition extends CommonObject global $langs; $result=''; - $label=$langs->trans("ShowSending").': '.$this->ref; + $label = '' . $langs->trans("ShowSending") . ''; + if (! empty($this->ref)) + $label .= '
' . $langs->trans('Ref') . ': '.$this->ref; $url = DOL_URL_ROOT.'/expedition/card.php?id='.$this->id; diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php index 2468c9084d2..d9e26368a74 100644 --- a/htdocs/expedition/list.php +++ b/htdocs/expedition/list.php @@ -69,7 +69,7 @@ $shipment=new Expedition($db); $helpurl='EN:Module_Shipments|FR:Module_Expéditions|ES:Módulo_Expediciones'; llxHeader('',$langs->trans('ListOfSendings'),$helpurl); -$sql = "SELECT e.rowid, e.ref, e.date_delivery as date_expedition, l.date_delivery as date_livraison, e.fk_statut"; +$sql = "SELECT e.rowid, e.ref, e.date_expedition as date_expedition, e.date_delivery as date_livraison, l.date_delivery as date_reception, e.fk_statut"; $sql.= ", s.nom as socname, s.rowid as socid"; $sql.= " FROM (".MAIN_DB_PREFIX."expedition as e"; if (!$user->rights->societe->client->voir && !$socid) // Internal user with no permission to see all @@ -120,8 +120,10 @@ if ($resql) print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"],"e.ref","",$param,'',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Company"), $_SERVER["PHP_SELF"],"s.nom", "", $param,'align="left"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("DateDeliveryPlanned"), $_SERVER["PHP_SELF"],"e.date_delivery","",$param, 'align="center"',$sortfield,$sortorder); - if($conf->livraison_bon->enabled) { + if($conf->expedition_bon->enabled) { print_liste_field_titre($langs->trans("DeliveryOrder"), $_SERVER["PHP_SELF"],"e.date_expedition","",$param, '',$sortfield,$sortorder); + } + if($conf->livraison_bon->enabled) { print_liste_field_titre($langs->trans("DateReceived"), $_SERVER["PHP_SELF"],"e.date_expedition","",$param, 'align="center"',$sortfield,$sortorder); } print_liste_field_titre($langs->trans("Status"), $_SERVER["PHP_SELF"],"e.fk_statut","",$param,'align="right"',$sortfield,$sortorder); @@ -137,10 +139,12 @@ if ($resql) print ''; print ''; print ''; - if($conf->livraison_bon->enabled) { + if($conf->expedition_bon->enabled) { print ''; } print '\n"; - if($conf->livraison_bon->enabled) { + if($conf->expedition_bon->enabled) { // Date real - print "\n"; + print ''."\n"; + } + if($conf->livraison_bon->enabled) { + print ''."\n"; } print ''; diff --git a/htdocs/expedition/shipment.php b/htdocs/expedition/shipment.php index bce365447e1..a4e4e57fe94 100644 --- a/htdocs/expedition/shipment.php +++ b/htdocs/expedition/shipment.php @@ -380,7 +380,7 @@ if ($id > 0 || ! empty($ref)) $sql.= " cd.qty,"; $sql.= ' cd.date_start,'; $sql.= ' cd.date_end,'; - $sql.= ' p.label as product_label, p.ref, p.fk_product_type, p.rowid as prodid,'; + $sql.= ' p.label as product_label, p.entity, p.ref, p.fk_product_type, p.rowid as prodid,'; $sql.= ' p.description as product_desc, p.fk_product_type as product_type'; $sql.= " FROM ".MAIN_DB_PREFIX."commandedet as cd"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON cd.fk_product = p.rowid"; @@ -436,7 +436,8 @@ if ($id > 0 || ! empty($ref)) $commande->fetch_thirdparty(); $prod = new Product($db); - $prod->id=$objp->fk_product; + $prod->id = $objp->fk_product; + $prod->entity = $objp->entity; $prod->getMultiLangs(); $outputlangs = $langs; @@ -461,9 +462,11 @@ if ($id > 0 || ! empty($ref)) $product_static->type=$objp->fk_product_type; $product_static->id=$objp->fk_product; $product_static->ref=$objp->ref; + $product_static->entity = $objp->entity; $text=$product_static->getNomUrl(1); $text.= ' - '.$label; - $description=($conf->global->PRODUIT_DESC_IN_FORM?'':dol_htmlentitiesbr($objp->description)); + $description=($conf->global->PRODUIT_DESC_IN_FORM?'':dol_htmlentitiesbr($objp->description)).'
'; + $description.= $product_static->show_photos($conf->product->multidir_output[$product_static->entity],1,1,0,0,0,80); print $form->textwithtooltip($text,$description,3,'','',$i); // Show range diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index 58c0efdda9a..10a50947bba 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -547,7 +547,9 @@ class Fichinter extends CommonObject global $langs; $result=''; - $label=$langs->trans("Show").': '.$this->ref; + $label = '' . $langs->trans("ShowIntervention") . ''; + if (! empty($this->ref)) + $label .= '
' . $langs->trans('Ref') . ': '.$this->ref; $lien = ''; $lienfin=''; diff --git a/htdocs/fourn/card.php b/htdocs/fourn/card.php index 0fefa8d4555..af379d633e7 100644 --- a/htdocs/fourn/card.php +++ b/htdocs/fourn/card.php @@ -336,7 +336,7 @@ if ($object->id > 0) } // TODO move to DAO class - $sql = "SELECT p.rowid,p.ref, p.date_commande as dc, p.fk_statut"; + $sql = "SELECT p.rowid,p.ref, p.date_commande as dc, p.fk_statut, p.total_ht, p.tva as total_tva, p.total_ttc"; $sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as p "; $sql.= " WHERE p.fk_soc =".$object->id; $sql.= " AND p.entity =".$conf->entity; @@ -368,8 +368,11 @@ if ($object->id > 0) print ""; print ''; print ''; } - // Author - $userstatic->id=$obj->fk_user_author; - $userstatic->login=$obj->login; + // Author + $userstatic->id = $obj->fk_user_author; + $userstatic->lastname = $obj->lastname; + $userstatic->firstname = $obj->firstname; + $userstatic->login = $obj->login; + $userstatic->photo = $obj->photo; print ""; diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index b6244802318..a5eecd998e3 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1401,6 +1401,7 @@ function top_menu($head, $title='', $target='', $disablejs=0, $disablehead=0, $a $form=new Form($db); // Define link to login card + /* $loginhtmltext=''; $logintext=''; if ($user->societe_id) { @@ -1421,9 +1422,9 @@ function top_menu($head, $title='', $target='', $disablejs=0, $disablehead=0, $a $loginhtmltext.='
'.$langs->trans("Administrator").': '.yn($user->admin); $type=($user->societe_id?$langs->trans("External").$company:$langs->trans("Internal")); $loginhtmltext.='
'.$langs->trans("Type").': '.$type; - $loginhtmltext.='
'.$langs->trans("IPAddress").': '.$_SERVER["REMOTE_ADDR"]; $loginhtmltext.='
'; $loginhtmltext.='
'.$langs->trans("Connection").''; + $loginhtmltext.='
'.$langs->trans("IPAddress").': '.$_SERVER["REMOTE_ADDR"]; if (! empty($conf->global->MAIN_MODULE_MULTICOMPANY)) $loginhtmltext.='
'.$langs->trans("ConnectedOnMultiCompany").': '.$conf->entity.' (user entity '.$user->entity.')'; $loginhtmltext.='
'.$langs->trans("AuthenticationMode").': '.$_SESSION["dol_authmode"].(empty($dolibarr_main_demo)?'':' (demo)'); $loginhtmltext.='
'.$langs->trans("ConnectedSince").': '.dol_print_date($user->datelastlogin,"dayhour"); @@ -1435,6 +1436,7 @@ function top_menu($head, $title='', $target='', $disablejs=0, $disablehead=0, $a $loginhtmltext.='
'.$langs->trans("Browser").': '.$conf->browser->name.($conf->browser->version?' '.$conf->browser->version:'').' ('.$_SERVER['HTTP_USER_AGENT'].')'; if (! empty($conf->browser->phone)) $loginhtmltext.='
'.$langs->trans("Phone").': '.$conf->browser->phone; if (! empty($_SESSION["disablemodules"])) $loginhtmltext.='
'.$langs->trans("DisabledModules").':
'.join(', ',explode(',',$_SESSION["disablemodules"])); + */ $appli='Dolibarr'; if (! empty($conf->global->MAIN_APPLICATION_TITLE)) @@ -1468,7 +1470,8 @@ function top_menu($head, $title='', $target='', $disablejs=0, $disablehead=0, $a $toprightmenu.=''; $toprightmenu.='\n"; print ''; diff --git a/htdocs/product/reassort.php b/htdocs/product/reassort.php index c8480d6e65a..ab184cdf943 100644 --- a/htdocs/product/reassort.php +++ b/htdocs/product/reassort.php @@ -306,6 +306,7 @@ if ($resql) print '"; print "'; diff --git a/htdocs/product/stock/mouvement.php b/htdocs/product/stock/mouvement.php index 1bac6b9fef5..f525457e1c5 100644 --- a/htdocs/product/stock/mouvement.php +++ b/htdocs/product/stock/mouvement.php @@ -119,7 +119,7 @@ $formother=new FormOther($db); $formproduct=new FormProduct($db); $sql = "SELECT p.rowid, p.ref as product_ref, p.label as produit, p.fk_product_type as type,"; -$sql.= " e.label as stock, e.rowid as entrepot_id,"; +$sql.= " e.label as stock, e.rowid as entrepot_id, e.lieu,"; $sql.= " m.rowid as mid, m.value, m.datem, m.fk_user_author, m.label, m.fk_origin, m.origintype,"; $sql.= " u.login"; $sql.= " FROM (".MAIN_DB_PREFIX."entrepot as e,"; @@ -501,6 +501,7 @@ if ($resql) print '\n"; @@ -515,6 +516,7 @@ if ($resql) print '\n"; // Author diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php index 352750295af..435fca794de 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -751,7 +751,7 @@ if ( (! empty($conf->productbatch->enabled)) && $product->hasbatch()) { print ''; } -$sql = "SELECT e.rowid, e.label, ps.reel, ps.pmp, ps.rowid as product_stock_id"; +$sql = "SELECT e.rowid, e.label, e.lieu, ps.reel, ps.pmp, ps.rowid as product_stock_id"; $sql.= " FROM ".MAIN_DB_PREFIX."entrepot as e,"; $sql.= " ".MAIN_DB_PREFIX."product_stock as ps"; $sql.= " WHERE ps.reel != 0"; @@ -775,6 +775,7 @@ if ($resql) $obj = $db->fetch_object($resql); $entrepotstatic->id=$obj->rowid; $entrepotstatic->libelle=$obj->label; + $entrepotstatic->lieu=$obj->lieu; print ''; print ''; print ''; diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 1d24076df27..93c0e6cf7f0 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -789,7 +789,11 @@ class Project extends CommonObject $result = ''; $lien = ''; $lienfin = ''; - $label = $langs->trans("ShowProject") . ': ' . $this->ref . ($this->title ? ' - ' . $this->title : ''); + $label = '' . $langs->trans("ShowProject") . ''; + if (! empty($this->ref)) + $label .= '
' . $langs->trans('Ref') . ': ' . $this->ref; + if (! empty($this->title)) + $label .= '
' . $langs->trans('Name') . ': ' . $this->title; $linkclose = '" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">'; if ($option != 'nolink') { diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index e1f2e424dee..35450a206ef 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -1720,35 +1720,56 @@ class Societe extends CommonObject $result=''; $lien=$lienfin=''; + $label = '
'; diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index e8ace86cf73..f18f02b60d8 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -2605,9 +2605,17 @@ class Propal extends CommonObject global $langs; $result=''; - $label=$langs->trans("ShowPropal").': '.$this->ref; + $label = '' . $langs->trans("ShowPropal") . ''; + if (! empty($this->ref)) + $label.= '
'.$langs->trans('Ref').': '.$this->ref; if (! empty($this->ref_client)) - $label.= '
'.$langs->trans('RefCustomer').': '.$this->ref_client; + $label.= '
'.$langs->trans('RefCustomer').': '.$this->ref_client; + if (! empty($this->total_ht)) + $label.= '
' . $langs->trans('AmountHT') . ': ' . price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency); + if (! empty($this->total_tva)) + $label.= '
' . $langs->trans('TVA') . ': ' . price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency); + if (! empty($this->total_ttc)) + $label.= '
' . $langs->trans('AmountTTC') . ': ' . price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency); $linkclose = '" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">'; if ($option == '') { $lien = ''; + $label = '' . $langs->trans("ShowAccount") . ''; + if (! empty($this->label)) + $label .= '
' . $langs->trans('Account') . ': ' . $this->label; + if (! empty($this->number)) + $label .= '
' . $langs->trans('AccountNumber') . ': ' . $this->number; + $linkclose = '" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">'; if (empty($mode)) { @@ -948,7 +953,7 @@ class Account extends CommonObject $lienfin='
'; } - if ($withpicto) $result.=($lien.img_object($langs->trans("ShowAccount").': '.$this->label, 'account', 'class="classfortooltip"').$lienfin.' '); + if ($withpicto) $result.=($lien.img_object($label, 'account', 'class="classfortooltip"').$lienfin.' '); $result.=$lien.$this->label.$lienfin; return $result; } diff --git a/htdocs/compta/bank/releve.php b/htdocs/compta/bank/releve.php index e4afe6f2b25..902495bc6aa 100644 --- a/htdocs/compta/bank/releve.php +++ b/htdocs/compta/bank/releve.php @@ -391,10 +391,9 @@ else } } elseif ($links[$key]['type']=='company') { - print ''; - print img_object($langs->trans('ShowCustomer'),'company').' '; - print dol_trunc($links[$key]['label'],24); - print ''; + $societestatic->id = $links[$key]['url_id']; + $societestatic->name = $links[$key]['label']; + print $societestatic->getNomUrl(1, 'company', 24); $newline=0; } elseif ($links[$key]['type']=='member') { diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index d30a19cd040..d8357b15d14 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -858,9 +858,17 @@ class Facture extends CommonInvoice if ($this->type == self::TYPE_CREDIT_NOTE) $picto.='a'; // Credit note if ($this->type == self::TYPE_DEPOSIT) $picto.='d'; // Deposit invoice - $label=$langs->trans("ShowInvoice").': '.$this->ref; + $label = '' . $langs->trans("ShowInvoice") . ''; + if (! empty($this->ref)) + $label .= '
'.$langs->trans('Ref') . ': ' . $this->ref; if (! empty($this->ref_client)) - $label.= '
' . $langs->trans('RefCustomer') . $this->ref_client; + $label .= '
' . $langs->trans('RefCustomer') . ': ' . $this->ref_client; + if (! empty($this->total_ht)) + $label.= '
' . $langs->trans('AmountHT') . ': ' . price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency); + if (! empty($this->total_tva)) + $label.= '
' . $langs->trans('TVA') . ': ' . price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency); + if (! empty($this->total_ttc)) + $label.= '
' . $langs->trans('AmountTTC') . ': ' . price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency); if ($this->type == self::TYPE_REPLACEMENT) $label=$langs->transnoentitiesnoconv("ShowInvoiceReplace").': '.$this->ref; if ($this->type == self::TYPE_CREDIT_NOTE) $label=$langs->transnoentitiesnoconv("ShowInvoiceAvoir").': '.$this->ref; if ($this->type == self::TYPE_DEPOSIT) $label=$langs->transnoentitiesnoconv("ShowInvoiceDeposit").': '.$this->ref; @@ -3330,7 +3338,8 @@ class Facture extends CommonInvoice $sql.= ' l.total_ht, l.total_tva, l.total_ttc, l.fk_product_fournisseur_price as fk_fournprice, l.buy_price_ht as pa_ht,'; $sql.= ' l.date_start, l.date_end,'; $sql.= ' p.ref as product_ref, p.fk_product_type, p.label as product_label,'; - $sql.= ' p.description as product_desc'; + $sql.= ' p.description as product_desc,'; + $sql.= ' p.entity'; $sql.= ' FROM '.MAIN_DB_PREFIX.'facturedet as l'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON l.fk_product=p.rowid'; $sql.= ' WHERE l.fk_facture = '.$this->id; @@ -3353,6 +3362,7 @@ class Facture extends CommonInvoice $this->lines[$i]->description = $obj->description; $this->lines[$i]->fk_product = $obj->fk_product; $this->lines[$i]->ref = $obj->product_ref; + $this->lines[$i]->entity = $obj->entity; // Product entity $this->lines[$i]->product_label = $obj->product_label; $this->lines[$i]->product_desc = $obj->product_desc; $this->lines[$i]->fk_product_type = $obj->fk_product_type; diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php index 9265c9ee463..b1d32083a8a 100644 --- a/htdocs/compta/index.php +++ b/htdocs/compta/index.php @@ -144,8 +144,12 @@ if (! empty($conf->don->enabled) && $user->rights->don->lire) */ if (! empty($conf->facture->enabled) && $user->rights->facture->lire) { - $sql = "SELECT f.facnumber, f.rowid, f.total_ttc, f.type,"; - $sql.= " s.nom as name, s.rowid as socid"; + $sql = "SELECT f.facnumber"; + $sql.= ", f.rowid, f.total as total_ht, f.tva as total_tva, f.total_ttc"; + $sql.= ", f.type"; + $sql.= ", s.nom as name"; + $sql.= ", s.rowid as socid"; + $sql.= ",s.code_client"; if (!$user->rights->societe->client->voir && !$socid) $sql.= ", sc.fk_soc, sc.fk_user "; $sql.= " FROM ".MAIN_DB_PREFIX."facture as f, ".MAIN_DB_PREFIX."societe as s"; if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; @@ -180,13 +184,18 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire) print '
'; $facturestatic->ref=$obj->facnumber; $facturestatic->id=$obj->rowid; + $facturestatic->total_ht=$obj->total_ht; + $facturestatic->total_tva=$obj->total_tva; + $facturestatic->total_ttc=$obj->total_ttc; $facturestatic->type=$obj->type; print $facturestatic->getNomUrl(1,''); print ''; $companystatic->id=$obj->socid; $companystatic->name=$obj->name; - $companystatic->client=1; + $companystatic->client = 1; + $companystatic->code_client = $obj->code_client; + $companystatic->code_fournisseur = $obj->code_fournisseur; print $companystatic->getNomUrl(1,'',16); print ''.price($obj->total_ttc).'
'; $facturesupplierstatic->ref=$obj->ref; $facturesupplierstatic->id=$obj->rowid; + $facturesupplierstatic->total_ht=$obj->total_ht; + $facturesupplierstatic->total_tva=$obj->total_tva; + $facturesupplierstatic->total_ttc=$obj->total_ttc; $facturesupplierstatic->type=$obj->type; print $facturesupplierstatic->getNomUrl(1,'',16); print ''; $companystatic->id=$obj->socid; $companystatic->name=$obj->name; - $companystatic->client=1; - print $companystatic->getNomUrl(1,'',16); + $companystatic->fournisseur = 1; + $companystatic->code_client = $obj->code_client; + $companystatic->code_fournisseur = $obj->code_fournisseur; + print $companystatic->getNomUrl(1,'supplier',16); print ''.price($obj->total_ttc).'
'; $facturestatic->ref=$obj->facnumber; $facturestatic->id=$obj->rowid; + $facturestatic->total_ht=$obj->total_ht; + $facturestatic->total_tva=$obj->total_tva; + $facturestatic->total_ttc=$obj->total_ttc; $facturestatic->type=$obj->type; print $facturestatic->getNomUrl(1,''); print ''.price($obj->total).''.price($obj->total_ht).''.price($obj->total_ttc).''.dol_print_date($db->jdate($obj->tms),'day').''.$facstatic->LibStatut($obj->paye,$obj->fk_statut,3,$obj->am).'
'; $facstatic->ref=$obj->ref; - $facstatic->id=$obj->rowid; + $facstatic->id = $obj->rowid; + $facstatic->total_ht = $obj->total_ht; + $facstatic->total_tva = $obj->total_tva; + $facstatic->total_ttc = $obj->total_ttc; print $facstatic->getNomUrl(1,''); print ''; $thirdpartystatic->id=$obj->socid; $thirdpartystatic->name=$obj->name; $thirdpartystatic->fournisseur=1; + $thirdpartystatic->code_client = $obj->code_client; + $thirdpartystatic->code_fournisseur = $obj->code_fournisseur; print $thirdpartystatic->getNomUrl(1,'supplier',44); print ''.price($obj->total_ht).''.price($obj->total_ht).''; $facturestatic->ref=$obj->facnumber; $facturestatic->id=$obj->rowid; + $facturestatic->total_ht=$obj->total_ht; + $facturestatic->total_tva=$obj->total_tva; + $facturestatic->total_ttc=$obj->total_ttc; $facturestatic->type=$obj->type; print $facturestatic->getNomUrl(1,''); print ''.price($obj->total).''.price($obj->total_ht).''.price($obj->total_ttc).''.price($obj->am).''.$facstatic->LibStatut($obj->paye,$obj->fk_statut,3,$obj->am).'
'; $facstatic->ref=$obj->ref; - $facstatic->id=$obj->rowid; + $facstatic->id = $obj->rowid; + $facstatic->total_ht = $obj->total_ht; + $facstatic->total_tva = $obj->total_tva; + $facstatic->total_ttc = $obj->total_ttc; print $facstatic->getNomUrl(1,''); print ''.$societestatic->getNomUrl(1, 'supplier', 44).''.price($obj->total_ht).''.price($obj->total_ttc).''; - $userstatic->id=$obj->fk_user_author; - $userstatic->login=$obj->login; - $out.=$userstatic->getLoginUrl(1); + //$userstatic->id=$obj->fk_user_author; + //$userstatic->login=$obj->login; + //$out.=$userstatic->getLoginUrl(1); + $userstatic->fetch($obj->fk_user_author); + $out.=$userstatic->getNomUrl(1); $out.=''; - $userstatic->id=$histo[$key]['userid']; - $userstatic->login=$histo[$key]['login']; - $out.=$userstatic->getLoginUrl(1); + //$userstatic->id=$histo[$key]['userid']; + //$userstatic->login=$histo[$key]['login']; + //$out.=$userstatic->getLoginUrl(1); + $userstatic->fetch($histo[$key]['userid']); + $out.=$userstatic->getNomUrl(1); $out.=' '; print ''; + } + if($conf->livraison_bon->enabled) { print ' '; @@ -178,17 +182,22 @@ if ($resql) // Date delivery planed print ""; - print dol_print_date($db->jdate($objp->date_expedition),"day"); + print dol_print_date($db->jdate($objp->date_livraison),"day"); /*$now = time(); if ( ($now - $db->jdate($objp->date_expedition)) > $conf->warnings->lim && $objp->statutid == 1 ) { }*/ print ""; - print dol_print_date($db->jdate($objp->date_livraison),"day"); - print "'; + print dol_print_date($db->jdate($objp->date_expedition),"day"); + print ''; + print dol_print_date($db->jdate($objp->date_reception),"day"); + print ''.$expedition->LibStatut($objp->fk_statut,5).'
'; - $orderstatic->id=$obj->rowid; - $orderstatic->ref=$obj->ref; + $orderstatic->id = $obj->rowid; + $orderstatic->ref = $obj->ref; + $orderstatic->total_ht = $obj->total_ht; + $orderstatic->total_tva = $obj->total_tva; + $orderstatic->total_ttc = $obj->total_ttc; print $orderstatic->getNomUrl(1); print ''; @@ -407,7 +410,7 @@ if ($object->id > 0) if ($user->rights->fournisseur->facture->lire) { // TODO move to DAO class - $sql = 'SELECT f.rowid,f.libelle,f.ref,f.ref_supplier,f.fk_statut,f.datef as df,f.total_ttc as amount,f.paye,'; + $sql = 'SELECT f.rowid,f.libelle,f.ref,f.ref_supplier,f.fk_statut,f.datef as df, f.total_ht, f.total_tva, f.total_ttc as amount,f.paye,'; $sql.= ' SUM(pf.amount) as am'; $sql.= ' FROM '.MAIN_DB_PREFIX.'facture_fourn as f'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'paiementfourn_facturefourn as pf ON f.rowid=pf.fk_facturefourn'; @@ -440,6 +443,10 @@ if ($object->id > 0) print ''; $facturestatic->id=$obj->rowid; $facturestatic->ref=($obj->ref?$obj->ref:$obj->rowid).($obj->ref_supplier?' - '.$obj->ref_supplier:''); + $facturestatic->ref_supplier = $obj->ref_supplier; + $facturestatic->total_ht = $obj->total_ht; + $facturestatic->total_tva = $obj->total_tva; + $facturestatic->total_ttc = $obj->total_ttc; //$facturestatic->ref_supplier=$obj->ref_supplier; print $facturestatic->getNomUrl(1); //print img_object($langs->trans('ShowBill'),'bill').' '.($obj->ref?$obj->ref:$obj->rowid).' - '.$obj->ref_supplier.''; diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 842fe9fcf0b..8ba3a8d53e9 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -1472,8 +1472,17 @@ class FactureFournisseur extends CommonInvoice global $langs; $result=''; - $label=$langs->trans("ShowInvoice").': '.$this->ref; - if ($this->ref_supplier) $label.=' / '.$this->ref_supplier; + $label = '' . $langs->trans("ShowSupplierInvoice") . ''; + if (! empty($this->ref)) + $label .= '
' . $langs->trans('Ref') . ': ' . $this->ref; + if (! empty($this->ref_supplier)) + $label.= '
' . $langs->trans('RefSupplier') . ': ' . $this->ref_supplier; + if (! empty($this->total_ht)) + $label.= '
' . $langs->trans('AmountHT') . ': ' . price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency); + if (! empty($this->total_tva)) + $label.= '
' . $langs->trans('TVA') . ': ' . price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency); + if (! empty($this->total_ttc)) + $label.= '
' . $langs->trans('AmountTTC') . ': ' . price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency); if ($option == 'document') { diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index b94a746a7b9..548e9b674c2 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -98,10 +98,14 @@ $offset = $conf->liste_limit * $page ; * Mode Liste */ -$sql = "SELECT s.rowid as socid, s.nom as name, cf.date_commande as dc,"; -$sql.= " cf.rowid,cf.ref, cf.ref_supplier, cf.fk_statut, cf.total_ht, cf.tva as total_tva, cf.total_ttc, cf.fk_user_author,cf.date_livraison,"; -$sql.= " p.rowid as project_id, p.ref as project_ref,"; -$sql.= " u.login"; +$sql = "SELECT s.rowid as socid, s.nom as name, cf.date_commande as dc"; +$sql.= ", cf.rowid,cf.ref, cf.ref_supplier, cf.fk_statut, cf.total_ht, cf.tva as total_tva, cf.total_ttc, cf.fk_user_author,cf.date_livraison"; +$sql.= ", p.rowid as project_id"; +$sql.= ", p.ref as project_ref"; +$sql.= ", u.firstname"; +$sql.= ", u.lastname"; +$sql.= ", u.photo"; +$sql.= ", u.login"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s,"; $sql.= " ".MAIN_DB_PREFIX."commande_fournisseur as cf"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as u ON cf.fk_user_author = u.rowid"; @@ -257,11 +261,14 @@ if ($resql) print '
"; - if ($userstatic->id) print $userstatic->getLoginUrl(1); + if ($userstatic->id) print $userstatic->getNomUrl(1); else print " "; print "'; $product_static->id=$objp->rowid; $product_static->ref=$objp->ref; + $product_static->label = $objp->label; $product_static->type=$objp->fk_product_type; + $product_static->entity = $objp->entity; print $product_static->getNomUrl(1,'',16); print "'.dol_trunc($objp->label,32).'
'; $product_static->ref=$objp->ref; $product_static->id=$objp->rowid; + $product_static->label = $objp->label; $product_static->type=$objp->fk_product_type; print $product_static->getNomUrl(1,'',16); //if ($objp->stock_theorique < $objp->seuil_stock_alerte) print ' '.img_warning($langs->trans("StockTooLow")); diff --git a/htdocs/product/stock/card.php b/htdocs/product/stock/card.php index b31305b448b..0d21b91d109 100644 --- a/htdocs/product/stock/card.php +++ b/htdocs/product/stock/card.php @@ -435,7 +435,8 @@ else print "
"; $productstatic->id=$objp->rowid; - $productstatic->ref=$objp->ref; + $productstatic->ref = $objp->ref; + $productstatic->label = $objp->produit; $productstatic->type=$objp->type; print $productstatic->getNomUrl(1,'stock',16); print ''; $productstatic->id=$objp->rowid; $productstatic->ref=$objp->product_ref; + $productstatic->label=$objp->produit; $productstatic->type=$objp->type; print $productstatic->getNomUrl(1,'',16); print "'; $warehousestatic->id=$objp->entrepot_id; $warehousestatic->libelle=$objp->stock; + $warehousestatic->lieu=$objp->lieu; print $warehousestatic->getNomUrl(1); print "
'.$entrepotstatic->getNomUrl(1).''.$obj->reel.($obj->reel<0?' '.img_warning():'').'
'; + $label.= ''; + $label.= ''; + if (! empty($this->logo)) { + $form = new Form($db); + $label .= ''; + } + $label.= '
'; if ($option == 'customer' || $option == 'compta') { + $label.= '' . $langs->trans("ShowCustomer") . ''; $lien = ''; $lien = ''; $lien = ''; $lien = ''; $lien = ''; $lien = 'name)) + $label.= '
' . $langs->trans('Name') . ': '. $this->name; + if (! empty($this->code_client)) + $label.= '
' . $langs->trans('CustomerCode') . ': '. $this->code_client; + if (! empty($this->code_fournisseur)) + $label.= '
' . $langs->trans('SupplierCode') . ': '. $this->code_fournisseur; + + $label.= '
  ' . $form->showphoto('societe', $this, 80) . '
'; // Add type of canvas $lien.=(!empty($this->canvas)?'&canvas='.$this->canvas:'').'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">'; diff --git a/htdocs/societe/index.php b/htdocs/societe/index.php index a6a00bb0046..d92a28a08f1 100644 --- a/htdocs/societe/index.php +++ b/htdocs/societe/index.php @@ -245,7 +245,9 @@ print '
'; * Last third parties modified */ $max=15; -$sql = "SELECT s.rowid, s.nom as name, s.client, s.fournisseur, s.canvas, s.tms as datem, s.status as status"; +$sql = "SELECT s.rowid, s.nom as name, s.client, s.fournisseur"; +$sql.= ", s.logo"; +$sql.= ", s.canvas, s.tms as datem, s.status as status"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; if (! $user->rights->societe->client->voir && ! $socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= ' WHERE s.entity IN ('.getEntity('societe', 1).')'; @@ -289,29 +291,49 @@ if ($result) $thirdparty_static->name=$objp->name; $thirdparty_static->client=$objp->client; $thirdparty_static->fournisseur=$objp->fournisseur; + $thirdparty_static->logo = $objp->logo; $thirdparty_static->datem=$db->jdate($objp->datem); $thirdparty_static->status=$objp->status; $thirdparty_static->canvas=$objp->canvas; - print $thirdparty_static->getNomUrl(1); - print "
'; + //print ''; if ($thirdparty_static->client==1 || $thirdparty_static->client==3) { - $thirdparty_static->name=$langs->trans("Customer"); - print $thirdparty_static->getNomUrl(0,'customer'); + print $thirdparty_static->getNomUrl(1, 'customer'); + print "'; + print $langs->trans("Customer"); + } + if ($thirdparty_static->client == 3 && empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) { + print $thirdparty_static->getNomUrl(1); + print "'; + print " / "; } - if ($thirdparty_static->client == 3 && empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) print " / "; if (($thirdparty_static->client==2 || $thirdparty_static->client==3) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) { - $thirdparty_static->name=$langs->trans("Prospect"); - print $thirdparty_static->getNomUrl(0,'prospect'); + print $thirdparty_static->getNomUrl(1, 'prospect'); + print "'; + print $langs->trans("Prospect"); } if (! empty($conf->fournisseur->enabled) && $thirdparty_static->fournisseur) { - if ($thirdparty_static->client) print " / "; - $thirdparty_static->name=$langs->trans("Supplier"); - print $thirdparty_static->getNomUrl(0,'supplier'); + if (! $thirdparty_static->client) { + print $thirdparty_static->getNomUrl(1, 'supplier'); + print "'; + print $langs->trans("Supplier"); + } else { + // Type + print " / "; + print $langs->trans("Supplier"); + } } print '
'; + $label.= ''; + $label.= ''; + } + $label.= ''; + + // Info Login + if ($infologin) { + $label.= '
'; + $label.= '
'.$langs->trans("Connection").''; + $label.= '
'.$langs->trans("IPAddress").': '.$_SERVER["REMOTE_ADDR"]; + if (! empty($conf->global->MAIN_MODULE_MULTICOMPANY)) $label.= '
'.$langs->trans("ConnectedOnMultiCompany").': '.$conf->entity.' (user entity '.$this->entity.')'; + $label.= '
'.$langs->trans("AuthenticationMode").': '.$_SESSION["dol_authmode"].(empty($dolibarr_main_demo)?'':' (demo)'); + $label.= '
'.$langs->trans("ConnectedSince").': '.dol_print_date($this->datelastlogin,"dayhour"); + $label.= '
'.$langs->trans("PreviousConnexion").': '.dol_print_date($this->datepreviouslogin,"dayhour"); + $label.= '
'.$langs->trans("CurrentTheme").': '.$conf->theme; + $label.= '
'.$langs->trans("CurrentMenuManager").': '.$menumanager->name; + $s=picto_from_langcode($langs->getDefaultLang()); + $label.= '
'.$langs->trans("CurrentUserLanguage").': '.($s?$s.' ':'').$langs->getDefaultLang(); + $label.= '
'.$langs->trans("Browser").': '.$conf->browser->name.($conf->browser->version?' '.$conf->browser->version:'').' ('.$_SERVER['HTTP_USER_AGENT'].')'; + if (! empty($conf->browser->phone)) $label.= '
'.$langs->trans("Phone").': '.$conf->browser->phone; + if (! empty($_SESSION["disablemodules"])) $label.= '
'.$langs->trans("DisabledModules").':
'.join(', ',explode(',',$_SESSION["disablemodules"])); + } - $result=''; - $label = $langs->trans("ShowUser").': '.$this->getFullName($langs,'','',24); $lien = ''; $lienfin=''; @@ -1795,7 +1841,7 @@ class User extends CommonObject $result.=($lien.img_object($label, 'user', 'class="classfortooltip"').$lienfin); if ($withpicto != 2) $result.=' '; } - $result.=$lien.$this->getFullName($langs,'','',24).$lienfin; + $result.= $lien . $this->getFullName($langs,'','',24) . $companylink . $lienfin; return $result; } diff --git a/htdocs/user/home.php b/htdocs/user/home.php index c9b3693f1ac..72e9b124ae0 100644 --- a/htdocs/user/home.php +++ b/htdocs/user/home.php @@ -98,8 +98,16 @@ print '
'; */ $max=10; -$sql = "SELECT u.rowid, u.lastname, u.firstname, u.admin, u.login, u.fk_societe, u.datec, u.statut, u.entity, u.ldap_sid,"; -$sql.= " s.nom as name, s.canvas"; +$sql = "SELECT u.rowid, u.lastname, u.firstname, u.admin, u.login, u.fk_societe, u.datec, u.statut"; +$sql.= ", u.entity"; +$sql.= ", u.ldap_sid"; +$sql.= ", u.photo"; +$sql.= ", u.admin"; +$sql.= ", u.email"; +$sql.= ", u.skype"; +$sql.= ", s.nom as name"; +$sql.= ", s.code_client"; +$sql.= ", s.canvas"; $sql.= " FROM ".MAIN_DB_PREFIX."user as u"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON u.fk_societe = s.rowid"; if (! empty($conf->multicompany->enabled) && $conf->entity == 1 && ($conf->multicompany->transverse_mode || ($user->admin && ! $user->entity))) @@ -129,7 +137,18 @@ if ($resql) $var=!$var; print "
'.img_object($langs->trans("ShowUser"),"user").' '.dolGetFirstLastname($obj->firstname,$obj->lastname).''; + print ''; + $fuserstatic->id = $obj->rowid; + $fuserstatic->statut = $obj->statut; + $fuserstatic->lastname = $obj->lastname; + $fuserstatic->firstname = $obj->firstname; + $fuserstatic->login = $obj->login; + $fuserstatic->photo = $obj->photo; + $fuserstatic->admin = $obj->admin; + $fuserstatic->email = $obj->email; + $fuserstatic->skype = $obj->skype; + $fuserstatic->societe_id = $obj->fk_societe; + print $fuserstatic->getNomUrl(1); if (! empty($conf->multicompany->enabled) && $obj->admin && ! $obj->entity) { print img_picto($langs->trans("SuperAdministrator"),'redstar'); @@ -145,6 +164,7 @@ if ($resql) { $companystatic->id=$obj->fk_societe; $companystatic->name=$obj->name; + $companystatic->code_client = $obj->code_client; $companystatic->canvas=$obj->canvas; print $companystatic->getNomUrl(1); } @@ -175,8 +195,6 @@ if ($resql) print ''.dol_print_date($db->jdate($obj->datec),'dayhour').''; - $fuserstatic->id=$obj->rowid; - $fuserstatic->statut=$obj->statut; print $fuserstatic->getLibStatut(3); print ''; diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 4a9e1f8514a..ee43d8c48af 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -1777,6 +1777,7 @@ class User extends CommonObject * * @param int $withpicto Include picto in link (0=No picto, 1=Inclut le picto dans le lien, 2=Picto seul) * @param string $option On what the link point to + * @param boolean $infologin Add connection info to the tooltip * @return string String with URL */ function getNomUrl($withpicto=0, $option='', $infologin=0)