Merge branch '18.0' of git@github.com:Dolibarr/dolibarr.git into 19.0

This commit is contained in:
Laurent Destailleur 2024-02-01 12:22:54 +01:00
commit 4cba87129c
9 changed files with 62 additions and 15 deletions

View file

@ -45,6 +45,9 @@ $action = GETPOST('action', 'aZ09');
if ($user->socid) {
$socid = $user->socid;
}
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('ordercontact', 'globalcard'));
$result = restrictedArea($user, 'commande', $id, '');
$hookmanager->initHooks(array('ordercontactcard', 'globalcard'));

View file

@ -80,6 +80,10 @@ $permissiontoadd = $usercancreate;
if ($user->socid) {
$socid = $user->socid;
}
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('orderdocument', 'globalcard'));
$result = restrictedArea($user, 'commande', $id, '');

View file

@ -9497,7 +9497,7 @@ abstract class CommonObject
foreach ($this->fields as $field => $info) {
if ($this->isDate($info)) {
if (is_null($obj->$field) || $obj->$field === '' || $obj->$field === '0000-00-00 00:00:00' || $obj->$field === '1000-01-01 00:00:00') {
if (!isset($obj->$field) || is_null($obj->$field) || $obj->$field === '' || $obj->$field === '0000-00-00 00:00:00' || $obj->$field === '1000-01-01 00:00:00') {
$this->$field = '';
} else {
$this->$field = $db->jdate($obj->$field);
@ -9513,7 +9513,7 @@ abstract class CommonObject
$this->$field = (float) $obj->$field;
}
} else {
if (!is_null($obj->$field) || (isset($info['notnull']) && $info['notnull'] == 1)) {
if (isset($obj->$field) && !is_null($obj->$field) || (isset($info['notnull']) && $info['notnull'] == 1)) {
$this->$field = (int) $obj->$field;
} else {
$this->$field = null;
@ -9528,7 +9528,7 @@ abstract class CommonObject
$this->$field = (float) $obj->$field;
}
} else {
if (!is_null($obj->$field) || (isset($info['notnull']) && $info['notnull'] == 1)) {
if (isset($obj->$field) && !is_null($obj->$field) || (isset($info['notnull']) && $info['notnull'] == 1)) {
$this->$field = (float) $obj->$field;
} else {
$this->$field = null;

View file

@ -116,7 +116,7 @@ class ExtraFields
*
* @param string $attrname Code of attribute
* @param string $label label of attribute
* @param string $type Type of attribute ('boolean','int','varchar','text','html','date','datehour','price', 'pricecy', 'phone','mail','password','url','select','checkbox','separate',...)
* @param string $type Type of attribute ('boolean','int','varchar','text','html','date','datetime','price', 'pricecy', 'phone','mail','password','url','select','checkbox','separate',...)
* @param int $pos Position of attribute
* @param string $size Size/length definition of attribute ('5', '24,8', ...). For float, it contains 2 numeric separated with a comma.
* @param string $elementtype Element type. Same value than object->table_element (Example 'member', 'product', 'thirdparty', ...)
@ -185,7 +185,7 @@ class ExtraFields
* This is a private method. For public method, use addExtraField.
*
* @param string $attrname code of attribute
* @param string $type Type of attribute ('boolean', 'int', 'varchar', 'text', 'html', 'date', 'datehour','price','pricecy','phone','mail','password','url','select','checkbox', ...)
* @param string $type Type of attribute ('boolean', 'int', 'varchar', 'text', 'html', 'date', 'datetime', 'price', 'pricecy', 'phone', 'mail', 'password', 'url', 'select', 'checkbox', ...)
* @param string $length Size/length of attribute ('5', '24,8', ...)
* @param string $elementtype Element type ('member', 'product', 'thirdparty', 'contact', ...)
* @param int $unique Is field unique or not
@ -281,7 +281,7 @@ class ExtraFields
*
* @param string $attrname code of attribute
* @param string $label label of attribute
* @param string $type Type of attribute ('int', 'varchar', 'text', 'html', 'date', 'datehour', 'float')
* @param string $type Type of attribute ('int', 'varchar', 'text', 'html', 'date', 'datehour', 'float')
* @param int $pos Position of attribute
* @param string $size Size/length of attribute ('5', '24,8', ...)
* @param string $elementtype Element type ('member', 'product', 'thirdparty', ...)
@ -529,7 +529,7 @@ class ExtraFields
*
* @param string $attrname Name of attribute
* @param string $label Label of attribute
* @param string $type Type of attribute ('boolean', 'int', 'varchar', 'text', 'html', 'date', 'datehour','price','phone','mail','password','url','select','checkbox', ...)
* @param string $type Type of attribute ('boolean', 'int', 'varchar', 'text', 'html', 'date', 'datetime','price','phone','mail','password','url','select','checkbox', ...)
* @param int $length Length of attribute
* @param string $elementtype Element type ('member', 'product', 'thirdparty', 'contact', ...)
* @param int $unique Is field unique or not

View file

@ -534,6 +534,8 @@ class FactureFournisseurRec extends CommonInvoice
$sql .= " auto_validate = ". (!empty($this->auto_validate) ? ((int) $this->auto_validate) : 0);
$sql .= " WHERE rowid = ". (int) $this->id;
$this->db->begin();
dol_syslog(get_class($this)."::update", LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql) {
@ -991,7 +993,7 @@ class FactureFournisseurRec extends CommonInvoice
$sql .= ', fk_user_author';
$sql .= ', fk_multicurrency, multicurrency_code, multicurrency_subprice, multicurrency_total_ht, multicurrency_total_tva, multicurrency_total_ttc';
$sql .= ') VALUES (';
$sql .= ' ' . (int) $facid; // source supplier invoie id
$sql .= ' ' . (int) $facid; // source supplier invoice id
$sql .= ', ' . (!empty($fk_product) ? "'" . $this->db->escape($fk_product) . "'" : 'null');
$sql .= ', ' . (!empty($ref) ? "'" . $this->db->escape($ref) . "'" : 'null');
$sql .= ', ' . (!empty($label) ? "'" . $this->db->escape($label) . "'" : 'null');
@ -2197,7 +2199,7 @@ class FactureFournisseurLigneRec extends CommonObjectLine
$sql .= ', special_code =' . (int) $this->special_code;
$sql .= ', rang = ' . (int) $this->rang;
$sql .= ', fk_unit = ' .($this->fk_unit ? "'".$this->db->escape($this->fk_unit)."'" : 'null');
$sql .= ', fk_user_modif = ' . (int) $user;
$sql .= ', fk_user_modif = ' . (int) $user->id;
$sql .= ' WHERE rowid = ' . (int) $this->id;
$this->db->begin();

View file

@ -172,7 +172,7 @@ if (empty($reshook)) {
$res = $object->add_object_linked('mo', $mo_parent->id);
}
header("Location: ".dol_buildpath('/mrp/mo_card.php?id='.((int) $moline->fk_mo), 1));
header("Location: ".dol_buildpath('/mrp/mo_card.php?id='.((int) $mo_parent->id), 1));
exit;
} elseif ($action == 'confirm_cancel' && $confirm == 'yes' && !empty($permissiontoadd)) {
$also_cancel_consumed_and_produced_lines = (GETPOST('alsoCancelConsumedAndProducedLines', 'alpha') ? 1 : 0);

View file

@ -361,9 +361,13 @@ if ($source == 'proposal') {
print '</td></tr>'."\n";
// Amount
$amount = '<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans("Amount");
$amount .= '</td><td class="CTableRow2">';
$amount .= '<b>'.price($object->total_ttc, 0, $langs, 1, -1, -1, $conf->currency).'</b>';
if ($object->multicurrency_code != $conf->currency) {
$amount .= ' ('.price($object->multicurrency_total_ttc, 0, $langs, 1, -1, -1, $object->multicurrency_code).')';
}
$amount .= '</td></tr>'."\n";
// Call Hook amountPropalSign

View file

@ -376,8 +376,18 @@ function LoadProducts(position, issubcat) {
}
?>
if (data[parseInt(idata)]['price_formated']) {
$("#proprice"+ishow).attr("class", "productprice");
$("#proprice"+ishow).html(data[parseInt(idata)]['price_ttc_formated']);
$("#proprice" + ishow).attr("class", "productprice");
<?php
if (getDolGlobalInt('TAKEPOS_CHANGE_PRICE_HT')) {
?>
$("#proprice" + ishow).html(data[parseInt(idata)]['price_formated']);
<?php
} else {
?>
$("#proprice" + ishow).html(data[parseInt(idata)]['price_ttc_formated']);
<?php
}
?>
}
console.log("#prodiv"+ishow+".data(rowid)="+data[idata]['id']);
console.log($("#prodiv"+ishow));
@ -463,8 +473,18 @@ function MoreProducts(moreorless) {
$("#probutton"+ishow).html(data[parseInt(idata)]['label']);
$("#probutton"+ishow).show();
if (data[parseInt(idata)]['price_formated']) {
$("#proprice"+ishow).attr("class", "productprice");
$("#proprice"+ishow).html(data[parseInt(idata)]['price_ttc_formated']);
$("#proprice" + ishow).attr("class", "productprice");
<?php
if (getDolGlobalInt('TAKEPOS_CHANGE_PRICE_HT')) {
?>
$("#proprice" + ishow).html(data[parseInt(idata)]['price_formated']);
<?php
} else {
?>
$("#proprice" + ishow).html(data[parseInt(idata)]['price_ttc_formated']);
<?php
}
?>
}
$("#proimg"+ishow).attr("src","genimg/index.php?query=pro&id="+data[idata]['id']);
$("#prodiv"+ishow).data("rowid",data[idata]['id']);
@ -683,7 +703,17 @@ function Search2(keyCodeForEnter, moreorless) {
$("#probutton" + i).show();
if (data[i]['price_formated']) {
$("#proprice" + i).attr("class", "productprice");
$("#proprice" + i).html(data[i]['price_ttc_formated']);
<?php
if (getDolGlobalInt('TAKEPOS_CHANGE_PRICE_HT')) {
?>
$("#proprice" + i).html(data[i]['price_formated']);
<?php
} else {
?>
$("#proprice" + i).html(data[i]['price_ttc_formated']);
<?php
}
?>
}
$("#proimg" + i).attr("title", titlestring);
if( undefined !== data[i]['img']) {

View file

@ -293,6 +293,10 @@ if (empty($reshook)) {
if ($pay != "delayed") {
$payment->create($user);
$payment->addPaymentToBank($user, 'payment', '(CustomerInvoicePayment)', $bankaccount, '', '');
if ($res < 0) {
$error++;
dol_htmloutput_errors($langs->trans('ErrorNoPaymentDefined'), $payment->errors, 1);
}
$remaintopay = $invoice->getRemainToPay(); // Recalculate remain to pay after the payment is recorded
} elseif (getDolGlobalInt("TAKEPOS_DELAYED_TERMS")) {
$invoice->setPaymentTerms(getDolGlobalInt("TAKEPOS_DELAYED_TERMS"));