';
+ dol_fiche_end('');
+
+ print '
';
print ' ';
- print ' ';
+ print ' ';
print ' ';
print '
';
diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php
index 6ca5b2fad02..20fce315153 100644
--- a/htdocs/categories/class/categorie.class.php
+++ b/htdocs/categories/class/categorie.class.php
@@ -643,8 +643,8 @@ class Categorie extends CommonObject
{
$field=''; $classname=''; $category_table=''; $object_table='';
if ($type=='product') { $field='product'; $classname='Product'; }
- if ($type=='customer') { $field='societe'; $classname='Societe'; }
- if ($type=='supplier') { $field='societe'; $classname='Fournisseur'; $category_table='fournisseur'; }
+ if ($type=='customer') { $field='soc'; $classname='Societe'; $category_table='societe'; $object_table='societe'; }
+ if ($type=='supplier') { $field='soc'; $classname='Fournisseur'; $category_table='fournisseur'; $object_table='societe'; }
if ($type=='member') { $field='member'; $classname='Adherent'; $category_table=''; $object_table='adherent'; }
if ($type=='contact') { $field='socpeople'; $classname='Contact'; $category_table='contact'; $object_table='socpeople'; }
diff --git a/htdocs/categories/viewcat.php b/htdocs/categories/viewcat.php
index c55f324ab06..31580e28be8 100644
--- a/htdocs/categories/viewcat.php
+++ b/htdocs/categories/viewcat.php
@@ -127,7 +127,7 @@ if ($type==0 && $elemid && $action == 'addintocategory' && ($user->rights->produ
$newobject = new Product($db);
$result = $newobject->fetch($elemid);
$elementtype = 'product';
-
+
// TODO Add into categ
$result=$object->add_type($newobject,$elementtype);
if ($result >= 0)
@@ -145,7 +145,7 @@ if ($type==0 && $elemid && $action == 'addintocategory' && ($user->rights->produ
setEventMessages($object->error,$object->errors,'errors');
}
}
-
+
}
@@ -232,7 +232,7 @@ print "
";
$cats = $object->get_filles();
if ($cats < 0)
{
- dol_print_error();
+ dol_print_error($db, $cats->error, $cats->errors);
}
else
{
@@ -286,12 +286,12 @@ if ($object->type == 0)
$prods = $object->getObjectsInCateg("product");
if ($prods < 0)
{
- dol_print_error();
+ dol_print_error($db, $prods->error, $prods->errors);
}
else
{
$showclassifyform=1; $typeid=0;
-
+
// Form to add record into a category
if ($showclassifyform)
{
@@ -312,7 +312,7 @@ if ($object->type == 0)
print '';
print '';
}
-
+
print "\n";
print ''.$langs->trans("ProductsAndServices")." \n";
@@ -359,7 +359,7 @@ if ($object->type == 1)
$socs = $object->getObjectsInCateg("supplier");
if ($socs < 0)
{
- dol_print_error();
+ dol_print_error($db, $socs->error, $socs->errors);
}
else
{
@@ -410,7 +410,7 @@ if($object->type == 2)
$socs = $object->getObjectsInCateg("customer");
if ($socs < 0)
{
- dol_print_error();
+ dol_print_error($db, $socs->error, $socs->errors);
}
else
{
@@ -466,7 +466,7 @@ if ($object->type == 3)
$prods = $object->getObjectsInCateg("member");
if ($prods < 0)
{
- dol_print_error($db,$object->error);
+ dol_print_error($db, $prods->error, $prods->errors);
}
else
{
@@ -518,7 +518,7 @@ if($object->type == 4)
$contacts = $object->getObjectsInCateg("contact");
if ($contacts < 0)
{
- dol_print_error();
+ dol_print_error($db, $contacts->error, $contacts->errors);
}
else
{
diff --git a/htdocs/comm/index.php b/htdocs/comm/index.php
index 3924774f7fc..6766bd1f868 100644
--- a/htdocs/comm/index.php
+++ b/htdocs/comm/index.php
@@ -585,9 +585,9 @@ if (! empty($conf->propal->enabled) && $user->rights->propal->lire)
*/
if (! empty($conf->commande->enabled) && $user->rights->commande->lire)
{
- $langs->load("order");
+ $langs->load("orders");
- $sql = "SELECT s.nom as name, s.rowid, c.rowid as commandeid, c.total_ttc, c.total_ht, c.tva as total_tva, c.ref, c.ref_client, c.fk_statut, c.date_valid as dv ";
+ $sql = "SELECT s.nom as name, s.rowid, c.rowid as commandeid, c.total_ttc, c.total_ht, c.tva as total_tva, c.ref, c.ref_client, c.fk_statut, c.date_valid as dv, c.facture as billed";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
$sql.= ", ".MAIN_DB_PREFIX."commande as c";
if (! $user->rights->societe->client->voir && ! $socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
@@ -654,7 +654,7 @@ if (! empty($conf->commande->enabled) && $user->rights->commande->lire)
print '';
print dol_print_date($db->jdate($obj->dp),'day').' '."\n";
print ''.price($obj->total_ttc).' ';
- print ''.$orderstatic->LibStatut($obj->fk_statut,3).' '."\n";
+ print ''.$orderstatic->LibStatut($obj->fk_statut,$obj->billed,3).' '."\n";
print ''."\n";
$i++;
$total += $obj->total_ttc;
diff --git a/htdocs/comm/prospect/class/prospect.class.php b/htdocs/comm/prospect/class/prospect.class.php
index 59f284408b8..719a8c830f1 100644
--- a/htdocs/comm/prospect/class/prospect.class.php
+++ b/htdocs/comm/prospect/class/prospect.class.php
@@ -26,8 +26,7 @@ include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
/**
- * \class Prospect
- * \brief Classe permettant la gestion des prospects
+ * Class to manage prospects
*/
class Prospect extends Societe
{
@@ -37,7 +36,7 @@ class Prospect extends Societe
/**
* Constructor
*
- * @param DoliDB $db Databas handler
+ * @param DoliDB $db Database handler
*/
function __construct($db)
{
diff --git a/htdocs/core/actions_sendmails.inc.php b/htdocs/core/actions_sendmails.inc.php
index fce813aaa05..d27e6e59fb4 100644
--- a/htdocs/core/actions_sendmails.inc.php
+++ b/htdocs/core/actions_sendmails.inc.php
@@ -22,7 +22,7 @@
*/
-// TODO Include this include file into all class objects
+// TODO Include this include file into all element pages allowing email sending
// $id must be defined
// $actiontypecode must be defined
@@ -161,9 +161,11 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
$filename = $attachedfiles['names'];
$mimetype = $attachedfiles['mimes'];
+ $trackid = GETPOST('trackid','aZ');
+
// Send mail
require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
- $mailfile = new CMailFile($subject,$sendto,$from,$message,$filepath,$mimetype,$filename,$sendtocc,$sendtobcc,$deliveryreceipt,-1);
+ $mailfile = new CMailFile($subject,$sendto,$from,$message,$filepath,$mimetype,$filename,$sendtocc,$sendtobcc,$deliveryreceipt,-1,'','',$trackid);
if ($mailfile->error)
{
$mesgs[]=''.$mailfile->error.'
';
diff --git a/htdocs/core/boxes/box_clients.php b/htdocs/core/boxes/box_clients.php
index 2cd5922d784..24c940fb9ea 100644
--- a/htdocs/core/boxes/box_clients.php
+++ b/htdocs/core/boxes/box_clients.php
@@ -101,8 +101,6 @@ class box_clients extends ModeleBoxes
if ($result)
{
$num = $db->num_rows($result);
- if (empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) $url= DOL_URL_ROOT."/comm/card.php?socid=";
- else $url= DOL_URL_ROOT."/societe/soc.php?socid=";
$line = 0;
while ($line < $num)
diff --git a/htdocs/core/boxes/box_commandes.php b/htdocs/core/boxes/box_commandes.php
index 53e3aaf2861..6eb5006182c 100644
--- a/htdocs/core/boxes/box_commandes.php
+++ b/htdocs/core/boxes/box_commandes.php
@@ -128,7 +128,7 @@ class box_commandes extends ModeleBoxes
$this->info_box_contents[$line][] = array(
'td' => 'align="right"',
- 'text' => price($objp->total_ht),
+ 'text' => price($objp->total_ht, 0, $langs, 0, -1, -1, $conf->currency),
);
if (! empty($conf->global->ORDER_BOX_LAST_ORDERS_SHOW_VALIDATE_USER)) {
diff --git a/htdocs/core/boxes/box_factures.php b/htdocs/core/boxes/box_factures.php
index dd1059cf9d2..d04c3e48a3b 100644
--- a/htdocs/core/boxes/box_factures.php
+++ b/htdocs/core/boxes/box_factures.php
@@ -94,10 +94,10 @@ class box_factures extends ModeleBoxes
$num = $db->num_rows($result);
$now=dol_now();
- $i = 0;
+ $line = 0;
$l_due_date = $langs->trans('Late').' ('.strtolower($langs->trans('DateEcheance')).': %s)';
- while ($i < $num) {
+ while ($line < $num) {
$objp = $db->fetch_object($result);
$datelimite = $db->jdate($objp->datelimite);
$date = $db->jdate($objp->df);
@@ -115,39 +115,39 @@ class box_factures extends ModeleBoxes
$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][] = array(
+ $this->info_box_contents[$line][] = array(
'td' => 'align="left"',
'text' => $facturestatic->getNomUrl(1),
'text2'=> $late,
'asis' => 1,
);
- $this->info_box_contents[$i][] = array(
+ $this->info_box_contents[$line][] = array(
'td' => 'align="left"',
'text' => $societestatic->getNomUrl(1, '', 40),
'asis' => 1,
);
- $this->info_box_contents[$i][] = array(
+ $this->info_box_contents[$line][] = array(
'td' => 'align="right"',
- 'text' => price($objp->total_ht),
+ 'text' => price($objp->total_ht, 0, $langs, 0, -1, -1, $conf->currency),
);
- $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' => $facturestatic->LibStatut($objp->paye,$objp->fk_statut,3),
);
- $i++;
+ $line++;
}
if ($num==0)
- $this->info_box_contents[$i][0] = array(
+ $this->info_box_contents[$line][0] = array(
'td' => 'align="center"',
'text'=>$langs->trans("NoRecordedInvoices"),
);
diff --git a/htdocs/core/boxes/box_factures_fourn.php b/htdocs/core/boxes/box_factures_fourn.php
index f48d2ab43d3..2f31fa61f78 100644
--- a/htdocs/core/boxes/box_factures_fourn.php
+++ b/htdocs/core/boxes/box_factures_fourn.php
@@ -56,10 +56,10 @@ class box_factures_fourn extends ModeleBoxes
$this->max=$max;
include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
- include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
+ include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php';
$facturestatic = new FactureFournisseur($db);
- $societestatic = new Societe($db);
+ $thirdpartytmp = new Fournisseur($db);
$this->info_box_head = array(
'text' => $langs->trans("BoxTitleLast".($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE?"":"Modified")."SupplierBills",$max)
@@ -95,10 +95,10 @@ class box_factures_fourn extends ModeleBoxes
$num = $db->num_rows($result);
$now=dol_now();
- $i = 0;
+ $line = 0;
$l_due_date = $langs->trans('Late').' ('.$langs->trans('DateEcheance').': %s)';
- while ($i < $num) {
+ while ($line < $num) {
$objp = $db->fetch_object($result);
$datelimite=$db->jdate($objp->datelimite);
$date=$db->jdate($objp->df);
@@ -108,36 +108,41 @@ class box_factures_fourn extends ModeleBoxes
$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;
+ $thirdpartytmp->id = $objp->socid;
+ $thirdpartytmp->name = $objp->name;
+ $thirdpartytmp->fournisseur = 1;
+ $thirdpartytmp->code_fournisseur = $objp->code_fournisseur;
+ $thirdpartytmp->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][] = array(
+ $this->info_box_contents[$line][] = array(
'td' => 'align="left"',
'text' => $facturestatic->getNomUrl(1),
'text2'=> $late,
'asis' => 1,
);
- $this->info_box_contents[$i][] = array(
+ $this->info_box_contents[$line][] = 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][] = array(
+ $this->info_box_contents[$line][] = array(
'td' => 'align="left"',
- 'text' => $societestatic->getNomUrl(1, 'supplier'),
+ 'text' => $thirdpartytmp->getNomUrl(1, 'supplier'),
'asis' => 1,
);
- $this->info_box_contents[$i][] = array(
+ $this->info_box_contents[$line][] = array(
+ 'td' => 'align="right"',
+ 'text' => price($objp->total_ht, 0, $langs, 0, -1, -1, $conf->currency),
+ );
+
+ $this->info_box_contents[$line][] = array(
'td' => 'align="right"',
'text' => dol_print_date($date,'day'),
);
@@ -145,16 +150,16 @@ class box_factures_fourn extends ModeleBoxes
$fac = new FactureFournisseur($db);
$fac->fetch($objp->facid);
$alreadypaid=$fac->getSommePaiement();
- $this->info_box_contents[$i][6] = array(
+ $this->info_box_contents[$line][] = array(
'td' => 'align="right" width="18"',
'text' => $facturestatic->LibStatut($objp->paye,$objp->fk_statut,3,$alreadypaid,$objp->type),
);
- $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("NoModifiedSupplierBills"),
);
diff --git a/htdocs/core/boxes/box_factures_fourn_imp.php b/htdocs/core/boxes/box_factures_fourn_imp.php
index a82af75332a..ecea4a27fd1 100644
--- a/htdocs/core/boxes/box_factures_fourn_imp.php
+++ b/htdocs/core/boxes/box_factures_fourn_imp.php
@@ -56,6 +56,8 @@ class box_factures_fourn_imp extends ModeleBoxes
include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
$facturestatic=new FactureFournisseur($db);
+ include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php';
+ $thirdpartytmp=new Fournisseur($db);
$this->info_box_head = array('text' => $langs->trans("BoxTitleOldestUnpaidSupplierBills",$max));
@@ -64,6 +66,9 @@ class box_factures_fourn_imp extends ModeleBoxes
$sql = "SELECT s.nom as name, s.rowid as socid,";
$sql.= " f.rowid as facid, f.ref, f.ref_supplier, f.date_lim_reglement as datelimite,";
$sql.= " f.amount, f.datef as df,";
+ $sql.= " f.total_ht as total_ht,";
+ $sql.= " f.tva as total_tva,";
+ $sql.= " f.total_ttc,";
$sql.= " f.paye, f.fk_statut, f.type";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
$sql.= ",".MAIN_DB_PREFIX."facture_fourn as f";
@@ -83,26 +88,30 @@ class box_factures_fourn_imp extends ModeleBoxes
$num = $db->num_rows($result);
$now=dol_now();
- $i = 0;
+ $line = 0;
$l_due_date = $langs->trans('Late').' ('.$langs->trans('DateEcheance').': %s)';
- while ($i < $num)
+ while ($line < $num)
{
$objp = $db->fetch_object($result);
$datelimite=$db->jdate($objp->datelimite);
+ $thirdpartytmp->id = $objp->socid;
+ $thirdpartytmp->name = $objp->name;
+ $thirdpartytmp->code_client = $objp->code_client;
+ $thirdpartytmp->logo = $objp->logo;
$late='';
if ($datelimite && $datelimite < ($now - $conf->facture->fournisseur->warning_delay)) $late=img_warning(sprintf($l_due_date,dol_print_date($datelimite,'day')));
$tooltip = $langs->trans('SupplierInvoice') . ': ' . ($objp->ref?$objp->ref:$objp->facid) . ' ' . $langs->trans('RefSupplier') . ': ' . $objp->ref_supplier;
- $this->info_box_contents[$i][0] = array(
+ $this->info_box_contents[$line][] = 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(
+ $this->info_box_contents[$line][] = array(
'td' => 'align="left"',
'text' => ($objp->ref?$objp->ref:$objp->facid),
'text2'=> $late,
@@ -110,29 +119,18 @@ class box_factures_fourn_imp extends ModeleBoxes
'url' => DOL_URL_ROOT."/fourn/facture/card.php?facid=".$objp->facid,
);
- $this->info_box_contents[$i][2] = array(
+ $this->info_box_contents[$line][] = array(
'td' => 'align="left"',
- 'text' => $objp->ref_supplier,
- 'tooltip' => $tooltip,
- 'url' => DOL_URL_ROOT."/fourn/facture/card.php?facid=".$objp->facid,
+ 'text' => $thirdpartytmp->getNomUrl(1, '', 40),
+ 'asis' => 1,
);
- $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[$line][] = array(
+ 'td' => 'align="right"',
+ 'text' => price($objp->total_ht, 0, $langs, 0, -1, -1, $conf->currency),
);
- $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(
+ $this->info_box_contents[$line][] = array(
'td' => 'align="right"',
'text' => dol_print_date($datelimite,'day'),
);
@@ -140,16 +138,16 @@ class box_factures_fourn_imp extends ModeleBoxes
$fac = new FactureFournisseur($db);
$fac->fetch($objp->facid);
$alreadypaid=$fac->getSommePaiement();
- $this->info_box_contents[$i][6] = array(
+ $this->info_box_contents[$line][] = array(
'td' => 'align="right" width="18"',
'text' => $facturestatic->LibStatut($objp->paye,$objp->fk_statut,3,$alreadypaid,$objp->type),
);
- $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("NoUnpaidSupplierBills"),
);
diff --git a/htdocs/core/boxes/box_factures_imp.php b/htdocs/core/boxes/box_factures_imp.php
index d7817d134d3..42e889138cc 100644
--- a/htdocs/core/boxes/box_factures_imp.php
+++ b/htdocs/core/boxes/box_factures_imp.php
@@ -95,10 +95,10 @@ class box_factures_imp extends ModeleBoxes
$num = $db->num_rows($result);
$now=dol_now();
- $i = 0;
+ $line = 0;
$l_due_date = $langs->trans('Late').' ('.strtolower($langs->trans('DateEcheance')).': %s)';
- while ($i < $num)
+ while ($line < $num)
{
$objp = $db->fetch_object($result);
$datelimite=$db->jdate($objp->datelimite);
@@ -117,33 +117,38 @@ class box_factures_imp extends ModeleBoxes
$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][] = array(
+ $this->info_box_contents[$line][] = array(
'td' => 'align="left"',
'text' => $facturestatic->getNomUrl(1),
'text2'=> $late,
'asis' => 1,
);
- $this->info_box_contents[$i][] = array(
+ $this->info_box_contents[$line][] = array(
'td' => 'align="left"',
'text' => $societestatic->getNomUrl(1, '', 44),
'asis' => 1,
);
- $this->info_box_contents[$i][] = array(
+ $this->info_box_contents[$line][] = array(
+ 'td' => 'align="right"',
+ 'text' => price($objp->total_ht, 0, $langs, 0, -1, -1, $conf->currency),
+ );
+
+ $this->info_box_contents[$line][] = array(
'td' => 'align="right"',
'text' => dol_print_date($datelimite,'day'),
);
- $this->info_box_contents[$i][] = array(
+ $this->info_box_contents[$line][] = array(
'td' => 'align="right" width="18"',
'text' => $facturestatic->LibStatut($objp->paye,$objp->fk_statut,3),
);
- $i++;
+ $line++;
}
- if ($num==0) $this->info_box_contents[$i][0] = array('td' => 'align="center"','text'=>$langs->trans("NoUnpaidCustomerBills"));
+ if ($num==0) $this->info_box_contents[$line][0] = array('td' => 'align="center"','text'=>$langs->trans("NoUnpaidCustomerBills"));
$db->free($result);
}
diff --git a/htdocs/core/boxes/box_fournisseurs.php b/htdocs/core/boxes/box_fournisseurs.php
index e9c21da739f..e3e6061d803 100644
--- a/htdocs/core/boxes/box_fournisseurs.php
+++ b/htdocs/core/boxes/box_fournisseurs.php
@@ -58,12 +58,16 @@ class box_fournisseurs extends ModeleBoxes
include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
$thirdpartystatic=new Societe($db);
+ include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php';
+ $thirdpartytmp=new Fournisseur($db);
$this->info_box_head = array('text' => $langs->trans("BoxTitleLastModifiedSuppliers",$max));
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, s.datec, s.tms, s.status,";
+ $sql.= " s.code_fournisseur,";
+ $sql.= " s.logo";
$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.fournisseur = 1";
@@ -78,42 +82,37 @@ class box_fournisseurs 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);
$datem=$db->jdate($objp->tms);
+ $thirdpartytmp->id = $objp->socid;
+ $thirdpartytmp->name = $objp->name;
+ $thirdpartytmp->code_client = $objp->code_client;
+ $thirdpartytmp->logo = $objp->logo;
- $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(
+ $this->info_box_contents[$line][] = array(
'td' => 'align="left"',
- 'text' => $objp->name,
- 'tooltip' => $tooltip,
- 'url' => DOL_URL_ROOT."/fourn/card.php?socid=".$objp->socid,
+ 'text' => $thirdpartytmp->getNomUrl(1, '', 40),
+ '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(
+ if ($num==0) $this->info_box_contents[$line][0] = array(
'td' => 'align="center"',
'text'=>$langs->trans("NoRecordedSuppliers"),
);
diff --git a/htdocs/core/boxes/box_propales.php b/htdocs/core/boxes/box_propales.php
index 4e8b47aa0d4..c14cf07a51c 100644
--- a/htdocs/core/boxes/box_propales.php
+++ b/htdocs/core/boxes/box_propales.php
@@ -123,7 +123,7 @@ class box_propales extends ModeleBoxes
$this->info_box_contents[$line][] = array(
'td' => 'align="right"',
- 'text' => price($objp->total_ht),
+ 'text' => price($objp->total_ht, 0, $langs, 0, -1, -1, $conf->currency),
);
$this->info_box_contents[$line][] = array(
diff --git a/htdocs/core/boxes/box_prospect.php b/htdocs/core/boxes/box_prospect.php
index ef9585202b0..2f96c57ee95 100644
--- a/htdocs/core/boxes/box_prospect.php
+++ b/htdocs/core/boxes/box_prospect.php
@@ -74,14 +74,20 @@ class box_prospect extends ModeleBoxes
$this->max=$max;
- include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
- $thirdpartystatic=new Societe($db);
+ include_once DOL_DOCUMENT_ROOT.'/comm/prospect/class/prospect.class.php';
+ $thirdpartystatic=new Prospect($db);
$this->info_box_head = array('text' => $langs->trans("BoxTitleLastModifiedProspects",$max));
if ($user->rights->societe->lire)
{
- $sql = "SELECT s.nom as name, s.rowid as socid, s.fk_stcomm, 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.fk_stcomm, 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 (2, 3)";
@@ -97,48 +103,46 @@ class box_prospect extends ModeleBoxes
{
$num = $db->num_rows($resql);
- $i = 0;
- $prospectstatic=new Prospect($db);
- while ($i < $num)
+ $line = 0;
+ while ($line < $num)
{
$objp = $db->fetch_object($resql);
$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' => $objp->name,
- 'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid,
- );
-
- $this->info_box_contents[$i][1] = array(
+ $this->info_box_contents[$line][] = array(
'td' => 'align="left"',
- 'text' => $objp->name,
- 'tooltip' => $objp->name,
- 'url' => DOL_URL_ROOT."/comm/card.php?socid=".$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' => str_replace('img ','img height="14" ',$prospectstatic->LibProspStatut($objp->fk_stcomm,3)),
+ 'text' => str_replace('img ','img height="14" ',$thirdpartystatic->LibProspStatut($objp->fk_stcomm,3)),
);
- $this->info_box_contents[$i][4] = 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(
+ $this->info_box_contents[$line][0] = array(
'td' => 'align="center"',
'text'=>$langs->trans("NoRecordedProspects"),
);
diff --git a/htdocs/core/boxes/box_supplier_orders.php b/htdocs/core/boxes/box_supplier_orders.php
index d435e5ca3dc..84521bf4ee0 100644
--- a/htdocs/core/boxes/box_supplier_orders.php
+++ b/htdocs/core/boxes/box_supplier_orders.php
@@ -58,13 +58,20 @@ class box_supplier_orders extends ModeleBoxes
include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php';
$supplierorderstatic=new CommandeFournisseur($db);
+ include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php';
+ $thirdpartytmp = new Fournisseur($db);
$this->info_box_head = array('text' => $langs->trans("BoxTitleLatest".($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE?"":"Modified")."SupplierOrders", $max));
if ($user->rights->fournisseur->commande->lire)
{
$sql = "SELECT s.nom as name, s.rowid as socid,";
+ $sql.= " s.code_client, s.code_fournisseur,";
+ $sql.= " s.logo,";
$sql.= " c.ref, c.tms, c.rowid, c.date_commande,";
+ $sql.= " c.total_ht,";
+ $sql.= " c.tva as total_tva,";
+ $sql.= " c.total_ttc,";
$sql.= " c.fk_statut";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
$sql.= ", ".MAIN_DB_PREFIX."commande_fournisseur as c";
@@ -82,60 +89,61 @@ class box_supplier_orders extends ModeleBoxes
{
$num = $db->num_rows($result);
- $i = 0;
- while ($i < $num) {
+ $line = 0;
+ while ($line < $num) {
$objp = $db->fetch_object($result);
$date=$db->jdate($objp->date_commande);
$datem=$db->jdate($objp->tms);
+ $thirdpartytmp->id = $objp->socid;
+ $thirdpartytmp->name = $objp->name;
+ $thirdpartytmp->fournisseur = 1;
+ $thirdpartytmp->code_fournisseur = $objp->code_fournisseur;
+ $thirdpartytmp->logo = $objp->logo;
$urlo = DOL_URL_ROOT."/fourn/commande/card.php?id=".$objp->rowid;
$urls = DOL_URL_ROOT."/fourn/card.php?socid=".$objp->socid;
$tooltip = $langs->trans('SupplierOrder') . ': ' . $objp->ref;
- $this->info_box_contents[$i][0] = array(
+ $this->info_box_contents[$line][] = array(
'td' => 'align="left" width="16"',
'logo' => $this->boximg,
'tooltip' => $tooltip,
'url' => $urlo,
);
- $this->info_box_contents[$i][1] = array(
+ $this->info_box_contents[$line][] = 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(
+ $this->info_box_contents[$line][] = array(
'td' => 'align="left"',
- 'text' => $objp->name,
- 'tooltip' => $tooltip,
- 'url' => $urls,
+ 'text' => $thirdpartytmp->getNomUrl(1, 'supplier'),
+ 'asis' => 1,
);
- $this->info_box_contents[$i][4] = array(
+ $this->info_box_contents[$line][] = array(
+ 'td' => 'align="right"',
+ 'text' => price($objp->total_ht, 0, $langs, 0, -1, -1, $conf->currency),
+ );
+
+ $this->info_box_contents[$line][] = array(
'td' => 'align="right"',
'text' => dol_print_date($date,'day'),
);
- $this->info_box_contents[$i][5] = array(
+ $this->info_box_contents[$line][] = array(
'td' => 'align="right" width="18"',
'text' => $supplierorderstatic->LibStatut($objp->fk_statut,3),
);
- $i++;
+ $line++;
}
if ($num == 0)
- $this->info_box_contents[$i][0] = array(
+ $this->info_box_contents[$line][0] = array(
'td' => 'align="center"',
'text' => $langs->trans("NoSupplierOrder"),
);
diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php
index 967b764dc65..6e41384dbce 100644
--- a/htdocs/core/class/CMailFile.class.php
+++ b/htdocs/core/class/CMailFile.class.php
@@ -4,7 +4,7 @@
* Copyright (C) Eric Seigne
* Copyright (C) 2000-2005 Rodolphe Quiedeville
* Copyright (C) 2003 Jean-Louis Bergamo
- * Copyright (C) 2004-2012 Laurent Destailleur
+ * Copyright (C) 2004-2015 Laurent Destailleur
* Copyright (C) 2005-2012 Regis Houssin
*
* This program is free software; you can redistribute it and/or modify
@@ -31,7 +31,7 @@
/**
* Class to send emails (with attachments or not)
- * Usage: $mailfile = new CMailFile($subject,$sendto,$replyto,$message,$filepath,$mimetype,$filename,$cc,$ccc,$deliveryreceipt,$msgishtml,$errors_to);
+ * Usage: $mailfile = new CMailFile($subject,$sendto,$replyto,$message,$filepath,$mimetype,$filename,$cc,$ccc,$deliveryreceipt,$msgishtml,$errors_to,$css,$trackid);
* $mailfile->sendfile();
*/
class CMailFile
@@ -45,6 +45,7 @@ class CMailFile
var $addr_to;
var $addr_cc;
var $addr_bcc;
+ var $trackid;
var $mixed_boundary;
var $related_boundary;
@@ -65,6 +66,9 @@ class CMailFile
//! Defined background directly in body tag
var $bodyCSS;
+ var $headers;
+ var $message;
+
// Image
var $html;
var $image_boundary;
@@ -95,10 +99,11 @@ class CMailFile
* @param string $addr_bcc Email bcc (Note: This is autocompleted with MAIN_MAIL_AUTOCOPY_TO if defined)
* @param int $deliveryreceipt Ask a delivery receipt
* @param int $msgishtml 1=String IS already html, 0=String IS NOT html, -1=Unknown make autodetection (with fast mode, not reliable)
- * @param string $errors_to Email errors
+ * @param string $errors_to Email for errors-to
* @param string $css Css option
+ * @param string $trackid Tracking string
*/
- function __construct($subject,$to,$from,$msg,$filename_list=array(),$mimetype_list=array(),$mimefilename_list=array(),$addr_cc="",$addr_bcc="",$deliveryreceipt=0,$msgishtml=0,$errors_to='',$css='')
+ function __construct($subject,$to,$from,$msg,$filename_list=array(),$mimetype_list=array(),$mimefilename_list=array(),$addr_cc="",$addr_bcc="",$deliveryreceipt=0,$msgishtml=0,$errors_to='',$css='',$trackid='')
{
global $conf;
@@ -124,7 +129,7 @@ class CMailFile
// If ending method not defined
if (empty($conf->global->MAIN_MAIL_SENDMODE)) $conf->global->MAIN_MAIL_SENDMODE='mail';
- dol_syslog("CMailFile::CMailfile: MAIN_MAIL_SENDMODE=".$conf->global->MAIN_MAIL_SENDMODE." charset=".$conf->file->character_set_client." from=$from, to=$to, addr_cc=$addr_cc, addr_bcc=$addr_bcc, errors_to=$errors_to", LOG_DEBUG);
+ dol_syslog("CMailFile::CMailfile: MAIN_MAIL_SENDMODE=".$conf->global->MAIN_MAIL_SENDMODE." charset=".$conf->file->character_set_client." from=$from, to=$to, addr_cc=$addr_cc, addr_bcc=$addr_bcc, errors_to=$errors_to, trackid=$trackid", LOG_DEBUG);
dol_syslog("CMailFile::CMailfile: subject=$subject, deliveryreceipt=$deliveryreceipt, msgishtml=$msgishtml", LOG_DEBUG);
// Detect if message is HTML (use fast method)
@@ -190,6 +195,7 @@ class CMailFile
$this->addr_cc = $addr_cc;
$this->addr_bcc = $addr_bcc;
$this->deliveryreceipt = $deliveryreceipt;
+ $this->trackid = $trackid;
$smtp_headers = $this->write_smtpheaders();
// Define mime_headers
@@ -249,6 +255,7 @@ class CMailFile
$smtps->setSubject($this->encodetorfc2822($subject));
$smtps->setTO($this->getValidAddress($to,0,1));
$smtps->setFrom($this->getValidAddress($from,0,1));
+ $smtps->setTrackId($trackid);
if (! empty($this->html))
{
@@ -301,6 +308,7 @@ class CMailFile
$this->phpmailer->Subject($this->encodetorfc2822($subject));
$this->phpmailer->setTO($this->getValidAddress($to,0,1));
$this->phpmailer->SetFrom($this->getValidAddress($from,0,1));
+ // TODO Add trackid into smtp header
if (! empty($this->html))
{
@@ -516,7 +524,7 @@ class CMailFile
/**
* Encode subject according to RFC 2822 - http://en.wikipedia.org/wiki/MIME#Encoded-Word
- *
+ *
* @param string $stringtoencode String to encode
* @return string string encoded
*/
@@ -674,7 +682,17 @@ class CMailFile
//$out.= "X-Priority: 3".$this->eol2;
$out.= 'Date: ' . date("r") . $this->eol2;
- $out.= 'Message-ID: <' . time() . '.phpmail@' . $host . ">" . $this->eol2;
+
+ $trackid = $this->trackid;
+ if ($trackid)
+ {
+ $out.= 'Message-ID: <' . time() . '.phpmail-'.$trackid.'@' . $host . ">" . $this->eol2;
+ $out.= 'references: <' . time() . '.phpmail-'.$trackid.'@' . $host . ">" . $this->eol2;
+ }
+ else
+ {
+ $out.= 'Message-ID: <' . time() . '.phpmail@' . $host . ">" . $this->eol2;
+ }
$out.= "X-Mailer: Dolibarr version " . DOL_VERSION ." (using php mail)".$this->eol2;
$out.= "Mime-Version: 1.0".$this->eol2;
diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index 82364874cfe..f80fdd87304 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -1493,13 +1493,13 @@ class Form
* @param int $price_level Level of price to show
* @param int $status -1=Return all products, 0=Products not on sell, 1=Products on sell
* @param int $finished 2=all, 1=finished, 0=raw material
- * @param string $selected_input_value Value of preselected input text (with ajax)
+ * @param string $selected_input_value Value of preselected input text (for use with ajax)
* @param int $hidelabel Hide label (0=no, 1=yes, 2=show search icon (before) and placeholder, 3 search icon after)
* @param array $ajaxoptions Options for ajax_autocompleter
* @param int $socid Thirdparty Id
* @return void
*/
- function select_produits($selected='', $htmlname='productid', $filtertype='', $limit=20, $price_level=0, $status=1, $finished=2, $selected_input_value='', $hidelabel=0, $ajaxoptions=array(),$socid=0)
+ function select_produits($selected='', $htmlname='productid', $filtertype='', $limit=20, $price_level=0, $status=1, $finished=2, $selected_input_value='', $hidelabel=0, $ajaxoptions=array(), $socid=0)
{
global $langs,$conf;
@@ -1512,9 +1512,10 @@ class Form
if ($selected && empty($selected_input_value))
{
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
- $product = new Product($this->db);
- $product->fetch($selected);
- $selected_input_value=$product->ref;
+ $producttmpselect = new Product($this->db);
+ $producttmpselect->fetch($selected);
+ $selected_input_value=$producttmpselect->ref;
+ unset($producttmpselect);
}
// mode=1 means customers products
$urloption='htmlname='.$htmlname.'&outjson=1&price_level='.$price_level.'&type='.$filtertype.'&mode=1&status='.$status.'&finished='.$finished;
diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php
index 3c799b767af..b9d5048db74 100644
--- a/htdocs/core/class/html.formmail.class.php
+++ b/htdocs/core/class/html.formmail.class.php
@@ -44,6 +44,7 @@ class FormMail extends Form
var $replytomail;
var $toname;
var $tomail;
+ var $trackid;
var $withsubstit; // Show substitution array
var $withfrom;
@@ -244,7 +245,7 @@ class FormMail extends Form
else
{
$out='';
-
+
// Define list of attached files
$listofpaths=array();
$listofnames=array();
@@ -277,12 +278,13 @@ class FormMail extends Form
$out.= '