diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index 7fb4704f382..5bdfb3ff202 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -1,7 +1,7 @@ * Copyright (C) 2003 Jean-Louis Bergamo - * Copyright (C) 2004-2017 Laurent Destailleur + * Copyright (C) 2004-2024 Laurent Destailleur * Copyright (C) 2004 Eric Seigne * Copyright (C) 2005-2017 Regis Houssin * Copyright (C) 2011-2023 Juanjo Menent @@ -887,6 +887,14 @@ if ($mode == 'common' || $mode == 'commonkanban') { } } + if ($objMod->isCoreOrExternalModule() == 'external' && !getDolGlobalString('DISABLE_CHECK_ON_MALWARE_MODULES')) { + $checkRes = $objMod->checkForCompliance(); // Check if module is reported as non compliant with Dolibarr rules and law + if (!is_numeric($checkRes) && $checkRes != '') { + $langs->load("errors"); + setEventMessages($objMod->getName().' : '.$langs->trans($checkRes), null, 'errors'); + } + } + // Define imginfo $imginfo = "info"; if ($objMod->isCoreOrExternalModule() == 'external') { diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index fe3d3560b35..78b69f13082 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -564,7 +564,7 @@ $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields $sql = 'SELECT'; -if ($search_all > 0) { +if ($search_all !== '') { $sql = 'SELECT DISTINCT'; } $sql .= ' s.rowid as socid, s.nom as name, s.name_alias as alias, s.email, s.phone, s.fax , s.address, s.town, s.zip, s.fk_pays, s.client, s.fournisseur, s.code_client,'; diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index eb8cb1d7180..a724d2001ff 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -1417,6 +1417,14 @@ class FactureRec extends CommonInvoice $facture->multicurrency_tx = $facturerec->multicurrency_tx; } + if (isset($facture->array_options) && isset($facturerec->array_options)) { + foreach ($facturerec->array_options as $key => $value) { + if (isset($facture->array_options[$key])) { + $facture->array_options[$key] = $value; + } + } + } + $invoiceidgenerated = $facture->create($user); if ($invoiceidgenerated <= 0) { $this->errors = $facture->errors; diff --git a/htdocs/compta/paiement/cheque/card.php b/htdocs/compta/paiement/cheque/card.php index 4e527c8f229..eae893f579e 100644 --- a/htdocs/compta/paiement/cheque/card.php +++ b/htdocs/compta/paiement/cheque/card.php @@ -144,6 +144,7 @@ if ($action == 'setref' && $user->hasRight('banque', 'cheque')) { if ($action == 'create' && GETPOSTINT("accountid") > 0 && $user->hasRight('banque', 'cheque')) { if (GETPOSTISARRAY('toRemise')) { $object->type = $type; + $object->date_bordereau = dol_now(); $arrayofid = GETPOST('toRemise', 'array:int'); $result = $object->create($user, GETPOSTINT("accountid"), 0, $arrayofid); @@ -168,6 +169,7 @@ if ($action == 'create' && GETPOSTINT("accountid") > 0 && $user->hasRight('banqu exit; } else { setEventMessages($object->error, $object->errors, 'errors'); + $action = 'new'; } } else { setEventMessages($langs->trans("ErrorSelectAtLeastOne"), null, 'mesgs'); diff --git a/htdocs/compta/paiement/cheque/class/remisecheque.class.php b/htdocs/compta/paiement/cheque/class/remisecheque.class.php index b0a95db90a9..0eb1559c2c6 100644 --- a/htdocs/compta/paiement/cheque/class/remisecheque.class.php +++ b/htdocs/compta/paiement/cheque/class/remisecheque.class.php @@ -345,7 +345,7 @@ class RemiseCheque extends CommonObject */ public function validate($user) { - global $langs, $conf; + global $conf; $this->errno = 0; @@ -357,7 +357,7 @@ class RemiseCheque extends CommonObject $sql = "UPDATE ".MAIN_DB_PREFIX."bordereau_cheque"; $sql .= " SET statut = 1, ref = '".$this->db->escape($numref)."'"; $sql .= " WHERE rowid = ".((int) $this->id); - $sql .= " AND entity = ".$conf->entity; + $sql .= " AND entity = ".((int) $conf->entity); $sql .= " AND statut = 0"; dol_syslog("RemiseCheque::Validate", LOG_DEBUG); @@ -368,13 +368,15 @@ class RemiseCheque extends CommonObject if ($num == 1) { $this->ref = $numref; $this->statut = 1; + $this->status = 1; } else { $this->errno = -1029; - dol_syslog("Remisecheque::Validate Error ".$this->errno, LOG_ERR); + dol_syslog("Remisecheque::validate Error ".$this->errno, LOG_ERR); } } else { $this->errno = -1033; - dol_syslog("Remisecheque::Validate Error ".$this->errno, LOG_ERR); + $this->error = $this->db->lasterror(); + dol_syslog("Remisecheque::validate Error ".$this->errno, LOG_ERR); } } diff --git a/htdocs/core/db/mysqli.class.php b/htdocs/core/db/mysqli.class.php index b0776c70842..ed4a6358753 100644 --- a/htdocs/core/db/mysqli.class.php +++ b/htdocs/core/db/mysqli.class.php @@ -1289,6 +1289,18 @@ class DoliDBMysqli extends DoliDB } } + +// Protection if class mysqli doe not exists to avoid error +if (!class_exists('mysqli')) { + /** + * A dummy class to avoid error when class is not available + */ + class mysqli + { + // Empty content + } +} + /** * Class to make SSL connection */ diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index 17ae76cba29..790abc28b05 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -1369,7 +1369,7 @@ function get_next_value($db, $mask, $table, $field, $where = '', $objsoc = '', $ if ($bentityon) { // only if entity enable $maskrefclient_sql .= " AND entity IN (".getEntity($sharetable).")"; } elseif (!empty($forceentity)) { - $sql .= " AND entity IN (".$db->sanitize($forceentity).")"; + $maskrefclient_sql .= " AND entity IN (".$db->sanitize($forceentity).")"; } if ($where) { $maskrefclient_sql .= $where; //use the same optional where as general mask diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 40ac55b3ba7..2532ccdfe8c 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -2541,10 +2541,12 @@ function pdf_getLinkedObjects(&$object, $outputlangs) if (count($objects) > 1) { $order = null; + + $refListsTxt = ''; if (empty($object->linkedObjects['commande']) && $object->element != 'commande') { - $object->note_public = dol_concatdesc($object->note_public, $outputlangs->transnoentities("RefOrder").' / '.$outputlangs->transnoentities("RefSending").' :'); + $refListsTxt.= $outputlangs->transnoentities("RefOrder").' / '.$outputlangs->transnoentities("RefSending").' :'; } else { - $object->note_public = dol_concatdesc($object->note_public, $outputlangs->transnoentities("RefSending").' :'); + $refListsTxt.=$outputlangs->transnoentities("RefSending").' :'; } // We concat this record info into fields xxx_value. title is overwrote. foreach ($objects as $elementobject) { @@ -2559,14 +2561,16 @@ function pdf_getLinkedObjects(&$object, $outputlangs) } } } - + $refListsTxt.= (!empty($refListsTxt)?' ':''); if (! is_object($order)) { - $object->note_public = dol_concatdesc($object->note_public, $outputlangs->transnoentities($elementobject->ref)); + $refListsTxt.= $outputlangs->transnoentities($elementobject->ref); } else { - $object->note_public = dol_concatdesc($object->note_public, $outputlangs->convToOutputCharset($order->ref).($order->ref_client ? ' ('.$order->ref_client.')' : '')); - $object->note_public = dol_concatdesc($object->note_public, ' / '.$outputlangs->transnoentities($elementobject->ref)); + $refListsTxt.= $outputlangs->convToOutputCharset($order->ref).($order->ref_client ? ' ('.$order->ref_client.')' : ''); + $refListsTxt.= ' / '.$outputlangs->transnoentities($elementobject->ref); } } + + $object->note_public = dol_concatdesc($object->note_public, $refListsTxt); } elseif (count($objects) == 1) { $elementobject = array_shift($objects); $order = null; diff --git a/htdocs/core/modules/DolibarrModules.class.php b/htdocs/core/modules/DolibarrModules.class.php index a2612a03976..239bfcfc6a4 100644 --- a/htdocs/core/modules/DolibarrModules.class.php +++ b/htdocs/core/modules/DolibarrModules.class.php @@ -2706,6 +2706,61 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it return 0; } + /** + * Check for module compliance with Dolibarr rules and law + * If a module is reported by this function,it is surely a malware. Delete it as soon as possible. + * + * @return int|string Return integer <0 if Error, 0 == not compliant, 'string' with message if module not compliant + */ + public function checkForCompliance() + { + global $conf, $langs; + + // Get list of illegal modules name or ID + if (empty($conf->cache['noncompliantmodules'])) { + require_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php'; + + $urlforblacklistmodules = 'www.dolibarr.org/_service_noncompliantmodules.php'; + + $result = getURLContent($urlforblacklistmodules, 'GET', '', 1, array(), array('http', 'https'), 0); // Accept http or https links on external remote server only + if (isset($result['content']) && $result['http_code'] == 200) { + $langs->load("errors"); + + // Security warning : be careful with remote data content, the module editor could be hacked (or evil) so limit to a-z A-Z 0-9 _ . - + $arrayoflines = preg_split("/[\n,]/", $result['content']); + foreach ($arrayoflines as $line) { + $tmpfieldsofline = explode(';', $line); + $modulekey = strtolower($tmpfieldsofline[0]); + $conf->cache['noncompliantmodules'][$modulekey]['name'] = $tmpfieldsofline[0]; + $conf->cache['noncompliantmodules'][$modulekey]['id'] = $tmpfieldsofline[1]; + $conf->cache['noncompliantmodules'][$modulekey]['message'] = $langs->trans(empty($tmpfieldsofline[2]) ? 'WarningModuleAffiliatedToAReportedCompany' : $tmpfieldsofline[2]); + if (!empty($tmpfieldsofline[3])) { + $message2 = $langs->trans("WarningModuleAffiliatedToAPiratPlatform", '{s}'); + $listofillegalurl = ''; + foreach (explode(" ", $tmpfieldsofline[3]) as $illegalurl) { + $listofillegalurl .= ($listofillegalurl ? ' '.$langs->trans("or").' ' : '').''.preg_replace('/[^a-z0-9\.\-]/', '', $illegalurl).''; + } + $message2 = str_replace('{s}', $listofillegalurl, $message2); + $conf->cache['noncompliantmodules'][$modulekey]['message2'] = $message2; + } + } + } + } + + if (!empty($conf->cache['noncompliantmodules'])) { + $modulekey = strtolower($this->name); + if (in_array($modulekey, array_keys($conf->cache['noncompliantmodules']))) { + $answer = trim($conf->cache['noncompliantmodules'][$modulekey]['message']); + if (!empty($conf->cache['noncompliantmodules'][$modulekey]['message2'])) { + $answer .= '
'.$conf->cache['noncompliantmodules'][$modulekey]['message2']; + } + return $answer; + } + } + + return 0; + } + /** * Helper method to declare dictionaries one at a time (rather than declaring dictionaries property by property). * diff --git a/htdocs/core/modules/cheque/doc/pdf_blochet.class.php b/htdocs/core/modules/cheque/doc/pdf_blochet.class.php index f77851f4e74..d9fe8a453f1 100644 --- a/htdocs/core/modules/cheque/doc/pdf_blochet.class.php +++ b/htdocs/core/modules/cheque/doc/pdf_blochet.class.php @@ -285,7 +285,7 @@ class BordereauChequeBlochet extends ModeleChequeReceipts $pdf->SetFont('', '', $default_font_size); $pdf->SetXY(10, 32); - $pdf->MultiCell(0, 2, $outputlangs->transnoentities("BankAccount"), 0, 'L'); + $pdf->MultiCell(22, 2, $outputlangs->transnoentities("BankAccount"), 0, 'L'); pdf_bank($pdf, $outputlangs, 32, 32, $this->account, 1); $pdf->SetFont('', '', $default_font_size); diff --git a/htdocs/core/modules/cheque/mod_chequereceipt_mint.php b/htdocs/core/modules/cheque/mod_chequereceipt_mint.php index 6c9660efe0a..be85808b48d 100644 --- a/htdocs/core/modules/cheque/mod_chequereceipt_mint.php +++ b/htdocs/core/modules/cheque/mod_chequereceipt_mint.php @@ -124,7 +124,7 @@ class mod_chequereceipt_mint extends ModeleNumRefChequeReceipts $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; $sql .= " FROM ".MAIN_DB_PREFIX."bordereau_cheque"; $sql .= " WHERE ref like '".$db->escape($this->prefix)."____-%'"; - $sql .= " AND entity = ".$conf->entity; + $sql .= " AND entity = ".((int) $conf->entity); $resql = $db->query($sql); if ($resql) { @@ -139,8 +139,8 @@ class mod_chequereceipt_mint extends ModeleNumRefChequeReceipts return -1; } - //$date=time(); - $date = $object->date_bordereau; + $date = (empty($object) ? dol_now() : $object->date_bordereau); + $yymm = dol_print_date($date, "%y%m"); if ($max >= (pow(10, 4) - 1)) { @@ -150,6 +150,7 @@ class mod_chequereceipt_mint extends ModeleNumRefChequeReceipts } dol_syslog(__METHOD__." return ".$this->prefix.$yymm."-".$num); + return $this->prefix.$yymm."-".$num; } } diff --git a/htdocs/core/modules/cheque/mod_chequereceipt_thyme.php b/htdocs/core/modules/cheque/mod_chequereceipt_thyme.php index edff2ae13e8..c03e67d6687 100644 --- a/htdocs/core/modules/cheque/mod_chequereceipt_thyme.php +++ b/htdocs/core/modules/cheque/mod_chequereceipt_thyme.php @@ -135,7 +135,9 @@ class mod_chequereceipt_thyme extends ModeleNumRefChequeReceipts return 0; } - $numFinal = get_next_value($db, $mask, 'bordereau_cheque', 'ref', '', $objsoc, empty($object) ? dol_now() : $object->date_bordereau); + $date = (empty($object) ? dol_now() : $object->date_bordereau); + + $numFinal = get_next_value($db, $mask, 'bordereau_cheque', 'ref', '', $objsoc, $date); return $numFinal; } diff --git a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php index 8b1fd6c7584..4f2edeac811 100644 --- a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php @@ -566,10 +566,6 @@ class pdf_eratosthene extends ModelePDFCommandes $posYAfterImage = 0; $posYAfterDescription = 0; - if ($this->getColumnStatus('position')) { - $this->printStdColumnContent($pdf, $curY, 'position', (string) ($i + 1)); - } - 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 @@ -653,6 +649,11 @@ class pdf_eratosthene extends ModelePDFCommandes $pdf->SetFont('', '', $default_font_size - 1); // We reposition the default font + // # of line + if ($this->getColumnStatus('position')) { + $this->printStdColumnContent($pdf, $curY, 'position', $i + 1); + } + // VAT Rate if ($this->getColumnStatus('vat')) { $vat_rate = pdf_getlinevatrate($object, $i, $outputlangs, $hidedetails); diff --git a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php index 3c2c453e5d4..51ce296ddbc 100644 --- a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php @@ -589,10 +589,6 @@ class pdf_espadon extends ModelePdfExpedition $posYAfterDescription = 0; $heightforsignature = 0; - if ($this->getColumnStatus('position')) { - $this->printStdColumnContent($pdf, $curY, 'position', (string) ($i + 1)); - } - 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 + $heightforsignature + $heightforinfotot))) { // If photo too high, we moved completely on new page @@ -681,8 +677,12 @@ class pdf_espadon extends ModelePdfExpedition $pdf->SetFont('', '', $default_font_size - 1); // We reposition the default font - // weight + // # of line + if ($this->getColumnStatus('position')) { + $this->printStdColumnContent($pdf, $curY, 'position', $i + 1); + } + // weight $weighttxt = ''; if (empty($object->lines[$i]->fk_product_type) && $object->lines[$i]->weight) { $weighttxt = round($object->lines[$i]->weight * $object->lines[$i]->qty_shipped, 5).' '.measuringUnitString(0, "weight", $object->lines[$i]->weight_units, 1); diff --git a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php index 408ddf303a6..70e6b5fc0b8 100644 --- a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php @@ -720,10 +720,6 @@ class pdf_sponge extends ModelePDFFactures $posYAfterImage = 0; $posYAfterDescription = 0; - if ($this->getColumnStatus('position')) { - $this->printStdColumnContent($pdf, $curY, 'position', (string) ($i + 1)); - } - if ($this->getColumnStatus('photo')) { // We start with Photo of product line if (isset($imglinesize['width']) && isset($imglinesize['height']) && ($curY + $imglinesize['height']) > ($this->page_hauteur - $page_bottom_margin)) { // If photo too high, we moved completely on new page @@ -805,6 +801,11 @@ class pdf_sponge extends ModelePDFFactures $pdf->SetFont('', '', $default_font_size - 1); // We reposition the default font + // # of line + if ($this->getColumnStatus('position')) { + $this->printStdColumnContent($pdf, $curY, 'position', $i + 1); + } + // VAT Rate if ($this->getColumnStatus('vat')) { $vat_rate = pdf_getlinevatrate($object, $i, $outputlangs, $hidedetails); diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index 32a4473cace..0231d0cfa95 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -1022,7 +1022,7 @@ class pdf_azur extends ModelePDFPropales $posy = $pdf->GetY() + 2; } } - if ($conf->global->FACTURE_CHQ_NUMBER == -1) { + if (getDolGlobalInt('FACTURE_CHQ_NUMBER') == -1) { $pdf->SetXY($this->marge_gauche, $posy); $pdf->SetFont('', 'B', $default_font_size - $diffsizetitle); $pdf->MultiCell(100, 3, $outputlangs->transnoentities('PaymentByChequeOrderedTo', $this->emetteur->name), 0, 'L', 0); @@ -1041,8 +1041,8 @@ class pdf_azur extends ModelePDFPropales // If payment mode not forced or forced to VIR, show payment with BAN if (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'VIR') { if (!empty($object->fk_account) || !empty($object->fk_bank) || getDolGlobalInt('FACTURE_RIB_NUMBER')) { - $bankid = (empty($object->fk_account) ? $conf->global->FACTURE_RIB_NUMBER : $object->fk_account); - if (!empty($object->fk_bank)) { + $bankid = (empty($object->fk_account) ? getDolGlobalInt('FACTURE_RIB_NUMBER') : $object->fk_account); + if (!empty($object->fk_bank) && $object->fk_bank > 0) { $bankid = $object->fk_bank; // For backward compatibility when object->fk_account is forced with object->fk_bank } $account = new Account($this->db); @@ -1522,12 +1522,12 @@ class pdf_azur extends ModelePDFPropales } else { $pdf->SetTextColor(200, 0, 0); $pdf->SetFont('', 'B', $default_font_size - 2); - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound", $logo), 0, 'L'); - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorGoToGlobalSetup"), 0, 'L'); + $pdf->MultiCell($w, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound", $logo), 0, 'L'); + $pdf->MultiCell($w, 3, $outputlangs->transnoentities("ErrorGoToGlobalSetup"), 0, 'L'); } } else { $text = $this->emetteur->name; - $pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, $ltrdirection); + $pdf->MultiCell($w, 4, $outputlangs->convToOutputCharset($text), 0, $ltrdirection); } } @@ -1540,7 +1540,7 @@ class pdf_azur extends ModelePDFPropales $pdf->SetTextColor(128, 0, 0); $title .= ' - '.$outputlangs->transnoentities("NotValidated"); } - $pdf->MultiCell(100, 4, $title, '', 'R'); + $pdf->MultiCell($w, 4, $title, '', 'R'); $pdf->SetFont('', 'B', $default_font_size); @@ -1558,7 +1558,7 @@ class pdf_azur extends ModelePDFPropales $posy += 4; $pdf->SetXY($posx, $posy); $pdf->SetTextColor(0, 0, 60); - $pdf->MultiCell(100, 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')) { @@ -1592,18 +1592,18 @@ class pdf_azur extends ModelePDFPropales $posy = $pdf->getY(); $pdf->SetXY($posx, $posy); $pdf->SetTextColor(0, 0, 60); - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("DatePropal")." : ".dol_print_date($object->date, $displaydate, false, $outputlangs, true), '', 'R'); + $pdf->MultiCell($w, 3, $outputlangs->transnoentities("DatePropal")." : ".dol_print_date($object->date, $displaydate, false, $outputlangs, true), '', 'R'); $posy += 4; $pdf->SetXY($posx, $posy); $pdf->SetTextColor(0, 0, 60); - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("DateEndPropal")." : ".dol_print_date($object->fin_validite, $displaydate, false, $outputlangs, true), '', 'R'); + $pdf->MultiCell($w, 3, $outputlangs->transnoentities("DateEndPropal")." : ".dol_print_date($object->fin_validite, $displaydate, false, $outputlangs, true), '', 'R'); if (!getDolGlobalString('MAIN_PDF_HIDE_CUSTOMER_CODE') && $object->thirdparty->code_client) { $posy += 4; $pdf->SetXY($posx, $posy); $pdf->SetTextColor(0, 0, 60); - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("CustomerCode")." : ".$outputlangs->transnoentities($object->thirdparty->code_client), '', 'R'); + $pdf->MultiCell($w, 3, $outputlangs->transnoentities("CustomerCode")." : ".$outputlangs->transnoentities($object->thirdparty->code_client), '', 'R'); } // Get contact @@ -1615,7 +1615,7 @@ class pdf_azur extends ModelePDFPropales $posy += 4; $pdf->SetXY($posx, $posy); $pdf->SetTextColor(0, 0, 60); - $pdf->MultiCell(100, 3, $outputlangs->trans("SalesRepresentative")." : ".$usertmp->getFullName($langs), '', 'R'); + $pdf->MultiCell($w, 3, $outputlangs->trans("SalesRepresentative")." : ".$usertmp->getFullName($langs), '', 'R'); } } @@ -1624,7 +1624,7 @@ class pdf_azur extends ModelePDFPropales $top_shift = 0; // Show list of linked objects $current_y = $pdf->getY(); - $posy = pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, 100, 3, 'R', $default_font_size); + $posy = pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, $w, 3, 'R', $default_font_size); if ($current_y < $pdf->getY()) { $top_shift = $pdf->getY() - $current_y; } @@ -1764,7 +1764,7 @@ class pdf_azur extends ModelePDFPropales * Show area for the customer to sign * * @param TCPDF $pdf Object PDF - * @param Propal $object Object invoice + * @param Propal $object Object proposal * @param int $posy Position depart * @param Translate $outputlangs Object langs * @return int Position pour suite @@ -1785,7 +1785,7 @@ class pdf_azur extends ModelePDFPropales $pdf->SetFont('', '', $default_font_size - 2); $pdf->MultiCell($largcol, $tab_hl, $outputlangs->transnoentities("ProposalCustomerSignature"), 0, 'L', 1); - $pdf->SetXY($posx, $tab_top + $tab_hl); + $pdf->SetXY($posx, $tab_top + $tab_hl + 3); $pdf->MultiCell($largcol, $tab_hl * 3, '', 1, 'R'); if (getDolGlobalString('MAIN_PDF_PROPAL_USE_ELECTRONIC_SIGNING')) { // Can be retrieve with getSignatureAppearanceArray() diff --git a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php index 87999f618de..ae8aee74f51 100644 --- a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php @@ -574,10 +574,6 @@ class pdf_cyan extends ModelePDFPropales $posYAfterImage = 0; $posYAfterDescription = 0; - if ($this->getColumnStatus('position')) { - $this->printStdColumnContent($pdf, $curY, 'position', (string) ($i + 1)); - } - 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 + $heightforsignature + $heightforinfotot))) { // If photo too high, we moved completely on new page @@ -612,18 +608,18 @@ class pdf_cyan extends ModelePDFPropales $this->printColDescContent($pdf, $curY, 'desc', $object, $i, $outputlangs, $hideref, $hidedesc); $pageposafter = $pdf->getPage(); - if ($pageposafter > $pageposbefore) { // There is a pagebreak + if ($pageposafter > $pageposbefore) { // There is a pagebreak (not enough space for total+free text+footer) $pdf->rollbackTransaction(true); - $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. + $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it to simple footer, so we can retry as if we have just the simple footer. $this->printColDescContent($pdf, $curY, 'desc', $object, $i, $outputlangs, $hideref, $hidedesc); $pageposafter = $pdf->getPage(); $posyafter = $pdf->GetY(); //var_dump($posyafter); var_dump(($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))); exit; - if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforsignature + $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 ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforsignature + $heightforinfotot))) { // There is no space left for total+free text but no page break. + if ($i == ($nblines - 1)) { // No more lines, and no space left to show total, so we create a new page manually because no break page was done automatically for the last part. $pdf->AddPage('', '', true); if (!empty($tplidx)) { $pdf->useTemplate($tplidx); @@ -631,7 +627,7 @@ class pdf_cyan extends ModelePDFPropales $pdf->setPage($pageposafter + 1); } } else { - // We found a page break + // We found a page break that was done automatically and there is ow enough space for total+free text+footer. // 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; @@ -652,7 +648,7 @@ class pdf_cyan extends ModelePDFPropales $pdf->setTopMargin($this->marge_haute); $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 or photo were moved completely on next page, so we set the value for $curY and current page that will be used by the following output. if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) { $pdf->setPage($pageposafter); $curY = $tab_top_newpage; @@ -660,6 +656,11 @@ class pdf_cyan extends ModelePDFPropales $pdf->SetFont('', '', $default_font_size - 1); // We reposition the default font + // # of line + if ($this->getColumnStatus('position')) { + $this->printStdColumnContent($pdf, $curY, 'position', $i + 1); + } + // VAT Rate if ($this->getColumnStatus('vat')) { $vat_rate = pdf_getlinevatrate($object, $i, $outputlangs, $hidedetails); @@ -723,13 +724,13 @@ class pdf_cyan extends ModelePDFPropales } $parameters = array( - 'object' => $object, - 'i' => $i, - 'pdf' => & $pdf, - 'curY' => & $curY, - 'nexY' => & $nexY, - 'outputlangs' => $outputlangs, - 'hidedetails' => $hidedetails + 'object' => $object, + 'i' => $i, + 'pdf' => & $pdf, + 'curY' => & $curY, + 'nexY' => & $nexY, + 'outputlangs' => $outputlangs, + 'hidedetails' => $hidedetails ); $reshook = $hookmanager->executeHooks('printPDFline', $parameters, $this); // Note that $object may have been modified by hook @@ -750,13 +751,13 @@ class pdf_cyan extends ModelePDFPropales // TODO remise_percent is an obsolete field for object parent /*if ($object->remise_percent) { - $tvaligne -= ($tvaligne * $object->remise_percent) / 100; + $tvaligne -= ($tvaligne * $object->remise_percent) / 100; } if ($object->remise_percent) { - $localtax1ligne -= ($localtax1ligne * $object->remise_percent) / 100; + $localtax1ligne -= ($localtax1ligne * $object->remise_percent) / 100; } if ($object->remise_percent) { - $localtax2ligne -= ($localtax2ligne * $object->remise_percent) / 100; + $localtax2ligne -= ($localtax2ligne * $object->remise_percent) / 100; }*/ $vatrate = (string) $object->lines[$i]->tva_tx; @@ -1005,7 +1006,7 @@ class pdf_cyan extends ModelePDFPropales } $posxval = 52; - if (getDolGlobalString('MAIN_PDF_DATE_TEXT')) { + if (getDolGlobalString('MAIN_PDF_DELIVERY_DATE_TEXT')) { $displaydate = "daytext"; } else { $displaydate = "day"; @@ -1139,7 +1140,7 @@ class pdf_cyan extends ModelePDFPropales // If payment mode not forced or forced to VIR, show payment with BAN if (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'VIR') { if ($object->fk_account > 0 || $object->fk_bank > 0 || getDolGlobalInt('FACTURE_RIB_NUMBER')) { - $bankid = ($object->fk_account <= 0 ? $conf->global->FACTURE_RIB_NUMBER : $object->fk_account); + $bankid = ($object->fk_account <= 0 ? getDolGlobalInt('FACTURE_RIB_NUMBER') : $object->fk_account); if ($object->fk_bank > 0) { $bankid = $object->fk_bank; // For backward compatibility when object->fk_account is forced with object->fk_bank } @@ -1319,12 +1320,12 @@ class pdf_cyan extends ModelePDFPropales foreach ($localtax_rate as $tvakey => $tvaval) { if ($tvakey != 0) { // On affiche pas taux 0 - //$this->atleastoneratenotnull++; + //$this->atleastoneratenotnull++; - $index++; - $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); + $index++; + $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); - $tvacompl = ''; + $tvacompl = ''; if (preg_match('/\*/', $tvakey)) { $tvakey = str_replace('*', '', $tvakey); $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; @@ -1354,12 +1355,12 @@ class pdf_cyan extends ModelePDFPropales foreach ($localtax_rate as $tvakey => $tvaval) { // retrieve global local tax if ($tvakey != 0) { // On affiche pas taux 0 - //$this->atleastoneratenotnull++; + //$this->atleastoneratenotnull++; - $index++; - $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); + $index++; + $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); - $tvacompl = ''; + $tvacompl = ''; if (preg_match('/\*/', $tvakey)) { $tvakey = str_replace('*', '', $tvakey); $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; @@ -1367,7 +1368,12 @@ class pdf_cyan extends ModelePDFPropales $totalvat = $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code).(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transcountrynoentities("TotalLT2", $mysoc->country_code) : ''); $totalvat .= ' '; - $totalvat .= vatrate((string) abs((float) $tvakey), 1).$tvacompl; + if (getDolGlobalString('PDF_LOCALTAX2_LABEL_IS_CODE_OR_RATE') == 'nocodenorate') { + $totalvat .= $tvacompl; + } else { + $totalvat .= vatrate((string) abs((float) $tvakey), 1).$tvacompl; + } + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1); $total_localtax = ((isModEnabled("multicurrency") && isset($object->multicurrency_tx) && $object->multicurrency_tx != 1) ? price2num($tvaval * $object->multicurrency_tx, 'MT') : $tvaval); @@ -1410,18 +1416,17 @@ class pdf_cyan extends ModelePDFPropales $pdf->MultiCell($largcol2, $tab2_hl, price($deja_regle, 0, $outputlangs), 0, 'R', 0); /* - if ($object->close_code == 'discount_vat') - { - $index++; - $pdf->SetFillColor(255,255,255); + if ($object->close_code == 'discount_vat') { + $index++; + $pdf->SetFillColor(255,255,255); - $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); - $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("EscompteOfferedShort"), $useborder, 'L', 1); + $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("EscompteOfferedShort"), $useborder, 'L', 1); - $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); - $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_ttc - $deja_regle, 0, $outputlangs), $useborder, 'R', 1); + $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); + $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_ttc - $deja_regle, 0, $outputlangs), $useborder, 'R', 1); - $resteapayer=0; + $resteapayer=0; } */ @@ -1850,7 +1855,7 @@ class pdf_cyan extends ModelePDFPropales $pdf->SetFont('', '', $default_font_size - 2); $pdf->MultiCell($largcol, $tab_hl, $outputlangs->transnoentities("ProposalCustomerSignature"), 0, 'L', 1); - $pdf->SetXY($posx, $tab_top + $tab_hl); + $pdf->SetXY($posx, $tab_top + $tab_hl + 3); $pdf->MultiCell($largcol, $tab_hl * 3, '', 1, 'R'); if (getDolGlobalString('MAIN_PDF_PROPAL_USE_ELECTRONIC_SIGNING')) { diff --git a/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php b/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php index b521cc9f444..cb4e0aab5c6 100644 --- a/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php +++ b/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php @@ -526,10 +526,6 @@ class pdf_cornas extends ModelePDFSuppliersOrders $posYAfterImage = 0; $posYAfterDescription = 0; - if ($this->getColumnStatus('position')) { - $this->printStdColumnContent($pdf, $curY, 'position', (string) ($i + 1)); - } - // We start with Photo of product line if ($this->getColumnStatus('photo')) { // We start with Photo of product line @@ -556,6 +552,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders $posYAfterImage = $curY + $imglinesize['height']; } } + // Description of product line $curX = $this->posxdesc - 1; $showpricebeforepagebreak = 1; @@ -611,6 +608,11 @@ class pdf_cornas extends ModelePDFSuppliersOrders $pdf->SetFont('', '', $default_font_size - 1); // On repositionne la police par default + // # of line + if ($this->getColumnStatus('position')) { + $this->printStdColumnContent($pdf, $curY, 'position', $i + 1); + } + // VAT Rate if ($this->getColumnStatus('vat')) { $vat_rate = pdf_getlinevatrate($object, $i, $outputlangs, $hidedetails); diff --git a/htdocs/fourn/facture/card-rec.php b/htdocs/fourn/facture/card-rec.php index 1f08e652c56..ee7e72f277c 100644 --- a/htdocs/fourn/facture/card-rec.php +++ b/htdocs/fourn/facture/card-rec.php @@ -544,8 +544,8 @@ if (empty($reshook)) { $label = ((GETPOST('product_label') && GETPOST('product_label') != $prod->label) ? GETPOST('product_label') : ''); // Update if prices fields are defined - $tva_tx = get_default_tva($mysoc, $object->thirdparty, $prod->id); - $tva_npr = get_default_npr($mysoc, $object->thirdparty, $prod->id); + $tva_tx = get_default_tva($object->thirdparty, $mysoc, $prod->id); + $tva_npr = get_default_npr($object->thirdparty, $mysoc, $prod->id); if (empty($tva_tx)) { $tva_npr = 0; } @@ -553,7 +553,7 @@ if (empty($reshook)) { // Search the correct price into loaded array product_price_by_qty using id of array retrieved into POST['pqp']. $pqp = (GETPOSTINT('pbq') ? GETPOSTINT('pbq') : 0); - $datapriceofproduct = $prod->getSellPrice($mysoc, $object->thirdparty, $pqp); + $datapriceofproduct = $prod->getSellPrice($object->thirdparty, $mysoc, $pqp); $pu_ht = $datapriceofproduct['pu_ht']; $pu_ttc = $datapriceofproduct['pu_ttc']; @@ -668,8 +668,8 @@ if (empty($reshook)) { $buyingprice = price2num(GETPOST('buying_price' . $predef) != '' ? GETPOST('buying_price' . $predef) : ''); // If buying_price is '0', we must keep this value // Local Taxes - $localtax1_tx = get_localtax($tva_tx, 1, $object->thirdparty, $mysoc, $tva_npr); - $localtax2_tx = get_localtax($tva_tx, 2, $object->thirdparty, $mysoc, $tva_npr); + $localtax1_tx = get_localtax($tva_tx, 1, $mysoc, $object->thirdparty, $tva_npr); + $localtax2_tx = get_localtax($tva_tx, 2, $mysoc, $object->thirdparty, $tva_npr); $info_bits = 0; if ($tva_npr) { $info_bits |= 0x01; @@ -1115,7 +1115,7 @@ if ($action == 'create') { $disableedit = 1; $disablemove = 1; $disableremove = 1; - $object->printObjectLines('', $mysoc, $object->thirdparty, $lineid, 0); // No date selector for template invoice + $object->printObjectLines('', $object->thirdparty, $mysoc, $lineid, 0); // No date selector for template invoice } print "\n"; @@ -1569,7 +1569,7 @@ if ($action == 'create') { $canchangeproduct = 0; $object->statut = $object->suspended; - $object->printObjectLines($action, $mysoc, $object->thirdparty, $lineid, 0); // No date selector for template invoice + $object->printObjectLines($action, $object->thirdparty, $mysoc, $lineid, 0); // No date selector for template invoice } // Form to add new line diff --git a/htdocs/install/mysql/tables/llx_mrp_mo-mrp.key.sql b/htdocs/install/mysql/tables/llx_mrp_mo-mrp.key.sql index 0bf20b1b48e..6f8aead90c8 100644 --- a/htdocs/install/mysql/tables/llx_mrp_mo-mrp.key.sql +++ b/htdocs/install/mysql/tables/llx_mrp_mo-mrp.key.sql @@ -1,4 +1,4 @@ --- Copyright (C) ---Put here your own copyright and developer email--- +-- Copyright (C) 2024 Laurent Destailleur -- -- 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 diff --git a/htdocs/install/mysql/tables/llx_mrp_mo_extrafields-mrp.key.sql b/htdocs/install/mysql/tables/llx_mrp_mo_extrafields-mrp.key.sql index cad0d9ffd79..da8e70b6375 100644 --- a/htdocs/install/mysql/tables/llx_mrp_mo_extrafields-mrp.key.sql +++ b/htdocs/install/mysql/tables/llx_mrp_mo_extrafields-mrp.key.sql @@ -1,4 +1,4 @@ --- Copyright (C) 2019 Alicealalalamdskfldmjgdfgdfhfghgfh Adminson +-- Copyright (C) 2024 Laurent Destailleur -- -- 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 diff --git a/htdocs/install/mysql/tables/llx_mrp_mo_extrafields-mrp.sql b/htdocs/install/mysql/tables/llx_mrp_mo_extrafields-mrp.sql index 96dc828134e..bcabab0d617 100644 --- a/htdocs/install/mysql/tables/llx_mrp_mo_extrafields-mrp.sql +++ b/htdocs/install/mysql/tables/llx_mrp_mo_extrafields-mrp.sql @@ -1,4 +1,4 @@ --- Copyright (C) 2019 Alicealalalamdskfldmjgdfgdfhfghgfh Adminson +-- Laurent Destailleur -- -- 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 diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index 02c07e6ca87..203f463b048 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -391,6 +391,9 @@ WarningReadBankAlsoAllowedIfUserHasPermission=Warning, reading bank account is a WarningNoDataTransferedInAccountancyYet=Please note, there is no data in the accounting table. Please transfer your data recorded in the application to the accounting section or change the calculation mode to analyze the data recorded outside of accounting. WarningChangingThisMayBreakStopTaskScheduler=Warning, changing this value may disable the scheduler WarningAmountOfFileDiffersFromSumOfLines=Warning, amount of file (%s) differs from the sum of lines (%s) +WarningModuleAffiliatedToAReportedCompany=Warning, this module has been reported to the Dolibarr foundation as being published by a company using illegal practices (non-compliance with the rules for using the Dolibarr brand, collecting your data without your consent or deploying malware). Use it at your own risk! +WarningModuleAffiliatedToAPiratPlatform=Be careful when getting a module (paid or free) from a suspicious non official platform like %s + SwissQrOnlyVIR = SwissQR invoice can only be added on invoices set to be paid with credit transfer payments. SwissQrCreditorAddressInvalid = Creditor address is invalid (are ZIP and city set? (%s) SwissQrCreditorInformationInvalid = Creditor information is invalid for IBAN (%s): %s diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index 219cbdc0176..9a298fcc8e1 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -1931,6 +1931,7 @@ while ($i < $imaxinloop) { $userstatic->user_mobile = $val['user_mobile']; $userstatic->job = $val['job']; $userstatic->gender = $val['gender']; + $userstatic->statut = $val['statut']; print ($nbofsalesrepresentative < 2) ? $userstatic->getNomUrl(-1, '', 0, 0, 12) : $userstatic->getNomUrl(-2); $j++; if ($j < $nbofsalesrepresentative) { diff --git a/htdocs/takepos/index.php b/htdocs/takepos/index.php index 55828d2594e..3af0a18669e 100644 --- a/htdocs/takepos/index.php +++ b/htdocs/takepos/index.php @@ -598,7 +598,7 @@ function CloseBill() { if (!empty($conf->global->TAKEPOS_FORBID_SALES_TO_DEFAULT_CUSTOMER)) { echo "customerAnchorTag = document.querySelector('a[id=\"customer\"]'); "; echo "if (customerAnchorTag && customerAnchorTag.innerText.trim() === '".$langs->trans("Customer")."') { "; - echo "alert('".$langs->trans("NoClientErrorMessage")."'); "; + echo "alert('".dol_escape_js($langs->trans("NoClientErrorMessage"))."'); "; echo "return; } \n"; } ?>