浏览代码

Merge branch '16.0-mmi' of gogs.iprospective.fr:iProspective/dolibarr into 16.0-mmi

Mathieu Moulin 1 年之前
父节点
当前提交
85947e5e79

+ 0 - 30
htdocs/core/class/commonobject.class.php

@@ -10110,36 +10110,6 @@ abstract class CommonObject
 		return $mt;
 	}
 
-	/**
-	 * Get filename for PDF
-	 * @author MMI Mathieu Moulin iProspective
-	 *
-	 * @return string
-	 */
-	public function pdf_filename()
-	{
-		global $conf;
-		
-		if (empty($conf->global->MMIDOCUMENT_PDF_RENAME))
-			return;
-		
-		$thirdparty = $this->thirdparty;
-		$file_e = [];
-		$file_e[] = dol_sanitizeFileName($this->ref);
-		if (!empty($conf->global->MMIDOCUMENT_PDF_RENAME_MYSOC)) {
-			global $mysoc;
-			$file_e[] = $mysoc->name;
-		}
-		if (!empty($conf->global->MMIDOCUMENT_PDF_RENAME_THIRDPARTY)) {
-			$file_e[] = $thirdparty->name;
-		}
-		if (!empty($conf->global->MMIDOCUMENT_PDF_RENAME_REF_CUSTOMER) && !empty($this->ref_customer)) {
-			$file_e[] = $this->ref_customer;
-		}
-		$filename = preg_replace('/[^A-Za-z0-9\-]/', '', str_replace(' ', '-', iconv('UTF-8','ASCII//TRANSLIT', implode('-', $file_e))));
-		return !empty($conf->global->MMIDOCUMENT_PDF_RENAME_UPPERCASE) ?strtoupper($filename) :$filename;
-	}
-
 	/**
 	 * Get total amount already paid
 	 * @author MMI Mathieu Moulin iProspective

+ 27 - 24
htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php

@@ -308,13 +308,7 @@ class pdf_eratosthene extends ModelePDFCommandes
 			} else {
 				$objectref = dol_sanitizeFileName($object->ref);
 				$dir = $conf->commande->multidir_output[$object->entity]."/".$objectref;
-				// MMIDocument PDF rename
-				if (!empty($conf->global->MMIDOCUMENT_PDF_RENAME)) {
-					$filename = $object->pdf_filename();
-					$file = $dir."/".$filename.".pdf";
-				}
-				else
-					$file = $dir."/".$objectref.".pdf";
+				$file = $dir."/".$objectref.".pdf";
 			}
 
 			if (!file_exists($dir)) {
@@ -1690,22 +1684,13 @@ class pdf_eratosthene extends ModelePDFCommandes
 
 			// Added by MMI Mathieu Moulin iProspective
 			// If CUSTOMER/SHIPPING contact defined, we use it
-			$useshippingcontact = false;
-			$arrayidcontact = $object->getIdContact('external', 'SHIPPING');
-			if (count($arrayidcontact) > 0) {
-				$usecontact = true;
-				$useshippingcontact = true;
-				$result = $object->fetch_contact($arrayidcontact[0]);
-			}
+			$useshippingcontact = !empty($object->getIdContact('external', 'SHIPPING'));
+			// If Maîtrise d'oeuvre defined, we use it
+			$usemaitrisecontact = !empty($object->getIdContact('external', 'MGMT'));
 			// If CUSTOMER/BILLING contact defined, we use it
-			$usebillingcontact = false;
-			$arrayidcontact = $object->getIdContact('external', 'BILLING');
-			if (count($arrayidcontact) > 0) {
-				$usebillingcontact = true;
-				$result = $object->fetch_contact($arrayidcontact[0]);
-			}
+			$usebillingcontact = !empty($object->getIdContact('external', 'BILLING'));
 			// MMI Hack size
-			if ($twocontacts = !empty($conf->global->MMI_DOCUMENT_PDF_SEPARATE_CONTACTS) && $useshippingcontact)
+			if ($twocontacts = !empty($conf->global->MMI_DOCUMENT_PDF_SEPARATE_CONTACTS) && ($useshippingcontact || $usemaitrisecontact))
 				$widthrecbox = 60;
 
 			// Show sender frame
@@ -1743,11 +1728,21 @@ class pdf_eratosthene extends ModelePDFCommandes
 				$arrayidcontact = $object->getIdContact('external', 'SHIPPING');
 				if (count($arrayidcontact) > 0) {
 					$usecontact = true;
+					$recipient_type = 'SHIPPING';
+					$address_type_label = $outputlangs->transnoentities("DeliveryAddress");
+					$result = $object->fetch_contact($arrayidcontact[0]);
+				}
+				// If Maîtrise d'oeuvre defined, we use it
+				$arrayidcontact = $object->getIdContact('external', 'MGMT');
+				if (count($arrayidcontact) > 0) {
+					$usecontact = true;
+					$recipient_type = 'MGMT';
+					$address_type_label = $outputlangs->transnoentities("ProjectManagementAddress");
 					$result = $object->fetch_contact($arrayidcontact[0]);
 				}
 
 				// Recipient name
-				if ($usecontact && ($object->contact->socid == $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) {
+				if ($usecontact && ($object->contact->socid != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) {
 					$thirdparty = $object->contact;
 				} else {
 					$thirdparty = $object->thirdparty;
@@ -1776,7 +1771,7 @@ class pdf_eratosthene extends ModelePDFCommandes
 				$pdf->SetTextColor(0, 0, 0);
 				$pdf->SetFont('', '', $default_font_size - 2);
 				$pdf->SetXY($posx + 2, $posy - 5);
-				$pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities("DeliveryAddress"), 0, $ltrdirection);
+				$pdf->MultiCell($widthrecbox, 5, $address_type_label, 0, $ltrdirection);
 				$pdf->Rect($posx, $posy, $widthrecbox, $hautcadre);
 
 				// Show recipient name
@@ -1802,7 +1797,7 @@ class pdf_eratosthene extends ModelePDFCommandes
 				}
 
 				// Recipient name
-				if ($usecontact && ($object->contact->socid == $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) {
+				if ($usecontact && ($object->contact->socid != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) {
 					$thirdparty = $object->contact;
 				} else {
 					$thirdparty = $object->thirdparty;
@@ -1856,6 +1851,14 @@ class pdf_eratosthene extends ModelePDFCommandes
 					$usecontact = true;
 					$result = $object->fetch_contact($arrayidcontact[0]);
 				}
+				// If BILLING contact defined, we use it
+				if (! $usecontact) {
+					$arrayidcontact = $object->getIdContact('external', 'BILLING');
+					if (count($arrayidcontact) > 0) {
+						$usecontact = true;
+						$result = $object->fetch_contact($arrayidcontact[0]);
+					}
+				}
 
 				// Recipient name
 				if ($usecontact && ($object->contact->socid == $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) {

+ 35 - 31
htdocs/core/modules/facture/doc/pdf_sponge.modules.php

@@ -316,13 +316,7 @@ class pdf_sponge extends ModelePDFFactures
 			} else {
 				$objectref = dol_sanitizeFileName($object->ref);
 				$dir = $conf->facture->multidir_output[$object->entity]."/".$objectref;
-				// MMIDocument PDF rename
-				if (!empty($conf->global->MMIDOCUMENT_PDF_RENAME)) {
-					$filename = $object->pdf_filename();
-					$file = $dir."/".$filename.".pdf";
-				}
-				else
-					$file = $dir."/".$objectref.".pdf";
+				$file = $dir."/".$objectref.".pdf";
 			}
 			if (!file_exists($dir)) {
 				if (dol_mkdir($dir) < 0) {
@@ -346,12 +340,21 @@ class pdf_sponge extends ModelePDFFactures
 				$nblines = count($object->lines);
 				$nbpayments = count($object->getListOfPayments());
 
+				// MMI Fix infotot height if multiple situations
+				$object->fetchPreviousNextSituationInvoice();
+				$TPreviousIncoice = $object->tab_previous_situation_invoice;
+				$TPreviousIncoice2 = [];
+				foreach($TPreviousIncoice as &$fac) {
+					$TPreviousIncoice2[$fac->situation_counter] = $fac;
+				}
+
 				// Create pdf instance
 				$pdf = pdf_getInstance($this->format);
 				$default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance
 				$pdf->SetAutoPageBreak(1, 0);
 
-				$heightforinfotot = 50 + (4 * $nbpayments); // Height reserved to output the info and total part and payment part
+				// MMI Fix infotot height if multiple situations
+				$heightforinfotot = 50 + (4 * $nbpayments) + (4 * count($TPreviousIncoice2)); // Height reserved to output the info and total part and payment part
 				$heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5); // Height reserved to output the free text on last page
 				$heightforfooter = $this->marge_basse + (empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 12 : 22); // Height reserved to output the footer (value include bottom margin)
 
@@ -440,9 +443,8 @@ class pdf_sponge extends ModelePDFFactures
 
 				// Added by MMI Mathieu Moulin iProspective
 				// Text complement
-				if (!empty($conf->global->DOCUMENT_SHOW_COMPLEMENT)) {
-					$textComplement = $this->textComplement($object, $outputlangs);
-					$heightfocomplement = $this->heightComplementArea($pdf, $textComplement, $default_font_size);
+				if (!empty($conf->global->DOCUMENT_SHOW_COMPLEMENT) && !empty($textComplement = $this->textComplement($object, $outputlangs))) {
+					$heightforfreetext += $heightfocomplement = $this->heightComplementArea($pdf, $textComplement, $default_font_size);
 					//var_dump($heightfocomplement); die();
 					//$heightforsignature += $heightfocomplement;
 				}
@@ -1509,7 +1511,7 @@ class pdf_sponge extends ModelePDFFactures
 				$pdf->SetFillColor(255, 255, 255);
 				$pdf->SetXY($col1x, $posy);
 				$pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("PDFSituationTitle", $fac->situation_counter).' '.$outputlangs->transnoentities("TotalHT"), 0, 'L', 1);
-
+				//var_dump($posy);
 				$pdf->SetXY($col2x, $posy);
 
 				$facSign = '';
@@ -1869,7 +1871,6 @@ class pdf_sponge extends ModelePDFFactures
 						$retainedWarrantyToPayOn = $outputlangs->transnoentities("RetainedWarrantyCumulated").(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transnoentities("RetainedWarrantyCumulated") : '');
 						//var_dump($object); die();
 						if (!empty($object->retained_warranty_fk_cond_reglement)) {
-							global $db;
 							$sql = 'SELECT code, libelle FROM '.MAIN_DB_PREFIX.'c_payment_term WHERE rowid='.$object->retained_warranty_fk_cond_reglement;
 							$resql = $this->db->query($sql);
 							if ($resql && ($obj = $this->db->fetch_object($resql)) && $obj->code=='1AN') {
@@ -2278,21 +2279,12 @@ class pdf_sponge extends ModelePDFFactures
 			// Added by MMI Mathieu Moulin iProspective
 			// Multiple contacts shipping & invoice
 			// If CUSTOMER/SHIPPING contact defined, we use it
-			$useshippingcontact = false;
-			$arrayidcontact = $object->getIdContact('external', 'SHIPPING');
-			if (count($arrayidcontact) > 0) {
-				$usecontact = true;
-				$useshippingcontact = true;
-				$result = $object->fetch_contact($arrayidcontact[0]);
-			}
+			$useshippingcontact = !empty($object->getIdContact('external', 'SHIPPING'));
+			// If Maîtrise d'oeuvre defined, we use it
+			$usemaitrisecontact = !empty($object->getIdContact('external', 'MGMT'));
 			// If CUSTOMER/BILLING contact defined, we use it
-			$usebillingcontact = false;
-			$arrayidcontact = $object->getIdContact('external', 'BILLING');
-			if (count($arrayidcontact) > 0) {
-				$usebillingcontact = true;
-				$result = $object->fetch_contact($arrayidcontact[0]);
-			}
-			if ($twocontacts = !empty($conf->global->MMI_DOCUMENT_PDF_SEPARATE_CONTACTS) && $useshippingcontact)
+			$usebillingcontact = !empty($object->getIdContact('external', 'BILLING'));
+			if ($twocontacts = !empty($conf->global->MMI_DOCUMENT_PDF_SEPARATE_CONTACTS) && ($useshippingcontact || $usemaitrisecontact))
 				$widthrecbox = 60;
 
 			// Show sender frame
@@ -2330,6 +2322,17 @@ class pdf_sponge extends ModelePDFFactures
 				$arrayidcontact = $object->getIdContact('external', 'SHIPPING');
 				if (count($arrayidcontact) > 0) {
 					$usecontact = true;
+					$recipient_type = 'SHIPPING';
+					$address_type_label = $outputlangs->transnoentities("DeliveryAddress");
+					$result = $object->fetch_contact($arrayidcontact[0]);
+				}
+				// If Maîtrise d'oeuvre defined, we use it
+				$usemaitrisecontact = false;
+				$arrayidcontact = $object->getIdContact('external', 'MGMT');
+				if (count($arrayidcontact) > 0) {
+					$usecontact = true;
+					$recipient_type = 'MGMT';
+					$address_type_label = $outputlangs->transnoentities("ProjectManagementAddress");
 					$result = $object->fetch_contact($arrayidcontact[0]);
 				}
 
@@ -2340,7 +2343,7 @@ class pdf_sponge extends ModelePDFFactures
 					$thirdparty = $object->thirdparty;
 				}
 
-				$carac_client_name = pdfBuildThirdpartyName($thirdparty, $outputlangs);
+				$carac_client_name = $recipient_type != 'MGMT' ?pdfBuildThirdpartyName($thirdparty, $outputlangs) :'';
 
 				$mode =  'target';
 				$carac_client = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, ($usecontact ? $object->contact : ''), $usecontact, $mode, $object);
@@ -2363,7 +2366,7 @@ class pdf_sponge extends ModelePDFFactures
 				$pdf->SetTextColor(0, 0, 0);
 				$pdf->SetFont('', '', $default_font_size - 2);
 				$pdf->SetXY($posx + 2, $posy - 5);
-				$pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities("DeliveryAddress"), 0, $ltrdirection);
+				$pdf->MultiCell($widthrecbox, 5, $address_type_label, 0, $ltrdirection);
 				$pdf->Rect($posx, $posy, $widthrecbox, $hautcadre);
 
 				// Show recipient name
@@ -2557,7 +2560,8 @@ class pdf_sponge extends ModelePDFFactures
 	}
 	protected function heightComplementArea(&$pdf, $text, $default_font_size)
 	{
-		$marg_top = 12;
+		global $conf;
+		$marg_top = 8+(!empty($conf->global->DOCUMENT_COMPLEMENT_TITLE) ?4 :0);
 		$tab_titre = 4;
 		$tab_text = $this->heightComplement($pdf, $text, $default_font_size);
 		//var_dump($tab_text);
@@ -2569,7 +2573,7 @@ class pdf_sponge extends ModelePDFFactures
 		$outputlangs->load('mmidocuments@mmidocuments');
 		
 		$default_font_size = pdf_getPDFFontSize($outputlangs);
-		$marg_top = 12;
+		$marg_top = 8+(!empty($conf->global->DOCUMENT_COMPLEMENT_TITLE) ?4 :0);
 		$tab_top = $posy + $marg_top;
 
 		$posx = $this->marge_gauche;

+ 27 - 22
htdocs/core/modules/propale/doc/pdf_cyan.modules.php

@@ -306,13 +306,7 @@ class pdf_cyan extends ModelePDFPropales
 			} else {
 				$objectref = dol_sanitizeFileName($object->ref);
 				$dir = $conf->propal->multidir_output[$object->entity]."/".$objectref;
-				// MMIDocument PDF rename
-				if (!empty($conf->global->MMIDOCUMENT_PDF_RENAME)) {
-					$filename = $object->pdf_filename();
-					$file = $dir."/".$filename.".pdf";
-				}
-				else
-					$file = $dir."/".$objectref.".pdf";
+				$file = $dir."/".$objectref.".pdf";
 			}
 
 			if (!file_exists($dir)) {
@@ -1782,20 +1776,12 @@ class pdf_cyan extends ModelePDFPropales
 
 			// Added by MMI Mathieu Moulin iProspective
 			// If CUSTOMER/SHIPPING contact defined, we use it
-			$useshippingcontact = false;
-			$arrayidcontact = $object->getIdContact('external', 'SHIPPING');
-			if (count($arrayidcontact) > 0) {
-				$useshippingcontact = true;
-				$result = $object->fetch_contact($arrayidcontact[0]);
-			}
+			$useshippingcontact = !empty($object->getIdContact('external', 'SHIPPING'));
+			// If Maîtrise d'oeuvre defined, we use it
+			$usemaitrisecontact = !empty($object->getIdContact('external', 'MGMT'));
 			// If CUSTOMER/BILLING contact defined, we use it
-			$usebillingcontact = false;
-			$arrayidcontact = $object->getIdContact('external', 'BILLING');
-			if (count($arrayidcontact) > 0) {
-				$usebillingcontact = true;
-				$result = $object->fetch_contact($arrayidcontact[0]);
-			}
-			if ($twocontacts = !empty($conf->global->MMI_DOCUMENT_PDF_SEPARATE_CONTACTS) && $useshippingcontact)
+			$usebillingcontact = !empty($object->getIdContact('external', 'BILLING'));
+			if ($twocontacts = !empty($conf->global->MMI_DOCUMENT_PDF_SEPARATE_CONTACTS) && ($useshippingcontact || $usemaitrisecontact))
 				$widthrecbox = 60;
 
 			// Show sender frame
@@ -1833,6 +1819,17 @@ class pdf_cyan extends ModelePDFPropales
 				$arrayidcontact = $object->getIdContact('external', 'SHIPPING');
 				if (count($arrayidcontact) > 0) {
 					$usecontact = true;
+					$recipient_type = 'SHIPPING';
+					$address_type_label = $outputlangs->transnoentities("DeliveryAddress");
+					$result = $object->fetch_contact($arrayidcontact[0]);
+				}
+				// If Maîtrise d'oeuvre defined, we use it
+				$arrayidcontact = $object->getIdContact('external', 'MGMT');
+				$usemaitrisecontact = false;
+				if (count($arrayidcontact) > 0) {
+					$usecontact = true;
+					$recipient_type = 'MGMT';
+					$address_type_label = $outputlangs->transnoentities("ProjectManagementAddress");
 					$result = $object->fetch_contact($arrayidcontact[0]);
 				}
 
@@ -1843,7 +1840,7 @@ class pdf_cyan extends ModelePDFPropales
 					$thirdparty = $object->thirdparty;
 				}
 
-				$carac_client_name = pdfBuildThirdpartyName($thirdparty, $outputlangs);
+				$carac_client_name = $recipient_type != 'MGMT' ?pdfBuildThirdpartyName($thirdparty, $outputlangs) :'';
 
 				$mode =  'target';
 				$carac_client = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, ($usecontact ? $object->contact : ''), $usecontact, $mode, $object);
@@ -1866,7 +1863,7 @@ class pdf_cyan extends ModelePDFPropales
 				$pdf->SetTextColor(0, 0, 0);
 				$pdf->SetFont('', '', $default_font_size - 2);
 				$pdf->SetXY($posx + 2, $posy - 5);
-				$pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities("DeliveryAddress"), 0, $ltrdirection);
+				$pdf->MultiCell($widthrecbox, 5, $address_type_label, 0, $ltrdirection);
 				$pdf->Rect($posx, $posy, $widthrecbox, $hautcadre);
 
 				// Show recipient name
@@ -1946,6 +1943,14 @@ class pdf_cyan extends ModelePDFPropales
 					$usecontact = true;
 					$result = $object->fetch_contact($arrayidcontact[0]);
 				}
+				// If BILLING contact defined, we use it
+				if (! $usecontact) {
+					$arrayidcontact = $object->getIdContact('external', 'BILLING');
+					if (count($arrayidcontact) > 0) {
+						$usecontact = true;
+						$result = $object->fetch_contact($arrayidcontact[0]);
+					}
+				}
 
 				// Recipient name
 				if ($usecontact && ($object->contact->socid == $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) {

+ 2 - 4
htdocs/core/tpl/card_presend.tpl.php

@@ -50,8 +50,7 @@ if ($action == 'presend') {
 		if ($object->element == 'invoice_supplier') {
 			$fileparams = dol_most_recent_file($diroutput.'/'.get_exdir($object->id, 2, 0, 0, $object, $object->element).$ref, preg_quote($ref, '/').'([^\-])+');
 		} else {
-			$filename = (!empty($conf->global->MMIDOCUMENT_PDF_RENAME)) ?$object->pdf_filename() :$ref;
-			$fileparams = dol_most_recent_file($diroutput.'/'.$ref, preg_quote($filename, '/').'[^\-]+');
+			$fileparams = dol_most_recent_file($diroutput.'/'.$ref, preg_quote($ref, '/').'[^\-]+');
 		}
 
 		$file = $fileparams['fullname'];
@@ -99,8 +98,7 @@ if ($action == 'presend') {
 			if ($object->element == 'invoice_supplier') {
 				$fileparams = dol_most_recent_file($diroutput.'/'.get_exdir($object->id, 2, 0, 0, $object, $object->element).$ref, preg_quote($ref, '/').'([^\-])+');
 			} else {
-				$filename = (!empty($conf->global->MMIDOCUMENT_PDF_RENAME)) ?$object->pdf_filename() :$ref;
-				$fileparams = dol_most_recent_file($diroutput.'/'.$ref, preg_quote($filename, '/').'[^\-]+');
+				$fileparams = dol_most_recent_file($diroutput.'/'.$ref, preg_quote($ref, '/').'[^\-]+');
 			}
 
 			$file = $fileparams['fullname'];

+ 1 - 1
htdocs/custom/mmidocuments

@@ -1 +1 @@
-Subproject commit 5307027be4313e6a5648ccbb0750d79d2c3c4d22
+Subproject commit 8f816be3d3ff1514e57b13122fa5db5f26ef5cc8

+ 1 - 1
htdocs/custom/mmiproject

@@ -1 +1 @@
-Subproject commit d874dbb76b9a981c7180e1b6fa933df74dfa3179
+Subproject commit 865ba8b1349f9b45e23078d5f17eea85f38d8363

+ 1 - 1
htdocs/document.php

@@ -288,7 +288,7 @@ if (!is_object($hookmanager)) {
 $hookmanager->initHooks(array('document'));
 $parameters = array('ecmfile' => $ecmfile, 'modulepart' => $modulepart, 'original_file' => $original_file,
 	'entity' => $entity, 'refname' => $refname, 'fullpath_original_file' => $fullpath_original_file,
-	'filename' => $filename, 'fullpath_original_file_osencoded' => $fullpath_original_file_osencoded);
+	'filename' => &$filename, 'fullpath_original_file_osencoded' => $fullpath_original_file_osencoded);
 $reshook = $hookmanager->executeHooks('downloadDocument', $parameters); // Note that $action and $object may have been
 if ($reshook < 0) {
 	$errors = $hookmanager->error.(is_array($hookmanager->errors) ? (!empty($hookmanager->error) ? ', ' : '').join($separator, $hookmanager->errors) : '');

+ 2 - 2
htdocs/product/ajax/products.php

@@ -186,8 +186,8 @@ if ($action == 'fetch' && !empty($id)) {
 				}
 				if (!empty($upd)) {
 					$found = true;
-					$outprice_ht = price($object->price*(100-$outdiscount)/100);
-					$outprice_ttc = price($object->price_ttc*(100-$outdiscount)/100);
+					$outprice_ht = price($object->price);
+					$outprice_ttc = price($object->price_ttc);
 					$outqty = $objp->stock;
 					$outpricebasetype = $object->price_base_type;
 					$outtva_tx = $object->tva_tx;