FIX Ref/label of product on contract line was not visible, nor into
page, nor into PDF.
This commit is contained in:
parent
83daa67cc6
commit
060d8a1a38
@ -36,8 +36,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/contract.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/modules/contract/modules_contract.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formfile.class.php';
|
||||
if (! empty($conf->produit->enabled) || ! empty($conf->service->enabled)) require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
||||
if (! empty($conf->propal->enabled)) require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
|
||||
if (! empty($conf->projet->enabled)) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
||||
@ -1240,9 +1240,7 @@ else
|
||||
* Lines of contracts
|
||||
*/
|
||||
|
||||
if ($conf->product->enabled || $conf->service->enabled) {
|
||||
$productstatic=new Product($db);
|
||||
}
|
||||
$productstatic=new Product($db);
|
||||
|
||||
$usemargins=0;
|
||||
if (! empty($conf->margin->enabled) && ! empty($object->element) && in_array($object->element,array('facture','propal','commande'))) $usemargins=1;
|
||||
|
||||
@ -260,8 +260,8 @@ class Contrat extends CommonObject
|
||||
/**
|
||||
* Activate a contract line
|
||||
*
|
||||
* @param User $user Objet User qui active le contrat
|
||||
* @param int $line_id Id de la ligne de detail a activer
|
||||
* @param User $user Objet User who activate contract
|
||||
* @param int $line_id Id of line to activate
|
||||
* @param int $date Date d'ouverture
|
||||
* @param int|string $date_end Date fin prevue
|
||||
* @param string $comment A comment typed by user
|
||||
@ -307,9 +307,9 @@ class Contrat extends CommonObject
|
||||
/**
|
||||
* Close a contract line
|
||||
*
|
||||
* @param User $user Objet User qui active le contrat
|
||||
* @param int $line_id Id de la ligne de detail a activer
|
||||
* @param int $date_end Date fin
|
||||
* @param User $user Objet User who close contract
|
||||
* @param int $line_id Id of line to close
|
||||
* @param int $date_end Date end
|
||||
* @param string $comment A comment typed by user
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
@ -600,7 +600,7 @@ class Contrat extends CommonObject
|
||||
$result=$this->fetch_lines();
|
||||
if ($result < 0)
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
$this->error=$this->db->lasterror();
|
||||
return -3;
|
||||
}
|
||||
|
||||
@ -623,7 +623,7 @@ class Contrat extends CommonObject
|
||||
}
|
||||
|
||||
/**
|
||||
* Load lignes array into this->lines
|
||||
* Load lines array into this->lines
|
||||
*
|
||||
* @return ContratLigne[] Return array of contract lines
|
||||
*/
|
||||
@ -643,7 +643,7 @@ class Contrat extends CommonObject
|
||||
$this->lines=array();
|
||||
|
||||
// Selectionne les lignes contrats liees a un produit
|
||||
$sql = "SELECT p.label, p.description as product_desc, p.ref,";
|
||||
$sql = "SELECT p.label as product_label, p.description as product_desc, p.ref as product_ref,";
|
||||
$sql.= " d.rowid, d.fk_contrat, d.statut, d.description, d.price_ht, d.tva_tx, d.localtax1_tx, d.localtax2_tx, d.qty, d.remise_percent, d.subprice, d.fk_product_fournisseur_price as fk_fournprice, d.buy_price_ht as pa_ht,";
|
||||
$sql.= " d.total_ht,";
|
||||
$sql.= " d.total_tva,";
|
||||
@ -701,10 +701,12 @@ class Contrat extends CommonObject
|
||||
$line->fk_user_ouverture= $objp->fk_user_ouverture;
|
||||
$line->fk_user_cloture = $objp->fk_user_cloture;
|
||||
|
||||
$line->ref = $objp->ref;
|
||||
$line->libelle = $objp->label; // Label produit
|
||||
$line->label = $objp->label; // For backward compatibility
|
||||
$line->product_desc = $objp->product_desc; // Description produit
|
||||
$line->ref = $objp->product_ref; // deprecated
|
||||
$line->label = $objp->product_label; // deprecated
|
||||
$line->libelle = $objp->product_label; // deprecated
|
||||
$line->product_ref = $objp->product_ref; // Ref product
|
||||
$line->product_desc = $objp->product_desc; // Description product
|
||||
$line->product_label = $objp->product_label; // Label product
|
||||
|
||||
$line->description = $objp->description;
|
||||
|
||||
@ -2245,7 +2247,10 @@ class ContratLigne extends CommonObject
|
||||
$sql.= " t.fk_contrat,";
|
||||
$sql.= " t.fk_product,";
|
||||
$sql.= " t.statut,";
|
||||
$sql.= " t.label,";
|
||||
$sql.= " t.label,"; // This field is not used. Only label of product
|
||||
$sql.= " p.ref as product_ref,";
|
||||
$sql.= " p.label as product_label,";
|
||||
$sql.= " p.description as product_desc,";
|
||||
$sql.= " t.description,";
|
||||
$sql.= " t.date_commande,";
|
||||
$sql.= " t.date_ouverture_prevue as date_ouverture_prevue,";
|
||||
@ -2273,7 +2278,7 @@ class ContratLigne extends CommonObject
|
||||
$sql.= " t.fk_user_ouverture,";
|
||||
$sql.= " t.fk_user_cloture,";
|
||||
$sql.= " t.commentaire";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."contratdet as t";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."contratdet as t LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = t.fk_product";
|
||||
if ($id) $sql.= " WHERE t.rowid = ".$id;
|
||||
if ($ref) $sql.= " WHERE t.rowid = '".$this->db->escape($ref)."'";
|
||||
|
||||
@ -2292,7 +2297,10 @@ class ContratLigne extends CommonObject
|
||||
$this->fk_contrat = $obj->fk_contrat;
|
||||
$this->fk_product = $obj->fk_product;
|
||||
$this->statut = $obj->statut;
|
||||
$this->label = $obj->label;
|
||||
$this->product_ref = $obj->product_ref;
|
||||
$this->product_label = $obj->product_label;
|
||||
$this->product_description = $obj->product_description;
|
||||
$this->label = $obj->label; // deprecated. We do not use this field. Only ref and label of product, and description of contract line
|
||||
$this->description = $obj->description;
|
||||
$this->date_commande = $this->db->jdate($obj->date_commande);
|
||||
$this->date_ouverture_prevue = $this->db->jdate($obj->date_ouverture_prevue);
|
||||
|
||||
@ -30,6 +30,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/modules/contract/modules_contract.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
||||
|
||||
|
||||
/**
|
||||
@ -253,6 +254,7 @@ class pdf_strato extends ModelePDFContract
|
||||
$objectligne = $object->lines[$i];
|
||||
|
||||
$valide = $objectligne->id ? $objectligne->fetch($objectligne->id) : 0;
|
||||
|
||||
if ($valide > 0 || $object->specimen)
|
||||
{
|
||||
$curX = $this->posxdesc-1;
|
||||
@ -278,12 +280,20 @@ class pdf_strato extends ModelePDFContract
|
||||
$durationi = $langs->trans("Unknown");
|
||||
}
|
||||
|
||||
$txtpredefinedservice='';
|
||||
$txtpredefinedservice = $objectligne->product_ref;
|
||||
if ($objectligne->product_label)
|
||||
{
|
||||
$txtpredefinedservice .= ' - ';
|
||||
$txtpredefinedservice .= $objectligne->product_label;
|
||||
}
|
||||
|
||||
$txt='<strong>'.dol_htmlentitiesbr($outputlangs->transnoentities("Date")." : ".$datei." - ".$outputlangs->transnoentities("Duration")." : ".$durationi,1,$outputlangs->charset_output).'</strong>';
|
||||
$desc=dol_htmlentitiesbr($objectligne->desc,1);
|
||||
|
||||
$pdf->writeHTMLCell(0, 0, $curX, $curY, dol_concatdesc($txt,$desc), 0, 1, 0);
|
||||
$pdf->writeHTMLCell(0, 0, $curX, $curY, dol_concatdesc($txt,dol_concatdesc($txtpredefinedservice,$desc)), 0, 1, 0);
|
||||
|
||||
$nexY = $pdf->GetY();
|
||||
$nexY = $pdf->GetY() + 2;
|
||||
$pageposafter=$pdf->getPage();
|
||||
$pdf->setPage($pageposbefore);
|
||||
$pdf->setTopMargin($this->marge_haute);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user