Merge branch '17.0' of git@github.com:Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur 2023-01-11 21:32:41 +01:00
commit 8ced29cb00
15 changed files with 39 additions and 25 deletions

View File

@ -4597,6 +4597,9 @@ class OrderLine extends CommonOrderLine
if (empty($this->remise_percent)) {
$this->remise_percent = 0;
}
if (empty($this->remise)) {
$this->remise = 0;
}
if (empty($this->info_bits)) {
$this->info_bits = 0;
}

View File

@ -1288,7 +1288,8 @@ abstract class CommonDocGenerator
}
$extrafields = $this->extrafieldsCache;
$extrafieldOutputContent = $extrafields->showOutputField($extrafieldKey, $object->array_options[$extrafieldOptionsKey], '', $object->table_element);
$extrafieldOutputContent = '';
if (isset($object->array_options[$extrafieldOptionsKey])) $extrafieldOutputContent = $extrafields->showOutputField($extrafieldKey, $object->array_options[$extrafieldOptionsKey], '', $object->table_element);
// TODO : allow showOutputField to be pdf public friendly, ex: in a link to object, clean getNomUrl to remove link and images... like a getName methode ...
if ($extrafields->attributes[$object->table_element]['type'][$extrafieldKey] == 'link') {

View File

@ -8047,7 +8047,7 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null,
$substitutionarray['__AMOUNT_TEXT__'] = is_object($object) ? dol_convertToWord($object->total_ttc, $outputlangs, '', true) : '';
$substitutionarray['__AMOUNT_TEXTCURRENCY__'] = is_object($object) ? dol_convertToWord($object->total_ttc, $outputlangs, $conf->currency, true) : '';
$substitutionarray['__AMOUNT_REMAIN__'] = is_object($object) ? $object->total_ttc - $already_payed_all : '';
$substitutionarray['__AMOUNT_REMAIN__'] = is_object($object) ? price2num($object->total_ttc - $already_payed_all, 'MT') : '';
$substitutionarray['__AMOUNT_VAT__'] = is_object($object) ? (isset($object->total_vat) ? $object->total_vat : $object->total_tva) : '';
$substitutionarray['__AMOUNT_VAT_TEXT__'] = is_object($object) ? (isset($object->total_vat) ? dol_convertToWord($object->total_vat, $outputlangs, '', true) : dol_convertToWord($object->total_tva, $outputlangs, '', true)) : '';

View File

@ -832,7 +832,7 @@ class pdf_espadon extends ModelePdfExpedition
$totalToShip = $tmparray['toship'];
// Set trueVolume and volume_units not currently stored into database
if ($object->trueWidth && $object->trueHeight && $object->trueDepth) {
$object->trueVolume = price(($object->trueWidth * $object->trueHeight * $object->trueDepth), 0, $outputlangs, 0, 0);
$object->trueVolume = $object->trueWidth * $object->trueHeight * $object->trueDepth;
$object->volume_units = $object->size_units * 3;
}

View File

@ -567,7 +567,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
// Total HT line
if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_PURCHASE_ORDER_WITHOUT_TOTAL_COLUMN)) {
$total_excl_tax = pdf_getlinetotalexcltax($object, $i, $outputlangs);
$total_excl_tax = pdf_getlinetotalexcltax($object, $i, $outputlangs, $hidedetails);
$pdf->SetXY($this->postotalht, $curY);
$pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->postotalht, 3, $total_excl_tax, 0, 'R', 0);
}

View File

@ -40,7 +40,7 @@ if ($action == 'presend') {
$titreform = 'SendMail';
$object->fetch_projet();
if (!isset($file)) $file = null;
$ref = dol_sanitizeFileName($object->ref);
if (!in_array($object->element, array('user', 'member'))) {
//$fileparams['fullname'] can be filled from the card
@ -57,7 +57,7 @@ if ($action == 'presend') {
}
}
$file = $fileparams['fullname'];
$file = isset($fileparams['fullname'])?$fileparams['fullname']:null;
}
// Define output language

View File

@ -52,7 +52,7 @@ $ref = GETPOST('ref', 'alpha');
$action = GETPOST('action', 'aZ09');
$cancel = GETPOST('cancel', 'alpha');
$confirm = GETPOST('confirm', 'alpha');
$socid = GETPOST('socid', 'int');
$amount = price2num(GETPOST('amount', 'alphanohtml'), 'MT');
$donation_date = dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear'));
$projectid = (GETPOST('projectid') ? GETPOST('projectid', 'int') : 0);
@ -63,6 +63,13 @@ if ($id > 0 || $ref) {
$object->fetch($id, $ref);
}
if (!empty($socid) && $socid > 0) {
$soc = new Societe($db);
if ($socid > 0) {
$soc->fetch($socid);
}
}
$extrafields = new ExtraFields($db);
// fetch optionals attributes and labels

View File

@ -60,6 +60,7 @@ $search_status = (GETPOST("search_status", 'intcomma') != '') ? GETPOST("search_
$search_all = trim((GETPOST('search_all', 'alphanohtml') != '') ?GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml'));
$search_ref = GETPOST('search_ref', 'alpha');
$search_company = GETPOST('search_company', 'alpha');
$search_thirdparty = GETPOST('search_thirdparty', 'alpha');
$search_name = GETPOST('search_name', 'alpha');
$search_amount = GETPOST('search_amount', 'alpha');
$optioncss = GETPOST('optioncss', 'alpha');
@ -72,6 +73,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
$search_all = "";
$search_ref = "";
$search_company = "";
$search_thirdparty = "";
$search_name = "";
$search_amount = "";
$search_status = '';

View File

@ -240,12 +240,9 @@ class EcmFiles extends CommonObject
}
// If ref not defined
$ref = '';
if (!empty($this->ref)) {
$ref = $this->ref;
} else {
if (empty($this->ref)) {
include_once DOL_DOCUMENT_ROOT.'/core/lib/security.lib.php';
$ref = dol_hash($this->filepath.'/'.$this->filename, 3);
$this->ref = dol_hash($this->filepath.'/'.$this->filename, 3);
}
$maxposition = 0;
@ -300,7 +297,7 @@ class EcmFiles extends CommonObject
$sql .= 'src_object_type,';
$sql .= 'src_object_id';
$sql .= ') VALUES (';
$sql .= " '".$this->db->escape($ref)."', ";
$sql .= " '".$this->db->escape($this->ref)."', ";
$sql .= ' '.(!isset($this->label) ? 'NULL' : "'".$this->db->escape($this->label)."'").',';
$sql .= ' '.(!isset($this->share) ? 'NULL' : "'".$this->db->escape($this->share)."'").',';
$sql .= ' '.((int) $this->entity).',';

View File

@ -1331,7 +1331,7 @@ class FactureFournisseurRec extends CommonInvoice
// We refresh the object in order to have all necessary data (like date_lim_reglement)
$new_fac_fourn->fetch($new_fac_fourn->id);
$result = $new_fac_fourn->generateDocument($facturerec->model_pdf, $langs);
if ($result <= 0) {
if ($result < 0) {
$this->errors = $new_fac_fourn->errors;
$this->error = $new_fac_fourn->error;
$error++;

View File

@ -46,7 +46,7 @@ foreach ($linkedObjectBlock as $key => $objectlink) {
?>
<tr class="<?php echo $trclass; ?>">
<td><?php echo $langs->trans("SupplierOrder"); ?></td>
<td><a href="<?php echo DOL_URL_ROOT.'/fourn/commande/card.php?id='.$objectlink->id ?>"><?php echo img_object($langs->trans("ShowOrder"), "order").' '.$objectlink->ref; ?></a></td>
<td><?php print $objectlink->getNomUrl(1); ?></td>
<td class="left"><?php echo $objectlink->ref_supplier; ?></td>
<td class="center"><?php echo dol_print_date($objectlink->date, 'day'); ?></td>
<td class="right"><?php

View File

@ -49,6 +49,11 @@ $pagenext = $page + 1;
if (!$sortorder) {
$sortorder = "ASC";
}
if ($user->rights->margins->read->all) {
$agentid = GETPOST('agentid', 'int');
} else {
$agentid = $user->id;
}
if (!$sortfield) {
if ($agentid > 0) {
$sortfield = "s.nom";
@ -74,11 +79,6 @@ if (!empty($enddatemonth)) {
}
// Security check
if ($user->rights->margins->read->all) {
$agentid = GETPOST('agentid', 'int');
} else {
$agentid = $user->id;
}
$result = restrictedArea($user, 'margins');
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
@ -317,7 +317,8 @@ if ($result) {
$sortfield = 'name';
}
$group_list = dol_sort_array($group_list, $sortfield, $sortorder);
$cumul_achat = 0;
$cumul_vente = 0;
foreach ($group_list as $group_id => $group_array) {
$pa = $group_array['buying_price'];
$pv = $group_array['selling_price'];

View File

@ -1033,6 +1033,7 @@ if ($source == 'order') {
$amount = price2num($amount);
}
$tag = '';
if (GETPOST('fulltag', 'alpha')) {
$fulltag = GETPOST('fulltag', 'alpha');
} else {

View File

@ -174,7 +174,7 @@ if (!empty($_SESSION['ipaddress'])) { // To avoid to make action twice
$companylangs->setDefaultLang($mysoc->default_lang);
$companylangs->loadLangs(array('main', 'members', 'bills', 'paypal', 'paybox'));
$from = $conf->global->MAILING_EMAIL_FROM;
$from = !empty($conf->global->MAILING_EMAIL_FROM) ? $conf->global->MAILING_EMAIL_FROM : getDolGlobalString("MAIN_MAIL_EMAIL_FROM");
$sendto = $sendemail;
$urlback = $_SERVER["REQUEST_URI"];

View File

@ -1327,7 +1327,9 @@ if ($ispaymentok) {
if ($attendeetovalidate->email_company && $attendeetovalidate->email_company != $thirdparty->email) {
$cc = ($cc ? ', ' : '').$attendeetovalidate->email_company;
}
$from = $conf->global->MAILING_EMAIL_FROM;
$from = !empty($conf->global->MAILING_EMAIL_FROM) ? $conf->global->MAILING_EMAIL_FROM : getDolGlobalString("MAIN_MAIL_EMAIL_FROM");
$urlback = $_SERVER["REQUEST_URI"];
$ishtml = dol_textishtml($texttosend); // May contain urls
@ -1628,7 +1630,7 @@ if ($ispaymentok) {
$companylangs->loadLangs(array('main', 'members', 'bills', 'paypal', 'paybox'));
$sendto = $sendemail;
$from = $conf->global->MAILING_EMAIL_FROM;
$from = !empty($conf->global->MAILING_EMAIL_FROM) ? $conf->global->MAILING_EMAIL_FROM : getDolGlobalString("MAIN_MAIL_EMAIL_FROM");
// Define $urlwithroot
$urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
$urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
@ -1756,7 +1758,7 @@ if ($ispaymentok) {
$companylangs->loadLangs(array('main', 'members', 'bills', 'paypal', 'paybox'));
$sendto = $sendemail;
$from = $conf->global->MAILING_EMAIL_FROM;
$from = !empty($conf->global->MAILING_EMAIL_FROM) ? $conf->global->MAILING_EMAIL_FROM : getDolGlobalString("MAIN_MAIL_EMAIL_FROM");
// Define $urlwithroot
$urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
$urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file