';
+ dol_fiche_end('');
+
+ print '
';
print ' ';
- print ' ';
+ print ' ';
print ' ';
print '
';
diff --git a/htdocs/categories/categorie.php b/htdocs/categories/categorie.php
index 1cd605ea9ca..0dc404ac3d1 100644
--- a/htdocs/categories/categorie.php
+++ b/htdocs/categories/categorie.php
@@ -357,7 +357,7 @@ else if ($id || $ref)
print '';
// Label
- print '
'.$langs->trans("Label").' '.$product->libelle.' ';
+ print ''.$langs->trans("Label").' '.$product->label.' ';
print '';
// Status (to sell)
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/edit.php b/htdocs/categories/edit.php
index 32bc33938f5..c3acb807e01 100644
--- a/htdocs/categories/edit.php
+++ b/htdocs/categories/edit.php
@@ -37,7 +37,7 @@ $action=GETPOST('action');
$confirm=GETPOST('confirm');
$socid=GETPOST('socid','int');
-$nom=GETPOST('nom');
+$label=GETPOST('label');
$description=GETPOST('description');
$visible=GETPOST('visible');
$parent=GETPOST('parent');
@@ -66,7 +66,7 @@ if ($action == 'update' && $user->rights->categorie->creer)
$categorie = new Categorie($db);
$result=$categorie->fetch($id);
- $categorie->label = $nom;
+ $categorie->label = $label;
$categorie->description = dol_htmlcleanlastbr($description);
$categorie->socid = ($socid ? $socid : 'null');
$categorie->visible = $visible;
@@ -138,13 +138,13 @@ print '
';
// Ref
print '';
print $langs->trans("Ref").' ';
-print ' ';
+print ' ';
print ' ';
// Description
print '';
-print ''.$langs->trans("Description").' ';
-print '';
+print ' '.$langs->trans("Description").' ';
+print '';
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor=new DolEditor('description',$object->description,'',200,'dolibarr_notes','',false,true,$conf->fckeditor->enabled,ROWS_6,50);
$doleditor->Create();
diff --git a/htdocs/categories/viewcat.php b/htdocs/categories/viewcat.php
index c55f324ab06..a1c544f338b 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 "
";
print "
\n";
print ''.$langs->trans("ProductsAndServices")." \n";
@@ -327,7 +327,7 @@ if ($object->type == 0)
print '';
print $prod->getNomUrl(1,'category');
print " \n";
- print ''.$prod->libelle." \n";
+ print ''.$prod->label." \n";
// Link to delete from category
print '';
$typeid=$object->type;
@@ -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/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php
index ad26b0c409d..bb0f8353709 100644
--- a/htdocs/commande/class/commande.class.php
+++ b/htdocs/commande/class/commande.class.php
@@ -1402,7 +1402,7 @@ class Commande extends CommonOrder
$line->localtax1_tx=$localtax1_tx;
$line->localtax2_tx=$localtax2_tx;
$line->ref=$prod->ref;
- $line->libelle=$prod->libelle;
+ $line->libelle=$prod->label;
$line->product_desc=$prod->description;
$line->fk_unit=$prod->fk_unit;
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/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index 77877a37cb2..567505db15a 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -91,11 +91,10 @@ abstract class CommonObject
*/
public $canvas;
-
- public $name;
- public $lastname;
- public $firstname;
- public $civility_id;
+ /**
+ *
+ * @var object Thirdparty associated with object
+ */
public $thirdparty;
// No constructor as it is an abstract class
diff --git a/htdocs/core/class/commonstickergenerator.class.php b/htdocs/core/class/commonstickergenerator.class.php
new file mode 100644
index 00000000000..1091962f6ea
--- /dev/null
+++ b/htdocs/core/class/commonstickergenerator.class.php
@@ -0,0 +1,270 @@
+
+ * Copyright (C) 2002-2003 Jean-Louis Bergamo
+ * Copyright (C) 2006-2013 Laurent Destailleur
+ * Copyright (C) 2015 Francis Appels
+ *
+ * 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 .
+ */
+
+/* Inspire de PDF_Label
+ * PDF_Label - PDF label editing
+ * @package PDF_Label
+ * @author Laurent PASSEBECQ
+ * @copyright 2003 Laurent PASSEBECQ
+ * disponible ici : http://www.fpdf.org/fr/script/script29.php
+ */
+
+//-------------------------------------------------------------------
+// VERSIONS :
+// 1.0 : Initial release
+// 1.1 : + : Added unit in the constructor
+// + : Now Positions start @ (1,1).. then the first image @top-left of a page is (1,1)
+// + : Added in the description of a label :
+// font-size : defaut char size (can be changed by calling Set_Char_Size(xx);
+// paper-size : Size of the paper for this sheet (thanx to Al Canton)
+// metric : type of unit used in this description
+// You can define your label properties in inches by setting metric to 'in'
+// and printing in millimiter by setting unit to 'mm' in constructor.
+// Added some labels :
+// 5160, 5161, 5162, 5163,5164 : thanx to Al Canton : acanton@adams-blake.com
+// 8600 : thanx to Kunal Walia : kunal@u.washington.edu
+// + : Added 3mm to the position of labels to avoid errors
+////////////////////////////////////////////////////
+
+/**
+ * \file htdocs/core/class/commonstickergenerator.class.php
+ * \ingroup core
+ * \brief generate pdf document with labels or cards in Avery or custom format
+ */
+
+require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
+require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
+require_once DOL_DOCUMENT_ROOT.'/core/lib/format_cards.lib.php';
+
+
+/**
+ * Class to generate stick sheet with format Avery or other personalised
+ */
+abstract class CommonStickerGenerator
+{
+
+ public $code; // Code of format
+ public $format; // Array with informations
+
+ // protected
+ var $_Avery_Name = ''; // Nom du format de l'etiquette
+ var $_Margin_Left = 0; // Marge de gauche de l'etiquette
+ var $_Margin_Top = 0; // marge en haut de la page avant la premiere etiquette
+ var $_X_Space = 0; // Espace horizontal entre 2 bandes d'etiquettes
+ var $_Y_Space = 0; // Espace vertical entre 2 bandes d'etiquettes
+ var $_X_Number = 0; // NX Nombre d'etiquettes sur la largeur de la page
+ var $_Y_Number = 0; // NY Nombre d'etiquettes sur la hauteur de la page
+ var $_Width = 0; // Largeur de chaque etiquette
+ var $_Height = 0; // Hauteur de chaque etiquette
+ var $_Char_Size = 10; // Hauteur des caracteres
+ var $_Line_Height = 10; // Hauteur par defaut d'une ligne
+ var $_Metric = 'mm'; // Type of metric.. Will help to calculate good values
+ var $_Metric_Doc = 'mm'; // Type of metric for the doc..
+ var $_COUNTX = 1;
+ var $_COUNTY = 1;
+ var $_First = 1;
+ var $Tformat;
+
+ /**
+ * Constructor
+ *
+ * @param DoliDB $db Database handler
+ */
+ function __construct($db)
+ {
+ $this->db = $db;
+ }
+
+ /**
+ * Function to build PDF on disk, then output on HTTP strem.
+ *
+ * @param array $arrayofrecords Array of record informations (array('textleft'=>,'textheader'=>, ..., 'id'=>,'photo'=>)
+ * @param Translate $outputlangs Lang object for output language
+ * @param string $srctemplatepath Full path of source filename for generator using a template file
+ * @param string $outputdir Output directory for pdf file
+ * @return int 1=OK, 0=KO
+ */
+ abstract function write_file($arrayofrecords,$outputlangs,$srctemplatepath,$outputdir='');
+
+ /**
+ * Output a sticker on page at position _COUNTX, _COUNTY (_COUNTX and _COUNTY start from 0)
+ *
+ * @param PDF $pdf PDF reference
+ * @param Translate $outputlangs Output langs
+ * @param array $param Associative array containing label content and optional parameters
+ * @return void
+ */
+ abstract function addSticker(&$pdf,$outputlangs,$param);
+
+ /**
+ * Methode qui permet de modifier la taille des caracteres
+ * Cela modiera aussi l'espace entre chaque ligne
+ *
+ * @param PDF $pdf PDF reference
+ * @param int $pt point
+ * @return void
+ */
+ function Set_Char_Size(&$pdf,$pt)
+ {
+ if ($pt > 3) {
+ $this->_Char_Size = $pt;
+ $this->_Line_Height = $this->_Get_Height_Chars($pt);
+ $pdf->SetFont('','',$pt);
+ }
+ }
+
+ /**
+ * protected Print dot line
+ *
+ * @param PDF $pdf PDF reference
+ * @param int $x1 X1
+ * @param int $y1 Y1
+ * @param int $x2 X2
+ * @param int $y2 Y2
+ * @param int $epaisseur Epaisseur
+ * @param int $nbPointilles Nb pointilles
+ * @return void
+ */
+ function _Pointille(&$pdf,$x1=0,$y1=0,$x2=210,$y2=297,$epaisseur=1,$nbPointilles=15)
+ {
+ $pdf->SetLineWidth($epaisseur);
+ $length=abs($x1-$x2);
+ $hauteur=abs($y1-$y2);
+ if($length>$hauteur) {
+ $Pointilles=($length/$nbPointilles)/2; // taille des pointilles
+ }
+ else {
+ $Pointilles=($hauteur/$nbPointilles)/2;
+ }
+ for($i=$x1;$i<=$x2;$i+=$Pointilles+$Pointilles) {
+ for($j=$i;$j<=($i+$Pointilles);$j++) {
+ if($j<=($x2-1)) {
+ $pdf->Line($j,$y1,$j+1,$y1); // on trace le pointill? du haut, point par point
+ $pdf->Line($j,$y2,$j+1,$y2); // on trace le pointill? du bas, point par point
+ }
+ }
+ }
+ for($i=$y1;$i<=$y2;$i+=$Pointilles+$Pointilles) {
+ for($j=$i;$j<=($i+$Pointilles);$j++) {
+ if($j<=($y2-1)) {
+ $pdf->Line($x1,$j,$x1,$j+1); // on trace le pointill? du haut, point par point
+ $pdf->Line($x2,$j,$x2,$j+1); // on trace le pointill? du bas, point par point
+ }
+ }
+ }
+ }
+
+ /**
+ * protected Function realisant une croix aux 4 coins des cartes
+ *
+ * @param PDF $pdf PDF reference
+ * @param int $x1 X1
+ * @param int $y1 Y1
+ * @param int $x2 X2
+ * @param int $y2 Y2
+ * @param int $epaisseur Epaisseur
+ * @param int $taille Size
+ * @return void
+ */
+ function _Croix(&$pdf,$x1=0,$y1=0,$x2=210,$y2=297,$epaisseur=1,$taille=4)
+ {
+ $pdf->SetDrawColor(192,192,192);
+
+ $pdf->SetLineWidth($epaisseur);
+ $lg=$taille/2;
+ // croix haut gauche
+ $pdf->Line($x1,$y1-$lg,$x1,$y1+$lg);
+ $pdf->Line($x1-$lg,$y1,$x1+$lg,$y1);
+ // croix bas gauche
+ $pdf->Line($x1,$y2-$lg,$x1,$y2+$lg);
+ $pdf->Line($x1-$lg,$y2,$x1+$lg,$y2);
+ // croix haut droit
+ $pdf->Line($x2,$y1-$lg,$x2,$y1+$lg);
+ $pdf->Line($x2-$lg,$y1,$x2+$lg,$y1);
+ // croix bas droit
+ $pdf->Line($x2,$y2-$lg,$x2,$y2+$lg);
+ $pdf->Line($x2-$lg,$y2,$x2+$lg,$y2);
+
+ $pdf->SetDrawColor(0,0,0);
+ }
+
+ /**
+ * protected Convert units (in to mm, mm to in)
+ * $src and $dest must be 'in' or 'mm'
+ *
+ * @param int $value value
+ * @param string $src from
+ * @param string $dest to
+ * @return float value value after conversion
+ */
+ function _Convert_Metric ($value, $src, $dest)
+ {
+ if ($src != $dest) {
+ $tab['in'] = 39.37008;
+ $tab['mm'] = 1000;
+ return $value * $tab[$dest] / $tab[$src];
+ } else {
+ return $value;
+ }
+ }
+
+ /**
+ * protected Give the height for a char size given.
+ *
+ * @param int $pt Point
+ * @return int Height chars
+ */
+ function _Get_Height_Chars($pt)
+ {
+ // Tableau de concordance entre la hauteur des caracteres et de l'espacement entre les lignes
+ $_Table_Hauteur_Chars = array(6=>2, 7=>2.5, 8=>3, 9=>3.5, 10=>4, 11=>6, 12=>7, 13=>8, 14=>9, 15=>10);
+ if (in_array($pt, array_keys($_Table_Hauteur_Chars))) {
+ return $_Table_Hauteur_Chars[$pt];
+ } else {
+ return 100; // There is a prob..
+ }
+ }
+
+ /**
+ * protected Set format
+ *
+ * @param PDF $pdf PDF reference
+ * @param string $format Format
+ * @return void
+ */
+ function _Set_Format(&$pdf, $format)
+ {
+ $this->_Metric = $format['metric'];
+ $this->_Avery_Name = $format['name'];
+ $this->_Avery_Code = $format['code'];
+ $this->_Margin_Left = $this->_Convert_Metric($format['marginLeft'], $this->_Metric, $this->_Metric_Doc);
+ $this->_Margin_Top = $this->_Convert_Metric($format['marginTop'], $this->_Metric, $this->_Metric_Doc);
+ $this->_X_Space = $this->_Convert_Metric($format['SpaceX'], $this->_Metric, $this->_Metric_Doc);
+ $this->_Y_Space = $this->_Convert_Metric($format['SpaceY'], $this->_Metric, $this->_Metric_Doc);
+ $this->_X_Number = $format['NX'];
+ $this->_Y_Number = $format['NY'];
+ $this->_Width = $this->_Convert_Metric($format['width'], $this->_Metric, $this->_Metric_Doc);
+ $this->_Height = $this->_Convert_Metric($format['height'], $this->_Metric, $this->_Metric_Doc);
+ $this->Set_Char_Size($pdf, $format['font-size']);
+ }
+
+}
diff --git a/htdocs/core/class/doleditor.class.php b/htdocs/core/class/doleditor.class.php
index 0839639217f..f95924929bb 100644
--- a/htdocs/core/class/doleditor.class.php
+++ b/htdocs/core/class/doleditor.class.php
@@ -160,7 +160,7 @@ class DolEditor
{
$found=1;
//$out.= '