";
print '';
- $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 ' ';
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 '';
@@ -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 ' ';
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 '';
diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php
index be945c7027e..f56184e2f06 100644
--- a/htdocs/comm/propal/class/propal.class.php
+++ b/htdocs/comm/propal/class/propal.class.php
@@ -2608,9 +2608,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 = 'id ?>">trans("ShowPropal"),"propal").' '.$object->ref; ?>
+ >
+ getNomUrl(1); ?>
ref_client; ?>
date,'day'); ?>
* Copyright (C) 2012 Marcos García
* Copyright (C) 2013 Florian Henry
- * Copyright (C) 2014 Ferran Marcet
+ * Copyright (C) 2014 Ferran Marcet
*
* 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/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php
index 8bd00764a57..27c320b3326 100644
--- a/htdocs/commande/class/commande.class.php
+++ b/htdocs/commande/class/commande.class.php
@@ -2887,10 +2887,18 @@ class Commande extends CommonOrder
if ($short) return $url;
- $picto='order';
- $label=$langs->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=' ';
@@ -3099,7 +3107,8 @@ class Commande extends CommonOrder
$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, l.localtax1_tx, l.localtax2_tx,';
$sql.= ' l.date_start, l.date_end,';
$sql.= ' p.label as product_label, p.ref, p.fk_product_type, p.rowid as prodid, ';
- $sql.= ' p.description as product_desc, p.stock as stock_reel';
+ $sql.= ' p.description as product_desc, p.stock as stock_reel,';
+ $sql.= ' p.entity';
$sql.= ' FROM '.MAIN_DB_PREFIX.'commandedet as l';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON l.fk_product=p.rowid';
$sql.= ' WHERE l.fk_commande = '.$this->id;
@@ -3121,6 +3130,7 @@ class Commande extends CommonOrder
$this->lines[$i]->description = $obj->description;
$this->lines[$i]->fk_product = $obj->fk_product;
$this->lines[$i]->ref = $obj->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/commande/list.php b/htdocs/commande/list.php
index 2c30f4128c6..8374547eaf1 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.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';
@@ -323,6 +324,7 @@ if ($resql)
$var=true;
$total=0;
$subtotal=0;
+ $productstat_cache=array();
$generic_commande = new Commande($db);
$generic_product = new Product($db);
@@ -334,6 +336,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();
@@ -351,17 +357,32 @@ if ($resql)
if ($generic_commande->lines[$lig]->product_type==0) {
$nbprod++; // order contains real products
$generic_product->id = $generic_commande->lines[$lig]->fk_product;
- $generic_product->load_stock();
+ if (empty($productstat_cache[$generic_commande->lines[$lig]->fk_product])) {
+ $generic_product->load_stock(true);
+ $productstat_cache[$generic_commande->lines[$lig]->fk_product]['stock_reel'] = $generic_product->stock_reel;
+ } else {
+ $generic_product->stock_reel = $productstat_cache[$generic_commande->lines[$lig]->fk_product]['stock_reel'];
+ }
// stock order and stock order_supplier
$stock_order=0;
$stock_order_supplier=0;
if (! empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT)) {
if (! empty($conf->commande->enabled)) {
- $generic_product->load_stats_commande(0,'1,2');
+ if (empty($productstat_cache[$generic_commande->lines[$lig]->fk_product]['stats_order_customer'])) {
+ $generic_product->load_stats_commande(0,'1,2',true);
+ $productstat_cache[$generic_commande->lines[$lig]->fk_product]['stats_order_customer'] = $generic_product->stats_commande['qty'];
+ } else {
+ $generic_product->stats_commande['qty'] = $productstat_cache[$generic_commande->lines[$lig]->fk_product]['stats_order_customer'];
+ }
$stock_order=$generic_product->stats_commande['qty'];
}
if (! empty($conf->fournisseur->enabled)) {
- $generic_product->load_stats_commande_fournisseur(0,'3');
+ if (empty($productstat_cache[$generic_commande->lines[$lig]->fk_product]['stats_order_supplier'])) {
+ $generic_product->load_stats_commande_fournisseur(0,'3',true);
+ $productstat_cache[$generic_commande->lines[$lig]->fk_product]['stats_order_supplier'] = $generic_product->stats_commande_fournisseur['qty'];
+ } else {
+ $generic_product->stats_commande_fournisseur['qty'] = $productstat_cache[$generic_commande->lines[$lig]->fk_product]['stats_order_supplier'];
+ }
$stock_order_supplier=$generic_product->stats_commande_fournisseur['qty'];
}
}
@@ -421,6 +442,7 @@ if ($resql)
// Company
$companystatic->id=$objp->socid;
+ $companystatic->code_client = $objp->code_client;
$companystatic->name=$objp->name;
$companystatic->client=$objp->client;
print '';
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'));
trans("Ref"); ?>
+ trans("RefCustomer"); ?>
trans("Date"); ?>
trans("AmountHTShort"); ?>
trans("Status"); ?>
@@ -47,8 +48,9 @@ foreach($linkedObjectBlock as $object)
{
$var=!$var;
?>
- >
- 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/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php
index 5ecca4047e6..598ccc2c8d8 100644
--- a/htdocs/compta/bank/class/account.class.php
+++ b/htdocs/compta/bank/class/account.class.php
@@ -935,7 +935,12 @@ class Account extends CommonObject
global $langs;
$result='';
- $linkclose = '" title="'.dol_escape_htmltag($this->label, 1).'" class="classfortooltip">';
+ $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 f4424b8c9ad..5c645783cc1 100644
--- a/htdocs/compta/facture/class/facture.class.php
+++ b/htdocs/compta/facture/class/facture.class.php
@@ -858,7 +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;
+ 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;
@@ -1681,8 +1691,8 @@ class Facture extends CommonInvoice
return 0;
}
- if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->facture->creer))
- || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->facture->invoice_advance->validate)))
+ if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->facture->creer))
+ || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->facture->invoice_advance->validate)))
{
$this->error='Permission denied';
dol_syslog(get_class($this)."::validate ".$this->error, LOG_ERR);
@@ -3329,7 +3339,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;
@@ -3352,6 +3363,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/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"));
trans("Ref"); ?>
+ trans("RefCustomer"); ?>
trans("Date"); ?>
trans("AmountHTShort"); ?>
trans("Status"); ?>
@@ -47,8 +48,9 @@ foreach($linkedObjectBlock as $object)
{
$var=!$var;
?>
- >
- 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/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 ' ';
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 ' ';
print ''.price($obj->total_ttc).' ';
@@ -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 '';
$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 ' ';
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 ' ';
print ''.price($obj->total_ttc).' ';
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 '';
$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 ' ';
@@ -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 ''.price($obj->total).' ';
+ if (! empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) print ''.price($obj->total_ht).' ';
print ''.price($obj->total_ttc).' ';
print ''.dol_print_date($db->jdate($obj->tms),'day').' ';
print ''.$facstatic->LibStatut($obj->paye,$obj->fk_statut,3,$obj->am).' ';
@@ -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 '';
$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 ' ';
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 ' ';
if (! empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) print ''.price($obj->total_ht).' ';
@@ -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 ''.price($obj->total_ht).' ';
@@ -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 '';
$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 ' ';
@@ -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 ''.price($obj->total).' ';
+ if (! empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) print ''.price($obj->total_ht).' ';
print ''.price($obj->total_ttc).' ';
print ''.price($obj->am).' ';
print ''.$facstatic->LibStatut($obj->paye,$obj->fk_statut,3,$obj->am).' ';
@@ -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 '';
$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->id=$obj->socid;
$societestatic->name=$obj->name;
$societestatic->client=0;
+ $societestatic->code_client = $obj->code_client;
+ $societestatic->code_fournisseur = $obj->code_fournisseur;
print ''.$societestatic->getNomUrl(1, 'supplier', 44).' ';
if (! empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) print ''.price($obj->total_ht).' ';
print ''.price($obj->total_ttc).' ';
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/contrat/admin/contractdet_extrafields.php b/htdocs/contrat/admin/contractdet_extrafields.php
new file mode 100644
index 00000000000..21f27cee6d9
--- /dev/null
+++ b/htdocs/contrat/admin/contractdet_extrafields.php
@@ -0,0 +1,159 @@
+
+ * Copyright (C) 2003 Jean-Louis Bergamo
+ * Copyright (C) 2004-2011 Laurent Destailleur
+ * Copyright (C) 2012 Regis Houssin
+ * Copyright (C) 2014 Florian Henry
+ * Copyright (C) 2013 Philippe Grand
+ *
+ * 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/contrat/admin/contract_extrafields.php
+ * \ingroup contrat
+ * \brief Page to setup extra fields of contract
+ */
+
+
+require '../../main.inc.php';
+require_once DOL_DOCUMENT_ROOT.'/core/lib/contract.lib.php';
+require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
+
+$langs->load("companies");
+$langs->load("admin");
+$langs->load("contracts");
+
+$extrafields = new ExtraFields($db);
+$form = new Form($db);
+
+// List of supported format
+$tmptype2label=ExtraFields::$type2label;
+$type2label=array('');
+foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->trans($val);
+
+$action=GETPOST('action', 'alpha');
+$attrname=GETPOST('attrname', 'alpha');
+$elementtype='contratdet'; //Must be the $element of the class that manage extrafield
+
+if (!$user->admin) accessforbidden();
+
+
+/*
+ * Actions
+ */
+
+require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php';
+
+
+
+/*
+ * View
+ */
+
+
+llxHeader();
+
+
+$linkback=''.$langs->trans("BackToModuleList").' ';
+print_fiche_titre($langs->trans("ContractsSetup"),$linkback,'setup');
+
+print ' ';
+$head=contract_admin_prepare_head();
+
+dol_fiche_head($head, 'attributeslines', $langs->trans("Contracts"), 0, 'contract');
+
+$textobject = $langs->transnoentitiesnoconv('Contracts');
+
+print $langs->trans("DefineHereComplementaryAttributes",$textobject).' '."\n";
+print ' ';
+
+// Load attribute_label
+$extrafields->fetch_name_optionals_label($elementtype);
+
+print "";
+
+print '';
+print ''.$langs->trans("Position").' ';
+print ''.$langs->trans("Label").' ';
+print ''.$langs->trans("AttributeCode").' ';
+print ''.$langs->trans("Type").' ';
+print ''.$langs->trans("Size").' ';
+print ''.$langs->trans("Unique").' ';
+print ''.$langs->trans("Required").' ';
+print ' ';
+print " \n";
+
+$var=True;
+foreach($extrafields->attribute_type as $key => $value)
+{
+ $var=!$var;
+ print "";
+ print "".$extrafields->attribute_pos[$key]." \n";
+ print "".$extrafields->attribute_label[$key]." \n";
+ print "".$key." \n";
+ print "".$type2label[$extrafields->attribute_type[$key]]." \n";
+ print ''.$extrafields->attribute_size[$key]." \n";
+ print ''.yn($extrafields->attribute_unique[$key])." \n";
+ print ''.yn($extrafields->attribute_required[$key])." \n";
+ print ''.img_edit().' ';
+ print " ".img_delete()." \n";
+ print " ";
+ // $i++;
+}
+
+print "
";
+
+dol_fiche_end();
+
+
+// Buttons
+if ($action != 'create' && $action != 'edit')
+{
+ print '";
+}
+
+
+/* ************************************************************************** */
+/* */
+/* Creation d'un champ optionnel
+ /* */
+/* ************************************************************************** */
+
+if ($action == 'create')
+{
+ print " ";
+ print_titre($langs->trans('NewAttribute'));
+
+ require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
+}
+
+/* ************************************************************************** */
+/* */
+/* Edition d'un champ optionnel */
+/* */
+/* ************************************************************************** */
+if ($action == 'edit' && ! empty($attrname))
+{
+ print " ";
+ print_titre($langs->trans("FieldEdition", $attrname));
+
+ require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php';
+}
+
+llxFooter();
+
+$db->close();
diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php
index 2a78f8a8616..eb224e0748d 100644
--- a/htdocs/contrat/card.php
+++ b/htdocs/contrat/card.php
@@ -84,6 +84,10 @@ if ($id > 0 || ! empty($ref)) {
// fetch optionals attributes and labels
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
+// fetch optionals attributes lines and labels
+$extrafieldsline = new ExtraFields($db);
+$extralabelslines=$extrafieldsline->fetch_name_optionals_label($object->table_element_line);
+
$permissionnote=$user->rights->contrat->creer; // Used by the include of actions_setnotes.inc.php
@@ -408,6 +412,18 @@ else if ($action == 'addline' && $user->rights->contrat->creer)
$error++;
}
+ // Extrafields
+ $extrafieldsline = new ExtraFields($db);
+ $extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line);
+ $array_option = $extrafieldsline->getOptionalsFromPost($extralabelsline, $predef);
+ // Unset extrafield
+ if (is_array($extralabelsline)) {
+ // Get extra fields
+ foreach ($extralabelsline as $key => $value) {
+ unset($_POST["options_" . $key]);
+ }
+ }
+
if (! $error)
{
// Clean parameters
@@ -520,7 +536,8 @@ else if ($action == 'addline' && $user->rights->contrat->creer)
$pu_ttc,
$info_bits,
$fk_fournprice,
- $pa_ht
+ $pa_ht,
+ $array_option
);
}
@@ -617,6 +634,12 @@ else if ($action == 'updateligne' && $user->rights->contrat->creer && ! GETPOST(
$objectline->fk_fournprice=$fk_fournprice;
$objectline->pa_ht=$pa_ht;
+ // Extrafields
+ $extrafieldsline = new ExtraFields($db);
+ $extralabelsline = $extrafieldsline->fetch_name_optionals_label($objectline->table_element);
+ $array_option = $extrafieldsline->getOptionalsFromPost($extralabelsline, $predef);
+ $objectline->array_options=$array_option;
+
// TODO verifier price_min si fk_product et multiprix
$result=$objectline->update($user);
@@ -1237,7 +1260,7 @@ else
* Lines of contracts
*/
- if ($conf->product->enabled) {
+ if ($conf->product->enabled || $conf->service->enabled) {
$productstatic=new Product($db);
}
@@ -1306,7 +1329,7 @@ else
$productstatic->ref=$objp->label;
print $productstatic->getNomUrl(0,'',16);
}
- if (! empty($conf->global->PRODUIT_DESC_IN_FORM) and $objp->description)
+ if (! empty($conf->global->PRODUIT_DESC_IN_FORM) && !empty($objp->description))
print ' '.dol_nl2br($objp->description);
print '';
}
@@ -1391,6 +1414,16 @@ else
print '';
print ' ';
}
+
+
+ //Display lines extrafields
+ if (is_array($extralabelslines) && count($extralabelslines)>0) {
+ print '';
+ $line = new ContratLigne($db);
+ $line->fetch_optionals($objp->rowid,$extralabelslines);
+ print $line->showOptionals($extrafieldsline, 'view', array('style'=>$bc[$var], 'colspan'=>$colspan));
+ print ' ';
+ }
}
// Ligne en mode update
else
@@ -1448,6 +1481,15 @@ else
print ' '.$langs->trans("DateEndPlanned").' ';
$form->select_date($db->jdate($objp->date_fin),"date_end_update",$usehm,$usehm,($db->jdate($objp->date_fin)>0?0:1),"update");
print '';
+
+ if (is_array($extralabelslines) && count($extralabelslines)>0) {
+ print '';
+ $line = new ContratLigne($db);
+ $line->fetch_optionals($objp->rowid,$extralabelslines);
+ print $line->showOptionals($extrafieldsline, 'edit', array('style'=>$bc[$var], 'colspan'=>$colspan));
+ print ' ';
+ }
+
print '';
}
diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php
index 21430ecca5b..a501e1c8851 100644
--- a/htdocs/contrat/class/contrat.class.php
+++ b/htdocs/contrat/class/contrat.class.php
@@ -923,7 +923,8 @@ class Contrat extends CommonObject
$modCodeContract = new $module();
}
- if (!empty($modCodeContract->code_auto)) {
+ //Commerce Efficace - Debut : Modification r�f�rence Contrat
+ /*if (!empty($modCodeContract->code_auto)) {
// Mise a jour ref
$sql = 'UPDATE '.MAIN_DB_PREFIX."contrat SET ref='(PROV".$this->id.")' WHERE rowid=".$this->id;
if ($this->db->query($sql))
@@ -933,7 +934,8 @@ class Contrat extends CommonObject
$this->ref="(PROV".$this->id.")";
}
}
- }
+ }*/
+ //Commerce Efficace - Fin : Modification r�f�rence Contrat
// Insert contacts commerciaux ('SALESREPSIGN','contrat')
$result=$this->add_contact($this->commercial_signature_id,'SALESREPSIGN','internal');
@@ -1254,9 +1256,10 @@ class Contrat extends CommonObject
* @param int $info_bits Bits de type de lignes
* @param int $fk_fournprice Fourn price id
* @param int $pa_ht Buying price HT
+ * @param array $array_option extrafields array
* @return int <0 si erreur, >0 si ok
*/
- function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1, $txlocaltax2, $fk_product, $remise_percent, $date_start, $date_end, $price_base_type='HT', $pu_ttc=0.0, $info_bits=0, $fk_fournprice=null, $pa_ht = 0)
+ function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1, $txlocaltax2, $fk_product, $remise_percent, $date_start, $date_end, $price_base_type='HT', $pu_ttc=0.0, $info_bits=0, $fk_fournprice=null, $pa_ht = 0,$array_option=0)
{
global $user, $langs, $conf, $mysoc;
@@ -1364,17 +1367,33 @@ class Contrat extends CommonObject
$result=$this->update_statut($user);
if ($result > 0)
{
- // Call trigger
- $result=$this->call_trigger('LINECONTRACT_CREATE',$user);
- if ($result < 0)
- {
- $this->db->rollback();
- return -1;
- }
- // End call triggers
-
- $this->db->commit();
- return 1;
+
+ if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($array_option) && count($array_option)>0) // For avoid conflicts if trigger used
+ {
+ $contractline = new ContratLigne($this->db);
+ $contractline->array_options=$array_option;
+ $contractline->id= $this->db->last_insert_id(MAIN_DB_PREFIX.$contractline->table_element);
+ $result=$contractline->insertExtraFields();
+ if ($result < 0)
+ {
+ $this->error[]=$contractline->error;
+ $error++;
+ }
+ }
+
+ if (empty($error)) {
+ // Call trigger
+ $result=$this->call_trigger('LINECONTRACT_CREATE',$user);
+ if ($result < 0)
+ {
+ $this->db->rollback();
+ return -1;
+ }
+ // End call triggers
+
+ $this->db->commit();
+ return 1;
+ }
}
else
{
@@ -1415,9 +1434,10 @@ class Contrat extends CommonObject
* @param int $info_bits Bits de type de lignes
* @param int $fk_fournprice Fourn price id
* @param int $pa_ht Buying price HT
+ * @param array $array_option extrafields array
* @return int < 0 si erreur, > 0 si ok
*/
- function updateline($rowid, $desc, $pu, $qty, $remise_percent, $date_start, $date_end, $tvatx, $localtax1tx=0.0, $localtax2tx=0.0, $date_debut_reel='', $date_fin_reel='', $price_base_type='HT', $info_bits=0, $fk_fournprice=null, $pa_ht = 0)
+ function updateline($rowid, $desc, $pu, $qty, $remise_percent, $date_start, $date_end, $tvatx, $localtax1tx=0.0, $localtax2tx=0.0, $date_debut_reel='', $date_fin_reel='', $price_base_type='HT', $info_bits=0, $fk_fournprice=null, $pa_ht = 0,$array_option=0)
{
global $user, $conf, $langs, $mysoc;
@@ -1517,17 +1537,33 @@ class Contrat extends CommonObject
$result=$this->update_statut($user);
if ($result >= 0)
{
- // Call trigger
- $result=$this->call_trigger('LINECONTRACT_UPDATE',$user);
- if ($result < 0)
- {
- $this->db->rollback();
- return -3;
- }
- // End call triggers
-
- $this->db->commit();
- return 1;
+
+ if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($array_option) && count($array_option)>0) // For avoid conflicts if trigger used
+ {
+ $contractline = new ContratLigne($this->db);
+ $contractline->array_options=$array_option;
+ $contractline->id= $this->db->last_insert_id(MAIN_DB_PREFIX.$contractline->table_element);
+ $result=$contractline->insertExtraFields();
+ if ($result < 0)
+ {
+ $this->error[]=$contractline->error;
+ $error++;
+ }
+ }
+
+ if (empty($error)) {
+ // Call trigger
+ $result=$this->call_trigger('LINECONTRACT_UPDATE',$user);
+ if ($result < 0)
+ {
+ $this->db->rollback();
+ return -3;
+ }
+ // End call triggers
+
+ $this->db->commit();
+ return 1;
+ }
}
else
{
@@ -1576,12 +1612,32 @@ class Contrat extends CommonObject
if (! $resql)
{
$this->error="Error ".$this->db->lasterror();
+ $error++;
+ }
+
+ if (empty($error)) {
+ // Remove extrafields
+ if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
+ {
+ $contractline = new ContratLigne($this->db);
+ $contractline->id= $idline;
+ $result=$contractline->deleteExtraFields();
+ if ($result < 0)
+ {
+ $error++;
+ $this->error="Error ".get_class($this)."::delete deleteExtraFields error -4 ".$contractline->error;
+ }
+ }
+ }
+
+ if (empty($error)) {
+ $this->db->commit();
+ return 1;
+ } else {
+ dol_syslog(get_class($this)."::delete ERROR:".$this->error, LOG_ERR);
$this->db->rollback();
return -1;
}
-
- $this->db->commit();
- return 1;
}
else
{
@@ -2083,6 +2139,9 @@ class ContratLigne extends CommonObject
var $statut; // 0 inactive, 4 active, 5 closed
var $label;
+ public $element='contratdet';
+ public $table_element='contratdet';
+
/**
* @var string
* @deprecated Use $label instead
@@ -2461,10 +2520,21 @@ class ContratLigne extends CommonObject
else
{
$this->error="Error ".$this->db->lasterror();
- $this->db->rollback();
- return -1;
+ $error++;
+ //return -1;
+ }
+
+ if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($this->array_options) && count($this->array_options)>0) // For avoid conflicts if trigger used
+ {
+
+ $result=$this->insertExtraFields();
+ if ($result < 0)
+ {
+ $error++;
+ }
}
+ if (empty($error)) {
if (! $notrigger)
{
// Call trigger
@@ -2472,9 +2542,16 @@ class ContratLigne extends CommonObject
if ($result < 0) { $error++; $this->db->rollback(); return -1; }
// End call triggers
}
+ }
+ if (empty($error)) {
$this->db->commit();
return 1;
+ } else {
+ $this->db->rollback();
+ $this->errors[]=$this->error;
+ return -1;
+ }
}
diff --git a/htdocs/contrat/class/index.html b/htdocs/contrat/class/index.html
deleted file mode 100644
index e69de29bb2d..00000000000
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); ?>
diff --git a/htdocs/core/ajax/ajaxdirtree.php b/htdocs/core/ajax/ajaxdirtree.php
index ae70d1a418a..76fc64b50cf 100644
--- a/htdocs/core/ajax/ajaxdirtree.php
+++ b/htdocs/core/ajax/ajaxdirtree.php
@@ -188,7 +188,7 @@ if (file_exists($fullpathselecteddir))
$userstatic->lastname=isset($val['login_c'])?$val['login_c']:0;
$htmltooltip=''.$langs->trans("ECMSection").' : '.$val['label'].' ';
$htmltooltip=''.$langs->trans("Type").' : '.$langs->trans("ECMSectionManual").' ';
- $htmltooltip.=''.$langs->trans("ECMCreationUser").' : '.$userstatic->getNomUrl(1).' ';
+ $htmltooltip.=''.$langs->trans("ECMCreationUser").' : '.$userstatic->getNomUrl(1, '', false, 1).' ';
$htmltooltip.=''.$langs->trans("ECMCreationDate").' : '.(isset($val['date_c'])?dol_print_date($val['date_c'],"dayhour"):$langs->trans("NeedRefresh")).' ';
$htmltooltip.=''.$langs->trans("Description").' : '.$val['description'].' ';
$htmltooltip.=''.$langs->trans("ECMNbOfFilesInDir").' : '.((isset($val['cachenbofdoc']) && $val['cachenbofdoc'] >= 0)?$val['cachenbofdoc']:$langs->trans("NeedRefresh")).' ';
diff --git a/htdocs/core/boxes/box_actions.php b/htdocs/core/boxes/box_actions.php
index ed5e731d896..2b251a6599f 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,70 +87,66 @@ 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) {
+ $line = 0;
+ while ($line < $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;
- $this->info_box_contents[$i][0] = array(
- 'td' => 'align="left" width="16"',
- 'logo' => ("action"),
- 'tooltip' => $langs->trans('Action'.$objp->code).': '.$label,
- 'url' => DOL_URL_ROOT."/comm/action/card.php?id=".$objp->id,
- );
-
- $this->info_box_contents[$i][1] = array(
+ $tooltip = $langs->trans('Action'.$objp->code).': '.$label;
+ $this->info_box_contents[$line][] = array(
'td' => 'align="left"',
- 'text' => dol_trunc($label,32),
+ 'text' => $actionstatic->getNomUrl(1),
'text2'=> $late,
- 'tooltip' => $langs->trans('Action'.$objp->code).': '.$label,
- 'url' => DOL_URL_ROOT."/comm/action/card.php?id=".$objp->id,
+ 'asis' => 1,
);
- $this->info_box_contents[$i][2] = array(
- 'td' => 'align="left" width="16"',
- 'logo' => ($objp->socid?'company':''),
- 'tooltip' => $langs->trans('Customer').': '.$objp->name,
- 'url' => ($objp->socid?DOL_URL_ROOT."/societe/soc.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,24),
- 'tooltip' => $langs->trans('Customer').': '.$objp->name,
- '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[$line][] = array(
'td' => 'align="left" class="nowrap"',
'text' => dol_print_date($datelimite, "dayhour"),
);
- $this->info_box_contents[$i][5] = array(
+ $this->info_box_contents[$line][] = array(
'td' => 'align="right"',
'text' => ($objp->percentage>= 0?$objp->percentage.'%':''),
);
- $this->info_box_contents[$i][6] = array(
+ $this->info_box_contents[$line][] = array(
'td' => 'align="right" width="18"',
'text' => $actionstatic->LibStatut($objp->percentage,3),
);
- $i++;
+ $line++;
}
- if ($num==0) $this->info_box_contents[$i][0] = array('td' => 'align="center"','text'=>$langs->trans("NoActionsToDo"));
+ if ($num==0)
+ $this->info_box_contents[$line][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 +173,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);
@@ -183,23 +184,23 @@ class box_actions extends ModeleBoxes
{
print 'trans("ActionsToDo").'">';
print '
';
- for ($i=0, $n=$nblines; $i < $n; $i++)
+ for ($line=0, $n=$nblines; $line < $n; $line++)
{
- if (isset($contents[$i]))
+ if (isset($contents[$line]))
{
// on affiche que les évènement du jours ou passé
// qui ne sont pas à 100%
$actioncejour=true;
$var=!$var;
// TR
- $logo=$contents[$i][0]['logo'];
- $label=$contents[$i][1]['text'];
- $urlevent=$contents[$i][1]['url'];
- $logosoc=$contents[$i][2]['logo'];
- $nomsoc=$contents[$i][3]['text'];
- $urlsoc=$contents[$i][3]['url'];
- $dateligne=$contents[$i][4]['text'];
- $percentage=$contents[$i][5]['text'];
+ $logo=$contents[$line][0]['logo'];
+ $label=$contents[$line][1]['text'];
+ $urlevent=$contents[$line][1]['url'];
+ $logosoc=$contents[$line][2]['logo'];
+ $nomsoc=$contents[$line][3]['text'];
+ $urlsoc=$contents[$line][3]['url'];
+ $dateligne=$contents[$line][4]['text'];
+ $percentage=$contents[$line][5]['text'];
print '';
print '';
print img_object("",$logo);
diff --git a/htdocs/core/boxes/box_activity.php b/htdocs/core/boxes/box_activity.php
index 9eaeb1d8cb4..66753f10f04 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
@@ -73,7 +73,7 @@ class box_activity extends ModeleBoxes
$totalMnt = 0;
$totalnb = 0;
- $i = 0;
+ $line = 0;
$cachetime = 3600;
$fileid = '-e'.$conf->entity.'-u'.$user->id.'-s'.$user->societe_id.'-r'.($user->rights->societe->client->voir?'1':'0').'.cache';
$now = dol_now();
@@ -94,8 +94,10 @@ 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;
- $refresh = !file_exists($cachefile) || ($now-$cachetime) > dol_filemtime($cachefile);
+ $cachedir = DOL_DATA_ROOT.'/facture/temp';
+ $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,38 +120,40 @@ 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;
- while ($i < count($data)) {
+ while ($line < count($data)) {
$billurl="viewstatut=2&paye=1&year=".$data[$j]->annee;
- $this->info_box_contents[$i][0] = array(
+ $this->info_box_contents[$line][0] = array(
'td' => 'align="left" width="16"',
'tooltip' => $langs->trans('Bills').' '.$facturestatic->LibStatut(1,$data[$j]->fk_statut,0),
'url' => DOL_URL_ROOT."/compta/facture/list.php?".$billurl."&mainmenu=accountancy&leftmenu=customers_bills",
'logo' => 'bill',
);
- $this->info_box_contents[$i][1] = array(
+ $this->info_box_contents[$line][1] = array(
'td' => 'align="left"',
'text' => $langs->trans("Bills")." ".$facturestatic->LibStatut(1,$data[$j]->fk_statut,0)." ".$data[$j]->annee,
);
- $this->info_box_contents[$i][2] = array(
+ $this->info_box_contents[$line][2] = array(
'td' => 'align="right"',
'tooltip' => $langs->trans('Bills').' '.$facturestatic->LibStatut(1,$data[$j]->fk_statut,0),
'text' => $data[$j]->nb,
'url' => DOL_URL_ROOT."/compta/facture/list.php?".$billurl."&mainmenu=accountancy&leftmenu=customers_bills",
);
- $this->info_box_contents[$i][3] = array(
+ $this->info_box_contents[$line][3] = array(
'td' => 'align="right"',
'text' => price($data[$j]->Mnttot,1,$langs,0,0,-1,$conf->currency)
);
@@ -159,22 +163,24 @@ class box_activity extends ModeleBoxes
$totalnb += $data[$j]->nb;
$totalMnt += $data[$j]->Mnttot;
}
- $this->info_box_contents[$i][4] = array(
+ $this->info_box_contents[$line][4] = array(
'td' => 'align="right" width="18"',
'text' => $facturestatic->LibStatut(1,$data[$j]->fk_statut,3),
);
- $i++;
+ $line++;
$j++;
}
if (count($data)==0)
- $this->info_box_contents[$i][0] = array(
+ $this->info_box_contents[$line][0] = array(
'td' => 'align="center"',
'text'=>$langs->trans("NoRecordedInvoices"),
);
}
- $cachefile = DOL_DATA_ROOT.'/facture/temp/boxactivity-invoice2'.$fileid;
- $refresh = !file_exists($cachefile) || ($now-$cachetime) > dol_filemtime($cachefile);
+ $cachedir = DOL_DATA_ROOT.'/facture/temp';
+ $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";
@@ -187,58 +193,60 @@ class box_activity extends ModeleBoxes
$result = $db->query($sql);
if ($result) {
- $num = $db->num_rows($result) + $i;
+ $num = $db->num_rows($result) + $line;
$j=0;
while ($j < $num) {
$data[$j]=$db->fetch_object($result);
$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;
- while ($i < count($data)) {
+ while ($line < count($data)) {
$billurl="viewstatut=".$data[$j]->fk_statut."&paye=0";
- $this->info_box_contents[$i][0] = array(
+ $this->info_box_contents[$line][0] = array(
'td' => 'align="left" width="16"',
'tooltip' => $langs->trans('Bills').' '.$facturestatic->LibStatut(0,$data[$j]->fk_statut,0),
'url' => DOL_URL_ROOT."/compta/facture/list.php?".$billurl."&mainmenu=accountancy&leftmenu=customers_bills",
'logo' => 'bill',
);
- $this->info_box_contents[$i][1] = array(
+ $this->info_box_contents[$line][1] = array(
'td' => 'align="left"',
'text' => $langs->trans("Bills")." ".$facturestatic->LibStatut(0,$data[$j]->fk_statut,0),
);
- $this->info_box_contents[$i][2] = array(
+ $this->info_box_contents[$line][2] = array(
'td' => 'align="right"',
'text' => $data[$j]->nb,
'tooltip' => $langs->trans('Bills').' '.$facturestatic->LibStatut(0,$data[$j]->fk_statut,0),
'url' => DOL_URL_ROOT."/compta/facture/list.php?".$billurl."&mainmenu=accountancy&leftmenu=customers_bills",
);
$totalnb += $data[$j]->nb;
- $this->info_box_contents[$i][3] = array(
+ $this->info_box_contents[$line][3] = array(
'td' => 'align="right"',
'text' => price($data[$j]->Mnttot,1,$langs,0,0,-1,$conf->currency),
);
$totalMnt += $objp->Mnttot;
- $this->info_box_contents[$i][4] = array(
+ $this->info_box_contents[$line][4] = array(
'td' => 'align="right" width="18"',
'text' => $facturestatic->LibStatut(0,$data[$j]->fk_statut,3),
);
- $i++;
+ $line++;
$j++;
}
if ($num==0)
- $this->info_box_contents[$i][0] = array(
+ $this->info_box_contents[$line][0] = array(
'td' => 'align="center"',
'text'=>$langs->trans("NoRecordedInvoices"),
);
@@ -255,9 +263,11 @@ 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;
- $refresh = !file_exists($cachefile) || ($now-$cachetime) > dol_filemtime($cachefile);
+ $cachedir = DOL_DATA_ROOT.'/commande/temp';
+ $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";
@@ -276,36 +286,38 @@ class box_activity extends ModeleBoxes
$result = $db->query($sql);
if ($result) {
- $num = $db->num_rows($result) + $i;
+ $num = $db->num_rows($result) + $line;
$j=0;
while ($j < $num) {
$data[$j]=$db->fetch_object($result);
$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;
- while ($i < count($data)) {
- $this->info_box_contents[$i][0] = array(
+ while ($line < count($data)) {
+ $this->info_box_contents[$line][0] = array(
'td' => 'align="left" width="16"',
'url' => DOL_URL_ROOT."/commande/list.php?mainmenu=commercial&leftmenu=orders&viewstatut=".$data[$j]->fk_statut,
'tooltip' => $langs->trans("Orders")." ".$commandestatic->LibStatut($data[$j]->fk_statut,0,0),
'logo' => 'object_order',
);
- $this->info_box_contents[$i][1] = array(
+ $this->info_box_contents[$line][1] = array(
'td' => 'align="left"',
'text' =>$langs->trans("Orders")." ".$commandestatic->LibStatut($data[$j]->fk_statut,0,0),
);
- $this->info_box_contents[$i][2] = array(
+ $this->info_box_contents[$line][2] = array(
'td' => 'align="right"',
'text' => $data[$j]->nb,
'tooltip' => $langs->trans("Orders")." ".$commandestatic->LibStatut($data[$j]->fk_statut,0,0),
@@ -313,17 +325,17 @@ class box_activity extends ModeleBoxes
);
$totalnb += $data[$j]->nb;
- $this->info_box_contents[$i][3] = array(
+ $this->info_box_contents[$line][3] = array(
'td' => 'align="right"',
'text' => price($data[$j]->Mnttot,1,$langs,0,0,-1,$conf->currency),
);
$totalMnt += $data[$j]->Mnttot;
- $this->info_box_contents[$i][4] = array(
+ $this->info_box_contents[$line][4] = array(
'td' => 'align="right" width="18"',
'text' => $commandestatic->LibStatut($data[$j]->fk_statut,0,3),
);
- $i++;
+ $line++;
$j++;
}
}
@@ -334,8 +346,9 @@ 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;
- $refresh = !file_exists($cachefile) || ($now-$cachetime) > dol_filemtime($cachefile);
+ $cachedir = DOL_DATA_ROOT.'/propale/temp';
+ $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";
@@ -354,24 +367,26 @@ class box_activity extends ModeleBoxes
$result = $db->query($sql);
if ($result) {
- $num = $db->num_rows($result) + $i;
+ $num = $db->num_rows($result) + $line;
$j=0;
while ($j < $num) {
$data[$j]=$db->fetch_object($result);
$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;
- while ($i < count($data)) {
- $this->info_box_contents[$i][0] = array(
+ while ($line < count($data)) {
+ $this->info_box_contents[$line][] = array(
'td' => 'align="left" width="16"',
'url' => DOL_URL_ROOT."/comm/propal/list.php?mainmenu=commercial&leftmenu=propals&viewstatut=".$data[$j]->fk_statut,
'tooltip' => $langs->trans("Proposals")." ".$propalstatic->LibStatut($data[$j]->fk_statut,0),
@@ -379,12 +394,12 @@ class box_activity extends ModeleBoxes
);
$objp = $db->fetch_object($result);
- $this->info_box_contents[$i][1] = array(
+ $this->info_box_contents[$line][] = array(
'td' => 'align="left"',
'text' => $langs->trans("Proposals")." ".$propalstatic->LibStatut($data[$j]->fk_statut,0),
);
- $this->info_box_contents[$i][2] = array(
+ $this->info_box_contents[$line][] = array(
'td' => 'align="right"',
'text' => $data[$j]->nb,
'tooltip' => $langs->trans("Proposals")." ".$propalstatic->LibStatut($data[$j]->fk_statut,0),
@@ -392,40 +407,40 @@ class box_activity extends ModeleBoxes
);
$totalnb += $data[$j]->nb;
- $this->info_box_contents[$i][3] = array(
+ $this->info_box_contents[$line][] = array(
'td' => 'align="right"',
'text' => price($data[$j]->Mnttot,1,$langs,0,0,-1,$conf->currency),
);
$totalMnt += $data[$j]->Mnttot;
- $this->info_box_contents[$i][4] = array(
+ $this->info_box_contents[$line][] = array(
'td' => 'align="right" width="18"',
'text' => $propalstatic->LibStatut($data[$j]->fk_statut,3),
);
- $i++;
+ $line++;
$j++;
}
}
}
// Add the sum in the bottom of the boxes
- $this->info_box_contents[$i][1] = array(
+ $this->info_box_contents[$line][1] = array(
'td' => 'align="left" ',
'text' => $langs->trans("Total")." ".$textHead,
);
- $this->info_box_contents[$i][2] = array(
+ $this->info_box_contents[$line][2] = array(
'td' => 'align="right" ',
'text' => $totalnb,
);
- $this->info_box_contents[$i][3] = array(
+ $this->info_box_contents[$line][3] = array(
'td' => 'align="right" ',
'text' => price($totalMnt,1,$langs,0,0,-1,$conf->currency)
);
- $this->info_box_contents[$i][4] = array(
+ $this->info_box_contents[$line][4] = array(
'td' => 'align="right" ',
'text' => "",
);
- $this->info_box_contents[$i][5] = array(
+ $this->info_box_contents[$line][5] = array(
'td' => 'align="right"',
'text' => "",
);
diff --git a/htdocs/core/boxes/box_bookmarks.php b/htdocs/core/boxes/box_bookmarks.php
index 5250108f76c..88adb744ceb 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
@@ -80,19 +81,19 @@ class box_bookmarks extends ModeleBoxes
{
$num = $db->num_rows($result);
- $i = 0;
+ $line = 0;
- while ($i < $num) {
+ while ($line < $num) {
$objp = $db->fetch_object($result);
- $this->info_box_contents[$i][0] = array(
+ $this->info_box_contents[$line][0] = array(
'td' => 'align="left" width="16"',
'logo' => $this->boximg,
'url' => $objp->url,
'tooltip' => $objp->title,
'target' => $objp->target?'newtab':'',
);
- $this->info_box_contents[$i][1] = array(
+ $this->info_box_contents[$line][1] = array(
'td' => 'align="left"',
'text' => $objp->title,
'url' => $objp->url,
@@ -100,13 +101,13 @@ class box_bookmarks extends ModeleBoxes
'target' => $objp->target?'newtab':'',
);
- $i++;
+ $line++;
}
if ($num==0) {
$mytxt=$langs->trans("NoRecordedBookmarks");
if ($user->rights->bookmark->creer) $mytxt.=' '.$langs->trans("ClickToAdd");
- $this->info_box_contents[$i][0] = array(
+ $this->info_box_contents[$line][0] = array(
'td' => 'align="center" colspan="2"',
'tooltip' => $mytxt,
'url'=> DOL_URL_ROOT.'/bookmarks/list.php', 'text'=>$mytxt,
diff --git a/htdocs/core/boxes/box_clients.php b/htdocs/core/boxes/box_clients.php
index 01e0dc92635..2cd5922d784 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)";
@@ -97,40 +104,40 @@ class box_clients extends ModeleBoxes
if (empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) $url= DOL_URL_ROOT."/comm/card.php?socid=";
else $url= DOL_URL_ROOT."/societe/soc.php?socid=";
- $i = 0;
- while ($i < $num)
+ $line = 0;
+ while ($line < $num)
{
$objp = $db->fetch_object($result);
$datec=$db->jdate($objp->datec);
$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[$line][] = 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[$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' => $thirdpartystatic->LibStatut($objp->status,3)
);
- $i++;
+ $line++;
}
- if ($num==0) $this->info_box_contents[$i][0] = array('td' => 'align="center"','text'=>$langs->trans("NoRecordedCustomers"));
+ if ($num==0) $this->info_box_contents[$line][0] = array('td' => 'align="center"','text'=>$langs->trans("NoRecordedCustomers"));
$db->free($result);
}
diff --git a/htdocs/core/boxes/box_commandes.php b/htdocs/core/boxes/box_commandes.php
index 670a5358d20..53e3aaf2861 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";
@@ -83,68 +97,63 @@ class box_commandes extends ModeleBoxes
if ($result) {
$num = $db->num_rows($result);
- $i = 0;
+ $line = 0;
- while ($i < $num) {
+ while ($line < $num) {
$objp = $db->fetch_object($result);
$date=$db->jdate($objp->date_commande);
$datem=$db->jdate($objp->tms);
+ $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,
- );
-
- $this->info_box_contents[$i][] = array(
+ $this->info_box_contents[$line][] = 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,
+ 'text' => $commandestatic->getNomUrl(1),
+ 'asis' => 1,
);
- $this->info_box_contents[$i][] = array(
+ $this->info_box_contents[$line][] = 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(
+ $this->info_box_contents[$line][] = array(
'td' => 'align="right"',
'text' => price($objp->total_ht),
);
if (! empty($conf->global->ORDER_BOX_LAST_ORDERS_SHOW_VALIDATE_USER)) {
if ($objp->fk_user_valid > 0) $userstatic->fetch($objp->fk_user_valid);
- $this->info_box_contents[$i][] = array(
+ $this->info_box_contents[$line][] = array(
'td' => 'align="right"',
'text' => (($objp->fk_user_valid > 0)?$userstatic->getNomUrl(1):''),
- 'url' => (($objp->fk_user_valid > 0)?DOL_URL_ROOT.'/user/card.php?id='.$objp->fk_user_valid:''),
+ 'asis' => 1,
);
}
- $this->info_box_contents[$i][] = array(
+ $this->info_box_contents[$line][] = array(
'td' => 'align="right"',
'text' => dol_print_date($date,'day'),
);
- $this->info_box_contents[$i][] = array(
+ $this->info_box_contents[$line][] = array(
'td' => 'align="right" width="18"',
'text' => $commandestatic->LibStatut($objp->fk_statut,$objp->facture,3),
);
- $i++;
+ $line++;
}
- if ($num==0) $this->info_box_contents[$i][0] = array('td' => 'align="center"','text'=>$langs->trans("NoRecordedOrders"));
+ if ($num==0) $this->info_box_contents[$line][0] = array('td' => 'align="center"','text'=>$langs->trans("NoRecordedOrders"));
$db->free($result);
} else {
diff --git a/htdocs/core/boxes/box_comptes.php b/htdocs/core/boxes/box_comptes.php
index 5340b06f0dd..178851466be 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
@@ -94,66 +95,56 @@ class box_comptes extends ModeleBoxes
if ($result) {
$num = $db->num_rows($result);
- $i = 0;
+ $line = 0;
$solde_total = array();
$account_static = new Account($db);
- while ($i < $num) {
+ while ($line < $num) {
$objp = $db->fetch_object($result);
$account_static->id = $objp->rowid;
+ $account_static->label = $objp->label;
+ $account_static->number = $objp->number;
$solde=$account_static->solde(0);
$solde_total[$objp->currency_code] += $solde;
- $this->info_box_contents[$i][0] = array(
- 'td' => 'align="left" width="16"',
- 'logo' => $this->boximg,
- 'tooltip' => $langs->trans('Account').': '.$objp->label,
- 'url' => DOL_URL_ROOT."/compta/bank/account.php?account=".$objp->rowid,
- );
-
- $this->info_box_contents[$i][1] = array(
+ $this->info_box_contents[$line][] = array(
'td' => 'align="left"',
- 'text' => $objp->label,
- 'tooltip' => $langs->trans('Account').': '.$objp->label,
- '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[$line][] = array(
'td' => 'align="left"',
'text' => $objp->number,
);
- $this->info_box_contents[$i][3] = array(
+ $this->info_box_contents[$line][] = 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++;
+ $line++;
}
// Total
foreach ($solde_total as $key=>$solde) {
- $this->info_box_contents[$i][0] = array(
+ $this->info_box_contents[$line][] = 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[$line][] = array(
'td' => 'align="right" class="liste_total"',
'text' => ' '
);
- $totalamount=price($solde,0,$langs,0,0,-1,$key);
- $this->info_box_contents[$i][3] = array(
+
+ $this->info_box_contents[$line][] = array(
'td' => 'align="right" class="liste_total"',
- 'text' => $totalamount
+ 'text' => price($solde, 0, $langs, 0, -1, -1, $key)
);
- $i++;
+ $line++;
}
$db->free($result);
diff --git a/htdocs/core/boxes/box_contacts.php b/htdocs/core/boxes/box_contacts.php
index 8ec8bf77b9c..fdd5f725883 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
@@ -61,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);
@@ -79,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);
@@ -89,47 +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][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[$line][] = 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[$line][] = 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[$line][] = array(
'td' => 'align="right"',
'text' => dol_print_date($datem, "day"),
);
- $i++;
+ $line++;
}
if ($num==0)
- $this->info_box_contents[$i][0] = array(
+ $this->info_box_contents[$line][0] = array(
'td' => 'align="center"',
'text'=>$langs->trans("NoRecordedContacts"),
);
diff --git a/htdocs/core/boxes/box_contracts.php b/htdocs/core/boxes/box_contracts.php
index c980be624da..58b5dc7f1fa 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
@@ -77,9 +78,9 @@ class box_contracts extends ModeleBoxes
$num = $db->num_rows($resql);
$now=dol_now();
- $i = 0;
+ $line = 0;
- while ($i < $num) {
+ while ($line < $num) {
$objp = $db->fetch_object($resql);
$datec=$db->jdate($objp->datec);
$dateterm=$db->jdate($objp->fin_validite);
@@ -93,14 +94,14 @@ class box_contracts extends ModeleBoxes
// fin_validite is no more on contract but on services
// if ($objp->fk_statut == 1 && $dateterm < ($now - $conf->contrat->cloture->warning_delay)) { $late = img_warning($langs->trans("Late")); }
- $this->info_box_contents[$i][0] = array(
+ $this->info_box_contents[$line][] = array(
'td' => 'align="left" width="16"',
'logo' => $this->boximg,
'tooltip' => $langs->trans('Contract').': '.($objp->ref?$objp->ref:$objp->rowid),
'url' => DOL_URL_ROOT."/contrat/card.php?id=".$objp->rowid,
);
- $this->info_box_contents[$i][1] = array(
+ $this->info_box_contents[$line][] = array(
'td' => 'align="left"',
'text' => ($objp->ref?$objp->ref:$objp->rowid), // Some contracts have no ref
'tooltip' => $langs->trans('Contract').': '.($objp->ref?$objp->ref:$objp->rowid),
@@ -108,36 +109,36 @@ class box_contracts extends ModeleBoxes
'url' => DOL_URL_ROOT."/contrat/card.php?id=".$objp->rowid,
);
- $this->info_box_contents[$i][2] = array(
+ $this->info_box_contents[$line][] = array(
'td' => 'align="left" width="16"',
'logo' => 'company',
'tooltip' => $langs->trans('Customer').': '.$objp->name,
'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid,
);
- $this->info_box_contents[$i][3] = array(
+ $this->info_box_contents[$line][] = array(
'td' => 'align="left"',
'text' => dol_trunc($objp->name,40),
'tooltip' => $langs->trans('Customer').': '.$objp->name,
'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid,
);
- $this->info_box_contents[$i][4] = array(
+ $this->info_box_contents[$line][] = array(
'td' => 'align="right"',
'text' => dol_print_date($datec,'day'),
);
- $this->info_box_contents[$i][5] = array(
+ $this->info_box_contents[$line][] = array(
'td' => 'align="right" class="nowrap"',
'text' => $contractstatic->getLibStatut(6),
'asis'=>1,
);
- $i++;
+ $line++;
}
if ($num==0)
- $this->info_box_contents[$i][0] = array(
+ $this->info_box_contents[$line][0] = array(
'td' => 'align="center"',
'text'=>$langs->trans("NoRecordedContracts"),
);
diff --git a/htdocs/core/boxes/box_external_rss.php b/htdocs/core/boxes/box_external_rss.php
index 689efc751c6..f1db35e1614 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
@@ -108,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'];
@@ -138,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_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 aa217f1c436..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
@@ -17,9 +18,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 +30,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 +94,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_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 f233221ccaa..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
@@ -84,36 +85,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_members.php b/htdocs/core/boxes/box_members.php
index 4760a3aaf89..f871226b4e9 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
@@ -95,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);
@@ -104,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;
@@ -113,39 +115,53 @@ 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[$line][] = array(
+ 'td' => 'align="left"',
+ 'text' => $memberstatic->getNomUrl(1),
+ 'asis' => 1,
+ );
- $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[$line][] = array(
+ 'td' => 'align="left"',
+ 'text' => $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[$line][] = 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[$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('td' => 'align="center"','text'=>$langs->trans("NoRecordedCustomers"));
+ if ($num==0)
+ $this->info_box_contents[$line][0] = array(
+ 'td' => 'align="center"',
+ 'text'=>$langs->trans("NoRecordedCustomers"),
+ );
- $db->free($result);
- }
- 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..509502183af 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
@@ -63,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";
+ $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';
@@ -75,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);
@@ -98,58 +99,92 @@ 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'),
- '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);
+ $this->info_box_contents[$line][] = array(
+ 'td' => 'align="left"',
+ 'text' => $objp->label,
+ );
- 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[$i][2] = array('td' => 'align="right"',
- 'text' => $price);
+ 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
+ {
+ $productstatic->fetch($objp->rowid, '', '', 1);
+ $priceparser = new PriceParser($this->db);
+ $price_result = $priceparser->parseProduct($productstatic);
+ if ($price_result >= 0) {
+ if ($objp->price_base_type == 'HT')
+ {
+ $price_base_type=$langs->trans("HT");
+ }
+ else
+ {
+ $price_result = $price_result * (1 + ($productstatic->tva_tx / 100));
+ $price_base_type=$langs->trans("TTC");
+ }
+ $price=price($price_result);
+ }
+ }
+ $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++;
- }
- if ($num==0) $this->info_box_contents[$i][0] = array('td' => 'align="center"','text'=>$langs->trans("NoRecordedProducts"));
+ $line++;
+ }
+ if ($num==0)
+ $this->info_box_contents[$line][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/box_produits_alerte_stock.php b/htdocs/core/boxes/box_produits_alerte_stock.php
index 1079f623492..8096dfdec10 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
@@ -64,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";
@@ -82,9 +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,57 +105,90 @@ 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;
- $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[$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);
+ $this->info_box_contents[$line][] = array(
+ 'td' => 'align="left"',
+ 'text' => $objp->label,
+ );
- 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[$i][2] = array('td' => 'align="right"',
- 'text' => $price);
+ 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
+ {
+ $productstatic->fetch($objp->rowid, '', '', 1);
+ $priceparser = new PriceParser($this->db);
+ $price_result = $priceparser->parseProduct($productstatic);
+ if ($price_result >= 0) {
+ if ($objp->price_base_type == 'HT')
+ {
+ $price_base_type=$langs->trans("HT");
+ }
+ else
+ {
+ $price_result = $price_result * (1 + ($productstatic->tva_tx / 100));
+ $price_base_type=$langs->trans("TTC");
+ }
+ $price=price($price_result);
+ }
+ }
- $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++;
- }
- if ($num==0) $this->info_box_contents[$i][0] = array('td' => 'align="center"','text'=>$langs->trans("NoTooLowStockProducts"));
+ $line++;
+ }
+ if ($num==0)
+ $this->info_box_contents[$line][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 {
- $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_project.php b/htdocs/core/boxes/box_project.php
index ef38a2537e6..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
@@ -90,21 +92,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 +119,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 +143,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..4e8b47aa0d4 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
@@ -56,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));
+ $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";
@@ -81,68 +84,81 @@ 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"));
}
- $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);
+ $this->info_box_contents[$line][] = array(
+ 'td' => 'align="left"',
+ 'text' => $propalstatic->getNomUrl(1),
+ 'text2'=> $late,
+ 'asis' => 1,
+ );
- $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[$line][] = array(
+ 'td' => 'align="left"',
+ 'text' => $societestatic->getNomUrl(1,'',40),
+ '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[$line][] = array(
+ 'td' => 'align="right"',
+ 'text' => price($objp->total_ht),
+ );
- $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[$line][] = array(
+ 'td' => 'align="right"',
+ 'text' => dol_print_date($date,'day'),
+ );
- $this->info_box_contents[$i][4] = array('td' => 'align="right"',
- 'text' => price($objp->total_ht),
- );
+ $this->info_box_contents[$line][] = array(
+ 'td' => 'align="right" width="18"',
+ 'text' => $propalstatic->LibStatut($objp->fk_statut,3),
+ );
- $this->info_box_contents[$i][5] = array('td' => 'align="right"',
- 'text' => dol_print_date($date,'day'));
+ $line++;
+ }
- $this->info_box_contents[$i][6] = array('td' => 'align="right" width="18"',
- 'text' => $propalstatic->LibStatut($objp->fk_statut,3));
+ if ($num==0)
+ $this->info_box_contents[$line][0] = array(
+ 'td' => 'align="center"',
+ 'text'=>$langs->trans("NoRecordedProposals"),
+ );
- $i++;
- }
-
- 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..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
@@ -104,41 +105,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..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
@@ -82,8 +83,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 +91,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/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 aed954fea97..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
@@ -178,153 +179,173 @@ 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 = array();
$bcx[0] = 'class="box_pair"';
$bcx[1] = 'class="box_impair"';
$var = false;
- dol_syslog(get_class($this).'::showBox');
+ $cachetime = 900; // 900 : 15mn
+ $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);
+ $out = '';
- // Define nbcol and nblines of the box to show
- $nbcol=0;
- if (isset($contents[0])) $nbcol=count($contents[0]);
- $nblines=count($contents);
+ if ($refresh) {
+ dol_syslog(get_class($this).'::showBox');
- print "\n\n\n";
- print ''."\n";
+ // Define nbcol and nblines of the box to show
+ $nbcol=0;
+ if (isset($contents[0])) $nbcol=count($contents[0]);
+ $nblines=count($contents);
- if (! empty($head['text']) || ! empty($head['sublink']) || ! empty($head['subpicto']) || $nblines)
- {
- print '
'."\n";
- }
+ $out.= "\n\n";
+ $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 '';
- }
- print ' ';
- print " \n";
- //print "
\n";
- //print "
\n";
- }
+ if (! empty($head['text']) || ! empty($head['sublink']) || ! empty($head['subpicto']) || $nblines)
+ {
+ $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 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.= '';
+ }
+ $out.= ' ';
+ $out.= " \n";
+ //$out.= "
\n";
+ //$out.= "
\n";
+ }
- // TR
- if (isset($contents[$i][0]['tr'])) print '';
- else print ' ';
+ // 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;
- // 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'];
+ // TR
+ if (isset($contents[$i][0]['tr'])) $out.= '';
+ else $out.= ' ';
- 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']:'';
+ // 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'];
- print ''."\n";
+ 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']:'';
- // 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 '>';
- }
+ $out.= ' '."\n";
- // 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"');
- }
+ // 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.= '>';
+ }
- $maxlength=$MAXLENGTHBOX;
- if (! empty($contents[$i][$j]['maxlength'])) $maxlength=$contents[$i][$j]['maxlength'];
+ // 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"');
+ }
- if ($maxlength) $textwithnotags=dol_trunc($textwithnotags,$maxlength);
- if (preg_match('/^ ';
+ if ($maxlength) $textwithnotags=dol_trunc($textwithnotags,$maxlength);
+ if (preg_match('/^ ';
- if (! empty($textnoformat)) print "\n".$textnoformat."\n";
+ if (preg_match('/^ \n";
- }
+ if (! empty($textnoformat)) $out.= "\n".$textnoformat."\n";
- print " \n";
- }
- }
- }
+ $out.= "\n";
+ }
- if (! empty($head['text']) || ! empty($head['sublink']) || ! empty($head['subpicto']) || $nblines)
- {
- print "
\n";
- }
+ $out.= " \n";
+ }
+ }
+ }
- // If invisible box with no contents
- 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";
+ }
- print "\n";
- print "\n\n";
- }
+ // If invisible box with no contents
+ if (empty($head['text']) && empty($head['sublink']) && empty($head['subpicto']) && ! $nblines) $out.= " \n";
+
+ $out.= "\n";
+ $out.= "\n\n";
+ if (! empty($conf->global->MAIN_ACTIVATE_FILECACHE)) {
+ dol_filecache($cachedir, $filename, $out);
+ }
+ } else {
+ dol_syslog(get_class($this).'::showBoxCached');
+ $out = dol_readcachefile($cachedir, $filename);
+ print "";
+
+ }
+ print $out;
+ }
}
diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index dc39692f08e..79f509225f6 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -737,7 +737,8 @@ abstract class CommonObject
$project = new Project($this->db);
$result = $project->fetch($this->fk_project);
- $this->projet = $project;
+ $this->projet = $project; // deprecated
+ $this->project = $project;
return $result;
}
@@ -2691,6 +2692,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/class/html.form.class.php b/htdocs/core/class/html.form.class.php
old mode 100755
new mode 100644
index 97039adea57..fdb02e041fc
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -832,8 +832,9 @@ class Form
if ($conf->use_javascript_ajax && ! $forcecombo)
{
include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
- $out.= ajax_combobox($htmlname, $events, $conf->global->COMPANY_USE_SEARCH_TO_SELECT);
- $nodatarole=' data-role="none"';
+ $comboenhancement =ajax_combobox($htmlname, $events, $conf->global->COMPANY_USE_SEARCH_TO_SELECT);
+ $out.= $comboenhancement;
+ $nodatarole=($comboenhancement?' data-role="none"':'');
}
// Construct $out and $outarray
@@ -1037,8 +1038,9 @@ class Form
if ($conf->use_javascript_ajax && ! $forcecombo && ! $options_only)
{
include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
- $out.= ajax_combobox($htmlname, $events, $conf->global->CONTACT_USE_SEARCH_TO_SELECT);
- $nodatarole=' data-role="none"';
+ $comboenhancement = ajax_combobox($htmlname, $events, $conf->global->CONTACT_USE_SEARCH_TO_SELECT);
+ $out.= $comboenhancement;
+ $nodatarole=($comboenhancement?' data-role="none"':'');
}
if ($htmlname != 'none' || $options_only) $out.= '';
@@ -1227,12 +1229,13 @@ class Form
{
// Enhance with select2
$nodatarole='';
- /*if ($conf->use_javascript_ajax)
+ if ($conf->use_javascript_ajax)
{
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
- $out.= ajax_combobox($htmlname);
- $nodatarole=' data-role="none"';
- }*/
+ include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
+ $comboenhancement = ajax_combobox($htmlname);
+ $out.=$comboenhancement;
+ $nodatarole=($comboenhancement?' data-role="none"':'');
+ }
$out.= '';
if ($show_empty) $out.= ' '."\n";
@@ -1466,7 +1469,7 @@ class Form
$outarray=array();
$sql = "SELECT ";
- $sql.= " p.rowid, p.label, p.ref, p.description, p.fk_product_type, p.price, p.price_ttc, p.price_base_type, p.tva_tx, p.duration, p.stock";
+ $sql.= " p.rowid, p.label, p.ref, p.description, p.fk_product_type, p.price, p.price_ttc, p.price_base_type, p.tva_tx, p.duration, p.stock, p.fk_price_expression";
//Price by customer
if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES) && !empty($socid)) {
@@ -1545,6 +1548,8 @@ class Form
$result=$this->db->query($sql);
if ($result)
{
+ require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
+ require_once DOL_DOCUMENT_ROOT.'/product/class/priceparser.class.php';
$num = $this->db->num_rows($result);
$out.='';
@@ -1594,6 +1599,19 @@ class Form
}
else
{
+ if (!empty($objp->fk_price_expression)) {
+ $price_product = new Product($this->db);
+ $price_product->fetch($objp->rowid, '', '', 1);
+ $priceparser = new PriceParser($this->db);
+ $price_result = $priceparser->parseProduct($price_product);
+ if ($price_result >= 0) {
+ $objp->price = $price_result;
+ $objp->unitprice = $price_result;
+ //Calculate the VAT
+ $objp->price_ttc = price2num($objp->price) * (1 + ($objp->tva_tx / 100));
+ $objp->price_ttc = price2num($objp->price_ttc,'MU');
+ }
+ }
$this->constructProductListOption($objp, $opt, $optJson, $price_level, $selected);
// Add new entry
// "key" value of json key array is used by jQuery automatically as selected value
@@ -1875,7 +1893,7 @@ class Form
$sql = "SELECT p.rowid, p.label, p.ref, p.price, p.duration,";
$sql.= " pfp.ref_fourn, pfp.rowid as idprodfournprice, pfp.price as fprice, pfp.quantity, pfp.remise_percent, pfp.remise, pfp.unitprice,";
- $sql.= " pfp.fk_price_expression, pfp.fk_product, pfp.tva_tx, s.nom as name";
+ $sql.= " pfp.fk_supplier_price_expression, pfp.fk_product, pfp.tva_tx, s.nom as name";
$sql.= " FROM ".MAIN_DB_PREFIX."product as p";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON p.rowid = pfp.fk_product";
if ($socid) $sql.= " AND pfp.fk_soc = ".$socid;
@@ -1957,9 +1975,9 @@ class Form
{
$outqty=$objp->quantity;
$outdiscount=$objp->remise_percent;
- if (!empty($objp->fk_price_expression)) {
+ if (!empty($objp->fk_supplier_price_expression)) {
$priceparser = new PriceParser($this->db);
- $price_result = $priceparser->parseProductSupplier($objp->fk_product, $objp->fk_price_expression, $objp->quantity, $objp->tva_tx);
+ $price_result = $priceparser->parseProductSupplier($objp->fk_product, $objp->fk_supplier_price_expression, $objp->quantity, $objp->tva_tx);
if ($price_result >= 0) {
$objp->fprice = $price_result;
if ($objp->quantity >= 1)
@@ -2056,7 +2074,7 @@ class Form
$sql = "SELECT p.rowid, p.label, p.ref, p.price, p.duration,";
$sql.= " pfp.ref_fourn, pfp.rowid as idprodfournprice, pfp.price as fprice, pfp.quantity, pfp.unitprice,";
- $sql.= " pfp.fk_price_expression, pfp.fk_product, pfp.tva_tx, s.nom as name";
+ $sql.= " pfp.fk_supplier_price_expression, pfp.fk_product, pfp.tva_tx, s.nom as name";
$sql.= " FROM ".MAIN_DB_PREFIX."product as p";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON p.rowid = pfp.fk_product";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON pfp.fk_soc = s.rowid";
@@ -2096,9 +2114,9 @@ class Form
}
$opt.= '>'.$objp->name.' - '.$objp->ref_fourn.' - ';
- if (!empty($objp->fk_price_expression)) {
+ if (!empty($objp->fk_supplier_price_expression)) {
$priceparser = new PriceParser($this->db);
- $price_result = $priceparser->parseProductSupplier($objp->fk_product, $objp->fk_price_expression, $objp->quantity, $objp->tva_tx);
+ $price_result = $priceparser->parseProductSupplier($objp->fk_product, $objp->fk_supplier_price_expression, $objp->quantity, $objp->tva_tx);
if ($price_result >= 0) {
$objp->fprice = $price_result;
if ($objp->quantity >= 1)
@@ -4273,7 +4291,7 @@ class Form
// Try also magic suggest
- // Add data-role="none" to diable jmobile decoration
+ // Add data-role="none" to disable jmobile decoration
$out = ''."\n";
if (is_array($array) && ! empty($array))
{
@@ -4488,7 +4506,7 @@ class Form
* @param int $width Width of photo
* @return string HTML code to output photo
*/
- function showphoto($modulepart,$object,$width=100)
+ static function showphoto($modulepart,$object,$width=100)
{
global $conf;
@@ -4613,8 +4631,9 @@ class Form
if ($conf->use_javascript_ajax)
{
include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
- $out.= ajax_combobox($htmlname);
- $nodatarole=' data-role="none"';
+ $comboenhancement = ajax_combobox($htmlname);
+ $out.= $comboenhancement;
+ $nodatarole=($comboenhancement?' data-role="none"':'');
}
$out.= '';
diff --git a/htdocs/core/class/html.formother.class.php b/htdocs/core/class/html.formother.class.php
index 68a7b677667..5bb491adf89 100644
--- a/htdocs/core/class/html.formother.class.php
+++ b/htdocs/core/class/html.formother.class.php
@@ -324,8 +324,9 @@ class FormOther
if ($conf->use_javascript_ajax)
{
include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
- $moreforfilter.= ajax_combobox('select_categ_'.$htmlname);
- $nodatarole=' data-role="none"';
+ $comboenhancement = ajax_combobox('select_categ_'.$htmlname);
+ $moreforfilter.=$comboenhancement;
+ $nodatarole=($comboenhancement?' data-role="none"':'');
}
// Print a select with each of them
@@ -373,8 +374,9 @@ class FormOther
if ($conf->use_javascript_ajax)
{
include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
- $out.= ajax_combobox($htmlname);
- $nodatarole=' data-role="none"';
+ $comboenhancement = ajax_combobox($htmlname);
+ $out.=$comboenhancement;
+ $nodatarole=($comboenhancement?' data-role="none"':'');
}
// Select each sales and print them in a select input
$out.='';
diff --git a/htdocs/core/class/html.formprojet.class.php b/htdocs/core/class/html.formprojet.class.php
index aba8abf78a3..e1487818438 100644
--- a/htdocs/core/class/html.formprojet.class.php
+++ b/htdocs/core/class/html.formprojet.class.php
@@ -91,8 +91,9 @@ class FormProjets
if (! empty($conf->use_javascript_ajax))
{
include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
- $out.= ajax_combobox($htmlname, '', 0, $forcefocus);
- $nodatarole=' data-role="none"';
+ $comboenhancement = ajax_combobox($htmlname, '', 0, $forcefocus);
+ $out.=$comboenhancement;
+ $nodatarole=($comboenhancement?' data-role="none"':'');
}
if (empty($option_only)) {
diff --git a/htdocs/core/class/ldap.class.php b/htdocs/core/class/ldap.class.php
index 95436a51e29..dc844ee3f02 100644
--- a/htdocs/core/class/ldap.class.php
+++ b/htdocs/core/class/ldap.class.php
@@ -176,7 +176,10 @@ class Ldap
if (is_resource($this->connection))
{
+ // Execute the ldap_set_option here (after connect and before bind)
$this->setVersion();
+ ldap_set_option($this->connection, LDAP_OPT_SIZELIMIT, 0); // no limit here. should return true.
+
if ($this->serverType == "activedirectory")
{
diff --git a/htdocs/core/class/rssparser.class.php b/htdocs/core/class/rssparser.class.php
index 5a156b1eda7..349b32d5104 100644
--- a/htdocs/core/class/rssparser.class.php
+++ b/htdocs/core/class/rssparser.class.php
@@ -550,7 +550,7 @@ class RssParser
//
elseif ($this->_format == 'atom' and $el == 'link' )
{
- if ( isset($attrs['rel']) and $attrs['rel'] == 'alternate' )
+ if ( isset($attrs['rel']) && $attrs['rel'] == 'alternate' )
{
$link_el = 'link';
}
diff --git a/htdocs/core/datepicker.php b/htdocs/core/datepicker.php
index 9c584c2ef6e..efa7b753101 100644
--- a/htdocs/core/datepicker.php
+++ b/htdocs/core/datepicker.php
@@ -26,17 +26,18 @@
* \brief File to manage popup date selector
*/
-if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Not disabled cause need to load personalized language
-//if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Not disabled cause need to load personalized language
+if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // disabled
+//if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Not disabled cause need to load personalized language
if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1');
-//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); // Not disabled cause need to do translations
+//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); // Not disabled cause need to do translations
if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK',1);
if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL',1);
-if (! defined('NOLOGIN')) define('NOLOGIN',1); // Not disabled cause need to load personalized language
-if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU',1);
-if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML',1);
+if (! defined('NOLOGIN')) define('NOLOGIN',1); // disabled
+if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU',1);
+if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML',1);
require_once '../main.inc.php';
+require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
if (GETPOST('lang')) $langs->setDefaultLang(GETPOST('lang')); // If language was forced on URL by the main.inc.php
$langs->load("main");
@@ -186,37 +187,49 @@ function displayBox($selectedDate,$month,$year)
global->MAIN_START_WEEK) ? (int) $conf->global->MAIN_START_WEEK : 0;
+ $startday=isset($conf->global->MAIN_START_WEEK)?$conf->global->MAIN_START_WEEK:1;
$day_names = array('ShortSunday', 'ShortMonday', 'ShortTuesday', 'ShortWednesday', 'ShortThursday', 'ShortFriday', 'ShortSaturday');
for( $i=0; $i < 7; $i++ )
{
- echo '', $langs->trans($day_names[($i + $first_day_of_week) % 7]), ' ', "\n";
+ echo '', $langs->trans($day_names[($i + $startday) % 7]), ' ', "\n";
}
?>
+<<<<<<< HEAD
+=======
+
+>>>>>>> refs/remotes/origin/3.7
";
+ //echo $conf->global->MAIN_START_WEEK.' '.$firstdate["wday"].' '.$startday;
$cols=0;
- for($i=0;$i< ($mydate["wday"]+7-$first_day_of_week)%7;$i++)
+ for ($i = 0; $i < 7; $i++)
{
+ $w = ($i + $startday) % 7;
+ if ($w == $firstdate["wday"])
+ {
+ $mydate = $firstdate;
+ break;
+ }
echo " ";
$cols++;
}
}
else
{
- if ($mydate["wday"]==$first_day_of_week)
+ if ($mydate["wday"] == $startday)
{
echo "";
$cols=0;
@@ -240,7 +253,7 @@ function displayBox($selectedDate,$month,$year)
echo ">".sprintf("%02s",$mydate["mday"])."";
$cols++;
- if ($mydate != $firstdate && $mydate["wday"]==(($first_day_of_week + 6)%7)) echo " \n";
+ if (($mydate["wday"] + 1) % 7 == $startday) echo "\n";
//$thedate=strtotime("tomorrow",$thedate);
$day++;
diff --git a/htdocs/core/filemanagerdol/connectors/php/commands.php b/htdocs/core/filemanagerdol/connectors/php/commands.php
index 3a0dc0378ea..18b54c1c6b8 100644
--- a/htdocs/core/filemanagerdol/connectors/php/commands.php
+++ b/htdocs/core/filemanagerdol/connectors/php/commands.php
@@ -188,7 +188,7 @@ function FileUpload($resourceType, $currentFolder, $sCommand, $CKEcallback = '')
if ( isset( $_FILES['NewFile'] ) && !is_null($_FILES['NewFile']['tmp_name'])
// This is for the QuickUpload tab box
- or (isset($_FILES['upload']) and !is_null($_FILES['upload']['tmp_name'])))
+ or (isset($_FILES['upload']) && !is_null($_FILES['upload']['tmp_name'])))
{
global $Config ;
diff --git a/htdocs/core/lib/agenda.lib.php b/htdocs/core/lib/agenda.lib.php
index 72c3214610a..6092603c03a 100644
--- a/htdocs/core/lib/agenda.lib.php
+++ b/htdocs/core/lib/agenda.lib.php
@@ -50,6 +50,8 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh
global $conf, $user, $langs, $db, $hookmanager;
global $begin_h, $end_h, $begin_d, $end_d;
+ $langs->load("companies");
+
// Filters
print '
';
+
print '
';
print '
';
print ' ';
@@ -651,7 +660,7 @@ if ($id > 0 || $ref)
}
else
{
- print $formproduct->selectWarehouses(($_GET["dwid"]?$_GET["dwid"]:GETPOST('id_entrepot_source')),'id_entrepot_source','',1);
+ print $formproduct->selectWarehouses((GETPOST("dwid")?GETPOT("dwid",'int'):(GETPOST('id_entrepot')?GETPOST('id_entrepot_source','int'):'ifone')),'id_entrepot_source','',1);
}
print '';
print '
'.$langs->trans("WarehouseTarget").' ';
@@ -753,7 +762,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";
@@ -777,6 +786,7 @@ if ($resql)
$obj = $db->fetch_object($resql);
$entrepotstatic->id=$obj->rowid;
$entrepotstatic->libelle=$obj->label;
+ $entrepotstatic->lieu=$obj->lieu;
print ' ';
print ''.$entrepotstatic->getNomUrl(1).' ';
print ''.$obj->reel.($obj->reel<0?' '.img_warning():'').' ';
diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php
index 1d24076df27..90fdae1232b 100644
--- a/htdocs/projet/class/project.class.php
+++ b/htdocs/projet/class/project.class.php
@@ -398,7 +398,7 @@ class Project extends CommonObject
* @param string $datefieldname name of table associated of the type
* @param string $dates Start date (at 00:00:00)
* @param string $datee End date (at 23:00:00)
- * @return mixed List of orders linked to project, < 0 or string if error
+ * @return mixed Array list of object ids linked to project, < 0 or string if error
*/
function get_element_list($type, $tablename, $datefieldname='', $dates='', $datee='')
{
@@ -768,9 +768,9 @@ class Project extends CommonObject
if ($statut == 0)
return $langs->trans($this->statuts_short[$statut]) . ' ' . img_picto($langs->trans($this->statuts_short[$statut]), 'statut0');
if ($statut == 1)
- return $langs->trans($this->statuts_short[$statut]) . ' ' . img_picto($langs->trans($this->statuts_short[$statut]), 'statut1');
+ return $langs->trans($this->statuts_short[$statut]) . ' ' . img_picto($langs->trans($this->statuts_short[$statut]), 'statut4');
if ($statut == 2)
- return img_picto($langs->trans($this->statuts_short[$statut]), 'statut6') . ' ' . $langs->trans($this->statuts_short[$statut]);
+ return $langs->trans($this->statuts_short[$statut]) . ' ' . img_picto($langs->trans($this->statuts_short[$statut]), 'statut6');
}
}
@@ -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/projet/element.php b/htdocs/projet/element.php
index 2e447e15568..1abaa37cac1 100644
--- a/htdocs/projet/element.php
+++ b/htdocs/projet/element.php
@@ -272,6 +272,8 @@ foreach ($listofreferent as $key => $value)
if ($qualified)
{
+ $element = new $classname($db);
+
if (! $showdatefilter)
{
print '';
@@ -336,6 +338,9 @@ foreach ($listofreferent as $key => $value)
$total_ht_by_third = 0;
$total_ttc_by_third = 0;
+ $saved_third_id = 0;
+ $breakline = '';
+
if (canApplySubtotalOn($tablename)) {
// Appel du mon code de tri :
$elementarray = sortElementsByClientName($elementarray);
@@ -344,11 +349,23 @@ foreach ($listofreferent as $key => $value)
$num=count($elementarray);
for ($i = 0; $i < $num; $i++)
{
- $element = new $classname($db);
$element->fetch($elementarray[$i]);
$element->fetch_thirdparty();
//print $classname;
+ if ($breakline && $saved_third_id != $element->thirdparty->id)
+ {
+ print $breakline;
+ $var = true;
+
+ $saved_third_id = $element->thirdparty->id;
+ $breakline = '';
+
+ $total_ht_by_third=0;
+ $total_ttc_by_third=0;
+ }
+ $saved_third_id = $element->thirdparty->id;
+
$qualifiedfortotal=true;
if ($key == 'invoice')
{
@@ -417,34 +434,28 @@ foreach ($listofreferent as $key => $value)
$total_ttc_by_third += $element->total_ttc;
}
- // Autre partie de mon code :
if (canApplySubtotalOn($tablename))
{
- $next_third_id = (isset($elementarray[$i+1])) ? $elementarray[$i+1] : '';
- $third_id = $element->thirdparty->id;
- if ($third_id != $next_third_id)
- {
- print '';
- print '';
- print ' ';
- print '';
- print ' ';
- print '';
- print $langs->trans('SubTotal').' : ';
- if (is_object($element->thirdparty)) print $element->thirdparty->getNomUrl(0,'',48);
- print ' ';
- print ''.price($total_ht).' ';
- print ''.price($total_ttc).' ';
- print ' ';
- print ' ';
-
- $total_ht_by_third = 0;
- $total_ttc_by_third = 0;
- $var=true;
- }
+ $breakline='';
+ $breakline.='';
+ $breakline.=' ';
+ $breakline.='';
+ $breakline.=' ';
+ $breakline.='';
+ $breakline.=$langs->trans('SubTotal').' : ';
+ if (is_object($element->thirdparty)) $breakline.=$element->thirdparty->getNomUrl(0,'',48);
+ $breakline.=' ';
+ $breakline.=''.price($total_ht_by_third).' ';
+ $breakline.=''.price($total_ttc_by_third).' ';
+ $breakline.=' ';
+ $breakline.=' ';
}
+
+ //var_dump($element->thirdparty->name.' - '.$saved_third_id.' - '.$element->thirdparty->id);
}
+ if ($breakline) print $breakline;
+
print ''.$langs->trans("Number").': '.$i.' ';
if (empty($value['disableamount'])) print ''.$langs->trans("TotalHT").' : '.price($total_ht).' ';
else print ' ';
@@ -524,6 +535,8 @@ foreach ($listofreferent as $key => $value)
$margin = $value['margin'];
if (isset($margin))
{
+ $element = new $classname($db);
+
$elementarray = $project->get_element_list($key, $tablename);
if (count($elementarray)>0 && is_array($elementarray))
{
@@ -533,7 +546,6 @@ foreach ($listofreferent as $key => $value)
$num=count($elementarray);
for ($i = 0; $i < $num; $i++)
{
- $element = new $classname($db);
$element->fetch($elementarray[$i]);
$element->fetch_thirdparty();
//print $classname;
@@ -607,23 +619,25 @@ function sortElementsByClientName($elementarray)
$element = new $classname($db);
$clientname = array();
- foreach ($elementarray as $key => $id)
+ foreach ($elementarray as $key => $id) // id = id of object
{
if (empty($clientname[$id]))
{
- $element->id = $id;
+ $element->fetch($id);
$element->fetch_thirdparty();
+
$clientname[$id] = $element->thirdparty->name;
}
}
- asort($clientname);
+ //var_dump($clientname);
+ asort($clientname); // sort on name
$elementarray = array();
- foreach ($clientname as $id => $name) {
+ foreach ($clientname as $id => $name)
+ {
$elementarray[] = $id;
}
return $elementarray;
}
-
diff --git a/htdocs/projet/ganttchart.inc.php b/htdocs/projet/ganttchart.inc.php
index 7b4249a0128..849e89ba16c 100644
--- a/htdocs/projet/ganttchart.inc.php
+++ b/htdocs/projet/ganttchart.inc.php
@@ -24,8 +24,7 @@
?>