mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-12 20:41:26 +01:00
fix cti (#29813)
* fix cti * fix cti * no photo in asset lines * no photo in asset lines * no photo in asset lines * no photo in asset lines * no photo in recruitment lines * no photo in recruitment lines * fix * fix dead catch
This commit is contained in:
@@ -3654,7 +3654,7 @@ class Propal extends CommonObject
|
|||||||
}
|
}
|
||||||
if ($user->hasRight('propal', 'lire')) {
|
if ($user->hasRight('propal', 'lire')) {
|
||||||
$datas['picto'] = img_picto('', $this->picto).' <u class="paddingrightonly">'.$langs->trans("Proposal").'</u>';
|
$datas['picto'] = img_picto('', $this->picto).' <u class="paddingrightonly">'.$langs->trans("Proposal").'</u>';
|
||||||
if (isset($this->statut)) {
|
if (isset($this->status)) {
|
||||||
$datas['status'] = ' '.$this->getLibStatut(5);
|
$datas['status'] = ' '.$this->getLibStatut(5);
|
||||||
}
|
}
|
||||||
if (!empty($this->ref)) {
|
if (!empty($this->ref)) {
|
||||||
@@ -3674,7 +3674,7 @@ class Propal extends CommonObject
|
|||||||
$langs->load('project');
|
$langs->load('project');
|
||||||
if (empty($this->project)) {
|
if (empty($this->project)) {
|
||||||
$res = $this->fetch_project();
|
$res = $this->fetch_project();
|
||||||
if ($res > 0 && $this->project instanceof Project) {
|
if ($res > 0 && !empty($this->project) && $this->project instanceof Project) {
|
||||||
$datas['project'] = '<br><b>'.$langs->trans('Project').':</b> '.$this->project->getNomUrl(1, '', 0, 1);
|
$datas['project'] = '<br><b>'.$langs->trans('Project').':</b> '.$this->project->getNomUrl(1, '', 0, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3756,7 +3756,7 @@ class Commande extends CommonOrder
|
|||||||
$langs->load('project');
|
$langs->load('project');
|
||||||
if (empty($this->project)) {
|
if (empty($this->project)) {
|
||||||
$res = $this->fetch_project();
|
$res = $this->fetch_project();
|
||||||
if ($res > 0 && $this->project instanceof Project) {
|
if ($res > 0 && !empty($this->project) && $this->project instanceof Project) {
|
||||||
$datas['project'] = '<br><b>'.$langs->trans('Project').':</b> '.$this->project->getNomUrl(1, '', 0, 1);
|
$datas['project'] = '<br><b>'.$langs->trans('Project').':</b> '.$this->project->getNomUrl(1, '', 0, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2086,9 +2086,9 @@ class Contrat extends CommonObject
|
|||||||
$datas['refcustomer'] = '<br><b>'.$langs->trans('RefCustomer').':</b> '. $this->ref_customer;
|
$datas['refcustomer'] = '<br><b>'.$langs->trans('RefCustomer').':</b> '. $this->ref_customer;
|
||||||
if (!$nofetch) {
|
if (!$nofetch) {
|
||||||
$langs->load('project');
|
$langs->load('project');
|
||||||
if (empty($this->project) && $this->project instanceof Project) {
|
if (empty($this->project)) {
|
||||||
$res = $this->fetch_project();
|
$res = $this->fetch_project();
|
||||||
if ($res > 0) {
|
if ($res > 0 && !empty($this->project) && $this->project instanceof Project) {
|
||||||
$datas['project'] = '<br><b>'.$langs->trans('Project').':</b> '.$this->project->getNomUrl(1, '', 0, 1);
|
$datas['project'] = '<br><b>'.$langs->trans('Project').':</b> '.$this->project->getNomUrl(1, '', 0, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
/* Copyright (C) 2011-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
/* Copyright (C) 2011-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2011-2012 Regis Houssin <regis.houssin@inodbox.com>
|
* Copyright (C) 2011-2012 Regis Houssin <regis.houssin@inodbox.com>
|
||||||
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
|
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
|
||||||
|
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
@@ -187,7 +187,7 @@ class doc_generic_asset_odt extends ModelePDFAsset
|
|||||||
/**
|
/**
|
||||||
* Function to build a document on disk using the generic odt module.
|
* Function to build a document on disk using the generic odt module.
|
||||||
*
|
*
|
||||||
* @param Asset $object Object source to build document
|
* @param Asset $object Object source to build document
|
||||||
* @param Translate $outputlangs Lang output object
|
* @param Translate $outputlangs Lang output object
|
||||||
* @param string $srctemplatepath Full path of source filename for generator using a template file
|
* @param string $srctemplatepath Full path of source filename for generator using a template file
|
||||||
* @param int $hidedetails Do not show line details
|
* @param int $hidedetails Do not show line details
|
||||||
|
|||||||
@@ -141,7 +141,7 @@ class pdf_standard_asset extends ModelePDFAsset
|
|||||||
/**
|
/**
|
||||||
* Function to build pdf onto disk
|
* Function to build pdf onto disk
|
||||||
*
|
*
|
||||||
* @param Object $object Object to generate
|
* @param Asset $object Object to generate
|
||||||
* @param Translate $outputlangs Lang output object
|
* @param Translate $outputlangs Lang output object
|
||||||
* @param string $srctemplatepath Full path of source filename for generator using a template file
|
* @param string $srctemplatepath Full path of source filename for generator using a template file
|
||||||
* @param int $hidedetails Do not show line details
|
* @param int $hidedetails Do not show line details
|
||||||
@@ -181,62 +181,6 @@ class pdf_standard_asset extends ModelePDFAsset
|
|||||||
$hidetop = getDolGlobalString('MAIN_PDF_DISABLE_COL_HEAD_TITLE');
|
$hidetop = getDolGlobalString('MAIN_PDF_DISABLE_COL_HEAD_TITLE');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Loop on each lines to detect if there is at least one image to show
|
|
||||||
$realpatharray = array();
|
|
||||||
$this->atleastonephoto = false;
|
|
||||||
/*
|
|
||||||
if (!empty($conf->global->MAIN_GENERATE_ASSET_WITH_PICTURE))
|
|
||||||
{
|
|
||||||
$objphoto = new Product($this->db);
|
|
||||||
|
|
||||||
for ($i = 0; $i < $nblines; $i++)
|
|
||||||
{
|
|
||||||
if (empty($object->lines[$i]->fk_product)) continue;
|
|
||||||
|
|
||||||
//var_dump($objphoto->ref);exit;
|
|
||||||
if (getDolGlobalInt('PRODUCT_USE_OLD_PATH_FOR_PHOTO')) {
|
|
||||||
$pdir[0] = get_exdir($objphoto->id, 2, 0, 0, $objphoto, 'product').$objphoto->id."/photos/";
|
|
||||||
$pdir[1] = get_exdir(0, 0, 0, 0, $objphoto, 'product').dol_sanitizeFileName($objphoto->ref).'/';
|
|
||||||
} else {
|
|
||||||
$pdir[0] = get_exdir(0, 0, 0, 0, $objphoto, 'product'); // default
|
|
||||||
$pdir[1] = get_exdir($objphoto->id, 2, 0, 0, $objphoto, 'product').$objphoto->id."/photos/"; // alternative
|
|
||||||
}
|
|
||||||
|
|
||||||
$arephoto = false;
|
|
||||||
foreach ($pdir as $midir)
|
|
||||||
{
|
|
||||||
if (!$arephoto)
|
|
||||||
{
|
|
||||||
$dir = $conf->product->dir_output.'/'.$midir;
|
|
||||||
|
|
||||||
foreach ($objphoto->liste_photos($dir, 1) as $key => $obj)
|
|
||||||
{
|
|
||||||
if (!getDolGlobalInt('CAT_HIGH_QUALITY_IMAGES')) // If CAT_HIGH_QUALITY_IMAGES not defined, we use thumb if defined and then original photo
|
|
||||||
{
|
|
||||||
if ($obj['photo_vignette'])
|
|
||||||
{
|
|
||||||
$filename = $obj['photo_vignette'];
|
|
||||||
} else {
|
|
||||||
$filename = $obj['photo'];
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$filename = $obj['photo'];
|
|
||||||
}
|
|
||||||
|
|
||||||
$realpath = $dir.$filename;
|
|
||||||
$arephoto = true;
|
|
||||||
$this->atleastonephoto = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($realpath && $arephoto) $realpatharray[$i] = $realpath;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
//if (count($realpatharray) == 0) $this->posxpicture=$this->posxtva;
|
|
||||||
|
|
||||||
if ($conf->asset->dir_output.'/asset') {
|
if ($conf->asset->dir_output.'/asset') {
|
||||||
$object->fetch_thirdparty();
|
$object->fetch_thirdparty();
|
||||||
|
|
||||||
@@ -495,12 +439,6 @@ class pdf_standard_asset extends ModelePDFAsset
|
|||||||
$pdf->SetFont('', '', $default_font_size - 1); // Into loop to work with multipage
|
$pdf->SetFont('', '', $default_font_size - 1); // Into loop to work with multipage
|
||||||
$pdf->SetTextColor(0, 0, 0);
|
$pdf->SetTextColor(0, 0, 0);
|
||||||
|
|
||||||
// Define size of image if we need it
|
|
||||||
$imglinesize = array();
|
|
||||||
if (!empty($realpatharray[$i])) {
|
|
||||||
$imglinesize = pdf_getSizeForImage($realpatharray[$i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
$pdf->setTopMargin($tab_top_newpage);
|
$pdf->setTopMargin($tab_top_newpage);
|
||||||
$pdf->setPageOrientation('', 1, $heightforfooter + $heightforfreetext + $heightforinfotot); // The only function to edit the bottom margin of current page to set it.
|
$pdf->setPageOrientation('', 1, $heightforfooter + $heightforfreetext + $heightforinfotot); // The only function to edit the bottom margin of current page to set it.
|
||||||
$pageposbefore = $pdf->getPage();
|
$pageposbefore = $pdf->getPage();
|
||||||
@@ -508,32 +446,6 @@ class pdf_standard_asset extends ModelePDFAsset
|
|||||||
$showpricebeforepagebreak = 1;
|
$showpricebeforepagebreak = 1;
|
||||||
$posYAfterImage = 0;
|
$posYAfterImage = 0;
|
||||||
|
|
||||||
if ($this->getColumnStatus('photo')) {
|
|
||||||
// We start with Photo of product line
|
|
||||||
if (isset($imglinesize['width']) && isset($imglinesize['height']) && ($curY + $imglinesize['height']) > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) { // If photo too high, we moved completely on new page
|
|
||||||
$pdf->AddPage('', '', true);
|
|
||||||
if (!empty($tplidx)) {
|
|
||||||
$pdf->useTemplate($tplidx);
|
|
||||||
}
|
|
||||||
$pdf->setPage($pageposbefore + 1);
|
|
||||||
|
|
||||||
$curY = $tab_top_newpage;
|
|
||||||
|
|
||||||
// Allows data in the first page if description is long enough to break in multiples pages
|
|
||||||
if (getDolGlobalString('MAIN_PDF_DATA_ON_FIRST_PAGE')) {
|
|
||||||
$showpricebeforepagebreak = 1;
|
|
||||||
} else {
|
|
||||||
$showpricebeforepagebreak = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($this->cols['photo']) && isset($imglinesize['width']) && isset($imglinesize['height'])) {
|
|
||||||
$pdf->Image($realpatharray[$i], $this->getColumnContentXStart('photo'), $curY, $imglinesize['width'], $imglinesize['height'], '', '', '', 2, 300); // Use 300 dpi
|
|
||||||
// $pdf->Image does not increase value return by getY, so we save it manually
|
|
||||||
$posYAfterImage = $curY + $imglinesize['height'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Description of product line
|
// Description of product line
|
||||||
if ($this->getColumnStatus('desc')) {
|
if ($this->getColumnStatus('desc')) {
|
||||||
$pdf->startTransaction();
|
$pdf->startTransaction();
|
||||||
@@ -578,7 +490,7 @@ class pdf_standard_asset extends ModelePDFAsset
|
|||||||
$pdf->setTopMargin($this->marge_haute);
|
$pdf->setTopMargin($this->marge_haute);
|
||||||
$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
|
$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
|
||||||
|
|
||||||
// We suppose that a too long description or photo were moved completely on next page
|
// We suppose that a too long description were moved completely on next page
|
||||||
if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) {
|
if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) {
|
||||||
$pdf->setPage($pageposafter);
|
$pdf->setPage($pageposafter);
|
||||||
$curY = $tab_top_newpage;
|
$curY = $tab_top_newpage;
|
||||||
@@ -872,7 +784,7 @@ class pdf_standard_asset extends ModelePDFAsset
|
|||||||
* Show top header of page.
|
* Show top header of page.
|
||||||
*
|
*
|
||||||
* @param TCPDF|TCPDI $pdf Object PDF
|
* @param TCPDF|TCPDI $pdf Object PDF
|
||||||
* @param Object $object Object to show
|
* @param Asset $object Object to show
|
||||||
* @param int $showaddress 0=no, 1=yes
|
* @param int $showaddress 0=no, 1=yes
|
||||||
* @param Translate $outputlangs Object lang for output
|
* @param Translate $outputlangs Object lang for output
|
||||||
* @param Translate $outputlangsbis Object lang for output bis
|
* @param Translate $outputlangsbis Object lang for output bis
|
||||||
@@ -890,7 +802,7 @@ class pdf_standard_asset extends ModelePDFAsset
|
|||||||
pdf_pagehead($pdf, $outputlangs, $this->page_hauteur);
|
pdf_pagehead($pdf, $outputlangs, $this->page_hauteur);
|
||||||
|
|
||||||
// Show Draft Watermark
|
// Show Draft Watermark
|
||||||
if ($object->statut == $object::STATUS_DRAFT && (getDolGlobalString('FACTURE_DRAFT_WATERMARK'))) {
|
if ($object->status == $object::STATUS_DRAFT && (getDolGlobalString('FACTURE_DRAFT_WATERMARK'))) {
|
||||||
pdf_watermark($pdf, $outputlangs, $this->page_hauteur, $this->page_largeur, 'mm', $conf->global->FACTURE_DRAFT_WATERMARK);
|
pdf_watermark($pdf, $outputlangs, $this->page_hauteur, $this->page_largeur, 'mm', $conf->global->FACTURE_DRAFT_WATERMARK);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -947,7 +859,7 @@ class pdf_standard_asset extends ModelePDFAsset
|
|||||||
$pdf->SetXY($posx, $posy);
|
$pdf->SetXY($posx, $posy);
|
||||||
$pdf->SetTextColor(0, 0, 60);
|
$pdf->SetTextColor(0, 0, 60);
|
||||||
$textref = $outputlangs->transnoentities("Ref")." : ".$outputlangs->convToOutputCharset($object->ref);
|
$textref = $outputlangs->transnoentities("Ref")." : ".$outputlangs->convToOutputCharset($object->ref);
|
||||||
if ($object->statut == $object::STATUS_DRAFT) {
|
if ($object->status == $object::STATUS_DRAFT) {
|
||||||
$pdf->SetTextColor(128, 0, 0);
|
$pdf->SetTextColor(128, 0, 0);
|
||||||
$textref .= ' - '.$outputlangs->transnoentities("NotValidated");
|
$textref .= ' - '.$outputlangs->transnoentities("NotValidated");
|
||||||
}
|
}
|
||||||
@@ -956,12 +868,12 @@ class pdf_standard_asset extends ModelePDFAsset
|
|||||||
$posy += 1;
|
$posy += 1;
|
||||||
$pdf->SetFont('', '', $default_font_size - 2);
|
$pdf->SetFont('', '', $default_font_size - 2);
|
||||||
|
|
||||||
if ($object->ref_client) {
|
// if ($object->ref_client) {
|
||||||
$posy += 4;
|
// $posy += 4;
|
||||||
$pdf->SetXY($posx, $posy);
|
// $pdf->SetXY($posx, $posy);
|
||||||
$pdf->SetTextColor(0, 0, 60);
|
// $pdf->SetTextColor(0, 0, 60);
|
||||||
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("RefCustomer")." : ".$outputlangs->convToOutputCharset($object->ref_client), '', 'R');
|
// $pdf->MultiCell($w, 3, $outputlangs->transnoentities("RefCustomer")." : ".$outputlangs->convToOutputCharset($object->ref_client), '', 'R');
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (getDolGlobalString('PDF_SHOW_PROJECT_TITLE')) {
|
if (getDolGlobalString('PDF_SHOW_PROJECT_TITLE')) {
|
||||||
$object->fetch_projet();
|
$object->fetch_projet();
|
||||||
@@ -992,7 +904,7 @@ class pdf_standard_asset extends ModelePDFAsset
|
|||||||
if (getDolGlobalString('PDF_USE_ALSO_LANGUAGE_CODE') && is_object($outputlangsbis)) {
|
if (getDolGlobalString('PDF_USE_ALSO_LANGUAGE_CODE') && is_object($outputlangsbis)) {
|
||||||
$title .= ' - '.$outputlangsbis->transnoentities("Date");
|
$title .= ' - '.$outputlangsbis->transnoentities("Date");
|
||||||
}
|
}
|
||||||
$pdf->MultiCell($w, 3, $title." : ".dol_print_date($object->date, "day", false, $outputlangs), '', 'R');
|
$pdf->MultiCell($w, 3, $title." : ".dol_print_date($object->date_acquisition, "day", false, $outputlangs), '', 'R');
|
||||||
|
|
||||||
if ($object->thirdparty->code_client) {
|
if ($object->thirdparty->code_client) {
|
||||||
$posy += 3;
|
$posy += 3;
|
||||||
@@ -1124,7 +1036,7 @@ class pdf_standard_asset extends ModelePDFAsset
|
|||||||
* Show footer of page. Need this->emetteur object
|
* Show footer of page. Need this->emetteur object
|
||||||
*
|
*
|
||||||
* @param TCPDF $pdf PDF
|
* @param TCPDF $pdf PDF
|
||||||
* @param Object $object Object to show
|
* @param Asset $object Object to show
|
||||||
* @param Translate $outputlangs Object lang for output
|
* @param Translate $outputlangs Object lang for output
|
||||||
* @param int $hidefreetext 1=Hide free text
|
* @param int $hidefreetext 1=Hide free text
|
||||||
* @return int Return height of bottom margin including footer text
|
* @return int Return height of bottom margin including footer text
|
||||||
@@ -1138,11 +1050,11 @@ class pdf_standard_asset extends ModelePDFAsset
|
|||||||
/**
|
/**
|
||||||
* Define Array Column Field
|
* Define Array Column Field
|
||||||
*
|
*
|
||||||
* @param object $object common object
|
* @param Asset $object common object
|
||||||
* @param Translate $outputlangs langs
|
* @param Translate $outputlangs langs
|
||||||
* @param int $hidedetails Do not show line details
|
* @param int $hidedetails Do not show line details
|
||||||
* @param int $hidedesc Do not show desc
|
* @param int $hidedesc Do not show desc
|
||||||
* @param int $hideref Do not show ref
|
* @param int $hideref Do not show ref
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0)
|
public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0)
|
||||||
@@ -1197,27 +1109,6 @@ class pdf_standard_asset extends ModelePDFAsset
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
// PHOTO
|
|
||||||
$rank = $rank + 10;
|
|
||||||
$this->cols['photo'] = array(
|
|
||||||
'rank' => $rank,
|
|
||||||
'width' => getDolGlobalInt('MAIN_DOCUMENTS_WITH_PICTURE_WIDTH', 20), // in mm
|
|
||||||
'status' => false,
|
|
||||||
'title' => array(
|
|
||||||
'textkey' => 'Photo',
|
|
||||||
'label' => ' '
|
|
||||||
),
|
|
||||||
'content' => array(
|
|
||||||
'padding' => array(0, 0, 0, 0), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
|
|
||||||
),
|
|
||||||
'border-left' => false, // remove left line separator
|
|
||||||
);
|
|
||||||
|
|
||||||
if (getDolGlobalString('MAIN_GENERATE_INVOICES_WITH_PICTURE') && !empty($this->atleastonephoto)) {
|
|
||||||
$this->cols['photo']['status'] = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
$rank = $rank + 10;
|
$rank = $rank + 10;
|
||||||
$this->cols['vat'] = array(
|
$this->cols['vat'] = array(
|
||||||
'rank' => $rank,
|
'rank' => $rank,
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
|
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
|
||||||
* Copyright (C) 2016 Charlie Benke <charlie@patas-monkey.com>
|
* Copyright (C) 2016 Charlie Benke <charlie@patas-monkey.com>
|
||||||
* Copyright (C) 2018-2019 Philippe Grand <philippe.grand@atoo-net.com>
|
* Copyright (C) 2018-2019 Philippe Grand <philippe.grand@atoo-net.com>
|
||||||
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
|
* Copyright (C) 2018-2024 Frédéric France <frederic.france@free.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -395,55 +395,55 @@ class doc_generic_bom_odt extends ModelePDFBom
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Replace tags of lines
|
// Replace tags of lines
|
||||||
|
$foundtagforlines = 1;
|
||||||
try {
|
try {
|
||||||
$foundtagforlines = 1;
|
$listlines = $odfHandler->setSegment('lines');
|
||||||
try {
|
} catch (OdfExceptionSegmentNotFound $e) {
|
||||||
$listlines = $odfHandler->setSegment('lines');
|
// We may arrive here if tags for lines not present into template
|
||||||
} catch (OdfExceptionSegmentNotFound $e) {
|
$foundtagforlines = 0;
|
||||||
// We may arrive here if tags for lines not present into template
|
dol_syslog($e->getMessage(), LOG_INFO);
|
||||||
$foundtagforlines = 0;
|
|
||||||
dol_syslog($e->getMessage(), LOG_INFO);
|
|
||||||
} catch (OdfException $e) {
|
|
||||||
$foundtagforlines = 0;
|
|
||||||
dol_syslog($e->getMessage(), LOG_INFO);
|
|
||||||
}
|
|
||||||
if ($foundtagforlines) {
|
|
||||||
$linenumber = 0;
|
|
||||||
foreach ($object->lines as $line) {
|
|
||||||
$linenumber++;
|
|
||||||
|
|
||||||
if ($line->fk_product > 0) {
|
|
||||||
$line->fetch_product();
|
|
||||||
|
|
||||||
$line->product_ref = $line->product->ref;
|
|
||||||
$line->product_desc = $line->product->description;
|
|
||||||
$line->product_label = $line->product->label;
|
|
||||||
$line->product_type = $line->product->type;
|
|
||||||
$line->product_barcode = $line->product->barcode;
|
|
||||||
}
|
|
||||||
|
|
||||||
$tmparray = $this->get_substitutionarray_lines($line, $outputlangs, $linenumber);
|
|
||||||
complete_substitutions_array($tmparray, $outputlangs, $object, $line, "completesubstitutionarray_lines");
|
|
||||||
// Call the ODTSubstitutionLine hook
|
|
||||||
$parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray, 'line'=>$line);
|
|
||||||
$reshook = $hookmanager->executeHooks('ODTSubstitutionLine', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
|
|
||||||
foreach ($tmparray as $key => $val) {
|
|
||||||
try {
|
|
||||||
$listlines->setVars($key, $val, true, 'UTF-8');
|
|
||||||
} catch (OdfException $e) {
|
|
||||||
dol_syslog($e->getMessage(), LOG_INFO);
|
|
||||||
} catch (SegmentException $e) {
|
|
||||||
dol_syslog($e->getMessage(), LOG_INFO);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$listlines->merge();
|
|
||||||
}
|
|
||||||
$odfHandler->mergeSegment($listlines);
|
|
||||||
}
|
|
||||||
} catch (OdfException $e) {
|
} catch (OdfException $e) {
|
||||||
$this->error = $e->getMessage();
|
$foundtagforlines = 0;
|
||||||
dol_syslog($this->error, LOG_WARNING);
|
dol_syslog($e->getMessage(), LOG_INFO);
|
||||||
return -1;
|
}
|
||||||
|
if ($foundtagforlines) {
|
||||||
|
$linenumber = 0;
|
||||||
|
foreach ($object->lines as $line) {
|
||||||
|
$linenumber++;
|
||||||
|
|
||||||
|
if ($line->fk_product > 0) {
|
||||||
|
$line->fetch_product();
|
||||||
|
|
||||||
|
$line->product_ref = $line->product->ref;
|
||||||
|
$line->product_desc = $line->product->description;
|
||||||
|
$line->product_label = $line->product->label;
|
||||||
|
$line->product_type = $line->product->type;
|
||||||
|
$line->product_barcode = $line->product->barcode;
|
||||||
|
}
|
||||||
|
|
||||||
|
$tmparray = $this->get_substitutionarray_lines($line, $outputlangs, $linenumber);
|
||||||
|
complete_substitutions_array($tmparray, $outputlangs, $object, $line, "completesubstitutionarray_lines");
|
||||||
|
// Call the ODTSubstitutionLine hook
|
||||||
|
$parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray, 'line'=>$line);
|
||||||
|
$reshook = $hookmanager->executeHooks('ODTSubstitutionLine', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
|
||||||
|
foreach ($tmparray as $key => $val) {
|
||||||
|
try {
|
||||||
|
$listlines->setVars($key, $val, true, 'UTF-8');
|
||||||
|
} catch (OdfException $e) {
|
||||||
|
dol_syslog($e->getMessage(), LOG_INFO);
|
||||||
|
} catch (SegmentException $e) {
|
||||||
|
dol_syslog($e->getMessage(), LOG_INFO);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$listlines->merge();
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
$odfHandler->mergeSegment($listlines);
|
||||||
|
} catch (OdfException $e) {
|
||||||
|
$this->error = $e->getMessage();
|
||||||
|
dol_syslog($this->error, LOG_WARNING);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Replace labels translated
|
// Replace labels translated
|
||||||
|
|||||||
@@ -219,63 +219,6 @@ class pdf_standard_recruitmentjobposition extends ModelePDFRecruitmentJobPositio
|
|||||||
$hidetop = getDolGlobalString('MAIN_PDF_DISABLE_COL_HEAD_TITLE');
|
$hidetop = getDolGlobalString('MAIN_PDF_DISABLE_COL_HEAD_TITLE');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Loop on each lines to detect if there is at least one image to show
|
|
||||||
$realpatharray = array();
|
|
||||||
// $this->atleastonephoto = false;
|
|
||||||
/*
|
|
||||||
if (!empty($conf->global->MAIN_GENERATE_MYOBJECT_WITH_PICTURE))
|
|
||||||
{
|
|
||||||
$objphoto = new Product($this->db);
|
|
||||||
|
|
||||||
for ($i = 0; $i < $nblines; $i++)
|
|
||||||
{
|
|
||||||
if (empty($object->lines[$i]->fk_product)) continue;
|
|
||||||
|
|
||||||
$objphoto->fetch($object->lines[$i]->fk_product);
|
|
||||||
//var_dump($objphoto->ref);exit;
|
|
||||||
if (getDolGlobalInt('PRODUCT_USE_OLD_PATH_FOR_PHOTO')) {
|
|
||||||
$pdir[0] = get_exdir($objphoto->id, 2, 0, 0, $objphoto, 'product').$objphoto->id."/photos/";
|
|
||||||
$pdir[1] = get_exdir(0, 0, 0, 0, $objphoto, 'product').dol_sanitizeFileName($objphoto->ref).'/';
|
|
||||||
} else {
|
|
||||||
$pdir[0] = get_exdir(0, 0, 0, 0, $objphoto, 'product'); // default
|
|
||||||
$pdir[1] = get_exdir($objphoto->id, 2, 0, 0, $objphoto, 'product').$objphoto->id."/photos/"; // alternative
|
|
||||||
}
|
|
||||||
|
|
||||||
$arephoto = false;
|
|
||||||
foreach ($pdir as $midir)
|
|
||||||
{
|
|
||||||
if (!$arephoto)
|
|
||||||
{
|
|
||||||
$dir = $conf->product->dir_output.'/'.$midir;
|
|
||||||
|
|
||||||
foreach ($objphoto->liste_photos($dir, 1) as $key => $obj)
|
|
||||||
{
|
|
||||||
if (!getDolGlobalInt('CAT_HIGH_QUALITY_IMAGES')) // If CAT_HIGH_QUALITY_IMAGES not defined, we use thumb if defined and then original photo
|
|
||||||
{
|
|
||||||
if ($obj['photo_vignette'])
|
|
||||||
{
|
|
||||||
$filename = $obj['photo_vignette'];
|
|
||||||
} else {
|
|
||||||
$filename = $obj['photo'];
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$filename = $obj['photo'];
|
|
||||||
}
|
|
||||||
|
|
||||||
$realpath = $dir.$filename;
|
|
||||||
$arephoto = true;
|
|
||||||
$this->atleastonephoto = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($realpath && $arephoto) $realpatharray[$i] = $realpath;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
//if (count($realpatharray) == 0) $this->posxpicture=$this->posxtva;
|
|
||||||
|
|
||||||
if ($conf->recruitment->dir_output.'/recruitmentjobposition') {
|
if ($conf->recruitment->dir_output.'/recruitmentjobposition') {
|
||||||
$object->fetch_thirdparty();
|
$object->fetch_thirdparty();
|
||||||
|
|
||||||
@@ -532,44 +475,11 @@ class pdf_standard_recruitmentjobposition extends ModelePDFRecruitmentJobPositio
|
|||||||
$pdf->SetFont('', '', $default_font_size - 1); // Into loop to work with multipage
|
$pdf->SetFont('', '', $default_font_size - 1); // Into loop to work with multipage
|
||||||
$pdf->SetTextColor(0, 0, 0);
|
$pdf->SetTextColor(0, 0, 0);
|
||||||
|
|
||||||
// Define size of image if we need it
|
|
||||||
$imglinesize = array();
|
|
||||||
if (!empty($realpatharray[$i])) {
|
|
||||||
$imglinesize = pdf_getSizeForImage($realpatharray[$i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
$pdf->setTopMargin($tab_top_newpage);
|
$pdf->setTopMargin($tab_top_newpage);
|
||||||
$pdf->setPageOrientation('', 1, $heightforfooter + $heightforfreetext + $heightforinfotot); // The only function to edit the bottom margin of current page to set it.
|
$pdf->setPageOrientation('', 1, $heightforfooter + $heightforfreetext + $heightforinfotot); // The only function to edit the bottom margin of current page to set it.
|
||||||
$pageposbefore = $pdf->getPage();
|
$pageposbefore = $pdf->getPage();
|
||||||
|
|
||||||
$showpricebeforepagebreak = 1;
|
$showpricebeforepagebreak = 1;
|
||||||
$posYAfterImage = 0;
|
|
||||||
|
|
||||||
if ($this->getColumnStatus('photo')) {
|
|
||||||
// We start with Photo of product line
|
|
||||||
if (isset($imglinesize['width']) && isset($imglinesize['height']) && ($curY + $imglinesize['height']) > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) { // If photo too high, we moved completely on new page
|
|
||||||
$pdf->AddPage('', '', true);
|
|
||||||
if (!empty($tplidx)) {
|
|
||||||
$pdf->useTemplate($tplidx);
|
|
||||||
}
|
|
||||||
$pdf->setPage($pageposbefore + 1);
|
|
||||||
|
|
||||||
$curY = $tab_top_newpage;
|
|
||||||
|
|
||||||
// Allows data in the first page if description is long enough to break in multiples pages
|
|
||||||
if (getDolGlobalString('MAIN_PDF_DATA_ON_FIRST_PAGE')) {
|
|
||||||
$showpricebeforepagebreak = 1;
|
|
||||||
} else {
|
|
||||||
$showpricebeforepagebreak = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($this->cols['photo']) && isset($imglinesize['width']) && isset($imglinesize['height'])) {
|
|
||||||
$pdf->Image($realpatharray[$i], $this->getColumnContentXStart('photo'), $curY, $imglinesize['width'], $imglinesize['height'], '', '', '', 2, 300); // Use 300 dpi
|
|
||||||
// $pdf->Image does not increase value return by getY, so we save it manually
|
|
||||||
$posYAfterImage = $curY + $imglinesize['height'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Description of product line
|
// Description of product line
|
||||||
if ($this->getColumnStatus('desc')) {
|
if ($this->getColumnStatus('desc')) {
|
||||||
@@ -586,8 +496,7 @@ class pdf_standard_recruitmentjobposition extends ModelePDFRecruitmentJobPositio
|
|||||||
|
|
||||||
$pageposafter = $pdf->getPage();
|
$pageposafter = $pdf->getPage();
|
||||||
$posyafter = $pdf->GetY();
|
$posyafter = $pdf->GetY();
|
||||||
//var_dump($posyafter);
|
|
||||||
//var_dump(($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))); exit;
|
|
||||||
if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) { // There is no space left for total+free text
|
if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) { // There is no space left for total+free text
|
||||||
if ($i == ($nblines - 1)) { // No more lines, and no space left to show total, so we create a new page
|
if ($i == ($nblines - 1)) { // No more lines, and no space left to show total, so we create a new page
|
||||||
$pdf->AddPage('', '', true);
|
$pdf->AddPage('', '', true);
|
||||||
@@ -616,7 +525,7 @@ class pdf_standard_recruitmentjobposition extends ModelePDFRecruitmentJobPositio
|
|||||||
$pdf->setTopMargin($this->marge_haute);
|
$pdf->setTopMargin($this->marge_haute);
|
||||||
$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
|
$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
|
||||||
|
|
||||||
// We suppose that a too long description or photo were moved completely on next page
|
// We suppose that a too long description were moved completely on next page
|
||||||
if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) {
|
if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) {
|
||||||
$pdf->setPage($pageposafter);
|
$pdf->setPage($pageposafter);
|
||||||
$curY = $tab_top_newpage;
|
$curY = $tab_top_newpage;
|
||||||
@@ -624,8 +533,6 @@ class pdf_standard_recruitmentjobposition extends ModelePDFRecruitmentJobPositio
|
|||||||
|
|
||||||
$pdf->SetFont('', '', $default_font_size - 1); // On repositionne la police par default
|
$pdf->SetFont('', '', $default_font_size - 1); // On repositionne la police par default
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$parameters = array(
|
$parameters = array(
|
||||||
'object' => $object,
|
'object' => $object,
|
||||||
'i' => $i,
|
'i' => $i,
|
||||||
@@ -637,8 +544,6 @@ class pdf_standard_recruitmentjobposition extends ModelePDFRecruitmentJobPositio
|
|||||||
);
|
);
|
||||||
$reshook = $hookmanager->executeHooks('printPDFline', $parameters, $this); // Note that $object may have been modified by hook
|
$reshook = $hookmanager->executeHooks('printPDFline', $parameters, $this); // Note that $object may have been modified by hook
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Detect if some page were added automatically and output _tableau for past pages
|
// Detect if some page were added automatically and output _tableau for past pages
|
||||||
while ($pagenb < $pageposafter) {
|
while ($pagenb < $pageposafter) {
|
||||||
$pdf->setPage($pagenb);
|
$pdf->setPage($pagenb);
|
||||||
@@ -795,7 +700,6 @@ class pdf_standard_recruitmentjobposition extends ModelePDFRecruitmentJobPositio
|
|||||||
// Output Rect
|
// Output Rect
|
||||||
$this->printRect($pdf, $this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $tab_height, $hidetop, $hidebottom); // Rect takes a length in 3rd parameter and 4th parameter
|
$this->printRect($pdf, $this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $tab_height, $hidetop, $hidebottom); // Rect takes a length in 3rd parameter and 4th parameter
|
||||||
|
|
||||||
|
|
||||||
$this->pdfTabTitles($pdf, $tab_top, $tab_height, $outputlangs, $hidetop);
|
$this->pdfTabTitles($pdf, $tab_top, $tab_height, $outputlangs, $hidetop);
|
||||||
|
|
||||||
if (empty($hidetop)) {
|
if (empty($hidetop)) {
|
||||||
@@ -826,7 +730,7 @@ class pdf_standard_recruitmentjobposition extends ModelePDFRecruitmentJobPositio
|
|||||||
pdf_pagehead($pdf, $outputlangs, $this->page_hauteur);
|
pdf_pagehead($pdf, $outputlangs, $this->page_hauteur);
|
||||||
|
|
||||||
// Show Draft Watermark
|
// Show Draft Watermark
|
||||||
if ($object->statut == $object::STATUS_DRAFT && getDolGlobalString('RECRUITMENT_RECRUITMENTJOBPOSITION_DRAFT_WATERMARK')) {
|
if ($object->status == $object::STATUS_DRAFT && getDolGlobalString('RECRUITMENT_RECRUITMENTJOBPOSITION_DRAFT_WATERMARK')) {
|
||||||
pdf_watermark($pdf, $outputlangs, $this->page_hauteur, $this->page_largeur, 'mm', getDolGlobalString('RECRUITMENT_RECRUITMENTJOBPOSITION_DRAFT_WATERMARK'));
|
pdf_watermark($pdf, $outputlangs, $this->page_hauteur, $this->page_largeur, 'mm', getDolGlobalString('RECRUITMENT_RECRUITMENTJOBPOSITION_DRAFT_WATERMARK'));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -879,7 +783,7 @@ class pdf_standard_recruitmentjobposition extends ModelePDFRecruitmentJobPositio
|
|||||||
$pdf->SetXY($posx, $posy);
|
$pdf->SetXY($posx, $posy);
|
||||||
$pdf->SetTextColor(0, 0, 60);
|
$pdf->SetTextColor(0, 0, 60);
|
||||||
$textref = $outputlangs->transnoentities("Ref")." : ".$outputlangs->convToOutputCharset($object->ref);
|
$textref = $outputlangs->transnoentities("Ref")." : ".$outputlangs->convToOutputCharset($object->ref);
|
||||||
if ($object->statut == $object::STATUS_DRAFT) {
|
if ($object->status == $object::STATUS_DRAFT) {
|
||||||
$pdf->SetTextColor(128, 0, 0);
|
$pdf->SetTextColor(128, 0, 0);
|
||||||
$textref .= ' - '.$outputlangs->transnoentities("NotValidated");
|
$textref .= ' - '.$outputlangs->transnoentities("NotValidated");
|
||||||
}
|
}
|
||||||
@@ -1047,13 +951,13 @@ class pdf_standard_recruitmentjobposition extends ModelePDFRecruitmentJobPositio
|
|||||||
|
|
||||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
|
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
|
||||||
/**
|
/**
|
||||||
* Show footer of page. Need this->emetteur object
|
* Show footer of page. Need this->emetteur object
|
||||||
*
|
*
|
||||||
* @param TCPDF $pdf PDF
|
* @param TCPDF $pdf PDF
|
||||||
* @param RecruitmentJobPosition $object Object to show
|
* @param RecruitmentJobPosition $object Object to show
|
||||||
* @param Translate $outputlangs Object lang for output
|
* @param Translate $outputlangs Object lang for output
|
||||||
* @param int $hidefreetext 1=Hide free text
|
* @param int $hidefreetext 1=Hide free text
|
||||||
* @return int Return height of bottom margin including footer text
|
* @return int Return height of bottom margin including footer text
|
||||||
*/
|
*/
|
||||||
protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
|
protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
|
||||||
{
|
{
|
||||||
@@ -1125,28 +1029,6 @@ class pdf_standard_recruitmentjobposition extends ModelePDFRecruitmentJobPositio
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
// PHOTO
|
|
||||||
$rank = $rank + 10;
|
|
||||||
$this->cols['photo'] = array(
|
|
||||||
'rank' => $rank,
|
|
||||||
'width' => (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH) ? 20 : $conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH), // in mm
|
|
||||||
'status' => false,
|
|
||||||
'title' => array(
|
|
||||||
'textkey' => 'Photo',
|
|
||||||
'label' => ' '
|
|
||||||
),
|
|
||||||
'content' => array(
|
|
||||||
'padding' => array(0, 0, 0, 0), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
|
|
||||||
),
|
|
||||||
'border-left' => false, // remove left line separator
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!empty($conf->global->MAIN_GENERATE_INVOICES_WITH_PICTURE) && !empty($this->atleastonephoto))
|
|
||||||
{
|
|
||||||
$this->cols['photo']['status'] = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
$rank = $rank + 10;
|
$rank = $rank + 10;
|
||||||
$this->cols['vat'] = array(
|
$this->cols['vat'] = array(
|
||||||
'rank' => $rank,
|
'rank' => $rank,
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
/* Copyright (C) 2016-2023 Laurent Destailleur <eldy@users.sourceforge.net>
|
/* Copyright (C) 2016-2023 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2020 Nicolas ZABOURI <info@inovea-conseil.com>
|
* Copyright (C) 2020 Nicolas ZABOURI <info@inovea-conseil.com>
|
||||||
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
|
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
|
||||||
|
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -4381,7 +4382,7 @@ if ($action == 'editmeta' || $action == 'createcontainer') { // Edit properties
|
|||||||
print $langs->trans('WEBSITE_PAGENAME');
|
print $langs->trans('WEBSITE_PAGENAME');
|
||||||
print '</td><td>';
|
print '</td><td>';
|
||||||
print '<span class="opacitymedium spanprefix hidden"></span> ';
|
print '<span class="opacitymedium spanprefix hidden"></span> ';
|
||||||
print '<input type="text" class="flat minwidth300" name="WEBSITE_PAGENAME" id="WEBSITE_PAGENAME" value="'.dol_escape_htmltag((string) preg_replace('/^_[a-z]+_page_/', '', $pageurl)).'">';
|
print '<input type="text" class="flat minwidth300" name="WEBSITE_PAGENAME" id="WEBSITE_PAGENAME" value="'.dol_escape_htmltag((string) preg_replace('/^_[a-z]+_page_/', '', (string) $pageurl)).'">';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
print '<script type="text/javascript">
|
print '<script type="text/javascript">
|
||||||
|
|||||||
Reference in New Issue
Block a user