diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 6ecb4045386..98d971acbd0 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -1565,6 +1565,8 @@ class Adherent extends CommonObject $result=''; $label = '' . $langs->trans("ShowMember") . ''; $label.= '
' . $langs->trans('Ref') . ': ' . $this->ref; + if (! empty($this->firstname) || ! empty($this->lastname)) + $label.= '
' . $langs->trans('Name') . ': ' . $this->getFullName($langs); $linkclose = '" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">'; if ($option == 'card') diff --git a/htdocs/core/boxes/box_contacts.php b/htdocs/core/boxes/box_contacts.php index a7abde7494b..fdd5f725883 100644 --- a/htdocs/core/boxes/box_contacts.php +++ b/htdocs/core/boxes/box_contacts.php @@ -62,14 +62,15 @@ class box_contacts extends ModeleBoxes if ($user->rights->societe->lire) { - $sql = "SELECT sp.rowid, sp.lastname, sp.firstname, sp.civility as civility_id, sp.datec, sp.tms, sp.fk_soc,"; - $sql.= " s.nom as socname"; + $sql = "SELECT sp.rowid, sp.lastname, sp.firstname, sp.civility as civility_id, sp.datec, sp.tms, sp.fk_soc"; + $sql.= ", s.nom as socname"; + $sql.= ", s.code_client"; $sql.= " FROM ".MAIN_DB_PREFIX."socpeople as sp"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON sp.fk_soc = s.rowid"; if (! $user->rights->societe->client->voir && ! $user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE sp.entity IN (".getEntity('societe', 1).")"; if (! $user->rights->societe->client->voir && ! $user->societe_id) $sql.= " AND sp.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; - if ($user->societe_id) $sql.= " AND sp.fk_soc = $user->societe_id"; + if ($user->societe_id) $sql.= " AND sp.fk_soc = ".$user->societe_id; $sql.= " ORDER BY sp.tms DESC"; $sql.= $db->plimit($max, 0); @@ -80,8 +81,8 @@ class box_contacts extends ModeleBoxes $contactstatic=new Contact($db); $societestatic=new Societe($db); - $i = 0; - while ($i < $num) { + $line = 0; + while ($line < $num) { $objp = $db->fetch_object($result); $datec=$db->jdate($objp->datec); $datem=$db->jdate($objp->tms); @@ -90,31 +91,32 @@ class box_contacts extends ModeleBoxes $contactstatic->firstname=$objp->firstname; $contactstatic->civility_id=$objp->civility_id; - $societestatic->id=$objp->fk_soc; - $societestatic->name=$objp->socname; + $societestatic->id = $objp->fk_soc; + $societestatic->code_client = $objp->code_client; + $societestatic->name = $objp->socname; - $this->info_box_contents[$i][] = array( + $this->info_box_contents[$line][] = array( 'td' => 'align="left"', 'text' => $contactstatic->getNomUrl(1), 'asis' => 1, ); - $this->info_box_contents[$i][] = array( + $this->info_box_contents[$line][] = array( 'td' => 'align="left"', 'text' => $societestatic->getNomUrl(1), 'asis' => 1, ); - $this->info_box_contents[$i][] = array( + $this->info_box_contents[$line][] = array( 'td' => 'align="right"', 'text' => dol_print_date($datem, "day"), ); - $i++; + $line++; } if ($num==0) - $this->info_box_contents[$i][0] = array( + $this->info_box_contents[$line][0] = array( 'td' => 'align="center"', 'text'=>$langs->trans("NoRecordedContacts"), ); diff --git a/htdocs/core/boxes/box_external_rss.php b/htdocs/core/boxes/box_external_rss.php index 773f98fff70..f1db35e1614 100644 --- a/htdocs/core/boxes/box_external_rss.php +++ b/htdocs/core/boxes/box_external_rss.php @@ -109,10 +109,11 @@ class box_external_rss extends ModeleBoxes // INFO on items $items=$rssparser->getItems(); + //print '
'.print_r($items,true).'
'; $nbitems=count($items); - for($i = 0; $i < $max && $i < $nbitems; $i++) + for($line = 0; $line < $max && $line < $nbitems; $line++) { - $item = $items[$i]; + $item = $items[$line]; // Feed common fields $href = $item['link']; @@ -139,28 +140,38 @@ class box_external_rss extends ModeleBoxes if (! $isutf8 && $conf->file->character_set_client == 'UTF-8') $title=utf8_encode($title); elseif ($isutf8 && $conf->file->character_set_client == 'ISO-8859-1') $title=utf8_decode($title); - $title=preg_replace("/([[:alnum:]])\?([[:alnum:]])/","\\1'\\2",$title); // Gere probleme des apostrophes mal codee/decodee par utf8 + $title=preg_replace("/([[:alnum:]])\?([[:alnum:]])/","\\1'\\2",$title); // Gere probleme des apostrophes mal codee/decodee par utf8 $title=preg_replace("/^\s+/","",$title); // Supprime espaces de debut $this->info_box_contents["$href"]="$title"; - $this->info_box_contents[$i][0] = array( + $tooltip = $title; + $description = ! empty($item['description'])?$item['description']:''; + $isutf8 = utf8_check($description); + if (! $isutf8 && $conf->file->character_set_client == 'UTF-8') $description=utf8_encode($description); + elseif ($isutf8 && $conf->file->character_set_client == 'ISO-8859-1') $description=utf8_decode($description); + $description=preg_replace("/([[:alnum:]])\?([[:alnum:]])/","\\1'\\2",$description); + $description=preg_replace("/^\s+/","",$description); + $description=str_replace("\r\n","",$description); + $tooltip.= '
'.$description; + + $this->info_box_contents[$line][0] = array( 'td' => 'align="left" width="16"', 'logo' => $this->boximg, 'url' => $href, - 'tooltip' => $title, + 'tooltip' => $tooltip, 'target' => 'newrss', ); - $this->info_box_contents[$i][1] = array( + $this->info_box_contents[$line][1] = array( 'td' => 'align="left"', 'text' => $title, 'url' => $href, - 'tooltip' => $title, + 'tooltip' => $tooltip, 'maxlength' => 64, 'target' => 'newrss', ); - $this->info_box_contents[$i][2] = array( + $this->info_box_contents[$line][2] = array( 'td' => 'align="right" nowrap="1"', 'text' => $date, ); diff --git a/htdocs/core/boxes/box_members.php b/htdocs/core/boxes/box_members.php index 46de6175354..f871226b4e9 100644 --- a/htdocs/core/boxes/box_members.php +++ b/htdocs/core/boxes/box_members.php @@ -96,8 +96,8 @@ class box_members extends ModeleBoxes { $num = $db->num_rows($result); - $i = 0; - while ($i < $num) + $line = 0; + while ($line < $num) { $objp = $db->fetch_object($result); $datec=$db->jdate($objp->datec); @@ -105,6 +105,7 @@ class box_members extends ModeleBoxes $memberstatic->lastname=$objp->lastname; $memberstatic->firstname=$objp->firstname; + $memberstatic->ref = $objp->rowid; if (! empty($objp->fk_soc)) { $memberstatic->socid = $objp->fk_soc; @@ -114,35 +115,33 @@ class box_members extends ModeleBoxes $memberstatic->name=$objp->company; } - $this->info_box_contents[$i][0] = array( - 'td' => 'align="left" width="16"', - 'logo' => $this->boximg, - 'tooltip' => $memberstatic->getFullName($langs), - 'url' => DOL_URL_ROOT."/adherents/card.php?rowid=".$objp->rowid, + $this->info_box_contents[$line][] = array( + 'td' => 'align="left"', + 'text' => $memberstatic->getNomUrl(1), + 'asis' => 1, ); - $this->info_box_contents[$i][1] = array( + $this->info_box_contents[$line][] = array( 'td' => 'align="left"', 'text' => $memberstatic->getFullName($langs), - 'tooltip' => $memberstatic->getFullName($langs), 'url' => DOL_URL_ROOT."/adherents/card.php?rowid=".$objp->rowid, ); - $this->info_box_contents[$i][2] = array( + $this->info_box_contents[$line][] = array( 'td' => 'align="right"', 'text' => dol_print_date($datem, "day"), ); - $this->info_box_contents[$i][3] = array( + $this->info_box_contents[$line][] = array( 'td' => 'align="right" width="18"', 'text' => $memberstatic->LibStatut($objp->status,$objp->cotisation,$db->jdate($objp->date_end_subscription),3), ); - $i++; + $line++; } if ($num==0) - $this->info_box_contents[$i][0] = array( + $this->info_box_contents[$line][0] = array( 'td' => 'align="center"', 'text'=>$langs->trans("NoRecordedCustomers"), ); diff --git a/htdocs/core/boxes/box_produits.php b/htdocs/core/boxes/box_produits.php index 59d20b35b91..509502183af 100755 --- a/htdocs/core/boxes/box_produits.php +++ b/htdocs/core/boxes/box_produits.php @@ -64,7 +64,7 @@ class box_produits extends ModeleBoxes if ($user->rights->produit->lire || $user->rights->service->lire) { - $sql = "SELECT p.rowid, p.label, p.price, p.price_base_type, p.price_ttc, p.fk_product_type, p.tms, p.tosell, p.tobuy, p.fk_price_expression"; + $sql = "SELECT p.rowid, p.label, p.ref, p.price, p.price_base_type, p.price_ttc, p.fk_product_type, p.tms, p.tosell, p.tobuy, p.fk_price_expression"; $sql.= " FROM ".MAIN_DB_PREFIX."product as p"; $sql.= ' WHERE p.entity IN ('.getEntity($productstatic->element, 1).')'; if (empty($user->rights->produit->lire)) $sql.=' AND p.fk_product_type != 0'; @@ -76,8 +76,8 @@ class box_produits extends ModeleBoxes if ($result) { $num = $db->num_rows($result); - $i = 0; - while ($i < $num) + $line = 0; + while ($line < $num) { $objp = $db->fetch_object($result); $datem=$db->jdate($objp->tms); @@ -99,35 +99,31 @@ class box_produits extends ModeleBoxes $objp->label = $objtp->label; } } + $productstatic->id = $objp->rowid; + $productstatic->ref = $objp->ref; + $productstatic->type = $objp->fk_product_type; + $productstatic->label = $objp->label; - $this->info_box_contents[$i][0] = array( - 'td' => 'align="left" width="16"', - 'logo' => ($objp->fk_product_type==1?'object_service':'object_product'), - 'tooltip' => $objp->label, - 'url' => DOL_URL_ROOT."/product/card.php?id=".$objp->rowid, + $this->info_box_contents[$line][] = array( + 'td' => 'align="left"', + 'text' => $productstatic->getNomUrl(1), + 'asis' => 1, ); - $this->info_box_contents[$i][1] = array('td' => 'align="left"', - 'text' => $objp->label, - 'url' => DOL_URL_ROOT."/product/card.php?id=".$objp->rowid); - if (empty($objp->fk_price_expression)) { - if ($objp->price_base_type == 'HT') - { - $price=price($objp->price); - $price_base_type=$langs->trans("HT"); - } - else - { - $price=price($objp->price_ttc); - $price_base_type=$langs->trans("TTC"); - } + $this->info_box_contents[$line][] = array( + 'td' => 'align="left"', + 'text' => $objp->label, + ); + + if (empty($objp->fk_price_expression)) { + $price_base_type=$langs->trans($objp->price_base_type); + $price=($objp->price_base_type == 'HT')?price($objp->price):$price=price($objp->price_ttc); } else //Parse the dinamic price { - $product = new Product($this->db); - $product->fetch($objp->rowid, '', '', 1); + $productstatic->fetch($objp->rowid, '', '', 1); $priceparser = new PriceParser($this->db); - $price_result = $priceparser->parseProduct($product); + $price_result = $priceparser->parseProduct($productstatic); if ($price_result >= 0) { if ($objp->price_base_type == 'HT') { @@ -135,31 +131,41 @@ class box_produits extends ModeleBoxes } else { - $price_result = $price_result * (1 + ($product->tva_tx / 100)); + $price_result = $price_result * (1 + ($productstatic->tva_tx / 100)); $price_base_type=$langs->trans("TTC"); } $price=price($price_result); } } - $this->info_box_contents[$i][2] = array('td' => 'align="right"', - 'text' => $price); + $this->info_box_contents[$line][] = array( + 'td' => 'align="right"', + 'text' => $price, + ); - $this->info_box_contents[$i][3] = array('td' => 'align="left" class="nowrap"', - 'text' => $price_base_type); + $this->info_box_contents[$line][] = array( + 'td' => 'align="left" class="nowrap"', + 'text' => $price_base_type, + ); - $this->info_box_contents[$i][4] = array('td' => 'align="right"', - 'text' => dol_print_date($datem,'day')); + $this->info_box_contents[$line][] = array( + 'td' => 'align="right"', + 'text' => dol_print_date($datem,'day'), + ); - $this->info_box_contents[$i][5] = array('td' => 'align="right" width="18"', - 'text' => $productstatic->LibStatut($objp->tosell,3,0)); + $this->info_box_contents[$line][] = array( + 'td' => 'align="right" width="18"', + 'text' => $productstatic->LibStatut($objp->tosell,3,0), + ); - $this->info_box_contents[$i][6] = array('td' => 'align="right" width="18"', - 'text' => $productstatic->LibStatut($objp->tobuy,3,1)); + $this->info_box_contents[$line][] = array( + 'td' => 'align="right" width="18"', + 'text' => $productstatic->LibStatut($objp->tobuy,3,1), + ); - $i++; + $line++; } if ($num==0) - $this->info_box_contents[$i][0] = array( + $this->info_box_contents[$line][0] = array( 'td' => 'align="center"', 'text'=>$langs->trans("NoRecordedProducts"), ); diff --git a/htdocs/core/boxes/box_produits_alerte_stock.php b/htdocs/core/boxes/box_produits_alerte_stock.php index 5d75c924ff2..8096dfdec10 100755 --- a/htdocs/core/boxes/box_produits_alerte_stock.php +++ b/htdocs/core/boxes/box_produits_alerte_stock.php @@ -65,7 +65,7 @@ class box_produits_alerte_stock extends ModeleBoxes if ($user->rights->produit->lire || $user->rights->service->lire) { - $sql = "SELECT p.rowid, p.label, p.price, p.price_base_type, p.price_ttc, p.fk_product_type, p.tms, p.tosell, p.tobuy, p.seuil_stock_alerte,"; + $sql = "SELECT p.rowid, p.label, p.price, p.ref, p.price_base_type, p.price_ttc, p.fk_product_type, p.tms, p.tosell, p.tobuy, p.seuil_stock_alerte,"; $sql.= " SUM(".$db->ifsql("s.reel IS NULL","0","s.reel").") as total_stock"; $sql.= " FROM ".MAIN_DB_PREFIX."product as p"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as s on p.rowid = s.fk_product"; @@ -83,8 +83,8 @@ class box_produits_alerte_stock extends ModeleBoxes { $langs->load("stocks"); $num = $db->num_rows($result); - $i = 0; - while ($i < $num) { + $line = 0; + while ($line < $num) { $objp = $db->fetch_object($result); $datem=$db->jdate($objp->tms); @@ -105,41 +105,32 @@ class box_produits_alerte_stock extends ModeleBoxes $objp->label = $objtp->label; } } + $productstatic->id = $objp->rowid; + $productstatic->ref = $objp->ref; + $productstatic->type = $objp->fk_product_type; + $productstatic->label = $objp->label; - $tooltip = $langs->trans('Product') . ': ' . $objp->label; - $this->info_box_contents[$i][0] = array( - 'td' => 'align="left" width="16"', - 'logo' => ($objp->fk_product_type==1?'object_service':'object_product'), - 'tooltip' => $tooltip, - 'url' => DOL_URL_ROOT."/product/card.php?id=".$objp->rowid, + $this->info_box_contents[$line][] = array( + 'td' => 'align="left"', + 'text' => $productstatic->getNomUrl(1), + 'asis' => 1, ); - $this->info_box_contents[$i][1] = array( + $this->info_box_contents[$line][] = array( 'td' => 'align="left"', 'text' => $objp->label, - 'tooltip' => $tooltip, - 'url' => DOL_URL_ROOT."/product/card.php?id=".$objp->rowid, ); - if (empty($objp->fk_price_expression)) - { - if ($objp->price_base_type == 'HT') - { - $price=price($objp->price); - $price_base_type=$langs->trans("HT"); - } - else - { - $price=price($objp->price_ttc); - $price_base_type=$langs->trans("TTC"); - } + if (empty($objp->fk_price_expression)) + { + $price_base_type=$langs->trans($objp->price_base_type); + $price=($objp->price_base_type == 'HT')?price($objp->price):$price=price($objp->price_ttc); } else //Parse the dinamic price { - $product = new Product($this->db); - $product->fetch($objp->rowid, '', '', 1); + $productstatic->fetch($objp->rowid, '', '', 1); $priceparser = new PriceParser($this->db); - $price_result = $priceparser->parseProduct($product); + $price_result = $priceparser->parseProduct($productstatic); if ($price_result >= 0) { if ($objp->price_base_type == 'HT') { @@ -147,32 +138,37 @@ class box_produits_alerte_stock extends ModeleBoxes } else { - $price_result = $price_result * (1 + ($product->tva_tx / 100)); + $price_result = $price_result * (1 + ($productstatic->tva_tx / 100)); $price_base_type=$langs->trans("TTC"); } $price=price($price_result); } } - $this->info_box_contents[$i][2] = array('td' => 'align="right"', - 'text' => $price); - $this->info_box_contents[$i][3] = array('td' => 'align="left" class="nowrap"', - 'text' => $price_base_type); + $this->info_box_contents[$line][] = array( + 'td' => 'align="right"', + 'text' => $price, + ); - $this->info_box_contents[$i][4] = array('td' => 'align="center"', + $this->info_box_contents[$line][] = array( + 'td' => 'align="left" class="nowrap"', + 'text' => $price_base_type, + ); + + $this->info_box_contents[$line][] = array('td' => 'align="center"', 'text' => $objp->total_stock . ' / '.$objp->seuil_stock_alerte, 'text2'=>img_warning($langs->transnoentitiesnoconv("StockLowerThanLimit"))); - $this->info_box_contents[$i][5] = array('td' => 'align="right" width="18"', + $this->info_box_contents[$line][] = array('td' => 'align="right" width="18"', 'text' => $productstatic->LibStatut($objp->tosell,3,0)); - $this->info_box_contents[$i][6] = array('td' => 'align="right" width="18"', + $this->info_box_contents[$line][] = array('td' => 'align="right" width="18"', 'text' => $productstatic->LibStatut($objp->tobuy,3,1)); - $i++; + $line++; } if ($num==0) - $this->info_box_contents[$i][0] = array( + $this->info_box_contents[$line][0] = array( 'td' => 'align="center"', 'text'=>$langs->trans("NoTooLowStockProducts"), ); @@ -189,8 +185,10 @@ class box_produits_alerte_stock extends ModeleBoxes } } else { - $this->info_box_contents[0][0] = array('td' => 'align="left"', - 'text' => $langs->trans("ReadPermissionNotAllowed")); + $this->info_box_contents[0][0] = array( + 'td' => 'align="left"', + 'text' => $langs->trans("ReadPermissionNotAllowed"), + ); } } diff --git a/htdocs/core/boxes/box_propales.php b/htdocs/core/boxes/box_propales.php index 7bec6849ac7..4e8b47aa0d4 100644 --- a/htdocs/core/boxes/box_propales.php +++ b/htdocs/core/boxes/box_propales.php @@ -57,14 +57,16 @@ class box_propales extends ModeleBoxes $this->max=$max; include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; + include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; $propalstatic=new Propal($db); + $societestatic = new Societe($db); $this->info_box_head = array('text' => $langs->trans("BoxTitleLast".($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE?"":"Modified")."Propals",$max)); if ($user->rights->propale->lire) { - $sql = "SELECT s.nom as name, s.rowid as socid,"; - $sql.= " p.rowid, p.ref, p.fk_statut, p.datep as dp, p.datec, p.fin_validite, p.date_cloture, p.total_ht, p.tms"; + $sql = "SELECT s.nom as name, s.rowid as socid, s.code_client, s.logo,"; + $sql.= " p.rowid, p.ref, p.fk_statut, p.datep as dp, p.datec, p.fin_validite, p.date_cloture, p.total_ht, p.tva as total_tva, p.total as total_ttc, p.tms"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql.= ", ".MAIN_DB_PREFIX."propal as p"; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; @@ -82,72 +84,63 @@ class box_propales extends ModeleBoxes $num = $db->num_rows($result); $now=dol_now(); - $i = 0; + $line = 0; - while ($i < $num) { + while ($line < $num) { $objp = $db->fetch_object($result); $date=$db->jdate($objp->dp); $datec=$db->jdate($objp->datec); $datem=$db->jdate($objp->tms); $dateterm=$db->jdate($objp->fin_validite); $dateclose=$db->jdate($objp->date_cloture); + $propalstatic->id = $objp->rowid; + $propalstatic->ref = $objp->ref; + $propalstatic->total_ht = $objp->total_ht; + $propalstatic->total_tva = $objp->total_tva; + $propalstatic->total_ttc = $objp->total_ttc; + $societestatic->id = $objp->socid; + $societestatic->name = $objp->name; + $societestatic->code_client = $objp->code_client; + $societestatic->logo = $objp->logo; $late = ''; if ($objp->fk_statut == 1 && $dateterm < ($now - $conf->propal->cloture->warning_delay)) { $late = img_warning($langs->trans("Late")); } - $tooltip = $langs->trans('Proposal') . ': ' . $objp->ref; - $this->info_box_contents[$i][0] = array( - 'td' => 'align="left" width="16"', - 'logo' => $this->boximg, - 'tooltip' => $tooltip, - 'url' => DOL_URL_ROOT."/comm/propal.php?id=".$objp->rowid, - ); - - $this->info_box_contents[$i][1] = array( + $this->info_box_contents[$line][] = array( 'td' => 'align="left"', - 'text' => $objp->ref, + 'text' => $propalstatic->getNomUrl(1), 'text2'=> $late, - 'tooltip' => $tooltip, - 'url' => DOL_URL_ROOT."/comm/propal.php?id=".$objp->rowid, + 'asis' => 1, ); - $tooltip = $langs->trans('Customer') . ': ' . $objp->name; - $this->info_box_contents[$i][2] = array( - 'td' => 'align="left" width="16"', - 'logo' => 'company', - 'tooltip' => $tooltip, - 'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid, - ); - - $this->info_box_contents[$i][3] = array( + $this->info_box_contents[$line][] = array( 'td' => 'align="left"', - 'text' => dol_trunc($objp->name,40), - 'tooltip' => $tooltip, - 'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid, + 'text' => $societestatic->getNomUrl(1,'',40), + 'asis' => 1, ); - $this->info_box_contents[$i][4] = array( + $this->info_box_contents[$line][] = array( 'td' => 'align="right"', 'text' => price($objp->total_ht), ); - $this->info_box_contents[$i][5] = array( + $this->info_box_contents[$line][] = array( 'td' => 'align="right"', 'text' => dol_print_date($date,'day'), ); - $this->info_box_contents[$i][6] = array( + $this->info_box_contents[$line][] = array( 'td' => 'align="right" width="18"', 'text' => $propalstatic->LibStatut($objp->fk_statut,3), ); - $i++; + $line++; } if ($num==0) - $this->info_box_contents[$i][0] = array( + $this->info_box_contents[$line][0] = array( 'td' => 'align="center"', 'text'=>$langs->trans("NoRecordedProposals"), );