Merge branch '20.0' of https://github.com/Dolibarr/dolibarr into fix_v20_pdf_space_lost_with_images

This commit is contained in:
John BOTELLA 2024-10-18 10:00:27 +02:00
commit 68df2bf79f
9 changed files with 44 additions and 31 deletions

View file

@ -561,7 +561,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,';

View file

@ -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');

View file

@ -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);
}
}

View file

@ -292,7 +292,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);

View file

@ -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;
}
}

View file

@ -128,7 +128,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;
}

View file

@ -1016,7 +1016,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);
@ -1035,8 +1035,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);
@ -1516,12 +1516,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);
}
}
@ -1534,7 +1534,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);
@ -1552,7 +1552,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')) {
@ -1586,18 +1586,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
@ -1609,7 +1609,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');
}
}
@ -1618,7 +1618,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;
}
@ -1758,7 +1758,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

View file

@ -997,7 +997,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";
@ -1078,8 +1078,8 @@ class pdf_cyan extends ModelePDFPropales
if (!getDolGlobalString('PROPOSAL_PDF_HIDE_PAYMENTMODE')) {
// Show payment mode
if ($object->mode_reglement_code
&& $object->mode_reglement_code != 'CHQ'
&& $object->mode_reglement_code != 'VIR') {
&& $object->mode_reglement_code != 'CHQ'
&& $object->mode_reglement_code != 'VIR') {
$pdf->SetFont('', 'B', $default_font_size - $diffsizetitle);
$pdf->SetXY($this->marge_gauche, $posy);
$titre = $outputlangs->transnoentities("PaymentMode").':';
@ -1131,7 +1131,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
}
@ -1359,7 +1359,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(abs($tvakey), 1).$tvacompl;
if (getDolGlobalString('PDF_LOCALTAX2_LABEL_IS_CODE_OR_RATE') == 'nocodenorate') {
$totalvat .= $tvacompl;
} else {
$totalvat .= vatrate(abs($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);
@ -1402,8 +1407,7 @@ class pdf_cyan extends ModelePDFPropales
$pdf->MultiCell($largcol2, $tab2_hl, price($deja_regle, 0, $outputlangs), 0, 'R', 0);
/*
if ($object->close_code == 'discount_vat')
{
if ($object->close_code == 'discount_vat') {
$index++;
$pdf->SetFillColor(255,255,255);

View file

@ -268,6 +268,8 @@ ALTER TABLE llx_ticket ADD COLUMN origin_references text DEFAULT NULL;
ALTER TABLE llx_expensereport MODIFY COLUMN model_pdf varchar(255) DEFAULT NULL;
ALTER TABLE llx_fichinter_rec MODIFY COLUMN modelpdf varchar(255) DEFAULT NULL;
ALTER TABLE llx_hrm_evaluation MODIFY COLUMN modelpdf varchar(255) DEFAULT NULL;
ALTER TABLE llx_societe ADD COLUMN geolat double(24,8) DEFAULT NULL;
ALTER TABLE llx_societe ADD COLUMN geolong double(24,8) DEFAULT NULL;
ALTER TABLE llx_societe ADD COLUMN geopoint point DEFAULT NULL;